@ulb-darmstadt/shacl-form 1.9.4 → 1.10.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.
- package/README.md +1 -5
- package/dist/config.d.ts +1 -0
- package/dist/constants.d.ts +1 -0
- package/dist/exports.d.ts +1 -1
- package/dist/form-bootstrap.js +91 -69
- package/dist/form-default.js +88 -66
- package/dist/form-material.js +128 -106
- package/dist/form.d.ts +0 -1
- package/dist/loader.d.ts +3 -2
- package/dist/plugins/leaflet.js +2 -2
- package/dist/plugins/mapbox.js +15 -15
- package/package.json +3 -3
- package/src/config.ts +1 -0
- package/src/constants.ts +1 -0
- package/src/exports.ts +1 -1
- package/src/form.ts +0 -6
- package/src/loader.ts +91 -65
- package/src/node.ts +2 -2
- package/src/property.ts +1 -0
package/dist/form-default.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Sr=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 bi={},Hr={},Qa;function id(){if(Qa)return Hr;Qa=1,Hr.byteLength=o,Hr.toByteArray=l,Hr.fromByteArray=b;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(y){var _=y.length;if(_%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=y.indexOf("=");E===-1&&(E=_);var v=E===_?0:4-E%4;return[E,v]}function o(y){var _=a(y),E=_[0],v=_[1];return(E+v)*3/4-v}function u(y,_,E){return(_+E)*3/4-E}function l(y){var _,E=a(y),v=E[0],x=E[1],S=new t(u(y,v,x)),m=0,d=x>0?v-4:v,g;for(g=0;g<d;g+=4)_=e[y.charCodeAt(g)]<<18|e[y.charCodeAt(g+1)]<<12|e[y.charCodeAt(g+2)]<<6|e[y.charCodeAt(g+3)],S[m++]=_>>16&255,S[m++]=_>>8&255,S[m++]=_&255;return x===2&&(_=e[y.charCodeAt(g)]<<2|e[y.charCodeAt(g+1)]>>4,S[m++]=_&255),x===1&&(_=e[y.charCodeAt(g)]<<10|e[y.charCodeAt(g+1)]<<4|e[y.charCodeAt(g+2)]>>2,S[m++]=_>>8&255,S[m++]=_&255),S}function c(y){return r[y>>18&63]+r[y>>12&63]+r[y>>6&63]+r[y&63]}function h(y,_,E){for(var v,x=[],S=_;S<E;S+=3)v=(y[S]<<16&16711680)+(y[S+1]<<8&65280)+(y[S+2]&255),x.push(c(v));return x.join("")}function b(y){for(var _,E=y.length,v=E%3,x=[],S=16383,m=0,d=E-v;m<d;m+=S)x.push(h(y,m,m+S>d?d:m+S));return v===1?(_=y[E-1],x.push(r[_>>2]+r[_<<4&63]+"==")):v===2&&(_=(y[E-2]<<8)+y[E-1],x.push(r[_>>10]+r[_>>4&63]+r[_<<2&63]+"=")),x.join("")}return Hr}var jn={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var Xa;function sd(){return Xa||(Xa=1,jn.read=function(r,e,t,n,i){var s,a,o=i*8-n-1,u=(1<<o)-1,l=u>>1,c=-7,h=t?i-1:0,b=t?-1:1,y=r[e+h];for(h+=b,s=y&(1<<-c)-1,y>>=-c,c+=o;c>0;s=s*256+r[e+h],h+=b,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=a*256+r[e+h],h+=b,c-=8);if(s===0)s=1-l;else{if(s===u)return a?NaN:(y?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-l}return(y?-1:1)*a*Math.pow(2,s-n)},jn.write=function(r,e,t,n,i,s){var a,o,u,l=s*8-i-1,c=(1<<l)-1,h=c>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:s-1,_=n?1:-1,E=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+h>=1?e+=b/u:e+=b*Math.pow(2,1-h),e*u>=2&&(a++,u/=2),a+h>=c?(o=0,a=c):a+h>=1?(o=(e*u-1)*Math.pow(2,i),a=a+h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;r[t+y]=o&255,y+=_,o/=256,i-=8);for(a=a<<i|o,l+=i;l>0;r[t+y]=a&255,y+=_,a/=256,l-=8);r[t+y-_]|=E*128}),jn}/*!
|
|
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 Ja;function Lt(){return Ja||(Ja=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 I=new Uint8Array(1),f={foo:function(){return 42}};return Object.setPrototypeOf(f,Uint8Array.prototype),Object.setPrototypeOf(I,f),I.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(I){if(I>i)throw new RangeError('The value "'+I+'" is invalid for option "size"');const f=new Uint8Array(I);return Object.setPrototypeOf(f,o.prototype),f}function o(I,f,p){if(typeof I=="number"){if(typeof f=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(I)}return u(I,f,p)}o.poolSize=8192;function u(I,f,p){if(typeof I=="string")return b(I,f);if(ArrayBuffer.isView(I))return _(I);if(I==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I);if(le(I,ArrayBuffer)||I&&le(I.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(le(I,SharedArrayBuffer)||I&&le(I.buffer,SharedArrayBuffer)))return E(I,f,p);if(typeof I=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const $=I.valueOf&&I.valueOf();if($!=null&&$!==I)return o.from($,f,p);const X=v(I);if(X)return X;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof I[Symbol.toPrimitive]=="function")return o.from(I[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 I)}o.from=function(I,f,p){return u(I,f,p)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function l(I){if(typeof I!="number")throw new TypeError('"size" argument must be of type number');if(I<0)throw new RangeError('The value "'+I+'" is invalid for option "size"')}function c(I,f,p){return l(I),I<=0?a(I):f!==void 0?typeof p=="string"?a(I).fill(f,p):a(I).fill(f):a(I)}o.alloc=function(I,f,p){return c(I,f,p)};function d(I){return l(I),a(I<0?0:x(I)|0)}o.allocUnsafe=function(I){return d(I)},o.allocUnsafeSlow=function(I){return d(I)};function b(I,f){if((typeof f!="string"||f==="")&&(f="utf8"),!o.isEncoding(f))throw new TypeError("Unknown encoding: "+f);const p=m(I,f)|0;let $=a(p);const X=$.write(I,f);return X!==p&&($=$.slice(0,X)),$}function y(I){const f=I.length<0?0:x(I.length)|0,p=a(f);for(let $=0;$<f;$+=1)p[$]=I[$]&255;return p}function _(I){if(le(I,Uint8Array)){const f=new Uint8Array(I);return E(f.buffer,f.byteOffset,f.byteLength)}return y(I)}function E(I,f,p){if(f<0||I.byteLength<f)throw new RangeError('"offset" is outside of buffer bounds');if(I.byteLength<f+(p||0))throw new RangeError('"length" is outside of buffer bounds');let $;return f===void 0&&p===void 0?$=new Uint8Array(I):p===void 0?$=new Uint8Array(I,f):$=new Uint8Array(I,f,p),Object.setPrototypeOf($,o.prototype),$}function v(I){if(o.isBuffer(I)){const f=x(I.length)|0,p=a(f);return p.length===0||I.copy(p,0,0,f),p}if(I.length!==void 0)return typeof I.length!="number"||Ne(I.length)?a(0):y(I);if(I.type==="Buffer"&&Array.isArray(I.data))return y(I.data)}function x(I){if(I>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return I|0}function S(I){return+I!=I&&(I=0),o.alloc(+I)}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,X=p.length;for(let oe=0,de=Math.min($,X);oe<de;++oe)if(f[oe]!==p[oe]){$=f[oe],X=p[oe];break}return $<X?-1:X<$?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 X=o.allocUnsafe(p);let oe=0;for($=0;$<f.length;++$){let de=f[$];if(le(de,Uint8Array))oe+de.length>X.length?(o.isBuffer(de)||(de=o.from(de)),de.copy(X,oe)):Uint8Array.prototype.set.call(X,de,oe);else if(o.isBuffer(de))de.copy(X,oe);else throw new TypeError('"list" argument must be an Array of Buffers');oe+=de.length}return X};function m(I,f){if(o.isBuffer(I))return I.length;if(ArrayBuffer.isView(I)||le(I,ArrayBuffer))return I.byteLength;if(typeof I!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof I);const p=I.length,$=arguments.length>2&&arguments[2]===!0;if(!$&&p===0)return 0;let X=!1;for(;;)switch(f){case"ascii":case"latin1":case"binary":return p;case"utf8":case"utf-8":return pe(I).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return p*2;case"hex":return p>>>1;case"base64":return ce(I).length;default:if(X)return $?-1:pe(I).length;f=(""+f).toLowerCase(),X=!0}}o.byteLength=m;function h(I,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(I||(I="utf8");;)switch(I){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: "+I);I=(I+"").toLowerCase(),$=!0}}o.prototype._isBuffer=!0;function g(I,f,p){const $=I[f];I[f]=I[p],I[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,$,X,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),X===void 0&&(X=0),oe===void 0&&(oe=this.length),p<0||$>f.length||X<0||oe>this.length)throw new RangeError("out of range index");if(X>=oe&&p>=$)return 0;if(X>=oe)return-1;if(p>=$)return 1;if(p>>>=0,$>>>=0,X>>>=0,oe>>>=0,this===f)return 0;let de=oe-X,Ee=$-p;const ke=Math.min(de,Ee),Oe=this.slice(X,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 N(I,f,p,$,X){if(I.length===0)return-1;if(typeof p=="string"?($=p,p=0):p>2147483647?p=2147483647:p<-2147483648&&(p=-2147483648),p=+p,Ne(p)&&(p=X?0:I.length-1),p<0&&(p=I.length+p),p>=I.length){if(X)return-1;p=I.length-1}else if(p<0)if(X)p=0;else return-1;if(typeof f=="string"&&(f=o.from(f,$)),o.isBuffer(f))return f.length===0?-1:j(I,f,p,$,X);if(typeof f=="number")return f=f&255,typeof Uint8Array.prototype.indexOf=="function"?X?Uint8Array.prototype.indexOf.call(I,f,p):Uint8Array.prototype.lastIndexOf.call(I,f,p):j(I,[f],p,$,X);throw new TypeError("val must be string, number or Buffer")}function j(I,f,p,$,X){let oe=1,de=I.length,Ee=f.length;if($!==void 0&&($=String($).toLowerCase(),$==="ucs2"||$==="ucs-2"||$==="utf16le"||$==="utf-16le")){if(I.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(X){let Le=-1;for(Oe=p;Oe<de;Oe++)if(ke(I,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(I,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 N(this,f,p,$,!0)},o.prototype.lastIndexOf=function(f,p,$){return N(this,f,p,$,!1)};function A(I,f,p,$){p=Number(p)||0;const X=I.length-p;$?($=Number($),$>X&&($=X)):$=X;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;I[p+de]=Ee}return de}function B(I,f,p,$){return ye(pe(f,I.length-p),I,p,$)}function R(I,f,p,$){return ye(me(f),I,p,$)}function F(I,f,p,$){return ye(ce(f),I,p,$)}function q(I,f,p,$){return ye(J(f,I.length-p),I,p,$)}o.prototype.write=function(f,p,$,X){if(p===void 0)X="utf8",$=this.length,p=0;else if($===void 0&&typeof p=="string")X=p,$=this.length,p=0;else if(isFinite(p))p=p>>>0,isFinite($)?($=$>>>0,X===void 0&&(X="utf8")):(X=$,$=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");X||(X="utf8");let de=!1;for(;;)switch(X){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: "+X);X=(""+X).toLowerCase(),de=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function D(I,f,p){return f===0&&p===I.length?e.fromByteArray(I):e.fromByteArray(I.slice(f,p))}function O(I,f,p){p=Math.min(I.length,p);const $=[];let X=f;for(;X<p;){const oe=I[X];let de=null,Ee=oe>239?4:oe>223?3:oe>191?2:1;if(X+Ee<=p){let ke,Oe,Le,De;switch(Ee){case 1:oe<128&&(de=oe);break;case 2:ke=I[X+1],(ke&192)===128&&(De=(oe&31)<<6|ke&63,De>127&&(de=De));break;case 3:ke=I[X+1],Oe=I[X+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=I[X+1],Oe=I[X+2],Le=I[X+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),X+=Ee}return T($)}const te=4096;function T(I){const f=I.length;if(f<=te)return String.fromCharCode.apply(String,I);let p="",$=0;for(;$<f;)p+=String.fromCharCode.apply(String,I.slice($,$+=te));return p}function Z(I,f,p){let $="";p=Math.min(I.length,p);for(let X=f;X<p;++X)$+=String.fromCharCode(I[X]&127);return $}function k(I,f,p){let $="";p=Math.min(I.length,p);for(let X=f;X<p;++X)$+=String.fromCharCode(I[X]);return $}function Y(I,f,p){const $=I.length;(!f||f<0)&&(f=0),(!p||p<0||p>$)&&(p=$);let X="";for(let oe=f;oe<p;++oe)X+=ze[I[oe]];return X}function w(I,f,p){const $=I.slice(f,p);let X="";for(let oe=0;oe<$.length-1;oe+=2)X+=String.fromCharCode($[oe]+$[oe+1]*256);return X}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 X=this.subarray(f,p);return Object.setPrototypeOf(X,o.prototype),X};function H(I,f,p){if(I%1!==0||I<0)throw new RangeError("offset is not uint");if(I+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 X=this[f],oe=1,de=0;for(;++de<p&&(oe*=256);)X+=this[f+de]*oe;return X},o.prototype.readUintBE=o.prototype.readUIntBE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=this[f+--p],oe=1;for(;p>0&&(oe*=256);)X+=this[f+--p]*oe;return X},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,C(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=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(X)+(BigInt(oe)<<BigInt(32))}),o.prototype.readBigUInt64BE=Se(function(f){f=f>>>0,C(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=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(X)<<BigInt(32))+BigInt(oe)}),o.prototype.readIntLE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=this[f],oe=1,de=0;for(;++de<p&&(oe*=256);)X+=this[f+de]*oe;return oe*=128,X>=oe&&(X-=Math.pow(2,8*p)),X},o.prototype.readIntBE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=p,oe=1,de=this[f+--X];for(;X>0&&(oe*=256);)de+=this[f+--X]*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,C(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=this[f+4]+this[f+5]*2**8+this[f+6]*2**16+($<<24);return(BigInt(X)<<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,C(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=(p<<24)+this[++f]*2**16+this[++f]*2**8+this[++f];return(BigInt(X)<<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(I,f,p,$,X,oe){if(!o.isBuffer(I))throw new TypeError('"buffer" argument must be a Buffer instance');if(f>X||f<oe)throw new RangeError('"value" argument is out of bounds');if(p+$>I.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(f,p,$,X){if(f=+f,p=p>>>0,$=$>>>0,!X){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,$,X){if(f=+f,p=p>>>0,$=$>>>0,!X){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 Q(I,f,p,$,X){ge(f,$,X,I,p,7);let oe=Number(f&BigInt(4294967295));I[p++]=oe,oe=oe>>8,I[p++]=oe,oe=oe>>8,I[p++]=oe,oe=oe>>8,I[p++]=oe;let de=Number(f>>BigInt(32)&BigInt(4294967295));return I[p++]=de,de=de>>8,I[p++]=de,de=de>>8,I[p++]=de,de=de>>8,I[p++]=de,p}function ue(I,f,p,$,X){ge(f,$,X,I,p,7);let oe=Number(f&BigInt(4294967295));I[p+7]=oe,oe=oe>>8,I[p+6]=oe,oe=oe>>8,I[p+5]=oe,oe=oe>>8,I[p+4]=oe;let de=Number(f>>BigInt(32)&BigInt(4294967295));return I[p+3]=de,de=de>>8,I[p+2]=de,de=de>>8,I[p+1]=de,de=de>>8,I[p]=de,p+8}o.prototype.writeBigUInt64LE=Se(function(f,p=0){return Q(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,$,X){if(f=+f,p=p>>>0,!X){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,$,X){if(f=+f,p=p>>>0,!X){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 Q(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(I,f,p,$,X,oe){if(p+$>I.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("Index out of range")}function G(I,f,p,$,X){return f=+f,p=p>>>0,X||V(I,f,p,4),t.write(I,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(I,f,p,$,X){return f=+f,p=p>>>0,X||V(I,f,p,8),t.write(I,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,$,X){if(!o.isBuffer(f))throw new TypeError("argument should be a Buffer");if($||($=0),!X&&X!==0&&(X=this.length),p>=f.length&&(p=f.length),p||(p=0),X>0&&X<$&&(X=$),X===$||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(X<0)throw new RangeError("sourceEnd out of bounds");X>this.length&&(X=this.length),f.length-p<X-$&&(X=f.length-p+$);const oe=X-$;return this===f&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(p,$,X):Uint8Array.prototype.set.call(f,this.subarray($,X),p),oe},o.prototype.fill=function(f,p,$,X){if(typeof f=="string"){if(typeof p=="string"?(X=p,p=0,$=this.length):typeof $=="string"&&(X=$,$=this.length),X!==void 0&&typeof X!="string")throw new TypeError("encoding must be a string");if(typeof X=="string"&&!o.isEncoding(X))throw new TypeError("Unknown encoding: "+X);if(f.length===1){const de=f.charCodeAt(0);(X==="utf8"&&de<128||X==="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,X),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(I,f,p){U[I]=class extends p{constructor(){super(),Object.defineProperty(this,"message",{value:f.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${I}]`,this.stack,delete this.name}get code(){return I}set code(X){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:X,writable:!0})}toString(){return`${this.name} [${I}]: ${this.message}`}}}ee("ERR_BUFFER_OUT_OF_BOUNDS",function(I){return I?`${I} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ee("ERR_INVALID_ARG_TYPE",function(I,f){return`The "${I}" argument must be of type number. Received type ${typeof f}`},TypeError),ee("ERR_OUT_OF_RANGE",function(I,f,p){let $=`The value of "${I}" is out of range.`,X=p;return Number.isInteger(p)&&Math.abs(p)>2**32?X=re(String(p)):typeof p=="bigint"&&(X=String(p),(p>BigInt(2)**BigInt(32)||p<-(BigInt(2)**BigInt(32)))&&(X=re(X)),X+="n"),$+=` It must be ${f}. Received ${X}`,$},RangeError);function re(I){let f="",p=I.length;const $=I[0]==="-"?1:0;for(;p>=$+4;p-=3)f=`_${I.slice(p-3,p)}${f}`;return`${I.slice(0,p)}${f}`}function fe(I,f,p){C(f,"offset"),(I[f]===void 0||I[f+p]===void 0)&&W(f,I.length-(p+1))}function ge(I,f,p,$,X,oe){if(I>p||I<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,I)}fe($,X,oe)}function C(I,f){if(typeof I!="number")throw new U.ERR_INVALID_ARG_TYPE(f,"number",I)}function W(I,f,p){throw Math.floor(I)!==I?(C(I,p),new U.ERR_OUT_OF_RANGE("offset","an integer",I)):f<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${f}`,I)}const se=/[^+/0-9A-Za-z-_]/g;function he(I){if(I=I.split("=")[0],I=I.trim().replace(se,""),I.length<2)return"";for(;I.length%4!==0;)I=I+"=";return I}function pe(I,f){f=f||1/0;let p;const $=I.length;let X=null;const oe=[];for(let de=0;de<$;++de){if(p=I.charCodeAt(de),p>55295&&p<57344){if(!X){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}X=p;continue}if(p<56320){(f-=3)>-1&&oe.push(239,191,189),X=p;continue}p=(X-55296<<10|p-56320)+65536}else X&&(f-=3)>-1&&oe.push(239,191,189);if(X=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(I){const f=[];for(let p=0;p<I.length;++p)f.push(I.charCodeAt(p)&255);return f}function J(I,f){let p,$,X;const oe=[];for(let de=0;de<I.length&&!((f-=2)<0);++de)p=I.charCodeAt(de),$=p>>8,X=p%256,oe.push(X),oe.push($);return oe}function ce(I){return e.toByteArray(he(I))}function ye(I,f,p,$){let X;for(X=0;X<$&&!(X+p>=f.length||X>=I.length);++X)f[X+p]=I[X];return X}function le(I,f){return I instanceof f||I!=null&&I.constructor!=null&&I.constructor.name!=null&&I.constructor.name===f.name}function Ne(I){return I!==I}const ze=function(){const I="0123456789abcdef",f=new Array(256);for(let p=0;p<16;++p){const $=p*16;for(let X=0;X<16;++X)f[$+X]=I[p]+I[X]}return f}();function Se(I){return typeof BigInt>"u"?Xe:I}function Xe(){throw new Error("BigInt not supported")}}(yi)),yi}var ad=Lt();const Ur="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Hr="http://www.w3.org/2001/XMLSchema#",jn="http://www.w3.org/2000/10/swap/",Ke={xsd:{decimal:`${Hr}decimal`,boolean:`${Hr}boolean`,double:`${Hr}double`,integer:`${Hr}integer`,string:`${Hr}string`},rdf:{type:`${Ur}type`,nil:`${Ur}nil`,first:`${Ur}first`,rest:`${Ur}rest`,langString:`${Ur}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${jn}reify#forSome`,forAll:`${jn}reify#forAll`},log:{implies:`${jn}log#implies`,isImpliedBy:`${jn}log#isImpliedBy`}},{xsd:Cn}=Ke,od=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Ka={"\\":"\\","'":"'",'"':'"',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="",b="",y="",_=null,E=0,v=!1;switch(c){case"^":if(n.length<3)break;if(n[1]==="^"){if(this._previousMarker="^^",n=n.substr(2),n[0]!=="<"){v=!0;break}}else{this._n3Mode&&(E=1,d="^");break}case"<":if(_=this._unescapedIri.exec(n))d="IRI",b=_[1];else if(_=this._iri.exec(n)){if(b=this._unescape(_[1]),b===null||ld.test(b))return a(this);d="IRI"}else n.length>1&&n[1]==="<"?(d="<<",E=2):this._n3Mode&&n.length>1&&n[1]==="="&&(E=2,this._isImpliedBy?(d="abbreviation",b="<"):(d="inverse",b=">"));break;case">":n.length>1&&n[1]===">"&&(d=">>",E=2);break;case"_":((_=this._blank.exec(n))||t&&(_=this._blank.exec(`${n} `)))&&(d="blank",y="_",b=_[1]);break;case'"':if(_=this._simpleQuotedString.exec(n))b=_[1];else if({value:b,matchLength:E}=this._parseLiteral(n),b===null)return a(this);(_!==null||E!==0)&&(d="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(_=this._simpleApostropheString.exec(n))b=_[1];else if({value:b,matchLength:E}=this._parseLiteral(n),b===null)return a(this);(_!==null||E!==0)&&(d="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(_=this._variable.exec(n))&&(d="var",b=_[0]);break;case"@":this._previousMarker==="literal"&&(_=this._langcode.exec(n))?(d="langcode",b=_[1]):(_=this._keyword.exec(n))&&(d=_[0]);break;case".":if(n.length===1?t:n[1]<"0"||n[1]>"9"){d=".",E=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",b=_[0],y=typeof _[1]=="string"?Cn.double:typeof _[2]=="string"?Cn.decimal:Cn.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(_=this._sparqlKeyword.exec(n))?d=_[0].toUpperCase():v=!0;break;case"f":case"t":(_=this._boolean.exec(n))?(d="literal",b=_[0],y=Cn.boolean):v=!0;break;case"a":(_=this._shortPredicates.exec(n))?(d="abbreviation",b="a"):v=!0;break;case"=":this._n3Mode&&n.length>1&&(d="abbreviation",n[1]!==">"?(E=1,b="="):(E=2,b=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(E=1,d=c);break;case"{":!this._lineMode&&n.length>=2&&(n[1]==="|"?(d="{|",E=2):(d=c,E=1));break;case"|":n.length>=2&&n[1]==="}"&&(d="|}",E=2);break;default:v=!0}if(v&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(_=this._prefix.exec(n))?(d="prefix",b=_[1]||""):((_=this._prefixed.exec(n))||t&&(_=this._prefixed.exec(`${n} `)))&&(d="prefixed",y=_[1]||"",b=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 x=E||_[0].length,S=s(d,b,y,l,x);this.previousToken=S,this._previousMarker=d,n=n.substr(x,n.length)}function s(o,u,l,c,d){const b=n?i-n.length:i,y=b+d,_={type:o,value:u,prefix:l,line:c,start:b,end:y};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 Ka?Ka[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:ir}=Ke;let Lr,fd=0;const Re={namedNode:zu,blankNode:Qu,variable:Ju,literal:Xu,defaultGraph:yd,quad:ra,triple:ra,fromTerm:dn,fromQuad:Ku};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 ii=class extends bt{get termType(){return"NamedNode"}},ut=class Wu 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 ii(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!=="@"?ir.string:hd.langString}equals(e){return e instanceof Wu?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(""),Lr||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};Lr=new md;function cn(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 ut(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(cn(r[0],e,!0),cn(r[1],e,!0),cn(r[2],e,!0),r[3]&&cn(r[3],e,!0))}function Sr(r,e){if(typeof r=="string")return r;if(r instanceof bt&&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!==ir.string?`^^${r.datatype.value}`:""}`;case"Quad":const t=[Sr(r.subject,!0),Sr(r.predicate,!0),Sr(r.object,!0)];return r.graph&&r.graph.termType!=="DefaultGraph"&&t.push(Sr(r.graph,!0)),e?t:JSON.stringify(t);default:throw new Error(`Unexpected termType: ${r.termType}`)}}let si=class extends bt{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 zu(r){return new ii(r)}function Qu(r){return new pd(r||`n3-${fd++}`)}function Xu(r,e){if(typeof e=="string")return new ut(`"${r}"@${e.toLowerCase()}`);let t=e?e.value:"";return t===""&&(typeof r=="boolean"?t=ir.boolean:typeof r=="number"&&(Number.isFinite(r)?t=Number.isInteger(r)?ir.integer:ir.double:(t=ir.double,Number.isNaN(r)||(r=r>0?"INF":"-INF")))),t===""||t===ir.string?new ut(`"${r}"`):new ut(`"${r}"^^${t}`)}function Ju(r){return new gd(r)}function yd(){return Lr}function ra(r,e,t,n){return new si(r,e,t,n)}function dn(r){if(r instanceof bt)return r;switch(r.termType){case"NamedNode":return zu(r.value);case"BlankNode":return Qu(r.value);case"Variable":return Ju(r.value);case"DefaultGraph":return Lr;case"Literal":return Xu(r.value,r.language||r.datatype);case"Quad":return Ku(r);default:throw new Error(`Unexpected termType: ${r.termType}`)}}function Ku(r){if(r instanceof si)return r;if(r.termType!=="Quad")throw new Error(`Unexpected termType: ${r.termType}`);return ra(dn(r.subject),dn(r.predicate),dn(r.object),dn(r.graph))}let Ya=0;class Yu{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Zu(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(){Ya=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=$n}_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${Ya++}_`,this._prefixCallback=s||$n,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=$n):this._readCallback&&(this._readCallback=this._readCallback(l))};a&&(this._lexer.comments=!0,o=(u,l)=>{u!==null?(this._callback(u),this._callback=$n):this._readCallback&&(l.type==="comment"?a(l.value):this._readCallback=this._readCallback(l))}),this._callback=i,this._lexer.tokenize(e,o)}}function $n(){}function Zu(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")}Zu(Yu.prototype,Re);function na(r){return!!r&&r.termType==="DefaultGraph"}function Vn(r){return r.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const bd=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,_d=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,Za="./",wd="../",bi="?",eo="#";class ga{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(!ga.supports(this.base))return this._baseMatcher=/.^/;const e=/^[^:]*:\/*/.exec(this.base)[0],t=["^",Vn(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]===eo?u=s.lastIndex-1:(t.push(Vn(a[0]),"(?:"),n.push(")?"),a[1]!==bi?i.push(l=s.lastIndex):(o=l=s.lastIndex,u=this.base.indexOf(eo,o),this._pathReplacements[o]=bi));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]]=Za,this._baseLength=u>0?u:this.base.length,t.push(Vn(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!==bi&&!_d.test(s)?e:i===Za&&/^[^?#]/.test(s)?s:i+s}return e.substring(n-1)}}const Vr=Re.defaultGraph(),{rdf:vd,xsd:_r}=Ke,to=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,ro=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,xd={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class Gr extends bt{equals(e){return e===this}}class ma{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=Vr,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new ga(t.baseIRI)))}get _inDefaultGraph(){return Vr.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 Ja;function jt(){return Ja||(Ja=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 I=new Uint8Array(1),f={foo:function(){return 42}};return Object.setPrototypeOf(f,Uint8Array.prototype),Object.setPrototypeOf(I,f),I.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(I){if(I>i)throw new RangeError('The value "'+I+'" is invalid for option "size"');const f=new Uint8Array(I);return Object.setPrototypeOf(f,o.prototype),f}function o(I,f,p){if(typeof I=="number"){if(typeof f=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(I)}return u(I,f,p)}o.poolSize=8192;function u(I,f,p){if(typeof I=="string")return b(I,f);if(ArrayBuffer.isView(I))return _(I);if(I==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I);if(le(I,ArrayBuffer)||I&&le(I.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(le(I,SharedArrayBuffer)||I&&le(I.buffer,SharedArrayBuffer)))return E(I,f,p);if(typeof I=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const $=I.valueOf&&I.valueOf();if($!=null&&$!==I)return o.from($,f,p);const X=v(I);if(X)return X;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof I[Symbol.toPrimitive]=="function")return o.from(I[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 I)}o.from=function(I,f,p){return u(I,f,p)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function l(I){if(typeof I!="number")throw new TypeError('"size" argument must be of type number');if(I<0)throw new RangeError('The value "'+I+'" is invalid for option "size"')}function c(I,f,p){return l(I),I<=0?a(I):f!==void 0?typeof p=="string"?a(I).fill(f,p):a(I).fill(f):a(I)}o.alloc=function(I,f,p){return c(I,f,p)};function h(I){return l(I),a(I<0?0:x(I)|0)}o.allocUnsafe=function(I){return h(I)},o.allocUnsafeSlow=function(I){return h(I)};function b(I,f){if((typeof f!="string"||f==="")&&(f="utf8"),!o.isEncoding(f))throw new TypeError("Unknown encoding: "+f);const p=m(I,f)|0;let $=a(p);const X=$.write(I,f);return X!==p&&($=$.slice(0,X)),$}function y(I){const f=I.length<0?0:x(I.length)|0,p=a(f);for(let $=0;$<f;$+=1)p[$]=I[$]&255;return p}function _(I){if(le(I,Uint8Array)){const f=new Uint8Array(I);return E(f.buffer,f.byteOffset,f.byteLength)}return y(I)}function E(I,f,p){if(f<0||I.byteLength<f)throw new RangeError('"offset" is outside of buffer bounds');if(I.byteLength<f+(p||0))throw new RangeError('"length" is outside of buffer bounds');let $;return f===void 0&&p===void 0?$=new Uint8Array(I):p===void 0?$=new Uint8Array(I,f):$=new Uint8Array(I,f,p),Object.setPrototypeOf($,o.prototype),$}function v(I){if(o.isBuffer(I)){const f=x(I.length)|0,p=a(f);return p.length===0||I.copy(p,0,0,f),p}if(I.length!==void 0)return typeof I.length!="number"||Re(I.length)?a(0):y(I);if(I.type==="Buffer"&&Array.isArray(I.data))return y(I.data)}function x(I){if(I>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return I|0}function S(I){return+I!=I&&(I=0),o.alloc(+I)}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,X=p.length;for(let oe=0,de=Math.min($,X);oe<de;++oe)if(f[oe]!==p[oe]){$=f[oe],X=p[oe];break}return $<X?-1:X<$?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 X=o.allocUnsafe(p);let oe=0;for($=0;$<f.length;++$){let de=f[$];if(le(de,Uint8Array))oe+de.length>X.length?(o.isBuffer(de)||(de=o.from(de)),de.copy(X,oe)):Uint8Array.prototype.set.call(X,de,oe);else if(o.isBuffer(de))de.copy(X,oe);else throw new TypeError('"list" argument must be an Array of Buffers');oe+=de.length}return X};function m(I,f){if(o.isBuffer(I))return I.length;if(ArrayBuffer.isView(I)||le(I,ArrayBuffer))return I.byteLength;if(typeof I!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof I);const p=I.length,$=arguments.length>2&&arguments[2]===!0;if(!$&&p===0)return 0;let X=!1;for(;;)switch(f){case"ascii":case"latin1":case"binary":return p;case"utf8":case"utf-8":return pe(I).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return p*2;case"hex":return p>>>1;case"base64":return ce(I).length;default:if(X)return $?-1:pe(I).length;f=(""+f).toLowerCase(),X=!0}}o.byteLength=m;function d(I,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(I||(I="utf8");;)switch(I){case"hex":return Y(this,f,p);case"utf8":case"utf-8":return L(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: "+I);I=(I+"").toLowerCase(),$=!0}}o.prototype._isBuffer=!0;function g(I,f,p){const $=I[f];I[f]=I[p],I[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?L(this,0,f):d.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,$,X,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),X===void 0&&(X=0),oe===void 0&&(oe=this.length),p<0||$>f.length||X<0||oe>this.length)throw new RangeError("out of range index");if(X>=oe&&p>=$)return 0;if(X>=oe)return-1;if(p>=$)return 1;if(p>>>=0,$>>>=0,X>>>=0,oe>>>=0,this===f)return 0;let de=oe-X,Ee=$-p;const ke=Math.min(de,Ee),Le=this.slice(X,oe),Oe=f.slice(p,$);for(let De=0;De<ke;++De)if(Le[De]!==Oe[De]){de=Le[De],Ee=Oe[De];break}return de<Ee?-1:Ee<de?1:0};function N(I,f,p,$,X){if(I.length===0)return-1;if(typeof p=="string"?($=p,p=0):p>2147483647?p=2147483647:p<-2147483648&&(p=-2147483648),p=+p,Re(p)&&(p=X?0:I.length-1),p<0&&(p=I.length+p),p>=I.length){if(X)return-1;p=I.length-1}else if(p<0)if(X)p=0;else return-1;if(typeof f=="string"&&(f=o.from(f,$)),o.isBuffer(f))return f.length===0?-1:j(I,f,p,$,X);if(typeof f=="number")return f=f&255,typeof Uint8Array.prototype.indexOf=="function"?X?Uint8Array.prototype.indexOf.call(I,f,p):Uint8Array.prototype.lastIndexOf.call(I,f,p):j(I,[f],p,$,X);throw new TypeError("val must be string, number or Buffer")}function j(I,f,p,$,X){let oe=1,de=I.length,Ee=f.length;if($!==void 0&&($=String($).toLowerCase(),$==="ucs2"||$==="ucs-2"||$==="utf16le"||$==="utf-16le")){if(I.length<2||f.length<2)return-1;oe=2,de/=2,Ee/=2,p/=2}function ke(Oe,De){return oe===1?Oe[De]:Oe.readUInt16BE(De*oe)}let Le;if(X){let Oe=-1;for(Le=p;Le<de;Le++)if(ke(I,Le)===ke(f,Oe===-1?0:Le-Oe)){if(Oe===-1&&(Oe=Le),Le-Oe+1===Ee)return Oe*oe}else Oe!==-1&&(Le-=Le-Oe),Oe=-1}else for(p+Ee>de&&(p=de-Ee),Le=p;Le>=0;Le--){let Oe=!0;for(let De=0;De<Ee;De++)if(ke(I,Le+De)!==ke(f,De)){Oe=!1;break}if(Oe)return Le}return-1}o.prototype.includes=function(f,p,$){return this.indexOf(f,p,$)!==-1},o.prototype.indexOf=function(f,p,$){return N(this,f,p,$,!0)},o.prototype.lastIndexOf=function(f,p,$){return N(this,f,p,$,!1)};function A(I,f,p,$){p=Number(p)||0;const X=I.length-p;$?($=Number($),$>X&&($=X)):$=X;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(Re(Ee))return de;I[p+de]=Ee}return de}function B(I,f,p,$){return ye(pe(f,I.length-p),I,p,$)}function R(I,f,p,$){return ye(me(f),I,p,$)}function F(I,f,p,$){return ye(ce(f),I,p,$)}function q(I,f,p,$){return ye(J(f,I.length-p),I,p,$)}o.prototype.write=function(f,p,$,X){if(p===void 0)X="utf8",$=this.length,p=0;else if($===void 0&&typeof p=="string")X=p,$=this.length,p=0;else if(isFinite(p))p=p>>>0,isFinite($)?($=$>>>0,X===void 0&&(X="utf8")):(X=$,$=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");X||(X="utf8");let de=!1;for(;;)switch(X){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: "+X);X=(""+X).toLowerCase(),de=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function D(I,f,p){return f===0&&p===I.length?e.fromByteArray(I):e.fromByteArray(I.slice(f,p))}function L(I,f,p){p=Math.min(I.length,p);const $=[];let X=f;for(;X<p;){const oe=I[X];let de=null,Ee=oe>239?4:oe>223?3:oe>191?2:1;if(X+Ee<=p){let ke,Le,Oe,De;switch(Ee){case 1:oe<128&&(de=oe);break;case 2:ke=I[X+1],(ke&192)===128&&(De=(oe&31)<<6|ke&63,De>127&&(de=De));break;case 3:ke=I[X+1],Le=I[X+2],(ke&192)===128&&(Le&192)===128&&(De=(oe&15)<<12|(ke&63)<<6|Le&63,De>2047&&(De<55296||De>57343)&&(de=De));break;case 4:ke=I[X+1],Le=I[X+2],Oe=I[X+3],(ke&192)===128&&(Le&192)===128&&(Oe&192)===128&&(De=(oe&15)<<18|(ke&63)<<12|(Le&63)<<6|Oe&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),X+=Ee}return T($)}const te=4096;function T(I){const f=I.length;if(f<=te)return String.fromCharCode.apply(String,I);let p="",$=0;for(;$<f;)p+=String.fromCharCode.apply(String,I.slice($,$+=te));return p}function Z(I,f,p){let $="";p=Math.min(I.length,p);for(let X=f;X<p;++X)$+=String.fromCharCode(I[X]&127);return $}function k(I,f,p){let $="";p=Math.min(I.length,p);for(let X=f;X<p;++X)$+=String.fromCharCode(I[X]);return $}function Y(I,f,p){const $=I.length;(!f||f<0)&&(f=0),(!p||p<0||p>$)&&(p=$);let X="";for(let oe=f;oe<p;++oe)X+=ze[I[oe]];return X}function w(I,f,p){const $=I.slice(f,p);let X="";for(let oe=0;oe<$.length-1;oe+=2)X+=String.fromCharCode($[oe]+$[oe+1]*256);return X}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 X=this.subarray(f,p);return Object.setPrototypeOf(X,o.prototype),X};function H(I,f,p){if(I%1!==0||I<0)throw new RangeError("offset is not uint");if(I+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 X=this[f],oe=1,de=0;for(;++de<p&&(oe*=256);)X+=this[f+de]*oe;return X},o.prototype.readUintBE=o.prototype.readUIntBE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=this[f+--p],oe=1;for(;p>0&&(oe*=256);)X+=this[f+--p]*oe;return X},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=Ie(function(f){f=f>>>0,C(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=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(X)+(BigInt(oe)<<BigInt(32))}),o.prototype.readBigUInt64BE=Ie(function(f){f=f>>>0,C(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=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(X)<<BigInt(32))+BigInt(oe)}),o.prototype.readIntLE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=this[f],oe=1,de=0;for(;++de<p&&(oe*=256);)X+=this[f+de]*oe;return oe*=128,X>=oe&&(X-=Math.pow(2,8*p)),X},o.prototype.readIntBE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=p,oe=1,de=this[f+--X];for(;X>0&&(oe*=256);)de+=this[f+--X]*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=Ie(function(f){f=f>>>0,C(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=this[f+4]+this[f+5]*2**8+this[f+6]*2**16+($<<24);return(BigInt(X)<<BigInt(32))+BigInt(p+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24)}),o.prototype.readBigInt64BE=Ie(function(f){f=f>>>0,C(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=(p<<24)+this[++f]*2**16+this[++f]*2**8+this[++f];return(BigInt(X)<<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(I,f,p,$,X,oe){if(!o.isBuffer(I))throw new TypeError('"buffer" argument must be a Buffer instance');if(f>X||f<oe)throw new RangeError('"value" argument is out of bounds');if(p+$>I.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(f,p,$,X){if(f=+f,p=p>>>0,$=$>>>0,!X){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,$,X){if(f=+f,p=p>>>0,$=$>>>0,!X){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 Q(I,f,p,$,X){ge(f,$,X,I,p,7);let oe=Number(f&BigInt(4294967295));I[p++]=oe,oe=oe>>8,I[p++]=oe,oe=oe>>8,I[p++]=oe,oe=oe>>8,I[p++]=oe;let de=Number(f>>BigInt(32)&BigInt(4294967295));return I[p++]=de,de=de>>8,I[p++]=de,de=de>>8,I[p++]=de,de=de>>8,I[p++]=de,p}function ue(I,f,p,$,X){ge(f,$,X,I,p,7);let oe=Number(f&BigInt(4294967295));I[p+7]=oe,oe=oe>>8,I[p+6]=oe,oe=oe>>8,I[p+5]=oe,oe=oe>>8,I[p+4]=oe;let de=Number(f>>BigInt(32)&BigInt(4294967295));return I[p+3]=de,de=de>>8,I[p+2]=de,de=de>>8,I[p+1]=de,de=de>>8,I[p]=de,p+8}o.prototype.writeBigUInt64LE=Ie(function(f,p=0){return Q(this,f,p,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=Ie(function(f,p=0){return ue(this,f,p,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(f,p,$,X){if(f=+f,p=p>>>0,!X){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,$,X){if(f=+f,p=p>>>0,!X){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=Ie(function(f,p=0){return Q(this,f,p,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=Ie(function(f,p=0){return ue(this,f,p,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function V(I,f,p,$,X,oe){if(p+$>I.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("Index out of range")}function G(I,f,p,$,X){return f=+f,p=p>>>0,X||V(I,f,p,4),t.write(I,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(I,f,p,$,X){return f=+f,p=p>>>0,X||V(I,f,p,8),t.write(I,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,$,X){if(!o.isBuffer(f))throw new TypeError("argument should be a Buffer");if($||($=0),!X&&X!==0&&(X=this.length),p>=f.length&&(p=f.length),p||(p=0),X>0&&X<$&&(X=$),X===$||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(X<0)throw new RangeError("sourceEnd out of bounds");X>this.length&&(X=this.length),f.length-p<X-$&&(X=f.length-p+$);const oe=X-$;return this===f&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(p,$,X):Uint8Array.prototype.set.call(f,this.subarray($,X),p),oe},o.prototype.fill=function(f,p,$,X){if(typeof f=="string"){if(typeof p=="string"?(X=p,p=0,$=this.length):typeof $=="string"&&(X=$,$=this.length),X!==void 0&&typeof X!="string")throw new TypeError("encoding must be a string");if(typeof X=="string"&&!o.isEncoding(X))throw new TypeError("Unknown encoding: "+X);if(f.length===1){const de=f.charCodeAt(0);(X==="utf8"&&de<128||X==="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,X),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(I,f,p){U[I]=class extends p{constructor(){super(),Object.defineProperty(this,"message",{value:f.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${I}]`,this.stack,delete this.name}get code(){return I}set code(X){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:X,writable:!0})}toString(){return`${this.name} [${I}]: ${this.message}`}}}ee("ERR_BUFFER_OUT_OF_BOUNDS",function(I){return I?`${I} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ee("ERR_INVALID_ARG_TYPE",function(I,f){return`The "${I}" argument must be of type number. Received type ${typeof f}`},TypeError),ee("ERR_OUT_OF_RANGE",function(I,f,p){let $=`The value of "${I}" is out of range.`,X=p;return Number.isInteger(p)&&Math.abs(p)>2**32?X=re(String(p)):typeof p=="bigint"&&(X=String(p),(p>BigInt(2)**BigInt(32)||p<-(BigInt(2)**BigInt(32)))&&(X=re(X)),X+="n"),$+=` It must be ${f}. Received ${X}`,$},RangeError);function re(I){let f="",p=I.length;const $=I[0]==="-"?1:0;for(;p>=$+4;p-=3)f=`_${I.slice(p-3,p)}${f}`;return`${I.slice(0,p)}${f}`}function fe(I,f,p){C(f,"offset"),(I[f]===void 0||I[f+p]===void 0)&&W(f,I.length-(p+1))}function ge(I,f,p,$,X,oe){if(I>p||I<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,I)}fe($,X,oe)}function C(I,f){if(typeof I!="number")throw new U.ERR_INVALID_ARG_TYPE(f,"number",I)}function W(I,f,p){throw Math.floor(I)!==I?(C(I,p),new U.ERR_OUT_OF_RANGE("offset","an integer",I)):f<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${f}`,I)}const se=/[^+/0-9A-Za-z-_]/g;function he(I){if(I=I.split("=")[0],I=I.trim().replace(se,""),I.length<2)return"";for(;I.length%4!==0;)I=I+"=";return I}function pe(I,f){f=f||1/0;let p;const $=I.length;let X=null;const oe=[];for(let de=0;de<$;++de){if(p=I.charCodeAt(de),p>55295&&p<57344){if(!X){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}X=p;continue}if(p<56320){(f-=3)>-1&&oe.push(239,191,189),X=p;continue}p=(X-55296<<10|p-56320)+65536}else X&&(f-=3)>-1&&oe.push(239,191,189);if(X=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(I){const f=[];for(let p=0;p<I.length;++p)f.push(I.charCodeAt(p)&255);return f}function J(I,f){let p,$,X;const oe=[];for(let de=0;de<I.length&&!((f-=2)<0);++de)p=I.charCodeAt(de),$=p>>8,X=p%256,oe.push(X),oe.push($);return oe}function ce(I){return e.toByteArray(he(I))}function ye(I,f,p,$){let X;for(X=0;X<$&&!(X+p>=f.length||X>=I.length);++X)f[X+p]=I[X];return X}function le(I,f){return I instanceof f||I!=null&&I.constructor!=null&&I.constructor.name!=null&&I.constructor.name===f.name}function Re(I){return I!==I}const ze=function(){const I="0123456789abcdef",f=new Array(256);for(let p=0;p<16;++p){const $=p*16;for(let X=0;X<16;++X)f[$+X]=I[p]+I[X]}return f}();function Ie(I){return typeof BigInt>"u"?Xe:I}function Xe(){throw new Error("BigInt not supported")}}(bi)),bi}var ad=jt();const Vr="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Gr="http://www.w3.org/2001/XMLSchema#",Cn="http://www.w3.org/2000/10/swap/",Ke={xsd:{decimal:`${Gr}decimal`,boolean:`${Gr}boolean`,double:`${Gr}double`,integer:`${Gr}integer`,string:`${Gr}string`},rdf:{type:`${Vr}type`,nil:`${Vr}nil`,first:`${Vr}first`,rest:`${Vr}rest`,langString:`${Vr}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${Cn}reify#forSome`,forAll:`${Cn}reify#forAll`},log:{implies:`${Cn}log#implies`,isImpliedBy:`${Cn}log#isImpliedBy`}},{xsd:$n}=Ke,od=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Ka={"\\":"\\","'":"'",'"':'"',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 h="",b="",y="",_=null,E=0,v=!1;switch(c){case"^":if(n.length<3)break;if(n[1]==="^"){if(this._previousMarker="^^",n=n.substr(2),n[0]!=="<"){v=!0;break}}else{this._n3Mode&&(E=1,h="^");break}case"<":if(_=this._unescapedIri.exec(n))h="IRI",b=_[1];else if(_=this._iri.exec(n)){if(b=this._unescape(_[1]),b===null||ld.test(b))return a(this);h="IRI"}else n.length>1&&n[1]==="<"?(h="<<",E=2):this._n3Mode&&n.length>1&&n[1]==="="&&(E=2,this._isImpliedBy?(h="abbreviation",b="<"):(h="inverse",b=">"));break;case">":n.length>1&&n[1]===">"&&(h=">>",E=2);break;case"_":((_=this._blank.exec(n))||t&&(_=this._blank.exec(`${n} `)))&&(h="blank",y="_",b=_[1]);break;case'"':if(_=this._simpleQuotedString.exec(n))b=_[1];else if({value:b,matchLength:E}=this._parseLiteral(n),b===null)return a(this);(_!==null||E!==0)&&(h="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(_=this._simpleApostropheString.exec(n))b=_[1];else if({value:b,matchLength:E}=this._parseLiteral(n),b===null)return a(this);(_!==null||E!==0)&&(h="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(_=this._variable.exec(n))&&(h="var",b=_[0]);break;case"@":this._previousMarker==="literal"&&(_=this._langcode.exec(n))?(h="langcode",b=_[1]):(_=this._keyword.exec(n))&&(h=_[0]);break;case".":if(n.length===1?t:n[1]<"0"||n[1]>"9"){h=".",E=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} `)))&&(h="literal",b=_[0],y=typeof _[1]=="string"?$n.double:typeof _[2]=="string"?$n.decimal:$n.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(_=this._sparqlKeyword.exec(n))?h=_[0].toUpperCase():v=!0;break;case"f":case"t":(_=this._boolean.exec(n))?(h="literal",b=_[0],y=$n.boolean):v=!0;break;case"a":(_=this._shortPredicates.exec(n))?(h="abbreviation",b="a"):v=!0;break;case"=":this._n3Mode&&n.length>1&&(h="abbreviation",n[1]!==">"?(E=1,b="="):(E=2,b=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(E=1,h=c);break;case"{":!this._lineMode&&n.length>=2&&(n[1]==="|"?(h="{|",E=2):(h=c,E=1));break;case"|":n.length>=2&&n[1]==="}"&&(h="|}",E=2);break;default:v=!0}if(v&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(_=this._prefix.exec(n))?(h="prefix",b=_[1]||""):((_=this._prefixed.exec(n))||t&&(_=this._prefixed.exec(`${n} `)))&&(h="prefixed",y=_[1]||"",b=this._unescape(_[2]))),this._previousMarker==="^^")switch(h){case"prefixed":h="type";break;case"IRI":h="typeIRI";break;default:h=""}if(!h)return t||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?a(this):this._input=n;const x=E||_[0].length,S=s(h,b,y,l,x);this.previousToken=S,this._previousMarker=h,n=n.substr(x,n.length)}function s(o,u,l,c,h){const b=n?i-n.length:i,y=b+h,_={type:o,value:u,prefix:l,line:c,start:b,end:y};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 Ka?Ka[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:ar}=Ke;let Cr,fd=0;const Ne={namedNode:Wu,blankNode:zu,variable:Xu,literal:Qu,defaultGraph:yd,quad:na,triple:na,fromTerm:fn,fromQuad:Ju};class wt{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof wt?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}let ii=class extends wt{get termType(){return"NamedNode"}},ct=class Gu extends wt{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const e=this.id;let t=e.lastIndexOf('"')+1;return t<e.length&&e[t++]==="@"?e.substr(t).toLowerCase():""}get datatype(){return new ii(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!=="@"?ar.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 wt{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},gd=class extends wt{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},md=class extends wt{constructor(){return super(""),Cr||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};Cr=new md;function hn(r,e,t){if(e=e||Ne,!r)return e.defaultGraph();switch(r[0]){case"?":return e.variable(r.substr(1));case"_":return e.blankNode(r.substr(2));case'"':if(e===Ne)return new 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(hn(r[0],e,!0),hn(r[1],e,!0),hn(r[2],e,!0),r[3]&&hn(r[3],e,!0))}function Ir(r,e){if(typeof r=="string")return r;if(r instanceof wt&&r.termType!=="Quad")return r.id;if(!r)return Cr.id;switch(r.termType){case"NamedNode":return r.value;case"BlankNode":return`_:${r.value}`;case"Variable":return`?${r.value}`;case"DefaultGraph":return"";case"Literal":return`"${r.value}"${r.language?`@${r.language}`:r.datatype&&r.datatype.value!==ar.string?`^^${r.datatype.value}`:""}`;case"Quad":const t=[Ir(r.subject,!0),Ir(r.predicate,!0),Ir(r.object,!0)];return r.graph&&r.graph.termType!=="DefaultGraph"&&t.push(Ir(r.graph,!0)),e?t:JSON.stringify(t);default:throw new Error(`Unexpected termType: ${r.termType}`)}}let si=class extends wt{constructor(e,t,n,i){super(""),this._subject=e,this._predicate=t,this._object=n,this._graph=i||Cr}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 ii(r)}function zu(r){return new pd(r||`n3-${fd++}`)}function Qu(r,e){if(typeof e=="string")return new ct(`"${r}"@${e.toLowerCase()}`);let t=e?e.value:"";return t===""&&(typeof r=="boolean"?t=ar.boolean:typeof r=="number"&&(Number.isFinite(r)?t=Number.isInteger(r)?ar.integer:ar.double:(t=ar.double,Number.isNaN(r)||(r=r>0?"INF":"-INF")))),t===""||t===ar.string?new ct(`"${r}"`):new ct(`"${r}"^^${t}`)}function Xu(r){return new gd(r)}function yd(){return Cr}function na(r,e,t,n){return new si(r,e,t,n)}function fn(r){if(r instanceof wt)return r;switch(r.termType){case"NamedNode":return Wu(r.value);case"BlankNode":return zu(r.value);case"Variable":return Xu(r.value);case"DefaultGraph":return Cr;case"Literal":return Qu(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 si)return r;if(r.termType!=="Quad")throw new Error(`Unexpected termType: ${r.termType}`);return na(fn(r.subject),fn(r.predicate),fn(r.object),fn(r.graph))}let Ya=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(){Ya=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=Fn}_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${Ya++}_`,this._prefixCallback=s||Fn,this._inversePredicate=!1,this._quantified=Object.create(null),!i){const u=[];let l;if(this._callback=(c,h)=>{c?l=c:h&&u.push(h)},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=Fn):this._readCallback&&(this._readCallback=this._readCallback(l))};a&&(this._lexer.comments=!0,o=(u,l)=>{u!==null?(this._callback(u),this._callback=Fn):this._readCallback&&(l.type==="comment"?a(l.value):this._readCallback=this._readCallback(l))}),this._callback=i,this._lexer.tokenize(e,o)}}function Fn(){}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,Ne);function ia(r){return!!r&&r.termType==="DefaultGraph"}function Vn(r){return r.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const bd=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,_d=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,Za="./",wd="../",_i="?",eo="#";class ga{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(!ga.supports(this.base))return this._baseMatcher=/.^/;const e=/^[^:]*:\/*/.exec(this.base)[0],t=["^",Vn(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]===eo?u=s.lastIndex-1:(t.push(Vn(a[0]),"(?:"),n.push(")?"),a[1]!==_i?i.push(l=s.lastIndex):(o=l=s.lastIndex,u=this.base.indexOf(eo,o),this._pathReplacements[o]=_i));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]]=Za,this._baseLength=u>0?u:this.base.length,t.push(Vn(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!==_i&&!_d.test(s)?e:i===Za&&/^[^?#]/.test(s)?s:i+s}return e.substring(n-1)}}const Wr=Ne.defaultGraph(),{rdf:vd,xsd:wr}=Ke,to=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,ro=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,xd={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class zr extends wt{equals(e){return e===this}}class ma{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=Wr,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new ga(t.baseIRI)))}get _inDefaultGraph(){return Wr.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
|
-
`)+(
|
|
10
|
+
`)+(Wr.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)),to.test(t)&&(t=t.replace(ro,no));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(to.test(t)&&(t=t.replace(ro,no)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===
|
|
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)),to.test(t)&&(t=t.replace(ro,no));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(to.test(t)&&(t=t.replace(ro,no)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===wr.string)return`"${t}"`}else switch(e.datatype.value){case wr.string:return`"${t}"`;case wr.boolean:if(t==="true"||t==="false")return t;break;case wr.integer:if(/^[+-]?\d+$/.test(t))return t;break;case wr.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case wr.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t;break}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===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)}${ia(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,Wr,i):this._writeQuad(e,t,n,i||Wr,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
19
|
`)}if(n){let i="",s="";for(const a in this._prefixIRIs)i+=i?`|${a}`:a,s+=(s?"|":"")+this._prefixIRIs[a];i=Vn(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
|
|
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 zr("[]");case 1:if(i=n[0],!(i.object instanceof zr))return new zr(`[ ${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
|
|
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
|
|
22
|
+
`)+this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)}`,e=i.predicate);return new zr(`${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 zr(`(${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 no(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
|
|
27
|
-
`;super(n),this.name="AggregateError",this.errors=t}}return vi={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},vi}var xi={exports:{}},Ei,so;function ec(){return so||(so=1,Ei={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"{}"}}}),Ei}var Si,ao;function nt(){if(ao)return Si;ao=1;const{format:r,inspect:e}=ec(),{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(v,x){if(!v)throw new u.ERR_INTERNAL_ASSERTION(x)}function c(v){let x="",S=v.length;const m=v[0]==="-"?1:0;for(;S>=m+4;S-=3)x=`_${v.slice(S-3,S)}${x}`;return`${v.slice(0,S)}${x}`}function d(v,x,S){if(typeof x=="function")return l(x.length<=S.length,`Code: ${v}; The provided arguments length (${S.length}) does not match the required ones (${x.length}).`),x(...S);const m=(x.match(/%[dfijoOs]/g)||[]).length;return l(m===S.length,`Code: ${v}; The provided arguments length (${S.length}) does not match the required ones (${m}).`),S.length===0?x:r(x,...S)}function b(v,x,S){S||(S=Error);class m extends S{constructor(...g){super(d(v,x,g))}toString(){return`${this.name} [${v}]: ${this.message}`}}Object.defineProperties(m.prototype,{name:{value:S.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${v}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),m.prototype.code=v,m.prototype[i]=!0,u[v]=m}function y(v){const x=o+v.name;return Object.defineProperty(v,"name",{value:x}),v}function _(v,x){if(v&&x&&v!==x){if(Array.isArray(x.errors))return x.errors.push(v),x;const S=new n([x,v],x.message);return S.code=x.code,S}return v||x}class E extends Error{constructor(x="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(x,S),this.code="ABORT_ERR",this.name="AbortError"}}return b("ERR_ASSERTION","%s",Error),b("ERR_INVALID_ARG_TYPE",(v,x,S)=>{l(typeof v=="string","'name' must be a string"),Array.isArray(x)||(x=[x]);let m="The ";v.endsWith(" argument")?m+=`${v} `:m+=`"${v}" ${v.includes(".")?"property":"argument"} `,m+="must be ";const h=[],g=[],N=[];for(const A of x)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"'),N.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:m+=`of type ${h[0]}`;break;case 2:m+=`one of type ${h[0]} or ${h[1]}`;break;default:{const A=h.pop();m+=`one of type ${h.join(", ")}, or ${A}`}}(g.length>0||N.length>0)&&(m+=" or ")}if(g.length>0){switch(g.length){case 1:m+=`an instance of ${g[0]}`;break;case 2:m+=`an instance of ${g[0]} or ${g[1]}`;break;default:{const A=g.pop();m+=`an instance of ${g.join(", ")}, or ${A}`}}N.length>0&&(m+=" or ")}switch(N.length){case 0:break;case 1:N[0].toLowerCase()!==N[0]&&(m+="an "),m+=`${N[0]}`;break;case 2:m+=`one of ${N[0]} or ${N[1]}`;break;default:{const A=N.pop();m+=`one of ${N.join(", ")}, or ${A}`}}if(S==null)m+=`. Received ${S}`;else if(typeof S=="function"&&S.name)m+=`. Received function ${S.name}`;else if(typeof S=="object"){var j;if((j=S.constructor)!==null&&j!==void 0&&j.name)m+=`. Received an instance of ${S.constructor.name}`;else{const A=e(S,{depth:-1});m+=`. Received ${A}`}}else{let A=e(S,{colors:!1});A.length>25&&(A=`${A.slice(0,25)}...`),m+=`. Received type ${typeof S} (${A})`}return m},TypeError),b("ERR_INVALID_ARG_VALUE",(v,x,S="is invalid")=>{let m=e(x);return m.length>128&&(m=m.slice(0,128)+"..."),`The ${v.includes(".")?"property":"argument"} '${v}' ${S}. Received ${m}`},TypeError),b("ERR_INVALID_RETURN_VALUE",(v,x,S)=>{var m;const h=S!=null&&(m=S.constructor)!==null&&m!==void 0&&m.name?`instance of ${S.constructor.name}`:`type ${typeof S}`;return`Expected ${v} to be returned from the "${x}" function but got ${h}.`},TypeError),b("ERR_MISSING_ARGS",(...v)=>{l(v.length>0,"At least one arg needs to be specified");let x;const S=v.length;switch(v=(Array.isArray(v)?v:[v]).map(m=>`"${m}"`).join(" or "),S){case 1:x+=`The ${v[0]} argument`;break;case 2:x+=`The ${v[0]} and ${v[1]} arguments`;break;default:{const m=v.pop();x+=`The ${v.join(", ")}, and ${m} arguments`}break}return`${x} must be specified`},TypeError),b("ERR_OUT_OF_RANGE",(v,x,S)=>{l(x,'Missing "range" argument');let m;if(Number.isInteger(S)&&Math.abs(S)>2**32)m=c(String(S));else if(typeof S=="bigint"){m=String(S);const h=BigInt(2)**BigInt(32);(S>h||S<-h)&&(m=c(m)),m+="n"}else m=e(S);return`The value of "${v}" is out of range. It must be ${x}. Received ${m}`},RangeError),b("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),b("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),b("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),b("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),b("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),b("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),b("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),b("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),b("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),b("ERR_STREAM_WRITE_AFTER_END","write after end",Error),b("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),Si={AbortError:E,aggregateTwoErrors:y(_),hideStackFrames:y,codes:u},Si}var Wr={exports:{}},oo;function wn(){if(oo)return Wr.exports;oo=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 Fn={exports:{}},lo;function ai(){if(lo)return Fn.exports;lo=1;var r=typeof Reflect=="object"?Reflect:null,e=r&&typeof r.apply=="function"?r.apply:function(g,N,j){return Function.prototype.apply.call(g,N,j)},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)}Fn.exports=s,Fn.exports.once=x,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 N=[],j=1;j<arguments.length;j++)N.push(arguments[j]);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(N.length>0&&(R=N[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,N);else for(var D=q.length,O=_(q,D),j=0;j<D;++j)e(O[j],this,N);return!0};function l(h,g,N,j){var A,B,R;if(o(N),B=h._events,B===void 0?(B=h._events=Object.create(null),h._eventsCount=0):(B.newListener!==void 0&&(h.emit("newListener",g,N.listener?N.listener:N),B=h._events),R=B[g]),R===void 0)R=B[g]=N,++h._eventsCount;else if(typeof R=="function"?R=B[g]=j?[N,R]:[R,N]:j?R.unshift(N):R.push(N),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,N){return l(this,g,N,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(g,N){return l(this,g,N,!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,N){var j={fired:!1,wrapFn:void 0,target:h,type:g,listener:N},A=c.bind(j);return A.listener=N,j.wrapFn=A,A}s.prototype.once=function(g,N){return o(N),this.on(g,d(this,g,N)),this},s.prototype.prependOnceListener=function(g,N){return o(N),this.prependListener(g,d(this,g,N)),this},s.prototype.removeListener=function(g,N){var j,A,B,R,F;if(o(N),A=this._events,A===void 0)return this;if(j=A[g],j===void 0)return this;if(j===N||j.listener===N)--this._eventsCount===0?this._events=Object.create(null):(delete A[g],A.removeListener&&this.emit("removeListener",g,j.listener||N));else if(typeof j!="function"){for(B=-1,R=j.length-1;R>=0;R--)if(j[R]===N||j[R].listener===N){F=j[R].listener,B=R;break}if(B<0)return this;B===0?j.shift():E(j,B),j.length===1&&(A[g]=j[0]),A.removeListener!==void 0&&this.emit("removeListener",g,F||N)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(g){var N,j,A;if(j=this._events,j===void 0)return this;if(j.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):j[g]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete j[g]),this;if(arguments.length===0){var B=Object.keys(j),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(N=j[g],typeof N=="function")this.removeListener(g,N);else if(N!==void 0)for(A=N.length-1;A>=0;A--)this.removeListener(g,N[A]);return this};function b(h,g,N){var j=h._events;if(j===void 0)return[];var A=j[g];return A===void 0?[]:typeof A=="function"?N?[A.listener||A]:[A]:N?v(A):_(A,A.length)}s.prototype.listeners=function(g){return b(this,g,!0)},s.prototype.rawListeners=function(g){return b(this,g,!1)},s.listenerCount=function(h,g){return typeof h.listenerCount=="function"?h.listenerCount(g):y.call(h,g)},s.prototype.listenerCount=y;function y(h){var g=this._events;if(g!==void 0){var N=g[h];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 _(h,g){for(var N=new Array(g),j=0;j<g;++j)N[j]=h[j];return N}function E(h,g){for(;g+1<h.length;g++)h[g]=h[g+1];h.pop()}function v(h){for(var g=new Array(h.length),N=0;N<g.length;++N)g[N]=h[N].listener||h[N];return g}function x(h,g){return new Promise(function(N,j){function A(R){h.removeListener(g,B),j(R)}function B(){typeof h.removeListener=="function"&&h.removeListener("error",A),N([].slice.call(arguments))}m(h,g,B,{once:!0}),g!=="error"&&S(h,A,{once:!0})})}function S(h,g,N){typeof h.on=="function"&&m(h,"error",g,N)}function m(h,g,N,j){if(typeof h.on=="function")j.once?h.once(g,N):h.on(g,N);else if(typeof h.addEventListener=="function")h.addEventListener(g,function A(B){j.once&&h.removeEventListener(g,A),N(B)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof h)}return Fn.exports}var uo;function at(){return uo||(uo=1,function(r){const e=Lt(),{format:t,inspect:n}=ec(),{codes:{ERR_INVALID_ARG_TYPE:i}}=nt(),{kResistStopPropagation:s,AggregateError:a,SymbolDispose:o}=Be(),u=globalThis.AbortSignal||wn().AbortSignal,l=globalThis.AbortController||wn().AbortController,c=Object.getPrototypeOf(async function(){}).constructor,d=globalThis.Blob||e.Blob,b=typeof d<"u"?function(v){return v instanceof d}:function(v){return!1},y=(E,v)=>{if(E!==void 0&&(E===null||typeof E!="object"||!("aborted"in E)))throw new i(v,"AbortSignal",E)},_=(E,v)=>{if(typeof E!="function")throw new i(v,"Function",E)};r.exports={AggregateError:a,kEmptyObject:Object.freeze({}),once(E){let v=!1;return function(...x){v||(v=!0,E.apply(this,x))}},createDeferredPromise:function(){let E,v;return{promise:new Promise((S,m)=>{E=S,v=m}),resolve:E,reject:v}},promisify(E){return new Promise((v,x)=>{E((S,...m)=>S?x(S):v(...m))})},debuglog(){return function(){}},format:t,inspect:n,types:{isAsyncFunction(E){return E instanceof c},isArrayBufferView(E){return ArrayBuffer.isView(E)}},isBlob:b,deprecate(E,v){return E},addAbortListener:ai().addAbortListener||function(v,x){if(v===void 0)throw new i("signal","AbortSignal",v);y(v,"signal"),_(x,"listener");let S;return v.aborted?queueMicrotask(()=>x()):(v.addEventListener("abort",x,{__proto__:null,once:!0,[s]:!0}),S=()=>{v.removeEventListener("abort",x)}),{__proto__:null,[o](){var m;(m=S)===null||m===void 0||m()}}},AbortSignalAny:u.any||function(v){if(v.length===1)return v[0];const x=new l,S=()=>x.abort();return v.forEach(m=>{y(m,"signals"),m.addEventListener("abort",S,{once:!0})}),x.signal.addEventListener("abort",()=>{v.forEach(m=>m.removeEventListener("abort",S))},{once:!0}),x.signal}},r.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}(xi)),xi.exports}var kn={},Ii,co;function In(){if(co)return Ii;co=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:b,StringPrototypeTrim:y}=Be(),{hideStackFrames:_,codes:{ERR_SOCKET_BAD_PORT:E,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:x,ERR_OUT_OF_RANGE:S,ERR_UNKNOWN_SIGNAL:m}}=nt(),{normalizeEncoding:h}=at(),{isAsyncFunction:g,isArrayBufferView:N}=at().types,j={};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 x(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 v(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 v(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 v(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 v(ce,"string",J)}function Z(J,ce,ye=void 0,le){if(typeof J!="number")throw new v(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 x(ce,J,Ne)}});function Y(J,ce){if(typeof J!="boolean")throw new v(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 v(ce,"Object",J)}),K=_((J,ce)=>{if(J!=null&&typeof J!="object"&&typeof J!="function")throw new v(ce,"a dictionary",J)}),Q=_((J,ce,ye=0)=>{if(!r(J))throw new v(ce,"Array",J);if(J.length<ye){const le=`must be longer than ${ye}`;throw new x(ce,J,le)}});function ue(J,ce){Q(J,ce);for(let ye=0;ye<J.length;ye++)T(J[ye],`${ce}[${ye}]`)}function V(J,ce){Q(J,ce);for(let ye=0;ye<J.length;ye++)Y(J[ye],`${ce}[${ye}]`)}function G(J,ce){Q(J,ce);for(let ye=0;ye<J.length;ye++){const le=J[ye],Ne=`${ce}[${ye}]`;if(le==null)throw new v(Ne,"AbortSignal",le);fe(le,Ne)}}function z(J,ce="signal"){if(T(J,ce),j[J]===void 0)throw j[b(J)]!==void 0?new m(J+" (signals must use all capital letters)"):new m(J)}const U=_((J,ce="buffer")=>{if(!N(J))throw new v(ce,["Buffer","TypedArray","DataView"],J)});function ee(J,ce){const ye=h(ce),le=J.length;if(ye==="hex"&&le%2!==0)throw new x("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"&&y(J).length===0||+J!==+J>>>0||J>65535||J===0&&!ye)throw new E(ce,J,ye);return J|0}const fe=_((J,ce)=>{if(J!==void 0&&(J===null||typeof J!="object"||!("aborted"in J)))throw new v(ce,"AbortSignal",J)}),ge=_((J,ce)=>{if(typeof J!="function")throw new v(ce,"Function",J)}),C=_((J,ce)=>{if(typeof J!="function"||g(J))throw new v(ce,"Function",J)}),W=_((J,ce)=>{if(J!==void 0)throw new v(ce,"undefined",J)});function se(J,ce,ye){if(!e(ye,J))throw new v(ce,`('${t(ye,"|")}')`,J)}const he=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function pe(J,ce){if(typeof J>"u"||!c(he,J))throw new x(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 x("hints",J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return Ii={isInt32:A,isUint32:B,parseFileMode:q,validateArray:Q,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:C,validatePort:re,validateSignalName:z,validateString:T,validateUint32:te,validateUndefined:W,validateUnion:se,validateAbortSignal:fe,validateLinkHeaderValue:me},Ii}var Pn={exports:{}},Ni={exports:{}},ho;function dr(){if(ho)return Ni.exports;ho=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(E){if(e===setTimeout)return setTimeout(E,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(E,0);try{return e(E,0)}catch{try{return e.call(null,E,0)}catch{return e.call(this,E,0)}}}function a(E){if(t===clearTimeout)return clearTimeout(E);if((t===i||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(E);try{return t(E)}catch{try{return t.call(null,E)}catch{return t.call(this,E)}}}var o=[],u=!1,l,c=-1;function d(){!u||!l||(u=!1,l.length?o=l.concat(o):c=-1,o.length&&b())}function b(){if(!u){var E=s(d);u=!0;for(var v=o.length;v;){for(l=o,o=[];++c<v;)l&&l[c].run();c=-1,v=o.length}l=null,u=!1,a(E)}}r.nextTick=function(E){var v=new Array(arguments.length-1);if(arguments.length>1)for(var x=1;x<arguments.length;x++)v[x-1]=arguments[x];o.push(new y(E,v)),o.length===1&&!u&&s(b)};function y(E,v){this.fun=E,this.array=v}y.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(E){return[]},r.binding=function(E){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(E){throw new Error("process.chdir is not supported")},r.umask=function(){return 0},Ni.exports}var Ri,fo;function jt(){if(fo)return Ri;fo=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 b(w){return!!(w&&typeof w.pipe=="function"&&w._readableState&&typeof w.on=="function"&&typeof w.write=="function")}function y(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&&!y(w)&&typeof w.pipeThrough=="function"&&typeof w.getReader=="function"&&typeof w.cancel=="function")}function E(w){return!!(w&&!y(w)&&typeof w.getWriter=="function"&&typeof w.abort=="function")}function v(w){return!!(w&&!y(w)&&typeof w.readable=="object"&&typeof w.writable=="object")}function x(w){return _(w)||E(w)||v(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 m(w){if(!y(w))return null;const H=w._writableState,K=w._readableState,Q=H||K;return!!(w.destroyed||w[n]||Q!=null&&Q.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 N(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 j(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:m(w)?!1:c(w)&&w.readable&&!j(w)}function B(w){return w&&w[a]!=null?w[a]:typeof w?.writable!="boolean"?null:m(w)?!1:d(w)&&w.writable&&!h(w)}function R(w,H){return y(w)?m(w)?!0:!(H?.readable!==!1&&A(w)||H?.writable!==!1&&B(w)):null}function F(w){var H,K;return y(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 y(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(!y(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(!y(w))return null;const H=w._writableState,K=w._readableState,Q=H||K;return!Q&&te(w)||!!(Q&&Q.autoDestroy&&Q.emitClose&&Q.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,Q,ue,V,G,z,U,ee,re;return!!(w&&((H=(K=(Q=(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&&Q!==void 0?Q:(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 Ri={isDestroyed:m,kIsDestroyed:n,isDisturbed:k,kIsDisturbed:o,isErrored:Y,kIsErrored:i,isReadable:A,kIsReadable:s,kIsClosedPromise:u,kControllerErrorFunction:l,kIsWritable:a,isClosed:D,isDuplexNodeStream:b,isFinished:R,isIterable:S,isReadableNodeStream:c,isReadableStream:_,isReadableEnded:N,isReadableFinished:j,isReadableErrored:q,isNodeStream:y,isWebStream:x,isWritable:B,isWritableNodeStream:d,isWritableStream:E,isWritableEnded:h,isWritableFinished:g,isWritableErrored:F,isServerRequest:T,isServerResponse:te,willEmitClose:Z,isTransformStream:v},Ri}var po;function Wt(){if(po)return Pn.exports;po=1;const r=dr(),{AbortError:e,codes:t}=nt(),{ERR_INVALID_ARG_TYPE:n,ERR_STREAM_PREMATURE_CLOSE:i}=t,{kEmptyObject:s,once:a}=at(),{validateAbortSignal:o,validateFunction:u,validateObject:l,validateBoolean:c}=In(),{Promise:d,PromisePrototypeThen:b,SymbolDispose:y}=Be(),{isClosed:_,isReadable:E,isReadableNodeStream:v,isReadableStream:x,isReadableFinished:S,isReadableErrored:m,isWritable:h,isWritableNodeStream:g,isWritableStream:N,isWritableFinished:j,isWritableErrored:A,isNodeStream:B,willEmitClose:R,kIsClosedPromise:F}=jt();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),x(k)||N(k))return T(k,Y,w);if(!B(k))throw new n("stream",["ReadableStream","WritableStream","Stream"],k);const Q=(H=Y.readable)!==null&&H!==void 0?H:v(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)&&v(k)===Q&&g(k)===ue,ee=j(k,!1);const re=()=>{ee=!0,k.destroyed&&(U=!1),!(U&&(!k.readable||Q))&&(!Q||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)},C=J=>{w.call(k,J)};let W=_(k);const se=()=>{W=!0;const J=A(k)||m(k);if(J&&typeof J!="boolean")return w.call(k,J);if(Q&&!fe&&v(k,!0)&&!S(k,!1))return w.call(k,new i);if(ue&&!ee&&!j(k,!1))return w.call(k,new i);w.call(k)},he=()=>{W=!0;const J=A(k)||m(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",C),k.on("close",se),W?r.nextTick(se):V!=null&&V.errorEmitted||G!=null&&G.errorEmitted?U||r.nextTick(he):(!Q&&(!U||E(k))&&(ee||h(k)===!1)||!ue&&(!U||h(k))&&(fe||E(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",C),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||at().addAbortListener;const ce=q(Y.signal,J),ye=w;w=a((...le)=>{ce[y](),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||at().addAbortListener;const ue=q(Y.signal,K),V=w;w=a((...G)=>{ue[y](),V.apply(k,G)})}const Q=(...ue)=>{H||r.nextTick(()=>w.apply(k,ue))};return b(k[F].promise,Q,Q),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,Q)=>{const ue=te(k,Y,V=>{H&&ue(),V?Q(V):K()})})}return Pn.exports=te,Pn.exports.finished=Z,Pn.exports}var Ti,go;function jr(){if(go)return Ti;go=1;const r=dr(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:n}=nt(),{Symbol:i}=Be(),{kIsDestroyed:s,isDestroyed:a,isFinished:o,isServerRequest:u}=jt(),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 b(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?y(this,R,F):this.once(l,function(te){y(this,e(te,R),F)}),this)}function y(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(E,R)}try{R._destroy(F||null,O)}catch(te){O(te)}}function _(R,F){v(R,F),E(R)}function E(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 v(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 x(){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(v,R,F):v(R,F))}function m(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 N(R){return R?.setHeader&&typeof R.abort=="function"}function j(R){R.emit("close")}function A(R,F){R.emit("error",F),r.nextTick(j,R)}function B(R,F){!R||a(R)||(!F&&!o(R)&&(F=new n),u(R)?(R.socket=null,R.destroy(F)):N(R)?R.abort():N(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(j,R),R.destroyed||(R[s]=!0))}return Ti={construct:m,destroyer:B,destroy:b,undestroy:x,errorOrDestroy:S},Ti}var Ai,mo;function ya(){if(mo)return Ai;mo=1;const{ArrayIsArray:r,ObjectSetPrototypeOf:e}=Be(),{EventEmitter:t}=ai();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(E){s.writable&&s.write(E)===!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",b));let c=!1;function d(){c||(c=!0,s.end())}function b(){c||(c=!0,typeof s.destroy=="function"&&s.destroy())}function y(E){_(),t.listenerCount(this,"error")===0&&this.emit("error",E)}i(o,"error",y),i(s,"error",y);function _(){o.removeListener("data",u),s.removeListener("drain",l),o.removeListener("end",d),o.removeListener("close",b),o.removeListener("error",y),s.removeListener("error",y),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 Ai={Stream:n,prependListener:i},Ai}var Di={exports:{}},yo;function oi(){return yo||(yo=1,function(r){const{SymbolDispose:e}=Be(),{AbortError:t,codes:n}=nt(),{isNodeStream:i,isWebStream:s,kControllerErrorFunction:a}=jt(),o=Wt(),{ERR_INVALID_ARG_TYPE:u}=n;let l;const c=(d,b)=>{if(typeof d!="object"||!("aborted"in d))throw new u(b,"AbortSignal",d)};r.exports.addAbortSignal=function(b,y){if(c(b,"signal"),!i(y)&&!s(y))throw new u("stream",["ReadableStream","WritableStream","Stream"],y);return r.exports.addAbortSignalNoValidate(b,y)},r.exports.addAbortSignalNoValidate=function(d,b){if(typeof d!="object"||!("aborted"in d))return b;const y=i(b)?()=>{b.destroy(new t(void 0,{cause:d.reason}))}:()=>{b[a](new t(void 0,{cause:d.reason}))};if(d.aborted)y();else{l=l||at().addAbortListener;const _=l(d,y);o(b,_[e])}return b}}(Di)),Di.exports}var Oi,bo;function Ed(){if(bo)return Oi;bo=1;const{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:n}=Be(),{Buffer:i}=Lt(),{inspect:s}=at();return Oi=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 b=c.data;if(o>b.length)t(u,b,l-o),o-=b.length;else{o===b.length?(t(u,b,l-o),++d,c.next?this.head=c.next:this.head=this.tail=null):(t(u,new n(b.buffer,b.byteOffset,o),l-o),this.head=c,c.data=b.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})}},Oi}var Li,_o;function li(){if(_o)return Li;_o=1;const{MathFloor:r,NumberIsInteger:e}=Be(),{validateInteger:t}=In(),{ERR_INVALID_ARG_VALUE:n}=nt().codes;let i=16*1024,s=16;function a(c,d,b){return c.highWaterMark!=null?c.highWaterMark:d?c[b]: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,b,y){const _=a(d,y,b);if(_!=null){if(!e(_)||_<0){const E=y?`options.${b}`:"options.highWaterMark";throw new n(E,_)}return r(_)}return o(c.objectMode)}return Li={getHighWaterMark:l,getDefaultHighWaterMark:o,setDefaultHighWaterMark:u},Li}var ji={},Mn={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var wo;function Sd(){return wo||(wo=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)}}(Mn,Mn.exports)),Mn.exports}var vo;function Id(){if(vo)return ji;vo=1;var r=Sd().Buffer,e=r.isEncoding||function(x){switch(x=""+x,x&&x.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(x){if(!x)return"utf8";for(var S;;)switch(x){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 x;default:if(S)return;x=(""+x).toLowerCase(),S=!0}}function n(x){var S=t(x);if(typeof S!="string"&&(r.isEncoding===e||!e(x)))throw new Error("Unknown encoding: "+x);return S||x}ji.StringDecoder=i;function i(x){this.encoding=n(x);var S;switch(this.encoding){case"utf16le":this.text=d,this.end=b,S=4;break;case"utf8":this.fillLast=u,S=4;break;case"base64":this.text=y,this.end=_,S=3;break;default:this.write=E,this.end=v;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(S)}i.prototype.write=function(x){if(x.length===0)return"";var S,m;if(this.lastNeed){if(S=this.fillLast(x),S===void 0)return"";m=this.lastNeed,this.lastNeed=0}else m=0;return m<x.length?S?S+this.text(x,m):this.text(x,m):S||""},i.prototype.end=c,i.prototype.text=l,i.prototype.fillLast=function(x){if(this.lastNeed<=x.length)return x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,x.length),this.lastNeed-=x.length};function s(x){return x<=127?0:x>>5===6?2:x>>4===14?3:x>>3===30?4:x>>6===2?-1:-2}function a(x,S,m){var h=S.length-1;if(h<m)return 0;var g=s(S[h]);return g>=0?(g>0&&(x.lastNeed=g-1),g):--h<m||g===-2?0:(g=s(S[h]),g>=0?(g>0&&(x.lastNeed=g-2),g):--h<m||g===-2?0:(g=s(S[h]),g>=0?(g>0&&(g===2?g=0:x.lastNeed=g-3),g):0))}function o(x,S,m){if((S[0]&192)!==128)return x.lastNeed=0,"�";if(x.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return x.lastNeed=1,"�";if(x.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return x.lastNeed=2,"�"}}function u(x){var S=this.lastTotal-this.lastNeed,m=o(this,x);if(m!==void 0)return m;if(this.lastNeed<=x.length)return x.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,S,0,x.length),this.lastNeed-=x.length}function l(x,S){var m=a(this,x,S);if(!this.lastNeed)return x.toString("utf8",S);this.lastTotal=m;var h=x.length-(m-this.lastNeed);return x.copy(this.lastChar,0,h),x.toString("utf8",S,h)}function c(x){var S=x&&x.length?this.write(x):"";return this.lastNeed?S+"�":S}function d(x,S){if((x.length-S)%2===0){var m=x.toString("utf16le",S);if(m){var h=m.charCodeAt(m.length-1);if(h>=55296&&h<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1],m.slice(0,-1)}return m}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=x[x.length-1],x.toString("utf16le",S,x.length-1)}function b(x){var S=x&&x.length?this.write(x):"";if(this.lastNeed){var m=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,m)}return S}function y(x,S){var m=(x.length-S)%3;return m===0?x.toString("base64",S):(this.lastNeed=3-m,this.lastTotal=3,m===1?this.lastChar[0]=x[x.length-1]:(this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1]),x.toString("base64",S,x.length-m))}function _(x){var S=x&&x.length?this.write(x):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function E(x){return x.toString(this.encoding)}function v(x){return x&&x.length?this.write(x):""}return ji}var Ci,xo;function tc(){if(xo)return Ci;xo=1;const r=dr(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:n}=Be(),{Buffer:i}=Lt(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_NULL_VALUES:a}=nt().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 b;if(l&&l[t])b=!0,d=l[t]();else if(l&&l[n])b=!1,d=l[n]();else throw new s("iterable",["Iterable"],l);const y=new u({objectMode:!0,highWaterMark:1,...c});let _=!1;y._read=function(){_||(_=!0,v())},y._destroy=function(x,S){e(E(x),()=>r.nextTick(S,x),m=>r.nextTick(S,m||x))};async function E(x){const S=x!=null,m=typeof d.throw=="function";if(S&&m){const{value:h,done:g}=await d.throw(x);if(await h,g)return}if(typeof d.return=="function"){const{value:h}=await d.return();await h}}async function v(){for(;;){try{const{value:x,done:S}=b?await d.next():d.next();if(S)y.push(null);else{const m=x&&typeof x.then=="function"?await x:x;if(m===null)throw _=!1,new a;if(y.push(m))continue;_=!1}}catch(x){y.destroy(x)}break}}return y}return Ci=o,Ci}var $i,Eo;function ui(){if(Eo)return $i;Eo=1;const r=dr(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:n,NumberParseInt:i,ObjectDefineProperties:s,ObjectKeys:a,ObjectSetPrototypeOf:o,Promise:u,SafeSet:l,SymbolAsyncDispose:c,SymbolAsyncIterator:d,Symbol:b}=Be();$i=le,le.ReadableState=ye;const{EventEmitter:y}=ai(),{Stream:_,prependListener:E}=ya(),{Buffer:v}=Lt(),{addAbortSignal:x}=oi(),S=Wt();let m=at().debuglog("stream",L=>{m=L});const h=Ed(),g=jr(),{getHighWaterMark:N,getDefaultHighWaterMark:j}=li(),{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}=nt(),{validateObject:te}=In(),T=b("kPaused"),{StringDecoder:Z}=Id(),k=tc();o(le.prototype,_.prototype),o(le,_);const Y=()=>{},{errorOrDestroy:w}=g,H=1,K=2,Q=4,ue=8,V=16,G=32,z=64,U=128,ee=256,re=512,fe=1024,ge=2048,C=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(Q),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(C),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|C|V|G,L&&L.objectMode&&(this.state|=H),be&&L&&L.readableObjectMode&&(this.state|=H),this.highWaterMark=L?N(this,L,"readableHighWaterMark",be):j(!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&=~C),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&&x(L.signal,this)),_.call(this,L),g.construct(this,()=>{this._readableState.needReadable&&X(this,this._readableState)})}le.prototype.destroy=g.destroy,le.prototype._undestroy=g.undestroy,le.prototype._destroy=function(L,M){M(L)},le.prototype[y.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){m("readableAddChunk",M);const ve=L._readableState;let Qe;if((ve.state&H)===0&&(typeof M=="string"?(be=be||ve.defaultEncoding,ve.encoding!==be&&(_e&&ve.encoding?M=v.from(M,be).toString(ve.encoding):(M=v.from(M,be),be=""))):M instanceof v?be="":_._isUint8Array(M)?(M=_._uint8ArrayToBuffer(M),be=""):M!=null&&(Qe=new B("chunk",["string","Buffer","Uint8Array"],M))),Qe)w(L,Qe);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&Q)!==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):X(L,ve)):ze(L,ve,M,!1)}else _e||(ve.state&=~ue,X(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)),X(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 Xe(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 I(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){m("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=Xe(L)),L!==0&&(M.state&=~U),L===0&&M.needReadable&&((M.highWaterMark!==0?M.length>=M.highWaterMark:M.length>0)||M.ended))return m("read: emitReadable",M.length,M.ended),M.length===0&&M.ended?Ue(this):p(this),null;if(L=I(L,M),L===0&&M.ended)return M.length===0&&Ue(this),null;let _e=(M.state&z)!==0;if(m("need readable",_e),(M.length===0||M.length-L<M.highWaterMark)&&(_e=!0,m("length less than watermark",_e)),M.ended||M.reading||M.destroyed||M.errored||!M.constructed)_e=!1,m("reading, ended or constructing",_e);else if(_e){m("do read"),M.state|=ue|G,M.length===0&&(M.state|=z);try{this._read(M.highWaterMark)}catch(Qe){w(this,Qe)}M.state&=~G,M.reading||(L=I(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&&Ue(this)),ve!==null&&!M.errorEmitted&&!M.closeEmitted&&(M.dataEmitted=!0,this.emit("data",ve)),ve};function f(L,M){if(m("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;m("emitReadable",M.needReadable,M.emittedReadable),M.needReadable=!1,M.emittedReadable||(m("emitReadable",M.flowing),M.emittedReadable=!0,r.nextTick($,L))}function $(L){const M=L._readableState;m("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 X(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(m("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),m("pipe count=%d opts=%j",_e.pipes.length,M);const Qe=(!M||M.end!==!1)&&L!==r.stdout&&L!==r.stderr?Dn:P;_e.endEmitted?r.nextTick(Qe):be.once("end",Qe),L.on("unpipe",Ze);function Ze(ne,ie){m("onunpipe"),ne===be&&ie&&ie.hasUnpiped===!1&&(ie.hasUnpiped=!0,Rt())}function Dn(){m("onend"),L.end()}let Nt,On=!1;function Rt(){m("cleanup"),L.removeListener("close",Mr),L.removeListener("finish",Ge),Nt&&L.removeListener("drain",Nt),L.removeListener("error",mr),L.removeListener("unpipe",Ze),be.removeListener("end",Dn),be.removeListener("end",P),be.removeListener("data",gr),On=!0,Nt&&_e.awaitDrainWriters&&(!L._writableState||L._writableState.needDrain)&&Nt()}function Pr(){On||(_e.pipes.length===1&&_e.pipes[0]===L?(m("false write response, pause",0),_e.awaitDrainWriters=L,_e.multiAwaitDrain=!1):_e.pipes.length>1&&_e.pipes.includes(L)&&(m("false write response, pause",_e.awaitDrainWriters.size),_e.awaitDrainWriters.add(L)),be.pause()),Nt||(Nt=de(be,L),L.on("drain",Nt))}be.on("data",gr);function gr(ne){m("ondata");const ie=L.write(ne);m("dest.write",ie),ie===!1&&Pr()}function mr(ne){if(m("onerror",ne),P(),L.removeListener("error",mr),L.listenerCount("error")===0){const ie=L._writableState||L._readableState;ie&&!ie.errorEmitted?w(L,ne):L.emit("error",ne)}}E(L,"error",mr);function Mr(){L.removeListener("finish",Ge),P()}L.once("close",Mr);function Ge(){m("onfinish"),L.removeListener("close",Mr),P()}L.once("finish",Ge);function P(){m("unpipe"),be.unpipe(L)}return L.emit("pipe",be),L.writableNeedDrain===!0?Pr():_e.flowing||(m("pipe resume"),be.resume()),L};function de(L,M){return function(){const _e=L._readableState;_e.awaitDrainWriters===M?(m("pipeOnDrain",1),_e.awaitDrainWriters=null):_e.multiAwaitDrain&&(m("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 Qe=0;Qe<ve.length;Qe++)ve[Qe].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,m("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){m("readable nexttick read 0"),L.read(0)}le.prototype.resume=function(){const L=this._readableState;return L.flowing||(m("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){m("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 m("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(m("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[T]=!0,this};function De(L){const M=L._readableState;for(m("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=kt(L,M);return be.stream=L,be}async function*kt(L,M){let be=Y;function _e(Ze){this===L?(be(),be=Y):be=Ze}L.on("readable",_e);let ve;const Qe=S(L,{writable:!1},Ze=>{ve=Ze?A(ve,Ze):null,be(),be=Y});try{for(;;){const Ze=L.destroyed?null:L.read();if(Ze!==null)yield Ze;else{if(ve)throw ve;if(ve===null)return;await new u(_e)}}}catch(Ze){throw ve=A(ve,Ze),ve}finally{(ve||M?.destroyOnReturn!==!1)&&(ve===void 0||L._readableState.autoDestroy)?g.destroyer(L,null):(L.off("readable",_e),Qe())}}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 Ue(L){const M=L._readableState;m("endReadable",M.endEmitted),M.endEmitted||(M.ended=!0,r.nextTick(An,M,L))}function An(L,M){if(m("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(Pt,M);else if(L.autoDestroy){const be=M._writableState;(!be||be.autoDestroy&&(be.finished||be.writable===!1))&&M.destroy()}}}function Pt(L){L.writable&&!L.writableEnded&&!L.destroyed&&L.end()}le.from=function(L,M){return k(le,L,M)};let pr;function kr(){return pr===void 0&&(pr={}),pr}return le.fromWeb=function(L,M){return kr().newStreamReadableFromReadableStream(L,M)},le.toWeb=function(L,M){return kr().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,Qe){g.destroyer(L,ve),Qe(ve)}}).wrap(L)},$i}var Fi,So;function ba(){if(So)return Fi;So=1;const r=dr(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:n,ObjectDefineProperty:i,ObjectDefineProperties:s,ObjectSetPrototypeOf:a,StringPrototypeToLowerCase:o,Symbol:u,SymbolHasInstance:l}=Be();Fi=te,te.WritableState=D;const{EventEmitter:c}=ai(),d=ya().Stream,{Buffer:b}=Lt(),y=jr(),{addAbortSignal:_}=oi(),{getHighWaterMark:E,getDefaultHighWaterMark:v}=li(),{ERR_INVALID_ARG_TYPE:x,ERR_METHOD_NOT_IMPLEMENTED:S,ERR_MULTIPLE_CALLBACK:m,ERR_STREAM_CANNOT_PIPE:h,ERR_STREAM_DESTROYED:g,ERR_STREAM_ALREADY_FINISHED:N,ERR_STREAM_NULL_VALUES:j,ERR_STREAM_WRITE_AFTER_END:A,ERR_UNKNOWN_ENCODING:B}=nt().codes,{errorOrDestroy:R}=y;a(te.prototype,d.prototype),a(te,d);function F(){}const q=u("kOnFinished");function D(C,W,se){typeof se!="boolean"&&(se=W instanceof Dt()),this.objectMode=!!(C&&C.objectMode),se&&(this.objectMode=this.objectMode||!!(C&&C.writableObjectMode)),this.highWaterMark=C?E(this,C,"writableHighWaterMark",se):v(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const he=!!(C&&C.decodeStrings===!1);this.decodeStrings=!he,this.defaultEncoding=C&&C.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=!C||C.emitClose!==!1,this.autoDestroy=!C||C.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[q]=[]}function O(C){C.buffered=[],C.bufferedIndex=0,C.allBuffers=!0,C.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(C){const W=this instanceof Dt();if(!W&&!n(te,this))return new te(C);this._writableState=new D(C,this,W),C&&(typeof C.write=="function"&&(this._write=C.write),typeof C.writev=="function"&&(this._writev=C.writev),typeof C.destroy=="function"&&(this._destroy=C.destroy),typeof C.final=="function"&&(this._final=C.final),typeof C.construct=="function"&&(this._construct=C.construct),C.signal&&_(C.signal,this)),d.call(this,C),y.construct(this,()=>{const se=this._writableState;se.writing||ue(this,se),U(this,se)})}i(te,l,{__proto__:null,value:function(C){return n(this,C)?!0:this!==te?!1:C&&C._writableState instanceof D}}),te.prototype.pipe=function(){R(this,new h)};function T(C,W,se,he){const pe=C._writableState;if(typeof se=="function")he=se,se=pe.defaultEncoding;else{if(!se)se=pe.defaultEncoding;else if(se!=="buffer"&&!b.isEncoding(se))throw new B(se);typeof he!="function"&&(he=F)}if(W===null)throw new j;if(!pe.objectMode)if(typeof W=="string")pe.decodeStrings!==!1&&(W=b.from(W,se),se="buffer");else if(W instanceof b)se="buffer";else if(d._isUint8Array(W))W=d._uint8ArrayToBuffer(W),se="buffer";else throw new x("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(C,me,!0),me):(pe.pendingcb++,Z(C,pe,W,se,he))}te.prototype.write=function(C,W,se){return T(this,C,W,se)===!0},te.prototype.cork=function(){this._writableState.corked++},te.prototype.uncork=function(){const C=this._writableState;C.corked&&(C.corked--,C.writing||ue(this,C))},te.prototype.setDefaultEncoding=function(W){if(typeof W=="string"&&(W=o(W)),!b.isEncoding(W))throw new B(W);return this._writableState.defaultEncoding=W,this};function Z(C,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,C._write(se,he,W.onwrite),W.sync=!1),J&&!W.errored&&!W.destroyed}function k(C,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?C._writev(pe,W.onwrite):C._write(pe,me,W.onwrite),W.sync=!1}function Y(C,W,se,he){--W.pendingcb,he(se),Q(W),R(C,se)}function w(C,W){const se=C._writableState,he=se.sync,pe=se.writecb;if(typeof pe!="function"){R(C,new m);return}se.writing=!1,se.writecb=null,se.length-=se.writelen,se.writelen=0,W?(W.stack,se.errored||(se.errored=W),C._readableState&&!C._readableState.errored&&(C._readableState.errored=W),he?r.nextTick(Y,C,se,W,pe):Y(C,se,W,pe)):(se.buffered.length>se.bufferedIndex&&ue(C,se),he?se.afterWriteTickInfo!==null&&se.afterWriteTickInfo.cb===pe?se.afterWriteTickInfo.count++:(se.afterWriteTickInfo={count:1,cb:pe,stream:C,state:se},r.nextTick(H,se.afterWriteTickInfo)):K(C,se,1,pe))}function H({stream:C,state:W,count:se,cb:he}){return W.afterWriteTickInfo=null,K(C,W,se,he)}function K(C,W,se,he){for(!W.ending&&!C.destroyed&&W.length===0&&W.needDrain&&(W.needDrain=!1,C.emit("drain"));se-- >0;)W.pendingcb--,he();W.destroyed&&Q(W),U(C,W)}function Q(C){if(C.writing)return;for(let pe=C.bufferedIndex;pe<C.buffered.length;++pe){var W;const{chunk:me,callback:J}=C.buffered[pe],ce=C.objectMode?1:me.length;C.length-=ce,J((W=C.errored)!==null&&W!==void 0?W:new g("write"))}const se=C[q].splice(0);for(let pe=0;pe<se.length;pe++){var he;se[pe]((he=C.errored)!==null&&he!==void 0?he:new g("end"))}O(C)}function ue(C,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&&C._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(C,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(C,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(C,W,se){if(this._writev)this._writev([{chunk:C,encoding:W}],se);else throw new S("_write()")},te.prototype._writev=null,te.prototype.end=function(C,W,se){const he=this._writableState;typeof C=="function"?(se=C,C=null,W=null):typeof W=="function"&&(se=W,W=null);let pe;if(C!=null){const me=T(this,C,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 N("end"):he.destroyed&&(pe=new g("end"))),typeof se=="function"&&(pe||he.finished?r.nextTick(se,pe):he[q].push(se)),this};function V(C){return C.ending&&!C.destroyed&&C.constructed&&C.length===0&&!C.errored&&C.buffered.length===0&&!C.finished&&!C.writing&&!C.errorEmitted&&!C.closeEmitted}function G(C,W){let se=!1;function he(pe){if(se){R(C,pe??m());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(C,pe,W.sync)}else V(W)&&(W.prefinished=!0,C.emit("prefinish"),W.pendingcb++,r.nextTick(ee,C,W))}W.sync=!0,W.pendingcb++;try{C._final(he)}catch(pe){he(pe)}W.sync=!1}function z(C,W){!W.prefinished&&!W.finalCalled&&(typeof C._final=="function"&&!W.destroyed?(W.finalCalled=!0,G(C,W)):(W.prefinished=!0,C.emit("prefinish")))}function U(C,W,se){V(W)&&(z(C,W),W.pendingcb===0&&(se?(W.pendingcb++,r.nextTick((he,pe)=>{V(pe)?ee(he,pe):pe.pendingcb--},C,W)):V(W)&&(W.pendingcb++,ee(C,W))))}function ee(C,W){W.pendingcb--,W.finished=!0;const se=W[q].splice(0);for(let he=0;he<se.length;he++)se[he]();if(C.emit("finish"),W.autoDestroy){const he=C._readableState;(!he||he.autoDestroy&&(he.endEmitted||he.readable===!1))&&C.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(C){this._writableState&&(this._writableState.destroyed=C)}},writable:{__proto__:null,get(){const C=this._writableState;return!!C&&C.writable!==!1&&!C.destroyed&&!C.errored&&!C.ending&&!C.ended},set(C){this._writableState&&(this._writableState.writable=!!C)}},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 C=this._writableState;return C?!C.destroyed&&!C.ending&&C.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=y.destroy;te.prototype.destroy=function(C,W){const se=this._writableState;return!se.destroyed&&(se.bufferedIndex<se.buffered.length||se[q].length)&&r.nextTick(Q,se),re.call(this,C,W),this},te.prototype._undestroy=y.undestroy,te.prototype._destroy=function(C,W){W(C)},te.prototype[c.captureRejectionSymbol]=function(C){this.destroy(C)};let fe;function ge(){return fe===void 0&&(fe={}),fe}return te.fromWeb=function(C,W){return ge().newStreamWritableFromWritableStream(C,W)},te.toWeb=function(C){return ge().newWritableStreamFromStreamWritable(C)},Fi}var ki,Io;function Nd(){if(Io)return ki;Io=1;const r=dr(),e=Lt(),{isReadable:t,isWritable:n,isIterable:i,isNodeStream:s,isReadableNodeStream:a,isWritableNodeStream:o,isDuplexNodeStream:u,isReadableStream:l,isWritableStream:c}=jt(),d=Wt(),{AbortError:b,codes:{ERR_INVALID_ARG_TYPE:y,ERR_INVALID_RETURN_VALUE:_}}=nt(),{destroyer:E}=jr(),v=Dt(),x=ui(),S=ba(),{createDeferredPromise:m}=at(),h=tc(),g=globalThis.Blob||e.Blob,N=typeof g<"u"?function(D){return D instanceof g}:function(D){return!1},j=globalThis.AbortController||wn().AbortController,{FunctionPrototypeCall:A}=Be();class B extends v{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)}}ki=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:x.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,Q=>{if(Q!=null)throw new _("nully","body",Q)},Q=>{E(H,Q)});return H=new B({objectMode:!0,readable:!1,write:Z,final(Q){k(async()=>{try{await K,r.nextTick(Q,null)}catch(ue){r.nextTick(Q,ue)}})},destroy:Y})}throw new _("Iterable, AsyncIterable or AsyncFunction",O,T)}if(N(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=>{E(T,Z)}),T=new B({objectMode:!0,writable:!1,read(){}})}throw new y(O,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],D)};function R(q){let{promise:D,resolve:O}=m();const te=new j,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 b(void 0,{cause:T.reason});({promise:D,resolve:O}=m()),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"?x.wrap(q.readable):q.readable,O=q.writable;let te=!!t(D),T=!!n(O),Z,k,Y,w,H;function K(Q){const ue=w;w=null,ue?ue(Q):Q&&H.destroy(Q)}return H=new B({readableObjectMode:!!(D!=null&&D.readableObjectMode),writableObjectMode:!!(O!=null&&O.writableObjectMode),readable:te,writable:T}),T&&(d(O,Q=>{T=!1,Q&&E(D,Q),K(Q)}),H._write=function(Q,ue,V){O.write(Q,ue)?V():Z=V},H._final=function(Q){O.end(),k=Q},O.on("drain",function(){if(Z){const Q=Z;Z=null,Q()}}),O.on("finish",function(){if(k){const Q=k;k=null,Q()}})),te&&(d(D,Q=>{te=!1,Q&&E(D,Q),K(Q)}),D.on("readable",function(){if(Y){const Q=Y;Y=null,Q()}}),D.on("end",function(){H.push(null)}),H._read=function(){for(;;){const Q=D.read();if(Q===null){Y=H._read;return}if(!H.push(Q))return}}),H._destroy=function(Q,ue){!Q&&w!==null&&(Q=new b),Y=null,Z=null,k=null,w===null?ue(Q):(w=ue,E(O,Q),E(D,Q))},H}return ki}var Pi,No;function Dt(){if(No)return Pi;No=1;const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:n}=Be();Pi=a;const i=ui(),s=ba();n(a.prototype,i.prototype),n(a,i);{const c=t(s.prototype);for(let d=0;d<c.length;d++){const b=c[d];a.prototype[b]||(a.prototype[b]=s.prototype[b])}}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=Nd()),l(c,"body")},Pi}var Mi,Ro;function rc(){if(Ro)return Mi;Ro=1;const{ObjectSetPrototypeOf:r,Symbol:e}=Be();Mi=a;const{ERR_METHOD_NOT_IMPLEMENTED:t}=nt().codes,n=Dt(),{getHighWaterMark:i}=li();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 b=this._readableState,y=this._writableState,_=b.length;this._transform(l,c,(E,v)=>{if(E){d(E);return}v!=null&&this.push(v),y.ended||_===b.length||b.length<b.highWaterMark?d():this[s]=d})},a.prototype._read=function(){if(this[s]){const l=this[s];this[s]=null,l()}},Mi}var Bi,To;function nc(){if(To)return Bi;To=1;const{ObjectSetPrototypeOf:r}=Be();Bi=t;const e=rc();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)},Bi}var qi,Ao;function _a(){if(Ao)return qi;Ao=1;const r=dr(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:n,SymbolDispose:i}=Be(),s=Wt(),{once:a}=at(),o=jr(),u=Dt(),{aggregateTwoErrors:l,codes:{ERR_INVALID_ARG_TYPE:c,ERR_INVALID_RETURN_VALUE:d,ERR_MISSING_ARGS:b,ERR_STREAM_DESTROYED:y,ERR_STREAM_PREMATURE_CLOSE:_},AbortError:E}=nt(),{validateFunction:v,validateAbortSignal:x}=In(),{isIterable:S,isReadable:m,isReadableNodeStream:h,isNodeStream:g,isTransformStream:N,isWebStream:j,isReadableStream:A,isReadableFinished:B}=jt(),R=globalThis.AbortController||wn().AbortController;let F,q,D;function O(Q,ue,V){let G=!1;Q.on("close",()=>{G=!0});const z=s(Q,{readable:ue,writable:V},U=>{G=!U});return{destroy:U=>{G||(G=!0,o.destroyer(Q,U||new y("pipe")))},cleanup:z}}function te(Q){return v(Q[Q.length-1],"streams[stream.length - 1]"),Q.pop()}function T(Q){if(S(Q))return Q;if(h(Q))return Z(Q);throw new c("val",["Readable","Iterable","AsyncIterable"],Q)}async function*Z(Q){q||(q=ui()),yield*q.prototype[n].call(Q)}async function k(Q,ue,V,{end:G}){let z,U=null;const ee=ge=>{if(ge&&(z=ge),U){const C=U;U=null,C()}},re=()=>new t((ge,C)=>{z?C(z):U=()=>{z?C(z):ge()}});ue.on("drain",ee);const fe=s(ue,{readable:!1},ee);try{ue.writableNeedDrain&&await re();for await(const ge of Q)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(Q,ue,V,{end:G}){N(ue)&&(ue=ue.writable);const z=ue.getWriter();try{for await(const U of Q)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(...Q){return H(Q,a(te(Q)))}function H(Q,ue,V){if(Q.length===1&&e(Q[0])&&(Q=Q[0]),Q.length<2)throw new b("streams");const G=new R,z=G.signal,U=V?.signal,ee=[];x(U,"options.signal");function re(){pe(new E)}D=D||at().addAbortListener;let fe;U&&(fe=D(U,re));let ge,C;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,C))}}let me;for(let ye=0;ye<Q.length;ye++){const le=Q[ye],Ne=ye<Q.length-1,ze=ye>0,Se=Ne||V?.end!==!1,Xe=ye===Q.length-1;if(g(le)){let I=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),m(le)&&Xe&&ee.push(p)}le.on("error",I),m(le)&&Xe&&ee.push(()=>{le.removeListener("error",I)})}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)||N(le)?me=le:me=u.from(le);else if(typeof le=="function"){if(N(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=nc());const I=new F({objectMode:!0}),f=(ce=me)===null||ce===void 0?void 0:ce.then;if(typeof f=="function")se++,f.call(me,X=>{C=X,X!=null&&I.write(X),Se&&I.end(),r.nextTick(he)},X=>{I.destroy(X),r.nextTick(he,X)});else if(S(me,!0))se++,k(me,I,he,{end:Se});else if(A(me)||N(me)){const X=me.readable||me;se++,k(X,I,he,{end:Se})}else throw new d("AsyncIterable or Promise","destination",me);me=I;const{destroy:p,cleanup:$}=O(me,!1,!0);W.push(p),Xe&&ee.push($)}}else if(g(le)){if(h(me)){se+=2;const I=K(me,le,he,{end:Se});m(le)&&Xe&&ee.push(I)}else if(N(me)||A(me)){const I=me.readable||me;se++,k(I,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(j(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(N(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(Q,ue,V,{end:G}){let z=!1;if(ue.on("close",()=>{z||V(new _)}),Q.pipe(ue,{end:!1}),G){let U=function(){z=!0,ue.end()};B(Q)?r.nextTick(U):Q.once("end",U)}else V();return s(Q,{readable:!0,writable:!1},U=>{const ee=Q._readableState;U&&U.code==="ERR_STREAM_PREMATURE_CLOSE"&&ee&&ee.ended&&!ee.errored&&!ee.errorEmitted?Q.once("end",V).once("error",V):V(U)}),s(ue,{readable:!1,writable:!0},V)}return qi={pipelineImpl:H,pipeline:w},qi}var Ui,Do;function ic(){if(Do)return Ui;Do=1;const{pipeline:r}=_a(),e=Dt(),{destroyer:t}=jr(),{isNodeStream:n,isReadable:i,isWritable:s,isWebStream:a,isTransformStream:o,isWritableStream:u,isReadableStream:l}=jt(),{AbortError:c,codes:{ERR_INVALID_ARG_VALUE:d,ERR_MISSING_ARGS:b}}=nt(),y=Wt();return Ui=function(...E){if(E.length===0)throw new b("streams");if(E.length===1)return e.from(E[0]);const v=[...E];if(typeof E[0]=="function"&&(E[0]=e.from(E[0])),typeof E[E.length-1]=="function"){const F=E.length-1;E[F]=e.from(E[F])}for(let F=0;F<E.length;++F)if(!(!n(E[F])&&!a(E[F]))){if(F<E.length-1&&!(i(E[F])||l(E[F])||o(E[F])))throw new d(`streams[${F}]`,v[F],"must be readable");if(F>0&&!(s(E[F])||u(E[F])||o(E[F])))throw new d(`streams[${F}]`,v[F],"must be writable")}let x,S,m,h,g;function N(F){const q=h;h=null,q?q(F):F?g.destroy(F):!R&&!B&&g.destroy()}const j=E[0],A=r(E,N),B=!!(s(j)||u(j)||o(j)),R=!!(i(A)||l(A)||o(A));if(g=new e({writableObjectMode:!!(j!=null&&j.writableObjectMode),readableObjectMode:!!(A!=null&&A.readableObjectMode),writable:B,readable:R}),B){if(n(j))g._write=function(q,D,O){j.write(q,D)?O():x=O},g._final=function(q){j.end(),S=q},j.on("drain",function(){if(x){const q=x;x=null,q()}});else if(a(j)){const D=(o(j)?j.writable:j).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;y(F,()=>{if(S){const q=S;S=null,q()}})}if(R){if(n(A))A.on("readable",function(){if(m){const F=m;m=null,F()}}),A.on("end",function(){g.push(null)}),g._read=function(){for(;;){const F=A.read();if(F===null){m=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),m=null,x=null,S=null,h===null?q(F):(h=q,n(A)&&t(A,F))},g},Ui}var Oo;function Rd(){if(Oo)return kn;Oo=1;const r=globalThis.AbortController||wn().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:n,ERR_OUT_OF_RANGE:i},AbortError:s}=nt(),{validateAbortSignal:a,validateInteger:o,validateObject:u}=In(),l=Be().Symbol("kWeak"),c=Be().Symbol("kResistStopPropagation"),{finished:d}=Wt(),b=ic(),{addAbortSignalNoValidate:y}=oi(),{isWritable:_,isNodeStream:E}=jt(),{deprecate:v}=at(),{ArrayPrototypePush:x,Boolean:S,MathFloor:m,Number:h,NumberIsNaN:g,Promise:N,PromiseReject:j,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"),E(U)&&!_(U))throw new e("stream",U,"must be writable");const re=b(this,U);return ee!=null&&ee.signal&&y(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=m(ee.concurrency));let fe=re-1;return ee?.highWaterMark!=null&&(fe=m(ee.highWaterMark)),o(re,"options.concurrency",1),o(fe,"options.highWaterMark",0),fe+=re,(async function*(){const C=at().AbortSignalAny([ee?.signal].filter(S)),W=this,se=[],he={signal:C};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(C.aborted)throw new s;try{if(Se=U(Se,he),Se===F)continue;Se=A(Se)}catch(Xe){Se=j(Xe)}ce+=1,B(Se,le,ye),se.push(Se),pe&&(pe(),pe=null),!J&&(se.length>=fe||ce>=re)&&await new N(Xe=>{me=Xe})}se.push(q)}catch(Se){const Xe=j(Se);B(Xe,le,ye),se.push(Xe)}finally{J=!0,pe&&(pe(),pe=null)}}ze();try{for(;;){for(;se.length>0;){const Se=await se[0];if(Se===q)return;if(C.aborted)throw new s;Se!==F&&(yield Se),se.shift(),Ne()}await new N(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 C=new r,W=C.signal;if(re!=null&&re.signal){const pe={once:!0,[l]:this,[c]:!0};re.signal.addEventListener("abort",()=>C.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{C.abort()}return ee}async function Q(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});x(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 C of this){var ge;if(ee!=null&&(ge=ee.signal)!==null&&ge!==void 0&&ge.aborted)throw new s;U--<=0&&(yield C)}}).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 C of this){var ge;if(ee!=null&&(ge=ee.signal)!==null&&ge!==void 0&&ge.aborted)throw new s;if(U-- >0&&(yield C),U<=0)return}}).call(this)}return kn.streamReturningOperators={asIndexedPairs:v(te,"readable.asIndexedPairs will be removed in a future version."),drop:G,filter:w,flatMap:ue,map:O,take:z,compose:D},kn.promiseReturningOperators={every:Z,forEach:Y,reduce:K,toArray:Q,some:T,find:k},kn}var Hi,Lo;function sc(){if(Lo)return Hi;Lo=1;const{ArrayPrototypePop:r,Promise:e}=Be(),{isIterable:t,isNodeStream:n,isWebStream:i}=jt(),{pipelineImpl:s}=_a(),{finished:a}=Wt();ac();function o(...u){return new e((l,c)=>{let d,b;const y=u[u.length-1];if(y&&typeof y=="object"&&!n(y)&&!t(y)&&!i(y)){const _=r(u);d=_.signal,b=_.end}s(u,(_,E)=>{_?c(_):l(E)},{signal:d,end:b})})}return Hi={finished:a,pipeline:o},Hi}var jo;function ac(){if(jo)return wi.exports;jo=1;const{Buffer:r}=Lt(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:n}=Be(),{promisify:{custom:i}}=at(),{streamReturningOperators:s,promiseReturningOperators:a}=Rd(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:o}}=nt(),u=ic(),{setDefaultHighWaterMark:l,getDefaultHighWaterMark:c}=li(),{pipeline:d}=_a(),{destroyer:b}=jr(),y=Wt(),_=sc(),E=jt(),v=wi.exports=ya().Stream;v.isDestroyed=E.isDestroyed,v.isDisturbed=E.isDisturbed,v.isErrored=E.isErrored,v.isReadable=E.isReadable,v.isWritable=E.isWritable,v.Readable=ui();for(const S of t(s)){let h=function(...g){if(new.target)throw o();return v.Readable.from(n(m,this,g))};const m=s[S];e(h,"name",{__proto__:null,value:m.name}),e(h,"length",{__proto__:null,value:m.length}),e(v.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(m,this,g)};const m=a[S];e(h,"name",{__proto__:null,value:m.name}),e(h,"length",{__proto__:null,value:m.length}),e(v.Readable.prototype,S,{__proto__:null,value:h,enumerable:!1,configurable:!0,writable:!0})}v.Writable=ba(),v.Duplex=Dt(),v.Transform=rc(),v.PassThrough=nc(),v.pipeline=d;const{addAbortSignal:x}=oi();return v.addAbortSignal=x,v.finished=y,v.destroy=b,v.compose=u,v.setDefaultHighWaterMark=l,v.getDefaultHighWaterMark=c,e(v,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return _}}),e(d,i,{__proto__:null,enumerable:!0,get(){return _.pipeline}}),e(y,i,{__proto__:null,enumerable:!0,get(){return _.finished}}),v.Stream=v,v._isUint8Array=function(m){return m instanceof Uint8Array},v._uint8ArrayToBuffer=function(m){return r.from(m.buffer,m.byteOffset,m.byteLength)},wi.exports}var Co;function oc(){return Co||(Co=1,function(r){const e=ac(),t=sc(),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}(_i)),_i.exports}var wa=oc();const Vi=Symbol("iter");function pn(r,e,t=4){if(t===0)return Object.assign(r,e);for(const n in e)r[n]=pn(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:pn({},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 cn(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&&(na(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${t}.${n}.${i}.${s}`:`.${t}.${n}.${i}`]}return this._ids[Sr(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${na(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Sr(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,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 tt{constructor(e,t){this._size=0,this._graphs=Object.create(null),!t&&e&&!e[0]&&typeof e.match!="function"&&(t=e,e=null),t=t||{},this._factory=t.factory||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 b=this._entities,y=this._termFromId(b[u]),_={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const E in e)if(c=e[E]){_[s]=this._termFromId(b[E]),n&&((l=c,c={})[n]=l[n]);for(const v in c)if(d=c[v]){_[a]=this._termFromId(b[v]);const x=i?i in d?[i]:[]:Object.keys(d);for(let S=0;S<x.length;S++)_[o]=this._termFromId(b[x[S]]),yield this._factory.quad(_.subject,_.predicate,_.object,y)}}}_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 wa.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 Bt(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 b=o.graph;let y=o.subject;for(;y&&!l;){const _=this.getQuads(null,null,y,null),E=this.getQuads(y,null,null,null);let v,x=null,S=null,m=null;for(let h=0;h<E.length&&!l;h++)v=E[h],v.graph.equals(b)?c?l=i(y,"has non-list arcs out"):v.predicate.value===Ke.rdf.first?x?l=i(y,"has multiple rdf:first arcs"):a.push(x=v):v.predicate.value===Ke.rdf.rest?S?l=i(y,"has multiple rdf:rest arcs"):a.push(S=v):_.length?l=i(y,"can't be subject and object"):(c=v,d="subject"):l=i(y,"not confined to single graph");for(let h=0;h<_.length&&!l;++h)v=_[h],c?l=i(y,"can't have coreferences"):v.predicate.value===Ke.rdf.rest?m?l=i(y,"has incoming rdf:rest arcs"):m=v:(c=v,d="object");x?u.unshift(x.object):l=i(y,"has no list head"),y=m&&m.subject}l?e=!1:c&&(n[c[d].value]=u)}),e&&this.removeQuads(a),n}addAll(e){if(e instanceof Bt&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof tt&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=pn(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof Bt&&(e=e.filtered),e===this)return!0;if(!(e instanceof tt)||this._entityIndex!==e._entityIndex)return e.every(l=>this.has(l));const t=this._graphs,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 b in o[d])if(!(b 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 Bt&&(e=e.filtered),e===this)return new tt({entityIndex:this._entityIndex});if(e instanceof tt&&e._entityIndex===this._entityIndex){const t=new tt({entityIndex:this._entityIndex}),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 Bt&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new tt({entityIndex:this._entityIndex});for(const n of this)e(n,this)&&t.add(n);return t}intersection(e){if(e instanceof Bt&&(e=e.filtered),e===this){const t=new tt({entityIndex:this._entityIndex});return t._graphs=pn(Object.create(null),this._graphs),t._size=this._size,t}else if(e instanceof tt&&this._entityIndex===e._entityIndex){const t=new tt({entityIndex:this._entityIndex}),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 tt({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 ma().quadsToString(this)}union(e){const t=new tt({entityIndex:this._entityIndex});return t._graphs=pn(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function xt(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:xt(r[s],e,t+1);a!==!1&&(i=i||Object.create(null),i[s]=a)}return i}class Bt extends wa.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 tt({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 b,y,_,E;(E=c[d])&&(!o&&u?(y=xt(E.predicates,[u,l,o]))&&(b=xt(E.subjects,[o,u,l]),_=xt(E.objects,[l,o,u])):l?(_=xt(E.objects,[l,o,u]))&&(b=xt(E.subjects,[o,u,l]),y=xt(E.predicates,[u,l,o])):(b=xt(E.subjects,[o,u,l]))&&(y=xt(E.predicates,[u,l,o]),_=xt(E.objects,[l,o,u])),b&&(a._graphs[d]={subjects:b,predicates:y,objects:_}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Vi]&&(this[Vi]=this[Symbol.iterator]());const t=this[Vi];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 ma().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 Bt(this.filtered,e,t,n,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}class Ad extends wa.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;const t=new Yu(e);let n,i;const s={onQuad:(a,o)=>{a&&this.emit("error",a)||o&&this.push(o)},onPrefix:(a,o)=>{this.emit("prefix",a,o)}};e&&e.comments&&(s.onComment=a=>{this.emit("comment",a)}),t.parse({on:(a,o)=>{switch(a){case"data":n=o;break;case"end":i=o;break}}},s),this._transform=(a,o,u)=>{n(a),u()},this._flush=a=>{i(),a()}}import(e){return e.on("data",t=>{this.write(t)}),e.on("end",()=>{this.end()}),e.on("error",t=>{this.emit("error",t)}),this}}const xe="http://www.w3.org/ns/shacl#",$o="http://datashapes.org/dash#",Vt="http://www.w3.org/2001/XMLSchema#",qt="http://www.w3.org/1999/02/22-rdf-syntax-ns#",va="http://www.w3.org/2000/01/rdf-schema#",xa="http://www.w3.org/2004/02/skos/core#",Dd="http://www.w3.org/2002/07/owl#",Od="http://www.w3.org/ns/oa#",Ld="http://purl.org/dc/terms/",jd="http://xmlns.com/foaf/0.1/",gn=Re.namedNode("loaded-shapes"),Et=Re.namedNode("loaded-data"),Ye=Re.namedNode(qt+"type"),ia=Re.namedNode(Ld+"conformsTo"),Fo=Re.namedNode(va+"subClassOf"),Ea=Re.namedNode(Dd+"imports"),Cd=Re.namedNode(xa+"broader"),$d=Re.namedNode(xa+"narrower"),Bn=Re.namedNode(xe+"NodeShape"),Fd=Re.namedNode(xe+"IRI"),Yn=Re.namedNode(xe+"property"),Sa=Re.namedNode(xe+"class"),vn=Re.namedNode(xe+"targetClass"),kd=Re.namedNode(xe+"nodeKind"),Pd=Re.namedNode(Vt+"string");function mn(r,e,t=xe,n){let i="";const s=Md(r,e,t,n);return s&&(i=s.value),i}function Md(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 Bd(r){r.querySelector(".editor")?.focus()}function Nn(r,e){return mn(r,"prefLabel",xa,e)||mn(r,"label",va,e)||mn(r,"name",jd,e)}function cc(r,e,t){const n=[];for(const i of r)n.push({value:i,label:Nn(e.getQuads(i,null,null,null),t),children:[]});return n}function sa(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(Ye,r,s)));e.parent&&dc(r,e.parent,t,n,i)}function Ia(r,e){if(e.shaclIn){const t=e.config.lists[e.shaclIn];return cc(t?.length?t:[],e.config.store,e.config.languages)}else{const t=e.config.store.getSubjects(Ye,r,gn);t.push(...e.config.store.getSubjects(Ye,r,Et)),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:Nn(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,$d,null))n.has(o.id)&&i.set(o.id,a.id);for(const o of e.config.store.getObjects(a,Fo,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(Fo,r,null))s.push(...Ia(a,e));return s}}function aa(r){let e;try{e=new URL(r)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function ko(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 qd(r,{remove:e=!1,ignoreErrors:t=!1}={}){const n={},i=t?()=>!0:(o,u)=>{throw new Error(`${o.value} ${u}`)},s=r.getQuads(null,qt+"rest",qt+"nil",null),a=e?[...s]:[];return s.forEach(o=>{const u=[];let l=!1,c,d;const b=o.graph;let y=o.subject;for(;y&&!l;){const _=r.getQuads(null,null,y,null),E=r.getQuads(y,null,null,null).filter(h=>!h.predicate.equals(Ye));let v,x=null,S=null,m=null;for(let h=0;h<E.length&&!l;h++)v=E[h],v.graph.equals(b)?c?l=i(y,"has non-list arcs out"):v.predicate.value===qt+"first"?x?l=i(y,"has multiple rdf:first arcs"):a.push(x=v):v.predicate.value===qt+"rest"?S?l=i(y,"has multiple rdf:rest arcs"):a.push(S=v):_.length?l=i(y,"can't be subject and object"):(c=v,d="subject"):l=i(y,"not confined to single graph");for(let h=0;h<_.length&&!l;++h)v=_[h],c?l=i(y,"can't have coreferences"):v.predicate.value===qt+"rest"?m?l=i(y,"has incoming rdf:rest arcs"):m=v:(c=v,d="object");x?u.unshift(x.object):l=i(y,"has no list head"),y=m&&m.subject}l?e=!1:c&&(n[c[d].value]=u)}),e&&r.removeQuads(a),n}function hc(r,e,t){const n=document.createElement("div");n.classList.add("shacl-or-constraint");const i=[];if(e instanceof Gt){const s=[];let a=!1;r.length&&(a=t.store.countQuads(r[0],Yn,null,null)>0);for(let l=0;l<r.length;l++)if(a){const c=t.store.getObjects(r[l],Yn,null),d=[];let b="";for(const y of c){const _=new ti(y,e,t);d.push(_),b+=(b.length>1?" / ":"")+_.template.label}s.push(d),i.push({label:b,value:l.toString()})}else{const c=new ti(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:Nn(l,t.languages)||sa(l[0].predicate.value,t.prefixes)+" = "+sa(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(Qn(e.template.clone().merge(s[parseInt(o.value)]),void 0,!0))},n.appendChild(a)}return n}function Ud(r,e,t){if(e instanceof ut){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,Ye,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,vn,o,null).length>0)return s}if(a.predicate.equals(Sa)){for(const o of n)if(a.object.equals(o))return s}}else if(a.predicate.equals(kd)&&a.object.equals(Fd))return s}}return console.error("couldn't resolve sh:or/sh:xone on property for value",e),[]}function Hd(r,e,t){for(const n of r){let i=!1;const s=t.store.getObjects(n,Yn,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 Vd={[`${xe}name`]:(r,e)=>{const t=e;r.name=ko(r.config.languages,r.name,t)},[`${xe}description`]:(r,e)=>{const t=e;r.description=ko(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)},[`${$o}singleLine`]:(r,e)=>{r.singleLine=e.value==="true"},[`${$o}readonly`]:(r,e)=>{r.readonly=e.value==="true"},[`${Od}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(qt+"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)},[Ea.id]:(r,e)=>{r.owlImports.push(e)},[Sa.id]:(r,e)=>{r.class=e;const t=r.config.store.getSubjects(vn,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 Gd{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)Vd[t.predicate.id]?.call(this,this,t.object);if(this.label=this.name?.value||Nn(e,this.config.languages),!this.label&&!this.shaclAnd&&(this.label=this.path?sa(this.path,this.config.prefixes):"unknown"),(this.node||this.shaclAnd)&&(this.node&&this.extendedShapes.push(this.node),this.shaclAnd)){const t=this.config.lists[this.shaclAnd];if(t?.length)for(const 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 Wd=`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 no(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 wi={exports:{}},vi={exports:{}},xi,io;function Be(){if(io)return xi;io=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 xi={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},xi}var Ei={exports:{}},Si,so;function Zu(){return so||(so=1,Si={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"{}"}}}),Si}var Ii,ao;function it(){if(ao)return Ii;ao=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(v,x){if(!v)throw new u.ERR_INTERNAL_ASSERTION(x)}function c(v){let x="",S=v.length;const m=v[0]==="-"?1:0;for(;S>=m+4;S-=3)x=`_${v.slice(S-3,S)}${x}`;return`${v.slice(0,S)}${x}`}function h(v,x,S){if(typeof x=="function")return l(x.length<=S.length,`Code: ${v}; The provided arguments length (${S.length}) does not match the required ones (${x.length}).`),x(...S);const m=(x.match(/%[dfijoOs]/g)||[]).length;return l(m===S.length,`Code: ${v}; The provided arguments length (${S.length}) does not match the required ones (${m}).`),S.length===0?x:r(x,...S)}function b(v,x,S){S||(S=Error);class m extends S{constructor(...g){super(h(v,x,g))}toString(){return`${this.name} [${v}]: ${this.message}`}}Object.defineProperties(m.prototype,{name:{value:S.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${v}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),m.prototype.code=v,m.prototype[i]=!0,u[v]=m}function y(v){const x=o+v.name;return Object.defineProperty(v,"name",{value:x}),v}function _(v,x){if(v&&x&&v!==x){if(Array.isArray(x.errors))return x.errors.push(v),x;const S=new n([x,v],x.message);return S.code=x.code,S}return v||x}class E extends Error{constructor(x="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(x,S),this.code="ABORT_ERR",this.name="AbortError"}}return b("ERR_ASSERTION","%s",Error),b("ERR_INVALID_ARG_TYPE",(v,x,S)=>{l(typeof v=="string","'name' must be a string"),Array.isArray(x)||(x=[x]);let m="The ";v.endsWith(" argument")?m+=`${v} `:m+=`"${v}" ${v.includes(".")?"property":"argument"} `,m+="must be ";const d=[],g=[],N=[];for(const A of x)l(typeof A=="string","All expected entries have to be of type string"),s.includes(A)?d.push(A.toLowerCase()):a.test(A)?g.push(A):(l(A!=="object",'The value "object" should be written as "Object"'),N.push(A));if(g.length>0){const A=d.indexOf("object");A!==-1&&(d.splice(d,A,1),g.push("Object"))}if(d.length>0){switch(d.length){case 1:m+=`of type ${d[0]}`;break;case 2:m+=`one of type ${d[0]} or ${d[1]}`;break;default:{const A=d.pop();m+=`one of type ${d.join(", ")}, or ${A}`}}(g.length>0||N.length>0)&&(m+=" or ")}if(g.length>0){switch(g.length){case 1:m+=`an instance of ${g[0]}`;break;case 2:m+=`an instance of ${g[0]} or ${g[1]}`;break;default:{const A=g.pop();m+=`an instance of ${g.join(", ")}, or ${A}`}}N.length>0&&(m+=" or ")}switch(N.length){case 0:break;case 1:N[0].toLowerCase()!==N[0]&&(m+="an "),m+=`${N[0]}`;break;case 2:m+=`one of ${N[0]} or ${N[1]}`;break;default:{const A=N.pop();m+=`one of ${N.join(", ")}, or ${A}`}}if(S==null)m+=`. Received ${S}`;else if(typeof S=="function"&&S.name)m+=`. Received function ${S.name}`;else if(typeof S=="object"){var j;if((j=S.constructor)!==null&&j!==void 0&&j.name)m+=`. Received an instance of ${S.constructor.name}`;else{const A=e(S,{depth:-1});m+=`. Received ${A}`}}else{let A=e(S,{colors:!1});A.length>25&&(A=`${A.slice(0,25)}...`),m+=`. Received type ${typeof S} (${A})`}return m},TypeError),b("ERR_INVALID_ARG_VALUE",(v,x,S="is invalid")=>{let m=e(x);return m.length>128&&(m=m.slice(0,128)+"..."),`The ${v.includes(".")?"property":"argument"} '${v}' ${S}. Received ${m}`},TypeError),b("ERR_INVALID_RETURN_VALUE",(v,x,S)=>{var m;const d=S!=null&&(m=S.constructor)!==null&&m!==void 0&&m.name?`instance of ${S.constructor.name}`:`type ${typeof S}`;return`Expected ${v} to be returned from the "${x}" function but got ${d}.`},TypeError),b("ERR_MISSING_ARGS",(...v)=>{l(v.length>0,"At least one arg needs to be specified");let x;const S=v.length;switch(v=(Array.isArray(v)?v:[v]).map(m=>`"${m}"`).join(" or "),S){case 1:x+=`The ${v[0]} argument`;break;case 2:x+=`The ${v[0]} and ${v[1]} arguments`;break;default:{const m=v.pop();x+=`The ${v.join(", ")}, and ${m} arguments`}break}return`${x} must be specified`},TypeError),b("ERR_OUT_OF_RANGE",(v,x,S)=>{l(x,'Missing "range" argument');let m;if(Number.isInteger(S)&&Math.abs(S)>2**32)m=c(String(S));else if(typeof S=="bigint"){m=String(S);const d=BigInt(2)**BigInt(32);(S>d||S<-d)&&(m=c(m)),m+="n"}else m=e(S);return`The value of "${v}" is out of range. It must be ${x}. Received ${m}`},RangeError),b("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),b("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),b("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),b("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),b("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),b("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),b("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),b("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),b("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),b("ERR_STREAM_WRITE_AFTER_END","write after end",Error),b("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),Ii={AbortError:E,aggregateTwoErrors:y(_),hideStackFrames:y,codes:u},Ii}var Qr={exports:{}},oo;function vn(){if(oo)return Qr.exports;oo=1;const{AbortController:r,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return Qr.exports=r,Qr.exports.AbortSignal=e,Qr.exports.default=r,Qr.exports}var kn={exports:{}},lo;function ai(){if(lo)return kn.exports;lo=1;var r=typeof Reflect=="object"?Reflect:null,e=r&&typeof r.apply=="function"?r.apply:function(g,N,j){return Function.prototype.apply.call(g,N,j)},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(d){console&&console.warn&&console.warn(d)}var i=Number.isNaN||function(g){return g!==g};function s(){s.init.call(this)}kn.exports=s,kn.exports.once=x,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function o(d){if(typeof d!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof d)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(d){if(typeof d!="number"||d<0||i(d))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+d+".");a=d}}),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(d){return d._maxListeners===void 0?s.defaultMaxListeners:d._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(g){for(var N=[],j=1;j<arguments.length;j++)N.push(arguments[j]);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(N.length>0&&(R=N[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,N);else for(var D=q.length,L=_(q,D),j=0;j<D;++j)e(L[j],this,N);return!0};function l(d,g,N,j){var A,B,R;if(o(N),B=d._events,B===void 0?(B=d._events=Object.create(null),d._eventsCount=0):(B.newListener!==void 0&&(d.emit("newListener",g,N.listener?N.listener:N),B=d._events),R=B[g]),R===void 0)R=B[g]=N,++d._eventsCount;else if(typeof R=="function"?R=B[g]=j?[N,R]:[R,N]:j?R.unshift(N):R.push(N),A=u(d),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=d,F.type=g,F.count=R.length,n(F)}return d}s.prototype.addListener=function(g,N){return l(this,g,N,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(g,N){return l(this,g,N,!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 h(d,g,N){var j={fired:!1,wrapFn:void 0,target:d,type:g,listener:N},A=c.bind(j);return A.listener=N,j.wrapFn=A,A}s.prototype.once=function(g,N){return o(N),this.on(g,h(this,g,N)),this},s.prototype.prependOnceListener=function(g,N){return o(N),this.prependListener(g,h(this,g,N)),this},s.prototype.removeListener=function(g,N){var j,A,B,R,F;if(o(N),A=this._events,A===void 0)return this;if(j=A[g],j===void 0)return this;if(j===N||j.listener===N)--this._eventsCount===0?this._events=Object.create(null):(delete A[g],A.removeListener&&this.emit("removeListener",g,j.listener||N));else if(typeof j!="function"){for(B=-1,R=j.length-1;R>=0;R--)if(j[R]===N||j[R].listener===N){F=j[R].listener,B=R;break}if(B<0)return this;B===0?j.shift():E(j,B),j.length===1&&(A[g]=j[0]),A.removeListener!==void 0&&this.emit("removeListener",g,F||N)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(g){var N,j,A;if(j=this._events,j===void 0)return this;if(j.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):j[g]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete j[g]),this;if(arguments.length===0){var B=Object.keys(j),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(N=j[g],typeof N=="function")this.removeListener(g,N);else if(N!==void 0)for(A=N.length-1;A>=0;A--)this.removeListener(g,N[A]);return this};function b(d,g,N){var j=d._events;if(j===void 0)return[];var A=j[g];return A===void 0?[]:typeof A=="function"?N?[A.listener||A]:[A]:N?v(A):_(A,A.length)}s.prototype.listeners=function(g){return b(this,g,!0)},s.prototype.rawListeners=function(g){return b(this,g,!1)},s.listenerCount=function(d,g){return typeof d.listenerCount=="function"?d.listenerCount(g):y.call(d,g)},s.prototype.listenerCount=y;function y(d){var g=this._events;if(g!==void 0){var N=g[d];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 _(d,g){for(var N=new Array(g),j=0;j<g;++j)N[j]=d[j];return N}function E(d,g){for(;g+1<d.length;g++)d[g]=d[g+1];d.pop()}function v(d){for(var g=new Array(d.length),N=0;N<g.length;++N)g[N]=d[N].listener||d[N];return g}function x(d,g){return new Promise(function(N,j){function A(R){d.removeListener(g,B),j(R)}function B(){typeof d.removeListener=="function"&&d.removeListener("error",A),N([].slice.call(arguments))}m(d,g,B,{once:!0}),g!=="error"&&S(d,A,{once:!0})})}function S(d,g,N){typeof d.on=="function"&&m(d,"error",g,N)}function m(d,g,N,j){if(typeof d.on=="function")j.once?d.once(g,N):d.on(g,N);else if(typeof d.addEventListener=="function")d.addEventListener(g,function A(B){j.once&&d.removeEventListener(g,A),N(B)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof d)}return kn.exports}var uo;function at(){return uo||(uo=1,function(r){const e=jt(),{format:t,inspect:n}=Zu(),{codes:{ERR_INVALID_ARG_TYPE:i}}=it(),{kResistStopPropagation:s,AggregateError:a,SymbolDispose:o}=Be(),u=globalThis.AbortSignal||vn().AbortSignal,l=globalThis.AbortController||vn().AbortController,c=Object.getPrototypeOf(async function(){}).constructor,h=globalThis.Blob||e.Blob,b=typeof h<"u"?function(v){return v instanceof h}:function(v){return!1},y=(E,v)=>{if(E!==void 0&&(E===null||typeof E!="object"||!("aborted"in E)))throw new i(v,"AbortSignal",E)},_=(E,v)=>{if(typeof E!="function")throw new i(v,"Function",E)};r.exports={AggregateError:a,kEmptyObject:Object.freeze({}),once(E){let v=!1;return function(...x){v||(v=!0,E.apply(this,x))}},createDeferredPromise:function(){let E,v;return{promise:new Promise((S,m)=>{E=S,v=m}),resolve:E,reject:v}},promisify(E){return new Promise((v,x)=>{E((S,...m)=>S?x(S):v(...m))})},debuglog(){return function(){}},format:t,inspect:n,types:{isAsyncFunction(E){return E instanceof c},isArrayBufferView(E){return ArrayBuffer.isView(E)}},isBlob:b,deprecate(E,v){return E},addAbortListener:ai().addAbortListener||function(v,x){if(v===void 0)throw new i("signal","AbortSignal",v);y(v,"signal"),_(x,"listener");let S;return v.aborted?queueMicrotask(()=>x()):(v.addEventListener("abort",x,{__proto__:null,once:!0,[s]:!0}),S=()=>{v.removeEventListener("abort",x)}),{__proto__:null,[o](){var m;(m=S)===null||m===void 0||m()}}},AbortSignalAny:u.any||function(v){if(v.length===1)return v[0];const x=new l,S=()=>x.abort();return v.forEach(m=>{y(m,"signals"),m.addEventListener("abort",S,{once:!0})}),x.signal.addEventListener("abort",()=>{v.forEach(m=>m.removeEventListener("abort",S))},{once:!0}),x.signal}},r.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}(Ei)),Ei.exports}var Pn={},Ni,co;function In(){if(co)return Ni;co=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:h,StringPrototypeToUpperCase:b,StringPrototypeTrim:y}=Be(),{hideStackFrames:_,codes:{ERR_SOCKET_BAD_PORT:E,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:x,ERR_OUT_OF_RANGE:S,ERR_UNKNOWN_SIGNAL:m}}=it(),{normalizeEncoding:d}=at(),{isAsyncFunction:g,isArrayBufferView:N}=at().types,j={};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 x(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 v(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)}),L=_((J,ce,ye=-2147483648,le=2147483647)=>{if(typeof J!="number")throw new v(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 v(ce,"number",J);if(!i(J))throw new S(ce,"an integer",J);const le=ye?1:0,Re=4294967295;if(J<le||J>Re)throw new S(ce,`>= ${le} && <= ${Re}`,J)});function T(J,ce){if(typeof J!="string")throw new v(ce,"string",J)}function Z(J,ce,ye=void 0,le){if(typeof J!="number")throw new v(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 Re="must be one of: "+t(n(ye,ze=>typeof ze=="string"?`'${ze}'`:h(ze)),", ");throw new x(ce,J,Re)}});function Y(J,ce){if(typeof J!="boolean")throw new v(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),Re=w(ye,"allowFunction",!1);if(!w(ye,"nullable",!1)&&J===null||!le&&r(J)||typeof J!="object"&&(!Re||typeof J!="function"))throw new v(ce,"Object",J)}),K=_((J,ce)=>{if(J!=null&&typeof J!="object"&&typeof J!="function")throw new v(ce,"a dictionary",J)}),Q=_((J,ce,ye=0)=>{if(!r(J))throw new v(ce,"Array",J);if(J.length<ye){const le=`must be longer than ${ye}`;throw new x(ce,J,le)}});function ue(J,ce){Q(J,ce);for(let ye=0;ye<J.length;ye++)T(J[ye],`${ce}[${ye}]`)}function V(J,ce){Q(J,ce);for(let ye=0;ye<J.length;ye++)Y(J[ye],`${ce}[${ye}]`)}function G(J,ce){Q(J,ce);for(let ye=0;ye<J.length;ye++){const le=J[ye],Re=`${ce}[${ye}]`;if(le==null)throw new v(Re,"AbortSignal",le);fe(le,Re)}}function z(J,ce="signal"){if(T(J,ce),j[J]===void 0)throw j[b(J)]!==void 0?new m(J+" (signals must use all capital letters)"):new m(J)}const U=_((J,ce="buffer")=>{if(!N(J))throw new v(ce,["Buffer","TypedArray","DataView"],J)});function ee(J,ce){const ye=d(ce),le=J.length;if(ye==="hex"&&le%2!==0)throw new x("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"&&y(J).length===0||+J!==+J>>>0||J>65535||J===0&&!ye)throw new E(ce,J,ye);return J|0}const fe=_((J,ce)=>{if(J!==void 0&&(J===null||typeof J!="object"||!("aborted"in J)))throw new v(ce,"AbortSignal",J)}),ge=_((J,ce)=>{if(typeof J!="function")throw new v(ce,"Function",J)}),C=_((J,ce)=>{if(typeof J!="function"||g(J))throw new v(ce,"Function",J)}),W=_((J,ce)=>{if(J!==void 0)throw new v(ce,"undefined",J)});function se(J,ce,ye){if(!e(ye,J))throw new v(ce,`('${t(ye,"|")}')`,J)}const he=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function pe(J,ce){if(typeof J>"u"||!c(he,J))throw new x(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 Re=J[le];pe(Re,"hints"),ye+=Re,le!==ce-1&&(ye+=", ")}return ye}throw new x("hints",J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return Ni={isInt32:A,isUint32:B,parseFileMode:q,validateArray:Q,validateStringArray:ue,validateBooleanArray:V,validateAbortSignalArray:G,validateBoolean:Y,validateBuffer:U,validateDictionary:K,validateEncoding:ee,validateFunction:ge,validateInt32:L,validateInteger:D,validateNumber:Z,validateObject:H,validateOneOf:k,validatePlainFunction:C,validatePort:re,validateSignalName:z,validateString:T,validateUint32:te,validateUndefined:W,validateUnion:se,validateAbortSignal:fe,validateLinkHeaderValue:me},Ni}var Mn={exports:{}},Ri={exports:{}},ho;function pr(){if(ho)return Ri.exports;ho=1;var r=Ri.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(E){if(e===setTimeout)return setTimeout(E,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(E,0);try{return e(E,0)}catch{try{return e.call(null,E,0)}catch{return e.call(this,E,0)}}}function a(E){if(t===clearTimeout)return clearTimeout(E);if((t===i||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(E);try{return t(E)}catch{try{return t.call(null,E)}catch{return t.call(this,E)}}}var o=[],u=!1,l,c=-1;function h(){!u||!l||(u=!1,l.length?o=l.concat(o):c=-1,o.length&&b())}function b(){if(!u){var E=s(h);u=!0;for(var v=o.length;v;){for(l=o,o=[];++c<v;)l&&l[c].run();c=-1,v=o.length}l=null,u=!1,a(E)}}r.nextTick=function(E){var v=new Array(arguments.length-1);if(arguments.length>1)for(var x=1;x<arguments.length;x++)v[x-1]=arguments[x];o.push(new y(E,v)),o.length===1&&!u&&s(b)};function y(E,v){this.fun=E,this.array=v}y.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(E){return[]},r.binding=function(E){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(E){throw new Error("process.chdir is not supported")},r.umask=function(){return 0},Ri.exports}var Ti,fo;function Ct(){if(fo)return Ti;fo=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 h(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 b(w){return!!(w&&typeof w.pipe=="function"&&w._readableState&&typeof w.on=="function"&&typeof w.write=="function")}function y(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&&!y(w)&&typeof w.pipeThrough=="function"&&typeof w.getReader=="function"&&typeof w.cancel=="function")}function E(w){return!!(w&&!y(w)&&typeof w.getWriter=="function"&&typeof w.abort=="function")}function v(w){return!!(w&&!y(w)&&typeof w.readable=="object"&&typeof w.writable=="object")}function x(w){return _(w)||E(w)||v(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 m(w){if(!y(w))return null;const H=w._writableState,K=w._readableState,Q=H||K;return!!(w.destroyed||w[n]||Q!=null&&Q.destroyed)}function d(w){if(!h(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(!h(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 N(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 j(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:m(w)?!1:c(w)&&w.readable&&!j(w)}function B(w){return w&&w[a]!=null?w[a]:typeof w?.writable!="boolean"?null:m(w)?!1:h(w)&&w.writable&&!d(w)}function R(w,H){return y(w)?m(w)?!0:!(H?.readable!==!1&&A(w)||H?.writable!==!1&&B(w)):null}function F(w){var H,K;return y(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 y(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(!y(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"&&L(w)?w._closed:null}function L(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"&&L(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(!y(w))return null;const H=w._writableState,K=w._readableState,Q=H||K;return!Q&&te(w)||!!(Q&&Q.autoDestroy&&Q.emitClose&&Q.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,Q,ue,V,G,z,U,ee,re;return!!(w&&((H=(K=(Q=(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&&Q!==void 0?Q:(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 Ti={isDestroyed:m,kIsDestroyed:n,isDisturbed:k,kIsDisturbed:o,isErrored:Y,kIsErrored:i,isReadable:A,kIsReadable:s,kIsClosedPromise:u,kControllerErrorFunction:l,kIsWritable:a,isClosed:D,isDuplexNodeStream:b,isFinished:R,isIterable:S,isReadableNodeStream:c,isReadableStream:_,isReadableEnded:N,isReadableFinished:j,isReadableErrored:q,isNodeStream:y,isWebStream:x,isWritable:B,isWritableNodeStream:h,isWritableStream:E,isWritableEnded:d,isWritableFinished:g,isWritableErrored:F,isServerRequest:T,isServerResponse:te,willEmitClose:Z,isTransformStream:v},Ti}var po;function zt(){if(po)return Mn.exports;po=1;const r=pr(),{AbortError:e,codes:t}=it(),{ERR_INVALID_ARG_TYPE:n,ERR_STREAM_PREMATURE_CLOSE:i}=t,{kEmptyObject:s,once:a}=at(),{validateAbortSignal:o,validateFunction:u,validateObject:l,validateBoolean:c}=In(),{Promise:h,PromisePrototypeThen:b,SymbolDispose:y}=Be(),{isClosed:_,isReadable:E,isReadableNodeStream:v,isReadableStream:x,isReadableFinished:S,isReadableErrored:m,isWritable:d,isWritableNodeStream:g,isWritableStream:N,isWritableFinished:j,isWritableErrored:A,isNodeStream:B,willEmitClose:R,kIsClosedPromise:F}=Ct();let q;function D(k){return k.setHeader&&typeof k.abort=="function"}const L=()=>{};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),x(k)||N(k))return T(k,Y,w);if(!B(k))throw new n("stream",["ReadableStream","WritableStream","Stream"],k);const Q=(H=Y.readable)!==null&&H!==void 0?H:v(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)&&v(k)===Q&&g(k)===ue,ee=j(k,!1);const re=()=>{ee=!0,k.destroyed&&(U=!1),!(U&&(!k.readable||Q))&&(!Q||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)},C=J=>{w.call(k,J)};let W=_(k);const se=()=>{W=!0;const J=A(k)||m(k);if(J&&typeof J!="boolean")return w.call(k,J);if(Q&&!fe&&v(k,!0)&&!S(k,!1))return w.call(k,new i);if(ue&&!ee&&!j(k,!1))return w.call(k,new i);w.call(k)},he=()=>{W=!0;const J=A(k)||m(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",C),k.on("close",se),W?r.nextTick(se):V!=null&&V.errorEmitted||G!=null&&G.errorEmitted?U||r.nextTick(he):(!Q&&(!U||E(k))&&(ee||d(k)===!1)||!ue&&(!U||d(k))&&(fe||E(k)===!1)||G&&k.req&&k.aborted)&&r.nextTick(he);const me=()=>{w=L,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",C),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||at().addAbortListener;const ce=q(Y.signal,J),ye=w;w=a((...le)=>{ce[y](),ye.apply(k,le)})}}return me}function T(k,Y,w){let H=!1,K=L;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||at().addAbortListener;const ue=q(Y.signal,K),V=w;w=a((...G)=>{ue[y](),V.apply(k,G)})}const Q=(...ue)=>{H||r.nextTick(()=>w.apply(k,ue))};return b(k[F].promise,Q,Q),L}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 h((K,Q)=>{const ue=te(k,Y,V=>{H&&ue(),V?Q(V):K()})})}return Mn.exports=te,Mn.exports.finished=Z,Mn.exports}var Ai,go;function $r(){if(go)return Ai;go=1;const r=pr(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:n}=it(),{Symbol:i}=Be(),{kIsDestroyed:s,isDestroyed:a,isFinished:o,isServerRequest:u}=Ct(),l=i("kDestroy"),c=i("kConstruct");function h(R,F,q){R&&(R.stack,F&&!F.errored&&(F.errored=R),q&&!q.errored&&(q.errored=R))}function b(R,F){const q=this._readableState,D=this._writableState,L=D||q;return D!=null&&D.destroyed||q!=null&&q.destroyed?(typeof F=="function"&&F(),this):(h(R,D,q),D&&(D.destroyed=!0),q&&(q.destroyed=!0),L.constructed?y(this,R,F):this.once(l,function(te){y(this,e(te,R),F)}),this)}function y(R,F,q){let D=!1;function L(te){if(D)return;D=!0;const T=R._readableState,Z=R._writableState;h(te,Z,T),Z&&(Z.closed=!0),T&&(T.closed=!0),typeof q=="function"&&q(te),te?r.nextTick(_,R,te):r.nextTick(E,R)}try{R._destroy(F||null,L)}catch(te){L(te)}}function _(R,F){v(R,F),E(R)}function E(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 v(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 x(){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,L=R._writableState;if(L!=null&&L.destroyed||D!=null&&D.destroyed)return this;D!=null&&D.autoDestroy||L!=null&&L.autoDestroy?R.destroy(F):F&&(F.stack,L&&!L.errored&&(L.errored=F),D&&!D.errored&&(D.errored=F),q?r.nextTick(v,R,F):v(R,F))}function m(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(d,R)}function d(R){let F=!1;function q(D){if(F){S(R,D??new t);return}F=!0;const L=R._readableState,te=R._writableState,T=te||L;L&&(L.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 N(R){return R?.setHeader&&typeof R.abort=="function"}function j(R){R.emit("close")}function A(R,F){R.emit("error",F),r.nextTick(j,R)}function B(R,F){!R||a(R)||(!F&&!o(R)&&(F=new n),u(R)?(R.socket=null,R.destroy(F)):N(R)?R.abort():N(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(j,R),R.destroyed||(R[s]=!0))}return Ai={construct:m,destroyer:B,destroy:b,undestroy:x,errorOrDestroy:S},Ai}var Di,mo;function ya(){if(mo)return Di;mo=1;const{ArrayIsArray:r,ObjectSetPrototypeOf:e}=Be(),{EventEmitter:t}=ai();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(E){s.writable&&s.write(E)===!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",h),o.on("close",b));let c=!1;function h(){c||(c=!0,s.end())}function b(){c||(c=!0,typeof s.destroy=="function"&&s.destroy())}function y(E){_(),t.listenerCount(this,"error")===0&&this.emit("error",E)}i(o,"error",y),i(s,"error",y);function _(){o.removeListener("data",u),s.removeListener("drain",l),o.removeListener("end",h),o.removeListener("close",b),o.removeListener("error",y),s.removeListener("error",y),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 Di={Stream:n,prependListener:i},Di}var Li={exports:{}},yo;function oi(){return yo||(yo=1,function(r){const{SymbolDispose:e}=Be(),{AbortError:t,codes:n}=it(),{isNodeStream:i,isWebStream:s,kControllerErrorFunction:a}=Ct(),o=zt(),{ERR_INVALID_ARG_TYPE:u}=n;let l;const c=(h,b)=>{if(typeof h!="object"||!("aborted"in h))throw new u(b,"AbortSignal",h)};r.exports.addAbortSignal=function(b,y){if(c(b,"signal"),!i(y)&&!s(y))throw new u("stream",["ReadableStream","WritableStream","Stream"],y);return r.exports.addAbortSignalNoValidate(b,y)},r.exports.addAbortSignalNoValidate=function(h,b){if(typeof h!="object"||!("aborted"in h))return b;const y=i(b)?()=>{b.destroy(new t(void 0,{cause:h.reason}))}:()=>{b[a](new t(void 0,{cause:h.reason}))};if(h.aborted)y();else{l=l||at().addAbortListener;const _=l(h,y);o(b,_[e])}return b}}(Li)),Li.exports}var Oi,bo;function Ed(){if(bo)return Oi;bo=1;const{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:n}=Be(),{Buffer:i}=jt(),{inspect:s}=at();return Oi=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 h=l.data;if(o>h.length)u+=h,o-=h.length;else{o===h.length?(u+=h,++c,l.next?this.head=l.next:this.head=this.tail=null):(u+=r(h,0,o),this.head=l,l.data=r(h,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,h=0;do{const b=c.data;if(o>b.length)t(u,b,l-o),o-=b.length;else{o===b.length?(t(u,b,l-o),++h,c.next?this.head=c.next:this.head=this.tail=null):(t(u,new n(b.buffer,b.byteOffset,o),l-o),this.head=c,c.data=b.slice(o));break}++h}while((c=c.next)!==null);return this.length-=h,u}[Symbol.for("nodejs.util.inspect.custom")](o,u){return s(this,{...u,depth:0,customInspect:!1})}},Oi}var ji,_o;function li(){if(_o)return ji;_o=1;const{MathFloor:r,NumberIsInteger:e}=Be(),{validateInteger:t}=In(),{ERR_INVALID_ARG_VALUE:n}=it().codes;let i=16*1024,s=16;function a(c,h,b){return c.highWaterMark!=null?c.highWaterMark:h?c[b]:null}function o(c){return c?s:i}function u(c,h){t(h,"value",0),c?s=h:i=h}function l(c,h,b,y){const _=a(h,y,b);if(_!=null){if(!e(_)||_<0){const E=y?`options.${b}`:"options.highWaterMark";throw new n(E,_)}return r(_)}return o(c.objectMode)}return ji={getHighWaterMark:l,getDefaultHighWaterMark:o,setDefaultHighWaterMark:u},ji}var Ci={},Bn={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var wo;function Sd(){return wo||(wo=1,function(r,e){var t=jt(),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)}}(Bn,Bn.exports)),Bn.exports}var vo;function Id(){if(vo)return Ci;vo=1;var r=Sd().Buffer,e=r.isEncoding||function(x){switch(x=""+x,x&&x.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(x){if(!x)return"utf8";for(var S;;)switch(x){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 x;default:if(S)return;x=(""+x).toLowerCase(),S=!0}}function n(x){var S=t(x);if(typeof S!="string"&&(r.isEncoding===e||!e(x)))throw new Error("Unknown encoding: "+x);return S||x}Ci.StringDecoder=i;function i(x){this.encoding=n(x);var S;switch(this.encoding){case"utf16le":this.text=h,this.end=b,S=4;break;case"utf8":this.fillLast=u,S=4;break;case"base64":this.text=y,this.end=_,S=3;break;default:this.write=E,this.end=v;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(S)}i.prototype.write=function(x){if(x.length===0)return"";var S,m;if(this.lastNeed){if(S=this.fillLast(x),S===void 0)return"";m=this.lastNeed,this.lastNeed=0}else m=0;return m<x.length?S?S+this.text(x,m):this.text(x,m):S||""},i.prototype.end=c,i.prototype.text=l,i.prototype.fillLast=function(x){if(this.lastNeed<=x.length)return x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,x.length),this.lastNeed-=x.length};function s(x){return x<=127?0:x>>5===6?2:x>>4===14?3:x>>3===30?4:x>>6===2?-1:-2}function a(x,S,m){var d=S.length-1;if(d<m)return 0;var g=s(S[d]);return g>=0?(g>0&&(x.lastNeed=g-1),g):--d<m||g===-2?0:(g=s(S[d]),g>=0?(g>0&&(x.lastNeed=g-2),g):--d<m||g===-2?0:(g=s(S[d]),g>=0?(g>0&&(g===2?g=0:x.lastNeed=g-3),g):0))}function o(x,S,m){if((S[0]&192)!==128)return x.lastNeed=0,"�";if(x.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return x.lastNeed=1,"�";if(x.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return x.lastNeed=2,"�"}}function u(x){var S=this.lastTotal-this.lastNeed,m=o(this,x);if(m!==void 0)return m;if(this.lastNeed<=x.length)return x.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,S,0,x.length),this.lastNeed-=x.length}function l(x,S){var m=a(this,x,S);if(!this.lastNeed)return x.toString("utf8",S);this.lastTotal=m;var d=x.length-(m-this.lastNeed);return x.copy(this.lastChar,0,d),x.toString("utf8",S,d)}function c(x){var S=x&&x.length?this.write(x):"";return this.lastNeed?S+"�":S}function h(x,S){if((x.length-S)%2===0){var m=x.toString("utf16le",S);if(m){var d=m.charCodeAt(m.length-1);if(d>=55296&&d<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1],m.slice(0,-1)}return m}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=x[x.length-1],x.toString("utf16le",S,x.length-1)}function b(x){var S=x&&x.length?this.write(x):"";if(this.lastNeed){var m=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,m)}return S}function y(x,S){var m=(x.length-S)%3;return m===0?x.toString("base64",S):(this.lastNeed=3-m,this.lastTotal=3,m===1?this.lastChar[0]=x[x.length-1]:(this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1]),x.toString("base64",S,x.length-m))}function _(x){var S=x&&x.length?this.write(x):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function E(x){return x.toString(this.encoding)}function v(x){return x&&x.length?this.write(x):""}return Ci}var $i,xo;function ec(){if(xo)return $i;xo=1;const r=pr(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:n}=Be(),{Buffer:i}=jt(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_NULL_VALUES:a}=it().codes;function o(u,l,c){let h;if(typeof l=="string"||l instanceof i)return new u({objectMode:!0,...c,read(){this.push(l),this.push(null)}});let b;if(l&&l[t])b=!0,h=l[t]();else if(l&&l[n])b=!1,h=l[n]();else throw new s("iterable",["Iterable"],l);const y=new u({objectMode:!0,highWaterMark:1,...c});let _=!1;y._read=function(){_||(_=!0,v())},y._destroy=function(x,S){e(E(x),()=>r.nextTick(S,x),m=>r.nextTick(S,m||x))};async function E(x){const S=x!=null,m=typeof h.throw=="function";if(S&&m){const{value:d,done:g}=await h.throw(x);if(await d,g)return}if(typeof h.return=="function"){const{value:d}=await h.return();await d}}async function v(){for(;;){try{const{value:x,done:S}=b?await h.next():h.next();if(S)y.push(null);else{const m=x&&typeof x.then=="function"?await x:x;if(m===null)throw _=!1,new a;if(y.push(m))continue;_=!1}}catch(x){y.destroy(x)}break}}return y}return $i=o,$i}var Fi,Eo;function ui(){if(Eo)return Fi;Eo=1;const r=pr(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:n,NumberParseInt:i,ObjectDefineProperties:s,ObjectKeys:a,ObjectSetPrototypeOf:o,Promise:u,SafeSet:l,SymbolAsyncDispose:c,SymbolAsyncIterator:h,Symbol:b}=Be();Fi=le,le.ReadableState=ye;const{EventEmitter:y}=ai(),{Stream:_,prependListener:E}=ya(),{Buffer:v}=jt(),{addAbortSignal:x}=oi(),S=zt();let m=at().debuglog("stream",O=>{m=O});const d=Ed(),g=$r(),{getHighWaterMark:N,getDefaultHighWaterMark:j}=li(),{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:L}=it(),{validateObject:te}=In(),T=b("kPaused"),{StringDecoder:Z}=Id(),k=ec();o(le.prototype,_.prototype),o(le,_);const Y=()=>{},{errorOrDestroy:w}=g,H=1,K=2,Q=4,ue=8,V=16,G=32,z=64,U=128,ee=256,re=512,fe=1024,ge=2048,C=4096,W=8192,se=16384,he=32768,pe=65536,me=1<<17,J=1<<18;function ce(O){return{enumerable:!1,get(){return(this.state&O)!==0},set(M){M?this.state|=O:this.state&=~O}}}s(ye.prototype,{objectMode:ce(H),ended:ce(K),endEmitted:ce(Q),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(C),destroyed:ce(W),closed:ce(se),closeEmitted:ce(he),multiAwaitDrain:ce(pe),readingMore:ce(me),dataEmitted:ce(J)});function ye(O,M,be){typeof be!="boolean"&&(be=M instanceof Lt()),this.state=ge|C|V|G,O&&O.objectMode&&(this.state|=H),be&&O&&O.readableObjectMode&&(this.state|=H),this.highWaterMark=O?N(this,O,"readableHighWaterMark",be):j(!1),this.buffer=new d,this.length=0,this.pipes=[],this.flowing=null,this[T]=null,O&&O.emitClose===!1&&(this.state&=~ge),O&&O.autoDestroy===!1&&(this.state&=~C),this.errored=null,this.defaultEncoding=O&&O.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,O&&O.encoding&&(this.decoder=new Z(O.encoding),this.encoding=O.encoding)}function le(O){if(!(this instanceof le))return new le(O);const M=this instanceof Lt();this._readableState=new ye(O,this,M),O&&(typeof O.read=="function"&&(this._read=O.read),typeof O.destroy=="function"&&(this._destroy=O.destroy),typeof O.construct=="function"&&(this._construct=O.construct),O.signal&&!M&&x(O.signal,this)),_.call(this,O),g.construct(this,()=>{this._readableState.needReadable&&X(this,this._readableState)})}le.prototype.destroy=g.destroy,le.prototype._undestroy=g.undestroy,le.prototype._destroy=function(O,M){M(O)},le.prototype[y.captureRejectionSymbol]=function(O){this.destroy(O)},le.prototype[c]=function(){let O;return this.destroyed||(O=this.readableEnded?null:new L,this.destroy(O)),new u((M,be)=>S(this,_e=>_e&&_e!==O?be(_e):M(null)))},le.prototype.push=function(O,M){return Re(this,O,M,!1)},le.prototype.unshift=function(O,M){return Re(this,O,M,!0)};function Re(O,M,be,_e){m("readableAddChunk",M);const ve=O._readableState;let Qe;if((ve.state&H)===0&&(typeof M=="string"?(be=be||ve.defaultEncoding,ve.encoding!==be&&(_e&&ve.encoding?M=v.from(M,be).toString(ve.encoding):(M=v.from(M,be),be=""))):M instanceof v?be="":_._isUint8Array(M)?(M=_._uint8ArrayToBuffer(M),be=""):M!=null&&(Qe=new B("chunk",["string","Buffer","Uint8Array"],M))),Qe)w(O,Qe);else if(M===null)ve.state&=~ue,f(O,ve);else if((ve.state&H)!==0||M&&M.length>0)if(_e)if((ve.state&Q)!==0)w(O,new D);else{if(ve.destroyed||ve.errored)return!1;ze(O,ve,M,!0)}else if(ve.ended)w(O,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(O,ve,M,!1):X(O,ve)):ze(O,ve,M,!1)}else _e||(ve.state&=~ue,X(O,ve));return!ve.ended&&(ve.length<ve.highWaterMark||ve.length===0)}function ze(O,M,be,_e){M.flowing&&M.length===0&&!M.sync&&O.listenerCount("data")>0?((M.state&pe)!==0?M.awaitDrainWriters.clear():M.awaitDrainWriters=null,M.dataEmitted=!0,O.emit("data",be)):(M.length+=M.objectMode?1:be.length,_e?M.buffer.unshift(be):M.buffer.push(be),(M.state&z)!==0&&p(O)),X(O,M)}le.prototype.isPaused=function(){const O=this._readableState;return O[T]===!0||O.flowing===!1},le.prototype.setEncoding=function(O){const M=new Z(O);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 Ie=1073741824;function Xe(O){if(O>Ie)throw new F("size","<= 1GiB",O);return O--,O|=O>>>1,O|=O>>>2,O|=O>>>4,O|=O>>>8,O|=O>>>16,O++,O}function I(O,M){return O<=0||M.length===0&&M.ended?0:(M.state&H)!==0?1:n(O)?M.flowing&&M.length?M.buffer.first().length:M.length:O<=M.length?O:M.ended?M.length:0}le.prototype.read=function(O){m("read",O),O===void 0?O=NaN:t(O)||(O=i(O,10));const M=this._readableState,be=O;if(O>M.highWaterMark&&(M.highWaterMark=Xe(O)),O!==0&&(M.state&=~U),O===0&&M.needReadable&&((M.highWaterMark!==0?M.length>=M.highWaterMark:M.length>0)||M.ended))return m("read: emitReadable",M.length,M.ended),M.length===0&&M.ended?He(this):p(this),null;if(O=I(O,M),O===0&&M.ended)return M.length===0&&He(this),null;let _e=(M.state&z)!==0;if(m("need readable",_e),(M.length===0||M.length-O<M.highWaterMark)&&(_e=!0,m("length less than watermark",_e)),M.ended||M.reading||M.destroyed||M.errored||!M.constructed)_e=!1,m("reading, ended or constructing",_e);else if(_e){m("do read"),M.state|=ue|G,M.length===0&&(M.state|=z);try{this._read(M.highWaterMark)}catch(Qe){w(this,Qe)}M.state&=~G,M.reading||(O=I(be,M))}let ve;return O>0?ve=qe(O,M):ve=null,ve===null?(M.needReadable=M.length<=M.highWaterMark,O=0):(M.length-=O,M.multiAwaitDrain?M.awaitDrainWriters.clear():M.awaitDrainWriters=null),M.length===0&&(M.ended||(M.needReadable=!0),be!==O&&M.ended&&He(this)),ve!==null&&!M.errorEmitted&&!M.closeEmitted&&(M.dataEmitted=!0,this.emit("data",ve)),ve};function f(O,M){if(m("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(O):(M.needReadable=!1,M.emittedReadable=!0,$(O))}}function p(O){const M=O._readableState;m("emitReadable",M.needReadable,M.emittedReadable),M.needReadable=!1,M.emittedReadable||(m("emitReadable",M.flowing),M.emittedReadable=!0,r.nextTick($,O))}function $(O){const M=O._readableState;m("emitReadable_",M.destroyed,M.length,M.ended),!M.destroyed&&!M.errored&&(M.length||M.ended)&&(O.emit("readable"),M.emittedReadable=!1),M.needReadable=!M.flowing&&!M.ended&&M.length<=M.highWaterMark,De(O)}function X(O,M){!M.readingMore&&M.constructed&&(M.readingMore=!0,r.nextTick(oe,O,M))}function oe(O,M){for(;!M.reading&&!M.ended&&(M.length<M.highWaterMark||M.flowing&&M.length===0);){const be=M.length;if(m("maybeReadMore read 0"),O.read(0),be===M.length)break}M.readingMore=!1}le.prototype._read=function(O){throw new R("_read()")},le.prototype.pipe=function(O,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(O),m("pipe count=%d opts=%j",_e.pipes.length,M);const Qe=(!M||M.end!==!1)&&O!==r.stdout&&O!==r.stderr?Ln:P;_e.endEmitted?r.nextTick(Qe):be.once("end",Qe),O.on("unpipe",Ye);function Ye(ne,ie){m("onunpipe"),ne===be&&ie&&ie.hasUnpiped===!1&&(ie.hasUnpiped=!0,Rt())}function Ln(){m("onend"),O.end()}let Nt,On=!1;function Rt(){m("cleanup"),O.removeListener("close",qr),O.removeListener("finish",We),Nt&&O.removeListener("drain",Nt),O.removeListener("error",yr),O.removeListener("unpipe",Ye),be.removeListener("end",Ln),be.removeListener("end",P),be.removeListener("data",mr),On=!0,Nt&&_e.awaitDrainWriters&&(!O._writableState||O._writableState.needDrain)&&Nt()}function Br(){On||(_e.pipes.length===1&&_e.pipes[0]===O?(m("false write response, pause",0),_e.awaitDrainWriters=O,_e.multiAwaitDrain=!1):_e.pipes.length>1&&_e.pipes.includes(O)&&(m("false write response, pause",_e.awaitDrainWriters.size),_e.awaitDrainWriters.add(O)),be.pause()),Nt||(Nt=de(be,O),O.on("drain",Nt))}be.on("data",mr);function mr(ne){m("ondata");const ie=O.write(ne);m("dest.write",ie),ie===!1&&Br()}function yr(ne){if(m("onerror",ne),P(),O.removeListener("error",yr),O.listenerCount("error")===0){const ie=O._writableState||O._readableState;ie&&!ie.errorEmitted?w(O,ne):O.emit("error",ne)}}E(O,"error",yr);function qr(){O.removeListener("finish",We),P()}O.once("close",qr);function We(){m("onfinish"),O.removeListener("close",qr),P()}O.once("finish",We);function P(){m("unpipe"),be.unpipe(O)}return O.emit("pipe",be),O.writableNeedDrain===!0?Br():_e.flowing||(m("pipe resume"),be.resume()),O};function de(O,M){return function(){const _e=O._readableState;_e.awaitDrainWriters===M?(m("pipeOnDrain",1),_e.awaitDrainWriters=null):_e.multiAwaitDrain&&(m("pipeOnDrain",_e.awaitDrainWriters.size),_e.awaitDrainWriters.delete(M)),(!_e.awaitDrainWriters||_e.awaitDrainWriters.size===0)&&O.listenerCount("data")&&O.resume()}}le.prototype.unpipe=function(O){const M=this._readableState,be={hasUnpiped:!1};if(M.pipes.length===0)return this;if(!O){const ve=M.pipes;M.pipes=[],this.pause();for(let Qe=0;Qe<ve.length;Qe++)ve[Qe].emit("unpipe",this,{hasUnpiped:!1});return this}const _e=e(M.pipes,O);return _e===-1?this:(M.pipes.splice(_e,1),M.pipes.length===0&&this.pause(),O.emit("unpipe",this,be),this)},le.prototype.on=function(O,M){const be=_.prototype.on.call(this,O,M),_e=this._readableState;return O==="data"?(_e.readableListening=this.listenerCount("readable")>0,_e.flowing!==!1&&this.resume()):O==="readable"&&!_e.endEmitted&&!_e.readableListening&&(_e.readableListening=_e.needReadable=!0,_e.flowing=!1,_e.emittedReadable=!1,m("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(O,M){const be=_.prototype.removeListener.call(this,O,M);return O==="readable"&&r.nextTick(Ee,this),be},le.prototype.off=le.prototype.removeListener,le.prototype.removeAllListeners=function(O){const M=_.prototype.removeAllListeners.apply(this,arguments);return(O==="readable"||O===void 0)&&r.nextTick(Ee,this),M};function Ee(O){const M=O._readableState;M.readableListening=O.listenerCount("readable")>0,M.resumeScheduled&&M[T]===!1?M.flowing=!0:O.listenerCount("data")>0?O.resume():M.readableListening||(M.flowing=null)}function ke(O){m("readable nexttick read 0"),O.read(0)}le.prototype.resume=function(){const O=this._readableState;return O.flowing||(m("resume"),O.flowing=!O.readableListening,Le(this,O)),O[T]=!1,this};function Le(O,M){M.resumeScheduled||(M.resumeScheduled=!0,r.nextTick(Oe,O,M))}function Oe(O,M){m("resume",M.reading),M.reading||O.read(0),M.resumeScheduled=!1,O.emit("resume"),De(O),M.flowing&&!M.reading&&O.read(0)}le.prototype.pause=function(){return m("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(m("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[T]=!0,this};function De(O){const M=O._readableState;for(m("flow",M.flowing);M.flowing&&O.read()!==null;);}le.prototype.wrap=function(O){let M=!1;O.on("data",_e=>{!this.push(_e)&&O.pause&&(M=!0,O.pause())}),O.on("end",()=>{this.push(null)}),O.on("error",_e=>{w(this,_e)}),O.on("close",()=>{this.destroy()}),O.on("destroy",()=>{this.destroy()}),this._read=()=>{M&&O.resume&&(M=!1,O.resume())};const be=a(O);for(let _e=1;_e<be.length;_e++){const ve=be[_e];this[ve]===void 0&&typeof O[ve]=="function"&&(this[ve]=O[ve].bind(O))}return this},le.prototype[h]=function(){return yt(this)},le.prototype.iterator=function(O){return O!==void 0&&te(O,"options"),yt(this,O)};function yt(O,M){typeof O.read!="function"&&(O=le.wrap(O,{objectMode:!0}));const be=Pt(O,M);return be.stream=O,be}async function*Pt(O,M){let be=Y;function _e(Ye){this===O?(be(),be=Y):be=Ye}O.on("readable",_e);let ve;const Qe=S(O,{writable:!1},Ye=>{ve=Ye?A(ve,Ye):null,be(),be=Y});try{for(;;){const Ye=O.destroyed?null:O.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||O._readableState.autoDestroy)?g.destroyer(O,null):(O.off("readable",_e),Qe())}}s(le.prototype,{readable:{__proto__:null,get(){const O=this._readableState;return!!O&&O.readable!==!1&&!O.destroyed&&!O.errorEmitted&&!O.endEmitted},set(O){this._readableState&&(this._readableState.readable=!!O)}},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(O){this._readableState&&(this._readableState.flowing=O)}},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(O){this._readableState&&(this._readableState.destroyed=O)}},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(O){this[T]=!!O}}}),le._fromList=qe;function qe(O,M){if(M.length===0)return null;let be;return M.objectMode?be=M.buffer.shift():!O||O>=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(O,M.decoder),be}function He(O){const M=O._readableState;m("endReadable",M.endEmitted),M.endEmitted||(M.ended=!0,r.nextTick(Dn,M,O))}function Dn(O,M){if(m("endReadableNT",O.endEmitted,O.length),!O.errored&&!O.closeEmitted&&!O.endEmitted&&O.length===0){if(O.endEmitted=!0,M.emit("end"),M.writable&&M.allowHalfOpen===!1)r.nextTick(Mt,M);else if(O.autoDestroy){const be=M._writableState;(!be||be.autoDestroy&&(be.finished||be.writable===!1))&&M.destroy()}}}function Mt(O){O.writable&&!O.writableEnded&&!O.destroyed&&O.end()}le.from=function(O,M){return k(le,O,M)};let gr;function Mr(){return gr===void 0&&(gr={}),gr}return le.fromWeb=function(O,M){return Mr().newStreamReadableFromReadableStream(O,M)},le.toWeb=function(O,M){return Mr().newReadableStreamFromStreamReadable(O,M)},le.wrap=function(O,M){var be,_e;return new le({objectMode:(be=(_e=O.readableObjectMode)!==null&&_e!==void 0?_e:O.objectMode)!==null&&be!==void 0?be:!0,...M,destroy(ve,Qe){g.destroyer(O,ve),Qe(ve)}}).wrap(O)},Fi}var ki,So;function ba(){if(So)return ki;So=1;const r=pr(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:n,ObjectDefineProperty:i,ObjectDefineProperties:s,ObjectSetPrototypeOf:a,StringPrototypeToLowerCase:o,Symbol:u,SymbolHasInstance:l}=Be();ki=te,te.WritableState=D;const{EventEmitter:c}=ai(),h=ya().Stream,{Buffer:b}=jt(),y=$r(),{addAbortSignal:_}=oi(),{getHighWaterMark:E,getDefaultHighWaterMark:v}=li(),{ERR_INVALID_ARG_TYPE:x,ERR_METHOD_NOT_IMPLEMENTED:S,ERR_MULTIPLE_CALLBACK:m,ERR_STREAM_CANNOT_PIPE:d,ERR_STREAM_DESTROYED:g,ERR_STREAM_ALREADY_FINISHED:N,ERR_STREAM_NULL_VALUES:j,ERR_STREAM_WRITE_AFTER_END:A,ERR_UNKNOWN_ENCODING:B}=it().codes,{errorOrDestroy:R}=y;a(te.prototype,h.prototype),a(te,h);function F(){}const q=u("kOnFinished");function D(C,W,se){typeof se!="boolean"&&(se=W instanceof Lt()),this.objectMode=!!(C&&C.objectMode),se&&(this.objectMode=this.objectMode||!!(C&&C.writableObjectMode)),this.highWaterMark=C?E(this,C,"writableHighWaterMark",se):v(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const he=!!(C&&C.decodeStrings===!1);this.decodeStrings=!he,this.defaultEncoding=C&&C.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,L(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!C||C.emitClose!==!1,this.autoDestroy=!C||C.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[q]=[]}function L(C){C.buffered=[],C.bufferedIndex=0,C.allBuffers=!0,C.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(C){const W=this instanceof Lt();if(!W&&!n(te,this))return new te(C);this._writableState=new D(C,this,W),C&&(typeof C.write=="function"&&(this._write=C.write),typeof C.writev=="function"&&(this._writev=C.writev),typeof C.destroy=="function"&&(this._destroy=C.destroy),typeof C.final=="function"&&(this._final=C.final),typeof C.construct=="function"&&(this._construct=C.construct),C.signal&&_(C.signal,this)),h.call(this,C),y.construct(this,()=>{const se=this._writableState;se.writing||ue(this,se),U(this,se)})}i(te,l,{__proto__:null,value:function(C){return n(this,C)?!0:this!==te?!1:C&&C._writableState instanceof D}}),te.prototype.pipe=function(){R(this,new d)};function T(C,W,se,he){const pe=C._writableState;if(typeof se=="function")he=se,se=pe.defaultEncoding;else{if(!se)se=pe.defaultEncoding;else if(se!=="buffer"&&!b.isEncoding(se))throw new B(se);typeof he!="function"&&(he=F)}if(W===null)throw new j;if(!pe.objectMode)if(typeof W=="string")pe.decodeStrings!==!1&&(W=b.from(W,se),se="buffer");else if(W instanceof b)se="buffer";else if(h._isUint8Array(W))W=h._uint8ArrayToBuffer(W),se="buffer";else throw new x("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(C,me,!0),me):(pe.pendingcb++,Z(C,pe,W,se,he))}te.prototype.write=function(C,W,se){return T(this,C,W,se)===!0},te.prototype.cork=function(){this._writableState.corked++},te.prototype.uncork=function(){const C=this._writableState;C.corked&&(C.corked--,C.writing||ue(this,C))},te.prototype.setDefaultEncoding=function(W){if(typeof W=="string"&&(W=o(W)),!b.isEncoding(W))throw new B(W);return this._writableState.defaultEncoding=W,this};function Z(C,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,C._write(se,he,W.onwrite),W.sync=!1),J&&!W.errored&&!W.destroyed}function k(C,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?C._writev(pe,W.onwrite):C._write(pe,me,W.onwrite),W.sync=!1}function Y(C,W,se,he){--W.pendingcb,he(se),Q(W),R(C,se)}function w(C,W){const se=C._writableState,he=se.sync,pe=se.writecb;if(typeof pe!="function"){R(C,new m);return}se.writing=!1,se.writecb=null,se.length-=se.writelen,se.writelen=0,W?(W.stack,se.errored||(se.errored=W),C._readableState&&!C._readableState.errored&&(C._readableState.errored=W),he?r.nextTick(Y,C,se,W,pe):Y(C,se,W,pe)):(se.buffered.length>se.bufferedIndex&&ue(C,se),he?se.afterWriteTickInfo!==null&&se.afterWriteTickInfo.cb===pe?se.afterWriteTickInfo.count++:(se.afterWriteTickInfo={count:1,cb:pe,stream:C,state:se},r.nextTick(H,se.afterWriteTickInfo)):K(C,se,1,pe))}function H({stream:C,state:W,count:se,cb:he}){return W.afterWriteTickInfo=null,K(C,W,se,he)}function K(C,W,se,he){for(!W.ending&&!C.destroyed&&W.length===0&&W.needDrain&&(W.needDrain=!1,C.emit("drain"));se-- >0;)W.pendingcb--,he();W.destroyed&&Q(W),U(C,W)}function Q(C){if(C.writing)return;for(let pe=C.bufferedIndex;pe<C.buffered.length;++pe){var W;const{chunk:me,callback:J}=C.buffered[pe],ce=C.objectMode?1:me.length;C.length-=ce,J((W=C.errored)!==null&&W!==void 0?W:new g("write"))}const se=C[q].splice(0);for(let pe=0;pe<se.length;pe++){var he;se[pe]((he=C.errored)!==null&&he!==void 0?he:new g("end"))}L(C)}function ue(C,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&&C._writev){W.pendingcb-=me-1;const ce=W.allNoop?F:le=>{for(let Re=J;Re<se.length;++Re)se[Re].callback(le)},ye=W.allNoop&&J===0?se:e(se,J);ye.allBuffers=W.allBuffers,k(C,W,!0,W.length,ye,"",ce),L(W)}else{do{const{chunk:ce,encoding:ye,callback:le}=se[J];se[J++]=null;const Re=pe?1:ce.length;k(C,W,!1,Re,ce,ye,le)}while(J<se.length&&!W.writing);J===se.length?L(W):J>256?(se.splice(0,J),W.bufferedIndex=0):W.bufferedIndex=J}W.bufferProcessing=!1}te.prototype._write=function(C,W,se){if(this._writev)this._writev([{chunk:C,encoding:W}],se);else throw new S("_write()")},te.prototype._writev=null,te.prototype.end=function(C,W,se){const he=this._writableState;typeof C=="function"?(se=C,C=null,W=null):typeof W=="function"&&(se=W,W=null);let pe;if(C!=null){const me=T(this,C,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 N("end"):he.destroyed&&(pe=new g("end"))),typeof se=="function"&&(pe||he.finished?r.nextTick(se,pe):he[q].push(se)),this};function V(C){return C.ending&&!C.destroyed&&C.constructed&&C.length===0&&!C.errored&&C.buffered.length===0&&!C.finished&&!C.writing&&!C.errorEmitted&&!C.closeEmitted}function G(C,W){let se=!1;function he(pe){if(se){R(C,pe??m());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(C,pe,W.sync)}else V(W)&&(W.prefinished=!0,C.emit("prefinish"),W.pendingcb++,r.nextTick(ee,C,W))}W.sync=!0,W.pendingcb++;try{C._final(he)}catch(pe){he(pe)}W.sync=!1}function z(C,W){!W.prefinished&&!W.finalCalled&&(typeof C._final=="function"&&!W.destroyed?(W.finalCalled=!0,G(C,W)):(W.prefinished=!0,C.emit("prefinish")))}function U(C,W,se){V(W)&&(z(C,W),W.pendingcb===0&&(se?(W.pendingcb++,r.nextTick((he,pe)=>{V(pe)?ee(he,pe):pe.pendingcb--},C,W)):V(W)&&(W.pendingcb++,ee(C,W))))}function ee(C,W){W.pendingcb--,W.finished=!0;const se=W[q].splice(0);for(let he=0;he<se.length;he++)se[he]();if(C.emit("finish"),W.autoDestroy){const he=C._readableState;(!he||he.autoDestroy&&(he.endEmitted||he.readable===!1))&&C.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(C){this._writableState&&(this._writableState.destroyed=C)}},writable:{__proto__:null,get(){const C=this._writableState;return!!C&&C.writable!==!1&&!C.destroyed&&!C.errored&&!C.ending&&!C.ended},set(C){this._writableState&&(this._writableState.writable=!!C)}},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 C=this._writableState;return C?!C.destroyed&&!C.ending&&C.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=y.destroy;te.prototype.destroy=function(C,W){const se=this._writableState;return!se.destroyed&&(se.bufferedIndex<se.buffered.length||se[q].length)&&r.nextTick(Q,se),re.call(this,C,W),this},te.prototype._undestroy=y.undestroy,te.prototype._destroy=function(C,W){W(C)},te.prototype[c.captureRejectionSymbol]=function(C){this.destroy(C)};let fe;function ge(){return fe===void 0&&(fe={}),fe}return te.fromWeb=function(C,W){return ge().newStreamWritableFromWritableStream(C,W)},te.toWeb=function(C){return ge().newWritableStreamFromStreamWritable(C)},ki}var Pi,Io;function Nd(){if(Io)return Pi;Io=1;const r=pr(),e=jt(),{isReadable:t,isWritable:n,isIterable:i,isNodeStream:s,isReadableNodeStream:a,isWritableNodeStream:o,isDuplexNodeStream:u,isReadableStream:l,isWritableStream:c}=Ct(),h=zt(),{AbortError:b,codes:{ERR_INVALID_ARG_TYPE:y,ERR_INVALID_RETURN_VALUE:_}}=it(),{destroyer:E}=$r(),v=Lt(),x=ui(),S=ba(),{createDeferredPromise:m}=at(),d=ec(),g=globalThis.Blob||e.Blob,N=typeof g<"u"?function(D){return D instanceof g}:function(D){return!1},j=globalThis.AbortController||vn().AbortController,{FunctionPrototypeCall:A}=Be();class B extends v{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)}}Pi=function q(D,L){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:x.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 d(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,Q=>{if(Q!=null)throw new _("nully","body",Q)},Q=>{E(H,Q)});return H=new B({objectMode:!0,readable:!1,write:Z,final(Q){k(async()=>{try{await K,r.nextTick(Q,null)}catch(ue){r.nextTick(Q,ue)}})},destroy:Y})}throw new _("Iterable, AsyncIterable or AsyncFunction",L,T)}if(N(D))return q(D.arrayBuffer());if(i(D))return d(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=>{E(T,Z)}),T=new B({objectMode:!0,writable:!1,read(){}})}throw new y(L,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],D)};function R(q){let{promise:D,resolve:L}=m();const te=new j,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 b(void 0,{cause:T.reason});({promise:D,resolve:L}=m()),yield Y}}(),{signal:T}),write(k,Y,w){const H=L;L=null,H({chunk:k,done:!1,cb:w})},final(k){const Y=L;L=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"?x.wrap(q.readable):q.readable,L=q.writable;let te=!!t(D),T=!!n(L),Z,k,Y,w,H;function K(Q){const ue=w;w=null,ue?ue(Q):Q&&H.destroy(Q)}return H=new B({readableObjectMode:!!(D!=null&&D.readableObjectMode),writableObjectMode:!!(L!=null&&L.writableObjectMode),readable:te,writable:T}),T&&(h(L,Q=>{T=!1,Q&&E(D,Q),K(Q)}),H._write=function(Q,ue,V){L.write(Q,ue)?V():Z=V},H._final=function(Q){L.end(),k=Q},L.on("drain",function(){if(Z){const Q=Z;Z=null,Q()}}),L.on("finish",function(){if(k){const Q=k;k=null,Q()}})),te&&(h(D,Q=>{te=!1,Q&&E(D,Q),K(Q)}),D.on("readable",function(){if(Y){const Q=Y;Y=null,Q()}}),D.on("end",function(){H.push(null)}),H._read=function(){for(;;){const Q=D.read();if(Q===null){Y=H._read;return}if(!H.push(Q))return}}),H._destroy=function(Q,ue){!Q&&w!==null&&(Q=new b),Y=null,Z=null,k=null,w===null?ue(Q):(w=ue,E(L,Q),E(D,Q))},H}return Pi}var Mi,No;function Lt(){if(No)return Mi;No=1;const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:n}=Be();Mi=a;const i=ui(),s=ba();n(a.prototype,i.prototype),n(a,i);{const c=t(s.prototype);for(let h=0;h<c.length;h++){const b=c[h];a.prototype[b]||(a.prototype[b]=s.prototype[b])}}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,h){return u().newStreamDuplexFromReadableWritablePair(c,h)},a.toWeb=function(c){return u().newReadableWritablePairFromDuplex(c)};let l;return a.from=function(c){return l||(l=Nd()),l(c,"body")},Mi}var Bi,Ro;function tc(){if(Ro)return Bi;Ro=1;const{ObjectSetPrototypeOf:r,Symbol:e}=Be();Bi=a;const{ERR_METHOD_NOT_IMPLEMENTED:t}=it().codes,n=Lt(),{getHighWaterMark:i}=li();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,h)=>{if(c){l?l(c):this.destroy(c);return}h!=null&&this.push(h),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,h){throw new t("_transform()")},a.prototype._write=function(l,c,h){const b=this._readableState,y=this._writableState,_=b.length;this._transform(l,c,(E,v)=>{if(E){h(E);return}v!=null&&this.push(v),y.ended||_===b.length||b.length<b.highWaterMark?h():this[s]=h})},a.prototype._read=function(){if(this[s]){const l=this[s];this[s]=null,l()}},Bi}var qi,To;function rc(){if(To)return qi;To=1;const{ObjectSetPrototypeOf:r}=Be();qi=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)},qi}var Ui,Ao;function _a(){if(Ao)return Ui;Ao=1;const r=pr(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:n,SymbolDispose:i}=Be(),s=zt(),{once:a}=at(),o=$r(),u=Lt(),{aggregateTwoErrors:l,codes:{ERR_INVALID_ARG_TYPE:c,ERR_INVALID_RETURN_VALUE:h,ERR_MISSING_ARGS:b,ERR_STREAM_DESTROYED:y,ERR_STREAM_PREMATURE_CLOSE:_},AbortError:E}=it(),{validateFunction:v,validateAbortSignal:x}=In(),{isIterable:S,isReadable:m,isReadableNodeStream:d,isNodeStream:g,isTransformStream:N,isWebStream:j,isReadableStream:A,isReadableFinished:B}=Ct(),R=globalThis.AbortController||vn().AbortController;let F,q,D;function L(Q,ue,V){let G=!1;Q.on("close",()=>{G=!0});const z=s(Q,{readable:ue,writable:V},U=>{G=!U});return{destroy:U=>{G||(G=!0,o.destroyer(Q,U||new y("pipe")))},cleanup:z}}function te(Q){return v(Q[Q.length-1],"streams[stream.length - 1]"),Q.pop()}function T(Q){if(S(Q))return Q;if(d(Q))return Z(Q);throw new c("val",["Readable","Iterable","AsyncIterable"],Q)}async function*Z(Q){q||(q=ui()),yield*q.prototype[n].call(Q)}async function k(Q,ue,V,{end:G}){let z,U=null;const ee=ge=>{if(ge&&(z=ge),U){const C=U;U=null,C()}},re=()=>new t((ge,C)=>{z?C(z):U=()=>{z?C(z):ge()}});ue.on("drain",ee);const fe=s(ue,{readable:!1},ee);try{ue.writableNeedDrain&&await re();for await(const ge of Q)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(Q,ue,V,{end:G}){N(ue)&&(ue=ue.writable);const z=ue.getWriter();try{for await(const U of Q)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(...Q){return H(Q,a(te(Q)))}function H(Q,ue,V){if(Q.length===1&&e(Q[0])&&(Q=Q[0]),Q.length<2)throw new b("streams");const G=new R,z=G.signal,U=V?.signal,ee=[];x(U,"options.signal");function re(){pe(new E)}D=D||at().addAbortListener;let fe;U&&(fe=D(U,re));let ge,C;const W=[];let se=0;function he(ye){pe(ye,--se===0)}function pe(ye,le){var Re;if(ye&&(!ge||ge.code==="ERR_STREAM_PREMATURE_CLOSE")&&(ge=ye),!(!ge&&!le)){for(;W.length;)W.shift()(ge);(Re=fe)===null||Re===void 0||Re[i](),G.abort(),le&&(ge||ee.forEach(ze=>ze()),r.nextTick(ue,ge,C))}}let me;for(let ye=0;ye<Q.length;ye++){const le=Q[ye],Re=ye<Q.length-1,ze=ye>0,Ie=Re||V?.end!==!1,Xe=ye===Q.length-1;if(g(le)){let I=function(f){f&&f.name!=="AbortError"&&f.code!=="ERR_STREAM_PREMATURE_CLOSE"&&he(f)};if(Ie){const{destroy:f,cleanup:p}=L(le,Re,ze);W.push(f),m(le)&&Xe&&ee.push(p)}le.on("error",I),m(le)&&Xe&&ee.push(()=>{le.removeListener("error",I)})}if(ye===0)if(typeof le=="function"){if(me=le({signal:z}),!S(me))throw new h("Iterable, AsyncIterable or Stream","source",me)}else S(le)||d(le)||N(le)?me=le:me=u.from(le);else if(typeof le=="function"){if(N(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}),Re){if(!S(me,!0))throw new h("AsyncIterable",`transform[${ye-1}]`,me)}else{var ce;F||(F=rc());const I=new F({objectMode:!0}),f=(ce=me)===null||ce===void 0?void 0:ce.then;if(typeof f=="function")se++,f.call(me,X=>{C=X,X!=null&&I.write(X),Ie&&I.end(),r.nextTick(he)},X=>{I.destroy(X),r.nextTick(he,X)});else if(S(me,!0))se++,k(me,I,he,{end:Ie});else if(A(me)||N(me)){const X=me.readable||me;se++,k(X,I,he,{end:Ie})}else throw new h("AsyncIterable or Promise","destination",me);me=I;const{destroy:p,cleanup:$}=L(me,!1,!0);W.push(p),Xe&&ee.push($)}}else if(g(le)){if(d(me)){se+=2;const I=K(me,le,he,{end:Ie});m(le)&&Xe&&ee.push(I)}else if(N(me)||A(me)){const I=me.readable||me;se++,k(I,le,he,{end:Ie})}else if(S(me))se++,k(me,le,he,{end:Ie});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else if(j(le)){if(d(me))se++,Y(T(me),le,he,{end:Ie});else if(A(me)||S(me))se++,Y(me,le,he,{end:Ie});else if(N(me))se++,Y(me.readable,le,he,{end:Ie});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(Q,ue,V,{end:G}){let z=!1;if(ue.on("close",()=>{z||V(new _)}),Q.pipe(ue,{end:!1}),G){let U=function(){z=!0,ue.end()};B(Q)?r.nextTick(U):Q.once("end",U)}else V();return s(Q,{readable:!0,writable:!1},U=>{const ee=Q._readableState;U&&U.code==="ERR_STREAM_PREMATURE_CLOSE"&&ee&&ee.ended&&!ee.errored&&!ee.errorEmitted?Q.once("end",V).once("error",V):V(U)}),s(ue,{readable:!1,writable:!0},V)}return Ui={pipelineImpl:H,pipeline:w},Ui}var Hi,Do;function nc(){if(Do)return Hi;Do=1;const{pipeline:r}=_a(),e=Lt(),{destroyer:t}=$r(),{isNodeStream:n,isReadable:i,isWritable:s,isWebStream:a,isTransformStream:o,isWritableStream:u,isReadableStream:l}=Ct(),{AbortError:c,codes:{ERR_INVALID_ARG_VALUE:h,ERR_MISSING_ARGS:b}}=it(),y=zt();return Hi=function(...E){if(E.length===0)throw new b("streams");if(E.length===1)return e.from(E[0]);const v=[...E];if(typeof E[0]=="function"&&(E[0]=e.from(E[0])),typeof E[E.length-1]=="function"){const F=E.length-1;E[F]=e.from(E[F])}for(let F=0;F<E.length;++F)if(!(!n(E[F])&&!a(E[F]))){if(F<E.length-1&&!(i(E[F])||l(E[F])||o(E[F])))throw new h(`streams[${F}]`,v[F],"must be readable");if(F>0&&!(s(E[F])||u(E[F])||o(E[F])))throw new h(`streams[${F}]`,v[F],"must be writable")}let x,S,m,d,g;function N(F){const q=d;d=null,q?q(F):F?g.destroy(F):!R&&!B&&g.destroy()}const j=E[0],A=r(E,N),B=!!(s(j)||u(j)||o(j)),R=!!(i(A)||l(A)||o(A));if(g=new e({writableObjectMode:!!(j!=null&&j.writableObjectMode),readableObjectMode:!!(A!=null&&A.readableObjectMode),writable:B,readable:R}),B){if(n(j))g._write=function(q,D,L){j.write(q,D)?L():x=L},g._final=function(q){j.end(),S=q},j.on("drain",function(){if(x){const q=x;x=null,q()}});else if(a(j)){const D=(o(j)?j.writable:j).getWriter();g._write=async function(L,te,T){try{await D.ready,D.write(L).catch(()=>{}),T()}catch(Z){T(Z)}},g._final=async function(L){try{await D.ready,D.close().catch(()=>{}),S=L}catch(te){L(te)}}}const F=o(A)?A.readable:A;y(F,()=>{if(S){const q=S;S=null,q()}})}if(R){if(n(A))A.on("readable",function(){if(m){const F=m;m=null,F()}}),A.on("end",function(){g.push(null)}),g._read=function(){for(;;){const F=A.read();if(F===null){m=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:L}=await q.read();if(!g.push(D))return;if(L){g.push(null);return}}catch{return}}}}return g._destroy=function(F,q){!F&&d!==null&&(F=new c),m=null,x=null,S=null,d===null?q(F):(d=q,n(A)&&t(A,F))},g},Hi}var Lo;function Rd(){if(Lo)return Pn;Lo=1;const r=globalThis.AbortController||vn().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:n,ERR_OUT_OF_RANGE:i},AbortError:s}=it(),{validateAbortSignal:a,validateInteger:o,validateObject:u}=In(),l=Be().Symbol("kWeak"),c=Be().Symbol("kResistStopPropagation"),{finished:h}=zt(),b=nc(),{addAbortSignalNoValidate:y}=oi(),{isWritable:_,isNodeStream:E}=Ct(),{deprecate:v}=at(),{ArrayPrototypePush:x,Boolean:S,MathFloor:m,Number:d,NumberIsNaN:g,Promise:N,PromiseReject:j,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"),E(U)&&!_(U))throw new e("stream",U,"must be writable");const re=b(this,U);return ee!=null&&ee.signal&&y(ee.signal,re),re}function L(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=m(ee.concurrency));let fe=re-1;return ee?.highWaterMark!=null&&(fe=m(ee.highWaterMark)),o(re,"options.concurrency",1),o(fe,"options.highWaterMark",0),fe+=re,(async function*(){const C=at().AbortSignalAny([ee?.signal].filter(S)),W=this,se=[],he={signal:C};let pe,me,J=!1,ce=0;function ye(){J=!0,le()}function le(){ce-=1,Re()}function Re(){me&&!J&&ce<re&&se.length<fe&&(me(),me=null)}async function ze(){try{for await(let Ie of W){if(J)return;if(C.aborted)throw new s;try{if(Ie=U(Ie,he),Ie===F)continue;Ie=A(Ie)}catch(Xe){Ie=j(Xe)}ce+=1,B(Ie,le,ye),se.push(Ie),pe&&(pe(),pe=null),!J&&(se.length>=fe||ce>=re)&&await new N(Xe=>{me=Xe})}se.push(q)}catch(Ie){const Xe=j(Ie);B(Xe,le,ye),se.push(Xe)}finally{J=!0,pe&&(pe(),pe=null)}}ze();try{for(;;){for(;se.length>0;){const Ie=await se[0];if(Ie===q)return;if(C.aborted)throw new s;Ie!==F&&(yield Ie),se.shift(),Re()}await new N(Ie=>{pe=Ie})}}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 L.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 L.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 h(this.destroy(pe)),pe}const C=new r,W=C.signal;if(re!=null&&re.signal){const pe={once:!0,[l]:this,[c]:!0};re.signal.addEventListener("abort",()=>C.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{C.abort()}return ee}async function Q(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});x(ee,fe)}return ee}function ue(U,ee){const re=L.call(this,U,ee);return(async function*(){for await(const ge of re)yield*ge}).call(this)}function V(U){if(U=d(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 C of this){var ge;if(ee!=null&&(ge=ee.signal)!==null&&ge!==void 0&&ge.aborted)throw new s;U--<=0&&(yield C)}}).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 C of this){var ge;if(ee!=null&&(ge=ee.signal)!==null&&ge!==void 0&&ge.aborted)throw new s;if(U-- >0&&(yield C),U<=0)return}}).call(this)}return Pn.streamReturningOperators={asIndexedPairs:v(te,"readable.asIndexedPairs will be removed in a future version."),drop:G,filter:w,flatMap:ue,map:L,take:z,compose:D},Pn.promiseReturningOperators={every:Z,forEach:Y,reduce:K,toArray:Q,some:T,find:k},Pn}var Vi,Oo;function ic(){if(Oo)return Vi;Oo=1;const{ArrayPrototypePop:r,Promise:e}=Be(),{isIterable:t,isNodeStream:n,isWebStream:i}=Ct(),{pipelineImpl:s}=_a(),{finished:a}=zt();sc();function o(...u){return new e((l,c)=>{let h,b;const y=u[u.length-1];if(y&&typeof y=="object"&&!n(y)&&!t(y)&&!i(y)){const _=r(u);h=_.signal,b=_.end}s(u,(_,E)=>{_?c(_):l(E)},{signal:h,end:b})})}return Vi={finished:a,pipeline:o},Vi}var jo;function sc(){if(jo)return vi.exports;jo=1;const{Buffer:r}=jt(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:n}=Be(),{promisify:{custom:i}}=at(),{streamReturningOperators:s,promiseReturningOperators:a}=Rd(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:o}}=it(),u=nc(),{setDefaultHighWaterMark:l,getDefaultHighWaterMark:c}=li(),{pipeline:h}=_a(),{destroyer:b}=$r(),y=zt(),_=ic(),E=Ct(),v=vi.exports=ya().Stream;v.isDestroyed=E.isDestroyed,v.isDisturbed=E.isDisturbed,v.isErrored=E.isErrored,v.isReadable=E.isReadable,v.isWritable=E.isWritable,v.Readable=ui();for(const S of t(s)){let d=function(...g){if(new.target)throw o();return v.Readable.from(n(m,this,g))};const m=s[S];e(d,"name",{__proto__:null,value:m.name}),e(d,"length",{__proto__:null,value:m.length}),e(v.Readable.prototype,S,{__proto__:null,value:d,enumerable:!1,configurable:!0,writable:!0})}for(const S of t(a)){let d=function(...g){if(new.target)throw o();return n(m,this,g)};const m=a[S];e(d,"name",{__proto__:null,value:m.name}),e(d,"length",{__proto__:null,value:m.length}),e(v.Readable.prototype,S,{__proto__:null,value:d,enumerable:!1,configurable:!0,writable:!0})}v.Writable=ba(),v.Duplex=Lt(),v.Transform=tc(),v.PassThrough=rc(),v.pipeline=h;const{addAbortSignal:x}=oi();return v.addAbortSignal=x,v.finished=y,v.destroy=b,v.compose=u,v.setDefaultHighWaterMark=l,v.getDefaultHighWaterMark=c,e(v,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return _}}),e(h,i,{__proto__:null,enumerable:!0,get(){return _.pipeline}}),e(y,i,{__proto__:null,enumerable:!0,get(){return _.finished}}),v.Stream=v,v._isUint8Array=function(m){return m instanceof Uint8Array},v._uint8ArrayToBuffer=function(m){return r.from(m.buffer,m.byteOffset,m.byteLength)},vi.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}(wi)),wi.exports}var wa=ac();const Gi=Symbol("iter");function mn(r,e,t=4){if(t===0)return Object.assign(r,e);for(const n in e)r[n]=mn(r[n]||Object.create(null),e[n],t-1);return r}function oc(r,e,t=4){let n=!1;for(const i in r)if(i in e){const s=t===0?null:oc(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 lc(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:mn({},r[i],t-1);else if(t!==0){const s=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}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||Ne}_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 hn(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&&(ia(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${t}.${n}.${i}.${s}`:`.${t}.${n}.${i}`]}return this._ids[Ir(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${ia(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Ir(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||Ne,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,h;const b=this._entities,y=this._termFromId(b[u]),_={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const E in e)if(c=e[E]){_[s]=this._termFromId(b[E]),n&&((l=c,c={})[n]=l[n]);for(const v in c)if(h=c[v]){_[a]=this._termFromId(b[v]);const x=i?i in h?[i]:[]:Object.keys(h);for(let S=0;S<x.length;S++)_[o]=this._termFromId(b[x[S]]),yield this._factory.quad(_.subject,_.predicate,_.object,y)}}}_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 wa.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 qt(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 h in s)(o=s[h])&&(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,h;const b=o.graph;let y=o.subject;for(;y&&!l;){const _=this.getQuads(null,null,y,null),E=this.getQuads(y,null,null,null);let v,x=null,S=null,m=null;for(let d=0;d<E.length&&!l;d++)v=E[d],v.graph.equals(b)?c?l=i(y,"has non-list arcs out"):v.predicate.value===Ke.rdf.first?x?l=i(y,"has multiple rdf:first arcs"):a.push(x=v):v.predicate.value===Ke.rdf.rest?S?l=i(y,"has multiple rdf:rest arcs"):a.push(S=v):_.length?l=i(y,"can't be subject and object"):(c=v,h="subject"):l=i(y,"not confined to single graph");for(let d=0;d<_.length&&!l;++d)v=_[d],c?l=i(y,"can't have coreferences"):v.predicate.value===Ke.rdf.rest?m?l=i(y,"has incoming rdf:rest arcs"):m=v:(c=v,h="object");x?u.unshift(x.object):l=i(y,"has no list head"),y=m&&m.subject}l?e=!1:c&&(n[c[h].value]=u)}),e&&this.removeQuads(a),n}addAll(e){if(e instanceof qt&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof et&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=mn(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof qt&&(e=e.filtered),e===this)return!0;if(!(e instanceof et)||this._entityIndex!==e._entityIndex)return e.every(l=>this.has(l));const t=this._graphs,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 h in o=s[c]){if(!(u=a[h]))return!1;for(const b in o[h])if(!(b 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 qt&&(e=e.filtered),e===this)return new et({entityIndex:this._entityIndex});if(e instanceof et&&e._entityIndex===this._entityIndex){const t=new et({entityIndex:this._entityIndex}),n=lc(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 qt&&(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 qt&&(e=e.filtered),e===this){const t=new et({entityIndex:this._entityIndex});return t._graphs=mn(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=oc(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 ma().quadsToString(this)}union(e){const t=new et({entityIndex:this._entityIndex});return t._graphs=mn(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function Et(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:Et(r[s],e,t+1);a!==!1&&(i=i||Object.create(null),i[s]=a)}return i}class qt extends wa.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 h in c){let b,y,_,E;(E=c[h])&&(!o&&u?(y=Et(E.predicates,[u,l,o]))&&(b=Et(E.subjects,[o,u,l]),_=Et(E.objects,[l,o,u])):l?(_=Et(E.objects,[l,o,u]))&&(b=Et(E.subjects,[o,u,l]),y=Et(E.predicates,[u,l,o])):(b=Et(E.subjects,[o,u,l]))&&(y=Et(E.predicates,[u,l,o]),_=Et(E.objects,[l,o,u])),b&&(a._graphs[h]={subjects:b,predicates:y,objects:_}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Gi]&&(this[Gi]=this[Symbol.iterator]());const t=this[Gi];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 ma().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 qt(this.filtered,e,t,n,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}class Ad extends wa.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;const t=new Ku(e);let n,i;const s={onQuad:(a,o)=>{a&&this.emit("error",a)||o&&this.push(o)},onPrefix:(a,o)=>{this.emit("prefix",a,o)}};e&&e.comments&&(s.onComment=a=>{this.emit("comment",a)}),t.parse({on:(a,o)=>{switch(a){case"data":n=o;break;case"end":i=o;break}}},s),this._transform=(a,o,u)=>{n(a),u()},this._flush=a=>{i(),a()}}import(e){return e.on("data",t=>{this.write(t)}),e.on("end",()=>{this.end()}),e.on("error",t=>{this.emit("error",t)}),this}}const xe="http://www.w3.org/ns/shacl#",$o="http://datashapes.org/dash#",Gt="http://www.w3.org/2001/XMLSchema#",Ut="http://www.w3.org/1999/02/22-rdf-syntax-ns#",va="http://www.w3.org/2000/01/rdf-schema#",xa="http://www.w3.org/2004/02/skos/core#",Dd="http://www.w3.org/2002/07/owl#",Ld="http://www.w3.org/ns/oa#",Od="http://purl.org/dc/terms/",jd="http://xmlns.com/foaf/0.1/",Nr=Ne.namedNode("loaded-shapes"),Dt=Ne.namedNode("loaded-data"),tt=Ne.namedNode(Ut+"type"),sa=Ne.namedNode(Od+"conformsTo"),Fo=Ne.namedNode(va+"subClassOf"),Ea=Ne.namedNode(Dd+"imports"),Cd=Ne.namedNode(xa+"broader"),$d=Ne.namedNode(xa+"narrower"),qn=Ne.namedNode(xe+"NodeShape"),Fd=Ne.namedNode(xe+"IRI"),Yn=Ne.namedNode(xe+"property"),Sa=Ne.namedNode(xe+"class"),uc=Ne.namedNode(xe+"node"),Rr=Ne.namedNode(xe+"targetClass"),kd=Ne.namedNode(xe+"nodeKind"),Pd=Ne.namedNode(Gt+"string");function yn(r,e,t=xe,n){let i="";const s=Md(r,e,t,n);return s&&(i=s.value),i}function Md(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 Bd(r){r.querySelector(".editor")?.focus()}function Nn(r,e){return yn(r,"prefLabel",xa,e)||yn(r,"label",va,e)||yn(r,"name",jd,e)}function cc(r,e,t){const n=[];for(const i of r)n.push({value:i,label:Nn(e.getQuads(i,null,null,null),t),children:[]});return n}function aa(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 Ia(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,Nr);t.push(...e.config.store.getSubjects(tt,r,Dt)),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:Nn(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,$d,null))n.has(o.id)&&i.set(o.id,a.id);for(const o of e.config.store.getObjects(a,Fo,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(Fo,r,null))s.push(...Ia(a,e));return s}}function oa(r){let e;try{e=new URL(r)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function ko(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 qd(r,{remove:e=!1,ignoreErrors:t=!1}={}){const n={},i=t?()=>!0:(o,u)=>{throw new Error(`${o.value} ${u}`)},s=r.getQuads(null,Ut+"rest",Ut+"nil",null),a=e?[...s]:[];return s.forEach(o=>{const u=[];let l=!1,c,h;const b=o.graph;let y=o.subject;for(;y&&!l;){const _=r.getQuads(null,null,y,null),E=r.getQuads(y,null,null,null).filter(d=>!d.predicate.equals(tt));let v,x=null,S=null,m=null;for(let d=0;d<E.length&&!l;d++)v=E[d],v.graph.equals(b)?c?l=i(y,"has non-list arcs out"):v.predicate.value===Ut+"first"?x?l=i(y,"has multiple rdf:first arcs"):a.push(x=v):v.predicate.value===Ut+"rest"?S?l=i(y,"has multiple rdf:rest arcs"):a.push(S=v):_.length?l=i(y,"can't be subject and object"):(c=v,h="subject"):l=i(y,"not confined to single graph");for(let d=0;d<_.length&&!l;++d)v=_[d],c?l=i(y,"can't have coreferences"):v.predicate.value===Ut+"rest"?m?l=i(y,"has incoming rdf:rest arcs"):m=v:(c=v,h="object");x?u.unshift(x.object):l=i(y,"has no list head"),y=m&&m.subject}l?e=!1:c&&(n[c[h].value]=u)}),e&&r.removeQuads(a),n}function hc(r,e,t){const n=document.createElement("div");n.classList.add("shacl-or-constraint");const i=[];if(e instanceof Wt){const s=[];let a=!1;r.length&&(a=t.store.countQuads(r[0],Yn,null,null)>0);for(let l=0;l<r.length;l++)if(a){const c=t.store.getObjects(r[l],Yn,null),h=[];let b="";for(const y of c){const _=new ti(y,e,t);h.push(_),b+=(b.length>1?" / ":"")+_.template.label}s.push(h),i.push({label:b,value:l.toString()})}else{const c=new ti(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 h=1;h<l.length;h++)c.after(l[h]),c=l[h]}},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:Nn(l,t.languages)||aa(l[0].predicate.value,t.prefixes)+" = "+aa(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(Qn(e.template.clone().merge(s[parseInt(o.value)]),void 0,!0))},n.appendChild(a)}return n}function Ud(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,Rr,o,null).length>0)return s}if(a.predicate.equals(Sa)){for(const o of n)if(a.object.equals(o))return s}}else if(a.predicate.equals(kd)&&a.object.equals(Fd))return s}}return console.error("couldn't resolve sh:or/sh:xone on property for value",e),[]}function Hd(r,e,t){for(const n of r){let i=!1;const s=t.store.getObjects(n,Yn,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 Vd={[`${xe}name`]:(r,e)=>{const t=e;r.name=ko(r.config.languages,r.name,t)},[`${xe}description`]:(r,e)=>{const t=e;r.description=ko(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)},[`${$o}singleLine`]:(r,e)=>{r.singleLine=e.value==="true"},[`${$o}readonly`]:(r,e)=>{r.readonly=e.value==="true"},[`${Ld}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=Ne.namedNode(Ut+"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)},[Ea.id]:(r,e)=>{r.owlImports.push(e)},[Sa.id]:(r,e)=>{r.class=e;const t=r.config.store.getSubjects(Rr,e,null);t.length>0&&(r.node=t[0])},[`${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 Gd{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)Vd[t.predicate.id]?.call(this,this,t.object);if(this.label=this.name?.value||Nn(e,this.config.languages),!this.label&&!this.shaclAnd&&(this.label=this.path?aa(this.path,this.config.prefixes):"unknown"),(this.node||this.shaclAnd)&&(this.node&&this.extendedShapes.push(this.node),this.shaclAnd)){const t=this.config.lists[this.shaclAnd];if(t?.length)for(const 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 Wd=`form { display:block; --label-width: 8em; --caret-size: 10px; }
|
|
28
28
|
form.mode-edit { padding-left: 1em; }
|
|
29
29
|
form, form * { box-sizing: border-box; }
|
|
30
30
|
shacl-node, .collapsible::part(content) { display: flex; flex-direction: column; width: 100%; position: relative; }
|
|
@@ -73,25 +73,25 @@ a, a:visited { color: inherit; }
|
|
|
73
73
|
.ref-link { cursor: pointer; }
|
|
74
74
|
.ref-link:hover { text-decoration: underline; }
|
|
75
75
|
.node-id-display { color: #999; font-size: 11px; }`;class zd{constructor(e){let t=Wd;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 ii){const l=n.config.store.getQuads(a,null,null,null);if(l.length){const c=Nn(l,n.config.languages);c&&(a=c)}}else t instanceof
|
|
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 ii){const l=n.config.store.getQuads(a,null,null,null);if(l.length){const c=Nn(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===`${Gt}date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`${Gt}dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let u;return oa(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 Qd(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,Ia(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===`${Ut}langString`||r.languageIn?.length)return r.config.theme.createLangStringEditor(r.label,e,n,r);switch(r.datatype?.value.replace(Gt,"")){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 Xd(r,e,t){if(e==="application/ld+json")return Jd(r);{const n=new ma({format:e,prefixes:t});n.addQuads(r);let i="";return n.end((s,a)=>{s&&console.error(s),i=a}),i}}function Jd(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!==`${Gt}#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 Kd(r){let e=r.shaclDatatype,t=r.value;if(t){if(r.dataset.class||r.dataset.nodeKind===xe+"IRI")return Ne.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=Ne.namedNode(n[1]))}return Ne.literal(t,e)}else if((r.type==="checkbox"||r.getAttribute("type")==="checkbox")&&(r.checked||parseInt(r.dataset.minCount||"0")>0))return Ne.literal(r.checked?"true":"false",e)}const bn={};function Yd(r){r.predicate===void 0&&r.datatype===void 0?console.warn('not registering plugin because it does neither define "predicate" nor "datatype"',r):bn[`${r.predicate}^${r.datatype}`]=r}function Zd(){return Object.entries(bn).map(r=>r[1])}function eh(r,e){let t=bn[`${r}^${e}`];return t||(t=bn[`${r}^undefined`],t)?t:bn[`undefined^${e}`]}class gy{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 Gn=globalThis,Na=Gn.ShadowRoot&&(Gn.ShadyCSS===void 0||Gn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ra=Symbol(),Po=new WeakMap;let fc=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Ra)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=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 th=r=>new fc(typeof r=="string"?r:r+"",void 0,Ra),
|
|
80
|
+
*/const Gn=globalThis,Na=Gn.ShadowRoot&&(Gn.ShadyCSS===void 0||Gn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ra=Symbol(),Po=new WeakMap;let fc=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Ra)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=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 th=r=>new fc(typeof r=="string"?r:r+"",void 0,Ra),St=(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,Ra)},rh=(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=Gn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Mo=Na?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return th(t)})(r):r;/**
|
|
81
81
|
* @license
|
|
82
82
|
* Copyright 2017 Google LLC
|
|
83
83
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
84
|
-
*/const{is:nh,defineProperty:ih,getOwnPropertyDescriptor:sh,getOwnPropertyNames:ah,getOwnPropertySymbols:oh,getPrototypeOf:lh}=Object,ci=globalThis,Bo=ci.trustedTypes,uh=Bo?Bo.emptyScript:"",ch=ci.reactiveElementPolyfillSupport,
|
|
84
|
+
*/const{is:nh,defineProperty:ih,getOwnPropertyDescriptor:sh,getOwnPropertyNames:ah,getOwnPropertySymbols:oh,getPrototypeOf:lh}=Object,ci=globalThis,Bo=ci.trustedTypes,uh=Bo?Bo.emptyScript:"",ch=ci.reactiveElementPolyfillSupport,_n=(r,e)=>r,la={toAttribute(r,e){switch(e){case Boolean:r=r?uh: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)=>!nh(r,e),qo={attribute:!0,type:String,converter:la,reflect:!1,useDefault:!1,hasChanged:pc};Symbol.metadata??=Symbol("metadata"),ci.litPropertyMetadata??=new WeakMap;let vr=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=qo){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&&ih(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=sh(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)??qo}static _$Ei(){if(this.hasOwnProperty(_n("elementProperties")))return;const e=lh(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(_n("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(_n("properties"))){const t=this.properties,n=[...ah(t),...oh(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(Mo(i))}else e!==void 0&&t.push(Mo(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 rh(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:la).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:la;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){}};vr.elementStyles=[],vr.shadowRootOptions={mode:"open"},vr[_n("elementProperties")]=new Map,vr[_n("finalized")]=new Map,ch?.({ReactiveElement:vr}),(ci.reactiveElementVersions??=[]).push("2.1.1");/**
|
|
85
85
|
* @license
|
|
86
86
|
* Copyright 2017 Google LLC
|
|
87
87
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
88
|
-
*/const Ta=globalThis,Zn=Ta.trustedTypes,Uo=Zn?Zn.createPolicy("lit-html",{createHTML:r=>r}):void 0,gc="$lit$",
|
|
89
|
-
\f\r]`,
|
|
90
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Go=/'/g,Wo=/"/g,yc=/^(?:script|style|textarea|title)$/i,fh=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),
|
|
88
|
+
*/const Ta=globalThis,Zn=Ta.trustedTypes,Uo=Zn?Zn.createPolicy("lit-html",{createHTML:r=>r}):void 0,gc="$lit$",Ht=`lit$${Math.random().toFixed(9).slice(2)}$`,mc="?"+Ht,dh=`<${mc}>`,ur=document,xn=()=>ur.createComment(""),En=r=>r===null||typeof r!="object"&&typeof r!="function",Aa=Array.isArray,hh=r=>Aa(r)||typeof r?.[Symbol.iterator]=="function",Wi=`[
|
|
89
|
+
\f\r]`,Xr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ho=/-->/g,Vo=/>/g,Kt=RegExp(`>|${Wi}(?:([^\\s"'>=/]+)(${Wi}*=${Wi}*(?:[^
|
|
90
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Go=/'/g,Wo=/"/g,yc=/^(?:script|style|textarea|title)$/i,fh=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),dt=fh(1),Tr=Symbol.for("lit-noChange"),Ve=Symbol.for("lit-nothing"),zo=new WeakMap,or=ur.createTreeWalker(ur,129);function bc(r,e){if(!Aa(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Uo!==void 0?Uo.createHTML(e):e}const ph=(r,e)=>{const t=r.length-1,n=[];let i,s=e===2?"<svg>":e===3?"<math>":"",a=Xr;for(let o=0;o<t;o++){const u=r[o];let l,c,h=-1,b=0;for(;b<u.length&&(a.lastIndex=b,c=a.exec(u),c!==null);)b=a.lastIndex,a===Xr?c[1]==="!--"?a=Ho:c[1]!==void 0?a=Vo:c[2]!==void 0?(yc.test(c[2])&&(i=RegExp("</"+c[2],"g")),a=Kt):c[3]!==void 0&&(a=Kt):a===Kt?c[0]===">"?(a=i??Xr,h=-1):c[1]===void 0?h=-2:(h=a.lastIndex-c[2].length,l=c[1],a=c[3]===void 0?Kt:c[3]==='"'?Wo:Go):a===Wo||a===Go?a=Kt:a===Ho||a===Vo?a=Xr:(a=Kt,i=void 0);const y=a===Kt&&r[o+1].startsWith("/>")?" ":"";s+=a===Xr?u+dh:h>=0?(n.push(l),u.slice(0,h)+gc+u.slice(h)+Ht+y):u+Ht+(h===-2?o:y)}return[bc(r,s+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};let ua=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]=ph(e,t);if(this.el=_c.createElement(l,n),or.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=or.nextNode())!==null&&u.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const h of i.getAttributeNames())if(h.endsWith(gc)){const b=c[a++],y=i.getAttribute(h).split(Ht),_=/([.?@])?(.*)/.exec(b);u.push({type:1,index:s,name:_[2],strings:y,ctor:_[1]==="."?mh:_[1]==="?"?yh:_[1]==="@"?bh:di}),i.removeAttribute(h)}else h.startsWith(Ht)&&(u.push({type:6,index:s}),i.removeAttribute(h));if(yc.test(i.tagName)){const h=i.textContent.split(Ht),b=h.length-1;if(b>0){i.textContent=Zn?Zn.emptyScript:"";for(let y=0;y<b;y++)i.append(h[y],xn()),or.nextNode(),u.push({type:2,index:++s});i.append(h[b],xn())}}}else if(i.nodeType===8)if(i.data===mc)u.push({type:2,index:s});else{let h=-1;for(;(h=i.data.indexOf(Ht,h+1))!==-1;)u.push({type:7,index:s}),h+=Ht.length-1}s++}}static createElement(e,t){const n=ur.createElement("template");return n.innerHTML=e,n}};function Ar(r,e,t=r,n){if(e===Tr)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl;const s=En(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=Ar(r,i._$AS(r,e.values),i,n)),e}let gh=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??ur).importNode(t,!0);or.currentNode=i;let s=or.nextNode(),a=0,o=0,u=n[0];for(;u!==void 0;){if(a===u.index){let l;u.type===2?l=new Da(s,s.nextSibling,this,e):u.type===1?l=new u.ctor(s,u.name,u.strings,this,e):u.type===6&&(l=new _h(s,this,e)),this._$AV.push(l),u=n[++o]}a!==u?.index&&(s=or.nextNode(),a++)}return or.currentNode=ur,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++}},Da=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=Ar(this,e,t),En(e)?e===Ve||e==null||e===""?(this._$AH!==Ve&&this._$AR(),this._$AH=Ve):e!==this._$AH&&e!==Tr&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):hh(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&&En(this._$AH)?this._$AA.nextSibling.data=e:this.T(ur.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=ua.createElement(bc(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{const s=new gh(i,this),a=s.u(this.options);s.p(t),this.T(a),this._$AH=s}}_$AC(e){let t=zo.get(e.strings);return t===void 0&&zo.set(e.strings,t=new ua(e)),t}k(e){Aa(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(xn()),this.O(xn()),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))}},di=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=Ar(this,e,t,0),a=!En(e)||e!==this._$AH&&e!==Tr,a&&(this._$AH=e);else{const o=e;let u,l;for(e=s[0],u=0;u<s.length-1;u++)l=Ar(this,o[n+u],t,u),l===Tr&&(l=this._$AH[u]),a||=!En(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??"")}},mh=class extends di{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ve?void 0:e}};class yh extends di{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Ve)}}let bh=class extends di{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=Ar(this,e,t,0)??Ve)===Tr)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)}},_h=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){Ar(this,e)}};const wh=Ta.litHtmlPolyfillSupport;wh?.(ua,Da),(Ta.litHtmlVersions??=[]).push("3.3.1");const vh=(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 Da(e.insertBefore(xn(),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 Oa=globalThis;class ar extends wr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=vh(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ir}}ar._$litElement$=!0,ar.finalized=!0,Oa.litElementHydrateSupport?.({LitElement:ar});const xh=Oa.litElementPolyfillSupport;xh?.({LitElement:ar});(Oa.litElementVersions??=[]).push("4.2.1");var vc=r=>{throw TypeError(r)},xc=(r,e,t)=>e.has(r)||vc("Cannot "+t),Mt=(r,e,t)=>(xc(r,e,"read from private field"),t?t.call(r):e.get(r)),Eh=(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),Sh=(r,e,t,n)=>(xc(r,e,"write to private field"),e.set(r,t),t);const hr=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)},Wn=globalThis,La=Wn.ShadowRoot&&(Wn.ShadyCSS===void 0||Wn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ec=Symbol(),Qo=new WeakMap;let Ih=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(La&&r===void 0){const t=e!==void 0&&e.length===1;t&&(r=Qo.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Qo.set(e,r))}return r}toString(){return this.cssText}};const Nh=r=>new Ih(typeof r=="string"?r:r+"",void 0,Ec),Rh=(r,e)=>{if(La)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=Wn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Xo=La?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return Nh(t)})(r):r,{is:Th,defineProperty:Ah,getOwnPropertyDescriptor:Dh,getOwnPropertyNames:Oh,getOwnPropertySymbols:Lh,getPrototypeOf:jh}=Object,Rr=globalThis,Jo=Rr.trustedTypes,Ch=Jo?Jo.emptyScript:"",Ko=Rr.reactiveElementPolyfillSupport,_n=(r,e)=>r,ei={toAttribute(r,e){switch(e){case Boolean:r=r?Ch: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}},ja=(r,e)=>!Th(r,e),Yo={attribute:!0,type:String,converter:ei,reflect:!1,useDefault:!1,hasChanged:ja};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Rr.litPropertyMetadata??(Rr.litPropertyMetadata=new WeakMap);class Qr 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=Yo){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&&Ah(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=Dh(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)??Yo}static _$Ei(){if(this.hasOwnProperty(_n("elementProperties")))return;const e=jh(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(_n("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(_n("properties"))){const t=this.properties,n=[...Oh(t),...Lh(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 Rh(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:ei).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:ei;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??ja)(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){}}Qr.elementStyles=[],Qr.shadowRootOptions={mode:"open"},Qr[_n("elementProperties")]=new Map,Qr[_n("finalized")]=new Map,Ko?.({ReactiveElement:Qr}),(Rr.reactiveElementVersions??(Rr.reactiveElementVersions=[])).push("2.1.0");const $h={attribute:!0,type:String,converter:ei,reflect:!1,hasChanged:ja},Fh=(r=$h,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"?Fh(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 kh=(r,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(r,e,t),t);function _t(r,e){return(t,n,i)=>{const s=a=>{var o;return((o=a.renderRoot)==null?void 0:o.querySelector(r))??null};return kh(t,n,{get(){return s(this)}})}}var Ph=Object.defineProperty,zt=(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&&Ph(e,t,i),i};const ua=class extends ar{constructor(){super(...arguments),this.dense=!1}};ua.shadowRootOptions={...ar.shadowRootOptions,delegatesFocus:!0},ua.styles=[Ct`
|
|
94
|
+
*/const La=globalThis;class lr extends vr{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=vh(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Tr}}lr._$litElement$=!0,lr.finalized=!0,La.litElementHydrateSupport?.({LitElement:lr});const xh=La.litElementPolyfillSupport;xh?.({LitElement:lr});(La.litElementVersions??=[]).push("4.2.1");var vc=r=>{throw TypeError(r)},xc=(r,e,t)=>e.has(r)||vc("Cannot "+t),Bt=(r,e,t)=>(xc(r,e,"read from private field"),t?t.call(r):e.get(r)),Eh=(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),Sh=(r,e,t,n)=>(xc(r,e,"write to private field"),e.set(r,t),t);const Qt=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)},Wn=globalThis,Oa=Wn.ShadowRoot&&(Wn.ShadyCSS===void 0||Wn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ec=Symbol(),Qo=new WeakMap;let Ih=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=Qo.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Qo.set(e,r))}return r}toString(){return this.cssText}};const Nh=r=>new Ih(typeof r=="string"?r:r+"",void 0,Ec),Rh=(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=Wn.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 Nh(t)})(r):r,{is:Th,defineProperty:Ah,getOwnPropertyDescriptor:Dh,getOwnPropertyNames:Lh,getOwnPropertySymbols:Oh,getPrototypeOf:jh}=Object,hi=globalThis,Jo=hi.trustedTypes,Ch=Jo?Jo.emptyScript:"",$h=hi.reactiveElementPolyfillSupport,wn=(r,e)=>r,ei={toAttribute(r,e){switch(e){case Boolean:r=r?Ch: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}},ja=(r,e)=>!Th(r,e),Ko={attribute:!0,type:String,converter:ei,reflect:!1,useDefault:!1,hasChanged:ja};Symbol.metadata??=Symbol("metadata"),hi.litPropertyMetadata??=new WeakMap;class Jr extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=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&&Ah(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=Dh(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(wn("elementProperties")))return;const e=jh(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(wn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(wn("properties"))){const t=this.properties,n=[...Lh(t),...Oh(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(){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 Rh(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:ei).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:ei;this._$Em=i,this[i]=a.fromAttribute(t,s.type)??this._$Ej?.get(i)??null,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??ja)(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){}}Jr.elementStyles=[],Jr.shadowRootOptions={mode:"open"},Jr[wn("elementProperties")]=new Map,Jr[wn("finalized")]=new Map,$h?.({ReactiveElement:Jr}),(hi.reactiveElementVersions??=[]).push("2.1.0");const Fh={attribute:!0,type:String,converter:ei,reflect:!1,hasChanged:ja},kh=(r=Fh,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 Se(r){return(e,t)=>typeof t=="object"?kh(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 Se({...r,state:!0,attribute:!1})}const Ph=(r,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(r,e,t),t);function pt(r,e){return(t,n,i)=>{const s=a=>a.renderRoot?.querySelector(r)??null;return Ph(t,n,{get(){return s(this)}})}}var Mh=Object.defineProperty,Xt=(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&&Mh(e,t,i),i};const ca=class extends lr{constructor(){super(...arguments),this.dense=!1}};ca.shadowRootOptions={...lr.shadowRootOptions,delegatesFocus:!0},ca.styles=[St`
|
|
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
|
|
117
|
+
`];let $t=ca;Xt([Se({type:Boolean,reflect:!0})],$t.prototype,"dense");var bt;const da=class extends $t{constructor(){super(),Eh(this,bt),this.value="",this.clearable=!1,this.required=!1,this.disabled=!1,Sh(this,bt,this.attachInternals())}checkValidity(){return Bt(this,bt).checkValidity()}reportValidity(){const e=Bt(this,bt).reportValidity();return this.classList.toggle("invalid",!e),e}get validity(){return Bt(this,bt).validity}get validationMessage(){return Bt(this,bt).validationMessage}setCustomValidity(e,t){e?Bt(this,bt).setValidity({customError:!0},e,t):Bt(this,bt).setValidity(void 0)}updateValidity(e,t,n){Bt(this,bt).setValidity(e,t,n)}setFormValue(e,t){Bt(this,bt).setFormValue(e,t)}};bt=new WeakMap,da.formAssociated=!0,da.styles=[...$t.styles,St`
|
|
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
|
|
121
|
+
`];let vt=da;Xt([Se()],vt.prototype,"name");Xt([Se()],vt.prototype,"value");Xt([Se({type:Boolean})],vt.prototype,"clearable");Xt([Se({type:Boolean})],vt.prototype,"required");Xt([Se({type:Boolean})],vt.prototype,"disabled");Xt([Se()],vt.prototype,"label");Xt([Se()],vt.prototype,"placeholder");function Bh(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 qh=Object.defineProperty,Uh=Object.getOwnPropertyDescriptor,Sc=(r,e,t,n)=>{for(var i=n>1?void 0:n?Uh(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&&qh(e,t,i),i};let Dr=class extends $t{constructor(){super(...arguments),this.icon=!1}render(){return dt`<a part="link"><slot><slot></a>`}};Dr.styles=[...$t.styles,St`
|
|
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
|
-
`];Sc([
|
|
133
|
+
`];Sc([Se({type:Boolean,reflect:!0})],Dr.prototype,"icon",2);Dr=Sc([Qt("rokit-button")],Dr);var Hh=Object.defineProperty,Vh=Object.getOwnPropertyDescriptor,Ft=(r,e,t,n)=>{for(var i=n>1?void 0:n?Vh(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&&Hh(e,t,i),i};let nt=class extends $t{constructor(){super(...arguments),this.open=!1,this.disabled=!1,this.transitioning=!1,this.closedBeforeTransition=!1,this.onMouseDown=(()=>{this.closedBeforeTransition=!this.open&&!this.transitioning}).bind(this),this.onClick=(()=>{this.toggle(this.closedBeforeTransition,!0)}).bind(this)}firstUpdated(){this.transitionDuration=Bh(getComputedStyle(this).getPropertyValue("--rokit-transition-duration-inner")),new IntersectionObserver(r=>{r.length&&r[0].isIntersecting&&this.updateContentHeight()}).observe(this)}updated(r){r.has("transitioning")&&this.classList.toggle("transitioning",this.transitioning),r.has("disabled")&&(this.disabled?(this.header.removeEventListener("mousedown",this.onMouseDown),this.header.removeEventListener("click",this.onClick)):(this.header.addEventListener("mousedown",this.onMouseDown),this.header.addEventListener("click",this.onClick))),r.has("open")&&!this.disabled&&(this.transitioning||this.toggle(this.open))}updateContentHeight(){setTimeout(()=>{this.content.style.maxHeight=(this.maxHeight!==void 0?Math.min(this.maxHeight,this.content.scrollHeight):this.content.scrollHeight)+"px",this.classList.toggle("has-content",this.content.style.maxHeight!=="0px")})}onSlotChange(){const r=this.shadowRoot.querySelector("#content > slot").assignedNodes(),e=new MutationObserver(()=>this.updateContentHeight());for(const t of r)e.observe(t,{subtree:!0,childList:!0,characterData:!0});this.updateContentHeight()}toggle(r=!this.open,e=!1){this.disabled||(this.transitioning=!0,this.open=r,this.toggleButton.classList.toggle("down",r),setTimeout(()=>{this.transitioning=!1,this.open&&e&&this.content.scrollIntoView({block:"nearest"})},this.transitionDuration))}render(){return dt`
|
|
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
|
-
`}};
|
|
144
|
+
`}};nt.styles=[...$t.styles,St`
|
|
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; }
|
|
@@ -150,20 +150,20 @@ a, a:visited { color: inherit; }
|
|
|
150
150
|
:host(:not([open])) #content, :host(.transitioning) #content { overflow: hidden !important; }
|
|
151
151
|
:host([open]) #content, :host(.transitioning) #content { padding-top: 4px; }
|
|
152
152
|
header { display: flex; align-items: center; padding: 6px 8px; background-color: var(--rokit-light-background-color-inner); user-select: none; }
|
|
153
|
-
.label { flex-grow: 1; }
|
|
153
|
+
.label { flex-grow: 1; overflow: hidden; }
|
|
154
154
|
#content { display: flex; transition: max-height var(--rokit-transition-duration-inner) ease-in-out; position: relative; scrollbar-width: thin; }
|
|
155
155
|
#toggle { margin-left: 3px; }
|
|
156
|
-
`]
|
|
156
|
+
`];Ft([Se({type:Boolean,reflect:!0})],nt.prototype,"open",2);Ft([Se()],nt.prototype,"label",2);Ft([Se({reflect:!0})],nt.prototype,"maxHeight",2);Ft([Se({type:Boolean})],nt.prototype,"disabled",2);Ft([pt("#content")],nt.prototype,"content",2);Ft([pt("#toggle")],nt.prototype,"toggleButton",2);Ft([pt("header")],nt.prototype,"header",2);Ft([Ca()],nt.prototype,"transitioning",2);nt=Ft([Qt("rokit-collapsible")],nt);var Gh=Object.defineProperty,Wh=Object.getOwnPropertyDescriptor,Ic=r=>{throw TypeError(r)},lt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Wh(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&&Gh(e,t,i),i},Nc=(r,e,t)=>e.has(r)||Ic("Cannot "+t),zh=(r,e,t)=>(Nc(r,e,"read from private field"),e.get(r)),Qh=(r,e,t)=>e.has(r)?Ic("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Yo=(r,e,t,n)=>(Nc(r,e,"write to private field"),e.set(r,t),t),pn;let Ue=class extends vt{constructor(){super(),this.type="text",this.readonly=!1,this.sticky=!1,this.minWidth=80,this.autoGrowLabelWidth=!1,Qh(this,pn,""),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,pn,this.value),this.inputElement.addEventListener("change",()=>{this.value=this.inputElement.value}),this.autoGrowLabelWidth&&new IntersectionObserver(r=>{r.length&&r[0].isIntersecting&&this.updateMinWidth()}).observe(this)}updateMinWidth(){const r=this.shadowRoot.querySelector(".wrapper");if(r){const e=this.shadowRoot?.querySelector("label")?.scrollWidth||0,t=this.minWidth>e?this.minWidth:e;r.style.minWidth=t>0?t+"px":""}}updated(r){r.has("label")&&(this.classList.toggle("has-label",this.label!==void 0),this.autoGrowLabelWidth&&this.updateMinWidth()),r.has("min")&&(this.inputElement.min=this.min||""),r.has("max")&&(this.inputElement.max=this.max||""),r.has("step")&&(this.inputElement.step=this.step||""),r.has("placeholder")&&(this.inputElement.placeholder=this.placeholder||""),r.has("pattern")&&(this.inputElement.pattern=this.pattern||""),r.has("minLength")&&(this.inputElement.minLength=this.minLength===void 0?-1:this.minLength),r.has("maxLength")&&(this.inputElement.maxLength=this.maxLength===void 0?-1:this.maxLength),r.has("value")&&(this.classList.toggle("has-value",this.value!==""),this.setFormValue(this.value),this.updateValidity(this.inputElement.validity,this.inputElement.validationMessage,this.inputElement),this.value!==zh(this,pn)&&(Yo(this,pn,this.value),this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))))}clear(){this.inputElement.value="",this.value="",this.blur()}renderInput(){return dt`<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 dt`
|
|
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?
|
|
161
|
+
${this.clearable?dt`
|
|
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
163
|
`:Ve}
|
|
164
164
|
</div>
|
|
165
165
|
<slot name="suffix" part="suffix"></slot>
|
|
166
|
-
`}};
|
|
166
|
+
`}};pn=new WeakMap;Ue.styles=[...vt.styles,St`
|
|
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
|
-
`];
|
|
180
|
+
`];lt([Se()],Ue.prototype,"type",2);lt([Se({type:Boolean,reflect:!0})],Ue.prototype,"readonly",2);lt([Se({type:Boolean,reflect:!0})],Ue.prototype,"sticky",2);lt([Se()],Ue.prototype,"pattern",2);lt([Se()],Ue.prototype,"minLength",2);lt([Se()],Ue.prototype,"maxLength",2);lt([Se()],Ue.prototype,"min",2);lt([Se()],Ue.prototype,"max",2);lt([Se()],Ue.prototype,"step",2);lt([Se()],Ue.prototype,"minWidth",2);lt([Se({type:Boolean})],Ue.prototype,"autoGrowLabelWidth",2);lt([pt("#input")],Ue.prototype,"inputElement",2);Ue=lt([Qt("rokit-input")],Ue);var Xh=Object.defineProperty,Jh=Object.getOwnPropertyDescriptor,Rc=r=>{throw TypeError(r)},rt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Jh(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},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),Un=(r,e,t,n)=>(Tc(r,e,"write to private field"),e.set(r,t),t),xr,zn;let Ge=class extends vt{constructor(){super(),this.emptyMessage="Nothing to select",this.collapsibleOrientationLeft="0",this.collapsibleOrientationRight="0",this.collapsibleWidth="",this.autoGrowLabelWidth=!1,this.collapse=!1,this.filterableThreshold=15,this.itemCount=0,el(this,xr,""),el(this,zn,""),this.addEventListener("focus",()=>{this.collapsible.toggle(!0)}),this.addEventListener("blur",()=>{this.checkInputValue(),this.collapsible.toggle(!1)}),this.addEventListener("input",()=>{this.collapsible.toggle(!0)})}firstUpdated(){Un(this,xr,this.value),Un(this,zn,getComputedStyle(this).getPropertyValue("--rokit-list-indent-inner")),this.input.placeholder=this.placeholder===void 0?"Type to filter list...":this.placeholder,this.input.label=this.label,this.inputMinWidth!==void 0&&(this.input.minWidth=this.inputMinWidth),setTimeout(()=>{this.collapsible.maxHeight=parseInt(this.collapsibleMaxHeight!==void 0?this.collapsibleMaxHeight:getComputedStyle(this).getPropertyValue("--rokit-list-max-height-inner")),this.collapsible.content.style.width=this.collapsibleWidth,this.collapsible.content.style.left=this.collapsibleOrientationLeft,this.collapsible.content.style.right=this.collapsibleOrientationRight})}updated(r){if(r.has("selectedItem")){const e=this.value;this.value=this.selectedItem?this.itemValue(this.selectedItem):"",this.input.value=this.selectedItem?this.itemText(this.selectedItem):this.value,this.input.title=this.input.value,this.classList.toggle("has-value",this.value!==""),this.setFormValue(this.value),this.required&&this.value===""?this.updateValidity({valueMissing:!0},"Please select a value",this.listContainer):this.updateValidity(),e!==this.value&&this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}r.has("value")&&this.selectItem(this.findItem(this.value)),r.has("disabled")&&(this.input.disabled=this.disabled,this.collapsible.disabled=this.disabled),(r.has("filterableThreshold")||r.has("itemCount"))&&(this.input.readonly=this.filterableThreshold<0||this.itemCount<this.filterableThreshold),this.collapsible?.toggleButton&&(this.collapsible.toggleButton.style.display=this.listContainer.childElementCount===0?"none":"")}checkInputValue(r=!0){if(this.input.value){const e=this.findItem(this.input.value);if(e){this.selectItem(e);return}}r&&(this.input.value="",this.input.title="",Un(this,xr,""),this.selectItem(null,!1))}filter(r){r=r.toLowerCase();let e=!0;for(const t of this.listContainer.querySelectorAll("li"))if(t.id!=="noresult"){const n=this.itemText(t).toLowerCase().indexOf(r)==-1;t.classList.toggle("hidden",n),this.collapse&&(t.classList.remove("open"),t.querySelector("ul")?.classList.remove("open")),n||(e=!1)}for(const t of this.listContainer.querySelectorAll("li:has(li:not(.hidden))"))t.classList.remove("hidden"),r&&this.collapse&&(t.classList.add("open"),t.querySelector("ul")?.classList.add("open")),e=!1;this.highlightItem(null),this.listContainer.querySelector("#noresult")?.classList.toggle("hidden",!e)}selectItem(r,e=!0){r?.getAttribute("disabled")!==null&&(r=null),this.selectedItem=r,this.filter(""),this.highlightItem(r,!1),e&&this.value&&Un(this,xr,this.value),setTimeout(()=>this.blur())}findItem(r){if(r){for(const e of this.listContainer.querySelectorAll("li"))if(this.itemValue(e)===r||this.itemText(e)===r)return e}return null}highlightItem(r,e=!0){if(this.listContainer.querySelector("li.active")?.classList.remove("active"),r){if(e&&this.listContainer.focus(),r.classList.add("active"),this.collapse)for(let t=r.closest("ul");t;t=t.parentElement.closest("ul"))t.classList.add("open"),t.closest("li")?.classList.add("open");this.collapsible.open&&r.scrollIntoView({block:"nearest"})}}highlightNextItem(){const r=this.listContainer.querySelector("li.active");let e=r;const t=this.listContainer.querySelectorAll("ul.open > li:not([disabled]):not(.hidden):not(.divider)");if(r){for(let 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){return r.querySelector("div > div")?.innerText||""}elementText(r){let e="";for(const t of r.childNodes)t.nodeType==3&&(e+=t.nodeValue?.trim());return e}onSlotChange(){this.listContainer.replaceChildren(),this.itemCount=0;let r=null;const e=this.shadowRoot.querySelector("#list-container-slot").assignedElements();if(e?.length===1&&(r=Array.prototype.slice.call(e[0].querySelectorAll(":scope > li")),this.copyItems(r,this.listContainer)),this.emptyMessage){const t=document.createElement("li");t.id="noresult",t.setAttribute("disabled",""),t.innerText=this.emptyMessage,this.listContainer.appendChild(t),r&&r.length>0&&t.classList.add("hidden")}this.value=this.value||Zo(this,xr),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,zn)})`);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?.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 Dr;c.title="Open",c.dense=!0,c.icon=!0,c.classList.add("toggle-node","caret"),c.addEventListener("click",h=>{h.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 dt`
|
|
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>
|
|
@@ -187,16 +187,17 @@ a, a:visited { color: inherit; }
|
|
|
187
187
|
@change="${()=>{this.checkInputValue(this.input.inputElement.value===""||!this.collapsible.open)}}"
|
|
188
188
|
@input="${()=>{this.filter(this.input.inputElement.value)}}"
|
|
189
189
|
@click="${()=>{this.collapsible.toggle(!0)}}"
|
|
190
|
+
?autoGrowLabelWidth="${this.autoGrowLabelWidth}"
|
|
190
191
|
@keydown="${r=>{switch(r.code){case"ArrowDown":r.preventDefault(),this.highlightNextItem();break;case"Enter":{const e=this.findItem(this.input.value);e?this.selectItem(e):this.filter(this.input.value);break}}}}"
|
|
191
192
|
></rokit-input>
|
|
192
193
|
<ul id="list-container" tabindex="-1" part="list" class="open"
|
|
193
194
|
@mousedown="${r=>{r.preventDefault()}}"
|
|
194
195
|
@click="${r=>{const e=r.target.closest("li");e&&e.getAttribute("disabled")===null&&!e.classList.contains("divider")&&this.selectItem(e)}}"
|
|
195
|
-
@keydown="${r=>{
|
|
196
|
+
@keydown="${r=>{switch(r.code){case"Enter":this.selectItem(this.listContainer.querySelector("li.active"));break;case"ArrowDown":r.preventDefault(),this.highlightNextItem();break;case"ArrowUp":r.preventDefault(),this.highlightPreviousItem();break;case"ArrowRight":if(this.collapse){const e=this.listContainer.querySelector("li.active");e&&(r.preventDefault(),e.classList.add("open"),e.querySelector("ul")?.classList.add("open"),this.collapsible.updateContentHeight())}break;case"ArrowLeft":if(this.collapse){const e=this.listContainer.querySelector("li.active");e&&(r.preventDefault(),e.classList.remove("open"),e.querySelector("ul")?.classList.remove("open"),this.collapsible.updateContentHeight())}break;case"Escape":this.listContainer.blur();break}}}">
|
|
196
197
|
</ul>
|
|
197
198
|
<slot id="list-container-slot" @slotchange=${this.onSlotChange}></slot>
|
|
198
199
|
</rokit-collapsible>
|
|
199
|
-
`}};
|
|
200
|
+
`}};xr=new WeakMap;zn=new WeakMap;Ge.styles=[...vt.styles,St`
|
|
200
201
|
:host { background-color: var(--rokit-light-background-color-inner); user-select: none; padding: 0; }
|
|
201
202
|
:host([dense]) li > div { padding: 4px 2px; }
|
|
202
203
|
:host([dense]) li.large > div, :host([dense]) li.header > div { padding-top: 6px; padding-bottom: 6px; }
|
|
@@ -222,37 +223,37 @@ a, a:visited { color: inherit; }
|
|
|
222
223
|
:host([collapse]) li > div > div { padding-left: 1.8em; }
|
|
223
224
|
:host([collapse]) ul:not(.open) { display: none; }
|
|
224
225
|
:host([collapse]) li:not(.open) > div > .toggle-node::part(link):before { transform: translate(0em, 0em) rotate(-45deg); }
|
|
225
|
-
`];
|
|
226
|
+
`];rt([Se()],Ge.prototype,"emptyMessage",2);rt([Se()],Ge.prototype,"sort",2);rt([Se()],Ge.prototype,"collapsibleMaxHeight",2);rt([Se()],Ge.prototype,"collapsibleOrientationLeft",2);rt([Se()],Ge.prototype,"collapsibleOrientationRight",2);rt([Se()],Ge.prototype,"collapsibleWidth",2);rt([Se({type:Boolean})],Ge.prototype,"autoGrowLabelWidth",2);rt([Se()],Ge.prototype,"inputMinWidth",2);rt([Se({type:Boolean,reflect:!0})],Ge.prototype,"collapse",2);rt([Se()],Ge.prototype,"filterableThreshold",2);rt([pt("rokit-collapsible")],Ge.prototype,"collapsible",2);rt([pt("#input")],Ge.prototype,"input",2);rt([pt("#list-container")],Ge.prototype,"listContainer",2);rt([Ca()],Ge.prototype,"selectedItem",2);rt([Ca()],Ge.prototype,"itemCount",2);Ge=rt([Qt("rokit-select")],Ge);var Kh=Object.defineProperty,Yh=Object.getOwnPropertyDescriptor,fi=(r,e,t,n)=>{for(var i=n>1?void 0:n?Yh(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&&Kh(e,t,i),i};let cr=class extends Ue{constructor(){super(...arguments),this.resize="none",this.rows=3}firstUpdated(){super.firstUpdated(),this.inputElement.rows=this.rows,this.cols!==void 0&&(this.inputElement.cols=this.cols),this.resize==="auto"?(this.inputElement.style.resize="none",this.inputElement.addEventListener("input",()=>this.autoResize())):this.inputElement.style.resize=this.resize}updated(r){super.updated(r),this.resize==="auto"&&r.has("resize")&&new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.autoResize()}).observe(this),this.resize==="auto"&&r.has("value")&&this.autoResize()}autoResize(){this.inputElement.style.height="",this.inputElement.style.height=this.inputElement.scrollHeight+"px"}onSlotChange(){const r=this.shadowRoot.querySelector("#content").assignedNodes().map(e=>e.textContent).join("");r.trim()!==""&&(this.value=r)}renderInput(){return dt`
|
|
226
227
|
<textarea id="input" part="input" autocomplete="off" name="${this.name}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" .value="${this.value}"></textarea>
|
|
227
228
|
<slot id="content" @slotchange=${this.onSlotChange}></slot>
|
|
228
|
-
`}};
|
|
229
|
+
`}};cr.styles=[...Ue.styles,St`
|
|
229
230
|
:host, .wrapper { align-items: flex-start; }
|
|
230
231
|
#input { height: initial; }
|
|
231
232
|
#content { display: none; }
|
|
232
|
-
`];
|
|
233
|
+
`];fi([Se()],cr.prototype,"resize",2);fi([Se()],cr.prototype,"rows",2);fi([Se()],cr.prototype,"cols",2);cr=fi([Qt("rokit-textarea")],cr);var Zh=Object.defineProperty,ef=Object.getOwnPropertyDescriptor,Ac=r=>{throw TypeError(r)},It=(r,e,t,n)=>{for(var i=n>1?void 0:n?ef(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&&Zh(e,t,i),i},Dc=(r,e,t)=>e.has(r)||Ac("Cannot "+t),Ce=(r,e,t)=>(Dc(r,e,"read from private field"),t?t.call(r):e.get(r)),zi=(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),Hn=(r,e,t,n)=>(Dc(r,e,"write to private field"),e.set(r,t),t),Me,At,Er;const Vt=18;let Ot=class extends Ue{constructor(){super(...arguments),this.labelFormatter=r=>String(r),zi(this,Me,[0,1]),zi(this,At,[Ce(this,Me)[0],Ce(this,Me)[1]]),zi(this,Er)}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")&&(Ce(this,Me)[0]=parseFloat(this.min||"0"),Ce(this,Me)[1]=Math.max(Ce(this,Me)[0],Ce(this,Me)[1])),r.has("max")&&(Ce(this,Me)[1]=parseFloat(this.max||"1"),Ce(this,Me)[0]=Math.min(Ce(this,Me)[0],Ce(this,Me)[1])),r.has("step")&&Hn(this,Er,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);Hn(this,At,[this.applyConstraints(e[0]),this.applyConstraints(e[1])])}else Hn(this,At,[this.applyConstraints(parseFloat(this.value))]);else Hn(this,At,[Ce(this,Me)[0],Ce(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===Ce(this,Me)[0]?e=this.endKnob:e.id==="end"&&e.value===Ce(this,Me)[1]&&(e=this.startKnob)),e}toScreenSpace(r){return(r-Ce(this,Me)[0])/(Ce(this,Me)[1]-Ce(this,Me)[0])*this.track.offsetWidth}toValueSpace(r){return r/this.track.offsetWidth*(Ce(this,Me)[1]-Ce(this,Me)[0])+Ce(this,Me)[0]}applyConstraints(r,e){let t=Math.min(Math.max(r,Ce(this,Me)[0]),Ce(this,Me)[1]);return Ce(this,Er)&&(t=Math.round(t/Ce(this,Er))*Ce(this,Er)),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,Ce(this,At)[0]),this.endKnob&&this.updateKnob(this.endKnob,Ce(this,At)[1])}onKnobDrag(r){if(r.target instanceof Lr||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([Ce(this,At)[0],e.value]):this.value=JSON.stringify([e.value,Ce(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 dt`
|
|
233
234
|
${super.renderInput()}
|
|
234
235
|
<div id="slider" part="slider" tabindex="0" ?range="${this.range!==void 0}">
|
|
235
236
|
<div id="track"></div>
|
|
236
237
|
<rokit-slider-knob id="start"></rokit-slider-knob>
|
|
237
|
-
${this.range===void 0?Ve:
|
|
238
|
+
${this.range===void 0?Ve:dt`
|
|
238
239
|
<rokit-slider-knob id="end"></rokit-slider-knob>
|
|
239
240
|
`}
|
|
240
241
|
</div>
|
|
241
|
-
`}};Me=new WeakMap;At=new WeakMap;
|
|
242
|
+
`}};Me=new WeakMap;At=new WeakMap;Er=new WeakMap;Ot.styles=[...Ue.styles,St`
|
|
242
243
|
:host(.has-label:not(:focus):not(.has-value):not([sticky])) #slider > * { visibility: hidden; }
|
|
243
244
|
:host(.has-label) .wrapper { padding-top: 1em; }
|
|
244
|
-
:host([sticky]) #slider { margin-top: ${.25*
|
|
245
|
+
:host([sticky]) #slider { margin-top: ${.25*Vt+22}px; }
|
|
245
246
|
#input { display: none; }
|
|
246
|
-
#slider { display: flex; position: relative; align-items: center; width: 100%; height: ${
|
|
247
|
+
#slider { display: flex; position: relative; align-items: center; width: 100%; height: ${Vt}px; padding: 0 ${Vt/2}px; outline: 0; }
|
|
247
248
|
:host(:not([sticky])) #slider:not(:focus) rokit-slider-knob::part(label) { color: transparent; background-color: transparent; border-color: transparent; top: 0; }
|
|
248
249
|
#track { height: 2px; flex-grow: 1; background-color: #CCC; }
|
|
249
250
|
#slider[range] #track { background-color: color-mix(in srgb, var(--rokit-primary-color-inner) 60%, transparent); border-width: 0; border-color: #CCC; border-style: solid; }
|
|
250
|
-
`];It([
|
|
251
|
-
:host { position: absolute; width: ${
|
|
252
|
-
:host(.focus), :host(:hover) { box-shadow: 0 0 0 ${
|
|
251
|
+
`];It([Se()],Ot.prototype,"range",2);It([Se()],Ot.prototype,"labelFormatter",2);It([pt("#slider")],Ot.prototype,"sliderElement",2);It([pt("#track")],Ot.prototype,"track",2);It([pt("#start")],Ot.prototype,"startKnob",2);It([pt("#end")],Ot.prototype,"endKnob",2);Ot=It([Qt("rokit-slider")],Ot);let Lr=class extends lr{constructor(){super(...arguments),this.offset=0,this.label="",this.value=0}updated(r){r.has("offset")&&(this.style.left=this.offset+"px")}render(){return dt`<label part="label">${this.label}</label>`}};Lr.styles=[St`
|
|
252
|
+
:host { position: absolute; width: ${Vt}px; height: ${Vt}px; border-radius: ${Vt}px; background-color: var(--rokit-primary-color-inner); }
|
|
253
|
+
:host(.focus), :host(:hover) { box-shadow: 0 0 0 ${Vt/2}px var(--rokit-primary-color-transparent-inner); z-index: 1; }
|
|
253
254
|
label {
|
|
254
255
|
position: absolute;
|
|
255
|
-
top: calc(-2em - ${
|
|
256
|
+
top: calc(-2em - ${Vt/4}px);
|
|
256
257
|
left: 50%;
|
|
257
258
|
transform: translate(-50%, 0);
|
|
258
259
|
white-space: nowrap;
|
|
@@ -277,7 +278,28 @@ a, a:visited { color: inherit; }
|
|
|
277
278
|
background-color: inherit;
|
|
278
279
|
clip-path: polygon(50% 50%, 100% 50%, 50% 100%, 0 50%);
|
|
279
280
|
}
|
|
280
|
-
`];It([Ie()],Ar.prototype,"offset",2);It([Ie()],Ar.prototype,"label",2);Ar=It([hr("rokit-slider-knob")],Ar);class ti extends HTMLElement{constructor(e,t,n,i){if(super(),this.template=new Gd(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 rt;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,Et));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 rt&&(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=Ud(n,e,this.template.config);s.length&&(t=Qn(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 ut)){const i=this.getRdfClassToLinkOrCreate();i&&this.template.config.store.countQuads(e,Ye,i,Et)===0&&(n=!0)}t=Qn(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)}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 Gt){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=Kd(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,vn,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,vn,null);for(const i of n)if(this.template.config.store.countQuads(e,Ye,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=Ia(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(()=>{Bd(s),s.classList.remove("fadeIn")},200)});else{const i=document.createElement("ul"),s=document.createElement("li");s.innerHTML="+ 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(Qn(this.template,u,!0,!0),e)}e.value=""})}return e}}function Qn(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 Gt(s,r.config,e,r.parent,r.nodeKind,r.label,n))}else{const s=eh(r.path,r.datatype?.value);s?r.config.editMode&&!n?i=s.createEditor(r,e):i=s.createViewer(r,e):i=Qd(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 Tr;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",ti);function ef(r,e){let t=r;const n=e.store.getQuads(r,null,null,null),i=mn(n,"label",va,e.languages);i&&(t=i);let s;if(e.attributes.collapse!==null)s=new rt,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=mn(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 tf(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 zi;const rf=new Uint8Array(16);function nf(){if(!zi){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");zi=crypto.getRandomValues.bind(crypto)}return zi(rf)}const sf=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),rl={randomUUID:sf};function nl(r,e,t){if(rl.randomUUID&&!r)return rl.randomUUID();r=r||{};const n=r.random??r.rng?.()??nf();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,tf(n)}class Gt 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+nl()):u=Re.blankNode(nl())}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 b=n.termType==="BlankNode"?"_:"+n.value:n.value;d.innerText=b,d.classList.add("ref-link"),d.onclick=()=>{this.config.form.querySelector(`shacl-node[data-node-id='${b}']`)?.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,Ea,null,null))this.owlImports.push(c.object);for(const c of t.store.getQuads(e,null,null,null))switch(c.predicate.id){case Yn.id:this.addPropertyInstance(c.object,t,n);break;case`${xe}and`:const d=t.lists[c.object.value];if(d?.length)for(const b of d)this.prepend(new Gt(b,t,n,this));else console.error("list not found:",c.object.value,"existing lists:",t.lists);break;case`${xe}node`:this.prepend(new Gt(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,Ye,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=ef(o,t),this.appendChild(u)),i=u}else console.warn("ignoring unknown group reference",s[0],"existing groups:",t.groups)}const a=new ti(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=Hd(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",Gt);var Jt={},Kt={},Yt={},Tt={},il;function af(){if(il)return Tt;il=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 y=s.indexOf("?");return y>0&&(s=s.substr(0,y)),s+i}if(i.startsWith("#"))return s+i;if(!s.length){const y=i.indexOf(":");if(y<0)throw new Error(`Found invalid relative IRI '${i}' for a missing baseIRI`);return t(i,y)}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 b=d.lastIndexOf("/");return b>=0&&b<d.length-1&&(d=d.substr(0,b+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 sl;function of(){return sl||(sl=1,function(r){var e=Yt&&Yt.__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=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(af(),r)}(Yt)),Yt}var Zt={},Qi={},al;function lf(){return al||(al=1,function(r){/**
|
|
281
|
+
`];It([Se()],Lr.prototype,"offset",2);It([Se()],Lr.prototype,"label",2);Lr=It([Qt("rokit-slider-knob")],Lr);var tf=Object.defineProperty,rf=Object.getOwnPropertyDescriptor,Rn=(r,e,t,n)=>{for(var i=n>1?void 0:n?rf(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&&tf(e,t,i),i};let dr=class extends $t{constructor(){super(...arguments),this.open=!1,this.closable=!1,this.title=""}firstUpdated(){this.dialogElement.addEventListener("close",()=>{this.open=!1,this.dispatchEvent(new Event("close"))})}updated(r){if(r.has("open"))if(this.open)document.body.style.top=`-${window.scrollY}px`,document.body.style.position="fixed",this.dialogElement.showModal();else{const e=document.body.style.top;document.body.style.position="",document.body.style.top="",window.scrollTo(0,parseInt(e||"0")*-1),this.dialogElement.close()}}render(){return dt`
|
|
282
|
+
<dialog id="dialog" part="dialog">
|
|
283
|
+
<header>
|
|
284
|
+
<div class="title" part="title">
|
|
285
|
+
<slot name="header">${this.title}</slot>
|
|
286
|
+
</div>
|
|
287
|
+
${this.closable?dt`
|
|
288
|
+
<rokit-button class="clear" icon ?dense="${this.dense}" @click="${()=>{this.open=!1}}" title="Close"></rokit-button>
|
|
289
|
+
`:Ve}
|
|
290
|
+
</header>
|
|
291
|
+
<main>
|
|
292
|
+
<slot></slot>
|
|
293
|
+
</main>
|
|
294
|
+
</dialog>
|
|
295
|
+
`}};dr.styles=[...$t.styles,St`
|
|
296
|
+
dialog[open] { display: flex; flex-direction: column; width: 100%; max-width: 90vw; max-height: 90vh; margin: auto; outline: 0; border: 0; border-radius: 1em; }
|
|
297
|
+
dialog::backdrop { background-color: #0007; }
|
|
298
|
+
header { display: flex; align-items: center; }
|
|
299
|
+
.title { font-weight: 600; flex-grow: 1; text-align: center; }
|
|
300
|
+
.clear { justify-self: flex-end; }
|
|
301
|
+
main { flex-grow: 1; overflow: auto; }
|
|
302
|
+
`];Rn([Se({type:Boolean,reflect:!0})],dr.prototype,"open",2);Rn([Se({type:Boolean})],dr.prototype,"closable",2);Rn([Se()],dr.prototype,"title",2);Rn([pt("#dialog")],dr.prototype,"dialogElement",2);dr=Rn([Qt("rokit-dialog")],dr);class ti extends HTMLElement{constructor(e,t,n,i){if(super(),this.template=new Gd(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 nt;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,Dt));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 nt&&(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=Ud(n,e,this.template.config);s.length&&(t=Qn(this.template.clone().merge(s),e,!0),i=!0)}i||(t=hc(n,this,this.template.config),Lc(t,""))}else{let n=!1;if(e&&!(e instanceof ct)){const i=this.getRdfClassToLinkOrCreate();i&&this.template.config.store.countQuads(e,tt,i,Dt)===0&&(n=!0)}t=Qn(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)}toRDF(e,t){for(const n of this.querySelectorAll(":scope > .property-instance, :scope > .collapsible > .property-instance")){const i=Ne.namedNode(n.dataset.path);if(n.firstChild instanceof Wt){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=Kd(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,Rr,null);if(t.length>0)return t[0]}}isValueValid(e){if(!this.template.extendedShapes.length)return!0;for(const t of this.template.extendedShapes){const n=this.template.config.store.getObjects(t,Rr,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 Ge;e.dense=!0,e.label="+ "+this.template.label,e.title="Add "+this.template.label,e.autoGrowLabelWidth=!0,e.classList.add("add-button");let t=[],n=this.getRdfClassToLinkOrCreate();if(n&&(t=Ia(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(()=>{Bd(s),s.classList.remove("fadeIn")},200)});else{const i=document.createElement("ul"),s=document.createElement("li");s.innerHTML="+ 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(Qn(this.template,u,!0,!0),e)}e.value=""})}return e}}function Qn(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 Wt(s,r.config,e,r.parent,r.nodeKind,r.label,n))}else{const s=eh(r.path,r.datatype?.value);s?r.config.editMode&&!n?i=s.createEditor(r,e):i=s.createViewer(r,e):i=Qd(r,e||null,r.config.editMode&&!n),i.classList.add("property-instance"),n&&i.classList.add("linked")}return r.config.editMode&&Lc(i,r.label,t),i.dataset.path=r.path,i}function Lc(r,e,t=!1){const n=new Dr;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",ti);function nf(r,e){let t=r;const n=e.store.getQuads(r,null,null,null),i=yn(n,"label",va,e.languages);i&&(t=i);let s;if(e.attributes.collapse!==null)s=new nt,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=yn(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 sf(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 Qi;const af=new Uint8Array(16);function of(){if(!Qi){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Qi=crypto.getRandomValues.bind(crypto)}return Qi(af)}const lf=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),tl={randomUUID:lf};function rl(r,e,t){if(tl.randomUUID&&!r)return tl.randomUUID();r=r||{};const n=r.random??r.rng?.()??of();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,sf(n)}class Wt 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=Ne.namedNode(t.attributes.valuesNamespace+rl()):u=Ne.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 h=document.createElement("a");let b=n.termType==="BlankNode"?"_:"+n.value:n.value;h.innerText=b,h.classList.add("ref-link"),h.onclick=()=>{this.config.form.querySelector(`shacl-node[data-node-id='${b}']`)?.scrollIntoView()},this.appendChild(h),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,Ea,null,null))this.owlImports.push(c.object);for(const c of t.store.getQuads(e,null,null,null))switch(c.predicate.id){case Yn.id:this.addPropertyInstance(c.object,t,n);break;case`${xe}and`:const h=t.lists[c.object.value];if(h?.length)for(const b of h)this.prepend(new Wt(b,t,n,this));else console.error("list not found:",c.object.value,"existing lists:",t.lists);break;case uc.id:this.prepend(new Wt(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,Ne.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=nf(o,t),this.appendChild(u)),i=u}else console.warn("ignoring unknown group reference",s[0],"existing groups:",t.groups)}const a=new ti(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=Hd(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",Wt);var Yt={},Zt={},er={},Tt={},nl;function uf(){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 y=s.indexOf("?");return y>0&&(s=s.substr(0,y)),s+i}if(i.startsWith("#"))return s+i;if(!s.length){const y=i.indexOf(":");if(y<0)throw new Error(`Found invalid relative IRI '${i}' for a missing baseIRI`);return t(i,y)}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 h=s.substr(c);const b=h.lastIndexOf("/");return b>=0&&b<h.length-1&&(h=h.substr(0,b+1),i[0]==="."&&i[1]!=="."&&i[1]!=="/"&&i[2]&&(i=i.substr(1))),i=h+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 cf(){return il||(il=1,function(r){var e=er&&er.__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=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(uf(),r)}(er)),er}var tr={},Xi={},sl;function df(){return sl||(sl=1,function(r){/**
|
|
281
303
|
* Character classes and associated utilities for the 5th edition of XML 1.0.
|
|
282
304
|
*
|
|
283
305
|
* @author Louis-Dominique Dubeau
|
|
@@ -285,52 +307,52 @@ a, a:visited { color: inherit; }
|
|
|
285
307
|
* @copyright Louis-Dominique Dubeau
|
|
286
308
|
*/Object.defineProperty(r,"__esModule",{value:!0}),r.CHAR=`
|
|
287
309
|
\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}(
|
|
310
|
+
`,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}(Xi)),Xi}var Ji={},al;function hf(){return al||(al=1,function(r){/**
|
|
289
311
|
* Character classes and associated utilities for the 2nd edition of XML 1.1.
|
|
290
312
|
*
|
|
291
313
|
* @author Louis-Dominique Dubeau
|
|
292
314
|
* @license MIT
|
|
293
315
|
* @copyright Louis-Dominique Dubeau
|
|
294
316
|
*/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(
|
|
317
|
+
`,r.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",r.NAME_CHAR="-"+r.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.CHAR_RE=new RegExp("^["+r.CHAR+"]$","u"),r.RESTRICTED_CHAR_RE=new RegExp("^["+r.RESTRICTED_CHAR+"]$","u"),r.S_RE=new RegExp("^["+r.S+"]+$","u"),r.NAME_START_CHAR_RE=new RegExp("^["+r.NAME_START_CHAR+"]$","u"),r.NAME_CHAR_RE=new RegExp("^["+r.NAME_CHAR+"]$","u"),r.NAME_RE=new RegExp("^["+r.NAME_START_CHAR+"]["+r.NAME_CHAR+"]*$","u"),r.NMTOKEN_RE=new RegExp("^["+r.NAME_CHAR+"]+$","u");var e=9,t=10,n=13,i=32;r.S_LIST=[i,t,n,e];function s(h){return h>=1&&h<=55295||h>=57344&&h<=65533||h>=65536&&h<=1114111}r.isChar=s;function a(h){return h>=1&&h<=8||h===11||h===12||h>=14&&h<=31||h>=127&&h<=132||h>=134&&h<=159}r.isRestrictedChar=a;function o(h){return h===9||h===10||h===13||h>31&&h<127||h===133||h>159&&h<=55295||h>=57344&&h<=65533||h>=65536&&h<=1114111}r.isCharAndNotRestricted=o;function u(h){return h===i||h===t||h===n||h===e}r.isS=u;function l(h){return h>=65&&h<=90||h>=97&&h<=122||h===58||h===95||h===8204||h===8205||h>=192&&h<=214||h>=216&&h<=246||h>=248&&h<=767||h>=880&&h<=893||h>=895&&h<=8191||h>=8304&&h<=8591||h>=11264&&h<=12271||h>=12289&&h<=55295||h>=63744&&h<=64975||h>=65008&&h<=65533||h>=65536&&h<=983039}r.isNameStartChar=l;function c(h){return l(h)||h>=48&&h<=57||h===45||h===46||h===183||h>=768&&h<=879||h>=8255&&h<=8256}r.isNameChar=c}(Ji)),Ji}var Ki={},ol;function ff(){return ol||(ol=1,function(r){/**
|
|
296
318
|
* Character class utilities for XML NS 1.0 edition 3.
|
|
297
319
|
*
|
|
298
320
|
* @author Louis-Dominique Dubeau
|
|
299
321
|
* @license MIT
|
|
300
322
|
* @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}(
|
|
323
|
+
*/Object.defineProperty(r,"__esModule",{value:!0}),r.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",r.NC_NAME_CHAR="-"+r.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.NC_NAME_START_CHAR_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]$","u"),r.NC_NAME_CHAR_RE=new RegExp("^["+r.NC_NAME_CHAR+"]$","u"),r.NC_NAME_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]["+r.NC_NAME_CHAR+"]*$","u");function e(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}(Ki)),Ki}var ll;function pf(){if(ll)return tr;ll=1,Object.defineProperty(tr,"__esModule",{value:!0}),tr.SaxesParser=tr.EVENTS=void 0;const r=df(),e=hf(),t=ff();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,h=t.isNCNameChar,b=t.NC_NAME_RE;const y="http://www.w3.org/XML/1998/namespace",_="http://www.w3.org/2000/xmlns/",E={__proto__:null,xml:y,xmlns:_},v={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},x=-1,S=-2,m=0,d=1,g=2,N=3,j=4,A=5,B=6,R=7,F=8,q=9,D=10,L=11,te=12,T=13,Z=14,k=15,Y=16,w=17,H=18,K=19,Q=20,ue=21,V=22,G=23,z=24,U=25,ee=26,re=27,fe=28,ge=29,C=30,W=31,se=32,he=33,pe=34,me=35,J=36,ce=37,ye=38,le=39,Re=40,ze=41,Ie=42,Xe=43,I=44,f=9,p=10,$=13,X=32,oe=33,de=34,Ee=38,ke=39,Le=45,Oe=47,De=59,yt=60,Pt=61,qe=62,He=63,Dn=91,Mt=93,gr=133,Mr=8232,O=We=>We===de||We===ke,M=[de,ke],be=[...M,Dn,qe],_e=[...M,yt,Mt],ve=[Pt,He,...o],Qe=[...o,qe,Ee,yt];function Ye(We,P,ne){switch(P){case"xml":ne!==y&&We.fail(`xml prefix must be bound to ${y}.`);break;case"xmlns":ne!==_&&We.fail(`xmlns prefix must be bound to ${_}.`);break}switch(ne){case _:We.fail(P===""?`the default namespace may not be set to ${ne}.`:`may not assign a prefix (even "xmlns") to the URI ${_}.`);break;case y:switch(P){case"xml":break;case"":We.fail(`the default namespace may not be set to ${ne}.`);break;default:We.fail("may not assign the xml namespace to another prefix.")}break}}function Ln(We,P){for(const ne of Object.keys(P))Ye(We,ne,P[ne])}const Nt=We=>b.test(We),On=We=>u.test(We),Rt=0,Br=1,mr=2;tr.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];const yr={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"};class qr{get closed(){return this._closed}constructor(P){this.opt=P??{},this.fragmentOpt=!!this.opt.fragment;const ne=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,ne){this.nameStartCheck=c,this.nameCheck=h,this.isName=Nt,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},E);const ie=this.opt.additionalNamespaces;ie!=null&&(Ln(this,ie),Object.assign(this.ns,ie))}else this.nameStartCheck=s,this.nameCheck=a,this.isName=On,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:m,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(v),(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[yr[P]]=ne}off(P){this[yr[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 x;const ie=P.charCodeAt(ne);if(this.column++,ie<55296){if(ie>=X||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 x;const ie=P.charCodeAt(ne);if(this.column++,ie<55296){if(ie>31&&ie<127||ie>159&&ie!==Mr||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===gr)&&(this.i=ne+2)}case gr:case Mr: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,je=Ae?p:we;if(je===x||P.includes(je))return this.text+=ie.slice(ne,this.prevI),je;Ae&&(this.text+=`${ie.slice(ne,this.prevI)}
|
|
302
324
|
`,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 x: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===x)return this.name+=P.slice(ne),x;if(!a(ie))return this.name+=P.slice(ne,this.prevI),ie===S?p:ie}}skipSpaces(){for(;;){const P=this.getCodeNorm();if(P===x||!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=
|
|
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 x: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
|
|
305
|
-
`),P=this.i,ne=Rt;break;case x: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
|
|
306
|
-
`),P=this.i;break;case x: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),je={name:P,prefix:we,local:Ae,value:ne};if(this.attribList.push(je),(ie=this.attributeHandler)===null||ie===void 0||ie.call(this,je),we==="xmlns"){const et=ne.trim();this.currentXMLVersion==="1.0"&&et===""&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[Ae]=et,Ze(this,Ae,et)}else if(P==="xmlns"){const et=ne.trim();this.topNS[""]=et,Ze(this,"",et)}}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!==m&&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 je=Ae.length-1;je>=0;je--)if(we=Ae[je].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:je,local:et}=this.qname(ie.name);ie.prefix=je,ie.local=et;const yr=ie.uri=(P=this.resolve(je))!==null&&P!==void 0?P:"";je!==""&&(je==="xmlns"&&this.fail('tags may not have "xmlns" as prefix.'),yr===""&&(this.fail(`unbound namespace prefix: ${JSON.stringify(je)}.`),ie.uri=je))}if(ne.length===0)return;const{attributes:we}=ie,Ae=new Set;for(const je of ne){const{name:et,prefix:yr,local:td}=je;let br,Br;yr===""?(br=et==="xmlns"?_:"",Br=et):(br=this.resolve(yr),br===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(yr)}.`),br=yr),Br=`{${br}}${td}`),Ae.has(Br)&&this.fail(`duplicate attribute: ${Br}.`),Ae.add(Br),je.uri=br,we[et]=je}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 Zt.SaxesParser=Mr,Zt}var Xr={},cl;function hf(){if(cl)return Xr;cl=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 er={},Jr={},dl;function Lc(){if(dl)return Jr;dl=1,Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.BlankNode=void 0;class r{constructor(t){this.termType="BlankNode",this.value=t}equals(t){return!!t&&t.termType==="BlankNode"&&t.value===this.value}}return Jr.BlankNode=r,Jr}var Kr={},Yr={},hl;function jc(){if(hl)return Yr;hl=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.DefaultGraph=void 0;class r{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&t.termType==="DefaultGraph"}}return Yr.DefaultGraph=r,r.INSTANCE=new r,Yr}var Zr={},en={},fl;function $a(){if(fl)return en;fl=1,Object.defineProperty(en,"__esModule",{value:!0}),en.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 en.NamedNode=r,en}var pl;function Cc(){if(pl)return Zr;pl=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.Literal=void 0;const r=$a();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 Zr.Literal=e,e.RDF_LANGUAGE_STRING=new r.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),e.RDF_DIRECTIONAL_LANGUAGE_STRING=new r.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),e.XSD_STRING=new r.NamedNode("http://www.w3.org/2001/XMLSchema#string"),Zr}var tn={},gl;function $c(){if(gl)return tn;gl=1,Object.defineProperty(tn,"__esModule",{value:!0}),tn.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 tn.Quad=r,tn}var rn={},ml;function Fc(){if(ml)return rn;ml=1,Object.defineProperty(rn,"__esModule",{value:!0}),rn.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 rn.Variable=r,rn}var yl;function ff(){if(yl)return Kr;yl=1,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.DataFactory=void 0;const r=Lc(),e=jc(),t=Cc(),n=$a(),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,b){return new i.Quad(l,c,d,b||this.defaultGraph())}fromTerm(l){switch(l.termType){case"NamedNode":return this.namedNode(l.value);case"BlankNode":return this.blankNode(l.value);case"Literal":return l.language?this.literal(l.value,l.language):l.datatype.equals(t.Literal.XSD_STRING)?this.literal(l.value):this.literal(l.value,this.fromTerm(l.datatype));case"Variable":return this.variable(l.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(l.subject),this.fromTerm(l.predicate),this.fromTerm(l.object),this.fromTerm(l.graph))}}fromQuad(l){return this.fromTerm(l)}resetBlankNodeCounter(){this.blankNodeCounter=0}}return Kr.DataFactory=o,Kr}var bl;function kc(){return bl||(bl=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(Lc(),r),t(ff(),r),t(jc(),r),t(Cc(),r),t($a(),r),t($c(),r),t(Fc(),r)}(er)),er}var tr={},Ki={},_l;function pf(){return _l||(_l=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}",b=`(${d}:${d}|${c})`,y=`((${d}:){6}${b}|::(${d}:){5}${b}|(${d})?::(${d}:){4}${b}|((${d}:){0,1}${d})?::(${d}:){3}${b}|((${d}:){0,2}${d})?::(${d}:){2}${b}|((${d}:){0,3}${d})?::${d}:${b}|((${d}:){0,4}${d})?::${b}|((${d}:){0,5}${d})?::${d}|((${d}:){0,6}${d})?::)`,_=`v[a-fA-F0-9]+\\.(${o}|${o}|":)+`,E=`\\[(${y}|${_})\\]`,v="[0-9]*",x="[a-zA-Z][a-zA-Z0-9+\\-.]*",m="[---]",N="[a-zA-Z0-9\\-._~ -豈-﷏ﷰ-𐀀-𠀀-𰀀------------]",j=`(${N}|${u}|${o}|[:@])*`,A=`(${j}|[\\/?])*`,B=`(${j}|${m}|[\\/?])*`,R=`(${j})+`,F=`(${j})*`,q="",D=`${R}(\\/${F})*`,O=`\\/(${R}(\\/${F})*)?`,te=`(\\/${F})*`,T=`(${N}|${u}|${o})*`,Z=`(${E}|${c}|${T})`,w=`(\\/\\/${`(${`(${N}|${u}|${o}|:)*`}@)?${Z}(:${v})?`}${te}|${O}|${D}|${q})`,H=`^${x}:${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}(Ki)),Ki}var wl;function gf(){return wl||(wl=1,function(r){var e=tr&&tr.__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=tr&&tr.__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)}(tr)),tr}var vl;function mf(){if(vl)return Kt;vl=1,Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.ParseType=Kt.RdfXmlParser=void 0;const r=of(),e=df(),t=oc(),n=hf(),i=kc(),s=gf();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",b=>d.emit("error",b)),l.on("data",b=>c.push(b)),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(b){return d(b)}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 y=l.name;let _="";for(const{key:S,value:m}of c.namespaces||[])_+=` ${S}="${m}"`;for(const S in l.attributes)_+=` ${S}="${l.attributes[S].value}"`;const v=`<${`${y}${_}`}>`;c.childrenStringTags.push(v);const x={childrenStringTags:c.childrenStringTags};x.childrenStringEmitClosingTag=`</${y}>`,this.activeTagStack.push(x);return}const b={};c?(b.language=c.language,b.direction=c.direction,b.baseIRI=c.baseIRI,b.childrenTripleTerms=c.childrenTripleTerms,b.rdfVersion=c.rdfVersion):b.baseIRI=this.baseIRI,this.activeTagStack.push(b),d===o.RESOURCE?this.onTagResource(l,b,c,!c):this.onTagProperty(l,b,c);for(const y in l.attributes){const _=l.attributes[y];_.prefix==="xmlns"&&(b.namespaces||(b.namespaces=[]),b.namespaces.push({key:`${_.prefix}:${_.local}`,value:_.value}))}c&&c.namespaces&&(b.namespaces=[...b.namespaces||[],...c.namespaces])}onTagResource(l,c,d,b){c.childrenParseType=o.PROPERTY;let y=!0;if(l.uri===$e.RDF){if(!b&&$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":y=!1}}const _=[],E=[];let v=null,x=!1,S=!1,m=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(v)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${v} where found.`);v=g.value;continue;case"ID":if(v)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${v} where found.`);this.validateNcname(g.value),v="#"+g.value,x=!0;continue;case"nodeID":if(v)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${v} where found.`);this.validateNcname(g.value),v=g.value,S=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"type":m=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)),E.push(g.value))}if(v!==null&&(c.subject=S?this.dataFactory.blankNode(v):this.valueToUri(v,c),x&&this.claimNodeId(c.subject)),c.subject||(c.subject=this.dataFactory.blankNode()),y){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"),N=d.childrenCollectionPredicate.equals(g);this.emitTriple(d.childrenCollectionSubject,d.childrenCollectionPredicate,h,N?null:d.reifiedStatementId,d.childrenTripleTerms,N?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(E[h],c);this.emitTriple(c.subject,_[h],g,d.reifiedStatementId,d.childrenTripleTerms,d.reifier)}m&&this.emitTriple(c.subject,this.dataFactory.namedNode($e.RDF+"type"),this.uriToNamedNode(m),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 b=!1,y=!1,_=null,E=!0;const v=[],x=[];for(const S in l.attributes){const m=l.attributes[S];if(m.uri===$e.RDF&&m.local==="version"){this.setVersion(c,m.value);continue}else if(m.uri===$e.RDF)switch(m.local){case"resource":if(_)throw this.newParseError(`Found both rdf:resource (${m.value}) and rdf:nodeID (${_}).`);if(b)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${m.value})`);c.hadChildren=!0,_=m.value,E=!1;continue;case"datatype":if(y)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${m.value}).`);if(b)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${m.value})`);c.datatype=this.valueToUri(m.value,c);continue;case"nodeID":if(y)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${m.value}).`);if(c.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${m.value}).`);if(b)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${m.value})`);this.validateNcname(m.value),c.hadChildren=!0,_=m.value,E=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"parseType":if(y)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(m.value==="Resource"){b=!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 m.value==="Collection"?(b=!0,c.hadChildren=!0,c.childrenCollectionSubject=c.subject,c.childrenCollectionPredicate=c.predicate,E=!1):m.value==="Literal"?(b=!0,c.childrenTagsToString=!0,c.childrenStringTags=[]):m.value==="Triple"&&(b=!0,c.childrenTagsToTripleTerms=!0,c.childrenTripleTerms=[]);continue;case"ID":this.validateNcname(m.value),c.reifiedStatementId=this.valueToUri("#"+m.value,c),this.claimNodeId(c.reifiedStatementId);continue;case"annotation":c.reifier=this.dataFactory.namedNode(m.value);continue;case"annotationNodeID":c.reifier=this.dataFactory.blankNode(m.value);continue}else if(m.uri===$e.XML&&m.local==="lang"){c.language=m.value===""?null:m.value.toLowerCase();continue}else if(m.uri===$e.ITS&&m.local==="dir"){this.setDirection(c,m.value);continue}else if(m.uri===$e.ITS&&m.local==="version")continue;if(m.prefix!=="xml"&&m.prefix!=="xmlns"&&(m.prefix!==""||m.local!=="xmlns")&&m.uri){if(b||c.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${m.value}`);c.hadChildren=!0,y=!0,v.push(this.uriToNamedNode(m.uri+m.local)),x.push(this.createLiteral(m.value,c))}}if(_!==null){const S=c.subject;c.subject=E?this.dataFactory.blankNode(_):this.valueToUri(_,c),this.emitTriple(S,c.predicate,c.subject,c.reifiedStatementId,c.childrenTripleTerms,c.reifier);for(let m=0;m<v.length;m++)this.emitTriple(c.subject,v[m],x[m],null,c.childrenTripleTerms,c.reifier);c.predicateEmitted=!0}else E&&(c.predicateSubPredicates=v,c.predicateSubObjects=x,c.predicateEmitted=!1)}emitTriple(l,c,d,b,y,_){const E=this.dataFactory.quad(l,c,d,this.defaultGraph);y?y.push(E):this.push(E),_&&this.push(this.dataFactory.quad(_,this.dataFactory.namedNode($e.RDF+"reifies"),E)),b&&(this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"type"),this.dataFactory.namedNode($e.RDF+"Statement"),this.defaultGraph)),this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"subject"),l,this.defaultGraph)),this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"predicate"),c,this.defaultGraph)),this.push(this.dataFactory.quad(b,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 b=0;b<l.predicateSubPredicates.length;b++)this.emitTriple(d,l.predicateSubPredicates[b],l.predicateSubObjects[b],null,l.childrenTripleTerms)}}}onDoctype(l){l.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(c,d,b)=>(this.saxParser.ENTITIES[d]=b,""))}setDirection(l,c){if(c){if(c!=="ltr"&&c!=="rtl")throw this.newParseError(`Base directions must either be 'ltr' or 'rtl', while '${c}' was found.`);l.direction=c}else delete l.direction}setVersion(l,c){l.rdfVersion=c,this.emit("version",c)}};Kt.RdfXmlParser=a,a.MIME_TYPE="application/rdf+xml",a.RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#",a.XML="http://www.w3.org/XML/1998/namespace",a.ITS="http://www.w3.org/2005/11/its",a.FORBIDDEN_NODE_ELEMENTS=["RDF","ID","about","bagID","parseType","resource","nodeID","li","aboutEach","aboutEachPrefix"],a.FORBIDDEN_PROPERTY_ELEMENTS=["Description","RDF","ID","about","bagID","parseType","resource","nodeID","aboutEach","aboutEachPrefix"],a.NCNAME_MATCHER=/^([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_])([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_\-.0-9#xB7\u{0300}-\u{036F}\u{203F}-\u{2040}])*$/u;var o;return function(u){u[u.RESOURCE=0]="RESOURCE",u[u.PROPERTY=1]="PROPERTY"}(o||(Kt.ParseType=o={})),Kt}var xl;function yf(){return xl||(xl=1,function(r){var e=Jt&&Jt.__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=Jt&&Jt.__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(mf(),r)}(Jt)),Jt}var bf=yf(),Yi={},Zi,El;function Fa(){return El||(El=1,Zi=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()]}}),Zi}var es={},Sl;function _f(){return Sl||(Sl=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 m=new Array(arguments.length-1),h=0;h<m.length;h++)m[h]=arguments[h+1];var g={callback:S,args:m};return n[t]=g,a(t),t++}function u(S){delete n[S]}function l(S){var m=S.callback,h=S.args;switch(h.length){case 0:m();break;case 1:m(h[0]);break;case 2:m(h[0],h[1]);break;case 3:m(h[0],h[1],h[2]);break;default:m.apply(e,h);break}}function c(S){if(i)setTimeout(c,0,S);else{var m=n[S];if(m){i=!0;try{l(m)}finally{u(S),i=!1}}}}function d(){a=function(S){process.nextTick(function(){c(S)})}}function b(){if(r.postMessage&&!r.importScripts){var S=!0,m=r.onmessage;return r.onmessage=function(){S=!1},r.postMessage("","*"),r.onmessage=m,S}}function y(){var S="setImmediate$"+Math.random()+"$",m=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",m,!1):r.attachEvent("onmessage",m),a=function(h){r.postMessage(S+h,"*")}}function _(){var S=new MessageChannel;S.port1.onmessage=function(m){var h=m.data;c(h)},a=function(m){S.port2.postMessage(m)}}function E(){var S=s.documentElement;a=function(m){var h=s.createElement("script");h.onreadystatechange=function(){c(m),h.onreadystatechange=null,S.removeChild(h),h=null},S.appendChild(h)}}function v(){a=function(S){setTimeout(c,0,S)}}var x=Object.getPrototypeOf&&Object.getPrototypeOf(r);x=x&&x.setTimeout?x:r,{}.toString.call(r.process)==="[object process]"?d():b()?y():r.MessageChannel?_():s&&"onreadystatechange"in s.createElement("script")?E():v(),x.setImmediate=o,x.clearImmediate=u}(typeof self>"u"?typeof Er>"u"?es:Er:self)),es}/*!
|
|
325
|
+
`,ne=this.i,we=p;break;case x: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===x)return this.name+=P.slice(ne),x;if(!a(ie))return this.name+=P.slice(ne,this.prevI),ie===S?p:ie}}skipSpaces(){for(;;){const P=this.getCodeNorm();if(P===x||!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=d}sBeginWhitespace(){const P=this.i,ne=this.skipSpaces();switch(this.prevI!==P&&(this.xmlDeclPossible=!1),ne){case yt:if(this.state=k,this.text.length!==0)throw new Error("no-empty text at start");break;case x: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 x:break;default:this.text+=String.fromCodePoint(ne),ne===Dn?this.state=j:O(ne)&&(this.state=N,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!==x&&(this.text+=String.fromCodePoint(P),P===Mt?this.state=g:P===yt?this.state=B:O(P)&&(this.state=A,this.q=P))}sDTDQuoted(){const P=this.q;this.captureToChar(P)&&(this.text+=String.fromCodePoint(P),this.state=j,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=L;break;default:this.state=j}}sDTDOpenWakaBang(){const P=String.fromCodePoint(this.getCodeNorm()),ne=this.openWakaBang+=P;this.text+=P,ne!=="-"&&(this.state=ne==="--"?F:j,this.openWakaBang="")}sDTDComment(){this.captureToChar(Le)&&(this.text+="-",this.state=q)}sDTDCommentEnding(){const P=this.getCodeNorm();this.text+=String.fromCodePoint(P),this.state=P===Le?D:F}sDTDCommentEnded(){const P=this.getCodeNorm();this.text+=String.fromCodePoint(P),P===qe?this.state=j:(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=j)}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)}
|
|
326
|
+
`,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 x: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 Oe:this.state=Xe,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=Q,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(Le)&&(this.state=H)}sCommentEnding(){var P;const ne=this.getCodeNorm();ne===Le?(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(Mt)&&(this.state=ue)}sCDataEnding(){const P=this.getCodeNorm();P===Mt?this.state=V:(this.text+=`]${String.fromCodePoint(P)}`,this.state=Q)}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 Mt:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(ne)}`,this.state=Q}}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===x){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!==x&&(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===Pt){if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=P===Pt?C:ge}}sXMLDeclEq(){const P=this.getCodeNorm();if(P===He){this.state=he,this.fail("XML declaration is incomplete.");return}n(P)||(P!==Pt&&this.fail("value required."),this.state=C)}sXMLDeclValueStart(){const P=this.getCodeNorm();if(P===He){this.state=he,this.fail("XML declaration is incomplete.");return}n(P)||(O(P)?this.q=P:(this.fail("value must be quoted."),this.q=X),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===x)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===x)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 Oe: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!==x&&(s(P)?(this.unget(),this.state=ce):P===qe?this.openTag():P===Oe?this.state=me:this.fail("disallowed character in attribute name."))}sAttribName(){const P=this.captureNameChars();P===Pt?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!==x&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){const P=this.skipSpaces();switch(P){case x:return;case Pt: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();O(P)?(this.q=P,this.state=Re):n(P)||(this.fail("unquoted attribute value."),this.state=Ie,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=Re;return;case p:case S:case f:this.text+=`${ne.slice(ie,this.prevI)} `,ie=this.i;break;case yt:this.text+=ne.slice(ie,this.prevI),this.fail("disallowed character.");return;case x:this.text+=ne.slice(ie);return}}sAttribValueClosed(){const P=this.getCodeNorm();n(P)?this.state=J:P===qe?this.openTag():P===Oe?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(Qe);switch(P){case Ee:this.state=Z,this.entityReturnState=Ie;break;case yt:this.fail("disallowed character.");break;case x: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=I:P!==x&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case qe:this.closeTag();break;case x: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 yt:{if(this.state=k,we!==void 0){const{text:Ae}=this,je=ie.slice(P,this.prevI);Ae.length!==0?(we(Ae+je),this.text=""):je.length!==0&&we(je)}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 Mt:switch(ne){case Rt:ne=Br;break;case Br:ne=mr;break;case mr:break;default:throw new Error("impossible state")}break;case qe:ne===mr&&this.fail('the string "]]>" is disallowed in char data.'),ne=Rt;break;case S:we!==void 0&&(this.text+=`${ie.slice(P,this.prevI)}
|
|
327
|
+
`),P=this.i,ne=Rt;break;case x: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 yt:{if(this.state=k,ie!==void 0){const{text:je}=this,Ze=ne.slice(P,this.prevI);je.length!==0?(ie(je+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)}
|
|
328
|
+
`),P=this.i;break;case x: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),je={name:P,prefix:we,local:Ae,value:ne};if(this.attribList.push(je),(ie=this.attributeHandler)===null||ie===void 0||ie.call(this,je),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!==m&&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 je=Ae.length-1;je>=0;je--)if(we=Ae[je].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:je,local:Ze}=this.qname(ie.name);ie.prefix=je,ie.local=Ze;const br=ie.uri=(P=this.resolve(je))!==null&&P!==void 0?P:"";je!==""&&(je==="xmlns"&&this.fail('tags may not have "xmlns" as prefix.'),br===""&&(this.fail(`unbound namespace prefix: ${JSON.stringify(je)}.`),ie.uri=je))}if(ne.length===0)return;const{attributes:we}=ie,Ae=new Set;for(const je of ne){const{name:Ze,prefix:br,local:td}=je;let _r,Ur;br===""?(_r=Ze==="xmlns"?_:"",Ur=Ze):(_r=this.resolve(br),_r===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(br)}.`),_r=br),Ur=`{${_r}}${td}`),Ae.has(Ur)&&this.fail(`duplicate attribute: ${Ur}.`),Ae.add(Ur),je.uri=_r,we[Ze]=je}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 tr.SaxesParser=qr,tr}var Kr={},ul;function gf(){if(ul)return Kr;ul=1,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.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 Kr.ParseError=r,Kr}var rr={},Yr={},cl;function Oc(){if(cl)return Yr;cl=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.BlankNode=void 0;class r{constructor(t){this.termType="BlankNode",this.value=t}equals(t){return!!t&&t.termType==="BlankNode"&&t.value===this.value}}return Yr.BlankNode=r,Yr}var Zr={},en={},dl;function jc(){if(dl)return en;dl=1,Object.defineProperty(en,"__esModule",{value:!0}),en.DefaultGraph=void 0;class r{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&t.termType==="DefaultGraph"}}return en.DefaultGraph=r,r.INSTANCE=new r,en}var tn={},rn={},hl;function $a(){if(hl)return rn;hl=1,Object.defineProperty(rn,"__esModule",{value:!0}),rn.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 rn.NamedNode=r,rn}var fl;function Cc(){if(fl)return tn;fl=1,Object.defineProperty(tn,"__esModule",{value:!0}),tn.Literal=void 0;const r=$a();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 tn.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"),tn}var nn={},pl;function $c(){if(pl)return nn;pl=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.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 nn.Quad=r,nn}var sn={},gl;function Fc(){if(gl)return sn;gl=1,Object.defineProperty(sn,"__esModule",{value:!0}),sn.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 sn.Variable=r,sn}var ml;function mf(){if(ml)return Zr;ml=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.DataFactory=void 0;const r=Oc(),e=jc(),t=Cc(),n=$a(),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,h,b){return new i.Quad(l,c,h,b||this.defaultGraph())}fromTerm(l){switch(l.termType){case"NamedNode":return this.namedNode(l.value);case"BlankNode":return this.blankNode(l.value);case"Literal":return l.language?this.literal(l.value,l.language):l.datatype.equals(t.Literal.XSD_STRING)?this.literal(l.value):this.literal(l.value,this.fromTerm(l.datatype));case"Variable":return this.variable(l.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(l.subject),this.fromTerm(l.predicate),this.fromTerm(l.object),this.fromTerm(l.graph))}}fromQuad(l){return this.fromTerm(l)}resetBlankNodeCounter(){this.blankNodeCounter=0}}return Zr.DataFactory=o,Zr}var yl;function kc(){return yl||(yl=1,function(r){var e=rr&&rr.__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=rr&&rr.__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(Oc(),r),t(mf(),r),t(jc(),r),t(Cc(),r),t($a(),r),t($c(),r),t(Fc(),r)}(rr)),rr}var nr={},Yi={},bl;function yf(){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}`,h="[a-fA-F0-9]{1,4}",b=`(${h}:${h}|${c})`,y=`((${h}:){6}${b}|::(${h}:){5}${b}|(${h})?::(${h}:){4}${b}|((${h}:){0,1}${h})?::(${h}:){3}${b}|((${h}:){0,2}${h})?::(${h}:){2}${b}|((${h}:){0,3}${h})?::${h}:${b}|((${h}:){0,4}${h})?::${b}|((${h}:){0,5}${h})?::${h}|((${h}:){0,6}${h})?::)`,_=`v[a-fA-F0-9]+\\.(${o}|${o}|":)+`,E=`\\[(${y}|${_})\\]`,v="[0-9]*",x="[a-zA-Z][a-zA-Z0-9+\\-.]*",m="[---]",N="[a-zA-Z0-9\\-._~ -豈-﷏ﷰ-𐀀-𠀀-𰀀------------]",j=`(${N}|${u}|${o}|[:@])*`,A=`(${j}|[\\/?])*`,B=`(${j}|${m}|[\\/?])*`,R=`(${j})+`,F=`(${j})*`,q="",D=`${R}(\\/${F})*`,L=`\\/(${R}(\\/${F})*)?`,te=`(\\/${F})*`,T=`(${N}|${u}|${o})*`,Z=`(${E}|${c}|${T})`,w=`(\\/\\/${`(${`(${N}|${u}|${o}|:)*`}@)?${Z}(:${v})?`}${te}|${L}|${D}|${q})`,H=`^${x}:${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}(Yi)),Yi}var _l;function bf(){return _l||(_l=1,function(r){var e=nr&&nr.__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=nr&&nr.__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(yf(),r)}(nr)),nr}var wl;function _f(){if(wl)return Zt;wl=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.ParseType=Zt.RdfXmlParser=void 0;const r=cf(),e=pf(),t=ac(),n=gf(),i=kc(),s=bf();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",b=>h.emit("error",b)),l.on("data",b=>c.push(b)),l.on("end",()=>c.push(null));const h=c.pipe(new $e(this.options));return h}_transform(l,c,h){try{this.saxParser.write(l)}catch(b){return h(b)}h()}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 h=o.RESOURCE;if(c&&(c.hadChildren=!0,h=c.childrenParseType),c&&c.childrenStringTags){const y=l.name;let _="";for(const{key:S,value:m}of c.namespaces||[])_+=` ${S}="${m}"`;for(const S in l.attributes)_+=` ${S}="${l.attributes[S].value}"`;const v=`<${`${y}${_}`}>`;c.childrenStringTags.push(v);const x={childrenStringTags:c.childrenStringTags};x.childrenStringEmitClosingTag=`</${y}>`,this.activeTagStack.push(x);return}const b={};c?(b.language=c.language,b.direction=c.direction,b.baseIRI=c.baseIRI,b.childrenTripleTerms=c.childrenTripleTerms,b.rdfVersion=c.rdfVersion):b.baseIRI=this.baseIRI,this.activeTagStack.push(b),h===o.RESOURCE?this.onTagResource(l,b,c,!c):this.onTagProperty(l,b,c);for(const y in l.attributes){const _=l.attributes[y];_.prefix==="xmlns"&&(b.namespaces||(b.namespaces=[]),b.namespaces.push({key:`${_.prefix}:${_.local}`,value:_.value}))}c&&c.namespaces&&(b.namespaces=[...b.namespaces||[],...c.namespaces])}onTagResource(l,c,h,b){c.childrenParseType=o.PROPERTY;let y=!0;if(l.uri===$e.RDF){if(!b&&$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":y=!1}}const _=[],E=[];let v=null,x=!1,S=!1,m=null;for(const d in l.attributes){const g=l.attributes[d];if(g.uri===$e.RDF&&g.local==="version"){this.setVersion(c,g.value);continue}else if(h&&g.uri===$e.RDF)switch(g.local){case"about":if(v)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${v} where found.`);v=g.value;continue;case"ID":if(v)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${v} where found.`);this.validateNcname(g.value),v="#"+g.value,x=!0;continue;case"nodeID":if(v)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${v} where found.`);this.validateNcname(g.value),v=g.value,S=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"type":m=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)),E.push(g.value))}if(v!==null&&(c.subject=S?this.dataFactory.blankNode(v):this.valueToUri(v,c),x&&this.claimNodeId(c.subject)),c.subject||(c.subject=this.dataFactory.blankNode()),y){const d=this.uriToNamedNode(l.uri+l.local);this.emitTriple(c.subject,this.dataFactory.namedNode($e.RDF+"type"),d,h?h.reifiedStatementId:null,c.childrenTripleTerms,c.reifier)}if(h){if(h.predicate)if(h.childrenCollectionSubject){const d=this.dataFactory.blankNode(),g=this.dataFactory.namedNode($e.RDF+"rest"),N=h.childrenCollectionPredicate.equals(g);this.emitTriple(h.childrenCollectionSubject,h.childrenCollectionPredicate,d,N?null:h.reifiedStatementId,h.childrenTripleTerms,N?null:h.reifier),this.emitTriple(d,this.dataFactory.namedNode($e.RDF+"first"),c.subject,null,c.childrenTripleTerms),h.childrenCollectionSubject=d,h.childrenCollectionPredicate=g}else{h.childrenTagsToTripleTerms||(this.emitTriple(h.subject,h.predicate,c.subject,h.reifiedStatementId,h.childrenTripleTerms,h.reifier),h.predicateEmitted=!0);for(let d=0;d<h.predicateSubPredicates.length;d++)this.emitTriple(c.subject,h.predicateSubPredicates[d],h.predicateSubObjects[d],null,h.childrenTripleTerms,h.reifier);h.predicateSubPredicates=[],h.predicateSubObjects=[]}for(let d=0;d<_.length;d++){const g=this.createLiteral(E[d],c);this.emitTriple(c.subject,_[d],g,h.reifiedStatementId,h.childrenTripleTerms,h.reifier)}m&&this.emitTriple(c.subject,this.dataFactory.namedNode($e.RDF+"type"),this.uriToNamedNode(m),null,c.childrenTripleTerms,c.reifier)}}onTagProperty(l,c,h){if(c.childrenParseType=o.RESOURCE,c.subject=h.subject,l.uri===$e.RDF&&l.local==="li"?(h.listItemCounter||(h.listItemCounter=1),c.predicate=this.uriToNamedNode(l.uri+"_"+h.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 b=!1,y=!1,_=null,E=!0;const v=[],x=[];for(const S in l.attributes){const m=l.attributes[S];if(m.uri===$e.RDF&&m.local==="version"){this.setVersion(c,m.value);continue}else if(m.uri===$e.RDF)switch(m.local){case"resource":if(_)throw this.newParseError(`Found both rdf:resource (${m.value}) and rdf:nodeID (${_}).`);if(b)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${m.value})`);c.hadChildren=!0,_=m.value,E=!1;continue;case"datatype":if(y)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${m.value}).`);if(b)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${m.value})`);c.datatype=this.valueToUri(m.value,c);continue;case"nodeID":if(y)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${m.value}).`);if(c.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${m.value}).`);if(b)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${m.value})`);this.validateNcname(m.value),c.hadChildren=!0,_=m.value,E=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"parseType":if(y)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(m.value==="Resource"){b=!0,c.childrenParseType=o.PROPERTY;const d=this.dataFactory.blankNode();this.emitTriple(c.subject,c.predicate,d,c.reifiedStatementId,c.childrenTripleTerms,c.reifier),c.subject=d,c.predicate=null}else m.value==="Collection"?(b=!0,c.hadChildren=!0,c.childrenCollectionSubject=c.subject,c.childrenCollectionPredicate=c.predicate,E=!1):m.value==="Literal"?(b=!0,c.childrenTagsToString=!0,c.childrenStringTags=[]):m.value==="Triple"&&(b=!0,c.childrenTagsToTripleTerms=!0,c.childrenTripleTerms=[]);continue;case"ID":this.validateNcname(m.value),c.reifiedStatementId=this.valueToUri("#"+m.value,c),this.claimNodeId(c.reifiedStatementId);continue;case"annotation":c.reifier=this.dataFactory.namedNode(m.value);continue;case"annotationNodeID":c.reifier=this.dataFactory.blankNode(m.value);continue}else if(m.uri===$e.XML&&m.local==="lang"){c.language=m.value===""?null:m.value.toLowerCase();continue}else if(m.uri===$e.ITS&&m.local==="dir"){this.setDirection(c,m.value);continue}else if(m.uri===$e.ITS&&m.local==="version")continue;if(m.prefix!=="xml"&&m.prefix!=="xmlns"&&(m.prefix!==""||m.local!=="xmlns")&&m.uri){if(b||c.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${m.value}`);c.hadChildren=!0,y=!0,v.push(this.uriToNamedNode(m.uri+m.local)),x.push(this.createLiteral(m.value,c))}}if(_!==null){const S=c.subject;c.subject=E?this.dataFactory.blankNode(_):this.valueToUri(_,c),this.emitTriple(S,c.predicate,c.subject,c.reifiedStatementId,c.childrenTripleTerms,c.reifier);for(let m=0;m<v.length;m++)this.emitTriple(c.subject,v[m],x[m],null,c.childrenTripleTerms,c.reifier);c.predicateEmitted=!0}else E&&(c.predicateSubPredicates=v,c.predicateSubObjects=x,c.predicateEmitted=!1)}emitTriple(l,c,h,b,y,_){const E=this.dataFactory.quad(l,c,h,this.defaultGraph);y?y.push(E):this.push(E),_&&this.push(this.dataFactory.quad(_,this.dataFactory.namedNode($e.RDF+"reifies"),E)),b&&(this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"type"),this.dataFactory.namedNode($e.RDF+"Statement"),this.defaultGraph)),this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"subject"),l,this.defaultGraph)),this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"predicate"),c,this.defaultGraph)),this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"object"),h,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 h of l.childrenTripleTerms)this.emitTriple(l.subject,l.predicate,h,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 h=this.dataFactory.blankNode();this.emitTriple(l.subject,l.predicate,h,l.reifiedStatementId,l.childrenTripleTerms,l.reifier);for(let b=0;b<l.predicateSubPredicates.length;b++)this.emitTriple(h,l.predicateSubPredicates[b],l.predicateSubObjects[b],null,l.childrenTripleTerms)}}}onDoctype(l){l.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(c,h,b)=>(this.saxParser.ENTITIES[h]=b,""))}setDirection(l,c){if(c){if(c!=="ltr"&&c!=="rtl")throw this.newParseError(`Base directions must either be 'ltr' or 'rtl', while '${c}' was found.`);l.direction=c}else delete l.direction}setVersion(l,c){l.rdfVersion=c,this.emit("version",c)}};Zt.RdfXmlParser=a,a.MIME_TYPE="application/rdf+xml",a.RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#",a.XML="http://www.w3.org/XML/1998/namespace",a.ITS="http://www.w3.org/2005/11/its",a.FORBIDDEN_NODE_ELEMENTS=["RDF","ID","about","bagID","parseType","resource","nodeID","li","aboutEach","aboutEachPrefix"],a.FORBIDDEN_PROPERTY_ELEMENTS=["Description","RDF","ID","about","bagID","parseType","resource","nodeID","aboutEach","aboutEachPrefix"],a.NCNAME_MATCHER=/^([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_])([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_\-.0-9#xB7\u{0300}-\u{036F}\u{203F}-\u{2040}])*$/u;var o;return function(u){u[u.RESOURCE=0]="RESOURCE",u[u.PROPERTY=1]="PROPERTY"}(o||(Zt.ParseType=o={})),Zt}var vl;function wf(){return vl||(vl=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(_f(),r)}(Yt)),Yt}var vf=wf(),Zi={},es,xl;function Fa(){return xl||(xl=1,es=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()]}}),es}var ts={},El;function xf(){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 m=new Array(arguments.length-1),d=0;d<m.length;d++)m[d]=arguments[d+1];var g={callback:S,args:m};return n[t]=g,a(t),t++}function u(S){delete n[S]}function l(S){var m=S.callback,d=S.args;switch(d.length){case 0:m();break;case 1:m(d[0]);break;case 2:m(d[0],d[1]);break;case 3:m(d[0],d[1],d[2]);break;default:m.apply(e,d);break}}function c(S){if(i)setTimeout(c,0,S);else{var m=n[S];if(m){i=!0;try{l(m)}finally{u(S),i=!1}}}}function h(){a=function(S){process.nextTick(function(){c(S)})}}function b(){if(r.postMessage&&!r.importScripts){var S=!0,m=r.onmessage;return r.onmessage=function(){S=!1},r.postMessage("","*"),r.onmessage=m,S}}function y(){var S="setImmediate$"+Math.random()+"$",m=function(d){d.source===r&&typeof d.data=="string"&&d.data.indexOf(S)===0&&c(+d.data.slice(S.length))};r.addEventListener?r.addEventListener("message",m,!1):r.attachEvent("onmessage",m),a=function(d){r.postMessage(S+d,"*")}}function _(){var S=new MessageChannel;S.port1.onmessage=function(m){var d=m.data;c(d)},a=function(m){S.port2.postMessage(m)}}function E(){var S=s.documentElement;a=function(m){var d=s.createElement("script");d.onreadystatechange=function(){c(m),d.onreadystatechange=null,S.removeChild(d),d=null},S.appendChild(d)}}function v(){a=function(S){setTimeout(c,0,S)}}var x=Object.getPrototypeOf&&Object.getPrototypeOf(r);x=x&&x.setTimeout?x:r,{}.toString.call(r.process)==="[object process]"?h():b()?y():r.MessageChannel?_():s&&"onreadystatechange"in s.createElement("script")?E():v(),x.setImmediate=o,x.clearImmediate=u}(typeof self>"u"?typeof Sr>"u"?ts:Sr:self)),ts}/*!
|
|
307
329
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
308
|
-
*/var
|
|
330
|
+
*/var rs,Sl;function pi(){if(Sl)return rs;Sl=1,xf();const r=self.crypto||self.msCrypto;return rs=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}},rs}/*!
|
|
309
331
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
310
|
-
*/var
|
|
332
|
+
*/var ns,Il;function Mc(){return Il||(Il=1,ns=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}}),ns}/*!
|
|
311
333
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
312
|
-
*/var
|
|
313
|
-
`,S}static serializeQuad(_){return Xn.serializeQuadComponents(_.subject,_.predicate,_.object,_.graph)}static legacyDatasetToQuads(_){const E=[],v={"blank node":i,IRI:n,literal:s};for(const x in _)_[x].forEach(m=>{const
|
|
314
|
-
`:return"\\n";case"\r":return"\\r"}})}const
|
|
315
|
-
`;case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(v)return String.fromCharCode(parseInt(v,16));if(x)throw new Error("Unsupported U escape")})}return
|
|
334
|
+
*/var is,Nl;function ka(){if(Nl)return is;Nl=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 y="(?:<([^:]+:[^>]*)>)",E="A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�"+"_",v=E+"0-9-·̀-ͯ‿-⁀",S="(_:(?:["+E+"0-9])(?:(?:["+v+".])*(?:["+v+"]))?)",m='"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"',d="(?:\\^\\^"+y+")",N="(?:"+m+"(?:"+d+"|"+"(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*))"+")?)",j="[ \\t]+",A="[ \\t]*",B="(?:"+y+"|"+S+")"+j,R=y+j,F="(?:"+y+"|"+S+"|"+N+")"+A,q="(?:\\.|(?:(?:"+y+"|"+S+")"+A+"\\.))";o.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,o.empty=new RegExp("^"+A+"$"),o.quad=new RegExp("^"+A+B+R+F+q+A+"$")})(),is=class Xn{static parse(_){const E=[],v={},x=_.split(o.eoln);let S=0;for(const m of x){if(S++,o.empty.test(m))continue;const d=m.match(o.quad);if(d===null)throw new Error("N-Quads parse error on line "+S+".");const g={subject:null,predicate:null,object:null,graph:null};if(d[1]!==void 0?g.subject={termType:n,value:d[1]}:g.subject={termType:i,value:d[2]},g.predicate={termType:n,value:d[3]},d[4]!==void 0?g.object={termType:n,value:d[4]}:d[5]!==void 0?g.object={termType:i,value:d[5]}:(g.object={termType:s,value:void 0,datatype:{termType:n}},d[7]!==void 0?g.object.datatype.value=d[7]:d[8]!==void 0?(g.object.datatype.value=e,g.object.language=d[8]):g.object.datatype.value=t,g.object.value=b(d[6])),d[9]!==void 0?g.graph={termType:n,value:d[9]}:d[10]!==void 0?g.graph={termType:i,value:d[10]}:g.graph={termType:a,value:""},!(g.graph.value in v))v[g.graph.value]=[g],E.push(g);else{let N=!0;const j=v[g.graph.value];for(const A of j)if(u(A,g)){N=!1;break}N&&(j.push(g),E.push(g))}}return E}static serialize(_){Array.isArray(_)||(_=Xn.legacyDatasetToQuads(_));const E=[];for(const v of _)E.push(Xn.serializeQuad(v));return E.sort().join("")}static serializeQuadComponents(_,E,v,x){let S="";return _.termType===n?S+=`<${_.value}>`:S+=`${_.value}`,S+=` <${E.value}> `,v.termType===n?S+=`<${v.value}>`:v.termType===i?S+=v.value:(S+=`"${c(v.value)}"`,v.datatype.value===e?v.language&&(S+=`@${v.language}`):v.datatype.value!==t&&(S+=`^^<${v.datatype.value}>`)),x.termType===n?S+=` <${x.value}>`:x.termType===i&&(S+=` ${x.value}`),S+=` .
|
|
335
|
+
`,S}static serializeQuad(_){return Xn.serializeQuadComponents(_.subject,_.predicate,_.object,_.graph)}static legacyDatasetToQuads(_){const E=[],v={"blank node":i,IRI:n,literal:s};for(const x in _)_[x].forEach(m=>{const d={};for(const g in m){const N=m[g],j={termType:v[N.type],value:N.value};j.termType===s&&(j.datatype={termType:n},"datatype"in N&&(j.datatype.value=N.datatype),"language"in N?("datatype"in N||(j.datatype.value=e),j.language=N.language):"datatype"in N||(j.datatype.value=t)),d[g]=j}x==="@default"?d.graph={termType:a,value:""}:d.graph={termType:x.startsWith("_:")?i:n,value:x},E.push(d)});return E}};function u(y,_){return!(y.subject.termType===_.subject.termType&&y.object.termType===_.object.termType)||!(y.subject.value===_.subject.value&&y.predicate.value===_.predicate.value&&y.object.value===_.object.value)?!1:y.object.termType!==s?!0:y.object.datatype.termType===_.object.datatype.termType&&y.object.language===_.object.language&&y.object.datatype.value===_.object.datatype.value}const l=/["\\\n\r]/g;function c(y){return y.replace(l,function(_){switch(_){case'"':return'\\"';case"\\":return"\\\\";case`
|
|
336
|
+
`:return"\\n";case"\r":return"\\r"}})}const h=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function b(y){return y.replace(h,function(_,E,v,x){if(E)switch(E){case"t":return" ";case"b":return"\b";case"n":return`
|
|
337
|
+
`;case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(v)return String.fromCharCode(parseInt(v,16));if(x)throw new Error("Unsupported U escape")})}return is}/*!
|
|
316
338
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
317
|
-
*/var
|
|
339
|
+
*/var ss,Rl;function Bc(){if(Rl)return ss;Rl=1;const r=Fa(),e=pi(),t=Mc(),n=ka();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}async main(a){this.deepIterations=new Map,this.quads=a;for(const y of a)this._addBlankNodeQuadInfo({quad:y,component:y.subject}),this._addBlankNodeQuadInfo({quad:y,component:y.object}),this._addBlankNodeQuadInfo({quad:y,component:y.graph});const o=new Map,u=[...this.blankNodeInfo.keys()];let l=0;for(const y of u)++l%100===0&&await this._yield(),await this._hashAndTrackBlankNode({id:y,hashToBlankNodes:o});const c=[...o.keys()].sort(),h=[];for(const y of c){const _=o.get(y);if(_.length>1){h.push(_);continue}const E=_[0];this.canonicalIssuer.getId(E)}for(const y of h){const _=[];for(const E of y){if(this.canonicalIssuer.hasId(E))continue;const v=new r("_:b");v.getId(E);const x=await this.hashNDegreeQuads(E,v);_.push(x)}_.sort(i);for(const E of _){const v=E.issuer.getOldIds();for(const x of v)this.canonicalIssuer.getId(x)}}const b=[];for(const y of this.quads){const _=n.serializeQuadComponents(this._componentWithCanonicalId(y.subject),y.predicate,this._componentWithCanonicalId(y.object),this._componentWithCanonicalId(y.graph));b.push(_)}return b.sort(),b.join("")}async hashFirstDegreeQuads(a){const o=[],u=this.blankNodeInfo.get(a),l=u.quads;for(const h of l){const b={subject:null,predicate:h.predicate,object:null,graph:null};b.subject=this.modifyFirstDegreeComponent(a,h.subject,"subject"),b.object=this.modifyFirstDegreeComponent(a,h.object,"object"),b.graph=this.modifyFirstDegreeComponent(a,h.graph,"graph"),o.push(n.serializeQuad(b))}o.sort();const c=this.createMessageDigest();for(const h of o)c.update(h);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 h=this.createMessageDigest();return h.update(l),l!=="g"&&h.update(this.getRelatedPredicate(o)),h.update(c),h.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),h=[...c.keys()].sort();for(const b of h){l.update(b);let y="",_;const E=new t(c.get(b));let v=0;for(;E.hasNext();){const x=E.next();++v%3===0&&await this._yield();let S=o.clone(),m="";const d=[];let g=!1;for(const N of x)if(this.canonicalIssuer.hasId(N)?m+=this.canonicalIssuer.getId(N):(S.hasId(N)||d.push(N),m+=S.getId(N)),y.length!==0&&m>y){g=!0;break}if(!g){for(const N of d){const j=await this.hashNDegreeQuads(N,S);if(m+=S.getId(N),m+=`<${j.hash}>`,S=j.issuer,y.length!==0&&m>y){g=!0;break}}g||(y.length===0||m<y)&&(y=m,_=S)}}l.update(y),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 h of l)++c%100===0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:h,component:h.subject,position:"s",id:a,issuer:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:h,component:h.object,position:"o",id:a,issuer:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:h,component:h.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:h}){if(!(o.termType==="BlankNode"&&o.value!==l))return;const b=o.value,y=await this.hashRelatedBlankNode(b,a,c,u),_=h.get(y);_?_.push(b):h.set(y,[b])}_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 ss}/*!
|
|
318
340
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
319
|
-
*/var
|
|
341
|
+
*/var as,Tl;function Ef(){if(Tl)return as;Tl=1;const r=pi(),e=Bc();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}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 h=await this.hashRelatedBlankNode(c,u,i,l),b=s.get(h);b?b.push(c):s.set(h,[c])}return s}},as}/*!
|
|
320
342
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
321
|
-
*/var
|
|
343
|
+
*/var os,Al;function qc(){if(Al)return os;Al=1;const r=Fa(),e=pi(),t=Mc(),n=ka();os=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 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()];for(const b of u)this._hashAndTrackBlankNode({id:b,hashToBlankNodes:o});const l=[...o.keys()].sort(),c=[];for(const b of l){const y=o.get(b);if(y.length>1){c.push(y);continue}const _=y[0];this.canonicalIssuer.getId(_)}for(const b of c){const y=[];for(const _ of b){if(this.canonicalIssuer.hasId(_))continue;const E=new r("_:b");E.getId(_);const v=this.hashNDegreeQuads(_,E);y.push(v)}y.sort(i);for(const _ of y){const E=_.issuer.getOldIds();for(const v of E)this.canonicalIssuer.getId(v)}}const h=[];for(const b of this.quads){const y=n.serializeQuadComponents(this._componentWithCanonicalId({component:b.subject}),b.predicate,this._componentWithCanonicalId({component:b.object}),this._componentWithCanonicalId({component:b.graph}));h.push(y)}return h.sort(),h.join("")}hashFirstDegreeQuads(a){const o=[],u=this.blankNodeInfo.get(a),l=u.quads;for(const h of l){const b={subject:null,predicate:h.predicate,object:null,graph:null};b.subject=this.modifyFirstDegreeComponent(a,h.subject,"subject"),b.object=this.modifyFirstDegreeComponent(a,h.object,"object"),b.graph=this.modifyFirstDegreeComponent(a,h.graph,"graph"),o.push(n.serializeQuad(b))}o.sort();const c=this.createMessageDigest();for(const h of o)c.update(h);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 h=this.createMessageDigest();return h.update(l),l!=="g"&&h.update(this.getRelatedPredicate(o)),h.update(c),h.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),h=[...c.keys()].sort();for(const b of h){l.update(b);let y="",_;const E=new t(c.get(b));for(;E.hasNext();){const v=E.next();let x=o.clone(),S="";const m=[];let d=!1;for(const g of v)if(this.canonicalIssuer.hasId(g)?S+=this.canonicalIssuer.getId(g):(x.hasId(g)||m.push(g),S+=x.getId(g)),y.length!==0&&S>y){d=!0;break}if(!d){for(const g of m){const N=this.hashNDegreeQuads(g,x);if(S+=x.getId(g),S+=`<${N.hash}>`,x=N.issuer,y.length!==0&&S>y){d=!0;break}}d||(y.length===0||S<y)&&(y=S,_=x)}}l.update(y),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:h}){if(!(o.termType==="BlankNode"&&o.value!==l))return;const b=o.value,y=this.hashRelatedBlankNode(b,a,c,u),_=h.get(y);_?_.push(b):h.set(y,[b])}_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 os}/*!
|
|
322
344
|
* Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
|
|
323
|
-
*/var os,Ol;function vf(){if(Ol)return os;Ol=1;const r=fi(),e=qc();return os=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}},os}const xf={},Ef=Object.freeze(Object.defineProperty({__proto__:null,default:xf},Symbol.toStringTag,{value:"Module"})),Sf=nd(Ef);var Ll;function If(){return Ll||(Ll=1,function(r){const e=Bc(),t=wf(),n=qc(),i=vf();let s;try{s=Sf}catch{}function a(o){return Array.isArray(o)?o:r.NQuads.legacyDatasetToQuads(o)}r.NQuads=ka(),r.IdentifierIssuer=Fa(),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,(b,y)=>b?d(b):c(y)))}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.")}}(Yi)),Yi}var ls,jl;function Pa(){return jl||(jl=1,ls=If()),ls}var us,Cl;function lt(){if(Cl)return us;Cl=1;const r={};return us=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",us}var cs,$l;function Ft(){if($l)return cs;$l=1;const r=lt(),e={};return cs=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},cs}var ds,Fl;function ft(){return Fl||(Fl=1,ds=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}}),ds}var hs,kl;function ct(){if(kl)return hs;kl=1;const r=Ft(),e=lt(),t=Pa().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={};hs=c,c.IdentifierIssuer=t,c.REGEX_BCP47=i,c.REGEX_KEYWORD=u,c.clone=function(b){if(b&&typeof b=="object"){let y;if(e.isArray(b)){y=[];for(let _=0;_<b.length;++_)y[_]=c.clone(b[_])}else if(b instanceof Map){y=new Map;for(const[_,E]of b)y.set(_,c.clone(E))}else if(b instanceof Set){y=new Set;for(const _ of b)y.add(c.clone(_))}else if(e.isObject(b)){y={};for(const _ in b)y[_]=c.clone(b[_])}else y=b.toString();return y}return b},c.asArray=function(b){return Array.isArray(b)?b:[b]},c.buildHeaders=(b={})=>{if(Object.keys(b).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},b)},c.parseLinkHeader=b=>{const y={},_=b.match(s);for(let E=0;E<_.length;++E){let v=_[E].match(a);if(!v)continue;const x={target:v[1]},S=v[2];for(;v=o.exec(S);)x[v[1]]=v[2]===void 0?v[3]:v[2];const m=x.rel||"";Array.isArray(y[m])?y[m].push(x):y.hasOwnProperty(m)?y[m]=[y[m],x]:y[m]=x}return y},c.validateTypeValue=(b,y)=>{if(!e.isString(b)&&!(e.isArray(b)&&b.every(_=>e.isString(_)))){if(y&&e.isObject(b))switch(Object.keys(b).length){case 0:return;case 1:if("@default"in b&&c.asArray(b["@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:b})}},c.hasProperty=(b,y)=>{if(b.hasOwnProperty(y)){const _=b[y];return!e.isArray(_)||_.length>0}return!1},c.hasValue=(b,y,_)=>{if(c.hasProperty(b,y)){let E=b[y];const v=r.isList(E);if(e.isArray(E)||v){v&&(E=E["@list"]);for(let x=0;x<E.length;++x)if(c.compareValues(_,E[x]))return!0}else if(!e.isArray(_))return c.compareValues(_,E)}return!1},c.addValue=(b,y,_,E)=>{if(E=E||{},"propertyIsArray"in E||(E.propertyIsArray=!1),"valueIsArray"in E||(E.valueIsArray=!1),"allowDuplicate"in E||(E.allowDuplicate=!0),"prependValue"in E||(E.prependValue=!1),E.valueIsArray)b[y]=_;else if(e.isArray(_)){_.length===0&&E.propertyIsArray&&!b.hasOwnProperty(y)&&(b[y]=[]),E.prependValue&&(_=_.concat(b[y]),b[y]=[]);for(let v=0;v<_.length;++v)c.addValue(b,y,_[v],E)}else if(b.hasOwnProperty(y)){const v=!E.allowDuplicate&&c.hasValue(b,y,_);!e.isArray(b[y])&&(!v||E.propertyIsArray)&&(b[y]=[b[y]]),v||(E.prependValue?b[y].unshift(_):b[y].push(_))}else b[y]=E.propertyIsArray?[_]:_},c.getValues=(b,y)=>[].concat(b[y]||[]),c.removeProperty=(b,y)=>{delete b[y]},c.removeValue=(b,y,_,E)=>{E=E||{},"propertyIsArray"in E||(E.propertyIsArray=!1);const v=c.getValues(b,y).filter(x=>!c.compareValues(x,_));v.length===0?c.removeProperty(b,y):v.length===1&&!E.propertyIsArray?b[y]=v[0]:b[y]=v},c.relabelBlankNodes=(b,y)=>{y=y||{};const _=y.issuer||new t("_:b");return d(_,b)},c.compareValues=(b,y)=>b===y||r.isValue(b)&&r.isValue(y)&&b["@value"]===y["@value"]&&b["@type"]===y["@type"]&&b["@language"]===y["@language"]&&b["@index"]===y["@index"]?!0:e.isObject(b)&&"@id"in b&&e.isObject(y)&&"@id"in y?b["@id"]===y["@id"]:!1,c.compareShortestLeast=(b,y)=>b.length<y.length?-1:y.length<b.length?1:b===y?0:b<y?-1:1;function d(b,y){if(e.isArray(y))for(let _=0;_<y.length;++_)y[_]=d(b,y[_]);else if(r.isList(y))y["@list"]=d(b,y["@list"]);else if(e.isObject(y)){r.isBlankNode(y)&&(y["@id"]=b.getId(y["@id"]));const _=Object.keys(y).sort();for(let E=0;E<_.length;++E){const v=_[E];v!=="@id"&&(y[v]=d(b,y[v]))}}return y}return hs}var fs,Pl;function Ma(){if(Pl)return fs;Pl=1;const r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",e="http://www.w3.org/2001/XMLSchema#";return fs={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"},fs}var ps,Ml;function Uc(){return Ml||(Ml=1,ps=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]}}}),ps}var gs,Bl;function Qt(){if(Bl)return gs;Bl=1;const r=lt(),e={};gs=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),gs}var ms,ql;function Nf(){if(ql)return ms;ql=1;const{parseLinkHeader:r,buildHeaders:e}=ct(),{LINK_HEADER_CONTEXT:t}=Ma(),n=ft(),i=Uc(),{prependBase:s}=Qt(),a=/(^|(\r\n))link:/i;ms=({secure:u,headers:l={},xhr:c}={headers:{}})=>{return l=e(l),new i().wrapLoader(b);async function b(y){if(y.indexOf("http:")!==0&&y.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:y});if(u&&y.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:y});let _;try{_=await o(c,y,l)}catch(m){throw new n("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:y,cause:m})}if(_.status>=400)throw new n("URL could not be dereferenced: "+_.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:y,httpStatusCode:_.status});let E={contextUrl:null,documentUrl:y,document:_.response},v=null;const x=_.getResponseHeader("Content-Type");let S;if(a.test(_.getAllResponseHeaders())&&(S=_.getResponseHeader("Link")),S&&x!=="application/ld+json"){const m=r(S),h=m[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:y});h&&(E.contextUrl=h.target),v=m.alternate,v&&v.type=="application/ld+json"&&!(x||"").match(/^application\/(\w*\+)?json$/)&&(E=await b(s(y,v.target)))}return E}};function o(u,l,c){u=u||XMLHttpRequest;const d=new u;return new Promise((b,y)=>{d.onload=()=>b(d),d.onerror=_=>y(_),d.open("GET",l,!0);for(const _ in c)d.setRequestHeader(_,c[_]);d.send()})}return ms}var ys,Ul;function Rf(){if(Ul)return ys;Ul=1;const r=Nf(),e={};return ys=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})},ys}var bs,Hl;function Tf(){return Hl||(Hl=1,bs=function(r){r.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),bs}var _s,Vl;function Af(){if(Vl)return _s;Vl=1,_s=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{Tf()(r)}catch{}return _s}var ws,Gl;function Hc(){if(Gl)return ws;Gl=1;const r=Af(),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 b{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,E(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,E(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})),E(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 N=this[u].tail;N!==null;){const j=N.prev;S(this,h,N,g),N=j}}forEach(h,g){g=g||this;for(let N=this[u].head;N!==null;){const j=N.next;S(this,h,N,g),N=j}}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,N){if(N=N||this[s],N&&typeof N!="number")throw new TypeError("maxAge must be a number");const j=N?Date.now():0,A=this[n](g,h);if(this[l].has(h)){if(A>this[e])return v(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=j,F.maxAge=N,F.value=g,this[t]+=A-F.length,F.length=A,this.get(h),E(this),!0}const B=new x(h,g,A,j,N);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),E(this),!0)}has(h){if(!this[l].has(h))return!1;const g=this[l].get(h).value;return!_(this,g)}get(h){return y(this,h,!0)}peek(h){return y(this,h,!1)}pop(){const h=this[u].tail;return h?(v(this,h),h.value):null}del(h){v(this,this[l].get(h))}load(h){this.reset();const g=Date.now();for(let N=h.length-1;N>=0;N--){const j=h[N],A=j.e||0;if(A===0)this.set(j.k,j.v);else{const B=A-g;B>0&&this.set(j.k,j.v,B)}}}prune(){this[l].forEach((h,g)=>y(this,g,!1))}}const y=(m,h,g)=>{const N=m[l].get(h);if(N){const j=N.value;if(_(m,j)){if(v(m,N),!m[i])return}else g&&(m[c]&&(N.value.now=Date.now()),m[u].unshiftNode(N));return j.value}},_=(m,h)=>{if(!h||!h.maxAge&&!m[s])return!1;const g=Date.now()-h.now;return h.maxAge?g>h.maxAge:m[s]&&g>m[s]},E=m=>{if(m[t]>m[e])for(let h=m[u].tail;m[t]>m[e]&&h!==null;){const g=h.prev;v(m,h),h=g}},v=(m,h)=>{if(h){const g=h.value;m[a]&&m[a](g.key,g.value),m[t]-=g.length,m[l].delete(g.key),m[u].removeNode(h)}};class x{constructor(h,g,N,j,A){this.key=h,this.value=g,this.length=N,this.now=j,this.maxAge=A||0}}const S=(m,h,g,N)=>{let j=g.value;_(m,j)&&(v(m,g),m[i]||(j=void 0)),j&&h.call(N,j.value,j.key,m)};return ws=b,ws}var vs,Wl;function Df(){if(Wl)return vs;Wl=1;const r=Hc(),e=10;return vs=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)}},vs}var xs,zl;function Of(){if(zl)return xs;zl=1;const{isArray:r,isObject:e,isString:t}=lt(),{asArray:n}=ct(),{prependBase:i}=Qt(),s=ft(),a=Df(),o=10;xs=class{constructor({sharedCache:d}){this.perOpCache=new Map,this.sharedCache=d}async resolve({activeCtx:d,context:b,documentLoader:y,base:_,cycles:E=new Set}){b&&e(b)&&b["@context"]&&(b=b["@context"]),b=n(b);const v=[];for(const x of b){if(t(x)){let h=this._get(x);h||(h=await this._resolveRemoteContext({activeCtx:d,url:x,documentLoader:y,base:_,cycles:E})),r(h)?v.push(...h):v.push(h);continue}if(x===null){v.push(new a({document:null}));continue}e(x)||u(b);const S=JSON.stringify(x);let m=this._get(S);m||(m=new a({document:x}),this._cacheResolvedContext({key:S,resolved:m,tag:"static"})),v.push(m)}return v}_get(d){let b=this.perOpCache.get(d);if(!b){const y=this.sharedCache.get(d);y&&(b=y.get("static"),b&&this.perOpCache.set(d,b))}return b}_cacheResolvedContext({key:d,resolved:b,tag:y}){if(this.perOpCache.set(d,b),y!==void 0){let _=this.sharedCache.get(d);_||(_=new Map,this.sharedCache.set(d,_)),_.set(y,b)}return b}async _resolveRemoteContext({activeCtx:d,url:b,documentLoader:y,base:_,cycles:E}){b=i(_,b);const{context:v,remoteDoc:x}=await this._fetchContext({activeCtx:d,url:b,documentLoader:y,cycles:E});_=x.documentUrl||b,l({context:v,base:_});const S=await this.resolve({activeCtx:d,context:v,documentLoader:y,base:_,cycles:E});return this._cacheResolvedContext({key:b,resolved:S,tag:x.tag}),S}async _fetchContext({activeCtx:d,url:b,documentLoader:y,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(b))throw new s("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:d.processingMode==="json-ld-1.0"?"recursive context inclusion":"context overflow",url:b});_.add(b);let E,v;try{v=await y(b),E=v.document||null,t(E)&&(E=JSON.parse(E))}catch(x){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: "${b}".`,"jsonld.InvalidUrl",{code:"loading remote context failed",url:b,cause:x})}if(!e(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: "${b}".`,"jsonld.InvalidUrl",{code:"invalid remote context",url:b});return"@context"in E?E={"@context":E["@context"]}:E={"@context":{}},v.contextUrl&&(r(E["@context"])||(E["@context"]=[E["@context"]]),E["@context"].push(v.contextUrl)),{context:E,remoteDoc:v}}};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 b=c["@context"];if(t(b)){c["@context"]=i(d,b);return}if(r(b)){for(let y=0;y<b.length;++y){const _=b[y];if(t(_)){b[y]=i(d,_);continue}e(_)&&l({context:{"@context":_},base:d})}return}if(e(b))for(const y in b)l({context:b[y],base:d})}return xs}var Es,Ql;function Lf(){return Ql||(Ql=1,Es=Pa().NQuads),Es}var Ss,Xl;function Rn(){if(Xl)return Ss;Xl=1;const r=ft(),{isArray:e}=lt(),{asArray:t}=ct(),n={};Ss=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},Ss}var Is,Jl;function ur(){if(Jl)return Is;Jl=1;const r=ct(),e=ft(),{isArray:t,isObject:n,isString:i,isUndefined:s}=lt(),{isAbsolute:a,isRelative:o,prependBase:u}=Qt(),{handleEvent:l}=Rn(),{REGEX_BCP47:c,REGEX_KEYWORD:d,asArray:b,compareShortestLeast:y}=ct(),_=new Map,E=1e4,v={};Is=v,v.process=async({activeCtx:m,localCtx:h,options:g,propagate:N=!0,overrideProtected:j=!1,cycles:A=new Set})=>{if(n(h)&&"@context"in h&&t(h["@context"])&&(h=h["@context"]),b(h).length===0)return m;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:m,context:h,documentLoader:g.documentLoader,base:g.base});n(D[0].document)&&typeof D[0].document["@propagate"]=="boolean"&&(N=D[0].document["@propagate"]);let O=m;!N&&!O.previousContext&&(O=O.clone(),O.previousContext=m);for(const te of D){let{document:T}=te;if(m=O,T===null){if(!j&&Object.keys(m.protected).length!==0)throw new e("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});O=m=v.getInitialContext(g).clone();continue}const Z=te.getProcessed(m);if(Z){if(q.eventHandler)for(const Y of Z.events)l({event:Y,options:q});O=m=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(m.processingMode&&m.processingMode==="json-ld-1.0")throw new e("@version: "+T["@version"]+" not compatible with "+m.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||m.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)&&v.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=x(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(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @direction not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context: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(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @propagate not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context: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(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @import not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context: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:m,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(m);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 Q in K)T.hasOwnProperty(Q)||(T[Q]=K[Q]);w[0].setProcessed(m,T)}k.set("@import",!0)}k.set("@protected",T["@protected"]||!1);for(const Y in T)if(v.createTermDefinition({activeCtx:O,localCtx:T,term:Y,defined:k,options:g,overrideProtected:j}),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 v.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(m,{context:O,events:R})}return O},v.createTermDefinition=({activeCtx:m,localCtx:h,term:g,defined:N,options:j,overrideProtected:A=!1})=>{if(N.has(g)){if(N.get(g))return;throw new e("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:h,term:g})}N.set(g,!1);let B;if(h.hasOwnProperty(g)&&(B=h[g]),g==="@type"&&n(B)&&(B["@container"]||"@set")==="@set"&&v.processingMode(m,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(v.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)){j.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:j});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=m.mappings.get(g);m.mappings.has(g)&&m.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={};m.mappings.set(g,q),q.reverse=!1;const D=["@container","@id","@language","@reverse","@type"];v.processingMode(m,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)){j.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:j}),R?m.mappings.set(g,R):m.mappings.delete(g);return}const Z=x(m,T,{vocab:!0,base:!1},h,N,j);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(!v.isKeyword(T)&&T.match(d)){j.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:j}),R?m.mappings.set(g,R):m.mappings.delete(g);return}else if(T!==g){if(T=x(m,T,{vocab:!0,base:!1},h,N,j),!a(T)&&!v.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(N).set(g,!0);if(x(m,g,{vocab:!0,base:!1},h,Z,j)!==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)&&v.createTermDefinition({activeCtx:m,localCtx:h,term:T,defined:N,options:j}),m.mappings.has(T)){const Z=g.substr(O+1);q["@id"]=m.mappings.get(T)["@id"]+Z}else q["@id"]=g}else if(g==="@type")q["@id"]=g;else{if(!("@vocab"in m))throw new e("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:h,term:g});q["@id"]=m["@vocab"]+g}if((B["@protected"]===!0||N.get("@protected")===!0&&B["@protected"]!==!1)&&(m.protected[g]=!0,q.protected=!0),N.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(v.processingMode(m,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=x(m,T,{vocab:!0,base:!1},h,N,j),!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(v.processingMode(m,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(v.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&&(m.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})},v.expandIri=(m,h,g,N)=>x(m,h,g,void 0,void 0,N);function x(m,h,g,N,j,A){if(h===null||!i(h)||v.isKeyword(h))return h;if(h.match(d))return null;if(N&&N.hasOwnProperty(h)&&j.get(h)!==!0&&v.createTermDefinition({activeCtx:m,localCtx:N,term:h,defined:j,options:A}),g=g||{},g.vocab){const R=m.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;N&&N.hasOwnProperty(R)&&v.createTermDefinition({activeCtx:m,localCtx:N,term:R,defined:j,options:A});const q=m.mappings.get(R);if(q&&q._prefix)return q["@id"]+F;if(a(h))return h}if(g.vocab&&"@vocab"in m)h=m["@vocab"]+h;else if(g.base){let R,F;"@base"in m?m["@base"]?(F=u(A.base,m["@base"]),R=u(F,h)):(F=m["@base"],R=h):(F=A.base,R=u(A.base,h)),h=R}return h}v.getInitialContext=m=>{const h=JSON.stringify({processingMode:m.processingMode}),g=_.get(h);if(g)return g;const N={processingMode:m.processingMode,mappings:new Map,inverse:null,getInverse:j,clone:R,revertToPreviousContext:F,protected:{}};return _.size===E&&_.clear(),_.set(h,N),N;function j(){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(y);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 Q=b(H["@id"]);for(const ue of Q){let V=D[ue];const G=v.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}},v.getContextValue=(m,h,g)=>{if(h===null)return g==="@context"?void 0:null;if(m.mappings.has(h)){const N=m.mappings.get(h);if(s(g))return N;if(N.hasOwnProperty(g))return N[g]}if(g==="@language"&&g in m||g==="@direction"&&g in m)return m[g];if(g!=="@context")return null},v.processingMode=(m,h)=>h.toString()>="1.1"?!m.processingMode||m.processingMode>="json-ld-"+h.toString():m.processingMode==="json-ld-1.0",v.isKeyword=m=>{if(!i(m)||m[0]!=="@")return!1;switch(m){case"@base":case"@container":case"@context":case"@default":case"@direction":case"@embed":case"@explicit":case"@graph":case"@id":case"@included":case"@index":case"@json":case"@language":case"@list":case"@nest":case"@none":case"@omitDefault":case"@prefix":case"@preserve":case"@protected":case"@requireAll":case"@reverse":case"@set":case"@type":case"@value":case"@version":case"@vocab":return!0}return!1};function S(m,h){if(!(m&&typeof m=="object")||!(h&&typeof h=="object"))return m===h;const g=Array.isArray(m);if(g!==Array.isArray(h))return!1;if(g){if(m.length!==h.length)return!1;for(let A=0;A<m.length;++A)if(!S(m[A],h[A]))return!1;return!0}const N=Object.keys(m),j=Object.keys(h);if(N.length!==j.length)return!1;for(const A in m){let B=m[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 Is}var Ns,Kl;function jf(){if(Kl)return Ns;Kl=1;const r=ft(),{isArray:e,isObject:t,isEmptyObject:n,isString:i,isUndefined:s}=lt(),{isList:a,isValue:o,isGraph:u,isSubject:l}=Ft(),{expandIri:c,getContextValue:d,isKeyword:b,process:y,processingMode:_}=ur(),{isAbsolute:E}=Qt(),{REGEX_BCP47:v,REGEX_KEYWORD:x,addValue:S,asArray:m,getValues:h,validateTypeValue:g}=ct(),{handleEvent:N}=Rn(),j={};Ns=j,j.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&&N({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 j.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(),Q=!k;if(Q&&Y&&K.length<=2&&!K.includes("@context"))for(const z of K){const U=c(Y,z,{vocab:!0},T);if(U==="@value"){Q=!1,D=Y;break}if(U==="@id"&&K.length===1){Q=!1;break}}Q&&(D=D.revertToPreviousContext()),s(H)||(D=await y({activeCtx:D,localCtx:H,propagate:!0,overrideProtected:!0,options:T})),"@context"in te&&(D=await y({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 y({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?[]:m(V["@value"]),ee=h(V,"@type");if(!(_(D,1.1)&&ee.includes("@json")&&ee.length===1))if(U.length===0)T.eventHandler&&N({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=>E(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&&N({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."),N({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(),Q=[];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||!(E(ee)||b(ee))){k.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:G,expandedProperty:ee}},options:k});continue}if(b(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(C=>i(C)))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",m(z).map(C=>{if(i(C)){const W=c(D,C,{base:!0},k);return k.eventHandler&&(W===null?N(C===null?{event:{type:["JsonLdEvent"],code:"null @id value",level:"warning",message:"Null @id found.",details:{id:C}},options:k}:{event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:C}},options:k}):E(W)||N({event:{type:["JsonLdEvent"],code:"relative @id reference",level:"warning",message:"Relative @id reference found.",details:{id:C,expandedId:W}},options:k})),W}return C}),{propertyIsArray:k.isFrame});continue}if(ee==="@type"){t(z)&&(z=Object.fromEntries(Object.entries(z).map(([C,W])=>[c(H,C,{vocab:!0}),m(W).map(se=>c(H,se,{base:!0,vocab:!0},{...k,typeExpansion:!0}))]))),g(z,k.isFrame),S(Z,"@type",m(z).map(C=>{if(i(C)){const W=c(H,C,{base:!0,vocab:!0},{...k,typeExpansion:!0});return W!=="@json"&&!E(W)&&k.eventHandler&&N({event:{type:["JsonLdEvent"],code:"relative @type reference",level:"warning",message:"Relative @type reference found.",details:{type:C}},options:k}),W}return C}),{propertyIsArray:!!k.isFrame});continue}if(ee==="@included"&&_(D,1.1)){const C=m(await j.expand({activeCtx:D,activeProperty:O,element:z,options:k}));if(!C.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",C,{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=m(z).map(C=>i(C)?C.toLowerCase():C);for(const C of z)i(C)&&!C.match(v)&&k.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:C}},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=m(z);for(const C of z)if(i(C)&&C!=="ltr"&&C!=="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 j.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 C=Z["@reverse"]||null;for(const W in U){if(W==="@reverse")continue;C===null&&(C=Z["@reverse"]={}),S(C,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(C,W,pe,{propertyIsArray:!0})}}continue}if(ee==="@nest"){Q.push(G);continue}let re=D;const fe=d(D,G,"@context");s(fe)||(re=await y({activeCtx:D,localCtx:fe,propagate:!0,overrideProtected:!0,options:k}));const ge=d(D,G,"@container")||[];if(ge.includes("@language")&&t(z)){const C=d(re,G,"@direction");U=F(re,z,C,k)}else if(ge.includes("@index")&&t(z)){const C=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:C,indexKey:W,propertyIndex:se})}else if(ge.includes("@id")&&t(z)){const C=ge.includes("@graph");U=await q({activeCtx:re,options:k,activeProperty:G,value:z,asGraph:C,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 C=ee==="@list";if(C||ee==="@set"){let W=O;C&&te==="@graph"&&(W=null),U=await j.expand({activeCtx:re,activeProperty:W,element:z,options:k,insideList:C})}else d(D,G,"@type")==="@json"?U={"@type":"@json","@value":z}:U=await j.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":m(U)}),ge.includes("@graph")&&!ge.some(C=>C==="@id"||C==="@index")){if(U=m(U),k.isFrame||(U=U.filter(C=>{const W=Object.keys(C).length;return A({value:C,count:W,options:k})!==null})),U.length===0)continue;U=U.map(C=>({"@graph":m(C)}))}if(re.mappings.has(G)&&re.mappings.get(G).reverse){const C=Z["@reverse"]=Z["@reverse"]||{};U=m(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(C,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 Q){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(x)&&T.eventHandler&&N({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(b(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 Q={"@value":K};w!=="@none"&&(Y.match(v)||T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:Y}},options:T}),Q["@language"]=Y.toLowerCase()),te&&(Q["@direction"]=te),Z.push(Q)}}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 Q of H){if(K){const G=d(D,Q,"@context");s(G)||(D=await y({activeCtx:D,localCtx:G,propagate:!1,options:O}))}let ue=T[Q];e(ue)||(ue=[ue]),ue=await j.expand({activeCtx:D,activeProperty:te,element:ue,options:O,insideList:!1,insideIndex:!0});let V;Y?Q==="@none"?V="@none":V=R({activeCtx:D,activeProperty:k,value:Q,options:O}):V=c(D,Q,{vocab:!0},O),k==="@id"?Q=c(D,Q,{base:!0},O):K&&(Q=V);for(let G of ue){if(Z&&!u(G)&&(G={"@graph":[G]}),k==="@type")V==="@none"||(G["@type"]?G["@type"]=[Q].concat(G["@type"]):G["@type"]=[Q]);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]=Q)}w.push(G)}}return w}return Ns}var Rs,Yl;function pi(){if(Yl)return Rs;Yl=1;const{isKeyword:r}=ur(),e=Ft(),t=lt(),n=ct(),i=ft(),s={};return Rs=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 E of a)s.createNodeMap(E,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 E=a["@type"];E.indexOf("_:")===0&&(a["@type"]=E=l.getId(E))}d&&d.push(a);return}else if(d&&e.isList(a)){const E=[];s.createNodeMap(a["@list"],o,u,l,c,E),d.push({"@list":E});return}if("@type"in a){const E=a["@type"];for(const v of E)v.indexOf("_:")===0&&l.getId(v)}t.isUndefined(c)&&(c=e.isBlankNode(a)?l.getId(a["@id"]):a["@id"]),d&&d.push({"@id":c});const b=o[u],y=b[c]=b[c]||{};y["@id"]=c;const _=Object.keys(a).sort();for(let E of _){if(E==="@id")continue;if(E==="@reverse"){const x={"@id":c},S=a["@reverse"];for(const m in S){const h=S[m];for(const g of h){let N=g["@id"];e.isBlankNode(g)&&(N=l.getId(N)),s.createNodeMap(g,o,u,l,N),n.addValue(b[N],m,x,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(E==="@graph"){c in o||(o[c]={}),s.createNodeMap(a[E],o,c,l);continue}if(E==="@included"){s.createNodeMap(a[E],o,u,l);continue}if(E!=="@type"&&r(E)){if(E==="@index"&&E in y&&(a[E]!==y[E]||a[E]["@id"]!==y[E]["@id"]))throw new i("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:y});y[E]=a[E];continue}const v=a[E];if(E.indexOf("_:")===0&&(E=l.getId(E)),v.length===0){n.addValue(y,E,[],{propertyIsArray:!0});continue}for(let x of v)if(E==="@type"&&(x=x.indexOf("_:")===0?l.getId(x):x),e.isSubject(x)||e.isSubjectReference(x)){if("@id"in x&&!x["@id"])continue;const S=e.isBlankNode(x)?l.getId(x["@id"]):x["@id"];n.addValue(y,E,{"@id":S},{propertyIsArray:!0,allowDuplicate:!1}),s.createNodeMap(x,o,u,l,S)}else if(e.isValue(x))n.addValue(y,E,x,{propertyIsArray:!0,allowDuplicate:!1});else if(e.isList(x)){const S=[];s.createNodeMap(x["@list"],o,u,l,c,S),x={"@list":S},n.addValue(y,E,x,{propertyIsArray:!0,allowDuplicate:!1})}else s.createNodeMap(x,o,u,l,c),n.addValue(y,E,x,{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 b of Object.keys(c).sort())if(r(b)&&b!=="@type")d[b]=n.clone(c[b]);else for(const y of c[b])n.addValue(d,b,n.clone(y),{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 b=d["@graph"];for(const y of Object.keys(c).sort()){const _=c[y];e.isSubjectReference(_)||b.push(_)}}return o},Rs}var Ts,Zl;function Cf(){if(Zl)return Ts;Zl=1;const{isSubjectReference:r}=Ft(),{createMergedNodeMap:e}=pi(),t={};return Ts=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},Ts}var As,eu;function $f(){if(eu)return As;eu=1;const r=ft(),e=Ft(),t=lt(),{REGEX_BCP47:n,addValue:i}=ct(),{handleEvent:s}=Rn(),{RDF_LIST:a,RDF_FIRST:o,RDF_REST:u,RDF_NIL:l,RDF_TYPE:c,RDF_JSON_LITERAL:d,XSD_BOOLEAN:b,XSD_DOUBLE:y,XSD_INTEGER:_,XSD_STRING:E}=Ma(),v={};As=v,v.fromRDF=async(S,m)=>{const{useRdfType:h=!1,useNativeTypes:g=!1,rdfDirection:N=null}=m,j={},A={"@default":j},B={};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 q of S){const D=q.graph.termType==="DefaultGraph"?"@default":q.graph.value;D in A||(A[D]={}),D!=="@default"&&!(D in j)&&(j[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=x(Z,g,N,m);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(j).sort();for(const q of F){const D=j[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 x(S,m,h,g){if(S.termType.endsWith("Node"))return{"@id":S.value};const N={"@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}),N["@language"]=S.language;else{let j=S.datatype.value;if(j||(j=E),j===d){j="@json";try{N["@value"]=JSON.parse(N["@value"])}catch(A){throw new r("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:N["@value"],cause:A})}}if(m){if(j===b)N["@value"]==="true"?N["@value"]=!0:N["@value"]==="false"&&(N["@value"]=!1);else if(t.isNumeric(N["@value"]))if(j===_){const A=parseInt(N["@value"],10);A.toFixed(0)===N["@value"]&&(N["@value"]=A)}else j===y&&(N["@value"]=parseFloat(N["@value"]));[b,_,y,E].includes(j)||(N["@type"]=j)}else if(h==="i18n-datatype"&&j.startsWith("https://www.w3.org/ns/i18n#")){const[,A,B]=j.split(/[#_]/);A.length>0&&(N["@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})),N["@direction"]=B}else j!==E&&(N["@type"]=j)}return N}return As}var Ds,tu;function Ff(){return tu||(tu=1,Ds=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])},"")+"}"}),Ds}var Os,ru;function kf(){if(ru)return Os;ru=1;const{createNodeMap:r}=pi(),{isKeyword:e}=ur(),t=Ft(),n=Ff(),i=ft(),s=lt(),a=ct(),{handleEvent:o}=Rn(),{RDF_FIRST:u,RDF_REST:l,RDF_NIL:c,RDF_TYPE:d,RDF_JSON_LITERAL:b,RDF_LANGSTRING:y,XSD_BOOLEAN:_,XSD_DOUBLE:E,XSD_INTEGER:v,XSD_STRING:x}=Ma(),{isAbsolute:S}=Qt(),m={};Os=m,m.toRDF=(j,A)=>{const B=new a.IdentifierIssuer("_:b"),R={"@default":{}};r(j,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(j,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=N(k,R,j,B,F.rdfDirection,F);H&&j.push({subject:Y,predicate:w,object:H,graph:B})}}}}function g(j,A,B,R,F,q){const D={termType:"NamedNode",value:u},O={termType:"NamedNode",value:l},te={termType:"NamedNode",value:c},T=j.pop(),Z=T?{termType:"BlankNode",value:A.getId()}:te;let k=Z;for(const Y of j){const w=N(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=N(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 N(j,A,B,R,F,q){const D={};if(t.isValue(j)){D.termType="Literal",D.value=void 0,D.datatype={termType:"NamedNode"};let O=j["@value"];const te=j["@type"]||null;if(te==="@json")D.value=n(O),D.datatype.value=b;else if(s.isBoolean(O))D.value=O.toString(),D.datatype.value=te||_;else if(s.isDouble(O)||te===E)s.isDouble(O)||(O=parseFloat(O)),D.value=O.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),D.datatype.value=te||E;else if(s.isNumber(O))D.value=O.toFixed(0),D.datatype.value=te||v;else if("@direction"in j&&F==="i18n-datatype"){const T=(j["@language"]||"").toLowerCase(),Z=j["@direction"],k=`https://www.w3.org/ns/i18n#${T}_${Z}`;D.datatype.value=k,D.value=O}else{if("@direction"in j&&F==="compound-literal")throw new i("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:F});if("@direction"in j&&F)throw new i("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:F});"@language"in j?("@direction"in j&&!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||y,D.language=j["@language"]):("@direction"in j&&!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||x)}}else if(t.isList(j)){const O=g(j["@list"],A,B,R,F,q);D.termType=O.termType,D.value=O.value}else{const O=s.isObject(j)?j["@id"]:j;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 Os}var Ls,nu;function Pf(){if(nu)return Ls;nu=1;const{isKeyword:r}=ur(),e=Ft(),t=lt(),n=ct(),i=Qt(),s=ft(),{createNodeMap:a,mergeNodeMapGraphs:o}=pi(),u={};Ls=u,u.frameMergedOrDefault=(h,g,N)=>{const j={options:N,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},A=new n.IdentifierIssuer("_:b");a(h,j.graphMap,"@default",A),N.merged&&(j.graphMap["@merged"]=o(j.graphMap),j.graph="@merged"),j.subjects=j.graphMap[j.graph];const B=[];u.frame(j,Object.keys(j.subjects).sort(),g,B),N.pruneBlankNodeIdentifiers&&(N.bnodesToClear=Object.keys(j.bnodeMap).filter(R=>j.bnodeMap[R].length===1));// remove @preserve from results
|
|
325
|
-
return N.link={},v(B,N)},u.frame=(
|
|
345
|
+
*/var ls,Dl;function Sf(){if(Dl)return ls;Dl=1;const r=pi(),e=qc();return ls=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),h=s.get(c);h?h.push(l):s.set(c,[l])}return s}},ls}const If={},Nf=Object.freeze(Object.defineProperty({__proto__:null,default:If},Symbol.toStringTag,{value:"Module"})),Rf=nd(Nf);var Ll;function Tf(){return Ll||(Ll=1,function(r){const e=Bc(),t=Ef(),n=qc(),i=Sf();let s;try{s=Rf}catch{}function a(o){return Array.isArray(o)?o:r.NQuads.legacyDatasetToQuads(o)}r.NQuads=ka(),r.IdentifierIssuer=Fa(),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,h)=>s.canonize(l,u,(b,y)=>b?h(b):c(y)))}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.")}}(Zi)),Zi}var us,Ol;function Pa(){return Ol||(Ol=1,us=Tf()),us}var cs,jl;function ut(){if(jl)return cs;jl=1;const r={};return cs=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",cs}var ds,Cl;function kt(){if(Cl)return ds;Cl=1;const r=ut(),e={};return ds=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},ds}var hs,$l;function gt(){return $l||($l=1,hs=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}}),hs}var fs,Fl;function ht(){if(Fl)return fs;Fl=1;const r=kt(),e=ut(),t=Pa().IdentifierIssuer,n=gt(),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={};fs=c,c.IdentifierIssuer=t,c.REGEX_BCP47=i,c.REGEX_KEYWORD=u,c.clone=function(b){if(b&&typeof b=="object"){let y;if(e.isArray(b)){y=[];for(let _=0;_<b.length;++_)y[_]=c.clone(b[_])}else if(b instanceof Map){y=new Map;for(const[_,E]of b)y.set(_,c.clone(E))}else if(b instanceof Set){y=new Set;for(const _ of b)y.add(c.clone(_))}else if(e.isObject(b)){y={};for(const _ in b)y[_]=c.clone(b[_])}else y=b.toString();return y}return b},c.asArray=function(b){return Array.isArray(b)?b:[b]},c.buildHeaders=(b={})=>{if(Object.keys(b).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},b)},c.parseLinkHeader=b=>{const y={},_=b.match(s);for(let E=0;E<_.length;++E){let v=_[E].match(a);if(!v)continue;const x={target:v[1]},S=v[2];for(;v=o.exec(S);)x[v[1]]=v[2]===void 0?v[3]:v[2];const m=x.rel||"";Array.isArray(y[m])?y[m].push(x):y.hasOwnProperty(m)?y[m]=[y[m],x]:y[m]=x}return y},c.validateTypeValue=(b,y)=>{if(!e.isString(b)&&!(e.isArray(b)&&b.every(_=>e.isString(_)))){if(y&&e.isObject(b))switch(Object.keys(b).length){case 0:return;case 1:if("@default"in b&&c.asArray(b["@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:b})}},c.hasProperty=(b,y)=>{if(b.hasOwnProperty(y)){const _=b[y];return!e.isArray(_)||_.length>0}return!1},c.hasValue=(b,y,_)=>{if(c.hasProperty(b,y)){let E=b[y];const v=r.isList(E);if(e.isArray(E)||v){v&&(E=E["@list"]);for(let x=0;x<E.length;++x)if(c.compareValues(_,E[x]))return!0}else if(!e.isArray(_))return c.compareValues(_,E)}return!1},c.addValue=(b,y,_,E)=>{if(E=E||{},"propertyIsArray"in E||(E.propertyIsArray=!1),"valueIsArray"in E||(E.valueIsArray=!1),"allowDuplicate"in E||(E.allowDuplicate=!0),"prependValue"in E||(E.prependValue=!1),E.valueIsArray)b[y]=_;else if(e.isArray(_)){_.length===0&&E.propertyIsArray&&!b.hasOwnProperty(y)&&(b[y]=[]),E.prependValue&&(_=_.concat(b[y]),b[y]=[]);for(let v=0;v<_.length;++v)c.addValue(b,y,_[v],E)}else if(b.hasOwnProperty(y)){const v=!E.allowDuplicate&&c.hasValue(b,y,_);!e.isArray(b[y])&&(!v||E.propertyIsArray)&&(b[y]=[b[y]]),v||(E.prependValue?b[y].unshift(_):b[y].push(_))}else b[y]=E.propertyIsArray?[_]:_},c.getValues=(b,y)=>[].concat(b[y]||[]),c.removeProperty=(b,y)=>{delete b[y]},c.removeValue=(b,y,_,E)=>{E=E||{},"propertyIsArray"in E||(E.propertyIsArray=!1);const v=c.getValues(b,y).filter(x=>!c.compareValues(x,_));v.length===0?c.removeProperty(b,y):v.length===1&&!E.propertyIsArray?b[y]=v[0]:b[y]=v},c.relabelBlankNodes=(b,y)=>{y=y||{};const _=y.issuer||new t("_:b");return h(_,b)},c.compareValues=(b,y)=>b===y||r.isValue(b)&&r.isValue(y)&&b["@value"]===y["@value"]&&b["@type"]===y["@type"]&&b["@language"]===y["@language"]&&b["@index"]===y["@index"]?!0:e.isObject(b)&&"@id"in b&&e.isObject(y)&&"@id"in y?b["@id"]===y["@id"]:!1,c.compareShortestLeast=(b,y)=>b.length<y.length?-1:y.length<b.length?1:b===y?0:b<y?-1:1;function h(b,y){if(e.isArray(y))for(let _=0;_<y.length;++_)y[_]=h(b,y[_]);else if(r.isList(y))y["@list"]=h(b,y["@list"]);else if(e.isObject(y)){r.isBlankNode(y)&&(y["@id"]=b.getId(y["@id"]));const _=Object.keys(y).sort();for(let E=0;E<_.length;++E){const v=_[E];v!=="@id"&&(y[v]=h(b,y[v]))}}return y}return fs}var ps,kl;function Ma(){if(kl)return ps;kl=1;const r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",e="http://www.w3.org/2001/XMLSchema#";return ps={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"},ps}var gs,Pl;function Uc(){return Pl||(Pl=1,gs=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]}}}),gs}var ms,Ml;function Jt(){if(Ml)return ms;Ml=1;const r=ut(),e={};ms=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 h=0;h<o.length;++h)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),ms}var ys,Bl;function Af(){if(Bl)return ys;Bl=1;const{parseLinkHeader:r,buildHeaders:e}=ht(),{LINK_HEADER_CONTEXT:t}=Ma(),n=gt(),i=Uc(),{prependBase:s}=Jt(),a=/(^|(\r\n))link:/i;ys=({secure:u,headers:l={},xhr:c}={headers:{}})=>{return l=e(l),new i().wrapLoader(b);async function b(y){if(y.indexOf("http:")!==0&&y.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:y});if(u&&y.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:y});let _;try{_=await o(c,y,l)}catch(m){throw new n("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:y,cause:m})}if(_.status>=400)throw new n("URL could not be dereferenced: "+_.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:y,httpStatusCode:_.status});let E={contextUrl:null,documentUrl:y,document:_.response},v=null;const x=_.getResponseHeader("Content-Type");let S;if(a.test(_.getAllResponseHeaders())&&(S=_.getResponseHeader("Link")),S&&x!=="application/ld+json"){const m=r(S),d=m[t];if(Array.isArray(d))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:y});d&&(E.contextUrl=d.target),v=m.alternate,v&&v.type=="application/ld+json"&&!(x||"").match(/^application\/(\w*\+)?json$/)&&(E=await b(s(y,v.target)))}return E}};function o(u,l,c){u=u||XMLHttpRequest;const h=new u;return new Promise((b,y)=>{h.onload=()=>b(h),h.onerror=_=>y(_),h.open("GET",l,!0);for(const _ in c)h.setRequestHeader(_,c[_]);h.send()})}return ys}var bs,ql;function Df(){if(ql)return bs;ql=1;const r=Af(),e={};return bs=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})},bs}var _s,Ul;function Lf(){return Ul||(Ul=1,_s=function(r){r.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),_s}var ws,Hl;function Of(){if(Hl)return ws;Hl=1,ws=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{Lf()(r)}catch{}return ws}var vs,Vl;function Hc(){if(Vl)return vs;Vl=1;const r=Of(),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"),h=()=>1;class b{constructor(d){if(typeof d=="number"&&(d={max:d}),d||(d={}),d.max&&(typeof d.max!="number"||d.max<0))throw new TypeError("max must be a non-negative number");this[e]=d.max||1/0;const g=d.length||h;if(this[n]=typeof g!="function"?h:g,this[i]=d.stale||!1,d.maxAge&&typeof d.maxAge!="number")throw new TypeError("maxAge must be a number");this[s]=d.maxAge||0,this[a]=d.dispose,this[o]=d.noDisposeOnSet||!1,this[c]=d.updateAgeOnGet||!1,this.reset()}set max(d){if(typeof d!="number"||d<0)throw new TypeError("max must be a non-negative number");this[e]=d||1/0,E(this)}get max(){return this[e]}set allowStale(d){this[i]=!!d}get allowStale(){return this[i]}set maxAge(d){if(typeof d!="number")throw new TypeError("maxAge must be a non-negative number");this[s]=d,E(this)}get maxAge(){return this[s]}set lengthCalculator(d){typeof d!="function"&&(d=h),d!==this[n]&&(this[n]=d,this[t]=0,this[u].forEach(g=>{g.length=this[n](g.value,g.key),this[t]+=g.length})),E(this)}get lengthCalculator(){return this[n]}get length(){return this[t]}get itemCount(){return this[u].length}rforEach(d,g){g=g||this;for(let N=this[u].tail;N!==null;){const j=N.prev;S(this,d,N,g),N=j}}forEach(d,g){g=g||this;for(let N=this[u].head;N!==null;){const j=N.next;S(this,d,N,g),N=j}}keys(){return this[u].toArray().map(d=>d.key)}values(){return this[u].toArray().map(d=>d.value)}reset(){this[a]&&this[u]&&this[u].length&&this[u].forEach(d=>this[a](d.key,d.value)),this[l]=new Map,this[u]=new r,this[t]=0}dump(){return this[u].map(d=>_(this,d)?!1:{k:d.key,v:d.value,e:d.now+(d.maxAge||0)}).toArray().filter(d=>d)}dumpLru(){return this[u]}set(d,g,N){if(N=N||this[s],N&&typeof N!="number")throw new TypeError("maxAge must be a number");const j=N?Date.now():0,A=this[n](g,d);if(this[l].has(d)){if(A>this[e])return v(this,this[l].get(d)),!1;const F=this[l].get(d).value;return this[a]&&(this[o]||this[a](d,F.value)),F.now=j,F.maxAge=N,F.value=g,this[t]+=A-F.length,F.length=A,this.get(d),E(this),!0}const B=new x(d,g,A,j,N);return B.length>this[e]?(this[a]&&this[a](d,g),!1):(this[t]+=B.length,this[u].unshift(B),this[l].set(d,this[u].head),E(this),!0)}has(d){if(!this[l].has(d))return!1;const g=this[l].get(d).value;return!_(this,g)}get(d){return y(this,d,!0)}peek(d){return y(this,d,!1)}pop(){const d=this[u].tail;return d?(v(this,d),d.value):null}del(d){v(this,this[l].get(d))}load(d){this.reset();const g=Date.now();for(let N=d.length-1;N>=0;N--){const j=d[N],A=j.e||0;if(A===0)this.set(j.k,j.v);else{const B=A-g;B>0&&this.set(j.k,j.v,B)}}}prune(){this[l].forEach((d,g)=>y(this,g,!1))}}const y=(m,d,g)=>{const N=m[l].get(d);if(N){const j=N.value;if(_(m,j)){if(v(m,N),!m[i])return}else g&&(m[c]&&(N.value.now=Date.now()),m[u].unshiftNode(N));return j.value}},_=(m,d)=>{if(!d||!d.maxAge&&!m[s])return!1;const g=Date.now()-d.now;return d.maxAge?g>d.maxAge:m[s]&&g>m[s]},E=m=>{if(m[t]>m[e])for(let d=m[u].tail;m[t]>m[e]&&d!==null;){const g=d.prev;v(m,d),d=g}},v=(m,d)=>{if(d){const g=d.value;m[a]&&m[a](g.key,g.value),m[t]-=g.length,m[l].delete(g.key),m[u].removeNode(d)}};class x{constructor(d,g,N,j,A){this.key=d,this.value=g,this.length=N,this.now=j,this.maxAge=A||0}}const S=(m,d,g,N)=>{let j=g.value;_(m,j)&&(v(m,g),m[i]||(j=void 0)),j&&d.call(N,j.value,j.key,m)};return vs=b,vs}var xs,Gl;function jf(){if(Gl)return xs;Gl=1;const r=Hc(),e=10;return xs=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)}},xs}var Es,Wl;function Cf(){if(Wl)return Es;Wl=1;const{isArray:r,isObject:e,isString:t}=ut(),{asArray:n}=ht(),{prependBase:i}=Jt(),s=gt(),a=jf(),o=10;Es=class{constructor({sharedCache:h}){this.perOpCache=new Map,this.sharedCache=h}async resolve({activeCtx:h,context:b,documentLoader:y,base:_,cycles:E=new Set}){b&&e(b)&&b["@context"]&&(b=b["@context"]),b=n(b);const v=[];for(const x of b){if(t(x)){let d=this._get(x);d||(d=await this._resolveRemoteContext({activeCtx:h,url:x,documentLoader:y,base:_,cycles:E})),r(d)?v.push(...d):v.push(d);continue}if(x===null){v.push(new a({document:null}));continue}e(x)||u(b);const S=JSON.stringify(x);let m=this._get(S);m||(m=new a({document:x}),this._cacheResolvedContext({key:S,resolved:m,tag:"static"})),v.push(m)}return v}_get(h){let b=this.perOpCache.get(h);if(!b){const y=this.sharedCache.get(h);y&&(b=y.get("static"),b&&this.perOpCache.set(h,b))}return b}_cacheResolvedContext({key:h,resolved:b,tag:y}){if(this.perOpCache.set(h,b),y!==void 0){let _=this.sharedCache.get(h);_||(_=new Map,this.sharedCache.set(h,_)),_.set(y,b)}return b}async _resolveRemoteContext({activeCtx:h,url:b,documentLoader:y,base:_,cycles:E}){b=i(_,b);const{context:v,remoteDoc:x}=await this._fetchContext({activeCtx:h,url:b,documentLoader:y,cycles:E});_=x.documentUrl||b,l({context:v,base:_});const S=await this.resolve({activeCtx:h,context:v,documentLoader:y,base:_,cycles:E});return this._cacheResolvedContext({key:b,resolved:S,tag:x.tag}),S}async _fetchContext({activeCtx:h,url:b,documentLoader:y,cycles:_}){if(_.size>o)throw new s("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:h.processingMode==="json-ld-1.0"?"loading remote context failed":"context overflow",max:o});if(_.has(b))throw new s("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:h.processingMode==="json-ld-1.0"?"recursive context inclusion":"context overflow",url:b});_.add(b);let E,v;try{v=await y(b),E=v.document||null,t(E)&&(E=JSON.parse(E))}catch(x){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: "${b}".`,"jsonld.InvalidUrl",{code:"loading remote context failed",url:b,cause:x})}if(!e(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: "${b}".`,"jsonld.InvalidUrl",{code:"invalid remote context",url:b});return"@context"in E?E={"@context":E["@context"]}:E={"@context":{}},v.contextUrl&&(r(E["@context"])||(E["@context"]=[E["@context"]]),E["@context"].push(v.contextUrl)),{context:E,remoteDoc:v}}};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:h}){if(!c)return;const b=c["@context"];if(t(b)){c["@context"]=i(h,b);return}if(r(b)){for(let y=0;y<b.length;++y){const _=b[y];if(t(_)){b[y]=i(h,_);continue}e(_)&&l({context:{"@context":_},base:h})}return}if(e(b))for(const y in b)l({context:b[y],base:h})}return Es}var Ss,zl;function $f(){return zl||(zl=1,Ss=Pa().NQuads),Ss}var Is,Ql;function Tn(){if(Ql)return Is;Ql=1;const r=gt(),{isArray:e}=ut(),{asArray:t}=ht(),n={};Is=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},Is}var Ns,Xl;function hr(){if(Xl)return Ns;Xl=1;const r=ht(),e=gt(),{isArray:t,isObject:n,isString:i,isUndefined:s}=ut(),{isAbsolute:a,isRelative:o,prependBase:u}=Jt(),{handleEvent:l}=Tn(),{REGEX_BCP47:c,REGEX_KEYWORD:h,asArray:b,compareShortestLeast:y}=ht(),_=new Map,E=1e4,v={};Ns=v,v.process=async({activeCtx:m,localCtx:d,options:g,propagate:N=!0,overrideProtected:j=!1,cycles:A=new Set})=>{if(n(d)&&"@context"in d&&t(d["@context"])&&(d=d["@context"]),b(d).length===0)return m;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:m,context:d,documentLoader:g.documentLoader,base:g.base});n(D[0].document)&&typeof D[0].document["@propagate"]=="boolean"&&(N=D[0].document["@propagate"]);let L=m;!N&&!L.previousContext&&(L=L.clone(),L.previousContext=m);for(const te of D){let{document:T}=te;if(m=L,T===null){if(!j&&Object.keys(m.protected).length!==0)throw new e("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});L=m=v.getInitialContext(g).clone();continue}const Z=te.getProcessed(m);if(Z){if(q.eventHandler)for(const Y of Z.events)l({event:Y,options:q});L=m=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});L=L.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(m.processingMode&&m.processingMode==="json-ld-1.0")throw new e("@version: "+T["@version"]+" not compatible with "+m.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:T});L.processingMode="json-ld-1.1",L["@version"]=T["@version"],k.set("@version",!0)}if(L.processingMode=L.processingMode||m.processingMode,"@base"in T){let Y=T["@base"];if(!(Y===null||a(Y)))if(o(Y))Y=u(L["@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});L["@base"]=Y,k.set("@base",!0)}if("@vocab"in T){const Y=T["@vocab"];if(Y===null)delete L["@vocab"];else if(i(Y)){if(!a(Y)&&v.processingMode(L,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=x(L,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}),L["@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 L["@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}),L["@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(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @direction not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:T});if(Y===null)delete L["@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});L["@direction"]=Y}k.set("@direction",!0)}if("@propagate"in T){const Y=T["@propagate"];if(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @propagate not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context: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:d});k.set("@propagate",!0)}if("@import"in T){const Y=T["@import"];if(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @import not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:T});if(!i(Y))throw new e("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:d});const w=await g.contextResolver.resolve({activeCtx:m,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:d});const H=w[0].getProcessed(m);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:d});for(const Q in K)T.hasOwnProperty(Q)||(T[Q]=K[Q]);w[0].setProcessed(m,T)}k.set("@import",!0)}k.set("@protected",T["@protected"]||!1);for(const Y in T)if(v.createTermDefinition({activeCtx:L,localCtx:T,term:Y,defined:k,options:g,overrideProtected:j}),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 v.process({activeCtx:L.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(m,{context:L,events:R})}return L},v.createTermDefinition=({activeCtx:m,localCtx:d,term:g,defined:N,options:j,overrideProtected:A=!1})=>{if(N.has(g)){if(N.get(g))return;throw new e("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:d,term:g})}N.set(g,!1);let B;if(d.hasOwnProperty(g)&&(B=d[g]),g==="@type"&&n(B)&&(B["@container"]||"@set")==="@set"&&v.processingMode(m,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:d,term:g})}else{if(v.isKeyword(g))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:d,term:g});if(g.match(h)){j.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:j});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:d})}const R=m.mappings.get(g);m.mappings.has(g)&&m.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:d});const q={};m.mappings.set(g,q),q.reverse=!1;const D=["@container","@id","@language","@reverse","@type"];v.processingMode(m,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:d});const L=g.indexOf(":");if(q._termHasColon=L>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:d});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:d});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:d});if(T.match(h)){j.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:j}),R?m.mappings.set(g,R):m.mappings.delete(g);return}const Z=x(m,T,{vocab:!0,base:!1},d,N,j);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:d});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:d});if(T===null)q["@id"]=null;else if(!v.isKeyword(T)&&T.match(h)){j.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:j}),R?m.mappings.set(g,R):m.mappings.delete(g);return}else if(T!==g){if(T=x(m,T,{vocab:!0,base:!1},d,N,j),!a(T)&&!v.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:d});if(g.match(/(?::[^:])|\//)){const Z=new Map(N).set(g,!0);if(x(m,g,{vocab:!0,base:!1},d,Z,j)!==T)throw new e("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:d})}q["@id"]=T,q._prefix=F&&!q._termHasColon&&T.match(/[:\/\?#\[\]@]$/)!==null}}if(!("@id"in q))if(q._termHasColon){const T=g.substr(0,L);if(d.hasOwnProperty(T)&&v.createTermDefinition({activeCtx:m,localCtx:d,term:T,defined:N,options:j}),m.mappings.has(T)){const Z=g.substr(L+1);q["@id"]=m.mappings.get(T)["@id"]+Z}else q["@id"]=g}else if(g==="@type")q["@id"]=g;else{if(!("@vocab"in m))throw new e("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:d,term:g});q["@id"]=m["@vocab"]+g}if((B["@protected"]===!0||N.get("@protected")===!0&&B["@protected"]!==!1)&&(m.protected[g]=!0,q.protected=!0),N.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:d});if(T==="@json"||T==="@none"){if(v.processingMode(m,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:d})}else if(T!=="@id"&&T!=="@vocab"){if(T=x(m,T,{vocab:!0,base:!1},d,N,j),!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:d});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:d})}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(v.processingMode(m,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:d})}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:d})}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:d})}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:d});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:d});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:d});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:d});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:d});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:d});if(v.isKeyword(q["@id"]))throw new e("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:d});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:d})}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:d});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:d});q["@nest"]=T}// disallow aliasing @context and @preserve
|
|
346
|
+
const te=q["@id"];if(te==="@context"||te==="@preserve")throw new e("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:d});if(R&&R.protected&&!A&&(m.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:d,term:g})},v.expandIri=(m,d,g,N)=>x(m,d,g,void 0,void 0,N);function x(m,d,g,N,j,A){if(d===null||!i(d)||v.isKeyword(d))return d;if(d.match(h))return null;if(N&&N.hasOwnProperty(d)&&j.get(d)!==!0&&v.createTermDefinition({activeCtx:m,localCtx:N,term:d,defined:j,options:A}),g=g||{},g.vocab){const R=m.mappings.get(d);if(R===null)return null;if(n(R)&&"@id"in R)return R["@id"]}const B=d.indexOf(":");if(B>0){const R=d.substr(0,B),F=d.substr(B+1);if(R==="_"||F.indexOf("//")===0)return d;N&&N.hasOwnProperty(R)&&v.createTermDefinition({activeCtx:m,localCtx:N,term:R,defined:j,options:A});const q=m.mappings.get(R);if(q&&q._prefix)return q["@id"]+F;if(a(d))return d}if(g.vocab&&"@vocab"in m)d=m["@vocab"]+d;else if(g.base){let R,F;"@base"in m?m["@base"]?(F=u(A.base,m["@base"]),R=u(F,d)):(F=m["@base"],R=d):(F=A.base,R=u(A.base,d)),d=R}return d}v.getInitialContext=m=>{const d=JSON.stringify({processingMode:m.processingMode}),g=_.get(d);if(g)return g;const N={processingMode:m.processingMode,mappings:new Map,inverse:null,getInverse:j,clone:R,revertToPreviousContext:F,protected:{}};return _.size===E&&_.clear(),_.set(d,N),N;function j(){const q=this;if(q.inverse)return q.inverse;const D=q.inverse={},L=q.fastCurieMap={},te={},T=(q["@language"]||"@none").toLowerCase(),Z=q["@direction"],k=q.mappings,Y=[...k.keys()].sort(y);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 Q=b(H["@id"]);for(const ue of Q){let V=D[ue];const G=v.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 L?L[ue[0]].push(z):L[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 L)A(L,w,1);return D}function A(q,D,L){const te=q[D],T=q[D]={};let Z,k;for(const Y of te)Z=Y.iri,L>=Z.length?k="":k=Z[L],k in T?T[k].push(Y):T[k]=[Y];for(const Y in T)Y!==""&&A(T,Y,L+1)}function B(q,D,L){D.hasOwnProperty(L)||(D[L]=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}},v.getContextValue=(m,d,g)=>{if(d===null)return g==="@context"?void 0:null;if(m.mappings.has(d)){const N=m.mappings.get(d);if(s(g))return N;if(N.hasOwnProperty(g))return N[g]}if(g==="@language"&&g in m||g==="@direction"&&g in m)return m[g];if(g!=="@context")return null},v.processingMode=(m,d)=>d.toString()>="1.1"?!m.processingMode||m.processingMode>="json-ld-"+d.toString():m.processingMode==="json-ld-1.0",v.isKeyword=m=>{if(!i(m)||m[0]!=="@")return!1;switch(m){case"@base":case"@container":case"@context":case"@default":case"@direction":case"@embed":case"@explicit":case"@graph":case"@id":case"@included":case"@index":case"@json":case"@language":case"@list":case"@nest":case"@none":case"@omitDefault":case"@prefix":case"@preserve":case"@protected":case"@requireAll":case"@reverse":case"@set":case"@type":case"@value":case"@version":case"@vocab":return!0}return!1};function S(m,d){if(!(m&&typeof m=="object")||!(d&&typeof d=="object"))return m===d;const g=Array.isArray(m);if(g!==Array.isArray(d))return!1;if(g){if(m.length!==d.length)return!1;for(let A=0;A<m.length;++A)if(!S(m[A],d[A]))return!1;return!0}const N=Object.keys(m),j=Object.keys(d);if(N.length!==j.length)return!1;for(const A in m){let B=m[A],R=d[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 Ns}var Rs,Jl;function Ff(){if(Jl)return Rs;Jl=1;const r=gt(),{isArray:e,isObject:t,isEmptyObject:n,isString:i,isUndefined:s}=ut(),{isList:a,isValue:o,isGraph:u,isSubject:l}=kt(),{expandIri:c,getContextValue:h,isKeyword:b,process:y,processingMode:_}=hr(),{isAbsolute:E}=Jt(),{REGEX_BCP47:v,REGEX_KEYWORD:x,addValue:S,asArray:m,getValues:d,validateTypeValue:g}=ht(),{handleEvent:N}=Tn(),j={};Rs=j,j.expand=async({activeCtx:D,activeProperty:L=null,element:te,options:T={},insideList:Z=!1,insideIndex:k=!1,typeScopedContext:Y=null})=>{if(te==null)return null;if(L==="@default"&&(T=Object.assign({},T,{isFrame:!1})),!e(te)&&!t(te))return!Z&&(L===null||c(D,L,{vocab:!0},T)==="@graph")?(T.eventHandler&&N({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:L,value:te,options:T});if(e(te)){let z=[];const U=h(D,L,"@container")||[];Z=Z||U.includes("@list");for(let ee=0;ee<te.length;++ee){let re=await j.expand({activeCtx:D,activeProperty:L,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,L,{vocab:!0},T),H=h(D,L,"@context");Y=Y||(D.previousContext?D:null);let K=Object.keys(te).sort(),Q=!k;if(Q&&Y&&K.length<=2&&!K.includes("@context"))for(const z of K){const U=c(Y,z,{vocab:!0},T);if(U==="@value"){Q=!1,D=Y;break}if(U==="@id"&&K.length===1){Q=!1;break}}Q&&(D=D.revertToPreviousContext()),s(H)||(D=await y({activeCtx:D,localCtx:H,propagate:!0,overrideProtected:!0,options:T})),"@context"in te&&(D=await y({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=h(Y,fe,"@context");s(ge)||(D=await y({activeCtx:D,localCtx:ge,options:T,propagate:!1}))}}let V={};await B({activeCtx:D,activeProperty:L,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?[]:m(V["@value"]),ee=d(V,"@type");if(!(_(D,1.1)&&ee.includes("@json")&&ee.length===1))if(U.length===0)T.eventHandler&&N({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=>E(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&&N({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&&(L===null||w==="@graph"||(h(D,L,"@container")||[]).includes("@graph"))&&(V=A({value:V,count:G,options:T})),V};function A({value:D,count:L,options:te}){if(L===0||"@value"in D||"@list"in D||L===1&&"@id"in D){if(te.eventHandler){let T,Z;L===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."):L===1&&"@id"in D&&(T="object with only @id",Z="Dropping object with only @id."),N({event:{type:["JsonLdEvent"],code:T,level:"warning",message:Z,details:{value:D}},options:te})}return null}return D}async function B({activeCtx:D,activeProperty:L,expandedActiveProperty:te,element:T,expandedParent:Z,options:k={},insideList:Y,typeKey:w,typeScopedContext:H}){const K=Object.keys(T).sort(),Q=[];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||!(E(ee)||b(ee))){k.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:G,expandedProperty:ee}},options:k});continue}if(b(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(C=>i(C)))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",m(z).map(C=>{if(i(C)){const W=c(D,C,{base:!0},k);return k.eventHandler&&(W===null?N(C===null?{event:{type:["JsonLdEvent"],code:"null @id value",level:"warning",message:"Null @id found.",details:{id:C}},options:k}:{event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:C}},options:k}):E(W)||N({event:{type:["JsonLdEvent"],code:"relative @id reference",level:"warning",message:"Relative @id reference found.",details:{id:C,expandedId:W}},options:k})),W}return C}),{propertyIsArray:k.isFrame});continue}if(ee==="@type"){t(z)&&(z=Object.fromEntries(Object.entries(z).map(([C,W])=>[c(H,C,{vocab:!0}),m(W).map(se=>c(H,se,{base:!0,vocab:!0},{...k,typeExpansion:!0}))]))),g(z,k.isFrame),S(Z,"@type",m(z).map(C=>{if(i(C)){const W=c(H,C,{base:!0,vocab:!0},{...k,typeExpansion:!0});return W!=="@json"&&!E(W)&&k.eventHandler&&N({event:{type:["JsonLdEvent"],code:"relative @type reference",level:"warning",message:"Relative @type reference found.",details:{type:C}},options:k}),W}return C}),{propertyIsArray:!!k.isFrame});continue}if(ee==="@included"&&_(D,1.1)){const C=m(await j.expand({activeCtx:D,activeProperty:L,element:z,options:k}));if(!C.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",C,{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=m(z).map(C=>i(C)?C.toLowerCase():C);for(const C of z)i(C)&&!C.match(v)&&k.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:C}},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=m(z);for(const C of z)if(i(C)&&C!=="ltr"&&C!=="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 j.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 C=Z["@reverse"]||null;for(const W in U){if(W==="@reverse")continue;C===null&&(C=Z["@reverse"]={}),S(C,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(C,W,pe,{propertyIsArray:!0})}}continue}if(ee==="@nest"){Q.push(G);continue}let re=D;const fe=h(D,G,"@context");s(fe)||(re=await y({activeCtx:D,localCtx:fe,propagate:!0,overrideProtected:!0,options:k}));const ge=h(D,G,"@container")||[];if(ge.includes("@language")&&t(z)){const C=h(re,G,"@direction");U=F(re,z,C,k)}else if(ge.includes("@index")&&t(z)){const C=ge.includes("@graph"),W=h(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:C,indexKey:W,propertyIndex:se})}else if(ge.includes("@id")&&t(z)){const C=ge.includes("@graph");U=await q({activeCtx:re,options:k,activeProperty:G,value:z,asGraph:C,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 C=ee==="@list";if(C||ee==="@set"){let W=L;C&&te==="@graph"&&(W=null),U=await j.expand({activeCtx:re,activeProperty:W,element:z,options:k,insideList:C})}else h(D,G,"@type")==="@json"?U={"@type":"@json","@value":z}:U=await j.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":m(U)}),ge.includes("@graph")&&!ge.some(C=>C==="@id"||C==="@index")){if(U=m(U),k.isFrame||(U=U.filter(C=>{const W=Object.keys(C).length;return A({value:C,count:W,options:k})!==null})),U.length===0)continue;U=U.map(C=>({"@graph":m(C)}))}if(re.mappings.has(G)&&re.mappings.get(G).reverse){const C=Z["@reverse"]=Z["@reverse"]||{};U=m(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(C,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 Q){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:L,expandedActiveProperty:te,element:U,expandedParent:Z,options:k,insideList:Y,typeScopedContext:H,typeKey:w})}}}function R({activeCtx:D,activeProperty:L,value:te,options:T}){if(te==null)return null;const Z=c(D,L,{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=h(D,L,"@type");if((k==="@id"||Z==="@graph")&&i(te)){const w=c(D,te,{base:!0},T);return w===null&&te.match(x)&&T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:L}},options:T}),{"@id":w}}if(k==="@vocab"&&i(te))return{"@id":c(D,te,{vocab:!0,base:!0},T)};if(b(Z))return te;const Y={};if(k&&!["@id","@vocab","@none"].includes(k))Y["@type"]=k;else if(i(te)){const w=h(D,L,"@language");w!==null&&(Y["@language"]=w);const H=h(D,L,"@direction");H!==null&&(Y["@direction"]=H)}return["boolean","number","string"].includes(typeof te)||(te=te.toString()),Y["@value"]=te,Y}function F(D,L,te,T){const Z=[],k=Object.keys(L).sort();for(const Y of k){const w=c(D,Y,{vocab:!0},T);let H=L[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:L});const Q={"@value":K};w!=="@none"&&(Y.match(v)||T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:Y}},options:T}),Q["@language"]=Y.toLowerCase()),te&&(Q["@direction"]=te),Z.push(Q)}}return Z}async function q({activeCtx:D,options:L,activeProperty:te,value:T,asGraph:Z,indexKey:k,propertyIndex:Y}){const w=[],H=Object.keys(T).sort(),K=k==="@type";for(let Q of H){if(K){const G=h(D,Q,"@context");s(G)||(D=await y({activeCtx:D,localCtx:G,propagate:!1,options:L}))}let ue=T[Q];e(ue)||(ue=[ue]),ue=await j.expand({activeCtx:D,activeProperty:te,element:ue,options:L,insideList:!1,insideIndex:!0});let V;Y?Q==="@none"?V="@none":V=R({activeCtx:D,activeProperty:k,value:Q,options:L}):V=c(D,Q,{vocab:!0},L),k==="@id"?Q=c(D,Q,{base:!0},L):K&&(Q=V);for(let G of ue){if(Z&&!u(G)&&(G={"@graph":[G]}),k==="@type")V==="@none"||(G["@type"]?G["@type"]=[Q].concat(G["@type"]):G["@type"]=[Q]);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]=Q)}w.push(G)}}return w}return Rs}var Ts,Kl;function gi(){if(Kl)return Ts;Kl=1;const{isKeyword:r}=hr(),e=kt(),t=ut(),n=ht(),i=gt(),s={};return Ts=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,h)=>{if(t.isArray(a)){for(const E of a)s.createNodeMap(E,o,u,l,void 0,h);return}if(!t.isObject(a)){h&&h.push(a);return}if(e.isValue(a)){if("@type"in a){let E=a["@type"];E.indexOf("_:")===0&&(a["@type"]=E=l.getId(E))}h&&h.push(a);return}else if(h&&e.isList(a)){const E=[];s.createNodeMap(a["@list"],o,u,l,c,E),h.push({"@list":E});return}if("@type"in a){const E=a["@type"];for(const v of E)v.indexOf("_:")===0&&l.getId(v)}t.isUndefined(c)&&(c=e.isBlankNode(a)?l.getId(a["@id"]):a["@id"]),h&&h.push({"@id":c});const b=o[u],y=b[c]=b[c]||{};y["@id"]=c;const _=Object.keys(a).sort();for(let E of _){if(E==="@id")continue;if(E==="@reverse"){const x={"@id":c},S=a["@reverse"];for(const m in S){const d=S[m];for(const g of d){let N=g["@id"];e.isBlankNode(g)&&(N=l.getId(N)),s.createNodeMap(g,o,u,l,N),n.addValue(b[N],m,x,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(E==="@graph"){c in o||(o[c]={}),s.createNodeMap(a[E],o,c,l);continue}if(E==="@included"){s.createNodeMap(a[E],o,u,l);continue}if(E!=="@type"&&r(E)){if(E==="@index"&&E in y&&(a[E]!==y[E]||a[E]["@id"]!==y[E]["@id"]))throw new i("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:y});y[E]=a[E];continue}const v=a[E];if(E.indexOf("_:")===0&&(E=l.getId(E)),v.length===0){n.addValue(y,E,[],{propertyIsArray:!0});continue}for(let x of v)if(E==="@type"&&(x=x.indexOf("_:")===0?l.getId(x):x),e.isSubject(x)||e.isSubjectReference(x)){if("@id"in x&&!x["@id"])continue;const S=e.isBlankNode(x)?l.getId(x["@id"]):x["@id"];n.addValue(y,E,{"@id":S},{propertyIsArray:!0,allowDuplicate:!1}),s.createNodeMap(x,o,u,l,S)}else if(e.isValue(x))n.addValue(y,E,x,{propertyIsArray:!0,allowDuplicate:!1});else if(e.isList(x)){const S=[];s.createNodeMap(x["@list"],o,u,l,c,S),x={"@list":S},n.addValue(y,E,x,{propertyIsArray:!0,allowDuplicate:!1})}else s.createNodeMap(x,o,u,l,c),n.addValue(y,E,x,{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 h=o[l];for(const b of Object.keys(c).sort())if(r(b)&&b!=="@type")h[b]=n.clone(c[b]);else for(const y of c[b])n.addValue(h,b,n.clone(y),{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 h=o[l];h?"@graph"in h||(h["@graph"]=[]):o[l]=h={"@id":l,"@graph":[]};const b=h["@graph"];for(const y of Object.keys(c).sort()){const _=c[y];e.isSubjectReference(_)||b.push(_)}}return o},Ts}var As,Yl;function kf(){if(Yl)return As;Yl=1;const{isSubjectReference:r}=kt(),{createMergedNodeMap:e}=gi(),t={};return As=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},As}var Ds,Zl;function Pf(){if(Zl)return Ds;Zl=1;const r=gt(),e=kt(),t=ut(),{REGEX_BCP47:n,addValue:i}=ht(),{handleEvent:s}=Tn(),{RDF_LIST:a,RDF_FIRST:o,RDF_REST:u,RDF_NIL:l,RDF_TYPE:c,RDF_JSON_LITERAL:h,XSD_BOOLEAN:b,XSD_DOUBLE:y,XSD_INTEGER:_,XSD_STRING:E}=Ma(),v={};Ds=v,v.fromRDF=async(S,m)=>{const{useRdfType:d=!1,useNativeTypes:g=!1,rdfDirection:N=null}=m,j={},A={"@default":j},B={};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 q of S){const D=q.graph.termType==="DefaultGraph"?"@default":q.graph.value;D in A||(A[D]={}),D!=="@default"&&!(D in j)&&(j[D]={"@id":D});const L=A[D],te=q.subject.value,T=q.predicate.value,Z=q.object;te in L||(L[te]={"@id":te});const k=L[te],Y=Z.termType.endsWith("Node");if(Y&&!(Z.value in L)&&(L[Z.value]={"@id":Z.value}),T===c&&!d&&Y){i(k,"@type",Z.value,{propertyIsArray:!0});continue}const w=x(Z,g,N,m);if(i(k,T,w,{propertyIsArray:!0}),Y)if(Z.value===l){const H=L[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 L=D[l];if(L.usages){for(let te of L.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 L.usages}}const R=[],F=Object.keys(j).sort();for(const q of F){const D=j[q];if(q in A){const L=D["@graph"]=[],te=A[q],T=Object.keys(te).sort();for(const Z of T){const k=te[Z];e.isSubjectReference(k)||L.push(k)}}e.isSubjectReference(D)||R.push(D)}return R};function x(S,m,d,g){if(S.termType.endsWith("Node"))return{"@id":S.value};const N={"@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}),N["@language"]=S.language;else{let j=S.datatype.value;if(j||(j=E),j===h){j="@json";try{N["@value"]=JSON.parse(N["@value"])}catch(A){throw new r("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:N["@value"],cause:A})}}if(m){if(j===b)N["@value"]==="true"?N["@value"]=!0:N["@value"]==="false"&&(N["@value"]=!1);else if(t.isNumeric(N["@value"]))if(j===_){const A=parseInt(N["@value"],10);A.toFixed(0)===N["@value"]&&(N["@value"]=A)}else j===y&&(N["@value"]=parseFloat(N["@value"]));[b,_,y,E].includes(j)||(N["@type"]=j)}else if(d==="i18n-datatype"&&j.startsWith("https://www.w3.org/ns/i18n#")){const[,A,B]=j.split(/[#_]/);A.length>0&&(N["@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})),N["@direction"]=B}else j!==E&&(N["@type"]=j)}return N}return Ds}var Ls,eu;function Mf(){return eu||(eu=1,Ls=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])},"")+"}"}),Ls}var Os,tu;function Bf(){if(tu)return Os;tu=1;const{createNodeMap:r}=gi(),{isKeyword:e}=hr(),t=kt(),n=Mf(),i=gt(),s=ut(),a=ht(),{handleEvent:o}=Tn(),{RDF_FIRST:u,RDF_REST:l,RDF_NIL:c,RDF_TYPE:h,RDF_JSON_LITERAL:b,RDF_LANGSTRING:y,XSD_BOOLEAN:_,XSD_DOUBLE:E,XSD_INTEGER:v,XSD_STRING:x}=Ma(),{isAbsolute:S}=Jt(),m={};Os=m,m.toRDF=(j,A)=>{const B=new a.IdentifierIssuer("_:b"),R={"@default":{}};r(j,R,"@default",B);const F=[],q=Object.keys(R).sort();for(const D of q){let L;if(D==="@default")L={termType:"DefaultGraph",value:""};else if(S(D))D.startsWith("_:")?L={termType:"BlankNode"}:L={termType:"NamedNode"},L.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}d(F,R[D],L,B,A)}return F};function d(j,A,B,R,F){const q=Object.keys(A).sort();for(const D of q){const L=A[D],te=Object.keys(L).sort();for(let T of te){const Z=L[T];if(T==="@type")T=h;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=N(k,R,j,B,F.rdfDirection,F);H&&j.push({subject:Y,predicate:w,object:H,graph:B})}}}}function g(j,A,B,R,F,q){const D={termType:"NamedNode",value:u},L={termType:"NamedNode",value:l},te={termType:"NamedNode",value:c},T=j.pop(),Z=T?{termType:"BlankNode",value:A.getId()}:te;let k=Z;for(const Y of j){const w=N(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:L,object:H,graph:R}),k=H}if(T){const Y=N(T,A,B,R,F,q);B.push({subject:k,predicate:D,object:Y,graph:R}),B.push({subject:k,predicate:L,object:te,graph:R})}return Z}function N(j,A,B,R,F,q){const D={};if(t.isValue(j)){D.termType="Literal",D.value=void 0,D.datatype={termType:"NamedNode"};let L=j["@value"];const te=j["@type"]||null;if(te==="@json")D.value=n(L),D.datatype.value=b;else if(s.isBoolean(L))D.value=L.toString(),D.datatype.value=te||_;else if(s.isDouble(L)||te===E)s.isDouble(L)||(L=parseFloat(L)),D.value=L.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),D.datatype.value=te||E;else if(s.isNumber(L))D.value=L.toFixed(0),D.datatype.value=te||v;else if("@direction"in j&&F==="i18n-datatype"){const T=(j["@language"]||"").toLowerCase(),Z=j["@direction"],k=`https://www.w3.org/ns/i18n#${T}_${Z}`;D.datatype.value=k,D.value=L}else{if("@direction"in j&&F==="compound-literal")throw new i("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:F});if("@direction"in j&&F)throw new i("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:F});"@language"in j?("@direction"in j&&!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=L,D.datatype.value=te||y,D.language=j["@language"]):("@direction"in j&&!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=L,D.datatype.value=te||x)}}else if(t.isList(j)){const L=g(j["@list"],A,B,R,F,q);D.termType=L.termType,D.value=L.value}else{const L=s.isObject(j)?j["@id"]:j;D.termType=L.startsWith("_:")?"BlankNode":"NamedNode",D.value=L}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 Os}var js,ru;function qf(){if(ru)return js;ru=1;const{isKeyword:r}=hr(),e=kt(),t=ut(),n=ht(),i=Jt(),s=gt(),{createNodeMap:a,mergeNodeMapGraphs:o}=gi(),u={};js=u,u.frameMergedOrDefault=(d,g,N)=>{const j={options:N,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},A=new n.IdentifierIssuer("_:b");a(d,j.graphMap,"@default",A),N.merged&&(j.graphMap["@merged"]=o(j.graphMap),j.graph="@merged"),j.subjects=j.graphMap[j.graph];const B=[];u.frame(j,Object.keys(j.subjects).sort(),g,B),N.pruneBlankNodeIdentifiers&&(N.bnodesToClear=Object.keys(j.bnodeMap).filter(R=>j.bnodeMap[R].length===1));// remove @preserve from results
|
|
347
|
+
return N.link={},v(B,N)},u.frame=(d,g,N,j,A=null)=>{b(N),N=N[0];const B=d.options,R={embed:h(N,B,"embed"),explicit:h(N,B,"explicit"),requireAll:h(N,B,"requireAll")};d.link.hasOwnProperty(d.graph)||(d.link[d.graph]={});const F=d.link[d.graph],q=y(d,g,N,R),D=Object.keys(q).sort();for(const L of D){const te=q[L];if(A===null?d.uniqueEmbeds={[d.graph]:{}}:d.uniqueEmbeds[d.graph]=d.uniqueEmbeds[d.graph]||{},R.embed==="@link"&&L in F){x(j,A,F[L]);continue}const T={"@id":L};if(L.indexOf("_:")===0&&n.addValue(d.bnodeMap,L,T,{propertyIsArray:!0}),F[L]=T,(R.embed==="@first"||R.embed==="@last")&&d.is11)throw new s("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:N});if(!(!d.embedded&&d.uniqueEmbeds[d.graph].hasOwnProperty(L))){if(d.embedded&&(R.embed==="@never"||c(te,d.graph,d.subjectStack))){x(j,A,T);continue}if(d.embedded&&(R.embed=="@first"||R.embed=="@once")&&d.uniqueEmbeds[d.graph].hasOwnProperty(L)){x(j,A,T);continue}if(R.embed==="@last"&&L in d.uniqueEmbeds[d.graph]&&E(d,L),d.uniqueEmbeds[d.graph][L]={parent:j,property:A},d.subjectStack.push({subject:te,graph:d.graph}),L in d.graphMap){let Z=!1,k=null;"@graph"in N?(k=N["@graph"][0],Z=!(L==="@merged"||L==="@default"),t.isObject(k)||(k={})):(Z=d.graph!=="@merged",k={}),Z&&u.frame({...d,graph:L,embedded:!1},Object.keys(d.graphMap[L]).sort(),[k],T,"@graph")}"@included"in N&&u.frame({...d,embedded:!1},g,N["@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(d.bnodeMap,k,T,{propertyIsArray:!0});continue}if(!(R.explicit&&!(Z in N)))for(const k of te[Z]){const Y=Z in N?N[Z]:l(R);if(e.isList(k)){const w=N[Z]&&N[Z][0]&&N[Z][0]["@list"]?N[Z][0]["@list"]:l(R),H={"@list":[]};x(T,Z,H);const K=k["@list"];for(const Q of K)e.isSubjectReference(Q)?u.frame({...d,embedded:!0},[Q["@id"]],w,H,"@list"):x(H,"@list",n.clone(Q))}else e.isSubjectReference(k)?u.frame({...d,embedded:!0},[k["@id"]],Y,T,Z):m(Y[0],k)&&x(T,Z,n.clone(k))}}for(const Z of Object.keys(N).sort()){if(Z==="@type"){if(!t.isObject(N[Z][0])||!("@default"in N[Z][0]))continue}else if(r(Z))continue;const k=N[Z][0]||{};if(!h(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(N["@reverse"]||{}).sort()){const k=N["@reverse"][Z];for(const Y of Object.keys(d.subjects))n.getValues(d.subjects[Y],Z).some(H=>H["@id"]===L)&&(T["@reverse"]=T["@reverse"]||{},n.addValue(T["@reverse"],Z,[],{propertyIsArray:!0}),u.frame({...d,embedded:!0},[Y],k,T["@reverse"][Z],A))}x(j,A,T),d.subjectStack.pop()}}},u.cleanupNull=(d,g)=>{if(t.isArray(d))return d.map(j=>u.cleanupNull(j,g)).filter(j=>j);if(d==="@null")return null;if(t.isObject(d)){if("@id"in d){const N=d["@id"];if(g.link.hasOwnProperty(N)){const j=g.link[N].indexOf(d);if(j!==-1)return g.link[N][j];g.link[N].push(d)}else g.link[N]=[d]}for(const N in d)d[N]=u.cleanupNull(d[N],g)}return d};function l(d){const g={};for(const N in d)d[N]!==void 0&&(g["@"+N]=[d[N]]);return[g]}function c(d,g,N){for(let j=N.length-1;j>=0;--j){const A=N[j];if(A.graph===g&&A.subject["@id"]===d["@id"])return!0}return!1}function h(d,g,N){const j="@"+N;let A=j in d?d[j][0]:g[N];if(N==="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:d})}return A}function b(d){if(!t.isArray(d)||d.length!==1||!t.isObject(d[0]))throw new s("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:d});if("@id"in d[0]){for(const g of n.asArray(d[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:d})}if("@type"in d[0]){for(const g of n.asArray(d[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:d})}}function y(d,g,N,j){const A={};for(const B of g){const R=d.graphMap[d.graph][B];_(d,R,N,j)&&(A[B]=R)}return A}function _(d,g,N,j){let A=!0,B=!1;for(const R in N){let F=!1;const q=n.getValues(g,R),D=n.getValues(N,R).length===0;if(R==="@id"){if(t.isEmptyObject(N["@id"][0]||{})?F=!0:N["@id"].length>=0&&(F=N["@id"].includes(q[0])),!j.requireAll)return F}else if(R==="@type"){if(A=!1,D){if(q.length>0)return!1;F=!0}else if(N["@type"].length===1&&t.isEmptyObject(N["@type"][0]))F=q.length>0;else for(const L of N["@type"])t.isObject(L)&&"@default"in L?F=!0:F=F||q.some(te=>te===L);if(!j.requireAll)return F}else{if(r(R))continue;{const L=n.getValues(N,R)[0];let te=!1;if(L&&(b([L]),te="@default"in L),A=!1,q.length===0&&te)continue;if(q.length>0&&D)return!1;if(L===void 0){if(q.length>0)return!1;F=!0}else if(e.isList(L)){const T=L["@list"][0];if(e.isList(q[0])){const Z=q[0]["@list"];e.isValue(T)?F=Z.some(k=>m(T,k)):(e.isSubject(T)||e.isSubjectReference(T))&&(F=Z.some(k=>S(d,T,k,j)))}}else e.isValue(L)?F=q.some(T=>m(L,T)):e.isSubjectReference(L)?F=q.some(T=>S(d,L,T,j)):t.isObject(L)?F=q.length>0:F=!1}}if(!F&&j.requireAll)return!1;B=B||F}return A||B}function E(d,g){const N=d.uniqueEmbeds[d.graph],j=N[g],A=j.parent,B=j.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(N);for(const L of D)L in N&&t.isObject(N[L].parent)&&N[L].parent["@id"]===q&&(delete N[L],F(L))};F(g)}/**
|
|
326
348
|
* Removes the @preserve keywords from expanded result of framing.
|
|
327
349
|
*
|
|
328
350
|
* @param input the framed, framed output.
|
|
329
351
|
* @param options the framing options used.
|
|
330
352
|
*
|
|
331
353
|
* @return the resulting output.
|
|
332
|
-
*/function v(
|
|
333
|
-
if("@preserve"in h)return h["@preserve"][0];if(e.isValue(h))return h;if(e.isList(h))return h["@list"]=v(h["@list"],g),h;if("@id"in h){const N=h["@id"];if(g.link.hasOwnProperty(N)){const j=g.link[N].indexOf(h);if(j!==-1)return g.link[N][j];g.link[N].push(h)}else g.link[N]=[h]}for(const N in h){if(N==="@id"&&g.bnodesToClear.includes(h[N])){delete h["@id"];continue}h[N]=v(h[N],g)}}return h}function x(h,g,N){t.isObject(h)?n.addValue(h,g,N,{propertyIsArray:!0}):h.push(N)}function S(h,g,N,j){if(!("@id"in N))return!1;const A=h.subjects[N["@id"]];return A&&_(h,A,g,j)}function m(h,g){const N=g["@value"],j=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(N)||t.isEmptyObject(B[0]))||!(!j&&R.length===0||R.includes(j)||j&&t.isEmptyObject(R[0]))||!(!A&&F.length===0||F.includes(A)||A&&t.isEmptyObject(F[0])))}return Ls}var js,iu;function Mf(){if(iu)return js;iu=1;const r=ft(),{isArray:e,isObject:t,isString:n,isUndefined:i}=lt(),{isList:s,isValue:a,isGraph:o,isSimpleGraph:u,isSubjectReference:l}=Ft(),{expandIri:c,getContextValue:d,isKeyword:b,process:y,processingMode:_}=ur(),{removeBase:E,prependBase:v}=Qt(),{REGEX_KEYWORD:x,addValue:S,asArray:m,compareShortestLeast:h}=ct(),g={};js=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 y({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 y({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 y({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=m(H).map(ue=>g.compactIri({activeCtx:A,iri:ue,relativeTo:{vocab:!1},base:F.base}));K.length===1&&(K=K[0]);const Q=g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}});O[Q]=K;continue}if(w==="@type"){let K=m(H).map(z=>g.compactIri({activeCtx:te,iri:z,relativeTo:{vocab:!0}}));K.length===1&&(K=K[0]);const Q=g.compactIri({activeCtx:A,iri:"@type",relativeTo:{vocab:!0}}),G=(d(A,Q,"@container")||[]).includes("@set")&&_(A,1.1)||e(K)&&H.length===0;S(O,Q,K,{propertyIsArray:G});continue}if(w==="@reverse"){const K=await g.compact({activeCtx:A,activeProperty:"@reverse",element:H,options:F});for(const Q in K)if(A.mappings.has(Q)&&A.mappings.get(Q).reverse){const ue=K[Q],G=(d(A,Q,"@container")||[]).includes("@set")||!F.compactArrays;S(O,Q,ue,{propertyIsArray:G}),delete K[Q]}if(Object.keys(K).length>0){const Q=g.compactIri({activeCtx:A,iri:w,relativeTo:{vocab:!0}});S(O,Q,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 Q=g.compactIri({activeCtx:A,iri:w,relativeTo:{vocab:!0}});S(O,Q,H);continue}if(w!=="@graph"&&w!=="@list"&&w!=="@included"&&b(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}),Q=A.mappings.has(K)?A.mappings.get(K)["@nest"]:null;let ue=O;Q&&(j(A,Q,F),t(O[Q])||(O[Q]={}),ue=O[Q]),S(ue,K,H,{propertyIsArray:!0})}for(const K of H){const Q=g.compactIri({activeCtx:A,iri:w,value:K,relativeTo:{vocab:!0},reverse:D}),ue=A.mappings.has(Q)?A.mappings.get(Q)["@nest"]:null;let V=O;ue&&(j(A,ue,F),t(O[ue])||(O[ue]={}),V=O[ue]);const G=d(A,Q,"@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:Q,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,Q,re,{valueIsArray:!0,allowDuplicate:!0});continue}if(z)if(G.includes("@graph")&&(G.includes("@id")||G.includes("@index")&&u(K))){let fe;V.hasOwnProperty(Q)?fe=V[Q]:V[Q]=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,Q,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,Q,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(Q)?fe=V[Q]:V[Q]=fe={};let ge;if(G.includes("@language"))a(re)&&(re=re["@value"]),ge=K["@language"];else if(G.includes("@index")){const C=d(A,Q,"@index")||"@index",W=g.compactIri({activeCtx:A,iri:C,relativeTo:{vocab:!0}});if(C==="@index")ge=K["@index"],delete re[W];else{let se;if([ge,...se]=m(re[C]||[]),!n(ge))ge=null;else switch(se.length){case 0:delete re[C];break;case 1:re[C]=se[0];break;default:re[C]=se;break}}}else if(G.includes("@id")){const C=g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}});ge=re[C],delete re[C]}else if(G.includes("@type")){const C=g.compactIri({activeCtx:A,iri:"@type",relativeTo:{vocab:!0}});let W;switch([ge,...W]=m(re[C]||[]),W.length){case 0:delete re[C];break;case 1:re[C]=W[0];break;default:re[C]=W;break}Object.keys(re).length===1&&"@id"in K&&(re=await g.compact({activeCtx:A,activeProperty:Q,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,Q,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(b(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 Q=N(A,B,R,w,H,K);if(Q!==null)return Q}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 Q=K+":"+B.substr(w.iri.length);A.mappings.get(K)._prefix&&(!A.mappings.has(Q)||R===null&&A.mappings.get(Q)["@id"]===B)&&(te===null||h(Q,te)<0)&&(te=Q)}}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=E(v(D,A["@base"]),B);return x.test(Y)?`./${Y}`:Y}else return B;else return E(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,Q=n(R["@value"]),ue=A.mappings.has(B)&&A.mappings.get(B)["@language"]===null;if(H&&te!=="@none"&&(!K||!Q||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 N(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 j(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 js}var Cs,su;function Bf(){return su||(su=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}/**
|
|
354
|
+
*/function v(d,g){if(t.isArray(d))return d.map(N=>v(N,g));if(t.isObject(d)){// remove @preserve
|
|
355
|
+
if("@preserve"in d)return d["@preserve"][0];if(e.isValue(d))return d;if(e.isList(d))return d["@list"]=v(d["@list"],g),d;if("@id"in d){const N=d["@id"];if(g.link.hasOwnProperty(N)){const j=g.link[N].indexOf(d);if(j!==-1)return g.link[N][j];g.link[N].push(d)}else g.link[N]=[d]}for(const N in d){if(N==="@id"&&g.bnodesToClear.includes(d[N])){delete d["@id"];continue}d[N]=v(d[N],g)}}return d}function x(d,g,N){t.isObject(d)?n.addValue(d,g,N,{propertyIsArray:!0}):d.push(N)}function S(d,g,N,j){if(!("@id"in N))return!1;const A=d.subjects[N["@id"]];return A&&_(d,A,g,j)}function m(d,g){const N=g["@value"],j=g["@type"],A=g["@language"],B=d["@value"]?t.isArray(d["@value"])?d["@value"]:[d["@value"]]:[],R=d["@type"]?t.isArray(d["@type"])?d["@type"]:[d["@type"]]:[],F=d["@language"]?t.isArray(d["@language"])?d["@language"]:[d["@language"]]:[];return B.length===0&&R.length===0&&F.length===0?!0:!(!(B.includes(N)||t.isEmptyObject(B[0]))||!(!j&&R.length===0||R.includes(j)||j&&t.isEmptyObject(R[0]))||!(!A&&F.length===0||F.includes(A)||A&&t.isEmptyObject(F[0])))}return js}var Cs,nu;function Uf(){if(nu)return Cs;nu=1;const r=gt(),{isArray:e,isObject:t,isString:n,isUndefined:i}=ut(),{isList:s,isValue:a,isGraph:o,isSimpleGraph:u,isSubjectReference:l}=kt(),{expandIri:c,getContextValue:h,isKeyword:b,process:y,processingMode:_}=hr(),{removeBase:E,prependBase:v}=Jt(),{REGEX_KEYWORD:x,addValue:S,asArray:m,compareShortestLeast:d}=ht(),g={};Cs=g,g.compact=async({activeCtx:A,activeProperty:B=null,element:R,options:F={}})=>{if(e(R)){let D=[];for(let L=0;L<R.length;++L){const te=await g.compact({activeCtx:A,activeProperty:B,element:R[L],options:F});te!==null&&D.push(te)}return F.compactArrays&&D.length===1&&(h(A,B,"@container")||[]).length===0&&(D=D[0]),D}const q=h(A,B,"@context");if(i(q)||(A=await y({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)&&(h(A,B,"@container")||[]).includes("@list"))return g.compact({activeCtx:A,activeProperty:B,element:R["@list"],options:F});const D=B==="@reverse",L={},te=A;!a(R)&&!l(R)&&(A=A.revertToPreviousContext());const T=h(te,B,"@context");i(T)||(A=await y({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:L}));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=h(te,H,"@context");i(K)||(A=await y({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=m(H).map(ue=>g.compactIri({activeCtx:A,iri:ue,relativeTo:{vocab:!1},base:F.base}));K.length===1&&(K=K[0]);const Q=g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}});L[Q]=K;continue}if(w==="@type"){let K=m(H).map(z=>g.compactIri({activeCtx:te,iri:z,relativeTo:{vocab:!0}}));K.length===1&&(K=K[0]);const Q=g.compactIri({activeCtx:A,iri:"@type",relativeTo:{vocab:!0}}),G=(h(A,Q,"@container")||[]).includes("@set")&&_(A,1.1)||e(K)&&H.length===0;S(L,Q,K,{propertyIsArray:G});continue}if(w==="@reverse"){const K=await g.compact({activeCtx:A,activeProperty:"@reverse",element:H,options:F});for(const Q in K)if(A.mappings.has(Q)&&A.mappings.get(Q).reverse){const ue=K[Q],G=(h(A,Q,"@container")||[]).includes("@set")||!F.compactArrays;S(L,Q,ue,{propertyIsArray:G}),delete K[Q]}if(Object.keys(K).length>0){const Q=g.compactIri({activeCtx:A,iri:w,relativeTo:{vocab:!0}});S(L,Q,K)}continue}if(w==="@preserve"){const K=await g.compact({activeCtx:A,activeProperty:B,element:H,options:F});e(K)&&K.length===0||S(L,w,K);continue}if(w==="@index"){if((h(A,B,"@container")||[]).includes("@index"))continue;const Q=g.compactIri({activeCtx:A,iri:w,relativeTo:{vocab:!0}});S(L,Q,H);continue}if(w!=="@graph"&&w!=="@list"&&w!=="@included"&&b(w)){const K=g.compactIri({activeCtx:A,iri:w,relativeTo:{vocab:!0}});S(L,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}),Q=A.mappings.has(K)?A.mappings.get(K)["@nest"]:null;let ue=L;Q&&(j(A,Q,F),t(L[Q])||(L[Q]={}),ue=L[Q]),S(ue,K,H,{propertyIsArray:!0})}for(const K of H){const Q=g.compactIri({activeCtx:A,iri:w,value:K,relativeTo:{vocab:!0},reverse:D}),ue=A.mappings.has(Q)?A.mappings.get(Q)["@nest"]:null;let V=L;ue&&(j(A,ue,F),t(L[ue])||(L[ue]={}),V=L[ue]);const G=h(A,Q,"@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:Q,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,Q,re,{valueIsArray:!0,allowDuplicate:!0});continue}if(z)if(G.includes("@graph")&&(G.includes("@id")||G.includes("@index")&&u(K))){let fe;V.hasOwnProperty(Q)?fe=V[Q]:V[Q]=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,Q,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,Q,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(Q)?fe=V[Q]:V[Q]=fe={};let ge;if(G.includes("@language"))a(re)&&(re=re["@value"]),ge=K["@language"];else if(G.includes("@index")){const C=h(A,Q,"@index")||"@index",W=g.compactIri({activeCtx:A,iri:C,relativeTo:{vocab:!0}});if(C==="@index")ge=K["@index"],delete re[W];else{let se;if([ge,...se]=m(re[C]||[]),!n(ge))ge=null;else switch(se.length){case 0:delete re[C];break;case 1:re[C]=se[0];break;default:re[C]=se;break}}}else if(G.includes("@id")){const C=g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}});ge=re[C],delete re[C]}else if(G.includes("@type")){const C=g.compactIri({activeCtx:A,iri:"@type",relativeTo:{vocab:!0}});let W;switch([ge,...W]=m(re[C]||[]),W.length){case 0:delete re[C];break;case 1:re[C]=W[0];break;default:re[C]=W;break}Object.keys(re).length===1&&"@id"in K&&(re=await g.compact({activeCtx:A,activeProperty:Q,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,Q,re,{propertyIsArray:fe})}}}return L}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 L=A.getInverse();if(b(B)&&B in L&&"@none"in L[B]&&"@type"in L[B]["@none"]&&"@none"in L[B]["@none"]["@type"])return L[B]["@none"]["@type"]["@none"];if(F.vocab&&B in L){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 Q=N(A,B,R,w,H,K);if(Q!==null)return Q}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 Q=K+":"+B.substr(w.iri.length);A.mappings.get(K)._prefix&&(!A.mappings.has(Q)||R===null&&A.mappings.get(Q)["@id"]===B)&&(te===null||d(Q,te)<0)&&(te=Q)}}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=E(v(D,A["@base"]),B);return x.test(Y)?`./${Y}`:Y}else return B;else return E(D,B);return B},g.compactValue=({activeCtx:A,activeProperty:B,value:R,options:F})=>{if(a(R)){const te=h(A,B,"@type"),T=h(A,B,"@language"),Z=h(A,B,"@direction"),k=h(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,Q=n(R["@value"]),ue=A.mappings.has(B)&&A.mappings.get(B)["@language"]===null;if(H&&te!=="@none"&&(!K||!Q||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=h(A,B,"@type"),L=g.compactIri({activeCtx:A,iri:R["@id"],relativeTo:{vocab:D==="@vocab"},base:F.base});return D==="@id"||D==="@vocab"||q==="@graph"?L:{[g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}})]:L}};function N(A,B,R,F,q,D){D===null&&(D="@null");const L=[];if((D==="@id"||D==="@reverse")&&t(R)&&"@id"in R){D==="@reverse"&&L.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"]?L.push.apply(L,["@vocab","@id"]):L.push.apply(L,["@id","@vocab"])}else{L.push(D);const T=L.find(Z=>Z.includes("_"));T&&L.push(T.replace(/^[^_]+_/,"_"))}L.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 L)if(k in Z)return Z[k]}return null}function j(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 Cs}var $s,iu;function Hf(){return iu||(iu=1,$s=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}),$s}/**
|
|
334
356
|
* A JavaScript implementation of the JSON-LD API.
|
|
335
357
|
*
|
|
336
358
|
* @author Dave Longley
|
|
@@ -364,17 +386,17 @@ if("@preserve"in h)return h["@preserve"][0];if(e.isValue(h))return h;if(e.isList
|
|
|
364
386
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
365
387
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
366
388
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
367
|
-
*/var $s,au;function qf(){if(au)return $s;au=1;const r=Pa(),e=Rf(),t=ct(),n=Of(),i=t.IdentifierIssuer,s=ft(),a=Hc(),o=Lf(),{expand:u}=jf(),{flatten:l}=Cf(),{fromRDF:c}=$f(),{toRDF:d}=kf(),{frameMergedOrDefault:b,cleanupNull:y}=Pf(),{isArray:_,isObject:E,isString:v}=lt(),{isSubjectReference:x}=Ft(),{expandIri:S,getInitialContext:m,process:h,processingMode:g}=ur(),{compact:N,compactIri:j}=Mf(),{createNodeMap:A,createMergedNodeMap:B,mergeNodeMaps:R}=pi(),{logEventHandler:F,logWarningEventHandler:q,safeEventHandler:D,setDefaultEventHandler:O,setupEventHandler:te,strictEventHandler:T,unhandledEventHandler:Z}=Rn(),k=function(w){const H={},Q=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:v(V)?V:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new i("_:b"),contextResolver:new n({sharedCache:Q})}),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(m(z),G,z);let re=await N({activeCtx:ee,element:U,options:z});z.compactArrays&&!z.graph&&_(re)?re.length===1?re=re[0]:re.length===0&&(re={}):z.graph&&E(re)&&(re=[re]),E(G)&&"@context"in G&&(G=G["@context"]),G=t.clone(G),_(G)||(G=[G]);const fe=G;G=[];for(let C=0;C<fe.length;++C)(!E(fe[C])||Object.keys(fe[C]).length>0)&&G.push(fe[C]);const ge=G.length>0;if(G.length===1&&(G=G[0]),_(re)){const C=j({activeCtx:ee,iri:"@graph",relativeTo:{vocab:!0}}),W=re;re={},ge&&(re["@context"]=G),re[C]=W}else if(E(re)&&ge){const C=re;re={"@context":G};for(const W in C)re[W]=C[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:Q})});const z={},U=[];if("expandContext"in G){const ge=t.clone(G.expandContext);E(ge)&&"@context"in ge?z.expandContext=ge:z.expandContext={"@context":ge},U.push(z.expandContext)}let ee;if(!v(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=m(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 E(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:v(V)?V:"",contextResolver:new n({sharedCache:Q})});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:v(V)?V:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new n({sharedCache:Q})}),v(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(m(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),C=Object.keys(G).map(he=>S(ee,he,{vocab:!0}));fe.merged=!C.includes("@graph"),fe.is11=g(ee,1.1);const W=b(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=y(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:v(V)?V:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new n({sharedCache:Q})}),"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:v(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:v(V)?V:"",skipExpansion:!1,contextResolver:new n({sharedCache:Q})});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:v(V)?V:"",contextResolver:new n({sharedCache:Q})});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:Q})});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),C=[],W=Object.keys(ge).sort();for(let he=0;he<W.length;++he){const pe=ge[W[he]];x(pe)||C.push(pe)}return G===null?C:(z.graph=!0,z.skipExpansion=!0,await w.compact(C,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");v(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:Q})}),G===null?m(z):(G=t.clone(G),E(G)&&"@context"in G||(G={"@context":G}),h({activeCtx:V,localCtx:G,options:z}))},w.getContextValue=ur().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=Qt(),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=Bf()(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),$s=Y,$s}var Uf=qf();const Fs={},ks={};let da;class Hf{constructor(e){this.loadedExternalUrls=[],this.loadedClasses=[],this.config=e}async loadGraphs(){this.loadedExternalUrls=[],this.loadedClasses=[];let e=da;this.config.prefixes={};const t=[];if(e||(e=new tt,t.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?Hn(this.config.attributes.shapesUrl):"",e,gn))),t.push(this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?Hn(this.config.attributes.valuesUrl):"",e,Et)),await Promise.all(t),!da&&e.countQuads(null,null,null,gn)===0&&this.config.attributes.valuesSubject){const n=[...e.getObjects(this.config.attributes.valuesSubject,Ye,Et),...e.getObjects(this.config.attributes.valuesSubject,ia,Et)],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(Hn(a),e,gn)))}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=ou(s)==="xml"?new bf.RdfXmlParser:new Ad;l.on("data",c=>{if(t.add(new si(c.subject,c.predicate,c.object,n)),this.config.attributes.ignoreOwlImports===null&&Ea.equals(c.predicate)){const d=this.toURL(c.object.value);d&&this.loadedExternalUrls.indexOf(d)<0&&(this.loadedExternalUrls.push(d),a.push(this.importRDF(Hn(d),t,Re.namedNode(d))))}if(this.config.classInstanceProvider&&Sa.equals(c.predicate)){const d=c.object.value;if(this.loadedClasses.indexOf(d)<0){let b;d in ks?b=ks[d]:(b=this.config.classInstanceProvider(d),ks[d]=b),this.loadedClasses.push(d),a.push(this.importRDF(b,t,n))}}}).on("error",c=>{console.warn("failed parsing graph",n,c.message),u(c)}).on("prefix",(c,d)=>{c&&(this.config.prefixes[c]=d)}).on("end",()=>{o(null)}),l.write(s),l.end()});try{await Promise.allSettled(a)}catch(o){console.warn(o)}};if(e instanceof Promise&&(e=await e),e){if(ou(e)==="json")try{e=await Uf.toRDF(JSON.parse(e),{format:"application/n-quads"})}catch(s){console.error(s)}await i(e)}}toURL(e){if(aa(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),aa(e)))return e}}return null}}async function Hn(r){if(r in Fs)return Fs[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 Fs[r]=e,e}function ou(r){return/^\s*\{/.test(r)?"json":/^\s*<\?xml/.test(r)?"xml":"ttl"}function Vf(r){da=r}class Ps{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 lu{constructor(e,t){this.attributes=new Ps,this.loader=new Hf(this),this.prefixes={},this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new tt,this.theme=e,this.form=t,this.languages=[...new Set(navigator.languages.flatMap(n=>n.length>2?[n.toLocaleLowerCase(),n.substring(0,2)]:n)),""]}updateAttributes(e){const t=new Ps;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 Ps;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=qd(e),this.groups=[],e.forSubjects(t=>{this.groups.push(t.id)},Ye,`${xe}PropertyGroup`,null)}}function Gf(r){return"_:"+r.value}function Wf(r,e){return[...r].map(t=>e(t)).join(`
|
|
389
|
+
*/var Fs,su;function Vf(){if(su)return Fs;su=1;const r=Pa(),e=Df(),t=ht(),n=Cf(),i=t.IdentifierIssuer,s=gt(),a=Hc(),o=$f(),{expand:u}=Ff(),{flatten:l}=kf(),{fromRDF:c}=Pf(),{toRDF:h}=Bf(),{frameMergedOrDefault:b,cleanupNull:y}=qf(),{isArray:_,isObject:E,isString:v}=ut(),{isSubjectReference:x}=kt(),{expandIri:S,getInitialContext:m,process:d,processingMode:g}=hr(),{compact:N,compactIri:j}=Uf(),{createNodeMap:A,createMergedNodeMap:B,mergeNodeMaps:R}=gi(),{logEventHandler:F,logWarningEventHandler:q,safeEventHandler:D,setDefaultEventHandler:L,setupEventHandler:te,strictEventHandler:T,unhandledEventHandler:Z}=Tn(),k=function(w){const H={},Q=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:v(V)?V:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new i("_:b"),contextResolver:new n({sharedCache:Q})}),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(m(z),G,z);let re=await N({activeCtx:ee,element:U,options:z});z.compactArrays&&!z.graph&&_(re)?re.length===1?re=re[0]:re.length===0&&(re={}):z.graph&&E(re)&&(re=[re]),E(G)&&"@context"in G&&(G=G["@context"]),G=t.clone(G),_(G)||(G=[G]);const fe=G;G=[];for(let C=0;C<fe.length;++C)(!E(fe[C])||Object.keys(fe[C]).length>0)&&G.push(fe[C]);const ge=G.length>0;if(G.length===1&&(G=G[0]),_(re)){const C=j({activeCtx:ee,iri:"@graph",relativeTo:{vocab:!0}}),W=re;re={},ge&&(re["@context"]=G),re[C]=W}else if(E(re)&&ge){const C=re;re={"@context":G};for(const W in C)re[W]=C[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:Q})});const z={},U=[];if("expandContext"in G){const ge=t.clone(G.expandContext);E(ge)&&"@context"in ge?z.expandContext=ge:z.expandContext={"@context":ge},U.push(z.expandContext)}let ee;if(!v(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=m(G);for(const ge of U)re=await d({activeCtx:re,localCtx:ge,options:G});let fe=await u({activeCtx:re,element:z.input,options:G});return E(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:v(V)?V:"",contextResolver:new n({sharedCache:Q})});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:v(V)?V:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new n({sharedCache:Q})}),v(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(m(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),C=Object.keys(G).map(he=>S(ee,he,{vocab:!0}));fe.merged=!C.includes("@graph"),fe.is11=g(ee,1.1);const W=b(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=y(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:v(V)?V:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new n({sharedCache:Q})}),"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:v(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:v(V)?V:"",skipExpansion:!1,contextResolver:new n({sharedCache:Q})});let z;G.skipExpansion?z=V:z=await w.expand(V,G);const U=h(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:v(V)?V:"",contextResolver:new n({sharedCache:Q})});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:Q})});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),C=[],W=Object.keys(ge).sort();for(let he=0;he<W.length;++he){const pe=ge[W[he]];x(pe)||C.push(pe)}return G===null?C:(z.graph=!0,z.skipExpansion=!0,await w.compact(C,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");v(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:Q})}),G===null?m(z):(G=t.clone(G),E(G)&&"@context"in G||(G={"@context":G}),d({activeCtx:V,localCtx:G,options:z}))},w.getContextValue=hr().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=Jt(),w.logEventHandler=F,w.logWarningEventHandler=q,w.safeEventHandler=D,w.setDefaultEventHandler=L,w.strictEventHandler=T,w.unhandledEventHandler=Z,w.util=t,Object.assign(w,t),w.promises=w,w.RequestQueue=Uc(),w.JsonLdProcessor=Hf()(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),Fs=Y,Fs}var Gf=Vf();const ks={},Ps={};class Wf{constructor(e){this.loadedExternalUrls=[],this.config=e}async loadGraphs(){this.loadedExternalUrls=[],this.config.prefixes={};const e=[],t=new et;if(e.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?this.fetchRDF(this.config.attributes.shapesUrl):"",t,Nr)),e.push(this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?this.fetchRDF(this.config.attributes.valuesUrl):"",t,Dt)),await Promise.all(e),await this.fetchOwlImports(t),await this.fetchClassInstances(t),t.countQuads(null,null,null,Nr)===0){const n=new Set;this.config.attributes.valuesSubject&&t.forObjects(s=>n.add(s),this.config.attributes.valuesSubject,sa,Dt),this.config.attributes.shapeSubject&&n.add(Ne.namedNode(this.config.attributes.shapeSubject));const 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),t,Nr)))}try{await Promise.allSettled(i)}catch(s){console.warn(s)}}this.config.store=t}async importRDF(e,t,n){const i=async s=>{const a=[];await new Promise((o,u)=>{const l=au(s)==="xml"?new vf.RdfXmlParser:new Ad;l.on("data",c=>{t.add(new si(c.subject,c.predicate,c.object,n))}).on("error",c=>{console.warn("failed parsing graph",n,c.message),u(c)}).on("prefix",(c,h)=>{c&&(this.config.prefixes[c]=h)}).on("end",()=>{o(null)}),l.write(s),l.end()});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 Gf.toRDF(JSON.parse(e),{format:"application/n-quads"})}catch(s){console.error(s)}await i(e)}}async fetchRDF(e){if(e in ks)return console.log("--- cache hit",e),ks[e];let t=e;this.config.attributes.proxy&&(t=this.config.attributes.proxy+encodeURIComponent(e));const n=fetch(t,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then(i=>i.text());return ks[e]=n,n}async fetchOwlImports(e){if(this.config.attributes.ignoreOwlImports===null){const t=new Set;e.forObjects(i=>{t.add(i.value)},null,Ea,null);const n=[];for(const i of t){const s=this.toURL(i);s&&n.push(this.importRDF(this.fetchRDF(s),e,Ne.namedNode(s)))}return Promise.allSettled(n)}}async fetchClassInstances(e){if(this.config.classInstanceProvider){const t=new Set;e.forObjects(i=>{t.add(i.value)},null,Sa,null),e.forObjects(i=>{e.forObjects(s=>{t.add(s.value)},i,Rr,null)},null,uc,null);const n=[];for(const i of t){let s;i in Ps?(console.log("--- class cache hit",i),s=Ps[i]):(s=this.config.classInstanceProvider(i),Ps[i]=s),n.push(this.importRDF(s,e,Nr))}return Promise.all(n)}}toURL(e){if(oa(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),oa(e)))return e}}return null}}function au(r){return/^\s*\{/.test(r)?"json":/^\s*<\?xml/.test(r)?"xml":"ttl"}class Ms{constructor(){this.shapes=null,this.shapesUrl=null,this.shapeSubject=null,this.values=null,this.valuesUrl=null,this.valueSubject=null,this.valuesSubject=null,this.valuesNamespace="",this.valuesGraph=null,this.view=null,this.language=null,this.loading="Loading…",this.proxy=null,this.ignoreOwlImports=null,this.collapse=null,this.submitButton=null,this.generateNodeShapeReference=null,this.showNodeIds=null}}class ou{constructor(e,t){this.attributes=new Ms,this.loader=new Wf(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 Ms;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=Ne.namedNode(t.valuesGraph))}static dataAttributes(){const e=new Ms;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=qd(e),this.groups=[],e.forSubjects(t=>{this.groups.push(t.id)},tt,`${xe}PropertyGroup`,null)}}function zf(r){return"_:"+r.value}function Qf(r,e){return[...r].map(t=>e(t)).join(`
|
|
368
390
|
`)+`
|
|
369
|
-
`}function zf(){return""}function Vc(r){return"<"+r.value+">"}const Qf=/["\\\\\n\r]/,Xf=/["\\\\\n\r]/g,Jf={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function Kf(r){return Jf[r]}function Yf(r){return Qf.test(r)?r.replace(Xf,Kf):r}function Zf(r){const e=Yf(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 ep(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 tp(r){return"?"+r.value}function ot(r){if(!r)return null;if(r.termType==="BlankNode")return Gf(r);if(r.termType==="DefaultGraph")return zf();if(r.termType==="Literal")return Zf(r);if(r.termType==="NamedNode")return Vc(r);if(r.termType==="Quad"||r.subject&&r.predicate&&r.object&&r.graph)return ep(r,ot);if(r.termType==="Variable")return tp(r);if(r[Symbol.iterator])return Wf(r,ot);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(ot(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(ot(e));return t&&t.value}has(e){return this.index.has(ot(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const n=ot(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 uu{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 cu(r){try{return ot(r)}catch{return null}}class dt{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=ot(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(cu(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(cu(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 Ba{equals(e){return!!e&&e.termType===this.termType}}Ba.prototype.termType="DefaultGraph";Ba.prototype.value="";function du(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 Jn{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}}Jn.prototype.termType="Literal";class Tn{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Tn.prototype.termType="NamedNode";class qa{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)}}qa.prototype.termType="Quad";qa.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 rp=new Tn("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),hu=new Tn("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),np=new Tn("http://www.w3.org/2001/XMLSchema#string");class zc{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new Ba}}namedNode(e){return new Tn(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new Gc(e)}literal(e,t){return typeof t=="string"?new Jn(e,t,hu):typeof t?.language=="string"?new Jn(e,t.language,t.direction?rp:hu,t.direction):new Jn(e,"",t||np)}variable(e){return new Wc(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,n,i=this.defaultGraph()){return new qa(e,t,n,i)}fromTerm(e){return du(this,e)}fromQuad(e){return du(this,e)}}zc.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const Ua=new zc,ip={apply:(r,e,t)=>r(t[0]),get:(r,e)=>r(e)};function pt(r,{factory:e=Ua}={}){const t=(n="")=>e.namedNode(`${r}${n.raw||n}`);return typeof Proxy>"u"?t:new Proxy(t,ip)}pt("http://www.w3.org/2001/XMLSchema#");const vt=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 uu({dataset:e.dataset,start:t,end:n,quad:c}))});for(const c of i)for(const d of s)for(const b of a)for(const y of o){const _={subject:c,predicate:d,object:b,graph:y};_[t]=e.term;const E=e.factory.quad(_.subject,_.predicate,_.object,_.graph);e.dataset.add(E),l(E)}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]||vt.nil,a));for(let u=0;u<o.length;u++)e.dataset.add(e.factory.quad(o[u],vt.first,n[u],a)),e.dataset.add(e.factory.quad(o[u],vt.rest,o[u+1]||vt.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);!vt.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:!!(vt.nil.equals(e.term)||Fe.traverse({ptr:e,predicates:[vt.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(vt.nil);){const t=e.out([vt.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const n=e.out([vt.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 b of e)c=[...c,...Fe.traverseOne({ptr:b,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u})];d&&(c=c.filter(b=>!d.has(b.term))),e=c,l=[...l,...c],d=new dt(l.map(b=>b.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 b of a)for(const y of o){const _={subject:c,predicate:d,object:b,graph:y};_[t]=e.term;for(const E of e.dataset.match(_.subject,_.predicate,_.object,_.graph))l.push(u(new uu({dataset:e.dataset,end:n,quad:E,start:t}),e))}return l}}function fu(r,e){return e?t=>e(r.extend(t)):()=>{}}class pu{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:fu(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:fu(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 gu(r,e){return r?r.equals(e):r===e}function sp(r,e){return!(r.dataset!==e.dataset||!gu(r.graph,e.graph)||!gu(r.term,e.term))}function mu(r,e){return e?t=>e(new r.constructor({factory:r.factory,ptrs:[t]})):()=>{}}class ri{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 pu({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 dt(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=mu(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=mu(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=>sp(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 pu({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 cr=pt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),ap=pt("http://www.w3.org/2000/01/rdf-schema#"),ae=pt("http://www.w3.org/ns/shacl#"),ha=pt("https://schemas.link/shacl-next#"),Ha=pt("http://www.w3.org/2001/XMLSchema#");function op(r){return r?`{${[...r.quads()].map(e=>ot(e)).join(" ")}}`:"{}"}function lp(r){return r?`{${r.map(e=>op(e)).join(" ")}}`:"{}"}var Ms,yu;function up(){if(yu)return Ms;yu=1;var r=/\s/;function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}return Ms=e,Ms}var Bs,bu;function cp(){if(bu)return Bs;bu=1;var r=up(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return Bs=t,Bs}var qs,_u;function dp(){if(_u)return qs;_u=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return qs=r,qs}var Us,wu;function hp(){if(wu)return Us;wu=1;var r=typeof Er=="object"&&Er&&Er.Object===Object&&Er;return Us=r,Us}var Hs,vu;function fp(){if(vu)return Hs;vu=1;var r=hp(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Hs=t,Hs}var Vs,xu;function Qc(){if(xu)return Vs;xu=1;var r=fp(),e=r.Symbol;return Vs=e,Vs}var Gs,Eu;function pp(){if(Eu)return Gs;Eu=1;var r=Qc(),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 Gs=s,Gs}var Ws,Su;function gp(){if(Su)return Ws;Su=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return Ws=t,Ws}var zs,Iu;function mp(){if(Iu)return zs;Iu=1;var r=Qc(),e=pp(),t=gp(),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 zs=a,zs}var Qs,Nu;function yp(){if(Nu)return Qs;Nu=1;function r(e){return e!=null&&typeof e=="object"}return Qs=r,Qs}var Xs,Ru;function bp(){if(Ru)return Xs;Ru=1;var r=mp(),e=yp(),t="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&r(i)==t}return Xs=n,Xs}var Js,Tu;function _p(){if(Tu)return Js;Tu=1;var r=cp(),e=dp(),t=bp(),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 Js=u,Js}var Ks,Au;function wp(){if(Au)return Ks;Au=1;var r=_p(),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 Ks=n,Ks}var Ys,Du;function vp(){if(Du)return Ys;Du=1;var r=wp();function e(t){var n=r(t),i=n%1;return n===n?i?n-i:n:0}return Ys=e,Ys}var Zs,Ou;function xp(){if(Ou)return Zs;Ou=1;var r=vp(),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 Zs=t,Zs}var ea,Lu;function Ep(){if(Lu)return ea;Lu=1;var r=xp();function e(t){return r(2,t)}return ea=e,ea}var Sp=Ep();const yt=rd(Sp);let ju=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 ri({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([cr.type],[ae.ValidationReport]).addOut([ae.conforms],[this.factory.literal(this.conforms.toString(),Ha.boolean)]);for(const t of this.results)e.addOut([ae.result],[this.factory.blankNode()],n=>{t.build(n,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function Ip(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=ot(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:b=[]}={}){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=b,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(y=>n.literal(Ip(y.value,e),y.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([cr.type],[ae.ValidationResult]).addOut([ae.focusNode],this.focusNode.terms).addOut([ae.resultSeverity],[this.severity]).addOut([ae.sourceConstraint],this.source).addOut([ae.sourceConstraintComponent],[this.constraintComponent]).addOut([ae.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([ae.resultMessage],this.message);const 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 Va{constructor({factory:e,focusNode:t,options:n={debug:!1,details:!1},processed:i=new Set,report:s=new ju({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 Va({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new ju({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`${ot(e.ptr.term)} - ${ot(this.focusNode.term)} - ${lp(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:ha.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:ha.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 Rp(){return{generic:Tp()}}function Tp(){return r=>{r.trace(ha.TraversalConstraintComponent,{args:{},message:[r.factory.literal("Traversal")],value:r.valueOrNode})}}class Ap{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(Rp),[...i].map(s=>s(e)).filter(Boolean)}}var rr={},nr={},nn={},sn={},Cu;function Dr(){if(Cu)return sn;Cu=1,Object.defineProperty(sn,"__esModule",{value:!0}),sn.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 sn.Translator=r,sn}var $u;function Dp(){if($u)return nn;$u=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.TypeHandlerBoolean=void 0;const r=Dr();let e=class Xc{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(Xc.TYPE))}};return nn.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",nn}var an={},Fu;function Op(){if(Fu)return an;Fu=1,Object.defineProperty(an,"__esModule",{value:!0}),an.TypeHandlerDate=void 0;const r=Dr();let e=class fa{fromRdf(n,i){switch(i&&!n.value.match(fa.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(fa.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 an.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]$/},an}var on={},ku;function Lp(){if(ku)return on;ku=1,Object.defineProperty(on,"__esModule",{value:!0}),on.TypeHandlerNumberDouble=void 0;const r=Dr();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 on.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"],on}var ln={},Pu;function jp(){if(Pu)return ln;Pu=1,Object.defineProperty(ln,"__esModule",{value:!0}),ln.TypeHandlerNumberInteger=void 0;const r=Dr();let e=class fn{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<=fn.MAX_INT&&n>=fn.MIN_INT?s.namedNode(fn.TYPES[0]):s.namedNode(fn.TYPES[1])))}};return ln.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,ln}var un={},Mu;function Cp(){if(Mu)return un;Mu=1,Object.defineProperty(un,"__esModule",{value:!0}),un.TypeHandlerString=void 0;let r=class{fromRdf(t){return t.value}toRdf(t,{datatype:n,dataFactory:i}){return i.literal(t,n)}};return un.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"],un}var Bu;function qu(){return Bu||(Bu=1,function(r){var e=nr&&nr.__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=nr&&nr.__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(Dp(),r),t(Op(),r),t(Lp(),r),t(jp(),r),t(Cp(),r)}(nr)),nr}var ta={},Uu;function $p(){return Uu||(Uu=1,Object.defineProperty(ta,"__esModule",{value:!0})),ta}var Hu;function Fp(){return Hu||(Hu=1,function(r){var e=rr&&rr.__createBinding||(Object.create?function(y,_,E,v){v===void 0&&(v=E);var x=Object.getOwnPropertyDescriptor(_,E);(!x||("get"in x?!_.__esModule:x.writable||x.configurable))&&(x={enumerable:!0,get:function(){return _[E]}}),Object.defineProperty(y,v,x)}:function(y,_,E,v){v===void 0&&(v=E),y[v]=_[E]}),t=rr&&rr.__exportStar||function(y,_){for(var E in y)E!=="default"&&!Object.prototype.hasOwnProperty.call(_,E)&&e(_,y,E)};Object.defineProperty(r,"__esModule",{value:!0}),r.fromRdf=u,r.toRdf=l,r.getTermRaw=c,r.getSupportedRdfDatatypes=d,r.getSupportedJavaScriptPrimitives=b;const n=kc(),i=qu(),s=Dr();t(qu(),r),t($p(),r),t(Dr(),r);const a=new n.DataFactory,o=new s.Translator;o.registerHandler(new i.TypeHandlerString,i.TypeHandlerString.TYPES.map(y=>a.namedNode(y)),["string"]),o.registerHandler(new i.TypeHandlerBoolean,[i.TypeHandlerBoolean.TYPE].map(y=>a.namedNode(y)),["boolean"]),o.registerHandler(new i.TypeHandlerNumberDouble,i.TypeHandlerNumberDouble.TYPES.map(y=>a.namedNode(y)),["number"]),o.registerHandler(new i.TypeHandlerNumberInteger,i.TypeHandlerNumberInteger.TYPES.map(y=>a.namedNode(y)),["number"]),o.registerHandler(new i.TypeHandlerDate,i.TypeHandlerDate.TYPES.map(y=>a.namedNode(y)),["object"]);function u(y,_){return o.fromRdf(y,_)}function l(y,_){return _&&"namedNode"in _&&(_={dataFactory:_}),_=_||{},_&&!_.dataFactory&&(_.dataFactory=a),o.toRdf(y,_)}function c(y,_){return y.termType==="Literal"?u(y,_):y.value}function d(){return o.getSupportedRdfDatatypes()}function b(){return o.getSupportedJavaScriptPrimitives()}}(rr)),rr}var Sn=Fp();function Vu(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 kp(r){return r.terms.length===0?null:r.ptrs[0].isList()?[...r.list()].map(e=>Vu(e)):[Vu(r)]}class Pp{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 dt(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 pa(r){const e=new dt,n=new ri({dataset:r.dataset,terms:r.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[ap.subClassOf]});for(const i of n.ptrs)for(const{term:s}of i.nodes())e.add(s);return e}class Mp{constructor(e){this.targetClass=new dt([...pa(e.hasOut([cr.type],[ae.NodeShape])),...pa(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([cr.type],this.targetClass).ptrs,...e.focusNode.node(this.targetNode).ptrs,...t.execute({start:"object",end:"object",predicates:this.targetObjectsOf}).ptrs,...t.execute({start:"subject",end:"subject",predicates:this.targetSubjectsOf}).ptrs],i=e.focusNode.clone({ptrs:n});return i.node([...new dt(i.terms)])}}class Bp{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=yt(()=>{const n=this.ptr.out([ae.deactivated]).term;return n&&Sn.fromRdf(n)}),this._message=yt(()=>this.ptr.out([ae.message]).terms),this._path=yt(()=>kp(this.ptr.out([ae.path]))),this._severity=yt(()=>this.ptr.out([ae.severity]).term),this._shapeValidator=yt(()=>new Pp(this)),this._sparql=yt(()=>this.ptr.out([ae.sparql])),this._targetResolver=yt(()=>new Mp(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 qp(r){const e=parseInt(r.ptr.out([ae.maxCount]).value);return{property:Up(e)}}function Up(r){return e=>{e.test(e.values.terms.length<=r,ae.MaxCountConstraintComponent,{args:{maxCount:r},message:[e.factory.literal("More than {$maxCount} values")]})}}function Hp(r){const e=parseInt(r.ptr.out([ae.minCount]).value);return{property:Vp(e)}}function Vp(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 Gp(r,e){for(const t of r)if(!await e(t))return!1;return!0}async function Wp(r,e){return(await Promise.all(r.map(t=>e(t)))).filter(Boolean)}async function gi(r,e){return Promise.all(r.map(e))}async function zp(r,e){for(const t of r)if(await e(t))return!0;return!1}function Qp(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 gi(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 Jp(r){const e=r.validator.shape(r.ptr.out([ae.not]));return{generic:Kp(e)}}function Kp(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 Yp(r){const e=[...r.ptr.out([ae.or])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Zp(e)}}function Zp(r){return async e=>{let t=[],n;if(e.options.debug||e.options.details){const i=await gi(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 zp(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 eg(r){const e=[...r.ptr.out([ae.xone])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:tg(e)}}function tg(r){return async e=>{const t=await gi(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 rg(r){if(!Sn.fromRdf(r.ptr.out([ae.closed]).term))return null;const t=r.ptr.out([ae.property]).map(s=>r.validator.shape(s)),n=new dt(t.filter(s=>!s.deactivated).map(s=>s.path[0].predicates[0])),i=new dt([...r.ptr.out([ae.ignoredProperties]).list()||[]].map(s=>s.term));return{node:ng(n,i)}}function ng(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 ig(r){const e=r.ptr.out([ae.hasValue]).term;return{node:sg(e),property:ag(e)}}function sg(r){return e=>{e.test(r.equals(e.valueOrNode.term),ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Value must be {$hasValue}")]})}}function ag(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 og(r){const e=new dt([...r.ptr.out([ae.in]).list()].map(t=>t.term));return{generic:lg(e)}}function lg(r){return e=>{e.test(r.has(e.valueOrNode.term),ae.InConstraintComponent,{args:{in:[...r].map(t=>t.value).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})}}function $r(r,e){if(!r||r.termType!=="Literal"||!e||e.termType!=="Literal"||Gu(r)!==Gu(e))return null;const t=Sn.fromRdf(r),n=Sn.fromRdf(e);return typeof t!=typeof n?null:typeof t=="string"?t.localeCompare(n):t-n}function Gu(r){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return Ha.dateTime.equals(r.datatype)&&e.test(r.value)}function ug(r){const e=r.ptr.out([ae.disjoint]).term;return{generic:cg(e)}}function cg(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 dg(r){const e=r.ptr.out([ae.equals]).term;return{node:hg(e),property:fg(e)}}function hg(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 fg(r){return e=>{const t=new dt(e.focusNode.out([r]).terms),n=new dt(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 pg(r){const e=r.ptr.out([ae.lessThan]).term;return{property:gg(e)}}function gg(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=$r(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 mg(r){const e=r.ptr.out([ae.lessThanOrEquals]).term;return{property:yg(e)}}function yg(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=$r(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 bg(r){const e=r.ptr.out([ae.maxExclusive]).term;return{generic:_g(e)}}function _g(r){return e=>{const t=$r(e.valueOrNode.term,r);e.test(t!==null&&t<0,ae.MaxExclusiveConstraintComponent,{args:{maxExclusive:r},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})}}function wg(r){const e=r.ptr.out([ae.maxInclusive]).term;return{generic:vg(e)}}function vg(r){return e=>{const t=$r(e.valueOrNode.term,r);e.test(t!==null&&t<=0,ae.MaxInclusiveConstraintComponent,{args:{maxInclusive:r},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})}}function xg(r){const e=r.ptr.out([ae.minExclusive]).term;return{generic:Eg(e)}}function Eg(r){return e=>{const t=$r(e.valueOrNode.term,r);e.test(t!==null&&t>0,ae.MinExclusiveConstraintComponent,{args:{minExclusive:r},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})}}function Sg(r){const e=r.ptr.out([ae.minInclusive]).term;return{generic:Ig(e)}}function Ig(r){return e=>{const t=$r(e.valueOrNode.term,r);e.test(t!==null&&t>=0,ae.MinInclusiveConstraintComponent,{args:{minInclusive:r},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})}}function Ng(r){const e=[...r.ptr.out([ae.node])].map(t=>r.validator.shape(t));return{generic:Rg(e)}}function Rg(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 Tg(r){const e=[...r.ptr.out([ae.property])].map(t=>r.validator.shape(t));return{generic:Ag(e)}}function Ag(r){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const n of r)await n.validate(t)}}function Dg(r){const e=r.validator.shape(r.ptr.out([ae.qualifiedValueShape])),t=r.ptr.out([ae.qualifiedValueShapesDisjoint]).term,n=t?Sn.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:Og(e,n,s,o)}}function Og(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 Wp(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 gi([...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 Gp([...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 Lg(r,e){return e?e.slice(0,r.length)===r:!1}function jg(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=>Lg(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 $g(r){const e=parseInt(r.ptr.out([ae.maxLength]).value);return{generic:Fg(e)}}function Fg(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 kg(r){const e=parseInt(r.ptr.out([ae.minLength]).value);return{generic:Pg(e)}}function Pg(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 Mg(r){const e=r.ptr.out([ae.pattern]).value,t=r.ptr.out([ae.flags]).value,n=new RegExp(e,t);return{generic:Bg(e,t,n)}}function Bg(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 qg(r){const e=r.ptr.out([ae.uniqueLang]).term;return e.value==="true"&&Ha.boolean.equals(e.datatype)?{property:Ug()}:null}function Ug(){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 Kn=pt("http://www.w3.org/ns/shacl#"),Kc=pt("https://schemas.link/shacl-next#");class Or{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(Kn.Info)||e.severity.equals(Kn.Violation)||e.severity.equals(Kn.Warning))}}function Hg(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=ot(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}class ni{constructor({args:e={},factory:t,message:n=[],severity:i=Kn.Violation}={}){this.severity=i,this.message=n.map(s=>t.literal(Hg(s.value,e),s.language||null))}}class Ga{constructor({factory:e=Ua}={}){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 Vg{constructor({factory:e=Ua,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 Pe 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 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 ni({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 Gg=/^([-+]?[0-9]+)$/;class st extends Pe{constructor(e=null,t=null,n,{factory:i}={}){super(Gg,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 st(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 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 ni({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 ni({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 Wa extends Fr{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.values=new Set(e)}clone({factory:e}={}){return new Wa(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const n=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,i=[this.factory.literal(n)];t.push(new ni({factory:this.factory,message:i}))}return new Or({results:t})}validateSimple(e){return this.values.has(e.value)}}const Te={xsd:pt("http://www.w3.org/2001/XMLSchema#")},Wg=new Fr({datatypes:Te.xsd.anySimpleType}),zg=new Fr({datatypes:Te.xsd.anyAtomicType}),mi=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,Qg=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,Yc=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,za=/^(-?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))?)$/,Jg=/^(-?([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))?)$/,Kg=/^(-?([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))?)$/,Yg=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Zg=/^(--(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,em=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,tm=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,rm=/^(([0-9a-fA-F]{2})*)$/,nm=/^(((([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] ?= ?=))?)$/,im=new Pe(mi,Te.xsd.string),sm=new Wa(["1","true","0","false"],Te.xsd.boolean),am=new Pe(Qg,Te.xsd.decimal),om=new Pe(Yc,Te.xsd.float),lm=new Pe(Yc,Te.xsd.double),um=new Pe(za,Te.xsd.duration),cm=new Pe(Zc,Te.xsd.dateTime),dm=new Pe(Xg,Te.xsd.time),hm=new Pe(Jg,Te.xsd.date),fm=new Pe(Kg,Te.xsd.gYearMonth),pm=new Pe(Yg,Te.xsd.gYear),gm=new Pe(Zg,Te.xsd.gMonthDay),mm=new Pe(em,Te.xsd.gDay),ym=new Pe(tm,Te.xsd.gMonth),bm=new Pe(rm,Te.xsd.hexBinary),_m=new Pe(nm,Te.xsd.base64Binary),wm=new Pe(mi,Te.xsd.anyURI),ed=/^([^\u000d\u000a\u0009]*)$/,vm=/^([^ ]+( [^ ]+)*)*$/,xm=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,Em=/^([^DT]*)$/,Sm=/^([^YM]*[DT].*)$/,Im=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Nm=new Pe([mi,ed],Te.xsd.normalizedString),Rm=new Pe([mi,ed,vm],Te.xsd.token),Tm=new Pe(xm,Te.xsd.language),Am=new st(null,null,Te.xsd.integer),Dm=new st(null,"0",Te.xsd.nonPositiveInteger),Om=new st(null,"-1",Te.xsd.negativeInteger),Lm=new st("-9223372036854775808","9223372036854775807",Te.xsd.long),jm=new st("-2147483648","2147483647",Te.xsd.int),Cm=new st("-32768","32767",Te.xsd.short),$m=new st("-128","127",Te.xsd.byte),Fm=new st("0",null,Te.xsd.nonNegativeInteger),km=new st("0","18446744073709551615",Te.xsd.unsignedLong),Pm=new st("0","4294967295",Te.xsd.unsignedInt),Mm=new st("0","65535",Te.xsd.unsignedShort),Bm=new st("0","255",Te.xsd.unsignedByte),qm=new st("1",null,Te.xsd.positiveInteger),Um=new Pe([za,Em],Te.xsd.yearMonthDuration),Hm=new Pe([za,Sm],Te.xsd.dayTimeDuration),Vm=new Pe([Zc,Im],Te.xsd.dateTimeStamp),Gm=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:zg,anySimpleType:Wg,anyURI:wm,base64Binary:_m,boolean:sm,byte:$m,date:hm,dateTime:cm,dateTimeStamp:Vm,dayTimeDuration:Hm,decimal:am,double:lm,duration:um,float:om,gDay:mm,gMonth:ym,gMonthDay:gm,gYear:pm,gYearMonth:fm,hexBinary:bm,int:jm,integer:Am,language:Tm,long:Lm,negativeInteger:Om,nonNegativeInteger:Fm,nonPositiveInteger:Dm,normalizedString:Nm,positiveInteger:qm,short:Cm,string:im,time:dm,token:Rm,unsignedByte:Bm,unsignedInt:Pm,unsignedLong:km,unsignedShort:Mm,yearMonthDuration:Um},Symbol.toStringTag,{value:"Module"}));class Wm extends Vg{constructor({factory:e}={}){super({factory:e,validations:{...Gm}})}}const zm=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 Qm(r){const e=r.ptr.out([ae.class]).map(t=>pa(t));return{generic:Xm(e)}}function Xm(r){return e=>{const t=new dt(e.valueOrNode.out([cr.type]).terms);for(const n of r){const i=[...t].some(s=>n.has(s));e.test(i,ae.ClassConstraintComponent,{value:e.valueOrNode})}}}function Jm(r){const e=r.ptr.out([ae.datatype]).term,t=new Wm;return{generic:Km(e,t)}}function Km(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 Ym(r){const e=r.ptr.out([ae.nodeKind]).term,t=zm.get(e);return{generic:Zm(e,t)}}function Zm(r,e){return t=>{t.test(e.has(t.valueOrNode.term.termType),ae.NodeKindConstraintComponent,{args:{nodeKind:r},message:[t.factory.literal("Value does not have node kind {$nodeKind}")],value:t.valueOrNode})}}const ey=new Cr([[ae.maxCount,qp],[ae.minCount,Hp],[ae.and,Qp],[ae.not,Jp],[ae.or,Yp],[ae.xone,eg],[ae.closed,rg],[ae.hasValue,ig],[ae.in,og],[ae.disjoint,ug],[ae.equals,dg],[ae.lessThan,pg],[ae.lessThanOrEquals,mg],[ae.maxExclusive,bg],[ae.maxInclusive,wg],[ae.minExclusive,xg],[ae.minInclusive,Sg],[ae.node,Ng],[ae.property,Tg],[ae.qualifiedValueShape,Dg],[ae.languageIn,jg],[ae.maxLength,$g],[ae.minLength,kg],[ae.pattern,Mg],[ae.uniqueLang,qg],[ae.class,Qm],[ae.datatype,Jm],[ae.nodeKind,Ym]]);class ty{constructor(e,{factory:t,...n}){if(this.factory=t,this.options=n,this.registry=new Ap(ey),this.shapesPtr=new ri({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([cr.type],[ae.NodeShape]),...this.shapesPtr.hasOut([cr.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 Bp(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const n=new ri({...e,factory:this.factory}),i=new Va({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 ry=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new lu(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 lu.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 Zd())n.stylesheet&&t.push(n.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new Gt(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,gn)>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 Xd(n,e,this.config.prefixes)}toRDF(e=new tt){return this.shape?.toRDF(e),e}registerPlugin(e){Yd(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setSharedShapesGraph(e){Vf(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 si(this.shape.shaclSubject,Re.namedNode(xe+"targetNode"),this.shape.nodeId,this.config.valuesGraphId));try{const t=this.config.store,n=await new ty(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(`
|
|
391
|
+
`}function Xf(){return""}function Vc(r){return"<"+r.value+">"}const Jf=/["\\\\\n\r]/,Kf=/["\\\\\n\r]/g,Yf={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function Zf(r){return Yf[r]}function ep(r){return Jf.test(r)?r.replace(Kf,Zf):r}function tp(r){const e=ep(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 rp(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 np(r){return"?"+r.value}function ot(r){if(!r)return null;if(r.termType==="BlankNode")return zf(r);if(r.termType==="DefaultGraph")return Xf();if(r.termType==="Literal")return tp(r);if(r.termType==="NamedNode")return Vc(r);if(r.termType==="Quad"||r.subject&&r.predicate&&r.object&&r.graph)return rp(r,ot);if(r.termType==="Variable")return np(r);if(r[Symbol.iterator])return Qf(r,ot);throw new Error(`unknown termType ${r.termType}`)}class Fr{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(ot(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(ot(e));return t&&t.value}has(e){return this.index.has(ot(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const n=ot(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 ot(r)}catch{return null}}class ft{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=ot(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 Ba{equals(e){return!!e&&e.termType===this.termType}}Ba.prototype.termType="DefaultGraph";Ba.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 Jn{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}}Jn.prototype.termType="Literal";class An{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}An.prototype.termType="NamedNode";class qa{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)}}qa.prototype.termType="Quad";qa.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 ip=new An("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),du=new An("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),sp=new An("http://www.w3.org/2001/XMLSchema#string");class zc{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new Ba}}namedNode(e){return new An(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new Gc(e)}literal(e,t){return typeof t=="string"?new Jn(e,t,du):typeof t?.language=="string"?new Jn(e,t.language,t.direction?ip:du,t.direction):new Jn(e,"",t||sp)}variable(e){return new Wc(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,n,i=this.defaultGraph()){return new qa(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 Ua=new zc,ap={apply:(r,e,t)=>r(t[0]),get:(r,e)=>r(e)};function mt(r,{factory:e=Ua}={}){const t=(n="")=>e.namedNode(`${r}${n.raw||n}`);return typeof Proxy>"u"?t:new Proxy(t,ap)}mt("http://www.w3.org/2001/XMLSchema#");const xt=mt("http://www.w3.org/1999/02/22-rdf-syntax-ns#");mt("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 h of s)for(const b of a)for(const y of o){const _={subject:c,predicate:h,object:b,graph:y};_[t]=e.term;const E=e.factory.quad(_.subject,_.predicate,_.object,_.graph);e.dataset.add(E),l(E)}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]||xt.nil,a));for(let u=0;u<o.length;u++)e.dataset.add(e.factory.quad(o[u],xt.first,n[u],a)),e.dataset.add(e.factory.quad(o[u],xt.rest,o[u+1]||xt.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 h of c)e.dataset.delete(h)}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);!xt.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:h}={}){if(t==="add")return Fe.add({ptr:e,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l,callback:h});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:!!(xt.nil.equals(e.term)||Fe.traverse({ptr:e,predicates:[xt.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(xt.nil);){const t=e.out([xt.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const n=e.out([xt.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,h;do{c=[];for(const b of e)c=[...c,...Fe.traverseOne({ptr:b,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u})];h&&(c=c.filter(b=>!h.has(b.term))),e=c,l=[...l,...c],h=new ft(l.map(b=>b.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 h of s)for(const b of a)for(const y of o){const _={subject:c,predicate:h,object:b,graph:y};_[t]=e.term;for(const E of e.dataset.match(_.subject,_.predicate,_.object,_.graph))l.push(u(new lu({dataset:e.dataset,end:n,quad:E,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 op(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 ri{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 ft(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=>op(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]})}}mt("http://www.w3.org/2002/07/owl#");const fr=mt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),lp=mt("http://www.w3.org/2000/01/rdf-schema#"),ae=mt("http://www.w3.org/ns/shacl#"),ha=mt("https://schemas.link/shacl-next#"),Ha=mt("http://www.w3.org/2001/XMLSchema#");function up(r){return r?`{${[...r.quads()].map(e=>ot(e)).join(" ")}}`:"{}"}function cp(r){return r?`{${r.map(e=>up(e)).join(" ")}}`:"{}"}var Bs,mu;function dp(){if(mu)return Bs;mu=1;var r=/\s/;function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}return Bs=e,Bs}var qs,yu;function hp(){if(yu)return qs;yu=1;var r=dp(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return qs=t,qs}var Us,bu;function fp(){if(bu)return Us;bu=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return Us=r,Us}var Hs,_u;function pp(){if(_u)return Hs;_u=1;var r=typeof Sr=="object"&&Sr&&Sr.Object===Object&&Sr;return Hs=r,Hs}var Vs,wu;function gp(){if(wu)return Vs;wu=1;var r=pp(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Vs=t,Vs}var Gs,vu;function Qc(){if(vu)return Gs;vu=1;var r=gp(),e=r.Symbol;return Gs=e,Gs}var Ws,xu;function mp(){if(xu)return Ws;xu=1;var r=Qc(),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 Ws=s,Ws}var zs,Eu;function yp(){if(Eu)return zs;Eu=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return zs=t,zs}var Qs,Su;function bp(){if(Su)return Qs;Su=1;var r=Qc(),e=mp(),t=yp(),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 Qs=a,Qs}var Xs,Iu;function _p(){if(Iu)return Xs;Iu=1;function r(e){return e!=null&&typeof e=="object"}return Xs=r,Xs}var Js,Nu;function wp(){if(Nu)return Js;Nu=1;var r=bp(),e=_p(),t="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&r(i)==t}return Js=n,Js}var Ks,Ru;function vp(){if(Ru)return Ks;Ru=1;var r=hp(),e=fp(),t=wp(),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 h=s.test(l);return h||a.test(l)?o(l.slice(2),h?2:8):i.test(l)?n:+l}return Ks=u,Ks}var Ys,Tu;function xp(){if(Tu)return Ys;Tu=1;var r=vp(),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 Ys=n,Ys}var Zs,Au;function Ep(){if(Au)return Zs;Au=1;var r=xp();function e(t){var n=r(t),i=n%1;return n===n?i?n-i:n:0}return Zs=e,Zs}var ea,Du;function Sp(){if(Du)return ea;Du=1;var r=Ep(),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 ea=t,ea}var ta,Lu;function Ip(){if(Lu)return ta;Lu=1;var r=Sp();function e(t){return r(2,t)}return ta=e,ta}var Np=Ip();const _t=rd(Np);let Ou=class{constructor({details:e,factory:t,options:n,results:i=[]}={}){this.details=e,this.factory=t,this.options=n,this.results=i,this._conforms=_t(()=>!this.results.some(s=>s.severity.equals(ae.Info)||s.severity.equals(ae.Violation)||s.severity.equals(ae.Warning))),this._ptr=_t(()=>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 ri({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([fr.type],[ae.ValidationReport]).addOut([ae.conforms],[this.factory.literal(this.conforms.toString(),Ha.boolean)]);for(const t of this.results)e.addOut([ae.result],[this.factory.blankNode()],n=>{t.build(n,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function Rp(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=ot(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}let Tp=class{constructor({args:e={},constraintComponent:t,factory:n,focusNode:i,message:s=[],path:a,results:o=[],severity:u,shape:l,source:c=[],value:h,valuePaths:b=[]}={}){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=h,this.valuePaths=b,this._message=_t(()=>(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(y=>n.literal(Rp(y.value,e),y.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([fr.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 Va{constructor({factory:e,focusNode:t,options:n={debug:!1,details:!1},processed:i=new Set,report:s=new Ou({factory:e,options:n}),results:a=new Map,shape:o,value:u,valueOrNode:l,valuePaths:c,values:h}={}){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=h}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 Va({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new Ou({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`${ot(e.ptr.term)} - ${ot(this.focusNode.term)} - ${cp(this.valuePaths)}`}result(e){const t=new Tp({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:ha.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:ha.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 Ap(){return{generic:Dp()}}function Dp(){return r=>{r.trace(ha.TraversalConstraintComponent,{args:{},message:[r.factory.literal("Traversal")],value:r.valueOrNode})}}class Lp{constructor(e){this.validations=new Fr(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(Ap),[...i].map(s=>s(e)).filter(Boolean)}}var ir={},sr={},an={},on={},ju;function Or(){if(ju)return on;ju=1,Object.defineProperty(on,"__esModule",{value:!0}),on.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 on.Translator=r,on}var Cu;function Op(){if(Cu)return an;Cu=1,Object.defineProperty(an,"__esModule",{value:!0}),an.TypeHandlerBoolean=void 0;const r=Or();let e=class Xc{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(Xc.TYPE))}};return an.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",an}var ln={},$u;function jp(){if($u)return ln;$u=1,Object.defineProperty(ln,"__esModule",{value:!0}),ln.TypeHandlerDate=void 0;const r=Or();let e=class fa{fromRdf(n,i){switch(i&&!n.value.match(fa.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(fa.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 ln.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]$/},ln}var un={},Fu;function Cp(){if(Fu)return un;Fu=1,Object.defineProperty(un,"__esModule",{value:!0}),un.TypeHandlerNumberDouble=void 0;const r=Or();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 un.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"],un}var cn={},ku;function $p(){if(ku)return cn;ku=1,Object.defineProperty(cn,"__esModule",{value:!0}),cn.TypeHandlerNumberInteger=void 0;const r=Or();let e=class gn{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<=gn.MAX_INT&&n>=gn.MIN_INT?s.namedNode(gn.TYPES[0]):s.namedNode(gn.TYPES[1])))}};return cn.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,cn}var dn={},Pu;function Fp(){if(Pu)return dn;Pu=1,Object.defineProperty(dn,"__esModule",{value:!0}),dn.TypeHandlerString=void 0;let r=class{fromRdf(t){return t.value}toRdf(t,{datatype:n,dataFactory:i}){return i.literal(t,n)}};return dn.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"],dn}var Mu;function Bu(){return Mu||(Mu=1,function(r){var e=sr&&sr.__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=sr&&sr.__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(Op(),r),t(jp(),r),t(Cp(),r),t($p(),r),t(Fp(),r)}(sr)),sr}var ra={},qu;function kp(){return qu||(qu=1,Object.defineProperty(ra,"__esModule",{value:!0})),ra}var Uu;function Pp(){return Uu||(Uu=1,function(r){var e=ir&&ir.__createBinding||(Object.create?function(y,_,E,v){v===void 0&&(v=E);var x=Object.getOwnPropertyDescriptor(_,E);(!x||("get"in x?!_.__esModule:x.writable||x.configurable))&&(x={enumerable:!0,get:function(){return _[E]}}),Object.defineProperty(y,v,x)}:function(y,_,E,v){v===void 0&&(v=E),y[v]=_[E]}),t=ir&&ir.__exportStar||function(y,_){for(var E in y)E!=="default"&&!Object.prototype.hasOwnProperty.call(_,E)&&e(_,y,E)};Object.defineProperty(r,"__esModule",{value:!0}),r.fromRdf=u,r.toRdf=l,r.getTermRaw=c,r.getSupportedRdfDatatypes=h,r.getSupportedJavaScriptPrimitives=b;const n=kc(),i=Bu(),s=Or();t(Bu(),r),t(kp(),r),t(Or(),r);const a=new n.DataFactory,o=new s.Translator;o.registerHandler(new i.TypeHandlerString,i.TypeHandlerString.TYPES.map(y=>a.namedNode(y)),["string"]),o.registerHandler(new i.TypeHandlerBoolean,[i.TypeHandlerBoolean.TYPE].map(y=>a.namedNode(y)),["boolean"]),o.registerHandler(new i.TypeHandlerNumberDouble,i.TypeHandlerNumberDouble.TYPES.map(y=>a.namedNode(y)),["number"]),o.registerHandler(new i.TypeHandlerNumberInteger,i.TypeHandlerNumberInteger.TYPES.map(y=>a.namedNode(y)),["number"]),o.registerHandler(new i.TypeHandlerDate,i.TypeHandlerDate.TYPES.map(y=>a.namedNode(y)),["object"]);function u(y,_){return o.fromRdf(y,_)}function l(y,_){return _&&"namedNode"in _&&(_={dataFactory:_}),_=_||{},_&&!_.dataFactory&&(_.dataFactory=a),o.toRdf(y,_)}function c(y,_){return y.termType==="Literal"?u(y,_):y.value}function h(){return o.getSupportedRdfDatatypes()}function b(){return o.getSupportedJavaScriptPrimitives()}}(ir)),ir}var Sn=Pp();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 Mp(r){return r.terms.length===0?null:r.ptrs[0].isList()?[...r.list()].map(e=>Hu(e)):[Hu(r)]}class Bp{constructor(e){this.shape=e,this._compiled=_t(()=>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 ft(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 Fr).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 pa(r){const e=new ft,n=new ri({dataset:r.dataset,terms:r.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[lp.subClassOf]});for(const i of n.ptrs)for(const{term:s}of i.nodes())e.add(s);return e}class qp{constructor(e){this.targetClass=new ft([...pa(e.hasOut([fr.type],[ae.NodeShape])),...pa(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([fr.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 ft(i.terms)])}}class Up{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=_t(()=>{const n=this.ptr.out([ae.deactivated]).term;return n&&Sn.fromRdf(n)}),this._message=_t(()=>this.ptr.out([ae.message]).terms),this._path=_t(()=>Mp(this.ptr.out([ae.path]))),this._severity=_t(()=>this.ptr.out([ae.severity]).term),this._shapeValidator=_t(()=>new Bp(this)),this._sparql=_t(()=>this.ptr.out([ae.sparql])),this._targetResolver=_t(()=>new qp(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 Hp(r){const e=parseInt(r.ptr.out([ae.maxCount]).value);return{property:Vp(e)}}function Vp(r){return e=>{e.test(e.values.terms.length<=r,ae.MaxCountConstraintComponent,{args:{maxCount:r},message:[e.factory.literal("More than {$maxCount} values")]})}}function Gp(r){const e=parseInt(r.ptr.out([ae.minCount]).value);return{property:Wp(e)}}function Wp(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 zp(r,e){for(const t of r)if(!await e(t))return!1;return!0}async function Qp(r,e){return(await Promise.all(r.map(t=>e(t)))).filter(Boolean)}async function mi(r,e){return Promise.all(r.map(e))}async function Xp(r,e){for(const t of r)if(await e(t))return!0;return!1}function Jp(r){const e=[...r.ptr.out([ae.and])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Kp(e)}}function Kp(r){return async e=>{const t=await mi(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 Yp(r){const e=r.validator.shape(r.ptr.out([ae.not]));return{generic:Zp(e)}}function Zp(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 eg(r){const e=[...r.ptr.out([ae.or])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:tg(e)}}function tg(r){return async e=>{let t=[],n;if(e.options.debug||e.options.details){const i=await mi(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 Xp(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 rg(r){const e=[...r.ptr.out([ae.xone])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:ng(e)}}function ng(r){return async e=>{const t=await mi(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 ig(r){if(!Sn.fromRdf(r.ptr.out([ae.closed]).term))return null;const t=r.ptr.out([ae.property]).map(s=>r.validator.shape(s)),n=new ft(t.filter(s=>!s.deactivated).map(s=>s.path[0].predicates[0])),i=new ft([...r.ptr.out([ae.ignoredProperties]).list()||[]].map(s=>s.term));return{node:sg(n,i)}}function sg(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 ag(r){const e=r.ptr.out([ae.hasValue]).term;return{node:og(e),property:lg(e)}}function og(r){return e=>{e.test(r.equals(e.valueOrNode.term),ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Value must be {$hasValue}")]})}}function lg(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 ug(r){const e=new ft([...r.ptr.out([ae.in]).list()].map(t=>t.term));return{generic:cg(e)}}function cg(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 kr(r,e){if(!r||r.termType!=="Literal"||!e||e.termType!=="Literal"||Vu(r)!==Vu(e))return null;const t=Sn.fromRdf(r),n=Sn.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 Ha.dateTime.equals(r.datatype)&&e.test(r.value)}function dg(r){const e=r.ptr.out([ae.disjoint]).term;return{generic:hg(e)}}function hg(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 fg(r){const e=r.ptr.out([ae.equals]).term;return{node:pg(e),property:gg(e)}}function pg(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 gg(r){return e=>{const t=new ft(e.focusNode.out([r]).terms),n=new ft(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 mg(r){const e=r.ptr.out([ae.lessThan]).term;return{property:yg(e)}}function yg(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=kr(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 bg(r){const e=r.ptr.out([ae.lessThanOrEquals]).term;return{property:_g(e)}}function _g(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=kr(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 wg(r){const e=r.ptr.out([ae.maxExclusive]).term;return{generic:vg(e)}}function vg(r){return e=>{const t=kr(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 xg(r){const e=r.ptr.out([ae.maxInclusive]).term;return{generic:Eg(e)}}function Eg(r){return e=>{const t=kr(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 Sg(r){const e=r.ptr.out([ae.minExclusive]).term;return{generic:Ig(e)}}function Ig(r){return e=>{const t=kr(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 Ng(r){const e=r.ptr.out([ae.minInclusive]).term;return{generic:Rg(e)}}function Rg(r){return e=>{const t=kr(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 Tg(r){const e=[...r.ptr.out([ae.node])].map(t=>r.validator.shape(t));return{generic:Ag(e)}}function Ag(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 Dg(r){const e=[...r.ptr.out([ae.property])].map(t=>r.validator.shape(t));return{generic:Lg(e)}}function Lg(r){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const n of r)await n.validate(t)}}function Og(r){const e=r.validator.shape(r.ptr.out([ae.qualifiedValueShape])),t=r.ptr.out([ae.qualifiedValueShapesDisjoint]).term,n=t?Sn.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:jg(e,n,s,o)}}function jg(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 Qp(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 mi([...a],async h=>(await h.validate(i.create({child:!0,focusNode:u}))).report);return s.push(c.flatMap(h=>h.results)),!c.every(h=>h.conforms)}else return!await zp([...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 Cg(r,e){return e?e.slice(0,r.length)===r:!1}function $g(r){const e=[...new Set([...r.ptr.out([ae.languageIn]).list()].map(t=>t.value))];return{generic:Fg(e)}}function Fg(r){return e=>{const t=r.some(n=>Cg(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 kg(r){const e=parseInt(r.ptr.out([ae.maxLength]).value);return{generic:Pg(e)}}function Pg(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 Mg(r){const e=parseInt(r.ptr.out([ae.minLength]).value);return{generic:Bg(e)}}function Bg(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 qg(r){const e=r.ptr.out([ae.pattern]).value,t=r.ptr.out([ae.flags]).value,n=new RegExp(e,t);return{generic:Ug(e,t,n)}}function Ug(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 Hg(r){const e=r.ptr.out([ae.uniqueLang]).term;return e.value==="true"&&Ha.boolean.equals(e.datatype)?{property:Vg()}:null}function Vg(){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 Kn=mt("http://www.w3.org/ns/shacl#"),Kc=mt("https://schemas.link/shacl-next#");class jr{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(Kn.Info)||e.severity.equals(Kn.Violation)||e.severity.equals(Kn.Warning))}}function Gg(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=ot(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}class ni{constructor({args:e={},factory:t,message:n=[],severity:i=Kn.Violation}={}){this.severity=i,this.message=n.map(s=>t.literal(Gg(s.value,e),s.language||null))}}class Ga{constructor({factory:e=Ua}={}){this.factory=e}clone({factory:e}={}){return new Ga({factory:e||this.factory})}validate(){return new jr}validateSimple(){return!0}}class Pr 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 Pr({datatypes:this.datatypes,factory:e||this.factory})}}class Wg{constructor({factory:e=Ua,validations:t}={}){if(this.factory=e,this.validations=new Fr,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 jr}validateSimple(e){const t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}}class Pe extends Pr{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 ni({args:s,factory:this.factory,message:this.message,severity:i})});return new jr({results:t})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}}const zg=/^([-+]?[0-9]+)$/;class st extends Pe{constructor(e=null,t=null,n,{factory:i}={}){super(zg,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 st(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!Kc.Debug.equals(t[0].severity))return new jr({results:t});const 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 ni({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 ni({factory:this.factory,message:s}))}return new jr({results:t})}validateSimple(e){if(!super.validateSimple(e))return!1;const t=BigInt(e.value);return!(this.minInclusive!==null&&t<this.minInclusive||this.maxInclusive!==null&&t>this.maxInclusive)}}class Wa extends Pr{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.values=new Set(e)}clone({factory:e}={}){return new Wa(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const n=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,i=[this.factory.literal(n)];t.push(new ni({factory:this.factory,message:i}))}return new jr({results:t})}validateSimple(e){return this.values.has(e.value)}}const Te={xsd:mt("http://www.w3.org/2001/XMLSchema#")},Qg=new Pr({datatypes:Te.xsd.anySimpleType}),Xg=new Pr({datatypes:Te.xsd.anyAtomicType}),yi=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,Jg=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,Yc=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,za=/^(-?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))?)$/,Kg=/^((([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))?)$/,Yg=/^(-?([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))?)$/,Zg=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,em=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,tm=/^(--(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,rm=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,nm=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,im=/^(([0-9a-fA-F]{2})*)$/,sm=/^(((([A-Za-z0-9+/] ?){4})*(([A-Za-z0-9+/] ?){3}[A-Za-z0-9+/]|([A-Za-z0-9+/] ?){2}[AEIMQUYcgkosw048] ?=|[A-Za-z0-9+/] ?[AQgw] ?= ?=))?)$/,am=new Pe(yi,Te.xsd.string),om=new Wa(["1","true","0","false"],Te.xsd.boolean),lm=new Pe(Jg,Te.xsd.decimal),um=new Pe(Yc,Te.xsd.float),cm=new Pe(Yc,Te.xsd.double),dm=new Pe(za,Te.xsd.duration),hm=new Pe(Zc,Te.xsd.dateTime),fm=new Pe(Kg,Te.xsd.time),pm=new Pe(Yg,Te.xsd.date),gm=new Pe(Zg,Te.xsd.gYearMonth),mm=new Pe(em,Te.xsd.gYear),ym=new Pe(tm,Te.xsd.gMonthDay),bm=new Pe(rm,Te.xsd.gDay),_m=new Pe(nm,Te.xsd.gMonth),wm=new Pe(im,Te.xsd.hexBinary),vm=new Pe(sm,Te.xsd.base64Binary),xm=new Pe(yi,Te.xsd.anyURI),ed=/^([^\u000d\u000a\u0009]*)$/,Em=/^([^ ]+( [^ ]+)*)*$/,Sm=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,Im=/^([^DT]*)$/,Nm=/^([^YM]*[DT].*)$/,Rm=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Tm=new Pe([yi,ed],Te.xsd.normalizedString),Am=new Pe([yi,ed,Em],Te.xsd.token),Dm=new Pe(Sm,Te.xsd.language),Lm=new st(null,null,Te.xsd.integer),Om=new st(null,"0",Te.xsd.nonPositiveInteger),jm=new st(null,"-1",Te.xsd.negativeInteger),Cm=new st("-9223372036854775808","9223372036854775807",Te.xsd.long),$m=new st("-2147483648","2147483647",Te.xsd.int),Fm=new st("-32768","32767",Te.xsd.short),km=new st("-128","127",Te.xsd.byte),Pm=new st("0",null,Te.xsd.nonNegativeInteger),Mm=new st("0","18446744073709551615",Te.xsd.unsignedLong),Bm=new st("0","4294967295",Te.xsd.unsignedInt),qm=new st("0","65535",Te.xsd.unsignedShort),Um=new st("0","255",Te.xsd.unsignedByte),Hm=new st("1",null,Te.xsd.positiveInteger),Vm=new Pe([za,Im],Te.xsd.yearMonthDuration),Gm=new Pe([za,Nm],Te.xsd.dayTimeDuration),Wm=new Pe([Zc,Rm],Te.xsd.dateTimeStamp),zm=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:Xg,anySimpleType:Qg,anyURI:xm,base64Binary:vm,boolean:om,byte:km,date:pm,dateTime:hm,dateTimeStamp:Wm,dayTimeDuration:Gm,decimal:lm,double:cm,duration:dm,float:um,gDay:bm,gMonth:_m,gMonthDay:ym,gYear:mm,gYearMonth:gm,hexBinary:wm,int:$m,integer:Lm,language:Dm,long:Cm,negativeInteger:jm,nonNegativeInteger:Pm,nonPositiveInteger:Om,normalizedString:Tm,positiveInteger:Hm,short:Fm,string:am,time:fm,token:Am,unsignedByte:Um,unsignedInt:Bm,unsignedLong:Mm,unsignedShort:qm,yearMonthDuration:Vm},Symbol.toStringTag,{value:"Module"}));class Qm extends Wg{constructor({factory:e}={}){super({factory:e,validations:{...zm}})}}const Xm=new Fr([[ae.BlankNode,new Set(["BlankNode"])],[ae.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[ae.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[ae.IRI,new Set(["NamedNode"])],[ae.IRIOrLiteral,new Set(["NamedNode","Literal"])],[ae.Literal,new Set(["Literal"])]]);function Jm(r){const e=r.ptr.out([ae.class]).map(t=>pa(t));return{generic:Km(e)}}function Km(r){return e=>{const t=new ft(e.valueOrNode.out([fr.type]).terms);for(const n of r){const i=[...t].some(s=>n.has(s));e.test(i,ae.ClassConstraintComponent,{value:e.valueOrNode})}}}function Ym(r){const e=r.ptr.out([ae.datatype]).term,t=new Qm;return{generic:Zm(e,t)}}function Zm(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 ey(r){const e=r.ptr.out([ae.nodeKind]).term,t=Xm.get(e);return{generic:ty(e,t)}}function ty(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 ry=new Fr([[ae.maxCount,Hp],[ae.minCount,Gp],[ae.and,Jp],[ae.not,Yp],[ae.or,eg],[ae.xone,rg],[ae.closed,ig],[ae.hasValue,ag],[ae.in,ug],[ae.disjoint,dg],[ae.equals,fg],[ae.lessThan,mg],[ae.lessThanOrEquals,bg],[ae.maxExclusive,wg],[ae.maxInclusive,xg],[ae.minExclusive,Sg],[ae.minInclusive,Ng],[ae.node,Tg],[ae.property,Dg],[ae.qualifiedValueShape,Og],[ae.languageIn,$g],[ae.maxLength,kg],[ae.minLength,Mg],[ae.pattern,qg],[ae.uniqueLang,Hg],[ae.class,Jm],[ae.datatype,Ym],[ae.nodeKind,ey]]);class ny{constructor(e,{factory:t,...n}){if(this.factory=t,this.options=n,this.registry=new Lp(ry),this.shapesPtr=new ri({dataset:e,factory:t}),this.shapes=new Fr,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([fr.type],[ae.NodeShape]),...this.shapesPtr.hasOut([fr.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 Up(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const n=new ri({...e,factory:this.factory}),i=new Va({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 iy=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 Zd())n.stylesheet&&t.push(n.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new Wt(e,this.config,this.config.attributes.valuesSubject?Ne.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.editMode){if(this.config.attributes.submitButton!==null){const 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(Ne.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,Nr)>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 Xd(n,e,this.config.prefixes)}toRDF(e=new et){return this.shape?.toRDF(e),e}registerPlugin(e){Yd(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}async validate(e=!1){for(const t of this.form.querySelectorAll(":scope .validation-error"))t.remove();for(const t of this.form.querySelectorAll(":scope .property-instance"))t.classList.remove("invalid"),t.querySelector(":scope > .editor")?.value?t.classList.add("valid"):t.classList.remove("valid");this.config.store.deleteGraph(this.config.valuesGraphId||""),this.shape?.toRDF(this.config.store),this.shape&&this.config.store.add(new si(this.shape.shaclSubject,Ne.namedNode(xe+"targetNode"),this.shape.nodeId,this.config.valuesGraphId));try{const t=this.config.store,n=await new ny(t,{details:!0,factory:Ne}).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(`
|
|
370
392
|
:scope shacl-node[data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${o.id}'] > .editor,
|
|
371
393
|
:scope shacl-node[data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${o.id}'] > .editor,
|
|
372
394
|
:scope shacl-node[data-node-id='${a.id}'] > .shacl-group > shacl-property > .property-instance[data-path='${o.id}'] > .editor,
|
|
373
395
|
: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(`
|
|
374
396
|
:scope [data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${o.id}'],
|
|
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
|
|
376
|
-
`;else n.title=e.sourceConstraintComponent?.value;return n}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=
|
|
397
|
+
: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 nt&&(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+`
|
|
398
|
+
`;else n.title=e.sourceConstraintComponent?.value;return n}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=Ne.namedNode(this.config.attributes.shapeSubject),this.config.store.getQuads(e,tt,qn,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,Dt)>0){const t=Ne.namedNode(this.config.attributes.valuesSubject),n=[...this.config.store.getQuads(t,tt,null,Dt),...this.config.store.getQuads(t,sa,null,Dt)];if(n.length===0){console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${tt.id} nor ${sa.id} statement`);return}for(const i of n)if(this.config.store.getQuads(i.object,tt,qn,null).length>0){e=i.object;break}if(!e){const i=this.config.store.getQuads(null,Rr,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,qn,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,qn,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,Dt))this.config.store.delete(t),(t.object.termType==="NamedNode"||t.object.termType==="BlankNode")&&this.removeFromDataGraph(t.object)}};const sy=`.editor:not([type='checkbox']) { border: 1px solid #DDD; }
|
|
377
399
|
.property-instance label { display: inline-flex; word-break: break-word; line-height: 1em; padding-top: 0.15em; padding-right: 1em; flex-shrink: 0; position: relative; }
|
|
378
400
|
.property-instance:not(:first-child) > label:not(.persistent) { visibility: hidden; max-height: 0; }
|
|
379
401
|
.mode-edit .property-instance label { width: var(--label-width); }
|
|
380
|
-
`;class
|
|
402
|
+
`;class ay extends zd{constructor(e){super(e||sy),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 ii&&(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===Gt+"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===Gt+"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 cr,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!==Gt+"integer"&&(s.step="0.1"),this.createDefaultTemplate(e,t,n,s,i)}createListEditor(e,t,n,i,s){const a=new Ge;a.clearable=!0,a.dense=!0;const o=this.createDefaultTemplate(e,null,n,a,s),u=document.createElement("ul");let l=!0;const c=(h,b)=>{const y=document.createElement("li");if(typeof h.value=="string"?(y.dataset.value=h.value,y.innerText=h.label?h.label:h.value):(h.value instanceof ct&&h.value.datatype.equals(Pd)?y.dataset.value=h.value.value:y.dataset.value=h.value.id,y.innerText=h.label?h.label:h.value.value),b.appendChild(y),h.children?.length){l=!1;const _=document.createElement("ul");y.appendChild(_);for(const E of h.children)c(E,_)}};for(const h of i)c(h,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 oy extends iy{constructor(){super(new ay)}}window.customElements.define("shacl-form",oy);export{ou as Config,Wf as Loader,gy as Plugin,oy as ShaclForm,Gd as ShaclPropertyTemplate,zd as Theme,Nn as findLabel,Yd as registerPlugin};
|