@ulb-darmstadt/shacl-form 1.9.3 → 1.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/form-bootstrap.js +27 -27
- package/dist/form-default.js +36 -36
- package/dist/form-material.js +6 -6
- package/dist/plugins/mapbox.js +213 -107
- package/package.json +4 -4
- package/src/property.ts +0 -3
package/dist/form-bootstrap.js
CHANGED
|
@@ -3,8 +3,8 @@ var kr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"
|
|
|
3
3
|
*
|
|
4
4
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
5
5
|
* @license MIT
|
|
6
|
-
*/var Ka;function Dt(){return Ka||(Ka=1,function(r){const e=nu(),t=ou(),i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=s,r.SlowBuffer=E,r.INSPECT_MAX_BYTES=50;const n=2147483647;r.kMaxLength=n,s.TYPED_ARRAY_SUPPORT=o(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{const S=new Uint8Array(1),p={foo:function(){return 42}};return Object.setPrototypeOf(p,Uint8Array.prototype),Object.setPrototypeOf(S,p),S.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function a(S){if(S>n)throw new RangeError('The value "'+S+'" is invalid for option "size"');const p=new Uint8Array(S);return Object.setPrototypeOf(p,s.prototype),p}function s(S,p,h){if(typeof S=="number"){if(typeof p=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(S)}return d(S,p,h)}s.poolSize=8192;function d(S,p,h){if(typeof S=="string")return v(S,p);if(ArrayBuffer.isView(S))return y(S);if(S==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof S);if(le(S,ArrayBuffer)||S&&le(S.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(le(S,SharedArrayBuffer)||S&&le(S.buffer,SharedArrayBuffer)))return k(S,p,h);if(typeof S=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const C=S.valueOf&&S.valueOf();if(C!=null&&C!==S)return s.from(C,p,h);const Q=x(S);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof S[Symbol.toPrimitive]=="function")return s.from(S[Symbol.toPrimitive]("string"),p,h);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof S)}s.from=function(S,p,h){return d(S,p,h)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(S){if(typeof S!="number")throw new TypeError('"size" argument must be of type number');if(S<0)throw new RangeError('The value "'+S+'" is invalid for option "size"')}function c(S,p,h){return l(S),S<=0?a(S):p!==void 0?typeof h=="string"?a(S).fill(p,h):a(S).fill(p):a(S)}s.alloc=function(S,p,h){return c(S,p,h)};function u(S){return l(S),a(S<0?0:_(S)|0)}s.allocUnsafe=function(S){return u(S)},s.allocUnsafeSlow=function(S){return u(S)};function v(S,p){if((typeof p!="string"||p==="")&&(p="utf8"),!s.isEncoding(p))throw new TypeError("Unknown encoding: "+p);const h=m(S,p)|0;let C=a(h);const Q=C.write(S,p);return Q!==h&&(C=C.slice(0,Q)),C}function g(S){const p=S.length<0?0:_(S.length)|0,h=a(p);for(let C=0;C<p;C+=1)h[C]=S[C]&255;return h}function y(S){if(le(S,Uint8Array)){const p=new Uint8Array(S);return k(p.buffer,p.byteOffset,p.byteLength)}return g(S)}function k(S,p,h){if(p<0||S.byteLength<p)throw new RangeError('"offset" is outside of buffer bounds');if(S.byteLength<p+(h||0))throw new RangeError('"length" is outside of buffer bounds');let C;return p===void 0&&h===void 0?C=new Uint8Array(S):h===void 0?C=new Uint8Array(S,p):C=new Uint8Array(S,p,h),Object.setPrototypeOf(C,s.prototype),C}function x(S){if(s.isBuffer(S)){const p=_(S.length)|0,h=a(p);return h.length===0||S.copy(h,0,0,p),h}if(S.length!==void 0)return typeof S.length!="number"||Re(S.length)?a(0):g(S);if(S.type==="Buffer"&&Array.isArray(S.data))return g(S.data)}function _(S){if(S>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return S|0}function E(S){return+S!=S&&(S=0),s.alloc(+S)}s.isBuffer=function(p){return p!=null&&p._isBuffer===!0&&p!==s.prototype},s.compare=function(p,h){if(le(p,Uint8Array)&&(p=s.from(p,p.offset,p.byteLength)),le(h,Uint8Array)&&(h=s.from(h,h.offset,h.byteLength)),!s.isBuffer(p)||!s.isBuffer(h))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(p===h)return 0;let C=p.length,Q=h.length;for(let se=0,ue=Math.min(C,Q);se<ue;++se)if(p[se]!==h[se]){C=p[se],Q=h[se];break}return C<Q?-1:Q<C?1:0},s.isEncoding=function(p){switch(String(p).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}},s.concat=function(p,h){if(!Array.isArray(p))throw new TypeError('"list" argument must be an Array of Buffers');if(p.length===0)return s.alloc(0);let C;if(h===void 0)for(h=0,C=0;C<p.length;++C)h+=p[C].length;const Q=s.allocUnsafe(h);let se=0;for(C=0;C<p.length;++C){let ue=p[C];if(le(ue,Uint8Array))se+ue.length>Q.length?(s.isBuffer(ue)||(ue=s.from(ue)),ue.copy(Q,se)):Uint8Array.prototype.set.call(Q,ue,se);else if(s.isBuffer(ue))ue.copy(Q,se);else throw new TypeError('"list" argument must be an Array of Buffers');se+=ue.length}return Q};function m(S,p){if(s.isBuffer(S))return S.length;if(ArrayBuffer.isView(S)||le(S,ArrayBuffer))return S.byteLength;if(typeof S!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof S);const h=S.length,C=arguments.length>2&&arguments[2]===!0;if(!C&&h===0)return 0;let Q=!1;for(;;)switch(p){case"ascii":case"latin1":case"binary":return h;case"utf8":case"utf-8":return he(S).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return h*2;case"hex":return h>>>1;case"base64":return ce(S).length;default:if(Q)return C?-1:he(S).length;p=(""+p).toLowerCase(),Q=!0}}s.byteLength=m;function f(S,p,h){let C=!1;if((p===void 0||p<0)&&(p=0),p>this.length||((h===void 0||h>this.length)&&(h=this.length),h<=0)||(h>>>=0,p>>>=0,h<=p))return"";for(S||(S="utf8");;)switch(S){case"hex":return Y(this,p,h);case"utf8":case"utf-8":return j(this,p,h);case"ascii":return Z(this,p,h);case"latin1":case"binary":return F(this,p,h);case"base64":return A(this,p,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,p,h);default:if(C)throw new TypeError("Unknown encoding: "+S);S=(S+"").toLowerCase(),C=!0}}s.prototype._isBuffer=!0;function b(S,p,h){const C=S[p];S[p]=S[h],S[h]=C}s.prototype.swap16=function(){const p=this.length;if(p%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let h=0;h<p;h+=2)b(this,h,h+1);return this},s.prototype.swap32=function(){const p=this.length;if(p%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let h=0;h<p;h+=4)b(this,h,h+3),b(this,h+1,h+2);return this},s.prototype.swap64=function(){const p=this.length;if(p%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let h=0;h<p;h+=8)b(this,h,h+7),b(this,h+1,h+6),b(this,h+2,h+5),b(this,h+3,h+4);return this},s.prototype.toString=function(){const p=this.length;return p===0?"":arguments.length===0?j(this,0,p):f.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(p){if(!s.isBuffer(p))throw new TypeError("Argument must be a Buffer");return this===p?!0:s.compare(this,p)===0},s.prototype.inspect=function(){let p="";const h=r.INSPECT_MAX_BYTES;return p=this.toString("hex",0,h).replace(/(.{2})/g,"$1 ").trim(),this.length>h&&(p+=" ... "),"<Buffer "+p+">"},i&&(s.prototype[i]=s.prototype.inspect),s.prototype.compare=function(p,h,C,Q,se){if(le(p,Uint8Array)&&(p=s.from(p,p.offset,p.byteLength)),!s.isBuffer(p))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof p);if(h===void 0&&(h=0),C===void 0&&(C=p?p.length:0),Q===void 0&&(Q=0),se===void 0&&(se=this.length),h<0||C>p.length||Q<0||se>this.length)throw new RangeError("out of range index");if(Q>=se&&h>=C)return 0;if(Q>=se)return-1;if(h>=C)return 1;if(h>>>=0,C>>>=0,Q>>>=0,se>>>=0,this===p)return 0;let ue=se-Q,ke=C-h;const Fe=Math.min(ue,ke),je=this.slice(Q,se),De=p.slice(h,C);for(let Ae=0;Ae<Fe;++Ae)if(je[Ae]!==De[Ae]){ue=je[Ae],ke=De[Ae];break}return ue<ke?-1:ke<ue?1:0};function R(S,p,h,C,Q){if(S.length===0)return-1;if(typeof h=="string"?(C=h,h=0):h>2147483647?h=2147483647:h<-2147483648&&(h=-2147483648),h=+h,Re(h)&&(h=Q?0:S.length-1),h<0&&(h=S.length+h),h>=S.length){if(Q)return-1;h=S.length-1}else if(h<0)if(Q)h=0;else return-1;if(typeof p=="string"&&(p=s.from(p,C)),s.isBuffer(p))return p.length===0?-1:L(S,p,h,C,Q);if(typeof p=="number")return p=p&255,typeof Uint8Array.prototype.indexOf=="function"?Q?Uint8Array.prototype.indexOf.call(S,p,h):Uint8Array.prototype.lastIndexOf.call(S,p,h):L(S,[p],h,C,Q);throw new TypeError("val must be string, number or Buffer")}function L(S,p,h,C,Q){let se=1,ue=S.length,ke=p.length;if(C!==void 0&&(C=String(C).toLowerCase(),C==="ucs2"||C==="ucs-2"||C==="utf16le"||C==="utf-16le")){if(S.length<2||p.length<2)return-1;se=2,ue/=2,ke/=2,h/=2}function Fe(De,Ae){return se===1?De[Ae]:De.readUInt16BE(Ae*se)}let je;if(Q){let De=-1;for(je=h;je<ue;je++)if(Fe(S,je)===Fe(p,De===-1?0:je-De)){if(De===-1&&(De=je),je-De+1===ke)return De*se}else De!==-1&&(je-=je-De),De=-1}else for(h+ke>ue&&(h=ue-ke),je=h;je>=0;je--){let De=!0;for(let Ae=0;Ae<ke;Ae++)if(Fe(S,je+Ae)!==Fe(p,Ae)){De=!1;break}if(De)return je}return-1}s.prototype.includes=function(p,h,C){return this.indexOf(p,h,C)!==-1},s.prototype.indexOf=function(p,h,C){return R(this,p,h,C,!0)},s.prototype.lastIndexOf=function(p,h,C){return R(this,p,h,C,!1)};function T(S,p,h,C){h=Number(h)||0;const Q=S.length-h;C?(C=Number(C),C>Q&&(C=Q)):C=Q;const se=p.length;C>se/2&&(C=se/2);let ue;for(ue=0;ue<C;++ue){const ke=parseInt(p.substr(ue*2,2),16);if(Re(ke))return ue;S[h+ue]=ke}return ue}function B(S,p,h,C){return ge(he(p,S.length-h),S,h,C)}function N(S,p,h,C){return ge(me(p),S,h,C)}function $(S,p,h,C){return ge(ce(p),S,h,C)}function q(S,p,h,C){return ge(J(p,S.length-h),S,h,C)}s.prototype.write=function(p,h,C,Q){if(h===void 0)Q="utf8",C=this.length,h=0;else if(C===void 0&&typeof h=="string")Q=h,C=this.length,h=0;else if(isFinite(h))h=h>>>0,isFinite(C)?(C=C>>>0,Q===void 0&&(Q="utf8")):(Q=C,C=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const se=this.length-h;if((C===void 0||C>se)&&(C=se),p.length>0&&(C<0||h<0)||h>this.length)throw new RangeError("Attempt to write outside buffer bounds");Q||(Q="utf8");let ue=!1;for(;;)switch(Q){case"hex":return T(this,p,h,C);case"utf8":case"utf-8":return B(this,p,h,C);case"ascii":case"latin1":case"binary":return N(this,p,h,C);case"base64":return $(this,p,h,C);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,p,h,C);default:if(ue)throw new TypeError("Unknown encoding: "+Q);Q=(""+Q).toLowerCase(),ue=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(S,p,h){return p===0&&h===S.length?e.fromByteArray(S):e.fromByteArray(S.slice(p,h))}function j(S,p,h){h=Math.min(S.length,h);const C=[];let Q=p;for(;Q<h;){const se=S[Q];let ue=null,ke=se>239?4:se>223?3:se>191?2:1;if(Q+ke<=h){let Fe,je,De,Ae;switch(ke){case 1:se<128&&(ue=se);break;case 2:Fe=S[Q+1],(Fe&192)===128&&(Ae=(se&31)<<6|Fe&63,Ae>127&&(ue=Ae));break;case 3:Fe=S[Q+1],je=S[Q+2],(Fe&192)===128&&(je&192)===128&&(Ae=(se&15)<<12|(Fe&63)<<6|je&63,Ae>2047&&(Ae<55296||Ae>57343)&&(ue=Ae));break;case 4:Fe=S[Q+1],je=S[Q+2],De=S[Q+3],(Fe&192)===128&&(je&192)===128&&(De&192)===128&&(Ae=(se&15)<<18|(Fe&63)<<12|(je&63)<<6|De&63,Ae>65535&&Ae<1114112&&(ue=Ae))}}ue===null?(ue=65533,ke=1):ue>65535&&(ue-=65536,C.push(ue>>>10&1023|55296),ue=56320|ue&1023),C.push(ue),Q+=ke}return I(C)}const te=4096;function I(S){const p=S.length;if(p<=te)return String.fromCharCode.apply(String,S);let h="",C=0;for(;C<p;)h+=String.fromCharCode.apply(String,S.slice(C,C+=te));return h}function Z(S,p,h){let C="";h=Math.min(S.length,h);for(let Q=p;Q<h;++Q)C+=String.fromCharCode(S[Q]&127);return C}function F(S,p,h){let C="";h=Math.min(S.length,h);for(let Q=p;Q<h;++Q)C+=String.fromCharCode(S[Q]);return C}function Y(S,p,h){const C=S.length;(!p||p<0)&&(p=0),(!h||h<0||h>C)&&(h=C);let Q="";for(let se=p;se<h;++se)Q+=We[S[se]];return Q}function w(S,p,h){const C=S.slice(p,h);let Q="";for(let se=0;se<C.length-1;se+=2)Q+=String.fromCharCode(C[se]+C[se+1]*256);return Q}s.prototype.slice=function(p,h){const C=this.length;p=~~p,h=h===void 0?C:~~h,p<0?(p+=C,p<0&&(p=0)):p>C&&(p=C),h<0?(h+=C,h<0&&(h=0)):h>C&&(h=C),h<p&&(h=p);const Q=this.subarray(p,h);return Object.setPrototypeOf(Q,s.prototype),Q};function U(S,p,h){if(S%1!==0||S<0)throw new RangeError("offset is not uint");if(S+p>h)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(p,h,C){p=p>>>0,h=h>>>0,C||U(p,h,this.length);let Q=this[p],se=1,ue=0;for(;++ue<h&&(se*=256);)Q+=this[p+ue]*se;return Q},s.prototype.readUintBE=s.prototype.readUIntBE=function(p,h,C){p=p>>>0,h=h>>>0,C||U(p,h,this.length);let Q=this[p+--h],se=1;for(;h>0&&(se*=256);)Q+=this[p+--h]*se;return Q},s.prototype.readUint8=s.prototype.readUInt8=function(p,h){return p=p>>>0,h||U(p,1,this.length),this[p]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(p,h){return p=p>>>0,h||U(p,2,this.length),this[p]|this[p+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(p,h){return p=p>>>0,h||U(p,2,this.length),this[p]<<8|this[p+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(p,h){return p=p>>>0,h||U(p,4,this.length),(this[p]|this[p+1]<<8|this[p+2]<<16)+this[p+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(p,h){return p=p>>>0,h||U(p,4,this.length),this[p]*16777216+(this[p+1]<<16|this[p+2]<<8|this[p+3])},s.prototype.readBigUInt64LE=Ee(function(p){p=p>>>0,O(p,"offset");const h=this[p],C=this[p+7];(h===void 0||C===void 0)&&V(p,this.length-8);const Q=h+this[++p]*2**8+this[++p]*2**16+this[++p]*2**24,se=this[++p]+this[++p]*2**8+this[++p]*2**16+C*2**24;return BigInt(Q)+(BigInt(se)<<BigInt(32))}),s.prototype.readBigUInt64BE=Ee(function(p){p=p>>>0,O(p,"offset");const h=this[p],C=this[p+7];(h===void 0||C===void 0)&&V(p,this.length-8);const Q=h*2**24+this[++p]*2**16+this[++p]*2**8+this[++p],se=this[++p]*2**24+this[++p]*2**16+this[++p]*2**8+C;return(BigInt(Q)<<BigInt(32))+BigInt(se)}),s.prototype.readIntLE=function(p,h,C){p=p>>>0,h=h>>>0,C||U(p,h,this.length);let Q=this[p],se=1,ue=0;for(;++ue<h&&(se*=256);)Q+=this[p+ue]*se;return se*=128,Q>=se&&(Q-=Math.pow(2,8*h)),Q},s.prototype.readIntBE=function(p,h,C){p=p>>>0,h=h>>>0,C||U(p,h,this.length);let Q=h,se=1,ue=this[p+--Q];for(;Q>0&&(se*=256);)ue+=this[p+--Q]*se;return se*=128,ue>=se&&(ue-=Math.pow(2,8*h)),ue},s.prototype.readInt8=function(p,h){return p=p>>>0,h||U(p,1,this.length),this[p]&128?(255-this[p]+1)*-1:this[p]},s.prototype.readInt16LE=function(p,h){p=p>>>0,h||U(p,2,this.length);const C=this[p]|this[p+1]<<8;return C&32768?C|4294901760:C},s.prototype.readInt16BE=function(p,h){p=p>>>0,h||U(p,2,this.length);const C=this[p+1]|this[p]<<8;return C&32768?C|4294901760:C},s.prototype.readInt32LE=function(p,h){return p=p>>>0,h||U(p,4,this.length),this[p]|this[p+1]<<8|this[p+2]<<16|this[p+3]<<24},s.prototype.readInt32BE=function(p,h){return p=p>>>0,h||U(p,4,this.length),this[p]<<24|this[p+1]<<16|this[p+2]<<8|this[p+3]},s.prototype.readBigInt64LE=Ee(function(p){p=p>>>0,O(p,"offset");const h=this[p],C=this[p+7];(h===void 0||C===void 0)&&V(p,this.length-8);const Q=this[p+4]+this[p+5]*2**8+this[p+6]*2**16+(C<<24);return(BigInt(Q)<<BigInt(32))+BigInt(h+this[++p]*2**8+this[++p]*2**16+this[++p]*2**24)}),s.prototype.readBigInt64BE=Ee(function(p){p=p>>>0,O(p,"offset");const h=this[p],C=this[p+7];(h===void 0||C===void 0)&&V(p,this.length-8);const Q=(h<<24)+this[++p]*2**16+this[++p]*2**8+this[++p];return(BigInt(Q)<<BigInt(32))+BigInt(this[++p]*2**24+this[++p]*2**16+this[++p]*2**8+C)}),s.prototype.readFloatLE=function(p,h){return p=p>>>0,h||U(p,4,this.length),t.read(this,p,!0,23,4)},s.prototype.readFloatBE=function(p,h){return p=p>>>0,h||U(p,4,this.length),t.read(this,p,!1,23,4)},s.prototype.readDoubleLE=function(p,h){return p=p>>>0,h||U(p,8,this.length),t.read(this,p,!0,52,8)},s.prototype.readDoubleBE=function(p,h){return p=p>>>0,h||U(p,8,this.length),t.read(this,p,!1,52,8)};function K(S,p,h,C,Q,se){if(!s.isBuffer(S))throw new TypeError('"buffer" argument must be a Buffer instance');if(p>Q||p<se)throw new RangeError('"value" argument is out of bounds');if(h+C>S.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(p,h,C,Q){if(p=+p,h=h>>>0,C=C>>>0,!Q){const ke=Math.pow(2,8*C)-1;K(this,p,h,C,ke,0)}let se=1,ue=0;for(this[h]=p&255;++ue<C&&(se*=256);)this[h+ue]=p/se&255;return h+C},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(p,h,C,Q){if(p=+p,h=h>>>0,C=C>>>0,!Q){const ke=Math.pow(2,8*C)-1;K(this,p,h,C,ke,0)}let se=C-1,ue=1;for(this[h+se]=p&255;--se>=0&&(ue*=256);)this[h+se]=p/ue&255;return h+C},s.prototype.writeUint8=s.prototype.writeUInt8=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,1,255,0),this[h]=p&255,h+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,2,65535,0),this[h]=p&255,this[h+1]=p>>>8,h+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,2,65535,0),this[h]=p>>>8,this[h+1]=p&255,h+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,4,4294967295,0),this[h+3]=p>>>24,this[h+2]=p>>>16,this[h+1]=p>>>8,this[h]=p&255,h+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,4,4294967295,0),this[h]=p>>>24,this[h+1]=p>>>16,this[h+2]=p>>>8,this[h+3]=p&255,h+4};function X(S,p,h,C,Q){be(p,C,Q,S,h,7);let se=Number(p&BigInt(4294967295));S[h++]=se,se=se>>8,S[h++]=se,se=se>>8,S[h++]=se,se=se>>8,S[h++]=se;let ue=Number(p>>BigInt(32)&BigInt(4294967295));return S[h++]=ue,ue=ue>>8,S[h++]=ue,ue=ue>>8,S[h++]=ue,ue=ue>>8,S[h++]=ue,h}function de(S,p,h,C,Q){be(p,C,Q,S,h,7);let se=Number(p&BigInt(4294967295));S[h+7]=se,se=se>>8,S[h+6]=se,se=se>>8,S[h+5]=se,se=se>>8,S[h+4]=se;let ue=Number(p>>BigInt(32)&BigInt(4294967295));return S[h+3]=ue,ue=ue>>8,S[h+2]=ue,ue=ue>>8,S[h+1]=ue,ue=ue>>8,S[h]=ue,h+8}s.prototype.writeBigUInt64LE=Ee(function(p,h=0){return X(this,p,h,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=Ee(function(p,h=0){return de(this,p,h,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeIntLE=function(p,h,C,Q){if(p=+p,h=h>>>0,!Q){const Fe=Math.pow(2,8*C-1);K(this,p,h,C,Fe-1,-Fe)}let se=0,ue=1,ke=0;for(this[h]=p&255;++se<C&&(ue*=256);)p<0&&ke===0&&this[h+se-1]!==0&&(ke=1),this[h+se]=(p/ue>>0)-ke&255;return h+C},s.prototype.writeIntBE=function(p,h,C,Q){if(p=+p,h=h>>>0,!Q){const Fe=Math.pow(2,8*C-1);K(this,p,h,C,Fe-1,-Fe)}let se=C-1,ue=1,ke=0;for(this[h+se]=p&255;--se>=0&&(ue*=256);)p<0&&ke===0&&this[h+se+1]!==0&&(ke=1),this[h+se]=(p/ue>>0)-ke&255;return h+C},s.prototype.writeInt8=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,1,127,-128),p<0&&(p=255+p+1),this[h]=p&255,h+1},s.prototype.writeInt16LE=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,2,32767,-32768),this[h]=p&255,this[h+1]=p>>>8,h+2},s.prototype.writeInt16BE=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,2,32767,-32768),this[h]=p>>>8,this[h+1]=p&255,h+2},s.prototype.writeInt32LE=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,4,2147483647,-2147483648),this[h]=p&255,this[h+1]=p>>>8,this[h+2]=p>>>16,this[h+3]=p>>>24,h+4},s.prototype.writeInt32BE=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,4,2147483647,-2147483648),p<0&&(p=4294967295+p+1),this[h]=p>>>24,this[h+1]=p>>>16,this[h+2]=p>>>8,this[h+3]=p&255,h+4},s.prototype.writeBigInt64LE=Ee(function(p,h=0){return X(this,p,h,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=Ee(function(p,h=0){return de(this,p,h,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function H(S,p,h,C,Q,se){if(h+C>S.length)throw new RangeError("Index out of range");if(h<0)throw new RangeError("Index out of range")}function G(S,p,h,C,Q){return p=+p,h=h>>>0,Q||H(S,p,h,4),t.write(S,p,h,C,23,4),h+4}s.prototype.writeFloatLE=function(p,h,C){return G(this,p,h,!0,C)},s.prototype.writeFloatBE=function(p,h,C){return G(this,p,h,!1,C)};function W(S,p,h,C,Q){return p=+p,h=h>>>0,Q||H(S,p,h,8),t.write(S,p,h,C,52,8),h+8}s.prototype.writeDoubleLE=function(p,h,C){return W(this,p,h,!0,C)},s.prototype.writeDoubleBE=function(p,h,C){return W(this,p,h,!1,C)},s.prototype.copy=function(p,h,C,Q){if(!s.isBuffer(p))throw new TypeError("argument should be a Buffer");if(C||(C=0),!Q&&Q!==0&&(Q=this.length),h>=p.length&&(h=p.length),h||(h=0),Q>0&&Q<C&&(Q=C),Q===C||p.length===0||this.length===0)return 0;if(h<0)throw new RangeError("targetStart out of bounds");if(C<0||C>=this.length)throw new RangeError("Index out of range");if(Q<0)throw new RangeError("sourceEnd out of bounds");Q>this.length&&(Q=this.length),p.length-h<Q-C&&(Q=p.length-h+C);const se=Q-C;return this===p&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(h,C,Q):Uint8Array.prototype.set.call(p,this.subarray(C,Q),h),se},s.prototype.fill=function(p,h,C,Q){if(typeof p=="string"){if(typeof h=="string"?(Q=h,h=0,C=this.length):typeof C=="string"&&(Q=C,C=this.length),Q!==void 0&&typeof Q!="string")throw new TypeError("encoding must be a string");if(typeof Q=="string"&&!s.isEncoding(Q))throw new TypeError("Unknown encoding: "+Q);if(p.length===1){const ue=p.charCodeAt(0);(Q==="utf8"&&ue<128||Q==="latin1")&&(p=ue)}}else typeof p=="number"?p=p&255:typeof p=="boolean"&&(p=Number(p));if(h<0||this.length<h||this.length<C)throw new RangeError("Out of range index");if(C<=h)return this;h=h>>>0,C=C===void 0?this.length:C>>>0,p||(p=0);let se;if(typeof p=="number")for(se=h;se<C;++se)this[se]=p;else{const ue=s.isBuffer(p)?p:s.from(p,Q),ke=ue.length;if(ke===0)throw new TypeError('The value "'+p+'" is invalid for argument "value"');for(se=0;se<C-h;++se)this[se+h]=ue[se%ke]}return this};const z={};function ee(S,p,h){z[S]=class extends h{constructor(){super(),Object.defineProperty(this,"message",{value:p.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${S}]`,this.stack,delete this.name}get code(){return S}set code(Q){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Q,writable:!0})}toString(){return`${this.name} [${S}]: ${this.message}`}}}ee("ERR_BUFFER_OUT_OF_BOUNDS",function(S){return S?`${S} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ee("ERR_INVALID_ARG_TYPE",function(S,p){return`The "${S}" argument must be of type number. Received type ${typeof p}`},TypeError),ee("ERR_OUT_OF_RANGE",function(S,p,h){let C=`The value of "${S}" is out of range.`,Q=h;return Number.isInteger(h)&&Math.abs(h)>2**32?Q=re(String(h)):typeof h=="bigint"&&(Q=String(h),(h>BigInt(2)**BigInt(32)||h<-(BigInt(2)**BigInt(32)))&&(Q=re(Q)),Q+="n"),C+=` It must be ${p}. Received ${Q}`,C},RangeError);function re(S){let p="",h=S.length;const C=S[0]==="-"?1:0;for(;h>=C+4;h-=3)p=`_${S.slice(h-3,h)}${p}`;return`${S.slice(0,h)}${p}`}function pe(S,p,h){O(p,"offset"),(S[p]===void 0||S[p+h]===void 0)&&V(p,S.length-(h+1))}function be(S,p,h,C,Q,se){if(S>h||S<p){const ue=typeof p=="bigint"?"n":"";let ke;throw p===0||p===BigInt(0)?ke=`>= 0${ue} and < 2${ue} ** ${(se+1)*8}${ue}`:ke=`>= -(2${ue} ** ${(se+1)*8-1}${ue}) and < 2 ** ${(se+1)*8-1}${ue}`,new z.ERR_OUT_OF_RANGE("value",ke,S)}pe(C,Q,se)}function O(S,p){if(typeof S!="number")throw new z.ERR_INVALID_ARG_TYPE(p,"number",S)}function V(S,p,h){throw Math.floor(S)!==S?(O(S,h),new z.ERR_OUT_OF_RANGE("offset","an integer",S)):p<0?new z.ERR_BUFFER_OUT_OF_BOUNDS:new z.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${p}`,S)}const oe=/[^+/0-9A-Za-z-_]/g;function fe(S){if(S=S.split("=")[0],S=S.trim().replace(oe,""),S.length<2)return"";for(;S.length%4!==0;)S=S+"=";return S}function he(S,p){p=p||1/0;let h;const C=S.length;let Q=null;const se=[];for(let ue=0;ue<C;++ue){if(h=S.charCodeAt(ue),h>55295&&h<57344){if(!Q){if(h>56319){(p-=3)>-1&&se.push(239,191,189);continue}else if(ue+1===C){(p-=3)>-1&&se.push(239,191,189);continue}Q=h;continue}if(h<56320){(p-=3)>-1&&se.push(239,191,189),Q=h;continue}h=(Q-55296<<10|h-56320)+65536}else Q&&(p-=3)>-1&&se.push(239,191,189);if(Q=null,h<128){if((p-=1)<0)break;se.push(h)}else if(h<2048){if((p-=2)<0)break;se.push(h>>6|192,h&63|128)}else if(h<65536){if((p-=3)<0)break;se.push(h>>12|224,h>>6&63|128,h&63|128)}else if(h<1114112){if((p-=4)<0)break;se.push(h>>18|240,h>>12&63|128,h>>6&63|128,h&63|128)}else throw new Error("Invalid code point")}return se}function me(S){const p=[];for(let h=0;h<S.length;++h)p.push(S.charCodeAt(h)&255);return p}function J(S,p){let h,C,Q;const se=[];for(let ue=0;ue<S.length&&!((p-=2)<0);++ue)h=S.charCodeAt(ue),C=h>>8,Q=h%256,se.push(Q),se.push(C);return se}function ce(S){return e.toByteArray(fe(S))}function ge(S,p,h,C){let Q;for(Q=0;Q<C&&!(Q+h>=p.length||Q>=S.length);++Q)p[Q+h]=S[Q];return Q}function le(S,p){return S instanceof p||S!=null&&S.constructor!=null&&S.constructor.name!=null&&S.constructor.name===p.name}function Re(S){return S!==S}const We=function(){const S="0123456789abcdef",p=new Array(256);for(let h=0;h<16;++h){const C=h*16;for(let Q=0;Q<16;++Q)p[C+Q]=S[h]+S[Q]}return p}();function Ee(S){return typeof BigInt>"u"?Qe:S}function Qe(){throw new Error("BigInt not supported")}}(gn)),gn}var au=Dt();const zr="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Ur="http://www.w3.org/2001/XMLSchema#",Di="http://www.w3.org/2000/10/swap/",Ke={xsd:{decimal:`${Ur}decimal`,boolean:`${Ur}boolean`,double:`${Ur}double`,integer:`${Ur}integer`,string:`${Ur}string`},rdf:{type:`${zr}type`,nil:`${zr}nil`,first:`${zr}first`,rest:`${zr}rest`,langString:`${zr}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${Di}reify#forSome`,forAll:`${Di}reify#forAll`},log:{implies:`${Di}log#implies`,isImpliedBy:`${Di}log#isImpliedBy`}},{xsd:Li}=Ke,su=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Ya={"\\":"\\","'":"'",'"':'"',n:`
|
|
7
|
-
`,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},lu=/[\x00-\x20<>\\"\{\}\|\^\`]/,du={},cu=/$0^/;class uu{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._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(const t in this)!(t in du)&&this[t]instanceof RegExp&&(this[t]=cu)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let i=this._input,n=i.length;for(;;){let s,d;for(;s=this._newline.exec(i);)this.comments&&(d=this._comment.exec(s[0]))&&o("comment",d[1],"",this._line,s[0].length),i=i.substr(s[0].length,i.length),n=i.length,this._line++;if(!s&&(s=this._whitespace.exec(i))&&(i=i.substr(s[0].length,i.length)),this._endOfFile.test(i))return t&&(this.comments&&(d=this._comment.exec(i))&&o("comment",d[1],"",this._line,i.length),i=null,o("eof","","",this._line,0)),this._input=i;const l=this._line,c=i[0];let u="",v="",g="",y=null,k=0,x=!1;switch(c){case"^":if(i.length<3)break;if(i[1]==="^"){if(this._previousMarker="^^",i=i.substr(2),i[0]!=="<"){x=!0;break}}else{this._n3Mode&&(k=1,u="^");break}case"<":if(y=this._unescapedIri.exec(i))u="IRI",v=y[1];else if(y=this._iri.exec(i)){if(v=this._unescape(y[1]),v===null||lu.test(v))return a(this);u="IRI"}else i.length>1&&i[1]==="<"?(u="<<",k=2):this._n3Mode&&i.length>1&&i[1]==="="&&(k=2,this._isImpliedBy?(u="abbreviation",v="<"):(u="inverse",v=">"));break;case">":i.length>1&&i[1]===">"&&(u=">>",k=2);break;case"_":((y=this._blank.exec(i))||t&&(y=this._blank.exec(`${i} `)))&&(u="blank",g="_",v=y[1]);break;case'"':if(y=this._simpleQuotedString.exec(i))v=y[1];else if({value:v,matchLength:k}=this._parseLiteral(i),v===null)return a(this);(y!==null||k!==0)&&(u="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(y=this._simpleApostropheString.exec(i))v=y[1];else if({value:v,matchLength:k}=this._parseLiteral(i),v===null)return a(this);(y!==null||k!==0)&&(u="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(y=this._variable.exec(i))&&(u="var",v=y[0]);break;case"@":this._previousMarker==="literal"&&(y=this._langcode.exec(i))?(u="langcode",v=y[1]):(y=this._keyword.exec(i))&&(u=y[0]);break;case".":if(i.length===1?t:i[1]<"0"||i[1]>"9"){u=".",k=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(y=this._number.exec(i)||t&&(y=this._number.exec(`${i} `)))&&(u="literal",v=y[0],g=typeof y[1]=="string"?Li.double:typeof y[2]=="string"?Li.decimal:Li.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(y=this._sparqlKeyword.exec(i))?u=y[0].toUpperCase():x=!0;break;case"f":case"t":(y=this._boolean.exec(i))?(u="literal",v=y[0],g=Li.boolean):x=!0;break;case"a":(y=this._shortPredicates.exec(i))?(u="abbreviation",v="a"):x=!0;break;case"=":this._n3Mode&&i.length>1&&(u="abbreviation",i[1]!==">"?(k=1,v="="):(k=2,v=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(k=1,u=c);break;case"{":!this._lineMode&&i.length>=2&&(i[1]==="|"?(u="{|",k=2):(u=c,k=1));break;case"|":i.length>=2&&i[1]==="}"&&(u="|}",k=2);break;default:x=!0}if(x&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(y=this._prefix.exec(i))?(u="prefix",v=y[1]||""):((y=this._prefixed.exec(i))||t&&(y=this._prefixed.exec(`${i} `)))&&(u="prefixed",g=y[1]||"",v=this._unescape(y[2]))),this._previousMarker==="^^")switch(u){case"prefixed":u="type";break;case"IRI":u="typeIRI";break;default:u=""}if(!u)return t||!/^'''|^"""/.test(i)&&/\n|\r/.test(i)?a(this):this._input=i;const _=k||y[0].length,E=o(u,v,g,l,_);this.previousToken=E,this._previousMarker=u,i=i.substr(_,i.length)}function o(s,d,l,c,u){const v=i?n-i.length:n,g=v+u,y={type:s,value:d,prefix:l,line:c,start:v,end:g};return e(null,y),y}function a(s){e(s._syntaxError(/^\S*/.exec(i)[0]))}}_unescape(e){let t=!1;const i=e.replace(su,(n,o,a,s)=>{if(typeof o=="string")return String.fromCharCode(Number.parseInt(o,16));if(typeof a=="string"){let d=Number.parseInt(a,16);return d<=65535?String.fromCharCode(Number.parseInt(a,16)):String.fromCharCode(55296+((d-=65536)>>10),56320+(d&1023))}return s in Ya?Ya[s]:(t=!0,"")});return t?null:i}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],i=t.length;let n=Math.max(this._literalClosingPos,i);for(;(n=e.indexOf(t,n))>0;){let o=0;for(;e[n-o-1]==="\\";)o++;if(o%2===0){const a=e.substring(i,n),s=a.split(/\r\n|\r|\n/).length-1,d=n+i;if(i===1&&s!==0||i===3&&this._lineMode)break;return this._line+=s,{value:this._unescape(a),matchLength:d}}n++}this._literalClosingPos=e.length-i+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,typeof e=="string")if(this._input=this._readStartingBom(e),typeof t=="function")queueMicrotask(()=>this._tokenizeToEnd(t,!0));else{const i=[];let n;if(this._tokenizeToEnd((o,a)=>o?n=o:i.push(a),!0),n)throw n;return i}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",i=>{this._input!==null&&i.length!==0&&(this._pendingBuffer&&(i=au.Buffer.concat([this._pendingBuffer,i]),this._pendingBuffer=null),i[i.length-1]&128?this._pendingBuffer=i:(typeof this._input>"u"?this._input=this._readStartingBom(typeof i=="string"?i:i.toString()):this._input+=i,this._tokenizeToEnd(t,!1)))}),e.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(t,!0)}),e.on("error",t)}}const{rdf:fu,xsd:nr}=Ke;let Dr,pu=0;const Ne={namedNode:Wd,blankNode:Xd,variable:Jd,literal:Qd,defaultGraph:gu,quad:ia,triple:ia,fromTerm:ci,fromQuad:Kd};class vt{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof vt?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}let nn=class extends vt{get termType(){return"NamedNode"}},dt=class Vd extends vt{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 nn(this.datatypeString)}get datatypeString(){const e=this.id,t=e.lastIndexOf('"')+1,i=t<e.length?e[t]:"";return i==="^"?e.substr(t+2):i!=="@"?nr.string:fu.langString}equals(e){return e instanceof Vd?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}}}},hu=class extends vt{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},bu=class extends vt{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},mu=class extends vt{constructor(){return super(""),Dr||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};Dr=new mu;function di(r,e,t){if(e=e||Ne,!r)return e.defaultGraph();switch(r[0]){case"?":return e.variable(r.substr(1));case"_":return e.blankNode(r.substr(2));case'"':if(e===Ne)return new dt(r);if(r[r.length-1]==='"')return e.literal(r.substr(1,r.length-2));const i=r.lastIndexOf('"',r.length-1);return e.literal(r.substr(1,i-1),r[i+1]==="@"?r.substr(i+2):e.namedNode(r.substr(i+3)));case"[":r=JSON.parse(r);break;default:if(!t||!Array.isArray(r))return e.namedNode(r)}return e.quad(di(r[0],e,!0),di(r[1],e,!0),di(r[2],e,!0),r[3]&&di(r[3],e,!0))}function Er(r,e){if(typeof r=="string")return r;if(r instanceof vt&&r.termType!=="Quad")return r.id;if(!r)return Dr.id;switch(r.termType){case"NamedNode":return r.value;case"BlankNode":return`_:${r.value}`;case"Variable":return`?${r.value}`;case"DefaultGraph":return"";case"Literal":return`"${r.value}"${r.language?`@${r.language}`:r.datatype&&r.datatype.value!==nr.string?`^^${r.datatype.value}`:""}`;case"Quad":const t=[Er(r.subject,!0),Er(r.predicate,!0),Er(r.object,!0)];return r.graph&&r.graph.termType!=="DefaultGraph"&&t.push(Er(r.graph,!0)),e?t:JSON.stringify(t);default:throw new Error(`Unexpected termType: ${r.termType}`)}}let on=class extends vt{constructor(e,t,i,n){super(""),this._subject=e,this._predicate=t,this._object=i,this._graph=n||Dr}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 Wd(r){return new nn(r)}function Xd(r){return new hu(r||`n3-${pu++}`)}function Qd(r,e){if(typeof e=="string")return new dt(`"${r}"@${e.toLowerCase()}`);let t=e?e.value:"";return t===""&&(typeof r=="boolean"?t=nr.boolean:typeof r=="number"&&(Number.isFinite(r)?t=Number.isInteger(r)?nr.integer:nr.double:(t=nr.double,Number.isNaN(r)||(r=r>0?"INF":"-INF")))),t===""||t===nr.string?new dt(`"${r}"`):new dt(`"${r}"^^${t}`)}function Jd(r){return new bu(r)}function gu(){return Dr}function ia(r,e,t,i){return new on(r,e,t,i)}function ci(r){if(r instanceof vt)return r;switch(r.termType){case"NamedNode":return Wd(r.value);case"BlankNode":return Xd(r.value);case"Variable":return Jd(r.value);case"DefaultGraph":return Dr;case"Literal":return Qd(r.value,r.language||r.datatype);case"Quad":return Kd(r);default:throw new Error(`Unexpected termType: ${r.termType}`)}}function Kd(r){if(r instanceof on)return r;if(r.termType!=="Quad")throw new Error(`Unexpected termType: ${r.termType}`);return ia(ci(r.subject),ci(r.predicate),ci(r.object),ci(r.graph))}let Za=0;class Yd{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Zd(this,e.factory);const t=typeof e.format=="string"?e.format.match(/\w*$/)[0].toLowerCase():"",i=/turtle/.test(t),n=/trig/.test(t),o=/triple/.test(t),a=/quad/.test(t),s=this._n3Mode=/n3/.test(t),d=o||a;(this._supportsNamedGraphs=!(i||s))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(i||n||o||s),this._isImpliedBy=e.isImpliedBy,this._supportsRDFStar=t===""||/star|\*$/.test(t),d&&(this._resolveRelativeIRI=l=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new uu({lineMode:d,n3:s,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){Za=0}_setBase(e){if(!e)this._base="",this._basePath="";else{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]}}_saveContext(e,t,i,n,o){const a=this._n3Mode;this._contextStack.push({type:e,subject:i,predicate:n,object:o,graph:t,inverse:a?this._inversePredicate:!1,blankPrefix:a?this._prefixes._:"",quantified:a?this._quantified:null}),a&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(e,t){const i=this._contextStack.pop();if(!i||i.type!==e)return this._error(`Unexpected ${t.type}`,t);this._subject=i.subject,this._predicate=i.predicate,this._object=i.object,this._graph=i.graph,this._n3Mode&&(this._inversePredicate=i.inverse,this._prefixes._=i.blankPrefix,this._quantified=i.quantified)}_readInTopContext(e){switch(e.type){case"eof":return this._graph!==null?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":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 i;switch(e.type){case"IRI":case"typeIRI":const n=this._resolveIRI(e.value);if(n===null)return this._error("Invalid IRI",e);i=this._factory.namedNode(n);break;case"type":case"prefixed":const o=this._prefixes[e.prefix];if(o===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);i=this._factory.namedNode(o+e.value);break;case"blank":i=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case"var":i=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!t&&this._n3Mode&&i.id in this._quantified&&(i=this._quantified[i.id]),i}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":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._factory.blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(e.prefix.length===0)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",e);default:if((this._subject=this._readEntity(e))===void 0)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 this._predicate===null?this._error(`Unexpected ${t}`,e):(this._subject=null,t==="]"?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return this._predicate!==null?this._readPredicate:this._error("Expected predicate but got ;",e);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if((this._predicate=this._readEntity(e))===void 0)return}return this._readObject}_readObject(e){switch(e.type){case"literal":if(e.prefix.length===0)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.blankNode()),this._readBlankNodeHead;case"(":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._factory.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((this._object=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return e.type==="{"?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return e.type!=="{"?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){return e.type==="]"?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if(e.type!=="]")return this._readBlankNodePunctuation(e);this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph);const t=this._predicate===null;return this._restoreContext("blank",e),this._object!==null?this._getContextEndReader():this._predicate!==null?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,i=null,n=this._readListItem;const o=this._subject,a=this._contextStack,s=a[a.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this._subject=t=this._factory.blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),a.length!==0&&a[a.length-1].type==="list"&&this._emit(this._subject,this._predicate,this._object,this._graph),this._predicate===null){if(n=this._readPredicate,this._subject===this.RDF_NIL)return n}else if(n=this._getContextEndReader(),this._object===this.RDF_NIL)return n;i=this.RDF_NIL;break;case"literal":e.prefix.length===0?(this._literalValue=e.value,n=this._readListItemDataTypeOrLang):(t=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if((t=this._readEntity(e))===void 0)return}if(i===null&&(this._subject=i=this._factory.blankNode()),o===null?s.predicate===null?s.subject=i:s.object=i:this._emit(o,this.RDF_REST,i,this._graph),t!==null){if(this._n3Mode&&(e.type==="IRI"||e.type==="prefixed"))return this._saveContext("item",this._graph,i,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(i,this.RDF_FIRST,t,this._graph)}return n}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let t=this._factory.literal(this._literalValue);switch(e.type){case"type":case"typeIRI":const i=this._readEntity(e);if(i===void 0)return;t=this._factory.literal(this._literalValue,i),e=null;break;case"langcode":t=this._factory.literal(this._literalValue,e.value),e=null;break}return{token:e,literal:t}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,t){const i=this._completeLiteral(e);if(i)return this._object=i.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),i.token===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(i.token))}_readFormulaTail(e){return e.type!=="}"?this._readPunctuation(e):(this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),this._object===null?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let t,i=this._graph;const n=this._subject,o=this._inversePredicate;switch(e.type){case"}":if(this._graph===null)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,o&&(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 a=this._predicate,s=this._object;this._subject=this._factory.quad(n,a,s,this.DEFAULTGRAPH),t=this._readPredicate;break;case"|}":if(this._subject.termType!=="Quad")return this._error("Unexpected asserted triple closing",e);this._subject=null,t=this._readPunctuation;break;default:if(this._supportsQuads&&this._graph===null&&(i=this._readEntity(e))!==void 0){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(n!==null){const a=this._predicate,s=this._object;o?this._emit(s,a,n,i):this._emit(n,a,s,i)}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 e.type!=="prefix"?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if(e.type!=="IRI")return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);const t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){const t=e.type==="IRI"&&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._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):e.type!=="."?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let t;switch(e.type){case"IRI":case"prefixed":if((t=this._readEntity(e,!0))!==void 0)break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(this._subject===null?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return e.type===","?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const t=this._contextStack,i=t.length&&t[t.length-1];if(i&&i.type==="item"){const n=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,n,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let t,i;const n=this._factory.blankNode();if((i=this._readEntity(e))!==void 0)return this._predicate===null?(t=this._subject,this._subject=n):(t=this._object,this._object=n),this._emit(t,i,n,this._graph),this._readPath}_readBackwardPath(e){const t=this._factory.blankNode();let i,n;if((i=this._readEntity(e))!==void 0)return this._predicate===null?(n=this._subject,this._subject=t):(n=this._object,this._object=t),this._emit(t,i,n,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return e.type!==">>"?this._supportsQuads&&this._graph===null&&(this._graph=this._readEntity(e))!==void 0?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._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",e),this._subject===null?(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,i,n){this._callback(null,this._factory.quad(e,t,i,n||this.DEFAULTGRAPH))}_error(e,t){const i=new Error(`${e} on line ${t.line}.`);i.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(i),this._callback=Oi}_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 i="",n=-1,o=-1,a=0,s="/";for(;n<t;){switch(s){case":":if(o<0&&e[++n]==="/"&&e[++n]==="/")for(;(o=n+1)<t&&e[o]!=="/";)n=o;break;case"?":case"#":n=t;break;case"/":if(e[n+1]===".")switch(s=e[++n+1],s){case"/":i+=e.substring(a,n-1),a=n+1;break;case void 0:case"?":case"#":return i+e.substring(a,n)+e.substr(n+1);case".":if(s=e[++n+1],s===void 0||s==="/"||s==="?"||s==="#"){if(i+=e.substring(a,n-2),(a=i.lastIndexOf("/"))>=o&&(i=i.substr(0,a)),s!=="/")return`${i}/${e.substr(n+1)}`;a=n+1}}}s=e[++n]}return i+e.substring(a)}parse(e,t,i){let n,o,a;if(t&&(t.onQuad||t.onPrefix||t.onComment)?(n=t.onQuad,o=t.onPrefix,a=t.onComment):(n=t,o=i),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Za++}_`,this._prefixCallback=o||Oi,this._inversePredicate=!1,this._quantified=Object.create(null),!n){const d=[];let l;if(this._callback=(c,u)=>{c?l=c:u&&d.push(u)},this._lexer.tokenize(e).every(c=>this._readCallback=this._readCallback(c)),l)throw l;return d}let s=(d,l)=>{d!==null?(this._callback(d),this._callback=Oi):this._readCallback&&(this._readCallback=this._readCallback(l))};a&&(this._lexer.comments=!0,s=(d,l)=>{d!==null?(this._callback(d),this._callback=Oi):this._readCallback&&(l.type==="comment"?a(l.value):this._readCallback=this._readCallback(l))}),this._callback=n,this._lexer.tokenize(e,s)}}function Oi(){}function Zd(r,e){r._factory=e,r.DEFAULTGRAPH=e.defaultGraph(),r.RDF_FIRST=e.namedNode(Ke.rdf.first),r.RDF_REST=e.namedNode(Ke.rdf.rest),r.RDF_NIL=e.namedNode(Ke.rdf.nil),r.N3_FORALL=e.namedNode(Ke.r.forAll),r.N3_FORSOME=e.namedNode(Ke.r.forSome),r.ABBREVIATIONS={a:e.namedNode(Ke.rdf.type),"=":e.namedNode(Ke.owl.sameAs),">":e.namedNode(Ke.log.implies),"<":e.namedNode(Ke.log.isImpliedBy)},r.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}Zd(Yd.prototype,Ne);function na(r){return!!r&&r.termType==="DefaultGraph"}function Ui(r){return r.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const vu=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,yu=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,es="./",wu="../",vn="?",ts="#";class ma{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!vu.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!ma.supports(this.base))return this._baseMatcher=/.^/;const e=/^[^:]*:\/*/.exec(this.base)[0],t=["^",Ui(e)],i=[],n=[],o=/[^/?#]*([/?#])/y;let a,s=0,d=0,l=o.lastIndex=e.length;for(;!s&&!d&&(a=o.exec(this.base));)a[1]===ts?d=o.lastIndex-1:(t.push(Ui(a[0]),"(?:"),i.push(")?"),a[1]!==vn?n.push(l=o.lastIndex):(s=l=o.lastIndex,d=this.base.indexOf(ts,s),this._pathReplacements[s]=vn));for(let c=0;c<n.length;c++)this._pathReplacements[n[c]]=wu.repeat(n.length-c-1);return this._pathReplacements[n[n.length-1]]=es,this._baseLength=d>0?d:this.base.length,t.push(Ui(this.base.substring(l,this._baseLength)),s?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...t,...i].join(""))}toRelative(e){const t=this._getBaseMatcher().exec(e);if(!t)return e;const i=t[0].length;if(i===this._baseLength&&i===e.length)return"";const n=this._pathReplacements[i];if(n){const o=e.substring(i);return n!==vn&&!yu.test(o)?e:n===es&&/^[^?#]/.test(o)?o:n+o}return e.substring(i-1)}}const Hr=Ne.defaultGraph(),{rdf:xu,xsd:yr}=Ke,rs=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,is=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,_u={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class Gr extends vt{equals(e){return e===this}}class ga{constructor(e,t){if(this._prefixRegex=/$0^/,e&&typeof e.write!="function"&&(t=e,e=null),t=t||{},this._lists=t.lists,e)this._outputStream=e,this._endStream=t.end===void 0?!0:!!t.end;else{let i="";this._outputStream={write(n,o,a){i+=n,a&&a()},end:n=>{n&&n(null,i)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Hr,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new ma(t.baseIRI)))}get _inDefaultGraph(){return Hr.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t)}_writeQuad(e,t,i,n,o){try{n.equals(this._graph)||(this._write((this._subject===null?"":this._inDefaultGraph?`.
|
|
6
|
+
*/var Ka;function Dt(){return Ka||(Ka=1,function(r){const e=nu(),t=ou(),i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=s,r.SlowBuffer=E,r.INSPECT_MAX_BYTES=50;const n=2147483647;r.kMaxLength=n,s.TYPED_ARRAY_SUPPORT=o(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{const S=new Uint8Array(1),p={foo:function(){return 42}};return Object.setPrototypeOf(p,Uint8Array.prototype),Object.setPrototypeOf(S,p),S.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function a(S){if(S>n)throw new RangeError('The value "'+S+'" is invalid for option "size"');const p=new Uint8Array(S);return Object.setPrototypeOf(p,s.prototype),p}function s(S,p,h){if(typeof S=="number"){if(typeof p=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(S)}return d(S,p,h)}s.poolSize=8192;function d(S,p,h){if(typeof S=="string")return v(S,p);if(ArrayBuffer.isView(S))return y(S);if(S==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof S);if(le(S,ArrayBuffer)||S&&le(S.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(le(S,SharedArrayBuffer)||S&&le(S.buffer,SharedArrayBuffer)))return k(S,p,h);if(typeof S=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const C=S.valueOf&&S.valueOf();if(C!=null&&C!==S)return s.from(C,p,h);const Q=x(S);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof S[Symbol.toPrimitive]=="function")return s.from(S[Symbol.toPrimitive]("string"),p,h);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof S)}s.from=function(S,p,h){return d(S,p,h)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(S){if(typeof S!="number")throw new TypeError('"size" argument must be of type number');if(S<0)throw new RangeError('The value "'+S+'" is invalid for option "size"')}function c(S,p,h){return l(S),S<=0?a(S):p!==void 0?typeof h=="string"?a(S).fill(p,h):a(S).fill(p):a(S)}s.alloc=function(S,p,h){return c(S,p,h)};function u(S){return l(S),a(S<0?0:_(S)|0)}s.allocUnsafe=function(S){return u(S)},s.allocUnsafeSlow=function(S){return u(S)};function v(S,p){if((typeof p!="string"||p==="")&&(p="utf8"),!s.isEncoding(p))throw new TypeError("Unknown encoding: "+p);const h=m(S,p)|0;let C=a(h);const Q=C.write(S,p);return Q!==h&&(C=C.slice(0,Q)),C}function g(S){const p=S.length<0?0:_(S.length)|0,h=a(p);for(let C=0;C<p;C+=1)h[C]=S[C]&255;return h}function y(S){if(le(S,Uint8Array)){const p=new Uint8Array(S);return k(p.buffer,p.byteOffset,p.byteLength)}return g(S)}function k(S,p,h){if(p<0||S.byteLength<p)throw new RangeError('"offset" is outside of buffer bounds');if(S.byteLength<p+(h||0))throw new RangeError('"length" is outside of buffer bounds');let C;return p===void 0&&h===void 0?C=new Uint8Array(S):h===void 0?C=new Uint8Array(S,p):C=new Uint8Array(S,p,h),Object.setPrototypeOf(C,s.prototype),C}function x(S){if(s.isBuffer(S)){const p=_(S.length)|0,h=a(p);return h.length===0||S.copy(h,0,0,p),h}if(S.length!==void 0)return typeof S.length!="number"||Re(S.length)?a(0):g(S);if(S.type==="Buffer"&&Array.isArray(S.data))return g(S.data)}function _(S){if(S>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return S|0}function E(S){return+S!=S&&(S=0),s.alloc(+S)}s.isBuffer=function(p){return p!=null&&p._isBuffer===!0&&p!==s.prototype},s.compare=function(p,h){if(le(p,Uint8Array)&&(p=s.from(p,p.offset,p.byteLength)),le(h,Uint8Array)&&(h=s.from(h,h.offset,h.byteLength)),!s.isBuffer(p)||!s.isBuffer(h))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(p===h)return 0;let C=p.length,Q=h.length;for(let se=0,ue=Math.min(C,Q);se<ue;++se)if(p[se]!==h[se]){C=p[se],Q=h[se];break}return C<Q?-1:Q<C?1:0},s.isEncoding=function(p){switch(String(p).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}},s.concat=function(p,h){if(!Array.isArray(p))throw new TypeError('"list" argument must be an Array of Buffers');if(p.length===0)return s.alloc(0);let C;if(h===void 0)for(h=0,C=0;C<p.length;++C)h+=p[C].length;const Q=s.allocUnsafe(h);let se=0;for(C=0;C<p.length;++C){let ue=p[C];if(le(ue,Uint8Array))se+ue.length>Q.length?(s.isBuffer(ue)||(ue=s.from(ue)),ue.copy(Q,se)):Uint8Array.prototype.set.call(Q,ue,se);else if(s.isBuffer(ue))ue.copy(Q,se);else throw new TypeError('"list" argument must be an Array of Buffers');se+=ue.length}return Q};function m(S,p){if(s.isBuffer(S))return S.length;if(ArrayBuffer.isView(S)||le(S,ArrayBuffer))return S.byteLength;if(typeof S!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof S);const h=S.length,C=arguments.length>2&&arguments[2]===!0;if(!C&&h===0)return 0;let Q=!1;for(;;)switch(p){case"ascii":case"latin1":case"binary":return h;case"utf8":case"utf-8":return he(S).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return h*2;case"hex":return h>>>1;case"base64":return ce(S).length;default:if(Q)return C?-1:he(S).length;p=(""+p).toLowerCase(),Q=!0}}s.byteLength=m;function f(S,p,h){let C=!1;if((p===void 0||p<0)&&(p=0),p>this.length||((h===void 0||h>this.length)&&(h=this.length),h<=0)||(h>>>=0,p>>>=0,h<=p))return"";for(S||(S="utf8");;)switch(S){case"hex":return Y(this,p,h);case"utf8":case"utf-8":return j(this,p,h);case"ascii":return Z(this,p,h);case"latin1":case"binary":return F(this,p,h);case"base64":return A(this,p,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,p,h);default:if(C)throw new TypeError("Unknown encoding: "+S);S=(S+"").toLowerCase(),C=!0}}s.prototype._isBuffer=!0;function b(S,p,h){const C=S[p];S[p]=S[h],S[h]=C}s.prototype.swap16=function(){const p=this.length;if(p%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let h=0;h<p;h+=2)b(this,h,h+1);return this},s.prototype.swap32=function(){const p=this.length;if(p%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let h=0;h<p;h+=4)b(this,h,h+3),b(this,h+1,h+2);return this},s.prototype.swap64=function(){const p=this.length;if(p%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let h=0;h<p;h+=8)b(this,h,h+7),b(this,h+1,h+6),b(this,h+2,h+5),b(this,h+3,h+4);return this},s.prototype.toString=function(){const p=this.length;return p===0?"":arguments.length===0?j(this,0,p):f.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(p){if(!s.isBuffer(p))throw new TypeError("Argument must be a Buffer");return this===p?!0:s.compare(this,p)===0},s.prototype.inspect=function(){let p="";const h=r.INSPECT_MAX_BYTES;return p=this.toString("hex",0,h).replace(/(.{2})/g,"$1 ").trim(),this.length>h&&(p+=" ... "),"<Buffer "+p+">"},i&&(s.prototype[i]=s.prototype.inspect),s.prototype.compare=function(p,h,C,Q,se){if(le(p,Uint8Array)&&(p=s.from(p,p.offset,p.byteLength)),!s.isBuffer(p))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof p);if(h===void 0&&(h=0),C===void 0&&(C=p?p.length:0),Q===void 0&&(Q=0),se===void 0&&(se=this.length),h<0||C>p.length||Q<0||se>this.length)throw new RangeError("out of range index");if(Q>=se&&h>=C)return 0;if(Q>=se)return-1;if(h>=C)return 1;if(h>>>=0,C>>>=0,Q>>>=0,se>>>=0,this===p)return 0;let ue=se-Q,ke=C-h;const Fe=Math.min(ue,ke),je=this.slice(Q,se),De=p.slice(h,C);for(let Ae=0;Ae<Fe;++Ae)if(je[Ae]!==De[Ae]){ue=je[Ae],ke=De[Ae];break}return ue<ke?-1:ke<ue?1:0};function R(S,p,h,C,Q){if(S.length===0)return-1;if(typeof h=="string"?(C=h,h=0):h>2147483647?h=2147483647:h<-2147483648&&(h=-2147483648),h=+h,Re(h)&&(h=Q?0:S.length-1),h<0&&(h=S.length+h),h>=S.length){if(Q)return-1;h=S.length-1}else if(h<0)if(Q)h=0;else return-1;if(typeof p=="string"&&(p=s.from(p,C)),s.isBuffer(p))return p.length===0?-1:L(S,p,h,C,Q);if(typeof p=="number")return p=p&255,typeof Uint8Array.prototype.indexOf=="function"?Q?Uint8Array.prototype.indexOf.call(S,p,h):Uint8Array.prototype.lastIndexOf.call(S,p,h):L(S,[p],h,C,Q);throw new TypeError("val must be string, number or Buffer")}function L(S,p,h,C,Q){let se=1,ue=S.length,ke=p.length;if(C!==void 0&&(C=String(C).toLowerCase(),C==="ucs2"||C==="ucs-2"||C==="utf16le"||C==="utf-16le")){if(S.length<2||p.length<2)return-1;se=2,ue/=2,ke/=2,h/=2}function Fe(De,Ae){return se===1?De[Ae]:De.readUInt16BE(Ae*se)}let je;if(Q){let De=-1;for(je=h;je<ue;je++)if(Fe(S,je)===Fe(p,De===-1?0:je-De)){if(De===-1&&(De=je),je-De+1===ke)return De*se}else De!==-1&&(je-=je-De),De=-1}else for(h+ke>ue&&(h=ue-ke),je=h;je>=0;je--){let De=!0;for(let Ae=0;Ae<ke;Ae++)if(Fe(S,je+Ae)!==Fe(p,Ae)){De=!1;break}if(De)return je}return-1}s.prototype.includes=function(p,h,C){return this.indexOf(p,h,C)!==-1},s.prototype.indexOf=function(p,h,C){return R(this,p,h,C,!0)},s.prototype.lastIndexOf=function(p,h,C){return R(this,p,h,C,!1)};function T(S,p,h,C){h=Number(h)||0;const Q=S.length-h;C?(C=Number(C),C>Q&&(C=Q)):C=Q;const se=p.length;C>se/2&&(C=se/2);let ue;for(ue=0;ue<C;++ue){const ke=parseInt(p.substr(ue*2,2),16);if(Re(ke))return ue;S[h+ue]=ke}return ue}function B(S,p,h,C){return ge(he(p,S.length-h),S,h,C)}function I(S,p,h,C){return ge(me(p),S,h,C)}function $(S,p,h,C){return ge(ce(p),S,h,C)}function q(S,p,h,C){return ge(J(p,S.length-h),S,h,C)}s.prototype.write=function(p,h,C,Q){if(h===void 0)Q="utf8",C=this.length,h=0;else if(C===void 0&&typeof h=="string")Q=h,C=this.length,h=0;else if(isFinite(h))h=h>>>0,isFinite(C)?(C=C>>>0,Q===void 0&&(Q="utf8")):(Q=C,C=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const se=this.length-h;if((C===void 0||C>se)&&(C=se),p.length>0&&(C<0||h<0)||h>this.length)throw new RangeError("Attempt to write outside buffer bounds");Q||(Q="utf8");let ue=!1;for(;;)switch(Q){case"hex":return T(this,p,h,C);case"utf8":case"utf-8":return B(this,p,h,C);case"ascii":case"latin1":case"binary":return I(this,p,h,C);case"base64":return $(this,p,h,C);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,p,h,C);default:if(ue)throw new TypeError("Unknown encoding: "+Q);Q=(""+Q).toLowerCase(),ue=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(S,p,h){return p===0&&h===S.length?e.fromByteArray(S):e.fromByteArray(S.slice(p,h))}function j(S,p,h){h=Math.min(S.length,h);const C=[];let Q=p;for(;Q<h;){const se=S[Q];let ue=null,ke=se>239?4:se>223?3:se>191?2:1;if(Q+ke<=h){let Fe,je,De,Ae;switch(ke){case 1:se<128&&(ue=se);break;case 2:Fe=S[Q+1],(Fe&192)===128&&(Ae=(se&31)<<6|Fe&63,Ae>127&&(ue=Ae));break;case 3:Fe=S[Q+1],je=S[Q+2],(Fe&192)===128&&(je&192)===128&&(Ae=(se&15)<<12|(Fe&63)<<6|je&63,Ae>2047&&(Ae<55296||Ae>57343)&&(ue=Ae));break;case 4:Fe=S[Q+1],je=S[Q+2],De=S[Q+3],(Fe&192)===128&&(je&192)===128&&(De&192)===128&&(Ae=(se&15)<<18|(Fe&63)<<12|(je&63)<<6|De&63,Ae>65535&&Ae<1114112&&(ue=Ae))}}ue===null?(ue=65533,ke=1):ue>65535&&(ue-=65536,C.push(ue>>>10&1023|55296),ue=56320|ue&1023),C.push(ue),Q+=ke}return N(C)}const te=4096;function N(S){const p=S.length;if(p<=te)return String.fromCharCode.apply(String,S);let h="",C=0;for(;C<p;)h+=String.fromCharCode.apply(String,S.slice(C,C+=te));return h}function Z(S,p,h){let C="";h=Math.min(S.length,h);for(let Q=p;Q<h;++Q)C+=String.fromCharCode(S[Q]&127);return C}function F(S,p,h){let C="";h=Math.min(S.length,h);for(let Q=p;Q<h;++Q)C+=String.fromCharCode(S[Q]);return C}function Y(S,p,h){const C=S.length;(!p||p<0)&&(p=0),(!h||h<0||h>C)&&(h=C);let Q="";for(let se=p;se<h;++se)Q+=We[S[se]];return Q}function w(S,p,h){const C=S.slice(p,h);let Q="";for(let se=0;se<C.length-1;se+=2)Q+=String.fromCharCode(C[se]+C[se+1]*256);return Q}s.prototype.slice=function(p,h){const C=this.length;p=~~p,h=h===void 0?C:~~h,p<0?(p+=C,p<0&&(p=0)):p>C&&(p=C),h<0?(h+=C,h<0&&(h=0)):h>C&&(h=C),h<p&&(h=p);const Q=this.subarray(p,h);return Object.setPrototypeOf(Q,s.prototype),Q};function U(S,p,h){if(S%1!==0||S<0)throw new RangeError("offset is not uint");if(S+p>h)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(p,h,C){p=p>>>0,h=h>>>0,C||U(p,h,this.length);let Q=this[p],se=1,ue=0;for(;++ue<h&&(se*=256);)Q+=this[p+ue]*se;return Q},s.prototype.readUintBE=s.prototype.readUIntBE=function(p,h,C){p=p>>>0,h=h>>>0,C||U(p,h,this.length);let Q=this[p+--h],se=1;for(;h>0&&(se*=256);)Q+=this[p+--h]*se;return Q},s.prototype.readUint8=s.prototype.readUInt8=function(p,h){return p=p>>>0,h||U(p,1,this.length),this[p]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(p,h){return p=p>>>0,h||U(p,2,this.length),this[p]|this[p+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(p,h){return p=p>>>0,h||U(p,2,this.length),this[p]<<8|this[p+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(p,h){return p=p>>>0,h||U(p,4,this.length),(this[p]|this[p+1]<<8|this[p+2]<<16)+this[p+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(p,h){return p=p>>>0,h||U(p,4,this.length),this[p]*16777216+(this[p+1]<<16|this[p+2]<<8|this[p+3])},s.prototype.readBigUInt64LE=Ee(function(p){p=p>>>0,O(p,"offset");const h=this[p],C=this[p+7];(h===void 0||C===void 0)&&V(p,this.length-8);const Q=h+this[++p]*2**8+this[++p]*2**16+this[++p]*2**24,se=this[++p]+this[++p]*2**8+this[++p]*2**16+C*2**24;return BigInt(Q)+(BigInt(se)<<BigInt(32))}),s.prototype.readBigUInt64BE=Ee(function(p){p=p>>>0,O(p,"offset");const h=this[p],C=this[p+7];(h===void 0||C===void 0)&&V(p,this.length-8);const Q=h*2**24+this[++p]*2**16+this[++p]*2**8+this[++p],se=this[++p]*2**24+this[++p]*2**16+this[++p]*2**8+C;return(BigInt(Q)<<BigInt(32))+BigInt(se)}),s.prototype.readIntLE=function(p,h,C){p=p>>>0,h=h>>>0,C||U(p,h,this.length);let Q=this[p],se=1,ue=0;for(;++ue<h&&(se*=256);)Q+=this[p+ue]*se;return se*=128,Q>=se&&(Q-=Math.pow(2,8*h)),Q},s.prototype.readIntBE=function(p,h,C){p=p>>>0,h=h>>>0,C||U(p,h,this.length);let Q=h,se=1,ue=this[p+--Q];for(;Q>0&&(se*=256);)ue+=this[p+--Q]*se;return se*=128,ue>=se&&(ue-=Math.pow(2,8*h)),ue},s.prototype.readInt8=function(p,h){return p=p>>>0,h||U(p,1,this.length),this[p]&128?(255-this[p]+1)*-1:this[p]},s.prototype.readInt16LE=function(p,h){p=p>>>0,h||U(p,2,this.length);const C=this[p]|this[p+1]<<8;return C&32768?C|4294901760:C},s.prototype.readInt16BE=function(p,h){p=p>>>0,h||U(p,2,this.length);const C=this[p+1]|this[p]<<8;return C&32768?C|4294901760:C},s.prototype.readInt32LE=function(p,h){return p=p>>>0,h||U(p,4,this.length),this[p]|this[p+1]<<8|this[p+2]<<16|this[p+3]<<24},s.prototype.readInt32BE=function(p,h){return p=p>>>0,h||U(p,4,this.length),this[p]<<24|this[p+1]<<16|this[p+2]<<8|this[p+3]},s.prototype.readBigInt64LE=Ee(function(p){p=p>>>0,O(p,"offset");const h=this[p],C=this[p+7];(h===void 0||C===void 0)&&V(p,this.length-8);const Q=this[p+4]+this[p+5]*2**8+this[p+6]*2**16+(C<<24);return(BigInt(Q)<<BigInt(32))+BigInt(h+this[++p]*2**8+this[++p]*2**16+this[++p]*2**24)}),s.prototype.readBigInt64BE=Ee(function(p){p=p>>>0,O(p,"offset");const h=this[p],C=this[p+7];(h===void 0||C===void 0)&&V(p,this.length-8);const Q=(h<<24)+this[++p]*2**16+this[++p]*2**8+this[++p];return(BigInt(Q)<<BigInt(32))+BigInt(this[++p]*2**24+this[++p]*2**16+this[++p]*2**8+C)}),s.prototype.readFloatLE=function(p,h){return p=p>>>0,h||U(p,4,this.length),t.read(this,p,!0,23,4)},s.prototype.readFloatBE=function(p,h){return p=p>>>0,h||U(p,4,this.length),t.read(this,p,!1,23,4)},s.prototype.readDoubleLE=function(p,h){return p=p>>>0,h||U(p,8,this.length),t.read(this,p,!0,52,8)},s.prototype.readDoubleBE=function(p,h){return p=p>>>0,h||U(p,8,this.length),t.read(this,p,!1,52,8)};function K(S,p,h,C,Q,se){if(!s.isBuffer(S))throw new TypeError('"buffer" argument must be a Buffer instance');if(p>Q||p<se)throw new RangeError('"value" argument is out of bounds');if(h+C>S.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(p,h,C,Q){if(p=+p,h=h>>>0,C=C>>>0,!Q){const ke=Math.pow(2,8*C)-1;K(this,p,h,C,ke,0)}let se=1,ue=0;for(this[h]=p&255;++ue<C&&(se*=256);)this[h+ue]=p/se&255;return h+C},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(p,h,C,Q){if(p=+p,h=h>>>0,C=C>>>0,!Q){const ke=Math.pow(2,8*C)-1;K(this,p,h,C,ke,0)}let se=C-1,ue=1;for(this[h+se]=p&255;--se>=0&&(ue*=256);)this[h+se]=p/ue&255;return h+C},s.prototype.writeUint8=s.prototype.writeUInt8=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,1,255,0),this[h]=p&255,h+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,2,65535,0),this[h]=p&255,this[h+1]=p>>>8,h+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,2,65535,0),this[h]=p>>>8,this[h+1]=p&255,h+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,4,4294967295,0),this[h+3]=p>>>24,this[h+2]=p>>>16,this[h+1]=p>>>8,this[h]=p&255,h+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,4,4294967295,0),this[h]=p>>>24,this[h+1]=p>>>16,this[h+2]=p>>>8,this[h+3]=p&255,h+4};function X(S,p,h,C,Q){be(p,C,Q,S,h,7);let se=Number(p&BigInt(4294967295));S[h++]=se,se=se>>8,S[h++]=se,se=se>>8,S[h++]=se,se=se>>8,S[h++]=se;let ue=Number(p>>BigInt(32)&BigInt(4294967295));return S[h++]=ue,ue=ue>>8,S[h++]=ue,ue=ue>>8,S[h++]=ue,ue=ue>>8,S[h++]=ue,h}function de(S,p,h,C,Q){be(p,C,Q,S,h,7);let se=Number(p&BigInt(4294967295));S[h+7]=se,se=se>>8,S[h+6]=se,se=se>>8,S[h+5]=se,se=se>>8,S[h+4]=se;let ue=Number(p>>BigInt(32)&BigInt(4294967295));return S[h+3]=ue,ue=ue>>8,S[h+2]=ue,ue=ue>>8,S[h+1]=ue,ue=ue>>8,S[h]=ue,h+8}s.prototype.writeBigUInt64LE=Ee(function(p,h=0){return X(this,p,h,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=Ee(function(p,h=0){return de(this,p,h,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeIntLE=function(p,h,C,Q){if(p=+p,h=h>>>0,!Q){const Fe=Math.pow(2,8*C-1);K(this,p,h,C,Fe-1,-Fe)}let se=0,ue=1,ke=0;for(this[h]=p&255;++se<C&&(ue*=256);)p<0&&ke===0&&this[h+se-1]!==0&&(ke=1),this[h+se]=(p/ue>>0)-ke&255;return h+C},s.prototype.writeIntBE=function(p,h,C,Q){if(p=+p,h=h>>>0,!Q){const Fe=Math.pow(2,8*C-1);K(this,p,h,C,Fe-1,-Fe)}let se=C-1,ue=1,ke=0;for(this[h+se]=p&255;--se>=0&&(ue*=256);)p<0&&ke===0&&this[h+se+1]!==0&&(ke=1),this[h+se]=(p/ue>>0)-ke&255;return h+C},s.prototype.writeInt8=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,1,127,-128),p<0&&(p=255+p+1),this[h]=p&255,h+1},s.prototype.writeInt16LE=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,2,32767,-32768),this[h]=p&255,this[h+1]=p>>>8,h+2},s.prototype.writeInt16BE=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,2,32767,-32768),this[h]=p>>>8,this[h+1]=p&255,h+2},s.prototype.writeInt32LE=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,4,2147483647,-2147483648),this[h]=p&255,this[h+1]=p>>>8,this[h+2]=p>>>16,this[h+3]=p>>>24,h+4},s.prototype.writeInt32BE=function(p,h,C){return p=+p,h=h>>>0,C||K(this,p,h,4,2147483647,-2147483648),p<0&&(p=4294967295+p+1),this[h]=p>>>24,this[h+1]=p>>>16,this[h+2]=p>>>8,this[h+3]=p&255,h+4},s.prototype.writeBigInt64LE=Ee(function(p,h=0){return X(this,p,h,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=Ee(function(p,h=0){return de(this,p,h,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function H(S,p,h,C,Q,se){if(h+C>S.length)throw new RangeError("Index out of range");if(h<0)throw new RangeError("Index out of range")}function G(S,p,h,C,Q){return p=+p,h=h>>>0,Q||H(S,p,h,4),t.write(S,p,h,C,23,4),h+4}s.prototype.writeFloatLE=function(p,h,C){return G(this,p,h,!0,C)},s.prototype.writeFloatBE=function(p,h,C){return G(this,p,h,!1,C)};function W(S,p,h,C,Q){return p=+p,h=h>>>0,Q||H(S,p,h,8),t.write(S,p,h,C,52,8),h+8}s.prototype.writeDoubleLE=function(p,h,C){return W(this,p,h,!0,C)},s.prototype.writeDoubleBE=function(p,h,C){return W(this,p,h,!1,C)},s.prototype.copy=function(p,h,C,Q){if(!s.isBuffer(p))throw new TypeError("argument should be a Buffer");if(C||(C=0),!Q&&Q!==0&&(Q=this.length),h>=p.length&&(h=p.length),h||(h=0),Q>0&&Q<C&&(Q=C),Q===C||p.length===0||this.length===0)return 0;if(h<0)throw new RangeError("targetStart out of bounds");if(C<0||C>=this.length)throw new RangeError("Index out of range");if(Q<0)throw new RangeError("sourceEnd out of bounds");Q>this.length&&(Q=this.length),p.length-h<Q-C&&(Q=p.length-h+C);const se=Q-C;return this===p&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(h,C,Q):Uint8Array.prototype.set.call(p,this.subarray(C,Q),h),se},s.prototype.fill=function(p,h,C,Q){if(typeof p=="string"){if(typeof h=="string"?(Q=h,h=0,C=this.length):typeof C=="string"&&(Q=C,C=this.length),Q!==void 0&&typeof Q!="string")throw new TypeError("encoding must be a string");if(typeof Q=="string"&&!s.isEncoding(Q))throw new TypeError("Unknown encoding: "+Q);if(p.length===1){const ue=p.charCodeAt(0);(Q==="utf8"&&ue<128||Q==="latin1")&&(p=ue)}}else typeof p=="number"?p=p&255:typeof p=="boolean"&&(p=Number(p));if(h<0||this.length<h||this.length<C)throw new RangeError("Out of range index");if(C<=h)return this;h=h>>>0,C=C===void 0?this.length:C>>>0,p||(p=0);let se;if(typeof p=="number")for(se=h;se<C;++se)this[se]=p;else{const ue=s.isBuffer(p)?p:s.from(p,Q),ke=ue.length;if(ke===0)throw new TypeError('The value "'+p+'" is invalid for argument "value"');for(se=0;se<C-h;++se)this[se+h]=ue[se%ke]}return this};const z={};function ee(S,p,h){z[S]=class extends h{constructor(){super(),Object.defineProperty(this,"message",{value:p.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${S}]`,this.stack,delete this.name}get code(){return S}set code(Q){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Q,writable:!0})}toString(){return`${this.name} [${S}]: ${this.message}`}}}ee("ERR_BUFFER_OUT_OF_BOUNDS",function(S){return S?`${S} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ee("ERR_INVALID_ARG_TYPE",function(S,p){return`The "${S}" argument must be of type number. Received type ${typeof p}`},TypeError),ee("ERR_OUT_OF_RANGE",function(S,p,h){let C=`The value of "${S}" is out of range.`,Q=h;return Number.isInteger(h)&&Math.abs(h)>2**32?Q=re(String(h)):typeof h=="bigint"&&(Q=String(h),(h>BigInt(2)**BigInt(32)||h<-(BigInt(2)**BigInt(32)))&&(Q=re(Q)),Q+="n"),C+=` It must be ${p}. Received ${Q}`,C},RangeError);function re(S){let p="",h=S.length;const C=S[0]==="-"?1:0;for(;h>=C+4;h-=3)p=`_${S.slice(h-3,h)}${p}`;return`${S.slice(0,h)}${p}`}function pe(S,p,h){O(p,"offset"),(S[p]===void 0||S[p+h]===void 0)&&V(p,S.length-(h+1))}function be(S,p,h,C,Q,se){if(S>h||S<p){const ue=typeof p=="bigint"?"n":"";let ke;throw p===0||p===BigInt(0)?ke=`>= 0${ue} and < 2${ue} ** ${(se+1)*8}${ue}`:ke=`>= -(2${ue} ** ${(se+1)*8-1}${ue}) and < 2 ** ${(se+1)*8-1}${ue}`,new z.ERR_OUT_OF_RANGE("value",ke,S)}pe(C,Q,se)}function O(S,p){if(typeof S!="number")throw new z.ERR_INVALID_ARG_TYPE(p,"number",S)}function V(S,p,h){throw Math.floor(S)!==S?(O(S,h),new z.ERR_OUT_OF_RANGE("offset","an integer",S)):p<0?new z.ERR_BUFFER_OUT_OF_BOUNDS:new z.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${p}`,S)}const oe=/[^+/0-9A-Za-z-_]/g;function fe(S){if(S=S.split("=")[0],S=S.trim().replace(oe,""),S.length<2)return"";for(;S.length%4!==0;)S=S+"=";return S}function he(S,p){p=p||1/0;let h;const C=S.length;let Q=null;const se=[];for(let ue=0;ue<C;++ue){if(h=S.charCodeAt(ue),h>55295&&h<57344){if(!Q){if(h>56319){(p-=3)>-1&&se.push(239,191,189);continue}else if(ue+1===C){(p-=3)>-1&&se.push(239,191,189);continue}Q=h;continue}if(h<56320){(p-=3)>-1&&se.push(239,191,189),Q=h;continue}h=(Q-55296<<10|h-56320)+65536}else Q&&(p-=3)>-1&&se.push(239,191,189);if(Q=null,h<128){if((p-=1)<0)break;se.push(h)}else if(h<2048){if((p-=2)<0)break;se.push(h>>6|192,h&63|128)}else if(h<65536){if((p-=3)<0)break;se.push(h>>12|224,h>>6&63|128,h&63|128)}else if(h<1114112){if((p-=4)<0)break;se.push(h>>18|240,h>>12&63|128,h>>6&63|128,h&63|128)}else throw new Error("Invalid code point")}return se}function me(S){const p=[];for(let h=0;h<S.length;++h)p.push(S.charCodeAt(h)&255);return p}function J(S,p){let h,C,Q;const se=[];for(let ue=0;ue<S.length&&!((p-=2)<0);++ue)h=S.charCodeAt(ue),C=h>>8,Q=h%256,se.push(Q),se.push(C);return se}function ce(S){return e.toByteArray(fe(S))}function ge(S,p,h,C){let Q;for(Q=0;Q<C&&!(Q+h>=p.length||Q>=S.length);++Q)p[Q+h]=S[Q];return Q}function le(S,p){return S instanceof p||S!=null&&S.constructor!=null&&S.constructor.name!=null&&S.constructor.name===p.name}function Re(S){return S!==S}const We=function(){const S="0123456789abcdef",p=new Array(256);for(let h=0;h<16;++h){const C=h*16;for(let Q=0;Q<16;++Q)p[C+Q]=S[h]+S[Q]}return p}();function Ee(S){return typeof BigInt>"u"?Qe:S}function Qe(){throw new Error("BigInt not supported")}}(gn)),gn}var au=Dt();const zr="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Ur="http://www.w3.org/2001/XMLSchema#",Di="http://www.w3.org/2000/10/swap/",Ke={xsd:{decimal:`${Ur}decimal`,boolean:`${Ur}boolean`,double:`${Ur}double`,integer:`${Ur}integer`,string:`${Ur}string`},rdf:{type:`${zr}type`,nil:`${zr}nil`,first:`${zr}first`,rest:`${zr}rest`,langString:`${zr}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${Di}reify#forSome`,forAll:`${Di}reify#forAll`},log:{implies:`${Di}log#implies`,isImpliedBy:`${Di}log#isImpliedBy`}},{xsd:Li}=Ke,su=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Ya={"\\":"\\","'":"'",'"':'"',n:`
|
|
7
|
+
`,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},lu=/[\x00-\x20<>\\"\{\}\|\^\`]/,du={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},cu=/$0^/;class uu{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._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(const t in this)!(t in du)&&this[t]instanceof RegExp&&(this[t]=cu)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let i=this._input,n=i.length;for(;;){let s,d;for(;s=this._newline.exec(i);)this.comments&&(d=this._comment.exec(s[0]))&&o("comment",d[1],"",this._line,s[0].length),i=i.substr(s[0].length,i.length),n=i.length,this._line++;if(!s&&(s=this._whitespace.exec(i))&&(i=i.substr(s[0].length,i.length)),this._endOfFile.test(i))return t&&(this.comments&&(d=this._comment.exec(i))&&o("comment",d[1],"",this._line,i.length),i=null,o("eof","","",this._line,0)),this._input=i;const l=this._line,c=i[0];let u="",v="",g="",y=null,k=0,x=!1;switch(c){case"^":if(i.length<3)break;if(i[1]==="^"){if(this._previousMarker="^^",i=i.substr(2),i[0]!=="<"){x=!0;break}}else{this._n3Mode&&(k=1,u="^");break}case"<":if(y=this._unescapedIri.exec(i))u="IRI",v=y[1];else if(y=this._iri.exec(i)){if(v=this._unescape(y[1]),v===null||lu.test(v))return a(this);u="IRI"}else i.length>1&&i[1]==="<"?(u="<<",k=2):this._n3Mode&&i.length>1&&i[1]==="="&&(k=2,this._isImpliedBy?(u="abbreviation",v="<"):(u="inverse",v=">"));break;case">":i.length>1&&i[1]===">"&&(u=">>",k=2);break;case"_":((y=this._blank.exec(i))||t&&(y=this._blank.exec(`${i} `)))&&(u="blank",g="_",v=y[1]);break;case'"':if(y=this._simpleQuotedString.exec(i))v=y[1];else if({value:v,matchLength:k}=this._parseLiteral(i),v===null)return a(this);(y!==null||k!==0)&&(u="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(y=this._simpleApostropheString.exec(i))v=y[1];else if({value:v,matchLength:k}=this._parseLiteral(i),v===null)return a(this);(y!==null||k!==0)&&(u="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(y=this._variable.exec(i))&&(u="var",v=y[0]);break;case"@":this._previousMarker==="literal"&&(y=this._langcode.exec(i))?(u="langcode",v=y[1]):(y=this._keyword.exec(i))&&(u=y[0]);break;case".":if(i.length===1?t:i[1]<"0"||i[1]>"9"){u=".",k=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(y=this._number.exec(i)||t&&(y=this._number.exec(`${i} `)))&&(u="literal",v=y[0],g=typeof y[1]=="string"?Li.double:typeof y[2]=="string"?Li.decimal:Li.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(y=this._sparqlKeyword.exec(i))?u=y[0].toUpperCase():x=!0;break;case"f":case"t":(y=this._boolean.exec(i))?(u="literal",v=y[0],g=Li.boolean):x=!0;break;case"a":(y=this._shortPredicates.exec(i))?(u="abbreviation",v="a"):x=!0;break;case"=":this._n3Mode&&i.length>1&&(u="abbreviation",i[1]!==">"?(k=1,v="="):(k=2,v=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(k=1,u=c);break;case"{":!this._lineMode&&i.length>=2&&(i[1]==="|"?(u="{|",k=2):(u=c,k=1));break;case"|":i.length>=2&&i[1]==="}"&&(u="|}",k=2);break;default:x=!0}if(x&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(y=this._prefix.exec(i))?(u="prefix",v=y[1]||""):((y=this._prefixed.exec(i))||t&&(y=this._prefixed.exec(`${i} `)))&&(u="prefixed",g=y[1]||"",v=this._unescape(y[2]))),this._previousMarker==="^^")switch(u){case"prefixed":u="type";break;case"IRI":u="typeIRI";break;default:u=""}if(!u)return t||!/^'''|^"""/.test(i)&&/\n|\r/.test(i)?a(this):this._input=i;const _=k||y[0].length,E=o(u,v,g,l,_);this.previousToken=E,this._previousMarker=u,i=i.substr(_,i.length)}function o(s,d,l,c,u){const v=i?n-i.length:n,g=v+u,y={type:s,value:d,prefix:l,line:c,start:v,end:g};return e(null,y),y}function a(s){e(s._syntaxError(/^\S*/.exec(i)[0]))}}_unescape(e){let t=!1;const i=e.replace(su,(n,o,a,s)=>{if(typeof o=="string")return String.fromCharCode(Number.parseInt(o,16));if(typeof a=="string"){let d=Number.parseInt(a,16);return d<=65535?String.fromCharCode(Number.parseInt(a,16)):String.fromCharCode(55296+((d-=65536)>>10),56320+(d&1023))}return s in Ya?Ya[s]:(t=!0,"")});return t?null:i}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],i=t.length;let n=Math.max(this._literalClosingPos,i);for(;(n=e.indexOf(t,n))>0;){let o=0;for(;e[n-o-1]==="\\";)o++;if(o%2===0){const a=e.substring(i,n),s=a.split(/\r\n|\r|\n/).length-1,d=n+i;if(i===1&&s!==0||i===3&&this._lineMode)break;return this._line+=s,{value:this._unescape(a),matchLength:d}}n++}this._literalClosingPos=e.length-i+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,typeof e=="string")if(this._input=this._readStartingBom(e),typeof t=="function")queueMicrotask(()=>this._tokenizeToEnd(t,!0));else{const i=[];let n;if(this._tokenizeToEnd((o,a)=>o?n=o:i.push(a),!0),n)throw n;return i}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",i=>{this._input!==null&&i.length!==0&&(this._pendingBuffer&&(i=au.Buffer.concat([this._pendingBuffer,i]),this._pendingBuffer=null),i[i.length-1]&128?this._pendingBuffer=i:(typeof this._input>"u"?this._input=this._readStartingBom(typeof i=="string"?i:i.toString()):this._input+=i,this._tokenizeToEnd(t,!1)))}),e.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(t,!0)}),e.on("error",t)}}const{rdf:fu,xsd:nr}=Ke;let Dr,pu=0;const Ie={namedNode:Wd,blankNode:Xd,variable:Jd,literal:Qd,defaultGraph:gu,quad:ia,triple:ia,fromTerm:ci,fromQuad:Kd};class vt{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof vt?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}let nn=class extends vt{get termType(){return"NamedNode"}},dt=class Vd extends vt{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 nn(this.datatypeString)}get datatypeString(){const e=this.id,t=e.lastIndexOf('"')+1,i=t<e.length?e[t]:"";return i==="^"?e.substr(t+2):i!=="@"?nr.string:fu.langString}equals(e){return e instanceof Vd?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}}}},hu=class extends vt{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},bu=class extends vt{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},mu=class extends vt{constructor(){return super(""),Dr||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};Dr=new mu;function di(r,e,t){if(e=e||Ie,!r)return e.defaultGraph();switch(r[0]){case"?":return e.variable(r.substr(1));case"_":return e.blankNode(r.substr(2));case'"':if(e===Ie)return new dt(r);if(r[r.length-1]==='"')return e.literal(r.substr(1,r.length-2));const i=r.lastIndexOf('"',r.length-1);return e.literal(r.substr(1,i-1),r[i+1]==="@"?r.substr(i+2):e.namedNode(r.substr(i+3)));case"[":r=JSON.parse(r);break;default:if(!t||!Array.isArray(r))return e.namedNode(r)}return e.quad(di(r[0],e,!0),di(r[1],e,!0),di(r[2],e,!0),r[3]&&di(r[3],e,!0))}function Er(r,e){if(typeof r=="string")return r;if(r instanceof vt&&r.termType!=="Quad")return r.id;if(!r)return Dr.id;switch(r.termType){case"NamedNode":return r.value;case"BlankNode":return`_:${r.value}`;case"Variable":return`?${r.value}`;case"DefaultGraph":return"";case"Literal":return`"${r.value}"${r.language?`@${r.language}`:r.datatype&&r.datatype.value!==nr.string?`^^${r.datatype.value}`:""}`;case"Quad":const t=[Er(r.subject,!0),Er(r.predicate,!0),Er(r.object,!0)];return r.graph&&r.graph.termType!=="DefaultGraph"&&t.push(Er(r.graph,!0)),e?t:JSON.stringify(t);default:throw new Error(`Unexpected termType: ${r.termType}`)}}let on=class extends vt{constructor(e,t,i,n){super(""),this._subject=e,this._predicate=t,this._object=i,this._graph=n||Dr}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 Wd(r){return new nn(r)}function Xd(r){return new hu(r||`n3-${pu++}`)}function Qd(r,e){if(typeof e=="string")return new dt(`"${r}"@${e.toLowerCase()}`);let t=e?e.value:"";return t===""&&(typeof r=="boolean"?t=nr.boolean:typeof r=="number"&&(Number.isFinite(r)?t=Number.isInteger(r)?nr.integer:nr.double:(t=nr.double,Number.isNaN(r)||(r=r>0?"INF":"-INF")))),t===""||t===nr.string?new dt(`"${r}"`):new dt(`"${r}"^^${t}`)}function Jd(r){return new bu(r)}function gu(){return Dr}function ia(r,e,t,i){return new on(r,e,t,i)}function ci(r){if(r instanceof vt)return r;switch(r.termType){case"NamedNode":return Wd(r.value);case"BlankNode":return Xd(r.value);case"Variable":return Jd(r.value);case"DefaultGraph":return Dr;case"Literal":return Qd(r.value,r.language||r.datatype);case"Quad":return Kd(r);default:throw new Error(`Unexpected termType: ${r.termType}`)}}function Kd(r){if(r instanceof on)return r;if(r.termType!=="Quad")throw new Error(`Unexpected termType: ${r.termType}`);return ia(ci(r.subject),ci(r.predicate),ci(r.object),ci(r.graph))}let Za=0;class Yd{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Zd(this,e.factory);const t=typeof e.format=="string"?e.format.match(/\w*$/)[0].toLowerCase():"",i=/turtle/.test(t),n=/trig/.test(t),o=/triple/.test(t),a=/quad/.test(t),s=this._n3Mode=/n3/.test(t),d=o||a;(this._supportsNamedGraphs=!(i||s))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(i||n||o||s),this._isImpliedBy=e.isImpliedBy,this._supportsRDFStar=t===""||/star|\*$/.test(t),d&&(this._resolveRelativeIRI=l=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new uu({lineMode:d,n3:s,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){Za=0}_setBase(e){if(!e)this._base="",this._basePath="";else{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]}}_saveContext(e,t,i,n,o){const a=this._n3Mode;this._contextStack.push({type:e,subject:i,predicate:n,object:o,graph:t,inverse:a?this._inversePredicate:!1,blankPrefix:a?this._prefixes._:"",quantified:a?this._quantified:null}),a&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(e,t){const i=this._contextStack.pop();if(!i||i.type!==e)return this._error(`Unexpected ${t.type}`,t);this._subject=i.subject,this._predicate=i.predicate,this._object=i.object,this._graph=i.graph,this._n3Mode&&(this._inversePredicate=i.inverse,this._prefixes._=i.blankPrefix,this._quantified=i.quantified)}_readInTopContext(e){switch(e.type){case"eof":return this._graph!==null?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":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 i;switch(e.type){case"IRI":case"typeIRI":const n=this._resolveIRI(e.value);if(n===null)return this._error("Invalid IRI",e);i=this._factory.namedNode(n);break;case"type":case"prefixed":const o=this._prefixes[e.prefix];if(o===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);i=this._factory.namedNode(o+e.value);break;case"blank":i=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case"var":i=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!t&&this._n3Mode&&i.id in this._quantified&&(i=this._quantified[i.id]),i}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":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._factory.blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(e.prefix.length===0)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",e);default:if((this._subject=this._readEntity(e))===void 0)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 this._predicate===null?this._error(`Unexpected ${t}`,e):(this._subject=null,t==="]"?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return this._predicate!==null?this._readPredicate:this._error("Expected predicate but got ;",e);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if((this._predicate=this._readEntity(e))===void 0)return}return this._readObject}_readObject(e){switch(e.type){case"literal":if(e.prefix.length===0)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.blankNode()),this._readBlankNodeHead;case"(":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._factory.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((this._object=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return e.type==="{"?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return e.type!=="{"?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){return e.type==="]"?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if(e.type!=="]")return this._readBlankNodePunctuation(e);this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph);const t=this._predicate===null;return this._restoreContext("blank",e),this._object!==null?this._getContextEndReader():this._predicate!==null?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,i=null,n=this._readListItem;const o=this._subject,a=this._contextStack,s=a[a.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this._subject=t=this._factory.blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),a.length!==0&&a[a.length-1].type==="list"&&this._emit(this._subject,this._predicate,this._object,this._graph),this._predicate===null){if(n=this._readPredicate,this._subject===this.RDF_NIL)return n}else if(n=this._getContextEndReader(),this._object===this.RDF_NIL)return n;i=this.RDF_NIL;break;case"literal":e.prefix.length===0?(this._literalValue=e.value,n=this._readListItemDataTypeOrLang):(t=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if((t=this._readEntity(e))===void 0)return}if(i===null&&(this._subject=i=this._factory.blankNode()),o===null?s.predicate===null?s.subject=i:s.object=i:this._emit(o,this.RDF_REST,i,this._graph),t!==null){if(this._n3Mode&&(e.type==="IRI"||e.type==="prefixed"))return this._saveContext("item",this._graph,i,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(i,this.RDF_FIRST,t,this._graph)}return n}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let t=this._factory.literal(this._literalValue);switch(e.type){case"type":case"typeIRI":const i=this._readEntity(e);if(i===void 0)return;t=this._factory.literal(this._literalValue,i),e=null;break;case"langcode":t=this._factory.literal(this._literalValue,e.value),e=null;break}return{token:e,literal:t}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,t){const i=this._completeLiteral(e);if(i)return this._object=i.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),i.token===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(i.token))}_readFormulaTail(e){return e.type!=="}"?this._readPunctuation(e):(this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),this._object===null?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let t,i=this._graph;const n=this._subject,o=this._inversePredicate;switch(e.type){case"}":if(this._graph===null)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,o&&(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 a=this._predicate,s=this._object;this._subject=this._factory.quad(n,a,s,this.DEFAULTGRAPH),t=this._readPredicate;break;case"|}":if(this._subject.termType!=="Quad")return this._error("Unexpected asserted triple closing",e);this._subject=null,t=this._readPunctuation;break;default:if(this._supportsQuads&&this._graph===null&&(i=this._readEntity(e))!==void 0){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(n!==null){const a=this._predicate,s=this._object;o?this._emit(s,a,n,i):this._emit(n,a,s,i)}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 e.type!=="prefix"?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if(e.type!=="IRI")return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);const t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){const t=e.type==="IRI"&&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._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):e.type!=="."?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let t;switch(e.type){case"IRI":case"prefixed":if((t=this._readEntity(e,!0))!==void 0)break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(this._subject===null?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return e.type===","?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const t=this._contextStack,i=t.length&&t[t.length-1];if(i&&i.type==="item"){const n=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,n,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let t,i;const n=this._factory.blankNode();if((i=this._readEntity(e))!==void 0)return this._predicate===null?(t=this._subject,this._subject=n):(t=this._object,this._object=n),this._emit(t,i,n,this._graph),this._readPath}_readBackwardPath(e){const t=this._factory.blankNode();let i,n;if((i=this._readEntity(e))!==void 0)return this._predicate===null?(n=this._subject,this._subject=t):(n=this._object,this._object=t),this._emit(t,i,n,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return e.type!==">>"?this._supportsQuads&&this._graph===null&&(this._graph=this._readEntity(e))!==void 0?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._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",e),this._subject===null?(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,i,n){this._callback(null,this._factory.quad(e,t,i,n||this.DEFAULTGRAPH))}_error(e,t){const i=new Error(`${e} on line ${t.line}.`);i.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(i),this._callback=Oi}_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 i="",n=-1,o=-1,a=0,s="/";for(;n<t;){switch(s){case":":if(o<0&&e[++n]==="/"&&e[++n]==="/")for(;(o=n+1)<t&&e[o]!=="/";)n=o;break;case"?":case"#":n=t;break;case"/":if(e[n+1]===".")switch(s=e[++n+1],s){case"/":i+=e.substring(a,n-1),a=n+1;break;case void 0:case"?":case"#":return i+e.substring(a,n)+e.substr(n+1);case".":if(s=e[++n+1],s===void 0||s==="/"||s==="?"||s==="#"){if(i+=e.substring(a,n-2),(a=i.lastIndexOf("/"))>=o&&(i=i.substr(0,a)),s!=="/")return`${i}/${e.substr(n+1)}`;a=n+1}}}s=e[++n]}return i+e.substring(a)}parse(e,t,i){let n,o,a;if(t&&(t.onQuad||t.onPrefix||t.onComment)?(n=t.onQuad,o=t.onPrefix,a=t.onComment):(n=t,o=i),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Za++}_`,this._prefixCallback=o||Oi,this._inversePredicate=!1,this._quantified=Object.create(null),!n){const d=[];let l;if(this._callback=(c,u)=>{c?l=c:u&&d.push(u)},this._lexer.tokenize(e).every(c=>this._readCallback=this._readCallback(c)),l)throw l;return d}let s=(d,l)=>{d!==null?(this._callback(d),this._callback=Oi):this._readCallback&&(this._readCallback=this._readCallback(l))};a&&(this._lexer.comments=!0,s=(d,l)=>{d!==null?(this._callback(d),this._callback=Oi):this._readCallback&&(l.type==="comment"?a(l.value):this._readCallback=this._readCallback(l))}),this._callback=n,this._lexer.tokenize(e,s)}}function Oi(){}function Zd(r,e){r._factory=e,r.DEFAULTGRAPH=e.defaultGraph(),r.RDF_FIRST=e.namedNode(Ke.rdf.first),r.RDF_REST=e.namedNode(Ke.rdf.rest),r.RDF_NIL=e.namedNode(Ke.rdf.nil),r.N3_FORALL=e.namedNode(Ke.r.forAll),r.N3_FORSOME=e.namedNode(Ke.r.forSome),r.ABBREVIATIONS={a:e.namedNode(Ke.rdf.type),"=":e.namedNode(Ke.owl.sameAs),">":e.namedNode(Ke.log.implies),"<":e.namedNode(Ke.log.isImpliedBy)},r.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}Zd(Yd.prototype,Ie);function na(r){return!!r&&r.termType==="DefaultGraph"}function Ui(r){return r.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const vu=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,yu=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,es="./",wu="../",vn="?",ts="#";class ma{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!vu.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!ma.supports(this.base))return this._baseMatcher=/.^/;const e=/^[^:]*:\/*/.exec(this.base)[0],t=["^",Ui(e)],i=[],n=[],o=/[^/?#]*([/?#])/y;let a,s=0,d=0,l=o.lastIndex=e.length;for(;!s&&!d&&(a=o.exec(this.base));)a[1]===ts?d=o.lastIndex-1:(t.push(Ui(a[0]),"(?:"),i.push(")?"),a[1]!==vn?n.push(l=o.lastIndex):(s=l=o.lastIndex,d=this.base.indexOf(ts,s),this._pathReplacements[s]=vn));for(let c=0;c<n.length;c++)this._pathReplacements[n[c]]=wu.repeat(n.length-c-1);return this._pathReplacements[n[n.length-1]]=es,this._baseLength=d>0?d:this.base.length,t.push(Ui(this.base.substring(l,this._baseLength)),s?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...t,...i].join(""))}toRelative(e){const t=this._getBaseMatcher().exec(e);if(!t)return e;const i=t[0].length;if(i===this._baseLength&&i===e.length)return"";const n=this._pathReplacements[i];if(n){const o=e.substring(i);return n!==vn&&!yu.test(o)?e:n===es&&/^[^?#]/.test(o)?o:n+o}return e.substring(i-1)}}const Hr=Ie.defaultGraph(),{rdf:xu,xsd:yr}=Ke,rs=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,is=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,_u={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class Gr extends vt{equals(e){return e===this}}class ga{constructor(e,t){if(this._prefixRegex=/$0^/,e&&typeof e.write!="function"&&(t=e,e=null),t=t||{},this._lists=t.lists,e)this._outputStream=e,this._endStream=t.end===void 0?!0:!!t.end;else{let i="";this._outputStream={write(n,o,a){i+=n,a&&a()},end:n=>{n&&n(null,i)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Hr,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new ma(t.baseIRI)))}get _inDefaultGraph(){return Hr.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t)}_writeQuad(e,t,i,n,o){try{n.equals(this._graph)||(this._write((this._subject===null?"":this._inDefaultGraph?`.
|
|
8
8
|
`:`
|
|
9
9
|
}
|
|
10
10
|
`)+(Hr.equals(n)?"":`${this._encodeIriOrBlank(n)} {
|
|
@@ -24,7 +24,7 @@ var kr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"
|
|
|
24
24
|
`:`
|
|
25
25
|
}
|
|
26
26
|
`),this._subject=null),this._write=this._blockedWrite;let t=e&&((i,n)=>{t=null,e(i,n)});if(this._endStream)try{return this._outputStream.end(t)}catch{}t&&t()}}function ns(r){let e=_u[r];return e===void 0&&(r.length===1?(e=r.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}var yn={exports:{}},wn={exports:{}},xn,os;function Be(){if(os)return xn;os=1;class r extends Error{constructor(t){if(!Array.isArray(t))throw new TypeError(`Expected input to be an Array, got ${typeof t}`);let i="";for(let n=0;n<t.length;n++)i+=` ${t[n].stack}
|
|
27
|
-
`;super(i),this.name="AggregateError",this.errors=t}}return xn={AggregateError:r,ArrayIsArray(e){return Array.isArray(e)},ArrayPrototypeIncludes(e,t){return e.includes(t)},ArrayPrototypeIndexOf(e,t){return e.indexOf(t)},ArrayPrototypeJoin(e,t){return e.join(t)},ArrayPrototypeMap(e,t){return e.map(t)},ArrayPrototypePop(e,t){return e.pop(t)},ArrayPrototypePush(e,t){return e.push(t)},ArrayPrototypeSlice(e,t,i){return e.slice(t,i)},Error,FunctionPrototypeCall(e,t,...i){return e.call(t,...i)},FunctionPrototypeSymbolHasInstance(e,t){return 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){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,i){return Object.defineProperty(e,t,i)},ObjectGetOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(e,t)},ObjectKeys(e){return Object.keys(e)},ObjectSetPrototypeOf(e,t){return Object.setPrototypeOf(e,t)},Promise,PromisePrototypeCatch(e,t){return e.catch(t)},PromisePrototypeThen(e,t,i){return e.then(t,i)},PromiseReject(e){return Promise.reject(e)},PromiseResolve(e){return Promise.resolve(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest(e,t){return e.test(t)},SafeSet:Set,String,StringPrototypeSlice(e,t,i){return e.slice(t,i)},StringPrototypeToLowerCase(e){return e.toLowerCase()},StringPrototypeToUpperCase(e){return e.toUpperCase()},StringPrototypeTrim(e){return 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,i){return e.set(t,i)},Boolean,Uint8Array},xn}var _n={exports:{}},kn,as;function ec(){return as||(as=1,kn={format(r,...e){return r.replace(/%([sdifj])/g,function(...[t,i]){const n=e.shift();return i==="f"?n.toFixed(6):i==="j"?JSON.stringify(n):i==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},inspect(r){switch(typeof r){case"string":if(r.includes("'"))if(r.includes('"')){if(!r.includes("`")&&!r.includes("${"))return`\`${r}\``}else return`"${r}"`;return`'${r}'`;case"number":return isNaN(r)?"NaN":Object.is(r,-0)?String(r):r;case"bigint":return`${String(r)}n`;case"boolean":case"undefined":return String(r);case"object":return"{}"}}}),kn}var En,ss;function it(){if(ss)return En;ss=1;const{format:r,inspect:e}=ec(),{AggregateError:t}=Be(),i=globalThis.AggregateError||t,n=Symbol("kIsNodeError"),o=["string","function","number","object","Function","Object","boolean","bigint","symbol"],a=/^([A-Z][a-z0-9]*)+$/,s="__node_internal_",d={};function l(x,_){if(!x)throw new d.ERR_INTERNAL_ASSERTION(_)}function c(x){let _="",E=x.length;const m=x[0]==="-"?1:0;for(;E>=m+4;E-=3)_=`_${x.slice(E-3,E)}${_}`;return`${x.slice(0,E)}${_}`}function u(x,_,E){if(typeof _=="function")return l(_.length<=E.length,`Code: ${x}; The provided arguments length (${E.length}) does not match the required ones (${_.length}).`),_(...E);const m=(_.match(/%[dfijoOs]/g)||[]).length;return l(m===E.length,`Code: ${x}; The provided arguments length (${E.length}) does not match the required ones (${m}).`),E.length===0?_:r(_,...E)}function v(x,_,E){E||(E=Error);class m extends E{constructor(...b){super(u(x,_,b))}toString(){return`${this.name} [${x}]: ${this.message}`}}Object.defineProperties(m.prototype,{name:{value:E.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${x}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),m.prototype.code=x,m.prototype[n]=!0,d[x]=m}function g(x){const _=s+x.name;return Object.defineProperty(x,"name",{value:_}),x}function y(x,_){if(x&&_&&x!==_){if(Array.isArray(_.errors))return _.errors.push(x),_;const E=new i([_,x],_.message);return E.code=_.code,E}return x||_}class k extends Error{constructor(_="The operation was aborted",E=void 0){if(E!==void 0&&typeof E!="object")throw new d.ERR_INVALID_ARG_TYPE("options","Object",E);super(_,E),this.code="ABORT_ERR",this.name="AbortError"}}return v("ERR_ASSERTION","%s",Error),v("ERR_INVALID_ARG_TYPE",(x,_,E)=>{l(typeof x=="string","'name' must be a string"),Array.isArray(_)||(_=[_]);let m="The ";x.endsWith(" argument")?m+=`${x} `:m+=`"${x}" ${x.includes(".")?"property":"argument"} `,m+="must be ";const f=[],b=[],R=[];for(const T of _)l(typeof T=="string","All expected entries have to be of type string"),o.includes(T)?f.push(T.toLowerCase()):a.test(T)?b.push(T):(l(T!=="object",'The value "object" should be written as "Object"'),R.push(T));if(b.length>0){const T=f.indexOf("object");T!==-1&&(f.splice(f,T,1),b.push("Object"))}if(f.length>0){switch(f.length){case 1:m+=`of type ${f[0]}`;break;case 2:m+=`one of type ${f[0]} or ${f[1]}`;break;default:{const T=f.pop();m+=`one of type ${f.join(", ")}, or ${T}`}}(b.length>0||R.length>0)&&(m+=" or ")}if(b.length>0){switch(b.length){case 1:m+=`an instance of ${b[0]}`;break;case 2:m+=`an instance of ${b[0]} or ${b[1]}`;break;default:{const T=b.pop();m+=`an instance of ${b.join(", ")}, or ${T}`}}R.length>0&&(m+=" or ")}switch(R.length){case 0:break;case 1:R[0].toLowerCase()!==R[0]&&(m+="an "),m+=`${R[0]}`;break;case 2:m+=`one of ${R[0]} or ${R[1]}`;break;default:{const T=R.pop();m+=`one of ${R.join(", ")}, or ${T}`}}if(E==null)m+=`. Received ${E}`;else if(typeof E=="function"&&E.name)m+=`. Received function ${E.name}`;else if(typeof E=="object"){var L;if((L=E.constructor)!==null&&L!==void 0&&L.name)m+=`. Received an instance of ${E.constructor.name}`;else{const T=e(E,{depth:-1});m+=`. Received ${T}`}}else{let T=e(E,{colors:!1});T.length>25&&(T=`${T.slice(0,25)}...`),m+=`. Received type ${typeof E} (${T})`}return m},TypeError),v("ERR_INVALID_ARG_VALUE",(x,_,E="is invalid")=>{let m=e(_);return m.length>128&&(m=m.slice(0,128)+"..."),`The ${x.includes(".")?"property":"argument"} '${x}' ${E}. Received ${m}`},TypeError),v("ERR_INVALID_RETURN_VALUE",(x,_,E)=>{var m;const f=E!=null&&(m=E.constructor)!==null&&m!==void 0&&m.name?`instance of ${E.constructor.name}`:`type ${typeof E}`;return`Expected ${x} to be returned from the "${_}" function but got ${f}.`},TypeError),v("ERR_MISSING_ARGS",(...x)=>{l(x.length>0,"At least one arg needs to be specified");let _;const E=x.length;switch(x=(Array.isArray(x)?x:[x]).map(m=>`"${m}"`).join(" or "),E){case 1:_+=`The ${x[0]} argument`;break;case 2:_+=`The ${x[0]} and ${x[1]} arguments`;break;default:{const m=x.pop();_+=`The ${x.join(", ")}, and ${m} arguments`}break}return`${_} must be specified`},TypeError),v("ERR_OUT_OF_RANGE",(x,_,E)=>{l(_,'Missing "range" argument');let m;if(Number.isInteger(E)&&Math.abs(E)>2**32)m=c(String(E));else if(typeof E=="bigint"){m=String(E);const f=BigInt(2)**BigInt(32);(E>f||E<-f)&&(m=c(m)),m+="n"}else m=e(E);return`The value of "${x}" is out of range. It must be ${_}. Received ${m}`},RangeError),v("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),v("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),v("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),v("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),v("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),v("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),v("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),v("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),v("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),v("ERR_STREAM_WRITE_AFTER_END","write after end",Error),v("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),En={AbortError:k,aggregateTwoErrors:g(y),hideStackFrames:g,codes:d},En}var Vr={exports:{}},ls;function yi(){if(ls)return Vr.exports;ls=1;const{AbortController:r,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return Vr.exports=r,Vr.exports.AbortSignal=e,Vr.exports.default=r,Vr.exports}var Ci={exports:{}},ds;function an(){if(ds)return Ci.exports;ds=1;var r=typeof Reflect=="object"?Reflect:null,e=r&&typeof r.apply=="function"?r.apply:function(b,R,L){return Function.prototype.apply.call(b,R,L)},t;r&&typeof r.ownKeys=="function"?t=r.ownKeys:Object.getOwnPropertySymbols?t=function(b){return Object.getOwnPropertyNames(b).concat(Object.getOwnPropertySymbols(b))}:t=function(b){return Object.getOwnPropertyNames(b)};function i(f){console&&console.warn&&console.warn(f)}var n=Number.isNaN||function(b){return b!==b};function o(){o.init.call(this)}Ci.exports=o,Ci.exports.once=_,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(f){if(typeof f!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof f)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(f){if(typeof f!="number"||f<0||n(f))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+f+".");a=f}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(b){if(typeof b!="number"||b<0||n(b))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+b+".");return this._maxListeners=b,this};function d(f){return f._maxListeners===void 0?o.defaultMaxListeners:f._maxListeners}o.prototype.getMaxListeners=function(){return d(this)},o.prototype.emit=function(b){for(var R=[],L=1;L<arguments.length;L++)R.push(arguments[L]);var T=b==="error",B=this._events;if(B!==void 0)T=T&&B.error===void 0;else if(!T)return!1;if(T){var N;if(R.length>0&&(N=R[0]),N instanceof Error)throw N;var $=new Error("Unhandled error."+(N?" ("+N.message+")":""));throw $.context=N,$}var q=B[b];if(q===void 0)return!1;if(typeof q=="function")e(q,this,R);else for(var A=q.length,j=y(q,A),L=0;L<A;++L)e(j[L],this,R);return!0};function l(f,b,R,L){var T,B,N;if(s(R),B=f._events,B===void 0?(B=f._events=Object.create(null),f._eventsCount=0):(B.newListener!==void 0&&(f.emit("newListener",b,R.listener?R.listener:R),B=f._events),N=B[b]),N===void 0)N=B[b]=R,++f._eventsCount;else if(typeof N=="function"?N=B[b]=L?[R,N]:[N,R]:L?N.unshift(R):N.push(R),T=d(f),T>0&&N.length>T&&!N.warned){N.warned=!0;var $=new Error("Possible EventEmitter memory leak detected. "+N.length+" "+String(b)+" listeners added. Use emitter.setMaxListeners() to increase limit");$.name="MaxListenersExceededWarning",$.emitter=f,$.type=b,$.count=N.length,i($)}return f}o.prototype.addListener=function(b,R){return l(this,b,R,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(b,R){return l(this,b,R,!0)};function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(f,b,R){var L={fired:!1,wrapFn:void 0,target:f,type:b,listener:R},T=c.bind(L);return T.listener=R,L.wrapFn=T,T}o.prototype.once=function(b,R){return s(R),this.on(b,u(this,b,R)),this},o.prototype.prependOnceListener=function(b,R){return s(R),this.prependListener(b,u(this,b,R)),this},o.prototype.removeListener=function(b,R){var L,T,B,N,$;if(s(R),T=this._events,T===void 0)return this;if(L=T[b],L===void 0)return this;if(L===R||L.listener===R)--this._eventsCount===0?this._events=Object.create(null):(delete T[b],T.removeListener&&this.emit("removeListener",b,L.listener||R));else if(typeof L!="function"){for(B=-1,N=L.length-1;N>=0;N--)if(L[N]===R||L[N].listener===R){$=L[N].listener,B=N;break}if(B<0)return this;B===0?L.shift():k(L,B),L.length===1&&(T[b]=L[0]),T.removeListener!==void 0&&this.emit("removeListener",b,$||R)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(b){var R,L,T;if(L=this._events,L===void 0)return this;if(L.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):L[b]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete L[b]),this;if(arguments.length===0){var B=Object.keys(L),N;for(T=0;T<B.length;++T)N=B[T],N!=="removeListener"&&this.removeAllListeners(N);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(R=L[b],typeof R=="function")this.removeListener(b,R);else if(R!==void 0)for(T=R.length-1;T>=0;T--)this.removeListener(b,R[T]);return this};function v(f,b,R){var L=f._events;if(L===void 0)return[];var T=L[b];return T===void 0?[]:typeof T=="function"?R?[T.listener||T]:[T]:R?x(T):y(T,T.length)}o.prototype.listeners=function(b){return v(this,b,!0)},o.prototype.rawListeners=function(b){return v(this,b,!1)},o.listenerCount=function(f,b){return typeof f.listenerCount=="function"?f.listenerCount(b):g.call(f,b)},o.prototype.listenerCount=g;function g(f){var b=this._events;if(b!==void 0){var R=b[f];if(typeof R=="function")return 1;if(R!==void 0)return R.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function y(f,b){for(var R=new Array(b),L=0;L<b;++L)R[L]=f[L];return R}function k(f,b){for(;b+1<f.length;b++)f[b]=f[b+1];f.pop()}function x(f){for(var b=new Array(f.length),R=0;R<b.length;++R)b[R]=f[R].listener||f[R];return b}function _(f,b){return new Promise(function(R,L){function T(N){f.removeListener(b,B),L(N)}function B(){typeof f.removeListener=="function"&&f.removeListener("error",T),R([].slice.call(arguments))}m(f,b,B,{once:!0}),b!=="error"&&E(f,T,{once:!0})})}function E(f,b,R){typeof f.on=="function"&&m(f,"error",b,R)}function m(f,b,R,L){if(typeof f.on=="function")L.once?f.once(b,R):f.on(b,R);else if(typeof f.addEventListener=="function")f.addEventListener(b,function T(B){L.once&&f.removeEventListener(b,T),R(B)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof f)}return Ci.exports}var cs;function at(){return cs||(cs=1,function(r){const e=Dt(),{format:t,inspect:i}=ec(),{codes:{ERR_INVALID_ARG_TYPE:n}}=it(),{kResistStopPropagation:o,AggregateError:a,SymbolDispose:s}=Be(),d=globalThis.AbortSignal||yi().AbortSignal,l=globalThis.AbortController||yi().AbortController,c=Object.getPrototypeOf(async function(){}).constructor,u=globalThis.Blob||e.Blob,v=typeof u<"u"?function(x){return x instanceof u}:function(x){return!1},g=(k,x)=>{if(k!==void 0&&(k===null||typeof k!="object"||!("aborted"in k)))throw new n(x,"AbortSignal",k)},y=(k,x)=>{if(typeof k!="function")throw new n(x,"Function",k)};r.exports={AggregateError:a,kEmptyObject:Object.freeze({}),once(k){let x=!1;return function(..._){x||(x=!0,k.apply(this,_))}},createDeferredPromise:function(){let k,x;return{promise:new Promise((E,m)=>{k=E,x=m}),resolve:k,reject:x}},promisify(k){return new Promise((x,_)=>{k((E,...m)=>E?_(E):x(...m))})},debuglog(){return function(){}},format:t,inspect:i,types:{isAsyncFunction(k){return k instanceof c},isArrayBufferView(k){return ArrayBuffer.isView(k)}},isBlob:v,deprecate(k,x){return k},addAbortListener:an().addAbortListener||function(x,_){if(x===void 0)throw new n("signal","AbortSignal",x);g(x,"signal"),y(_,"listener");let E;return x.aborted?queueMicrotask(()=>_()):(x.addEventListener("abort",_,{__proto__:null,once:!0,[o]:!0}),E=()=>{x.removeEventListener("abort",_)}),{__proto__:null,[s](){var m;(m=E)===null||m===void 0||m()}}},AbortSignalAny:d.any||function(x){if(x.length===1)return x[0];const _=new l,E=()=>_.abort();return x.forEach(m=>{g(m,"signals"),m.addEventListener("abort",E,{once:!0})}),_.signal.addEventListener("abort",()=>{x.forEach(m=>m.removeEventListener("abort",E))},{once:!0}),_.signal}},r.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}(_n)),_n.exports}var $i={},Sn,us;function Ei(){if(us)return Sn;us=1;const{ArrayIsArray:r,ArrayPrototypeIncludes:e,ArrayPrototypeJoin:t,ArrayPrototypeMap:i,NumberIsInteger:n,NumberIsNaN:o,NumberMAX_SAFE_INTEGER:a,NumberMIN_SAFE_INTEGER:s,NumberParseInt:d,ObjectPrototypeHasOwnProperty:l,RegExpPrototypeExec:c,String:u,StringPrototypeToUpperCase:v,StringPrototypeTrim:g}=Be(),{hideStackFrames:y,codes:{ERR_SOCKET_BAD_PORT:k,ERR_INVALID_ARG_TYPE:x,ERR_INVALID_ARG_VALUE:_,ERR_OUT_OF_RANGE:E,ERR_UNKNOWN_SIGNAL:m}}=it(),{normalizeEncoding:f}=at(),{isAsyncFunction:b,isArrayBufferView:R}=at().types,L={};function T(J){return J===(J|0)}function B(J){return J===J>>>0}const N=/^[0-7]+$/,$="must be a 32-bit unsigned integer or an octal string";function q(J,ce,ge){if(typeof J>"u"&&(J=ge),typeof J=="string"){if(c(N,J)===null)throw new _(ce,J,$);J=d(J,8)}return te(J,ce),J}const A=y((J,ce,ge=s,le=a)=>{if(typeof J!="number")throw new x(ce,"number",J);if(!n(J))throw new E(ce,"an integer",J);if(J<ge||J>le)throw new E(ce,`>= ${ge} && <= ${le}`,J)}),j=y((J,ce,ge=-2147483648,le=2147483647)=>{if(typeof J!="number")throw new x(ce,"number",J);if(!n(J))throw new E(ce,"an integer",J);if(J<ge||J>le)throw new E(ce,`>= ${ge} && <= ${le}`,J)}),te=y((J,ce,ge=!1)=>{if(typeof J!="number")throw new x(ce,"number",J);if(!n(J))throw new E(ce,"an integer",J);const le=ge?1:0,Re=4294967295;if(J<le||J>Re)throw new E(ce,`>= ${le} && <= ${Re}`,J)});function I(J,ce){if(typeof J!="string")throw new x(ce,"string",J)}function Z(J,ce,ge=void 0,le){if(typeof J!="number")throw new x(ce,"number",J);if(ge!=null&&J<ge||le!=null&&J>le||(ge!=null||le!=null)&&o(J))throw new E(ce,`${ge!=null?`>= ${ge}`:""}${ge!=null&&le!=null?" && ":""}${le!=null?`<= ${le}`:""}`,J)}const F=y((J,ce,ge)=>{if(!e(ge,J)){const Re="must be one of: "+t(i(ge,We=>typeof We=="string"?`'${We}'`:u(We)),", ");throw new _(ce,J,Re)}});function Y(J,ce){if(typeof J!="boolean")throw new x(ce,"boolean",J)}function w(J,ce,ge){return J==null||!l(J,ce)?ge:J[ce]}const U=y((J,ce,ge=null)=>{const le=w(ge,"allowArray",!1),Re=w(ge,"allowFunction",!1);if(!w(ge,"nullable",!1)&&J===null||!le&&r(J)||typeof J!="object"&&(!Re||typeof J!="function"))throw new x(ce,"Object",J)}),K=y((J,ce)=>{if(J!=null&&typeof J!="object"&&typeof J!="function")throw new x(ce,"a dictionary",J)}),X=y((J,ce,ge=0)=>{if(!r(J))throw new x(ce,"Array",J);if(J.length<ge){const le=`must be longer than ${ge}`;throw new _(ce,J,le)}});function de(J,ce){X(J,ce);for(let ge=0;ge<J.length;ge++)I(J[ge],`${ce}[${ge}]`)}function H(J,ce){X(J,ce);for(let ge=0;ge<J.length;ge++)Y(J[ge],`${ce}[${ge}]`)}function G(J,ce){X(J,ce);for(let ge=0;ge<J.length;ge++){const le=J[ge],Re=`${ce}[${ge}]`;if(le==null)throw new x(Re,"AbortSignal",le);pe(le,Re)}}function W(J,ce="signal"){if(I(J,ce),L[J]===void 0)throw L[v(J)]!==void 0?new m(J+" (signals must use all capital letters)"):new m(J)}const z=y((J,ce="buffer")=>{if(!R(J))throw new x(ce,["Buffer","TypedArray","DataView"],J)});function ee(J,ce){const ge=f(ce),le=J.length;if(ge==="hex"&&le%2!==0)throw new _("encoding",ce,`is invalid for data of length ${le}`)}function re(J,ce="Port",ge=!0){if(typeof J!="number"&&typeof J!="string"||typeof J=="string"&&g(J).length===0||+J!==+J>>>0||J>65535||J===0&&!ge)throw new k(ce,J,ge);return J|0}const pe=y((J,ce)=>{if(J!==void 0&&(J===null||typeof J!="object"||!("aborted"in J)))throw new x(ce,"AbortSignal",J)}),be=y((J,ce)=>{if(typeof J!="function")throw new x(ce,"Function",J)}),O=y((J,ce)=>{if(typeof J!="function"||b(J))throw new x(ce,"Function",J)}),V=y((J,ce)=>{if(J!==void 0)throw new x(ce,"undefined",J)});function oe(J,ce,ge){if(!e(ge,J))throw new x(ce,`('${t(ge,"|")}')`,J)}const fe=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function he(J,ce){if(typeof J>"u"||!c(fe,J))throw new _(ce,J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function me(J){if(typeof J=="string")return he(J,"hints"),J;if(r(J)){const ce=J.length;let ge="";if(ce===0)return ge;for(let le=0;le<ce;le++){const Re=J[le];he(Re,"hints"),ge+=Re,le!==ce-1&&(ge+=", ")}return ge}throw new _("hints",J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return Sn={isInt32:T,isUint32:B,parseFileMode:q,validateArray:X,validateStringArray:de,validateBooleanArray:H,validateAbortSignalArray:G,validateBoolean:Y,validateBuffer:z,validateDictionary:K,validateEncoding:ee,validateFunction:be,validateInt32:j,validateInteger:A,validateNumber:Z,validateObject:U,validateOneOf:F,validatePlainFunction:O,validatePort:re,validateSignalName:W,validateString:I,validateUint32:te,validateUndefined:V,validateUnion:oe,validateAbortSignal:pe,validateLinkHeaderValue:me},Sn}var Fi={exports:{}},Rn={exports:{}},fs;function ur(){if(fs)return Rn.exports;fs=1;var r=Rn.exports={},e,t;function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=i}catch{e=i}try{typeof clearTimeout=="function"?t=clearTimeout:t=n}catch{t=n}})();function o(k){if(e===setTimeout)return setTimeout(k,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(k,0);try{return e(k,0)}catch{try{return e.call(null,k,0)}catch{return e.call(this,k,0)}}}function a(k){if(t===clearTimeout)return clearTimeout(k);if((t===n||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(k);try{return t(k)}catch{try{return t.call(null,k)}catch{return t.call(this,k)}}}var s=[],d=!1,l,c=-1;function u(){!d||!l||(d=!1,l.length?s=l.concat(s):c=-1,s.length&&v())}function v(){if(!d){var k=o(u);d=!0;for(var x=s.length;x;){for(l=s,s=[];++c<x;)l&&l[c].run();c=-1,x=s.length}l=null,d=!1,a(k)}}r.nextTick=function(k){var x=new Array(arguments.length-1);if(arguments.length>1)for(var _=1;_<arguments.length;_++)x[_-1]=arguments[_];s.push(new g(k,x)),s.length===1&&!d&&o(v)};function g(k,x){this.fun=k,this.array=x}g.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={};function y(){}return r.on=y,r.addListener=y,r.once=y,r.off=y,r.removeListener=y,r.removeAllListeners=y,r.emit=y,r.prependListener=y,r.prependOnceListener=y,r.listeners=function(k){return[]},r.binding=function(k){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(k){throw new Error("process.chdir is not supported")},r.umask=function(){return 0},Rn.exports}var Nn,ps;function Lt(){if(ps)return Nn;ps=1;const{SymbolAsyncIterator:r,SymbolIterator:e,SymbolFor:t}=Be(),i=t("nodejs.stream.destroyed"),n=t("nodejs.stream.errored"),o=t("nodejs.stream.readable"),a=t("nodejs.stream.writable"),s=t("nodejs.stream.disturbed"),d=t("nodejs.webstream.isClosedPromise"),l=t("nodejs.webstream.controllerErrorFunction");function c(w,U=!1){var K;return!!(w&&typeof w.pipe=="function"&&typeof w.on=="function"&&(!U||typeof w.pause=="function"&&typeof w.resume=="function")&&(!w._writableState||((K=w._readableState)===null||K===void 0?void 0:K.readable)!==!1)&&(!w._writableState||w._readableState))}function u(w){var U;return!!(w&&typeof w.write=="function"&&typeof w.on=="function"&&(!w._readableState||((U=w._writableState)===null||U===void 0?void 0:U.writable)!==!1))}function v(w){return!!(w&&typeof w.pipe=="function"&&w._readableState&&typeof w.on=="function"&&typeof w.write=="function")}function g(w){return w&&(w._readableState||w._writableState||typeof w.write=="function"&&typeof w.on=="function"||typeof w.pipe=="function"&&typeof w.on=="function")}function y(w){return!!(w&&!g(w)&&typeof w.pipeThrough=="function"&&typeof w.getReader=="function"&&typeof w.cancel=="function")}function k(w){return!!(w&&!g(w)&&typeof w.getWriter=="function"&&typeof w.abort=="function")}function x(w){return!!(w&&!g(w)&&typeof w.readable=="object"&&typeof w.writable=="object")}function _(w){return y(w)||k(w)||x(w)}function E(w,U){return w==null?!1:U===!0?typeof w[r]=="function":U===!1?typeof w[e]=="function":typeof w[r]=="function"||typeof w[e]=="function"}function m(w){if(!g(w))return null;const U=w._writableState,K=w._readableState,X=U||K;return!!(w.destroyed||w[i]||X!=null&&X.destroyed)}function f(w){if(!u(w))return null;if(w.writableEnded===!0)return!0;const U=w._writableState;return U!=null&&U.errored?!1:typeof U?.ended!="boolean"?null:U.ended}function b(w,U){if(!u(w))return null;if(w.writableFinished===!0)return!0;const K=w._writableState;return K!=null&&K.errored?!1:typeof K?.finished!="boolean"?null:!!(K.finished||U===!1&&K.ended===!0&&K.length===0)}function R(w){if(!c(w))return null;if(w.readableEnded===!0)return!0;const U=w._readableState;return!U||U.errored?!1:typeof U?.ended!="boolean"?null:U.ended}function L(w,U){if(!c(w))return null;const K=w._readableState;return K!=null&&K.errored?!1:typeof K?.endEmitted!="boolean"?null:!!(K.endEmitted||U===!1&&K.ended===!0&&K.length===0)}function T(w){return w&&w[o]!=null?w[o]:typeof w?.readable!="boolean"?null:m(w)?!1:c(w)&&w.readable&&!L(w)}function B(w){return w&&w[a]!=null?w[a]:typeof w?.writable!="boolean"?null:m(w)?!1:u(w)&&w.writable&&!f(w)}function N(w,U){return g(w)?m(w)?!0:!(U?.readable!==!1&&T(w)||U?.writable!==!1&&B(w)):null}function $(w){var U,K;return g(w)?w.writableErrored?w.writableErrored:(U=(K=w._writableState)===null||K===void 0?void 0:K.errored)!==null&&U!==void 0?U:null:null}function q(w){var U,K;return g(w)?w.readableErrored?w.readableErrored:(U=(K=w._readableState)===null||K===void 0?void 0:K.errored)!==null&&U!==void 0?U:null:null}function A(w){if(!g(w))return null;if(typeof w.closed=="boolean")return w.closed;const U=w._writableState,K=w._readableState;return typeof U?.closed=="boolean"||typeof K?.closed=="boolean"?U?.closed||K?.closed:typeof w._closed=="boolean"&&j(w)?w._closed:null}function j(w){return typeof w._closed=="boolean"&&typeof w._defaultKeepAlive=="boolean"&&typeof w._removedConnection=="boolean"&&typeof w._removedContLen=="boolean"}function te(w){return typeof w._sent100=="boolean"&&j(w)}function I(w){var U;return typeof w._consuming=="boolean"&&typeof w._dumped=="boolean"&&((U=w.req)===null||U===void 0?void 0:U.upgradeOrConnect)===void 0}function Z(w){if(!g(w))return null;const U=w._writableState,K=w._readableState,X=U||K;return!X&&te(w)||!!(X&&X.autoDestroy&&X.emitClose&&X.closed===!1)}function F(w){var U;return!!(w&&((U=w[s])!==null&&U!==void 0?U:w.readableDidRead||w.readableAborted))}function Y(w){var U,K,X,de,H,G,W,z,ee,re;return!!(w&&((U=(K=(X=(de=(H=(G=w[n])!==null&&G!==void 0?G:w.readableErrored)!==null&&H!==void 0?H:w.writableErrored)!==null&&de!==void 0?de:(W=w._readableState)===null||W===void 0?void 0:W.errorEmitted)!==null&&X!==void 0?X:(z=w._writableState)===null||z===void 0?void 0:z.errorEmitted)!==null&&K!==void 0?K:(ee=w._readableState)===null||ee===void 0?void 0:ee.errored)!==null&&U!==void 0?U:!((re=w._writableState)===null||re===void 0)&&re.errored))}return Nn={isDestroyed:m,kIsDestroyed:i,isDisturbed:F,kIsDisturbed:s,isErrored:Y,kIsErrored:n,isReadable:T,kIsReadable:o,kIsClosedPromise:d,kControllerErrorFunction:l,kIsWritable:a,isClosed:A,isDuplexNodeStream:v,isFinished:N,isIterable:E,isReadableNodeStream:c,isReadableStream:y,isReadableEnded:R,isReadableFinished:L,isReadableErrored:q,isNodeStream:g,isWebStream:_,isWritable:B,isWritableNodeStream:u,isWritableStream:k,isWritableEnded:f,isWritableFinished:b,isWritableErrored:$,isServerRequest:I,isServerResponse:te,willEmitClose:Z,isTransformStream:x},Nn}var hs;function Vt(){if(hs)return Fi.exports;hs=1;const r=ur(),{AbortError:e,codes:t}=it(),{ERR_INVALID_ARG_TYPE:i,ERR_STREAM_PREMATURE_CLOSE:n}=t,{kEmptyObject:o,once:a}=at(),{validateAbortSignal:s,validateFunction:d,validateObject:l,validateBoolean:c}=Ei(),{Promise:u,PromisePrototypeThen:v,SymbolDispose:g}=Be(),{isClosed:y,isReadable:k,isReadableNodeStream:x,isReadableStream:_,isReadableFinished:E,isReadableErrored:m,isWritable:f,isWritableNodeStream:b,isWritableStream:R,isWritableFinished:L,isWritableErrored:T,isNodeStream:B,willEmitClose:N,kIsClosedPromise:$}=Lt();let q;function A(F){return F.setHeader&&typeof F.abort=="function"}const j=()=>{};function te(F,Y,w){var U,K;if(arguments.length===2?(w=Y,Y=o):Y==null?Y=o:l(Y,"options"),d(w,"callback"),s(Y.signal,"options.signal"),w=a(w),_(F)||R(F))return I(F,Y,w);if(!B(F))throw new i("stream",["ReadableStream","WritableStream","Stream"],F);const X=(U=Y.readable)!==null&&U!==void 0?U:x(F),de=(K=Y.writable)!==null&&K!==void 0?K:b(F),H=F._writableState,G=F._readableState,W=()=>{F.writable||re()};let z=N(F)&&x(F)===X&&b(F)===de,ee=L(F,!1);const re=()=>{ee=!0,F.destroyed&&(z=!1),!(z&&(!F.readable||X))&&(!X||pe)&&w.call(F)};let pe=E(F,!1);const be=()=>{pe=!0,F.destroyed&&(z=!1),!(z&&(!F.writable||de))&&(!de||ee)&&w.call(F)},O=J=>{w.call(F,J)};let V=y(F);const oe=()=>{V=!0;const J=T(F)||m(F);if(J&&typeof J!="boolean")return w.call(F,J);if(X&&!pe&&x(F,!0)&&!E(F,!1))return w.call(F,new n);if(de&&!ee&&!L(F,!1))return w.call(F,new n);w.call(F)},fe=()=>{V=!0;const J=T(F)||m(F);if(J&&typeof J!="boolean")return w.call(F,J);w.call(F)},he=()=>{F.req.on("finish",re)};A(F)?(F.on("complete",re),z||F.on("abort",oe),F.req?he():F.on("request",he)):de&&!H&&(F.on("end",W),F.on("close",W)),!z&&typeof F.aborted=="boolean"&&F.on("aborted",oe),F.on("end",be),F.on("finish",re),Y.error!==!1&&F.on("error",O),F.on("close",oe),V?r.nextTick(oe):H!=null&&H.errorEmitted||G!=null&&G.errorEmitted?z||r.nextTick(fe):(!X&&(!z||k(F))&&(ee||f(F)===!1)||!de&&(!z||f(F))&&(pe||k(F)===!1)||G&&F.req&&F.aborted)&&r.nextTick(fe);const me=()=>{w=j,F.removeListener("aborted",oe),F.removeListener("complete",re),F.removeListener("abort",oe),F.removeListener("request",he),F.req&&F.req.removeListener("finish",re),F.removeListener("end",W),F.removeListener("close",W),F.removeListener("finish",re),F.removeListener("end",be),F.removeListener("error",O),F.removeListener("close",oe)};if(Y.signal&&!V){const J=()=>{const ce=w;me(),ce.call(F,new e(void 0,{cause:Y.signal.reason}))};if(Y.signal.aborted)r.nextTick(J);else{q=q||at().addAbortListener;const ce=q(Y.signal,J),ge=w;w=a((...le)=>{ce[g](),ge.apply(F,le)})}}return me}function I(F,Y,w){let U=!1,K=j;if(Y.signal)if(K=()=>{U=!0,w.call(F,new e(void 0,{cause:Y.signal.reason}))},Y.signal.aborted)r.nextTick(K);else{q=q||at().addAbortListener;const de=q(Y.signal,K),H=w;w=a((...G)=>{de[g](),H.apply(F,G)})}const X=(...de)=>{U||r.nextTick(()=>w.apply(F,de))};return v(F[$].promise,X,X),j}function Z(F,Y){var w;let U=!1;return Y===null&&(Y=o),(w=Y)!==null&&w!==void 0&&w.cleanup&&(c(Y.cleanup,"cleanup"),U=Y.cleanup),new u((K,X)=>{const de=te(F,Y,H=>{U&&de(),H?X(H):K()})})}return Fi.exports=te,Fi.exports.finished=Z,Fi.exports}var In,bs;function Lr(){if(bs)return In;bs=1;const r=ur(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:i}=it(),{Symbol:n}=Be(),{kIsDestroyed:o,isDestroyed:a,isFinished:s,isServerRequest:d}=Lt(),l=n("kDestroy"),c=n("kConstruct");function u(N,$,q){N&&(N.stack,$&&!$.errored&&($.errored=N),q&&!q.errored&&(q.errored=N))}function v(N,$){const q=this._readableState,A=this._writableState,j=A||q;return A!=null&&A.destroyed||q!=null&&q.destroyed?(typeof $=="function"&&$(),this):(u(N,A,q),A&&(A.destroyed=!0),q&&(q.destroyed=!0),j.constructed?g(this,N,$):this.once(l,function(te){g(this,e(te,N),$)}),this)}function g(N,$,q){let A=!1;function j(te){if(A)return;A=!0;const I=N._readableState,Z=N._writableState;u(te,Z,I),Z&&(Z.closed=!0),I&&(I.closed=!0),typeof q=="function"&&q(te),te?r.nextTick(y,N,te):r.nextTick(k,N)}try{N._destroy($||null,j)}catch(te){j(te)}}function y(N,$){x(N,$),k(N)}function k(N){const $=N._readableState,q=N._writableState;q&&(q.closeEmitted=!0),$&&($.closeEmitted=!0),(q!=null&&q.emitClose||$!=null&&$.emitClose)&&N.emit("close")}function x(N,$){const q=N._readableState,A=N._writableState;A!=null&&A.errorEmitted||q!=null&&q.errorEmitted||(A&&(A.errorEmitted=!0),q&&(q.errorEmitted=!0),N.emit("error",$))}function _(){const N=this._readableState,$=this._writableState;N&&(N.constructed=!0,N.closed=!1,N.closeEmitted=!1,N.destroyed=!1,N.errored=null,N.errorEmitted=!1,N.reading=!1,N.ended=N.readable===!1,N.endEmitted=N.readable===!1),$&&($.constructed=!0,$.destroyed=!1,$.closed=!1,$.closeEmitted=!1,$.errored=null,$.errorEmitted=!1,$.finalCalled=!1,$.prefinished=!1,$.ended=$.writable===!1,$.ending=$.writable===!1,$.finished=$.writable===!1)}function E(N,$,q){const A=N._readableState,j=N._writableState;if(j!=null&&j.destroyed||A!=null&&A.destroyed)return this;A!=null&&A.autoDestroy||j!=null&&j.autoDestroy?N.destroy($):$&&($.stack,j&&!j.errored&&(j.errored=$),A&&!A.errored&&(A.errored=$),q?r.nextTick(x,N,$):x(N,$))}function m(N,$){if(typeof N._construct!="function")return;const q=N._readableState,A=N._writableState;q&&(q.constructed=!1),A&&(A.constructed=!1),N.once(c,$),!(N.listenerCount(c)>1)&&r.nextTick(f,N)}function f(N){let $=!1;function q(A){if($){E(N,A??new t);return}$=!0;const j=N._readableState,te=N._writableState,I=te||j;j&&(j.constructed=!0),te&&(te.constructed=!0),I.destroyed?N.emit(l,A):A?E(N,A,!0):r.nextTick(b,N)}try{N._construct(A=>{r.nextTick(q,A)})}catch(A){r.nextTick(q,A)}}function b(N){N.emit(c)}function R(N){return N?.setHeader&&typeof N.abort=="function"}function L(N){N.emit("close")}function T(N,$){N.emit("error",$),r.nextTick(L,N)}function B(N,$){!N||a(N)||(!$&&!s(N)&&($=new i),d(N)?(N.socket=null,N.destroy($)):R(N)?N.abort():R(N.req)?N.req.abort():typeof N.destroy=="function"?N.destroy($):typeof N.close=="function"?N.close():$?r.nextTick(T,N,$):r.nextTick(L,N),N.destroyed||(N[o]=!0))}return In={construct:m,destroyer:B,destroy:v,undestroy:_,errorOrDestroy:E},In}var Tn,ms;function va(){if(ms)return Tn;ms=1;const{ArrayIsArray:r,ObjectSetPrototypeOf:e}=Be(),{EventEmitter:t}=an();function i(o){t.call(this,o)}e(i.prototype,t.prototype),e(i,t),i.prototype.pipe=function(o,a){const s=this;function d(k){o.writable&&o.write(k)===!1&&s.pause&&s.pause()}s.on("data",d);function l(){s.readable&&s.resume&&s.resume()}o.on("drain",l),!o._isStdio&&(!a||a.end!==!1)&&(s.on("end",u),s.on("close",v));let c=!1;function u(){c||(c=!0,o.end())}function v(){c||(c=!0,typeof o.destroy=="function"&&o.destroy())}function g(k){y(),t.listenerCount(this,"error")===0&&this.emit("error",k)}n(s,"error",g),n(o,"error",g);function y(){s.removeListener("data",d),o.removeListener("drain",l),s.removeListener("end",u),s.removeListener("close",v),s.removeListener("error",g),o.removeListener("error",g),s.removeListener("end",y),s.removeListener("close",y),o.removeListener("close",y)}return s.on("end",y),s.on("close",y),o.on("close",y),o.emit("pipe",s),o};function n(o,a,s){if(typeof o.prependListener=="function")return o.prependListener(a,s);!o._events||!o._events[a]?o.on(a,s):r(o._events[a])?o._events[a].unshift(s):o._events[a]=[s,o._events[a]]}return Tn={Stream:i,prependListener:n},Tn}var An={exports:{}},gs;function sn(){return gs||(gs=1,function(r){const{SymbolDispose:e}=Be(),{AbortError:t,codes:i}=it(),{isNodeStream:n,isWebStream:o,kControllerErrorFunction:a}=Lt(),s=Vt(),{ERR_INVALID_ARG_TYPE:d}=i;let l;const c=(u,v)=>{if(typeof u!="object"||!("aborted"in u))throw new d(v,"AbortSignal",u)};r.exports.addAbortSignal=function(v,g){if(c(v,"signal"),!n(g)&&!o(g))throw new d("stream",["ReadableStream","WritableStream","Stream"],g);return r.exports.addAbortSignalNoValidate(v,g)},r.exports.addAbortSignalNoValidate=function(u,v){if(typeof u!="object"||!("aborted"in u))return v;const g=n(v)?()=>{v.destroy(new t(void 0,{cause:u.reason}))}:()=>{v[a](new t(void 0,{cause:u.reason}))};if(u.aborted)g();else{l=l||at().addAbortListener;const y=l(u,g);s(v,y[e])}return v}}(An)),An.exports}var jn,vs;function ku(){if(vs)return jn;vs=1;const{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:i}=Be(),{Buffer:n}=Dt(),{inspect:o}=at();return jn=class{constructor(){this.head=null,this.tail=null,this.length=0}push(s){const d={data:s,next:null};this.length>0?this.tail.next=d:this.head=d,this.tail=d,++this.length}unshift(s){const d={data:s,next:this.head};this.length===0&&(this.tail=d),this.head=d,++this.length}shift(){if(this.length===0)return;const s=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,s}clear(){this.head=this.tail=null,this.length=0}join(s){if(this.length===0)return"";let d=this.head,l=""+d.data;for(;(d=d.next)!==null;)l+=s+d.data;return l}concat(s){if(this.length===0)return n.alloc(0);const d=n.allocUnsafe(s>>>0);let l=this.head,c=0;for(;l;)t(d,l.data,c),c+=l.data.length,l=l.next;return d}consume(s,d){const l=this.head.data;if(s<l.length){const c=l.slice(0,s);return this.head.data=l.slice(s),c}return s===l.length?this.shift():d?this._getString(s):this._getBuffer(s)}first(){return this.head.data}*[e](){for(let s=this.head;s;s=s.next)yield s.data}_getString(s){let d="",l=this.head,c=0;do{const u=l.data;if(s>u.length)d+=u,s-=u.length;else{s===u.length?(d+=u,++c,l.next?this.head=l.next:this.head=this.tail=null):(d+=r(u,0,s),this.head=l,l.data=r(u,s));break}++c}while((l=l.next)!==null);return this.length-=c,d}_getBuffer(s){const d=n.allocUnsafe(s),l=s;let c=this.head,u=0;do{const v=c.data;if(s>v.length)t(d,v,l-s),s-=v.length;else{s===v.length?(t(d,v,l-s),++u,c.next?this.head=c.next:this.head=this.tail=null):(t(d,new i(v.buffer,v.byteOffset,s),l-s),this.head=c,c.data=v.slice(s));break}++u}while((c=c.next)!==null);return this.length-=u,d}[Symbol.for("nodejs.util.inspect.custom")](s,d){return o(this,{...d,depth:0,customInspect:!1})}},jn}var Dn,ys;function ln(){if(ys)return Dn;ys=1;const{MathFloor:r,NumberIsInteger:e}=Be(),{validateInteger:t}=Ei(),{ERR_INVALID_ARG_VALUE:i}=it().codes;let n=16*1024,o=16;function a(c,u,v){return c.highWaterMark!=null?c.highWaterMark:u?c[v]:null}function s(c){return c?o:n}function d(c,u){t(u,"value",0),c?o=u:n=u}function l(c,u,v,g){const y=a(u,g,v);if(y!=null){if(!e(y)||y<0){const k=g?`options.${v}`:"options.highWaterMark";throw new i(k,y)}return r(y)}return s(c.objectMode)}return Dn={getHighWaterMark:l,getDefaultHighWaterMark:s,setDefaultHighWaterMark:d},Dn}var Ln={},Pi={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var ws;function Eu(){return ws||(ws=1,function(r,e){var t=Dt(),i=t.Buffer;function n(a,s){for(var d in a)s[d]=a[d]}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?r.exports=t:(n(t,e),e.Buffer=o);function o(a,s,d){return i(a,s,d)}o.prototype=Object.create(i.prototype),n(i,o),o.from=function(a,s,d){if(typeof a=="number")throw new TypeError("Argument must not be a number");return i(a,s,d)},o.alloc=function(a,s,d){if(typeof a!="number")throw new TypeError("Argument must be a number");var l=i(a);return s!==void 0?typeof d=="string"?l.fill(s,d):l.fill(s):l.fill(0),l},o.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return i(a)},o.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(a)}}(Pi,Pi.exports)),Pi.exports}var xs;function Su(){if(xs)return Ln;xs=1;var r=Eu().Buffer,e=r.isEncoding||function(_){switch(_=""+_,_&&_.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 t(_){if(!_)return"utf8";for(var E;;)switch(_){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 _;default:if(E)return;_=(""+_).toLowerCase(),E=!0}}function i(_){var E=t(_);if(typeof E!="string"&&(r.isEncoding===e||!e(_)))throw new Error("Unknown encoding: "+_);return E||_}Ln.StringDecoder=n;function n(_){this.encoding=i(_);var E;switch(this.encoding){case"utf16le":this.text=u,this.end=v,E=4;break;case"utf8":this.fillLast=d,E=4;break;case"base64":this.text=g,this.end=y,E=3;break;default:this.write=k,this.end=x;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(E)}n.prototype.write=function(_){if(_.length===0)return"";var E,m;if(this.lastNeed){if(E=this.fillLast(_),E===void 0)return"";m=this.lastNeed,this.lastNeed=0}else m=0;return m<_.length?E?E+this.text(_,m):this.text(_,m):E||""},n.prototype.end=c,n.prototype.text=l,n.prototype.fillLast=function(_){if(this.lastNeed<=_.length)return _.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,this.lastTotal-this.lastNeed,0,_.length),this.lastNeed-=_.length};function o(_){return _<=127?0:_>>5===6?2:_>>4===14?3:_>>3===30?4:_>>6===2?-1:-2}function a(_,E,m){var f=E.length-1;if(f<m)return 0;var b=o(E[f]);return b>=0?(b>0&&(_.lastNeed=b-1),b):--f<m||b===-2?0:(b=o(E[f]),b>=0?(b>0&&(_.lastNeed=b-2),b):--f<m||b===-2?0:(b=o(E[f]),b>=0?(b>0&&(b===2?b=0:_.lastNeed=b-3),b):0))}function s(_,E,m){if((E[0]&192)!==128)return _.lastNeed=0,"�";if(_.lastNeed>1&&E.length>1){if((E[1]&192)!==128)return _.lastNeed=1,"�";if(_.lastNeed>2&&E.length>2&&(E[2]&192)!==128)return _.lastNeed=2,"�"}}function d(_){var E=this.lastTotal-this.lastNeed,m=s(this,_);if(m!==void 0)return m;if(this.lastNeed<=_.length)return _.copy(this.lastChar,E,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,E,0,_.length),this.lastNeed-=_.length}function l(_,E){var m=a(this,_,E);if(!this.lastNeed)return _.toString("utf8",E);this.lastTotal=m;var f=_.length-(m-this.lastNeed);return _.copy(this.lastChar,0,f),_.toString("utf8",E,f)}function c(_){var E=_&&_.length?this.write(_):"";return this.lastNeed?E+"�":E}function u(_,E){if((_.length-E)%2===0){var m=_.toString("utf16le",E);if(m){var f=m.charCodeAt(m.length-1);if(f>=55296&&f<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1],m.slice(0,-1)}return m}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=_[_.length-1],_.toString("utf16le",E,_.length-1)}function v(_){var E=_&&_.length?this.write(_):"";if(this.lastNeed){var m=this.lastTotal-this.lastNeed;return E+this.lastChar.toString("utf16le",0,m)}return E}function g(_,E){var m=(_.length-E)%3;return m===0?_.toString("base64",E):(this.lastNeed=3-m,this.lastTotal=3,m===1?this.lastChar[0]=_[_.length-1]:(this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1]),_.toString("base64",E,_.length-m))}function y(_){var E=_&&_.length?this.write(_):"";return this.lastNeed?E+this.lastChar.toString("base64",0,3-this.lastNeed):E}function k(_){return _.toString(this.encoding)}function x(_){return _&&_.length?this.write(_):""}return Ln}var On,_s;function tc(){if(_s)return On;_s=1;const r=ur(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:i}=Be(),{Buffer:n}=Dt(),{ERR_INVALID_ARG_TYPE:o,ERR_STREAM_NULL_VALUES:a}=it().codes;function s(d,l,c){let u;if(typeof l=="string"||l instanceof n)return new d({objectMode:!0,...c,read(){this.push(l),this.push(null)}});let v;if(l&&l[t])v=!0,u=l[t]();else if(l&&l[i])v=!1,u=l[i]();else throw new o("iterable",["Iterable"],l);const g=new d({objectMode:!0,highWaterMark:1,...c});let y=!1;g._read=function(){y||(y=!0,x())},g._destroy=function(_,E){e(k(_),()=>r.nextTick(E,_),m=>r.nextTick(E,m||_))};async function k(_){const E=_!=null,m=typeof u.throw=="function";if(E&&m){const{value:f,done:b}=await u.throw(_);if(await f,b)return}if(typeof u.return=="function"){const{value:f}=await u.return();await f}}async function x(){for(;;){try{const{value:_,done:E}=v?await u.next():u.next();if(E)g.push(null);else{const m=_&&typeof _.then=="function"?await _:_;if(m===null)throw y=!1,new a;if(g.push(m))continue;y=!1}}catch(_){g.destroy(_)}break}}return g}return On=s,On}var Cn,ks;function dn(){if(ks)return Cn;ks=1;const r=ur(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:i,NumberParseInt:n,ObjectDefineProperties:o,ObjectKeys:a,ObjectSetPrototypeOf:s,Promise:d,SafeSet:l,SymbolAsyncDispose:c,SymbolAsyncIterator:u,Symbol:v}=Be();Cn=le,le.ReadableState=ge;const{EventEmitter:g}=an(),{Stream:y,prependListener:k}=va(),{Buffer:x}=Dt(),{addAbortSignal:_}=sn(),E=Vt();let m=at().debuglog("stream",D=>{m=D});const f=ku(),b=Lr(),{getHighWaterMark:R,getDefaultHighWaterMark:L}=ln(),{aggregateTwoErrors:T,codes:{ERR_INVALID_ARG_TYPE:B,ERR_METHOD_NOT_IMPLEMENTED:N,ERR_OUT_OF_RANGE:$,ERR_STREAM_PUSH_AFTER_EOF:q,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:A},AbortError:j}=it(),{validateObject:te}=Ei(),I=v("kPaused"),{StringDecoder:Z}=Su(),F=tc();s(le.prototype,y.prototype),s(le,y);const Y=()=>{},{errorOrDestroy:w}=b,U=1,K=2,X=4,de=8,H=16,G=32,W=64,z=128,ee=256,re=512,pe=1024,be=2048,O=4096,V=8192,oe=16384,fe=32768,he=65536,me=1<<17,J=1<<18;function ce(D){return{enumerable:!1,get(){return(this.state&D)!==0},set(M){M?this.state|=D:this.state&=~D}}}o(ge.prototype,{objectMode:ce(U),ended:ce(K),endEmitted:ce(X),reading:ce(de),constructed:ce(H),sync:ce(G),needReadable:ce(W),emittedReadable:ce(z),readableListening:ce(ee),resumeScheduled:ce(re),errorEmitted:ce(pe),emitClose:ce(be),autoDestroy:ce(O),destroyed:ce(V),closed:ce(oe),closeEmitted:ce(fe),multiAwaitDrain:ce(he),readingMore:ce(me),dataEmitted:ce(J)});function ge(D,M,ve){typeof ve!="boolean"&&(ve=M instanceof At()),this.state=be|O|H|G,D&&D.objectMode&&(this.state|=U),ve&&D&&D.readableObjectMode&&(this.state|=U),this.highWaterMark=D?R(this,D,"readableHighWaterMark",ve):L(!1),this.buffer=new f,this.length=0,this.pipes=[],this.flowing=null,this[I]=null,D&&D.emitClose===!1&&(this.state&=~be),D&&D.autoDestroy===!1&&(this.state&=~O),this.errored=null,this.defaultEncoding=D&&D.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,D&&D.encoding&&(this.decoder=new Z(D.encoding),this.encoding=D.encoding)}function le(D){if(!(this instanceof le))return new le(D);const M=this instanceof At();this._readableState=new ge(D,this,M),D&&(typeof D.read=="function"&&(this._read=D.read),typeof D.destroy=="function"&&(this._destroy=D.destroy),typeof D.construct=="function"&&(this._construct=D.construct),D.signal&&!M&&_(D.signal,this)),y.call(this,D),b.construct(this,()=>{this._readableState.needReadable&&Q(this,this._readableState)})}le.prototype.destroy=b.destroy,le.prototype._undestroy=b.undestroy,le.prototype._destroy=function(D,M){M(D)},le.prototype[g.captureRejectionSymbol]=function(D){this.destroy(D)},le.prototype[c]=function(){let D;return this.destroyed||(D=this.readableEnded?null:new j,this.destroy(D)),new d((M,ve)=>E(this,ye=>ye&&ye!==D?ve(ye):M(null)))},le.prototype.push=function(D,M){return Re(this,D,M,!1)},le.prototype.unshift=function(D,M){return Re(this,D,M,!0)};function Re(D,M,ve,ye){m("readableAddChunk",M);const xe=D._readableState;let Xe;if((xe.state&U)===0&&(typeof M=="string"?(ve=ve||xe.defaultEncoding,xe.encoding!==ve&&(ye&&xe.encoding?M=x.from(M,ve).toString(xe.encoding):(M=x.from(M,ve),ve=""))):M instanceof x?ve="":y._isUint8Array(M)?(M=y._uint8ArrayToBuffer(M),ve=""):M!=null&&(Xe=new B("chunk",["string","Buffer","Uint8Array"],M))),Xe)w(D,Xe);else if(M===null)xe.state&=~de,p(D,xe);else if((xe.state&U)!==0||M&&M.length>0)if(ye)if((xe.state&X)!==0)w(D,new A);else{if(xe.destroyed||xe.errored)return!1;We(D,xe,M,!0)}else if(xe.ended)w(D,new q);else{if(xe.destroyed||xe.errored)return!1;xe.state&=~de,xe.decoder&&!ve?(M=xe.decoder.write(M),xe.objectMode||M.length!==0?We(D,xe,M,!1):Q(D,xe)):We(D,xe,M,!1)}else ye||(xe.state&=~de,Q(D,xe));return!xe.ended&&(xe.length<xe.highWaterMark||xe.length===0)}function We(D,M,ve,ye){M.flowing&&M.length===0&&!M.sync&&D.listenerCount("data")>0?((M.state&he)!==0?M.awaitDrainWriters.clear():M.awaitDrainWriters=null,M.dataEmitted=!0,D.emit("data",ve)):(M.length+=M.objectMode?1:ve.length,ye?M.buffer.unshift(ve):M.buffer.push(ve),(M.state&W)!==0&&h(D)),Q(D,M)}le.prototype.isPaused=function(){const D=this._readableState;return D[I]===!0||D.flowing===!1},le.prototype.setEncoding=function(D){const M=new Z(D);this._readableState.decoder=M,this._readableState.encoding=this._readableState.decoder.encoding;const ve=this._readableState.buffer;let ye="";for(const xe of ve)ye+=M.write(xe);return ve.clear(),ye!==""&&ve.push(ye),this._readableState.length=ye.length,this};const Ee=1073741824;function Qe(D){if(D>Ee)throw new $("size","<= 1GiB",D);return D--,D|=D>>>1,D|=D>>>2,D|=D>>>4,D|=D>>>8,D|=D>>>16,D++,D}function S(D,M){return D<=0||M.length===0&&M.ended?0:(M.state&U)!==0?1:i(D)?M.flowing&&M.length?M.buffer.first().length:M.length:D<=M.length?D:M.ended?M.length:0}le.prototype.read=function(D){m("read",D),D===void 0?D=NaN:t(D)||(D=n(D,10));const M=this._readableState,ve=D;if(D>M.highWaterMark&&(M.highWaterMark=Qe(D)),D!==0&&(M.state&=~z),D===0&&M.needReadable&&((M.highWaterMark!==0?M.length>=M.highWaterMark:M.length>0)||M.ended))return m("read: emitReadable",M.length,M.ended),M.length===0&&M.ended?ze(this):h(this),null;if(D=S(D,M),D===0&&M.ended)return M.length===0&&ze(this),null;let ye=(M.state&W)!==0;if(m("need readable",ye),(M.length===0||M.length-D<M.highWaterMark)&&(ye=!0,m("length less than watermark",ye)),M.ended||M.reading||M.destroyed||M.errored||!M.constructed)ye=!1,m("reading, ended or constructing",ye);else if(ye){m("do read"),M.state|=de|G,M.length===0&&(M.state|=W);try{this._read(M.highWaterMark)}catch(Xe){w(this,Xe)}M.state&=~G,M.reading||(D=S(ve,M))}let xe;return D>0?xe=qe(D,M):xe=null,xe===null?(M.needReadable=M.length<=M.highWaterMark,D=0):(M.length-=D,M.multiAwaitDrain?M.awaitDrainWriters.clear():M.awaitDrainWriters=null),M.length===0&&(M.ended||(M.needReadable=!0),ve!==D&&M.ended&&ze(this)),xe!==null&&!M.errorEmitted&&!M.closeEmitted&&(M.dataEmitted=!0,this.emit("data",xe)),xe};function p(D,M){if(m("onEofChunk"),!M.ended){if(M.decoder){const ve=M.decoder.end();ve&&ve.length&&(M.buffer.push(ve),M.length+=M.objectMode?1:ve.length)}M.ended=!0,M.sync?h(D):(M.needReadable=!1,M.emittedReadable=!0,C(D))}}function h(D){const M=D._readableState;m("emitReadable",M.needReadable,M.emittedReadable),M.needReadable=!1,M.emittedReadable||(m("emitReadable",M.flowing),M.emittedReadable=!0,r.nextTick(C,D))}function C(D){const M=D._readableState;m("emitReadable_",M.destroyed,M.length,M.ended),!M.destroyed&&!M.errored&&(M.length||M.ended)&&(D.emit("readable"),M.emittedReadable=!1),M.needReadable=!M.flowing&&!M.ended&&M.length<=M.highWaterMark,Ae(D)}function Q(D,M){!M.readingMore&&M.constructed&&(M.readingMore=!0,r.nextTick(se,D,M))}function se(D,M){for(;!M.reading&&!M.ended&&(M.length<M.highWaterMark||M.flowing&&M.length===0);){const ve=M.length;if(m("maybeReadMore read 0"),D.read(0),ve===M.length)break}M.readingMore=!1}le.prototype._read=function(D){throw new N("_read()")},le.prototype.pipe=function(D,M){const ve=this,ye=this._readableState;ye.pipes.length===1&&(ye.multiAwaitDrain||(ye.multiAwaitDrain=!0,ye.awaitDrainWriters=new l(ye.awaitDrainWriters?[ye.awaitDrainWriters]:[]))),ye.pipes.push(D),m("pipe count=%d opts=%j",ye.pipes.length,M);const Xe=(!M||M.end!==!1)&&D!==r.stdout&&D!==r.stderr?Ti:P;ye.endEmitted?r.nextTick(Xe):ve.once("end",Xe),D.on("unpipe",Ze);function Ze(ie,ne){m("onunpipe"),ie===ve&&ne&&ne.hasUnpiped===!1&&(ne.hasUnpiped=!0,Nt())}function Ti(){m("onend"),D.end()}let Rt,Ai=!1;function Nt(){m("cleanup"),D.removeListener("close",Mr),D.removeListener("finish",Ge),Rt&&D.removeListener("drain",Rt),D.removeListener("error",mr),D.removeListener("unpipe",Ze),ve.removeListener("end",Ti),ve.removeListener("end",P),ve.removeListener("data",br),Ai=!0,Rt&&ye.awaitDrainWriters&&(!D._writableState||D._writableState.needDrain)&&Rt()}function Pr(){Ai||(ye.pipes.length===1&&ye.pipes[0]===D?(m("false write response, pause",0),ye.awaitDrainWriters=D,ye.multiAwaitDrain=!1):ye.pipes.length>1&&ye.pipes.includes(D)&&(m("false write response, pause",ye.awaitDrainWriters.size),ye.awaitDrainWriters.add(D)),ve.pause()),Rt||(Rt=ue(ve,D),D.on("drain",Rt))}ve.on("data",br);function br(ie){m("ondata");const ne=D.write(ie);m("dest.write",ne),ne===!1&&Pr()}function mr(ie){if(m("onerror",ie),P(),D.removeListener("error",mr),D.listenerCount("error")===0){const ne=D._writableState||D._readableState;ne&&!ne.errorEmitted?w(D,ie):D.emit("error",ie)}}k(D,"error",mr);function Mr(){D.removeListener("finish",Ge),P()}D.once("close",Mr);function Ge(){m("onfinish"),D.removeListener("close",Mr),P()}D.once("finish",Ge);function P(){m("unpipe"),ve.unpipe(D)}return D.emit("pipe",ve),D.writableNeedDrain===!0?Pr():ye.flowing||(m("pipe resume"),ve.resume()),D};function ue(D,M){return function(){const ye=D._readableState;ye.awaitDrainWriters===M?(m("pipeOnDrain",1),ye.awaitDrainWriters=null):ye.multiAwaitDrain&&(m("pipeOnDrain",ye.awaitDrainWriters.size),ye.awaitDrainWriters.delete(M)),(!ye.awaitDrainWriters||ye.awaitDrainWriters.size===0)&&D.listenerCount("data")&&D.resume()}}le.prototype.unpipe=function(D){const M=this._readableState,ve={hasUnpiped:!1};if(M.pipes.length===0)return this;if(!D){const xe=M.pipes;M.pipes=[],this.pause();for(let Xe=0;Xe<xe.length;Xe++)xe[Xe].emit("unpipe",this,{hasUnpiped:!1});return this}const ye=e(M.pipes,D);return ye===-1?this:(M.pipes.splice(ye,1),M.pipes.length===0&&this.pause(),D.emit("unpipe",this,ve),this)},le.prototype.on=function(D,M){const ve=y.prototype.on.call(this,D,M),ye=this._readableState;return D==="data"?(ye.readableListening=this.listenerCount("readable")>0,ye.flowing!==!1&&this.resume()):D==="readable"&&!ye.endEmitted&&!ye.readableListening&&(ye.readableListening=ye.needReadable=!0,ye.flowing=!1,ye.emittedReadable=!1,m("on readable",ye.length,ye.reading),ye.length?h(this):ye.reading||r.nextTick(Fe,this)),ve},le.prototype.addListener=le.prototype.on,le.prototype.removeListener=function(D,M){const ve=y.prototype.removeListener.call(this,D,M);return D==="readable"&&r.nextTick(ke,this),ve},le.prototype.off=le.prototype.removeListener,le.prototype.removeAllListeners=function(D){const M=y.prototype.removeAllListeners.apply(this,arguments);return(D==="readable"||D===void 0)&&r.nextTick(ke,this),M};function ke(D){const M=D._readableState;M.readableListening=D.listenerCount("readable")>0,M.resumeScheduled&&M[I]===!1?M.flowing=!0:D.listenerCount("data")>0?D.resume():M.readableListening||(M.flowing=null)}function Fe(D){m("readable nexttick read 0"),D.read(0)}le.prototype.resume=function(){const D=this._readableState;return D.flowing||(m("resume"),D.flowing=!D.readableListening,je(this,D)),D[I]=!1,this};function je(D,M){M.resumeScheduled||(M.resumeScheduled=!0,r.nextTick(De,D,M))}function De(D,M){m("resume",M.reading),M.reading||D.read(0),M.resumeScheduled=!1,D.emit("resume"),Ae(D),M.flowing&&!M.reading&&D.read(0)}le.prototype.pause=function(){return m("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(m("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[I]=!0,this};function Ae(D){const M=D._readableState;for(m("flow",M.flowing);M.flowing&&D.read()!==null;);}le.prototype.wrap=function(D){let M=!1;D.on("data",ye=>{!this.push(ye)&&D.pause&&(M=!0,D.pause())}),D.on("end",()=>{this.push(null)}),D.on("error",ye=>{w(this,ye)}),D.on("close",()=>{this.destroy()}),D.on("destroy",()=>{this.destroy()}),this._read=()=>{M&&D.resume&&(M=!1,D.resume())};const ve=a(D);for(let ye=1;ye<ve.length;ye++){const xe=ve[ye];this[xe]===void 0&&typeof D[xe]=="function"&&(this[xe]=D[xe].bind(D))}return this},le.prototype[u]=function(){return bt(this)},le.prototype.iterator=function(D){return D!==void 0&&te(D,"options"),bt(this,D)};function bt(D,M){typeof D.read!="function"&&(D=le.wrap(D,{objectMode:!0}));const ve=Ft(D,M);return ve.stream=D,ve}async function*Ft(D,M){let ve=Y;function ye(Ze){this===D?(ve(),ve=Y):ve=Ze}D.on("readable",ye);let xe;const Xe=E(D,{writable:!1},Ze=>{xe=Ze?T(xe,Ze):null,ve(),ve=Y});try{for(;;){const Ze=D.destroyed?null:D.read();if(Ze!==null)yield Ze;else{if(xe)throw xe;if(xe===null)return;await new d(ye)}}}catch(Ze){throw xe=T(xe,Ze),xe}finally{(xe||M?.destroyOnReturn!==!1)&&(xe===void 0||D._readableState.autoDestroy)?b.destroyer(D,null):(D.off("readable",ye),Xe())}}o(le.prototype,{readable:{__proto__:null,get(){const D=this._readableState;return!!D&&D.readable!==!1&&!D.destroyed&&!D.errorEmitted&&!D.endEmitted},set(D){this._readableState&&(this._readableState.readable=!!D)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(D){this._readableState&&(this._readableState.flowing=D)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(D){this._readableState&&(this._readableState.destroyed=D)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),o(ge.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[I]!==!1},set(D){this[I]=!!D}}}),le._fromList=qe;function qe(D,M){if(M.length===0)return null;let ve;return M.objectMode?ve=M.buffer.shift():!D||D>=M.length?(M.decoder?ve=M.buffer.join(""):M.buffer.length===1?ve=M.buffer.first():ve=M.buffer.concat(M.length),M.buffer.clear()):ve=M.buffer.consume(D,M.decoder),ve}function ze(D){const M=D._readableState;m("endReadable",M.endEmitted),M.endEmitted||(M.ended=!0,r.nextTick(Ii,M,D))}function Ii(D,M){if(m("endReadableNT",D.endEmitted,D.length),!D.errored&&!D.closeEmitted&&!D.endEmitted&&D.length===0){if(D.endEmitted=!0,M.emit("end"),M.writable&&M.allowHalfOpen===!1)r.nextTick(Pt,M);else if(D.autoDestroy){const ve=M._writableState;(!ve||ve.autoDestroy&&(ve.finished||ve.writable===!1))&&M.destroy()}}}function Pt(D){D.writable&&!D.writableEnded&&!D.destroyed&&D.end()}le.from=function(D,M){return F(le,D,M)};let hr;function Fr(){return hr===void 0&&(hr={}),hr}return le.fromWeb=function(D,M){return Fr().newStreamReadableFromReadableStream(D,M)},le.toWeb=function(D,M){return Fr().newReadableStreamFromStreamReadable(D,M)},le.wrap=function(D,M){var ve,ye;return new le({objectMode:(ve=(ye=D.readableObjectMode)!==null&&ye!==void 0?ye:D.objectMode)!==null&&ve!==void 0?ve:!0,...M,destroy(xe,Xe){b.destroyer(D,xe),Xe(xe)}}).wrap(D)},Cn}var $n,Es;function ya(){if(Es)return $n;Es=1;const r=ur(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:i,ObjectDefineProperty:n,ObjectDefineProperties:o,ObjectSetPrototypeOf:a,StringPrototypeToLowerCase:s,Symbol:d,SymbolHasInstance:l}=Be();$n=te,te.WritableState=A;const{EventEmitter:c}=an(),u=va().Stream,{Buffer:v}=Dt(),g=Lr(),{addAbortSignal:y}=sn(),{getHighWaterMark:k,getDefaultHighWaterMark:x}=ln(),{ERR_INVALID_ARG_TYPE:_,ERR_METHOD_NOT_IMPLEMENTED:E,ERR_MULTIPLE_CALLBACK:m,ERR_STREAM_CANNOT_PIPE:f,ERR_STREAM_DESTROYED:b,ERR_STREAM_ALREADY_FINISHED:R,ERR_STREAM_NULL_VALUES:L,ERR_STREAM_WRITE_AFTER_END:T,ERR_UNKNOWN_ENCODING:B}=it().codes,{errorOrDestroy:N}=g;a(te.prototype,u.prototype),a(te,u);function $(){}const q=d("kOnFinished");function A(O,V,oe){typeof oe!="boolean"&&(oe=V instanceof At()),this.objectMode=!!(O&&O.objectMode),oe&&(this.objectMode=this.objectMode||!!(O&&O.writableObjectMode)),this.highWaterMark=O?k(this,O,"writableHighWaterMark",oe):x(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const fe=!!(O&&O.decodeStrings===!1);this.decodeStrings=!fe,this.defaultEncoding=O&&O.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=w.bind(void 0,V),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,j(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!O||O.emitClose!==!1,this.autoDestroy=!O||O.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[q]=[]}function j(O){O.buffered=[],O.bufferedIndex=0,O.allBuffers=!0,O.allNoop=!0}A.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},n(A.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function te(O){const V=this instanceof At();if(!V&&!i(te,this))return new te(O);this._writableState=new A(O,this,V),O&&(typeof O.write=="function"&&(this._write=O.write),typeof O.writev=="function"&&(this._writev=O.writev),typeof O.destroy=="function"&&(this._destroy=O.destroy),typeof O.final=="function"&&(this._final=O.final),typeof O.construct=="function"&&(this._construct=O.construct),O.signal&&y(O.signal,this)),u.call(this,O),g.construct(this,()=>{const oe=this._writableState;oe.writing||de(this,oe),z(this,oe)})}n(te,l,{__proto__:null,value:function(O){return i(this,O)?!0:this!==te?!1:O&&O._writableState instanceof A}}),te.prototype.pipe=function(){N(this,new f)};function I(O,V,oe,fe){const he=O._writableState;if(typeof oe=="function")fe=oe,oe=he.defaultEncoding;else{if(!oe)oe=he.defaultEncoding;else if(oe!=="buffer"&&!v.isEncoding(oe))throw new B(oe);typeof fe!="function"&&(fe=$)}if(V===null)throw new L;if(!he.objectMode)if(typeof V=="string")he.decodeStrings!==!1&&(V=v.from(V,oe),oe="buffer");else if(V instanceof v)oe="buffer";else if(u._isUint8Array(V))V=u._uint8ArrayToBuffer(V),oe="buffer";else throw new _("chunk",["string","Buffer","Uint8Array"],V);let me;return he.ending?me=new T:he.destroyed&&(me=new b("write")),me?(r.nextTick(fe,me),N(O,me,!0),me):(he.pendingcb++,Z(O,he,V,oe,fe))}te.prototype.write=function(O,V,oe){return I(this,O,V,oe)===!0},te.prototype.cork=function(){this._writableState.corked++},te.prototype.uncork=function(){const O=this._writableState;O.corked&&(O.corked--,O.writing||de(this,O))},te.prototype.setDefaultEncoding=function(V){if(typeof V=="string"&&(V=s(V)),!v.isEncoding(V))throw new B(V);return this._writableState.defaultEncoding=V,this};function Z(O,V,oe,fe,he){const me=V.objectMode?1:oe.length;V.length+=me;const J=V.length<V.highWaterMark;return J||(V.needDrain=!0),V.writing||V.corked||V.errored||!V.constructed?(V.buffered.push({chunk:oe,encoding:fe,callback:he}),V.allBuffers&&fe!=="buffer"&&(V.allBuffers=!1),V.allNoop&&he!==$&&(V.allNoop=!1)):(V.writelen=me,V.writecb=he,V.writing=!0,V.sync=!0,O._write(oe,fe,V.onwrite),V.sync=!1),J&&!V.errored&&!V.destroyed}function F(O,V,oe,fe,he,me,J){V.writelen=fe,V.writecb=J,V.writing=!0,V.sync=!0,V.destroyed?V.onwrite(new b("write")):oe?O._writev(he,V.onwrite):O._write(he,me,V.onwrite),V.sync=!1}function Y(O,V,oe,fe){--V.pendingcb,fe(oe),X(V),N(O,oe)}function w(O,V){const oe=O._writableState,fe=oe.sync,he=oe.writecb;if(typeof he!="function"){N(O,new m);return}oe.writing=!1,oe.writecb=null,oe.length-=oe.writelen,oe.writelen=0,V?(V.stack,oe.errored||(oe.errored=V),O._readableState&&!O._readableState.errored&&(O._readableState.errored=V),fe?r.nextTick(Y,O,oe,V,he):Y(O,oe,V,he)):(oe.buffered.length>oe.bufferedIndex&&de(O,oe),fe?oe.afterWriteTickInfo!==null&&oe.afterWriteTickInfo.cb===he?oe.afterWriteTickInfo.count++:(oe.afterWriteTickInfo={count:1,cb:he,stream:O,state:oe},r.nextTick(U,oe.afterWriteTickInfo)):K(O,oe,1,he))}function U({stream:O,state:V,count:oe,cb:fe}){return V.afterWriteTickInfo=null,K(O,V,oe,fe)}function K(O,V,oe,fe){for(!V.ending&&!O.destroyed&&V.length===0&&V.needDrain&&(V.needDrain=!1,O.emit("drain"));oe-- >0;)V.pendingcb--,fe();V.destroyed&&X(V),z(O,V)}function X(O){if(O.writing)return;for(let he=O.bufferedIndex;he<O.buffered.length;++he){var V;const{chunk:me,callback:J}=O.buffered[he],ce=O.objectMode?1:me.length;O.length-=ce,J((V=O.errored)!==null&&V!==void 0?V:new b("write"))}const oe=O[q].splice(0);for(let he=0;he<oe.length;he++){var fe;oe[he]((fe=O.errored)!==null&&fe!==void 0?fe:new b("end"))}j(O)}function de(O,V){if(V.corked||V.bufferProcessing||V.destroyed||!V.constructed)return;const{buffered:oe,bufferedIndex:fe,objectMode:he}=V,me=oe.length-fe;if(!me)return;let J=fe;if(V.bufferProcessing=!0,me>1&&O._writev){V.pendingcb-=me-1;const ce=V.allNoop?$:le=>{for(let Re=J;Re<oe.length;++Re)oe[Re].callback(le)},ge=V.allNoop&&J===0?oe:e(oe,J);ge.allBuffers=V.allBuffers,F(O,V,!0,V.length,ge,"",ce),j(V)}else{do{const{chunk:ce,encoding:ge,callback:le}=oe[J];oe[J++]=null;const Re=he?1:ce.length;F(O,V,!1,Re,ce,ge,le)}while(J<oe.length&&!V.writing);J===oe.length?j(V):J>256?(oe.splice(0,J),V.bufferedIndex=0):V.bufferedIndex=J}V.bufferProcessing=!1}te.prototype._write=function(O,V,oe){if(this._writev)this._writev([{chunk:O,encoding:V}],oe);else throw new E("_write()")},te.prototype._writev=null,te.prototype.end=function(O,V,oe){const fe=this._writableState;typeof O=="function"?(oe=O,O=null,V=null):typeof V=="function"&&(oe=V,V=null);let he;if(O!=null){const me=I(this,O,V);me instanceof t&&(he=me)}return fe.corked&&(fe.corked=1,this.uncork()),he||(!fe.errored&&!fe.ending?(fe.ending=!0,z(this,fe,!0),fe.ended=!0):fe.finished?he=new R("end"):fe.destroyed&&(he=new b("end"))),typeof oe=="function"&&(he||fe.finished?r.nextTick(oe,he):fe[q].push(oe)),this};function H(O){return O.ending&&!O.destroyed&&O.constructed&&O.length===0&&!O.errored&&O.buffered.length===0&&!O.finished&&!O.writing&&!O.errorEmitted&&!O.closeEmitted}function G(O,V){let oe=!1;function fe(he){if(oe){N(O,he??m());return}if(oe=!0,V.pendingcb--,he){const me=V[q].splice(0);for(let J=0;J<me.length;J++)me[J](he);N(O,he,V.sync)}else H(V)&&(V.prefinished=!0,O.emit("prefinish"),V.pendingcb++,r.nextTick(ee,O,V))}V.sync=!0,V.pendingcb++;try{O._final(fe)}catch(he){fe(he)}V.sync=!1}function W(O,V){!V.prefinished&&!V.finalCalled&&(typeof O._final=="function"&&!V.destroyed?(V.finalCalled=!0,G(O,V)):(V.prefinished=!0,O.emit("prefinish")))}function z(O,V,oe){H(V)&&(W(O,V),V.pendingcb===0&&(oe?(V.pendingcb++,r.nextTick((fe,he)=>{H(he)?ee(fe,he):he.pendingcb--},O,V)):H(V)&&(V.pendingcb++,ee(O,V))))}function ee(O,V){V.pendingcb--,V.finished=!0;const oe=V[q].splice(0);for(let fe=0;fe<oe.length;fe++)oe[fe]();if(O.emit("finish"),V.autoDestroy){const fe=O._readableState;(!fe||fe.autoDestroy&&(fe.endEmitted||fe.readable===!1))&&O.destroy()}}o(te.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(O){this._writableState&&(this._writableState.destroyed=O)}},writable:{__proto__:null,get(){const O=this._writableState;return!!O&&O.writable!==!1&&!O.destroyed&&!O.errored&&!O.ending&&!O.ended},set(O){this._writableState&&(this._writableState.writable=!!O)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){const O=this._writableState;return O?!O.destroyed&&!O.ending&&O.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});const re=g.destroy;te.prototype.destroy=function(O,V){const oe=this._writableState;return!oe.destroyed&&(oe.bufferedIndex<oe.buffered.length||oe[q].length)&&r.nextTick(X,oe),re.call(this,O,V),this},te.prototype._undestroy=g.undestroy,te.prototype._destroy=function(O,V){V(O)},te.prototype[c.captureRejectionSymbol]=function(O){this.destroy(O)};let pe;function be(){return pe===void 0&&(pe={}),pe}return te.fromWeb=function(O,V){return be().newStreamWritableFromWritableStream(O,V)},te.toWeb=function(O){return be().newWritableStreamFromStreamWritable(O)},$n}var Fn,Ss;function Ru(){if(Ss)return Fn;Ss=1;const r=ur(),e=Dt(),{isReadable:t,isWritable:i,isIterable:n,isNodeStream:o,isReadableNodeStream:a,isWritableNodeStream:s,isDuplexNodeStream:d,isReadableStream:l,isWritableStream:c}=Lt(),u=Vt(),{AbortError:v,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:y}}=it(),{destroyer:k}=Lr(),x=At(),_=dn(),E=ya(),{createDeferredPromise:m}=at(),f=tc(),b=globalThis.Blob||e.Blob,R=typeof b<"u"?function(A){return A instanceof b}:function(A){return!1},L=globalThis.AbortController||yi().AbortController,{FunctionPrototypeCall:T}=Be();class B extends x{constructor(A){super(A),A?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),A?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}Fn=function q(A,j){if(d(A))return A;if(a(A))return $({readable:A});if(s(A))return $({writable:A});if(o(A))return $({writable:!1,readable:!1});if(l(A))return $({readable:_.fromWeb(A)});if(c(A))return $({writable:E.fromWeb(A)});if(typeof A=="function"){const{value:I,write:Z,final:F,destroy:Y}=N(A);if(n(I))return f(B,I,{objectMode:!0,write:Z,final:F,destroy:Y});const w=I?.then;if(typeof w=="function"){let U;const K=T(w,I,X=>{if(X!=null)throw new y("nully","body",X)},X=>{k(U,X)});return U=new B({objectMode:!0,readable:!1,write:Z,final(X){F(async()=>{try{await K,r.nextTick(X,null)}catch(de){r.nextTick(X,de)}})},destroy:Y})}throw new y("Iterable, AsyncIterable or AsyncFunction",j,I)}if(R(A))return q(A.arrayBuffer());if(n(A))return f(B,A,{objectMode:!0,writable:!1});if(l(A?.readable)&&c(A?.writable))return B.fromWeb(A);if(typeof A?.writable=="object"||typeof A?.readable=="object"){const I=A!=null&&A.readable?a(A?.readable)?A?.readable:q(A.readable):void 0,Z=A!=null&&A.writable?s(A?.writable)?A?.writable:q(A.writable):void 0;return $({readable:I,writable:Z})}const te=A?.then;if(typeof te=="function"){let I;return T(te,A,Z=>{Z!=null&&I.push(Z),I.push(null)},Z=>{k(I,Z)}),I=new B({objectMode:!0,writable:!1,read(){}})}throw new g(j,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],A)};function N(q){let{promise:A,resolve:j}=m();const te=new L,I=te.signal;return{value:q(async function*(){for(;;){const F=A;A=null;const{chunk:Y,done:w,cb:U}=await F;if(r.nextTick(U),w)return;if(I.aborted)throw new v(void 0,{cause:I.reason});({promise:A,resolve:j}=m()),yield Y}}(),{signal:I}),write(F,Y,w){const U=j;j=null,U({chunk:F,done:!1,cb:w})},final(F){const Y=j;j=null,Y({done:!0,cb:F})},destroy(F,Y){te.abort(),Y(F)}}}function $(q){const A=q.readable&&typeof q.readable.read!="function"?_.wrap(q.readable):q.readable,j=q.writable;let te=!!t(A),I=!!i(j),Z,F,Y,w,U;function K(X){const de=w;w=null,de?de(X):X&&U.destroy(X)}return U=new B({readableObjectMode:!!(A!=null&&A.readableObjectMode),writableObjectMode:!!(j!=null&&j.writableObjectMode),readable:te,writable:I}),I&&(u(j,X=>{I=!1,X&&k(A,X),K(X)}),U._write=function(X,de,H){j.write(X,de)?H():Z=H},U._final=function(X){j.end(),F=X},j.on("drain",function(){if(Z){const X=Z;Z=null,X()}}),j.on("finish",function(){if(F){const X=F;F=null,X()}})),te&&(u(A,X=>{te=!1,X&&k(A,X),K(X)}),A.on("readable",function(){if(Y){const X=Y;Y=null,X()}}),A.on("end",function(){U.push(null)}),U._read=function(){for(;;){const X=A.read();if(X===null){Y=U._read;return}if(!U.push(X))return}}),U._destroy=function(X,de){!X&&w!==null&&(X=new v),Y=null,Z=null,F=null,w===null?de(X):(w=de,k(j,X),k(A,X))},U}return Fn}var Pn,Rs;function At(){if(Rs)return Pn;Rs=1;const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:i}=Be();Pn=a;const n=dn(),o=ya();i(a.prototype,n.prototype),i(a,n);{const c=t(o.prototype);for(let u=0;u<c.length;u++){const v=c[u];a.prototype[v]||(a.prototype[v]=o.prototype[v])}}function a(c){if(!(this instanceof a))return new a(c);n.call(this,c),o.call(this,c),c?(this.allowHalfOpen=c.allowHalfOpen!==!1,c.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),c.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}r(a.prototype,{writable:{__proto__:null,...e(o.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(o.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(o.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(o.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(o.prototype,"writableLength")},writableFinished:{__proto__:null,...e(o.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(o.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(o.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(o.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(c){this._readableState&&this._writableState&&(this._readableState.destroyed=c,this._writableState.destroyed=c)}}});let s;function d(){return s===void 0&&(s={}),s}a.fromWeb=function(c,u){return d().newStreamDuplexFromReadableWritablePair(c,u)},a.toWeb=function(c){return d().newReadableWritablePairFromDuplex(c)};let l;return a.from=function(c){return l||(l=Ru()),l(c,"body")},Pn}var Mn,Ns;function rc(){if(Ns)return Mn;Ns=1;const{ObjectSetPrototypeOf:r,Symbol:e}=Be();Mn=a;const{ERR_METHOD_NOT_IMPLEMENTED:t}=it().codes,i=At(),{getHighWaterMark:n}=ln();r(a.prototype,i.prototype),r(a,i);const o=e("kCallback");function a(l){if(!(this instanceof a))return new a(l);const c=l?n(this,l,"readableHighWaterMark",!0):null;c===0&&(l={...l,highWaterMark:null,readableHighWaterMark:c,writableHighWaterMark:l.writableHighWaterMark||0}),i.call(this,l),this._readableState.sync=!1,this[o]=null,l&&(typeof l.transform=="function"&&(this._transform=l.transform),typeof l.flush=="function"&&(this._flush=l.flush)),this.on("prefinish",d)}function s(l){typeof this._flush=="function"&&!this.destroyed?this._flush((c,u)=>{if(c){l?l(c):this.destroy(c);return}u!=null&&this.push(u),this.push(null),l&&l()}):(this.push(null),l&&l())}function d(){this._final!==s&&s.call(this)}return a.prototype._final=s,a.prototype._transform=function(l,c,u){throw new t("_transform()")},a.prototype._write=function(l,c,u){const v=this._readableState,g=this._writableState,y=v.length;this._transform(l,c,(k,x)=>{if(k){u(k);return}x!=null&&this.push(x),g.ended||y===v.length||v.length<v.highWaterMark?u():this[o]=u})},a.prototype._read=function(){if(this[o]){const l=this[o];this[o]=null,l()}},Mn}var Bn,Is;function ic(){if(Is)return Bn;Is=1;const{ObjectSetPrototypeOf:r}=Be();Bn=t;const e=rc();r(t.prototype,e.prototype),r(t,e);function t(i){if(!(this instanceof t))return new t(i);e.call(this,i)}return t.prototype._transform=function(i,n,o){o(null,i)},Bn}var qn,Ts;function wa(){if(Ts)return qn;Ts=1;const r=ur(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:i,SymbolDispose:n}=Be(),o=Vt(),{once:a}=at(),s=Lr(),d=At(),{aggregateTwoErrors:l,codes:{ERR_INVALID_ARG_TYPE:c,ERR_INVALID_RETURN_VALUE:u,ERR_MISSING_ARGS:v,ERR_STREAM_DESTROYED:g,ERR_STREAM_PREMATURE_CLOSE:y},AbortError:k}=it(),{validateFunction:x,validateAbortSignal:_}=Ei(),{isIterable:E,isReadable:m,isReadableNodeStream:f,isNodeStream:b,isTransformStream:R,isWebStream:L,isReadableStream:T,isReadableFinished:B}=Lt(),N=globalThis.AbortController||yi().AbortController;let $,q,A;function j(X,de,H){let G=!1;X.on("close",()=>{G=!0});const W=o(X,{readable:de,writable:H},z=>{G=!z});return{destroy:z=>{G||(G=!0,s.destroyer(X,z||new g("pipe")))},cleanup:W}}function te(X){return x(X[X.length-1],"streams[stream.length - 1]"),X.pop()}function I(X){if(E(X))return X;if(f(X))return Z(X);throw new c("val",["Readable","Iterable","AsyncIterable"],X)}async function*Z(X){q||(q=dn()),yield*q.prototype[i].call(X)}async function F(X,de,H,{end:G}){let W,z=null;const ee=be=>{if(be&&(W=be),z){const O=z;z=null,O()}},re=()=>new t((be,O)=>{W?O(W):z=()=>{W?O(W):be()}});de.on("drain",ee);const pe=o(de,{readable:!1},ee);try{de.writableNeedDrain&&await re();for await(const be of X)de.write(be)||await re();G&&(de.end(),await re()),H()}catch(be){H(W!==be?l(W,be):be)}finally{pe(),de.off("drain",ee)}}async function Y(X,de,H,{end:G}){R(de)&&(de=de.writable);const W=de.getWriter();try{for await(const z of X)await W.ready,W.write(z).catch(()=>{});await W.ready,G&&await W.close(),H()}catch(z){try{await W.abort(z),H(z)}catch(ee){H(ee)}}}function w(...X){return U(X,a(te(X)))}function U(X,de,H){if(X.length===1&&e(X[0])&&(X=X[0]),X.length<2)throw new v("streams");const G=new N,W=G.signal,z=H?.signal,ee=[];_(z,"options.signal");function re(){he(new k)}A=A||at().addAbortListener;let pe;z&&(pe=A(z,re));let be,O;const V=[];let oe=0;function fe(ge){he(ge,--oe===0)}function he(ge,le){var Re;if(ge&&(!be||be.code==="ERR_STREAM_PREMATURE_CLOSE")&&(be=ge),!(!be&&!le)){for(;V.length;)V.shift()(be);(Re=pe)===null||Re===void 0||Re[n](),G.abort(),le&&(be||ee.forEach(We=>We()),r.nextTick(de,be,O))}}let me;for(let ge=0;ge<X.length;ge++){const le=X[ge],Re=ge<X.length-1,We=ge>0,Ee=Re||H?.end!==!1,Qe=ge===X.length-1;if(b(le)){let S=function(p){p&&p.name!=="AbortError"&&p.code!=="ERR_STREAM_PREMATURE_CLOSE"&&fe(p)};if(Ee){const{destroy:p,cleanup:h}=j(le,Re,We);V.push(p),m(le)&&Qe&&ee.push(h)}le.on("error",S),m(le)&&Qe&&ee.push(()=>{le.removeListener("error",S)})}if(ge===0)if(typeof le=="function"){if(me=le({signal:W}),!E(me))throw new u("Iterable, AsyncIterable or Stream","source",me)}else E(le)||f(le)||R(le)?me=le:me=d.from(le);else if(typeof le=="function"){if(R(me)){var J;me=I((J=me)===null||J===void 0?void 0:J.readable)}else me=I(me);if(me=le(me,{signal:W}),Re){if(!E(me,!0))throw new u("AsyncIterable",`transform[${ge-1}]`,me)}else{var ce;$||($=ic());const S=new $({objectMode:!0}),p=(ce=me)===null||ce===void 0?void 0:ce.then;if(typeof p=="function")oe++,p.call(me,Q=>{O=Q,Q!=null&&S.write(Q),Ee&&S.end(),r.nextTick(fe)},Q=>{S.destroy(Q),r.nextTick(fe,Q)});else if(E(me,!0))oe++,F(me,S,fe,{end:Ee});else if(T(me)||R(me)){const Q=me.readable||me;oe++,F(Q,S,fe,{end:Ee})}else throw new u("AsyncIterable or Promise","destination",me);me=S;const{destroy:h,cleanup:C}=j(me,!1,!0);V.push(h),Qe&&ee.push(C)}}else if(b(le)){if(f(me)){oe+=2;const S=K(me,le,fe,{end:Ee});m(le)&&Qe&&ee.push(S)}else if(R(me)||T(me)){const S=me.readable||me;oe++,F(S,le,fe,{end:Ee})}else if(E(me))oe++,F(me,le,fe,{end:Ee});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else if(L(le)){if(f(me))oe++,Y(I(me),le,fe,{end:Ee});else if(T(me)||E(me))oe++,Y(me,le,fe,{end:Ee});else if(R(me))oe++,Y(me.readable,le,fe,{end:Ee});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else me=d.from(le)}return(W!=null&&W.aborted||z!=null&&z.aborted)&&r.nextTick(re),me}function K(X,de,H,{end:G}){let W=!1;if(de.on("close",()=>{W||H(new y)}),X.pipe(de,{end:!1}),G){let z=function(){W=!0,de.end()};B(X)?r.nextTick(z):X.once("end",z)}else H();return o(X,{readable:!0,writable:!1},z=>{const ee=X._readableState;z&&z.code==="ERR_STREAM_PREMATURE_CLOSE"&&ee&&ee.ended&&!ee.errored&&!ee.errorEmitted?X.once("end",H).once("error",H):H(z)}),o(de,{readable:!1,writable:!0},H)}return qn={pipelineImpl:U,pipeline:w},qn}var zn,As;function nc(){if(As)return zn;As=1;const{pipeline:r}=wa(),e=At(),{destroyer:t}=Lr(),{isNodeStream:i,isReadable:n,isWritable:o,isWebStream:a,isTransformStream:s,isWritableStream:d,isReadableStream:l}=Lt(),{AbortError:c,codes:{ERR_INVALID_ARG_VALUE:u,ERR_MISSING_ARGS:v}}=it(),g=Vt();return zn=function(...k){if(k.length===0)throw new v("streams");if(k.length===1)return e.from(k[0]);const x=[...k];if(typeof k[0]=="function"&&(k[0]=e.from(k[0])),typeof k[k.length-1]=="function"){const $=k.length-1;k[$]=e.from(k[$])}for(let $=0;$<k.length;++$)if(!(!i(k[$])&&!a(k[$]))){if($<k.length-1&&!(n(k[$])||l(k[$])||s(k[$])))throw new u(`streams[${$}]`,x[$],"must be readable");if($>0&&!(o(k[$])||d(k[$])||s(k[$])))throw new u(`streams[${$}]`,x[$],"must be writable")}let _,E,m,f,b;function R($){const q=f;f=null,q?q($):$?b.destroy($):!N&&!B&&b.destroy()}const L=k[0],T=r(k,R),B=!!(o(L)||d(L)||s(L)),N=!!(n(T)||l(T)||s(T));if(b=new e({writableObjectMode:!!(L!=null&&L.writableObjectMode),readableObjectMode:!!(T!=null&&T.readableObjectMode),writable:B,readable:N}),B){if(i(L))b._write=function(q,A,j){L.write(q,A)?j():_=j},b._final=function(q){L.end(),E=q},L.on("drain",function(){if(_){const q=_;_=null,q()}});else if(a(L)){const A=(s(L)?L.writable:L).getWriter();b._write=async function(j,te,I){try{await A.ready,A.write(j).catch(()=>{}),I()}catch(Z){I(Z)}},b._final=async function(j){try{await A.ready,A.close().catch(()=>{}),E=j}catch(te){j(te)}}}const $=s(T)?T.readable:T;g($,()=>{if(E){const q=E;E=null,q()}})}if(N){if(i(T))T.on("readable",function(){if(m){const $=m;m=null,$()}}),T.on("end",function(){b.push(null)}),b._read=function(){for(;;){const $=T.read();if($===null){m=b._read;return}if(!b.push($))return}};else if(a(T)){const q=(s(T)?T.readable:T).getReader();b._read=async function(){for(;;)try{const{value:A,done:j}=await q.read();if(!b.push(A))return;if(j){b.push(null);return}}catch{return}}}}return b._destroy=function($,q){!$&&f!==null&&($=new c),m=null,_=null,E=null,f===null?q($):(f=q,i(T)&&t(T,$))},b},zn}var js;function Nu(){if(js)return $i;js=1;const r=globalThis.AbortController||yi().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:i,ERR_OUT_OF_RANGE:n},AbortError:o}=it(),{validateAbortSignal:a,validateInteger:s,validateObject:d}=Ei(),l=Be().Symbol("kWeak"),c=Be().Symbol("kResistStopPropagation"),{finished:u}=Vt(),v=nc(),{addAbortSignalNoValidate:g}=sn(),{isWritable:y,isNodeStream:k}=Lt(),{deprecate:x}=at(),{ArrayPrototypePush:_,Boolean:E,MathFloor:m,Number:f,NumberIsNaN:b,Promise:R,PromiseReject:L,PromiseResolve:T,PromisePrototypeThen:B,Symbol:N}=Be(),$=N("kEmpty"),q=N("kEof");function A(z,ee){if(ee!=null&&d(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),k(z)&&!y(z))throw new e("stream",z,"must be writable");const re=v(this,z);return ee!=null&&ee.signal&&g(ee.signal,re),re}function j(z,ee){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);ee!=null&&d(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal");let re=1;ee?.concurrency!=null&&(re=m(ee.concurrency));let pe=re-1;return ee?.highWaterMark!=null&&(pe=m(ee.highWaterMark)),s(re,"options.concurrency",1),s(pe,"options.highWaterMark",0),pe+=re,(async function*(){const O=at().AbortSignalAny([ee?.signal].filter(E)),V=this,oe=[],fe={signal:O};let he,me,J=!1,ce=0;function ge(){J=!0,le()}function le(){ce-=1,Re()}function Re(){me&&!J&&ce<re&&oe.length<pe&&(me(),me=null)}async function We(){try{for await(let Ee of V){if(J)return;if(O.aborted)throw new o;try{if(Ee=z(Ee,fe),Ee===$)continue;Ee=T(Ee)}catch(Qe){Ee=L(Qe)}ce+=1,B(Ee,le,ge),oe.push(Ee),he&&(he(),he=null),!J&&(oe.length>=pe||ce>=re)&&await new R(Qe=>{me=Qe})}oe.push(q)}catch(Ee){const Qe=L(Ee);B(Qe,le,ge),oe.push(Qe)}finally{J=!0,he&&(he(),he=null)}}We();try{for(;;){for(;oe.length>0;){const Ee=await oe[0];if(Ee===q)return;if(O.aborted)throw new o;Ee!==$&&(yield Ee),oe.shift(),Re()}await new R(Ee=>{he=Ee})}}finally{J=!0,me&&(me(),me=null)}}).call(this)}function te(z=void 0){return z!=null&&d(z,"options"),z?.signal!=null&&a(z.signal,"options.signal"),(async function*(){let re=0;for await(const be of this){var pe;if(z!=null&&(pe=z.signal)!==null&&pe!==void 0&&pe.aborted)throw new o({cause:z.signal.reason});yield[re++,be]}}).call(this)}async function I(z,ee=void 0){for await(const re of w.call(this,z,ee))return!0;return!1}async function Z(z,ee=void 0){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);return!await I.call(this,async(...re)=>!await z(...re),ee)}async function F(z,ee){for await(const re of w.call(this,z,ee))return re}async function Y(z,ee){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);async function re(pe,be){return await z(pe,be),$}for await(const pe of j.call(this,re,ee));}function w(z,ee){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);async function re(pe,be){return await z(pe,be)?pe:$}return j.call(this,re,ee)}class U extends i{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function K(z,ee,re){var pe;if(typeof z!="function")throw new t("reducer",["Function","AsyncFunction"],z);re!=null&&d(re,"options"),re?.signal!=null&&a(re.signal,"options.signal");let be=arguments.length>1;if(re!=null&&(pe=re.signal)!==null&&pe!==void 0&&pe.aborted){const he=new o(void 0,{cause:re.signal.reason});throw this.once("error",()=>{}),await u(this.destroy(he)),he}const O=new r,V=O.signal;if(re!=null&&re.signal){const he={once:!0,[l]:this,[c]:!0};re.signal.addEventListener("abort",()=>O.abort(),he)}let oe=!1;try{for await(const he of this){var fe;if(oe=!0,re!=null&&(fe=re.signal)!==null&&fe!==void 0&&fe.aborted)throw new o;be?ee=await z(ee,he,{signal:V}):(ee=he,be=!0)}if(!oe&&!be)throw new U}finally{O.abort()}return ee}async function X(z){z!=null&&d(z,"options"),z?.signal!=null&&a(z.signal,"options.signal");const ee=[];for await(const pe of this){var re;if(z!=null&&(re=z.signal)!==null&&re!==void 0&&re.aborted)throw new o(void 0,{cause:z.signal.reason});_(ee,pe)}return ee}function de(z,ee){const re=j.call(this,z,ee);return(async function*(){for await(const be of re)yield*be}).call(this)}function H(z){if(z=f(z),b(z))return 0;if(z<0)throw new n("number",">= 0",z);return z}function G(z,ee=void 0){return ee!=null&&d(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),z=H(z),(async function*(){var pe;if(ee!=null&&(pe=ee.signal)!==null&&pe!==void 0&&pe.aborted)throw new o;for await(const O of this){var be;if(ee!=null&&(be=ee.signal)!==null&&be!==void 0&&be.aborted)throw new o;z--<=0&&(yield O)}}).call(this)}function W(z,ee=void 0){return ee!=null&&d(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),z=H(z),(async function*(){var pe;if(ee!=null&&(pe=ee.signal)!==null&&pe!==void 0&&pe.aborted)throw new o;for await(const O of this){var be;if(ee!=null&&(be=ee.signal)!==null&&be!==void 0&&be.aborted)throw new o;if(z-- >0&&(yield O),z<=0)return}}).call(this)}return $i.streamReturningOperators={asIndexedPairs:x(te,"readable.asIndexedPairs will be removed in a future version."),drop:G,filter:w,flatMap:de,map:j,take:W,compose:A},$i.promiseReturningOperators={every:Z,forEach:Y,reduce:K,toArray:X,some:I,find:F},$i}var Un,Ds;function oc(){if(Ds)return Un;Ds=1;const{ArrayPrototypePop:r,Promise:e}=Be(),{isIterable:t,isNodeStream:i,isWebStream:n}=Lt(),{pipelineImpl:o}=wa(),{finished:a}=Vt();ac();function s(...d){return new e((l,c)=>{let u,v;const g=d[d.length-1];if(g&&typeof g=="object"&&!i(g)&&!t(g)&&!n(g)){const y=r(d);u=y.signal,v=y.end}o(d,(y,k)=>{y?c(y):l(k)},{signal:u,end:v})})}return Un={finished:a,pipeline:s},Un}var Ls;function ac(){if(Ls)return wn.exports;Ls=1;const{Buffer:r}=Dt(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:i}=Be(),{promisify:{custom:n}}=at(),{streamReturningOperators:o,promiseReturningOperators:a}=Nu(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:s}}=it(),d=nc(),{setDefaultHighWaterMark:l,getDefaultHighWaterMark:c}=ln(),{pipeline:u}=wa(),{destroyer:v}=Lr(),g=Vt(),y=oc(),k=Lt(),x=wn.exports=va().Stream;x.isDestroyed=k.isDestroyed,x.isDisturbed=k.isDisturbed,x.isErrored=k.isErrored,x.isReadable=k.isReadable,x.isWritable=k.isWritable,x.Readable=dn();for(const E of t(o)){let f=function(...b){if(new.target)throw s();return x.Readable.from(i(m,this,b))};const m=o[E];e(f,"name",{__proto__:null,value:m.name}),e(f,"length",{__proto__:null,value:m.length}),e(x.Readable.prototype,E,{__proto__:null,value:f,enumerable:!1,configurable:!0,writable:!0})}for(const E of t(a)){let f=function(...b){if(new.target)throw s();return i(m,this,b)};const m=a[E];e(f,"name",{__proto__:null,value:m.name}),e(f,"length",{__proto__:null,value:m.length}),e(x.Readable.prototype,E,{__proto__:null,value:f,enumerable:!1,configurable:!0,writable:!0})}x.Writable=ya(),x.Duplex=At(),x.Transform=rc(),x.PassThrough=ic(),x.pipeline=u;const{addAbortSignal:_}=sn();return x.addAbortSignal=_,x.finished=g,x.destroy=v,x.compose=d,x.setDefaultHighWaterMark=l,x.getDefaultHighWaterMark=c,e(x,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return y}}),e(u,n,{__proto__:null,enumerable:!0,get(){return y.pipeline}}),e(g,n,{__proto__:null,enumerable:!0,get(){return y.finished}}),x.Stream=x,x._isUint8Array=function(m){return m instanceof Uint8Array},x._uint8ArrayToBuffer=function(m){return r.from(m.buffer,m.byteOffset,m.byteLength)},wn.exports}var Os;function sc(){return Os||(Os=1,function(r){const e=ac(),t=oc(),i=e.Readable.destroy;r.exports=e.Readable,r.exports._uint8ArrayToBuffer=e._uint8ArrayToBuffer,r.exports._isUint8Array=e._isUint8Array,r.exports.isDisturbed=e.isDisturbed,r.exports.isErrored=e.isErrored,r.exports.isReadable=e.isReadable,r.exports.Readable=e.Readable,r.exports.Writable=e.Writable,r.exports.Duplex=e.Duplex,r.exports.Transform=e.Transform,r.exports.PassThrough=e.PassThrough,r.exports.addAbortSignal=e.addAbortSignal,r.exports.finished=e.finished,r.exports.destroy=e.destroy,r.exports.destroy=i,r.exports.pipeline=e.pipeline,r.exports.compose=e.compose,Object.defineProperty(e,"promises",{configurable:!0,enumerable:!0,get(){return t}}),r.exports.Stream=e.Stream,r.exports.default=r.exports}(yn)),yn.exports}var xa=sc();const Hn=Symbol("iter");function pi(r,e,t=4){if(t===0)return Object.assign(r,e);for(const i in e)r[i]=pi(r[i]||Object.create(null),e[i],t-1);return r}function lc(r,e,t=4){let i=!1;for(const n in r)if(n in e){const o=t===0?null:lc(r[n],e[n],t-1);if(o!==!1)i=i||Object.create(null),i[n]=o;else if(t===3)return!1}return i}function dc(r,e,t=4){let i=!1;for(const n in r)if(!(n in e))i=i||Object.create(null),i[n]=t===0?null:pi({},r[n],t-1);else if(t!==0){const o=dc(r[n],e[n],t-1);if(o!==!1)i=i||Object.create(null),i[n]=o;else if(t===3)return!1}return i}class Iu{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||Ne}_termFromId(e){if(e[0]==="."){const t=this._entities,i=e.split(".");return this._factory.quad(this._termFromId(t[i[1]]),this._termFromId(t[i[2]]),this._termFromId(t[i[3]]),i[4]&&this._termFromId(t[i[4]]))}return di(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){const t=this._termToNumericId(e.subject),i=this._termToNumericId(e.predicate),n=this._termToNumericId(e.object);let o;return t&&i&&n&&(na(e.graph)||(o=this._termToNumericId(e.graph)))&&this._ids[o?`.${t}.${i}.${n}.${o}`:`.${t}.${i}.${n}`]}return this._ids[Er(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${na(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Er(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,i;if(e)for(t=e=`_:${e}`,i=1;this._ids[t];)t=e+i++;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 tt{constructor(e,t){this._size=0,this._graphs=Object.create(null),!t&&e&&!e[0]&&typeof e.match!="function"&&(t=e,e=null),t=t||{},this._factory=t.factory||Ne,this._entityIndex=t.entityIndex||new Iu({factory:this._factory}),this._entities=this._entityIndex._entities,this._termFromId=this._entityIndex._termFromId.bind(this._entityIndex),this._termToNumericId=this._entityIndex._termToNumericId.bind(this._entityIndex),this._termToNewNumericId=this._entityIndex._termToNewNumericId.bind(this._entityIndex),e&&this.addAll(e)}get size(){let e=this._size;if(e!==null)return e;e=0;const t=this._graphs;let i,n;for(const o in t)for(const a in i=t[o].subjects)for(const s in n=i[a])e+=Object.keys(n[s]).length;return this._size=e}_addToIndex(e,t,i,n){const o=e[t]||(e[t]={}),a=o[i]||(o[i]={}),s=n in a;return s||(a[n]=null),!s}_removeFromIndex(e,t,i,n){const o=e[t],a=o[i];delete a[n];for(const s in a)return;delete o[i];for(const s in o)return;delete e[t]}*_findInIndex(e,t,i,n,o,a,s,d){let l,c,u;const v=this._entities,g=this._termFromId(v[d]),y={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const k in e)if(c=e[k]){y[o]=this._termFromId(v[k]),i&&((l=c,c={})[i]=l[i]);for(const x in c)if(u=c[x]){y[a]=this._termFromId(v[x]);const _=n?n in u?[n]:[]:Object.keys(u);for(let E=0;E<_.length;E++)y[s]=this._termFromId(v[_[E]]),yield this._factory.quad(y.subject,y.predicate,y.object,g)}}}_loop(e,t){for(const i in e)t(i)}_loopByKey0(e,t,i){let n,o;if(n=e[t])for(o in n)i(o)}_loopByKey1(e,t,i){let n,o;for(n in e)o=e[n],o[t]&&i(n)}_loopBy2Keys(e,t,i,n){let o,a,s;if((o=e[t])&&(a=o[i]))for(s in a)n(s)}_countInIndex(e,t,i,n){let o=0,a,s,d;t&&((a=e,e={})[t]=a[t]);for(const l in e)if(s=e[l]){i&&((a=s,s={})[i]=a[i]);for(const c in s)(d=s[c])&&(n?n in d&&o++:o+=Object.keys(d).length)}return o}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){const t=Object.create(null);return i=>{i in t||(t[i]=!0,e(this._termFromId(this._entities[i],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,i,n){t||(n=e.graph,i=e.object,t=e.predicate,e=e.subject),n=n?this._termToNewNumericId(n):1;let o=this._graphs[n];return o||(o=this._graphs[n]={subjects:{},predicates:{},objects:{}},Object.freeze(o)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),i=this._termToNewNumericId(i),this._addToIndex(o.subjects,e,t,i)?(this._addToIndex(o.predicates,t,i,e),this._addToIndex(o.objects,i,e,t),this._size=null,!0):!1}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}delete(e){return this.removeQuad(e),this}has(e,t,i,n){return e&&e.subject&&({subject:e,predicate:t,object:i,graph:n}=e),!this.readQuads(e,t,i,n).next().done}import(e){return e.on("data",t=>{this.addQuad(t)}),e}removeQuad(e,t,i,n){t||({subject:e,predicate:t,object:i,graph:n}=e),n=n?this._termToNumericId(n):1;const o=this._graphs;let a,s,d;if(!(e=e&&this._termToNumericId(e))||!(t=t&&this._termToNumericId(t))||!(i=i&&this._termToNumericId(i))||!(a=o[n])||!(s=a.subjects[e])||!(d=s[t])||!(i in d))return!1;this._removeFromIndex(a.subjects,e,t,i),this._removeFromIndex(a.predicates,t,i,e),this._removeFromIndex(a.objects,i,e,t),this._size!==null&&this._size--;for(e in a.subjects)return!0;return delete o[n],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t])}remove(e){return e.on("data",t=>{this.removeQuad(t)}),e}removeMatches(e,t,i,n){const o=new xa.Readable({objectMode:!0}),a=this.readQuads(e,t,i,n);return o._read=s=>{for(;--s>=0;){const{done:d,value:l}=a.next();if(d){o.push(null);return}o.push(l)}},this.remove(o)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,i,n){return[...this.readQuads(e,t,i,n)]}*readQuads(e,t,i,n){const o=this._getGraphs(n);let a,s,d,l;if(!(e&&!(s=this._termToNumericId(e))||t&&!(d=this._termToNumericId(t))||i&&!(l=this._termToNumericId(i))))for(const c in o)(a=o[c])&&(s?l?yield*this._findInIndex(a.objects,l,s,d,"object","subject","predicate",c):yield*this._findInIndex(a.subjects,s,d,null,"subject","predicate","object",c):d?yield*this._findInIndex(a.predicates,d,l,null,"predicate","object","subject",c):l?yield*this._findInIndex(a.objects,l,null,null,"object","subject","predicate",c):yield*this._findInIndex(a.subjects,null,null,null,"subject","predicate","object",c))}match(e,t,i,n){return new Bt(this,e,t,i,n,{entityIndex:this._entityIndex})}countQuads(e,t,i,n){const o=this._getGraphs(n);let a=0,s,d,l,c;if(e&&!(d=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||i&&!(c=this._termToNumericId(i)))return 0;for(const u in o)(s=o[u])&&(e?i?a+=this._countInIndex(s.objects,c,d,l):a+=this._countInIndex(s.subjects,d,l,c):t?a+=this._countInIndex(s.predicates,l,c,d):a+=this._countInIndex(s.objects,c,d,l));return a}forEach(e,t,i,n,o){this.some(a=>(e(a,this),!1),t,i,n,o)}every(e,t,i,n,o){return!this.some(a=>!e(a,this),t,i,n,o)}some(e,t,i,n,o){for(const a of this.readQuads(t,i,n,o))if(e(a,this))return!0;return!1}getSubjects(e,t,i){const n=[];return this.forSubjects(o=>{n.push(o)},e,t,i),n}forSubjects(e,t,i,n){const o=this._getGraphs(n);let a,s,d;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||i&&!(d=this._termToNumericId(i))))for(n in o)(a=o[n])&&(s?d?this._loopBy2Keys(a.predicates,s,d,e):this._loopByKey1(a.subjects,s,e):d?this._loopByKey0(a.objects,d,e):this._loop(a.subjects,e))}getPredicates(e,t,i){const n=[];return this.forPredicates(o=>{n.push(o)},e,t,i),n}forPredicates(e,t,i,n){const o=this._getGraphs(n);let a,s,d;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||i&&!(d=this._termToNumericId(i))))for(n in o)(a=o[n])&&(s?d?this._loopBy2Keys(a.objects,d,s,e):this._loopByKey0(a.subjects,s,e):d?this._loopByKey1(a.predicates,d,e):this._loop(a.predicates,e))}getObjects(e,t,i){const n=[];return this.forObjects(o=>{n.push(o)},e,t,i),n}forObjects(e,t,i,n){const o=this._getGraphs(n);let a,s,d;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||i&&!(d=this._termToNumericId(i))))for(n in o)(a=o[n])&&(s?d?this._loopBy2Keys(a.subjects,s,d,e):this._loopByKey1(a.objects,s,e):d?this._loopByKey0(a.predicates,d,e):this._loop(a.objects,e))}getGraphs(e,t,i){const n=[];return this.forGraphs(o=>{n.push(o)},e,t,i),n}forGraphs(e,t,i,n){for(const o in this._graphs)this.some(a=>(e(a.graph),!0),t,i,n,this._termFromId(this._entities[o]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const i={},n=t?()=>!0:(s,d)=>{throw new Error(`${s.value} ${d}`)},o=this.getQuads(null,Ke.rdf.rest,Ke.rdf.nil,null),a=e?[...o]:[];return o.forEach(s=>{const d=[];let l=!1,c,u;const v=s.graph;let g=s.subject;for(;g&&!l;){const y=this.getQuads(null,null,g,null),k=this.getQuads(g,null,null,null);let x,_=null,E=null,m=null;for(let f=0;f<k.length&&!l;f++)x=k[f],x.graph.equals(v)?c?l=n(g,"has non-list arcs out"):x.predicate.value===Ke.rdf.first?_?l=n(g,"has multiple rdf:first arcs"):a.push(_=x):x.predicate.value===Ke.rdf.rest?E?l=n(g,"has multiple rdf:rest arcs"):a.push(E=x):y.length?l=n(g,"can't be subject and object"):(c=x,u="subject"):l=n(g,"not confined to single graph");for(let f=0;f<y.length&&!l;++f)x=y[f],c?l=n(g,"can't have coreferences"):x.predicate.value===Ke.rdf.rest?m?l=n(g,"has incoming rdf:rest arcs"):m=x:(c=x,u="object");_?d.unshift(_.object):l=n(g,"has no list head"),g=m&&m.subject}l?e=!1:c&&(i[c[u].value]=d)}),e&&this.removeQuads(a),i}addAll(e){if(e instanceof Bt&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof tt&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=pi(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof Bt&&(e=e.filtered),e===this)return!0;if(!(e instanceof tt)||this._entityIndex!==e._entityIndex)return e.every(l=>this.has(l));const t=this._graphs,i=e._graphs;let n,o,a,s,d;for(const l in i){if(!(n=t[l]))return!1;n=n.subjects;for(const c in o=i[l].subjects){if(!(a=n[c]))return!1;for(const u in s=o[c]){if(!(d=a[u]))return!1;for(const v in s[u])if(!(v in d))return!1}}}return!0}deleteMatches(e,t,i,n){for(const o of this.match(e,t,i,n))this.removeQuad(o);return this}difference(e){if(e&&e instanceof Bt&&(e=e.filtered),e===this)return new tt({entityIndex:this._entityIndex});if(e instanceof tt&&e._entityIndex===this._entityIndex){const t=new tt({entityIndex:this._entityIndex}),i=dc(this._graphs,e._graphs);return i&&(t._graphs=i,t._size=null),t}return this.filter(t=>!e.has(t))}equals(e){return e instanceof Bt&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new tt({entityIndex:this._entityIndex});for(const i of this)e(i,this)&&t.add(i);return t}intersection(e){if(e instanceof Bt&&(e=e.filtered),e===this){const t=new tt({entityIndex:this._entityIndex});return t._graphs=pi(Object.create(null),this._graphs),t._size=this._size,t}else if(e instanceof tt&&this._entityIndex===e._entityIndex){const t=new tt({entityIndex:this._entityIndex}),i=lc(e._graphs,this._graphs);return i&&(t._graphs=i,t._size=null),t}return this.filter(t=>e.has(t))}map(e){const t=new tt({entityIndex:this._entityIndex});for(const i of this)t.add(e(i,this));return t}reduce(e,t){const i=this.readQuads();let n=t===void 0?i.next().value:t;for(const o of i)n=e(n,o,this);return n}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new ga().quadsToString(this)}union(e){const t=new tt({entityIndex:this._entityIndex});return t._graphs=pi(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function _t(r,e,t=0){const i=e[t];if(i&&!(i in r))return!1;let n=!1;for(const o in i?{[i]:r[i]}:r){const a=t===2?null:_t(r[o],e,t+1);a!==!1&&(n=n||Object.create(null),n[o]=a)}return n}class Bt extends xa.Readable{constructor(e,t,i,n,o,a){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:i,object:n,graph:o,options:a})}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:i,predicate:n,subject:o}=this,a=this._filtered=new tt({factory:e._factory,entityIndex:this.options.entityIndex});let s,d,l;if(o&&!(s=a._termToNumericId(o))||n&&!(d=a._termToNumericId(n))||i&&!(l=a._termToNumericId(i)))return a;const c=e._getGraphs(t);for(const u in c){let v,g,y,k;(k=c[u])&&(!s&&d?(g=_t(k.predicates,[d,l,s]))&&(v=_t(k.subjects,[s,d,l]),y=_t(k.objects,[l,s,d])):l?(y=_t(k.objects,[l,s,d]))&&(v=_t(k.subjects,[s,d,l]),g=_t(k.predicates,[d,l,s])):(v=_t(k.subjects,[s,d,l]))&&(g=_t(k.predicates,[d,l,s]),y=_t(k.objects,[l,s,d])),v&&(a._graphs[u]={subjects:v,predicates:g,objects:y}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Hn]&&(this[Hn]=this[Symbol.iterator]());const t=this[Hn];for(;--e>=0;){const{done:i,value:n}=t.next();if(i){this.push(null);return}this.push(n)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,i,n){return this.filtered.deleteMatches(e,t,i,n)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,i,n,o){return this.filtered.every(e,t,i,n,o)}filter(e){return this.filtered.filter(e)}forEach(e,t,i,n,o){return this.filtered.forEach(e,t,i,n,o)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,t,i,n,o){return this.filtered.some(e,t,i,n,o)}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 ga().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,i,n){return new Bt(this.filtered,e,t,i,n,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}class Tu extends xa.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;const t=new Yd(e);let i,n;const o={onQuad:(a,s)=>{a&&this.emit("error",a)||s&&this.push(s)},onPrefix:(a,s)=>{this.emit("prefix",a,s)}};e&&e.comments&&(o.onComment=a=>{this.emit("comment",a)}),t.parse({on:(a,s)=>{switch(a){case"data":i=s;break;case"end":n=s;break}}},o),this._transform=(a,s,d)=>{i(a),d()},this._flush=a=>{n(),a()}}import(e){return e.on("data",t=>{this.write(t)}),e.on("end",()=>{this.end()}),e.on("error",t=>{this.emit("error",t)}),this}}const _e="http://www.w3.org/ns/shacl#",Cs="http://datashapes.org/dash#",Ht="http://www.w3.org/2001/XMLSchema#",qt="http://www.w3.org/1999/02/22-rdf-syntax-ns#",_a="http://www.w3.org/2000/01/rdf-schema#",ka="http://www.w3.org/2004/02/skos/core#",Au="http://www.w3.org/2002/07/owl#",ju="http://www.w3.org/ns/oa#",Du="http://purl.org/dc/terms/",Lu="http://xmlns.com/foaf/0.1/",hi=Ne.namedNode("loaded-shapes"),kt=Ne.namedNode("loaded-data"),Ye=Ne.namedNode(qt+"type"),oa=Ne.namedNode(Du+"conformsTo"),$s=Ne.namedNode(_a+"subClassOf"),Ea=Ne.namedNode(Au+"imports"),Ou=Ne.namedNode(ka+"broader"),Cu=Ne.namedNode(ka+"narrower"),Mi=Ne.namedNode(_e+"NodeShape"),$u=Ne.namedNode(_e+"IRI"),Ki=Ne.namedNode(_e+"property"),Sa=Ne.namedNode(_e+"class"),wi=Ne.namedNode(_e+"targetClass"),Fu=Ne.namedNode(_e+"nodeKind"),Pu=Ne.namedNode(Ht+"string");function bi(r,e,t=_e,i){let n="";const o=Mu(r,e,t,i);return o&&(n=o.value),n}function Mu(r,e,t=_e,i){let n;const o=t+e;if(i?.length){for(const a of i)for(const s of r)if(s.predicate.value===o){if(s.object.id.endsWith(`@${a}`))return s.object;s.object.id.indexOf("@")<0?n=s.object:n||(n=s.object)}}else for(const a of r)if(a.predicate.value===o)return a.object;return n}function Bu(r){r.querySelector(".editor")?.focus()}function Si(r,e){return bi(r,"prefLabel",ka,e)||bi(r,"label",_a,e)||bi(r,"name",Lu,e)}function cc(r,e,t){const i=[];for(const n of r)i.push({value:n,label:Si(e.getQuads(n,null,null,null),t),children:[]});return i}function aa(r,e){for(const t in e)r=r.replace(e[t],"");return r}function uc(r,e,t,i,n=new Set){for(const o of e.owlImports)n.has(o.id)||(n.add(o.id),i.push(...t.getSubjects(Ye,r,o)));e.parent&&uc(r,e.parent,t,i,n)}function Ra(r,e){if(e.shaclIn){const t=e.config.lists[e.shaclIn];return cc(t?.length?t:[],e.config.store,e.config.languages)}else{const t=e.config.store.getSubjects(Ye,r,hi);t.push(...e.config.store.getSubjects(Ye,r,kt)),uc(r,e,e.config.store,t);const i=new Map,n=new Map;for(const a of t)i.set(a.id,{value:a,label:Si(e.config.store.getQuads(a,null,null,null),e.config.languages),children:[]});for(const a of t){for(const s of e.config.store.getObjects(a,Ou,null))i.has(s.id)&&n.set(a.id,s.id);for(const s of e.config.store.getObjects(a,Cu,null))i.has(s.id)&&n.set(s.id,a.id);for(const s of e.config.store.getObjects(a,$s,null))i.has(s.id)&&n.set(a.id,s.id)}for(const[a,s]of n.entries())i.get(s)?.children?.push(i.get(a));const o=[];for(const[a,s]of i.entries())n.has(a)||o.push(s);for(const a of e.config.store.getSubjects($s,r,null))o.push(...Ra(a,e));return o}}function sa(r){let e;try{e=new URL(r)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function Fs(r,e,t){if(e===void 0)return t;if(t===void 0)return e;const i=r.indexOf(e.language);if(i<0)return t;const n=r.indexOf(t.language);return n<0||n>i?e:t}function qu(r,{remove:e=!1,ignoreErrors:t=!1}={}){const i={},n=t?()=>!0:(s,d)=>{throw new Error(`${s.value} ${d}`)},o=r.getQuads(null,qt+"rest",qt+"nil",null),a=e?[...o]:[];return o.forEach(s=>{const d=[];let l=!1,c,u;const v=s.graph;let g=s.subject;for(;g&&!l;){const y=r.getQuads(null,null,g,null),k=r.getQuads(g,null,null,null).filter(f=>!f.predicate.equals(Ye));let x,_=null,E=null,m=null;for(let f=0;f<k.length&&!l;f++)x=k[f],x.graph.equals(v)?c?l=n(g,"has non-list arcs out"):x.predicate.value===qt+"first"?_?l=n(g,"has multiple rdf:first arcs"):a.push(_=x):x.predicate.value===qt+"rest"?E?l=n(g,"has multiple rdf:rest arcs"):a.push(E=x):y.length?l=n(g,"can't be subject and object"):(c=x,u="subject"):l=n(g,"not confined to single graph");for(let f=0;f<y.length&&!l;++f)x=y[f],c?l=n(g,"can't have coreferences"):x.predicate.value===qt+"rest"?m?l=n(g,"has incoming rdf:rest arcs"):m=x:(c=x,u="object");_?d.unshift(_.object):l=n(g,"has no list head"),g=m&&m.subject}l?e=!1:c&&(i[c[u].value]=d)}),e&&r.removeQuads(a),i}function fc(r,e,t){const i=document.createElement("div");i.classList.add("shacl-or-constraint");const n=[];if(e instanceof Gt){const o=[];let a=!1;r.length&&(a=t.store.countQuads(r[0],Ki,null,null)>0);for(let l=0;l<r.length;l++)if(a){const c=t.store.getObjects(r[l],Ki,null),u=[];let v="";for(const g of c){const y=new en(g,e,t);u.push(y),v+=(v.length>1?" / ":"")+y.template.label}o.push(u),n.push({label:v,value:l.toString()})}else{const c=new en(r[l],e,t);o.push([c]),n.push({label:c.template.label,value:l.toString()})}const s=t.theme.createListEditor("Please choose",null,!1,n),d=s.querySelector(".editor");d.onchange=()=>{if(d.value){const l=o[parseInt(d.value)];let c;l.length&&(c=l[0],i.replaceWith(l[0]));for(let u=1;u<l.length;u++)c.after(l[u]),c=l[u]}},i.appendChild(s)}else{const o=[];for(let d=0;d<r.length;d++){const l=t.store.getQuads(r[d],null,null,null);l.length&&(o.push(l),n.push({label:Si(l,t.languages)||aa(l[0].predicate.value,t.prefixes)+" = "+aa(l[0].object.value,t.prefixes),value:d.toString()}))}const a=t.theme.createListEditor(e.template.label+"?",null,!1,n,e.template),s=a.querySelector(".editor");s.onchange=()=>{s.value&&i.replaceWith(Wi(e.template.clone().merge(o[parseInt(s.value)]),void 0,!0))},i.appendChild(a)}return i}function zu(r,e,t){if(e instanceof dt){const i=e.datatype;for(const n of r){const o=t.store.getQuads(n,null,null,null);for(const a of o)if(a.predicate.value===`${_e}datatype`&&a.object.equals(i))return o}}else{const i=t.store.getObjects(e,Ye,null);for(const n of r){const o=t.store.getQuads(n,null,null,null);for(const a of o)if(i.length>0){if(a.predicate.value===`${_e}node`){for(const s of i)if(t.store.getQuads(a.object,wi,s,null).length>0)return o}if(a.predicate.equals(Sa)){for(const s of i)if(a.object.equals(s))return o}}else if(a.predicate.equals(Fu)&&a.object.equals($u))return o}}return console.error("couldn't resolve sh:or/sh:xone on property for value",e),[]}function Uu(r,e,t){for(const i of r){let n=!1;const o=t.store.getObjects(i,Ki,null);for(const a of o){const s=t.store.getObjects(a,`${_e}path`,null);for(const d of s)if(n=t.store.countQuads(e,d,null,null)>0,n)break}if(n)return o}return console.error("couldn't resolve sh:or/sh:xone on node for value",e),[]}const Hu={[`${_e}name`]:(r,e)=>{const t=e;r.name=Fs(r.config.languages,r.name,t)},[`${_e}description`]:(r,e)=>{const t=e;r.description=Fs(r.config.languages,r.description,t)},[`${_e}path`]:(r,e)=>{r.path=e.value},[`${_e}node`]:(r,e)=>{r.node=e},[`${_e}datatype`]:(r,e)=>{r.datatype=e},[`${_e}nodeKind`]:(r,e)=>{r.nodeKind=e},[`${_e}minCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${_e}maxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[`${_e}minLength`]:(r,e)=>{r.minLength=parseInt(e.value)},[`${_e}maxLength`]:(r,e)=>{r.maxLength=parseInt(e.value)},[`${_e}minInclusive`]:(r,e)=>{r.minInclusive=parseInt(e.value)},[`${_e}maxInclusive`]:(r,e)=>{r.maxInclusive=parseInt(e.value)},[`${_e}minExclusive`]:(r,e)=>{r.minExclusive=parseInt(e.value)},[`${_e}maxExclusive`]:(r,e)=>{r.maxExclusive=parseInt(e.value)},[`${_e}pattern`]:(r,e)=>{r.pattern=e.value},[`${_e}order`]:(r,e)=>{r.order=parseInt(e.value)},[`${Cs}singleLine`]:(r,e)=>{r.singleLine=e.value==="true"},[`${Cs}readonly`]:(r,e)=>{r.readonly=e.value==="true"},[`${ju}styleClass`]:(r,e)=>{r.cssClass=e.value},[`${_e}and`]:(r,e)=>{r.shaclAnd=e.value},[`${_e}in`]:(r,e)=>{r.shaclIn=e.value},[`${_e}languageIn`]:(r,e)=>{r.languageIn=r.config.lists[e.value],r.datatype=Ne.namedNode(qt+"langString")},[`${_e}defaultValue`]:(r,e)=>{r.defaultValue=e},[`${_e}hasValue`]:(r,e)=>{r.hasValue=e},[`${_e}qualifiedValueShape`]:(r,e)=>{r.qualifiedValueShape=e},[`${_e}qualifiedMinCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${_e}qualifiedMaxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[Ea.id]:(r,e)=>{r.owlImports.push(e)},[Sa.id]:(r,e)=>{r.class=e;const t=r.config.store.getSubjects(wi,e,null);t.length>0&&(r.node=t[0])},[`${_e}or`]:(r,e)=>{const t=r.config.lists[e.value];t?.length?r.shaclOr=t:console.error("list for sh:or not found:",e.value,"existing lists:",r.config.lists)},[`${_e}xone`]:(r,e)=>{const t=r.config.lists[e.value];t?.length?r.shaclXone=t:console.error("list for sh:xone not found:",e.value,"existing lists:",r.config.lists)}};class Gu{constructor(e,t,i){this.label="",this.owlImports=[],this.extendedShapes=[],this.parent=t,this.config=i,this.merge(e),this.qualifiedValueShape&&this.merge(i.store.getQuads(this.qualifiedValueShape,null,null,null))}merge(e){for(const t of e)Hu[t.predicate.id]?.call(this,this,t.object);if(this.label=this.name?.value||Si(e,this.config.languages),!this.label&&!this.shaclAnd&&(this.label=this.path?aa(this.path,this.config.prefixes):"unknown"),(this.node||this.shaclAnd)&&(this.node&&this.extendedShapes.push(this.node),this.shaclAnd)){const t=this.config.lists[this.shaclAnd];if(t?.length)for(const i of t)this.extendedShapes.push(i)}return this}clone(){const e=Object.assign({},this);return e.extendedShapes=[...this.extendedShapes],e.owlImports=[...this.owlImports],this.languageIn&&(e.languageIn=[...this.languageIn]),this.shaclOr&&(e.shaclOr=[...this.shaclOr]),this.shaclXone&&(e.shaclXone=[...this.shaclXone]),e.merge=this.merge.bind(e),e.clone=this.clone.bind(e),e}}const Vu=`form { display:block; --label-width: 8em; --caret-size: 10px; }
|
|
27
|
+
`;super(i),this.name="AggregateError",this.errors=t}}return xn={AggregateError:r,ArrayIsArray(e){return Array.isArray(e)},ArrayPrototypeIncludes(e,t){return e.includes(t)},ArrayPrototypeIndexOf(e,t){return e.indexOf(t)},ArrayPrototypeJoin(e,t){return e.join(t)},ArrayPrototypeMap(e,t){return e.map(t)},ArrayPrototypePop(e,t){return e.pop(t)},ArrayPrototypePush(e,t){return e.push(t)},ArrayPrototypeSlice(e,t,i){return e.slice(t,i)},Error,FunctionPrototypeCall(e,t,...i){return e.call(t,...i)},FunctionPrototypeSymbolHasInstance(e,t){return 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){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,i){return Object.defineProperty(e,t,i)},ObjectGetOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(e,t)},ObjectKeys(e){return Object.keys(e)},ObjectSetPrototypeOf(e,t){return Object.setPrototypeOf(e,t)},Promise,PromisePrototypeCatch(e,t){return e.catch(t)},PromisePrototypeThen(e,t,i){return e.then(t,i)},PromiseReject(e){return Promise.reject(e)},PromiseResolve(e){return Promise.resolve(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest(e,t){return e.test(t)},SafeSet:Set,String,StringPrototypeSlice(e,t,i){return e.slice(t,i)},StringPrototypeToLowerCase(e){return e.toLowerCase()},StringPrototypeToUpperCase(e){return e.toUpperCase()},StringPrototypeTrim(e){return 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,i){return e.set(t,i)},Boolean,Uint8Array},xn}var _n={exports:{}},kn,as;function ec(){return as||(as=1,kn={format(r,...e){return r.replace(/%([sdifj])/g,function(...[t,i]){const n=e.shift();return i==="f"?n.toFixed(6):i==="j"?JSON.stringify(n):i==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},inspect(r){switch(typeof r){case"string":if(r.includes("'"))if(r.includes('"')){if(!r.includes("`")&&!r.includes("${"))return`\`${r}\``}else return`"${r}"`;return`'${r}'`;case"number":return isNaN(r)?"NaN":Object.is(r,-0)?String(r):r;case"bigint":return`${String(r)}n`;case"boolean":case"undefined":return String(r);case"object":return"{}"}}}),kn}var En,ss;function it(){if(ss)return En;ss=1;const{format:r,inspect:e}=ec(),{AggregateError:t}=Be(),i=globalThis.AggregateError||t,n=Symbol("kIsNodeError"),o=["string","function","number","object","Function","Object","boolean","bigint","symbol"],a=/^([A-Z][a-z0-9]*)+$/,s="__node_internal_",d={};function l(x,_){if(!x)throw new d.ERR_INTERNAL_ASSERTION(_)}function c(x){let _="",E=x.length;const m=x[0]==="-"?1:0;for(;E>=m+4;E-=3)_=`_${x.slice(E-3,E)}${_}`;return`${x.slice(0,E)}${_}`}function u(x,_,E){if(typeof _=="function")return l(_.length<=E.length,`Code: ${x}; The provided arguments length (${E.length}) does not match the required ones (${_.length}).`),_(...E);const m=(_.match(/%[dfijoOs]/g)||[]).length;return l(m===E.length,`Code: ${x}; The provided arguments length (${E.length}) does not match the required ones (${m}).`),E.length===0?_:r(_,...E)}function v(x,_,E){E||(E=Error);class m extends E{constructor(...b){super(u(x,_,b))}toString(){return`${this.name} [${x}]: ${this.message}`}}Object.defineProperties(m.prototype,{name:{value:E.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${x}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),m.prototype.code=x,m.prototype[n]=!0,d[x]=m}function g(x){const _=s+x.name;return Object.defineProperty(x,"name",{value:_}),x}function y(x,_){if(x&&_&&x!==_){if(Array.isArray(_.errors))return _.errors.push(x),_;const E=new i([_,x],_.message);return E.code=_.code,E}return x||_}class k extends Error{constructor(_="The operation was aborted",E=void 0){if(E!==void 0&&typeof E!="object")throw new d.ERR_INVALID_ARG_TYPE("options","Object",E);super(_,E),this.code="ABORT_ERR",this.name="AbortError"}}return v("ERR_ASSERTION","%s",Error),v("ERR_INVALID_ARG_TYPE",(x,_,E)=>{l(typeof x=="string","'name' must be a string"),Array.isArray(_)||(_=[_]);let m="The ";x.endsWith(" argument")?m+=`${x} `:m+=`"${x}" ${x.includes(".")?"property":"argument"} `,m+="must be ";const f=[],b=[],R=[];for(const T of _)l(typeof T=="string","All expected entries have to be of type string"),o.includes(T)?f.push(T.toLowerCase()):a.test(T)?b.push(T):(l(T!=="object",'The value "object" should be written as "Object"'),R.push(T));if(b.length>0){const T=f.indexOf("object");T!==-1&&(f.splice(f,T,1),b.push("Object"))}if(f.length>0){switch(f.length){case 1:m+=`of type ${f[0]}`;break;case 2:m+=`one of type ${f[0]} or ${f[1]}`;break;default:{const T=f.pop();m+=`one of type ${f.join(", ")}, or ${T}`}}(b.length>0||R.length>0)&&(m+=" or ")}if(b.length>0){switch(b.length){case 1:m+=`an instance of ${b[0]}`;break;case 2:m+=`an instance of ${b[0]} or ${b[1]}`;break;default:{const T=b.pop();m+=`an instance of ${b.join(", ")}, or ${T}`}}R.length>0&&(m+=" or ")}switch(R.length){case 0:break;case 1:R[0].toLowerCase()!==R[0]&&(m+="an "),m+=`${R[0]}`;break;case 2:m+=`one of ${R[0]} or ${R[1]}`;break;default:{const T=R.pop();m+=`one of ${R.join(", ")}, or ${T}`}}if(E==null)m+=`. Received ${E}`;else if(typeof E=="function"&&E.name)m+=`. Received function ${E.name}`;else if(typeof E=="object"){var L;if((L=E.constructor)!==null&&L!==void 0&&L.name)m+=`. Received an instance of ${E.constructor.name}`;else{const T=e(E,{depth:-1});m+=`. Received ${T}`}}else{let T=e(E,{colors:!1});T.length>25&&(T=`${T.slice(0,25)}...`),m+=`. Received type ${typeof E} (${T})`}return m},TypeError),v("ERR_INVALID_ARG_VALUE",(x,_,E="is invalid")=>{let m=e(_);return m.length>128&&(m=m.slice(0,128)+"..."),`The ${x.includes(".")?"property":"argument"} '${x}' ${E}. Received ${m}`},TypeError),v("ERR_INVALID_RETURN_VALUE",(x,_,E)=>{var m;const f=E!=null&&(m=E.constructor)!==null&&m!==void 0&&m.name?`instance of ${E.constructor.name}`:`type ${typeof E}`;return`Expected ${x} to be returned from the "${_}" function but got ${f}.`},TypeError),v("ERR_MISSING_ARGS",(...x)=>{l(x.length>0,"At least one arg needs to be specified");let _;const E=x.length;switch(x=(Array.isArray(x)?x:[x]).map(m=>`"${m}"`).join(" or "),E){case 1:_+=`The ${x[0]} argument`;break;case 2:_+=`The ${x[0]} and ${x[1]} arguments`;break;default:{const m=x.pop();_+=`The ${x.join(", ")}, and ${m} arguments`}break}return`${_} must be specified`},TypeError),v("ERR_OUT_OF_RANGE",(x,_,E)=>{l(_,'Missing "range" argument');let m;if(Number.isInteger(E)&&Math.abs(E)>2**32)m=c(String(E));else if(typeof E=="bigint"){m=String(E);const f=BigInt(2)**BigInt(32);(E>f||E<-f)&&(m=c(m)),m+="n"}else m=e(E);return`The value of "${x}" is out of range. It must be ${_}. Received ${m}`},RangeError),v("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),v("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),v("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),v("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),v("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),v("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),v("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),v("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),v("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),v("ERR_STREAM_WRITE_AFTER_END","write after end",Error),v("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),En={AbortError:k,aggregateTwoErrors:g(y),hideStackFrames:g,codes:d},En}var Vr={exports:{}},ls;function yi(){if(ls)return Vr.exports;ls=1;const{AbortController:r,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return Vr.exports=r,Vr.exports.AbortSignal=e,Vr.exports.default=r,Vr.exports}var Ci={exports:{}},ds;function an(){if(ds)return Ci.exports;ds=1;var r=typeof Reflect=="object"?Reflect:null,e=r&&typeof r.apply=="function"?r.apply:function(b,R,L){return Function.prototype.apply.call(b,R,L)},t;r&&typeof r.ownKeys=="function"?t=r.ownKeys:Object.getOwnPropertySymbols?t=function(b){return Object.getOwnPropertyNames(b).concat(Object.getOwnPropertySymbols(b))}:t=function(b){return Object.getOwnPropertyNames(b)};function i(f){console&&console.warn&&console.warn(f)}var n=Number.isNaN||function(b){return b!==b};function o(){o.init.call(this)}Ci.exports=o,Ci.exports.once=_,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(f){if(typeof f!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof f)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(f){if(typeof f!="number"||f<0||n(f))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+f+".");a=f}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(b){if(typeof b!="number"||b<0||n(b))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+b+".");return this._maxListeners=b,this};function d(f){return f._maxListeners===void 0?o.defaultMaxListeners:f._maxListeners}o.prototype.getMaxListeners=function(){return d(this)},o.prototype.emit=function(b){for(var R=[],L=1;L<arguments.length;L++)R.push(arguments[L]);var T=b==="error",B=this._events;if(B!==void 0)T=T&&B.error===void 0;else if(!T)return!1;if(T){var I;if(R.length>0&&(I=R[0]),I instanceof Error)throw I;var $=new Error("Unhandled error."+(I?" ("+I.message+")":""));throw $.context=I,$}var q=B[b];if(q===void 0)return!1;if(typeof q=="function")e(q,this,R);else for(var A=q.length,j=y(q,A),L=0;L<A;++L)e(j[L],this,R);return!0};function l(f,b,R,L){var T,B,I;if(s(R),B=f._events,B===void 0?(B=f._events=Object.create(null),f._eventsCount=0):(B.newListener!==void 0&&(f.emit("newListener",b,R.listener?R.listener:R),B=f._events),I=B[b]),I===void 0)I=B[b]=R,++f._eventsCount;else if(typeof I=="function"?I=B[b]=L?[R,I]:[I,R]:L?I.unshift(R):I.push(R),T=d(f),T>0&&I.length>T&&!I.warned){I.warned=!0;var $=new Error("Possible EventEmitter memory leak detected. "+I.length+" "+String(b)+" listeners added. Use emitter.setMaxListeners() to increase limit");$.name="MaxListenersExceededWarning",$.emitter=f,$.type=b,$.count=I.length,i($)}return f}o.prototype.addListener=function(b,R){return l(this,b,R,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(b,R){return l(this,b,R,!0)};function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(f,b,R){var L={fired:!1,wrapFn:void 0,target:f,type:b,listener:R},T=c.bind(L);return T.listener=R,L.wrapFn=T,T}o.prototype.once=function(b,R){return s(R),this.on(b,u(this,b,R)),this},o.prototype.prependOnceListener=function(b,R){return s(R),this.prependListener(b,u(this,b,R)),this},o.prototype.removeListener=function(b,R){var L,T,B,I,$;if(s(R),T=this._events,T===void 0)return this;if(L=T[b],L===void 0)return this;if(L===R||L.listener===R)--this._eventsCount===0?this._events=Object.create(null):(delete T[b],T.removeListener&&this.emit("removeListener",b,L.listener||R));else if(typeof L!="function"){for(B=-1,I=L.length-1;I>=0;I--)if(L[I]===R||L[I].listener===R){$=L[I].listener,B=I;break}if(B<0)return this;B===0?L.shift():k(L,B),L.length===1&&(T[b]=L[0]),T.removeListener!==void 0&&this.emit("removeListener",b,$||R)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(b){var R,L,T;if(L=this._events,L===void 0)return this;if(L.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):L[b]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete L[b]),this;if(arguments.length===0){var B=Object.keys(L),I;for(T=0;T<B.length;++T)I=B[T],I!=="removeListener"&&this.removeAllListeners(I);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(R=L[b],typeof R=="function")this.removeListener(b,R);else if(R!==void 0)for(T=R.length-1;T>=0;T--)this.removeListener(b,R[T]);return this};function v(f,b,R){var L=f._events;if(L===void 0)return[];var T=L[b];return T===void 0?[]:typeof T=="function"?R?[T.listener||T]:[T]:R?x(T):y(T,T.length)}o.prototype.listeners=function(b){return v(this,b,!0)},o.prototype.rawListeners=function(b){return v(this,b,!1)},o.listenerCount=function(f,b){return typeof f.listenerCount=="function"?f.listenerCount(b):g.call(f,b)},o.prototype.listenerCount=g;function g(f){var b=this._events;if(b!==void 0){var R=b[f];if(typeof R=="function")return 1;if(R!==void 0)return R.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function y(f,b){for(var R=new Array(b),L=0;L<b;++L)R[L]=f[L];return R}function k(f,b){for(;b+1<f.length;b++)f[b]=f[b+1];f.pop()}function x(f){for(var b=new Array(f.length),R=0;R<b.length;++R)b[R]=f[R].listener||f[R];return b}function _(f,b){return new Promise(function(R,L){function T(I){f.removeListener(b,B),L(I)}function B(){typeof f.removeListener=="function"&&f.removeListener("error",T),R([].slice.call(arguments))}m(f,b,B,{once:!0}),b!=="error"&&E(f,T,{once:!0})})}function E(f,b,R){typeof f.on=="function"&&m(f,"error",b,R)}function m(f,b,R,L){if(typeof f.on=="function")L.once?f.once(b,R):f.on(b,R);else if(typeof f.addEventListener=="function")f.addEventListener(b,function T(B){L.once&&f.removeEventListener(b,T),R(B)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof f)}return Ci.exports}var cs;function at(){return cs||(cs=1,function(r){const e=Dt(),{format:t,inspect:i}=ec(),{codes:{ERR_INVALID_ARG_TYPE:n}}=it(),{kResistStopPropagation:o,AggregateError:a,SymbolDispose:s}=Be(),d=globalThis.AbortSignal||yi().AbortSignal,l=globalThis.AbortController||yi().AbortController,c=Object.getPrototypeOf(async function(){}).constructor,u=globalThis.Blob||e.Blob,v=typeof u<"u"?function(x){return x instanceof u}:function(x){return!1},g=(k,x)=>{if(k!==void 0&&(k===null||typeof k!="object"||!("aborted"in k)))throw new n(x,"AbortSignal",k)},y=(k,x)=>{if(typeof k!="function")throw new n(x,"Function",k)};r.exports={AggregateError:a,kEmptyObject:Object.freeze({}),once(k){let x=!1;return function(..._){x||(x=!0,k.apply(this,_))}},createDeferredPromise:function(){let k,x;return{promise:new Promise((E,m)=>{k=E,x=m}),resolve:k,reject:x}},promisify(k){return new Promise((x,_)=>{k((E,...m)=>E?_(E):x(...m))})},debuglog(){return function(){}},format:t,inspect:i,types:{isAsyncFunction(k){return k instanceof c},isArrayBufferView(k){return ArrayBuffer.isView(k)}},isBlob:v,deprecate(k,x){return k},addAbortListener:an().addAbortListener||function(x,_){if(x===void 0)throw new n("signal","AbortSignal",x);g(x,"signal"),y(_,"listener");let E;return x.aborted?queueMicrotask(()=>_()):(x.addEventListener("abort",_,{__proto__:null,once:!0,[o]:!0}),E=()=>{x.removeEventListener("abort",_)}),{__proto__:null,[s](){var m;(m=E)===null||m===void 0||m()}}},AbortSignalAny:d.any||function(x){if(x.length===1)return x[0];const _=new l,E=()=>_.abort();return x.forEach(m=>{g(m,"signals"),m.addEventListener("abort",E,{once:!0})}),_.signal.addEventListener("abort",()=>{x.forEach(m=>m.removeEventListener("abort",E))},{once:!0}),_.signal}},r.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}(_n)),_n.exports}var $i={},Sn,us;function Ei(){if(us)return Sn;us=1;const{ArrayIsArray:r,ArrayPrototypeIncludes:e,ArrayPrototypeJoin:t,ArrayPrototypeMap:i,NumberIsInteger:n,NumberIsNaN:o,NumberMAX_SAFE_INTEGER:a,NumberMIN_SAFE_INTEGER:s,NumberParseInt:d,ObjectPrototypeHasOwnProperty:l,RegExpPrototypeExec:c,String:u,StringPrototypeToUpperCase:v,StringPrototypeTrim:g}=Be(),{hideStackFrames:y,codes:{ERR_SOCKET_BAD_PORT:k,ERR_INVALID_ARG_TYPE:x,ERR_INVALID_ARG_VALUE:_,ERR_OUT_OF_RANGE:E,ERR_UNKNOWN_SIGNAL:m}}=it(),{normalizeEncoding:f}=at(),{isAsyncFunction:b,isArrayBufferView:R}=at().types,L={};function T(J){return J===(J|0)}function B(J){return J===J>>>0}const I=/^[0-7]+$/,$="must be a 32-bit unsigned integer or an octal string";function q(J,ce,ge){if(typeof J>"u"&&(J=ge),typeof J=="string"){if(c(I,J)===null)throw new _(ce,J,$);J=d(J,8)}return te(J,ce),J}const A=y((J,ce,ge=s,le=a)=>{if(typeof J!="number")throw new x(ce,"number",J);if(!n(J))throw new E(ce,"an integer",J);if(J<ge||J>le)throw new E(ce,`>= ${ge} && <= ${le}`,J)}),j=y((J,ce,ge=-2147483648,le=2147483647)=>{if(typeof J!="number")throw new x(ce,"number",J);if(!n(J))throw new E(ce,"an integer",J);if(J<ge||J>le)throw new E(ce,`>= ${ge} && <= ${le}`,J)}),te=y((J,ce,ge=!1)=>{if(typeof J!="number")throw new x(ce,"number",J);if(!n(J))throw new E(ce,"an integer",J);const le=ge?1:0,Re=4294967295;if(J<le||J>Re)throw new E(ce,`>= ${le} && <= ${Re}`,J)});function N(J,ce){if(typeof J!="string")throw new x(ce,"string",J)}function Z(J,ce,ge=void 0,le){if(typeof J!="number")throw new x(ce,"number",J);if(ge!=null&&J<ge||le!=null&&J>le||(ge!=null||le!=null)&&o(J))throw new E(ce,`${ge!=null?`>= ${ge}`:""}${ge!=null&&le!=null?" && ":""}${le!=null?`<= ${le}`:""}`,J)}const F=y((J,ce,ge)=>{if(!e(ge,J)){const Re="must be one of: "+t(i(ge,We=>typeof We=="string"?`'${We}'`:u(We)),", ");throw new _(ce,J,Re)}});function Y(J,ce){if(typeof J!="boolean")throw new x(ce,"boolean",J)}function w(J,ce,ge){return J==null||!l(J,ce)?ge:J[ce]}const U=y((J,ce,ge=null)=>{const le=w(ge,"allowArray",!1),Re=w(ge,"allowFunction",!1);if(!w(ge,"nullable",!1)&&J===null||!le&&r(J)||typeof J!="object"&&(!Re||typeof J!="function"))throw new x(ce,"Object",J)}),K=y((J,ce)=>{if(J!=null&&typeof J!="object"&&typeof J!="function")throw new x(ce,"a dictionary",J)}),X=y((J,ce,ge=0)=>{if(!r(J))throw new x(ce,"Array",J);if(J.length<ge){const le=`must be longer than ${ge}`;throw new _(ce,J,le)}});function de(J,ce){X(J,ce);for(let ge=0;ge<J.length;ge++)N(J[ge],`${ce}[${ge}]`)}function H(J,ce){X(J,ce);for(let ge=0;ge<J.length;ge++)Y(J[ge],`${ce}[${ge}]`)}function G(J,ce){X(J,ce);for(let ge=0;ge<J.length;ge++){const le=J[ge],Re=`${ce}[${ge}]`;if(le==null)throw new x(Re,"AbortSignal",le);pe(le,Re)}}function W(J,ce="signal"){if(N(J,ce),L[J]===void 0)throw L[v(J)]!==void 0?new m(J+" (signals must use all capital letters)"):new m(J)}const z=y((J,ce="buffer")=>{if(!R(J))throw new x(ce,["Buffer","TypedArray","DataView"],J)});function ee(J,ce){const ge=f(ce),le=J.length;if(ge==="hex"&&le%2!==0)throw new _("encoding",ce,`is invalid for data of length ${le}`)}function re(J,ce="Port",ge=!0){if(typeof J!="number"&&typeof J!="string"||typeof J=="string"&&g(J).length===0||+J!==+J>>>0||J>65535||J===0&&!ge)throw new k(ce,J,ge);return J|0}const pe=y((J,ce)=>{if(J!==void 0&&(J===null||typeof J!="object"||!("aborted"in J)))throw new x(ce,"AbortSignal",J)}),be=y((J,ce)=>{if(typeof J!="function")throw new x(ce,"Function",J)}),O=y((J,ce)=>{if(typeof J!="function"||b(J))throw new x(ce,"Function",J)}),V=y((J,ce)=>{if(J!==void 0)throw new x(ce,"undefined",J)});function oe(J,ce,ge){if(!e(ge,J))throw new x(ce,`('${t(ge,"|")}')`,J)}const fe=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function he(J,ce){if(typeof J>"u"||!c(fe,J))throw new _(ce,J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function me(J){if(typeof J=="string")return he(J,"hints"),J;if(r(J)){const ce=J.length;let ge="";if(ce===0)return ge;for(let le=0;le<ce;le++){const Re=J[le];he(Re,"hints"),ge+=Re,le!==ce-1&&(ge+=", ")}return ge}throw new _("hints",J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return Sn={isInt32:T,isUint32:B,parseFileMode:q,validateArray:X,validateStringArray:de,validateBooleanArray:H,validateAbortSignalArray:G,validateBoolean:Y,validateBuffer:z,validateDictionary:K,validateEncoding:ee,validateFunction:be,validateInt32:j,validateInteger:A,validateNumber:Z,validateObject:U,validateOneOf:F,validatePlainFunction:O,validatePort:re,validateSignalName:W,validateString:N,validateUint32:te,validateUndefined:V,validateUnion:oe,validateAbortSignal:pe,validateLinkHeaderValue:me},Sn}var Fi={exports:{}},Rn={exports:{}},fs;function ur(){if(fs)return Rn.exports;fs=1;var r=Rn.exports={},e,t;function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=i}catch{e=i}try{typeof clearTimeout=="function"?t=clearTimeout:t=n}catch{t=n}})();function o(k){if(e===setTimeout)return setTimeout(k,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(k,0);try{return e(k,0)}catch{try{return e.call(null,k,0)}catch{return e.call(this,k,0)}}}function a(k){if(t===clearTimeout)return clearTimeout(k);if((t===n||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(k);try{return t(k)}catch{try{return t.call(null,k)}catch{return t.call(this,k)}}}var s=[],d=!1,l,c=-1;function u(){!d||!l||(d=!1,l.length?s=l.concat(s):c=-1,s.length&&v())}function v(){if(!d){var k=o(u);d=!0;for(var x=s.length;x;){for(l=s,s=[];++c<x;)l&&l[c].run();c=-1,x=s.length}l=null,d=!1,a(k)}}r.nextTick=function(k){var x=new Array(arguments.length-1);if(arguments.length>1)for(var _=1;_<arguments.length;_++)x[_-1]=arguments[_];s.push(new g(k,x)),s.length===1&&!d&&o(v)};function g(k,x){this.fun=k,this.array=x}g.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={};function y(){}return r.on=y,r.addListener=y,r.once=y,r.off=y,r.removeListener=y,r.removeAllListeners=y,r.emit=y,r.prependListener=y,r.prependOnceListener=y,r.listeners=function(k){return[]},r.binding=function(k){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(k){throw new Error("process.chdir is not supported")},r.umask=function(){return 0},Rn.exports}var In,ps;function Lt(){if(ps)return In;ps=1;const{SymbolAsyncIterator:r,SymbolIterator:e,SymbolFor:t}=Be(),i=t("nodejs.stream.destroyed"),n=t("nodejs.stream.errored"),o=t("nodejs.stream.readable"),a=t("nodejs.stream.writable"),s=t("nodejs.stream.disturbed"),d=t("nodejs.webstream.isClosedPromise"),l=t("nodejs.webstream.controllerErrorFunction");function c(w,U=!1){var K;return!!(w&&typeof w.pipe=="function"&&typeof w.on=="function"&&(!U||typeof w.pause=="function"&&typeof w.resume=="function")&&(!w._writableState||((K=w._readableState)===null||K===void 0?void 0:K.readable)!==!1)&&(!w._writableState||w._readableState))}function u(w){var U;return!!(w&&typeof w.write=="function"&&typeof w.on=="function"&&(!w._readableState||((U=w._writableState)===null||U===void 0?void 0:U.writable)!==!1))}function v(w){return!!(w&&typeof w.pipe=="function"&&w._readableState&&typeof w.on=="function"&&typeof w.write=="function")}function g(w){return w&&(w._readableState||w._writableState||typeof w.write=="function"&&typeof w.on=="function"||typeof w.pipe=="function"&&typeof w.on=="function")}function y(w){return!!(w&&!g(w)&&typeof w.pipeThrough=="function"&&typeof w.getReader=="function"&&typeof w.cancel=="function")}function k(w){return!!(w&&!g(w)&&typeof w.getWriter=="function"&&typeof w.abort=="function")}function x(w){return!!(w&&!g(w)&&typeof w.readable=="object"&&typeof w.writable=="object")}function _(w){return y(w)||k(w)||x(w)}function E(w,U){return w==null?!1:U===!0?typeof w[r]=="function":U===!1?typeof w[e]=="function":typeof w[r]=="function"||typeof w[e]=="function"}function m(w){if(!g(w))return null;const U=w._writableState,K=w._readableState,X=U||K;return!!(w.destroyed||w[i]||X!=null&&X.destroyed)}function f(w){if(!u(w))return null;if(w.writableEnded===!0)return!0;const U=w._writableState;return U!=null&&U.errored?!1:typeof U?.ended!="boolean"?null:U.ended}function b(w,U){if(!u(w))return null;if(w.writableFinished===!0)return!0;const K=w._writableState;return K!=null&&K.errored?!1:typeof K?.finished!="boolean"?null:!!(K.finished||U===!1&&K.ended===!0&&K.length===0)}function R(w){if(!c(w))return null;if(w.readableEnded===!0)return!0;const U=w._readableState;return!U||U.errored?!1:typeof U?.ended!="boolean"?null:U.ended}function L(w,U){if(!c(w))return null;const K=w._readableState;return K!=null&&K.errored?!1:typeof K?.endEmitted!="boolean"?null:!!(K.endEmitted||U===!1&&K.ended===!0&&K.length===0)}function T(w){return w&&w[o]!=null?w[o]:typeof w?.readable!="boolean"?null:m(w)?!1:c(w)&&w.readable&&!L(w)}function B(w){return w&&w[a]!=null?w[a]:typeof w?.writable!="boolean"?null:m(w)?!1:u(w)&&w.writable&&!f(w)}function I(w,U){return g(w)?m(w)?!0:!(U?.readable!==!1&&T(w)||U?.writable!==!1&&B(w)):null}function $(w){var U,K;return g(w)?w.writableErrored?w.writableErrored:(U=(K=w._writableState)===null||K===void 0?void 0:K.errored)!==null&&U!==void 0?U:null:null}function q(w){var U,K;return g(w)?w.readableErrored?w.readableErrored:(U=(K=w._readableState)===null||K===void 0?void 0:K.errored)!==null&&U!==void 0?U:null:null}function A(w){if(!g(w))return null;if(typeof w.closed=="boolean")return w.closed;const U=w._writableState,K=w._readableState;return typeof U?.closed=="boolean"||typeof K?.closed=="boolean"?U?.closed||K?.closed:typeof w._closed=="boolean"&&j(w)?w._closed:null}function j(w){return typeof w._closed=="boolean"&&typeof w._defaultKeepAlive=="boolean"&&typeof w._removedConnection=="boolean"&&typeof w._removedContLen=="boolean"}function te(w){return typeof w._sent100=="boolean"&&j(w)}function N(w){var U;return typeof w._consuming=="boolean"&&typeof w._dumped=="boolean"&&((U=w.req)===null||U===void 0?void 0:U.upgradeOrConnect)===void 0}function Z(w){if(!g(w))return null;const U=w._writableState,K=w._readableState,X=U||K;return!X&&te(w)||!!(X&&X.autoDestroy&&X.emitClose&&X.closed===!1)}function F(w){var U;return!!(w&&((U=w[s])!==null&&U!==void 0?U:w.readableDidRead||w.readableAborted))}function Y(w){var U,K,X,de,H,G,W,z,ee,re;return!!(w&&((U=(K=(X=(de=(H=(G=w[n])!==null&&G!==void 0?G:w.readableErrored)!==null&&H!==void 0?H:w.writableErrored)!==null&&de!==void 0?de:(W=w._readableState)===null||W===void 0?void 0:W.errorEmitted)!==null&&X!==void 0?X:(z=w._writableState)===null||z===void 0?void 0:z.errorEmitted)!==null&&K!==void 0?K:(ee=w._readableState)===null||ee===void 0?void 0:ee.errored)!==null&&U!==void 0?U:!((re=w._writableState)===null||re===void 0)&&re.errored))}return In={isDestroyed:m,kIsDestroyed:i,isDisturbed:F,kIsDisturbed:s,isErrored:Y,kIsErrored:n,isReadable:T,kIsReadable:o,kIsClosedPromise:d,kControllerErrorFunction:l,kIsWritable:a,isClosed:A,isDuplexNodeStream:v,isFinished:I,isIterable:E,isReadableNodeStream:c,isReadableStream:y,isReadableEnded:R,isReadableFinished:L,isReadableErrored:q,isNodeStream:g,isWebStream:_,isWritable:B,isWritableNodeStream:u,isWritableStream:k,isWritableEnded:f,isWritableFinished:b,isWritableErrored:$,isServerRequest:N,isServerResponse:te,willEmitClose:Z,isTransformStream:x},In}var hs;function Vt(){if(hs)return Fi.exports;hs=1;const r=ur(),{AbortError:e,codes:t}=it(),{ERR_INVALID_ARG_TYPE:i,ERR_STREAM_PREMATURE_CLOSE:n}=t,{kEmptyObject:o,once:a}=at(),{validateAbortSignal:s,validateFunction:d,validateObject:l,validateBoolean:c}=Ei(),{Promise:u,PromisePrototypeThen:v,SymbolDispose:g}=Be(),{isClosed:y,isReadable:k,isReadableNodeStream:x,isReadableStream:_,isReadableFinished:E,isReadableErrored:m,isWritable:f,isWritableNodeStream:b,isWritableStream:R,isWritableFinished:L,isWritableErrored:T,isNodeStream:B,willEmitClose:I,kIsClosedPromise:$}=Lt();let q;function A(F){return F.setHeader&&typeof F.abort=="function"}const j=()=>{};function te(F,Y,w){var U,K;if(arguments.length===2?(w=Y,Y=o):Y==null?Y=o:l(Y,"options"),d(w,"callback"),s(Y.signal,"options.signal"),w=a(w),_(F)||R(F))return N(F,Y,w);if(!B(F))throw new i("stream",["ReadableStream","WritableStream","Stream"],F);const X=(U=Y.readable)!==null&&U!==void 0?U:x(F),de=(K=Y.writable)!==null&&K!==void 0?K:b(F),H=F._writableState,G=F._readableState,W=()=>{F.writable||re()};let z=I(F)&&x(F)===X&&b(F)===de,ee=L(F,!1);const re=()=>{ee=!0,F.destroyed&&(z=!1),!(z&&(!F.readable||X))&&(!X||pe)&&w.call(F)};let pe=E(F,!1);const be=()=>{pe=!0,F.destroyed&&(z=!1),!(z&&(!F.writable||de))&&(!de||ee)&&w.call(F)},O=J=>{w.call(F,J)};let V=y(F);const oe=()=>{V=!0;const J=T(F)||m(F);if(J&&typeof J!="boolean")return w.call(F,J);if(X&&!pe&&x(F,!0)&&!E(F,!1))return w.call(F,new n);if(de&&!ee&&!L(F,!1))return w.call(F,new n);w.call(F)},fe=()=>{V=!0;const J=T(F)||m(F);if(J&&typeof J!="boolean")return w.call(F,J);w.call(F)},he=()=>{F.req.on("finish",re)};A(F)?(F.on("complete",re),z||F.on("abort",oe),F.req?he():F.on("request",he)):de&&!H&&(F.on("end",W),F.on("close",W)),!z&&typeof F.aborted=="boolean"&&F.on("aborted",oe),F.on("end",be),F.on("finish",re),Y.error!==!1&&F.on("error",O),F.on("close",oe),V?r.nextTick(oe):H!=null&&H.errorEmitted||G!=null&&G.errorEmitted?z||r.nextTick(fe):(!X&&(!z||k(F))&&(ee||f(F)===!1)||!de&&(!z||f(F))&&(pe||k(F)===!1)||G&&F.req&&F.aborted)&&r.nextTick(fe);const me=()=>{w=j,F.removeListener("aborted",oe),F.removeListener("complete",re),F.removeListener("abort",oe),F.removeListener("request",he),F.req&&F.req.removeListener("finish",re),F.removeListener("end",W),F.removeListener("close",W),F.removeListener("finish",re),F.removeListener("end",be),F.removeListener("error",O),F.removeListener("close",oe)};if(Y.signal&&!V){const J=()=>{const ce=w;me(),ce.call(F,new e(void 0,{cause:Y.signal.reason}))};if(Y.signal.aborted)r.nextTick(J);else{q=q||at().addAbortListener;const ce=q(Y.signal,J),ge=w;w=a((...le)=>{ce[g](),ge.apply(F,le)})}}return me}function N(F,Y,w){let U=!1,K=j;if(Y.signal)if(K=()=>{U=!0,w.call(F,new e(void 0,{cause:Y.signal.reason}))},Y.signal.aborted)r.nextTick(K);else{q=q||at().addAbortListener;const de=q(Y.signal,K),H=w;w=a((...G)=>{de[g](),H.apply(F,G)})}const X=(...de)=>{U||r.nextTick(()=>w.apply(F,de))};return v(F[$].promise,X,X),j}function Z(F,Y){var w;let U=!1;return Y===null&&(Y=o),(w=Y)!==null&&w!==void 0&&w.cleanup&&(c(Y.cleanup,"cleanup"),U=Y.cleanup),new u((K,X)=>{const de=te(F,Y,H=>{U&&de(),H?X(H):K()})})}return Fi.exports=te,Fi.exports.finished=Z,Fi.exports}var Nn,bs;function Lr(){if(bs)return Nn;bs=1;const r=ur(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:i}=it(),{Symbol:n}=Be(),{kIsDestroyed:o,isDestroyed:a,isFinished:s,isServerRequest:d}=Lt(),l=n("kDestroy"),c=n("kConstruct");function u(I,$,q){I&&(I.stack,$&&!$.errored&&($.errored=I),q&&!q.errored&&(q.errored=I))}function v(I,$){const q=this._readableState,A=this._writableState,j=A||q;return A!=null&&A.destroyed||q!=null&&q.destroyed?(typeof $=="function"&&$(),this):(u(I,A,q),A&&(A.destroyed=!0),q&&(q.destroyed=!0),j.constructed?g(this,I,$):this.once(l,function(te){g(this,e(te,I),$)}),this)}function g(I,$,q){let A=!1;function j(te){if(A)return;A=!0;const N=I._readableState,Z=I._writableState;u(te,Z,N),Z&&(Z.closed=!0),N&&(N.closed=!0),typeof q=="function"&&q(te),te?r.nextTick(y,I,te):r.nextTick(k,I)}try{I._destroy($||null,j)}catch(te){j(te)}}function y(I,$){x(I,$),k(I)}function k(I){const $=I._readableState,q=I._writableState;q&&(q.closeEmitted=!0),$&&($.closeEmitted=!0),(q!=null&&q.emitClose||$!=null&&$.emitClose)&&I.emit("close")}function x(I,$){const q=I._readableState,A=I._writableState;A!=null&&A.errorEmitted||q!=null&&q.errorEmitted||(A&&(A.errorEmitted=!0),q&&(q.errorEmitted=!0),I.emit("error",$))}function _(){const I=this._readableState,$=this._writableState;I&&(I.constructed=!0,I.closed=!1,I.closeEmitted=!1,I.destroyed=!1,I.errored=null,I.errorEmitted=!1,I.reading=!1,I.ended=I.readable===!1,I.endEmitted=I.readable===!1),$&&($.constructed=!0,$.destroyed=!1,$.closed=!1,$.closeEmitted=!1,$.errored=null,$.errorEmitted=!1,$.finalCalled=!1,$.prefinished=!1,$.ended=$.writable===!1,$.ending=$.writable===!1,$.finished=$.writable===!1)}function E(I,$,q){const A=I._readableState,j=I._writableState;if(j!=null&&j.destroyed||A!=null&&A.destroyed)return this;A!=null&&A.autoDestroy||j!=null&&j.autoDestroy?I.destroy($):$&&($.stack,j&&!j.errored&&(j.errored=$),A&&!A.errored&&(A.errored=$),q?r.nextTick(x,I,$):x(I,$))}function m(I,$){if(typeof I._construct!="function")return;const q=I._readableState,A=I._writableState;q&&(q.constructed=!1),A&&(A.constructed=!1),I.once(c,$),!(I.listenerCount(c)>1)&&r.nextTick(f,I)}function f(I){let $=!1;function q(A){if($){E(I,A??new t);return}$=!0;const j=I._readableState,te=I._writableState,N=te||j;j&&(j.constructed=!0),te&&(te.constructed=!0),N.destroyed?I.emit(l,A):A?E(I,A,!0):r.nextTick(b,I)}try{I._construct(A=>{r.nextTick(q,A)})}catch(A){r.nextTick(q,A)}}function b(I){I.emit(c)}function R(I){return I?.setHeader&&typeof I.abort=="function"}function L(I){I.emit("close")}function T(I,$){I.emit("error",$),r.nextTick(L,I)}function B(I,$){!I||a(I)||(!$&&!s(I)&&($=new i),d(I)?(I.socket=null,I.destroy($)):R(I)?I.abort():R(I.req)?I.req.abort():typeof I.destroy=="function"?I.destroy($):typeof I.close=="function"?I.close():$?r.nextTick(T,I,$):r.nextTick(L,I),I.destroyed||(I[o]=!0))}return Nn={construct:m,destroyer:B,destroy:v,undestroy:_,errorOrDestroy:E},Nn}var Tn,ms;function va(){if(ms)return Tn;ms=1;const{ArrayIsArray:r,ObjectSetPrototypeOf:e}=Be(),{EventEmitter:t}=an();function i(o){t.call(this,o)}e(i.prototype,t.prototype),e(i,t),i.prototype.pipe=function(o,a){const s=this;function d(k){o.writable&&o.write(k)===!1&&s.pause&&s.pause()}s.on("data",d);function l(){s.readable&&s.resume&&s.resume()}o.on("drain",l),!o._isStdio&&(!a||a.end!==!1)&&(s.on("end",u),s.on("close",v));let c=!1;function u(){c||(c=!0,o.end())}function v(){c||(c=!0,typeof o.destroy=="function"&&o.destroy())}function g(k){y(),t.listenerCount(this,"error")===0&&this.emit("error",k)}n(s,"error",g),n(o,"error",g);function y(){s.removeListener("data",d),o.removeListener("drain",l),s.removeListener("end",u),s.removeListener("close",v),s.removeListener("error",g),o.removeListener("error",g),s.removeListener("end",y),s.removeListener("close",y),o.removeListener("close",y)}return s.on("end",y),s.on("close",y),o.on("close",y),o.emit("pipe",s),o};function n(o,a,s){if(typeof o.prependListener=="function")return o.prependListener(a,s);!o._events||!o._events[a]?o.on(a,s):r(o._events[a])?o._events[a].unshift(s):o._events[a]=[s,o._events[a]]}return Tn={Stream:i,prependListener:n},Tn}var An={exports:{}},gs;function sn(){return gs||(gs=1,function(r){const{SymbolDispose:e}=Be(),{AbortError:t,codes:i}=it(),{isNodeStream:n,isWebStream:o,kControllerErrorFunction:a}=Lt(),s=Vt(),{ERR_INVALID_ARG_TYPE:d}=i;let l;const c=(u,v)=>{if(typeof u!="object"||!("aborted"in u))throw new d(v,"AbortSignal",u)};r.exports.addAbortSignal=function(v,g){if(c(v,"signal"),!n(g)&&!o(g))throw new d("stream",["ReadableStream","WritableStream","Stream"],g);return r.exports.addAbortSignalNoValidate(v,g)},r.exports.addAbortSignalNoValidate=function(u,v){if(typeof u!="object"||!("aborted"in u))return v;const g=n(v)?()=>{v.destroy(new t(void 0,{cause:u.reason}))}:()=>{v[a](new t(void 0,{cause:u.reason}))};if(u.aborted)g();else{l=l||at().addAbortListener;const y=l(u,g);s(v,y[e])}return v}}(An)),An.exports}var jn,vs;function ku(){if(vs)return jn;vs=1;const{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:i}=Be(),{Buffer:n}=Dt(),{inspect:o}=at();return jn=class{constructor(){this.head=null,this.tail=null,this.length=0}push(s){const d={data:s,next:null};this.length>0?this.tail.next=d:this.head=d,this.tail=d,++this.length}unshift(s){const d={data:s,next:this.head};this.length===0&&(this.tail=d),this.head=d,++this.length}shift(){if(this.length===0)return;const s=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,s}clear(){this.head=this.tail=null,this.length=0}join(s){if(this.length===0)return"";let d=this.head,l=""+d.data;for(;(d=d.next)!==null;)l+=s+d.data;return l}concat(s){if(this.length===0)return n.alloc(0);const d=n.allocUnsafe(s>>>0);let l=this.head,c=0;for(;l;)t(d,l.data,c),c+=l.data.length,l=l.next;return d}consume(s,d){const l=this.head.data;if(s<l.length){const c=l.slice(0,s);return this.head.data=l.slice(s),c}return s===l.length?this.shift():d?this._getString(s):this._getBuffer(s)}first(){return this.head.data}*[e](){for(let s=this.head;s;s=s.next)yield s.data}_getString(s){let d="",l=this.head,c=0;do{const u=l.data;if(s>u.length)d+=u,s-=u.length;else{s===u.length?(d+=u,++c,l.next?this.head=l.next:this.head=this.tail=null):(d+=r(u,0,s),this.head=l,l.data=r(u,s));break}++c}while((l=l.next)!==null);return this.length-=c,d}_getBuffer(s){const d=n.allocUnsafe(s),l=s;let c=this.head,u=0;do{const v=c.data;if(s>v.length)t(d,v,l-s),s-=v.length;else{s===v.length?(t(d,v,l-s),++u,c.next?this.head=c.next:this.head=this.tail=null):(t(d,new i(v.buffer,v.byteOffset,s),l-s),this.head=c,c.data=v.slice(s));break}++u}while((c=c.next)!==null);return this.length-=u,d}[Symbol.for("nodejs.util.inspect.custom")](s,d){return o(this,{...d,depth:0,customInspect:!1})}},jn}var Dn,ys;function ln(){if(ys)return Dn;ys=1;const{MathFloor:r,NumberIsInteger:e}=Be(),{validateInteger:t}=Ei(),{ERR_INVALID_ARG_VALUE:i}=it().codes;let n=16*1024,o=16;function a(c,u,v){return c.highWaterMark!=null?c.highWaterMark:u?c[v]:null}function s(c){return c?o:n}function d(c,u){t(u,"value",0),c?o=u:n=u}function l(c,u,v,g){const y=a(u,g,v);if(y!=null){if(!e(y)||y<0){const k=g?`options.${v}`:"options.highWaterMark";throw new i(k,y)}return r(y)}return s(c.objectMode)}return Dn={getHighWaterMark:l,getDefaultHighWaterMark:s,setDefaultHighWaterMark:d},Dn}var Ln={},Pi={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var ws;function Eu(){return ws||(ws=1,function(r,e){var t=Dt(),i=t.Buffer;function n(a,s){for(var d in a)s[d]=a[d]}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?r.exports=t:(n(t,e),e.Buffer=o);function o(a,s,d){return i(a,s,d)}o.prototype=Object.create(i.prototype),n(i,o),o.from=function(a,s,d){if(typeof a=="number")throw new TypeError("Argument must not be a number");return i(a,s,d)},o.alloc=function(a,s,d){if(typeof a!="number")throw new TypeError("Argument must be a number");var l=i(a);return s!==void 0?typeof d=="string"?l.fill(s,d):l.fill(s):l.fill(0),l},o.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return i(a)},o.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(a)}}(Pi,Pi.exports)),Pi.exports}var xs;function Su(){if(xs)return Ln;xs=1;var r=Eu().Buffer,e=r.isEncoding||function(_){switch(_=""+_,_&&_.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 t(_){if(!_)return"utf8";for(var E;;)switch(_){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 _;default:if(E)return;_=(""+_).toLowerCase(),E=!0}}function i(_){var E=t(_);if(typeof E!="string"&&(r.isEncoding===e||!e(_)))throw new Error("Unknown encoding: "+_);return E||_}Ln.StringDecoder=n;function n(_){this.encoding=i(_);var E;switch(this.encoding){case"utf16le":this.text=u,this.end=v,E=4;break;case"utf8":this.fillLast=d,E=4;break;case"base64":this.text=g,this.end=y,E=3;break;default:this.write=k,this.end=x;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(E)}n.prototype.write=function(_){if(_.length===0)return"";var E,m;if(this.lastNeed){if(E=this.fillLast(_),E===void 0)return"";m=this.lastNeed,this.lastNeed=0}else m=0;return m<_.length?E?E+this.text(_,m):this.text(_,m):E||""},n.prototype.end=c,n.prototype.text=l,n.prototype.fillLast=function(_){if(this.lastNeed<=_.length)return _.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,this.lastTotal-this.lastNeed,0,_.length),this.lastNeed-=_.length};function o(_){return _<=127?0:_>>5===6?2:_>>4===14?3:_>>3===30?4:_>>6===2?-1:-2}function a(_,E,m){var f=E.length-1;if(f<m)return 0;var b=o(E[f]);return b>=0?(b>0&&(_.lastNeed=b-1),b):--f<m||b===-2?0:(b=o(E[f]),b>=0?(b>0&&(_.lastNeed=b-2),b):--f<m||b===-2?0:(b=o(E[f]),b>=0?(b>0&&(b===2?b=0:_.lastNeed=b-3),b):0))}function s(_,E,m){if((E[0]&192)!==128)return _.lastNeed=0,"�";if(_.lastNeed>1&&E.length>1){if((E[1]&192)!==128)return _.lastNeed=1,"�";if(_.lastNeed>2&&E.length>2&&(E[2]&192)!==128)return _.lastNeed=2,"�"}}function d(_){var E=this.lastTotal-this.lastNeed,m=s(this,_);if(m!==void 0)return m;if(this.lastNeed<=_.length)return _.copy(this.lastChar,E,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,E,0,_.length),this.lastNeed-=_.length}function l(_,E){var m=a(this,_,E);if(!this.lastNeed)return _.toString("utf8",E);this.lastTotal=m;var f=_.length-(m-this.lastNeed);return _.copy(this.lastChar,0,f),_.toString("utf8",E,f)}function c(_){var E=_&&_.length?this.write(_):"";return this.lastNeed?E+"�":E}function u(_,E){if((_.length-E)%2===0){var m=_.toString("utf16le",E);if(m){var f=m.charCodeAt(m.length-1);if(f>=55296&&f<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1],m.slice(0,-1)}return m}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=_[_.length-1],_.toString("utf16le",E,_.length-1)}function v(_){var E=_&&_.length?this.write(_):"";if(this.lastNeed){var m=this.lastTotal-this.lastNeed;return E+this.lastChar.toString("utf16le",0,m)}return E}function g(_,E){var m=(_.length-E)%3;return m===0?_.toString("base64",E):(this.lastNeed=3-m,this.lastTotal=3,m===1?this.lastChar[0]=_[_.length-1]:(this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1]),_.toString("base64",E,_.length-m))}function y(_){var E=_&&_.length?this.write(_):"";return this.lastNeed?E+this.lastChar.toString("base64",0,3-this.lastNeed):E}function k(_){return _.toString(this.encoding)}function x(_){return _&&_.length?this.write(_):""}return Ln}var On,_s;function tc(){if(_s)return On;_s=1;const r=ur(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:i}=Be(),{Buffer:n}=Dt(),{ERR_INVALID_ARG_TYPE:o,ERR_STREAM_NULL_VALUES:a}=it().codes;function s(d,l,c){let u;if(typeof l=="string"||l instanceof n)return new d({objectMode:!0,...c,read(){this.push(l),this.push(null)}});let v;if(l&&l[t])v=!0,u=l[t]();else if(l&&l[i])v=!1,u=l[i]();else throw new o("iterable",["Iterable"],l);const g=new d({objectMode:!0,highWaterMark:1,...c});let y=!1;g._read=function(){y||(y=!0,x())},g._destroy=function(_,E){e(k(_),()=>r.nextTick(E,_),m=>r.nextTick(E,m||_))};async function k(_){const E=_!=null,m=typeof u.throw=="function";if(E&&m){const{value:f,done:b}=await u.throw(_);if(await f,b)return}if(typeof u.return=="function"){const{value:f}=await u.return();await f}}async function x(){for(;;){try{const{value:_,done:E}=v?await u.next():u.next();if(E)g.push(null);else{const m=_&&typeof _.then=="function"?await _:_;if(m===null)throw y=!1,new a;if(g.push(m))continue;y=!1}}catch(_){g.destroy(_)}break}}return g}return On=s,On}var Cn,ks;function dn(){if(ks)return Cn;ks=1;const r=ur(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:i,NumberParseInt:n,ObjectDefineProperties:o,ObjectKeys:a,ObjectSetPrototypeOf:s,Promise:d,SafeSet:l,SymbolAsyncDispose:c,SymbolAsyncIterator:u,Symbol:v}=Be();Cn=le,le.ReadableState=ge;const{EventEmitter:g}=an(),{Stream:y,prependListener:k}=va(),{Buffer:x}=Dt(),{addAbortSignal:_}=sn(),E=Vt();let m=at().debuglog("stream",D=>{m=D});const f=ku(),b=Lr(),{getHighWaterMark:R,getDefaultHighWaterMark:L}=ln(),{aggregateTwoErrors:T,codes:{ERR_INVALID_ARG_TYPE:B,ERR_METHOD_NOT_IMPLEMENTED:I,ERR_OUT_OF_RANGE:$,ERR_STREAM_PUSH_AFTER_EOF:q,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:A},AbortError:j}=it(),{validateObject:te}=Ei(),N=v("kPaused"),{StringDecoder:Z}=Su(),F=tc();s(le.prototype,y.prototype),s(le,y);const Y=()=>{},{errorOrDestroy:w}=b,U=1,K=2,X=4,de=8,H=16,G=32,W=64,z=128,ee=256,re=512,pe=1024,be=2048,O=4096,V=8192,oe=16384,fe=32768,he=65536,me=1<<17,J=1<<18;function ce(D){return{enumerable:!1,get(){return(this.state&D)!==0},set(M){M?this.state|=D:this.state&=~D}}}o(ge.prototype,{objectMode:ce(U),ended:ce(K),endEmitted:ce(X),reading:ce(de),constructed:ce(H),sync:ce(G),needReadable:ce(W),emittedReadable:ce(z),readableListening:ce(ee),resumeScheduled:ce(re),errorEmitted:ce(pe),emitClose:ce(be),autoDestroy:ce(O),destroyed:ce(V),closed:ce(oe),closeEmitted:ce(fe),multiAwaitDrain:ce(he),readingMore:ce(me),dataEmitted:ce(J)});function ge(D,M,ve){typeof ve!="boolean"&&(ve=M instanceof At()),this.state=be|O|H|G,D&&D.objectMode&&(this.state|=U),ve&&D&&D.readableObjectMode&&(this.state|=U),this.highWaterMark=D?R(this,D,"readableHighWaterMark",ve):L(!1),this.buffer=new f,this.length=0,this.pipes=[],this.flowing=null,this[N]=null,D&&D.emitClose===!1&&(this.state&=~be),D&&D.autoDestroy===!1&&(this.state&=~O),this.errored=null,this.defaultEncoding=D&&D.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,D&&D.encoding&&(this.decoder=new Z(D.encoding),this.encoding=D.encoding)}function le(D){if(!(this instanceof le))return new le(D);const M=this instanceof At();this._readableState=new ge(D,this,M),D&&(typeof D.read=="function"&&(this._read=D.read),typeof D.destroy=="function"&&(this._destroy=D.destroy),typeof D.construct=="function"&&(this._construct=D.construct),D.signal&&!M&&_(D.signal,this)),y.call(this,D),b.construct(this,()=>{this._readableState.needReadable&&Q(this,this._readableState)})}le.prototype.destroy=b.destroy,le.prototype._undestroy=b.undestroy,le.prototype._destroy=function(D,M){M(D)},le.prototype[g.captureRejectionSymbol]=function(D){this.destroy(D)},le.prototype[c]=function(){let D;return this.destroyed||(D=this.readableEnded?null:new j,this.destroy(D)),new d((M,ve)=>E(this,ye=>ye&&ye!==D?ve(ye):M(null)))},le.prototype.push=function(D,M){return Re(this,D,M,!1)},le.prototype.unshift=function(D,M){return Re(this,D,M,!0)};function Re(D,M,ve,ye){m("readableAddChunk",M);const xe=D._readableState;let Xe;if((xe.state&U)===0&&(typeof M=="string"?(ve=ve||xe.defaultEncoding,xe.encoding!==ve&&(ye&&xe.encoding?M=x.from(M,ve).toString(xe.encoding):(M=x.from(M,ve),ve=""))):M instanceof x?ve="":y._isUint8Array(M)?(M=y._uint8ArrayToBuffer(M),ve=""):M!=null&&(Xe=new B("chunk",["string","Buffer","Uint8Array"],M))),Xe)w(D,Xe);else if(M===null)xe.state&=~de,p(D,xe);else if((xe.state&U)!==0||M&&M.length>0)if(ye)if((xe.state&X)!==0)w(D,new A);else{if(xe.destroyed||xe.errored)return!1;We(D,xe,M,!0)}else if(xe.ended)w(D,new q);else{if(xe.destroyed||xe.errored)return!1;xe.state&=~de,xe.decoder&&!ve?(M=xe.decoder.write(M),xe.objectMode||M.length!==0?We(D,xe,M,!1):Q(D,xe)):We(D,xe,M,!1)}else ye||(xe.state&=~de,Q(D,xe));return!xe.ended&&(xe.length<xe.highWaterMark||xe.length===0)}function We(D,M,ve,ye){M.flowing&&M.length===0&&!M.sync&&D.listenerCount("data")>0?((M.state&he)!==0?M.awaitDrainWriters.clear():M.awaitDrainWriters=null,M.dataEmitted=!0,D.emit("data",ve)):(M.length+=M.objectMode?1:ve.length,ye?M.buffer.unshift(ve):M.buffer.push(ve),(M.state&W)!==0&&h(D)),Q(D,M)}le.prototype.isPaused=function(){const D=this._readableState;return D[N]===!0||D.flowing===!1},le.prototype.setEncoding=function(D){const M=new Z(D);this._readableState.decoder=M,this._readableState.encoding=this._readableState.decoder.encoding;const ve=this._readableState.buffer;let ye="";for(const xe of ve)ye+=M.write(xe);return ve.clear(),ye!==""&&ve.push(ye),this._readableState.length=ye.length,this};const Ee=1073741824;function Qe(D){if(D>Ee)throw new $("size","<= 1GiB",D);return D--,D|=D>>>1,D|=D>>>2,D|=D>>>4,D|=D>>>8,D|=D>>>16,D++,D}function S(D,M){return D<=0||M.length===0&&M.ended?0:(M.state&U)!==0?1:i(D)?M.flowing&&M.length?M.buffer.first().length:M.length:D<=M.length?D:M.ended?M.length:0}le.prototype.read=function(D){m("read",D),D===void 0?D=NaN:t(D)||(D=n(D,10));const M=this._readableState,ve=D;if(D>M.highWaterMark&&(M.highWaterMark=Qe(D)),D!==0&&(M.state&=~z),D===0&&M.needReadable&&((M.highWaterMark!==0?M.length>=M.highWaterMark:M.length>0)||M.ended))return m("read: emitReadable",M.length,M.ended),M.length===0&&M.ended?ze(this):h(this),null;if(D=S(D,M),D===0&&M.ended)return M.length===0&&ze(this),null;let ye=(M.state&W)!==0;if(m("need readable",ye),(M.length===0||M.length-D<M.highWaterMark)&&(ye=!0,m("length less than watermark",ye)),M.ended||M.reading||M.destroyed||M.errored||!M.constructed)ye=!1,m("reading, ended or constructing",ye);else if(ye){m("do read"),M.state|=de|G,M.length===0&&(M.state|=W);try{this._read(M.highWaterMark)}catch(Xe){w(this,Xe)}M.state&=~G,M.reading||(D=S(ve,M))}let xe;return D>0?xe=qe(D,M):xe=null,xe===null?(M.needReadable=M.length<=M.highWaterMark,D=0):(M.length-=D,M.multiAwaitDrain?M.awaitDrainWriters.clear():M.awaitDrainWriters=null),M.length===0&&(M.ended||(M.needReadable=!0),ve!==D&&M.ended&&ze(this)),xe!==null&&!M.errorEmitted&&!M.closeEmitted&&(M.dataEmitted=!0,this.emit("data",xe)),xe};function p(D,M){if(m("onEofChunk"),!M.ended){if(M.decoder){const ve=M.decoder.end();ve&&ve.length&&(M.buffer.push(ve),M.length+=M.objectMode?1:ve.length)}M.ended=!0,M.sync?h(D):(M.needReadable=!1,M.emittedReadable=!0,C(D))}}function h(D){const M=D._readableState;m("emitReadable",M.needReadable,M.emittedReadable),M.needReadable=!1,M.emittedReadable||(m("emitReadable",M.flowing),M.emittedReadable=!0,r.nextTick(C,D))}function C(D){const M=D._readableState;m("emitReadable_",M.destroyed,M.length,M.ended),!M.destroyed&&!M.errored&&(M.length||M.ended)&&(D.emit("readable"),M.emittedReadable=!1),M.needReadable=!M.flowing&&!M.ended&&M.length<=M.highWaterMark,Ae(D)}function Q(D,M){!M.readingMore&&M.constructed&&(M.readingMore=!0,r.nextTick(se,D,M))}function se(D,M){for(;!M.reading&&!M.ended&&(M.length<M.highWaterMark||M.flowing&&M.length===0);){const ve=M.length;if(m("maybeReadMore read 0"),D.read(0),ve===M.length)break}M.readingMore=!1}le.prototype._read=function(D){throw new I("_read()")},le.prototype.pipe=function(D,M){const ve=this,ye=this._readableState;ye.pipes.length===1&&(ye.multiAwaitDrain||(ye.multiAwaitDrain=!0,ye.awaitDrainWriters=new l(ye.awaitDrainWriters?[ye.awaitDrainWriters]:[]))),ye.pipes.push(D),m("pipe count=%d opts=%j",ye.pipes.length,M);const Xe=(!M||M.end!==!1)&&D!==r.stdout&&D!==r.stderr?Ti:P;ye.endEmitted?r.nextTick(Xe):ve.once("end",Xe),D.on("unpipe",Ze);function Ze(ie,ne){m("onunpipe"),ie===ve&&ne&&ne.hasUnpiped===!1&&(ne.hasUnpiped=!0,It())}function Ti(){m("onend"),D.end()}let Rt,Ai=!1;function It(){m("cleanup"),D.removeListener("close",Mr),D.removeListener("finish",Ge),Rt&&D.removeListener("drain",Rt),D.removeListener("error",mr),D.removeListener("unpipe",Ze),ve.removeListener("end",Ti),ve.removeListener("end",P),ve.removeListener("data",br),Ai=!0,Rt&&ye.awaitDrainWriters&&(!D._writableState||D._writableState.needDrain)&&Rt()}function Pr(){Ai||(ye.pipes.length===1&&ye.pipes[0]===D?(m("false write response, pause",0),ye.awaitDrainWriters=D,ye.multiAwaitDrain=!1):ye.pipes.length>1&&ye.pipes.includes(D)&&(m("false write response, pause",ye.awaitDrainWriters.size),ye.awaitDrainWriters.add(D)),ve.pause()),Rt||(Rt=ue(ve,D),D.on("drain",Rt))}ve.on("data",br);function br(ie){m("ondata");const ne=D.write(ie);m("dest.write",ne),ne===!1&&Pr()}function mr(ie){if(m("onerror",ie),P(),D.removeListener("error",mr),D.listenerCount("error")===0){const ne=D._writableState||D._readableState;ne&&!ne.errorEmitted?w(D,ie):D.emit("error",ie)}}k(D,"error",mr);function Mr(){D.removeListener("finish",Ge),P()}D.once("close",Mr);function Ge(){m("onfinish"),D.removeListener("close",Mr),P()}D.once("finish",Ge);function P(){m("unpipe"),ve.unpipe(D)}return D.emit("pipe",ve),D.writableNeedDrain===!0?Pr():ye.flowing||(m("pipe resume"),ve.resume()),D};function ue(D,M){return function(){const ye=D._readableState;ye.awaitDrainWriters===M?(m("pipeOnDrain",1),ye.awaitDrainWriters=null):ye.multiAwaitDrain&&(m("pipeOnDrain",ye.awaitDrainWriters.size),ye.awaitDrainWriters.delete(M)),(!ye.awaitDrainWriters||ye.awaitDrainWriters.size===0)&&D.listenerCount("data")&&D.resume()}}le.prototype.unpipe=function(D){const M=this._readableState,ve={hasUnpiped:!1};if(M.pipes.length===0)return this;if(!D){const xe=M.pipes;M.pipes=[],this.pause();for(let Xe=0;Xe<xe.length;Xe++)xe[Xe].emit("unpipe",this,{hasUnpiped:!1});return this}const ye=e(M.pipes,D);return ye===-1?this:(M.pipes.splice(ye,1),M.pipes.length===0&&this.pause(),D.emit("unpipe",this,ve),this)},le.prototype.on=function(D,M){const ve=y.prototype.on.call(this,D,M),ye=this._readableState;return D==="data"?(ye.readableListening=this.listenerCount("readable")>0,ye.flowing!==!1&&this.resume()):D==="readable"&&!ye.endEmitted&&!ye.readableListening&&(ye.readableListening=ye.needReadable=!0,ye.flowing=!1,ye.emittedReadable=!1,m("on readable",ye.length,ye.reading),ye.length?h(this):ye.reading||r.nextTick(Fe,this)),ve},le.prototype.addListener=le.prototype.on,le.prototype.removeListener=function(D,M){const ve=y.prototype.removeListener.call(this,D,M);return D==="readable"&&r.nextTick(ke,this),ve},le.prototype.off=le.prototype.removeListener,le.prototype.removeAllListeners=function(D){const M=y.prototype.removeAllListeners.apply(this,arguments);return(D==="readable"||D===void 0)&&r.nextTick(ke,this),M};function ke(D){const M=D._readableState;M.readableListening=D.listenerCount("readable")>0,M.resumeScheduled&&M[N]===!1?M.flowing=!0:D.listenerCount("data")>0?D.resume():M.readableListening||(M.flowing=null)}function Fe(D){m("readable nexttick read 0"),D.read(0)}le.prototype.resume=function(){const D=this._readableState;return D.flowing||(m("resume"),D.flowing=!D.readableListening,je(this,D)),D[N]=!1,this};function je(D,M){M.resumeScheduled||(M.resumeScheduled=!0,r.nextTick(De,D,M))}function De(D,M){m("resume",M.reading),M.reading||D.read(0),M.resumeScheduled=!1,D.emit("resume"),Ae(D),M.flowing&&!M.reading&&D.read(0)}le.prototype.pause=function(){return m("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(m("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[N]=!0,this};function Ae(D){const M=D._readableState;for(m("flow",M.flowing);M.flowing&&D.read()!==null;);}le.prototype.wrap=function(D){let M=!1;D.on("data",ye=>{!this.push(ye)&&D.pause&&(M=!0,D.pause())}),D.on("end",()=>{this.push(null)}),D.on("error",ye=>{w(this,ye)}),D.on("close",()=>{this.destroy()}),D.on("destroy",()=>{this.destroy()}),this._read=()=>{M&&D.resume&&(M=!1,D.resume())};const ve=a(D);for(let ye=1;ye<ve.length;ye++){const xe=ve[ye];this[xe]===void 0&&typeof D[xe]=="function"&&(this[xe]=D[xe].bind(D))}return this},le.prototype[u]=function(){return bt(this)},le.prototype.iterator=function(D){return D!==void 0&&te(D,"options"),bt(this,D)};function bt(D,M){typeof D.read!="function"&&(D=le.wrap(D,{objectMode:!0}));const ve=Ft(D,M);return ve.stream=D,ve}async function*Ft(D,M){let ve=Y;function ye(Ze){this===D?(ve(),ve=Y):ve=Ze}D.on("readable",ye);let xe;const Xe=E(D,{writable:!1},Ze=>{xe=Ze?T(xe,Ze):null,ve(),ve=Y});try{for(;;){const Ze=D.destroyed?null:D.read();if(Ze!==null)yield Ze;else{if(xe)throw xe;if(xe===null)return;await new d(ye)}}}catch(Ze){throw xe=T(xe,Ze),xe}finally{(xe||M?.destroyOnReturn!==!1)&&(xe===void 0||D._readableState.autoDestroy)?b.destroyer(D,null):(D.off("readable",ye),Xe())}}o(le.prototype,{readable:{__proto__:null,get(){const D=this._readableState;return!!D&&D.readable!==!1&&!D.destroyed&&!D.errorEmitted&&!D.endEmitted},set(D){this._readableState&&(this._readableState.readable=!!D)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(D){this._readableState&&(this._readableState.flowing=D)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(D){this._readableState&&(this._readableState.destroyed=D)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),o(ge.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[N]!==!1},set(D){this[N]=!!D}}}),le._fromList=qe;function qe(D,M){if(M.length===0)return null;let ve;return M.objectMode?ve=M.buffer.shift():!D||D>=M.length?(M.decoder?ve=M.buffer.join(""):M.buffer.length===1?ve=M.buffer.first():ve=M.buffer.concat(M.length),M.buffer.clear()):ve=M.buffer.consume(D,M.decoder),ve}function ze(D){const M=D._readableState;m("endReadable",M.endEmitted),M.endEmitted||(M.ended=!0,r.nextTick(Ni,M,D))}function Ni(D,M){if(m("endReadableNT",D.endEmitted,D.length),!D.errored&&!D.closeEmitted&&!D.endEmitted&&D.length===0){if(D.endEmitted=!0,M.emit("end"),M.writable&&M.allowHalfOpen===!1)r.nextTick(Pt,M);else if(D.autoDestroy){const ve=M._writableState;(!ve||ve.autoDestroy&&(ve.finished||ve.writable===!1))&&M.destroy()}}}function Pt(D){D.writable&&!D.writableEnded&&!D.destroyed&&D.end()}le.from=function(D,M){return F(le,D,M)};let hr;function Fr(){return hr===void 0&&(hr={}),hr}return le.fromWeb=function(D,M){return Fr().newStreamReadableFromReadableStream(D,M)},le.toWeb=function(D,M){return Fr().newReadableStreamFromStreamReadable(D,M)},le.wrap=function(D,M){var ve,ye;return new le({objectMode:(ve=(ye=D.readableObjectMode)!==null&&ye!==void 0?ye:D.objectMode)!==null&&ve!==void 0?ve:!0,...M,destroy(xe,Xe){b.destroyer(D,xe),Xe(xe)}}).wrap(D)},Cn}var $n,Es;function ya(){if(Es)return $n;Es=1;const r=ur(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:i,ObjectDefineProperty:n,ObjectDefineProperties:o,ObjectSetPrototypeOf:a,StringPrototypeToLowerCase:s,Symbol:d,SymbolHasInstance:l}=Be();$n=te,te.WritableState=A;const{EventEmitter:c}=an(),u=va().Stream,{Buffer:v}=Dt(),g=Lr(),{addAbortSignal:y}=sn(),{getHighWaterMark:k,getDefaultHighWaterMark:x}=ln(),{ERR_INVALID_ARG_TYPE:_,ERR_METHOD_NOT_IMPLEMENTED:E,ERR_MULTIPLE_CALLBACK:m,ERR_STREAM_CANNOT_PIPE:f,ERR_STREAM_DESTROYED:b,ERR_STREAM_ALREADY_FINISHED:R,ERR_STREAM_NULL_VALUES:L,ERR_STREAM_WRITE_AFTER_END:T,ERR_UNKNOWN_ENCODING:B}=it().codes,{errorOrDestroy:I}=g;a(te.prototype,u.prototype),a(te,u);function $(){}const q=d("kOnFinished");function A(O,V,oe){typeof oe!="boolean"&&(oe=V instanceof At()),this.objectMode=!!(O&&O.objectMode),oe&&(this.objectMode=this.objectMode||!!(O&&O.writableObjectMode)),this.highWaterMark=O?k(this,O,"writableHighWaterMark",oe):x(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const fe=!!(O&&O.decodeStrings===!1);this.decodeStrings=!fe,this.defaultEncoding=O&&O.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=w.bind(void 0,V),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,j(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!O||O.emitClose!==!1,this.autoDestroy=!O||O.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[q]=[]}function j(O){O.buffered=[],O.bufferedIndex=0,O.allBuffers=!0,O.allNoop=!0}A.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},n(A.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function te(O){const V=this instanceof At();if(!V&&!i(te,this))return new te(O);this._writableState=new A(O,this,V),O&&(typeof O.write=="function"&&(this._write=O.write),typeof O.writev=="function"&&(this._writev=O.writev),typeof O.destroy=="function"&&(this._destroy=O.destroy),typeof O.final=="function"&&(this._final=O.final),typeof O.construct=="function"&&(this._construct=O.construct),O.signal&&y(O.signal,this)),u.call(this,O),g.construct(this,()=>{const oe=this._writableState;oe.writing||de(this,oe),z(this,oe)})}n(te,l,{__proto__:null,value:function(O){return i(this,O)?!0:this!==te?!1:O&&O._writableState instanceof A}}),te.prototype.pipe=function(){I(this,new f)};function N(O,V,oe,fe){const he=O._writableState;if(typeof oe=="function")fe=oe,oe=he.defaultEncoding;else{if(!oe)oe=he.defaultEncoding;else if(oe!=="buffer"&&!v.isEncoding(oe))throw new B(oe);typeof fe!="function"&&(fe=$)}if(V===null)throw new L;if(!he.objectMode)if(typeof V=="string")he.decodeStrings!==!1&&(V=v.from(V,oe),oe="buffer");else if(V instanceof v)oe="buffer";else if(u._isUint8Array(V))V=u._uint8ArrayToBuffer(V),oe="buffer";else throw new _("chunk",["string","Buffer","Uint8Array"],V);let me;return he.ending?me=new T:he.destroyed&&(me=new b("write")),me?(r.nextTick(fe,me),I(O,me,!0),me):(he.pendingcb++,Z(O,he,V,oe,fe))}te.prototype.write=function(O,V,oe){return N(this,O,V,oe)===!0},te.prototype.cork=function(){this._writableState.corked++},te.prototype.uncork=function(){const O=this._writableState;O.corked&&(O.corked--,O.writing||de(this,O))},te.prototype.setDefaultEncoding=function(V){if(typeof V=="string"&&(V=s(V)),!v.isEncoding(V))throw new B(V);return this._writableState.defaultEncoding=V,this};function Z(O,V,oe,fe,he){const me=V.objectMode?1:oe.length;V.length+=me;const J=V.length<V.highWaterMark;return J||(V.needDrain=!0),V.writing||V.corked||V.errored||!V.constructed?(V.buffered.push({chunk:oe,encoding:fe,callback:he}),V.allBuffers&&fe!=="buffer"&&(V.allBuffers=!1),V.allNoop&&he!==$&&(V.allNoop=!1)):(V.writelen=me,V.writecb=he,V.writing=!0,V.sync=!0,O._write(oe,fe,V.onwrite),V.sync=!1),J&&!V.errored&&!V.destroyed}function F(O,V,oe,fe,he,me,J){V.writelen=fe,V.writecb=J,V.writing=!0,V.sync=!0,V.destroyed?V.onwrite(new b("write")):oe?O._writev(he,V.onwrite):O._write(he,me,V.onwrite),V.sync=!1}function Y(O,V,oe,fe){--V.pendingcb,fe(oe),X(V),I(O,oe)}function w(O,V){const oe=O._writableState,fe=oe.sync,he=oe.writecb;if(typeof he!="function"){I(O,new m);return}oe.writing=!1,oe.writecb=null,oe.length-=oe.writelen,oe.writelen=0,V?(V.stack,oe.errored||(oe.errored=V),O._readableState&&!O._readableState.errored&&(O._readableState.errored=V),fe?r.nextTick(Y,O,oe,V,he):Y(O,oe,V,he)):(oe.buffered.length>oe.bufferedIndex&&de(O,oe),fe?oe.afterWriteTickInfo!==null&&oe.afterWriteTickInfo.cb===he?oe.afterWriteTickInfo.count++:(oe.afterWriteTickInfo={count:1,cb:he,stream:O,state:oe},r.nextTick(U,oe.afterWriteTickInfo)):K(O,oe,1,he))}function U({stream:O,state:V,count:oe,cb:fe}){return V.afterWriteTickInfo=null,K(O,V,oe,fe)}function K(O,V,oe,fe){for(!V.ending&&!O.destroyed&&V.length===0&&V.needDrain&&(V.needDrain=!1,O.emit("drain"));oe-- >0;)V.pendingcb--,fe();V.destroyed&&X(V),z(O,V)}function X(O){if(O.writing)return;for(let he=O.bufferedIndex;he<O.buffered.length;++he){var V;const{chunk:me,callback:J}=O.buffered[he],ce=O.objectMode?1:me.length;O.length-=ce,J((V=O.errored)!==null&&V!==void 0?V:new b("write"))}const oe=O[q].splice(0);for(let he=0;he<oe.length;he++){var fe;oe[he]((fe=O.errored)!==null&&fe!==void 0?fe:new b("end"))}j(O)}function de(O,V){if(V.corked||V.bufferProcessing||V.destroyed||!V.constructed)return;const{buffered:oe,bufferedIndex:fe,objectMode:he}=V,me=oe.length-fe;if(!me)return;let J=fe;if(V.bufferProcessing=!0,me>1&&O._writev){V.pendingcb-=me-1;const ce=V.allNoop?$:le=>{for(let Re=J;Re<oe.length;++Re)oe[Re].callback(le)},ge=V.allNoop&&J===0?oe:e(oe,J);ge.allBuffers=V.allBuffers,F(O,V,!0,V.length,ge,"",ce),j(V)}else{do{const{chunk:ce,encoding:ge,callback:le}=oe[J];oe[J++]=null;const Re=he?1:ce.length;F(O,V,!1,Re,ce,ge,le)}while(J<oe.length&&!V.writing);J===oe.length?j(V):J>256?(oe.splice(0,J),V.bufferedIndex=0):V.bufferedIndex=J}V.bufferProcessing=!1}te.prototype._write=function(O,V,oe){if(this._writev)this._writev([{chunk:O,encoding:V}],oe);else throw new E("_write()")},te.prototype._writev=null,te.prototype.end=function(O,V,oe){const fe=this._writableState;typeof O=="function"?(oe=O,O=null,V=null):typeof V=="function"&&(oe=V,V=null);let he;if(O!=null){const me=N(this,O,V);me instanceof t&&(he=me)}return fe.corked&&(fe.corked=1,this.uncork()),he||(!fe.errored&&!fe.ending?(fe.ending=!0,z(this,fe,!0),fe.ended=!0):fe.finished?he=new R("end"):fe.destroyed&&(he=new b("end"))),typeof oe=="function"&&(he||fe.finished?r.nextTick(oe,he):fe[q].push(oe)),this};function H(O){return O.ending&&!O.destroyed&&O.constructed&&O.length===0&&!O.errored&&O.buffered.length===0&&!O.finished&&!O.writing&&!O.errorEmitted&&!O.closeEmitted}function G(O,V){let oe=!1;function fe(he){if(oe){I(O,he??m());return}if(oe=!0,V.pendingcb--,he){const me=V[q].splice(0);for(let J=0;J<me.length;J++)me[J](he);I(O,he,V.sync)}else H(V)&&(V.prefinished=!0,O.emit("prefinish"),V.pendingcb++,r.nextTick(ee,O,V))}V.sync=!0,V.pendingcb++;try{O._final(fe)}catch(he){fe(he)}V.sync=!1}function W(O,V){!V.prefinished&&!V.finalCalled&&(typeof O._final=="function"&&!V.destroyed?(V.finalCalled=!0,G(O,V)):(V.prefinished=!0,O.emit("prefinish")))}function z(O,V,oe){H(V)&&(W(O,V),V.pendingcb===0&&(oe?(V.pendingcb++,r.nextTick((fe,he)=>{H(he)?ee(fe,he):he.pendingcb--},O,V)):H(V)&&(V.pendingcb++,ee(O,V))))}function ee(O,V){V.pendingcb--,V.finished=!0;const oe=V[q].splice(0);for(let fe=0;fe<oe.length;fe++)oe[fe]();if(O.emit("finish"),V.autoDestroy){const fe=O._readableState;(!fe||fe.autoDestroy&&(fe.endEmitted||fe.readable===!1))&&O.destroy()}}o(te.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(O){this._writableState&&(this._writableState.destroyed=O)}},writable:{__proto__:null,get(){const O=this._writableState;return!!O&&O.writable!==!1&&!O.destroyed&&!O.errored&&!O.ending&&!O.ended},set(O){this._writableState&&(this._writableState.writable=!!O)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){const O=this._writableState;return O?!O.destroyed&&!O.ending&&O.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});const re=g.destroy;te.prototype.destroy=function(O,V){const oe=this._writableState;return!oe.destroyed&&(oe.bufferedIndex<oe.buffered.length||oe[q].length)&&r.nextTick(X,oe),re.call(this,O,V),this},te.prototype._undestroy=g.undestroy,te.prototype._destroy=function(O,V){V(O)},te.prototype[c.captureRejectionSymbol]=function(O){this.destroy(O)};let pe;function be(){return pe===void 0&&(pe={}),pe}return te.fromWeb=function(O,V){return be().newStreamWritableFromWritableStream(O,V)},te.toWeb=function(O){return be().newWritableStreamFromStreamWritable(O)},$n}var Fn,Ss;function Ru(){if(Ss)return Fn;Ss=1;const r=ur(),e=Dt(),{isReadable:t,isWritable:i,isIterable:n,isNodeStream:o,isReadableNodeStream:a,isWritableNodeStream:s,isDuplexNodeStream:d,isReadableStream:l,isWritableStream:c}=Lt(),u=Vt(),{AbortError:v,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:y}}=it(),{destroyer:k}=Lr(),x=At(),_=dn(),E=ya(),{createDeferredPromise:m}=at(),f=tc(),b=globalThis.Blob||e.Blob,R=typeof b<"u"?function(A){return A instanceof b}:function(A){return!1},L=globalThis.AbortController||yi().AbortController,{FunctionPrototypeCall:T}=Be();class B extends x{constructor(A){super(A),A?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),A?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}Fn=function q(A,j){if(d(A))return A;if(a(A))return $({readable:A});if(s(A))return $({writable:A});if(o(A))return $({writable:!1,readable:!1});if(l(A))return $({readable:_.fromWeb(A)});if(c(A))return $({writable:E.fromWeb(A)});if(typeof A=="function"){const{value:N,write:Z,final:F,destroy:Y}=I(A);if(n(N))return f(B,N,{objectMode:!0,write:Z,final:F,destroy:Y});const w=N?.then;if(typeof w=="function"){let U;const K=T(w,N,X=>{if(X!=null)throw new y("nully","body",X)},X=>{k(U,X)});return U=new B({objectMode:!0,readable:!1,write:Z,final(X){F(async()=>{try{await K,r.nextTick(X,null)}catch(de){r.nextTick(X,de)}})},destroy:Y})}throw new y("Iterable, AsyncIterable or AsyncFunction",j,N)}if(R(A))return q(A.arrayBuffer());if(n(A))return f(B,A,{objectMode:!0,writable:!1});if(l(A?.readable)&&c(A?.writable))return B.fromWeb(A);if(typeof A?.writable=="object"||typeof A?.readable=="object"){const N=A!=null&&A.readable?a(A?.readable)?A?.readable:q(A.readable):void 0,Z=A!=null&&A.writable?s(A?.writable)?A?.writable:q(A.writable):void 0;return $({readable:N,writable:Z})}const te=A?.then;if(typeof te=="function"){let N;return T(te,A,Z=>{Z!=null&&N.push(Z),N.push(null)},Z=>{k(N,Z)}),N=new B({objectMode:!0,writable:!1,read(){}})}throw new g(j,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],A)};function I(q){let{promise:A,resolve:j}=m();const te=new L,N=te.signal;return{value:q(async function*(){for(;;){const F=A;A=null;const{chunk:Y,done:w,cb:U}=await F;if(r.nextTick(U),w)return;if(N.aborted)throw new v(void 0,{cause:N.reason});({promise:A,resolve:j}=m()),yield Y}}(),{signal:N}),write(F,Y,w){const U=j;j=null,U({chunk:F,done:!1,cb:w})},final(F){const Y=j;j=null,Y({done:!0,cb:F})},destroy(F,Y){te.abort(),Y(F)}}}function $(q){const A=q.readable&&typeof q.readable.read!="function"?_.wrap(q.readable):q.readable,j=q.writable;let te=!!t(A),N=!!i(j),Z,F,Y,w,U;function K(X){const de=w;w=null,de?de(X):X&&U.destroy(X)}return U=new B({readableObjectMode:!!(A!=null&&A.readableObjectMode),writableObjectMode:!!(j!=null&&j.writableObjectMode),readable:te,writable:N}),N&&(u(j,X=>{N=!1,X&&k(A,X),K(X)}),U._write=function(X,de,H){j.write(X,de)?H():Z=H},U._final=function(X){j.end(),F=X},j.on("drain",function(){if(Z){const X=Z;Z=null,X()}}),j.on("finish",function(){if(F){const X=F;F=null,X()}})),te&&(u(A,X=>{te=!1,X&&k(A,X),K(X)}),A.on("readable",function(){if(Y){const X=Y;Y=null,X()}}),A.on("end",function(){U.push(null)}),U._read=function(){for(;;){const X=A.read();if(X===null){Y=U._read;return}if(!U.push(X))return}}),U._destroy=function(X,de){!X&&w!==null&&(X=new v),Y=null,Z=null,F=null,w===null?de(X):(w=de,k(j,X),k(A,X))},U}return Fn}var Pn,Rs;function At(){if(Rs)return Pn;Rs=1;const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:i}=Be();Pn=a;const n=dn(),o=ya();i(a.prototype,n.prototype),i(a,n);{const c=t(o.prototype);for(let u=0;u<c.length;u++){const v=c[u];a.prototype[v]||(a.prototype[v]=o.prototype[v])}}function a(c){if(!(this instanceof a))return new a(c);n.call(this,c),o.call(this,c),c?(this.allowHalfOpen=c.allowHalfOpen!==!1,c.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),c.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}r(a.prototype,{writable:{__proto__:null,...e(o.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(o.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(o.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(o.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(o.prototype,"writableLength")},writableFinished:{__proto__:null,...e(o.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(o.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(o.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(o.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(c){this._readableState&&this._writableState&&(this._readableState.destroyed=c,this._writableState.destroyed=c)}}});let s;function d(){return s===void 0&&(s={}),s}a.fromWeb=function(c,u){return d().newStreamDuplexFromReadableWritablePair(c,u)},a.toWeb=function(c){return d().newReadableWritablePairFromDuplex(c)};let l;return a.from=function(c){return l||(l=Ru()),l(c,"body")},Pn}var Mn,Is;function rc(){if(Is)return Mn;Is=1;const{ObjectSetPrototypeOf:r,Symbol:e}=Be();Mn=a;const{ERR_METHOD_NOT_IMPLEMENTED:t}=it().codes,i=At(),{getHighWaterMark:n}=ln();r(a.prototype,i.prototype),r(a,i);const o=e("kCallback");function a(l){if(!(this instanceof a))return new a(l);const c=l?n(this,l,"readableHighWaterMark",!0):null;c===0&&(l={...l,highWaterMark:null,readableHighWaterMark:c,writableHighWaterMark:l.writableHighWaterMark||0}),i.call(this,l),this._readableState.sync=!1,this[o]=null,l&&(typeof l.transform=="function"&&(this._transform=l.transform),typeof l.flush=="function"&&(this._flush=l.flush)),this.on("prefinish",d)}function s(l){typeof this._flush=="function"&&!this.destroyed?this._flush((c,u)=>{if(c){l?l(c):this.destroy(c);return}u!=null&&this.push(u),this.push(null),l&&l()}):(this.push(null),l&&l())}function d(){this._final!==s&&s.call(this)}return a.prototype._final=s,a.prototype._transform=function(l,c,u){throw new t("_transform()")},a.prototype._write=function(l,c,u){const v=this._readableState,g=this._writableState,y=v.length;this._transform(l,c,(k,x)=>{if(k){u(k);return}x!=null&&this.push(x),g.ended||y===v.length||v.length<v.highWaterMark?u():this[o]=u})},a.prototype._read=function(){if(this[o]){const l=this[o];this[o]=null,l()}},Mn}var Bn,Ns;function ic(){if(Ns)return Bn;Ns=1;const{ObjectSetPrototypeOf:r}=Be();Bn=t;const e=rc();r(t.prototype,e.prototype),r(t,e);function t(i){if(!(this instanceof t))return new t(i);e.call(this,i)}return t.prototype._transform=function(i,n,o){o(null,i)},Bn}var qn,Ts;function wa(){if(Ts)return qn;Ts=1;const r=ur(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:i,SymbolDispose:n}=Be(),o=Vt(),{once:a}=at(),s=Lr(),d=At(),{aggregateTwoErrors:l,codes:{ERR_INVALID_ARG_TYPE:c,ERR_INVALID_RETURN_VALUE:u,ERR_MISSING_ARGS:v,ERR_STREAM_DESTROYED:g,ERR_STREAM_PREMATURE_CLOSE:y},AbortError:k}=it(),{validateFunction:x,validateAbortSignal:_}=Ei(),{isIterable:E,isReadable:m,isReadableNodeStream:f,isNodeStream:b,isTransformStream:R,isWebStream:L,isReadableStream:T,isReadableFinished:B}=Lt(),I=globalThis.AbortController||yi().AbortController;let $,q,A;function j(X,de,H){let G=!1;X.on("close",()=>{G=!0});const W=o(X,{readable:de,writable:H},z=>{G=!z});return{destroy:z=>{G||(G=!0,s.destroyer(X,z||new g("pipe")))},cleanup:W}}function te(X){return x(X[X.length-1],"streams[stream.length - 1]"),X.pop()}function N(X){if(E(X))return X;if(f(X))return Z(X);throw new c("val",["Readable","Iterable","AsyncIterable"],X)}async function*Z(X){q||(q=dn()),yield*q.prototype[i].call(X)}async function F(X,de,H,{end:G}){let W,z=null;const ee=be=>{if(be&&(W=be),z){const O=z;z=null,O()}},re=()=>new t((be,O)=>{W?O(W):z=()=>{W?O(W):be()}});de.on("drain",ee);const pe=o(de,{readable:!1},ee);try{de.writableNeedDrain&&await re();for await(const be of X)de.write(be)||await re();G&&(de.end(),await re()),H()}catch(be){H(W!==be?l(W,be):be)}finally{pe(),de.off("drain",ee)}}async function Y(X,de,H,{end:G}){R(de)&&(de=de.writable);const W=de.getWriter();try{for await(const z of X)await W.ready,W.write(z).catch(()=>{});await W.ready,G&&await W.close(),H()}catch(z){try{await W.abort(z),H(z)}catch(ee){H(ee)}}}function w(...X){return U(X,a(te(X)))}function U(X,de,H){if(X.length===1&&e(X[0])&&(X=X[0]),X.length<2)throw new v("streams");const G=new I,W=G.signal,z=H?.signal,ee=[];_(z,"options.signal");function re(){he(new k)}A=A||at().addAbortListener;let pe;z&&(pe=A(z,re));let be,O;const V=[];let oe=0;function fe(ge){he(ge,--oe===0)}function he(ge,le){var Re;if(ge&&(!be||be.code==="ERR_STREAM_PREMATURE_CLOSE")&&(be=ge),!(!be&&!le)){for(;V.length;)V.shift()(be);(Re=pe)===null||Re===void 0||Re[n](),G.abort(),le&&(be||ee.forEach(We=>We()),r.nextTick(de,be,O))}}let me;for(let ge=0;ge<X.length;ge++){const le=X[ge],Re=ge<X.length-1,We=ge>0,Ee=Re||H?.end!==!1,Qe=ge===X.length-1;if(b(le)){let S=function(p){p&&p.name!=="AbortError"&&p.code!=="ERR_STREAM_PREMATURE_CLOSE"&&fe(p)};if(Ee){const{destroy:p,cleanup:h}=j(le,Re,We);V.push(p),m(le)&&Qe&&ee.push(h)}le.on("error",S),m(le)&&Qe&&ee.push(()=>{le.removeListener("error",S)})}if(ge===0)if(typeof le=="function"){if(me=le({signal:W}),!E(me))throw new u("Iterable, AsyncIterable or Stream","source",me)}else E(le)||f(le)||R(le)?me=le:me=d.from(le);else if(typeof le=="function"){if(R(me)){var J;me=N((J=me)===null||J===void 0?void 0:J.readable)}else me=N(me);if(me=le(me,{signal:W}),Re){if(!E(me,!0))throw new u("AsyncIterable",`transform[${ge-1}]`,me)}else{var ce;$||($=ic());const S=new $({objectMode:!0}),p=(ce=me)===null||ce===void 0?void 0:ce.then;if(typeof p=="function")oe++,p.call(me,Q=>{O=Q,Q!=null&&S.write(Q),Ee&&S.end(),r.nextTick(fe)},Q=>{S.destroy(Q),r.nextTick(fe,Q)});else if(E(me,!0))oe++,F(me,S,fe,{end:Ee});else if(T(me)||R(me)){const Q=me.readable||me;oe++,F(Q,S,fe,{end:Ee})}else throw new u("AsyncIterable or Promise","destination",me);me=S;const{destroy:h,cleanup:C}=j(me,!1,!0);V.push(h),Qe&&ee.push(C)}}else if(b(le)){if(f(me)){oe+=2;const S=K(me,le,fe,{end:Ee});m(le)&&Qe&&ee.push(S)}else if(R(me)||T(me)){const S=me.readable||me;oe++,F(S,le,fe,{end:Ee})}else if(E(me))oe++,F(me,le,fe,{end:Ee});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else if(L(le)){if(f(me))oe++,Y(N(me),le,fe,{end:Ee});else if(T(me)||E(me))oe++,Y(me,le,fe,{end:Ee});else if(R(me))oe++,Y(me.readable,le,fe,{end:Ee});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else me=d.from(le)}return(W!=null&&W.aborted||z!=null&&z.aborted)&&r.nextTick(re),me}function K(X,de,H,{end:G}){let W=!1;if(de.on("close",()=>{W||H(new y)}),X.pipe(de,{end:!1}),G){let z=function(){W=!0,de.end()};B(X)?r.nextTick(z):X.once("end",z)}else H();return o(X,{readable:!0,writable:!1},z=>{const ee=X._readableState;z&&z.code==="ERR_STREAM_PREMATURE_CLOSE"&&ee&&ee.ended&&!ee.errored&&!ee.errorEmitted?X.once("end",H).once("error",H):H(z)}),o(de,{readable:!1,writable:!0},H)}return qn={pipelineImpl:U,pipeline:w},qn}var zn,As;function nc(){if(As)return zn;As=1;const{pipeline:r}=wa(),e=At(),{destroyer:t}=Lr(),{isNodeStream:i,isReadable:n,isWritable:o,isWebStream:a,isTransformStream:s,isWritableStream:d,isReadableStream:l}=Lt(),{AbortError:c,codes:{ERR_INVALID_ARG_VALUE:u,ERR_MISSING_ARGS:v}}=it(),g=Vt();return zn=function(...k){if(k.length===0)throw new v("streams");if(k.length===1)return e.from(k[0]);const x=[...k];if(typeof k[0]=="function"&&(k[0]=e.from(k[0])),typeof k[k.length-1]=="function"){const $=k.length-1;k[$]=e.from(k[$])}for(let $=0;$<k.length;++$)if(!(!i(k[$])&&!a(k[$]))){if($<k.length-1&&!(n(k[$])||l(k[$])||s(k[$])))throw new u(`streams[${$}]`,x[$],"must be readable");if($>0&&!(o(k[$])||d(k[$])||s(k[$])))throw new u(`streams[${$}]`,x[$],"must be writable")}let _,E,m,f,b;function R($){const q=f;f=null,q?q($):$?b.destroy($):!I&&!B&&b.destroy()}const L=k[0],T=r(k,R),B=!!(o(L)||d(L)||s(L)),I=!!(n(T)||l(T)||s(T));if(b=new e({writableObjectMode:!!(L!=null&&L.writableObjectMode),readableObjectMode:!!(T!=null&&T.readableObjectMode),writable:B,readable:I}),B){if(i(L))b._write=function(q,A,j){L.write(q,A)?j():_=j},b._final=function(q){L.end(),E=q},L.on("drain",function(){if(_){const q=_;_=null,q()}});else if(a(L)){const A=(s(L)?L.writable:L).getWriter();b._write=async function(j,te,N){try{await A.ready,A.write(j).catch(()=>{}),N()}catch(Z){N(Z)}},b._final=async function(j){try{await A.ready,A.close().catch(()=>{}),E=j}catch(te){j(te)}}}const $=s(T)?T.readable:T;g($,()=>{if(E){const q=E;E=null,q()}})}if(I){if(i(T))T.on("readable",function(){if(m){const $=m;m=null,$()}}),T.on("end",function(){b.push(null)}),b._read=function(){for(;;){const $=T.read();if($===null){m=b._read;return}if(!b.push($))return}};else if(a(T)){const q=(s(T)?T.readable:T).getReader();b._read=async function(){for(;;)try{const{value:A,done:j}=await q.read();if(!b.push(A))return;if(j){b.push(null);return}}catch{return}}}}return b._destroy=function($,q){!$&&f!==null&&($=new c),m=null,_=null,E=null,f===null?q($):(f=q,i(T)&&t(T,$))},b},zn}var js;function Iu(){if(js)return $i;js=1;const r=globalThis.AbortController||yi().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:i,ERR_OUT_OF_RANGE:n},AbortError:o}=it(),{validateAbortSignal:a,validateInteger:s,validateObject:d}=Ei(),l=Be().Symbol("kWeak"),c=Be().Symbol("kResistStopPropagation"),{finished:u}=Vt(),v=nc(),{addAbortSignalNoValidate:g}=sn(),{isWritable:y,isNodeStream:k}=Lt(),{deprecate:x}=at(),{ArrayPrototypePush:_,Boolean:E,MathFloor:m,Number:f,NumberIsNaN:b,Promise:R,PromiseReject:L,PromiseResolve:T,PromisePrototypeThen:B,Symbol:I}=Be(),$=I("kEmpty"),q=I("kEof");function A(z,ee){if(ee!=null&&d(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),k(z)&&!y(z))throw new e("stream",z,"must be writable");const re=v(this,z);return ee!=null&&ee.signal&&g(ee.signal,re),re}function j(z,ee){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);ee!=null&&d(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal");let re=1;ee?.concurrency!=null&&(re=m(ee.concurrency));let pe=re-1;return ee?.highWaterMark!=null&&(pe=m(ee.highWaterMark)),s(re,"options.concurrency",1),s(pe,"options.highWaterMark",0),pe+=re,(async function*(){const O=at().AbortSignalAny([ee?.signal].filter(E)),V=this,oe=[],fe={signal:O};let he,me,J=!1,ce=0;function ge(){J=!0,le()}function le(){ce-=1,Re()}function Re(){me&&!J&&ce<re&&oe.length<pe&&(me(),me=null)}async function We(){try{for await(let Ee of V){if(J)return;if(O.aborted)throw new o;try{if(Ee=z(Ee,fe),Ee===$)continue;Ee=T(Ee)}catch(Qe){Ee=L(Qe)}ce+=1,B(Ee,le,ge),oe.push(Ee),he&&(he(),he=null),!J&&(oe.length>=pe||ce>=re)&&await new R(Qe=>{me=Qe})}oe.push(q)}catch(Ee){const Qe=L(Ee);B(Qe,le,ge),oe.push(Qe)}finally{J=!0,he&&(he(),he=null)}}We();try{for(;;){for(;oe.length>0;){const Ee=await oe[0];if(Ee===q)return;if(O.aborted)throw new o;Ee!==$&&(yield Ee),oe.shift(),Re()}await new R(Ee=>{he=Ee})}}finally{J=!0,me&&(me(),me=null)}}).call(this)}function te(z=void 0){return z!=null&&d(z,"options"),z?.signal!=null&&a(z.signal,"options.signal"),(async function*(){let re=0;for await(const be of this){var pe;if(z!=null&&(pe=z.signal)!==null&&pe!==void 0&&pe.aborted)throw new o({cause:z.signal.reason});yield[re++,be]}}).call(this)}async function N(z,ee=void 0){for await(const re of w.call(this,z,ee))return!0;return!1}async function Z(z,ee=void 0){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);return!await N.call(this,async(...re)=>!await z(...re),ee)}async function F(z,ee){for await(const re of w.call(this,z,ee))return re}async function Y(z,ee){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);async function re(pe,be){return await z(pe,be),$}for await(const pe of j.call(this,re,ee));}function w(z,ee){if(typeof z!="function")throw new t("fn",["Function","AsyncFunction"],z);async function re(pe,be){return await z(pe,be)?pe:$}return j.call(this,re,ee)}class U extends i{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function K(z,ee,re){var pe;if(typeof z!="function")throw new t("reducer",["Function","AsyncFunction"],z);re!=null&&d(re,"options"),re?.signal!=null&&a(re.signal,"options.signal");let be=arguments.length>1;if(re!=null&&(pe=re.signal)!==null&&pe!==void 0&&pe.aborted){const he=new o(void 0,{cause:re.signal.reason});throw this.once("error",()=>{}),await u(this.destroy(he)),he}const O=new r,V=O.signal;if(re!=null&&re.signal){const he={once:!0,[l]:this,[c]:!0};re.signal.addEventListener("abort",()=>O.abort(),he)}let oe=!1;try{for await(const he of this){var fe;if(oe=!0,re!=null&&(fe=re.signal)!==null&&fe!==void 0&&fe.aborted)throw new o;be?ee=await z(ee,he,{signal:V}):(ee=he,be=!0)}if(!oe&&!be)throw new U}finally{O.abort()}return ee}async function X(z){z!=null&&d(z,"options"),z?.signal!=null&&a(z.signal,"options.signal");const ee=[];for await(const pe of this){var re;if(z!=null&&(re=z.signal)!==null&&re!==void 0&&re.aborted)throw new o(void 0,{cause:z.signal.reason});_(ee,pe)}return ee}function de(z,ee){const re=j.call(this,z,ee);return(async function*(){for await(const be of re)yield*be}).call(this)}function H(z){if(z=f(z),b(z))return 0;if(z<0)throw new n("number",">= 0",z);return z}function G(z,ee=void 0){return ee!=null&&d(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),z=H(z),(async function*(){var pe;if(ee!=null&&(pe=ee.signal)!==null&&pe!==void 0&&pe.aborted)throw new o;for await(const O of this){var be;if(ee!=null&&(be=ee.signal)!==null&&be!==void 0&&be.aborted)throw new o;z--<=0&&(yield O)}}).call(this)}function W(z,ee=void 0){return ee!=null&&d(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),z=H(z),(async function*(){var pe;if(ee!=null&&(pe=ee.signal)!==null&&pe!==void 0&&pe.aborted)throw new o;for await(const O of this){var be;if(ee!=null&&(be=ee.signal)!==null&&be!==void 0&&be.aborted)throw new o;if(z-- >0&&(yield O),z<=0)return}}).call(this)}return $i.streamReturningOperators={asIndexedPairs:x(te,"readable.asIndexedPairs will be removed in a future version."),drop:G,filter:w,flatMap:de,map:j,take:W,compose:A},$i.promiseReturningOperators={every:Z,forEach:Y,reduce:K,toArray:X,some:N,find:F},$i}var Un,Ds;function oc(){if(Ds)return Un;Ds=1;const{ArrayPrototypePop:r,Promise:e}=Be(),{isIterable:t,isNodeStream:i,isWebStream:n}=Lt(),{pipelineImpl:o}=wa(),{finished:a}=Vt();ac();function s(...d){return new e((l,c)=>{let u,v;const g=d[d.length-1];if(g&&typeof g=="object"&&!i(g)&&!t(g)&&!n(g)){const y=r(d);u=y.signal,v=y.end}o(d,(y,k)=>{y?c(y):l(k)},{signal:u,end:v})})}return Un={finished:a,pipeline:s},Un}var Ls;function ac(){if(Ls)return wn.exports;Ls=1;const{Buffer:r}=Dt(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:i}=Be(),{promisify:{custom:n}}=at(),{streamReturningOperators:o,promiseReturningOperators:a}=Iu(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:s}}=it(),d=nc(),{setDefaultHighWaterMark:l,getDefaultHighWaterMark:c}=ln(),{pipeline:u}=wa(),{destroyer:v}=Lr(),g=Vt(),y=oc(),k=Lt(),x=wn.exports=va().Stream;x.isDestroyed=k.isDestroyed,x.isDisturbed=k.isDisturbed,x.isErrored=k.isErrored,x.isReadable=k.isReadable,x.isWritable=k.isWritable,x.Readable=dn();for(const E of t(o)){let f=function(...b){if(new.target)throw s();return x.Readable.from(i(m,this,b))};const m=o[E];e(f,"name",{__proto__:null,value:m.name}),e(f,"length",{__proto__:null,value:m.length}),e(x.Readable.prototype,E,{__proto__:null,value:f,enumerable:!1,configurable:!0,writable:!0})}for(const E of t(a)){let f=function(...b){if(new.target)throw s();return i(m,this,b)};const m=a[E];e(f,"name",{__proto__:null,value:m.name}),e(f,"length",{__proto__:null,value:m.length}),e(x.Readable.prototype,E,{__proto__:null,value:f,enumerable:!1,configurable:!0,writable:!0})}x.Writable=ya(),x.Duplex=At(),x.Transform=rc(),x.PassThrough=ic(),x.pipeline=u;const{addAbortSignal:_}=sn();return x.addAbortSignal=_,x.finished=g,x.destroy=v,x.compose=d,x.setDefaultHighWaterMark=l,x.getDefaultHighWaterMark=c,e(x,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return y}}),e(u,n,{__proto__:null,enumerable:!0,get(){return y.pipeline}}),e(g,n,{__proto__:null,enumerable:!0,get(){return y.finished}}),x.Stream=x,x._isUint8Array=function(m){return m instanceof Uint8Array},x._uint8ArrayToBuffer=function(m){return r.from(m.buffer,m.byteOffset,m.byteLength)},wn.exports}var Os;function sc(){return Os||(Os=1,function(r){const e=ac(),t=oc(),i=e.Readable.destroy;r.exports=e.Readable,r.exports._uint8ArrayToBuffer=e._uint8ArrayToBuffer,r.exports._isUint8Array=e._isUint8Array,r.exports.isDisturbed=e.isDisturbed,r.exports.isErrored=e.isErrored,r.exports.isReadable=e.isReadable,r.exports.Readable=e.Readable,r.exports.Writable=e.Writable,r.exports.Duplex=e.Duplex,r.exports.Transform=e.Transform,r.exports.PassThrough=e.PassThrough,r.exports.addAbortSignal=e.addAbortSignal,r.exports.finished=e.finished,r.exports.destroy=e.destroy,r.exports.destroy=i,r.exports.pipeline=e.pipeline,r.exports.compose=e.compose,Object.defineProperty(e,"promises",{configurable:!0,enumerable:!0,get(){return t}}),r.exports.Stream=e.Stream,r.exports.default=r.exports}(yn)),yn.exports}var xa=sc();const Hn=Symbol("iter");function pi(r,e,t=4){if(t===0)return Object.assign(r,e);for(const i in e)r[i]=pi(r[i]||Object.create(null),e[i],t-1);return r}function lc(r,e,t=4){let i=!1;for(const n in r)if(n in e){const o=t===0?null:lc(r[n],e[n],t-1);if(o!==!1)i=i||Object.create(null),i[n]=o;else if(t===3)return!1}return i}function dc(r,e,t=4){let i=!1;for(const n in r)if(!(n in e))i=i||Object.create(null),i[n]=t===0?null:pi({},r[n],t-1);else if(t!==0){const o=dc(r[n],e[n],t-1);if(o!==!1)i=i||Object.create(null),i[n]=o;else if(t===3)return!1}return i}class Nu{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||Ie}_termFromId(e){if(e[0]==="."){const t=this._entities,i=e.split(".");return this._factory.quad(this._termFromId(t[i[1]]),this._termFromId(t[i[2]]),this._termFromId(t[i[3]]),i[4]&&this._termFromId(t[i[4]]))}return di(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){const t=this._termToNumericId(e.subject),i=this._termToNumericId(e.predicate),n=this._termToNumericId(e.object);let o;return t&&i&&n&&(na(e.graph)||(o=this._termToNumericId(e.graph)))&&this._ids[o?`.${t}.${i}.${n}.${o}`:`.${t}.${i}.${n}`]}return this._ids[Er(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${na(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Er(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,i;if(e)for(t=e=`_:${e}`,i=1;this._ids[t];)t=e+i++;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 tt{constructor(e,t){this._size=0,this._graphs=Object.create(null),!t&&e&&!e[0]&&typeof e.match!="function"&&(t=e,e=null),t=t||{},this._factory=t.factory||Ie,this._entityIndex=t.entityIndex||new Nu({factory:this._factory}),this._entities=this._entityIndex._entities,this._termFromId=this._entityIndex._termFromId.bind(this._entityIndex),this._termToNumericId=this._entityIndex._termToNumericId.bind(this._entityIndex),this._termToNewNumericId=this._entityIndex._termToNewNumericId.bind(this._entityIndex),e&&this.addAll(e)}get size(){let e=this._size;if(e!==null)return e;e=0;const t=this._graphs;let i,n;for(const o in t)for(const a in i=t[o].subjects)for(const s in n=i[a])e+=Object.keys(n[s]).length;return this._size=e}_addToIndex(e,t,i,n){const o=e[t]||(e[t]={}),a=o[i]||(o[i]={}),s=n in a;return s||(a[n]=null),!s}_removeFromIndex(e,t,i,n){const o=e[t],a=o[i];delete a[n];for(const s in a)return;delete o[i];for(const s in o)return;delete e[t]}*_findInIndex(e,t,i,n,o,a,s,d){let l,c,u;const v=this._entities,g=this._termFromId(v[d]),y={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const k in e)if(c=e[k]){y[o]=this._termFromId(v[k]),i&&((l=c,c={})[i]=l[i]);for(const x in c)if(u=c[x]){y[a]=this._termFromId(v[x]);const _=n?n in u?[n]:[]:Object.keys(u);for(let E=0;E<_.length;E++)y[s]=this._termFromId(v[_[E]]),yield this._factory.quad(y.subject,y.predicate,y.object,g)}}}_loop(e,t){for(const i in e)t(i)}_loopByKey0(e,t,i){let n,o;if(n=e[t])for(o in n)i(o)}_loopByKey1(e,t,i){let n,o;for(n in e)o=e[n],o[t]&&i(n)}_loopBy2Keys(e,t,i,n){let o,a,s;if((o=e[t])&&(a=o[i]))for(s in a)n(s)}_countInIndex(e,t,i,n){let o=0,a,s,d;t&&((a=e,e={})[t]=a[t]);for(const l in e)if(s=e[l]){i&&((a=s,s={})[i]=a[i]);for(const c in s)(d=s[c])&&(n?n in d&&o++:o+=Object.keys(d).length)}return o}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){const t=Object.create(null);return i=>{i in t||(t[i]=!0,e(this._termFromId(this._entities[i],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,i,n){t||(n=e.graph,i=e.object,t=e.predicate,e=e.subject),n=n?this._termToNewNumericId(n):1;let o=this._graphs[n];return o||(o=this._graphs[n]={subjects:{},predicates:{},objects:{}},Object.freeze(o)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),i=this._termToNewNumericId(i),this._addToIndex(o.subjects,e,t,i)?(this._addToIndex(o.predicates,t,i,e),this._addToIndex(o.objects,i,e,t),this._size=null,!0):!1}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}delete(e){return this.removeQuad(e),this}has(e,t,i,n){return e&&e.subject&&({subject:e,predicate:t,object:i,graph:n}=e),!this.readQuads(e,t,i,n).next().done}import(e){return e.on("data",t=>{this.addQuad(t)}),e}removeQuad(e,t,i,n){t||({subject:e,predicate:t,object:i,graph:n}=e),n=n?this._termToNumericId(n):1;const o=this._graphs;let a,s,d;if(!(e=e&&this._termToNumericId(e))||!(t=t&&this._termToNumericId(t))||!(i=i&&this._termToNumericId(i))||!(a=o[n])||!(s=a.subjects[e])||!(d=s[t])||!(i in d))return!1;this._removeFromIndex(a.subjects,e,t,i),this._removeFromIndex(a.predicates,t,i,e),this._removeFromIndex(a.objects,i,e,t),this._size!==null&&this._size--;for(e in a.subjects)return!0;return delete o[n],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t])}remove(e){return e.on("data",t=>{this.removeQuad(t)}),e}removeMatches(e,t,i,n){const o=new xa.Readable({objectMode:!0}),a=this.readQuads(e,t,i,n);return o._read=s=>{for(;--s>=0;){const{done:d,value:l}=a.next();if(d){o.push(null);return}o.push(l)}},this.remove(o)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,i,n){return[...this.readQuads(e,t,i,n)]}*readQuads(e,t,i,n){const o=this._getGraphs(n);let a,s,d,l;if(!(e&&!(s=this._termToNumericId(e))||t&&!(d=this._termToNumericId(t))||i&&!(l=this._termToNumericId(i))))for(const c in o)(a=o[c])&&(s?l?yield*this._findInIndex(a.objects,l,s,d,"object","subject","predicate",c):yield*this._findInIndex(a.subjects,s,d,null,"subject","predicate","object",c):d?yield*this._findInIndex(a.predicates,d,l,null,"predicate","object","subject",c):l?yield*this._findInIndex(a.objects,l,null,null,"object","subject","predicate",c):yield*this._findInIndex(a.subjects,null,null,null,"subject","predicate","object",c))}match(e,t,i,n){return new Bt(this,e,t,i,n,{entityIndex:this._entityIndex})}countQuads(e,t,i,n){const o=this._getGraphs(n);let a=0,s,d,l,c;if(e&&!(d=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||i&&!(c=this._termToNumericId(i)))return 0;for(const u in o)(s=o[u])&&(e?i?a+=this._countInIndex(s.objects,c,d,l):a+=this._countInIndex(s.subjects,d,l,c):t?a+=this._countInIndex(s.predicates,l,c,d):a+=this._countInIndex(s.objects,c,d,l));return a}forEach(e,t,i,n,o){this.some(a=>(e(a,this),!1),t,i,n,o)}every(e,t,i,n,o){return!this.some(a=>!e(a,this),t,i,n,o)}some(e,t,i,n,o){for(const a of this.readQuads(t,i,n,o))if(e(a,this))return!0;return!1}getSubjects(e,t,i){const n=[];return this.forSubjects(o=>{n.push(o)},e,t,i),n}forSubjects(e,t,i,n){const o=this._getGraphs(n);let a,s,d;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||i&&!(d=this._termToNumericId(i))))for(n in o)(a=o[n])&&(s?d?this._loopBy2Keys(a.predicates,s,d,e):this._loopByKey1(a.subjects,s,e):d?this._loopByKey0(a.objects,d,e):this._loop(a.subjects,e))}getPredicates(e,t,i){const n=[];return this.forPredicates(o=>{n.push(o)},e,t,i),n}forPredicates(e,t,i,n){const o=this._getGraphs(n);let a,s,d;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||i&&!(d=this._termToNumericId(i))))for(n in o)(a=o[n])&&(s?d?this._loopBy2Keys(a.objects,d,s,e):this._loopByKey0(a.subjects,s,e):d?this._loopByKey1(a.predicates,d,e):this._loop(a.predicates,e))}getObjects(e,t,i){const n=[];return this.forObjects(o=>{n.push(o)},e,t,i),n}forObjects(e,t,i,n){const o=this._getGraphs(n);let a,s,d;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||i&&!(d=this._termToNumericId(i))))for(n in o)(a=o[n])&&(s?d?this._loopBy2Keys(a.subjects,s,d,e):this._loopByKey1(a.objects,s,e):d?this._loopByKey0(a.predicates,d,e):this._loop(a.objects,e))}getGraphs(e,t,i){const n=[];return this.forGraphs(o=>{n.push(o)},e,t,i),n}forGraphs(e,t,i,n){for(const o in this._graphs)this.some(a=>(e(a.graph),!0),t,i,n,this._termFromId(this._entities[o]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const i={},n=t?()=>!0:(s,d)=>{throw new Error(`${s.value} ${d}`)},o=this.getQuads(null,Ke.rdf.rest,Ke.rdf.nil,null),a=e?[...o]:[];return o.forEach(s=>{const d=[];let l=!1,c,u;const v=s.graph;let g=s.subject;for(;g&&!l;){const y=this.getQuads(null,null,g,null),k=this.getQuads(g,null,null,null);let x,_=null,E=null,m=null;for(let f=0;f<k.length&&!l;f++)x=k[f],x.graph.equals(v)?c?l=n(g,"has non-list arcs out"):x.predicate.value===Ke.rdf.first?_?l=n(g,"has multiple rdf:first arcs"):a.push(_=x):x.predicate.value===Ke.rdf.rest?E?l=n(g,"has multiple rdf:rest arcs"):a.push(E=x):y.length?l=n(g,"can't be subject and object"):(c=x,u="subject"):l=n(g,"not confined to single graph");for(let f=0;f<y.length&&!l;++f)x=y[f],c?l=n(g,"can't have coreferences"):x.predicate.value===Ke.rdf.rest?m?l=n(g,"has incoming rdf:rest arcs"):m=x:(c=x,u="object");_?d.unshift(_.object):l=n(g,"has no list head"),g=m&&m.subject}l?e=!1:c&&(i[c[u].value]=d)}),e&&this.removeQuads(a),i}addAll(e){if(e instanceof Bt&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof tt&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=pi(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof Bt&&(e=e.filtered),e===this)return!0;if(!(e instanceof tt)||this._entityIndex!==e._entityIndex)return e.every(l=>this.has(l));const t=this._graphs,i=e._graphs;let n,o,a,s,d;for(const l in i){if(!(n=t[l]))return!1;n=n.subjects;for(const c in o=i[l].subjects){if(!(a=n[c]))return!1;for(const u in s=o[c]){if(!(d=a[u]))return!1;for(const v in s[u])if(!(v in d))return!1}}}return!0}deleteMatches(e,t,i,n){for(const o of this.match(e,t,i,n))this.removeQuad(o);return this}difference(e){if(e&&e instanceof Bt&&(e=e.filtered),e===this)return new tt({entityIndex:this._entityIndex});if(e instanceof tt&&e._entityIndex===this._entityIndex){const t=new tt({entityIndex:this._entityIndex}),i=dc(this._graphs,e._graphs);return i&&(t._graphs=i,t._size=null),t}return this.filter(t=>!e.has(t))}equals(e){return e instanceof Bt&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new tt({entityIndex:this._entityIndex});for(const i of this)e(i,this)&&t.add(i);return t}intersection(e){if(e instanceof Bt&&(e=e.filtered),e===this){const t=new tt({entityIndex:this._entityIndex});return t._graphs=pi(Object.create(null),this._graphs),t._size=this._size,t}else if(e instanceof tt&&this._entityIndex===e._entityIndex){const t=new tt({entityIndex:this._entityIndex}),i=lc(e._graphs,this._graphs);return i&&(t._graphs=i,t._size=null),t}return this.filter(t=>e.has(t))}map(e){const t=new tt({entityIndex:this._entityIndex});for(const i of this)t.add(e(i,this));return t}reduce(e,t){const i=this.readQuads();let n=t===void 0?i.next().value:t;for(const o of i)n=e(n,o,this);return n}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new ga().quadsToString(this)}union(e){const t=new tt({entityIndex:this._entityIndex});return t._graphs=pi(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function _t(r,e,t=0){const i=e[t];if(i&&!(i in r))return!1;let n=!1;for(const o in i?{[i]:r[i]}:r){const a=t===2?null:_t(r[o],e,t+1);a!==!1&&(n=n||Object.create(null),n[o]=a)}return n}class Bt extends xa.Readable{constructor(e,t,i,n,o,a){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:i,object:n,graph:o,options:a})}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:i,predicate:n,subject:o}=this,a=this._filtered=new tt({factory:e._factory,entityIndex:this.options.entityIndex});let s,d,l;if(o&&!(s=a._termToNumericId(o))||n&&!(d=a._termToNumericId(n))||i&&!(l=a._termToNumericId(i)))return a;const c=e._getGraphs(t);for(const u in c){let v,g,y,k;(k=c[u])&&(!s&&d?(g=_t(k.predicates,[d,l,s]))&&(v=_t(k.subjects,[s,d,l]),y=_t(k.objects,[l,s,d])):l?(y=_t(k.objects,[l,s,d]))&&(v=_t(k.subjects,[s,d,l]),g=_t(k.predicates,[d,l,s])):(v=_t(k.subjects,[s,d,l]))&&(g=_t(k.predicates,[d,l,s]),y=_t(k.objects,[l,s,d])),v&&(a._graphs[u]={subjects:v,predicates:g,objects:y}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Hn]&&(this[Hn]=this[Symbol.iterator]());const t=this[Hn];for(;--e>=0;){const{done:i,value:n}=t.next();if(i){this.push(null);return}this.push(n)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,i,n){return this.filtered.deleteMatches(e,t,i,n)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,i,n,o){return this.filtered.every(e,t,i,n,o)}filter(e){return this.filtered.filter(e)}forEach(e,t,i,n,o){return this.filtered.forEach(e,t,i,n,o)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,t,i,n,o){return this.filtered.some(e,t,i,n,o)}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 ga().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,i,n){return new Bt(this.filtered,e,t,i,n,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}class Tu extends xa.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;const t=new Yd(e);let i,n;const o={onQuad:(a,s)=>{a&&this.emit("error",a)||s&&this.push(s)},onPrefix:(a,s)=>{this.emit("prefix",a,s)}};e&&e.comments&&(o.onComment=a=>{this.emit("comment",a)}),t.parse({on:(a,s)=>{switch(a){case"data":i=s;break;case"end":n=s;break}}},o),this._transform=(a,s,d)=>{i(a),d()},this._flush=a=>{n(),a()}}import(e){return e.on("data",t=>{this.write(t)}),e.on("end",()=>{this.end()}),e.on("error",t=>{this.emit("error",t)}),this}}const _e="http://www.w3.org/ns/shacl#",Cs="http://datashapes.org/dash#",Ht="http://www.w3.org/2001/XMLSchema#",qt="http://www.w3.org/1999/02/22-rdf-syntax-ns#",_a="http://www.w3.org/2000/01/rdf-schema#",ka="http://www.w3.org/2004/02/skos/core#",Au="http://www.w3.org/2002/07/owl#",ju="http://www.w3.org/ns/oa#",Du="http://purl.org/dc/terms/",Lu="http://xmlns.com/foaf/0.1/",hi=Ie.namedNode("loaded-shapes"),kt=Ie.namedNode("loaded-data"),Ye=Ie.namedNode(qt+"type"),oa=Ie.namedNode(Du+"conformsTo"),$s=Ie.namedNode(_a+"subClassOf"),Ea=Ie.namedNode(Au+"imports"),Ou=Ie.namedNode(ka+"broader"),Cu=Ie.namedNode(ka+"narrower"),Mi=Ie.namedNode(_e+"NodeShape"),$u=Ie.namedNode(_e+"IRI"),Ki=Ie.namedNode(_e+"property"),Sa=Ie.namedNode(_e+"class"),wi=Ie.namedNode(_e+"targetClass"),Fu=Ie.namedNode(_e+"nodeKind"),Pu=Ie.namedNode(Ht+"string");function bi(r,e,t=_e,i){let n="";const o=Mu(r,e,t,i);return o&&(n=o.value),n}function Mu(r,e,t=_e,i){let n;const o=t+e;if(i?.length){for(const a of i)for(const s of r)if(s.predicate.value===o){if(s.object.id.endsWith(`@${a}`))return s.object;s.object.id.indexOf("@")<0?n=s.object:n||(n=s.object)}}else for(const a of r)if(a.predicate.value===o)return a.object;return n}function Bu(r){r.querySelector(".editor")?.focus()}function Si(r,e){return bi(r,"prefLabel",ka,e)||bi(r,"label",_a,e)||bi(r,"name",Lu,e)}function cc(r,e,t){const i=[];for(const n of r)i.push({value:n,label:Si(e.getQuads(n,null,null,null),t),children:[]});return i}function aa(r,e){for(const t in e)r=r.replace(e[t],"");return r}function uc(r,e,t,i,n=new Set){for(const o of e.owlImports)n.has(o.id)||(n.add(o.id),i.push(...t.getSubjects(Ye,r,o)));e.parent&&uc(r,e.parent,t,i,n)}function Ra(r,e){if(e.shaclIn){const t=e.config.lists[e.shaclIn];return cc(t?.length?t:[],e.config.store,e.config.languages)}else{const t=e.config.store.getSubjects(Ye,r,hi);t.push(...e.config.store.getSubjects(Ye,r,kt)),uc(r,e,e.config.store,t);const i=new Map,n=new Map;for(const a of t)i.set(a.id,{value:a,label:Si(e.config.store.getQuads(a,null,null,null),e.config.languages),children:[]});for(const a of t){for(const s of e.config.store.getObjects(a,Ou,null))i.has(s.id)&&n.set(a.id,s.id);for(const s of e.config.store.getObjects(a,Cu,null))i.has(s.id)&&n.set(s.id,a.id);for(const s of e.config.store.getObjects(a,$s,null))i.has(s.id)&&n.set(a.id,s.id)}for(const[a,s]of n.entries())i.get(s)?.children?.push(i.get(a));const o=[];for(const[a,s]of i.entries())n.has(a)||o.push(s);for(const a of e.config.store.getSubjects($s,r,null))o.push(...Ra(a,e));return o}}function sa(r){let e;try{e=new URL(r)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function Fs(r,e,t){if(e===void 0)return t;if(t===void 0)return e;const i=r.indexOf(e.language);if(i<0)return t;const n=r.indexOf(t.language);return n<0||n>i?e:t}function qu(r,{remove:e=!1,ignoreErrors:t=!1}={}){const i={},n=t?()=>!0:(s,d)=>{throw new Error(`${s.value} ${d}`)},o=r.getQuads(null,qt+"rest",qt+"nil",null),a=e?[...o]:[];return o.forEach(s=>{const d=[];let l=!1,c,u;const v=s.graph;let g=s.subject;for(;g&&!l;){const y=r.getQuads(null,null,g,null),k=r.getQuads(g,null,null,null).filter(f=>!f.predicate.equals(Ye));let x,_=null,E=null,m=null;for(let f=0;f<k.length&&!l;f++)x=k[f],x.graph.equals(v)?c?l=n(g,"has non-list arcs out"):x.predicate.value===qt+"first"?_?l=n(g,"has multiple rdf:first arcs"):a.push(_=x):x.predicate.value===qt+"rest"?E?l=n(g,"has multiple rdf:rest arcs"):a.push(E=x):y.length?l=n(g,"can't be subject and object"):(c=x,u="subject"):l=n(g,"not confined to single graph");for(let f=0;f<y.length&&!l;++f)x=y[f],c?l=n(g,"can't have coreferences"):x.predicate.value===qt+"rest"?m?l=n(g,"has incoming rdf:rest arcs"):m=x:(c=x,u="object");_?d.unshift(_.object):l=n(g,"has no list head"),g=m&&m.subject}l?e=!1:c&&(i[c[u].value]=d)}),e&&r.removeQuads(a),i}function fc(r,e,t){const i=document.createElement("div");i.classList.add("shacl-or-constraint");const n=[];if(e instanceof Gt){const o=[];let a=!1;r.length&&(a=t.store.countQuads(r[0],Ki,null,null)>0);for(let l=0;l<r.length;l++)if(a){const c=t.store.getObjects(r[l],Ki,null),u=[];let v="";for(const g of c){const y=new en(g,e,t);u.push(y),v+=(v.length>1?" / ":"")+y.template.label}o.push(u),n.push({label:v,value:l.toString()})}else{const c=new en(r[l],e,t);o.push([c]),n.push({label:c.template.label,value:l.toString()})}const s=t.theme.createListEditor("Please choose",null,!1,n),d=s.querySelector(".editor");d.onchange=()=>{if(d.value){const l=o[parseInt(d.value)];let c;l.length&&(c=l[0],i.replaceWith(l[0]));for(let u=1;u<l.length;u++)c.after(l[u]),c=l[u]}},i.appendChild(s)}else{const o=[];for(let d=0;d<r.length;d++){const l=t.store.getQuads(r[d],null,null,null);l.length&&(o.push(l),n.push({label:Si(l,t.languages)||aa(l[0].predicate.value,t.prefixes)+" = "+aa(l[0].object.value,t.prefixes),value:d.toString()}))}const a=t.theme.createListEditor(e.template.label+"?",null,!1,n,e.template),s=a.querySelector(".editor");s.onchange=()=>{s.value&&i.replaceWith(Wi(e.template.clone().merge(o[parseInt(s.value)]),void 0,!0))},i.appendChild(a)}return i}function zu(r,e,t){if(e instanceof dt){const i=e.datatype;for(const n of r){const o=t.store.getQuads(n,null,null,null);for(const a of o)if(a.predicate.value===`${_e}datatype`&&a.object.equals(i))return o}}else{const i=t.store.getObjects(e,Ye,null);for(const n of r){const o=t.store.getQuads(n,null,null,null);for(const a of o)if(i.length>0){if(a.predicate.value===`${_e}node`){for(const s of i)if(t.store.getQuads(a.object,wi,s,null).length>0)return o}if(a.predicate.equals(Sa)){for(const s of i)if(a.object.equals(s))return o}}else if(a.predicate.equals(Fu)&&a.object.equals($u))return o}}return console.error("couldn't resolve sh:or/sh:xone on property for value",e),[]}function Uu(r,e,t){for(const i of r){let n=!1;const o=t.store.getObjects(i,Ki,null);for(const a of o){const s=t.store.getObjects(a,`${_e}path`,null);for(const d of s)if(n=t.store.countQuads(e,d,null,null)>0,n)break}if(n)return o}return console.error("couldn't resolve sh:or/sh:xone on node for value",e),[]}const Hu={[`${_e}name`]:(r,e)=>{const t=e;r.name=Fs(r.config.languages,r.name,t)},[`${_e}description`]:(r,e)=>{const t=e;r.description=Fs(r.config.languages,r.description,t)},[`${_e}path`]:(r,e)=>{r.path=e.value},[`${_e}node`]:(r,e)=>{r.node=e},[`${_e}datatype`]:(r,e)=>{r.datatype=e},[`${_e}nodeKind`]:(r,e)=>{r.nodeKind=e},[`${_e}minCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${_e}maxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[`${_e}minLength`]:(r,e)=>{r.minLength=parseInt(e.value)},[`${_e}maxLength`]:(r,e)=>{r.maxLength=parseInt(e.value)},[`${_e}minInclusive`]:(r,e)=>{r.minInclusive=parseInt(e.value)},[`${_e}maxInclusive`]:(r,e)=>{r.maxInclusive=parseInt(e.value)},[`${_e}minExclusive`]:(r,e)=>{r.minExclusive=parseInt(e.value)},[`${_e}maxExclusive`]:(r,e)=>{r.maxExclusive=parseInt(e.value)},[`${_e}pattern`]:(r,e)=>{r.pattern=e.value},[`${_e}order`]:(r,e)=>{r.order=parseInt(e.value)},[`${Cs}singleLine`]:(r,e)=>{r.singleLine=e.value==="true"},[`${Cs}readonly`]:(r,e)=>{r.readonly=e.value==="true"},[`${ju}styleClass`]:(r,e)=>{r.cssClass=e.value},[`${_e}and`]:(r,e)=>{r.shaclAnd=e.value},[`${_e}in`]:(r,e)=>{r.shaclIn=e.value},[`${_e}languageIn`]:(r,e)=>{r.languageIn=r.config.lists[e.value],r.datatype=Ie.namedNode(qt+"langString")},[`${_e}defaultValue`]:(r,e)=>{r.defaultValue=e},[`${_e}hasValue`]:(r,e)=>{r.hasValue=e},[`${_e}qualifiedValueShape`]:(r,e)=>{r.qualifiedValueShape=e},[`${_e}qualifiedMinCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${_e}qualifiedMaxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[Ea.id]:(r,e)=>{r.owlImports.push(e)},[Sa.id]:(r,e)=>{r.class=e;const t=r.config.store.getSubjects(wi,e,null);t.length>0&&(r.node=t[0])},[`${_e}or`]:(r,e)=>{const t=r.config.lists[e.value];t?.length?r.shaclOr=t:console.error("list for sh:or not found:",e.value,"existing lists:",r.config.lists)},[`${_e}xone`]:(r,e)=>{const t=r.config.lists[e.value];t?.length?r.shaclXone=t:console.error("list for sh:xone not found:",e.value,"existing lists:",r.config.lists)}};class Gu{constructor(e,t,i){this.label="",this.owlImports=[],this.extendedShapes=[],this.parent=t,this.config=i,this.merge(e),this.qualifiedValueShape&&this.merge(i.store.getQuads(this.qualifiedValueShape,null,null,null))}merge(e){for(const t of e)Hu[t.predicate.id]?.call(this,this,t.object);if(this.label=this.name?.value||Si(e,this.config.languages),!this.label&&!this.shaclAnd&&(this.label=this.path?aa(this.path,this.config.prefixes):"unknown"),(this.node||this.shaclAnd)&&(this.node&&this.extendedShapes.push(this.node),this.shaclAnd)){const t=this.config.lists[this.shaclAnd];if(t?.length)for(const i of t)this.extendedShapes.push(i)}return this}clone(){const e=Object.assign({},this);return e.extendedShapes=[...this.extendedShapes],e.owlImports=[...this.owlImports],this.languageIn&&(e.languageIn=[...this.languageIn]),this.shaclOr&&(e.shaclOr=[...this.shaclOr]),this.shaclXone&&(e.shaclXone=[...this.shaclXone]),e.merge=this.merge.bind(e),e.clone=this.clone.bind(e),e}}const Vu=`form { display:block; --label-width: 8em; --caret-size: 10px; }
|
|
28
28
|
form.mode-edit { padding-left: 1em; }
|
|
29
29
|
form, form * { box-sizing: border-box; }
|
|
30
30
|
shacl-node, .collapsible::part(content) { display: flex; flex-direction: column; width: 100%; position: relative; }
|
|
@@ -73,11 +73,11 @@ a, a:visited { color: inherit; }
|
|
|
73
73
|
.ref-link { cursor: pointer; }
|
|
74
74
|
.ref-link:hover { text-decoration: underline; }
|
|
75
75
|
.node-id-display { color: #999; font-size: 11px; }`;class Wu{constructor(e){let t=Vu;e&&(t+=`
|
|
76
|
-
`+e),this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t)}apply(e){}createViewer(e,t,i){const n=document.createElement("div"),o=document.createElement("label");o.innerHTML=e+":",i.description&&o.setAttribute("title",i.description.value),n.appendChild(o);let a=t.value,s=null;if(t instanceof nn){const l=i.config.store.getQuads(a,null,null,null);if(l.length){const c=Si(l,i.config.languages);c&&(a=c)}}else t instanceof dt&&(t.language?(s=document.createElement("span"),s.classList.add("lang"),s.innerText=`@${t.language}`):t.datatype.value===`${Ht}date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`${Ht}dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let d;return sa(t.value)?(d=document.createElement("a"),d.setAttribute("href",t.value)):d=document.createElement("div"),d.classList.add("d-flex"),d.innerText=a,s&&d.appendChild(s),n.appendChild(d),n}}function Xu(r,e,t){if(t){const i=r.minCount!==void 0&&r.minCount>0;if(r.class)return r.config.theme.createListEditor(r.label,e,i,Ra(r.class,r),r);if(r.shaclIn){const n=r.config.lists[r.shaclIn];if(n?.length){const o=cc(n,r.config.store,r.config.languages);return r.config.theme.createListEditor(r.label,e,i,o,r)}else console.error("list not found:",r.shaclIn,"existing lists:",r.config.lists)}if(r.datatype?.value===`${qt}langString`||r.languageIn?.length)return r.config.theme.createLangStringEditor(r.label,e,i,r);switch(r.datatype?.value.replace(Ht,"")){case"integer":case"float":case"double":case"decimal":return r.config.theme.createNumberEditor(r.label,e,i,r);case"date":case"dateTime":return r.config.theme.createDateEditor(r.label,e,i,r);case"boolean":return r.config.theme.createBooleanEditor(r.label,e,i,r);case"base64Binary":return r.config.theme.createFileEditor(r.label,e,i,r)}return r.config.theme.createTextEditor(r.label,e,i,r)}else{if(e)return r.config.theme.createViewer(r.label,e,r);const i=document.createElement("div");return i.innerHTML="No value",i}}function Qu(r,e,t){if(e==="application/ld+json")return Ju(r);{const i=new ga({format:e,prefixes:t});i.addQuads(r);let n="";return i.end((o,a)=>{o&&console.error(o),n=a}),n}}function Ju(r){const e=[];for(const t of r){const i={"@id":t.subject.id};if(t.predicate===Ye)i["@type"]=t.object.id;else{let n=t.object.value;t.object instanceof dt?t.object.language?n={"@language":t.object.language,"@value":t.object.value}:t.object.datatype&&t.object.datatype.value!==`${Ht}#string`&&(n={"@type":t.object.datatype.value,"@value":t.object.value}):n={"@id":t.object.id},i[t.predicate.value]=n}e.push(i)}return JSON.stringify(e)}function Ku(r){let e=r.shaclDatatype,t=r.value;if(t){if(r.dataset.class||r.dataset.nodeKind===_e+"IRI")return
|
|
76
|
+
`+e),this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t)}apply(e){}createViewer(e,t,i){const n=document.createElement("div"),o=document.createElement("label");o.innerHTML=e+":",i.description&&o.setAttribute("title",i.description.value),n.appendChild(o);let a=t.value,s=null;if(t instanceof nn){const l=i.config.store.getQuads(a,null,null,null);if(l.length){const c=Si(l,i.config.languages);c&&(a=c)}}else t instanceof dt&&(t.language?(s=document.createElement("span"),s.classList.add("lang"),s.innerText=`@${t.language}`):t.datatype.value===`${Ht}date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`${Ht}dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let d;return sa(t.value)?(d=document.createElement("a"),d.setAttribute("href",t.value)):d=document.createElement("div"),d.classList.add("d-flex"),d.innerText=a,s&&d.appendChild(s),n.appendChild(d),n}}function Xu(r,e,t){if(t){const i=r.minCount!==void 0&&r.minCount>0;if(r.class)return r.config.theme.createListEditor(r.label,e,i,Ra(r.class,r),r);if(r.shaclIn){const n=r.config.lists[r.shaclIn];if(n?.length){const o=cc(n,r.config.store,r.config.languages);return r.config.theme.createListEditor(r.label,e,i,o,r)}else console.error("list not found:",r.shaclIn,"existing lists:",r.config.lists)}if(r.datatype?.value===`${qt}langString`||r.languageIn?.length)return r.config.theme.createLangStringEditor(r.label,e,i,r);switch(r.datatype?.value.replace(Ht,"")){case"integer":case"float":case"double":case"decimal":return r.config.theme.createNumberEditor(r.label,e,i,r);case"date":case"dateTime":return r.config.theme.createDateEditor(r.label,e,i,r);case"boolean":return r.config.theme.createBooleanEditor(r.label,e,i,r);case"base64Binary":return r.config.theme.createFileEditor(r.label,e,i,r)}return r.config.theme.createTextEditor(r.label,e,i,r)}else{if(e)return r.config.theme.createViewer(r.label,e,r);const i=document.createElement("div");return i.innerHTML="No value",i}}function Qu(r,e,t){if(e==="application/ld+json")return Ju(r);{const i=new ga({format:e,prefixes:t});i.addQuads(r);let n="";return i.end((o,a)=>{o&&console.error(o),n=a}),n}}function Ju(r){const e=[];for(const t of r){const i={"@id":t.subject.id};if(t.predicate===Ye)i["@type"]=t.object.id;else{let n=t.object.value;t.object instanceof dt?t.object.language?n={"@language":t.object.language,"@value":t.object.value}:t.object.datatype&&t.object.datatype.value!==`${Ht}#string`&&(n={"@type":t.object.datatype.value,"@value":t.object.value}):n={"@id":t.object.id},i[t.predicate.value]=n}e.push(i)}return JSON.stringify(e)}function Ku(r){let e=r.shaclDatatype,t=r.value;if(t){if(r.dataset.class||r.dataset.nodeKind===_e+"IRI")return Ie.namedNode(t);if(r.dataset.link)return JSON.parse(r.dataset.link);if(r.dataset.lang?e=r.dataset.lang:r.type==="number"?t=parseFloat(t):r.type==="file"&&r.binaryData?t=r.binaryData:r.type==="datetime-local"&&(t=new Date(t).toISOString().slice(0,19)),!e&&typeof t=="string"){const i=t.split("^^");i.length===2&&(i[0].startsWith('"')&&i[0].endsWith('"')||i[0].startsWith("'")&&i[0].endsWith("'"))&&i[1].split(":").length===2&&(t=i[0].substring(1,i[0].length-1),e=Ie.namedNode(i[1]))}return Ie.literal(t,e)}else if((r.type==="checkbox"||r.getAttribute("type")==="checkbox")&&(r.checked||parseInt(r.dataset.minCount||"0")>0))return Ie.literal(r.checked?"true":"false",e)}const mi={};function Yu(r){r.predicate===void 0&&r.datatype===void 0?console.warn('not registering plugin because it does neither define "predicate" nor "datatype"',r):mi[`${r.predicate}^${r.datatype}`]=r}function Zu(){return Object.entries(mi).map(r=>r[1])}function ef(r,e){let t=mi[`${r}^${e}`];return t||(t=mi[`${r}^undefined`],t)?t:mi[`undefined^${e}`]}class mg{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)}}/**
|
|
77
77
|
* @license
|
|
78
78
|
* Copyright 2019 Google LLC
|
|
79
79
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
80
|
-
*/const Hi=globalThis,
|
|
80
|
+
*/const Hi=globalThis,Ia=Hi.ShadowRoot&&(Hi.ShadyCSS===void 0||Hi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Na=Symbol(),Ps=new WeakMap;let pc=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==Na)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Ia&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=Ps.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Ps.set(t,e))}return e}toString(){return this.cssText}};const tf=r=>new pc(typeof r=="string"?r:r+"",void 0,Na),Ot=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((i,n,o)=>i+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+r[o+1],r[0]);return new pc(t,r,Na)},rf=(r,e)=>{if(Ia)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),n=Hi.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=t.cssText,r.appendChild(i)}},Ms=Ia?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return tf(t)})(r):r;/**
|
|
81
81
|
* @license
|
|
82
82
|
* Copyright 2017 Google LLC
|
|
83
83
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -87,11 +87,11 @@ a, a:visited { color: inherit; }
|
|
|
87
87
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
88
88
|
*/const Ta=globalThis,Yi=Ta.trustedTypes,zs=Yi?Yi.createPolicy("lit-html",{createHTML:r=>r}):void 0,bc="$lit$",zt=`lit$${Math.random().toFixed(9).slice(2)}$`,mc="?"+zt,ff=`<${mc}>`,sr=document,xi=()=>sr.createComment(""),_i=r=>r===null||typeof r!="object"&&typeof r!="function",Aa=Array.isArray,pf=r=>Aa(r)||typeof r?.[Symbol.iterator]=="function",Gn=`[
|
|
89
89
|
\f\r]`,Wr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Us=/-->/g,Hs=/>/g,Qt=RegExp(`>|${Gn}(?:([^\\s"'>=/]+)(${Gn}*=${Gn}*(?:[^
|
|
90
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Gs=/'/g,Vs=/"/g,gc=/^(?:script|style|textarea|title)$/i,hf=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),Et=hf(1),Sr=Symbol.for("lit-noChange"),He=Symbol.for("lit-nothing"),Ws=new WeakMap,or=sr.createTreeWalker(sr,129);function vc(r,e){if(!Aa(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return zs!==void 0?zs.createHTML(e):e}const bf=(r,e)=>{const t=r.length-1,i=[];let n,o=e===2?"<svg>":e===3?"<math>":"",a=Wr;for(let s=0;s<t;s++){const d=r[s];let l,c,u=-1,v=0;for(;v<d.length&&(a.lastIndex=v,c=a.exec(d),c!==null);)v=a.lastIndex,a===Wr?c[1]==="!--"?a=Us:c[1]!==void 0?a=Hs:c[2]!==void 0?(gc.test(c[2])&&(n=RegExp("</"+c[2],"g")),a=Qt):c[3]!==void 0&&(a=Qt):a===Qt?c[0]===">"?(a=n??Wr,u=-1):c[1]===void 0?u=-2:(u=a.lastIndex-c[2].length,l=c[1],a=c[3]===void 0?Qt:c[3]==='"'?Vs:Gs):a===Vs||a===Gs?a=Qt:a===Us||a===Hs?a=Wr:(a=Qt,n=void 0);const g=a===Qt&&r[s+1].startsWith("/>")?" ":"";o+=a===Wr?d+ff:u>=0?(i.push(l),d.slice(0,u)+bc+d.slice(u)+zt+g):d+zt+(u===-2?s:g)}return[vc(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};let da=class yc{constructor({strings:e,_$litType$:t},i){let n;this.parts=[];let o=0,a=0;const s=e.length-1,d=this.parts,[l,c]=bf(e,t);if(this.el=yc.createElement(l,i),or.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(n=or.nextNode())!==null&&d.length<s;){if(n.nodeType===1){if(n.hasAttributes())for(const u of n.getAttributeNames())if(u.endsWith(bc)){const v=c[a++],g=n.getAttribute(u).split(zt),y=/([.?@])?(.*)/.exec(v);d.push({type:1,index:o,name:y[2],strings:g,ctor:y[1]==="."?gf:y[1]==="?"?vf:y[1]==="@"?yf:un}),n.removeAttribute(u)}else u.startsWith(zt)&&(d.push({type:6,index:o}),n.removeAttribute(u));if(gc.test(n.tagName)){const u=n.textContent.split(zt),v=u.length-1;if(v>0){n.textContent=Yi?Yi.emptyScript:"";for(let g=0;g<v;g++)n.append(u[g],xi()),or.nextNode(),d.push({type:2,index:++o});n.append(u[v],xi())}}}else if(n.nodeType===8)if(n.data===mc)d.push({type:2,index:o});else{let u=-1;for(;(u=n.data.indexOf(zt,u+1))!==-1;)d.push({type:7,index:o}),u+=zt.length-1}o++}}static createElement(e,t){const i=sr.createElement("template");return i.innerHTML=e,i}};function Rr(r,e,t=r,i){if(e===Sr)return e;let n=i!==void 0?t._$Co?.[i]:t._$Cl;const o=_i(e)?void 0:e._$litDirective$;return n?.constructor!==o&&(n?._$AO?.(!1),o===void 0?n=void 0:(n=new o(r),n._$AT(r,t,i)),i!==void 0?(t._$Co??=[])[i]=n:t._$Cl=n),n!==void 0&&(e=Rr(r,n._$AS(r,e.values),n,i)),e}
|
|
90
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Gs=/'/g,Vs=/"/g,gc=/^(?:script|style|textarea|title)$/i,hf=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),Et=hf(1),Sr=Symbol.for("lit-noChange"),He=Symbol.for("lit-nothing"),Ws=new WeakMap,or=sr.createTreeWalker(sr,129);function vc(r,e){if(!Aa(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return zs!==void 0?zs.createHTML(e):e}const bf=(r,e)=>{const t=r.length-1,i=[];let n,o=e===2?"<svg>":e===3?"<math>":"",a=Wr;for(let s=0;s<t;s++){const d=r[s];let l,c,u=-1,v=0;for(;v<d.length&&(a.lastIndex=v,c=a.exec(d),c!==null);)v=a.lastIndex,a===Wr?c[1]==="!--"?a=Us:c[1]!==void 0?a=Hs:c[2]!==void 0?(gc.test(c[2])&&(n=RegExp("</"+c[2],"g")),a=Qt):c[3]!==void 0&&(a=Qt):a===Qt?c[0]===">"?(a=n??Wr,u=-1):c[1]===void 0?u=-2:(u=a.lastIndex-c[2].length,l=c[1],a=c[3]===void 0?Qt:c[3]==='"'?Vs:Gs):a===Vs||a===Gs?a=Qt:a===Us||a===Hs?a=Wr:(a=Qt,n=void 0);const g=a===Qt&&r[s+1].startsWith("/>")?" ":"";o+=a===Wr?d+ff:u>=0?(i.push(l),d.slice(0,u)+bc+d.slice(u)+zt+g):d+zt+(u===-2?s:g)}return[vc(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};let da=class yc{constructor({strings:e,_$litType$:t},i){let n;this.parts=[];let o=0,a=0;const s=e.length-1,d=this.parts,[l,c]=bf(e,t);if(this.el=yc.createElement(l,i),or.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(n=or.nextNode())!==null&&d.length<s;){if(n.nodeType===1){if(n.hasAttributes())for(const u of n.getAttributeNames())if(u.endsWith(bc)){const v=c[a++],g=n.getAttribute(u).split(zt),y=/([.?@])?(.*)/.exec(v);d.push({type:1,index:o,name:y[2],strings:g,ctor:y[1]==="."?gf:y[1]==="?"?vf:y[1]==="@"?yf:un}),n.removeAttribute(u)}else u.startsWith(zt)&&(d.push({type:6,index:o}),n.removeAttribute(u));if(gc.test(n.tagName)){const u=n.textContent.split(zt),v=u.length-1;if(v>0){n.textContent=Yi?Yi.emptyScript:"";for(let g=0;g<v;g++)n.append(u[g],xi()),or.nextNode(),d.push({type:2,index:++o});n.append(u[v],xi())}}}else if(n.nodeType===8)if(n.data===mc)d.push({type:2,index:o});else{let u=-1;for(;(u=n.data.indexOf(zt,u+1))!==-1;)d.push({type:7,index:o}),u+=zt.length-1}o++}}static createElement(e,t){const i=sr.createElement("template");return i.innerHTML=e,i}};function Rr(r,e,t=r,i){if(e===Sr)return e;let n=i!==void 0?t._$Co?.[i]:t._$Cl;const o=_i(e)?void 0:e._$litDirective$;return n?.constructor!==o&&(n?._$AO?.(!1),o===void 0?n=void 0:(n=new o(r),n._$AT(r,t,i)),i!==void 0?(t._$Co??=[])[i]=n:t._$Cl=n),n!==void 0&&(e=Rr(r,n._$AS(r,e.values),n,i)),e}class mf{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,n=(e?.creationScope??sr).importNode(t,!0);or.currentNode=n;let o=or.nextNode(),a=0,s=0,d=i[0];for(;d!==void 0;){if(a===d.index){let l;d.type===2?l=new ja(o,o.nextSibling,this,e):d.type===1?l=new d.ctor(o,d.name,d.strings,this,e):d.type===6&&(l=new wf(o,this,e)),this._$AV.push(l),d=i[++s]}a!==d?.index&&(o=or.nextNode(),a++)}return or.currentNode=sr,n}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}let ja=class wc{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,n){this.type=2,this._$AH=He,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Rr(this,e,t),_i(e)?e===He||e==null||e===""?(this._$AH!==He&&this._$AR(),this._$AH=He):e!==this._$AH&&e!==Sr&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):pf(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==He&&_i(this._$AH)?this._$AA.nextSibling.data=e:this.T(sr.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,n=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=da.createElement(vc(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===n)this._$AH.p(t);else{const o=new mf(n,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Ws.get(e.strings);return t===void 0&&Ws.set(e.strings,t=new da(e)),t}k(e){Aa(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,n=0;for(const o of e)n===t.length?t.push(i=new wc(this.O(xi()),this.O(xi()),this,this.options)):i=t[n],i._$AI(o),n++;n<t.length&&(this._$AR(i&&i._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},un=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,n,o){this.type=1,this._$AH=He,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=He}_$AI(e,t=this,i,n){const o=this.strings;let a=!1;if(o===void 0)e=Rr(this,e,t,0),a=!_i(e)||e!==this._$AH&&e!==Sr,a&&(this._$AH=e);else{const s=e;let d,l;for(e=o[0],d=0;d<o.length-1;d++)l=Rr(this,s[i+d],t,d),l===Sr&&(l=this._$AH[d]),a||=!_i(l)||l!==this._$AH[d],l===He?e=He:e!==He&&(e+=(l??"")+o[d+1]),this._$AH[d]=l}a&&!n&&this.j(e)}j(e){e===He?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},gf=class extends un{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===He?void 0:e}},vf=class extends un{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==He)}},yf=class extends un{constructor(e,t,i,n,o){super(e,t,i,n,o),this.type=5}_$AI(e,t=this){if((e=Rr(this,e,t,0)??He)===Sr)return;const i=this._$AH,n=e===He&&i!==He||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==He&&(i===He||n);n&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},wf=class{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Rr(this,e)}};const xf=Ta.litHtmlPolyfillSupport;xf?.(da,ja),(Ta.litHtmlVersions??=[]).push("3.3.1");const _f=(r,e,t)=>{const i=t?.renderBefore??e;let n=i._$litPart$;if(n===void 0){const o=t?.renderBefore??null;i._$litPart$=n=new ja(e.insertBefore(xi(),o),o,void 0,t??{})}return n._$AI(r),n};/**
|
|
91
91
|
* @license
|
|
92
92
|
* Copyright 2017 Google LLC
|
|
93
93
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
94
|
-
*/const Da=globalThis;class ar extends wr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=_f(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Sr}}ar._$litElement$=!0,ar.finalized=!0,Da.litElementHydrateSupport?.({LitElement:ar});const kf=Da.litElementPolyfillSupport;kf?.({LitElement:ar});(Da.litElementVersions??=[]).push("4.2.1");var xc=r=>{throw TypeError(r)},_c=(r,e,t)=>e.has(r)||xc("Cannot "+t),Mt=(r,e,t)=>(_c(r,e,"read from private field"),t?t.call(r):e.get(r)),Ef=(r,e,t)=>e.has(r)?xc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Sf=(r,e,t,i)=>(_c(r,e,"write to private field"),e.set(r,t),t);const fr=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)},Gi=globalThis,La=Gi.ShadowRoot&&(Gi.ShadyCSS===void 0||Gi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,kc=Symbol(),Xs=new WeakMap;let Rf=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==kc)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o;const e=this.t;if(La&&r===void 0){const t=e!==void 0&&e.length===1;t&&(r=Xs.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Xs.set(e,r))}return r}toString(){return this.cssText}};const Nf=r=>new Rf(typeof r=="string"?r:r+"",void 0,kc),If=(r,e)=>{if(La)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),n=Gi.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=t.cssText,r.appendChild(i)}},Qs=La?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return Nf(t)})(r):r,{is:Tf,defineProperty:Af,getOwnPropertyDescriptor:jf,getOwnPropertyNames:Df,getOwnPropertySymbols:Lf,getPrototypeOf:Of}=Object,Nr=globalThis,Js=Nr.trustedTypes,Cf=Js?Js.emptyScript:"",Ks=Nr.reactiveElementPolyfillSupport,vi=(r,e)=>r,Zi={toAttribute(r,e){switch(e){case Boolean:r=r?Cf:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Oa=(r,e)=>!Tf(r,e),Ys={attribute:!0,type:String,converter:Zi,reflect:!1,useDefault:!1,hasChanged:Oa};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Nr.litPropertyMetadata??(Nr.litPropertyMetadata=new WeakMap);class Xr extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ys){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),n=this.getPropertyDescriptor(e,i,t);n!==void 0&&Af(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){const{get:n,set:o}=jf(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:n,set(a){const s=n?.call(this);o?.call(this,a),this.requestUpdate(e,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ys}static _$Ei(){if(this.hasOwnProperty(vi("elementProperties")))return;const e=Of(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(vi("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(vi("properties"))){const t=this.properties,i=[...Df(t),...Lf(t)];for(const n of i)this.createProperty(n,t[n])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,n]of t)this.elementProperties.set(i,n)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const n=this._$Eu(t,i);n!==void 0&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const n of i)t.unshift(Qs(n))}else e!==void 0&&t.push(Qs(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return If(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){var i;const n=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,n);if(o!==void 0&&n.reflect===!0){const a=(((i=n.converter)==null?void 0:i.toAttribute)!==void 0?n.converter:Zi).toAttribute(t,n.type);this._$Em=e,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$Em=null}}_$AK(e,t){var i,n;const o=this.constructor,a=o._$Eh.get(e);if(a!==void 0&&this._$Em!==a){const s=o.getPropertyOptions(a),d=typeof s.converter=="function"?{fromAttribute:s.converter}:((i=s.converter)==null?void 0:i.fromAttribute)!==void 0?s.converter:Zi;this._$Em=a,this[a]=d.fromAttribute(t,s.type)??((n=this._$Ej)==null?void 0:n.get(a))??null,this._$Em=null}}requestUpdate(e,t,i){var n;if(e!==void 0){const o=this.constructor,a=this[e];if(i??(i=o.getPropertyOptions(e)),!((i.hasChanged??Oa)(a,t)||i.useDefault&&i.reflect&&a===((n=this._$Ej)==null?void 0:n.get(e))&&!this.hasAttribute(o._$Eu(e,i))))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:n,wrapped:o},a){i&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,a??t??this[e]),o!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),n===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[o,a]of n){const{wrapped:s}=a,d=this[o];s!==!0||this._$AL.has(o)||d===void 0||this.C(o,void 0,a,d)}}let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(e=this._$EO)==null||e.forEach(n=>{var o;return(o=n.hostUpdate)==null?void 0:o.call(n)}),this.update(i)):this._$EM()}catch(n){throw t=!1,this._$EM(),n}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(i=>{var n;return(n=i.hostUpdated)==null?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}}Xr.elementStyles=[],Xr.shadowRootOptions={mode:"open"},Xr[vi("elementProperties")]=new Map,Xr[vi("finalized")]=new Map,Ks?.({ReactiveElement:Xr}),(Nr.reactiveElementVersions??(Nr.reactiveElementVersions=[])).push("2.1.0");const $f={attribute:!0,type:String,converter:Zi,reflect:!1,hasChanged:Oa},Ff=(r=$f,e,t)=>{const{kind:i,metadata:n}=t;let o=globalThis.litPropertyMetadata.get(n);if(o===void 0&&globalThis.litPropertyMetadata.set(n,o=new Map),i==="setter"&&((r=Object.create(r)).wrapped=!0),o.set(t.name,r),i==="accessor"){const{name:a}=t;return{set(s){const d=e.get.call(this);e.set.call(this,s),this.requestUpdate(a,d,r)},init(s){return s!==void 0&&this.C(a,void 0,r,s),s}}}if(i==="setter"){const{name:a}=t;return function(s){const d=this[a];e.call(this,s),this.requestUpdate(a,d,r)}}throw Error("Unsupported decorator location: "+i)};function Se(r){return(e,t)=>typeof t=="object"?Ff(r,e,t):((i,n,o)=>{const a=n.hasOwnProperty(o);return n.constructor.createProperty(o,i),a?Object.getOwnPropertyDescriptor(n,o):void 0})(r,e,t)}function Ca(r){return Se({...r,state:!0,attribute:!1})}const Pf=(r,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(r,e,t),t);function yt(r,e){return(t,i,n)=>{const o=a=>{var s;return((s=a.renderRoot)==null?void 0:s.querySelector(r))??null};return Pf(t,i,{get(){return o(this)}})}}var Mf=Object.defineProperty,Wt=(r,e,t,i)=>{for(var n=void 0,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=a(e,t,n)||n);return n&&Mf(e,t,n),n};const ca=class extends ar{constructor(){super(...arguments),this.dense=!1}};ca.shadowRootOptions={...ar.shadowRootOptions,delegatesFocus:!0},ca.styles=[Ot`
|
|
94
|
+
*/const Da=globalThis;class ar extends wr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=_f(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Sr}}ar._$litElement$=!0,ar.finalized=!0,Da.litElementHydrateSupport?.({LitElement:ar});const kf=Da.litElementPolyfillSupport;kf?.({LitElement:ar});(Da.litElementVersions??=[]).push("4.2.1");var xc=r=>{throw TypeError(r)},_c=(r,e,t)=>e.has(r)||xc("Cannot "+t),Mt=(r,e,t)=>(_c(r,e,"read from private field"),t?t.call(r):e.get(r)),Ef=(r,e,t)=>e.has(r)?xc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Sf=(r,e,t,i)=>(_c(r,e,"write to private field"),e.set(r,t),t);const fr=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)},Gi=globalThis,La=Gi.ShadowRoot&&(Gi.ShadyCSS===void 0||Gi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,kc=Symbol(),Xs=new WeakMap;let Rf=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==kc)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o;const e=this.t;if(La&&r===void 0){const t=e!==void 0&&e.length===1;t&&(r=Xs.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Xs.set(e,r))}return r}toString(){return this.cssText}};const If=r=>new Rf(typeof r=="string"?r:r+"",void 0,kc),Nf=(r,e)=>{if(La)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),n=Gi.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=t.cssText,r.appendChild(i)}},Qs=La?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return If(t)})(r):r,{is:Tf,defineProperty:Af,getOwnPropertyDescriptor:jf,getOwnPropertyNames:Df,getOwnPropertySymbols:Lf,getPrototypeOf:Of}=Object,Ir=globalThis,Js=Ir.trustedTypes,Cf=Js?Js.emptyScript:"",Ks=Ir.reactiveElementPolyfillSupport,vi=(r,e)=>r,Zi={toAttribute(r,e){switch(e){case Boolean:r=r?Cf:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Oa=(r,e)=>!Tf(r,e),Ys={attribute:!0,type:String,converter:Zi,reflect:!1,useDefault:!1,hasChanged:Oa};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Ir.litPropertyMetadata??(Ir.litPropertyMetadata=new WeakMap);class Xr extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ys){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),n=this.getPropertyDescriptor(e,i,t);n!==void 0&&Af(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){const{get:n,set:o}=jf(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:n,set(a){const s=n?.call(this);o?.call(this,a),this.requestUpdate(e,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ys}static _$Ei(){if(this.hasOwnProperty(vi("elementProperties")))return;const e=Of(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(vi("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(vi("properties"))){const t=this.properties,i=[...Df(t),...Lf(t)];for(const n of i)this.createProperty(n,t[n])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,n]of t)this.elementProperties.set(i,n)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const n=this._$Eu(t,i);n!==void 0&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const n of i)t.unshift(Qs(n))}else e!==void 0&&t.push(Qs(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Nf(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){var i;const n=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,n);if(o!==void 0&&n.reflect===!0){const a=(((i=n.converter)==null?void 0:i.toAttribute)!==void 0?n.converter:Zi).toAttribute(t,n.type);this._$Em=e,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$Em=null}}_$AK(e,t){var i,n;const o=this.constructor,a=o._$Eh.get(e);if(a!==void 0&&this._$Em!==a){const s=o.getPropertyOptions(a),d=typeof s.converter=="function"?{fromAttribute:s.converter}:((i=s.converter)==null?void 0:i.fromAttribute)!==void 0?s.converter:Zi;this._$Em=a,this[a]=d.fromAttribute(t,s.type)??((n=this._$Ej)==null?void 0:n.get(a))??null,this._$Em=null}}requestUpdate(e,t,i){var n;if(e!==void 0){const o=this.constructor,a=this[e];if(i??(i=o.getPropertyOptions(e)),!((i.hasChanged??Oa)(a,t)||i.useDefault&&i.reflect&&a===((n=this._$Ej)==null?void 0:n.get(e))&&!this.hasAttribute(o._$Eu(e,i))))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:n,wrapped:o},a){i&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,a??t??this[e]),o!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),n===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[o,a]of n){const{wrapped:s}=a,d=this[o];s!==!0||this._$AL.has(o)||d===void 0||this.C(o,void 0,a,d)}}let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(e=this._$EO)==null||e.forEach(n=>{var o;return(o=n.hostUpdate)==null?void 0:o.call(n)}),this.update(i)):this._$EM()}catch(n){throw t=!1,this._$EM(),n}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(i=>{var n;return(n=i.hostUpdated)==null?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}}Xr.elementStyles=[],Xr.shadowRootOptions={mode:"open"},Xr[vi("elementProperties")]=new Map,Xr[vi("finalized")]=new Map,Ks?.({ReactiveElement:Xr}),(Ir.reactiveElementVersions??(Ir.reactiveElementVersions=[])).push("2.1.0");const $f={attribute:!0,type:String,converter:Zi,reflect:!1,hasChanged:Oa},Ff=(r=$f,e,t)=>{const{kind:i,metadata:n}=t;let o=globalThis.litPropertyMetadata.get(n);if(o===void 0&&globalThis.litPropertyMetadata.set(n,o=new Map),i==="setter"&&((r=Object.create(r)).wrapped=!0),o.set(t.name,r),i==="accessor"){const{name:a}=t;return{set(s){const d=e.get.call(this);e.set.call(this,s),this.requestUpdate(a,d,r)},init(s){return s!==void 0&&this.C(a,void 0,r,s),s}}}if(i==="setter"){const{name:a}=t;return function(s){const d=this[a];e.call(this,s),this.requestUpdate(a,d,r)}}throw Error("Unsupported decorator location: "+i)};function Se(r){return(e,t)=>typeof t=="object"?Ff(r,e,t):((i,n,o)=>{const a=n.hasOwnProperty(o);return n.constructor.createProperty(o,i),a?Object.getOwnPropertyDescriptor(n,o):void 0})(r,e,t)}function Ca(r){return Se({...r,state:!0,attribute:!1})}const Pf=(r,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(r,e,t),t);function yt(r,e){return(t,i,n)=>{const o=a=>{var s;return((s=a.renderRoot)==null?void 0:s.querySelector(r))??null};return Pf(t,i,{get(){return o(this)}})}}var Mf=Object.defineProperty,Wt=(r,e,t,i)=>{for(var n=void 0,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=a(e,t,n)||n);return n&&Mf(e,t,n),n};const ca=class extends ar{constructor(){super(...arguments),this.dense=!1}};ca.shadowRootOptions={...ar.shadowRootOptions,delegatesFocus:!0},ca.styles=[Ot`
|
|
95
95
|
:host {
|
|
96
96
|
/* color-scheme: light dark; */
|
|
97
97
|
--rokit-primary-color-inner: var(--rokit-primary-color, #008877);
|
|
@@ -118,7 +118,7 @@ a, a:visited { color: inherit; }
|
|
|
118
118
|
:host { display: inline-flex; align-items: center; padding: 6px 8px; border-bottom: 2px solid var(--rokit-light-background-darker-color-inner); box-sizing: border-box; position: relative; }
|
|
119
119
|
:host(:focus) { border-color: var(--rokit-primary-color-inner); }
|
|
120
120
|
:host(.invalid) { border-color: var(--rokit-error-color-inner); }
|
|
121
|
-
`];let wt=ua;Wt([Se()],wt.prototype,"name");Wt([Se()],wt.prototype,"value");Wt([Se({type:Boolean})],wt.prototype,"clearable");Wt([Se({type:Boolean})],wt.prototype,"required");Wt([Se({type:Boolean})],wt.prototype,"disabled");Wt([Se()],wt.prototype,"label");Wt([Se()],wt.prototype,"placeholder");function Bf(r){const e=parseFloat(r),t=r.match(/m?s/);let i=0;if(t)switch(t[0]){case"s":i=e*1e3;break;case"ms":i=e;break;default:i=0;break}return i}var qf=Object.defineProperty,zf=Object.getOwnPropertyDescriptor,Ec=(r,e,t,i)=>{for(var n=i>1?void 0:i?zf(e,t):e,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&qf(e,t,n),n};let
|
|
121
|
+
`];let wt=ua;Wt([Se()],wt.prototype,"name");Wt([Se()],wt.prototype,"value");Wt([Se({type:Boolean})],wt.prototype,"clearable");Wt([Se({type:Boolean})],wt.prototype,"required");Wt([Se({type:Boolean})],wt.prototype,"disabled");Wt([Se()],wt.prototype,"label");Wt([Se()],wt.prototype,"placeholder");function Bf(r){const e=parseFloat(r),t=r.match(/m?s/);let i=0;if(t)switch(t[0]){case"s":i=e*1e3;break;case"ms":i=e;break;default:i=0;break}return i}var qf=Object.defineProperty,zf=Object.getOwnPropertyDescriptor,Ec=(r,e,t,i)=>{for(var n=i>1?void 0:i?zf(e,t):e,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&qf(e,t,n),n};let Nr=class extends pr{constructor(){super(...arguments),this.icon=!1}render(){return Et`<a part="link"><slot><slot></a>`}};Nr.styles=[...pr.styles,Ot`
|
|
122
122
|
:host { display: inline-flex; }
|
|
123
123
|
:host a { display: flex; min-width: 1em; height: 1em; padding: 0.5em; cursor: pointer; border-radius: 0.6em; align-items: center; justify-content: center; }
|
|
124
124
|
:host a:hover { text-shadow: 0 0 1px; }
|
|
@@ -130,7 +130,7 @@ a, a:visited { color: inherit; }
|
|
|
130
130
|
:host(.caret) a:before { content: ''; width: var(--rokit-caret-size-inner); height: var(--rokit-caret-size-inner); border-style: none solid solid none; border-width: calc(0.3 * var(--rokit-caret-size-inner)); transform: translate(0.15em, -0.15em) rotate(45deg); transition: transform var(--rokit-transition-duration-inner) ease-out; margin-right: calc(0.5 * var(--rokit-caret-size-inner)); }
|
|
131
131
|
:host(.caret.down) a:before { transform: translate(0.15em, 0.15em) rotate(225deg); }
|
|
132
132
|
:host(.caret.right) a:before { transform: translate(0em, 0em) rotate(-45deg); }
|
|
133
|
-
`];Ec([Se({type:Boolean,reflect:!0})],
|
|
133
|
+
`];Ec([Se({type:Boolean,reflect:!0})],Nr.prototype,"icon",2);Nr=Ec([fr("rokit-button")],Nr);var Uf=Object.defineProperty,Hf=Object.getOwnPropertyDescriptor,Ct=(r,e,t,i)=>{for(var n=i>1?void 0:i?Hf(e,t):e,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Uf(e,t,n),n};let rt=class extends pr{constructor(){super(...arguments),this.open=!1,this.disabled=!1,this.transitioning=!1,this.closedBeforeTransition=!1,this.onMouseDown=(()=>{this.closedBeforeTransition=!this.open&&!this.transitioning}).bind(this),this.onClick=(()=>{this.toggle(this.closedBeforeTransition,!0)}).bind(this)}firstUpdated(){this.transitionDuration=Bf(getComputedStyle(this).getPropertyValue("--rokit-transition-duration-inner")),new IntersectionObserver(r=>{r.length&&r[0].isIntersecting&&this.updateContentHeight()}).observe(this)}updated(r){r.has("transitioning")&&this.classList.toggle("transitioning",this.transitioning),r.has("disabled")&&(this.disabled?(this.header.removeEventListener("mousedown",this.onMouseDown),this.header.removeEventListener("click",this.onClick)):(this.header.addEventListener("mousedown",this.onMouseDown),this.header.addEventListener("click",this.onClick))),r.has("open")&&!this.disabled&&(this.transitioning||this.toggle(this.open))}updateContentHeight(){setTimeout(()=>{this.content.style.maxHeight=(this.maxHeight!==void 0?Math.min(this.maxHeight,this.content.scrollHeight):this.content.scrollHeight)+"px",this.classList.toggle("has-content",this.content.style.maxHeight!=="0px")})}onSlotChange(){const r=this.shadowRoot.querySelector("#content > slot").assignedNodes(),e=new MutationObserver(()=>this.updateContentHeight());for(const t of r)e.observe(t,{subtree:!0,childList:!0,characterData:!0});this.updateContentHeight()}toggle(r=!this.open,e=!1){this.disabled||(this.transitioning=!0,this.open=r,this.toggleButton.classList.toggle("down",r),setTimeout(()=>{this.transitioning=!1,this.open&&e&&this.content.scrollIntoView({block:"nearest"})},this.transitionDuration))}render(){return Et`
|
|
134
134
|
<header part="header">
|
|
135
135
|
<slot name="prefix" part="prefix"></slot>
|
|
136
136
|
<span class="label"><slot name="label" part="label">${this.label}</slot></span>
|
|
@@ -153,7 +153,7 @@ a, a:visited { color: inherit; }
|
|
|
153
153
|
.label { flex-grow: 1; }
|
|
154
154
|
#content { display: flex; transition: max-height var(--rokit-transition-duration-inner) ease-in-out; position: relative; scrollbar-width: thin; }
|
|
155
155
|
#toggle { margin-left: 3px; }
|
|
156
|
-
`];Ct([Se({type:Boolean,reflect:!0})],rt.prototype,"open",2);Ct([Se()],rt.prototype,"label",2);Ct([Se({reflect:!0})],rt.prototype,"maxHeight",2);Ct([Se({type:Boolean})],rt.prototype,"disabled",2);Ct([yt("#content")],rt.prototype,"content",2);Ct([yt("#toggle")],rt.prototype,"toggleButton",2);Ct([yt("header")],rt.prototype,"header",2);Ct([Ca()],rt.prototype,"transitioning",2);rt=Ct([fr("rokit-collapsible")],rt);var Gf=Object.defineProperty,Vf=Object.getOwnPropertyDescriptor,Sc=r=>{throw TypeError(r)},ft=(r,e,t,i)=>{for(var n=i>1?void 0:i?Vf(e,t):e,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Gf(e,t,n),n},Rc=(r,e,t)=>e.has(r)||Sc("Cannot "+t),Wf=(r,e,t)=>(Rc(r,e,"read from private field"),e.get(r)),Xf=(r,e,t)=>e.has(r)?Sc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Zs=(r,e,t,i)=>(Rc(r,e,"write to private field"),e.set(r,t),t),ui;let Ue=class extends wt{constructor(){super(),this.type="text",this.readonly=!1,this.sticky=!1,this.minWidth=80,Xf(this,ui,""),this.addEventListener("keydown",r=>{r.code==="Escape"&&this.blur()}),this.addEventListener("focus",()=>{this.classList.add("has-focus")}),this.addEventListener("blur",()=>{this.inputElement.scrollLeft=0,this.classList.remove("has-focus")})}firstUpdated(){Zs(this,ui,this.value),this.inputElement.addEventListener("change",()=>{this.value=this.inputElement.value}),this.updateMinWidth()}updateMinWidth(){var r,e;const t=this.shadowRoot.querySelector(".wrapper");if(t){const i=((e=(r=this.shadowRoot)==null?void 0:r.querySelector("label"))==null?void 0:e.scrollWidth)||0
|
|
156
|
+
`];Ct([Se({type:Boolean,reflect:!0})],rt.prototype,"open",2);Ct([Se()],rt.prototype,"label",2);Ct([Se({reflect:!0})],rt.prototype,"maxHeight",2);Ct([Se({type:Boolean})],rt.prototype,"disabled",2);Ct([yt("#content")],rt.prototype,"content",2);Ct([yt("#toggle")],rt.prototype,"toggleButton",2);Ct([yt("header")],rt.prototype,"header",2);Ct([Ca()],rt.prototype,"transitioning",2);rt=Ct([fr("rokit-collapsible")],rt);var Gf=Object.defineProperty,Vf=Object.getOwnPropertyDescriptor,Sc=r=>{throw TypeError(r)},ft=(r,e,t,i)=>{for(var n=i>1?void 0:i?Vf(e,t):e,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Gf(e,t,n),n},Rc=(r,e,t)=>e.has(r)||Sc("Cannot "+t),Wf=(r,e,t)=>(Rc(r,e,"read from private field"),e.get(r)),Xf=(r,e,t)=>e.has(r)?Sc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Zs=(r,e,t,i)=>(Rc(r,e,"write to private field"),e.set(r,t),t),ui;let Ue=class extends wt{constructor(){super(),this.type="text",this.readonly=!1,this.sticky=!1,this.minWidth=80,Xf(this,ui,""),this.addEventListener("keydown",r=>{r.code==="Escape"&&this.blur()}),this.addEventListener("focus",()=>{this.classList.add("has-focus")}),this.addEventListener("blur",()=>{this.inputElement.scrollLeft=0,this.classList.remove("has-focus")})}firstUpdated(){Zs(this,ui,this.value),this.inputElement.addEventListener("change",()=>{this.value=this.inputElement.value}),new IntersectionObserver(r=>{r.length&&r[0].isIntersecting&&this.updateMinWidth()}).observe(this)}updateMinWidth(){var r,e;const t=this.shadowRoot.querySelector(".wrapper");if(t){const i=((e=(r=this.shadowRoot)==null?void 0:r.querySelector("label"))==null?void 0:e.scrollWidth)||0,n=this.minWidth>i?this.minWidth:i;t.style.minWidth=n>0?n+"px":""}}updated(r){r.has("label")&&(this.classList.toggle("has-label",this.label!==void 0),this.updateMinWidth()),r.has("min")&&(this.inputElement.min=this.min||""),r.has("max")&&(this.inputElement.max=this.max||""),r.has("step")&&(this.inputElement.step=this.step||""),r.has("placeholder")&&(this.inputElement.placeholder=this.placeholder||""),r.has("pattern")&&(this.inputElement.pattern=this.pattern||""),r.has("minLength")&&(this.inputElement.minLength=this.minLength===void 0?-1:this.minLength),r.has("maxLength")&&(this.inputElement.maxLength=this.maxLength===void 0?-1:this.maxLength),r.has("value")&&(this.classList.toggle("has-value",this.value!==""),this.setFormValue(this.value),this.updateValidity(this.inputElement.validity,this.inputElement.validationMessage,this.inputElement),this.value!==Wf(this,ui)&&(Zs(this,ui,this.value),this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))))}clear(){this.inputElement.value="",this.value="",this.blur()}renderInput(){return Et`<input id="input" part="input" size="1" name="${this.name}" type="${this.type}" autocomplete="off" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" .value="${this.type==="file"?"":this.value}">`}render(){return Et`
|
|
157
157
|
<slot name="prefix" part="prefix"></slot>
|
|
158
158
|
<div class="wrapper">
|
|
159
159
|
<label for="input" part="label">${this.label}</label>
|
|
@@ -177,7 +177,7 @@ a, a:visited { color: inherit; }
|
|
|
177
177
|
:host(.has-label) #input { margin-top: 0.9em; }
|
|
178
178
|
:host(.has-label:not(.has-focus):not(.has-value):not([sticky])) #input { clip-path: polygon(0 0, 0 0, 0 0, 0 0); }
|
|
179
179
|
:host(:not(.has-value)) .clear { visibility: hidden; }
|
|
180
|
-
`];ft([Se()],Ue.prototype,"type",2);ft([Se({type:Boolean,reflect:!0})],Ue.prototype,"readonly",2);ft([Se({type:Boolean,reflect:!0})],Ue.prototype,"sticky",2);ft([Se()],Ue.prototype,"pattern",2);ft([Se()],Ue.prototype,"minLength",2);ft([Se()],Ue.prototype,"maxLength",2);ft([Se()],Ue.prototype,"min",2);ft([Se()],Ue.prototype,"max",2);ft([Se()],Ue.prototype,"step",2);ft([Se()],Ue.prototype,"minWidth",2);ft([yt("#input")],Ue.prototype,"inputElement",2);Ue=ft([fr("rokit-input")],Ue);var Qf=Object.defineProperty,Jf=Object.getOwnPropertyDescriptor,
|
|
180
|
+
`];ft([Se()],Ue.prototype,"type",2);ft([Se({type:Boolean,reflect:!0})],Ue.prototype,"readonly",2);ft([Se({type:Boolean,reflect:!0})],Ue.prototype,"sticky",2);ft([Se()],Ue.prototype,"pattern",2);ft([Se()],Ue.prototype,"minLength",2);ft([Se()],Ue.prototype,"maxLength",2);ft([Se()],Ue.prototype,"min",2);ft([Se()],Ue.prototype,"max",2);ft([Se()],Ue.prototype,"step",2);ft([Se()],Ue.prototype,"minWidth",2);ft([yt("#input")],Ue.prototype,"inputElement",2);Ue=ft([fr("rokit-input")],Ue);var Qf=Object.defineProperty,Jf=Object.getOwnPropertyDescriptor,Ic=r=>{throw TypeError(r)},nt=(r,e,t,i)=>{for(var n=i>1?void 0:i?Jf(e,t):e,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Qf(e,t,n),n},Nc=(r,e,t)=>e.has(r)||Ic("Cannot "+t),el=(r,e,t)=>(Nc(r,e,"read from private field"),t?t.call(r):e.get(r)),tl=(r,e,t)=>e.has(r)?Ic("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Bi=(r,e,t,i)=>(Nc(r,e,"write to private field"),e.set(r,t),t),xr,Vi;let Ve=class extends wt{constructor(){super(),this.emptyMessage="Nothing to select",this.collapsibleOrientationLeft="0",this.collapsibleOrientationRight="0",this.collapsibleWidth="",this.collapse=!1,this.filterableThreshold=15,this.itemCount=0,tl(this,xr,""),tl(this,Vi,""),this.addEventListener("focus",()=>{this.collapsible.toggle(!0)}),this.addEventListener("blur",()=>{this.checkInputValue(),this.collapsible.toggle(!1)})}firstUpdated(){Bi(this,xr,this.value),Bi(this,Vi,getComputedStyle(this).getPropertyValue("--rokit-list-indent-inner")),this.input.placeholder=this.placeholder===void 0?"Type to filter list...":this.placeholder,this.input.label=this.label,this.inputMinWidth!==void 0&&(this.input.minWidth=this.inputMinWidth),setTimeout(()=>{this.collapsible.maxHeight=parseInt(this.collapsibleMaxHeight!==void 0?this.collapsibleMaxHeight:getComputedStyle(this).getPropertyValue("--rokit-list-max-height-inner")),this.collapsible.content.style.width=this.collapsibleWidth,this.collapsible.content.style.left=this.collapsibleOrientationLeft,this.collapsible.content.style.right=this.collapsibleOrientationRight})}updated(r){var e;if(r.has("selectedItem")){const t=this.value;this.value=this.selectedItem?this.itemValue(this.selectedItem):"",this.input.value=this.selectedItem?this.itemText(this.selectedItem):this.value,this.input.title=this.input.value,this.classList.toggle("has-value",this.value!==""),this.setFormValue(this.value),this.required&&this.value===""?this.updateValidity({valueMissing:!0},"Please select a value",this.listContainer):this.updateValidity(),t!==this.value&&this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}r.has("value")&&this.selectItem(this.findItem(this.value)),r.has("disabled")&&(this.input.disabled=this.disabled,this.collapsible.disabled=this.disabled),(r.has("filterableThreshold")||r.has("itemCount"))&&(this.input.readonly=this.filterableThreshold<0||this.itemCount<this.filterableThreshold),(e=this.collapsible)!=null&&e.toggleButton&&(this.collapsible.toggleButton.style.display=this.listContainer.childElementCount===0?"none":"")}checkInputValue(r=!0){if(this.input.value){const e=this.findItem(this.input.value);if(e){this.selectItem(e);return}}r&&(this.input.value="",this.input.title="",Bi(this,xr,""),this.selectItem(null,!1))}filter(r){var e,t,i;r=r.toLowerCase();let n=!0;for(const o of this.listContainer.querySelectorAll("li"))if(o.id!=="noresult"){const a=this.itemText(o).toLowerCase().indexOf(r)==-1;o.classList.toggle("hidden",a),this.collapse&&(o.classList.remove("open"),(e=o.querySelector("ul"))==null||e.classList.remove("open")),a||(n=!1)}for(const o of this.listContainer.querySelectorAll("li:has(li:not(.hidden))"))o.classList.remove("hidden"),r&&this.collapse&&(o.classList.add("open"),(t=o.querySelector("ul"))==null||t.classList.add("open")),n=!1;this.highlightItem(null),(i=this.listContainer.querySelector("#noresult"))==null||i.classList.toggle("hidden",!n)}selectItem(r,e=!0){r?.getAttribute("disabled")!==null&&(r=null),this.selectedItem=r,this.filter(""),this.highlightItem(r,!1),e&&this.value&&Bi(this,xr,this.value),setTimeout(()=>this.blur())}findItem(r){if(r){for(const e of this.listContainer.querySelectorAll("li"))if(this.itemValue(e)===r||this.itemText(e)===r)return e}return null}highlightItem(r,e=!0){var t,i;if((t=this.listContainer.querySelector("li.active"))==null||t.classList.remove("active"),r){if(e&&this.listContainer.focus(),r.classList.add("active"),this.collapse)for(let n=r.closest("ul");n;n=n.parentElement.closest("ul"))n.classList.add("open"),(i=n.closest("li"))==null||i.classList.add("open");this.collapsible.open&&r.scrollIntoView({block:"nearest"})}}highlightNextItem(){const r=this.listContainer.querySelector("li.active");let e=r;const t=this.listContainer.querySelectorAll("ul.open > li:not([disabled]):not(.hidden):not(.divider)");if(r){for(let i=0;i<t.length;i++)if(t[i]===r&&i<t.length-1){e=t[i+1];break}}else t.length>0&&(e=t[0]);this.highlightItem(e)}highlightPreviousItem(){const r=this.listContainer.querySelector("li.active");let e=null;if(r){const t=this.listContainer.querySelectorAll("ul.open > li:not([disabled]):not(.hidden):not(.divider)");for(let i=0;i<t.length;i++)if(t[i]===r&&i>0){e=t[i-1];break}}this.highlightItem(e),e||this.input.focus()}itemValue(r){return r.dataset.value||this.itemText(r)||""}itemText(r){var e;return((e=r.querySelector("div > div"))==null?void 0:e.innerText)||""}elementText(r){var e;let t="";for(const i of r.childNodes)i.nodeType==3&&(t+=(e=i.nodeValue)==null?void 0:e.trim());return t}onSlotChange(){this.listContainer.replaceChildren(),this.itemCount=0;let r=null;const e=this.shadowRoot.querySelector("#list-container-slot").assignedElements();if(e?.length===1&&(r=Array.prototype.slice.call(e[0].querySelectorAll(":scope > li")),this.copyItems(r,this.listContainer)),this.emptyMessage){const t=document.createElement("li");t.id="noresult",t.setAttribute("disabled",""),t.innerText=this.emptyMessage,this.listContainer.appendChild(t),r&&r.length>0&&t.classList.add("hidden")}this.value=this.value||el(this,xr),this.selectItem(this.findItem(this.value))}copyItems(r,e,t=0){if(this.sort!==void 0){const n=this.sort||"asc";r=r.sort((o,a)=>n==="desc"?(this.elementText(a)||this.itemValue(a)).localeCompare(this.elementText(o)||this.itemValue(o)):(this.elementText(o)||this.itemValue(o)).localeCompare(this.elementText(a)||this.itemValue(a)))}let i="";t>0&&(i=`calc(0.3em + ${t}*${el(this,Vi)})`);for(const n of r){const o=n.cloneNode();o.replaceChildren();const a=document.createElement("div");i&&(a.style.paddingLeft=i);const s=document.createElement("div");a.appendChild(s);for(const l of n.childNodes)if(l.nodeName!=="UL"){const c=l.cloneNode(!0);c.nodeType===3&&c.nodeValue&&(c.nodeValue=c.nodeValue.trim()),s.appendChild(c)}o.appendChild(a),o.title=o.title||this.itemText(o);const d=n.querySelector("ul");if(d!=null&&d.childElementCount){const l=document.createElement("ul");if(o.appendChild(l),this.copyItems(Array.prototype.slice.call(d.children),l,t+1),this.collapse){const c=new Nr;c.title="Open",c.dense=!0,c.icon=!0,c.classList.add("toggle-node","caret"),c.addEventListener("click",u=>{u.stopPropagation(),o.classList.toggle("open"),l.classList.toggle("open"),c.title=o.classList.contains("open")?"Close":"Open",this.collapsible.updateContentHeight()}),a.prepend(c)}else l.classList.add("open")}e.appendChild(o),this.itemCount++}}render(){return Et`
|
|
181
181
|
<rokit-collapsible ?dense="${this.dense}" part="collapsible">
|
|
182
182
|
<slot name="prefix" part="prefix" slot="prefix"></slot>
|
|
183
183
|
<slot name="suffix" part="suffix" slot="suffix"></slot>
|
|
@@ -222,7 +222,7 @@ a, a:visited { color: inherit; }
|
|
|
222
222
|
:host([collapse]) li > div > div { padding-left: 1.8em; }
|
|
223
223
|
:host([collapse]) ul:not(.open) { display: none; }
|
|
224
224
|
:host([collapse]) li:not(.open) > div > .toggle-node::part(link):before { transform: translate(0em, 0em) rotate(-45deg); }
|
|
225
|
-
`];nt([Se()],Ve.prototype,"emptyMessage",2);nt([Se()],Ve.prototype,"sort",2);nt([Se()],Ve.prototype,"collapsibleMaxHeight",2);nt([Se()],Ve.prototype,"collapsibleOrientationLeft",2);nt([Se()],Ve.prototype,"collapsibleOrientationRight",2);nt([Se()],Ve.prototype,"collapsibleWidth",2);nt([Se()],Ve.prototype,"inputMinWidth",2);nt([Se({type:Boolean,reflect:!0})],Ve.prototype,"collapse",2);nt([Se()],Ve.prototype,"filterableThreshold",2);nt([yt("rokit-collapsible")],Ve.prototype,"collapsible",2);nt([yt("#input")],Ve.prototype,"input",2);nt([yt("#list-container")],Ve.prototype,"listContainer",2);nt([Ca()],Ve.prototype,"selectedItem",2);nt([Ca()],Ve.prototype,"itemCount",2);Ve=nt([fr("rokit-select")],Ve);var Kf=Object.defineProperty,Yf=Object.getOwnPropertyDescriptor,fn=(r,e,t,i)=>{for(var n=i>1?void 0:i?Yf(e,t):e,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Kf(e,t,n),n};let lr=class extends Ue{constructor(){super(...arguments),this.resize="none",this.rows=3}firstUpdated(){super.firstUpdated(),this.inputElement.rows=this.rows,this.cols!==void 0&&(this.inputElement.cols=this.cols),this.resize==="auto"?(this.inputElement.style.resize="none",this.inputElement.addEventListener("input",()=>this.autoResize())):this.inputElement.style.resize=this.resize}updated(r){super.updated(r),this.resize==="auto"&&r.has("value")&&this.autoResize()}autoResize(){this.inputElement.style.height="",this.inputElement.style.height=this.inputElement.scrollHeight+"px"}onSlotChange(){const r=this.shadowRoot.querySelector("#content").assignedNodes().map(e=>e.textContent).join("");r.trim()!==""&&(this.value=r)}renderInput(){return Et`
|
|
225
|
+
`];nt([Se()],Ve.prototype,"emptyMessage",2);nt([Se()],Ve.prototype,"sort",2);nt([Se()],Ve.prototype,"collapsibleMaxHeight",2);nt([Se()],Ve.prototype,"collapsibleOrientationLeft",2);nt([Se()],Ve.prototype,"collapsibleOrientationRight",2);nt([Se()],Ve.prototype,"collapsibleWidth",2);nt([Se()],Ve.prototype,"inputMinWidth",2);nt([Se({type:Boolean,reflect:!0})],Ve.prototype,"collapse",2);nt([Se()],Ve.prototype,"filterableThreshold",2);nt([yt("rokit-collapsible")],Ve.prototype,"collapsible",2);nt([yt("#input")],Ve.prototype,"input",2);nt([yt("#list-container")],Ve.prototype,"listContainer",2);nt([Ca()],Ve.prototype,"selectedItem",2);nt([Ca()],Ve.prototype,"itemCount",2);Ve=nt([fr("rokit-select")],Ve);var Kf=Object.defineProperty,Yf=Object.getOwnPropertyDescriptor,fn=(r,e,t,i)=>{for(var n=i>1?void 0:i?Yf(e,t):e,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Kf(e,t,n),n};let lr=class extends Ue{constructor(){super(...arguments),this.resize="none",this.rows=3}firstUpdated(){super.firstUpdated(),this.inputElement.rows=this.rows,this.cols!==void 0&&(this.inputElement.cols=this.cols),this.resize==="auto"?(this.inputElement.style.resize="none",this.inputElement.addEventListener("input",()=>this.autoResize())):this.inputElement.style.resize=this.resize}updated(r){super.updated(r),this.resize==="auto"&&r.has("resize")&&new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.autoResize()}).observe(this),this.resize==="auto"&&r.has("value")&&this.autoResize()}autoResize(){this.inputElement.style.height="",this.inputElement.style.height=this.inputElement.scrollHeight+"px"}onSlotChange(){const r=this.shadowRoot.querySelector("#content").assignedNodes().map(e=>e.textContent).join("");r.trim()!==""&&(this.value=r)}renderInput(){return Et`
|
|
226
226
|
<textarea id="input" part="input" autocomplete="off" name="${this.name}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" .value="${this.value}"></textarea>
|
|
227
227
|
<slot id="content" @slotchange=${this.onSlotChange}></slot>
|
|
228
228
|
`}};lr.styles=[...Ue.styles,Ot`
|
|
@@ -277,7 +277,7 @@ a, a:visited { color: inherit; }
|
|
|
277
277
|
background-color: inherit;
|
|
278
278
|
clip-path: polygon(50% 50%, 100% 50%, 50% 100%, 0 50%);
|
|
279
279
|
}
|
|
280
|
-
`];St([Se()],Tr.prototype,"offset",2);St([Se()],Tr.prototype,"label",2);Tr=St([fr("rokit-slider-knob")],Tr);class en extends HTMLElement{constructor(e,t,i,n){if(super(),this.template=new Gu(i.store.getQuads(e,null,null,null),t,i),this.template.extendedShapes.length&&this.template.config.attributes.collapse!==null&&(!this.template.maxCount||this.template.maxCount>1)){const o=new rt;o.classList.add("collapsible","shacl-group"),o.open=i.attributes.collapse==="open",o.label=this.template.label,this.container=o}else this.container=this;if(this.template.order!==void 0&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),i.editMode&&!t.linked&&(this.addButton=this.createAddButton(),this.container.appendChild(this.addButton)),this.template.path){let o=[];n&&(t.linked?o=i.store.getQuads(n,this.template.path,null,null):o=i.store.getQuads(n,this.template.path,null,kt));let a=!1;for(const s of o)this.isValueValid(s.object)&&(this.addPropertyInstance(s.object),this.template.hasValue&&s.object.equals(this.template.hasValue)&&(a=!0));i.editMode&&this.template.hasValue&&!a&&!t.linked&&this.addPropertyInstance(this.template.hasValue)}i.editMode&&!t.linked&&(this.addEventListener("change",()=>{this.updateControls()}),this.updateControls()),this.container instanceof rt&&(i.editMode&&!t.linked||this.container.childElementCount>0)&&this.appendChild(this.container)}addPropertyInstance(e){let t;if(this.template.shaclOr?.length||this.template.shaclXone?.length){const i=this.template.shaclOr?.length?this.template.shaclOr:this.template.shaclXone;let n=!1;if(e){const o=zu(i,e,this.template.config);o.length&&(t=Wi(this.template.clone().merge(o),e,!0),n=!0)}n||(t=fc(i,this,this.template.config),jc(t,""))}else{let i=!1;if(e&&!(e instanceof dt)){const n=this.getRdfClassToLinkOrCreate();n&&this.template.config.store.countQuads(e,Ye,n,kt)===0&&(i=!0)}t=Wi(this.template,e,void 0,i||this.template.parent.linked)}return this.addButton?this.container.insertBefore(t,this.addButton):this.container.appendChild(t),t}updateControls(){let e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length;e===0&&(!this.template.extendedShapes.length||this.template.minCount!==void 0&&this.template.minCount>0)&&(this.addPropertyInstance(),e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length);let t;this.template.minCount!==void 0?t=e>this.template.minCount:t=this.template.extendedShapes.length>0||e>1;const i=this.template.maxCount===void 0||e<this.template.maxCount;this.classList.toggle("may-remove",t),this.classList.toggle("may-add",i),i&&this.addButton?.input&&this.addButton.input.updateMinWidth()}toRDF(e,t){for(const i of this.querySelectorAll(":scope > .property-instance, :scope > .collapsible > .property-instance")){const n=Ne.namedNode(i.dataset.path);if(i.firstChild instanceof Gt){const o=i.firstChild.toRDF(e);e.addQuad(t,n,o,this.template.config.valuesGraphId)}else for(const o of i.querySelectorAll(":scope > .editor")){const a=Ku(o);a&&e.addQuad(t,n,a,this.template.config.valuesGraphId)}}}getRdfClassToLinkOrCreate(){if(this.template.class&&this.template.node)return this.template.class;for(const e of this.template.extendedShapes){const t=this.template.config.store.getObjects(e,wi,null);if(t.length>0)return t[0]}}isValueValid(e){if(!this.template.extendedShapes.length)return!0;for(const t of this.template.extendedShapes){const i=this.template.config.store.getObjects(t,wi,null);for(const n of i)if(this.template.config.store.countQuads(e,Ye,n,null)>0)return!0}return!1}createAddButton(){const e=new Ve;e.dense=!0,e.label="+ "+this.template.label,e.title="Add "+this.template.label,e.classList.add("add-button");let t=[],i=this.getRdfClassToLinkOrCreate();if(i&&(t=Ra(i,this.template)),t.length===0)e.emptyMessage="",e.inputMinWidth=0,e.addEventListener("click",n=>{e.blur();const o=this.addPropertyInstance();o.classList.add("fadeIn"),this.updateControls(),setTimeout(()=>{Bu(o),o.classList.remove("fadeIn")},200)});else{const n=document.createElement("ul"),o=document.createElement("li");o.innerHTML="+ Create new "+this.template.label+"...",o.dataset.value="new",o.classList.add("large"),n.appendChild(o);const a=document.createElement("li");a.classList.add("divider"),n.appendChild(a);const s=document.createElement("li");s.classList.add("header"),s.innerText="Or link existing:",n.appendChild(s);for(const d of t){const l=document.createElement("li"),c=typeof d.value=="string"?d.value:d.value.value;l.innerText=d.label?d.label:c,l.dataset.value=JSON.stringify(d.value),n.appendChild(l)}e.appendChild(n),e.collapsibleWidth="250px",e.collapsibleOrientationLeft="",e.addEventListener("change",()=>{if(e.value==="new")this.addPropertyInstance();else{const d=JSON.parse(e.value);this.container.insertBefore(Wi(this.template,d,!0,!0),e)}e.value=""})}return e}}function Wi(r,e,t=!1,i=!1){let n;if(r.extendedShapes.length){n=document.createElement("div"),n.classList.add("property-instance");for(const o of r.extendedShapes)n.appendChild(new Gt(o,r.config,e,r.parent,r.nodeKind,r.label,i))}else{const o=ef(r.path,r.datatype?.value);o?r.config.editMode&&!i?n=o.createEditor(r,e):n=o.createViewer(r,e):n=Xu(r,e||null,r.config.editMode&&!i),n.classList.add("property-instance"),i&&n.classList.add("linked")}return r.config.editMode&&jc(n,r.label,t),n.dataset.path=r.path,n}function jc(r,e,t=!1){const i=new Ir;i.classList.add("remove-button","clear"),i.title="Remove "+e,i.dense=!0,i.icon=!0,i.addEventListener("click",n=>{r.classList.remove("fadeIn"),r.classList.add("fadeOut"),setTimeout(()=>{const o=r.parentElement;r.remove(),o?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},200)}),t&&i.classList.add("persistent"),r.appendChild(i)}window.customElements.define("shacl-property",en);function tp(r,e){let t=r;const i=e.store.getQuads(r,null,null,null),n=bi(i,"label",_a,e.languages);n&&(t=n);let o;if(e.attributes.collapse!==null)o=new rt,o.classList.add("collapsible"),o.open=e.attributes.collapse==="open",o.label=t;else{o=document.createElement("div");const s=document.createElement("h1");s.innerText=t,o.appendChild(s)}o.dataset.subject=r,o.classList.add("shacl-group");const a=bi(i,"order");return a&&(o.style.order=a),o}const Je=[];for(let r=0;r<256;++r)Je.push((r+256).toString(16).slice(1));function rp(r,e=0){return(Je[r[e+0]]+Je[r[e+1]]+Je[r[e+2]]+Je[r[e+3]]+"-"+Je[r[e+4]]+Je[r[e+5]]+"-"+Je[r[e+6]]+Je[r[e+7]]+"-"+Je[r[e+8]]+Je[r[e+9]]+"-"+Je[r[e+10]]+Je[r[e+11]]+Je[r[e+12]]+Je[r[e+13]]+Je[r[e+14]]+Je[r[e+15]]).toLowerCase()}let Wn;const ip=new Uint8Array(16);function np(){if(!Wn){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Wn=crypto.getRandomValues.bind(crypto)}return Wn(ip)}const op=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),rl={randomUUID:op};function il(r,e,t){if(rl.randomUUID&&!r)return rl.randomUUID();r=r||{};const i=r.random??r.rng?.()??np();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,rp(i)}class Gt extends HTMLElement{constructor(e,t,i,n,o,a,s){super(),this.owlImports=[],this.parent=n,this.config=t,this.shaclSubject=e,this.linked=s||!1;let d=i;if(!d){if(!o){const c=t.store.getObjects(e,`${_e}nodeKind`,null);c.length&&(o=c[0])}o===void 0&&t.attributes.valuesNamespace||o?.value===`${_e}IRI`?d=Ne.namedNode(t.attributes.valuesNamespace+il()):d=Ne.blankNode(il())}this.nodeId=d;const l=JSON.stringify([e,i]);if(i&&t.renderedNodes.has(l)){a=a||"Link";const c=document.createElement("label");c.innerText=a,c.classList.add("linked"),this.appendChild(c);const u=document.createElement("a");let v=i.termType==="BlankNode"?"_:"+i.value:i.value;u.innerText=v,u.classList.add("ref-link"),u.onclick=()=>{this.config.form.querySelector(`shacl-node[data-node-id='${v}']`)?.scrollIntoView()},this.appendChild(u),this.style.flexDirection="row"}else{if(i&&t.renderedNodes.add(l),this.dataset.nodeId=this.nodeId.id,this.config.attributes.showNodeIds!==null){const c=document.createElement("div");c.innerText=`id: ${this.nodeId.id}`,c.classList.add("node-id-display"),this.appendChild(c)}for(const c of t.store.getQuads(e,Ea,null,null))this.owlImports.push(c.object);for(const c of t.store.getQuads(e,null,null,null))switch(c.predicate.id){case Ki.id:this.addPropertyInstance(c.object,t,i);break;case`${_e}and`:const u=t.lists[c.object.value];if(u?.length)for(const v of u)this.prepend(new Gt(v,t,i,this));else console.error("list not found:",c.object.value,"existing lists:",t.lists);break;case`${_e}node`:this.prepend(new Gt(c.object,t,i,this));break;case`${_e}targetClass`:this.targetClass=c.object;break;case`${_e}or`:this.tryResolve(c.object,i,t);break;case`${_e}xone`:this.tryResolve(c.object,i,t);break}if(a){const c=document.createElement("h1");c.innerText=a,this.prepend(c)}}}toRDF(e,t){if(t||(t=this.nodeId),!this.linked){for(const i of this.querySelectorAll(":scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property"))i.toRDF(e,t);this.targetClass&&e.addQuad(t,Ye,this.targetClass,this.config.valuesGraphId),this.config.attributes.generateNodeShapeReference&&!this.parent&&e.addQuad(t,Ne.namedNode(this.config.attributes.generateNodeShapeReference),this.shaclSubject,this.config.valuesGraphId)}return t}addPropertyInstance(e,t,i){let n=this;const o=t.store.getQuads(e,`${_e}group`,null,null);if(o.length>0){const s=o[0].object.value;if(t.groups.indexOf(s)>-1){let d=this.querySelector(`:scope > .shacl-group[data-subject='${s}']`);d||(d=tp(s,t),this.appendChild(d)),n=d}else console.warn("ignoring unknown group reference",o[0],"existing groups:",t.groups)}const a=new en(e,this,t,i);a.childElementCount>0&&n.appendChild(a)}tryResolve(e,t,i){const n=i.lists[e.value];if(n?.length){let o=!1;if(t){const a=Uu(n,t,i);if(a.length){for(const s of a)this.addPropertyInstance(s,i,t);o=!0}}o||this.appendChild(fc(n,this,i))}else console.error("list for sh:or/sh:xone not found:",e,"existing lists:",i.lists)}}window.customElements.define("shacl-node",Gt);var Jt={},Kt={},Yt={},It={},nl;function ap(){if(nl)return It;nl=1,Object.defineProperty(It,"__esModule",{value:!0}),It.removeDotSegmentsOfPath=It.removeDotSegments=It.resolve=void 0;function r(n,o){o=o||"";const a=o.indexOf("#");if(a>0&&(o=o.substr(0,a)),!n.length){if(o.indexOf(":")<0)throw new Error(`Found invalid baseIRI '${o}' for value '${n}'`);return o}if(n.startsWith("?")){const g=o.indexOf("?");return g>0&&(o=o.substr(0,g)),o+n}if(n.startsWith("#"))return o+n;if(!o.length){const g=n.indexOf(":");if(g<0)throw new Error(`Found invalid relative IRI '${n}' for a missing baseIRI`);return t(n,g)}const s=n.indexOf(":");if(s>=0)return t(n,s);const d=o.indexOf(":");if(d<0)throw new Error(`Found invalid baseIRI '${o}' for value '${n}'`);const l=o.substr(0,d+1);if(n.indexOf("//")===0)return l+t(n,s);let c;if(o.indexOf("//",d)===d+1){if(c=o.indexOf("/",d+3),c<0)return o.length>d+3?o+"/"+t(n,s):l+t(n,s)}else if(c=o.indexOf("/",d+1),c<0)return l+t(n,s);if(n.indexOf("/")===0)return o.substr(0,c)+e(n);let u=o.substr(c);const v=u.lastIndexOf("/");return v>=0&&v<u.length-1&&(u=u.substr(0,v+1),n[0]==="."&&n[1]!=="."&&n[1]!=="/"&&n[2]&&(n=n.substr(1))),n=u+n,n=e(n),o.substr(0,c)+n}It.resolve=r;function e(n){const o=[];let a=0;for(;a<n.length;)switch(n[a]){case"/":if(n[a+1]===".")if(n[a+2]==="."){if(!i(n[a+3])){o.push([]),a++;break}o.pop(),n[a+3]||o.push([]),a+=3}else{if(!i(n[a+2])){o.push([]),a++;break}n[a+2]||o.push([]),a+=2}else o.push([]),a++;break;case"#":case"?":o.length||o.push([]),o[o.length-1].push(n.substr(a)),a=n.length;break;default:o.length||o.push([]),o[o.length-1].push(n[a]),a++;break}return"/"+o.map(s=>s.join("")).join("/")}It.removeDotSegments=e;function t(n,o){let a=o+1;o>=0?n[o+1]==="/"&&n[o+2]==="/"&&(a=o+3):n[0]==="/"&&n[1]==="/"&&(a=2);const s=n.indexOf("/",a);if(s<0)return n;const d=n.substr(0,s),l=n.substr(s);return d+e(l)}It.removeDotSegmentsOfPath=t;function i(n){return!n||n==="#"||n==="?"||n==="/"}return It}var ol;function sp(){return ol||(ol=1,function(r){var e=Yt&&Yt.__createBinding||(Object.create?function(i,n,o,a){a===void 0&&(a=o),Object.defineProperty(i,a,{enumerable:!0,get:function(){return n[o]}})}:function(i,n,o,a){a===void 0&&(a=o),i[a]=n[o]}),t=Yt&&Yt.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),t(ap(),r)}(Yt)),Yt}var Zt={},Xn={},al;function lp(){return al||(al=1,function(r){/**
|
|
280
|
+
`];St([Se()],Tr.prototype,"offset",2);St([Se()],Tr.prototype,"label",2);Tr=St([fr("rokit-slider-knob")],Tr);class en extends HTMLElement{constructor(e,t,i,n){if(super(),this.template=new Gu(i.store.getQuads(e,null,null,null),t,i),this.template.extendedShapes.length&&this.template.config.attributes.collapse!==null&&(!this.template.maxCount||this.template.maxCount>1)){const o=new rt;o.classList.add("collapsible","shacl-group"),o.open=i.attributes.collapse==="open",o.label=this.template.label,this.container=o}else this.container=this;if(this.template.order!==void 0&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),i.editMode&&!t.linked&&(this.addButton=this.createAddButton(),this.container.appendChild(this.addButton)),this.template.path){let o=[];n&&(t.linked?o=i.store.getQuads(n,this.template.path,null,null):o=i.store.getQuads(n,this.template.path,null,kt));let a=!1;for(const s of o)this.isValueValid(s.object)&&(this.addPropertyInstance(s.object),this.template.hasValue&&s.object.equals(this.template.hasValue)&&(a=!0));i.editMode&&this.template.hasValue&&!a&&!t.linked&&this.addPropertyInstance(this.template.hasValue)}i.editMode&&!t.linked&&(this.addEventListener("change",()=>{this.updateControls()}),this.updateControls()),this.container instanceof rt&&(i.editMode&&!t.linked||this.container.childElementCount>0)&&this.appendChild(this.container)}addPropertyInstance(e){let t;if(this.template.shaclOr?.length||this.template.shaclXone?.length){const i=this.template.shaclOr?.length?this.template.shaclOr:this.template.shaclXone;let n=!1;if(e){const o=zu(i,e,this.template.config);o.length&&(t=Wi(this.template.clone().merge(o),e,!0),n=!0)}n||(t=fc(i,this,this.template.config),jc(t,""))}else{let i=!1;if(e&&!(e instanceof dt)){const n=this.getRdfClassToLinkOrCreate();n&&this.template.config.store.countQuads(e,Ye,n,kt)===0&&(i=!0)}t=Wi(this.template,e,void 0,i||this.template.parent.linked)}return this.addButton?this.container.insertBefore(t,this.addButton):this.container.appendChild(t),t}updateControls(){let e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length;e===0&&(!this.template.extendedShapes.length||this.template.minCount!==void 0&&this.template.minCount>0)&&(this.addPropertyInstance(),e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length);let t;this.template.minCount!==void 0?t=e>this.template.minCount:t=this.template.extendedShapes.length>0||e>1;const i=this.template.maxCount===void 0||e<this.template.maxCount;this.classList.toggle("may-remove",t),this.classList.toggle("may-add",i)}toRDF(e,t){for(const i of this.querySelectorAll(":scope > .property-instance, :scope > .collapsible > .property-instance")){const n=Ie.namedNode(i.dataset.path);if(i.firstChild instanceof Gt){const o=i.firstChild.toRDF(e);e.addQuad(t,n,o,this.template.config.valuesGraphId)}else for(const o of i.querySelectorAll(":scope > .editor")){const a=Ku(o);a&&e.addQuad(t,n,a,this.template.config.valuesGraphId)}}}getRdfClassToLinkOrCreate(){if(this.template.class&&this.template.node)return this.template.class;for(const e of this.template.extendedShapes){const t=this.template.config.store.getObjects(e,wi,null);if(t.length>0)return t[0]}}isValueValid(e){if(!this.template.extendedShapes.length)return!0;for(const t of this.template.extendedShapes){const i=this.template.config.store.getObjects(t,wi,null);for(const n of i)if(this.template.config.store.countQuads(e,Ye,n,null)>0)return!0}return!1}createAddButton(){const e=new Ve;e.dense=!0,e.label="+ "+this.template.label,e.title="Add "+this.template.label,e.classList.add("add-button");let t=[],i=this.getRdfClassToLinkOrCreate();if(i&&(t=Ra(i,this.template)),t.length===0)e.emptyMessage="",e.inputMinWidth=0,e.addEventListener("click",n=>{e.blur();const o=this.addPropertyInstance();o.classList.add("fadeIn"),this.updateControls(),setTimeout(()=>{Bu(o),o.classList.remove("fadeIn")},200)});else{const n=document.createElement("ul"),o=document.createElement("li");o.innerHTML="+ Create new "+this.template.label+"...",o.dataset.value="new",o.classList.add("large"),n.appendChild(o);const a=document.createElement("li");a.classList.add("divider"),n.appendChild(a);const s=document.createElement("li");s.classList.add("header"),s.innerText="Or link existing:",n.appendChild(s);for(const d of t){const l=document.createElement("li"),c=typeof d.value=="string"?d.value:d.value.value;l.innerText=d.label?d.label:c,l.dataset.value=JSON.stringify(d.value),n.appendChild(l)}e.appendChild(n),e.collapsibleWidth="250px",e.collapsibleOrientationLeft="",e.addEventListener("change",()=>{if(e.value==="new")this.addPropertyInstance();else{const d=JSON.parse(e.value);this.container.insertBefore(Wi(this.template,d,!0,!0),e)}e.value=""})}return e}}function Wi(r,e,t=!1,i=!1){let n;if(r.extendedShapes.length){n=document.createElement("div"),n.classList.add("property-instance");for(const o of r.extendedShapes)n.appendChild(new Gt(o,r.config,e,r.parent,r.nodeKind,r.label,i))}else{const o=ef(r.path,r.datatype?.value);o?r.config.editMode&&!i?n=o.createEditor(r,e):n=o.createViewer(r,e):n=Xu(r,e||null,r.config.editMode&&!i),n.classList.add("property-instance"),i&&n.classList.add("linked")}return r.config.editMode&&jc(n,r.label,t),n.dataset.path=r.path,n}function jc(r,e,t=!1){const i=new Nr;i.classList.add("remove-button","clear"),i.title="Remove "+e,i.dense=!0,i.icon=!0,i.addEventListener("click",n=>{r.classList.remove("fadeIn"),r.classList.add("fadeOut"),setTimeout(()=>{const o=r.parentElement;r.remove(),o?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},200)}),t&&i.classList.add("persistent"),r.appendChild(i)}window.customElements.define("shacl-property",en);function tp(r,e){let t=r;const i=e.store.getQuads(r,null,null,null),n=bi(i,"label",_a,e.languages);n&&(t=n);let o;if(e.attributes.collapse!==null)o=new rt,o.classList.add("collapsible"),o.open=e.attributes.collapse==="open",o.label=t;else{o=document.createElement("div");const s=document.createElement("h1");s.innerText=t,o.appendChild(s)}o.dataset.subject=r,o.classList.add("shacl-group");const a=bi(i,"order");return a&&(o.style.order=a),o}const Je=[];for(let r=0;r<256;++r)Je.push((r+256).toString(16).slice(1));function rp(r,e=0){return(Je[r[e+0]]+Je[r[e+1]]+Je[r[e+2]]+Je[r[e+3]]+"-"+Je[r[e+4]]+Je[r[e+5]]+"-"+Je[r[e+6]]+Je[r[e+7]]+"-"+Je[r[e+8]]+Je[r[e+9]]+"-"+Je[r[e+10]]+Je[r[e+11]]+Je[r[e+12]]+Je[r[e+13]]+Je[r[e+14]]+Je[r[e+15]]).toLowerCase()}let Wn;const ip=new Uint8Array(16);function np(){if(!Wn){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Wn=crypto.getRandomValues.bind(crypto)}return Wn(ip)}const op=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),rl={randomUUID:op};function il(r,e,t){if(rl.randomUUID&&!r)return rl.randomUUID();r=r||{};const i=r.random??r.rng?.()??np();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,rp(i)}class Gt extends HTMLElement{constructor(e,t,i,n,o,a,s){super(),this.owlImports=[],this.parent=n,this.config=t,this.shaclSubject=e,this.linked=s||!1;let d=i;if(!d){if(!o){const c=t.store.getObjects(e,`${_e}nodeKind`,null);c.length&&(o=c[0])}o===void 0&&t.attributes.valuesNamespace||o?.value===`${_e}IRI`?d=Ie.namedNode(t.attributes.valuesNamespace+il()):d=Ie.blankNode(il())}this.nodeId=d;const l=JSON.stringify([e,i]);if(i&&t.renderedNodes.has(l)){a=a||"Link";const c=document.createElement("label");c.innerText=a,c.classList.add("linked"),this.appendChild(c);const u=document.createElement("a");let v=i.termType==="BlankNode"?"_:"+i.value:i.value;u.innerText=v,u.classList.add("ref-link"),u.onclick=()=>{this.config.form.querySelector(`shacl-node[data-node-id='${v}']`)?.scrollIntoView()},this.appendChild(u),this.style.flexDirection="row"}else{if(i&&t.renderedNodes.add(l),this.dataset.nodeId=this.nodeId.id,this.config.attributes.showNodeIds!==null){const c=document.createElement("div");c.innerText=`id: ${this.nodeId.id}`,c.classList.add("node-id-display"),this.appendChild(c)}for(const c of t.store.getQuads(e,Ea,null,null))this.owlImports.push(c.object);for(const c of t.store.getQuads(e,null,null,null))switch(c.predicate.id){case Ki.id:this.addPropertyInstance(c.object,t,i);break;case`${_e}and`:const u=t.lists[c.object.value];if(u?.length)for(const v of u)this.prepend(new Gt(v,t,i,this));else console.error("list not found:",c.object.value,"existing lists:",t.lists);break;case`${_e}node`:this.prepend(new Gt(c.object,t,i,this));break;case`${_e}targetClass`:this.targetClass=c.object;break;case`${_e}or`:this.tryResolve(c.object,i,t);break;case`${_e}xone`:this.tryResolve(c.object,i,t);break}if(a){const c=document.createElement("h1");c.innerText=a,this.prepend(c)}}}toRDF(e,t){if(t||(t=this.nodeId),!this.linked){for(const i of this.querySelectorAll(":scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property"))i.toRDF(e,t);this.targetClass&&e.addQuad(t,Ye,this.targetClass,this.config.valuesGraphId),this.config.attributes.generateNodeShapeReference&&!this.parent&&e.addQuad(t,Ie.namedNode(this.config.attributes.generateNodeShapeReference),this.shaclSubject,this.config.valuesGraphId)}return t}addPropertyInstance(e,t,i){let n=this;const o=t.store.getQuads(e,`${_e}group`,null,null);if(o.length>0){const s=o[0].object.value;if(t.groups.indexOf(s)>-1){let d=this.querySelector(`:scope > .shacl-group[data-subject='${s}']`);d||(d=tp(s,t),this.appendChild(d)),n=d}else console.warn("ignoring unknown group reference",o[0],"existing groups:",t.groups)}const a=new en(e,this,t,i);a.childElementCount>0&&n.appendChild(a)}tryResolve(e,t,i){const n=i.lists[e.value];if(n?.length){let o=!1;if(t){const a=Uu(n,t,i);if(a.length){for(const s of a)this.addPropertyInstance(s,i,t);o=!0}}o||this.appendChild(fc(n,this,i))}else console.error("list for sh:or/sh:xone not found:",e,"existing lists:",i.lists)}}window.customElements.define("shacl-node",Gt);var Jt={},Kt={},Yt={},Nt={},nl;function ap(){if(nl)return Nt;nl=1,Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.removeDotSegmentsOfPath=Nt.removeDotSegments=Nt.resolve=void 0;function r(n,o){o=o||"";const a=o.indexOf("#");if(a>0&&(o=o.substr(0,a)),!n.length){if(o.indexOf(":")<0)throw new Error(`Found invalid baseIRI '${o}' for value '${n}'`);return o}if(n.startsWith("?")){const g=o.indexOf("?");return g>0&&(o=o.substr(0,g)),o+n}if(n.startsWith("#"))return o+n;if(!o.length){const g=n.indexOf(":");if(g<0)throw new Error(`Found invalid relative IRI '${n}' for a missing baseIRI`);return t(n,g)}const s=n.indexOf(":");if(s>=0)return t(n,s);const d=o.indexOf(":");if(d<0)throw new Error(`Found invalid baseIRI '${o}' for value '${n}'`);const l=o.substr(0,d+1);if(n.indexOf("//")===0)return l+t(n,s);let c;if(o.indexOf("//",d)===d+1){if(c=o.indexOf("/",d+3),c<0)return o.length>d+3?o+"/"+t(n,s):l+t(n,s)}else if(c=o.indexOf("/",d+1),c<0)return l+t(n,s);if(n.indexOf("/")===0)return o.substr(0,c)+e(n);let u=o.substr(c);const v=u.lastIndexOf("/");return v>=0&&v<u.length-1&&(u=u.substr(0,v+1),n[0]==="."&&n[1]!=="."&&n[1]!=="/"&&n[2]&&(n=n.substr(1))),n=u+n,n=e(n),o.substr(0,c)+n}Nt.resolve=r;function e(n){const o=[];let a=0;for(;a<n.length;)switch(n[a]){case"/":if(n[a+1]===".")if(n[a+2]==="."){if(!i(n[a+3])){o.push([]),a++;break}o.pop(),n[a+3]||o.push([]),a+=3}else{if(!i(n[a+2])){o.push([]),a++;break}n[a+2]||o.push([]),a+=2}else o.push([]),a++;break;case"#":case"?":o.length||o.push([]),o[o.length-1].push(n.substr(a)),a=n.length;break;default:o.length||o.push([]),o[o.length-1].push(n[a]),a++;break}return"/"+o.map(s=>s.join("")).join("/")}Nt.removeDotSegments=e;function t(n,o){let a=o+1;o>=0?n[o+1]==="/"&&n[o+2]==="/"&&(a=o+3):n[0]==="/"&&n[1]==="/"&&(a=2);const s=n.indexOf("/",a);if(s<0)return n;const d=n.substr(0,s),l=n.substr(s);return d+e(l)}Nt.removeDotSegmentsOfPath=t;function i(n){return!n||n==="#"||n==="?"||n==="/"}return Nt}var ol;function sp(){return ol||(ol=1,function(r){var e=Yt&&Yt.__createBinding||(Object.create?function(i,n,o,a){a===void 0&&(a=o),Object.defineProperty(i,a,{enumerable:!0,get:function(){return n[o]}})}:function(i,n,o,a){a===void 0&&(a=o),i[a]=n[o]}),t=Yt&&Yt.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),t(ap(),r)}(Yt)),Yt}var Zt={},Xn={},al;function lp(){return al||(al=1,function(r){/**
|
|
281
281
|
* Character classes and associated utilities for the 5th edition of XML 1.0.
|
|
282
282
|
*
|
|
283
283
|
* @author Louis-Dominique Dubeau
|
|
@@ -298,31 +298,31 @@ a, a:visited { color: inherit; }
|
|
|
298
298
|
* @author Louis-Dominique Dubeau
|
|
299
299
|
* @license MIT
|
|
300
300
|
* @copyright Louis-Dominique Dubeau
|
|
301
|
-
*/Object.defineProperty(r,"__esModule",{value:!0}),r.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",r.NC_NAME_CHAR="-"+r.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.NC_NAME_START_CHAR_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]$","u"),r.NC_NAME_CHAR_RE=new RegExp("^["+r.NC_NAME_CHAR+"]$","u"),r.NC_NAME_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]["+r.NC_NAME_CHAR+"]*$","u");function e(i){return i>=65&&i<=90||i===95||i>=97&&i<=122||i>=192&&i<=214||i>=216&&i<=246||i>=248&&i<=767||i>=880&&i<=893||i>=895&&i<=8191||i>=8204&&i<=8205||i>=8304&&i<=8591||i>=11264&&i<=12271||i>=12289&&i<=55295||i>=63744&&i<=64975||i>=65008&&i<=65533||i>=65536&&i<=983039}r.isNCNameStartChar=e;function t(i){return e(i)||i===45||i===46||i>=48&&i<=57||i===183||i>=768&&i<=879||i>=8255&&i<=8256}r.isNCNameChar=t}(Jn)),Jn}var dl;function up(){if(dl)return Zt;dl=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.SaxesParser=Zt.EVENTS=void 0;const r=lp(),e=dp(),t=cp();var i=r.isS,n=r.isChar,o=r.isNameStartChar,a=r.isNameChar,s=r.S_LIST,d=r.NAME_RE,l=e.isChar,c=t.isNCNameStartChar,u=t.isNCNameChar,v=t.NC_NAME_RE;const g="http://www.w3.org/XML/1998/namespace",y="http://www.w3.org/2000/xmlns/",k={__proto__:null,xml:g,xmlns:y},x={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},_=-1,E=-2,m=0,f=1,b=2,R=3,L=4,T=5,B=6,
|
|
301
|
+
*/Object.defineProperty(r,"__esModule",{value:!0}),r.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",r.NC_NAME_CHAR="-"+r.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.NC_NAME_START_CHAR_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]$","u"),r.NC_NAME_CHAR_RE=new RegExp("^["+r.NC_NAME_CHAR+"]$","u"),r.NC_NAME_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]["+r.NC_NAME_CHAR+"]*$","u");function e(i){return i>=65&&i<=90||i===95||i>=97&&i<=122||i>=192&&i<=214||i>=216&&i<=246||i>=248&&i<=767||i>=880&&i<=893||i>=895&&i<=8191||i>=8204&&i<=8205||i>=8304&&i<=8591||i>=11264&&i<=12271||i>=12289&&i<=55295||i>=63744&&i<=64975||i>=65008&&i<=65533||i>=65536&&i<=983039}r.isNCNameStartChar=e;function t(i){return e(i)||i===45||i===46||i>=48&&i<=57||i===183||i>=768&&i<=879||i>=8255&&i<=8256}r.isNCNameChar=t}(Jn)),Jn}var dl;function up(){if(dl)return Zt;dl=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.SaxesParser=Zt.EVENTS=void 0;const r=lp(),e=dp(),t=cp();var i=r.isS,n=r.isChar,o=r.isNameStartChar,a=r.isNameChar,s=r.S_LIST,d=r.NAME_RE,l=e.isChar,c=t.isNCNameStartChar,u=t.isNCNameChar,v=t.NC_NAME_RE;const g="http://www.w3.org/XML/1998/namespace",y="http://www.w3.org/2000/xmlns/",k={__proto__:null,xml:g,xmlns:y},x={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},_=-1,E=-2,m=0,f=1,b=2,R=3,L=4,T=5,B=6,I=7,$=8,q=9,A=10,j=11,te=12,N=13,Z=14,F=15,Y=16,w=17,U=18,K=19,X=20,de=21,H=22,G=23,W=24,z=25,ee=26,re=27,pe=28,be=29,O=30,V=31,oe=32,fe=33,he=34,me=35,J=36,ce=37,ge=38,le=39,Re=40,We=41,Ee=42,Qe=43,S=44,p=9,h=10,C=13,Q=32,se=33,ue=34,ke=38,Fe=39,je=45,De=47,Ae=59,bt=60,Ft=61,qe=62,ze=63,Ni=91,Pt=93,hr=133,Fr=8232,D=Ge=>Ge===ue||Ge===Fe,M=[ue,Fe],ve=[...M,Ni,qe],ye=[...M,bt,Pt],xe=[Ft,ze,...s],Xe=[...s,qe,ke,bt];function Ze(Ge,P,ie){switch(P){case"xml":ie!==g&&Ge.fail(`xml prefix must be bound to ${g}.`);break;case"xmlns":ie!==y&&Ge.fail(`xmlns prefix must be bound to ${y}.`);break}switch(ie){case y:Ge.fail(P===""?`the default namespace may not be set to ${ie}.`:`may not assign a prefix (even "xmlns") to the URI ${y}.`);break;case g:switch(P){case"xml":break;case"":Ge.fail(`the default namespace may not be set to ${ie}.`);break;default:Ge.fail("may not assign the xml namespace to another prefix.")}break}}function Ti(Ge,P){for(const ie of Object.keys(P))Ze(Ge,ie,P[ie])}const Rt=Ge=>v.test(Ge),Ai=Ge=>d.test(Ge),It=0,Pr=1,br=2;Zt.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];const mr={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"};class Mr{get closed(){return this._closed}constructor(P){this.opt=P??{},this.fragmentOpt=!!this.opt.fragment;const ie=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,ie){this.nameStartCheck=c,this.nameCheck=u,this.isName=Rt,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},k);const ne=this.opt.additionalNamespaces;ne!=null&&(Ti(this,ne),Object.assign(this.ns,ne))}else this.nameStartCheck=o,this.nameCheck=a,this.isName=Ai,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}_init(){var P;this.openWakaBang="",this.text="",this.name="",this.piTarget="",this.entity="",this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk="",this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=It,this.attribList=[];const{fragmentOpt:ie}=this;this.state=ie?N:m,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=ie,this.xmlDeclPossible=!ie,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:ne}=this.opt;if(ne===void 0){if(this.opt.forceXMLVersion===!0)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");ne="1.0"}this.setXMLVersion(ne),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(x),(P=this.readyHandler)===null||P===void 0||P.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(P,ie){this[mr[P]]=ie}off(P){this[mr[P]]=void 0}makeError(P){var ie;let ne=(ie=this.fileName)!==null&&ie!==void 0?ie:"";return this.trackPosition&&(ne.length>0&&(ne+=":"),ne+=`${this.line}:${this.column}`),ne.length>0&&(ne+=": "),new Error(ne+P)}fail(P){const ie=this.makeError(P),ne=this.errorHandler;if(ne===void 0)throw ie;return ne(ie),this}write(P){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let ie=!1;P===null?(ie=!0,P=""):typeof P=="object"&&(P=P.toString()),this.carriedFromPrevious!==void 0&&(P=`${this.carriedFromPrevious}${P}`,this.carriedFromPrevious=void 0);let ne=P.length;const we=P.charCodeAt(ne-1);!ie&&(we===C||we>=55296&&we<=56319)&&(this.carriedFromPrevious=P[ne-1],ne--,P=P.slice(0,ne));const{stateTable:Te}=this;for(this.chunk=P,this.i=0;this.i<ne;)Te[this.state].call(this);return this.chunkPosition+=ne,ie?this.end():this}close(){return this.write(null)}getCode10(){const{chunk:P,i:ie}=this;if(this.prevI=ie,this.i=ie+1,ie>=P.length)return _;const ne=P.charCodeAt(ie);if(this.column++,ne<55296){if(ne>=Q||ne===p)return ne;switch(ne){case h:return this.line++,this.column=0,this.positionAtNewLine=this.position,h;case C:return P.charCodeAt(ie+1)===h&&(this.i=ie+2),this.line++,this.column=0,this.positionAtNewLine=this.position,E;default:return this.fail("disallowed character."),ne}}if(ne>56319)return ne>=57344&&ne<=65533||this.fail("disallowed character."),ne;const we=65536+(ne-55296)*1024+(P.charCodeAt(ie+1)-56320);return this.i=ie+2,we>1114111&&this.fail("disallowed character."),we}getCode11(){const{chunk:P,i:ie}=this;if(this.prevI=ie,this.i=ie+1,ie>=P.length)return _;const ne=P.charCodeAt(ie);if(this.column++,ne<55296){if(ne>31&&ne<127||ne>159&&ne!==Fr||ne===p)return ne;switch(ne){case h:return this.line++,this.column=0,this.positionAtNewLine=this.position,h;case C:{const Te=P.charCodeAt(ie+1);(Te===h||Te===hr)&&(this.i=ie+2)}case hr:case Fr:return this.line++,this.column=0,this.positionAtNewLine=this.position,E;default:return this.fail("disallowed character."),ne}}if(ne>56319)return ne>=57344&&ne<=65533||this.fail("disallowed character."),ne;const we=65536+(ne-55296)*1024+(P.charCodeAt(ie+1)-56320);return this.i=ie+2,we>1114111&&this.fail("disallowed character."),we}getCodeNorm(){const P=this.getCode();return P===E?h:P}unget(){this.i=this.prevI,this.column--}captureTo(P){let{i:ie}=this;const{chunk:ne}=this;for(;;){const we=this.getCode(),Te=we===E,Le=Te?h:we;if(Le===_||P.includes(Le))return this.text+=ne.slice(ie,this.prevI),Le;Te&&(this.text+=`${ne.slice(ie,this.prevI)}
|
|
302
302
|
`,ie=this.i)}}captureToChar(P){let{i:ie}=this;const{chunk:ne}=this;for(;;){let we=this.getCode();switch(we){case E:this.text+=`${ne.slice(ie,this.prevI)}
|
|
303
|
-
`,ie=this.i,we=h;break;case _:return this.text+=ne.slice(ie),!1}if(we===P)return this.text+=ne.slice(ie,this.prevI),!0}}captureNameChars(){const{chunk:P,i:ie}=this;for(;;){const ne=this.getCode();if(ne===_)return this.name+=P.slice(ie),_;if(!a(ne))return this.name+=P.slice(ie,this.prevI),ne===E?h:ne}}skipSpaces(){for(;;){const P=this.getCodeNorm();if(P===_||!i(P))return P}}setXMLVersion(P){this.currentXMLVersion=P,P==="1.0"?(this.isChar=n,this.getCode=this.getCode10):(this.isChar=l,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=f}sBeginWhitespace(){const P=this.i,ie=this.skipSpaces();switch(this.prevI!==P&&(this.xmlDeclPossible=!1),ie){case bt:if(this.state=F,this.text.length!==0)throw new Error("no-empty text at start");break;case _:break;default:this.unget(),this.state=
|
|
304
|
-
`,P=this.i;break;case Ae:{const{entityReturnState:ne}=this,we=this.entity+ie.slice(P,this.prevI);this.state=ne;let Te;we===""?(this.fail("empty entity name."),Te="&;"):(Te=this.parseEntity(we),this.entity=""),(ne!==
|
|
305
|
-
`),P=this.i,ie=
|
|
306
|
-
`),P=this.i;break;case _:ne!==void 0&&(this.text+=ie.slice(P));break e;default:i(Te)||(we=!0)}}we&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0))}pushAttribNS(P,ie){var ne;const{prefix:we,local:Te}=this.qname(P),Le={name:P,prefix:we,local:Te,value:ie};if(this.attribList.push(Le),(ne=this.attributeHandler)===null||ne===void 0||ne.call(this,Le),we==="xmlns"){const et=ie.trim();this.currentXMLVersion==="1.0"&&et===""&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[Te]=et,Ze(this,Te,et)}else if(P==="xmlns"){const et=ie.trim();this.topNS[""]=et,Ze(this,"",et)}}pushAttribPlain(P,ie){var ne;const we={name:P,value:ie};this.attribList.push(we),(ne=this.attributeHandler)===null||ne===void 0||ne.call(this,we)}end(){var P,ie;this.sawRoot||this.fail("document must contain a root element.");const{tags:ne}=this;for(;ne.length>0;){const Te=ne.pop();this.fail(`unclosed tag: ${Te.name}`)}this.state!==m&&this.state!==I&&this.fail("unexpected end.");const{text:we}=this;return we.length!==0&&((P=this.textHandler)===null||P===void 0||P.call(this,we),this.text=""),this._closed=!0,(ie=this.endHandler)===null||ie===void 0||ie.call(this),this._init(),this}resolve(P){var ie,ne;let we=this.topNS[P];if(we!==void 0)return we;const{tags:Te}=this;for(let Le=Te.length-1;Le>=0;Le--)if(we=Te[Le].ns[P],we!==void 0)return we;return we=this.ns[P],we!==void 0?we:(ne=(ie=this.opt).resolvePrefix)===null||ne===void 0?void 0:ne.call(ie,P)}qname(P){const ie=P.indexOf(":");if(ie===-1)return{prefix:"",local:P};const ne=P.slice(ie+1),we=P.slice(0,ie);return(we===""||ne===""||ne.includes(":"))&&this.fail(`malformed name: ${P}.`),{prefix:we,local:ne}}processAttribsNS(){var P;const{attribList:ie}=this,ne=this.tag;{const{prefix:Le,local:et}=this.qname(ne.name);ne.prefix=Le,ne.local=et;const gr=ne.uri=(P=this.resolve(Le))!==null&&P!==void 0?P:"";Le!==""&&(Le==="xmlns"&&this.fail('tags may not have "xmlns" as prefix.'),gr===""&&(this.fail(`unbound namespace prefix: ${JSON.stringify(Le)}.`),ne.uri=Le))}if(ie.length===0)return;const{attributes:we}=ne,Te=new Set;for(const Le of ie){const{name:et,prefix:gr,local:tu}=Le;let vr,Br;gr===""?(vr=et==="xmlns"?y:"",Br=et):(vr=this.resolve(gr),vr===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(gr)}.`),vr=gr),Br=`{${vr}}${tu}`),Te.has(Br)&&this.fail(`duplicate attribute: ${Br}.`),Te.add(Br),Le.uri=vr,we[et]=Le}this.attribList=[]}processAttribsPlain(){const{attribList:P}=this,ie=this.tag.attributes;for(const{name:ne,value:we}of P)ie[ne]!==void 0&&this.fail(`duplicate attribute: ${ne}.`),ie[ne]=we;this.attribList=[]}openTag(){var P;this.processAttribs();const{tags:ie}=this,ne=this.tag;ne.isSelfClosing=!1,(P=this.openTagHandler)===null||P===void 0||P.call(this,ne),ie.push(ne),this.state=I,this.name=""}openSelfClosingTag(){var P,ie,ne;this.processAttribs();const{tags:we}=this,Te=this.tag;Te.isSelfClosing=!0,(P=this.openTagHandler)===null||P===void 0||P.call(this,Te),(ie=this.closeTagHandler)===null||ie===void 0||ie.call(this,Te),(this.tag=(ne=we[we.length-1])!==null&&ne!==void 0?ne:null)===null&&(this.closedRoot=!0),this.state=I,this.name=""}closeTag(){const{tags:P,name:ie}=this;if(this.state=I,this.name="",ie===""){this.fail("weird empty close tag."),this.text+="</>";return}const ne=this.closeTagHandler;let we=P.length;for(;we-- >0;){const Te=this.tag=P.pop();if(this.topNS=Te.ns,ne?.(Te),Te.name===ie)break;this.fail("unexpected close tag.")}we===0?this.closedRoot=!0:we<0&&(this.fail(`unmatched closing tag: ${ie}.`),this.text+=`</${ie}>`)}parseEntity(P){if(P[0]!=="#"){const ne=this.ENTITIES[P];return ne!==void 0?ne:(this.fail(this.isName(P)?"undefined entity.":"disallowed character in entity name."),`&${P};`)}let ie=NaN;return P[1]==="x"&&/^#x[0-9a-f]+$/i.test(P)?ie=parseInt(P.slice(2),16):/^#[0-9]+$/.test(P)&&(ie=parseInt(P.slice(1),10)),this.isChar(ie)?String.fromCodePoint(ie):(this.fail("malformed character entity."),`&${P};`)}}return Zt.SaxesParser=Mr,Zt}var Qr={},cl;function fp(){if(cl)return Qr;cl=1,Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.ParseError=void 0;let r=class extends Error{constructor(t,i){const n=t.saxParser;super(t.trackPosition?`Line ${n.line} column ${n.column+1}: ${i}`:i)}};return Qr.ParseError=r,Qr}var er={},Jr={},ul;function Dc(){if(ul)return Jr;ul=1,Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.BlankNode=void 0;class r{constructor(t){this.termType="BlankNode",this.value=t}equals(t){return!!t&&t.termType==="BlankNode"&&t.value===this.value}}return Jr.BlankNode=r,Jr}var Kr={},Yr={},fl;function Lc(){if(fl)return Yr;fl=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.DefaultGraph=void 0;class r{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&t.termType==="DefaultGraph"}}return Yr.DefaultGraph=r,r.INSTANCE=new r,Yr}var Zr={},ei={},pl;function $a(){if(pl)return ei;pl=1,Object.defineProperty(ei,"__esModule",{value:!0}),ei.NamedNode=void 0;class r{constructor(t){this.termType="NamedNode",this.value=t}equals(t){return!!t&&t.termType==="NamedNode"&&t.value===this.value}}return ei.NamedNode=r,ei}var hl;function Oc(){if(hl)return Zr;hl=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.Literal=void 0;const r=$a();class e{constructor(i,n){this.termType="Literal",this.value=i,typeof n=="string"?(this.language=n,this.datatype=e.RDF_LANGUAGE_STRING,this.direction=""):n?"termType"in n?(this.language="",this.datatype=n,this.direction=""):(this.language=n.language,this.datatype=n.direction?e.RDF_DIRECTIONAL_LANGUAGE_STRING:e.RDF_LANGUAGE_STRING,this.direction=n.direction||""):(this.language="",this.datatype=e.XSD_STRING,this.direction="")}equals(i){return!!i&&i.termType==="Literal"&&i.value===this.value&&i.language===this.language&&(i.direction===this.direction||!i.direction&&this.direction==="")&&this.datatype.equals(i.datatype)}}return Zr.Literal=e,e.RDF_LANGUAGE_STRING=new r.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),e.RDF_DIRECTIONAL_LANGUAGE_STRING=new r.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),e.XSD_STRING=new r.NamedNode("http://www.w3.org/2001/XMLSchema#string"),Zr}var ti={},bl;function Cc(){if(bl)return ti;bl=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.Quad=void 0;class r{constructor(t,i,n,o){this.termType="Quad",this.value="",this.subject=t,this.predicate=i,this.object=n,this.graph=o}equals(t){return!!t&&(t.termType==="Quad"||!t.termType)&&this.subject.equals(t.subject)&&this.predicate.equals(t.predicate)&&this.object.equals(t.object)&&this.graph.equals(t.graph)}}return ti.Quad=r,ti}var ri={},ml;function $c(){if(ml)return ri;ml=1,Object.defineProperty(ri,"__esModule",{value:!0}),ri.Variable=void 0;class r{constructor(t){this.termType="Variable",this.value=t}equals(t){return!!t&&t.termType==="Variable"&&t.value===this.value}}return ri.Variable=r,ri}var gl;function pp(){if(gl)return Kr;gl=1,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.DataFactory=void 0;const r=Dc(),e=Lc(),t=Oc(),i=$a(),n=Cc(),o=$c();let a=0;class s{constructor(l){this.blankNodeCounter=0,l=l||{},this.blankNodePrefix=l.blankNodePrefix||`df_${a++}_`}namedNode(l){return new i.NamedNode(l)}blankNode(l){return new r.BlankNode(l||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(l,c){return new t.Literal(l,c)}variable(l){return new o.Variable(l)}defaultGraph(){return e.DefaultGraph.INSTANCE}quad(l,c,u,v){return new n.Quad(l,c,u,v||this.defaultGraph())}fromTerm(l){switch(l.termType){case"NamedNode":return this.namedNode(l.value);case"BlankNode":return this.blankNode(l.value);case"Literal":return l.language?this.literal(l.value,l.language):l.datatype.equals(t.Literal.XSD_STRING)?this.literal(l.value):this.literal(l.value,this.fromTerm(l.datatype));case"Variable":return this.variable(l.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(l.subject),this.fromTerm(l.predicate),this.fromTerm(l.object),this.fromTerm(l.graph))}}fromQuad(l){return this.fromTerm(l)}resetBlankNodeCounter(){this.blankNodeCounter=0}}return Kr.DataFactory=s,Kr}var vl;function Fc(){return vl||(vl=1,function(r){var e=er&&er.__createBinding||(Object.create?function(i,n,o,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(n,o);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[o]}}),Object.defineProperty(i,a,s)}:function(i,n,o,a){a===void 0&&(a=o),i[a]=n[o]}),t=er&&er.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),t(Dc(),r),t(pp(),r),t(Lc(),r),t(Oc(),r),t($a(),r),t(Cc(),r),t($c(),r)}(er)),er}var tr={},Kn={},yl;function hp(){return yl||(yl=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.validateIri=r.IriValidationStrategy=void 0;function e(){const s="[!$&'()*+,;=]",d="%[a-fA-F0-9]{2}",l="([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",c=`${l}\\.${l}\\.${l}\\.${l}`,u="[a-fA-F0-9]{1,4}",v=`(${u}:${u}|${c})`,g=`((${u}:){6}${v}|::(${u}:){5}${v}|(${u})?::(${u}:){4}${v}|((${u}:){0,1}${u})?::(${u}:){3}${v}|((${u}:){0,2}${u})?::(${u}:){2}${v}|((${u}:){0,3}${u})?::${u}:${v}|((${u}:){0,4}${u})?::${v}|((${u}:){0,5}${u})?::${u}|((${u}:){0,6}${u})?::)`,y=`v[a-fA-F0-9]+\\.(${s}|${s}|":)+`,k=`\\[(${g}|${y})\\]`,x="[0-9]*",_="[a-zA-Z][a-zA-Z0-9+\\-.]*",m="[---]",R="[a-zA-Z0-9\\-._~ -豈-﷏ﷰ-𐀀-𠀀-𰀀------------]",L=`(${R}|${d}|${s}|[:@])*`,T=`(${L}|[\\/?])*`,B=`(${L}|${m}|[\\/?])*`,N=`(${L})+`,$=`(${L})*`,q="",A=`${N}(\\/${$})*`,j=`\\/(${N}(\\/${$})*)?`,te=`(\\/${$})*`,I=`(${R}|${d}|${s})*`,Z=`(${k}|${c}|${I})`,w=`(\\/\\/${`(${`(${R}|${d}|${s}|:)*`}@)?${Z}(:${x})?`}${te}|${j}|${A}|${q})`,U=`^${_}:${w}(\\?${B})?(#${T})?$`;return new RegExp(U,"u")}const t=e(),i=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u;var n;(function(a){a.Strict="strict",a.Pragmatic="pragmatic",a.None="none"})(n=r.IriValidationStrategy||(r.IriValidationStrategy={}));function o(a,s=n.Strict){switch(s){case n.Strict:return t.test(a)?void 0:new Error(`Invalid IRI according to RFC 3987: '${a}'`);case n.Pragmatic:return i.test(a)?void 0:new Error(`Invalid IRI according to RDF Turtle: '${a}'`);case n.None:return;default:return new Error(`Not supported validation strategy "${s}"`)}}r.validateIri=o}(Kn)),Kn}var wl;function bp(){return wl||(wl=1,function(r){var e=tr&&tr.__createBinding||(Object.create?function(i,n,o,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(n,o);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[o]}}),Object.defineProperty(i,a,s)}:function(i,n,o,a){a===void 0&&(a=o),i[a]=n[o]}),t=tr&&tr.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),t(hp(),r)}(tr)),tr}var xl;function mp(){if(xl)return Kt;xl=1,Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.ParseType=Kt.RdfXmlParser=void 0;const r=sp(),e=up(),t=sc(),i=fp(),n=Fc(),o=bp();let a=class Ce extends t.Transform{constructor(l){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},l&&(Object.assign(this,l),this.options=l),this.dataFactory||(this.dataFactory=new n.DataFactory),this.baseIRI||(this.baseIRI=""),this.defaultGraph||(this.defaultGraph=this.dataFactory.defaultGraph()),this.validateUri!==!1&&(this.validateUri=!0),this.iriValidationStrategy||(this.iriValidationStrategy=this.validateUri?o.IriValidationStrategy.Pragmatic:o.IriValidationStrategy.None),this.saxParser=new e.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(l){const c=new t.PassThrough({readableObjectMode:!0});l.on("error",v=>u.emit("error",v)),l.on("data",v=>c.push(v)),l.on("end",()=>c.push(null));const u=c.pipe(new Ce(this.options));return u}_transform(l,c,u){try{this.saxParser.write(l)}catch(v){return u(v)}u()}newParseError(l){return new i.ParseError(this,l)}valueToUri(l,c){return this.uriToNamedNode((0,r.resolve)(l,c.baseIRI))}uriToNamedNode(l){const c=(0,o.validateIri)(l,this.iriValidationStrategy);if(c instanceof Error)throw this.newParseError(c.message);return this.dataFactory.namedNode(l)}validateNcname(l){if(!Ce.NCNAME_MATCHER.test(l))throw this.newParseError(`Not a valid NCName: ${l}`)}createLiteral(l,c){return this.dataFactory.literal(l,c.datatype?c.datatype:c.language?{language:c.language,direction:c.rdfVersion?c.direction:void 0}:void 0)}attachSaxListeners(){this.saxParser.on("error",l=>this.emit("error",l)),this.saxParser.on("opentag",this.onTag.bind(this)),this.saxParser.on("text",this.onText.bind(this)),this.saxParser.on("cdata",this.onText.bind(this)),this.saxParser.on("closetag",this.onCloseTag.bind(this)),this.saxParser.on("doctype",this.onDoctype.bind(this))}onTag(l){const c=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;let u=s.RESOURCE;if(c&&(c.hadChildren=!0,u=c.childrenParseType),c&&c.childrenStringTags){const g=l.name;let y="";for(const{key:E,value:m}of c.namespaces||[])y+=` ${E}="${m}"`;for(const E in l.attributes)y+=` ${E}="${l.attributes[E].value}"`;const x=`<${`${g}${y}`}>`;c.childrenStringTags.push(x);const _={childrenStringTags:c.childrenStringTags};_.childrenStringEmitClosingTag=`</${g}>`,this.activeTagStack.push(_);return}const v={};c?(v.language=c.language,v.direction=c.direction,v.baseIRI=c.baseIRI,v.childrenTripleTerms=c.childrenTripleTerms,v.rdfVersion=c.rdfVersion):v.baseIRI=this.baseIRI,this.activeTagStack.push(v),u===s.RESOURCE?this.onTagResource(l,v,c,!c):this.onTagProperty(l,v,c);for(const g in l.attributes){const y=l.attributes[g];y.prefix==="xmlns"&&(v.namespaces||(v.namespaces=[]),v.namespaces.push({key:`${y.prefix}:${y.local}`,value:y.value}))}c&&c.namespaces&&(v.namespaces=[...v.namespaces||[],...c.namespaces])}onTagResource(l,c,u,v){c.childrenParseType=s.PROPERTY;let g=!0;if(l.uri===Ce.RDF){if(!v&&Ce.FORBIDDEN_NODE_ELEMENTS.indexOf(l.local)>=0)throw this.newParseError(`Illegal node element name: ${l.local}`);switch(l.local){case"RDF":c.childrenParseType=s.RESOURCE;case"Description":g=!1}}const y=[],k=[];let x=null,_=!1,E=!1,m=null;for(const f in l.attributes){const b=l.attributes[f];if(b.uri===Ce.RDF&&b.local==="version"){this.setVersion(c,b.value);continue}else if(u&&b.uri===Ce.RDF)switch(b.local){case"about":if(x)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${b.value} and ${x} where found.`);x=b.value;continue;case"ID":if(x)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${b.value} and ${x} where found.`);this.validateNcname(b.value),x="#"+b.value,_=!0;continue;case"nodeID":if(x)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${b.value} and ${x} where found.`);this.validateNcname(b.value),x=b.value,E=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"type":m=b.value;continue;case"aboutEach":throw this.newParseError("rdf:aboutEach is not supported.");case"aboutEachPrefix":throw this.newParseError("rdf:aboutEachPrefix is not supported.");case"li":throw this.newParseError("rdf:li on node elements are not supported.")}else if(b.uri===Ce.XML){if(b.local==="lang"){c.language=b.value===""?null:b.value.toLowerCase();continue}else if(b.local==="base"){c.baseIRI=(0,r.resolve)(b.value,c.baseIRI);continue}}else if(b.uri===Ce.ITS&&b.local==="dir"){this.setDirection(c,b.value);continue}b.prefix!=="xml"&&b.prefix!=="xmlns"&&(b.prefix!==""||b.local!=="xmlns")&&b.uri&&(y.push(this.uriToNamedNode(b.uri+b.local)),k.push(b.value))}if(x!==null&&(c.subject=E?this.dataFactory.blankNode(x):this.valueToUri(x,c),_&&this.claimNodeId(c.subject)),c.subject||(c.subject=this.dataFactory.blankNode()),g){const f=this.uriToNamedNode(l.uri+l.local);this.emitTriple(c.subject,this.dataFactory.namedNode(Ce.RDF+"type"),f,u?u.reifiedStatementId:null,c.childrenTripleTerms,c.reifier)}if(u){if(u.predicate)if(u.childrenCollectionSubject){const f=this.dataFactory.blankNode(),b=this.dataFactory.namedNode(Ce.RDF+"rest"),R=u.childrenCollectionPredicate.equals(b);this.emitTriple(u.childrenCollectionSubject,u.childrenCollectionPredicate,f,R?null:u.reifiedStatementId,u.childrenTripleTerms,R?null:u.reifier),this.emitTriple(f,this.dataFactory.namedNode(Ce.RDF+"first"),c.subject,null,c.childrenTripleTerms),u.childrenCollectionSubject=f,u.childrenCollectionPredicate=b}else{u.childrenTagsToTripleTerms||(this.emitTriple(u.subject,u.predicate,c.subject,u.reifiedStatementId,u.childrenTripleTerms,u.reifier),u.predicateEmitted=!0);for(let f=0;f<u.predicateSubPredicates.length;f++)this.emitTriple(c.subject,u.predicateSubPredicates[f],u.predicateSubObjects[f],null,u.childrenTripleTerms,u.reifier);u.predicateSubPredicates=[],u.predicateSubObjects=[]}for(let f=0;f<y.length;f++){const b=this.createLiteral(k[f],c);this.emitTriple(c.subject,y[f],b,u.reifiedStatementId,u.childrenTripleTerms,u.reifier)}m&&this.emitTriple(c.subject,this.dataFactory.namedNode(Ce.RDF+"type"),this.uriToNamedNode(m),null,c.childrenTripleTerms,c.reifier)}}onTagProperty(l,c,u){if(c.childrenParseType=s.RESOURCE,c.subject=u.subject,l.uri===Ce.RDF&&l.local==="li"?(u.listItemCounter||(u.listItemCounter=1),c.predicate=this.uriToNamedNode(l.uri+"_"+u.listItemCounter++)):c.predicate=this.uriToNamedNode(l.uri+l.local),l.uri===Ce.RDF&&Ce.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(l.local)>=0)throw this.newParseError(`Illegal property element name: ${l.local}`);c.predicateSubPredicates=[],c.predicateSubObjects=[];let v=!1,g=!1,y=null,k=!0;const x=[],_=[];for(const E in l.attributes){const m=l.attributes[E];if(m.uri===Ce.RDF&&m.local==="version"){this.setVersion(c,m.value);continue}else if(m.uri===Ce.RDF)switch(m.local){case"resource":if(y)throw this.newParseError(`Found both rdf:resource (${m.value}) and rdf:nodeID (${y}).`);if(v)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${m.value})`);c.hadChildren=!0,y=m.value,k=!1;continue;case"datatype":if(g)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${m.value}).`);if(v)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${m.value})`);c.datatype=this.valueToUri(m.value,c);continue;case"nodeID":if(g)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${m.value}).`);if(c.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${m.value}).`);if(v)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${m.value})`);this.validateNcname(m.value),c.hadChildren=!0,y=m.value,k=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"parseType":if(g)throw this.newParseError("rdf:parseType is not allowed when non-rdf:* property attributes are present");if(c.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${c.datatype.value})`);if(y)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${y})`);if(m.value==="Resource"){v=!0,c.childrenParseType=s.PROPERTY;const f=this.dataFactory.blankNode();this.emitTriple(c.subject,c.predicate,f,c.reifiedStatementId,c.childrenTripleTerms,c.reifier),c.subject=f,c.predicate=null}else m.value==="Collection"?(v=!0,c.hadChildren=!0,c.childrenCollectionSubject=c.subject,c.childrenCollectionPredicate=c.predicate,k=!1):m.value==="Literal"?(v=!0,c.childrenTagsToString=!0,c.childrenStringTags=[]):m.value==="Triple"&&(v=!0,c.childrenTagsToTripleTerms=!0,c.childrenTripleTerms=[]);continue;case"ID":this.validateNcname(m.value),c.reifiedStatementId=this.valueToUri("#"+m.value,c),this.claimNodeId(c.reifiedStatementId);continue;case"annotation":c.reifier=this.dataFactory.namedNode(m.value);continue;case"annotationNodeID":c.reifier=this.dataFactory.blankNode(m.value);continue}else if(m.uri===Ce.XML&&m.local==="lang"){c.language=m.value===""?null:m.value.toLowerCase();continue}else if(m.uri===Ce.ITS&&m.local==="dir"){this.setDirection(c,m.value);continue}else if(m.uri===Ce.ITS&&m.local==="version")continue;if(m.prefix!=="xml"&&m.prefix!=="xmlns"&&(m.prefix!==""||m.local!=="xmlns")&&m.uri){if(v||c.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${m.value}`);c.hadChildren=!0,g=!0,x.push(this.uriToNamedNode(m.uri+m.local)),_.push(this.createLiteral(m.value,c))}}if(y!==null){const E=c.subject;c.subject=k?this.dataFactory.blankNode(y):this.valueToUri(y,c),this.emitTriple(E,c.predicate,c.subject,c.reifiedStatementId,c.childrenTripleTerms,c.reifier);for(let m=0;m<x.length;m++)this.emitTriple(c.subject,x[m],_[m],null,c.childrenTripleTerms,c.reifier);c.predicateEmitted=!0}else k&&(c.predicateSubPredicates=x,c.predicateSubObjects=_,c.predicateEmitted=!1)}emitTriple(l,c,u,v,g,y){const k=this.dataFactory.quad(l,c,u,this.defaultGraph);g?g.push(k):this.push(k),y&&this.push(this.dataFactory.quad(y,this.dataFactory.namedNode(Ce.RDF+"reifies"),k)),v&&(this.push(this.dataFactory.quad(v,this.dataFactory.namedNode(Ce.RDF+"type"),this.dataFactory.namedNode(Ce.RDF+"Statement"),this.defaultGraph)),this.push(this.dataFactory.quad(v,this.dataFactory.namedNode(Ce.RDF+"subject"),l,this.defaultGraph)),this.push(this.dataFactory.quad(v,this.dataFactory.namedNode(Ce.RDF+"predicate"),c,this.defaultGraph)),this.push(this.dataFactory.quad(v,this.dataFactory.namedNode(Ce.RDF+"object"),u,this.defaultGraph)))}claimNodeId(l){if(!this.allowDuplicateRdfIds){if(this.nodeIds[l.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${l.value}'.`);this.nodeIds[l.value]=!0}}onText(l){const c=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;c&&(c.childrenStringTags?c.childrenStringTags.push(l):c.predicate&&(c.text=l))}onCloseTag(){const l=this.activeTagStack.pop(),c=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;if(l.childrenStringEmitClosingTag&&l.childrenStringTags.push(l.childrenStringEmitClosingTag),l.childrenTagsToString&&(l.datatype=this.dataFactory.namedNode(Ce.RDF+"XMLLiteral"),l.text=l.childrenStringTags.join(""),l.hadChildren=!1),l.childrenTagsToTripleTerms&&l.predicate&&l.rdfVersion){if(l.childrenTripleTerms.length!==1)throw this.newParseError(`Expected exactly one triple term in rdf:parseType="Triple" but got ${l.childrenTripleTerms.length}`);for(const u of l.childrenTripleTerms)this.emitTriple(l.subject,l.predicate,u,null,c.childrenTripleTerms,c.reifier);l.predicateEmitted=!0}if(l.childrenCollectionSubject)this.emitTriple(l.childrenCollectionSubject,l.childrenCollectionPredicate,this.dataFactory.namedNode(Ce.RDF+"nil"),null,l.childrenTripleTerms);else if(l.predicate){if(!l.hadChildren&&l.childrenParseType!==s.PROPERTY)this.emitTriple(l.subject,l.predicate,this.createLiteral(l.text||"",l),l.reifiedStatementId,l.childrenTripleTerms,l.reifier);else if(!l.predicateEmitted){const u=this.dataFactory.blankNode();this.emitTriple(l.subject,l.predicate,u,l.reifiedStatementId,l.childrenTripleTerms,l.reifier);for(let v=0;v<l.predicateSubPredicates.length;v++)this.emitTriple(u,l.predicateSubPredicates[v],l.predicateSubObjects[v],null,l.childrenTripleTerms)}}}onDoctype(l){l.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(c,u,v)=>(this.saxParser.ENTITIES[u]=v,""))}setDirection(l,c){if(c){if(c!=="ltr"&&c!=="rtl")throw this.newParseError(`Base directions must either be 'ltr' or 'rtl', while '${c}' was found.`);l.direction=c}else delete l.direction}setVersion(l,c){l.rdfVersion=c,this.emit("version",c)}};Kt.RdfXmlParser=a,a.MIME_TYPE="application/rdf+xml",a.RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#",a.XML="http://www.w3.org/XML/1998/namespace",a.ITS="http://www.w3.org/2005/11/its",a.FORBIDDEN_NODE_ELEMENTS=["RDF","ID","about","bagID","parseType","resource","nodeID","li","aboutEach","aboutEachPrefix"],a.FORBIDDEN_PROPERTY_ELEMENTS=["Description","RDF","ID","about","bagID","parseType","resource","nodeID","aboutEach","aboutEachPrefix"],a.NCNAME_MATCHER=/^([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_])([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_\-.0-9#xB7\u{0300}-\u{036F}\u{203F}-\u{2040}])*$/u;var s;return function(d){d[d.RESOURCE=0]="RESOURCE",d[d.PROPERTY=1]="PROPERTY"}(s||(Kt.ParseType=s={})),Kt}var _l;function gp(){return _l||(_l=1,function(r){var e=Jt&&Jt.__createBinding||(Object.create?function(i,n,o,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(n,o);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[o]}}),Object.defineProperty(i,a,s)}:function(i,n,o,a){a===void 0&&(a=o),i[a]=n[o]}),t=Jt&&Jt.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),t(mp(),r)}(Jt)),Jt}var vp=gp(),Yn={},Zn,kl;function Fa(){return kl||(kl=1,Zn=class Pc{constructor(e,t=new Map,i=0){this.prefix=e,this._existing=t,this.counter=i}clone(){const{prefix:e,_existing:t,counter:i}=this;return new Pc(e,new Map(t),i)}getId(e){const t=e&&this._existing.get(e);if(t)return t;const i=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,i),i}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}}),Zn}var eo={},El;function yp(){return El||(El=1,function(r,e){if(r.setImmediate)return;var t=1,i={},n=!1,o=r.document,a;function s(E){typeof E!="function"&&(E=new Function(""+E));for(var m=new Array(arguments.length-1),f=0;f<m.length;f++)m[f]=arguments[f+1];var b={callback:E,args:m};return i[t]=b,a(t),t++}function d(E){delete i[E]}function l(E){var m=E.callback,f=E.args;switch(f.length){case 0:m();break;case 1:m(f[0]);break;case 2:m(f[0],f[1]);break;case 3:m(f[0],f[1],f[2]);break;default:m.apply(e,f);break}}function c(E){if(n)setTimeout(c,0,E);else{var m=i[E];if(m){n=!0;try{l(m)}finally{d(E),n=!1}}}}function u(){a=function(E){process.nextTick(function(){c(E)})}}function v(){if(r.postMessage&&!r.importScripts){var E=!0,m=r.onmessage;return r.onmessage=function(){E=!1},r.postMessage("","*"),r.onmessage=m,E}}function g(){var E="setImmediate$"+Math.random()+"$",m=function(f){f.source===r&&typeof f.data=="string"&&f.data.indexOf(E)===0&&c(+f.data.slice(E.length))};r.addEventListener?r.addEventListener("message",m,!1):r.attachEvent("onmessage",m),a=function(f){r.postMessage(E+f,"*")}}function y(){var E=new MessageChannel;E.port1.onmessage=function(m){var f=m.data;c(f)},a=function(m){E.port2.postMessage(m)}}function k(){var E=o.documentElement;a=function(m){var f=o.createElement("script");f.onreadystatechange=function(){c(m),f.onreadystatechange=null,E.removeChild(f),f=null},E.appendChild(f)}}function x(){a=function(E){setTimeout(c,0,E)}}var _=Object.getPrototypeOf&&Object.getPrototypeOf(r);_=_&&_.setTimeout?_:r,{}.toString.call(r.process)==="[object process]"?u():v()?g():r.MessageChannel?y():o&&"onreadystatechange"in o.createElement("script")?k():x(),_.setImmediate=s,_.clearImmediate=d}(typeof self>"u"?typeof kr>"u"?eo:kr:self)),eo}/*!
|
|
303
|
+
`,ie=this.i,we=h;break;case _:return this.text+=ne.slice(ie),!1}if(we===P)return this.text+=ne.slice(ie,this.prevI),!0}}captureNameChars(){const{chunk:P,i:ie}=this;for(;;){const ne=this.getCode();if(ne===_)return this.name+=P.slice(ie),_;if(!a(ne))return this.name+=P.slice(ie,this.prevI),ne===E?h:ne}}skipSpaces(){for(;;){const P=this.getCodeNorm();if(P===_||!i(P))return P}}setXMLVersion(P){this.currentXMLVersion=P,P==="1.0"?(this.isChar=n,this.getCode=this.getCode10):(this.isChar=l,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=f}sBeginWhitespace(){const P=this.i,ie=this.skipSpaces();switch(this.prevI!==P&&(this.xmlDeclPossible=!1),ie){case bt:if(this.state=F,this.text.length!==0)throw new Error("no-empty text at start");break;case _:break;default:this.unget(),this.state=N,this.xmlDeclPossible=!1}}sDoctype(){var P;const ie=this.captureTo(ve);switch(ie){case qe:{(P=this.doctypeHandler)===null||P===void 0||P.call(this,this.text),this.text="",this.state=N,this.doctype=!0;break}case _:break;default:this.text+=String.fromCodePoint(ie),ie===Ni?this.state=L:D(ie)&&(this.state=R,this.q=ie)}}sDoctypeQuote(){const P=this.q;this.captureToChar(P)&&(this.text+=String.fromCodePoint(P),this.q=null,this.state=b)}sDTD(){const P=this.captureTo(ye);P!==_&&(this.text+=String.fromCodePoint(P),P===Pt?this.state=b:P===bt?this.state=B:D(P)&&(this.state=T,this.q=P))}sDTDQuoted(){const P=this.q;this.captureToChar(P)&&(this.text+=String.fromCodePoint(P),this.state=L,this.q=null)}sDTDOpenWaka(){const P=this.getCodeNorm();switch(this.text+=String.fromCodePoint(P),P){case se:this.state=I,this.openWakaBang="";break;case ze:this.state=j;break;default:this.state=L}}sDTDOpenWakaBang(){const P=String.fromCodePoint(this.getCodeNorm()),ie=this.openWakaBang+=P;this.text+=P,ie!=="-"&&(this.state=ie==="--"?$:L,this.openWakaBang="")}sDTDComment(){this.captureToChar(je)&&(this.text+="-",this.state=q)}sDTDCommentEnding(){const P=this.getCodeNorm();this.text+=String.fromCodePoint(P),this.state=P===je?A:$}sDTDCommentEnded(){const P=this.getCodeNorm();this.text+=String.fromCodePoint(P),P===qe?this.state=L:(this.fail("malformed comment."),this.state=$)}sDTDPI(){this.captureToChar(ze)&&(this.text+="?",this.state=te)}sDTDPIEnding(){const P=this.getCodeNorm();this.text+=String.fromCodePoint(P),P===qe&&(this.state=L)}sText(){this.tags.length!==0?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:P}=this;const{chunk:ie}=this;e:for(;;)switch(this.getCode()){case E:this.entity+=`${ie.slice(P,this.prevI)}
|
|
304
|
+
`,P=this.i;break;case Ae:{const{entityReturnState:ne}=this,we=this.entity+ie.slice(P,this.prevI);this.state=ne;let Te;we===""?(this.fail("empty entity name."),Te="&;"):(Te=this.parseEntity(we),this.entity=""),(ne!==N||this.textHandler!==void 0)&&(this.text+=Te);break e}case _:this.entity+=ie.slice(P);break e}}sOpenWaka(){const P=this.getCode();if(o(P))this.state=he,this.unget(),this.xmlDeclPossible=!1;else switch(P){case De:this.state=Qe,this.xmlDeclPossible=!1;break;case se:this.state=Y,this.openWakaBang="",this.xmlDeclPossible=!1;break;case ze:this.state=G;break;default:this.fail("disallowed character in tag name"),this.state=N,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0),this.state=X,this.openWakaBang="";break;case"--":this.state=w,this.openWakaBang="";break;case"DOCTYPE":this.state=b,(this.doctype||this.sawRoot)&&this.fail("inappropriately located doctype declaration."),this.openWakaBang="";break;default:this.openWakaBang.length>=7&&this.fail("incorrect syntax.")}}sComment(){this.captureToChar(je)&&(this.state=U)}sCommentEnding(){var P;const ie=this.getCodeNorm();ie===je?(this.state=K,(P=this.commentHandler)===null||P===void 0||P.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(ie)}`,this.state=w)}sCommentEnded(){const P=this.getCodeNorm();P!==qe?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(P)}`,this.state=w):this.state=N}sCData(){this.captureToChar(Pt)&&(this.state=de)}sCDataEnding(){const P=this.getCodeNorm();P===Pt?this.state=H:(this.text+=`]${String.fromCodePoint(P)}`,this.state=X)}sCDataEnding2(){var P;const ie=this.getCodeNorm();switch(ie){case qe:{(P=this.cdataHandler)===null||P===void 0||P.call(this,this.text),this.text="",this.state=N;break}case Pt:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(ie)}`,this.state=X}}sPIFirstChar(){const P=this.getCodeNorm();this.nameStartCheck(P)?(this.piTarget+=String.fromCodePoint(P),this.state=W):P===ze||i(P)?(this.fail("processing instruction without a target."),this.state=P===ze?ee:z):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(P),this.state=W)}sPIRest(){const{chunk:P,i:ie}=this;for(;;){const ne=this.getCodeNorm();if(ne===_){this.piTarget+=P.slice(ie);return}if(!this.nameCheck(ne)){this.piTarget+=P.slice(ie,this.prevI);const we=ne===ze;we||i(ne)?this.piTarget==="xml"?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=we?fe:re):this.state=we?ee:z:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(ne));break}}}sPIBody(){if(this.text.length===0){const P=this.getCodeNorm();P===ze?this.state=ee:i(P)||(this.text=String.fromCodePoint(P))}else this.captureToChar(ze)&&(this.state=ee)}sPIEnding(){var P;const ie=this.getCodeNorm();if(ie===qe){const{piTarget:ne}=this;ne.toLowerCase()==="xml"&&this.fail("the XML declaration must appear at the start of the document."),(P=this.piHandler)===null||P===void 0||P.call(this,{target:ne,body:this.text}),this.piTarget=this.text="",this.state=N}else ie===ze?this.text+="?":(this.text+=`?${String.fromCodePoint(ie)}`,this.state=z);this.xmlDeclPossible=!1}sXMLDeclNameStart(){const P=this.skipSpaces();if(P===ze){this.state=fe;return}P!==_&&(this.state=pe,this.name=String.fromCodePoint(P))}sXMLDeclName(){const P=this.captureTo(xe);if(P===ze){this.state=fe,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(i(P)||P===Ft){if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=P===Ft?O:be}}sXMLDeclEq(){const P=this.getCodeNorm();if(P===ze){this.state=fe,this.fail("XML declaration is incomplete.");return}i(P)||(P!==Ft&&this.fail("value required."),this.state=O)}sXMLDeclValueStart(){const P=this.getCodeNorm();if(P===ze){this.state=fe,this.fail("XML declaration is incomplete.");return}i(P)||(D(P)?this.q=P:(this.fail("value must be quoted."),this.q=Q),this.state=V)}sXMLDeclValue(){const P=this.captureTo([this.q,ze]);if(P===ze){this.state=fe,this.text="",this.fail("XML declaration is incomplete.");return}if(P===_)return;const ie=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];const ne=ie;this.xmlDecl.version=ne,/^1\.[0-9]+$/.test(ne)?this.opt.forceXMLVersion||this.setXMLVersion(ne):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(ie)||this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=ie;break;case"standalone":ie!=="yes"&&ie!=="no"&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=ie;break}this.name="",this.state=oe}sXMLDeclSeparator(){const P=this.getCodeNorm();if(P===ze){this.state=fe;return}i(P)||(this.fail("whitespace required."),this.unget()),this.state=re}sXMLDeclEnding(){var P;this.getCodeNorm()===qe?(this.piTarget!=="xml"?this.fail("processing instructions are not allowed before root."):this.name!=="version"&&this.xmlDeclExpects.includes("version")&&this.fail("XML declaration must contain a version."),(P=this.xmldeclHandler)===null||P===void 0||P.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=N):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var P;const ie=this.captureNameChars();if(ie===_)return;const ne=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=ne.ns=Object.create(null)),(P=this.openTagStartHandler)===null||P===void 0||P.call(this,ne),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),ie){case qe:this.openTag();break;case De:this.state=me;break;default:i(ie)||this.fail("disallowed character in tag name."),this.state=J}}sOpenTagSlash(){this.getCode()===qe?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=J)}sAttrib(){const P=this.skipSpaces();P!==_&&(o(P)?(this.unget(),this.state=ce):P===qe?this.openTag():P===De?this.state=me:this.fail("disallowed character in attribute name."))}sAttribName(){const P=this.captureNameChars();P===Ft?this.state=le:i(P)?this.state=ge:P===qe?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):P!==_&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){const P=this.skipSpaces();switch(P){case _:return;case Ft:this.state=le;break;default:this.fail("attribute without value."),this.text="",this.name="",P===qe?this.openTag():o(P)?(this.unget(),this.state=ce):(this.fail("disallowed character in attribute name."),this.state=J)}}sAttribValue(){const P=this.getCodeNorm();D(P)?(this.q=P,this.state=Re):i(P)||(this.fail("unquoted attribute value."),this.state=Ee,this.unget())}sAttribValueQuoted(){const{q:P,chunk:ie}=this;let{i:ne}=this;for(;;)switch(this.getCode()){case P:this.pushAttrib(this.name,this.text+ie.slice(ne,this.prevI)),this.name=this.text="",this.q=null,this.state=We;return;case ke:this.text+=ie.slice(ne,this.prevI),this.state=Z,this.entityReturnState=Re;return;case h:case E:case p:this.text+=`${ie.slice(ne,this.prevI)} `,ne=this.i;break;case bt:this.text+=ie.slice(ne,this.prevI),this.fail("disallowed character.");return;case _:this.text+=ie.slice(ne);return}}sAttribValueClosed(){const P=this.getCodeNorm();i(P)?this.state=J:P===qe?this.openTag():P===De?this.state=me:o(P)?(this.fail("no whitespace between attributes."),this.unget(),this.state=ce):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){const P=this.captureTo(Xe);switch(P){case ke:this.state=Z,this.entityReturnState=Ee;break;case bt:this.fail("disallowed character.");break;case _:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",P===qe?this.openTag():this.state=J}}sCloseTag(){const P=this.captureNameChars();P===qe?this.closeTag():i(P)?this.state=S:P!==_&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case qe:this.closeTag();break;case _:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:P,forbiddenState:ie}=this;const{chunk:ne,textHandler:we}=this;e:for(;;)switch(this.getCode()){case bt:{if(this.state=F,we!==void 0){const{text:Te}=this,Le=ne.slice(P,this.prevI);Te.length!==0?(we(Te+Le),this.text=""):Le.length!==0&&we(Le)}ie=It;break e}case ke:this.state=Z,this.entityReturnState=N,we!==void 0&&(this.text+=ne.slice(P,this.prevI)),ie=It;break e;case Pt:switch(ie){case It:ie=Pr;break;case Pr:ie=br;break;case br:break;default:throw new Error("impossible state")}break;case qe:ie===br&&this.fail('the string "]]>" is disallowed in char data.'),ie=It;break;case E:we!==void 0&&(this.text+=`${ne.slice(P,this.prevI)}
|
|
305
|
+
`),P=this.i,ie=It;break;case _:we!==void 0&&(this.text+=ne.slice(P));break e;default:ie=It}this.forbiddenState=ie}handleTextOutsideRoot(){let{i:P}=this;const{chunk:ie,textHandler:ne}=this;let we=!1;e:for(;;){const Te=this.getCode();switch(Te){case bt:{if(this.state=F,ne!==void 0){const{text:Le}=this,et=ie.slice(P,this.prevI);Le.length!==0?(ne(Le+et),this.text=""):et.length!==0&&ne(et)}break e}case ke:this.state=Z,this.entityReturnState=N,ne!==void 0&&(this.text+=ie.slice(P,this.prevI)),we=!0;break e;case E:ne!==void 0&&(this.text+=`${ie.slice(P,this.prevI)}
|
|
306
|
+
`),P=this.i;break;case _:ne!==void 0&&(this.text+=ie.slice(P));break e;default:i(Te)||(we=!0)}}we&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0))}pushAttribNS(P,ie){var ne;const{prefix:we,local:Te}=this.qname(P),Le={name:P,prefix:we,local:Te,value:ie};if(this.attribList.push(Le),(ne=this.attributeHandler)===null||ne===void 0||ne.call(this,Le),we==="xmlns"){const et=ie.trim();this.currentXMLVersion==="1.0"&&et===""&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[Te]=et,Ze(this,Te,et)}else if(P==="xmlns"){const et=ie.trim();this.topNS[""]=et,Ze(this,"",et)}}pushAttribPlain(P,ie){var ne;const we={name:P,value:ie};this.attribList.push(we),(ne=this.attributeHandler)===null||ne===void 0||ne.call(this,we)}end(){var P,ie;this.sawRoot||this.fail("document must contain a root element.");const{tags:ne}=this;for(;ne.length>0;){const Te=ne.pop();this.fail(`unclosed tag: ${Te.name}`)}this.state!==m&&this.state!==N&&this.fail("unexpected end.");const{text:we}=this;return we.length!==0&&((P=this.textHandler)===null||P===void 0||P.call(this,we),this.text=""),this._closed=!0,(ie=this.endHandler)===null||ie===void 0||ie.call(this),this._init(),this}resolve(P){var ie,ne;let we=this.topNS[P];if(we!==void 0)return we;const{tags:Te}=this;for(let Le=Te.length-1;Le>=0;Le--)if(we=Te[Le].ns[P],we!==void 0)return we;return we=this.ns[P],we!==void 0?we:(ne=(ie=this.opt).resolvePrefix)===null||ne===void 0?void 0:ne.call(ie,P)}qname(P){const ie=P.indexOf(":");if(ie===-1)return{prefix:"",local:P};const ne=P.slice(ie+1),we=P.slice(0,ie);return(we===""||ne===""||ne.includes(":"))&&this.fail(`malformed name: ${P}.`),{prefix:we,local:ne}}processAttribsNS(){var P;const{attribList:ie}=this,ne=this.tag;{const{prefix:Le,local:et}=this.qname(ne.name);ne.prefix=Le,ne.local=et;const gr=ne.uri=(P=this.resolve(Le))!==null&&P!==void 0?P:"";Le!==""&&(Le==="xmlns"&&this.fail('tags may not have "xmlns" as prefix.'),gr===""&&(this.fail(`unbound namespace prefix: ${JSON.stringify(Le)}.`),ne.uri=Le))}if(ie.length===0)return;const{attributes:we}=ne,Te=new Set;for(const Le of ie){const{name:et,prefix:gr,local:tu}=Le;let vr,Br;gr===""?(vr=et==="xmlns"?y:"",Br=et):(vr=this.resolve(gr),vr===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(gr)}.`),vr=gr),Br=`{${vr}}${tu}`),Te.has(Br)&&this.fail(`duplicate attribute: ${Br}.`),Te.add(Br),Le.uri=vr,we[et]=Le}this.attribList=[]}processAttribsPlain(){const{attribList:P}=this,ie=this.tag.attributes;for(const{name:ne,value:we}of P)ie[ne]!==void 0&&this.fail(`duplicate attribute: ${ne}.`),ie[ne]=we;this.attribList=[]}openTag(){var P;this.processAttribs();const{tags:ie}=this,ne=this.tag;ne.isSelfClosing=!1,(P=this.openTagHandler)===null||P===void 0||P.call(this,ne),ie.push(ne),this.state=N,this.name=""}openSelfClosingTag(){var P,ie,ne;this.processAttribs();const{tags:we}=this,Te=this.tag;Te.isSelfClosing=!0,(P=this.openTagHandler)===null||P===void 0||P.call(this,Te),(ie=this.closeTagHandler)===null||ie===void 0||ie.call(this,Te),(this.tag=(ne=we[we.length-1])!==null&&ne!==void 0?ne:null)===null&&(this.closedRoot=!0),this.state=N,this.name=""}closeTag(){const{tags:P,name:ie}=this;if(this.state=N,this.name="",ie===""){this.fail("weird empty close tag."),this.text+="</>";return}const ne=this.closeTagHandler;let we=P.length;for(;we-- >0;){const Te=this.tag=P.pop();if(this.topNS=Te.ns,ne?.(Te),Te.name===ie)break;this.fail("unexpected close tag.")}we===0?this.closedRoot=!0:we<0&&(this.fail(`unmatched closing tag: ${ie}.`),this.text+=`</${ie}>`)}parseEntity(P){if(P[0]!=="#"){const ne=this.ENTITIES[P];return ne!==void 0?ne:(this.fail(this.isName(P)?"undefined entity.":"disallowed character in entity name."),`&${P};`)}let ie=NaN;return P[1]==="x"&&/^#x[0-9a-f]+$/i.test(P)?ie=parseInt(P.slice(2),16):/^#[0-9]+$/.test(P)&&(ie=parseInt(P.slice(1),10)),this.isChar(ie)?String.fromCodePoint(ie):(this.fail("malformed character entity."),`&${P};`)}}return Zt.SaxesParser=Mr,Zt}var Qr={},cl;function fp(){if(cl)return Qr;cl=1,Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.ParseError=void 0;let r=class extends Error{constructor(t,i){const n=t.saxParser;super(t.trackPosition?`Line ${n.line} column ${n.column+1}: ${i}`:i)}};return Qr.ParseError=r,Qr}var er={},Jr={},ul;function Dc(){if(ul)return Jr;ul=1,Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.BlankNode=void 0;class r{constructor(t){this.termType="BlankNode",this.value=t}equals(t){return!!t&&t.termType==="BlankNode"&&t.value===this.value}}return Jr.BlankNode=r,Jr}var Kr={},Yr={},fl;function Lc(){if(fl)return Yr;fl=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.DefaultGraph=void 0;class r{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&t.termType==="DefaultGraph"}}return Yr.DefaultGraph=r,r.INSTANCE=new r,Yr}var Zr={},ei={},pl;function $a(){if(pl)return ei;pl=1,Object.defineProperty(ei,"__esModule",{value:!0}),ei.NamedNode=void 0;class r{constructor(t){this.termType="NamedNode",this.value=t}equals(t){return!!t&&t.termType==="NamedNode"&&t.value===this.value}}return ei.NamedNode=r,ei}var hl;function Oc(){if(hl)return Zr;hl=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.Literal=void 0;const r=$a();class e{constructor(i,n){this.termType="Literal",this.value=i,typeof n=="string"?(this.language=n,this.datatype=e.RDF_LANGUAGE_STRING,this.direction=""):n?"termType"in n?(this.language="",this.datatype=n,this.direction=""):(this.language=n.language,this.datatype=n.direction?e.RDF_DIRECTIONAL_LANGUAGE_STRING:e.RDF_LANGUAGE_STRING,this.direction=n.direction||""):(this.language="",this.datatype=e.XSD_STRING,this.direction="")}equals(i){return!!i&&i.termType==="Literal"&&i.value===this.value&&i.language===this.language&&(i.direction===this.direction||!i.direction&&this.direction==="")&&this.datatype.equals(i.datatype)}}return Zr.Literal=e,e.RDF_LANGUAGE_STRING=new r.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),e.RDF_DIRECTIONAL_LANGUAGE_STRING=new r.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),e.XSD_STRING=new r.NamedNode("http://www.w3.org/2001/XMLSchema#string"),Zr}var ti={},bl;function Cc(){if(bl)return ti;bl=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.Quad=void 0;class r{constructor(t,i,n,o){this.termType="Quad",this.value="",this.subject=t,this.predicate=i,this.object=n,this.graph=o}equals(t){return!!t&&(t.termType==="Quad"||!t.termType)&&this.subject.equals(t.subject)&&this.predicate.equals(t.predicate)&&this.object.equals(t.object)&&this.graph.equals(t.graph)}}return ti.Quad=r,ti}var ri={},ml;function $c(){if(ml)return ri;ml=1,Object.defineProperty(ri,"__esModule",{value:!0}),ri.Variable=void 0;class r{constructor(t){this.termType="Variable",this.value=t}equals(t){return!!t&&t.termType==="Variable"&&t.value===this.value}}return ri.Variable=r,ri}var gl;function pp(){if(gl)return Kr;gl=1,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.DataFactory=void 0;const r=Dc(),e=Lc(),t=Oc(),i=$a(),n=Cc(),o=$c();let a=0;class s{constructor(l){this.blankNodeCounter=0,l=l||{},this.blankNodePrefix=l.blankNodePrefix||`df_${a++}_`}namedNode(l){return new i.NamedNode(l)}blankNode(l){return new r.BlankNode(l||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(l,c){return new t.Literal(l,c)}variable(l){return new o.Variable(l)}defaultGraph(){return e.DefaultGraph.INSTANCE}quad(l,c,u,v){return new n.Quad(l,c,u,v||this.defaultGraph())}fromTerm(l){switch(l.termType){case"NamedNode":return this.namedNode(l.value);case"BlankNode":return this.blankNode(l.value);case"Literal":return l.language?this.literal(l.value,l.language):l.datatype.equals(t.Literal.XSD_STRING)?this.literal(l.value):this.literal(l.value,this.fromTerm(l.datatype));case"Variable":return this.variable(l.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(l.subject),this.fromTerm(l.predicate),this.fromTerm(l.object),this.fromTerm(l.graph))}}fromQuad(l){return this.fromTerm(l)}resetBlankNodeCounter(){this.blankNodeCounter=0}}return Kr.DataFactory=s,Kr}var vl;function Fc(){return vl||(vl=1,function(r){var e=er&&er.__createBinding||(Object.create?function(i,n,o,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(n,o);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[o]}}),Object.defineProperty(i,a,s)}:function(i,n,o,a){a===void 0&&(a=o),i[a]=n[o]}),t=er&&er.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),t(Dc(),r),t(pp(),r),t(Lc(),r),t(Oc(),r),t($a(),r),t(Cc(),r),t($c(),r)}(er)),er}var tr={},Kn={},yl;function hp(){return yl||(yl=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.validateIri=r.IriValidationStrategy=void 0;function e(){const s="[!$&'()*+,;=]",d="%[a-fA-F0-9]{2}",l="([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",c=`${l}\\.${l}\\.${l}\\.${l}`,u="[a-fA-F0-9]{1,4}",v=`(${u}:${u}|${c})`,g=`((${u}:){6}${v}|::(${u}:){5}${v}|(${u})?::(${u}:){4}${v}|((${u}:){0,1}${u})?::(${u}:){3}${v}|((${u}:){0,2}${u})?::(${u}:){2}${v}|((${u}:){0,3}${u})?::${u}:${v}|((${u}:){0,4}${u})?::${v}|((${u}:){0,5}${u})?::${u}|((${u}:){0,6}${u})?::)`,y=`v[a-fA-F0-9]+\\.(${s}|${s}|":)+`,k=`\\[(${g}|${y})\\]`,x="[0-9]*",_="[a-zA-Z][a-zA-Z0-9+\\-.]*",m="[---]",R="[a-zA-Z0-9\\-._~ -豈-﷏ﷰ-𐀀-𠀀-𰀀------------]",L=`(${R}|${d}|${s}|[:@])*`,T=`(${L}|[\\/?])*`,B=`(${L}|${m}|[\\/?])*`,I=`(${L})+`,$=`(${L})*`,q="",A=`${I}(\\/${$})*`,j=`\\/(${I}(\\/${$})*)?`,te=`(\\/${$})*`,N=`(${R}|${d}|${s})*`,Z=`(${k}|${c}|${N})`,w=`(\\/\\/${`(${`(${R}|${d}|${s}|:)*`}@)?${Z}(:${x})?`}${te}|${j}|${A}|${q})`,U=`^${_}:${w}(\\?${B})?(#${T})?$`;return new RegExp(U,"u")}const t=e(),i=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u;var n;(function(a){a.Strict="strict",a.Pragmatic="pragmatic",a.None="none"})(n=r.IriValidationStrategy||(r.IriValidationStrategy={}));function o(a,s=n.Strict){switch(s){case n.Strict:return t.test(a)?void 0:new Error(`Invalid IRI according to RFC 3987: '${a}'`);case n.Pragmatic:return i.test(a)?void 0:new Error(`Invalid IRI according to RDF Turtle: '${a}'`);case n.None:return;default:return new Error(`Not supported validation strategy "${s}"`)}}r.validateIri=o}(Kn)),Kn}var wl;function bp(){return wl||(wl=1,function(r){var e=tr&&tr.__createBinding||(Object.create?function(i,n,o,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(n,o);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[o]}}),Object.defineProperty(i,a,s)}:function(i,n,o,a){a===void 0&&(a=o),i[a]=n[o]}),t=tr&&tr.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),t(hp(),r)}(tr)),tr}var xl;function mp(){if(xl)return Kt;xl=1,Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.ParseType=Kt.RdfXmlParser=void 0;const r=sp(),e=up(),t=sc(),i=fp(),n=Fc(),o=bp();let a=class Ce extends t.Transform{constructor(l){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},l&&(Object.assign(this,l),this.options=l),this.dataFactory||(this.dataFactory=new n.DataFactory),this.baseIRI||(this.baseIRI=""),this.defaultGraph||(this.defaultGraph=this.dataFactory.defaultGraph()),this.validateUri!==!1&&(this.validateUri=!0),this.iriValidationStrategy||(this.iriValidationStrategy=this.validateUri?o.IriValidationStrategy.Pragmatic:o.IriValidationStrategy.None),this.saxParser=new e.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(l){const c=new t.PassThrough({readableObjectMode:!0});l.on("error",v=>u.emit("error",v)),l.on("data",v=>c.push(v)),l.on("end",()=>c.push(null));const u=c.pipe(new Ce(this.options));return u}_transform(l,c,u){try{this.saxParser.write(l)}catch(v){return u(v)}u()}newParseError(l){return new i.ParseError(this,l)}valueToUri(l,c){return this.uriToNamedNode((0,r.resolve)(l,c.baseIRI))}uriToNamedNode(l){const c=(0,o.validateIri)(l,this.iriValidationStrategy);if(c instanceof Error)throw this.newParseError(c.message);return this.dataFactory.namedNode(l)}validateNcname(l){if(!Ce.NCNAME_MATCHER.test(l))throw this.newParseError(`Not a valid NCName: ${l}`)}createLiteral(l,c){return this.dataFactory.literal(l,c.datatype?c.datatype:c.language?{language:c.language,direction:c.rdfVersion?c.direction:void 0}:void 0)}attachSaxListeners(){this.saxParser.on("error",l=>this.emit("error",l)),this.saxParser.on("opentag",this.onTag.bind(this)),this.saxParser.on("text",this.onText.bind(this)),this.saxParser.on("cdata",this.onText.bind(this)),this.saxParser.on("closetag",this.onCloseTag.bind(this)),this.saxParser.on("doctype",this.onDoctype.bind(this))}onTag(l){const c=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;let u=s.RESOURCE;if(c&&(c.hadChildren=!0,u=c.childrenParseType),c&&c.childrenStringTags){const g=l.name;let y="";for(const{key:E,value:m}of c.namespaces||[])y+=` ${E}="${m}"`;for(const E in l.attributes)y+=` ${E}="${l.attributes[E].value}"`;const x=`<${`${g}${y}`}>`;c.childrenStringTags.push(x);const _={childrenStringTags:c.childrenStringTags};_.childrenStringEmitClosingTag=`</${g}>`,this.activeTagStack.push(_);return}const v={};c?(v.language=c.language,v.direction=c.direction,v.baseIRI=c.baseIRI,v.childrenTripleTerms=c.childrenTripleTerms,v.rdfVersion=c.rdfVersion):v.baseIRI=this.baseIRI,this.activeTagStack.push(v),u===s.RESOURCE?this.onTagResource(l,v,c,!c):this.onTagProperty(l,v,c);for(const g in l.attributes){const y=l.attributes[g];y.prefix==="xmlns"&&(v.namespaces||(v.namespaces=[]),v.namespaces.push({key:`${y.prefix}:${y.local}`,value:y.value}))}c&&c.namespaces&&(v.namespaces=[...v.namespaces||[],...c.namespaces])}onTagResource(l,c,u,v){c.childrenParseType=s.PROPERTY;let g=!0;if(l.uri===Ce.RDF){if(!v&&Ce.FORBIDDEN_NODE_ELEMENTS.indexOf(l.local)>=0)throw this.newParseError(`Illegal node element name: ${l.local}`);switch(l.local){case"RDF":c.childrenParseType=s.RESOURCE;case"Description":g=!1}}const y=[],k=[];let x=null,_=!1,E=!1,m=null;for(const f in l.attributes){const b=l.attributes[f];if(b.uri===Ce.RDF&&b.local==="version"){this.setVersion(c,b.value);continue}else if(u&&b.uri===Ce.RDF)switch(b.local){case"about":if(x)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${b.value} and ${x} where found.`);x=b.value;continue;case"ID":if(x)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${b.value} and ${x} where found.`);this.validateNcname(b.value),x="#"+b.value,_=!0;continue;case"nodeID":if(x)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${b.value} and ${x} where found.`);this.validateNcname(b.value),x=b.value,E=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"type":m=b.value;continue;case"aboutEach":throw this.newParseError("rdf:aboutEach is not supported.");case"aboutEachPrefix":throw this.newParseError("rdf:aboutEachPrefix is not supported.");case"li":throw this.newParseError("rdf:li on node elements are not supported.")}else if(b.uri===Ce.XML){if(b.local==="lang"){c.language=b.value===""?null:b.value.toLowerCase();continue}else if(b.local==="base"){c.baseIRI=(0,r.resolve)(b.value,c.baseIRI);continue}}else if(b.uri===Ce.ITS&&b.local==="dir"){this.setDirection(c,b.value);continue}b.prefix!=="xml"&&b.prefix!=="xmlns"&&(b.prefix!==""||b.local!=="xmlns")&&b.uri&&(y.push(this.uriToNamedNode(b.uri+b.local)),k.push(b.value))}if(x!==null&&(c.subject=E?this.dataFactory.blankNode(x):this.valueToUri(x,c),_&&this.claimNodeId(c.subject)),c.subject||(c.subject=this.dataFactory.blankNode()),g){const f=this.uriToNamedNode(l.uri+l.local);this.emitTriple(c.subject,this.dataFactory.namedNode(Ce.RDF+"type"),f,u?u.reifiedStatementId:null,c.childrenTripleTerms,c.reifier)}if(u){if(u.predicate)if(u.childrenCollectionSubject){const f=this.dataFactory.blankNode(),b=this.dataFactory.namedNode(Ce.RDF+"rest"),R=u.childrenCollectionPredicate.equals(b);this.emitTriple(u.childrenCollectionSubject,u.childrenCollectionPredicate,f,R?null:u.reifiedStatementId,u.childrenTripleTerms,R?null:u.reifier),this.emitTriple(f,this.dataFactory.namedNode(Ce.RDF+"first"),c.subject,null,c.childrenTripleTerms),u.childrenCollectionSubject=f,u.childrenCollectionPredicate=b}else{u.childrenTagsToTripleTerms||(this.emitTriple(u.subject,u.predicate,c.subject,u.reifiedStatementId,u.childrenTripleTerms,u.reifier),u.predicateEmitted=!0);for(let f=0;f<u.predicateSubPredicates.length;f++)this.emitTriple(c.subject,u.predicateSubPredicates[f],u.predicateSubObjects[f],null,u.childrenTripleTerms,u.reifier);u.predicateSubPredicates=[],u.predicateSubObjects=[]}for(let f=0;f<y.length;f++){const b=this.createLiteral(k[f],c);this.emitTriple(c.subject,y[f],b,u.reifiedStatementId,u.childrenTripleTerms,u.reifier)}m&&this.emitTriple(c.subject,this.dataFactory.namedNode(Ce.RDF+"type"),this.uriToNamedNode(m),null,c.childrenTripleTerms,c.reifier)}}onTagProperty(l,c,u){if(c.childrenParseType=s.RESOURCE,c.subject=u.subject,l.uri===Ce.RDF&&l.local==="li"?(u.listItemCounter||(u.listItemCounter=1),c.predicate=this.uriToNamedNode(l.uri+"_"+u.listItemCounter++)):c.predicate=this.uriToNamedNode(l.uri+l.local),l.uri===Ce.RDF&&Ce.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(l.local)>=0)throw this.newParseError(`Illegal property element name: ${l.local}`);c.predicateSubPredicates=[],c.predicateSubObjects=[];let v=!1,g=!1,y=null,k=!0;const x=[],_=[];for(const E in l.attributes){const m=l.attributes[E];if(m.uri===Ce.RDF&&m.local==="version"){this.setVersion(c,m.value);continue}else if(m.uri===Ce.RDF)switch(m.local){case"resource":if(y)throw this.newParseError(`Found both rdf:resource (${m.value}) and rdf:nodeID (${y}).`);if(v)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${m.value})`);c.hadChildren=!0,y=m.value,k=!1;continue;case"datatype":if(g)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${m.value}).`);if(v)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${m.value})`);c.datatype=this.valueToUri(m.value,c);continue;case"nodeID":if(g)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${m.value}).`);if(c.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${m.value}).`);if(v)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${m.value})`);this.validateNcname(m.value),c.hadChildren=!0,y=m.value,k=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"parseType":if(g)throw this.newParseError("rdf:parseType is not allowed when non-rdf:* property attributes are present");if(c.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${c.datatype.value})`);if(y)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${y})`);if(m.value==="Resource"){v=!0,c.childrenParseType=s.PROPERTY;const f=this.dataFactory.blankNode();this.emitTriple(c.subject,c.predicate,f,c.reifiedStatementId,c.childrenTripleTerms,c.reifier),c.subject=f,c.predicate=null}else m.value==="Collection"?(v=!0,c.hadChildren=!0,c.childrenCollectionSubject=c.subject,c.childrenCollectionPredicate=c.predicate,k=!1):m.value==="Literal"?(v=!0,c.childrenTagsToString=!0,c.childrenStringTags=[]):m.value==="Triple"&&(v=!0,c.childrenTagsToTripleTerms=!0,c.childrenTripleTerms=[]);continue;case"ID":this.validateNcname(m.value),c.reifiedStatementId=this.valueToUri("#"+m.value,c),this.claimNodeId(c.reifiedStatementId);continue;case"annotation":c.reifier=this.dataFactory.namedNode(m.value);continue;case"annotationNodeID":c.reifier=this.dataFactory.blankNode(m.value);continue}else if(m.uri===Ce.XML&&m.local==="lang"){c.language=m.value===""?null:m.value.toLowerCase();continue}else if(m.uri===Ce.ITS&&m.local==="dir"){this.setDirection(c,m.value);continue}else if(m.uri===Ce.ITS&&m.local==="version")continue;if(m.prefix!=="xml"&&m.prefix!=="xmlns"&&(m.prefix!==""||m.local!=="xmlns")&&m.uri){if(v||c.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${m.value}`);c.hadChildren=!0,g=!0,x.push(this.uriToNamedNode(m.uri+m.local)),_.push(this.createLiteral(m.value,c))}}if(y!==null){const E=c.subject;c.subject=k?this.dataFactory.blankNode(y):this.valueToUri(y,c),this.emitTriple(E,c.predicate,c.subject,c.reifiedStatementId,c.childrenTripleTerms,c.reifier);for(let m=0;m<x.length;m++)this.emitTriple(c.subject,x[m],_[m],null,c.childrenTripleTerms,c.reifier);c.predicateEmitted=!0}else k&&(c.predicateSubPredicates=x,c.predicateSubObjects=_,c.predicateEmitted=!1)}emitTriple(l,c,u,v,g,y){const k=this.dataFactory.quad(l,c,u,this.defaultGraph);g?g.push(k):this.push(k),y&&this.push(this.dataFactory.quad(y,this.dataFactory.namedNode(Ce.RDF+"reifies"),k)),v&&(this.push(this.dataFactory.quad(v,this.dataFactory.namedNode(Ce.RDF+"type"),this.dataFactory.namedNode(Ce.RDF+"Statement"),this.defaultGraph)),this.push(this.dataFactory.quad(v,this.dataFactory.namedNode(Ce.RDF+"subject"),l,this.defaultGraph)),this.push(this.dataFactory.quad(v,this.dataFactory.namedNode(Ce.RDF+"predicate"),c,this.defaultGraph)),this.push(this.dataFactory.quad(v,this.dataFactory.namedNode(Ce.RDF+"object"),u,this.defaultGraph)))}claimNodeId(l){if(!this.allowDuplicateRdfIds){if(this.nodeIds[l.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${l.value}'.`);this.nodeIds[l.value]=!0}}onText(l){const c=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;c&&(c.childrenStringTags?c.childrenStringTags.push(l):c.predicate&&(c.text=l))}onCloseTag(){const l=this.activeTagStack.pop(),c=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;if(l.childrenStringEmitClosingTag&&l.childrenStringTags.push(l.childrenStringEmitClosingTag),l.childrenTagsToString&&(l.datatype=this.dataFactory.namedNode(Ce.RDF+"XMLLiteral"),l.text=l.childrenStringTags.join(""),l.hadChildren=!1),l.childrenTagsToTripleTerms&&l.predicate&&l.rdfVersion){if(l.childrenTripleTerms.length!==1)throw this.newParseError(`Expected exactly one triple term in rdf:parseType="Triple" but got ${l.childrenTripleTerms.length}`);for(const u of l.childrenTripleTerms)this.emitTriple(l.subject,l.predicate,u,null,c.childrenTripleTerms,c.reifier);l.predicateEmitted=!0}if(l.childrenCollectionSubject)this.emitTriple(l.childrenCollectionSubject,l.childrenCollectionPredicate,this.dataFactory.namedNode(Ce.RDF+"nil"),null,l.childrenTripleTerms);else if(l.predicate){if(!l.hadChildren&&l.childrenParseType!==s.PROPERTY)this.emitTriple(l.subject,l.predicate,this.createLiteral(l.text||"",l),l.reifiedStatementId,l.childrenTripleTerms,l.reifier);else if(!l.predicateEmitted){const u=this.dataFactory.blankNode();this.emitTriple(l.subject,l.predicate,u,l.reifiedStatementId,l.childrenTripleTerms,l.reifier);for(let v=0;v<l.predicateSubPredicates.length;v++)this.emitTriple(u,l.predicateSubPredicates[v],l.predicateSubObjects[v],null,l.childrenTripleTerms)}}}onDoctype(l){l.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(c,u,v)=>(this.saxParser.ENTITIES[u]=v,""))}setDirection(l,c){if(c){if(c!=="ltr"&&c!=="rtl")throw this.newParseError(`Base directions must either be 'ltr' or 'rtl', while '${c}' was found.`);l.direction=c}else delete l.direction}setVersion(l,c){l.rdfVersion=c,this.emit("version",c)}};Kt.RdfXmlParser=a,a.MIME_TYPE="application/rdf+xml",a.RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#",a.XML="http://www.w3.org/XML/1998/namespace",a.ITS="http://www.w3.org/2005/11/its",a.FORBIDDEN_NODE_ELEMENTS=["RDF","ID","about","bagID","parseType","resource","nodeID","li","aboutEach","aboutEachPrefix"],a.FORBIDDEN_PROPERTY_ELEMENTS=["Description","RDF","ID","about","bagID","parseType","resource","nodeID","aboutEach","aboutEachPrefix"],a.NCNAME_MATCHER=/^([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_])([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_\-.0-9#xB7\u{0300}-\u{036F}\u{203F}-\u{2040}])*$/u;var s;return function(d){d[d.RESOURCE=0]="RESOURCE",d[d.PROPERTY=1]="PROPERTY"}(s||(Kt.ParseType=s={})),Kt}var _l;function gp(){return _l||(_l=1,function(r){var e=Jt&&Jt.__createBinding||(Object.create?function(i,n,o,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(n,o);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[o]}}),Object.defineProperty(i,a,s)}:function(i,n,o,a){a===void 0&&(a=o),i[a]=n[o]}),t=Jt&&Jt.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),t(mp(),r)}(Jt)),Jt}var vp=gp(),Yn={},Zn,kl;function Fa(){return kl||(kl=1,Zn=class Pc{constructor(e,t=new Map,i=0){this.prefix=e,this._existing=t,this.counter=i}clone(){const{prefix:e,_existing:t,counter:i}=this;return new Pc(e,new Map(t),i)}getId(e){const t=e&&this._existing.get(e);if(t)return t;const i=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,i),i}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}}),Zn}var eo={},El;function yp(){return El||(El=1,function(r,e){if(r.setImmediate)return;var t=1,i={},n=!1,o=r.document,a;function s(E){typeof E!="function"&&(E=new Function(""+E));for(var m=new Array(arguments.length-1),f=0;f<m.length;f++)m[f]=arguments[f+1];var b={callback:E,args:m};return i[t]=b,a(t),t++}function d(E){delete i[E]}function l(E){var m=E.callback,f=E.args;switch(f.length){case 0:m();break;case 1:m(f[0]);break;case 2:m(f[0],f[1]);break;case 3:m(f[0],f[1],f[2]);break;default:m.apply(e,f);break}}function c(E){if(n)setTimeout(c,0,E);else{var m=i[E];if(m){n=!0;try{l(m)}finally{d(E),n=!1}}}}function u(){a=function(E){process.nextTick(function(){c(E)})}}function v(){if(r.postMessage&&!r.importScripts){var E=!0,m=r.onmessage;return r.onmessage=function(){E=!1},r.postMessage("","*"),r.onmessage=m,E}}function g(){var E="setImmediate$"+Math.random()+"$",m=function(f){f.source===r&&typeof f.data=="string"&&f.data.indexOf(E)===0&&c(+f.data.slice(E.length))};r.addEventListener?r.addEventListener("message",m,!1):r.attachEvent("onmessage",m),a=function(f){r.postMessage(E+f,"*")}}function y(){var E=new MessageChannel;E.port1.onmessage=function(m){var f=m.data;c(f)},a=function(m){E.port2.postMessage(m)}}function k(){var E=o.documentElement;a=function(m){var f=o.createElement("script");f.onreadystatechange=function(){c(m),f.onreadystatechange=null,E.removeChild(f),f=null},E.appendChild(f)}}function x(){a=function(E){setTimeout(c,0,E)}}var _=Object.getPrototypeOf&&Object.getPrototypeOf(r);_=_&&_.setTimeout?_:r,{}.toString.call(r.process)==="[object process]"?u():v()?g():r.MessageChannel?y():o&&"onreadystatechange"in o.createElement("script")?k():x(),_.setImmediate=s,_.clearImmediate=d}(typeof self>"u"?typeof kr>"u"?eo:kr:self)),eo}/*!
|
|
307
307
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
308
308
|
*/var to,Sl;function pn(){if(Sl)return to;Sl=1,yp();const r=self.crypto||self.msCrypto;return to=class{constructor(t){if(!(r&&r.subtle))throw new Error("crypto.subtle not found.");if(t==="sha256")this.algorithm={name:"SHA-256"};else if(t==="sha1")this.algorithm={name:"SHA-1"};else throw new Error(`Unsupported algorithm "${t}".`);this._content=""}update(t){this._content+=t}async digest(){const t=new TextEncoder().encode(this._content),i=new Uint8Array(await r.subtle.digest(this.algorithm,t));let n="";for(let o=0;o<i.length;++o)n+=i[o].toString(16).padStart(2,"0");return n}},to}/*!
|
|
309
309
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
310
310
|
*/var ro,Rl;function Mc(){return Rl||(Rl=1,ro=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,i=e.slice();let n=null,o=0;const a=e.length;for(let s=0;s<a;++s){const d=e[s],l=t.get(d);(n===null||d>n)&&(l&&s>0&&d>e[s-1]||!l&&s<a-1&&d>e[s+1])&&(n=d,o=s)}if(n===null)this.done=!0;else{const s=t.get(n)?o-1:o+1;e[o]=e[s],e[s]=n;for(const d of e)d>n&&t.set(d,!t.get(d))}return i}}),ro}/*!
|
|
311
311
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
312
|
-
*/var io,
|
|
312
|
+
*/var io,Il;function Pa(){if(Il)return io;Il=1;const e="http://www.w3.org/1999/02/22-rdf-syntax-ns#"+"langString",t="http://www.w3.org/2001/XMLSchema#string",i="NamedNode",n="BlankNode",o="Literal",a="DefaultGraph",s={};(()=>{const g="(?:<([^:]+:[^>]*)>)",k="A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�"+"_",x=k+"0-9-·̀-ͯ‿-⁀",E="(_:(?:["+k+"0-9])(?:(?:["+x+".])*(?:["+x+"]))?)",m='"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"',f="(?:\\^\\^"+g+")",R="(?:"+m+"(?:"+f+"|"+"(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*))"+")?)",L="[ \\t]+",T="[ \\t]*",B="(?:"+g+"|"+E+")"+L,I=g+L,$="(?:"+g+"|"+E+"|"+R+")"+T,q="(?:\\.|(?:(?:"+g+"|"+E+")"+T+"\\.))";s.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,s.empty=new RegExp("^"+T+"$"),s.quad=new RegExp("^"+T+B+I+$+q+T+"$")})(),io=class Xi{static parse(y){const k=[],x={},_=y.split(s.eoln);let E=0;for(const m of _){if(E++,s.empty.test(m))continue;const f=m.match(s.quad);if(f===null)throw new Error("N-Quads parse error on line "+E+".");const b={subject:null,predicate:null,object:null,graph:null};if(f[1]!==void 0?b.subject={termType:i,value:f[1]}:b.subject={termType:n,value:f[2]},b.predicate={termType:i,value:f[3]},f[4]!==void 0?b.object={termType:i,value:f[4]}:f[5]!==void 0?b.object={termType:n,value:f[5]}:(b.object={termType:o,value:void 0,datatype:{termType:i}},f[7]!==void 0?b.object.datatype.value=f[7]:f[8]!==void 0?(b.object.datatype.value=e,b.object.language=f[8]):b.object.datatype.value=t,b.object.value=v(f[6])),f[9]!==void 0?b.graph={termType:i,value:f[9]}:f[10]!==void 0?b.graph={termType:n,value:f[10]}:b.graph={termType:a,value:""},!(b.graph.value in x))x[b.graph.value]=[b],k.push(b);else{let R=!0;const L=x[b.graph.value];for(const T of L)if(d(T,b)){R=!1;break}R&&(L.push(b),k.push(b))}}return k}static serialize(y){Array.isArray(y)||(y=Xi.legacyDatasetToQuads(y));const k=[];for(const x of y)k.push(Xi.serializeQuad(x));return k.sort().join("")}static serializeQuadComponents(y,k,x,_){let E="";return y.termType===i?E+=`<${y.value}>`:E+=`${y.value}`,E+=` <${k.value}> `,x.termType===i?E+=`<${x.value}>`:x.termType===n?E+=x.value:(E+=`"${c(x.value)}"`,x.datatype.value===e?x.language&&(E+=`@${x.language}`):x.datatype.value!==t&&(E+=`^^<${x.datatype.value}>`)),_.termType===i?E+=` <${_.value}>`:_.termType===n&&(E+=` ${_.value}`),E+=` .
|
|
313
313
|
`,E}static serializeQuad(y){return Xi.serializeQuadComponents(y.subject,y.predicate,y.object,y.graph)}static legacyDatasetToQuads(y){const k=[],x={"blank node":n,IRI:i,literal:o};for(const _ in y)y[_].forEach(m=>{const f={};for(const b in m){const R=m[b],L={termType:x[R.type],value:R.value};L.termType===o&&(L.datatype={termType:i},"datatype"in R&&(L.datatype.value=R.datatype),"language"in R?("datatype"in R||(L.datatype.value=e),L.language=R.language):"datatype"in R||(L.datatype.value=t)),f[b]=L}_==="@default"?f.graph={termType:a,value:""}:f.graph={termType:_.startsWith("_:")?n:i,value:_},k.push(f)});return k}};function d(g,y){return!(g.subject.termType===y.subject.termType&&g.object.termType===y.object.termType)||!(g.subject.value===y.subject.value&&g.predicate.value===y.predicate.value&&g.object.value===y.object.value)?!1:g.object.termType!==o?!0:g.object.datatype.termType===y.object.datatype.termType&&g.object.language===y.object.language&&g.object.datatype.value===y.object.datatype.value}const l=/["\\\n\r]/g;function c(g){return g.replace(l,function(y){switch(y){case'"':return'\\"';case"\\":return"\\\\";case`
|
|
314
314
|
`:return"\\n";case"\r":return"\\r"}})}const u=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function v(g){return g.replace(u,function(y,k,x,_){if(k)switch(k){case"t":return" ";case"b":return"\b";case"n":return`
|
|
315
315
|
`;case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(x)return String.fromCharCode(parseInt(x,16));if(_)throw new Error("Unsupported U escape")})}return io}/*!
|
|
316
316
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
317
|
-
*/var no,
|
|
317
|
+
*/var no,Nl;function Bc(){if(Nl)return no;Nl=1;const r=Fa(),e=pn(),t=Mc(),i=Pa();no=class{constructor({createMessageDigest:a=()=>new e("sha256"),canonicalIdMap:s=new Map,maxDeepIterations:d=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",s),this.createMessageDigest=a,this.maxDeepIterations=d,this.quads=null,this.deepIterations=null}async main(a){this.deepIterations=new Map,this.quads=a;for(const g of a)this._addBlankNodeQuadInfo({quad:g,component:g.subject}),this._addBlankNodeQuadInfo({quad:g,component:g.object}),this._addBlankNodeQuadInfo({quad:g,component:g.graph});const s=new Map,d=[...this.blankNodeInfo.keys()];let l=0;for(const g of d)++l%100===0&&await this._yield(),await this._hashAndTrackBlankNode({id:g,hashToBlankNodes:s});const c=[...s.keys()].sort(),u=[];for(const g of c){const y=s.get(g);if(y.length>1){u.push(y);continue}const k=y[0];this.canonicalIssuer.getId(k)}for(const g of u){const y=[];for(const k of g){if(this.canonicalIssuer.hasId(k))continue;const x=new r("_:b");x.getId(k);const _=await this.hashNDegreeQuads(k,x);y.push(_)}y.sort(n);for(const k of y){const x=k.issuer.getOldIds();for(const _ of x)this.canonicalIssuer.getId(_)}}const v=[];for(const g of this.quads){const y=i.serializeQuadComponents(this._componentWithCanonicalId(g.subject),g.predicate,this._componentWithCanonicalId(g.object),this._componentWithCanonicalId(g.graph));v.push(y)}return v.sort(),v.join("")}async hashFirstDegreeQuads(a){const s=[],d=this.blankNodeInfo.get(a),l=d.quads;for(const u of l){const v={subject:null,predicate:u.predicate,object:null,graph:null};v.subject=this.modifyFirstDegreeComponent(a,u.subject,"subject"),v.object=this.modifyFirstDegreeComponent(a,u.object,"object"),v.graph=this.modifyFirstDegreeComponent(a,u.graph,"graph"),s.push(i.serializeQuad(v))}s.sort();const c=this.createMessageDigest();for(const u of s)c.update(u);return d.hash=await c.digest(),d.hash}async hashRelatedBlankNode(a,s,d,l){let c;this.canonicalIssuer.hasId(a)?c=this.canonicalIssuer.getId(a):d.hasId(a)?c=d.getId(a):c=this.blankNodeInfo.get(a).hash;const u=this.createMessageDigest();return u.update(l),l!=="g"&&u.update(this.getRelatedPredicate(s)),u.update(c),u.digest()}async hashNDegreeQuads(a,s){const d=this.deepIterations.get(a)||0;if(d>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(a,d+1);const l=this.createMessageDigest(),c=await this.createHashToRelated(a,s),u=[...c.keys()].sort();for(const v of u){l.update(v);let g="",y;const k=new t(c.get(v));let x=0;for(;k.hasNext();){const _=k.next();++x%3===0&&await this._yield();let E=s.clone(),m="";const f=[];let b=!1;for(const R of _)if(this.canonicalIssuer.hasId(R)?m+=this.canonicalIssuer.getId(R):(E.hasId(R)||f.push(R),m+=E.getId(R)),g.length!==0&&m>g){b=!0;break}if(!b){for(const R of f){const L=await this.hashNDegreeQuads(R,E);if(m+=E.getId(R),m+=`<${L.hash}>`,E=L.issuer,g.length!==0&&m>g){b=!0;break}}b||(g.length===0||m<g)&&(g=m,y=E)}}l.update(g),s=y}return{hash:await l.digest(),issuer:s}}modifyFirstDegreeComponent(a,s){return s.termType!=="BlankNode"?s:{termType:"BlankNode",value:s.value===a?"_:a":"_:z"}}getRelatedPredicate(a){return`<${a.predicate.value}>`}async createHashToRelated(a,s){const d=new Map,l=this.blankNodeInfo.get(a).quads;let c=0;for(const u of l)++c%100===0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:u,component:u.subject,position:"s",id:a,issuer:s,hashToRelated:d}),this._addRelatedBlankNodeHash({quad:u,component:u.object,position:"o",id:a,issuer:s,hashToRelated:d}),this._addRelatedBlankNodeHash({quad:u,component:u.graph,position:"g",id:a,issuer:s,hashToRelated:d})]);return d}async _hashAndTrackBlankNode({id:a,hashToBlankNodes:s}){const d=await this.hashFirstDegreeQuads(a),l=s.get(d);l?l.push(a):s.set(d,[a])}_addBlankNodeQuadInfo({quad:a,component:s}){if(s.termType!=="BlankNode")return;const d=s.value,l=this.blankNodeInfo.get(d);l?l.quads.add(a):this.blankNodeInfo.set(d,{quads:new Set([a]),hash:null})}async _addRelatedBlankNodeHash({quad:a,component:s,position:d,id:l,issuer:c,hashToRelated:u}){if(!(s.termType==="BlankNode"&&s.value!==l))return;const v=s.value,g=await this.hashRelatedBlankNode(v,a,c,d),y=u.get(g);y?y.push(v):u.set(g,[v])}_componentWithCanonicalId(a){return a.termType==="BlankNode"&&!a.value.startsWith(this.canonicalIssuer.prefix)?{termType:"BlankNode",value:this.canonicalIssuer.getId(a.value)}:a}async _yield(){return new Promise(a=>setImmediate(a))}};function n(o,a){return o.hash<a.hash?-1:o.hash>a.hash?1:0}return no}/*!
|
|
318
318
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
319
319
|
*/var oo,Tl;function wp(){if(Tl)return oo;Tl=1;const r=pn(),e=Bc();return oo=class extends e{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new r("sha1")}modifyFirstDegreeComponent(i,n,o){return n.termType!=="BlankNode"?n:o==="graph"?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:n.value===i?"_:a":"_:z"}}getRelatedPredicate(i){return i.predicate.value}async createHashToRelated(i,n){const o=new Map,a=this.blankNodeInfo.get(i).quads;let s=0;for(const d of a){let l,c;if(d.subject.termType==="BlankNode"&&d.subject.value!==i)c=d.subject.value,l="p";else if(d.object.termType==="BlankNode"&&d.object.value!==i)c=d.object.value,l="r";else continue;++s%100===0&&await this._yield();const u=await this.hashRelatedBlankNode(c,d,n,l),v=o.get(u);v?v.push(c):o.set(u,[c])}return o}},oo}/*!
|
|
320
320
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
321
321
|
*/var ao,Al;function qc(){if(Al)return ao;Al=1;const r=Fa(),e=pn(),t=Mc(),i=Pa();ao=class{constructor({createMessageDigest:a=()=>new e("sha256"),canonicalIdMap:s=new Map,maxDeepIterations:d=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",s),this.createMessageDigest=a,this.maxDeepIterations=d,this.quads=null,this.deepIterations=null}main(a){this.deepIterations=new Map,this.quads=a;for(const v of a)this._addBlankNodeQuadInfo({quad:v,component:v.subject}),this._addBlankNodeQuadInfo({quad:v,component:v.object}),this._addBlankNodeQuadInfo({quad:v,component:v.graph});const s=new Map,d=[...this.blankNodeInfo.keys()];for(const v of d)this._hashAndTrackBlankNode({id:v,hashToBlankNodes:s});const l=[...s.keys()].sort(),c=[];for(const v of l){const g=s.get(v);if(g.length>1){c.push(g);continue}const y=g[0];this.canonicalIssuer.getId(y)}for(const v of c){const g=[];for(const y of v){if(this.canonicalIssuer.hasId(y))continue;const k=new r("_:b");k.getId(y);const x=this.hashNDegreeQuads(y,k);g.push(x)}g.sort(n);for(const y of g){const k=y.issuer.getOldIds();for(const x of k)this.canonicalIssuer.getId(x)}}const u=[];for(const v of this.quads){const g=i.serializeQuadComponents(this._componentWithCanonicalId({component:v.subject}),v.predicate,this._componentWithCanonicalId({component:v.object}),this._componentWithCanonicalId({component:v.graph}));u.push(g)}return u.sort(),u.join("")}hashFirstDegreeQuads(a){const s=[],d=this.blankNodeInfo.get(a),l=d.quads;for(const u of l){const v={subject:null,predicate:u.predicate,object:null,graph:null};v.subject=this.modifyFirstDegreeComponent(a,u.subject,"subject"),v.object=this.modifyFirstDegreeComponent(a,u.object,"object"),v.graph=this.modifyFirstDegreeComponent(a,u.graph,"graph"),s.push(i.serializeQuad(v))}s.sort();const c=this.createMessageDigest();for(const u of s)c.update(u);return d.hash=c.digest(),d.hash}hashRelatedBlankNode(a,s,d,l){let c;this.canonicalIssuer.hasId(a)?c=this.canonicalIssuer.getId(a):d.hasId(a)?c=d.getId(a):c=this.blankNodeInfo.get(a).hash;const u=this.createMessageDigest();return u.update(l),l!=="g"&&u.update(this.getRelatedPredicate(s)),u.update(c),u.digest()}hashNDegreeQuads(a,s){const d=this.deepIterations.get(a)||0;if(d>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(a,d+1);const l=this.createMessageDigest(),c=this.createHashToRelated(a,s),u=[...c.keys()].sort();for(const v of u){l.update(v);let g="",y;const k=new t(c.get(v));for(;k.hasNext();){const x=k.next();let _=s.clone(),E="";const m=[];let f=!1;for(const b of x)if(this.canonicalIssuer.hasId(b)?E+=this.canonicalIssuer.getId(b):(_.hasId(b)||m.push(b),E+=_.getId(b)),g.length!==0&&E>g){f=!0;break}if(!f){for(const b of m){const R=this.hashNDegreeQuads(b,_);if(E+=_.getId(b),E+=`<${R.hash}>`,_=R.issuer,g.length!==0&&E>g){f=!0;break}}f||(g.length===0||E<g)&&(g=E,y=_)}}l.update(g),s=y}return{hash:l.digest(),issuer:s}}modifyFirstDegreeComponent(a,s){return s.termType!=="BlankNode"?s:{termType:"BlankNode",value:s.value===a?"_:a":"_:z"}}getRelatedPredicate(a){return`<${a.predicate.value}>`}createHashToRelated(a,s){const d=new Map,l=this.blankNodeInfo.get(a).quads;for(const c of l)this._addRelatedBlankNodeHash({quad:c,component:c.subject,position:"s",id:a,issuer:s,hashToRelated:d}),this._addRelatedBlankNodeHash({quad:c,component:c.object,position:"o",id:a,issuer:s,hashToRelated:d}),this._addRelatedBlankNodeHash({quad:c,component:c.graph,position:"g",id:a,issuer:s,hashToRelated:d});return d}_hashAndTrackBlankNode({id:a,hashToBlankNodes:s}){const d=this.hashFirstDegreeQuads(a),l=s.get(d);l?l.push(a):s.set(d,[a])}_addBlankNodeQuadInfo({quad:a,component:s}){if(s.termType!=="BlankNode")return;const d=s.value,l=this.blankNodeInfo.get(d);l?l.quads.add(a):this.blankNodeInfo.set(d,{quads:new Set([a]),hash:null})}_addRelatedBlankNodeHash({quad:a,component:s,position:d,id:l,issuer:c,hashToRelated:u}){if(!(s.termType==="BlankNode"&&s.value!==l))return;const v=s.value,g=this.hashRelatedBlankNode(v,a,c,d),y=u.get(g);y?y.push(v):u.set(g,[v])}_componentWithCanonicalId({component:a}){return a.termType==="BlankNode"&&!a.value.startsWith(this.canonicalIssuer.prefix)?{termType:"BlankNode",value:this.canonicalIssuer.getId(a.value)}:a}};function n(o,a){return o.hash<a.hash?-1:o.hash>a.hash?1:0}return ao}/*!
|
|
322
322
|
* Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
|
|
323
|
-
*/var so,jl;function xp(){if(jl)return so;jl=1;const r=pn(),e=qc();return so=class extends e{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new r("sha1")}modifyFirstDegreeComponent(i,n,o){return n.termType!=="BlankNode"?n:o==="graph"?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:n.value===i?"_:a":"_:z"}}getRelatedPredicate(i){return i.predicate.value}createHashToRelated(i,n){const o=new Map,a=this.blankNodeInfo.get(i).quads;for(const s of a){let d,l;if(s.subject.termType==="BlankNode"&&s.subject.value!==i)l=s.subject.value,d="p";else if(s.object.termType==="BlankNode"&&s.object.value!==i)l=s.object.value,d="r";else continue;const c=this.hashRelatedBlankNode(l,s,n,d),u=o.get(c);u?u.push(l):o.set(c,[l])}return o}},so}const _p={},kp=Object.freeze(Object.defineProperty({__proto__:null,default:_p},Symbol.toStringTag,{value:"Module"})),Ep=iu(kp);var Dl;function Sp(){return Dl||(Dl=1,function(r){const e=Bc(),t=wp(),i=qc(),n=xp();let o;try{o=Ep}catch{}function a(s){return Array.isArray(s)?s:r.NQuads.legacyDatasetToQuads(s)}r.NQuads=Pa(),r.IdentifierIssuer=Fa(),r._rdfCanonizeNative=function(s){return s&&(o=s),o},r.canonize=async function(s,d){const l=a(s);if(d.useNative){if(!o)throw new Error("rdf-canonize-native not available");if(d.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return new Promise((c,u)=>o.canonize(l,d,(v,g)=>v?u(v):c(g)))}if(d.algorithm==="URDNA2015")return new e(d).main(l);if(d.algorithm==="URGNA2012"){if(d.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new t(d).main(l)}throw"algorithm"in d?new Error("Invalid RDF Dataset Canonicalization algorithm: "+d.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")},r._canonizeSync=function(s,d){const l=a(s);if(d.useNative){if(!o)throw new Error("rdf-canonize-native not available");if(d.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return o.canonizeSync(l,d)}if(d.algorithm==="URDNA2015")return new i(d).main(l);if(d.algorithm==="URGNA2012"){if(d.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new n(d).main(l)}throw"algorithm"in d?new Error("Invalid RDF Dataset Canonicalization algorithm: "+d.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")}}(Yn)),Yn}var lo,Ll;function Ma(){return Ll||(Ll=1,lo=Sp()),lo}var co,Ol;function lt(){if(Ol)return co;Ol=1;const r={};return co=r,r.isArray=Array.isArray,r.isBoolean=e=>typeof e=="boolean"||Object.prototype.toString.call(e)==="[object Boolean]",r.isDouble=e=>r.isNumber(e)&&(String(e).indexOf(".")!==-1||Math.abs(e)>=1e21),r.isEmptyObject=e=>r.isObject(e)&&Object.keys(e).length===0,r.isNumber=e=>typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]",r.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),r.isObject=e=>Object.prototype.toString.call(e)==="[object Object]",r.isString=e=>typeof e=="string"||Object.prototype.toString.call(e)==="[object String]",r.isUndefined=e=>typeof e>"u",co}var uo,Cl;function $t(){if(Cl)return uo;Cl=1;const r=lt(),e={};return uo=e,e.isSubject=t=>r.isObject(t)&&!("@value"in t||"@set"in t||"@list"in t)?Object.keys(t).length>1||!("@id"in t):!1,e.isSubjectReference=t=>r.isObject(t)&&Object.keys(t).length===1&&"@id"in t,e.isValue=t=>r.isObject(t)&&"@value"in t,e.isList=t=>r.isObject(t)&&"@list"in t,e.isGraph=t=>r.isObject(t)&&"@graph"in t&&Object.keys(t).filter(i=>i!=="@id"&&i!=="@index").length===1,e.isSimpleGraph=t=>e.isGraph(t)&&!("@id"in t),e.isBlankNode=t=>{if(r.isObject(t)){if("@id"in t){const i=t["@id"];return!r.isString(i)||i.indexOf("_:")===0}return Object.keys(t).length===0||!("@value"in t||"@set"in t||"@list"in t)}return!1},uo}var fo,$l;function pt(){return $l||($l=1,fo=class extends Error{constructor(e="An unspecified JSON-LD error occurred.",t="jsonld.Error",i={}){super(e),this.name=t,this.message=e,this.details=i}}),fo}var po,Fl;function ct(){if(Fl)return po;Fl=1;const r=$t(),e=lt(),t=Ma().IdentifierIssuer,i=pt(),n=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,o=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,a=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,s=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,d=/^@[a-zA-Z]+$/,l={headers:{accept:"application/ld+json, application/json"}},c={};po=c,c.IdentifierIssuer=t,c.REGEX_BCP47=n,c.REGEX_KEYWORD=d,c.clone=function(v){if(v&&typeof v=="object"){let g;if(e.isArray(v)){g=[];for(let y=0;y<v.length;++y)g[y]=c.clone(v[y])}else if(v instanceof Map){g=new Map;for(const[y,k]of v)g.set(y,c.clone(k))}else if(v instanceof Set){g=new Set;for(const y of v)g.add(c.clone(y))}else if(e.isObject(v)){g={};for(const y in v)g[y]=c.clone(v[y])}else g=v.toString();return g}return v},c.asArray=function(v){return Array.isArray(v)?v:[v]},c.buildHeaders=(v={})=>{if(Object.keys(v).some(y=>y.toLowerCase()==="accept"))throw new RangeError('Accept header may not be specified; only "'+l.headers.accept+'" is supported.');return Object.assign({Accept:l.headers.accept},v)},c.parseLinkHeader=v=>{const g={},y=v.match(o);for(let k=0;k<y.length;++k){let x=y[k].match(a);if(!x)continue;const _={target:x[1]},E=x[2];for(;x=s.exec(E);)_[x[1]]=x[2]===void 0?x[3]:x[2];const m=_.rel||"";Array.isArray(g[m])?g[m].push(_):g.hasOwnProperty(m)?g[m]=[g[m],_]:g[m]=_}return g},c.validateTypeValue=(v,g)=>{if(!e.isString(v)&&!(e.isArray(v)&&v.every(y=>e.isString(y)))){if(g&&e.isObject(v))switch(Object.keys(v).length){case 0:return;case 1:if("@default"in v&&c.asArray(v["@default"]).every(y=>e.isString(y)))return}throw new i('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:v})}},c.hasProperty=(v,g)=>{if(v.hasOwnProperty(g)){const y=v[g];return!e.isArray(y)||y.length>0}return!1},c.hasValue=(v,g,y)=>{if(c.hasProperty(v,g)){let k=v[g];const x=r.isList(k);if(e.isArray(k)||x){x&&(k=k["@list"]);for(let _=0;_<k.length;++_)if(c.compareValues(y,k[_]))return!0}else if(!e.isArray(y))return c.compareValues(y,k)}return!1},c.addValue=(v,g,y,k)=>{if(k=k||{},"propertyIsArray"in k||(k.propertyIsArray=!1),"valueIsArray"in k||(k.valueIsArray=!1),"allowDuplicate"in k||(k.allowDuplicate=!0),"prependValue"in k||(k.prependValue=!1),k.valueIsArray)v[g]=y;else if(e.isArray(y)){y.length===0&&k.propertyIsArray&&!v.hasOwnProperty(g)&&(v[g]=[]),k.prependValue&&(y=y.concat(v[g]),v[g]=[]);for(let x=0;x<y.length;++x)c.addValue(v,g,y[x],k)}else if(v.hasOwnProperty(g)){const x=!k.allowDuplicate&&c.hasValue(v,g,y);!e.isArray(v[g])&&(!x||k.propertyIsArray)&&(v[g]=[v[g]]),x||(k.prependValue?v[g].unshift(y):v[g].push(y))}else v[g]=k.propertyIsArray?[y]:y},c.getValues=(v,g)=>[].concat(v[g]||[]),c.removeProperty=(v,g)=>{delete v[g]},c.removeValue=(v,g,y,k)=>{k=k||{},"propertyIsArray"in k||(k.propertyIsArray=!1);const x=c.getValues(v,g).filter(_=>!c.compareValues(_,y));x.length===0?c.removeProperty(v,g):x.length===1&&!k.propertyIsArray?v[g]=x[0]:v[g]=x},c.relabelBlankNodes=(v,g)=>{g=g||{};const y=g.issuer||new t("_:b");return u(y,v)},c.compareValues=(v,g)=>v===g||r.isValue(v)&&r.isValue(g)&&v["@value"]===g["@value"]&&v["@type"]===g["@type"]&&v["@language"]===g["@language"]&&v["@index"]===g["@index"]?!0:e.isObject(v)&&"@id"in v&&e.isObject(g)&&"@id"in g?v["@id"]===g["@id"]:!1,c.compareShortestLeast=(v,g)=>v.length<g.length?-1:g.length<v.length?1:v===g?0:v<g?-1:1;function u(v,g){if(e.isArray(g))for(let y=0;y<g.length;++y)g[y]=u(v,g[y]);else if(r.isList(g))g["@list"]=u(v,g["@list"]);else if(e.isObject(g)){r.isBlankNode(g)&&(g["@id"]=v.getId(g["@id"]));const y=Object.keys(g).sort();for(let k=0;k<y.length;++k){const x=y[k];x!=="@id"&&(g[x]=u(v,g[x]))}}return g}return po}var ho,Pl;function Ba(){if(Pl)return ho;Pl=1;const r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",e="http://www.w3.org/2001/XMLSchema#";return ho={LINK_HEADER_REL:"http://www.w3.org/ns/json-ld#context",LINK_HEADER_CONTEXT:"http://www.w3.org/ns/json-ld#context",RDF:r,RDF_LIST:r+"List",RDF_FIRST:r+"first",RDF_REST:r+"rest",RDF_NIL:r+"nil",RDF_TYPE:r+"type",RDF_PLAIN_LITERAL:r+"PlainLiteral",RDF_XML_LITERAL:r+"XMLLiteral",RDF_JSON_LITERAL:r+"JSON",RDF_OBJECT:r+"object",RDF_LANGSTRING:r+"langString",XSD:e,XSD_BOOLEAN:e+"boolean",XSD_DOUBLE:e+"double",XSD_INTEGER:e+"integer",XSD_STRING:e+"string"},ho}var bo,Ml;function zc(){return Ml||(Ml=1,bo=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]}}}),bo}var mo,Bl;function Xt(){if(Bl)return mo;Bl=1;const r=lt(),e={};mo=e,e.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*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},e.parse=(i,n)=>{const o={},a=e.parsers[n||"full"],s=a.regex.exec(i);let d=a.keys.length;for(;d--;)o[a.keys[d]]=s[d]===void 0?null:s[d];return(o.scheme==="https"&&o.port==="443"||o.scheme==="http"&&o.port==="80")&&(o.href=o.href.replace(":"+o.port,""),o.authority=o.authority.replace(":"+o.port,""),o.port=null),o.normalizedPath=e.removeDotSegments(o.path),o},e.prependBase=(i,n)=>{if(i===null||e.isAbsolute(n))return n;(!i||r.isString(i))&&(i=e.parse(i||""));const o=e.parse(n),a={protocol:i.protocol||""};if(o.authority!==null)a.authority=o.authority,a.path=o.path,a.query=o.query;else if(a.authority=i.authority,o.path==="")a.path=i.path,o.query!==null?a.query=o.query:a.query=i.query;else{if(o.path.indexOf("/")===0)a.path=o.path;else{let d=i.path;d=d.substr(0,d.lastIndexOf("/")+1),(d.length>0||i.authority)&&d.substr(-1)!=="/"&&(d+="/"),d+=o.path,a.path=d}a.query=o.query}o.path!==""&&(a.path=e.removeDotSegments(a.path));let s=a.protocol;return a.authority!==null&&(s+="//"+a.authority),s+=a.path,a.query!==null&&(s+="?"+a.query),o.fragment!==null&&(s+="#"+o.fragment),s===""&&(s="./"),s},e.removeBase=(i,n)=>{if(i===null)return n;(!i||r.isString(i))&&(i=e.parse(i||""));let o="";if(i.href!==""?o+=(i.protocol||"")+"//"+(i.authority||""):n.indexOf("//")&&(o+="//"),n.indexOf(o)!==0)return n;const a=e.parse(n.substr(o.length)),s=i.normalizedPath.split("/"),d=a.normalizedPath.split("/"),l=a.fragment||a.query?0:1;for(;s.length>0&&d.length>l&&s[0]===d[0];)s.shift(),d.shift();let c="";if(s.length>0){s.pop();for(let u=0;u<s.length;++u)c+="../"}return c+=d.join("/"),a.query!==null&&(c+="?"+a.query),a.fragment!==null&&(c+="#"+a.fragment),c===""&&(c="./"),c},e.removeDotSegments=i=>{if(i.length===0)return"";const n=i.split("/"),o=[];for(;n.length>0;){const a=n.shift(),s=n.length===0;if(a==="."){s&&o.push("");continue}if(a===".."){o.pop(),s&&o.push("");continue}o.push(a)}return i[0]==="/"&&o.length>0&&o[0]!==""&&o.unshift(""),o.length===1&&o[0]===""?"/":o.join("/")};const t=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;return e.isAbsolute=i=>r.isString(i)&&t.test(i),e.isRelative=i=>r.isString(i),mo}var go,ql;function Rp(){if(ql)return go;ql=1;const{parseLinkHeader:r,buildHeaders:e}=ct(),{LINK_HEADER_CONTEXT:t}=Ba(),i=pt(),n=zc(),{prependBase:o}=Xt(),a=/(^|(\r\n))link:/i;go=({secure:d,headers:l={},xhr:c}={headers:{}})=>{return l=e(l),new n().wrapLoader(v);async function v(g){if(g.indexOf("http:")!==0&&g.indexOf("https:")!==0)throw new i('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:g});if(d&&g.indexOf("https")!==0)throw new i(`URL could not be dereferenced; secure mode is enabled and the URL's scheme is not "https".`,"jsonld.InvalidUrl",{code:"loading document failed",url:g});let y;try{y=await s(c,g,l)}catch(m){throw new i("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:g,cause:m})}if(y.status>=400)throw new i("URL could not be dereferenced: "+y.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:g,httpStatusCode:y.status});let k={contextUrl:null,documentUrl:g,document:y.response},x=null;const _=y.getResponseHeader("Content-Type");let E;if(a.test(y.getAllResponseHeaders())&&(E=y.getResponseHeader("Link")),E&&_!=="application/ld+json"){const m=r(E),f=m[t];if(Array.isArray(f))throw new i("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:g});f&&(k.contextUrl=f.target),x=m.alternate,x&&x.type=="application/ld+json"&&!(_||"").match(/^application\/(\w*\+)?json$/)&&(k=await v(o(g,x.target)))}return k}};function s(d,l,c){d=d||XMLHttpRequest;const u=new d;return new Promise((v,g)=>{u.onload=()=>v(u),u.onerror=y=>g(y),u.open("GET",l,!0);for(const y in c)u.setRequestHeader(y,c[y]);u.send()})}return go}var vo,zl;function Np(){if(zl)return vo;zl=1;const r=Rp(),e={};return vo=e,e.setupDocumentLoaders=function(t){typeof XMLHttpRequest<"u"&&(t.documentLoaders.xhr=r,t.useDocumentLoader("xhr"))},e.setupGlobals=function(t){typeof globalThis.JsonLdProcessor>"u"&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:t.JsonLdProcessor})},vo}var yo,Ul;function Ip(){return Ul||(Ul=1,yo=function(r){r.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),yo}var wo,Hl;function Tp(){if(Hl)return wo;Hl=1,wo=r,r.Node=n,r.create=r;function r(o){var a=this;if(a instanceof r||(a=new r),a.tail=null,a.head=null,a.length=0,o&&typeof o.forEach=="function")o.forEach(function(l){a.push(l)});else if(arguments.length>0)for(var s=0,d=arguments.length;s<d;s++)a.push(arguments[s]);return a}r.prototype.removeNode=function(o){if(o.list!==this)throw new Error("removing node which does not belong to this list");var a=o.next,s=o.prev;return a&&(a.prev=s),s&&(s.next=a),o===this.head&&(this.head=a),o===this.tail&&(this.tail=s),o.list.length--,o.next=null,o.prev=null,o.list=null,a},r.prototype.unshiftNode=function(o){if(o!==this.head){o.list&&o.list.removeNode(o);var a=this.head;o.list=this,o.next=a,a&&(a.prev=o),this.head=o,this.tail||(this.tail=o),this.length++}},r.prototype.pushNode=function(o){if(o!==this.tail){o.list&&o.list.removeNode(o);var a=this.tail;o.list=this,o.prev=a,a&&(a.next=o),this.tail=o,this.head||(this.head=o),this.length++}},r.prototype.push=function(){for(var o=0,a=arguments.length;o<a;o++)t(this,arguments[o]);return this.length},r.prototype.unshift=function(){for(var o=0,a=arguments.length;o<a;o++)i(this,arguments[o]);return this.length},r.prototype.pop=function(){if(this.tail){var o=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,o}},r.prototype.shift=function(){if(this.head){var o=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,o}},r.prototype.forEach=function(o,a){a=a||this;for(var s=this.head,d=0;s!==null;d++)o.call(a,s.value,d,this),s=s.next},r.prototype.forEachReverse=function(o,a){a=a||this;for(var s=this.tail,d=this.length-1;s!==null;d--)o.call(a,s.value,d,this),s=s.prev},r.prototype.get=function(o){for(var a=0,s=this.head;s!==null&&a<o;a++)s=s.next;if(a===o&&s!==null)return s.value},r.prototype.getReverse=function(o){for(var a=0,s=this.tail;s!==null&&a<o;a++)s=s.prev;if(a===o&&s!==null)return s.value},r.prototype.map=function(o,a){a=a||this;for(var s=new r,d=this.head;d!==null;)s.push(o.call(a,d.value,this)),d=d.next;return s},r.prototype.mapReverse=function(o,a){a=a||this;for(var s=new r,d=this.tail;d!==null;)s.push(o.call(a,d.value,this)),d=d.prev;return s},r.prototype.reduce=function(o,a){var s,d=this.head;if(arguments.length>1)s=a;else if(this.head)d=this.head.next,s=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var l=0;d!==null;l++)s=o(s,d.value,l),d=d.next;return s},r.prototype.reduceReverse=function(o,a){var s,d=this.tail;if(arguments.length>1)s=a;else if(this.tail)d=this.tail.prev,s=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var l=this.length-1;d!==null;l--)s=o(s,d.value,l),d=d.prev;return s},r.prototype.toArray=function(){for(var o=new Array(this.length),a=0,s=this.head;s!==null;a++)o[a]=s.value,s=s.next;return o},r.prototype.toArrayReverse=function(){for(var o=new Array(this.length),a=0,s=this.tail;s!==null;a++)o[a]=s.value,s=s.prev;return o},r.prototype.slice=function(o,a){a=a||this.length,a<0&&(a+=this.length),o=o||0,o<0&&(o+=this.length);var s=new r;if(a<o||a<0)return s;o<0&&(o=0),a>this.length&&(a=this.length);for(var d=0,l=this.head;l!==null&&d<o;d++)l=l.next;for(;l!==null&&d<a;d++,l=l.next)s.push(l.value);return s},r.prototype.sliceReverse=function(o,a){a=a||this.length,a<0&&(a+=this.length),o=o||0,o<0&&(o+=this.length);var s=new r;if(a<o||a<0)return s;o<0&&(o=0),a>this.length&&(a=this.length);for(var d=this.length,l=this.tail;l!==null&&d>a;d--)l=l.prev;for(;l!==null&&d>o;d--,l=l.prev)s.push(l.value);return s},r.prototype.splice=function(o,a,...s){o>this.length&&(o=this.length-1),o<0&&(o=this.length+o);for(var d=0,l=this.head;l!==null&&d<o;d++)l=l.next;for(var c=[],d=0;l&&d<a;d++)c.push(l.value),l=this.removeNode(l);l===null&&(l=this.tail),l!==this.head&&l!==this.tail&&(l=l.prev);for(var d=0;d<s.length;d++)l=e(this,l,s[d]);return c},r.prototype.reverse=function(){for(var o=this.head,a=this.tail,s=o;s!==null;s=s.prev){var d=s.prev;s.prev=s.next,s.next=d}return this.head=a,this.tail=o,this};function e(o,a,s){var d=a===o.head?new n(s,null,a,o):new n(s,a,a.next,o);return d.next===null&&(o.tail=d),d.prev===null&&(o.head=d),o.length++,d}function t(o,a){o.tail=new n(a,o.tail,null,o),o.head||(o.head=o.tail),o.length++}function i(o,a){o.head=new n(a,null,o.head,o),o.tail||(o.tail=o.head),o.length++}function n(o,a,s,d){if(!(this instanceof n))return new n(o,a,s,d);this.list=d,this.value=o,a?(a.next=this,this.prev=a):this.prev=null,s?(s.prev=this,this.next=s):this.next=null}try{Ip()(r)}catch{}return wo}var xo,Gl;function Uc(){if(Gl)return xo;Gl=1;const r=Tp(),e=Symbol("max"),t=Symbol("length"),i=Symbol("lengthCalculator"),n=Symbol("allowStale"),o=Symbol("maxAge"),a=Symbol("dispose"),s=Symbol("noDisposeOnSet"),d=Symbol("lruList"),l=Symbol("cache"),c=Symbol("updateAgeOnGet"),u=()=>1;class v{constructor(f){if(typeof f=="number"&&(f={max:f}),f||(f={}),f.max&&(typeof f.max!="number"||f.max<0))throw new TypeError("max must be a non-negative number");this[e]=f.max||1/0;const b=f.length||u;if(this[i]=typeof b!="function"?u:b,this[n]=f.stale||!1,f.maxAge&&typeof f.maxAge!="number")throw new TypeError("maxAge must be a number");this[o]=f.maxAge||0,this[a]=f.dispose,this[s]=f.noDisposeOnSet||!1,this[c]=f.updateAgeOnGet||!1,this.reset()}set max(f){if(typeof f!="number"||f<0)throw new TypeError("max must be a non-negative number");this[e]=f||1/0,k(this)}get max(){return this[e]}set allowStale(f){this[n]=!!f}get allowStale(){return this[n]}set maxAge(f){if(typeof f!="number")throw new TypeError("maxAge must be a non-negative number");this[o]=f,k(this)}get maxAge(){return this[o]}set lengthCalculator(f){typeof f!="function"&&(f=u),f!==this[i]&&(this[i]=f,this[t]=0,this[d].forEach(b=>{b.length=this[i](b.value,b.key),this[t]+=b.length})),k(this)}get lengthCalculator(){return this[i]}get length(){return this[t]}get itemCount(){return this[d].length}rforEach(f,b){b=b||this;for(let R=this[d].tail;R!==null;){const L=R.prev;E(this,f,R,b),R=L}}forEach(f,b){b=b||this;for(let R=this[d].head;R!==null;){const L=R.next;E(this,f,R,b),R=L}}keys(){return this[d].toArray().map(f=>f.key)}values(){return this[d].toArray().map(f=>f.value)}reset(){this[a]&&this[d]&&this[d].length&&this[d].forEach(f=>this[a](f.key,f.value)),this[l]=new Map,this[d]=new r,this[t]=0}dump(){return this[d].map(f=>y(this,f)?!1:{k:f.key,v:f.value,e:f.now+(f.maxAge||0)}).toArray().filter(f=>f)}dumpLru(){return this[d]}set(f,b,R){if(R=R||this[o],R&&typeof R!="number")throw new TypeError("maxAge must be a number");const L=R?Date.now():0,T=this[i](b,f);if(this[l].has(f)){if(T>this[e])return x(this,this[l].get(f)),!1;const $=this[l].get(f).value;return this[a]&&(this[s]||this[a](f,$.value)),$.now=L,$.maxAge=R,$.value=b,this[t]+=T-$.length,$.length=T,this.get(f),k(this),!0}const B=new _(f,b,T,L,R);return B.length>this[e]?(this[a]&&this[a](f,b),!1):(this[t]+=B.length,this[d].unshift(B),this[l].set(f,this[d].head),k(this),!0)}has(f){if(!this[l].has(f))return!1;const b=this[l].get(f).value;return!y(this,b)}get(f){return g(this,f,!0)}peek(f){return g(this,f,!1)}pop(){const f=this[d].tail;return f?(x(this,f),f.value):null}del(f){x(this,this[l].get(f))}load(f){this.reset();const b=Date.now();for(let R=f.length-1;R>=0;R--){const L=f[R],T=L.e||0;if(T===0)this.set(L.k,L.v);else{const B=T-b;B>0&&this.set(L.k,L.v,B)}}}prune(){this[l].forEach((f,b)=>g(this,b,!1))}}const g=(m,f,b)=>{const R=m[l].get(f);if(R){const L=R.value;if(y(m,L)){if(x(m,R),!m[n])return}else b&&(m[c]&&(R.value.now=Date.now()),m[d].unshiftNode(R));return L.value}},y=(m,f)=>{if(!f||!f.maxAge&&!m[o])return!1;const b=Date.now()-f.now;return f.maxAge?b>f.maxAge:m[o]&&b>m[o]},k=m=>{if(m[t]>m[e])for(let f=m[d].tail;m[t]>m[e]&&f!==null;){const b=f.prev;x(m,f),f=b}},x=(m,f)=>{if(f){const b=f.value;m[a]&&m[a](b.key,b.value),m[t]-=b.length,m[l].delete(b.key),m[d].removeNode(f)}};class _{constructor(f,b,R,L,T){this.key=f,this.value=b,this.length=R,this.now=L,this.maxAge=T||0}}const E=(m,f,b,R)=>{let L=b.value;y(m,L)&&(x(m,b),m[n]||(L=void 0)),L&&f.call(R,L.value,L.key,m)};return xo=v,xo}var _o,Vl;function Ap(){if(Vl)return _o;Vl=1;const r=Uc(),e=10;return _o=class{constructor({document:i}){this.document=i,this.cache=new r({max:e})}getProcessed(i){return this.cache.get(i)}setProcessed(i,n){this.cache.set(i,n)}},_o}var ko,Wl;function jp(){if(Wl)return ko;Wl=1;const{isArray:r,isObject:e,isString:t}=lt(),{asArray:i}=ct(),{prependBase:n}=Xt(),o=pt(),a=Ap(),s=10;ko=class{constructor({sharedCache:u}){this.perOpCache=new Map,this.sharedCache=u}async resolve({activeCtx:u,context:v,documentLoader:g,base:y,cycles:k=new Set}){v&&e(v)&&v["@context"]&&(v=v["@context"]),v=i(v);const x=[];for(const _ of v){if(t(_)){let f=this._get(_);f||(f=await this._resolveRemoteContext({activeCtx:u,url:_,documentLoader:g,base:y,cycles:k})),r(f)?x.push(...f):x.push(f);continue}if(_===null){x.push(new a({document:null}));continue}e(_)||d(v);const E=JSON.stringify(_);let m=this._get(E);m||(m=new a({document:_}),this._cacheResolvedContext({key:E,resolved:m,tag:"static"})),x.push(m)}return x}_get(u){let v=this.perOpCache.get(u);if(!v){const g=this.sharedCache.get(u);g&&(v=g.get("static"),v&&this.perOpCache.set(u,v))}return v}_cacheResolvedContext({key:u,resolved:v,tag:g}){if(this.perOpCache.set(u,v),g!==void 0){let y=this.sharedCache.get(u);y||(y=new Map,this.sharedCache.set(u,y)),y.set(g,v)}return v}async _resolveRemoteContext({activeCtx:u,url:v,documentLoader:g,base:y,cycles:k}){v=n(y,v);const{context:x,remoteDoc:_}=await this._fetchContext({activeCtx:u,url:v,documentLoader:g,cycles:k});y=_.documentUrl||v,l({context:x,base:y});const E=await this.resolve({activeCtx:u,context:x,documentLoader:g,base:y,cycles:k});return this._cacheResolvedContext({key:v,resolved:E,tag:_.tag}),E}async _fetchContext({activeCtx:u,url:v,documentLoader:g,cycles:y}){if(y.size>s)throw new o("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:u.processingMode==="json-ld-1.0"?"loading remote context failed":"context overflow",max:s});if(y.has(v))throw new o("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:u.processingMode==="json-ld-1.0"?"recursive context inclusion":"context overflow",url:v});y.add(v);let k,x;try{x=await g(v),k=x.document||null,t(k)&&(k=JSON.parse(k))}catch(_){throw new o(`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. URL: "${v}".`,"jsonld.InvalidUrl",{code:"loading remote context failed",url:v,cause:_})}if(!e(k))throw new o(`Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object. URL: "${v}".`,"jsonld.InvalidUrl",{code:"invalid remote context",url:v});return"@context"in k?k={"@context":k["@context"]}:k={"@context":{}},x.contextUrl&&(r(k["@context"])||(k["@context"]=[k["@context"]]),k["@context"].push(x.contextUrl)),{context:k,remoteDoc:x}}};function d(c){throw new o("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:c})}function l({context:c,base:u}){if(!c)return;const v=c["@context"];if(t(v)){c["@context"]=n(u,v);return}if(r(v)){for(let g=0;g<v.length;++g){const y=v[g];if(t(y)){v[g]=n(u,y);continue}e(y)&&l({context:{"@context":y},base:u})}return}if(e(v))for(const g in v)l({context:v[g],base:u})}return ko}var Eo,Xl;function Dp(){return Xl||(Xl=1,Eo=Ma().NQuads),Eo}var So,Ql;function Ri(){if(Ql)return So;Ql=1;const r=pt(),{isArray:e}=lt(),{asArray:t}=ct(),i={};So=i,i.defaultEventHandler=null,i.setupEventHandler=({options:a={}})=>{const s=[].concat(a.safe?i.safeEventHandler:[],a.eventHandler?t(a.eventHandler):[],i.defaultEventHandler?i.defaultEventHandler:[]);return s.length===0?null:s},i.handleEvent=({event:a,options:s})=>{n({event:a,handlers:s.eventHandler})};function n({event:a,handlers:s}){let d=!0;for(let l=0;d&&l<s.length;++l){d=!1;const c=s[l];if(e(c))d=n({event:a,handlers:c});else if(typeof c=="function")c({event:a,next:()=>{d=!0}});else if(typeof c=="object")a.code in c?c[a.code]({event:a,next:()=>{d=!0}}):d=!0;else throw new r("Invalid event handler.","jsonld.InvalidEventHandler",{event:a})}return d}const o=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"]);return i.safeEventHandler=function({event:s,next:d}){if(s.level==="warning"&&o.has(s.code))throw new r("Safe mode validation error.","jsonld.ValidationError",{event:s});d()},i.logEventHandler=function({event:s,next:d}){console.log(`EVENT: ${s.message}`,{event:s}),d()},i.logWarningEventHandler=function({event:s,next:d}){s.level==="warning"&&console.warn(`WARNING: ${s.message}`,{event:s}),d()},i.unhandledEventHandler=function({event:s}){throw new r("No handler for event.","jsonld.UnhandledEvent",{event:s})},i.setDefaultEventHandler=function({eventHandler:a}={}){i.defaultEventHandler=a?t(a):null},So}var Ro,Jl;function dr(){if(Jl)return Ro;Jl=1;const r=ct(),e=pt(),{isArray:t,isObject:i,isString:n,isUndefined:o}=lt(),{isAbsolute:a,isRelative:s,prependBase:d}=Xt(),{handleEvent:l}=Ri(),{REGEX_BCP47:c,REGEX_KEYWORD:u,asArray:v,compareShortestLeast:g}=ct(),y=new Map,k=1e4,x={};Ro=x,x.process=async({activeCtx:m,localCtx:f,options:b,propagate:R=!0,overrideProtected:L=!1,cycles:T=new Set})=>{if(i(f)&&"@context"in f&&t(f["@context"])&&(f=f["@context"]),v(f).length===0)return m;const N=[],$=[({event:te,next:I})=>{N.push(te),I()}];b.eventHandler&&$.push(b.eventHandler);const q=b;b={...b,eventHandler:$};const A=await b.contextResolver.resolve({activeCtx:m,context:f,documentLoader:b.documentLoader,base:b.base});i(A[0].document)&&typeof A[0].document["@propagate"]=="boolean"&&(R=A[0].document["@propagate"]);let j=m;!R&&!j.previousContext&&(j=j.clone(),j.previousContext=m);for(const te of A){let{document:I}=te;if(m=j,I===null){if(!L&&Object.keys(m.protected).length!==0)throw new e("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});j=m=x.getInitialContext(b).clone();continue}const Z=te.getProcessed(m);if(Z){if(q.eventHandler)for(const Y of Z.events)l({event:Y,options:q});j=m=Z.context;continue}if(i(I)&&"@context"in I&&(I=I["@context"]),!i(I))throw new e("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:I});j=j.clone();const F=new Map;if("@version"in I){if(I["@version"]!==1.1)throw new e("Unsupported JSON-LD version: "+I["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:I});if(m.processingMode&&m.processingMode==="json-ld-1.0")throw new e("@version: "+I["@version"]+" not compatible with "+m.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:I});j.processingMode="json-ld-1.1",j["@version"]=I["@version"],F.set("@version",!0)}if(j.processingMode=j.processingMode||m.processingMode,"@base"in I){let Y=I["@base"];if(!(Y===null||a(Y)))if(s(Y))Y=d(j["@base"],Y);else throw new e('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:I});j["@base"]=Y,F.set("@base",!0)}if("@vocab"in I){const Y=I["@vocab"];if(Y===null)delete j["@vocab"];else if(n(Y)){if(!a(Y)&&x.processingMode(j,1))throw new e('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:I});{const w=_(j,Y,{vocab:!0,base:!0},void 0,void 0,b);a(w)||b.eventHandler&&l({event:{type:["JsonLdEvent"],code:"relative @vocab reference",level:"warning",message:"Relative @vocab reference found.",details:{vocab:w}},options:b}),j["@vocab"]=w}}else throw new e('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:I});F.set("@vocab",!0)}if("@language"in I){const Y=I["@language"];if(Y===null)delete j["@language"];else if(n(Y))Y.match(c)||b.eventHandler&&l({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:Y}},options:b}),j["@language"]=Y.toLowerCase();else throw new e('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:I});F.set("@language",!0)}if("@direction"in I){const Y=I["@direction"];if(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @direction not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:I});if(Y===null)delete j["@direction"];else{if(Y!=="ltr"&&Y!=="rtl")throw new e('Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:I});j["@direction"]=Y}F.set("@direction",!0)}if("@propagate"in I){const Y=I["@propagate"];if(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @propagate not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:I});if(typeof Y!="boolean")throw new e("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:f});F.set("@propagate",!0)}if("@import"in I){const Y=I["@import"];if(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @import not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:I});if(!n(Y))throw new e("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:f});const w=await b.contextResolver.resolve({activeCtx:m,context:Y,documentLoader:b.documentLoader,base:b.base});if(w.length!==1)throw new e("Invalid JSON-LD syntax; @import must reference a single context.","jsonld.SyntaxError",{code:"invalid remote context",context:f});const U=w[0].getProcessed(m);if(U)I=U;else{const K=w[0].document;if("@import"in K)throw new e("Invalid JSON-LD syntax: imported context must not include @import.","jsonld.SyntaxError",{code:"invalid context entry",context:f});for(const X in K)I.hasOwnProperty(X)||(I[X]=K[X]);w[0].setProcessed(m,I)}F.set("@import",!0)}F.set("@protected",I["@protected"]||!1);for(const Y in I)if(x.createTermDefinition({activeCtx:j,localCtx:I,term:Y,defined:F,options:b,overrideProtected:L}),i(I[Y])&&"@context"in I[Y]){const w=I[Y]["@context"];let U=!0;if(n(w)){const K=d(b.base,w);T.has(K)?U=!1:T.add(K)}if(U)try{await x.process({activeCtx:j.clone(),localCtx:I[Y]["@context"],overrideProtected:!0,options:b,cycles:T})}catch{throw new e("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:I[Y]["@context"],term:Y})}}te.setProcessed(m,{context:j,events:N})}return j},x.createTermDefinition=({activeCtx:m,localCtx:f,term:b,defined:R,options:L,overrideProtected:T=!1})=>{if(R.has(b)){if(R.get(b))return;throw new e("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:f,term:b})}R.set(b,!1);let B;if(f.hasOwnProperty(b)&&(B=f[b]),b==="@type"&&i(B)&&(B["@container"]||"@set")==="@set"&&x.processingMode(m,1.1)){const I=["@container","@id","@protected"],Z=Object.keys(B);if(Z.length===0||Z.some(F=>!I.includes(F)))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:f,term:b})}else{if(x.isKeyword(b))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:f,term:b});if(b.match(u)){L.eventHandler&&l({event:{type:["JsonLdEvent"],code:"reserved term",level:"warning",message:'Terms beginning with "@" are reserved for future use and dropped.',details:{term:b}},options:L});return}else if(b==="")throw new e("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:f})}const N=m.mappings.get(b);m.mappings.has(b)&&m.mappings.delete(b);let $=!1;if((n(B)||B===null)&&($=!0,B={"@id":B}),!i(B))throw new e("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:f});const q={};m.mappings.set(b,q),q.reverse=!1;const A=["@container","@id","@language","@reverse","@type"];x.processingMode(m,1.1)&&A.push("@context","@direction","@index","@nest","@prefix","@protected");for(const I in B)if(!A.includes(I))throw new e("Invalid JSON-LD syntax; a term definition must not contain "+I,"jsonld.SyntaxError",{code:"invalid term definition",context:f});const j=b.indexOf(":");if(q._termHasColon=j>0,"@reverse"in B){if("@id"in B)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:f});if("@nest"in B)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:f});const I=B["@reverse"];if(!n(I))throw new e("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:f});if(I.match(u)){L.eventHandler&&l({event:{type:["JsonLdEvent"],code:"reserved @reverse value",level:"warning",message:'@reverse values beginning with "@" are reserved for future use and dropped.',details:{reverse:I}},options:L}),N?m.mappings.set(b,N):m.mappings.delete(b);return}const Z=_(m,I,{vocab:!0,base:!1},f,R,L);if(!a(Z))throw new e("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:f});q["@id"]=Z,q.reverse=!0}else if("@id"in B){let I=B["@id"];if(I&&!n(I))throw new e("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:f});if(I===null)q["@id"]=null;else if(!x.isKeyword(I)&&I.match(u)){L.eventHandler&&l({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:'@id values beginning with "@" are reserved for future use and dropped.',details:{id:I}},options:L}),N?m.mappings.set(b,N):m.mappings.delete(b);return}else if(I!==b){if(I=_(m,I,{vocab:!0,base:!1},f,R,L),!a(I)&&!x.isKeyword(I))throw new e("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:f});if(b.match(/(?::[^:])|\//)){const Z=new Map(R).set(b,!0);if(_(m,b,{vocab:!0,base:!1},f,Z,L)!==I)throw new e("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:f})}q["@id"]=I,q._prefix=$&&!q._termHasColon&&I.match(/[:\/\?#\[\]@]$/)!==null}}if(!("@id"in q))if(q._termHasColon){const I=b.substr(0,j);if(f.hasOwnProperty(I)&&x.createTermDefinition({activeCtx:m,localCtx:f,term:I,defined:R,options:L}),m.mappings.has(I)){const Z=b.substr(j+1);q["@id"]=m.mappings.get(I)["@id"]+Z}else q["@id"]=b}else if(b==="@type")q["@id"]=b;else{if(!("@vocab"in m))throw new e("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:f,term:b});q["@id"]=m["@vocab"]+b}if((B["@protected"]===!0||R.get("@protected")===!0&&B["@protected"]!==!1)&&(m.protected[b]=!0,q.protected=!0),R.set(b,!0),"@type"in B){let I=B["@type"];if(!n(I))throw new e("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:f});if(I==="@json"||I==="@none"){if(x.processingMode(m,1))throw new e(`Invalid JSON-LD syntax; an @context @type value must not be "${I}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:f})}else if(I!=="@id"&&I!=="@vocab"){if(I=_(m,I,{vocab:!0,base:!1},f,R,L),!a(I))throw new e("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:f});if(I.indexOf("_:")===0)throw new e("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:f})}q["@type"]=I}if("@container"in B){const I=n(B["@container"])?[B["@container"]]:B["@container"]||[],Z=["@list","@set","@index","@language"];let F=!0;const Y=I.includes("@set");if(x.processingMode(m,1.1)){if(Z.push("@graph","@id","@type"),I.includes("@list")){if(I.length!==1)throw new e("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:f})}else if(I.includes("@graph")){if(I.some(w=>w!=="@graph"&&w!=="@id"&&w!=="@index"&&w!=="@set"))throw new e("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:f})}else F&=I.length<=(Y?2:1);if(I.includes("@type")&&(q["@type"]=q["@type"]||"@id",!["@id","@vocab"].includes(q["@type"])))throw new e("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:f})}else F&=!t(B["@container"]),F&=I.length<=1;if(F&=I.every(w=>Z.includes(w)),F&=!(Y&&I.includes("@list")),!F)throw new e("Invalid JSON-LD syntax; @context @container value must be one of the following: "+Z.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:f});if(q.reverse&&!I.every(w=>["@index","@set"].includes(w)))throw new e("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:f});q["@container"]=I}if("@index"in B){if(!("@container"in B)||!q["@container"].includes("@index"))throw new e(`Invalid JSON-LD syntax; @index without @index in @container: "${B["@index"]}" on term "${b}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:f});if(!n(B["@index"])||B["@index"].indexOf("@")===0)throw new e(`Invalid JSON-LD syntax; @index must expand to an IRI: "${B["@index"]}" on term "${b}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:f});q["@index"]=B["@index"]}if("@context"in B&&(q["@context"]=B["@context"]),"@language"in B&&!("@type"in B)){let I=B["@language"];if(I!==null&&!n(I))throw new e("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:f});I!==null&&(I=I.toLowerCase()),q["@language"]=I}if("@prefix"in B){if(b.match(/:|\//))throw new e("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:f});if(x.isKeyword(q["@id"]))throw new e("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:f});if(typeof B["@prefix"]=="boolean")q._prefix=B["@prefix"]===!0;else throw new e("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:f})}if("@direction"in B){const I=B["@direction"];if(I!==null&&I!=="ltr"&&I!=="rtl")throw new e('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:f});q["@direction"]=I}if("@nest"in B){const I=B["@nest"];if(!n(I)||I!=="@nest"&&I.indexOf("@")===0)throw new e("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:f});q["@nest"]=I}// disallow aliasing @context and @preserve
|
|
324
|
-
const te=q["@id"];if(te==="@context"||te==="@preserve")throw new e("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:f});if(N&&N.protected&&!T&&(m.protected[b]=!0,q.protected=!0,!E(N,q)))throw new e("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:f,term:b})},x.expandIri=(m,f,b,R)=>_(m,f,b,void 0,void 0,R);function _(m,f,b,R,L,T){if(f===null||!n(f)||x.isKeyword(f))return f;if(f.match(u))return null;if(R&&R.hasOwnProperty(f)&&L.get(f)!==!0&&x.createTermDefinition({activeCtx:m,localCtx:R,term:f,defined:L,options:T}),b=b||{},b.vocab){const N=m.mappings.get(f);if(N===null)return null;if(i(N)&&"@id"in N)return N["@id"]}const B=f.indexOf(":");if(B>0){const N=f.substr(0,B),$=f.substr(B+1);if(N==="_"||$.indexOf("//")===0)return f;R&&R.hasOwnProperty(N)&&x.createTermDefinition({activeCtx:m,localCtx:R,term:N,defined:L,options:T});const q=m.mappings.get(N);if(q&&q._prefix)return q["@id"]+$;if(a(f))return f}if(b.vocab&&"@vocab"in m)f=m["@vocab"]+f;else if(b.base){let N,$;"@base"in m?m["@base"]?($=d(T.base,m["@base"]),N=d($,f)):($=m["@base"],N=f):($=T.base,N=d(T.base,f)),f=N}return f}x.getInitialContext=m=>{const f=JSON.stringify({processingMode:m.processingMode}),b=y.get(f);if(b)return b;const R={processingMode:m.processingMode,mappings:new Map,inverse:null,getInverse:L,clone:N,revertToPreviousContext:$,protected:{}};return y.size===k&&y.clear(),y.set(f,R),R;function L(){const q=this;if(q.inverse)return q.inverse;const A=q.inverse={},j=q.fastCurieMap={},te={},I=(q["@language"]||"@none").toLowerCase(),Z=q["@direction"],F=q.mappings,Y=[...F.keys()].sort(g);for(const w of Y){const U=F.get(w);if(U===null)continue;let K=U["@container"]||"@none";if(K=[].concat(K).sort().join(""),U["@id"]===null)continue;const X=v(U["@id"]);for(const de of X){let H=A[de];const G=x.isKeyword(de);if(H)!G&&!U._termHasColon&&te[de].push(w);else if(A[de]=H={},!G&&!U._termHasColon){te[de]=[w];const W={iri:de,terms:te[de]};de[0]in j?j[de[0]].push(W):j[de[0]]=[W]}if(H[K]||(H[K]={"@language":{},"@type":{},"@any":{}}),H=H[K],B(w,H["@any"],"@none"),U.reverse)B(w,H["@type"],"@reverse");else if(U["@type"]==="@none")B(w,H["@any"],"@none"),B(w,H["@language"],"@none"),B(w,H["@type"],"@none");else if("@type"in U)B(w,H["@type"],U["@type"]);else if("@language"in U&&"@direction"in U){const W=U["@language"],z=U["@direction"];W&&z?B(w,H["@language"],`${W}_${z}`.toLowerCase()):W?B(w,H["@language"],W.toLowerCase()):z?B(w,H["@language"],`_${z}`):B(w,H["@language"],"@null")}else"@language"in U?B(w,H["@language"],(U["@language"]||"@null").toLowerCase()):"@direction"in U?U["@direction"]?B(w,H["@language"],`_${U["@direction"]}`):B(w,H["@language"],"@none"):Z?(B(w,H["@language"],`_${Z}`),B(w,H["@language"],"@none"),B(w,H["@type"],"@none")):(B(w,H["@language"],I),B(w,H["@language"],"@none"),B(w,H["@type"],"@none"))}}for(const w in j)T(j,w,1);return A}function T(q,A,j){const te=q[A],I=q[A]={};let Z,F;for(const Y of te)Z=Y.iri,j>=Z.length?F="":F=Z[j],F in I?I[F].push(Y):I[F]=[Y];for(const Y in I)Y!==""&&T(I,Y,j+1)}function B(q,A,j){A.hasOwnProperty(j)||(A[j]=q)}function N(){const q={};return q.mappings=r.clone(this.mappings),q.clone=this.clone,q.inverse=null,q.getInverse=this.getInverse,q.protected=r.clone(this.protected),this.previousContext&&(q.previousContext=this.previousContext.clone()),q.revertToPreviousContext=this.revertToPreviousContext,"@base"in this&&(q["@base"]=this["@base"]),"@language"in this&&(q["@language"]=this["@language"]),"@vocab"in this&&(q["@vocab"]=this["@vocab"]),q}function $(){return this.previousContext?this.previousContext.clone():this}},x.getContextValue=(m,f,b)=>{if(f===null)return b==="@context"?void 0:null;if(m.mappings.has(f)){const R=m.mappings.get(f);if(o(b))return R;if(R.hasOwnProperty(b))return R[b]}if(b==="@language"&&b in m||b==="@direction"&&b in m)return m[b];if(b!=="@context")return null},x.processingMode=(m,f)=>f.toString()>="1.1"?!m.processingMode||m.processingMode>="json-ld-"+f.toString():m.processingMode==="json-ld-1.0",x.isKeyword=m=>{if(!n(m)||m[0]!=="@")return!1;switch(m){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};function E(m,f){if(!(m&&typeof m=="object")||!(f&&typeof f=="object"))return m===f;const b=Array.isArray(m);if(b!==Array.isArray(f))return!1;if(b){if(m.length!==f.length)return!1;for(let T=0;T<m.length;++T)if(!E(m[T],f[T]))return!1;return!0}const R=Object.keys(m),L=Object.keys(f);if(R.length!==L.length)return!1;for(const T in m){let B=m[T],N=f[T];if(T==="@container"&&Array.isArray(B)&&Array.isArray(N)&&(B=B.slice().sort(),N=N.slice().sort()),!E(B,N))return!1}return!0}return Ro}var No,Kl;function Lp(){if(Kl)return No;Kl=1;const r=pt(),{isArray:e,isObject:t,isEmptyObject:i,isString:n,isUndefined:o}=lt(),{isList:a,isValue:s,isGraph:d,isSubject:l}=$t(),{expandIri:c,getContextValue:u,isKeyword:v,process:g,processingMode:y}=dr(),{isAbsolute:k}=Xt(),{REGEX_BCP47:x,REGEX_KEYWORD:_,addValue:E,asArray:m,getValues:f,validateTypeValue:b}=ct(),{handleEvent:R}=Ri(),L={};No=L,L.expand=async({activeCtx:A,activeProperty:j=null,element:te,options:I={},insideList:Z=!1,insideIndex:F=!1,typeScopedContext:Y=null})=>{if(te==null)return null;if(j==="@default"&&(I=Object.assign({},I,{isFrame:!1})),!e(te)&&!t(te))return!Z&&(j===null||c(A,j,{vocab:!0},I)==="@graph")?(I.eventHandler&&R({event:{type:["JsonLdEvent"],code:"free-floating scalar",level:"warning",message:"Dropping free-floating scalar not in a list.",details:{value:te}},options:I}),null):N({activeCtx:A,activeProperty:j,value:te,options:I});if(e(te)){let W=[];const z=u(A,j,"@container")||[];Z=Z||z.includes("@list");for(let ee=0;ee<te.length;++ee){let re=await L.expand({activeCtx:A,activeProperty:j,element:te[ee],options:I,insideIndex:F,typeScopedContext:Y});Z&&e(re)&&(re={"@list":re}),re!==null&&(e(re)?W=W.concat(re):W.push(re))}return W}const w=c(A,j,{vocab:!0},I),U=u(A,j,"@context");Y=Y||(A.previousContext?A:null);let K=Object.keys(te).sort(),X=!F;if(X&&Y&&K.length<=2&&!K.includes("@context"))for(const W of K){const z=c(Y,W,{vocab:!0},I);if(z==="@value"){X=!1,A=Y;break}if(z==="@id"&&K.length===1){X=!1;break}}X&&(A=A.revertToPreviousContext()),o(U)||(A=await g({activeCtx:A,localCtx:U,propagate:!0,overrideProtected:!0,options:I})),"@context"in te&&(A=await g({activeCtx:A,localCtx:te["@context"],options:I})),Y=A;let de=null;for(const W of K)if(c(A,W,{vocab:!0},I)==="@type"){de=de||W;const ee=te[W],re=Array.isArray(ee)?ee.length>1?ee.slice().sort():ee:[ee];for(const pe of re){const be=u(Y,pe,"@context");o(be)||(A=await g({activeCtx:A,localCtx:be,options:I,propagate:!1}))}}let H={};await B({activeCtx:A,activeProperty:j,expandedActiveProperty:w,element:te,expandedParent:H,options:I,insideList:Z,typeKey:de,typeScopedContext:Y}),K=Object.keys(H);let G=K.length;if("@value"in H){if("@type"in H&&("@language"in H||"@direction"in H))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:H});let W=G-1;if("@type"in H&&(W-=1),"@index"in H&&(W-=1),"@language"in H&&(W-=1),"@direction"in H&&(W-=1),W!==0)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:H});const z=H["@value"]===null?[]:m(H["@value"]),ee=f(H,"@type");if(!(y(A,1.1)&&ee.includes("@json")&&ee.length===1))if(z.length===0)I.eventHandler&&R({event:{type:["JsonLdEvent"],code:"null @value value",level:"warning",message:"Dropping null @value value.",details:{value:H}},options:I}),H=null;else{if(!z.every(re=>n(re)||i(re))&&"@language"in H)throw new r("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:H});if(!ee.every(re=>k(re)&&!(n(re)&&re.indexOf("_:")===0)||i(re)))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:H})}}else if("@type"in H&&!e(H["@type"]))H["@type"]=[H["@type"]];else if("@set"in H||"@list"in H){if(G>1&&!(G===2&&"@index"in H))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:H});"@set"in H&&(H=H["@set"],K=Object.keys(H),G=K.length)}else G===1&&"@language"in H&&(I.eventHandler&&R({event:{type:["JsonLdEvent"],code:"object with only @language",level:"warning",message:"Dropping object with only @language.",details:{value:H}},options:I}),H=null);return t(H)&&!I.keepFreeFloatingNodes&&!Z&&(j===null||w==="@graph"||(u(A,j,"@container")||[]).includes("@graph"))&&(H=T({value:H,count:G,options:I})),H};function T({value:A,count:j,options:te}){if(j===0||"@value"in A||"@list"in A||j===1&&"@id"in A){if(te.eventHandler){let I,Z;j===0?(I="empty object",Z="Dropping empty object."):"@value"in A?(I="object with only @value",Z="Dropping object with only @value."):"@list"in A?(I="object with only @list",Z="Dropping object with only @list."):j===1&&"@id"in A&&(I="object with only @id",Z="Dropping object with only @id."),R({event:{type:["JsonLdEvent"],code:I,level:"warning",message:Z,details:{value:A}},options:te})}return null}return A}async function B({activeCtx:A,activeProperty:j,expandedActiveProperty:te,element:I,expandedParent:Z,options:F={},insideList:Y,typeKey:w,typeScopedContext:U}){const K=Object.keys(I).sort(),X=[];let de;const H=I[w]&&c(A,e(I[w])?I[w][0]:I[w],{vocab:!0},{...F,typeExpansion:!0})==="@json";for(const G of K){let W=I[G],z;if(G==="@context")continue;const ee=c(A,G,{vocab:!0},F);if(ee===null||!(k(ee)||v(ee))){F.eventHandler&&R({event:{type:["JsonLdEvent"],code:"invalid property",level:"warning",message:"Dropping property that did not expand into an absolute IRI or keyword.",details:{property:G,expandedProperty:ee}},options:F});continue}if(v(ee)){if(te==="@reverse")throw new r("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:W});if(ee in Z&&ee!=="@included"&&ee!=="@type")throw new r("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:ee})}if(ee==="@id"){if(!n(W)){if(!F.isFrame)throw new r('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:W});if(t(W)){if(!i(W))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:W})}else if(e(W)){if(!W.every(O=>n(O)))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:W})}else 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:W})}E(Z,"@id",m(W).map(O=>{if(n(O)){const V=c(A,O,{base:!0},F);return F.eventHandler&&(V===null?R(O===null?{event:{type:["JsonLdEvent"],code:"null @id value",level:"warning",message:"Null @id found.",details:{id:O}},options:F}:{event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:O}},options:F}):k(V)||R({event:{type:["JsonLdEvent"],code:"relative @id reference",level:"warning",message:"Relative @id reference found.",details:{id:O,expandedId:V}},options:F})),V}return O}),{propertyIsArray:F.isFrame});continue}if(ee==="@type"){t(W)&&(W=Object.fromEntries(Object.entries(W).map(([O,V])=>[c(U,O,{vocab:!0}),m(V).map(oe=>c(U,oe,{base:!0,vocab:!0},{...F,typeExpansion:!0}))]))),b(W,F.isFrame),E(Z,"@type",m(W).map(O=>{if(n(O)){const V=c(U,O,{base:!0,vocab:!0},{...F,typeExpansion:!0});return V!=="@json"&&!k(V)&&F.eventHandler&&R({event:{type:["JsonLdEvent"],code:"relative @type reference",level:"warning",message:"Relative @type reference found.",details:{type:O}},options:F}),V}return O}),{propertyIsArray:!!F.isFrame});continue}if(ee==="@included"&&y(A,1.1)){const O=m(await L.expand({activeCtx:A,activeProperty:j,element:W,options:F}));if(!O.every(V=>l(V)))throw new r("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:W});E(Z,"@included",O,{propertyIsArray:!0});continue}if(ee==="@graph"&&!(t(W)||e(W)))throw new r('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:W});if(ee==="@value"){de=W,H&&y(A,1.1)?Z["@value"]=W:E(Z,"@value",W,{propertyIsArray:F.isFrame});continue}if(ee==="@language"){if(W===null)continue;if(!n(W)&&!F.isFrame)throw new r('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:W});W=m(W).map(O=>n(O)?O.toLowerCase():O);for(const O of W)n(O)&&!O.match(x)&&F.eventHandler&&R({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:O}},options:F});E(Z,"@language",W,{propertyIsArray:F.isFrame});continue}if(ee==="@direction"){if(!n(W)&&!F.isFrame)throw new r('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:W});W=m(W);for(const O of W)if(n(O)&&O!=="ltr"&&O!=="rtl")throw new r('Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",value:W});E(Z,"@direction",W,{propertyIsArray:F.isFrame});continue}if(ee==="@index"){if(!n(W))throw new r('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:W});E(Z,"@index",W);continue}if(ee==="@reverse"){if(!t(W))throw new r('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:W});if(z=await L.expand({activeCtx:A,activeProperty:"@reverse",element:W,options:F}),"@reverse"in z)for(const V in z["@reverse"])E(Z,V,z["@reverse"][V],{propertyIsArray:!0});let O=Z["@reverse"]||null;for(const V in z){if(V==="@reverse")continue;O===null&&(O=Z["@reverse"]={}),E(O,V,[],{propertyIsArray:!0});const oe=z[V];for(let fe=0;fe<oe.length;++fe){const he=oe[fe];if(s(he)||a(he))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:z});E(O,V,he,{propertyIsArray:!0})}}continue}if(ee==="@nest"){X.push(G);continue}let re=A;const pe=u(A,G,"@context");o(pe)||(re=await g({activeCtx:A,localCtx:pe,propagate:!0,overrideProtected:!0,options:F}));const be=u(A,G,"@container")||[];if(be.includes("@language")&&t(W)){const O=u(re,G,"@direction");z=$(re,W,O,F)}else if(be.includes("@index")&&t(W)){const O=be.includes("@graph"),V=u(re,G,"@index")||"@index",oe=V!=="@index"&&c(A,V,{vocab:!0},F);z=await q({activeCtx:re,options:F,activeProperty:G,value:W,asGraph:O,indexKey:V,propertyIndex:oe})}else if(be.includes("@id")&&t(W)){const O=be.includes("@graph");z=await q({activeCtx:re,options:F,activeProperty:G,value:W,asGraph:O,indexKey:"@id"})}else if(be.includes("@type")&&t(W))z=await q({activeCtx:re.revertToPreviousContext(),options:F,activeProperty:G,value:W,asGraph:!1,indexKey:"@type"});else{const O=ee==="@list";if(O||ee==="@set"){let V=j;O&&te==="@graph"&&(V=null),z=await L.expand({activeCtx:re,activeProperty:V,element:W,options:F,insideList:O})}else u(A,G,"@type")==="@json"?z={"@type":"@json","@value":W}:z=await L.expand({activeCtx:re,activeProperty:G,element:W,options:F,insideList:!1})}if(!(z===null&&ee!=="@value")){if(ee!=="@list"&&!a(z)&&be.includes("@list")&&(z={"@list":m(z)}),be.includes("@graph")&&!be.some(O=>O==="@id"||O==="@index")){if(z=m(z),F.isFrame||(z=z.filter(O=>{const V=Object.keys(O).length;return T({value:O,count:V,options:F})!==null})),z.length===0)continue;z=z.map(O=>({"@graph":m(O)}))}if(re.mappings.has(G)&&re.mappings.get(G).reverse){const O=Z["@reverse"]=Z["@reverse"]||{};z=m(z);for(let V=0;V<z.length;++V){const oe=z[V];if(s(oe)||a(oe))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:z});E(O,ee,oe,{propertyIsArray:!0})}continue}E(Z,ee,z,{propertyIsArray:!0})}}if("@value"in Z&&!(Z["@type"]==="@json"&&y(A,1.1))){if((t(de)||e(de))&&!F.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:de})}for(const G of X){const W=e(I[G])?I[G]:[I[G]];for(const z of W){if(!t(z)||Object.keys(z).some(ee=>c(A,ee,{vocab:!0},F)==="@value"))throw new r("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:z});await B({activeCtx:A,activeProperty:j,expandedActiveProperty:te,element:z,expandedParent:Z,options:F,insideList:Y,typeScopedContext:U,typeKey:w})}}}function N({activeCtx:A,activeProperty:j,value:te,options:I}){if(te==null)return null;const Z=c(A,j,{vocab:!0},I);if(Z==="@id")return c(A,te,{base:!0},I);if(Z==="@type")return c(A,te,{vocab:!0,base:!0},{...I,typeExpansion:!0});const F=u(A,j,"@type");if((F==="@id"||Z==="@graph")&&n(te)){const w=c(A,te,{base:!0},I);return w===null&&te.match(_)&&I.eventHandler&&R({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:j}},options:I}),{"@id":w}}if(F==="@vocab"&&n(te))return{"@id":c(A,te,{vocab:!0,base:!0},I)};if(v(Z))return te;const Y={};if(F&&!["@id","@vocab","@none"].includes(F))Y["@type"]=F;else if(n(te)){const w=u(A,j,"@language");w!==null&&(Y["@language"]=w);const U=u(A,j,"@direction");U!==null&&(Y["@direction"]=U)}return["boolean","number","string"].includes(typeof te)||(te=te.toString()),Y["@value"]=te,Y}function $(A,j,te,I){const Z=[],F=Object.keys(j).sort();for(const Y of F){const w=c(A,Y,{vocab:!0},I);let U=j[Y];e(U)||(U=[U]);for(const K of U){if(K===null)continue;if(!n(K))throw new r("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:j});const X={"@value":K};w!=="@none"&&(Y.match(x)||I.eventHandler&&R({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:Y}},options:I}),X["@language"]=Y.toLowerCase()),te&&(X["@direction"]=te),Z.push(X)}}return Z}async function q({activeCtx:A,options:j,activeProperty:te,value:I,asGraph:Z,indexKey:F,propertyIndex:Y}){const w=[],U=Object.keys(I).sort(),K=F==="@type";for(let X of U){if(K){const G=u(A,X,"@context");o(G)||(A=await g({activeCtx:A,localCtx:G,propagate:!1,options:j}))}let de=I[X];e(de)||(de=[de]),de=await L.expand({activeCtx:A,activeProperty:te,element:de,options:j,insideList:!1,insideIndex:!0});let H;Y?X==="@none"?H="@none":H=N({activeCtx:A,activeProperty:F,value:X,options:j}):H=c(A,X,{vocab:!0},j),F==="@id"?X=c(A,X,{base:!0},j):K&&(X=H);for(let G of de){if(Z&&!d(G)&&(G={"@graph":[G]}),F==="@type")H==="@none"||(G["@type"]?G["@type"]=[X].concat(G["@type"]):G["@type"]=[X]);else{if(s(G)&&!["@language","@type","@index"].includes(F))throw new r(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${F}".`,"jsonld.SyntaxError",{code:"invalid value object",value:G});Y?H!=="@none"&&E(G,Y,H,{propertyIsArray:!0,prependValue:!0}):H!=="@none"&&!(F in G)&&(G[F]=X)}w.push(G)}}return w}return No}var Io,Yl;function hn(){if(Yl)return Io;Yl=1;const{isKeyword:r}=dr(),e=$t(),t=lt(),i=ct(),n=pt(),o={};return Io=o,o.createMergedNodeMap=(a,s)=>{s=s||{};const d=s.issuer||new i.IdentifierIssuer("_:b"),l={"@default":{}};return o.createNodeMap(a,l,"@default",d),o.mergeNodeMaps(l)},o.createNodeMap=(a,s,d,l,c,u)=>{if(t.isArray(a)){for(const k of a)o.createNodeMap(k,s,d,l,void 0,u);return}if(!t.isObject(a)){u&&u.push(a);return}if(e.isValue(a)){if("@type"in a){let k=a["@type"];k.indexOf("_:")===0&&(a["@type"]=k=l.getId(k))}u&&u.push(a);return}else if(u&&e.isList(a)){const k=[];o.createNodeMap(a["@list"],s,d,l,c,k),u.push({"@list":k});return}if("@type"in a){const k=a["@type"];for(const x of k)x.indexOf("_:")===0&&l.getId(x)}t.isUndefined(c)&&(c=e.isBlankNode(a)?l.getId(a["@id"]):a["@id"]),u&&u.push({"@id":c});const v=s[d],g=v[c]=v[c]||{};g["@id"]=c;const y=Object.keys(a).sort();for(let k of y){if(k==="@id")continue;if(k==="@reverse"){const _={"@id":c},E=a["@reverse"];for(const m in E){const f=E[m];for(const b of f){let R=b["@id"];e.isBlankNode(b)&&(R=l.getId(R)),o.createNodeMap(b,s,d,l,R),i.addValue(v[R],m,_,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(k==="@graph"){c in s||(s[c]={}),o.createNodeMap(a[k],s,c,l);continue}if(k==="@included"){o.createNodeMap(a[k],s,d,l);continue}if(k!=="@type"&&r(k)){if(k==="@index"&&k in g&&(a[k]!==g[k]||a[k]["@id"]!==g[k]["@id"]))throw new n("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:g});g[k]=a[k];continue}const x=a[k];if(k.indexOf("_:")===0&&(k=l.getId(k)),x.length===0){i.addValue(g,k,[],{propertyIsArray:!0});continue}for(let _ of x)if(k==="@type"&&(_=_.indexOf("_:")===0?l.getId(_):_),e.isSubject(_)||e.isSubjectReference(_)){if("@id"in _&&!_["@id"])continue;const E=e.isBlankNode(_)?l.getId(_["@id"]):_["@id"];i.addValue(g,k,{"@id":E},{propertyIsArray:!0,allowDuplicate:!1}),o.createNodeMap(_,s,d,l,E)}else if(e.isValue(_))i.addValue(g,k,_,{propertyIsArray:!0,allowDuplicate:!1});else if(e.isList(_)){const E=[];o.createNodeMap(_["@list"],s,d,l,c,E),_={"@list":E},i.addValue(g,k,_,{propertyIsArray:!0,allowDuplicate:!1})}else o.createNodeMap(_,s,d,l,c),i.addValue(g,k,_,{propertyIsArray:!0,allowDuplicate:!1})}},o.mergeNodeMapGraphs=a=>{const s={};for(const d of Object.keys(a).sort())for(const l of Object.keys(a[d]).sort()){const c=a[d][l];l in s||(s[l]={"@id":l});const u=s[l];for(const v of Object.keys(c).sort())if(r(v)&&v!=="@type")u[v]=i.clone(c[v]);else for(const g of c[v])i.addValue(u,v,i.clone(g),{propertyIsArray:!0,allowDuplicate:!1})}return s},o.mergeNodeMaps=a=>{const s=a["@default"],d=Object.keys(a).sort();for(const l of d){if(l==="@default")continue;const c=a[l];let u=s[l];u?"@graph"in u||(u["@graph"]=[]):s[l]=u={"@id":l,"@graph":[]};const v=u["@graph"];for(const g of Object.keys(c).sort()){const y=c[g];e.isSubjectReference(y)||v.push(y)}}return s},Io}var To,Zl;function Op(){if(Zl)return To;Zl=1;const{isSubjectReference:r}=$t(),{createMergedNodeMap:e}=hn(),t={};return To=t,t.flatten=i=>{const n=e(i),o=[],a=Object.keys(n).sort();for(let s=0;s<a.length;++s){const d=n[a[s]];r(d)||o.push(d)}return o},To}var Ao,ed;function Cp(){if(ed)return Ao;ed=1;const r=pt(),e=$t(),t=lt(),{REGEX_BCP47:i,addValue:n}=ct(),{handleEvent:o}=Ri(),{RDF_LIST:a,RDF_FIRST:s,RDF_REST:d,RDF_NIL:l,RDF_TYPE:c,RDF_JSON_LITERAL:u,XSD_BOOLEAN:v,XSD_DOUBLE:g,XSD_INTEGER:y,XSD_STRING:k}=Ba(),x={};Ao=x,x.fromRDF=async(E,m)=>{const{useRdfType:f=!1,useNativeTypes:b=!1,rdfDirection:R=null}=m,L={},T={"@default":L},B={};if(R){if(R==="compound-literal")throw new r("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:R});if(R!=="i18n-datatype")throw new r("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:R})}for(const q of E){const A=q.graph.termType==="DefaultGraph"?"@default":q.graph.value;A in T||(T[A]={}),A!=="@default"&&!(A in L)&&(L[A]={"@id":A});const j=T[A],te=q.subject.value,I=q.predicate.value,Z=q.object;te in j||(j[te]={"@id":te});const F=j[te],Y=Z.termType.endsWith("Node");if(Y&&!(Z.value in j)&&(j[Z.value]={"@id":Z.value}),I===c&&!f&&Y){n(F,"@type",Z.value,{propertyIsArray:!0});continue}const w=_(Z,b,R,m);if(n(F,I,w,{propertyIsArray:!0}),Y)if(Z.value===l){const U=j[Z.value];"usages"in U||(U.usages=[]),U.usages.push({node:F,property:I,value:w})}else Z.value in B?B[Z.value]=!1:B[Z.value]={node:F,property:I,value:w}}for(const q in T){const A=T[q];if(!(l in A))continue;const j=A[l];if(j.usages){for(let te of j.usages){let I=te.node,Z=te.property,F=te.value;const Y=[],w=[];let U=Object.keys(I).length;for(;Z===d&&t.isObject(B[I["@id"]])&&t.isArray(I[s])&&I[s].length===1&&t.isArray(I[d])&&I[d].length===1&&(U===3||U===4&&t.isArray(I["@type"])&&I["@type"].length===1&&I["@type"][0]===a)&&(Y.push(I[s][0]),w.push(I["@id"]),te=B[I["@id"]],I=te.node,Z=te.property,F=te.value,U=Object.keys(I).length,!!e.isBlankNode(I)););delete F["@id"],F["@list"]=Y.reverse();for(const K of w)delete A[K]}delete j.usages}}const N=[],$=Object.keys(L).sort();for(const q of $){const A=L[q];if(q in T){const j=A["@graph"]=[],te=T[q],I=Object.keys(te).sort();for(const Z of I){const F=te[Z];e.isSubjectReference(F)||j.push(F)}}e.isSubjectReference(A)||N.push(A)}return N};function _(E,m,f,b){if(E.termType.endsWith("Node"))return{"@id":E.value};const R={"@value":E.value};if(E.language)E.language.match(i)||b.eventHandler&&o({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:E.language}},options:b}),R["@language"]=E.language;else{let L=E.datatype.value;if(L||(L=k),L===u){L="@json";try{R["@value"]=JSON.parse(R["@value"])}catch(T){throw new r("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:R["@value"],cause:T})}}if(m){if(L===v)R["@value"]==="true"?R["@value"]=!0:R["@value"]==="false"&&(R["@value"]=!1);else if(t.isNumeric(R["@value"]))if(L===y){const T=parseInt(R["@value"],10);T.toFixed(0)===R["@value"]&&(R["@value"]=T)}else L===g&&(R["@value"]=parseFloat(R["@value"]));[v,y,g,k].includes(L)||(R["@type"]=L)}else if(f==="i18n-datatype"&&L.startsWith("https://www.w3.org/ns/i18n#")){const[,T,B]=L.split(/[#_]/);T.length>0&&(R["@language"]=T,T.match(i)||b.eventHandler&&o({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:T}},options:b})),R["@direction"]=B}else L!==k&&(R["@type"]=L)}return R}return Ao}var jo,td;function $p(){return td||(td=1,jo=function r(e){return e===null||typeof e!="object"||e.toJSON!=null?JSON.stringify(e):Array.isArray(e)?"["+e.reduce((t,i,n)=>{const o=n===0?"":",",a=i===void 0||typeof i=="symbol"?null:i;return t+o+r(a)},"")+"]":"{"+Object.keys(e).sort().reduce((t,i,n)=>{if(e[i]===void 0||typeof e[i]=="symbol")return t;const o=t.length===0?"":",";return t+o+r(i)+":"+r(e[i])},"")+"}"}),jo}var Do,rd;function Fp(){if(rd)return Do;rd=1;const{createNodeMap:r}=hn(),{isKeyword:e}=dr(),t=$t(),i=$p(),n=pt(),o=lt(),a=ct(),{handleEvent:s}=Ri(),{RDF_FIRST:d,RDF_REST:l,RDF_NIL:c,RDF_TYPE:u,RDF_JSON_LITERAL:v,RDF_LANGSTRING:g,XSD_BOOLEAN:y,XSD_DOUBLE:k,XSD_INTEGER:x,XSD_STRING:_}=Ba(),{isAbsolute:E}=Xt(),m={};Do=m,m.toRDF=(L,T)=>{const B=new a.IdentifierIssuer("_:b"),N={"@default":{}};r(L,N,"@default",B);const $=[],q=Object.keys(N).sort();for(const A of q){let j;if(A==="@default")j={termType:"DefaultGraph",value:""};else if(E(A))A.startsWith("_:")?j={termType:"BlankNode"}:j={termType:"NamedNode"},j.value=A;else{T.eventHandler&&s({event:{type:["JsonLdEvent"],code:"relative graph reference",level:"warning",message:"Relative graph reference found.",details:{graph:A}},options:T});continue}f($,N[A],j,B,T)}return $};function f(L,T,B,N,$){const q=Object.keys(T).sort();for(const A of q){const j=T[A],te=Object.keys(j).sort();for(let I of te){const Z=j[I];if(I==="@type")I=u;else if(e(I))continue;for(const F of Z){const Y={termType:A.startsWith("_:")?"BlankNode":"NamedNode",value:A};if(!E(A)){$.eventHandler&&s({event:{type:["JsonLdEvent"],code:"relative subject reference",level:"warning",message:"Relative subject reference found.",details:{subject:A}},options:$});continue}const w={termType:I.startsWith("_:")?"BlankNode":"NamedNode",value:I};if(!E(I)){$.eventHandler&&s({event:{type:["JsonLdEvent"],code:"relative predicate reference",level:"warning",message:"Relative predicate reference found.",details:{predicate:I}},options:$});continue}if(w.termType==="BlankNode"&&!$.produceGeneralizedRdf){$.eventHandler&&s({event:{type:["JsonLdEvent"],code:"blank node predicate",level:"warning",message:"Dropping blank node predicate.",details:{property:N.getOldIds().find(K=>N.getId(K)===I)}},options:$});continue}const U=R(F,N,L,B,$.rdfDirection,$);U&&L.push({subject:Y,predicate:w,object:U,graph:B})}}}}function b(L,T,B,N,$,q){const A={termType:"NamedNode",value:d},j={termType:"NamedNode",value:l},te={termType:"NamedNode",value:c},I=L.pop(),Z=I?{termType:"BlankNode",value:T.getId()}:te;let F=Z;for(const Y of L){const w=R(Y,T,B,N,$,q),U={termType:"BlankNode",value:T.getId()};B.push({subject:F,predicate:A,object:w,graph:N}),B.push({subject:F,predicate:j,object:U,graph:N}),F=U}if(I){const Y=R(I,T,B,N,$,q);B.push({subject:F,predicate:A,object:Y,graph:N}),B.push({subject:F,predicate:j,object:te,graph:N})}return Z}function R(L,T,B,N,$,q){const A={};if(t.isValue(L)){A.termType="Literal",A.value=void 0,A.datatype={termType:"NamedNode"};let j=L["@value"];const te=L["@type"]||null;if(te==="@json")A.value=i(j),A.datatype.value=v;else if(o.isBoolean(j))A.value=j.toString(),A.datatype.value=te||y;else if(o.isDouble(j)||te===k)o.isDouble(j)||(j=parseFloat(j)),A.value=j.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),A.datatype.value=te||k;else if(o.isNumber(j))A.value=j.toFixed(0),A.datatype.value=te||x;else if("@direction"in L&&$==="i18n-datatype"){const I=(L["@language"]||"").toLowerCase(),Z=L["@direction"],F=`https://www.w3.org/ns/i18n#${I}_${Z}`;A.datatype.value=F,A.value=j}else{if("@direction"in L&&$==="compound-literal")throw new n("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:$});if("@direction"in L&&$)throw new n("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:$});"@language"in L?("@direction"in L&&!$&&q.eventHandler&&s({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:A.value}},options:q}),A.value=j,A.datatype.value=te||g,A.language=L["@language"]):("@direction"in L&&!$&&q.eventHandler&&s({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:A.value}},options:q}),A.value=j,A.datatype.value=te||_)}}else if(t.isList(L)){const j=b(L["@list"],T,B,N,$,q);A.termType=j.termType,A.value=j.value}else{const j=o.isObject(L)?L["@id"]:L;A.termType=j.startsWith("_:")?"BlankNode":"NamedNode",A.value=j}return A.termType==="NamedNode"&&!E(A.value)?(q.eventHandler&&s({event:{type:["JsonLdEvent"],code:"relative object reference",level:"warning",message:"Relative object reference found.",details:{object:A.value}},options:q}),null):A}return Do}var Lo,id;function Pp(){if(id)return Lo;id=1;const{isKeyword:r}=dr(),e=$t(),t=lt(),i=ct(),n=Xt(),o=pt(),{createNodeMap:a,mergeNodeMapGraphs:s}=hn(),d={};Lo=d,d.frameMergedOrDefault=(f,b,R)=>{const L={options:R,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},T=new i.IdentifierIssuer("_:b");a(f,L.graphMap,"@default",T),R.merged&&(L.graphMap["@merged"]=s(L.graphMap),L.graph="@merged"),L.subjects=L.graphMap[L.graph];const B=[];d.frame(L,Object.keys(L.subjects).sort(),b,B),R.pruneBlankNodeIdentifiers&&(R.bnodesToClear=Object.keys(L.bnodeMap).filter(N=>L.bnodeMap[N].length===1));// remove @preserve from results
|
|
325
|
-
return R.link={},x(B,R)},d.frame=(f,b,R,L,T=null)=>{v(R),R=R[0];const B=f.options,
|
|
323
|
+
*/var so,jl;function xp(){if(jl)return so;jl=1;const r=pn(),e=qc();return so=class extends e{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new r("sha1")}modifyFirstDegreeComponent(i,n,o){return n.termType!=="BlankNode"?n:o==="graph"?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:n.value===i?"_:a":"_:z"}}getRelatedPredicate(i){return i.predicate.value}createHashToRelated(i,n){const o=new Map,a=this.blankNodeInfo.get(i).quads;for(const s of a){let d,l;if(s.subject.termType==="BlankNode"&&s.subject.value!==i)l=s.subject.value,d="p";else if(s.object.termType==="BlankNode"&&s.object.value!==i)l=s.object.value,d="r";else continue;const c=this.hashRelatedBlankNode(l,s,n,d),u=o.get(c);u?u.push(l):o.set(c,[l])}return o}},so}const _p={},kp=Object.freeze(Object.defineProperty({__proto__:null,default:_p},Symbol.toStringTag,{value:"Module"})),Ep=iu(kp);var Dl;function Sp(){return Dl||(Dl=1,function(r){const e=Bc(),t=wp(),i=qc(),n=xp();let o;try{o=Ep}catch{}function a(s){return Array.isArray(s)?s:r.NQuads.legacyDatasetToQuads(s)}r.NQuads=Pa(),r.IdentifierIssuer=Fa(),r._rdfCanonizeNative=function(s){return s&&(o=s),o},r.canonize=async function(s,d){const l=a(s);if(d.useNative){if(!o)throw new Error("rdf-canonize-native not available");if(d.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return new Promise((c,u)=>o.canonize(l,d,(v,g)=>v?u(v):c(g)))}if(d.algorithm==="URDNA2015")return new e(d).main(l);if(d.algorithm==="URGNA2012"){if(d.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new t(d).main(l)}throw"algorithm"in d?new Error("Invalid RDF Dataset Canonicalization algorithm: "+d.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")},r._canonizeSync=function(s,d){const l=a(s);if(d.useNative){if(!o)throw new Error("rdf-canonize-native not available");if(d.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return o.canonizeSync(l,d)}if(d.algorithm==="URDNA2015")return new i(d).main(l);if(d.algorithm==="URGNA2012"){if(d.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new n(d).main(l)}throw"algorithm"in d?new Error("Invalid RDF Dataset Canonicalization algorithm: "+d.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")}}(Yn)),Yn}var lo,Ll;function Ma(){return Ll||(Ll=1,lo=Sp()),lo}var co,Ol;function lt(){if(Ol)return co;Ol=1;const r={};return co=r,r.isArray=Array.isArray,r.isBoolean=e=>typeof e=="boolean"||Object.prototype.toString.call(e)==="[object Boolean]",r.isDouble=e=>r.isNumber(e)&&(String(e).indexOf(".")!==-1||Math.abs(e)>=1e21),r.isEmptyObject=e=>r.isObject(e)&&Object.keys(e).length===0,r.isNumber=e=>typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]",r.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),r.isObject=e=>Object.prototype.toString.call(e)==="[object Object]",r.isString=e=>typeof e=="string"||Object.prototype.toString.call(e)==="[object String]",r.isUndefined=e=>typeof e>"u",co}var uo,Cl;function $t(){if(Cl)return uo;Cl=1;const r=lt(),e={};return uo=e,e.isSubject=t=>r.isObject(t)&&!("@value"in t||"@set"in t||"@list"in t)?Object.keys(t).length>1||!("@id"in t):!1,e.isSubjectReference=t=>r.isObject(t)&&Object.keys(t).length===1&&"@id"in t,e.isValue=t=>r.isObject(t)&&"@value"in t,e.isList=t=>r.isObject(t)&&"@list"in t,e.isGraph=t=>r.isObject(t)&&"@graph"in t&&Object.keys(t).filter(i=>i!=="@id"&&i!=="@index").length===1,e.isSimpleGraph=t=>e.isGraph(t)&&!("@id"in t),e.isBlankNode=t=>{if(r.isObject(t)){if("@id"in t){const i=t["@id"];return!r.isString(i)||i.indexOf("_:")===0}return Object.keys(t).length===0||!("@value"in t||"@set"in t||"@list"in t)}return!1},uo}var fo,$l;function pt(){return $l||($l=1,fo=class extends Error{constructor(e="An unspecified JSON-LD error occurred.",t="jsonld.Error",i={}){super(e),this.name=t,this.message=e,this.details=i}}),fo}var po,Fl;function ct(){if(Fl)return po;Fl=1;const r=$t(),e=lt(),t=Ma().IdentifierIssuer,i=pt(),n=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,o=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,a=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,s=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,d=/^@[a-zA-Z]+$/,l={headers:{accept:"application/ld+json, application/json"}},c={};po=c,c.IdentifierIssuer=t,c.REGEX_BCP47=n,c.REGEX_KEYWORD=d,c.clone=function(v){if(v&&typeof v=="object"){let g;if(e.isArray(v)){g=[];for(let y=0;y<v.length;++y)g[y]=c.clone(v[y])}else if(v instanceof Map){g=new Map;for(const[y,k]of v)g.set(y,c.clone(k))}else if(v instanceof Set){g=new Set;for(const y of v)g.add(c.clone(y))}else if(e.isObject(v)){g={};for(const y in v)g[y]=c.clone(v[y])}else g=v.toString();return g}return v},c.asArray=function(v){return Array.isArray(v)?v:[v]},c.buildHeaders=(v={})=>{if(Object.keys(v).some(y=>y.toLowerCase()==="accept"))throw new RangeError('Accept header may not be specified; only "'+l.headers.accept+'" is supported.');return Object.assign({Accept:l.headers.accept},v)},c.parseLinkHeader=v=>{const g={},y=v.match(o);for(let k=0;k<y.length;++k){let x=y[k].match(a);if(!x)continue;const _={target:x[1]},E=x[2];for(;x=s.exec(E);)_[x[1]]=x[2]===void 0?x[3]:x[2];const m=_.rel||"";Array.isArray(g[m])?g[m].push(_):g.hasOwnProperty(m)?g[m]=[g[m],_]:g[m]=_}return g},c.validateTypeValue=(v,g)=>{if(!e.isString(v)&&!(e.isArray(v)&&v.every(y=>e.isString(y)))){if(g&&e.isObject(v))switch(Object.keys(v).length){case 0:return;case 1:if("@default"in v&&c.asArray(v["@default"]).every(y=>e.isString(y)))return}throw new i('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:v})}},c.hasProperty=(v,g)=>{if(v.hasOwnProperty(g)){const y=v[g];return!e.isArray(y)||y.length>0}return!1},c.hasValue=(v,g,y)=>{if(c.hasProperty(v,g)){let k=v[g];const x=r.isList(k);if(e.isArray(k)||x){x&&(k=k["@list"]);for(let _=0;_<k.length;++_)if(c.compareValues(y,k[_]))return!0}else if(!e.isArray(y))return c.compareValues(y,k)}return!1},c.addValue=(v,g,y,k)=>{if(k=k||{},"propertyIsArray"in k||(k.propertyIsArray=!1),"valueIsArray"in k||(k.valueIsArray=!1),"allowDuplicate"in k||(k.allowDuplicate=!0),"prependValue"in k||(k.prependValue=!1),k.valueIsArray)v[g]=y;else if(e.isArray(y)){y.length===0&&k.propertyIsArray&&!v.hasOwnProperty(g)&&(v[g]=[]),k.prependValue&&(y=y.concat(v[g]),v[g]=[]);for(let x=0;x<y.length;++x)c.addValue(v,g,y[x],k)}else if(v.hasOwnProperty(g)){const x=!k.allowDuplicate&&c.hasValue(v,g,y);!e.isArray(v[g])&&(!x||k.propertyIsArray)&&(v[g]=[v[g]]),x||(k.prependValue?v[g].unshift(y):v[g].push(y))}else v[g]=k.propertyIsArray?[y]:y},c.getValues=(v,g)=>[].concat(v[g]||[]),c.removeProperty=(v,g)=>{delete v[g]},c.removeValue=(v,g,y,k)=>{k=k||{},"propertyIsArray"in k||(k.propertyIsArray=!1);const x=c.getValues(v,g).filter(_=>!c.compareValues(_,y));x.length===0?c.removeProperty(v,g):x.length===1&&!k.propertyIsArray?v[g]=x[0]:v[g]=x},c.relabelBlankNodes=(v,g)=>{g=g||{};const y=g.issuer||new t("_:b");return u(y,v)},c.compareValues=(v,g)=>v===g||r.isValue(v)&&r.isValue(g)&&v["@value"]===g["@value"]&&v["@type"]===g["@type"]&&v["@language"]===g["@language"]&&v["@index"]===g["@index"]?!0:e.isObject(v)&&"@id"in v&&e.isObject(g)&&"@id"in g?v["@id"]===g["@id"]:!1,c.compareShortestLeast=(v,g)=>v.length<g.length?-1:g.length<v.length?1:v===g?0:v<g?-1:1;function u(v,g){if(e.isArray(g))for(let y=0;y<g.length;++y)g[y]=u(v,g[y]);else if(r.isList(g))g["@list"]=u(v,g["@list"]);else if(e.isObject(g)){r.isBlankNode(g)&&(g["@id"]=v.getId(g["@id"]));const y=Object.keys(g).sort();for(let k=0;k<y.length;++k){const x=y[k];x!=="@id"&&(g[x]=u(v,g[x]))}}return g}return po}var ho,Pl;function Ba(){if(Pl)return ho;Pl=1;const r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",e="http://www.w3.org/2001/XMLSchema#";return ho={LINK_HEADER_REL:"http://www.w3.org/ns/json-ld#context",LINK_HEADER_CONTEXT:"http://www.w3.org/ns/json-ld#context",RDF:r,RDF_LIST:r+"List",RDF_FIRST:r+"first",RDF_REST:r+"rest",RDF_NIL:r+"nil",RDF_TYPE:r+"type",RDF_PLAIN_LITERAL:r+"PlainLiteral",RDF_XML_LITERAL:r+"XMLLiteral",RDF_JSON_LITERAL:r+"JSON",RDF_OBJECT:r+"object",RDF_LANGSTRING:r+"langString",XSD:e,XSD_BOOLEAN:e+"boolean",XSD_DOUBLE:e+"double",XSD_INTEGER:e+"integer",XSD_STRING:e+"string"},ho}var bo,Ml;function zc(){return Ml||(Ml=1,bo=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]}}}),bo}var mo,Bl;function Xt(){if(Bl)return mo;Bl=1;const r=lt(),e={};mo=e,e.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*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},e.parse=(i,n)=>{const o={},a=e.parsers[n||"full"],s=a.regex.exec(i);let d=a.keys.length;for(;d--;)o[a.keys[d]]=s[d]===void 0?null:s[d];return(o.scheme==="https"&&o.port==="443"||o.scheme==="http"&&o.port==="80")&&(o.href=o.href.replace(":"+o.port,""),o.authority=o.authority.replace(":"+o.port,""),o.port=null),o.normalizedPath=e.removeDotSegments(o.path),o},e.prependBase=(i,n)=>{if(i===null||e.isAbsolute(n))return n;(!i||r.isString(i))&&(i=e.parse(i||""));const o=e.parse(n),a={protocol:i.protocol||""};if(o.authority!==null)a.authority=o.authority,a.path=o.path,a.query=o.query;else if(a.authority=i.authority,o.path==="")a.path=i.path,o.query!==null?a.query=o.query:a.query=i.query;else{if(o.path.indexOf("/")===0)a.path=o.path;else{let d=i.path;d=d.substr(0,d.lastIndexOf("/")+1),(d.length>0||i.authority)&&d.substr(-1)!=="/"&&(d+="/"),d+=o.path,a.path=d}a.query=o.query}o.path!==""&&(a.path=e.removeDotSegments(a.path));let s=a.protocol;return a.authority!==null&&(s+="//"+a.authority),s+=a.path,a.query!==null&&(s+="?"+a.query),o.fragment!==null&&(s+="#"+o.fragment),s===""&&(s="./"),s},e.removeBase=(i,n)=>{if(i===null)return n;(!i||r.isString(i))&&(i=e.parse(i||""));let o="";if(i.href!==""?o+=(i.protocol||"")+"//"+(i.authority||""):n.indexOf("//")&&(o+="//"),n.indexOf(o)!==0)return n;const a=e.parse(n.substr(o.length)),s=i.normalizedPath.split("/"),d=a.normalizedPath.split("/"),l=a.fragment||a.query?0:1;for(;s.length>0&&d.length>l&&s[0]===d[0];)s.shift(),d.shift();let c="";if(s.length>0){s.pop();for(let u=0;u<s.length;++u)c+="../"}return c+=d.join("/"),a.query!==null&&(c+="?"+a.query),a.fragment!==null&&(c+="#"+a.fragment),c===""&&(c="./"),c},e.removeDotSegments=i=>{if(i.length===0)return"";const n=i.split("/"),o=[];for(;n.length>0;){const a=n.shift(),s=n.length===0;if(a==="."){s&&o.push("");continue}if(a===".."){o.pop(),s&&o.push("");continue}o.push(a)}return i[0]==="/"&&o.length>0&&o[0]!==""&&o.unshift(""),o.length===1&&o[0]===""?"/":o.join("/")};const t=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;return e.isAbsolute=i=>r.isString(i)&&t.test(i),e.isRelative=i=>r.isString(i),mo}var go,ql;function Rp(){if(ql)return go;ql=1;const{parseLinkHeader:r,buildHeaders:e}=ct(),{LINK_HEADER_CONTEXT:t}=Ba(),i=pt(),n=zc(),{prependBase:o}=Xt(),a=/(^|(\r\n))link:/i;go=({secure:d,headers:l={},xhr:c}={headers:{}})=>{return l=e(l),new n().wrapLoader(v);async function v(g){if(g.indexOf("http:")!==0&&g.indexOf("https:")!==0)throw new i('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:g});if(d&&g.indexOf("https")!==0)throw new i(`URL could not be dereferenced; secure mode is enabled and the URL's scheme is not "https".`,"jsonld.InvalidUrl",{code:"loading document failed",url:g});let y;try{y=await s(c,g,l)}catch(m){throw new i("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:g,cause:m})}if(y.status>=400)throw new i("URL could not be dereferenced: "+y.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:g,httpStatusCode:y.status});let k={contextUrl:null,documentUrl:g,document:y.response},x=null;const _=y.getResponseHeader("Content-Type");let E;if(a.test(y.getAllResponseHeaders())&&(E=y.getResponseHeader("Link")),E&&_!=="application/ld+json"){const m=r(E),f=m[t];if(Array.isArray(f))throw new i("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:g});f&&(k.contextUrl=f.target),x=m.alternate,x&&x.type=="application/ld+json"&&!(_||"").match(/^application\/(\w*\+)?json$/)&&(k=await v(o(g,x.target)))}return k}};function s(d,l,c){d=d||XMLHttpRequest;const u=new d;return new Promise((v,g)=>{u.onload=()=>v(u),u.onerror=y=>g(y),u.open("GET",l,!0);for(const y in c)u.setRequestHeader(y,c[y]);u.send()})}return go}var vo,zl;function Ip(){if(zl)return vo;zl=1;const r=Rp(),e={};return vo=e,e.setupDocumentLoaders=function(t){typeof XMLHttpRequest<"u"&&(t.documentLoaders.xhr=r,t.useDocumentLoader("xhr"))},e.setupGlobals=function(t){typeof globalThis.JsonLdProcessor>"u"&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:t.JsonLdProcessor})},vo}var yo,Ul;function Np(){return Ul||(Ul=1,yo=function(r){r.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),yo}var wo,Hl;function Tp(){if(Hl)return wo;Hl=1,wo=r,r.Node=n,r.create=r;function r(o){var a=this;if(a instanceof r||(a=new r),a.tail=null,a.head=null,a.length=0,o&&typeof o.forEach=="function")o.forEach(function(l){a.push(l)});else if(arguments.length>0)for(var s=0,d=arguments.length;s<d;s++)a.push(arguments[s]);return a}r.prototype.removeNode=function(o){if(o.list!==this)throw new Error("removing node which does not belong to this list");var a=o.next,s=o.prev;return a&&(a.prev=s),s&&(s.next=a),o===this.head&&(this.head=a),o===this.tail&&(this.tail=s),o.list.length--,o.next=null,o.prev=null,o.list=null,a},r.prototype.unshiftNode=function(o){if(o!==this.head){o.list&&o.list.removeNode(o);var a=this.head;o.list=this,o.next=a,a&&(a.prev=o),this.head=o,this.tail||(this.tail=o),this.length++}},r.prototype.pushNode=function(o){if(o!==this.tail){o.list&&o.list.removeNode(o);var a=this.tail;o.list=this,o.prev=a,a&&(a.next=o),this.tail=o,this.head||(this.head=o),this.length++}},r.prototype.push=function(){for(var o=0,a=arguments.length;o<a;o++)t(this,arguments[o]);return this.length},r.prototype.unshift=function(){for(var o=0,a=arguments.length;o<a;o++)i(this,arguments[o]);return this.length},r.prototype.pop=function(){if(this.tail){var o=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,o}},r.prototype.shift=function(){if(this.head){var o=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,o}},r.prototype.forEach=function(o,a){a=a||this;for(var s=this.head,d=0;s!==null;d++)o.call(a,s.value,d,this),s=s.next},r.prototype.forEachReverse=function(o,a){a=a||this;for(var s=this.tail,d=this.length-1;s!==null;d--)o.call(a,s.value,d,this),s=s.prev},r.prototype.get=function(o){for(var a=0,s=this.head;s!==null&&a<o;a++)s=s.next;if(a===o&&s!==null)return s.value},r.prototype.getReverse=function(o){for(var a=0,s=this.tail;s!==null&&a<o;a++)s=s.prev;if(a===o&&s!==null)return s.value},r.prototype.map=function(o,a){a=a||this;for(var s=new r,d=this.head;d!==null;)s.push(o.call(a,d.value,this)),d=d.next;return s},r.prototype.mapReverse=function(o,a){a=a||this;for(var s=new r,d=this.tail;d!==null;)s.push(o.call(a,d.value,this)),d=d.prev;return s},r.prototype.reduce=function(o,a){var s,d=this.head;if(arguments.length>1)s=a;else if(this.head)d=this.head.next,s=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var l=0;d!==null;l++)s=o(s,d.value,l),d=d.next;return s},r.prototype.reduceReverse=function(o,a){var s,d=this.tail;if(arguments.length>1)s=a;else if(this.tail)d=this.tail.prev,s=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var l=this.length-1;d!==null;l--)s=o(s,d.value,l),d=d.prev;return s},r.prototype.toArray=function(){for(var o=new Array(this.length),a=0,s=this.head;s!==null;a++)o[a]=s.value,s=s.next;return o},r.prototype.toArrayReverse=function(){for(var o=new Array(this.length),a=0,s=this.tail;s!==null;a++)o[a]=s.value,s=s.prev;return o},r.prototype.slice=function(o,a){a=a||this.length,a<0&&(a+=this.length),o=o||0,o<0&&(o+=this.length);var s=new r;if(a<o||a<0)return s;o<0&&(o=0),a>this.length&&(a=this.length);for(var d=0,l=this.head;l!==null&&d<o;d++)l=l.next;for(;l!==null&&d<a;d++,l=l.next)s.push(l.value);return s},r.prototype.sliceReverse=function(o,a){a=a||this.length,a<0&&(a+=this.length),o=o||0,o<0&&(o+=this.length);var s=new r;if(a<o||a<0)return s;o<0&&(o=0),a>this.length&&(a=this.length);for(var d=this.length,l=this.tail;l!==null&&d>a;d--)l=l.prev;for(;l!==null&&d>o;d--,l=l.prev)s.push(l.value);return s},r.prototype.splice=function(o,a,...s){o>this.length&&(o=this.length-1),o<0&&(o=this.length+o);for(var d=0,l=this.head;l!==null&&d<o;d++)l=l.next;for(var c=[],d=0;l&&d<a;d++)c.push(l.value),l=this.removeNode(l);l===null&&(l=this.tail),l!==this.head&&l!==this.tail&&(l=l.prev);for(var d=0;d<s.length;d++)l=e(this,l,s[d]);return c},r.prototype.reverse=function(){for(var o=this.head,a=this.tail,s=o;s!==null;s=s.prev){var d=s.prev;s.prev=s.next,s.next=d}return this.head=a,this.tail=o,this};function e(o,a,s){var d=a===o.head?new n(s,null,a,o):new n(s,a,a.next,o);return d.next===null&&(o.tail=d),d.prev===null&&(o.head=d),o.length++,d}function t(o,a){o.tail=new n(a,o.tail,null,o),o.head||(o.head=o.tail),o.length++}function i(o,a){o.head=new n(a,null,o.head,o),o.tail||(o.tail=o.head),o.length++}function n(o,a,s,d){if(!(this instanceof n))return new n(o,a,s,d);this.list=d,this.value=o,a?(a.next=this,this.prev=a):this.prev=null,s?(s.prev=this,this.next=s):this.next=null}try{Np()(r)}catch{}return wo}var xo,Gl;function Uc(){if(Gl)return xo;Gl=1;const r=Tp(),e=Symbol("max"),t=Symbol("length"),i=Symbol("lengthCalculator"),n=Symbol("allowStale"),o=Symbol("maxAge"),a=Symbol("dispose"),s=Symbol("noDisposeOnSet"),d=Symbol("lruList"),l=Symbol("cache"),c=Symbol("updateAgeOnGet"),u=()=>1;class v{constructor(f){if(typeof f=="number"&&(f={max:f}),f||(f={}),f.max&&(typeof f.max!="number"||f.max<0))throw new TypeError("max must be a non-negative number");this[e]=f.max||1/0;const b=f.length||u;if(this[i]=typeof b!="function"?u:b,this[n]=f.stale||!1,f.maxAge&&typeof f.maxAge!="number")throw new TypeError("maxAge must be a number");this[o]=f.maxAge||0,this[a]=f.dispose,this[s]=f.noDisposeOnSet||!1,this[c]=f.updateAgeOnGet||!1,this.reset()}set max(f){if(typeof f!="number"||f<0)throw new TypeError("max must be a non-negative number");this[e]=f||1/0,k(this)}get max(){return this[e]}set allowStale(f){this[n]=!!f}get allowStale(){return this[n]}set maxAge(f){if(typeof f!="number")throw new TypeError("maxAge must be a non-negative number");this[o]=f,k(this)}get maxAge(){return this[o]}set lengthCalculator(f){typeof f!="function"&&(f=u),f!==this[i]&&(this[i]=f,this[t]=0,this[d].forEach(b=>{b.length=this[i](b.value,b.key),this[t]+=b.length})),k(this)}get lengthCalculator(){return this[i]}get length(){return this[t]}get itemCount(){return this[d].length}rforEach(f,b){b=b||this;for(let R=this[d].tail;R!==null;){const L=R.prev;E(this,f,R,b),R=L}}forEach(f,b){b=b||this;for(let R=this[d].head;R!==null;){const L=R.next;E(this,f,R,b),R=L}}keys(){return this[d].toArray().map(f=>f.key)}values(){return this[d].toArray().map(f=>f.value)}reset(){this[a]&&this[d]&&this[d].length&&this[d].forEach(f=>this[a](f.key,f.value)),this[l]=new Map,this[d]=new r,this[t]=0}dump(){return this[d].map(f=>y(this,f)?!1:{k:f.key,v:f.value,e:f.now+(f.maxAge||0)}).toArray().filter(f=>f)}dumpLru(){return this[d]}set(f,b,R){if(R=R||this[o],R&&typeof R!="number")throw new TypeError("maxAge must be a number");const L=R?Date.now():0,T=this[i](b,f);if(this[l].has(f)){if(T>this[e])return x(this,this[l].get(f)),!1;const $=this[l].get(f).value;return this[a]&&(this[s]||this[a](f,$.value)),$.now=L,$.maxAge=R,$.value=b,this[t]+=T-$.length,$.length=T,this.get(f),k(this),!0}const B=new _(f,b,T,L,R);return B.length>this[e]?(this[a]&&this[a](f,b),!1):(this[t]+=B.length,this[d].unshift(B),this[l].set(f,this[d].head),k(this),!0)}has(f){if(!this[l].has(f))return!1;const b=this[l].get(f).value;return!y(this,b)}get(f){return g(this,f,!0)}peek(f){return g(this,f,!1)}pop(){const f=this[d].tail;return f?(x(this,f),f.value):null}del(f){x(this,this[l].get(f))}load(f){this.reset();const b=Date.now();for(let R=f.length-1;R>=0;R--){const L=f[R],T=L.e||0;if(T===0)this.set(L.k,L.v);else{const B=T-b;B>0&&this.set(L.k,L.v,B)}}}prune(){this[l].forEach((f,b)=>g(this,b,!1))}}const g=(m,f,b)=>{const R=m[l].get(f);if(R){const L=R.value;if(y(m,L)){if(x(m,R),!m[n])return}else b&&(m[c]&&(R.value.now=Date.now()),m[d].unshiftNode(R));return L.value}},y=(m,f)=>{if(!f||!f.maxAge&&!m[o])return!1;const b=Date.now()-f.now;return f.maxAge?b>f.maxAge:m[o]&&b>m[o]},k=m=>{if(m[t]>m[e])for(let f=m[d].tail;m[t]>m[e]&&f!==null;){const b=f.prev;x(m,f),f=b}},x=(m,f)=>{if(f){const b=f.value;m[a]&&m[a](b.key,b.value),m[t]-=b.length,m[l].delete(b.key),m[d].removeNode(f)}};class _{constructor(f,b,R,L,T){this.key=f,this.value=b,this.length=R,this.now=L,this.maxAge=T||0}}const E=(m,f,b,R)=>{let L=b.value;y(m,L)&&(x(m,b),m[n]||(L=void 0)),L&&f.call(R,L.value,L.key,m)};return xo=v,xo}var _o,Vl;function Ap(){if(Vl)return _o;Vl=1;const r=Uc(),e=10;return _o=class{constructor({document:i}){this.document=i,this.cache=new r({max:e})}getProcessed(i){return this.cache.get(i)}setProcessed(i,n){this.cache.set(i,n)}},_o}var ko,Wl;function jp(){if(Wl)return ko;Wl=1;const{isArray:r,isObject:e,isString:t}=lt(),{asArray:i}=ct(),{prependBase:n}=Xt(),o=pt(),a=Ap(),s=10;ko=class{constructor({sharedCache:u}){this.perOpCache=new Map,this.sharedCache=u}async resolve({activeCtx:u,context:v,documentLoader:g,base:y,cycles:k=new Set}){v&&e(v)&&v["@context"]&&(v=v["@context"]),v=i(v);const x=[];for(const _ of v){if(t(_)){let f=this._get(_);f||(f=await this._resolveRemoteContext({activeCtx:u,url:_,documentLoader:g,base:y,cycles:k})),r(f)?x.push(...f):x.push(f);continue}if(_===null){x.push(new a({document:null}));continue}e(_)||d(v);const E=JSON.stringify(_);let m=this._get(E);m||(m=new a({document:_}),this._cacheResolvedContext({key:E,resolved:m,tag:"static"})),x.push(m)}return x}_get(u){let v=this.perOpCache.get(u);if(!v){const g=this.sharedCache.get(u);g&&(v=g.get("static"),v&&this.perOpCache.set(u,v))}return v}_cacheResolvedContext({key:u,resolved:v,tag:g}){if(this.perOpCache.set(u,v),g!==void 0){let y=this.sharedCache.get(u);y||(y=new Map,this.sharedCache.set(u,y)),y.set(g,v)}return v}async _resolveRemoteContext({activeCtx:u,url:v,documentLoader:g,base:y,cycles:k}){v=n(y,v);const{context:x,remoteDoc:_}=await this._fetchContext({activeCtx:u,url:v,documentLoader:g,cycles:k});y=_.documentUrl||v,l({context:x,base:y});const E=await this.resolve({activeCtx:u,context:x,documentLoader:g,base:y,cycles:k});return this._cacheResolvedContext({key:v,resolved:E,tag:_.tag}),E}async _fetchContext({activeCtx:u,url:v,documentLoader:g,cycles:y}){if(y.size>s)throw new o("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:u.processingMode==="json-ld-1.0"?"loading remote context failed":"context overflow",max:s});if(y.has(v))throw new o("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:u.processingMode==="json-ld-1.0"?"recursive context inclusion":"context overflow",url:v});y.add(v);let k,x;try{x=await g(v),k=x.document||null,t(k)&&(k=JSON.parse(k))}catch(_){throw new o(`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. URL: "${v}".`,"jsonld.InvalidUrl",{code:"loading remote context failed",url:v,cause:_})}if(!e(k))throw new o(`Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object. URL: "${v}".`,"jsonld.InvalidUrl",{code:"invalid remote context",url:v});return"@context"in k?k={"@context":k["@context"]}:k={"@context":{}},x.contextUrl&&(r(k["@context"])||(k["@context"]=[k["@context"]]),k["@context"].push(x.contextUrl)),{context:k,remoteDoc:x}}};function d(c){throw new o("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:c})}function l({context:c,base:u}){if(!c)return;const v=c["@context"];if(t(v)){c["@context"]=n(u,v);return}if(r(v)){for(let g=0;g<v.length;++g){const y=v[g];if(t(y)){v[g]=n(u,y);continue}e(y)&&l({context:{"@context":y},base:u})}return}if(e(v))for(const g in v)l({context:v[g],base:u})}return ko}var Eo,Xl;function Dp(){return Xl||(Xl=1,Eo=Ma().NQuads),Eo}var So,Ql;function Ri(){if(Ql)return So;Ql=1;const r=pt(),{isArray:e}=lt(),{asArray:t}=ct(),i={};So=i,i.defaultEventHandler=null,i.setupEventHandler=({options:a={}})=>{const s=[].concat(a.safe?i.safeEventHandler:[],a.eventHandler?t(a.eventHandler):[],i.defaultEventHandler?i.defaultEventHandler:[]);return s.length===0?null:s},i.handleEvent=({event:a,options:s})=>{n({event:a,handlers:s.eventHandler})};function n({event:a,handlers:s}){let d=!0;for(let l=0;d&&l<s.length;++l){d=!1;const c=s[l];if(e(c))d=n({event:a,handlers:c});else if(typeof c=="function")c({event:a,next:()=>{d=!0}});else if(typeof c=="object")a.code in c?c[a.code]({event:a,next:()=>{d=!0}}):d=!0;else throw new r("Invalid event handler.","jsonld.InvalidEventHandler",{event:a})}return d}const o=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"]);return i.safeEventHandler=function({event:s,next:d}){if(s.level==="warning"&&o.has(s.code))throw new r("Safe mode validation error.","jsonld.ValidationError",{event:s});d()},i.logEventHandler=function({event:s,next:d}){console.log(`EVENT: ${s.message}`,{event:s}),d()},i.logWarningEventHandler=function({event:s,next:d}){s.level==="warning"&&console.warn(`WARNING: ${s.message}`,{event:s}),d()},i.unhandledEventHandler=function({event:s}){throw new r("No handler for event.","jsonld.UnhandledEvent",{event:s})},i.setDefaultEventHandler=function({eventHandler:a}={}){i.defaultEventHandler=a?t(a):null},So}var Ro,Jl;function dr(){if(Jl)return Ro;Jl=1;const r=ct(),e=pt(),{isArray:t,isObject:i,isString:n,isUndefined:o}=lt(),{isAbsolute:a,isRelative:s,prependBase:d}=Xt(),{handleEvent:l}=Ri(),{REGEX_BCP47:c,REGEX_KEYWORD:u,asArray:v,compareShortestLeast:g}=ct(),y=new Map,k=1e4,x={};Ro=x,x.process=async({activeCtx:m,localCtx:f,options:b,propagate:R=!0,overrideProtected:L=!1,cycles:T=new Set})=>{if(i(f)&&"@context"in f&&t(f["@context"])&&(f=f["@context"]),v(f).length===0)return m;const I=[],$=[({event:te,next:N})=>{I.push(te),N()}];b.eventHandler&&$.push(b.eventHandler);const q=b;b={...b,eventHandler:$};const A=await b.contextResolver.resolve({activeCtx:m,context:f,documentLoader:b.documentLoader,base:b.base});i(A[0].document)&&typeof A[0].document["@propagate"]=="boolean"&&(R=A[0].document["@propagate"]);let j=m;!R&&!j.previousContext&&(j=j.clone(),j.previousContext=m);for(const te of A){let{document:N}=te;if(m=j,N===null){if(!L&&Object.keys(m.protected).length!==0)throw new e("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});j=m=x.getInitialContext(b).clone();continue}const Z=te.getProcessed(m);if(Z){if(q.eventHandler)for(const Y of Z.events)l({event:Y,options:q});j=m=Z.context;continue}if(i(N)&&"@context"in N&&(N=N["@context"]),!i(N))throw new e("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:N});j=j.clone();const F=new Map;if("@version"in N){if(N["@version"]!==1.1)throw new e("Unsupported JSON-LD version: "+N["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:N});if(m.processingMode&&m.processingMode==="json-ld-1.0")throw new e("@version: "+N["@version"]+" not compatible with "+m.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:N});j.processingMode="json-ld-1.1",j["@version"]=N["@version"],F.set("@version",!0)}if(j.processingMode=j.processingMode||m.processingMode,"@base"in N){let Y=N["@base"];if(!(Y===null||a(Y)))if(s(Y))Y=d(j["@base"],Y);else throw new e('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:N});j["@base"]=Y,F.set("@base",!0)}if("@vocab"in N){const Y=N["@vocab"];if(Y===null)delete j["@vocab"];else if(n(Y)){if(!a(Y)&&x.processingMode(j,1))throw new e('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:N});{const w=_(j,Y,{vocab:!0,base:!0},void 0,void 0,b);a(w)||b.eventHandler&&l({event:{type:["JsonLdEvent"],code:"relative @vocab reference",level:"warning",message:"Relative @vocab reference found.",details:{vocab:w}},options:b}),j["@vocab"]=w}}else throw new e('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:N});F.set("@vocab",!0)}if("@language"in N){const Y=N["@language"];if(Y===null)delete j["@language"];else if(n(Y))Y.match(c)||b.eventHandler&&l({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:Y}},options:b}),j["@language"]=Y.toLowerCase();else throw new e('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:N});F.set("@language",!0)}if("@direction"in N){const Y=N["@direction"];if(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @direction not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:N});if(Y===null)delete j["@direction"];else{if(Y!=="ltr"&&Y!=="rtl")throw new e('Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:N});j["@direction"]=Y}F.set("@direction",!0)}if("@propagate"in N){const Y=N["@propagate"];if(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @propagate not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:N});if(typeof Y!="boolean")throw new e("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:f});F.set("@propagate",!0)}if("@import"in N){const Y=N["@import"];if(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @import not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:N});if(!n(Y))throw new e("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:f});const w=await b.contextResolver.resolve({activeCtx:m,context:Y,documentLoader:b.documentLoader,base:b.base});if(w.length!==1)throw new e("Invalid JSON-LD syntax; @import must reference a single context.","jsonld.SyntaxError",{code:"invalid remote context",context:f});const U=w[0].getProcessed(m);if(U)N=U;else{const K=w[0].document;if("@import"in K)throw new e("Invalid JSON-LD syntax: imported context must not include @import.","jsonld.SyntaxError",{code:"invalid context entry",context:f});for(const X in K)N.hasOwnProperty(X)||(N[X]=K[X]);w[0].setProcessed(m,N)}F.set("@import",!0)}F.set("@protected",N["@protected"]||!1);for(const Y in N)if(x.createTermDefinition({activeCtx:j,localCtx:N,term:Y,defined:F,options:b,overrideProtected:L}),i(N[Y])&&"@context"in N[Y]){const w=N[Y]["@context"];let U=!0;if(n(w)){const K=d(b.base,w);T.has(K)?U=!1:T.add(K)}if(U)try{await x.process({activeCtx:j.clone(),localCtx:N[Y]["@context"],overrideProtected:!0,options:b,cycles:T})}catch{throw new e("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:N[Y]["@context"],term:Y})}}te.setProcessed(m,{context:j,events:I})}return j},x.createTermDefinition=({activeCtx:m,localCtx:f,term:b,defined:R,options:L,overrideProtected:T=!1})=>{if(R.has(b)){if(R.get(b))return;throw new e("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:f,term:b})}R.set(b,!1);let B;if(f.hasOwnProperty(b)&&(B=f[b]),b==="@type"&&i(B)&&(B["@container"]||"@set")==="@set"&&x.processingMode(m,1.1)){const N=["@container","@id","@protected"],Z=Object.keys(B);if(Z.length===0||Z.some(F=>!N.includes(F)))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:f,term:b})}else{if(x.isKeyword(b))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:f,term:b});if(b.match(u)){L.eventHandler&&l({event:{type:["JsonLdEvent"],code:"reserved term",level:"warning",message:'Terms beginning with "@" are reserved for future use and dropped.',details:{term:b}},options:L});return}else if(b==="")throw new e("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:f})}const I=m.mappings.get(b);m.mappings.has(b)&&m.mappings.delete(b);let $=!1;if((n(B)||B===null)&&($=!0,B={"@id":B}),!i(B))throw new e("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:f});const q={};m.mappings.set(b,q),q.reverse=!1;const A=["@container","@id","@language","@reverse","@type"];x.processingMode(m,1.1)&&A.push("@context","@direction","@index","@nest","@prefix","@protected");for(const N in B)if(!A.includes(N))throw new e("Invalid JSON-LD syntax; a term definition must not contain "+N,"jsonld.SyntaxError",{code:"invalid term definition",context:f});const j=b.indexOf(":");if(q._termHasColon=j>0,"@reverse"in B){if("@id"in B)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:f});if("@nest"in B)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:f});const N=B["@reverse"];if(!n(N))throw new e("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:f});if(N.match(u)){L.eventHandler&&l({event:{type:["JsonLdEvent"],code:"reserved @reverse value",level:"warning",message:'@reverse values beginning with "@" are reserved for future use and dropped.',details:{reverse:N}},options:L}),I?m.mappings.set(b,I):m.mappings.delete(b);return}const Z=_(m,N,{vocab:!0,base:!1},f,R,L);if(!a(Z))throw new e("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:f});q["@id"]=Z,q.reverse=!0}else if("@id"in B){let N=B["@id"];if(N&&!n(N))throw new e("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:f});if(N===null)q["@id"]=null;else if(!x.isKeyword(N)&&N.match(u)){L.eventHandler&&l({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:'@id values beginning with "@" are reserved for future use and dropped.',details:{id:N}},options:L}),I?m.mappings.set(b,I):m.mappings.delete(b);return}else if(N!==b){if(N=_(m,N,{vocab:!0,base:!1},f,R,L),!a(N)&&!x.isKeyword(N))throw new e("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:f});if(b.match(/(?::[^:])|\//)){const Z=new Map(R).set(b,!0);if(_(m,b,{vocab:!0,base:!1},f,Z,L)!==N)throw new e("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:f})}q["@id"]=N,q._prefix=$&&!q._termHasColon&&N.match(/[:\/\?#\[\]@]$/)!==null}}if(!("@id"in q))if(q._termHasColon){const N=b.substr(0,j);if(f.hasOwnProperty(N)&&x.createTermDefinition({activeCtx:m,localCtx:f,term:N,defined:R,options:L}),m.mappings.has(N)){const Z=b.substr(j+1);q["@id"]=m.mappings.get(N)["@id"]+Z}else q["@id"]=b}else if(b==="@type")q["@id"]=b;else{if(!("@vocab"in m))throw new e("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:f,term:b});q["@id"]=m["@vocab"]+b}if((B["@protected"]===!0||R.get("@protected")===!0&&B["@protected"]!==!1)&&(m.protected[b]=!0,q.protected=!0),R.set(b,!0),"@type"in B){let N=B["@type"];if(!n(N))throw new e("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:f});if(N==="@json"||N==="@none"){if(x.processingMode(m,1))throw new e(`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:f})}else if(N!=="@id"&&N!=="@vocab"){if(N=_(m,N,{vocab:!0,base:!1},f,R,L),!a(N))throw new e("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:f});if(N.indexOf("_:")===0)throw new e("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:f})}q["@type"]=N}if("@container"in B){const N=n(B["@container"])?[B["@container"]]:B["@container"]||[],Z=["@list","@set","@index","@language"];let F=!0;const Y=N.includes("@set");if(x.processingMode(m,1.1)){if(Z.push("@graph","@id","@type"),N.includes("@list")){if(N.length!==1)throw new e("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:f})}else if(N.includes("@graph")){if(N.some(w=>w!=="@graph"&&w!=="@id"&&w!=="@index"&&w!=="@set"))throw new e("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:f})}else F&=N.length<=(Y?2:1);if(N.includes("@type")&&(q["@type"]=q["@type"]||"@id",!["@id","@vocab"].includes(q["@type"])))throw new e("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:f})}else F&=!t(B["@container"]),F&=N.length<=1;if(F&=N.every(w=>Z.includes(w)),F&=!(Y&&N.includes("@list")),!F)throw new e("Invalid JSON-LD syntax; @context @container value must be one of the following: "+Z.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:f});if(q.reverse&&!N.every(w=>["@index","@set"].includes(w)))throw new e("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:f});q["@container"]=N}if("@index"in B){if(!("@container"in B)||!q["@container"].includes("@index"))throw new e(`Invalid JSON-LD syntax; @index without @index in @container: "${B["@index"]}" on term "${b}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:f});if(!n(B["@index"])||B["@index"].indexOf("@")===0)throw new e(`Invalid JSON-LD syntax; @index must expand to an IRI: "${B["@index"]}" on term "${b}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:f});q["@index"]=B["@index"]}if("@context"in B&&(q["@context"]=B["@context"]),"@language"in B&&!("@type"in B)){let N=B["@language"];if(N!==null&&!n(N))throw new e("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:f});N!==null&&(N=N.toLowerCase()),q["@language"]=N}if("@prefix"in B){if(b.match(/:|\//))throw new e("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:f});if(x.isKeyword(q["@id"]))throw new e("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:f});if(typeof B["@prefix"]=="boolean")q._prefix=B["@prefix"]===!0;else throw new e("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:f})}if("@direction"in B){const N=B["@direction"];if(N!==null&&N!=="ltr"&&N!=="rtl")throw new e('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:f});q["@direction"]=N}if("@nest"in B){const N=B["@nest"];if(!n(N)||N!=="@nest"&&N.indexOf("@")===0)throw new e("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:f});q["@nest"]=N}// disallow aliasing @context and @preserve
|
|
324
|
+
const te=q["@id"];if(te==="@context"||te==="@preserve")throw new e("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:f});if(I&&I.protected&&!T&&(m.protected[b]=!0,q.protected=!0,!E(I,q)))throw new e("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:f,term:b})},x.expandIri=(m,f,b,R)=>_(m,f,b,void 0,void 0,R);function _(m,f,b,R,L,T){if(f===null||!n(f)||x.isKeyword(f))return f;if(f.match(u))return null;if(R&&R.hasOwnProperty(f)&&L.get(f)!==!0&&x.createTermDefinition({activeCtx:m,localCtx:R,term:f,defined:L,options:T}),b=b||{},b.vocab){const I=m.mappings.get(f);if(I===null)return null;if(i(I)&&"@id"in I)return I["@id"]}const B=f.indexOf(":");if(B>0){const I=f.substr(0,B),$=f.substr(B+1);if(I==="_"||$.indexOf("//")===0)return f;R&&R.hasOwnProperty(I)&&x.createTermDefinition({activeCtx:m,localCtx:R,term:I,defined:L,options:T});const q=m.mappings.get(I);if(q&&q._prefix)return q["@id"]+$;if(a(f))return f}if(b.vocab&&"@vocab"in m)f=m["@vocab"]+f;else if(b.base){let I,$;"@base"in m?m["@base"]?($=d(T.base,m["@base"]),I=d($,f)):($=m["@base"],I=f):($=T.base,I=d(T.base,f)),f=I}return f}x.getInitialContext=m=>{const f=JSON.stringify({processingMode:m.processingMode}),b=y.get(f);if(b)return b;const R={processingMode:m.processingMode,mappings:new Map,inverse:null,getInverse:L,clone:I,revertToPreviousContext:$,protected:{}};return y.size===k&&y.clear(),y.set(f,R),R;function L(){const q=this;if(q.inverse)return q.inverse;const A=q.inverse={},j=q.fastCurieMap={},te={},N=(q["@language"]||"@none").toLowerCase(),Z=q["@direction"],F=q.mappings,Y=[...F.keys()].sort(g);for(const w of Y){const U=F.get(w);if(U===null)continue;let K=U["@container"]||"@none";if(K=[].concat(K).sort().join(""),U["@id"]===null)continue;const X=v(U["@id"]);for(const de of X){let H=A[de];const G=x.isKeyword(de);if(H)!G&&!U._termHasColon&&te[de].push(w);else if(A[de]=H={},!G&&!U._termHasColon){te[de]=[w];const W={iri:de,terms:te[de]};de[0]in j?j[de[0]].push(W):j[de[0]]=[W]}if(H[K]||(H[K]={"@language":{},"@type":{},"@any":{}}),H=H[K],B(w,H["@any"],"@none"),U.reverse)B(w,H["@type"],"@reverse");else if(U["@type"]==="@none")B(w,H["@any"],"@none"),B(w,H["@language"],"@none"),B(w,H["@type"],"@none");else if("@type"in U)B(w,H["@type"],U["@type"]);else if("@language"in U&&"@direction"in U){const W=U["@language"],z=U["@direction"];W&&z?B(w,H["@language"],`${W}_${z}`.toLowerCase()):W?B(w,H["@language"],W.toLowerCase()):z?B(w,H["@language"],`_${z}`):B(w,H["@language"],"@null")}else"@language"in U?B(w,H["@language"],(U["@language"]||"@null").toLowerCase()):"@direction"in U?U["@direction"]?B(w,H["@language"],`_${U["@direction"]}`):B(w,H["@language"],"@none"):Z?(B(w,H["@language"],`_${Z}`),B(w,H["@language"],"@none"),B(w,H["@type"],"@none")):(B(w,H["@language"],N),B(w,H["@language"],"@none"),B(w,H["@type"],"@none"))}}for(const w in j)T(j,w,1);return A}function T(q,A,j){const te=q[A],N=q[A]={};let Z,F;for(const Y of te)Z=Y.iri,j>=Z.length?F="":F=Z[j],F in N?N[F].push(Y):N[F]=[Y];for(const Y in N)Y!==""&&T(N,Y,j+1)}function B(q,A,j){A.hasOwnProperty(j)||(A[j]=q)}function I(){const q={};return q.mappings=r.clone(this.mappings),q.clone=this.clone,q.inverse=null,q.getInverse=this.getInverse,q.protected=r.clone(this.protected),this.previousContext&&(q.previousContext=this.previousContext.clone()),q.revertToPreviousContext=this.revertToPreviousContext,"@base"in this&&(q["@base"]=this["@base"]),"@language"in this&&(q["@language"]=this["@language"]),"@vocab"in this&&(q["@vocab"]=this["@vocab"]),q}function $(){return this.previousContext?this.previousContext.clone():this}},x.getContextValue=(m,f,b)=>{if(f===null)return b==="@context"?void 0:null;if(m.mappings.has(f)){const R=m.mappings.get(f);if(o(b))return R;if(R.hasOwnProperty(b))return R[b]}if(b==="@language"&&b in m||b==="@direction"&&b in m)return m[b];if(b!=="@context")return null},x.processingMode=(m,f)=>f.toString()>="1.1"?!m.processingMode||m.processingMode>="json-ld-"+f.toString():m.processingMode==="json-ld-1.0",x.isKeyword=m=>{if(!n(m)||m[0]!=="@")return!1;switch(m){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};function E(m,f){if(!(m&&typeof m=="object")||!(f&&typeof f=="object"))return m===f;const b=Array.isArray(m);if(b!==Array.isArray(f))return!1;if(b){if(m.length!==f.length)return!1;for(let T=0;T<m.length;++T)if(!E(m[T],f[T]))return!1;return!0}const R=Object.keys(m),L=Object.keys(f);if(R.length!==L.length)return!1;for(const T in m){let B=m[T],I=f[T];if(T==="@container"&&Array.isArray(B)&&Array.isArray(I)&&(B=B.slice().sort(),I=I.slice().sort()),!E(B,I))return!1}return!0}return Ro}var Io,Kl;function Lp(){if(Kl)return Io;Kl=1;const r=pt(),{isArray:e,isObject:t,isEmptyObject:i,isString:n,isUndefined:o}=lt(),{isList:a,isValue:s,isGraph:d,isSubject:l}=$t(),{expandIri:c,getContextValue:u,isKeyword:v,process:g,processingMode:y}=dr(),{isAbsolute:k}=Xt(),{REGEX_BCP47:x,REGEX_KEYWORD:_,addValue:E,asArray:m,getValues:f,validateTypeValue:b}=ct(),{handleEvent:R}=Ri(),L={};Io=L,L.expand=async({activeCtx:A,activeProperty:j=null,element:te,options:N={},insideList:Z=!1,insideIndex:F=!1,typeScopedContext:Y=null})=>{if(te==null)return null;if(j==="@default"&&(N=Object.assign({},N,{isFrame:!1})),!e(te)&&!t(te))return!Z&&(j===null||c(A,j,{vocab:!0},N)==="@graph")?(N.eventHandler&&R({event:{type:["JsonLdEvent"],code:"free-floating scalar",level:"warning",message:"Dropping free-floating scalar not in a list.",details:{value:te}},options:N}),null):I({activeCtx:A,activeProperty:j,value:te,options:N});if(e(te)){let W=[];const z=u(A,j,"@container")||[];Z=Z||z.includes("@list");for(let ee=0;ee<te.length;++ee){let re=await L.expand({activeCtx:A,activeProperty:j,element:te[ee],options:N,insideIndex:F,typeScopedContext:Y});Z&&e(re)&&(re={"@list":re}),re!==null&&(e(re)?W=W.concat(re):W.push(re))}return W}const w=c(A,j,{vocab:!0},N),U=u(A,j,"@context");Y=Y||(A.previousContext?A:null);let K=Object.keys(te).sort(),X=!F;if(X&&Y&&K.length<=2&&!K.includes("@context"))for(const W of K){const z=c(Y,W,{vocab:!0},N);if(z==="@value"){X=!1,A=Y;break}if(z==="@id"&&K.length===1){X=!1;break}}X&&(A=A.revertToPreviousContext()),o(U)||(A=await g({activeCtx:A,localCtx:U,propagate:!0,overrideProtected:!0,options:N})),"@context"in te&&(A=await g({activeCtx:A,localCtx:te["@context"],options:N})),Y=A;let de=null;for(const W of K)if(c(A,W,{vocab:!0},N)==="@type"){de=de||W;const ee=te[W],re=Array.isArray(ee)?ee.length>1?ee.slice().sort():ee:[ee];for(const pe of re){const be=u(Y,pe,"@context");o(be)||(A=await g({activeCtx:A,localCtx:be,options:N,propagate:!1}))}}let H={};await B({activeCtx:A,activeProperty:j,expandedActiveProperty:w,element:te,expandedParent:H,options:N,insideList:Z,typeKey:de,typeScopedContext:Y}),K=Object.keys(H);let G=K.length;if("@value"in H){if("@type"in H&&("@language"in H||"@direction"in H))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:H});let W=G-1;if("@type"in H&&(W-=1),"@index"in H&&(W-=1),"@language"in H&&(W-=1),"@direction"in H&&(W-=1),W!==0)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:H});const z=H["@value"]===null?[]:m(H["@value"]),ee=f(H,"@type");if(!(y(A,1.1)&&ee.includes("@json")&&ee.length===1))if(z.length===0)N.eventHandler&&R({event:{type:["JsonLdEvent"],code:"null @value value",level:"warning",message:"Dropping null @value value.",details:{value:H}},options:N}),H=null;else{if(!z.every(re=>n(re)||i(re))&&"@language"in H)throw new r("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:H});if(!ee.every(re=>k(re)&&!(n(re)&&re.indexOf("_:")===0)||i(re)))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:H})}}else if("@type"in H&&!e(H["@type"]))H["@type"]=[H["@type"]];else if("@set"in H||"@list"in H){if(G>1&&!(G===2&&"@index"in H))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:H});"@set"in H&&(H=H["@set"],K=Object.keys(H),G=K.length)}else G===1&&"@language"in H&&(N.eventHandler&&R({event:{type:["JsonLdEvent"],code:"object with only @language",level:"warning",message:"Dropping object with only @language.",details:{value:H}},options:N}),H=null);return t(H)&&!N.keepFreeFloatingNodes&&!Z&&(j===null||w==="@graph"||(u(A,j,"@container")||[]).includes("@graph"))&&(H=T({value:H,count:G,options:N})),H};function T({value:A,count:j,options:te}){if(j===0||"@value"in A||"@list"in A||j===1&&"@id"in A){if(te.eventHandler){let N,Z;j===0?(N="empty object",Z="Dropping empty object."):"@value"in A?(N="object with only @value",Z="Dropping object with only @value."):"@list"in A?(N="object with only @list",Z="Dropping object with only @list."):j===1&&"@id"in A&&(N="object with only @id",Z="Dropping object with only @id."),R({event:{type:["JsonLdEvent"],code:N,level:"warning",message:Z,details:{value:A}},options:te})}return null}return A}async function B({activeCtx:A,activeProperty:j,expandedActiveProperty:te,element:N,expandedParent:Z,options:F={},insideList:Y,typeKey:w,typeScopedContext:U}){const K=Object.keys(N).sort(),X=[];let de;const H=N[w]&&c(A,e(N[w])?N[w][0]:N[w],{vocab:!0},{...F,typeExpansion:!0})==="@json";for(const G of K){let W=N[G],z;if(G==="@context")continue;const ee=c(A,G,{vocab:!0},F);if(ee===null||!(k(ee)||v(ee))){F.eventHandler&&R({event:{type:["JsonLdEvent"],code:"invalid property",level:"warning",message:"Dropping property that did not expand into an absolute IRI or keyword.",details:{property:G,expandedProperty:ee}},options:F});continue}if(v(ee)){if(te==="@reverse")throw new r("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:W});if(ee in Z&&ee!=="@included"&&ee!=="@type")throw new r("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:ee})}if(ee==="@id"){if(!n(W)){if(!F.isFrame)throw new r('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:W});if(t(W)){if(!i(W))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:W})}else if(e(W)){if(!W.every(O=>n(O)))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:W})}else 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:W})}E(Z,"@id",m(W).map(O=>{if(n(O)){const V=c(A,O,{base:!0},F);return F.eventHandler&&(V===null?R(O===null?{event:{type:["JsonLdEvent"],code:"null @id value",level:"warning",message:"Null @id found.",details:{id:O}},options:F}:{event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:O}},options:F}):k(V)||R({event:{type:["JsonLdEvent"],code:"relative @id reference",level:"warning",message:"Relative @id reference found.",details:{id:O,expandedId:V}},options:F})),V}return O}),{propertyIsArray:F.isFrame});continue}if(ee==="@type"){t(W)&&(W=Object.fromEntries(Object.entries(W).map(([O,V])=>[c(U,O,{vocab:!0}),m(V).map(oe=>c(U,oe,{base:!0,vocab:!0},{...F,typeExpansion:!0}))]))),b(W,F.isFrame),E(Z,"@type",m(W).map(O=>{if(n(O)){const V=c(U,O,{base:!0,vocab:!0},{...F,typeExpansion:!0});return V!=="@json"&&!k(V)&&F.eventHandler&&R({event:{type:["JsonLdEvent"],code:"relative @type reference",level:"warning",message:"Relative @type reference found.",details:{type:O}},options:F}),V}return O}),{propertyIsArray:!!F.isFrame});continue}if(ee==="@included"&&y(A,1.1)){const O=m(await L.expand({activeCtx:A,activeProperty:j,element:W,options:F}));if(!O.every(V=>l(V)))throw new r("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:W});E(Z,"@included",O,{propertyIsArray:!0});continue}if(ee==="@graph"&&!(t(W)||e(W)))throw new r('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:W});if(ee==="@value"){de=W,H&&y(A,1.1)?Z["@value"]=W:E(Z,"@value",W,{propertyIsArray:F.isFrame});continue}if(ee==="@language"){if(W===null)continue;if(!n(W)&&!F.isFrame)throw new r('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:W});W=m(W).map(O=>n(O)?O.toLowerCase():O);for(const O of W)n(O)&&!O.match(x)&&F.eventHandler&&R({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:O}},options:F});E(Z,"@language",W,{propertyIsArray:F.isFrame});continue}if(ee==="@direction"){if(!n(W)&&!F.isFrame)throw new r('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:W});W=m(W);for(const O of W)if(n(O)&&O!=="ltr"&&O!=="rtl")throw new r('Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",value:W});E(Z,"@direction",W,{propertyIsArray:F.isFrame});continue}if(ee==="@index"){if(!n(W))throw new r('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:W});E(Z,"@index",W);continue}if(ee==="@reverse"){if(!t(W))throw new r('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:W});if(z=await L.expand({activeCtx:A,activeProperty:"@reverse",element:W,options:F}),"@reverse"in z)for(const V in z["@reverse"])E(Z,V,z["@reverse"][V],{propertyIsArray:!0});let O=Z["@reverse"]||null;for(const V in z){if(V==="@reverse")continue;O===null&&(O=Z["@reverse"]={}),E(O,V,[],{propertyIsArray:!0});const oe=z[V];for(let fe=0;fe<oe.length;++fe){const he=oe[fe];if(s(he)||a(he))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:z});E(O,V,he,{propertyIsArray:!0})}}continue}if(ee==="@nest"){X.push(G);continue}let re=A;const pe=u(A,G,"@context");o(pe)||(re=await g({activeCtx:A,localCtx:pe,propagate:!0,overrideProtected:!0,options:F}));const be=u(A,G,"@container")||[];if(be.includes("@language")&&t(W)){const O=u(re,G,"@direction");z=$(re,W,O,F)}else if(be.includes("@index")&&t(W)){const O=be.includes("@graph"),V=u(re,G,"@index")||"@index",oe=V!=="@index"&&c(A,V,{vocab:!0},F);z=await q({activeCtx:re,options:F,activeProperty:G,value:W,asGraph:O,indexKey:V,propertyIndex:oe})}else if(be.includes("@id")&&t(W)){const O=be.includes("@graph");z=await q({activeCtx:re,options:F,activeProperty:G,value:W,asGraph:O,indexKey:"@id"})}else if(be.includes("@type")&&t(W))z=await q({activeCtx:re.revertToPreviousContext(),options:F,activeProperty:G,value:W,asGraph:!1,indexKey:"@type"});else{const O=ee==="@list";if(O||ee==="@set"){let V=j;O&&te==="@graph"&&(V=null),z=await L.expand({activeCtx:re,activeProperty:V,element:W,options:F,insideList:O})}else u(A,G,"@type")==="@json"?z={"@type":"@json","@value":W}:z=await L.expand({activeCtx:re,activeProperty:G,element:W,options:F,insideList:!1})}if(!(z===null&&ee!=="@value")){if(ee!=="@list"&&!a(z)&&be.includes("@list")&&(z={"@list":m(z)}),be.includes("@graph")&&!be.some(O=>O==="@id"||O==="@index")){if(z=m(z),F.isFrame||(z=z.filter(O=>{const V=Object.keys(O).length;return T({value:O,count:V,options:F})!==null})),z.length===0)continue;z=z.map(O=>({"@graph":m(O)}))}if(re.mappings.has(G)&&re.mappings.get(G).reverse){const O=Z["@reverse"]=Z["@reverse"]||{};z=m(z);for(let V=0;V<z.length;++V){const oe=z[V];if(s(oe)||a(oe))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:z});E(O,ee,oe,{propertyIsArray:!0})}continue}E(Z,ee,z,{propertyIsArray:!0})}}if("@value"in Z&&!(Z["@type"]==="@json"&&y(A,1.1))){if((t(de)||e(de))&&!F.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:de})}for(const G of X){const W=e(N[G])?N[G]:[N[G]];for(const z of W){if(!t(z)||Object.keys(z).some(ee=>c(A,ee,{vocab:!0},F)==="@value"))throw new r("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:z});await B({activeCtx:A,activeProperty:j,expandedActiveProperty:te,element:z,expandedParent:Z,options:F,insideList:Y,typeScopedContext:U,typeKey:w})}}}function I({activeCtx:A,activeProperty:j,value:te,options:N}){if(te==null)return null;const Z=c(A,j,{vocab:!0},N);if(Z==="@id")return c(A,te,{base:!0},N);if(Z==="@type")return c(A,te,{vocab:!0,base:!0},{...N,typeExpansion:!0});const F=u(A,j,"@type");if((F==="@id"||Z==="@graph")&&n(te)){const w=c(A,te,{base:!0},N);return w===null&&te.match(_)&&N.eventHandler&&R({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:j}},options:N}),{"@id":w}}if(F==="@vocab"&&n(te))return{"@id":c(A,te,{vocab:!0,base:!0},N)};if(v(Z))return te;const Y={};if(F&&!["@id","@vocab","@none"].includes(F))Y["@type"]=F;else if(n(te)){const w=u(A,j,"@language");w!==null&&(Y["@language"]=w);const U=u(A,j,"@direction");U!==null&&(Y["@direction"]=U)}return["boolean","number","string"].includes(typeof te)||(te=te.toString()),Y["@value"]=te,Y}function $(A,j,te,N){const Z=[],F=Object.keys(j).sort();for(const Y of F){const w=c(A,Y,{vocab:!0},N);let U=j[Y];e(U)||(U=[U]);for(const K of U){if(K===null)continue;if(!n(K))throw new r("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:j});const X={"@value":K};w!=="@none"&&(Y.match(x)||N.eventHandler&&R({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:Y}},options:N}),X["@language"]=Y.toLowerCase()),te&&(X["@direction"]=te),Z.push(X)}}return Z}async function q({activeCtx:A,options:j,activeProperty:te,value:N,asGraph:Z,indexKey:F,propertyIndex:Y}){const w=[],U=Object.keys(N).sort(),K=F==="@type";for(let X of U){if(K){const G=u(A,X,"@context");o(G)||(A=await g({activeCtx:A,localCtx:G,propagate:!1,options:j}))}let de=N[X];e(de)||(de=[de]),de=await L.expand({activeCtx:A,activeProperty:te,element:de,options:j,insideList:!1,insideIndex:!0});let H;Y?X==="@none"?H="@none":H=I({activeCtx:A,activeProperty:F,value:X,options:j}):H=c(A,X,{vocab:!0},j),F==="@id"?X=c(A,X,{base:!0},j):K&&(X=H);for(let G of de){if(Z&&!d(G)&&(G={"@graph":[G]}),F==="@type")H==="@none"||(G["@type"]?G["@type"]=[X].concat(G["@type"]):G["@type"]=[X]);else{if(s(G)&&!["@language","@type","@index"].includes(F))throw new r(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${F}".`,"jsonld.SyntaxError",{code:"invalid value object",value:G});Y?H!=="@none"&&E(G,Y,H,{propertyIsArray:!0,prependValue:!0}):H!=="@none"&&!(F in G)&&(G[F]=X)}w.push(G)}}return w}return Io}var No,Yl;function hn(){if(Yl)return No;Yl=1;const{isKeyword:r}=dr(),e=$t(),t=lt(),i=ct(),n=pt(),o={};return No=o,o.createMergedNodeMap=(a,s)=>{s=s||{};const d=s.issuer||new i.IdentifierIssuer("_:b"),l={"@default":{}};return o.createNodeMap(a,l,"@default",d),o.mergeNodeMaps(l)},o.createNodeMap=(a,s,d,l,c,u)=>{if(t.isArray(a)){for(const k of a)o.createNodeMap(k,s,d,l,void 0,u);return}if(!t.isObject(a)){u&&u.push(a);return}if(e.isValue(a)){if("@type"in a){let k=a["@type"];k.indexOf("_:")===0&&(a["@type"]=k=l.getId(k))}u&&u.push(a);return}else if(u&&e.isList(a)){const k=[];o.createNodeMap(a["@list"],s,d,l,c,k),u.push({"@list":k});return}if("@type"in a){const k=a["@type"];for(const x of k)x.indexOf("_:")===0&&l.getId(x)}t.isUndefined(c)&&(c=e.isBlankNode(a)?l.getId(a["@id"]):a["@id"]),u&&u.push({"@id":c});const v=s[d],g=v[c]=v[c]||{};g["@id"]=c;const y=Object.keys(a).sort();for(let k of y){if(k==="@id")continue;if(k==="@reverse"){const _={"@id":c},E=a["@reverse"];for(const m in E){const f=E[m];for(const b of f){let R=b["@id"];e.isBlankNode(b)&&(R=l.getId(R)),o.createNodeMap(b,s,d,l,R),i.addValue(v[R],m,_,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(k==="@graph"){c in s||(s[c]={}),o.createNodeMap(a[k],s,c,l);continue}if(k==="@included"){o.createNodeMap(a[k],s,d,l);continue}if(k!=="@type"&&r(k)){if(k==="@index"&&k in g&&(a[k]!==g[k]||a[k]["@id"]!==g[k]["@id"]))throw new n("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:g});g[k]=a[k];continue}const x=a[k];if(k.indexOf("_:")===0&&(k=l.getId(k)),x.length===0){i.addValue(g,k,[],{propertyIsArray:!0});continue}for(let _ of x)if(k==="@type"&&(_=_.indexOf("_:")===0?l.getId(_):_),e.isSubject(_)||e.isSubjectReference(_)){if("@id"in _&&!_["@id"])continue;const E=e.isBlankNode(_)?l.getId(_["@id"]):_["@id"];i.addValue(g,k,{"@id":E},{propertyIsArray:!0,allowDuplicate:!1}),o.createNodeMap(_,s,d,l,E)}else if(e.isValue(_))i.addValue(g,k,_,{propertyIsArray:!0,allowDuplicate:!1});else if(e.isList(_)){const E=[];o.createNodeMap(_["@list"],s,d,l,c,E),_={"@list":E},i.addValue(g,k,_,{propertyIsArray:!0,allowDuplicate:!1})}else o.createNodeMap(_,s,d,l,c),i.addValue(g,k,_,{propertyIsArray:!0,allowDuplicate:!1})}},o.mergeNodeMapGraphs=a=>{const s={};for(const d of Object.keys(a).sort())for(const l of Object.keys(a[d]).sort()){const c=a[d][l];l in s||(s[l]={"@id":l});const u=s[l];for(const v of Object.keys(c).sort())if(r(v)&&v!=="@type")u[v]=i.clone(c[v]);else for(const g of c[v])i.addValue(u,v,i.clone(g),{propertyIsArray:!0,allowDuplicate:!1})}return s},o.mergeNodeMaps=a=>{const s=a["@default"],d=Object.keys(a).sort();for(const l of d){if(l==="@default")continue;const c=a[l];let u=s[l];u?"@graph"in u||(u["@graph"]=[]):s[l]=u={"@id":l,"@graph":[]};const v=u["@graph"];for(const g of Object.keys(c).sort()){const y=c[g];e.isSubjectReference(y)||v.push(y)}}return s},No}var To,Zl;function Op(){if(Zl)return To;Zl=1;const{isSubjectReference:r}=$t(),{createMergedNodeMap:e}=hn(),t={};return To=t,t.flatten=i=>{const n=e(i),o=[],a=Object.keys(n).sort();for(let s=0;s<a.length;++s){const d=n[a[s]];r(d)||o.push(d)}return o},To}var Ao,ed;function Cp(){if(ed)return Ao;ed=1;const r=pt(),e=$t(),t=lt(),{REGEX_BCP47:i,addValue:n}=ct(),{handleEvent:o}=Ri(),{RDF_LIST:a,RDF_FIRST:s,RDF_REST:d,RDF_NIL:l,RDF_TYPE:c,RDF_JSON_LITERAL:u,XSD_BOOLEAN:v,XSD_DOUBLE:g,XSD_INTEGER:y,XSD_STRING:k}=Ba(),x={};Ao=x,x.fromRDF=async(E,m)=>{const{useRdfType:f=!1,useNativeTypes:b=!1,rdfDirection:R=null}=m,L={},T={"@default":L},B={};if(R){if(R==="compound-literal")throw new r("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:R});if(R!=="i18n-datatype")throw new r("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:R})}for(const q of E){const A=q.graph.termType==="DefaultGraph"?"@default":q.graph.value;A in T||(T[A]={}),A!=="@default"&&!(A in L)&&(L[A]={"@id":A});const j=T[A],te=q.subject.value,N=q.predicate.value,Z=q.object;te in j||(j[te]={"@id":te});const F=j[te],Y=Z.termType.endsWith("Node");if(Y&&!(Z.value in j)&&(j[Z.value]={"@id":Z.value}),N===c&&!f&&Y){n(F,"@type",Z.value,{propertyIsArray:!0});continue}const w=_(Z,b,R,m);if(n(F,N,w,{propertyIsArray:!0}),Y)if(Z.value===l){const U=j[Z.value];"usages"in U||(U.usages=[]),U.usages.push({node:F,property:N,value:w})}else Z.value in B?B[Z.value]=!1:B[Z.value]={node:F,property:N,value:w}}for(const q in T){const A=T[q];if(!(l in A))continue;const j=A[l];if(j.usages){for(let te of j.usages){let N=te.node,Z=te.property,F=te.value;const Y=[],w=[];let U=Object.keys(N).length;for(;Z===d&&t.isObject(B[N["@id"]])&&t.isArray(N[s])&&N[s].length===1&&t.isArray(N[d])&&N[d].length===1&&(U===3||U===4&&t.isArray(N["@type"])&&N["@type"].length===1&&N["@type"][0]===a)&&(Y.push(N[s][0]),w.push(N["@id"]),te=B[N["@id"]],N=te.node,Z=te.property,F=te.value,U=Object.keys(N).length,!!e.isBlankNode(N)););delete F["@id"],F["@list"]=Y.reverse();for(const K of w)delete A[K]}delete j.usages}}const I=[],$=Object.keys(L).sort();for(const q of $){const A=L[q];if(q in T){const j=A["@graph"]=[],te=T[q],N=Object.keys(te).sort();for(const Z of N){const F=te[Z];e.isSubjectReference(F)||j.push(F)}}e.isSubjectReference(A)||I.push(A)}return I};function _(E,m,f,b){if(E.termType.endsWith("Node"))return{"@id":E.value};const R={"@value":E.value};if(E.language)E.language.match(i)||b.eventHandler&&o({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:E.language}},options:b}),R["@language"]=E.language;else{let L=E.datatype.value;if(L||(L=k),L===u){L="@json";try{R["@value"]=JSON.parse(R["@value"])}catch(T){throw new r("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:R["@value"],cause:T})}}if(m){if(L===v)R["@value"]==="true"?R["@value"]=!0:R["@value"]==="false"&&(R["@value"]=!1);else if(t.isNumeric(R["@value"]))if(L===y){const T=parseInt(R["@value"],10);T.toFixed(0)===R["@value"]&&(R["@value"]=T)}else L===g&&(R["@value"]=parseFloat(R["@value"]));[v,y,g,k].includes(L)||(R["@type"]=L)}else if(f==="i18n-datatype"&&L.startsWith("https://www.w3.org/ns/i18n#")){const[,T,B]=L.split(/[#_]/);T.length>0&&(R["@language"]=T,T.match(i)||b.eventHandler&&o({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:T}},options:b})),R["@direction"]=B}else L!==k&&(R["@type"]=L)}return R}return Ao}var jo,td;function $p(){return td||(td=1,jo=function r(e){return e===null||typeof e!="object"||e.toJSON!=null?JSON.stringify(e):Array.isArray(e)?"["+e.reduce((t,i,n)=>{const o=n===0?"":",",a=i===void 0||typeof i=="symbol"?null:i;return t+o+r(a)},"")+"]":"{"+Object.keys(e).sort().reduce((t,i,n)=>{if(e[i]===void 0||typeof e[i]=="symbol")return t;const o=t.length===0?"":",";return t+o+r(i)+":"+r(e[i])},"")+"}"}),jo}var Do,rd;function Fp(){if(rd)return Do;rd=1;const{createNodeMap:r}=hn(),{isKeyword:e}=dr(),t=$t(),i=$p(),n=pt(),o=lt(),a=ct(),{handleEvent:s}=Ri(),{RDF_FIRST:d,RDF_REST:l,RDF_NIL:c,RDF_TYPE:u,RDF_JSON_LITERAL:v,RDF_LANGSTRING:g,XSD_BOOLEAN:y,XSD_DOUBLE:k,XSD_INTEGER:x,XSD_STRING:_}=Ba(),{isAbsolute:E}=Xt(),m={};Do=m,m.toRDF=(L,T)=>{const B=new a.IdentifierIssuer("_:b"),I={"@default":{}};r(L,I,"@default",B);const $=[],q=Object.keys(I).sort();for(const A of q){let j;if(A==="@default")j={termType:"DefaultGraph",value:""};else if(E(A))A.startsWith("_:")?j={termType:"BlankNode"}:j={termType:"NamedNode"},j.value=A;else{T.eventHandler&&s({event:{type:["JsonLdEvent"],code:"relative graph reference",level:"warning",message:"Relative graph reference found.",details:{graph:A}},options:T});continue}f($,I[A],j,B,T)}return $};function f(L,T,B,I,$){const q=Object.keys(T).sort();for(const A of q){const j=T[A],te=Object.keys(j).sort();for(let N of te){const Z=j[N];if(N==="@type")N=u;else if(e(N))continue;for(const F of Z){const Y={termType:A.startsWith("_:")?"BlankNode":"NamedNode",value:A};if(!E(A)){$.eventHandler&&s({event:{type:["JsonLdEvent"],code:"relative subject reference",level:"warning",message:"Relative subject reference found.",details:{subject:A}},options:$});continue}const w={termType:N.startsWith("_:")?"BlankNode":"NamedNode",value:N};if(!E(N)){$.eventHandler&&s({event:{type:["JsonLdEvent"],code:"relative predicate reference",level:"warning",message:"Relative predicate reference found.",details:{predicate:N}},options:$});continue}if(w.termType==="BlankNode"&&!$.produceGeneralizedRdf){$.eventHandler&&s({event:{type:["JsonLdEvent"],code:"blank node predicate",level:"warning",message:"Dropping blank node predicate.",details:{property:I.getOldIds().find(K=>I.getId(K)===N)}},options:$});continue}const U=R(F,I,L,B,$.rdfDirection,$);U&&L.push({subject:Y,predicate:w,object:U,graph:B})}}}}function b(L,T,B,I,$,q){const A={termType:"NamedNode",value:d},j={termType:"NamedNode",value:l},te={termType:"NamedNode",value:c},N=L.pop(),Z=N?{termType:"BlankNode",value:T.getId()}:te;let F=Z;for(const Y of L){const w=R(Y,T,B,I,$,q),U={termType:"BlankNode",value:T.getId()};B.push({subject:F,predicate:A,object:w,graph:I}),B.push({subject:F,predicate:j,object:U,graph:I}),F=U}if(N){const Y=R(N,T,B,I,$,q);B.push({subject:F,predicate:A,object:Y,graph:I}),B.push({subject:F,predicate:j,object:te,graph:I})}return Z}function R(L,T,B,I,$,q){const A={};if(t.isValue(L)){A.termType="Literal",A.value=void 0,A.datatype={termType:"NamedNode"};let j=L["@value"];const te=L["@type"]||null;if(te==="@json")A.value=i(j),A.datatype.value=v;else if(o.isBoolean(j))A.value=j.toString(),A.datatype.value=te||y;else if(o.isDouble(j)||te===k)o.isDouble(j)||(j=parseFloat(j)),A.value=j.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),A.datatype.value=te||k;else if(o.isNumber(j))A.value=j.toFixed(0),A.datatype.value=te||x;else if("@direction"in L&&$==="i18n-datatype"){const N=(L["@language"]||"").toLowerCase(),Z=L["@direction"],F=`https://www.w3.org/ns/i18n#${N}_${Z}`;A.datatype.value=F,A.value=j}else{if("@direction"in L&&$==="compound-literal")throw new n("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:$});if("@direction"in L&&$)throw new n("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:$});"@language"in L?("@direction"in L&&!$&&q.eventHandler&&s({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:A.value}},options:q}),A.value=j,A.datatype.value=te||g,A.language=L["@language"]):("@direction"in L&&!$&&q.eventHandler&&s({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:A.value}},options:q}),A.value=j,A.datatype.value=te||_)}}else if(t.isList(L)){const j=b(L["@list"],T,B,I,$,q);A.termType=j.termType,A.value=j.value}else{const j=o.isObject(L)?L["@id"]:L;A.termType=j.startsWith("_:")?"BlankNode":"NamedNode",A.value=j}return A.termType==="NamedNode"&&!E(A.value)?(q.eventHandler&&s({event:{type:["JsonLdEvent"],code:"relative object reference",level:"warning",message:"Relative object reference found.",details:{object:A.value}},options:q}),null):A}return Do}var Lo,id;function Pp(){if(id)return Lo;id=1;const{isKeyword:r}=dr(),e=$t(),t=lt(),i=ct(),n=Xt(),o=pt(),{createNodeMap:a,mergeNodeMapGraphs:s}=hn(),d={};Lo=d,d.frameMergedOrDefault=(f,b,R)=>{const L={options:R,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},T=new i.IdentifierIssuer("_:b");a(f,L.graphMap,"@default",T),R.merged&&(L.graphMap["@merged"]=s(L.graphMap),L.graph="@merged"),L.subjects=L.graphMap[L.graph];const B=[];d.frame(L,Object.keys(L.subjects).sort(),b,B),R.pruneBlankNodeIdentifiers&&(R.bnodesToClear=Object.keys(L.bnodeMap).filter(I=>L.bnodeMap[I].length===1));// remove @preserve from results
|
|
325
|
+
return R.link={},x(B,R)},d.frame=(f,b,R,L,T=null)=>{v(R),R=R[0];const B=f.options,I={embed:u(R,B,"embed"),explicit:u(R,B,"explicit"),requireAll:u(R,B,"requireAll")};f.link.hasOwnProperty(f.graph)||(f.link[f.graph]={});const $=f.link[f.graph],q=g(f,b,R,I),A=Object.keys(q).sort();for(const j of A){const te=q[j];if(T===null?f.uniqueEmbeds={[f.graph]:{}}:f.uniqueEmbeds[f.graph]=f.uniqueEmbeds[f.graph]||{},I.embed==="@link"&&j in $){_(L,T,$[j]);continue}const N={"@id":j};if(j.indexOf("_:")===0&&i.addValue(f.bnodeMap,j,N,{propertyIsArray:!0}),$[j]=N,(I.embed==="@first"||I.embed==="@last")&&f.is11)throw new o("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:R});if(!(!f.embedded&&f.uniqueEmbeds[f.graph].hasOwnProperty(j))){if(f.embedded&&(I.embed==="@never"||c(te,f.graph,f.subjectStack))){_(L,T,N);continue}if(f.embedded&&(I.embed=="@first"||I.embed=="@once")&&f.uniqueEmbeds[f.graph].hasOwnProperty(j)){_(L,T,N);continue}if(I.embed==="@last"&&j in f.uniqueEmbeds[f.graph]&&k(f,j),f.uniqueEmbeds[f.graph][j]={parent:L,property:T},f.subjectStack.push({subject:te,graph:f.graph}),j in f.graphMap){let Z=!1,F=null;"@graph"in R?(F=R["@graph"][0],Z=!(j==="@merged"||j==="@default"),t.isObject(F)||(F={})):(Z=f.graph!=="@merged",F={}),Z&&d.frame({...f,graph:j,embedded:!1},Object.keys(f.graphMap[j]).sort(),[F],N,"@graph")}"@included"in R&&d.frame({...f,embedded:!1},b,R["@included"],N,"@included");for(const Z of Object.keys(te).sort()){if(r(Z)){if(N[Z]=i.clone(te[Z]),Z==="@type")for(const F of te["@type"])F.indexOf("_:")===0&&i.addValue(f.bnodeMap,F,N,{propertyIsArray:!0});continue}if(!(I.explicit&&!(Z in R)))for(const F of te[Z]){const Y=Z in R?R[Z]:l(I);if(e.isList(F)){const w=R[Z]&&R[Z][0]&&R[Z][0]["@list"]?R[Z][0]["@list"]:l(I),U={"@list":[]};_(N,Z,U);const K=F["@list"];for(const X of K)e.isSubjectReference(X)?d.frame({...f,embedded:!0},[X["@id"]],w,U,"@list"):_(U,"@list",i.clone(X))}else e.isSubjectReference(F)?d.frame({...f,embedded:!0},[F["@id"]],Y,N,Z):m(Y[0],F)&&_(N,Z,i.clone(F))}}for(const Z of Object.keys(R).sort()){if(Z==="@type"){if(!t.isObject(R[Z][0])||!("@default"in R[Z][0]))continue}else if(r(Z))continue;const F=R[Z][0]||{};if(!u(F,B,"omitDefault")&&!(Z in N)){let w="@null";"@default"in F&&(w=i.clone(F["@default"])),t.isArray(w)||(w=[w]),N[Z]=[{"@preserve":w}]}}for(const Z of Object.keys(R["@reverse"]||{}).sort()){const F=R["@reverse"][Z];for(const Y of Object.keys(f.subjects))i.getValues(f.subjects[Y],Z).some(U=>U["@id"]===j)&&(N["@reverse"]=N["@reverse"]||{},i.addValue(N["@reverse"],Z,[],{propertyIsArray:!0}),d.frame({...f,embedded:!0},[Y],F,N["@reverse"][Z],T))}_(L,T,N),f.subjectStack.pop()}}},d.cleanupNull=(f,b)=>{if(t.isArray(f))return f.map(L=>d.cleanupNull(L,b)).filter(L=>L);if(f==="@null")return null;if(t.isObject(f)){if("@id"in f){const R=f["@id"];if(b.link.hasOwnProperty(R)){const L=b.link[R].indexOf(f);if(L!==-1)return b.link[R][L];b.link[R].push(f)}else b.link[R]=[f]}for(const R in f)f[R]=d.cleanupNull(f[R],b)}return f};function l(f){const b={};for(const R in f)f[R]!==void 0&&(b["@"+R]=[f[R]]);return[b]}function c(f,b,R){for(let L=R.length-1;L>=0;--L){const T=R[L];if(T.graph===b&&T.subject["@id"]===f["@id"])return!0}return!1}function u(f,b,R){const L="@"+R;let T=L in f?f[L][0]:b[R];if(R==="embed"){if(T===!0)T="@once";else if(T===!1)T="@never";else if(T!=="@always"&&T!=="@never"&&T!=="@link"&&T!=="@first"&&T!=="@last"&&T!=="@once")throw new o("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:f})}return T}function v(f){if(!t.isArray(f)||f.length!==1||!t.isObject(f[0]))throw new o("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:f});if("@id"in f[0]){for(const b of i.asArray(f[0]["@id"]))if(!(t.isObject(b)||n.isAbsolute(b))||t.isString(b)&&b.indexOf("_:")===0)throw new o("Invalid JSON-LD syntax; invalid @id in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:f})}if("@type"in f[0]){for(const b of i.asArray(f[0]["@type"]))if(!(t.isObject(b)||n.isAbsolute(b)||b==="@json")||t.isString(b)&&b.indexOf("_:")===0)throw new o("Invalid JSON-LD syntax; invalid @type in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:f})}}function g(f,b,R,L){const T={};for(const B of b){const I=f.graphMap[f.graph][B];y(f,I,R,L)&&(T[B]=I)}return T}function y(f,b,R,L){let T=!0,B=!1;for(const I in R){let $=!1;const q=i.getValues(b,I),A=i.getValues(R,I).length===0;if(I==="@id"){if(t.isEmptyObject(R["@id"][0]||{})?$=!0:R["@id"].length>=0&&($=R["@id"].includes(q[0])),!L.requireAll)return $}else if(I==="@type"){if(T=!1,A){if(q.length>0)return!1;$=!0}else if(R["@type"].length===1&&t.isEmptyObject(R["@type"][0]))$=q.length>0;else for(const j of R["@type"])t.isObject(j)&&"@default"in j?$=!0:$=$||q.some(te=>te===j);if(!L.requireAll)return $}else{if(r(I))continue;{const j=i.getValues(R,I)[0];let te=!1;if(j&&(v([j]),te="@default"in j),T=!1,q.length===0&&te)continue;if(q.length>0&&A)return!1;if(j===void 0){if(q.length>0)return!1;$=!0}else if(e.isList(j)){const N=j["@list"][0];if(e.isList(q[0])){const Z=q[0]["@list"];e.isValue(N)?$=Z.some(F=>m(N,F)):(e.isSubject(N)||e.isSubjectReference(N))&&($=Z.some(F=>E(f,N,F,L)))}}else e.isValue(j)?$=q.some(N=>m(j,N)):e.isSubjectReference(j)?$=q.some(N=>E(f,j,N,L)):t.isObject(j)?$=q.length>0:$=!1}}if(!$&&L.requireAll)return!1;B=B||$}return T||B}function k(f,b){const R=f.uniqueEmbeds[f.graph],L=R[b],T=L.parent,B=L.property,I={"@id":b};if(t.isArray(T)){for(let q=0;q<T.length;++q)if(i.compareValues(T[q],I)){T[q]=I;break}}else{const q=t.isArray(T[B]);i.removeValue(T,B,I,{propertyIsArray:q}),i.addValue(T,B,I,{propertyIsArray:q})}const $=q=>{const A=Object.keys(R);for(const j of A)j in R&&t.isObject(R[j].parent)&&R[j].parent["@id"]===q&&(delete R[j],$(j))};$(b)}/**
|
|
326
326
|
* Removes the @preserve keywords from expanded result of framing.
|
|
327
327
|
*
|
|
328
328
|
* @param input the framed, framed output.
|
|
@@ -330,7 +330,7 @@ return R.link={},x(B,R)},d.frame=(f,b,R,L,T=null)=>{v(R),R=R[0];const B=f.option
|
|
|
330
330
|
*
|
|
331
331
|
* @return the resulting output.
|
|
332
332
|
*/function x(f,b){if(t.isArray(f))return f.map(R=>x(R,b));if(t.isObject(f)){// remove @preserve
|
|
333
|
-
if("@preserve"in f)return f["@preserve"][0];if(e.isValue(f))return f;if(e.isList(f))return f["@list"]=x(f["@list"],b),f;if("@id"in f){const R=f["@id"];if(b.link.hasOwnProperty(R)){const L=b.link[R].indexOf(f);if(L!==-1)return b.link[R][L];b.link[R].push(f)}else b.link[R]=[f]}for(const R in f){if(R==="@id"&&b.bnodesToClear.includes(f[R])){delete f["@id"];continue}f[R]=x(f[R],b)}}return f}function _(f,b,R){t.isObject(f)?i.addValue(f,b,R,{propertyIsArray:!0}):f.push(R)}function E(f,b,R,L){if(!("@id"in R))return!1;const T=f.subjects[R["@id"]];return T&&y(f,T,b,L)}function m(f,b){const R=b["@value"],L=b["@type"],T=b["@language"],B=f["@value"]?t.isArray(f["@value"])?f["@value"]:[f["@value"]]:[],N=f["@type"]?t.isArray(f["@type"])?f["@type"]:[f["@type"]]:[],$=f["@language"]?t.isArray(f["@language"])?f["@language"]:[f["@language"]]:[];return B.length===0&&N.length===0&&$.length===0?!0:!(!(B.includes(R)||t.isEmptyObject(B[0]))||!(!L&&N.length===0||N.includes(L)||L&&t.isEmptyObject(N[0]))||!(!T&&$.length===0||$.includes(T)||T&&t.isEmptyObject($[0])))}return Lo}var Oo,nd;function Mp(){if(nd)return Oo;nd=1;const r=pt(),{isArray:e,isObject:t,isString:i,isUndefined:n}=lt(),{isList:o,isValue:a,isGraph:s,isSimpleGraph:d,isSubjectReference:l}=$t(),{expandIri:c,getContextValue:u,isKeyword:v,process:g,processingMode:y}=dr(),{removeBase:k,prependBase:x}=Xt(),{REGEX_KEYWORD:_,addValue:E,asArray:m,compareShortestLeast:f}=ct(),b={};Oo=b,b.compact=async({activeCtx:T,activeProperty:B=null,element:N,options:$={}})=>{if(e(N)){let A=[];for(let j=0;j<N.length;++j){const te=await b.compact({activeCtx:T,activeProperty:B,element:N[j],options:$});te!==null&&A.push(te)}return $.compactArrays&&A.length===1&&(u(T,B,"@container")||[]).length===0&&(A=A[0]),A}const q=u(T,B,"@context");if(n(q)||(T=await g({activeCtx:T,localCtx:q,propagate:!0,overrideProtected:!0,options:$})),t(N)){if($.link&&"@id"in N&&$.link.hasOwnProperty(N["@id"])){const w=$.link[N["@id"]];for(let U=0;U<w.length;++U)if(w[U].expanded===N)return w[U].compacted}if(a(N)||l(N)){const w=b.compactValue({activeCtx:T,activeProperty:B,value:N,options:$});return $.link&&l(N)&&($.link.hasOwnProperty(N["@id"])||($.link[N["@id"]]=[]),$.link[N["@id"]].push({expanded:N,compacted:w})),w}if(o(N)&&(u(T,B,"@container")||[]).includes("@list"))return b.compact({activeCtx:T,activeProperty:B,element:N["@list"],options:$});const A=B==="@reverse",j={},te=T;!a(N)&&!l(N)&&(T=T.revertToPreviousContext());const I=u(te,B,"@context");n(I)||(T=await g({activeCtx:T,localCtx:I,propagate:!0,overrideProtected:!0,options:$})),$.link&&"@id"in N&&($.link.hasOwnProperty(N["@id"])||($.link[N["@id"]]=[]),$.link[N["@id"]].push({expanded:N,compacted:j}));let Z=N["@type"]||[];Z.length>1&&(Z=Array.from(Z).sort());const F=T;for(const w of Z){const U=b.compactIri({activeCtx:F,iri:w,relativeTo:{vocab:!0}}),K=u(te,U,"@context");n(K)||(T=await g({activeCtx:T,localCtx:K,options:$,propagate:!1}))}const Y=Object.keys(N).sort();for(const w of Y){const U=N[w];if(w==="@id"){let K=m(U).map(de=>b.compactIri({activeCtx:T,iri:de,relativeTo:{vocab:!1},base:$.base}));K.length===1&&(K=K[0]);const X=b.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}});j[X]=K;continue}if(w==="@type"){let K=m(U).map(W=>b.compactIri({activeCtx:te,iri:W,relativeTo:{vocab:!0}}));K.length===1&&(K=K[0]);const X=b.compactIri({activeCtx:T,iri:"@type",relativeTo:{vocab:!0}}),G=(u(T,X,"@container")||[]).includes("@set")&&y(T,1.1)||e(K)&&U.length===0;E(j,X,K,{propertyIsArray:G});continue}if(w==="@reverse"){const K=await b.compact({activeCtx:T,activeProperty:"@reverse",element:U,options:$});for(const X in K)if(T.mappings.has(X)&&T.mappings.get(X).reverse){const de=K[X],G=(u(T,X,"@container")||[]).includes("@set")||!$.compactArrays;E(j,X,de,{propertyIsArray:G}),delete K[X]}if(Object.keys(K).length>0){const X=b.compactIri({activeCtx:T,iri:w,relativeTo:{vocab:!0}});E(j,X,K)}continue}if(w==="@preserve"){const K=await b.compact({activeCtx:T,activeProperty:B,element:U,options:$});e(K)&&K.length===0||E(j,w,K);continue}if(w==="@index"){if((u(T,B,"@container")||[]).includes("@index"))continue;const X=b.compactIri({activeCtx:T,iri:w,relativeTo:{vocab:!0}});E(j,X,U);continue}if(w!=="@graph"&&w!=="@list"&&w!=="@included"&&v(w)){const K=b.compactIri({activeCtx:T,iri:w,relativeTo:{vocab:!0}});E(j,K,U);continue}if(!e(U))throw new r("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(U.length===0){const K=b.compactIri({activeCtx:T,iri:w,value:U,relativeTo:{vocab:!0},reverse:A}),X=T.mappings.has(K)?T.mappings.get(K)["@nest"]:null;let de=j;X&&(L(T,X,$),t(j[X])||(j[X]={}),de=j[X]),E(de,K,U,{propertyIsArray:!0})}for(const K of U){const X=b.compactIri({activeCtx:T,iri:w,value:K,relativeTo:{vocab:!0},reverse:A}),de=T.mappings.has(X)?T.mappings.get(X)["@nest"]:null;let H=j;de&&(L(T,de,$),t(j[de])||(j[de]={}),H=j[de]);const G=u(T,X,"@container")||[],W=s(K),z=o(K);let ee;z?ee=K["@list"]:W&&(ee=K["@graph"]);let re=await b.compact({activeCtx:T,activeProperty:X,element:z||W?ee:K,options:$});if(z)if(e(re)||(re=[re]),!G.includes("@list"))re={[b.compactIri({activeCtx:T,iri:"@list",relativeTo:{vocab:!0}})]:re},"@index"in K&&(re[b.compactIri({activeCtx:T,iri:"@index",relativeTo:{vocab:!0}})]=K["@index"]);else{E(H,X,re,{valueIsArray:!0,allowDuplicate:!0});continue}if(W)if(G.includes("@graph")&&(G.includes("@id")||G.includes("@index")&&d(K))){let pe;H.hasOwnProperty(X)?pe=H[X]:H[X]=pe={};const be=(G.includes("@id")?K["@id"]:K["@index"])||b.compactIri({activeCtx:T,iri:"@none",relativeTo:{vocab:!0}});E(pe,be,re,{propertyIsArray:!$.compactArrays||G.includes("@set")})}else G.includes("@graph")&&d(K)?(e(re)&&re.length>1&&(re={"@included":re}),E(H,X,re,{propertyIsArray:!$.compactArrays||G.includes("@set")})):(e(re)&&re.length===1&&$.compactArrays&&(re=re[0]),re={[b.compactIri({activeCtx:T,iri:"@graph",relativeTo:{vocab:!0}})]:re},"@id"in K&&(re[b.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}})]=K["@id"]),"@index"in K&&(re[b.compactIri({activeCtx:T,iri:"@index",relativeTo:{vocab:!0}})]=K["@index"]),E(H,X,re,{propertyIsArray:!$.compactArrays||G.includes("@set")}));else if(G.includes("@language")||G.includes("@index")||G.includes("@id")||G.includes("@type")){let pe;H.hasOwnProperty(X)?pe=H[X]:H[X]=pe={};let be;if(G.includes("@language"))a(re)&&(re=re["@value"]),be=K["@language"];else if(G.includes("@index")){const O=u(T,X,"@index")||"@index",V=b.compactIri({activeCtx:T,iri:O,relativeTo:{vocab:!0}});if(O==="@index")be=K["@index"],delete re[V];else{let oe;if([be,...oe]=m(re[O]||[]),!i(be))be=null;else switch(oe.length){case 0:delete re[O];break;case 1:re[O]=oe[0];break;default:re[O]=oe;break}}}else if(G.includes("@id")){const O=b.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}});be=re[O],delete re[O]}else if(G.includes("@type")){const O=b.compactIri({activeCtx:T,iri:"@type",relativeTo:{vocab:!0}});let V;switch([be,...V]=m(re[O]||[]),V.length){case 0:delete re[O];break;case 1:re[O]=V[0];break;default:re[O]=V;break}Object.keys(re).length===1&&"@id"in K&&(re=await b.compact({activeCtx:T,activeProperty:X,element:{"@id":K["@id"]},options:$}))}be||(be=b.compactIri({activeCtx:T,iri:"@none",relativeTo:{vocab:!0}})),E(pe,be,re,{propertyIsArray:G.includes("@set")})}else{const pe=!$.compactArrays||G.includes("@set")||G.includes("@list")||e(re)&&re.length===0||w==="@list"||w==="@graph";E(H,X,re,{propertyIsArray:pe})}}}return j}return N},b.compactIri=({activeCtx:T,iri:B,value:N=null,relativeTo:$={vocab:!1},reverse:q=!1,base:A=null})=>{if(B===null)return B;T.isPropertyTermScoped&&T.previousContext&&(T=T.previousContext);const j=T.getInverse();if(v(B)&&B in j&&"@none"in j[B]&&"@type"in j[B]["@none"]&&"@none"in j[B]["@none"]["@type"])return j[B]["@none"]["@type"]["@none"];if($.vocab&&B in j){const Y=T["@language"]||"@none",w=[];t(N)&&"@index"in N&&!("@graph"in N)&&w.push("@index","@index@set"),t(N)&&"@preserve"in N&&(N=N["@preserve"][0]),s(N)?("@index"in N&&w.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in N&&w.push("@graph@id","@graph@id@set"),w.push("@graph","@graph@set","@set"),"@index"in N||w.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in N||w.push("@graph@id","@graph@id@set")):t(N)&&!a(N)&&w.push("@id","@id@set","@type","@set@type");let U="@language",K="@null";if(q)U="@type",K="@reverse",w.push("@set");else if(o(N)){"@index"in N||w.push("@list");const de=N["@list"];if(de.length===0)U="@any",K="@none";else{let H=de.length===0?Y:null,G=null;for(let W=0;W<de.length;++W){const z=de[W];let ee="@none",re="@none";if(a(z))if("@direction"in z){const pe=(z["@language"]||"").toLowerCase(),be=z["@direction"];ee=`${pe}_${be}`}else"@language"in z?ee=z["@language"].toLowerCase():"@type"in z?re=z["@type"]:ee="@null";else re="@id";if(H===null?H=ee:ee!==H&&a(z)&&(H="@none"),G===null?G=re:re!==G&&(G="@none"),H==="@none"&&G==="@none")break}H=H||"@none",G=G||"@none",G!=="@none"?(U="@type",K=G):K=H}}else{if(a(N))if("@language"in N&&!("@index"in N)){w.push("@language","@language@set"),K=N["@language"];const de=N["@direction"];de&&(K=`${K}_${de}`)}else"@direction"in N&&!("@index"in N)?K=`_${N["@direction"]}`:"@type"in N&&(U="@type",K=N["@type"]);else U="@type",K="@id";w.push("@set")}w.push("@none"),t(N)&&!("@index"in N)&&w.push("@index","@index@set"),a(N)&&Object.keys(N).length===1&&w.push("@language","@language@set");const X=R(T,B,N,w,U,K);if(X!==null)return X}if($.vocab&&"@vocab"in T){const Y=T["@vocab"];if(B.indexOf(Y)===0&&B!==Y){const w=B.substr(Y.length);if(!T.mappings.has(w))return w}}let te=null;const I=[];let Z=T.fastCurieMap;const F=B.length-1;for(let Y=0;Y<F&&B[Y]in Z;++Y)Z=Z[B[Y]],""in Z&&I.push(Z[""][0]);for(let Y=I.length-1;Y>=0;--Y){const w=I[Y],U=w.terms;for(const K of U){const X=K+":"+B.substr(w.iri.length);T.mappings.get(K)._prefix&&(!T.mappings.has(X)||N===null&&T.mappings.get(X)["@id"]===B)&&(te===null||f(X,te)<0)&&(te=X)}}if(te!==null)return te;for(const[Y,w]of T.mappings)if(w&&w._prefix&&B.startsWith(Y+":"))throw new r(`Absolute IRI "${B}" confused with prefix "${Y}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:T});if(!$.vocab)if("@base"in T)if(T["@base"]){const Y=k(x(A,T["@base"]),B);return _.test(Y)?`./${Y}`:Y}else return B;else return k(A,B);return B},b.compactValue=({activeCtx:T,activeProperty:B,value:N,options:$})=>{if(a(N)){const te=u(T,B,"@type"),I=u(T,B,"@language"),Z=u(T,B,"@direction"),F=u(T,B,"@container")||[],Y="@index"in N&&!F.includes("@index");if(!Y&&te!=="@none"&&(N["@type"]===te||"@language"in N&&N["@language"]===I&&"@direction"in N&&N["@direction"]===Z||"@language"in N&&N["@language"]===I||"@direction"in N&&N["@direction"]===Z))return N["@value"];const w=Object.keys(N).length,U=w===1||w===2&&"@index"in N&&!Y,K="@language"in T,X=i(N["@value"]),de=T.mappings.has(B)&&T.mappings.get(B)["@language"]===null;if(U&&te!=="@none"&&(!K||!X||de))return N["@value"];const H={};return Y&&(H[b.compactIri({activeCtx:T,iri:"@index",relativeTo:{vocab:!0}})]=N["@index"]),"@type"in N?H[b.compactIri({activeCtx:T,iri:"@type",relativeTo:{vocab:!0}})]=b.compactIri({activeCtx:T,iri:N["@type"],relativeTo:{vocab:!0}}):"@language"in N&&(H[b.compactIri({activeCtx:T,iri:"@language",relativeTo:{vocab:!0}})]=N["@language"]),"@direction"in N&&(H[b.compactIri({activeCtx:T,iri:"@direction",relativeTo:{vocab:!0}})]=N["@direction"]),H[b.compactIri({activeCtx:T,iri:"@value",relativeTo:{vocab:!0}})]=N["@value"],H}const q=c(T,B,{vocab:!0},$),A=u(T,B,"@type"),j=b.compactIri({activeCtx:T,iri:N["@id"],relativeTo:{vocab:A==="@vocab"},base:$.base});return A==="@id"||A==="@vocab"||q==="@graph"?j:{[b.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}})]:j}};function R(T,B,N,$,q,A){A===null&&(A="@null");const j=[];if((A==="@id"||A==="@reverse")&&t(N)&&"@id"in N){A==="@reverse"&&j.push("@reverse");const I=b.compactIri({activeCtx:T,iri:N["@id"],relativeTo:{vocab:!0}});T.mappings.has(I)&&T.mappings.get(I)&&T.mappings.get(I)["@id"]===N["@id"]?j.push.apply(j,["@vocab","@id"]):j.push.apply(j,["@id","@vocab"])}else{j.push(A);const I=j.find(Z=>Z.includes("_"));I&&j.push(I.replace(/^[^_]+_/,"_"))}j.push("@none");const te=T.inverse[B];for(const I of $){if(!(I in te))continue;const Z=te[I][q];for(const F of j)if(F in Z)return Z[F]}return null}function L(T,B,N){if(c(T,B,{vocab:!0},N)!=="@nest")throw new r("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}return Oo}var Co,od;function Bp(){return od||(od=1,Co=r=>{class e{toString(){return"[object JsonLdProcessor]"}}return Object.defineProperty(e,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(e.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:e}),e.compact=function(t,i){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):r.compact(t,i)},e.expand=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):r.expand(t)},e.flatten=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):r.flatten(t)},e}),Co}/**
|
|
333
|
+
if("@preserve"in f)return f["@preserve"][0];if(e.isValue(f))return f;if(e.isList(f))return f["@list"]=x(f["@list"],b),f;if("@id"in f){const R=f["@id"];if(b.link.hasOwnProperty(R)){const L=b.link[R].indexOf(f);if(L!==-1)return b.link[R][L];b.link[R].push(f)}else b.link[R]=[f]}for(const R in f){if(R==="@id"&&b.bnodesToClear.includes(f[R])){delete f["@id"];continue}f[R]=x(f[R],b)}}return f}function _(f,b,R){t.isObject(f)?i.addValue(f,b,R,{propertyIsArray:!0}):f.push(R)}function E(f,b,R,L){if(!("@id"in R))return!1;const T=f.subjects[R["@id"]];return T&&y(f,T,b,L)}function m(f,b){const R=b["@value"],L=b["@type"],T=b["@language"],B=f["@value"]?t.isArray(f["@value"])?f["@value"]:[f["@value"]]:[],I=f["@type"]?t.isArray(f["@type"])?f["@type"]:[f["@type"]]:[],$=f["@language"]?t.isArray(f["@language"])?f["@language"]:[f["@language"]]:[];return B.length===0&&I.length===0&&$.length===0?!0:!(!(B.includes(R)||t.isEmptyObject(B[0]))||!(!L&&I.length===0||I.includes(L)||L&&t.isEmptyObject(I[0]))||!(!T&&$.length===0||$.includes(T)||T&&t.isEmptyObject($[0])))}return Lo}var Oo,nd;function Mp(){if(nd)return Oo;nd=1;const r=pt(),{isArray:e,isObject:t,isString:i,isUndefined:n}=lt(),{isList:o,isValue:a,isGraph:s,isSimpleGraph:d,isSubjectReference:l}=$t(),{expandIri:c,getContextValue:u,isKeyword:v,process:g,processingMode:y}=dr(),{removeBase:k,prependBase:x}=Xt(),{REGEX_KEYWORD:_,addValue:E,asArray:m,compareShortestLeast:f}=ct(),b={};Oo=b,b.compact=async({activeCtx:T,activeProperty:B=null,element:I,options:$={}})=>{if(e(I)){let A=[];for(let j=0;j<I.length;++j){const te=await b.compact({activeCtx:T,activeProperty:B,element:I[j],options:$});te!==null&&A.push(te)}return $.compactArrays&&A.length===1&&(u(T,B,"@container")||[]).length===0&&(A=A[0]),A}const q=u(T,B,"@context");if(n(q)||(T=await g({activeCtx:T,localCtx:q,propagate:!0,overrideProtected:!0,options:$})),t(I)){if($.link&&"@id"in I&&$.link.hasOwnProperty(I["@id"])){const w=$.link[I["@id"]];for(let U=0;U<w.length;++U)if(w[U].expanded===I)return w[U].compacted}if(a(I)||l(I)){const w=b.compactValue({activeCtx:T,activeProperty:B,value:I,options:$});return $.link&&l(I)&&($.link.hasOwnProperty(I["@id"])||($.link[I["@id"]]=[]),$.link[I["@id"]].push({expanded:I,compacted:w})),w}if(o(I)&&(u(T,B,"@container")||[]).includes("@list"))return b.compact({activeCtx:T,activeProperty:B,element:I["@list"],options:$});const A=B==="@reverse",j={},te=T;!a(I)&&!l(I)&&(T=T.revertToPreviousContext());const N=u(te,B,"@context");n(N)||(T=await g({activeCtx:T,localCtx:N,propagate:!0,overrideProtected:!0,options:$})),$.link&&"@id"in I&&($.link.hasOwnProperty(I["@id"])||($.link[I["@id"]]=[]),$.link[I["@id"]].push({expanded:I,compacted:j}));let Z=I["@type"]||[];Z.length>1&&(Z=Array.from(Z).sort());const F=T;for(const w of Z){const U=b.compactIri({activeCtx:F,iri:w,relativeTo:{vocab:!0}}),K=u(te,U,"@context");n(K)||(T=await g({activeCtx:T,localCtx:K,options:$,propagate:!1}))}const Y=Object.keys(I).sort();for(const w of Y){const U=I[w];if(w==="@id"){let K=m(U).map(de=>b.compactIri({activeCtx:T,iri:de,relativeTo:{vocab:!1},base:$.base}));K.length===1&&(K=K[0]);const X=b.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}});j[X]=K;continue}if(w==="@type"){let K=m(U).map(W=>b.compactIri({activeCtx:te,iri:W,relativeTo:{vocab:!0}}));K.length===1&&(K=K[0]);const X=b.compactIri({activeCtx:T,iri:"@type",relativeTo:{vocab:!0}}),G=(u(T,X,"@container")||[]).includes("@set")&&y(T,1.1)||e(K)&&U.length===0;E(j,X,K,{propertyIsArray:G});continue}if(w==="@reverse"){const K=await b.compact({activeCtx:T,activeProperty:"@reverse",element:U,options:$});for(const X in K)if(T.mappings.has(X)&&T.mappings.get(X).reverse){const de=K[X],G=(u(T,X,"@container")||[]).includes("@set")||!$.compactArrays;E(j,X,de,{propertyIsArray:G}),delete K[X]}if(Object.keys(K).length>0){const X=b.compactIri({activeCtx:T,iri:w,relativeTo:{vocab:!0}});E(j,X,K)}continue}if(w==="@preserve"){const K=await b.compact({activeCtx:T,activeProperty:B,element:U,options:$});e(K)&&K.length===0||E(j,w,K);continue}if(w==="@index"){if((u(T,B,"@container")||[]).includes("@index"))continue;const X=b.compactIri({activeCtx:T,iri:w,relativeTo:{vocab:!0}});E(j,X,U);continue}if(w!=="@graph"&&w!=="@list"&&w!=="@included"&&v(w)){const K=b.compactIri({activeCtx:T,iri:w,relativeTo:{vocab:!0}});E(j,K,U);continue}if(!e(U))throw new r("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(U.length===0){const K=b.compactIri({activeCtx:T,iri:w,value:U,relativeTo:{vocab:!0},reverse:A}),X=T.mappings.has(K)?T.mappings.get(K)["@nest"]:null;let de=j;X&&(L(T,X,$),t(j[X])||(j[X]={}),de=j[X]),E(de,K,U,{propertyIsArray:!0})}for(const K of U){const X=b.compactIri({activeCtx:T,iri:w,value:K,relativeTo:{vocab:!0},reverse:A}),de=T.mappings.has(X)?T.mappings.get(X)["@nest"]:null;let H=j;de&&(L(T,de,$),t(j[de])||(j[de]={}),H=j[de]);const G=u(T,X,"@container")||[],W=s(K),z=o(K);let ee;z?ee=K["@list"]:W&&(ee=K["@graph"]);let re=await b.compact({activeCtx:T,activeProperty:X,element:z||W?ee:K,options:$});if(z)if(e(re)||(re=[re]),!G.includes("@list"))re={[b.compactIri({activeCtx:T,iri:"@list",relativeTo:{vocab:!0}})]:re},"@index"in K&&(re[b.compactIri({activeCtx:T,iri:"@index",relativeTo:{vocab:!0}})]=K["@index"]);else{E(H,X,re,{valueIsArray:!0,allowDuplicate:!0});continue}if(W)if(G.includes("@graph")&&(G.includes("@id")||G.includes("@index")&&d(K))){let pe;H.hasOwnProperty(X)?pe=H[X]:H[X]=pe={};const be=(G.includes("@id")?K["@id"]:K["@index"])||b.compactIri({activeCtx:T,iri:"@none",relativeTo:{vocab:!0}});E(pe,be,re,{propertyIsArray:!$.compactArrays||G.includes("@set")})}else G.includes("@graph")&&d(K)?(e(re)&&re.length>1&&(re={"@included":re}),E(H,X,re,{propertyIsArray:!$.compactArrays||G.includes("@set")})):(e(re)&&re.length===1&&$.compactArrays&&(re=re[0]),re={[b.compactIri({activeCtx:T,iri:"@graph",relativeTo:{vocab:!0}})]:re},"@id"in K&&(re[b.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}})]=K["@id"]),"@index"in K&&(re[b.compactIri({activeCtx:T,iri:"@index",relativeTo:{vocab:!0}})]=K["@index"]),E(H,X,re,{propertyIsArray:!$.compactArrays||G.includes("@set")}));else if(G.includes("@language")||G.includes("@index")||G.includes("@id")||G.includes("@type")){let pe;H.hasOwnProperty(X)?pe=H[X]:H[X]=pe={};let be;if(G.includes("@language"))a(re)&&(re=re["@value"]),be=K["@language"];else if(G.includes("@index")){const O=u(T,X,"@index")||"@index",V=b.compactIri({activeCtx:T,iri:O,relativeTo:{vocab:!0}});if(O==="@index")be=K["@index"],delete re[V];else{let oe;if([be,...oe]=m(re[O]||[]),!i(be))be=null;else switch(oe.length){case 0:delete re[O];break;case 1:re[O]=oe[0];break;default:re[O]=oe;break}}}else if(G.includes("@id")){const O=b.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}});be=re[O],delete re[O]}else if(G.includes("@type")){const O=b.compactIri({activeCtx:T,iri:"@type",relativeTo:{vocab:!0}});let V;switch([be,...V]=m(re[O]||[]),V.length){case 0:delete re[O];break;case 1:re[O]=V[0];break;default:re[O]=V;break}Object.keys(re).length===1&&"@id"in K&&(re=await b.compact({activeCtx:T,activeProperty:X,element:{"@id":K["@id"]},options:$}))}be||(be=b.compactIri({activeCtx:T,iri:"@none",relativeTo:{vocab:!0}})),E(pe,be,re,{propertyIsArray:G.includes("@set")})}else{const pe=!$.compactArrays||G.includes("@set")||G.includes("@list")||e(re)&&re.length===0||w==="@list"||w==="@graph";E(H,X,re,{propertyIsArray:pe})}}}return j}return I},b.compactIri=({activeCtx:T,iri:B,value:I=null,relativeTo:$={vocab:!1},reverse:q=!1,base:A=null})=>{if(B===null)return B;T.isPropertyTermScoped&&T.previousContext&&(T=T.previousContext);const j=T.getInverse();if(v(B)&&B in j&&"@none"in j[B]&&"@type"in j[B]["@none"]&&"@none"in j[B]["@none"]["@type"])return j[B]["@none"]["@type"]["@none"];if($.vocab&&B in j){const Y=T["@language"]||"@none",w=[];t(I)&&"@index"in I&&!("@graph"in I)&&w.push("@index","@index@set"),t(I)&&"@preserve"in I&&(I=I["@preserve"][0]),s(I)?("@index"in I&&w.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in I&&w.push("@graph@id","@graph@id@set"),w.push("@graph","@graph@set","@set"),"@index"in I||w.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in I||w.push("@graph@id","@graph@id@set")):t(I)&&!a(I)&&w.push("@id","@id@set","@type","@set@type");let U="@language",K="@null";if(q)U="@type",K="@reverse",w.push("@set");else if(o(I)){"@index"in I||w.push("@list");const de=I["@list"];if(de.length===0)U="@any",K="@none";else{let H=de.length===0?Y:null,G=null;for(let W=0;W<de.length;++W){const z=de[W];let ee="@none",re="@none";if(a(z))if("@direction"in z){const pe=(z["@language"]||"").toLowerCase(),be=z["@direction"];ee=`${pe}_${be}`}else"@language"in z?ee=z["@language"].toLowerCase():"@type"in z?re=z["@type"]:ee="@null";else re="@id";if(H===null?H=ee:ee!==H&&a(z)&&(H="@none"),G===null?G=re:re!==G&&(G="@none"),H==="@none"&&G==="@none")break}H=H||"@none",G=G||"@none",G!=="@none"?(U="@type",K=G):K=H}}else{if(a(I))if("@language"in I&&!("@index"in I)){w.push("@language","@language@set"),K=I["@language"];const de=I["@direction"];de&&(K=`${K}_${de}`)}else"@direction"in I&&!("@index"in I)?K=`_${I["@direction"]}`:"@type"in I&&(U="@type",K=I["@type"]);else U="@type",K="@id";w.push("@set")}w.push("@none"),t(I)&&!("@index"in I)&&w.push("@index","@index@set"),a(I)&&Object.keys(I).length===1&&w.push("@language","@language@set");const X=R(T,B,I,w,U,K);if(X!==null)return X}if($.vocab&&"@vocab"in T){const Y=T["@vocab"];if(B.indexOf(Y)===0&&B!==Y){const w=B.substr(Y.length);if(!T.mappings.has(w))return w}}let te=null;const N=[];let Z=T.fastCurieMap;const F=B.length-1;for(let Y=0;Y<F&&B[Y]in Z;++Y)Z=Z[B[Y]],""in Z&&N.push(Z[""][0]);for(let Y=N.length-1;Y>=0;--Y){const w=N[Y],U=w.terms;for(const K of U){const X=K+":"+B.substr(w.iri.length);T.mappings.get(K)._prefix&&(!T.mappings.has(X)||I===null&&T.mappings.get(X)["@id"]===B)&&(te===null||f(X,te)<0)&&(te=X)}}if(te!==null)return te;for(const[Y,w]of T.mappings)if(w&&w._prefix&&B.startsWith(Y+":"))throw new r(`Absolute IRI "${B}" confused with prefix "${Y}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:T});if(!$.vocab)if("@base"in T)if(T["@base"]){const Y=k(x(A,T["@base"]),B);return _.test(Y)?`./${Y}`:Y}else return B;else return k(A,B);return B},b.compactValue=({activeCtx:T,activeProperty:B,value:I,options:$})=>{if(a(I)){const te=u(T,B,"@type"),N=u(T,B,"@language"),Z=u(T,B,"@direction"),F=u(T,B,"@container")||[],Y="@index"in I&&!F.includes("@index");if(!Y&&te!=="@none"&&(I["@type"]===te||"@language"in I&&I["@language"]===N&&"@direction"in I&&I["@direction"]===Z||"@language"in I&&I["@language"]===N||"@direction"in I&&I["@direction"]===Z))return I["@value"];const w=Object.keys(I).length,U=w===1||w===2&&"@index"in I&&!Y,K="@language"in T,X=i(I["@value"]),de=T.mappings.has(B)&&T.mappings.get(B)["@language"]===null;if(U&&te!=="@none"&&(!K||!X||de))return I["@value"];const H={};return Y&&(H[b.compactIri({activeCtx:T,iri:"@index",relativeTo:{vocab:!0}})]=I["@index"]),"@type"in I?H[b.compactIri({activeCtx:T,iri:"@type",relativeTo:{vocab:!0}})]=b.compactIri({activeCtx:T,iri:I["@type"],relativeTo:{vocab:!0}}):"@language"in I&&(H[b.compactIri({activeCtx:T,iri:"@language",relativeTo:{vocab:!0}})]=I["@language"]),"@direction"in I&&(H[b.compactIri({activeCtx:T,iri:"@direction",relativeTo:{vocab:!0}})]=I["@direction"]),H[b.compactIri({activeCtx:T,iri:"@value",relativeTo:{vocab:!0}})]=I["@value"],H}const q=c(T,B,{vocab:!0},$),A=u(T,B,"@type"),j=b.compactIri({activeCtx:T,iri:I["@id"],relativeTo:{vocab:A==="@vocab"},base:$.base});return A==="@id"||A==="@vocab"||q==="@graph"?j:{[b.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}})]:j}};function R(T,B,I,$,q,A){A===null&&(A="@null");const j=[];if((A==="@id"||A==="@reverse")&&t(I)&&"@id"in I){A==="@reverse"&&j.push("@reverse");const N=b.compactIri({activeCtx:T,iri:I["@id"],relativeTo:{vocab:!0}});T.mappings.has(N)&&T.mappings.get(N)&&T.mappings.get(N)["@id"]===I["@id"]?j.push.apply(j,["@vocab","@id"]):j.push.apply(j,["@id","@vocab"])}else{j.push(A);const N=j.find(Z=>Z.includes("_"));N&&j.push(N.replace(/^[^_]+_/,"_"))}j.push("@none");const te=T.inverse[B];for(const N of $){if(!(N in te))continue;const Z=te[N][q];for(const F of j)if(F in Z)return Z[F]}return null}function L(T,B,I){if(c(T,B,{vocab:!0},I)!=="@nest")throw new r("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}return Oo}var Co,od;function Bp(){return od||(od=1,Co=r=>{class e{toString(){return"[object JsonLdProcessor]"}}return Object.defineProperty(e,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(e.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:e}),e.compact=function(t,i){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):r.compact(t,i)},e.expand=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):r.expand(t)},e.flatten=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):r.flatten(t)},e}),Co}/**
|
|
334
334
|
* A JavaScript implementation of the JSON-LD API.
|
|
335
335
|
*
|
|
336
336
|
* @author Dave Longley
|
|
@@ -364,16 +364,16 @@ if("@preserve"in f)return f["@preserve"][0];if(e.isValue(f))return f;if(e.isList
|
|
|
364
364
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
365
365
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
366
366
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
367
|
-
*/var $o,ad;function qp(){if(ad)return $o;ad=1;const r=Ma(),e=Np(),t=ct(),i=jp(),n=t.IdentifierIssuer,o=pt(),a=Uc(),s=Dp(),{expand:d}=Lp(),{flatten:l}=Op(),{fromRDF:c}=Cp(),{toRDF:u}=Fp(),{frameMergedOrDefault:v,cleanupNull:g}=Pp(),{isArray:y,isObject:k,isString:x}=lt(),{isSubjectReference:_}=$t(),{expandIri:E,getInitialContext:m,process:f,processingMode:b}=dr(),{compact:R,compactIri:L}=Mp(),{createNodeMap:T,createMergedNodeMap:B,mergeNodeMaps:N}=hn(),{logEventHandler:$,logWarningEventHandler:q,safeEventHandler:A,setDefaultEventHandler:j,setupEventHandler:te,strictEventHandler:I,unhandledEventHandler:Z}=Ri(),F=function(w){const U={},X=new a({max:100});w.compact=async function(H,G,W){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(G===null)throw new o("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(H===null)return null;W=de(W,{base:x(H)?H:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new n("_:b"),contextResolver:new i({sharedCache:X})}),W.link&&(W.skipExpansion=!0),W.compactToRelative||delete W.base;let z;W.skipExpansion?z=H:z=await w.expand(H,W);const ee=await w.processContext(m(W),G,W);let re=await R({activeCtx:ee,element:z,options:W});W.compactArrays&&!W.graph&&y(re)?re.length===1?re=re[0]:re.length===0&&(re={}):W.graph&&k(re)&&(re=[re]),k(G)&&"@context"in G&&(G=G["@context"]),G=t.clone(G),y(G)||(G=[G]);const pe=G;G=[];for(let O=0;O<pe.length;++O)(!k(pe[O])||Object.keys(pe[O]).length>0)&&G.push(pe[O]);const be=G.length>0;if(G.length===1&&(G=G[0]),y(re)){const O=L({activeCtx:ee,iri:"@graph",relativeTo:{vocab:!0}}),V=re;re={},be&&(re["@context"]=G),re[O]=V}else if(k(re)&&be){const O=re;re={"@context":G};for(const V in O)re[V]=O[V]}return re},w.expand=async function(H,G){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");G=de(G,{keepFreeFloatingNodes:!1,contextResolver:new i({sharedCache:X})});const W={},z=[];if("expandContext"in G){const be=t.clone(G.expandContext);k(be)&&"@context"in be?W.expandContext=be:W.expandContext={"@context":be},z.push(W.expandContext)}let ee;if(!x(H))W.input=t.clone(H);else{const be=await w.get(H,G);ee=be.documentUrl,W.input=be.document,be.contextUrl&&(W.remoteContext={"@context":be.contextUrl},z.push(W.remoteContext))}"base"in G||(G.base=ee||"");let re=m(G);for(const be of z)re=await f({activeCtx:re,localCtx:be,options:G});let pe=await d({activeCtx:re,element:W.input,options:G});return k(pe)&&"@graph"in pe&&Object.keys(pe).length===1?pe=pe["@graph"]:pe===null&&(pe=[]),y(pe)||(pe=[pe]),pe},w.flatten=async function(H,G,W){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");typeof G=="function"?G=null:G=G||null,W=de(W,{base:x(H)?H:"",contextResolver:new i({sharedCache:X})});const z=await w.expand(H,W),ee=l(z);return G===null?ee:(W.graph=!0,W.skipExpansion=!0,await w.compact(ee,G,W))},w.frame=async function(H,G,W){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(W=de(W,{base:x(H)?H:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new i({sharedCache:X})}),x(G)){const fe=await w.get(G,W);if(G=fe.document,fe.contextUrl){let he=G["@context"];he?y(he)?he.push(fe.contextUrl):he=[he,fe.contextUrl]:he=fe.contextUrl,G["@context"]=he}}const z=G?G["@context"]||{}:{},ee=await w.processContext(m(W),z,W);W.hasOwnProperty("omitGraph")||(W.omitGraph=b(ee,1.1)),W.hasOwnProperty("pruneBlankNodeIdentifiers")||(W.pruneBlankNodeIdentifiers=b(ee,1.1));const re=await w.expand(H,W),pe={...W};pe.isFrame=!0,pe.keepFreeFloatingNodes=!0;const be=await w.expand(G,pe),O=Object.keys(G).map(fe=>E(ee,fe,{vocab:!0}));pe.merged=!O.includes("@graph"),pe.is11=b(ee,1.1);const V=v(re,be,pe);pe.graph=!W.omitGraph,pe.skipExpansion=!0,pe.link={},pe.framing=!0;let oe=await w.compact(V,z,pe);return pe.link={},oe=g(oe,pe),oe},w.link=async function(H,G,W){const z={};return G&&(z["@context"]=G),z["@embed"]="@link",w.frame(H,z,W)},w.normalize=w.canonize=async function(H,G){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if(G=de(G,{base:x(H)?H:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new i({sharedCache:X})}),"inputFormat"in G){if(G.inputFormat!=="application/n-quads"&&G.inputFormat!=="application/nquads")throw new o("Unknown canonicalization input format.","jsonld.CanonizeError");const ee=s.parse(H);return r.canonize(ee,G)}const W={...G};delete W.format,W.produceGeneralizedRdf=!1;const z=await w.toRDF(H,W);return r.canonize(z,G)},w.fromRDF=async function(H,G){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");G=de(G,{format:x(H)?"application/n-quads":void 0});const{format:W}=G;let{rdfParser:z}=G;if(W){if(z=z||U[W],!z)throw new o("Unknown input format.","jsonld.UnknownFormat",{format:W})}else z=()=>H;const ee=await z(H);return c(ee,G)},w.toRDF=async function(H,G){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");G=de(G,{base:x(H)?H:"",skipExpansion:!1,contextResolver:new i({sharedCache:X})});let W;G.skipExpansion?W=H:W=await w.expand(H,G);const z=u(W,G);if(G.format){if(G.format==="application/n-quads"||G.format==="application/nquads")return s.serialize(z);throw new o("Unknown output format.","jsonld.UnknownFormat",{format:G.format})}return z},w.createNodeMap=async function(H,G){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");G=de(G,{base:x(H)?H:"",contextResolver:new i({sharedCache:X})});const W=await w.expand(H,G);return B(W,G)},w.merge=async function(H,G,W){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!y(H))throw new TypeError('Could not merge, "docs" must be an array.');typeof G=="function"?G=null:G=G||null,W=de(W,{contextResolver:new i({sharedCache:X})});const z=await Promise.all(H.map(fe=>{const he={...W};return w.expand(fe,he)}));let ee=!0;"mergeNodes"in W&&(ee=W.mergeNodes);const re=W.issuer||new n("_:b"),pe={"@default":{}};for(let fe=0;fe<z.length;++fe){const he=t.relabelBlankNodes(z[fe],{issuer:new n("_:b"+fe+"-")}),me=ee||fe===0?pe:{"@default":{}};if(T(he,me,"@default",re),me!==pe)for(const J in me){const ce=me[J];if(!(J in pe)){pe[J]=ce;continue}const ge=pe[J];for(const le in ce)le in ge||(ge[le]=ce[le])}}const be=N(pe),O=[],V=Object.keys(be).sort();for(let fe=0;fe<V.length;++fe){const he=be[V[fe]];_(he)||O.push(he)}return G===null?O:(W.graph=!0,W.skipExpansion=!0,await w.compact(O,G,W))},Object.defineProperty(w,"documentLoader",{get:()=>w._documentLoader,set:H=>w._documentLoader=H}),w.documentLoader=async H=>{throw new o("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:H})},w.get=async function(H,G){let W;typeof G.documentLoader=="function"?W=G.documentLoader:W=w.documentLoader;const z=await W(H);try{if(!z.document)throw new o("No remote document found at the given URL.","jsonld.NullRemoteDocument");x(z.document)&&(z.document=JSON.parse(z.document))}catch(ee){throw new o("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:ee,remoteDoc:z})}return z},w.processContext=async function(H,G,W){return W=de(W,{base:"",contextResolver:new i({sharedCache:X})}),G===null?m(W):(G=t.clone(G),k(G)&&"@context"in G||(G={"@context":G}),f({activeCtx:H,localCtx:G,options:W}))},w.getContextValue=dr().getContextValue,w.documentLoaders={},w.useDocumentLoader=function(H){if(!(H in w.documentLoaders))throw new o('Unknown document loader type: "'+H+'"',"jsonld.UnknownDocumentLoader",{type:H});w.documentLoader=w.documentLoaders[H].apply(w,Array.prototype.slice.call(arguments,1))},w.registerRDFParser=function(H,G){U[H]=G},w.unregisterRDFParser=function(H){delete U[H]},w.registerRDFParser("application/n-quads",s.parse),w.registerRDFParser("application/nquads",s.parse),w.url=Xt(),w.logEventHandler=$,w.logWarningEventHandler=q,w.safeEventHandler=A,w.setDefaultEventHandler=j,w.strictEventHandler=I,w.unhandledEventHandler=Z,w.util=t,Object.assign(w,t),w.promises=w,w.RequestQueue=zc(),w.JsonLdProcessor=Bp()(w),e.setupGlobals(w),e.setupDocumentLoaders(w);function de(H,{documentLoader:G=w.documentLoader,...W}){if(H&&"compactionMap"in H)throw new o('"compactionMap" not supported.',"jsonld.OptionsError");if(H&&"expansionMap"in H)throw new o('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:G},W,H,{eventHandler:te({options:H})})}return w},Y=function(){return F(function(){return Y()})};return F(Y),$o=Y,$o}var zp=qp();const Fo={},Po={};let fa;class Up{constructor(e){this.loadedExternalUrls=[],this.loadedClasses=[],this.config=e}async loadGraphs(){this.loadedExternalUrls=[],this.loadedClasses=[];let e=fa;this.config.prefixes={};const t=[];if(e||(e=new tt,t.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?zi(this.config.attributes.shapesUrl):"",e,hi))),t.push(this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?zi(this.config.attributes.valuesUrl):"",e,kt)),await Promise.all(t),!fa&&e.countQuads(null,null,null,hi)===0&&this.config.attributes.valuesSubject){const i=[...e.getObjects(this.config.attributes.valuesSubject,Ye,kt),...e.getObjects(this.config.attributes.valuesSubject,oa,kt)],n=[];for(const o of i){const a=this.toURL(o.value);a&&this.loadedExternalUrls.indexOf(a)<0&&(this.loadedExternalUrls.push(a),n.push(this.importRDF(zi(a),e,hi)))}try{await Promise.allSettled(n)}catch(o){console.warn(o)}}this.config.store=e}async importRDF(e,t,i){const n=async o=>{const a=[];await new Promise((s,d)=>{const l=sd(o)==="xml"?new vp.RdfXmlParser:new Tu;l.on("data",c=>{if(t.add(new on(c.subject,c.predicate,c.object,i)),this.config.attributes.ignoreOwlImports===null&&Ea.equals(c.predicate)){const u=this.toURL(c.object.value);u&&this.loadedExternalUrls.indexOf(u)<0&&(this.loadedExternalUrls.push(u),a.push(this.importRDF(zi(u),t,Ne.namedNode(u))))}if(this.config.classInstanceProvider&&Sa.equals(c.predicate)){const u=c.object.value;if(this.loadedClasses.indexOf(u)<0){let v;u in Po?v=Po[u]:(v=this.config.classInstanceProvider(u),Po[u]=v),this.loadedClasses.push(u),a.push(this.importRDF(v,t,i))}}}).on("error",c=>{console.warn("failed parsing graph",i,c.message),d(c)}).on("prefix",(c,u)=>{c&&(this.config.prefixes[c]=u)}).on("end",()=>{s(null)}),l.write(o),l.end()});try{await Promise.allSettled(a)}catch(s){console.warn(s)}};if(e instanceof Promise&&(e=await e),e){if(sd(e)==="json")try{e=await zp.toRDF(JSON.parse(e),{format:"application/n-quads"})}catch(o){console.error(o)}await n(e)}}toURL(e){if(sa(e))return e;if(this.config.prefixes){const t=e.split(":");if(t.length===2){const i=this.config.prefixes[t[0]];if(i&&(e=e.replace(`${t[0]}:`,i),sa(e)))return e}}return null}}async function zi(r){if(r in Fo)return Fo[r];const e=fetch(r,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then(t=>t.text());return Fo[r]=e,e}function sd(r){return/^\s*\{/.test(r)?"json":/^\s*<\?xml/.test(r)?"xml":"ttl"}function Hp(r){fa=r}class Mo{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 ld{constructor(e,t){this.attributes=new Mo,this.loader=new Up(this),this.prefixes={},this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new tt,this.theme=e,this.form=t,this.languages=[...new Set(navigator.languages.flatMap(i=>i.length>2?[i.toLocaleLowerCase(),i.substring(0,2)]:i)),""]}updateAttributes(e){const t=new Mo;if(Object.keys(t).forEach(i=>{const n=e.dataset[i];n!==void 0&&(t[i]=n)}),this.editMode=t.view===null,this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){const i=this.languages.indexOf(t.language);i>-1&&this.languages.splice(i,1),this.languages.unshift(t.language)}t.valuesGraph&&(this.valuesGraphId=Ne.namedNode(t.valuesGraph))}static dataAttributes(){const e=new Mo;return Object.keys(e).map(t=>(t=t.replace(/[A-Z]/g,i=>"-"+i.toLowerCase()),"data-"+t))}get store(){return this._store}set store(e){this._store=e,this.lists=qu(e),this.groups=[],e.forSubjects(t=>{this.groups.push(t.id)},Ye,`${_e}PropertyGroup`,null)}}function Gp(r){return"_:"+r.value}function Vp(r,e){return[...r].map(t=>e(t)).join(`
|
|
367
|
+
*/var $o,ad;function qp(){if(ad)return $o;ad=1;const r=Ma(),e=Ip(),t=ct(),i=jp(),n=t.IdentifierIssuer,o=pt(),a=Uc(),s=Dp(),{expand:d}=Lp(),{flatten:l}=Op(),{fromRDF:c}=Cp(),{toRDF:u}=Fp(),{frameMergedOrDefault:v,cleanupNull:g}=Pp(),{isArray:y,isObject:k,isString:x}=lt(),{isSubjectReference:_}=$t(),{expandIri:E,getInitialContext:m,process:f,processingMode:b}=dr(),{compact:R,compactIri:L}=Mp(),{createNodeMap:T,createMergedNodeMap:B,mergeNodeMaps:I}=hn(),{logEventHandler:$,logWarningEventHandler:q,safeEventHandler:A,setDefaultEventHandler:j,setupEventHandler:te,strictEventHandler:N,unhandledEventHandler:Z}=Ri(),F=function(w){const U={},X=new a({max:100});w.compact=async function(H,G,W){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(G===null)throw new o("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(H===null)return null;W=de(W,{base:x(H)?H:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new n("_:b"),contextResolver:new i({sharedCache:X})}),W.link&&(W.skipExpansion=!0),W.compactToRelative||delete W.base;let z;W.skipExpansion?z=H:z=await w.expand(H,W);const ee=await w.processContext(m(W),G,W);let re=await R({activeCtx:ee,element:z,options:W});W.compactArrays&&!W.graph&&y(re)?re.length===1?re=re[0]:re.length===0&&(re={}):W.graph&&k(re)&&(re=[re]),k(G)&&"@context"in G&&(G=G["@context"]),G=t.clone(G),y(G)||(G=[G]);const pe=G;G=[];for(let O=0;O<pe.length;++O)(!k(pe[O])||Object.keys(pe[O]).length>0)&&G.push(pe[O]);const be=G.length>0;if(G.length===1&&(G=G[0]),y(re)){const O=L({activeCtx:ee,iri:"@graph",relativeTo:{vocab:!0}}),V=re;re={},be&&(re["@context"]=G),re[O]=V}else if(k(re)&&be){const O=re;re={"@context":G};for(const V in O)re[V]=O[V]}return re},w.expand=async function(H,G){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");G=de(G,{keepFreeFloatingNodes:!1,contextResolver:new i({sharedCache:X})});const W={},z=[];if("expandContext"in G){const be=t.clone(G.expandContext);k(be)&&"@context"in be?W.expandContext=be:W.expandContext={"@context":be},z.push(W.expandContext)}let ee;if(!x(H))W.input=t.clone(H);else{const be=await w.get(H,G);ee=be.documentUrl,W.input=be.document,be.contextUrl&&(W.remoteContext={"@context":be.contextUrl},z.push(W.remoteContext))}"base"in G||(G.base=ee||"");let re=m(G);for(const be of z)re=await f({activeCtx:re,localCtx:be,options:G});let pe=await d({activeCtx:re,element:W.input,options:G});return k(pe)&&"@graph"in pe&&Object.keys(pe).length===1?pe=pe["@graph"]:pe===null&&(pe=[]),y(pe)||(pe=[pe]),pe},w.flatten=async function(H,G,W){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");typeof G=="function"?G=null:G=G||null,W=de(W,{base:x(H)?H:"",contextResolver:new i({sharedCache:X})});const z=await w.expand(H,W),ee=l(z);return G===null?ee:(W.graph=!0,W.skipExpansion=!0,await w.compact(ee,G,W))},w.frame=async function(H,G,W){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(W=de(W,{base:x(H)?H:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new i({sharedCache:X})}),x(G)){const fe=await w.get(G,W);if(G=fe.document,fe.contextUrl){let he=G["@context"];he?y(he)?he.push(fe.contextUrl):he=[he,fe.contextUrl]:he=fe.contextUrl,G["@context"]=he}}const z=G?G["@context"]||{}:{},ee=await w.processContext(m(W),z,W);W.hasOwnProperty("omitGraph")||(W.omitGraph=b(ee,1.1)),W.hasOwnProperty("pruneBlankNodeIdentifiers")||(W.pruneBlankNodeIdentifiers=b(ee,1.1));const re=await w.expand(H,W),pe={...W};pe.isFrame=!0,pe.keepFreeFloatingNodes=!0;const be=await w.expand(G,pe),O=Object.keys(G).map(fe=>E(ee,fe,{vocab:!0}));pe.merged=!O.includes("@graph"),pe.is11=b(ee,1.1);const V=v(re,be,pe);pe.graph=!W.omitGraph,pe.skipExpansion=!0,pe.link={},pe.framing=!0;let oe=await w.compact(V,z,pe);return pe.link={},oe=g(oe,pe),oe},w.link=async function(H,G,W){const z={};return G&&(z["@context"]=G),z["@embed"]="@link",w.frame(H,z,W)},w.normalize=w.canonize=async function(H,G){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if(G=de(G,{base:x(H)?H:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new i({sharedCache:X})}),"inputFormat"in G){if(G.inputFormat!=="application/n-quads"&&G.inputFormat!=="application/nquads")throw new o("Unknown canonicalization input format.","jsonld.CanonizeError");const ee=s.parse(H);return r.canonize(ee,G)}const W={...G};delete W.format,W.produceGeneralizedRdf=!1;const z=await w.toRDF(H,W);return r.canonize(z,G)},w.fromRDF=async function(H,G){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");G=de(G,{format:x(H)?"application/n-quads":void 0});const{format:W}=G;let{rdfParser:z}=G;if(W){if(z=z||U[W],!z)throw new o("Unknown input format.","jsonld.UnknownFormat",{format:W})}else z=()=>H;const ee=await z(H);return c(ee,G)},w.toRDF=async function(H,G){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");G=de(G,{base:x(H)?H:"",skipExpansion:!1,contextResolver:new i({sharedCache:X})});let W;G.skipExpansion?W=H:W=await w.expand(H,G);const z=u(W,G);if(G.format){if(G.format==="application/n-quads"||G.format==="application/nquads")return s.serialize(z);throw new o("Unknown output format.","jsonld.UnknownFormat",{format:G.format})}return z},w.createNodeMap=async function(H,G){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");G=de(G,{base:x(H)?H:"",contextResolver:new i({sharedCache:X})});const W=await w.expand(H,G);return B(W,G)},w.merge=async function(H,G,W){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!y(H))throw new TypeError('Could not merge, "docs" must be an array.');typeof G=="function"?G=null:G=G||null,W=de(W,{contextResolver:new i({sharedCache:X})});const z=await Promise.all(H.map(fe=>{const he={...W};return w.expand(fe,he)}));let ee=!0;"mergeNodes"in W&&(ee=W.mergeNodes);const re=W.issuer||new n("_:b"),pe={"@default":{}};for(let fe=0;fe<z.length;++fe){const he=t.relabelBlankNodes(z[fe],{issuer:new n("_:b"+fe+"-")}),me=ee||fe===0?pe:{"@default":{}};if(T(he,me,"@default",re),me!==pe)for(const J in me){const ce=me[J];if(!(J in pe)){pe[J]=ce;continue}const ge=pe[J];for(const le in ce)le in ge||(ge[le]=ce[le])}}const be=I(pe),O=[],V=Object.keys(be).sort();for(let fe=0;fe<V.length;++fe){const he=be[V[fe]];_(he)||O.push(he)}return G===null?O:(W.graph=!0,W.skipExpansion=!0,await w.compact(O,G,W))},Object.defineProperty(w,"documentLoader",{get:()=>w._documentLoader,set:H=>w._documentLoader=H}),w.documentLoader=async H=>{throw new o("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:H})},w.get=async function(H,G){let W;typeof G.documentLoader=="function"?W=G.documentLoader:W=w.documentLoader;const z=await W(H);try{if(!z.document)throw new o("No remote document found at the given URL.","jsonld.NullRemoteDocument");x(z.document)&&(z.document=JSON.parse(z.document))}catch(ee){throw new o("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:ee,remoteDoc:z})}return z},w.processContext=async function(H,G,W){return W=de(W,{base:"",contextResolver:new i({sharedCache:X})}),G===null?m(W):(G=t.clone(G),k(G)&&"@context"in G||(G={"@context":G}),f({activeCtx:H,localCtx:G,options:W}))},w.getContextValue=dr().getContextValue,w.documentLoaders={},w.useDocumentLoader=function(H){if(!(H in w.documentLoaders))throw new o('Unknown document loader type: "'+H+'"',"jsonld.UnknownDocumentLoader",{type:H});w.documentLoader=w.documentLoaders[H].apply(w,Array.prototype.slice.call(arguments,1))},w.registerRDFParser=function(H,G){U[H]=G},w.unregisterRDFParser=function(H){delete U[H]},w.registerRDFParser("application/n-quads",s.parse),w.registerRDFParser("application/nquads",s.parse),w.url=Xt(),w.logEventHandler=$,w.logWarningEventHandler=q,w.safeEventHandler=A,w.setDefaultEventHandler=j,w.strictEventHandler=N,w.unhandledEventHandler=Z,w.util=t,Object.assign(w,t),w.promises=w,w.RequestQueue=zc(),w.JsonLdProcessor=Bp()(w),e.setupGlobals(w),e.setupDocumentLoaders(w);function de(H,{documentLoader:G=w.documentLoader,...W}){if(H&&"compactionMap"in H)throw new o('"compactionMap" not supported.',"jsonld.OptionsError");if(H&&"expansionMap"in H)throw new o('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:G},W,H,{eventHandler:te({options:H})})}return w},Y=function(){return F(function(){return Y()})};return F(Y),$o=Y,$o}var zp=qp();const Fo={},Po={};let fa;class Up{constructor(e){this.loadedExternalUrls=[],this.loadedClasses=[],this.config=e}async loadGraphs(){this.loadedExternalUrls=[],this.loadedClasses=[];let e=fa;this.config.prefixes={};const t=[];if(e||(e=new tt,t.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?zi(this.config.attributes.shapesUrl):"",e,hi))),t.push(this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?zi(this.config.attributes.valuesUrl):"",e,kt)),await Promise.all(t),!fa&&e.countQuads(null,null,null,hi)===0&&this.config.attributes.valuesSubject){const i=[...e.getObjects(this.config.attributes.valuesSubject,Ye,kt),...e.getObjects(this.config.attributes.valuesSubject,oa,kt)],n=[];for(const o of i){const a=this.toURL(o.value);a&&this.loadedExternalUrls.indexOf(a)<0&&(this.loadedExternalUrls.push(a),n.push(this.importRDF(zi(a),e,hi)))}try{await Promise.allSettled(n)}catch(o){console.warn(o)}}this.config.store=e}async importRDF(e,t,i){const n=async o=>{const a=[];await new Promise((s,d)=>{const l=sd(o)==="xml"?new vp.RdfXmlParser:new Tu;l.on("data",c=>{if(t.add(new on(c.subject,c.predicate,c.object,i)),this.config.attributes.ignoreOwlImports===null&&Ea.equals(c.predicate)){const u=this.toURL(c.object.value);u&&this.loadedExternalUrls.indexOf(u)<0&&(this.loadedExternalUrls.push(u),a.push(this.importRDF(zi(u),t,Ie.namedNode(u))))}if(this.config.classInstanceProvider&&Sa.equals(c.predicate)){const u=c.object.value;if(this.loadedClasses.indexOf(u)<0){let v;u in Po?v=Po[u]:(v=this.config.classInstanceProvider(u),Po[u]=v),this.loadedClasses.push(u),a.push(this.importRDF(v,t,i))}}}).on("error",c=>{console.warn("failed parsing graph",i,c.message),d(c)}).on("prefix",(c,u)=>{c&&(this.config.prefixes[c]=u)}).on("end",()=>{s(null)}),l.write(o),l.end()});try{await Promise.allSettled(a)}catch(s){console.warn(s)}};if(e instanceof Promise&&(e=await e),e){if(sd(e)==="json")try{e=await zp.toRDF(JSON.parse(e),{format:"application/n-quads"})}catch(o){console.error(o)}await n(e)}}toURL(e){if(sa(e))return e;if(this.config.prefixes){const t=e.split(":");if(t.length===2){const i=this.config.prefixes[t[0]];if(i&&(e=e.replace(`${t[0]}:`,i),sa(e)))return e}}return null}}async function zi(r){if(r in Fo)return Fo[r];const e=fetch(r,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then(t=>t.text());return Fo[r]=e,e}function sd(r){return/^\s*\{/.test(r)?"json":/^\s*<\?xml/.test(r)?"xml":"ttl"}function Hp(r){fa=r}class Mo{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 ld{constructor(e,t){this.attributes=new Mo,this.loader=new Up(this),this.prefixes={},this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new tt,this.theme=e,this.form=t,this.languages=[...new Set(navigator.languages.flatMap(i=>i.length>2?[i.toLocaleLowerCase(),i.substring(0,2)]:i)),""]}updateAttributes(e){const t=new Mo;if(Object.keys(t).forEach(i=>{const n=e.dataset[i];n!==void 0&&(t[i]=n)}),this.editMode=t.view===null,this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){const i=this.languages.indexOf(t.language);i>-1&&this.languages.splice(i,1),this.languages.unshift(t.language)}t.valuesGraph&&(this.valuesGraphId=Ie.namedNode(t.valuesGraph))}static dataAttributes(){const e=new Mo;return Object.keys(e).map(t=>(t=t.replace(/[A-Z]/g,i=>"-"+i.toLowerCase()),"data-"+t))}get store(){return this._store}set store(e){this._store=e,this.lists=qu(e),this.groups=[],e.forSubjects(t=>{this.groups.push(t.id)},Ye,`${_e}PropertyGroup`,null)}}function Gp(r){return"_:"+r.value}function Vp(r,e){return[...r].map(t=>e(t)).join(`
|
|
368
368
|
`)+`
|
|
369
|
-
`}function Wp(){return""}function Hc(r){return"<"+r.value+">"}const Xp=/["\\\\\n\r]/,Qp=/["\\\\\n\r]/g,Jp={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function Kp(r){return Jp[r]}function Yp(r){return Xp.test(r)?r.replace(Qp,Kp):r}function Zp(r){const e=Yp(r.value);return r.datatype.value==="http://www.w3.org/2001/XMLSchema#string"?'"'+e+'"':r.datatype.value==="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"?'"'+e+'"@'+r.language:'"'+e+'"^^'+Hc(r.datatype)}function eh(r,e){const t=e(r.subject),i=e(r.predicate),n=e(r.object),o=e(r.graph);return`${t} ${i} ${n} ${o?o+" ":""}.`}function th(r){return"?"+r.value}function st(r){if(!r)return null;if(r.termType==="BlankNode")return Gp(r);if(r.termType==="DefaultGraph")return Wp();if(r.termType==="Literal")return Zp(r);if(r.termType==="NamedNode")return Hc(r);if(r.termType==="Quad"||r.subject&&r.predicate&&r.object&&r.graph)return eh(r,st);if(r.termType==="Variable")return th(r);if(r[Symbol.iterator])return Vp(r,st);throw new Error(`unknown termType ${r.termType}`)}class Or{constructor(e){if(this.index=new Map,e)for(const[t,i]of e)this.set(t,i)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(st(e))}*entries(){for(const[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(const i of this.entries())e.call(t,i[1],i[0],this)}get(e){const t=this.index.get(st(e));return t&&t.value}has(e){return this.index.has(st(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const i=st(e);return this.index.set(i,{term:e,value:t}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}class dd{constructor({dataset:e,end:t,quad:i,start:n}){this.dataset=e,this.end=t,this.quad=i,this.start=n}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}}function cd(r){try{return st(r)}catch{return null}}class ut{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=st(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(cd(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(cd(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}class Gc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Gc.prototype.termType="BlankNode";class qa{equals(e){return!!e&&e.termType===this.termType}}qa.prototype.termType="DefaultGraph";qa.prototype.value="";function ud(r,e){if(!e)return null;if(e.termType==="BlankNode")return r.blankNode(e.value);if(e.termType==="DefaultGraph")return r.defaultGraph();if(e.termType==="Literal")return r.literal(e.value,e.language||r.namedNode(e.datatype.value));if(e.termType==="NamedNode")return r.namedNode(e.value);if(e.termType==="Quad"){const t=r.fromTerm(e.subject),i=r.fromTerm(e.predicate),n=r.fromTerm(e.object),o=r.fromTerm(e.graph);return r.quad(t,i,n,o)}if(e.termType==="Variable")return r.variable(e.value);throw new Error(`unknown termType ${e.termType}`)}class Qi{constructor(e,t,i,n=""){this.value=e,this.language=t,this.datatype=i,this.direction=n}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value&&e.language===this.language&&e.datatype.equals(this.datatype)&&(e.direction||"")===this.direction}}Qi.prototype.termType="Literal";class Ni{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Ni.prototype.termType="NamedNode";class za{constructor(e,t,i,n){this.subject=e,this.predicate=t,this.object=i,this.graph=n}equals(e){return!!e&&(e.termType==="Quad"||!e.termType)&&e.subject.equals(this.subject)&&e.predicate.equals(this.predicate)&&e.object.equals(this.object)&&e.graph.equals(this.graph)}}za.prototype.termType="Quad";za.prototype.value="";class Vc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Vc.prototype.termType="Variable";const rh=new Ni("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),fd=new Ni("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),ih=new Ni("http://www.w3.org/2001/XMLSchema#string");class Wc{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new qa}}namedNode(e){return new Ni(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new Gc(e)}literal(e,t){return typeof t=="string"?new Qi(e,t,fd):typeof t?.language=="string"?new Qi(e,t.language,t.direction?rh:fd,t.direction):new Qi(e,"",t||ih)}variable(e){return new Vc(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,i,n=this.defaultGraph()){return new za(e,t,i,n)}fromTerm(e){return ud(this,e)}fromQuad(e){return ud(this,e)}}Wc.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const Ua=new Wc,nh={apply:(r,e,t)=>r(t[0]),get:(r,e)=>r(e)};function ht(r,{factory:e=Ua}={}){const t=(i="")=>e.namedNode(`${r}${i.raw||i}`);return typeof Proxy>"u"?t:new Proxy(t,nh)}ht("http://www.w3.org/2001/XMLSchema#");const xt=ht("http://www.w3.org/1999/02/22-rdf-syntax-ns#");ht("http://www.w3.org/2000/01/rdf-schema#");class $e{static add({ptr:e,start:t,end:i,subjects:n=[null],predicates:o=[null],objects:a=[null],graphs:s,callback:d}={}){if(!e.factory)throw new Error("add operation requires a factory");let l=()=>{};d&&(l=c=>{d(new dd({dataset:e.dataset,start:t,end:i,quad:c}))});for(const c of n)for(const u of o)for(const v of a)for(const g of s){const y={subject:c,predicate:u,object:v,graph:g};y[t]=e.term;const k=e.factory.quad(y.subject,y.predicate,y.object,y.graph);e.dataset.add(k),l(k)}return e}static addList({ptr:e,predicates:t,items:i,graphs:n}){if(e.isAny())throw new Error("can't attach a list to an any ptr");for(const o of t)for(const a of n){const s=i.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,o,s[0]||xt.nil,a));for(let d=0;d<s.length;d++)e.dataset.add(e.factory.quad(s[d],xt.first,i[d],a)),e.dataset.add(e.factory.quad(s[d],xt.rest,s[d+1]||xt.nil,a))}return e}static delete({ptr:e,start:t,subjects:i=[null],predicates:n=[null],objects:o=[null]}){for(const a of i)for(const s of n)for(const d of o){const l={subject:a,predicate:s,object:d};l[t]=e.term;const c=e.dataset.match(l.subject,l.predicate,l.object);for(const u of c)e.dataset.delete(u)}return e}static deleteList({ptr:e,predicates:t}){const i=[];for(const n of t)for(const o of e.dataset.match(e.term,n)){let a=o.object;for(i.push(o);!xt.nil.equals(a);){a=i[i.length-1].object;const s=e.dataset.match(a);if(s.size===0)break;for(const d of s)i.push(d)}}for(const n of i)e.dataset.delete(n);return e}static execute({ptr:e,operation:t="traverse",quantifier:i,start:n,end:o,subjects:a,predicates:s,objects:d,graphs:l,items:c,callback:u}={}){if(t==="add")return $e.add({ptr:e,start:n,end:o,subjects:a,predicates:s,objects:d,graphs:l,callback:u});if(t==="addList")return $e.addList({ptr:e,predicates:s,items:c,graphs:l});if(t==="delete")return $e.delete({ptr:e,start:n,subjects:a,predicates:s,objects:d});if(t==="deleteList")return $e.deleteList({ptr:e,predicates:s});if(t==="isList")return $e.isList({ptr:e});if(t==="list")return $e.list({ptr:e});if(t==="traverse")return $e.traverse({ptr:e,quantifier:i,start:n,end:o,subjects:a,predicates:s,objects:d,graphs:l});throw new Error(`unknown operation ${t}`)}static isList({ptr:e}){return e.isAny()?!1:!!(xt.nil.equals(e.term)||$e.traverse({ptr:e,predicates:[xt.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(xt.nil);){const t=e.out([xt.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const i=e.out([xt.rest]);if(i.length!==1)throw new Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=i[0]}}}}static traverse({ptr:e,quantifier:t="one",start:i="subject",end:n="object",subjects:o=[null],predicates:a=[null],objects:s=[null],graphs:d=[null],callback:l}){if(t==="one")return $e.traverseOne({ptr:e,start:i,end:n,subjects:o,predicates:a,objects:s,graphs:d,callback:l});if(t==="oneOrMore"){const c=$e.traverse({ptr:e,end:n,start:i,subjects:o,predicates:a,objects:s,graphs:d,callback:l});return $e.traverseMore({ptrs:c,end:n,start:i,subjects:o,predicates:a,objects:s,graphs:d,callback:l})}if(t==="zeroOrMore")return $e.traverseMore({ptrs:[e],end:n,start:i,subjects:o,predicates:a,objects:s,graphs:d,callback:l});if(t==="zeroOrOne")return[e,...$e.traverse({ptr:e,end:n,start:i,subjects:o,predicates:a,objects:s,graphs:d,callback:l})];throw new Error(`unknown quantifier ${t}`)}static traverseMore({ptrs:e,end:t,start:i,subjects:n,predicates:o,objects:a,graphs:s,callback:d}={}){let l=[...e],c,u;do{c=[];for(const v of e)c=[...c,...$e.traverseOne({ptr:v,end:t,start:i,subjects:n,predicates:o,objects:a,graphs:s,callback:d})];u&&(c=c.filter(v=>!u.has(v.term))),e=c,l=[...l,...c],u=new ut(l.map(v=>v.term))}while(c.length>0);return l}static traverseOne({ptr:e,start:t,end:i,subjects:n,predicates:o,objects:a,graphs:s,callback:d=(l,c)=>c.extend(l)}={}){const l=[];for(const c of n)for(const u of o)for(const v of a)for(const g of s){const y={subject:c,predicate:u,object:v,graph:g};y[t]=e.term;for(const k of e.dataset.match(y.subject,y.predicate,y.object,y.graph))l.push(d(new dd({dataset:e.dataset,end:i,quad:k,start:t}),e))}return l}}function pd(r,e){return e?t=>e(r.extend(t)):()=>{}}class hd{constructor({dataset:e,edges:t=[],factory:i,graph:n,term:o}){if(!e&&t.length===0)throw new Error("dataset or edges is required");if(t.length===0&&typeof o>"u")throw new Error("edges or term must be given");if(t.length>0&&o)throw new Error("edges or term must be given");this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=i,this._graph=n,t.length===0&&(this._term=o)}get edge(){return this.edges[this.edges.length-1]}get graph(){return typeof this._graph=="object"?this._graph:this.edge&&this.edge.graph}get length(){return this._term!==void 0?1:this.edges.length+1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return this._term!==void 0?this._term:this.edge.term}get value(){const e=this.term;return e===null?void 0:e.value}addIn(e,t,i){return $e.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:pd(this,i)})}addList(e,t){return $e.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,i){return $e.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:pd(this,i)})}deleteIn(e,t){return $e.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return $e.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return $e.delete({ptr:this,start:"subject",predicates:e,objects:t})}execute({operation:e,quantifier:t,start:i,end:n,subjects:o,predicates:a,objects:s,graphs:d,items:l,callback:c}){return $e.execute({ptr:this,operation:e,quantifier:t,start:i,end:n,subjects:o,predicates:a,objects:s,graphs:d,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 $e.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return $e.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return $e.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return $e.isList({ptr:this})}list(){return $e.list({ptr:this})}*nodes(){for(let e=0;e<this.length;e++)this._term!==void 0?yield{dataset:this.dataset,term:this._term}:this.edges.length>e?yield{dataset:this.edges[e].dataset,term:this.edges[e].startTerm}:this.edges.length===e&&(yield{dataset:this.edges[e-1].dataset,term:this.edges[e-1].term})}out(e,t){return $e.traverse({ptr:this,predicates:e,objects:t,graphs:[this.graph]})}*quads(){for(const{quad:e}of this.edges)yield e}trim(){return new this.constructor({dataset:this.dataset,factory:this.factory,graph:this.graph,term:this.term})}}function bd(r,e){return r?r.equals(e):r===e}function oh(r,e){return!(r.dataset!==e.dataset||!bd(r.graph,e.graph)||!bd(r.term,e.term))}function md(r,e){return e?t=>e(new r.constructor({factory:r.factory,ptrs:[t]})):()=>{}}class tn{constructor({dataset:e,factory:t,ptrs:i,terms:n,graphs:o}){if(this.factory=t,i)this.ptrs=[...i];else{this.ptrs=[];for(const a of n||[null])for(const s of o||[null])this.ptrs.push(new hd({dataset:e,factory:t,graph:s,term:a}))}}get dataset(){const e=new Set(this.datasets);return e.size!==1?null:e[Symbol.iterator]().next().value}get datasets(){return this.ptrs.map(e=>e.dataset)}get term(){const e=new ut(this.terms);if(e.size===1)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map(e=>e.term)}get value(){const e=this.term;return e?.value}get values(){return this.ptrs.map(e=>e.value)}addIn(e,t,i){const n=md(this,i);for(const o of this.ptrs)o.addIn(e,t,n);return this}addList(e,t){if(this.isAny())throw new Error("can't attach a list to an any ptr");for(const i of this.ptrs)i.addList(e,t);return this}addOut(e,t,i){const n=md(this,i);for(const o of this.ptrs)o.addOut(e,t,n);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(const i of this.ptrs)i.deleteIn(e,t);return this}deleteList(e){for(const t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(const i of this.ptrs)i.deleteOut(e,t);return this}distinct(){const e=this.ptrs.reduce((t,i)=>(t.some(n=>oh(n,i))||t.push(i.trim()),t),[]);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 i of e)t=t.execute(i);return t}filter(e){return this.clone({ptrs:[...this].filter(e).map(t=>t.ptrs[0])})}hasIn(e,t){return this.clone({ptrs:this.ptrs.flatMap(i=>i.hasIn(e,t))})}hasOut(e,t){return this.clone({ptrs:this.ptrs.flatMap(i=>i.hasOut(e,t))})}in(e,t){return this.clone({ptrs:this.ptrs.flatMap(i=>i.in(e,t))})}isAny(){return this.ptrs.length>0&&this.ptrs.some(e=>e.isAny())}isList(){return this.ptrs.length!==1?!1:this.ptrs[0].isList()}list(){if(!this.isList())return;const e=this.ptrs[0].list(),t=this;return function*(){for(const i of e)yield t.clone({ptrs:[i]})}()}map(e){return[...this].map(e)}node(e){const t=this.dataset,i=[...e].map(n=>new hd({dataset:t,factory:this.factory,term:n}));return this.clone({ptrs:i})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap(i=>i.out(e,t))})}*quads(){for(const{edges:e}of this.ptrs)for(const{quad:t}of e)yield t}trim(){return this.clone({ptrs:this.ptrs.map(e=>e.trim())})}*[Symbol.iterator](){for(const e of this.ptrs)yield this.clone({ptrs:[e]})}}ht("http://www.w3.org/2002/07/owl#");const cr=ht("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),ah=ht("http://www.w3.org/2000/01/rdf-schema#"),ae=ht("http://www.w3.org/ns/shacl#"),pa=ht("https://schemas.link/shacl-next#"),Ha=ht("http://www.w3.org/2001/XMLSchema#");function sh(r){return r?`{${[...r.quads()].map(e=>st(e)).join(" ")}}`:"{}"}function lh(r){return r?`{${r.map(e=>sh(e)).join(" ")}}`:"{}"}var Bo,gd;function dh(){if(gd)return Bo;gd=1;var r=/\s/;function e(t){for(var i=t.length;i--&&r.test(t.charAt(i)););return i}return Bo=e,Bo}var qo,vd;function ch(){if(vd)return qo;vd=1;var r=dh(),e=/^\s+/;function t(i){return i&&i.slice(0,r(i)+1).replace(e,"")}return qo=t,qo}var zo,yd;function uh(){if(yd)return zo;yd=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return zo=r,zo}var Uo,wd;function fh(){if(wd)return Uo;wd=1;var r=typeof kr=="object"&&kr&&kr.Object===Object&&kr;return Uo=r,Uo}var Ho,xd;function ph(){if(xd)return Ho;xd=1;var r=fh(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Ho=t,Ho}var Go,_d;function Xc(){if(_d)return Go;_d=1;var r=ph(),e=r.Symbol;return Go=e,Go}var Vo,kd;function hh(){if(kd)return Vo;kd=1;var r=Xc(),e=Object.prototype,t=e.hasOwnProperty,i=e.toString,n=r?r.toStringTag:void 0;function o(a){var s=t.call(a,n),d=a[n];try{a[n]=void 0;var l=!0}catch{}var c=i.call(a);return l&&(s?a[n]=d:delete a[n]),c}return Vo=o,Vo}var Wo,Ed;function bh(){if(Ed)return Wo;Ed=1;var r=Object.prototype,e=r.toString;function t(i){return e.call(i)}return Wo=t,Wo}var Xo,Sd;function mh(){if(Sd)return Xo;Sd=1;var r=Xc(),e=hh(),t=bh(),i="[object Null]",n="[object Undefined]",o=r?r.toStringTag:void 0;function a(s){return s==null?s===void 0?n:i:o&&o in Object(s)?e(s):t(s)}return Xo=a,Xo}var Qo,Rd;function gh(){if(Rd)return Qo;Rd=1;function r(e){return e!=null&&typeof e=="object"}return Qo=r,Qo}var Jo,Nd;function vh(){if(Nd)return Jo;Nd=1;var r=mh(),e=gh(),t="[object Symbol]";function i(n){return typeof n=="symbol"||e(n)&&r(n)==t}return Jo=i,Jo}var Ko,Id;function yh(){if(Id)return Ko;Id=1;var r=ch(),e=uh(),t=vh(),i=NaN,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt;function d(l){if(typeof l=="number")return l;if(t(l))return i;if(e(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=e(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=r(l);var u=o.test(l);return u||a.test(l)?s(l.slice(2),u?2:8):n.test(l)?i:+l}return Ko=d,Ko}var Yo,Td;function wh(){if(Td)return Yo;Td=1;var r=yh(),e=1/0,t=17976931348623157e292;function i(n){if(!n)return n===0?n:0;if(n=r(n),n===e||n===-e){var o=n<0?-1:1;return o*t}return n===n?n:0}return Yo=i,Yo}var Zo,Ad;function xh(){if(Ad)return Zo;Ad=1;var r=wh();function e(t){var i=r(t),n=i%1;return i===i?n?i-n:i:0}return Zo=e,Zo}var ea,jd;function _h(){if(jd)return ea;jd=1;var r=xh(),e="Expected a function";function t(i,n){var o;if(typeof n!="function")throw new TypeError(e);return i=r(i),function(){return--i>0&&(o=n.apply(this,arguments)),i<=1&&(n=void 0),o}}return ea=t,ea}var ta,Dd;function kh(){if(Dd)return ta;Dd=1;var r=_h();function e(t){return r(2,t)}return ta=e,ta}var Eh=kh();const gt=ru(Eh);let Ld=class{constructor({details:e,factory:t,options:i,results:n=[]}={}){this.details=e,this.factory=t,this.options=i,this.results=n,this._conforms=gt(()=>!this.results.some(o=>o.severity.equals(ae.Info)||o.severity.equals(ae.Violation)||o.severity.equals(ae.Warning))),this._ptr=gt(()=>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 tn({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([cr.type],[ae.ValidationReport]).addOut([ae.conforms],[this.factory.literal(this.conforms.toString(),Ha.boolean)]);for(const t of this.results)e.addOut([ae.result],[this.factory.blankNode()],i=>{t.build(i,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function Sh(r,e){return Object.entries(e).reduce((t,[i,n])=>(n&&n.termType&&(n=st(n)),t.replace(`{$${i}}`,n).replace(`{?${i}}`,n)),r)}let Rh=class{constructor({args:e={},constraintComponent:t,factory:i,focusNode:n,message:o=[],path:a,results:s=[],severity:d,shape:l,source:c=[],value:u,valuePaths:v=[]}={}){this.args=e,this.constraintComponent=t,this.factory=i,this.focusNode=n,this.path=a||l.path,this.results=s,this.severity=d,this.shape=l,this.source=c,this.value=u,this.valuePaths=v,this._message=gt(()=>(this.shape.message.length>0&&(o=this.shape.message),o.length===0&&(o=this.shape.ptr.node([this.constraintComponent]).out([ae.message]).terms),o.map(g=>i.literal(Sh(g.value,e),g.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([cr.type],[ae.ValidationResult]).addOut([ae.focusNode],this.focusNode.terms).addOut([ae.resultSeverity],[this.severity]).addOut([ae.sourceConstraint],this.source).addOut([ae.sourceConstraintComponent],[this.constraintComponent]).addOut([ae.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([ae.resultMessage],this.message);const i=n=>{if(n.quantifier==="one")return n.predicates.length>1?e.node([this.factory.blankNode()]).addList([ae.alternativePath],n.predicates):n.start==="object"?e.node([this.factory.blankNode()]).addOut([ae.inversePath],[n.predicates[0]]):e.node([n.predicates[0]]);if(n.quantifier==="oneOrMore")return e.node([this.factory.blankNode()]).addOut([ae.oneOrMorePath],[n.predicates[0]]);if(n.quantifier==="zeroOrMore")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrMorePath],[n.predicates[0]]);if(n.quantifier==="zeroOrOne")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrOnePath],[n.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([ae.resultPath],i(this.path[0]).terms):e.addList([ae.resultPath],this.path.map(n=>i(n).term))),typeof this.value<"u"&&e.addOut([ae.value],this.value.terms),t)for(const n of this.results)e.addOut([ae.detail],[this.factory.blankNode()],o=>{n.build(o,{details:t})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}};class Ga{constructor({factory:e,focusNode:t,options:i={debug:!1,details:!1},processed:n=new Set,report:o=new Ld({factory:e,options:i}),results:a=new Map,shape:s,value:d,valueOrNode:l,valuePaths:c,values:u}={}){this.factory=e,this.focusNode=t,this.options=i,this.processed=n,this.report=o,this.results=a,this.shape=s,this.value=d,this.valuePaths=c,this.valueOrNode=l,this.values=u}create({child:e,focusNode:t=this.focusNode,shape:i=this.shape,value:n=this.value,valueOrNode:o=this.valueOrNode,valuePaths:a=this.valuePaths,values:s=this.values}={}){return new Ga({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new Ld({factory:this.factory,options:this.options}):this.report,results:this.results,shape:i,value:n,valueOrNode:o,valuePaths:a,values:s})}id({shape:e=this.shape}={}){return`${st(e.ptr.term)} - ${st(this.focusNode.term)} - ${lh(this.valuePaths)}`}result(e){const t=new Rh({factory:this.factory,focusNode:this.focusNode,shape:this.shape,value:this.value,valuePaths:this.valuePaths,...e}),i=this.id();this.results.has(i)?this.results.get(i).add(t):this.results.set(i,new Set([t])),this.report.results.push(t)}debug(e,t){this.options.debug&&this.result({severity:pa.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:pa.Trace,constraintComponent:e,...t})}test(e,t,i){e?this.debug(t,i):this.violation(t,i)}violation(e,t){this.result({constraintComponent:e,severity:this.shape.severity||ae.Violation,...t})}}function Nh(){return{generic:Ih()}}function Ih(){return r=>{r.trace(pa.TraversalConstraintComponent,{args:{},message:[r.factory.literal("Traversal")],value:r.valueOrNode})}}class Th{constructor(e){this.validations=new Or(e)}compile(e){const t=e.validator.options.coverage;if(e.deactivated)return[];let i=!1;const n=new Set;for(const o of e.ptr.execute({start:"subject",end:"predicate"})){const a=this.validations.get(o.term);a&&(n.add(a),o.term.equals(ae.property)&&(i=!0))}return t&&e.isPropertyShape&&!i&&n.add(Nh),[...n].map(o=>o(e)).filter(Boolean)}}var rr={},ir={},ii={},ni={},Od;function Ar(){if(Od)return ni;Od=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.Translator=void 0;let r=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(t){throw new Error(`Invalid RDF ${t.datatype.value} value: '${t.value}'`)}registerHandler(t,i,n){for(const o of i)this.supportedRdfDatatypes.push(o),this.fromRdfHandlers[o.value]=t;for(const o of n){let a=this.toRdfHandlers[o];a||(this.toRdfHandlers[o]=a=[]),a.push(t)}}fromRdf(t,i){const n=this.fromRdfHandlers[t.datatype.value];return n?n.fromRdf(t,i):t.value}toRdf(t,i){const n=this.toRdfHandlers[typeof t];if(n)for(const o of n){const a=o.toRdf(t,i);if(a)return a}throw new Error(`Invalid JavaScript value: '${t}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}};return ni.Translator=r,ni}var Cd;function Ah(){if(Cd)return ii;Cd=1,Object.defineProperty(ii,"__esModule",{value:!0}),ii.TypeHandlerBoolean=void 0;const r=Ar();let e=class Qc{fromRdf(i,n){switch(i.value){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1}return n&&r.Translator.incorrectRdfDataType(i),!1}toRdf(i,{datatype:n,dataFactory:o}){return o.literal(i?"true":"false",n||o.namedNode(Qc.TYPE))}};return ii.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",ii}var oi={},$d;function jh(){if($d)return oi;$d=1,Object.defineProperty(oi,"__esModule",{value:!0}),oi.TypeHandlerDate=void 0;const r=Ar();let e=class ha{fromRdf(i,n){switch(n&&!i.value.match(ha.VALIDATORS[i.datatype.value.substr(33,i.datatype.value.length)])&&r.Translator.incorrectRdfDataType(i),i.datatype.value){case"http://www.w3.org/2001/XMLSchema#gDay":return new Date(0,0,parseInt(i.value,10));case"http://www.w3.org/2001/XMLSchema#gMonthDay":const o=i.value.split("-");return new Date(0,parseInt(o[0],10)-1,parseInt(o[1],10));case"http://www.w3.org/2001/XMLSchema#gYear":return new Date(i.value+"-01-01");case"http://www.w3.org/2001/XMLSchema#gYearMonth":return new Date(i.value+"-01");default:return new Date(i.value)}}toRdf(i,{datatype:n,dataFactory:o}){if(n=n||o.namedNode(ha.TYPES[0]),!(i instanceof Date))return null;const a=i;let s;switch(n.value){case"http://www.w3.org/2001/XMLSchema#gDay":s=String(a.getUTCDate());break;case"http://www.w3.org/2001/XMLSchema#gMonthDay":s=a.getUTCMonth()+1+"-"+a.getUTCDate();break;case"http://www.w3.org/2001/XMLSchema#gYear":s=String(a.getUTCFullYear());break;case"http://www.w3.org/2001/XMLSchema#gYearMonth":s=a.getUTCFullYear()+"-"+(a.getUTCMonth()+1);break;case"http://www.w3.org/2001/XMLSchema#date":s=a.toISOString().replace(/T.*$/,"");break;default:s=a.toISOString()}return o.literal(s,n)}};return oi.TypeHandlerDate=e,e.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"],e.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]$/},oi}var ai={},Fd;function Dh(){if(Fd)return ai;Fd=1,Object.defineProperty(ai,"__esModule",{value:!0}),ai.TypeHandlerNumberDouble=void 0;const r=Ar();let e=class Jc{fromRdf(i,n){const o=parseFloat(i.value);return n&&isNaN(o)&&r.Translator.incorrectRdfDataType(i),o}toRdf(i,{datatype:n,dataFactory:o}){return n=n||o.namedNode(Jc.TYPES[0]),isNaN(i)?o.literal("NaN",n):isFinite(i)?i%1===0?null:o.literal(i.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),n):o.literal(i>0?"INF":"-INF",n)}};return ai.TypeHandlerNumberDouble=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float"],ai}var si={},Pd;function Lh(){if(Pd)return si;Pd=1,Object.defineProperty(si,"__esModule",{value:!0}),si.TypeHandlerNumberInteger=void 0;const r=Ar();let e=class fi{fromRdf(i,n){const o=parseInt(i.value,10);return n&&(isNaN(o)||i.value.indexOf(".")>=0)&&r.Translator.incorrectRdfDataType(i),o}toRdf(i,{datatype:n,dataFactory:o}){return o.literal(String(i),n||(i<=fi.MAX_INT&&i>=fi.MIN_INT?o.namedNode(fi.TYPES[0]):o.namedNode(fi.TYPES[1])))}};return si.TypeHandlerNumberInteger=e,e.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"],e.MAX_INT=2147483647,e.MIN_INT=-2147483648,si}var li={},Md;function Oh(){if(Md)return li;Md=1,Object.defineProperty(li,"__esModule",{value:!0}),li.TypeHandlerString=void 0;let r=class{fromRdf(t){return t.value}toRdf(t,{datatype:i,dataFactory:n}){return n.literal(t,i)}};return li.TypeHandlerString=r,r.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/1999/02/22-rdf-syntax-ns#dirLangString","http://www.w3.org/2001/XMLSchema#time","http://www.w3.org/2001/XMLSchema#duration"],li}var Bd;function qd(){return Bd||(Bd=1,function(r){var e=ir&&ir.__createBinding||(Object.create?function(i,n,o,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(n,o);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[o]}}),Object.defineProperty(i,a,s)}:function(i,n,o,a){a===void 0&&(a=o),i[a]=n[o]}),t=ir&&ir.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),t(Ah(),r),t(jh(),r),t(Dh(),r),t(Lh(),r),t(Oh(),r)}(ir)),ir}var ra={},zd;function Ch(){return zd||(zd=1,Object.defineProperty(ra,"__esModule",{value:!0})),ra}var Ud;function $h(){return Ud||(Ud=1,function(r){var e=rr&&rr.__createBinding||(Object.create?function(g,y,k,x){x===void 0&&(x=k);var _=Object.getOwnPropertyDescriptor(y,k);(!_||("get"in _?!y.__esModule:_.writable||_.configurable))&&(_={enumerable:!0,get:function(){return y[k]}}),Object.defineProperty(g,x,_)}:function(g,y,k,x){x===void 0&&(x=k),g[x]=y[k]}),t=rr&&rr.__exportStar||function(g,y){for(var k in g)k!=="default"&&!Object.prototype.hasOwnProperty.call(y,k)&&e(y,g,k)};Object.defineProperty(r,"__esModule",{value:!0}),r.fromRdf=d,r.toRdf=l,r.getTermRaw=c,r.getSupportedRdfDatatypes=u,r.getSupportedJavaScriptPrimitives=v;const i=Fc(),n=qd(),o=Ar();t(qd(),r),t(Ch(),r),t(Ar(),r);const a=new i.DataFactory,s=new o.Translator;s.registerHandler(new n.TypeHandlerString,n.TypeHandlerString.TYPES.map(g=>a.namedNode(g)),["string"]),s.registerHandler(new n.TypeHandlerBoolean,[n.TypeHandlerBoolean.TYPE].map(g=>a.namedNode(g)),["boolean"]),s.registerHandler(new n.TypeHandlerNumberDouble,n.TypeHandlerNumberDouble.TYPES.map(g=>a.namedNode(g)),["number"]),s.registerHandler(new n.TypeHandlerNumberInteger,n.TypeHandlerNumberInteger.TYPES.map(g=>a.namedNode(g)),["number"]),s.registerHandler(new n.TypeHandlerDate,n.TypeHandlerDate.TYPES.map(g=>a.namedNode(g)),["object"]);function d(g,y){return s.fromRdf(g,y)}function l(g,y){return y&&"namedNode"in y&&(y={dataFactory:y}),y=y||{},y&&!y.dataFactory&&(y.dataFactory=a),s.toRdf(g,y)}function c(g,y){return g.termType==="Literal"?d(g,y):g.value}function u(){return s.getSupportedRdfDatatypes()}function v(){return s.getSupportedJavaScriptPrimitives()}}(rr)),rr}var ki=$h();function Hd(r){if(r.term.termType!=="BlankNode")return{quantifier:"one",start:"subject",end:"object",predicates:[r.term]};const e=r.out([ae.alternativePath]);if(e.ptrs.length===1&&e.ptrs[0].isList())return{quantifier:"one",start:"subject",end:"object",predicates:[...e.list()].map(a=>a.term)};const t=r.out([ae.inversePath]);if(t.term)return{quantifier:"one",start:"object",end:"subject",predicates:[t.term]};const i=r.out([ae.oneOrMorePath]);if(i.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[i.term]};const n=r.out([ae.zeroOrMorePath]);if(n.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[n.term]};const o=r.out([ae.zeroOrOnePath]);if(o.term)return{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[o.term]}}function Fh(r){return r.terms.length===0?null:r.ptrs[0].isList()?[...r.list()].map(e=>Hd(e)):[Hd(r)]}class Ph{constructor(e){this.shape=e,this._compiled=gt(()=>this.shape.validator.registry.compile(e))}get compiled(){return this._compiled()}async validate(e){return e.focusNode.dataset.size===0||(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 i of this.compiled)i.node&&await i.node(t),i.generic&&await i.generic(t)}async validateProperty(e){let t;this.shape.isSparqlShape?t=e.focusNode:t=e.focusNode.executeAll(this.shape.path);const i=t.node(new ut(t.terms)),n=[...t].reduce((a,s)=>{const d=s.term,l=t.node([d]);return a.has(d)||a.set(d,{value:l,valuePaths:[]}),a.get(d).valuePaths.push(s),a},new Or).values(),o=e.create({shape:this.shape,values:i});for(const a of this.compiled)a.property&&await a.property(o);for(const{value:a,valuePaths:s}of n){const d=e.create({shape:this.shape,value:a,valueOrNode:a,valuePaths:s});for(const l of this.compiled)l.generic&&await l.generic(d)}}}function ba(r){const e=new ut,i=new tn({dataset:r.dataset,terms:r.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[ah.subClassOf]});for(const n of i.ptrs)for(const{term:o}of n.nodes())e.add(o);return e}class Mh{constructor(e){this.targetClass=new ut([...ba(e.hasOut([cr.type],[ae.NodeShape])),...ba(e.out([ae.targetClass]))]),this.targetNode=e.out([ae.targetNode]).terms,this.targetObjectsOf=e.out([ae.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([ae.targetSubjectsOf]).terms}resolve(e){const t=e.focusNode.node([null]),i=[...e.focusNode.hasOut([cr.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],n=e.focusNode.clone({ptrs:i});return n.node([...new ut(n.terms)])}}class Bh{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=gt(()=>{const i=this.ptr.out([ae.deactivated]).term;return i&&ki.fromRdf(i)}),this._message=gt(()=>this.ptr.out([ae.message]).terms),this._path=gt(()=>Fh(this.ptr.out([ae.path]))),this._severity=gt(()=>this.ptr.out([ae.severity]).term),this._shapeValidator=gt(()=>new Ph(this)),this._sparql=gt(()=>this.ptr.out([ae.sparql])),this._targetResolver=gt(()=>new Mh(this.ptr))}get deactivated(){return this._deactivated()}get isPropertyShape(){return!!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 i of e.results.get(t))e.report.results.push(i);return e}return e.processed.add(t),this.shapeValidator.validate(e)}}function qh(r){const e=parseInt(r.ptr.out([ae.maxCount]).value);return{property:zh(e)}}function zh(r){return e=>{e.test(e.values.terms.length<=r,ae.MaxCountConstraintComponent,{args:{maxCount:r},message:[e.factory.literal("More than {$maxCount} values")]})}}function Uh(r){const e=parseInt(r.ptr.out([ae.minCount]).value);return{property:Hh(e)}}function Hh(r){return e=>{e.test(e.values.terms.length>=r,ae.MinCountConstraintComponent,{args:{minCount:r},message:[e.factory.literal("Less than {$minCount} values")]})}}async function Gh(r,e){for(const t of r)if(!await e(t))return!1;return!0}async function Vh(r,e){return(await Promise.all(r.map(t=>e(t)))).filter(Boolean)}async function bn(r,e){return Promise.all(r.map(e))}async function Wh(r,e){for(const t of r)if(await e(t))return!0;return!1}function Xh(r){const e=[...r.ptr.out([ae.and])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Qh(e)}}function Qh(r){return async e=>{const t=await bn(r,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),i=t.every(n=>n.conforms);e.test(i,ae.AndConstraintComponent,{results:t.flatMap(n=>n.results),value:e.valueOrNode})}}function Jh(r){const e=r.validator.shape(r.ptr.out([ae.not]));return{generic:Kh(e)}}function Kh(r){return async e=>{const t=(await r.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,i=!t.conforms;e.test(i,ae.NotConstraintComponent,{args:{not:r.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:t.results,value:e.valueOrNode})}}function Yh(r){const e=[...r.ptr.out([ae.or])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Zh(e)}}function Zh(r){return async e=>{let t=[],i;if(e.options.debug||e.options.details){const n=await bn(r,async o=>(await o.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report);t=n.flatMap(o=>o.results),i=n.some(o=>o.conforms)}else i=await Wh(r,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms);e.test(i,ae.OrConstraintComponent,{results:t,value:e.valueOrNode})}}function eb(r){const e=[...r.ptr.out([ae.xone])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:tb(e)}}function tb(r){return async e=>{const t=await bn(r,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),i=t.filter(n=>n.conforms).length===1;e.test(i,ae.XoneConstraintComponent,{results:t.flatMap(n=>n.results),value:e.valueOrNode})}}function rb(r){if(!ki.fromRdf(r.ptr.out([ae.closed]).term))return null;const t=r.ptr.out([ae.property]).map(o=>r.validator.shape(o)),i=new ut(t.filter(o=>!o.deactivated).map(o=>o.path[0].predicates[0])),n=new ut([...r.ptr.out([ae.ignoredProperties]).list()||[]].map(o=>o.term));return{node:ib(i,n)}}function ib(r,e){return t=>{const i=t.focusNode.execute({start:"subject",end:"predicate"}).filter(n=>e.has(n.term)?!1:!r.has(n.term));if(i.ptrs.length>0)for(const n of i)t.violation(ae.ClosedConstraintComponent,{message:[t.factory.literal("Predicate is not allowed (closed shape)")],path:[{quantifier:"one",start:"subject",end:"object",predicates:[n.term]}],value:t.focusNode.node([[...n.quads()][0].object])});else t.debug(ae.ClosedConstraintComponent)}}function nb(r){const e=r.ptr.out([ae.hasValue]).term;return{node:ob(e),property:ab(e)}}function ob(r){return e=>{e.test(r.equals(e.valueOrNode.term),ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Value must be {$hasValue}")]})}}function ab(r){return e=>{const t=[...e.values].some(i=>r.equals(i.term));e.test(t,ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Missing expected value {$hasValue}")]})}}function sb(r){const e=new ut([...r.ptr.out([ae.in]).list()].map(t=>t.term));return{generic:lb(e)}}function lb(r){return e=>{e.test(r.has(e.valueOrNode.term),ae.InConstraintComponent,{args:{in:[...r].map(t=>t.value).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})}}function Cr(r,e){if(!r||r.termType!=="Literal"||!e||e.termType!=="Literal"||Gd(r)!==Gd(e))return null;const t=ki.fromRdf(r),i=ki.fromRdf(e);return typeof t!=typeof i?null:typeof t=="string"?t.localeCompare(i):t-i}function Gd(r){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return Ha.dateTime.equals(r.datatype)&&e.test(r.value)}function db(r){const e=r.ptr.out([ae.disjoint]).term;return{generic:cb(e)}}function cb(r){return e=>{const t=e.focusNode.dataset.match(e.focusNode.term,r,e.valueOrNode.term);e.test(t.size===0,ae.DisjointConstraintComponent,{args:{disjoint:r},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})}}function ub(r){const e=r.ptr.out([ae.equals]).term;return{node:fb(e),property:pb(e)}}function fb(r){return e=>{const t=e.focusNode.out([r]),i=t.filter(o=>!o.term.equals(e.focusNode.term)),n=t.terms.length!==0&&i.terms.length===0;e.test(n,ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:i.terms[0]&&e.focusNode.node([i.terms[0]])||e.focusNode})}}function pb(r){return e=>{const t=new ut(e.focusNode.out([r]).terms),i=new ut(e.values.terms),n=[...i].filter(s=>!t.has(s)),o=[...t].filter(s=>!i.has(s)),a=[...n,...o];for(const s of a)e.violation(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:e.focusNode.node([s])});a.length===0&&e.debug(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")]})}}function hb(r){const e=r.ptr.out([ae.lessThan]).term;return{property:bb(e)}}function bb(r){return e=>{const t=e.focusNode.out([r]).terms;for(const i of e.values)for(const n of t){const o=Cr(i.term,n);o===null||o>=0?e.violation(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:i}):e.debug(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:i})}}}function mb(r){const e=r.ptr.out([ae.lessThanOrEquals]).term;return{property:gb(e)}}function gb(r){return e=>{const t=e.focusNode.out([r]).terms;for(const i of e.values)for(const n of t){const o=Cr(i.term,n);o===null||o>0?e.violation(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:i}):e.debug(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:i})}}}function vb(r){const e=r.ptr.out([ae.maxExclusive]).term;return{generic:yb(e)}}function yb(r){return e=>{const t=Cr(e.valueOrNode.term,r);e.test(t!==null&&t<0,ae.MaxExclusiveConstraintComponent,{args:{maxExclusive:r},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})}}function wb(r){const e=r.ptr.out([ae.maxInclusive]).term;return{generic:xb(e)}}function xb(r){return e=>{const t=Cr(e.valueOrNode.term,r);e.test(t!==null&&t<=0,ae.MaxInclusiveConstraintComponent,{args:{maxInclusive:r},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})}}function _b(r){const e=r.ptr.out([ae.minExclusive]).term;return{generic:kb(e)}}function kb(r){return e=>{const t=Cr(e.valueOrNode.term,r);e.test(t!==null&&t>0,ae.MinExclusiveConstraintComponent,{args:{minExclusive:r},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})}}function Eb(r){const e=r.ptr.out([ae.minInclusive]).term;return{generic:Sb(e)}}function Sb(r){return e=>{const t=Cr(e.valueOrNode.term,r);e.test(t!==null&&t>=0,ae.MinInclusiveConstraintComponent,{args:{minInclusive:r},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})}}function Rb(r){const e=[...r.ptr.out([ae.node])].map(t=>r.validator.shape(t));return{generic:Nb(e)}}function Nb(r){return async e=>{for(const t of r){const i=await t.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(i.report.conforms,ae.NodeConstraintComponent,{args:{node:t.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:i.report.results,value:e.valueOrNode})}}}function Ib(r){const e=[...r.ptr.out([ae.property])].map(t=>r.validator.shape(t));return{generic:Tb(e)}}function Tb(r){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const i of r)await i.validate(t)}}function Ab(r){const e=r.validator.shape(r.ptr.out([ae.qualifiedValueShape])),t=r.ptr.out([ae.qualifiedValueShapesDisjoint]).term,i=t?ki.fromRdf(t):!1,n=r.ptr.out([ae.qualifiedMaxCount]).term,o=n?parseInt(n.value):null,a=r.ptr.out([ae.qualifiedMinCount]).term,s=a?parseInt(a.value):null;return{property:jb(e,i,o,s)}}function jb(r,e,t,i){return async n=>{const o=[];let a=[];e&&(a=new Set(n.shape.ptr.in([ae.property]).out([ae.property]).out([ae.qualifiedValueShape]).filter(d=>!d.term.equals(r.ptr.term)).map(d=>n.shape.validator.shape(d))));const s=(await Vh(n.values,async d=>{const l=(await r.validate(n.create({child:!0,focusNode:d}))).report;if(o.push(l.results),!l.conforms)return!1;if(a.length===0)return!0;if(n.options.debug||n.options.details){const c=await bn([...a],async u=>(await u.validate(n.create({child:!0,focusNode:d}))).report);return o.push(c.flatMap(u=>u.results)),!c.every(u=>u.conforms)}else return!await Gh([...a],async c=>(await c.validate(n.create({child:!0,focusNode:d}))).report.conforms)})).length;t!==null&&n.test(s<=t,ae.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:t,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[n.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:o.flat()}),i!==null&&n.test(s>=i,ae.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:i,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[n.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:o.flat()})}}function Db(r,e){return e?e.slice(0,r.length)===r:!1}function Lb(r){const e=[...new Set([...r.ptr.out([ae.languageIn]).list()].map(t=>t.value))];return{generic:Ob(e)}}function Ob(r){return e=>{const t=r.some(i=>Db(i,e.valueOrNode.term.language));e.test(t,ae.LanguageInConstraintComponent,{args:{languageIn:r.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})}}function Cb(r){const e=parseInt(r.ptr.out([ae.maxLength]).value);return{generic:$b(e)}}function $b(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length<=r;e.test(t,ae.MaxLengthConstraintComponent,{args:{maxLength:r},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})}}function Fb(r){const e=parseInt(r.ptr.out([ae.minLength]).value);return{generic:Pb(e)}}function Pb(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length>=r;e.test(t,ae.MinLengthConstraintComponent,{args:{minLength:r},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})}}function Mb(r){const e=r.ptr.out([ae.pattern]).value,t=r.ptr.out([ae.flags]).value,i=new RegExp(e,t);return{generic:Bb(e,t,i)}}function Bb(r,e,t){return i=>{i.test(t.test(i.valueOrNode.term.value),ae.PatternConstraintComponent,{args:{flags:e,pattern:r},message:[i.factory.literal('Value does not match pattern "{$pattern}"')],value:i.valueOrNode})}}function qb(r){const e=r.ptr.out([ae.uniqueLang]).term;return e.value==="true"&&Ha.boolean.equals(e.datatype)?{property:zb()}:null}function zb(){return r=>{const t=Object.entries(r.values.terms.reduce((i,n)=>(n.language&&(i[n.language]=(i[n.language]||0)+1),i),{})).filter(([,i])=>i>1);for(const[i]of t)r.violation(ae.UniqueLangConstraintComponent,{args:{lang:i},message:[r.factory.literal('Language "{?lang}" used more than once')]});t.length===0&&r.debug(ae.UniqueLangConstraintComponent)}}const Ji=ht("http://www.w3.org/ns/shacl#"),Kc=ht("https://schemas.link/shacl-next#");class jr{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(Ji.Info)||e.severity.equals(Ji.Violation)||e.severity.equals(Ji.Warning))}}function Ub(r,e){return Object.entries(e).reduce((t,[i,n])=>(n&&n.termType&&(n=st(n)),t.replace(`{$${i}}`,n).replace(`{?${i}}`,n)),r)}class rn{constructor({args:e={},factory:t,message:i=[],severity:n=Ji.Violation}={}){this.severity=n,this.message=i.map(o=>t.literal(Ub(o.value,e),o.language||null))}}class Va{constructor({factory:e=Ua}={}){this.factory=e}clone({factory:e}={}){return new Va({factory:e||this.factory})}validate(){return new jr}validateSimple(){return!0}}class $r extends Va{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(const i of Array.isArray(e)?e:[e])i&&this.datatypes.push(this.factory.fromTerm(i))}clone({factory:e}={}){return new $r({datatypes:this.datatypes,factory:e||this.factory})}}class Hb{constructor({factory:e=Ua,validations:t}={}){if(this.factory=e,this.validations=new Or,t)for(const i of Object.values(t)){const n=i.clone({factory:this.factory});for(const o of n.datatypes)this.validations.set(o,n)}}validate(e){const t=this.validations.get(e.datatype);return t?t.validate(e):new jr}validateSimple(e){const t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}}class Pe extends $r{constructor(e,t,{factory:i}={}){super({datatypes:t,factory:i}),this.message=[this.factory.literal("term value {$this} matches pattern {$pattern}")],this.patterns=Array.isArray(e)?e:[e]}clone({factory:e}={}){return new Pe(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map(i=>{let n;i.test(e.value)&&(n=Kc.Debug);const o={pattern:this.factory.literal(i.toString()),this:e};return new rn({args:o,factory:this.factory,message:this.message,severity:n})});return new jr({results:t})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}}const Gb=/^([-+]?[0-9]+)$/;class ot extends Pe{constructor(e=null,t=null,i,{factory:n}={}){super(Gb,i,{factory:n}),this.maxInclusive=null,this.minInclusive=null,typeof t=="string"&&(this.maxInclusive=BigInt(t)),typeof e=="string"&&(this.minInclusive=BigInt(e))}clone({factory:e}={}){return new ot(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!Kc.Debug.equals(t[0].severity))return new jr({results:t});const i=BigInt(e.value);if(this.minInclusive!==null&&i<this.minInclusive){const n=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,o=[this.factory.literal(n)];t.push(new rn({factory:this.factory,message:o}))}if(this.maxInclusive!==null&&i>this.maxInclusive){const n=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,o=[this.factory.literal(n)];t.push(new rn({factory:this.factory,message:o}))}return new jr({results:t})}validateSimple(e){if(!super.validateSimple(e))return!1;const t=BigInt(e.value);return!(this.minInclusive!==null&&t<this.minInclusive||this.maxInclusive!==null&&t>this.maxInclusive)}}class Wa extends $r{constructor(e,t,{factory:i}={}){super({datatypes:t,factory:i}),this.values=new Set(e)}clone({factory:e}={}){return new Wa(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const i=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,n=[this.factory.literal(i)];t.push(new rn({factory:this.factory,message:n}))}return new jr({results:t})}validateSimple(e){return this.values.has(e.value)}}const Ie={xsd:ht("http://www.w3.org/2001/XMLSchema#")},Vb=new $r({datatypes:Ie.xsd.anySimpleType}),Wb=new $r({datatypes:Ie.xsd.anyAtomicType}),mn=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,Xb=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,Yc=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,Xa=/^(-?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)))))$/,Zc=/^(-?([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))?)$/,Qb=/^((([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))?)$/,Jb=/^(-?([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))?)$/,Kb=/^(-?([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))?)$/,Yb=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Zb=/^(--(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))?)$/,em=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,tm=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,rm=/^(([0-9a-fA-F]{2})*)$/,im=/^(((([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] ?= ?=))?)$/,nm=new Pe(mn,Ie.xsd.string),om=new Wa(["1","true","0","false"],Ie.xsd.boolean),am=new Pe(Xb,Ie.xsd.decimal),sm=new Pe(Yc,Ie.xsd.float),lm=new Pe(Yc,Ie.xsd.double),dm=new Pe(Xa,Ie.xsd.duration),cm=new Pe(Zc,Ie.xsd.dateTime),um=new Pe(Qb,Ie.xsd.time),fm=new Pe(Jb,Ie.xsd.date),pm=new Pe(Kb,Ie.xsd.gYearMonth),hm=new Pe(Yb,Ie.xsd.gYear),bm=new Pe(Zb,Ie.xsd.gMonthDay),mm=new Pe(em,Ie.xsd.gDay),gm=new Pe(tm,Ie.xsd.gMonth),vm=new Pe(rm,Ie.xsd.hexBinary),ym=new Pe(im,Ie.xsd.base64Binary),wm=new Pe(mn,Ie.xsd.anyURI),eu=/^([^\u000d\u000a\u0009]*)$/,xm=/^([^ ]+( [^ ]+)*)*$/,_m=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,km=/^([^DT]*)$/,Em=/^([^YM]*[DT].*)$/,Sm=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Rm=new Pe([mn,eu],Ie.xsd.normalizedString),Nm=new Pe([mn,eu,xm],Ie.xsd.token),Im=new Pe(_m,Ie.xsd.language),Tm=new ot(null,null,Ie.xsd.integer),Am=new ot(null,"0",Ie.xsd.nonPositiveInteger),jm=new ot(null,"-1",Ie.xsd.negativeInteger),Dm=new ot("-9223372036854775808","9223372036854775807",Ie.xsd.long),Lm=new ot("-2147483648","2147483647",Ie.xsd.int),Om=new ot("-32768","32767",Ie.xsd.short),Cm=new ot("-128","127",Ie.xsd.byte),$m=new ot("0",null,Ie.xsd.nonNegativeInteger),Fm=new ot("0","18446744073709551615",Ie.xsd.unsignedLong),Pm=new ot("0","4294967295",Ie.xsd.unsignedInt),Mm=new ot("0","65535",Ie.xsd.unsignedShort),Bm=new ot("0","255",Ie.xsd.unsignedByte),qm=new ot("1",null,Ie.xsd.positiveInteger),zm=new Pe([Xa,km],Ie.xsd.yearMonthDuration),Um=new Pe([Xa,Em],Ie.xsd.dayTimeDuration),Hm=new Pe([Zc,Sm],Ie.xsd.dateTimeStamp),Gm=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:Wb,anySimpleType:Vb,anyURI:wm,base64Binary:ym,boolean:om,byte:Cm,date:fm,dateTime:cm,dateTimeStamp:Hm,dayTimeDuration:Um,decimal:am,double:lm,duration:dm,float:sm,gDay:mm,gMonth:gm,gMonthDay:bm,gYear:hm,gYearMonth:pm,hexBinary:vm,int:Lm,integer:Tm,language:Im,long:Dm,negativeInteger:jm,nonNegativeInteger:$m,nonPositiveInteger:Am,normalizedString:Rm,positiveInteger:qm,short:Om,string:nm,time:um,token:Nm,unsignedByte:Bm,unsignedInt:Pm,unsignedLong:Fm,unsignedShort:Mm,yearMonthDuration:zm},Symbol.toStringTag,{value:"Module"}));class Vm extends Hb{constructor({factory:e}={}){super({factory:e,validations:{...Gm}})}}const Wm=new Or([[ae.BlankNode,new Set(["BlankNode"])],[ae.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[ae.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[ae.IRI,new Set(["NamedNode"])],[ae.IRIOrLiteral,new Set(["NamedNode","Literal"])],[ae.Literal,new Set(["Literal"])]]);function Xm(r){const e=r.ptr.out([ae.class]).map(t=>ba(t));return{generic:Qm(e)}}function Qm(r){return e=>{const t=new ut(e.valueOrNode.out([cr.type]).terms);for(const i of r){const n=[...t].some(o=>i.has(o));e.test(n,ae.ClassConstraintComponent,{value:e.valueOrNode})}}}function Jm(r){const e=r.ptr.out([ae.datatype]).term,t=new Vm;return{generic:Km(e,t)}}function Km(r,e){return t=>{const i=r.equals(t.valueOrNode.term.datatype)&&e.validateSimple(t.valueOrNode.term);t.test(i,ae.DatatypeConstraintComponent,{args:{datatype:r},message:[t.factory.literal("Value does not have datatype {$datatype}")],value:t.valueOrNode})}}function Ym(r){const e=r.ptr.out([ae.nodeKind]).term,t=Wm.get(e);return{generic:Zm(e,t)}}function Zm(r,e){return t=>{t.test(e.has(t.valueOrNode.term.termType),ae.NodeKindConstraintComponent,{args:{nodeKind:r},message:[t.factory.literal("Value does not have node kind {$nodeKind}")],value:t.valueOrNode})}}const eg=new Or([[ae.maxCount,qh],[ae.minCount,Uh],[ae.and,Xh],[ae.not,Jh],[ae.or,Yh],[ae.xone,eb],[ae.closed,rb],[ae.hasValue,nb],[ae.in,sb],[ae.disjoint,db],[ae.equals,ub],[ae.lessThan,hb],[ae.lessThanOrEquals,mb],[ae.maxExclusive,vb],[ae.maxInclusive,wb],[ae.minExclusive,_b],[ae.minInclusive,Eb],[ae.node,Rb],[ae.property,Ib],[ae.qualifiedValueShape,Ab],[ae.languageIn,Lb],[ae.maxLength,Cb],[ae.minLength,Fb],[ae.pattern,Mb],[ae.uniqueLang,qb],[ae.class,Xm],[ae.datatype,Jm],[ae.nodeKind,Ym]]);class tg{constructor(e,{factory:t,...i}){if(this.factory=t,this.options=i,this.registry=new Th(eg),this.shapesPtr=new tn({dataset:e,factory:t}),this.shapes=new Or,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0),this.options.validations)for(const[o,a]of this.options.validations)this.registry.validations.set(o,a);const n=[...this.shapesPtr.hasOut([ae.targetClass]),...this.shapesPtr.hasOut([ae.targetNode]),...this.shapesPtr.hasOut([ae.targetObjectsOf]),...this.shapesPtr.hasOut([ae.targetSubjectsOf]),...this.shapesPtr.hasOut([cr.type],[ae.NodeShape]),...this.shapesPtr.hasOut([cr.type],[ae.PropertyShape])];for(const o of n)this.shape(o)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new Bh(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const i=new tn({...e,factory:this.factory}),n=new Ga({factory:this.factory,focusNode:i,options:this.options,validator:this});t?t=t.map(o=>this.shape(this.shapesPtr.node(o.terms))):t=this.shapes.values();for(const o of t){const a=n.create({shape:o});let s;i.isAny()?s=o.resolveTargets(a):s=i;for(const d of s)await o.validate(a.create({focusNode:d}))}return n.report}}let rg=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new ld(e,this.form),this.form.addEventListener("change",t=>{t.stopPropagation(),this.config.editMode&&this.validate(!0).then(i=>{this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:i.conforms,report:i}}))}).catch(i=>{console.warn(i)})})}static get observedAttributes(){return ld.dataAttributes()}connectedCallback(){this.shadowRoot.prepend(this.form)}attributeChangedCallback(){this.config.updateAttributes(this),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.initDebounceTimeout=setTimeout(async()=>{this.form.replaceChildren(document.createTextNode(this.config.attributes.loading));try{await this.config.loader.loadGraphs(),this.form.replaceChildren(),this.config.renderedNodes.clear();const e=this.findRootShaclShapeSubject();if(e){this.form.classList.forEach(i=>{this.form.classList.remove(i)}),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 i of Zu())i.stylesheet&&t.push(i.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new Gt(e,this.config,this.config.attributes.valuesSubject?Ne.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.editMode){if(this.config.attributes.submitButton!==null){const i=this.config.theme.createButton(this.config.attributes.submitButton||"Submit",!0);i.addEventListener("click",n=>{n.preventDefault(),this.form.reportValidity()&&this.validate().then(o=>{if(o?.conforms)this.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}));else{let a=this.form.querySelector(":scope .invalid > .editor");a?a.focus():this.form.querySelector(":scope .invalid")?.scrollIntoView()}})}),this.form.appendChild(i)}this.config.attributes.valuesSubject&&this.removeFromDataGraph(Ne.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,hi)>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()){const i=t.getQuads(null,null,null,null);return Qu(i,e,this.config.prefixes)}toRDF(e=new tt){return this.shape?.toRDF(e),e}registerPlugin(e){Yu(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setSharedShapesGraph(e){Hp(e),this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}async validate(e=!1){for(const t of this.form.querySelectorAll(":scope .validation-error"))t.remove();for(const t of this.form.querySelectorAll(":scope .property-instance"))t.classList.remove("invalid"),t.querySelector(":scope > .editor")?.value?t.classList.add("valid"):t.classList.remove("valid");this.config.store.deleteGraph(this.config.valuesGraphId||""),this.shape?.toRDF(this.config.store),this.shape&&this.config.store.add(new on(this.shape.shaclSubject,Ne.namedNode(_e+"targetNode"),this.shape.nodeId,this.config.valuesGraphId));try{const t=this.config.store,i=await new tg(t,{details:!0,factory:Ne}).validate({dataset:t});for(const n of i.results)if(n.focusNode?.ptrs?.length)for(const o of n.focusNode.ptrs){const a=o._term;if(n.path?.length){const s=n.path[0].predicates[0];let d=this.form.querySelectorAll(`
|
|
369
|
+
`}function Wp(){return""}function Hc(r){return"<"+r.value+">"}const Xp=/["\\\\\n\r]/,Qp=/["\\\\\n\r]/g,Jp={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function Kp(r){return Jp[r]}function Yp(r){return Xp.test(r)?r.replace(Qp,Kp):r}function Zp(r){const e=Yp(r.value);return r.datatype.value==="http://www.w3.org/2001/XMLSchema#string"?'"'+e+'"':r.datatype.value==="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"?'"'+e+'"@'+r.language:'"'+e+'"^^'+Hc(r.datatype)}function eh(r,e){const t=e(r.subject),i=e(r.predicate),n=e(r.object),o=e(r.graph);return`${t} ${i} ${n} ${o?o+" ":""}.`}function th(r){return"?"+r.value}function st(r){if(!r)return null;if(r.termType==="BlankNode")return Gp(r);if(r.termType==="DefaultGraph")return Wp();if(r.termType==="Literal")return Zp(r);if(r.termType==="NamedNode")return Hc(r);if(r.termType==="Quad"||r.subject&&r.predicate&&r.object&&r.graph)return eh(r,st);if(r.termType==="Variable")return th(r);if(r[Symbol.iterator])return Vp(r,st);throw new Error(`unknown termType ${r.termType}`)}class Or{constructor(e){if(this.index=new Map,e)for(const[t,i]of e)this.set(t,i)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(st(e))}*entries(){for(const[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(const i of this.entries())e.call(t,i[1],i[0],this)}get(e){const t=this.index.get(st(e));return t&&t.value}has(e){return this.index.has(st(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const i=st(e);return this.index.set(i,{term:e,value:t}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}class dd{constructor({dataset:e,end:t,quad:i,start:n}){this.dataset=e,this.end=t,this.quad=i,this.start=n}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}}function cd(r){try{return st(r)}catch{return null}}class ut{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=st(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(cd(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(cd(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}class Gc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Gc.prototype.termType="BlankNode";class qa{equals(e){return!!e&&e.termType===this.termType}}qa.prototype.termType="DefaultGraph";qa.prototype.value="";function ud(r,e){if(!e)return null;if(e.termType==="BlankNode")return r.blankNode(e.value);if(e.termType==="DefaultGraph")return r.defaultGraph();if(e.termType==="Literal")return r.literal(e.value,e.language||r.namedNode(e.datatype.value));if(e.termType==="NamedNode")return r.namedNode(e.value);if(e.termType==="Quad"){const t=r.fromTerm(e.subject),i=r.fromTerm(e.predicate),n=r.fromTerm(e.object),o=r.fromTerm(e.graph);return r.quad(t,i,n,o)}if(e.termType==="Variable")return r.variable(e.value);throw new Error(`unknown termType ${e.termType}`)}class Qi{constructor(e,t,i,n=""){this.value=e,this.language=t,this.datatype=i,this.direction=n}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value&&e.language===this.language&&e.datatype.equals(this.datatype)&&(e.direction||"")===this.direction}}Qi.prototype.termType="Literal";class Ii{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Ii.prototype.termType="NamedNode";class za{constructor(e,t,i,n){this.subject=e,this.predicate=t,this.object=i,this.graph=n}equals(e){return!!e&&(e.termType==="Quad"||!e.termType)&&e.subject.equals(this.subject)&&e.predicate.equals(this.predicate)&&e.object.equals(this.object)&&e.graph.equals(this.graph)}}za.prototype.termType="Quad";za.prototype.value="";class Vc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Vc.prototype.termType="Variable";const rh=new Ii("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),fd=new Ii("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),ih=new Ii("http://www.w3.org/2001/XMLSchema#string");class Wc{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new qa}}namedNode(e){return new Ii(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new Gc(e)}literal(e,t){return typeof t=="string"?new Qi(e,t,fd):typeof t?.language=="string"?new Qi(e,t.language,t.direction?rh:fd,t.direction):new Qi(e,"",t||ih)}variable(e){return new Vc(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,i,n=this.defaultGraph()){return new za(e,t,i,n)}fromTerm(e){return ud(this,e)}fromQuad(e){return ud(this,e)}}Wc.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const Ua=new Wc,nh={apply:(r,e,t)=>r(t[0]),get:(r,e)=>r(e)};function ht(r,{factory:e=Ua}={}){const t=(i="")=>e.namedNode(`${r}${i.raw||i}`);return typeof Proxy>"u"?t:new Proxy(t,nh)}ht("http://www.w3.org/2001/XMLSchema#");const xt=ht("http://www.w3.org/1999/02/22-rdf-syntax-ns#");ht("http://www.w3.org/2000/01/rdf-schema#");class $e{static add({ptr:e,start:t,end:i,subjects:n=[null],predicates:o=[null],objects:a=[null],graphs:s,callback:d}={}){if(!e.factory)throw new Error("add operation requires a factory");let l=()=>{};d&&(l=c=>{d(new dd({dataset:e.dataset,start:t,end:i,quad:c}))});for(const c of n)for(const u of o)for(const v of a)for(const g of s){const y={subject:c,predicate:u,object:v,graph:g};y[t]=e.term;const k=e.factory.quad(y.subject,y.predicate,y.object,y.graph);e.dataset.add(k),l(k)}return e}static addList({ptr:e,predicates:t,items:i,graphs:n}){if(e.isAny())throw new Error("can't attach a list to an any ptr");for(const o of t)for(const a of n){const s=i.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,o,s[0]||xt.nil,a));for(let d=0;d<s.length;d++)e.dataset.add(e.factory.quad(s[d],xt.first,i[d],a)),e.dataset.add(e.factory.quad(s[d],xt.rest,s[d+1]||xt.nil,a))}return e}static delete({ptr:e,start:t,subjects:i=[null],predicates:n=[null],objects:o=[null]}){for(const a of i)for(const s of n)for(const d of o){const l={subject:a,predicate:s,object:d};l[t]=e.term;const c=e.dataset.match(l.subject,l.predicate,l.object);for(const u of c)e.dataset.delete(u)}return e}static deleteList({ptr:e,predicates:t}){const i=[];for(const n of t)for(const o of e.dataset.match(e.term,n)){let a=o.object;for(i.push(o);!xt.nil.equals(a);){a=i[i.length-1].object;const s=e.dataset.match(a);if(s.size===0)break;for(const d of s)i.push(d)}}for(const n of i)e.dataset.delete(n);return e}static execute({ptr:e,operation:t="traverse",quantifier:i,start:n,end:o,subjects:a,predicates:s,objects:d,graphs:l,items:c,callback:u}={}){if(t==="add")return $e.add({ptr:e,start:n,end:o,subjects:a,predicates:s,objects:d,graphs:l,callback:u});if(t==="addList")return $e.addList({ptr:e,predicates:s,items:c,graphs:l});if(t==="delete")return $e.delete({ptr:e,start:n,subjects:a,predicates:s,objects:d});if(t==="deleteList")return $e.deleteList({ptr:e,predicates:s});if(t==="isList")return $e.isList({ptr:e});if(t==="list")return $e.list({ptr:e});if(t==="traverse")return $e.traverse({ptr:e,quantifier:i,start:n,end:o,subjects:a,predicates:s,objects:d,graphs:l});throw new Error(`unknown operation ${t}`)}static isList({ptr:e}){return e.isAny()?!1:!!(xt.nil.equals(e.term)||$e.traverse({ptr:e,predicates:[xt.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(xt.nil);){const t=e.out([xt.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const i=e.out([xt.rest]);if(i.length!==1)throw new Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=i[0]}}}}static traverse({ptr:e,quantifier:t="one",start:i="subject",end:n="object",subjects:o=[null],predicates:a=[null],objects:s=[null],graphs:d=[null],callback:l}){if(t==="one")return $e.traverseOne({ptr:e,start:i,end:n,subjects:o,predicates:a,objects:s,graphs:d,callback:l});if(t==="oneOrMore"){const c=$e.traverse({ptr:e,end:n,start:i,subjects:o,predicates:a,objects:s,graphs:d,callback:l});return $e.traverseMore({ptrs:c,end:n,start:i,subjects:o,predicates:a,objects:s,graphs:d,callback:l})}if(t==="zeroOrMore")return $e.traverseMore({ptrs:[e],end:n,start:i,subjects:o,predicates:a,objects:s,graphs:d,callback:l});if(t==="zeroOrOne")return[e,...$e.traverse({ptr:e,end:n,start:i,subjects:o,predicates:a,objects:s,graphs:d,callback:l})];throw new Error(`unknown quantifier ${t}`)}static traverseMore({ptrs:e,end:t,start:i,subjects:n,predicates:o,objects:a,graphs:s,callback:d}={}){let l=[...e],c,u;do{c=[];for(const v of e)c=[...c,...$e.traverseOne({ptr:v,end:t,start:i,subjects:n,predicates:o,objects:a,graphs:s,callback:d})];u&&(c=c.filter(v=>!u.has(v.term))),e=c,l=[...l,...c],u=new ut(l.map(v=>v.term))}while(c.length>0);return l}static traverseOne({ptr:e,start:t,end:i,subjects:n,predicates:o,objects:a,graphs:s,callback:d=(l,c)=>c.extend(l)}={}){const l=[];for(const c of n)for(const u of o)for(const v of a)for(const g of s){const y={subject:c,predicate:u,object:v,graph:g};y[t]=e.term;for(const k of e.dataset.match(y.subject,y.predicate,y.object,y.graph))l.push(d(new dd({dataset:e.dataset,end:i,quad:k,start:t}),e))}return l}}function pd(r,e){return e?t=>e(r.extend(t)):()=>{}}class hd{constructor({dataset:e,edges:t=[],factory:i,graph:n,term:o}){if(!e&&t.length===0)throw new Error("dataset or edges is required");if(t.length===0&&typeof o>"u")throw new Error("edges or term must be given");if(t.length>0&&o)throw new Error("edges or term must be given");this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=i,this._graph=n,t.length===0&&(this._term=o)}get edge(){return this.edges[this.edges.length-1]}get graph(){return typeof this._graph=="object"?this._graph:this.edge&&this.edge.graph}get length(){return this._term!==void 0?1:this.edges.length+1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return this._term!==void 0?this._term:this.edge.term}get value(){const e=this.term;return e===null?void 0:e.value}addIn(e,t,i){return $e.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:pd(this,i)})}addList(e,t){return $e.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,i){return $e.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:pd(this,i)})}deleteIn(e,t){return $e.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return $e.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return $e.delete({ptr:this,start:"subject",predicates:e,objects:t})}execute({operation:e,quantifier:t,start:i,end:n,subjects:o,predicates:a,objects:s,graphs:d,items:l,callback:c}){return $e.execute({ptr:this,operation:e,quantifier:t,start:i,end:n,subjects:o,predicates:a,objects:s,graphs:d,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 $e.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return $e.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return $e.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return $e.isList({ptr:this})}list(){return $e.list({ptr:this})}*nodes(){for(let e=0;e<this.length;e++)this._term!==void 0?yield{dataset:this.dataset,term:this._term}:this.edges.length>e?yield{dataset:this.edges[e].dataset,term:this.edges[e].startTerm}:this.edges.length===e&&(yield{dataset:this.edges[e-1].dataset,term:this.edges[e-1].term})}out(e,t){return $e.traverse({ptr:this,predicates:e,objects:t,graphs:[this.graph]})}*quads(){for(const{quad:e}of this.edges)yield e}trim(){return new this.constructor({dataset:this.dataset,factory:this.factory,graph:this.graph,term:this.term})}}function bd(r,e){return r?r.equals(e):r===e}function oh(r,e){return!(r.dataset!==e.dataset||!bd(r.graph,e.graph)||!bd(r.term,e.term))}function md(r,e){return e?t=>e(new r.constructor({factory:r.factory,ptrs:[t]})):()=>{}}class tn{constructor({dataset:e,factory:t,ptrs:i,terms:n,graphs:o}){if(this.factory=t,i)this.ptrs=[...i];else{this.ptrs=[];for(const a of n||[null])for(const s of o||[null])this.ptrs.push(new hd({dataset:e,factory:t,graph:s,term:a}))}}get dataset(){const e=new Set(this.datasets);return e.size!==1?null:e[Symbol.iterator]().next().value}get datasets(){return this.ptrs.map(e=>e.dataset)}get term(){const e=new ut(this.terms);if(e.size===1)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map(e=>e.term)}get value(){const e=this.term;return e?.value}get values(){return this.ptrs.map(e=>e.value)}addIn(e,t,i){const n=md(this,i);for(const o of this.ptrs)o.addIn(e,t,n);return this}addList(e,t){if(this.isAny())throw new Error("can't attach a list to an any ptr");for(const i of this.ptrs)i.addList(e,t);return this}addOut(e,t,i){const n=md(this,i);for(const o of this.ptrs)o.addOut(e,t,n);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(const i of this.ptrs)i.deleteIn(e,t);return this}deleteList(e){for(const t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(const i of this.ptrs)i.deleteOut(e,t);return this}distinct(){const e=this.ptrs.reduce((t,i)=>(t.some(n=>oh(n,i))||t.push(i.trim()),t),[]);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 i of e)t=t.execute(i);return t}filter(e){return this.clone({ptrs:[...this].filter(e).map(t=>t.ptrs[0])})}hasIn(e,t){return this.clone({ptrs:this.ptrs.flatMap(i=>i.hasIn(e,t))})}hasOut(e,t){return this.clone({ptrs:this.ptrs.flatMap(i=>i.hasOut(e,t))})}in(e,t){return this.clone({ptrs:this.ptrs.flatMap(i=>i.in(e,t))})}isAny(){return this.ptrs.length>0&&this.ptrs.some(e=>e.isAny())}isList(){return this.ptrs.length!==1?!1:this.ptrs[0].isList()}list(){if(!this.isList())return;const e=this.ptrs[0].list(),t=this;return function*(){for(const i of e)yield t.clone({ptrs:[i]})}()}map(e){return[...this].map(e)}node(e){const t=this.dataset,i=[...e].map(n=>new hd({dataset:t,factory:this.factory,term:n}));return this.clone({ptrs:i})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap(i=>i.out(e,t))})}*quads(){for(const{edges:e}of this.ptrs)for(const{quad:t}of e)yield t}trim(){return this.clone({ptrs:this.ptrs.map(e=>e.trim())})}*[Symbol.iterator](){for(const e of this.ptrs)yield this.clone({ptrs:[e]})}}ht("http://www.w3.org/2002/07/owl#");const cr=ht("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),ah=ht("http://www.w3.org/2000/01/rdf-schema#"),ae=ht("http://www.w3.org/ns/shacl#"),pa=ht("https://schemas.link/shacl-next#"),Ha=ht("http://www.w3.org/2001/XMLSchema#");function sh(r){return r?`{${[...r.quads()].map(e=>st(e)).join(" ")}}`:"{}"}function lh(r){return r?`{${r.map(e=>sh(e)).join(" ")}}`:"{}"}var Bo,gd;function dh(){if(gd)return Bo;gd=1;var r=/\s/;function e(t){for(var i=t.length;i--&&r.test(t.charAt(i)););return i}return Bo=e,Bo}var qo,vd;function ch(){if(vd)return qo;vd=1;var r=dh(),e=/^\s+/;function t(i){return i&&i.slice(0,r(i)+1).replace(e,"")}return qo=t,qo}var zo,yd;function uh(){if(yd)return zo;yd=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return zo=r,zo}var Uo,wd;function fh(){if(wd)return Uo;wd=1;var r=typeof kr=="object"&&kr&&kr.Object===Object&&kr;return Uo=r,Uo}var Ho,xd;function ph(){if(xd)return Ho;xd=1;var r=fh(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Ho=t,Ho}var Go,_d;function Xc(){if(_d)return Go;_d=1;var r=ph(),e=r.Symbol;return Go=e,Go}var Vo,kd;function hh(){if(kd)return Vo;kd=1;var r=Xc(),e=Object.prototype,t=e.hasOwnProperty,i=e.toString,n=r?r.toStringTag:void 0;function o(a){var s=t.call(a,n),d=a[n];try{a[n]=void 0;var l=!0}catch{}var c=i.call(a);return l&&(s?a[n]=d:delete a[n]),c}return Vo=o,Vo}var Wo,Ed;function bh(){if(Ed)return Wo;Ed=1;var r=Object.prototype,e=r.toString;function t(i){return e.call(i)}return Wo=t,Wo}var Xo,Sd;function mh(){if(Sd)return Xo;Sd=1;var r=Xc(),e=hh(),t=bh(),i="[object Null]",n="[object Undefined]",o=r?r.toStringTag:void 0;function a(s){return s==null?s===void 0?n:i:o&&o in Object(s)?e(s):t(s)}return Xo=a,Xo}var Qo,Rd;function gh(){if(Rd)return Qo;Rd=1;function r(e){return e!=null&&typeof e=="object"}return Qo=r,Qo}var Jo,Id;function vh(){if(Id)return Jo;Id=1;var r=mh(),e=gh(),t="[object Symbol]";function i(n){return typeof n=="symbol"||e(n)&&r(n)==t}return Jo=i,Jo}var Ko,Nd;function yh(){if(Nd)return Ko;Nd=1;var r=ch(),e=uh(),t=vh(),i=NaN,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt;function d(l){if(typeof l=="number")return l;if(t(l))return i;if(e(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=e(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=r(l);var u=o.test(l);return u||a.test(l)?s(l.slice(2),u?2:8):n.test(l)?i:+l}return Ko=d,Ko}var Yo,Td;function wh(){if(Td)return Yo;Td=1;var r=yh(),e=1/0,t=17976931348623157e292;function i(n){if(!n)return n===0?n:0;if(n=r(n),n===e||n===-e){var o=n<0?-1:1;return o*t}return n===n?n:0}return Yo=i,Yo}var Zo,Ad;function xh(){if(Ad)return Zo;Ad=1;var r=wh();function e(t){var i=r(t),n=i%1;return i===i?n?i-n:i:0}return Zo=e,Zo}var ea,jd;function _h(){if(jd)return ea;jd=1;var r=xh(),e="Expected a function";function t(i,n){var o;if(typeof n!="function")throw new TypeError(e);return i=r(i),function(){return--i>0&&(o=n.apply(this,arguments)),i<=1&&(n=void 0),o}}return ea=t,ea}var ta,Dd;function kh(){if(Dd)return ta;Dd=1;var r=_h();function e(t){return r(2,t)}return ta=e,ta}var Eh=kh();const gt=ru(Eh);let Ld=class{constructor({details:e,factory:t,options:i,results:n=[]}={}){this.details=e,this.factory=t,this.options=i,this.results=n,this._conforms=gt(()=>!this.results.some(o=>o.severity.equals(ae.Info)||o.severity.equals(ae.Violation)||o.severity.equals(ae.Warning))),this._ptr=gt(()=>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 tn({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([cr.type],[ae.ValidationReport]).addOut([ae.conforms],[this.factory.literal(this.conforms.toString(),Ha.boolean)]);for(const t of this.results)e.addOut([ae.result],[this.factory.blankNode()],i=>{t.build(i,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function Sh(r,e){return Object.entries(e).reduce((t,[i,n])=>(n&&n.termType&&(n=st(n)),t.replace(`{$${i}}`,n).replace(`{?${i}}`,n)),r)}let Rh=class{constructor({args:e={},constraintComponent:t,factory:i,focusNode:n,message:o=[],path:a,results:s=[],severity:d,shape:l,source:c=[],value:u,valuePaths:v=[]}={}){this.args=e,this.constraintComponent=t,this.factory=i,this.focusNode=n,this.path=a||l.path,this.results=s,this.severity=d,this.shape=l,this.source=c,this.value=u,this.valuePaths=v,this._message=gt(()=>(this.shape.message.length>0&&(o=this.shape.message),o.length===0&&(o=this.shape.ptr.node([this.constraintComponent]).out([ae.message]).terms),o.map(g=>i.literal(Sh(g.value,e),g.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([cr.type],[ae.ValidationResult]).addOut([ae.focusNode],this.focusNode.terms).addOut([ae.resultSeverity],[this.severity]).addOut([ae.sourceConstraint],this.source).addOut([ae.sourceConstraintComponent],[this.constraintComponent]).addOut([ae.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([ae.resultMessage],this.message);const i=n=>{if(n.quantifier==="one")return n.predicates.length>1?e.node([this.factory.blankNode()]).addList([ae.alternativePath],n.predicates):n.start==="object"?e.node([this.factory.blankNode()]).addOut([ae.inversePath],[n.predicates[0]]):e.node([n.predicates[0]]);if(n.quantifier==="oneOrMore")return e.node([this.factory.blankNode()]).addOut([ae.oneOrMorePath],[n.predicates[0]]);if(n.quantifier==="zeroOrMore")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrMorePath],[n.predicates[0]]);if(n.quantifier==="zeroOrOne")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrOnePath],[n.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([ae.resultPath],i(this.path[0]).terms):e.addList([ae.resultPath],this.path.map(n=>i(n).term))),typeof this.value<"u"&&e.addOut([ae.value],this.value.terms),t)for(const n of this.results)e.addOut([ae.detail],[this.factory.blankNode()],o=>{n.build(o,{details:t})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}};class Ga{constructor({factory:e,focusNode:t,options:i={debug:!1,details:!1},processed:n=new Set,report:o=new Ld({factory:e,options:i}),results:a=new Map,shape:s,value:d,valueOrNode:l,valuePaths:c,values:u}={}){this.factory=e,this.focusNode=t,this.options=i,this.processed=n,this.report=o,this.results=a,this.shape=s,this.value=d,this.valuePaths=c,this.valueOrNode=l,this.values=u}create({child:e,focusNode:t=this.focusNode,shape:i=this.shape,value:n=this.value,valueOrNode:o=this.valueOrNode,valuePaths:a=this.valuePaths,values:s=this.values}={}){return new Ga({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new Ld({factory:this.factory,options:this.options}):this.report,results:this.results,shape:i,value:n,valueOrNode:o,valuePaths:a,values:s})}id({shape:e=this.shape}={}){return`${st(e.ptr.term)} - ${st(this.focusNode.term)} - ${lh(this.valuePaths)}`}result(e){const t=new Rh({factory:this.factory,focusNode:this.focusNode,shape:this.shape,value:this.value,valuePaths:this.valuePaths,...e}),i=this.id();this.results.has(i)?this.results.get(i).add(t):this.results.set(i,new Set([t])),this.report.results.push(t)}debug(e,t){this.options.debug&&this.result({severity:pa.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:pa.Trace,constraintComponent:e,...t})}test(e,t,i){e?this.debug(t,i):this.violation(t,i)}violation(e,t){this.result({constraintComponent:e,severity:this.shape.severity||ae.Violation,...t})}}function Ih(){return{generic:Nh()}}function Nh(){return r=>{r.trace(pa.TraversalConstraintComponent,{args:{},message:[r.factory.literal("Traversal")],value:r.valueOrNode})}}class Th{constructor(e){this.validations=new Or(e)}compile(e){const t=e.validator.options.coverage;if(e.deactivated)return[];let i=!1;const n=new Set;for(const o of e.ptr.execute({start:"subject",end:"predicate"})){const a=this.validations.get(o.term);a&&(n.add(a),o.term.equals(ae.property)&&(i=!0))}return t&&e.isPropertyShape&&!i&&n.add(Ih),[...n].map(o=>o(e)).filter(Boolean)}}var rr={},ir={},ii={},ni={},Od;function Ar(){if(Od)return ni;Od=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.Translator=void 0;let r=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(t){throw new Error(`Invalid RDF ${t.datatype.value} value: '${t.value}'`)}registerHandler(t,i,n){for(const o of i)this.supportedRdfDatatypes.push(o),this.fromRdfHandlers[o.value]=t;for(const o of n){let a=this.toRdfHandlers[o];a||(this.toRdfHandlers[o]=a=[]),a.push(t)}}fromRdf(t,i){const n=this.fromRdfHandlers[t.datatype.value];return n?n.fromRdf(t,i):t.value}toRdf(t,i){const n=this.toRdfHandlers[typeof t];if(n)for(const o of n){const a=o.toRdf(t,i);if(a)return a}throw new Error(`Invalid JavaScript value: '${t}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}};return ni.Translator=r,ni}var Cd;function Ah(){if(Cd)return ii;Cd=1,Object.defineProperty(ii,"__esModule",{value:!0}),ii.TypeHandlerBoolean=void 0;const r=Ar();let e=class Qc{fromRdf(i,n){switch(i.value){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1}return n&&r.Translator.incorrectRdfDataType(i),!1}toRdf(i,{datatype:n,dataFactory:o}){return o.literal(i?"true":"false",n||o.namedNode(Qc.TYPE))}};return ii.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",ii}var oi={},$d;function jh(){if($d)return oi;$d=1,Object.defineProperty(oi,"__esModule",{value:!0}),oi.TypeHandlerDate=void 0;const r=Ar();let e=class ha{fromRdf(i,n){switch(n&&!i.value.match(ha.VALIDATORS[i.datatype.value.substr(33,i.datatype.value.length)])&&r.Translator.incorrectRdfDataType(i),i.datatype.value){case"http://www.w3.org/2001/XMLSchema#gDay":return new Date(0,0,parseInt(i.value,10));case"http://www.w3.org/2001/XMLSchema#gMonthDay":const o=i.value.split("-");return new Date(0,parseInt(o[0],10)-1,parseInt(o[1],10));case"http://www.w3.org/2001/XMLSchema#gYear":return new Date(i.value+"-01-01");case"http://www.w3.org/2001/XMLSchema#gYearMonth":return new Date(i.value+"-01");default:return new Date(i.value)}}toRdf(i,{datatype:n,dataFactory:o}){if(n=n||o.namedNode(ha.TYPES[0]),!(i instanceof Date))return null;const a=i;let s;switch(n.value){case"http://www.w3.org/2001/XMLSchema#gDay":s=String(a.getUTCDate());break;case"http://www.w3.org/2001/XMLSchema#gMonthDay":s=a.getUTCMonth()+1+"-"+a.getUTCDate();break;case"http://www.w3.org/2001/XMLSchema#gYear":s=String(a.getUTCFullYear());break;case"http://www.w3.org/2001/XMLSchema#gYearMonth":s=a.getUTCFullYear()+"-"+(a.getUTCMonth()+1);break;case"http://www.w3.org/2001/XMLSchema#date":s=a.toISOString().replace(/T.*$/,"");break;default:s=a.toISOString()}return o.literal(s,n)}};return oi.TypeHandlerDate=e,e.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"],e.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]$/},oi}var ai={},Fd;function Dh(){if(Fd)return ai;Fd=1,Object.defineProperty(ai,"__esModule",{value:!0}),ai.TypeHandlerNumberDouble=void 0;const r=Ar();let e=class Jc{fromRdf(i,n){const o=parseFloat(i.value);return n&&isNaN(o)&&r.Translator.incorrectRdfDataType(i),o}toRdf(i,{datatype:n,dataFactory:o}){return n=n||o.namedNode(Jc.TYPES[0]),isNaN(i)?o.literal("NaN",n):isFinite(i)?i%1===0?null:o.literal(i.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),n):o.literal(i>0?"INF":"-INF",n)}};return ai.TypeHandlerNumberDouble=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float"],ai}var si={},Pd;function Lh(){if(Pd)return si;Pd=1,Object.defineProperty(si,"__esModule",{value:!0}),si.TypeHandlerNumberInteger=void 0;const r=Ar();let e=class fi{fromRdf(i,n){const o=parseInt(i.value,10);return n&&(isNaN(o)||i.value.indexOf(".")>=0)&&r.Translator.incorrectRdfDataType(i),o}toRdf(i,{datatype:n,dataFactory:o}){return o.literal(String(i),n||(i<=fi.MAX_INT&&i>=fi.MIN_INT?o.namedNode(fi.TYPES[0]):o.namedNode(fi.TYPES[1])))}};return si.TypeHandlerNumberInteger=e,e.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"],e.MAX_INT=2147483647,e.MIN_INT=-2147483648,si}var li={},Md;function Oh(){if(Md)return li;Md=1,Object.defineProperty(li,"__esModule",{value:!0}),li.TypeHandlerString=void 0;let r=class{fromRdf(t){return t.value}toRdf(t,{datatype:i,dataFactory:n}){return n.literal(t,i)}};return li.TypeHandlerString=r,r.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/1999/02/22-rdf-syntax-ns#dirLangString","http://www.w3.org/2001/XMLSchema#time","http://www.w3.org/2001/XMLSchema#duration"],li}var Bd;function qd(){return Bd||(Bd=1,function(r){var e=ir&&ir.__createBinding||(Object.create?function(i,n,o,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(n,o);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[o]}}),Object.defineProperty(i,a,s)}:function(i,n,o,a){a===void 0&&(a=o),i[a]=n[o]}),t=ir&&ir.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),t(Ah(),r),t(jh(),r),t(Dh(),r),t(Lh(),r),t(Oh(),r)}(ir)),ir}var ra={},zd;function Ch(){return zd||(zd=1,Object.defineProperty(ra,"__esModule",{value:!0})),ra}var Ud;function $h(){return Ud||(Ud=1,function(r){var e=rr&&rr.__createBinding||(Object.create?function(g,y,k,x){x===void 0&&(x=k);var _=Object.getOwnPropertyDescriptor(y,k);(!_||("get"in _?!y.__esModule:_.writable||_.configurable))&&(_={enumerable:!0,get:function(){return y[k]}}),Object.defineProperty(g,x,_)}:function(g,y,k,x){x===void 0&&(x=k),g[x]=y[k]}),t=rr&&rr.__exportStar||function(g,y){for(var k in g)k!=="default"&&!Object.prototype.hasOwnProperty.call(y,k)&&e(y,g,k)};Object.defineProperty(r,"__esModule",{value:!0}),r.fromRdf=d,r.toRdf=l,r.getTermRaw=c,r.getSupportedRdfDatatypes=u,r.getSupportedJavaScriptPrimitives=v;const i=Fc(),n=qd(),o=Ar();t(qd(),r),t(Ch(),r),t(Ar(),r);const a=new i.DataFactory,s=new o.Translator;s.registerHandler(new n.TypeHandlerString,n.TypeHandlerString.TYPES.map(g=>a.namedNode(g)),["string"]),s.registerHandler(new n.TypeHandlerBoolean,[n.TypeHandlerBoolean.TYPE].map(g=>a.namedNode(g)),["boolean"]),s.registerHandler(new n.TypeHandlerNumberDouble,n.TypeHandlerNumberDouble.TYPES.map(g=>a.namedNode(g)),["number"]),s.registerHandler(new n.TypeHandlerNumberInteger,n.TypeHandlerNumberInteger.TYPES.map(g=>a.namedNode(g)),["number"]),s.registerHandler(new n.TypeHandlerDate,n.TypeHandlerDate.TYPES.map(g=>a.namedNode(g)),["object"]);function d(g,y){return s.fromRdf(g,y)}function l(g,y){return y&&"namedNode"in y&&(y={dataFactory:y}),y=y||{},y&&!y.dataFactory&&(y.dataFactory=a),s.toRdf(g,y)}function c(g,y){return g.termType==="Literal"?d(g,y):g.value}function u(){return s.getSupportedRdfDatatypes()}function v(){return s.getSupportedJavaScriptPrimitives()}}(rr)),rr}var ki=$h();function Hd(r){if(r.term.termType!=="BlankNode")return{quantifier:"one",start:"subject",end:"object",predicates:[r.term]};const e=r.out([ae.alternativePath]);if(e.ptrs.length===1&&e.ptrs[0].isList())return{quantifier:"one",start:"subject",end:"object",predicates:[...e.list()].map(a=>a.term)};const t=r.out([ae.inversePath]);if(t.term)return{quantifier:"one",start:"object",end:"subject",predicates:[t.term]};const i=r.out([ae.oneOrMorePath]);if(i.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[i.term]};const n=r.out([ae.zeroOrMorePath]);if(n.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[n.term]};const o=r.out([ae.zeroOrOnePath]);if(o.term)return{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[o.term]}}function Fh(r){return r.terms.length===0?null:r.ptrs[0].isList()?[...r.list()].map(e=>Hd(e)):[Hd(r)]}class Ph{constructor(e){this.shape=e,this._compiled=gt(()=>this.shape.validator.registry.compile(e))}get compiled(){return this._compiled()}async validate(e){return e.focusNode.dataset.size===0||(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 i of this.compiled)i.node&&await i.node(t),i.generic&&await i.generic(t)}async validateProperty(e){let t;this.shape.isSparqlShape?t=e.focusNode:t=e.focusNode.executeAll(this.shape.path);const i=t.node(new ut(t.terms)),n=[...t].reduce((a,s)=>{const d=s.term,l=t.node([d]);return a.has(d)||a.set(d,{value:l,valuePaths:[]}),a.get(d).valuePaths.push(s),a},new Or).values(),o=e.create({shape:this.shape,values:i});for(const a of this.compiled)a.property&&await a.property(o);for(const{value:a,valuePaths:s}of n){const d=e.create({shape:this.shape,value:a,valueOrNode:a,valuePaths:s});for(const l of this.compiled)l.generic&&await l.generic(d)}}}function ba(r){const e=new ut,i=new tn({dataset:r.dataset,terms:r.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[ah.subClassOf]});for(const n of i.ptrs)for(const{term:o}of n.nodes())e.add(o);return e}class Mh{constructor(e){this.targetClass=new ut([...ba(e.hasOut([cr.type],[ae.NodeShape])),...ba(e.out([ae.targetClass]))]),this.targetNode=e.out([ae.targetNode]).terms,this.targetObjectsOf=e.out([ae.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([ae.targetSubjectsOf]).terms}resolve(e){const t=e.focusNode.node([null]),i=[...e.focusNode.hasOut([cr.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],n=e.focusNode.clone({ptrs:i});return n.node([...new ut(n.terms)])}}class Bh{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=gt(()=>{const i=this.ptr.out([ae.deactivated]).term;return i&&ki.fromRdf(i)}),this._message=gt(()=>this.ptr.out([ae.message]).terms),this._path=gt(()=>Fh(this.ptr.out([ae.path]))),this._severity=gt(()=>this.ptr.out([ae.severity]).term),this._shapeValidator=gt(()=>new Ph(this)),this._sparql=gt(()=>this.ptr.out([ae.sparql])),this._targetResolver=gt(()=>new Mh(this.ptr))}get deactivated(){return this._deactivated()}get isPropertyShape(){return!!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 i of e.results.get(t))e.report.results.push(i);return e}return e.processed.add(t),this.shapeValidator.validate(e)}}function qh(r){const e=parseInt(r.ptr.out([ae.maxCount]).value);return{property:zh(e)}}function zh(r){return e=>{e.test(e.values.terms.length<=r,ae.MaxCountConstraintComponent,{args:{maxCount:r},message:[e.factory.literal("More than {$maxCount} values")]})}}function Uh(r){const e=parseInt(r.ptr.out([ae.minCount]).value);return{property:Hh(e)}}function Hh(r){return e=>{e.test(e.values.terms.length>=r,ae.MinCountConstraintComponent,{args:{minCount:r},message:[e.factory.literal("Less than {$minCount} values")]})}}async function Gh(r,e){for(const t of r)if(!await e(t))return!1;return!0}async function Vh(r,e){return(await Promise.all(r.map(t=>e(t)))).filter(Boolean)}async function bn(r,e){return Promise.all(r.map(e))}async function Wh(r,e){for(const t of r)if(await e(t))return!0;return!1}function Xh(r){const e=[...r.ptr.out([ae.and])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Qh(e)}}function Qh(r){return async e=>{const t=await bn(r,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),i=t.every(n=>n.conforms);e.test(i,ae.AndConstraintComponent,{results:t.flatMap(n=>n.results),value:e.valueOrNode})}}function Jh(r){const e=r.validator.shape(r.ptr.out([ae.not]));return{generic:Kh(e)}}function Kh(r){return async e=>{const t=(await r.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,i=!t.conforms;e.test(i,ae.NotConstraintComponent,{args:{not:r.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:t.results,value:e.valueOrNode})}}function Yh(r){const e=[...r.ptr.out([ae.or])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Zh(e)}}function Zh(r){return async e=>{let t=[],i;if(e.options.debug||e.options.details){const n=await bn(r,async o=>(await o.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report);t=n.flatMap(o=>o.results),i=n.some(o=>o.conforms)}else i=await Wh(r,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms);e.test(i,ae.OrConstraintComponent,{results:t,value:e.valueOrNode})}}function eb(r){const e=[...r.ptr.out([ae.xone])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:tb(e)}}function tb(r){return async e=>{const t=await bn(r,async n=>(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),i=t.filter(n=>n.conforms).length===1;e.test(i,ae.XoneConstraintComponent,{results:t.flatMap(n=>n.results),value:e.valueOrNode})}}function rb(r){if(!ki.fromRdf(r.ptr.out([ae.closed]).term))return null;const t=r.ptr.out([ae.property]).map(o=>r.validator.shape(o)),i=new ut(t.filter(o=>!o.deactivated).map(o=>o.path[0].predicates[0])),n=new ut([...r.ptr.out([ae.ignoredProperties]).list()||[]].map(o=>o.term));return{node:ib(i,n)}}function ib(r,e){return t=>{const i=t.focusNode.execute({start:"subject",end:"predicate"}).filter(n=>e.has(n.term)?!1:!r.has(n.term));if(i.ptrs.length>0)for(const n of i)t.violation(ae.ClosedConstraintComponent,{message:[t.factory.literal("Predicate is not allowed (closed shape)")],path:[{quantifier:"one",start:"subject",end:"object",predicates:[n.term]}],value:t.focusNode.node([[...n.quads()][0].object])});else t.debug(ae.ClosedConstraintComponent)}}function nb(r){const e=r.ptr.out([ae.hasValue]).term;return{node:ob(e),property:ab(e)}}function ob(r){return e=>{e.test(r.equals(e.valueOrNode.term),ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Value must be {$hasValue}")]})}}function ab(r){return e=>{const t=[...e.values].some(i=>r.equals(i.term));e.test(t,ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Missing expected value {$hasValue}")]})}}function sb(r){const e=new ut([...r.ptr.out([ae.in]).list()].map(t=>t.term));return{generic:lb(e)}}function lb(r){return e=>{e.test(r.has(e.valueOrNode.term),ae.InConstraintComponent,{args:{in:[...r].map(t=>t.value).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})}}function Cr(r,e){if(!r||r.termType!=="Literal"||!e||e.termType!=="Literal"||Gd(r)!==Gd(e))return null;const t=ki.fromRdf(r),i=ki.fromRdf(e);return typeof t!=typeof i?null:typeof t=="string"?t.localeCompare(i):t-i}function Gd(r){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return Ha.dateTime.equals(r.datatype)&&e.test(r.value)}function db(r){const e=r.ptr.out([ae.disjoint]).term;return{generic:cb(e)}}function cb(r){return e=>{const t=e.focusNode.dataset.match(e.focusNode.term,r,e.valueOrNode.term);e.test(t.size===0,ae.DisjointConstraintComponent,{args:{disjoint:r},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})}}function ub(r){const e=r.ptr.out([ae.equals]).term;return{node:fb(e),property:pb(e)}}function fb(r){return e=>{const t=e.focusNode.out([r]),i=t.filter(o=>!o.term.equals(e.focusNode.term)),n=t.terms.length!==0&&i.terms.length===0;e.test(n,ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:i.terms[0]&&e.focusNode.node([i.terms[0]])||e.focusNode})}}function pb(r){return e=>{const t=new ut(e.focusNode.out([r]).terms),i=new ut(e.values.terms),n=[...i].filter(s=>!t.has(s)),o=[...t].filter(s=>!i.has(s)),a=[...n,...o];for(const s of a)e.violation(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:e.focusNode.node([s])});a.length===0&&e.debug(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")]})}}function hb(r){const e=r.ptr.out([ae.lessThan]).term;return{property:bb(e)}}function bb(r){return e=>{const t=e.focusNode.out([r]).terms;for(const i of e.values)for(const n of t){const o=Cr(i.term,n);o===null||o>=0?e.violation(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:i}):e.debug(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:i})}}}function mb(r){const e=r.ptr.out([ae.lessThanOrEquals]).term;return{property:gb(e)}}function gb(r){return e=>{const t=e.focusNode.out([r]).terms;for(const i of e.values)for(const n of t){const o=Cr(i.term,n);o===null||o>0?e.violation(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:i}):e.debug(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:i})}}}function vb(r){const e=r.ptr.out([ae.maxExclusive]).term;return{generic:yb(e)}}function yb(r){return e=>{const t=Cr(e.valueOrNode.term,r);e.test(t!==null&&t<0,ae.MaxExclusiveConstraintComponent,{args:{maxExclusive:r},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})}}function wb(r){const e=r.ptr.out([ae.maxInclusive]).term;return{generic:xb(e)}}function xb(r){return e=>{const t=Cr(e.valueOrNode.term,r);e.test(t!==null&&t<=0,ae.MaxInclusiveConstraintComponent,{args:{maxInclusive:r},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})}}function _b(r){const e=r.ptr.out([ae.minExclusive]).term;return{generic:kb(e)}}function kb(r){return e=>{const t=Cr(e.valueOrNode.term,r);e.test(t!==null&&t>0,ae.MinExclusiveConstraintComponent,{args:{minExclusive:r},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})}}function Eb(r){const e=r.ptr.out([ae.minInclusive]).term;return{generic:Sb(e)}}function Sb(r){return e=>{const t=Cr(e.valueOrNode.term,r);e.test(t!==null&&t>=0,ae.MinInclusiveConstraintComponent,{args:{minInclusive:r},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})}}function Rb(r){const e=[...r.ptr.out([ae.node])].map(t=>r.validator.shape(t));return{generic:Ib(e)}}function Ib(r){return async e=>{for(const t of r){const i=await t.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(i.report.conforms,ae.NodeConstraintComponent,{args:{node:t.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:i.report.results,value:e.valueOrNode})}}}function Nb(r){const e=[...r.ptr.out([ae.property])].map(t=>r.validator.shape(t));return{generic:Tb(e)}}function Tb(r){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const i of r)await i.validate(t)}}function Ab(r){const e=r.validator.shape(r.ptr.out([ae.qualifiedValueShape])),t=r.ptr.out([ae.qualifiedValueShapesDisjoint]).term,i=t?ki.fromRdf(t):!1,n=r.ptr.out([ae.qualifiedMaxCount]).term,o=n?parseInt(n.value):null,a=r.ptr.out([ae.qualifiedMinCount]).term,s=a?parseInt(a.value):null;return{property:jb(e,i,o,s)}}function jb(r,e,t,i){return async n=>{const o=[];let a=[];e&&(a=new Set(n.shape.ptr.in([ae.property]).out([ae.property]).out([ae.qualifiedValueShape]).filter(d=>!d.term.equals(r.ptr.term)).map(d=>n.shape.validator.shape(d))));const s=(await Vh(n.values,async d=>{const l=(await r.validate(n.create({child:!0,focusNode:d}))).report;if(o.push(l.results),!l.conforms)return!1;if(a.length===0)return!0;if(n.options.debug||n.options.details){const c=await bn([...a],async u=>(await u.validate(n.create({child:!0,focusNode:d}))).report);return o.push(c.flatMap(u=>u.results)),!c.every(u=>u.conforms)}else return!await Gh([...a],async c=>(await c.validate(n.create({child:!0,focusNode:d}))).report.conforms)})).length;t!==null&&n.test(s<=t,ae.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:t,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[n.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:o.flat()}),i!==null&&n.test(s>=i,ae.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:i,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[n.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:o.flat()})}}function Db(r,e){return e?e.slice(0,r.length)===r:!1}function Lb(r){const e=[...new Set([...r.ptr.out([ae.languageIn]).list()].map(t=>t.value))];return{generic:Ob(e)}}function Ob(r){return e=>{const t=r.some(i=>Db(i,e.valueOrNode.term.language));e.test(t,ae.LanguageInConstraintComponent,{args:{languageIn:r.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})}}function Cb(r){const e=parseInt(r.ptr.out([ae.maxLength]).value);return{generic:$b(e)}}function $b(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length<=r;e.test(t,ae.MaxLengthConstraintComponent,{args:{maxLength:r},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})}}function Fb(r){const e=parseInt(r.ptr.out([ae.minLength]).value);return{generic:Pb(e)}}function Pb(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length>=r;e.test(t,ae.MinLengthConstraintComponent,{args:{minLength:r},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})}}function Mb(r){const e=r.ptr.out([ae.pattern]).value,t=r.ptr.out([ae.flags]).value,i=new RegExp(e,t);return{generic:Bb(e,t,i)}}function Bb(r,e,t){return i=>{i.test(t.test(i.valueOrNode.term.value),ae.PatternConstraintComponent,{args:{flags:e,pattern:r},message:[i.factory.literal('Value does not match pattern "{$pattern}"')],value:i.valueOrNode})}}function qb(r){const e=r.ptr.out([ae.uniqueLang]).term;return e.value==="true"&&Ha.boolean.equals(e.datatype)?{property:zb()}:null}function zb(){return r=>{const t=Object.entries(r.values.terms.reduce((i,n)=>(n.language&&(i[n.language]=(i[n.language]||0)+1),i),{})).filter(([,i])=>i>1);for(const[i]of t)r.violation(ae.UniqueLangConstraintComponent,{args:{lang:i},message:[r.factory.literal('Language "{?lang}" used more than once')]});t.length===0&&r.debug(ae.UniqueLangConstraintComponent)}}const Ji=ht("http://www.w3.org/ns/shacl#"),Kc=ht("https://schemas.link/shacl-next#");class jr{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(Ji.Info)||e.severity.equals(Ji.Violation)||e.severity.equals(Ji.Warning))}}function Ub(r,e){return Object.entries(e).reduce((t,[i,n])=>(n&&n.termType&&(n=st(n)),t.replace(`{$${i}}`,n).replace(`{?${i}}`,n)),r)}class rn{constructor({args:e={},factory:t,message:i=[],severity:n=Ji.Violation}={}){this.severity=n,this.message=i.map(o=>t.literal(Ub(o.value,e),o.language||null))}}class Va{constructor({factory:e=Ua}={}){this.factory=e}clone({factory:e}={}){return new Va({factory:e||this.factory})}validate(){return new jr}validateSimple(){return!0}}class $r extends Va{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(const i of Array.isArray(e)?e:[e])i&&this.datatypes.push(this.factory.fromTerm(i))}clone({factory:e}={}){return new $r({datatypes:this.datatypes,factory:e||this.factory})}}class Hb{constructor({factory:e=Ua,validations:t}={}){if(this.factory=e,this.validations=new Or,t)for(const i of Object.values(t)){const n=i.clone({factory:this.factory});for(const o of n.datatypes)this.validations.set(o,n)}}validate(e){const t=this.validations.get(e.datatype);return t?t.validate(e):new jr}validateSimple(e){const t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}}class Pe extends $r{constructor(e,t,{factory:i}={}){super({datatypes:t,factory:i}),this.message=[this.factory.literal("term value {$this} matches pattern {$pattern}")],this.patterns=Array.isArray(e)?e:[e]}clone({factory:e}={}){return new Pe(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map(i=>{let n;i.test(e.value)&&(n=Kc.Debug);const o={pattern:this.factory.literal(i.toString()),this:e};return new rn({args:o,factory:this.factory,message:this.message,severity:n})});return new jr({results:t})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}}const Gb=/^([-+]?[0-9]+)$/;class ot extends Pe{constructor(e=null,t=null,i,{factory:n}={}){super(Gb,i,{factory:n}),this.maxInclusive=null,this.minInclusive=null,typeof t=="string"&&(this.maxInclusive=BigInt(t)),typeof e=="string"&&(this.minInclusive=BigInt(e))}clone({factory:e}={}){return new ot(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!Kc.Debug.equals(t[0].severity))return new jr({results:t});const i=BigInt(e.value);if(this.minInclusive!==null&&i<this.minInclusive){const n=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,o=[this.factory.literal(n)];t.push(new rn({factory:this.factory,message:o}))}if(this.maxInclusive!==null&&i>this.maxInclusive){const n=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,o=[this.factory.literal(n)];t.push(new rn({factory:this.factory,message:o}))}return new jr({results:t})}validateSimple(e){if(!super.validateSimple(e))return!1;const t=BigInt(e.value);return!(this.minInclusive!==null&&t<this.minInclusive||this.maxInclusive!==null&&t>this.maxInclusive)}}class Wa extends $r{constructor(e,t,{factory:i}={}){super({datatypes:t,factory:i}),this.values=new Set(e)}clone({factory:e}={}){return new Wa(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const i=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,n=[this.factory.literal(i)];t.push(new rn({factory:this.factory,message:n}))}return new jr({results:t})}validateSimple(e){return this.values.has(e.value)}}const Ne={xsd:ht("http://www.w3.org/2001/XMLSchema#")},Vb=new $r({datatypes:Ne.xsd.anySimpleType}),Wb=new $r({datatypes:Ne.xsd.anyAtomicType}),mn=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,Xb=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,Yc=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,Xa=/^(-?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)))))$/,Zc=/^(-?([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))?)$/,Qb=/^((([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))?)$/,Jb=/^(-?([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))?)$/,Kb=/^(-?([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))?)$/,Yb=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Zb=/^(--(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))?)$/,em=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,tm=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,rm=/^(([0-9a-fA-F]{2})*)$/,im=/^(((([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] ?= ?=))?)$/,nm=new Pe(mn,Ne.xsd.string),om=new Wa(["1","true","0","false"],Ne.xsd.boolean),am=new Pe(Xb,Ne.xsd.decimal),sm=new Pe(Yc,Ne.xsd.float),lm=new Pe(Yc,Ne.xsd.double),dm=new Pe(Xa,Ne.xsd.duration),cm=new Pe(Zc,Ne.xsd.dateTime),um=new Pe(Qb,Ne.xsd.time),fm=new Pe(Jb,Ne.xsd.date),pm=new Pe(Kb,Ne.xsd.gYearMonth),hm=new Pe(Yb,Ne.xsd.gYear),bm=new Pe(Zb,Ne.xsd.gMonthDay),mm=new Pe(em,Ne.xsd.gDay),gm=new Pe(tm,Ne.xsd.gMonth),vm=new Pe(rm,Ne.xsd.hexBinary),ym=new Pe(im,Ne.xsd.base64Binary),wm=new Pe(mn,Ne.xsd.anyURI),eu=/^([^\u000d\u000a\u0009]*)$/,xm=/^([^ ]+( [^ ]+)*)*$/,_m=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,km=/^([^DT]*)$/,Em=/^([^YM]*[DT].*)$/,Sm=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Rm=new Pe([mn,eu],Ne.xsd.normalizedString),Im=new Pe([mn,eu,xm],Ne.xsd.token),Nm=new Pe(_m,Ne.xsd.language),Tm=new ot(null,null,Ne.xsd.integer),Am=new ot(null,"0",Ne.xsd.nonPositiveInteger),jm=new ot(null,"-1",Ne.xsd.negativeInteger),Dm=new ot("-9223372036854775808","9223372036854775807",Ne.xsd.long),Lm=new ot("-2147483648","2147483647",Ne.xsd.int),Om=new ot("-32768","32767",Ne.xsd.short),Cm=new ot("-128","127",Ne.xsd.byte),$m=new ot("0",null,Ne.xsd.nonNegativeInteger),Fm=new ot("0","18446744073709551615",Ne.xsd.unsignedLong),Pm=new ot("0","4294967295",Ne.xsd.unsignedInt),Mm=new ot("0","65535",Ne.xsd.unsignedShort),Bm=new ot("0","255",Ne.xsd.unsignedByte),qm=new ot("1",null,Ne.xsd.positiveInteger),zm=new Pe([Xa,km],Ne.xsd.yearMonthDuration),Um=new Pe([Xa,Em],Ne.xsd.dayTimeDuration),Hm=new Pe([Zc,Sm],Ne.xsd.dateTimeStamp),Gm=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:Wb,anySimpleType:Vb,anyURI:wm,base64Binary:ym,boolean:om,byte:Cm,date:fm,dateTime:cm,dateTimeStamp:Hm,dayTimeDuration:Um,decimal:am,double:lm,duration:dm,float:sm,gDay:mm,gMonth:gm,gMonthDay:bm,gYear:hm,gYearMonth:pm,hexBinary:vm,int:Lm,integer:Tm,language:Nm,long:Dm,negativeInteger:jm,nonNegativeInteger:$m,nonPositiveInteger:Am,normalizedString:Rm,positiveInteger:qm,short:Om,string:nm,time:um,token:Im,unsignedByte:Bm,unsignedInt:Pm,unsignedLong:Fm,unsignedShort:Mm,yearMonthDuration:zm},Symbol.toStringTag,{value:"Module"}));class Vm extends Hb{constructor({factory:e}={}){super({factory:e,validations:{...Gm}})}}const Wm=new Or([[ae.BlankNode,new Set(["BlankNode"])],[ae.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[ae.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[ae.IRI,new Set(["NamedNode"])],[ae.IRIOrLiteral,new Set(["NamedNode","Literal"])],[ae.Literal,new Set(["Literal"])]]);function Xm(r){const e=r.ptr.out([ae.class]).map(t=>ba(t));return{generic:Qm(e)}}function Qm(r){return e=>{const t=new ut(e.valueOrNode.out([cr.type]).terms);for(const i of r){const n=[...t].some(o=>i.has(o));e.test(n,ae.ClassConstraintComponent,{value:e.valueOrNode})}}}function Jm(r){const e=r.ptr.out([ae.datatype]).term,t=new Vm;return{generic:Km(e,t)}}function Km(r,e){return t=>{const i=r.equals(t.valueOrNode.term.datatype)&&e.validateSimple(t.valueOrNode.term);t.test(i,ae.DatatypeConstraintComponent,{args:{datatype:r},message:[t.factory.literal("Value does not have datatype {$datatype}")],value:t.valueOrNode})}}function Ym(r){const e=r.ptr.out([ae.nodeKind]).term,t=Wm.get(e);return{generic:Zm(e,t)}}function Zm(r,e){return t=>{t.test(e.has(t.valueOrNode.term.termType),ae.NodeKindConstraintComponent,{args:{nodeKind:r},message:[t.factory.literal("Value does not have node kind {$nodeKind}")],value:t.valueOrNode})}}const eg=new Or([[ae.maxCount,qh],[ae.minCount,Uh],[ae.and,Xh],[ae.not,Jh],[ae.or,Yh],[ae.xone,eb],[ae.closed,rb],[ae.hasValue,nb],[ae.in,sb],[ae.disjoint,db],[ae.equals,ub],[ae.lessThan,hb],[ae.lessThanOrEquals,mb],[ae.maxExclusive,vb],[ae.maxInclusive,wb],[ae.minExclusive,_b],[ae.minInclusive,Eb],[ae.node,Rb],[ae.property,Nb],[ae.qualifiedValueShape,Ab],[ae.languageIn,Lb],[ae.maxLength,Cb],[ae.minLength,Fb],[ae.pattern,Mb],[ae.uniqueLang,qb],[ae.class,Xm],[ae.datatype,Jm],[ae.nodeKind,Ym]]);class tg{constructor(e,{factory:t,...i}){if(this.factory=t,this.options=i,this.registry=new Th(eg),this.shapesPtr=new tn({dataset:e,factory:t}),this.shapes=new Or,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0),this.options.validations)for(const[o,a]of this.options.validations)this.registry.validations.set(o,a);const n=[...this.shapesPtr.hasOut([ae.targetClass]),...this.shapesPtr.hasOut([ae.targetNode]),...this.shapesPtr.hasOut([ae.targetObjectsOf]),...this.shapesPtr.hasOut([ae.targetSubjectsOf]),...this.shapesPtr.hasOut([cr.type],[ae.NodeShape]),...this.shapesPtr.hasOut([cr.type],[ae.PropertyShape])];for(const o of n)this.shape(o)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new Bh(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const i=new tn({...e,factory:this.factory}),n=new Ga({factory:this.factory,focusNode:i,options:this.options,validator:this});t?t=t.map(o=>this.shape(this.shapesPtr.node(o.terms))):t=this.shapes.values();for(const o of t){const a=n.create({shape:o});let s;i.isAny()?s=o.resolveTargets(a):s=i;for(const d of s)await o.validate(a.create({focusNode:d}))}return n.report}}let rg=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new ld(e,this.form),this.form.addEventListener("change",t=>{t.stopPropagation(),this.config.editMode&&this.validate(!0).then(i=>{this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:i.conforms,report:i}}))}).catch(i=>{console.warn(i)})})}static get observedAttributes(){return ld.dataAttributes()}connectedCallback(){this.shadowRoot.prepend(this.form)}attributeChangedCallback(){this.config.updateAttributes(this),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.initDebounceTimeout=setTimeout(async()=>{this.form.replaceChildren(document.createTextNode(this.config.attributes.loading));try{await this.config.loader.loadGraphs(),this.form.replaceChildren(),this.config.renderedNodes.clear();const e=this.findRootShaclShapeSubject();if(e){this.form.classList.forEach(i=>{this.form.classList.remove(i)}),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 i of Zu())i.stylesheet&&t.push(i.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new Gt(e,this.config,this.config.attributes.valuesSubject?Ie.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.editMode){if(this.config.attributes.submitButton!==null){const i=this.config.theme.createButton(this.config.attributes.submitButton||"Submit",!0);i.addEventListener("click",n=>{n.preventDefault(),this.form.reportValidity()&&this.validate().then(o=>{if(o?.conforms)this.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}));else{let a=this.form.querySelector(":scope .invalid > .editor");a?a.focus():this.form.querySelector(":scope .invalid")?.scrollIntoView()}})}),this.form.appendChild(i)}this.config.attributes.valuesSubject&&this.removeFromDataGraph(Ie.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,hi)>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()){const i=t.getQuads(null,null,null,null);return Qu(i,e,this.config.prefixes)}toRDF(e=new tt){return this.shape?.toRDF(e),e}registerPlugin(e){Yu(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setSharedShapesGraph(e){Hp(e),this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}async validate(e=!1){for(const t of this.form.querySelectorAll(":scope .validation-error"))t.remove();for(const t of this.form.querySelectorAll(":scope .property-instance"))t.classList.remove("invalid"),t.querySelector(":scope > .editor")?.value?t.classList.add("valid"):t.classList.remove("valid");this.config.store.deleteGraph(this.config.valuesGraphId||""),this.shape?.toRDF(this.config.store),this.shape&&this.config.store.add(new on(this.shape.shaclSubject,Ie.namedNode(_e+"targetNode"),this.shape.nodeId,this.config.valuesGraphId));try{const t=this.config.store,i=await new tg(t,{details:!0,factory:Ie}).validate({dataset:t});for(const n of i.results)if(n.focusNode?.ptrs?.length)for(const o of n.focusNode.ptrs){const a=o._term;if(n.path?.length){const s=n.path[0].predicates[0];let d=this.form.querySelectorAll(`
|
|
370
370
|
:scope shacl-node[data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${s.id}'] > .editor,
|
|
371
371
|
:scope shacl-node[data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${s.id}'] > .editor,
|
|
372
372
|
:scope shacl-node[data-node-id='${a.id}'] > .shacl-group > shacl-property > .property-instance[data-path='${s.id}'] > .editor,
|
|
373
373
|
:scope shacl-node[data-node-id='${a.id}'] > .shacl-group > shacl-property > .shacl-group > .property-instance[data-path='${s.id}'] > .editor`);d.length===0&&(d=this.form.querySelectorAll(`
|
|
374
374
|
:scope [data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${s.id}'],
|
|
375
375
|
:scope [data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${s.id}']`));for(const l of d)if(l.classList.contains("editor")){if(!e||l.value){let c=l.parentElement;c.classList.add("invalid"),c.classList.remove("valid"),c.appendChild(this.createValidationErrorDisplay(n));do c instanceof rt&&(c.open=!0),c=c.parentElement;while(c)}}else e||(l.classList.add("invalid"),l.classList.remove("valid"),l.appendChild(this.createValidationErrorDisplay(n,"node")))}else e||this.form.querySelector(`:scope [data-node-id='${a.id}']`)?.prepend(this.createValidationErrorDisplay(n,"node"))}return i}catch(t){return console.error(t),!1}}createValidationErrorDisplay(e,t){const i=document.createElement("span");if(i.classList.add("validation-error"),t&&i.classList.add(t),e)if(e.message?.length>0)for(const n of e.message)i.title+=n.value+`
|
|
376
|
-
`;else i.title=e.sourceConstraintComponent?.value;return i}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=
|
|
376
|
+
`;else i.title=e.sourceConstraintComponent?.value;return i}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=Ie.namedNode(this.config.attributes.shapeSubject),this.config.store.getQuads(e,Ye,Mi,null).length===0){console.warn(`shapes graph does not contain requested root shape ${this.config.attributes.shapeSubject}`);return}}else if(this.config.attributes.valuesSubject&&this.config.store.countQuads(null,null,null,kt)>0){const t=Ie.namedNode(this.config.attributes.valuesSubject),i=[...this.config.store.getQuads(t,Ye,null,kt),...this.config.store.getQuads(t,oa,null,kt)];if(i.length===0){console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${Ye.id} nor ${oa.id} statement`);return}for(const n of i)if(this.config.store.getQuads(n.object,Ye,Mi,null).length>0){e=n.object;break}if(!e){const n=this.config.store.getQuads(null,wi,i[0].object,null);if(n.length===0){console.error(`value subject '${this.config.attributes.valuesSubject}' has no shacl shape definition in the shapes graph`);return}if(n.length>1&&console.warn(`value subject '${this.config.attributes.valuesSubject}' has multiple shacl shape definitions in the shapes graph, choosing the first found (${n[0].subject})`),this.config.store.getQuads(n[0].subject,Ye,Mi,null).length===0){console.error(`value subject '${this.config.attributes.valuesSubject}' references a shape which is not a NodeShape (${n[0].subject})`);return}e=n[0].subject}}else{const t=this.config.store.getQuads(null,Ye,Mi,null);if(t.length==0){console.warn("shapes graph does not contain any root shapes");return}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}removeFromDataGraph(e){this.config.attributes.valuesSubject;for(const t of this.config.store.getQuads(e,null,null,kt))this.config.store.delete(t),(t.object.termType==="NamedNode"||t.object.termType==="BlankNode")&&this.removeFromDataGraph(t.object)}};const ig=`.editor:not([type='checkbox']) { border: 1px solid #DDD; }
|
|
377
377
|
.property-instance label { display: inline-flex; word-break: break-word; line-height: 1em; padding-top: 0.15em; padding-right: 1em; flex-shrink: 0; position: relative; }
|
|
378
378
|
.property-instance:not(:first-child) > label:not(.persistent) { visibility: hidden; max-height: 0; }
|
|
379
379
|
.mode-edit .property-instance label { width: var(--label-width); }
|