@ulb-darmstadt/shacl-form 1.8.4 → 1.9.0

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 Zt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _c(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function xc(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var e=r.default;if(typeof e=="function"){var t=function n(){var i=!1;try{i=this instanceof n}catch{}return i?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(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var Vn={},pr={},Ia;function Sc(){if(Ia)return pr;Ia=1,pr.byteLength=o,pr.toByteArray=d,pr.fromByteArray=w;for(var r=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,s=n.length;i<s;++i)r[i]=n[i],e[n.charCodeAt(i)]=i;e[45]=62,e[95]=63;function a(g){var m=g.length;if(m%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var _=g.indexOf("=");_===-1&&(_=m);var x=_===m?0:4-_%4;return[_,x]}function o(g){var m=a(g),_=m[0],x=m[1];return(_+x)*3/4-x}function l(g,m,_){return(m+_)*3/4-_}function d(g){var m,_=a(g),x=_[0],S=_[1],I=new t(l(g,x,S)),b=0,c=S>0?x-4:x,p;for(p=0;p<c;p+=4)m=e[g.charCodeAt(p)]<<18|e[g.charCodeAt(p+1)]<<12|e[g.charCodeAt(p+2)]<<6|e[g.charCodeAt(p+3)],I[b++]=m>>16&255,I[b++]=m>>8&255,I[b++]=m&255;return S===2&&(m=e[g.charCodeAt(p)]<<2|e[g.charCodeAt(p+1)]>>4,I[b++]=m&255),S===1&&(m=e[g.charCodeAt(p)]<<10|e[g.charCodeAt(p+1)]<<4|e[g.charCodeAt(p+2)]>>2,I[b++]=m>>8&255,I[b++]=m&255),I}function h(g){return r[g>>18&63]+r[g>>12&63]+r[g>>6&63]+r[g&63]}function y(g,m,_){for(var x,S=[],I=m;I<_;I+=3)x=(g[I]<<16&16711680)+(g[I+1]<<8&65280)+(g[I+2]&255),S.push(h(x));return S.join("")}function w(g){for(var m,_=g.length,x=_%3,S=[],I=16383,b=0,c=_-x;b<c;b+=I)S.push(y(g,b,b+I>c?c:b+I));return x===1?(m=g[_-1],S.push(r[m>>2]+r[m<<4&63]+"==")):x===2&&(m=(g[_-2]<<8)+g[_-1],S.push(r[m>>10]+r[m>>4&63]+r[m<<2&63]+"=")),S.join("")}return pr}var Zr={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var Ra;function Ec(){return Ra||(Ra=1,Zr.read=function(r,e,t,n,i){var s,a,o=i*8-n-1,l=(1<<o)-1,d=l>>1,h=-7,y=t?i-1:0,w=t?-1:1,g=r[e+y];for(y+=w,s=g&(1<<-h)-1,g>>=-h,h+=o;h>0;s=s*256+r[e+y],y+=w,h-=8);for(a=s&(1<<-h)-1,s>>=-h,h+=n;h>0;a=a*256+r[e+y],y+=w,h-=8);if(s===0)s=1-d;else{if(s===l)return a?NaN:(g?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-d}return(g?-1:1)*a*Math.pow(2,s-n)},Zr.write=function(r,e,t,n,i,s){var a,o,l,d=s*8-i-1,h=(1<<d)-1,y=h>>1,w=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:s-1,m=n?1:-1,_=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+y>=1?e+=w/l:e+=w*Math.pow(2,1-y),e*l>=2&&(a++,l/=2),a+y>=h?(o=0,a=h):a+y>=1?(o=(e*l-1)*Math.pow(2,i),a=a+y):(o=e*Math.pow(2,y-1)*Math.pow(2,i),a=0));i>=8;r[t+g]=o&255,g+=m,o/=256,i-=8);for(a=a<<i|o,d+=i;d>0;r[t+g]=a&255,g+=m,a/=256,d-=8);r[t+g-m]|=_*128}),Zr}/*!
1
+ var xr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function nd(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var e=r.default;if(typeof e=="function"){var t=function n(){var i=!1;try{i=this instanceof n}catch{}return i?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(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var mi={},Br={},za;function id(){if(za)return Br;za=1,Br.byteLength=o,Br.toByteArray=l,Br.fromByteArray=m;for(var r=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,s=n.length;i<s;++i)r[i]=n[i],e[n.charCodeAt(i)]=i;e[45]=62,e[95]=63;function a(b){var _=b.length;if(_%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var x=b.indexOf("=");x===-1&&(x=_);var E=x===_?0:4-x%4;return[x,E]}function o(b){var _=a(b),x=_[0],E=_[1];return(x+E)*3/4-E}function u(b,_,x){return(_+x)*3/4-x}function l(b){var _,x=a(b),E=x[0],v=x[1],S=new t(u(b,E,v)),y=0,h=v>0?E-4:E,g;for(g=0;g<h;g+=4)_=e[b.charCodeAt(g)]<<18|e[b.charCodeAt(g+1)]<<12|e[b.charCodeAt(g+2)]<<6|e[b.charCodeAt(g+3)],S[y++]=_>>16&255,S[y++]=_>>8&255,S[y++]=_&255;return v===2&&(_=e[b.charCodeAt(g)]<<2|e[b.charCodeAt(g+1)]>>4,S[y++]=_&255),v===1&&(_=e[b.charCodeAt(g)]<<10|e[b.charCodeAt(g+1)]<<4|e[b.charCodeAt(g+2)]>>2,S[y++]=_>>8&255,S[y++]=_&255),S}function c(b){return r[b>>18&63]+r[b>>12&63]+r[b>>6&63]+r[b&63]}function d(b,_,x){for(var E,v=[],S=_;S<x;S+=3)E=(b[S]<<16&16711680)+(b[S+1]<<8&65280)+(b[S+2]&255),v.push(c(E));return v.join("")}function m(b){for(var _,x=b.length,E=x%3,v=[],S=16383,y=0,h=x-E;y<h;y+=S)v.push(d(b,y,y+S>h?h:y+S));return E===1?(_=b[x-1],v.push(r[_>>2]+r[_<<4&63]+"==")):E===2&&(_=(b[x-2]<<8)+b[x-1],v.push(r[_>>10]+r[_>>4&63]+r[_<<2&63]+"=")),v.join("")}return Br}var Dn={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var Xa;function sd(){return Xa||(Xa=1,Dn.read=function(r,e,t,n,i){var s,a,o=i*8-n-1,u=(1<<o)-1,l=u>>1,c=-7,d=t?i-1:0,m=t?-1:1,b=r[e+d];for(d+=m,s=b&(1<<-c)-1,b>>=-c,c+=o;c>0;s=s*256+r[e+d],d+=m,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=a*256+r[e+d],d+=m,c-=8);if(s===0)s=1-l;else{if(s===u)return a?NaN:(b?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-l}return(b?-1:1)*a*Math.pow(2,s-n)},Dn.write=function(r,e,t,n,i,s){var a,o,u,l=s*8-i-1,c=(1<<l)-1,d=c>>1,m=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=n?0:s-1,_=n?1:-1,x=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+d>=1?e+=m/u:e+=m*Math.pow(2,1-d),e*u>=2&&(a++,u/=2),a+d>=c?(o=0,a=c):a+d>=1?(o=(e*u-1)*Math.pow(2,i),a=a+d):(o=e*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;r[t+b]=o&255,b+=_,o/=256,i-=8);for(a=a<<i|o,l+=i;l>0;r[t+b]=a&255,b+=_,a/=256,l-=8);r[t+b-_]|=x*128}),Dn}/*!
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 Na;function bt(){return Na||(Na=1,function(r){const e=Sc(),t=Ec(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=o,r.SlowBuffer=I,r.INSPECT_MAX_BYTES=50;const i=2147483647;r.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=s(),!o.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 s(){try{const E=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(E,u),E.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function a(E){if(E>i)throw new RangeError('The value "'+E+'" is invalid for option "size"');const u=new Uint8Array(E);return Object.setPrototypeOf(u,o.prototype),u}function o(E,u,f){if(typeof E=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return y(E)}return l(E,u,f)}o.poolSize=8192;function l(E,u,f){if(typeof E=="string")return w(E,u);if(ArrayBuffer.isView(E))return m(E);if(E==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof E);if(se(E,ArrayBuffer)||E&&se(E.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(se(E,SharedArrayBuffer)||E&&se(E.buffer,SharedArrayBuffer)))return _(E,u,f);if(typeof E=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const k=E.valueOf&&E.valueOf();if(k!=null&&k!==E)return o.from(k,u,f);const J=x(E);if(J)return J;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof E[Symbol.toPrimitive]=="function")return o.from(E[Symbol.toPrimitive]("string"),u,f);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof E)}o.from=function(E,u,f){return l(E,u,f)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function d(E){if(typeof E!="number")throw new TypeError('"size" argument must be of type number');if(E<0)throw new RangeError('The value "'+E+'" is invalid for option "size"')}function h(E,u,f){return d(E),E<=0?a(E):u!==void 0?typeof f=="string"?a(E).fill(u,f):a(E).fill(u):a(E)}o.alloc=function(E,u,f){return h(E,u,f)};function y(E){return d(E),a(E<0?0:S(E)|0)}o.allocUnsafe=function(E){return y(E)},o.allocUnsafeSlow=function(E){return y(E)};function w(E,u){if((typeof u!="string"||u==="")&&(u="utf8"),!o.isEncoding(u))throw new TypeError("Unknown encoding: "+u);const f=b(E,u)|0;let k=a(f);const J=k.write(E,u);return J!==f&&(k=k.slice(0,J)),k}function g(E){const u=E.length<0?0:S(E.length)|0,f=a(u);for(let k=0;k<u;k+=1)f[k]=E[k]&255;return f}function m(E){if(se(E,Uint8Array)){const u=new Uint8Array(E);return _(u.buffer,u.byteOffset,u.byteLength)}return g(E)}function _(E,u,f){if(u<0||E.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(E.byteLength<u+(f||0))throw new RangeError('"length" is outside of buffer bounds');let k;return u===void 0&&f===void 0?k=new Uint8Array(E):f===void 0?k=new Uint8Array(E,u):k=new Uint8Array(E,u,f),Object.setPrototypeOf(k,o.prototype),k}function x(E){if(o.isBuffer(E)){const u=S(E.length)|0,f=a(u);return f.length===0||E.copy(f,0,0,u),f}if(E.length!==void 0)return typeof E.length!="number"||Ee(E.length)?a(0):g(E);if(E.type==="Buffer"&&Array.isArray(E.data))return g(E.data)}function S(E){if(E>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return E|0}function I(E){return+E!=E&&(E=0),o.alloc(+E)}o.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==o.prototype},o.compare=function(u,f){if(se(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),se(f,Uint8Array)&&(f=o.from(f,f.offset,f.byteLength)),!o.isBuffer(u)||!o.isBuffer(f))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===f)return 0;let k=u.length,J=f.length;for(let ie=0,oe=Math.min(k,J);ie<oe;++ie)if(u[ie]!==f[ie]){k=u[ie],J=f[ie];break}return k<J?-1:J<k?1:0},o.isEncoding=function(u){switch(String(u).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}},o.concat=function(u,f){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return o.alloc(0);let k;if(f===void 0)for(f=0,k=0;k<u.length;++k)f+=u[k].length;const J=o.allocUnsafe(f);let ie=0;for(k=0;k<u.length;++k){let oe=u[k];if(se(oe,Uint8Array))ie+oe.length>J.length?(o.isBuffer(oe)||(oe=o.from(oe)),oe.copy(J,ie)):Uint8Array.prototype.set.call(J,oe,ie);else if(o.isBuffer(oe))oe.copy(J,ie);else throw new TypeError('"list" argument must be an Array of Buffers');ie+=oe.length}return J};function b(E,u){if(o.isBuffer(E))return E.length;if(ArrayBuffer.isView(E)||se(E,ArrayBuffer))return E.byteLength;if(typeof E!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof E);const f=E.length,k=arguments.length>2&&arguments[2]===!0;if(!k&&f===0)return 0;let J=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return f;case"utf8":case"utf-8":return de(E).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f*2;case"hex":return f>>>1;case"base64":return le(E).length;default:if(J)return k?-1:de(E).length;u=(""+u).toLowerCase(),J=!0}}o.byteLength=b;function c(E,u,f){let k=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((f===void 0||f>this.length)&&(f=this.length),f<=0)||(f>>>=0,u>>>=0,f<=u))return"";for(E||(E="utf8");;)switch(E){case"hex":return K(this,u,f);case"utf8":case"utf-8":return j(this,u,f);case"ascii":return ee(this,u,f);case"latin1":case"binary":return C(this,u,f);case"base64":return A(this,u,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,u,f);default:if(k)throw new TypeError("Unknown encoding: "+E);E=(E+"").toLowerCase(),k=!0}}o.prototype._isBuffer=!0;function p(E,u,f){const k=E[u];E[u]=E[f],E[f]=k}o.prototype.swap16=function(){const u=this.length;if(u%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let f=0;f<u;f+=2)p(this,f,f+1);return this},o.prototype.swap32=function(){const u=this.length;if(u%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let f=0;f<u;f+=4)p(this,f,f+3),p(this,f+1,f+2);return this},o.prototype.swap64=function(){const u=this.length;if(u%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let f=0;f<u;f+=8)p(this,f,f+7),p(this,f+1,f+6),p(this,f+2,f+5),p(this,f+3,f+4);return this},o.prototype.toString=function(){const u=this.length;return u===0?"":arguments.length===0?j(this,0,u):c.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(u){if(!o.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:o.compare(this,u)===0},o.prototype.inspect=function(){let u="";const f=r.INSPECT_MAX_BYTES;return u=this.toString("hex",0,f).replace(/(.{2})/g,"$1 ").trim(),this.length>f&&(u+=" ... "),"<Buffer "+u+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(u,f,k,J,ie){if(se(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),!o.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(f===void 0&&(f=0),k===void 0&&(k=u?u.length:0),J===void 0&&(J=0),ie===void 0&&(ie=this.length),f<0||k>u.length||J<0||ie>this.length)throw new RangeError("out of range index");if(J>=ie&&f>=k)return 0;if(J>=ie)return-1;if(f>=k)return 1;if(f>>>=0,k>>>=0,J>>>=0,ie>>>=0,this===u)return 0;let oe=ie-J,we=k-f;const Le=Math.min(oe,we),Te=this.slice(J,ie),je=u.slice(f,k);for(let Ie=0;Ie<Le;++Ie)if(Te[Ie]!==je[Ie]){oe=Te[Ie],we=je[Ie];break}return oe<we?-1:we<oe?1:0};function N(E,u,f,k,J){if(E.length===0)return-1;if(typeof f=="string"?(k=f,f=0):f>2147483647?f=2147483647:f<-2147483648&&(f=-2147483648),f=+f,Ee(f)&&(f=J?0:E.length-1),f<0&&(f=E.length+f),f>=E.length){if(J)return-1;f=E.length-1}else if(f<0)if(J)f=0;else return-1;if(typeof u=="string"&&(u=o.from(u,k)),o.isBuffer(u))return u.length===0?-1:D(E,u,f,k,J);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?J?Uint8Array.prototype.indexOf.call(E,u,f):Uint8Array.prototype.lastIndexOf.call(E,u,f):D(E,[u],f,k,J);throw new TypeError("val must be string, number or Buffer")}function D(E,u,f,k,J){let ie=1,oe=E.length,we=u.length;if(k!==void 0&&(k=String(k).toLowerCase(),k==="ucs2"||k==="ucs-2"||k==="utf16le"||k==="utf-16le")){if(E.length<2||u.length<2)return-1;ie=2,oe/=2,we/=2,f/=2}function Le(je,Ie){return ie===1?je[Ie]:je.readUInt16BE(Ie*ie)}let Te;if(J){let je=-1;for(Te=f;Te<oe;Te++)if(Le(E,Te)===Le(u,je===-1?0:Te-je)){if(je===-1&&(je=Te),Te-je+1===we)return je*ie}else je!==-1&&(Te-=Te-je),je=-1}else for(f+we>oe&&(f=oe-we),Te=f;Te>=0;Te--){let je=!0;for(let Ie=0;Ie<we;Ie++)if(Le(E,Te+Ie)!==Le(u,Ie)){je=!1;break}if(je)return Te}return-1}o.prototype.includes=function(u,f,k){return this.indexOf(u,f,k)!==-1},o.prototype.indexOf=function(u,f,k){return N(this,u,f,k,!0)},o.prototype.lastIndexOf=function(u,f,k){return N(this,u,f,k,!1)};function T(E,u,f,k){f=Number(f)||0;const J=E.length-f;k?(k=Number(k),k>J&&(k=J)):k=J;const ie=u.length;k>ie/2&&(k=ie/2);let oe;for(oe=0;oe<k;++oe){const we=parseInt(u.substr(oe*2,2),16);if(Ee(we))return oe;E[f+oe]=we}return oe}function q(E,u,f,k){return he(de(u,E.length-f),E,f,k)}function R(E,u,f,k){return he(pe(u),E,f,k)}function M(E,u,f,k){return he(le(u),E,f,k)}function B(E,u,f,k){return he(X(u,E.length-f),E,f,k)}o.prototype.write=function(u,f,k,J){if(f===void 0)J="utf8",k=this.length,f=0;else if(k===void 0&&typeof f=="string")J=f,k=this.length,f=0;else if(isFinite(f))f=f>>>0,isFinite(k)?(k=k>>>0,J===void 0&&(J="utf8")):(J=k,k=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const ie=this.length-f;if((k===void 0||k>ie)&&(k=ie),u.length>0&&(k<0||f<0)||f>this.length)throw new RangeError("Attempt to write outside buffer bounds");J||(J="utf8");let oe=!1;for(;;)switch(J){case"hex":return T(this,u,f,k);case"utf8":case"utf-8":return q(this,u,f,k);case"ascii":case"latin1":case"binary":return R(this,u,f,k);case"base64":return M(this,u,f,k);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,u,f,k);default:if(oe)throw new TypeError("Unknown encoding: "+J);J=(""+J).toLowerCase(),oe=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(E,u,f){return u===0&&f===E.length?e.fromByteArray(E):e.fromByteArray(E.slice(u,f))}function j(E,u,f){f=Math.min(E.length,f);const k=[];let J=u;for(;J<f;){const ie=E[J];let oe=null,we=ie>239?4:ie>223?3:ie>191?2:1;if(J+we<=f){let Le,Te,je,Ie;switch(we){case 1:ie<128&&(oe=ie);break;case 2:Le=E[J+1],(Le&192)===128&&(Ie=(ie&31)<<6|Le&63,Ie>127&&(oe=Ie));break;case 3:Le=E[J+1],Te=E[J+2],(Le&192)===128&&(Te&192)===128&&(Ie=(ie&15)<<12|(Le&63)<<6|Te&63,Ie>2047&&(Ie<55296||Ie>57343)&&(oe=Ie));break;case 4:Le=E[J+1],Te=E[J+2],je=E[J+3],(Le&192)===128&&(Te&192)===128&&(je&192)===128&&(Ie=(ie&15)<<18|(Le&63)<<12|(Te&63)<<6|je&63,Ie>65535&&Ie<1114112&&(oe=Ie))}}oe===null?(oe=65533,we=1):oe>65535&&(oe-=65536,k.push(oe>>>10&1023|55296),oe=56320|oe&1023),k.push(oe),J+=we}return L(k)}const Y=4096;function L(E){const u=E.length;if(u<=Y)return String.fromCharCode.apply(String,E);let f="",k=0;for(;k<u;)f+=String.fromCharCode.apply(String,E.slice(k,k+=Y));return f}function ee(E,u,f){let k="";f=Math.min(E.length,f);for(let J=u;J<f;++J)k+=String.fromCharCode(E[J]&127);return k}function C(E,u,f){let k="";f=Math.min(E.length,f);for(let J=u;J<f;++J)k+=String.fromCharCode(E[J]);return k}function K(E,u,f){const k=E.length;(!u||u<0)&&(u=0),(!f||f<0||f>k)&&(f=k);let J="";for(let ie=u;ie<f;++ie)J+=qe[E[ie]];return J}function v(E,u,f){const k=E.slice(u,f);let J="";for(let ie=0;ie<k.length-1;ie+=2)J+=String.fromCharCode(k[ie]+k[ie+1]*256);return J}o.prototype.slice=function(u,f){const k=this.length;u=~~u,f=f===void 0?k:~~f,u<0?(u+=k,u<0&&(u=0)):u>k&&(u=k),f<0?(f+=k,f<0&&(f=0)):f>k&&(f=k),f<u&&(f=u);const J=this.subarray(u,f);return Object.setPrototypeOf(J,o.prototype),J};function U(E,u,f){if(E%1!==0||E<0)throw new RangeError("offset is not uint");if(E+u>f)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(u,f,k){u=u>>>0,f=f>>>0,k||U(u,f,this.length);let J=this[u],ie=1,oe=0;for(;++oe<f&&(ie*=256);)J+=this[u+oe]*ie;return J},o.prototype.readUintBE=o.prototype.readUIntBE=function(u,f,k){u=u>>>0,f=f>>>0,k||U(u,f,this.length);let J=this[u+--f],ie=1;for(;f>0&&(ie*=256);)J+=this[u+--f]*ie;return J},o.prototype.readUint8=o.prototype.readUInt8=function(u,f){return u=u>>>0,f||U(u,1,this.length),this[u]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(u,f){return u=u>>>0,f||U(u,2,this.length),this[u]|this[u+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(u,f){return u=u>>>0,f||U(u,2,this.length),this[u]<<8|this[u+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(u,f){return u=u>>>0,f||U(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(u,f){return u=u>>>0,f||U(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},o.prototype.readBigUInt64LE=_e(function(u){u=u>>>0,O(u,"offset");const f=this[u],k=this[u+7];(f===void 0||k===void 0)&&G(u,this.length-8);const J=f+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24,ie=this[++u]+this[++u]*2**8+this[++u]*2**16+k*2**24;return BigInt(J)+(BigInt(ie)<<BigInt(32))}),o.prototype.readBigUInt64BE=_e(function(u){u=u>>>0,O(u,"offset");const f=this[u],k=this[u+7];(f===void 0||k===void 0)&&G(u,this.length-8);const J=f*2**24+this[++u]*2**16+this[++u]*2**8+this[++u],ie=this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+k;return(BigInt(J)<<BigInt(32))+BigInt(ie)}),o.prototype.readIntLE=function(u,f,k){u=u>>>0,f=f>>>0,k||U(u,f,this.length);let J=this[u],ie=1,oe=0;for(;++oe<f&&(ie*=256);)J+=this[u+oe]*ie;return ie*=128,J>=ie&&(J-=Math.pow(2,8*f)),J},o.prototype.readIntBE=function(u,f,k){u=u>>>0,f=f>>>0,k||U(u,f,this.length);let J=f,ie=1,oe=this[u+--J];for(;J>0&&(ie*=256);)oe+=this[u+--J]*ie;return ie*=128,oe>=ie&&(oe-=Math.pow(2,8*f)),oe},o.prototype.readInt8=function(u,f){return u=u>>>0,f||U(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},o.prototype.readInt16LE=function(u,f){u=u>>>0,f||U(u,2,this.length);const k=this[u]|this[u+1]<<8;return k&32768?k|4294901760:k},o.prototype.readInt16BE=function(u,f){u=u>>>0,f||U(u,2,this.length);const k=this[u+1]|this[u]<<8;return k&32768?k|4294901760:k},o.prototype.readInt32LE=function(u,f){return u=u>>>0,f||U(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},o.prototype.readInt32BE=function(u,f){return u=u>>>0,f||U(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},o.prototype.readBigInt64LE=_e(function(u){u=u>>>0,O(u,"offset");const f=this[u],k=this[u+7];(f===void 0||k===void 0)&&G(u,this.length-8);const J=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(k<<24);return(BigInt(J)<<BigInt(32))+BigInt(f+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24)}),o.prototype.readBigInt64BE=_e(function(u){u=u>>>0,O(u,"offset");const f=this[u],k=this[u+7];(f===void 0||k===void 0)&&G(u,this.length-8);const J=(f<<24)+this[++u]*2**16+this[++u]*2**8+this[++u];return(BigInt(J)<<BigInt(32))+BigInt(this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+k)}),o.prototype.readFloatLE=function(u,f){return u=u>>>0,f||U(u,4,this.length),t.read(this,u,!0,23,4)},o.prototype.readFloatBE=function(u,f){return u=u>>>0,f||U(u,4,this.length),t.read(this,u,!1,23,4)},o.prototype.readDoubleLE=function(u,f){return u=u>>>0,f||U(u,8,this.length),t.read(this,u,!0,52,8)},o.prototype.readDoubleBE=function(u,f){return u=u>>>0,f||U(u,8,this.length),t.read(this,u,!1,52,8)};function Q(E,u,f,k,J,ie){if(!o.isBuffer(E))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>J||u<ie)throw new RangeError('"value" argument is out of bounds');if(f+k>E.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(u,f,k,J){if(u=+u,f=f>>>0,k=k>>>0,!J){const we=Math.pow(2,8*k)-1;Q(this,u,f,k,we,0)}let ie=1,oe=0;for(this[f]=u&255;++oe<k&&(ie*=256);)this[f+oe]=u/ie&255;return f+k},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(u,f,k,J){if(u=+u,f=f>>>0,k=k>>>0,!J){const we=Math.pow(2,8*k)-1;Q(this,u,f,k,we,0)}let ie=k-1,oe=1;for(this[f+ie]=u&255;--ie>=0&&(oe*=256);)this[f+ie]=u/oe&255;return f+k},o.prototype.writeUint8=o.prototype.writeUInt8=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,1,255,0),this[f]=u&255,f+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,2,65535,0),this[f]=u&255,this[f+1]=u>>>8,f+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,2,65535,0),this[f]=u>>>8,this[f+1]=u&255,f+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,4,4294967295,0),this[f+3]=u>>>24,this[f+2]=u>>>16,this[f+1]=u>>>8,this[f]=u&255,f+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,4,4294967295,0),this[f]=u>>>24,this[f+1]=u>>>16,this[f+2]=u>>>8,this[f+3]=u&255,f+4};function z(E,u,f,k,J){fe(u,k,J,E,f,7);let ie=Number(u&BigInt(4294967295));E[f++]=ie,ie=ie>>8,E[f++]=ie,ie=ie>>8,E[f++]=ie,ie=ie>>8,E[f++]=ie;let oe=Number(u>>BigInt(32)&BigInt(4294967295));return E[f++]=oe,oe=oe>>8,E[f++]=oe,oe=oe>>8,E[f++]=oe,oe=oe>>8,E[f++]=oe,f}function ae(E,u,f,k,J){fe(u,k,J,E,f,7);let ie=Number(u&BigInt(4294967295));E[f+7]=ie,ie=ie>>8,E[f+6]=ie,ie=ie>>8,E[f+5]=ie,ie=ie>>8,E[f+4]=ie;let oe=Number(u>>BigInt(32)&BigInt(4294967295));return E[f+3]=oe,oe=oe>>8,E[f+2]=oe,oe=oe>>8,E[f+1]=oe,oe=oe>>8,E[f]=oe,f+8}o.prototype.writeBigUInt64LE=_e(function(u,f=0){return z(this,u,f,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=_e(function(u,f=0){return ae(this,u,f,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(u,f,k,J){if(u=+u,f=f>>>0,!J){const Le=Math.pow(2,8*k-1);Q(this,u,f,k,Le-1,-Le)}let ie=0,oe=1,we=0;for(this[f]=u&255;++ie<k&&(oe*=256);)u<0&&we===0&&this[f+ie-1]!==0&&(we=1),this[f+ie]=(u/oe>>0)-we&255;return f+k},o.prototype.writeIntBE=function(u,f,k,J){if(u=+u,f=f>>>0,!J){const Le=Math.pow(2,8*k-1);Q(this,u,f,k,Le-1,-Le)}let ie=k-1,oe=1,we=0;for(this[f+ie]=u&255;--ie>=0&&(oe*=256);)u<0&&we===0&&this[f+ie+1]!==0&&(we=1),this[f+ie]=(u/oe>>0)-we&255;return f+k},o.prototype.writeInt8=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,1,127,-128),u<0&&(u=255+u+1),this[f]=u&255,f+1},o.prototype.writeInt16LE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,2,32767,-32768),this[f]=u&255,this[f+1]=u>>>8,f+2},o.prototype.writeInt16BE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,2,32767,-32768),this[f]=u>>>8,this[f+1]=u&255,f+2},o.prototype.writeInt32LE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,4,2147483647,-2147483648),this[f]=u&255,this[f+1]=u>>>8,this[f+2]=u>>>16,this[f+3]=u>>>24,f+4},o.prototype.writeInt32BE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[f]=u>>>24,this[f+1]=u>>>16,this[f+2]=u>>>8,this[f+3]=u&255,f+4},o.prototype.writeBigInt64LE=_e(function(u,f=0){return z(this,u,f,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=_e(function(u,f=0){return ae(this,u,f,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function H(E,u,f,k,J,ie){if(f+k>E.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("Index out of range")}function V(E,u,f,k,J){return u=+u,f=f>>>0,J||H(E,u,f,4),t.write(E,u,f,k,23,4),f+4}o.prototype.writeFloatLE=function(u,f,k){return V(this,u,f,!0,k)},o.prototype.writeFloatBE=function(u,f,k){return V(this,u,f,!1,k)};function W(E,u,f,k,J){return u=+u,f=f>>>0,J||H(E,u,f,8),t.write(E,u,f,k,52,8),f+8}o.prototype.writeDoubleLE=function(u,f,k){return W(this,u,f,!0,k)},o.prototype.writeDoubleBE=function(u,f,k){return W(this,u,f,!1,k)},o.prototype.copy=function(u,f,k,J){if(!o.isBuffer(u))throw new TypeError("argument should be a Buffer");if(k||(k=0),!J&&J!==0&&(J=this.length),f>=u.length&&(f=u.length),f||(f=0),J>0&&J<k&&(J=k),J===k||u.length===0||this.length===0)return 0;if(f<0)throw new RangeError("targetStart out of bounds");if(k<0||k>=this.length)throw new RangeError("Index out of range");if(J<0)throw new RangeError("sourceEnd out of bounds");J>this.length&&(J=this.length),u.length-f<J-k&&(J=u.length-f+k);const ie=J-k;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(f,k,J):Uint8Array.prototype.set.call(u,this.subarray(k,J),f),ie},o.prototype.fill=function(u,f,k,J){if(typeof u=="string"){if(typeof f=="string"?(J=f,f=0,k=this.length):typeof k=="string"&&(J=k,k=this.length),J!==void 0&&typeof J!="string")throw new TypeError("encoding must be a string");if(typeof J=="string"&&!o.isEncoding(J))throw new TypeError("Unknown encoding: "+J);if(u.length===1){const oe=u.charCodeAt(0);(J==="utf8"&&oe<128||J==="latin1")&&(u=oe)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(f<0||this.length<f||this.length<k)throw new RangeError("Out of range index");if(k<=f)return this;f=f>>>0,k=k===void 0?this.length:k>>>0,u||(u=0);let ie;if(typeof u=="number")for(ie=f;ie<k;++ie)this[ie]=u;else{const oe=o.isBuffer(u)?u:o.from(u,J),we=oe.length;if(we===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(ie=0;ie<k-f;++ie)this[ie+f]=oe[ie%we]}return this};const F={};function Z(E,u,f){F[E]=class extends f{constructor(){super(),Object.defineProperty(this,"message",{value:u.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${E}]`,this.stack,delete this.name}get code(){return E}set code(J){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:J,writable:!0})}toString(){return`${this.name} [${E}]: ${this.message}`}}}Z("ERR_BUFFER_OUT_OF_BOUNDS",function(E){return E?`${E} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Z("ERR_INVALID_ARG_TYPE",function(E,u){return`The "${E}" argument must be of type number. Received type ${typeof u}`},TypeError),Z("ERR_OUT_OF_RANGE",function(E,u,f){let k=`The value of "${E}" is out of range.`,J=f;return Number.isInteger(f)&&Math.abs(f)>2**32?J=te(String(f)):typeof f=="bigint"&&(J=String(f),(f>BigInt(2)**BigInt(32)||f<-(BigInt(2)**BigInt(32)))&&(J=te(J)),J+="n"),k+=` It must be ${u}. Received ${J}`,k},RangeError);function te(E){let u="",f=E.length;const k=E[0]==="-"?1:0;for(;f>=k+4;f-=3)u=`_${E.slice(f-3,f)}${u}`;return`${E.slice(0,f)}${u}`}function ce(E,u,f){O(u,"offset"),(E[u]===void 0||E[u+f]===void 0)&&G(u,E.length-(f+1))}function fe(E,u,f,k,J,ie){if(E>f||E<u){const oe=typeof u=="bigint"?"n":"";let we;throw u===0||u===BigInt(0)?we=`>= 0${oe} and < 2${oe} ** ${(ie+1)*8}${oe}`:we=`>= -(2${oe} ** ${(ie+1)*8-1}${oe}) and < 2 ** ${(ie+1)*8-1}${oe}`,new F.ERR_OUT_OF_RANGE("value",we,E)}ce(k,J,ie)}function O(E,u){if(typeof E!="number")throw new F.ERR_INVALID_ARG_TYPE(u,"number",E)}function G(E,u,f){throw Math.floor(E)!==E?(O(E,f),new F.ERR_OUT_OF_RANGE("offset","an integer",E)):u<0?new F.ERR_BUFFER_OUT_OF_BOUNDS:new F.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${u}`,E)}const re=/[^+/0-9A-Za-z-_]/g;function ue(E){if(E=E.split("=")[0],E=E.trim().replace(re,""),E.length<2)return"";for(;E.length%4!==0;)E=E+"=";return E}function de(E,u){u=u||1/0;let f;const k=E.length;let J=null;const ie=[];for(let oe=0;oe<k;++oe){if(f=E.charCodeAt(oe),f>55295&&f<57344){if(!J){if(f>56319){(u-=3)>-1&&ie.push(239,191,189);continue}else if(oe+1===k){(u-=3)>-1&&ie.push(239,191,189);continue}J=f;continue}if(f<56320){(u-=3)>-1&&ie.push(239,191,189),J=f;continue}f=(J-55296<<10|f-56320)+65536}else J&&(u-=3)>-1&&ie.push(239,191,189);if(J=null,f<128){if((u-=1)<0)break;ie.push(f)}else if(f<2048){if((u-=2)<0)break;ie.push(f>>6|192,f&63|128)}else if(f<65536){if((u-=3)<0)break;ie.push(f>>12|224,f>>6&63|128,f&63|128)}else if(f<1114112){if((u-=4)<0)break;ie.push(f>>18|240,f>>12&63|128,f>>6&63|128,f&63|128)}else throw new Error("Invalid code point")}return ie}function pe(E){const u=[];for(let f=0;f<E.length;++f)u.push(E.charCodeAt(f)&255);return u}function X(E,u){let f,k,J;const ie=[];for(let oe=0;oe<E.length&&!((u-=2)<0);++oe)f=E.charCodeAt(oe),k=f>>8,J=f%256,ie.push(J),ie.push(k);return ie}function le(E){return e.toByteArray(ue(E))}function he(E,u,f,k){let J;for(J=0;J<k&&!(J+f>=u.length||J>=E.length);++J)u[J+f]=E[J];return J}function se(E,u){return E instanceof u||E!=null&&E.constructor!=null&&E.constructor.name!=null&&E.constructor.name===u.name}function Ee(E){return E!==E}const qe=function(){const E="0123456789abcdef",u=new Array(256);for(let f=0;f<16;++f){const k=f*16;for(let J=0;J<16;++J)u[k+J]=E[f]+E[J]}return u}();function _e(E){return typeof BigInt>"u"?He:E}function He(){throw new Error("BigInt not supported")}}(Vn)),Vn}var Ic=bt();const gr="http://www.w3.org/1999/02/22-rdf-syntax-ns#",yr="http://www.w3.org/2001/XMLSchema#",en="http://www.w3.org/2000/10/swap/",Pe={xsd:{decimal:`${yr}decimal`,boolean:`${yr}boolean`,double:`${yr}double`,integer:`${yr}integer`,string:`${yr}string`},rdf:{type:`${gr}type`,nil:`${gr}nil`,first:`${gr}first`,rest:`${gr}rest`,langString:`${gr}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${en}reify#forSome`,forAll:`${en}reify#forAll`},log:{implies:`${en}log#implies`,isImpliedBy:`${en}log#isImpliedBy`}},{xsd:tn}=Pe,Rc=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Ta={"\\":"\\","'":"'",'"':'"',n:`
7
- `,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Nc=/[\x00-\x20<>\\"\{\}\|\^\`]/,Tc={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},Ac=/$0^/;class Lc{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 Tc)&&this[t]instanceof RegExp&&(this[t]=Ac)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let n=this._input,i=n.length;for(;;){let o,l;for(;o=this._newline.exec(n);)this.comments&&(l=this._comment.exec(o[0]))&&s("comment",l[1],"",this._line,o[0].length),n=n.substr(o[0].length,n.length),i=n.length,this._line++;if(!o&&(o=this._whitespace.exec(n))&&(n=n.substr(o[0].length,n.length)),this._endOfFile.test(n))return t&&(this.comments&&(l=this._comment.exec(n))&&s("comment",l[1],"",this._line,n.length),n=null,s("eof","","",this._line,0)),this._input=n;const d=this._line,h=n[0];let y="",w="",g="",m=null,_=0,x=!1;switch(h){case"^":if(n.length<3)break;if(n[1]==="^"){if(this._previousMarker="^^",n=n.substr(2),n[0]!=="<"){x=!0;break}}else{this._n3Mode&&(_=1,y="^");break}case"<":if(m=this._unescapedIri.exec(n))y="IRI",w=m[1];else if(m=this._iri.exec(n)){if(w=this._unescape(m[1]),w===null||Nc.test(w))return a(this);y="IRI"}else n.length>1&&n[1]==="<"?(y="<<",_=2):this._n3Mode&&n.length>1&&n[1]==="="&&(_=2,this._isImpliedBy?(y="abbreviation",w="<"):(y="inverse",w=">"));break;case">":n.length>1&&n[1]===">"&&(y=">>",_=2);break;case"_":((m=this._blank.exec(n))||t&&(m=this._blank.exec(`${n} `)))&&(y="blank",g="_",w=m[1]);break;case'"':if(m=this._simpleQuotedString.exec(n))w=m[1];else if({value:w,matchLength:_}=this._parseLiteral(n),w===null)return a(this);(m!==null||_!==0)&&(y="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(m=this._simpleApostropheString.exec(n))w=m[1];else if({value:w,matchLength:_}=this._parseLiteral(n),w===null)return a(this);(m!==null||_!==0)&&(y="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(m=this._variable.exec(n))&&(y="var",w=m[0]);break;case"@":this._previousMarker==="literal"&&(m=this._langcode.exec(n))?(y="langcode",w=m[1]):(m=this._keyword.exec(n))&&(y=m[0]);break;case".":if(n.length===1?t:n[1]<"0"||n[1]>"9"){y=".",_=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(m=this._number.exec(n)||t&&(m=this._number.exec(`${n} `)))&&(y="literal",w=m[0],g=typeof m[1]=="string"?tn.double:typeof m[2]=="string"?tn.decimal:tn.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(m=this._sparqlKeyword.exec(n))?y=m[0].toUpperCase():x=!0;break;case"f":case"t":(m=this._boolean.exec(n))?(y="literal",w=m[0],g=tn.boolean):x=!0;break;case"a":(m=this._shortPredicates.exec(n))?(y="abbreviation",w="a"):x=!0;break;case"=":this._n3Mode&&n.length>1&&(y="abbreviation",n[1]!==">"?(_=1,w="="):(_=2,w=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(_=1,y=h);break;case"{":!this._lineMode&&n.length>=2&&(n[1]==="|"?(y="{|",_=2):(y=h,_=1));break;case"|":n.length>=2&&n[1]==="}"&&(y="|}",_=2);break;default:x=!0}if(x&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(m=this._prefix.exec(n))?(y="prefix",w=m[1]||""):((m=this._prefixed.exec(n))||t&&(m=this._prefixed.exec(`${n} `)))&&(y="prefixed",g=m[1]||"",w=this._unescape(m[2]))),this._previousMarker==="^^")switch(y){case"prefixed":y="type";break;case"IRI":y="typeIRI";break;default:y=""}if(!y)return t||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?a(this):this._input=n;const S=_||m[0].length,I=s(y,w,g,d,S);this.previousToken=I,this._previousMarker=y,n=n.substr(S,n.length)}function s(o,l,d,h,y){const w=n?i-n.length:i,g=w+y,m={type:o,value:l,prefix:d,line:h,start:w,end:g};return e(null,m),m}function a(o){e(o._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(e){let t=!1;const n=e.replace(Rc,(i,s,a,o)=>{if(typeof s=="string")return String.fromCharCode(Number.parseInt(s,16));if(typeof a=="string"){let l=Number.parseInt(a,16);return l<=65535?String.fromCharCode(Number.parseInt(a,16)):String.fromCharCode(55296+((l-=65536)>>10),56320+(l&1023))}return o in Ta?Ta[o]:(t=!0,"")});return t?null:n}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],n=t.length;let i=Math.max(this._literalClosingPos,n);for(;(i=e.indexOf(t,i))>0;){let s=0;for(;e[i-s-1]==="\\";)s++;if(s%2===0){const a=e.substring(n,i),o=a.split(/\r\n|\r|\n/).length-1,l=i+n;if(n===1&&o!==0||n===3&&this._lineMode)break;return this._line+=o,{value:this._unescape(a),matchLength:l}}i++}this._literalClosingPos=e.length-n+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;const t=new Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith("\uFEFF")?e.substr(1):e}tokenize(e,t){if(this._line=1,typeof e=="string")if(this._input=this._readStartingBom(e),typeof t=="function")queueMicrotask(()=>this._tokenizeToEnd(t,!0));else{const n=[];let i;if(this._tokenizeToEnd((s,a)=>s?i=s:n.push(a),!0),i)throw i;return n}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",n=>{this._input!==null&&n.length!==0&&(this._pendingBuffer&&(n=Ic.Buffer.concat([this._pendingBuffer,n]),this._pendingBuffer=null),n[n.length-1]&128?this._pendingBuffer=n:(typeof this._input>"u"?this._input=this._readStartingBom(typeof n=="string"?n:n.toString()):this._input+=n,this._tokenizeToEnd(t,!1)))}),e.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(t,!0)}),e.on("error",t)}}const{rdf:jc,xsd:Mt}=Pe;let lr,Oc=0;const xe={namedNode:du,blankNode:fu,variable:pu,literal:hu,defaultGraph:Mc,quad:Is,triple:Is,fromTerm:Mr,fromQuad:gu};class at{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof at?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 Rn=class extends at{get termType(){return"NamedNode"}},Ze=class cu extends at{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 Rn(this.datatypeString)}get datatypeString(){const e=this.id,t=e.lastIndexOf('"')+1,n=t<e.length?e[t]:"";return n==="^"?e.substr(t+2):n!=="@"?Mt.string:jc.langString}equals(e){return e instanceof cu?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}}}},$c=class extends at{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},kc=class extends at{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},Dc=class extends at{constructor(){return super(""),lr||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};lr=new Dc;function Dr(r,e,t){if(e=e||xe,!r)return e.defaultGraph();switch(r[0]){case"?":return e.variable(r.substr(1));case"_":return e.blankNode(r.substr(2));case'"':if(e===xe)return new Ze(r);if(r[r.length-1]==='"')return e.literal(r.substr(1,r.length-2));const n=r.lastIndexOf('"',r.length-1);return e.literal(r.substr(1,n-1),r[n+1]==="@"?r.substr(n+2):e.namedNode(r.substr(n+3)));case"[":r=JSON.parse(r);break;default:if(!t||!Array.isArray(r))return e.namedNode(r)}return e.quad(Dr(r[0],e,!0),Dr(r[1],e,!0),Dr(r[2],e,!0),r[3]&&Dr(r[3],e,!0))}function er(r,e){if(typeof r=="string")return r;if(r instanceof at&&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!==Mt.string?`^^${r.datatype.value}`:""}`;case"Quad":const t=[er(r.subject,!0),er(r.predicate,!0),er(r.object,!0)];return r.graph&&r.graph.termType!=="DefaultGraph"&&t.push(er(r.graph,!0)),e?t:JSON.stringify(t);default:throw new Error(`Unexpected termType: ${r.termType}`)}}let Nn=class extends at{constructor(e,t,n,i){super(""),this._subject=e,this._predicate=t,this._object=n,this._graph=i||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 du(r){return new Rn(r)}function fu(r){return new $c(r||`n3-${Oc++}`)}function hu(r,e){if(typeof e=="string")return new Ze(`"${r}"@${e.toLowerCase()}`);let t=e?e.value:"";return t===""&&(typeof r=="boolean"?t=Mt.boolean:typeof r=="number"&&(Number.isFinite(r)?t=Number.isInteger(r)?Mt.integer:Mt.double:(t=Mt.double,Number.isNaN(r)||(r=r>0?"INF":"-INF")))),t===""||t===Mt.string?new Ze(`"${r}"`):new Ze(`"${r}"^^${t}`)}function pu(r){return new kc(r)}function Mc(){return lr}function Is(r,e,t,n){return new Nn(r,e,t,n)}function Mr(r){if(r instanceof at)return r;switch(r.termType){case"NamedNode":return du(r.value);case"BlankNode":return fu(r.value);case"Variable":return pu(r.value);case"DefaultGraph":return lr;case"Literal":return hu(r.value,r.language||r.datatype);case"Quad":return gu(r);default:throw new Error(`Unexpected termType: ${r.termType}`)}}function gu(r){if(r instanceof Nn)return r;if(r.termType!=="Quad")throw new Error(`Unexpected termType: ${r.termType}`);return Is(Mr(r.subject),Mr(r.predicate),Mr(r.object),Mr(r.graph))}let Aa=0;class Rs{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&yu(this,e.factory);const t=typeof e.format=="string"?e.format.match(/\w*$/)[0].toLowerCase():"",n=/turtle/.test(t),i=/trig/.test(t),s=/triple/.test(t),a=/quad/.test(t),o=this._n3Mode=/n3/.test(t),l=s||a;(this._supportsNamedGraphs=!(n||o))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(n||i||s||o),this._isImpliedBy=e.isImpliedBy,this._supportsRDFStar=t===""||/star|\*$/.test(t),l&&(this._resolveRelativeIRI=d=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new Lc({lineMode:l,n3:o,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){Aa=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,n,i,s){const a=this._n3Mode;this._contextStack.push({type:e,subject:n,predicate:i,object:s,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 n=this._contextStack.pop();if(!n||n.type!==e)return this._error(`Unexpected ${t.type}`,t);this._subject=n.subject,this._predicate=n.predicate,this._object=n.object,this._graph=n.graph,this._n3Mode&&(this._inversePredicate=n.inverse,this._prefixes._=n.blankPrefix,this._quantified=n.quantified)}_readInTopContext(e){switch(e.type){case"eof":return 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 n;switch(e.type){case"IRI":case"typeIRI":const i=this._resolveIRI(e.value);if(i===null)return this._error("Invalid IRI",e);n=this._factory.namedNode(i);break;case"type":case"prefixed":const s=this._prefixes[e.prefix];if(s===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);n=this._factory.namedNode(s+e.value);break;case"blank":n=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case"var":n=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!t&&this._n3Mode&&n.id in this._quantified&&(n=this._quantified[n.id]),n}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._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,n=null,i=this._readListItem;const s=this._subject,a=this._contextStack,o=a[a.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,n=this._factory.blankNode(),this.RDF_FIRST,this._subject=t=this._factory.blankNode()),i=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,n=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),a.length!==0&&a[a.length-1].type==="list"&&this._emit(this._subject,this._predicate,this._object,this._graph),this._predicate===null){if(i=this._readPredicate,this._subject===this.RDF_NIL)return i}else if(i=this._getContextEndReader(),this._object===this.RDF_NIL)return i;n=this.RDF_NIL;break;case"literal":e.prefix.length===0?(this._literalValue=e.value,i=this._readListItemDataTypeOrLang):(t=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),i=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if((t=this._readEntity(e))===void 0)return}if(n===null&&(this._subject=n=this._factory.blankNode()),s===null?o.predicate===null?o.subject=n:o.object=n:this._emit(s,this.RDF_REST,n,this._graph),t!==null){if(this._n3Mode&&(e.type==="IRI"||e.type==="prefixed"))return this._saveContext("item",this._graph,n,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(n,this.RDF_FIRST,t,this._graph)}return i}_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 n=this._readEntity(e);if(n===void 0)return;t=this._factory.literal(this._literalValue,n),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 n=this._completeLiteral(e);if(n)return this._object=n.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),n.token===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(n.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,n=this._graph;const i=this._subject,s=this._inversePredicate;switch(e.type){case"}":if(this._graph===null)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,s&&(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,o=this._object;this._subject=this._factory.quad(i,a,o,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&&(n=this._readEntity(e))!==void 0){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(i!==null){const a=this._predicate,o=this._object;s?this._emit(o,a,i,n):this._emit(i,a,o,n)}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),t}_readQuadPunctuation(e){return e.type!=="."?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return 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,n=t.length&&t[t.length-1];if(n&&n.type==="item"){const i=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,i,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let t,n;const i=this._factory.blankNode();if((n=this._readEntity(e))!==void 0)return this._predicate===null?(t=this._subject,this._subject=i):(t=this._object,this._object=i),this._emit(t,n,i,this._graph),this._readPath}_readBackwardPath(e){const t=this._factory.blankNode();let n,i;if((n=this._readEntity(e))!==void 0)return this._predicate===null?(i=this._subject,this._subject=t):(i=this._object,this._object=t),this._emit(t,n,i,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,n,i){this._callback(null,this._factory.quad(e,t,n,i||this.DEFAULTGRAPH))}_error(e,t){const n=new Error(`${e} on line ${t.line}.`);n.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=rn}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return(e[1]==="/"?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;const t=e.length;let n="",i=-1,s=-1,a=0,o="/";for(;i<t;){switch(o){case":":if(s<0&&e[++i]==="/"&&e[++i]==="/")for(;(s=i+1)<t&&e[s]!=="/";)i=s;break;case"?":case"#":i=t;break;case"/":if(e[i+1]===".")switch(o=e[++i+1],o){case"/":n+=e.substring(a,i-1),a=i+1;break;case void 0:case"?":case"#":return n+e.substring(a,i)+e.substr(i+1);case".":if(o=e[++i+1],o===void 0||o==="/"||o==="?"||o==="#"){if(n+=e.substring(a,i-2),(a=n.lastIndexOf("/"))>=s&&(n=n.substr(0,a)),o!=="/")return`${n}/${e.substr(i+1)}`;a=i+1}}}o=e[++i]}return n+e.substring(a)}parse(e,t,n){let i,s,a;if(t&&(t.onQuad||t.onPrefix||t.onComment)?(i=t.onQuad,s=t.onPrefix,a=t.onComment):(i=t,s=n),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Aa++}_`,this._prefixCallback=s||rn,this._inversePredicate=!1,this._quantified=Object.create(null),!i){const l=[];let d;if(this._callback=(h,y)=>{h?d=h:y&&l.push(y)},this._lexer.tokenize(e).every(h=>this._readCallback=this._readCallback(h)),d)throw d;return l}let o=(l,d)=>{l!==null?(this._callback(l),this._callback=rn):this._readCallback&&(this._readCallback=this._readCallback(d))};a&&(this._lexer.comments=!0,o=(l,d)=>{l!==null?(this._callback(l),this._callback=rn):this._readCallback&&(d.type==="comment"?a(d.value):this._readCallback=this._readCallback(d))}),this._callback=i,this._lexer.tokenize(e,o)}}function rn(){}function yu(r,e){r._factory=e,r.DEFAULTGRAPH=e.defaultGraph(),r.RDF_FIRST=e.namedNode(Pe.rdf.first),r.RDF_REST=e.namedNode(Pe.rdf.rest),r.RDF_NIL=e.namedNode(Pe.rdf.nil),r.N3_FORALL=e.namedNode(Pe.r.forAll),r.N3_FORSOME=e.namedNode(Pe.r.forSome),r.ABBREVIATIONS={a:e.namedNode(Pe.rdf.type),"=":e.namedNode(Pe.owl.sameAs),">":e.namedNode(Pe.log.implies),"<":e.namedNode(Pe.log.isImpliedBy)},r.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}yu(Rs.prototype,xe);function Ns(r){return!!r&&r.termType==="DefaultGraph"}function dn(r){return r.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const Cc=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Pc=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,La="./",qc="../",Gn="?",ja="#";class qs{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!Cc.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!qs.supports(this.base))return this._baseMatcher=/.^/;const e=/^[^:]*:\/*/.exec(this.base)[0],t=["^",dn(e)],n=[],i=[],s=/[^/?#]*([/?#])/y;let a,o=0,l=0,d=s.lastIndex=e.length;for(;!o&&!l&&(a=s.exec(this.base));)a[1]===ja?l=s.lastIndex-1:(t.push(dn(a[0]),"(?:"),n.push(")?"),a[1]!==Gn?i.push(d=s.lastIndex):(o=d=s.lastIndex,l=this.base.indexOf(ja,o),this._pathReplacements[o]=Gn));for(let h=0;h<i.length;h++)this._pathReplacements[i[h]]=qc.repeat(i.length-h-1);return this._pathReplacements[i[i.length-1]]=La,this._baseLength=l>0?l:this.base.length,t.push(dn(this.base.substring(d,this._baseLength)),o?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...t,...n].join(""))}toRelative(e){const t=this._getBaseMatcher().exec(e);if(!t)return e;const n=t[0].length;if(n===this._baseLength&&n===e.length)return"";const i=this._pathReplacements[n];if(i){const s=e.substring(n);return i!==Gn&&!Pc.test(s)?e:i===La&&/^[^?#]/.test(s)?s:i+s}return e.substring(n-1)}}const mr=xe.defaultGraph(),{rdf:Bc,xsd:Qt}=Pe,Oa=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,$a=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Fc={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class br extends at{equals(e){return e===this}}class Bs{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 n="";this._outputStream={write(i,s,a){n+=i,a&&a()},end:i=>{i&&i(null,n)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=mr,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new qs(t.baseIRI)))}get _inDefaultGraph(){return mr.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t)}_writeQuad(e,t,n,i,s){try{i.equals(this._graph)||(this._write((this._subject===null?"":this._inDefaultGraph?`.
6
+ */var Qa;function Lt(){return Qa||(Qa=1,function(r){const e=id(),t=sd(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=o,r.SlowBuffer=S,r.INSPECT_MAX_BYTES=50;const i=2147483647;r.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=s(),!o.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 s(){try{const N=new Uint8Array(1),f={foo:function(){return 42}};return Object.setPrototypeOf(f,Uint8Array.prototype),Object.setPrototypeOf(N,f),N.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function a(N){if(N>i)throw new RangeError('The value "'+N+'" is invalid for option "size"');const f=new Uint8Array(N);return Object.setPrototypeOf(f,o.prototype),f}function o(N,f,p){if(typeof N=="number"){if(typeof f=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(N)}return u(N,f,p)}o.poolSize=8192;function u(N,f,p){if(typeof N=="string")return m(N,f);if(ArrayBuffer.isView(N))return _(N);if(N==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof N);if(le(N,ArrayBuffer)||N&&le(N.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(le(N,SharedArrayBuffer)||N&&le(N.buffer,SharedArrayBuffer)))return x(N,f,p);if(typeof N=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const $=N.valueOf&&N.valueOf();if($!=null&&$!==N)return o.from($,f,p);const Q=E(N);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof N[Symbol.toPrimitive]=="function")return o.from(N[Symbol.toPrimitive]("string"),f,p);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof N)}o.from=function(N,f,p){return u(N,f,p)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function l(N){if(typeof N!="number")throw new TypeError('"size" argument must be of type number');if(N<0)throw new RangeError('The value "'+N+'" is invalid for option "size"')}function c(N,f,p){return l(N),N<=0?a(N):f!==void 0?typeof p=="string"?a(N).fill(f,p):a(N).fill(f):a(N)}o.alloc=function(N,f,p){return c(N,f,p)};function d(N){return l(N),a(N<0?0:v(N)|0)}o.allocUnsafe=function(N){return d(N)},o.allocUnsafeSlow=function(N){return d(N)};function m(N,f){if((typeof f!="string"||f==="")&&(f="utf8"),!o.isEncoding(f))throw new TypeError("Unknown encoding: "+f);const p=y(N,f)|0;let $=a(p);const Q=$.write(N,f);return Q!==p&&($=$.slice(0,Q)),$}function b(N){const f=N.length<0?0:v(N.length)|0,p=a(f);for(let $=0;$<f;$+=1)p[$]=N[$]&255;return p}function _(N){if(le(N,Uint8Array)){const f=new Uint8Array(N);return x(f.buffer,f.byteOffset,f.byteLength)}return b(N)}function x(N,f,p){if(f<0||N.byteLength<f)throw new RangeError('"offset" is outside of buffer bounds');if(N.byteLength<f+(p||0))throw new RangeError('"length" is outside of buffer bounds');let $;return f===void 0&&p===void 0?$=new Uint8Array(N):p===void 0?$=new Uint8Array(N,f):$=new Uint8Array(N,f,p),Object.setPrototypeOf($,o.prototype),$}function E(N){if(o.isBuffer(N)){const f=v(N.length)|0,p=a(f);return p.length===0||N.copy(p,0,0,f),p}if(N.length!==void 0)return typeof N.length!="number"||Ne(N.length)?a(0):b(N);if(N.type==="Buffer"&&Array.isArray(N.data))return b(N.data)}function v(N){if(N>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return N|0}function S(N){return+N!=N&&(N=0),o.alloc(+N)}o.isBuffer=function(f){return f!=null&&f._isBuffer===!0&&f!==o.prototype},o.compare=function(f,p){if(le(f,Uint8Array)&&(f=o.from(f,f.offset,f.byteLength)),le(p,Uint8Array)&&(p=o.from(p,p.offset,p.byteLength)),!o.isBuffer(f)||!o.isBuffer(p))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(f===p)return 0;let $=f.length,Q=p.length;for(let oe=0,de=Math.min($,Q);oe<de;++oe)if(f[oe]!==p[oe]){$=f[oe],Q=p[oe];break}return $<Q?-1:Q<$?1:0},o.isEncoding=function(f){switch(String(f).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}},o.concat=function(f,p){if(!Array.isArray(f))throw new TypeError('"list" argument must be an Array of Buffers');if(f.length===0)return o.alloc(0);let $;if(p===void 0)for(p=0,$=0;$<f.length;++$)p+=f[$].length;const Q=o.allocUnsafe(p);let oe=0;for($=0;$<f.length;++$){let de=f[$];if(le(de,Uint8Array))oe+de.length>Q.length?(o.isBuffer(de)||(de=o.from(de)),de.copy(Q,oe)):Uint8Array.prototype.set.call(Q,de,oe);else if(o.isBuffer(de))de.copy(Q,oe);else throw new TypeError('"list" argument must be an Array of Buffers');oe+=de.length}return Q};function y(N,f){if(o.isBuffer(N))return N.length;if(ArrayBuffer.isView(N)||le(N,ArrayBuffer))return N.byteLength;if(typeof N!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof N);const p=N.length,$=arguments.length>2&&arguments[2]===!0;if(!$&&p===0)return 0;let Q=!1;for(;;)switch(f){case"ascii":case"latin1":case"binary":return p;case"utf8":case"utf-8":return pe(N).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return p*2;case"hex":return p>>>1;case"base64":return ce(N).length;default:if(Q)return $?-1:pe(N).length;f=(""+f).toLowerCase(),Q=!0}}o.byteLength=y;function h(N,f,p){let $=!1;if((f===void 0||f<0)&&(f=0),f>this.length||((p===void 0||p>this.length)&&(p=this.length),p<=0)||(p>>>=0,f>>>=0,p<=f))return"";for(N||(N="utf8");;)switch(N){case"hex":return Y(this,f,p);case"utf8":case"utf-8":return O(this,f,p);case"ascii":return Z(this,f,p);case"latin1":case"binary":return k(this,f,p);case"base64":return D(this,f,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,f,p);default:if($)throw new TypeError("Unknown encoding: "+N);N=(N+"").toLowerCase(),$=!0}}o.prototype._isBuffer=!0;function g(N,f,p){const $=N[f];N[f]=N[p],N[p]=$}o.prototype.swap16=function(){const f=this.length;if(f%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let p=0;p<f;p+=2)g(this,p,p+1);return this},o.prototype.swap32=function(){const f=this.length;if(f%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let p=0;p<f;p+=4)g(this,p,p+3),g(this,p+1,p+2);return this},o.prototype.swap64=function(){const f=this.length;if(f%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let p=0;p<f;p+=8)g(this,p,p+7),g(this,p+1,p+6),g(this,p+2,p+5),g(this,p+3,p+4);return this},o.prototype.toString=function(){const f=this.length;return f===0?"":arguments.length===0?O(this,0,f):h.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(f){if(!o.isBuffer(f))throw new TypeError("Argument must be a Buffer");return this===f?!0:o.compare(this,f)===0},o.prototype.inspect=function(){let f="";const p=r.INSPECT_MAX_BYTES;return f=this.toString("hex",0,p).replace(/(.{2})/g,"$1 ").trim(),this.length>p&&(f+=" ... "),"<Buffer "+f+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(f,p,$,Q,oe){if(le(f,Uint8Array)&&(f=o.from(f,f.offset,f.byteLength)),!o.isBuffer(f))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof f);if(p===void 0&&(p=0),$===void 0&&($=f?f.length:0),Q===void 0&&(Q=0),oe===void 0&&(oe=this.length),p<0||$>f.length||Q<0||oe>this.length)throw new RangeError("out of range index");if(Q>=oe&&p>=$)return 0;if(Q>=oe)return-1;if(p>=$)return 1;if(p>>>=0,$>>>=0,Q>>>=0,oe>>>=0,this===f)return 0;let de=oe-Q,Ee=$-p;const ke=Math.min(de,Ee),Oe=this.slice(Q,oe),Le=f.slice(p,$);for(let De=0;De<ke;++De)if(Oe[De]!==Le[De]){de=Oe[De],Ee=Le[De];break}return de<Ee?-1:Ee<de?1:0};function I(N,f,p,$,Q){if(N.length===0)return-1;if(typeof p=="string"?($=p,p=0):p>2147483647?p=2147483647:p<-2147483648&&(p=-2147483648),p=+p,Ne(p)&&(p=Q?0:N.length-1),p<0&&(p=N.length+p),p>=N.length){if(Q)return-1;p=N.length-1}else if(p<0)if(Q)p=0;else return-1;if(typeof f=="string"&&(f=o.from(f,$)),o.isBuffer(f))return f.length===0?-1:C(N,f,p,$,Q);if(typeof f=="number")return f=f&255,typeof Uint8Array.prototype.indexOf=="function"?Q?Uint8Array.prototype.indexOf.call(N,f,p):Uint8Array.prototype.lastIndexOf.call(N,f,p):C(N,[f],p,$,Q);throw new TypeError("val must be string, number or Buffer")}function C(N,f,p,$,Q){let oe=1,de=N.length,Ee=f.length;if($!==void 0&&($=String($).toLowerCase(),$==="ucs2"||$==="ucs-2"||$==="utf16le"||$==="utf-16le")){if(N.length<2||f.length<2)return-1;oe=2,de/=2,Ee/=2,p/=2}function ke(Le,De){return oe===1?Le[De]:Le.readUInt16BE(De*oe)}let Oe;if(Q){let Le=-1;for(Oe=p;Oe<de;Oe++)if(ke(N,Oe)===ke(f,Le===-1?0:Oe-Le)){if(Le===-1&&(Le=Oe),Oe-Le+1===Ee)return Le*oe}else Le!==-1&&(Oe-=Oe-Le),Le=-1}else for(p+Ee>de&&(p=de-Ee),Oe=p;Oe>=0;Oe--){let Le=!0;for(let De=0;De<Ee;De++)if(ke(N,Oe+De)!==ke(f,De)){Le=!1;break}if(Le)return Oe}return-1}o.prototype.includes=function(f,p,$){return this.indexOf(f,p,$)!==-1},o.prototype.indexOf=function(f,p,$){return I(this,f,p,$,!0)},o.prototype.lastIndexOf=function(f,p,$){return I(this,f,p,$,!1)};function A(N,f,p,$){p=Number(p)||0;const Q=N.length-p;$?($=Number($),$>Q&&($=Q)):$=Q;const oe=f.length;$>oe/2&&($=oe/2);let de;for(de=0;de<$;++de){const Ee=parseInt(f.substr(de*2,2),16);if(Ne(Ee))return de;N[p+de]=Ee}return de}function B(N,f,p,$){return ye(pe(f,N.length-p),N,p,$)}function R(N,f,p,$){return ye(me(f),N,p,$)}function F(N,f,p,$){return ye(ce(f),N,p,$)}function q(N,f,p,$){return ye(J(f,N.length-p),N,p,$)}o.prototype.write=function(f,p,$,Q){if(p===void 0)Q="utf8",$=this.length,p=0;else if($===void 0&&typeof p=="string")Q=p,$=this.length,p=0;else if(isFinite(p))p=p>>>0,isFinite($)?($=$>>>0,Q===void 0&&(Q="utf8")):(Q=$,$=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const oe=this.length-p;if(($===void 0||$>oe)&&($=oe),f.length>0&&($<0||p<0)||p>this.length)throw new RangeError("Attempt to write outside buffer bounds");Q||(Q="utf8");let de=!1;for(;;)switch(Q){case"hex":return A(this,f,p,$);case"utf8":case"utf-8":return B(this,f,p,$);case"ascii":case"latin1":case"binary":return R(this,f,p,$);case"base64":return F(this,f,p,$);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,f,p,$);default:if(de)throw new TypeError("Unknown encoding: "+Q);Q=(""+Q).toLowerCase(),de=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function D(N,f,p){return f===0&&p===N.length?e.fromByteArray(N):e.fromByteArray(N.slice(f,p))}function O(N,f,p){p=Math.min(N.length,p);const $=[];let Q=f;for(;Q<p;){const oe=N[Q];let de=null,Ee=oe>239?4:oe>223?3:oe>191?2:1;if(Q+Ee<=p){let ke,Oe,Le,De;switch(Ee){case 1:oe<128&&(de=oe);break;case 2:ke=N[Q+1],(ke&192)===128&&(De=(oe&31)<<6|ke&63,De>127&&(de=De));break;case 3:ke=N[Q+1],Oe=N[Q+2],(ke&192)===128&&(Oe&192)===128&&(De=(oe&15)<<12|(ke&63)<<6|Oe&63,De>2047&&(De<55296||De>57343)&&(de=De));break;case 4:ke=N[Q+1],Oe=N[Q+2],Le=N[Q+3],(ke&192)===128&&(Oe&192)===128&&(Le&192)===128&&(De=(oe&15)<<18|(ke&63)<<12|(Oe&63)<<6|Le&63,De>65535&&De<1114112&&(de=De))}}de===null?(de=65533,Ee=1):de>65535&&(de-=65536,$.push(de>>>10&1023|55296),de=56320|de&1023),$.push(de),Q+=Ee}return T($)}const te=4096;function T(N){const f=N.length;if(f<=te)return String.fromCharCode.apply(String,N);let p="",$=0;for(;$<f;)p+=String.fromCharCode.apply(String,N.slice($,$+=te));return p}function Z(N,f,p){let $="";p=Math.min(N.length,p);for(let Q=f;Q<p;++Q)$+=String.fromCharCode(N[Q]&127);return $}function k(N,f,p){let $="";p=Math.min(N.length,p);for(let Q=f;Q<p;++Q)$+=String.fromCharCode(N[Q]);return $}function Y(N,f,p){const $=N.length;(!f||f<0)&&(f=0),(!p||p<0||p>$)&&(p=$);let Q="";for(let oe=f;oe<p;++oe)Q+=ze[N[oe]];return Q}function w(N,f,p){const $=N.slice(f,p);let Q="";for(let oe=0;oe<$.length-1;oe+=2)Q+=String.fromCharCode($[oe]+$[oe+1]*256);return Q}o.prototype.slice=function(f,p){const $=this.length;f=~~f,p=p===void 0?$:~~p,f<0?(f+=$,f<0&&(f=0)):f>$&&(f=$),p<0?(p+=$,p<0&&(p=0)):p>$&&(p=$),p<f&&(p=f);const Q=this.subarray(f,p);return Object.setPrototypeOf(Q,o.prototype),Q};function H(N,f,p){if(N%1!==0||N<0)throw new RangeError("offset is not uint");if(N+f>p)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let Q=this[f],oe=1,de=0;for(;++de<p&&(oe*=256);)Q+=this[f+de]*oe;return Q},o.prototype.readUintBE=o.prototype.readUIntBE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let Q=this[f+--p],oe=1;for(;p>0&&(oe*=256);)Q+=this[f+--p]*oe;return Q},o.prototype.readUint8=o.prototype.readUInt8=function(f,p){return f=f>>>0,p||H(f,1,this.length),this[f]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(f,p){return f=f>>>0,p||H(f,2,this.length),this[f]|this[f+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(f,p){return f=f>>>0,p||H(f,2,this.length),this[f]<<8|this[f+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(f,p){return f=f>>>0,p||H(f,4,this.length),(this[f]|this[f+1]<<8|this[f+2]<<16)+this[f+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(f,p){return f=f>>>0,p||H(f,4,this.length),this[f]*16777216+(this[f+1]<<16|this[f+2]<<8|this[f+3])},o.prototype.readBigUInt64LE=Se(function(f){f=f>>>0,j(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const Q=p+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24,oe=this[++f]+this[++f]*2**8+this[++f]*2**16+$*2**24;return BigInt(Q)+(BigInt(oe)<<BigInt(32))}),o.prototype.readBigUInt64BE=Se(function(f){f=f>>>0,j(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const Q=p*2**24+this[++f]*2**16+this[++f]*2**8+this[++f],oe=this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+$;return(BigInt(Q)<<BigInt(32))+BigInt(oe)}),o.prototype.readIntLE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let Q=this[f],oe=1,de=0;for(;++de<p&&(oe*=256);)Q+=this[f+de]*oe;return oe*=128,Q>=oe&&(Q-=Math.pow(2,8*p)),Q},o.prototype.readIntBE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let Q=p,oe=1,de=this[f+--Q];for(;Q>0&&(oe*=256);)de+=this[f+--Q]*oe;return oe*=128,de>=oe&&(de-=Math.pow(2,8*p)),de},o.prototype.readInt8=function(f,p){return f=f>>>0,p||H(f,1,this.length),this[f]&128?(255-this[f]+1)*-1:this[f]},o.prototype.readInt16LE=function(f,p){f=f>>>0,p||H(f,2,this.length);const $=this[f]|this[f+1]<<8;return $&32768?$|4294901760:$},o.prototype.readInt16BE=function(f,p){f=f>>>0,p||H(f,2,this.length);const $=this[f+1]|this[f]<<8;return $&32768?$|4294901760:$},o.prototype.readInt32LE=function(f,p){return f=f>>>0,p||H(f,4,this.length),this[f]|this[f+1]<<8|this[f+2]<<16|this[f+3]<<24},o.prototype.readInt32BE=function(f,p){return f=f>>>0,p||H(f,4,this.length),this[f]<<24|this[f+1]<<16|this[f+2]<<8|this[f+3]},o.prototype.readBigInt64LE=Se(function(f){f=f>>>0,j(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const Q=this[f+4]+this[f+5]*2**8+this[f+6]*2**16+($<<24);return(BigInt(Q)<<BigInt(32))+BigInt(p+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24)}),o.prototype.readBigInt64BE=Se(function(f){f=f>>>0,j(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const Q=(p<<24)+this[++f]*2**16+this[++f]*2**8+this[++f];return(BigInt(Q)<<BigInt(32))+BigInt(this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+$)}),o.prototype.readFloatLE=function(f,p){return f=f>>>0,p||H(f,4,this.length),t.read(this,f,!0,23,4)},o.prototype.readFloatBE=function(f,p){return f=f>>>0,p||H(f,4,this.length),t.read(this,f,!1,23,4)},o.prototype.readDoubleLE=function(f,p){return f=f>>>0,p||H(f,8,this.length),t.read(this,f,!0,52,8)},o.prototype.readDoubleBE=function(f,p){return f=f>>>0,p||H(f,8,this.length),t.read(this,f,!1,52,8)};function K(N,f,p,$,Q,oe){if(!o.isBuffer(N))throw new TypeError('"buffer" argument must be a Buffer instance');if(f>Q||f<oe)throw new RangeError('"value" argument is out of bounds');if(p+$>N.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(f,p,$,Q){if(f=+f,p=p>>>0,$=$>>>0,!Q){const Ee=Math.pow(2,8*$)-1;K(this,f,p,$,Ee,0)}let oe=1,de=0;for(this[p]=f&255;++de<$&&(oe*=256);)this[p+de]=f/oe&255;return p+$},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(f,p,$,Q){if(f=+f,p=p>>>0,$=$>>>0,!Q){const Ee=Math.pow(2,8*$)-1;K(this,f,p,$,Ee,0)}let oe=$-1,de=1;for(this[p+oe]=f&255;--oe>=0&&(de*=256);)this[p+oe]=f/de&255;return p+$},o.prototype.writeUint8=o.prototype.writeUInt8=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,1,255,0),this[p]=f&255,p+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,2,65535,0),this[p]=f&255,this[p+1]=f>>>8,p+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,2,65535,0),this[p]=f>>>8,this[p+1]=f&255,p+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,4,4294967295,0),this[p+3]=f>>>24,this[p+2]=f>>>16,this[p+1]=f>>>8,this[p]=f&255,p+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,4,4294967295,0),this[p]=f>>>24,this[p+1]=f>>>16,this[p+2]=f>>>8,this[p+3]=f&255,p+4};function X(N,f,p,$,Q){ge(f,$,Q,N,p,7);let oe=Number(f&BigInt(4294967295));N[p++]=oe,oe=oe>>8,N[p++]=oe,oe=oe>>8,N[p++]=oe,oe=oe>>8,N[p++]=oe;let de=Number(f>>BigInt(32)&BigInt(4294967295));return N[p++]=de,de=de>>8,N[p++]=de,de=de>>8,N[p++]=de,de=de>>8,N[p++]=de,p}function ue(N,f,p,$,Q){ge(f,$,Q,N,p,7);let oe=Number(f&BigInt(4294967295));N[p+7]=oe,oe=oe>>8,N[p+6]=oe,oe=oe>>8,N[p+5]=oe,oe=oe>>8,N[p+4]=oe;let de=Number(f>>BigInt(32)&BigInt(4294967295));return N[p+3]=de,de=de>>8,N[p+2]=de,de=de>>8,N[p+1]=de,de=de>>8,N[p]=de,p+8}o.prototype.writeBigUInt64LE=Se(function(f,p=0){return X(this,f,p,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=Se(function(f,p=0){return ue(this,f,p,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(f,p,$,Q){if(f=+f,p=p>>>0,!Q){const ke=Math.pow(2,8*$-1);K(this,f,p,$,ke-1,-ke)}let oe=0,de=1,Ee=0;for(this[p]=f&255;++oe<$&&(de*=256);)f<0&&Ee===0&&this[p+oe-1]!==0&&(Ee=1),this[p+oe]=(f/de>>0)-Ee&255;return p+$},o.prototype.writeIntBE=function(f,p,$,Q){if(f=+f,p=p>>>0,!Q){const ke=Math.pow(2,8*$-1);K(this,f,p,$,ke-1,-ke)}let oe=$-1,de=1,Ee=0;for(this[p+oe]=f&255;--oe>=0&&(de*=256);)f<0&&Ee===0&&this[p+oe+1]!==0&&(Ee=1),this[p+oe]=(f/de>>0)-Ee&255;return p+$},o.prototype.writeInt8=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,1,127,-128),f<0&&(f=255+f+1),this[p]=f&255,p+1},o.prototype.writeInt16LE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,2,32767,-32768),this[p]=f&255,this[p+1]=f>>>8,p+2},o.prototype.writeInt16BE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,2,32767,-32768),this[p]=f>>>8,this[p+1]=f&255,p+2},o.prototype.writeInt32LE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,4,2147483647,-2147483648),this[p]=f&255,this[p+1]=f>>>8,this[p+2]=f>>>16,this[p+3]=f>>>24,p+4},o.prototype.writeInt32BE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,4,2147483647,-2147483648),f<0&&(f=4294967295+f+1),this[p]=f>>>24,this[p+1]=f>>>16,this[p+2]=f>>>8,this[p+3]=f&255,p+4},o.prototype.writeBigInt64LE=Se(function(f,p=0){return X(this,f,p,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=Se(function(f,p=0){return ue(this,f,p,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function V(N,f,p,$,Q,oe){if(p+$>N.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("Index out of range")}function G(N,f,p,$,Q){return f=+f,p=p>>>0,Q||V(N,f,p,4),t.write(N,f,p,$,23,4),p+4}o.prototype.writeFloatLE=function(f,p,$){return G(this,f,p,!0,$)},o.prototype.writeFloatBE=function(f,p,$){return G(this,f,p,!1,$)};function z(N,f,p,$,Q){return f=+f,p=p>>>0,Q||V(N,f,p,8),t.write(N,f,p,$,52,8),p+8}o.prototype.writeDoubleLE=function(f,p,$){return z(this,f,p,!0,$)},o.prototype.writeDoubleBE=function(f,p,$){return z(this,f,p,!1,$)},o.prototype.copy=function(f,p,$,Q){if(!o.isBuffer(f))throw new TypeError("argument should be a Buffer");if($||($=0),!Q&&Q!==0&&(Q=this.length),p>=f.length&&(p=f.length),p||(p=0),Q>0&&Q<$&&(Q=$),Q===$||f.length===0||this.length===0)return 0;if(p<0)throw new RangeError("targetStart out of bounds");if($<0||$>=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),f.length-p<Q-$&&(Q=f.length-p+$);const oe=Q-$;return this===f&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(p,$,Q):Uint8Array.prototype.set.call(f,this.subarray($,Q),p),oe},o.prototype.fill=function(f,p,$,Q){if(typeof f=="string"){if(typeof p=="string"?(Q=p,p=0,$=this.length):typeof $=="string"&&(Q=$,$=this.length),Q!==void 0&&typeof Q!="string")throw new TypeError("encoding must be a string");if(typeof Q=="string"&&!o.isEncoding(Q))throw new TypeError("Unknown encoding: "+Q);if(f.length===1){const de=f.charCodeAt(0);(Q==="utf8"&&de<128||Q==="latin1")&&(f=de)}}else typeof f=="number"?f=f&255:typeof f=="boolean"&&(f=Number(f));if(p<0||this.length<p||this.length<$)throw new RangeError("Out of range index");if($<=p)return this;p=p>>>0,$=$===void 0?this.length:$>>>0,f||(f=0);let oe;if(typeof f=="number")for(oe=p;oe<$;++oe)this[oe]=f;else{const de=o.isBuffer(f)?f:o.from(f,Q),Ee=de.length;if(Ee===0)throw new TypeError('The value "'+f+'" is invalid for argument "value"');for(oe=0;oe<$-p;++oe)this[oe+p]=de[oe%Ee]}return this};const U={};function ee(N,f,p){U[N]=class extends p{constructor(){super(),Object.defineProperty(this,"message",{value:f.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${N}]`,this.stack,delete this.name}get code(){return N}set code(Q){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Q,writable:!0})}toString(){return`${this.name} [${N}]: ${this.message}`}}}ee("ERR_BUFFER_OUT_OF_BOUNDS",function(N){return N?`${N} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ee("ERR_INVALID_ARG_TYPE",function(N,f){return`The "${N}" argument must be of type number. Received type ${typeof f}`},TypeError),ee("ERR_OUT_OF_RANGE",function(N,f,p){let $=`The value of "${N}" is out of range.`,Q=p;return Number.isInteger(p)&&Math.abs(p)>2**32?Q=re(String(p)):typeof p=="bigint"&&(Q=String(p),(p>BigInt(2)**BigInt(32)||p<-(BigInt(2)**BigInt(32)))&&(Q=re(Q)),Q+="n"),$+=` It must be ${f}. Received ${Q}`,$},RangeError);function re(N){let f="",p=N.length;const $=N[0]==="-"?1:0;for(;p>=$+4;p-=3)f=`_${N.slice(p-3,p)}${f}`;return`${N.slice(0,p)}${f}`}function fe(N,f,p){j(f,"offset"),(N[f]===void 0||N[f+p]===void 0)&&W(f,N.length-(p+1))}function ge(N,f,p,$,Q,oe){if(N>p||N<f){const de=typeof f=="bigint"?"n":"";let Ee;throw f===0||f===BigInt(0)?Ee=`>= 0${de} and < 2${de} ** ${(oe+1)*8}${de}`:Ee=`>= -(2${de} ** ${(oe+1)*8-1}${de}) and < 2 ** ${(oe+1)*8-1}${de}`,new U.ERR_OUT_OF_RANGE("value",Ee,N)}fe($,Q,oe)}function j(N,f){if(typeof N!="number")throw new U.ERR_INVALID_ARG_TYPE(f,"number",N)}function W(N,f,p){throw Math.floor(N)!==N?(j(N,p),new U.ERR_OUT_OF_RANGE("offset","an integer",N)):f<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${f}`,N)}const se=/[^+/0-9A-Za-z-_]/g;function he(N){if(N=N.split("=")[0],N=N.trim().replace(se,""),N.length<2)return"";for(;N.length%4!==0;)N=N+"=";return N}function pe(N,f){f=f||1/0;let p;const $=N.length;let Q=null;const oe=[];for(let de=0;de<$;++de){if(p=N.charCodeAt(de),p>55295&&p<57344){if(!Q){if(p>56319){(f-=3)>-1&&oe.push(239,191,189);continue}else if(de+1===$){(f-=3)>-1&&oe.push(239,191,189);continue}Q=p;continue}if(p<56320){(f-=3)>-1&&oe.push(239,191,189),Q=p;continue}p=(Q-55296<<10|p-56320)+65536}else Q&&(f-=3)>-1&&oe.push(239,191,189);if(Q=null,p<128){if((f-=1)<0)break;oe.push(p)}else if(p<2048){if((f-=2)<0)break;oe.push(p>>6|192,p&63|128)}else if(p<65536){if((f-=3)<0)break;oe.push(p>>12|224,p>>6&63|128,p&63|128)}else if(p<1114112){if((f-=4)<0)break;oe.push(p>>18|240,p>>12&63|128,p>>6&63|128,p&63|128)}else throw new Error("Invalid code point")}return oe}function me(N){const f=[];for(let p=0;p<N.length;++p)f.push(N.charCodeAt(p)&255);return f}function J(N,f){let p,$,Q;const oe=[];for(let de=0;de<N.length&&!((f-=2)<0);++de)p=N.charCodeAt(de),$=p>>8,Q=p%256,oe.push(Q),oe.push($);return oe}function ce(N){return e.toByteArray(he(N))}function ye(N,f,p,$){let Q;for(Q=0;Q<$&&!(Q+p>=f.length||Q>=N.length);++Q)f[Q+p]=N[Q];return Q}function le(N,f){return N instanceof f||N!=null&&N.constructor!=null&&N.constructor.name!=null&&N.constructor.name===f.name}function Ne(N){return N!==N}const ze=function(){const N="0123456789abcdef",f=new Array(256);for(let p=0;p<16;++p){const $=p*16;for(let Q=0;Q<16;++Q)f[$+Q]=N[p]+N[Q]}return f}();function Se(N){return typeof BigInt>"u"?Qe:N}function Qe(){throw new Error("BigInt not supported")}}(mi)),mi}var ad=Lt();const qr="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Ur="http://www.w3.org/2001/XMLSchema#",On="http://www.w3.org/2000/10/swap/",Ke={xsd:{decimal:`${Ur}decimal`,boolean:`${Ur}boolean`,double:`${Ur}double`,integer:`${Ur}integer`,string:`${Ur}string`},rdf:{type:`${qr}type`,nil:`${qr}nil`,first:`${qr}first`,rest:`${qr}rest`,langString:`${qr}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${On}reify#forSome`,forAll:`${On}reify#forAll`},log:{implies:`${On}log#implies`,isImpliedBy:`${On}log#isImpliedBy`}},{xsd:Ln}=Ke,od=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Ja={"\\":"\\","'":"'",'"':'"',n:`
7
+ `,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},ld=/[\x00-\x20<>\\"\{\}\|\^\`]/,ud={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},cd=/$0^/;class dd{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 ud)&&this[t]instanceof RegExp&&(this[t]=cd)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let n=this._input,i=n.length;for(;;){let o,u;for(;o=this._newline.exec(n);)this.comments&&(u=this._comment.exec(o[0]))&&s("comment",u[1],"",this._line,o[0].length),n=n.substr(o[0].length,n.length),i=n.length,this._line++;if(!o&&(o=this._whitespace.exec(n))&&(n=n.substr(o[0].length,n.length)),this._endOfFile.test(n))return t&&(this.comments&&(u=this._comment.exec(n))&&s("comment",u[1],"",this._line,n.length),n=null,s("eof","","",this._line,0)),this._input=n;const l=this._line,c=n[0];let d="",m="",b="",_=null,x=0,E=!1;switch(c){case"^":if(n.length<3)break;if(n[1]==="^"){if(this._previousMarker="^^",n=n.substr(2),n[0]!=="<"){E=!0;break}}else{this._n3Mode&&(x=1,d="^");break}case"<":if(_=this._unescapedIri.exec(n))d="IRI",m=_[1];else if(_=this._iri.exec(n)){if(m=this._unescape(_[1]),m===null||ld.test(m))return a(this);d="IRI"}else n.length>1&&n[1]==="<"?(d="<<",x=2):this._n3Mode&&n.length>1&&n[1]==="="&&(x=2,this._isImpliedBy?(d="abbreviation",m="<"):(d="inverse",m=">"));break;case">":n.length>1&&n[1]===">"&&(d=">>",x=2);break;case"_":((_=this._blank.exec(n))||t&&(_=this._blank.exec(`${n} `)))&&(d="blank",b="_",m=_[1]);break;case'"':if(_=this._simpleQuotedString.exec(n))m=_[1];else if({value:m,matchLength:x}=this._parseLiteral(n),m===null)return a(this);(_!==null||x!==0)&&(d="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(_=this._simpleApostropheString.exec(n))m=_[1];else if({value:m,matchLength:x}=this._parseLiteral(n),m===null)return a(this);(_!==null||x!==0)&&(d="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(_=this._variable.exec(n))&&(d="var",m=_[0]);break;case"@":this._previousMarker==="literal"&&(_=this._langcode.exec(n))?(d="langcode",m=_[1]):(_=this._keyword.exec(n))&&(d=_[0]);break;case".":if(n.length===1?t:n[1]<"0"||n[1]>"9"){d=".",x=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(_=this._number.exec(n)||t&&(_=this._number.exec(`${n} `)))&&(d="literal",m=_[0],b=typeof _[1]=="string"?Ln.double:typeof _[2]=="string"?Ln.decimal:Ln.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(_=this._sparqlKeyword.exec(n))?d=_[0].toUpperCase():E=!0;break;case"f":case"t":(_=this._boolean.exec(n))?(d="literal",m=_[0],b=Ln.boolean):E=!0;break;case"a":(_=this._shortPredicates.exec(n))?(d="abbreviation",m="a"):E=!0;break;case"=":this._n3Mode&&n.length>1&&(d="abbreviation",n[1]!==">"?(x=1,m="="):(x=2,m=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(x=1,d=c);break;case"{":!this._lineMode&&n.length>=2&&(n[1]==="|"?(d="{|",x=2):(d=c,x=1));break;case"|":n.length>=2&&n[1]==="}"&&(d="|}",x=2);break;default:E=!0}if(E&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(_=this._prefix.exec(n))?(d="prefix",m=_[1]||""):((_=this._prefixed.exec(n))||t&&(_=this._prefixed.exec(`${n} `)))&&(d="prefixed",b=_[1]||"",m=this._unescape(_[2]))),this._previousMarker==="^^")switch(d){case"prefixed":d="type";break;case"IRI":d="typeIRI";break;default:d=""}if(!d)return t||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?a(this):this._input=n;const v=x||_[0].length,S=s(d,m,b,l,v);this.previousToken=S,this._previousMarker=d,n=n.substr(v,n.length)}function s(o,u,l,c,d){const m=n?i-n.length:i,b=m+d,_={type:o,value:u,prefix:l,line:c,start:m,end:b};return e(null,_),_}function a(o){e(o._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(e){let t=!1;const n=e.replace(od,(i,s,a,o)=>{if(typeof s=="string")return String.fromCharCode(Number.parseInt(s,16));if(typeof a=="string"){let u=Number.parseInt(a,16);return u<=65535?String.fromCharCode(Number.parseInt(a,16)):String.fromCharCode(55296+((u-=65536)>>10),56320+(u&1023))}return o in Ja?Ja[o]:(t=!0,"")});return t?null:n}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],n=t.length;let i=Math.max(this._literalClosingPos,n);for(;(i=e.indexOf(t,i))>0;){let s=0;for(;e[i-s-1]==="\\";)s++;if(s%2===0){const a=e.substring(n,i),o=a.split(/\r\n|\r|\n/).length-1,u=i+n;if(n===1&&o!==0||n===3&&this._lineMode)break;return this._line+=o,{value:this._unescape(a),matchLength:u}}i++}this._literalClosingPos=e.length-n+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;const t=new Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith("\uFEFF")?e.substr(1):e}tokenize(e,t){if(this._line=1,typeof e=="string")if(this._input=this._readStartingBom(e),typeof t=="function")queueMicrotask(()=>this._tokenizeToEnd(t,!0));else{const n=[];let i;if(this._tokenizeToEnd((s,a)=>s?i=s:n.push(a),!0),i)throw i;return n}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",n=>{this._input!==null&&n.length!==0&&(this._pendingBuffer&&(n=ad.Buffer.concat([this._pendingBuffer,n]),this._pendingBuffer=null),n[n.length-1]&128?this._pendingBuffer=n:(typeof this._input>"u"?this._input=this._readStartingBom(typeof n=="string"?n:n.toString()):this._input+=n,this._tokenizeToEnd(t,!1)))}),e.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(t,!0)}),e.on("error",t)}}const{rdf:hd,xsd:tr}=Ke;let Or,fd=0;const Re={namedNode:Wu,blankNode:zu,variable:Qu,literal:Xu,defaultGraph:yd,quad:ta,triple:ta,fromTerm:cn,fromQuad:Ju};class bt{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof bt?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 ni=class extends bt{get termType(){return"NamedNode"}},ct=class Gu extends bt{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 ni(this.datatypeString)}get datatypeString(){const e=this.id,t=e.lastIndexOf('"')+1,n=t<e.length?e[t]:"";return n==="^"?e.substr(t+2):n!=="@"?tr.string:hd.langString}equals(e){return e instanceof Gu?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}}}},pd=class extends bt{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},gd=class extends bt{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},md=class extends bt{constructor(){return super(""),Or||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};Or=new md;function un(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 n=r.lastIndexOf('"',r.length-1);return e.literal(r.substr(1,n-1),r[n+1]==="@"?r.substr(n+2):e.namedNode(r.substr(n+3)));case"[":r=JSON.parse(r);break;default:if(!t||!Array.isArray(r))return e.namedNode(r)}return e.quad(un(r[0],e,!0),un(r[1],e,!0),un(r[2],e,!0),r[3]&&un(r[3],e,!0))}function Er(r,e){if(typeof r=="string")return r;if(r instanceof bt&&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!==tr.string?`^^${r.datatype.value}`:""}`;case"Quad":const t=[Er(r.subject,!0),Er(r.predicate,!0),Er(r.object,!0)];return r.graph&&r.graph.termType!=="DefaultGraph"&&t.push(Er(r.graph,!0)),e?t:JSON.stringify(t);default:throw new Error(`Unexpected termType: ${r.termType}`)}}let ii=class extends bt{constructor(e,t,n,i){super(""),this._subject=e,this._predicate=t,this._object=n,this._graph=i||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 Wu(r){return new ni(r)}function zu(r){return new pd(r||`n3-${fd++}`)}function Xu(r,e){if(typeof e=="string")return new ct(`"${r}"@${e.toLowerCase()}`);let t=e?e.value:"";return t===""&&(typeof r=="boolean"?t=tr.boolean:typeof r=="number"&&(Number.isFinite(r)?t=Number.isInteger(r)?tr.integer:tr.double:(t=tr.double,Number.isNaN(r)||(r=r>0?"INF":"-INF")))),t===""||t===tr.string?new ct(`"${r}"`):new ct(`"${r}"^^${t}`)}function Qu(r){return new gd(r)}function yd(){return Or}function ta(r,e,t,n){return new ii(r,e,t,n)}function cn(r){if(r instanceof bt)return r;switch(r.termType){case"NamedNode":return Wu(r.value);case"BlankNode":return zu(r.value);case"Variable":return Qu(r.value);case"DefaultGraph":return Or;case"Literal":return Xu(r.value,r.language||r.datatype);case"Quad":return Ju(r);default:throw new Error(`Unexpected termType: ${r.termType}`)}}function Ju(r){if(r instanceof ii)return r;if(r.termType!=="Quad")throw new Error(`Unexpected termType: ${r.termType}`);return ta(cn(r.subject),cn(r.predicate),cn(r.object),cn(r.graph))}let Ka=0;class Ku{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Yu(this,e.factory);const t=typeof e.format=="string"?e.format.match(/\w*$/)[0].toLowerCase():"",n=/turtle/.test(t),i=/trig/.test(t),s=/triple/.test(t),a=/quad/.test(t),o=this._n3Mode=/n3/.test(t),u=s||a;(this._supportsNamedGraphs=!(n||o))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(n||i||s||o),this._isImpliedBy=e.isImpliedBy,this._supportsRDFStar=t===""||/star|\*$/.test(t),u&&(this._resolveRelativeIRI=l=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new dd({lineMode:u,n3:o,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){Ka=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,n,i,s){const a=this._n3Mode;this._contextStack.push({type:e,subject:n,predicate:i,object:s,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 n=this._contextStack.pop();if(!n||n.type!==e)return this._error(`Unexpected ${t.type}`,t);this._subject=n.subject,this._predicate=n.predicate,this._object=n.object,this._graph=n.graph,this._n3Mode&&(this._inversePredicate=n.inverse,this._prefixes._=n.blankPrefix,this._quantified=n.quantified)}_readInTopContext(e){switch(e.type){case"eof":return 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 n;switch(e.type){case"IRI":case"typeIRI":const i=this._resolveIRI(e.value);if(i===null)return this._error("Invalid IRI",e);n=this._factory.namedNode(i);break;case"type":case"prefixed":const s=this._prefixes[e.prefix];if(s===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);n=this._factory.namedNode(s+e.value);break;case"blank":n=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case"var":n=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!t&&this._n3Mode&&n.id in this._quantified&&(n=this._quantified[n.id]),n}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._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,n=null,i=this._readListItem;const s=this._subject,a=this._contextStack,o=a[a.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,n=this._factory.blankNode(),this.RDF_FIRST,this._subject=t=this._factory.blankNode()),i=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,n=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),a.length!==0&&a[a.length-1].type==="list"&&this._emit(this._subject,this._predicate,this._object,this._graph),this._predicate===null){if(i=this._readPredicate,this._subject===this.RDF_NIL)return i}else if(i=this._getContextEndReader(),this._object===this.RDF_NIL)return i;n=this.RDF_NIL;break;case"literal":e.prefix.length===0?(this._literalValue=e.value,i=this._readListItemDataTypeOrLang):(t=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),i=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if((t=this._readEntity(e))===void 0)return}if(n===null&&(this._subject=n=this._factory.blankNode()),s===null?o.predicate===null?o.subject=n:o.object=n:this._emit(s,this.RDF_REST,n,this._graph),t!==null){if(this._n3Mode&&(e.type==="IRI"||e.type==="prefixed"))return this._saveContext("item",this._graph,n,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(n,this.RDF_FIRST,t,this._graph)}return i}_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 n=this._readEntity(e);if(n===void 0)return;t=this._factory.literal(this._literalValue,n),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 n=this._completeLiteral(e);if(n)return this._object=n.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),n.token===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(n.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,n=this._graph;const i=this._subject,s=this._inversePredicate;switch(e.type){case"}":if(this._graph===null)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,s&&(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,o=this._object;this._subject=this._factory.quad(i,a,o,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&&(n=this._readEntity(e))!==void 0){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(i!==null){const a=this._predicate,o=this._object;s?this._emit(o,a,i,n):this._emit(i,a,o,n)}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),t}_readQuadPunctuation(e){return e.type!=="."?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return 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,n=t.length&&t[t.length-1];if(n&&n.type==="item"){const i=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,i,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let t,n;const i=this._factory.blankNode();if((n=this._readEntity(e))!==void 0)return this._predicate===null?(t=this._subject,this._subject=i):(t=this._object,this._object=i),this._emit(t,n,i,this._graph),this._readPath}_readBackwardPath(e){const t=this._factory.blankNode();let n,i;if((n=this._readEntity(e))!==void 0)return this._predicate===null?(i=this._subject,this._subject=t):(i=this._object,this._object=t),this._emit(t,n,i,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,n,i){this._callback(null,this._factory.quad(e,t,n,i||this.DEFAULTGRAPH))}_error(e,t){const n=new Error(`${e} on line ${t.line}.`);n.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=Cn}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return(e[1]==="/"?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;const t=e.length;let n="",i=-1,s=-1,a=0,o="/";for(;i<t;){switch(o){case":":if(s<0&&e[++i]==="/"&&e[++i]==="/")for(;(s=i+1)<t&&e[s]!=="/";)i=s;break;case"?":case"#":i=t;break;case"/":if(e[i+1]===".")switch(o=e[++i+1],o){case"/":n+=e.substring(a,i-1),a=i+1;break;case void 0:case"?":case"#":return n+e.substring(a,i)+e.substr(i+1);case".":if(o=e[++i+1],o===void 0||o==="/"||o==="?"||o==="#"){if(n+=e.substring(a,i-2),(a=n.lastIndexOf("/"))>=s&&(n=n.substr(0,a)),o!=="/")return`${n}/${e.substr(i+1)}`;a=i+1}}}o=e[++i]}return n+e.substring(a)}parse(e,t,n){let i,s,a;if(t&&(t.onQuad||t.onPrefix||t.onComment)?(i=t.onQuad,s=t.onPrefix,a=t.onComment):(i=t,s=n),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Ka++}_`,this._prefixCallback=s||Cn,this._inversePredicate=!1,this._quantified=Object.create(null),!i){const u=[];let l;if(this._callback=(c,d)=>{c?l=c:d&&u.push(d)},this._lexer.tokenize(e).every(c=>this._readCallback=this._readCallback(c)),l)throw l;return u}let o=(u,l)=>{u!==null?(this._callback(u),this._callback=Cn):this._readCallback&&(this._readCallback=this._readCallback(l))};a&&(this._lexer.comments=!0,o=(u,l)=>{u!==null?(this._callback(u),this._callback=Cn):this._readCallback&&(l.type==="comment"?a(l.value):this._readCallback=this._readCallback(l))}),this._callback=i,this._lexer.tokenize(e,o)}}function Cn(){}function Yu(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")}Yu(Ku.prototype,Re);function ra(r){return!!r&&r.termType==="DefaultGraph"}function Un(r){return r.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const bd=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,_d=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,Ya="./",wd="../",yi="?",Za="#";class pa{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!bd.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!pa.supports(this.base))return this._baseMatcher=/.^/;const e=/^[^:]*:\/*/.exec(this.base)[0],t=["^",Un(e)],n=[],i=[],s=/[^/?#]*([/?#])/y;let a,o=0,u=0,l=s.lastIndex=e.length;for(;!o&&!u&&(a=s.exec(this.base));)a[1]===Za?u=s.lastIndex-1:(t.push(Un(a[0]),"(?:"),n.push(")?"),a[1]!==yi?i.push(l=s.lastIndex):(o=l=s.lastIndex,u=this.base.indexOf(Za,o),this._pathReplacements[o]=yi));for(let c=0;c<i.length;c++)this._pathReplacements[i[c]]=wd.repeat(i.length-c-1);return this._pathReplacements[i[i.length-1]]=Ya,this._baseLength=u>0?u:this.base.length,t.push(Un(this.base.substring(l,this._baseLength)),o?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...t,...n].join(""))}toRelative(e){const t=this._getBaseMatcher().exec(e);if(!t)return e;const n=t[0].length;if(n===this._baseLength&&n===e.length)return"";const i=this._pathReplacements[n];if(i){const s=e.substring(n);return i!==yi&&!_d.test(s)?e:i===Ya&&/^[^?#]/.test(s)?s:i+s}return e.substring(n-1)}}const Hr=Re.defaultGraph(),{rdf:vd,xsd:br}=Ke,eo=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,to=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,xd={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class Vr extends bt{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 n="";this._outputStream={write(i,s,a){n+=i,a&&a()},end:i=>{i&&i(null,n)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Hr,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new pa(t.baseIRI)))}get _inDefaultGraph(){return Hr.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t)}_writeQuad(e,t,n,i,s){try{i.equals(this._graph)||(this._write((this._subject===null?"":this._inDefaultGraph?`.
8
8
  `:`
9
9
  }
10
- `)+(mr.equals(i)?"":`${this._encodeIriOrBlank(i)} {
10
+ `)+(Hr.equals(i)?"":`${this._encodeIriOrBlank(i)} {
11
11
  `)),this._graph=i,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(`, ${this._encodeObject(n)}`,s):this._write(`;
12
12
  ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(n)}`,s):this._write(`${(this._subject===null?"":`.
13
13
  `)+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(n)}`,s)}catch(a){s&&s(a)}}_writeQuadLine(e,t,n,i,s){delete this._prefixMatch,this._write(this.quadToString(e,t,n,i),s)}quadToString(e,t,n,i){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(n)}${i&&i.value?` ${this._encodeIriOrBlank(i)} .
14
14
  `:` .
15
- `}`}quadsToString(e){let t="";for(const n of e)t+=this.quadToString(n.subject,n.predicate,n.object,n.graph);return t}_encodeSubject(e){return 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)),Oa.test(t)&&(t=t.replace($a,ka));const n=this._prefixRegex.exec(t);return n?n[1]?this._prefixIRIs[n[1]]+n[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(Oa.test(t)&&(t=t.replace($a,ka)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===Qt.string)return`"${t}"`}else switch(e.datatype.value){case Qt.string:return`"${t}"`;case Qt.boolean:if(t==="true"||t==="false")return t;break;case Qt.integer:if(/^[+-]?\d+$/.test(t))return t;break;case Qt.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case Qt.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t;break}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===Bc.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:t,object:n,graph:i}){return`<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(n)}${Ns(i)?"":` ${this._encodeIriOrBlank(i)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,n,i,s){n===void 0?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):typeof i=="function"?this._writeQuad(e,t,n,mr,i):this._writeQuad(e,t,n,i||mr,s)}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}addPrefix(e,t,n){const i={};i[e]=t,this.addPrefixes(i,n)}addPrefixes(e,t){if(!this._prefixIRIs)return t&&t();let n=!1;for(let i in e){let s=e[i];typeof s!="string"&&(s=s.value),n=!0,this._subject!==null&&(this._write(this._inDefaultGraph?`.
15
+ `}`}quadsToString(e){let t="";for(const n of e)t+=this.quadToString(n.subject,n.predicate,n.object,n.graph);return t}_encodeSubject(e){return 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)),eo.test(t)&&(t=t.replace(to,ro));const n=this._prefixRegex.exec(t);return n?n[1]?this._prefixIRIs[n[1]]+n[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(eo.test(t)&&(t=t.replace(to,ro)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===br.string)return`"${t}"`}else switch(e.datatype.value){case br.string:return`"${t}"`;case br.boolean:if(t==="true"||t==="false")return t;break;case br.integer:if(/^[+-]?\d+$/.test(t))return t;break;case br.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case br.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t;break}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===vd.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:t,object:n,graph:i}){return`<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(n)}${ra(i)?"":` ${this._encodeIriOrBlank(i)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,n,i,s){n===void 0?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):typeof i=="function"?this._writeQuad(e,t,n,Hr,i):this._writeQuad(e,t,n,i||Hr,s)}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}addPrefix(e,t,n){const i={};i[e]=t,this.addPrefixes(i,n)}addPrefixes(e,t){if(!this._prefixIRIs)return t&&t();let n=!1;for(let i in e){let s=e[i];typeof s!="string"&&(s=s.value),n=!0,this._subject!==null&&(this._write(this._inDefaultGraph?`.
16
16
  `:`
17
17
  }
18
18
  `),this._subject=null,this._graph=""),this._prefixIRIs[s]=i+=":",this._write(`@prefix ${i} <${s}>.
19
- `)}if(n){let i="",s="";for(const a in this._prefixIRIs)i+=i?`|${a}`:a,s+=(s?"|":"")+this._prefixIRIs[a];i=dn(i),this._prefixRegex=new RegExp(`^(?:${s})[^/]*$|^(${i})([_a-zA-Z0-9][\\-_a-zA-Z0-9]*)$`)}this._write(n?`
20
- `:"",t)}blank(e,t){let n=e,i,s;switch(e===void 0?n=[]:e.termType?n=[{predicate:e,object:t}]:"length"in e||(n=[e]),s=n.length){case 0:return new br("[]");case 1:if(i=n[0],!(i.object instanceof br))return new br(`[ ${this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)} ]`);default:let a="[";for(let o=0;o<s;o++)i=n[o],i.predicate.equals(e)?a+=`, ${this._encodeObject(i.object)}`:(a+=`${(o?`;
19
+ `)}if(n){let i="",s="";for(const a in this._prefixIRIs)i+=i?`|${a}`:a,s+=(s?"|":"")+this._prefixIRIs[a];i=Un(i),this._prefixRegex=new RegExp(`^(?:${s})[^/]*$|^(${i})([_a-zA-Z0-9][\\-_a-zA-Z0-9]*)$`)}this._write(n?`
20
+ `:"",t)}blank(e,t){let n=e,i,s;switch(e===void 0?n=[]:e.termType?n=[{predicate:e,object:t}]:"length"in e||(n=[e]),s=n.length){case 0:return new Vr("[]");case 1:if(i=n[0],!(i.object instanceof Vr))return new Vr(`[ ${this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)} ]`);default:let a="[";for(let o=0;o<s;o++)i=n[o],i.predicate.equals(e)?a+=`, ${this._encodeObject(i.object)}`:(a+=`${(o?`;
21
21
  `:`
22
- `)+this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)}`,e=i.predicate);return new br(`${a}
23
- ]`)}}list(e){const t=e&&e.length||0,n=new Array(t);for(let i=0;i<t;i++)n[i]=this._encodeObject(e[i]);return new br(`(${n.join(" ")})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
22
+ `)+this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)}`,e=i.predicate);return new Vr(`${a}
23
+ ]`)}}list(e){const t=e&&e.length||0,n=new Array(t);for(let i=0;i<t;i++)n[i]=this._encodeObject(e[i]);return new Vr(`(${n.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&&((n,i)=>{t=null,e(n,i)});if(this._endStream)try{return this._outputStream.end(t)}catch{}t&&t()}}function ka(r){let e=Fc[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:{}},zn={exports:{}},Jn,Da;function $e(){if(Da)return Jn;Da=1;class r extends Error{constructor(t){if(!Array.isArray(t))throw new TypeError(`Expected input to be an Array, got ${typeof t}`);let n="";for(let i=0;i<t.length;i++)n+=` ${t[i].stack}
27
- `;super(n),this.name="AggregateError",this.errors=t}}return Jn={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,n){return e.slice(t,n)},Error,FunctionPrototypeCall(e,t,...n){return e.call(t,...n)},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,n){return Object.defineProperty(e,t,n)},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,n){return e.then(t,n)},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,n){return e.slice(t,n)},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,n){return e.set(t,n)},Boolean,Uint8Array},Jn}var Qn={exports:{}},Xn,Ma;function mu(){return Ma||(Ma=1,Xn={format(r,...e){return r.replace(/%([sdifj])/g,function(...[t,n]){const i=e.shift();return n==="f"?i.toFixed(6):n==="j"?JSON.stringify(i):n==="s"&&typeof i=="object"?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})},inspect(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"{}"}}}),Xn}var Kn,Ca;function Ve(){if(Ca)return Kn;Ca=1;const{format:r,inspect:e}=mu(),{AggregateError:t}=$e(),n=globalThis.AggregateError||t,i=Symbol("kIsNodeError"),s=["string","function","number","object","Function","Object","boolean","bigint","symbol"],a=/^([A-Z][a-z0-9]*)+$/,o="__node_internal_",l={};function d(x,S){if(!x)throw new l.ERR_INTERNAL_ASSERTION(S)}function h(x){let S="",I=x.length;const b=x[0]==="-"?1:0;for(;I>=b+4;I-=3)S=`_${x.slice(I-3,I)}${S}`;return`${x.slice(0,I)}${S}`}function y(x,S,I){if(typeof S=="function")return d(S.length<=I.length,`Code: ${x}; The provided arguments length (${I.length}) does not match the required ones (${S.length}).`),S(...I);const b=(S.match(/%[dfijoOs]/g)||[]).length;return d(b===I.length,`Code: ${x}; The provided arguments length (${I.length}) does not match the required ones (${b}).`),I.length===0?S:r(S,...I)}function w(x,S,I){I||(I=Error);class b extends I{constructor(...p){super(y(x,S,p))}toString(){return`${this.name} [${x}]: ${this.message}`}}Object.defineProperties(b.prototype,{name:{value:I.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${x}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),b.prototype.code=x,b.prototype[i]=!0,l[x]=b}function g(x){const S=o+x.name;return Object.defineProperty(x,"name",{value:S}),x}function m(x,S){if(x&&S&&x!==S){if(Array.isArray(S.errors))return S.errors.push(x),S;const I=new n([S,x],S.message);return I.code=S.code,I}return x||S}class _ extends Error{constructor(S="The operation was aborted",I=void 0){if(I!==void 0&&typeof I!="object")throw new l.ERR_INVALID_ARG_TYPE("options","Object",I);super(S,I),this.code="ABORT_ERR",this.name="AbortError"}}return w("ERR_ASSERTION","%s",Error),w("ERR_INVALID_ARG_TYPE",(x,S,I)=>{d(typeof x=="string","'name' must be a string"),Array.isArray(S)||(S=[S]);let b="The ";x.endsWith(" argument")?b+=`${x} `:b+=`"${x}" ${x.includes(".")?"property":"argument"} `,b+="must be ";const c=[],p=[],N=[];for(const T of S)d(typeof T=="string","All expected entries have to be of type string"),s.includes(T)?c.push(T.toLowerCase()):a.test(T)?p.push(T):(d(T!=="object",'The value "object" should be written as "Object"'),N.push(T));if(p.length>0){const T=c.indexOf("object");T!==-1&&(c.splice(c,T,1),p.push("Object"))}if(c.length>0){switch(c.length){case 1:b+=`of type ${c[0]}`;break;case 2:b+=`one of type ${c[0]} or ${c[1]}`;break;default:{const T=c.pop();b+=`one of type ${c.join(", ")}, or ${T}`}}(p.length>0||N.length>0)&&(b+=" or ")}if(p.length>0){switch(p.length){case 1:b+=`an instance of ${p[0]}`;break;case 2:b+=`an instance of ${p[0]} or ${p[1]}`;break;default:{const T=p.pop();b+=`an instance of ${p.join(", ")}, or ${T}`}}N.length>0&&(b+=" or ")}switch(N.length){case 0:break;case 1:N[0].toLowerCase()!==N[0]&&(b+="an "),b+=`${N[0]}`;break;case 2:b+=`one of ${N[0]} or ${N[1]}`;break;default:{const T=N.pop();b+=`one of ${N.join(", ")}, or ${T}`}}if(I==null)b+=`. Received ${I}`;else if(typeof I=="function"&&I.name)b+=`. Received function ${I.name}`;else if(typeof I=="object"){var D;if((D=I.constructor)!==null&&D!==void 0&&D.name)b+=`. Received an instance of ${I.constructor.name}`;else{const T=e(I,{depth:-1});b+=`. Received ${T}`}}else{let T=e(I,{colors:!1});T.length>25&&(T=`${T.slice(0,25)}...`),b+=`. Received type ${typeof I} (${T})`}return b},TypeError),w("ERR_INVALID_ARG_VALUE",(x,S,I="is invalid")=>{let b=e(S);return b.length>128&&(b=b.slice(0,128)+"..."),`The ${x.includes(".")?"property":"argument"} '${x}' ${I}. Received ${b}`},TypeError),w("ERR_INVALID_RETURN_VALUE",(x,S,I)=>{var b;const c=I!=null&&(b=I.constructor)!==null&&b!==void 0&&b.name?`instance of ${I.constructor.name}`:`type ${typeof I}`;return`Expected ${x} to be returned from the "${S}" function but got ${c}.`},TypeError),w("ERR_MISSING_ARGS",(...x)=>{d(x.length>0,"At least one arg needs to be specified");let S;const I=x.length;switch(x=(Array.isArray(x)?x:[x]).map(b=>`"${b}"`).join(" or "),I){case 1:S+=`The ${x[0]} argument`;break;case 2:S+=`The ${x[0]} and ${x[1]} arguments`;break;default:{const b=x.pop();S+=`The ${x.join(", ")}, and ${b} arguments`}break}return`${S} must be specified`},TypeError),w("ERR_OUT_OF_RANGE",(x,S,I)=>{d(S,'Missing "range" argument');let b;if(Number.isInteger(I)&&Math.abs(I)>2**32)b=h(String(I));else if(typeof I=="bigint"){b=String(I);const c=BigInt(2)**BigInt(32);(I>c||I<-c)&&(b=h(b)),b+="n"}else b=e(I);return`The value of "${x}" is out of range. It must be ${S}. Received ${b}`},RangeError),w("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),w("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),w("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),w("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),w("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),w("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),w("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),w("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),w("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),w("ERR_STREAM_WRITE_AFTER_END","write after end",Error),w("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),Kn={AbortError:_,aggregateTwoErrors:g(m),hideStackFrames:g,codes:l},Kn}var wr={exports:{}},Pa;function Gr(){if(Pa)return wr.exports;Pa=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 nn={exports:{}},qa;function Tn(){if(qa)return nn.exports;qa=1;var r=typeof Reflect=="object"?Reflect:null,e=r&&typeof r.apply=="function"?r.apply:function(p,N,D){return Function.prototype.apply.call(p,N,D)},t;r&&typeof r.ownKeys=="function"?t=r.ownKeys:Object.getOwnPropertySymbols?t=function(p){return Object.getOwnPropertyNames(p).concat(Object.getOwnPropertySymbols(p))}:t=function(p){return Object.getOwnPropertyNames(p)};function n(c){console&&console.warn&&console.warn(c)}var i=Number.isNaN||function(p){return p!==p};function s(){s.init.call(this)}nn.exports=s,nn.exports.once=S,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function o(c){if(typeof c!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof c)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(c){if(typeof c!="number"||c<0||i(c))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+c+".");a=c}}),s.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},s.prototype.setMaxListeners=function(p){if(typeof p!="number"||p<0||i(p))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+p+".");return this._maxListeners=p,this};function l(c){return c._maxListeners===void 0?s.defaultMaxListeners:c._maxListeners}s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(p){for(var N=[],D=1;D<arguments.length;D++)N.push(arguments[D]);var T=p==="error",q=this._events;if(q!==void 0)T=T&&q.error===void 0;else if(!T)return!1;if(T){var R;if(N.length>0&&(R=N[0]),R instanceof Error)throw R;var M=new Error("Unhandled error."+(R?" ("+R.message+")":""));throw M.context=R,M}var B=q[p];if(B===void 0)return!1;if(typeof B=="function")e(B,this,N);else for(var A=B.length,j=m(B,A),D=0;D<A;++D)e(j[D],this,N);return!0};function d(c,p,N,D){var T,q,R;if(o(N),q=c._events,q===void 0?(q=c._events=Object.create(null),c._eventsCount=0):(q.newListener!==void 0&&(c.emit("newListener",p,N.listener?N.listener:N),q=c._events),R=q[p]),R===void 0)R=q[p]=N,++c._eventsCount;else if(typeof R=="function"?R=q[p]=D?[N,R]:[R,N]:D?R.unshift(N):R.push(N),T=l(c),T>0&&R.length>T&&!R.warned){R.warned=!0;var M=new Error("Possible EventEmitter memory leak detected. "+R.length+" "+String(p)+" listeners added. Use emitter.setMaxListeners() to increase limit");M.name="MaxListenersExceededWarning",M.emitter=c,M.type=p,M.count=R.length,n(M)}return c}s.prototype.addListener=function(p,N){return d(this,p,N,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(p,N){return d(this,p,N,!0)};function h(){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 y(c,p,N){var D={fired:!1,wrapFn:void 0,target:c,type:p,listener:N},T=h.bind(D);return T.listener=N,D.wrapFn=T,T}s.prototype.once=function(p,N){return o(N),this.on(p,y(this,p,N)),this},s.prototype.prependOnceListener=function(p,N){return o(N),this.prependListener(p,y(this,p,N)),this},s.prototype.removeListener=function(p,N){var D,T,q,R,M;if(o(N),T=this._events,T===void 0)return this;if(D=T[p],D===void 0)return this;if(D===N||D.listener===N)--this._eventsCount===0?this._events=Object.create(null):(delete T[p],T.removeListener&&this.emit("removeListener",p,D.listener||N));else if(typeof D!="function"){for(q=-1,R=D.length-1;R>=0;R--)if(D[R]===N||D[R].listener===N){M=D[R].listener,q=R;break}if(q<0)return this;q===0?D.shift():_(D,q),D.length===1&&(T[p]=D[0]),T.removeListener!==void 0&&this.emit("removeListener",p,M||N)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(p){var N,D,T;if(D=this._events,D===void 0)return this;if(D.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):D[p]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete D[p]),this;if(arguments.length===0){var q=Object.keys(D),R;for(T=0;T<q.length;++T)R=q[T],R!=="removeListener"&&this.removeAllListeners(R);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(N=D[p],typeof N=="function")this.removeListener(p,N);else if(N!==void 0)for(T=N.length-1;T>=0;T--)this.removeListener(p,N[T]);return this};function w(c,p,N){var D=c._events;if(D===void 0)return[];var T=D[p];return T===void 0?[]:typeof T=="function"?N?[T.listener||T]:[T]:N?x(T):m(T,T.length)}s.prototype.listeners=function(p){return w(this,p,!0)},s.prototype.rawListeners=function(p){return w(this,p,!1)},s.listenerCount=function(c,p){return typeof c.listenerCount=="function"?c.listenerCount(p):g.call(c,p)},s.prototype.listenerCount=g;function g(c){var p=this._events;if(p!==void 0){var N=p[c];if(typeof N=="function")return 1;if(N!==void 0)return N.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function m(c,p){for(var N=new Array(p),D=0;D<p;++D)N[D]=c[D];return N}function _(c,p){for(;p+1<c.length;p++)c[p]=c[p+1];c.pop()}function x(c){for(var p=new Array(c.length),N=0;N<p.length;++N)p[N]=c[N].listener||c[N];return p}function S(c,p){return new Promise(function(N,D){function T(R){c.removeListener(p,q),D(R)}function q(){typeof c.removeListener=="function"&&c.removeListener("error",T),N([].slice.call(arguments))}b(c,p,q,{once:!0}),p!=="error"&&I(c,T,{once:!0})})}function I(c,p,N){typeof c.on=="function"&&b(c,"error",p,N)}function b(c,p,N,D){if(typeof c.on=="function")D.once?c.once(p,N):c.on(p,N);else if(typeof c.addEventListener=="function")c.addEventListener(p,function T(q){D.once&&c.removeEventListener(p,T),N(q)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof c)}return nn.exports}var Ba;function ze(){return Ba||(Ba=1,function(r){const e=bt(),{format:t,inspect:n}=mu(),{codes:{ERR_INVALID_ARG_TYPE:i}}=Ve(),{kResistStopPropagation:s,AggregateError:a,SymbolDispose:o}=$e(),l=globalThis.AbortSignal||Gr().AbortSignal,d=globalThis.AbortController||Gr().AbortController,h=Object.getPrototypeOf(async function(){}).constructor,y=globalThis.Blob||e.Blob,w=typeof y<"u"?function(x){return x instanceof y}:function(x){return!1},g=(_,x)=>{if(_!==void 0&&(_===null||typeof _!="object"||!("aborted"in _)))throw new i(x,"AbortSignal",_)},m=(_,x)=>{if(typeof _!="function")throw new i(x,"Function",_)};r.exports={AggregateError:a,kEmptyObject:Object.freeze({}),once(_){let x=!1;return function(...S){x||(x=!0,_.apply(this,S))}},createDeferredPromise:function(){let _,x;return{promise:new Promise((I,b)=>{_=I,x=b}),resolve:_,reject:x}},promisify(_){return new Promise((x,S)=>{_((I,...b)=>I?S(I):x(...b))})},debuglog(){return function(){}},format:t,inspect:n,types:{isAsyncFunction(_){return _ instanceof h},isArrayBufferView(_){return ArrayBuffer.isView(_)}},isBlob:w,deprecate(_,x){return _},addAbortListener:Tn().addAbortListener||function(x,S){if(x===void 0)throw new i("signal","AbortSignal",x);g(x,"signal"),m(S,"listener");let I;return x.aborted?queueMicrotask(()=>S()):(x.addEventListener("abort",S,{__proto__:null,once:!0,[s]:!0}),I=()=>{x.removeEventListener("abort",S)}),{__proto__:null,[o](){var b;(b=I)===null||b===void 0||b()}}},AbortSignalAny:l.any||function(x){if(x.length===1)return x[0];const S=new d,I=()=>S.abort();return x.forEach(b=>{g(b,"signals"),b.addEventListener("abort",I,{once:!0})}),S.signal.addEventListener("abort",()=>{x.forEach(b=>b.removeEventListener("abort",I))},{once:!0}),S.signal}},r.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}(Qn)),Qn.exports}var sn={},Yn,Fa;function Xr(){if(Fa)return Yn;Fa=1;const{ArrayIsArray:r,ArrayPrototypeIncludes:e,ArrayPrototypeJoin:t,ArrayPrototypeMap:n,NumberIsInteger:i,NumberIsNaN:s,NumberMAX_SAFE_INTEGER:a,NumberMIN_SAFE_INTEGER:o,NumberParseInt:l,ObjectPrototypeHasOwnProperty:d,RegExpPrototypeExec:h,String:y,StringPrototypeToUpperCase:w,StringPrototypeTrim:g}=$e(),{hideStackFrames:m,codes:{ERR_SOCKET_BAD_PORT:_,ERR_INVALID_ARG_TYPE:x,ERR_INVALID_ARG_VALUE:S,ERR_OUT_OF_RANGE:I,ERR_UNKNOWN_SIGNAL:b}}=Ve(),{normalizeEncoding:c}=ze(),{isAsyncFunction:p,isArrayBufferView:N}=ze().types,D={};function T(X){return X===(X|0)}function q(X){return X===X>>>0}const R=/^[0-7]+$/,M="must be a 32-bit unsigned integer or an octal string";function B(X,le,he){if(typeof X>"u"&&(X=he),typeof X=="string"){if(h(R,X)===null)throw new S(le,X,M);X=l(X,8)}return Y(X,le),X}const A=m((X,le,he=o,se=a)=>{if(typeof X!="number")throw new x(le,"number",X);if(!i(X))throw new I(le,"an integer",X);if(X<he||X>se)throw new I(le,`>= ${he} && <= ${se}`,X)}),j=m((X,le,he=-2147483648,se=2147483647)=>{if(typeof X!="number")throw new x(le,"number",X);if(!i(X))throw new I(le,"an integer",X);if(X<he||X>se)throw new I(le,`>= ${he} && <= ${se}`,X)}),Y=m((X,le,he=!1)=>{if(typeof X!="number")throw new x(le,"number",X);if(!i(X))throw new I(le,"an integer",X);const se=he?1:0,Ee=4294967295;if(X<se||X>Ee)throw new I(le,`>= ${se} && <= ${Ee}`,X)});function L(X,le){if(typeof X!="string")throw new x(le,"string",X)}function ee(X,le,he=void 0,se){if(typeof X!="number")throw new x(le,"number",X);if(he!=null&&X<he||se!=null&&X>se||(he!=null||se!=null)&&s(X))throw new I(le,`${he!=null?`>= ${he}`:""}${he!=null&&se!=null?" && ":""}${se!=null?`<= ${se}`:""}`,X)}const C=m((X,le,he)=>{if(!e(he,X)){const Ee="must be one of: "+t(n(he,qe=>typeof qe=="string"?`'${qe}'`:y(qe)),", ");throw new S(le,X,Ee)}});function K(X,le){if(typeof X!="boolean")throw new x(le,"boolean",X)}function v(X,le,he){return X==null||!d(X,le)?he:X[le]}const U=m((X,le,he=null)=>{const se=v(he,"allowArray",!1),Ee=v(he,"allowFunction",!1);if(!v(he,"nullable",!1)&&X===null||!se&&r(X)||typeof X!="object"&&(!Ee||typeof X!="function"))throw new x(le,"Object",X)}),Q=m((X,le)=>{if(X!=null&&typeof X!="object"&&typeof X!="function")throw new x(le,"a dictionary",X)}),z=m((X,le,he=0)=>{if(!r(X))throw new x(le,"Array",X);if(X.length<he){const se=`must be longer than ${he}`;throw new S(le,X,se)}});function ae(X,le){z(X,le);for(let he=0;he<X.length;he++)L(X[he],`${le}[${he}]`)}function H(X,le){z(X,le);for(let he=0;he<X.length;he++)K(X[he],`${le}[${he}]`)}function V(X,le){z(X,le);for(let he=0;he<X.length;he++){const se=X[he],Ee=`${le}[${he}]`;if(se==null)throw new x(Ee,"AbortSignal",se);ce(se,Ee)}}function W(X,le="signal"){if(L(X,le),D[X]===void 0)throw D[w(X)]!==void 0?new b(X+" (signals must use all capital letters)"):new b(X)}const F=m((X,le="buffer")=>{if(!N(X))throw new x(le,["Buffer","TypedArray","DataView"],X)});function Z(X,le){const he=c(le),se=X.length;if(he==="hex"&&se%2!==0)throw new S("encoding",le,`is invalid for data of length ${se}`)}function te(X,le="Port",he=!0){if(typeof X!="number"&&typeof X!="string"||typeof X=="string"&&g(X).length===0||+X!==+X>>>0||X>65535||X===0&&!he)throw new _(le,X,he);return X|0}const ce=m((X,le)=>{if(X!==void 0&&(X===null||typeof X!="object"||!("aborted"in X)))throw new x(le,"AbortSignal",X)}),fe=m((X,le)=>{if(typeof X!="function")throw new x(le,"Function",X)}),O=m((X,le)=>{if(typeof X!="function"||p(X))throw new x(le,"Function",X)}),G=m((X,le)=>{if(X!==void 0)throw new x(le,"undefined",X)});function re(X,le,he){if(!e(he,X))throw new x(le,`('${t(he,"|")}')`,X)}const ue=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function de(X,le){if(typeof X>"u"||!h(ue,X))throw new S(le,X,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function pe(X){if(typeof X=="string")return de(X,"hints"),X;if(r(X)){const le=X.length;let he="";if(le===0)return he;for(let se=0;se<le;se++){const Ee=X[se];de(Ee,"hints"),he+=Ee,se!==le-1&&(he+=", ")}return he}throw new S("hints",X,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return Yn={isInt32:T,isUint32:q,parseFileMode:B,validateArray:z,validateStringArray:ae,validateBooleanArray:H,validateAbortSignalArray:V,validateBoolean:K,validateBuffer:F,validateDictionary:Q,validateEncoding:Z,validateFunction:fe,validateInt32:j,validateInteger:A,validateNumber:ee,validateObject:U,validateOneOf:C,validatePlainFunction:O,validatePort:te,validateSignalName:W,validateString:L,validateUint32:Y,validateUndefined:G,validateUnion:re,validateAbortSignal:ce,validateLinkHeaderValue:pe},Yn}var an={exports:{}},Zn={exports:{}},Ua;function Vt(){if(Ua)return Zn.exports;Ua=1;var r=Zn.exports={},e,t;function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=n}catch{e=n}try{typeof clearTimeout=="function"?t=clearTimeout:t=i}catch{t=i}})();function s(_){if(e===setTimeout)return setTimeout(_,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(_,0);try{return e(_,0)}catch{try{return e.call(null,_,0)}catch{return e.call(this,_,0)}}}function a(_){if(t===clearTimeout)return clearTimeout(_);if((t===i||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(_);try{return t(_)}catch{try{return t.call(null,_)}catch{return t.call(this,_)}}}var o=[],l=!1,d,h=-1;function y(){!l||!d||(l=!1,d.length?o=d.concat(o):h=-1,o.length&&w())}function w(){if(!l){var _=s(y);l=!0;for(var x=o.length;x;){for(d=o,o=[];++h<x;)d&&d[h].run();h=-1,x=o.length}d=null,l=!1,a(_)}}r.nextTick=function(_){var x=new Array(arguments.length-1);if(arguments.length>1)for(var S=1;S<arguments.length;S++)x[S-1]=arguments[S];o.push(new g(_,x)),o.length===1&&!l&&s(w)};function g(_,x){this.fun=_,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 m(){}return r.on=m,r.addListener=m,r.once=m,r.off=m,r.removeListener=m,r.removeAllListeners=m,r.emit=m,r.prependListener=m,r.prependOnceListener=m,r.listeners=function(_){return[]},r.binding=function(_){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(_){throw new Error("process.chdir is not supported")},r.umask=function(){return 0},Zn.exports}var ei,Ha;function wt(){if(Ha)return ei;Ha=1;const{SymbolAsyncIterator:r,SymbolIterator:e,SymbolFor:t}=$e(),n=t("nodejs.stream.destroyed"),i=t("nodejs.stream.errored"),s=t("nodejs.stream.readable"),a=t("nodejs.stream.writable"),o=t("nodejs.stream.disturbed"),l=t("nodejs.webstream.isClosedPromise"),d=t("nodejs.webstream.controllerErrorFunction");function h(v,U=!1){var Q;return!!(v&&typeof v.pipe=="function"&&typeof v.on=="function"&&(!U||typeof v.pause=="function"&&typeof v.resume=="function")&&(!v._writableState||((Q=v._readableState)===null||Q===void 0?void 0:Q.readable)!==!1)&&(!v._writableState||v._readableState))}function y(v){var U;return!!(v&&typeof v.write=="function"&&typeof v.on=="function"&&(!v._readableState||((U=v._writableState)===null||U===void 0?void 0:U.writable)!==!1))}function w(v){return!!(v&&typeof v.pipe=="function"&&v._readableState&&typeof v.on=="function"&&typeof v.write=="function")}function g(v){return v&&(v._readableState||v._writableState||typeof v.write=="function"&&typeof v.on=="function"||typeof v.pipe=="function"&&typeof v.on=="function")}function m(v){return!!(v&&!g(v)&&typeof v.pipeThrough=="function"&&typeof v.getReader=="function"&&typeof v.cancel=="function")}function _(v){return!!(v&&!g(v)&&typeof v.getWriter=="function"&&typeof v.abort=="function")}function x(v){return!!(v&&!g(v)&&typeof v.readable=="object"&&typeof v.writable=="object")}function S(v){return m(v)||_(v)||x(v)}function I(v,U){return v==null?!1:U===!0?typeof v[r]=="function":U===!1?typeof v[e]=="function":typeof v[r]=="function"||typeof v[e]=="function"}function b(v){if(!g(v))return null;const U=v._writableState,Q=v._readableState,z=U||Q;return!!(v.destroyed||v[n]||z!=null&&z.destroyed)}function c(v){if(!y(v))return null;if(v.writableEnded===!0)return!0;const U=v._writableState;return U!=null&&U.errored?!1:typeof U?.ended!="boolean"?null:U.ended}function p(v,U){if(!y(v))return null;if(v.writableFinished===!0)return!0;const Q=v._writableState;return Q!=null&&Q.errored?!1:typeof Q?.finished!="boolean"?null:!!(Q.finished||U===!1&&Q.ended===!0&&Q.length===0)}function N(v){if(!h(v))return null;if(v.readableEnded===!0)return!0;const U=v._readableState;return!U||U.errored?!1:typeof U?.ended!="boolean"?null:U.ended}function D(v,U){if(!h(v))return null;const Q=v._readableState;return Q!=null&&Q.errored?!1:typeof Q?.endEmitted!="boolean"?null:!!(Q.endEmitted||U===!1&&Q.ended===!0&&Q.length===0)}function T(v){return v&&v[s]!=null?v[s]:typeof v?.readable!="boolean"?null:b(v)?!1:h(v)&&v.readable&&!D(v)}function q(v){return v&&v[a]!=null?v[a]:typeof v?.writable!="boolean"?null:b(v)?!1:y(v)&&v.writable&&!c(v)}function R(v,U){return g(v)?b(v)?!0:!(U?.readable!==!1&&T(v)||U?.writable!==!1&&q(v)):null}function M(v){var U,Q;return g(v)?v.writableErrored?v.writableErrored:(U=(Q=v._writableState)===null||Q===void 0?void 0:Q.errored)!==null&&U!==void 0?U:null:null}function B(v){var U,Q;return g(v)?v.readableErrored?v.readableErrored:(U=(Q=v._readableState)===null||Q===void 0?void 0:Q.errored)!==null&&U!==void 0?U:null:null}function A(v){if(!g(v))return null;if(typeof v.closed=="boolean")return v.closed;const U=v._writableState,Q=v._readableState;return typeof U?.closed=="boolean"||typeof Q?.closed=="boolean"?U?.closed||Q?.closed:typeof v._closed=="boolean"&&j(v)?v._closed:null}function j(v){return typeof v._closed=="boolean"&&typeof v._defaultKeepAlive=="boolean"&&typeof v._removedConnection=="boolean"&&typeof v._removedContLen=="boolean"}function Y(v){return typeof v._sent100=="boolean"&&j(v)}function L(v){var U;return typeof v._consuming=="boolean"&&typeof v._dumped=="boolean"&&((U=v.req)===null||U===void 0?void 0:U.upgradeOrConnect)===void 0}function ee(v){if(!g(v))return null;const U=v._writableState,Q=v._readableState,z=U||Q;return!z&&Y(v)||!!(z&&z.autoDestroy&&z.emitClose&&z.closed===!1)}function C(v){var U;return!!(v&&((U=v[o])!==null&&U!==void 0?U:v.readableDidRead||v.readableAborted))}function K(v){var U,Q,z,ae,H,V,W,F,Z,te;return!!(v&&((U=(Q=(z=(ae=(H=(V=v[i])!==null&&V!==void 0?V:v.readableErrored)!==null&&H!==void 0?H:v.writableErrored)!==null&&ae!==void 0?ae:(W=v._readableState)===null||W===void 0?void 0:W.errorEmitted)!==null&&z!==void 0?z:(F=v._writableState)===null||F===void 0?void 0:F.errorEmitted)!==null&&Q!==void 0?Q:(Z=v._readableState)===null||Z===void 0?void 0:Z.errored)!==null&&U!==void 0?U:!((te=v._writableState)===null||te===void 0)&&te.errored))}return ei={isDestroyed:b,kIsDestroyed:n,isDisturbed:C,kIsDisturbed:o,isErrored:K,kIsErrored:i,isReadable:T,kIsReadable:s,kIsClosedPromise:l,kControllerErrorFunction:d,kIsWritable:a,isClosed:A,isDuplexNodeStream:w,isFinished:R,isIterable:I,isReadableNodeStream:h,isReadableStream:m,isReadableEnded:N,isReadableFinished:D,isReadableErrored:B,isNodeStream:g,isWebStream:S,isWritable:q,isWritableNodeStream:y,isWritableStream:_,isWritableEnded:c,isWritableFinished:p,isWritableErrored:M,isServerRequest:L,isServerResponse:Y,willEmitClose:ee,isTransformStream:x},ei}var Va;function Tt(){if(Va)return an.exports;Va=1;const r=Vt(),{AbortError:e,codes:t}=Ve(),{ERR_INVALID_ARG_TYPE:n,ERR_STREAM_PREMATURE_CLOSE:i}=t,{kEmptyObject:s,once:a}=ze(),{validateAbortSignal:o,validateFunction:l,validateObject:d,validateBoolean:h}=Xr(),{Promise:y,PromisePrototypeThen:w,SymbolDispose:g}=$e(),{isClosed:m,isReadable:_,isReadableNodeStream:x,isReadableStream:S,isReadableFinished:I,isReadableErrored:b,isWritable:c,isWritableNodeStream:p,isWritableStream:N,isWritableFinished:D,isWritableErrored:T,isNodeStream:q,willEmitClose:R,kIsClosedPromise:M}=wt();let B;function A(C){return C.setHeader&&typeof C.abort=="function"}const j=()=>{};function Y(C,K,v){var U,Q;if(arguments.length===2?(v=K,K=s):K==null?K=s:d(K,"options"),l(v,"callback"),o(K.signal,"options.signal"),v=a(v),S(C)||N(C))return L(C,K,v);if(!q(C))throw new n("stream",["ReadableStream","WritableStream","Stream"],C);const z=(U=K.readable)!==null&&U!==void 0?U:x(C),ae=(Q=K.writable)!==null&&Q!==void 0?Q:p(C),H=C._writableState,V=C._readableState,W=()=>{C.writable||te()};let F=R(C)&&x(C)===z&&p(C)===ae,Z=D(C,!1);const te=()=>{Z=!0,C.destroyed&&(F=!1),!(F&&(!C.readable||z))&&(!z||ce)&&v.call(C)};let ce=I(C,!1);const fe=()=>{ce=!0,C.destroyed&&(F=!1),!(F&&(!C.writable||ae))&&(!ae||Z)&&v.call(C)},O=X=>{v.call(C,X)};let G=m(C);const re=()=>{G=!0;const X=T(C)||b(C);if(X&&typeof X!="boolean")return v.call(C,X);if(z&&!ce&&x(C,!0)&&!I(C,!1))return v.call(C,new i);if(ae&&!Z&&!D(C,!1))return v.call(C,new i);v.call(C)},ue=()=>{G=!0;const X=T(C)||b(C);if(X&&typeof X!="boolean")return v.call(C,X);v.call(C)},de=()=>{C.req.on("finish",te)};A(C)?(C.on("complete",te),F||C.on("abort",re),C.req?de():C.on("request",de)):ae&&!H&&(C.on("end",W),C.on("close",W)),!F&&typeof C.aborted=="boolean"&&C.on("aborted",re),C.on("end",fe),C.on("finish",te),K.error!==!1&&C.on("error",O),C.on("close",re),G?r.nextTick(re):H!=null&&H.errorEmitted||V!=null&&V.errorEmitted?F||r.nextTick(ue):(!z&&(!F||_(C))&&(Z||c(C)===!1)||!ae&&(!F||c(C))&&(ce||_(C)===!1)||V&&C.req&&C.aborted)&&r.nextTick(ue);const pe=()=>{v=j,C.removeListener("aborted",re),C.removeListener("complete",te),C.removeListener("abort",re),C.removeListener("request",de),C.req&&C.req.removeListener("finish",te),C.removeListener("end",W),C.removeListener("close",W),C.removeListener("finish",te),C.removeListener("end",fe),C.removeListener("error",O),C.removeListener("close",re)};if(K.signal&&!G){const X=()=>{const le=v;pe(),le.call(C,new e(void 0,{cause:K.signal.reason}))};if(K.signal.aborted)r.nextTick(X);else{B=B||ze().addAbortListener;const le=B(K.signal,X),he=v;v=a((...se)=>{le[g](),he.apply(C,se)})}}return pe}function L(C,K,v){let U=!1,Q=j;if(K.signal)if(Q=()=>{U=!0,v.call(C,new e(void 0,{cause:K.signal.reason}))},K.signal.aborted)r.nextTick(Q);else{B=B||ze().addAbortListener;const ae=B(K.signal,Q),H=v;v=a((...V)=>{ae[g](),H.apply(C,V)})}const z=(...ae)=>{U||r.nextTick(()=>v.apply(C,ae))};return w(C[M].promise,z,z),j}function ee(C,K){var v;let U=!1;return K===null&&(K=s),(v=K)!==null&&v!==void 0&&v.cleanup&&(h(K.cleanup,"cleanup"),U=K.cleanup),new y((Q,z)=>{const ae=Y(C,K,H=>{U&&ae(),H?z(H):Q()})})}return an.exports=Y,an.exports.finished=ee,an.exports}var ti,Ga;function ur(){if(Ga)return ti;Ga=1;const r=Vt(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:n}=Ve(),{Symbol:i}=$e(),{kIsDestroyed:s,isDestroyed:a,isFinished:o,isServerRequest:l}=wt(),d=i("kDestroy"),h=i("kConstruct");function y(R,M,B){R&&(R.stack,M&&!M.errored&&(M.errored=R),B&&!B.errored&&(B.errored=R))}function w(R,M){const B=this._readableState,A=this._writableState,j=A||B;return A!=null&&A.destroyed||B!=null&&B.destroyed?(typeof M=="function"&&M(),this):(y(R,A,B),A&&(A.destroyed=!0),B&&(B.destroyed=!0),j.constructed?g(this,R,M):this.once(d,function(Y){g(this,e(Y,R),M)}),this)}function g(R,M,B){let A=!1;function j(Y){if(A)return;A=!0;const L=R._readableState,ee=R._writableState;y(Y,ee,L),ee&&(ee.closed=!0),L&&(L.closed=!0),typeof B=="function"&&B(Y),Y?r.nextTick(m,R,Y):r.nextTick(_,R)}try{R._destroy(M||null,j)}catch(Y){j(Y)}}function m(R,M){x(R,M),_(R)}function _(R){const M=R._readableState,B=R._writableState;B&&(B.closeEmitted=!0),M&&(M.closeEmitted=!0),(B!=null&&B.emitClose||M!=null&&M.emitClose)&&R.emit("close")}function x(R,M){const B=R._readableState,A=R._writableState;A!=null&&A.errorEmitted||B!=null&&B.errorEmitted||(A&&(A.errorEmitted=!0),B&&(B.errorEmitted=!0),R.emit("error",M))}function S(){const R=this._readableState,M=this._writableState;R&&(R.constructed=!0,R.closed=!1,R.closeEmitted=!1,R.destroyed=!1,R.errored=null,R.errorEmitted=!1,R.reading=!1,R.ended=R.readable===!1,R.endEmitted=R.readable===!1),M&&(M.constructed=!0,M.destroyed=!1,M.closed=!1,M.closeEmitted=!1,M.errored=null,M.errorEmitted=!1,M.finalCalled=!1,M.prefinished=!1,M.ended=M.writable===!1,M.ending=M.writable===!1,M.finished=M.writable===!1)}function I(R,M,B){const A=R._readableState,j=R._writableState;if(j!=null&&j.destroyed||A!=null&&A.destroyed)return this;A!=null&&A.autoDestroy||j!=null&&j.autoDestroy?R.destroy(M):M&&(M.stack,j&&!j.errored&&(j.errored=M),A&&!A.errored&&(A.errored=M),B?r.nextTick(x,R,M):x(R,M))}function b(R,M){if(typeof R._construct!="function")return;const B=R._readableState,A=R._writableState;B&&(B.constructed=!1),A&&(A.constructed=!1),R.once(h,M),!(R.listenerCount(h)>1)&&r.nextTick(c,R)}function c(R){let M=!1;function B(A){if(M){I(R,A??new t);return}M=!0;const j=R._readableState,Y=R._writableState,L=Y||j;j&&(j.constructed=!0),Y&&(Y.constructed=!0),L.destroyed?R.emit(d,A):A?I(R,A,!0):r.nextTick(p,R)}try{R._construct(A=>{r.nextTick(B,A)})}catch(A){r.nextTick(B,A)}}function p(R){R.emit(h)}function N(R){return R?.setHeader&&typeof R.abort=="function"}function D(R){R.emit("close")}function T(R,M){R.emit("error",M),r.nextTick(D,R)}function q(R,M){!R||a(R)||(!M&&!o(R)&&(M=new n),l(R)?(R.socket=null,R.destroy(M)):N(R)?R.abort():N(R.req)?R.req.abort():typeof R.destroy=="function"?R.destroy(M):typeof R.close=="function"?R.close():M?r.nextTick(T,R,M):r.nextTick(D,R),R.destroyed||(R[s]=!0))}return ti={construct:b,destroyer:q,destroy:w,undestroy:S,errorOrDestroy:I},ti}var ri,Wa;function Fs(){if(Wa)return ri;Wa=1;const{ArrayIsArray:r,ObjectSetPrototypeOf:e}=$e(),{EventEmitter:t}=Tn();function n(s){t.call(this,s)}e(n.prototype,t.prototype),e(n,t),n.prototype.pipe=function(s,a){const o=this;function l(_){s.writable&&s.write(_)===!1&&o.pause&&o.pause()}o.on("data",l);function d(){o.readable&&o.resume&&o.resume()}s.on("drain",d),!s._isStdio&&(!a||a.end!==!1)&&(o.on("end",y),o.on("close",w));let h=!1;function y(){h||(h=!0,s.end())}function w(){h||(h=!0,typeof s.destroy=="function"&&s.destroy())}function g(_){m(),t.listenerCount(this,"error")===0&&this.emit("error",_)}i(o,"error",g),i(s,"error",g);function m(){o.removeListener("data",l),s.removeListener("drain",d),o.removeListener("end",y),o.removeListener("close",w),o.removeListener("error",g),s.removeListener("error",g),o.removeListener("end",m),o.removeListener("close",m),s.removeListener("close",m)}return o.on("end",m),o.on("close",m),s.on("close",m),s.emit("pipe",o),s};function i(s,a,o){if(typeof s.prependListener=="function")return s.prependListener(a,o);!s._events||!s._events[a]?s.on(a,o):r(s._events[a])?s._events[a].unshift(o):s._events[a]=[o,s._events[a]]}return ri={Stream:n,prependListener:i},ri}var ni={exports:{}},za;function An(){return za||(za=1,function(r){const{SymbolDispose:e}=$e(),{AbortError:t,codes:n}=Ve(),{isNodeStream:i,isWebStream:s,kControllerErrorFunction:a}=wt(),o=Tt(),{ERR_INVALID_ARG_TYPE:l}=n;let d;const h=(y,w)=>{if(typeof y!="object"||!("aborted"in y))throw new l(w,"AbortSignal",y)};r.exports.addAbortSignal=function(w,g){if(h(w,"signal"),!i(g)&&!s(g))throw new l("stream",["ReadableStream","WritableStream","Stream"],g);return r.exports.addAbortSignalNoValidate(w,g)},r.exports.addAbortSignalNoValidate=function(y,w){if(typeof y!="object"||!("aborted"in y))return w;const g=i(w)?()=>{w.destroy(new t(void 0,{cause:y.reason}))}:()=>{w[a](new t(void 0,{cause:y.reason}))};if(y.aborted)g();else{d=d||ze().addAbortListener;const m=d(y,g);o(w,m[e])}return w}}(ni)),ni.exports}var ii,Ja;function Uc(){if(Ja)return ii;Ja=1;const{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:n}=$e(),{Buffer:i}=bt(),{inspect:s}=ze();return ii=class{constructor(){this.head=null,this.tail=null,this.length=0}push(o){const l={data:o,next:null};this.length>0?this.tail.next=l:this.head=l,this.tail=l,++this.length}unshift(o){const l={data:o,next:this.head};this.length===0&&(this.tail=l),this.head=l,++this.length}shift(){if(this.length===0)return;const o=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,o}clear(){this.head=this.tail=null,this.length=0}join(o){if(this.length===0)return"";let l=this.head,d=""+l.data;for(;(l=l.next)!==null;)d+=o+l.data;return d}concat(o){if(this.length===0)return i.alloc(0);const l=i.allocUnsafe(o>>>0);let d=this.head,h=0;for(;d;)t(l,d.data,h),h+=d.data.length,d=d.next;return l}consume(o,l){const d=this.head.data;if(o<d.length){const h=d.slice(0,o);return this.head.data=d.slice(o),h}return o===d.length?this.shift():l?this._getString(o):this._getBuffer(o)}first(){return this.head.data}*[e](){for(let o=this.head;o;o=o.next)yield o.data}_getString(o){let l="",d=this.head,h=0;do{const y=d.data;if(o>y.length)l+=y,o-=y.length;else{o===y.length?(l+=y,++h,d.next?this.head=d.next:this.head=this.tail=null):(l+=r(y,0,o),this.head=d,d.data=r(y,o));break}++h}while((d=d.next)!==null);return this.length-=h,l}_getBuffer(o){const l=i.allocUnsafe(o),d=o;let h=this.head,y=0;do{const w=h.data;if(o>w.length)t(l,w,d-o),o-=w.length;else{o===w.length?(t(l,w,d-o),++y,h.next?this.head=h.next:this.head=this.tail=null):(t(l,new n(w.buffer,w.byteOffset,o),d-o),this.head=h,h.data=w.slice(o));break}++y}while((h=h.next)!==null);return this.length-=y,l}[Symbol.for("nodejs.util.inspect.custom")](o,l){return s(this,{...l,depth:0,customInspect:!1})}},ii}var si,Qa;function Ln(){if(Qa)return si;Qa=1;const{MathFloor:r,NumberIsInteger:e}=$e(),{validateInteger:t}=Xr(),{ERR_INVALID_ARG_VALUE:n}=Ve().codes;let i=16*1024,s=16;function a(h,y,w){return h.highWaterMark!=null?h.highWaterMark:y?h[w]:null}function o(h){return h?s:i}function l(h,y){t(y,"value",0),h?s=y:i=y}function d(h,y,w,g){const m=a(y,g,w);if(m!=null){if(!e(m)||m<0){const _=g?`options.${w}`:"options.highWaterMark";throw new n(_,m)}return r(m)}return o(h.objectMode)}return si={getHighWaterMark:d,getDefaultHighWaterMark:o,setDefaultHighWaterMark:l},si}var ai={},on={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Xa;function Hc(){return Xa||(Xa=1,function(r,e){var t=bt(),n=t.Buffer;function i(a,o){for(var l in a)o[l]=a[l]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?r.exports=t:(i(t,e),e.Buffer=s);function s(a,o,l){return n(a,o,l)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(a,o,l){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,o,l)},s.alloc=function(a,o,l){if(typeof a!="number")throw new TypeError("Argument must be a number");var d=n(a);return o!==void 0?typeof l=="string"?d.fill(o,l):d.fill(o):d.fill(0),d},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(a)}}(on,on.exports)),on.exports}var Ka;function Vc(){if(Ka)return ai;Ka=1;var r=Hc().Buffer,e=r.isEncoding||function(S){switch(S=""+S,S&&S.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(S){if(!S)return"utf8";for(var I;;)switch(S){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 S;default:if(I)return;S=(""+S).toLowerCase(),I=!0}}function n(S){var I=t(S);if(typeof I!="string"&&(r.isEncoding===e||!e(S)))throw new Error("Unknown encoding: "+S);return I||S}ai.StringDecoder=i;function i(S){this.encoding=n(S);var I;switch(this.encoding){case"utf16le":this.text=y,this.end=w,I=4;break;case"utf8":this.fillLast=l,I=4;break;case"base64":this.text=g,this.end=m,I=3;break;default:this.write=_,this.end=x;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(I)}i.prototype.write=function(S){if(S.length===0)return"";var I,b;if(this.lastNeed){if(I=this.fillLast(S),I===void 0)return"";b=this.lastNeed,this.lastNeed=0}else b=0;return b<S.length?I?I+this.text(S,b):this.text(S,b):I||""},i.prototype.end=h,i.prototype.text=d,i.prototype.fillLast=function(S){if(this.lastNeed<=S.length)return S.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);S.copy(this.lastChar,this.lastTotal-this.lastNeed,0,S.length),this.lastNeed-=S.length};function s(S){return S<=127?0:S>>5===6?2:S>>4===14?3:S>>3===30?4:S>>6===2?-1:-2}function a(S,I,b){var c=I.length-1;if(c<b)return 0;var p=s(I[c]);return p>=0?(p>0&&(S.lastNeed=p-1),p):--c<b||p===-2?0:(p=s(I[c]),p>=0?(p>0&&(S.lastNeed=p-2),p):--c<b||p===-2?0:(p=s(I[c]),p>=0?(p>0&&(p===2?p=0:S.lastNeed=p-3),p):0))}function o(S,I,b){if((I[0]&192)!==128)return S.lastNeed=0,"�";if(S.lastNeed>1&&I.length>1){if((I[1]&192)!==128)return S.lastNeed=1,"�";if(S.lastNeed>2&&I.length>2&&(I[2]&192)!==128)return S.lastNeed=2,"�"}}function l(S){var I=this.lastTotal-this.lastNeed,b=o(this,S);if(b!==void 0)return b;if(this.lastNeed<=S.length)return S.copy(this.lastChar,I,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);S.copy(this.lastChar,I,0,S.length),this.lastNeed-=S.length}function d(S,I){var b=a(this,S,I);if(!this.lastNeed)return S.toString("utf8",I);this.lastTotal=b;var c=S.length-(b-this.lastNeed);return S.copy(this.lastChar,0,c),S.toString("utf8",I,c)}function h(S){var I=S&&S.length?this.write(S):"";return this.lastNeed?I+"�":I}function y(S,I){if((S.length-I)%2===0){var b=S.toString("utf16le",I);if(b){var c=b.charCodeAt(b.length-1);if(c>=55296&&c<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=S[S.length-2],this.lastChar[1]=S[S.length-1],b.slice(0,-1)}return b}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=S[S.length-1],S.toString("utf16le",I,S.length-1)}function w(S){var I=S&&S.length?this.write(S):"";if(this.lastNeed){var b=this.lastTotal-this.lastNeed;return I+this.lastChar.toString("utf16le",0,b)}return I}function g(S,I){var b=(S.length-I)%3;return b===0?S.toString("base64",I):(this.lastNeed=3-b,this.lastTotal=3,b===1?this.lastChar[0]=S[S.length-1]:(this.lastChar[0]=S[S.length-2],this.lastChar[1]=S[S.length-1]),S.toString("base64",I,S.length-b))}function m(S){var I=S&&S.length?this.write(S):"";return this.lastNeed?I+this.lastChar.toString("base64",0,3-this.lastNeed):I}function _(S){return S.toString(this.encoding)}function x(S){return S&&S.length?this.write(S):""}return ai}var oi,Ya;function bu(){if(Ya)return oi;Ya=1;const r=Vt(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:n}=$e(),{Buffer:i}=bt(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_NULL_VALUES:a}=Ve().codes;function o(l,d,h){let y;if(typeof d=="string"||d instanceof i)return new l({objectMode:!0,...h,read(){this.push(d),this.push(null)}});let w;if(d&&d[t])w=!0,y=d[t]();else if(d&&d[n])w=!1,y=d[n]();else throw new s("iterable",["Iterable"],d);const g=new l({objectMode:!0,highWaterMark:1,...h});let m=!1;g._read=function(){m||(m=!0,x())},g._destroy=function(S,I){e(_(S),()=>r.nextTick(I,S),b=>r.nextTick(I,b||S))};async function _(S){const I=S!=null,b=typeof y.throw=="function";if(I&&b){const{value:c,done:p}=await y.throw(S);if(await c,p)return}if(typeof y.return=="function"){const{value:c}=await y.return();await c}}async function x(){for(;;){try{const{value:S,done:I}=w?await y.next():y.next();if(I)g.push(null);else{const b=S&&typeof S.then=="function"?await S:S;if(b===null)throw m=!1,new a;if(g.push(b))continue;m=!1}}catch(S){g.destroy(S)}break}}return g}return oi=o,oi}var li,Za;function jn(){if(Za)return li;Za=1;const r=Vt(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:n,NumberParseInt:i,ObjectDefineProperties:s,ObjectKeys:a,ObjectSetPrototypeOf:o,Promise:l,SafeSet:d,SymbolAsyncDispose:h,SymbolAsyncIterator:y,Symbol:w}=$e();li=se,se.ReadableState=he;const{EventEmitter:g}=Tn(),{Stream:m,prependListener:_}=Fs(),{Buffer:x}=bt(),{addAbortSignal:S}=An(),I=Tt();let b=ze().debuglog("stream",$=>{b=$});const c=Uc(),p=ur(),{getHighWaterMark:N,getDefaultHighWaterMark:D}=Ln(),{aggregateTwoErrors:T,codes:{ERR_INVALID_ARG_TYPE:q,ERR_METHOD_NOT_IMPLEMENTED:R,ERR_OUT_OF_RANGE:M,ERR_STREAM_PUSH_AFTER_EOF:B,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:A},AbortError:j}=Ve(),{validateObject:Y}=Xr(),L=w("kPaused"),{StringDecoder:ee}=Vc(),C=bu();o(se.prototype,m.prototype),o(se,m);const K=()=>{},{errorOrDestroy:v}=p,U=1,Q=2,z=4,ae=8,H=16,V=32,W=64,F=128,Z=256,te=512,ce=1024,fe=2048,O=4096,G=8192,re=16384,ue=32768,de=65536,pe=1<<17,X=1<<18;function le($){return{enumerable:!1,get(){return(this.state&$)!==0},set(P){P?this.state|=$:this.state&=~$}}}s(he.prototype,{objectMode:le(U),ended:le(Q),endEmitted:le(z),reading:le(ae),constructed:le(H),sync:le(V),needReadable:le(W),emittedReadable:le(F),readableListening:le(Z),resumeScheduled:le(te),errorEmitted:le(ce),emitClose:le(fe),autoDestroy:le(O),destroyed:le(G),closed:le(re),closeEmitted:le(ue),multiAwaitDrain:le(de),readingMore:le(pe),dataEmitted:le(X)});function he($,P,ge){typeof ge!="boolean"&&(ge=P instanceof yt()),this.state=fe|O|H|V,$&&$.objectMode&&(this.state|=U),ge&&$&&$.readableObjectMode&&(this.state|=U),this.highWaterMark=$?N(this,$,"readableHighWaterMark",ge):D(!1),this.buffer=new c,this.length=0,this.pipes=[],this.flowing=null,this[L]=null,$&&$.emitClose===!1&&(this.state&=~fe),$&&$.autoDestroy===!1&&(this.state&=~O),this.errored=null,this.defaultEncoding=$&&$.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,$&&$.encoding&&(this.decoder=new ee($.encoding),this.encoding=$.encoding)}function se($){if(!(this instanceof se))return new se($);const P=this instanceof yt();this._readableState=new he($,this,P),$&&(typeof $.read=="function"&&(this._read=$.read),typeof $.destroy=="function"&&(this._destroy=$.destroy),typeof $.construct=="function"&&(this._construct=$.construct),$.signal&&!P&&S($.signal,this)),m.call(this,$),p.construct(this,()=>{this._readableState.needReadable&&J(this,this._readableState)})}se.prototype.destroy=p.destroy,se.prototype._undestroy=p.undestroy,se.prototype._destroy=function($,P){P($)},se.prototype[g.captureRejectionSymbol]=function($){this.destroy($)},se.prototype[h]=function(){let $;return this.destroyed||($=this.readableEnded?null:new j,this.destroy($)),new l((P,ge)=>I(this,ye=>ye&&ye!==$?ge(ye):P(null)))},se.prototype.push=function($,P){return Ee(this,$,P,!1)},se.prototype.unshift=function($,P){return Ee(this,$,P,!0)};function Ee($,P,ge,ye){b("readableAddChunk",P);const me=$._readableState;let Be;if((me.state&U)===0&&(typeof P=="string"?(ge=ge||me.defaultEncoding,me.encoding!==ge&&(ye&&me.encoding?P=x.from(P,ge).toString(me.encoding):(P=x.from(P,ge),ge=""))):P instanceof x?ge="":m._isUint8Array(P)?(P=m._uint8ArrayToBuffer(P),ge=""):P!=null&&(Be=new q("chunk",["string","Buffer","Uint8Array"],P))),Be)v($,Be);else if(P===null)me.state&=~ae,u($,me);else if((me.state&U)!==0||P&&P.length>0)if(ye)if((me.state&z)!==0)v($,new A);else{if(me.destroyed||me.errored)return!1;qe($,me,P,!0)}else if(me.ended)v($,new B);else{if(me.destroyed||me.errored)return!1;me.state&=~ae,me.decoder&&!ge?(P=me.decoder.write(P),me.objectMode||P.length!==0?qe($,me,P,!1):J($,me)):qe($,me,P,!1)}else ye||(me.state&=~ae,J($,me));return!me.ended&&(me.length<me.highWaterMark||me.length===0)}function qe($,P,ge,ye){P.flowing&&P.length===0&&!P.sync&&$.listenerCount("data")>0?((P.state&de)!==0?P.awaitDrainWriters.clear():P.awaitDrainWriters=null,P.dataEmitted=!0,$.emit("data",ge)):(P.length+=P.objectMode?1:ge.length,ye?P.buffer.unshift(ge):P.buffer.push(ge),(P.state&W)!==0&&f($)),J($,P)}se.prototype.isPaused=function(){const $=this._readableState;return $[L]===!0||$.flowing===!1},se.prototype.setEncoding=function($){const P=new ee($);this._readableState.decoder=P,this._readableState.encoding=this._readableState.decoder.encoding;const ge=this._readableState.buffer;let ye="";for(const me of ge)ye+=P.write(me);return ge.clear(),ye!==""&&ge.push(ye),this._readableState.length=ye.length,this};const _e=1073741824;function He($){if($>_e)throw new M("size","<= 1GiB",$);return $--,$|=$>>>1,$|=$>>>2,$|=$>>>4,$|=$>>>8,$|=$>>>16,$++,$}function E($,P){return $<=0||P.length===0&&P.ended?0:(P.state&U)!==0?1:n($)?P.flowing&&P.length?P.buffer.first().length:P.length:$<=P.length?$:P.ended?P.length:0}se.prototype.read=function($){b("read",$),$===void 0?$=NaN:t($)||($=i($,10));const P=this._readableState,ge=$;if($>P.highWaterMark&&(P.highWaterMark=He($)),$!==0&&(P.state&=~F),$===0&&P.needReadable&&((P.highWaterMark!==0?P.length>=P.highWaterMark:P.length>0)||P.ended))return b("read: emitReadable",P.length,P.ended),P.length===0&&P.ended?qn(this):f(this),null;if($=E($,P),$===0&&P.ended)return P.length===0&&qn(this),null;let ye=(P.state&W)!==0;if(b("need readable",ye),(P.length===0||P.length-$<P.highWaterMark)&&(ye=!0,b("length less than watermark",ye)),P.ended||P.reading||P.destroyed||P.errored||!P.constructed)ye=!1,b("reading, ended or constructing",ye);else if(ye){b("do read"),P.state|=ae|V,P.length===0&&(P.state|=W);try{this._read(P.highWaterMark)}catch(Be){v(this,Be)}P.state&=~V,P.reading||($=E(ge,P))}let me;return $>0?me=wa($,P):me=null,me===null?(P.needReadable=P.length<=P.highWaterMark,$=0):(P.length-=$,P.multiAwaitDrain?P.awaitDrainWriters.clear():P.awaitDrainWriters=null),P.length===0&&(P.ended||(P.needReadable=!0),ge!==$&&P.ended&&qn(this)),me!==null&&!P.errorEmitted&&!P.closeEmitted&&(P.dataEmitted=!0,this.emit("data",me)),me};function u($,P){if(b("onEofChunk"),!P.ended){if(P.decoder){const ge=P.decoder.end();ge&&ge.length&&(P.buffer.push(ge),P.length+=P.objectMode?1:ge.length)}P.ended=!0,P.sync?f($):(P.needReadable=!1,P.emittedReadable=!0,k($))}}function f($){const P=$._readableState;b("emitReadable",P.needReadable,P.emittedReadable),P.needReadable=!1,P.emittedReadable||(b("emitReadable",P.flowing),P.emittedReadable=!0,r.nextTick(k,$))}function k($){const P=$._readableState;b("emitReadable_",P.destroyed,P.length,P.ended),!P.destroyed&&!P.errored&&(P.length||P.ended)&&($.emit("readable"),P.emittedReadable=!1),P.needReadable=!P.flowing&&!P.ended&&P.length<=P.highWaterMark,Ie($)}function J($,P){!P.readingMore&&P.constructed&&(P.readingMore=!0,r.nextTick(ie,$,P))}function ie($,P){for(;!P.reading&&!P.ended&&(P.length<P.highWaterMark||P.flowing&&P.length===0);){const ge=P.length;if(b("maybeReadMore read 0"),$.read(0),ge===P.length)break}P.readingMore=!1}se.prototype._read=function($){throw new R("_read()")},se.prototype.pipe=function($,P){const ge=this,ye=this._readableState;ye.pipes.length===1&&(ye.multiAwaitDrain||(ye.multiAwaitDrain=!0,ye.awaitDrainWriters=new d(ye.awaitDrainWriters?[ye.awaitDrainWriters]:[]))),ye.pipes.push($),b("pipe count=%d opts=%j",ye.pipes.length,P);const Be=(!P||P.end!==!1)&&$!==r.stdout&&$!==r.stderr?_a:hr;ye.endEmitted?r.nextTick(Be):ge.once("end",Be),$.on("unpipe",Ye);function Ye(jt,pt){b("onunpipe"),jt===ge&&pt&&pt.hasUnpiped===!1&&(pt.hasUnpiped=!0,vc())}function _a(){b("onend"),$.end()}let Lt,xa=!1;function vc(){b("cleanup"),$.removeListener("close",Un),$.removeListener("finish",Hn),Lt&&$.removeListener("drain",Lt),$.removeListener("error",Fn),$.removeListener("unpipe",Ye),ge.removeListener("end",_a),ge.removeListener("end",hr),ge.removeListener("data",Ea),xa=!0,Lt&&ye.awaitDrainWriters&&(!$._writableState||$._writableState.needDrain)&&Lt()}function Sa(){xa||(ye.pipes.length===1&&ye.pipes[0]===$?(b("false write response, pause",0),ye.awaitDrainWriters=$,ye.multiAwaitDrain=!1):ye.pipes.length>1&&ye.pipes.includes($)&&(b("false write response, pause",ye.awaitDrainWriters.size),ye.awaitDrainWriters.add($)),ge.pause()),Lt||(Lt=oe(ge,$),$.on("drain",Lt))}ge.on("data",Ea);function Ea(jt){b("ondata");const pt=$.write(jt);b("dest.write",pt),pt===!1&&Sa()}function Fn(jt){if(b("onerror",jt),hr(),$.removeListener("error",Fn),$.listenerCount("error")===0){const pt=$._writableState||$._readableState;pt&&!pt.errorEmitted?v($,jt):$.emit("error",jt)}}_($,"error",Fn);function Un(){$.removeListener("finish",Hn),hr()}$.once("close",Un);function Hn(){b("onfinish"),$.removeListener("close",Un),hr()}$.once("finish",Hn);function hr(){b("unpipe"),ge.unpipe($)}return $.emit("pipe",ge),$.writableNeedDrain===!0?Sa():ye.flowing||(b("pipe resume"),ge.resume()),$};function oe($,P){return function(){const ye=$._readableState;ye.awaitDrainWriters===P?(b("pipeOnDrain",1),ye.awaitDrainWriters=null):ye.multiAwaitDrain&&(b("pipeOnDrain",ye.awaitDrainWriters.size),ye.awaitDrainWriters.delete(P)),(!ye.awaitDrainWriters||ye.awaitDrainWriters.size===0)&&$.listenerCount("data")&&$.resume()}}se.prototype.unpipe=function($){const P=this._readableState,ge={hasUnpiped:!1};if(P.pipes.length===0)return this;if(!$){const me=P.pipes;P.pipes=[],this.pause();for(let Be=0;Be<me.length;Be++)me[Be].emit("unpipe",this,{hasUnpiped:!1});return this}const ye=e(P.pipes,$);return ye===-1?this:(P.pipes.splice(ye,1),P.pipes.length===0&&this.pause(),$.emit("unpipe",this,ge),this)},se.prototype.on=function($,P){const ge=m.prototype.on.call(this,$,P),ye=this._readableState;return $==="data"?(ye.readableListening=this.listenerCount("readable")>0,ye.flowing!==!1&&this.resume()):$==="readable"&&!ye.endEmitted&&!ye.readableListening&&(ye.readableListening=ye.needReadable=!0,ye.flowing=!1,ye.emittedReadable=!1,b("on readable",ye.length,ye.reading),ye.length?f(this):ye.reading||r.nextTick(Le,this)),ge},se.prototype.addListener=se.prototype.on,se.prototype.removeListener=function($,P){const ge=m.prototype.removeListener.call(this,$,P);return $==="readable"&&r.nextTick(we,this),ge},se.prototype.off=se.prototype.removeListener,se.prototype.removeAllListeners=function($){const P=m.prototype.removeAllListeners.apply(this,arguments);return($==="readable"||$===void 0)&&r.nextTick(we,this),P};function we($){const P=$._readableState;P.readableListening=$.listenerCount("readable")>0,P.resumeScheduled&&P[L]===!1?P.flowing=!0:$.listenerCount("data")>0?$.resume():P.readableListening||(P.flowing=null)}function Le($){b("readable nexttick read 0"),$.read(0)}se.prototype.resume=function(){const $=this._readableState;return $.flowing||(b("resume"),$.flowing=!$.readableListening,Te(this,$)),$[L]=!1,this};function Te($,P){P.resumeScheduled||(P.resumeScheduled=!0,r.nextTick(je,$,P))}function je($,P){b("resume",P.reading),P.reading||$.read(0),P.resumeScheduled=!1,$.emit("resume"),Ie($),P.flowing&&!P.reading&&$.read(0)}se.prototype.pause=function(){return b("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(b("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[L]=!0,this};function Ie($){const P=$._readableState;for(b("flow",P.flowing);P.flowing&&$.read()!==null;);}se.prototype.wrap=function($){let P=!1;$.on("data",ye=>{!this.push(ye)&&$.pause&&(P=!0,$.pause())}),$.on("end",()=>{this.push(null)}),$.on("error",ye=>{v(this,ye)}),$.on("close",()=>{this.destroy()}),$.on("destroy",()=>{this.destroy()}),this._read=()=>{P&&$.resume&&(P=!1,$.resume())};const ge=a($);for(let ye=1;ye<ge.length;ye++){const me=ge[ye];this[me]===void 0&&typeof $[me]=="function"&&(this[me]=$[me].bind($))}return this},se.prototype[y]=function(){return ba(this)},se.prototype.iterator=function($){return $!==void 0&&Y($,"options"),ba(this,$)};function ba($,P){typeof $.read!="function"&&($=se.wrap($,{objectMode:!0}));const ge=mc($,P);return ge.stream=$,ge}async function*mc($,P){let ge=K;function ye(Ye){this===$?(ge(),ge=K):ge=Ye}$.on("readable",ye);let me;const Be=I($,{writable:!1},Ye=>{me=Ye?T(me,Ye):null,ge(),ge=K});try{for(;;){const Ye=$.destroyed?null:$.read();if(Ye!==null)yield Ye;else{if(me)throw me;if(me===null)return;await new l(ye)}}}catch(Ye){throw me=T(me,Ye),me}finally{(me||P?.destroyOnReturn!==!1)&&(me===void 0||$._readableState.autoDestroy)?p.destroyer($,null):($.off("readable",ye),Be())}}s(se.prototype,{readable:{__proto__:null,get(){const $=this._readableState;return!!$&&$.readable!==!1&&!$.destroyed&&!$.errorEmitted&&!$.endEmitted},set($){this._readableState&&(this._readableState.readable=!!$)}},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($){this._readableState&&(this._readableState.flowing=$)}},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($){this._readableState&&(this._readableState.destroyed=$)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),s(he.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[L]!==!1},set($){this[L]=!!$}}}),se._fromList=wa;function wa($,P){if(P.length===0)return null;let ge;return P.objectMode?ge=P.buffer.shift():!$||$>=P.length?(P.decoder?ge=P.buffer.join(""):P.buffer.length===1?ge=P.buffer.first():ge=P.buffer.concat(P.length),P.buffer.clear()):ge=P.buffer.consume($,P.decoder),ge}function qn($){const P=$._readableState;b("endReadable",P.endEmitted),P.endEmitted||(P.ended=!0,r.nextTick(bc,P,$))}function bc($,P){if(b("endReadableNT",$.endEmitted,$.length),!$.errored&&!$.closeEmitted&&!$.endEmitted&&$.length===0){if($.endEmitted=!0,P.emit("end"),P.writable&&P.allowHalfOpen===!1)r.nextTick(wc,P);else if($.autoDestroy){const ge=P._writableState;(!ge||ge.autoDestroy&&(ge.finished||ge.writable===!1))&&P.destroy()}}}function wc($){$.writable&&!$.writableEnded&&!$.destroyed&&$.end()}se.from=function($,P){return C(se,$,P)};let Bn;function va(){return Bn===void 0&&(Bn={}),Bn}return se.fromWeb=function($,P){return va().newStreamReadableFromReadableStream($,P)},se.toWeb=function($,P){return va().newReadableStreamFromStreamReadable($,P)},se.wrap=function($,P){var ge,ye;return new se({objectMode:(ge=(ye=$.readableObjectMode)!==null&&ye!==void 0?ye:$.objectMode)!==null&&ge!==void 0?ge:!0,...P,destroy(me,Be){p.destroyer($,me),Be(me)}}).wrap($)},li}var ui,eo;function Us(){if(eo)return ui;eo=1;const r=Vt(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:n,ObjectDefineProperty:i,ObjectDefineProperties:s,ObjectSetPrototypeOf:a,StringPrototypeToLowerCase:o,Symbol:l,SymbolHasInstance:d}=$e();ui=Y,Y.WritableState=A;const{EventEmitter:h}=Tn(),y=Fs().Stream,{Buffer:w}=bt(),g=ur(),{addAbortSignal:m}=An(),{getHighWaterMark:_,getDefaultHighWaterMark:x}=Ln(),{ERR_INVALID_ARG_TYPE:S,ERR_METHOD_NOT_IMPLEMENTED:I,ERR_MULTIPLE_CALLBACK:b,ERR_STREAM_CANNOT_PIPE:c,ERR_STREAM_DESTROYED:p,ERR_STREAM_ALREADY_FINISHED:N,ERR_STREAM_NULL_VALUES:D,ERR_STREAM_WRITE_AFTER_END:T,ERR_UNKNOWN_ENCODING:q}=Ve().codes,{errorOrDestroy:R}=g;a(Y.prototype,y.prototype),a(Y,y);function M(){}const B=l("kOnFinished");function A(O,G,re){typeof re!="boolean"&&(re=G instanceof yt()),this.objectMode=!!(O&&O.objectMode),re&&(this.objectMode=this.objectMode||!!(O&&O.writableObjectMode)),this.highWaterMark=O?_(this,O,"writableHighWaterMark",re):x(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const ue=!!(O&&O.decodeStrings===!1);this.decodeStrings=!ue,this.defaultEncoding=O&&O.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=v.bind(void 0,G),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[B]=[]}function j(O){O.buffered=[],O.bufferedIndex=0,O.allBuffers=!0,O.allNoop=!0}A.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},i(A.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function Y(O){const G=this instanceof yt();if(!G&&!n(Y,this))return new Y(O);this._writableState=new A(O,this,G),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&&m(O.signal,this)),y.call(this,O),g.construct(this,()=>{const re=this._writableState;re.writing||ae(this,re),F(this,re)})}i(Y,d,{__proto__:null,value:function(O){return n(this,O)?!0:this!==Y?!1:O&&O._writableState instanceof A}}),Y.prototype.pipe=function(){R(this,new c)};function L(O,G,re,ue){const de=O._writableState;if(typeof re=="function")ue=re,re=de.defaultEncoding;else{if(!re)re=de.defaultEncoding;else if(re!=="buffer"&&!w.isEncoding(re))throw new q(re);typeof ue!="function"&&(ue=M)}if(G===null)throw new D;if(!de.objectMode)if(typeof G=="string")de.decodeStrings!==!1&&(G=w.from(G,re),re="buffer");else if(G instanceof w)re="buffer";else if(y._isUint8Array(G))G=y._uint8ArrayToBuffer(G),re="buffer";else throw new S("chunk",["string","Buffer","Uint8Array"],G);let pe;return de.ending?pe=new T:de.destroyed&&(pe=new p("write")),pe?(r.nextTick(ue,pe),R(O,pe,!0),pe):(de.pendingcb++,ee(O,de,G,re,ue))}Y.prototype.write=function(O,G,re){return L(this,O,G,re)===!0},Y.prototype.cork=function(){this._writableState.corked++},Y.prototype.uncork=function(){const O=this._writableState;O.corked&&(O.corked--,O.writing||ae(this,O))},Y.prototype.setDefaultEncoding=function(G){if(typeof G=="string"&&(G=o(G)),!w.isEncoding(G))throw new q(G);return this._writableState.defaultEncoding=G,this};function ee(O,G,re,ue,de){const pe=G.objectMode?1:re.length;G.length+=pe;const X=G.length<G.highWaterMark;return X||(G.needDrain=!0),G.writing||G.corked||G.errored||!G.constructed?(G.buffered.push({chunk:re,encoding:ue,callback:de}),G.allBuffers&&ue!=="buffer"&&(G.allBuffers=!1),G.allNoop&&de!==M&&(G.allNoop=!1)):(G.writelen=pe,G.writecb=de,G.writing=!0,G.sync=!0,O._write(re,ue,G.onwrite),G.sync=!1),X&&!G.errored&&!G.destroyed}function C(O,G,re,ue,de,pe,X){G.writelen=ue,G.writecb=X,G.writing=!0,G.sync=!0,G.destroyed?G.onwrite(new p("write")):re?O._writev(de,G.onwrite):O._write(de,pe,G.onwrite),G.sync=!1}function K(O,G,re,ue){--G.pendingcb,ue(re),z(G),R(O,re)}function v(O,G){const re=O._writableState,ue=re.sync,de=re.writecb;if(typeof de!="function"){R(O,new b);return}re.writing=!1,re.writecb=null,re.length-=re.writelen,re.writelen=0,G?(G.stack,re.errored||(re.errored=G),O._readableState&&!O._readableState.errored&&(O._readableState.errored=G),ue?r.nextTick(K,O,re,G,de):K(O,re,G,de)):(re.buffered.length>re.bufferedIndex&&ae(O,re),ue?re.afterWriteTickInfo!==null&&re.afterWriteTickInfo.cb===de?re.afterWriteTickInfo.count++:(re.afterWriteTickInfo={count:1,cb:de,stream:O,state:re},r.nextTick(U,re.afterWriteTickInfo)):Q(O,re,1,de))}function U({stream:O,state:G,count:re,cb:ue}){return G.afterWriteTickInfo=null,Q(O,G,re,ue)}function Q(O,G,re,ue){for(!G.ending&&!O.destroyed&&G.length===0&&G.needDrain&&(G.needDrain=!1,O.emit("drain"));re-- >0;)G.pendingcb--,ue();G.destroyed&&z(G),F(O,G)}function z(O){if(O.writing)return;for(let de=O.bufferedIndex;de<O.buffered.length;++de){var G;const{chunk:pe,callback:X}=O.buffered[de],le=O.objectMode?1:pe.length;O.length-=le,X((G=O.errored)!==null&&G!==void 0?G:new p("write"))}const re=O[B].splice(0);for(let de=0;de<re.length;de++){var ue;re[de]((ue=O.errored)!==null&&ue!==void 0?ue:new p("end"))}j(O)}function ae(O,G){if(G.corked||G.bufferProcessing||G.destroyed||!G.constructed)return;const{buffered:re,bufferedIndex:ue,objectMode:de}=G,pe=re.length-ue;if(!pe)return;let X=ue;if(G.bufferProcessing=!0,pe>1&&O._writev){G.pendingcb-=pe-1;const le=G.allNoop?M:se=>{for(let Ee=X;Ee<re.length;++Ee)re[Ee].callback(se)},he=G.allNoop&&X===0?re:e(re,X);he.allBuffers=G.allBuffers,C(O,G,!0,G.length,he,"",le),j(G)}else{do{const{chunk:le,encoding:he,callback:se}=re[X];re[X++]=null;const Ee=de?1:le.length;C(O,G,!1,Ee,le,he,se)}while(X<re.length&&!G.writing);X===re.length?j(G):X>256?(re.splice(0,X),G.bufferedIndex=0):G.bufferedIndex=X}G.bufferProcessing=!1}Y.prototype._write=function(O,G,re){if(this._writev)this._writev([{chunk:O,encoding:G}],re);else throw new I("_write()")},Y.prototype._writev=null,Y.prototype.end=function(O,G,re){const ue=this._writableState;typeof O=="function"?(re=O,O=null,G=null):typeof G=="function"&&(re=G,G=null);let de;if(O!=null){const pe=L(this,O,G);pe instanceof t&&(de=pe)}return ue.corked&&(ue.corked=1,this.uncork()),de||(!ue.errored&&!ue.ending?(ue.ending=!0,F(this,ue,!0),ue.ended=!0):ue.finished?de=new N("end"):ue.destroyed&&(de=new p("end"))),typeof re=="function"&&(de||ue.finished?r.nextTick(re,de):ue[B].push(re)),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 V(O,G){let re=!1;function ue(de){if(re){R(O,de??b());return}if(re=!0,G.pendingcb--,de){const pe=G[B].splice(0);for(let X=0;X<pe.length;X++)pe[X](de);R(O,de,G.sync)}else H(G)&&(G.prefinished=!0,O.emit("prefinish"),G.pendingcb++,r.nextTick(Z,O,G))}G.sync=!0,G.pendingcb++;try{O._final(ue)}catch(de){ue(de)}G.sync=!1}function W(O,G){!G.prefinished&&!G.finalCalled&&(typeof O._final=="function"&&!G.destroyed?(G.finalCalled=!0,V(O,G)):(G.prefinished=!0,O.emit("prefinish")))}function F(O,G,re){H(G)&&(W(O,G),G.pendingcb===0&&(re?(G.pendingcb++,r.nextTick((ue,de)=>{H(de)?Z(ue,de):de.pendingcb--},O,G)):H(G)&&(G.pendingcb++,Z(O,G))))}function Z(O,G){G.pendingcb--,G.finished=!0;const re=G[B].splice(0);for(let ue=0;ue<re.length;ue++)re[ue]();if(O.emit("finish"),G.autoDestroy){const ue=O._readableState;(!ue||ue.autoDestroy&&(ue.endEmitted||ue.readable===!1))&&O.destroy()}}s(Y.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 te=g.destroy;Y.prototype.destroy=function(O,G){const re=this._writableState;return!re.destroyed&&(re.bufferedIndex<re.buffered.length||re[B].length)&&r.nextTick(z,re),te.call(this,O,G),this},Y.prototype._undestroy=g.undestroy,Y.prototype._destroy=function(O,G){G(O)},Y.prototype[h.captureRejectionSymbol]=function(O){this.destroy(O)};let ce;function fe(){return ce===void 0&&(ce={}),ce}return Y.fromWeb=function(O,G){return fe().newStreamWritableFromWritableStream(O,G)},Y.toWeb=function(O){return fe().newWritableStreamFromStreamWritable(O)},ui}var ci,to;function Gc(){if(to)return ci;to=1;const r=Vt(),e=bt(),{isReadable:t,isWritable:n,isIterable:i,isNodeStream:s,isReadableNodeStream:a,isWritableNodeStream:o,isDuplexNodeStream:l,isReadableStream:d,isWritableStream:h}=wt(),y=Tt(),{AbortError:w,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:m}}=Ve(),{destroyer:_}=ur(),x=yt(),S=jn(),I=Us(),{createDeferredPromise:b}=ze(),c=bu(),p=globalThis.Blob||e.Blob,N=typeof p<"u"?function(A){return A instanceof p}:function(A){return!1},D=globalThis.AbortController||Gr().AbortController,{FunctionPrototypeCall:T}=$e();class q 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)}}ci=function B(A,j){if(l(A))return A;if(a(A))return M({readable:A});if(o(A))return M({writable:A});if(s(A))return M({writable:!1,readable:!1});if(d(A))return M({readable:S.fromWeb(A)});if(h(A))return M({writable:I.fromWeb(A)});if(typeof A=="function"){const{value:L,write:ee,final:C,destroy:K}=R(A);if(i(L))return c(q,L,{objectMode:!0,write:ee,final:C,destroy:K});const v=L?.then;if(typeof v=="function"){let U;const Q=T(v,L,z=>{if(z!=null)throw new m("nully","body",z)},z=>{_(U,z)});return U=new q({objectMode:!0,readable:!1,write:ee,final(z){C(async()=>{try{await Q,r.nextTick(z,null)}catch(ae){r.nextTick(z,ae)}})},destroy:K})}throw new m("Iterable, AsyncIterable or AsyncFunction",j,L)}if(N(A))return B(A.arrayBuffer());if(i(A))return c(q,A,{objectMode:!0,writable:!1});if(d(A?.readable)&&h(A?.writable))return q.fromWeb(A);if(typeof A?.writable=="object"||typeof A?.readable=="object"){const L=A!=null&&A.readable?a(A?.readable)?A?.readable:B(A.readable):void 0,ee=A!=null&&A.writable?o(A?.writable)?A?.writable:B(A.writable):void 0;return M({readable:L,writable:ee})}const Y=A?.then;if(typeof Y=="function"){let L;return T(Y,A,ee=>{ee!=null&&L.push(ee),L.push(null)},ee=>{_(L,ee)}),L=new q({objectMode:!0,writable:!1,read(){}})}throw new g(j,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],A)};function R(B){let{promise:A,resolve:j}=b();const Y=new D,L=Y.signal;return{value:B(async function*(){for(;;){const C=A;A=null;const{chunk:K,done:v,cb:U}=await C;if(r.nextTick(U),v)return;if(L.aborted)throw new w(void 0,{cause:L.reason});({promise:A,resolve:j}=b()),yield K}}(),{signal:L}),write(C,K,v){const U=j;j=null,U({chunk:C,done:!1,cb:v})},final(C){const K=j;j=null,K({done:!0,cb:C})},destroy(C,K){Y.abort(),K(C)}}}function M(B){const A=B.readable&&typeof B.readable.read!="function"?S.wrap(B.readable):B.readable,j=B.writable;let Y=!!t(A),L=!!n(j),ee,C,K,v,U;function Q(z){const ae=v;v=null,ae?ae(z):z&&U.destroy(z)}return U=new q({readableObjectMode:!!(A!=null&&A.readableObjectMode),writableObjectMode:!!(j!=null&&j.writableObjectMode),readable:Y,writable:L}),L&&(y(j,z=>{L=!1,z&&_(A,z),Q(z)}),U._write=function(z,ae,H){j.write(z,ae)?H():ee=H},U._final=function(z){j.end(),C=z},j.on("drain",function(){if(ee){const z=ee;ee=null,z()}}),j.on("finish",function(){if(C){const z=C;C=null,z()}})),Y&&(y(A,z=>{Y=!1,z&&_(A,z),Q(z)}),A.on("readable",function(){if(K){const z=K;K=null,z()}}),A.on("end",function(){U.push(null)}),U._read=function(){for(;;){const z=A.read();if(z===null){K=U._read;return}if(!U.push(z))return}}),U._destroy=function(z,ae){!z&&v!==null&&(z=new w),K=null,ee=null,C=null,v===null?ae(z):(v=ae,_(j,z),_(A,z))},U}return ci}var di,ro;function yt(){if(ro)return di;ro=1;const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:n}=$e();di=a;const i=jn(),s=Us();n(a.prototype,i.prototype),n(a,i);{const h=t(s.prototype);for(let y=0;y<h.length;y++){const w=h[y];a.prototype[w]||(a.prototype[w]=s.prototype[w])}}function a(h){if(!(this instanceof a))return new a(h);i.call(this,h),s.call(this,h),h?(this.allowHalfOpen=h.allowHalfOpen!==!1,h.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),h.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(s.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(s.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(s.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(s.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(s.prototype,"writableLength")},writableFinished:{__proto__:null,...e(s.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(s.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(s.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(s.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(h){this._readableState&&this._writableState&&(this._readableState.destroyed=h,this._writableState.destroyed=h)}}});let o;function l(){return o===void 0&&(o={}),o}a.fromWeb=function(h,y){return l().newStreamDuplexFromReadableWritablePair(h,y)},a.toWeb=function(h){return l().newReadableWritablePairFromDuplex(h)};let d;return a.from=function(h){return d||(d=Gc()),d(h,"body")},di}var fi,no;function wu(){if(no)return fi;no=1;const{ObjectSetPrototypeOf:r,Symbol:e}=$e();fi=a;const{ERR_METHOD_NOT_IMPLEMENTED:t}=Ve().codes,n=yt(),{getHighWaterMark:i}=Ln();r(a.prototype,n.prototype),r(a,n);const s=e("kCallback");function a(d){if(!(this instanceof a))return new a(d);const h=d?i(this,d,"readableHighWaterMark",!0):null;h===0&&(d={...d,highWaterMark:null,readableHighWaterMark:h,writableHighWaterMark:d.writableHighWaterMark||0}),n.call(this,d),this._readableState.sync=!1,this[s]=null,d&&(typeof d.transform=="function"&&(this._transform=d.transform),typeof d.flush=="function"&&(this._flush=d.flush)),this.on("prefinish",l)}function o(d){typeof this._flush=="function"&&!this.destroyed?this._flush((h,y)=>{if(h){d?d(h):this.destroy(h);return}y!=null&&this.push(y),this.push(null),d&&d()}):(this.push(null),d&&d())}function l(){this._final!==o&&o.call(this)}return a.prototype._final=o,a.prototype._transform=function(d,h,y){throw new t("_transform()")},a.prototype._write=function(d,h,y){const w=this._readableState,g=this._writableState,m=w.length;this._transform(d,h,(_,x)=>{if(_){y(_);return}x!=null&&this.push(x),g.ended||m===w.length||w.length<w.highWaterMark?y():this[s]=y})},a.prototype._read=function(){if(this[s]){const d=this[s];this[s]=null,d()}},fi}var hi,io;function vu(){if(io)return hi;io=1;const{ObjectSetPrototypeOf:r}=$e();hi=t;const e=wu();r(t.prototype,e.prototype),r(t,e);function t(n){if(!(this instanceof t))return new t(n);e.call(this,n)}return t.prototype._transform=function(n,i,s){s(null,n)},hi}var pi,so;function Hs(){if(so)return pi;so=1;const r=Vt(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:n,SymbolDispose:i}=$e(),s=Tt(),{once:a}=ze(),o=ur(),l=yt(),{aggregateTwoErrors:d,codes:{ERR_INVALID_ARG_TYPE:h,ERR_INVALID_RETURN_VALUE:y,ERR_MISSING_ARGS:w,ERR_STREAM_DESTROYED:g,ERR_STREAM_PREMATURE_CLOSE:m},AbortError:_}=Ve(),{validateFunction:x,validateAbortSignal:S}=Xr(),{isIterable:I,isReadable:b,isReadableNodeStream:c,isNodeStream:p,isTransformStream:N,isWebStream:D,isReadableStream:T,isReadableFinished:q}=wt(),R=globalThis.AbortController||Gr().AbortController;let M,B,A;function j(z,ae,H){let V=!1;z.on("close",()=>{V=!0});const W=s(z,{readable:ae,writable:H},F=>{V=!F});return{destroy:F=>{V||(V=!0,o.destroyer(z,F||new g("pipe")))},cleanup:W}}function Y(z){return x(z[z.length-1],"streams[stream.length - 1]"),z.pop()}function L(z){if(I(z))return z;if(c(z))return ee(z);throw new h("val",["Readable","Iterable","AsyncIterable"],z)}async function*ee(z){B||(B=jn()),yield*B.prototype[n].call(z)}async function C(z,ae,H,{end:V}){let W,F=null;const Z=fe=>{if(fe&&(W=fe),F){const O=F;F=null,O()}},te=()=>new t((fe,O)=>{W?O(W):F=()=>{W?O(W):fe()}});ae.on("drain",Z);const ce=s(ae,{readable:!1},Z);try{ae.writableNeedDrain&&await te();for await(const fe of z)ae.write(fe)||await te();V&&(ae.end(),await te()),H()}catch(fe){H(W!==fe?d(W,fe):fe)}finally{ce(),ae.off("drain",Z)}}async function K(z,ae,H,{end:V}){N(ae)&&(ae=ae.writable);const W=ae.getWriter();try{for await(const F of z)await W.ready,W.write(F).catch(()=>{});await W.ready,V&&await W.close(),H()}catch(F){try{await W.abort(F),H(F)}catch(Z){H(Z)}}}function v(...z){return U(z,a(Y(z)))}function U(z,ae,H){if(z.length===1&&e(z[0])&&(z=z[0]),z.length<2)throw new w("streams");const V=new R,W=V.signal,F=H?.signal,Z=[];S(F,"options.signal");function te(){de(new _)}A=A||ze().addAbortListener;let ce;F&&(ce=A(F,te));let fe,O;const G=[];let re=0;function ue(he){de(he,--re===0)}function de(he,se){var Ee;if(he&&(!fe||fe.code==="ERR_STREAM_PREMATURE_CLOSE")&&(fe=he),!(!fe&&!se)){for(;G.length;)G.shift()(fe);(Ee=ce)===null||Ee===void 0||Ee[i](),V.abort(),se&&(fe||Z.forEach(qe=>qe()),r.nextTick(ae,fe,O))}}let pe;for(let he=0;he<z.length;he++){const se=z[he],Ee=he<z.length-1,qe=he>0,_e=Ee||H?.end!==!1,He=he===z.length-1;if(p(se)){let E=function(u){u&&u.name!=="AbortError"&&u.code!=="ERR_STREAM_PREMATURE_CLOSE"&&ue(u)};if(_e){const{destroy:u,cleanup:f}=j(se,Ee,qe);G.push(u),b(se)&&He&&Z.push(f)}se.on("error",E),b(se)&&He&&Z.push(()=>{se.removeListener("error",E)})}if(he===0)if(typeof se=="function"){if(pe=se({signal:W}),!I(pe))throw new y("Iterable, AsyncIterable or Stream","source",pe)}else I(se)||c(se)||N(se)?pe=se:pe=l.from(se);else if(typeof se=="function"){if(N(pe)){var X;pe=L((X=pe)===null||X===void 0?void 0:X.readable)}else pe=L(pe);if(pe=se(pe,{signal:W}),Ee){if(!I(pe,!0))throw new y("AsyncIterable",`transform[${he-1}]`,pe)}else{var le;M||(M=vu());const E=new M({objectMode:!0}),u=(le=pe)===null||le===void 0?void 0:le.then;if(typeof u=="function")re++,u.call(pe,J=>{O=J,J!=null&&E.write(J),_e&&E.end(),r.nextTick(ue)},J=>{E.destroy(J),r.nextTick(ue,J)});else if(I(pe,!0))re++,C(pe,E,ue,{end:_e});else if(T(pe)||N(pe)){const J=pe.readable||pe;re++,C(J,E,ue,{end:_e})}else throw new y("AsyncIterable or Promise","destination",pe);pe=E;const{destroy:f,cleanup:k}=j(pe,!1,!0);G.push(f),He&&Z.push(k)}}else if(p(se)){if(c(pe)){re+=2;const E=Q(pe,se,ue,{end:_e});b(se)&&He&&Z.push(E)}else if(N(pe)||T(pe)){const E=pe.readable||pe;re++,C(E,se,ue,{end:_e})}else if(I(pe))re++,C(pe,se,ue,{end:_e});else throw new h("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],pe);pe=se}else if(D(se)){if(c(pe))re++,K(L(pe),se,ue,{end:_e});else if(T(pe)||I(pe))re++,K(pe,se,ue,{end:_e});else if(N(pe))re++,K(pe.readable,se,ue,{end:_e});else throw new h("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],pe);pe=se}else pe=l.from(se)}return(W!=null&&W.aborted||F!=null&&F.aborted)&&r.nextTick(te),pe}function Q(z,ae,H,{end:V}){let W=!1;if(ae.on("close",()=>{W||H(new m)}),z.pipe(ae,{end:!1}),V){let F=function(){W=!0,ae.end()};q(z)?r.nextTick(F):z.once("end",F)}else H();return s(z,{readable:!0,writable:!1},F=>{const Z=z._readableState;F&&F.code==="ERR_STREAM_PREMATURE_CLOSE"&&Z&&Z.ended&&!Z.errored&&!Z.errorEmitted?z.once("end",H).once("error",H):H(F)}),s(ae,{readable:!1,writable:!0},H)}return pi={pipelineImpl:U,pipeline:v},pi}var gi,ao;function _u(){if(ao)return gi;ao=1;const{pipeline:r}=Hs(),e=yt(),{destroyer:t}=ur(),{isNodeStream:n,isReadable:i,isWritable:s,isWebStream:a,isTransformStream:o,isWritableStream:l,isReadableStream:d}=wt(),{AbortError:h,codes:{ERR_INVALID_ARG_VALUE:y,ERR_MISSING_ARGS:w}}=Ve(),g=Tt();return gi=function(..._){if(_.length===0)throw new w("streams");if(_.length===1)return e.from(_[0]);const x=[..._];if(typeof _[0]=="function"&&(_[0]=e.from(_[0])),typeof _[_.length-1]=="function"){const M=_.length-1;_[M]=e.from(_[M])}for(let M=0;M<_.length;++M)if(!(!n(_[M])&&!a(_[M]))){if(M<_.length-1&&!(i(_[M])||d(_[M])||o(_[M])))throw new y(`streams[${M}]`,x[M],"must be readable");if(M>0&&!(s(_[M])||l(_[M])||o(_[M])))throw new y(`streams[${M}]`,x[M],"must be writable")}let S,I,b,c,p;function N(M){const B=c;c=null,B?B(M):M?p.destroy(M):!R&&!q&&p.destroy()}const D=_[0],T=r(_,N),q=!!(s(D)||l(D)||o(D)),R=!!(i(T)||d(T)||o(T));if(p=new e({writableObjectMode:!!(D!=null&&D.writableObjectMode),readableObjectMode:!!(T!=null&&T.readableObjectMode),writable:q,readable:R}),q){if(n(D))p._write=function(B,A,j){D.write(B,A)?j():S=j},p._final=function(B){D.end(),I=B},D.on("drain",function(){if(S){const B=S;S=null,B()}});else if(a(D)){const A=(o(D)?D.writable:D).getWriter();p._write=async function(j,Y,L){try{await A.ready,A.write(j).catch(()=>{}),L()}catch(ee){L(ee)}},p._final=async function(j){try{await A.ready,A.close().catch(()=>{}),I=j}catch(Y){j(Y)}}}const M=o(T)?T.readable:T;g(M,()=>{if(I){const B=I;I=null,B()}})}if(R){if(n(T))T.on("readable",function(){if(b){const M=b;b=null,M()}}),T.on("end",function(){p.push(null)}),p._read=function(){for(;;){const M=T.read();if(M===null){b=p._read;return}if(!p.push(M))return}};else if(a(T)){const B=(o(T)?T.readable:T).getReader();p._read=async function(){for(;;)try{const{value:A,done:j}=await B.read();if(!p.push(A))return;if(j){p.push(null);return}}catch{return}}}}return p._destroy=function(M,B){!M&&c!==null&&(M=new h),b=null,S=null,I=null,c===null?B(M):(c=B,n(T)&&t(T,M))},p},gi}var oo;function Wc(){if(oo)return sn;oo=1;const r=globalThis.AbortController||Gr().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:n,ERR_OUT_OF_RANGE:i},AbortError:s}=Ve(),{validateAbortSignal:a,validateInteger:o,validateObject:l}=Xr(),d=$e().Symbol("kWeak"),h=$e().Symbol("kResistStopPropagation"),{finished:y}=Tt(),w=_u(),{addAbortSignalNoValidate:g}=An(),{isWritable:m,isNodeStream:_}=wt(),{deprecate:x}=ze(),{ArrayPrototypePush:S,Boolean:I,MathFloor:b,Number:c,NumberIsNaN:p,Promise:N,PromiseReject:D,PromiseResolve:T,PromisePrototypeThen:q,Symbol:R}=$e(),M=R("kEmpty"),B=R("kEof");function A(F,Z){if(Z!=null&&l(Z,"options"),Z?.signal!=null&&a(Z.signal,"options.signal"),_(F)&&!m(F))throw new e("stream",F,"must be writable");const te=w(this,F);return Z!=null&&Z.signal&&g(Z.signal,te),te}function j(F,Z){if(typeof F!="function")throw new t("fn",["Function","AsyncFunction"],F);Z!=null&&l(Z,"options"),Z?.signal!=null&&a(Z.signal,"options.signal");let te=1;Z?.concurrency!=null&&(te=b(Z.concurrency));let ce=te-1;return Z?.highWaterMark!=null&&(ce=b(Z.highWaterMark)),o(te,"options.concurrency",1),o(ce,"options.highWaterMark",0),ce+=te,(async function*(){const O=ze().AbortSignalAny([Z?.signal].filter(I)),G=this,re=[],ue={signal:O};let de,pe,X=!1,le=0;function he(){X=!0,se()}function se(){le-=1,Ee()}function Ee(){pe&&!X&&le<te&&re.length<ce&&(pe(),pe=null)}async function qe(){try{for await(let _e of G){if(X)return;if(O.aborted)throw new s;try{if(_e=F(_e,ue),_e===M)continue;_e=T(_e)}catch(He){_e=D(He)}le+=1,q(_e,se,he),re.push(_e),de&&(de(),de=null),!X&&(re.length>=ce||le>=te)&&await new N(He=>{pe=He})}re.push(B)}catch(_e){const He=D(_e);q(He,se,he),re.push(He)}finally{X=!0,de&&(de(),de=null)}}qe();try{for(;;){for(;re.length>0;){const _e=await re[0];if(_e===B)return;if(O.aborted)throw new s;_e!==M&&(yield _e),re.shift(),Ee()}await new N(_e=>{de=_e})}}finally{X=!0,pe&&(pe(),pe=null)}}).call(this)}function Y(F=void 0){return F!=null&&l(F,"options"),F?.signal!=null&&a(F.signal,"options.signal"),(async function*(){let te=0;for await(const fe of this){var ce;if(F!=null&&(ce=F.signal)!==null&&ce!==void 0&&ce.aborted)throw new s({cause:F.signal.reason});yield[te++,fe]}}).call(this)}async function L(F,Z=void 0){for await(const te of v.call(this,F,Z))return!0;return!1}async function ee(F,Z=void 0){if(typeof F!="function")throw new t("fn",["Function","AsyncFunction"],F);return!await L.call(this,async(...te)=>!await F(...te),Z)}async function C(F,Z){for await(const te of v.call(this,F,Z))return te}async function K(F,Z){if(typeof F!="function")throw new t("fn",["Function","AsyncFunction"],F);async function te(ce,fe){return await F(ce,fe),M}for await(const ce of j.call(this,te,Z));}function v(F,Z){if(typeof F!="function")throw new t("fn",["Function","AsyncFunction"],F);async function te(ce,fe){return await F(ce,fe)?ce:M}return j.call(this,te,Z)}class U extends n{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function Q(F,Z,te){var ce;if(typeof F!="function")throw new t("reducer",["Function","AsyncFunction"],F);te!=null&&l(te,"options"),te?.signal!=null&&a(te.signal,"options.signal");let fe=arguments.length>1;if(te!=null&&(ce=te.signal)!==null&&ce!==void 0&&ce.aborted){const de=new s(void 0,{cause:te.signal.reason});throw this.once("error",()=>{}),await y(this.destroy(de)),de}const O=new r,G=O.signal;if(te!=null&&te.signal){const de={once:!0,[d]:this,[h]:!0};te.signal.addEventListener("abort",()=>O.abort(),de)}let re=!1;try{for await(const de of this){var ue;if(re=!0,te!=null&&(ue=te.signal)!==null&&ue!==void 0&&ue.aborted)throw new s;fe?Z=await F(Z,de,{signal:G}):(Z=de,fe=!0)}if(!re&&!fe)throw new U}finally{O.abort()}return Z}async function z(F){F!=null&&l(F,"options"),F?.signal!=null&&a(F.signal,"options.signal");const Z=[];for await(const ce of this){var te;if(F!=null&&(te=F.signal)!==null&&te!==void 0&&te.aborted)throw new s(void 0,{cause:F.signal.reason});S(Z,ce)}return Z}function ae(F,Z){const te=j.call(this,F,Z);return(async function*(){for await(const fe of te)yield*fe}).call(this)}function H(F){if(F=c(F),p(F))return 0;if(F<0)throw new i("number",">= 0",F);return F}function V(F,Z=void 0){return Z!=null&&l(Z,"options"),Z?.signal!=null&&a(Z.signal,"options.signal"),F=H(F),(async function*(){var ce;if(Z!=null&&(ce=Z.signal)!==null&&ce!==void 0&&ce.aborted)throw new s;for await(const O of this){var fe;if(Z!=null&&(fe=Z.signal)!==null&&fe!==void 0&&fe.aborted)throw new s;F--<=0&&(yield O)}}).call(this)}function W(F,Z=void 0){return Z!=null&&l(Z,"options"),Z?.signal!=null&&a(Z.signal,"options.signal"),F=H(F),(async function*(){var ce;if(Z!=null&&(ce=Z.signal)!==null&&ce!==void 0&&ce.aborted)throw new s;for await(const O of this){var fe;if(Z!=null&&(fe=Z.signal)!==null&&fe!==void 0&&fe.aborted)throw new s;if(F-- >0&&(yield O),F<=0)return}}).call(this)}return sn.streamReturningOperators={asIndexedPairs:x(Y,"readable.asIndexedPairs will be removed in a future version."),drop:V,filter:v,flatMap:ae,map:j,take:W,compose:A},sn.promiseReturningOperators={every:ee,forEach:K,reduce:Q,toArray:z,some:L,find:C},sn}var yi,lo;function xu(){if(lo)return yi;lo=1;const{ArrayPrototypePop:r,Promise:e}=$e(),{isIterable:t,isNodeStream:n,isWebStream:i}=wt(),{pipelineImpl:s}=Hs(),{finished:a}=Tt();Su();function o(...l){return new e((d,h)=>{let y,w;const g=l[l.length-1];if(g&&typeof g=="object"&&!n(g)&&!t(g)&&!i(g)){const m=r(l);y=m.signal,w=m.end}s(l,(m,_)=>{m?h(m):d(_)},{signal:y,end:w})})}return yi={finished:a,pipeline:o},yi}var uo;function Su(){if(uo)return zn.exports;uo=1;const{Buffer:r}=bt(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:n}=$e(),{promisify:{custom:i}}=ze(),{streamReturningOperators:s,promiseReturningOperators:a}=Wc(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:o}}=Ve(),l=_u(),{setDefaultHighWaterMark:d,getDefaultHighWaterMark:h}=Ln(),{pipeline:y}=Hs(),{destroyer:w}=ur(),g=Tt(),m=xu(),_=wt(),x=zn.exports=Fs().Stream;x.isDestroyed=_.isDestroyed,x.isDisturbed=_.isDisturbed,x.isErrored=_.isErrored,x.isReadable=_.isReadable,x.isWritable=_.isWritable,x.Readable=jn();for(const I of t(s)){let c=function(...p){if(new.target)throw o();return x.Readable.from(n(b,this,p))};const b=s[I];e(c,"name",{__proto__:null,value:b.name}),e(c,"length",{__proto__:null,value:b.length}),e(x.Readable.prototype,I,{__proto__:null,value:c,enumerable:!1,configurable:!0,writable:!0})}for(const I of t(a)){let c=function(...p){if(new.target)throw o();return n(b,this,p)};const b=a[I];e(c,"name",{__proto__:null,value:b.name}),e(c,"length",{__proto__:null,value:b.length}),e(x.Readable.prototype,I,{__proto__:null,value:c,enumerable:!1,configurable:!0,writable:!0})}x.Writable=Us(),x.Duplex=yt(),x.Transform=wu(),x.PassThrough=vu(),x.pipeline=y;const{addAbortSignal:S}=An();return x.addAbortSignal=S,x.finished=g,x.destroy=w,x.compose=l,x.setDefaultHighWaterMark=d,x.getDefaultHighWaterMark=h,e(x,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return m}}),e(y,i,{__proto__:null,enumerable:!0,get(){return m.pipeline}}),e(g,i,{__proto__:null,enumerable:!0,get(){return m.finished}}),x.Stream=x,x._isUint8Array=function(b){return b instanceof Uint8Array},x._uint8ArrayToBuffer=function(b){return r.from(b.buffer,b.byteOffset,b.byteLength)},zn.exports}var co;function zc(){return co||(co=1,function(r){const e=Su(),t=xu(),n=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=n,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 Eu=zc();const mi=Symbol("iter");function Br(r,e,t=4){if(t===0)return Object.assign(r,e);for(const n in e)r[n]=Br(r[n]||Object.create(null),e[n],t-1);return r}function Iu(r,e,t=4){let n=!1;for(const i in r)if(i in e){const s=t===0?null:Iu(r[i],e[i],t-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(t===3)return!1}return n}function Ru(r,e,t=4){let n=!1;for(const i in r)if(!(i in e))n=n||Object.create(null),n[i]=t===0?null:Br({},r[i],t-1);else if(t!==0){const s=Ru(r[i],e[i],t-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(t===3)return!1}return n}class Jc{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||xe}_termFromId(e){if(e[0]==="."){const t=this._entities,n=e.split(".");return this._factory.quad(this._termFromId(t[n[1]]),this._termFromId(t[n[2]]),this._termFromId(t[n[3]]),n[4]&&this._termFromId(t[n[4]]))}return Dr(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){const t=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),i=this._termToNumericId(e.object);let s;return t&&n&&i&&(Ns(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${t}.${n}.${i}.${s}`:`.${t}.${n}.${i}`]}return this._ids[er(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${Ns(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:er(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,n;if(e)for(t=e=`_:${e}`,n=1;this._ids[t];)t=e+n++;else do t=`_:b${this._blankNodeIndex++}`;while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}}class Fe{constructor(e,t){this._size=0,this._graphs=Object.create(null),!t&&e&&!e[0]&&typeof e.match!="function"&&(t=e,e=null),t=t||{},this._factory=t.factory||xe,this._entityIndex=t.entityIndex||new Jc({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 n,i;for(const s in t)for(const a in n=t[s].subjects)for(const o in i=n[a])e+=Object.keys(i[o]).length;return this._size=e}_addToIndex(e,t,n,i){const s=e[t]||(e[t]={}),a=s[n]||(s[n]={}),o=i in a;return o||(a[i]=null),!o}_removeFromIndex(e,t,n,i){const s=e[t],a=s[n];delete a[i];for(const o in a)return;delete s[n];for(const o in s)return;delete e[t]}*_findInIndex(e,t,n,i,s,a,o,l){let d,h,y;const w=this._entities,g=this._termFromId(w[l]),m={subject:null,predicate:null,object:null};t&&((d=e,e={})[t]=d[t]);for(const _ in e)if(h=e[_]){m[s]=this._termFromId(w[_]),n&&((d=h,h={})[n]=d[n]);for(const x in h)if(y=h[x]){m[a]=this._termFromId(w[x]);const S=i?i in y?[i]:[]:Object.keys(y);for(let I=0;I<S.length;I++)m[o]=this._termFromId(w[S[I]]),yield this._factory.quad(m.subject,m.predicate,m.object,g)}}}_loop(e,t){for(const n in e)t(n)}_loopByKey0(e,t,n){let i,s;if(i=e[t])for(s in i)n(s)}_loopByKey1(e,t,n){let i,s;for(i in e)s=e[i],s[t]&&n(i)}_loopBy2Keys(e,t,n,i){let s,a,o;if((s=e[t])&&(a=s[n]))for(o in a)i(o)}_countInIndex(e,t,n,i){let s=0,a,o,l;t&&((a=e,e={})[t]=a[t]);for(const d in e)if(o=e[d]){n&&((a=o,o={})[n]=a[n]);for(const h in o)(l=o[h])&&(i?i in l&&s++:s+=Object.keys(l).length)}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){const t=Object.create(null);return n=>{n in t||(t[n]=!0,e(this._termFromId(this._entities[n],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,n,i){t||(i=e.graph,n=e.object,t=e.predicate,e=e.subject),i=i?this._termToNewNumericId(i):1;let s=this._graphs[i];return s||(s=this._graphs[i]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),n=this._termToNewNumericId(n),this._addToIndex(s.subjects,e,t,n)?(this._addToIndex(s.predicates,t,n,e),this._addToIndex(s.objects,n,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,n,i){return e&&e.subject&&({subject:e,predicate:t,object:n,graph:i}=e),!this.readQuads(e,t,n,i).next().done}import(e){return e.on("data",t=>{this.addQuad(t)}),e}removeQuad(e,t,n,i){t||({subject:e,predicate:t,object:n,graph:i}=e),i=i?this._termToNumericId(i):1;const s=this._graphs;let a,o,l;if(!(e=e&&this._termToNumericId(e))||!(t=t&&this._termToNumericId(t))||!(n=n&&this._termToNumericId(n))||!(a=s[i])||!(o=a.subjects[e])||!(l=o[t])||!(n in l))return!1;this._removeFromIndex(a.subjects,e,t,n),this._removeFromIndex(a.predicates,t,n,e),this._removeFromIndex(a.objects,n,e,t),this._size!==null&&this._size--;for(e in a.subjects)return!0;return delete s[i],!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,n,i){const s=new Eu.Readable({objectMode:!0}),a=this.readQuads(e,t,n,i);return s._read=o=>{for(;--o>=0;){const{done:l,value:d}=a.next();if(l){s.push(null);return}s.push(d)}},this.remove(s)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,n,i){return[...this.readQuads(e,t,n,i)]}*readQuads(e,t,n,i){const s=this._getGraphs(i);let a,o,l,d;if(!(e&&!(o=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||n&&!(d=this._termToNumericId(n))))for(const h in s)(a=s[h])&&(o?d?yield*this._findInIndex(a.objects,d,o,l,"object","subject","predicate",h):yield*this._findInIndex(a.subjects,o,l,null,"subject","predicate","object",h):l?yield*this._findInIndex(a.predicates,l,d,null,"predicate","object","subject",h):d?yield*this._findInIndex(a.objects,d,null,null,"object","subject","predicate",h):yield*this._findInIndex(a.subjects,null,null,null,"subject","predicate","object",h))}match(e,t,n,i){return new St(this,e,t,n,i,{entityIndex:this._entityIndex})}countQuads(e,t,n,i){const s=this._getGraphs(i);let a=0,o,l,d,h;if(e&&!(l=this._termToNumericId(e))||t&&!(d=this._termToNumericId(t))||n&&!(h=this._termToNumericId(n)))return 0;for(const y in s)(o=s[y])&&(e?n?a+=this._countInIndex(o.objects,h,l,d):a+=this._countInIndex(o.subjects,l,d,h):t?a+=this._countInIndex(o.predicates,d,h,l):a+=this._countInIndex(o.objects,h,l,d));return a}forEach(e,t,n,i,s){this.some(a=>(e(a,this),!1),t,n,i,s)}every(e,t,n,i,s){return!this.some(a=>!e(a,this),t,n,i,s)}some(e,t,n,i,s){for(const a of this.readQuads(t,n,i,s))if(e(a,this))return!0;return!1}getSubjects(e,t,n){const i=[];return this.forSubjects(s=>{i.push(s)},e,t,n),i}forSubjects(e,t,n,i){const s=this._getGraphs(i);let a,o,l;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?l?this._loopBy2Keys(a.predicates,o,l,e):this._loopByKey1(a.subjects,o,e):l?this._loopByKey0(a.objects,l,e):this._loop(a.subjects,e))}getPredicates(e,t,n){const i=[];return this.forPredicates(s=>{i.push(s)},e,t,n),i}forPredicates(e,t,n,i){const s=this._getGraphs(i);let a,o,l;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?l?this._loopBy2Keys(a.objects,l,o,e):this._loopByKey0(a.subjects,o,e):l?this._loopByKey1(a.predicates,l,e):this._loop(a.predicates,e))}getObjects(e,t,n){const i=[];return this.forObjects(s=>{i.push(s)},e,t,n),i}forObjects(e,t,n,i){const s=this._getGraphs(i);let a,o,l;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?l?this._loopBy2Keys(a.subjects,o,l,e):this._loopByKey1(a.objects,o,e):l?this._loopByKey0(a.predicates,l,e):this._loop(a.objects,e))}getGraphs(e,t,n){const i=[];return this.forGraphs(s=>{i.push(s)},e,t,n),i}forGraphs(e,t,n,i){for(const s in this._graphs)this.some(a=>(e(a.graph),!0),t,n,i,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const n={},i=t?()=>!0:(o,l)=>{throw new Error(`${o.value} ${l}`)},s=this.getQuads(null,Pe.rdf.rest,Pe.rdf.nil,null),a=e?[...s]:[];return s.forEach(o=>{const l=[];let d=!1,h,y;const w=o.graph;let g=o.subject;for(;g&&!d;){const m=this.getQuads(null,null,g,null),_=this.getQuads(g,null,null,null);let x,S=null,I=null,b=null;for(let c=0;c<_.length&&!d;c++)x=_[c],x.graph.equals(w)?h?d=i(g,"has non-list arcs out"):x.predicate.value===Pe.rdf.first?S?d=i(g,"has multiple rdf:first arcs"):a.push(S=x):x.predicate.value===Pe.rdf.rest?I?d=i(g,"has multiple rdf:rest arcs"):a.push(I=x):m.length?d=i(g,"can't be subject and object"):(h=x,y="subject"):d=i(g,"not confined to single graph");for(let c=0;c<m.length&&!d;++c)x=m[c],h?d=i(g,"can't have coreferences"):x.predicate.value===Pe.rdf.rest?b?d=i(g,"has incoming rdf:rest arcs"):b=x:(h=x,y="object");S?l.unshift(S.object):d=i(g,"has no list head"),g=b&&b.subject}d?e=!1:h&&(n[h[y].value]=l)}),e&&this.removeQuads(a),n}addAll(e){if(e instanceof St&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof Fe&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=Br(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof St&&(e=e.filtered),e===this)return!0;if(!(e instanceof Fe)||this._entityIndex!==e._entityIndex)return e.every(d=>this.has(d));const t=this._graphs,n=e._graphs;let i,s,a,o,l;for(const d in n){if(!(i=t[d]))return!1;i=i.subjects;for(const h in s=n[d].subjects){if(!(a=i[h]))return!1;for(const y in o=s[h]){if(!(l=a[y]))return!1;for(const w in o[y])if(!(w in l))return!1}}}return!0}deleteMatches(e,t,n,i){for(const s of this.match(e,t,n,i))this.removeQuad(s);return this}difference(e){if(e&&e instanceof St&&(e=e.filtered),e===this)return new Fe({entityIndex:this._entityIndex});if(e instanceof Fe&&e._entityIndex===this._entityIndex){const t=new Fe({entityIndex:this._entityIndex}),n=Ru(this._graphs,e._graphs);return n&&(t._graphs=n,t._size=null),t}return this.filter(t=>!e.has(t))}equals(e){return e instanceof St&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new Fe({entityIndex:this._entityIndex});for(const n of this)e(n,this)&&t.add(n);return t}intersection(e){if(e instanceof St&&(e=e.filtered),e===this){const t=new Fe({entityIndex:this._entityIndex});return t._graphs=Br(Object.create(null),this._graphs),t._size=this._size,t}else if(e instanceof Fe&&this._entityIndex===e._entityIndex){const t=new Fe({entityIndex:this._entityIndex}),n=Iu(e._graphs,this._graphs);return n&&(t._graphs=n,t._size=null),t}return this.filter(t=>e.has(t))}map(e){const t=new Fe({entityIndex:this._entityIndex});for(const n of this)t.add(e(n,this));return t}reduce(e,t){const n=this.readQuads();let i=t===void 0?n.next().value:t;for(const s of n)i=e(i,s,this);return i}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new Bs().quadsToString(this)}union(e){const t=new Fe({entityIndex:this._entityIndex});return t._graphs=Br(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function lt(r,e,t=0){const n=e[t];if(n&&!(n in r))return!1;let i=!1;for(const s in n?{[n]:r[n]}:r){const a=t===2?null:lt(r[s],e,t+1);a!==!1&&(i=i||Object.create(null),i[s]=a)}return i}class St extends Eu.Readable{constructor(e,t,n,i,s,a){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:n,object:i,graph:s,options:a})}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:n,predicate:i,subject:s}=this,a=this._filtered=new Fe({factory:e._factory,entityIndex:this.options.entityIndex});let o,l,d;if(s&&!(o=a._termToNumericId(s))||i&&!(l=a._termToNumericId(i))||n&&!(d=a._termToNumericId(n)))return a;const h=e._getGraphs(t);for(const y in h){let w,g,m,_;(_=h[y])&&(!o&&l?(g=lt(_.predicates,[l,d,o]))&&(w=lt(_.subjects,[o,l,d]),m=lt(_.objects,[d,o,l])):d?(m=lt(_.objects,[d,o,l]))&&(w=lt(_.subjects,[o,l,d]),g=lt(_.predicates,[l,d,o])):(w=lt(_.subjects,[o,l,d]))&&(g=lt(_.predicates,[l,d,o]),m=lt(_.objects,[d,o,l])),w&&(a._graphs[y]={subjects:w,predicates:g,objects:m}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[mi]&&(this[mi]=this[Symbol.iterator]());const t=this[mi];for(;--e>=0;){const{done:n,value:i}=t.next();if(n){this.push(null);return}this.push(i)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,n,i){return this.filtered.deleteMatches(e,t,n,i)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,n,i,s){return this.filtered.every(e,t,n,i,s)}filter(e){return this.filtered.filter(e)}forEach(e,t,n,i,s){return this.filtered.forEach(e,t,n,i,s)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,t,n,i,s){return this.filtered.some(e,t,n,i,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(e)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,t){return this.filtered.reduce(e,t)}toString(){return new Bs().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,t,n,i){return new St(this.filtered,e,t,n,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}const be="http://www.w3.org/ns/shacl#",fo="http://datashapes.org/dash#",Rt="http://www.w3.org/2001/XMLSchema#",Vs="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Gs="http://www.w3.org/2000/01/rdf-schema#",Ws="http://www.w3.org/2004/02/skos/core#",Qc="http://www.w3.org/2002/07/owl#",Xc="http://www.w3.org/ns/oa#",Kc="http://purl.org/dc/terms/",Yc="http://xmlns.com/foaf/0.1/",wn=xe.namedNode("loaded-shapes"),ut=xe.namedNode("loaded-data"),Ue=xe.namedNode(Vs+"type"),Ts=xe.namedNode(Kc+"conformsTo"),Zc=xe.namedNode(Gs+"subClassOf"),zs=xe.namedNode(Qc+"imports"),ed=xe.namedNode(Ws+"broader"),td=xe.namedNode(Ws+"narrower"),ln=xe.namedNode(be+"NodeShape"),rd=xe.namedNode(be+"IRI"),vn=xe.namedNode(be+"property"),Js=xe.namedNode(be+"class"),Wr=xe.namedNode(be+"targetClass"),nd=xe.namedNode(be+"nodeKind"),id=xe.namedNode(Rt+"string");function Fr(r,e,t=be,n){let i="";const s=sd(r,e,t,n);return s&&(i=s.value),i}function sd(r,e,t=be,n){let i;const s=t+e;if(n?.length){for(const a of n)for(const o of r)if(o.predicate.value===s){if(o.object.id.endsWith(`@${a}`))return o.object;o.object.id.indexOf("@")<0?i=o.object:i||(i=o.object)}}else for(const a of r)if(a.predicate.value===s)return a.object;return i}function ad(r){r.querySelector("input,select,textarea")?.focus()}function Pt(r,e){return Fr(r,"prefLabel",Ws,e)||Fr(r,"label",Gs,e)||Fr(r,"name",Yc,e)}function Nu(r,e,t){const n=[];for(const i of r)n.push({value:i,label:Pt(e.getQuads(i,null,null,null),t),children:[]});return n}function As(r,e){for(const t in e)r=r.replace(e[t],"");return r}function Tu(r,e,t,n,i=new Set){for(const s of e.owlImports)i.has(s.id)||(i.add(s.id),n.push(...t.getSubjects(Ue,r,s)));e.parent&&Tu(r,e.parent,t,n,i)}function Qs(r,e){if(e.shaclIn){const t=e.config.lists[e.shaclIn];return Nu(t?.length?t:[],e.config.store,e.config.languages)}else{const t=e.config.store.getSubjects(Ue,r,wn);t.push(...e.config.store.getSubjects(Ue,r,ut)),Tu(r,e,e.config.store,t);const n=new Map,i=new Map;for(const a of t)n.set(a.id,{value:a,label:Pt(e.config.store.getQuads(a,null,null,null),e.config.languages),children:[]});for(const a of t){for(const o of e.config.store.getObjects(a,ed,null))i.set(a.id,o.id),n.has(o.id)||n.set(o.id,{value:o,label:Pt(e.config.store.getQuads(o,null,null,null),e.config.languages),children:[]});for(const o of e.config.store.getObjects(a,td,null))i.set(o.id,a.id),n.has(o.id)||n.set(o.id,{value:o,label:Pt(e.config.store.getQuads(o,null,null,null),e.config.languages),children:[]})}for(const[a,o]of i.entries())n.get(o)?.children?.push(n.get(a));const s=[];for(const[a,o]of n.entries())i.has(a)||s.push(o);for(const a of e.config.store.getSubjects(Zc,r,null))s.push(...Qs(a,e));return s}}function Ls(r){let e;try{e=new URL(r)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function ho(r,e,t){if(e===void 0)return t;if(t===void 0)return e;const n=r.indexOf(e.language);if(n<0)return t;const i=r.indexOf(t.language);return i<0||i>n?e:t}function Au(r,e,t){const n=document.createElement("div");n.classList.add("shacl-or-constraint");const i=[];if(e instanceof Nt){const s=[];let a=!1;r.length&&(a=t.store.countQuads(r[0],vn,null,null)>0);for(let d=0;d<r.length;d++)if(a){const h=t.store.getObjects(r[d],vn,null),y=[];let w="";for(const g of h){const m=new Sn(g,e,t);y.push(m),w+=(w.length>1?" / ":"")+m.template.label}s.push(y),i.push({label:w,value:d.toString()})}else{const h=new Sn(r[d],e,t);s.push([h]),i.push({label:h.template.label,value:d.toString()})}const o=t.theme.createListEditor("Please choose",null,!1,i),l=o.querySelector(".editor");l.onchange=()=>{if(l.value){const d=s[parseInt(l.value)];let h;d.length&&(h=d[0],n.replaceWith(d[0]));for(let y=1;y<d.length;y++)h.after(d[y]),h=d[y]}},n.appendChild(o)}else{const s=[];for(let l=0;l<r.length;l++){const d=t.store.getQuads(r[l],null,null,null);d.length&&(s.push(d),i.push({label:Pt(d,t.languages)||As(d[0].predicate.value,t.prefixes)+" = "+As(d[0].object.value,t.prefixes),value:l.toString()}))}const a=t.theme.createListEditor(e.template.label+"?",null,!1,i,e.template),o=a.querySelector(".editor");o.onchange=()=>{o.value&&n.replaceWith(gn(e.template.clone().merge(s[parseInt(o.value)]),void 0,!0))},n.appendChild(a)}return n}function od(r,e,t){if(e instanceof Ze){const n=e.datatype;for(const i of r){const s=t.store.getQuads(i,null,null,null);for(const a of s)if(a.predicate.value===`${be}datatype`&&a.object.equals(n))return s}}else{const n=t.store.getObjects(e,Ue,null);for(const i of r){const s=t.store.getQuads(i,null,null,null);for(const a of s)if(n.length>0){if(a.predicate.value===`${be}node`){for(const o of n)if(t.store.getQuads(a.object,Wr,o,null).length>0)return s}if(a.predicate.equals(Js)){for(const o of n)if(a.object.equals(o))return s}}else if(a.predicate.equals(nd)&&a.object.equals(rd))return s}}return console.error("couldn't resolve sh:or/sh:xone on property for value",e),[]}function ld(r,e,t){for(const n of r){let i=!1;const s=t.store.getObjects(n,vn,null);for(const a of s){const o=t.store.getObjects(a,`${be}path`,null);for(const l of o)if(i=t.store.countQuads(e,l,null,null)>0,i)break}if(i)return s}return console.error("couldn't resolve sh:or/sh:xone on node for value",e),[]}const ud={[`${be}name`]:(r,e)=>{const t=e;r.name=ho(r.config.languages,r.name,t)},[`${be}description`]:(r,e)=>{const t=e;r.description=ho(r.config.languages,r.description,t)},[`${be}path`]:(r,e)=>{r.path=e.value},[`${be}node`]:(r,e)=>{r.node=e},[`${be}datatype`]:(r,e)=>{r.datatype=e},[`${be}nodeKind`]:(r,e)=>{r.nodeKind=e},[`${be}minCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${be}maxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[`${be}minLength`]:(r,e)=>{r.minLength=parseInt(e.value)},[`${be}maxLength`]:(r,e)=>{r.maxLength=parseInt(e.value)},[`${be}minInclusive`]:(r,e)=>{r.minInclusive=parseInt(e.value)},[`${be}maxInclusive`]:(r,e)=>{r.maxInclusive=parseInt(e.value)},[`${be}minExclusive`]:(r,e)=>{r.minExclusive=parseInt(e.value)},[`${be}maxExclusive`]:(r,e)=>{r.maxExclusive=parseInt(e.value)},[`${be}pattern`]:(r,e)=>{r.pattern=e.value},[`${be}order`]:(r,e)=>{r.order=parseInt(e.value)},[`${fo}singleLine`]:(r,e)=>{r.singleLine=e.value==="true"},[`${fo}readonly`]:(r,e)=>{r.readonly=e.value==="true"},[`${Xc}styleClass`]:(r,e)=>{r.cssClass=e.value},[`${be}and`]:(r,e)=>{r.shaclAnd=e.value},[`${be}in`]:(r,e)=>{r.shaclIn=e.value},[`${be}languageIn`]:(r,e)=>{r.languageIn=r.config.lists[e.value],r.datatype=xe.namedNode(Vs+"langString")},[`${be}defaultValue`]:(r,e)=>{r.defaultValue=e},[`${be}hasValue`]:(r,e)=>{r.hasValue=e},[`${be}qualifiedValueShape`]:(r,e)=>{r.qualifiedValueShape=e},[`${be}qualifiedMinCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${be}qualifiedMaxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[zs.id]:(r,e)=>{r.owlImports.push(e)},[Js.id]:(r,e)=>{r.class=e;const t=r.config.store.getSubjects(Wr,e,null);t.length>0&&(r.node=t[0])},[`${be}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)},[`${be}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 cd{constructor(e,t,n){this.label="",this.owlImports=[],this.extendedShapes=[],this.parent=t,this.config=n,this.merge(e),this.qualifiedValueShape&&this.merge(n.store.getQuads(this.qualifiedValueShape,null,null,null))}merge(e){for(const t of e)ud[t.predicate.id]?.call(this,this,t.object);if(this.label=this.name?.value||Pt(e,this.config.languages),!this.label&&!this.shaclAnd&&(this.label=this.path?As(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 n of t)this.extendedShapes.push(n)}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 dd=`form { display:block; --label-width: 8em; --caret-size: 10px; }
26
+ `),this._subject=null),this._write=this._blockedWrite;let t=e&&((n,i)=>{t=null,e(n,i)});if(this._endStream)try{return this._outputStream.end(t)}catch{}t&&t()}}function ro(r){let e=xd[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 bi={exports:{}},_i={exports:{}},wi,no;function Be(){if(no)return wi;no=1;class r extends Error{constructor(t){if(!Array.isArray(t))throw new TypeError(`Expected input to be an Array, got ${typeof t}`);let n="";for(let i=0;i<t.length;i++)n+=` ${t[i].stack}
27
+ `;super(n),this.name="AggregateError",this.errors=t}}return wi={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,n){return e.slice(t,n)},Error,FunctionPrototypeCall(e,t,...n){return e.call(t,...n)},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,n){return Object.defineProperty(e,t,n)},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,n){return e.then(t,n)},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,n){return e.slice(t,n)},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,n){return e.set(t,n)},Boolean,Uint8Array},wi}var vi={exports:{}},xi,io;function Zu(){return io||(io=1,xi={format(r,...e){return r.replace(/%([sdifj])/g,function(...[t,n]){const i=e.shift();return n==="f"?i.toFixed(6):n==="j"?JSON.stringify(i):n==="s"&&typeof i=="object"?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})},inspect(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"{}"}}}),xi}var Ei,so;function rt(){if(so)return Ei;so=1;const{format:r,inspect:e}=Zu(),{AggregateError:t}=Be(),n=globalThis.AggregateError||t,i=Symbol("kIsNodeError"),s=["string","function","number","object","Function","Object","boolean","bigint","symbol"],a=/^([A-Z][a-z0-9]*)+$/,o="__node_internal_",u={};function l(E,v){if(!E)throw new u.ERR_INTERNAL_ASSERTION(v)}function c(E){let v="",S=E.length;const y=E[0]==="-"?1:0;for(;S>=y+4;S-=3)v=`_${E.slice(S-3,S)}${v}`;return`${E.slice(0,S)}${v}`}function d(E,v,S){if(typeof v=="function")return l(v.length<=S.length,`Code: ${E}; The provided arguments length (${S.length}) does not match the required ones (${v.length}).`),v(...S);const y=(v.match(/%[dfijoOs]/g)||[]).length;return l(y===S.length,`Code: ${E}; The provided arguments length (${S.length}) does not match the required ones (${y}).`),S.length===0?v:r(v,...S)}function m(E,v,S){S||(S=Error);class y extends S{constructor(...g){super(d(E,v,g))}toString(){return`${this.name} [${E}]: ${this.message}`}}Object.defineProperties(y.prototype,{name:{value:S.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${E}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),y.prototype.code=E,y.prototype[i]=!0,u[E]=y}function b(E){const v=o+E.name;return Object.defineProperty(E,"name",{value:v}),E}function _(E,v){if(E&&v&&E!==v){if(Array.isArray(v.errors))return v.errors.push(E),v;const S=new n([v,E],v.message);return S.code=v.code,S}return E||v}class x extends Error{constructor(v="The operation was aborted",S=void 0){if(S!==void 0&&typeof S!="object")throw new u.ERR_INVALID_ARG_TYPE("options","Object",S);super(v,S),this.code="ABORT_ERR",this.name="AbortError"}}return m("ERR_ASSERTION","%s",Error),m("ERR_INVALID_ARG_TYPE",(E,v,S)=>{l(typeof E=="string","'name' must be a string"),Array.isArray(v)||(v=[v]);let y="The ";E.endsWith(" argument")?y+=`${E} `:y+=`"${E}" ${E.includes(".")?"property":"argument"} `,y+="must be ";const h=[],g=[],I=[];for(const A of v)l(typeof A=="string","All expected entries have to be of type string"),s.includes(A)?h.push(A.toLowerCase()):a.test(A)?g.push(A):(l(A!=="object",'The value "object" should be written as "Object"'),I.push(A));if(g.length>0){const A=h.indexOf("object");A!==-1&&(h.splice(h,A,1),g.push("Object"))}if(h.length>0){switch(h.length){case 1:y+=`of type ${h[0]}`;break;case 2:y+=`one of type ${h[0]} or ${h[1]}`;break;default:{const A=h.pop();y+=`one of type ${h.join(", ")}, or ${A}`}}(g.length>0||I.length>0)&&(y+=" or ")}if(g.length>0){switch(g.length){case 1:y+=`an instance of ${g[0]}`;break;case 2:y+=`an instance of ${g[0]} or ${g[1]}`;break;default:{const A=g.pop();y+=`an instance of ${g.join(", ")}, or ${A}`}}I.length>0&&(y+=" or ")}switch(I.length){case 0:break;case 1:I[0].toLowerCase()!==I[0]&&(y+="an "),y+=`${I[0]}`;break;case 2:y+=`one of ${I[0]} or ${I[1]}`;break;default:{const A=I.pop();y+=`one of ${I.join(", ")}, or ${A}`}}if(S==null)y+=`. Received ${S}`;else if(typeof S=="function"&&S.name)y+=`. Received function ${S.name}`;else if(typeof S=="object"){var C;if((C=S.constructor)!==null&&C!==void 0&&C.name)y+=`. Received an instance of ${S.constructor.name}`;else{const A=e(S,{depth:-1});y+=`. Received ${A}`}}else{let A=e(S,{colors:!1});A.length>25&&(A=`${A.slice(0,25)}...`),y+=`. Received type ${typeof S} (${A})`}return y},TypeError),m("ERR_INVALID_ARG_VALUE",(E,v,S="is invalid")=>{let y=e(v);return y.length>128&&(y=y.slice(0,128)+"..."),`The ${E.includes(".")?"property":"argument"} '${E}' ${S}. Received ${y}`},TypeError),m("ERR_INVALID_RETURN_VALUE",(E,v,S)=>{var y;const h=S!=null&&(y=S.constructor)!==null&&y!==void 0&&y.name?`instance of ${S.constructor.name}`:`type ${typeof S}`;return`Expected ${E} to be returned from the "${v}" function but got ${h}.`},TypeError),m("ERR_MISSING_ARGS",(...E)=>{l(E.length>0,"At least one arg needs to be specified");let v;const S=E.length;switch(E=(Array.isArray(E)?E:[E]).map(y=>`"${y}"`).join(" or "),S){case 1:v+=`The ${E[0]} argument`;break;case 2:v+=`The ${E[0]} and ${E[1]} arguments`;break;default:{const y=E.pop();v+=`The ${E.join(", ")}, and ${y} arguments`}break}return`${v} must be specified`},TypeError),m("ERR_OUT_OF_RANGE",(E,v,S)=>{l(v,'Missing "range" argument');let y;if(Number.isInteger(S)&&Math.abs(S)>2**32)y=c(String(S));else if(typeof S=="bigint"){y=String(S);const h=BigInt(2)**BigInt(32);(S>h||S<-h)&&(y=c(y)),y+="n"}else y=e(S);return`The value of "${E}" is out of range. It must be ${v}. Received ${y}`},RangeError),m("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),m("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),m("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),m("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),m("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),m("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),m("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),m("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),m("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),m("ERR_STREAM_WRITE_AFTER_END","write after end",Error),m("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),Ei={AbortError:x,aggregateTwoErrors:b(_),hideStackFrames:b,codes:u},Ei}var Gr={exports:{}},ao;function bn(){if(ao)return Gr.exports;ao=1;const{AbortController:r,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return Gr.exports=r,Gr.exports.AbortSignal=e,Gr.exports.default=r,Gr.exports}var jn={exports:{}},oo;function si(){if(oo)return jn.exports;oo=1;var r=typeof Reflect=="object"?Reflect:null,e=r&&typeof r.apply=="function"?r.apply:function(g,I,C){return Function.prototype.apply.call(g,I,C)},t;r&&typeof r.ownKeys=="function"?t=r.ownKeys:Object.getOwnPropertySymbols?t=function(g){return Object.getOwnPropertyNames(g).concat(Object.getOwnPropertySymbols(g))}:t=function(g){return Object.getOwnPropertyNames(g)};function n(h){console&&console.warn&&console.warn(h)}var i=Number.isNaN||function(g){return g!==g};function s(){s.init.call(this)}jn.exports=s,jn.exports.once=v,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function o(h){if(typeof h!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof h)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(h){if(typeof h!="number"||h<0||i(h))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+h+".");a=h}}),s.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},s.prototype.setMaxListeners=function(g){if(typeof g!="number"||g<0||i(g))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+g+".");return this._maxListeners=g,this};function u(h){return h._maxListeners===void 0?s.defaultMaxListeners:h._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(g){for(var I=[],C=1;C<arguments.length;C++)I.push(arguments[C]);var A=g==="error",B=this._events;if(B!==void 0)A=A&&B.error===void 0;else if(!A)return!1;if(A){var R;if(I.length>0&&(R=I[0]),R instanceof Error)throw R;var F=new Error("Unhandled error."+(R?" ("+R.message+")":""));throw F.context=R,F}var q=B[g];if(q===void 0)return!1;if(typeof q=="function")e(q,this,I);else for(var D=q.length,O=_(q,D),C=0;C<D;++C)e(O[C],this,I);return!0};function l(h,g,I,C){var A,B,R;if(o(I),B=h._events,B===void 0?(B=h._events=Object.create(null),h._eventsCount=0):(B.newListener!==void 0&&(h.emit("newListener",g,I.listener?I.listener:I),B=h._events),R=B[g]),R===void 0)R=B[g]=I,++h._eventsCount;else if(typeof R=="function"?R=B[g]=C?[I,R]:[R,I]:C?R.unshift(I):R.push(I),A=u(h),A>0&&R.length>A&&!R.warned){R.warned=!0;var F=new Error("Possible EventEmitter memory leak detected. "+R.length+" "+String(g)+" listeners added. Use emitter.setMaxListeners() to increase limit");F.name="MaxListenersExceededWarning",F.emitter=h,F.type=g,F.count=R.length,n(F)}return h}s.prototype.addListener=function(g,I){return l(this,g,I,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(g,I){return l(this,g,I,!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 d(h,g,I){var C={fired:!1,wrapFn:void 0,target:h,type:g,listener:I},A=c.bind(C);return A.listener=I,C.wrapFn=A,A}s.prototype.once=function(g,I){return o(I),this.on(g,d(this,g,I)),this},s.prototype.prependOnceListener=function(g,I){return o(I),this.prependListener(g,d(this,g,I)),this},s.prototype.removeListener=function(g,I){var C,A,B,R,F;if(o(I),A=this._events,A===void 0)return this;if(C=A[g],C===void 0)return this;if(C===I||C.listener===I)--this._eventsCount===0?this._events=Object.create(null):(delete A[g],A.removeListener&&this.emit("removeListener",g,C.listener||I));else if(typeof C!="function"){for(B=-1,R=C.length-1;R>=0;R--)if(C[R]===I||C[R].listener===I){F=C[R].listener,B=R;break}if(B<0)return this;B===0?C.shift():x(C,B),C.length===1&&(A[g]=C[0]),A.removeListener!==void 0&&this.emit("removeListener",g,F||I)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(g){var I,C,A;if(C=this._events,C===void 0)return this;if(C.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):C[g]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete C[g]),this;if(arguments.length===0){var B=Object.keys(C),R;for(A=0;A<B.length;++A)R=B[A],R!=="removeListener"&&this.removeAllListeners(R);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(I=C[g],typeof I=="function")this.removeListener(g,I);else if(I!==void 0)for(A=I.length-1;A>=0;A--)this.removeListener(g,I[A]);return this};function m(h,g,I){var C=h._events;if(C===void 0)return[];var A=C[g];return A===void 0?[]:typeof A=="function"?I?[A.listener||A]:[A]:I?E(A):_(A,A.length)}s.prototype.listeners=function(g){return m(this,g,!0)},s.prototype.rawListeners=function(g){return m(this,g,!1)},s.listenerCount=function(h,g){return typeof h.listenerCount=="function"?h.listenerCount(g):b.call(h,g)},s.prototype.listenerCount=b;function b(h){var g=this._events;if(g!==void 0){var I=g[h];if(typeof I=="function")return 1;if(I!==void 0)return I.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function _(h,g){for(var I=new Array(g),C=0;C<g;++C)I[C]=h[C];return I}function x(h,g){for(;g+1<h.length;g++)h[g]=h[g+1];h.pop()}function E(h){for(var g=new Array(h.length),I=0;I<g.length;++I)g[I]=h[I].listener||h[I];return g}function v(h,g){return new Promise(function(I,C){function A(R){h.removeListener(g,B),C(R)}function B(){typeof h.removeListener=="function"&&h.removeListener("error",A),I([].slice.call(arguments))}y(h,g,B,{once:!0}),g!=="error"&&S(h,A,{once:!0})})}function S(h,g,I){typeof h.on=="function"&&y(h,"error",g,I)}function y(h,g,I,C){if(typeof h.on=="function")C.once?h.once(g,I):h.on(g,I);else if(typeof h.addEventListener=="function")h.addEventListener(g,function A(B){C.once&&h.removeEventListener(g,A),I(B)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof h)}return jn.exports}var lo;function st(){return lo||(lo=1,function(r){const e=Lt(),{format:t,inspect:n}=Zu(),{codes:{ERR_INVALID_ARG_TYPE:i}}=rt(),{kResistStopPropagation:s,AggregateError:a,SymbolDispose:o}=Be(),u=globalThis.AbortSignal||bn().AbortSignal,l=globalThis.AbortController||bn().AbortController,c=Object.getPrototypeOf(async function(){}).constructor,d=globalThis.Blob||e.Blob,m=typeof d<"u"?function(E){return E instanceof d}:function(E){return!1},b=(x,E)=>{if(x!==void 0&&(x===null||typeof x!="object"||!("aborted"in x)))throw new i(E,"AbortSignal",x)},_=(x,E)=>{if(typeof x!="function")throw new i(E,"Function",x)};r.exports={AggregateError:a,kEmptyObject:Object.freeze({}),once(x){let E=!1;return function(...v){E||(E=!0,x.apply(this,v))}},createDeferredPromise:function(){let x,E;return{promise:new Promise((S,y)=>{x=S,E=y}),resolve:x,reject:E}},promisify(x){return new Promise((E,v)=>{x((S,...y)=>S?v(S):E(...y))})},debuglog(){return function(){}},format:t,inspect:n,types:{isAsyncFunction(x){return x instanceof c},isArrayBufferView(x){return ArrayBuffer.isView(x)}},isBlob:m,deprecate(x,E){return x},addAbortListener:si().addAbortListener||function(E,v){if(E===void 0)throw new i("signal","AbortSignal",E);b(E,"signal"),_(v,"listener");let S;return E.aborted?queueMicrotask(()=>v()):(E.addEventListener("abort",v,{__proto__:null,once:!0,[s]:!0}),S=()=>{E.removeEventListener("abort",v)}),{__proto__:null,[o](){var y;(y=S)===null||y===void 0||y()}}},AbortSignalAny:u.any||function(E){if(E.length===1)return E[0];const v=new l,S=()=>v.abort();return E.forEach(y=>{b(y,"signals"),y.addEventListener("abort",S,{once:!0})}),v.signal.addEventListener("abort",()=>{E.forEach(y=>y.removeEventListener("abort",S))},{once:!0}),v.signal}},r.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}(vi)),vi.exports}var $n={},Si,uo;function En(){if(uo)return Si;uo=1;const{ArrayIsArray:r,ArrayPrototypeIncludes:e,ArrayPrototypeJoin:t,ArrayPrototypeMap:n,NumberIsInteger:i,NumberIsNaN:s,NumberMAX_SAFE_INTEGER:a,NumberMIN_SAFE_INTEGER:o,NumberParseInt:u,ObjectPrototypeHasOwnProperty:l,RegExpPrototypeExec:c,String:d,StringPrototypeToUpperCase:m,StringPrototypeTrim:b}=Be(),{hideStackFrames:_,codes:{ERR_SOCKET_BAD_PORT:x,ERR_INVALID_ARG_TYPE:E,ERR_INVALID_ARG_VALUE:v,ERR_OUT_OF_RANGE:S,ERR_UNKNOWN_SIGNAL:y}}=rt(),{normalizeEncoding:h}=st(),{isAsyncFunction:g,isArrayBufferView:I}=st().types,C={};function A(J){return J===(J|0)}function B(J){return J===J>>>0}const R=/^[0-7]+$/,F="must be a 32-bit unsigned integer or an octal string";function q(J,ce,ye){if(typeof J>"u"&&(J=ye),typeof J=="string"){if(c(R,J)===null)throw new v(ce,J,F);J=u(J,8)}return te(J,ce),J}const D=_((J,ce,ye=o,le=a)=>{if(typeof J!="number")throw new E(ce,"number",J);if(!i(J))throw new S(ce,"an integer",J);if(J<ye||J>le)throw new S(ce,`>= ${ye} && <= ${le}`,J)}),O=_((J,ce,ye=-2147483648,le=2147483647)=>{if(typeof J!="number")throw new E(ce,"number",J);if(!i(J))throw new S(ce,"an integer",J);if(J<ye||J>le)throw new S(ce,`>= ${ye} && <= ${le}`,J)}),te=_((J,ce,ye=!1)=>{if(typeof J!="number")throw new E(ce,"number",J);if(!i(J))throw new S(ce,"an integer",J);const le=ye?1:0,Ne=4294967295;if(J<le||J>Ne)throw new S(ce,`>= ${le} && <= ${Ne}`,J)});function T(J,ce){if(typeof J!="string")throw new E(ce,"string",J)}function Z(J,ce,ye=void 0,le){if(typeof J!="number")throw new E(ce,"number",J);if(ye!=null&&J<ye||le!=null&&J>le||(ye!=null||le!=null)&&s(J))throw new S(ce,`${ye!=null?`>= ${ye}`:""}${ye!=null&&le!=null?" && ":""}${le!=null?`<= ${le}`:""}`,J)}const k=_((J,ce,ye)=>{if(!e(ye,J)){const Ne="must be one of: "+t(n(ye,ze=>typeof ze=="string"?`'${ze}'`:d(ze)),", ");throw new v(ce,J,Ne)}});function Y(J,ce){if(typeof J!="boolean")throw new E(ce,"boolean",J)}function w(J,ce,ye){return J==null||!l(J,ce)?ye:J[ce]}const H=_((J,ce,ye=null)=>{const le=w(ye,"allowArray",!1),Ne=w(ye,"allowFunction",!1);if(!w(ye,"nullable",!1)&&J===null||!le&&r(J)||typeof J!="object"&&(!Ne||typeof J!="function"))throw new E(ce,"Object",J)}),K=_((J,ce)=>{if(J!=null&&typeof J!="object"&&typeof J!="function")throw new E(ce,"a dictionary",J)}),X=_((J,ce,ye=0)=>{if(!r(J))throw new E(ce,"Array",J);if(J.length<ye){const le=`must be longer than ${ye}`;throw new v(ce,J,le)}});function ue(J,ce){X(J,ce);for(let ye=0;ye<J.length;ye++)T(J[ye],`${ce}[${ye}]`)}function V(J,ce){X(J,ce);for(let ye=0;ye<J.length;ye++)Y(J[ye],`${ce}[${ye}]`)}function G(J,ce){X(J,ce);for(let ye=0;ye<J.length;ye++){const le=J[ye],Ne=`${ce}[${ye}]`;if(le==null)throw new E(Ne,"AbortSignal",le);fe(le,Ne)}}function z(J,ce="signal"){if(T(J,ce),C[J]===void 0)throw C[m(J)]!==void 0?new y(J+" (signals must use all capital letters)"):new y(J)}const U=_((J,ce="buffer")=>{if(!I(J))throw new E(ce,["Buffer","TypedArray","DataView"],J)});function ee(J,ce){const ye=h(ce),le=J.length;if(ye==="hex"&&le%2!==0)throw new v("encoding",ce,`is invalid for data of length ${le}`)}function re(J,ce="Port",ye=!0){if(typeof J!="number"&&typeof J!="string"||typeof J=="string"&&b(J).length===0||+J!==+J>>>0||J>65535||J===0&&!ye)throw new x(ce,J,ye);return J|0}const fe=_((J,ce)=>{if(J!==void 0&&(J===null||typeof J!="object"||!("aborted"in J)))throw new E(ce,"AbortSignal",J)}),ge=_((J,ce)=>{if(typeof J!="function")throw new E(ce,"Function",J)}),j=_((J,ce)=>{if(typeof J!="function"||g(J))throw new E(ce,"Function",J)}),W=_((J,ce)=>{if(J!==void 0)throw new E(ce,"undefined",J)});function se(J,ce,ye){if(!e(ye,J))throw new E(ce,`('${t(ye,"|")}')`,J)}const he=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function pe(J,ce){if(typeof J>"u"||!c(he,J))throw new v(ce,J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function me(J){if(typeof J=="string")return pe(J,"hints"),J;if(r(J)){const ce=J.length;let ye="";if(ce===0)return ye;for(let le=0;le<ce;le++){const Ne=J[le];pe(Ne,"hints"),ye+=Ne,le!==ce-1&&(ye+=", ")}return ye}throw new v("hints",J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return Si={isInt32:A,isUint32:B,parseFileMode:q,validateArray:X,validateStringArray:ue,validateBooleanArray:V,validateAbortSignalArray:G,validateBoolean:Y,validateBuffer:U,validateDictionary:K,validateEncoding:ee,validateFunction:ge,validateInt32:O,validateInteger:D,validateNumber:Z,validateObject:H,validateOneOf:k,validatePlainFunction:j,validatePort:re,validateSignalName:z,validateString:T,validateUint32:te,validateUndefined:W,validateUnion:se,validateAbortSignal:fe,validateLinkHeaderValue:me},Si}var Fn={exports:{}},Ni={exports:{}},co;function lr(){if(co)return Ni.exports;co=1;var r=Ni.exports={},e,t;function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=n}catch{e=n}try{typeof clearTimeout=="function"?t=clearTimeout:t=i}catch{t=i}})();function s(x){if(e===setTimeout)return setTimeout(x,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(x,0);try{return e(x,0)}catch{try{return e.call(null,x,0)}catch{return e.call(this,x,0)}}}function a(x){if(t===clearTimeout)return clearTimeout(x);if((t===i||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(x);try{return t(x)}catch{try{return t.call(null,x)}catch{return t.call(this,x)}}}var o=[],u=!1,l,c=-1;function d(){!u||!l||(u=!1,l.length?o=l.concat(o):c=-1,o.length&&m())}function m(){if(!u){var x=s(d);u=!0;for(var E=o.length;E;){for(l=o,o=[];++c<E;)l&&l[c].run();c=-1,E=o.length}l=null,u=!1,a(x)}}r.nextTick=function(x){var E=new Array(arguments.length-1);if(arguments.length>1)for(var v=1;v<arguments.length;v++)E[v-1]=arguments[v];o.push(new b(x,E)),o.length===1&&!u&&s(m)};function b(x,E){this.fun=x,this.array=E}b.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={};function _(){}return r.on=_,r.addListener=_,r.once=_,r.off=_,r.removeListener=_,r.removeAllListeners=_,r.emit=_,r.prependListener=_,r.prependOnceListener=_,r.listeners=function(x){return[]},r.binding=function(x){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(x){throw new Error("process.chdir is not supported")},r.umask=function(){return 0},Ni.exports}var Ii,ho;function Ct(){if(ho)return Ii;ho=1;const{SymbolAsyncIterator:r,SymbolIterator:e,SymbolFor:t}=Be(),n=t("nodejs.stream.destroyed"),i=t("nodejs.stream.errored"),s=t("nodejs.stream.readable"),a=t("nodejs.stream.writable"),o=t("nodejs.stream.disturbed"),u=t("nodejs.webstream.isClosedPromise"),l=t("nodejs.webstream.controllerErrorFunction");function c(w,H=!1){var K;return!!(w&&typeof w.pipe=="function"&&typeof w.on=="function"&&(!H||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 d(w){var H;return!!(w&&typeof w.write=="function"&&typeof w.on=="function"&&(!w._readableState||((H=w._writableState)===null||H===void 0?void 0:H.writable)!==!1))}function m(w){return!!(w&&typeof w.pipe=="function"&&w._readableState&&typeof w.on=="function"&&typeof w.write=="function")}function b(w){return w&&(w._readableState||w._writableState||typeof w.write=="function"&&typeof w.on=="function"||typeof w.pipe=="function"&&typeof w.on=="function")}function _(w){return!!(w&&!b(w)&&typeof w.pipeThrough=="function"&&typeof w.getReader=="function"&&typeof w.cancel=="function")}function x(w){return!!(w&&!b(w)&&typeof w.getWriter=="function"&&typeof w.abort=="function")}function E(w){return!!(w&&!b(w)&&typeof w.readable=="object"&&typeof w.writable=="object")}function v(w){return _(w)||x(w)||E(w)}function S(w,H){return w==null?!1:H===!0?typeof w[r]=="function":H===!1?typeof w[e]=="function":typeof w[r]=="function"||typeof w[e]=="function"}function y(w){if(!b(w))return null;const H=w._writableState,K=w._readableState,X=H||K;return!!(w.destroyed||w[n]||X!=null&&X.destroyed)}function h(w){if(!d(w))return null;if(w.writableEnded===!0)return!0;const H=w._writableState;return H!=null&&H.errored?!1:typeof H?.ended!="boolean"?null:H.ended}function g(w,H){if(!d(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||H===!1&&K.ended===!0&&K.length===0)}function I(w){if(!c(w))return null;if(w.readableEnded===!0)return!0;const H=w._readableState;return!H||H.errored?!1:typeof H?.ended!="boolean"?null:H.ended}function C(w,H){if(!c(w))return null;const K=w._readableState;return K!=null&&K.errored?!1:typeof K?.endEmitted!="boolean"?null:!!(K.endEmitted||H===!1&&K.ended===!0&&K.length===0)}function A(w){return w&&w[s]!=null?w[s]:typeof w?.readable!="boolean"?null:y(w)?!1:c(w)&&w.readable&&!C(w)}function B(w){return w&&w[a]!=null?w[a]:typeof w?.writable!="boolean"?null:y(w)?!1:d(w)&&w.writable&&!h(w)}function R(w,H){return b(w)?y(w)?!0:!(H?.readable!==!1&&A(w)||H?.writable!==!1&&B(w)):null}function F(w){var H,K;return b(w)?w.writableErrored?w.writableErrored:(H=(K=w._writableState)===null||K===void 0?void 0:K.errored)!==null&&H!==void 0?H:null:null}function q(w){var H,K;return b(w)?w.readableErrored?w.readableErrored:(H=(K=w._readableState)===null||K===void 0?void 0:K.errored)!==null&&H!==void 0?H:null:null}function D(w){if(!b(w))return null;if(typeof w.closed=="boolean")return w.closed;const H=w._writableState,K=w._readableState;return typeof H?.closed=="boolean"||typeof K?.closed=="boolean"?H?.closed||K?.closed:typeof w._closed=="boolean"&&O(w)?w._closed:null}function O(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"&&O(w)}function T(w){var H;return typeof w._consuming=="boolean"&&typeof w._dumped=="boolean"&&((H=w.req)===null||H===void 0?void 0:H.upgradeOrConnect)===void 0}function Z(w){if(!b(w))return null;const H=w._writableState,K=w._readableState,X=H||K;return!X&&te(w)||!!(X&&X.autoDestroy&&X.emitClose&&X.closed===!1)}function k(w){var H;return!!(w&&((H=w[o])!==null&&H!==void 0?H:w.readableDidRead||w.readableAborted))}function Y(w){var H,K,X,ue,V,G,z,U,ee,re;return!!(w&&((H=(K=(X=(ue=(V=(G=w[i])!==null&&G!==void 0?G:w.readableErrored)!==null&&V!==void 0?V:w.writableErrored)!==null&&ue!==void 0?ue:(z=w._readableState)===null||z===void 0?void 0:z.errorEmitted)!==null&&X!==void 0?X:(U=w._writableState)===null||U===void 0?void 0:U.errorEmitted)!==null&&K!==void 0?K:(ee=w._readableState)===null||ee===void 0?void 0:ee.errored)!==null&&H!==void 0?H:!((re=w._writableState)===null||re===void 0)&&re.errored))}return Ii={isDestroyed:y,kIsDestroyed:n,isDisturbed:k,kIsDisturbed:o,isErrored:Y,kIsErrored:i,isReadable:A,kIsReadable:s,kIsClosedPromise:u,kControllerErrorFunction:l,kIsWritable:a,isClosed:D,isDuplexNodeStream:m,isFinished:R,isIterable:S,isReadableNodeStream:c,isReadableStream:_,isReadableEnded:I,isReadableFinished:C,isReadableErrored:q,isNodeStream:b,isWebStream:v,isWritable:B,isWritableNodeStream:d,isWritableStream:x,isWritableEnded:h,isWritableFinished:g,isWritableErrored:F,isServerRequest:T,isServerResponse:te,willEmitClose:Z,isTransformStream:E},Ii}var fo;function Vt(){if(fo)return Fn.exports;fo=1;const r=lr(),{AbortError:e,codes:t}=rt(),{ERR_INVALID_ARG_TYPE:n,ERR_STREAM_PREMATURE_CLOSE:i}=t,{kEmptyObject:s,once:a}=st(),{validateAbortSignal:o,validateFunction:u,validateObject:l,validateBoolean:c}=En(),{Promise:d,PromisePrototypeThen:m,SymbolDispose:b}=Be(),{isClosed:_,isReadable:x,isReadableNodeStream:E,isReadableStream:v,isReadableFinished:S,isReadableErrored:y,isWritable:h,isWritableNodeStream:g,isWritableStream:I,isWritableFinished:C,isWritableErrored:A,isNodeStream:B,willEmitClose:R,kIsClosedPromise:F}=Ct();let q;function D(k){return k.setHeader&&typeof k.abort=="function"}const O=()=>{};function te(k,Y,w){var H,K;if(arguments.length===2?(w=Y,Y=s):Y==null?Y=s:l(Y,"options"),u(w,"callback"),o(Y.signal,"options.signal"),w=a(w),v(k)||I(k))return T(k,Y,w);if(!B(k))throw new n("stream",["ReadableStream","WritableStream","Stream"],k);const X=(H=Y.readable)!==null&&H!==void 0?H:E(k),ue=(K=Y.writable)!==null&&K!==void 0?K:g(k),V=k._writableState,G=k._readableState,z=()=>{k.writable||re()};let U=R(k)&&E(k)===X&&g(k)===ue,ee=C(k,!1);const re=()=>{ee=!0,k.destroyed&&(U=!1),!(U&&(!k.readable||X))&&(!X||fe)&&w.call(k)};let fe=S(k,!1);const ge=()=>{fe=!0,k.destroyed&&(U=!1),!(U&&(!k.writable||ue))&&(!ue||ee)&&w.call(k)},j=J=>{w.call(k,J)};let W=_(k);const se=()=>{W=!0;const J=A(k)||y(k);if(J&&typeof J!="boolean")return w.call(k,J);if(X&&!fe&&E(k,!0)&&!S(k,!1))return w.call(k,new i);if(ue&&!ee&&!C(k,!1))return w.call(k,new i);w.call(k)},he=()=>{W=!0;const J=A(k)||y(k);if(J&&typeof J!="boolean")return w.call(k,J);w.call(k)},pe=()=>{k.req.on("finish",re)};D(k)?(k.on("complete",re),U||k.on("abort",se),k.req?pe():k.on("request",pe)):ue&&!V&&(k.on("end",z),k.on("close",z)),!U&&typeof k.aborted=="boolean"&&k.on("aborted",se),k.on("end",ge),k.on("finish",re),Y.error!==!1&&k.on("error",j),k.on("close",se),W?r.nextTick(se):V!=null&&V.errorEmitted||G!=null&&G.errorEmitted?U||r.nextTick(he):(!X&&(!U||x(k))&&(ee||h(k)===!1)||!ue&&(!U||h(k))&&(fe||x(k)===!1)||G&&k.req&&k.aborted)&&r.nextTick(he);const me=()=>{w=O,k.removeListener("aborted",se),k.removeListener("complete",re),k.removeListener("abort",se),k.removeListener("request",pe),k.req&&k.req.removeListener("finish",re),k.removeListener("end",z),k.removeListener("close",z),k.removeListener("finish",re),k.removeListener("end",ge),k.removeListener("error",j),k.removeListener("close",se)};if(Y.signal&&!W){const J=()=>{const ce=w;me(),ce.call(k,new e(void 0,{cause:Y.signal.reason}))};if(Y.signal.aborted)r.nextTick(J);else{q=q||st().addAbortListener;const ce=q(Y.signal,J),ye=w;w=a((...le)=>{ce[b](),ye.apply(k,le)})}}return me}function T(k,Y,w){let H=!1,K=O;if(Y.signal)if(K=()=>{H=!0,w.call(k,new e(void 0,{cause:Y.signal.reason}))},Y.signal.aborted)r.nextTick(K);else{q=q||st().addAbortListener;const ue=q(Y.signal,K),V=w;w=a((...G)=>{ue[b](),V.apply(k,G)})}const X=(...ue)=>{H||r.nextTick(()=>w.apply(k,ue))};return m(k[F].promise,X,X),O}function Z(k,Y){var w;let H=!1;return Y===null&&(Y=s),(w=Y)!==null&&w!==void 0&&w.cleanup&&(c(Y.cleanup,"cleanup"),H=Y.cleanup),new d((K,X)=>{const ue=te(k,Y,V=>{H&&ue(),V?X(V):K()})})}return Fn.exports=te,Fn.exports.finished=Z,Fn.exports}var Ri,po;function Lr(){if(po)return Ri;po=1;const r=lr(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:n}=rt(),{Symbol:i}=Be(),{kIsDestroyed:s,isDestroyed:a,isFinished:o,isServerRequest:u}=Ct(),l=i("kDestroy"),c=i("kConstruct");function d(R,F,q){R&&(R.stack,F&&!F.errored&&(F.errored=R),q&&!q.errored&&(q.errored=R))}function m(R,F){const q=this._readableState,D=this._writableState,O=D||q;return D!=null&&D.destroyed||q!=null&&q.destroyed?(typeof F=="function"&&F(),this):(d(R,D,q),D&&(D.destroyed=!0),q&&(q.destroyed=!0),O.constructed?b(this,R,F):this.once(l,function(te){b(this,e(te,R),F)}),this)}function b(R,F,q){let D=!1;function O(te){if(D)return;D=!0;const T=R._readableState,Z=R._writableState;d(te,Z,T),Z&&(Z.closed=!0),T&&(T.closed=!0),typeof q=="function"&&q(te),te?r.nextTick(_,R,te):r.nextTick(x,R)}try{R._destroy(F||null,O)}catch(te){O(te)}}function _(R,F){E(R,F),x(R)}function x(R){const F=R._readableState,q=R._writableState;q&&(q.closeEmitted=!0),F&&(F.closeEmitted=!0),(q!=null&&q.emitClose||F!=null&&F.emitClose)&&R.emit("close")}function E(R,F){const q=R._readableState,D=R._writableState;D!=null&&D.errorEmitted||q!=null&&q.errorEmitted||(D&&(D.errorEmitted=!0),q&&(q.errorEmitted=!0),R.emit("error",F))}function v(){const R=this._readableState,F=this._writableState;R&&(R.constructed=!0,R.closed=!1,R.closeEmitted=!1,R.destroyed=!1,R.errored=null,R.errorEmitted=!1,R.reading=!1,R.ended=R.readable===!1,R.endEmitted=R.readable===!1),F&&(F.constructed=!0,F.destroyed=!1,F.closed=!1,F.closeEmitted=!1,F.errored=null,F.errorEmitted=!1,F.finalCalled=!1,F.prefinished=!1,F.ended=F.writable===!1,F.ending=F.writable===!1,F.finished=F.writable===!1)}function S(R,F,q){const D=R._readableState,O=R._writableState;if(O!=null&&O.destroyed||D!=null&&D.destroyed)return this;D!=null&&D.autoDestroy||O!=null&&O.autoDestroy?R.destroy(F):F&&(F.stack,O&&!O.errored&&(O.errored=F),D&&!D.errored&&(D.errored=F),q?r.nextTick(E,R,F):E(R,F))}function y(R,F){if(typeof R._construct!="function")return;const q=R._readableState,D=R._writableState;q&&(q.constructed=!1),D&&(D.constructed=!1),R.once(c,F),!(R.listenerCount(c)>1)&&r.nextTick(h,R)}function h(R){let F=!1;function q(D){if(F){S(R,D??new t);return}F=!0;const O=R._readableState,te=R._writableState,T=te||O;O&&(O.constructed=!0),te&&(te.constructed=!0),T.destroyed?R.emit(l,D):D?S(R,D,!0):r.nextTick(g,R)}try{R._construct(D=>{r.nextTick(q,D)})}catch(D){r.nextTick(q,D)}}function g(R){R.emit(c)}function I(R){return R?.setHeader&&typeof R.abort=="function"}function C(R){R.emit("close")}function A(R,F){R.emit("error",F),r.nextTick(C,R)}function B(R,F){!R||a(R)||(!F&&!o(R)&&(F=new n),u(R)?(R.socket=null,R.destroy(F)):I(R)?R.abort():I(R.req)?R.req.abort():typeof R.destroy=="function"?R.destroy(F):typeof R.close=="function"?R.close():F?r.nextTick(A,R,F):r.nextTick(C,R),R.destroyed||(R[s]=!0))}return Ri={construct:y,destroyer:B,destroy:m,undestroy:v,errorOrDestroy:S},Ri}var Ti,go;function ma(){if(go)return Ti;go=1;const{ArrayIsArray:r,ObjectSetPrototypeOf:e}=Be(),{EventEmitter:t}=si();function n(s){t.call(this,s)}e(n.prototype,t.prototype),e(n,t),n.prototype.pipe=function(s,a){const o=this;function u(x){s.writable&&s.write(x)===!1&&o.pause&&o.pause()}o.on("data",u);function l(){o.readable&&o.resume&&o.resume()}s.on("drain",l),!s._isStdio&&(!a||a.end!==!1)&&(o.on("end",d),o.on("close",m));let c=!1;function d(){c||(c=!0,s.end())}function m(){c||(c=!0,typeof s.destroy=="function"&&s.destroy())}function b(x){_(),t.listenerCount(this,"error")===0&&this.emit("error",x)}i(o,"error",b),i(s,"error",b);function _(){o.removeListener("data",u),s.removeListener("drain",l),o.removeListener("end",d),o.removeListener("close",m),o.removeListener("error",b),s.removeListener("error",b),o.removeListener("end",_),o.removeListener("close",_),s.removeListener("close",_)}return o.on("end",_),o.on("close",_),s.on("close",_),s.emit("pipe",o),s};function i(s,a,o){if(typeof s.prependListener=="function")return s.prependListener(a,o);!s._events||!s._events[a]?s.on(a,o):r(s._events[a])?s._events[a].unshift(o):s._events[a]=[o,s._events[a]]}return Ti={Stream:n,prependListener:i},Ti}var Ai={exports:{}},mo;function ai(){return mo||(mo=1,function(r){const{SymbolDispose:e}=Be(),{AbortError:t,codes:n}=rt(),{isNodeStream:i,isWebStream:s,kControllerErrorFunction:a}=Ct(),o=Vt(),{ERR_INVALID_ARG_TYPE:u}=n;let l;const c=(d,m)=>{if(typeof d!="object"||!("aborted"in d))throw new u(m,"AbortSignal",d)};r.exports.addAbortSignal=function(m,b){if(c(m,"signal"),!i(b)&&!s(b))throw new u("stream",["ReadableStream","WritableStream","Stream"],b);return r.exports.addAbortSignalNoValidate(m,b)},r.exports.addAbortSignalNoValidate=function(d,m){if(typeof d!="object"||!("aborted"in d))return m;const b=i(m)?()=>{m.destroy(new t(void 0,{cause:d.reason}))}:()=>{m[a](new t(void 0,{cause:d.reason}))};if(d.aborted)b();else{l=l||st().addAbortListener;const _=l(d,b);o(m,_[e])}return m}}(Ai)),Ai.exports}var Di,yo;function Ed(){if(yo)return Di;yo=1;const{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:n}=Be(),{Buffer:i}=Lt(),{inspect:s}=st();return Di=class{constructor(){this.head=null,this.tail=null,this.length=0}push(o){const u={data:o,next:null};this.length>0?this.tail.next=u:this.head=u,this.tail=u,++this.length}unshift(o){const u={data:o,next:this.head};this.length===0&&(this.tail=u),this.head=u,++this.length}shift(){if(this.length===0)return;const o=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,o}clear(){this.head=this.tail=null,this.length=0}join(o){if(this.length===0)return"";let u=this.head,l=""+u.data;for(;(u=u.next)!==null;)l+=o+u.data;return l}concat(o){if(this.length===0)return i.alloc(0);const u=i.allocUnsafe(o>>>0);let l=this.head,c=0;for(;l;)t(u,l.data,c),c+=l.data.length,l=l.next;return u}consume(o,u){const l=this.head.data;if(o<l.length){const c=l.slice(0,o);return this.head.data=l.slice(o),c}return o===l.length?this.shift():u?this._getString(o):this._getBuffer(o)}first(){return this.head.data}*[e](){for(let o=this.head;o;o=o.next)yield o.data}_getString(o){let u="",l=this.head,c=0;do{const d=l.data;if(o>d.length)u+=d,o-=d.length;else{o===d.length?(u+=d,++c,l.next?this.head=l.next:this.head=this.tail=null):(u+=r(d,0,o),this.head=l,l.data=r(d,o));break}++c}while((l=l.next)!==null);return this.length-=c,u}_getBuffer(o){const u=i.allocUnsafe(o),l=o;let c=this.head,d=0;do{const m=c.data;if(o>m.length)t(u,m,l-o),o-=m.length;else{o===m.length?(t(u,m,l-o),++d,c.next?this.head=c.next:this.head=this.tail=null):(t(u,new n(m.buffer,m.byteOffset,o),l-o),this.head=c,c.data=m.slice(o));break}++d}while((c=c.next)!==null);return this.length-=d,u}[Symbol.for("nodejs.util.inspect.custom")](o,u){return s(this,{...u,depth:0,customInspect:!1})}},Di}var Oi,bo;function oi(){if(bo)return Oi;bo=1;const{MathFloor:r,NumberIsInteger:e}=Be(),{validateInteger:t}=En(),{ERR_INVALID_ARG_VALUE:n}=rt().codes;let i=16*1024,s=16;function a(c,d,m){return c.highWaterMark!=null?c.highWaterMark:d?c[m]:null}function o(c){return c?s:i}function u(c,d){t(d,"value",0),c?s=d:i=d}function l(c,d,m,b){const _=a(d,b,m);if(_!=null){if(!e(_)||_<0){const x=b?`options.${m}`:"options.highWaterMark";throw new n(x,_)}return r(_)}return o(c.objectMode)}return Oi={getHighWaterMark:l,getDefaultHighWaterMark:o,setDefaultHighWaterMark:u},Oi}var Li={},kn={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var _o;function Sd(){return _o||(_o=1,function(r,e){var t=Lt(),n=t.Buffer;function i(a,o){for(var u in a)o[u]=a[u]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?r.exports=t:(i(t,e),e.Buffer=s);function s(a,o,u){return n(a,o,u)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(a,o,u){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,o,u)},s.alloc=function(a,o,u){if(typeof a!="number")throw new TypeError("Argument must be a number");var l=n(a);return o!==void 0?typeof u=="string"?l.fill(o,u):l.fill(o):l.fill(0),l},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(a)}}(kn,kn.exports)),kn.exports}var wo;function Nd(){if(wo)return Li;wo=1;var r=Sd().Buffer,e=r.isEncoding||function(v){switch(v=""+v,v&&v.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(v){if(!v)return"utf8";for(var S;;)switch(v){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 v;default:if(S)return;v=(""+v).toLowerCase(),S=!0}}function n(v){var S=t(v);if(typeof S!="string"&&(r.isEncoding===e||!e(v)))throw new Error("Unknown encoding: "+v);return S||v}Li.StringDecoder=i;function i(v){this.encoding=n(v);var S;switch(this.encoding){case"utf16le":this.text=d,this.end=m,S=4;break;case"utf8":this.fillLast=u,S=4;break;case"base64":this.text=b,this.end=_,S=3;break;default:this.write=x,this.end=E;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(S)}i.prototype.write=function(v){if(v.length===0)return"";var S,y;if(this.lastNeed){if(S=this.fillLast(v),S===void 0)return"";y=this.lastNeed,this.lastNeed=0}else y=0;return y<v.length?S?S+this.text(v,y):this.text(v,y):S||""},i.prototype.end=c,i.prototype.text=l,i.prototype.fillLast=function(v){if(this.lastNeed<=v.length)return v.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);v.copy(this.lastChar,this.lastTotal-this.lastNeed,0,v.length),this.lastNeed-=v.length};function s(v){return v<=127?0:v>>5===6?2:v>>4===14?3:v>>3===30?4:v>>6===2?-1:-2}function a(v,S,y){var h=S.length-1;if(h<y)return 0;var g=s(S[h]);return g>=0?(g>0&&(v.lastNeed=g-1),g):--h<y||g===-2?0:(g=s(S[h]),g>=0?(g>0&&(v.lastNeed=g-2),g):--h<y||g===-2?0:(g=s(S[h]),g>=0?(g>0&&(g===2?g=0:v.lastNeed=g-3),g):0))}function o(v,S,y){if((S[0]&192)!==128)return v.lastNeed=0,"�";if(v.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return v.lastNeed=1,"�";if(v.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return v.lastNeed=2,"�"}}function u(v){var S=this.lastTotal-this.lastNeed,y=o(this,v);if(y!==void 0)return y;if(this.lastNeed<=v.length)return v.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);v.copy(this.lastChar,S,0,v.length),this.lastNeed-=v.length}function l(v,S){var y=a(this,v,S);if(!this.lastNeed)return v.toString("utf8",S);this.lastTotal=y;var h=v.length-(y-this.lastNeed);return v.copy(this.lastChar,0,h),v.toString("utf8",S,h)}function c(v){var S=v&&v.length?this.write(v):"";return this.lastNeed?S+"�":S}function d(v,S){if((v.length-S)%2===0){var y=v.toString("utf16le",S);if(y){var h=y.charCodeAt(y.length-1);if(h>=55296&&h<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=v[v.length-2],this.lastChar[1]=v[v.length-1],y.slice(0,-1)}return y}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=v[v.length-1],v.toString("utf16le",S,v.length-1)}function m(v){var S=v&&v.length?this.write(v):"";if(this.lastNeed){var y=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,y)}return S}function b(v,S){var y=(v.length-S)%3;return y===0?v.toString("base64",S):(this.lastNeed=3-y,this.lastTotal=3,y===1?this.lastChar[0]=v[v.length-1]:(this.lastChar[0]=v[v.length-2],this.lastChar[1]=v[v.length-1]),v.toString("base64",S,v.length-y))}function _(v){var S=v&&v.length?this.write(v):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function x(v){return v.toString(this.encoding)}function E(v){return v&&v.length?this.write(v):""}return Li}var Ci,vo;function ec(){if(vo)return Ci;vo=1;const r=lr(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:n}=Be(),{Buffer:i}=Lt(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_NULL_VALUES:a}=rt().codes;function o(u,l,c){let d;if(typeof l=="string"||l instanceof i)return new u({objectMode:!0,...c,read(){this.push(l),this.push(null)}});let m;if(l&&l[t])m=!0,d=l[t]();else if(l&&l[n])m=!1,d=l[n]();else throw new s("iterable",["Iterable"],l);const b=new u({objectMode:!0,highWaterMark:1,...c});let _=!1;b._read=function(){_||(_=!0,E())},b._destroy=function(v,S){e(x(v),()=>r.nextTick(S,v),y=>r.nextTick(S,y||v))};async function x(v){const S=v!=null,y=typeof d.throw=="function";if(S&&y){const{value:h,done:g}=await d.throw(v);if(await h,g)return}if(typeof d.return=="function"){const{value:h}=await d.return();await h}}async function E(){for(;;){try{const{value:v,done:S}=m?await d.next():d.next();if(S)b.push(null);else{const y=v&&typeof v.then=="function"?await v:v;if(y===null)throw _=!1,new a;if(b.push(y))continue;_=!1}}catch(v){b.destroy(v)}break}}return b}return Ci=o,Ci}var ji,xo;function li(){if(xo)return ji;xo=1;const r=lr(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:n,NumberParseInt:i,ObjectDefineProperties:s,ObjectKeys:a,ObjectSetPrototypeOf:o,Promise:u,SafeSet:l,SymbolAsyncDispose:c,SymbolAsyncIterator:d,Symbol:m}=Be();ji=le,le.ReadableState=ye;const{EventEmitter:b}=si(),{Stream:_,prependListener:x}=ma(),{Buffer:E}=Lt(),{addAbortSignal:v}=ai(),S=Vt();let y=st().debuglog("stream",L=>{y=L});const h=Ed(),g=Lr(),{getHighWaterMark:I,getDefaultHighWaterMark:C}=oi(),{aggregateTwoErrors:A,codes:{ERR_INVALID_ARG_TYPE:B,ERR_METHOD_NOT_IMPLEMENTED:R,ERR_OUT_OF_RANGE:F,ERR_STREAM_PUSH_AFTER_EOF:q,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:D},AbortError:O}=rt(),{validateObject:te}=En(),T=m("kPaused"),{StringDecoder:Z}=Nd(),k=ec();o(le.prototype,_.prototype),o(le,_);const Y=()=>{},{errorOrDestroy:w}=g,H=1,K=2,X=4,ue=8,V=16,G=32,z=64,U=128,ee=256,re=512,fe=1024,ge=2048,j=4096,W=8192,se=16384,he=32768,pe=65536,me=1<<17,J=1<<18;function ce(L){return{enumerable:!1,get(){return(this.state&L)!==0},set(M){M?this.state|=L:this.state&=~L}}}s(ye.prototype,{objectMode:ce(H),ended:ce(K),endEmitted:ce(X),reading:ce(ue),constructed:ce(V),sync:ce(G),needReadable:ce(z),emittedReadable:ce(U),readableListening:ce(ee),resumeScheduled:ce(re),errorEmitted:ce(fe),emitClose:ce(ge),autoDestroy:ce(j),destroyed:ce(W),closed:ce(se),closeEmitted:ce(he),multiAwaitDrain:ce(pe),readingMore:ce(me),dataEmitted:ce(J)});function ye(L,M,be){typeof be!="boolean"&&(be=M instanceof Dt()),this.state=ge|j|V|G,L&&L.objectMode&&(this.state|=H),be&&L&&L.readableObjectMode&&(this.state|=H),this.highWaterMark=L?I(this,L,"readableHighWaterMark",be):C(!1),this.buffer=new h,this.length=0,this.pipes=[],this.flowing=null,this[T]=null,L&&L.emitClose===!1&&(this.state&=~ge),L&&L.autoDestroy===!1&&(this.state&=~j),this.errored=null,this.defaultEncoding=L&&L.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,L&&L.encoding&&(this.decoder=new Z(L.encoding),this.encoding=L.encoding)}function le(L){if(!(this instanceof le))return new le(L);const M=this instanceof Dt();this._readableState=new ye(L,this,M),L&&(typeof L.read=="function"&&(this._read=L.read),typeof L.destroy=="function"&&(this._destroy=L.destroy),typeof L.construct=="function"&&(this._construct=L.construct),L.signal&&!M&&v(L.signal,this)),_.call(this,L),g.construct(this,()=>{this._readableState.needReadable&&Q(this,this._readableState)})}le.prototype.destroy=g.destroy,le.prototype._undestroy=g.undestroy,le.prototype._destroy=function(L,M){M(L)},le.prototype[b.captureRejectionSymbol]=function(L){this.destroy(L)},le.prototype[c]=function(){let L;return this.destroyed||(L=this.readableEnded?null:new O,this.destroy(L)),new u((M,be)=>S(this,_e=>_e&&_e!==L?be(_e):M(null)))},le.prototype.push=function(L,M){return Ne(this,L,M,!1)},le.prototype.unshift=function(L,M){return Ne(this,L,M,!0)};function Ne(L,M,be,_e){y("readableAddChunk",M);const ve=L._readableState;let Xe;if((ve.state&H)===0&&(typeof M=="string"?(be=be||ve.defaultEncoding,ve.encoding!==be&&(_e&&ve.encoding?M=E.from(M,be).toString(ve.encoding):(M=E.from(M,be),be=""))):M instanceof E?be="":_._isUint8Array(M)?(M=_._uint8ArrayToBuffer(M),be=""):M!=null&&(Xe=new B("chunk",["string","Buffer","Uint8Array"],M))),Xe)w(L,Xe);else if(M===null)ve.state&=~ue,f(L,ve);else if((ve.state&H)!==0||M&&M.length>0)if(_e)if((ve.state&X)!==0)w(L,new D);else{if(ve.destroyed||ve.errored)return!1;ze(L,ve,M,!0)}else if(ve.ended)w(L,new q);else{if(ve.destroyed||ve.errored)return!1;ve.state&=~ue,ve.decoder&&!be?(M=ve.decoder.write(M),ve.objectMode||M.length!==0?ze(L,ve,M,!1):Q(L,ve)):ze(L,ve,M,!1)}else _e||(ve.state&=~ue,Q(L,ve));return!ve.ended&&(ve.length<ve.highWaterMark||ve.length===0)}function ze(L,M,be,_e){M.flowing&&M.length===0&&!M.sync&&L.listenerCount("data")>0?((M.state&pe)!==0?M.awaitDrainWriters.clear():M.awaitDrainWriters=null,M.dataEmitted=!0,L.emit("data",be)):(M.length+=M.objectMode?1:be.length,_e?M.buffer.unshift(be):M.buffer.push(be),(M.state&z)!==0&&p(L)),Q(L,M)}le.prototype.isPaused=function(){const L=this._readableState;return L[T]===!0||L.flowing===!1},le.prototype.setEncoding=function(L){const M=new Z(L);this._readableState.decoder=M,this._readableState.encoding=this._readableState.decoder.encoding;const be=this._readableState.buffer;let _e="";for(const ve of be)_e+=M.write(ve);return be.clear(),_e!==""&&be.push(_e),this._readableState.length=_e.length,this};const Se=1073741824;function Qe(L){if(L>Se)throw new F("size","<= 1GiB",L);return L--,L|=L>>>1,L|=L>>>2,L|=L>>>4,L|=L>>>8,L|=L>>>16,L++,L}function N(L,M){return L<=0||M.length===0&&M.ended?0:(M.state&H)!==0?1:n(L)?M.flowing&&M.length?M.buffer.first().length:M.length:L<=M.length?L:M.ended?M.length:0}le.prototype.read=function(L){y("read",L),L===void 0?L=NaN:t(L)||(L=i(L,10));const M=this._readableState,be=L;if(L>M.highWaterMark&&(M.highWaterMark=Qe(L)),L!==0&&(M.state&=~U),L===0&&M.needReadable&&((M.highWaterMark!==0?M.length>=M.highWaterMark:M.length>0)||M.ended))return y("read: emitReadable",M.length,M.ended),M.length===0&&M.ended?He(this):p(this),null;if(L=N(L,M),L===0&&M.ended)return M.length===0&&He(this),null;let _e=(M.state&z)!==0;if(y("need readable",_e),(M.length===0||M.length-L<M.highWaterMark)&&(_e=!0,y("length less than watermark",_e)),M.ended||M.reading||M.destroyed||M.errored||!M.constructed)_e=!1,y("reading, ended or constructing",_e);else if(_e){y("do read"),M.state|=ue|G,M.length===0&&(M.state|=z);try{this._read(M.highWaterMark)}catch(Xe){w(this,Xe)}M.state&=~G,M.reading||(L=N(be,M))}let ve;return L>0?ve=qe(L,M):ve=null,ve===null?(M.needReadable=M.length<=M.highWaterMark,L=0):(M.length-=L,M.multiAwaitDrain?M.awaitDrainWriters.clear():M.awaitDrainWriters=null),M.length===0&&(M.ended||(M.needReadable=!0),be!==L&&M.ended&&He(this)),ve!==null&&!M.errorEmitted&&!M.closeEmitted&&(M.dataEmitted=!0,this.emit("data",ve)),ve};function f(L,M){if(y("onEofChunk"),!M.ended){if(M.decoder){const be=M.decoder.end();be&&be.length&&(M.buffer.push(be),M.length+=M.objectMode?1:be.length)}M.ended=!0,M.sync?p(L):(M.needReadable=!1,M.emittedReadable=!0,$(L))}}function p(L){const M=L._readableState;y("emitReadable",M.needReadable,M.emittedReadable),M.needReadable=!1,M.emittedReadable||(y("emitReadable",M.flowing),M.emittedReadable=!0,r.nextTick($,L))}function $(L){const M=L._readableState;y("emitReadable_",M.destroyed,M.length,M.ended),!M.destroyed&&!M.errored&&(M.length||M.ended)&&(L.emit("readable"),M.emittedReadable=!1),M.needReadable=!M.flowing&&!M.ended&&M.length<=M.highWaterMark,De(L)}function Q(L,M){!M.readingMore&&M.constructed&&(M.readingMore=!0,r.nextTick(oe,L,M))}function oe(L,M){for(;!M.reading&&!M.ended&&(M.length<M.highWaterMark||M.flowing&&M.length===0);){const be=M.length;if(y("maybeReadMore read 0"),L.read(0),be===M.length)break}M.readingMore=!1}le.prototype._read=function(L){throw new R("_read()")},le.prototype.pipe=function(L,M){const be=this,_e=this._readableState;_e.pipes.length===1&&(_e.multiAwaitDrain||(_e.multiAwaitDrain=!0,_e.awaitDrainWriters=new l(_e.awaitDrainWriters?[_e.awaitDrainWriters]:[]))),_e.pipes.push(L),y("pipe count=%d opts=%j",_e.pipes.length,M);const Xe=(!M||M.end!==!1)&&L!==r.stdout&&L!==r.stderr?Tn:P;_e.endEmitted?r.nextTick(Xe):be.once("end",Xe),L.on("unpipe",Ye);function Ye(ne,ie){y("onunpipe"),ne===be&&ie&&ie.hasUnpiped===!1&&(ie.hasUnpiped=!0,Rt())}function Tn(){y("onend"),L.end()}let It,An=!1;function Rt(){y("cleanup"),L.removeListener("close",Pr),L.removeListener("finish",Ge),It&&L.removeListener("drain",It),L.removeListener("error",gr),L.removeListener("unpipe",Ye),be.removeListener("end",Tn),be.removeListener("end",P),be.removeListener("data",pr),An=!0,It&&_e.awaitDrainWriters&&(!L._writableState||L._writableState.needDrain)&&It()}function kr(){An||(_e.pipes.length===1&&_e.pipes[0]===L?(y("false write response, pause",0),_e.awaitDrainWriters=L,_e.multiAwaitDrain=!1):_e.pipes.length>1&&_e.pipes.includes(L)&&(y("false write response, pause",_e.awaitDrainWriters.size),_e.awaitDrainWriters.add(L)),be.pause()),It||(It=de(be,L),L.on("drain",It))}be.on("data",pr);function pr(ne){y("ondata");const ie=L.write(ne);y("dest.write",ie),ie===!1&&kr()}function gr(ne){if(y("onerror",ne),P(),L.removeListener("error",gr),L.listenerCount("error")===0){const ie=L._writableState||L._readableState;ie&&!ie.errorEmitted?w(L,ne):L.emit("error",ne)}}x(L,"error",gr);function Pr(){L.removeListener("finish",Ge),P()}L.once("close",Pr);function Ge(){y("onfinish"),L.removeListener("close",Pr),P()}L.once("finish",Ge);function P(){y("unpipe"),be.unpipe(L)}return L.emit("pipe",be),L.writableNeedDrain===!0?kr():_e.flowing||(y("pipe resume"),be.resume()),L};function de(L,M){return function(){const _e=L._readableState;_e.awaitDrainWriters===M?(y("pipeOnDrain",1),_e.awaitDrainWriters=null):_e.multiAwaitDrain&&(y("pipeOnDrain",_e.awaitDrainWriters.size),_e.awaitDrainWriters.delete(M)),(!_e.awaitDrainWriters||_e.awaitDrainWriters.size===0)&&L.listenerCount("data")&&L.resume()}}le.prototype.unpipe=function(L){const M=this._readableState,be={hasUnpiped:!1};if(M.pipes.length===0)return this;if(!L){const ve=M.pipes;M.pipes=[],this.pause();for(let Xe=0;Xe<ve.length;Xe++)ve[Xe].emit("unpipe",this,{hasUnpiped:!1});return this}const _e=e(M.pipes,L);return _e===-1?this:(M.pipes.splice(_e,1),M.pipes.length===0&&this.pause(),L.emit("unpipe",this,be),this)},le.prototype.on=function(L,M){const be=_.prototype.on.call(this,L,M),_e=this._readableState;return L==="data"?(_e.readableListening=this.listenerCount("readable")>0,_e.flowing!==!1&&this.resume()):L==="readable"&&!_e.endEmitted&&!_e.readableListening&&(_e.readableListening=_e.needReadable=!0,_e.flowing=!1,_e.emittedReadable=!1,y("on readable",_e.length,_e.reading),_e.length?p(this):_e.reading||r.nextTick(ke,this)),be},le.prototype.addListener=le.prototype.on,le.prototype.removeListener=function(L,M){const be=_.prototype.removeListener.call(this,L,M);return L==="readable"&&r.nextTick(Ee,this),be},le.prototype.off=le.prototype.removeListener,le.prototype.removeAllListeners=function(L){const M=_.prototype.removeAllListeners.apply(this,arguments);return(L==="readable"||L===void 0)&&r.nextTick(Ee,this),M};function Ee(L){const M=L._readableState;M.readableListening=L.listenerCount("readable")>0,M.resumeScheduled&&M[T]===!1?M.flowing=!0:L.listenerCount("data")>0?L.resume():M.readableListening||(M.flowing=null)}function ke(L){y("readable nexttick read 0"),L.read(0)}le.prototype.resume=function(){const L=this._readableState;return L.flowing||(y("resume"),L.flowing=!L.readableListening,Oe(this,L)),L[T]=!1,this};function Oe(L,M){M.resumeScheduled||(M.resumeScheduled=!0,r.nextTick(Le,L,M))}function Le(L,M){y("resume",M.reading),M.reading||L.read(0),M.resumeScheduled=!1,L.emit("resume"),De(L),M.flowing&&!M.reading&&L.read(0)}le.prototype.pause=function(){return y("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(y("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[T]=!0,this};function De(L){const M=L._readableState;for(y("flow",M.flowing);M.flowing&&L.read()!==null;);}le.prototype.wrap=function(L){let M=!1;L.on("data",_e=>{!this.push(_e)&&L.pause&&(M=!0,L.pause())}),L.on("end",()=>{this.push(null)}),L.on("error",_e=>{w(this,_e)}),L.on("close",()=>{this.destroy()}),L.on("destroy",()=>{this.destroy()}),this._read=()=>{M&&L.resume&&(M=!1,L.resume())};const be=a(L);for(let _e=1;_e<be.length;_e++){const ve=be[_e];this[ve]===void 0&&typeof L[ve]=="function"&&(this[ve]=L[ve].bind(L))}return this},le.prototype[d]=function(){return gt(this)},le.prototype.iterator=function(L){return L!==void 0&&te(L,"options"),gt(this,L)};function gt(L,M){typeof L.read!="function"&&(L=le.wrap(L,{objectMode:!0}));const be=Ft(L,M);return be.stream=L,be}async function*Ft(L,M){let be=Y;function _e(Ye){this===L?(be(),be=Y):be=Ye}L.on("readable",_e);let ve;const Xe=S(L,{writable:!1},Ye=>{ve=Ye?A(ve,Ye):null,be(),be=Y});try{for(;;){const Ye=L.destroyed?null:L.read();if(Ye!==null)yield Ye;else{if(ve)throw ve;if(ve===null)return;await new u(_e)}}}catch(Ye){throw ve=A(ve,Ye),ve}finally{(ve||M?.destroyOnReturn!==!1)&&(ve===void 0||L._readableState.autoDestroy)?g.destroyer(L,null):(L.off("readable",_e),Xe())}}s(le.prototype,{readable:{__proto__:null,get(){const L=this._readableState;return!!L&&L.readable!==!1&&!L.destroyed&&!L.errorEmitted&&!L.endEmitted},set(L){this._readableState&&(this._readableState.readable=!!L)}},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(L){this._readableState&&(this._readableState.flowing=L)}},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(L){this._readableState&&(this._readableState.destroyed=L)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),s(ye.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[T]!==!1},set(L){this[T]=!!L}}}),le._fromList=qe;function qe(L,M){if(M.length===0)return null;let be;return M.objectMode?be=M.buffer.shift():!L||L>=M.length?(M.decoder?be=M.buffer.join(""):M.buffer.length===1?be=M.buffer.first():be=M.buffer.concat(M.length),M.buffer.clear()):be=M.buffer.consume(L,M.decoder),be}function He(L){const M=L._readableState;y("endReadable",M.endEmitted),M.endEmitted||(M.ended=!0,r.nextTick(Rn,M,L))}function Rn(L,M){if(y("endReadableNT",L.endEmitted,L.length),!L.errored&&!L.closeEmitted&&!L.endEmitted&&L.length===0){if(L.endEmitted=!0,M.emit("end"),M.writable&&M.allowHalfOpen===!1)r.nextTick(kt,M);else if(L.autoDestroy){const be=M._writableState;(!be||be.autoDestroy&&(be.finished||be.writable===!1))&&M.destroy()}}}function kt(L){L.writable&&!L.writableEnded&&!L.destroyed&&L.end()}le.from=function(L,M){return k(le,L,M)};let fr;function Fr(){return fr===void 0&&(fr={}),fr}return le.fromWeb=function(L,M){return Fr().newStreamReadableFromReadableStream(L,M)},le.toWeb=function(L,M){return Fr().newReadableStreamFromStreamReadable(L,M)},le.wrap=function(L,M){var be,_e;return new le({objectMode:(be=(_e=L.readableObjectMode)!==null&&_e!==void 0?_e:L.objectMode)!==null&&be!==void 0?be:!0,...M,destroy(ve,Xe){g.destroyer(L,ve),Xe(ve)}}).wrap(L)},ji}var $i,Eo;function ya(){if(Eo)return $i;Eo=1;const r=lr(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:n,ObjectDefineProperty:i,ObjectDefineProperties:s,ObjectSetPrototypeOf:a,StringPrototypeToLowerCase:o,Symbol:u,SymbolHasInstance:l}=Be();$i=te,te.WritableState=D;const{EventEmitter:c}=si(),d=ma().Stream,{Buffer:m}=Lt(),b=Lr(),{addAbortSignal:_}=ai(),{getHighWaterMark:x,getDefaultHighWaterMark:E}=oi(),{ERR_INVALID_ARG_TYPE:v,ERR_METHOD_NOT_IMPLEMENTED:S,ERR_MULTIPLE_CALLBACK:y,ERR_STREAM_CANNOT_PIPE:h,ERR_STREAM_DESTROYED:g,ERR_STREAM_ALREADY_FINISHED:I,ERR_STREAM_NULL_VALUES:C,ERR_STREAM_WRITE_AFTER_END:A,ERR_UNKNOWN_ENCODING:B}=rt().codes,{errorOrDestroy:R}=b;a(te.prototype,d.prototype),a(te,d);function F(){}const q=u("kOnFinished");function D(j,W,se){typeof se!="boolean"&&(se=W instanceof Dt()),this.objectMode=!!(j&&j.objectMode),se&&(this.objectMode=this.objectMode||!!(j&&j.writableObjectMode)),this.highWaterMark=j?x(this,j,"writableHighWaterMark",se):E(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const he=!!(j&&j.decodeStrings===!1);this.decodeStrings=!he,this.defaultEncoding=j&&j.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=w.bind(void 0,W),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,O(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!j||j.emitClose!==!1,this.autoDestroy=!j||j.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[q]=[]}function O(j){j.buffered=[],j.bufferedIndex=0,j.allBuffers=!0,j.allNoop=!0}D.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},i(D.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function te(j){const W=this instanceof Dt();if(!W&&!n(te,this))return new te(j);this._writableState=new D(j,this,W),j&&(typeof j.write=="function"&&(this._write=j.write),typeof j.writev=="function"&&(this._writev=j.writev),typeof j.destroy=="function"&&(this._destroy=j.destroy),typeof j.final=="function"&&(this._final=j.final),typeof j.construct=="function"&&(this._construct=j.construct),j.signal&&_(j.signal,this)),d.call(this,j),b.construct(this,()=>{const se=this._writableState;se.writing||ue(this,se),U(this,se)})}i(te,l,{__proto__:null,value:function(j){return n(this,j)?!0:this!==te?!1:j&&j._writableState instanceof D}}),te.prototype.pipe=function(){R(this,new h)};function T(j,W,se,he){const pe=j._writableState;if(typeof se=="function")he=se,se=pe.defaultEncoding;else{if(!se)se=pe.defaultEncoding;else if(se!=="buffer"&&!m.isEncoding(se))throw new B(se);typeof he!="function"&&(he=F)}if(W===null)throw new C;if(!pe.objectMode)if(typeof W=="string")pe.decodeStrings!==!1&&(W=m.from(W,se),se="buffer");else if(W instanceof m)se="buffer";else if(d._isUint8Array(W))W=d._uint8ArrayToBuffer(W),se="buffer";else throw new v("chunk",["string","Buffer","Uint8Array"],W);let me;return pe.ending?me=new A:pe.destroyed&&(me=new g("write")),me?(r.nextTick(he,me),R(j,me,!0),me):(pe.pendingcb++,Z(j,pe,W,se,he))}te.prototype.write=function(j,W,se){return T(this,j,W,se)===!0},te.prototype.cork=function(){this._writableState.corked++},te.prototype.uncork=function(){const j=this._writableState;j.corked&&(j.corked--,j.writing||ue(this,j))},te.prototype.setDefaultEncoding=function(W){if(typeof W=="string"&&(W=o(W)),!m.isEncoding(W))throw new B(W);return this._writableState.defaultEncoding=W,this};function Z(j,W,se,he,pe){const me=W.objectMode?1:se.length;W.length+=me;const J=W.length<W.highWaterMark;return J||(W.needDrain=!0),W.writing||W.corked||W.errored||!W.constructed?(W.buffered.push({chunk:se,encoding:he,callback:pe}),W.allBuffers&&he!=="buffer"&&(W.allBuffers=!1),W.allNoop&&pe!==F&&(W.allNoop=!1)):(W.writelen=me,W.writecb=pe,W.writing=!0,W.sync=!0,j._write(se,he,W.onwrite),W.sync=!1),J&&!W.errored&&!W.destroyed}function k(j,W,se,he,pe,me,J){W.writelen=he,W.writecb=J,W.writing=!0,W.sync=!0,W.destroyed?W.onwrite(new g("write")):se?j._writev(pe,W.onwrite):j._write(pe,me,W.onwrite),W.sync=!1}function Y(j,W,se,he){--W.pendingcb,he(se),X(W),R(j,se)}function w(j,W){const se=j._writableState,he=se.sync,pe=se.writecb;if(typeof pe!="function"){R(j,new y);return}se.writing=!1,se.writecb=null,se.length-=se.writelen,se.writelen=0,W?(W.stack,se.errored||(se.errored=W),j._readableState&&!j._readableState.errored&&(j._readableState.errored=W),he?r.nextTick(Y,j,se,W,pe):Y(j,se,W,pe)):(se.buffered.length>se.bufferedIndex&&ue(j,se),he?se.afterWriteTickInfo!==null&&se.afterWriteTickInfo.cb===pe?se.afterWriteTickInfo.count++:(se.afterWriteTickInfo={count:1,cb:pe,stream:j,state:se},r.nextTick(H,se.afterWriteTickInfo)):K(j,se,1,pe))}function H({stream:j,state:W,count:se,cb:he}){return W.afterWriteTickInfo=null,K(j,W,se,he)}function K(j,W,se,he){for(!W.ending&&!j.destroyed&&W.length===0&&W.needDrain&&(W.needDrain=!1,j.emit("drain"));se-- >0;)W.pendingcb--,he();W.destroyed&&X(W),U(j,W)}function X(j){if(j.writing)return;for(let pe=j.bufferedIndex;pe<j.buffered.length;++pe){var W;const{chunk:me,callback:J}=j.buffered[pe],ce=j.objectMode?1:me.length;j.length-=ce,J((W=j.errored)!==null&&W!==void 0?W:new g("write"))}const se=j[q].splice(0);for(let pe=0;pe<se.length;pe++){var he;se[pe]((he=j.errored)!==null&&he!==void 0?he:new g("end"))}O(j)}function ue(j,W){if(W.corked||W.bufferProcessing||W.destroyed||!W.constructed)return;const{buffered:se,bufferedIndex:he,objectMode:pe}=W,me=se.length-he;if(!me)return;let J=he;if(W.bufferProcessing=!0,me>1&&j._writev){W.pendingcb-=me-1;const ce=W.allNoop?F:le=>{for(let Ne=J;Ne<se.length;++Ne)se[Ne].callback(le)},ye=W.allNoop&&J===0?se:e(se,J);ye.allBuffers=W.allBuffers,k(j,W,!0,W.length,ye,"",ce),O(W)}else{do{const{chunk:ce,encoding:ye,callback:le}=se[J];se[J++]=null;const Ne=pe?1:ce.length;k(j,W,!1,Ne,ce,ye,le)}while(J<se.length&&!W.writing);J===se.length?O(W):J>256?(se.splice(0,J),W.bufferedIndex=0):W.bufferedIndex=J}W.bufferProcessing=!1}te.prototype._write=function(j,W,se){if(this._writev)this._writev([{chunk:j,encoding:W}],se);else throw new S("_write()")},te.prototype._writev=null,te.prototype.end=function(j,W,se){const he=this._writableState;typeof j=="function"?(se=j,j=null,W=null):typeof W=="function"&&(se=W,W=null);let pe;if(j!=null){const me=T(this,j,W);me instanceof t&&(pe=me)}return he.corked&&(he.corked=1,this.uncork()),pe||(!he.errored&&!he.ending?(he.ending=!0,U(this,he,!0),he.ended=!0):he.finished?pe=new I("end"):he.destroyed&&(pe=new g("end"))),typeof se=="function"&&(pe||he.finished?r.nextTick(se,pe):he[q].push(se)),this};function V(j){return j.ending&&!j.destroyed&&j.constructed&&j.length===0&&!j.errored&&j.buffered.length===0&&!j.finished&&!j.writing&&!j.errorEmitted&&!j.closeEmitted}function G(j,W){let se=!1;function he(pe){if(se){R(j,pe??y());return}if(se=!0,W.pendingcb--,pe){const me=W[q].splice(0);for(let J=0;J<me.length;J++)me[J](pe);R(j,pe,W.sync)}else V(W)&&(W.prefinished=!0,j.emit("prefinish"),W.pendingcb++,r.nextTick(ee,j,W))}W.sync=!0,W.pendingcb++;try{j._final(he)}catch(pe){he(pe)}W.sync=!1}function z(j,W){!W.prefinished&&!W.finalCalled&&(typeof j._final=="function"&&!W.destroyed?(W.finalCalled=!0,G(j,W)):(W.prefinished=!0,j.emit("prefinish")))}function U(j,W,se){V(W)&&(z(j,W),W.pendingcb===0&&(se?(W.pendingcb++,r.nextTick((he,pe)=>{V(pe)?ee(he,pe):pe.pendingcb--},j,W)):V(W)&&(W.pendingcb++,ee(j,W))))}function ee(j,W){W.pendingcb--,W.finished=!0;const se=W[q].splice(0);for(let he=0;he<se.length;he++)se[he]();if(j.emit("finish"),W.autoDestroy){const he=j._readableState;(!he||he.autoDestroy&&(he.endEmitted||he.readable===!1))&&j.destroy()}}s(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(j){this._writableState&&(this._writableState.destroyed=j)}},writable:{__proto__:null,get(){const j=this._writableState;return!!j&&j.writable!==!1&&!j.destroyed&&!j.errored&&!j.ending&&!j.ended},set(j){this._writableState&&(this._writableState.writable=!!j)}},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 j=this._writableState;return j?!j.destroyed&&!j.ending&&j.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=b.destroy;te.prototype.destroy=function(j,W){const se=this._writableState;return!se.destroyed&&(se.bufferedIndex<se.buffered.length||se[q].length)&&r.nextTick(X,se),re.call(this,j,W),this},te.prototype._undestroy=b.undestroy,te.prototype._destroy=function(j,W){W(j)},te.prototype[c.captureRejectionSymbol]=function(j){this.destroy(j)};let fe;function ge(){return fe===void 0&&(fe={}),fe}return te.fromWeb=function(j,W){return ge().newStreamWritableFromWritableStream(j,W)},te.toWeb=function(j){return ge().newWritableStreamFromStreamWritable(j)},$i}var Fi,So;function Id(){if(So)return Fi;So=1;const r=lr(),e=Lt(),{isReadable:t,isWritable:n,isIterable:i,isNodeStream:s,isReadableNodeStream:a,isWritableNodeStream:o,isDuplexNodeStream:u,isReadableStream:l,isWritableStream:c}=Ct(),d=Vt(),{AbortError:m,codes:{ERR_INVALID_ARG_TYPE:b,ERR_INVALID_RETURN_VALUE:_}}=rt(),{destroyer:x}=Lr(),E=Dt(),v=li(),S=ya(),{createDeferredPromise:y}=st(),h=ec(),g=globalThis.Blob||e.Blob,I=typeof g<"u"?function(D){return D instanceof g}:function(D){return!1},C=globalThis.AbortController||bn().AbortController,{FunctionPrototypeCall:A}=Be();class B extends E{constructor(D){super(D),D?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),D?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}Fi=function q(D,O){if(u(D))return D;if(a(D))return F({readable:D});if(o(D))return F({writable:D});if(s(D))return F({writable:!1,readable:!1});if(l(D))return F({readable:v.fromWeb(D)});if(c(D))return F({writable:S.fromWeb(D)});if(typeof D=="function"){const{value:T,write:Z,final:k,destroy:Y}=R(D);if(i(T))return h(B,T,{objectMode:!0,write:Z,final:k,destroy:Y});const w=T?.then;if(typeof w=="function"){let H;const K=A(w,T,X=>{if(X!=null)throw new _("nully","body",X)},X=>{x(H,X)});return H=new B({objectMode:!0,readable:!1,write:Z,final(X){k(async()=>{try{await K,r.nextTick(X,null)}catch(ue){r.nextTick(X,ue)}})},destroy:Y})}throw new _("Iterable, AsyncIterable or AsyncFunction",O,T)}if(I(D))return q(D.arrayBuffer());if(i(D))return h(B,D,{objectMode:!0,writable:!1});if(l(D?.readable)&&c(D?.writable))return B.fromWeb(D);if(typeof D?.writable=="object"||typeof D?.readable=="object"){const T=D!=null&&D.readable?a(D?.readable)?D?.readable:q(D.readable):void 0,Z=D!=null&&D.writable?o(D?.writable)?D?.writable:q(D.writable):void 0;return F({readable:T,writable:Z})}const te=D?.then;if(typeof te=="function"){let T;return A(te,D,Z=>{Z!=null&&T.push(Z),T.push(null)},Z=>{x(T,Z)}),T=new B({objectMode:!0,writable:!1,read(){}})}throw new b(O,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],D)};function R(q){let{promise:D,resolve:O}=y();const te=new C,T=te.signal;return{value:q(async function*(){for(;;){const k=D;D=null;const{chunk:Y,done:w,cb:H}=await k;if(r.nextTick(H),w)return;if(T.aborted)throw new m(void 0,{cause:T.reason});({promise:D,resolve:O}=y()),yield Y}}(),{signal:T}),write(k,Y,w){const H=O;O=null,H({chunk:k,done:!1,cb:w})},final(k){const Y=O;O=null,Y({done:!0,cb:k})},destroy(k,Y){te.abort(),Y(k)}}}function F(q){const D=q.readable&&typeof q.readable.read!="function"?v.wrap(q.readable):q.readable,O=q.writable;let te=!!t(D),T=!!n(O),Z,k,Y,w,H;function K(X){const ue=w;w=null,ue?ue(X):X&&H.destroy(X)}return H=new B({readableObjectMode:!!(D!=null&&D.readableObjectMode),writableObjectMode:!!(O!=null&&O.writableObjectMode),readable:te,writable:T}),T&&(d(O,X=>{T=!1,X&&x(D,X),K(X)}),H._write=function(X,ue,V){O.write(X,ue)?V():Z=V},H._final=function(X){O.end(),k=X},O.on("drain",function(){if(Z){const X=Z;Z=null,X()}}),O.on("finish",function(){if(k){const X=k;k=null,X()}})),te&&(d(D,X=>{te=!1,X&&x(D,X),K(X)}),D.on("readable",function(){if(Y){const X=Y;Y=null,X()}}),D.on("end",function(){H.push(null)}),H._read=function(){for(;;){const X=D.read();if(X===null){Y=H._read;return}if(!H.push(X))return}}),H._destroy=function(X,ue){!X&&w!==null&&(X=new m),Y=null,Z=null,k=null,w===null?ue(X):(w=ue,x(O,X),x(D,X))},H}return Fi}var ki,No;function Dt(){if(No)return ki;No=1;const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:n}=Be();ki=a;const i=li(),s=ya();n(a.prototype,i.prototype),n(a,i);{const c=t(s.prototype);for(let d=0;d<c.length;d++){const m=c[d];a.prototype[m]||(a.prototype[m]=s.prototype[m])}}function a(c){if(!(this instanceof a))return new a(c);i.call(this,c),s.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(s.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(s.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(s.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(s.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(s.prototype,"writableLength")},writableFinished:{__proto__:null,...e(s.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(s.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(s.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(s.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 o;function u(){return o===void 0&&(o={}),o}a.fromWeb=function(c,d){return u().newStreamDuplexFromReadableWritablePair(c,d)},a.toWeb=function(c){return u().newReadableWritablePairFromDuplex(c)};let l;return a.from=function(c){return l||(l=Id()),l(c,"body")},ki}var Pi,Io;function tc(){if(Io)return Pi;Io=1;const{ObjectSetPrototypeOf:r,Symbol:e}=Be();Pi=a;const{ERR_METHOD_NOT_IMPLEMENTED:t}=rt().codes,n=Dt(),{getHighWaterMark:i}=oi();r(a.prototype,n.prototype),r(a,n);const s=e("kCallback");function a(l){if(!(this instanceof a))return new a(l);const c=l?i(this,l,"readableHighWaterMark",!0):null;c===0&&(l={...l,highWaterMark:null,readableHighWaterMark:c,writableHighWaterMark:l.writableHighWaterMark||0}),n.call(this,l),this._readableState.sync=!1,this[s]=null,l&&(typeof l.transform=="function"&&(this._transform=l.transform),typeof l.flush=="function"&&(this._flush=l.flush)),this.on("prefinish",u)}function o(l){typeof this._flush=="function"&&!this.destroyed?this._flush((c,d)=>{if(c){l?l(c):this.destroy(c);return}d!=null&&this.push(d),this.push(null),l&&l()}):(this.push(null),l&&l())}function u(){this._final!==o&&o.call(this)}return a.prototype._final=o,a.prototype._transform=function(l,c,d){throw new t("_transform()")},a.prototype._write=function(l,c,d){const m=this._readableState,b=this._writableState,_=m.length;this._transform(l,c,(x,E)=>{if(x){d(x);return}E!=null&&this.push(E),b.ended||_===m.length||m.length<m.highWaterMark?d():this[s]=d})},a.prototype._read=function(){if(this[s]){const l=this[s];this[s]=null,l()}},Pi}var Mi,Ro;function rc(){if(Ro)return Mi;Ro=1;const{ObjectSetPrototypeOf:r}=Be();Mi=t;const e=tc();r(t.prototype,e.prototype),r(t,e);function t(n){if(!(this instanceof t))return new t(n);e.call(this,n)}return t.prototype._transform=function(n,i,s){s(null,n)},Mi}var Bi,To;function ba(){if(To)return Bi;To=1;const r=lr(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:n,SymbolDispose:i}=Be(),s=Vt(),{once:a}=st(),o=Lr(),u=Dt(),{aggregateTwoErrors:l,codes:{ERR_INVALID_ARG_TYPE:c,ERR_INVALID_RETURN_VALUE:d,ERR_MISSING_ARGS:m,ERR_STREAM_DESTROYED:b,ERR_STREAM_PREMATURE_CLOSE:_},AbortError:x}=rt(),{validateFunction:E,validateAbortSignal:v}=En(),{isIterable:S,isReadable:y,isReadableNodeStream:h,isNodeStream:g,isTransformStream:I,isWebStream:C,isReadableStream:A,isReadableFinished:B}=Ct(),R=globalThis.AbortController||bn().AbortController;let F,q,D;function O(X,ue,V){let G=!1;X.on("close",()=>{G=!0});const z=s(X,{readable:ue,writable:V},U=>{G=!U});return{destroy:U=>{G||(G=!0,o.destroyer(X,U||new b("pipe")))},cleanup:z}}function te(X){return E(X[X.length-1],"streams[stream.length - 1]"),X.pop()}function T(X){if(S(X))return X;if(h(X))return Z(X);throw new c("val",["Readable","Iterable","AsyncIterable"],X)}async function*Z(X){q||(q=li()),yield*q.prototype[n].call(X)}async function k(X,ue,V,{end:G}){let z,U=null;const ee=ge=>{if(ge&&(z=ge),U){const j=U;U=null,j()}},re=()=>new t((ge,j)=>{z?j(z):U=()=>{z?j(z):ge()}});ue.on("drain",ee);const fe=s(ue,{readable:!1},ee);try{ue.writableNeedDrain&&await re();for await(const ge of X)ue.write(ge)||await re();G&&(ue.end(),await re()),V()}catch(ge){V(z!==ge?l(z,ge):ge)}finally{fe(),ue.off("drain",ee)}}async function Y(X,ue,V,{end:G}){I(ue)&&(ue=ue.writable);const z=ue.getWriter();try{for await(const U of X)await z.ready,z.write(U).catch(()=>{});await z.ready,G&&await z.close(),V()}catch(U){try{await z.abort(U),V(U)}catch(ee){V(ee)}}}function w(...X){return H(X,a(te(X)))}function H(X,ue,V){if(X.length===1&&e(X[0])&&(X=X[0]),X.length<2)throw new m("streams");const G=new R,z=G.signal,U=V?.signal,ee=[];v(U,"options.signal");function re(){pe(new x)}D=D||st().addAbortListener;let fe;U&&(fe=D(U,re));let ge,j;const W=[];let se=0;function he(ye){pe(ye,--se===0)}function pe(ye,le){var Ne;if(ye&&(!ge||ge.code==="ERR_STREAM_PREMATURE_CLOSE")&&(ge=ye),!(!ge&&!le)){for(;W.length;)W.shift()(ge);(Ne=fe)===null||Ne===void 0||Ne[i](),G.abort(),le&&(ge||ee.forEach(ze=>ze()),r.nextTick(ue,ge,j))}}let me;for(let ye=0;ye<X.length;ye++){const le=X[ye],Ne=ye<X.length-1,ze=ye>0,Se=Ne||V?.end!==!1,Qe=ye===X.length-1;if(g(le)){let N=function(f){f&&f.name!=="AbortError"&&f.code!=="ERR_STREAM_PREMATURE_CLOSE"&&he(f)};if(Se){const{destroy:f,cleanup:p}=O(le,Ne,ze);W.push(f),y(le)&&Qe&&ee.push(p)}le.on("error",N),y(le)&&Qe&&ee.push(()=>{le.removeListener("error",N)})}if(ye===0)if(typeof le=="function"){if(me=le({signal:z}),!S(me))throw new d("Iterable, AsyncIterable or Stream","source",me)}else S(le)||h(le)||I(le)?me=le:me=u.from(le);else if(typeof le=="function"){if(I(me)){var J;me=T((J=me)===null||J===void 0?void 0:J.readable)}else me=T(me);if(me=le(me,{signal:z}),Ne){if(!S(me,!0))throw new d("AsyncIterable",`transform[${ye-1}]`,me)}else{var ce;F||(F=rc());const N=new F({objectMode:!0}),f=(ce=me)===null||ce===void 0?void 0:ce.then;if(typeof f=="function")se++,f.call(me,Q=>{j=Q,Q!=null&&N.write(Q),Se&&N.end(),r.nextTick(he)},Q=>{N.destroy(Q),r.nextTick(he,Q)});else if(S(me,!0))se++,k(me,N,he,{end:Se});else if(A(me)||I(me)){const Q=me.readable||me;se++,k(Q,N,he,{end:Se})}else throw new d("AsyncIterable or Promise","destination",me);me=N;const{destroy:p,cleanup:$}=O(me,!1,!0);W.push(p),Qe&&ee.push($)}}else if(g(le)){if(h(me)){se+=2;const N=K(me,le,he,{end:Se});y(le)&&Qe&&ee.push(N)}else if(I(me)||A(me)){const N=me.readable||me;se++,k(N,le,he,{end:Se})}else if(S(me))se++,k(me,le,he,{end:Se});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else if(C(le)){if(h(me))se++,Y(T(me),le,he,{end:Se});else if(A(me)||S(me))se++,Y(me,le,he,{end:Se});else if(I(me))se++,Y(me.readable,le,he,{end:Se});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else me=u.from(le)}return(z!=null&&z.aborted||U!=null&&U.aborted)&&r.nextTick(re),me}function K(X,ue,V,{end:G}){let z=!1;if(ue.on("close",()=>{z||V(new _)}),X.pipe(ue,{end:!1}),G){let U=function(){z=!0,ue.end()};B(X)?r.nextTick(U):X.once("end",U)}else V();return s(X,{readable:!0,writable:!1},U=>{const ee=X._readableState;U&&U.code==="ERR_STREAM_PREMATURE_CLOSE"&&ee&&ee.ended&&!ee.errored&&!ee.errorEmitted?X.once("end",V).once("error",V):V(U)}),s(ue,{readable:!1,writable:!0},V)}return Bi={pipelineImpl:H,pipeline:w},Bi}var qi,Ao;function nc(){if(Ao)return qi;Ao=1;const{pipeline:r}=ba(),e=Dt(),{destroyer:t}=Lr(),{isNodeStream:n,isReadable:i,isWritable:s,isWebStream:a,isTransformStream:o,isWritableStream:u,isReadableStream:l}=Ct(),{AbortError:c,codes:{ERR_INVALID_ARG_VALUE:d,ERR_MISSING_ARGS:m}}=rt(),b=Vt();return qi=function(...x){if(x.length===0)throw new m("streams");if(x.length===1)return e.from(x[0]);const E=[...x];if(typeof x[0]=="function"&&(x[0]=e.from(x[0])),typeof x[x.length-1]=="function"){const F=x.length-1;x[F]=e.from(x[F])}for(let F=0;F<x.length;++F)if(!(!n(x[F])&&!a(x[F]))){if(F<x.length-1&&!(i(x[F])||l(x[F])||o(x[F])))throw new d(`streams[${F}]`,E[F],"must be readable");if(F>0&&!(s(x[F])||u(x[F])||o(x[F])))throw new d(`streams[${F}]`,E[F],"must be writable")}let v,S,y,h,g;function I(F){const q=h;h=null,q?q(F):F?g.destroy(F):!R&&!B&&g.destroy()}const C=x[0],A=r(x,I),B=!!(s(C)||u(C)||o(C)),R=!!(i(A)||l(A)||o(A));if(g=new e({writableObjectMode:!!(C!=null&&C.writableObjectMode),readableObjectMode:!!(A!=null&&A.readableObjectMode),writable:B,readable:R}),B){if(n(C))g._write=function(q,D,O){C.write(q,D)?O():v=O},g._final=function(q){C.end(),S=q},C.on("drain",function(){if(v){const q=v;v=null,q()}});else if(a(C)){const D=(o(C)?C.writable:C).getWriter();g._write=async function(O,te,T){try{await D.ready,D.write(O).catch(()=>{}),T()}catch(Z){T(Z)}},g._final=async function(O){try{await D.ready,D.close().catch(()=>{}),S=O}catch(te){O(te)}}}const F=o(A)?A.readable:A;b(F,()=>{if(S){const q=S;S=null,q()}})}if(R){if(n(A))A.on("readable",function(){if(y){const F=y;y=null,F()}}),A.on("end",function(){g.push(null)}),g._read=function(){for(;;){const F=A.read();if(F===null){y=g._read;return}if(!g.push(F))return}};else if(a(A)){const q=(o(A)?A.readable:A).getReader();g._read=async function(){for(;;)try{const{value:D,done:O}=await q.read();if(!g.push(D))return;if(O){g.push(null);return}}catch{return}}}}return g._destroy=function(F,q){!F&&h!==null&&(F=new c),y=null,v=null,S=null,h===null?q(F):(h=q,n(A)&&t(A,F))},g},qi}var Do;function Rd(){if(Do)return $n;Do=1;const r=globalThis.AbortController||bn().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:n,ERR_OUT_OF_RANGE:i},AbortError:s}=rt(),{validateAbortSignal:a,validateInteger:o,validateObject:u}=En(),l=Be().Symbol("kWeak"),c=Be().Symbol("kResistStopPropagation"),{finished:d}=Vt(),m=nc(),{addAbortSignalNoValidate:b}=ai(),{isWritable:_,isNodeStream:x}=Ct(),{deprecate:E}=st(),{ArrayPrototypePush:v,Boolean:S,MathFloor:y,Number:h,NumberIsNaN:g,Promise:I,PromiseReject:C,PromiseResolve:A,PromisePrototypeThen:B,Symbol:R}=Be(),F=R("kEmpty"),q=R("kEof");function D(U,ee){if(ee!=null&&u(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),x(U)&&!_(U))throw new e("stream",U,"must be writable");const re=m(this,U);return ee!=null&&ee.signal&&b(ee.signal,re),re}function O(U,ee){if(typeof U!="function")throw new t("fn",["Function","AsyncFunction"],U);ee!=null&&u(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal");let re=1;ee?.concurrency!=null&&(re=y(ee.concurrency));let fe=re-1;return ee?.highWaterMark!=null&&(fe=y(ee.highWaterMark)),o(re,"options.concurrency",1),o(fe,"options.highWaterMark",0),fe+=re,(async function*(){const j=st().AbortSignalAny([ee?.signal].filter(S)),W=this,se=[],he={signal:j};let pe,me,J=!1,ce=0;function ye(){J=!0,le()}function le(){ce-=1,Ne()}function Ne(){me&&!J&&ce<re&&se.length<fe&&(me(),me=null)}async function ze(){try{for await(let Se of W){if(J)return;if(j.aborted)throw new s;try{if(Se=U(Se,he),Se===F)continue;Se=A(Se)}catch(Qe){Se=C(Qe)}ce+=1,B(Se,le,ye),se.push(Se),pe&&(pe(),pe=null),!J&&(se.length>=fe||ce>=re)&&await new I(Qe=>{me=Qe})}se.push(q)}catch(Se){const Qe=C(Se);B(Qe,le,ye),se.push(Qe)}finally{J=!0,pe&&(pe(),pe=null)}}ze();try{for(;;){for(;se.length>0;){const Se=await se[0];if(Se===q)return;if(j.aborted)throw new s;Se!==F&&(yield Se),se.shift(),Ne()}await new I(Se=>{pe=Se})}}finally{J=!0,me&&(me(),me=null)}}).call(this)}function te(U=void 0){return U!=null&&u(U,"options"),U?.signal!=null&&a(U.signal,"options.signal"),(async function*(){let re=0;for await(const ge of this){var fe;if(U!=null&&(fe=U.signal)!==null&&fe!==void 0&&fe.aborted)throw new s({cause:U.signal.reason});yield[re++,ge]}}).call(this)}async function T(U,ee=void 0){for await(const re of w.call(this,U,ee))return!0;return!1}async function Z(U,ee=void 0){if(typeof U!="function")throw new t("fn",["Function","AsyncFunction"],U);return!await T.call(this,async(...re)=>!await U(...re),ee)}async function k(U,ee){for await(const re of w.call(this,U,ee))return re}async function Y(U,ee){if(typeof U!="function")throw new t("fn",["Function","AsyncFunction"],U);async function re(fe,ge){return await U(fe,ge),F}for await(const fe of O.call(this,re,ee));}function w(U,ee){if(typeof U!="function")throw new t("fn",["Function","AsyncFunction"],U);async function re(fe,ge){return await U(fe,ge)?fe:F}return O.call(this,re,ee)}class H extends n{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function K(U,ee,re){var fe;if(typeof U!="function")throw new t("reducer",["Function","AsyncFunction"],U);re!=null&&u(re,"options"),re?.signal!=null&&a(re.signal,"options.signal");let ge=arguments.length>1;if(re!=null&&(fe=re.signal)!==null&&fe!==void 0&&fe.aborted){const pe=new s(void 0,{cause:re.signal.reason});throw this.once("error",()=>{}),await d(this.destroy(pe)),pe}const j=new r,W=j.signal;if(re!=null&&re.signal){const pe={once:!0,[l]:this,[c]:!0};re.signal.addEventListener("abort",()=>j.abort(),pe)}let se=!1;try{for await(const pe of this){var he;if(se=!0,re!=null&&(he=re.signal)!==null&&he!==void 0&&he.aborted)throw new s;ge?ee=await U(ee,pe,{signal:W}):(ee=pe,ge=!0)}if(!se&&!ge)throw new H}finally{j.abort()}return ee}async function X(U){U!=null&&u(U,"options"),U?.signal!=null&&a(U.signal,"options.signal");const ee=[];for await(const fe of this){var re;if(U!=null&&(re=U.signal)!==null&&re!==void 0&&re.aborted)throw new s(void 0,{cause:U.signal.reason});v(ee,fe)}return ee}function ue(U,ee){const re=O.call(this,U,ee);return(async function*(){for await(const ge of re)yield*ge}).call(this)}function V(U){if(U=h(U),g(U))return 0;if(U<0)throw new i("number",">= 0",U);return U}function G(U,ee=void 0){return ee!=null&&u(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),U=V(U),(async function*(){var fe;if(ee!=null&&(fe=ee.signal)!==null&&fe!==void 0&&fe.aborted)throw new s;for await(const j of this){var ge;if(ee!=null&&(ge=ee.signal)!==null&&ge!==void 0&&ge.aborted)throw new s;U--<=0&&(yield j)}}).call(this)}function z(U,ee=void 0){return ee!=null&&u(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),U=V(U),(async function*(){var fe;if(ee!=null&&(fe=ee.signal)!==null&&fe!==void 0&&fe.aborted)throw new s;for await(const j of this){var ge;if(ee!=null&&(ge=ee.signal)!==null&&ge!==void 0&&ge.aborted)throw new s;if(U-- >0&&(yield j),U<=0)return}}).call(this)}return $n.streamReturningOperators={asIndexedPairs:E(te,"readable.asIndexedPairs will be removed in a future version."),drop:G,filter:w,flatMap:ue,map:O,take:z,compose:D},$n.promiseReturningOperators={every:Z,forEach:Y,reduce:K,toArray:X,some:T,find:k},$n}var Ui,Oo;function ic(){if(Oo)return Ui;Oo=1;const{ArrayPrototypePop:r,Promise:e}=Be(),{isIterable:t,isNodeStream:n,isWebStream:i}=Ct(),{pipelineImpl:s}=ba(),{finished:a}=Vt();sc();function o(...u){return new e((l,c)=>{let d,m;const b=u[u.length-1];if(b&&typeof b=="object"&&!n(b)&&!t(b)&&!i(b)){const _=r(u);d=_.signal,m=_.end}s(u,(_,x)=>{_?c(_):l(x)},{signal:d,end:m})})}return Ui={finished:a,pipeline:o},Ui}var Lo;function sc(){if(Lo)return _i.exports;Lo=1;const{Buffer:r}=Lt(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:n}=Be(),{promisify:{custom:i}}=st(),{streamReturningOperators:s,promiseReturningOperators:a}=Rd(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:o}}=rt(),u=nc(),{setDefaultHighWaterMark:l,getDefaultHighWaterMark:c}=oi(),{pipeline:d}=ba(),{destroyer:m}=Lr(),b=Vt(),_=ic(),x=Ct(),E=_i.exports=ma().Stream;E.isDestroyed=x.isDestroyed,E.isDisturbed=x.isDisturbed,E.isErrored=x.isErrored,E.isReadable=x.isReadable,E.isWritable=x.isWritable,E.Readable=li();for(const S of t(s)){let h=function(...g){if(new.target)throw o();return E.Readable.from(n(y,this,g))};const y=s[S];e(h,"name",{__proto__:null,value:y.name}),e(h,"length",{__proto__:null,value:y.length}),e(E.Readable.prototype,S,{__proto__:null,value:h,enumerable:!1,configurable:!0,writable:!0})}for(const S of t(a)){let h=function(...g){if(new.target)throw o();return n(y,this,g)};const y=a[S];e(h,"name",{__proto__:null,value:y.name}),e(h,"length",{__proto__:null,value:y.length}),e(E.Readable.prototype,S,{__proto__:null,value:h,enumerable:!1,configurable:!0,writable:!0})}E.Writable=ya(),E.Duplex=Dt(),E.Transform=tc(),E.PassThrough=rc(),E.pipeline=d;const{addAbortSignal:v}=ai();return E.addAbortSignal=v,E.finished=b,E.destroy=m,E.compose=u,E.setDefaultHighWaterMark=l,E.getDefaultHighWaterMark=c,e(E,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return _}}),e(d,i,{__proto__:null,enumerable:!0,get(){return _.pipeline}}),e(b,i,{__proto__:null,enumerable:!0,get(){return _.finished}}),E.Stream=E,E._isUint8Array=function(y){return y instanceof Uint8Array},E._uint8ArrayToBuffer=function(y){return r.from(y.buffer,y.byteOffset,y.byteLength)},_i.exports}var Co;function ac(){return Co||(Co=1,function(r){const e=sc(),t=ic(),n=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=n,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}(bi)),bi.exports}var oc=ac();const Hi=Symbol("iter");function fn(r,e,t=4){if(t===0)return Object.assign(r,e);for(const n in e)r[n]=fn(r[n]||Object.create(null),e[n],t-1);return r}function lc(r,e,t=4){let n=!1;for(const i in r)if(i in e){const s=t===0?null:lc(r[i],e[i],t-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(t===3)return!1}return n}function uc(r,e,t=4){let n=!1;for(const i in r)if(!(i in e))n=n||Object.create(null),n[i]=t===0?null:fn({},r[i],t-1);else if(t!==0){const s=uc(r[i],e[i],t-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(t===3)return!1}return n}class Td{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,n=e.split(".");return this._factory.quad(this._termFromId(t[n[1]]),this._termFromId(t[n[2]]),this._termFromId(t[n[3]]),n[4]&&this._termFromId(t[n[4]]))}return un(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){const t=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),i=this._termToNumericId(e.object);let s;return t&&n&&i&&(ra(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${t}.${n}.${i}.${s}`:`.${t}.${n}.${i}`]}return this._ids[Er(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${ra(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Er(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,n;if(e)for(t=e=`_:${e}`,n=1;this._ids[t];)t=e+n++;else do t=`_:b${this._blankNodeIndex++}`;while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}}class 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 Td({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 n,i;for(const s in t)for(const a in n=t[s].subjects)for(const o in i=n[a])e+=Object.keys(i[o]).length;return this._size=e}_addToIndex(e,t,n,i){const s=e[t]||(e[t]={}),a=s[n]||(s[n]={}),o=i in a;return o||(a[i]=null),!o}_removeFromIndex(e,t,n,i){const s=e[t],a=s[n];delete a[i];for(const o in a)return;delete s[n];for(const o in s)return;delete e[t]}*_findInIndex(e,t,n,i,s,a,o,u){let l,c,d;const m=this._entities,b=this._termFromId(m[u]),_={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const x in e)if(c=e[x]){_[s]=this._termFromId(m[x]),n&&((l=c,c={})[n]=l[n]);for(const E in c)if(d=c[E]){_[a]=this._termFromId(m[E]);const v=i?i in d?[i]:[]:Object.keys(d);for(let S=0;S<v.length;S++)_[o]=this._termFromId(m[v[S]]),yield this._factory.quad(_.subject,_.predicate,_.object,b)}}}_loop(e,t){for(const n in e)t(n)}_loopByKey0(e,t,n){let i,s;if(i=e[t])for(s in i)n(s)}_loopByKey1(e,t,n){let i,s;for(i in e)s=e[i],s[t]&&n(i)}_loopBy2Keys(e,t,n,i){let s,a,o;if((s=e[t])&&(a=s[n]))for(o in a)i(o)}_countInIndex(e,t,n,i){let s=0,a,o,u;t&&((a=e,e={})[t]=a[t]);for(const l in e)if(o=e[l]){n&&((a=o,o={})[n]=a[n]);for(const c in o)(u=o[c])&&(i?i in u&&s++:s+=Object.keys(u).length)}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){const t=Object.create(null);return n=>{n in t||(t[n]=!0,e(this._termFromId(this._entities[n],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,n,i){t||(i=e.graph,n=e.object,t=e.predicate,e=e.subject),i=i?this._termToNewNumericId(i):1;let s=this._graphs[i];return s||(s=this._graphs[i]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),n=this._termToNewNumericId(n),this._addToIndex(s.subjects,e,t,n)?(this._addToIndex(s.predicates,t,n,e),this._addToIndex(s.objects,n,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,n,i){return e&&e.subject&&({subject:e,predicate:t,object:n,graph:i}=e),!this.readQuads(e,t,n,i).next().done}import(e){return e.on("data",t=>{this.addQuad(t)}),e}removeQuad(e,t,n,i){t||({subject:e,predicate:t,object:n,graph:i}=e),i=i?this._termToNumericId(i):1;const s=this._graphs;let a,o,u;if(!(e=e&&this._termToNumericId(e))||!(t=t&&this._termToNumericId(t))||!(n=n&&this._termToNumericId(n))||!(a=s[i])||!(o=a.subjects[e])||!(u=o[t])||!(n in u))return!1;this._removeFromIndex(a.subjects,e,t,n),this._removeFromIndex(a.predicates,t,n,e),this._removeFromIndex(a.objects,n,e,t),this._size!==null&&this._size--;for(e in a.subjects)return!0;return delete s[i],!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,n,i){const s=new oc.Readable({objectMode:!0}),a=this.readQuads(e,t,n,i);return s._read=o=>{for(;--o>=0;){const{done:u,value:l}=a.next();if(u){s.push(null);return}s.push(l)}},this.remove(s)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,n,i){return[...this.readQuads(e,t,n,i)]}*readQuads(e,t,n,i){const s=this._getGraphs(i);let a,o,u,l;if(!(e&&!(o=this._termToNumericId(e))||t&&!(u=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n))))for(const c in s)(a=s[c])&&(o?l?yield*this._findInIndex(a.objects,l,o,u,"object","subject","predicate",c):yield*this._findInIndex(a.subjects,o,u,null,"subject","predicate","object",c):u?yield*this._findInIndex(a.predicates,u,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,n,i){return new Mt(this,e,t,n,i,{entityIndex:this._entityIndex})}countQuads(e,t,n,i){const s=this._getGraphs(i);let a=0,o,u,l,c;if(e&&!(u=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||n&&!(c=this._termToNumericId(n)))return 0;for(const d in s)(o=s[d])&&(e?n?a+=this._countInIndex(o.objects,c,u,l):a+=this._countInIndex(o.subjects,u,l,c):t?a+=this._countInIndex(o.predicates,l,c,u):a+=this._countInIndex(o.objects,c,u,l));return a}forEach(e,t,n,i,s){this.some(a=>(e(a,this),!1),t,n,i,s)}every(e,t,n,i,s){return!this.some(a=>!e(a,this),t,n,i,s)}some(e,t,n,i,s){for(const a of this.readQuads(t,n,i,s))if(e(a,this))return!0;return!1}getSubjects(e,t,n){const i=[];return this.forSubjects(s=>{i.push(s)},e,t,n),i}forSubjects(e,t,n,i){const s=this._getGraphs(i);let a,o,u;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(u=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?u?this._loopBy2Keys(a.predicates,o,u,e):this._loopByKey1(a.subjects,o,e):u?this._loopByKey0(a.objects,u,e):this._loop(a.subjects,e))}getPredicates(e,t,n){const i=[];return this.forPredicates(s=>{i.push(s)},e,t,n),i}forPredicates(e,t,n,i){const s=this._getGraphs(i);let a,o,u;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(u=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?u?this._loopBy2Keys(a.objects,u,o,e):this._loopByKey0(a.subjects,o,e):u?this._loopByKey1(a.predicates,u,e):this._loop(a.predicates,e))}getObjects(e,t,n){const i=[];return this.forObjects(s=>{i.push(s)},e,t,n),i}forObjects(e,t,n,i){const s=this._getGraphs(i);let a,o,u;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(u=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?u?this._loopBy2Keys(a.subjects,o,u,e):this._loopByKey1(a.objects,o,e):u?this._loopByKey0(a.predicates,u,e):this._loop(a.objects,e))}getGraphs(e,t,n){const i=[];return this.forGraphs(s=>{i.push(s)},e,t,n),i}forGraphs(e,t,n,i){for(const s in this._graphs)this.some(a=>(e(a.graph),!0),t,n,i,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const n={},i=t?()=>!0:(o,u)=>{throw new Error(`${o.value} ${u}`)},s=this.getQuads(null,Ke.rdf.rest,Ke.rdf.nil,null),a=e?[...s]:[];return s.forEach(o=>{const u=[];let l=!1,c,d;const m=o.graph;let b=o.subject;for(;b&&!l;){const _=this.getQuads(null,null,b,null),x=this.getQuads(b,null,null,null);let E,v=null,S=null,y=null;for(let h=0;h<x.length&&!l;h++)E=x[h],E.graph.equals(m)?c?l=i(b,"has non-list arcs out"):E.predicate.value===Ke.rdf.first?v?l=i(b,"has multiple rdf:first arcs"):a.push(v=E):E.predicate.value===Ke.rdf.rest?S?l=i(b,"has multiple rdf:rest arcs"):a.push(S=E):_.length?l=i(b,"can't be subject and object"):(c=E,d="subject"):l=i(b,"not confined to single graph");for(let h=0;h<_.length&&!l;++h)E=_[h],c?l=i(b,"can't have coreferences"):E.predicate.value===Ke.rdf.rest?y?l=i(b,"has incoming rdf:rest arcs"):y=E:(c=E,d="object");v?u.unshift(v.object):l=i(b,"has no list head"),b=y&&y.subject}l?e=!1:c&&(n[c[d].value]=u)}),e&&this.removeQuads(a),n}addAll(e){if(e instanceof Mt&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof et&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=fn(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof Mt&&(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,n=e._graphs;let i,s,a,o,u;for(const l in n){if(!(i=t[l]))return!1;i=i.subjects;for(const c in s=n[l].subjects){if(!(a=i[c]))return!1;for(const d in o=s[c]){if(!(u=a[d]))return!1;for(const m in o[d])if(!(m in u))return!1}}}return!0}deleteMatches(e,t,n,i){for(const s of this.match(e,t,n,i))this.removeQuad(s);return this}difference(e){if(e&&e instanceof Mt&&(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}),n=uc(this._graphs,e._graphs);return n&&(t._graphs=n,t._size=null),t}return this.filter(t=>!e.has(t))}equals(e){return e instanceof Mt&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new et({entityIndex:this._entityIndex});for(const n of this)e(n,this)&&t.add(n);return t}intersection(e){if(e instanceof Mt&&(e=e.filtered),e===this){const t=new et({entityIndex:this._entityIndex});return t._graphs=fn(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}),n=lc(e._graphs,this._graphs);return n&&(t._graphs=n,t._size=null),t}return this.filter(t=>e.has(t))}map(e){const t=new et({entityIndex:this._entityIndex});for(const n of this)t.add(e(n,this));return t}reduce(e,t){const n=this.readQuads();let i=t===void 0?n.next().value:t;for(const s of n)i=e(i,s,this);return i}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new ga().quadsToString(this)}union(e){const t=new et({entityIndex:this._entityIndex});return t._graphs=fn(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function wt(r,e,t=0){const n=e[t];if(n&&!(n in r))return!1;let i=!1;for(const s in n?{[n]:r[n]}:r){const a=t===2?null:wt(r[s],e,t+1);a!==!1&&(i=i||Object.create(null),i[s]=a)}return i}class Mt extends oc.Readable{constructor(e,t,n,i,s,a){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:n,object:i,graph:s,options:a})}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:n,predicate:i,subject:s}=this,a=this._filtered=new et({factory:e._factory,entityIndex:this.options.entityIndex});let o,u,l;if(s&&!(o=a._termToNumericId(s))||i&&!(u=a._termToNumericId(i))||n&&!(l=a._termToNumericId(n)))return a;const c=e._getGraphs(t);for(const d in c){let m,b,_,x;(x=c[d])&&(!o&&u?(b=wt(x.predicates,[u,l,o]))&&(m=wt(x.subjects,[o,u,l]),_=wt(x.objects,[l,o,u])):l?(_=wt(x.objects,[l,o,u]))&&(m=wt(x.subjects,[o,u,l]),b=wt(x.predicates,[u,l,o])):(m=wt(x.subjects,[o,u,l]))&&(b=wt(x.predicates,[u,l,o]),_=wt(x.objects,[l,o,u])),m&&(a._graphs[d]={subjects:m,predicates:b,objects:_}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Hi]&&(this[Hi]=this[Symbol.iterator]());const t=this[Hi];for(;--e>=0;){const{done:n,value:i}=t.next();if(n){this.push(null);return}this.push(i)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,n,i){return this.filtered.deleteMatches(e,t,n,i)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,n,i,s){return this.filtered.every(e,t,n,i,s)}filter(e){return this.filtered.filter(e)}forEach(e,t,n,i,s){return this.filtered.forEach(e,t,n,i,s)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,t,n,i,s){return this.filtered.some(e,t,n,i,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(e)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,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,n,i){return new Mt(this.filtered,e,t,n,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}const xe="http://www.w3.org/ns/shacl#",jo="http://datashapes.org/dash#",Ut="http://www.w3.org/2001/XMLSchema#",_a="http://www.w3.org/1999/02/22-rdf-syntax-ns#",wa="http://www.w3.org/2000/01/rdf-schema#",va="http://www.w3.org/2004/02/skos/core#",Ad="http://www.w3.org/2002/07/owl#",Dd="http://www.w3.org/ns/oa#",Od="http://purl.org/dc/terms/",Ld="http://xmlns.com/foaf/0.1/",Jn=Re.namedNode("loaded-shapes"),vt=Re.namedNode("loaded-data"),tt=Re.namedNode(_a+"type"),na=Re.namedNode(Od+"conformsTo"),$o=Re.namedNode(wa+"subClassOf"),xa=Re.namedNode(Ad+"imports"),Cd=Re.namedNode(va+"broader"),jd=Re.namedNode(va+"narrower"),Pn=Re.namedNode(xe+"NodeShape"),$d=Re.namedNode(xe+"IRI"),Kn=Re.namedNode(xe+"property"),Ea=Re.namedNode(xe+"class"),_n=Re.namedNode(xe+"targetClass"),Fd=Re.namedNode(xe+"nodeKind"),kd=Re.namedNode(Ut+"string");function pn(r,e,t=xe,n){let i="";const s=Pd(r,e,t,n);return s&&(i=s.value),i}function Pd(r,e,t=xe,n){let i;const s=t+e;if(n?.length){for(const a of n)for(const o of r)if(o.predicate.value===s){if(o.object.id.endsWith(`@${a}`))return o.object;o.object.id.indexOf("@")<0?i=o.object:i||(i=o.object)}}else for(const a of r)if(a.predicate.value===s)return a.object;return i}function Md(r){r.querySelector("input,select,textarea")?.focus()}function Sn(r,e){return pn(r,"prefLabel",va,e)||pn(r,"label",wa,e)||pn(r,"name",Ld,e)}function cc(r,e,t){const n=[];for(const i of r)n.push({value:i,label:Sn(e.getQuads(i,null,null,null),t),children:[]});return n}function ia(r,e){for(const t in e)r=r.replace(e[t],"");return r}function dc(r,e,t,n,i=new Set){for(const s of e.owlImports)i.has(s.id)||(i.add(s.id),n.push(...t.getSubjects(tt,r,s)));e.parent&&dc(r,e.parent,t,n,i)}function Sa(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,Jn);t.push(...e.config.store.getSubjects(tt,r,vt)),dc(r,e,e.config.store,t);const n=new Map,i=new Map;for(const a of t)n.set(a.id,{value:a,label:Sn(e.config.store.getQuads(a,null,null,null),e.config.languages),children:[]});for(const a of t){for(const o of e.config.store.getObjects(a,Cd,null))n.has(o.id)&&i.set(a.id,o.id);for(const o of e.config.store.getObjects(a,jd,null))n.has(o.id)&&i.set(o.id,a.id);for(const o of e.config.store.getObjects(a,$o,null))n.has(o.id)&&i.set(a.id,o.id)}for(const[a,o]of i.entries())n.get(o)?.children?.push(n.get(a));const s=[];for(const[a,o]of n.entries())i.has(a)||s.push(o);for(const a of e.config.store.getSubjects($o,r,null))s.push(...Sa(a,e));return s}}function sa(r){let e;try{e=new URL(r)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function Fo(r,e,t){if(e===void 0)return t;if(t===void 0)return e;const n=r.indexOf(e.language);if(n<0)return t;const i=r.indexOf(t.language);return i<0||i>n?e:t}function hc(r,e,t){const n=document.createElement("div");n.classList.add("shacl-or-constraint");const i=[];if(e instanceof Ht){const s=[];let a=!1;r.length&&(a=t.store.countQuads(r[0],Kn,null,null)>0);for(let l=0;l<r.length;l++)if(a){const c=t.store.getObjects(r[l],Kn,null),d=[];let m="";for(const b of c){const _=new ei(b,e,t);d.push(_),m+=(m.length>1?" / ":"")+_.template.label}s.push(d),i.push({label:m,value:l.toString()})}else{const c=new ei(r[l],e,t);s.push([c]),i.push({label:c.template.label,value:l.toString()})}const o=t.theme.createListEditor("Please choose",null,!1,i),u=o.querySelector(".editor");u.onchange=()=>{if(u.value){const l=s[parseInt(u.value)];let c;l.length&&(c=l[0],n.replaceWith(l[0]));for(let d=1;d<l.length;d++)c.after(l[d]),c=l[d]}},n.appendChild(o)}else{const s=[];for(let u=0;u<r.length;u++){const l=t.store.getQuads(r[u],null,null,null);l.length&&(s.push(l),i.push({label:Sn(l,t.languages)||ia(l[0].predicate.value,t.prefixes)+" = "+ia(l[0].object.value,t.prefixes),value:u.toString()}))}const a=t.theme.createListEditor(e.template.label+"?",null,!1,i,e.template),o=a.querySelector(".editor");o.onchange=()=>{o.value&&n.replaceWith(Wn(e.template.clone().merge(s[parseInt(o.value)]),void 0,!0))},n.appendChild(a)}return n}function Bd(r,e,t){if(e instanceof ct){const n=e.datatype;for(const i of r){const s=t.store.getQuads(i,null,null,null);for(const a of s)if(a.predicate.value===`${xe}datatype`&&a.object.equals(n))return s}}else{const n=t.store.getObjects(e,tt,null);for(const i of r){const s=t.store.getQuads(i,null,null,null);for(const a of s)if(n.length>0){if(a.predicate.value===`${xe}node`){for(const o of n)if(t.store.getQuads(a.object,_n,o,null).length>0)return s}if(a.predicate.equals(Ea)){for(const o of n)if(a.object.equals(o))return s}}else if(a.predicate.equals(Fd)&&a.object.equals($d))return s}}return console.error("couldn't resolve sh:or/sh:xone on property for value",e),[]}function qd(r,e,t){for(const n of r){let i=!1;const s=t.store.getObjects(n,Kn,null);for(const a of s){const o=t.store.getObjects(a,`${xe}path`,null);for(const u of o)if(i=t.store.countQuads(e,u,null,null)>0,i)break}if(i)return s}return console.error("couldn't resolve sh:or/sh:xone on node for value",e),[]}const Ud={[`${xe}name`]:(r,e)=>{const t=e;r.name=Fo(r.config.languages,r.name,t)},[`${xe}description`]:(r,e)=>{const t=e;r.description=Fo(r.config.languages,r.description,t)},[`${xe}path`]:(r,e)=>{r.path=e.value},[`${xe}node`]:(r,e)=>{r.node=e},[`${xe}datatype`]:(r,e)=>{r.datatype=e},[`${xe}nodeKind`]:(r,e)=>{r.nodeKind=e},[`${xe}minCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${xe}maxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[`${xe}minLength`]:(r,e)=>{r.minLength=parseInt(e.value)},[`${xe}maxLength`]:(r,e)=>{r.maxLength=parseInt(e.value)},[`${xe}minInclusive`]:(r,e)=>{r.minInclusive=parseInt(e.value)},[`${xe}maxInclusive`]:(r,e)=>{r.maxInclusive=parseInt(e.value)},[`${xe}minExclusive`]:(r,e)=>{r.minExclusive=parseInt(e.value)},[`${xe}maxExclusive`]:(r,e)=>{r.maxExclusive=parseInt(e.value)},[`${xe}pattern`]:(r,e)=>{r.pattern=e.value},[`${xe}order`]:(r,e)=>{r.order=parseInt(e.value)},[`${jo}singleLine`]:(r,e)=>{r.singleLine=e.value==="true"},[`${jo}readonly`]:(r,e)=>{r.readonly=e.value==="true"},[`${Dd}styleClass`]:(r,e)=>{r.cssClass=e.value},[`${xe}and`]:(r,e)=>{r.shaclAnd=e.value},[`${xe}in`]:(r,e)=>{r.shaclIn=e.value},[`${xe}languageIn`]:(r,e)=>{r.languageIn=r.config.lists[e.value],r.datatype=Re.namedNode(_a+"langString")},[`${xe}defaultValue`]:(r,e)=>{r.defaultValue=e},[`${xe}hasValue`]:(r,e)=>{r.hasValue=e},[`${xe}qualifiedValueShape`]:(r,e)=>{r.qualifiedValueShape=e},[`${xe}qualifiedMinCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${xe}qualifiedMaxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[xa.id]:(r,e)=>{r.owlImports.push(e)},[Ea.id]:(r,e)=>{r.class=e;const t=r.config.store.getSubjects(_n,e,null);t.length>0&&(r.node=t[0])},[`${xe}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)},[`${xe}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 Hd{constructor(e,t,n){this.label="",this.owlImports=[],this.extendedShapes=[],this.parent=t,this.config=n,this.merge(e),this.qualifiedValueShape&&this.merge(n.store.getQuads(this.qualifiedValueShape,null,null,null))}merge(e){for(const t of e)Ud[t.predicate.id]?.call(this,this,t.object);if(this.label=this.name?.value||Sn(e,this.config.languages),!this.label&&!this.shaclAnd&&(this.label=this.path?ia(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 n of t)this.extendedShapes.push(n)}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 Vd=`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; }
@@ -72,26 +72,26 @@ a, a:visited { color: inherit; }
72
72
  .collapsible > .property-instance > shacl-node > h1 { display: none; }
73
73
  .ref-link { cursor: pointer; }
74
74
  .ref-link:hover { text-decoration: underline; }
75
- .node-id-display { color: #999; font-size: 11px; }`;class fd{constructor(e){let t=dd;e&&(t+=`
76
- `+e),this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t)}apply(e){}createViewer(e,t,n){const i=document.createElement("div"),s=document.createElement("label");s.innerHTML=e+":",n.description&&s.setAttribute("title",n.description.value),i.appendChild(s);let a=t.value,o=null;if(t instanceof Rn){const d=n.config.store.getQuads(a,null,null,null);if(d.length){const h=Pt(d,n.config.languages);h&&(a=h)}}else t instanceof Ze&&(t.language?(o=document.createElement("span"),o.classList.add("lang"),o.innerText=`@${t.language}`):t.datatype.value===`${Rt}date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`${Rt}dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let l;return Ls(t.value)?(l=document.createElement("a"),l.setAttribute("href",t.value)):l=document.createElement("div"),l.classList.add("d-flex"),l.innerText=a,o&&l.appendChild(o),i.appendChild(l),i}}function hd(r,e,t){if(t){const n=r.minCount!==void 0&&r.minCount>0;if(r.class)return r.config.theme.createListEditor(r.label,e,n,Qs(r.class,r),r);if(r.shaclIn){const i=r.config.lists[r.shaclIn];if(i?.length){const s=Nu(i,r.config.store,r.config.languages);return r.config.theme.createListEditor(r.label,e,n,s,r)}else console.error("list not found:",r.shaclIn,"existing lists:",r.config.lists)}if(r.datatype?.value===`${Vs}langString`||r.languageIn?.length)return r.config.theme.createLangStringEditor(r.label,e,n,r);switch(r.datatype?.value.replace(Rt,"")){case"integer":case"float":case"double":case"decimal":return r.config.theme.createNumberEditor(r.label,e,n,r);case"date":case"dateTime":return r.config.theme.createDateEditor(r.label,e,n,r);case"boolean":return r.config.theme.createBooleanEditor(r.label,e,n,r);case"base64Binary":return r.config.theme.createFileEditor(r.label,e,n,r)}return r.config.theme.createTextEditor(r.label,e,n,r)}else{if(e)return r.config.theme.createViewer(r.label,e,r);const n=document.createElement("div");return n.innerHTML="No value",n}}function pd(r,e,t){if(e==="application/ld+json")return gd(r);{const n=new Bs({format:e,prefixes:t});n.addQuads(r);let i="";return n.end((s,a)=>{s&&console.error(s),i=a}),i}}function gd(r){const e=[];for(const t of r){const n={"@id":t.subject.id};if(t.predicate===Ue)n["@type"]=t.object.id;else{let i=t.object.value;t.object instanceof Ze?t.object.language?i={"@language":t.object.language,"@value":t.object.value}:t.object.datatype&&t.object.datatype.value!==`${Rt}#string`&&(i={"@type":t.object.datatype.value,"@value":t.object.value}):i={"@id":t.object.id},n[t.predicate.value]=i}e.push(n)}return JSON.stringify(e)}function yd(r){let e=r.shaclDatatype,t=r.value;if(t){if(r.dataset.class||r.dataset.nodeKind===be+"IRI")return xe.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 n=t.split("^^");n.length===2&&(n[0].startsWith('"')&&n[0].endsWith('"')||n[0].startsWith("'")&&n[0].endsWith("'"))&&n[1].split(":").length===2&&(t=n[0].substring(1,n[0].length-1),e=xe.namedNode(n[1]))}return xe.literal(t,e)}else if((r.type==="checkbox"||r.getAttribute("type")==="checkbox")&&(r.checked||parseInt(r.dataset.minCount||"0")>0))return xe.literal(r.checked?"true":"false",e)}const Ur={};function md(r){r.predicate===void 0&&r.datatype===void 0?console.warn('not registering plugin because it does neither define "predicate" nor "datatype"',r):Ur[`${r.predicate}^${r.datatype}`]=r}function bd(){return Object.entries(Ur).map(r=>r[1])}function wd(r,e){let t=Ur[`${r}^${e}`];return t||(t=Ur[`${r}^undefined`],t)?t:Ur[`undefined^${e}`]}class _y{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)}}/**
75
+ .node-id-display { color: #999; font-size: 11px; }`;class Gd{constructor(e){let t=Vd;e&&(t+=`
76
+ `+e),this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t)}apply(e){}createViewer(e,t,n){const i=document.createElement("div"),s=document.createElement("label");s.innerHTML=e+":",n.description&&s.setAttribute("title",n.description.value),i.appendChild(s);let a=t.value,o=null;if(t instanceof ni){const l=n.config.store.getQuads(a,null,null,null);if(l.length){const c=Sn(l,n.config.languages);c&&(a=c)}}else t instanceof ct&&(t.language?(o=document.createElement("span"),o.classList.add("lang"),o.innerText=`@${t.language}`):t.datatype.value===`${Ut}date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`${Ut}dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let u;return sa(t.value)?(u=document.createElement("a"),u.setAttribute("href",t.value)):u=document.createElement("div"),u.classList.add("d-flex"),u.innerText=a,o&&u.appendChild(o),i.appendChild(u),i}}function Wd(r,e,t){if(t){const n=r.minCount!==void 0&&r.minCount>0;if(r.class)return r.config.theme.createListEditor(r.label,e,n,Sa(r.class,r),r);if(r.shaclIn){const i=r.config.lists[r.shaclIn];if(i?.length){const s=cc(i,r.config.store,r.config.languages);return r.config.theme.createListEditor(r.label,e,n,s,r)}else console.error("list not found:",r.shaclIn,"existing lists:",r.config.lists)}if(r.datatype?.value===`${_a}langString`||r.languageIn?.length)return r.config.theme.createLangStringEditor(r.label,e,n,r);switch(r.datatype?.value.replace(Ut,"")){case"integer":case"float":case"double":case"decimal":return r.config.theme.createNumberEditor(r.label,e,n,r);case"date":case"dateTime":return r.config.theme.createDateEditor(r.label,e,n,r);case"boolean":return r.config.theme.createBooleanEditor(r.label,e,n,r);case"base64Binary":return r.config.theme.createFileEditor(r.label,e,n,r)}return r.config.theme.createTextEditor(r.label,e,n,r)}else{if(e)return r.config.theme.createViewer(r.label,e,r);const n=document.createElement("div");return n.innerHTML="No value",n}}function zd(r,e,t){if(e==="application/ld+json")return Xd(r);{const n=new ga({format:e,prefixes:t});n.addQuads(r);let i="";return n.end((s,a)=>{s&&console.error(s),i=a}),i}}function Xd(r){const e=[];for(const t of r){const n={"@id":t.subject.id};if(t.predicate===tt)n["@type"]=t.object.id;else{let i=t.object.value;t.object instanceof ct?t.object.language?i={"@language":t.object.language,"@value":t.object.value}:t.object.datatype&&t.object.datatype.value!==`${Ut}#string`&&(i={"@type":t.object.datatype.value,"@value":t.object.value}):i={"@id":t.object.id},n[t.predicate.value]=i}e.push(n)}return JSON.stringify(e)}function Qd(r){let e=r.shaclDatatype,t=r.value;if(t){if(r.dataset.class||r.dataset.nodeKind===xe+"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 n=t.split("^^");n.length===2&&(n[0].startsWith('"')&&n[0].endsWith('"')||n[0].startsWith("'")&&n[0].endsWith("'"))&&n[1].split(":").length===2&&(t=n[0].substring(1,n[0].length-1),e=Re.namedNode(n[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 gn={};function Jd(r){r.predicate===void 0&&r.datatype===void 0?console.warn('not registering plugin because it does neither define "predicate" nor "datatype"',r):gn[`${r.predicate}^${r.datatype}`]=r}function Kd(){return Object.entries(gn).map(r=>r[1])}function Yd(r,e){let t=gn[`${r}^${e}`];return t||(t=gn[`${r}^undefined`],t)?t:gn[`undefined^${e}`]}class hy{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 fn=globalThis,Xs=fn.ShadowRoot&&(fn.ShadyCSS===void 0||fn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ks=Symbol(),po=new WeakMap;let Lu=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Ks)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(Xs&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=po.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&po.set(t,e))}return e}toString(){return this.cssText}};const vd=r=>new Lu(typeof r=="string"?r:r+"",void 0,Ks),vt=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((n,i,s)=>n+(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.")})(i)+r[s+1],r[0]);return new Lu(t,r,Ks)},_d=(r,e)=>{if(Xs)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=fn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},go=Xs?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return vd(t)})(r):r;/**
80
+ */const Hn=globalThis,Na=Hn.ShadowRoot&&(Hn.ShadyCSS===void 0||Hn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ia=Symbol(),ko=new WeakMap;let fc=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Ia)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(Na&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=ko.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&ko.set(t,e))}return e}toString(){return this.cssText}};const Zd=r=>new fc(typeof r=="string"?r:r+"",void 0,Ia),jt=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((n,i,s)=>n+(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.")})(i)+r[s+1],r[0]);return new fc(t,r,Ia)},eh=(r,e)=>{if(Na)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=Hn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Po=Na?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return Zd(t)})(r):r;/**
81
81
  * @license
82
82
  * Copyright 2017 Google LLC
83
83
  * SPDX-License-Identifier: BSD-3-Clause
84
- */const{is:xd,defineProperty:Sd,getOwnPropertyDescriptor:Ed,getOwnPropertyNames:Id,getOwnPropertySymbols:Rd,getPrototypeOf:Nd}=Object,On=globalThis,yo=On.trustedTypes,Td=yo?yo.emptyScript:"",Ad=On.reactiveElementPolyfillSupport,Hr=(r,e)=>r,js={toAttribute(r,e){switch(e){case Boolean:r=r?Td: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}},ju=(r,e)=>!xd(r,e),mo={attribute:!0,type:String,converter:js,reflect:!1,useDefault:!1,hasChanged:ju};Symbol.metadata??=Symbol("metadata"),On.litPropertyMetadata??=new WeakMap;let Xt=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=mo){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 n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Sd(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=Ed(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){const o=i?.call(this);s?.call(this,a),this.requestUpdate(e,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??mo}static _$Ei(){if(this.hasOwnProperty(Hr("elementProperties")))return;const e=Nd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Hr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Hr("properties"))){const t=this.properties,n=[...Id(t),...Rd(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(go(i))}else e!==void 0&&t.push(go(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n: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 n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return _d(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,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){const s=(n.converter?.toAttribute!==void 0?n.converter:js).toAttribute(t,n.type);this._$Em=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(e,t){const n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const s=n.getPropertyOptions(i),a=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:js;this._$Em=i;const o=a.fromAttribute(t,s.type);this[i]=o??this._$Ej?.get(i)??o,this._$Em=null}}requestUpdate(e,t,n){if(e!==void 0){const i=this.constructor,s=this[e];if(n??=i.getPropertyOptions(e),!((n.hasChanged??ju)(s,t)||n.useDefault&&n.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:s},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),s!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!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[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[i,s]of n){const{wrapped:a}=s,o=this[i];a!==!0||this._$AL.has(i)||o===void 0||this.C(i,void 0,s,o)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}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){}};Xt.elementStyles=[],Xt.shadowRootOptions={mode:"open"},Xt[Hr("elementProperties")]=new Map,Xt[Hr("finalized")]=new Map,Ad?.({ReactiveElement:Xt}),(On.reactiveElementVersions??=[]).push("2.1.1");/**
84
+ */const{is:th,defineProperty:rh,getOwnPropertyDescriptor:nh,getOwnPropertyNames:ih,getOwnPropertySymbols:sh,getPrototypeOf:ah}=Object,ui=globalThis,Mo=ui.trustedTypes,oh=Mo?Mo.emptyScript:"",lh=ui.reactiveElementPolyfillSupport,mn=(r,e)=>r,aa={toAttribute(r,e){switch(e){case Boolean:r=r?oh: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)=>!th(r,e),Bo={attribute:!0,type:String,converter:aa,reflect:!1,useDefault:!1,hasChanged:pc};Symbol.metadata??=Symbol("metadata"),ui.litPropertyMetadata??=new WeakMap;let _r=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=Bo){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 n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&rh(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=nh(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){const o=i?.call(this);s?.call(this,a),this.requestUpdate(e,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Bo}static _$Ei(){if(this.hasOwnProperty(mn("elementProperties")))return;const e=ah(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(mn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(mn("properties"))){const t=this.properties,n=[...ih(t),...sh(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(Po(i))}else e!==void 0&&t.push(Po(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n: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 n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return eh(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,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){const s=(n.converter?.toAttribute!==void 0?n.converter:aa).toAttribute(t,n.type);this._$Em=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(e,t){const n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const s=n.getPropertyOptions(i),a=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:aa;this._$Em=i;const o=a.fromAttribute(t,s.type);this[i]=o??this._$Ej?.get(i)??o,this._$Em=null}}requestUpdate(e,t,n){if(e!==void 0){const i=this.constructor,s=this[e];if(n??=i.getPropertyOptions(e),!((n.hasChanged??pc)(s,t)||n.useDefault&&n.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:s},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),s!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!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[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[i,s]of n){const{wrapped:a}=s,o=this[i];a!==!0||this._$AL.has(i)||o===void 0||this.C(i,void 0,s,o)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}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){}};_r.elementStyles=[],_r.shadowRootOptions={mode:"open"},_r[mn("elementProperties")]=new Map,_r[mn("finalized")]=new Map,lh?.({ReactiveElement:_r}),(ui.reactiveElementVersions??=[]).push("2.1.1");/**
85
85
  * @license
86
86
  * Copyright 2017 Google LLC
87
87
  * SPDX-License-Identifier: BSD-3-Clause
88
- */const Ys=globalThis,_n=Ys.trustedTypes,bo=_n?_n.createPolicy("lit-html",{createHTML:r=>r}):void 0,Ou="$lit$",Et=`lit$${Math.random().toFixed(9).slice(2)}$`,$u="?"+Et,Ld=`<${$u}>`,Bt=document,zr=()=>Bt.createComment(""),Jr=r=>r===null||typeof r!="object"&&typeof r!="function",Zs=Array.isArray,jd=r=>Zs(r)||typeof r?.[Symbol.iterator]=="function",bi=`[
89
- \f\r]`,vr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,wo=/-->/g,vo=/>/g,Ot=RegExp(`>|${bi}(?:([^\\s"'>=/]+)(${bi}*=${bi}*(?:[^
90
- \f\r"'\`<>=]|("|')|))|$)`,"g"),_o=/'/g,xo=/"/g,ku=/^(?:script|style|textarea|title)$/i,Od=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),ct=Od(1),tr=Symbol.for("lit-noChange"),De=Symbol.for("lit-nothing"),So=new WeakMap,Ct=Bt.createTreeWalker(Bt,129);function Du(r,e){if(!Zs(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return bo!==void 0?bo.createHTML(e):e}const $d=(r,e)=>{const t=r.length-1,n=[];let i,s=e===2?"<svg>":e===3?"<math>":"",a=vr;for(let o=0;o<t;o++){const l=r[o];let d,h,y=-1,w=0;for(;w<l.length&&(a.lastIndex=w,h=a.exec(l),h!==null);)w=a.lastIndex,a===vr?h[1]==="!--"?a=wo:h[1]!==void 0?a=vo:h[2]!==void 0?(ku.test(h[2])&&(i=RegExp("</"+h[2],"g")),a=Ot):h[3]!==void 0&&(a=Ot):a===Ot?h[0]===">"?(a=i??vr,y=-1):h[1]===void 0?y=-2:(y=a.lastIndex-h[2].length,d=h[1],a=h[3]===void 0?Ot:h[3]==='"'?xo:_o):a===xo||a===_o?a=Ot:a===wo||a===vo?a=vr:(a=Ot,i=void 0);const g=a===Ot&&r[o+1].startsWith("/>")?" ":"";s+=a===vr?l+Ld:y>=0?(n.push(d),l.slice(0,y)+Ou+l.slice(y)+Et+g):l+Et+(y===-2?o:g)}return[Du(r,s+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};let Os=class Mu{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let s=0,a=0;const o=e.length-1,l=this.parts,[d,h]=$d(e,t);if(this.el=Mu.createElement(d,n),Ct.currentNode=this.el.content,t===2||t===3){const y=this.el.content.firstChild;y.replaceWith(...y.childNodes)}for(;(i=Ct.nextNode())!==null&&l.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const y of i.getAttributeNames())if(y.endsWith(Ou)){const w=h[a++],g=i.getAttribute(y).split(Et),m=/([.?@])?(.*)/.exec(w);l.push({type:1,index:s,name:m[2],strings:g,ctor:m[1]==="."?Dd:m[1]==="?"?Md:m[1]==="@"?Cd:$n}),i.removeAttribute(y)}else y.startsWith(Et)&&(l.push({type:6,index:s}),i.removeAttribute(y));if(ku.test(i.tagName)){const y=i.textContent.split(Et),w=y.length-1;if(w>0){i.textContent=_n?_n.emptyScript:"";for(let g=0;g<w;g++)i.append(y[g],zr()),Ct.nextNode(),l.push({type:2,index:++s});i.append(y[w],zr())}}}else if(i.nodeType===8)if(i.data===$u)l.push({type:2,index:s});else{let y=-1;for(;(y=i.data.indexOf(Et,y+1))!==-1;)l.push({type:7,index:s}),y+=Et.length-1}s++}}static createElement(e,t){const n=Bt.createElement("template");return n.innerHTML=e,n}};function rr(r,e,t=r,n){if(e===tr)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl;const s=Jr(e)?void 0:e._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=rr(r,i._$AS(r,e.values),i,n)),e}let kd=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:n}=this._$AD,i=(e?.creationScope??Bt).importNode(t,!0);Ct.currentNode=i;let s=Ct.nextNode(),a=0,o=0,l=n[0];for(;l!==void 0;){if(a===l.index){let d;l.type===2?d=new ea(s,s.nextSibling,this,e):l.type===1?d=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(d=new Pd(s,this,e)),this._$AV.push(d),l=n[++o]}a!==l?.index&&(s=Ct.nextNode(),a++)}return Ct.currentNode=Bt,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},ea=class Cu{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=De,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=rr(this,e,t),Jr(e)?e===De||e==null||e===""?(this._$AH!==De&&this._$AR(),this._$AH=De):e!==this._$AH&&e!==tr&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):jd(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!==De&&Jr(this._$AH)?this._$AA.nextSibling.data=e:this.T(Bt.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Os.createElement(Du(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{const s=new kd(i,this),a=s.u(this.options);s.p(t),this.T(a),this._$AH=s}}_$AC(e){let t=So.get(e.strings);return t===void 0&&So.set(e.strings,t=new Os(e)),t}k(e){Zs(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const s of e)i===t.length?t.push(n=new Cu(this.O(zr()),this.O(zr()),this,this.options)):n=t[i],n._$AI(s),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const n=e.nextSibling;e.remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},$n=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=De,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=De}_$AI(e,t=this,n,i){const s=this.strings;let a=!1;if(s===void 0)e=rr(this,e,t,0),a=!Jr(e)||e!==this._$AH&&e!==tr,a&&(this._$AH=e);else{const o=e;let l,d;for(e=s[0],l=0;l<s.length-1;l++)d=rr(this,o[n+l],t,l),d===tr&&(d=this._$AH[l]),a||=!Jr(d)||d!==this._$AH[l],d===De?e=De:e!==De&&(e+=(d??"")+s[l+1]),this._$AH[l]=d}a&&!i&&this.j(e)}j(e){e===De?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Dd=class extends $n{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===De?void 0:e}},Md=class extends $n{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==De)}},Cd=class extends $n{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=rr(this,e,t,0)??De)===tr)return;const n=this._$AH,i=e===De&&n!==De||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==De&&(n===De||i);i&&this.element.removeEventListener(this.name,this,n),s&&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)}},Pd=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){rr(this,e)}};const qd=Ys.litHtmlPolyfillSupport;qd?.(Os,ea),(Ys.litHtmlVersions??=[]).push("3.3.1");const Bd=(r,e,t)=>{const n=t?.renderBefore??e;let i=n._$litPart$;if(i===void 0){const s=t?.renderBefore??null;n._$litPart$=i=new ea(e.insertBefore(zr(),s),s,void 0,t??{})}return i._$AI(r),i};/**
88
+ */const Ra=globalThis,Yn=Ra.trustedTypes,qo=Yn?Yn.createPolicy("lit-html",{createHTML:r=>r}):void 0,gc="$lit$",Bt=`lit$${Math.random().toFixed(9).slice(2)}$`,mc="?"+Bt,uh=`<${mc}>`,ir=document,wn=()=>ir.createComment(""),vn=r=>r===null||typeof r!="object"&&typeof r!="function",Ta=Array.isArray,ch=r=>Ta(r)||typeof r?.[Symbol.iterator]=="function",Vi=`[
89
+ \f\r]`,Wr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Uo=/-->/g,Ho=/>/g,Wt=RegExp(`>|${Vi}(?:([^\\s"'>=/]+)(${Vi}*=${Vi}*(?:[^
90
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Vo=/'/g,Go=/"/g,yc=/^(?:script|style|textarea|title)$/i,dh=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),xt=dh(1),Sr=Symbol.for("lit-noChange"),Ve=Symbol.for("lit-nothing"),Wo=new WeakMap,rr=ir.createTreeWalker(ir,129);function bc(r,e){if(!Ta(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return qo!==void 0?qo.createHTML(e):e}const hh=(r,e)=>{const t=r.length-1,n=[];let i,s=e===2?"<svg>":e===3?"<math>":"",a=Wr;for(let o=0;o<t;o++){const u=r[o];let l,c,d=-1,m=0;for(;m<u.length&&(a.lastIndex=m,c=a.exec(u),c!==null);)m=a.lastIndex,a===Wr?c[1]==="!--"?a=Uo:c[1]!==void 0?a=Ho:c[2]!==void 0?(yc.test(c[2])&&(i=RegExp("</"+c[2],"g")),a=Wt):c[3]!==void 0&&(a=Wt):a===Wt?c[0]===">"?(a=i??Wr,d=-1):c[1]===void 0?d=-2:(d=a.lastIndex-c[2].length,l=c[1],a=c[3]===void 0?Wt:c[3]==='"'?Go:Vo):a===Go||a===Vo?a=Wt:a===Uo||a===Ho?a=Wr:(a=Wt,i=void 0);const b=a===Wt&&r[o+1].startsWith("/>")?" ":"";s+=a===Wr?u+uh:d>=0?(n.push(l),u.slice(0,d)+gc+u.slice(d)+Bt+b):u+Bt+(d===-2?o:b)}return[bc(r,s+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};let oa=class _c{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let s=0,a=0;const o=e.length-1,u=this.parts,[l,c]=hh(e,t);if(this.el=_c.createElement(l,n),rr.currentNode=this.el.content,t===2||t===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=rr.nextNode())!==null&&u.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const d of i.getAttributeNames())if(d.endsWith(gc)){const m=c[a++],b=i.getAttribute(d).split(Bt),_=/([.?@])?(.*)/.exec(m);u.push({type:1,index:s,name:_[2],strings:b,ctor:_[1]==="."?ph:_[1]==="?"?gh:_[1]==="@"?mh:ci}),i.removeAttribute(d)}else d.startsWith(Bt)&&(u.push({type:6,index:s}),i.removeAttribute(d));if(yc.test(i.tagName)){const d=i.textContent.split(Bt),m=d.length-1;if(m>0){i.textContent=Yn?Yn.emptyScript:"";for(let b=0;b<m;b++)i.append(d[b],wn()),rr.nextNode(),u.push({type:2,index:++s});i.append(d[m],wn())}}}else if(i.nodeType===8)if(i.data===mc)u.push({type:2,index:s});else{let d=-1;for(;(d=i.data.indexOf(Bt,d+1))!==-1;)u.push({type:7,index:s}),d+=Bt.length-1}s++}}static createElement(e,t){const n=ir.createElement("template");return n.innerHTML=e,n}};function Nr(r,e,t=r,n){if(e===Sr)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl;const s=vn(e)?void 0:e._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=Nr(r,i._$AS(r,e.values),i,n)),e}let fh=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:n}=this._$AD,i=(e?.creationScope??ir).importNode(t,!0);rr.currentNode=i;let s=rr.nextNode(),a=0,o=0,u=n[0];for(;u!==void 0;){if(a===u.index){let l;u.type===2?l=new Aa(s,s.nextSibling,this,e):u.type===1?l=new u.ctor(s,u.name,u.strings,this,e):u.type===6&&(l=new yh(s,this,e)),this._$AV.push(l),u=n[++o]}a!==u?.index&&(s=rr.nextNode(),a++)}return rr.currentNode=ir,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},Aa=class wc{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=Ve,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.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),vn(e)?e===Ve||e==null||e===""?(this._$AH!==Ve&&this._$AR(),this._$AH=Ve):e!==this._$AH&&e!==Sr&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):ch(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!==Ve&&vn(this._$AH)?this._$AA.nextSibling.data=e:this.T(ir.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=oa.createElement(bc(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{const s=new fh(i,this),a=s.u(this.options);s.p(t),this.T(a),this._$AH=s}}_$AC(e){let t=Wo.get(e.strings);return t===void 0&&Wo.set(e.strings,t=new oa(e)),t}k(e){Ta(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const s of e)i===t.length?t.push(n=new wc(this.O(wn()),this.O(wn()),this,this.options)):n=t[i],n._$AI(s),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const n=e.nextSibling;e.remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ci=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=Ve,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Ve}_$AI(e,t=this,n,i){const s=this.strings;let a=!1;if(s===void 0)e=Nr(this,e,t,0),a=!vn(e)||e!==this._$AH&&e!==Sr,a&&(this._$AH=e);else{const o=e;let u,l;for(e=s[0],u=0;u<s.length-1;u++)l=Nr(this,o[n+u],t,u),l===Sr&&(l=this._$AH[u]),a||=!vn(l)||l!==this._$AH[u],l===Ve?e=Ve:e!==Ve&&(e+=(l??"")+s[u+1]),this._$AH[u]=l}a&&!i&&this.j(e)}j(e){e===Ve?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},ph=class extends ci{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ve?void 0:e}},gh=class extends ci{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Ve)}},mh=class extends ci{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=Nr(this,e,t,0)??Ve)===Sr)return;const n=this._$AH,i=e===Ve&&n!==Ve||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==Ve&&(n===Ve||i);i&&this.element.removeEventListener(this.name,this,n),s&&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)}},yh=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Nr(this,e)}};const bh=Ra.litHtmlPolyfillSupport;bh?.(oa,Aa),(Ra.litHtmlVersions??=[]).push("3.3.1");const _h=(r,e,t)=>{const n=t?.renderBefore??e;let i=n._$litPart$;if(i===void 0){const s=t?.renderBefore??null;n._$litPart$=i=new Aa(e.insertBefore(wn(),s),s,void 0,t??{})}return i._$AI(r),i};/**
91
91
  * @license
92
92
  * Copyright 2017 Google LLC
93
93
  * SPDX-License-Identifier: BSD-3-Clause
94
- */const ta=globalThis;class qt extends Xt{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=Bd(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return tr}}qt._$litElement$=!0,qt.finalized=!0,ta.litElementHydrateSupport?.({LitElement:qt});const Fd=ta.litElementPolyfillSupport;Fd?.({LitElement:qt});(ta.litElementVersions??=[]).push("4.2.1");var Pu=r=>{throw TypeError(r)},qu=(r,e,t)=>e.has(r)||Pu("Cannot "+t),xt=(r,e,t)=>(qu(r,e,"read from private field"),t?t.call(r):e.get(r)),Ud=(r,e,t)=>e.has(r)?Pu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Hd=(r,e,t,n)=>(qu(r,e,"write to private field"),e.set(r,t),t);const Gt=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)},hn=globalThis,ra=hn.ShadowRoot&&(hn.ShadyCSS===void 0||hn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Bu=Symbol(),Eo=new WeakMap;let Vd=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==Bu)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(ra&&r===void 0){const t=e!==void 0&&e.length===1;t&&(r=Eo.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Eo.set(e,r))}return r}toString(){return this.cssText}};const Gd=r=>new Vd(typeof r=="string"?r:r+"",void 0,Bu),Wd=(r,e)=>{if(ra)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=hn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Io=ra?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return Gd(t)})(r):r,{is:zd,defineProperty:Jd,getOwnPropertyDescriptor:Qd,getOwnPropertyNames:Xd,getOwnPropertySymbols:Kd,getPrototypeOf:Yd}=Object,nr=globalThis,Ro=nr.trustedTypes,Zd=Ro?Ro.emptyScript:"",No=nr.reactiveElementPolyfillSupport,Vr=(r,e)=>r,xn={toAttribute(r,e){switch(e){case Boolean:r=r?Zd: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}},na=(r,e)=>!zd(r,e),To={attribute:!0,type:String,converter:xn,reflect:!1,useDefault:!1,hasChanged:na};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),nr.litPropertyMetadata??(nr.litPropertyMetadata=new WeakMap);class _r extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=To){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 n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Jd(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=Qd(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){const o=i?.call(this);s?.call(this,a),this.requestUpdate(e,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??To}static _$Ei(){if(this.hasOwnProperty(Vr("elementProperties")))return;const e=Yd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Vr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Vr("properties"))){const t=this.properties,n=[...Xd(t),...Kd(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(Io(i))}else e!==void 0&&t.push(Io(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Wd(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostConnected)==null?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostDisconnected)==null?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){var n;const i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(s!==void 0&&i.reflect===!0){const a=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:xn).toAttribute(t,i.type);this._$Em=e,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$Em=null}}_$AK(e,t){var n,i;const s=this.constructor,a=s._$Eh.get(e);if(a!==void 0&&this._$Em!==a){const o=s.getPropertyOptions(a),l=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:xn;this._$Em=a,this[a]=l.fromAttribute(t,o.type)??((i=this._$Ej)==null?void 0:i.get(a))??null,this._$Em=null}}requestUpdate(e,t,n){var i;if(e!==void 0){const s=this.constructor,a=this[e];if(n??(n=s.getPropertyOptions(e)),!((n.hasChanged??na)(a,t)||n.useDefault&&n.reflect&&a===((i=this._$Ej)==null?void 0:i.get(e))&&!this.hasAttribute(s._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:s},a){n&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,a??t??this[e]),s!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[s,a]of this._$Ep)this[s]=a;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[s,a]of i){const{wrapped:o}=a,l=this[s];o!==!0||this._$AL.has(s)||l===void 0||this.C(s,void 0,a,l)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(e=this._$EO)==null||e.forEach(i=>{var s;return(s=i.hostUpdate)==null?void 0:s.call(i)}),this.update(n)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostUpdated)==null?void 0:i.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}}_r.elementStyles=[],_r.shadowRootOptions={mode:"open"},_r[Vr("elementProperties")]=new Map,_r[Vr("finalized")]=new Map,No?.({ReactiveElement:_r}),(nr.reactiveElementVersions??(nr.reactiveElementVersions=[])).push("2.1.0");const ef={attribute:!0,type:String,converter:xn,reflect:!1,hasChanged:na},tf=(r=ef,e,t)=>{const{kind:n,metadata:i}=t;let s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),n==="setter"&&((r=Object.create(r)).wrapped=!0),s.set(t.name,r),n==="accessor"){const{name:a}=t;return{set(o){const l=e.get.call(this);e.set.call(this,o),this.requestUpdate(a,l,r)},init(o){return o!==void 0&&this.C(a,void 0,r,o),o}}}if(n==="setter"){const{name:a}=t;return function(o){const l=this[a];e.call(this,o),this.requestUpdate(a,l,r)}}throw Error("Unsupported decorator location: "+n)};function ve(r){return(e,t)=>typeof t=="object"?tf(r,e,t):((n,i,s)=>{const a=i.hasOwnProperty(s);return i.constructor.createProperty(s,n),a?Object.getOwnPropertyDescriptor(i,s):void 0})(r,e,t)}function ia(r){return ve({...r,state:!0,attribute:!1})}const rf=(r,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(r,e,t),t);function dt(r,e){return(t,n,i)=>{const s=a=>{var o;return((o=a.renderRoot)==null?void 0:o.querySelector(r))??null};return rf(t,n,{get(){return s(this)}})}}var nf=Object.defineProperty,Wt=(r,e,t,n)=>{for(var i=void 0,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=a(e,t,i)||i);return i&&nf(e,t,i),i};const $s=class extends qt{constructor(){super(...arguments),this.dense=!1}};$s.shadowRootOptions={...qt.shadowRootOptions,delegatesFocus:!0},$s.styles=[vt`
94
+ */const Da=globalThis;class nr extends _r{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=_h(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Sr}}nr._$litElement$=!0,nr.finalized=!0,Da.litElementHydrateSupport?.({LitElement:nr});const wh=Da.litElementPolyfillSupport;wh?.({LitElement:nr});(Da.litElementVersions??=[]).push("4.2.1");var vc=r=>{throw TypeError(r)},xc=(r,e,t)=>e.has(r)||vc("Cannot "+t),Pt=(r,e,t)=>(xc(r,e,"read from private field"),t?t.call(r):e.get(r)),vh=(r,e,t)=>e.has(r)?vc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),xh=(r,e,t,n)=>(xc(r,e,"write to private field"),e.set(r,t),t);const ur=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)},Vn=globalThis,Oa=Vn.ShadowRoot&&(Vn.ShadyCSS===void 0||Vn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ec=Symbol(),zo=new WeakMap;let Eh=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==Ec)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(Oa&&r===void 0){const t=e!==void 0&&e.length===1;t&&(r=zo.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&zo.set(e,r))}return r}toString(){return this.cssText}};const Sh=r=>new Eh(typeof r=="string"?r:r+"",void 0,Ec),Nh=(r,e)=>{if(Oa)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=Vn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Xo=Oa?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return Sh(t)})(r):r,{is:Ih,defineProperty:Rh,getOwnPropertyDescriptor:Th,getOwnPropertyNames:Ah,getOwnPropertySymbols:Dh,getPrototypeOf:Oh}=Object,Ir=globalThis,Qo=Ir.trustedTypes,Lh=Qo?Qo.emptyScript:"",Jo=Ir.reactiveElementPolyfillSupport,yn=(r,e)=>r,Zn={toAttribute(r,e){switch(e){case Boolean:r=r?Lh: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}},La=(r,e)=>!Ih(r,e),Ko={attribute:!0,type:String,converter:Zn,reflect:!1,useDefault:!1,hasChanged:La};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Ir.litPropertyMetadata??(Ir.litPropertyMetadata=new WeakMap);class zr extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ko){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 n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Rh(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=Th(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){const o=i?.call(this);s?.call(this,a),this.requestUpdate(e,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ko}static _$Ei(){if(this.hasOwnProperty(yn("elementProperties")))return;const e=Oh(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(yn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(yn("properties"))){const t=this.properties,n=[...Ah(t),...Dh(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(Xo(i))}else e!==void 0&&t.push(Xo(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Nh(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostConnected)==null?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostDisconnected)==null?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){var n;const i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(s!==void 0&&i.reflect===!0){const a=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:Zn).toAttribute(t,i.type);this._$Em=e,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$Em=null}}_$AK(e,t){var n,i;const s=this.constructor,a=s._$Eh.get(e);if(a!==void 0&&this._$Em!==a){const o=s.getPropertyOptions(a),u=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Zn;this._$Em=a,this[a]=u.fromAttribute(t,o.type)??((i=this._$Ej)==null?void 0:i.get(a))??null,this._$Em=null}}requestUpdate(e,t,n){var i;if(e!==void 0){const s=this.constructor,a=this[e];if(n??(n=s.getPropertyOptions(e)),!((n.hasChanged??La)(a,t)||n.useDefault&&n.reflect&&a===((i=this._$Ej)==null?void 0:i.get(e))&&!this.hasAttribute(s._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:s},a){n&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,a??t??this[e]),s!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[s,a]of this._$Ep)this[s]=a;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[s,a]of i){const{wrapped:o}=a,u=this[s];o!==!0||this._$AL.has(s)||u===void 0||this.C(s,void 0,a,u)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(e=this._$EO)==null||e.forEach(i=>{var s;return(s=i.hostUpdate)==null?void 0:s.call(i)}),this.update(n)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostUpdated)==null?void 0:i.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}}zr.elementStyles=[],zr.shadowRootOptions={mode:"open"},zr[yn("elementProperties")]=new Map,zr[yn("finalized")]=new Map,Jo?.({ReactiveElement:zr}),(Ir.reactiveElementVersions??(Ir.reactiveElementVersions=[])).push("2.1.0");const Ch={attribute:!0,type:String,converter:Zn,reflect:!1,hasChanged:La},jh=(r=Ch,e,t)=>{const{kind:n,metadata:i}=t;let s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),n==="setter"&&((r=Object.create(r)).wrapped=!0),s.set(t.name,r),n==="accessor"){const{name:a}=t;return{set(o){const u=e.get.call(this);e.set.call(this,o),this.requestUpdate(a,u,r)},init(o){return o!==void 0&&this.C(a,void 0,r,o),o}}}if(n==="setter"){const{name:a}=t;return function(o){const u=this[a];e.call(this,o),this.requestUpdate(a,u,r)}}throw Error("Unsupported decorator location: "+n)};function Ie(r){return(e,t)=>typeof t=="object"?jh(r,e,t):((n,i,s)=>{const a=i.hasOwnProperty(s);return i.constructor.createProperty(s,n),a?Object.getOwnPropertyDescriptor(i,s):void 0})(r,e,t)}function Ca(r){return Ie({...r,state:!0,attribute:!1})}const $h=(r,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(r,e,t),t);function Et(r,e){return(t,n,i)=>{const s=a=>{var o;return((o=a.renderRoot)==null?void 0:o.querySelector(r))??null};return $h(t,n,{get(){return s(this)}})}}var Fh=Object.defineProperty,cr=(r,e,t,n)=>{for(var i=void 0,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=a(e,t,i)||i);return i&&Fh(e,t,i),i};const la=class extends nr{constructor(){super(...arguments),this.dense=!1}};la.shadowRootOptions={...nr.shadowRootOptions,delegatesFocus:!0},la.styles=[jt`
95
95
  :host {
96
96
  /* color-scheme: light dark; */
97
97
  --rokit-primary-color-inner: var(--rokit-primary-color, #008877);
@@ -114,11 +114,11 @@ a, a:visited { color: inherit; }
114
114
  }
115
115
  }
116
116
  */
117
- `];let zt=$s;Wt([ve({type:Boolean,reflect:!0})],zt.prototype,"dense");var it;const ks=class extends zt{constructor(){super(),Ud(this,it),this.value="",this.clearable=!1,this.required=!1,Hd(this,it,this.attachInternals())}checkValidity(){return xt(this,it).checkValidity()}reportValidity(){const e=xt(this,it).reportValidity();return this.classList.toggle("invalid",!e),e}get validity(){return xt(this,it).validity}get validationMessage(){return xt(this,it).validationMessage}setCustomValidity(e,t){e?xt(this,it).setValidity({customError:!0},e,t):xt(this,it).setValidity(void 0)}updateValidity(e,t,n){xt(this,it).setValidity(e,t,n)}setFormValue(e,t){xt(this,it).setFormValue(e,t)}};it=new WeakMap,ks.formAssociated=!0,ks.styles=[...zt.styles,vt`
117
+ `];let dr=la;cr([Ie({type:Boolean,reflect:!0})],dr.prototype,"dense");var mt;const ua=class extends dr{constructor(){super(),vh(this,mt),this.value="",this.clearable=!1,this.required=!1,xh(this,mt,this.attachInternals())}checkValidity(){return Pt(this,mt).checkValidity()}reportValidity(){const e=Pt(this,mt).reportValidity();return this.classList.toggle("invalid",!e),e}get validity(){return Pt(this,mt).validity}get validationMessage(){return Pt(this,mt).validationMessage}setCustomValidity(e,t){e?Pt(this,mt).setValidity({customError:!0},e,t):Pt(this,mt).setValidity(void 0)}updateValidity(e,t,n){Pt(this,mt).setValidity(e,t,n)}setFormValue(e,t){Pt(this,mt).setFormValue(e,t)}};mt=new WeakMap,ua.formAssociated=!0,ua.styles=[...dr.styles,jt`
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 ft=ks;Wt([ve()],ft.prototype,"name");Wt([ve()],ft.prototype,"value");Wt([ve({type:Boolean})],ft.prototype,"clearable");Wt([ve({type:Boolean})],ft.prototype,"required");Wt([ve()],ft.prototype,"label");Wt([ve()],ft.prototype,"placeholder");function sf(r){const e=parseFloat(r),t=r.match(/m?s/);let n=0;if(t)switch(t[0]){case"s":n=e*1e3;break;case"ms":n=e;break;default:n=0;break}return n}var af=Object.defineProperty,of=Object.getOwnPropertyDescriptor,Fu=(r,e,t,n)=>{for(var i=n>1?void 0:n?of(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&af(e,t,i),i};let ir=class extends zt{constructor(){super(...arguments),this.icon=!1}render(){return ct`<a part="link"><slot><slot></a>`}};ir.styles=[...zt.styles,vt`
121
+ `];let St=ua;cr([Ie()],St.prototype,"name");cr([Ie()],St.prototype,"value");cr([Ie({type:Boolean})],St.prototype,"clearable");cr([Ie({type:Boolean})],St.prototype,"required");cr([Ie()],St.prototype,"label");cr([Ie()],St.prototype,"placeholder");function kh(r){const e=parseFloat(r),t=r.match(/m?s/);let n=0;if(t)switch(t[0]){case"s":n=e*1e3;break;case"ms":n=e;break;default:n=0;break}return n}var Ph=Object.defineProperty,Mh=Object.getOwnPropertyDescriptor,Sc=(r,e,t,n)=>{for(var i=n>1?void 0:n?Mh(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ph(e,t,i),i};let Rr=class extends dr{constructor(){super(...arguments),this.icon=!1}render(){return xt`<a part="link"><slot><slot></a>`}};Rr.styles=[...dr.styles,jt`
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
- `];Fu([ve({type:Boolean,reflect:!0})],ir.prototype,"icon",2);ir=Fu([Gt("rokit-button")],ir);var lf=Object.defineProperty,uf=Object.getOwnPropertyDescriptor,Jt=(r,e,t,n)=>{for(var i=n>1?void 0:n?uf(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&lf(e,t,i),i};let Qe=class extends zt{constructor(){super(...arguments),this.open=!1,this.transitioning=!1,this.closedBeforeTransition=!1}firstUpdated(){const r=this.shadowRoot.querySelector("header");r.addEventListener("mousedown",()=>{this.closedBeforeTransition=!this.open&&!this.transitioning}),r.addEventListener("click",()=>{this.toggle(this.closedBeforeTransition,!0)}),this.transitionDuration=sf(getComputedStyle(this).getPropertyValue("--rokit-transition-duration-inner"))}updated(r){r.has("transitioning")&&this.classList.toggle("transitioning",this.transitioning),r.has("open")&&(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.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 ct`
133
+ `];Sc([Ie({type:Boolean,reflect:!0})],Rr.prototype,"icon",2);Rr=Sc([ur("rokit-button")],Rr);var Bh=Object.defineProperty,qh=Object.getOwnPropertyDescriptor,hr=(r,e,t,n)=>{for(var i=n>1?void 0:n?qh(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Bh(e,t,i),i};let ot=class extends dr{constructor(){super(...arguments),this.open=!1,this.transitioning=!1,this.closedBeforeTransition=!1}firstUpdated(){const r=this.shadowRoot.querySelector("header");r.addEventListener("mousedown",()=>{this.closedBeforeTransition=!this.open&&!this.transitioning}),r.addEventListener("click",()=>{this.toggle(this.closedBeforeTransition,!0)}),this.transitionDuration=kh(getComputedStyle(this).getPropertyValue("--rokit-transition-duration-inner"))}updated(r){r.has("transitioning")&&this.classList.toggle("transitioning",this.transitioning),r.has("open")&&(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.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 xt`
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>
@@ -141,7 +141,7 @@ a, a:visited { color: inherit; }
141
141
  <div id="content" part="content">
142
142
  <slot @slotchange=${this.onSlotChange}></slot>
143
143
  </div>
144
- `}};Qe.styles=[...zt.styles,vt`
144
+ `}};ot.styles=[...dr.styles,jt`
145
145
  :host { display: flex; flex-direction: column; align-items: stretch; border-bottom: 2px solid var(--rokit-light-background-darker-color-inner); }
146
146
  :host header { cursor: pointer; }
147
147
  :host([dense]) header { padding: 2px 4px; }
@@ -153,17 +153,17 @@ a, a:visited { color: inherit; }
153
153
  .label { flex-grow: 1; }
154
154
  #content { display: flex; transition: max-height var(--rokit-transition-duration-inner) ease-in-out; position: relative; scrollbar-width: thin; }
155
155
  #toggle { margin-left: 3px; }
156
- `];Jt([ve({type:Boolean,reflect:!0})],Qe.prototype,"open",2);Jt([ve()],Qe.prototype,"label",2);Jt([ve({reflect:!0})],Qe.prototype,"maxHeight",2);Jt([dt("#content")],Qe.prototype,"content",2);Jt([dt("#toggle")],Qe.prototype,"toggleButton",2);Jt([ia()],Qe.prototype,"transitioning",2);Qe=Jt([Gt("rokit-collapsible")],Qe);var cf=Object.defineProperty,df=Object.getOwnPropertyDescriptor,Uu=r=>{throw TypeError(r)},Xe=(r,e,t,n)=>{for(var i=n>1?void 0:n?df(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&cf(e,t,i),i},Hu=(r,e,t)=>e.has(r)||Uu("Cannot "+t),ff=(r,e,t)=>(Hu(r,e,"read from private field"),e.get(r)),hf=(r,e,t)=>e.has(r)?Uu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Ao=(r,e,t,n)=>(Hu(r,e,"write to private field"),e.set(r,t),t),Cr;let ke=class extends ft{constructor(){super(),this.type="text",this.disabled=!1,this.readonly=!1,this.sticky=!1,this.minWidth=80,hf(this,Cr,""),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(){Ao(this,Cr,this.value),this.inputElement.addEventListener("change",()=>{this.value=this.inputElement.value}),this.updateMinWidth()}updateMinWidth(){var r,e;const t=((e=(r=this.shadowRoot)==null?void 0:r.querySelector("label"))==null?void 0:e.scrollWidth)||0,n=this.shadowRoot.querySelector(".wrapper");n.style.minWidth=`${this.minWidth>t?this.minWidth:t}px`}updated(r){r.has("label")&&this.classList.toggle("has-label",this.label!==void 0),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!==ff(this,Cr)&&(Ao(this,Cr,this.value),this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))))}clear(){this.inputElement.value="",this.value="",this.blur()}renderInput(){return ct`<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 ct`
156
+ `];hr([Ie({type:Boolean,reflect:!0})],ot.prototype,"open",2);hr([Ie()],ot.prototype,"label",2);hr([Ie({reflect:!0})],ot.prototype,"maxHeight",2);hr([Et("#content")],ot.prototype,"content",2);hr([Et("#toggle")],ot.prototype,"toggleButton",2);hr([Ca()],ot.prototype,"transitioning",2);ot=hr([ur("rokit-collapsible")],ot);var Uh=Object.defineProperty,Hh=Object.getOwnPropertyDescriptor,Nc=r=>{throw TypeError(r)},lt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Hh(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Uh(e,t,i),i},Ic=(r,e,t)=>e.has(r)||Nc("Cannot "+t),Vh=(r,e,t)=>(Ic(r,e,"read from private field"),e.get(r)),Gh=(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),Yo=(r,e,t,n)=>(Ic(r,e,"write to private field"),e.set(r,t),t),dn;let Ue=class extends St{constructor(){super(),this.type="text",this.disabled=!1,this.readonly=!1,this.sticky=!1,this.minWidth=80,Gh(this,dn,""),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(){Yo(this,dn,this.value),this.inputElement.addEventListener("change",()=>{this.value=this.inputElement.value}),this.updateMinWidth()}updateMinWidth(){var r,e;const t=this.shadowRoot.querySelector(".wrapper");if(t){const n=((e=(r=this.shadowRoot)==null?void 0:r.querySelector("label"))==null?void 0:e.scrollWidth)||0;t.style.minWidth=`${this.minWidth>n?this.minWidth:n}px`}}updated(r){r.has("label")&&this.classList.toggle("has-label",this.label!==void 0),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!==Vh(this,dn)&&(Yo(this,dn,this.value),this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))))}clear(){this.inputElement.value="",this.value="",this.blur()}renderInput(){return xt`<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 xt`
157
157
  <slot name="prefix" part="prefix"></slot>
158
158
  <div class="wrapper">
159
159
  <label for="input" part="label">${this.label}</label>
160
160
  ${this.renderInput()}
161
- ${this.clearable?ct`
161
+ ${this.clearable?xt`
162
162
  <rokit-button class="clear" icon ?dense="${this.dense}" @mousedown="${r=>{r.preventDefault()}}" @click="${r=>{r.stopPropagation(),this.clear()}}" title="Clear"></rokit-button>
163
- `:De}
163
+ `:Ve}
164
164
  </div>
165
165
  <slot name="suffix" part="suffix"></slot>
166
- `}};Cr=new WeakMap;ke.styles=[...ft.styles,vt`
166
+ `}};dn=new WeakMap;Ue.styles=[...St.styles,jt`
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
- `];Xe([ve()],ke.prototype,"type",2);Xe([ve({type:Boolean})],ke.prototype,"disabled",2);Xe([ve({type:Boolean,reflect:!0})],ke.prototype,"readonly",2);Xe([ve({type:Boolean,reflect:!0})],ke.prototype,"sticky",2);Xe([ve()],ke.prototype,"pattern",2);Xe([ve()],ke.prototype,"minLength",2);Xe([ve()],ke.prototype,"maxLength",2);Xe([ve()],ke.prototype,"min",2);Xe([ve()],ke.prototype,"max",2);Xe([ve()],ke.prototype,"step",2);Xe([ve()],ke.prototype,"minWidth",2);Xe([dt("#input")],ke.prototype,"inputElement",2);ke=Xe([Gt("rokit-input")],ke);var pf=Object.defineProperty,gf=Object.getOwnPropertyDescriptor,Vu=r=>{throw TypeError(r)},Ge=(r,e,t,n)=>{for(var i=n>1?void 0:n?gf(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&pf(e,t,i),i},Gu=(r,e,t)=>e.has(r)||Vu("Cannot "+t),Lo=(r,e,t)=>(Gu(r,e,"read from private field"),t?t.call(r):e.get(r)),jo=(r,e,t)=>e.has(r)?Vu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),un=(r,e,t,n)=>(Gu(r,e,"write to private field"),e.set(r,t),t),Kt,pn;let Me=class extends ft{constructor(){super(),this.emptyMessage="Nothing to select",this.collapsibleOrientationLeft="0",this.collapsibleOrientationRight="0",this.collapsibleWidth="",this.collapse=!1,this.filterableThreshold=15,this.itemCount=0,jo(this,Kt,""),jo(this,pn,""),this.addEventListener("focus",()=>{this.collapsible.toggle(!0)}),this.addEventListener("blur",()=>{this.checkInputValue(),this.collapsible.toggle(!1)})}firstUpdated(){un(this,Kt,this.value),un(this,pn,getComputedStyle(this).getPropertyValue("--rokit-list-indent-inner")),this.input.placeholder=this.placeholder===void 0?"Type to filter list...":this.placeholder,this.input.label=this.label,this.inputMinWidth!==void 0&&(this.input.minWidth=this.inputMinWidth),setTimeout(()=>{this.collapsible.maxHeight=parseInt(this.collapsibleMaxHeight!==void 0?this.collapsibleMaxHeight:getComputedStyle(this).getPropertyValue("--rokit-list-max-height-inner")),this.collapsible.content.style.width=this.collapsibleWidth,this.collapsible.content.style.left=this.collapsibleOrientationLeft,this.collapsible.content.style.right=this.collapsibleOrientationRight})}updated(r){var e;if(r.has("selectedItem")){const t=this.value;this.value=this.selectedItem?this.itemValue(this.selectedItem):"",this.input.value=this.selectedItem?this.itemText(this.selectedItem):this.value,this.input.title=this.input.value,this.classList.toggle("has-value",this.value!==""),this.setFormValue(this.value),this.required&&this.value===""?this.updateValidity({valueMissing:!0},"Please select a value",this.listContainer):this.updateValidity(),t!==this.value&&this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}r.has("value")&&this.selectItem(this.findItem(this.value)),(r.has("filterableThreshold")||r.has("itemCount"))&&(this.input.readonly=this.filterableThreshold<0||this.itemCount<this.filterableThreshold),(e=this.collapsible)!=null&&e.toggleButton&&(this.collapsible.toggleButton.style.display=this.listContainer.childElementCount===0?"none":"")}checkInputValue(r=!0){if(this.input.value){const e=this.findItem(this.input.value);if(e){this.selectItem(e);return}}r&&(this.input.value="",this.input.title="",un(this,Kt,""),this.selectItem(null,!1))}filter(r){var e,t,n;r=r.toLowerCase();let i=!0;for(const s of this.listContainer.querySelectorAll("li"))if(s.id!=="noresult"){const a=this.itemText(s).toLowerCase().indexOf(r)==-1;s.classList.toggle("hidden",a),this.collapse&&(s.classList.remove("open"),(e=s.querySelector("ul"))==null||e.classList.remove("open")),a||(i=!1)}for(const s of this.listContainer.querySelectorAll("li:has(li:not(.hidden))"))s.classList.remove("hidden"),r&&this.collapse&&(s.classList.add("open"),(t=s.querySelector("ul"))==null||t.classList.add("open")),i=!1;this.highlightItem(null),(n=this.listContainer.querySelector("#noresult"))==null||n.classList.toggle("hidden",!i)}selectItem(r,e=!0){r?.getAttribute("disabled")!==null&&(r=null),this.selectedItem=r,this.filter(""),this.highlightItem(r,!1),e&&this.value&&un(this,Kt,this.value),setTimeout(()=>this.blur())}findItem(r){if(r){for(const e of this.listContainer.querySelectorAll("li"))if(this.itemValue(e)===r||this.itemText(e)===r)return e}return null}highlightItem(r,e=!0){var t,n;if((t=this.listContainer.querySelector("li.active"))==null||t.classList.remove("active"),r){if(e&&this.listContainer.focus(),r.classList.add("active"),this.collapse)for(let i=r.closest("ul");i;i=i.parentElement.closest("ul"))i.classList.add("open"),(n=i.closest("li"))==null||n.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 n=0;n<t.length;n++)if(t[n]===r&&n<t.length-1){e=t[n+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 n=0;n<t.length;n++)if(t[n]===r&&n>0){e=t[n-1];break}}this.highlightItem(e),e||this.input.focus()}itemValue(r){return r.dataset.value||this.itemText(r)||""}itemText(r){var e;return((e=r.querySelector("div > div"))==null?void 0:e.innerText)||""}elementText(r){var e;let t="";for(const n of r.childNodes)n.nodeType==3&&(t+=(e=n.nodeValue)==null?void 0:e.trim());return t}onSlotChange(){this.listContainer.replaceChildren(),this.itemCount=0;let r=null;const e=this.shadowRoot.querySelector("#list-container-slot").assignedElements();if(e?.length===1&&(r=Array.prototype.slice.call(e[0].querySelectorAll(":scope > li")),this.copyItems(r,this.listContainer)),this.emptyMessage){const t=document.createElement("li");t.id="noresult",t.setAttribute("disabled",""),t.innerText=this.emptyMessage,this.listContainer.appendChild(t),r&&r.length>0&&t.classList.add("hidden")}this.value=this.value||Lo(this,Kt),this.selectItem(this.findItem(this.value))}copyItems(r,e,t=0){if(this.sort!==void 0){const i=this.sort||"asc";r=r.sort((s,a)=>i==="desc"?(this.elementText(a)||this.itemValue(a)).localeCompare(this.elementText(s)||this.itemValue(s)):(this.elementText(s)||this.itemValue(s)).localeCompare(this.elementText(a)||this.itemValue(a)))}let n="";t>0&&(n=`calc(0.3em + ${t}*${Lo(this,pn)})`);for(const i of r){const s=i.cloneNode();s.replaceChildren();const a=document.createElement("div");n&&(a.style.paddingLeft=n);const o=document.createElement("div");a.appendChild(o);for(const d of i.childNodes)if(d.nodeName!=="UL"){const h=d.cloneNode(!0);h.nodeType===3&&h.nodeValue&&(h.nodeValue=h.nodeValue.trim()),o.appendChild(h)}s.appendChild(a),s.title=s.title||this.itemText(s);const l=i.querySelector("ul");if(l!=null&&l.childElementCount){const d=document.createElement("ul");if(s.appendChild(d),this.copyItems(Array.prototype.slice.call(l.children),d,t+1),this.collapse){const h=new ir;h.title="Open",h.dense=!0,h.icon=!0,h.classList.add("toggle-node","caret"),h.addEventListener("click",y=>{y.stopPropagation(),s.classList.toggle("open"),d.classList.toggle("open"),h.title=s.classList.contains("open")?"Close":"Open",this.collapsible.updateContentHeight()}),a.prepend(h)}else d.classList.add("open")}e.appendChild(s),this.itemCount++}}render(){return ct`
180
+ `];lt([Ie()],Ue.prototype,"type",2);lt([Ie({type:Boolean})],Ue.prototype,"disabled",2);lt([Ie({type:Boolean,reflect:!0})],Ue.prototype,"readonly",2);lt([Ie({type:Boolean,reflect:!0})],Ue.prototype,"sticky",2);lt([Ie()],Ue.prototype,"pattern",2);lt([Ie()],Ue.prototype,"minLength",2);lt([Ie()],Ue.prototype,"maxLength",2);lt([Ie()],Ue.prototype,"min",2);lt([Ie()],Ue.prototype,"max",2);lt([Ie()],Ue.prototype,"step",2);lt([Ie()],Ue.prototype,"minWidth",2);lt([Et("#input")],Ue.prototype,"inputElement",2);Ue=lt([ur("rokit-input")],Ue);var Wh=Object.defineProperty,zh=Object.getOwnPropertyDescriptor,Rc=r=>{throw TypeError(r)},nt=(r,e,t,n)=>{for(var i=n>1?void 0:n?zh(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Wh(e,t,i),i},Tc=(r,e,t)=>e.has(r)||Rc("Cannot "+t),Zo=(r,e,t)=>(Tc(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),Mn=(r,e,t,n)=>(Tc(r,e,"write to private field"),e.set(r,t),t),wr,Gn;let We=class extends St{constructor(){super(),this.emptyMessage="Nothing to select",this.collapsibleOrientationLeft="0",this.collapsibleOrientationRight="0",this.collapsibleWidth="",this.collapse=!1,this.filterableThreshold=15,this.itemCount=0,el(this,wr,""),el(this,Gn,""),this.addEventListener("focus",()=>{this.collapsible.toggle(!0)}),this.addEventListener("blur",()=>{this.checkInputValue(),this.collapsible.toggle(!1)})}firstUpdated(){Mn(this,wr,this.value),Mn(this,Gn,getComputedStyle(this).getPropertyValue("--rokit-list-indent-inner")),this.input.placeholder=this.placeholder===void 0?"Type to filter list...":this.placeholder,this.input.label=this.label,this.inputMinWidth!==void 0&&(this.input.minWidth=this.inputMinWidth),setTimeout(()=>{this.collapsible.maxHeight=parseInt(this.collapsibleMaxHeight!==void 0?this.collapsibleMaxHeight:getComputedStyle(this).getPropertyValue("--rokit-list-max-height-inner")),this.collapsible.content.style.width=this.collapsibleWidth,this.collapsible.content.style.left=this.collapsibleOrientationLeft,this.collapsible.content.style.right=this.collapsibleOrientationRight})}updated(r){var e;if(r.has("selectedItem")){const t=this.value;this.value=this.selectedItem?this.itemValue(this.selectedItem):"",this.input.value=this.selectedItem?this.itemText(this.selectedItem):this.value,this.input.title=this.input.value,this.classList.toggle("has-value",this.value!==""),this.setFormValue(this.value),this.required&&this.value===""?this.updateValidity({valueMissing:!0},"Please select a value",this.listContainer):this.updateValidity(),t!==this.value&&this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}r.has("value")&&this.selectItem(this.findItem(this.value)),(r.has("filterableThreshold")||r.has("itemCount"))&&(this.input.readonly=this.filterableThreshold<0||this.itemCount<this.filterableThreshold),(e=this.collapsible)!=null&&e.toggleButton&&(this.collapsible.toggleButton.style.display=this.listContainer.childElementCount===0?"none":"")}checkInputValue(r=!0){if(this.input.value){const e=this.findItem(this.input.value);if(e){this.selectItem(e);return}}r&&(this.input.value="",this.input.title="",Mn(this,wr,""),this.selectItem(null,!1))}filter(r){var e,t,n;r=r.toLowerCase();let i=!0;for(const s of this.listContainer.querySelectorAll("li"))if(s.id!=="noresult"){const a=this.itemText(s).toLowerCase().indexOf(r)==-1;s.classList.toggle("hidden",a),this.collapse&&(s.classList.remove("open"),(e=s.querySelector("ul"))==null||e.classList.remove("open")),a||(i=!1)}for(const s of this.listContainer.querySelectorAll("li:has(li:not(.hidden))"))s.classList.remove("hidden"),r&&this.collapse&&(s.classList.add("open"),(t=s.querySelector("ul"))==null||t.classList.add("open")),i=!1;this.highlightItem(null),(n=this.listContainer.querySelector("#noresult"))==null||n.classList.toggle("hidden",!i)}selectItem(r,e=!0){r?.getAttribute("disabled")!==null&&(r=null),this.selectedItem=r,this.filter(""),this.highlightItem(r,!1),e&&this.value&&Mn(this,wr,this.value),setTimeout(()=>this.blur())}findItem(r){if(r){for(const e of this.listContainer.querySelectorAll("li"))if(this.itemValue(e)===r||this.itemText(e)===r)return e}return null}highlightItem(r,e=!0){var t,n;if((t=this.listContainer.querySelector("li.active"))==null||t.classList.remove("active"),r){if(e&&this.listContainer.focus(),r.classList.add("active"),this.collapse)for(let i=r.closest("ul");i;i=i.parentElement.closest("ul"))i.classList.add("open"),(n=i.closest("li"))==null||n.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 n=0;n<t.length;n++)if(t[n]===r&&n<t.length-1){e=t[n+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 n=0;n<t.length;n++)if(t[n]===r&&n>0){e=t[n-1];break}}this.highlightItem(e),e||this.input.focus()}itemValue(r){return r.dataset.value||this.itemText(r)||""}itemText(r){var e;return((e=r.querySelector("div > div"))==null?void 0:e.innerText)||""}elementText(r){var e;let t="";for(const n of r.childNodes)n.nodeType==3&&(t+=(e=n.nodeValue)==null?void 0:e.trim());return t}onSlotChange(){this.listContainer.replaceChildren(),this.itemCount=0;let r=null;const e=this.shadowRoot.querySelector("#list-container-slot").assignedElements();if(e?.length===1&&(r=Array.prototype.slice.call(e[0].querySelectorAll(":scope > li")),this.copyItems(r,this.listContainer)),this.emptyMessage){const t=document.createElement("li");t.id="noresult",t.setAttribute("disabled",""),t.innerText=this.emptyMessage,this.listContainer.appendChild(t),r&&r.length>0&&t.classList.add("hidden")}this.value=this.value||Zo(this,wr),this.selectItem(this.findItem(this.value))}copyItems(r,e,t=0){if(this.sort!==void 0){const i=this.sort||"asc";r=r.sort((s,a)=>i==="desc"?(this.elementText(a)||this.itemValue(a)).localeCompare(this.elementText(s)||this.itemValue(s)):(this.elementText(s)||this.itemValue(s)).localeCompare(this.elementText(a)||this.itemValue(a)))}let n="";t>0&&(n=`calc(0.3em + ${t}*${Zo(this,Gn)})`);for(const i of r){const s=i.cloneNode();s.replaceChildren();const a=document.createElement("div");n&&(a.style.paddingLeft=n);const o=document.createElement("div");a.appendChild(o);for(const l of i.childNodes)if(l.nodeName!=="UL"){const c=l.cloneNode(!0);c.nodeType===3&&c.nodeValue&&(c.nodeValue=c.nodeValue.trim()),o.appendChild(c)}s.appendChild(a),s.title=s.title||this.itemText(s);const u=i.querySelector("ul");if(u!=null&&u.childElementCount){const l=document.createElement("ul");if(s.appendChild(l),this.copyItems(Array.prototype.slice.call(u.children),l,t+1),this.collapse){const c=new Rr;c.title="Open",c.dense=!0,c.icon=!0,c.classList.add("toggle-node","caret"),c.addEventListener("click",d=>{d.stopPropagation(),s.classList.toggle("open"),l.classList.toggle("open"),c.title=s.classList.contains("open")?"Close":"Open",this.collapsible.updateContentHeight()}),a.prepend(c)}else l.classList.add("open")}e.appendChild(s),this.itemCount++}}render(){return xt`
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>
@@ -196,7 +196,7 @@ a, a:visited { color: inherit; }
196
196
  </ul>
197
197
  <slot id="list-container-slot" @slotchange=${this.onSlotChange}></slot>
198
198
  </rokit-collapsible>
199
- `}};Kt=new WeakMap;pn=new WeakMap;Me.styles=[...ft.styles,vt`
199
+ `}};wr=new WeakMap;Gn=new WeakMap;We.styles=[...St.styles,jt`
200
200
  :host { background-color: var(--rokit-light-background-color-inner); user-select: none; padding: 0; }
201
201
  :host([dense]) li > div { padding: 4px 2px; }
202
202
  :host([dense]) li.large > div, :host([dense]) li.header > div { padding-top: 6px; padding-bottom: 6px; }
@@ -222,37 +222,37 @@ a, a:visited { color: inherit; }
222
222
  :host([collapse]) li > div > div { padding-left: 1.8em; }
223
223
  :host([collapse]) ul:not(.open) { display: none; }
224
224
  :host([collapse]) li:not(.open) > div > .toggle-node::part(link):before { transform: translate(0em, 0em) rotate(-45deg); }
225
- `];Ge([ve()],Me.prototype,"emptyMessage",2);Ge([ve()],Me.prototype,"sort",2);Ge([ve()],Me.prototype,"collapsibleMaxHeight",2);Ge([ve()],Me.prototype,"collapsibleOrientationLeft",2);Ge([ve()],Me.prototype,"collapsibleOrientationRight",2);Ge([ve()],Me.prototype,"collapsibleWidth",2);Ge([ve()],Me.prototype,"inputMinWidth",2);Ge([ve({type:Boolean,reflect:!0})],Me.prototype,"collapse",2);Ge([ve()],Me.prototype,"filterableThreshold",2);Ge([dt("rokit-collapsible")],Me.prototype,"collapsible",2);Ge([dt("#input")],Me.prototype,"input",2);Ge([dt("#list-container")],Me.prototype,"listContainer",2);Ge([ia()],Me.prototype,"selectedItem",2);Ge([ia()],Me.prototype,"itemCount",2);Me=Ge([Gt("rokit-select")],Me);var yf=Object.defineProperty,mf=Object.getOwnPropertyDescriptor,kn=(r,e,t,n)=>{for(var i=n>1?void 0:n?mf(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&yf(e,t,i),i};let Ft=class extends ke{constructor(){super(...arguments),this.resize="none",this.rows=3}firstUpdated(){super.firstUpdated(),this.inputElement.rows=this.rows,this.cols!==void 0&&(this.inputElement.cols=this.cols),this.resize==="auto"?(this.inputElement.style.resize="none",this.inputElement.addEventListener("input",()=>this.autoResize())):this.inputElement.style.resize=this.resize}updated(r){super.updated(r),this.resize==="auto"&&r.has("value")&&this.autoResize()}autoResize(){this.inputElement.style.height="",this.inputElement.style.height=this.inputElement.scrollHeight+"px"}onSlotChange(){const r=this.shadowRoot.querySelector("#content").assignedNodes().map(e=>e.textContent).join("");r.trim()!==""&&(this.value=r)}renderInput(){return ct`
225
+ `];nt([Ie()],We.prototype,"emptyMessage",2);nt([Ie()],We.prototype,"sort",2);nt([Ie()],We.prototype,"collapsibleMaxHeight",2);nt([Ie()],We.prototype,"collapsibleOrientationLeft",2);nt([Ie()],We.prototype,"collapsibleOrientationRight",2);nt([Ie()],We.prototype,"collapsibleWidth",2);nt([Ie()],We.prototype,"inputMinWidth",2);nt([Ie({type:Boolean,reflect:!0})],We.prototype,"collapse",2);nt([Ie()],We.prototype,"filterableThreshold",2);nt([Et("rokit-collapsible")],We.prototype,"collapsible",2);nt([Et("#input")],We.prototype,"input",2);nt([Et("#list-container")],We.prototype,"listContainer",2);nt([Ca()],We.prototype,"selectedItem",2);nt([Ca()],We.prototype,"itemCount",2);We=nt([ur("rokit-select")],We);var Xh=Object.defineProperty,Qh=Object.getOwnPropertyDescriptor,di=(r,e,t,n)=>{for(var i=n>1?void 0:n?Qh(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Xh(e,t,i),i};let sr=class extends Ue{constructor(){super(...arguments),this.resize="none",this.rows=3}firstUpdated(){super.firstUpdated(),this.inputElement.rows=this.rows,this.cols!==void 0&&(this.inputElement.cols=this.cols),this.resize==="auto"?(this.inputElement.style.resize="none",this.inputElement.addEventListener("input",()=>this.autoResize())):this.inputElement.style.resize=this.resize}updated(r){super.updated(r),this.resize==="auto"&&r.has("value")&&this.autoResize()}autoResize(){this.inputElement.style.height="",this.inputElement.style.height=this.inputElement.scrollHeight+"px"}onSlotChange(){const r=this.shadowRoot.querySelector("#content").assignedNodes().map(e=>e.textContent).join("");r.trim()!==""&&(this.value=r)}renderInput(){return xt`
226
226
  <textarea id="input" part="input" autocomplete="off" name="${this.name}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" .value="${this.value}"></textarea>
227
227
  <slot id="content" @slotchange=${this.onSlotChange}></slot>
228
- `}};Ft.styles=[...ke.styles,vt`
228
+ `}};sr.styles=[...Ue.styles,jt`
229
229
  :host, .wrapper { align-items: flex-start; }
230
230
  #input { height: initial; }
231
231
  #content { display: none; }
232
- `];kn([ve()],Ft.prototype,"resize",2);kn([ve()],Ft.prototype,"rows",2);kn([ve()],Ft.prototype,"cols",2);Ft=kn([Gt("rokit-textarea")],Ft);var bf=Object.defineProperty,wf=Object.getOwnPropertyDescriptor,Wu=r=>{throw TypeError(r)},ht=(r,e,t,n)=>{for(var i=n>1?void 0:n?wf(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&bf(e,t,i),i},zu=(r,e,t)=>e.has(r)||Wu("Cannot "+t),Re=(r,e,t)=>(zu(r,e,"read from private field"),t?t.call(r):e.get(r)),wi=(r,e,t)=>e.has(r)?Wu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),cn=(r,e,t,n)=>(zu(r,e,"write to private field"),e.set(r,t),t),Oe,gt,Yt;const It=18;let mt=class extends ke{constructor(){super(...arguments),this.labelFormatter=r=>String(r),wi(this,Oe,[0,1]),wi(this,gt,[Re(this,Oe)[0],Re(this,Oe)[1]]),wi(this,Yt)}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")&&(Re(this,Oe)[0]=parseFloat(this.min||"0"),Re(this,Oe)[1]=Math.max(Re(this,Oe)[0],Re(this,Oe)[1])),r.has("max")&&(Re(this,Oe)[1]=parseFloat(this.max||"1"),Re(this,Oe)[0]=Math.min(Re(this,Oe)[0],Re(this,Oe)[1])),r.has("step")&&cn(this,Yt,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);cn(this,gt,[this.applyConstraints(e[0]),this.applyConstraints(e[1])])}else cn(this,gt,[this.applyConstraints(parseFloat(this.value))]);else cn(this,gt,[Re(this,Oe)[0],Re(this,Oe)[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===Re(this,Oe)[0]?e=this.endKnob:e.id==="end"&&e.value===Re(this,Oe)[1]&&(e=this.startKnob)),e}toScreenSpace(r){return(r-Re(this,Oe)[0])/(Re(this,Oe)[1]-Re(this,Oe)[0])*this.track.offsetWidth}toValueSpace(r){return r/this.track.offsetWidth*(Re(this,Oe)[1]-Re(this,Oe)[0])+Re(this,Oe)[0]}applyConstraints(r,e){let t=Math.min(Math.max(r,Re(this,Oe)[0]),Re(this,Oe)[1]);return Re(this,Yt)&&(t=Math.round(t/Re(this,Yt))*Re(this,Yt)),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,Re(this,gt)[0]),this.endKnob&&this.updateKnob(this.endKnob,Re(this,gt)[1])}onKnobDrag(r){if(r.target instanceof sr||this.classList.contains("has-value")||this.classList.contains("has-focus")){let e;const t=i=>{let s=0;i.type==="touchmove"||i.type==="touchstart"?s=i.touches[0].clientX:s=i.clientX,s=s-this.track.getBoundingClientRect().left,e||(e=this.chooseKnob(s),e.classList.add("focus")),this.updateKnob(e,this.applyConstraints(this.toValueSpace(s),e.id==="start"))},n=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("touchmove",t),document.removeEventListener("mouseup",n),document.removeEventListener("touchend",n),e&&(e.classList.remove("focus"),this.range!==void 0?e.id==="end"?this.value=JSON.stringify([Re(this,gt)[0],e.value]):this.value=JSON.stringify([e.value,Re(this,gt)[1]]):this.value=String(e.value)),e=void 0};this.sliderElement.focus(),document.addEventListener("mousemove",t),document.addEventListener("touchmove",t),document.addEventListener("mouseup",n),document.addEventListener("touchend",n),t(r)}}renderInput(){return ct`
232
+ `];di([Ie()],sr.prototype,"resize",2);di([Ie()],sr.prototype,"rows",2);di([Ie()],sr.prototype,"cols",2);sr=di([ur("rokit-textarea")],sr);var Jh=Object.defineProperty,Kh=Object.getOwnPropertyDescriptor,Ac=r=>{throw TypeError(r)},Nt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Kh(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Jh(e,t,i),i},Dc=(r,e,t)=>e.has(r)||Ac("Cannot "+t),je=(r,e,t)=>(Dc(r,e,"read from private field"),t?t.call(r):e.get(r)),Gi=(r,e,t)=>e.has(r)?Ac("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Bn=(r,e,t,n)=>(Dc(r,e,"write to private field"),e.set(r,t),t),Me,At,vr;const qt=18;let Ot=class extends Ue{constructor(){super(...arguments),this.labelFormatter=r=>String(r),Gi(this,Me,[0,1]),Gi(this,At,[je(this,Me)[0],je(this,Me)[1]]),Gi(this,vr)}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")&&(je(this,Me)[0]=parseFloat(this.min||"0"),je(this,Me)[1]=Math.max(je(this,Me)[0],je(this,Me)[1])),r.has("max")&&(je(this,Me)[1]=parseFloat(this.max||"1"),je(this,Me)[0]=Math.min(je(this,Me)[0],je(this,Me)[1])),r.has("step")&&Bn(this,vr,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);Bn(this,At,[this.applyConstraints(e[0]),this.applyConstraints(e[1])])}else Bn(this,At,[this.applyConstraints(parseFloat(this.value))]);else Bn(this,At,[je(this,Me)[0],je(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===je(this,Me)[0]?e=this.endKnob:e.id==="end"&&e.value===je(this,Me)[1]&&(e=this.startKnob)),e}toScreenSpace(r){return(r-je(this,Me)[0])/(je(this,Me)[1]-je(this,Me)[0])*this.track.offsetWidth}toValueSpace(r){return r/this.track.offsetWidth*(je(this,Me)[1]-je(this,Me)[0])+je(this,Me)[0]}applyConstraints(r,e){let t=Math.min(Math.max(r,je(this,Me)[0]),je(this,Me)[1]);return je(this,vr)&&(t=Math.round(t/je(this,vr))*je(this,vr)),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,je(this,At)[0]),this.endKnob&&this.updateKnob(this.endKnob,je(this,At)[1])}onKnobDrag(r){if(r.target instanceof Tr||this.classList.contains("has-value")||this.classList.contains("has-focus")){let e;const t=i=>{let s=0;i.type==="touchmove"||i.type==="touchstart"?s=i.touches[0].clientX:s=i.clientX,s=s-this.track.getBoundingClientRect().left,e||(e=this.chooseKnob(s),e.classList.add("focus")),this.updateKnob(e,this.applyConstraints(this.toValueSpace(s),e.id==="start"))},n=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("touchmove",t),document.removeEventListener("mouseup",n),document.removeEventListener("touchend",n),e&&(e.classList.remove("focus"),this.range!==void 0?e.id==="end"?this.value=JSON.stringify([je(this,At)[0],e.value]):this.value=JSON.stringify([e.value,je(this,At)[1]]):this.value=String(e.value)),e=void 0};this.sliderElement.focus(),document.addEventListener("mousemove",t),document.addEventListener("touchmove",t),document.addEventListener("mouseup",n),document.addEventListener("touchend",n),t(r)}}renderInput(){return xt`
233
233
  ${super.renderInput()}
234
234
  <div id="slider" part="slider" tabindex="0" ?range="${this.range!==void 0}">
235
235
  <div id="track"></div>
236
236
  <rokit-slider-knob id="start"></rokit-slider-knob>
237
- ${this.range===void 0?De:ct`
237
+ ${this.range===void 0?Ve:xt`
238
238
  <rokit-slider-knob id="end"></rokit-slider-knob>
239
239
  `}
240
240
  </div>
241
- `}};Oe=new WeakMap;gt=new WeakMap;Yt=new WeakMap;mt.styles=[...ke.styles,vt`
241
+ `}};Me=new WeakMap;At=new WeakMap;vr=new WeakMap;Ot.styles=[...Ue.styles,jt`
242
242
  :host(.has-label:not(:focus):not(.has-value):not([sticky])) #slider > * { visibility: hidden; }
243
243
  :host(.has-label) .wrapper { padding-top: 1em; }
244
- :host([sticky]) #slider { margin-top: ${.25*It+22}px; }
244
+ :host([sticky]) #slider { margin-top: ${.25*qt+22}px; }
245
245
  #input { display: none; }
246
- #slider { display: flex; position: relative; align-items: center; width: 100%; height: ${It}px; padding: 0 ${It/2}px; outline: 0; }
246
+ #slider { display: flex; position: relative; align-items: center; width: 100%; height: ${qt}px; padding: 0 ${qt/2}px; outline: 0; }
247
247
  :host(:not([sticky])) #slider:not(:focus) rokit-slider-knob::part(label) { color: transparent; background-color: transparent; border-color: transparent; top: 0; }
248
248
  #track { height: 2px; flex-grow: 1; background-color: #CCC; }
249
249
  #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; }
250
- `];ht([ve()],mt.prototype,"range",2);ht([ve()],mt.prototype,"labelFormatter",2);ht([dt("#slider")],mt.prototype,"sliderElement",2);ht([dt("#track")],mt.prototype,"track",2);ht([dt("#start")],mt.prototype,"startKnob",2);ht([dt("#end")],mt.prototype,"endKnob",2);mt=ht([Gt("rokit-slider")],mt);let sr=class extends qt{constructor(){super(...arguments),this.offset=0,this.label="",this.value=0}updated(r){r.has("offset")&&(this.style.left=this.offset+"px")}render(){return ct`<label part="label">${this.label}</label>`}};sr.styles=[vt`
251
- :host { position: absolute; width: ${It}px; height: ${It}px; border-radius: ${It}px; background-color: var(--rokit-primary-color-inner); }
252
- :host(.focus), :host(:hover) { box-shadow: 0 0 0 ${It/2}px var(--rokit-primary-color-transparent-inner); z-index: 1; }
250
+ `];Nt([Ie()],Ot.prototype,"range",2);Nt([Ie()],Ot.prototype,"labelFormatter",2);Nt([Et("#slider")],Ot.prototype,"sliderElement",2);Nt([Et("#track")],Ot.prototype,"track",2);Nt([Et("#start")],Ot.prototype,"startKnob",2);Nt([Et("#end")],Ot.prototype,"endKnob",2);Ot=Nt([ur("rokit-slider")],Ot);let Tr=class extends nr{constructor(){super(...arguments),this.offset=0,this.label="",this.value=0}updated(r){r.has("offset")&&(this.style.left=this.offset+"px")}render(){return xt`<label part="label">${this.label}</label>`}};Tr.styles=[jt`
251
+ :host { position: absolute; width: ${qt}px; height: ${qt}px; border-radius: ${qt}px; background-color: var(--rokit-primary-color-inner); }
252
+ :host(.focus), :host(:hover) { box-shadow: 0 0 0 ${qt/2}px var(--rokit-primary-color-transparent-inner); z-index: 1; }
253
253
  label {
254
254
  position: absolute;
255
- top: calc(-2em - ${It/4}px);
255
+ top: calc(-2em - ${qt/4}px);
256
256
  left: 50%;
257
257
  transform: translate(-50%, 0);
258
258
  white-space: nowrap;
@@ -277,34 +277,60 @@ a, a:visited { color: inherit; }
277
277
  background-color: inherit;
278
278
  clip-path: polygon(50% 50%, 100% 50%, 50% 100%, 0 50%);
279
279
  }
280
- `];ht([ve()],sr.prototype,"offset",2);ht([ve()],sr.prototype,"label",2);sr=ht([Gt("rokit-slider-knob")],sr);class Sn extends HTMLElement{constructor(e,t,n,i){if(super(),this.template=new cd(n.store.getQuads(e,null,null,null),t,n),this.template.extendedShapes.length&&this.template.config.attributes.collapse!==null&&(!this.template.maxCount||this.template.maxCount>1)){const s=new Qe;s.classList.add("collapsible","shacl-group"),s.open=n.attributes.collapse==="open",s.label=this.template.label,this.container=s}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),n.editMode&&!t.linked&&(this.addButton=this.createAddButton(),this.container.appendChild(this.addButton)),this.template.path){let s=[];i&&(t.linked?s=n.store.getQuads(i,this.template.path,null,null):s=n.store.getQuads(i,this.template.path,null,ut));let a=!1;for(const o of s)this.isValueValid(o.object)&&(this.addPropertyInstance(o.object),this.template.hasValue&&o.object.equals(this.template.hasValue)&&(a=!0));n.editMode&&this.template.hasValue&&!a&&!t.linked&&this.addPropertyInstance(this.template.hasValue)}n.editMode&&!t.linked&&(this.addEventListener("change",()=>{this.updateControls()}),this.updateControls()),this.container instanceof Qe&&(n.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 n=this.template.shaclOr?.length?this.template.shaclOr:this.template.shaclXone;let i=!1;if(e){const s=od(n,e,this.template.config);s.length&&(t=gn(this.template.clone().merge(s),e,!0),i=!0)}i||(t=Au(n,this,this.template.config),Ju(t,""))}else{let n=!1;if(e&&!(e instanceof Ze)){const i=this.getRdfClassToLinkOrCreate();i&&this.template.config.store.countQuads(e,Ue,i,ut)===0&&(n=!0)}t=gn(this.template,e,void 0,n||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 n=this.template.maxCount===void 0||e<this.template.maxCount;this.classList.toggle("may-remove",t),this.classList.toggle("may-add",n),n&&this.addButton?.input&&this.addButton.input.updateMinWidth()}toRDF(e,t){for(const n of this.querySelectorAll(":scope > .property-instance, :scope > .collapsible > .property-instance")){const i=xe.namedNode(n.dataset.path);if(n.firstChild instanceof Nt){const s=n.firstChild.toRDF(e);e.addQuad(t,i,s,this.template.config.valuesGraphId)}else for(const s of n.querySelectorAll(":scope > .editor")){const a=yd(s);a&&e.addQuad(t,i,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,Wr,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 n=this.template.config.store.getObjects(t,Wr,null);for(const i of n)if(this.template.config.store.countQuads(e,Ue,i,null)>0)return!0}return!1}createAddButton(){const e=new Me;e.dense=!0,e.label="+ "+this.template.label,e.title="Add "+this.template.label,e.classList.add("add-button");let t=[],n=this.getRdfClassToLinkOrCreate();if(n&&(t=Qs(n,this.template)),t.length===0)e.emptyMessage="",e.inputMinWidth=0,e.addEventListener("click",i=>{e.blur();const s=this.addPropertyInstance();s.classList.add("fadeIn"),this.updateControls(),setTimeout(()=>{ad(s),s.classList.remove("fadeIn")},200)});else{const i=document.createElement("ul"),s=document.createElement("li");s.innerHTML="&#xFF0B; Create new "+this.template.label+"...",s.dataset.value="new",s.classList.add("large"),i.appendChild(s);const a=document.createElement("li");a.classList.add("divider"),i.appendChild(a);const o=document.createElement("li");o.classList.add("header"),o.innerText="Or link existing:",i.appendChild(o);for(const l of t){const d=document.createElement("li"),h=typeof l.value=="string"?l.value:l.value.value;d.innerText=l.label?l.label:h,d.dataset.value=JSON.stringify(l.value),i.appendChild(d)}e.appendChild(i),e.collapsibleWidth="250px",e.collapsibleOrientationLeft="",e.addEventListener("change",()=>{if(e.value==="new")this.addPropertyInstance();else{const l=JSON.parse(e.value);this.container.insertBefore(gn(this.template,l,!0,!0),e)}e.value=""})}return e}}function gn(r,e,t=!1,n=!1){let i;if(r.extendedShapes.length){i=document.createElement("div"),i.classList.add("property-instance");for(const s of r.extendedShapes)i.appendChild(new Nt(s,r.config,e,r.parent,r.nodeKind,r.label,n))}else{const s=wd(r.path,r.datatype?.value);s?r.config.editMode&&!n?i=s.createEditor(r,e):i=s.createViewer(r,e):i=hd(r,e||null,r.config.editMode&&!n),i.classList.add("property-instance"),n&&i.classList.add("linked")}return r.config.editMode&&Ju(i,r.label,t),i.dataset.path=r.path,i}function Ju(r,e,t=!1){const n=new ir;n.classList.add("remove-button","clear"),n.title="Remove "+e,n.dense=!0,n.icon=!0,n.addEventListener("click",i=>{r.classList.remove("fadeIn"),r.classList.add("fadeOut"),setTimeout(()=>{const s=r.parentElement;r.remove(),s?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},200)}),t&&n.classList.add("persistent"),r.appendChild(n)}window.customElements.define("shacl-property",Sn);function vf(r,e){let t=r;const n=e.store.getQuads(r,null,null,null),i=Fr(n,"label",Gs,e.languages);i&&(t=i);let s;if(e.attributes.collapse!==null)s=new Qe,s.classList.add("collapsible"),s.open=e.attributes.collapse==="open",s.label=t;else{s=document.createElement("div");const o=document.createElement("h1");o.innerText=t,s.appendChild(o)}s.dataset.subject=r,s.classList.add("shacl-group");const a=Fr(n,"order");return a&&(s.style.order=a),s}const Ce=[];for(let r=0;r<256;++r)Ce.push((r+256).toString(16).slice(1));function _f(r,e=0){return(Ce[r[e+0]]+Ce[r[e+1]]+Ce[r[e+2]]+Ce[r[e+3]]+"-"+Ce[r[e+4]]+Ce[r[e+5]]+"-"+Ce[r[e+6]]+Ce[r[e+7]]+"-"+Ce[r[e+8]]+Ce[r[e+9]]+"-"+Ce[r[e+10]]+Ce[r[e+11]]+Ce[r[e+12]]+Ce[r[e+13]]+Ce[r[e+14]]+Ce[r[e+15]]).toLowerCase()}let vi;const xf=new Uint8Array(16);function Sf(){if(!vi){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");vi=crypto.getRandomValues.bind(crypto)}return vi(xf)}const Ef=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Oo={randomUUID:Ef};function $o(r,e,t){if(Oo.randomUUID&&!r)return Oo.randomUUID();r=r||{};const n=r.random??r.rng?.()??Sf();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,_f(n)}class Nt extends HTMLElement{constructor(e,t,n,i,s,a,o){super(),this.owlImports=[],this.parent=i,this.config=t,this.shaclSubject=e,this.linked=o||!1;let l=n;if(!l){if(!s){const h=t.store.getObjects(e,`${be}nodeKind`,null);h.length&&(s=h[0])}s===void 0&&t.attributes.valuesNamespace||s?.value===`${be}IRI`?l=xe.namedNode(t.attributes.valuesNamespace+$o()):l=xe.blankNode($o())}this.nodeId=l;const d=JSON.stringify([e,n]);if(n&&t.renderedNodes.has(d)){a=a||"Link";const h=document.createElement("label");h.innerText=a,h.classList.add("linked"),this.appendChild(h);const y=document.createElement("a");let w=n.termType==="BlankNode"?"_:"+n.value:n.value;y.innerText=w,y.classList.add("ref-link"),y.onclick=()=>{this.config.form.querySelector(`shacl-node[data-node-id='${w}']`)?.scrollIntoView()},this.appendChild(y),this.style.flexDirection="row"}else{if(n&&t.renderedNodes.add(d),this.dataset.nodeId=this.nodeId.id,this.config.attributes.showNodeIds!==null){const h=document.createElement("div");h.innerText=`id: ${this.nodeId.id}`,h.classList.add("node-id-display"),this.appendChild(h)}for(const h of t.store.getQuads(e,zs,null,null))this.owlImports.push(h.object);for(const h of t.store.getQuads(e,null,null,null))switch(h.predicate.id){case vn.id:this.addPropertyInstance(h.object,t,n);break;case`${be}and`:const y=t.lists[h.object.value];if(y?.length)for(const w of y)this.prepend(new Nt(w,t,n,this));else console.error("list not found:",h.object.value,"existing lists:",t.lists);break;case`${be}node`:this.prepend(new Nt(h.object,t,n,this));break;case`${be}targetClass`:this.targetClass=h.object;break;case`${be}or`:this.tryResolve(h.object,n,t);break;case`${be}xone`:this.tryResolve(h.object,n,t);break}if(a){const h=document.createElement("h1");h.innerText=a,this.prepend(h)}}}toRDF(e,t){if(t||(t=this.nodeId),!this.linked){for(const n of this.querySelectorAll(":scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property"))n.toRDF(e,t);this.targetClass&&e.addQuad(t,Ue,this.targetClass,this.config.valuesGraphId),this.config.attributes.generateNodeShapeReference&&!this.parent&&e.addQuad(t,xe.namedNode(this.config.attributes.generateNodeShapeReference),this.shaclSubject,this.config.valuesGraphId)}return t}addPropertyInstance(e,t,n){let i=this;const s=t.store.getQuads(e,`${be}group`,null,null);if(s.length>0){const o=s[0].object.value;if(t.groups.indexOf(o)>-1){let l=this.querySelector(`:scope > .shacl-group[data-subject='${o}']`);l||(l=vf(o,t),this.appendChild(l)),i=l}else console.warn("ignoring unknown group reference",s[0],"existing groups:",t.groups)}const a=new Sn(e,this,t,n);a.childElementCount>0&&i.appendChild(a)}tryResolve(e,t,n){const i=n.lists[e.value];if(i?.length){let s=!1;if(t){const a=ld(i,t,n);if(a.length){for(const o of a)this.addPropertyInstance(o,n,t);s=!0}}s||this.appendChild(Au(i,this,n))}else console.error("list for sh:or/sh:xone not found:",e,"existing lists:",n.lists)}}window.customElements.define("shacl-node",Nt);var _i={},xi,ko;function sa(){return ko||(ko=1,xi=class Qu{constructor(e,t=new Map,n=0){this.prefix=e,this._existing=t,this.counter=n}clone(){const{prefix:e,_existing:t,counter:n}=this;return new Qu(e,new Map(t),n)}getId(e){const t=e&&this._existing.get(e);if(t)return t;const n=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,n),n}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}}),xi}var Si={},Do;function If(){return Do||(Do=1,function(r,e){if(r.setImmediate)return;var t=1,n={},i=!1,s=r.document,a;function o(I){typeof I!="function"&&(I=new Function(""+I));for(var b=new Array(arguments.length-1),c=0;c<b.length;c++)b[c]=arguments[c+1];var p={callback:I,args:b};return n[t]=p,a(t),t++}function l(I){delete n[I]}function d(I){var b=I.callback,c=I.args;switch(c.length){case 0:b();break;case 1:b(c[0]);break;case 2:b(c[0],c[1]);break;case 3:b(c[0],c[1],c[2]);break;default:b.apply(e,c);break}}function h(I){if(i)setTimeout(h,0,I);else{var b=n[I];if(b){i=!0;try{d(b)}finally{l(I),i=!1}}}}function y(){a=function(I){process.nextTick(function(){h(I)})}}function w(){if(r.postMessage&&!r.importScripts){var I=!0,b=r.onmessage;return r.onmessage=function(){I=!1},r.postMessage("","*"),r.onmessage=b,I}}function g(){var I="setImmediate$"+Math.random()+"$",b=function(c){c.source===r&&typeof c.data=="string"&&c.data.indexOf(I)===0&&h(+c.data.slice(I.length))};r.addEventListener?r.addEventListener("message",b,!1):r.attachEvent("onmessage",b),a=function(c){r.postMessage(I+c,"*")}}function m(){var I=new MessageChannel;I.port1.onmessage=function(b){var c=b.data;h(c)},a=function(b){I.port2.postMessage(b)}}function _(){var I=s.documentElement;a=function(b){var c=s.createElement("script");c.onreadystatechange=function(){h(b),c.onreadystatechange=null,I.removeChild(c),c=null},I.appendChild(c)}}function x(){a=function(I){setTimeout(h,0,I)}}var S=Object.getPrototypeOf&&Object.getPrototypeOf(r);S=S&&S.setTimeout?S:r,{}.toString.call(r.process)==="[object process]"?y():w()?g():r.MessageChannel?m():s&&"onreadystatechange"in s.createElement("script")?_():x(),S.setImmediate=o,S.clearImmediate=l}(typeof self>"u"?typeof Zt>"u"?Si:Zt:self)),Si}/*!
280
+ `];Nt([Ie()],Tr.prototype,"offset",2);Nt([Ie()],Tr.prototype,"label",2);Tr=Nt([ur("rokit-slider-knob")],Tr);class ei extends HTMLElement{constructor(e,t,n,i){if(super(),this.template=new Hd(n.store.getQuads(e,null,null,null),t,n),this.template.extendedShapes.length&&this.template.config.attributes.collapse!==null&&(!this.template.maxCount||this.template.maxCount>1)){const s=new ot;s.classList.add("collapsible","shacl-group"),s.open=n.attributes.collapse==="open",s.label=this.template.label,this.container=s}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),n.editMode&&!t.linked&&(this.addButton=this.createAddButton(),this.container.appendChild(this.addButton)),this.template.path){let s=[];i&&(t.linked?s=n.store.getQuads(i,this.template.path,null,null):s=n.store.getQuads(i,this.template.path,null,vt));let a=!1;for(const o of s)this.isValueValid(o.object)&&(this.addPropertyInstance(o.object),this.template.hasValue&&o.object.equals(this.template.hasValue)&&(a=!0));n.editMode&&this.template.hasValue&&!a&&!t.linked&&this.addPropertyInstance(this.template.hasValue)}n.editMode&&!t.linked&&(this.addEventListener("change",()=>{this.updateControls()}),this.updateControls()),this.container instanceof ot&&(n.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 n=this.template.shaclOr?.length?this.template.shaclOr:this.template.shaclXone;let i=!1;if(e){const s=Bd(n,e,this.template.config);s.length&&(t=Wn(this.template.clone().merge(s),e,!0),i=!0)}i||(t=hc(n,this,this.template.config),Oc(t,""))}else{let n=!1;if(e&&!(e instanceof ct)){const i=this.getRdfClassToLinkOrCreate();i&&this.template.config.store.countQuads(e,tt,i,vt)===0&&(n=!0)}t=Wn(this.template,e,void 0,n||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 n=this.template.maxCount===void 0||e<this.template.maxCount;this.classList.toggle("may-remove",t),this.classList.toggle("may-add",n),n&&this.addButton?.input&&this.addButton.input.updateMinWidth()}toRDF(e,t){for(const n of this.querySelectorAll(":scope > .property-instance, :scope > .collapsible > .property-instance")){const i=Re.namedNode(n.dataset.path);if(n.firstChild instanceof Ht){const s=n.firstChild.toRDF(e);e.addQuad(t,i,s,this.template.config.valuesGraphId)}else for(const s of n.querySelectorAll(":scope > .editor")){const a=Qd(s);a&&e.addQuad(t,i,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,_n,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 n=this.template.config.store.getObjects(t,_n,null);for(const i of n)if(this.template.config.store.countQuads(e,tt,i,null)>0)return!0}return!1}createAddButton(){const e=new We;e.dense=!0,e.label="+ "+this.template.label,e.title="Add "+this.template.label,e.classList.add("add-button");let t=[],n=this.getRdfClassToLinkOrCreate();if(n&&(t=Sa(n,this.template)),t.length===0)e.emptyMessage="",e.inputMinWidth=0,e.addEventListener("click",i=>{e.blur();const s=this.addPropertyInstance();s.classList.add("fadeIn"),this.updateControls(),setTimeout(()=>{Md(s),s.classList.remove("fadeIn")},200)});else{const i=document.createElement("ul"),s=document.createElement("li");s.innerHTML="&#xFF0B; Create new "+this.template.label+"...",s.dataset.value="new",s.classList.add("large"),i.appendChild(s);const a=document.createElement("li");a.classList.add("divider"),i.appendChild(a);const o=document.createElement("li");o.classList.add("header"),o.innerText="Or link existing:",i.appendChild(o);for(const u of t){const l=document.createElement("li"),c=typeof u.value=="string"?u.value:u.value.value;l.innerText=u.label?u.label:c,l.dataset.value=JSON.stringify(u.value),i.appendChild(l)}e.appendChild(i),e.collapsibleWidth="250px",e.collapsibleOrientationLeft="",e.addEventListener("change",()=>{if(e.value==="new")this.addPropertyInstance();else{const u=JSON.parse(e.value);this.container.insertBefore(Wn(this.template,u,!0,!0),e)}e.value=""})}return e}}function Wn(r,e,t=!1,n=!1){let i;if(r.extendedShapes.length){i=document.createElement("div"),i.classList.add("property-instance");for(const s of r.extendedShapes)i.appendChild(new Ht(s,r.config,e,r.parent,r.nodeKind,r.label,n))}else{const s=Yd(r.path,r.datatype?.value);s?r.config.editMode&&!n?i=s.createEditor(r,e):i=s.createViewer(r,e):i=Wd(r,e||null,r.config.editMode&&!n),i.classList.add("property-instance"),n&&i.classList.add("linked")}return r.config.editMode&&Oc(i,r.label,t),i.dataset.path=r.path,i}function Oc(r,e,t=!1){const n=new Rr;n.classList.add("remove-button","clear"),n.title="Remove "+e,n.dense=!0,n.icon=!0,n.addEventListener("click",i=>{r.classList.remove("fadeIn"),r.classList.add("fadeOut"),setTimeout(()=>{const s=r.parentElement;r.remove(),s?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},200)}),t&&n.classList.add("persistent"),r.appendChild(n)}window.customElements.define("shacl-property",ei);function Yh(r,e){let t=r;const n=e.store.getQuads(r,null,null,null),i=pn(n,"label",wa,e.languages);i&&(t=i);let s;if(e.attributes.collapse!==null)s=new ot,s.classList.add("collapsible"),s.open=e.attributes.collapse==="open",s.label=t;else{s=document.createElement("div");const o=document.createElement("h1");o.innerText=t,s.appendChild(o)}s.dataset.subject=r,s.classList.add("shacl-group");const a=pn(n,"order");return a&&(s.style.order=a),s}const Je=[];for(let r=0;r<256;++r)Je.push((r+256).toString(16).slice(1));function Zh(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 Wi;const ef=new Uint8Array(16);function tf(){if(!Wi){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Wi=crypto.getRandomValues.bind(crypto)}return Wi(ef)}const rf=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),tl={randomUUID:rf};function rl(r,e,t){if(tl.randomUUID&&!r)return tl.randomUUID();r=r||{};const n=r.random??r.rng?.()??tf();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Zh(n)}class Ht extends HTMLElement{constructor(e,t,n,i,s,a,o){super(),this.owlImports=[],this.parent=i,this.config=t,this.shaclSubject=e,this.linked=o||!1;let u=n;if(!u){if(!s){const c=t.store.getObjects(e,`${xe}nodeKind`,null);c.length&&(s=c[0])}s===void 0&&t.attributes.valuesNamespace||s?.value===`${xe}IRI`?u=Re.namedNode(t.attributes.valuesNamespace+rl()):u=Re.blankNode(rl())}this.nodeId=u;const l=JSON.stringify([e,n]);if(n&&t.renderedNodes.has(l)){a=a||"Link";const c=document.createElement("label");c.innerText=a,c.classList.add("linked"),this.appendChild(c);const d=document.createElement("a");let m=n.termType==="BlankNode"?"_:"+n.value:n.value;d.innerText=m,d.classList.add("ref-link"),d.onclick=()=>{this.config.form.querySelector(`shacl-node[data-node-id='${m}']`)?.scrollIntoView()},this.appendChild(d),this.style.flexDirection="row"}else{if(n&&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,xa,null,null))this.owlImports.push(c.object);for(const c of t.store.getQuads(e,null,null,null))switch(c.predicate.id){case Kn.id:this.addPropertyInstance(c.object,t,n);break;case`${xe}and`:const d=t.lists[c.object.value];if(d?.length)for(const m of d)this.prepend(new Ht(m,t,n,this));else console.error("list not found:",c.object.value,"existing lists:",t.lists);break;case`${xe}node`:this.prepend(new Ht(c.object,t,n,this));break;case`${xe}targetClass`:this.targetClass=c.object;break;case`${xe}or`:this.tryResolve(c.object,n,t);break;case`${xe}xone`:this.tryResolve(c.object,n,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 n of this.querySelectorAll(":scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property"))n.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,n){let i=this;const s=t.store.getQuads(e,`${xe}group`,null,null);if(s.length>0){const o=s[0].object.value;if(t.groups.indexOf(o)>-1){let u=this.querySelector(`:scope > .shacl-group[data-subject='${o}']`);u||(u=Yh(o,t),this.appendChild(u)),i=u}else console.warn("ignoring unknown group reference",s[0],"existing groups:",t.groups)}const a=new ei(e,this,t,n);a.childElementCount>0&&i.appendChild(a)}tryResolve(e,t,n){const i=n.lists[e.value];if(i?.length){let s=!1;if(t){const a=qd(i,t,n);if(a.length){for(const o of a)this.addPropertyInstance(o,n,t);s=!0}}s||this.appendChild(hc(i,this,n))}else console.error("list for sh:or/sh:xone not found:",e,"existing lists:",n.lists)}}window.customElements.define("shacl-node",Ht);var zt={},Xt={},Qt={},Tt={},nl;function nf(){if(nl)return Tt;nl=1,Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.removeDotSegmentsOfPath=Tt.removeDotSegments=Tt.resolve=void 0;function r(i,s){s=s||"";const a=s.indexOf("#");if(a>0&&(s=s.substr(0,a)),!i.length){if(s.indexOf(":")<0)throw new Error(`Found invalid baseIRI '${s}' for value '${i}'`);return s}if(i.startsWith("?")){const b=s.indexOf("?");return b>0&&(s=s.substr(0,b)),s+i}if(i.startsWith("#"))return s+i;if(!s.length){const b=i.indexOf(":");if(b<0)throw new Error(`Found invalid relative IRI '${i}' for a missing baseIRI`);return t(i,b)}const o=i.indexOf(":");if(o>=0)return t(i,o);const u=s.indexOf(":");if(u<0)throw new Error(`Found invalid baseIRI '${s}' for value '${i}'`);const l=s.substr(0,u+1);if(i.indexOf("//")===0)return l+t(i,o);let c;if(s.indexOf("//",u)===u+1){if(c=s.indexOf("/",u+3),c<0)return s.length>u+3?s+"/"+t(i,o):l+t(i,o)}else if(c=s.indexOf("/",u+1),c<0)return l+t(i,o);if(i.indexOf("/")===0)return s.substr(0,c)+e(i);let d=s.substr(c);const m=d.lastIndexOf("/");return m>=0&&m<d.length-1&&(d=d.substr(0,m+1),i[0]==="."&&i[1]!=="."&&i[1]!=="/"&&i[2]&&(i=i.substr(1))),i=d+i,i=e(i),s.substr(0,c)+i}Tt.resolve=r;function e(i){const s=[];let a=0;for(;a<i.length;)switch(i[a]){case"/":if(i[a+1]===".")if(i[a+2]==="."){if(!n(i[a+3])){s.push([]),a++;break}s.pop(),i[a+3]||s.push([]),a+=3}else{if(!n(i[a+2])){s.push([]),a++;break}i[a+2]||s.push([]),a+=2}else s.push([]),a++;break;case"#":case"?":s.length||s.push([]),s[s.length-1].push(i.substr(a)),a=i.length;break;default:s.length||s.push([]),s[s.length-1].push(i[a]),a++;break}return"/"+s.map(o=>o.join("")).join("/")}Tt.removeDotSegments=e;function t(i,s){let a=s+1;s>=0?i[s+1]==="/"&&i[s+2]==="/"&&(a=s+3):i[0]==="/"&&i[1]==="/"&&(a=2);const o=i.indexOf("/",a);if(o<0)return i;const u=i.substr(0,o),l=i.substr(o);return u+e(l)}Tt.removeDotSegmentsOfPath=t;function n(i){return!i||i==="#"||i==="?"||i==="/"}return Tt}var il;function sf(){return il||(il=1,function(r){var e=Qt&&Qt.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s),Object.defineProperty(n,a,{enumerable:!0,get:function(){return i[s]}})}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=Qt&&Qt.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(nf(),r)}(Qt)),Qt}var Jt={},zi={},sl;function af(){return sl||(sl=1,function(r){/**
281
+ * Character classes and associated utilities for the 5th edition of XML 1.0.
282
+ *
283
+ * @author Louis-Dominique Dubeau
284
+ * @license MIT
285
+ * @copyright Louis-Dominique Dubeau
286
+ */Object.defineProperty(r,"__esModule",{value:!0}),r.CHAR=`
287
+ \r -퟿-�𐀀-􏿿`,r.S=` \r
288
+ `,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.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,n=13,i=32;r.S_LIST=[i,t,n,e];function s(l){return l>=i&&l<=55295||l===t||l===n||l===e||l>=57344&&l<=65533||l>=65536&&l<=1114111}r.isChar=s;function a(l){return l===i||l===t||l===n||l===e}r.isS=a;function o(l){return l>=65&&l<=90||l>=97&&l<=122||l===58||l===95||l===8204||l===8205||l>=192&&l<=214||l>=216&&l<=246||l>=248&&l<=767||l>=880&&l<=893||l>=895&&l<=8191||l>=8304&&l<=8591||l>=11264&&l<=12271||l>=12289&&l<=55295||l>=63744&&l<=64975||l>=65008&&l<=65533||l>=65536&&l<=983039}r.isNameStartChar=o;function u(l){return o(l)||l>=48&&l<=57||l===45||l===46||l===183||l>=768&&l<=879||l>=8255&&l<=8256}r.isNameChar=u}(zi)),zi}var Xi={},al;function of(){return al||(al=1,function(r){/**
289
+ * Character classes and associated utilities for the 2nd edition of XML 1.1.
290
+ *
291
+ * @author Louis-Dominique Dubeau
292
+ * @license MIT
293
+ * @copyright Louis-Dominique Dubeau
294
+ */Object.defineProperty(r,"__esModule",{value:!0}),r.CHAR="-퟿-�𐀀-􏿿",r.RESTRICTED_CHAR="-\b\v\f--„†-Ÿ",r.S=` \r
295
+ `,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,n=13,i=32;r.S_LIST=[i,t,n,e];function s(d){return d>=1&&d<=55295||d>=57344&&d<=65533||d>=65536&&d<=1114111}r.isChar=s;function a(d){return d>=1&&d<=8||d===11||d===12||d>=14&&d<=31||d>=127&&d<=132||d>=134&&d<=159}r.isRestrictedChar=a;function o(d){return d===9||d===10||d===13||d>31&&d<127||d===133||d>159&&d<=55295||d>=57344&&d<=65533||d>=65536&&d<=1114111}r.isCharAndNotRestricted=o;function u(d){return d===i||d===t||d===n||d===e}r.isS=u;function l(d){return d>=65&&d<=90||d>=97&&d<=122||d===58||d===95||d===8204||d===8205||d>=192&&d<=214||d>=216&&d<=246||d>=248&&d<=767||d>=880&&d<=893||d>=895&&d<=8191||d>=8304&&d<=8591||d>=11264&&d<=12271||d>=12289&&d<=55295||d>=63744&&d<=64975||d>=65008&&d<=65533||d>=65536&&d<=983039}r.isNameStartChar=l;function c(d){return l(d)||d>=48&&d<=57||d===45||d===46||d===183||d>=768&&d<=879||d>=8255&&d<=8256}r.isNameChar=c}(Xi)),Xi}var Qi={},ol;function lf(){return ol||(ol=1,function(r){/**
296
+ * Character class utilities for XML NS 1.0 edition 3.
297
+ *
298
+ * @author Louis-Dominique Dubeau
299
+ * @license MIT
300
+ * @copyright Louis-Dominique Dubeau
301
+ */Object.defineProperty(r,"__esModule",{value:!0}),r.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",r.NC_NAME_CHAR="-"+r.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.NC_NAME_START_CHAR_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]$","u"),r.NC_NAME_CHAR_RE=new RegExp("^["+r.NC_NAME_CHAR+"]$","u"),r.NC_NAME_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]["+r.NC_NAME_CHAR+"]*$","u");function e(n){return n>=65&&n<=90||n===95||n>=97&&n<=122||n>=192&&n<=214||n>=216&&n<=246||n>=248&&n<=767||n>=880&&n<=893||n>=895&&n<=8191||n>=8204&&n<=8205||n>=8304&&n<=8591||n>=11264&&n<=12271||n>=12289&&n<=55295||n>=63744&&n<=64975||n>=65008&&n<=65533||n>=65536&&n<=983039}r.isNCNameStartChar=e;function t(n){return e(n)||n===45||n===46||n>=48&&n<=57||n===183||n>=768&&n<=879||n>=8255&&n<=8256}r.isNCNameChar=t}(Qi)),Qi}var ll;function uf(){if(ll)return Jt;ll=1,Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.SaxesParser=Jt.EVENTS=void 0;const r=af(),e=of(),t=lf();var n=r.isS,i=r.isChar,s=r.isNameStartChar,a=r.isNameChar,o=r.S_LIST,u=r.NAME_RE,l=e.isChar,c=t.isNCNameStartChar,d=t.isNCNameChar,m=t.NC_NAME_RE;const b="http://www.w3.org/XML/1998/namespace",_="http://www.w3.org/2000/xmlns/",x={__proto__:null,xml:b,xmlns:_},E={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},v=-1,S=-2,y=0,h=1,g=2,I=3,C=4,A=5,B=6,R=7,F=8,q=9,D=10,O=11,te=12,T=13,Z=14,k=15,Y=16,w=17,H=18,K=19,X=20,ue=21,V=22,G=23,z=24,U=25,ee=26,re=27,fe=28,ge=29,j=30,W=31,se=32,he=33,pe=34,me=35,J=36,ce=37,ye=38,le=39,Ne=40,ze=41,Se=42,Qe=43,N=44,f=9,p=10,$=13,Q=32,oe=33,de=34,Ee=38,ke=39,Oe=45,Le=47,De=59,gt=60,Ft=61,qe=62,He=63,Rn=91,kt=93,fr=133,Fr=8232,L=Ge=>Ge===de||Ge===ke,M=[de,ke],be=[...M,Rn,qe],_e=[...M,gt,kt],ve=[Ft,He,...o],Xe=[...o,qe,Ee,gt];function Ye(Ge,P,ne){switch(P){case"xml":ne!==b&&Ge.fail(`xml prefix must be bound to ${b}.`);break;case"xmlns":ne!==_&&Ge.fail(`xmlns prefix must be bound to ${_}.`);break}switch(ne){case _:Ge.fail(P===""?`the default namespace may not be set to ${ne}.`:`may not assign a prefix (even "xmlns") to the URI ${_}.`);break;case b:switch(P){case"xml":break;case"":Ge.fail(`the default namespace may not be set to ${ne}.`);break;default:Ge.fail("may not assign the xml namespace to another prefix.")}break}}function Tn(Ge,P){for(const ne of Object.keys(P))Ye(Ge,ne,P[ne])}const It=Ge=>m.test(Ge),An=Ge=>u.test(Ge),Rt=0,kr=1,pr=2;Jt.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 Pr{get closed(){return this._closed}constructor(P){this.opt=P??{},this.fragmentOpt=!!this.opt.fragment;const ne=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,ne){this.nameStartCheck=c,this.nameCheck=d,this.isName=It,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},x);const ie=this.opt.additionalNamespaces;ie!=null&&(Tn(this,ie),Object.assign(this.ns,ie))}else this.nameStartCheck=s,this.nameCheck=a,this.isName=An,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=Rt,this.attribList=[];const{fragmentOpt:ne}=this;this.state=ne?T:y,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=ne,this.xmlDeclPossible=!ne,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:ie}=this.opt;if(ie===void 0){if(this.opt.forceXMLVersion===!0)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");ie="1.0"}this.setXMLVersion(ie),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(E),(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,ne){this[gr[P]]=ne}off(P){this[gr[P]]=void 0}makeError(P){var ne;let ie=(ne=this.fileName)!==null&&ne!==void 0?ne:"";return this.trackPosition&&(ie.length>0&&(ie+=":"),ie+=`${this.line}:${this.column}`),ie.length>0&&(ie+=": "),new Error(ie+P)}fail(P){const ne=this.makeError(P),ie=this.errorHandler;if(ie===void 0)throw ne;return ie(ne),this}write(P){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let ne=!1;P===null?(ne=!0,P=""):typeof P=="object"&&(P=P.toString()),this.carriedFromPrevious!==void 0&&(P=`${this.carriedFromPrevious}${P}`,this.carriedFromPrevious=void 0);let ie=P.length;const we=P.charCodeAt(ie-1);!ne&&(we===$||we>=55296&&we<=56319)&&(this.carriedFromPrevious=P[ie-1],ie--,P=P.slice(0,ie));const{stateTable:Ae}=this;for(this.chunk=P,this.i=0;this.i<ie;)Ae[this.state].call(this);return this.chunkPosition+=ie,ne?this.end():this}close(){return this.write(null)}getCode10(){const{chunk:P,i:ne}=this;if(this.prevI=ne,this.i=ne+1,ne>=P.length)return v;const ie=P.charCodeAt(ne);if(this.column++,ie<55296){if(ie>=Q||ie===f)return ie;switch(ie){case p:return this.line++,this.column=0,this.positionAtNewLine=this.position,p;case $:return P.charCodeAt(ne+1)===p&&(this.i=ne+2),this.line++,this.column=0,this.positionAtNewLine=this.position,S;default:return this.fail("disallowed character."),ie}}if(ie>56319)return ie>=57344&&ie<=65533||this.fail("disallowed character."),ie;const we=65536+(ie-55296)*1024+(P.charCodeAt(ne+1)-56320);return this.i=ne+2,we>1114111&&this.fail("disallowed character."),we}getCode11(){const{chunk:P,i:ne}=this;if(this.prevI=ne,this.i=ne+1,ne>=P.length)return v;const ie=P.charCodeAt(ne);if(this.column++,ie<55296){if(ie>31&&ie<127||ie>159&&ie!==Fr||ie===f)return ie;switch(ie){case p:return this.line++,this.column=0,this.positionAtNewLine=this.position,p;case $:{const Ae=P.charCodeAt(ne+1);(Ae===p||Ae===fr)&&(this.i=ne+2)}case fr:case Fr:return this.line++,this.column=0,this.positionAtNewLine=this.position,S;default:return this.fail("disallowed character."),ie}}if(ie>56319)return ie>=57344&&ie<=65533||this.fail("disallowed character."),ie;const we=65536+(ie-55296)*1024+(P.charCodeAt(ne+1)-56320);return this.i=ne+2,we>1114111&&this.fail("disallowed character."),we}getCodeNorm(){const P=this.getCode();return P===S?p:P}unget(){this.i=this.prevI,this.column--}captureTo(P){let{i:ne}=this;const{chunk:ie}=this;for(;;){const we=this.getCode(),Ae=we===S,Ce=Ae?p:we;if(Ce===v||P.includes(Ce))return this.text+=ie.slice(ne,this.prevI),Ce;Ae&&(this.text+=`${ie.slice(ne,this.prevI)}
302
+ `,ne=this.i)}}captureToChar(P){let{i:ne}=this;const{chunk:ie}=this;for(;;){let we=this.getCode();switch(we){case S:this.text+=`${ie.slice(ne,this.prevI)}
303
+ `,ne=this.i,we=p;break;case v:return this.text+=ie.slice(ne),!1}if(we===P)return this.text+=ie.slice(ne,this.prevI),!0}}captureNameChars(){const{chunk:P,i:ne}=this;for(;;){const ie=this.getCode();if(ie===v)return this.name+=P.slice(ne),v;if(!a(ie))return this.name+=P.slice(ne,this.prevI),ie===S?p:ie}}skipSpaces(){for(;;){const P=this.getCodeNorm();if(P===v||!n(P))return P}}setXMLVersion(P){this.currentXMLVersion=P,P==="1.0"?(this.isChar=i,this.getCode=this.getCode10):(this.isChar=l,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=h}sBeginWhitespace(){const P=this.i,ne=this.skipSpaces();switch(this.prevI!==P&&(this.xmlDeclPossible=!1),ne){case gt:if(this.state=k,this.text.length!==0)throw new Error("no-empty text at start");break;case v:break;default:this.unget(),this.state=T,this.xmlDeclPossible=!1}}sDoctype(){var P;const ne=this.captureTo(be);switch(ne){case qe:{(P=this.doctypeHandler)===null||P===void 0||P.call(this,this.text),this.text="",this.state=T,this.doctype=!0;break}case v:break;default:this.text+=String.fromCodePoint(ne),ne===Rn?this.state=C:L(ne)&&(this.state=I,this.q=ne)}}sDoctypeQuote(){const P=this.q;this.captureToChar(P)&&(this.text+=String.fromCodePoint(P),this.q=null,this.state=g)}sDTD(){const P=this.captureTo(_e);P!==v&&(this.text+=String.fromCodePoint(P),P===kt?this.state=g:P===gt?this.state=B:L(P)&&(this.state=A,this.q=P))}sDTDQuoted(){const P=this.q;this.captureToChar(P)&&(this.text+=String.fromCodePoint(P),this.state=C,this.q=null)}sDTDOpenWaka(){const P=this.getCodeNorm();switch(this.text+=String.fromCodePoint(P),P){case oe:this.state=R,this.openWakaBang="";break;case He:this.state=O;break;default:this.state=C}}sDTDOpenWakaBang(){const P=String.fromCodePoint(this.getCodeNorm()),ne=this.openWakaBang+=P;this.text+=P,ne!=="-"&&(this.state=ne==="--"?F:C,this.openWakaBang="")}sDTDComment(){this.captureToChar(Oe)&&(this.text+="-",this.state=q)}sDTDCommentEnding(){const P=this.getCodeNorm();this.text+=String.fromCodePoint(P),this.state=P===Oe?D:F}sDTDCommentEnded(){const P=this.getCodeNorm();this.text+=String.fromCodePoint(P),P===qe?this.state=C:(this.fail("malformed comment."),this.state=F)}sDTDPI(){this.captureToChar(He)&&(this.text+="?",this.state=te)}sDTDPIEnding(){const P=this.getCodeNorm();this.text+=String.fromCodePoint(P),P===qe&&(this.state=C)}sText(){this.tags.length!==0?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:P}=this;const{chunk:ne}=this;e:for(;;)switch(this.getCode()){case S:this.entity+=`${ne.slice(P,this.prevI)}
304
+ `,P=this.i;break;case De:{const{entityReturnState:ie}=this,we=this.entity+ne.slice(P,this.prevI);this.state=ie;let Ae;we===""?(this.fail("empty entity name."),Ae="&;"):(Ae=this.parseEntity(we),this.entity=""),(ie!==T||this.textHandler!==void 0)&&(this.text+=Ae);break e}case v:this.entity+=ne.slice(P);break e}}sOpenWaka(){const P=this.getCode();if(s(P))this.state=pe,this.unget(),this.xmlDeclPossible=!1;else switch(P){case Le:this.state=Qe,this.xmlDeclPossible=!1;break;case oe:this.state=Y,this.openWakaBang="",this.xmlDeclPossible=!1;break;case He:this.state=G;break;default:this.fail("disallowed character in tag name"),this.state=T,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=g,(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(Oe)&&(this.state=H)}sCommentEnding(){var P;const ne=this.getCodeNorm();ne===Oe?(this.state=K,(P=this.commentHandler)===null||P===void 0||P.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(ne)}`,this.state=w)}sCommentEnded(){const P=this.getCodeNorm();P!==qe?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(P)}`,this.state=w):this.state=T}sCData(){this.captureToChar(kt)&&(this.state=ue)}sCDataEnding(){const P=this.getCodeNorm();P===kt?this.state=V:(this.text+=`]${String.fromCodePoint(P)}`,this.state=X)}sCDataEnding2(){var P;const ne=this.getCodeNorm();switch(ne){case qe:{(P=this.cdataHandler)===null||P===void 0||P.call(this,this.text),this.text="",this.state=T;break}case kt:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(ne)}`,this.state=X}}sPIFirstChar(){const P=this.getCodeNorm();this.nameStartCheck(P)?(this.piTarget+=String.fromCodePoint(P),this.state=z):P===He||n(P)?(this.fail("processing instruction without a target."),this.state=P===He?ee:U):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(P),this.state=z)}sPIRest(){const{chunk:P,i:ne}=this;for(;;){const ie=this.getCodeNorm();if(ie===v){this.piTarget+=P.slice(ne);return}if(!this.nameCheck(ie)){this.piTarget+=P.slice(ne,this.prevI);const we=ie===He;we||n(ie)?this.piTarget==="xml"?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=we?he:re):this.state=we?ee:U:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(ie));break}}}sPIBody(){if(this.text.length===0){const P=this.getCodeNorm();P===He?this.state=ee:n(P)||(this.text=String.fromCodePoint(P))}else this.captureToChar(He)&&(this.state=ee)}sPIEnding(){var P;const ne=this.getCodeNorm();if(ne===qe){const{piTarget:ie}=this;ie.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:ie,body:this.text}),this.piTarget=this.text="",this.state=T}else ne===He?this.text+="?":(this.text+=`?${String.fromCodePoint(ne)}`,this.state=U);this.xmlDeclPossible=!1}sXMLDeclNameStart(){const P=this.skipSpaces();if(P===He){this.state=he;return}P!==v&&(this.state=fe,this.name=String.fromCodePoint(P))}sXMLDeclName(){const P=this.captureTo(ve);if(P===He){this.state=he,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(n(P)||P===Ft){if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=P===Ft?j:ge}}sXMLDeclEq(){const P=this.getCodeNorm();if(P===He){this.state=he,this.fail("XML declaration is incomplete.");return}n(P)||(P!==Ft&&this.fail("value required."),this.state=j)}sXMLDeclValueStart(){const P=this.getCodeNorm();if(P===He){this.state=he,this.fail("XML declaration is incomplete.");return}n(P)||(L(P)?this.q=P:(this.fail("value must be quoted."),this.q=Q),this.state=W)}sXMLDeclValue(){const P=this.captureTo([this.q,He]);if(P===He){this.state=he,this.text="",this.fail("XML declaration is incomplete.");return}if(P===v)return;const ne=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];const ie=ne;this.xmlDecl.version=ie,/^1\.[0-9]+$/.test(ie)?this.opt.forceXMLVersion||this.setXMLVersion(ie):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(ne)||this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=ne;break;case"standalone":ne!=="yes"&&ne!=="no"&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=ne;break}this.name="",this.state=se}sXMLDeclSeparator(){const P=this.getCodeNorm();if(P===He){this.state=he;return}n(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=T):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var P;const ne=this.captureNameChars();if(ne===v)return;const ie=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=ie.ns=Object.create(null)),(P=this.openTagStartHandler)===null||P===void 0||P.call(this,ie),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),ne){case qe:this.openTag();break;case Le:this.state=me;break;default:n(ne)||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!==v&&(s(P)?(this.unget(),this.state=ce):P===qe?this.openTag():P===Le?this.state=me:this.fail("disallowed character in attribute name."))}sAttribName(){const P=this.captureNameChars();P===Ft?this.state=le:n(P)?this.state=ye:P===qe?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):P!==v&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){const P=this.skipSpaces();switch(P){case v:return;case Ft:this.state=le;break;default:this.fail("attribute without value."),this.text="",this.name="",P===qe?this.openTag():s(P)?(this.unget(),this.state=ce):(this.fail("disallowed character in attribute name."),this.state=J)}}sAttribValue(){const P=this.getCodeNorm();L(P)?(this.q=P,this.state=Ne):n(P)||(this.fail("unquoted attribute value."),this.state=Se,this.unget())}sAttribValueQuoted(){const{q:P,chunk:ne}=this;let{i:ie}=this;for(;;)switch(this.getCode()){case P:this.pushAttrib(this.name,this.text+ne.slice(ie,this.prevI)),this.name=this.text="",this.q=null,this.state=ze;return;case Ee:this.text+=ne.slice(ie,this.prevI),this.state=Z,this.entityReturnState=Ne;return;case p:case S:case f:this.text+=`${ne.slice(ie,this.prevI)} `,ie=this.i;break;case gt:this.text+=ne.slice(ie,this.prevI),this.fail("disallowed character.");return;case v:this.text+=ne.slice(ie);return}}sAttribValueClosed(){const P=this.getCodeNorm();n(P)?this.state=J:P===qe?this.openTag():P===Le?this.state=me:s(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 Ee:this.state=Z,this.entityReturnState=Se;break;case gt:this.fail("disallowed character.");break;case v: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():n(P)?this.state=N:P!==v&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case qe:this.closeTag();break;case v:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:P,forbiddenState:ne}=this;const{chunk:ie,textHandler:we}=this;e:for(;;)switch(this.getCode()){case gt:{if(this.state=k,we!==void 0){const{text:Ae}=this,Ce=ie.slice(P,this.prevI);Ae.length!==0?(we(Ae+Ce),this.text=""):Ce.length!==0&&we(Ce)}ne=Rt;break e}case Ee:this.state=Z,this.entityReturnState=T,we!==void 0&&(this.text+=ie.slice(P,this.prevI)),ne=Rt;break e;case kt:switch(ne){case Rt:ne=kr;break;case kr:ne=pr;break;case pr:break;default:throw new Error("impossible state")}break;case qe:ne===pr&&this.fail('the string "]]>" is disallowed in char data.'),ne=Rt;break;case S:we!==void 0&&(this.text+=`${ie.slice(P,this.prevI)}
305
+ `),P=this.i,ne=Rt;break;case v:we!==void 0&&(this.text+=ie.slice(P));break e;default:ne=Rt}this.forbiddenState=ne}handleTextOutsideRoot(){let{i:P}=this;const{chunk:ne,textHandler:ie}=this;let we=!1;e:for(;;){const Ae=this.getCode();switch(Ae){case gt:{if(this.state=k,ie!==void 0){const{text:Ce}=this,Ze=ne.slice(P,this.prevI);Ce.length!==0?(ie(Ce+Ze),this.text=""):Ze.length!==0&&ie(Ze)}break e}case Ee:this.state=Z,this.entityReturnState=T,ie!==void 0&&(this.text+=ne.slice(P,this.prevI)),we=!0;break e;case S:ie!==void 0&&(this.text+=`${ne.slice(P,this.prevI)}
306
+ `),P=this.i;break;case v:ie!==void 0&&(this.text+=ne.slice(P));break e;default:n(Ae)||(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,ne){var ie;const{prefix:we,local:Ae}=this.qname(P),Ce={name:P,prefix:we,local:Ae,value:ne};if(this.attribList.push(Ce),(ie=this.attributeHandler)===null||ie===void 0||ie.call(this,Ce),we==="xmlns"){const Ze=ne.trim();this.currentXMLVersion==="1.0"&&Ze===""&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[Ae]=Ze,Ye(this,Ae,Ze)}else if(P==="xmlns"){const Ze=ne.trim();this.topNS[""]=Ze,Ye(this,"",Ze)}}pushAttribPlain(P,ne){var ie;const we={name:P,value:ne};this.attribList.push(we),(ie=this.attributeHandler)===null||ie===void 0||ie.call(this,we)}end(){var P,ne;this.sawRoot||this.fail("document must contain a root element.");const{tags:ie}=this;for(;ie.length>0;){const Ae=ie.pop();this.fail(`unclosed tag: ${Ae.name}`)}this.state!==y&&this.state!==T&&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,(ne=this.endHandler)===null||ne===void 0||ne.call(this),this._init(),this}resolve(P){var ne,ie;let we=this.topNS[P];if(we!==void 0)return we;const{tags:Ae}=this;for(let Ce=Ae.length-1;Ce>=0;Ce--)if(we=Ae[Ce].ns[P],we!==void 0)return we;return we=this.ns[P],we!==void 0?we:(ie=(ne=this.opt).resolvePrefix)===null||ie===void 0?void 0:ie.call(ne,P)}qname(P){const ne=P.indexOf(":");if(ne===-1)return{prefix:"",local:P};const ie=P.slice(ne+1),we=P.slice(0,ne);return(we===""||ie===""||ie.includes(":"))&&this.fail(`malformed name: ${P}.`),{prefix:we,local:ie}}processAttribsNS(){var P;const{attribList:ne}=this,ie=this.tag;{const{prefix:Ce,local:Ze}=this.qname(ie.name);ie.prefix=Ce,ie.local=Ze;const mr=ie.uri=(P=this.resolve(Ce))!==null&&P!==void 0?P:"";Ce!==""&&(Ce==="xmlns"&&this.fail('tags may not have "xmlns" as prefix.'),mr===""&&(this.fail(`unbound namespace prefix: ${JSON.stringify(Ce)}.`),ie.uri=Ce))}if(ne.length===0)return;const{attributes:we}=ie,Ae=new Set;for(const Ce of ne){const{name:Ze,prefix:mr,local:td}=Ce;let yr,Mr;mr===""?(yr=Ze==="xmlns"?_:"",Mr=Ze):(yr=this.resolve(mr),yr===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(mr)}.`),yr=mr),Mr=`{${yr}}${td}`),Ae.has(Mr)&&this.fail(`duplicate attribute: ${Mr}.`),Ae.add(Mr),Ce.uri=yr,we[Ze]=Ce}this.attribList=[]}processAttribsPlain(){const{attribList:P}=this,ne=this.tag.attributes;for(const{name:ie,value:we}of P)ne[ie]!==void 0&&this.fail(`duplicate attribute: ${ie}.`),ne[ie]=we;this.attribList=[]}openTag(){var P;this.processAttribs();const{tags:ne}=this,ie=this.tag;ie.isSelfClosing=!1,(P=this.openTagHandler)===null||P===void 0||P.call(this,ie),ne.push(ie),this.state=T,this.name=""}openSelfClosingTag(){var P,ne,ie;this.processAttribs();const{tags:we}=this,Ae=this.tag;Ae.isSelfClosing=!0,(P=this.openTagHandler)===null||P===void 0||P.call(this,Ae),(ne=this.closeTagHandler)===null||ne===void 0||ne.call(this,Ae),(this.tag=(ie=we[we.length-1])!==null&&ie!==void 0?ie:null)===null&&(this.closedRoot=!0),this.state=T,this.name=""}closeTag(){const{tags:P,name:ne}=this;if(this.state=T,this.name="",ne===""){this.fail("weird empty close tag."),this.text+="</>";return}const ie=this.closeTagHandler;let we=P.length;for(;we-- >0;){const Ae=this.tag=P.pop();if(this.topNS=Ae.ns,ie?.(Ae),Ae.name===ne)break;this.fail("unexpected close tag.")}we===0?this.closedRoot=!0:we<0&&(this.fail(`unmatched closing tag: ${ne}.`),this.text+=`</${ne}>`)}parseEntity(P){if(P[0]!=="#"){const ie=this.ENTITIES[P];return ie!==void 0?ie:(this.fail(this.isName(P)?"undefined entity.":"disallowed character in entity name."),`&${P};`)}let ne=NaN;return P[1]==="x"&&/^#x[0-9a-f]+$/i.test(P)?ne=parseInt(P.slice(2),16):/^#[0-9]+$/.test(P)&&(ne=parseInt(P.slice(1),10)),this.isChar(ne)?String.fromCodePoint(ne):(this.fail("malformed character entity."),`&${P};`)}}return Jt.SaxesParser=Pr,Jt}var Xr={},ul;function cf(){if(ul)return Xr;ul=1,Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.ParseError=void 0;let r=class extends Error{constructor(t,n){const i=t.saxParser;super(t.trackPosition?`Line ${i.line} column ${i.column+1}: ${n}`:n)}};return Xr.ParseError=r,Xr}var Kt={},Qr={},cl;function Lc(){if(cl)return Qr;cl=1,Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.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 Qr.BlankNode=r,Qr}var Jr={},Kr={},dl;function Cc(){if(dl)return Kr;dl=1,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.DefaultGraph=void 0;class r{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&t.termType==="DefaultGraph"}}return Kr.DefaultGraph=r,r.INSTANCE=new r,Kr}var Yr={},Zr={},hl;function ja(){if(hl)return Zr;hl=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.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 Zr.NamedNode=r,Zr}var fl;function jc(){if(fl)return Yr;fl=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.Literal=void 0;const r=ja();class e{constructor(n,i){this.termType="Literal",this.value=n,typeof i=="string"?(this.language=i,this.datatype=e.RDF_LANGUAGE_STRING,this.direction=""):i?"termType"in i?(this.language="",this.datatype=i,this.direction=""):(this.language=i.language,this.datatype=i.direction?e.RDF_DIRECTIONAL_LANGUAGE_STRING:e.RDF_LANGUAGE_STRING,this.direction=i.direction||""):(this.language="",this.datatype=e.XSD_STRING,this.direction="")}equals(n){return!!n&&n.termType==="Literal"&&n.value===this.value&&n.language===this.language&&(n.direction===this.direction||!n.direction&&this.direction==="")&&this.datatype.equals(n.datatype)}}return Yr.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"),Yr}var en={},pl;function $c(){if(pl)return en;pl=1,Object.defineProperty(en,"__esModule",{value:!0}),en.Quad=void 0;class r{constructor(t,n,i,s){this.termType="Quad",this.value="",this.subject=t,this.predicate=n,this.object=i,this.graph=s}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 en.Quad=r,en}var tn={},gl;function Fc(){if(gl)return tn;gl=1,Object.defineProperty(tn,"__esModule",{value:!0}),tn.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 tn.Variable=r,tn}var ml;function df(){if(ml)return Jr;ml=1,Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.DataFactory=void 0;const r=Lc(),e=Cc(),t=jc(),n=ja(),i=$c(),s=Fc();let a=0;class o{constructor(l){this.blankNodeCounter=0,l=l||{},this.blankNodePrefix=l.blankNodePrefix||`df_${a++}_`}namedNode(l){return new n.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 s.Variable(l)}defaultGraph(){return e.DefaultGraph.INSTANCE}quad(l,c,d,m){return new i.Quad(l,c,d,m||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 Jr.DataFactory=o,Jr}var yl;function kc(){return yl||(yl=1,function(r){var e=Kt&&Kt.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=Kt&&Kt.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(Lc(),r),t(df(),r),t(Cc(),r),t(jc(),r),t(ja(),r),t($c(),r),t(Fc(),r)}(Kt)),Kt}var Yt={},Ji={},bl;function hf(){return bl||(bl=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.validateIri=r.IriValidationStrategy=void 0;function e(){const o="[!$&'()*+,;=]",u="%[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}`,d="[a-fA-F0-9]{1,4}",m=`(${d}:${d}|${c})`,b=`((${d}:){6}${m}|::(${d}:){5}${m}|(${d})?::(${d}:){4}${m}|((${d}:){0,1}${d})?::(${d}:){3}${m}|((${d}:){0,2}${d})?::(${d}:){2}${m}|((${d}:){0,3}${d})?::${d}:${m}|((${d}:){0,4}${d})?::${m}|((${d}:){0,5}${d})?::${d}|((${d}:){0,6}${d})?::)`,_=`v[a-fA-F0-9]+\\.(${o}|${o}|":)+`,x=`\\[(${b}|${_})\\]`,E="[0-9]*",v="[a-zA-Z][a-zA-Z0-9+\\-.]*",y="[-󰀀-󿿽􀀀-􏿽]",I="[a-zA-Z0-9\\-._~ -퟿豈-﷏ﷰ-￯𐀀-🿽𠀀-𯿽𰀀-𿿽񀀀-񏿽񐀀-񟿽񠀀-񯿽񰀀-񿿽򀀀-򏿽򐀀-򟿽򠀀-򯿽򰀀-򿿽󀀀-󏿽󐀀-󟿽󡀀-󯿽]",C=`(${I}|${u}|${o}|[:@])*`,A=`(${C}|[\\/?])*`,B=`(${C}|${y}|[\\/?])*`,R=`(${C})+`,F=`(${C})*`,q="",D=`${R}(\\/${F})*`,O=`\\/(${R}(\\/${F})*)?`,te=`(\\/${F})*`,T=`(${I}|${u}|${o})*`,Z=`(${x}|${c}|${T})`,w=`(\\/\\/${`(${`(${I}|${u}|${o}|:)*`}@)?${Z}(:${E})?`}${te}|${O}|${D}|${q})`,H=`^${v}:${w}(\\?${B})?(#${A})?$`;return new RegExp(H,"u")}const t=e(),n=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u;var i;(function(a){a.Strict="strict",a.Pragmatic="pragmatic",a.None="none"})(i=r.IriValidationStrategy||(r.IriValidationStrategy={}));function s(a,o=i.Strict){switch(o){case i.Strict:return t.test(a)?void 0:new Error(`Invalid IRI according to RFC 3987: '${a}'`);case i.Pragmatic:return n.test(a)?void 0:new Error(`Invalid IRI according to RDF Turtle: '${a}'`);case i.None:return;default:return new Error(`Not supported validation strategy "${o}"`)}}r.validateIri=s}(Ji)),Ji}var _l;function ff(){return _l||(_l=1,function(r){var e=Yt&&Yt.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=Yt&&Yt.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(hf(),r)}(Yt)),Yt}var wl;function pf(){if(wl)return Xt;wl=1,Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.ParseType=Xt.RdfXmlParser=void 0;const r=sf(),e=uf(),t=ac(),n=cf(),i=kc(),s=ff();let a=class $e 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 i.DataFactory),this.baseIRI||(this.baseIRI=""),this.defaultGraph||(this.defaultGraph=this.dataFactory.defaultGraph()),this.validateUri!==!1&&(this.validateUri=!0),this.iriValidationStrategy||(this.iriValidationStrategy=this.validateUri?s.IriValidationStrategy.Pragmatic:s.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",m=>d.emit("error",m)),l.on("data",m=>c.push(m)),l.on("end",()=>c.push(null));const d=c.pipe(new $e(this.options));return d}_transform(l,c,d){try{this.saxParser.write(l)}catch(m){return d(m)}d()}newParseError(l){return new n.ParseError(this,l)}valueToUri(l,c){return this.uriToNamedNode((0,r.resolve)(l,c.baseIRI))}uriToNamedNode(l){const c=(0,s.validateIri)(l,this.iriValidationStrategy);if(c instanceof Error)throw this.newParseError(c.message);return this.dataFactory.namedNode(l)}validateNcname(l){if(!$e.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 d=o.RESOURCE;if(c&&(c.hadChildren=!0,d=c.childrenParseType),c&&c.childrenStringTags){const b=l.name;let _="";for(const{key:S,value:y}of c.namespaces||[])_+=` ${S}="${y}"`;for(const S in l.attributes)_+=` ${S}="${l.attributes[S].value}"`;const E=`<${`${b}${_}`}>`;c.childrenStringTags.push(E);const v={childrenStringTags:c.childrenStringTags};v.childrenStringEmitClosingTag=`</${b}>`,this.activeTagStack.push(v);return}const m={};c?(m.language=c.language,m.direction=c.direction,m.baseIRI=c.baseIRI,m.childrenTripleTerms=c.childrenTripleTerms,m.rdfVersion=c.rdfVersion):m.baseIRI=this.baseIRI,this.activeTagStack.push(m),d===o.RESOURCE?this.onTagResource(l,m,c,!c):this.onTagProperty(l,m,c);for(const b in l.attributes){const _=l.attributes[b];_.prefix==="xmlns"&&(m.namespaces||(m.namespaces=[]),m.namespaces.push({key:`${_.prefix}:${_.local}`,value:_.value}))}c&&c.namespaces&&(m.namespaces=[...m.namespaces||[],...c.namespaces])}onTagResource(l,c,d,m){c.childrenParseType=o.PROPERTY;let b=!0;if(l.uri===$e.RDF){if(!m&&$e.FORBIDDEN_NODE_ELEMENTS.indexOf(l.local)>=0)throw this.newParseError(`Illegal node element name: ${l.local}`);switch(l.local){case"RDF":c.childrenParseType=o.RESOURCE;case"Description":b=!1}}const _=[],x=[];let E=null,v=!1,S=!1,y=null;for(const h in l.attributes){const g=l.attributes[h];if(g.uri===$e.RDF&&g.local==="version"){this.setVersion(c,g.value);continue}else if(d&&g.uri===$e.RDF)switch(g.local){case"about":if(E)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${E} where found.`);E=g.value;continue;case"ID":if(E)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${E} where found.`);this.validateNcname(g.value),E="#"+g.value,v=!0;continue;case"nodeID":if(E)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${E} where found.`);this.validateNcname(g.value),E=g.value,S=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"type":y=g.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(g.uri===$e.XML){if(g.local==="lang"){c.language=g.value===""?null:g.value.toLowerCase();continue}else if(g.local==="base"){c.baseIRI=(0,r.resolve)(g.value,c.baseIRI);continue}}else if(g.uri===$e.ITS&&g.local==="dir"){this.setDirection(c,g.value);continue}g.prefix!=="xml"&&g.prefix!=="xmlns"&&(g.prefix!==""||g.local!=="xmlns")&&g.uri&&(_.push(this.uriToNamedNode(g.uri+g.local)),x.push(g.value))}if(E!==null&&(c.subject=S?this.dataFactory.blankNode(E):this.valueToUri(E,c),v&&this.claimNodeId(c.subject)),c.subject||(c.subject=this.dataFactory.blankNode()),b){const h=this.uriToNamedNode(l.uri+l.local);this.emitTriple(c.subject,this.dataFactory.namedNode($e.RDF+"type"),h,d?d.reifiedStatementId:null,c.childrenTripleTerms,c.reifier)}if(d){if(d.predicate)if(d.childrenCollectionSubject){const h=this.dataFactory.blankNode(),g=this.dataFactory.namedNode($e.RDF+"rest"),I=d.childrenCollectionPredicate.equals(g);this.emitTriple(d.childrenCollectionSubject,d.childrenCollectionPredicate,h,I?null:d.reifiedStatementId,d.childrenTripleTerms,I?null:d.reifier),this.emitTriple(h,this.dataFactory.namedNode($e.RDF+"first"),c.subject,null,c.childrenTripleTerms),d.childrenCollectionSubject=h,d.childrenCollectionPredicate=g}else{d.childrenTagsToTripleTerms||(this.emitTriple(d.subject,d.predicate,c.subject,d.reifiedStatementId,d.childrenTripleTerms,d.reifier),d.predicateEmitted=!0);for(let h=0;h<d.predicateSubPredicates.length;h++)this.emitTriple(c.subject,d.predicateSubPredicates[h],d.predicateSubObjects[h],null,d.childrenTripleTerms,d.reifier);d.predicateSubPredicates=[],d.predicateSubObjects=[]}for(let h=0;h<_.length;h++){const g=this.createLiteral(x[h],c);this.emitTriple(c.subject,_[h],g,d.reifiedStatementId,d.childrenTripleTerms,d.reifier)}y&&this.emitTriple(c.subject,this.dataFactory.namedNode($e.RDF+"type"),this.uriToNamedNode(y),null,c.childrenTripleTerms,c.reifier)}}onTagProperty(l,c,d){if(c.childrenParseType=o.RESOURCE,c.subject=d.subject,l.uri===$e.RDF&&l.local==="li"?(d.listItemCounter||(d.listItemCounter=1),c.predicate=this.uriToNamedNode(l.uri+"_"+d.listItemCounter++)):c.predicate=this.uriToNamedNode(l.uri+l.local),l.uri===$e.RDF&&$e.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(l.local)>=0)throw this.newParseError(`Illegal property element name: ${l.local}`);c.predicateSubPredicates=[],c.predicateSubObjects=[];let m=!1,b=!1,_=null,x=!0;const E=[],v=[];for(const S in l.attributes){const y=l.attributes[S];if(y.uri===$e.RDF&&y.local==="version"){this.setVersion(c,y.value);continue}else if(y.uri===$e.RDF)switch(y.local){case"resource":if(_)throw this.newParseError(`Found both rdf:resource (${y.value}) and rdf:nodeID (${_}).`);if(m)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${y.value})`);c.hadChildren=!0,_=y.value,x=!1;continue;case"datatype":if(b)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${y.value}).`);if(m)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${y.value})`);c.datatype=this.valueToUri(y.value,c);continue;case"nodeID":if(b)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${y.value}).`);if(c.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${y.value}).`);if(m)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${y.value})`);this.validateNcname(y.value),c.hadChildren=!0,_=y.value,x=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"parseType":if(b)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(_)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${_})`);if(y.value==="Resource"){m=!0,c.childrenParseType=o.PROPERTY;const h=this.dataFactory.blankNode();this.emitTriple(c.subject,c.predicate,h,c.reifiedStatementId,c.childrenTripleTerms,c.reifier),c.subject=h,c.predicate=null}else y.value==="Collection"?(m=!0,c.hadChildren=!0,c.childrenCollectionSubject=c.subject,c.childrenCollectionPredicate=c.predicate,x=!1):y.value==="Literal"?(m=!0,c.childrenTagsToString=!0,c.childrenStringTags=[]):y.value==="Triple"&&(m=!0,c.childrenTagsToTripleTerms=!0,c.childrenTripleTerms=[]);continue;case"ID":this.validateNcname(y.value),c.reifiedStatementId=this.valueToUri("#"+y.value,c),this.claimNodeId(c.reifiedStatementId);continue;case"annotation":c.reifier=this.dataFactory.namedNode(y.value);continue;case"annotationNodeID":c.reifier=this.dataFactory.blankNode(y.value);continue}else if(y.uri===$e.XML&&y.local==="lang"){c.language=y.value===""?null:y.value.toLowerCase();continue}else if(y.uri===$e.ITS&&y.local==="dir"){this.setDirection(c,y.value);continue}else if(y.uri===$e.ITS&&y.local==="version")continue;if(y.prefix!=="xml"&&y.prefix!=="xmlns"&&(y.prefix!==""||y.local!=="xmlns")&&y.uri){if(m||c.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${y.value}`);c.hadChildren=!0,b=!0,E.push(this.uriToNamedNode(y.uri+y.local)),v.push(this.createLiteral(y.value,c))}}if(_!==null){const S=c.subject;c.subject=x?this.dataFactory.blankNode(_):this.valueToUri(_,c),this.emitTriple(S,c.predicate,c.subject,c.reifiedStatementId,c.childrenTripleTerms,c.reifier);for(let y=0;y<E.length;y++)this.emitTriple(c.subject,E[y],v[y],null,c.childrenTripleTerms,c.reifier);c.predicateEmitted=!0}else x&&(c.predicateSubPredicates=E,c.predicateSubObjects=v,c.predicateEmitted=!1)}emitTriple(l,c,d,m,b,_){const x=this.dataFactory.quad(l,c,d,this.defaultGraph);b?b.push(x):this.push(x),_&&this.push(this.dataFactory.quad(_,this.dataFactory.namedNode($e.RDF+"reifies"),x)),m&&(this.push(this.dataFactory.quad(m,this.dataFactory.namedNode($e.RDF+"type"),this.dataFactory.namedNode($e.RDF+"Statement"),this.defaultGraph)),this.push(this.dataFactory.quad(m,this.dataFactory.namedNode($e.RDF+"subject"),l,this.defaultGraph)),this.push(this.dataFactory.quad(m,this.dataFactory.namedNode($e.RDF+"predicate"),c,this.defaultGraph)),this.push(this.dataFactory.quad(m,this.dataFactory.namedNode($e.RDF+"object"),d,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($e.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 d of l.childrenTripleTerms)this.emitTriple(l.subject,l.predicate,d,null,c.childrenTripleTerms,c.reifier);l.predicateEmitted=!0}if(l.childrenCollectionSubject)this.emitTriple(l.childrenCollectionSubject,l.childrenCollectionPredicate,this.dataFactory.namedNode($e.RDF+"nil"),null,l.childrenTripleTerms);else if(l.predicate){if(!l.hadChildren&&l.childrenParseType!==o.PROPERTY)this.emitTriple(l.subject,l.predicate,this.createLiteral(l.text||"",l),l.reifiedStatementId,l.childrenTripleTerms,l.reifier);else if(!l.predicateEmitted){const d=this.dataFactory.blankNode();this.emitTriple(l.subject,l.predicate,d,l.reifiedStatementId,l.childrenTripleTerms,l.reifier);for(let m=0;m<l.predicateSubPredicates.length;m++)this.emitTriple(d,l.predicateSubPredicates[m],l.predicateSubObjects[m],null,l.childrenTripleTerms)}}}onDoctype(l){l.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(c,d,m)=>(this.saxParser.ENTITIES[d]=m,""))}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)}};Xt.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 o;return function(u){u[u.RESOURCE=0]="RESOURCE",u[u.PROPERTY=1]="PROPERTY"}(o||(Xt.ParseType=o={})),Xt}var vl;function gf(){return vl||(vl=1,function(r){var e=zt&&zt.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=zt&&zt.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(pf(),r)}(zt)),zt}var mf=gf(),Ki={},Yi,xl;function $a(){return xl||(xl=1,Yi=class Pc{constructor(e,t=new Map,n=0){this.prefix=e,this._existing=t,this.counter=n}clone(){const{prefix:e,_existing:t,counter:n}=this;return new Pc(e,new Map(t),n)}getId(e){const t=e&&this._existing.get(e);if(t)return t;const n=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,n),n}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}}),Yi}var Zi={},El;function yf(){return El||(El=1,function(r,e){if(r.setImmediate)return;var t=1,n={},i=!1,s=r.document,a;function o(S){typeof S!="function"&&(S=new Function(""+S));for(var y=new Array(arguments.length-1),h=0;h<y.length;h++)y[h]=arguments[h+1];var g={callback:S,args:y};return n[t]=g,a(t),t++}function u(S){delete n[S]}function l(S){var y=S.callback,h=S.args;switch(h.length){case 0:y();break;case 1:y(h[0]);break;case 2:y(h[0],h[1]);break;case 3:y(h[0],h[1],h[2]);break;default:y.apply(e,h);break}}function c(S){if(i)setTimeout(c,0,S);else{var y=n[S];if(y){i=!0;try{l(y)}finally{u(S),i=!1}}}}function d(){a=function(S){process.nextTick(function(){c(S)})}}function m(){if(r.postMessage&&!r.importScripts){var S=!0,y=r.onmessage;return r.onmessage=function(){S=!1},r.postMessage("","*"),r.onmessage=y,S}}function b(){var S="setImmediate$"+Math.random()+"$",y=function(h){h.source===r&&typeof h.data=="string"&&h.data.indexOf(S)===0&&c(+h.data.slice(S.length))};r.addEventListener?r.addEventListener("message",y,!1):r.attachEvent("onmessage",y),a=function(h){r.postMessage(S+h,"*")}}function _(){var S=new MessageChannel;S.port1.onmessage=function(y){var h=y.data;c(h)},a=function(y){S.port2.postMessage(y)}}function x(){var S=s.documentElement;a=function(y){var h=s.createElement("script");h.onreadystatechange=function(){c(y),h.onreadystatechange=null,S.removeChild(h),h=null},S.appendChild(h)}}function E(){a=function(S){setTimeout(c,0,S)}}var v=Object.getPrototypeOf&&Object.getPrototypeOf(r);v=v&&v.setTimeout?v:r,{}.toString.call(r.process)==="[object process]"?d():m()?b():r.MessageChannel?_():s&&"onreadystatechange"in s.createElement("script")?x():E(),v.setImmediate=o,v.clearImmediate=u}(typeof self>"u"?typeof xr>"u"?Zi:xr:self)),Zi}/*!
281
307
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
282
- */var Ei,Mo;function Dn(){if(Mo)return Ei;Mo=1,If();const r=self.crypto||self.msCrypto;return Ei=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),n=new Uint8Array(await r.subtle.digest(this.algorithm,t));let i="";for(let s=0;s<n.length;++s)i+=n[s].toString(16).padStart(2,"0");return i}},Ei}/*!
308
+ */var es,Sl;function hi(){if(Sl)return es;Sl=1,yf();const r=self.crypto||self.msCrypto;return es=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),n=new Uint8Array(await r.subtle.digest(this.algorithm,t));let i="";for(let s=0;s<n.length;++s)i+=n[s].toString(16).padStart(2,"0");return i}},es}/*!
283
309
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
284
- */var Ii,Co;function Xu(){return Co||(Co=1,Ii=class{constructor(e){this.current=e.sort(),this.done=!1,this.dir=new Map;for(let t=0;t<e.length;++t)this.dir.set(e[t],!0)}hasNext(){return!this.done}next(){const{current:e,dir:t}=this,n=e.slice();let i=null,s=0;const a=e.length;for(let o=0;o<a;++o){const l=e[o],d=t.get(l);(i===null||l>i)&&(d&&o>0&&l>e[o-1]||!d&&o<a-1&&l>e[o+1])&&(i=l,s=o)}if(i===null)this.done=!0;else{const o=t.get(i)?s-1:s+1;e[s]=e[o],e[o]=i;for(const l of e)l>i&&t.set(l,!t.get(l))}return n}}),Ii}/*!
310
+ */var ts,Nl;function Mc(){return Nl||(Nl=1,ts=class{constructor(e){this.current=e.sort(),this.done=!1,this.dir=new Map;for(let t=0;t<e.length;++t)this.dir.set(e[t],!0)}hasNext(){return!this.done}next(){const{current:e,dir:t}=this,n=e.slice();let i=null,s=0;const a=e.length;for(let o=0;o<a;++o){const u=e[o],l=t.get(u);(i===null||u>i)&&(l&&o>0&&u>e[o-1]||!l&&o<a-1&&u>e[o+1])&&(i=u,s=o)}if(i===null)this.done=!0;else{const o=t.get(i)?s-1:s+1;e[s]=e[o],e[o]=i;for(const u of e)u>i&&t.set(u,!t.get(u))}return n}}),ts}/*!
285
311
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
286
- */var Ri,Po;function aa(){if(Po)return Ri;Po=1;const e="http://www.w3.org/1999/02/22-rdf-syntax-ns#"+"langString",t="http://www.w3.org/2001/XMLSchema#string",n="NamedNode",i="BlankNode",s="Literal",a="DefaultGraph",o={};(()=>{const g="(?:<([^:]+:[^>]*)>)",_="A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�"+"_",x=_+"0-9-·̀-ͯ‿-⁀",I="(_:(?:["+_+"0-9])(?:(?:["+x+".])*(?:["+x+"]))?)",b='"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"',c="(?:\\^\\^"+g+")",N="(?:"+b+"(?:"+c+"|"+"(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*))"+")?)",D="[ \\t]+",T="[ \\t]*",q="(?:"+g+"|"+I+")"+D,R=g+D,M="(?:"+g+"|"+I+"|"+N+")"+T,B="(?:\\.|(?:(?:"+g+"|"+I+")"+T+"\\.))";o.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,o.empty=new RegExp("^"+T+"$"),o.quad=new RegExp("^"+T+q+R+M+B+T+"$")})(),Ri=class yn{static parse(m){const _=[],x={},S=m.split(o.eoln);let I=0;for(const b of S){if(I++,o.empty.test(b))continue;const c=b.match(o.quad);if(c===null)throw new Error("N-Quads parse error on line "+I+".");const p={subject:null,predicate:null,object:null,graph:null};if(c[1]!==void 0?p.subject={termType:n,value:c[1]}:p.subject={termType:i,value:c[2]},p.predicate={termType:n,value:c[3]},c[4]!==void 0?p.object={termType:n,value:c[4]}:c[5]!==void 0?p.object={termType:i,value:c[5]}:(p.object={termType:s,value:void 0,datatype:{termType:n}},c[7]!==void 0?p.object.datatype.value=c[7]:c[8]!==void 0?(p.object.datatype.value=e,p.object.language=c[8]):p.object.datatype.value=t,p.object.value=w(c[6])),c[9]!==void 0?p.graph={termType:n,value:c[9]}:c[10]!==void 0?p.graph={termType:i,value:c[10]}:p.graph={termType:a,value:""},!(p.graph.value in x))x[p.graph.value]=[p],_.push(p);else{let N=!0;const D=x[p.graph.value];for(const T of D)if(l(T,p)){N=!1;break}N&&(D.push(p),_.push(p))}}return _}static serialize(m){Array.isArray(m)||(m=yn.legacyDatasetToQuads(m));const _=[];for(const x of m)_.push(yn.serializeQuad(x));return _.sort().join("")}static serializeQuadComponents(m,_,x,S){let I="";return m.termType===n?I+=`<${m.value}>`:I+=`${m.value}`,I+=` <${_.value}> `,x.termType===n?I+=`<${x.value}>`:x.termType===i?I+=x.value:(I+=`"${h(x.value)}"`,x.datatype.value===e?x.language&&(I+=`@${x.language}`):x.datatype.value!==t&&(I+=`^^<${x.datatype.value}>`)),S.termType===n?I+=` <${S.value}>`:S.termType===i&&(I+=` ${S.value}`),I+=` .
287
- `,I}static serializeQuad(m){return yn.serializeQuadComponents(m.subject,m.predicate,m.object,m.graph)}static legacyDatasetToQuads(m){const _=[],x={"blank node":i,IRI:n,literal:s};for(const S in m)m[S].forEach(b=>{const c={};for(const p in b){const N=b[p],D={termType:x[N.type],value:N.value};D.termType===s&&(D.datatype={termType:n},"datatype"in N&&(D.datatype.value=N.datatype),"language"in N?("datatype"in N||(D.datatype.value=e),D.language=N.language):"datatype"in N||(D.datatype.value=t)),c[p]=D}S==="@default"?c.graph={termType:a,value:""}:c.graph={termType:S.startsWith("_:")?i:n,value:S},_.push(c)});return _}};function l(g,m){return!(g.subject.termType===m.subject.termType&&g.object.termType===m.object.termType)||!(g.subject.value===m.subject.value&&g.predicate.value===m.predicate.value&&g.object.value===m.object.value)?!1:g.object.termType!==s?!0:g.object.datatype.termType===m.object.datatype.termType&&g.object.language===m.object.language&&g.object.datatype.value===m.object.datatype.value}const d=/["\\\n\r]/g;function h(g){return g.replace(d,function(m){switch(m){case'"':return'\\"';case"\\":return"\\\\";case`
288
- `:return"\\n";case"\r":return"\\r"}})}const y=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function w(g){return g.replace(y,function(m,_,x,S){if(_)switch(_){case"t":return" ";case"b":return"\b";case"n":return`
289
- `;case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(x)return String.fromCharCode(parseInt(x,16));if(S)throw new Error("Unsupported U escape")})}return Ri}/*!
312
+ */var rs,Il;function Fa(){if(Il)return rs;Il=1;const e="http://www.w3.org/1999/02/22-rdf-syntax-ns#"+"langString",t="http://www.w3.org/2001/XMLSchema#string",n="NamedNode",i="BlankNode",s="Literal",a="DefaultGraph",o={};(()=>{const b="(?:<([^:]+:[^>]*)>)",x="A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�"+"_",E=x+"0-9-·̀-ͯ‿-⁀",S="(_:(?:["+x+"0-9])(?:(?:["+E+".])*(?:["+E+"]))?)",y='"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"',h="(?:\\^\\^"+b+")",I="(?:"+y+"(?:"+h+"|"+"(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*))"+")?)",C="[ \\t]+",A="[ \\t]*",B="(?:"+b+"|"+S+")"+C,R=b+C,F="(?:"+b+"|"+S+"|"+I+")"+A,q="(?:\\.|(?:(?:"+b+"|"+S+")"+A+"\\.))";o.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,o.empty=new RegExp("^"+A+"$"),o.quad=new RegExp("^"+A+B+R+F+q+A+"$")})(),rs=class zn{static parse(_){const x=[],E={},v=_.split(o.eoln);let S=0;for(const y of v){if(S++,o.empty.test(y))continue;const h=y.match(o.quad);if(h===null)throw new Error("N-Quads parse error on line "+S+".");const g={subject:null,predicate:null,object:null,graph:null};if(h[1]!==void 0?g.subject={termType:n,value:h[1]}:g.subject={termType:i,value:h[2]},g.predicate={termType:n,value:h[3]},h[4]!==void 0?g.object={termType:n,value:h[4]}:h[5]!==void 0?g.object={termType:i,value:h[5]}:(g.object={termType:s,value:void 0,datatype:{termType:n}},h[7]!==void 0?g.object.datatype.value=h[7]:h[8]!==void 0?(g.object.datatype.value=e,g.object.language=h[8]):g.object.datatype.value=t,g.object.value=m(h[6])),h[9]!==void 0?g.graph={termType:n,value:h[9]}:h[10]!==void 0?g.graph={termType:i,value:h[10]}:g.graph={termType:a,value:""},!(g.graph.value in E))E[g.graph.value]=[g],x.push(g);else{let I=!0;const C=E[g.graph.value];for(const A of C)if(u(A,g)){I=!1;break}I&&(C.push(g),x.push(g))}}return x}static serialize(_){Array.isArray(_)||(_=zn.legacyDatasetToQuads(_));const x=[];for(const E of _)x.push(zn.serializeQuad(E));return x.sort().join("")}static serializeQuadComponents(_,x,E,v){let S="";return _.termType===n?S+=`<${_.value}>`:S+=`${_.value}`,S+=` <${x.value}> `,E.termType===n?S+=`<${E.value}>`:E.termType===i?S+=E.value:(S+=`"${c(E.value)}"`,E.datatype.value===e?E.language&&(S+=`@${E.language}`):E.datatype.value!==t&&(S+=`^^<${E.datatype.value}>`)),v.termType===n?S+=` <${v.value}>`:v.termType===i&&(S+=` ${v.value}`),S+=` .
313
+ `,S}static serializeQuad(_){return zn.serializeQuadComponents(_.subject,_.predicate,_.object,_.graph)}static legacyDatasetToQuads(_){const x=[],E={"blank node":i,IRI:n,literal:s};for(const v in _)_[v].forEach(y=>{const h={};for(const g in y){const I=y[g],C={termType:E[I.type],value:I.value};C.termType===s&&(C.datatype={termType:n},"datatype"in I&&(C.datatype.value=I.datatype),"language"in I?("datatype"in I||(C.datatype.value=e),C.language=I.language):"datatype"in I||(C.datatype.value=t)),h[g]=C}v==="@default"?h.graph={termType:a,value:""}:h.graph={termType:v.startsWith("_:")?i:n,value:v},x.push(h)});return x}};function u(b,_){return!(b.subject.termType===_.subject.termType&&b.object.termType===_.object.termType)||!(b.subject.value===_.subject.value&&b.predicate.value===_.predicate.value&&b.object.value===_.object.value)?!1:b.object.termType!==s?!0:b.object.datatype.termType===_.object.datatype.termType&&b.object.language===_.object.language&&b.object.datatype.value===_.object.datatype.value}const l=/["\\\n\r]/g;function c(b){return b.replace(l,function(_){switch(_){case'"':return'\\"';case"\\":return"\\\\";case`
314
+ `:return"\\n";case"\r":return"\\r"}})}const d=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function m(b){return b.replace(d,function(_,x,E,v){if(x)switch(x){case"t":return" ";case"b":return"\b";case"n":return`
315
+ `;case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(E)return String.fromCharCode(parseInt(E,16));if(v)throw new Error("Unsupported U escape")})}return rs}/*!
290
316
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
291
- */var Ni,qo;function Ku(){if(qo)return Ni;qo=1;const r=sa(),e=Dn(),t=Xu(),n=aa();Ni=class{constructor({createMessageDigest:a=()=>new e("sha256"),canonicalIdMap:o=new Map,maxDeepIterations:l=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",o),this.createMessageDigest=a,this.maxDeepIterations=l,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 o=new Map,l=[...this.blankNodeInfo.keys()];let d=0;for(const g of l)++d%100===0&&await this._yield(),await this._hashAndTrackBlankNode({id:g,hashToBlankNodes:o});const h=[...o.keys()].sort(),y=[];for(const g of h){const m=o.get(g);if(m.length>1){y.push(m);continue}const _=m[0];this.canonicalIssuer.getId(_)}for(const g of y){const m=[];for(const _ of g){if(this.canonicalIssuer.hasId(_))continue;const x=new r("_:b");x.getId(_);const S=await this.hashNDegreeQuads(_,x);m.push(S)}m.sort(i);for(const _ of m){const x=_.issuer.getOldIds();for(const S of x)this.canonicalIssuer.getId(S)}}const w=[];for(const g of this.quads){const m=n.serializeQuadComponents(this._componentWithCanonicalId(g.subject),g.predicate,this._componentWithCanonicalId(g.object),this._componentWithCanonicalId(g.graph));w.push(m)}return w.sort(),w.join("")}async hashFirstDegreeQuads(a){const o=[],l=this.blankNodeInfo.get(a),d=l.quads;for(const y of d){const w={subject:null,predicate:y.predicate,object:null,graph:null};w.subject=this.modifyFirstDegreeComponent(a,y.subject,"subject"),w.object=this.modifyFirstDegreeComponent(a,y.object,"object"),w.graph=this.modifyFirstDegreeComponent(a,y.graph,"graph"),o.push(n.serializeQuad(w))}o.sort();const h=this.createMessageDigest();for(const y of o)h.update(y);return l.hash=await h.digest(),l.hash}async hashRelatedBlankNode(a,o,l,d){let h;this.canonicalIssuer.hasId(a)?h=this.canonicalIssuer.getId(a):l.hasId(a)?h=l.getId(a):h=this.blankNodeInfo.get(a).hash;const y=this.createMessageDigest();return y.update(d),d!=="g"&&y.update(this.getRelatedPredicate(o)),y.update(h),y.digest()}async hashNDegreeQuads(a,o){const l=this.deepIterations.get(a)||0;if(l>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(a,l+1);const d=this.createMessageDigest(),h=await this.createHashToRelated(a,o),y=[...h.keys()].sort();for(const w of y){d.update(w);let g="",m;const _=new t(h.get(w));let x=0;for(;_.hasNext();){const S=_.next();++x%3===0&&await this._yield();let I=o.clone(),b="";const c=[];let p=!1;for(const N of S)if(this.canonicalIssuer.hasId(N)?b+=this.canonicalIssuer.getId(N):(I.hasId(N)||c.push(N),b+=I.getId(N)),g.length!==0&&b>g){p=!0;break}if(!p){for(const N of c){const D=await this.hashNDegreeQuads(N,I);if(b+=I.getId(N),b+=`<${D.hash}>`,I=D.issuer,g.length!==0&&b>g){p=!0;break}}p||(g.length===0||b<g)&&(g=b,m=I)}}d.update(g),o=m}return{hash:await d.digest(),issuer:o}}modifyFirstDegreeComponent(a,o){return o.termType!=="BlankNode"?o:{termType:"BlankNode",value:o.value===a?"_:a":"_:z"}}getRelatedPredicate(a){return`<${a.predicate.value}>`}async createHashToRelated(a,o){const l=new Map,d=this.blankNodeInfo.get(a).quads;let h=0;for(const y of d)++h%100===0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:y,component:y.subject,position:"s",id:a,issuer:o,hashToRelated:l}),this._addRelatedBlankNodeHash({quad:y,component:y.object,position:"o",id:a,issuer:o,hashToRelated:l}),this._addRelatedBlankNodeHash({quad:y,component:y.graph,position:"g",id:a,issuer:o,hashToRelated:l})]);return l}async _hashAndTrackBlankNode({id:a,hashToBlankNodes:o}){const l=await this.hashFirstDegreeQuads(a),d=o.get(l);d?d.push(a):o.set(l,[a])}_addBlankNodeQuadInfo({quad:a,component:o}){if(o.termType!=="BlankNode")return;const l=o.value,d=this.blankNodeInfo.get(l);d?d.quads.add(a):this.blankNodeInfo.set(l,{quads:new Set([a]),hash:null})}async _addRelatedBlankNodeHash({quad:a,component:o,position:l,id:d,issuer:h,hashToRelated:y}){if(!(o.termType==="BlankNode"&&o.value!==d))return;const w=o.value,g=await this.hashRelatedBlankNode(w,a,h,l),m=y.get(g);m?m.push(w):y.set(g,[w])}_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 i(s,a){return s.hash<a.hash?-1:s.hash>a.hash?1:0}return Ni}/*!
317
+ */var ns,Rl;function Bc(){if(Rl)return ns;Rl=1;const r=$a(),e=hi(),t=Mc(),n=Fa();ns=class{constructor({createMessageDigest:a=()=>new e("sha256"),canonicalIdMap:o=new Map,maxDeepIterations:u=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",o),this.createMessageDigest=a,this.maxDeepIterations=u,this.quads=null,this.deepIterations=null}async main(a){this.deepIterations=new Map,this.quads=a;for(const b of a)this._addBlankNodeQuadInfo({quad:b,component:b.subject}),this._addBlankNodeQuadInfo({quad:b,component:b.object}),this._addBlankNodeQuadInfo({quad:b,component:b.graph});const o=new Map,u=[...this.blankNodeInfo.keys()];let l=0;for(const b of u)++l%100===0&&await this._yield(),await this._hashAndTrackBlankNode({id:b,hashToBlankNodes:o});const c=[...o.keys()].sort(),d=[];for(const b of c){const _=o.get(b);if(_.length>1){d.push(_);continue}const x=_[0];this.canonicalIssuer.getId(x)}for(const b of d){const _=[];for(const x of b){if(this.canonicalIssuer.hasId(x))continue;const E=new r("_:b");E.getId(x);const v=await this.hashNDegreeQuads(x,E);_.push(v)}_.sort(i);for(const x of _){const E=x.issuer.getOldIds();for(const v of E)this.canonicalIssuer.getId(v)}}const m=[];for(const b of this.quads){const _=n.serializeQuadComponents(this._componentWithCanonicalId(b.subject),b.predicate,this._componentWithCanonicalId(b.object),this._componentWithCanonicalId(b.graph));m.push(_)}return m.sort(),m.join("")}async hashFirstDegreeQuads(a){const o=[],u=this.blankNodeInfo.get(a),l=u.quads;for(const d of l){const m={subject:null,predicate:d.predicate,object:null,graph:null};m.subject=this.modifyFirstDegreeComponent(a,d.subject,"subject"),m.object=this.modifyFirstDegreeComponent(a,d.object,"object"),m.graph=this.modifyFirstDegreeComponent(a,d.graph,"graph"),o.push(n.serializeQuad(m))}o.sort();const c=this.createMessageDigest();for(const d of o)c.update(d);return u.hash=await c.digest(),u.hash}async hashRelatedBlankNode(a,o,u,l){let c;this.canonicalIssuer.hasId(a)?c=this.canonicalIssuer.getId(a):u.hasId(a)?c=u.getId(a):c=this.blankNodeInfo.get(a).hash;const d=this.createMessageDigest();return d.update(l),l!=="g"&&d.update(this.getRelatedPredicate(o)),d.update(c),d.digest()}async hashNDegreeQuads(a,o){const u=this.deepIterations.get(a)||0;if(u>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(a,u+1);const l=this.createMessageDigest(),c=await this.createHashToRelated(a,o),d=[...c.keys()].sort();for(const m of d){l.update(m);let b="",_;const x=new t(c.get(m));let E=0;for(;x.hasNext();){const v=x.next();++E%3===0&&await this._yield();let S=o.clone(),y="";const h=[];let g=!1;for(const I of v)if(this.canonicalIssuer.hasId(I)?y+=this.canonicalIssuer.getId(I):(S.hasId(I)||h.push(I),y+=S.getId(I)),b.length!==0&&y>b){g=!0;break}if(!g){for(const I of h){const C=await this.hashNDegreeQuads(I,S);if(y+=S.getId(I),y+=`<${C.hash}>`,S=C.issuer,b.length!==0&&y>b){g=!0;break}}g||(b.length===0||y<b)&&(b=y,_=S)}}l.update(b),o=_}return{hash:await l.digest(),issuer:o}}modifyFirstDegreeComponent(a,o){return o.termType!=="BlankNode"?o:{termType:"BlankNode",value:o.value===a?"_:a":"_:z"}}getRelatedPredicate(a){return`<${a.predicate.value}>`}async createHashToRelated(a,o){const u=new Map,l=this.blankNodeInfo.get(a).quads;let c=0;for(const d of l)++c%100===0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:d,component:d.subject,position:"s",id:a,issuer:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:d,component:d.object,position:"o",id:a,issuer:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:d,component:d.graph,position:"g",id:a,issuer:o,hashToRelated:u})]);return u}async _hashAndTrackBlankNode({id:a,hashToBlankNodes:o}){const u=await this.hashFirstDegreeQuads(a),l=o.get(u);l?l.push(a):o.set(u,[a])}_addBlankNodeQuadInfo({quad:a,component:o}){if(o.termType!=="BlankNode")return;const u=o.value,l=this.blankNodeInfo.get(u);l?l.quads.add(a):this.blankNodeInfo.set(u,{quads:new Set([a]),hash:null})}async _addRelatedBlankNodeHash({quad:a,component:o,position:u,id:l,issuer:c,hashToRelated:d}){if(!(o.termType==="BlankNode"&&o.value!==l))return;const m=o.value,b=await this.hashRelatedBlankNode(m,a,c,u),_=d.get(b);_?_.push(m):d.set(b,[m])}_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 i(s,a){return s.hash<a.hash?-1:s.hash>a.hash?1:0}return ns}/*!
292
318
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
293
- */var Ti,Bo;function Rf(){if(Bo)return Ti;Bo=1;const r=Dn(),e=Ku();return Ti=class extends e{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new r("sha1")}modifyFirstDegreeComponent(n,i,s){return i.termType!=="BlankNode"?i:s==="graph"?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:i.value===n?"_:a":"_:z"}}getRelatedPredicate(n){return n.predicate.value}async createHashToRelated(n,i){const s=new Map,a=this.blankNodeInfo.get(n).quads;let o=0;for(const l of a){let d,h;if(l.subject.termType==="BlankNode"&&l.subject.value!==n)h=l.subject.value,d="p";else if(l.object.termType==="BlankNode"&&l.object.value!==n)h=l.object.value,d="r";else continue;++o%100===0&&await this._yield();const y=await this.hashRelatedBlankNode(h,l,i,d),w=s.get(y);w?w.push(h):s.set(y,[h])}return s}},Ti}/*!
319
+ */var is,Tl;function bf(){if(Tl)return is;Tl=1;const r=hi(),e=Bc();return is=class extends e{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new r("sha1")}modifyFirstDegreeComponent(n,i,s){return i.termType!=="BlankNode"?i:s==="graph"?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:i.value===n?"_:a":"_:z"}}getRelatedPredicate(n){return n.predicate.value}async createHashToRelated(n,i){const s=new Map,a=this.blankNodeInfo.get(n).quads;let o=0;for(const u of a){let l,c;if(u.subject.termType==="BlankNode"&&u.subject.value!==n)c=u.subject.value,l="p";else if(u.object.termType==="BlankNode"&&u.object.value!==n)c=u.object.value,l="r";else continue;++o%100===0&&await this._yield();const d=await this.hashRelatedBlankNode(c,u,i,l),m=s.get(d);m?m.push(c):s.set(d,[c])}return s}},is}/*!
294
320
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
295
- */var Ai,Fo;function Yu(){if(Fo)return Ai;Fo=1;const r=sa(),e=Dn(),t=Xu(),n=aa();Ai=class{constructor({createMessageDigest:a=()=>new e("sha256"),canonicalIdMap:o=new Map,maxDeepIterations:l=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",o),this.createMessageDigest=a,this.maxDeepIterations=l,this.quads=null,this.deepIterations=null}main(a){this.deepIterations=new Map,this.quads=a;for(const w of a)this._addBlankNodeQuadInfo({quad:w,component:w.subject}),this._addBlankNodeQuadInfo({quad:w,component:w.object}),this._addBlankNodeQuadInfo({quad:w,component:w.graph});const o=new Map,l=[...this.blankNodeInfo.keys()];for(const w of l)this._hashAndTrackBlankNode({id:w,hashToBlankNodes:o});const d=[...o.keys()].sort(),h=[];for(const w of d){const g=o.get(w);if(g.length>1){h.push(g);continue}const m=g[0];this.canonicalIssuer.getId(m)}for(const w of h){const g=[];for(const m of w){if(this.canonicalIssuer.hasId(m))continue;const _=new r("_:b");_.getId(m);const x=this.hashNDegreeQuads(m,_);g.push(x)}g.sort(i);for(const m of g){const _=m.issuer.getOldIds();for(const x of _)this.canonicalIssuer.getId(x)}}const y=[];for(const w of this.quads){const g=n.serializeQuadComponents(this._componentWithCanonicalId({component:w.subject}),w.predicate,this._componentWithCanonicalId({component:w.object}),this._componentWithCanonicalId({component:w.graph}));y.push(g)}return y.sort(),y.join("")}hashFirstDegreeQuads(a){const o=[],l=this.blankNodeInfo.get(a),d=l.quads;for(const y of d){const w={subject:null,predicate:y.predicate,object:null,graph:null};w.subject=this.modifyFirstDegreeComponent(a,y.subject,"subject"),w.object=this.modifyFirstDegreeComponent(a,y.object,"object"),w.graph=this.modifyFirstDegreeComponent(a,y.graph,"graph"),o.push(n.serializeQuad(w))}o.sort();const h=this.createMessageDigest();for(const y of o)h.update(y);return l.hash=h.digest(),l.hash}hashRelatedBlankNode(a,o,l,d){let h;this.canonicalIssuer.hasId(a)?h=this.canonicalIssuer.getId(a):l.hasId(a)?h=l.getId(a):h=this.blankNodeInfo.get(a).hash;const y=this.createMessageDigest();return y.update(d),d!=="g"&&y.update(this.getRelatedPredicate(o)),y.update(h),y.digest()}hashNDegreeQuads(a,o){const l=this.deepIterations.get(a)||0;if(l>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(a,l+1);const d=this.createMessageDigest(),h=this.createHashToRelated(a,o),y=[...h.keys()].sort();for(const w of y){d.update(w);let g="",m;const _=new t(h.get(w));for(;_.hasNext();){const x=_.next();let S=o.clone(),I="";const b=[];let c=!1;for(const p of x)if(this.canonicalIssuer.hasId(p)?I+=this.canonicalIssuer.getId(p):(S.hasId(p)||b.push(p),I+=S.getId(p)),g.length!==0&&I>g){c=!0;break}if(!c){for(const p of b){const N=this.hashNDegreeQuads(p,S);if(I+=S.getId(p),I+=`<${N.hash}>`,S=N.issuer,g.length!==0&&I>g){c=!0;break}}c||(g.length===0||I<g)&&(g=I,m=S)}}d.update(g),o=m}return{hash:d.digest(),issuer:o}}modifyFirstDegreeComponent(a,o){return o.termType!=="BlankNode"?o:{termType:"BlankNode",value:o.value===a?"_:a":"_:z"}}getRelatedPredicate(a){return`<${a.predicate.value}>`}createHashToRelated(a,o){const l=new Map,d=this.blankNodeInfo.get(a).quads;for(const h of d)this._addRelatedBlankNodeHash({quad:h,component:h.subject,position:"s",id:a,issuer:o,hashToRelated:l}),this._addRelatedBlankNodeHash({quad:h,component:h.object,position:"o",id:a,issuer:o,hashToRelated:l}),this._addRelatedBlankNodeHash({quad:h,component:h.graph,position:"g",id:a,issuer:o,hashToRelated:l});return l}_hashAndTrackBlankNode({id:a,hashToBlankNodes:o}){const l=this.hashFirstDegreeQuads(a),d=o.get(l);d?d.push(a):o.set(l,[a])}_addBlankNodeQuadInfo({quad:a,component:o}){if(o.termType!=="BlankNode")return;const l=o.value,d=this.blankNodeInfo.get(l);d?d.quads.add(a):this.blankNodeInfo.set(l,{quads:new Set([a]),hash:null})}_addRelatedBlankNodeHash({quad:a,component:o,position:l,id:d,issuer:h,hashToRelated:y}){if(!(o.termType==="BlankNode"&&o.value!==d))return;const w=o.value,g=this.hashRelatedBlankNode(w,a,h,l),m=y.get(g);m?m.push(w):y.set(g,[w])}_componentWithCanonicalId({component:a}){return a.termType==="BlankNode"&&!a.value.startsWith(this.canonicalIssuer.prefix)?{termType:"BlankNode",value:this.canonicalIssuer.getId(a.value)}:a}};function i(s,a){return s.hash<a.hash?-1:s.hash>a.hash?1:0}return Ai}/*!
321
+ */var ss,Al;function qc(){if(Al)return ss;Al=1;const r=$a(),e=hi(),t=Mc(),n=Fa();ss=class{constructor({createMessageDigest:a=()=>new e("sha256"),canonicalIdMap:o=new Map,maxDeepIterations:u=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",o),this.createMessageDigest=a,this.maxDeepIterations=u,this.quads=null,this.deepIterations=null}main(a){this.deepIterations=new Map,this.quads=a;for(const m of a)this._addBlankNodeQuadInfo({quad:m,component:m.subject}),this._addBlankNodeQuadInfo({quad:m,component:m.object}),this._addBlankNodeQuadInfo({quad:m,component:m.graph});const o=new Map,u=[...this.blankNodeInfo.keys()];for(const m of u)this._hashAndTrackBlankNode({id:m,hashToBlankNodes:o});const l=[...o.keys()].sort(),c=[];for(const m of l){const b=o.get(m);if(b.length>1){c.push(b);continue}const _=b[0];this.canonicalIssuer.getId(_)}for(const m of c){const b=[];for(const _ of m){if(this.canonicalIssuer.hasId(_))continue;const x=new r("_:b");x.getId(_);const E=this.hashNDegreeQuads(_,x);b.push(E)}b.sort(i);for(const _ of b){const x=_.issuer.getOldIds();for(const E of x)this.canonicalIssuer.getId(E)}}const d=[];for(const m of this.quads){const b=n.serializeQuadComponents(this._componentWithCanonicalId({component:m.subject}),m.predicate,this._componentWithCanonicalId({component:m.object}),this._componentWithCanonicalId({component:m.graph}));d.push(b)}return d.sort(),d.join("")}hashFirstDegreeQuads(a){const o=[],u=this.blankNodeInfo.get(a),l=u.quads;for(const d of l){const m={subject:null,predicate:d.predicate,object:null,graph:null};m.subject=this.modifyFirstDegreeComponent(a,d.subject,"subject"),m.object=this.modifyFirstDegreeComponent(a,d.object,"object"),m.graph=this.modifyFirstDegreeComponent(a,d.graph,"graph"),o.push(n.serializeQuad(m))}o.sort();const c=this.createMessageDigest();for(const d of o)c.update(d);return u.hash=c.digest(),u.hash}hashRelatedBlankNode(a,o,u,l){let c;this.canonicalIssuer.hasId(a)?c=this.canonicalIssuer.getId(a):u.hasId(a)?c=u.getId(a):c=this.blankNodeInfo.get(a).hash;const d=this.createMessageDigest();return d.update(l),l!=="g"&&d.update(this.getRelatedPredicate(o)),d.update(c),d.digest()}hashNDegreeQuads(a,o){const u=this.deepIterations.get(a)||0;if(u>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(a,u+1);const l=this.createMessageDigest(),c=this.createHashToRelated(a,o),d=[...c.keys()].sort();for(const m of d){l.update(m);let b="",_;const x=new t(c.get(m));for(;x.hasNext();){const E=x.next();let v=o.clone(),S="";const y=[];let h=!1;for(const g of E)if(this.canonicalIssuer.hasId(g)?S+=this.canonicalIssuer.getId(g):(v.hasId(g)||y.push(g),S+=v.getId(g)),b.length!==0&&S>b){h=!0;break}if(!h){for(const g of y){const I=this.hashNDegreeQuads(g,v);if(S+=v.getId(g),S+=`<${I.hash}>`,v=I.issuer,b.length!==0&&S>b){h=!0;break}}h||(b.length===0||S<b)&&(b=S,_=v)}}l.update(b),o=_}return{hash:l.digest(),issuer:o}}modifyFirstDegreeComponent(a,o){return o.termType!=="BlankNode"?o:{termType:"BlankNode",value:o.value===a?"_:a":"_:z"}}getRelatedPredicate(a){return`<${a.predicate.value}>`}createHashToRelated(a,o){const u=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:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:c,component:c.object,position:"o",id:a,issuer:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:c,component:c.graph,position:"g",id:a,issuer:o,hashToRelated:u});return u}_hashAndTrackBlankNode({id:a,hashToBlankNodes:o}){const u=this.hashFirstDegreeQuads(a),l=o.get(u);l?l.push(a):o.set(u,[a])}_addBlankNodeQuadInfo({quad:a,component:o}){if(o.termType!=="BlankNode")return;const u=o.value,l=this.blankNodeInfo.get(u);l?l.quads.add(a):this.blankNodeInfo.set(u,{quads:new Set([a]),hash:null})}_addRelatedBlankNodeHash({quad:a,component:o,position:u,id:l,issuer:c,hashToRelated:d}){if(!(o.termType==="BlankNode"&&o.value!==l))return;const m=o.value,b=this.hashRelatedBlankNode(m,a,c,u),_=d.get(b);_?_.push(m):d.set(b,[m])}_componentWithCanonicalId({component:a}){return a.termType==="BlankNode"&&!a.value.startsWith(this.canonicalIssuer.prefix)?{termType:"BlankNode",value:this.canonicalIssuer.getId(a.value)}:a}};function i(s,a){return s.hash<a.hash?-1:s.hash>a.hash?1:0}return ss}/*!
296
322
  * Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
297
- */var Li,Uo;function Nf(){if(Uo)return Li;Uo=1;const r=Dn(),e=Yu();return Li=class extends e{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new r("sha1")}modifyFirstDegreeComponent(n,i,s){return i.termType!=="BlankNode"?i:s==="graph"?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:i.value===n?"_:a":"_:z"}}getRelatedPredicate(n){return n.predicate.value}createHashToRelated(n,i){const s=new Map,a=this.blankNodeInfo.get(n).quads;for(const o of a){let l,d;if(o.subject.termType==="BlankNode"&&o.subject.value!==n)d=o.subject.value,l="p";else if(o.object.termType==="BlankNode"&&o.object.value!==n)d=o.object.value,l="r";else continue;const h=this.hashRelatedBlankNode(d,o,i,l),y=s.get(h);y?y.push(d):s.set(h,[d])}return s}},Li}const Tf={},Af=Object.freeze(Object.defineProperty({__proto__:null,default:Tf},Symbol.toStringTag,{value:"Module"})),Lf=xc(Af);var Ho;function jf(){return Ho||(Ho=1,function(r){const e=Ku(),t=Rf(),n=Yu(),i=Nf();let s;try{s=Lf}catch{}function a(o){return Array.isArray(o)?o:r.NQuads.legacyDatasetToQuads(o)}r.NQuads=aa(),r.IdentifierIssuer=sa(),r._rdfCanonizeNative=function(o){return o&&(s=o),s},r.canonize=async function(o,l){const d=a(o);if(l.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(l.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return new Promise((h,y)=>s.canonize(d,l,(w,g)=>w?y(w):h(g)))}if(l.algorithm==="URDNA2015")return new e(l).main(d);if(l.algorithm==="URGNA2012"){if(l.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new t(l).main(d)}throw"algorithm"in l?new Error("Invalid RDF Dataset Canonicalization algorithm: "+l.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")},r._canonizeSync=function(o,l){const d=a(o);if(l.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(l.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return s.canonizeSync(d,l)}if(l.algorithm==="URDNA2015")return new n(l).main(d);if(l.algorithm==="URGNA2012"){if(l.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new i(l).main(d)}throw"algorithm"in l?new Error("Invalid RDF Dataset Canonicalization algorithm: "+l.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")}}(_i)),_i}var ji,Vo;function oa(){return Vo||(Vo=1,ji=jf()),ji}var Oi,Go;function Ke(){if(Go)return Oi;Go=1;const r={};return Oi=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",Oi}var $i,Wo;function _t(){if(Wo)return $i;Wo=1;const r=Ke(),e={};return $i=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(n=>n!=="@id"&&n!=="@index").length===1,e.isSimpleGraph=t=>e.isGraph(t)&&!("@id"in t),e.isBlankNode=t=>{if(r.isObject(t)){if("@id"in t){const n=t["@id"];return!r.isString(n)||n.indexOf("_:")===0}return Object.keys(t).length===0||!("@value"in t||"@set"in t||"@list"in t)}return!1},$i}var ki,zo;function rt(){return zo||(zo=1,ki=class extends Error{constructor(e="An unspecified JSON-LD error occurred.",t="jsonld.Error",n={}){super(e),this.name=t,this.message=e,this.details=n}}),ki}var Di,Jo;function et(){if(Jo)return Di;Jo=1;const r=_t(),e=Ke(),t=oa().IdentifierIssuer,n=rt(),i=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,a=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,o=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,l=/^@[a-zA-Z]+$/,d={headers:{accept:"application/ld+json, application/json"}},h={};Di=h,h.IdentifierIssuer=t,h.REGEX_BCP47=i,h.REGEX_KEYWORD=l,h.clone=function(w){if(w&&typeof w=="object"){let g;if(e.isArray(w)){g=[];for(let m=0;m<w.length;++m)g[m]=h.clone(w[m])}else if(w instanceof Map){g=new Map;for(const[m,_]of w)g.set(m,h.clone(_))}else if(w instanceof Set){g=new Set;for(const m of w)g.add(h.clone(m))}else if(e.isObject(w)){g={};for(const m in w)g[m]=h.clone(w[m])}else g=w.toString();return g}return w},h.asArray=function(w){return Array.isArray(w)?w:[w]},h.buildHeaders=(w={})=>{if(Object.keys(w).some(m=>m.toLowerCase()==="accept"))throw new RangeError('Accept header may not be specified; only "'+d.headers.accept+'" is supported.');return Object.assign({Accept:d.headers.accept},w)},h.parseLinkHeader=w=>{const g={},m=w.match(s);for(let _=0;_<m.length;++_){let x=m[_].match(a);if(!x)continue;const S={target:x[1]},I=x[2];for(;x=o.exec(I);)S[x[1]]=x[2]===void 0?x[3]:x[2];const b=S.rel||"";Array.isArray(g[b])?g[b].push(S):g.hasOwnProperty(b)?g[b]=[g[b],S]:g[b]=S}return g},h.validateTypeValue=(w,g)=>{if(!e.isString(w)&&!(e.isArray(w)&&w.every(m=>e.isString(m)))){if(g&&e.isObject(w))switch(Object.keys(w).length){case 0:return;case 1:if("@default"in w&&h.asArray(w["@default"]).every(m=>e.isString(m)))return}throw new n('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:w})}},h.hasProperty=(w,g)=>{if(w.hasOwnProperty(g)){const m=w[g];return!e.isArray(m)||m.length>0}return!1},h.hasValue=(w,g,m)=>{if(h.hasProperty(w,g)){let _=w[g];const x=r.isList(_);if(e.isArray(_)||x){x&&(_=_["@list"]);for(let S=0;S<_.length;++S)if(h.compareValues(m,_[S]))return!0}else if(!e.isArray(m))return h.compareValues(m,_)}return!1},h.addValue=(w,g,m,_)=>{if(_=_||{},"propertyIsArray"in _||(_.propertyIsArray=!1),"valueIsArray"in _||(_.valueIsArray=!1),"allowDuplicate"in _||(_.allowDuplicate=!0),"prependValue"in _||(_.prependValue=!1),_.valueIsArray)w[g]=m;else if(e.isArray(m)){m.length===0&&_.propertyIsArray&&!w.hasOwnProperty(g)&&(w[g]=[]),_.prependValue&&(m=m.concat(w[g]),w[g]=[]);for(let x=0;x<m.length;++x)h.addValue(w,g,m[x],_)}else if(w.hasOwnProperty(g)){const x=!_.allowDuplicate&&h.hasValue(w,g,m);!e.isArray(w[g])&&(!x||_.propertyIsArray)&&(w[g]=[w[g]]),x||(_.prependValue?w[g].unshift(m):w[g].push(m))}else w[g]=_.propertyIsArray?[m]:m},h.getValues=(w,g)=>[].concat(w[g]||[]),h.removeProperty=(w,g)=>{delete w[g]},h.removeValue=(w,g,m,_)=>{_=_||{},"propertyIsArray"in _||(_.propertyIsArray=!1);const x=h.getValues(w,g).filter(S=>!h.compareValues(S,m));x.length===0?h.removeProperty(w,g):x.length===1&&!_.propertyIsArray?w[g]=x[0]:w[g]=x},h.relabelBlankNodes=(w,g)=>{g=g||{};const m=g.issuer||new t("_:b");return y(m,w)},h.compareValues=(w,g)=>w===g||r.isValue(w)&&r.isValue(g)&&w["@value"]===g["@value"]&&w["@type"]===g["@type"]&&w["@language"]===g["@language"]&&w["@index"]===g["@index"]?!0:e.isObject(w)&&"@id"in w&&e.isObject(g)&&"@id"in g?w["@id"]===g["@id"]:!1,h.compareShortestLeast=(w,g)=>w.length<g.length?-1:g.length<w.length?1:w===g?0:w<g?-1:1;function y(w,g){if(e.isArray(g))for(let m=0;m<g.length;++m)g[m]=y(w,g[m]);else if(r.isList(g))g["@list"]=y(w,g["@list"]);else if(e.isObject(g)){r.isBlankNode(g)&&(g["@id"]=w.getId(g["@id"]));const m=Object.keys(g).sort();for(let _=0;_<m.length;++_){const x=m[_];x!=="@id"&&(g[x]=y(w,g[x]))}}return g}return Di}var Mi,Qo;function la(){if(Qo)return Mi;Qo=1;const r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",e="http://www.w3.org/2001/XMLSchema#";return Mi={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"},Mi}var Ci,Xo;function Zu(){return Xo||(Xo=1,Ci=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]}}}),Ci}var Pi,Ko;function At(){if(Ko)return Pi;Ko=1;const r=Ke(),e={};Pi=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=(n,i)=>{const s={},a=e.parsers[i||"full"],o=a.regex.exec(n);let l=a.keys.length;for(;l--;)s[a.keys[l]]=o[l]===void 0?null:o[l];return(s.scheme==="https"&&s.port==="443"||s.scheme==="http"&&s.port==="80")&&(s.href=s.href.replace(":"+s.port,""),s.authority=s.authority.replace(":"+s.port,""),s.port=null),s.normalizedPath=e.removeDotSegments(s.path),s},e.prependBase=(n,i)=>{if(n===null||e.isAbsolute(i))return i;(!n||r.isString(n))&&(n=e.parse(n||""));const s=e.parse(i),a={protocol:n.protocol||""};if(s.authority!==null)a.authority=s.authority,a.path=s.path,a.query=s.query;else if(a.authority=n.authority,s.path==="")a.path=n.path,s.query!==null?a.query=s.query:a.query=n.query;else{if(s.path.indexOf("/")===0)a.path=s.path;else{let l=n.path;l=l.substr(0,l.lastIndexOf("/")+1),(l.length>0||n.authority)&&l.substr(-1)!=="/"&&(l+="/"),l+=s.path,a.path=l}a.query=s.query}s.path!==""&&(a.path=e.removeDotSegments(a.path));let o=a.protocol;return a.authority!==null&&(o+="//"+a.authority),o+=a.path,a.query!==null&&(o+="?"+a.query),s.fragment!==null&&(o+="#"+s.fragment),o===""&&(o="./"),o},e.removeBase=(n,i)=>{if(n===null)return i;(!n||r.isString(n))&&(n=e.parse(n||""));let s="";if(n.href!==""?s+=(n.protocol||"")+"//"+(n.authority||""):i.indexOf("//")&&(s+="//"),i.indexOf(s)!==0)return i;const a=e.parse(i.substr(s.length)),o=n.normalizedPath.split("/"),l=a.normalizedPath.split("/"),d=a.fragment||a.query?0:1;for(;o.length>0&&l.length>d&&o[0]===l[0];)o.shift(),l.shift();let h="";if(o.length>0){o.pop();for(let y=0;y<o.length;++y)h+="../"}return h+=l.join("/"),a.query!==null&&(h+="?"+a.query),a.fragment!==null&&(h+="#"+a.fragment),h===""&&(h="./"),h},e.removeDotSegments=n=>{if(n.length===0)return"";const i=n.split("/"),s=[];for(;i.length>0;){const a=i.shift(),o=i.length===0;if(a==="."){o&&s.push("");continue}if(a===".."){s.pop(),o&&s.push("");continue}s.push(a)}return n[0]==="/"&&s.length>0&&s[0]!==""&&s.unshift(""),s.length===1&&s[0]===""?"/":s.join("/")};const t=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;return e.isAbsolute=n=>r.isString(n)&&t.test(n),e.isRelative=n=>r.isString(n),Pi}var qi,Yo;function Of(){if(Yo)return qi;Yo=1;const{parseLinkHeader:r,buildHeaders:e}=et(),{LINK_HEADER_CONTEXT:t}=la(),n=rt(),i=Zu(),{prependBase:s}=At(),a=/(^|(\r\n))link:/i;qi=({secure:l,headers:d={},xhr:h}={headers:{}})=>{return d=e(d),new i().wrapLoader(w);async function w(g){if(g.indexOf("http:")!==0&&g.indexOf("https:")!==0)throw new n('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:g});if(l&&g.indexOf("https")!==0)throw new n(`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 m;try{m=await o(h,g,d)}catch(b){throw new n("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:g,cause:b})}if(m.status>=400)throw new n("URL could not be dereferenced: "+m.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:g,httpStatusCode:m.status});let _={contextUrl:null,documentUrl:g,document:m.response},x=null;const S=m.getResponseHeader("Content-Type");let I;if(a.test(m.getAllResponseHeaders())&&(I=m.getResponseHeader("Link")),I&&S!=="application/ld+json"){const b=r(I),c=b[t];if(Array.isArray(c))throw new n("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:g});c&&(_.contextUrl=c.target),x=b.alternate,x&&x.type=="application/ld+json"&&!(S||"").match(/^application\/(\w*\+)?json$/)&&(_=await w(s(g,x.target)))}return _}};function o(l,d,h){l=l||XMLHttpRequest;const y=new l;return new Promise((w,g)=>{y.onload=()=>w(y),y.onerror=m=>g(m),y.open("GET",d,!0);for(const m in h)y.setRequestHeader(m,h[m]);y.send()})}return qi}var Bi,Zo;function $f(){if(Zo)return Bi;Zo=1;const r=Of(),e={};return Bi=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})},Bi}var Fi,el;function kf(){return el||(el=1,Fi=function(r){r.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),Fi}var Ui,tl;function Df(){if(tl)return Ui;tl=1,Ui=r,r.Node=i,r.create=r;function r(s){var a=this;if(a instanceof r||(a=new r),a.tail=null,a.head=null,a.length=0,s&&typeof s.forEach=="function")s.forEach(function(d){a.push(d)});else if(arguments.length>0)for(var o=0,l=arguments.length;o<l;o++)a.push(arguments[o]);return a}r.prototype.removeNode=function(s){if(s.list!==this)throw new Error("removing node which does not belong to this list");var a=s.next,o=s.prev;return a&&(a.prev=o),o&&(o.next=a),s===this.head&&(this.head=a),s===this.tail&&(this.tail=o),s.list.length--,s.next=null,s.prev=null,s.list=null,a},r.prototype.unshiftNode=function(s){if(s!==this.head){s.list&&s.list.removeNode(s);var a=this.head;s.list=this,s.next=a,a&&(a.prev=s),this.head=s,this.tail||(this.tail=s),this.length++}},r.prototype.pushNode=function(s){if(s!==this.tail){s.list&&s.list.removeNode(s);var a=this.tail;s.list=this,s.prev=a,a&&(a.next=s),this.tail=s,this.head||(this.head=s),this.length++}},r.prototype.push=function(){for(var s=0,a=arguments.length;s<a;s++)t(this,arguments[s]);return this.length},r.prototype.unshift=function(){for(var s=0,a=arguments.length;s<a;s++)n(this,arguments[s]);return this.length},r.prototype.pop=function(){if(this.tail){var s=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,s}},r.prototype.shift=function(){if(this.head){var s=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,s}},r.prototype.forEach=function(s,a){a=a||this;for(var o=this.head,l=0;o!==null;l++)s.call(a,o.value,l,this),o=o.next},r.prototype.forEachReverse=function(s,a){a=a||this;for(var o=this.tail,l=this.length-1;o!==null;l--)s.call(a,o.value,l,this),o=o.prev},r.prototype.get=function(s){for(var a=0,o=this.head;o!==null&&a<s;a++)o=o.next;if(a===s&&o!==null)return o.value},r.prototype.getReverse=function(s){for(var a=0,o=this.tail;o!==null&&a<s;a++)o=o.prev;if(a===s&&o!==null)return o.value},r.prototype.map=function(s,a){a=a||this;for(var o=new r,l=this.head;l!==null;)o.push(s.call(a,l.value,this)),l=l.next;return o},r.prototype.mapReverse=function(s,a){a=a||this;for(var o=new r,l=this.tail;l!==null;)o.push(s.call(a,l.value,this)),l=l.prev;return o},r.prototype.reduce=function(s,a){var o,l=this.head;if(arguments.length>1)o=a;else if(this.head)l=this.head.next,o=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var d=0;l!==null;d++)o=s(o,l.value,d),l=l.next;return o},r.prototype.reduceReverse=function(s,a){var o,l=this.tail;if(arguments.length>1)o=a;else if(this.tail)l=this.tail.prev,o=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var d=this.length-1;l!==null;d--)o=s(o,l.value,d),l=l.prev;return o},r.prototype.toArray=function(){for(var s=new Array(this.length),a=0,o=this.head;o!==null;a++)s[a]=o.value,o=o.next;return s},r.prototype.toArrayReverse=function(){for(var s=new Array(this.length),a=0,o=this.tail;o!==null;a++)s[a]=o.value,o=o.prev;return s},r.prototype.slice=function(s,a){a=a||this.length,a<0&&(a+=this.length),s=s||0,s<0&&(s+=this.length);var o=new r;if(a<s||a<0)return o;s<0&&(s=0),a>this.length&&(a=this.length);for(var l=0,d=this.head;d!==null&&l<s;l++)d=d.next;for(;d!==null&&l<a;l++,d=d.next)o.push(d.value);return o},r.prototype.sliceReverse=function(s,a){a=a||this.length,a<0&&(a+=this.length),s=s||0,s<0&&(s+=this.length);var o=new r;if(a<s||a<0)return o;s<0&&(s=0),a>this.length&&(a=this.length);for(var l=this.length,d=this.tail;d!==null&&l>a;l--)d=d.prev;for(;d!==null&&l>s;l--,d=d.prev)o.push(d.value);return o},r.prototype.splice=function(s,a,...o){s>this.length&&(s=this.length-1),s<0&&(s=this.length+s);for(var l=0,d=this.head;d!==null&&l<s;l++)d=d.next;for(var h=[],l=0;d&&l<a;l++)h.push(d.value),d=this.removeNode(d);d===null&&(d=this.tail),d!==this.head&&d!==this.tail&&(d=d.prev);for(var l=0;l<o.length;l++)d=e(this,d,o[l]);return h},r.prototype.reverse=function(){for(var s=this.head,a=this.tail,o=s;o!==null;o=o.prev){var l=o.prev;o.prev=o.next,o.next=l}return this.head=a,this.tail=s,this};function e(s,a,o){var l=a===s.head?new i(o,null,a,s):new i(o,a,a.next,s);return l.next===null&&(s.tail=l),l.prev===null&&(s.head=l),s.length++,l}function t(s,a){s.tail=new i(a,s.tail,null,s),s.head||(s.head=s.tail),s.length++}function n(s,a){s.head=new i(a,null,s.head,s),s.tail||(s.tail=s.head),s.length++}function i(s,a,o,l){if(!(this instanceof i))return new i(s,a,o,l);this.list=l,this.value=s,a?(a.next=this,this.prev=a):this.prev=null,o?(o.prev=this,this.next=o):this.next=null}try{kf()(r)}catch{}return Ui}var Hi,rl;function ec(){if(rl)return Hi;rl=1;const r=Df(),e=Symbol("max"),t=Symbol("length"),n=Symbol("lengthCalculator"),i=Symbol("allowStale"),s=Symbol("maxAge"),a=Symbol("dispose"),o=Symbol("noDisposeOnSet"),l=Symbol("lruList"),d=Symbol("cache"),h=Symbol("updateAgeOnGet"),y=()=>1;class w{constructor(c){if(typeof c=="number"&&(c={max:c}),c||(c={}),c.max&&(typeof c.max!="number"||c.max<0))throw new TypeError("max must be a non-negative number");this[e]=c.max||1/0;const p=c.length||y;if(this[n]=typeof p!="function"?y:p,this[i]=c.stale||!1,c.maxAge&&typeof c.maxAge!="number")throw new TypeError("maxAge must be a number");this[s]=c.maxAge||0,this[a]=c.dispose,this[o]=c.noDisposeOnSet||!1,this[h]=c.updateAgeOnGet||!1,this.reset()}set max(c){if(typeof c!="number"||c<0)throw new TypeError("max must be a non-negative number");this[e]=c||1/0,_(this)}get max(){return this[e]}set allowStale(c){this[i]=!!c}get allowStale(){return this[i]}set maxAge(c){if(typeof c!="number")throw new TypeError("maxAge must be a non-negative number");this[s]=c,_(this)}get maxAge(){return this[s]}set lengthCalculator(c){typeof c!="function"&&(c=y),c!==this[n]&&(this[n]=c,this[t]=0,this[l].forEach(p=>{p.length=this[n](p.value,p.key),this[t]+=p.length})),_(this)}get lengthCalculator(){return this[n]}get length(){return this[t]}get itemCount(){return this[l].length}rforEach(c,p){p=p||this;for(let N=this[l].tail;N!==null;){const D=N.prev;I(this,c,N,p),N=D}}forEach(c,p){p=p||this;for(let N=this[l].head;N!==null;){const D=N.next;I(this,c,N,p),N=D}}keys(){return this[l].toArray().map(c=>c.key)}values(){return this[l].toArray().map(c=>c.value)}reset(){this[a]&&this[l]&&this[l].length&&this[l].forEach(c=>this[a](c.key,c.value)),this[d]=new Map,this[l]=new r,this[t]=0}dump(){return this[l].map(c=>m(this,c)?!1:{k:c.key,v:c.value,e:c.now+(c.maxAge||0)}).toArray().filter(c=>c)}dumpLru(){return this[l]}set(c,p,N){if(N=N||this[s],N&&typeof N!="number")throw new TypeError("maxAge must be a number");const D=N?Date.now():0,T=this[n](p,c);if(this[d].has(c)){if(T>this[e])return x(this,this[d].get(c)),!1;const M=this[d].get(c).value;return this[a]&&(this[o]||this[a](c,M.value)),M.now=D,M.maxAge=N,M.value=p,this[t]+=T-M.length,M.length=T,this.get(c),_(this),!0}const q=new S(c,p,T,D,N);return q.length>this[e]?(this[a]&&this[a](c,p),!1):(this[t]+=q.length,this[l].unshift(q),this[d].set(c,this[l].head),_(this),!0)}has(c){if(!this[d].has(c))return!1;const p=this[d].get(c).value;return!m(this,p)}get(c){return g(this,c,!0)}peek(c){return g(this,c,!1)}pop(){const c=this[l].tail;return c?(x(this,c),c.value):null}del(c){x(this,this[d].get(c))}load(c){this.reset();const p=Date.now();for(let N=c.length-1;N>=0;N--){const D=c[N],T=D.e||0;if(T===0)this.set(D.k,D.v);else{const q=T-p;q>0&&this.set(D.k,D.v,q)}}}prune(){this[d].forEach((c,p)=>g(this,p,!1))}}const g=(b,c,p)=>{const N=b[d].get(c);if(N){const D=N.value;if(m(b,D)){if(x(b,N),!b[i])return}else p&&(b[h]&&(N.value.now=Date.now()),b[l].unshiftNode(N));return D.value}},m=(b,c)=>{if(!c||!c.maxAge&&!b[s])return!1;const p=Date.now()-c.now;return c.maxAge?p>c.maxAge:b[s]&&p>b[s]},_=b=>{if(b[t]>b[e])for(let c=b[l].tail;b[t]>b[e]&&c!==null;){const p=c.prev;x(b,c),c=p}},x=(b,c)=>{if(c){const p=c.value;b[a]&&b[a](p.key,p.value),b[t]-=p.length,b[d].delete(p.key),b[l].removeNode(c)}};class S{constructor(c,p,N,D,T){this.key=c,this.value=p,this.length=N,this.now=D,this.maxAge=T||0}}const I=(b,c,p,N)=>{let D=p.value;m(b,D)&&(x(b,p),b[i]||(D=void 0)),D&&c.call(N,D.value,D.key,b)};return Hi=w,Hi}var Vi,nl;function Mf(){if(nl)return Vi;nl=1;const r=ec(),e=10;return Vi=class{constructor({document:n}){this.document=n,this.cache=new r({max:e})}getProcessed(n){return this.cache.get(n)}setProcessed(n,i){this.cache.set(n,i)}},Vi}var Gi,il;function Cf(){if(il)return Gi;il=1;const{isArray:r,isObject:e,isString:t}=Ke(),{asArray:n}=et(),{prependBase:i}=At(),s=rt(),a=Mf(),o=10;Gi=class{constructor({sharedCache:y}){this.perOpCache=new Map,this.sharedCache=y}async resolve({activeCtx:y,context:w,documentLoader:g,base:m,cycles:_=new Set}){w&&e(w)&&w["@context"]&&(w=w["@context"]),w=n(w);const x=[];for(const S of w){if(t(S)){let c=this._get(S);c||(c=await this._resolveRemoteContext({activeCtx:y,url:S,documentLoader:g,base:m,cycles:_})),r(c)?x.push(...c):x.push(c);continue}if(S===null){x.push(new a({document:null}));continue}e(S)||l(w);const I=JSON.stringify(S);let b=this._get(I);b||(b=new a({document:S}),this._cacheResolvedContext({key:I,resolved:b,tag:"static"})),x.push(b)}return x}_get(y){let w=this.perOpCache.get(y);if(!w){const g=this.sharedCache.get(y);g&&(w=g.get("static"),w&&this.perOpCache.set(y,w))}return w}_cacheResolvedContext({key:y,resolved:w,tag:g}){if(this.perOpCache.set(y,w),g!==void 0){let m=this.sharedCache.get(y);m||(m=new Map,this.sharedCache.set(y,m)),m.set(g,w)}return w}async _resolveRemoteContext({activeCtx:y,url:w,documentLoader:g,base:m,cycles:_}){w=i(m,w);const{context:x,remoteDoc:S}=await this._fetchContext({activeCtx:y,url:w,documentLoader:g,cycles:_});m=S.documentUrl||w,d({context:x,base:m});const I=await this.resolve({activeCtx:y,context:x,documentLoader:g,base:m,cycles:_});return this._cacheResolvedContext({key:w,resolved:I,tag:S.tag}),I}async _fetchContext({activeCtx:y,url:w,documentLoader:g,cycles:m}){if(m.size>o)throw new s("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:y.processingMode==="json-ld-1.0"?"loading remote context failed":"context overflow",max:o});if(m.has(w))throw new s("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:y.processingMode==="json-ld-1.0"?"recursive context inclusion":"context overflow",url:w});m.add(w);let _,x;try{x=await g(w),_=x.document||null,t(_)&&(_=JSON.parse(_))}catch(S){throw new s(`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: "${w}".`,"jsonld.InvalidUrl",{code:"loading remote context failed",url:w,cause:S})}if(!e(_))throw new s(`Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object. URL: "${w}".`,"jsonld.InvalidUrl",{code:"invalid remote context",url:w});return"@context"in _?_={"@context":_["@context"]}:_={"@context":{}},x.contextUrl&&(r(_["@context"])||(_["@context"]=[_["@context"]]),_["@context"].push(x.contextUrl)),{context:_,remoteDoc:x}}};function l(h){throw new s("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:h})}function d({context:h,base:y}){if(!h)return;const w=h["@context"];if(t(w)){h["@context"]=i(y,w);return}if(r(w)){for(let g=0;g<w.length;++g){const m=w[g];if(t(m)){w[g]=i(y,m);continue}e(m)&&d({context:{"@context":m},base:y})}return}if(e(w))for(const g in w)d({context:w[g],base:y})}return Gi}var Wi,sl;function Pf(){return sl||(sl=1,Wi=oa().NQuads),Wi}var zi,al;function Kr(){if(al)return zi;al=1;const r=rt(),{isArray:e}=Ke(),{asArray:t}=et(),n={};zi=n,n.defaultEventHandler=null,n.setupEventHandler=({options:a={}})=>{const o=[].concat(a.safe?n.safeEventHandler:[],a.eventHandler?t(a.eventHandler):[],n.defaultEventHandler?n.defaultEventHandler:[]);return o.length===0?null:o},n.handleEvent=({event:a,options:o})=>{i({event:a,handlers:o.eventHandler})};function i({event:a,handlers:o}){let l=!0;for(let d=0;l&&d<o.length;++d){l=!1;const h=o[d];if(e(h))l=i({event:a,handlers:h});else if(typeof h=="function")h({event:a,next:()=>{l=!0}});else if(typeof h=="object")a.code in h?h[a.code]({event:a,next:()=>{l=!0}}):l=!0;else throw new r("Invalid event handler.","jsonld.InvalidEventHandler",{event:a})}return l}const s=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 n.safeEventHandler=function({event:o,next:l}){if(o.level==="warning"&&s.has(o.code))throw new r("Safe mode validation error.","jsonld.ValidationError",{event:o});l()},n.logEventHandler=function({event:o,next:l}){console.log(`EVENT: ${o.message}`,{event:o}),l()},n.logWarningEventHandler=function({event:o,next:l}){o.level==="warning"&&console.warn(`WARNING: ${o.message}`,{event:o}),l()},n.unhandledEventHandler=function({event:o}){throw new r("No handler for event.","jsonld.UnhandledEvent",{event:o})},n.setDefaultEventHandler=function({eventHandler:a}={}){n.defaultEventHandler=a?t(a):null},zi}var Ji,ol;function Ut(){if(ol)return Ji;ol=1;const r=et(),e=rt(),{isArray:t,isObject:n,isString:i,isUndefined:s}=Ke(),{isAbsolute:a,isRelative:o,prependBase:l}=At(),{handleEvent:d}=Kr(),{REGEX_BCP47:h,REGEX_KEYWORD:y,asArray:w,compareShortestLeast:g}=et(),m=new Map,_=1e4,x={};Ji=x,x.process=async({activeCtx:b,localCtx:c,options:p,propagate:N=!0,overrideProtected:D=!1,cycles:T=new Set})=>{if(n(c)&&"@context"in c&&t(c["@context"])&&(c=c["@context"]),w(c).length===0)return b;const R=[],M=[({event:Y,next:L})=>{R.push(Y),L()}];p.eventHandler&&M.push(p.eventHandler);const B=p;p={...p,eventHandler:M};const A=await p.contextResolver.resolve({activeCtx:b,context:c,documentLoader:p.documentLoader,base:p.base});n(A[0].document)&&typeof A[0].document["@propagate"]=="boolean"&&(N=A[0].document["@propagate"]);let j=b;!N&&!j.previousContext&&(j=j.clone(),j.previousContext=b);for(const Y of A){let{document:L}=Y;if(b=j,L===null){if(!D&&Object.keys(b.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=b=x.getInitialContext(p).clone();continue}const ee=Y.getProcessed(b);if(ee){if(B.eventHandler)for(const K of ee.events)d({event:K,options:B});j=b=ee.context;continue}if(n(L)&&"@context"in L&&(L=L["@context"]),!n(L))throw new e("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:L});j=j.clone();const C=new Map;if("@version"in L){if(L["@version"]!==1.1)throw new e("Unsupported JSON-LD version: "+L["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:L});if(b.processingMode&&b.processingMode==="json-ld-1.0")throw new e("@version: "+L["@version"]+" not compatible with "+b.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:L});j.processingMode="json-ld-1.1",j["@version"]=L["@version"],C.set("@version",!0)}if(j.processingMode=j.processingMode||b.processingMode,"@base"in L){let K=L["@base"];if(!(K===null||a(K)))if(o(K))K=l(j["@base"],K);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:L});j["@base"]=K,C.set("@base",!0)}if("@vocab"in L){const K=L["@vocab"];if(K===null)delete j["@vocab"];else if(i(K)){if(!a(K)&&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:L});{const v=S(j,K,{vocab:!0,base:!0},void 0,void 0,p);a(v)||p.eventHandler&&d({event:{type:["JsonLdEvent"],code:"relative @vocab reference",level:"warning",message:"Relative @vocab reference found.",details:{vocab:v}},options:p}),j["@vocab"]=v}}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:L});C.set("@vocab",!0)}if("@language"in L){const K=L["@language"];if(K===null)delete j["@language"];else if(i(K))K.match(h)||p.eventHandler&&d({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:K}},options:p}),j["@language"]=K.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:L});C.set("@language",!0)}if("@direction"in L){const K=L["@direction"];if(b.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @direction not compatible with "+b.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:L});if(K===null)delete j["@direction"];else{if(K!=="ltr"&&K!=="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:L});j["@direction"]=K}C.set("@direction",!0)}if("@propagate"in L){const K=L["@propagate"];if(b.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @propagate not compatible with "+b.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:L});if(typeof K!="boolean")throw new e("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:c});C.set("@propagate",!0)}if("@import"in L){const K=L["@import"];if(b.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @import not compatible with "+b.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:L});if(!i(K))throw new e("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:c});const v=await p.contextResolver.resolve({activeCtx:b,context:K,documentLoader:p.documentLoader,base:p.base});if(v.length!==1)throw new e("Invalid JSON-LD syntax; @import must reference a single context.","jsonld.SyntaxError",{code:"invalid remote context",context:c});const U=v[0].getProcessed(b);if(U)L=U;else{const Q=v[0].document;if("@import"in Q)throw new e("Invalid JSON-LD syntax: imported context must not include @import.","jsonld.SyntaxError",{code:"invalid context entry",context:c});for(const z in Q)L.hasOwnProperty(z)||(L[z]=Q[z]);v[0].setProcessed(b,L)}C.set("@import",!0)}C.set("@protected",L["@protected"]||!1);for(const K in L)if(x.createTermDefinition({activeCtx:j,localCtx:L,term:K,defined:C,options:p,overrideProtected:D}),n(L[K])&&"@context"in L[K]){const v=L[K]["@context"];let U=!0;if(i(v)){const Q=l(p.base,v);T.has(Q)?U=!1:T.add(Q)}if(U)try{await x.process({activeCtx:j.clone(),localCtx:L[K]["@context"],overrideProtected:!0,options:p,cycles:T})}catch{throw new e("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:L[K]["@context"],term:K})}}Y.setProcessed(b,{context:j,events:R})}return j},x.createTermDefinition=({activeCtx:b,localCtx:c,term:p,defined:N,options:D,overrideProtected:T=!1})=>{if(N.has(p)){if(N.get(p))return;throw new e("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:c,term:p})}N.set(p,!1);let q;if(c.hasOwnProperty(p)&&(q=c[p]),p==="@type"&&n(q)&&(q["@container"]||"@set")==="@set"&&x.processingMode(b,1.1)){const L=["@container","@id","@protected"],ee=Object.keys(q);if(ee.length===0||ee.some(C=>!L.includes(C)))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:c,term:p})}else{if(x.isKeyword(p))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:c,term:p});if(p.match(y)){D.eventHandler&&d({event:{type:["JsonLdEvent"],code:"reserved term",level:"warning",message:'Terms beginning with "@" are reserved for future use and dropped.',details:{term:p}},options:D});return}else if(p==="")throw new e("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:c})}const R=b.mappings.get(p);b.mappings.has(p)&&b.mappings.delete(p);let M=!1;if((i(q)||q===null)&&(M=!0,q={"@id":q}),!n(q))throw new e("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:c});const B={};b.mappings.set(p,B),B.reverse=!1;const A=["@container","@id","@language","@reverse","@type"];x.processingMode(b,1.1)&&A.push("@context","@direction","@index","@nest","@prefix","@protected");for(const L in q)if(!A.includes(L))throw new e("Invalid JSON-LD syntax; a term definition must not contain "+L,"jsonld.SyntaxError",{code:"invalid term definition",context:c});const j=p.indexOf(":");if(B._termHasColon=j>0,"@reverse"in q){if("@id"in q)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:c});if("@nest"in q)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:c});const L=q["@reverse"];if(!i(L))throw new e("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:c});if(L.match(y)){D.eventHandler&&d({event:{type:["JsonLdEvent"],code:"reserved @reverse value",level:"warning",message:'@reverse values beginning with "@" are reserved for future use and dropped.',details:{reverse:L}},options:D}),R?b.mappings.set(p,R):b.mappings.delete(p);return}const ee=S(b,L,{vocab:!0,base:!1},c,N,D);if(!a(ee))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:c});B["@id"]=ee,B.reverse=!0}else if("@id"in q){let L=q["@id"];if(L&&!i(L))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:c});if(L===null)B["@id"]=null;else if(!x.isKeyword(L)&&L.match(y)){D.eventHandler&&d({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:'@id values beginning with "@" are reserved for future use and dropped.',details:{id:L}},options:D}),R?b.mappings.set(p,R):b.mappings.delete(p);return}else if(L!==p){if(L=S(b,L,{vocab:!0,base:!1},c,N,D),!a(L)&&!x.isKeyword(L))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:c});if(p.match(/(?::[^:])|\//)){const ee=new Map(N).set(p,!0);if(S(b,p,{vocab:!0,base:!1},c,ee,D)!==L)throw new e("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:c})}B["@id"]=L,B._prefix=M&&!B._termHasColon&&L.match(/[:\/\?#\[\]@]$/)!==null}}if(!("@id"in B))if(B._termHasColon){const L=p.substr(0,j);if(c.hasOwnProperty(L)&&x.createTermDefinition({activeCtx:b,localCtx:c,term:L,defined:N,options:D}),b.mappings.has(L)){const ee=p.substr(j+1);B["@id"]=b.mappings.get(L)["@id"]+ee}else B["@id"]=p}else if(p==="@type")B["@id"]=p;else{if(!("@vocab"in b))throw new e("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:c,term:p});B["@id"]=b["@vocab"]+p}if((q["@protected"]===!0||N.get("@protected")===!0&&q["@protected"]!==!1)&&(b.protected[p]=!0,B.protected=!0),N.set(p,!0),"@type"in q){let L=q["@type"];if(!i(L))throw new e("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:c});if(L==="@json"||L==="@none"){if(x.processingMode(b,1))throw new e(`Invalid JSON-LD syntax; an @context @type value must not be "${L}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:c})}else if(L!=="@id"&&L!=="@vocab"){if(L=S(b,L,{vocab:!0,base:!1},c,N,D),!a(L))throw new e("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:c});if(L.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:c})}B["@type"]=L}if("@container"in q){const L=i(q["@container"])?[q["@container"]]:q["@container"]||[],ee=["@list","@set","@index","@language"];let C=!0;const K=L.includes("@set");if(x.processingMode(b,1.1)){if(ee.push("@graph","@id","@type"),L.includes("@list")){if(L.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:c})}else if(L.includes("@graph")){if(L.some(v=>v!=="@graph"&&v!=="@id"&&v!=="@index"&&v!=="@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:c})}else C&=L.length<=(K?2:1);if(L.includes("@type")&&(B["@type"]=B["@type"]||"@id",!["@id","@vocab"].includes(B["@type"])))throw new e("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:c})}else C&=!t(q["@container"]),C&=L.length<=1;if(C&=L.every(v=>ee.includes(v)),C&=!(K&&L.includes("@list")),!C)throw new e("Invalid JSON-LD syntax; @context @container value must be one of the following: "+ee.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:c});if(B.reverse&&!L.every(v=>["@index","@set"].includes(v)))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:c});B["@container"]=L}if("@index"in q){if(!("@container"in q)||!B["@container"].includes("@index"))throw new e(`Invalid JSON-LD syntax; @index without @index in @container: "${q["@index"]}" on term "${p}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:c});if(!i(q["@index"])||q["@index"].indexOf("@")===0)throw new e(`Invalid JSON-LD syntax; @index must expand to an IRI: "${q["@index"]}" on term "${p}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:c});B["@index"]=q["@index"]}if("@context"in q&&(B["@context"]=q["@context"]),"@language"in q&&!("@type"in q)){let L=q["@language"];if(L!==null&&!i(L))throw new e("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:c});L!==null&&(L=L.toLowerCase()),B["@language"]=L}if("@prefix"in q){if(p.match(/:|\//))throw new e("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:c});if(x.isKeyword(B["@id"]))throw new e("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:c});if(typeof q["@prefix"]=="boolean")B._prefix=q["@prefix"]===!0;else throw new e("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:c})}if("@direction"in q){const L=q["@direction"];if(L!==null&&L!=="ltr"&&L!=="rtl")throw new e('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:c});B["@direction"]=L}if("@nest"in q){const L=q["@nest"];if(!i(L)||L!=="@nest"&&L.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:c});B["@nest"]=L}// disallow aliasing @context and @preserve
298
- const Y=B["@id"];if(Y==="@context"||Y==="@preserve")throw new e("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:c});if(R&&R.protected&&!T&&(b.protected[p]=!0,B.protected=!0,!I(R,B)))throw new e("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:c,term:p})},x.expandIri=(b,c,p,N)=>S(b,c,p,void 0,void 0,N);function S(b,c,p,N,D,T){if(c===null||!i(c)||x.isKeyword(c))return c;if(c.match(y))return null;if(N&&N.hasOwnProperty(c)&&D.get(c)!==!0&&x.createTermDefinition({activeCtx:b,localCtx:N,term:c,defined:D,options:T}),p=p||{},p.vocab){const R=b.mappings.get(c);if(R===null)return null;if(n(R)&&"@id"in R)return R["@id"]}const q=c.indexOf(":");if(q>0){const R=c.substr(0,q),M=c.substr(q+1);if(R==="_"||M.indexOf("//")===0)return c;N&&N.hasOwnProperty(R)&&x.createTermDefinition({activeCtx:b,localCtx:N,term:R,defined:D,options:T});const B=b.mappings.get(R);if(B&&B._prefix)return B["@id"]+M;if(a(c))return c}if(p.vocab&&"@vocab"in b)c=b["@vocab"]+c;else if(p.base){let R,M;"@base"in b?b["@base"]?(M=l(T.base,b["@base"]),R=l(M,c)):(M=b["@base"],R=c):(M=T.base,R=l(T.base,c)),c=R}return c}x.getInitialContext=b=>{const c=JSON.stringify({processingMode:b.processingMode}),p=m.get(c);if(p)return p;const N={processingMode:b.processingMode,mappings:new Map,inverse:null,getInverse:D,clone:R,revertToPreviousContext:M,protected:{}};return m.size===_&&m.clear(),m.set(c,N),N;function D(){const B=this;if(B.inverse)return B.inverse;const A=B.inverse={},j=B.fastCurieMap={},Y={},L=(B["@language"]||"@none").toLowerCase(),ee=B["@direction"],C=B.mappings,K=[...C.keys()].sort(g);for(const v of K){const U=C.get(v);if(U===null)continue;let Q=U["@container"]||"@none";if(Q=[].concat(Q).sort().join(""),U["@id"]===null)continue;const z=w(U["@id"]);for(const ae of z){let H=A[ae];const V=x.isKeyword(ae);if(H)!V&&!U._termHasColon&&Y[ae].push(v);else if(A[ae]=H={},!V&&!U._termHasColon){Y[ae]=[v];const W={iri:ae,terms:Y[ae]};ae[0]in j?j[ae[0]].push(W):j[ae[0]]=[W]}if(H[Q]||(H[Q]={"@language":{},"@type":{},"@any":{}}),H=H[Q],q(v,H["@any"],"@none"),U.reverse)q(v,H["@type"],"@reverse");else if(U["@type"]==="@none")q(v,H["@any"],"@none"),q(v,H["@language"],"@none"),q(v,H["@type"],"@none");else if("@type"in U)q(v,H["@type"],U["@type"]);else if("@language"in U&&"@direction"in U){const W=U["@language"],F=U["@direction"];W&&F?q(v,H["@language"],`${W}_${F}`.toLowerCase()):W?q(v,H["@language"],W.toLowerCase()):F?q(v,H["@language"],`_${F}`):q(v,H["@language"],"@null")}else"@language"in U?q(v,H["@language"],(U["@language"]||"@null").toLowerCase()):"@direction"in U?U["@direction"]?q(v,H["@language"],`_${U["@direction"]}`):q(v,H["@language"],"@none"):ee?(q(v,H["@language"],`_${ee}`),q(v,H["@language"],"@none"),q(v,H["@type"],"@none")):(q(v,H["@language"],L),q(v,H["@language"],"@none"),q(v,H["@type"],"@none"))}}for(const v in j)T(j,v,1);return A}function T(B,A,j){const Y=B[A],L=B[A]={};let ee,C;for(const K of Y)ee=K.iri,j>=ee.length?C="":C=ee[j],C in L?L[C].push(K):L[C]=[K];for(const K in L)K!==""&&T(L,K,j+1)}function q(B,A,j){A.hasOwnProperty(j)||(A[j]=B)}function R(){const B={};return B.mappings=r.clone(this.mappings),B.clone=this.clone,B.inverse=null,B.getInverse=this.getInverse,B.protected=r.clone(this.protected),this.previousContext&&(B.previousContext=this.previousContext.clone()),B.revertToPreviousContext=this.revertToPreviousContext,"@base"in this&&(B["@base"]=this["@base"]),"@language"in this&&(B["@language"]=this["@language"]),"@vocab"in this&&(B["@vocab"]=this["@vocab"]),B}function M(){return this.previousContext?this.previousContext.clone():this}},x.getContextValue=(b,c,p)=>{if(c===null)return p==="@context"?void 0:null;if(b.mappings.has(c)){const N=b.mappings.get(c);if(s(p))return N;if(N.hasOwnProperty(p))return N[p]}if(p==="@language"&&p in b||p==="@direction"&&p in b)return b[p];if(p!=="@context")return null},x.processingMode=(b,c)=>c.toString()>="1.1"?!b.processingMode||b.processingMode>="json-ld-"+c.toString():b.processingMode==="json-ld-1.0",x.isKeyword=b=>{if(!i(b)||b[0]!=="@")return!1;switch(b){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 I(b,c){if(!(b&&typeof b=="object")||!(c&&typeof c=="object"))return b===c;const p=Array.isArray(b);if(p!==Array.isArray(c))return!1;if(p){if(b.length!==c.length)return!1;for(let T=0;T<b.length;++T)if(!I(b[T],c[T]))return!1;return!0}const N=Object.keys(b),D=Object.keys(c);if(N.length!==D.length)return!1;for(const T in b){let q=b[T],R=c[T];if(T==="@container"&&Array.isArray(q)&&Array.isArray(R)&&(q=q.slice().sort(),R=R.slice().sort()),!I(q,R))return!1}return!0}return Ji}var Qi,ll;function qf(){if(ll)return Qi;ll=1;const r=rt(),{isArray:e,isObject:t,isEmptyObject:n,isString:i,isUndefined:s}=Ke(),{isList:a,isValue:o,isGraph:l,isSubject:d}=_t(),{expandIri:h,getContextValue:y,isKeyword:w,process:g,processingMode:m}=Ut(),{isAbsolute:_}=At(),{REGEX_BCP47:x,REGEX_KEYWORD:S,addValue:I,asArray:b,getValues:c,validateTypeValue:p}=et(),{handleEvent:N}=Kr(),D={};Qi=D,D.expand=async({activeCtx:A,activeProperty:j=null,element:Y,options:L={},insideList:ee=!1,insideIndex:C=!1,typeScopedContext:K=null})=>{if(Y==null)return null;if(j==="@default"&&(L=Object.assign({},L,{isFrame:!1})),!e(Y)&&!t(Y))return!ee&&(j===null||h(A,j,{vocab:!0},L)==="@graph")?(L.eventHandler&&N({event:{type:["JsonLdEvent"],code:"free-floating scalar",level:"warning",message:"Dropping free-floating scalar not in a list.",details:{value:Y}},options:L}),null):R({activeCtx:A,activeProperty:j,value:Y,options:L});if(e(Y)){let W=[];const F=y(A,j,"@container")||[];ee=ee||F.includes("@list");for(let Z=0;Z<Y.length;++Z){let te=await D.expand({activeCtx:A,activeProperty:j,element:Y[Z],options:L,insideIndex:C,typeScopedContext:K});ee&&e(te)&&(te={"@list":te}),te!==null&&(e(te)?W=W.concat(te):W.push(te))}return W}const v=h(A,j,{vocab:!0},L),U=y(A,j,"@context");K=K||(A.previousContext?A:null);let Q=Object.keys(Y).sort(),z=!C;if(z&&K&&Q.length<=2&&!Q.includes("@context"))for(const W of Q){const F=h(K,W,{vocab:!0},L);if(F==="@value"){z=!1,A=K;break}if(F==="@id"&&Q.length===1){z=!1;break}}z&&(A=A.revertToPreviousContext()),s(U)||(A=await g({activeCtx:A,localCtx:U,propagate:!0,overrideProtected:!0,options:L})),"@context"in Y&&(A=await g({activeCtx:A,localCtx:Y["@context"],options:L})),K=A;let ae=null;for(const W of Q)if(h(A,W,{vocab:!0},L)==="@type"){ae=ae||W;const Z=Y[W],te=Array.isArray(Z)?Z.length>1?Z.slice().sort():Z:[Z];for(const ce of te){const fe=y(K,ce,"@context");s(fe)||(A=await g({activeCtx:A,localCtx:fe,options:L,propagate:!1}))}}let H={};await q({activeCtx:A,activeProperty:j,expandedActiveProperty:v,element:Y,expandedParent:H,options:L,insideList:ee,typeKey:ae,typeScopedContext:K}),Q=Object.keys(H);let V=Q.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=V-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 F=H["@value"]===null?[]:b(H["@value"]),Z=c(H,"@type");if(!(m(A,1.1)&&Z.includes("@json")&&Z.length===1))if(F.length===0)L.eventHandler&&N({event:{type:["JsonLdEvent"],code:"null @value value",level:"warning",message:"Dropping null @value value.",details:{value:H}},options:L}),H=null;else{if(!F.every(te=>i(te)||n(te))&&"@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(!Z.every(te=>_(te)&&!(i(te)&&te.indexOf("_:")===0)||n(te)))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(V>1&&!(V===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"],Q=Object.keys(H),V=Q.length)}else V===1&&"@language"in H&&(L.eventHandler&&N({event:{type:["JsonLdEvent"],code:"object with only @language",level:"warning",message:"Dropping object with only @language.",details:{value:H}},options:L}),H=null);return t(H)&&!L.keepFreeFloatingNodes&&!ee&&(j===null||v==="@graph"||(y(A,j,"@container")||[]).includes("@graph"))&&(H=T({value:H,count:V,options:L})),H};function T({value:A,count:j,options:Y}){if(j===0||"@value"in A||"@list"in A||j===1&&"@id"in A){if(Y.eventHandler){let L,ee;j===0?(L="empty object",ee="Dropping empty object."):"@value"in A?(L="object with only @value",ee="Dropping object with only @value."):"@list"in A?(L="object with only @list",ee="Dropping object with only @list."):j===1&&"@id"in A&&(L="object with only @id",ee="Dropping object with only @id."),N({event:{type:["JsonLdEvent"],code:L,level:"warning",message:ee,details:{value:A}},options:Y})}return null}return A}async function q({activeCtx:A,activeProperty:j,expandedActiveProperty:Y,element:L,expandedParent:ee,options:C={},insideList:K,typeKey:v,typeScopedContext:U}){const Q=Object.keys(L).sort(),z=[];let ae;const H=L[v]&&h(A,e(L[v])?L[v][0]:L[v],{vocab:!0},{...C,typeExpansion:!0})==="@json";for(const V of Q){let W=L[V],F;if(V==="@context")continue;const Z=h(A,V,{vocab:!0},C);if(Z===null||!(_(Z)||w(Z))){C.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid property",level:"warning",message:"Dropping property that did not expand into an absolute IRI or keyword.",details:{property:V,expandedProperty:Z}},options:C});continue}if(w(Z)){if(Y==="@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(Z in ee&&Z!=="@included"&&Z!=="@type")throw new r("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:Z})}if(Z==="@id"){if(!i(W)){if(!C.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(!n(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=>i(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})}I(ee,"@id",b(W).map(O=>{if(i(O)){const G=h(A,O,{base:!0},C);return C.eventHandler&&(G===null?N(O===null?{event:{type:["JsonLdEvent"],code:"null @id value",level:"warning",message:"Null @id found.",details:{id:O}},options:C}:{event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:O}},options:C}):_(G)||N({event:{type:["JsonLdEvent"],code:"relative @id reference",level:"warning",message:"Relative @id reference found.",details:{id:O,expandedId:G}},options:C})),G}return O}),{propertyIsArray:C.isFrame});continue}if(Z==="@type"){t(W)&&(W=Object.fromEntries(Object.entries(W).map(([O,G])=>[h(U,O,{vocab:!0}),b(G).map(re=>h(U,re,{base:!0,vocab:!0},{...C,typeExpansion:!0}))]))),p(W,C.isFrame),I(ee,"@type",b(W).map(O=>{if(i(O)){const G=h(U,O,{base:!0,vocab:!0},{...C,typeExpansion:!0});return G!=="@json"&&!_(G)&&C.eventHandler&&N({event:{type:["JsonLdEvent"],code:"relative @type reference",level:"warning",message:"Relative @type reference found.",details:{type:O}},options:C}),G}return O}),{propertyIsArray:!!C.isFrame});continue}if(Z==="@included"&&m(A,1.1)){const O=b(await D.expand({activeCtx:A,activeProperty:j,element:W,options:C}));if(!O.every(G=>d(G)))throw new r("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:W});I(ee,"@included",O,{propertyIsArray:!0});continue}if(Z==="@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(Z==="@value"){ae=W,H&&m(A,1.1)?ee["@value"]=W:I(ee,"@value",W,{propertyIsArray:C.isFrame});continue}if(Z==="@language"){if(W===null)continue;if(!i(W)&&!C.isFrame)throw new r('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:W});W=b(W).map(O=>i(O)?O.toLowerCase():O);for(const O of W)i(O)&&!O.match(x)&&C.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:O}},options:C});I(ee,"@language",W,{propertyIsArray:C.isFrame});continue}if(Z==="@direction"){if(!i(W)&&!C.isFrame)throw new r('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:W});W=b(W);for(const O of W)if(i(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});I(ee,"@direction",W,{propertyIsArray:C.isFrame});continue}if(Z==="@index"){if(!i(W))throw new r('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:W});I(ee,"@index",W);continue}if(Z==="@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(F=await D.expand({activeCtx:A,activeProperty:"@reverse",element:W,options:C}),"@reverse"in F)for(const G in F["@reverse"])I(ee,G,F["@reverse"][G],{propertyIsArray:!0});let O=ee["@reverse"]||null;for(const G in F){if(G==="@reverse")continue;O===null&&(O=ee["@reverse"]={}),I(O,G,[],{propertyIsArray:!0});const re=F[G];for(let ue=0;ue<re.length;++ue){const de=re[ue];if(o(de)||a(de))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:F});I(O,G,de,{propertyIsArray:!0})}}continue}if(Z==="@nest"){z.push(V);continue}let te=A;const ce=y(A,V,"@context");s(ce)||(te=await g({activeCtx:A,localCtx:ce,propagate:!0,overrideProtected:!0,options:C}));const fe=y(A,V,"@container")||[];if(fe.includes("@language")&&t(W)){const O=y(te,V,"@direction");F=M(te,W,O,C)}else if(fe.includes("@index")&&t(W)){const O=fe.includes("@graph"),G=y(te,V,"@index")||"@index",re=G!=="@index"&&h(A,G,{vocab:!0},C);F=await B({activeCtx:te,options:C,activeProperty:V,value:W,asGraph:O,indexKey:G,propertyIndex:re})}else if(fe.includes("@id")&&t(W)){const O=fe.includes("@graph");F=await B({activeCtx:te,options:C,activeProperty:V,value:W,asGraph:O,indexKey:"@id"})}else if(fe.includes("@type")&&t(W))F=await B({activeCtx:te.revertToPreviousContext(),options:C,activeProperty:V,value:W,asGraph:!1,indexKey:"@type"});else{const O=Z==="@list";if(O||Z==="@set"){let G=j;O&&Y==="@graph"&&(G=null),F=await D.expand({activeCtx:te,activeProperty:G,element:W,options:C,insideList:O})}else y(A,V,"@type")==="@json"?F={"@type":"@json","@value":W}:F=await D.expand({activeCtx:te,activeProperty:V,element:W,options:C,insideList:!1})}if(!(F===null&&Z!=="@value")){if(Z!=="@list"&&!a(F)&&fe.includes("@list")&&(F={"@list":b(F)}),fe.includes("@graph")&&!fe.some(O=>O==="@id"||O==="@index")){if(F=b(F),C.isFrame||(F=F.filter(O=>{const G=Object.keys(O).length;return T({value:O,count:G,options:C})!==null})),F.length===0)continue;F=F.map(O=>({"@graph":b(O)}))}if(te.mappings.has(V)&&te.mappings.get(V).reverse){const O=ee["@reverse"]=ee["@reverse"]||{};F=b(F);for(let G=0;G<F.length;++G){const re=F[G];if(o(re)||a(re))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:F});I(O,Z,re,{propertyIsArray:!0})}continue}I(ee,Z,F,{propertyIsArray:!0})}}if("@value"in ee&&!(ee["@type"]==="@json"&&m(A,1.1))){if((t(ae)||e(ae))&&!C.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:ae})}for(const V of z){const W=e(L[V])?L[V]:[L[V]];for(const F of W){if(!t(F)||Object.keys(F).some(Z=>h(A,Z,{vocab:!0},C)==="@value"))throw new r("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:F});await q({activeCtx:A,activeProperty:j,expandedActiveProperty:Y,element:F,expandedParent:ee,options:C,insideList:K,typeScopedContext:U,typeKey:v})}}}function R({activeCtx:A,activeProperty:j,value:Y,options:L}){if(Y==null)return null;const ee=h(A,j,{vocab:!0},L);if(ee==="@id")return h(A,Y,{base:!0},L);if(ee==="@type")return h(A,Y,{vocab:!0,base:!0},{...L,typeExpansion:!0});const C=y(A,j,"@type");if((C==="@id"||ee==="@graph")&&i(Y)){const v=h(A,Y,{base:!0},L);return v===null&&Y.match(S)&&L.eventHandler&&N({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:j}},options:L}),{"@id":v}}if(C==="@vocab"&&i(Y))return{"@id":h(A,Y,{vocab:!0,base:!0},L)};if(w(ee))return Y;const K={};if(C&&!["@id","@vocab","@none"].includes(C))K["@type"]=C;else if(i(Y)){const v=y(A,j,"@language");v!==null&&(K["@language"]=v);const U=y(A,j,"@direction");U!==null&&(K["@direction"]=U)}return["boolean","number","string"].includes(typeof Y)||(Y=Y.toString()),K["@value"]=Y,K}function M(A,j,Y,L){const ee=[],C=Object.keys(j).sort();for(const K of C){const v=h(A,K,{vocab:!0},L);let U=j[K];e(U)||(U=[U]);for(const Q of U){if(Q===null)continue;if(!i(Q))throw new r("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:j});const z={"@value":Q};v!=="@none"&&(K.match(x)||L.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:K}},options:L}),z["@language"]=K.toLowerCase()),Y&&(z["@direction"]=Y),ee.push(z)}}return ee}async function B({activeCtx:A,options:j,activeProperty:Y,value:L,asGraph:ee,indexKey:C,propertyIndex:K}){const v=[],U=Object.keys(L).sort(),Q=C==="@type";for(let z of U){if(Q){const V=y(A,z,"@context");s(V)||(A=await g({activeCtx:A,localCtx:V,propagate:!1,options:j}))}let ae=L[z];e(ae)||(ae=[ae]),ae=await D.expand({activeCtx:A,activeProperty:Y,element:ae,options:j,insideList:!1,insideIndex:!0});let H;K?z==="@none"?H="@none":H=R({activeCtx:A,activeProperty:C,value:z,options:j}):H=h(A,z,{vocab:!0},j),C==="@id"?z=h(A,z,{base:!0},j):Q&&(z=H);for(let V of ae){if(ee&&!l(V)&&(V={"@graph":[V]}),C==="@type")H==="@none"||(V["@type"]?V["@type"]=[z].concat(V["@type"]):V["@type"]=[z]);else{if(o(V)&&!["@language","@type","@index"].includes(C))throw new r(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${C}".`,"jsonld.SyntaxError",{code:"invalid value object",value:V});K?H!=="@none"&&I(V,K,H,{propertyIsArray:!0,prependValue:!0}):H!=="@none"&&!(C in V)&&(V[C]=z)}v.push(V)}}return v}return Qi}var Xi,ul;function Mn(){if(ul)return Xi;ul=1;const{isKeyword:r}=Ut(),e=_t(),t=Ke(),n=et(),i=rt(),s={};return Xi=s,s.createMergedNodeMap=(a,o)=>{o=o||{};const l=o.issuer||new n.IdentifierIssuer("_:b"),d={"@default":{}};return s.createNodeMap(a,d,"@default",l),s.mergeNodeMaps(d)},s.createNodeMap=(a,o,l,d,h,y)=>{if(t.isArray(a)){for(const _ of a)s.createNodeMap(_,o,l,d,void 0,y);return}if(!t.isObject(a)){y&&y.push(a);return}if(e.isValue(a)){if("@type"in a){let _=a["@type"];_.indexOf("_:")===0&&(a["@type"]=_=d.getId(_))}y&&y.push(a);return}else if(y&&e.isList(a)){const _=[];s.createNodeMap(a["@list"],o,l,d,h,_),y.push({"@list":_});return}if("@type"in a){const _=a["@type"];for(const x of _)x.indexOf("_:")===0&&d.getId(x)}t.isUndefined(h)&&(h=e.isBlankNode(a)?d.getId(a["@id"]):a["@id"]),y&&y.push({"@id":h});const w=o[l],g=w[h]=w[h]||{};g["@id"]=h;const m=Object.keys(a).sort();for(let _ of m){if(_==="@id")continue;if(_==="@reverse"){const S={"@id":h},I=a["@reverse"];for(const b in I){const c=I[b];for(const p of c){let N=p["@id"];e.isBlankNode(p)&&(N=d.getId(N)),s.createNodeMap(p,o,l,d,N),n.addValue(w[N],b,S,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(_==="@graph"){h in o||(o[h]={}),s.createNodeMap(a[_],o,h,d);continue}if(_==="@included"){s.createNodeMap(a[_],o,l,d);continue}if(_!=="@type"&&r(_)){if(_==="@index"&&_ in g&&(a[_]!==g[_]||a[_]["@id"]!==g[_]["@id"]))throw new i("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:g});g[_]=a[_];continue}const x=a[_];if(_.indexOf("_:")===0&&(_=d.getId(_)),x.length===0){n.addValue(g,_,[],{propertyIsArray:!0});continue}for(let S of x)if(_==="@type"&&(S=S.indexOf("_:")===0?d.getId(S):S),e.isSubject(S)||e.isSubjectReference(S)){if("@id"in S&&!S["@id"])continue;const I=e.isBlankNode(S)?d.getId(S["@id"]):S["@id"];n.addValue(g,_,{"@id":I},{propertyIsArray:!0,allowDuplicate:!1}),s.createNodeMap(S,o,l,d,I)}else if(e.isValue(S))n.addValue(g,_,S,{propertyIsArray:!0,allowDuplicate:!1});else if(e.isList(S)){const I=[];s.createNodeMap(S["@list"],o,l,d,h,I),S={"@list":I},n.addValue(g,_,S,{propertyIsArray:!0,allowDuplicate:!1})}else s.createNodeMap(S,o,l,d,h),n.addValue(g,_,S,{propertyIsArray:!0,allowDuplicate:!1})}},s.mergeNodeMapGraphs=a=>{const o={};for(const l of Object.keys(a).sort())for(const d of Object.keys(a[l]).sort()){const h=a[l][d];d in o||(o[d]={"@id":d});const y=o[d];for(const w of Object.keys(h).sort())if(r(w)&&w!=="@type")y[w]=n.clone(h[w]);else for(const g of h[w])n.addValue(y,w,n.clone(g),{propertyIsArray:!0,allowDuplicate:!1})}return o},s.mergeNodeMaps=a=>{const o=a["@default"],l=Object.keys(a).sort();for(const d of l){if(d==="@default")continue;const h=a[d];let y=o[d];y?"@graph"in y||(y["@graph"]=[]):o[d]=y={"@id":d,"@graph":[]};const w=y["@graph"];for(const g of Object.keys(h).sort()){const m=h[g];e.isSubjectReference(m)||w.push(m)}}return o},Xi}var Ki,cl;function Bf(){if(cl)return Ki;cl=1;const{isSubjectReference:r}=_t(),{createMergedNodeMap:e}=Mn(),t={};return Ki=t,t.flatten=n=>{const i=e(n),s=[],a=Object.keys(i).sort();for(let o=0;o<a.length;++o){const l=i[a[o]];r(l)||s.push(l)}return s},Ki}var Yi,dl;function Ff(){if(dl)return Yi;dl=1;const r=rt(),e=_t(),t=Ke(),{REGEX_BCP47:n,addValue:i}=et(),{handleEvent:s}=Kr(),{RDF_LIST:a,RDF_FIRST:o,RDF_REST:l,RDF_NIL:d,RDF_TYPE:h,RDF_JSON_LITERAL:y,XSD_BOOLEAN:w,XSD_DOUBLE:g,XSD_INTEGER:m,XSD_STRING:_}=la(),x={};Yi=x,x.fromRDF=async(I,b)=>{const{useRdfType:c=!1,useNativeTypes:p=!1,rdfDirection:N=null}=b,D={},T={"@default":D},q={};if(N){if(N==="compound-literal")throw new r("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:N});if(N!=="i18n-datatype")throw new r("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:N})}for(const B of I){const A=B.graph.termType==="DefaultGraph"?"@default":B.graph.value;A in T||(T[A]={}),A!=="@default"&&!(A in D)&&(D[A]={"@id":A});const j=T[A],Y=B.subject.value,L=B.predicate.value,ee=B.object;Y in j||(j[Y]={"@id":Y});const C=j[Y],K=ee.termType.endsWith("Node");if(K&&!(ee.value in j)&&(j[ee.value]={"@id":ee.value}),L===h&&!c&&K){i(C,"@type",ee.value,{propertyIsArray:!0});continue}const v=S(ee,p,N,b);if(i(C,L,v,{propertyIsArray:!0}),K)if(ee.value===d){const U=j[ee.value];"usages"in U||(U.usages=[]),U.usages.push({node:C,property:L,value:v})}else ee.value in q?q[ee.value]=!1:q[ee.value]={node:C,property:L,value:v}}for(const B in T){const A=T[B];if(!(d in A))continue;const j=A[d];if(j.usages){for(let Y of j.usages){let L=Y.node,ee=Y.property,C=Y.value;const K=[],v=[];let U=Object.keys(L).length;for(;ee===l&&t.isObject(q[L["@id"]])&&t.isArray(L[o])&&L[o].length===1&&t.isArray(L[l])&&L[l].length===1&&(U===3||U===4&&t.isArray(L["@type"])&&L["@type"].length===1&&L["@type"][0]===a)&&(K.push(L[o][0]),v.push(L["@id"]),Y=q[L["@id"]],L=Y.node,ee=Y.property,C=Y.value,U=Object.keys(L).length,!!e.isBlankNode(L)););delete C["@id"],C["@list"]=K.reverse();for(const Q of v)delete A[Q]}delete j.usages}}const R=[],M=Object.keys(D).sort();for(const B of M){const A=D[B];if(B in T){const j=A["@graph"]=[],Y=T[B],L=Object.keys(Y).sort();for(const ee of L){const C=Y[ee];e.isSubjectReference(C)||j.push(C)}}e.isSubjectReference(A)||R.push(A)}return R};function S(I,b,c,p){if(I.termType.endsWith("Node"))return{"@id":I.value};const N={"@value":I.value};if(I.language)I.language.match(n)||p.eventHandler&&s({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:I.language}},options:p}),N["@language"]=I.language;else{let D=I.datatype.value;if(D||(D=_),D===y){D="@json";try{N["@value"]=JSON.parse(N["@value"])}catch(T){throw new r("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:N["@value"],cause:T})}}if(b){if(D===w)N["@value"]==="true"?N["@value"]=!0:N["@value"]==="false"&&(N["@value"]=!1);else if(t.isNumeric(N["@value"]))if(D===m){const T=parseInt(N["@value"],10);T.toFixed(0)===N["@value"]&&(N["@value"]=T)}else D===g&&(N["@value"]=parseFloat(N["@value"]));[w,m,g,_].includes(D)||(N["@type"]=D)}else if(c==="i18n-datatype"&&D.startsWith("https://www.w3.org/ns/i18n#")){const[,T,q]=D.split(/[#_]/);T.length>0&&(N["@language"]=T,T.match(n)||p.eventHandler&&s({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:T}},options:p})),N["@direction"]=q}else D!==_&&(N["@type"]=D)}return N}return Yi}var Zi,fl;function Uf(){return fl||(fl=1,Zi=function r(e){return e===null||typeof e!="object"||e.toJSON!=null?JSON.stringify(e):Array.isArray(e)?"["+e.reduce((t,n,i)=>{const s=i===0?"":",",a=n===void 0||typeof n=="symbol"?null:n;return t+s+r(a)},"")+"]":"{"+Object.keys(e).sort().reduce((t,n,i)=>{if(e[n]===void 0||typeof e[n]=="symbol")return t;const s=t.length===0?"":",";return t+s+r(n)+":"+r(e[n])},"")+"}"}),Zi}var es,hl;function Hf(){if(hl)return es;hl=1;const{createNodeMap:r}=Mn(),{isKeyword:e}=Ut(),t=_t(),n=Uf(),i=rt(),s=Ke(),a=et(),{handleEvent:o}=Kr(),{RDF_FIRST:l,RDF_REST:d,RDF_NIL:h,RDF_TYPE:y,RDF_JSON_LITERAL:w,RDF_LANGSTRING:g,XSD_BOOLEAN:m,XSD_DOUBLE:_,XSD_INTEGER:x,XSD_STRING:S}=la(),{isAbsolute:I}=At(),b={};es=b,b.toRDF=(D,T)=>{const q=new a.IdentifierIssuer("_:b"),R={"@default":{}};r(D,R,"@default",q);const M=[],B=Object.keys(R).sort();for(const A of B){let j;if(A==="@default")j={termType:"DefaultGraph",value:""};else if(I(A))A.startsWith("_:")?j={termType:"BlankNode"}:j={termType:"NamedNode"},j.value=A;else{T.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative graph reference",level:"warning",message:"Relative graph reference found.",details:{graph:A}},options:T});continue}c(M,R[A],j,q,T)}return M};function c(D,T,q,R,M){const B=Object.keys(T).sort();for(const A of B){const j=T[A],Y=Object.keys(j).sort();for(let L of Y){const ee=j[L];if(L==="@type")L=y;else if(e(L))continue;for(const C of ee){const K={termType:A.startsWith("_:")?"BlankNode":"NamedNode",value:A};if(!I(A)){M.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative subject reference",level:"warning",message:"Relative subject reference found.",details:{subject:A}},options:M});continue}const v={termType:L.startsWith("_:")?"BlankNode":"NamedNode",value:L};if(!I(L)){M.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative predicate reference",level:"warning",message:"Relative predicate reference found.",details:{predicate:L}},options:M});continue}if(v.termType==="BlankNode"&&!M.produceGeneralizedRdf){M.eventHandler&&o({event:{type:["JsonLdEvent"],code:"blank node predicate",level:"warning",message:"Dropping blank node predicate.",details:{property:R.getOldIds().find(Q=>R.getId(Q)===L)}},options:M});continue}const U=N(C,R,D,q,M.rdfDirection,M);U&&D.push({subject:K,predicate:v,object:U,graph:q})}}}}function p(D,T,q,R,M,B){const A={termType:"NamedNode",value:l},j={termType:"NamedNode",value:d},Y={termType:"NamedNode",value:h},L=D.pop(),ee=L?{termType:"BlankNode",value:T.getId()}:Y;let C=ee;for(const K of D){const v=N(K,T,q,R,M,B),U={termType:"BlankNode",value:T.getId()};q.push({subject:C,predicate:A,object:v,graph:R}),q.push({subject:C,predicate:j,object:U,graph:R}),C=U}if(L){const K=N(L,T,q,R,M,B);q.push({subject:C,predicate:A,object:K,graph:R}),q.push({subject:C,predicate:j,object:Y,graph:R})}return ee}function N(D,T,q,R,M,B){const A={};if(t.isValue(D)){A.termType="Literal",A.value=void 0,A.datatype={termType:"NamedNode"};let j=D["@value"];const Y=D["@type"]||null;if(Y==="@json")A.value=n(j),A.datatype.value=w;else if(s.isBoolean(j))A.value=j.toString(),A.datatype.value=Y||m;else if(s.isDouble(j)||Y===_)s.isDouble(j)||(j=parseFloat(j)),A.value=j.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),A.datatype.value=Y||_;else if(s.isNumber(j))A.value=j.toFixed(0),A.datatype.value=Y||x;else if("@direction"in D&&M==="i18n-datatype"){const L=(D["@language"]||"").toLowerCase(),ee=D["@direction"],C=`https://www.w3.org/ns/i18n#${L}_${ee}`;A.datatype.value=C,A.value=j}else{if("@direction"in D&&M==="compound-literal")throw new i("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:M});if("@direction"in D&&M)throw new i("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:M});"@language"in D?("@direction"in D&&!M&&B.eventHandler&&o({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:A.value}},options:B}),A.value=j,A.datatype.value=Y||g,A.language=D["@language"]):("@direction"in D&&!M&&B.eventHandler&&o({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:A.value}},options:B}),A.value=j,A.datatype.value=Y||S)}}else if(t.isList(D)){const j=p(D["@list"],T,q,R,M,B);A.termType=j.termType,A.value=j.value}else{const j=s.isObject(D)?D["@id"]:D;A.termType=j.startsWith("_:")?"BlankNode":"NamedNode",A.value=j}return A.termType==="NamedNode"&&!I(A.value)?(B.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative object reference",level:"warning",message:"Relative object reference found.",details:{object:A.value}},options:B}),null):A}return es}var ts,pl;function Vf(){if(pl)return ts;pl=1;const{isKeyword:r}=Ut(),e=_t(),t=Ke(),n=et(),i=At(),s=rt(),{createNodeMap:a,mergeNodeMapGraphs:o}=Mn(),l={};ts=l,l.frameMergedOrDefault=(c,p,N)=>{const D={options:N,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},T=new n.IdentifierIssuer("_:b");a(c,D.graphMap,"@default",T),N.merged&&(D.graphMap["@merged"]=o(D.graphMap),D.graph="@merged"),D.subjects=D.graphMap[D.graph];const q=[];l.frame(D,Object.keys(D.subjects).sort(),p,q),N.pruneBlankNodeIdentifiers&&(N.bnodesToClear=Object.keys(D.bnodeMap).filter(R=>D.bnodeMap[R].length===1));// remove @preserve from results
299
- return N.link={},x(q,N)},l.frame=(c,p,N,D,T=null)=>{w(N),N=N[0];const q=c.options,R={embed:y(N,q,"embed"),explicit:y(N,q,"explicit"),requireAll:y(N,q,"requireAll")};c.link.hasOwnProperty(c.graph)||(c.link[c.graph]={});const M=c.link[c.graph],B=g(c,p,N,R),A=Object.keys(B).sort();for(const j of A){const Y=B[j];if(T===null?c.uniqueEmbeds={[c.graph]:{}}:c.uniqueEmbeds[c.graph]=c.uniqueEmbeds[c.graph]||{},R.embed==="@link"&&j in M){S(D,T,M[j]);continue}const L={"@id":j};if(j.indexOf("_:")===0&&n.addValue(c.bnodeMap,j,L,{propertyIsArray:!0}),M[j]=L,(R.embed==="@first"||R.embed==="@last")&&c.is11)throw new s("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:N});if(!(!c.embedded&&c.uniqueEmbeds[c.graph].hasOwnProperty(j))){if(c.embedded&&(R.embed==="@never"||h(Y,c.graph,c.subjectStack))){S(D,T,L);continue}if(c.embedded&&(R.embed=="@first"||R.embed=="@once")&&c.uniqueEmbeds[c.graph].hasOwnProperty(j)){S(D,T,L);continue}if(R.embed==="@last"&&j in c.uniqueEmbeds[c.graph]&&_(c,j),c.uniqueEmbeds[c.graph][j]={parent:D,property:T},c.subjectStack.push({subject:Y,graph:c.graph}),j in c.graphMap){let ee=!1,C=null;"@graph"in N?(C=N["@graph"][0],ee=!(j==="@merged"||j==="@default"),t.isObject(C)||(C={})):(ee=c.graph!=="@merged",C={}),ee&&l.frame({...c,graph:j,embedded:!1},Object.keys(c.graphMap[j]).sort(),[C],L,"@graph")}"@included"in N&&l.frame({...c,embedded:!1},p,N["@included"],L,"@included");for(const ee of Object.keys(Y).sort()){if(r(ee)){if(L[ee]=n.clone(Y[ee]),ee==="@type")for(const C of Y["@type"])C.indexOf("_:")===0&&n.addValue(c.bnodeMap,C,L,{propertyIsArray:!0});continue}if(!(R.explicit&&!(ee in N)))for(const C of Y[ee]){const K=ee in N?N[ee]:d(R);if(e.isList(C)){const v=N[ee]&&N[ee][0]&&N[ee][0]["@list"]?N[ee][0]["@list"]:d(R),U={"@list":[]};S(L,ee,U);const Q=C["@list"];for(const z of Q)e.isSubjectReference(z)?l.frame({...c,embedded:!0},[z["@id"]],v,U,"@list"):S(U,"@list",n.clone(z))}else e.isSubjectReference(C)?l.frame({...c,embedded:!0},[C["@id"]],K,L,ee):b(K[0],C)&&S(L,ee,n.clone(C))}}for(const ee of Object.keys(N).sort()){if(ee==="@type"){if(!t.isObject(N[ee][0])||!("@default"in N[ee][0]))continue}else if(r(ee))continue;const C=N[ee][0]||{};if(!y(C,q,"omitDefault")&&!(ee in L)){let v="@null";"@default"in C&&(v=n.clone(C["@default"])),t.isArray(v)||(v=[v]),L[ee]=[{"@preserve":v}]}}for(const ee of Object.keys(N["@reverse"]||{}).sort()){const C=N["@reverse"][ee];for(const K of Object.keys(c.subjects))n.getValues(c.subjects[K],ee).some(U=>U["@id"]===j)&&(L["@reverse"]=L["@reverse"]||{},n.addValue(L["@reverse"],ee,[],{propertyIsArray:!0}),l.frame({...c,embedded:!0},[K],C,L["@reverse"][ee],T))}S(D,T,L),c.subjectStack.pop()}}},l.cleanupNull=(c,p)=>{if(t.isArray(c))return c.map(D=>l.cleanupNull(D,p)).filter(D=>D);if(c==="@null")return null;if(t.isObject(c)){if("@id"in c){const N=c["@id"];if(p.link.hasOwnProperty(N)){const D=p.link[N].indexOf(c);if(D!==-1)return p.link[N][D];p.link[N].push(c)}else p.link[N]=[c]}for(const N in c)c[N]=l.cleanupNull(c[N],p)}return c};function d(c){const p={};for(const N in c)c[N]!==void 0&&(p["@"+N]=[c[N]]);return[p]}function h(c,p,N){for(let D=N.length-1;D>=0;--D){const T=N[D];if(T.graph===p&&T.subject["@id"]===c["@id"])return!0}return!1}function y(c,p,N){const D="@"+N;let T=D in c?c[D][0]:p[N];if(N==="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 s("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:c})}return T}function w(c){if(!t.isArray(c)||c.length!==1||!t.isObject(c[0]))throw new s("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:c});if("@id"in c[0]){for(const p of n.asArray(c[0]["@id"]))if(!(t.isObject(p)||i.isAbsolute(p))||t.isString(p)&&p.indexOf("_:")===0)throw new s("Invalid JSON-LD syntax; invalid @id in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:c})}if("@type"in c[0]){for(const p of n.asArray(c[0]["@type"]))if(!(t.isObject(p)||i.isAbsolute(p)||p==="@json")||t.isString(p)&&p.indexOf("_:")===0)throw new s("Invalid JSON-LD syntax; invalid @type in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:c})}}function g(c,p,N,D){const T={};for(const q of p){const R=c.graphMap[c.graph][q];m(c,R,N,D)&&(T[q]=R)}return T}function m(c,p,N,D){let T=!0,q=!1;for(const R in N){let M=!1;const B=n.getValues(p,R),A=n.getValues(N,R).length===0;if(R==="@id"){if(t.isEmptyObject(N["@id"][0]||{})?M=!0:N["@id"].length>=0&&(M=N["@id"].includes(B[0])),!D.requireAll)return M}else if(R==="@type"){if(T=!1,A){if(B.length>0)return!1;M=!0}else if(N["@type"].length===1&&t.isEmptyObject(N["@type"][0]))M=B.length>0;else for(const j of N["@type"])t.isObject(j)&&"@default"in j?M=!0:M=M||B.some(Y=>Y===j);if(!D.requireAll)return M}else{if(r(R))continue;{const j=n.getValues(N,R)[0];let Y=!1;if(j&&(w([j]),Y="@default"in j),T=!1,B.length===0&&Y)continue;if(B.length>0&&A)return!1;if(j===void 0){if(B.length>0)return!1;M=!0}else if(e.isList(j)){const L=j["@list"][0];if(e.isList(B[0])){const ee=B[0]["@list"];e.isValue(L)?M=ee.some(C=>b(L,C)):(e.isSubject(L)||e.isSubjectReference(L))&&(M=ee.some(C=>I(c,L,C,D)))}}else e.isValue(j)?M=B.some(L=>b(j,L)):e.isSubjectReference(j)?M=B.some(L=>I(c,j,L,D)):t.isObject(j)?M=B.length>0:M=!1}}if(!M&&D.requireAll)return!1;q=q||M}return T||q}function _(c,p){const N=c.uniqueEmbeds[c.graph],D=N[p],T=D.parent,q=D.property,R={"@id":p};if(t.isArray(T)){for(let B=0;B<T.length;++B)if(n.compareValues(T[B],R)){T[B]=R;break}}else{const B=t.isArray(T[q]);n.removeValue(T,q,R,{propertyIsArray:B}),n.addValue(T,q,R,{propertyIsArray:B})}const M=B=>{const A=Object.keys(N);for(const j of A)j in N&&t.isObject(N[j].parent)&&N[j].parent["@id"]===B&&(delete N[j],M(j))};M(p)}/**
323
+ */var as,Dl;function _f(){if(Dl)return as;Dl=1;const r=hi(),e=qc();return as=class extends e{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new r("sha1")}modifyFirstDegreeComponent(n,i,s){return i.termType!=="BlankNode"?i:s==="graph"?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:i.value===n?"_:a":"_:z"}}getRelatedPredicate(n){return n.predicate.value}createHashToRelated(n,i){const s=new Map,a=this.blankNodeInfo.get(n).quads;for(const o of a){let u,l;if(o.subject.termType==="BlankNode"&&o.subject.value!==n)l=o.subject.value,u="p";else if(o.object.termType==="BlankNode"&&o.object.value!==n)l=o.object.value,u="r";else continue;const c=this.hashRelatedBlankNode(l,o,i,u),d=s.get(c);d?d.push(l):s.set(c,[l])}return s}},as}const wf={},vf=Object.freeze(Object.defineProperty({__proto__:null,default:wf},Symbol.toStringTag,{value:"Module"})),xf=nd(vf);var Ol;function Ef(){return Ol||(Ol=1,function(r){const e=Bc(),t=bf(),n=qc(),i=_f();let s;try{s=xf}catch{}function a(o){return Array.isArray(o)?o:r.NQuads.legacyDatasetToQuads(o)}r.NQuads=Fa(),r.IdentifierIssuer=$a(),r._rdfCanonizeNative=function(o){return o&&(s=o),s},r.canonize=async function(o,u){const l=a(o);if(u.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(u.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return new Promise((c,d)=>s.canonize(l,u,(m,b)=>m?d(m):c(b)))}if(u.algorithm==="URDNA2015")return new e(u).main(l);if(u.algorithm==="URGNA2012"){if(u.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new t(u).main(l)}throw"algorithm"in u?new Error("Invalid RDF Dataset Canonicalization algorithm: "+u.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")},r._canonizeSync=function(o,u){const l=a(o);if(u.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(u.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return s.canonizeSync(l,u)}if(u.algorithm==="URDNA2015")return new n(u).main(l);if(u.algorithm==="URGNA2012"){if(u.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new i(u).main(l)}throw"algorithm"in u?new Error("Invalid RDF Dataset Canonicalization algorithm: "+u.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")}}(Ki)),Ki}var os,Ll;function ka(){return Ll||(Ll=1,os=Ef()),os}var ls,Cl;function ut(){if(Cl)return ls;Cl=1;const r={};return ls=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",ls}var us,jl;function $t(){if(jl)return us;jl=1;const r=ut(),e={};return us=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(n=>n!=="@id"&&n!=="@index").length===1,e.isSimpleGraph=t=>e.isGraph(t)&&!("@id"in t),e.isBlankNode=t=>{if(r.isObject(t)){if("@id"in t){const n=t["@id"];return!r.isString(n)||n.indexOf("_:")===0}return Object.keys(t).length===0||!("@value"in t||"@set"in t||"@list"in t)}return!1},us}var cs,$l;function ft(){return $l||($l=1,cs=class extends Error{constructor(e="An unspecified JSON-LD error occurred.",t="jsonld.Error",n={}){super(e),this.name=t,this.message=e,this.details=n}}),cs}var ds,Fl;function dt(){if(Fl)return ds;Fl=1;const r=$t(),e=ut(),t=ka().IdentifierIssuer,n=ft(),i=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,a=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,o=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,u=/^@[a-zA-Z]+$/,l={headers:{accept:"application/ld+json, application/json"}},c={};ds=c,c.IdentifierIssuer=t,c.REGEX_BCP47=i,c.REGEX_KEYWORD=u,c.clone=function(m){if(m&&typeof m=="object"){let b;if(e.isArray(m)){b=[];for(let _=0;_<m.length;++_)b[_]=c.clone(m[_])}else if(m instanceof Map){b=new Map;for(const[_,x]of m)b.set(_,c.clone(x))}else if(m instanceof Set){b=new Set;for(const _ of m)b.add(c.clone(_))}else if(e.isObject(m)){b={};for(const _ in m)b[_]=c.clone(m[_])}else b=m.toString();return b}return m},c.asArray=function(m){return Array.isArray(m)?m:[m]},c.buildHeaders=(m={})=>{if(Object.keys(m).some(_=>_.toLowerCase()==="accept"))throw new RangeError('Accept header may not be specified; only "'+l.headers.accept+'" is supported.');return Object.assign({Accept:l.headers.accept},m)},c.parseLinkHeader=m=>{const b={},_=m.match(s);for(let x=0;x<_.length;++x){let E=_[x].match(a);if(!E)continue;const v={target:E[1]},S=E[2];for(;E=o.exec(S);)v[E[1]]=E[2]===void 0?E[3]:E[2];const y=v.rel||"";Array.isArray(b[y])?b[y].push(v):b.hasOwnProperty(y)?b[y]=[b[y],v]:b[y]=v}return b},c.validateTypeValue=(m,b)=>{if(!e.isString(m)&&!(e.isArray(m)&&m.every(_=>e.isString(_)))){if(b&&e.isObject(m))switch(Object.keys(m).length){case 0:return;case 1:if("@default"in m&&c.asArray(m["@default"]).every(_=>e.isString(_)))return}throw new n('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:m})}},c.hasProperty=(m,b)=>{if(m.hasOwnProperty(b)){const _=m[b];return!e.isArray(_)||_.length>0}return!1},c.hasValue=(m,b,_)=>{if(c.hasProperty(m,b)){let x=m[b];const E=r.isList(x);if(e.isArray(x)||E){E&&(x=x["@list"]);for(let v=0;v<x.length;++v)if(c.compareValues(_,x[v]))return!0}else if(!e.isArray(_))return c.compareValues(_,x)}return!1},c.addValue=(m,b,_,x)=>{if(x=x||{},"propertyIsArray"in x||(x.propertyIsArray=!1),"valueIsArray"in x||(x.valueIsArray=!1),"allowDuplicate"in x||(x.allowDuplicate=!0),"prependValue"in x||(x.prependValue=!1),x.valueIsArray)m[b]=_;else if(e.isArray(_)){_.length===0&&x.propertyIsArray&&!m.hasOwnProperty(b)&&(m[b]=[]),x.prependValue&&(_=_.concat(m[b]),m[b]=[]);for(let E=0;E<_.length;++E)c.addValue(m,b,_[E],x)}else if(m.hasOwnProperty(b)){const E=!x.allowDuplicate&&c.hasValue(m,b,_);!e.isArray(m[b])&&(!E||x.propertyIsArray)&&(m[b]=[m[b]]),E||(x.prependValue?m[b].unshift(_):m[b].push(_))}else m[b]=x.propertyIsArray?[_]:_},c.getValues=(m,b)=>[].concat(m[b]||[]),c.removeProperty=(m,b)=>{delete m[b]},c.removeValue=(m,b,_,x)=>{x=x||{},"propertyIsArray"in x||(x.propertyIsArray=!1);const E=c.getValues(m,b).filter(v=>!c.compareValues(v,_));E.length===0?c.removeProperty(m,b):E.length===1&&!x.propertyIsArray?m[b]=E[0]:m[b]=E},c.relabelBlankNodes=(m,b)=>{b=b||{};const _=b.issuer||new t("_:b");return d(_,m)},c.compareValues=(m,b)=>m===b||r.isValue(m)&&r.isValue(b)&&m["@value"]===b["@value"]&&m["@type"]===b["@type"]&&m["@language"]===b["@language"]&&m["@index"]===b["@index"]?!0:e.isObject(m)&&"@id"in m&&e.isObject(b)&&"@id"in b?m["@id"]===b["@id"]:!1,c.compareShortestLeast=(m,b)=>m.length<b.length?-1:b.length<m.length?1:m===b?0:m<b?-1:1;function d(m,b){if(e.isArray(b))for(let _=0;_<b.length;++_)b[_]=d(m,b[_]);else if(r.isList(b))b["@list"]=d(m,b["@list"]);else if(e.isObject(b)){r.isBlankNode(b)&&(b["@id"]=m.getId(b["@id"]));const _=Object.keys(b).sort();for(let x=0;x<_.length;++x){const E=_[x];E!=="@id"&&(b[E]=d(m,b[E]))}}return b}return ds}var hs,kl;function Pa(){if(kl)return hs;kl=1;const r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",e="http://www.w3.org/2001/XMLSchema#";return hs={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"},hs}var fs,Pl;function Uc(){return Pl||(Pl=1,fs=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]}}}),fs}var ps,Ml;function Gt(){if(Ml)return ps;Ml=1;const r=ut(),e={};ps=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=(n,i)=>{const s={},a=e.parsers[i||"full"],o=a.regex.exec(n);let u=a.keys.length;for(;u--;)s[a.keys[u]]=o[u]===void 0?null:o[u];return(s.scheme==="https"&&s.port==="443"||s.scheme==="http"&&s.port==="80")&&(s.href=s.href.replace(":"+s.port,""),s.authority=s.authority.replace(":"+s.port,""),s.port=null),s.normalizedPath=e.removeDotSegments(s.path),s},e.prependBase=(n,i)=>{if(n===null||e.isAbsolute(i))return i;(!n||r.isString(n))&&(n=e.parse(n||""));const s=e.parse(i),a={protocol:n.protocol||""};if(s.authority!==null)a.authority=s.authority,a.path=s.path,a.query=s.query;else if(a.authority=n.authority,s.path==="")a.path=n.path,s.query!==null?a.query=s.query:a.query=n.query;else{if(s.path.indexOf("/")===0)a.path=s.path;else{let u=n.path;u=u.substr(0,u.lastIndexOf("/")+1),(u.length>0||n.authority)&&u.substr(-1)!=="/"&&(u+="/"),u+=s.path,a.path=u}a.query=s.query}s.path!==""&&(a.path=e.removeDotSegments(a.path));let o=a.protocol;return a.authority!==null&&(o+="//"+a.authority),o+=a.path,a.query!==null&&(o+="?"+a.query),s.fragment!==null&&(o+="#"+s.fragment),o===""&&(o="./"),o},e.removeBase=(n,i)=>{if(n===null)return i;(!n||r.isString(n))&&(n=e.parse(n||""));let s="";if(n.href!==""?s+=(n.protocol||"")+"//"+(n.authority||""):i.indexOf("//")&&(s+="//"),i.indexOf(s)!==0)return i;const a=e.parse(i.substr(s.length)),o=n.normalizedPath.split("/"),u=a.normalizedPath.split("/"),l=a.fragment||a.query?0:1;for(;o.length>0&&u.length>l&&o[0]===u[0];)o.shift(),u.shift();let c="";if(o.length>0){o.pop();for(let d=0;d<o.length;++d)c+="../"}return c+=u.join("/"),a.query!==null&&(c+="?"+a.query),a.fragment!==null&&(c+="#"+a.fragment),c===""&&(c="./"),c},e.removeDotSegments=n=>{if(n.length===0)return"";const i=n.split("/"),s=[];for(;i.length>0;){const a=i.shift(),o=i.length===0;if(a==="."){o&&s.push("");continue}if(a===".."){s.pop(),o&&s.push("");continue}s.push(a)}return n[0]==="/"&&s.length>0&&s[0]!==""&&s.unshift(""),s.length===1&&s[0]===""?"/":s.join("/")};const t=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;return e.isAbsolute=n=>r.isString(n)&&t.test(n),e.isRelative=n=>r.isString(n),ps}var gs,Bl;function Sf(){if(Bl)return gs;Bl=1;const{parseLinkHeader:r,buildHeaders:e}=dt(),{LINK_HEADER_CONTEXT:t}=Pa(),n=ft(),i=Uc(),{prependBase:s}=Gt(),a=/(^|(\r\n))link:/i;gs=({secure:u,headers:l={},xhr:c}={headers:{}})=>{return l=e(l),new i().wrapLoader(m);async function m(b){if(b.indexOf("http:")!==0&&b.indexOf("https:")!==0)throw new n('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:b});if(u&&b.indexOf("https")!==0)throw new n(`URL could not be dereferenced; secure mode is enabled and the URL's scheme is not "https".`,"jsonld.InvalidUrl",{code:"loading document failed",url:b});let _;try{_=await o(c,b,l)}catch(y){throw new n("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:b,cause:y})}if(_.status>=400)throw new n("URL could not be dereferenced: "+_.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:b,httpStatusCode:_.status});let x={contextUrl:null,documentUrl:b,document:_.response},E=null;const v=_.getResponseHeader("Content-Type");let S;if(a.test(_.getAllResponseHeaders())&&(S=_.getResponseHeader("Link")),S&&v!=="application/ld+json"){const y=r(S),h=y[t];if(Array.isArray(h))throw new n("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:b});h&&(x.contextUrl=h.target),E=y.alternate,E&&E.type=="application/ld+json"&&!(v||"").match(/^application\/(\w*\+)?json$/)&&(x=await m(s(b,E.target)))}return x}};function o(u,l,c){u=u||XMLHttpRequest;const d=new u;return new Promise((m,b)=>{d.onload=()=>m(d),d.onerror=_=>b(_),d.open("GET",l,!0);for(const _ in c)d.setRequestHeader(_,c[_]);d.send()})}return gs}var ms,ql;function Nf(){if(ql)return ms;ql=1;const r=Sf(),e={};return ms=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})},ms}var ys,Ul;function If(){return Ul||(Ul=1,ys=function(r){r.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),ys}var bs,Hl;function Rf(){if(Hl)return bs;Hl=1,bs=r,r.Node=i,r.create=r;function r(s){var a=this;if(a instanceof r||(a=new r),a.tail=null,a.head=null,a.length=0,s&&typeof s.forEach=="function")s.forEach(function(l){a.push(l)});else if(arguments.length>0)for(var o=0,u=arguments.length;o<u;o++)a.push(arguments[o]);return a}r.prototype.removeNode=function(s){if(s.list!==this)throw new Error("removing node which does not belong to this list");var a=s.next,o=s.prev;return a&&(a.prev=o),o&&(o.next=a),s===this.head&&(this.head=a),s===this.tail&&(this.tail=o),s.list.length--,s.next=null,s.prev=null,s.list=null,a},r.prototype.unshiftNode=function(s){if(s!==this.head){s.list&&s.list.removeNode(s);var a=this.head;s.list=this,s.next=a,a&&(a.prev=s),this.head=s,this.tail||(this.tail=s),this.length++}},r.prototype.pushNode=function(s){if(s!==this.tail){s.list&&s.list.removeNode(s);var a=this.tail;s.list=this,s.prev=a,a&&(a.next=s),this.tail=s,this.head||(this.head=s),this.length++}},r.prototype.push=function(){for(var s=0,a=arguments.length;s<a;s++)t(this,arguments[s]);return this.length},r.prototype.unshift=function(){for(var s=0,a=arguments.length;s<a;s++)n(this,arguments[s]);return this.length},r.prototype.pop=function(){if(this.tail){var s=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,s}},r.prototype.shift=function(){if(this.head){var s=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,s}},r.prototype.forEach=function(s,a){a=a||this;for(var o=this.head,u=0;o!==null;u++)s.call(a,o.value,u,this),o=o.next},r.prototype.forEachReverse=function(s,a){a=a||this;for(var o=this.tail,u=this.length-1;o!==null;u--)s.call(a,o.value,u,this),o=o.prev},r.prototype.get=function(s){for(var a=0,o=this.head;o!==null&&a<s;a++)o=o.next;if(a===s&&o!==null)return o.value},r.prototype.getReverse=function(s){for(var a=0,o=this.tail;o!==null&&a<s;a++)o=o.prev;if(a===s&&o!==null)return o.value},r.prototype.map=function(s,a){a=a||this;for(var o=new r,u=this.head;u!==null;)o.push(s.call(a,u.value,this)),u=u.next;return o},r.prototype.mapReverse=function(s,a){a=a||this;for(var o=new r,u=this.tail;u!==null;)o.push(s.call(a,u.value,this)),u=u.prev;return o},r.prototype.reduce=function(s,a){var o,u=this.head;if(arguments.length>1)o=a;else if(this.head)u=this.head.next,o=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var l=0;u!==null;l++)o=s(o,u.value,l),u=u.next;return o},r.prototype.reduceReverse=function(s,a){var o,u=this.tail;if(arguments.length>1)o=a;else if(this.tail)u=this.tail.prev,o=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var l=this.length-1;u!==null;l--)o=s(o,u.value,l),u=u.prev;return o},r.prototype.toArray=function(){for(var s=new Array(this.length),a=0,o=this.head;o!==null;a++)s[a]=o.value,o=o.next;return s},r.prototype.toArrayReverse=function(){for(var s=new Array(this.length),a=0,o=this.tail;o!==null;a++)s[a]=o.value,o=o.prev;return s},r.prototype.slice=function(s,a){a=a||this.length,a<0&&(a+=this.length),s=s||0,s<0&&(s+=this.length);var o=new r;if(a<s||a<0)return o;s<0&&(s=0),a>this.length&&(a=this.length);for(var u=0,l=this.head;l!==null&&u<s;u++)l=l.next;for(;l!==null&&u<a;u++,l=l.next)o.push(l.value);return o},r.prototype.sliceReverse=function(s,a){a=a||this.length,a<0&&(a+=this.length),s=s||0,s<0&&(s+=this.length);var o=new r;if(a<s||a<0)return o;s<0&&(s=0),a>this.length&&(a=this.length);for(var u=this.length,l=this.tail;l!==null&&u>a;u--)l=l.prev;for(;l!==null&&u>s;u--,l=l.prev)o.push(l.value);return o},r.prototype.splice=function(s,a,...o){s>this.length&&(s=this.length-1),s<0&&(s=this.length+s);for(var u=0,l=this.head;l!==null&&u<s;u++)l=l.next;for(var c=[],u=0;l&&u<a;u++)c.push(l.value),l=this.removeNode(l);l===null&&(l=this.tail),l!==this.head&&l!==this.tail&&(l=l.prev);for(var u=0;u<o.length;u++)l=e(this,l,o[u]);return c},r.prototype.reverse=function(){for(var s=this.head,a=this.tail,o=s;o!==null;o=o.prev){var u=o.prev;o.prev=o.next,o.next=u}return this.head=a,this.tail=s,this};function e(s,a,o){var u=a===s.head?new i(o,null,a,s):new i(o,a,a.next,s);return u.next===null&&(s.tail=u),u.prev===null&&(s.head=u),s.length++,u}function t(s,a){s.tail=new i(a,s.tail,null,s),s.head||(s.head=s.tail),s.length++}function n(s,a){s.head=new i(a,null,s.head,s),s.tail||(s.tail=s.head),s.length++}function i(s,a,o,u){if(!(this instanceof i))return new i(s,a,o,u);this.list=u,this.value=s,a?(a.next=this,this.prev=a):this.prev=null,o?(o.prev=this,this.next=o):this.next=null}try{If()(r)}catch{}return bs}var _s,Vl;function Hc(){if(Vl)return _s;Vl=1;const r=Rf(),e=Symbol("max"),t=Symbol("length"),n=Symbol("lengthCalculator"),i=Symbol("allowStale"),s=Symbol("maxAge"),a=Symbol("dispose"),o=Symbol("noDisposeOnSet"),u=Symbol("lruList"),l=Symbol("cache"),c=Symbol("updateAgeOnGet"),d=()=>1;class m{constructor(h){if(typeof h=="number"&&(h={max:h}),h||(h={}),h.max&&(typeof h.max!="number"||h.max<0))throw new TypeError("max must be a non-negative number");this[e]=h.max||1/0;const g=h.length||d;if(this[n]=typeof g!="function"?d:g,this[i]=h.stale||!1,h.maxAge&&typeof h.maxAge!="number")throw new TypeError("maxAge must be a number");this[s]=h.maxAge||0,this[a]=h.dispose,this[o]=h.noDisposeOnSet||!1,this[c]=h.updateAgeOnGet||!1,this.reset()}set max(h){if(typeof h!="number"||h<0)throw new TypeError("max must be a non-negative number");this[e]=h||1/0,x(this)}get max(){return this[e]}set allowStale(h){this[i]=!!h}get allowStale(){return this[i]}set maxAge(h){if(typeof h!="number")throw new TypeError("maxAge must be a non-negative number");this[s]=h,x(this)}get maxAge(){return this[s]}set lengthCalculator(h){typeof h!="function"&&(h=d),h!==this[n]&&(this[n]=h,this[t]=0,this[u].forEach(g=>{g.length=this[n](g.value,g.key),this[t]+=g.length})),x(this)}get lengthCalculator(){return this[n]}get length(){return this[t]}get itemCount(){return this[u].length}rforEach(h,g){g=g||this;for(let I=this[u].tail;I!==null;){const C=I.prev;S(this,h,I,g),I=C}}forEach(h,g){g=g||this;for(let I=this[u].head;I!==null;){const C=I.next;S(this,h,I,g),I=C}}keys(){return this[u].toArray().map(h=>h.key)}values(){return this[u].toArray().map(h=>h.value)}reset(){this[a]&&this[u]&&this[u].length&&this[u].forEach(h=>this[a](h.key,h.value)),this[l]=new Map,this[u]=new r,this[t]=0}dump(){return this[u].map(h=>_(this,h)?!1:{k:h.key,v:h.value,e:h.now+(h.maxAge||0)}).toArray().filter(h=>h)}dumpLru(){return this[u]}set(h,g,I){if(I=I||this[s],I&&typeof I!="number")throw new TypeError("maxAge must be a number");const C=I?Date.now():0,A=this[n](g,h);if(this[l].has(h)){if(A>this[e])return E(this,this[l].get(h)),!1;const F=this[l].get(h).value;return this[a]&&(this[o]||this[a](h,F.value)),F.now=C,F.maxAge=I,F.value=g,this[t]+=A-F.length,F.length=A,this.get(h),x(this),!0}const B=new v(h,g,A,C,I);return B.length>this[e]?(this[a]&&this[a](h,g),!1):(this[t]+=B.length,this[u].unshift(B),this[l].set(h,this[u].head),x(this),!0)}has(h){if(!this[l].has(h))return!1;const g=this[l].get(h).value;return!_(this,g)}get(h){return b(this,h,!0)}peek(h){return b(this,h,!1)}pop(){const h=this[u].tail;return h?(E(this,h),h.value):null}del(h){E(this,this[l].get(h))}load(h){this.reset();const g=Date.now();for(let I=h.length-1;I>=0;I--){const C=h[I],A=C.e||0;if(A===0)this.set(C.k,C.v);else{const B=A-g;B>0&&this.set(C.k,C.v,B)}}}prune(){this[l].forEach((h,g)=>b(this,g,!1))}}const b=(y,h,g)=>{const I=y[l].get(h);if(I){const C=I.value;if(_(y,C)){if(E(y,I),!y[i])return}else g&&(y[c]&&(I.value.now=Date.now()),y[u].unshiftNode(I));return C.value}},_=(y,h)=>{if(!h||!h.maxAge&&!y[s])return!1;const g=Date.now()-h.now;return h.maxAge?g>h.maxAge:y[s]&&g>y[s]},x=y=>{if(y[t]>y[e])for(let h=y[u].tail;y[t]>y[e]&&h!==null;){const g=h.prev;E(y,h),h=g}},E=(y,h)=>{if(h){const g=h.value;y[a]&&y[a](g.key,g.value),y[t]-=g.length,y[l].delete(g.key),y[u].removeNode(h)}};class v{constructor(h,g,I,C,A){this.key=h,this.value=g,this.length=I,this.now=C,this.maxAge=A||0}}const S=(y,h,g,I)=>{let C=g.value;_(y,C)&&(E(y,g),y[i]||(C=void 0)),C&&h.call(I,C.value,C.key,y)};return _s=m,_s}var ws,Gl;function Tf(){if(Gl)return ws;Gl=1;const r=Hc(),e=10;return ws=class{constructor({document:n}){this.document=n,this.cache=new r({max:e})}getProcessed(n){return this.cache.get(n)}setProcessed(n,i){this.cache.set(n,i)}},ws}var vs,Wl;function Af(){if(Wl)return vs;Wl=1;const{isArray:r,isObject:e,isString:t}=ut(),{asArray:n}=dt(),{prependBase:i}=Gt(),s=ft(),a=Tf(),o=10;vs=class{constructor({sharedCache:d}){this.perOpCache=new Map,this.sharedCache=d}async resolve({activeCtx:d,context:m,documentLoader:b,base:_,cycles:x=new Set}){m&&e(m)&&m["@context"]&&(m=m["@context"]),m=n(m);const E=[];for(const v of m){if(t(v)){let h=this._get(v);h||(h=await this._resolveRemoteContext({activeCtx:d,url:v,documentLoader:b,base:_,cycles:x})),r(h)?E.push(...h):E.push(h);continue}if(v===null){E.push(new a({document:null}));continue}e(v)||u(m);const S=JSON.stringify(v);let y=this._get(S);y||(y=new a({document:v}),this._cacheResolvedContext({key:S,resolved:y,tag:"static"})),E.push(y)}return E}_get(d){let m=this.perOpCache.get(d);if(!m){const b=this.sharedCache.get(d);b&&(m=b.get("static"),m&&this.perOpCache.set(d,m))}return m}_cacheResolvedContext({key:d,resolved:m,tag:b}){if(this.perOpCache.set(d,m),b!==void 0){let _=this.sharedCache.get(d);_||(_=new Map,this.sharedCache.set(d,_)),_.set(b,m)}return m}async _resolveRemoteContext({activeCtx:d,url:m,documentLoader:b,base:_,cycles:x}){m=i(_,m);const{context:E,remoteDoc:v}=await this._fetchContext({activeCtx:d,url:m,documentLoader:b,cycles:x});_=v.documentUrl||m,l({context:E,base:_});const S=await this.resolve({activeCtx:d,context:E,documentLoader:b,base:_,cycles:x});return this._cacheResolvedContext({key:m,resolved:S,tag:v.tag}),S}async _fetchContext({activeCtx:d,url:m,documentLoader:b,cycles:_}){if(_.size>o)throw new s("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:d.processingMode==="json-ld-1.0"?"loading remote context failed":"context overflow",max:o});if(_.has(m))throw new s("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:d.processingMode==="json-ld-1.0"?"recursive context inclusion":"context overflow",url:m});_.add(m);let x,E;try{E=await b(m),x=E.document||null,t(x)&&(x=JSON.parse(x))}catch(v){throw new s(`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: "${m}".`,"jsonld.InvalidUrl",{code:"loading remote context failed",url:m,cause:v})}if(!e(x))throw new s(`Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object. URL: "${m}".`,"jsonld.InvalidUrl",{code:"invalid remote context",url:m});return"@context"in x?x={"@context":x["@context"]}:x={"@context":{}},E.contextUrl&&(r(x["@context"])||(x["@context"]=[x["@context"]]),x["@context"].push(E.contextUrl)),{context:x,remoteDoc:E}}};function u(c){throw new s("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:c})}function l({context:c,base:d}){if(!c)return;const m=c["@context"];if(t(m)){c["@context"]=i(d,m);return}if(r(m)){for(let b=0;b<m.length;++b){const _=m[b];if(t(_)){m[b]=i(d,_);continue}e(_)&&l({context:{"@context":_},base:d})}return}if(e(m))for(const b in m)l({context:m[b],base:d})}return vs}var xs,zl;function Df(){return zl||(zl=1,xs=ka().NQuads),xs}var Es,Xl;function Nn(){if(Xl)return Es;Xl=1;const r=ft(),{isArray:e}=ut(),{asArray:t}=dt(),n={};Es=n,n.defaultEventHandler=null,n.setupEventHandler=({options:a={}})=>{const o=[].concat(a.safe?n.safeEventHandler:[],a.eventHandler?t(a.eventHandler):[],n.defaultEventHandler?n.defaultEventHandler:[]);return o.length===0?null:o},n.handleEvent=({event:a,options:o})=>{i({event:a,handlers:o.eventHandler})};function i({event:a,handlers:o}){let u=!0;for(let l=0;u&&l<o.length;++l){u=!1;const c=o[l];if(e(c))u=i({event:a,handlers:c});else if(typeof c=="function")c({event:a,next:()=>{u=!0}});else if(typeof c=="object")a.code in c?c[a.code]({event:a,next:()=>{u=!0}}):u=!0;else throw new r("Invalid event handler.","jsonld.InvalidEventHandler",{event:a})}return u}const s=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 n.safeEventHandler=function({event:o,next:u}){if(o.level==="warning"&&s.has(o.code))throw new r("Safe mode validation error.","jsonld.ValidationError",{event:o});u()},n.logEventHandler=function({event:o,next:u}){console.log(`EVENT: ${o.message}`,{event:o}),u()},n.logWarningEventHandler=function({event:o,next:u}){o.level==="warning"&&console.warn(`WARNING: ${o.message}`,{event:o}),u()},n.unhandledEventHandler=function({event:o}){throw new r("No handler for event.","jsonld.UnhandledEvent",{event:o})},n.setDefaultEventHandler=function({eventHandler:a}={}){n.defaultEventHandler=a?t(a):null},Es}var Ss,Ql;function ar(){if(Ql)return Ss;Ql=1;const r=dt(),e=ft(),{isArray:t,isObject:n,isString:i,isUndefined:s}=ut(),{isAbsolute:a,isRelative:o,prependBase:u}=Gt(),{handleEvent:l}=Nn(),{REGEX_BCP47:c,REGEX_KEYWORD:d,asArray:m,compareShortestLeast:b}=dt(),_=new Map,x=1e4,E={};Ss=E,E.process=async({activeCtx:y,localCtx:h,options:g,propagate:I=!0,overrideProtected:C=!1,cycles:A=new Set})=>{if(n(h)&&"@context"in h&&t(h["@context"])&&(h=h["@context"]),m(h).length===0)return y;const R=[],F=[({event:te,next:T})=>{R.push(te),T()}];g.eventHandler&&F.push(g.eventHandler);const q=g;g={...g,eventHandler:F};const D=await g.contextResolver.resolve({activeCtx:y,context:h,documentLoader:g.documentLoader,base:g.base});n(D[0].document)&&typeof D[0].document["@propagate"]=="boolean"&&(I=D[0].document["@propagate"]);let O=y;!I&&!O.previousContext&&(O=O.clone(),O.previousContext=y);for(const te of D){let{document:T}=te;if(y=O,T===null){if(!C&&Object.keys(y.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"});O=y=E.getInitialContext(g).clone();continue}const Z=te.getProcessed(y);if(Z){if(q.eventHandler)for(const Y of Z.events)l({event:Y,options:q});O=y=Z.context;continue}if(n(T)&&"@context"in T&&(T=T["@context"]),!n(T))throw new e("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:T});O=O.clone();const k=new Map;if("@version"in T){if(T["@version"]!==1.1)throw new e("Unsupported JSON-LD version: "+T["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:T});if(y.processingMode&&y.processingMode==="json-ld-1.0")throw new e("@version: "+T["@version"]+" not compatible with "+y.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:T});O.processingMode="json-ld-1.1",O["@version"]=T["@version"],k.set("@version",!0)}if(O.processingMode=O.processingMode||y.processingMode,"@base"in T){let Y=T["@base"];if(!(Y===null||a(Y)))if(o(Y))Y=u(O["@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:T});O["@base"]=Y,k.set("@base",!0)}if("@vocab"in T){const Y=T["@vocab"];if(Y===null)delete O["@vocab"];else if(i(Y)){if(!a(Y)&&E.processingMode(O,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:T});{const w=v(O,Y,{vocab:!0,base:!0},void 0,void 0,g);a(w)||g.eventHandler&&l({event:{type:["JsonLdEvent"],code:"relative @vocab reference",level:"warning",message:"Relative @vocab reference found.",details:{vocab:w}},options:g}),O["@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:T});k.set("@vocab",!0)}if("@language"in T){const Y=T["@language"];if(Y===null)delete O["@language"];else if(i(Y))Y.match(c)||g.eventHandler&&l({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:Y}},options:g}),O["@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:T});k.set("@language",!0)}if("@direction"in T){const Y=T["@direction"];if(y.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @direction not compatible with "+y.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:T});if(Y===null)delete O["@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:T});O["@direction"]=Y}k.set("@direction",!0)}if("@propagate"in T){const Y=T["@propagate"];if(y.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @propagate not compatible with "+y.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:T});if(typeof Y!="boolean")throw new e("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:h});k.set("@propagate",!0)}if("@import"in T){const Y=T["@import"];if(y.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @import not compatible with "+y.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:T});if(!i(Y))throw new e("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:h});const w=await g.contextResolver.resolve({activeCtx:y,context:Y,documentLoader:g.documentLoader,base:g.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:h});const H=w[0].getProcessed(y);if(H)T=H;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:h});for(const X in K)T.hasOwnProperty(X)||(T[X]=K[X]);w[0].setProcessed(y,T)}k.set("@import",!0)}k.set("@protected",T["@protected"]||!1);for(const Y in T)if(E.createTermDefinition({activeCtx:O,localCtx:T,term:Y,defined:k,options:g,overrideProtected:C}),n(T[Y])&&"@context"in T[Y]){const w=T[Y]["@context"];let H=!0;if(i(w)){const K=u(g.base,w);A.has(K)?H=!1:A.add(K)}if(H)try{await E.process({activeCtx:O.clone(),localCtx:T[Y]["@context"],overrideProtected:!0,options:g,cycles:A})}catch{throw new e("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:T[Y]["@context"],term:Y})}}te.setProcessed(y,{context:O,events:R})}return O},E.createTermDefinition=({activeCtx:y,localCtx:h,term:g,defined:I,options:C,overrideProtected:A=!1})=>{if(I.has(g)){if(I.get(g))return;throw new e("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:h,term:g})}I.set(g,!1);let B;if(h.hasOwnProperty(g)&&(B=h[g]),g==="@type"&&n(B)&&(B["@container"]||"@set")==="@set"&&E.processingMode(y,1.1)){const T=["@container","@id","@protected"],Z=Object.keys(B);if(Z.length===0||Z.some(k=>!T.includes(k)))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:h,term:g})}else{if(E.isKeyword(g))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:h,term:g});if(g.match(d)){C.eventHandler&&l({event:{type:["JsonLdEvent"],code:"reserved term",level:"warning",message:'Terms beginning with "@" are reserved for future use and dropped.',details:{term:g}},options:C});return}else if(g==="")throw new e("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:h})}const R=y.mappings.get(g);y.mappings.has(g)&&y.mappings.delete(g);let F=!1;if((i(B)||B===null)&&(F=!0,B={"@id":B}),!n(B))throw new e("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:h});const q={};y.mappings.set(g,q),q.reverse=!1;const D=["@container","@id","@language","@reverse","@type"];E.processingMode(y,1.1)&&D.push("@context","@direction","@index","@nest","@prefix","@protected");for(const T in B)if(!D.includes(T))throw new e("Invalid JSON-LD syntax; a term definition must not contain "+T,"jsonld.SyntaxError",{code:"invalid term definition",context:h});const O=g.indexOf(":");if(q._termHasColon=O>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:h});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:h});const T=B["@reverse"];if(!i(T))throw new e("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:h});if(T.match(d)){C.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:T}},options:C}),R?y.mappings.set(g,R):y.mappings.delete(g);return}const Z=v(y,T,{vocab:!0,base:!1},h,I,C);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:h});q["@id"]=Z,q.reverse=!0}else if("@id"in B){let T=B["@id"];if(T&&!i(T))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:h});if(T===null)q["@id"]=null;else if(!E.isKeyword(T)&&T.match(d)){C.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:T}},options:C}),R?y.mappings.set(g,R):y.mappings.delete(g);return}else if(T!==g){if(T=v(y,T,{vocab:!0,base:!1},h,I,C),!a(T)&&!E.isKeyword(T))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:h});if(g.match(/(?::[^:])|\//)){const Z=new Map(I).set(g,!0);if(v(y,g,{vocab:!0,base:!1},h,Z,C)!==T)throw new e("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:h})}q["@id"]=T,q._prefix=F&&!q._termHasColon&&T.match(/[:\/\?#\[\]@]$/)!==null}}if(!("@id"in q))if(q._termHasColon){const T=g.substr(0,O);if(h.hasOwnProperty(T)&&E.createTermDefinition({activeCtx:y,localCtx:h,term:T,defined:I,options:C}),y.mappings.has(T)){const Z=g.substr(O+1);q["@id"]=y.mappings.get(T)["@id"]+Z}else q["@id"]=g}else if(g==="@type")q["@id"]=g;else{if(!("@vocab"in y))throw new e("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:h,term:g});q["@id"]=y["@vocab"]+g}if((B["@protected"]===!0||I.get("@protected")===!0&&B["@protected"]!==!1)&&(y.protected[g]=!0,q.protected=!0),I.set(g,!0),"@type"in B){let T=B["@type"];if(!i(T))throw new e("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:h});if(T==="@json"||T==="@none"){if(E.processingMode(y,1))throw new e(`Invalid JSON-LD syntax; an @context @type value must not be "${T}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:h})}else if(T!=="@id"&&T!=="@vocab"){if(T=v(y,T,{vocab:!0,base:!1},h,I,C),!a(T))throw new e("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:h});if(T.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:h})}q["@type"]=T}if("@container"in B){const T=i(B["@container"])?[B["@container"]]:B["@container"]||[],Z=["@list","@set","@index","@language"];let k=!0;const Y=T.includes("@set");if(E.processingMode(y,1.1)){if(Z.push("@graph","@id","@type"),T.includes("@list")){if(T.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:h})}else if(T.includes("@graph")){if(T.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:h})}else k&=T.length<=(Y?2:1);if(T.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:h})}else k&=!t(B["@container"]),k&=T.length<=1;if(k&=T.every(w=>Z.includes(w)),k&=!(Y&&T.includes("@list")),!k)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:h});if(q.reverse&&!T.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:h});q["@container"]=T}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 "${g}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:h});if(!i(B["@index"])||B["@index"].indexOf("@")===0)throw new e(`Invalid JSON-LD syntax; @index must expand to an IRI: "${B["@index"]}" on term "${g}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:h});q["@index"]=B["@index"]}if("@context"in B&&(q["@context"]=B["@context"]),"@language"in B&&!("@type"in B)){let T=B["@language"];if(T!==null&&!i(T))throw new e("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:h});T!==null&&(T=T.toLowerCase()),q["@language"]=T}if("@prefix"in B){if(g.match(/:|\//))throw new e("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:h});if(E.isKeyword(q["@id"]))throw new e("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:h});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:h})}if("@direction"in B){const T=B["@direction"];if(T!==null&&T!=="ltr"&&T!=="rtl")throw new e('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:h});q["@direction"]=T}if("@nest"in B){const T=B["@nest"];if(!i(T)||T!=="@nest"&&T.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:h});q["@nest"]=T}// disallow aliasing @context and @preserve
324
+ const te=q["@id"];if(te==="@context"||te==="@preserve")throw new e("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:h});if(R&&R.protected&&!A&&(y.protected[g]=!0,q.protected=!0,!S(R,q)))throw new e("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:h,term:g})},E.expandIri=(y,h,g,I)=>v(y,h,g,void 0,void 0,I);function v(y,h,g,I,C,A){if(h===null||!i(h)||E.isKeyword(h))return h;if(h.match(d))return null;if(I&&I.hasOwnProperty(h)&&C.get(h)!==!0&&E.createTermDefinition({activeCtx:y,localCtx:I,term:h,defined:C,options:A}),g=g||{},g.vocab){const R=y.mappings.get(h);if(R===null)return null;if(n(R)&&"@id"in R)return R["@id"]}const B=h.indexOf(":");if(B>0){const R=h.substr(0,B),F=h.substr(B+1);if(R==="_"||F.indexOf("//")===0)return h;I&&I.hasOwnProperty(R)&&E.createTermDefinition({activeCtx:y,localCtx:I,term:R,defined:C,options:A});const q=y.mappings.get(R);if(q&&q._prefix)return q["@id"]+F;if(a(h))return h}if(g.vocab&&"@vocab"in y)h=y["@vocab"]+h;else if(g.base){let R,F;"@base"in y?y["@base"]?(F=u(A.base,y["@base"]),R=u(F,h)):(F=y["@base"],R=h):(F=A.base,R=u(A.base,h)),h=R}return h}E.getInitialContext=y=>{const h=JSON.stringify({processingMode:y.processingMode}),g=_.get(h);if(g)return g;const I={processingMode:y.processingMode,mappings:new Map,inverse:null,getInverse:C,clone:R,revertToPreviousContext:F,protected:{}};return _.size===x&&_.clear(),_.set(h,I),I;function C(){const q=this;if(q.inverse)return q.inverse;const D=q.inverse={},O=q.fastCurieMap={},te={},T=(q["@language"]||"@none").toLowerCase(),Z=q["@direction"],k=q.mappings,Y=[...k.keys()].sort(b);for(const w of Y){const H=k.get(w);if(H===null)continue;let K=H["@container"]||"@none";if(K=[].concat(K).sort().join(""),H["@id"]===null)continue;const X=m(H["@id"]);for(const ue of X){let V=D[ue];const G=E.isKeyword(ue);if(V)!G&&!H._termHasColon&&te[ue].push(w);else if(D[ue]=V={},!G&&!H._termHasColon){te[ue]=[w];const z={iri:ue,terms:te[ue]};ue[0]in O?O[ue[0]].push(z):O[ue[0]]=[z]}if(V[K]||(V[K]={"@language":{},"@type":{},"@any":{}}),V=V[K],B(w,V["@any"],"@none"),H.reverse)B(w,V["@type"],"@reverse");else if(H["@type"]==="@none")B(w,V["@any"],"@none"),B(w,V["@language"],"@none"),B(w,V["@type"],"@none");else if("@type"in H)B(w,V["@type"],H["@type"]);else if("@language"in H&&"@direction"in H){const z=H["@language"],U=H["@direction"];z&&U?B(w,V["@language"],`${z}_${U}`.toLowerCase()):z?B(w,V["@language"],z.toLowerCase()):U?B(w,V["@language"],`_${U}`):B(w,V["@language"],"@null")}else"@language"in H?B(w,V["@language"],(H["@language"]||"@null").toLowerCase()):"@direction"in H?H["@direction"]?B(w,V["@language"],`_${H["@direction"]}`):B(w,V["@language"],"@none"):Z?(B(w,V["@language"],`_${Z}`),B(w,V["@language"],"@none"),B(w,V["@type"],"@none")):(B(w,V["@language"],T),B(w,V["@language"],"@none"),B(w,V["@type"],"@none"))}}for(const w in O)A(O,w,1);return D}function A(q,D,O){const te=q[D],T=q[D]={};let Z,k;for(const Y of te)Z=Y.iri,O>=Z.length?k="":k=Z[O],k in T?T[k].push(Y):T[k]=[Y];for(const Y in T)Y!==""&&A(T,Y,O+1)}function B(q,D,O){D.hasOwnProperty(O)||(D[O]=q)}function R(){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 F(){return this.previousContext?this.previousContext.clone():this}},E.getContextValue=(y,h,g)=>{if(h===null)return g==="@context"?void 0:null;if(y.mappings.has(h)){const I=y.mappings.get(h);if(s(g))return I;if(I.hasOwnProperty(g))return I[g]}if(g==="@language"&&g in y||g==="@direction"&&g in y)return y[g];if(g!=="@context")return null},E.processingMode=(y,h)=>h.toString()>="1.1"?!y.processingMode||y.processingMode>="json-ld-"+h.toString():y.processingMode==="json-ld-1.0",E.isKeyword=y=>{if(!i(y)||y[0]!=="@")return!1;switch(y){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 S(y,h){if(!(y&&typeof y=="object")||!(h&&typeof h=="object"))return y===h;const g=Array.isArray(y);if(g!==Array.isArray(h))return!1;if(g){if(y.length!==h.length)return!1;for(let A=0;A<y.length;++A)if(!S(y[A],h[A]))return!1;return!0}const I=Object.keys(y),C=Object.keys(h);if(I.length!==C.length)return!1;for(const A in y){let B=y[A],R=h[A];if(A==="@container"&&Array.isArray(B)&&Array.isArray(R)&&(B=B.slice().sort(),R=R.slice().sort()),!S(B,R))return!1}return!0}return Ss}var Ns,Jl;function Of(){if(Jl)return Ns;Jl=1;const r=ft(),{isArray:e,isObject:t,isEmptyObject:n,isString:i,isUndefined:s}=ut(),{isList:a,isValue:o,isGraph:u,isSubject:l}=$t(),{expandIri:c,getContextValue:d,isKeyword:m,process:b,processingMode:_}=ar(),{isAbsolute:x}=Gt(),{REGEX_BCP47:E,REGEX_KEYWORD:v,addValue:S,asArray:y,getValues:h,validateTypeValue:g}=dt(),{handleEvent:I}=Nn(),C={};Ns=C,C.expand=async({activeCtx:D,activeProperty:O=null,element:te,options:T={},insideList:Z=!1,insideIndex:k=!1,typeScopedContext:Y=null})=>{if(te==null)return null;if(O==="@default"&&(T=Object.assign({},T,{isFrame:!1})),!e(te)&&!t(te))return!Z&&(O===null||c(D,O,{vocab:!0},T)==="@graph")?(T.eventHandler&&I({event:{type:["JsonLdEvent"],code:"free-floating scalar",level:"warning",message:"Dropping free-floating scalar not in a list.",details:{value:te}},options:T}),null):R({activeCtx:D,activeProperty:O,value:te,options:T});if(e(te)){let z=[];const U=d(D,O,"@container")||[];Z=Z||U.includes("@list");for(let ee=0;ee<te.length;++ee){let re=await C.expand({activeCtx:D,activeProperty:O,element:te[ee],options:T,insideIndex:k,typeScopedContext:Y});Z&&e(re)&&(re={"@list":re}),re!==null&&(e(re)?z=z.concat(re):z.push(re))}return z}const w=c(D,O,{vocab:!0},T),H=d(D,O,"@context");Y=Y||(D.previousContext?D:null);let K=Object.keys(te).sort(),X=!k;if(X&&Y&&K.length<=2&&!K.includes("@context"))for(const z of K){const U=c(Y,z,{vocab:!0},T);if(U==="@value"){X=!1,D=Y;break}if(U==="@id"&&K.length===1){X=!1;break}}X&&(D=D.revertToPreviousContext()),s(H)||(D=await b({activeCtx:D,localCtx:H,propagate:!0,overrideProtected:!0,options:T})),"@context"in te&&(D=await b({activeCtx:D,localCtx:te["@context"],options:T})),Y=D;let ue=null;for(const z of K)if(c(D,z,{vocab:!0},T)==="@type"){ue=ue||z;const ee=te[z],re=Array.isArray(ee)?ee.length>1?ee.slice().sort():ee:[ee];for(const fe of re){const ge=d(Y,fe,"@context");s(ge)||(D=await b({activeCtx:D,localCtx:ge,options:T,propagate:!1}))}}let V={};await B({activeCtx:D,activeProperty:O,expandedActiveProperty:w,element:te,expandedParent:V,options:T,insideList:Z,typeKey:ue,typeScopedContext:Y}),K=Object.keys(V);let G=K.length;if("@value"in V){if("@type"in V&&("@language"in V||"@direction"in V))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:V});let z=G-1;if("@type"in V&&(z-=1),"@index"in V&&(z-=1),"@language"in V&&(z-=1),"@direction"in V&&(z-=1),z!==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:V});const U=V["@value"]===null?[]:y(V["@value"]),ee=h(V,"@type");if(!(_(D,1.1)&&ee.includes("@json")&&ee.length===1))if(U.length===0)T.eventHandler&&I({event:{type:["JsonLdEvent"],code:"null @value value",level:"warning",message:"Dropping null @value value.",details:{value:V}},options:T}),V=null;else{if(!U.every(re=>i(re)||n(re))&&"@language"in V)throw new r("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:V});if(!ee.every(re=>x(re)&&!(i(re)&&re.indexOf("_:")===0)||n(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:V})}}else if("@type"in V&&!e(V["@type"]))V["@type"]=[V["@type"]];else if("@set"in V||"@list"in V){if(G>1&&!(G===2&&"@index"in V))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:V});"@set"in V&&(V=V["@set"],K=Object.keys(V),G=K.length)}else G===1&&"@language"in V&&(T.eventHandler&&I({event:{type:["JsonLdEvent"],code:"object with only @language",level:"warning",message:"Dropping object with only @language.",details:{value:V}},options:T}),V=null);return t(V)&&!T.keepFreeFloatingNodes&&!Z&&(O===null||w==="@graph"||(d(D,O,"@container")||[]).includes("@graph"))&&(V=A({value:V,count:G,options:T})),V};function A({value:D,count:O,options:te}){if(O===0||"@value"in D||"@list"in D||O===1&&"@id"in D){if(te.eventHandler){let T,Z;O===0?(T="empty object",Z="Dropping empty object."):"@value"in D?(T="object with only @value",Z="Dropping object with only @value."):"@list"in D?(T="object with only @list",Z="Dropping object with only @list."):O===1&&"@id"in D&&(T="object with only @id",Z="Dropping object with only @id."),I({event:{type:["JsonLdEvent"],code:T,level:"warning",message:Z,details:{value:D}},options:te})}return null}return D}async function B({activeCtx:D,activeProperty:O,expandedActiveProperty:te,element:T,expandedParent:Z,options:k={},insideList:Y,typeKey:w,typeScopedContext:H}){const K=Object.keys(T).sort(),X=[];let ue;const V=T[w]&&c(D,e(T[w])?T[w][0]:T[w],{vocab:!0},{...k,typeExpansion:!0})==="@json";for(const G of K){let z=T[G],U;if(G==="@context")continue;const ee=c(D,G,{vocab:!0},k);if(ee===null||!(x(ee)||m(ee))){k.eventHandler&&I({event:{type:["JsonLdEvent"],code:"invalid property",level:"warning",message:"Dropping property that did not expand into an absolute IRI or keyword.",details:{property:G,expandedProperty:ee}},options:k});continue}if(m(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:z});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(!i(z)){if(!k.isFrame)throw new r('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:z});if(t(z)){if(!n(z))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:z})}else if(e(z)){if(!z.every(j=>i(j)))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:z})}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:z})}S(Z,"@id",y(z).map(j=>{if(i(j)){const W=c(D,j,{base:!0},k);return k.eventHandler&&(W===null?I(j===null?{event:{type:["JsonLdEvent"],code:"null @id value",level:"warning",message:"Null @id found.",details:{id:j}},options:k}:{event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:j}},options:k}):x(W)||I({event:{type:["JsonLdEvent"],code:"relative @id reference",level:"warning",message:"Relative @id reference found.",details:{id:j,expandedId:W}},options:k})),W}return j}),{propertyIsArray:k.isFrame});continue}if(ee==="@type"){t(z)&&(z=Object.fromEntries(Object.entries(z).map(([j,W])=>[c(H,j,{vocab:!0}),y(W).map(se=>c(H,se,{base:!0,vocab:!0},{...k,typeExpansion:!0}))]))),g(z,k.isFrame),S(Z,"@type",y(z).map(j=>{if(i(j)){const W=c(H,j,{base:!0,vocab:!0},{...k,typeExpansion:!0});return W!=="@json"&&!x(W)&&k.eventHandler&&I({event:{type:["JsonLdEvent"],code:"relative @type reference",level:"warning",message:"Relative @type reference found.",details:{type:j}},options:k}),W}return j}),{propertyIsArray:!!k.isFrame});continue}if(ee==="@included"&&_(D,1.1)){const j=y(await C.expand({activeCtx:D,activeProperty:O,element:z,options:k}));if(!j.every(W=>l(W)))throw new r("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:z});S(Z,"@included",j,{propertyIsArray:!0});continue}if(ee==="@graph"&&!(t(z)||e(z)))throw new r('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:z});if(ee==="@value"){ue=z,V&&_(D,1.1)?Z["@value"]=z:S(Z,"@value",z,{propertyIsArray:k.isFrame});continue}if(ee==="@language"){if(z===null)continue;if(!i(z)&&!k.isFrame)throw new r('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:z});z=y(z).map(j=>i(j)?j.toLowerCase():j);for(const j of z)i(j)&&!j.match(E)&&k.eventHandler&&I({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:j}},options:k});S(Z,"@language",z,{propertyIsArray:k.isFrame});continue}if(ee==="@direction"){if(!i(z)&&!k.isFrame)throw new r('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:z});z=y(z);for(const j of z)if(i(j)&&j!=="ltr"&&j!=="rtl")throw new r('Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",value:z});S(Z,"@direction",z,{propertyIsArray:k.isFrame});continue}if(ee==="@index"){if(!i(z))throw new r('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:z});S(Z,"@index",z);continue}if(ee==="@reverse"){if(!t(z))throw new r('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:z});if(U=await C.expand({activeCtx:D,activeProperty:"@reverse",element:z,options:k}),"@reverse"in U)for(const W in U["@reverse"])S(Z,W,U["@reverse"][W],{propertyIsArray:!0});let j=Z["@reverse"]||null;for(const W in U){if(W==="@reverse")continue;j===null&&(j=Z["@reverse"]={}),S(j,W,[],{propertyIsArray:!0});const se=U[W];for(let he=0;he<se.length;++he){const pe=se[he];if(o(pe)||a(pe))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:U});S(j,W,pe,{propertyIsArray:!0})}}continue}if(ee==="@nest"){X.push(G);continue}let re=D;const fe=d(D,G,"@context");s(fe)||(re=await b({activeCtx:D,localCtx:fe,propagate:!0,overrideProtected:!0,options:k}));const ge=d(D,G,"@container")||[];if(ge.includes("@language")&&t(z)){const j=d(re,G,"@direction");U=F(re,z,j,k)}else if(ge.includes("@index")&&t(z)){const j=ge.includes("@graph"),W=d(re,G,"@index")||"@index",se=W!=="@index"&&c(D,W,{vocab:!0},k);U=await q({activeCtx:re,options:k,activeProperty:G,value:z,asGraph:j,indexKey:W,propertyIndex:se})}else if(ge.includes("@id")&&t(z)){const j=ge.includes("@graph");U=await q({activeCtx:re,options:k,activeProperty:G,value:z,asGraph:j,indexKey:"@id"})}else if(ge.includes("@type")&&t(z))U=await q({activeCtx:re.revertToPreviousContext(),options:k,activeProperty:G,value:z,asGraph:!1,indexKey:"@type"});else{const j=ee==="@list";if(j||ee==="@set"){let W=O;j&&te==="@graph"&&(W=null),U=await C.expand({activeCtx:re,activeProperty:W,element:z,options:k,insideList:j})}else d(D,G,"@type")==="@json"?U={"@type":"@json","@value":z}:U=await C.expand({activeCtx:re,activeProperty:G,element:z,options:k,insideList:!1})}if(!(U===null&&ee!=="@value")){if(ee!=="@list"&&!a(U)&&ge.includes("@list")&&(U={"@list":y(U)}),ge.includes("@graph")&&!ge.some(j=>j==="@id"||j==="@index")){if(U=y(U),k.isFrame||(U=U.filter(j=>{const W=Object.keys(j).length;return A({value:j,count:W,options:k})!==null})),U.length===0)continue;U=U.map(j=>({"@graph":y(j)}))}if(re.mappings.has(G)&&re.mappings.get(G).reverse){const j=Z["@reverse"]=Z["@reverse"]||{};U=y(U);for(let W=0;W<U.length;++W){const se=U[W];if(o(se)||a(se))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:U});S(j,ee,se,{propertyIsArray:!0})}continue}S(Z,ee,U,{propertyIsArray:!0})}}if("@value"in Z&&!(Z["@type"]==="@json"&&_(D,1.1))){if((t(ue)||e(ue))&&!k.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:ue})}for(const G of X){const z=e(T[G])?T[G]:[T[G]];for(const U of z){if(!t(U)||Object.keys(U).some(ee=>c(D,ee,{vocab:!0},k)==="@value"))throw new r("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:U});await B({activeCtx:D,activeProperty:O,expandedActiveProperty:te,element:U,expandedParent:Z,options:k,insideList:Y,typeScopedContext:H,typeKey:w})}}}function R({activeCtx:D,activeProperty:O,value:te,options:T}){if(te==null)return null;const Z=c(D,O,{vocab:!0},T);if(Z==="@id")return c(D,te,{base:!0},T);if(Z==="@type")return c(D,te,{vocab:!0,base:!0},{...T,typeExpansion:!0});const k=d(D,O,"@type");if((k==="@id"||Z==="@graph")&&i(te)){const w=c(D,te,{base:!0},T);return w===null&&te.match(v)&&T.eventHandler&&I({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:O}},options:T}),{"@id":w}}if(k==="@vocab"&&i(te))return{"@id":c(D,te,{vocab:!0,base:!0},T)};if(m(Z))return te;const Y={};if(k&&!["@id","@vocab","@none"].includes(k))Y["@type"]=k;else if(i(te)){const w=d(D,O,"@language");w!==null&&(Y["@language"]=w);const H=d(D,O,"@direction");H!==null&&(Y["@direction"]=H)}return["boolean","number","string"].includes(typeof te)||(te=te.toString()),Y["@value"]=te,Y}function F(D,O,te,T){const Z=[],k=Object.keys(O).sort();for(const Y of k){const w=c(D,Y,{vocab:!0},T);let H=O[Y];e(H)||(H=[H]);for(const K of H){if(K===null)continue;if(!i(K))throw new r("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:O});const X={"@value":K};w!=="@none"&&(Y.match(E)||T.eventHandler&&I({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:Y}},options:T}),X["@language"]=Y.toLowerCase()),te&&(X["@direction"]=te),Z.push(X)}}return Z}async function q({activeCtx:D,options:O,activeProperty:te,value:T,asGraph:Z,indexKey:k,propertyIndex:Y}){const w=[],H=Object.keys(T).sort(),K=k==="@type";for(let X of H){if(K){const G=d(D,X,"@context");s(G)||(D=await b({activeCtx:D,localCtx:G,propagate:!1,options:O}))}let ue=T[X];e(ue)||(ue=[ue]),ue=await C.expand({activeCtx:D,activeProperty:te,element:ue,options:O,insideList:!1,insideIndex:!0});let V;Y?X==="@none"?V="@none":V=R({activeCtx:D,activeProperty:k,value:X,options:O}):V=c(D,X,{vocab:!0},O),k==="@id"?X=c(D,X,{base:!0},O):K&&(X=V);for(let G of ue){if(Z&&!u(G)&&(G={"@graph":[G]}),k==="@type")V==="@none"||(G["@type"]?G["@type"]=[X].concat(G["@type"]):G["@type"]=[X]);else{if(o(G)&&!["@language","@type","@index"].includes(k))throw new r(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${k}".`,"jsonld.SyntaxError",{code:"invalid value object",value:G});Y?V!=="@none"&&S(G,Y,V,{propertyIsArray:!0,prependValue:!0}):V!=="@none"&&!(k in G)&&(G[k]=X)}w.push(G)}}return w}return Ns}var Is,Kl;function fi(){if(Kl)return Is;Kl=1;const{isKeyword:r}=ar(),e=$t(),t=ut(),n=dt(),i=ft(),s={};return Is=s,s.createMergedNodeMap=(a,o)=>{o=o||{};const u=o.issuer||new n.IdentifierIssuer("_:b"),l={"@default":{}};return s.createNodeMap(a,l,"@default",u),s.mergeNodeMaps(l)},s.createNodeMap=(a,o,u,l,c,d)=>{if(t.isArray(a)){for(const x of a)s.createNodeMap(x,o,u,l,void 0,d);return}if(!t.isObject(a)){d&&d.push(a);return}if(e.isValue(a)){if("@type"in a){let x=a["@type"];x.indexOf("_:")===0&&(a["@type"]=x=l.getId(x))}d&&d.push(a);return}else if(d&&e.isList(a)){const x=[];s.createNodeMap(a["@list"],o,u,l,c,x),d.push({"@list":x});return}if("@type"in a){const x=a["@type"];for(const E of x)E.indexOf("_:")===0&&l.getId(E)}t.isUndefined(c)&&(c=e.isBlankNode(a)?l.getId(a["@id"]):a["@id"]),d&&d.push({"@id":c});const m=o[u],b=m[c]=m[c]||{};b["@id"]=c;const _=Object.keys(a).sort();for(let x of _){if(x==="@id")continue;if(x==="@reverse"){const v={"@id":c},S=a["@reverse"];for(const y in S){const h=S[y];for(const g of h){let I=g["@id"];e.isBlankNode(g)&&(I=l.getId(I)),s.createNodeMap(g,o,u,l,I),n.addValue(m[I],y,v,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(x==="@graph"){c in o||(o[c]={}),s.createNodeMap(a[x],o,c,l);continue}if(x==="@included"){s.createNodeMap(a[x],o,u,l);continue}if(x!=="@type"&&r(x)){if(x==="@index"&&x in b&&(a[x]!==b[x]||a[x]["@id"]!==b[x]["@id"]))throw new i("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:b});b[x]=a[x];continue}const E=a[x];if(x.indexOf("_:")===0&&(x=l.getId(x)),E.length===0){n.addValue(b,x,[],{propertyIsArray:!0});continue}for(let v of E)if(x==="@type"&&(v=v.indexOf("_:")===0?l.getId(v):v),e.isSubject(v)||e.isSubjectReference(v)){if("@id"in v&&!v["@id"])continue;const S=e.isBlankNode(v)?l.getId(v["@id"]):v["@id"];n.addValue(b,x,{"@id":S},{propertyIsArray:!0,allowDuplicate:!1}),s.createNodeMap(v,o,u,l,S)}else if(e.isValue(v))n.addValue(b,x,v,{propertyIsArray:!0,allowDuplicate:!1});else if(e.isList(v)){const S=[];s.createNodeMap(v["@list"],o,u,l,c,S),v={"@list":S},n.addValue(b,x,v,{propertyIsArray:!0,allowDuplicate:!1})}else s.createNodeMap(v,o,u,l,c),n.addValue(b,x,v,{propertyIsArray:!0,allowDuplicate:!1})}},s.mergeNodeMapGraphs=a=>{const o={};for(const u of Object.keys(a).sort())for(const l of Object.keys(a[u]).sort()){const c=a[u][l];l in o||(o[l]={"@id":l});const d=o[l];for(const m of Object.keys(c).sort())if(r(m)&&m!=="@type")d[m]=n.clone(c[m]);else for(const b of c[m])n.addValue(d,m,n.clone(b),{propertyIsArray:!0,allowDuplicate:!1})}return o},s.mergeNodeMaps=a=>{const o=a["@default"],u=Object.keys(a).sort();for(const l of u){if(l==="@default")continue;const c=a[l];let d=o[l];d?"@graph"in d||(d["@graph"]=[]):o[l]=d={"@id":l,"@graph":[]};const m=d["@graph"];for(const b of Object.keys(c).sort()){const _=c[b];e.isSubjectReference(_)||m.push(_)}}return o},Is}var Rs,Yl;function Lf(){if(Yl)return Rs;Yl=1;const{isSubjectReference:r}=$t(),{createMergedNodeMap:e}=fi(),t={};return Rs=t,t.flatten=n=>{const i=e(n),s=[],a=Object.keys(i).sort();for(let o=0;o<a.length;++o){const u=i[a[o]];r(u)||s.push(u)}return s},Rs}var Ts,Zl;function Cf(){if(Zl)return Ts;Zl=1;const r=ft(),e=$t(),t=ut(),{REGEX_BCP47:n,addValue:i}=dt(),{handleEvent:s}=Nn(),{RDF_LIST:a,RDF_FIRST:o,RDF_REST:u,RDF_NIL:l,RDF_TYPE:c,RDF_JSON_LITERAL:d,XSD_BOOLEAN:m,XSD_DOUBLE:b,XSD_INTEGER:_,XSD_STRING:x}=Pa(),E={};Ts=E,E.fromRDF=async(S,y)=>{const{useRdfType:h=!1,useNativeTypes:g=!1,rdfDirection:I=null}=y,C={},A={"@default":C},B={};if(I){if(I==="compound-literal")throw new r("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:I});if(I!=="i18n-datatype")throw new r("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:I})}for(const q of S){const D=q.graph.termType==="DefaultGraph"?"@default":q.graph.value;D in A||(A[D]={}),D!=="@default"&&!(D in C)&&(C[D]={"@id":D});const O=A[D],te=q.subject.value,T=q.predicate.value,Z=q.object;te in O||(O[te]={"@id":te});const k=O[te],Y=Z.termType.endsWith("Node");if(Y&&!(Z.value in O)&&(O[Z.value]={"@id":Z.value}),T===c&&!h&&Y){i(k,"@type",Z.value,{propertyIsArray:!0});continue}const w=v(Z,g,I,y);if(i(k,T,w,{propertyIsArray:!0}),Y)if(Z.value===l){const H=O[Z.value];"usages"in H||(H.usages=[]),H.usages.push({node:k,property:T,value:w})}else Z.value in B?B[Z.value]=!1:B[Z.value]={node:k,property:T,value:w}}for(const q in A){const D=A[q];if(!(l in D))continue;const O=D[l];if(O.usages){for(let te of O.usages){let T=te.node,Z=te.property,k=te.value;const Y=[],w=[];let H=Object.keys(T).length;for(;Z===u&&t.isObject(B[T["@id"]])&&t.isArray(T[o])&&T[o].length===1&&t.isArray(T[u])&&T[u].length===1&&(H===3||H===4&&t.isArray(T["@type"])&&T["@type"].length===1&&T["@type"][0]===a)&&(Y.push(T[o][0]),w.push(T["@id"]),te=B[T["@id"]],T=te.node,Z=te.property,k=te.value,H=Object.keys(T).length,!!e.isBlankNode(T)););delete k["@id"],k["@list"]=Y.reverse();for(const K of w)delete D[K]}delete O.usages}}const R=[],F=Object.keys(C).sort();for(const q of F){const D=C[q];if(q in A){const O=D["@graph"]=[],te=A[q],T=Object.keys(te).sort();for(const Z of T){const k=te[Z];e.isSubjectReference(k)||O.push(k)}}e.isSubjectReference(D)||R.push(D)}return R};function v(S,y,h,g){if(S.termType.endsWith("Node"))return{"@id":S.value};const I={"@value":S.value};if(S.language)S.language.match(n)||g.eventHandler&&s({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:S.language}},options:g}),I["@language"]=S.language;else{let C=S.datatype.value;if(C||(C=x),C===d){C="@json";try{I["@value"]=JSON.parse(I["@value"])}catch(A){throw new r("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:I["@value"],cause:A})}}if(y){if(C===m)I["@value"]==="true"?I["@value"]=!0:I["@value"]==="false"&&(I["@value"]=!1);else if(t.isNumeric(I["@value"]))if(C===_){const A=parseInt(I["@value"],10);A.toFixed(0)===I["@value"]&&(I["@value"]=A)}else C===b&&(I["@value"]=parseFloat(I["@value"]));[m,_,b,x].includes(C)||(I["@type"]=C)}else if(h==="i18n-datatype"&&C.startsWith("https://www.w3.org/ns/i18n#")){const[,A,B]=C.split(/[#_]/);A.length>0&&(I["@language"]=A,A.match(n)||g.eventHandler&&s({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:A}},options:g})),I["@direction"]=B}else C!==x&&(I["@type"]=C)}return I}return Ts}var As,eu;function jf(){return eu||(eu=1,As=function r(e){return e===null||typeof e!="object"||e.toJSON!=null?JSON.stringify(e):Array.isArray(e)?"["+e.reduce((t,n,i)=>{const s=i===0?"":",",a=n===void 0||typeof n=="symbol"?null:n;return t+s+r(a)},"")+"]":"{"+Object.keys(e).sort().reduce((t,n,i)=>{if(e[n]===void 0||typeof e[n]=="symbol")return t;const s=t.length===0?"":",";return t+s+r(n)+":"+r(e[n])},"")+"}"}),As}var Ds,tu;function $f(){if(tu)return Ds;tu=1;const{createNodeMap:r}=fi(),{isKeyword:e}=ar(),t=$t(),n=jf(),i=ft(),s=ut(),a=dt(),{handleEvent:o}=Nn(),{RDF_FIRST:u,RDF_REST:l,RDF_NIL:c,RDF_TYPE:d,RDF_JSON_LITERAL:m,RDF_LANGSTRING:b,XSD_BOOLEAN:_,XSD_DOUBLE:x,XSD_INTEGER:E,XSD_STRING:v}=Pa(),{isAbsolute:S}=Gt(),y={};Ds=y,y.toRDF=(C,A)=>{const B=new a.IdentifierIssuer("_:b"),R={"@default":{}};r(C,R,"@default",B);const F=[],q=Object.keys(R).sort();for(const D of q){let O;if(D==="@default")O={termType:"DefaultGraph",value:""};else if(S(D))D.startsWith("_:")?O={termType:"BlankNode"}:O={termType:"NamedNode"},O.value=D;else{A.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative graph reference",level:"warning",message:"Relative graph reference found.",details:{graph:D}},options:A});continue}h(F,R[D],O,B,A)}return F};function h(C,A,B,R,F){const q=Object.keys(A).sort();for(const D of q){const O=A[D],te=Object.keys(O).sort();for(let T of te){const Z=O[T];if(T==="@type")T=d;else if(e(T))continue;for(const k of Z){const Y={termType:D.startsWith("_:")?"BlankNode":"NamedNode",value:D};if(!S(D)){F.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative subject reference",level:"warning",message:"Relative subject reference found.",details:{subject:D}},options:F});continue}const w={termType:T.startsWith("_:")?"BlankNode":"NamedNode",value:T};if(!S(T)){F.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative predicate reference",level:"warning",message:"Relative predicate reference found.",details:{predicate:T}},options:F});continue}if(w.termType==="BlankNode"&&!F.produceGeneralizedRdf){F.eventHandler&&o({event:{type:["JsonLdEvent"],code:"blank node predicate",level:"warning",message:"Dropping blank node predicate.",details:{property:R.getOldIds().find(K=>R.getId(K)===T)}},options:F});continue}const H=I(k,R,C,B,F.rdfDirection,F);H&&C.push({subject:Y,predicate:w,object:H,graph:B})}}}}function g(C,A,B,R,F,q){const D={termType:"NamedNode",value:u},O={termType:"NamedNode",value:l},te={termType:"NamedNode",value:c},T=C.pop(),Z=T?{termType:"BlankNode",value:A.getId()}:te;let k=Z;for(const Y of C){const w=I(Y,A,B,R,F,q),H={termType:"BlankNode",value:A.getId()};B.push({subject:k,predicate:D,object:w,graph:R}),B.push({subject:k,predicate:O,object:H,graph:R}),k=H}if(T){const Y=I(T,A,B,R,F,q);B.push({subject:k,predicate:D,object:Y,graph:R}),B.push({subject:k,predicate:O,object:te,graph:R})}return Z}function I(C,A,B,R,F,q){const D={};if(t.isValue(C)){D.termType="Literal",D.value=void 0,D.datatype={termType:"NamedNode"};let O=C["@value"];const te=C["@type"]||null;if(te==="@json")D.value=n(O),D.datatype.value=m;else if(s.isBoolean(O))D.value=O.toString(),D.datatype.value=te||_;else if(s.isDouble(O)||te===x)s.isDouble(O)||(O=parseFloat(O)),D.value=O.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),D.datatype.value=te||x;else if(s.isNumber(O))D.value=O.toFixed(0),D.datatype.value=te||E;else if("@direction"in C&&F==="i18n-datatype"){const T=(C["@language"]||"").toLowerCase(),Z=C["@direction"],k=`https://www.w3.org/ns/i18n#${T}_${Z}`;D.datatype.value=k,D.value=O}else{if("@direction"in C&&F==="compound-literal")throw new i("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:F});if("@direction"in C&&F)throw new i("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:F});"@language"in C?("@direction"in C&&!F&&q.eventHandler&&o({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:D.value}},options:q}),D.value=O,D.datatype.value=te||b,D.language=C["@language"]):("@direction"in C&&!F&&q.eventHandler&&o({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:D.value}},options:q}),D.value=O,D.datatype.value=te||v)}}else if(t.isList(C)){const O=g(C["@list"],A,B,R,F,q);D.termType=O.termType,D.value=O.value}else{const O=s.isObject(C)?C["@id"]:C;D.termType=O.startsWith("_:")?"BlankNode":"NamedNode",D.value=O}return D.termType==="NamedNode"&&!S(D.value)?(q.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative object reference",level:"warning",message:"Relative object reference found.",details:{object:D.value}},options:q}),null):D}return Ds}var Os,ru;function Ff(){if(ru)return Os;ru=1;const{isKeyword:r}=ar(),e=$t(),t=ut(),n=dt(),i=Gt(),s=ft(),{createNodeMap:a,mergeNodeMapGraphs:o}=fi(),u={};Os=u,u.frameMergedOrDefault=(h,g,I)=>{const C={options:I,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},A=new n.IdentifierIssuer("_:b");a(h,C.graphMap,"@default",A),I.merged&&(C.graphMap["@merged"]=o(C.graphMap),C.graph="@merged"),C.subjects=C.graphMap[C.graph];const B=[];u.frame(C,Object.keys(C.subjects).sort(),g,B),I.pruneBlankNodeIdentifiers&&(I.bnodesToClear=Object.keys(C.bnodeMap).filter(R=>C.bnodeMap[R].length===1));// remove @preserve from results
325
+ return I.link={},E(B,I)},u.frame=(h,g,I,C,A=null)=>{m(I),I=I[0];const B=h.options,R={embed:d(I,B,"embed"),explicit:d(I,B,"explicit"),requireAll:d(I,B,"requireAll")};h.link.hasOwnProperty(h.graph)||(h.link[h.graph]={});const F=h.link[h.graph],q=b(h,g,I,R),D=Object.keys(q).sort();for(const O of D){const te=q[O];if(A===null?h.uniqueEmbeds={[h.graph]:{}}:h.uniqueEmbeds[h.graph]=h.uniqueEmbeds[h.graph]||{},R.embed==="@link"&&O in F){v(C,A,F[O]);continue}const T={"@id":O};if(O.indexOf("_:")===0&&n.addValue(h.bnodeMap,O,T,{propertyIsArray:!0}),F[O]=T,(R.embed==="@first"||R.embed==="@last")&&h.is11)throw new s("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:I});if(!(!h.embedded&&h.uniqueEmbeds[h.graph].hasOwnProperty(O))){if(h.embedded&&(R.embed==="@never"||c(te,h.graph,h.subjectStack))){v(C,A,T);continue}if(h.embedded&&(R.embed=="@first"||R.embed=="@once")&&h.uniqueEmbeds[h.graph].hasOwnProperty(O)){v(C,A,T);continue}if(R.embed==="@last"&&O in h.uniqueEmbeds[h.graph]&&x(h,O),h.uniqueEmbeds[h.graph][O]={parent:C,property:A},h.subjectStack.push({subject:te,graph:h.graph}),O in h.graphMap){let Z=!1,k=null;"@graph"in I?(k=I["@graph"][0],Z=!(O==="@merged"||O==="@default"),t.isObject(k)||(k={})):(Z=h.graph!=="@merged",k={}),Z&&u.frame({...h,graph:O,embedded:!1},Object.keys(h.graphMap[O]).sort(),[k],T,"@graph")}"@included"in I&&u.frame({...h,embedded:!1},g,I["@included"],T,"@included");for(const Z of Object.keys(te).sort()){if(r(Z)){if(T[Z]=n.clone(te[Z]),Z==="@type")for(const k of te["@type"])k.indexOf("_:")===0&&n.addValue(h.bnodeMap,k,T,{propertyIsArray:!0});continue}if(!(R.explicit&&!(Z in I)))for(const k of te[Z]){const Y=Z in I?I[Z]:l(R);if(e.isList(k)){const w=I[Z]&&I[Z][0]&&I[Z][0]["@list"]?I[Z][0]["@list"]:l(R),H={"@list":[]};v(T,Z,H);const K=k["@list"];for(const X of K)e.isSubjectReference(X)?u.frame({...h,embedded:!0},[X["@id"]],w,H,"@list"):v(H,"@list",n.clone(X))}else e.isSubjectReference(k)?u.frame({...h,embedded:!0},[k["@id"]],Y,T,Z):y(Y[0],k)&&v(T,Z,n.clone(k))}}for(const Z of Object.keys(I).sort()){if(Z==="@type"){if(!t.isObject(I[Z][0])||!("@default"in I[Z][0]))continue}else if(r(Z))continue;const k=I[Z][0]||{};if(!d(k,B,"omitDefault")&&!(Z in T)){let w="@null";"@default"in k&&(w=n.clone(k["@default"])),t.isArray(w)||(w=[w]),T[Z]=[{"@preserve":w}]}}for(const Z of Object.keys(I["@reverse"]||{}).sort()){const k=I["@reverse"][Z];for(const Y of Object.keys(h.subjects))n.getValues(h.subjects[Y],Z).some(H=>H["@id"]===O)&&(T["@reverse"]=T["@reverse"]||{},n.addValue(T["@reverse"],Z,[],{propertyIsArray:!0}),u.frame({...h,embedded:!0},[Y],k,T["@reverse"][Z],A))}v(C,A,T),h.subjectStack.pop()}}},u.cleanupNull=(h,g)=>{if(t.isArray(h))return h.map(C=>u.cleanupNull(C,g)).filter(C=>C);if(h==="@null")return null;if(t.isObject(h)){if("@id"in h){const I=h["@id"];if(g.link.hasOwnProperty(I)){const C=g.link[I].indexOf(h);if(C!==-1)return g.link[I][C];g.link[I].push(h)}else g.link[I]=[h]}for(const I in h)h[I]=u.cleanupNull(h[I],g)}return h};function l(h){const g={};for(const I in h)h[I]!==void 0&&(g["@"+I]=[h[I]]);return[g]}function c(h,g,I){for(let C=I.length-1;C>=0;--C){const A=I[C];if(A.graph===g&&A.subject["@id"]===h["@id"])return!0}return!1}function d(h,g,I){const C="@"+I;let A=C in h?h[C][0]:g[I];if(I==="embed"){if(A===!0)A="@once";else if(A===!1)A="@never";else if(A!=="@always"&&A!=="@never"&&A!=="@link"&&A!=="@first"&&A!=="@last"&&A!=="@once")throw new s("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:h})}return A}function m(h){if(!t.isArray(h)||h.length!==1||!t.isObject(h[0]))throw new s("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:h});if("@id"in h[0]){for(const g of n.asArray(h[0]["@id"]))if(!(t.isObject(g)||i.isAbsolute(g))||t.isString(g)&&g.indexOf("_:")===0)throw new s("Invalid JSON-LD syntax; invalid @id in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:h})}if("@type"in h[0]){for(const g of n.asArray(h[0]["@type"]))if(!(t.isObject(g)||i.isAbsolute(g)||g==="@json")||t.isString(g)&&g.indexOf("_:")===0)throw new s("Invalid JSON-LD syntax; invalid @type in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:h})}}function b(h,g,I,C){const A={};for(const B of g){const R=h.graphMap[h.graph][B];_(h,R,I,C)&&(A[B]=R)}return A}function _(h,g,I,C){let A=!0,B=!1;for(const R in I){let F=!1;const q=n.getValues(g,R),D=n.getValues(I,R).length===0;if(R==="@id"){if(t.isEmptyObject(I["@id"][0]||{})?F=!0:I["@id"].length>=0&&(F=I["@id"].includes(q[0])),!C.requireAll)return F}else if(R==="@type"){if(A=!1,D){if(q.length>0)return!1;F=!0}else if(I["@type"].length===1&&t.isEmptyObject(I["@type"][0]))F=q.length>0;else for(const O of I["@type"])t.isObject(O)&&"@default"in O?F=!0:F=F||q.some(te=>te===O);if(!C.requireAll)return F}else{if(r(R))continue;{const O=n.getValues(I,R)[0];let te=!1;if(O&&(m([O]),te="@default"in O),A=!1,q.length===0&&te)continue;if(q.length>0&&D)return!1;if(O===void 0){if(q.length>0)return!1;F=!0}else if(e.isList(O)){const T=O["@list"][0];if(e.isList(q[0])){const Z=q[0]["@list"];e.isValue(T)?F=Z.some(k=>y(T,k)):(e.isSubject(T)||e.isSubjectReference(T))&&(F=Z.some(k=>S(h,T,k,C)))}}else e.isValue(O)?F=q.some(T=>y(O,T)):e.isSubjectReference(O)?F=q.some(T=>S(h,O,T,C)):t.isObject(O)?F=q.length>0:F=!1}}if(!F&&C.requireAll)return!1;B=B||F}return A||B}function x(h,g){const I=h.uniqueEmbeds[h.graph],C=I[g],A=C.parent,B=C.property,R={"@id":g};if(t.isArray(A)){for(let q=0;q<A.length;++q)if(n.compareValues(A[q],R)){A[q]=R;break}}else{const q=t.isArray(A[B]);n.removeValue(A,B,R,{propertyIsArray:q}),n.addValue(A,B,R,{propertyIsArray:q})}const F=q=>{const D=Object.keys(I);for(const O of D)O in I&&t.isObject(I[O].parent)&&I[O].parent["@id"]===q&&(delete I[O],F(O))};F(g)}/**
300
326
  * Removes the @preserve keywords from expanded result of framing.
301
327
  *
302
328
  * @param input the framed, framed output.
303
329
  * @param options the framing options used.
304
330
  *
305
331
  * @return the resulting output.
306
- */function x(c,p){if(t.isArray(c))return c.map(N=>x(N,p));if(t.isObject(c)){// remove @preserve
307
- if("@preserve"in c)return c["@preserve"][0];if(e.isValue(c))return c;if(e.isList(c))return c["@list"]=x(c["@list"],p),c;if("@id"in c){const N=c["@id"];if(p.link.hasOwnProperty(N)){const D=p.link[N].indexOf(c);if(D!==-1)return p.link[N][D];p.link[N].push(c)}else p.link[N]=[c]}for(const N in c){if(N==="@id"&&p.bnodesToClear.includes(c[N])){delete c["@id"];continue}c[N]=x(c[N],p)}}return c}function S(c,p,N){t.isObject(c)?n.addValue(c,p,N,{propertyIsArray:!0}):c.push(N)}function I(c,p,N,D){if(!("@id"in N))return!1;const T=c.subjects[N["@id"]];return T&&m(c,T,p,D)}function b(c,p){const N=p["@value"],D=p["@type"],T=p["@language"],q=c["@value"]?t.isArray(c["@value"])?c["@value"]:[c["@value"]]:[],R=c["@type"]?t.isArray(c["@type"])?c["@type"]:[c["@type"]]:[],M=c["@language"]?t.isArray(c["@language"])?c["@language"]:[c["@language"]]:[];return q.length===0&&R.length===0&&M.length===0?!0:!(!(q.includes(N)||t.isEmptyObject(q[0]))||!(!D&&R.length===0||R.includes(D)||D&&t.isEmptyObject(R[0]))||!(!T&&M.length===0||M.includes(T)||T&&t.isEmptyObject(M[0])))}return ts}var rs,gl;function Gf(){if(gl)return rs;gl=1;const r=rt(),{isArray:e,isObject:t,isString:n,isUndefined:i}=Ke(),{isList:s,isValue:a,isGraph:o,isSimpleGraph:l,isSubjectReference:d}=_t(),{expandIri:h,getContextValue:y,isKeyword:w,process:g,processingMode:m}=Ut(),{removeBase:_,prependBase:x}=At(),{REGEX_KEYWORD:S,addValue:I,asArray:b,compareShortestLeast:c}=et(),p={};rs=p,p.compact=async({activeCtx:T,activeProperty:q=null,element:R,options:M={}})=>{if(e(R)){let A=[];for(let j=0;j<R.length;++j){const Y=await p.compact({activeCtx:T,activeProperty:q,element:R[j],options:M});Y!==null&&A.push(Y)}return M.compactArrays&&A.length===1&&(y(T,q,"@container")||[]).length===0&&(A=A[0]),A}const B=y(T,q,"@context");if(i(B)||(T=await g({activeCtx:T,localCtx:B,propagate:!0,overrideProtected:!0,options:M})),t(R)){if(M.link&&"@id"in R&&M.link.hasOwnProperty(R["@id"])){const v=M.link[R["@id"]];for(let U=0;U<v.length;++U)if(v[U].expanded===R)return v[U].compacted}if(a(R)||d(R)){const v=p.compactValue({activeCtx:T,activeProperty:q,value:R,options:M});return M.link&&d(R)&&(M.link.hasOwnProperty(R["@id"])||(M.link[R["@id"]]=[]),M.link[R["@id"]].push({expanded:R,compacted:v})),v}if(s(R)&&(y(T,q,"@container")||[]).includes("@list"))return p.compact({activeCtx:T,activeProperty:q,element:R["@list"],options:M});const A=q==="@reverse",j={},Y=T;!a(R)&&!d(R)&&(T=T.revertToPreviousContext());const L=y(Y,q,"@context");i(L)||(T=await g({activeCtx:T,localCtx:L,propagate:!0,overrideProtected:!0,options:M})),M.link&&"@id"in R&&(M.link.hasOwnProperty(R["@id"])||(M.link[R["@id"]]=[]),M.link[R["@id"]].push({expanded:R,compacted:j}));let ee=R["@type"]||[];ee.length>1&&(ee=Array.from(ee).sort());const C=T;for(const v of ee){const U=p.compactIri({activeCtx:C,iri:v,relativeTo:{vocab:!0}}),Q=y(Y,U,"@context");i(Q)||(T=await g({activeCtx:T,localCtx:Q,options:M,propagate:!1}))}const K=Object.keys(R).sort();for(const v of K){const U=R[v];if(v==="@id"){let Q=b(U).map(ae=>p.compactIri({activeCtx:T,iri:ae,relativeTo:{vocab:!1},base:M.base}));Q.length===1&&(Q=Q[0]);const z=p.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}});j[z]=Q;continue}if(v==="@type"){let Q=b(U).map(W=>p.compactIri({activeCtx:Y,iri:W,relativeTo:{vocab:!0}}));Q.length===1&&(Q=Q[0]);const z=p.compactIri({activeCtx:T,iri:"@type",relativeTo:{vocab:!0}}),V=(y(T,z,"@container")||[]).includes("@set")&&m(T,1.1)||e(Q)&&U.length===0;I(j,z,Q,{propertyIsArray:V});continue}if(v==="@reverse"){const Q=await p.compact({activeCtx:T,activeProperty:"@reverse",element:U,options:M});for(const z in Q)if(T.mappings.has(z)&&T.mappings.get(z).reverse){const ae=Q[z],V=(y(T,z,"@container")||[]).includes("@set")||!M.compactArrays;I(j,z,ae,{propertyIsArray:V}),delete Q[z]}if(Object.keys(Q).length>0){const z=p.compactIri({activeCtx:T,iri:v,relativeTo:{vocab:!0}});I(j,z,Q)}continue}if(v==="@preserve"){const Q=await p.compact({activeCtx:T,activeProperty:q,element:U,options:M});e(Q)&&Q.length===0||I(j,v,Q);continue}if(v==="@index"){if((y(T,q,"@container")||[]).includes("@index"))continue;const z=p.compactIri({activeCtx:T,iri:v,relativeTo:{vocab:!0}});I(j,z,U);continue}if(v!=="@graph"&&v!=="@list"&&v!=="@included"&&w(v)){const Q=p.compactIri({activeCtx:T,iri:v,relativeTo:{vocab:!0}});I(j,Q,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 Q=p.compactIri({activeCtx:T,iri:v,value:U,relativeTo:{vocab:!0},reverse:A}),z=T.mappings.has(Q)?T.mappings.get(Q)["@nest"]:null;let ae=j;z&&(D(T,z,M),t(j[z])||(j[z]={}),ae=j[z]),I(ae,Q,U,{propertyIsArray:!0})}for(const Q of U){const z=p.compactIri({activeCtx:T,iri:v,value:Q,relativeTo:{vocab:!0},reverse:A}),ae=T.mappings.has(z)?T.mappings.get(z)["@nest"]:null;let H=j;ae&&(D(T,ae,M),t(j[ae])||(j[ae]={}),H=j[ae]);const V=y(T,z,"@container")||[],W=o(Q),F=s(Q);let Z;F?Z=Q["@list"]:W&&(Z=Q["@graph"]);let te=await p.compact({activeCtx:T,activeProperty:z,element:F||W?Z:Q,options:M});if(F)if(e(te)||(te=[te]),!V.includes("@list"))te={[p.compactIri({activeCtx:T,iri:"@list",relativeTo:{vocab:!0}})]:te},"@index"in Q&&(te[p.compactIri({activeCtx:T,iri:"@index",relativeTo:{vocab:!0}})]=Q["@index"]);else{I(H,z,te,{valueIsArray:!0,allowDuplicate:!0});continue}if(W)if(V.includes("@graph")&&(V.includes("@id")||V.includes("@index")&&l(Q))){let ce;H.hasOwnProperty(z)?ce=H[z]:H[z]=ce={};const fe=(V.includes("@id")?Q["@id"]:Q["@index"])||p.compactIri({activeCtx:T,iri:"@none",relativeTo:{vocab:!0}});I(ce,fe,te,{propertyIsArray:!M.compactArrays||V.includes("@set")})}else V.includes("@graph")&&l(Q)?(e(te)&&te.length>1&&(te={"@included":te}),I(H,z,te,{propertyIsArray:!M.compactArrays||V.includes("@set")})):(e(te)&&te.length===1&&M.compactArrays&&(te=te[0]),te={[p.compactIri({activeCtx:T,iri:"@graph",relativeTo:{vocab:!0}})]:te},"@id"in Q&&(te[p.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}})]=Q["@id"]),"@index"in Q&&(te[p.compactIri({activeCtx:T,iri:"@index",relativeTo:{vocab:!0}})]=Q["@index"]),I(H,z,te,{propertyIsArray:!M.compactArrays||V.includes("@set")}));else if(V.includes("@language")||V.includes("@index")||V.includes("@id")||V.includes("@type")){let ce;H.hasOwnProperty(z)?ce=H[z]:H[z]=ce={};let fe;if(V.includes("@language"))a(te)&&(te=te["@value"]),fe=Q["@language"];else if(V.includes("@index")){const O=y(T,z,"@index")||"@index",G=p.compactIri({activeCtx:T,iri:O,relativeTo:{vocab:!0}});if(O==="@index")fe=Q["@index"],delete te[G];else{let re;if([fe,...re]=b(te[O]||[]),!n(fe))fe=null;else switch(re.length){case 0:delete te[O];break;case 1:te[O]=re[0];break;default:te[O]=re;break}}}else if(V.includes("@id")){const O=p.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}});fe=te[O],delete te[O]}else if(V.includes("@type")){const O=p.compactIri({activeCtx:T,iri:"@type",relativeTo:{vocab:!0}});let G;switch([fe,...G]=b(te[O]||[]),G.length){case 0:delete te[O];break;case 1:te[O]=G[0];break;default:te[O]=G;break}Object.keys(te).length===1&&"@id"in Q&&(te=await p.compact({activeCtx:T,activeProperty:z,element:{"@id":Q["@id"]},options:M}))}fe||(fe=p.compactIri({activeCtx:T,iri:"@none",relativeTo:{vocab:!0}})),I(ce,fe,te,{propertyIsArray:V.includes("@set")})}else{const ce=!M.compactArrays||V.includes("@set")||V.includes("@list")||e(te)&&te.length===0||v==="@list"||v==="@graph";I(H,z,te,{propertyIsArray:ce})}}}return j}return R},p.compactIri=({activeCtx:T,iri:q,value:R=null,relativeTo:M={vocab:!1},reverse:B=!1,base:A=null})=>{if(q===null)return q;T.isPropertyTermScoped&&T.previousContext&&(T=T.previousContext);const j=T.getInverse();if(w(q)&&q in j&&"@none"in j[q]&&"@type"in j[q]["@none"]&&"@none"in j[q]["@none"]["@type"])return j[q]["@none"]["@type"]["@none"];if(M.vocab&&q in j){const K=T["@language"]||"@none",v=[];t(R)&&"@index"in R&&!("@graph"in R)&&v.push("@index","@index@set"),t(R)&&"@preserve"in R&&(R=R["@preserve"][0]),o(R)?("@index"in R&&v.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in R&&v.push("@graph@id","@graph@id@set"),v.push("@graph","@graph@set","@set"),"@index"in R||v.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in R||v.push("@graph@id","@graph@id@set")):t(R)&&!a(R)&&v.push("@id","@id@set","@type","@set@type");let U="@language",Q="@null";if(B)U="@type",Q="@reverse",v.push("@set");else if(s(R)){"@index"in R||v.push("@list");const ae=R["@list"];if(ae.length===0)U="@any",Q="@none";else{let H=ae.length===0?K:null,V=null;for(let W=0;W<ae.length;++W){const F=ae[W];let Z="@none",te="@none";if(a(F))if("@direction"in F){const ce=(F["@language"]||"").toLowerCase(),fe=F["@direction"];Z=`${ce}_${fe}`}else"@language"in F?Z=F["@language"].toLowerCase():"@type"in F?te=F["@type"]:Z="@null";else te="@id";if(H===null?H=Z:Z!==H&&a(F)&&(H="@none"),V===null?V=te:te!==V&&(V="@none"),H==="@none"&&V==="@none")break}H=H||"@none",V=V||"@none",V!=="@none"?(U="@type",Q=V):Q=H}}else{if(a(R))if("@language"in R&&!("@index"in R)){v.push("@language","@language@set"),Q=R["@language"];const ae=R["@direction"];ae&&(Q=`${Q}_${ae}`)}else"@direction"in R&&!("@index"in R)?Q=`_${R["@direction"]}`:"@type"in R&&(U="@type",Q=R["@type"]);else U="@type",Q="@id";v.push("@set")}v.push("@none"),t(R)&&!("@index"in R)&&v.push("@index","@index@set"),a(R)&&Object.keys(R).length===1&&v.push("@language","@language@set");const z=N(T,q,R,v,U,Q);if(z!==null)return z}if(M.vocab&&"@vocab"in T){const K=T["@vocab"];if(q.indexOf(K)===0&&q!==K){const v=q.substr(K.length);if(!T.mappings.has(v))return v}}let Y=null;const L=[];let ee=T.fastCurieMap;const C=q.length-1;for(let K=0;K<C&&q[K]in ee;++K)ee=ee[q[K]],""in ee&&L.push(ee[""][0]);for(let K=L.length-1;K>=0;--K){const v=L[K],U=v.terms;for(const Q of U){const z=Q+":"+q.substr(v.iri.length);T.mappings.get(Q)._prefix&&(!T.mappings.has(z)||R===null&&T.mappings.get(z)["@id"]===q)&&(Y===null||c(z,Y)<0)&&(Y=z)}}if(Y!==null)return Y;for(const[K,v]of T.mappings)if(v&&v._prefix&&q.startsWith(K+":"))throw new r(`Absolute IRI "${q}" confused with prefix "${K}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:T});if(!M.vocab)if("@base"in T)if(T["@base"]){const K=_(x(A,T["@base"]),q);return S.test(K)?`./${K}`:K}else return q;else return _(A,q);return q},p.compactValue=({activeCtx:T,activeProperty:q,value:R,options:M})=>{if(a(R)){const Y=y(T,q,"@type"),L=y(T,q,"@language"),ee=y(T,q,"@direction"),C=y(T,q,"@container")||[],K="@index"in R&&!C.includes("@index");if(!K&&Y!=="@none"&&(R["@type"]===Y||"@language"in R&&R["@language"]===L&&"@direction"in R&&R["@direction"]===ee||"@language"in R&&R["@language"]===L||"@direction"in R&&R["@direction"]===ee))return R["@value"];const v=Object.keys(R).length,U=v===1||v===2&&"@index"in R&&!K,Q="@language"in T,z=n(R["@value"]),ae=T.mappings.has(q)&&T.mappings.get(q)["@language"]===null;if(U&&Y!=="@none"&&(!Q||!z||ae))return R["@value"];const H={};return K&&(H[p.compactIri({activeCtx:T,iri:"@index",relativeTo:{vocab:!0}})]=R["@index"]),"@type"in R?H[p.compactIri({activeCtx:T,iri:"@type",relativeTo:{vocab:!0}})]=p.compactIri({activeCtx:T,iri:R["@type"],relativeTo:{vocab:!0}}):"@language"in R&&(H[p.compactIri({activeCtx:T,iri:"@language",relativeTo:{vocab:!0}})]=R["@language"]),"@direction"in R&&(H[p.compactIri({activeCtx:T,iri:"@direction",relativeTo:{vocab:!0}})]=R["@direction"]),H[p.compactIri({activeCtx:T,iri:"@value",relativeTo:{vocab:!0}})]=R["@value"],H}const B=h(T,q,{vocab:!0},M),A=y(T,q,"@type"),j=p.compactIri({activeCtx:T,iri:R["@id"],relativeTo:{vocab:A==="@vocab"},base:M.base});return A==="@id"||A==="@vocab"||B==="@graph"?j:{[p.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}})]:j}};function N(T,q,R,M,B,A){A===null&&(A="@null");const j=[];if((A==="@id"||A==="@reverse")&&t(R)&&"@id"in R){A==="@reverse"&&j.push("@reverse");const L=p.compactIri({activeCtx:T,iri:R["@id"],relativeTo:{vocab:!0}});T.mappings.has(L)&&T.mappings.get(L)&&T.mappings.get(L)["@id"]===R["@id"]?j.push.apply(j,["@vocab","@id"]):j.push.apply(j,["@id","@vocab"])}else{j.push(A);const L=j.find(ee=>ee.includes("_"));L&&j.push(L.replace(/^[^_]+_/,"_"))}j.push("@none");const Y=T.inverse[q];for(const L of M){if(!(L in Y))continue;const ee=Y[L][B];for(const C of j)if(C in ee)return ee[C]}return null}function D(T,q,R){if(h(T,q,{vocab:!0},R)!=="@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 rs}var ns,yl;function Wf(){return yl||(yl=1,ns=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,n){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):r.compact(t,n)},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}),ns}/**
332
+ */function E(h,g){if(t.isArray(h))return h.map(I=>E(I,g));if(t.isObject(h)){// remove @preserve
333
+ if("@preserve"in h)return h["@preserve"][0];if(e.isValue(h))return h;if(e.isList(h))return h["@list"]=E(h["@list"],g),h;if("@id"in h){const I=h["@id"];if(g.link.hasOwnProperty(I)){const C=g.link[I].indexOf(h);if(C!==-1)return g.link[I][C];g.link[I].push(h)}else g.link[I]=[h]}for(const I in h){if(I==="@id"&&g.bnodesToClear.includes(h[I])){delete h["@id"];continue}h[I]=E(h[I],g)}}return h}function v(h,g,I){t.isObject(h)?n.addValue(h,g,I,{propertyIsArray:!0}):h.push(I)}function S(h,g,I,C){if(!("@id"in I))return!1;const A=h.subjects[I["@id"]];return A&&_(h,A,g,C)}function y(h,g){const I=g["@value"],C=g["@type"],A=g["@language"],B=h["@value"]?t.isArray(h["@value"])?h["@value"]:[h["@value"]]:[],R=h["@type"]?t.isArray(h["@type"])?h["@type"]:[h["@type"]]:[],F=h["@language"]?t.isArray(h["@language"])?h["@language"]:[h["@language"]]:[];return B.length===0&&R.length===0&&F.length===0?!0:!(!(B.includes(I)||t.isEmptyObject(B[0]))||!(!C&&R.length===0||R.includes(C)||C&&t.isEmptyObject(R[0]))||!(!A&&F.length===0||F.includes(A)||A&&t.isEmptyObject(F[0])))}return Os}var Ls,nu;function kf(){if(nu)return Ls;nu=1;const r=ft(),{isArray:e,isObject:t,isString:n,isUndefined:i}=ut(),{isList:s,isValue:a,isGraph:o,isSimpleGraph:u,isSubjectReference:l}=$t(),{expandIri:c,getContextValue:d,isKeyword:m,process:b,processingMode:_}=ar(),{removeBase:x,prependBase:E}=Gt(),{REGEX_KEYWORD:v,addValue:S,asArray:y,compareShortestLeast:h}=dt(),g={};Ls=g,g.compact=async({activeCtx:A,activeProperty:B=null,element:R,options:F={}})=>{if(e(R)){let D=[];for(let O=0;O<R.length;++O){const te=await g.compact({activeCtx:A,activeProperty:B,element:R[O],options:F});te!==null&&D.push(te)}return F.compactArrays&&D.length===1&&(d(A,B,"@container")||[]).length===0&&(D=D[0]),D}const q=d(A,B,"@context");if(i(q)||(A=await b({activeCtx:A,localCtx:q,propagate:!0,overrideProtected:!0,options:F})),t(R)){if(F.link&&"@id"in R&&F.link.hasOwnProperty(R["@id"])){const w=F.link[R["@id"]];for(let H=0;H<w.length;++H)if(w[H].expanded===R)return w[H].compacted}if(a(R)||l(R)){const w=g.compactValue({activeCtx:A,activeProperty:B,value:R,options:F});return F.link&&l(R)&&(F.link.hasOwnProperty(R["@id"])||(F.link[R["@id"]]=[]),F.link[R["@id"]].push({expanded:R,compacted:w})),w}if(s(R)&&(d(A,B,"@container")||[]).includes("@list"))return g.compact({activeCtx:A,activeProperty:B,element:R["@list"],options:F});const D=B==="@reverse",O={},te=A;!a(R)&&!l(R)&&(A=A.revertToPreviousContext());const T=d(te,B,"@context");i(T)||(A=await b({activeCtx:A,localCtx:T,propagate:!0,overrideProtected:!0,options:F})),F.link&&"@id"in R&&(F.link.hasOwnProperty(R["@id"])||(F.link[R["@id"]]=[]),F.link[R["@id"]].push({expanded:R,compacted:O}));let Z=R["@type"]||[];Z.length>1&&(Z=Array.from(Z).sort());const k=A;for(const w of Z){const H=g.compactIri({activeCtx:k,iri:w,relativeTo:{vocab:!0}}),K=d(te,H,"@context");i(K)||(A=await b({activeCtx:A,localCtx:K,options:F,propagate:!1}))}const Y=Object.keys(R).sort();for(const w of Y){const H=R[w];if(w==="@id"){let K=y(H).map(ue=>g.compactIri({activeCtx:A,iri:ue,relativeTo:{vocab:!1},base:F.base}));K.length===1&&(K=K[0]);const X=g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}});O[X]=K;continue}if(w==="@type"){let K=y(H).map(z=>g.compactIri({activeCtx:te,iri:z,relativeTo:{vocab:!0}}));K.length===1&&(K=K[0]);const X=g.compactIri({activeCtx:A,iri:"@type",relativeTo:{vocab:!0}}),G=(d(A,X,"@container")||[]).includes("@set")&&_(A,1.1)||e(K)&&H.length===0;S(O,X,K,{propertyIsArray:G});continue}if(w==="@reverse"){const K=await g.compact({activeCtx:A,activeProperty:"@reverse",element:H,options:F});for(const X in K)if(A.mappings.has(X)&&A.mappings.get(X).reverse){const ue=K[X],G=(d(A,X,"@container")||[]).includes("@set")||!F.compactArrays;S(O,X,ue,{propertyIsArray:G}),delete K[X]}if(Object.keys(K).length>0){const X=g.compactIri({activeCtx:A,iri:w,relativeTo:{vocab:!0}});S(O,X,K)}continue}if(w==="@preserve"){const K=await g.compact({activeCtx:A,activeProperty:B,element:H,options:F});e(K)&&K.length===0||S(O,w,K);continue}if(w==="@index"){if((d(A,B,"@container")||[]).includes("@index"))continue;const X=g.compactIri({activeCtx:A,iri:w,relativeTo:{vocab:!0}});S(O,X,H);continue}if(w!=="@graph"&&w!=="@list"&&w!=="@included"&&m(w)){const K=g.compactIri({activeCtx:A,iri:w,relativeTo:{vocab:!0}});S(O,K,H);continue}if(!e(H))throw new r("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(H.length===0){const K=g.compactIri({activeCtx:A,iri:w,value:H,relativeTo:{vocab:!0},reverse:D}),X=A.mappings.has(K)?A.mappings.get(K)["@nest"]:null;let ue=O;X&&(C(A,X,F),t(O[X])||(O[X]={}),ue=O[X]),S(ue,K,H,{propertyIsArray:!0})}for(const K of H){const X=g.compactIri({activeCtx:A,iri:w,value:K,relativeTo:{vocab:!0},reverse:D}),ue=A.mappings.has(X)?A.mappings.get(X)["@nest"]:null;let V=O;ue&&(C(A,ue,F),t(O[ue])||(O[ue]={}),V=O[ue]);const G=d(A,X,"@container")||[],z=o(K),U=s(K);let ee;U?ee=K["@list"]:z&&(ee=K["@graph"]);let re=await g.compact({activeCtx:A,activeProperty:X,element:U||z?ee:K,options:F});if(U)if(e(re)||(re=[re]),!G.includes("@list"))re={[g.compactIri({activeCtx:A,iri:"@list",relativeTo:{vocab:!0}})]:re},"@index"in K&&(re[g.compactIri({activeCtx:A,iri:"@index",relativeTo:{vocab:!0}})]=K["@index"]);else{S(V,X,re,{valueIsArray:!0,allowDuplicate:!0});continue}if(z)if(G.includes("@graph")&&(G.includes("@id")||G.includes("@index")&&u(K))){let fe;V.hasOwnProperty(X)?fe=V[X]:V[X]=fe={};const ge=(G.includes("@id")?K["@id"]:K["@index"])||g.compactIri({activeCtx:A,iri:"@none",relativeTo:{vocab:!0}});S(fe,ge,re,{propertyIsArray:!F.compactArrays||G.includes("@set")})}else G.includes("@graph")&&u(K)?(e(re)&&re.length>1&&(re={"@included":re}),S(V,X,re,{propertyIsArray:!F.compactArrays||G.includes("@set")})):(e(re)&&re.length===1&&F.compactArrays&&(re=re[0]),re={[g.compactIri({activeCtx:A,iri:"@graph",relativeTo:{vocab:!0}})]:re},"@id"in K&&(re[g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}})]=K["@id"]),"@index"in K&&(re[g.compactIri({activeCtx:A,iri:"@index",relativeTo:{vocab:!0}})]=K["@index"]),S(V,X,re,{propertyIsArray:!F.compactArrays||G.includes("@set")}));else if(G.includes("@language")||G.includes("@index")||G.includes("@id")||G.includes("@type")){let fe;V.hasOwnProperty(X)?fe=V[X]:V[X]=fe={};let ge;if(G.includes("@language"))a(re)&&(re=re["@value"]),ge=K["@language"];else if(G.includes("@index")){const j=d(A,X,"@index")||"@index",W=g.compactIri({activeCtx:A,iri:j,relativeTo:{vocab:!0}});if(j==="@index")ge=K["@index"],delete re[W];else{let se;if([ge,...se]=y(re[j]||[]),!n(ge))ge=null;else switch(se.length){case 0:delete re[j];break;case 1:re[j]=se[0];break;default:re[j]=se;break}}}else if(G.includes("@id")){const j=g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}});ge=re[j],delete re[j]}else if(G.includes("@type")){const j=g.compactIri({activeCtx:A,iri:"@type",relativeTo:{vocab:!0}});let W;switch([ge,...W]=y(re[j]||[]),W.length){case 0:delete re[j];break;case 1:re[j]=W[0];break;default:re[j]=W;break}Object.keys(re).length===1&&"@id"in K&&(re=await g.compact({activeCtx:A,activeProperty:X,element:{"@id":K["@id"]},options:F}))}ge||(ge=g.compactIri({activeCtx:A,iri:"@none",relativeTo:{vocab:!0}})),S(fe,ge,re,{propertyIsArray:G.includes("@set")})}else{const fe=!F.compactArrays||G.includes("@set")||G.includes("@list")||e(re)&&re.length===0||w==="@list"||w==="@graph";S(V,X,re,{propertyIsArray:fe})}}}return O}return R},g.compactIri=({activeCtx:A,iri:B,value:R=null,relativeTo:F={vocab:!1},reverse:q=!1,base:D=null})=>{if(B===null)return B;A.isPropertyTermScoped&&A.previousContext&&(A=A.previousContext);const O=A.getInverse();if(m(B)&&B in O&&"@none"in O[B]&&"@type"in O[B]["@none"]&&"@none"in O[B]["@none"]["@type"])return O[B]["@none"]["@type"]["@none"];if(F.vocab&&B in O){const Y=A["@language"]||"@none",w=[];t(R)&&"@index"in R&&!("@graph"in R)&&w.push("@index","@index@set"),t(R)&&"@preserve"in R&&(R=R["@preserve"][0]),o(R)?("@index"in R&&w.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in R&&w.push("@graph@id","@graph@id@set"),w.push("@graph","@graph@set","@set"),"@index"in R||w.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in R||w.push("@graph@id","@graph@id@set")):t(R)&&!a(R)&&w.push("@id","@id@set","@type","@set@type");let H="@language",K="@null";if(q)H="@type",K="@reverse",w.push("@set");else if(s(R)){"@index"in R||w.push("@list");const ue=R["@list"];if(ue.length===0)H="@any",K="@none";else{let V=ue.length===0?Y:null,G=null;for(let z=0;z<ue.length;++z){const U=ue[z];let ee="@none",re="@none";if(a(U))if("@direction"in U){const fe=(U["@language"]||"").toLowerCase(),ge=U["@direction"];ee=`${fe}_${ge}`}else"@language"in U?ee=U["@language"].toLowerCase():"@type"in U?re=U["@type"]:ee="@null";else re="@id";if(V===null?V=ee:ee!==V&&a(U)&&(V="@none"),G===null?G=re:re!==G&&(G="@none"),V==="@none"&&G==="@none")break}V=V||"@none",G=G||"@none",G!=="@none"?(H="@type",K=G):K=V}}else{if(a(R))if("@language"in R&&!("@index"in R)){w.push("@language","@language@set"),K=R["@language"];const ue=R["@direction"];ue&&(K=`${K}_${ue}`)}else"@direction"in R&&!("@index"in R)?K=`_${R["@direction"]}`:"@type"in R&&(H="@type",K=R["@type"]);else H="@type",K="@id";w.push("@set")}w.push("@none"),t(R)&&!("@index"in R)&&w.push("@index","@index@set"),a(R)&&Object.keys(R).length===1&&w.push("@language","@language@set");const X=I(A,B,R,w,H,K);if(X!==null)return X}if(F.vocab&&"@vocab"in A){const Y=A["@vocab"];if(B.indexOf(Y)===0&&B!==Y){const w=B.substr(Y.length);if(!A.mappings.has(w))return w}}let te=null;const T=[];let Z=A.fastCurieMap;const k=B.length-1;for(let Y=0;Y<k&&B[Y]in Z;++Y)Z=Z[B[Y]],""in Z&&T.push(Z[""][0]);for(let Y=T.length-1;Y>=0;--Y){const w=T[Y],H=w.terms;for(const K of H){const X=K+":"+B.substr(w.iri.length);A.mappings.get(K)._prefix&&(!A.mappings.has(X)||R===null&&A.mappings.get(X)["@id"]===B)&&(te===null||h(X,te)<0)&&(te=X)}}if(te!==null)return te;for(const[Y,w]of A.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:A});if(!F.vocab)if("@base"in A)if(A["@base"]){const Y=x(E(D,A["@base"]),B);return v.test(Y)?`./${Y}`:Y}else return B;else return x(D,B);return B},g.compactValue=({activeCtx:A,activeProperty:B,value:R,options:F})=>{if(a(R)){const te=d(A,B,"@type"),T=d(A,B,"@language"),Z=d(A,B,"@direction"),k=d(A,B,"@container")||[],Y="@index"in R&&!k.includes("@index");if(!Y&&te!=="@none"&&(R["@type"]===te||"@language"in R&&R["@language"]===T&&"@direction"in R&&R["@direction"]===Z||"@language"in R&&R["@language"]===T||"@direction"in R&&R["@direction"]===Z))return R["@value"];const w=Object.keys(R).length,H=w===1||w===2&&"@index"in R&&!Y,K="@language"in A,X=n(R["@value"]),ue=A.mappings.has(B)&&A.mappings.get(B)["@language"]===null;if(H&&te!=="@none"&&(!K||!X||ue))return R["@value"];const V={};return Y&&(V[g.compactIri({activeCtx:A,iri:"@index",relativeTo:{vocab:!0}})]=R["@index"]),"@type"in R?V[g.compactIri({activeCtx:A,iri:"@type",relativeTo:{vocab:!0}})]=g.compactIri({activeCtx:A,iri:R["@type"],relativeTo:{vocab:!0}}):"@language"in R&&(V[g.compactIri({activeCtx:A,iri:"@language",relativeTo:{vocab:!0}})]=R["@language"]),"@direction"in R&&(V[g.compactIri({activeCtx:A,iri:"@direction",relativeTo:{vocab:!0}})]=R["@direction"]),V[g.compactIri({activeCtx:A,iri:"@value",relativeTo:{vocab:!0}})]=R["@value"],V}const q=c(A,B,{vocab:!0},F),D=d(A,B,"@type"),O=g.compactIri({activeCtx:A,iri:R["@id"],relativeTo:{vocab:D==="@vocab"},base:F.base});return D==="@id"||D==="@vocab"||q==="@graph"?O:{[g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}})]:O}};function I(A,B,R,F,q,D){D===null&&(D="@null");const O=[];if((D==="@id"||D==="@reverse")&&t(R)&&"@id"in R){D==="@reverse"&&O.push("@reverse");const T=g.compactIri({activeCtx:A,iri:R["@id"],relativeTo:{vocab:!0}});A.mappings.has(T)&&A.mappings.get(T)&&A.mappings.get(T)["@id"]===R["@id"]?O.push.apply(O,["@vocab","@id"]):O.push.apply(O,["@id","@vocab"])}else{O.push(D);const T=O.find(Z=>Z.includes("_"));T&&O.push(T.replace(/^[^_]+_/,"_"))}O.push("@none");const te=A.inverse[B];for(const T of F){if(!(T in te))continue;const Z=te[T][q];for(const k of O)if(k in Z)return Z[k]}return null}function C(A,B,R){if(c(A,B,{vocab:!0},R)!=="@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 Ls}var Cs,iu;function Pf(){return iu||(iu=1,Cs=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,n){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):r.compact(t,n)},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}),Cs}/**
308
334
  * A JavaScript implementation of the JSON-LD API.
309
335
  *
310
336
  * @author Dave Longley
@@ -338,17 +364,17 @@ if("@preserve"in c)return c["@preserve"][0];if(e.isValue(c))return c;if(e.isList
338
364
  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
339
365
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
340
366
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
341
- */var is,ml;function zf(){if(ml)return is;ml=1;const r=oa(),e=$f(),t=et(),n=Cf(),i=t.IdentifierIssuer,s=rt(),a=ec(),o=Pf(),{expand:l}=qf(),{flatten:d}=Bf(),{fromRDF:h}=Ff(),{toRDF:y}=Hf(),{frameMergedOrDefault:w,cleanupNull:g}=Vf(),{isArray:m,isObject:_,isString:x}=Ke(),{isSubjectReference:S}=_t(),{expandIri:I,getInitialContext:b,process:c,processingMode:p}=Ut(),{compact:N,compactIri:D}=Gf(),{createNodeMap:T,createMergedNodeMap:q,mergeNodeMaps:R}=Mn(),{logEventHandler:M,logWarningEventHandler:B,safeEventHandler:A,setDefaultEventHandler:j,setupEventHandler:Y,strictEventHandler:L,unhandledEventHandler:ee}=Kr(),C=function(v){const U={},z=new a({max:100});v.compact=async function(H,V,W){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(V===null)throw new s("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(H===null)return null;W=ae(W,{base:x(H)?H:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new i("_:b"),contextResolver:new n({sharedCache:z})}),W.link&&(W.skipExpansion=!0),W.compactToRelative||delete W.base;let F;W.skipExpansion?F=H:F=await v.expand(H,W);const Z=await v.processContext(b(W),V,W);let te=await N({activeCtx:Z,element:F,options:W});W.compactArrays&&!W.graph&&m(te)?te.length===1?te=te[0]:te.length===0&&(te={}):W.graph&&_(te)&&(te=[te]),_(V)&&"@context"in V&&(V=V["@context"]),V=t.clone(V),m(V)||(V=[V]);const ce=V;V=[];for(let O=0;O<ce.length;++O)(!_(ce[O])||Object.keys(ce[O]).length>0)&&V.push(ce[O]);const fe=V.length>0;if(V.length===1&&(V=V[0]),m(te)){const O=D({activeCtx:Z,iri:"@graph",relativeTo:{vocab:!0}}),G=te;te={},fe&&(te["@context"]=V),te[O]=G}else if(_(te)&&fe){const O=te;te={"@context":V};for(const G in O)te[G]=O[G]}return te},v.expand=async function(H,V){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");V=ae(V,{keepFreeFloatingNodes:!1,contextResolver:new n({sharedCache:z})});const W={},F=[];if("expandContext"in V){const fe=t.clone(V.expandContext);_(fe)&&"@context"in fe?W.expandContext=fe:W.expandContext={"@context":fe},F.push(W.expandContext)}let Z;if(!x(H))W.input=t.clone(H);else{const fe=await v.get(H,V);Z=fe.documentUrl,W.input=fe.document,fe.contextUrl&&(W.remoteContext={"@context":fe.contextUrl},F.push(W.remoteContext))}"base"in V||(V.base=Z||"");let te=b(V);for(const fe of F)te=await c({activeCtx:te,localCtx:fe,options:V});let ce=await l({activeCtx:te,element:W.input,options:V});return _(ce)&&"@graph"in ce&&Object.keys(ce).length===1?ce=ce["@graph"]:ce===null&&(ce=[]),m(ce)||(ce=[ce]),ce},v.flatten=async function(H,V,W){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");typeof V=="function"?V=null:V=V||null,W=ae(W,{base:x(H)?H:"",contextResolver:new n({sharedCache:z})});const F=await v.expand(H,W),Z=d(F);return V===null?Z:(W.graph=!0,W.skipExpansion=!0,await v.compact(Z,V,W))},v.frame=async function(H,V,W){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(W=ae(W,{base:x(H)?H:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new n({sharedCache:z})}),x(V)){const ue=await v.get(V,W);if(V=ue.document,ue.contextUrl){let de=V["@context"];de?m(de)?de.push(ue.contextUrl):de=[de,ue.contextUrl]:de=ue.contextUrl,V["@context"]=de}}const F=V?V["@context"]||{}:{},Z=await v.processContext(b(W),F,W);W.hasOwnProperty("omitGraph")||(W.omitGraph=p(Z,1.1)),W.hasOwnProperty("pruneBlankNodeIdentifiers")||(W.pruneBlankNodeIdentifiers=p(Z,1.1));const te=await v.expand(H,W),ce={...W};ce.isFrame=!0,ce.keepFreeFloatingNodes=!0;const fe=await v.expand(V,ce),O=Object.keys(V).map(ue=>I(Z,ue,{vocab:!0}));ce.merged=!O.includes("@graph"),ce.is11=p(Z,1.1);const G=w(te,fe,ce);ce.graph=!W.omitGraph,ce.skipExpansion=!0,ce.link={},ce.framing=!0;let re=await v.compact(G,F,ce);return ce.link={},re=g(re,ce),re},v.link=async function(H,V,W){const F={};return V&&(F["@context"]=V),F["@embed"]="@link",v.frame(H,F,W)},v.normalize=v.canonize=async function(H,V){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if(V=ae(V,{base:x(H)?H:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new n({sharedCache:z})}),"inputFormat"in V){if(V.inputFormat!=="application/n-quads"&&V.inputFormat!=="application/nquads")throw new s("Unknown canonicalization input format.","jsonld.CanonizeError");const Z=o.parse(H);return r.canonize(Z,V)}const W={...V};delete W.format,W.produceGeneralizedRdf=!1;const F=await v.toRDF(H,W);return r.canonize(F,V)},v.fromRDF=async function(H,V){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");V=ae(V,{format:x(H)?"application/n-quads":void 0});const{format:W}=V;let{rdfParser:F}=V;if(W){if(F=F||U[W],!F)throw new s("Unknown input format.","jsonld.UnknownFormat",{format:W})}else F=()=>H;const Z=await F(H);return h(Z,V)},v.toRDF=async function(H,V){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");V=ae(V,{base:x(H)?H:"",skipExpansion:!1,contextResolver:new n({sharedCache:z})});let W;V.skipExpansion?W=H:W=await v.expand(H,V);const F=y(W,V);if(V.format){if(V.format==="application/n-quads"||V.format==="application/nquads")return o.serialize(F);throw new s("Unknown output format.","jsonld.UnknownFormat",{format:V.format})}return F},v.createNodeMap=async function(H,V){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");V=ae(V,{base:x(H)?H:"",contextResolver:new n({sharedCache:z})});const W=await v.expand(H,V);return q(W,V)},v.merge=async function(H,V,W){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!m(H))throw new TypeError('Could not merge, "docs" must be an array.');typeof V=="function"?V=null:V=V||null,W=ae(W,{contextResolver:new n({sharedCache:z})});const F=await Promise.all(H.map(ue=>{const de={...W};return v.expand(ue,de)}));let Z=!0;"mergeNodes"in W&&(Z=W.mergeNodes);const te=W.issuer||new i("_:b"),ce={"@default":{}};for(let ue=0;ue<F.length;++ue){const de=t.relabelBlankNodes(F[ue],{issuer:new i("_:b"+ue+"-")}),pe=Z||ue===0?ce:{"@default":{}};if(T(de,pe,"@default",te),pe!==ce)for(const X in pe){const le=pe[X];if(!(X in ce)){ce[X]=le;continue}const he=ce[X];for(const se in le)se in he||(he[se]=le[se])}}const fe=R(ce),O=[],G=Object.keys(fe).sort();for(let ue=0;ue<G.length;++ue){const de=fe[G[ue]];S(de)||O.push(de)}return V===null?O:(W.graph=!0,W.skipExpansion=!0,await v.compact(O,V,W))},Object.defineProperty(v,"documentLoader",{get:()=>v._documentLoader,set:H=>v._documentLoader=H}),v.documentLoader=async H=>{throw new s("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:H})},v.get=async function(H,V){let W;typeof V.documentLoader=="function"?W=V.documentLoader:W=v.documentLoader;const F=await W(H);try{if(!F.document)throw new s("No remote document found at the given URL.","jsonld.NullRemoteDocument");x(F.document)&&(F.document=JSON.parse(F.document))}catch(Z){throw new s("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:Z,remoteDoc:F})}return F},v.processContext=async function(H,V,W){return W=ae(W,{base:"",contextResolver:new n({sharedCache:z})}),V===null?b(W):(V=t.clone(V),_(V)&&"@context"in V||(V={"@context":V}),c({activeCtx:H,localCtx:V,options:W}))},v.getContextValue=Ut().getContextValue,v.documentLoaders={},v.useDocumentLoader=function(H){if(!(H in v.documentLoaders))throw new s('Unknown document loader type: "'+H+'"',"jsonld.UnknownDocumentLoader",{type:H});v.documentLoader=v.documentLoaders[H].apply(v,Array.prototype.slice.call(arguments,1))},v.registerRDFParser=function(H,V){U[H]=V},v.unregisterRDFParser=function(H){delete U[H]},v.registerRDFParser("application/n-quads",o.parse),v.registerRDFParser("application/nquads",o.parse),v.url=At(),v.logEventHandler=M,v.logWarningEventHandler=B,v.safeEventHandler=A,v.setDefaultEventHandler=j,v.strictEventHandler=L,v.unhandledEventHandler=ee,v.util=t,Object.assign(v,t),v.promises=v,v.RequestQueue=Zu(),v.JsonLdProcessor=Wf()(v),e.setupGlobals(v),e.setupDocumentLoaders(v);function ae(H,{documentLoader:V=v.documentLoader,...W}){if(H&&"compactionMap"in H)throw new s('"compactionMap" not supported.',"jsonld.OptionsError");if(H&&"expansionMap"in H)throw new s('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:V},W,H,{eventHandler:Y({options:H})})}return v},K=function(){return C(function(){return K()})};return C(K),is=K,is}var Jf=zf();const ss={},as={};let Ds;class Qf{constructor(e){this.loadedExternalUrls=[],this.loadedClasses=[],this.config=e}async loadGraphs(){this.loadedExternalUrls=[],this.loadedClasses=[];let e=Ds;this.config.prefixes={};const t=[];if(e||(e=new Fe,t.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?this.fetchRDF(this.config.attributes.shapesUrl):"",e,wn))),t.push(this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?this.fetchRDF(this.config.attributes.valuesUrl):"",e,ut,new Rs({blankNodePrefix:""}))),await Promise.all(t),!Ds&&e?.size==0&&this.config.attributes.valuesSubject){const n=[...e.getObjects(this.config.attributes.valuesSubject,Ue,ut),...e.getObjects(this.config.attributes.valuesSubject,Ts,ut)],i=[];for(const s of n){const a=this.toURL(s.value);a&&this.loadedExternalUrls.indexOf(a)<0&&(this.loadedExternalUrls.push(a),i.push(this.importRDF(this.fetchRDF(a),e,wn)))}try{await Promise.allSettled(i)}catch(s){console.warn(s)}}this.config.store=e}async importRDF(e,t,n,i){const s=i||new Rs,a=async o=>{const l=[];await new Promise((d,h)=>{s.parse(o,(y,w,g)=>{if(y)return console.warn("failed parsing graph",n,y.message),h(y);if(w){if(t.add(new Nn(w.subject,w.predicate,w.object,n)),this.config.attributes.ignoreOwlImports===null&&zs.equals(w.predicate)){const m=this.toURL(w.object.value);m&&this.loadedExternalUrls.indexOf(m)<0&&(this.loadedExternalUrls.push(m),l.push(this.importRDF(this.fetchRDF(m),t,xe.namedNode(m),i)))}if(this.config.classInstanceProvider&&Js.equals(w.predicate)){const m=w.object.value;if(this.loadedClasses.indexOf(m)<0){let _;m in as?_=as[m]:(_=this.config.classInstanceProvider(m),as[m]=_),this.loadedClasses.push(m),l.push(this.importRDF(_,t,n,i))}}return}g&&this.config.registerPrefixes(g),d(null)})});try{await Promise.allSettled(l)}catch(d){console.warn(d)}};if(e instanceof Promise&&(e=await e),e){try{e=await Jf.toRDF(JSON.parse(e),{format:"application/n-quads"})}catch{}await a(e)}}async fetchRDF(e){if(e in ss)return ss[e];const t=fetch(e,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then(n=>n.text());return ss[e]=t,t}toURL(e){if(Ls(e))return e;if(this.config.prefixes){const t=e.split(":");if(t.length===2){const n=this.config.prefixes[t[0]];if(n&&(e=e.replace(`${t[0]}:`,n),Ls(e)))return e}}return null}}function Xf(r){Ds=r}class os{constructor(){this.shapes=null,this.shapesUrl=null,this.shapeSubject=null,this.values=null,this.valuesUrl=null,this.valueSubject=null,this.valuesSubject=null,this.valuesNamespace="",this.valuesGraph=null,this.view=null,this.language=null,this.loading="Loading…",this.ignoreOwlImports=null,this.collapse=null,this.submitButton=null,this.generateNodeShapeReference=null,this.showNodeIds=null}}class bl{constructor(e,t){this.attributes=new os,this.loader=new Qf(this),this.prefixes={},this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new Fe,this.theme=e,this.form=t,this.languages=[...new Set(navigator.languages.flatMap(n=>n.length>2?[n.toLocaleLowerCase(),n.substring(0,2)]:n)),""]}updateAttributes(e){const t=new os;if(Object.keys(t).forEach(n=>{const i=e.dataset[n];i!==void 0&&(t[n]=i)}),this.editMode=t.view===null,this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){const n=this.languages.indexOf(t.language);n>-1&&this.languages.splice(n,1),this.languages.unshift(t.language)}t.valuesGraph&&(this.valuesGraphId=xe.namedNode(t.valuesGraph))}static dataAttributes(){const e=new os;return Object.keys(e).map(t=>(t=t.replace(/[A-Z]/g,n=>"-"+n.toLowerCase()),"data-"+t))}get store(){return this._store}set store(e){this._store=e,this.lists=e.extractLists(),this.groups=[],e.forSubjects(t=>{this.groups.push(t.id)},Ue,`${be}PropertyGroup`,null)}registerPrefixes(e){for(const t in e)t&&(this.prefixes[t]=e[t])}}function Kf(r){return"_:"+r.value}function Yf(r,e){return[...r].map(t=>e(t)).join(`
367
+ */var js,su;function Mf(){if(su)return js;su=1;const r=ka(),e=Nf(),t=dt(),n=Af(),i=t.IdentifierIssuer,s=ft(),a=Hc(),o=Df(),{expand:u}=Of(),{flatten:l}=Lf(),{fromRDF:c}=Cf(),{toRDF:d}=$f(),{frameMergedOrDefault:m,cleanupNull:b}=Ff(),{isArray:_,isObject:x,isString:E}=ut(),{isSubjectReference:v}=$t(),{expandIri:S,getInitialContext:y,process:h,processingMode:g}=ar(),{compact:I,compactIri:C}=kf(),{createNodeMap:A,createMergedNodeMap:B,mergeNodeMaps:R}=fi(),{logEventHandler:F,logWarningEventHandler:q,safeEventHandler:D,setDefaultEventHandler:O,setupEventHandler:te,strictEventHandler:T,unhandledEventHandler:Z}=Nn(),k=function(w){const H={},X=new a({max:100});w.compact=async function(V,G,z){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(G===null)throw new s("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(V===null)return null;z=ue(z,{base:E(V)?V:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new i("_:b"),contextResolver:new n({sharedCache:X})}),z.link&&(z.skipExpansion=!0),z.compactToRelative||delete z.base;let U;z.skipExpansion?U=V:U=await w.expand(V,z);const ee=await w.processContext(y(z),G,z);let re=await I({activeCtx:ee,element:U,options:z});z.compactArrays&&!z.graph&&_(re)?re.length===1?re=re[0]:re.length===0&&(re={}):z.graph&&x(re)&&(re=[re]),x(G)&&"@context"in G&&(G=G["@context"]),G=t.clone(G),_(G)||(G=[G]);const fe=G;G=[];for(let j=0;j<fe.length;++j)(!x(fe[j])||Object.keys(fe[j]).length>0)&&G.push(fe[j]);const ge=G.length>0;if(G.length===1&&(G=G[0]),_(re)){const j=C({activeCtx:ee,iri:"@graph",relativeTo:{vocab:!0}}),W=re;re={},ge&&(re["@context"]=G),re[j]=W}else if(x(re)&&ge){const j=re;re={"@context":G};for(const W in j)re[W]=j[W]}return re},w.expand=async function(V,G){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");G=ue(G,{keepFreeFloatingNodes:!1,contextResolver:new n({sharedCache:X})});const z={},U=[];if("expandContext"in G){const ge=t.clone(G.expandContext);x(ge)&&"@context"in ge?z.expandContext=ge:z.expandContext={"@context":ge},U.push(z.expandContext)}let ee;if(!E(V))z.input=t.clone(V);else{const ge=await w.get(V,G);ee=ge.documentUrl,z.input=ge.document,ge.contextUrl&&(z.remoteContext={"@context":ge.contextUrl},U.push(z.remoteContext))}"base"in G||(G.base=ee||"");let re=y(G);for(const ge of U)re=await h({activeCtx:re,localCtx:ge,options:G});let fe=await u({activeCtx:re,element:z.input,options:G});return x(fe)&&"@graph"in fe&&Object.keys(fe).length===1?fe=fe["@graph"]:fe===null&&(fe=[]),_(fe)||(fe=[fe]),fe},w.flatten=async function(V,G,z){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");typeof G=="function"?G=null:G=G||null,z=ue(z,{base:E(V)?V:"",contextResolver:new n({sharedCache:X})});const U=await w.expand(V,z),ee=l(U);return G===null?ee:(z.graph=!0,z.skipExpansion=!0,await w.compact(ee,G,z))},w.frame=async function(V,G,z){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(z=ue(z,{base:E(V)?V:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new n({sharedCache:X})}),E(G)){const he=await w.get(G,z);if(G=he.document,he.contextUrl){let pe=G["@context"];pe?_(pe)?pe.push(he.contextUrl):pe=[pe,he.contextUrl]:pe=he.contextUrl,G["@context"]=pe}}const U=G?G["@context"]||{}:{},ee=await w.processContext(y(z),U,z);z.hasOwnProperty("omitGraph")||(z.omitGraph=g(ee,1.1)),z.hasOwnProperty("pruneBlankNodeIdentifiers")||(z.pruneBlankNodeIdentifiers=g(ee,1.1));const re=await w.expand(V,z),fe={...z};fe.isFrame=!0,fe.keepFreeFloatingNodes=!0;const ge=await w.expand(G,fe),j=Object.keys(G).map(he=>S(ee,he,{vocab:!0}));fe.merged=!j.includes("@graph"),fe.is11=g(ee,1.1);const W=m(re,ge,fe);fe.graph=!z.omitGraph,fe.skipExpansion=!0,fe.link={},fe.framing=!0;let se=await w.compact(W,U,fe);return fe.link={},se=b(se,fe),se},w.link=async function(V,G,z){const U={};return G&&(U["@context"]=G),U["@embed"]="@link",w.frame(V,U,z)},w.normalize=w.canonize=async function(V,G){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if(G=ue(G,{base:E(V)?V:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new n({sharedCache:X})}),"inputFormat"in G){if(G.inputFormat!=="application/n-quads"&&G.inputFormat!=="application/nquads")throw new s("Unknown canonicalization input format.","jsonld.CanonizeError");const ee=o.parse(V);return r.canonize(ee,G)}const z={...G};delete z.format,z.produceGeneralizedRdf=!1;const U=await w.toRDF(V,z);return r.canonize(U,G)},w.fromRDF=async function(V,G){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");G=ue(G,{format:E(V)?"application/n-quads":void 0});const{format:z}=G;let{rdfParser:U}=G;if(z){if(U=U||H[z],!U)throw new s("Unknown input format.","jsonld.UnknownFormat",{format:z})}else U=()=>V;const ee=await U(V);return c(ee,G)},w.toRDF=async function(V,G){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");G=ue(G,{base:E(V)?V:"",skipExpansion:!1,contextResolver:new n({sharedCache:X})});let z;G.skipExpansion?z=V:z=await w.expand(V,G);const U=d(z,G);if(G.format){if(G.format==="application/n-quads"||G.format==="application/nquads")return o.serialize(U);throw new s("Unknown output format.","jsonld.UnknownFormat",{format:G.format})}return U},w.createNodeMap=async function(V,G){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");G=ue(G,{base:E(V)?V:"",contextResolver:new n({sharedCache:X})});const z=await w.expand(V,G);return B(z,G)},w.merge=async function(V,G,z){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!_(V))throw new TypeError('Could not merge, "docs" must be an array.');typeof G=="function"?G=null:G=G||null,z=ue(z,{contextResolver:new n({sharedCache:X})});const U=await Promise.all(V.map(he=>{const pe={...z};return w.expand(he,pe)}));let ee=!0;"mergeNodes"in z&&(ee=z.mergeNodes);const re=z.issuer||new i("_:b"),fe={"@default":{}};for(let he=0;he<U.length;++he){const pe=t.relabelBlankNodes(U[he],{issuer:new i("_:b"+he+"-")}),me=ee||he===0?fe:{"@default":{}};if(A(pe,me,"@default",re),me!==fe)for(const J in me){const ce=me[J];if(!(J in fe)){fe[J]=ce;continue}const ye=fe[J];for(const le in ce)le in ye||(ye[le]=ce[le])}}const ge=R(fe),j=[],W=Object.keys(ge).sort();for(let he=0;he<W.length;++he){const pe=ge[W[he]];v(pe)||j.push(pe)}return G===null?j:(z.graph=!0,z.skipExpansion=!0,await w.compact(j,G,z))},Object.defineProperty(w,"documentLoader",{get:()=>w._documentLoader,set:V=>w._documentLoader=V}),w.documentLoader=async V=>{throw new s("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:V})},w.get=async function(V,G){let z;typeof G.documentLoader=="function"?z=G.documentLoader:z=w.documentLoader;const U=await z(V);try{if(!U.document)throw new s("No remote document found at the given URL.","jsonld.NullRemoteDocument");E(U.document)&&(U.document=JSON.parse(U.document))}catch(ee){throw new s("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:ee,remoteDoc:U})}return U},w.processContext=async function(V,G,z){return z=ue(z,{base:"",contextResolver:new n({sharedCache:X})}),G===null?y(z):(G=t.clone(G),x(G)&&"@context"in G||(G={"@context":G}),h({activeCtx:V,localCtx:G,options:z}))},w.getContextValue=ar().getContextValue,w.documentLoaders={},w.useDocumentLoader=function(V){if(!(V in w.documentLoaders))throw new s('Unknown document loader type: "'+V+'"',"jsonld.UnknownDocumentLoader",{type:V});w.documentLoader=w.documentLoaders[V].apply(w,Array.prototype.slice.call(arguments,1))},w.registerRDFParser=function(V,G){H[V]=G},w.unregisterRDFParser=function(V){delete H[V]},w.registerRDFParser("application/n-quads",o.parse),w.registerRDFParser("application/nquads",o.parse),w.url=Gt(),w.logEventHandler=F,w.logWarningEventHandler=q,w.safeEventHandler=D,w.setDefaultEventHandler=O,w.strictEventHandler=T,w.unhandledEventHandler=Z,w.util=t,Object.assign(w,t),w.promises=w,w.RequestQueue=Uc(),w.JsonLdProcessor=Pf()(w),e.setupGlobals(w),e.setupDocumentLoaders(w);function ue(V,{documentLoader:G=w.documentLoader,...z}){if(V&&"compactionMap"in V)throw new s('"compactionMap" not supported.',"jsonld.OptionsError");if(V&&"expansionMap"in V)throw new s('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:G},z,V,{eventHandler:te({options:V})})}return w},Y=function(){return k(function(){return Y()})};return k(Y),js=Y,js}var Bf=Mf();const $s={},Fs={},qf=new Ku;let ca;class Uf{constructor(e){this.loadedExternalUrls=[],this.loadedClasses=[],this.config=e}async loadGraphs(){this.loadedExternalUrls=[],this.loadedClasses=[];let e=ca;this.config.prefixes={};const t=[];if(e||(e=new et,t.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?qn(this.config.attributes.shapesUrl):"",e,Jn))),t.push(this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?qn(this.config.attributes.valuesUrl):"",e,vt)),await Promise.all(t),!ca&&e?.size==0&&this.config.attributes.valuesSubject){const n=[...e.getObjects(this.config.attributes.valuesSubject,tt,vt),...e.getObjects(this.config.attributes.valuesSubject,na,vt)],i=[];for(const s of n){const a=this.toURL(s.value);a&&this.loadedExternalUrls.indexOf(a)<0&&(this.loadedExternalUrls.push(a),i.push(this.importRDF(qn(a),e,Jn)))}try{await Promise.allSettled(i)}catch(s){console.warn(s)}}this.config.store=e}async importRDF(e,t,n){const i=async s=>{const a=[];await new Promise((o,u)=>{const l=d=>{if(t.add(new ii(d.subject,d.predicate,d.object,n)),this.config.attributes.ignoreOwlImports===null&&xa.equals(d.predicate)){const m=this.toURL(d.object.value);m&&this.loadedExternalUrls.indexOf(m)<0&&(this.loadedExternalUrls.push(m),a.push(this.importRDF(qn(m),t,Re.namedNode(m))))}if(this.config.classInstanceProvider&&Ea.equals(d.predicate)){const m=d.object.value;if(this.loadedClasses.indexOf(m)<0){let b;m in Fs?b=Fs[m]:(b=this.config.classInstanceProvider(m),Fs[m]=b),this.loadedClasses.push(m),a.push(this.importRDF(b,t,n))}}};if(au(s)==="xml"){const d=new mf.RdfXmlParser;d.on("data",m=>{l(m)}).on("error",m=>{console.warn("failed parsing graph",n,m.message),u(m)}).on("prefix",(m,b)=>{m&&(this.config.prefixes[m]=b)}).on("end",()=>{o(null)}),d.write(s),d.end()}else qf.parse(s,(d,m,b)=>{if(d)return console.warn("failed parsing graph",n,d.message),u(d);if(m){l(m);return}b&&this.config.registerPrefixes(b),o(null)})});try{await Promise.allSettled(a)}catch(o){console.warn(o)}};if(e instanceof Promise&&(e=await e),e){if(au(e)==="json")try{e=await Bf.toRDF(JSON.parse(e),{format:"application/n-quads"})}catch(s){console.error(s)}await i(e)}}toURL(e){if(sa(e))return e;if(this.config.prefixes){const t=e.split(":");if(t.length===2){const n=this.config.prefixes[t[0]];if(n&&(e=e.replace(`${t[0]}:`,n),sa(e)))return e}}return null}}async function qn(r){if(r in $s)return $s[r];const e=fetch(r,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then(t=>t.text());return $s[r]=e,e}function au(r){return/^\s*\{/.test(r)?"json":/^\s*<\?xml/.test(r)?"xml":"ttl"}function Hf(r){ca=r}class ks{constructor(){this.shapes=null,this.shapesUrl=null,this.shapeSubject=null,this.values=null,this.valuesUrl=null,this.valueSubject=null,this.valuesSubject=null,this.valuesNamespace="",this.valuesGraph=null,this.view=null,this.language=null,this.loading="Loading…",this.ignoreOwlImports=null,this.collapse=null,this.submitButton=null,this.generateNodeShapeReference=null,this.showNodeIds=null}}class ou{constructor(e,t){this.attributes=new ks,this.loader=new Uf(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(n=>n.length>2?[n.toLocaleLowerCase(),n.substring(0,2)]:n)),""]}updateAttributes(e){const t=new ks;if(Object.keys(t).forEach(n=>{const i=e.dataset[n];i!==void 0&&(t[n]=i)}),this.editMode=t.view===null,this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){const n=this.languages.indexOf(t.language);n>-1&&this.languages.splice(n,1),this.languages.unshift(t.language)}t.valuesGraph&&(this.valuesGraphId=Re.namedNode(t.valuesGraph))}static dataAttributes(){const e=new ks;return Object.keys(e).map(t=>(t=t.replace(/[A-Z]/g,n=>"-"+n.toLowerCase()),"data-"+t))}get store(){return this._store}set store(e){this._store=e,this.lists=e.extractLists(),this.groups=[],e.forSubjects(t=>{this.groups.push(t.id)},tt,`${xe}PropertyGroup`,null)}registerPrefixes(e){for(const t in e)t&&(this.prefixes[t]=e[t])}}function Vf(r){return"_:"+r.value}function Gf(r,e){return[...r].map(t=>e(t)).join(`
342
368
  `)+`
343
- `}function Zf(){return""}function tc(r){return"<"+r.value+">"}const eh=/["\\\\\n\r]/,th=/["\\\\\n\r]/g,rh={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function nh(r){return rh[r]}function ih(r){return eh.test(r)?r.replace(th,nh):r}function sh(r){const e=ih(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+'"^^'+tc(r.datatype)}function ah(r,e){const t=e(r.subject),n=e(r.predicate),i=e(r.object),s=e(r.graph);return`${t} ${n} ${i} ${s?s+" ":""}.`}function oh(r){return"?"+r.value}function Je(r){if(!r)return null;if(r.termType==="BlankNode")return Kf(r);if(r.termType==="DefaultGraph")return Zf();if(r.termType==="Literal")return sh(r);if(r.termType==="NamedNode")return tc(r);if(r.termType==="Quad"||r.subject&&r.predicate&&r.object&&r.graph)return ah(r,Je);if(r.termType==="Variable")return oh(r);if(r[Symbol.iterator])return Yf(r,Je);throw new Error(`unknown termType ${r.termType}`)}class cr{constructor(e){if(this.index=new Map,e)for(const[t,n]of e)this.set(t,n)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(Je(e))}*entries(){for(const[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(const n of this.entries())e.call(t,n[1],n[0],this)}get(e){const t=this.index.get(Je(e));return t&&t.value}has(e){return this.index.has(Je(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const n=Je(e);return this.index.set(n,{term:e,value:t}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}class wl{constructor({dataset:e,end:t,quad:n,start:i}){this.dataset=e,this.end=t,this.quad=n,this.start=i}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}}function vl(r){try{return Je(r)}catch{return null}}class tt{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=Je(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(vl(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(vl(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}let rc=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};rc.prototype.termType="BlankNode";let ua=class{equals(e){return!!e&&e.termType===this.termType}};ua.prototype.termType="DefaultGraph";ua.prototype.value="";function _l(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),n=r.fromTerm(e.predicate),i=r.fromTerm(e.object),s=r.fromTerm(e.graph);return r.quad(t,n,i,s)}if(e.termType==="Variable")return r.variable(e.value);throw new Error(`unknown termType ${e.termType}`)}let mn=class{constructor(e,t,n,i=""){this.value=e,this.language=t,this.datatype=n,this.direction=i}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}};mn.prototype.termType="Literal";let Yr=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};Yr.prototype.termType="NamedNode";let ca=class{constructor(e,t,n,i){this.subject=e,this.predicate=t,this.object=n,this.graph=i}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)}};ca.prototype.termType="Quad";ca.prototype.value="";let nc=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};nc.prototype.termType="Variable";const lh=new Yr("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),xl=new Yr("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),uh=new Yr("http://www.w3.org/2001/XMLSchema#string");let ic=class{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new ua}}namedNode(e){return new Yr(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new rc(e)}literal(e,t){return typeof t=="string"?new mn(e,t,xl):typeof t?.language=="string"?new mn(e,t.language,t.direction?lh:xl,t.direction):new mn(e,"",t||uh)}variable(e){return new nc(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,n,i=this.defaultGraph()){return new ca(e,t,n,i)}fromTerm(e){return _l(this,e)}fromQuad(e){return _l(this,e)}};ic.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const da=new ic,ch={apply:(r,e,t)=>r(t[0]),get:(r,e)=>r(e)};function nt(r,{factory:e=da}={}){const t=(n="")=>e.namedNode(`${r}${n.raw||n}`);return typeof Proxy>"u"?t:new Proxy(t,ch)}nt("http://www.w3.org/2001/XMLSchema#");const ot=nt("http://www.w3.org/1999/02/22-rdf-syntax-ns#");nt("http://www.w3.org/2000/01/rdf-schema#");class Ne{static add({ptr:e,start:t,end:n,subjects:i=[null],predicates:s=[null],objects:a=[null],graphs:o,callback:l}={}){if(!e.factory)throw new Error("add operation requires a factory");let d=()=>{};l&&(d=h=>{l(new wl({dataset:e.dataset,start:t,end:n,quad:h}))});for(const h of i)for(const y of s)for(const w of a)for(const g of o){const m={subject:h,predicate:y,object:w,graph:g};m[t]=e.term;const _=e.factory.quad(m.subject,m.predicate,m.object,m.graph);e.dataset.add(_),d(_)}return e}static addList({ptr:e,predicates:t,items:n,graphs:i}){if(e.isAny())throw new Error("can't attach a list to an any ptr");for(const s of t)for(const a of i){const o=n.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,s,o[0]||ot.nil,a));for(let l=0;l<o.length;l++)e.dataset.add(e.factory.quad(o[l],ot.first,n[l],a)),e.dataset.add(e.factory.quad(o[l],ot.rest,o[l+1]||ot.nil,a))}return e}static delete({ptr:e,start:t,subjects:n=[null],predicates:i=[null],objects:s=[null]}){for(const a of n)for(const o of i)for(const l of s){const d={subject:a,predicate:o,object:l};d[t]=e.term;const h=e.dataset.match(d.subject,d.predicate,d.object);for(const y of h)e.dataset.delete(y)}return e}static deleteList({ptr:e,predicates:t}){const n=[];for(const i of t)for(const s of e.dataset.match(e.term,i)){let a=s.object;for(n.push(s);!ot.nil.equals(a);){a=n[n.length-1].object;const o=e.dataset.match(a);if(o.size===0)break;for(const l of o)n.push(l)}}for(const i of n)e.dataset.delete(i);return e}static execute({ptr:e,operation:t="traverse",quantifier:n,start:i,end:s,subjects:a,predicates:o,objects:l,graphs:d,items:h,callback:y}={}){if(t==="add")return Ne.add({ptr:e,start:i,end:s,subjects:a,predicates:o,objects:l,graphs:d,callback:y});if(t==="addList")return Ne.addList({ptr:e,predicates:o,items:h,graphs:d});if(t==="delete")return Ne.delete({ptr:e,start:i,subjects:a,predicates:o,objects:l});if(t==="deleteList")return Ne.deleteList({ptr:e,predicates:o});if(t==="isList")return Ne.isList({ptr:e});if(t==="list")return Ne.list({ptr:e});if(t==="traverse")return Ne.traverse({ptr:e,quantifier:n,start:i,end:s,subjects:a,predicates:o,objects:l,graphs:d});throw new Error(`unknown operation ${t}`)}static isList({ptr:e}){return e.isAny()?!1:!!(ot.nil.equals(e.term)||Ne.traverse({ptr:e,predicates:[ot.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(ot.nil);){const t=e.out([ot.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const n=e.out([ot.rest]);if(n.length!==1)throw new Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=n[0]}}}}static traverse({ptr:e,quantifier:t="one",start:n="subject",end:i="object",subjects:s=[null],predicates:a=[null],objects:o=[null],graphs:l=[null],callback:d}){if(t==="one")return Ne.traverseOne({ptr:e,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:l,callback:d});if(t==="oneOrMore"){const h=Ne.traverse({ptr:e,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:l,callback:d});return Ne.traverseMore({ptrs:h,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:l,callback:d})}if(t==="zeroOrMore")return Ne.traverseMore({ptrs:[e],end:i,start:n,subjects:s,predicates:a,objects:o,graphs:l,callback:d});if(t==="zeroOrOne")return[e,...Ne.traverse({ptr:e,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:l,callback:d})];throw new Error(`unknown quantifier ${t}`)}static traverseMore({ptrs:e,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:l}={}){let d=[...e],h,y;do{h=[];for(const w of e)h=[...h,...Ne.traverseOne({ptr:w,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:l})];y&&(h=h.filter(w=>!y.has(w.term))),e=h,d=[...d,...h],y=new tt(d.map(w=>w.term))}while(h.length>0);return d}static traverseOne({ptr:e,start:t,end:n,subjects:i,predicates:s,objects:a,graphs:o,callback:l=(d,h)=>h.extend(d)}={}){const d=[];for(const h of i)for(const y of s)for(const w of a)for(const g of o){const m={subject:h,predicate:y,object:w,graph:g};m[t]=e.term;for(const _ of e.dataset.match(m.subject,m.predicate,m.object,m.graph))d.push(l(new wl({dataset:e.dataset,end:n,quad:_,start:t}),e))}return d}}function Sl(r,e){return e?t=>e(r.extend(t)):()=>{}}class El{constructor({dataset:e,edges:t=[],factory:n,graph:i,term:s}){if(!e&&t.length===0)throw new Error("dataset or edges is required");if(t.length===0&&typeof s>"u")throw new Error("edges or term must be given");if(t.length>0&&s)throw new Error("edges or term must be given");this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=n,this._graph=i,t.length===0&&(this._term=s)}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,n){return Ne.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:Sl(this,n)})}addList(e,t){return Ne.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,n){return Ne.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:Sl(this,n)})}deleteIn(e,t){return Ne.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return Ne.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return Ne.delete({ptr:this,start:"subject",predicates:e,objects:t})}execute({operation:e,quantifier:t,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:l,items:d,callback:h}){return Ne.execute({ptr:this,operation:e,quantifier:t,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:l,items:d,callback:h})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return Ne.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return Ne.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return Ne.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return Ne.isList({ptr:this})}list(){return Ne.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 Ne.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 Il(r,e){return r?r.equals(e):r===e}function dh(r,e){return!(r.dataset!==e.dataset||!Il(r.graph,e.graph)||!Il(r.term,e.term))}function Rl(r,e){return e?t=>e(new r.constructor({factory:r.factory,ptrs:[t]})):()=>{}}class En{constructor({dataset:e,factory:t,ptrs:n,terms:i,graphs:s}){if(this.factory=t,n)this.ptrs=[...n];else{this.ptrs=[];for(const a of i||[null])for(const o of s||[null])this.ptrs.push(new El({dataset:e,factory:t,graph:o,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 tt(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,n){const i=Rl(this,n);for(const s of this.ptrs)s.addIn(e,t,i);return this}addList(e,t){if(this.isAny())throw new Error("can't attach a list to an any ptr");for(const n of this.ptrs)n.addList(e,t);return this}addOut(e,t,n){const i=Rl(this,n);for(const s of this.ptrs)s.addOut(e,t,i);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(const n of this.ptrs)n.deleteIn(e,t);return this}deleteList(e){for(const t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(const n of this.ptrs)n.deleteOut(e,t);return this}distinct(){const e=this.ptrs.reduce((t,n)=>(t.some(i=>dh(i,n))||t.push(n.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 n of e)t=t.execute(n);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(n=>n.hasIn(e,t))})}hasOut(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.hasOut(e,t))})}in(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.in(e,t))})}isAny(){return this.ptrs.length>0&&this.ptrs.some(e=>e.isAny())}isList(){return 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 n of e)yield t.clone({ptrs:[n]})}()}map(e){return[...this].map(e)}node(e){const t=this.dataset,n=[...e].map(i=>new El({dataset:t,factory:this.factory,term:i}));return this.clone({ptrs:n})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.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]})}}nt("http://www.w3.org/2002/07/owl#");const Ht=nt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),fh=nt("http://www.w3.org/2000/01/rdf-schema#"),ne=nt("http://www.w3.org/ns/shacl#"),Ms=nt("https://schemas.link/shacl-next#"),fa=nt("http://www.w3.org/2001/XMLSchema#");function hh(r){return r?`{${[...r.quads()].map(e=>Je(e)).join(" ")}}`:"{}"}function ph(r){return r?`{${r.map(e=>hh(e)).join(" ")}}`:"{}"}var ls,Nl;function gh(){if(Nl)return ls;Nl=1;var r=/\s/;function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}return ls=e,ls}var us,Tl;function yh(){if(Tl)return us;Tl=1;var r=gh(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return us=t,us}var cs,Al;function mh(){if(Al)return cs;Al=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return cs=r,cs}var ds,Ll;function bh(){if(Ll)return ds;Ll=1;var r=typeof Zt=="object"&&Zt&&Zt.Object===Object&&Zt;return ds=r,ds}var fs,jl;function wh(){if(jl)return fs;jl=1;var r=bh(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return fs=t,fs}var hs,Ol;function sc(){if(Ol)return hs;Ol=1;var r=wh(),e=r.Symbol;return hs=e,hs}var ps,$l;function vh(){if($l)return ps;$l=1;var r=sc(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,i=r?r.toStringTag:void 0;function s(a){var o=t.call(a,i),l=a[i];try{a[i]=void 0;var d=!0}catch{}var h=n.call(a);return d&&(o?a[i]=l:delete a[i]),h}return ps=s,ps}var gs,kl;function _h(){if(kl)return gs;kl=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return gs=t,gs}var ys,Dl;function xh(){if(Dl)return ys;Dl=1;var r=sc(),e=vh(),t=_h(),n="[object Null]",i="[object Undefined]",s=r?r.toStringTag:void 0;function a(o){return o==null?o===void 0?i:n:s&&s in Object(o)?e(o):t(o)}return ys=a,ys}var ms,Ml;function Sh(){if(Ml)return ms;Ml=1;function r(e){return e!=null&&typeof e=="object"}return ms=r,ms}var bs,Cl;function Eh(){if(Cl)return bs;Cl=1;var r=xh(),e=Sh(),t="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&r(i)==t}return bs=n,bs}var ws,Pl;function Ih(){if(Pl)return ws;Pl=1;var r=yh(),e=mh(),t=Eh(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt;function l(d){if(typeof d=="number")return d;if(t(d))return n;if(e(d)){var h=typeof d.valueOf=="function"?d.valueOf():d;d=e(h)?h+"":h}if(typeof d!="string")return d===0?d:+d;d=r(d);var y=s.test(d);return y||a.test(d)?o(d.slice(2),y?2:8):i.test(d)?n:+d}return ws=l,ws}var vs,ql;function Rh(){if(ql)return vs;ql=1;var r=Ih(),e=1/0,t=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=r(i),i===e||i===-e){var s=i<0?-1:1;return s*t}return i===i?i:0}return vs=n,vs}var _s,Bl;function Nh(){if(Bl)return _s;Bl=1;var r=Rh();function e(t){var n=r(t),i=n%1;return n===n?i?n-i:n:0}return _s=e,_s}var xs,Fl;function Th(){if(Fl)return xs;Fl=1;var r=Nh(),e="Expected a function";function t(n,i){var s;if(typeof i!="function")throw new TypeError(e);return n=r(n),function(){return--n>0&&(s=i.apply(this,arguments)),n<=1&&(i=void 0),s}}return xs=t,xs}var Ss,Ul;function Ah(){if(Ul)return Ss;Ul=1;var r=Th();function e(t){return r(2,t)}return Ss=e,Ss}var Lh=Ah();const st=_c(Lh);let Hl=class{constructor({details:e,factory:t,options:n,results:i=[]}={}){this.details=e,this.factory=t,this.options=n,this.results=i,this._conforms=st(()=>!this.results.some(s=>s.severity.equals(ne.Info)||s.severity.equals(ne.Violation)||s.severity.equals(ne.Warning))),this._ptr=st(()=>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 En({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([Ht.type],[ne.ValidationReport]).addOut([ne.conforms],[this.factory.literal(this.conforms.toString(),fa.boolean)]);for(const t of this.results)e.addOut([ne.result],[this.factory.blankNode()],n=>{t.build(n,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function jh(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=Je(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}let Oh=class{constructor({args:e={},constraintComponent:t,factory:n,focusNode:i,message:s=[],path:a,results:o=[],severity:l,shape:d,source:h=[],value:y,valuePaths:w=[]}={}){this.args=e,this.constraintComponent=t,this.factory=n,this.focusNode=i,this.path=a||d.path,this.results=o,this.severity=l,this.shape=d,this.source=h,this.value=y,this.valuePaths=w,this._message=st(()=>(this.shape.message.length>0&&(s=this.shape.message),s.length===0&&(s=this.shape.ptr.node([this.constraintComponent]).out([ne.message]).terms),s.map(g=>n.literal(jh(g.value,e),g.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([Ht.type],[ne.ValidationResult]).addOut([ne.focusNode],this.focusNode.terms).addOut([ne.resultSeverity],[this.severity]).addOut([ne.sourceConstraint],this.source).addOut([ne.sourceConstraintComponent],[this.constraintComponent]).addOut([ne.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([ne.resultMessage],this.message);const n=i=>{if(i.quantifier==="one")return i.predicates.length>1?e.node([this.factory.blankNode()]).addList([ne.alternativePath],i.predicates):i.start==="object"?e.node([this.factory.blankNode()]).addOut([ne.inversePath],[i.predicates[0]]):e.node([i.predicates[0]]);if(i.quantifier==="oneOrMore")return e.node([this.factory.blankNode()]).addOut([ne.oneOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrMore")return e.node([this.factory.blankNode()]).addOut([ne.zeroOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrOne")return e.node([this.factory.blankNode()]).addOut([ne.zeroOrOnePath],[i.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([ne.resultPath],n(this.path[0]).terms):e.addList([ne.resultPath],this.path.map(i=>n(i).term))),typeof this.value<"u"&&e.addOut([ne.value],this.value.terms),t)for(const i of this.results)e.addOut([ne.detail],[this.factory.blankNode()],s=>{i.build(s,{details:t})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}};class ha{constructor({factory:e,focusNode:t,options:n={debug:!1,details:!1},processed:i=new Set,report:s=new Hl({factory:e,options:n}),results:a=new Map,shape:o,value:l,valueOrNode:d,valuePaths:h,values:y}={}){this.factory=e,this.focusNode=t,this.options=n,this.processed=i,this.report=s,this.results=a,this.shape=o,this.value=l,this.valuePaths=h,this.valueOrNode=d,this.values=y}create({child:e,focusNode:t=this.focusNode,shape:n=this.shape,value:i=this.value,valueOrNode:s=this.valueOrNode,valuePaths:a=this.valuePaths,values:o=this.values}={}){return new ha({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new Hl({factory:this.factory,options:this.options}):this.report,results:this.results,shape:n,value:i,valueOrNode:s,valuePaths:a,values:o})}id({shape:e=this.shape}={}){return`${Je(e.ptr.term)} - ${Je(this.focusNode.term)} - ${ph(this.valuePaths)}`}result(e){const t=new Oh({factory:this.factory,focusNode:this.focusNode,shape:this.shape,value:this.value,valuePaths:this.valuePaths,...e}),n=this.id();this.results.has(n)?this.results.get(n).add(t):this.results.set(n,new Set([t])),this.report.results.push(t)}debug(e,t){this.options.debug&&this.result({severity:Ms.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:Ms.Trace,constraintComponent:e,...t})}test(e,t,n){e?this.debug(t,n):this.violation(t,n)}violation(e,t){this.result({constraintComponent:e,severity:this.shape.severity||ne.Violation,...t})}}function $h(){return{generic:kh()}}function kh(){return r=>{r.trace(Ms.TraversalConstraintComponent,{args:{},message:[r.factory.literal("Traversal")],value:r.valueOrNode})}}class Dh{constructor(e){this.validations=new cr(e)}compile(e){const t=e.validator.options.coverage;if(e.deactivated)return[];let n=!1;const i=new Set;for(const s of e.ptr.execute({start:"subject",end:"predicate"})){const a=this.validations.get(s.term);a&&(i.add(a),s.term.equals(ne.property)&&(n=!0))}return t&&e.isPropertyShape&&!n&&i.add($h),[...i].map(s=>s(e)).filter(Boolean)}}var $t={},kt={},xr={},Vl;function ac(){if(Vl)return xr;Vl=1,Object.defineProperty(xr,"__esModule",{value:!0}),xr.BlankNode=void 0;let r=class{constructor(t){this.termType="BlankNode",this.value=t}equals(t){return!!t&&t.termType==="BlankNode"&&t.value===this.value}};return xr.BlankNode=r,xr}var Sr={},Er={},Gl;function oc(){if(Gl)return Er;Gl=1,Object.defineProperty(Er,"__esModule",{value:!0}),Er.DefaultGraph=void 0;let r=class{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&t.termType==="DefaultGraph"}};return Er.DefaultGraph=r,r.INSTANCE=new r,Er}var Ir={},Rr={},Wl;function pa(){if(Wl)return Rr;Wl=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.NamedNode=void 0;let r=class{constructor(t){this.termType="NamedNode",this.value=t}equals(t){return!!t&&t.termType==="NamedNode"&&t.value===this.value}};return Rr.NamedNode=r,Rr}var zl;function lc(){if(zl)return Ir;zl=1,Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.Literal=void 0;const r=pa();let e=class Pr{constructor(n,i){this.termType="Literal",this.value=n,typeof i=="string"?(this.language=i,this.datatype=Pr.RDF_LANGUAGE_STRING,this.direction=""):i?"termType"in i?(this.language="",this.datatype=i,this.direction=""):(this.language=i.language,this.datatype=i.direction?Pr.RDF_DIRECTIONAL_LANGUAGE_STRING:Pr.RDF_LANGUAGE_STRING,this.direction=i.direction||""):(this.language="",this.datatype=Pr.XSD_STRING,this.direction="")}equals(n){return!!n&&n.termType==="Literal"&&n.value===this.value&&n.language===this.language&&(n.direction===this.direction||!n.direction&&this.direction==="")&&this.datatype.equals(n.datatype)}};return Ir.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"),Ir}var Nr={},Jl;function uc(){if(Jl)return Nr;Jl=1,Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.Quad=void 0;let r=class{constructor(t,n,i,s){this.termType="Quad",this.value="",this.subject=t,this.predicate=n,this.object=i,this.graph=s}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 Nr.Quad=r,Nr}var Tr={},Ql;function cc(){if(Ql)return Tr;Ql=1,Object.defineProperty(Tr,"__esModule",{value:!0}),Tr.Variable=void 0;let r=class{constructor(t){this.termType="Variable",this.value=t}equals(t){return!!t&&t.termType==="Variable"&&t.value===this.value}};return Tr.Variable=r,Tr}var Xl;function Mh(){if(Xl)return Sr;Xl=1,Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.DataFactory=void 0;const r=ac(),e=oc(),t=lc(),n=pa(),i=uc(),s=cc();let a=0,o=class{constructor(d){this.blankNodeCounter=0,d=d||{},this.blankNodePrefix=d.blankNodePrefix||`df_${a++}_`}namedNode(d){return new n.NamedNode(d)}blankNode(d){return new r.BlankNode(d||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(d,h){return new t.Literal(d,h)}variable(d){return new s.Variable(d)}defaultGraph(){return e.DefaultGraph.INSTANCE}quad(d,h,y,w){return new i.Quad(d,h,y,w||this.defaultGraph())}fromTerm(d){switch(d.termType){case"NamedNode":return this.namedNode(d.value);case"BlankNode":return this.blankNode(d.value);case"Literal":return d.language?this.literal(d.value,d.language):d.datatype.equals(t.Literal.XSD_STRING)?this.literal(d.value):this.literal(d.value,this.fromTerm(d.datatype));case"Variable":return this.variable(d.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(d.subject),this.fromTerm(d.predicate),this.fromTerm(d.object),this.fromTerm(d.graph))}}fromQuad(d){return this.fromTerm(d)}resetBlankNodeCounter(){this.blankNodeCounter=0}};return Sr.DataFactory=o,Sr}var Kl;function Ch(){return Kl||(Kl=1,function(r){var e=kt&&kt.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=kt&&kt.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(ac(),r),t(Mh(),r),t(oc(),r),t(lc(),r),t(pa(),r),t(uc(),r),t(cc(),r)}(kt)),kt}var Dt={},Ar={},Lr={},Yl;function ar(){if(Yl)return Lr;Yl=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.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,n,i){for(const s of n)this.supportedRdfDatatypes.push(s),this.fromRdfHandlers[s.value]=t;for(const s of i){let a=this.toRdfHandlers[s];a||(this.toRdfHandlers[s]=a=[]),a.push(t)}}fromRdf(t,n){const i=this.fromRdfHandlers[t.datatype.value];return i?i.fromRdf(t,n):t.value}toRdf(t,n){const i=this.toRdfHandlers[typeof t];if(i)for(const s of i){const a=s.toRdf(t,n);if(a)return a}throw new Error(`Invalid JavaScript value: '${t}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}};return Lr.Translator=r,Lr}var Zl;function Ph(){if(Zl)return Ar;Zl=1,Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.TypeHandlerBoolean=void 0;const r=ar();let e=class dc{fromRdf(n,i){switch(n.value){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1}return i&&r.Translator.incorrectRdfDataType(n),!1}toRdf(n,{datatype:i,dataFactory:s}){return s.literal(n?"true":"false",i||s.namedNode(dc.TYPE))}};return Ar.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",Ar}var jr={},eu;function qh(){if(eu)return jr;eu=1,Object.defineProperty(jr,"__esModule",{value:!0}),jr.TypeHandlerDate=void 0;const r=ar();let e=class Cs{fromRdf(n,i){switch(i&&!n.value.match(Cs.VALIDATORS[n.datatype.value.substr(33,n.datatype.value.length)])&&r.Translator.incorrectRdfDataType(n),n.datatype.value){case"http://www.w3.org/2001/XMLSchema#gDay":return new Date(0,0,parseInt(n.value,10));case"http://www.w3.org/2001/XMLSchema#gMonthDay":const s=n.value.split("-");return new Date(0,parseInt(s[0],10)-1,parseInt(s[1],10));case"http://www.w3.org/2001/XMLSchema#gYear":return new Date(n.value+"-01-01");case"http://www.w3.org/2001/XMLSchema#gYearMonth":return new Date(n.value+"-01");default:return new Date(n.value)}}toRdf(n,{datatype:i,dataFactory:s}){if(i=i||s.namedNode(Cs.TYPES[0]),!(n instanceof Date))return null;const a=n;let o;switch(i.value){case"http://www.w3.org/2001/XMLSchema#gDay":o=String(a.getUTCDate());break;case"http://www.w3.org/2001/XMLSchema#gMonthDay":o=a.getUTCMonth()+1+"-"+a.getUTCDate();break;case"http://www.w3.org/2001/XMLSchema#gYear":o=String(a.getUTCFullYear());break;case"http://www.w3.org/2001/XMLSchema#gYearMonth":o=a.getUTCFullYear()+"-"+(a.getUTCMonth()+1);break;case"http://www.w3.org/2001/XMLSchema#date":o=a.toISOString().replace(/T.*$/,"");break;default:o=a.toISOString()}return s.literal(o,i)}};return jr.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]$/},jr}var Or={},tu;function Bh(){if(tu)return Or;tu=1,Object.defineProperty(Or,"__esModule",{value:!0}),Or.TypeHandlerNumberDouble=void 0;const r=ar();let e=class fc{fromRdf(n,i){const s=parseFloat(n.value);return i&&isNaN(s)&&r.Translator.incorrectRdfDataType(n),s}toRdf(n,{datatype:i,dataFactory:s}){return i=i||s.namedNode(fc.TYPES[0]),isNaN(n)?s.literal("NaN",i):isFinite(n)?n%1===0?null:s.literal(n.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),i):s.literal(n>0?"INF":"-INF",i)}};return Or.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"],Or}var $r={},ru;function Fh(){if(ru)return $r;ru=1,Object.defineProperty($r,"__esModule",{value:!0}),$r.TypeHandlerNumberInteger=void 0;const r=ar();let e=class qr{fromRdf(n,i){const s=parseInt(n.value,10);return i&&(isNaN(s)||n.value.indexOf(".")>=0)&&r.Translator.incorrectRdfDataType(n),s}toRdf(n,{datatype:i,dataFactory:s}){return s.literal(String(n),i||(n<=qr.MAX_INT&&n>=qr.MIN_INT?s.namedNode(qr.TYPES[0]):s.namedNode(qr.TYPES[1])))}};return $r.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,$r}var kr={},nu;function Uh(){if(nu)return kr;nu=1,Object.defineProperty(kr,"__esModule",{value:!0}),kr.TypeHandlerString=void 0;let r=class{fromRdf(t){return t.value}toRdf(t,{datatype:n,dataFactory:i}){return i.literal(t,n)}};return kr.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"],kr}var iu;function su(){return iu||(iu=1,function(r){var e=Dt&&Dt.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=Dt&&Dt.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(Ph(),r),t(qh(),r),t(Bh(),r),t(Fh(),r),t(Uh(),r)}(Dt)),Dt}var Es={},au;function Hh(){return au||(au=1,Object.defineProperty(Es,"__esModule",{value:!0})),Es}var ou;function Vh(){return ou||(ou=1,function(r){var e=$t&&$t.__createBinding||(Object.create?function(g,m,_,x){x===void 0&&(x=_);var S=Object.getOwnPropertyDescriptor(m,_);(!S||("get"in S?!m.__esModule:S.writable||S.configurable))&&(S={enumerable:!0,get:function(){return m[_]}}),Object.defineProperty(g,x,S)}:function(g,m,_,x){x===void 0&&(x=_),g[x]=m[_]}),t=$t&&$t.__exportStar||function(g,m){for(var _ in g)_!=="default"&&!Object.prototype.hasOwnProperty.call(m,_)&&e(m,g,_)};Object.defineProperty(r,"__esModule",{value:!0}),r.fromRdf=l,r.toRdf=d,r.getTermRaw=h,r.getSupportedRdfDatatypes=y,r.getSupportedJavaScriptPrimitives=w;const n=Ch(),i=su(),s=ar();t(su(),r),t(Hh(),r),t(ar(),r);const a=new n.DataFactory,o=new s.Translator;o.registerHandler(new i.TypeHandlerString,i.TypeHandlerString.TYPES.map(g=>a.namedNode(g)),["string"]),o.registerHandler(new i.TypeHandlerBoolean,[i.TypeHandlerBoolean.TYPE].map(g=>a.namedNode(g)),["boolean"]),o.registerHandler(new i.TypeHandlerNumberDouble,i.TypeHandlerNumberDouble.TYPES.map(g=>a.namedNode(g)),["number"]),o.registerHandler(new i.TypeHandlerNumberInteger,i.TypeHandlerNumberInteger.TYPES.map(g=>a.namedNode(g)),["number"]),o.registerHandler(new i.TypeHandlerDate,i.TypeHandlerDate.TYPES.map(g=>a.namedNode(g)),["object"]);function l(g,m){return o.fromRdf(g,m)}function d(g,m){return m&&"namedNode"in m&&(m={dataFactory:m}),m=m||{},m&&!m.dataFactory&&(m.dataFactory=a),o.toRdf(g,m)}function h(g,m){return g.termType==="Literal"?l(g,m):g.value}function y(){return o.getSupportedRdfDatatypes()}function w(){return o.getSupportedJavaScriptPrimitives()}}($t)),$t}var Qr=Vh();function lu(r){if(r.term.termType!=="BlankNode")return{quantifier:"one",start:"subject",end:"object",predicates:[r.term]};const e=r.out([ne.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([ne.inversePath]);if(t.term)return{quantifier:"one",start:"object",end:"subject",predicates:[t.term]};const n=r.out([ne.oneOrMorePath]);if(n.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[n.term]};const i=r.out([ne.zeroOrMorePath]);if(i.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[i.term]};const s=r.out([ne.zeroOrOnePath]);if(s.term)return{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[s.term]}}function Gh(r){return r.terms.length===0?null:r.ptrs[0].isList()?[...r.list()].map(e=>lu(e)):[lu(r)]}class Wh{constructor(e){this.shape=e,this._compiled=st(()=>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 n of this.compiled)n.node&&await n.node(t),n.generic&&await n.generic(t)}async validateProperty(e){let t;this.shape.isSparqlShape?t=e.focusNode:t=e.focusNode.executeAll(this.shape.path);const n=t.node(new tt(t.terms)),i=[...t].reduce((a,o)=>{const l=o.term,d=t.node([l]);return a.has(l)||a.set(l,{value:d,valuePaths:[]}),a.get(l).valuePaths.push(o),a},new cr).values(),s=e.create({shape:this.shape,values:n});for(const a of this.compiled)a.property&&await a.property(s);for(const{value:a,valuePaths:o}of i){const l=e.create({shape:this.shape,value:a,valueOrNode:a,valuePaths:o});for(const d of this.compiled)d.generic&&await d.generic(l)}}}function Ps(r){const e=new tt,n=new En({dataset:r.dataset,terms:r.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[fh.subClassOf]});for(const i of n.ptrs)for(const{term:s}of i.nodes())e.add(s);return e}class zh{constructor(e){this.targetClass=new tt([...Ps(e.hasOut([Ht.type],[ne.NodeShape])),...Ps(e.out([ne.targetClass]))]),this.targetNode=e.out([ne.targetNode]).terms,this.targetObjectsOf=e.out([ne.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([ne.targetSubjectsOf]).terms}resolve(e){const t=e.focusNode.node([null]),n=[...e.focusNode.hasOut([Ht.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],i=e.focusNode.clone({ptrs:n});return i.node([...new tt(i.terms)])}}class Jh{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=st(()=>{const n=this.ptr.out([ne.deactivated]).term;return n&&Qr.fromRdf(n)}),this._message=st(()=>this.ptr.out([ne.message]).terms),this._path=st(()=>Gh(this.ptr.out([ne.path]))),this._severity=st(()=>this.ptr.out([ne.severity]).term),this._shapeValidator=st(()=>new Wh(this)),this._sparql=st(()=>this.ptr.out([ne.sparql])),this._targetResolver=st(()=>new zh(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 n of e.results.get(t))e.report.results.push(n);return e}return e.processed.add(t),this.shapeValidator.validate(e)}}function Qh(r){const e=parseInt(r.ptr.out([ne.maxCount]).value);return{property:Xh(e)}}function Xh(r){return e=>{e.test(e.values.terms.length<=r,ne.MaxCountConstraintComponent,{args:{maxCount:r},message:[e.factory.literal("More than {$maxCount} values")]})}}function Kh(r){const e=parseInt(r.ptr.out([ne.minCount]).value);return{property:Yh(e)}}function Yh(r){return e=>{e.test(e.values.terms.length>=r,ne.MinCountConstraintComponent,{args:{minCount:r},message:[e.factory.literal("Less than {$minCount} values")]})}}async function Zh(r,e){for(const t of r)if(!await e(t))return!1;return!0}async function ep(r,e){return(await Promise.all(r.map(t=>e(t)))).filter(Boolean)}async function Cn(r,e){return Promise.all(r.map(e))}async function tp(r,e){for(const t of r)if(await e(t))return!0;return!1}function rp(r){const e=[...r.ptr.out([ne.and])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:np(e)}}function np(r){return async e=>{const t=await Cn(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),n=t.every(i=>i.conforms);e.test(n,ne.AndConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function ip(r){const e=r.validator.shape(r.ptr.out([ne.not]));return{generic:sp(e)}}function sp(r){return async e=>{const t=(await r.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,n=!t.conforms;e.test(n,ne.NotConstraintComponent,{args:{not:r.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:t.results,value:e.valueOrNode})}}function ap(r){const e=[...r.ptr.out([ne.or])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:op(e)}}function op(r){return async e=>{let t=[],n;if(e.options.debug||e.options.details){const i=await Cn(r,async s=>(await s.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report);t=i.flatMap(s=>s.results),n=i.some(s=>s.conforms)}else n=await tp(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms);e.test(n,ne.OrConstraintComponent,{results:t,value:e.valueOrNode})}}function lp(r){const e=[...r.ptr.out([ne.xone])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:up(e)}}function up(r){return async e=>{const t=await Cn(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),n=t.filter(i=>i.conforms).length===1;e.test(n,ne.XoneConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function cp(r){if(!Qr.fromRdf(r.ptr.out([ne.closed]).term))return null;const t=r.ptr.out([ne.property]).map(s=>r.validator.shape(s)),n=new tt(t.filter(s=>!s.deactivated).map(s=>s.path[0].predicates[0])),i=new tt([...r.ptr.out([ne.ignoredProperties]).list()||[]].map(s=>s.term));return{node:dp(n,i)}}function dp(r,e){return t=>{const n=t.focusNode.execute({start:"subject",end:"predicate"}).filter(i=>e.has(i.term)?!1:!r.has(i.term));if(n.ptrs.length>0)for(const i of n)t.violation(ne.ClosedConstraintComponent,{message:[t.factory.literal("Predicate is not allowed (closed shape)")],path:[{quantifier:"one",start:"subject",end:"object",predicates:[i.term]}],value:t.focusNode.node([[...i.quads()][0].object])});else t.debug(ne.ClosedConstraintComponent)}}function fp(r){const e=r.ptr.out([ne.hasValue]).term;return{node:hp(e),property:pp(e)}}function hp(r){return e=>{e.test(r.equals(e.valueOrNode.term),ne.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Value must be {$hasValue}")]})}}function pp(r){return e=>{const t=[...e.values].some(n=>r.equals(n.term));e.test(t,ne.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Missing expected value {$hasValue}")]})}}function gp(r){const e=new tt([...r.ptr.out([ne.in]).list()].map(t=>t.term));return{generic:yp(e)}}function yp(r){return e=>{e.test(r.has(e.valueOrNode.term),ne.InConstraintComponent,{args:{in:[...r].map(t=>t.value).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})}}function dr(r,e){if(!r||r.termType!=="Literal"||!e||e.termType!=="Literal"||uu(r)!==uu(e))return null;const t=Qr.fromRdf(r),n=Qr.fromRdf(e);return typeof t!=typeof n?null:typeof t=="string"?t.localeCompare(n):t-n}function uu(r){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return fa.dateTime.equals(r.datatype)&&e.test(r.value)}function mp(r){const e=r.ptr.out([ne.disjoint]).term;return{generic:bp(e)}}function bp(r){return e=>{const t=e.focusNode.dataset.match(e.focusNode.term,r,e.valueOrNode.term);e.test(t.size===0,ne.DisjointConstraintComponent,{args:{disjoint:r},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})}}function wp(r){const e=r.ptr.out([ne.equals]).term;return{node:vp(e),property:_p(e)}}function vp(r){return e=>{const t=e.focusNode.out([r]),n=t.filter(s=>!s.term.equals(e.focusNode.term)),i=t.terms.length!==0&&n.terms.length===0;e.test(i,ne.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:n.terms[0]&&e.focusNode.node([n.terms[0]])||e.focusNode})}}function _p(r){return e=>{const t=new tt(e.focusNode.out([r]).terms),n=new tt(e.values.terms),i=[...n].filter(o=>!t.has(o)),s=[...t].filter(o=>!n.has(o)),a=[...i,...s];for(const o of a)e.violation(ne.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:e.focusNode.node([o])});a.length===0&&e.debug(ne.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")]})}}function xp(r){const e=r.ptr.out([ne.lessThan]).term;return{property:Sp(e)}}function Sp(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=dr(n.term,i);s===null||s>=0?e.violation(ne.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n}):e.debug(ne.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n})}}}function Ep(r){const e=r.ptr.out([ne.lessThanOrEquals]).term;return{property:Ip(e)}}function Ip(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=dr(n.term,i);s===null||s>0?e.violation(ne.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n}):e.debug(ne.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n})}}}function Rp(r){const e=r.ptr.out([ne.maxExclusive]).term;return{generic:Np(e)}}function Np(r){return e=>{const t=dr(e.valueOrNode.term,r);e.test(t!==null&&t<0,ne.MaxExclusiveConstraintComponent,{args:{maxExclusive:r},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})}}function Tp(r){const e=r.ptr.out([ne.maxInclusive]).term;return{generic:Ap(e)}}function Ap(r){return e=>{const t=dr(e.valueOrNode.term,r);e.test(t!==null&&t<=0,ne.MaxInclusiveConstraintComponent,{args:{maxInclusive:r},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})}}function Lp(r){const e=r.ptr.out([ne.minExclusive]).term;return{generic:jp(e)}}function jp(r){return e=>{const t=dr(e.valueOrNode.term,r);e.test(t!==null&&t>0,ne.MinExclusiveConstraintComponent,{args:{minExclusive:r},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})}}function Op(r){const e=r.ptr.out([ne.minInclusive]).term;return{generic:$p(e)}}function $p(r){return e=>{const t=dr(e.valueOrNode.term,r);e.test(t!==null&&t>=0,ne.MinInclusiveConstraintComponent,{args:{minInclusive:r},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})}}function kp(r){const e=[...r.ptr.out([ne.node])].map(t=>r.validator.shape(t));return{generic:Dp(e)}}function Dp(r){return async e=>{for(const t of r){const n=await t.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(n.report.conforms,ne.NodeConstraintComponent,{args:{node:t.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:n.report.results,value:e.valueOrNode})}}}function Mp(r){const e=[...r.ptr.out([ne.property])].map(t=>r.validator.shape(t));return{generic:Cp(e)}}function Cp(r){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const n of r)await n.validate(t)}}function Pp(r){const e=r.validator.shape(r.ptr.out([ne.qualifiedValueShape])),t=r.ptr.out([ne.qualifiedValueShapesDisjoint]).term,n=t?Qr.fromRdf(t):!1,i=r.ptr.out([ne.qualifiedMaxCount]).term,s=i?parseInt(i.value):null,a=r.ptr.out([ne.qualifiedMinCount]).term,o=a?parseInt(a.value):null;return{property:qp(e,n,s,o)}}function qp(r,e,t,n){return async i=>{const s=[];let a=[];e&&(a=new Set(i.shape.ptr.in([ne.property]).out([ne.property]).out([ne.qualifiedValueShape]).filter(l=>!l.term.equals(r.ptr.term)).map(l=>i.shape.validator.shape(l))));const o=(await ep(i.values,async l=>{const d=(await r.validate(i.create({child:!0,focusNode:l}))).report;if(s.push(d.results),!d.conforms)return!1;if(a.length===0)return!0;if(i.options.debug||i.options.details){const h=await Cn([...a],async y=>(await y.validate(i.create({child:!0,focusNode:l}))).report);return s.push(h.flatMap(y=>y.results)),!h.every(y=>y.conforms)}else return!await Zh([...a],async h=>(await h.validate(i.create({child:!0,focusNode:l}))).report.conforms)})).length;t!==null&&i.test(o<=t,ne.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:t,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[i.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:s.flat()}),n!==null&&i.test(o>=n,ne.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:n,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[i.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:s.flat()})}}function Bp(r,e){return e?e.slice(0,r.length)===r:!1}function Fp(r){const e=[...new Set([...r.ptr.out([ne.languageIn]).list()].map(t=>t.value))];return{generic:Up(e)}}function Up(r){return e=>{const t=r.some(n=>Bp(n,e.valueOrNode.term.language));e.test(t,ne.LanguageInConstraintComponent,{args:{languageIn:r.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})}}function Hp(r){const e=parseInt(r.ptr.out([ne.maxLength]).value);return{generic:Vp(e)}}function Vp(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length<=r;e.test(t,ne.MaxLengthConstraintComponent,{args:{maxLength:r},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})}}function Gp(r){const e=parseInt(r.ptr.out([ne.minLength]).value);return{generic:Wp(e)}}function Wp(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length>=r;e.test(t,ne.MinLengthConstraintComponent,{args:{minLength:r},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})}}function zp(r){const e=r.ptr.out([ne.pattern]).value,t=r.ptr.out([ne.flags]).value,n=new RegExp(e,t);return{generic:Jp(e,t,n)}}function Jp(r,e,t){return n=>{n.test(t.test(n.valueOrNode.term.value),ne.PatternConstraintComponent,{args:{flags:e,pattern:r},message:[n.factory.literal('Value does not match pattern "{$pattern}"')],value:n.valueOrNode})}}function Qp(r){const e=r.ptr.out([ne.uniqueLang]).term;return e.value==="true"&&fa.boolean.equals(e.datatype)?{property:Xp()}:null}function Xp(){return r=>{const t=Object.entries(r.values.terms.reduce((n,i)=>(i.language&&(n[i.language]=(n[i.language]||0)+1),n),{})).filter(([,n])=>n>1);for(const[n]of t)r.violation(ne.UniqueLangConstraintComponent,{args:{lang:n},message:[r.factory.literal('Language "{?lang}" used more than once')]});t.length===0&&r.debug(ne.UniqueLangConstraintComponent)}}const bn=nt("http://www.w3.org/ns/shacl#"),hc=nt("https://schemas.link/shacl-next#");class or{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(bn.Info)||e.severity.equals(bn.Violation)||e.severity.equals(bn.Warning))}}function Kp(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=Je(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}class In{constructor({args:e={},factory:t,message:n=[],severity:i=bn.Violation}={}){this.severity=i,this.message=n.map(s=>t.literal(Kp(s.value,e),s.language||null))}}class ga{constructor({factory:e=da}={}){this.factory=e}clone({factory:e}={}){return new ga({factory:e||this.factory})}validate(){return new or}validateSimple(){return!0}}class fr extends ga{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(const n of Array.isArray(e)?e:[e])n&&this.datatypes.push(this.factory.fromTerm(n))}clone({factory:e}={}){return new fr({datatypes:this.datatypes,factory:e||this.factory})}}class Yp{constructor({factory:e=da,validations:t}={}){if(this.factory=e,this.validations=new cr,t)for(const n of Object.values(t)){const i=n.clone({factory:this.factory});for(const s of i.datatypes)this.validations.set(s,i)}}validate(e){const t=this.validations.get(e.datatype);return t?t.validate(e):new or}validateSimple(e){const t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}}class Ae extends fr{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.message=[this.factory.literal("term value {$this} matches pattern {$pattern}")],this.patterns=Array.isArray(e)?e:[e]}clone({factory:e}={}){return new Ae(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map(n=>{let i;n.test(e.value)&&(i=hc.Debug);const s={pattern:this.factory.literal(n.toString()),this:e};return new In({args:s,factory:this.factory,message:this.message,severity:i})});return new or({results:t})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}}const Zp=/^([-+]?[0-9]+)$/;class We extends Ae{constructor(e=null,t=null,n,{factory:i}={}){super(Zp,n,{factory:i}),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 We(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!hc.Debug.equals(t[0].severity))return new or({results:t});const n=BigInt(e.value);if(this.minInclusive!==null&&n<this.minInclusive){const i=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,s=[this.factory.literal(i)];t.push(new In({factory:this.factory,message:s}))}if(this.maxInclusive!==null&&n>this.maxInclusive){const i=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,s=[this.factory.literal(i)];t.push(new In({factory:this.factory,message:s}))}return new or({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 ya extends fr{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.values=new Set(e)}clone({factory:e}={}){return new ya(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const n=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,i=[this.factory.literal(n)];t.push(new In({factory:this.factory,message:i}))}return new or({results:t})}validateSimple(e){return this.values.has(e.value)}}const Se={xsd:nt("http://www.w3.org/2001/XMLSchema#")},eg=new fr({datatypes:Se.xsd.anySimpleType}),tg=new fr({datatypes:Se.xsd.anyAtomicType}),Pn=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,rg=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,pc=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,ma=/^(-?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)))))$/,gc=/^(-?([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))?)$/,ng=/^((([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))?)$/,ig=/^(-?([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))?)$/,sg=/^(-?([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))?)$/,ag=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,og=/^(--(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))?)$/,lg=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,ug=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,cg=/^(([0-9a-fA-F]{2})*)$/,dg=/^(((([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] ?= ?=))?)$/,fg=new Ae(Pn,Se.xsd.string),hg=new ya(["1","true","0","false"],Se.xsd.boolean),pg=new Ae(rg,Se.xsd.decimal),gg=new Ae(pc,Se.xsd.float),yg=new Ae(pc,Se.xsd.double),mg=new Ae(ma,Se.xsd.duration),bg=new Ae(gc,Se.xsd.dateTime),wg=new Ae(ng,Se.xsd.time),vg=new Ae(ig,Se.xsd.date),_g=new Ae(sg,Se.xsd.gYearMonth),xg=new Ae(ag,Se.xsd.gYear),Sg=new Ae(og,Se.xsd.gMonthDay),Eg=new Ae(lg,Se.xsd.gDay),Ig=new Ae(ug,Se.xsd.gMonth),Rg=new Ae(cg,Se.xsd.hexBinary),Ng=new Ae(dg,Se.xsd.base64Binary),Tg=new Ae(Pn,Se.xsd.anyURI),yc=/^([^\u000d\u000a\u0009]*)$/,Ag=/^([^ ]+( [^ ]+)*)*$/,Lg=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,jg=/^([^DT]*)$/,Og=/^([^YM]*[DT].*)$/,$g=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,kg=new Ae([Pn,yc],Se.xsd.normalizedString),Dg=new Ae([Pn,yc,Ag],Se.xsd.token),Mg=new Ae(Lg,Se.xsd.language),Cg=new We(null,null,Se.xsd.integer),Pg=new We(null,"0",Se.xsd.nonPositiveInteger),qg=new We(null,"-1",Se.xsd.negativeInteger),Bg=new We("-9223372036854775808","9223372036854775807",Se.xsd.long),Fg=new We("-2147483648","2147483647",Se.xsd.int),Ug=new We("-32768","32767",Se.xsd.short),Hg=new We("-128","127",Se.xsd.byte),Vg=new We("0",null,Se.xsd.nonNegativeInteger),Gg=new We("0","18446744073709551615",Se.xsd.unsignedLong),Wg=new We("0","4294967295",Se.xsd.unsignedInt),zg=new We("0","65535",Se.xsd.unsignedShort),Jg=new We("0","255",Se.xsd.unsignedByte),Qg=new We("1",null,Se.xsd.positiveInteger),Xg=new Ae([ma,jg],Se.xsd.yearMonthDuration),Kg=new Ae([ma,Og],Se.xsd.dayTimeDuration),Yg=new Ae([gc,$g],Se.xsd.dateTimeStamp),Zg=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:tg,anySimpleType:eg,anyURI:Tg,base64Binary:Ng,boolean:hg,byte:Hg,date:vg,dateTime:bg,dateTimeStamp:Yg,dayTimeDuration:Kg,decimal:pg,double:yg,duration:mg,float:gg,gDay:Eg,gMonth:Ig,gMonthDay:Sg,gYear:xg,gYearMonth:_g,hexBinary:Rg,int:Fg,integer:Cg,language:Mg,long:Bg,negativeInteger:qg,nonNegativeInteger:Vg,nonPositiveInteger:Pg,normalizedString:kg,positiveInteger:Qg,short:Ug,string:fg,time:wg,token:Dg,unsignedByte:Jg,unsignedInt:Wg,unsignedLong:Gg,unsignedShort:zg,yearMonthDuration:Xg},Symbol.toStringTag,{value:"Module"}));class ey extends Yp{constructor({factory:e}={}){super({factory:e,validations:{...Zg}})}}const ty=new cr([[ne.BlankNode,new Set(["BlankNode"])],[ne.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[ne.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[ne.IRI,new Set(["NamedNode"])],[ne.IRIOrLiteral,new Set(["NamedNode","Literal"])],[ne.Literal,new Set(["Literal"])]]);function ry(r){const e=r.ptr.out([ne.class]).map(t=>Ps(t));return{generic:ny(e)}}function ny(r){return e=>{const t=new tt(e.valueOrNode.out([Ht.type]).terms);for(const n of r){const i=[...t].some(s=>n.has(s));e.test(i,ne.ClassConstraintComponent,{value:e.valueOrNode})}}}function iy(r){const e=r.ptr.out([ne.datatype]).term,t=new ey;return{generic:sy(e,t)}}function sy(r,e){return t=>{const n=r.equals(t.valueOrNode.term.datatype)&&e.validateSimple(t.valueOrNode.term);t.test(n,ne.DatatypeConstraintComponent,{args:{datatype:r},message:[t.factory.literal("Value does not have datatype {$datatype}")],value:t.valueOrNode})}}function ay(r){const e=r.ptr.out([ne.nodeKind]).term,t=ty.get(e);return{generic:oy(e,t)}}function oy(r,e){return t=>{t.test(e.has(t.valueOrNode.term.termType),ne.NodeKindConstraintComponent,{args:{nodeKind:r},message:[t.factory.literal("Value does not have node kind {$nodeKind}")],value:t.valueOrNode})}}const ly=new cr([[ne.maxCount,Qh],[ne.minCount,Kh],[ne.and,rp],[ne.not,ip],[ne.or,ap],[ne.xone,lp],[ne.closed,cp],[ne.hasValue,fp],[ne.in,gp],[ne.disjoint,mp],[ne.equals,wp],[ne.lessThan,xp],[ne.lessThanOrEquals,Ep],[ne.maxExclusive,Rp],[ne.maxInclusive,Tp],[ne.minExclusive,Lp],[ne.minInclusive,Op],[ne.node,kp],[ne.property,Mp],[ne.qualifiedValueShape,Pp],[ne.languageIn,Fp],[ne.maxLength,Hp],[ne.minLength,Gp],[ne.pattern,zp],[ne.uniqueLang,Qp],[ne.class,ry],[ne.datatype,iy],[ne.nodeKind,ay]]);class uy{constructor(e,{factory:t,...n}){if(this.factory=t,this.options=n,this.registry=new Dh(ly),this.shapesPtr=new En({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[s,a]of this.options.validations)this.registry.validations.set(s,a);const i=[...this.shapesPtr.hasOut([ne.targetClass]),...this.shapesPtr.hasOut([ne.targetNode]),...this.shapesPtr.hasOut([ne.targetObjectsOf]),...this.shapesPtr.hasOut([ne.targetSubjectsOf]),...this.shapesPtr.hasOut([Ht.type],[ne.NodeShape]),...this.shapesPtr.hasOut([Ht.type],[ne.PropertyShape])];for(const s of i)this.shape(s)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new Jh(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const n=new En({...e,factory:this.factory}),i=new ha({factory:this.factory,focusNode:n,options:this.options,validator:this});t?t=t.map(s=>this.shape(this.shapesPtr.node(s.terms))):t=this.shapes.values();for(const s of t){const a=i.create({shape:s});let o;n.isAny()?o=s.resolveTargets(a):o=n;for(const l of o)await s.validate(a.create({focusNode:l}))}return i.report}}let cy=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new bl(e,this.form),this.form.addEventListener("change",t=>{t.stopPropagation(),this.config.editMode&&this.validate(!0).then(n=>{this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:n.conforms,report:n}}))}).catch(n=>{console.warn(n)})})}static get observedAttributes(){return bl.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(n=>{this.form.classList.remove(n)}),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 n of bd())n.stylesheet&&t.push(n.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new Nt(e,this.config,this.config.attributes.valuesSubject?xe.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.editMode){if(this.config.attributes.submitButton!==null){const n=this.config.theme.createButton(this.config.attributes.submitButton||"Submit",!0);n.addEventListener("click",i=>{i.preventDefault(),this.form.reportValidity()&&this.validate().then(s=>{if(s?.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(n)}this.config.attributes.valuesSubject&&this.removeFromDataGraph(xe.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,wn)>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 n=t.getQuads(null,null,null,null);return pd(n,e,this.config.prefixes)}toRDF(e=new Fe){return this.shape?.toRDF(e),e}registerPlugin(e){md(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setSharedShapesGraph(e){Xf(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 Nn(this.shape.shaclSubject,xe.namedNode(be+"targetNode"),this.shape.nodeId,this.config.valuesGraphId));try{const t=this.config.store,n=await new uy(t,{details:!0,factory:xe}).validate({dataset:t});for(const i of n.results)if(i.focusNode?.ptrs?.length)for(const s of i.focusNode.ptrs){const a=s._term;if(i.path?.length){const o=i.path[0].predicates[0];let l=this.form.querySelectorAll(`
369
+ `}function Wf(){return""}function Vc(r){return"<"+r.value+">"}const zf=/["\\\\\n\r]/,Xf=/["\\\\\n\r]/g,Qf={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function Jf(r){return Qf[r]}function Kf(r){return zf.test(r)?r.replace(Xf,Jf):r}function Yf(r){const e=Kf(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+'"^^'+Vc(r.datatype)}function Zf(r,e){const t=e(r.subject),n=e(r.predicate),i=e(r.object),s=e(r.graph);return`${t} ${n} ${i} ${s?s+" ":""}.`}function ep(r){return"?"+r.value}function at(r){if(!r)return null;if(r.termType==="BlankNode")return Vf(r);if(r.termType==="DefaultGraph")return Wf();if(r.termType==="Literal")return Yf(r);if(r.termType==="NamedNode")return Vc(r);if(r.termType==="Quad"||r.subject&&r.predicate&&r.object&&r.graph)return Zf(r,at);if(r.termType==="Variable")return ep(r);if(r[Symbol.iterator])return Gf(r,at);throw new Error(`unknown termType ${r.termType}`)}class Cr{constructor(e){if(this.index=new Map,e)for(const[t,n]of e)this.set(t,n)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(at(e))}*entries(){for(const[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(const n of this.entries())e.call(t,n[1],n[0],this)}get(e){const t=this.index.get(at(e));return t&&t.value}has(e){return this.index.has(at(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const n=at(e);return this.index.set(n,{term:e,value:t}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}class lu{constructor({dataset:e,end:t,quad:n,start:i}){this.dataset=e,this.end=t,this.quad=n,this.start=i}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}}function uu(r){try{return at(r)}catch{return null}}class ht{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=at(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(uu(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(uu(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 Ma{equals(e){return!!e&&e.termType===this.termType}}Ma.prototype.termType="DefaultGraph";Ma.prototype.value="";function cu(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),n=r.fromTerm(e.predicate),i=r.fromTerm(e.object),s=r.fromTerm(e.graph);return r.quad(t,n,i,s)}if(e.termType==="Variable")return r.variable(e.value);throw new Error(`unknown termType ${e.termType}`)}class Xn{constructor(e,t,n,i=""){this.value=e,this.language=t,this.datatype=n,this.direction=i}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}}Xn.prototype.termType="Literal";class In{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}In.prototype.termType="NamedNode";class Ba{constructor(e,t,n,i){this.subject=e,this.predicate=t,this.object=n,this.graph=i}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)}}Ba.prototype.termType="Quad";Ba.prototype.value="";class Wc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Wc.prototype.termType="Variable";const tp=new In("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),du=new In("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),rp=new In("http://www.w3.org/2001/XMLSchema#string");class zc{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new Ma}}namedNode(e){return new In(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new Gc(e)}literal(e,t){return typeof t=="string"?new Xn(e,t,du):typeof t?.language=="string"?new Xn(e,t.language,t.direction?tp:du,t.direction):new Xn(e,"",t||rp)}variable(e){return new Wc(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,n,i=this.defaultGraph()){return new Ba(e,t,n,i)}fromTerm(e){return cu(this,e)}fromQuad(e){return cu(this,e)}}zc.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const qa=new zc,np={apply:(r,e,t)=>r(t[0]),get:(r,e)=>r(e)};function pt(r,{factory:e=qa}={}){const t=(n="")=>e.namedNode(`${r}${n.raw||n}`);return typeof Proxy>"u"?t:new Proxy(t,np)}pt("http://www.w3.org/2001/XMLSchema#");const _t=pt("http://www.w3.org/1999/02/22-rdf-syntax-ns#");pt("http://www.w3.org/2000/01/rdf-schema#");class Fe{static add({ptr:e,start:t,end:n,subjects:i=[null],predicates:s=[null],objects:a=[null],graphs:o,callback:u}={}){if(!e.factory)throw new Error("add operation requires a factory");let l=()=>{};u&&(l=c=>{u(new lu({dataset:e.dataset,start:t,end:n,quad:c}))});for(const c of i)for(const d of s)for(const m of a)for(const b of o){const _={subject:c,predicate:d,object:m,graph:b};_[t]=e.term;const x=e.factory.quad(_.subject,_.predicate,_.object,_.graph);e.dataset.add(x),l(x)}return e}static addList({ptr:e,predicates:t,items:n,graphs:i}){if(e.isAny())throw new Error("can't attach a list to an any ptr");for(const s of t)for(const a of i){const o=n.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,s,o[0]||_t.nil,a));for(let u=0;u<o.length;u++)e.dataset.add(e.factory.quad(o[u],_t.first,n[u],a)),e.dataset.add(e.factory.quad(o[u],_t.rest,o[u+1]||_t.nil,a))}return e}static delete({ptr:e,start:t,subjects:n=[null],predicates:i=[null],objects:s=[null]}){for(const a of n)for(const o of i)for(const u of s){const l={subject:a,predicate:o,object:u};l[t]=e.term;const c=e.dataset.match(l.subject,l.predicate,l.object);for(const d of c)e.dataset.delete(d)}return e}static deleteList({ptr:e,predicates:t}){const n=[];for(const i of t)for(const s of e.dataset.match(e.term,i)){let a=s.object;for(n.push(s);!_t.nil.equals(a);){a=n[n.length-1].object;const o=e.dataset.match(a);if(o.size===0)break;for(const u of o)n.push(u)}}for(const i of n)e.dataset.delete(i);return e}static execute({ptr:e,operation:t="traverse",quantifier:n,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l,items:c,callback:d}={}){if(t==="add")return Fe.add({ptr:e,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l,callback:d});if(t==="addList")return Fe.addList({ptr:e,predicates:o,items:c,graphs:l});if(t==="delete")return Fe.delete({ptr:e,start:i,subjects:a,predicates:o,objects:u});if(t==="deleteList")return Fe.deleteList({ptr:e,predicates:o});if(t==="isList")return Fe.isList({ptr:e});if(t==="list")return Fe.list({ptr:e});if(t==="traverse")return Fe.traverse({ptr:e,quantifier:n,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l});throw new Error(`unknown operation ${t}`)}static isList({ptr:e}){return e.isAny()?!1:!!(_t.nil.equals(e.term)||Fe.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 n=e.out([_t.rest]);if(n.length!==1)throw new Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=n[0]}}}}static traverse({ptr:e,quantifier:t="one",start:n="subject",end:i="object",subjects:s=[null],predicates:a=[null],objects:o=[null],graphs:u=[null],callback:l}){if(t==="one")return Fe.traverseOne({ptr:e,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,callback:l});if(t==="oneOrMore"){const c=Fe.traverse({ptr:e,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l});return Fe.traverseMore({ptrs:c,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l})}if(t==="zeroOrMore")return Fe.traverseMore({ptrs:[e],end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l});if(t==="zeroOrOne")return[e,...Fe.traverse({ptr:e,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l})];throw new Error(`unknown quantifier ${t}`)}static traverseMore({ptrs:e,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u}={}){let l=[...e],c,d;do{c=[];for(const m of e)c=[...c,...Fe.traverseOne({ptr:m,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u})];d&&(c=c.filter(m=>!d.has(m.term))),e=c,l=[...l,...c],d=new ht(l.map(m=>m.term))}while(c.length>0);return l}static traverseOne({ptr:e,start:t,end:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u=(l,c)=>c.extend(l)}={}){const l=[];for(const c of i)for(const d of s)for(const m of a)for(const b of o){const _={subject:c,predicate:d,object:m,graph:b};_[t]=e.term;for(const x of e.dataset.match(_.subject,_.predicate,_.object,_.graph))l.push(u(new lu({dataset:e.dataset,end:n,quad:x,start:t}),e))}return l}}function hu(r,e){return e?t=>e(r.extend(t)):()=>{}}class fu{constructor({dataset:e,edges:t=[],factory:n,graph:i,term:s}){if(!e&&t.length===0)throw new Error("dataset or edges is required");if(t.length===0&&typeof s>"u")throw new Error("edges or term must be given");if(t.length>0&&s)throw new Error("edges or term must be given");this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=n,this._graph=i,t.length===0&&(this._term=s)}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,n){return Fe.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:hu(this,n)})}addList(e,t){return Fe.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,n){return Fe.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:hu(this,n)})}deleteIn(e,t){return Fe.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return Fe.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return Fe.delete({ptr:this,start:"subject",predicates:e,objects:t})}execute({operation:e,quantifier:t,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,items:l,callback:c}){return Fe.execute({ptr:this,operation:e,quantifier:t,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,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 Fe.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return Fe.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return Fe.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return Fe.isList({ptr:this})}list(){return Fe.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 Fe.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 pu(r,e){return r?r.equals(e):r===e}function ip(r,e){return!(r.dataset!==e.dataset||!pu(r.graph,e.graph)||!pu(r.term,e.term))}function gu(r,e){return e?t=>e(new r.constructor({factory:r.factory,ptrs:[t]})):()=>{}}class ti{constructor({dataset:e,factory:t,ptrs:n,terms:i,graphs:s}){if(this.factory=t,n)this.ptrs=[...n];else{this.ptrs=[];for(const a of i||[null])for(const o of s||[null])this.ptrs.push(new fu({dataset:e,factory:t,graph:o,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 ht(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,n){const i=gu(this,n);for(const s of this.ptrs)s.addIn(e,t,i);return this}addList(e,t){if(this.isAny())throw new Error("can't attach a list to an any ptr");for(const n of this.ptrs)n.addList(e,t);return this}addOut(e,t,n){const i=gu(this,n);for(const s of this.ptrs)s.addOut(e,t,i);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(const n of this.ptrs)n.deleteIn(e,t);return this}deleteList(e){for(const t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(const n of this.ptrs)n.deleteOut(e,t);return this}distinct(){const e=this.ptrs.reduce((t,n)=>(t.some(i=>ip(i,n))||t.push(n.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 n of e)t=t.execute(n);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(n=>n.hasIn(e,t))})}hasOut(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.hasOut(e,t))})}in(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.in(e,t))})}isAny(){return this.ptrs.length>0&&this.ptrs.some(e=>e.isAny())}isList(){return 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 n of e)yield t.clone({ptrs:[n]})}()}map(e){return[...this].map(e)}node(e){const t=this.dataset,n=[...e].map(i=>new fu({dataset:t,factory:this.factory,term:i}));return this.clone({ptrs:n})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.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]})}}pt("http://www.w3.org/2002/07/owl#");const or=pt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),sp=pt("http://www.w3.org/2000/01/rdf-schema#"),ae=pt("http://www.w3.org/ns/shacl#"),da=pt("https://schemas.link/shacl-next#"),Ua=pt("http://www.w3.org/2001/XMLSchema#");function ap(r){return r?`{${[...r.quads()].map(e=>at(e)).join(" ")}}`:"{}"}function op(r){return r?`{${r.map(e=>ap(e)).join(" ")}}`:"{}"}var Ps,mu;function lp(){if(mu)return Ps;mu=1;var r=/\s/;function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}return Ps=e,Ps}var Ms,yu;function up(){if(yu)return Ms;yu=1;var r=lp(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return Ms=t,Ms}var Bs,bu;function cp(){if(bu)return Bs;bu=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return Bs=r,Bs}var qs,_u;function dp(){if(_u)return qs;_u=1;var r=typeof xr=="object"&&xr&&xr.Object===Object&&xr;return qs=r,qs}var Us,wu;function hp(){if(wu)return Us;wu=1;var r=dp(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Us=t,Us}var Hs,vu;function Xc(){if(vu)return Hs;vu=1;var r=hp(),e=r.Symbol;return Hs=e,Hs}var Vs,xu;function fp(){if(xu)return Vs;xu=1;var r=Xc(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,i=r?r.toStringTag:void 0;function s(a){var o=t.call(a,i),u=a[i];try{a[i]=void 0;var l=!0}catch{}var c=n.call(a);return l&&(o?a[i]=u:delete a[i]),c}return Vs=s,Vs}var Gs,Eu;function pp(){if(Eu)return Gs;Eu=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return Gs=t,Gs}var Ws,Su;function gp(){if(Su)return Ws;Su=1;var r=Xc(),e=fp(),t=pp(),n="[object Null]",i="[object Undefined]",s=r?r.toStringTag:void 0;function a(o){return o==null?o===void 0?i:n:s&&s in Object(o)?e(o):t(o)}return Ws=a,Ws}var zs,Nu;function mp(){if(Nu)return zs;Nu=1;function r(e){return e!=null&&typeof e=="object"}return zs=r,zs}var Xs,Iu;function yp(){if(Iu)return Xs;Iu=1;var r=gp(),e=mp(),t="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&r(i)==t}return Xs=n,Xs}var Qs,Ru;function bp(){if(Ru)return Qs;Ru=1;var r=up(),e=cp(),t=yp(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt;function u(l){if(typeof l=="number")return l;if(t(l))return n;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 d=s.test(l);return d||a.test(l)?o(l.slice(2),d?2:8):i.test(l)?n:+l}return Qs=u,Qs}var Js,Tu;function _p(){if(Tu)return Js;Tu=1;var r=bp(),e=1/0,t=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=r(i),i===e||i===-e){var s=i<0?-1:1;return s*t}return i===i?i:0}return Js=n,Js}var Ks,Au;function wp(){if(Au)return Ks;Au=1;var r=_p();function e(t){var n=r(t),i=n%1;return n===n?i?n-i:n:0}return Ks=e,Ks}var Ys,Du;function vp(){if(Du)return Ys;Du=1;var r=wp(),e="Expected a function";function t(n,i){var s;if(typeof i!="function")throw new TypeError(e);return n=r(n),function(){return--n>0&&(s=i.apply(this,arguments)),n<=1&&(i=void 0),s}}return Ys=t,Ys}var Zs,Ou;function xp(){if(Ou)return Zs;Ou=1;var r=vp();function e(t){return r(2,t)}return Zs=e,Zs}var Ep=xp();const yt=rd(Ep);let Lu=class{constructor({details:e,factory:t,options:n,results:i=[]}={}){this.details=e,this.factory=t,this.options=n,this.results=i,this._conforms=yt(()=>!this.results.some(s=>s.severity.equals(ae.Info)||s.severity.equals(ae.Violation)||s.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 ti({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([or.type],[ae.ValidationReport]).addOut([ae.conforms],[this.factory.literal(this.conforms.toString(),Ua.boolean)]);for(const t of this.results)e.addOut([ae.result],[this.factory.blankNode()],n=>{t.build(n,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function Sp(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=at(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}let Np=class{constructor({args:e={},constraintComponent:t,factory:n,focusNode:i,message:s=[],path:a,results:o=[],severity:u,shape:l,source:c=[],value:d,valuePaths:m=[]}={}){this.args=e,this.constraintComponent=t,this.factory=n,this.focusNode=i,this.path=a||l.path,this.results=o,this.severity=u,this.shape=l,this.source=c,this.value=d,this.valuePaths=m,this._message=yt(()=>(this.shape.message.length>0&&(s=this.shape.message),s.length===0&&(s=this.shape.ptr.node([this.constraintComponent]).out([ae.message]).terms),s.map(b=>n.literal(Sp(b.value,e),b.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([or.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 n=i=>{if(i.quantifier==="one")return i.predicates.length>1?e.node([this.factory.blankNode()]).addList([ae.alternativePath],i.predicates):i.start==="object"?e.node([this.factory.blankNode()]).addOut([ae.inversePath],[i.predicates[0]]):e.node([i.predicates[0]]);if(i.quantifier==="oneOrMore")return e.node([this.factory.blankNode()]).addOut([ae.oneOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrMore")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrOne")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrOnePath],[i.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([ae.resultPath],n(this.path[0]).terms):e.addList([ae.resultPath],this.path.map(i=>n(i).term))),typeof this.value<"u"&&e.addOut([ae.value],this.value.terms),t)for(const i of this.results)e.addOut([ae.detail],[this.factory.blankNode()],s=>{i.build(s,{details:t})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}};class Ha{constructor({factory:e,focusNode:t,options:n={debug:!1,details:!1},processed:i=new Set,report:s=new Lu({factory:e,options:n}),results:a=new Map,shape:o,value:u,valueOrNode:l,valuePaths:c,values:d}={}){this.factory=e,this.focusNode=t,this.options=n,this.processed=i,this.report=s,this.results=a,this.shape=o,this.value=u,this.valuePaths=c,this.valueOrNode=l,this.values=d}create({child:e,focusNode:t=this.focusNode,shape:n=this.shape,value:i=this.value,valueOrNode:s=this.valueOrNode,valuePaths:a=this.valuePaths,values:o=this.values}={}){return new Ha({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new Lu({factory:this.factory,options:this.options}):this.report,results:this.results,shape:n,value:i,valueOrNode:s,valuePaths:a,values:o})}id({shape:e=this.shape}={}){return`${at(e.ptr.term)} - ${at(this.focusNode.term)} - ${op(this.valuePaths)}`}result(e){const t=new Np({factory:this.factory,focusNode:this.focusNode,shape:this.shape,value:this.value,valuePaths:this.valuePaths,...e}),n=this.id();this.results.has(n)?this.results.get(n).add(t):this.results.set(n,new Set([t])),this.report.results.push(t)}debug(e,t){this.options.debug&&this.result({severity:da.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:da.Trace,constraintComponent:e,...t})}test(e,t,n){e?this.debug(t,n):this.violation(t,n)}violation(e,t){this.result({constraintComponent:e,severity:this.shape.severity||ae.Violation,...t})}}function Ip(){return{generic:Rp()}}function Rp(){return r=>{r.trace(da.TraversalConstraintComponent,{args:{},message:[r.factory.literal("Traversal")],value:r.valueOrNode})}}class Tp{constructor(e){this.validations=new Cr(e)}compile(e){const t=e.validator.options.coverage;if(e.deactivated)return[];let n=!1;const i=new Set;for(const s of e.ptr.execute({start:"subject",end:"predicate"})){const a=this.validations.get(s.term);a&&(i.add(a),s.term.equals(ae.property)&&(n=!0))}return t&&e.isPropertyShape&&!n&&i.add(Ip),[...i].map(s=>s(e)).filter(Boolean)}}var Zt={},er={},rn={},nn={},Cu;function Ar(){if(Cu)return nn;Cu=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.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,n,i){for(const s of n)this.supportedRdfDatatypes.push(s),this.fromRdfHandlers[s.value]=t;for(const s of i){let a=this.toRdfHandlers[s];a||(this.toRdfHandlers[s]=a=[]),a.push(t)}}fromRdf(t,n){const i=this.fromRdfHandlers[t.datatype.value];return i?i.fromRdf(t,n):t.value}toRdf(t,n){const i=this.toRdfHandlers[typeof t];if(i)for(const s of i){const a=s.toRdf(t,n);if(a)return a}throw new Error(`Invalid JavaScript value: '${t}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}};return nn.Translator=r,nn}var ju;function Ap(){if(ju)return rn;ju=1,Object.defineProperty(rn,"__esModule",{value:!0}),rn.TypeHandlerBoolean=void 0;const r=Ar();let e=class Qc{fromRdf(n,i){switch(n.value){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1}return i&&r.Translator.incorrectRdfDataType(n),!1}toRdf(n,{datatype:i,dataFactory:s}){return s.literal(n?"true":"false",i||s.namedNode(Qc.TYPE))}};return rn.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",rn}var sn={},$u;function Dp(){if($u)return sn;$u=1,Object.defineProperty(sn,"__esModule",{value:!0}),sn.TypeHandlerDate=void 0;const r=Ar();let e=class ha{fromRdf(n,i){switch(i&&!n.value.match(ha.VALIDATORS[n.datatype.value.substr(33,n.datatype.value.length)])&&r.Translator.incorrectRdfDataType(n),n.datatype.value){case"http://www.w3.org/2001/XMLSchema#gDay":return new Date(0,0,parseInt(n.value,10));case"http://www.w3.org/2001/XMLSchema#gMonthDay":const s=n.value.split("-");return new Date(0,parseInt(s[0],10)-1,parseInt(s[1],10));case"http://www.w3.org/2001/XMLSchema#gYear":return new Date(n.value+"-01-01");case"http://www.w3.org/2001/XMLSchema#gYearMonth":return new Date(n.value+"-01");default:return new Date(n.value)}}toRdf(n,{datatype:i,dataFactory:s}){if(i=i||s.namedNode(ha.TYPES[0]),!(n instanceof Date))return null;const a=n;let o;switch(i.value){case"http://www.w3.org/2001/XMLSchema#gDay":o=String(a.getUTCDate());break;case"http://www.w3.org/2001/XMLSchema#gMonthDay":o=a.getUTCMonth()+1+"-"+a.getUTCDate();break;case"http://www.w3.org/2001/XMLSchema#gYear":o=String(a.getUTCFullYear());break;case"http://www.w3.org/2001/XMLSchema#gYearMonth":o=a.getUTCFullYear()+"-"+(a.getUTCMonth()+1);break;case"http://www.w3.org/2001/XMLSchema#date":o=a.toISOString().replace(/T.*$/,"");break;default:o=a.toISOString()}return s.literal(o,i)}};return sn.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]$/},sn}var an={},Fu;function Op(){if(Fu)return an;Fu=1,Object.defineProperty(an,"__esModule",{value:!0}),an.TypeHandlerNumberDouble=void 0;const r=Ar();let e=class Jc{fromRdf(n,i){const s=parseFloat(n.value);return i&&isNaN(s)&&r.Translator.incorrectRdfDataType(n),s}toRdf(n,{datatype:i,dataFactory:s}){return i=i||s.namedNode(Jc.TYPES[0]),isNaN(n)?s.literal("NaN",i):isFinite(n)?n%1===0?null:s.literal(n.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),i):s.literal(n>0?"INF":"-INF",i)}};return an.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"],an}var on={},ku;function Lp(){if(ku)return on;ku=1,Object.defineProperty(on,"__esModule",{value:!0}),on.TypeHandlerNumberInteger=void 0;const r=Ar();let e=class hn{fromRdf(n,i){const s=parseInt(n.value,10);return i&&(isNaN(s)||n.value.indexOf(".")>=0)&&r.Translator.incorrectRdfDataType(n),s}toRdf(n,{datatype:i,dataFactory:s}){return s.literal(String(n),i||(n<=hn.MAX_INT&&n>=hn.MIN_INT?s.namedNode(hn.TYPES[0]):s.namedNode(hn.TYPES[1])))}};return on.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,on}var ln={},Pu;function Cp(){if(Pu)return ln;Pu=1,Object.defineProperty(ln,"__esModule",{value:!0}),ln.TypeHandlerString=void 0;let r=class{fromRdf(t){return t.value}toRdf(t,{datatype:n,dataFactory:i}){return i.literal(t,n)}};return ln.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"],ln}var Mu;function Bu(){return Mu||(Mu=1,function(r){var e=er&&er.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=er&&er.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(Ap(),r),t(Dp(),r),t(Op(),r),t(Lp(),r),t(Cp(),r)}(er)),er}var ea={},qu;function jp(){return qu||(qu=1,Object.defineProperty(ea,"__esModule",{value:!0})),ea}var Uu;function $p(){return Uu||(Uu=1,function(r){var e=Zt&&Zt.__createBinding||(Object.create?function(b,_,x,E){E===void 0&&(E=x);var v=Object.getOwnPropertyDescriptor(_,x);(!v||("get"in v?!_.__esModule:v.writable||v.configurable))&&(v={enumerable:!0,get:function(){return _[x]}}),Object.defineProperty(b,E,v)}:function(b,_,x,E){E===void 0&&(E=x),b[E]=_[x]}),t=Zt&&Zt.__exportStar||function(b,_){for(var x in b)x!=="default"&&!Object.prototype.hasOwnProperty.call(_,x)&&e(_,b,x)};Object.defineProperty(r,"__esModule",{value:!0}),r.fromRdf=u,r.toRdf=l,r.getTermRaw=c,r.getSupportedRdfDatatypes=d,r.getSupportedJavaScriptPrimitives=m;const n=kc(),i=Bu(),s=Ar();t(Bu(),r),t(jp(),r),t(Ar(),r);const a=new n.DataFactory,o=new s.Translator;o.registerHandler(new i.TypeHandlerString,i.TypeHandlerString.TYPES.map(b=>a.namedNode(b)),["string"]),o.registerHandler(new i.TypeHandlerBoolean,[i.TypeHandlerBoolean.TYPE].map(b=>a.namedNode(b)),["boolean"]),o.registerHandler(new i.TypeHandlerNumberDouble,i.TypeHandlerNumberDouble.TYPES.map(b=>a.namedNode(b)),["number"]),o.registerHandler(new i.TypeHandlerNumberInteger,i.TypeHandlerNumberInteger.TYPES.map(b=>a.namedNode(b)),["number"]),o.registerHandler(new i.TypeHandlerDate,i.TypeHandlerDate.TYPES.map(b=>a.namedNode(b)),["object"]);function u(b,_){return o.fromRdf(b,_)}function l(b,_){return _&&"namedNode"in _&&(_={dataFactory:_}),_=_||{},_&&!_.dataFactory&&(_.dataFactory=a),o.toRdf(b,_)}function c(b,_){return b.termType==="Literal"?u(b,_):b.value}function d(){return o.getSupportedRdfDatatypes()}function m(){return o.getSupportedJavaScriptPrimitives()}}(Zt)),Zt}var xn=$p();function Hu(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 n=r.out([ae.oneOrMorePath]);if(n.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[n.term]};const i=r.out([ae.zeroOrMorePath]);if(i.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[i.term]};const s=r.out([ae.zeroOrOnePath]);if(s.term)return{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[s.term]}}function Fp(r){return r.terms.length===0?null:r.ptrs[0].isList()?[...r.list()].map(e=>Hu(e)):[Hu(r)]}class kp{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 n of this.compiled)n.node&&await n.node(t),n.generic&&await n.generic(t)}async validateProperty(e){let t;this.shape.isSparqlShape?t=e.focusNode:t=e.focusNode.executeAll(this.shape.path);const n=t.node(new ht(t.terms)),i=[...t].reduce((a,o)=>{const u=o.term,l=t.node([u]);return a.has(u)||a.set(u,{value:l,valuePaths:[]}),a.get(u).valuePaths.push(o),a},new Cr).values(),s=e.create({shape:this.shape,values:n});for(const a of this.compiled)a.property&&await a.property(s);for(const{value:a,valuePaths:o}of i){const u=e.create({shape:this.shape,value:a,valueOrNode:a,valuePaths:o});for(const l of this.compiled)l.generic&&await l.generic(u)}}}function fa(r){const e=new ht,n=new ti({dataset:r.dataset,terms:r.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[sp.subClassOf]});for(const i of n.ptrs)for(const{term:s}of i.nodes())e.add(s);return e}class Pp{constructor(e){this.targetClass=new ht([...fa(e.hasOut([or.type],[ae.NodeShape])),...fa(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]),n=[...e.focusNode.hasOut([or.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],i=e.focusNode.clone({ptrs:n});return i.node([...new ht(i.terms)])}}class Mp{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=yt(()=>{const n=this.ptr.out([ae.deactivated]).term;return n&&xn.fromRdf(n)}),this._message=yt(()=>this.ptr.out([ae.message]).terms),this._path=yt(()=>Fp(this.ptr.out([ae.path]))),this._severity=yt(()=>this.ptr.out([ae.severity]).term),this._shapeValidator=yt(()=>new kp(this)),this._sparql=yt(()=>this.ptr.out([ae.sparql])),this._targetResolver=yt(()=>new Pp(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 n of e.results.get(t))e.report.results.push(n);return e}return e.processed.add(t),this.shapeValidator.validate(e)}}function Bp(r){const e=parseInt(r.ptr.out([ae.maxCount]).value);return{property:qp(e)}}function qp(r){return e=>{e.test(e.values.terms.length<=r,ae.MaxCountConstraintComponent,{args:{maxCount:r},message:[e.factory.literal("More than {$maxCount} values")]})}}function Up(r){const e=parseInt(r.ptr.out([ae.minCount]).value);return{property:Hp(e)}}function Hp(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 Vp(r,e){for(const t of r)if(!await e(t))return!1;return!0}async function Gp(r,e){return(await Promise.all(r.map(t=>e(t)))).filter(Boolean)}async function pi(r,e){return Promise.all(r.map(e))}async function Wp(r,e){for(const t of r)if(await e(t))return!0;return!1}function zp(r){const e=[...r.ptr.out([ae.and])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Xp(e)}}function Xp(r){return async e=>{const t=await pi(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),n=t.every(i=>i.conforms);e.test(n,ae.AndConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function Qp(r){const e=r.validator.shape(r.ptr.out([ae.not]));return{generic:Jp(e)}}function Jp(r){return async e=>{const t=(await r.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,n=!t.conforms;e.test(n,ae.NotConstraintComponent,{args:{not:r.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:t.results,value:e.valueOrNode})}}function Kp(r){const e=[...r.ptr.out([ae.or])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Yp(e)}}function Yp(r){return async e=>{let t=[],n;if(e.options.debug||e.options.details){const i=await pi(r,async s=>(await s.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report);t=i.flatMap(s=>s.results),n=i.some(s=>s.conforms)}else n=await Wp(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms);e.test(n,ae.OrConstraintComponent,{results:t,value:e.valueOrNode})}}function Zp(r){const e=[...r.ptr.out([ae.xone])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:eg(e)}}function eg(r){return async e=>{const t=await pi(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),n=t.filter(i=>i.conforms).length===1;e.test(n,ae.XoneConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function tg(r){if(!xn.fromRdf(r.ptr.out([ae.closed]).term))return null;const t=r.ptr.out([ae.property]).map(s=>r.validator.shape(s)),n=new ht(t.filter(s=>!s.deactivated).map(s=>s.path[0].predicates[0])),i=new ht([...r.ptr.out([ae.ignoredProperties]).list()||[]].map(s=>s.term));return{node:rg(n,i)}}function rg(r,e){return t=>{const n=t.focusNode.execute({start:"subject",end:"predicate"}).filter(i=>e.has(i.term)?!1:!r.has(i.term));if(n.ptrs.length>0)for(const i of n)t.violation(ae.ClosedConstraintComponent,{message:[t.factory.literal("Predicate is not allowed (closed shape)")],path:[{quantifier:"one",start:"subject",end:"object",predicates:[i.term]}],value:t.focusNode.node([[...i.quads()][0].object])});else t.debug(ae.ClosedConstraintComponent)}}function ng(r){const e=r.ptr.out([ae.hasValue]).term;return{node:ig(e),property:sg(e)}}function ig(r){return e=>{e.test(r.equals(e.valueOrNode.term),ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Value must be {$hasValue}")]})}}function sg(r){return e=>{const t=[...e.values].some(n=>r.equals(n.term));e.test(t,ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Missing expected value {$hasValue}")]})}}function ag(r){const e=new ht([...r.ptr.out([ae.in]).list()].map(t=>t.term));return{generic:og(e)}}function og(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 jr(r,e){if(!r||r.termType!=="Literal"||!e||e.termType!=="Literal"||Vu(r)!==Vu(e))return null;const t=xn.fromRdf(r),n=xn.fromRdf(e);return typeof t!=typeof n?null:typeof t=="string"?t.localeCompare(n):t-n}function Vu(r){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return Ua.dateTime.equals(r.datatype)&&e.test(r.value)}function lg(r){const e=r.ptr.out([ae.disjoint]).term;return{generic:ug(e)}}function ug(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 cg(r){const e=r.ptr.out([ae.equals]).term;return{node:dg(e),property:hg(e)}}function dg(r){return e=>{const t=e.focusNode.out([r]),n=t.filter(s=>!s.term.equals(e.focusNode.term)),i=t.terms.length!==0&&n.terms.length===0;e.test(i,ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:n.terms[0]&&e.focusNode.node([n.terms[0]])||e.focusNode})}}function hg(r){return e=>{const t=new ht(e.focusNode.out([r]).terms),n=new ht(e.values.terms),i=[...n].filter(o=>!t.has(o)),s=[...t].filter(o=>!n.has(o)),a=[...i,...s];for(const o of a)e.violation(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:e.focusNode.node([o])});a.length===0&&e.debug(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")]})}}function fg(r){const e=r.ptr.out([ae.lessThan]).term;return{property:pg(e)}}function pg(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=jr(n.term,i);s===null||s>=0?e.violation(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n}):e.debug(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n})}}}function gg(r){const e=r.ptr.out([ae.lessThanOrEquals]).term;return{property:mg(e)}}function mg(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=jr(n.term,i);s===null||s>0?e.violation(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n}):e.debug(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n})}}}function yg(r){const e=r.ptr.out([ae.maxExclusive]).term;return{generic:bg(e)}}function bg(r){return e=>{const t=jr(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 _g(r){const e=r.ptr.out([ae.maxInclusive]).term;return{generic:wg(e)}}function wg(r){return e=>{const t=jr(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 vg(r){const e=r.ptr.out([ae.minExclusive]).term;return{generic:xg(e)}}function xg(r){return e=>{const t=jr(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 Eg(r){const e=r.ptr.out([ae.minInclusive]).term;return{generic:Sg(e)}}function Sg(r){return e=>{const t=jr(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 Ng(r){const e=[...r.ptr.out([ae.node])].map(t=>r.validator.shape(t));return{generic:Ig(e)}}function Ig(r){return async e=>{for(const t of r){const n=await t.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(n.report.conforms,ae.NodeConstraintComponent,{args:{node:t.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:n.report.results,value:e.valueOrNode})}}}function Rg(r){const e=[...r.ptr.out([ae.property])].map(t=>r.validator.shape(t));return{generic:Tg(e)}}function Tg(r){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const n of r)await n.validate(t)}}function Ag(r){const e=r.validator.shape(r.ptr.out([ae.qualifiedValueShape])),t=r.ptr.out([ae.qualifiedValueShapesDisjoint]).term,n=t?xn.fromRdf(t):!1,i=r.ptr.out([ae.qualifiedMaxCount]).term,s=i?parseInt(i.value):null,a=r.ptr.out([ae.qualifiedMinCount]).term,o=a?parseInt(a.value):null;return{property:Dg(e,n,s,o)}}function Dg(r,e,t,n){return async i=>{const s=[];let a=[];e&&(a=new Set(i.shape.ptr.in([ae.property]).out([ae.property]).out([ae.qualifiedValueShape]).filter(u=>!u.term.equals(r.ptr.term)).map(u=>i.shape.validator.shape(u))));const o=(await Gp(i.values,async u=>{const l=(await r.validate(i.create({child:!0,focusNode:u}))).report;if(s.push(l.results),!l.conforms)return!1;if(a.length===0)return!0;if(i.options.debug||i.options.details){const c=await pi([...a],async d=>(await d.validate(i.create({child:!0,focusNode:u}))).report);return s.push(c.flatMap(d=>d.results)),!c.every(d=>d.conforms)}else return!await Vp([...a],async c=>(await c.validate(i.create({child:!0,focusNode:u}))).report.conforms)})).length;t!==null&&i.test(o<=t,ae.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:t,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[i.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:s.flat()}),n!==null&&i.test(o>=n,ae.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:n,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[i.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:s.flat()})}}function Og(r,e){return e?e.slice(0,r.length)===r:!1}function Lg(r){const e=[...new Set([...r.ptr.out([ae.languageIn]).list()].map(t=>t.value))];return{generic:Cg(e)}}function Cg(r){return e=>{const t=r.some(n=>Og(n,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 jg(r){const e=parseInt(r.ptr.out([ae.maxLength]).value);return{generic:$g(e)}}function $g(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 Fg(r){const e=parseInt(r.ptr.out([ae.minLength]).value);return{generic:kg(e)}}function kg(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 Pg(r){const e=r.ptr.out([ae.pattern]).value,t=r.ptr.out([ae.flags]).value,n=new RegExp(e,t);return{generic:Mg(e,t,n)}}function Mg(r,e,t){return n=>{n.test(t.test(n.valueOrNode.term.value),ae.PatternConstraintComponent,{args:{flags:e,pattern:r},message:[n.factory.literal('Value does not match pattern "{$pattern}"')],value:n.valueOrNode})}}function Bg(r){const e=r.ptr.out([ae.uniqueLang]).term;return e.value==="true"&&Ua.boolean.equals(e.datatype)?{property:qg()}:null}function qg(){return r=>{const t=Object.entries(r.values.terms.reduce((n,i)=>(i.language&&(n[i.language]=(n[i.language]||0)+1),n),{})).filter(([,n])=>n>1);for(const[n]of t)r.violation(ae.UniqueLangConstraintComponent,{args:{lang:n},message:[r.factory.literal('Language "{?lang}" used more than once')]});t.length===0&&r.debug(ae.UniqueLangConstraintComponent)}}const Qn=pt("http://www.w3.org/ns/shacl#"),Kc=pt("https://schemas.link/shacl-next#");class Dr{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(Qn.Info)||e.severity.equals(Qn.Violation)||e.severity.equals(Qn.Warning))}}function Ug(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=at(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}class ri{constructor({args:e={},factory:t,message:n=[],severity:i=Qn.Violation}={}){this.severity=i,this.message=n.map(s=>t.literal(Ug(s.value,e),s.language||null))}}class Va{constructor({factory:e=qa}={}){this.factory=e}clone({factory:e}={}){return new Va({factory:e||this.factory})}validate(){return new Dr}validateSimple(){return!0}}class $r extends Va{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(const n of Array.isArray(e)?e:[e])n&&this.datatypes.push(this.factory.fromTerm(n))}clone({factory:e}={}){return new $r({datatypes:this.datatypes,factory:e||this.factory})}}class Hg{constructor({factory:e=qa,validations:t}={}){if(this.factory=e,this.validations=new Cr,t)for(const n of Object.values(t)){const i=n.clone({factory:this.factory});for(const s of i.datatypes)this.validations.set(s,i)}}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 $r{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.message=[this.factory.literal("term value {$this} matches pattern {$pattern}")],this.patterns=Array.isArray(e)?e:[e]}clone({factory:e}={}){return new Pe(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map(n=>{let i;n.test(e.value)&&(i=Kc.Debug);const s={pattern:this.factory.literal(n.toString()),this:e};return new ri({args:s,factory:this.factory,message:this.message,severity:i})});return new Dr({results:t})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}}const Vg=/^([-+]?[0-9]+)$/;class it extends Pe{constructor(e=null,t=null,n,{factory:i}={}){super(Vg,n,{factory:i}),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 it(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 Dr({results:t});const n=BigInt(e.value);if(this.minInclusive!==null&&n<this.minInclusive){const i=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,s=[this.factory.literal(i)];t.push(new ri({factory:this.factory,message:s}))}if(this.maxInclusive!==null&&n>this.maxInclusive){const i=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,s=[this.factory.literal(i)];t.push(new ri({factory:this.factory,message:s}))}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 Ga extends $r{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.values=new Set(e)}clone({factory:e}={}){return new Ga(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const n=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,i=[this.factory.literal(n)];t.push(new ri({factory:this.factory,message:i}))}return new Dr({results:t})}validateSimple(e){return this.values.has(e.value)}}const Te={xsd:pt("http://www.w3.org/2001/XMLSchema#")},Gg=new $r({datatypes:Te.xsd.anySimpleType}),Wg=new $r({datatypes:Te.xsd.anyAtomicType}),gi=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,zg=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,Yc=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,Wa=/^(-?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))?)$/,Xg=/^((([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))?)$/,Qg=/^(-?([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))?)$/,Jg=/^(-?([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))?)$/,Kg=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Yg=/^(--(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))?)$/,Zg=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,em=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,tm=/^(([0-9a-fA-F]{2})*)$/,rm=/^(((([A-Za-z0-9+/] ?){4})*(([A-Za-z0-9+/] ?){3}[A-Za-z0-9+/]|([A-Za-z0-9+/] ?){2}[AEIMQUYcgkosw048] ?=|[A-Za-z0-9+/] ?[AQgw] ?= ?=))?)$/,nm=new Pe(gi,Te.xsd.string),im=new Ga(["1","true","0","false"],Te.xsd.boolean),sm=new Pe(zg,Te.xsd.decimal),am=new Pe(Yc,Te.xsd.float),om=new Pe(Yc,Te.xsd.double),lm=new Pe(Wa,Te.xsd.duration),um=new Pe(Zc,Te.xsd.dateTime),cm=new Pe(Xg,Te.xsd.time),dm=new Pe(Qg,Te.xsd.date),hm=new Pe(Jg,Te.xsd.gYearMonth),fm=new Pe(Kg,Te.xsd.gYear),pm=new Pe(Yg,Te.xsd.gMonthDay),gm=new Pe(Zg,Te.xsd.gDay),mm=new Pe(em,Te.xsd.gMonth),ym=new Pe(tm,Te.xsd.hexBinary),bm=new Pe(rm,Te.xsd.base64Binary),_m=new Pe(gi,Te.xsd.anyURI),ed=/^([^\u000d\u000a\u0009]*)$/,wm=/^([^ ]+( [^ ]+)*)*$/,vm=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,xm=/^([^DT]*)$/,Em=/^([^YM]*[DT].*)$/,Sm=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Nm=new Pe([gi,ed],Te.xsd.normalizedString),Im=new Pe([gi,ed,wm],Te.xsd.token),Rm=new Pe(vm,Te.xsd.language),Tm=new it(null,null,Te.xsd.integer),Am=new it(null,"0",Te.xsd.nonPositiveInteger),Dm=new it(null,"-1",Te.xsd.negativeInteger),Om=new it("-9223372036854775808","9223372036854775807",Te.xsd.long),Lm=new it("-2147483648","2147483647",Te.xsd.int),Cm=new it("-32768","32767",Te.xsd.short),jm=new it("-128","127",Te.xsd.byte),$m=new it("0",null,Te.xsd.nonNegativeInteger),Fm=new it("0","18446744073709551615",Te.xsd.unsignedLong),km=new it("0","4294967295",Te.xsd.unsignedInt),Pm=new it("0","65535",Te.xsd.unsignedShort),Mm=new it("0","255",Te.xsd.unsignedByte),Bm=new it("1",null,Te.xsd.positiveInteger),qm=new Pe([Wa,xm],Te.xsd.yearMonthDuration),Um=new Pe([Wa,Em],Te.xsd.dayTimeDuration),Hm=new Pe([Zc,Sm],Te.xsd.dateTimeStamp),Vm=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:Wg,anySimpleType:Gg,anyURI:_m,base64Binary:bm,boolean:im,byte:jm,date:dm,dateTime:um,dateTimeStamp:Hm,dayTimeDuration:Um,decimal:sm,double:om,duration:lm,float:am,gDay:gm,gMonth:mm,gMonthDay:pm,gYear:fm,gYearMonth:hm,hexBinary:ym,int:Lm,integer:Tm,language:Rm,long:Om,negativeInteger:Dm,nonNegativeInteger:$m,nonPositiveInteger:Am,normalizedString:Nm,positiveInteger:Bm,short:Cm,string:nm,time:cm,token:Im,unsignedByte:Mm,unsignedInt:km,unsignedLong:Fm,unsignedShort:Pm,yearMonthDuration:qm},Symbol.toStringTag,{value:"Module"}));class Gm extends Hg{constructor({factory:e}={}){super({factory:e,validations:{...Vm}})}}const Wm=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 zm(r){const e=r.ptr.out([ae.class]).map(t=>fa(t));return{generic:Xm(e)}}function Xm(r){return e=>{const t=new ht(e.valueOrNode.out([or.type]).terms);for(const n of r){const i=[...t].some(s=>n.has(s));e.test(i,ae.ClassConstraintComponent,{value:e.valueOrNode})}}}function Qm(r){const e=r.ptr.out([ae.datatype]).term,t=new Gm;return{generic:Jm(e,t)}}function Jm(r,e){return t=>{const n=r.equals(t.valueOrNode.term.datatype)&&e.validateSimple(t.valueOrNode.term);t.test(n,ae.DatatypeConstraintComponent,{args:{datatype:r},message:[t.factory.literal("Value does not have datatype {$datatype}")],value:t.valueOrNode})}}function Km(r){const e=r.ptr.out([ae.nodeKind]).term,t=Wm.get(e);return{generic:Ym(e,t)}}function Ym(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 Zm=new Cr([[ae.maxCount,Bp],[ae.minCount,Up],[ae.and,zp],[ae.not,Qp],[ae.or,Kp],[ae.xone,Zp],[ae.closed,tg],[ae.hasValue,ng],[ae.in,ag],[ae.disjoint,lg],[ae.equals,cg],[ae.lessThan,fg],[ae.lessThanOrEquals,gg],[ae.maxExclusive,yg],[ae.maxInclusive,_g],[ae.minExclusive,vg],[ae.minInclusive,Eg],[ae.node,Ng],[ae.property,Rg],[ae.qualifiedValueShape,Ag],[ae.languageIn,Lg],[ae.maxLength,jg],[ae.minLength,Fg],[ae.pattern,Pg],[ae.uniqueLang,Bg],[ae.class,zm],[ae.datatype,Qm],[ae.nodeKind,Km]]);class ey{constructor(e,{factory:t,...n}){if(this.factory=t,this.options=n,this.registry=new Tp(Zm),this.shapesPtr=new ti({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[s,a]of this.options.validations)this.registry.validations.set(s,a);const i=[...this.shapesPtr.hasOut([ae.targetClass]),...this.shapesPtr.hasOut([ae.targetNode]),...this.shapesPtr.hasOut([ae.targetObjectsOf]),...this.shapesPtr.hasOut([ae.targetSubjectsOf]),...this.shapesPtr.hasOut([or.type],[ae.NodeShape]),...this.shapesPtr.hasOut([or.type],[ae.PropertyShape])];for(const s of i)this.shape(s)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new Mp(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const n=new ti({...e,factory:this.factory}),i=new Ha({factory:this.factory,focusNode:n,options:this.options,validator:this});t?t=t.map(s=>this.shape(this.shapesPtr.node(s.terms))):t=this.shapes.values();for(const s of t){const a=i.create({shape:s});let o;n.isAny()?o=s.resolveTargets(a):o=n;for(const u of o)await s.validate(a.create({focusNode:u}))}return i.report}}let ty=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new ou(e,this.form),this.form.addEventListener("change",t=>{t.stopPropagation(),this.config.editMode&&this.validate(!0).then(n=>{this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:n.conforms,report:n}}))}).catch(n=>{console.warn(n)})})}static get observedAttributes(){return ou.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(n=>{this.form.classList.remove(n)}),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 n of Kd())n.stylesheet&&t.push(n.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new Ht(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 n=this.config.theme.createButton(this.config.attributes.submitButton||"Submit",!0);n.addEventListener("click",i=>{i.preventDefault(),this.form.reportValidity()&&this.validate().then(s=>{if(s?.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(n)}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,Jn)>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 n=t.getQuads(null,null,null,null);return zd(n,e,this.config.prefixes)}toRDF(e=new et){return this.shape?.toRDF(e),e}registerPlugin(e){Jd(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setSharedShapesGraph(e){Hf(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 ii(this.shape.shaclSubject,Re.namedNode(xe+"targetNode"),this.shape.nodeId,this.config.valuesGraphId));try{const t=this.config.store,n=await new ey(t,{details:!0,factory:Re}).validate({dataset:t});for(const i of n.results)if(i.focusNode?.ptrs?.length)for(const s of i.focusNode.ptrs){const a=s._term;if(i.path?.length){const o=i.path[0].predicates[0];let u=this.form.querySelectorAll(`
344
370
  :scope shacl-node[data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${o.id}'] > .editor,
345
371
  :scope shacl-node[data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${o.id}'] > .editor,
346
372
  :scope shacl-node[data-node-id='${a.id}'] > .shacl-group > shacl-property > .property-instance[data-path='${o.id}'] > .editor,
347
- :scope shacl-node[data-node-id='${a.id}'] > .shacl-group > shacl-property > .shacl-group > .property-instance[data-path='${o.id}'] > .editor`);l.length===0&&(l=this.form.querySelectorAll(`
373
+ :scope shacl-node[data-node-id='${a.id}'] > .shacl-group > shacl-property > .shacl-group > .property-instance[data-path='${o.id}'] > .editor`);u.length===0&&(u=this.form.querySelectorAll(`
348
374
  :scope [data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${o.id}'],
349
- :scope [data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${o.id}']`));for(const d of l)if(d.classList.contains("editor")){if(!e||d.value){let h=d.parentElement;h.classList.add("invalid"),h.classList.remove("valid"),h.appendChild(this.createValidationErrorDisplay(i));do h instanceof Qe&&(h.open=!0),h=h.parentElement;while(h)}}else e||(d.classList.add("invalid"),d.classList.remove("valid"),d.appendChild(this.createValidationErrorDisplay(i,"node")))}else e||this.form.querySelector(`:scope [data-node-id='${a.id}']`)?.prepend(this.createValidationErrorDisplay(i,"node"))}return n}catch(t){return console.error(t),!1}}createValidationErrorDisplay(e,t){const n=document.createElement("span");if(n.classList.add("validation-error"),t&&n.classList.add(t),e)if(e.message?.length>0)for(const i of e.message)n.title+=i.value+`
350
- `;else n.title=e.sourceConstraintComponent?.value;return n}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=xe.namedNode(this.config.attributes.shapeSubject),this.config.store.getQuads(e,Ue,ln,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,ut)>0){const t=xe.namedNode(this.config.attributes.valuesSubject),n=[...this.config.store.getQuads(t,Ue,null,ut),...this.config.store.getQuads(t,Ts,null,ut)];if(n.length===0){console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${Ue.id} nor ${Ts.id} statement`);return}for(const i of n)if(this.config.store.getQuads(i.object,Ue,ln,null).length>0){e=i.object;break}if(!e){const i=this.config.store.getQuads(null,Wr,n[0].object,null);if(i.length===0){console.error(`value subject '${this.config.attributes.valuesSubject}' has no shacl shape definition in the shapes graph`);return}if(i.length>1&&console.warn(`value subject '${this.config.attributes.valuesSubject}' has multiple shacl shape definitions in the shapes graph, choosing the first found (${i[0].subject})`),this.config.store.getQuads(i[0].subject,Ue,ln,null).length===0){console.error(`value subject '${this.config.attributes.valuesSubject}' references a shape which is not a NodeShape (${i[0].subject})`);return}e=i[0].subject}}else{const t=this.config.store.getQuads(null,Ue,ln,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,ut))this.config.store.delete(t),(t.object.termType==="NamedNode"||t.object.termType==="BlankNode")&&this.removeFromDataGraph(t.object)}};const dy=`.editor:not([type='checkbox']) { border: 1px solid #DDD; }
375
+ :scope [data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${o.id}']`));for(const l of u)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(i));do c instanceof ot&&(c.open=!0),c=c.parentElement;while(c)}}else e||(l.classList.add("invalid"),l.classList.remove("valid"),l.appendChild(this.createValidationErrorDisplay(i,"node")))}else e||this.form.querySelector(`:scope [data-node-id='${a.id}']`)?.prepend(this.createValidationErrorDisplay(i,"node"))}return n}catch(t){return console.error(t),!1}}createValidationErrorDisplay(e,t){const n=document.createElement("span");if(n.classList.add("validation-error"),t&&n.classList.add(t),e)if(e.message?.length>0)for(const i of e.message)n.title+=i.value+`
376
+ `;else n.title=e.sourceConstraintComponent?.value;return n}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=Re.namedNode(this.config.attributes.shapeSubject),this.config.store.getQuads(e,tt,Pn,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,vt)>0){const t=Re.namedNode(this.config.attributes.valuesSubject),n=[...this.config.store.getQuads(t,tt,null,vt),...this.config.store.getQuads(t,na,null,vt)];if(n.length===0){console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${tt.id} nor ${na.id} statement`);return}for(const i of n)if(this.config.store.getQuads(i.object,tt,Pn,null).length>0){e=i.object;break}if(!e){const i=this.config.store.getQuads(null,_n,n[0].object,null);if(i.length===0){console.error(`value subject '${this.config.attributes.valuesSubject}' has no shacl shape definition in the shapes graph`);return}if(i.length>1&&console.warn(`value subject '${this.config.attributes.valuesSubject}' has multiple shacl shape definitions in the shapes graph, choosing the first found (${i[0].subject})`),this.config.store.getQuads(i[0].subject,tt,Pn,null).length===0){console.error(`value subject '${this.config.attributes.valuesSubject}' references a shape which is not a NodeShape (${i[0].subject})`);return}e=i[0].subject}}else{const t=this.config.store.getQuads(null,tt,Pn,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,vt))this.config.store.delete(t),(t.object.termType==="NamedNode"||t.object.termType==="BlankNode")&&this.removeFromDataGraph(t.object)}};const ry=`.editor:not([type='checkbox']) { border: 1px solid #DDD; }
351
377
  .property-instance label { display: inline-flex; word-break: break-word; line-height: 1em; padding-top: 0.15em; padding-right: 1em; flex-shrink: 0; position: relative; }
352
378
  .property-instance:not(:first-child) > label:not(.persistent) { visibility: hidden; max-height: 0; }
353
379
  .mode-edit .property-instance label { width: var(--label-width); }
354
- `;class fy extends fd{constructor(e){super(e||dy),this.idCtr=0}createDefaultTemplate(e,t,n,i,s){i.id=`e${this.idCtr++}`,i.classList.add("editor"),s?.datatype?i.shaclDatatype=s.datatype:t instanceof Ze&&(i.shaclDatatype=t.datatype),s?.minCount!==void 0&&(i.dataset.minCount=String(s.minCount)),s?.class&&(i.dataset.class=s.class.value),s?.nodeKind?i.dataset.nodeKind=s.nodeKind.value:t instanceof Rn&&(i.dataset.nodeKind=be+"IRI"),(s?.hasValue||s?.readonly)&&(i.disabled=!0),i.value=t?.value||s?.defaultValue?.value||"";const a=document.createElement("label");a.htmlFor=i.id,a.innerText=e,s?.description&&a.setAttribute("title",s.description.value);const o=s?.description?s.description.value:s?.pattern?s.pattern:null;o&&i.setAttribute("placeholder",o),n&&(i.setAttribute("required","true"),a.classList.add("required"));const l=document.createElement("div");return l.appendChild(a),l.appendChild(i),l}createDateEditor(e,t,n,i){const s=new ke;i.datatype?.value===Rt+"dateTime"?(s.type="datetime-local",s.setAttribute("step","1")):s.type="date",s.clearable=!0,s.dense=!0,s.classList.add("pr-0");const a=this.createDefaultTemplate(e,null,n,s,i);if(t)try{let o=new Date(t.value).toISOString();i.datatype?.value===Rt+"dateTime"?o=o.slice(0,19):o=o.slice(0,10),s.value=o}catch(o){console.error(o,t)}return a}createTextEditor(e,t,n,i){let s;return i.singleLine===!1?(s=new Ft,s.resize="auto"):s=new ke,s.dense=!0,i.pattern&&(s.pattern=i.pattern),i.minLength&&(s.minLength=i.minLength),i.maxLength&&(s.maxLength=i.maxLength),this.createDefaultTemplate(e,t,n,s,i)}createLangStringEditor(e,t,n,i){const s=this.createTextEditor(e,t,n,i),a=s.querySelector(":scope .editor");let o;if(i.languageIn?.length){o=document.createElement("select");for(const l of i.languageIn){const d=document.createElement("option");d.innerText=l.value,o.appendChild(d)}}else o=document.createElement("input"),o.maxLength=5,o.size=5,o.placeholder="lang?";return o.title="Language of the text",o.classList.add("lang-chooser"),o.slot="suffix",o.addEventListener("change",l=>{l.stopPropagation(),a&&(a.dataset.lang=o.value,a.dispatchEvent(new Event("change",{bubbles:!0})))}),t instanceof Ze&&(o.value=t.language),a.dataset.lang=o.value,a.appendChild(o),s}createBooleanEditor(e,t,n,i){const s=document.createElement("input");s.type="checkbox",s.classList.add("ml-0");const a=this.createDefaultTemplate(e,null,n,s,i);return s.removeAttribute("required"),a.querySelector(":scope label")?.classList.remove("required"),t instanceof Ze&&(s.checked=t.value==="true"),a}createFileEditor(e,t,n,i){const s=document.createElement("input");return s.type="file",s.addEventListener("change",a=>{if(s.files?.length){a.stopPropagation();const o=new FileReader;o.readAsDataURL(s.files[0]),o.onload=()=>{s.binaryData=btoa(o.result),s.parentElement?.dispatchEvent(new Event("change",{bubbles:!0}))}}else s.binaryData=void 0}),this.createDefaultTemplate(e,t,n,s,i)}createNumberEditor(e,t,n,i){const s=new ke;s.type="number",s.clearable=!0,s.dense=!0,s.classList.add("pr-0");const a=i.minInclusive!==void 0?i.minInclusive:i.minExclusive!==void 0?i.minExclusive+1:void 0,o=i.maxInclusive!==void 0?i.maxInclusive:i.maxExclusive!==void 0?i.maxExclusive-1:void 0;return a!==void 0&&(s.min=String(a)),o!==void 0&&(s.max=String(o)),i.datatype?.value!==Rt+"integer"&&(s.step="0.1"),this.createDefaultTemplate(e,t,n,s,i)}createListEditor(e,t,n,i,s){const a=new Me;a.clearable=!0,a.dense=!0;const o=this.createDefaultTemplate(e,null,n,a,s),l=document.createElement("ul");let d=!0;const h=(y,w)=>{const g=document.createElement("li");if(typeof y.value=="string"?(g.dataset.value=y.value,g.innerText=y.label?y.label:y.value):(y.value instanceof Ze&&y.value.datatype.equals(id)?g.dataset.value=y.value.value:g.dataset.value=y.value.id,g.innerText=y.label?y.label:y.value.value),w.appendChild(g),y.children?.length){d=!1;const m=document.createElement("ul");g.appendChild(m);for(const _ of y.children)h(_,m)}};for(const y of i)h(y,l);return d||(a.collapse=!0),a.appendChild(l),t&&(a.value=t.value),o}createButton(e,t){const n=document.createElement("button");return n.type="button",n.innerHTML=e,n}}class hy extends cy{constructor(){super(new fy)}}window.customElements.define("shacl-form",hy);export{bl as Config,Qf as Loader,_y as Plugin,hy as ShaclForm,cd as ShaclPropertyTemplate,fd as Theme,Pt as findLabel,md as registerPlugin,Xf as setSharedShapesGraph};
380
+ `;class ny extends Gd{constructor(e){super(e||ry),this.idCtr=0}createDefaultTemplate(e,t,n,i,s){i.id=`e${this.idCtr++}`,i.classList.add("editor"),s?.datatype?i.shaclDatatype=s.datatype:t instanceof ct&&(i.shaclDatatype=t.datatype),s?.minCount!==void 0&&(i.dataset.minCount=String(s.minCount)),s?.class&&(i.dataset.class=s.class.value),s?.nodeKind?i.dataset.nodeKind=s.nodeKind.value:t instanceof ni&&(i.dataset.nodeKind=xe+"IRI"),(s?.hasValue||s?.readonly)&&(i.disabled=!0),i.value=t?.value||s?.defaultValue?.value||"";const a=document.createElement("label");a.htmlFor=i.id,a.innerText=e,s?.description&&a.setAttribute("title",s.description.value);const o=s?.description?s.description.value:s?.pattern?s.pattern:null;o&&i.setAttribute("placeholder",o),n&&(i.setAttribute("required","true"),a.classList.add("required"));const u=document.createElement("div");return u.appendChild(a),u.appendChild(i),u}createDateEditor(e,t,n,i){const s=new Ue;i.datatype?.value===Ut+"dateTime"?(s.type="datetime-local",s.setAttribute("step","1")):s.type="date",s.clearable=!0,s.dense=!0,s.classList.add("pr-0");const a=this.createDefaultTemplate(e,null,n,s,i);if(t)try{let o=new Date(t.value).toISOString();i.datatype?.value===Ut+"dateTime"?o=o.slice(0,19):o=o.slice(0,10),s.value=o}catch(o){console.error(o,t)}return a}createTextEditor(e,t,n,i){let s;return i.singleLine===!1?(s=new sr,s.resize="auto"):s=new Ue,s.dense=!0,i.pattern&&(s.pattern=i.pattern),i.minLength&&(s.minLength=i.minLength),i.maxLength&&(s.maxLength=i.maxLength),this.createDefaultTemplate(e,t,n,s,i)}createLangStringEditor(e,t,n,i){const s=this.createTextEditor(e,t,n,i),a=s.querySelector(":scope .editor");let o;if(i.languageIn?.length){o=document.createElement("select");for(const u of i.languageIn){const l=document.createElement("option");l.innerText=u.value,o.appendChild(l)}}else o=document.createElement("input"),o.maxLength=5,o.size=5,o.placeholder="lang?";return o.title="Language of the text",o.classList.add("lang-chooser"),o.slot="suffix",o.addEventListener("change",u=>{u.stopPropagation(),a&&(a.dataset.lang=o.value,a.dispatchEvent(new Event("change",{bubbles:!0})))}),t instanceof ct&&(o.value=t.language),a.dataset.lang=o.value,a.appendChild(o),s}createBooleanEditor(e,t,n,i){const s=document.createElement("input");s.type="checkbox",s.classList.add("ml-0");const a=this.createDefaultTemplate(e,null,n,s,i);return s.removeAttribute("required"),a.querySelector(":scope label")?.classList.remove("required"),t instanceof ct&&(s.checked=t.value==="true"),a}createFileEditor(e,t,n,i){const s=document.createElement("input");return s.type="file",s.addEventListener("change",a=>{if(s.files?.length){a.stopPropagation();const o=new FileReader;o.readAsDataURL(s.files[0]),o.onload=()=>{s.binaryData=btoa(o.result),s.parentElement?.dispatchEvent(new Event("change",{bubbles:!0}))}}else s.binaryData=void 0}),this.createDefaultTemplate(e,t,n,s,i)}createNumberEditor(e,t,n,i){const s=new Ue;s.type="number",s.clearable=!0,s.dense=!0,s.classList.add("pr-0");const a=i.minInclusive!==void 0?i.minInclusive:i.minExclusive!==void 0?i.minExclusive+1:void 0,o=i.maxInclusive!==void 0?i.maxInclusive:i.maxExclusive!==void 0?i.maxExclusive-1:void 0;return a!==void 0&&(s.min=String(a)),o!==void 0&&(s.max=String(o)),i.datatype?.value!==Ut+"integer"&&(s.step="0.1"),this.createDefaultTemplate(e,t,n,s,i)}createListEditor(e,t,n,i,s){const a=new We;a.clearable=!0,a.dense=!0;const o=this.createDefaultTemplate(e,null,n,a,s),u=document.createElement("ul");let l=!0;const c=(d,m)=>{const b=document.createElement("li");if(typeof d.value=="string"?(b.dataset.value=d.value,b.innerText=d.label?d.label:d.value):(d.value instanceof ct&&d.value.datatype.equals(kd)?b.dataset.value=d.value.value:b.dataset.value=d.value.id,b.innerText=d.label?d.label:d.value.value),m.appendChild(b),d.children?.length){l=!1;const _=document.createElement("ul");b.appendChild(_);for(const x of d.children)c(x,_)}};for(const d of i)c(d,u);return l||(a.collapse=!0),a.appendChild(u),t&&(a.value=t.value),o}createButton(e,t){const n=document.createElement("button");return n.type="button",n.innerHTML=e,n}}class iy extends ty{constructor(){super(new ny)}}window.customElements.define("shacl-form",iy);export{ou as Config,Uf as Loader,hy as Plugin,iy as ShaclForm,Hd as ShaclPropertyTemplate,Gd as Theme,Sn as findLabel,Jd as registerPlugin,Hf as setSharedShapesGraph};