@ulb-darmstadt/shacl-form 1.10.0 → 1.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,30 +1,30 @@
1
- var Er=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ru(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function iu(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var e=r.default;if(typeof e=="function"){var t=function i(){var n=!1;try{n=this instanceof i}catch{}return n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var n=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return r[i]}})}),t}var vn={},Ur={},Qa;function nu(){if(Qa)return Ur;Qa=1,Ur.byteLength=s,Ur.toByteArray=l,Ur.fromByteArray=v;for(var r=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=i.length;n<o;++n)r[n]=i[n],e[i.charCodeAt(n)]=n;e[45]=62,e[95]=63;function a(g){var y=g.length;if(y%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=g.indexOf("=");k===-1&&(k=y);var x=k===y?0:4-k%4;return[k,x]}function s(g){var y=a(g),k=y[0],x=y[1];return(k+x)*3/4-x}function d(g,y,k){return(y+k)*3/4-k}function l(g){var y,k=a(g),x=k[0],_=k[1],E=new t(d(g,x,_)),m=0,u=_>0?x-4:x,b;for(b=0;b<u;b+=4)y=e[g.charCodeAt(b)]<<18|e[g.charCodeAt(b+1)]<<12|e[g.charCodeAt(b+2)]<<6|e[g.charCodeAt(b+3)],E[m++]=y>>16&255,E[m++]=y>>8&255,E[m++]=y&255;return _===2&&(y=e[g.charCodeAt(b)]<<2|e[g.charCodeAt(b+1)]>>4,E[m++]=y&255),_===1&&(y=e[g.charCodeAt(b)]<<10|e[g.charCodeAt(b+1)]<<4|e[g.charCodeAt(b+2)]>>2,E[m++]=y>>8&255,E[m++]=y&255),E}function c(g){return r[g>>18&63]+r[g>>12&63]+r[g>>6&63]+r[g&63]}function f(g,y,k){for(var x,_=[],E=y;E<k;E+=3)x=(g[E]<<16&16711680)+(g[E+1]<<8&65280)+(g[E+2]&255),_.push(c(x));return _.join("")}function v(g){for(var y,k=g.length,x=k%3,_=[],E=16383,m=0,u=k-x;m<u;m+=E)_.push(f(g,m,m+E>u?u:m+E));return x===1?(y=g[k-1],_.push(r[y>>2]+r[y<<4&63]+"==")):x===2&&(y=(g[k-2]<<8)+g[k-1],_.push(r[y>>10]+r[y>>4&63]+r[y<<2&63]+"=")),_.join("")}return Ur}var Di={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var Ja;function ou(){return Ja||(Ja=1,Di.read=function(r,e,t,i,n){var o,a,s=n*8-i-1,d=(1<<s)-1,l=d>>1,c=-7,f=t?n-1:0,v=t?-1:1,g=r[e+f];for(f+=v,o=g&(1<<-c)-1,g>>=-c,c+=s;c>0;o=o*256+r[e+f],f+=v,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=i;c>0;a=a*256+r[e+f],f+=v,c-=8);if(o===0)o=1-l;else{if(o===d)return a?NaN:(g?-1:1)*(1/0);a=a+Math.pow(2,i),o=o-l}return(g?-1:1)*a*Math.pow(2,o-i)},Di.write=function(r,e,t,i,n,o){var a,s,d,l=o*8-n-1,c=(1<<l)-1,f=c>>1,v=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=i?0:o-1,y=i?1:-1,k=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(d=Math.pow(2,-a))<1&&(a--,d*=2),a+f>=1?e+=v/d:e+=v*Math.pow(2,1-f),e*d>=2&&(a++,d/=2),a+f>=c?(s=0,a=c):a+f>=1?(s=(e*d-1)*Math.pow(2,n),a=a+f):(s=e*Math.pow(2,f-1)*Math.pow(2,n),a=0));n>=8;r[t+g]=s&255,g+=y,s/=256,n-=8);for(a=a<<n|s,l+=n;l>0;r[t+g]=a&255,g+=y,a/=256,l-=8);r[t+g-y]|=k*128}),Di}/*!
1
+ var Er=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function tu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function ru(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var e=r.default;if(typeof e=="function"){var t=function i(){var n=!1;try{n=this instanceof i}catch{}return n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var n=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return r[i]}})}),t}var vn={},zr={},Qa;function iu(){if(Qa)return zr;Qa=1,zr.byteLength=s,zr.toByteArray=l,zr.fromByteArray=v;for(var r=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=i.length;n<o;++n)r[n]=i[n],e[i.charCodeAt(n)]=n;e[45]=62,e[95]=63;function a(g){var y=g.length;if(y%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=g.indexOf("=");k===-1&&(k=y);var x=k===y?0:4-k%4;return[k,x]}function s(g){var y=a(g),k=y[0],x=y[1];return(k+x)*3/4-x}function d(g,y,k){return(y+k)*3/4-k}function l(g){var y,k=a(g),x=k[0],_=k[1],E=new t(d(g,x,_)),m=0,f=_>0?x-4:x,b;for(b=0;b<f;b+=4)y=e[g.charCodeAt(b)]<<18|e[g.charCodeAt(b+1)]<<12|e[g.charCodeAt(b+2)]<<6|e[g.charCodeAt(b+3)],E[m++]=y>>16&255,E[m++]=y>>8&255,E[m++]=y&255;return _===2&&(y=e[g.charCodeAt(b)]<<2|e[g.charCodeAt(b+1)]>>4,E[m++]=y&255),_===1&&(y=e[g.charCodeAt(b)]<<10|e[g.charCodeAt(b+1)]<<4|e[g.charCodeAt(b+2)]>>2,E[m++]=y>>8&255,E[m++]=y&255),E}function c(g){return r[g>>18&63]+r[g>>12&63]+r[g>>6&63]+r[g&63]}function u(g,y,k){for(var x,_=[],E=y;E<k;E+=3)x=(g[E]<<16&16711680)+(g[E+1]<<8&65280)+(g[E+2]&255),_.push(c(x));return _.join("")}function v(g){for(var y,k=g.length,x=k%3,_=[],E=16383,m=0,f=k-x;m<f;m+=E)_.push(u(g,m,m+E>f?f:m+E));return x===1?(y=g[k-1],_.push(r[y>>2]+r[y<<4&63]+"==")):x===2&&(y=(g[k-2]<<8)+g[k-1],_.push(r[y>>10]+r[y>>4&63]+r[y<<2&63]+"=")),_.join("")}return zr}var Li={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var Ja;function nu(){return Ja||(Ja=1,Li.read=function(r,e,t,i,n){var o,a,s=n*8-i-1,d=(1<<s)-1,l=d>>1,c=-7,u=t?n-1:0,v=t?-1:1,g=r[e+u];for(u+=v,o=g&(1<<-c)-1,g>>=-c,c+=s;c>0;o=o*256+r[e+u],u+=v,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=i;c>0;a=a*256+r[e+u],u+=v,c-=8);if(o===0)o=1-l;else{if(o===d)return a?NaN:(g?-1:1)*(1/0);a=a+Math.pow(2,i),o=o-l}return(g?-1:1)*a*Math.pow(2,o-i)},Li.write=function(r,e,t,i,n,o){var a,s,d,l=o*8-n-1,c=(1<<l)-1,u=c>>1,v=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=i?0:o-1,y=i?1:-1,k=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(d=Math.pow(2,-a))<1&&(a--,d*=2),a+u>=1?e+=v/d:e+=v*Math.pow(2,1-u),e*d>=2&&(a++,d/=2),a+u>=c?(s=0,a=c):a+u>=1?(s=(e*d-1)*Math.pow(2,n),a=a+u):(s=e*Math.pow(2,u-1)*Math.pow(2,n),a=0));n>=8;r[t+g]=s&255,g+=y,s/=256,n-=8);for(a=a<<n|s,l+=n;l>0;r[t+g]=a&255,g+=y,a/=256,l-=8);r[t+g-y]|=k*128}),Li}/*!
2
2
  * The buffer module from node.js, for the browser.
3
3
  *
4
4
  * @author Feross Aboukhadijeh <https://feross.org>
5
5
  * @license MIT
6
- */var Ka;function Lt(){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 f(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 f(S){return l(S),a(S<0?0:_(S)|0)}s.allocUnsafe=function(S){return f(S)},s.allocUnsafeSlow=function(S){return f(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"||Ie(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 u(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):u.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,Ie(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(Ie(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=Se(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=Se(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=Se(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=Se(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=Se(function(p,h=0){return X(this,p,h,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=Se(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=Se(function(p,h=0){return X(this,p,h,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=Se(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 Ie(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 Se(S){return typeof BigInt>"u"?Qe:S}function Qe(){throw new Error("BigInt not supported")}}(vn)),vn}var au=Lt();const Hr="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Gr="http://www.w3.org/2001/XMLSchema#",Li="http://www.w3.org/2000/10/swap/",Ke={xsd:{decimal:`${Gr}decimal`,boolean:`${Gr}boolean`,double:`${Gr}double`,integer:`${Gr}integer`,string:`${Gr}string`},rdf:{type:`${Hr}type`,nil:`${Hr}nil`,first:`${Hr}first`,rest:`${Hr}rest`,langString:`${Hr}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${Li}reify#forSome`,forAll:`${Li}reify#forAll`},log:{implies:`${Li}log#implies`,isImpliedBy:`${Li}log#isImpliedBy`}},{xsd:Oi}=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 f="",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,f="^");break}case"<":if(y=this._unescapedIri.exec(i))f="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);f="IRI"}else i.length>1&&i[1]==="<"?(f="<<",k=2):this._n3Mode&&i.length>1&&i[1]==="="&&(k=2,this._isImpliedBy?(f="abbreviation",v="<"):(f="inverse",v=">"));break;case">":i.length>1&&i[1]===">"&&(f=">>",k=2);break;case"_":((y=this._blank.exec(i))||t&&(y=this._blank.exec(`${i} `)))&&(f="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)&&(f="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)&&(f="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(y=this._variable.exec(i))&&(f="var",v=y[0]);break;case"@":this._previousMarker==="literal"&&(y=this._langcode.exec(i))?(f="langcode",v=y[1]):(y=this._keyword.exec(i))&&(f=y[0]);break;case".":if(i.length===1?t:i[1]<"0"||i[1]>"9"){f=".",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} `)))&&(f="literal",v=y[0],g=typeof y[1]=="string"?Oi.double:typeof y[2]=="string"?Oi.decimal:Oi.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(y=this._sparqlKeyword.exec(i))?f=y[0].toUpperCase():x=!0;break;case"f":case"t":(y=this._boolean.exec(i))?(f="literal",v=y[0],g=Oi.boolean):x=!0;break;case"a":(y=this._shortPredicates.exec(i))?(f="abbreviation",v="a"):x=!0;break;case"=":this._n3Mode&&i.length>1&&(f="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,f=c);break;case"{":!this._lineMode&&i.length>=2&&(i[1]==="|"?(f="{|",k=2):(f=c,k=1));break;case"|":i.length>=2&&i[1]==="}"&&(f="|}",k=2);break;default:x=!0}if(x&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(y=this._prefix.exec(i))?(f="prefix",v=y[1]||""):((y=this._prefixed.exec(i))||t&&(y=this._prefixed.exec(`${i} `)))&&(f="prefixed",g=y[1]||"",v=this._unescape(y[2]))),this._previousMarker==="^^")switch(f){case"prefixed":f="type";break;case"IRI":f="typeIRI";break;default:f=""}if(!f)return t||!/^'''|^"""/.test(i)&&/\n|\r/.test(i)?a(this):this._input=i;const _=k||y[0].length,E=o(f,v,g,l,_);this.previousToken=E,this._previousMarker=f,i=i.substr(_,i.length)}function o(s,d,l,c,f){const v=i?n-i.length:n,g=v+f,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:ar}=Ke;let Or,pu=0;const Re={namedNode:Vd,blankNode:Wd,variable:Qd,literal:Xd,defaultGraph:gu,quad:na,triple:na,fromTerm:fi,fromQuad:Jd};class wt{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof wt?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 wt{get termType(){return"NamedNode"}},ct=class Gd extends wt{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!=="@"?ar.string:fu.langString}equals(e){return e instanceof Gd?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 wt{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},bu=class extends wt{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},mu=class extends wt{constructor(){return super(""),Or||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};Or=new mu;function ui(r,e,t){if(e=e||Re,!r)return e.defaultGraph();switch(r[0]){case"?":return e.variable(r.substr(1));case"_":return e.blankNode(r.substr(2));case'"':if(e===Re)return new ct(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(ui(r[0],e,!0),ui(r[1],e,!0),ui(r[2],e,!0),r[3]&&ui(r[3],e,!0))}function Sr(r,e){if(typeof r=="string")return r;if(r instanceof wt&&r.termType!=="Quad")return r.id;if(!r)return Or.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!==ar.string?`^^${r.datatype.value}`:""}`;case"Quad":const t=[Sr(r.subject,!0),Sr(r.predicate,!0),Sr(r.object,!0)];return r.graph&&r.graph.termType!=="DefaultGraph"&&t.push(Sr(r.graph,!0)),e?t:JSON.stringify(t);default:throw new Error(`Unexpected termType: ${r.termType}`)}}let on=class extends wt{constructor(e,t,i,n){super(""),this._subject=e,this._predicate=t,this._object=i,this._graph=n||Or}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 Vd(r){return new nn(r)}function Wd(r){return new hu(r||`n3-${pu++}`)}function Xd(r,e){if(typeof e=="string")return new ct(`"${r}"@${e.toLowerCase()}`);let t=e?e.value:"";return t===""&&(typeof r=="boolean"?t=ar.boolean:typeof r=="number"&&(Number.isFinite(r)?t=Number.isInteger(r)?ar.integer:ar.double:(t=ar.double,Number.isNaN(r)||(r=r>0?"INF":"-INF")))),t===""||t===ar.string?new ct(`"${r}"`):new ct(`"${r}"^^${t}`)}function Qd(r){return new bu(r)}function gu(){return Or}function na(r,e,t,i){return new on(r,e,t,i)}function fi(r){if(r instanceof wt)return r;switch(r.termType){case"NamedNode":return Vd(r.value);case"BlankNode":return Wd(r.value);case"Variable":return Qd(r.value);case"DefaultGraph":return Or;case"Literal":return Xd(r.value,r.language||r.datatype);case"Quad":return Jd(r);default:throw new Error(`Unexpected termType: ${r.termType}`)}}function Jd(r){if(r instanceof on)return r;if(r.termType!=="Quad")throw new Error(`Unexpected termType: ${r.termType}`);return na(fi(r.subject),fi(r.predicate),fi(r.object),fi(r.graph))}let Za=0;class Kd{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Yd(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=Ci}_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||Ci,this._inversePredicate=!1,this._quantified=Object.create(null),!n){const d=[];let l;if(this._callback=(c,f)=>{c?l=c:f&&d.push(f)},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=Ci):this._readCallback&&(this._readCallback=this._readCallback(l))};a&&(this._lexer.comments=!0,s=(d,l)=>{d!==null?(this._callback(d),this._callback=Ci):this._readCallback&&(l.type==="comment"?a(l.value):this._readCallback=this._readCallback(l))}),this._callback=n,this._lexer.tokenize(e,s)}}function Ci(){}function Yd(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")}Yd(Kd.prototype,Re);function oa(r){return!!r&&r.termType==="DefaultGraph"}function Ui(r){return r.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const vu=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,yu=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,es="./",wu="../",yn="?",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]!==yn?n.push(l=o.lastIndex):(s=l=o.lastIndex,d=this.base.indexOf(ts,s),this._pathReplacements[s]=yn));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!==yn&&!yu.test(o)?e:n===es&&/^[^?#]/.test(o)?o:n+o}return e.substring(i-1)}}const Vr=Re.defaultGraph(),{rdf:xu,xsd:wr}=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 Wr extends wt{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=Vr,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new ma(t.baseIRI)))}get _inDefaultGraph(){return Vr.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 Lt(){return Ka||(Ka=1,function(r){const e=iu(),t=nu(),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"||Ie(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,Ie(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(Ie(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=Se(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=Se(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=Se(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=Se(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=Se(function(p,h=0){return X(this,p,h,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=Se(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=Se(function(p,h=0){return X(this,p,h,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=Se(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 Ie(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 Se(S){return typeof BigInt>"u"?Qe:S}function Qe(){throw new Error("BigInt not supported")}}(vn)),vn}var ou=Lt();const Ur="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Hr="http://www.w3.org/2001/XMLSchema#",Oi="http://www.w3.org/2000/10/swap/",Ke={xsd:{decimal:`${Hr}decimal`,boolean:`${Hr}boolean`,double:`${Hr}double`,integer:`${Hr}integer`,string:`${Hr}string`},rdf:{type:`${Ur}type`,nil:`${Ur}nil`,first:`${Ur}first`,rest:`${Ur}rest`,langString:`${Ur}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${Oi}reify#forSome`,forAll:`${Oi}reify#forAll`},log:{implies:`${Oi}log#implies`,isImpliedBy:`${Oi}log#isImpliedBy`}},{xsd:Ci}=Ke,au=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Ya={"\\":"\\","'":"'",'"':'"',n:`
7
+ `,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},su=/[\x00-\x20<>\\"\{\}\|\^\`]/,lu={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},du=/$0^/;class cu{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 lu)&&this[t]instanceof RegExp&&(this[t]=du)}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||su.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"?Ci.double:typeof y[2]=="string"?Ci.decimal:Ci.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=Ci.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(au,(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=ou.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:uu,xsd:ar}=Ke;let Lr,fu=0;const Re={namedNode:Vd,blankNode:Wd,variable:Qd,literal:Xd,defaultGraph:mu,quad:na,triple:na,fromTerm:ui,fromQuad:Jd};class wt{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof wt?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 wi=class extends wt{get termType(){return"NamedNode"}},ct=class Gd extends wt{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 wi(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!=="@"?ar.string:uu.langString}equals(e){return e instanceof Gd?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}}}},pu=class extends wt{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},hu=class extends wt{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},bu=class extends wt{constructor(){return super(""),Lr||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};Lr=new bu;function ci(r,e,t){if(e=e||Re,!r)return e.defaultGraph();switch(r[0]){case"?":return e.variable(r.substr(1));case"_":return e.blankNode(r.substr(2));case'"':if(e===Re)return new ct(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(ci(r[0],e,!0),ci(r[1],e,!0),ci(r[2],e,!0),r[3]&&ci(r[3],e,!0))}function Sr(r,e){if(typeof r=="string")return r;if(r instanceof wt&&r.termType!=="Quad")return r.id;if(!r)return Lr.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!==ar.string?`^^${r.datatype.value}`:""}`;case"Quad":const t=[Sr(r.subject,!0),Sr(r.predicate,!0),Sr(r.object,!0)];return r.graph&&r.graph.termType!=="DefaultGraph"&&t.push(Sr(r.graph,!0)),e?t:JSON.stringify(t);default:throw new Error(`Unexpected termType: ${r.termType}`)}}let on=class extends wt{constructor(e,t,i,n){super(""),this._subject=e,this._predicate=t,this._object=i,this._graph=n||Lr}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 Vd(r){return new wi(r)}function Wd(r){return new pu(r||`n3-${fu++}`)}function Xd(r,e){if(typeof e=="string")return new ct(`"${r}"@${e.toLowerCase()}`);let t=e?e.value:"";return t===""&&(typeof r=="boolean"?t=ar.boolean:typeof r=="number"&&(Number.isFinite(r)?t=Number.isInteger(r)?ar.integer:ar.double:(t=ar.double,Number.isNaN(r)||(r=r>0?"INF":"-INF")))),t===""||t===ar.string?new ct(`"${r}"`):new ct(`"${r}"^^${t}`)}function Qd(r){return new hu(r)}function mu(){return Lr}function na(r,e,t,i){return new on(r,e,t,i)}function ui(r){if(r instanceof wt)return r;switch(r.termType){case"NamedNode":return Vd(r.value);case"BlankNode":return Wd(r.value);case"Variable":return Qd(r.value);case"DefaultGraph":return Lr;case"Literal":return Xd(r.value,r.language||r.datatype);case"Quad":return Jd(r);default:throw new Error(`Unexpected termType: ${r.termType}`)}}function Jd(r){if(r instanceof on)return r;if(r.termType!=="Quad")throw new Error(`Unexpected termType: ${r.termType}`);return na(ui(r.subject),ui(r.predicate),ui(r.object),ui(r.graph))}let Za=0;class Kd{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Yd(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 cu({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=$i}_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||$i,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=$i):this._readCallback&&(this._readCallback=this._readCallback(l))};a&&(this._lexer.comments=!0,s=(d,l)=>{d!==null?(this._callback(d),this._callback=$i):this._readCallback&&(l.type==="comment"?a(l.value):this._readCallback=this._readCallback(l))}),this._callback=n,this._lexer.tokenize(e,s)}}function $i(){}function Yd(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")}Yd(Kd.prototype,Re);function oa(r){return!!r&&r.termType==="DefaultGraph"}function Hi(r){return r.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const gu=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,vu=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,es="./",yu="../",yn="?",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!gu.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!ma.supports(this.base))return this._baseMatcher=/.^/;const e=/^[^:]*:\/*/.exec(this.base)[0],t=["^",Hi(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(Hi(a[0]),"(?:"),i.push(")?"),a[1]!==yn?n.push(l=o.lastIndex):(s=l=o.lastIndex,d=this.base.indexOf(ts,s),this._pathReplacements[s]=yn));for(let c=0;c<n.length;c++)this._pathReplacements[n[c]]=yu.repeat(n.length-c-1);return this._pathReplacements[n[n.length-1]]=es,this._baseLength=d>0?d:this.base.length,t.push(Hi(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!==yn&&!vu.test(o)?e:n===es&&/^[^?#]/.test(o)?o:n+o}return e.substring(i-1)}}const Gr=Re.defaultGraph(),{rdf:wu,xsd:wr}=Ke,rs=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,is=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,xu={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class Vr extends wt{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=Gr,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new ma(t.baseIRI)))}get _inDefaultGraph(){return Gr.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
- `)+(Vr.equals(n)?"":`${this._encodeIriOrBlank(n)} {
10
+ `)+(Gr.equals(n)?"":`${this._encodeIriOrBlank(n)} {
11
11
  `)),this._graph=n,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(`, ${this._encodeObject(i)}`,o):this._write(`;
12
12
  ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(i)}`,o):this._write(`${(this._subject===null?"":`.
13
13
  `)+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(i)}`,o)}catch(a){o&&o(a)}}_writeQuadLine(e,t,i,n,o){delete this._prefixMatch,this._write(this.quadToString(e,t,i,n),o)}quadToString(e,t,i,n){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(i)}${n&&n.value?` ${this._encodeIriOrBlank(n)} .
14
14
  `:` .
15
- `}`}quadsToString(e){let t="";for(const i of e)t+=this.quadToString(i.subject,i.predicate,i.object,i.graph);return t}_encodeSubject(e){return e.termType==="Quad"?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if(e.termType!=="NamedNode")return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let t=e.value;this._baseIri&&(t=this._baseIri.toRelative(t)),rs.test(t)&&(t=t.replace(is,ns));const i=this._prefixRegex.exec(t);return i?i[1]?this._prefixIRIs[i[1]]+i[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(rs.test(t)&&(t=t.replace(is,ns)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===wr.string)return`"${t}"`}else switch(e.datatype.value){case wr.string:return`"${t}"`;case wr.boolean:if(t==="true"||t==="false")return t;break;case wr.integer:if(/^[+-]?\d+$/.test(t))return t;break;case wr.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case wr.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t;break}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===xu.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:t,object:i,graph:n}){return`<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(i)}${oa(n)?"":` ${this._encodeIriOrBlank(n)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,i,n,o){i===void 0?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):typeof n=="function"?this._writeQuad(e,t,i,Vr,n):this._writeQuad(e,t,i,n||Vr,o)}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}addPrefix(e,t,i){const n={};n[e]=t,this.addPrefixes(n,i)}addPrefixes(e,t){if(!this._prefixIRIs)return t&&t();let i=!1;for(let n in e){let o=e[n];typeof o!="string"&&(o=o.value),i=!0,this._subject!==null&&(this._write(this._inDefaultGraph?`.
15
+ `}`}quadsToString(e){let t="";for(const i of e)t+=this.quadToString(i.subject,i.predicate,i.object,i.graph);return t}_encodeSubject(e){return e.termType==="Quad"?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if(e.termType!=="NamedNode")return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let t=e.value;this._baseIri&&(t=this._baseIri.toRelative(t)),rs.test(t)&&(t=t.replace(is,ns));const i=this._prefixRegex.exec(t);return i?i[1]?this._prefixIRIs[i[1]]+i[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(rs.test(t)&&(t=t.replace(is,ns)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===wr.string)return`"${t}"`}else switch(e.datatype.value){case wr.string:return`"${t}"`;case wr.boolean:if(t==="true"||t==="false")return t;break;case wr.integer:if(/^[+-]?\d+$/.test(t))return t;break;case wr.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case wr.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t;break}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===wu.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:t,object:i,graph:n}){return`<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(i)}${oa(n)?"":` ${this._encodeIriOrBlank(n)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,i,n,o){i===void 0?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):typeof n=="function"?this._writeQuad(e,t,i,Gr,n):this._writeQuad(e,t,i,n||Gr,o)}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}addPrefix(e,t,i){const n={};n[e]=t,this.addPrefixes(n,i)}addPrefixes(e,t){if(!this._prefixIRIs)return t&&t();let i=!1;for(let n in e){let o=e[n];typeof o!="string"&&(o=o.value),i=!0,this._subject!==null&&(this._write(this._inDefaultGraph?`.
16
16
  `:`
17
17
  }
18
18
  `),this._subject=null,this._graph=""),this._prefixIRIs[o]=n+=":",this._write(`@prefix ${n} <${o}>.
19
- `)}if(i){let n="",o="";for(const a in this._prefixIRIs)n+=n?`|${a}`:a,o+=(o?"|":"")+this._prefixIRIs[a];n=Ui(n),this._prefixRegex=new RegExp(`^(?:${o})[^/]*$|^(${n})([_a-zA-Z0-9][\\-_a-zA-Z0-9]*)$`)}this._write(i?`
20
- `:"",t)}blank(e,t){let i=e,n,o;switch(e===void 0?i=[]:e.termType?i=[{predicate:e,object:t}]:"length"in e||(i=[e]),o=i.length){case 0:return new Wr("[]");case 1:if(n=i[0],!(n.object instanceof Wr))return new Wr(`[ ${this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)} ]`);default:let a="[";for(let s=0;s<o;s++)n=i[s],n.predicate.equals(e)?a+=`, ${this._encodeObject(n.object)}`:(a+=`${(s?`;
19
+ `)}if(i){let n="",o="";for(const a in this._prefixIRIs)n+=n?`|${a}`:a,o+=(o?"|":"")+this._prefixIRIs[a];n=Hi(n),this._prefixRegex=new RegExp(`^(?:${o})[^/]*$|^(${n})([_a-zA-Z0-9][\\-_a-zA-Z0-9]*)$`)}this._write(i?`
20
+ `:"",t)}blank(e,t){let i=e,n,o;switch(e===void 0?i=[]:e.termType?i=[{predicate:e,object:t}]:"length"in e||(i=[e]),o=i.length){case 0:return new Vr("[]");case 1:if(n=i[0],!(n.object instanceof Vr))return new Vr(`[ ${this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)} ]`);default:let a="[";for(let s=0;s<o;s++)n=i[s],n.predicate.equals(e)?a+=`, ${this._encodeObject(n.object)}`:(a+=`${(s?`;
21
21
  `:`
22
- `)+this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)}`,e=n.predicate);return new Wr(`${a}
23
- ]`)}}list(e){const t=e&&e.length||0,i=new Array(t);for(let n=0;n<t;n++)i[n]=this._encodeObject(e[n]);return new Wr(`(${i.join(" ")})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
22
+ `)+this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)}`,e=n.predicate);return new Vr(`${a}
23
+ ]`)}}list(e){const t=e&&e.length||0,i=new Array(t);for(let n=0;n<t;n++)i[n]=this._encodeObject(e[n]);return new Vr(`(${i.join(" ")})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
24
24
  `:`
25
25
  }
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 wn={exports:{}},xn={exports:{}},_n,os;function Be(){if(os)return _n;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 _n={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},_n}var kn={exports:{}},En,as;function Zd(){return as||(as=1,En={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"{}"}}}),En}var Sn,ss;function nt(){if(ss)return Sn;ss=1;const{format:r,inspect:e}=Zd(),{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 f(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(f(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 u=[],b=[],R=[];for(const T of _)l(typeof T=="string","All expected entries have to be of type string"),o.includes(T)?u.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=u.indexOf("object");T!==-1&&(u.splice(u,T,1),b.push("Object"))}if(u.length>0){switch(u.length){case 1:m+=`of type ${u[0]}`;break;case 2:m+=`one of type ${u[0]} or ${u[1]}`;break;default:{const T=u.pop();m+=`one of type ${u.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 u=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 ${u}.`},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 u=BigInt(2)**BigInt(32);(E>u||E<-u)&&(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),Sn={AbortError:k,aggregateTwoErrors:g(y),hideStackFrames:g,codes:d},Sn}var Xr={exports:{}},ls;function wi(){if(ls)return Xr.exports;ls=1;const{AbortController:r,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return Xr.exports=r,Xr.exports.AbortSignal=e,Xr.exports.default=r,Xr.exports}var $i={exports:{}},ds;function an(){if(ds)return $i.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(u){console&&console.warn&&console.warn(u)}var n=Number.isNaN||function(b){return b!==b};function o(){o.init.call(this)}$i.exports=o,$i.exports.once=_,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(u){if(typeof u!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof u)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(u){if(typeof u!="number"||u<0||n(u))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+u+".");a=u}}),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(u){return u._maxListeners===void 0?o.defaultMaxListeners:u._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(u,b,R,L){var T,B,I;if(s(R),B=u._events,B===void 0?(B=u._events=Object.create(null),u._eventsCount=0):(B.newListener!==void 0&&(u.emit("newListener",b,R.listener?R.listener:R),B=u._events),I=B[b]),I===void 0)I=B[b]=R,++u._eventsCount;else if(typeof I=="function"?I=B[b]=L?[R,I]:[I,R]:L?I.unshift(R):I.push(R),T=d(u),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=u,$.type=b,$.count=I.length,i($)}return u}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 f(u,b,R){var L={fired:!1,wrapFn:void 0,target:u,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,f(this,b,R)),this},o.prototype.prependOnceListener=function(b,R){return s(R),this.prependListener(b,f(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(u,b,R){var L=u._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(u,b){return typeof u.listenerCount=="function"?u.listenerCount(b):g.call(u,b)},o.prototype.listenerCount=g;function g(u){var b=this._events;if(b!==void 0){var R=b[u];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(u,b){for(var R=new Array(b),L=0;L<b;++L)R[L]=u[L];return R}function k(u,b){for(;b+1<u.length;b++)u[b]=u[b+1];u.pop()}function x(u){for(var b=new Array(u.length),R=0;R<b.length;++R)b[R]=u[R].listener||u[R];return b}function _(u,b){return new Promise(function(R,L){function T(I){u.removeListener(b,B),L(I)}function B(){typeof u.removeListener=="function"&&u.removeListener("error",T),R([].slice.call(arguments))}m(u,b,B,{once:!0}),b!=="error"&&E(u,T,{once:!0})})}function E(u,b,R){typeof u.on=="function"&&m(u,"error",b,R)}function m(u,b,R,L){if(typeof u.on=="function")L.once?u.once(b,R):u.on(b,R);else if(typeof u.addEventListener=="function")u.addEventListener(b,function T(B){L.once&&u.removeEventListener(b,T),R(B)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof u)}return $i.exports}var cs;function at(){return cs||(cs=1,function(r){const e=Lt(),{format:t,inspect:i}=Zd(),{codes:{ERR_INVALID_ARG_TYPE:n}}=nt(),{kResistStopPropagation:o,AggregateError:a,SymbolDispose:s}=Be(),d=globalThis.AbortSignal||wi().AbortSignal,l=globalThis.AbortController||wi().AbortController,c=Object.getPrototypeOf(async function(){}).constructor,f=globalThis.Blob||e.Blob,v=typeof f<"u"?function(x){return x instanceof f}: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")}(kn)),kn.exports}var Fi={},Rn,us;function Ei(){if(us)return Rn;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:f,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}}=nt(),{normalizeEncoding:u}=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,Ie=4294967295;if(J<le||J>Ie)throw new E(ce,`>= ${le} && <= ${Ie}`,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 Ie="must be one of: "+t(i(ge,We=>typeof We=="string"?`'${We}'`:f(We)),", ");throw new _(ce,J,Ie)}});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),Ie=w(ge,"allowFunction",!1);if(!w(ge,"nullable",!1)&&J===null||!le&&r(J)||typeof J!="object"&&(!Ie||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],Ie=`${ce}[${ge}]`;if(le==null)throw new x(Ie,"AbortSignal",le);pe(le,Ie)}}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=u(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 Ie=J[le];he(Ie,"hints"),ge+=Ie,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 Rn={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},Rn}var Pi={exports:{}},In={exports:{}},fs;function hr(){if(fs)return In.exports;fs=1;var r=In.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 f(){!d||!l||(d=!1,l.length?s=l.concat(s):c=-1,s.length&&v())}function v(){if(!d){var k=o(f);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},In.exports}var Nn,ps;function Ot(){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 f(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 u(w){if(!f(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(!f(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:f(w)&&w.writable&&!u(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 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:I,isIterable:E,isReadableNodeStream:c,isReadableStream:y,isReadableEnded:R,isReadableFinished:L,isReadableErrored:q,isNodeStream:g,isWebStream:_,isWritable:B,isWritableNodeStream:f,isWritableStream:k,isWritableEnded:u,isWritableFinished:b,isWritableErrored:$,isServerRequest:N,isServerResponse:te,willEmitClose:Z,isTransformStream:x},Nn}var hs;function Wt(){if(hs)return Pi.exports;hs=1;const r=hr(),{AbortError:e,codes:t}=nt(),{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:f,PromisePrototypeThen:v,SymbolDispose:g}=Be(),{isClosed:y,isReadable:k,isReadableNodeStream:x,isReadableStream:_,isReadableFinished:E,isReadableErrored:m,isWritable:u,isWritableNodeStream:b,isWritableStream:R,isWritableFinished:L,isWritableErrored:T,isNodeStream:B,willEmitClose:I,kIsClosedPromise:$}=Ot();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||u(F)===!1)||!de&&(!z||u(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 f((K,X)=>{const de=te(F,Y,H=>{U&&de(),H?X(H):K()})})}return Pi.exports=te,Pi.exports.finished=Z,Pi.exports}var Tn,bs;function Cr(){if(bs)return Tn;bs=1;const r=hr(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:i}=nt(),{Symbol:n}=Be(),{kIsDestroyed:o,isDestroyed:a,isFinished:s,isServerRequest:d}=Ot(),l=n("kDestroy"),c=n("kConstruct");function f(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):(f(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;f(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(u,I)}function u(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 Tn={construct:m,destroyer:B,destroy:v,undestroy:_,errorOrDestroy:E},Tn}var An,ms;function va(){if(ms)return An;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",f),s.on("close",v));let c=!1;function f(){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",f),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 An={Stream:i,prependListener:n},An}var jn={exports:{}},gs;function sn(){return gs||(gs=1,function(r){const{SymbolDispose:e}=Be(),{AbortError:t,codes:i}=nt(),{isNodeStream:n,isWebStream:o,kControllerErrorFunction:a}=Ot(),s=Wt(),{ERR_INVALID_ARG_TYPE:d}=i;let l;const c=(f,v)=>{if(typeof f!="object"||!("aborted"in f))throw new d(v,"AbortSignal",f)};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(f,v){if(typeof f!="object"||!("aborted"in f))return v;const g=n(v)?()=>{v.destroy(new t(void 0,{cause:f.reason}))}:()=>{v[a](new t(void 0,{cause:f.reason}))};if(f.aborted)g();else{l=l||at().addAbortListener;const y=l(f,g);s(v,y[e])}return v}}(jn)),jn.exports}var Dn,vs;function ku(){if(vs)return Dn;vs=1;const{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:i}=Be(),{Buffer:n}=Lt(),{inspect:o}=at();return Dn=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 f=l.data;if(s>f.length)d+=f,s-=f.length;else{s===f.length?(d+=f,++c,l.next?this.head=l.next:this.head=this.tail=null):(d+=r(f,0,s),this.head=l,l.data=r(f,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,f=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),++f,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}++f}while((c=c.next)!==null);return this.length-=f,d}[Symbol.for("nodejs.util.inspect.custom")](s,d){return o(this,{...d,depth:0,customInspect:!1})}},Dn}var Ln,ys;function ln(){if(ys)return Ln;ys=1;const{MathFloor:r,NumberIsInteger:e}=Be(),{validateInteger:t}=Ei(),{ERR_INVALID_ARG_VALUE:i}=nt().codes;let n=16*1024,o=16;function a(c,f,v){return c.highWaterMark!=null?c.highWaterMark:f?c[v]:null}function s(c){return c?o:n}function d(c,f){t(f,"value",0),c?o=f:n=f}function l(c,f,v,g){const y=a(f,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 Ln={getHighWaterMark:l,getDefaultHighWaterMark:s,setDefaultHighWaterMark:d},Ln}var On={},Mi={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var ws;function Eu(){return ws||(ws=1,function(r,e){var t=Lt(),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)}}(Mi,Mi.exports)),Mi.exports}var xs;function Su(){if(xs)return On;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||_}On.StringDecoder=n;function n(_){this.encoding=i(_);var E;switch(this.encoding){case"utf16le":this.text=f,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 u=E.length-1;if(u<m)return 0;var b=o(E[u]);return b>=0?(b>0&&(_.lastNeed=b-1),b):--u<m||b===-2?0:(b=o(E[u]),b>=0?(b>0&&(_.lastNeed=b-2),b):--u<m||b===-2?0:(b=o(E[u]),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 u=_.length-(m-this.lastNeed);return _.copy(this.lastChar,0,u),_.toString("utf8",E,u)}function c(_){var E=_&&_.length?this.write(_):"";return this.lastNeed?E+"�":E}function f(_,E){if((_.length-E)%2===0){var m=_.toString("utf16le",E);if(m){var u=m.charCodeAt(m.length-1);if(u>=55296&&u<=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 On}var Cn,_s;function ec(){if(_s)return Cn;_s=1;const r=hr(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:i}=Be(),{Buffer:n}=Lt(),{ERR_INVALID_ARG_TYPE:o,ERR_STREAM_NULL_VALUES:a}=nt().codes;function s(d,l,c){let f;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,f=l[t]();else if(l&&l[i])v=!1,f=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 f.throw=="function";if(E&&m){const{value:u,done:b}=await f.throw(_);if(await u,b)return}if(typeof f.return=="function"){const{value:u}=await f.return();await u}}async function x(){for(;;){try{const{value:_,done:E}=v?await f.next():f.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 Cn=s,Cn}var $n,ks;function dn(){if(ks)return $n;ks=1;const r=hr(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:i,NumberParseInt:n,ObjectDefineProperties:o,ObjectKeys:a,ObjectSetPrototypeOf:s,Promise:d,SafeSet:l,SymbolAsyncDispose:c,SymbolAsyncIterator:f,Symbol:v}=Be();$n=le,le.ReadableState=ge;const{EventEmitter:g}=an(),{Stream:y,prependListener:k}=va(),{Buffer:x}=Lt(),{addAbortSignal:_}=sn(),E=Wt();let m=at().debuglog("stream",D=>{m=D});const u=ku(),b=Cr(),{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}=nt(),{validateObject:te}=Ei(),N=v("kPaused"),{StringDecoder:Z}=Su(),F=ec();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 jt()),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 u,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 jt();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 Ie(this,D,M,!1)},le.prototype.unshift=function(D,M){return Ie(this,D,M,!0)};function Ie(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 Se=1073741824;function Qe(D){if(D>Se)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?Ue(this):h(this),null;if(D=S(D,M),D===0&&M.ended)return M.length===0&&Ue(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&&Ue(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?Ai:P;ye.endEmitted?r.nextTick(Xe):ve.once("end",Xe),D.on("unpipe",Ye);function Ye(ie,ne){m("onunpipe"),ie===ve&&ne&&ne.hasUnpiped===!1&&(ne.hasUnpiped=!0,It())}function Ai(){m("onend"),D.end()}let Rt,ji=!1;function It(){m("cleanup"),D.removeListener("close",qr),D.removeListener("finish",Ve),Rt&&D.removeListener("drain",Rt),D.removeListener("error",gr),D.removeListener("unpipe",Ye),ve.removeListener("end",Ai),ve.removeListener("end",P),ve.removeListener("data",mr),ji=!0,Rt&&ye.awaitDrainWriters&&(!D._writableState||D._writableState.needDrain)&&Rt()}function Br(){ji||(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",mr);function mr(ie){m("ondata");const ne=D.write(ie);m("dest.write",ne),ne===!1&&Br()}function gr(ie){if(m("onerror",ie),P(),D.removeListener("error",gr),D.listenerCount("error")===0){const ne=D._writableState||D._readableState;ne&&!ne.errorEmitted?w(D,ie):D.emit("error",ie)}}k(D,"error",gr);function qr(){D.removeListener("finish",Ve),P()}D.once("close",qr);function Ve(){m("onfinish"),D.removeListener("close",qr),P()}D.once("finish",Ve);function P(){m("unpipe"),ve.unpipe(D)}return D.emit("pipe",ve),D.writableNeedDrain===!0?Br():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[f]=function(){return gt(this)},le.prototype.iterator=function(D){return D!==void 0&&te(D,"options"),gt(this,D)};function gt(D,M){typeof D.read!="function"&&(D=le.wrap(D,{objectMode:!0}));const ve=Pt(D,M);return ve.stream=D,ve}async function*Pt(D,M){let ve=Y;function ye(Ye){this===D?(ve(),ve=Y):ve=Ye}D.on("readable",ye);let xe;const Xe=E(D,{writable:!1},Ye=>{xe=Ye?T(xe,Ye):null,ve(),ve=Y});try{for(;;){const Ye=D.destroyed?null:D.read();if(Ye!==null)yield Ye;else{if(xe)throw xe;if(xe===null)return;await new d(ye)}}}catch(Ye){throw xe=T(xe,Ye),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 Ue(D){const M=D._readableState;m("endReadable",M.endEmitted),M.endEmitted||(M.ended=!0,r.nextTick(Ti,M,D))}function Ti(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(Mt,M);else if(D.autoDestroy){const ve=M._writableState;(!ve||ve.autoDestroy&&(ve.finished||ve.writable===!1))&&M.destroy()}}}function Mt(D){D.writable&&!D.writableEnded&&!D.destroyed&&D.end()}le.from=function(D,M){return F(le,D,M)};let br;function Mr(){return br===void 0&&(br={}),br}return le.fromWeb=function(D,M){return Mr().newStreamReadableFromReadableStream(D,M)},le.toWeb=function(D,M){return Mr().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)},$n}var Fn,Es;function ya(){if(Es)return Fn;Es=1;const r=hr(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:i,ObjectDefineProperty:n,ObjectDefineProperties:o,ObjectSetPrototypeOf:a,StringPrototypeToLowerCase:s,Symbol:d,SymbolHasInstance:l}=Be();Fn=te,te.WritableState=A;const{EventEmitter:c}=an(),f=va().Stream,{Buffer:v}=Lt(),g=Cr(),{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:u,ERR_STREAM_DESTROYED:b,ERR_STREAM_ALREADY_FINISHED:R,ERR_STREAM_NULL_VALUES:L,ERR_STREAM_WRITE_AFTER_END:T,ERR_UNKNOWN_ENCODING:B}=nt().codes,{errorOrDestroy:I}=g;a(te.prototype,f.prototype),a(te,f);function $(){}const q=d("kOnFinished");function A(O,V,oe){typeof oe!="boolean"&&(oe=V instanceof jt()),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 jt();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)),f.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 u)};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(f._isUint8Array(V))V=f._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 Ie=J;Ie<oe.length;++Ie)oe[Ie].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 Ie=he?1:ce.length;F(O,V,!1,Ie,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)},Fn}var Pn,Ss;function Ru(){if(Ss)return Pn;Ss=1;const r=hr(),e=Lt(),{isReadable:t,isWritable:i,isIterable:n,isNodeStream:o,isReadableNodeStream:a,isWritableNodeStream:s,isDuplexNodeStream:d,isReadableStream:l,isWritableStream:c}=Ot(),f=Wt(),{AbortError:v,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:y}}=nt(),{destroyer:k}=Cr(),x=jt(),_=dn(),E=ya(),{createDeferredPromise:m}=at(),u=ec(),b=globalThis.Blob||e.Blob,R=typeof b<"u"?function(A){return A instanceof b}:function(A){return!1},L=globalThis.AbortController||wi().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)}}Pn=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 u(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 u(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&&(f(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&&(f(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 Pn}var Mn,Rs;function jt(){if(Rs)return Mn;Rs=1;const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:i}=Be();Mn=a;const n=dn(),o=ya();i(a.prototype,n.prototype),i(a,n);{const c=t(o.prototype);for(let f=0;f<c.length;f++){const v=c[f];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,f){return d().newStreamDuplexFromReadableWritablePair(c,f)},a.toWeb=function(c){return d().newReadableWritablePairFromDuplex(c)};let l;return a.from=function(c){return l||(l=Ru()),l(c,"body")},Mn}var Bn,Is;function tc(){if(Is)return Bn;Is=1;const{ObjectSetPrototypeOf:r,Symbol:e}=Be();Bn=a;const{ERR_METHOD_NOT_IMPLEMENTED:t}=nt().codes,i=jt(),{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,f)=>{if(c){l?l(c):this.destroy(c);return}f!=null&&this.push(f),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,f){throw new t("_transform()")},a.prototype._write=function(l,c,f){const v=this._readableState,g=this._writableState,y=v.length;this._transform(l,c,(k,x)=>{if(k){f(k);return}x!=null&&this.push(x),g.ended||y===v.length||v.length<v.highWaterMark?f():this[o]=f})},a.prototype._read=function(){if(this[o]){const l=this[o];this[o]=null,l()}},Bn}var qn,Ns;function rc(){if(Ns)return qn;Ns=1;const{ObjectSetPrototypeOf:r}=Be();qn=t;const e=tc();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)},qn}var zn,Ts;function wa(){if(Ts)return zn;Ts=1;const r=hr(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:i,SymbolDispose:n}=Be(),o=Wt(),{once:a}=at(),s=Cr(),d=jt(),{aggregateTwoErrors:l,codes:{ERR_INVALID_ARG_TYPE:c,ERR_INVALID_RETURN_VALUE:f,ERR_MISSING_ARGS:v,ERR_STREAM_DESTROYED:g,ERR_STREAM_PREMATURE_CLOSE:y},AbortError:k}=nt(),{validateFunction:x,validateAbortSignal:_}=Ei(),{isIterable:E,isReadable:m,isReadableNodeStream:u,isNodeStream:b,isTransformStream:R,isWebStream:L,isReadableStream:T,isReadableFinished:B}=Ot(),I=globalThis.AbortController||wi().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(u(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 Ie;if(ge&&(!be||be.code==="ERR_STREAM_PREMATURE_CLOSE")&&(be=ge),!(!be&&!le)){for(;V.length;)V.shift()(be);(Ie=pe)===null||Ie===void 0||Ie[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],Ie=ge<X.length-1,We=ge>0,Se=Ie||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(Se){const{destroy:p,cleanup:h}=j(le,Ie,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 f("Iterable, AsyncIterable or Stream","source",me)}else E(le)||u(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}),Ie){if(!E(me,!0))throw new f("AsyncIterable",`transform[${ge-1}]`,me)}else{var ce;$||($=rc());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),Se&&S.end(),r.nextTick(fe)},Q=>{S.destroy(Q),r.nextTick(fe,Q)});else if(E(me,!0))oe++,F(me,S,fe,{end:Se});else if(T(me)||R(me)){const Q=me.readable||me;oe++,F(Q,S,fe,{end:Se})}else throw new f("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(u(me)){oe+=2;const S=K(me,le,fe,{end:Se});m(le)&&Qe&&ee.push(S)}else if(R(me)||T(me)){const S=me.readable||me;oe++,F(S,le,fe,{end:Se})}else if(E(me))oe++,F(me,le,fe,{end:Se});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else if(L(le)){if(u(me))oe++,Y(N(me),le,fe,{end:Se});else if(T(me)||E(me))oe++,Y(me,le,fe,{end:Se});else if(R(me))oe++,Y(me.readable,le,fe,{end:Se});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 zn={pipelineImpl:U,pipeline:w},zn}var Un,As;function ic(){if(As)return Un;As=1;const{pipeline:r}=wa(),e=jt(),{destroyer:t}=Cr(),{isNodeStream:i,isReadable:n,isWritable:o,isWebStream:a,isTransformStream:s,isWritableStream:d,isReadableStream:l}=Ot(),{AbortError:c,codes:{ERR_INVALID_ARG_VALUE:f,ERR_MISSING_ARGS:v}}=nt(),g=Wt();return Un=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 f(`streams[${$}]`,x[$],"must be readable");if($>0&&!(o(k[$])||d(k[$])||s(k[$])))throw new f(`streams[${$}]`,x[$],"must be writable")}let _,E,m,u,b;function R($){const q=u;u=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){!$&&u!==null&&($=new c),m=null,_=null,E=null,u===null?q($):(u=q,i(T)&&t(T,$))},b},Un}var js;function Iu(){if(js)return Fi;js=1;const r=globalThis.AbortController||wi().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:i,ERR_OUT_OF_RANGE:n},AbortError:o}=nt(),{validateAbortSignal:a,validateInteger:s,validateObject:d}=Ei(),l=Be().Symbol("kWeak"),c=Be().Symbol("kResistStopPropagation"),{finished:f}=Wt(),v=ic(),{addAbortSignalNoValidate:g}=sn(),{isWritable:y,isNodeStream:k}=Ot(),{deprecate:x}=at(),{ArrayPrototypePush:_,Boolean:E,MathFloor:m,Number:u,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,Ie()}function Ie(){me&&!J&&ce<re&&oe.length<pe&&(me(),me=null)}async function We(){try{for await(let Se of V){if(J)return;if(O.aborted)throw new o;try{if(Se=z(Se,fe),Se===$)continue;Se=T(Se)}catch(Qe){Se=L(Qe)}ce+=1,B(Se,le,ge),oe.push(Se),he&&(he(),he=null),!J&&(oe.length>=pe||ce>=re)&&await new R(Qe=>{me=Qe})}oe.push(q)}catch(Se){const Qe=L(Se);B(Qe,le,ge),oe.push(Qe)}finally{J=!0,he&&(he(),he=null)}}We();try{for(;;){for(;oe.length>0;){const Se=await oe[0];if(Se===q)return;if(O.aborted)throw new o;Se!==$&&(yield Se),oe.shift(),Ie()}await new R(Se=>{he=Se})}}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 f(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=u(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 Fi.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},Fi.promiseReturningOperators={every:Z,forEach:Y,reduce:K,toArray:X,some:N,find:F},Fi}var Hn,Ds;function nc(){if(Ds)return Hn;Ds=1;const{ArrayPrototypePop:r,Promise:e}=Be(),{isIterable:t,isNodeStream:i,isWebStream:n}=Ot(),{pipelineImpl:o}=wa(),{finished:a}=Wt();oc();function s(...d){return new e((l,c)=>{let f,v;const g=d[d.length-1];if(g&&typeof g=="object"&&!i(g)&&!t(g)&&!n(g)){const y=r(d);f=y.signal,v=y.end}o(d,(y,k)=>{y?c(y):l(k)},{signal:f,end:v})})}return Hn={finished:a,pipeline:s},Hn}var Ls;function oc(){if(Ls)return xn.exports;Ls=1;const{Buffer:r}=Lt(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:i}=Be(),{promisify:{custom:n}}=at(),{streamReturningOperators:o,promiseReturningOperators:a}=Iu(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:s}}=nt(),d=ic(),{setDefaultHighWaterMark:l,getDefaultHighWaterMark:c}=ln(),{pipeline:f}=wa(),{destroyer:v}=Cr(),g=Wt(),y=nc(),k=Ot(),x=xn.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 u=function(...b){if(new.target)throw s();return x.Readable.from(i(m,this,b))};const m=o[E];e(u,"name",{__proto__:null,value:m.name}),e(u,"length",{__proto__:null,value:m.length}),e(x.Readable.prototype,E,{__proto__:null,value:u,enumerable:!1,configurable:!0,writable:!0})}for(const E of t(a)){let u=function(...b){if(new.target)throw s();return i(m,this,b)};const m=a[E];e(u,"name",{__proto__:null,value:m.name}),e(u,"length",{__proto__:null,value:m.length}),e(x.Readable.prototype,E,{__proto__:null,value:u,enumerable:!1,configurable:!0,writable:!0})}x.Writable=ya(),x.Duplex=jt(),x.Transform=tc(),x.PassThrough=rc(),x.pipeline=f;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(f,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)},xn.exports}var Os;function ac(){return Os||(Os=1,function(r){const e=oc(),t=nc(),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}(wn)),wn.exports}var xa=ac();const Gn=Symbol("iter");function bi(r,e,t=4){if(t===0)return Object.assign(r,e);for(const i in e)r[i]=bi(r[i]||Object.create(null),e[i],t-1);return r}function sc(r,e,t=4){let i=!1;for(const n in r)if(n in e){const o=t===0?null:sc(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 lc(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:bi({},r[n],t-1);else if(t!==0){const o=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}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||Re}_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 ui(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&&(oa(e.graph)||(o=this._termToNumericId(e.graph)))&&this._ids[o?`.${t}.${i}.${n}.${o}`:`.${t}.${i}.${n}`]}return this._ids[Sr(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${oa(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Sr(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 et{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||Re,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,f;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(f=c[x]){y[a]=this._termFromId(v[x]);const _=n?n in f?[n]:[]:Object.keys(f);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 qt(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 f in o)(s=o[f])&&(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,f;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 u=0;u<k.length&&!l;u++)x=k[u],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,f="subject"):l=n(g,"not confined to single graph");for(let u=0;u<y.length&&!l;++u)x=y[u],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,f="object");_?d.unshift(_.object):l=n(g,"has no list head"),g=m&&m.subject}l?e=!1:c&&(i[c[f].value]=d)}),e&&this.removeQuads(a),i}addAll(e){if(e instanceof qt&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof et&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=bi(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof qt&&(e=e.filtered),e===this)return!0;if(!(e instanceof et)||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 f in s=o[c]){if(!(d=a[f]))return!1;for(const v in s[f])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 qt&&(e=e.filtered),e===this)return new et({entityIndex:this._entityIndex});if(e instanceof et&&e._entityIndex===this._entityIndex){const t=new et({entityIndex:this._entityIndex}),i=lc(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 qt&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new et({entityIndex:this._entityIndex});for(const i of this)e(i,this)&&t.add(i);return t}intersection(e){if(e instanceof qt&&(e=e.filtered),e===this){const t=new et({entityIndex:this._entityIndex});return t._graphs=bi(Object.create(null),this._graphs),t._size=this._size,t}else if(e instanceof et&&this._entityIndex===e._entityIndex){const t=new et({entityIndex:this._entityIndex}),i=sc(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 et({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 et({entityIndex:this._entityIndex});return t._graphs=bi(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function kt(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:kt(r[o],e,t+1);a!==!1&&(n=n||Object.create(null),n[o]=a)}return n}class qt 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 et({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 f in c){let v,g,y,k;(k=c[f])&&(!s&&d?(g=kt(k.predicates,[d,l,s]))&&(v=kt(k.subjects,[s,d,l]),y=kt(k.objects,[l,s,d])):l?(y=kt(k.objects,[l,s,d]))&&(v=kt(k.subjects,[s,d,l]),g=kt(k.predicates,[d,l,s])):(v=kt(k.subjects,[s,d,l]))&&(g=kt(k.predicates,[d,l,s]),y=kt(k.objects,[l,s,d])),v&&(a._graphs[f]={subjects:v,predicates:g,objects:y}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Gn]&&(this[Gn]=this[Symbol.iterator]());const t=this[Gn];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 qt(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 Kd(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#",Gt="http://www.w3.org/2001/XMLSchema#",zt="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/",Rr=Re.namedNode("loaded-shapes"),At=Re.namedNode("loaded-data"),tt=Re.namedNode(zt+"type"),aa=Re.namedNode(Du+"conformsTo"),$s=Re.namedNode(_a+"subClassOf"),Ea=Re.namedNode(Au+"imports"),Ou=Re.namedNode(ka+"broader"),Cu=Re.namedNode(ka+"narrower"),Bi=Re.namedNode(_e+"NodeShape"),$u=Re.namedNode(_e+"IRI"),Ki=Re.namedNode(_e+"property"),Sa=Re.namedNode(_e+"class"),dc=Re.namedNode(_e+"node"),Ir=Re.namedNode(_e+"targetClass"),Fu=Re.namedNode(_e+"nodeKind"),Pu=Re.namedNode(Gt+"string");function mi(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 mi(r,"prefLabel",ka,e)||mi(r,"label",_a,e)||mi(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 sa(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(tt,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(tt,r,Rr);t.push(...e.config.store.getSubjects(tt,r,At)),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 la(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,zt+"rest",zt+"nil",null),a=e?[...o]:[];return o.forEach(s=>{const d=[];let l=!1,c,f;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(u=>!u.predicate.equals(tt));let x,_=null,E=null,m=null;for(let u=0;u<k.length&&!l;u++)x=k[u],x.graph.equals(v)?c?l=n(g,"has non-list arcs out"):x.predicate.value===zt+"first"?_?l=n(g,"has multiple rdf:first arcs"):a.push(_=x):x.predicate.value===zt+"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,f="subject"):l=n(g,"not confined to single graph");for(let u=0;u<y.length&&!l;++u)x=y[u],c?l=n(g,"can't have coreferences"):x.predicate.value===zt+"rest"?m?l=n(g,"has incoming rdf:rest arcs"):m=x:(c=x,f="object");_?d.unshift(_.object):l=n(g,"has no list head"),g=m&&m.subject}l?e=!1:c&&(i[c[f].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 Vt){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),f=[];let v="";for(const g of c){const y=new en(g,e,t);f.push(y),v+=(v.length>1?" / ":"")+y.template.label}o.push(f),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 f=1;f<l.length;f++)c.after(l[f]),c=l[f]}},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)||sa(l[0].predicate.value,t.prefixes)+" = "+sa(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 ct){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,tt,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,Ir,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=Re.namedNode(zt+"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(Ir,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?sa(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; }
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=xu[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 wn={exports:{}},xn={exports:{}},_n,os;function Be(){if(os)return _n;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 _n={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},_n}var kn={exports:{}},En,as;function Zd(){return as||(as=1,En={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"{}"}}}),En}var Sn,ss;function nt(){if(ss)return Sn;ss=1;const{format:r,inspect:e}=Zd(),{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),Sn={AbortError:k,aggregateTwoErrors:g(y),hideStackFrames:g,codes:d},Sn}var Wr={exports:{}},ls;function xi(){if(ls)return Wr.exports;ls=1;const{AbortController:r,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return Wr.exports=r,Wr.exports.AbortSignal=e,Wr.exports.default=r,Wr.exports}var Fi={exports:{}},ds;function an(){if(ds)return Fi.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)}Fi.exports=o,Fi.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 Fi.exports}var cs;function at(){return cs||(cs=1,function(r){const e=Lt(),{format:t,inspect:i}=Zd(),{codes:{ERR_INVALID_ARG_TYPE:n}}=nt(),{kResistStopPropagation:o,AggregateError:a,SymbolDispose:s}=Be(),d=globalThis.AbortSignal||xi().AbortSignal,l=globalThis.AbortController||xi().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")}(kn)),kn.exports}var Pi={},Rn,us;function Si(){if(us)return Rn;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}}=nt(),{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,Ie=4294967295;if(J<le||J>Ie)throw new E(ce,`>= ${le} && <= ${Ie}`,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 Ie="must be one of: "+t(i(ge,We=>typeof We=="string"?`'${We}'`:u(We)),", ");throw new _(ce,J,Ie)}});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),Ie=w(ge,"allowFunction",!1);if(!w(ge,"nullable",!1)&&J===null||!le&&r(J)||typeof J!="object"&&(!Ie||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],Ie=`${ce}[${ge}]`;if(le==null)throw new x(Ie,"AbortSignal",le);pe(le,Ie)}}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 Ie=J[le];he(Ie,"hints"),ge+=Ie,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 Rn={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},Rn}var Mi={exports:{}},In={exports:{}},fs;function hr(){if(fs)return In.exports;fs=1;var r=In.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},In.exports}var Nn,ps;function Ot(){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 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 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: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},Nn}var hs;function Wt(){if(hs)return Mi.exports;hs=1;const r=hr(),{AbortError:e,codes:t}=nt(),{ERR_INVALID_ARG_TYPE:i,ERR_STREAM_PREMATURE_CLOSE:n}=t,{kEmptyObject:o,once:a}=at(),{validateAbortSignal:s,validateFunction:d,validateObject:l,validateBoolean:c}=Si(),{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:$}=Ot();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 Mi.exports=te,Mi.exports.finished=Z,Mi.exports}var Tn,bs;function Or(){if(bs)return Tn;bs=1;const r=hr(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:i}=nt(),{Symbol:n}=Be(),{kIsDestroyed:o,isDestroyed:a,isFinished:s,isServerRequest:d}=Ot(),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 Tn={construct:m,destroyer:B,destroy:v,undestroy:_,errorOrDestroy:E},Tn}var An,ms;function va(){if(ms)return An;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 An={Stream:i,prependListener:n},An}var jn={exports:{}},gs;function sn(){return gs||(gs=1,function(r){const{SymbolDispose:e}=Be(),{AbortError:t,codes:i}=nt(),{isNodeStream:n,isWebStream:o,kControllerErrorFunction:a}=Ot(),s=Wt(),{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}}(jn)),jn.exports}var Dn,vs;function _u(){if(vs)return Dn;vs=1;const{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:i}=Be(),{Buffer:n}=Lt(),{inspect:o}=at();return Dn=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})}},Dn}var Ln,ys;function ln(){if(ys)return Ln;ys=1;const{MathFloor:r,NumberIsInteger:e}=Be(),{validateInteger:t}=Si(),{ERR_INVALID_ARG_VALUE:i}=nt().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 Ln={getHighWaterMark:l,getDefaultHighWaterMark:s,setDefaultHighWaterMark:d},Ln}var On={},Bi={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var ws;function ku(){return ws||(ws=1,function(r,e){var t=Lt(),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)}}(Bi,Bi.exports)),Bi.exports}var xs;function Eu(){if(xs)return On;xs=1;var r=ku().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||_}On.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 On}var Cn,_s;function ec(){if(_s)return Cn;_s=1;const r=hr(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:i}=Be(),{Buffer:n}=Lt(),{ERR_INVALID_ARG_TYPE:o,ERR_STREAM_NULL_VALUES:a}=nt().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 Cn=s,Cn}var $n,ks;function dn(){if(ks)return $n;ks=1;const r=hr(),{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();$n=le,le.ReadableState=ge;const{EventEmitter:g}=an(),{Stream:y,prependListener:k}=va(),{Buffer:x}=Lt(),{addAbortSignal:_}=sn(),E=Wt();let m=at().debuglog("stream",D=>{m=D});const f=_u(),b=Or(),{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}=nt(),{validateObject:te}=Si(),N=v("kPaused"),{StringDecoder:Z}=Eu(),F=ec();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 jt()),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 jt();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 Ie(this,D,M,!1)},le.prototype.unshift=function(D,M){return Ie(this,D,M,!0)};function Ie(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 Se=1073741824;function Qe(D){if(D>Se)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?Ue(this):h(this),null;if(D=S(D,M),D===0&&M.ended)return M.length===0&&Ue(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&&Ue(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?ji:P;ye.endEmitted?r.nextTick(Xe):ve.once("end",Xe),D.on("unpipe",Ye);function Ye(ie,ne){m("onunpipe"),ie===ve&&ne&&ne.hasUnpiped===!1&&(ne.hasUnpiped=!0,It())}function ji(){m("onend"),D.end()}let Rt,Di=!1;function It(){m("cleanup"),D.removeListener("close",Br),D.removeListener("finish",Ve),Rt&&D.removeListener("drain",Rt),D.removeListener("error",gr),D.removeListener("unpipe",Ye),ve.removeListener("end",ji),ve.removeListener("end",P),ve.removeListener("data",mr),Di=!0,Rt&&ye.awaitDrainWriters&&(!D._writableState||D._writableState.needDrain)&&Rt()}function Mr(){Di||(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",mr);function mr(ie){m("ondata");const ne=D.write(ie);m("dest.write",ne),ne===!1&&Mr()}function gr(ie){if(m("onerror",ie),P(),D.removeListener("error",gr),D.listenerCount("error")===0){const ne=D._writableState||D._readableState;ne&&!ne.errorEmitted?w(D,ie):D.emit("error",ie)}}k(D,"error",gr);function Br(){D.removeListener("finish",Ve),P()}D.once("close",Br);function Ve(){m("onfinish"),D.removeListener("close",Br),P()}D.once("finish",Ve);function P(){m("unpipe"),ve.unpipe(D)}return D.emit("pipe",ve),D.writableNeedDrain===!0?Mr():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 gt(this)},le.prototype.iterator=function(D){return D!==void 0&&te(D,"options"),gt(this,D)};function gt(D,M){typeof D.read!="function"&&(D=le.wrap(D,{objectMode:!0}));const ve=Pt(D,M);return ve.stream=D,ve}async function*Pt(D,M){let ve=Y;function ye(Ye){this===D?(ve(),ve=Y):ve=Ye}D.on("readable",ye);let xe;const Xe=E(D,{writable:!1},Ye=>{xe=Ye?T(xe,Ye):null,ve(),ve=Y});try{for(;;){const Ye=D.destroyed?null:D.read();if(Ye!==null)yield Ye;else{if(xe)throw xe;if(xe===null)return;await new d(ye)}}}catch(Ye){throw xe=T(xe,Ye),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 Ue(D){const M=D._readableState;m("endReadable",M.endEmitted),M.endEmitted||(M.ended=!0,r.nextTick(Ai,M,D))}function Ai(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(Mt,M);else if(D.autoDestroy){const ve=M._writableState;(!ve||ve.autoDestroy&&(ve.finished||ve.writable===!1))&&M.destroy()}}}function Mt(D){D.writable&&!D.writableEnded&&!D.destroyed&&D.end()}le.from=function(D,M){return F(le,D,M)};let br;function Pr(){return br===void 0&&(br={}),br}return le.fromWeb=function(D,M){return Pr().newStreamReadableFromReadableStream(D,M)},le.toWeb=function(D,M){return Pr().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)},$n}var Fn,Es;function ya(){if(Es)return Fn;Es=1;const r=hr(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:i,ObjectDefineProperty:n,ObjectDefineProperties:o,ObjectSetPrototypeOf:a,StringPrototypeToLowerCase:s,Symbol:d,SymbolHasInstance:l}=Be();Fn=te,te.WritableState=A;const{EventEmitter:c}=an(),u=va().Stream,{Buffer:v}=Lt(),g=Or(),{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}=nt().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 jt()),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 jt();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 Ie=J;Ie<oe.length;++Ie)oe[Ie].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 Ie=he?1:ce.length;F(O,V,!1,Ie,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)},Fn}var Pn,Ss;function Su(){if(Ss)return Pn;Ss=1;const r=hr(),e=Lt(),{isReadable:t,isWritable:i,isIterable:n,isNodeStream:o,isReadableNodeStream:a,isWritableNodeStream:s,isDuplexNodeStream:d,isReadableStream:l,isWritableStream:c}=Ot(),u=Wt(),{AbortError:v,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:y}}=nt(),{destroyer:k}=Or(),x=jt(),_=dn(),E=ya(),{createDeferredPromise:m}=at(),f=ec(),b=globalThis.Blob||e.Blob,R=typeof b<"u"?function(A){return A instanceof b}:function(A){return!1},L=globalThis.AbortController||xi().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)}}Pn=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 Pn}var Mn,Rs;function jt(){if(Rs)return Mn;Rs=1;const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:i}=Be();Mn=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=Su()),l(c,"body")},Mn}var Bn,Is;function tc(){if(Is)return Bn;Is=1;const{ObjectSetPrototypeOf:r,Symbol:e}=Be();Bn=a;const{ERR_METHOD_NOT_IMPLEMENTED:t}=nt().codes,i=jt(),{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()}},Bn}var qn,Ns;function rc(){if(Ns)return qn;Ns=1;const{ObjectSetPrototypeOf:r}=Be();qn=t;const e=tc();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)},qn}var zn,Ts;function wa(){if(Ts)return zn;Ts=1;const r=hr(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:i,SymbolDispose:n}=Be(),o=Wt(),{once:a}=at(),s=Or(),d=jt(),{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}=nt(),{validateFunction:x,validateAbortSignal:_}=Si(),{isIterable:E,isReadable:m,isReadableNodeStream:f,isNodeStream:b,isTransformStream:R,isWebStream:L,isReadableStream:T,isReadableFinished:B}=Ot(),I=globalThis.AbortController||xi().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 Ie;if(ge&&(!be||be.code==="ERR_STREAM_PREMATURE_CLOSE")&&(be=ge),!(!be&&!le)){for(;V.length;)V.shift()(be);(Ie=pe)===null||Ie===void 0||Ie[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],Ie=ge<X.length-1,We=ge>0,Se=Ie||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(Se){const{destroy:p,cleanup:h}=j(le,Ie,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}),Ie){if(!E(me,!0))throw new u("AsyncIterable",`transform[${ge-1}]`,me)}else{var ce;$||($=rc());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),Se&&S.end(),r.nextTick(fe)},Q=>{S.destroy(Q),r.nextTick(fe,Q)});else if(E(me,!0))oe++,F(me,S,fe,{end:Se});else if(T(me)||R(me)){const Q=me.readable||me;oe++,F(Q,S,fe,{end:Se})}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:Se});m(le)&&Qe&&ee.push(S)}else if(R(me)||T(me)){const S=me.readable||me;oe++,F(S,le,fe,{end:Se})}else if(E(me))oe++,F(me,le,fe,{end:Se});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:Se});else if(T(me)||E(me))oe++,Y(me,le,fe,{end:Se});else if(R(me))oe++,Y(me.readable,le,fe,{end:Se});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 zn={pipelineImpl:U,pipeline:w},zn}var Un,As;function ic(){if(As)return Un;As=1;const{pipeline:r}=wa(),e=jt(),{destroyer:t}=Or(),{isNodeStream:i,isReadable:n,isWritable:o,isWebStream:a,isTransformStream:s,isWritableStream:d,isReadableStream:l}=Ot(),{AbortError:c,codes:{ERR_INVALID_ARG_VALUE:u,ERR_MISSING_ARGS:v}}=nt(),g=Wt();return Un=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},Un}var js;function Ru(){if(js)return Pi;js=1;const r=globalThis.AbortController||xi().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:i,ERR_OUT_OF_RANGE:n},AbortError:o}=nt(),{validateAbortSignal:a,validateInteger:s,validateObject:d}=Si(),l=Be().Symbol("kWeak"),c=Be().Symbol("kResistStopPropagation"),{finished:u}=Wt(),v=ic(),{addAbortSignalNoValidate:g}=sn(),{isWritable:y,isNodeStream:k}=Ot(),{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,Ie()}function Ie(){me&&!J&&ce<re&&oe.length<pe&&(me(),me=null)}async function We(){try{for await(let Se of V){if(J)return;if(O.aborted)throw new o;try{if(Se=z(Se,fe),Se===$)continue;Se=T(Se)}catch(Qe){Se=L(Qe)}ce+=1,B(Se,le,ge),oe.push(Se),he&&(he(),he=null),!J&&(oe.length>=pe||ce>=re)&&await new R(Qe=>{me=Qe})}oe.push(q)}catch(Se){const Qe=L(Se);B(Qe,le,ge),oe.push(Qe)}finally{J=!0,he&&(he(),he=null)}}We();try{for(;;){for(;oe.length>0;){const Se=await oe[0];if(Se===q)return;if(O.aborted)throw new o;Se!==$&&(yield Se),oe.shift(),Ie()}await new R(Se=>{he=Se})}}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 Pi.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},Pi.promiseReturningOperators={every:Z,forEach:Y,reduce:K,toArray:X,some:N,find:F},Pi}var Hn,Ds;function nc(){if(Ds)return Hn;Ds=1;const{ArrayPrototypePop:r,Promise:e}=Be(),{isIterable:t,isNodeStream:i,isWebStream:n}=Ot(),{pipelineImpl:o}=wa(),{finished:a}=Wt();oc();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 Hn={finished:a,pipeline:s},Hn}var Ls;function oc(){if(Ls)return xn.exports;Ls=1;const{Buffer:r}=Lt(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:i}=Be(),{promisify:{custom:n}}=at(),{streamReturningOperators:o,promiseReturningOperators:a}=Ru(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:s}}=nt(),d=ic(),{setDefaultHighWaterMark:l,getDefaultHighWaterMark:c}=ln(),{pipeline:u}=wa(),{destroyer:v}=Or(),g=Wt(),y=nc(),k=Ot(),x=xn.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=jt(),x.Transform=tc(),x.PassThrough=rc(),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)},xn.exports}var Os;function ac(){return Os||(Os=1,function(r){const e=oc(),t=nc(),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}(wn)),wn.exports}var xa=ac();const Gn=Symbol("iter");function hi(r,e,t=4){if(t===0)return Object.assign(r,e);for(const i in e)r[i]=hi(r[i]||Object.create(null),e[i],t-1);return r}function sc(r,e,t=4){let i=!1;for(const n in r)if(n in e){const o=t===0?null:sc(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 lc(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:hi({},r[n],t-1);else if(t!==0){const o=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}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||Re}_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 ci(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&&(oa(e.graph)||(o=this._termToNumericId(e.graph)))&&this._ids[o?`.${t}.${i}.${n}.${o}`:`.${t}.${i}.${n}`]}return this._ids[Sr(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${oa(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Sr(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 et{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||Re,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 qt(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 qt&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof et&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=hi(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof qt&&(e=e.filtered),e===this)return!0;if(!(e instanceof et)||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 qt&&(e=e.filtered),e===this)return new et({entityIndex:this._entityIndex});if(e instanceof et&&e._entityIndex===this._entityIndex){const t=new et({entityIndex:this._entityIndex}),i=lc(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 qt&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new et({entityIndex:this._entityIndex});for(const i of this)e(i,this)&&t.add(i);return t}intersection(e){if(e instanceof qt&&(e=e.filtered),e===this){const t=new et({entityIndex:this._entityIndex});return t._graphs=hi(Object.create(null),this._graphs),t._size=this._size,t}else if(e instanceof et&&this._entityIndex===e._entityIndex){const t=new et({entityIndex:this._entityIndex}),i=sc(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 et({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 et({entityIndex:this._entityIndex});return t._graphs=hi(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function kt(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:kt(r[o],e,t+1);a!==!1&&(n=n||Object.create(null),n[o]=a)}return n}class qt 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 et({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=kt(k.predicates,[d,l,s]))&&(v=kt(k.subjects,[s,d,l]),y=kt(k.objects,[l,s,d])):l?(y=kt(k.objects,[l,s,d]))&&(v=kt(k.subjects,[s,d,l]),g=kt(k.predicates,[d,l,s])):(v=kt(k.subjects,[s,d,l]))&&(g=kt(k.predicates,[d,l,s]),y=kt(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[Gn]&&(this[Gn]=this[Symbol.iterator]());const t=this[Gn];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 qt(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 Nu extends xa.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;const t=new Kd(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#",Gt="http://www.w3.org/2001/XMLSchema#",zt="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#",Tu="http://www.w3.org/2002/07/owl#",Au="http://www.w3.org/ns/oa#",ju="http://purl.org/dc/terms/",Du="http://xmlns.com/foaf/0.1/",bi=Re.namedNode("loaded-shapes"),At=Re.namedNode("loaded-data"),tt=Re.namedNode(zt+"type"),aa=Re.namedNode(ju+"conformsTo"),$s=Re.namedNode(_a+"subClassOf"),Ea=Re.namedNode(Tu+"imports"),Lu=Re.namedNode(ka+"broader"),Ou=Re.namedNode(ka+"narrower"),qi=Re.namedNode(_e+"NodeShape"),Cu=Re.namedNode(_e+"IRI"),Yi=Re.namedNode(_e+"property"),Sa=Re.namedNode(_e+"class"),$u=Re.namedNode(_e+"node"),Rr=Re.namedNode(_e+"targetClass"),Fu=Re.namedNode(_e+"nodeKind"),Pu=Re.namedNode(Gt+"string");function mi(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 Ri(r,e){return mi(r,"prefLabel",ka,e)||mi(r,"label",_a,e)||mi(r,"name",Du,e)}function dc(r,e,t){const i=[];for(const n of r)i.push({value:n,label:Ri(e.getQuads(n,null,null,null),t),children:[]});return i}function sa(r,e){for(const t in e)r=r.replace(e[t],"");return r}function cc(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(tt,r,o)));e.parent&&cc(r,e.parent,t,i,n)}function Ra(r,e){if(e.shaclIn){const t=e.config.lists[e.shaclIn];return dc(t?.length?t:[],e.config.store,e.config.languages)}else{const t=e.config.store.getSubjects(tt,r,bi);t.push(...e.config.store.getSubjects(tt,r,At)),cc(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:Ri(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,Lu,null))i.has(s.id)&&n.set(a.id,s.id);for(const s of e.config.store.getObjects(a,Ou,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 la(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,zt+"rest",zt+"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(tt));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===zt+"first"?_?l=n(g,"has multiple rdf:first arcs"):a.push(_=x):x.predicate.value===zt+"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===zt+"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 uc(r,e,t){const i=document.createElement("div");i.classList.add("shacl-or-constraint");const n=[];if(e instanceof Vt){const o=[];let a=!1;r.length&&(a=t.store.countQuads(r[0],Yi,null,null)>0);for(let l=0;l<r.length;l++)if(a){const c=t.store.getObjects(r[l],Yi,null),u=[];let v="";for(const g of c){const y=new tn(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 tn(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:Ri(l,t.languages)||sa(l[0].predicate.value,t.prefixes)+" = "+sa(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(Xi(e.template.clone().merge(o[parseInt(s.value)]),void 0,!0))},i.appendChild(a)}return i}function zu(r,e,t){if(e instanceof ct){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,tt,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,Rr,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(Cu))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,Yi,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"},[`${Au}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=Re.namedNode(zt+"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(Rr,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||Ri(e,this.config.languages),!this.label&&!this.shaclAnd&&(this.label=this.path?sa(this.path,this.config.prefixes):"unknown"),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,25 +73,25 @@ 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 ct&&(t.language?(s=document.createElement("span"),s.classList.add("lang"),s.innerText=`@${t.language}`):t.datatype.value===`${Gt}date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`${Gt}dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let d;return la(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===`${zt}langString`||r.languageIn?.length)return r.config.theme.createLangStringEditor(r.label,e,i,r);switch(r.datatype?.value.replace(Gt,"")){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===tt)i["@type"]=t.object.id;else{let n=t.object.value;t.object instanceof ct?t.object.language?n={"@language":t.object.language,"@value":t.object.value}:t.object.datatype&&t.object.datatype.value!==`${Gt}#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 Re.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=Re.namedNode(i[1]))}return Re.literal(t,e)}else if((r.type==="checkbox"||r.getAttribute("type")==="checkbox")&&(r.checked||parseInt(r.dataset.minCount||"0")>0))return Re.literal(r.checked?"true":"false",e)}const gi={};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):gi[`${r.predicate}^${r.datatype}`]=r}function Zu(){return Object.entries(gi).map(r=>r[1])}function ef(r,e){let t=gi[`${r}^${e}`];return t||(t=gi[`${r}^undefined`],t)?t:gi[`undefined^${e}`]}class vg{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)}}/**
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 wi){const l=i.config.store.getQuads(a,null,null,null);if(l.length){const c=Ri(l,i.config.languages);c&&(a=c)}}else t instanceof ct&&(t.language?(s=document.createElement("span"),s.classList.add("lang"),s.innerText=`@${t.language}`):t.datatype.value===`${Gt}date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`${Gt}dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let d;return la(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=dc(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===`${zt}langString`||r.languageIn?.length)return r.config.theme.createLangStringEditor(r.label,e,i,r);switch(r.datatype?.value.replace(Gt,"")){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===tt)i["@type"]=t.object.id;else{let n=t.object.value;t.object instanceof ct?t.object.language?n={"@language":t.object.language,"@value":t.object.value}:t.object.datatype&&t.object.datatype.value!==`${Gt}#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(t.startsWith("<")&&t.endsWith(">")&&t.indexOf(":")>-1)return Re.namedNode(t.substring(1,t.length-1));if(r.dataset.class||r.dataset.nodeKind===_e+"IRI")return Re.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=Re.namedNode(i[1]))}return Re.literal(t,e)}else if((r.type==="checkbox"||r.getAttribute("type")==="checkbox")&&(r.checked||parseInt(r.dataset.minCount||"0")>0))return Re.literal(r.checked?"true":"false",e)}const gi={};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):gi[`${r.predicate}^${r.datatype}`]=r}function Zu(){return Object.entries(gi).map(r=>r[1])}function ef(r,e){let t=gi[`${r}^${e}`];return t||(t=gi[`${r}^undefined`],t)?t:gi[`undefined^${e}`]}class vg{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,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),Et=(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;/**
80
+ */const Gi=globalThis,Ia=Gi.ShadowRoot&&(Gi.ShadyCSS===void 0||Gi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Na=Symbol(),Ps=new WeakMap;let fc=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 fc(typeof r=="string"?r:r+"",void 0,Na),Et=(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 fc(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=Gi.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
84
- */const{is:nf,defineProperty:of,getOwnPropertyDescriptor:af,getOwnPropertyNames:sf,getOwnPropertySymbols:lf,getPrototypeOf:df}=Object,cn=globalThis,Bs=cn.trustedTypes,cf=Bs?Bs.emptyScript:"",uf=cn.reactiveElementPolyfillSupport,vi=(r,e)=>r,da={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}},hc=(r,e)=>!nf(r,e),qs={attribute:!0,type:String,converter:da,reflect:!1,useDefault:!1,hasChanged:hc};Symbol.metadata??=Symbol("metadata"),cn.litPropertyMetadata??=new WeakMap;let xr=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=qs){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&&of(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){const{get:n,set:o}=af(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)??qs}static _$Ei(){if(this.hasOwnProperty(vi("elementProperties")))return;const e=df(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=[...sf(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(Ms(n))}else e!==void 0&&t.push(Ms(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(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.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 rf(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,i);if(n!==void 0&&i.reflect===!0){const o=(i.converter?.toAttribute!==void 0?i.converter:da).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(e,t){const i=this.constructor,n=i._$Eh.get(e);if(n!==void 0&&this._$Em!==n){const o=i.getPropertyOptions(n),a=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:da;this._$Em=n;const s=a.fromAttribute(t,o.type);this[n]=s??this._$Ej?.get(n)??s,this._$Em=null}}requestUpdate(e,t,i){if(e!==void 0){const n=this.constructor,o=this[e];if(i??=n.getPropertyOptions(e),!((i.hasChanged??hc)(o,t)||i.useDefault&&i.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(n._$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??=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??=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(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[n,o]of i){const{wrapped:a}=o,s=this[n];a!==!0||this._$AL.has(n)||s===void 0||this.C(n,void 0,o,s)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(t)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),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.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,uf?.({ReactiveElement:xr}),(cn.reactiveElementVersions??=[]).push("2.1.1");/**
84
+ */const{is:nf,defineProperty:of,getOwnPropertyDescriptor:af,getOwnPropertyNames:sf,getOwnPropertySymbols:lf,getPrototypeOf:df}=Object,cn=globalThis,Bs=cn.trustedTypes,cf=Bs?Bs.emptyScript:"",uf=cn.reactiveElementPolyfillSupport,vi=(r,e)=>r,da={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}},pc=(r,e)=>!nf(r,e),qs={attribute:!0,type:String,converter:da,reflect:!1,useDefault:!1,hasChanged:pc};Symbol.metadata??=Symbol("metadata"),cn.litPropertyMetadata??=new WeakMap;let xr=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=qs){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&&of(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){const{get:n,set:o}=af(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)??qs}static _$Ei(){if(this.hasOwnProperty(vi("elementProperties")))return;const e=df(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=[...sf(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(Ms(n))}else e!==void 0&&t.push(Ms(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(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.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 rf(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,i);if(n!==void 0&&i.reflect===!0){const o=(i.converter?.toAttribute!==void 0?i.converter:da).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(e,t){const i=this.constructor,n=i._$Eh.get(e);if(n!==void 0&&this._$Em!==n){const o=i.getPropertyOptions(n),a=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:da;this._$Em=n;const s=a.fromAttribute(t,o.type);this[n]=s??this._$Ej?.get(n)??s,this._$Em=null}}requestUpdate(e,t,i){if(e!==void 0){const n=this.constructor,o=this[e];if(i??=n.getPropertyOptions(e),!((i.hasChanged??pc)(o,t)||i.useDefault&&i.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(n._$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??=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??=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(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[n,o]of i){const{wrapped:a}=o,s=this[n];a!==!0||this._$AL.has(n)||s===void 0||this.C(n,void 0,o,s)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(t)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),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.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,uf?.({ReactiveElement:xr}),(cn.reactiveElementVersions??=[]).push("2.1.1");/**
85
85
  * @license
86
86
  * Copyright 2017 Google LLC
87
87
  * SPDX-License-Identifier: BSD-3-Clause
88
- */const Ta=globalThis,Yi=Ta.trustedTypes,zs=Yi?Yi.createPolicy("lit-html",{createHTML:r=>r}):void 0,bc="$lit$",Ut=`lit$${Math.random().toFixed(9).slice(2)}$`,mc="?"+Ut,ff=`<${mc}>`,dr=document,xi=()=>dr.createComment(""),_i=r=>r===null||typeof r!="object"&&typeof r!="function",Aa=Array.isArray,pf=r=>Aa(r)||typeof r?.[Symbol.iterator]=="function",Vn=`[
89
- \f\r]`,Qr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Us=/-->/g,Hs=/>/g,Kt=RegExp(`>|${Vn}(?:([^\\s"'>=/]+)(${Vn}*=${Vn}*(?:[^
90
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Gs=/'/g,Vs=/"/g,gc=/^(?:script|style|textarea|title)$/i,hf=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),ut=hf(1),Nr=Symbol.for("lit-noChange"),He=Symbol.for("lit-nothing"),Ws=new WeakMap,sr=dr.createTreeWalker(dr,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=Qr;for(let s=0;s<t;s++){const d=r[s];let l,c,f=-1,v=0;for(;v<d.length&&(a.lastIndex=v,c=a.exec(d),c!==null);)v=a.lastIndex,a===Qr?c[1]==="!--"?a=Us:c[1]!==void 0?a=Hs:c[2]!==void 0?(gc.test(c[2])&&(n=RegExp("</"+c[2],"g")),a=Kt):c[3]!==void 0&&(a=Kt):a===Kt?c[0]===">"?(a=n??Qr,f=-1):c[1]===void 0?f=-2:(f=a.lastIndex-c[2].length,l=c[1],a=c[3]===void 0?Kt:c[3]==='"'?Vs:Gs):a===Vs||a===Gs?a=Kt:a===Us||a===Hs?a=Qr:(a=Kt,n=void 0);const g=a===Kt&&r[s+1].startsWith("/>")?" ":"";o+=a===Qr?d+ff:f>=0?(i.push(l),d.slice(0,f)+bc+d.slice(f)+Ut+g):d+Ut+(f===-2?s:g)}return[vc(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};let ca=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),sr.currentNode=this.el.content,t===2||t===3){const f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(n=sr.nextNode())!==null&&d.length<s;){if(n.nodeType===1){if(n.hasAttributes())for(const f of n.getAttributeNames())if(f.endsWith(bc)){const v=c[a++],g=n.getAttribute(f).split(Ut),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(f)}else f.startsWith(Ut)&&(d.push({type:6,index:o}),n.removeAttribute(f));if(gc.test(n.tagName)){const f=n.textContent.split(Ut),v=f.length-1;if(v>0){n.textContent=Yi?Yi.emptyScript:"";for(let g=0;g<v;g++)n.append(f[g],xi()),sr.nextNode(),d.push({type:2,index:++o});n.append(f[v],xi())}}}else if(n.nodeType===8)if(n.data===mc)d.push({type:2,index:o});else{let f=-1;for(;(f=n.data.indexOf(Ut,f+1))!==-1;)d.push({type:7,index:o}),f+=Ut.length-1}o++}}static createElement(e,t){const i=dr.createElement("template");return i.innerHTML=e,i}};function Tr(r,e,t=r,i){if(e===Nr)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=Tr(r,n._$AS(r,e.values),n,i)),e}let mf=class{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??dr).importNode(t,!0);sr.currentNode=n;let o=sr.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=sr.nextNode(),a++)}return sr.currentNode=dr,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++}},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=Tr(this,e,t),_i(e)?e===He||e==null||e===""?(this._$AH!==He&&this._$AR(),this._$AH=He):e!==this._$AH&&e!==Nr&&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(dr.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=ca.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 ca(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=Tr(this,e,t,0),a=!_i(e)||e!==this._$AH&&e!==Nr,a&&(this._$AH=e);else{const s=e;let d,l;for(e=o[0],d=0;d<o.length-1;d++)l=Tr(this,s[i+d],t,d),l===Nr&&(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}};class vf extends un{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==He)}}let 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=Tr(this,e,t,0)??He)===Nr)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){Tr(this,e)}};const xf=Ta.litHtmlPolyfillSupport;xf?.(ca,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};/**
88
+ */const Ta=globalThis,Zi=Ta.trustedTypes,zs=Zi?Zi.createPolicy("lit-html",{createHTML:r=>r}):void 0,hc="$lit$",Ut=`lit$${Math.random().toFixed(9).slice(2)}$`,bc="?"+Ut,ff=`<${bc}>`,dr=document,_i=()=>dr.createComment(""),ki=r=>r===null||typeof r!="object"&&typeof r!="function",Aa=Array.isArray,pf=r=>Aa(r)||typeof r?.[Symbol.iterator]=="function",Vn=`[
89
+ \f\r]`,Xr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Us=/-->/g,Hs=/>/g,Kt=RegExp(`>|${Vn}(?:([^\\s"'>=/]+)(${Vn}*=${Vn}*(?:[^
90
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Gs=/'/g,Vs=/"/g,mc=/^(?:script|style|textarea|title)$/i,hf=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),ut=hf(1),Ir=Symbol.for("lit-noChange"),He=Symbol.for("lit-nothing"),Ws=new WeakMap,sr=dr.createTreeWalker(dr,129);function gc(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=Xr;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===Xr?c[1]==="!--"?a=Us:c[1]!==void 0?a=Hs:c[2]!==void 0?(mc.test(c[2])&&(n=RegExp("</"+c[2],"g")),a=Kt):c[3]!==void 0&&(a=Kt):a===Kt?c[0]===">"?(a=n??Xr,u=-1):c[1]===void 0?u=-2:(u=a.lastIndex-c[2].length,l=c[1],a=c[3]===void 0?Kt:c[3]==='"'?Vs:Gs):a===Vs||a===Gs?a=Kt:a===Us||a===Hs?a=Xr:(a=Kt,n=void 0);const g=a===Kt&&r[s+1].startsWith("/>")?" ":"";o+=a===Xr?d+ff:u>=0?(i.push(l),d.slice(0,u)+hc+d.slice(u)+Ut+g):d+Ut+(u===-2?s:g)}return[gc(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};let ca=class vc{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=vc.createElement(l,i),sr.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(n=sr.nextNode())!==null&&d.length<s;){if(n.nodeType===1){if(n.hasAttributes())for(const u of n.getAttributeNames())if(u.endsWith(hc)){const v=c[a++],g=n.getAttribute(u).split(Ut),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(Ut)&&(d.push({type:6,index:o}),n.removeAttribute(u));if(mc.test(n.tagName)){const u=n.textContent.split(Ut),v=u.length-1;if(v>0){n.textContent=Zi?Zi.emptyScript:"";for(let g=0;g<v;g++)n.append(u[g],_i()),sr.nextNode(),d.push({type:2,index:++o});n.append(u[v],_i())}}}else if(n.nodeType===8)if(n.data===bc)d.push({type:2,index:o});else{let u=-1;for(;(u=n.data.indexOf(Ut,u+1))!==-1;)d.push({type:7,index:o}),u+=Ut.length-1}o++}}static createElement(e,t){const i=dr.createElement("template");return i.innerHTML=e,i}};function Nr(r,e,t=r,i){if(e===Ir)return e;let n=i!==void 0?t._$Co?.[i]:t._$Cl;const o=ki(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=Nr(r,n._$AS(r,e.values),n,i)),e}let mf=class{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??dr).importNode(t,!0);sr.currentNode=n;let o=sr.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=sr.nextNode(),a++)}return sr.currentNode=dr,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++}},ja=class yc{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=Nr(this,e,t),ki(e)?e===He||e==null||e===""?(this._$AH!==He&&this._$AR(),this._$AH=He):e!==this._$AH&&e!==Ir&&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&&ki(this._$AH)?this._$AA.nextSibling.data=e:this.T(dr.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=ca.createElement(gc(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 ca(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 yc(this.O(_i()),this.O(_i()),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=Nr(this,e,t,0),a=!ki(e)||e!==this._$AH&&e!==Ir,a&&(this._$AH=e);else{const s=e;let d,l;for(e=o[0],d=0;d<o.length-1;d++)l=Nr(this,s[i+d],t,d),l===Ir&&(l=this._$AH[d]),a||=!ki(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}};class vf extends un{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==He)}}let 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=Nr(this,e,t,0)??He)===Ir)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){Nr(this,e)}};const xf=Ta.litHtmlPolyfillSupport;xf?.(ca,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(_i(),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 lr extends xr{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 Nr}}lr._$litElement$=!0,lr.finalized=!0,Da.litElementHydrateSupport?.({LitElement:lr});const kf=Da.litElementPolyfillSupport;kf?.({LitElement:lr});(Da.litElementVersions??=[]).push("4.2.1");var xc=r=>{throw TypeError(r)},_c=(r,e,t)=>e.has(r)||xc("Cannot "+t),Bt=(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 Xt=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,fn=globalThis,Js=fn.trustedTypes,Cf=Js?Js.emptyScript:"",$f=fn.reactiveElementPolyfillSupport,yi=(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),Ks={attribute:!0,type:String,converter:Zi,reflect:!1,useDefault:!1,hasChanged:Oa};Symbol.metadata??=Symbol("metadata"),fn.litPropertyMetadata??=new WeakMap;class Jr extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ks){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)??Ks}static _$Ei(){if(this.hasOwnProperty(yi("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(yi("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(yi("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(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.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(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,i);if(n!==void 0&&i.reflect===!0){const o=(i.converter?.toAttribute!==void 0?i.converter:Zi).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(e,t){const i=this.constructor,n=i._$Eh.get(e);if(n!==void 0&&this._$Em!==n){const o=i.getPropertyOptions(n),a=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:Zi;this._$Em=n,this[n]=a.fromAttribute(t,o.type)??this._$Ej?.get(n)??null,this._$Em=null}}requestUpdate(e,t,i){if(e!==void 0){const n=this.constructor,o=this[e];if(i??=n.getPropertyOptions(e),!((i.hasChanged??Oa)(o,t)||i.useDefault&&i.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(n._$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??=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??=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(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[n,o]of i){const{wrapped:a}=o,s=this[n];a!==!0||this._$AL.has(n)||s===void 0||this.C(n,void 0,o,s)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(t)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),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.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}}Jr.elementStyles=[],Jr.shadowRootOptions={mode:"open"},Jr[yi("elementProperties")]=new Map,Jr[yi("finalized")]=new Map,$f?.({ReactiveElement:Jr}),(fn.reactiveElementVersions??=[]).push("2.1.0");const Ff={attribute:!0,type:String,converter:Zi,reflect:!1,hasChanged:Oa},Pf=(r=Ff,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 Ee(r){return(e,t)=>typeof t=="object"?Pf(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 Ee({...r,state:!0,attribute:!1})}const Mf=(r,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(r,e,t),t);function ht(r,e){return(t,i,n)=>{const o=a=>a.renderRoot?.querySelector(r)??null;return Mf(t,i,{get(){return o(this)}})}}var Bf=Object.defineProperty,Qt=(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&&Bf(e,t,n),n};const ua=class extends lr{constructor(){super(...arguments),this.dense=!1}};ua.shadowRootOptions={...lr.shadowRootOptions,delegatesFocus:!0},ua.styles=[Et`
94
+ */const Da=globalThis;class lr extends xr{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 Ir}}lr._$litElement$=!0,lr.finalized=!0,Da.litElementHydrateSupport?.({LitElement:lr});const kf=Da.litElementPolyfillSupport;kf?.({LitElement:lr});(Da.litElementVersions??=[]).push("4.2.1");var wc=r=>{throw TypeError(r)},xc=(r,e,t)=>e.has(r)||wc("Cannot "+t),Bt=(r,e,t)=>(xc(r,e,"read from private field"),t?t.call(r):e.get(r)),Ef=(r,e,t)=>e.has(r)?wc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Sf=(r,e,t,i)=>(xc(r,e,"write to private field"),e.set(r,t),t);const Xt=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)},Vi=globalThis,La=Vi.ShadowRoot&&(Vi.ShadyCSS===void 0||Vi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,_c=Symbol(),Xs=new WeakMap;let Rf=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==_c)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,_c),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=Vi.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,fn=globalThis,Js=fn.trustedTypes,Cf=Js?Js.emptyScript:"",$f=fn.reactiveElementPolyfillSupport,yi=(r,e)=>r,en={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),Ks={attribute:!0,type:String,converter:en,reflect:!1,useDefault:!1,hasChanged:Oa};Symbol.metadata??=Symbol("metadata"),fn.litPropertyMetadata??=new WeakMap;class Qr extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ks){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)??Ks}static _$Ei(){if(this.hasOwnProperty(yi("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(yi("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(yi("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(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.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(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,i);if(n!==void 0&&i.reflect===!0){const o=(i.converter?.toAttribute!==void 0?i.converter:en).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(e,t){const i=this.constructor,n=i._$Eh.get(e);if(n!==void 0&&this._$Em!==n){const o=i.getPropertyOptions(n),a=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:en;this._$Em=n,this[n]=a.fromAttribute(t,o.type)??this._$Ej?.get(n)??null,this._$Em=null}}requestUpdate(e,t,i){if(e!==void 0){const n=this.constructor,o=this[e];if(i??=n.getPropertyOptions(e),!((i.hasChanged??Oa)(o,t)||i.useDefault&&i.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(n._$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??=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??=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(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[n,o]of i){const{wrapped:a}=o,s=this[n];a!==!0||this._$AL.has(n)||s===void 0||this.C(n,void 0,o,s)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(t)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),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.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}}Qr.elementStyles=[],Qr.shadowRootOptions={mode:"open"},Qr[yi("elementProperties")]=new Map,Qr[yi("finalized")]=new Map,$f?.({ReactiveElement:Qr}),(fn.reactiveElementVersions??=[]).push("2.1.0");const Ff={attribute:!0,type:String,converter:en,reflect:!1,hasChanged:Oa},Pf=(r=Ff,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 Ee(r){return(e,t)=>typeof t=="object"?Pf(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 Ee({...r,state:!0,attribute:!1})}const Mf=(r,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(r,e,t),t);function ht(r,e){return(t,i,n)=>{const o=a=>a.renderRoot?.querySelector(r)??null;return Mf(t,i,{get(){return o(this)}})}}var Bf=Object.defineProperty,Qt=(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&&Bf(e,t,n),n};const ua=class extends lr{constructor(){super(...arguments),this.dense=!1}};ua.shadowRootOptions={...lr.shadowRootOptions,delegatesFocus:!0},ua.styles=[Et`
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 xt=fa;Qt([Ee()],xt.prototype,"name");Qt([Ee()],xt.prototype,"value");Qt([Ee({type:Boolean})],xt.prototype,"clearable");Qt([Ee({type:Boolean})],xt.prototype,"required");Qt([Ee({type:Boolean})],xt.prototype,"disabled");Qt([Ee()],xt.prototype,"label");Qt([Ee()],xt.prototype,"placeholder");function qf(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 zf=Object.defineProperty,Uf=Object.getOwnPropertyDescriptor,Ec=(r,e,t,i)=>{for(var n=i>1?void 0:i?Uf(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&&zf(e,t,n),n};let Ar=class extends Ct{constructor(){super(...arguments),this.icon=!1}render(){return ut`<a part="link"><slot><slot></a>`}};Ar.styles=[...Ct.styles,Et`
121
+ `];let xt=fa;Qt([Ee()],xt.prototype,"name");Qt([Ee()],xt.prototype,"value");Qt([Ee({type:Boolean})],xt.prototype,"clearable");Qt([Ee({type:Boolean})],xt.prototype,"required");Qt([Ee({type:Boolean})],xt.prototype,"disabled");Qt([Ee()],xt.prototype,"label");Qt([Ee()],xt.prototype,"placeholder");function qf(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 zf=Object.defineProperty,Uf=Object.getOwnPropertyDescriptor,kc=(r,e,t,i)=>{for(var n=i>1?void 0:i?Uf(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&&zf(e,t,n),n};let Tr=class extends Ct{constructor(){super(...arguments),this.icon=!1}render(){return ut`<a part="link"><slot><slot></a>`}};Tr.styles=[...Ct.styles,Et`
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([Ee({type:Boolean,reflect:!0})],Ar.prototype,"icon",2);Ar=Ec([Xt("rokit-button")],Ar);var Hf=Object.defineProperty,Gf=Object.getOwnPropertyDescriptor,$t=(r,e,t,i)=>{for(var n=i>1?void 0:i?Gf(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&&Hf(e,t,n),n};let it=class extends Ct{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=qf(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 ut`
133
+ `];kc([Ee({type:Boolean,reflect:!0})],Tr.prototype,"icon",2);Tr=kc([Xt("rokit-button")],Tr);var Hf=Object.defineProperty,Gf=Object.getOwnPropertyDescriptor,$t=(r,e,t,i)=>{for(var n=i>1?void 0:i?Gf(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&&Hf(e,t,n),n};let it=class extends Ct{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=qf(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 ut`
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; overflow: hidden; }
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
- `];$t([Ee({type:Boolean,reflect:!0})],it.prototype,"open",2);$t([Ee()],it.prototype,"label",2);$t([Ee({reflect:!0})],it.prototype,"maxHeight",2);$t([Ee({type:Boolean})],it.prototype,"disabled",2);$t([ht("#content")],it.prototype,"content",2);$t([ht("#toggle")],it.prototype,"toggleButton",2);$t([ht("header")],it.prototype,"header",2);$t([Ca()],it.prototype,"transitioning",2);it=$t([Xt("rokit-collapsible")],it);var Vf=Object.defineProperty,Wf=Object.getOwnPropertyDescriptor,Sc=r=>{throw TypeError(r)},lt=(r,e,t,i)=>{for(var n=i>1?void 0:i?Wf(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&&Vf(e,t,n),n},Rc=(r,e,t)=>e.has(r)||Sc("Cannot "+t),Xf=(r,e,t)=>(Rc(r,e,"read from private field"),e.get(r)),Qf=(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),Ys=(r,e,t,i)=>(Rc(r,e,"write to private field"),e.set(r,t),t),pi;let ze=class extends xt{constructor(){super(),this.type="text",this.readonly=!1,this.sticky=!1,this.minWidth=80,this.autoGrowLabelWidth=!1,Qf(this,pi,""),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(){Ys(this,pi,this.value),this.inputElement.addEventListener("change",()=>{this.value=this.inputElement.value}),this.autoGrowLabelWidth&&new IntersectionObserver(r=>{r.length&&r[0].isIntersecting&&this.updateMinWidth()}).observe(this)}updateMinWidth(){const r=this.shadowRoot.querySelector(".wrapper");if(r){const e=this.shadowRoot?.querySelector("label")?.scrollWidth||0,t=this.minWidth>e?this.minWidth:e;r.style.minWidth=t>0?t+"px":""}}updated(r){r.has("label")&&(this.classList.toggle("has-label",this.label!==void 0),this.autoGrowLabelWidth&&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!==Xf(this,pi)&&(Ys(this,pi,this.value),this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))))}clear(){this.inputElement.value="",this.value="",this.blur()}renderInput(){return ut`<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 ut`
156
+ `];$t([Ee({type:Boolean,reflect:!0})],it.prototype,"open",2);$t([Ee()],it.prototype,"label",2);$t([Ee({reflect:!0})],it.prototype,"maxHeight",2);$t([Ee({type:Boolean})],it.prototype,"disabled",2);$t([ht("#content")],it.prototype,"content",2);$t([ht("#toggle")],it.prototype,"toggleButton",2);$t([ht("header")],it.prototype,"header",2);$t([Ca()],it.prototype,"transitioning",2);it=$t([Xt("rokit-collapsible")],it);var Vf=Object.defineProperty,Wf=Object.getOwnPropertyDescriptor,Ec=r=>{throw TypeError(r)},lt=(r,e,t,i)=>{for(var n=i>1?void 0:i?Wf(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&&Vf(e,t,n),n},Sc=(r,e,t)=>e.has(r)||Ec("Cannot "+t),Xf=(r,e,t)=>(Sc(r,e,"read from private field"),e.get(r)),Qf=(r,e,t)=>e.has(r)?Ec("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Ys=(r,e,t,i)=>(Sc(r,e,"write to private field"),e.set(r,t),t),fi;let ze=class extends xt{constructor(){super(),this.type="text",this.readonly=!1,this.sticky=!1,this.minWidth=80,this.autoGrowLabelWidth=!1,Qf(this,fi,""),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(){Ys(this,fi,this.value),this.inputElement.addEventListener("change",()=>{this.value=this.inputElement.value}),this.autoGrowLabelWidth&&new IntersectionObserver(r=>{r.length&&r[0].isIntersecting&&this.updateMinWidth()}).observe(this)}updateMinWidth(){const r=this.shadowRoot.querySelector(".wrapper");if(r){const e=this.shadowRoot?.querySelector("label")?.scrollWidth||0,t=this.minWidth>e?this.minWidth:e;r.style.minWidth=t>0?t+"px":""}}updated(r){r.has("label")&&(this.classList.toggle("has-label",this.label!==void 0),this.autoGrowLabelWidth&&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!==Xf(this,fi)&&(Ys(this,fi,this.value),this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))))}clear(){this.inputElement.value="",this.value="",this.blur()}renderInput(){return ut`<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 ut`
157
157
  <slot name="prefix" part="prefix"></slot>
158
158
  <div class="wrapper">
159
159
  <label for="input" part="label">${this.label}</label>
@@ -163,7 +163,7 @@ a, a:visited { color: inherit; }
163
163
  `:He}
164
164
  </div>
165
165
  <slot name="suffix" part="suffix"></slot>
166
- `}};pi=new WeakMap;ze.styles=[...xt.styles,Et`
166
+ `}};fi=new WeakMap;ze.styles=[...xt.styles,Et`
167
167
  :host { background-color: var(--rokit-light-background-color-inner); user-select: none; }
168
168
  :host([dense]) { padding: 2px 4px; }
169
169
  :host(.has-focus:not([readonly])) label, :host(.has-value) label, :host([sticky]) label { font-size: 0.75em; top: 0.5em; font-weight: 600; }
@@ -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
- `];lt([Ee()],ze.prototype,"type",2);lt([Ee({type:Boolean,reflect:!0})],ze.prototype,"readonly",2);lt([Ee({type:Boolean,reflect:!0})],ze.prototype,"sticky",2);lt([Ee()],ze.prototype,"pattern",2);lt([Ee()],ze.prototype,"minLength",2);lt([Ee()],ze.prototype,"maxLength",2);lt([Ee()],ze.prototype,"min",2);lt([Ee()],ze.prototype,"max",2);lt([Ee()],ze.prototype,"step",2);lt([Ee()],ze.prototype,"minWidth",2);lt([Ee({type:Boolean})],ze.prototype,"autoGrowLabelWidth",2);lt([ht("#input")],ze.prototype,"inputElement",2);ze=lt([Xt("rokit-input")],ze);var Jf=Object.defineProperty,Kf=Object.getOwnPropertyDescriptor,Ic=r=>{throw TypeError(r)},rt=(r,e,t,i)=>{for(var n=i>1?void 0:i?Kf(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&&Jf(e,t,n),n},Nc=(r,e,t)=>e.has(r)||Ic("Cannot "+t),Zs=(r,e,t)=>(Nc(r,e,"read from private field"),t?t.call(r):e.get(r)),el=(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),qi=(r,e,t,i)=>(Nc(r,e,"write to private field"),e.set(r,t),t),_r,Vi;let Ge=class extends xt{constructor(){super(),this.emptyMessage="Nothing to select",this.collapsibleOrientationLeft="0",this.collapsibleOrientationRight="0",this.collapsibleWidth="",this.autoGrowLabelWidth=!1,this.collapse=!1,this.filterableThreshold=15,this.itemCount=0,el(this,_r,""),el(this,Vi,""),this.addEventListener("focus",()=>{this.collapsible.toggle(!0)}),this.addEventListener("blur",()=>{this.checkInputValue(),this.collapsible.toggle(!1)}),this.addEventListener("input",()=>{this.collapsible.toggle(!0)})}firstUpdated(){qi(this,_r,this.value),qi(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){if(r.has("selectedItem")){const e=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(),e!==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),this.collapsible?.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="",qi(this,_r,""),this.selectItem(null,!1))}filter(r){r=r.toLowerCase();let e=!0;for(const t of this.listContainer.querySelectorAll("li"))if(t.id!=="noresult"){const i=this.itemText(t).toLowerCase().indexOf(r)==-1;t.classList.toggle("hidden",i),this.collapse&&(t.classList.remove("open"),t.querySelector("ul")?.classList.remove("open")),i||(e=!1)}for(const t of this.listContainer.querySelectorAll("li:has(li:not(.hidden))"))t.classList.remove("hidden"),r&&this.collapse&&(t.classList.add("open"),t.querySelector("ul")?.classList.add("open")),e=!1;this.highlightItem(null),this.listContainer.querySelector("#noresult")?.classList.toggle("hidden",!e)}selectItem(r,e=!0){r?.getAttribute("disabled")!==null&&(r=null),this.selectedItem=r,this.filter(""),this.highlightItem(r,!1),e&&this.value&&qi(this,_r,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){if(this.listContainer.querySelector("li.active")?.classList.remove("active"),r){if(e&&this.listContainer.focus(),r.classList.add("active"),this.collapse)for(let t=r.closest("ul");t;t=t.parentElement.closest("ul"))t.classList.add("open"),t.closest("li")?.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){return r.querySelector("div > div")?.innerText||""}elementText(r){let e="";for(const t of r.childNodes)t.nodeType==3&&(e+=t.nodeValue?.trim());return e}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||Zs(this,_r),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}*${Zs(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?.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 Ar;c.title="Open",c.dense=!0,c.icon=!0,c.classList.add("toggle-node","caret"),c.addEventListener("click",f=>{f.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 ut`
180
+ `];lt([Ee()],ze.prototype,"type",2);lt([Ee({type:Boolean,reflect:!0})],ze.prototype,"readonly",2);lt([Ee({type:Boolean,reflect:!0})],ze.prototype,"sticky",2);lt([Ee()],ze.prototype,"pattern",2);lt([Ee()],ze.prototype,"minLength",2);lt([Ee()],ze.prototype,"maxLength",2);lt([Ee()],ze.prototype,"min",2);lt([Ee()],ze.prototype,"max",2);lt([Ee()],ze.prototype,"step",2);lt([Ee()],ze.prototype,"minWidth",2);lt([Ee({type:Boolean})],ze.prototype,"autoGrowLabelWidth",2);lt([ht("#input")],ze.prototype,"inputElement",2);ze=lt([Xt("rokit-input")],ze);var Jf=Object.defineProperty,Kf=Object.getOwnPropertyDescriptor,Rc=r=>{throw TypeError(r)},rt=(r,e,t,i)=>{for(var n=i>1?void 0:i?Kf(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&&Jf(e,t,n),n},Ic=(r,e,t)=>e.has(r)||Rc("Cannot "+t),Zs=(r,e,t)=>(Ic(r,e,"read from private field"),t?t.call(r):e.get(r)),el=(r,e,t)=>e.has(r)?Rc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),zi=(r,e,t,i)=>(Ic(r,e,"write to private field"),e.set(r,t),t),_r,Wi;let Ge=class extends xt{constructor(){super(),this.emptyMessage="Nothing to select",this.collapsibleOrientationLeft="0",this.collapsibleOrientationRight="0",this.collapsibleWidth="",this.autoGrowLabelWidth=!1,this.collapse=!1,this.filterableThreshold=15,this.itemCount=0,el(this,_r,""),el(this,Wi,""),this.addEventListener("focus",()=>{this.collapsible.toggle(!0)}),this.addEventListener("blur",()=>{this.checkInputValue(),this.collapsible.toggle(!1)}),this.addEventListener("input",()=>{this.collapsible.toggle(!0)})}firstUpdated(){zi(this,_r,this.value),zi(this,Wi,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){if(r.has("selectedItem")){const e=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(),e!==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),this.collapsible?.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="",zi(this,_r,""),this.selectItem(null,!1))}filter(r){r=r.toLowerCase();let e=!0;for(const t of this.listContainer.querySelectorAll("li"))if(t.id!=="noresult"){const i=this.itemText(t).toLowerCase().indexOf(r)==-1;t.classList.toggle("hidden",i),this.collapse&&(t.classList.remove("open"),t.querySelector("ul")?.classList.remove("open")),i||(e=!1)}for(const t of this.listContainer.querySelectorAll("li:has(li:not(.hidden))"))t.classList.remove("hidden"),r&&this.collapse&&(t.classList.add("open"),t.querySelector("ul")?.classList.add("open")),e=!1;this.highlightItem(null),this.listContainer.querySelector("#noresult")?.classList.toggle("hidden",!e)}selectItem(r,e=!0){r?.getAttribute("disabled")!==null&&(r=null),this.selectedItem=r,this.filter(""),this.highlightItem(r,!1),e&&this.value&&zi(this,_r,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){if(this.listContainer.querySelector("li.active")?.classList.remove("active"),r){if(e&&this.listContainer.focus(),r.classList.add("active"),this.collapse)for(let t=r.closest("ul");t;t=t.parentElement.closest("ul"))t.classList.add("open"),t.closest("li")?.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){return r.querySelector("div > div")?.innerText||""}elementText(r){let e="";for(const t of r.childNodes)t.nodeType==3&&(e+=t.nodeValue?.trim());return e}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||Zs(this,_r),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}*${Zs(this,Wi)})`);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?.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 Tr;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 ut`
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>
@@ -197,7 +197,7 @@ a, a:visited { color: inherit; }
197
197
  </ul>
198
198
  <slot id="list-container-slot" @slotchange=${this.onSlotChange}></slot>
199
199
  </rokit-collapsible>
200
- `}};_r=new WeakMap;Vi=new WeakMap;Ge.styles=[...xt.styles,Et`
200
+ `}};_r=new WeakMap;Wi=new WeakMap;Ge.styles=[...xt.styles,Et`
201
201
  :host { background-color: var(--rokit-light-background-color-inner); user-select: none; padding: 0; }
202
202
  :host([dense]) li > div { padding: 4px 2px; }
203
203
  :host([dense]) li.large > div, :host([dense]) li.header > div { padding-top: 6px; padding-bottom: 6px; }
@@ -230,7 +230,7 @@ a, a:visited { color: inherit; }
230
230
  :host, .wrapper { align-items: flex-start; }
231
231
  #input { height: initial; }
232
232
  #content { display: none; }
233
- `];pn([Ee()],cr.prototype,"resize",2);pn([Ee()],cr.prototype,"rows",2);pn([Ee()],cr.prototype,"cols",2);cr=pn([Xt("rokit-textarea")],cr);var ep=Object.defineProperty,tp=Object.getOwnPropertyDescriptor,Tc=r=>{throw TypeError(r)},St=(r,e,t,i)=>{for(var n=i>1?void 0:i?tp(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&&ep(e,t,n),n},Ac=(r,e,t)=>e.has(r)||Tc("Cannot "+t),Oe=(r,e,t)=>(Ac(r,e,"read from private field"),t?t.call(r):e.get(r)),Wn=(r,e,t)=>e.has(r)?Tc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),zi=(r,e,t,i)=>(Ac(r,e,"write to private field"),e.set(r,t),t),Me,Tt,kr;const Ht=18;let Dt=class extends ze{constructor(){super(...arguments),this.labelFormatter=r=>String(r),Wn(this,Me,[0,1]),Wn(this,Tt,[Oe(this,Me)[0],Oe(this,Me)[1]]),Wn(this,kr)}firstUpdated(){super.firstUpdated(),this.sliderElement.addEventListener("mousedown",r=>this.onKnobDrag(r)),this.sliderElement.addEventListener("touchstart",r=>this.onKnobDrag(r)),new ResizeObserver(()=>{this.updateKnobPositions()}).observe(this.sliderElement)}updated(r){if(super.updated(r),r.has("min")&&(Oe(this,Me)[0]=parseFloat(this.min||"0"),Oe(this,Me)[1]=Math.max(Oe(this,Me)[0],Oe(this,Me)[1])),r.has("max")&&(Oe(this,Me)[1]=parseFloat(this.max||"1"),Oe(this,Me)[0]=Math.min(Oe(this,Me)[0],Oe(this,Me)[1])),r.has("step")&&zi(this,kr,this.step?parseFloat(this.step):void 0),r.has("value")||r.has("min")||r.has("max"))if(this.value)if(this.range!==void 0){const e=JSON.parse(this.value);zi(this,Tt,[this.applyConstraints(e[0]),this.applyConstraints(e[1])])}else zi(this,Tt,[this.applyConstraints(parseFloat(this.value))]);else zi(this,Tt,[Oe(this,Me)[0],Oe(this,Me)[1]]);this.updateKnobPositions()}updateValidity(r,e){super.updateValidity(r,e,this.sliderElement)}chooseKnob(r){if(!this.endKnob)return this.startKnob;let e=Math.abs(r-this.startKnob.offsetLeft)<Math.abs(r-this.endKnob.offsetLeft)?this.startKnob:this.endKnob;return this.startKnob.value===this.endKnob.value&&(e.id==="start"&&e.value===Oe(this,Me)[0]?e=this.endKnob:e.id==="end"&&e.value===Oe(this,Me)[1]&&(e=this.startKnob)),e}toScreenSpace(r){return(r-Oe(this,Me)[0])/(Oe(this,Me)[1]-Oe(this,Me)[0])*this.track.offsetWidth}toValueSpace(r){return r/this.track.offsetWidth*(Oe(this,Me)[1]-Oe(this,Me)[0])+Oe(this,Me)[0]}applyConstraints(r,e){let t=Math.min(Math.max(r,Oe(this,Me)[0]),Oe(this,Me)[1]);return Oe(this,kr)&&(t=Math.round(t/Oe(this,kr))*Oe(this,kr)),e!==void 0&&this.endKnob&&(t=e?Math.min(t,this.endKnob.value):Math.max(t,this.startKnob.value)),t}updateKnob(r,e){r.value=e,r.offset=this.toScreenSpace(e),r.label=this.labelFormatter(e),this.endKnob&&(r.id==="start"?this.track.style.borderLeftWidth=r.offset+"px":this.track.style.borderRightWidth=this.track.offsetWidth-r.offset+"px")}updateKnobPositions(){this.updateKnob(this.startKnob,Oe(this,Tt)[0]),this.endKnob&&this.updateKnob(this.endKnob,Oe(this,Tt)[1])}onKnobDrag(r){if(r.target instanceof jr||this.classList.contains("has-value")||this.classList.contains("has-focus")){let e;const t=n=>{let o=0;n.type==="touchmove"||n.type==="touchstart"?o=n.touches[0].clientX:o=n.clientX,o=o-this.track.getBoundingClientRect().left,e||(e=this.chooseKnob(o),e.classList.add("focus")),this.updateKnob(e,this.applyConstraints(this.toValueSpace(o),e.id==="start"))},i=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("touchmove",t),document.removeEventListener("mouseup",i),document.removeEventListener("touchend",i),e&&(e.classList.remove("focus"),this.range!==void 0?e.id==="end"?this.value=JSON.stringify([Oe(this,Tt)[0],e.value]):this.value=JSON.stringify([e.value,Oe(this,Tt)[1]]):this.value=String(e.value)),e=void 0};this.sliderElement.focus(),document.addEventListener("mousemove",t),document.addEventListener("touchmove",t),document.addEventListener("mouseup",i),document.addEventListener("touchend",i),t(r)}}renderInput(){return ut`
233
+ `];pn([Ee()],cr.prototype,"resize",2);pn([Ee()],cr.prototype,"rows",2);pn([Ee()],cr.prototype,"cols",2);cr=pn([Xt("rokit-textarea")],cr);var ep=Object.defineProperty,tp=Object.getOwnPropertyDescriptor,Nc=r=>{throw TypeError(r)},St=(r,e,t,i)=>{for(var n=i>1?void 0:i?tp(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&&ep(e,t,n),n},Tc=(r,e,t)=>e.has(r)||Nc("Cannot "+t),Oe=(r,e,t)=>(Tc(r,e,"read from private field"),t?t.call(r):e.get(r)),Wn=(r,e,t)=>e.has(r)?Nc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Ui=(r,e,t,i)=>(Tc(r,e,"write to private field"),e.set(r,t),t),Me,Tt,kr;const Ht=18;let Dt=class extends ze{constructor(){super(...arguments),this.labelFormatter=r=>String(r),Wn(this,Me,[0,1]),Wn(this,Tt,[Oe(this,Me)[0],Oe(this,Me)[1]]),Wn(this,kr)}firstUpdated(){super.firstUpdated(),this.sliderElement.addEventListener("mousedown",r=>this.onKnobDrag(r)),this.sliderElement.addEventListener("touchstart",r=>this.onKnobDrag(r)),new ResizeObserver(()=>{this.updateKnobPositions()}).observe(this.sliderElement)}updated(r){if(super.updated(r),r.has("min")&&(Oe(this,Me)[0]=parseFloat(this.min||"0"),Oe(this,Me)[1]=Math.max(Oe(this,Me)[0],Oe(this,Me)[1])),r.has("max")&&(Oe(this,Me)[1]=parseFloat(this.max||"1"),Oe(this,Me)[0]=Math.min(Oe(this,Me)[0],Oe(this,Me)[1])),r.has("step")&&Ui(this,kr,this.step?parseFloat(this.step):void 0),r.has("value")||r.has("min")||r.has("max"))if(this.value)if(this.range!==void 0){const e=JSON.parse(this.value);Ui(this,Tt,[this.applyConstraints(e[0]),this.applyConstraints(e[1])])}else Ui(this,Tt,[this.applyConstraints(parseFloat(this.value))]);else Ui(this,Tt,[Oe(this,Me)[0],Oe(this,Me)[1]]);this.updateKnobPositions()}updateValidity(r,e){super.updateValidity(r,e,this.sliderElement)}chooseKnob(r){if(!this.endKnob)return this.startKnob;let e=Math.abs(r-this.startKnob.offsetLeft)<Math.abs(r-this.endKnob.offsetLeft)?this.startKnob:this.endKnob;return this.startKnob.value===this.endKnob.value&&(e.id==="start"&&e.value===Oe(this,Me)[0]?e=this.endKnob:e.id==="end"&&e.value===Oe(this,Me)[1]&&(e=this.startKnob)),e}toScreenSpace(r){return(r-Oe(this,Me)[0])/(Oe(this,Me)[1]-Oe(this,Me)[0])*this.track.offsetWidth}toValueSpace(r){return r/this.track.offsetWidth*(Oe(this,Me)[1]-Oe(this,Me)[0])+Oe(this,Me)[0]}applyConstraints(r,e){let t=Math.min(Math.max(r,Oe(this,Me)[0]),Oe(this,Me)[1]);return Oe(this,kr)&&(t=Math.round(t/Oe(this,kr))*Oe(this,kr)),e!==void 0&&this.endKnob&&(t=e?Math.min(t,this.endKnob.value):Math.max(t,this.startKnob.value)),t}updateKnob(r,e){r.value=e,r.offset=this.toScreenSpace(e),r.label=this.labelFormatter(e),this.endKnob&&(r.id==="start"?this.track.style.borderLeftWidth=r.offset+"px":this.track.style.borderRightWidth=this.track.offsetWidth-r.offset+"px")}updateKnobPositions(){this.updateKnob(this.startKnob,Oe(this,Tt)[0]),this.endKnob&&this.updateKnob(this.endKnob,Oe(this,Tt)[1])}onKnobDrag(r){if(r.target instanceof Ar||this.classList.contains("has-value")||this.classList.contains("has-focus")){let e;const t=n=>{let o=0;n.type==="touchmove"||n.type==="touchstart"?o=n.touches[0].clientX:o=n.clientX,o=o-this.track.getBoundingClientRect().left,e||(e=this.chooseKnob(o),e.classList.add("focus")),this.updateKnob(e,this.applyConstraints(this.toValueSpace(o),e.id==="start"))},i=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("touchmove",t),document.removeEventListener("mouseup",i),document.removeEventListener("touchend",i),e&&(e.classList.remove("focus"),this.range!==void 0?e.id==="end"?this.value=JSON.stringify([Oe(this,Tt)[0],e.value]):this.value=JSON.stringify([e.value,Oe(this,Tt)[1]]):this.value=String(e.value)),e=void 0};this.sliderElement.focus(),document.addEventListener("mousemove",t),document.addEventListener("touchmove",t),document.addEventListener("mouseup",i),document.addEventListener("touchend",i),t(r)}}renderInput(){return ut`
234
234
  ${super.renderInput()}
235
235
  <div id="slider" part="slider" tabindex="0" ?range="${this.range!==void 0}">
236
236
  <div id="track"></div>
@@ -248,7 +248,7 @@ a, a:visited { color: inherit; }
248
248
  :host(:not([sticky])) #slider:not(:focus) rokit-slider-knob::part(label) { color: transparent; background-color: transparent; border-color: transparent; top: 0; }
249
249
  #track { height: 2px; flex-grow: 1; background-color: #CCC; }
250
250
  #slider[range] #track { background-color: color-mix(in srgb, var(--rokit-primary-color-inner) 60%, transparent); border-width: 0; border-color: #CCC; border-style: solid; }
251
- `];St([Ee()],Dt.prototype,"range",2);St([Ee()],Dt.prototype,"labelFormatter",2);St([ht("#slider")],Dt.prototype,"sliderElement",2);St([ht("#track")],Dt.prototype,"track",2);St([ht("#start")],Dt.prototype,"startKnob",2);St([ht("#end")],Dt.prototype,"endKnob",2);Dt=St([Xt("rokit-slider")],Dt);let jr=class extends lr{constructor(){super(...arguments),this.offset=0,this.label="",this.value=0}updated(r){r.has("offset")&&(this.style.left=this.offset+"px")}render(){return ut`<label part="label">${this.label}</label>`}};jr.styles=[Et`
251
+ `];St([Ee()],Dt.prototype,"range",2);St([Ee()],Dt.prototype,"labelFormatter",2);St([ht("#slider")],Dt.prototype,"sliderElement",2);St([ht("#track")],Dt.prototype,"track",2);St([ht("#start")],Dt.prototype,"startKnob",2);St([ht("#end")],Dt.prototype,"endKnob",2);Dt=St([Xt("rokit-slider")],Dt);let Ar=class extends lr{constructor(){super(...arguments),this.offset=0,this.label="",this.value=0}updated(r){r.has("offset")&&(this.style.left=this.offset+"px")}render(){return ut`<label part="label">${this.label}</label>`}};Ar.styles=[Et`
252
252
  :host { position: absolute; width: ${Ht}px; height: ${Ht}px; border-radius: ${Ht}px; background-color: var(--rokit-primary-color-inner); }
253
253
  :host(.focus), :host(:hover) { box-shadow: 0 0 0 ${Ht/2}px var(--rokit-primary-color-transparent-inner); z-index: 1; }
254
254
  label {
@@ -278,7 +278,7 @@ a, a:visited { color: inherit; }
278
278
  background-color: inherit;
279
279
  clip-path: polygon(50% 50%, 100% 50%, 50% 100%, 0 50%);
280
280
  }
281
- `];St([Ee()],jr.prototype,"offset",2);St([Ee()],jr.prototype,"label",2);jr=St([Xt("rokit-slider-knob")],jr);var rp=Object.defineProperty,ip=Object.getOwnPropertyDescriptor,Ri=(r,e,t,i)=>{for(var n=i>1?void 0:i?ip(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&&rp(e,t,n),n};let ur=class extends Ct{constructor(){super(...arguments),this.open=!1,this.closable=!1,this.title=""}firstUpdated(){this.dialogElement.addEventListener("close",()=>{this.open=!1,this.dispatchEvent(new Event("close"))})}updated(r){if(r.has("open"))if(this.open)document.body.style.top=`-${window.scrollY}px`,document.body.style.position="fixed",this.dialogElement.showModal();else{const e=document.body.style.top;document.body.style.position="",document.body.style.top="",window.scrollTo(0,parseInt(e||"0")*-1),this.dialogElement.close()}}render(){return ut`
281
+ `];St([Ee()],Ar.prototype,"offset",2);St([Ee()],Ar.prototype,"label",2);Ar=St([Xt("rokit-slider-knob")],Ar);var rp=Object.defineProperty,ip=Object.getOwnPropertyDescriptor,Ii=(r,e,t,i)=>{for(var n=i>1?void 0:i?ip(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&&rp(e,t,n),n};let ur=class extends Ct{constructor(){super(...arguments),this.open=!1,this.closable=!1,this.title=""}firstUpdated(){this.dialogElement.addEventListener("close",()=>{this.open=!1,this.dispatchEvent(new Event("close"))})}updated(r){if(r.has("open"))if(this.open)document.body.style.top=`-${window.scrollY}px`,document.body.style.position="fixed",this.dialogElement.showModal();else{const e=document.body.style.top;document.body.style.position="",document.body.style.top="",window.scrollTo(0,parseInt(e||"0")*-1),this.dialogElement.close()}}render(){return ut`
282
282
  <dialog id="dialog" part="dialog">
283
283
  <header>
284
284
  <div class="title" part="title">
@@ -299,7 +299,7 @@ a, a:visited { color: inherit; }
299
299
  .title { font-weight: 600; flex-grow: 1; text-align: center; }
300
300
  .clear { justify-self: flex-end; }
301
301
  main { flex-grow: 1; overflow: auto; }
302
- `];Ri([Ee({type:Boolean,reflect:!0})],ur.prototype,"open",2);Ri([Ee({type:Boolean})],ur.prototype,"closable",2);Ri([Ee()],ur.prototype,"title",2);Ri([ht("#dialog")],ur.prototype,"dialogElement",2);ur=Ri([Xt("rokit-dialog")],ur);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 it;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,At));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 it&&(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 ct)){const n=this.getRdfClassToLinkOrCreate();n&&this.template.config.store.countQuads(e,tt,n,At)===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=Re.namedNode(i.dataset.path);if(i.firstChild instanceof Vt){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,Ir,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,Ir,null);for(const n of i)if(this.template.config.store.countQuads(e,tt,n,null)>0)return!0}return!1}createAddButton(){const e=new Ge;e.dense=!0,e.label="+ "+this.template.label,e.title="Add "+this.template.label,e.autoGrowLabelWidth=!0,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="&#xFF0B; 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 Vt(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 Ar;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 np(r,e){let t=r;const i=e.store.getQuads(r,null,null,null),n=mi(i,"label",_a,e.languages);n&&(t=n);let o;if(e.attributes.collapse!==null)o=new it,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=mi(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 op(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 Xn;const ap=new Uint8Array(16);function sp(){if(!Xn){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Xn=crypto.getRandomValues.bind(crypto)}return Xn(ap)}const lp=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),tl={randomUUID:lp};function rl(r,e,t){if(tl.randomUUID&&!r)return tl.randomUUID();r=r||{};const i=r.random??r.rng?.()??sp();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,op(i)}class Vt 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=Re.namedNode(t.attributes.valuesNamespace+rl()):d=Re.blankNode(rl())}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 f=document.createElement("a");let v=i.termType==="BlankNode"?"_:"+i.value:i.value;f.innerText=v,f.classList.add("ref-link"),f.onclick=()=>{this.config.form.querySelector(`shacl-node[data-node-id='${v}']`)?.scrollIntoView()},this.appendChild(f),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 f=t.lists[c.object.value];if(f?.length)for(const v of f)this.prepend(new Vt(v,t,i,this));else console.error("list not found:",c.object.value,"existing lists:",t.lists);break;case dc.id:this.prepend(new Vt(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,tt,this.targetClass,this.config.valuesGraphId),this.config.attributes.generateNodeShapeReference&&!this.parent&&e.addQuad(t,Re.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=np(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",Vt);var Yt={},Zt={},er={},Nt={},il;function dp(){if(il)return Nt;il=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 f=o.substr(c);const v=f.lastIndexOf("/");return v>=0&&v<f.length-1&&(f=f.substr(0,v+1),n[0]==="."&&n[1]!=="."&&n[1]!=="/"&&n[2]&&(n=n.substr(1))),n=f+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 nl;function cp(){return nl||(nl=1,function(r){var e=er&&er.__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=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(dp(),r)}(er)),er}var tr={},Qn={},ol;function up(){return ol||(ol=1,function(r){/**
302
+ `];Ii([Ee({type:Boolean,reflect:!0})],ur.prototype,"open",2);Ii([Ee({type:Boolean})],ur.prototype,"closable",2);Ii([Ee()],ur.prototype,"title",2);Ii([ht("#dialog")],ur.prototype,"dialogElement",2);ur=Ii([Xt("rokit-dialog")],ur);class tn extends HTMLElement{constructor(e,t,i,n){if(super(),this.template=new Gu(i.store.getQuads(e,null,null,null),t,i),this.container=this,this.template.extendedShapes.length&&this.template.config.attributes.collapse!==null&&(!this.template.maxCount||this.template.maxCount>1)){const o=new it;o.classList.add("collapsible","shacl-group"),o.open=i.attributes.collapse==="open",o.label=this.template.label,this.container=o}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,At));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 it&&(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=Xi(this.template.clone().merge(o),e,!0),n=!0)}n||(t=uc(i,this,this.template.config),Ac(t,""))}else{let i=!1;if(e&&!(e instanceof ct)){const n=this.getRdfClassToLinkOrCreate();n&&this.template.config.store.countQuads(e,tt,n,At)===0&&(i=!0)}t=Xi(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=Re.namedNode(i.dataset.path);if(i.firstChild instanceof Vt){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,Rr,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,Rr,null);for(const n of i)if(this.template.config.store.countQuads(e,tt,n,null)>0)return!0}return!1}createAddButton(){const e=new Ge;e.dense=!0,e.label="+ "+this.template.label,e.title="Add "+this.template.label,e.autoGrowLabelWidth=!0,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="&#xFF0B; 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(Xi(this.template,d,!0,!0),e)}e.value=""})}return e}}function Xi(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 Vt(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&&Ac(n,r.label,t),n.dataset.path=r.path,n}function Ac(r,e,t=!1){const i=new Tr;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",tn);function np(r,e){let t=r;const i=e.store.getQuads(r,null,null,null),n=mi(i,"label",_a,e.languages);n&&(t=n);let o;if(e.attributes.collapse!==null)o=new it,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=mi(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 op(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 Xn;const ap=new Uint8Array(16);function sp(){if(!Xn){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Xn=crypto.getRandomValues.bind(crypto)}return Xn(ap)}const lp=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),tl={randomUUID:lp};function rl(r,e,t){if(tl.randomUUID&&!r)return tl.randomUUID();r=r||{};const i=r.random??r.rng?.()??sp();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,op(i)}class Vt 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=Re.namedNode(t.attributes.valuesNamespace+rl()):d=Re.blankNode(rl())}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 Yi.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 Vt(v,t,i,this));else console.error("list not found:",c.object.value,"existing lists:",t.lists);break;case $u.id:this.prepend(new Vt(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,tt,this.targetClass,this.config.valuesGraphId),this.config.attributes.generateNodeShapeReference&&!this.parent&&e.addQuad(t,Re.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=np(s,t),this.appendChild(d)),n=d}else console.warn("ignoring unknown group reference",o[0],"existing groups:",t.groups)}const a=new tn(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(uc(n,this,i))}else console.error("list for sh:or/sh:xone not found:",e,"existing lists:",i.lists)}}window.customElements.define("shacl-node",Vt);var Yt={},Zt={},er={},Nt={},il;function dp(){if(il)return Nt;il=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 nl;function cp(){return nl||(nl=1,function(r){var e=er&&er.__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=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(dp(),r)}(er)),er}var tr={},Qn={},ol;function up(){return ol||(ol=1,function(r){/**
303
303
  * Character classes and associated utilities for the 5th edition of XML 1.0.
304
304
  *
305
305
  * @author Louis-Dominique Dubeau
@@ -314,45 +314,45 @@ a, a:visited { color: inherit; }
314
314
  * @license MIT
315
315
  * @copyright Louis-Dominique Dubeau
316
316
  */Object.defineProperty(r,"__esModule",{value:!0}),r.CHAR="-퟿-�𐀀-􏿿",r.RESTRICTED_CHAR="-\b\v\f--„†-Ÿ",r.S=` \r
317
- `,r.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",r.NAME_CHAR="-"+r.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.CHAR_RE=new RegExp("^["+r.CHAR+"]$","u"),r.RESTRICTED_CHAR_RE=new RegExp("^["+r.RESTRICTED_CHAR+"]$","u"),r.S_RE=new RegExp("^["+r.S+"]+$","u"),r.NAME_START_CHAR_RE=new RegExp("^["+r.NAME_START_CHAR+"]$","u"),r.NAME_CHAR_RE=new RegExp("^["+r.NAME_CHAR+"]$","u"),r.NAME_RE=new RegExp("^["+r.NAME_START_CHAR+"]["+r.NAME_CHAR+"]*$","u"),r.NMTOKEN_RE=new RegExp("^["+r.NAME_CHAR+"]+$","u");var e=9,t=10,i=13,n=32;r.S_LIST=[n,t,i,e];function o(f){return f>=1&&f<=55295||f>=57344&&f<=65533||f>=65536&&f<=1114111}r.isChar=o;function a(f){return f>=1&&f<=8||f===11||f===12||f>=14&&f<=31||f>=127&&f<=132||f>=134&&f<=159}r.isRestrictedChar=a;function s(f){return f===9||f===10||f===13||f>31&&f<127||f===133||f>159&&f<=55295||f>=57344&&f<=65533||f>=65536&&f<=1114111}r.isCharAndNotRestricted=s;function d(f){return f===n||f===t||f===i||f===e}r.isS=d;function l(f){return f>=65&&f<=90||f>=97&&f<=122||f===58||f===95||f===8204||f===8205||f>=192&&f<=214||f>=216&&f<=246||f>=248&&f<=767||f>=880&&f<=893||f>=895&&f<=8191||f>=8304&&f<=8591||f>=11264&&f<=12271||f>=12289&&f<=55295||f>=63744&&f<=64975||f>=65008&&f<=65533||f>=65536&&f<=983039}r.isNameStartChar=l;function c(f){return l(f)||f>=48&&f<=57||f===45||f===46||f===183||f>=768&&f<=879||f>=8255&&f<=8256}r.isNameChar=c}(Jn)),Jn}var Kn={},sl;function pp(){return sl||(sl=1,function(r){/**
317
+ `,r.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",r.NAME_CHAR="-"+r.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.CHAR_RE=new RegExp("^["+r.CHAR+"]$","u"),r.RESTRICTED_CHAR_RE=new RegExp("^["+r.RESTRICTED_CHAR+"]$","u"),r.S_RE=new RegExp("^["+r.S+"]+$","u"),r.NAME_START_CHAR_RE=new RegExp("^["+r.NAME_START_CHAR+"]$","u"),r.NAME_CHAR_RE=new RegExp("^["+r.NAME_CHAR+"]$","u"),r.NAME_RE=new RegExp("^["+r.NAME_START_CHAR+"]["+r.NAME_CHAR+"]*$","u"),r.NMTOKEN_RE=new RegExp("^["+r.NAME_CHAR+"]+$","u");var e=9,t=10,i=13,n=32;r.S_LIST=[n,t,i,e];function o(u){return u>=1&&u<=55295||u>=57344&&u<=65533||u>=65536&&u<=1114111}r.isChar=o;function a(u){return u>=1&&u<=8||u===11||u===12||u>=14&&u<=31||u>=127&&u<=132||u>=134&&u<=159}r.isRestrictedChar=a;function s(u){return u===9||u===10||u===13||u>31&&u<127||u===133||u>159&&u<=55295||u>=57344&&u<=65533||u>=65536&&u<=1114111}r.isCharAndNotRestricted=s;function d(u){return u===n||u===t||u===i||u===e}r.isS=d;function l(u){return u>=65&&u<=90||u>=97&&u<=122||u===58||u===95||u===8204||u===8205||u>=192&&u<=214||u>=216&&u<=246||u>=248&&u<=767||u>=880&&u<=893||u>=895&&u<=8191||u>=8304&&u<=8591||u>=11264&&u<=12271||u>=12289&&u<=55295||u>=63744&&u<=64975||u>=65008&&u<=65533||u>=65536&&u<=983039}r.isNameStartChar=l;function c(u){return l(u)||u>=48&&u<=57||u===45||u===46||u===183||u>=768&&u<=879||u>=8255&&u<=8256}r.isNameChar=c}(Jn)),Jn}var Kn={},sl;function pp(){return sl||(sl=1,function(r){/**
318
318
  * Character class utilities for XML NS 1.0 edition 3.
319
319
  *
320
320
  * @author Louis-Dominique Dubeau
321
321
  * @license MIT
322
322
  * @copyright Louis-Dominique Dubeau
323
- */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}(Kn)),Kn}var ll;function hp(){if(ll)return tr;ll=1,Object.defineProperty(tr,"__esModule",{value:!0}),tr.SaxesParser=tr.EVENTS=void 0;const r=up(),e=fp(),t=pp();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,f=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,u=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,Ie=40,We=41,Se=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,gt=60,Pt=61,qe=62,Ue=63,Ti=91,Mt=93,br=133,Mr=8232,D=Ve=>Ve===ue||Ve===Fe,M=[ue,Fe],ve=[...M,Ti,qe],ye=[...M,gt,Mt],xe=[Pt,Ue,...s],Xe=[...s,qe,ke,gt];function Ye(Ve,P,ie){switch(P){case"xml":ie!==g&&Ve.fail(`xml prefix must be bound to ${g}.`);break;case"xmlns":ie!==y&&Ve.fail(`xmlns prefix must be bound to ${y}.`);break}switch(ie){case y:Ve.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"":Ve.fail(`the default namespace may not be set to ${ie}.`);break;default:Ve.fail("may not assign the xml namespace to another prefix.")}break}}function Ai(Ve,P){for(const ie of Object.keys(P))Ye(Ve,ie,P[ie])}const Rt=Ve=>v.test(Ve),ji=Ve=>d.test(Ve),It=0,Br=1,mr=2;tr.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];const gr={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 qr{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=f,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&&(Ai(this,ne),Object.assign(this.ns,ne))}else this.nameStartCheck=o,this.nameCheck=a,this.isName=ji,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[gr[P]]=ie}off(P){this[gr[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!==Mr||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===br)&&(this.i=ie+2)}case br:case Mr: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)}
323
+ */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}(Kn)),Kn}var ll;function hp(){if(ll)return tr;ll=1,Object.defineProperty(tr,"__esModule",{value:!0}),tr.SaxesParser=tr.EVENTS=void 0;const r=up(),e=fp(),t=pp();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,Ie=40,We=41,Se=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,gt=60,Pt=61,qe=62,Ue=63,Ai=91,Mt=93,br=133,Pr=8232,D=Ve=>Ve===ue||Ve===Fe,M=[ue,Fe],ve=[...M,Ai,qe],ye=[...M,gt,Mt],xe=[Pt,Ue,...s],Xe=[...s,qe,ke,gt];function Ye(Ve,P,ie){switch(P){case"xml":ie!==g&&Ve.fail(`xml prefix must be bound to ${g}.`);break;case"xmlns":ie!==y&&Ve.fail(`xmlns prefix must be bound to ${y}.`);break}switch(ie){case y:Ve.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"":Ve.fail(`the default namespace may not be set to ${ie}.`);break;default:Ve.fail("may not assign the xml namespace to another prefix.")}break}}function ji(Ve,P){for(const ie of Object.keys(P))Ye(Ve,ie,P[ie])}const Rt=Ve=>v.test(Ve),Di=Ve=>d.test(Ve),It=0,Mr=1,mr=2;tr.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];const gr={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 Br{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&&(ji(this,ne),Object.assign(this.ns,ne))}else this.nameStartCheck=o,this.nameCheck=a,this.isName=Di,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[gr[P]]=ie}off(P){this[gr[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!==Pr||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===br)&&(this.i=ie+2)}case br:case Pr: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)}
324
324
  `,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)}
325
- `,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=u}sBeginWhitespace(){const P=this.i,ie=this.skipSpaces();switch(this.prevI!==P&&(this.xmlDeclPossible=!1),ie){case gt: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===Ti?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===Mt?this.state=b:P===gt?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 Ue: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(Ue)&&(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)}
326
- `,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 Ue: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(Mt)&&(this.state=de)}sCDataEnding(){const P=this.getCodeNorm();P===Mt?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 Mt: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===Ue||i(P)?(this.fail("processing instruction without a target."),this.state=P===Ue?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===Ue;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===Ue?this.state=ee:i(P)||(this.text=String.fromCodePoint(P))}else this.captureToChar(Ue)&&(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===Ue?this.text+="?":(this.text+=`?${String.fromCodePoint(ie)}`,this.state=z);this.xmlDeclPossible=!1}sXMLDeclNameStart(){const P=this.skipSpaces();if(P===Ue){this.state=fe;return}P!==_&&(this.state=pe,this.name=String.fromCodePoint(P))}sXMLDeclName(){const P=this.captureTo(xe);if(P===Ue){this.state=fe,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(i(P)||P===Pt){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===Pt?O:be}}sXMLDeclEq(){const P=this.getCodeNorm();if(P===Ue){this.state=fe,this.fail("XML declaration is incomplete.");return}i(P)||(P!==Pt&&this.fail("value required."),this.state=O)}sXMLDeclValueStart(){const P=this.getCodeNorm();if(P===Ue){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,Ue]);if(P===Ue){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===Ue){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===Pt?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 Pt: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=Ie):i(P)||(this.fail("unquoted attribute value."),this.state=Se,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=Ie;return;case h:case E:case p:this.text+=`${ie.slice(ne,this.prevI)} `,ne=this.i;break;case gt: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=Se;break;case gt: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 gt:{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 Mt:switch(ie){case It:ie=Br;break;case Br:ie=mr;break;case mr:break;default:throw new Error("impossible state")}break;case qe:ie===mr&&this.fail('the string "]]>" is disallowed in char data.'),ie=It;break;case E:we!==void 0&&(this.text+=`${ne.slice(P,this.prevI)}
325
+ `,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 gt: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===Ai?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===Mt?this.state=b:P===gt?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 Ue: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(Ue)&&(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)}
326
+ `,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 Ue: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(Mt)&&(this.state=de)}sCDataEnding(){const P=this.getCodeNorm();P===Mt?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 Mt: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===Ue||i(P)?(this.fail("processing instruction without a target."),this.state=P===Ue?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===Ue;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===Ue?this.state=ee:i(P)||(this.text=String.fromCodePoint(P))}else this.captureToChar(Ue)&&(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===Ue?this.text+="?":(this.text+=`?${String.fromCodePoint(ie)}`,this.state=z);this.xmlDeclPossible=!1}sXMLDeclNameStart(){const P=this.skipSpaces();if(P===Ue){this.state=fe;return}P!==_&&(this.state=pe,this.name=String.fromCodePoint(P))}sXMLDeclName(){const P=this.captureTo(xe);if(P===Ue){this.state=fe,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(i(P)||P===Pt){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===Pt?O:be}}sXMLDeclEq(){const P=this.getCodeNorm();if(P===Ue){this.state=fe,this.fail("XML declaration is incomplete.");return}i(P)||(P!==Pt&&this.fail("value required."),this.state=O)}sXMLDeclValueStart(){const P=this.getCodeNorm();if(P===Ue){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,Ue]);if(P===Ue){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===Ue){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===Pt?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 Pt: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=Ie):i(P)||(this.fail("unquoted attribute value."),this.state=Se,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=Ie;return;case h:case E:case p:this.text+=`${ie.slice(ne,this.prevI)} `,ne=this.i;break;case gt: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=Se;break;case gt: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 gt:{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 Mt:switch(ie){case It:ie=Mr;break;case Mr:ie=mr;break;case mr:break;default:throw new Error("impossible state")}break;case qe:ie===mr&&this.fail('the string "]]>" is disallowed in char data.'),ie=It;break;case E:we!==void 0&&(this.text+=`${ne.slice(P,this.prevI)}
327
327
  `),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 gt:{if(this.state=F,ne!==void 0){const{text:Le}=this,Ze=ie.slice(P,this.prevI);Le.length!==0?(ne(Le+Ze),this.text=""):Ze.length!==0&&ne(Ze)}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)}
328
- `),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 Ze=ie.trim();this.currentXMLVersion==="1.0"&&Ze===""&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[Te]=Ze,Ye(this,Te,Ze)}else if(P==="xmlns"){const Ze=ie.trim();this.topNS[""]=Ze,Ye(this,"",Ze)}}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:Ze}=this.qname(ne.name);ne.prefix=Le,ne.local=Ze;const vr=ne.uri=(P=this.resolve(Le))!==null&&P!==void 0?P:"";Le!==""&&(Le==="xmlns"&&this.fail('tags may not have "xmlns" as prefix.'),vr===""&&(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:Ze,prefix:vr,local:tu}=Le;let yr,zr;vr===""?(yr=Ze==="xmlns"?y:"",zr=Ze):(yr=this.resolve(vr),yr===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(vr)}.`),yr=vr),zr=`{${yr}}${tu}`),Te.has(zr)&&this.fail(`duplicate attribute: ${zr}.`),Te.add(zr),Le.uri=yr,we[Ze]=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 tr.SaxesParser=qr,tr}var Kr={},dl;function bp(){if(dl)return Kr;dl=1,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.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 Kr.ParseError=r,Kr}var rr={},Yr={},cl;function Dc(){if(cl)return Yr;cl=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.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 Yr.BlankNode=r,Yr}var Zr={},ei={},ul;function Lc(){if(ul)return ei;ul=1,Object.defineProperty(ei,"__esModule",{value:!0}),ei.DefaultGraph=void 0;class r{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&t.termType==="DefaultGraph"}}return ei.DefaultGraph=r,r.INSTANCE=new r,ei}var ti={},ri={},fl;function $a(){if(fl)return ri;fl=1,Object.defineProperty(ri,"__esModule",{value:!0}),ri.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 ri.NamedNode=r,ri}var pl;function Oc(){if(pl)return ti;pl=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.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 ti.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"),ti}var ii={},hl;function Cc(){if(hl)return ii;hl=1,Object.defineProperty(ii,"__esModule",{value:!0}),ii.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 ii.Quad=r,ii}var ni={},bl;function $c(){if(bl)return ni;bl=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.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 ni.Variable=r,ni}var ml;function mp(){if(ml)return Zr;ml=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.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,f,v){return new n.Quad(l,c,f,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 Zr.DataFactory=s,Zr}var gl;function Fc(){return gl||(gl=1,function(r){var e=rr&&rr.__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=rr&&rr.__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(mp(),r),t(Lc(),r),t(Oc(),r),t($a(),r),t(Cc(),r),t($c(),r)}(rr)),rr}var ir={},Yn={},vl;function gp(){return vl||(vl=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}`,f="[a-fA-F0-9]{1,4}",v=`(${f}:${f}|${c})`,g=`((${f}:){6}${v}|::(${f}:){5}${v}|(${f})?::(${f}:){4}${v}|((${f}:){0,1}${f})?::(${f}:){3}${v}|((${f}:){0,2}${f})?::(${f}:){2}${v}|((${f}:){0,3}${f})?::${f}:${v}|((${f}:){0,4}${f})?::${v}|((${f}:){0,5}${f})?::${f}|((${f}:){0,6}${f})?::)`,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}(Yn)),Yn}var yl;function vp(){return yl||(yl=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(gp(),r)}(ir)),ir}var wl;function yp(){if(wl)return Zt;wl=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.ParseType=Zt.RdfXmlParser=void 0;const r=cp(),e=hp(),t=ac(),i=bp(),n=Fc(),o=vp();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=>f.emit("error",v)),l.on("data",v=>c.push(v)),l.on("end",()=>c.push(null));const f=c.pipe(new Ce(this.options));return f}_transform(l,c,f){try{this.saxParser.write(l)}catch(v){return f(v)}f()}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 f=s.RESOURCE;if(c&&(c.hadChildren=!0,f=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),f===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,f,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 u in l.attributes){const b=l.attributes[u];if(b.uri===Ce.RDF&&b.local==="version"){this.setVersion(c,b.value);continue}else if(f&&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 u=this.uriToNamedNode(l.uri+l.local);this.emitTriple(c.subject,this.dataFactory.namedNode(Ce.RDF+"type"),u,f?f.reifiedStatementId:null,c.childrenTripleTerms,c.reifier)}if(f){if(f.predicate)if(f.childrenCollectionSubject){const u=this.dataFactory.blankNode(),b=this.dataFactory.namedNode(Ce.RDF+"rest"),R=f.childrenCollectionPredicate.equals(b);this.emitTriple(f.childrenCollectionSubject,f.childrenCollectionPredicate,u,R?null:f.reifiedStatementId,f.childrenTripleTerms,R?null:f.reifier),this.emitTriple(u,this.dataFactory.namedNode(Ce.RDF+"first"),c.subject,null,c.childrenTripleTerms),f.childrenCollectionSubject=u,f.childrenCollectionPredicate=b}else{f.childrenTagsToTripleTerms||(this.emitTriple(f.subject,f.predicate,c.subject,f.reifiedStatementId,f.childrenTripleTerms,f.reifier),f.predicateEmitted=!0);for(let u=0;u<f.predicateSubPredicates.length;u++)this.emitTriple(c.subject,f.predicateSubPredicates[u],f.predicateSubObjects[u],null,f.childrenTripleTerms,f.reifier);f.predicateSubPredicates=[],f.predicateSubObjects=[]}for(let u=0;u<y.length;u++){const b=this.createLiteral(k[u],c);this.emitTriple(c.subject,y[u],b,f.reifiedStatementId,f.childrenTripleTerms,f.reifier)}m&&this.emitTriple(c.subject,this.dataFactory.namedNode(Ce.RDF+"type"),this.uriToNamedNode(m),null,c.childrenTripleTerms,c.reifier)}}onTagProperty(l,c,f){if(c.childrenParseType=s.RESOURCE,c.subject=f.subject,l.uri===Ce.RDF&&l.local==="li"?(f.listItemCounter||(f.listItemCounter=1),c.predicate=this.uriToNamedNode(l.uri+"_"+f.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 u=this.dataFactory.blankNode();this.emitTriple(c.subject,c.predicate,u,c.reifiedStatementId,c.childrenTripleTerms,c.reifier),c.subject=u,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,f,v,g,y){const k=this.dataFactory.quad(l,c,f,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"),f,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 f of l.childrenTripleTerms)this.emitTriple(l.subject,l.predicate,f,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 f=this.dataFactory.blankNode();this.emitTriple(l.subject,l.predicate,f,l.reifiedStatementId,l.childrenTripleTerms,l.reifier);for(let v=0;v<l.predicateSubPredicates.length;v++)this.emitTriple(f,l.predicateSubPredicates[v],l.predicateSubObjects[v],null,l.childrenTripleTerms)}}}onDoctype(l){l.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(c,f,v)=>(this.saxParser.ENTITIES[f]=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)}};Zt.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||(Zt.ParseType=s={})),Zt}var xl;function wp(){return xl||(xl=1,function(r){var e=Yt&&Yt.__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=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(yp(),r)}(Yt)),Yt}var xp=wp(),Zn={},eo,_l;function Fa(){return _l||(_l=1,eo=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()]}}),eo}var to={},kl;function _p(){return kl||(kl=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),u=0;u<m.length;u++)m[u]=arguments[u+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,u=E.args;switch(u.length){case 0:m();break;case 1:m(u[0]);break;case 2:m(u[0],u[1]);break;case 3:m(u[0],u[1],u[2]);break;default:m.apply(e,u);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 f(){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(u){u.source===r&&typeof u.data=="string"&&u.data.indexOf(E)===0&&c(+u.data.slice(E.length))};r.addEventListener?r.addEventListener("message",m,!1):r.attachEvent("onmessage",m),a=function(u){r.postMessage(E+u,"*")}}function y(){var E=new MessageChannel;E.port1.onmessage=function(m){var u=m.data;c(u)},a=function(m){E.port2.postMessage(m)}}function k(){var E=o.documentElement;a=function(m){var u=o.createElement("script");u.onreadystatechange=function(){c(m),u.onreadystatechange=null,E.removeChild(u),u=null},E.appendChild(u)}}function x(){a=function(E){setTimeout(c,0,E)}}var _=Object.getPrototypeOf&&Object.getPrototypeOf(r);_=_&&_.setTimeout?_:r,{}.toString.call(r.process)==="[object process]"?f():v()?g():r.MessageChannel?y():o&&"onreadystatechange"in o.createElement("script")?k():x(),_.setImmediate=s,_.clearImmediate=d}(typeof self>"u"?typeof Er>"u"?to:Er:self)),to}/*!
328
+ `),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 Ze=ie.trim();this.currentXMLVersion==="1.0"&&Ze===""&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[Te]=Ze,Ye(this,Te,Ze)}else if(P==="xmlns"){const Ze=ie.trim();this.topNS[""]=Ze,Ye(this,"",Ze)}}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:Ze}=this.qname(ne.name);ne.prefix=Le,ne.local=Ze;const vr=ne.uri=(P=this.resolve(Le))!==null&&P!==void 0?P:"";Le!==""&&(Le==="xmlns"&&this.fail('tags may not have "xmlns" as prefix.'),vr===""&&(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:Ze,prefix:vr,local:eu}=Le;let yr,qr;vr===""?(yr=Ze==="xmlns"?y:"",qr=Ze):(yr=this.resolve(vr),yr===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(vr)}.`),yr=vr),qr=`{${yr}}${eu}`),Te.has(qr)&&this.fail(`duplicate attribute: ${qr}.`),Te.add(qr),Le.uri=yr,we[Ze]=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 tr.SaxesParser=Br,tr}var Jr={},dl;function bp(){if(dl)return Jr;dl=1,Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.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 Jr.ParseError=r,Jr}var rr={},Kr={},cl;function jc(){if(cl)return Kr;cl=1,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.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 Kr.BlankNode=r,Kr}var Yr={},Zr={},ul;function Dc(){if(ul)return Zr;ul=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.DefaultGraph=void 0;class r{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&t.termType==="DefaultGraph"}}return Zr.DefaultGraph=r,r.INSTANCE=new r,Zr}var ei={},ti={},fl;function $a(){if(fl)return ti;fl=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.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 ti.NamedNode=r,ti}var pl;function Lc(){if(pl)return ei;pl=1,Object.defineProperty(ei,"__esModule",{value:!0}),ei.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 ei.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"),ei}var ri={},hl;function Oc(){if(hl)return ri;hl=1,Object.defineProperty(ri,"__esModule",{value:!0}),ri.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 ri.Quad=r,ri}var ii={},bl;function Cc(){if(bl)return ii;bl=1,Object.defineProperty(ii,"__esModule",{value:!0}),ii.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 ii.Variable=r,ii}var ml;function mp(){if(ml)return Yr;ml=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.DataFactory=void 0;const r=jc(),e=Dc(),t=Lc(),i=$a(),n=Oc(),o=Cc();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 Yr.DataFactory=s,Yr}var gl;function $c(){return gl||(gl=1,function(r){var e=rr&&rr.__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=rr&&rr.__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(jc(),r),t(mp(),r),t(Dc(),r),t(Lc(),r),t($a(),r),t(Oc(),r),t(Cc(),r)}(rr)),rr}var ir={},Yn={},vl;function gp(){return vl||(vl=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}(Yn)),Yn}var yl;function vp(){return yl||(yl=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(gp(),r)}(ir)),ir}var wl;function yp(){if(wl)return Zt;wl=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.ParseType=Zt.RdfXmlParser=void 0;const r=cp(),e=hp(),t=ac(),i=bp(),n=$c(),o=vp();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)}};Zt.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||(Zt.ParseType=s={})),Zt}var xl;function wp(){return xl||(xl=1,function(r){var e=Yt&&Yt.__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=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(yp(),r)}(Yt)),Yt}var xp=wp(),Zn={},eo,_l;function Fa(){return _l||(_l=1,eo=class Fc{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 Fc(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()]}}),eo}var to={},kl;function _p(){return kl||(kl=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 Er>"u"?to:Er:self)),to}/*!
329
329
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
330
330
  */var ro,El;function hn(){if(El)return ro;El=1,_p();const r=self.crypto||self.msCrypto;return ro=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}},ro}/*!
331
331
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
332
- */var io,Sl;function Mc(){return Sl||(Sl=1,io=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}}),io}/*!
332
+ */var io,Sl;function Pc(){return Sl||(Sl=1,io=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}}),io}/*!
333
333
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
334
- */var no,Rl;function Pa(){if(Rl)return no;Rl=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='"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"',u="(?:\\^\\^"+g+")",R="(?:"+m+"(?:"+u+"|"+"(?:@([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+"$")})(),no=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 u=m.match(s.quad);if(u===null)throw new Error("N-Quads parse error on line "+E+".");const b={subject:null,predicate:null,object:null,graph:null};if(u[1]!==void 0?b.subject={termType:i,value:u[1]}:b.subject={termType:n,value:u[2]},b.predicate={termType:i,value:u[3]},u[4]!==void 0?b.object={termType:i,value:u[4]}:u[5]!==void 0?b.object={termType:n,value:u[5]}:(b.object={termType:o,value:void 0,datatype:{termType:i}},u[7]!==void 0?b.object.datatype.value=u[7]:u[8]!==void 0?(b.object.datatype.value=e,b.object.language=u[8]):b.object.datatype.value=t,b.object.value=v(u[6])),u[9]!==void 0?b.graph={termType:i,value:u[9]}:u[10]!==void 0?b.graph={termType:n,value:u[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+=` .
335
- `,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 u={};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)),u[b]=L}_==="@default"?u.graph={termType:a,value:""}:u.graph={termType:_.startsWith("_:")?n:i,value:_},k.push(u)});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`
336
- `:return"\\n";case"\r":return"\\r"}})}const f=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function v(g){return g.replace(f,function(y,k,x,_){if(k)switch(k){case"t":return" ";case"b":return"\b";case"n":return`
334
+ */var no,Rl;function Pa(){if(Rl)return no;Rl=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+"$")})(),no=class Qi{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=Qi.legacyDatasetToQuads(y));const k=[];for(const x of y)k.push(Qi.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+=` .
335
+ `,E}static serializeQuad(y){return Qi.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`
336
+ `: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`
337
337
  `;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 no}/*!
338
338
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
339
- */var oo,Il;function Bc(){if(Il)return oo;Il=1;const r=Fa(),e=hn(),t=Mc(),i=Pa();oo=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(),f=[];for(const g of c){const y=s.get(g);if(y.length>1){f.push(y);continue}const k=y[0];this.canonicalIssuer.getId(k)}for(const g of f){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 f of l){const v={subject:null,predicate:f.predicate,object:null,graph:null};v.subject=this.modifyFirstDegreeComponent(a,f.subject,"subject"),v.object=this.modifyFirstDegreeComponent(a,f.object,"object"),v.graph=this.modifyFirstDegreeComponent(a,f.graph,"graph"),s.push(i.serializeQuad(v))}s.sort();const c=this.createMessageDigest();for(const f of s)c.update(f);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 f=this.createMessageDigest();return f.update(l),l!=="g"&&f.update(this.getRelatedPredicate(s)),f.update(c),f.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),f=[...c.keys()].sort();for(const v of f){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 u=[];let b=!1;for(const R of _)if(this.canonicalIssuer.hasId(R)?m+=this.canonicalIssuer.getId(R):(E.hasId(R)||u.push(R),m+=E.getId(R)),g.length!==0&&m>g){b=!0;break}if(!b){for(const R of u){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 f of l)++c%100===0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:f,component:f.subject,position:"s",id:a,issuer:s,hashToRelated:d}),this._addRelatedBlankNodeHash({quad:f,component:f.object,position:"o",id:a,issuer:s,hashToRelated:d}),this._addRelatedBlankNodeHash({quad:f,component:f.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:f}){if(!(s.termType==="BlankNode"&&s.value!==l))return;const v=s.value,g=await this.hashRelatedBlankNode(v,a,c,d),y=f.get(g);y?y.push(v):f.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 oo}/*!
339
+ */var oo,Il;function Mc(){if(Il)return oo;Il=1;const r=Fa(),e=hn(),t=Pc(),i=Pa();oo=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 oo}/*!
340
340
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
341
- */var ao,Nl;function kp(){if(Nl)return ao;Nl=1;const r=hn(),e=Bc();return ao=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 f=await this.hashRelatedBlankNode(c,d,n,l),v=o.get(f);v?v.push(c):o.set(f,[c])}return o}},ao}/*!
341
+ */var ao,Nl;function kp(){if(Nl)return ao;Nl=1;const r=hn(),e=Mc();return ao=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}},ao}/*!
342
342
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
343
- */var so,Tl;function qc(){if(Tl)return so;Tl=1;const r=Fa(),e=hn(),t=Mc(),i=Pa();so=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 f=[];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}));f.push(g)}return f.sort(),f.join("")}hashFirstDegreeQuads(a){const s=[],d=this.blankNodeInfo.get(a),l=d.quads;for(const f of l){const v={subject:null,predicate:f.predicate,object:null,graph:null};v.subject=this.modifyFirstDegreeComponent(a,f.subject,"subject"),v.object=this.modifyFirstDegreeComponent(a,f.object,"object"),v.graph=this.modifyFirstDegreeComponent(a,f.graph,"graph"),s.push(i.serializeQuad(v))}s.sort();const c=this.createMessageDigest();for(const f of s)c.update(f);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 f=this.createMessageDigest();return f.update(l),l!=="g"&&f.update(this.getRelatedPredicate(s)),f.update(c),f.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),f=[...c.keys()].sort();for(const v of f){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 u=!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){u=!0;break}if(!u){for(const b of m){const R=this.hashNDegreeQuads(b,_);if(E+=_.getId(b),E+=`<${R.hash}>`,_=R.issuer,g.length!==0&&E>g){u=!0;break}}u||(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:f}){if(!(s.termType==="BlankNode"&&s.value!==l))return;const v=s.value,g=this.hashRelatedBlankNode(v,a,c,d),y=f.get(g);y?y.push(v):f.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 so}/*!
343
+ */var so,Tl;function Bc(){if(Tl)return so;Tl=1;const r=Fa(),e=hn(),t=Pc(),i=Pa();so=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 so}/*!
344
344
  * Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
345
- */var lo,Al;function Ep(){if(Al)return lo;Al=1;const r=hn(),e=qc();return lo=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),f=o.get(c);f?f.push(l):o.set(c,[l])}return o}},lo}const Sp={},Rp=Object.freeze(Object.defineProperty({__proto__:null,default:Sp},Symbol.toStringTag,{value:"Module"})),Ip=iu(Rp);var jl;function Np(){return jl||(jl=1,function(r){const e=Bc(),t=kp(),i=qc(),n=Ep();let o;try{o=Ip}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,f)=>o.canonize(l,d,(v,g)=>v?f(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.")}}(Zn)),Zn}var co,Dl;function Ma(){return Dl||(Dl=1,co=Np()),co}var uo,Ll;function dt(){if(Ll)return uo;Ll=1;const r={};return uo=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",uo}var fo,Ol;function Ft(){if(Ol)return fo;Ol=1;const r=dt(),e={};return fo=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},fo}var po,Cl;function bt(){return Cl||(Cl=1,po=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}}),po}var ho,$l;function ft(){if($l)return ho;$l=1;const r=Ft(),e=dt(),t=Ma().IdentifierIssuer,i=bt(),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={};ho=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 f(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 f(v,g){if(e.isArray(g))for(let y=0;y<g.length;++y)g[y]=f(v,g[y]);else if(r.isList(g))g["@list"]=f(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]=f(v,g[x]))}}return g}return ho}var bo,Fl;function Ba(){if(Fl)return bo;Fl=1;const r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",e="http://www.w3.org/2001/XMLSchema#";return bo={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"},bo}var mo,Pl;function zc(){return Pl||(Pl=1,mo=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]}}}),mo}var go,Ml;function Jt(){if(Ml)return go;Ml=1;const r=dt(),e={};go=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 f=0;f<s.length;++f)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),go}var vo,Bl;function Tp(){if(Bl)return vo;Bl=1;const{parseLinkHeader:r,buildHeaders:e}=ft(),{LINK_HEADER_CONTEXT:t}=Ba(),i=bt(),n=zc(),{prependBase:o}=Jt(),a=/(^|(\r\n))link:/i;vo=({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),u=m[t];if(Array.isArray(u))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});u&&(k.contextUrl=u.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 f=new d;return new Promise((v,g)=>{f.onload=()=>v(f),f.onerror=y=>g(y),f.open("GET",l,!0);for(const y in c)f.setRequestHeader(y,c[y]);f.send()})}return vo}var yo,ql;function Ap(){if(ql)return yo;ql=1;const r=Tp(),e={};return yo=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})},yo}var wo,zl;function jp(){return zl||(zl=1,wo=function(r){r.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),wo}var xo,Ul;function Dp(){if(Ul)return xo;Ul=1,xo=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{jp()(r)}catch{}return xo}var _o,Hl;function Uc(){if(Hl)return _o;Hl=1;const r=Dp(),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"),f=()=>1;class v{constructor(u){if(typeof u=="number"&&(u={max:u}),u||(u={}),u.max&&(typeof u.max!="number"||u.max<0))throw new TypeError("max must be a non-negative number");this[e]=u.max||1/0;const b=u.length||f;if(this[i]=typeof b!="function"?f:b,this[n]=u.stale||!1,u.maxAge&&typeof u.maxAge!="number")throw new TypeError("maxAge must be a number");this[o]=u.maxAge||0,this[a]=u.dispose,this[s]=u.noDisposeOnSet||!1,this[c]=u.updateAgeOnGet||!1,this.reset()}set max(u){if(typeof u!="number"||u<0)throw new TypeError("max must be a non-negative number");this[e]=u||1/0,k(this)}get max(){return this[e]}set allowStale(u){this[n]=!!u}get allowStale(){return this[n]}set maxAge(u){if(typeof u!="number")throw new TypeError("maxAge must be a non-negative number");this[o]=u,k(this)}get maxAge(){return this[o]}set lengthCalculator(u){typeof u!="function"&&(u=f),u!==this[i]&&(this[i]=u,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(u,b){b=b||this;for(let R=this[d].tail;R!==null;){const L=R.prev;E(this,u,R,b),R=L}}forEach(u,b){b=b||this;for(let R=this[d].head;R!==null;){const L=R.next;E(this,u,R,b),R=L}}keys(){return this[d].toArray().map(u=>u.key)}values(){return this[d].toArray().map(u=>u.value)}reset(){this[a]&&this[d]&&this[d].length&&this[d].forEach(u=>this[a](u.key,u.value)),this[l]=new Map,this[d]=new r,this[t]=0}dump(){return this[d].map(u=>y(this,u)?!1:{k:u.key,v:u.value,e:u.now+(u.maxAge||0)}).toArray().filter(u=>u)}dumpLru(){return this[d]}set(u,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,u);if(this[l].has(u)){if(T>this[e])return x(this,this[l].get(u)),!1;const $=this[l].get(u).value;return this[a]&&(this[s]||this[a](u,$.value)),$.now=L,$.maxAge=R,$.value=b,this[t]+=T-$.length,$.length=T,this.get(u),k(this),!0}const B=new _(u,b,T,L,R);return B.length>this[e]?(this[a]&&this[a](u,b),!1):(this[t]+=B.length,this[d].unshift(B),this[l].set(u,this[d].head),k(this),!0)}has(u){if(!this[l].has(u))return!1;const b=this[l].get(u).value;return!y(this,b)}get(u){return g(this,u,!0)}peek(u){return g(this,u,!1)}pop(){const u=this[d].tail;return u?(x(this,u),u.value):null}del(u){x(this,this[l].get(u))}load(u){this.reset();const b=Date.now();for(let R=u.length-1;R>=0;R--){const L=u[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((u,b)=>g(this,b,!1))}}const g=(m,u,b)=>{const R=m[l].get(u);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,u)=>{if(!u||!u.maxAge&&!m[o])return!1;const b=Date.now()-u.now;return u.maxAge?b>u.maxAge:m[o]&&b>m[o]},k=m=>{if(m[t]>m[e])for(let u=m[d].tail;m[t]>m[e]&&u!==null;){const b=u.prev;x(m,u),u=b}},x=(m,u)=>{if(u){const b=u.value;m[a]&&m[a](b.key,b.value),m[t]-=b.length,m[l].delete(b.key),m[d].removeNode(u)}};class _{constructor(u,b,R,L,T){this.key=u,this.value=b,this.length=R,this.now=L,this.maxAge=T||0}}const E=(m,u,b,R)=>{let L=b.value;y(m,L)&&(x(m,b),m[n]||(L=void 0)),L&&u.call(R,L.value,L.key,m)};return _o=v,_o}var ko,Gl;function Lp(){if(Gl)return ko;Gl=1;const r=Uc(),e=10;return ko=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)}},ko}var Eo,Vl;function Op(){if(Vl)return Eo;Vl=1;const{isArray:r,isObject:e,isString:t}=dt(),{asArray:i}=ft(),{prependBase:n}=Jt(),o=bt(),a=Lp(),s=10;Eo=class{constructor({sharedCache:f}){this.perOpCache=new Map,this.sharedCache=f}async resolve({activeCtx:f,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 u=this._get(_);u||(u=await this._resolveRemoteContext({activeCtx:f,url:_,documentLoader:g,base:y,cycles:k})),r(u)?x.push(...u):x.push(u);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(f){let v=this.perOpCache.get(f);if(!v){const g=this.sharedCache.get(f);g&&(v=g.get("static"),v&&this.perOpCache.set(f,v))}return v}_cacheResolvedContext({key:f,resolved:v,tag:g}){if(this.perOpCache.set(f,v),g!==void 0){let y=this.sharedCache.get(f);y||(y=new Map,this.sharedCache.set(f,y)),y.set(g,v)}return v}async _resolveRemoteContext({activeCtx:f,url:v,documentLoader:g,base:y,cycles:k}){v=n(y,v);const{context:x,remoteDoc:_}=await this._fetchContext({activeCtx:f,url:v,documentLoader:g,cycles:k});y=_.documentUrl||v,l({context:x,base:y});const E=await this.resolve({activeCtx:f,context:x,documentLoader:g,base:y,cycles:k});return this._cacheResolvedContext({key:v,resolved:E,tag:_.tag}),E}async _fetchContext({activeCtx:f,url:v,documentLoader:g,cycles:y}){if(y.size>s)throw new o("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:f.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:f.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:f}){if(!c)return;const v=c["@context"];if(t(v)){c["@context"]=n(f,v);return}if(r(v)){for(let g=0;g<v.length;++g){const y=v[g];if(t(y)){v[g]=n(f,y);continue}e(y)&&l({context:{"@context":y},base:f})}return}if(e(v))for(const g in v)l({context:v[g],base:f})}return Eo}var So,Wl;function Cp(){return Wl||(Wl=1,So=Ma().NQuads),So}var Ro,Xl;function Ii(){if(Xl)return Ro;Xl=1;const r=bt(),{isArray:e}=dt(),{asArray:t}=ft(),i={};Ro=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},Ro}var Io,Ql;function fr(){if(Ql)return Io;Ql=1;const r=ft(),e=bt(),{isArray:t,isObject:i,isString:n,isUndefined:o}=dt(),{isAbsolute:a,isRelative:s,prependBase:d}=Jt(),{handleEvent:l}=Ii(),{REGEX_BCP47:c,REGEX_KEYWORD:f,asArray:v,compareShortestLeast:g}=ft(),y=new Map,k=1e4,x={};Io=x,x.process=async({activeCtx:m,localCtx:u,options:b,propagate:R=!0,overrideProtected:L=!1,cycles:T=new Set})=>{if(i(u)&&"@context"in u&&t(u["@context"])&&(u=u["@context"]),v(u).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:u,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:u});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:u});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:u});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:u});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:u,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:u,term:b})}R.set(b,!1);let B;if(u.hasOwnProperty(b)&&(B=u[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:u,term:b})}else{if(x.isKeyword(b))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:u,term:b});if(b.match(f)){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:u})}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:u});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:u});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:u});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:u});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:u});if(N.match(f)){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},u,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:u});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:u});if(N===null)q["@id"]=null;else if(!x.isKeyword(N)&&N.match(f)){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},u,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:u});if(b.match(/(?::[^:])|\//)){const Z=new Map(R).set(b,!0);if(_(m,b,{vocab:!0,base:!1},u,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:u})}q["@id"]=N,q._prefix=$&&!q._termHasColon&&N.match(/[:\/\?#\[\]@]$/)!==null}}if(!("@id"in q))if(q._termHasColon){const N=b.substr(0,j);if(u.hasOwnProperty(N)&&x.createTermDefinition({activeCtx:m,localCtx:u,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:u,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:u});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:u})}else if(N!=="@id"&&N!=="@vocab"){if(N=_(m,N,{vocab:!0,base:!1},u,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:u});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:u})}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:u})}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:u})}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:u})}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:u});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:u});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:u});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:u});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:u});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:u});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:u});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:u})}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:u});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:u});q["@nest"]=N}// disallow aliasing @context and @preserve
346
- 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:u});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:u,term:b})},x.expandIri=(m,u,b,R)=>_(m,u,b,void 0,void 0,R);function _(m,u,b,R,L,T){if(u===null||!n(u)||x.isKeyword(u))return u;if(u.match(f))return null;if(R&&R.hasOwnProperty(u)&&L.get(u)!==!0&&x.createTermDefinition({activeCtx:m,localCtx:R,term:u,defined:L,options:T}),b=b||{},b.vocab){const I=m.mappings.get(u);if(I===null)return null;if(i(I)&&"@id"in I)return I["@id"]}const B=u.indexOf(":");if(B>0){const I=u.substr(0,B),$=u.substr(B+1);if(I==="_"||$.indexOf("//")===0)return u;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(u))return u}if(b.vocab&&"@vocab"in m)u=m["@vocab"]+u;else if(b.base){let I,$;"@base"in m?m["@base"]?($=d(T.base,m["@base"]),I=d($,u)):($=m["@base"],I=u):($=T.base,I=d(T.base,u)),u=I}return u}x.getInitialContext=m=>{const u=JSON.stringify({processingMode:m.processingMode}),b=y.get(u);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(u,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,u,b)=>{if(u===null)return b==="@context"?void 0:null;if(m.mappings.has(u)){const R=m.mappings.get(u);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,u)=>u.toString()>="1.1"?!m.processingMode||m.processingMode>="json-ld-"+u.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,u){if(!(m&&typeof m=="object")||!(u&&typeof u=="object"))return m===u;const b=Array.isArray(m);if(b!==Array.isArray(u))return!1;if(b){if(m.length!==u.length)return!1;for(let T=0;T<m.length;++T)if(!E(m[T],u[T]))return!1;return!0}const R=Object.keys(m),L=Object.keys(u);if(R.length!==L.length)return!1;for(const T in m){let B=m[T],I=u[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 Io}var No,Jl;function $p(){if(Jl)return No;Jl=1;const r=bt(),{isArray:e,isObject:t,isEmptyObject:i,isString:n,isUndefined:o}=dt(),{isList:a,isValue:s,isGraph:d,isSubject:l}=Ft(),{expandIri:c,getContextValue:f,isKeyword:v,process:g,processingMode:y}=fr(),{isAbsolute:k}=Jt(),{REGEX_BCP47:x,REGEX_KEYWORD:_,addValue:E,asArray:m,getValues:u,validateTypeValue:b}=ft(),{handleEvent:R}=Ii(),L={};No=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=f(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=f(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=f(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=u(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"||(f(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=f(A,G,"@context");o(pe)||(re=await g({activeCtx:A,localCtx:pe,propagate:!0,overrideProtected:!0,options:F}));const be=f(A,G,"@container")||[];if(be.includes("@language")&&t(W)){const O=f(re,G,"@direction");z=$(re,W,O,F)}else if(be.includes("@index")&&t(W)){const O=be.includes("@graph"),V=f(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 f(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=f(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=f(A,j,"@language");w!==null&&(Y["@language"]=w);const U=f(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=f(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 No}var To,Kl;function bn(){if(Kl)return To;Kl=1;const{isKeyword:r}=fr(),e=Ft(),t=dt(),i=ft(),n=bt(),o={};return To=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,f)=>{if(t.isArray(a)){for(const k of a)o.createNodeMap(k,s,d,l,void 0,f);return}if(!t.isObject(a)){f&&f.push(a);return}if(e.isValue(a)){if("@type"in a){let k=a["@type"];k.indexOf("_:")===0&&(a["@type"]=k=l.getId(k))}f&&f.push(a);return}else if(f&&e.isList(a)){const k=[];o.createNodeMap(a["@list"],s,d,l,c,k),f.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"]),f&&f.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 u=E[m];for(const b of u){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 f=s[l];for(const v of Object.keys(c).sort())if(r(v)&&v!=="@type")f[v]=i.clone(c[v]);else for(const g of c[v])i.addValue(f,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 f=s[l];f?"@graph"in f||(f["@graph"]=[]):s[l]=f={"@id":l,"@graph":[]};const v=f["@graph"];for(const g of Object.keys(c).sort()){const y=c[g];e.isSubjectReference(y)||v.push(y)}}return s},To}var Ao,Yl;function Fp(){if(Yl)return Ao;Yl=1;const{isSubjectReference:r}=Ft(),{createMergedNodeMap:e}=bn(),t={};return Ao=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},Ao}var jo,Zl;function Pp(){if(Zl)return jo;Zl=1;const r=bt(),e=Ft(),t=dt(),{REGEX_BCP47:i,addValue:n}=ft(),{handleEvent:o}=Ii(),{RDF_LIST:a,RDF_FIRST:s,RDF_REST:d,RDF_NIL:l,RDF_TYPE:c,RDF_JSON_LITERAL:f,XSD_BOOLEAN:v,XSD_DOUBLE:g,XSD_INTEGER:y,XSD_STRING:k}=Ba(),x={};jo=x,x.fromRDF=async(E,m)=>{const{useRdfType:u=!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&&!u&&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,u,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===f){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(u==="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 jo}var Do,ed;function Mp(){return ed||(ed=1,Do=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])},"")+"}"}),Do}var Lo,td;function Bp(){if(td)return Lo;td=1;const{createNodeMap:r}=bn(),{isKeyword:e}=fr(),t=Ft(),i=Mp(),n=bt(),o=dt(),a=ft(),{handleEvent:s}=Ii(),{RDF_FIRST:d,RDF_REST:l,RDF_NIL:c,RDF_TYPE:f,RDF_JSON_LITERAL:v,RDF_LANGSTRING:g,XSD_BOOLEAN:y,XSD_DOUBLE:k,XSD_INTEGER:x,XSD_STRING:_}=Ba(),{isAbsolute:E}=Jt(),m={};Lo=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}u($,I[A],j,B,T)}return $};function u(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=f;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 Lo}var Oo,rd;function qp(){if(rd)return Oo;rd=1;const{isKeyword:r}=fr(),e=Ft(),t=dt(),i=ft(),n=Jt(),o=bt(),{createNodeMap:a,mergeNodeMapGraphs:s}=bn(),d={};Oo=d,d.frameMergedOrDefault=(u,b,R)=>{const L={options:R,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},T=new i.IdentifierIssuer("_:b");a(u,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
347
- return R.link={},x(B,R)},d.frame=(u,b,R,L,T=null)=>{v(R),R=R[0];const B=u.options,I={embed:f(R,B,"embed"),explicit:f(R,B,"explicit"),requireAll:f(R,B,"requireAll")};u.link.hasOwnProperty(u.graph)||(u.link[u.graph]={});const $=u.link[u.graph],q=g(u,b,R,I),A=Object.keys(q).sort();for(const j of A){const te=q[j];if(T===null?u.uniqueEmbeds={[u.graph]:{}}:u.uniqueEmbeds[u.graph]=u.uniqueEmbeds[u.graph]||{},I.embed==="@link"&&j in $){_(L,T,$[j]);continue}const N={"@id":j};if(j.indexOf("_:")===0&&i.addValue(u.bnodeMap,j,N,{propertyIsArray:!0}),$[j]=N,(I.embed==="@first"||I.embed==="@last")&&u.is11)throw new o("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:R});if(!(!u.embedded&&u.uniqueEmbeds[u.graph].hasOwnProperty(j))){if(u.embedded&&(I.embed==="@never"||c(te,u.graph,u.subjectStack))){_(L,T,N);continue}if(u.embedded&&(I.embed=="@first"||I.embed=="@once")&&u.uniqueEmbeds[u.graph].hasOwnProperty(j)){_(L,T,N);continue}if(I.embed==="@last"&&j in u.uniqueEmbeds[u.graph]&&k(u,j),u.uniqueEmbeds[u.graph][j]={parent:L,property:T},u.subjectStack.push({subject:te,graph:u.graph}),j in u.graphMap){let Z=!1,F=null;"@graph"in R?(F=R["@graph"][0],Z=!(j==="@merged"||j==="@default"),t.isObject(F)||(F={})):(Z=u.graph!=="@merged",F={}),Z&&d.frame({...u,graph:j,embedded:!1},Object.keys(u.graphMap[j]).sort(),[F],N,"@graph")}"@included"in R&&d.frame({...u,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(u.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({...u,embedded:!0},[X["@id"]],w,U,"@list"):_(U,"@list",i.clone(X))}else e.isSubjectReference(F)?d.frame({...u,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(!f(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(u.subjects))i.getValues(u.subjects[Y],Z).some(U=>U["@id"]===j)&&(N["@reverse"]=N["@reverse"]||{},i.addValue(N["@reverse"],Z,[],{propertyIsArray:!0}),d.frame({...u,embedded:!0},[Y],F,N["@reverse"][Z],T))}_(L,T,N),u.subjectStack.pop()}}},d.cleanupNull=(u,b)=>{if(t.isArray(u))return u.map(L=>d.cleanupNull(L,b)).filter(L=>L);if(u==="@null")return null;if(t.isObject(u)){if("@id"in u){const R=u["@id"];if(b.link.hasOwnProperty(R)){const L=b.link[R].indexOf(u);if(L!==-1)return b.link[R][L];b.link[R].push(u)}else b.link[R]=[u]}for(const R in u)u[R]=d.cleanupNull(u[R],b)}return u};function l(u){const b={};for(const R in u)u[R]!==void 0&&(b["@"+R]=[u[R]]);return[b]}function c(u,b,R){for(let L=R.length-1;L>=0;--L){const T=R[L];if(T.graph===b&&T.subject["@id"]===u["@id"])return!0}return!1}function f(u,b,R){const L="@"+R;let T=L in u?u[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:u})}return T}function v(u){if(!t.isArray(u)||u.length!==1||!t.isObject(u[0]))throw new o("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:u});if("@id"in u[0]){for(const b of i.asArray(u[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:u})}if("@type"in u[0]){for(const b of i.asArray(u[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:u})}}function g(u,b,R,L){const T={};for(const B of b){const I=u.graphMap[u.graph][B];y(u,I,R,L)&&(T[B]=I)}return T}function y(u,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(u,N,F,L)))}}else e.isValue(j)?$=q.some(N=>m(j,N)):e.isSubjectReference(j)?$=q.some(N=>E(u,j,N,L)):t.isObject(j)?$=q.length>0:$=!1}}if(!$&&L.requireAll)return!1;B=B||$}return T||B}function k(u,b){const R=u.uniqueEmbeds[u.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)}/**
345
+ */var lo,Al;function Ep(){if(Al)return lo;Al=1;const r=hn(),e=Bc();return lo=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}},lo}const Sp={},Rp=Object.freeze(Object.defineProperty({__proto__:null,default:Sp},Symbol.toStringTag,{value:"Module"})),Ip=ru(Rp);var jl;function Np(){return jl||(jl=1,function(r){const e=Mc(),t=kp(),i=Bc(),n=Ep();let o;try{o=Ip}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.")}}(Zn)),Zn}var co,Dl;function Ma(){return Dl||(Dl=1,co=Np()),co}var uo,Ll;function dt(){if(Ll)return uo;Ll=1;const r={};return uo=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",uo}var fo,Ol;function Ft(){if(Ol)return fo;Ol=1;const r=dt(),e={};return fo=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},fo}var po,Cl;function bt(){return Cl||(Cl=1,po=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}}),po}var ho,$l;function ft(){if($l)return ho;$l=1;const r=Ft(),e=dt(),t=Ma().IdentifierIssuer,i=bt(),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={};ho=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 ho}var bo,Fl;function Ba(){if(Fl)return bo;Fl=1;const r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",e="http://www.w3.org/2001/XMLSchema#";return bo={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"},bo}var mo,Pl;function qc(){return Pl||(Pl=1,mo=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]}}}),mo}var go,Ml;function Jt(){if(Ml)return go;Ml=1;const r=dt(),e={};go=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),go}var vo,Bl;function Tp(){if(Bl)return vo;Bl=1;const{parseLinkHeader:r,buildHeaders:e}=ft(),{LINK_HEADER_CONTEXT:t}=Ba(),i=bt(),n=qc(),{prependBase:o}=Jt(),a=/(^|(\r\n))link:/i;vo=({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 vo}var yo,ql;function Ap(){if(ql)return yo;ql=1;const r=Tp(),e={};return yo=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})},yo}var wo,zl;function jp(){return zl||(zl=1,wo=function(r){r.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),wo}var xo,Ul;function Dp(){if(Ul)return xo;Ul=1,xo=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{jp()(r)}catch{}return xo}var _o,Hl;function zc(){if(Hl)return _o;Hl=1;const r=Dp(),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 _o=v,_o}var ko,Gl;function Lp(){if(Gl)return ko;Gl=1;const r=zc(),e=10;return ko=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)}},ko}var Eo,Vl;function Op(){if(Vl)return Eo;Vl=1;const{isArray:r,isObject:e,isString:t}=dt(),{asArray:i}=ft(),{prependBase:n}=Jt(),o=bt(),a=Lp(),s=10;Eo=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 Eo}var So,Wl;function Cp(){return Wl||(Wl=1,So=Ma().NQuads),So}var Ro,Xl;function Ni(){if(Xl)return Ro;Xl=1;const r=bt(),{isArray:e}=dt(),{asArray:t}=ft(),i={};Ro=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},Ro}var Io,Ql;function fr(){if(Ql)return Io;Ql=1;const r=ft(),e=bt(),{isArray:t,isObject:i,isString:n,isUndefined:o}=dt(),{isAbsolute:a,isRelative:s,prependBase:d}=Jt(),{handleEvent:l}=Ni(),{REGEX_BCP47:c,REGEX_KEYWORD:u,asArray:v,compareShortestLeast:g}=ft(),y=new Map,k=1e4,x={};Io=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
346
+ 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 Io}var No,Jl;function $p(){if(Jl)return No;Jl=1;const r=bt(),{isArray:e,isObject:t,isEmptyObject:i,isString:n,isUndefined:o}=dt(),{isList:a,isValue:s,isGraph:d,isSubject:l}=Ft(),{expandIri:c,getContextValue:u,isKeyword:v,process:g,processingMode:y}=fr(),{isAbsolute:k}=Jt(),{REGEX_BCP47:x,REGEX_KEYWORD:_,addValue:E,asArray:m,getValues:f,validateTypeValue:b}=ft(),{handleEvent:R}=Ni(),L={};No=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 No}var To,Kl;function bn(){if(Kl)return To;Kl=1;const{isKeyword:r}=fr(),e=Ft(),t=dt(),i=ft(),n=bt(),o={};return To=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},To}var Ao,Yl;function Fp(){if(Yl)return Ao;Yl=1;const{isSubjectReference:r}=Ft(),{createMergedNodeMap:e}=bn(),t={};return Ao=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},Ao}var jo,Zl;function Pp(){if(Zl)return jo;Zl=1;const r=bt(),e=Ft(),t=dt(),{REGEX_BCP47:i,addValue:n}=ft(),{handleEvent:o}=Ni(),{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={};jo=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 jo}var Do,ed;function Mp(){return ed||(ed=1,Do=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])},"")+"}"}),Do}var Lo,td;function Bp(){if(td)return Lo;td=1;const{createNodeMap:r}=bn(),{isKeyword:e}=fr(),t=Ft(),i=Mp(),n=bt(),o=dt(),a=ft(),{handleEvent:s}=Ni(),{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}=Jt(),m={};Lo=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 Lo}var Oo,rd;function qp(){if(rd)return Oo;rd=1;const{isKeyword:r}=fr(),e=Ft(),t=dt(),i=ft(),n=Jt(),o=bt(),{createNodeMap:a,mergeNodeMapGraphs:s}=bn(),d={};Oo=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
347
+ 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)}/**
348
348
  * Removes the @preserve keywords from expanded result of framing.
349
349
  *
350
350
  * @param input the framed, framed output.
351
351
  * @param options the framing options used.
352
352
  *
353
353
  * @return the resulting output.
354
- */function x(u,b){if(t.isArray(u))return u.map(R=>x(R,b));if(t.isObject(u)){// remove @preserve
355
- if("@preserve"in u)return u["@preserve"][0];if(e.isValue(u))return u;if(e.isList(u))return u["@list"]=x(u["@list"],b),u;if("@id"in u){const R=u["@id"];if(b.link.hasOwnProperty(R)){const L=b.link[R].indexOf(u);if(L!==-1)return b.link[R][L];b.link[R].push(u)}else b.link[R]=[u]}for(const R in u){if(R==="@id"&&b.bnodesToClear.includes(u[R])){delete u["@id"];continue}u[R]=x(u[R],b)}}return u}function _(u,b,R){t.isObject(u)?i.addValue(u,b,R,{propertyIsArray:!0}):u.push(R)}function E(u,b,R,L){if(!("@id"in R))return!1;const T=u.subjects[R["@id"]];return T&&y(u,T,b,L)}function m(u,b){const R=b["@value"],L=b["@type"],T=b["@language"],B=u["@value"]?t.isArray(u["@value"])?u["@value"]:[u["@value"]]:[],I=u["@type"]?t.isArray(u["@type"])?u["@type"]:[u["@type"]]:[],$=u["@language"]?t.isArray(u["@language"])?u["@language"]:[u["@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 Oo}var Co,id;function zp(){if(id)return Co;id=1;const r=bt(),{isArray:e,isObject:t,isString:i,isUndefined:n}=dt(),{isList:o,isValue:a,isGraph:s,isSimpleGraph:d,isSubjectReference:l}=Ft(),{expandIri:c,getContextValue:f,isKeyword:v,process:g,processingMode:y}=fr(),{removeBase:k,prependBase:x}=Jt(),{REGEX_KEYWORD:_,addValue:E,asArray:m,compareShortestLeast:u}=ft(),b={};Co=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&&(f(T,B,"@container")||[]).length===0&&(A=A[0]),A}const q=f(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)&&(f(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=f(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=f(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=(f(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=(f(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((f(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=f(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=f(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||u(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=f(T,B,"@type"),N=f(T,B,"@language"),Z=f(T,B,"@direction"),F=f(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=f(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 Co}var $o,nd;function Up(){return nd||(nd=1,$o=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}),$o}/**
354
+ */function x(f,b){if(t.isArray(f))return f.map(R=>x(R,b));if(t.isObject(f)){// remove @preserve
355
+ 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 Oo}var Co,id;function zp(){if(id)return Co;id=1;const r=bt(),{isArray:e,isObject:t,isString:i,isUndefined:n}=dt(),{isList:o,isValue:a,isGraph:s,isSimpleGraph:d,isSubjectReference:l}=Ft(),{expandIri:c,getContextValue:u,isKeyword:v,process:g,processingMode:y}=fr(),{removeBase:k,prependBase:x}=Jt(),{REGEX_KEYWORD:_,addValue:E,asArray:m,compareShortestLeast:f}=ft(),b={};Co=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 Co}var $o,nd;function Up(){return nd||(nd=1,$o=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}),$o}/**
356
356
  * A JavaScript implementation of the JSON-LD API.
357
357
  *
358
358
  * @author Dave Longley
@@ -386,20 +386,20 @@ if("@preserve"in u)return u["@preserve"][0];if(e.isValue(u))return u;if(e.isList
386
386
  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
387
387
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
388
388
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
389
- */var Fo,od;function Hp(){if(od)return Fo;od=1;const r=Ma(),e=Ap(),t=ft(),i=Op(),n=t.IdentifierIssuer,o=bt(),a=Uc(),s=Cp(),{expand:d}=$p(),{flatten:l}=Fp(),{fromRDF:c}=Pp(),{toRDF:f}=Bp(),{frameMergedOrDefault:v,cleanupNull:g}=qp(),{isArray:y,isObject:k,isString:x}=dt(),{isSubjectReference:_}=Ft(),{expandIri:E,getInitialContext:m,process:u,processingMode:b}=fr(),{compact:R,compactIri:L}=zp(),{createNodeMap:T,createMergedNodeMap:B,mergeNodeMaps:I}=bn(),{logEventHandler:$,logWarningEventHandler:q,safeEventHandler:A,setDefaultEventHandler:j,setupEventHandler:te,strictEventHandler:N,unhandledEventHandler:Z}=Ii(),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 u({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=f(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}),u({activeCtx:H,localCtx:G,options:W}))},w.getContextValue=fr().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=Jt(),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=Up()(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),Fo=Y,Fo}var Gp=Hp();const Po={},Mo={};class Vp{constructor(e){this.loadedExternalUrls=[],this.config=e}async loadGraphs(){this.loadedExternalUrls=[],this.config.prefixes={};const e=[],t=new et;if(e.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?this.fetchRDF(this.config.attributes.shapesUrl):"",t,Rr)),e.push(this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?this.fetchRDF(this.config.attributes.valuesUrl):"",t,At)),await Promise.all(e),await this.fetchOwlImports(t),await this.fetchClassInstances(t),t.countQuads(null,null,null,Rr)===0){const i=new Set;this.config.attributes.valuesSubject&&t.forObjects(o=>i.add(o),this.config.attributes.valuesSubject,aa,At),this.config.attributes.shapeSubject&&i.add(Re.namedNode(this.config.attributes.shapeSubject));const 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(this.fetchRDF(a),t,Rr)))}try{await Promise.allSettled(n)}catch(o){console.warn(o)}}this.config.store=t}async importRDF(e,t,i){const n=async o=>{const a=[];await new Promise((s,d)=>{const l=ad(o)==="xml"?new xp.RdfXmlParser:new Tu;l.on("data",c=>{t.add(new on(c.subject,c.predicate,c.object,i))}).on("error",c=>{console.warn("failed parsing graph",i,c.message),d(c)}).on("prefix",(c,f)=>{c&&(this.config.prefixes[c]=f)}).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(ad(e)==="json")try{e=await Gp.toRDF(JSON.parse(e),{format:"application/n-quads"})}catch(o){console.error(o)}await n(e)}}async fetchRDF(e){if(e in Po)return console.log("--- cache hit",e),Po[e];let t=e;this.config.attributes.proxy&&(t=this.config.attributes.proxy+encodeURIComponent(e));const i=fetch(t,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then(n=>n.text());return Po[e]=i,i}async fetchOwlImports(e){if(this.config.attributes.ignoreOwlImports===null){const t=new Set;e.forObjects(n=>{t.add(n.value)},null,Ea,null);const i=[];for(const n of t){const o=this.toURL(n);o&&i.push(this.importRDF(this.fetchRDF(o),e,Re.namedNode(o)))}return Promise.allSettled(i)}}async fetchClassInstances(e){if(this.config.classInstanceProvider){const t=new Set;e.forObjects(n=>{t.add(n.value)},null,Sa,null),e.forObjects(n=>{e.forObjects(o=>{t.add(o.value)},n,Ir,null)},null,dc,null);const i=[];for(const n of t){let o;n in Mo?(console.log("--- class cache hit",n),o=Mo[n]):(o=this.config.classInstanceProvider(n),Mo[n]=o),i.push(this.importRDF(o,e,Rr))}return Promise.all(i)}}toURL(e){if(la(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),la(e)))return e}}return null}}function ad(r){return/^\s*\{/.test(r)?"json":/^\s*<\?xml/.test(r)?"xml":"ttl"}class Bo{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.proxy=null,this.ignoreOwlImports=null,this.collapse=null,this.submitButton=null,this.generateNodeShapeReference=null,this.showNodeIds=null}}class sd{constructor(e,t){this.attributes=new Bo,this.loader=new Vp(this),this.prefixes={},this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new et,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 Bo;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=Re.namedNode(t.valuesGraph))}static dataAttributes(){const e=new Bo;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)},tt,`${_e}PropertyGroup`,null)}}function Wp(r){return"_:"+r.value}function Xp(r,e){return[...r].map(t=>e(t)).join(`
389
+ */var Fo,od;function Hp(){if(od)return Fo;od=1;const r=Ma(),e=Ap(),t=ft(),i=Op(),n=t.IdentifierIssuer,o=bt(),a=zc(),s=Cp(),{expand:d}=$p(),{flatten:l}=Fp(),{fromRDF:c}=Pp(),{toRDF:u}=Bp(),{frameMergedOrDefault:v,cleanupNull:g}=qp(),{isArray:y,isObject:k,isString:x}=dt(),{isSubjectReference:_}=Ft(),{expandIri:E,getInitialContext:m,process:f,processingMode:b}=fr(),{compact:R,compactIri:L}=zp(),{createNodeMap:T,createMergedNodeMap:B,mergeNodeMaps:I}=bn(),{logEventHandler:$,logWarningEventHandler:q,safeEventHandler:A,setDefaultEventHandler:j,setupEventHandler:te,strictEventHandler:N,unhandledEventHandler:Z}=Ni(),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=fr().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=Jt(),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=qc(),w.JsonLdProcessor=Up()(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),Fo=Y,Fo}var Gp=Hp();const Po={},Mo={};class Vp{constructor(e){this.loadedExternalUrls=[],this.loadedClasses=[],this.config=e}async loadGraphs(){this.loadedExternalUrls=[],this.loadedClasses=[],this.config.prefixes={};const e=[],t=new et;if(e.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?this.fetchRDF(this.config.attributes.shapesUrl):"",t,bi)),e.push(this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?this.fetchRDF(this.config.attributes.valuesUrl):"",t,At)),await Promise.all(e),t.countQuads(null,null,null,bi)===0&&this.config.attributes.valuesSubject){const i=[...t.getObjects(this.config.attributes.valuesSubject,aa,At)],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(this.fetchRDF(a),t,bi)))}try{await Promise.allSettled(n)}catch(o){console.warn(o)}}this.config.store=t}async importRDF(e,t,i){const n=async o=>{const a=[];await new Promise((s,d)=>{const l=ad(o)==="xml"?new xp.RdfXmlParser:new Nu;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(this.fetchRDF(u),t,Re.namedNode(u))))}if(this.config.classInstanceProvider&&(Sa.equals(c.predicate)||Rr.equals(c.predicate))){const u=c.object.value;if(this.loadedClasses.indexOf(u)<0){let v;u in Mo?v=Mo[u]:(v=this.config.classInstanceProvider(u),Mo[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(ad(e)==="json")try{e=await Gp.toRDF(JSON.parse(e),{format:"application/n-quads"})}catch(o){console.error(o)}await n(e)}}toURL(e){if(la(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),la(e)))return e}}return null}async fetchRDF(e){if(e in Po)return Po[e];let t=e;this.config.attributes.proxy&&(t=this.config.attributes.proxy+encodeURIComponent(e));const i=fetch(t,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then(n=>n.text());return Po[e]=i,i}}function ad(r){return/^\s*\{/.test(r)?"json":/^\s*<\?xml/.test(r)?"xml":"ttl"}class Bo{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.proxy=null,this.ignoreOwlImports=null,this.collapse=null,this.submitButton=null,this.generateNodeShapeReference=null,this.showNodeIds=null}}class sd{constructor(e,t){this.attributes=new Bo,this.loader=new Vp(this),this.prefixes={},this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new et,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 Bo;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=Re.namedNode(t.valuesGraph))}static dataAttributes(){const e=new Bo;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,{ignoreErrors:!0}),this.groups=[],e.forSubjects(t=>{this.groups.push(t.id)},tt,`${_e}PropertyGroup`,null)}}function Wp(r){return"_:"+r.value}function Xp(r,e){return[...r].map(t=>e(t)).join(`
390
390
  `)+`
391
- `}function Qp(){return""}function Hc(r){return"<"+r.value+">"}const Jp=/["\\\\\n\r]/,Kp=/["\\\\\n\r]/g,Yp={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function Zp(r){return Yp[r]}function eh(r){return Jp.test(r)?r.replace(Kp,Zp):r}function th(r){const e=eh(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 rh(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 ih(r){return"?"+r.value}function st(r){if(!r)return null;if(r.termType==="BlankNode")return Wp(r);if(r.termType==="DefaultGraph")return Qp();if(r.termType==="Literal")return th(r);if(r.termType==="NamedNode")return Hc(r);if(r.termType==="Quad"||r.subject&&r.predicate&&r.object&&r.graph)return rh(r,st);if(r.termType==="Variable")return ih(r);if(r[Symbol.iterator])return Xp(r,st);throw new Error(`unknown termType ${r.termType}`)}class $r{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 ld{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 dd(r){try{return st(r)}catch{return null}}class pt{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(dd(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(dd(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 cd(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 nh=new Ni("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),ud=new Ni("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),oh=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,ud):typeof t?.language=="string"?new Qi(e,t.language,t.direction?nh:ud,t.direction):new Qi(e,"",t||oh)}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 cd(this,e)}fromQuad(e){return cd(this,e)}}Wc.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const Ua=new Wc,ah={apply:(r,e,t)=>r(t[0]),get:(r,e)=>r(e)};function mt(r,{factory:e=Ua}={}){const t=(i="")=>e.namedNode(`${r}${i.raw||i}`);return typeof Proxy>"u"?t:new Proxy(t,ah)}mt("http://www.w3.org/2001/XMLSchema#");const _t=mt("http://www.w3.org/1999/02/22-rdf-syntax-ns#");mt("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 ld({dataset:e.dataset,start:t,end:i,quad:c}))});for(const c of n)for(const f of o)for(const v of a)for(const g of s){const y={subject:c,predicate:f,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]||_t.nil,a));for(let d=0;d<s.length;d++)e.dataset.add(e.factory.quad(s[d],_t.first,i[d],a)),e.dataset.add(e.factory.quad(s[d],_t.rest,s[d+1]||_t.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 f of c)e.dataset.delete(f)}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);!_t.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:f}={}){if(t==="add")return $e.add({ptr:e,start:n,end:o,subjects:a,predicates:s,objects:d,graphs:l,callback:f});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:!!(_t.nil.equals(e.term)||$e.traverse({ptr:e,predicates:[_t.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(_t.nil);){const t=e.out([_t.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const i=e.out([_t.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,f;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})];f&&(c=c.filter(v=>!f.has(v.term))),e=c,l=[...l,...c],f=new pt(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 f of o)for(const v of a)for(const g of s){const y={subject:c,predicate:f,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 ld({dataset:e.dataset,end:i,quad:k,start:t}),e))}return l}}function fd(r,e){return e?t=>e(r.extend(t)):()=>{}}class pd{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:fd(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:fd(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 hd(r,e){return r?r.equals(e):r===e}function sh(r,e){return!(r.dataset!==e.dataset||!hd(r.graph,e.graph)||!hd(r.term,e.term))}function bd(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 pd({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 pt(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=bd(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=bd(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=>sh(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 pd({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]})}}mt("http://www.w3.org/2002/07/owl#");const pr=mt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),lh=mt("http://www.w3.org/2000/01/rdf-schema#"),ae=mt("http://www.w3.org/ns/shacl#"),pa=mt("https://schemas.link/shacl-next#"),Ha=mt("http://www.w3.org/2001/XMLSchema#");function dh(r){return r?`{${[...r.quads()].map(e=>st(e)).join(" ")}}`:"{}"}function ch(r){return r?`{${r.map(e=>dh(e)).join(" ")}}`:"{}"}var qo,md;function uh(){if(md)return qo;md=1;var r=/\s/;function e(t){for(var i=t.length;i--&&r.test(t.charAt(i)););return i}return qo=e,qo}var zo,gd;function fh(){if(gd)return zo;gd=1;var r=uh(),e=/^\s+/;function t(i){return i&&i.slice(0,r(i)+1).replace(e,"")}return zo=t,zo}var Uo,vd;function ph(){if(vd)return Uo;vd=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return Uo=r,Uo}var Ho,yd;function hh(){if(yd)return Ho;yd=1;var r=typeof Er=="object"&&Er&&Er.Object===Object&&Er;return Ho=r,Ho}var Go,wd;function bh(){if(wd)return Go;wd=1;var r=hh(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Go=t,Go}var Vo,xd;function Xc(){if(xd)return Vo;xd=1;var r=bh(),e=r.Symbol;return Vo=e,Vo}var Wo,_d;function mh(){if(_d)return Wo;_d=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 Wo=o,Wo}var Xo,kd;function gh(){if(kd)return Xo;kd=1;var r=Object.prototype,e=r.toString;function t(i){return e.call(i)}return Xo=t,Xo}var Qo,Ed;function vh(){if(Ed)return Qo;Ed=1;var r=Xc(),e=mh(),t=gh(),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 Qo=a,Qo}var Jo,Sd;function yh(){if(Sd)return Jo;Sd=1;function r(e){return e!=null&&typeof e=="object"}return Jo=r,Jo}var Ko,Rd;function wh(){if(Rd)return Ko;Rd=1;var r=vh(),e=yh(),t="[object Symbol]";function i(n){return typeof n=="symbol"||e(n)&&r(n)==t}return Ko=i,Ko}var Yo,Id;function xh(){if(Id)return Yo;Id=1;var r=fh(),e=ph(),t=wh(),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 f=o.test(l);return f||a.test(l)?s(l.slice(2),f?2:8):n.test(l)?i:+l}return Yo=d,Yo}var Zo,Nd;function _h(){if(Nd)return Zo;Nd=1;var r=xh(),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 Zo=i,Zo}var ea,Td;function kh(){if(Td)return ea;Td=1;var r=_h();function e(t){var i=r(t),n=i%1;return i===i?n?i-n:i:0}return ea=e,ea}var ta,Ad;function Eh(){if(Ad)return ta;Ad=1;var r=kh(),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 ta=t,ta}var ra,jd;function Sh(){if(jd)return ra;jd=1;var r=Eh();function e(t){return r(2,t)}return ra=e,ra}var Rh=Sh();const yt=ru(Rh);let Dd=class{constructor({details:e,factory:t,options:i,results:n=[]}={}){this.details=e,this.factory=t,this.options=i,this.results=n,this._conforms=yt(()=>!this.results.some(o=>o.severity.equals(ae.Info)||o.severity.equals(ae.Violation)||o.severity.equals(ae.Warning))),this._ptr=yt(()=>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([pr.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 Ih(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 Nh=class{constructor({args:e={},constraintComponent:t,factory:i,focusNode:n,message:o=[],path:a,results:s=[],severity:d,shape:l,source:c=[],value:f,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=f,this.valuePaths=v,this._message=yt(()=>(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(Ih(g.value,e),g.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([pr.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 Dd({factory:e,options:i}),results:a=new Map,shape:s,value:d,valueOrNode:l,valuePaths:c,values:f}={}){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=f}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 Dd({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)} - ${ch(this.valuePaths)}`}result(e){const t=new Nh({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 Th(){return{generic:Ah()}}function Ah(){return r=>{r.trace(pa.TraversalConstraintComponent,{args:{},message:[r.factory.literal("Traversal")],value:r.valueOrNode})}}class jh{constructor(e){this.validations=new $r(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(Th),[...n].map(o=>o(e)).filter(Boolean)}}var nr={},or={},oi={},ai={},Ld;function Dr(){if(Ld)return ai;Ld=1,Object.defineProperty(ai,"__esModule",{value:!0}),ai.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 ai.Translator=r,ai}var Od;function Dh(){if(Od)return oi;Od=1,Object.defineProperty(oi,"__esModule",{value:!0}),oi.TypeHandlerBoolean=void 0;const r=Dr();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 oi.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",oi}var si={},Cd;function Lh(){if(Cd)return si;Cd=1,Object.defineProperty(si,"__esModule",{value:!0}),si.TypeHandlerDate=void 0;const r=Dr();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 si.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]$/},si}var li={},$d;function Oh(){if($d)return li;$d=1,Object.defineProperty(li,"__esModule",{value:!0}),li.TypeHandlerNumberDouble=void 0;const r=Dr();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 li.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"],li}var di={},Fd;function Ch(){if(Fd)return di;Fd=1,Object.defineProperty(di,"__esModule",{value:!0}),di.TypeHandlerNumberInteger=void 0;const r=Dr();let e=class hi{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<=hi.MAX_INT&&i>=hi.MIN_INT?o.namedNode(hi.TYPES[0]):o.namedNode(hi.TYPES[1])))}};return di.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,di}var ci={},Pd;function $h(){if(Pd)return ci;Pd=1,Object.defineProperty(ci,"__esModule",{value:!0}),ci.TypeHandlerString=void 0;let r=class{fromRdf(t){return t.value}toRdf(t,{datatype:i,dataFactory:n}){return n.literal(t,i)}};return ci.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"],ci}var Md;function Bd(){return Md||(Md=1,function(r){var e=or&&or.__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=or&&or.__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(Dh(),r),t(Lh(),r),t(Oh(),r),t(Ch(),r),t($h(),r)}(or)),or}var ia={},qd;function Fh(){return qd||(qd=1,Object.defineProperty(ia,"__esModule",{value:!0})),ia}var zd;function Ph(){return zd||(zd=1,function(r){var e=nr&&nr.__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=nr&&nr.__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=f,r.getSupportedJavaScriptPrimitives=v;const i=Fc(),n=Bd(),o=Dr();t(Bd(),r),t(Fh(),r),t(Dr(),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 f(){return s.getSupportedRdfDatatypes()}function v(){return s.getSupportedJavaScriptPrimitives()}}(nr)),nr}var ki=Ph();function Ud(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 Mh(r){return r.terms.length===0?null:r.ptrs[0].isList()?[...r.list()].map(e=>Ud(e)):[Ud(r)]}class Bh{constructor(e){this.shape=e,this._compiled=yt(()=>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 pt(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 $r).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 pt,i=new tn({dataset:r.dataset,terms:r.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[lh.subClassOf]});for(const n of i.ptrs)for(const{term:o}of n.nodes())e.add(o);return e}class qh{constructor(e){this.targetClass=new pt([...ba(e.hasOut([pr.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([pr.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 pt(n.terms)])}}class zh{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=yt(()=>{const i=this.ptr.out([ae.deactivated]).term;return i&&ki.fromRdf(i)}),this._message=yt(()=>this.ptr.out([ae.message]).terms),this._path=yt(()=>Mh(this.ptr.out([ae.path]))),this._severity=yt(()=>this.ptr.out([ae.severity]).term),this._shapeValidator=yt(()=>new Bh(this)),this._sparql=yt(()=>this.ptr.out([ae.sparql])),this._targetResolver=yt(()=>new qh(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 Uh(r){const e=parseInt(r.ptr.out([ae.maxCount]).value);return{property:Hh(e)}}function Hh(r){return e=>{e.test(e.values.terms.length<=r,ae.MaxCountConstraintComponent,{args:{maxCount:r},message:[e.factory.literal("More than {$maxCount} values")]})}}function Gh(r){const e=parseInt(r.ptr.out([ae.minCount]).value);return{property:Vh(e)}}function Vh(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 Wh(r,e){for(const t of r)if(!await e(t))return!1;return!0}async function Xh(r,e){return(await Promise.all(r.map(t=>e(t)))).filter(Boolean)}async function mn(r,e){return Promise.all(r.map(e))}async function Qh(r,e){for(const t of r)if(await e(t))return!0;return!1}function Jh(r){const e=[...r.ptr.out([ae.and])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Kh(e)}}function Kh(r){return async e=>{const t=await mn(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 Yh(r){const e=r.validator.shape(r.ptr.out([ae.not]));return{generic:Zh(e)}}function Zh(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 eb(r){const e=[...r.ptr.out([ae.or])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:tb(e)}}function tb(r){return async e=>{let t=[],i;if(e.options.debug||e.options.details){const n=await mn(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 Qh(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 rb(r){const e=[...r.ptr.out([ae.xone])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:ib(e)}}function ib(r){return async e=>{const t=await mn(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 nb(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 pt(t.filter(o=>!o.deactivated).map(o=>o.path[0].predicates[0])),n=new pt([...r.ptr.out([ae.ignoredProperties]).list()||[]].map(o=>o.term));return{node:ob(i,n)}}function ob(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 ab(r){const e=r.ptr.out([ae.hasValue]).term;return{node:sb(e),property:lb(e)}}function sb(r){return e=>{e.test(r.equals(e.valueOrNode.term),ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Value must be {$hasValue}")]})}}function lb(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 db(r){const e=new pt([...r.ptr.out([ae.in]).list()].map(t=>t.term));return{generic:cb(e)}}function cb(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 Fr(r,e){if(!r||r.termType!=="Literal"||!e||e.termType!=="Literal"||Hd(r)!==Hd(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 Hd(r){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return Ha.dateTime.equals(r.datatype)&&e.test(r.value)}function ub(r){const e=r.ptr.out([ae.disjoint]).term;return{generic:fb(e)}}function fb(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 pb(r){const e=r.ptr.out([ae.equals]).term;return{node:hb(e),property:bb(e)}}function hb(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 bb(r){return e=>{const t=new pt(e.focusNode.out([r]).terms),i=new pt(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 mb(r){const e=r.ptr.out([ae.lessThan]).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=Fr(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 vb(r){const e=r.ptr.out([ae.lessThanOrEquals]).term;return{property:yb(e)}}function yb(r){return e=>{const t=e.focusNode.out([r]).terms;for(const i of e.values)for(const n of t){const o=Fr(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 wb(r){const e=r.ptr.out([ae.maxExclusive]).term;return{generic:xb(e)}}function xb(r){return e=>{const t=Fr(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 _b(r){const e=r.ptr.out([ae.maxInclusive]).term;return{generic:kb(e)}}function kb(r){return e=>{const t=Fr(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 Eb(r){const e=r.ptr.out([ae.minExclusive]).term;return{generic:Sb(e)}}function Sb(r){return e=>{const t=Fr(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 Rb(r){const e=r.ptr.out([ae.minInclusive]).term;return{generic:Ib(e)}}function Ib(r){return e=>{const t=Fr(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 Nb(r){const e=[...r.ptr.out([ae.node])].map(t=>r.validator.shape(t));return{generic:Tb(e)}}function Tb(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 Ab(r){const e=[...r.ptr.out([ae.property])].map(t=>r.validator.shape(t));return{generic:jb(e)}}function jb(r){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const i of r)await i.validate(t)}}function Db(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:Lb(e,i,o,s)}}function Lb(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 Xh(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 mn([...a],async f=>(await f.validate(n.create({child:!0,focusNode:d}))).report);return o.push(c.flatMap(f=>f.results)),!c.every(f=>f.conforms)}else return!await Wh([...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 Ob(r,e){return e?e.slice(0,r.length)===r:!1}function Cb(r){const e=[...new Set([...r.ptr.out([ae.languageIn]).list()].map(t=>t.value))];return{generic:$b(e)}}function $b(r){return e=>{const t=r.some(i=>Ob(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 Fb(r){const e=parseInt(r.ptr.out([ae.maxLength]).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.MaxLengthConstraintComponent,{args:{maxLength:r},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})}}function Mb(r){const e=parseInt(r.ptr.out([ae.minLength]).value);return{generic:Bb(e)}}function Bb(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 qb(r){const e=r.ptr.out([ae.pattern]).value,t=r.ptr.out([ae.flags]).value,i=new RegExp(e,t);return{generic:zb(e,t,i)}}function zb(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 Ub(r){const e=r.ptr.out([ae.uniqueLang]).term;return e.value==="true"&&Ha.boolean.equals(e.datatype)?{property:Hb()}:null}function Hb(){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=mt("http://www.w3.org/ns/shacl#"),Kc=mt("https://schemas.link/shacl-next#");class Lr{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 Gb(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(Gb(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 Lr}validateSimple(){return!0}}class Pr 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 Pr({datatypes:this.datatypes,factory:e||this.factory})}}class Vb{constructor({factory:e=Ua,validations:t}={}){if(this.factory=e,this.validations=new $r,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 Lr}validateSimple(e){const t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}}class Pe extends Pr{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 Lr({results:t})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}}const Wb=/^([-+]?[0-9]+)$/;class ot extends Pe{constructor(e=null,t=null,i,{factory:n}={}){super(Wb,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 Lr({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 Lr({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 Pr{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 Lr({results:t})}validateSimple(e){return this.values.has(e.value)}}const Ne={xsd:mt("http://www.w3.org/2001/XMLSchema#")},Xb=new Pr({datatypes:Ne.xsd.anySimpleType}),Qb=new Pr({datatypes:Ne.xsd.anyAtomicType}),gn=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,Jb=/^((\+|-)?([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))?)$/,Kb=/^((([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))?)$/,Yb=/^(-?([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))?)$/,Zb=/^(-?([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))?)$/,em=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,tm=/^(--(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))?)$/,rm=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,im=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,nm=/^(([0-9a-fA-F]{2})*)$/,om=/^(((([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] ?= ?=))?)$/,am=new Pe(gn,Ne.xsd.string),sm=new Wa(["1","true","0","false"],Ne.xsd.boolean),lm=new Pe(Jb,Ne.xsd.decimal),dm=new Pe(Yc,Ne.xsd.float),cm=new Pe(Yc,Ne.xsd.double),um=new Pe(Xa,Ne.xsd.duration),fm=new Pe(Zc,Ne.xsd.dateTime),pm=new Pe(Kb,Ne.xsd.time),hm=new Pe(Yb,Ne.xsd.date),bm=new Pe(Zb,Ne.xsd.gYearMonth),mm=new Pe(em,Ne.xsd.gYear),gm=new Pe(tm,Ne.xsd.gMonthDay),vm=new Pe(rm,Ne.xsd.gDay),ym=new Pe(im,Ne.xsd.gMonth),wm=new Pe(nm,Ne.xsd.hexBinary),xm=new Pe(om,Ne.xsd.base64Binary),_m=new Pe(gn,Ne.xsd.anyURI),eu=/^([^\u000d\u000a\u0009]*)$/,km=/^([^ ]+( [^ ]+)*)*$/,Em=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,Sm=/^([^DT]*)$/,Rm=/^([^YM]*[DT].*)$/,Im=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Nm=new Pe([gn,eu],Ne.xsd.normalizedString),Tm=new Pe([gn,eu,km],Ne.xsd.token),Am=new Pe(Em,Ne.xsd.language),jm=new ot(null,null,Ne.xsd.integer),Dm=new ot(null,"0",Ne.xsd.nonPositiveInteger),Lm=new ot(null,"-1",Ne.xsd.negativeInteger),Om=new ot("-9223372036854775808","9223372036854775807",Ne.xsd.long),Cm=new ot("-2147483648","2147483647",Ne.xsd.int),$m=new ot("-32768","32767",Ne.xsd.short),Fm=new ot("-128","127",Ne.xsd.byte),Pm=new ot("0",null,Ne.xsd.nonNegativeInteger),Mm=new ot("0","18446744073709551615",Ne.xsd.unsignedLong),Bm=new ot("0","4294967295",Ne.xsd.unsignedInt),qm=new ot("0","65535",Ne.xsd.unsignedShort),zm=new ot("0","255",Ne.xsd.unsignedByte),Um=new ot("1",null,Ne.xsd.positiveInteger),Hm=new Pe([Xa,Sm],Ne.xsd.yearMonthDuration),Gm=new Pe([Xa,Rm],Ne.xsd.dayTimeDuration),Vm=new Pe([Zc,Im],Ne.xsd.dateTimeStamp),Wm=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:Qb,anySimpleType:Xb,anyURI:_m,base64Binary:xm,boolean:sm,byte:Fm,date:hm,dateTime:fm,dateTimeStamp:Vm,dayTimeDuration:Gm,decimal:lm,double:cm,duration:um,float:dm,gDay:vm,gMonth:ym,gMonthDay:gm,gYear:mm,gYearMonth:bm,hexBinary:wm,int:Cm,integer:jm,language:Am,long:Om,negativeInteger:Lm,nonNegativeInteger:Pm,nonPositiveInteger:Dm,normalizedString:Nm,positiveInteger:Um,short:$m,string:am,time:pm,token:Tm,unsignedByte:zm,unsignedInt:Bm,unsignedLong:Mm,unsignedShort:qm,yearMonthDuration:Hm},Symbol.toStringTag,{value:"Module"}));class Xm extends Vb{constructor({factory:e}={}){super({factory:e,validations:{...Wm}})}}const Qm=new $r([[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 Jm(r){const e=r.ptr.out([ae.class]).map(t=>ba(t));return{generic:Km(e)}}function Km(r){return e=>{const t=new pt(e.valueOrNode.out([pr.type]).terms);for(const i of r){const n=[...t].some(o=>i.has(o));e.test(n,ae.ClassConstraintComponent,{value:e.valueOrNode})}}}function Ym(r){const e=r.ptr.out([ae.datatype]).term,t=new Xm;return{generic:Zm(e,t)}}function Zm(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 eg(r){const e=r.ptr.out([ae.nodeKind]).term,t=Qm.get(e);return{generic:tg(e,t)}}function tg(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 rg=new $r([[ae.maxCount,Uh],[ae.minCount,Gh],[ae.and,Jh],[ae.not,Yh],[ae.or,eb],[ae.xone,rb],[ae.closed,nb],[ae.hasValue,ab],[ae.in,db],[ae.disjoint,ub],[ae.equals,pb],[ae.lessThan,mb],[ae.lessThanOrEquals,vb],[ae.maxExclusive,wb],[ae.maxInclusive,_b],[ae.minExclusive,Eb],[ae.minInclusive,Rb],[ae.node,Nb],[ae.property,Ab],[ae.qualifiedValueShape,Db],[ae.languageIn,Cb],[ae.maxLength,Fb],[ae.minLength,Mb],[ae.pattern,qb],[ae.uniqueLang,Ub],[ae.class,Jm],[ae.datatype,Ym],[ae.nodeKind,eg]]);class ig{constructor(e,{factory:t,...i}){if(this.factory=t,this.options=i,this.registry=new jh(rg),this.shapesPtr=new tn({dataset:e,factory:t}),this.shapes=new $r,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([pr.type],[ae.NodeShape]),...this.shapesPtr.hasOut([pr.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 zh(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 ng=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new sd(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 sd.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 Vt(e,this.config,this.config.attributes.valuesSubject?Re.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(Re.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,Rr)>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 et){return this.shape?.toRDF(e),e}registerPlugin(e){Yu(e),this.initialize()}setTheme(e){this.config.theme=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,Re.namedNode(_e+"targetNode"),this.shape.nodeId,this.config.valuesGraphId));try{const t=this.config.store,i=await new ig(t,{details:!0,factory:Re}).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(`
391
+ `}function Qp(){return""}function Uc(r){return"<"+r.value+">"}const Jp=/["\\\\\n\r]/,Kp=/["\\\\\n\r]/g,Yp={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function Zp(r){return Yp[r]}function eh(r){return Jp.test(r)?r.replace(Kp,Zp):r}function th(r){const e=eh(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+'"^^'+Uc(r.datatype)}function rh(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 ih(r){return"?"+r.value}function st(r){if(!r)return null;if(r.termType==="BlankNode")return Wp(r);if(r.termType==="DefaultGraph")return Qp();if(r.termType==="Literal")return th(r);if(r.termType==="NamedNode")return Uc(r);if(r.termType==="Quad"||r.subject&&r.predicate&&r.object&&r.graph)return rh(r,st);if(r.termType==="Variable")return ih(r);if(r[Symbol.iterator])return Xp(r,st);throw new Error(`unknown termType ${r.termType}`)}class Cr{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 ld{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 dd(r){try{return st(r)}catch{return null}}class pt{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(dd(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(dd(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}class Hc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Hc.prototype.termType="BlankNode";class qa{equals(e){return!!e&&e.termType===this.termType}}qa.prototype.termType="DefaultGraph";qa.prototype.value="";function cd(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 Ji{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}}Ji.prototype.termType="Literal";class Ti{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Ti.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 Gc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Gc.prototype.termType="Variable";const nh=new Ti("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),ud=new Ti("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),oh=new Ti("http://www.w3.org/2001/XMLSchema#string");class Vc{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new qa}}namedNode(e){return new Ti(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new Hc(e)}literal(e,t){return typeof t=="string"?new Ji(e,t,ud):typeof t?.language=="string"?new Ji(e,t.language,t.direction?nh:ud,t.direction):new Ji(e,"",t||oh)}variable(e){return new Gc(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,i,n=this.defaultGraph()){return new za(e,t,i,n)}fromTerm(e){return cd(this,e)}fromQuad(e){return cd(this,e)}}Vc.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const Ua=new Vc,ah={apply:(r,e,t)=>r(t[0]),get:(r,e)=>r(e)};function mt(r,{factory:e=Ua}={}){const t=(i="")=>e.namedNode(`${r}${i.raw||i}`);return typeof Proxy>"u"?t:new Proxy(t,ah)}mt("http://www.w3.org/2001/XMLSchema#");const _t=mt("http://www.w3.org/1999/02/22-rdf-syntax-ns#");mt("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 ld({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]||_t.nil,a));for(let d=0;d<s.length;d++)e.dataset.add(e.factory.quad(s[d],_t.first,i[d],a)),e.dataset.add(e.factory.quad(s[d],_t.rest,s[d+1]||_t.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);!_t.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:!!(_t.nil.equals(e.term)||$e.traverse({ptr:e,predicates:[_t.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(_t.nil);){const t=e.out([_t.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const i=e.out([_t.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 pt(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 ld({dataset:e.dataset,end:i,quad:k,start:t}),e))}return l}}function fd(r,e){return e?t=>e(r.extend(t)):()=>{}}class pd{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:fd(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:fd(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 hd(r,e){return r?r.equals(e):r===e}function sh(r,e){return!(r.dataset!==e.dataset||!hd(r.graph,e.graph)||!hd(r.term,e.term))}function bd(r,e){return e?t=>e(new r.constructor({factory:r.factory,ptrs:[t]})):()=>{}}class rn{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 pd({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 pt(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=bd(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=bd(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=>sh(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 pd({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]})}}mt("http://www.w3.org/2002/07/owl#");const pr=mt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),lh=mt("http://www.w3.org/2000/01/rdf-schema#"),ae=mt("http://www.w3.org/ns/shacl#"),pa=mt("https://schemas.link/shacl-next#"),Ha=mt("http://www.w3.org/2001/XMLSchema#");function dh(r){return r?`{${[...r.quads()].map(e=>st(e)).join(" ")}}`:"{}"}function ch(r){return r?`{${r.map(e=>dh(e)).join(" ")}}`:"{}"}var qo,md;function uh(){if(md)return qo;md=1;var r=/\s/;function e(t){for(var i=t.length;i--&&r.test(t.charAt(i)););return i}return qo=e,qo}var zo,gd;function fh(){if(gd)return zo;gd=1;var r=uh(),e=/^\s+/;function t(i){return i&&i.slice(0,r(i)+1).replace(e,"")}return zo=t,zo}var Uo,vd;function ph(){if(vd)return Uo;vd=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return Uo=r,Uo}var Ho,yd;function hh(){if(yd)return Ho;yd=1;var r=typeof Er=="object"&&Er&&Er.Object===Object&&Er;return Ho=r,Ho}var Go,wd;function bh(){if(wd)return Go;wd=1;var r=hh(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Go=t,Go}var Vo,xd;function Wc(){if(xd)return Vo;xd=1;var r=bh(),e=r.Symbol;return Vo=e,Vo}var Wo,_d;function mh(){if(_d)return Wo;_d=1;var r=Wc(),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 Wo=o,Wo}var Xo,kd;function gh(){if(kd)return Xo;kd=1;var r=Object.prototype,e=r.toString;function t(i){return e.call(i)}return Xo=t,Xo}var Qo,Ed;function vh(){if(Ed)return Qo;Ed=1;var r=Wc(),e=mh(),t=gh(),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 Qo=a,Qo}var Jo,Sd;function yh(){if(Sd)return Jo;Sd=1;function r(e){return e!=null&&typeof e=="object"}return Jo=r,Jo}var Ko,Rd;function wh(){if(Rd)return Ko;Rd=1;var r=vh(),e=yh(),t="[object Symbol]";function i(n){return typeof n=="symbol"||e(n)&&r(n)==t}return Ko=i,Ko}var Yo,Id;function xh(){if(Id)return Yo;Id=1;var r=fh(),e=ph(),t=wh(),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 Yo=d,Yo}var Zo,Nd;function _h(){if(Nd)return Zo;Nd=1;var r=xh(),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 Zo=i,Zo}var ea,Td;function kh(){if(Td)return ea;Td=1;var r=_h();function e(t){var i=r(t),n=i%1;return i===i?n?i-n:i:0}return ea=e,ea}var ta,Ad;function Eh(){if(Ad)return ta;Ad=1;var r=kh(),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 ta=t,ta}var ra,jd;function Sh(){if(jd)return ra;jd=1;var r=Eh();function e(t){return r(2,t)}return ra=e,ra}var Rh=Sh();const yt=tu(Rh);let Dd=class{constructor({details:e,factory:t,options:i,results:n=[]}={}){this.details=e,this.factory=t,this.options=i,this.results=n,this._conforms=yt(()=>!this.results.some(o=>o.severity.equals(ae.Info)||o.severity.equals(ae.Violation)||o.severity.equals(ae.Warning))),this._ptr=yt(()=>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 rn({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([pr.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 Ih(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 Nh=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=yt(()=>(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(Ih(g.value,e),g.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([pr.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 Dd({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 Dd({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)} - ${ch(this.valuePaths)}`}result(e){const t=new Nh({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 Th(){return{generic:Ah()}}function Ah(){return r=>{r.trace(pa.TraversalConstraintComponent,{args:{},message:[r.factory.literal("Traversal")],value:r.valueOrNode})}}class jh{constructor(e){this.validations=new Cr(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(Th),[...n].map(o=>o(e)).filter(Boolean)}}var nr={},or={},ni={},oi={},Ld;function jr(){if(Ld)return oi;Ld=1,Object.defineProperty(oi,"__esModule",{value:!0}),oi.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 oi.Translator=r,oi}var Od;function Dh(){if(Od)return ni;Od=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.TypeHandlerBoolean=void 0;const r=jr();let e=class Xc{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(Xc.TYPE))}};return ni.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",ni}var ai={},Cd;function Lh(){if(Cd)return ai;Cd=1,Object.defineProperty(ai,"__esModule",{value:!0}),ai.TypeHandlerDate=void 0;const r=jr();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 ai.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]$/},ai}var si={},$d;function Oh(){if($d)return si;$d=1,Object.defineProperty(si,"__esModule",{value:!0}),si.TypeHandlerNumberDouble=void 0;const r=jr();let e=class Qc{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(Qc.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 si.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"],si}var li={},Fd;function Ch(){if(Fd)return li;Fd=1,Object.defineProperty(li,"__esModule",{value:!0}),li.TypeHandlerNumberInteger=void 0;const r=jr();let e=class pi{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<=pi.MAX_INT&&i>=pi.MIN_INT?o.namedNode(pi.TYPES[0]):o.namedNode(pi.TYPES[1])))}};return li.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,li}var di={},Pd;function $h(){if(Pd)return di;Pd=1,Object.defineProperty(di,"__esModule",{value:!0}),di.TypeHandlerString=void 0;let r=class{fromRdf(t){return t.value}toRdf(t,{datatype:i,dataFactory:n}){return n.literal(t,i)}};return di.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"],di}var Md;function Bd(){return Md||(Md=1,function(r){var e=or&&or.__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=or&&or.__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(Dh(),r),t(Lh(),r),t(Oh(),r),t(Ch(),r),t($h(),r)}(or)),or}var ia={},qd;function Fh(){return qd||(qd=1,Object.defineProperty(ia,"__esModule",{value:!0})),ia}var zd;function Ph(){return zd||(zd=1,function(r){var e=nr&&nr.__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=nr&&nr.__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=$c(),n=Bd(),o=jr();t(Bd(),r),t(Fh(),r),t(jr(),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()}}(nr)),nr}var Ei=Ph();function Ud(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 Mh(r){return r.terms.length===0?null:r.ptrs[0].isList()?[...r.list()].map(e=>Ud(e)):[Ud(r)]}class Bh{constructor(e){this.shape=e,this._compiled=yt(()=>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 pt(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 Cr).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 pt,i=new rn({dataset:r.dataset,terms:r.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[lh.subClassOf]});for(const n of i.ptrs)for(const{term:o}of n.nodes())e.add(o);return e}class qh{constructor(e){this.targetClass=new pt([...ba(e.hasOut([pr.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([pr.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 pt(n.terms)])}}class zh{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=yt(()=>{const i=this.ptr.out([ae.deactivated]).term;return i&&Ei.fromRdf(i)}),this._message=yt(()=>this.ptr.out([ae.message]).terms),this._path=yt(()=>Mh(this.ptr.out([ae.path]))),this._severity=yt(()=>this.ptr.out([ae.severity]).term),this._shapeValidator=yt(()=>new Bh(this)),this._sparql=yt(()=>this.ptr.out([ae.sparql])),this._targetResolver=yt(()=>new qh(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 Uh(r){const e=parseInt(r.ptr.out([ae.maxCount]).value);return{property:Hh(e)}}function Hh(r){return e=>{e.test(e.values.terms.length<=r,ae.MaxCountConstraintComponent,{args:{maxCount:r},message:[e.factory.literal("More than {$maxCount} values")]})}}function Gh(r){const e=parseInt(r.ptr.out([ae.minCount]).value);return{property:Vh(e)}}function Vh(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 Wh(r,e){for(const t of r)if(!await e(t))return!1;return!0}async function Xh(r,e){return(await Promise.all(r.map(t=>e(t)))).filter(Boolean)}async function mn(r,e){return Promise.all(r.map(e))}async function Qh(r,e){for(const t of r)if(await e(t))return!0;return!1}function Jh(r){const e=[...r.ptr.out([ae.and])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Kh(e)}}function Kh(r){return async e=>{const t=await mn(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 Yh(r){const e=r.validator.shape(r.ptr.out([ae.not]));return{generic:Zh(e)}}function Zh(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 eb(r){const e=[...r.ptr.out([ae.or])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:tb(e)}}function tb(r){return async e=>{let t=[],i;if(e.options.debug||e.options.details){const n=await mn(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 Qh(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 rb(r){const e=[...r.ptr.out([ae.xone])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:ib(e)}}function ib(r){return async e=>{const t=await mn(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 nb(r){if(!Ei.fromRdf(r.ptr.out([ae.closed]).term))return null;const t=r.ptr.out([ae.property]).map(o=>r.validator.shape(o)),i=new pt(t.filter(o=>!o.deactivated).map(o=>o.path[0].predicates[0])),n=new pt([...r.ptr.out([ae.ignoredProperties]).list()||[]].map(o=>o.term));return{node:ob(i,n)}}function ob(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 ab(r){const e=r.ptr.out([ae.hasValue]).term;return{node:sb(e),property:lb(e)}}function sb(r){return e=>{e.test(r.equals(e.valueOrNode.term),ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Value must be {$hasValue}")]})}}function lb(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 db(r){const e=new pt([...r.ptr.out([ae.in]).list()].map(t=>t.term));return{generic:cb(e)}}function cb(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 $r(r,e){if(!r||r.termType!=="Literal"||!e||e.termType!=="Literal"||Hd(r)!==Hd(e))return null;const t=Ei.fromRdf(r),i=Ei.fromRdf(e);return typeof t!=typeof i?null:typeof t=="string"?t.localeCompare(i):t-i}function Hd(r){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return Ha.dateTime.equals(r.datatype)&&e.test(r.value)}function ub(r){const e=r.ptr.out([ae.disjoint]).term;return{generic:fb(e)}}function fb(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 pb(r){const e=r.ptr.out([ae.equals]).term;return{node:hb(e),property:bb(e)}}function hb(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 bb(r){return e=>{const t=new pt(e.focusNode.out([r]).terms),i=new pt(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 mb(r){const e=r.ptr.out([ae.lessThan]).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=$r(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 vb(r){const e=r.ptr.out([ae.lessThanOrEquals]).term;return{property:yb(e)}}function yb(r){return e=>{const t=e.focusNode.out([r]).terms;for(const i of e.values)for(const n of t){const o=$r(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 wb(r){const e=r.ptr.out([ae.maxExclusive]).term;return{generic:xb(e)}}function xb(r){return e=>{const t=$r(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 _b(r){const e=r.ptr.out([ae.maxInclusive]).term;return{generic:kb(e)}}function kb(r){return e=>{const t=$r(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 Eb(r){const e=r.ptr.out([ae.minExclusive]).term;return{generic:Sb(e)}}function Sb(r){return e=>{const t=$r(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 Rb(r){const e=r.ptr.out([ae.minInclusive]).term;return{generic:Ib(e)}}function Ib(r){return e=>{const t=$r(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 Nb(r){const e=[...r.ptr.out([ae.node])].map(t=>r.validator.shape(t));return{generic:Tb(e)}}function Tb(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 Ab(r){const e=[...r.ptr.out([ae.property])].map(t=>r.validator.shape(t));return{generic:jb(e)}}function jb(r){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const i of r)await i.validate(t)}}function Db(r){const e=r.validator.shape(r.ptr.out([ae.qualifiedValueShape])),t=r.ptr.out([ae.qualifiedValueShapesDisjoint]).term,i=t?Ei.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:Lb(e,i,o,s)}}function Lb(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 Xh(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 mn([...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 Wh([...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 Ob(r,e){return e?e.slice(0,r.length)===r:!1}function Cb(r){const e=[...new Set([...r.ptr.out([ae.languageIn]).list()].map(t=>t.value))];return{generic:$b(e)}}function $b(r){return e=>{const t=r.some(i=>Ob(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 Fb(r){const e=parseInt(r.ptr.out([ae.maxLength]).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.MaxLengthConstraintComponent,{args:{maxLength:r},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})}}function Mb(r){const e=parseInt(r.ptr.out([ae.minLength]).value);return{generic:Bb(e)}}function Bb(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 qb(r){const e=r.ptr.out([ae.pattern]).value,t=r.ptr.out([ae.flags]).value,i=new RegExp(e,t);return{generic:zb(e,t,i)}}function zb(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 Ub(r){const e=r.ptr.out([ae.uniqueLang]).term;return e.value==="true"&&Ha.boolean.equals(e.datatype)?{property:Hb()}:null}function Hb(){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 Ki=mt("http://www.w3.org/ns/shacl#"),Jc=mt("https://schemas.link/shacl-next#");class Dr{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(Ki.Info)||e.severity.equals(Ki.Violation)||e.severity.equals(Ki.Warning))}}function Gb(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 nn{constructor({args:e={},factory:t,message:i=[],severity:n=Ki.Violation}={}){this.severity=n,this.message=i.map(o=>t.literal(Gb(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 Dr}validateSimple(){return!0}}class Fr 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 Fr({datatypes:this.datatypes,factory:e||this.factory})}}class Vb{constructor({factory:e=Ua,validations:t}={}){if(this.factory=e,this.validations=new Cr,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 Dr}validateSimple(e){const t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}}class Pe extends Fr{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=Jc.Debug);const o={pattern:this.factory.literal(i.toString()),this:e};return new nn({args:o,factory:this.factory,message:this.message,severity:n})});return new Dr({results:t})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}}const Wb=/^([-+]?[0-9]+)$/;class ot extends Pe{constructor(e=null,t=null,i,{factory:n}={}){super(Wb,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(!Jc.Debug.equals(t[0].severity))return new Dr({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 nn({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 nn({factory:this.factory,message:o}))}return new Dr({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 Fr{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 nn({factory:this.factory,message:n}))}return new Dr({results:t})}validateSimple(e){return this.values.has(e.value)}}const Ne={xsd:mt("http://www.w3.org/2001/XMLSchema#")},Xb=new Fr({datatypes:Ne.xsd.anySimpleType}),Qb=new Fr({datatypes:Ne.xsd.anyAtomicType}),gn=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,Jb=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,Kc=/^((\+|-)?([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)))))$/,Yc=/^(-?([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))?)$/,Kb=/^((([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))?)$/,Yb=/^(-?([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))?)$/,Zb=/^(-?([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))?)$/,em=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,tm=/^(--(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))?)$/,rm=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,im=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,nm=/^(([0-9a-fA-F]{2})*)$/,om=/^(((([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] ?= ?=))?)$/,am=new Pe(gn,Ne.xsd.string),sm=new Wa(["1","true","0","false"],Ne.xsd.boolean),lm=new Pe(Jb,Ne.xsd.decimal),dm=new Pe(Kc,Ne.xsd.float),cm=new Pe(Kc,Ne.xsd.double),um=new Pe(Xa,Ne.xsd.duration),fm=new Pe(Yc,Ne.xsd.dateTime),pm=new Pe(Kb,Ne.xsd.time),hm=new Pe(Yb,Ne.xsd.date),bm=new Pe(Zb,Ne.xsd.gYearMonth),mm=new Pe(em,Ne.xsd.gYear),gm=new Pe(tm,Ne.xsd.gMonthDay),vm=new Pe(rm,Ne.xsd.gDay),ym=new Pe(im,Ne.xsd.gMonth),wm=new Pe(nm,Ne.xsd.hexBinary),xm=new Pe(om,Ne.xsd.base64Binary),_m=new Pe(gn,Ne.xsd.anyURI),Zc=/^([^\u000d\u000a\u0009]*)$/,km=/^([^ ]+( [^ ]+)*)*$/,Em=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,Sm=/^([^DT]*)$/,Rm=/^([^YM]*[DT].*)$/,Im=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Nm=new Pe([gn,Zc],Ne.xsd.normalizedString),Tm=new Pe([gn,Zc,km],Ne.xsd.token),Am=new Pe(Em,Ne.xsd.language),jm=new ot(null,null,Ne.xsd.integer),Dm=new ot(null,"0",Ne.xsd.nonPositiveInteger),Lm=new ot(null,"-1",Ne.xsd.negativeInteger),Om=new ot("-9223372036854775808","9223372036854775807",Ne.xsd.long),Cm=new ot("-2147483648","2147483647",Ne.xsd.int),$m=new ot("-32768","32767",Ne.xsd.short),Fm=new ot("-128","127",Ne.xsd.byte),Pm=new ot("0",null,Ne.xsd.nonNegativeInteger),Mm=new ot("0","18446744073709551615",Ne.xsd.unsignedLong),Bm=new ot("0","4294967295",Ne.xsd.unsignedInt),qm=new ot("0","65535",Ne.xsd.unsignedShort),zm=new ot("0","255",Ne.xsd.unsignedByte),Um=new ot("1",null,Ne.xsd.positiveInteger),Hm=new Pe([Xa,Sm],Ne.xsd.yearMonthDuration),Gm=new Pe([Xa,Rm],Ne.xsd.dayTimeDuration),Vm=new Pe([Yc,Im],Ne.xsd.dateTimeStamp),Wm=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:Qb,anySimpleType:Xb,anyURI:_m,base64Binary:xm,boolean:sm,byte:Fm,date:hm,dateTime:fm,dateTimeStamp:Vm,dayTimeDuration:Gm,decimal:lm,double:cm,duration:um,float:dm,gDay:vm,gMonth:ym,gMonthDay:gm,gYear:mm,gYearMonth:bm,hexBinary:wm,int:Cm,integer:jm,language:Am,long:Om,negativeInteger:Lm,nonNegativeInteger:Pm,nonPositiveInteger:Dm,normalizedString:Nm,positiveInteger:Um,short:$m,string:am,time:pm,token:Tm,unsignedByte:zm,unsignedInt:Bm,unsignedLong:Mm,unsignedShort:qm,yearMonthDuration:Hm},Symbol.toStringTag,{value:"Module"}));class Xm extends Vb{constructor({factory:e}={}){super({factory:e,validations:{...Wm}})}}const Qm=new Cr([[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 Jm(r){const e=r.ptr.out([ae.class]).map(t=>ba(t));return{generic:Km(e)}}function Km(r){return e=>{const t=new pt(e.valueOrNode.out([pr.type]).terms);for(const i of r){const n=[...t].some(o=>i.has(o));e.test(n,ae.ClassConstraintComponent,{value:e.valueOrNode})}}}function Ym(r){const e=r.ptr.out([ae.datatype]).term,t=new Xm;return{generic:Zm(e,t)}}function Zm(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 eg(r){const e=r.ptr.out([ae.nodeKind]).term,t=Qm.get(e);return{generic:tg(e,t)}}function tg(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 rg=new Cr([[ae.maxCount,Uh],[ae.minCount,Gh],[ae.and,Jh],[ae.not,Yh],[ae.or,eb],[ae.xone,rb],[ae.closed,nb],[ae.hasValue,ab],[ae.in,db],[ae.disjoint,ub],[ae.equals,pb],[ae.lessThan,mb],[ae.lessThanOrEquals,vb],[ae.maxExclusive,wb],[ae.maxInclusive,_b],[ae.minExclusive,Eb],[ae.minInclusive,Rb],[ae.node,Nb],[ae.property,Ab],[ae.qualifiedValueShape,Db],[ae.languageIn,Cb],[ae.maxLength,Fb],[ae.minLength,Mb],[ae.pattern,qb],[ae.uniqueLang,Ub],[ae.class,Jm],[ae.datatype,Ym],[ae.nodeKind,eg]]);class ig{constructor(e,{factory:t,...i}){if(this.factory=t,this.options=i,this.registry=new jh(rg),this.shapesPtr=new rn({dataset:e,factory:t}),this.shapes=new Cr,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([pr.type],[ae.NodeShape]),...this.shapesPtr.hasOut([pr.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 zh(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const i=new rn({...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 ng=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new sd(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 sd.dataAttributes()}connectedCallback(){this.shadowRoot.prepend(this.form)}attributeChangedCallback(){this.config.updateAttributes(this),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.initDebounceTimeout=setTimeout(async()=>{this.setAttribute("loading",""),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 Vt(e,this.config,this.config.attributes.valuesSubject?Re.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(Re.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,bi)>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)}this.removeAttribute("loading")},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 et){return this.shape?.toRDF(e),e}registerPlugin(e){Yu(e),this.initialize()}setTheme(e){this.config.theme=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&&(this.shape.toRDF(this.config.store),this.config.store.add(new on(this.shape.shaclSubject,Re.namedNode(_e+"targetNode"),this.shape.nodeId,this.config.valuesGraphId)));try{const t=this.config.store,i=await new ig(t,{details:!0,factory:Re}).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(`
392
392
  :scope shacl-node[data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${s.id}'] > .editor,
393
393
  :scope shacl-node[data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${s.id}'] > .editor,
394
394
  :scope shacl-node[data-node-id='${a.id}'] > .shacl-group > shacl-property > .property-instance[data-path='${s.id}'] > .editor,
395
395
  :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(`
396
396
  :scope [data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${s.id}'],
397
397
  :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 it&&(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+`
398
- `;else i.title=e.sourceConstraintComponent?.value;return i}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=Re.namedNode(this.config.attributes.shapeSubject),this.config.store.getQuads(e,tt,Bi,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,At)>0){const t=Re.namedNode(this.config.attributes.valuesSubject),i=[...this.config.store.getQuads(t,tt,null,At),...this.config.store.getQuads(t,aa,null,At)];if(i.length===0){console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${tt.id} nor ${aa.id} statement`);return}for(const n of i)if(this.config.store.getQuads(n.object,tt,Bi,null).length>0){e=n.object;break}if(!e){const n=this.config.store.getQuads(null,Ir,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,tt,Bi,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,tt,Bi,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,At))this.config.store.delete(t),(t.object.termType==="NamedNode"||t.object.termType==="BlankNode")&&this.removeFromDataGraph(t.object)}};const og=`.editor:not([type='checkbox']) { border: 1px solid #DDD; }
398
+ `;else i.title=e.sourceConstraintComponent?.value;return i}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=Re.namedNode(this.config.attributes.shapeSubject),this.config.store.getQuads(e,tt,qi,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,At)>0){const t=Re.namedNode(this.config.attributes.valuesSubject),i=[...this.config.store.getQuads(t,tt,null,At),...this.config.store.getQuads(t,aa,null,At)];if(i.length===0){console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${tt.id} nor ${aa.id} statement`);return}for(const n of i)if(this.config.store.getQuads(n.object,tt,qi,null).length>0){e=n.object;break}if(!e){const n=this.config.store.getQuads(null,Rr,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,tt,qi,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,tt,qi,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,At))this.config.store.delete(t),(t.object.termType==="NamedNode"||t.object.termType==="BlankNode")&&this.removeFromDataGraph(t.object)}};const og=`.editor:not([type='checkbox']) { border: 1px solid #DDD; }
399
399
  .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; }
400
400
  .property-instance:not(:first-child) > label:not(.persistent) { visibility: hidden; max-height: 0; }
401
401
  .mode-edit .property-instance label { width: var(--label-width); }
402
- `;class ag extends Wu{constructor(e){super(e||og),this.idCtr=0}createDefaultTemplate(e,t,i,n,o){n.id=`e${this.idCtr++}`,n.classList.add("editor"),o?.datatype?n.shaclDatatype=o.datatype:t instanceof ct&&(n.shaclDatatype=t.datatype),o?.minCount!==void 0&&(n.dataset.minCount=String(o.minCount)),o?.class&&(n.dataset.class=o.class.value),o?.nodeKind?n.dataset.nodeKind=o.nodeKind.value:t instanceof nn&&(n.dataset.nodeKind=_e+"IRI"),(o?.hasValue||o?.readonly)&&(n.disabled=!0),n.value=t?.value||o?.defaultValue?.value||"";const a=document.createElement("label");a.htmlFor=n.id,a.innerText=e,o?.description&&a.setAttribute("title",o.description.value);const s=o?.description?o.description.value:o?.pattern?o.pattern:null;s&&n.setAttribute("placeholder",s),i&&(n.setAttribute("required","true"),a.classList.add("required"));const d=document.createElement("div");return d.appendChild(a),d.appendChild(n),d}createDateEditor(e,t,i,n){const o=new ze;n.datatype?.value===Gt+"dateTime"?(o.type="datetime-local",o.setAttribute("step","1")):o.type="date",o.clearable=!0,o.dense=!0,o.classList.add("pr-0");const a=this.createDefaultTemplate(e,null,i,o,n);if(t)try{let s=new Date(t.value).toISOString();n.datatype?.value===Gt+"dateTime"?s=s.slice(0,19):s=s.slice(0,10),o.value=s}catch(s){console.error(s,t)}return a}createTextEditor(e,t,i,n){let o;return n.singleLine===!1?(o=new cr,o.resize="auto"):o=new ze,o.dense=!0,n.pattern&&(o.pattern=n.pattern),n.minLength&&(o.minLength=n.minLength),n.maxLength&&(o.maxLength=n.maxLength),this.createDefaultTemplate(e,t,i,o,n)}createLangStringEditor(e,t,i,n){const o=this.createTextEditor(e,t,i,n),a=o.querySelector(":scope .editor");let s;if(n.languageIn?.length){s=document.createElement("select");for(const d of n.languageIn){const l=document.createElement("option");l.innerText=d.value,s.appendChild(l)}}else s=document.createElement("input"),s.maxLength=5,s.size=5,s.placeholder="lang?";return s.title="Language of the text",s.classList.add("lang-chooser"),s.slot="suffix",s.addEventListener("change",d=>{d.stopPropagation(),a&&(a.dataset.lang=s.value,a.dispatchEvent(new Event("change",{bubbles:!0})))}),t instanceof ct&&(s.value=t.language),a.dataset.lang=s.value,a.appendChild(s),o}createBooleanEditor(e,t,i,n){const o=document.createElement("input");o.type="checkbox",o.classList.add("ml-0");const a=this.createDefaultTemplate(e,null,i,o,n);return o.removeAttribute("required"),a.querySelector(":scope label")?.classList.remove("required"),t instanceof ct&&(o.checked=t.value==="true"),a}createFileEditor(e,t,i,n){const o=document.createElement("input");return o.type="file",o.addEventListener("change",a=>{if(o.files?.length){a.stopPropagation();const s=new FileReader;s.readAsDataURL(o.files[0]),s.onload=()=>{o.binaryData=btoa(s.result),o.parentElement?.dispatchEvent(new Event("change",{bubbles:!0}))}}else o.binaryData=void 0}),this.createDefaultTemplate(e,t,i,o,n)}createNumberEditor(e,t,i,n){const o=new ze;o.type="number",o.clearable=!0,o.dense=!0,o.classList.add("pr-0");const a=n.minInclusive!==void 0?n.minInclusive:n.minExclusive!==void 0?n.minExclusive+1:void 0,s=n.maxInclusive!==void 0?n.maxInclusive:n.maxExclusive!==void 0?n.maxExclusive-1:void 0;return a!==void 0&&(o.min=String(a)),s!==void 0&&(o.max=String(s)),n.datatype?.value!==Gt+"integer"&&(o.step="0.1"),this.createDefaultTemplate(e,t,i,o,n)}createListEditor(e,t,i,n,o){const a=new Ge;a.clearable=!0,a.dense=!0;const s=this.createDefaultTemplate(e,null,i,a,o),d=document.createElement("ul");let l=!0;const c=(f,v)=>{const g=document.createElement("li");if(typeof f.value=="string"?(g.dataset.value=f.value,g.innerText=f.label?f.label:f.value):(f.value instanceof ct&&f.value.datatype.equals(Pu)?g.dataset.value=f.value.value:g.dataset.value=f.value.id,g.innerText=f.label?f.label:f.value.value),v.appendChild(g),f.children?.length){l=!1;const y=document.createElement("ul");g.appendChild(y);for(const k of f.children)c(k,y)}};for(const f of n)c(f,d);return l||(a.collapse=!0),a.appendChild(d),t&&(a.value=t.value),s}createButton(e,t){const i=document.createElement("button");return i.type="button",i.innerHTML=e,i}}const sg=`@charset "UTF-8";/*!
402
+ `;class ag extends Wu{constructor(e){super(e||og),this.idCtr=0}createDefaultTemplate(e,t,i,n,o){n.id=`e${this.idCtr++}`,n.classList.add("editor"),o?.datatype?n.shaclDatatype=o.datatype:t instanceof ct&&(n.shaclDatatype=t.datatype),o?.minCount!==void 0&&(n.dataset.minCount=String(o.minCount)),o?.class&&(n.dataset.class=o.class.value),o?.nodeKind?n.dataset.nodeKind=o.nodeKind.value:t instanceof wi&&(n.dataset.nodeKind=_e+"IRI"),(o?.hasValue||o?.readonly)&&(n.disabled=!0),n.value=t?.value||o?.defaultValue?.value||"";const a=document.createElement("label");a.htmlFor=n.id,a.innerText=e,o?.description&&a.setAttribute("title",o.description.value);const s=o?.description?o.description.value:o?.pattern?o.pattern:null;s&&n.setAttribute("placeholder",s),i&&(n.setAttribute("required","true"),a.classList.add("required"));const d=document.createElement("div");return d.appendChild(a),d.appendChild(n),d}createDateEditor(e,t,i,n){const o=new ze;n.datatype?.value===Gt+"dateTime"?(o.type="datetime-local",o.setAttribute("step","1")):o.type="date",o.clearable=!0,o.dense=!0,o.classList.add("pr-0");const a=this.createDefaultTemplate(e,null,i,o,n);if(t)try{let s=new Date(t.value).toISOString();n.datatype?.value===Gt+"dateTime"?s=s.slice(0,19):s=s.slice(0,10),o.value=s}catch(s){console.error(s,t)}return a}createTextEditor(e,t,i,n){let o;return n.singleLine===!1?(o=new cr,o.resize="auto"):o=new ze,o.dense=!0,n.pattern&&(o.pattern=n.pattern),n.minLength&&(o.minLength=n.minLength),n.maxLength&&(o.maxLength=n.maxLength),this.createDefaultTemplate(e,t,i,o,n)}createLangStringEditor(e,t,i,n){const o=this.createTextEditor(e,t,i,n),a=o.querySelector(":scope .editor");let s;if(n.languageIn?.length){s=document.createElement("select");for(const d of n.languageIn){const l=document.createElement("option");l.innerText=d.value,s.appendChild(l)}}else s=document.createElement("input"),s.maxLength=5,s.size=5,s.placeholder="lang?";return s.title="Language of the text",s.classList.add("lang-chooser"),s.slot="suffix",s.addEventListener("change",d=>{d.stopPropagation(),a&&(a.dataset.lang=s.value,a.dispatchEvent(new Event("change",{bubbles:!0})))}),t instanceof ct&&(s.value=t.language),a.dataset.lang=s.value,a.appendChild(s),o}createBooleanEditor(e,t,i,n){const o=document.createElement("input");o.type="checkbox",o.classList.add("ml-0");const a=this.createDefaultTemplate(e,null,i,o,n);return o.removeAttribute("required"),a.querySelector(":scope label")?.classList.remove("required"),t instanceof ct&&(o.checked=t.value==="true"),a}createFileEditor(e,t,i,n){const o=document.createElement("input");return o.type="file",o.addEventListener("change",a=>{if(o.files?.length){a.stopPropagation();const s=new FileReader;s.readAsDataURL(o.files[0]),s.onload=()=>{o.binaryData=btoa(s.result),o.parentElement?.dispatchEvent(new Event("change",{bubbles:!0}))}}else o.binaryData=void 0}),this.createDefaultTemplate(e,t,i,o,n)}createNumberEditor(e,t,i,n){const o=new ze;o.type="number",o.clearable=!0,o.dense=!0,o.classList.add("pr-0");const a=n.minInclusive!==void 0?n.minInclusive:n.minExclusive!==void 0?n.minExclusive+1:void 0,s=n.maxInclusive!==void 0?n.maxInclusive:n.maxExclusive!==void 0?n.maxExclusive-1:void 0;return a!==void 0&&(o.min=String(a)),s!==void 0&&(o.max=String(s)),n.datatype?.value!==Gt+"integer"&&(o.step="0.1"),this.createDefaultTemplate(e,t,i,o,n)}createListEditor(e,t,i,n,o){const a=new Ge;a.clearable=!0,a.dense=!0;const s=this.createDefaultTemplate(e,null,i,a,o),d=document.createElement("ul");let l=!0;const c=(u,v)=>{const g=document.createElement("li");if(typeof u.value=="string"?(g.dataset.value=u.value,g.innerText=u.label?u.label:u.value):(u.value instanceof ct&&u.value.datatype.equals(Pu)?g.dataset.value=u.value.value:u.value instanceof wi?g.dataset.value="<"+u.value.value+">":g.dataset.value=u.value.id,g.innerText=u.label?u.label:u.value.value),v.appendChild(g),u.children?.length){l=!1;const y=document.createElement("ul");g.appendChild(y);for(const k of u.children)c(k,y)}};for(const u of n)c(u,d);return l||(a.collapse=!0),a.appendChild(d),t&&(a.value=t.value),s}createButton(e,t){const i=document.createElement("button");return i.type="button",i.innerHTML=e,i}}const sg=`@charset "UTF-8";/*!
403
403
  * Bootstrap v5.3.7 (https://getbootstrap.com/)
404
404
  * Copyright 2011-2025 The Bootstrap Authors
405
405
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
@@ -410,4 +410,4 @@ if("@preserve"in u)return u["@preserve"][0];if(e.isValue(u))return u;if(e.isList
410
410
  .property-instance { margin-bottom:14px; }
411
411
  .form-floating[data-description] { margin-bottom: 28px; }
412
412
  .remove-button { padding: 6px; }`;class dg extends ag{constructor(){super(sg+`
413
- `+lg)}apply(e){super.apply(e),e.dataset.bsTheme="light"}createDefaultTemplate(e,t,i,n,o){const a=super.createDefaultTemplate(e,t,i,n,o);n.type!=="checkbox"&&(a.classList.add("form-floating"),n.tagName==="SELECT"?n.classList.add("form-select"):n.classList.add("form-control"));const s=a.querySelector("label");return s?.classList.add("form-label"),s?.title&&(a.dataset.description=s.title,s.removeAttribute("title")),a.prepend(n),a}createButton(e,t){const i=super.createButton(e,t);return i.classList.add("btn",t?"btn-primary":"btn-outline-secondary"),i}}class cg extends ng{constructor(){super(new dg)}}window.customElements.define("shacl-form",cg);export{sd as Config,Vp as Loader,vg as Plugin,cg as ShaclForm,Gu as ShaclPropertyTemplate,Wu as Theme,Si as findLabel,Yu as registerPlugin};
413
+ `+lg)}apply(e){super.apply(e),e.dataset.bsTheme="light"}createDefaultTemplate(e,t,i,n,o){const a=super.createDefaultTemplate(e,t,i,n,o);n.type!=="checkbox"&&(a.classList.add("form-floating"),n.tagName==="SELECT"?n.classList.add("form-select"):n.classList.add("form-control"));const s=a.querySelector("label");return s?.classList.add("form-label"),s?.title&&(a.dataset.description=s.title,s.removeAttribute("title")),a.prepend(n),a}createButton(e,t){const i=super.createButton(e,t);return i.classList.add("btn",t?"btn-primary":"btn-outline-secondary"),i}}class cg extends ng{constructor(){super(new dg)}}window.customElements.define("shacl-form",cg);export{sd as Config,Vp as Loader,vg as Plugin,cg as ShaclForm,Gu as ShaclPropertyTemplate,Wu as Theme,Ri as findLabel,Yu as registerPlugin};