@opengeospatial/jsonld-ui-utils 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var jsonldUIUtils=function(t){"use strict";async function e(t){const e=new Map,i=async(t,e)=>{for(const[s,n]of Object.entries(t))"@context"===s?t[s]=await r(n,e):"object"==typeof n&&null!==n&&await i(n,e)},r=async(t,s)=>{if(null==t)return{};if(Array.isArray(t)){return(t=>{const e=(t,e)=>{if(!t||!Object.keys(t).length)return e;const i={...t};for(const[t,r]of Object.entries(e))i[t]=r;return i};if(!t.length)return{};if(1===t.length)return t[0];let i=t[0];for(let r=1;r<t.length;r++)i=e(i,t[r]);return i})(await Promise.all(t.map(t=>r(t,s))))}if("object"==typeof t)return await i(t,s),t;{if(null==s?void 0:s.includes(t))throw new Error("Circular dependencies found: "+s.join(" -> ")+" -> "+t);const i=Array.isArray(s)?null==s?void 0:s.slice():[];let n;return i.push(t),e.has(t)?n=e.get(t):(n=await(async t=>{const e=await fetch(t,{headers:{Accept:"application/json"}});return await e.json()})(t),e.set(t,n)),r(n["@context"],i)}};return r("object"==typeof t&&null!==t&&"@context"in t?t["@context"]:t)}var i=Object.freeze({__proto__:null,loadContext:e});const r=t=>e=>`${t}${e}`,s=r("http://www.w3.org/2004/02/skos/core#"),n=r("http://www.w3.org/2000/01/rdf-schema#"),a=r("http://purl.org/dc/terms/"),o=r("http://purl.org/dc/elements/1.1/"),h=r("https://schema.org/"),u=r("http://xmlns.com/foaf/0.1/"),l=[s("prefLabel"),a("title"),o("title"),h("name"),u("name"),n("label")],c=[s("definition"),a("description"),o("description"),n("comment")];var d="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},f=[],p=[],_="undefined"!=typeof Uint8Array?Uint8Array:Array,g=!1;function b(){g=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)f[e]=t[e],p[t.charCodeAt(e)]=e;p["-".charCodeAt(0)]=62,p["_".charCodeAt(0)]=63}function m(t){return f[t>>18&63]+f[t>>12&63]+f[t>>6&63]+f[63&t]}function y(t,e,i){for(var r,s=[],n=e;n<i;n+=3)r=(t[n]<<16)+(t[n+1]<<8)+t[n+2],s.push(m(r));return s.join("")}function x(t){var e;g||b();for(var i=t.length,r=i%3,s="",n=[],a=16383,o=0,h=i-r;o<h;o+=a)n.push(y(t,o,o+a>h?h:o+a));return 1===r?(e=t[i-1],s+=f[e>>2],s+=f[e<<4&63],s+="=="):2===r&&(e=(t[i-2]<<8)+t[i-1],s+=f[e>>10],s+=f[e>>4&63],s+=f[e<<2&63],s+="="),n.push(s),n.join("")}function v(t,e,i,r,s){var n,a,o=8*s-r-1,h=(1<<o)-1,u=h>>1,l=-7,c=i?s-1:0,d=i?-1:1,f=t[e+c];for(c+=d,n=f&(1<<-l)-1,f>>=-l,l+=o;l>0;n=256*n+t[e+c],c+=d,l-=8);for(a=n&(1<<-l)-1,n>>=-l,l+=r;l>0;a=256*a+t[e+c],c+=d,l-=8);if(0===n)n=1-u;else{if(n===h)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),n-=u}return(f?-1:1)*a*Math.pow(2,n-r)}function w(t,e,i,r,s,n){var a,o,h,u=8*n-s-1,l=(1<<u)-1,c=l>>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:n-1,p=r?1:-1,_=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-a))<1&&(a--,h*=2),(e+=a+c>=1?d/h:d*Math.pow(2,1-c))*h>=2&&(a++,h/=2),a+c>=l?(o=0,a=l):a+c>=1?(o=(e*h-1)*Math.pow(2,s),a+=c):(o=e*Math.pow(2,c-1)*Math.pow(2,s),a=0));s>=8;t[i+f]=255&o,f+=p,o/=256,s-=8);for(a=a<<s|o,u+=s;u>0;t[i+f]=255&a,f+=p,a/=256,u-=8);t[i+f-p]|=128*_}var T={}.toString,I=Array.isArray||function(t){return"[object Array]"==T.call(t)};function E(){return N.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function R(t,e){if(E()<e)throw new RangeError("Invalid typed array length");return N.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=N.prototype:(null===t&&(t=new N(e)),t.length=e),t}function N(t,e,i){if(!(N.TYPED_ARRAY_SUPPORT||this instanceof N))return new N(t,e,i);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return C(this,t)}return j(this,t,e,i)}function j(t,e,i,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,i,r){if(e.byteLength,i<0||e.byteLength<i)throw new RangeError("'offset' is out of bounds");if(e.byteLength<i+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===i&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,i):new Uint8Array(e,i,r);N.TYPED_ARRAY_SUPPORT?(t=e).__proto__=N.prototype:t=P(t,e);return t}(t,e,i,r):"string"==typeof e?function(t,e,i){"string"==typeof i&&""!==i||(i="utf8");if(!N.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var r=0|$(e,i);t=R(t,r);var s=t.write(e,i);s!==r&&(t=t.slice(0,s));return t}(t,e,i):function(t,e){if(A(e)){var i=0|k(e.length);return 0===(t=R(t,i)).length||e.copy(t,0,0,i),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?R(t,0):P(t,e);if("Buffer"===e.type&&I(e.data))return P(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function S(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function C(t,e){if(S(e),t=R(t,e<0?0:0|k(e)),!N.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)t[i]=0;return t}function P(t,e){var i=e.length<0?0:0|k(e.length);t=R(t,i);for(var r=0;r<i;r+=1)t[r]=255&e[r];return t}function k(t){if(t>=E())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+E().toString(16)+" bytes");return 0|t}function A(t){return!(null==t||!t._isBuffer)}function $(t,e){if(A(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return ot(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return ht(t).length;default:if(r)return ot(t).length;e=(""+e).toLowerCase(),r=!0}}function D(t,e,i){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return W(this,e,i);case"utf8":case"utf-8":return z(this,e,i);case"ascii":return V(this,e,i);case"latin1":case"binary":return X(this,e,i);case"base64":return G(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Z(this,e,i);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function O(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function F(t,e,i,r,s){if(0===t.length)return-1;if("string"==typeof i?(r=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=s?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(s)return-1;i=t.length-1}else if(i<0){if(!s)return-1;i=0}if("string"==typeof e&&(e=N.from(e,r)),A(e))return 0===e.length?-1:L(t,e,i,r,s);if("number"==typeof e)return e&=255,N.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):L(t,[e],i,r,s);throw new TypeError("val must be string, number or Buffer")}function L(t,e,i,r,s){var n,a=1,o=t.length,h=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,o/=2,h/=2,i/=2}function u(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(s){var l=-1;for(n=i;n<o;n++)if(u(t,n)===u(e,-1===l?0:n-l)){if(-1===l&&(l=n),n-l+1===h)return l*a}else-1!==l&&(n-=n-l),l=-1}else for(i+h>o&&(i=o-h),n=i;n>=0;n--){for(var c=!0,d=0;d<h;d++)if(u(t,n+d)!==u(e,d)){c=!1;break}if(c)return n}return-1}function M(t,e,i,r){i=Number(i)||0;var s=t.length-i;r?(r=Number(r))>s&&(r=s):r=s;var n=e.length;if(n%2!=0)throw new TypeError("Invalid hex string");r>n/2&&(r=n/2);for(var a=0;a<r;++a){var o=parseInt(e.substr(2*a,2),16);if(isNaN(o))return a;t[i+a]=o}return a}function B(t,e,i,r){return ut(ot(e,t.length-i),t,i,r)}function q(t,e,i,r){return ut(function(t){for(var e=[],i=0;i<t.length;++i)e.push(255&t.charCodeAt(i));return e}(e),t,i,r)}function U(t,e,i,r){return q(t,e,i,r)}function Q(t,e,i,r){return ut(ht(e),t,i,r)}function H(t,e,i,r){return ut(function(t,e){for(var i,r,s,n=[],a=0;a<t.length&&!((e-=2)<0);++a)r=(i=t.charCodeAt(a))>>8,s=i%256,n.push(s),n.push(r);return n}(e,t.length-i),t,i,r)}function G(t,e,i){return 0===e&&i===t.length?x(t):x(t.slice(e,i))}function z(t,e,i){i=Math.min(t.length,i);for(var r=[],s=e;s<i;){var n,a,o,h,u=t[s],l=null,c=u>239?4:u>223?3:u>191?2:1;if(s+c<=i)switch(c){case 1:u<128&&(l=u);break;case 2:128==(192&(n=t[s+1]))&&(h=(31&u)<<6|63&n)>127&&(l=h);break;case 3:n=t[s+1],a=t[s+2],128==(192&n)&&128==(192&a)&&(h=(15&u)<<12|(63&n)<<6|63&a)>2047&&(h<55296||h>57343)&&(l=h);break;case 4:n=t[s+1],a=t[s+2],o=t[s+3],128==(192&n)&&128==(192&a)&&128==(192&o)&&(h=(15&u)<<18|(63&n)<<12|(63&a)<<6|63&o)>65535&&h<1114112&&(l=h)}null===l?(l=65533,c=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),s+=c}return function(t){var e=t.length;if(e<=Y)return String.fromCharCode.apply(String,t);var i="",r=0;for(;r<e;)i+=String.fromCharCode.apply(String,t.slice(r,r+=Y));return i}(r)}N.TYPED_ARRAY_SUPPORT=void 0===d.TYPED_ARRAY_SUPPORT||d.TYPED_ARRAY_SUPPORT,E(),N.poolSize=8192,N._augment=function(t){return t.__proto__=N.prototype,t},N.from=function(t,e,i){return j(null,t,e,i)},N.TYPED_ARRAY_SUPPORT&&(N.prototype.__proto__=Uint8Array.prototype,N.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&N[Symbol.species]),N.alloc=function(t,e,i){return function(t,e,i,r){return S(e),e<=0?R(t,e):void 0!==i?"string"==typeof r?R(t,e).fill(i,r):R(t,e).fill(i):R(t,e)}(null,t,e,i)},N.allocUnsafe=function(t){return C(null,t)},N.allocUnsafeSlow=function(t){return C(null,t)},N.isBuffer=function(t){return null!=t&&(!!t._isBuffer||lt(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&lt(t.slice(0,0))}(t))},N.compare=function(t,e){if(!A(t)||!A(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var i=t.length,r=e.length,s=0,n=Math.min(i,r);s<n;++s)if(t[s]!==e[s]){i=t[s],r=e[s];break}return i<r?-1:r<i?1:0},N.isEncoding=function(t){switch(String(t).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}},N.concat=function(t,e){if(!I(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return N.alloc(0);var i;if(void 0===e)for(e=0,i=0;i<t.length;++i)e+=t[i].length;var r=N.allocUnsafe(e),s=0;for(i=0;i<t.length;++i){var n=t[i];if(!A(n))throw new TypeError('"list" argument must be an Array of Buffers');n.copy(r,s),s+=n.length}return r},N.byteLength=$,N.prototype._isBuffer=!0,N.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)O(this,e,e+1);return this},N.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)O(this,e,e+3),O(this,e+1,e+2);return this},N.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)O(this,e,e+7),O(this,e+1,e+6),O(this,e+2,e+5),O(this,e+3,e+4);return this},N.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?z(this,0,t):D.apply(this,arguments)},N.prototype.equals=function(t){if(!A(t))throw new TypeError("Argument must be a Buffer");return this===t||0===N.compare(this,t)},N.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},N.prototype.compare=function(t,e,i,r,s){if(!A(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===r&&(r=0),void 0===s&&(s=this.length),e<0||i>t.length||r<0||s>this.length)throw new RangeError("out of range index");if(r>=s&&e>=i)return 0;if(r>=s)return-1;if(e>=i)return 1;if(this===t)return 0;for(var n=(s>>>=0)-(r>>>=0),a=(i>>>=0)-(e>>>=0),o=Math.min(n,a),h=this.slice(r,s),u=t.slice(e,i),l=0;l<o;++l)if(h[l]!==u[l]){n=h[l],a=u[l];break}return n<a?-1:a<n?1:0},N.prototype.includes=function(t,e,i){return-1!==this.indexOf(t,e,i)},N.prototype.indexOf=function(t,e,i){return F(this,t,e,i,!0)},N.prototype.lastIndexOf=function(t,e,i){return F(this,t,e,i,!1)},N.prototype.write=function(t,e,i,r){if(void 0===e)r="utf8",i=this.length,e=0;else if(void 0===i&&"string"==typeof e)r=e,i=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(i)?(i|=0,void 0===r&&(r="utf8")):(r=i,i=void 0)}var s=this.length-e;if((void 0===i||i>s)&&(i=s),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var n=!1;;)switch(r){case"hex":return M(this,t,e,i);case"utf8":case"utf-8":return B(this,t,e,i);case"ascii":return q(this,t,e,i);case"latin1":case"binary":return U(this,t,e,i);case"base64":return Q(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return H(this,t,e,i);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),n=!0}},N.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Y=4096;function V(t,e,i){var r="";i=Math.min(t.length,i);for(var s=e;s<i;++s)r+=String.fromCharCode(127&t[s]);return r}function X(t,e,i){var r="";i=Math.min(t.length,i);for(var s=e;s<i;++s)r+=String.fromCharCode(t[s]);return r}function W(t,e,i){var r=t.length;(!e||e<0)&&(e=0),(!i||i<0||i>r)&&(i=r);for(var s="",n=e;n<i;++n)s+=at(t[n]);return s}function Z(t,e,i){for(var r=t.slice(e,i),s="",n=0;n<r.length;n+=2)s+=String.fromCharCode(r[n]+256*r[n+1]);return s}function K(t,e,i){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>i)throw new RangeError("Trying to access beyond buffer length")}function J(t,e,i,r,s,n){if(!A(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>s||e<n)throw new RangeError('"value" argument is out of bounds');if(i+r>t.length)throw new RangeError("Index out of range")}function tt(t,e,i,r){e<0&&(e=65535+e+1);for(var s=0,n=Math.min(t.length-i,2);s<n;++s)t[i+s]=(e&255<<8*(r?s:1-s))>>>8*(r?s:1-s)}function et(t,e,i,r){e<0&&(e=4294967295+e+1);for(var s=0,n=Math.min(t.length-i,4);s<n;++s)t[i+s]=e>>>8*(r?s:3-s)&255}function it(t,e,i,r,s,n){if(i+r>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function rt(t,e,i,r,s){return s||it(t,0,i,4),w(t,e,i,r,23,4),i+4}function st(t,e,i,r,s){return s||it(t,0,i,8),w(t,e,i,r,52,8),i+8}N.prototype.slice=function(t,e){var i,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),N.TYPED_ARRAY_SUPPORT)(i=this.subarray(t,e)).__proto__=N.prototype;else{var s=e-t;i=new N(s,void 0);for(var n=0;n<s;++n)i[n]=this[n+t]}return i},N.prototype.readUIntLE=function(t,e,i){t|=0,e|=0,i||K(t,e,this.length);for(var r=this[t],s=1,n=0;++n<e&&(s*=256);)r+=this[t+n]*s;return r},N.prototype.readUIntBE=function(t,e,i){t|=0,e|=0,i||K(t,e,this.length);for(var r=this[t+--e],s=1;e>0&&(s*=256);)r+=this[t+--e]*s;return r},N.prototype.readUInt8=function(t,e){return e||K(t,1,this.length),this[t]},N.prototype.readUInt16LE=function(t,e){return e||K(t,2,this.length),this[t]|this[t+1]<<8},N.prototype.readUInt16BE=function(t,e){return e||K(t,2,this.length),this[t]<<8|this[t+1]},N.prototype.readUInt32LE=function(t,e){return e||K(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},N.prototype.readUInt32BE=function(t,e){return e||K(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},N.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||K(t,e,this.length);for(var r=this[t],s=1,n=0;++n<e&&(s*=256);)r+=this[t+n]*s;return r>=(s*=128)&&(r-=Math.pow(2,8*e)),r},N.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||K(t,e,this.length);for(var r=e,s=1,n=this[t+--r];r>0&&(s*=256);)n+=this[t+--r]*s;return n>=(s*=128)&&(n-=Math.pow(2,8*e)),n},N.prototype.readInt8=function(t,e){return e||K(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},N.prototype.readInt16LE=function(t,e){e||K(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},N.prototype.readInt16BE=function(t,e){e||K(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},N.prototype.readInt32LE=function(t,e){return e||K(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},N.prototype.readInt32BE=function(t,e){return e||K(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},N.prototype.readFloatLE=function(t,e){return e||K(t,4,this.length),v(this,t,!0,23,4)},N.prototype.readFloatBE=function(t,e){return e||K(t,4,this.length),v(this,t,!1,23,4)},N.prototype.readDoubleLE=function(t,e){return e||K(t,8,this.length),v(this,t,!0,52,8)},N.prototype.readDoubleBE=function(t,e){return e||K(t,8,this.length),v(this,t,!1,52,8)},N.prototype.writeUIntLE=function(t,e,i,r){(t=+t,e|=0,i|=0,r)||J(this,t,e,i,Math.pow(2,8*i)-1,0);var s=1,n=0;for(this[e]=255&t;++n<i&&(s*=256);)this[e+n]=t/s&255;return e+i},N.prototype.writeUIntBE=function(t,e,i,r){(t=+t,e|=0,i|=0,r)||J(this,t,e,i,Math.pow(2,8*i)-1,0);var s=i-1,n=1;for(this[e+s]=255&t;--s>=0&&(n*=256);)this[e+s]=t/n&255;return e+i},N.prototype.writeUInt8=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,1,255,0),N.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},N.prototype.writeUInt16LE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,2,65535,0),N.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):tt(this,t,e,!0),e+2},N.prototype.writeUInt16BE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,2,65535,0),N.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):tt(this,t,e,!1),e+2},N.prototype.writeUInt32LE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,4,4294967295,0),N.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):et(this,t,e,!0),e+4},N.prototype.writeUInt32BE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,4,4294967295,0),N.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):et(this,t,e,!1),e+4},N.prototype.writeIntLE=function(t,e,i,r){if(t=+t,e|=0,!r){var s=Math.pow(2,8*i-1);J(this,t,e,i,s-1,-s)}var n=0,a=1,o=0;for(this[e]=255&t;++n<i&&(a*=256);)t<0&&0===o&&0!==this[e+n-1]&&(o=1),this[e+n]=(t/a|0)-o&255;return e+i},N.prototype.writeIntBE=function(t,e,i,r){if(t=+t,e|=0,!r){var s=Math.pow(2,8*i-1);J(this,t,e,i,s-1,-s)}var n=i-1,a=1,o=0;for(this[e+n]=255&t;--n>=0&&(a*=256);)t<0&&0===o&&0!==this[e+n+1]&&(o=1),this[e+n]=(t/a|0)-o&255;return e+i},N.prototype.writeInt8=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,1,127,-128),N.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},N.prototype.writeInt16LE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,2,32767,-32768),N.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):tt(this,t,e,!0),e+2},N.prototype.writeInt16BE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,2,32767,-32768),N.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):tt(this,t,e,!1),e+2},N.prototype.writeInt32LE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,4,2147483647,-2147483648),N.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):et(this,t,e,!0),e+4},N.prototype.writeInt32BE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),N.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):et(this,t,e,!1),e+4},N.prototype.writeFloatLE=function(t,e,i){return rt(this,t,e,!0,i)},N.prototype.writeFloatBE=function(t,e,i){return rt(this,t,e,!1,i)},N.prototype.writeDoubleLE=function(t,e,i){return st(this,t,e,!0,i)},N.prototype.writeDoubleBE=function(t,e,i){return st(this,t,e,!1,i)},N.prototype.copy=function(t,e,i,r){if(i||(i=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<i&&(r=i),r===i)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-i&&(r=t.length-e+i);var s,n=r-i;if(this===t&&i<e&&e<r)for(s=n-1;s>=0;--s)t[s+e]=this[s+i];else if(n<1e3||!N.TYPED_ARRAY_SUPPORT)for(s=0;s<n;++s)t[s+e]=this[s+i];else Uint8Array.prototype.set.call(t,this.subarray(i,i+n),e);return n},N.prototype.fill=function(t,e,i,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,i=this.length):"string"==typeof i&&(r=i,i=this.length),1===t.length){var s=t.charCodeAt(0);s<256&&(t=s)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!N.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<i)throw new RangeError("Out of range index");if(i<=e)return this;var n;if(e>>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(n=e;n<i;++n)this[n]=t;else{var a=A(t)?t:ot(new N(t,r).toString()),o=a.length;for(n=0;n<i-e;++n)this[n+e]=a[n%o]}return this};var nt=/[^+\/0-9A-Za-z-_]/g;function at(t){return t<16?"0"+t.toString(16):t.toString(16)}function ot(t,e){var i;e=e||1/0;for(var r=t.length,s=null,n=[],a=0;a<r;++a){if((i=t.charCodeAt(a))>55295&&i<57344){if(!s){if(i>56319){(e-=3)>-1&&n.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&n.push(239,191,189);continue}s=i;continue}if(i<56320){(e-=3)>-1&&n.push(239,191,189),s=i;continue}i=65536+(s-55296<<10|i-56320)}else s&&(e-=3)>-1&&n.push(239,191,189);if(s=null,i<128){if((e-=1)<0)break;n.push(i)}else if(i<2048){if((e-=2)<0)break;n.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;n.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;n.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return n}function ht(t){return function(t){var e,i,r,s,n,a;g||b();var o=t.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");n="="===t[o-2]?2:"="===t[o-1]?1:0,a=new _(3*o/4-n),r=n>0?o-4:o;var h=0;for(e=0,i=0;e<r;e+=4,i+=3)s=p[t.charCodeAt(e)]<<18|p[t.charCodeAt(e+1)]<<12|p[t.charCodeAt(e+2)]<<6|p[t.charCodeAt(e+3)],a[h++]=s>>16&255,a[h++]=s>>8&255,a[h++]=255&s;return 2===n?(s=p[t.charCodeAt(e)]<<2|p[t.charCodeAt(e+1)]>>4,a[h++]=255&s):1===n&&(s=p[t.charCodeAt(e)]<<10|p[t.charCodeAt(e+1)]<<4|p[t.charCodeAt(e+2)]>>2,a[h++]=s>>8&255,a[h++]=255&s),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(nt,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function ut(t,e,i,r){for(var s=0;s<r&&!(s+i>=e.length||s>=t.length);++s)e[s+i]=t[s];return s}function lt(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}const ct="http://www.w3.org/1999/02/22-rdf-syntax-ns#",dt="http://www.w3.org/2001/XMLSchema#",ft="http://www.w3.org/2000/10/swap/";var pt={xsd:{decimal:`${dt}decimal`,boolean:`${dt}boolean`,double:`${dt}double`,integer:`${dt}integer`,string:`${dt}string`},rdf:{type:`${ct}type`,nil:`${ct}nil`,first:`${ct}first`,rest:`${ct}rest`,langString:`${ct}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${ft}reify#forSome`,forAll:`${ft}reify#forAll`},log:{implies:`${ft}log#implies`,isImpliedBy:`${ft}log#isImpliedBy`}};const{xsd:_t}=pt,gt=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,bt={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},mt=/[\x00-\x20<>\\"\{\}\|\^\`]/,yt={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},xt=/$0^/;class vt{constructor(t){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]*)?$/,t=t||{},this._isImpliedBy=t.isImpliedBy,this._lineMode=!!t.lineMode){this._n3Mode=!1;for(const t in this)!(t in yt)&&this[t]instanceof RegExp&&(this[t]=xt)}else this._n3Mode=!1!==t.n3;this.comments=!!t.comments,this._literalClosingPos=0}_tokenizeToEnd(t,e){let i=this._input,r=i.length;for(;;){let t,a;for(;t=this._newline.exec(i);)this.comments&&(a=this._comment.exec(t[0]))&&s("comment",a[1],"",this._line,t[0].length),i=i.substr(t[0].length,i.length),r=i.length,this._line++;if(!t&&(t=this._whitespace.exec(i))&&(i=i.substr(t[0].length,i.length)),this._endOfFile.test(i))return e&&(this.comments&&(a=this._comment.exec(i))&&s("comment",a[1],"",this._line,i.length),i=null,s("eof","","",this._line,0)),this._input=i;const o=this._line,h=i[0];let u="",l="",c="",d=null,f=0,p=!1;switch(h){case"^":if(i.length<3)break;if("^"!==i[1]){this._n3Mode&&(f=1,u="^");break}if(this._previousMarker="^^",i=i.substr(2),"<"!==i[0]){p=!0;break}case"<":if(d=this._unescapedIri.exec(i))u="IRI",l=d[1];else if(d=this._iri.exec(i)){if(l=this._unescape(d[1]),null===l||mt.test(l))return n(this);u="IRI"}else i.length>1&&"<"===i[1]?(u="<<",f=2):this._n3Mode&&i.length>1&&"="===i[1]&&(f=2,this._isImpliedBy?(u="abbreviation",l="<"):(u="inverse",l=">"));break;case">":i.length>1&&">"===i[1]&&(u=">>",f=2);break;case"_":((d=this._blank.exec(i))||e&&(d=this._blank.exec(`${i} `)))&&(u="blank",c="_",l=d[1]);break;case'"':if(d=this._simpleQuotedString.exec(i))l=d[1];else if(({value:l,matchLength:f}=this._parseLiteral(i)),null===l)return n(this);null===d&&0===f||(u="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(d=this._simpleApostropheString.exec(i))l=d[1];else if(({value:l,matchLength:f}=this._parseLiteral(i)),null===l)return n(this);null===d&&0===f||(u="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(d=this._variable.exec(i))&&(u="var",l=d[0]);break;case"@":"literal"===this._previousMarker&&(d=this._langcode.exec(i))?(u="langcode",l=d[1]):(d=this._keyword.exec(i))&&(u=d[0]);break;case".":if(1===i.length?e:i[1]<"0"||i[1]>"9"){u=".",f=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(d=this._number.exec(i)||e&&(d=this._number.exec(`${i} `)))&&(u="literal",l=d[0],c="string"==typeof d[1]?_t.double:"string"==typeof d[2]?_t.decimal:_t.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(d=this._sparqlKeyword.exec(i))?u=d[0].toUpperCase():p=!0;break;case"f":case"t":(d=this._boolean.exec(i))?(u="literal",l=d[0],c=_t.boolean):p=!0;break;case"a":(d=this._shortPredicates.exec(i))?(u="abbreviation",l="a"):p=!0;break;case"=":this._n3Mode&&i.length>1&&(u="abbreviation",">"!==i[1]?(f=1,l="="):(f=2,l=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(f=1,u=h);break;case"{":!this._lineMode&&i.length>=2&&("|"===i[1]?(u="{|",f=2):(u=h,f=1));break;case"|":i.length>=2&&"}"===i[1]&&(u="|}",f=2);break;default:p=!0}if(p&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(d=this._prefix.exec(i))?((d=this._prefixed.exec(i))||e&&(d=this._prefixed.exec(`${i} `)))&&(u="prefixed",c=d[1]||"",l=this._unescape(d[2])):(u="prefix",l=d[1]||"")),"^^"===this._previousMarker)switch(u){case"prefixed":u="type";break;case"IRI":u="typeIRI";break;default:u=""}if(!u)return e||!/^'''|^"""/.test(i)&&/\n|\r/.test(i)?n(this):this._input=i;const _=f||d[0].length,g=s(u,l,c,o,_);this.previousToken=g,this._previousMarker=u,i=i.substr(_,i.length)}function s(e,s,n,a,o){const h=i?r-i.length:r,u={type:e,value:s,prefix:n,line:a,start:h,end:h+o};return t(null,u),u}function n(e){t(e._syntaxError(/^\S*/.exec(i)[0]))}}_unescape(t){let e=!1;const i=t.replace(gt,(t,i,r,s)=>{if("string"==typeof i)return String.fromCharCode(Number.parseInt(i,16));if("string"==typeof r){let t=Number.parseInt(r,16);return t<=65535?String.fromCharCode(Number.parseInt(r,16)):String.fromCharCode(55296+((t-=65536)>>10),56320+(1023&t))}return s in bt?bt[s]:(e=!0,"")});return e?null:i}_parseLiteral(t){if(t.length>=3){const e=t.match(/^(?:"""|"|'''|'|)/)[0],i=e.length;let r=Math.max(this._literalClosingPos,i);for(;(r=t.indexOf(e,r))>0;){let e=0;for(;"\\"===t[r-e-1];)e++;if(e%2==0){const e=t.substring(i,r),s=e.split(/\r\n|\r|\n/).length-1,n=r+i;if(1===i&&0!==s||3===i&&this._lineMode)break;return this._line+=s,{value:this._unescape(e),matchLength:n}}r++}this._literalClosingPos=t.length-i+1}return{value:"",matchLength:0}}_syntaxError(t){this._input=null;const e=new Error(`Unexpected "${t}" on line ${this._line}.`);return e.context={token:void 0,line:this._line,previousToken:this.previousToken},e}_readStartingBom(t){return t.startsWith("\ufeff")?t.substr(1):t}tokenize(t,e){if(this._line=1,"string"==typeof t){if(this._input=this._readStartingBom(t),"function"!=typeof e){const t=[];let e;if(this._tokenizeToEnd((i,r)=>i?e=i:t.push(r),!0),e)throw e;return t}queueMicrotask(()=>this._tokenizeToEnd(e,!0))}else this._pendingBuffer=null,"function"==typeof t.setEncoding&&t.setEncoding("utf8"),t.on("data",t=>{null!==this._input&&0!==t.length&&(this._pendingBuffer&&(t=N.concat([this._pendingBuffer,t]),this._pendingBuffer=null),128&t[t.length-1]?this._pendingBuffer=t:(void 0===this._input?this._input=this._readStartingBom("string"==typeof t?t:t.toString()):this._input+=t,this._tokenizeToEnd(e,!1)))}),t.on("end",()=>{"string"==typeof this._input&&this._tokenizeToEnd(e,!0)}),t.on("error",e)}}const{rdf:wt,xsd:Tt}=pt;let It,Et=0;const Rt={namedNode:Dt,blankNode:Ot,variable:Lt,literal:Ft,defaultGraph:function(){return It},quad:Mt,triple:Mt,fromTerm:Bt,fromQuad:qt};class Nt{constructor(t){this.id=t}get value(){return this.id}equals(t){return t instanceof Nt?this.id===t.id:!!t&&this.termType===t.termType&&this.value===t.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}let jt=class extends Nt{get termType(){return"NamedNode"}},St=class t extends Nt{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const t=this.id;let e=t.lastIndexOf('"')+1;return e<t.length&&"@"===t[e++]?t.substr(e).toLowerCase():""}get datatype(){return new jt(this.datatypeString)}get datatypeString(){const t=this.id,e=t.lastIndexOf('"')+1,i=e<t.length?t[e]:"";return"^"===i?t.substr(e+2):"@"!==i?Tt.string:wt.langString}equals(e){return e instanceof t?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}}}},Ct=class extends Nt{constructor(t){super(`_:${t}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},Pt=class extends Nt{constructor(t){super(`?${t}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}};function kt(t,e,i){if(e=e||Rt,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===Rt)return new St(t);if('"'===t[t.length-1])return e.literal(t.substr(1,t.length-2));const r=t.lastIndexOf('"',t.length-1);return e.literal(t.substr(1,r-1),"@"===t[r+1]?t.substr(r+2):e.namedNode(t.substr(r+3)));case"[":t=JSON.parse(t);break;default:if(!i||!Array.isArray(t))return e.namedNode(t)}return e.quad(kt(t[0],e,!0),kt(t[1],e,!0),kt(t[2],e,!0),t[3]&&kt(t[3],e,!0))}function At(t,e){if("string"==typeof t)return t;if(t instanceof Nt&&"Quad"!==t.termType)return t.id;if(!t)return It.id;switch(t.termType){case"NamedNode":return t.value;case"BlankNode":return`_:${t.value}`;case"Variable":return`?${t.value}`;case"DefaultGraph":return"";case"Literal":return`"${t.value}"${t.language?`@${t.language}`:t.datatype&&t.datatype.value!==Tt.string?`^^${t.datatype.value}`:""}`;case"Quad":const i=[At(t.subject,!0),At(t.predicate,!0),At(t.object,!0)];return t.graph&&"DefaultGraph"!==t.graph.termType&&i.push(At(t.graph,!0)),e?i:JSON.stringify(i);default:throw new Error(`Unexpected termType: ${t.termType}`)}}It=new class extends Nt{constructor(){return super(""),It||this}get termType(){return"DefaultGraph"}equals(t){return this===t||!!t&&this.termType===t.termType}};let $t=class extends Nt{constructor(t,e,i,r){super(""),this._subject=t,this._predicate=e,this._object=i,this._graph=r||It}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(t){return!!t&&this._subject.equals(t.subject)&&this._predicate.equals(t.predicate)&&this._object.equals(t.object)&&this._graph.equals(t.graph)}};function Dt(t){return new jt(t)}function Ot(t){return new Ct(t||"n3-"+Et++)}function Ft(t,e){if("string"==typeof e)return new St(`"${t}"@${e.toLowerCase()}`);let i=e?e.value:"";return""===i&&("boolean"==typeof t?i=Tt.boolean:"number"==typeof t&&(Number.isFinite(t)?i=Number.isInteger(t)?Tt.integer:Tt.double:(i=Tt.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),""===i||i===Tt.string?new St(`"${t}"`):new St(`"${t}"^^${i}`)}function Lt(t){return new Pt(t)}function Mt(t,e,i,r){return new $t(t,e,i,r)}function Bt(t){if(t instanceof Nt)return t;switch(t.termType){case"NamedNode":return Dt(t.value);case"BlankNode":return Ot(t.value);case"Variable":return Lt(t.value);case"DefaultGraph":return It;case"Literal":return Ft(t.value,t.language||t.datatype);case"Quad":return qt(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function qt(t){if(t instanceof $t)return t;if("Quad"!==t.termType)throw new Error(`Unexpected termType: ${t.termType}`);return Mt(Bt(t.subject),Bt(t.predicate),Bt(t.object),Bt(t.graph))}let Ut=0;class Qt{constructor(t){this._contextStack=[],this._graph=null,t=t||{},this._setBase(t.baseIRI),t.factory&&Gt(this,t.factory);const e="string"==typeof t.format?t.format.match(/\w*$/)[0].toLowerCase():"",i=/turtle/.test(e),r=/trig/.test(e),s=/triple/.test(e),n=/quad/.test(e),a=this._n3Mode=/n3/.test(e),o=s||n;(this._supportsNamedGraphs=!(i||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(i||r||s||a),this._isImpliedBy=t.isImpliedBy,this._supportsRDFStar=""===e||/star|\*$/.test(e),o&&(this._resolveRelativeIRI=t=>null),this._blankNodePrefix="string"!=typeof t.blankNodePrefix?"":t.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=t.lexer||new vt({lineMode:o,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!t.explicitQuantifiers}static _resetBlankNodePrefix(){Ut=0}_setBase(t){if(t){const e=t.indexOf("#");e>=0&&(t=t.substr(0,e)),this._base=t,this._basePath=t.indexOf("/")<0?t:t.replace(/[^\/?]*(?:\?.*)?$/,""),t=t.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=t[0],this._baseScheme=t[1]}else this._base="",this._basePath=""}_saveContext(t,e,i,r,s){const n=this._n3Mode;this._contextStack.push({type:t,subject:i,predicate:r,object:s,graph:e,inverse:!!n&&this._inversePredicate,blankPrefix:n?this._prefixes._:"",quantified:n?this._quantified:null}),n&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(t,e){const i=this._contextStack.pop();if(!i||i.type!==t)return this._error(`Unexpected ${e.type}`,e);this._subject=i.subject,this._predicate=i.predicate,this._object=i.object,this._graph=i.graph,this._n3Mode&&(this._inversePredicate=i.inverse,this._prefixes._=i.blankPrefix,this._quantified=i.quantified)}_readInTopContext(t){switch(t.type){case"eof":return null!==this._graph?this._error("Unclosed graph",t):(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(t)}}_readEntity(t,e){let i;switch(t.type){case"IRI":case"typeIRI":const e=this._resolveIRI(t.value);if(null===e)return this._error("Invalid IRI",t);i=this._factory.namedNode(e);break;case"type":case"prefixed":const r=this._prefixes[t.prefix];if(void 0===r)return this._error(`Undefined prefix "${t.prefix}:"`,t);i=this._factory.namedNode(r+t.value);break;case"blank":i=this._factory.blankNode(this._prefixes[t.prefix]+t.value);break;case"var":i=this._factory.variable(t.value.substr(1));break;default:return this._error(`Expected entity but got ${t.type}`,t)}return!e&&this._n3Mode&&i.id in this._quantified&&(i=this._quantified[i.id]),i}_readSubject(t){switch(this._predicate=null,t.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",t);case"}":return this._readPunctuation(t);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',t);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',t);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",t);if(0===t.prefix.length)return this._literalValue=t.value,this._completeSubjectLiteral;this._subject=this._factory.literal(t.value,this._factory.namedNode(t.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",t);default:if(void 0===(this._subject=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(t){const e=t.type;switch(e){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[t.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${e}`,t):(this._subject=null,"]"===e?this._readBlankNodeTail(t):this._readPunctuation(t));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",t);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",t);default:if(void 0===(this._predicate=this._readEntity(t)))return}return this._readObject}_readObject(t){switch(t.type){case"literal":if(0===t.prefix.length)return this._literalValue=t.value,this._readDataTypeOrLang;this._object=this._factory.literal(t.value,this._factory.namedNode(t.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",t);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",t);default:if(void 0===(this._object=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(t){return"{"===t.type?this._readGraph(t):this._readPredicate(t)}_readGraph(t){return"{"!==t.type?this._error(`Expected graph but got ${t.type}`,t):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(t){return"]"===t.type?(this._subject=null,this._readBlankNodeTail(t)):(this._predicate=null,this._readPredicate(t))}_readBlankNodeTail(t){if("]"!==t.type)return this._readBlankNodePunctuation(t);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const e=null===this._predicate;return this._restoreContext("blank",t),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:e?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(t){switch(t.type){case".":case"}":return this._subject=null,this._readPunctuation(t);default:return this._readPredicate(t)}}_readListItem(t){let e=null,i=null,r=this._readListItem;const s=this._subject,n=this._contextStack,a=n[n.length-1];switch(t.type){case"[":this._saveContext("blank",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this._subject=e=this._factory.blankNode()),r=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",t),0!==n.length&&"list"===n[n.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(r=this._readPredicate,this._subject===this.RDF_NIL)return r}else if(r=this._getContextEndReader(),this._object===this.RDF_NIL)return r;i=this.RDF_NIL;break;case"literal":0===t.prefix.length?(this._literalValue=t.value,r=this._readListItemDataTypeOrLang):(e=this._factory.literal(t.value,this._factory.namedNode(t.prefix)),r=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",t);default:if(void 0===(e=this._readEntity(t)))return}if(null===i&&(this._subject=i=this._factory.blankNode()),null===s?null===a.predicate?a.subject=i:a.object=i:this._emit(s,this.RDF_REST,i,this._graph),null!==e){if(this._n3Mode&&("IRI"===t.type||"prefixed"===t.type))return this._saveContext("item",this._graph,i,this.RDF_FIRST,e),this._subject=e,this._predicate=null,this._getPathReader(this._readListItem);this._emit(i,this.RDF_FIRST,e,this._graph)}return r}_readDataTypeOrLang(t){return this._completeObjectLiteral(t,!1)}_readListItemDataTypeOrLang(t){return this._completeObjectLiteral(t,!0)}_completeLiteral(t){let e=this._factory.literal(this._literalValue);switch(t.type){case"type":case"typeIRI":const i=this._readEntity(t);if(void 0===i)return;e=this._factory.literal(this._literalValue,i),t=null;break;case"langcode":e=this._factory.literal(this._literalValue,t.value),t=null}return{token:t,literal:e}}_completeSubjectLiteral(t){return this._subject=this._completeLiteral(t).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(t,e){const i=this._completeLiteral(t);if(i)return this._object=i.literal,e&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),null===i.token?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(i.token))}_readFormulaTail(t){return"}"!==t.type?this._readPunctuation(t):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",t),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(t){let e,i=this._graph;const r=this._subject,s=this._inversePredicate;switch(t.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",t);if(this._n3Mode)return this._readFormulaTail(t);this._graph=null;case".":this._subject=null,e=this._contextStack.length?this._readSubject:this._readInTopContext,s&&(this._inversePredicate=!1);break;case";":e=this._readPredicate;break;case",":e=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF-star syntax",t);const n=this._predicate,a=this._object;this._subject=this._factory.quad(r,n,a,this.DEFAULTGRAPH),e=this._readPredicate;break;case"|}":if("Quad"!==this._subject.termType)return this._error("Unexpected asserted triple closing",t);this._subject=null,e=this._readPunctuation;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(i=this._readEntity(t))){e=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,t)}if(null!==r){const t=this._predicate,e=this._object;s?this._emit(e,t,r,i):this._emit(r,t,e,i)}return e}_readBlankNodePunctuation(t){let e;switch(t.type){case";":e=this._readPredicate;break;case",":e=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,t)}return this._emit(this._subject,this._predicate,this._object,this._graph),e}_readQuadPunctuation(t){return"."!==t.type?this._error("Expected dot to follow quad",t):this._readInTopContext}_readPrefix(t){return"prefix"!==t.type?this._error("Expected prefix to follow @prefix",t):(this._prefix=t.value,this._readPrefixIRI)}_readPrefixIRI(t){if("IRI"!==t.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,t);const e=this._readEntity(t);return this._prefixes[this._prefix]=e.value,this._prefixCallback(this._prefix,e),this._readDeclarationPunctuation}_readBaseIRI(t){const e="IRI"===t.type&&this._resolveIRI(t.value);return e?(this._setBase(e),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",t)}_readNamedGraphLabel(t){switch(t.type){case"IRI":case"blank":case"prefixed":return this._readSubject(t),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",t)}}_readNamedGraphBlankLabel(t){return"]"!==t.type?this._error("Invalid graph label",t):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(t){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(t)):"."!==t.type?this._error("Expected declaration to end with a dot",t):this._readInTopContext}_readQuantifierList(t){let e;switch(t.type){case"IRI":case"prefixed":if(void 0!==(e=this._readEntity(t,!0)))break;default:return this._error(`Unexpected ${t.type}`,t)}return this._explicitQuantifiers?(null===this._subject?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,e,this.QUANTIFIERS_GRAPH)):this._quantified[e.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(t){return","===t.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(t))}_getPathReader(t){return this._afterPath=t,this._readPath}_readPath(t){switch(t.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const e=this._contextStack,i=e.length&&e[e.length-1];if(i&&"item"===i.type){const e=this._subject;this._restoreContext("item",t),this._emit(this._subject,this.RDF_FIRST,e,this._graph)}return this._afterPath(t)}}_readForwardPath(t){let e,i;const r=this._factory.blankNode();if(void 0!==(i=this._readEntity(t)))return null===this._predicate?(e=this._subject,this._subject=r):(e=this._object,this._object=r),this._emit(e,i,r,this._graph),this._readPath}_readBackwardPath(t){const e=this._factory.blankNode();let i,r;if(void 0!==(i=this._readEntity(t)))return null===this._predicate?(r=this._subject,this._subject=e):(r=this._object,this._object=e),this._emit(e,i,r,this._graph),this._readPath}_readRDFStarTailOrGraph(t){return">>"!==t.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(t))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,t):this._readRDFStarTail(t)}_readRDFStarTail(t){if(">>"!==t.type)return this._error(`Expected >> but got ${t.type}`,t);const e=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",t),null===this._subject?(this._subject=e,this._readPredicate):(this._object=e,this._getContextEndReader())}_getContextEndReader(){const t=this._contextStack;if(!t.length)return this._readPunctuation;switch(t[t.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(t,e,i,r){this._callback(null,this._factory.quad(t,e,i,r||this.DEFAULTGRAPH))}_error(t,e){const i=new Error(`${t} on line ${e.line}.`);i.context={token:e,line:e.line,previousToken:this._lexer.previousToken},this._callback(i),this._callback=Ht}_resolveIRI(t){return/^[a-z][a-z0-9+.-]*:/i.test(t)?t:this._resolveRelativeIRI(t)}_resolveRelativeIRI(t){if(!t.length)return this._base;switch(t[0]){case"#":return this._base+t;case"?":return this._base.replace(/(?:\?.*)?$/,t);case"/":return("/"===t[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(t);default:return/^[^/:]*:/.test(t)?null:this._removeDotSegments(this._basePath+t)}}_removeDotSegments(t){if(!/(^|\/)\.\.?($|[/#?])/.test(t))return t;const e=t.length;let i="",r=-1,s=-1,n=0,a="/";for(;r<e;){switch(a){case":":if(s<0&&"/"===t[++r]&&"/"===t[++r])for(;(s=r+1)<e&&"/"!==t[s];)r=s;break;case"?":case"#":r=e;break;case"/":if("."===t[r+1])switch(a=t[1+ ++r],a){case"/":i+=t.substring(n,r-1),n=r+1;break;case void 0:case"?":case"#":return i+t.substring(n,r)+t.substr(r+1);case".":if(a=t[1+ ++r],void 0===a||"/"===a||"?"===a||"#"===a){if(i+=t.substring(n,r-2),(n=i.lastIndexOf("/"))>=s&&(i=i.substr(0,n)),"/"!==a)return`${i}/${t.substr(r+1)}`;n=r+1}}}a=t[++r]}return i+t.substring(n)}parse(t,e,i){let r,s,n;if(e&&(e.onQuad||e.onPrefix||e.onComment)?(r=e.onQuad,s=e.onPrefix,n=e.onComment):(r=e,s=i),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Ut++}_`,this._prefixCallback=s||Ht,this._inversePredicate=!1,this._quantified=Object.create(null),!r){const e=[];let i;if(this._callback=(t,r)=>{t?i=t:r&&e.push(r)},this._lexer.tokenize(t).every(t=>this._readCallback=this._readCallback(t)),i)throw i;return e}let a=(t,e)=>{null!==t?(this._callback(t),this._callback=Ht):this._readCallback&&(this._readCallback=this._readCallback(e))};n&&(this._lexer.comments=!0,a=(t,e)=>{null!==t?(this._callback(t),this._callback=Ht):this._readCallback&&("comment"===e.type?n(e.value):this._readCallback=this._readCallback(e))}),this._callback=r,this._lexer.tokenize(t,a)}}function Ht(){}function Gt(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(pt.rdf.first),t.RDF_REST=e.namedNode(pt.rdf.rest),t.RDF_NIL=e.namedNode(pt.rdf.nil),t.N3_FORALL=e.namedNode(pt.r.forAll),t.N3_FORSOME=e.namedNode(pt.r.forSome),t.ABBREVIATIONS={a:e.namedNode(pt.rdf.type),"=":e.namedNode(pt.owl.sameAs),">":e.namedNode(pt.log.implies),"<":e.namedNode(pt.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}function zt(t){return!!t&&"DefaultGraph"===t.termType}function Yt(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}Gt(Qt.prototype,Rt);const Vt=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Xt=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/;class Wt{constructor(t){this.base=t,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(t.length+1)}static supports(t){return!Vt.test(t)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!Wt.supports(this.base))return this._baseMatcher=/.^/;const t=/^[^:]*:\/*/.exec(this.base)[0],e=["^",Yt(t)],i=[],r=[],s=/[^/?#]*([/?#])/y;let n,a=0,o=0,h=s.lastIndex=t.length;for(;!a&&!o&&(n=s.exec(this.base));)"#"===n[1]?o=s.lastIndex-1:(e.push(Yt(n[0]),"(?:"),i.push(")?"),"?"!==n[1]?r.push(h=s.lastIndex):(a=h=s.lastIndex,o=this.base.indexOf("#",a),this._pathReplacements[a]="?"));for(let t=0;t<r.length;t++)this._pathReplacements[r[t]]="../".repeat(r.length-t-1);return this._pathReplacements[r[r.length-1]]="./",this._baseLength=o>0?o:this.base.length,e.push(Yt(this.base.substring(h,this._baseLength)),a?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...e,...i].join(""))}toRelative(t){const e=this._getBaseMatcher().exec(t);if(!e)return t;const i=e[0].length;if(i===this._baseLength&&i===t.length)return"";const r=this._pathReplacements[i];if(r){const e=t.substring(i);return"?"===r||Xt.test(e)?"./"===r&&/^[^?#]/.test(e)?e:r+e:t}return t.substring(i-1)}}const Zt=Rt.defaultGraph(),{rdf:Kt,xsd:Jt}=pt,te=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,ee=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,ie={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class re extends Nt{equals(t){return t===this}}class se{constructor(t,e){if(this._prefixRegex=/$0^/,t&&"function"!=typeof t.write&&(e=t,t=null),e=e||{},this._lists=e.lists,t)this._outputStream=t,this._endStream=void 0===e.end||!!e.end;else{let t="";this._outputStream={write(e,i,r){t+=e,r&&r()},end:e=>{e&&e(null,t)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(e.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Zt,this._prefixIRIs=Object.create(null),e.prefixes&&this.addPrefixes(e.prefixes),e.baseIRI&&(this._baseIri=new Wt(e.baseIRI)))}get _inDefaultGraph(){return Zt.equals(this._graph)}_write(t,e){this._outputStream.write(t,"utf8",e)}_writeQuad(t,e,i,r,s){try{r.equals(this._graph)||(this._write((null===this._subject?"":this._inDefaultGraph?".\n":"\n}\n")+(Zt.equals(r)?"":`${this._encodeIriOrBlank(r)} {\n`)),this._graph=r,this._subject=null),t.equals(this._subject)?e.equals(this._predicate)?this._write(`, ${this._encodeObject(i)}`,s):this._write(`;\n ${this._encodePredicate(this._predicate=e)} ${this._encodeObject(i)}`,s):this._write(`${(null===this._subject?"":".\n")+this._encodeSubject(this._subject=t)} ${this._encodePredicate(this._predicate=e)} ${this._encodeObject(i)}`,s)}catch(t){s&&s(t)}}_writeQuadLine(t,e,i,r,s){delete this._prefixMatch,this._write(this.quadToString(t,e,i,r),s)}quadToString(t,e,i,r){return`${this._encodeSubject(t)} ${this._encodeIriOrBlank(e)} ${this._encodeObject(i)}${r&&r.value?` ${this._encodeIriOrBlank(r)} .\n`:" .\n"}`}quadsToString(t){let e="";for(const i of t)e+=this.quadToString(i.subject,i.predicate,i.object,i.graph);return e}_encodeSubject(t){return"Quad"===t.termType?this._encodeQuad(t):this._encodeIriOrBlank(t)}_encodeIriOrBlank(t){if("NamedNode"!==t.termType)return this._lists&&t.value in this._lists&&(t=this.list(this._lists[t.value])),"id"in t?t.id:`_:${t.value}`;let e=t.value;this._baseIri&&(e=this._baseIri.toRelative(e)),te.test(e)&&(e=e.replace(ee,ne));const i=this._prefixRegex.exec(e);return i?i[1]?this._prefixIRIs[i[1]]+i[2]:e:`<${e}>`}_encodeLiteral(t){let e=t.value;if(te.test(e)&&(e=e.replace(ee,ne)),t.language)return`"${e}"@${t.language}`;if(this._lineMode){if(t.datatype.value===Jt.string)return`"${e}"`}else switch(t.datatype.value){case Jt.string:return`"${e}"`;case Jt.boolean:if("true"===e||"false"===e)return e;break;case Jt.integer:if(/^[+-]?\d+$/.test(e))return e;break;case Jt.decimal:if(/^[+-]?\d*\.\d+$/.test(e))return e;break;case Jt.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(e))return e}return`"${e}"^^${this._encodeIriOrBlank(t.datatype)}`}_encodePredicate(t){return t.value===Kt.type?"a":this._encodeIriOrBlank(t)}_encodeObject(t){switch(t.termType){case"Quad":return this._encodeQuad(t);case"Literal":return this._encodeLiteral(t);default:return this._encodeIriOrBlank(t)}}_encodeQuad({subject:t,predicate:e,object:i,graph:r}){return`<<${this._encodeSubject(t)} ${this._encodePredicate(e)} ${this._encodeObject(i)}${zt(r)?"":` ${this._encodeIriOrBlank(r)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(t,e,i,r,s){void 0===i?this._writeQuad(t.subject,t.predicate,t.object,t.graph,e):"function"==typeof r?this._writeQuad(t,e,i,Zt,r):this._writeQuad(t,e,i,r||Zt,s)}addQuads(t){for(let e=0;e<t.length;e++)this.addQuad(t[e])}addPrefix(t,e,i){const r={};r[t]=e,this.addPrefixes(r,i)}addPrefixes(t,e){if(!this._prefixIRIs)return e&&e();let i=!1;for(let e in t){let r=t[e];"string"!=typeof r&&(r=r.value),i=!0,null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null,this._graph=""),this._prefixIRIs[r]=e+=":",this._write(`@prefix ${e} <${r}>.\n`)}if(i){let t="",e="";for(const i in this._prefixIRIs)t+=t?`|${i}`:i,e+=(e?"|":"")+this._prefixIRIs[i];t=Yt(t),this._prefixRegex=new RegExp(`^(?:${e})[^/]*$|^(${t})([_a-zA-Z0-9][\\-_a-zA-Z0-9]*)$`)}this._write(i?"\n":"",e)}blank(t,e){let i,r,s=t;switch(void 0===t?s=[]:t.termType?s=[{predicate:t,object:e}]:"length"in t||(s=[t]),r=s.length){case 0:return new re("[]");case 1:if(i=s[0],!(i.object instanceof re))return new re(`[ ${this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)} ]`);default:let e="[";for(let n=0;n<r;n++)i=s[n],i.predicate.equals(t)?e+=`, ${this._encodeObject(i.object)}`:(e+=`${(n?";\n ":"\n ")+this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)}`,t=i.predicate);return new re(`${e}\n]`)}}list(t){const e=t&&t.length||0,i=new Array(e);for(let r=0;r<e;r++)i[r]=this._encodeObject(t[r]);return new re(`(${i.join(" ")})`)}end(t){null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null),this._write=this._blockedWrite;let e=t&&((i,r)=>{e=null,t(i,r)});if(this._endStream)try{return this._outputStream.end(e)}catch(t){}e&&e()}}function ne(t){let e=ie[t];return void 0===e&&(1===t.length?(e=t.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=(1024*(t.charCodeAt(0)-55296)+t.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}class ae{constructor(){}on(){return this}once(){return this}emit(){return this}pipe(){return this}push(){return!1}destroy(){}_read(){}}class oe{constructor(){}on(){return this}write(){}end(){}}class he extends ae{}class ue extends he{}var le={Readable:ae,Writable:oe,Transform:he,PassThrough:ue},ce=Object.freeze({__proto__:null,PassThrough:ue,Readable:ae,Transform:he,Writable:oe,default:le});const de=Symbol("iter");function fe(t,e,i=4){if(0===i)return Object.assign(t,e);for(const r in e)t[r]=fe(t[r]||Object.create(null),e[r],i-1);return t}function pe(t,e,i=4){let r=!1;for(const s in t)if(s in e){const n=0===i?null:pe(t[s],e[s],i-1);if(!1!==n)r=r||Object.create(null),r[s]=n;else if(3===i)return!1}return r}function _e(t,e,i=4){let r=!1;for(const s in t)if(s in e){if(0!==i){const n=_e(t[s],e[s],i-1);if(!1!==n)r=r||Object.create(null),r[s]=n;else if(3===i)return!1}}else r=r||Object.create(null),r[s]=0===i?null:fe({},t[s],i-1);return r}class ge{constructor(t={}){this._id=1,this._ids=Object.create(null),this._ids[""]=1,this._entities=Object.create(null),this._entities[1]="",this._blankNodeIndex=0,this._factory=t.factory||Rt}_termFromId(t){if("."===t[0]){const e=this._entities,i=t.split(".");return this._factory.quad(this._termFromId(e[i[1]]),this._termFromId(e[i[2]]),this._termFromId(e[i[3]]),i[4]&&this._termFromId(e[i[4]]))}return kt(t,this._factory)}_termToNumericId(t){if("Quad"===t.termType){const e=this._termToNumericId(t.subject),i=this._termToNumericId(t.predicate),r=this._termToNumericId(t.object);let s;return e&&i&&r&&(zt(t.graph)||(s=this._termToNumericId(t.graph)))&&this._ids[s?`.${e}.${i}.${r}.${s}`:`.${e}.${i}.${r}`]}return this._ids[At(t)]}_termToNewNumericId(t){const e=t&&"Quad"===t.termType?`.${this._termToNewNumericId(t.subject)}.${this._termToNewNumericId(t.predicate)}.${this._termToNewNumericId(t.object)}${zt(t.graph)?"":`.${this._termToNewNumericId(t.graph)}`}`:At(t);return this._ids[e]||(this._ids[this._entities[++this._id]=e]=this._id)}createBlankNode(t){let e,i;if(t)for(e=t=`_:${t}`,i=1;this._ids[e];)e=t+i++;else do{e="_:b"+this._blankNodeIndex++}while(this._ids[e]);return this._ids[e]=++this._id,this._entities[this._id]=e,this._factory.blankNode(e.substr(2))}}class be{constructor(t,e){this._size=0,this._graphs=Object.create(null),e||!t||t[0]||"function"==typeof t.match||(e=t,t=null),e=e||{},this._factory=e.factory||Rt,this._entityIndex=e.entityIndex||new ge({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),t&&this.addAll(t)}get size(){let t=this._size;if(null!==t)return t;t=0;const e=this._graphs;let i,r;for(const s in e)for(const n in i=e[s].subjects)for(const e in r=i[n])t+=Object.keys(r[e]).length;return this._size=t}_addToIndex(t,e,i,r){const s=t[e]||(t[e]={}),n=s[i]||(s[i]={}),a=r in n;return a||(n[r]=null),!a}_removeFromIndex(t,e,i,r){const s=t[e],n=s[i];delete n[r];for(const t in n)return;delete s[i];for(const t in s)return;delete t[e]}*_findInIndex(t,e,i,r,s,n,a,o){let h,u,l;const c=this._entities,d=this._termFromId(c[o]),f={subject:null,predicate:null,object:null};e&&((h=t,t={})[e]=h[e]);for(const e in t)if(u=t[e]){f[s]=this._termFromId(c[e]),i&&((h=u,u={})[i]=h[i]);for(const t in u)if(l=u[t]){f[n]=this._termFromId(c[t]);const e=r?r in l?[r]:[]:Object.keys(l);for(let t=0;t<e.length;t++)f[a]=this._termFromId(c[e[t]]),yield this._factory.quad(f.subject,f.predicate,f.object,d)}}}_loop(t,e){for(const i in t)e(i)}_loopByKey0(t,e,i){let r,s;if(r=t[e])for(s in r)i(s)}_loopByKey1(t,e,i){let r,s;for(r in t)s=t[r],s[e]&&i(r)}_loopBy2Keys(t,e,i,r){let s,n,a;if((s=t[e])&&(n=s[i]))for(a in n)r(a)}_countInIndex(t,e,i,r){let s,n,a,o=0;e&&((s=t,t={})[e]=s[e]);for(const e in t)if(n=t[e]){i&&((s=n,n={})[i]=s[i]);for(const t in n)(a=n[t])&&(r?r in a&&o++:o+=Object.keys(a).length)}return o}_getGraphs(t){return"number"!=typeof(t=""===t?1:t&&(this._termToNumericId(t)||-1))?this._graphs:{[t]:this._graphs[t]}}_uniqueEntities(t){const e=Object.create(null);return i=>{i in e||(e[i]=!0,t(this._termFromId(this._entities[i],this._factory)))}}add(t){return this.addQuad(t),this}addQuad(t,e,i,r){e||(r=t.graph,i=t.object,e=t.predicate,t=t.subject),r=r?this._termToNewNumericId(r):1;let s=this._graphs[r];return s||(s=this._graphs[r]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),t=this._termToNewNumericId(t),e=this._termToNewNumericId(e),i=this._termToNewNumericId(i),!!this._addToIndex(s.subjects,t,e,i)&&(this._addToIndex(s.predicates,e,i,t),this._addToIndex(s.objects,i,t,e),this._size=null,!0)}addQuads(t){for(let e=0;e<t.length;e++)this.addQuad(t[e])}delete(t){return this.removeQuad(t),this}has(t,e,i,r){return t&&t.subject&&({subject:t,predicate:e,object:i,graph:r}=t),!this.readQuads(t,e,i,r).next().done}import(t){return t.on("data",t=>{this.addQuad(t)}),t}removeQuad(t,e,i,r){e||({subject:t,predicate:e,object:i,graph:r}=t),r=r?this._termToNumericId(r):1;const s=this._graphs;let n,a,o;if(!((t=t&&this._termToNumericId(t))&&(e=e&&this._termToNumericId(e))&&(i=i&&this._termToNumericId(i))&&(n=s[r])&&(a=n.subjects[t])&&(o=a[e])&&i in o))return!1;for(t in this._removeFromIndex(n.subjects,t,e,i),this._removeFromIndex(n.predicates,e,i,t),this._removeFromIndex(n.objects,i,t,e),null!==this._size&&this._size--,n.subjects)return!0;return delete s[r],!0}removeQuads(t){for(let e=0;e<t.length;e++)this.removeQuad(t[e])}remove(t){return t.on("data",t=>{this.removeQuad(t)}),t}removeMatches(t,e,i,r){const s=new ae({objectMode:!0}),n=this.readQuads(t,e,i,r);return s._read=t=>{for(;--t>=0;){const{done:t,value:e}=n.next();if(t)return void s.push(null);s.push(e)}},this.remove(s)}deleteGraph(t){return this.removeMatches(null,null,null,t)}getQuads(t,e,i,r){return[...this.readQuads(t,e,i,r)]}*readQuads(t,e,i,r){const s=this._getGraphs(r);let n,a,o,h;if(!(t&&!(a=this._termToNumericId(t))||e&&!(o=this._termToNumericId(e))||i&&!(h=this._termToNumericId(i))))for(const t in s)(n=s[t])&&(a?h?yield*this._findInIndex(n.objects,h,a,o,"object","subject","predicate",t):yield*this._findInIndex(n.subjects,a,o,null,"subject","predicate","object",t):o?yield*this._findInIndex(n.predicates,o,h,null,"predicate","object","subject",t):h?yield*this._findInIndex(n.objects,h,null,null,"object","subject","predicate",t):yield*this._findInIndex(n.subjects,null,null,null,"subject","predicate","object",t))}match(t,e,i,r){return new ye(this,t,e,i,r,{entityIndex:this._entityIndex})}countQuads(t,e,i,r){const s=this._getGraphs(r);let n,a,o,h,u=0;if(t&&!(a=this._termToNumericId(t))||e&&!(o=this._termToNumericId(e))||i&&!(h=this._termToNumericId(i)))return 0;for(const r in s)(n=s[r])&&(u+=t?i?this._countInIndex(n.objects,h,a,o):this._countInIndex(n.subjects,a,o,h):e?this._countInIndex(n.predicates,o,h,a):this._countInIndex(n.objects,h,a,o));return u}forEach(t,e,i,r,s){this.some(e=>(t(e,this),!1),e,i,r,s)}every(t,e,i,r,s){return!this.some(e=>!t(e,this),e,i,r,s)}some(t,e,i,r,s){for(const n of this.readQuads(e,i,r,s))if(t(n,this))return!0;return!1}getSubjects(t,e,i){const r=[];return this.forSubjects(t=>{r.push(t)},t,e,i),r}forSubjects(t,e,i,r){const s=this._getGraphs(r);let n,a,o;if(t=this._uniqueEntities(t),!(e&&!(a=this._termToNumericId(e))||i&&!(o=this._termToNumericId(i))))for(r in s)(n=s[r])&&(a?o?this._loopBy2Keys(n.predicates,a,o,t):this._loopByKey1(n.subjects,a,t):o?this._loopByKey0(n.objects,o,t):this._loop(n.subjects,t))}getPredicates(t,e,i){const r=[];return this.forPredicates(t=>{r.push(t)},t,e,i),r}forPredicates(t,e,i,r){const s=this._getGraphs(r);let n,a,o;if(t=this._uniqueEntities(t),!(e&&!(a=this._termToNumericId(e))||i&&!(o=this._termToNumericId(i))))for(r in s)(n=s[r])&&(a?o?this._loopBy2Keys(n.objects,o,a,t):this._loopByKey0(n.subjects,a,t):o?this._loopByKey1(n.predicates,o,t):this._loop(n.predicates,t))}getObjects(t,e,i){const r=[];return this.forObjects(t=>{r.push(t)},t,e,i),r}forObjects(t,e,i,r){const s=this._getGraphs(r);let n,a,o;if(t=this._uniqueEntities(t),!(e&&!(a=this._termToNumericId(e))||i&&!(o=this._termToNumericId(i))))for(r in s)(n=s[r])&&(a?o?this._loopBy2Keys(n.subjects,a,o,t):this._loopByKey1(n.objects,a,t):o?this._loopByKey0(n.predicates,o,t):this._loop(n.objects,t))}getGraphs(t,e,i){const r=[];return this.forGraphs(t=>{r.push(t)},t,e,i),r}forGraphs(t,e,i,r){for(const s in this._graphs)this.some(e=>(t(e.graph),!0),e,i,r,this._termFromId(this._entities[s]))}createBlankNode(t){return this._entityIndex.createBlankNode(t)}extractLists({remove:t=!1,ignoreErrors:e=!1}={}){const i={},r=e?()=>!0:(t,e)=>{throw new Error(`${t.value} ${e}`)},s=this.getQuads(null,pt.rdf.rest,pt.rdf.nil,null),n=t?[...s]:[];return s.forEach(e=>{const s=[];let a,o,h=!1;const u=e.graph;let l=e.subject;for(;l&&!h;){const t=this.getQuads(null,null,l,null),e=this.getQuads(l,null,null,null);let i,c=null,d=null,f=null;for(let s=0;s<e.length&&!h;s++)i=e[s],i.graph.equals(u)?a?h=r(l,"has non-list arcs out"):i.predicate.value===pt.rdf.first?c?h=r(l,"has multiple rdf:first arcs"):n.push(c=i):i.predicate.value===pt.rdf.rest?d?h=r(l,"has multiple rdf:rest arcs"):n.push(d=i):t.length?h=r(l,"can't be subject and object"):(a=i,o="subject"):h=r(l,"not confined to single graph");for(let e=0;e<t.length&&!h;++e)i=t[e],a?h=r(l,"can't have coreferences"):i.predicate.value===pt.rdf.rest?f?h=r(l,"has incoming rdf:rest arcs"):f=i:(a=i,o="object");c?s.unshift(c.object):h=r(l,"has no list head"),l=f&&f.subject}h?t=!1:a&&(i[a[o].value]=s)}),t&&this.removeQuads(n),i}addAll(t){if(t instanceof ye&&(t=t.filtered),Array.isArray(t))this.addQuads(t);else if(t instanceof be&&t._entityIndex===this._entityIndex)0!==t._size&&(this._graphs=fe(this._graphs,t._graphs),this._size=null);else for(const e of t)this.add(e);return this}contains(t){if(t instanceof ye&&(t=t.filtered),t===this)return!0;if(!(t instanceof be)||this._entityIndex!==t._entityIndex)return t.every(t=>this.has(t));const e=this._graphs,i=t._graphs;let r,s,n,a,o;for(const t in i){if(!(r=e[t]))return!1;r=r.subjects;for(const e in s=i[t].subjects){if(!(n=r[e]))return!1;for(const t in a=s[e]){if(!(o=n[t]))return!1;for(const e in a[t])if(!(e in o))return!1}}}return!0}deleteMatches(t,e,i,r){for(const s of this.match(t,e,i,r))this.removeQuad(s);return this}difference(t){if(t&&t instanceof ye&&(t=t.filtered),t===this)return new be({entityIndex:this._entityIndex});if(t instanceof be&&t._entityIndex===this._entityIndex){const e=new be({entityIndex:this._entityIndex}),i=_e(this._graphs,t._graphs);return i&&(e._graphs=i,e._size=null),e}return this.filter(e=>!t.has(e))}equals(t){return t instanceof ye&&(t=t.filtered),t===this||this.size===t.size&&this.contains(t)}filter(t){const e=new be({entityIndex:this._entityIndex});for(const i of this)t(i,this)&&e.add(i);return e}intersection(t){if(t instanceof ye&&(t=t.filtered),t===this){const t=new be({entityIndex:this._entityIndex});return t._graphs=fe(Object.create(null),this._graphs),t._size=this._size,t}if(t instanceof be&&this._entityIndex===t._entityIndex){const e=new be({entityIndex:this._entityIndex}),i=pe(t._graphs,this._graphs);return i&&(e._graphs=i,e._size=null),e}return this.filter(e=>t.has(e))}map(t){const e=new be({entityIndex:this._entityIndex});for(const i of this)e.add(t(i,this));return e}reduce(t,e){const i=this.readQuads();let r=void 0===e?i.next().value:e;for(const e of i)r=t(r,e,this);return r}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return(new se).quadsToString(this)}union(t){const e=new be({entityIndex:this._entityIndex});return e._graphs=fe(Object.create(null),this._graphs),e._size=this._size,e.addAll(t),e}*[Symbol.iterator](){yield*this.readQuads()}}function me(t,e,i=0){const r=e[i];if(r&&!(r in t))return!1;let s=!1;for(const n in r?{[r]:t[r]}:t){const r=2===i?null:me(t[n],e,i+1);!1!==r&&(s=s||Object.create(null),s[n]=r)}return s}class ye extends ae{constructor(t,e,i,r,s,n){super({objectMode:!0}),Object.assign(this,{n3Store:t,subject:e,predicate:i,object:r,graph:s,options:n})}get filtered(){if(!this._filtered){const{n3Store:t,graph:e,object:i,predicate:r,subject:s}=this,n=this._filtered=new be({factory:t._factory,entityIndex:this.options.entityIndex});let a,o,h;if(s&&!(a=n._termToNumericId(s))||r&&!(o=n._termToNumericId(r))||i&&!(h=n._termToNumericId(i)))return n;const u=t._getGraphs(e);for(const t in u){let e,i,r,s;(s=u[t])&&(!a&&o?(i=me(s.predicates,[o,h,a]))&&(e=me(s.subjects,[a,o,h]),r=me(s.objects,[h,a,o])):h?(r=me(s.objects,[h,a,o]))&&(e=me(s.subjects,[a,o,h]),i=me(s.predicates,[o,h,a])):(e=me(s.subjects,[a,o,h]))&&(i=me(s.predicates,[o,h,a]),r=me(s.objects,[h,a,o])),e&&(n._graphs[t]={subjects:e,predicates:i,objects:r}))}n._size=null}return this._filtered}get size(){return this.filtered.size}_read(t){t>0&&!this[de]&&(this[de]=this[Symbol.iterator]());const e=this[de];for(;--t>=0;){const{done:t,value:i}=e.next();if(t)return void this.push(null);this.push(i)}}addAll(t){return this.filtered.addAll(t)}contains(t){return this.filtered.contains(t)}deleteMatches(t,e,i,r){return this.filtered.deleteMatches(t,e,i,r)}difference(t){return this.filtered.difference(t)}equals(t){return this.filtered.equals(t)}every(t,e,i,r,s){return this.filtered.every(t,e,i,r,s)}filter(t){return this.filtered.filter(t)}forEach(t,e,i,r,s){return this.filtered.forEach(t,e,i,r,s)}import(t){return this.filtered.import(t)}intersection(t){return this.filtered.intersection(t)}map(t){return this.filtered.map(t)}some(t,e,i,r,s){return this.filtered.some(t,e,i,r,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(t){return this._filtered?this._filtered.union(t):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(t)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(t,e){return this.filtered.reduce(t,e)}toString(){return(new se).quadsToString(this)}add(t){return this.filtered.add(t)}delete(t){return this.filtered.delete(t)}has(t){return this.filtered.has(t)}match(t,e,i,r){return new ye(this.filtered,t,e,i,r,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}function xe(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if("function"==typeof e){var i=function t(){var i=!1;try{i=this instanceof t}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach(function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})}),i}var ve,we,Te={},Ie={},Ee={},Re={};function Ne(){return we||(we=1,t=Ee,e=Ee&&Ee.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=Ee&&Ee.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i(function(){if(ve)return Re;function t(t){const e=[];let r=0;for(;r<t.length;)switch(t[r]){case"/":if("."===t[r+1])if("."===t[r+2]){if(!i(t[r+3])){e.push([]),r++;break}e.pop(),t[r+3]||e.push([]),r+=3}else{if(!i(t[r+2])){e.push([]),r++;break}t[r+2]||e.push([]),r+=2}else e.push([]),r++;break;case"#":case"?":e.length||e.push([]),e[e.length-1].push(t.substr(r)),r=t.length;break;default:e.length||e.push([]),e[e.length-1].push(t[r]),r++}return"/"+e.map(t=>t.join("")).join("/")}function e(e,i){let r=i+1;i>=0?"/"===e[i+1]&&"/"===e[i+2]&&(r=i+3):"/"===e[0]&&"/"===e[1]&&(r=2);const s=e.indexOf("/",r);return s<0?e:e.substr(0,s)+t(e.substr(s))}function i(t){return!t||"#"===t||"?"===t||"/"===t}return ve=1,Object.defineProperty(Re,"__esModule",{value:!0}),Re.removeDotSegmentsOfPath=Re.removeDotSegments=Re.resolve=void 0,Re.resolve=function(i,r){const s=(r=r||"").indexOf("#");if(s>0&&(r=r.substr(0,s)),!i.length){if(r.indexOf(":")<0)throw new Error(`Found invalid baseIRI '${r}' for value '${i}'`);return r}if(i.startsWith("?")){const t=r.indexOf("?");return t>0&&(r=r.substr(0,t)),r+i}if(i.startsWith("#"))return r+i;if(!r.length){const t=i.indexOf(":");if(t<0)throw new Error(`Found invalid relative IRI '${i}' for a missing baseIRI`);return e(i,t)}const n=i.indexOf(":");if(n>=0){const t=i.indexOf("/");if(t<0||n<t)return e(i,n)}const a=r.indexOf(":");if(a<0)throw new Error(`Found invalid baseIRI '${r}' for value '${i}'`);const o=r.substr(0,a+1);if(0===i.indexOf("//"))return o+e(i,n);let h;if(r.indexOf("//",a)===a+1){if(h=r.indexOf("/",a+3),h<0)return r.length>a+3?r+"/"+e(i,n):o+e(i,n)}else if(h=r.indexOf("/",a+1),h<0)return o+e(i,n);if(0===i.indexOf("/"))return r.substr(0,h)+t(i);let u=r.substr(h);const l=u.lastIndexOf("/");return l>=0&&l<u.length-1&&(u=u.substr(0,l+1),"."===i[0]&&"."!==i[1]&&"/"!==i[1]&&i[2]&&(i=i.substr(1))),i=t(i=u+i),r.substr(0,h)+i},Re.removeDotSegments=t,Re.removeDotSegmentsOfPath=e,Re}(),t)),Ee;var t,e,i}var je,Se={},Ce={};function Pe(){return je||(je=1,function(t){
1
+ var jsonldUIUtils=function(t){"use strict";const e=new Map;async function i(t){const i=async(t,e)=>{for(const[s,n]of Object.entries(t))"@context"===s?t[s]=await r(n,e):"object"==typeof n&&null!==n&&await i(n,e)},r=async(t,s)=>{if(null==t)return{};if(Array.isArray(t)){return(t=>{const e=(t,e)=>{if(!t||!Object.keys(t).length)return e;const i={...t};for(const[t,r]of Object.entries(e))i[t]=r;return i};if(!t.length)return{};if(1===t.length)return t[0];let i=t[0];for(let r=1;r<t.length;r++)i=e(i,t[r]);return i})(await Promise.all(t.map(t=>r(t,s))))}if("object"==typeof t)return await i(t,s),t;{if(null==s?void 0:s.includes(t))throw new Error("Circular dependencies found: "+s.join(" -> ")+" -> "+t);const i=Array.isArray(s)?null==s?void 0:s.slice():[];return i.push(t),e.has(t)||e.set(t,(async t=>{const e=await fetch(t,{headers:{Accept:"application/json"}});return await e.json()})(t).then(t=>r(t["@context"],i))),e.get(t)}};return r("object"==typeof t&&null!==t&&"@context"in t?t["@context"]:t)}var r=Object.freeze({__proto__:null,loadContext:i});const s=t=>e=>`${t}${e}`,n=s("http://www.w3.org/2004/02/skos/core#"),a=s("http://www.w3.org/2000/01/rdf-schema#"),o=s("http://purl.org/dc/terms/"),h=s("http://purl.org/dc/elements/1.1/"),u=s("https://schema.org/"),l=s("http://xmlns.com/foaf/0.1/"),c=[n("prefLabel"),o("title"),h("title"),u("name"),l("name"),a("label")],d=[n("definition"),o("description"),h("description"),a("comment")];var f="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},p=[],_=[],g="undefined"!=typeof Uint8Array?Uint8Array:Array,b=!1;function m(){b=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)p[e]=t[e],_[t.charCodeAt(e)]=e;_["-".charCodeAt(0)]=62,_["_".charCodeAt(0)]=63}function y(t){return p[t>>18&63]+p[t>>12&63]+p[t>>6&63]+p[63&t]}function x(t,e,i){for(var r,s=[],n=e;n<i;n+=3)r=(t[n]<<16)+(t[n+1]<<8)+t[n+2],s.push(y(r));return s.join("")}function v(t){var e;b||m();for(var i=t.length,r=i%3,s="",n=[],a=16383,o=0,h=i-r;o<h;o+=a)n.push(x(t,o,o+a>h?h:o+a));return 1===r?(e=t[i-1],s+=p[e>>2],s+=p[e<<4&63],s+="=="):2===r&&(e=(t[i-2]<<8)+t[i-1],s+=p[e>>10],s+=p[e>>4&63],s+=p[e<<2&63],s+="="),n.push(s),n.join("")}function w(t,e,i,r,s){var n,a,o=8*s-r-1,h=(1<<o)-1,u=h>>1,l=-7,c=i?s-1:0,d=i?-1:1,f=t[e+c];for(c+=d,n=f&(1<<-l)-1,f>>=-l,l+=o;l>0;n=256*n+t[e+c],c+=d,l-=8);for(a=n&(1<<-l)-1,n>>=-l,l+=r;l>0;a=256*a+t[e+c],c+=d,l-=8);if(0===n)n=1-u;else{if(n===h)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),n-=u}return(f?-1:1)*a*Math.pow(2,n-r)}function T(t,e,i,r,s,n){var a,o,h,u=8*n-s-1,l=(1<<u)-1,c=l>>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:n-1,p=r?1:-1,_=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-a))<1&&(a--,h*=2),(e+=a+c>=1?d/h:d*Math.pow(2,1-c))*h>=2&&(a++,h/=2),a+c>=l?(o=0,a=l):a+c>=1?(o=(e*h-1)*Math.pow(2,s),a+=c):(o=e*Math.pow(2,c-1)*Math.pow(2,s),a=0));s>=8;t[i+f]=255&o,f+=p,o/=256,s-=8);for(a=a<<s|o,u+=s;u>0;t[i+f]=255&a,f+=p,a/=256,u-=8);t[i+f-p]|=128*_}var I={}.toString,E=Array.isArray||function(t){return"[object Array]"==I.call(t)};function R(){return j.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function N(t,e){if(R()<e)throw new RangeError("Invalid typed array length");return j.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=j.prototype:(null===t&&(t=new j(e)),t.length=e),t}function j(t,e,i){if(!(j.TYPED_ARRAY_SUPPORT||this instanceof j))return new j(t,e,i);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return P(this,t)}return S(this,t,e,i)}function S(t,e,i,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,i,r){if(e.byteLength,i<0||e.byteLength<i)throw new RangeError("'offset' is out of bounds");if(e.byteLength<i+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===i&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,i):new Uint8Array(e,i,r);j.TYPED_ARRAY_SUPPORT?(t=e).__proto__=j.prototype:t=k(t,e);return t}(t,e,i,r):"string"==typeof e?function(t,e,i){"string"==typeof i&&""!==i||(i="utf8");if(!j.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var r=0|D(e,i);t=N(t,r);var s=t.write(e,i);s!==r&&(t=t.slice(0,s));return t}(t,e,i):function(t,e){if($(e)){var i=0|A(e.length);return 0===(t=N(t,i)).length||e.copy(t,0,0,i),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?N(t,0):k(t,e);if("Buffer"===e.type&&E(e.data))return k(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function C(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function P(t,e){if(C(e),t=N(t,e<0?0:0|A(e)),!j.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)t[i]=0;return t}function k(t,e){var i=e.length<0?0:0|A(e.length);t=N(t,i);for(var r=0;r<i;r+=1)t[r]=255&e[r];return t}function A(t){if(t>=R())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+R().toString(16)+" bytes");return 0|t}function $(t){return!(null==t||!t._isBuffer)}function D(t,e){if($(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return ht(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return ut(t).length;default:if(r)return ht(t).length;e=(""+e).toLowerCase(),r=!0}}function O(t,e,i){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return Z(this,e,i);case"utf8":case"utf-8":return Y(this,e,i);case"ascii":return X(this,e,i);case"latin1":case"binary":return W(this,e,i);case"base64":return z(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K(this,e,i);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function F(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function L(t,e,i,r,s){if(0===t.length)return-1;if("string"==typeof i?(r=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=s?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(s)return-1;i=t.length-1}else if(i<0){if(!s)return-1;i=0}if("string"==typeof e&&(e=j.from(e,r)),$(e))return 0===e.length?-1:M(t,e,i,r,s);if("number"==typeof e)return e&=255,j.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):M(t,[e],i,r,s);throw new TypeError("val must be string, number or Buffer")}function M(t,e,i,r,s){var n,a=1,o=t.length,h=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,o/=2,h/=2,i/=2}function u(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(s){var l=-1;for(n=i;n<o;n++)if(u(t,n)===u(e,-1===l?0:n-l)){if(-1===l&&(l=n),n-l+1===h)return l*a}else-1!==l&&(n-=n-l),l=-1}else for(i+h>o&&(i=o-h),n=i;n>=0;n--){for(var c=!0,d=0;d<h;d++)if(u(t,n+d)!==u(e,d)){c=!1;break}if(c)return n}return-1}function B(t,e,i,r){i=Number(i)||0;var s=t.length-i;r?(r=Number(r))>s&&(r=s):r=s;var n=e.length;if(n%2!=0)throw new TypeError("Invalid hex string");r>n/2&&(r=n/2);for(var a=0;a<r;++a){var o=parseInt(e.substr(2*a,2),16);if(isNaN(o))return a;t[i+a]=o}return a}function q(t,e,i,r){return lt(ht(e,t.length-i),t,i,r)}function U(t,e,i,r){return lt(function(t){for(var e=[],i=0;i<t.length;++i)e.push(255&t.charCodeAt(i));return e}(e),t,i,r)}function Q(t,e,i,r){return U(t,e,i,r)}function H(t,e,i,r){return lt(ut(e),t,i,r)}function G(t,e,i,r){return lt(function(t,e){for(var i,r,s,n=[],a=0;a<t.length&&!((e-=2)<0);++a)r=(i=t.charCodeAt(a))>>8,s=i%256,n.push(s),n.push(r);return n}(e,t.length-i),t,i,r)}function z(t,e,i){return 0===e&&i===t.length?v(t):v(t.slice(e,i))}function Y(t,e,i){i=Math.min(t.length,i);for(var r=[],s=e;s<i;){var n,a,o,h,u=t[s],l=null,c=u>239?4:u>223?3:u>191?2:1;if(s+c<=i)switch(c){case 1:u<128&&(l=u);break;case 2:128==(192&(n=t[s+1]))&&(h=(31&u)<<6|63&n)>127&&(l=h);break;case 3:n=t[s+1],a=t[s+2],128==(192&n)&&128==(192&a)&&(h=(15&u)<<12|(63&n)<<6|63&a)>2047&&(h<55296||h>57343)&&(l=h);break;case 4:n=t[s+1],a=t[s+2],o=t[s+3],128==(192&n)&&128==(192&a)&&128==(192&o)&&(h=(15&u)<<18|(63&n)<<12|(63&a)<<6|63&o)>65535&&h<1114112&&(l=h)}null===l?(l=65533,c=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),s+=c}return function(t){var e=t.length;if(e<=V)return String.fromCharCode.apply(String,t);var i="",r=0;for(;r<e;)i+=String.fromCharCode.apply(String,t.slice(r,r+=V));return i}(r)}j.TYPED_ARRAY_SUPPORT=void 0===f.TYPED_ARRAY_SUPPORT||f.TYPED_ARRAY_SUPPORT,R(),j.poolSize=8192,j._augment=function(t){return t.__proto__=j.prototype,t},j.from=function(t,e,i){return S(null,t,e,i)},j.TYPED_ARRAY_SUPPORT&&(j.prototype.__proto__=Uint8Array.prototype,j.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&j[Symbol.species]),j.alloc=function(t,e,i){return function(t,e,i,r){return C(e),e<=0?N(t,e):void 0!==i?"string"==typeof r?N(t,e).fill(i,r):N(t,e).fill(i):N(t,e)}(null,t,e,i)},j.allocUnsafe=function(t){return P(null,t)},j.allocUnsafeSlow=function(t){return P(null,t)},j.isBuffer=function(t){return null!=t&&(!!t._isBuffer||ct(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&ct(t.slice(0,0))}(t))},j.compare=function(t,e){if(!$(t)||!$(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var i=t.length,r=e.length,s=0,n=Math.min(i,r);s<n;++s)if(t[s]!==e[s]){i=t[s],r=e[s];break}return i<r?-1:r<i?1:0},j.isEncoding=function(t){switch(String(t).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}},j.concat=function(t,e){if(!E(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return j.alloc(0);var i;if(void 0===e)for(e=0,i=0;i<t.length;++i)e+=t[i].length;var r=j.allocUnsafe(e),s=0;for(i=0;i<t.length;++i){var n=t[i];if(!$(n))throw new TypeError('"list" argument must be an Array of Buffers');n.copy(r,s),s+=n.length}return r},j.byteLength=D,j.prototype._isBuffer=!0,j.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)F(this,e,e+1);return this},j.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)F(this,e,e+3),F(this,e+1,e+2);return this},j.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)F(this,e,e+7),F(this,e+1,e+6),F(this,e+2,e+5),F(this,e+3,e+4);return this},j.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?Y(this,0,t):O.apply(this,arguments)},j.prototype.equals=function(t){if(!$(t))throw new TypeError("Argument must be a Buffer");return this===t||0===j.compare(this,t)},j.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},j.prototype.compare=function(t,e,i,r,s){if(!$(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===r&&(r=0),void 0===s&&(s=this.length),e<0||i>t.length||r<0||s>this.length)throw new RangeError("out of range index");if(r>=s&&e>=i)return 0;if(r>=s)return-1;if(e>=i)return 1;if(this===t)return 0;for(var n=(s>>>=0)-(r>>>=0),a=(i>>>=0)-(e>>>=0),o=Math.min(n,a),h=this.slice(r,s),u=t.slice(e,i),l=0;l<o;++l)if(h[l]!==u[l]){n=h[l],a=u[l];break}return n<a?-1:a<n?1:0},j.prototype.includes=function(t,e,i){return-1!==this.indexOf(t,e,i)},j.prototype.indexOf=function(t,e,i){return L(this,t,e,i,!0)},j.prototype.lastIndexOf=function(t,e,i){return L(this,t,e,i,!1)},j.prototype.write=function(t,e,i,r){if(void 0===e)r="utf8",i=this.length,e=0;else if(void 0===i&&"string"==typeof e)r=e,i=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(i)?(i|=0,void 0===r&&(r="utf8")):(r=i,i=void 0)}var s=this.length-e;if((void 0===i||i>s)&&(i=s),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var n=!1;;)switch(r){case"hex":return B(this,t,e,i);case"utf8":case"utf-8":return q(this,t,e,i);case"ascii":return U(this,t,e,i);case"latin1":case"binary":return Q(this,t,e,i);case"base64":return H(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,t,e,i);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),n=!0}},j.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var V=4096;function X(t,e,i){var r="";i=Math.min(t.length,i);for(var s=e;s<i;++s)r+=String.fromCharCode(127&t[s]);return r}function W(t,e,i){var r="";i=Math.min(t.length,i);for(var s=e;s<i;++s)r+=String.fromCharCode(t[s]);return r}function Z(t,e,i){var r=t.length;(!e||e<0)&&(e=0),(!i||i<0||i>r)&&(i=r);for(var s="",n=e;n<i;++n)s+=ot(t[n]);return s}function K(t,e,i){for(var r=t.slice(e,i),s="",n=0;n<r.length;n+=2)s+=String.fromCharCode(r[n]+256*r[n+1]);return s}function J(t,e,i){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>i)throw new RangeError("Trying to access beyond buffer length")}function tt(t,e,i,r,s,n){if(!$(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>s||e<n)throw new RangeError('"value" argument is out of bounds');if(i+r>t.length)throw new RangeError("Index out of range")}function et(t,e,i,r){e<0&&(e=65535+e+1);for(var s=0,n=Math.min(t.length-i,2);s<n;++s)t[i+s]=(e&255<<8*(r?s:1-s))>>>8*(r?s:1-s)}function it(t,e,i,r){e<0&&(e=4294967295+e+1);for(var s=0,n=Math.min(t.length-i,4);s<n;++s)t[i+s]=e>>>8*(r?s:3-s)&255}function rt(t,e,i,r,s,n){if(i+r>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function st(t,e,i,r,s){return s||rt(t,0,i,4),T(t,e,i,r,23,4),i+4}function nt(t,e,i,r,s){return s||rt(t,0,i,8),T(t,e,i,r,52,8),i+8}j.prototype.slice=function(t,e){var i,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),j.TYPED_ARRAY_SUPPORT)(i=this.subarray(t,e)).__proto__=j.prototype;else{var s=e-t;i=new j(s,void 0);for(var n=0;n<s;++n)i[n]=this[n+t]}return i},j.prototype.readUIntLE=function(t,e,i){t|=0,e|=0,i||J(t,e,this.length);for(var r=this[t],s=1,n=0;++n<e&&(s*=256);)r+=this[t+n]*s;return r},j.prototype.readUIntBE=function(t,e,i){t|=0,e|=0,i||J(t,e,this.length);for(var r=this[t+--e],s=1;e>0&&(s*=256);)r+=this[t+--e]*s;return r},j.prototype.readUInt8=function(t,e){return e||J(t,1,this.length),this[t]},j.prototype.readUInt16LE=function(t,e){return e||J(t,2,this.length),this[t]|this[t+1]<<8},j.prototype.readUInt16BE=function(t,e){return e||J(t,2,this.length),this[t]<<8|this[t+1]},j.prototype.readUInt32LE=function(t,e){return e||J(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},j.prototype.readUInt32BE=function(t,e){return e||J(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},j.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||J(t,e,this.length);for(var r=this[t],s=1,n=0;++n<e&&(s*=256);)r+=this[t+n]*s;return r>=(s*=128)&&(r-=Math.pow(2,8*e)),r},j.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||J(t,e,this.length);for(var r=e,s=1,n=this[t+--r];r>0&&(s*=256);)n+=this[t+--r]*s;return n>=(s*=128)&&(n-=Math.pow(2,8*e)),n},j.prototype.readInt8=function(t,e){return e||J(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},j.prototype.readInt16LE=function(t,e){e||J(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},j.prototype.readInt16BE=function(t,e){e||J(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},j.prototype.readInt32LE=function(t,e){return e||J(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},j.prototype.readInt32BE=function(t,e){return e||J(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},j.prototype.readFloatLE=function(t,e){return e||J(t,4,this.length),w(this,t,!0,23,4)},j.prototype.readFloatBE=function(t,e){return e||J(t,4,this.length),w(this,t,!1,23,4)},j.prototype.readDoubleLE=function(t,e){return e||J(t,8,this.length),w(this,t,!0,52,8)},j.prototype.readDoubleBE=function(t,e){return e||J(t,8,this.length),w(this,t,!1,52,8)},j.prototype.writeUIntLE=function(t,e,i,r){(t=+t,e|=0,i|=0,r)||tt(this,t,e,i,Math.pow(2,8*i)-1,0);var s=1,n=0;for(this[e]=255&t;++n<i&&(s*=256);)this[e+n]=t/s&255;return e+i},j.prototype.writeUIntBE=function(t,e,i,r){(t=+t,e|=0,i|=0,r)||tt(this,t,e,i,Math.pow(2,8*i)-1,0);var s=i-1,n=1;for(this[e+s]=255&t;--s>=0&&(n*=256);)this[e+s]=t/n&255;return e+i},j.prototype.writeUInt8=function(t,e,i){return t=+t,e|=0,i||tt(this,t,e,1,255,0),j.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},j.prototype.writeUInt16LE=function(t,e,i){return t=+t,e|=0,i||tt(this,t,e,2,65535,0),j.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):et(this,t,e,!0),e+2},j.prototype.writeUInt16BE=function(t,e,i){return t=+t,e|=0,i||tt(this,t,e,2,65535,0),j.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):et(this,t,e,!1),e+2},j.prototype.writeUInt32LE=function(t,e,i){return t=+t,e|=0,i||tt(this,t,e,4,4294967295,0),j.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):it(this,t,e,!0),e+4},j.prototype.writeUInt32BE=function(t,e,i){return t=+t,e|=0,i||tt(this,t,e,4,4294967295,0),j.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):it(this,t,e,!1),e+4},j.prototype.writeIntLE=function(t,e,i,r){if(t=+t,e|=0,!r){var s=Math.pow(2,8*i-1);tt(this,t,e,i,s-1,-s)}var n=0,a=1,o=0;for(this[e]=255&t;++n<i&&(a*=256);)t<0&&0===o&&0!==this[e+n-1]&&(o=1),this[e+n]=(t/a|0)-o&255;return e+i},j.prototype.writeIntBE=function(t,e,i,r){if(t=+t,e|=0,!r){var s=Math.pow(2,8*i-1);tt(this,t,e,i,s-1,-s)}var n=i-1,a=1,o=0;for(this[e+n]=255&t;--n>=0&&(a*=256);)t<0&&0===o&&0!==this[e+n+1]&&(o=1),this[e+n]=(t/a|0)-o&255;return e+i},j.prototype.writeInt8=function(t,e,i){return t=+t,e|=0,i||tt(this,t,e,1,127,-128),j.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},j.prototype.writeInt16LE=function(t,e,i){return t=+t,e|=0,i||tt(this,t,e,2,32767,-32768),j.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):et(this,t,e,!0),e+2},j.prototype.writeInt16BE=function(t,e,i){return t=+t,e|=0,i||tt(this,t,e,2,32767,-32768),j.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):et(this,t,e,!1),e+2},j.prototype.writeInt32LE=function(t,e,i){return t=+t,e|=0,i||tt(this,t,e,4,2147483647,-2147483648),j.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):it(this,t,e,!0),e+4},j.prototype.writeInt32BE=function(t,e,i){return t=+t,e|=0,i||tt(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),j.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):it(this,t,e,!1),e+4},j.prototype.writeFloatLE=function(t,e,i){return st(this,t,e,!0,i)},j.prototype.writeFloatBE=function(t,e,i){return st(this,t,e,!1,i)},j.prototype.writeDoubleLE=function(t,e,i){return nt(this,t,e,!0,i)},j.prototype.writeDoubleBE=function(t,e,i){return nt(this,t,e,!1,i)},j.prototype.copy=function(t,e,i,r){if(i||(i=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<i&&(r=i),r===i)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-i&&(r=t.length-e+i);var s,n=r-i;if(this===t&&i<e&&e<r)for(s=n-1;s>=0;--s)t[s+e]=this[s+i];else if(n<1e3||!j.TYPED_ARRAY_SUPPORT)for(s=0;s<n;++s)t[s+e]=this[s+i];else Uint8Array.prototype.set.call(t,this.subarray(i,i+n),e);return n},j.prototype.fill=function(t,e,i,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,i=this.length):"string"==typeof i&&(r=i,i=this.length),1===t.length){var s=t.charCodeAt(0);s<256&&(t=s)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!j.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<i)throw new RangeError("Out of range index");if(i<=e)return this;var n;if(e>>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(n=e;n<i;++n)this[n]=t;else{var a=$(t)?t:ht(new j(t,r).toString()),o=a.length;for(n=0;n<i-e;++n)this[n+e]=a[n%o]}return this};var at=/[^+\/0-9A-Za-z-_]/g;function ot(t){return t<16?"0"+t.toString(16):t.toString(16)}function ht(t,e){var i;e=e||1/0;for(var r=t.length,s=null,n=[],a=0;a<r;++a){if((i=t.charCodeAt(a))>55295&&i<57344){if(!s){if(i>56319){(e-=3)>-1&&n.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&n.push(239,191,189);continue}s=i;continue}if(i<56320){(e-=3)>-1&&n.push(239,191,189),s=i;continue}i=65536+(s-55296<<10|i-56320)}else s&&(e-=3)>-1&&n.push(239,191,189);if(s=null,i<128){if((e-=1)<0)break;n.push(i)}else if(i<2048){if((e-=2)<0)break;n.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;n.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;n.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return n}function ut(t){return function(t){var e,i,r,s,n,a;b||m();var o=t.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");n="="===t[o-2]?2:"="===t[o-1]?1:0,a=new g(3*o/4-n),r=n>0?o-4:o;var h=0;for(e=0,i=0;e<r;e+=4,i+=3)s=_[t.charCodeAt(e)]<<18|_[t.charCodeAt(e+1)]<<12|_[t.charCodeAt(e+2)]<<6|_[t.charCodeAt(e+3)],a[h++]=s>>16&255,a[h++]=s>>8&255,a[h++]=255&s;return 2===n?(s=_[t.charCodeAt(e)]<<2|_[t.charCodeAt(e+1)]>>4,a[h++]=255&s):1===n&&(s=_[t.charCodeAt(e)]<<10|_[t.charCodeAt(e+1)]<<4|_[t.charCodeAt(e+2)]>>2,a[h++]=s>>8&255,a[h++]=255&s),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(at,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function lt(t,e,i,r){for(var s=0;s<r&&!(s+i>=e.length||s>=t.length);++s)e[s+i]=t[s];return s}function ct(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}const dt="http://www.w3.org/1999/02/22-rdf-syntax-ns#",ft="http://www.w3.org/2001/XMLSchema#",pt="http://www.w3.org/2000/10/swap/";var _t={xsd:{decimal:`${ft}decimal`,boolean:`${ft}boolean`,double:`${ft}double`,integer:`${ft}integer`,string:`${ft}string`},rdf:{type:`${dt}type`,nil:`${dt}nil`,first:`${dt}first`,rest:`${dt}rest`,langString:`${dt}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${pt}reify#forSome`,forAll:`${pt}reify#forAll`},log:{implies:`${pt}log#implies`,isImpliedBy:`${pt}log#isImpliedBy`}};const{xsd:gt}=_t,bt=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,mt={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},yt=/[\x00-\x20<>\\"\{\}\|\^\`]/,xt={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},vt=/$0^/;class wt{constructor(t){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]*)?$/,t=t||{},this._isImpliedBy=t.isImpliedBy,this._lineMode=!!t.lineMode){this._n3Mode=!1;for(const t in this)!(t in xt)&&this[t]instanceof RegExp&&(this[t]=vt)}else this._n3Mode=!1!==t.n3;this.comments=!!t.comments,this._literalClosingPos=0}_tokenizeToEnd(t,e){let i=this._input,r=i.length;for(;;){let t,a;for(;t=this._newline.exec(i);)this.comments&&(a=this._comment.exec(t[0]))&&s("comment",a[1],"",this._line,t[0].length),i=i.substr(t[0].length,i.length),r=i.length,this._line++;if(!t&&(t=this._whitespace.exec(i))&&(i=i.substr(t[0].length,i.length)),this._endOfFile.test(i))return e&&(this.comments&&(a=this._comment.exec(i))&&s("comment",a[1],"",this._line,i.length),i=null,s("eof","","",this._line,0)),this._input=i;const o=this._line,h=i[0];let u="",l="",c="",d=null,f=0,p=!1;switch(h){case"^":if(i.length<3)break;if("^"!==i[1]){this._n3Mode&&(f=1,u="^");break}if(this._previousMarker="^^",i=i.substr(2),"<"!==i[0]){p=!0;break}case"<":if(d=this._unescapedIri.exec(i))u="IRI",l=d[1];else if(d=this._iri.exec(i)){if(l=this._unescape(d[1]),null===l||yt.test(l))return n(this);u="IRI"}else i.length>1&&"<"===i[1]?(u="<<",f=2):this._n3Mode&&i.length>1&&"="===i[1]&&(f=2,this._isImpliedBy?(u="abbreviation",l="<"):(u="inverse",l=">"));break;case">":i.length>1&&">"===i[1]&&(u=">>",f=2);break;case"_":((d=this._blank.exec(i))||e&&(d=this._blank.exec(`${i} `)))&&(u="blank",c="_",l=d[1]);break;case'"':if(d=this._simpleQuotedString.exec(i))l=d[1];else if(({value:l,matchLength:f}=this._parseLiteral(i)),null===l)return n(this);null===d&&0===f||(u="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(d=this._simpleApostropheString.exec(i))l=d[1];else if(({value:l,matchLength:f}=this._parseLiteral(i)),null===l)return n(this);null===d&&0===f||(u="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(d=this._variable.exec(i))&&(u="var",l=d[0]);break;case"@":"literal"===this._previousMarker&&(d=this._langcode.exec(i))?(u="langcode",l=d[1]):(d=this._keyword.exec(i))&&(u=d[0]);break;case".":if(1===i.length?e:i[1]<"0"||i[1]>"9"){u=".",f=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(d=this._number.exec(i)||e&&(d=this._number.exec(`${i} `)))&&(u="literal",l=d[0],c="string"==typeof d[1]?gt.double:"string"==typeof d[2]?gt.decimal:gt.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(d=this._sparqlKeyword.exec(i))?u=d[0].toUpperCase():p=!0;break;case"f":case"t":(d=this._boolean.exec(i))?(u="literal",l=d[0],c=gt.boolean):p=!0;break;case"a":(d=this._shortPredicates.exec(i))?(u="abbreviation",l="a"):p=!0;break;case"=":this._n3Mode&&i.length>1&&(u="abbreviation",">"!==i[1]?(f=1,l="="):(f=2,l=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(f=1,u=h);break;case"{":!this._lineMode&&i.length>=2&&("|"===i[1]?(u="{|",f=2):(u=h,f=1));break;case"|":i.length>=2&&"}"===i[1]&&(u="|}",f=2);break;default:p=!0}if(p&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(d=this._prefix.exec(i))?((d=this._prefixed.exec(i))||e&&(d=this._prefixed.exec(`${i} `)))&&(u="prefixed",c=d[1]||"",l=this._unescape(d[2])):(u="prefix",l=d[1]||"")),"^^"===this._previousMarker)switch(u){case"prefixed":u="type";break;case"IRI":u="typeIRI";break;default:u=""}if(!u)return e||!/^'''|^"""/.test(i)&&/\n|\r/.test(i)?n(this):this._input=i;const _=f||d[0].length,g=s(u,l,c,o,_);this.previousToken=g,this._previousMarker=u,i=i.substr(_,i.length)}function s(e,s,n,a,o){const h=i?r-i.length:r,u={type:e,value:s,prefix:n,line:a,start:h,end:h+o};return t(null,u),u}function n(e){t(e._syntaxError(/^\S*/.exec(i)[0]))}}_unescape(t){let e=!1;const i=t.replace(bt,(t,i,r,s)=>{if("string"==typeof i)return String.fromCharCode(Number.parseInt(i,16));if("string"==typeof r){let t=Number.parseInt(r,16);return t<=65535?String.fromCharCode(Number.parseInt(r,16)):String.fromCharCode(55296+((t-=65536)>>10),56320+(1023&t))}return s in mt?mt[s]:(e=!0,"")});return e?null:i}_parseLiteral(t){if(t.length>=3){const e=t.match(/^(?:"""|"|'''|'|)/)[0],i=e.length;let r=Math.max(this._literalClosingPos,i);for(;(r=t.indexOf(e,r))>0;){let e=0;for(;"\\"===t[r-e-1];)e++;if(e%2==0){const e=t.substring(i,r),s=e.split(/\r\n|\r|\n/).length-1,n=r+i;if(1===i&&0!==s||3===i&&this._lineMode)break;return this._line+=s,{value:this._unescape(e),matchLength:n}}r++}this._literalClosingPos=t.length-i+1}return{value:"",matchLength:0}}_syntaxError(t){this._input=null;const e=new Error(`Unexpected "${t}" on line ${this._line}.`);return e.context={token:void 0,line:this._line,previousToken:this.previousToken},e}_readStartingBom(t){return t.startsWith("\ufeff")?t.substr(1):t}tokenize(t,e){if(this._line=1,"string"==typeof t){if(this._input=this._readStartingBom(t),"function"!=typeof e){const t=[];let e;if(this._tokenizeToEnd((i,r)=>i?e=i:t.push(r),!0),e)throw e;return t}queueMicrotask(()=>this._tokenizeToEnd(e,!0))}else this._pendingBuffer=null,"function"==typeof t.setEncoding&&t.setEncoding("utf8"),t.on("data",t=>{null!==this._input&&0!==t.length&&(this._pendingBuffer&&(t=j.concat([this._pendingBuffer,t]),this._pendingBuffer=null),128&t[t.length-1]?this._pendingBuffer=t:(void 0===this._input?this._input=this._readStartingBom("string"==typeof t?t:t.toString()):this._input+=t,this._tokenizeToEnd(e,!1)))}),t.on("end",()=>{"string"==typeof this._input&&this._tokenizeToEnd(e,!0)}),t.on("error",e)}}const{rdf:Tt,xsd:It}=_t;let Et,Rt=0;const Nt={namedNode:Ot,blankNode:Ft,variable:Mt,literal:Lt,defaultGraph:function(){return Et},quad:Bt,triple:Bt,fromTerm:qt,fromQuad:Ut};class jt{constructor(t){this.id=t}get value(){return this.id}equals(t){return t instanceof jt?this.id===t.id:!!t&&this.termType===t.termType&&this.value===t.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}let St=class extends jt{get termType(){return"NamedNode"}},Ct=class t extends jt{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const t=this.id;let e=t.lastIndexOf('"')+1;return e<t.length&&"@"===t[e++]?t.substr(e).toLowerCase():""}get datatype(){return new St(this.datatypeString)}get datatypeString(){const t=this.id,e=t.lastIndexOf('"')+1,i=e<t.length?t[e]:"";return"^"===i?t.substr(e+2):"@"!==i?It.string:Tt.langString}equals(e){return e instanceof t?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}}}},Pt=class extends jt{constructor(t){super(`_:${t}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},kt=class extends jt{constructor(t){super(`?${t}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}};function At(t,e,i){if(e=e||Nt,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===Nt)return new Ct(t);if('"'===t[t.length-1])return e.literal(t.substr(1,t.length-2));const r=t.lastIndexOf('"',t.length-1);return e.literal(t.substr(1,r-1),"@"===t[r+1]?t.substr(r+2):e.namedNode(t.substr(r+3)));case"[":t=JSON.parse(t);break;default:if(!i||!Array.isArray(t))return e.namedNode(t)}return e.quad(At(t[0],e,!0),At(t[1],e,!0),At(t[2],e,!0),t[3]&&At(t[3],e,!0))}function $t(t,e){if("string"==typeof t)return t;if(t instanceof jt&&"Quad"!==t.termType)return t.id;if(!t)return Et.id;switch(t.termType){case"NamedNode":return t.value;case"BlankNode":return`_:${t.value}`;case"Variable":return`?${t.value}`;case"DefaultGraph":return"";case"Literal":return`"${t.value}"${t.language?`@${t.language}`:t.datatype&&t.datatype.value!==It.string?`^^${t.datatype.value}`:""}`;case"Quad":const i=[$t(t.subject,!0),$t(t.predicate,!0),$t(t.object,!0)];return t.graph&&"DefaultGraph"!==t.graph.termType&&i.push($t(t.graph,!0)),e?i:JSON.stringify(i);default:throw new Error(`Unexpected termType: ${t.termType}`)}}Et=new class extends jt{constructor(){return super(""),Et||this}get termType(){return"DefaultGraph"}equals(t){return this===t||!!t&&this.termType===t.termType}};let Dt=class extends jt{constructor(t,e,i,r){super(""),this._subject=t,this._predicate=e,this._object=i,this._graph=r||Et}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(t){return!!t&&this._subject.equals(t.subject)&&this._predicate.equals(t.predicate)&&this._object.equals(t.object)&&this._graph.equals(t.graph)}};function Ot(t){return new St(t)}function Ft(t){return new Pt(t||"n3-"+Rt++)}function Lt(t,e){if("string"==typeof e)return new Ct(`"${t}"@${e.toLowerCase()}`);let i=e?e.value:"";return""===i&&("boolean"==typeof t?i=It.boolean:"number"==typeof t&&(Number.isFinite(t)?i=Number.isInteger(t)?It.integer:It.double:(i=It.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),""===i||i===It.string?new Ct(`"${t}"`):new Ct(`"${t}"^^${i}`)}function Mt(t){return new kt(t)}function Bt(t,e,i,r){return new Dt(t,e,i,r)}function qt(t){if(t instanceof jt)return t;switch(t.termType){case"NamedNode":return Ot(t.value);case"BlankNode":return Ft(t.value);case"Variable":return Mt(t.value);case"DefaultGraph":return Et;case"Literal":return Lt(t.value,t.language||t.datatype);case"Quad":return Ut(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function Ut(t){if(t instanceof Dt)return t;if("Quad"!==t.termType)throw new Error(`Unexpected termType: ${t.termType}`);return Bt(qt(t.subject),qt(t.predicate),qt(t.object),qt(t.graph))}let Qt=0;class Ht{constructor(t){this._contextStack=[],this._graph=null,t=t||{},this._setBase(t.baseIRI),t.factory&&zt(this,t.factory);const e="string"==typeof t.format?t.format.match(/\w*$/)[0].toLowerCase():"",i=/turtle/.test(e),r=/trig/.test(e),s=/triple/.test(e),n=/quad/.test(e),a=this._n3Mode=/n3/.test(e),o=s||n;(this._supportsNamedGraphs=!(i||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(i||r||s||a),this._isImpliedBy=t.isImpliedBy,this._supportsRDFStar=""===e||/star|\*$/.test(e),o&&(this._resolveRelativeIRI=t=>null),this._blankNodePrefix="string"!=typeof t.blankNodePrefix?"":t.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=t.lexer||new wt({lineMode:o,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!t.explicitQuantifiers}static _resetBlankNodePrefix(){Qt=0}_setBase(t){if(t){const e=t.indexOf("#");e>=0&&(t=t.substr(0,e)),this._base=t,this._basePath=t.indexOf("/")<0?t:t.replace(/[^\/?]*(?:\?.*)?$/,""),t=t.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=t[0],this._baseScheme=t[1]}else this._base="",this._basePath=""}_saveContext(t,e,i,r,s){const n=this._n3Mode;this._contextStack.push({type:t,subject:i,predicate:r,object:s,graph:e,inverse:!!n&&this._inversePredicate,blankPrefix:n?this._prefixes._:"",quantified:n?this._quantified:null}),n&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(t,e){const i=this._contextStack.pop();if(!i||i.type!==t)return this._error(`Unexpected ${e.type}`,e);this._subject=i.subject,this._predicate=i.predicate,this._object=i.object,this._graph=i.graph,this._n3Mode&&(this._inversePredicate=i.inverse,this._prefixes._=i.blankPrefix,this._quantified=i.quantified)}_readInTopContext(t){switch(t.type){case"eof":return null!==this._graph?this._error("Unclosed graph",t):(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(t)}}_readEntity(t,e){let i;switch(t.type){case"IRI":case"typeIRI":const e=this._resolveIRI(t.value);if(null===e)return this._error("Invalid IRI",t);i=this._factory.namedNode(e);break;case"type":case"prefixed":const r=this._prefixes[t.prefix];if(void 0===r)return this._error(`Undefined prefix "${t.prefix}:"`,t);i=this._factory.namedNode(r+t.value);break;case"blank":i=this._factory.blankNode(this._prefixes[t.prefix]+t.value);break;case"var":i=this._factory.variable(t.value.substr(1));break;default:return this._error(`Expected entity but got ${t.type}`,t)}return!e&&this._n3Mode&&i.id in this._quantified&&(i=this._quantified[i.id]),i}_readSubject(t){switch(this._predicate=null,t.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",t);case"}":return this._readPunctuation(t);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',t);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',t);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",t);if(0===t.prefix.length)return this._literalValue=t.value,this._completeSubjectLiteral;this._subject=this._factory.literal(t.value,this._factory.namedNode(t.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",t);default:if(void 0===(this._subject=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(t){const e=t.type;switch(e){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[t.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${e}`,t):(this._subject=null,"]"===e?this._readBlankNodeTail(t):this._readPunctuation(t));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",t);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",t);default:if(void 0===(this._predicate=this._readEntity(t)))return}return this._readObject}_readObject(t){switch(t.type){case"literal":if(0===t.prefix.length)return this._literalValue=t.value,this._readDataTypeOrLang;this._object=this._factory.literal(t.value,this._factory.namedNode(t.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",t);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",t);default:if(void 0===(this._object=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(t){return"{"===t.type?this._readGraph(t):this._readPredicate(t)}_readGraph(t){return"{"!==t.type?this._error(`Expected graph but got ${t.type}`,t):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(t){return"]"===t.type?(this._subject=null,this._readBlankNodeTail(t)):(this._predicate=null,this._readPredicate(t))}_readBlankNodeTail(t){if("]"!==t.type)return this._readBlankNodePunctuation(t);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const e=null===this._predicate;return this._restoreContext("blank",t),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:e?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(t){switch(t.type){case".":case"}":return this._subject=null,this._readPunctuation(t);default:return this._readPredicate(t)}}_readListItem(t){let e=null,i=null,r=this._readListItem;const s=this._subject,n=this._contextStack,a=n[n.length-1];switch(t.type){case"[":this._saveContext("blank",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this._subject=e=this._factory.blankNode()),r=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",t),0!==n.length&&"list"===n[n.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(r=this._readPredicate,this._subject===this.RDF_NIL)return r}else if(r=this._getContextEndReader(),this._object===this.RDF_NIL)return r;i=this.RDF_NIL;break;case"literal":0===t.prefix.length?(this._literalValue=t.value,r=this._readListItemDataTypeOrLang):(e=this._factory.literal(t.value,this._factory.namedNode(t.prefix)),r=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",t);default:if(void 0===(e=this._readEntity(t)))return}if(null===i&&(this._subject=i=this._factory.blankNode()),null===s?null===a.predicate?a.subject=i:a.object=i:this._emit(s,this.RDF_REST,i,this._graph),null!==e){if(this._n3Mode&&("IRI"===t.type||"prefixed"===t.type))return this._saveContext("item",this._graph,i,this.RDF_FIRST,e),this._subject=e,this._predicate=null,this._getPathReader(this._readListItem);this._emit(i,this.RDF_FIRST,e,this._graph)}return r}_readDataTypeOrLang(t){return this._completeObjectLiteral(t,!1)}_readListItemDataTypeOrLang(t){return this._completeObjectLiteral(t,!0)}_completeLiteral(t){let e=this._factory.literal(this._literalValue);switch(t.type){case"type":case"typeIRI":const i=this._readEntity(t);if(void 0===i)return;e=this._factory.literal(this._literalValue,i),t=null;break;case"langcode":e=this._factory.literal(this._literalValue,t.value),t=null}return{token:t,literal:e}}_completeSubjectLiteral(t){return this._subject=this._completeLiteral(t).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(t,e){const i=this._completeLiteral(t);if(i)return this._object=i.literal,e&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),null===i.token?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(i.token))}_readFormulaTail(t){return"}"!==t.type?this._readPunctuation(t):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",t),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(t){let e,i=this._graph;const r=this._subject,s=this._inversePredicate;switch(t.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",t);if(this._n3Mode)return this._readFormulaTail(t);this._graph=null;case".":this._subject=null,e=this._contextStack.length?this._readSubject:this._readInTopContext,s&&(this._inversePredicate=!1);break;case";":e=this._readPredicate;break;case",":e=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF-star syntax",t);const n=this._predicate,a=this._object;this._subject=this._factory.quad(r,n,a,this.DEFAULTGRAPH),e=this._readPredicate;break;case"|}":if("Quad"!==this._subject.termType)return this._error("Unexpected asserted triple closing",t);this._subject=null,e=this._readPunctuation;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(i=this._readEntity(t))){e=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,t)}if(null!==r){const t=this._predicate,e=this._object;s?this._emit(e,t,r,i):this._emit(r,t,e,i)}return e}_readBlankNodePunctuation(t){let e;switch(t.type){case";":e=this._readPredicate;break;case",":e=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,t)}return this._emit(this._subject,this._predicate,this._object,this._graph),e}_readQuadPunctuation(t){return"."!==t.type?this._error("Expected dot to follow quad",t):this._readInTopContext}_readPrefix(t){return"prefix"!==t.type?this._error("Expected prefix to follow @prefix",t):(this._prefix=t.value,this._readPrefixIRI)}_readPrefixIRI(t){if("IRI"!==t.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,t);const e=this._readEntity(t);return this._prefixes[this._prefix]=e.value,this._prefixCallback(this._prefix,e),this._readDeclarationPunctuation}_readBaseIRI(t){const e="IRI"===t.type&&this._resolveIRI(t.value);return e?(this._setBase(e),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",t)}_readNamedGraphLabel(t){switch(t.type){case"IRI":case"blank":case"prefixed":return this._readSubject(t),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",t)}}_readNamedGraphBlankLabel(t){return"]"!==t.type?this._error("Invalid graph label",t):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(t){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(t)):"."!==t.type?this._error("Expected declaration to end with a dot",t):this._readInTopContext}_readQuantifierList(t){let e;switch(t.type){case"IRI":case"prefixed":if(void 0!==(e=this._readEntity(t,!0)))break;default:return this._error(`Unexpected ${t.type}`,t)}return this._explicitQuantifiers?(null===this._subject?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,e,this.QUANTIFIERS_GRAPH)):this._quantified[e.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(t){return","===t.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(t))}_getPathReader(t){return this._afterPath=t,this._readPath}_readPath(t){switch(t.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const e=this._contextStack,i=e.length&&e[e.length-1];if(i&&"item"===i.type){const e=this._subject;this._restoreContext("item",t),this._emit(this._subject,this.RDF_FIRST,e,this._graph)}return this._afterPath(t)}}_readForwardPath(t){let e,i;const r=this._factory.blankNode();if(void 0!==(i=this._readEntity(t)))return null===this._predicate?(e=this._subject,this._subject=r):(e=this._object,this._object=r),this._emit(e,i,r,this._graph),this._readPath}_readBackwardPath(t){const e=this._factory.blankNode();let i,r;if(void 0!==(i=this._readEntity(t)))return null===this._predicate?(r=this._subject,this._subject=e):(r=this._object,this._object=e),this._emit(e,i,r,this._graph),this._readPath}_readRDFStarTailOrGraph(t){return">>"!==t.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(t))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,t):this._readRDFStarTail(t)}_readRDFStarTail(t){if(">>"!==t.type)return this._error(`Expected >> but got ${t.type}`,t);const e=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",t),null===this._subject?(this._subject=e,this._readPredicate):(this._object=e,this._getContextEndReader())}_getContextEndReader(){const t=this._contextStack;if(!t.length)return this._readPunctuation;switch(t[t.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(t,e,i,r){this._callback(null,this._factory.quad(t,e,i,r||this.DEFAULTGRAPH))}_error(t,e){const i=new Error(`${t} on line ${e.line}.`);i.context={token:e,line:e.line,previousToken:this._lexer.previousToken},this._callback(i),this._callback=Gt}_resolveIRI(t){return/^[a-z][a-z0-9+.-]*:/i.test(t)?t:this._resolveRelativeIRI(t)}_resolveRelativeIRI(t){if(!t.length)return this._base;switch(t[0]){case"#":return this._base+t;case"?":return this._base.replace(/(?:\?.*)?$/,t);case"/":return("/"===t[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(t);default:return/^[^/:]*:/.test(t)?null:this._removeDotSegments(this._basePath+t)}}_removeDotSegments(t){if(!/(^|\/)\.\.?($|[/#?])/.test(t))return t;const e=t.length;let i="",r=-1,s=-1,n=0,a="/";for(;r<e;){switch(a){case":":if(s<0&&"/"===t[++r]&&"/"===t[++r])for(;(s=r+1)<e&&"/"!==t[s];)r=s;break;case"?":case"#":r=e;break;case"/":if("."===t[r+1])switch(a=t[1+ ++r],a){case"/":i+=t.substring(n,r-1),n=r+1;break;case void 0:case"?":case"#":return i+t.substring(n,r)+t.substr(r+1);case".":if(a=t[1+ ++r],void 0===a||"/"===a||"?"===a||"#"===a){if(i+=t.substring(n,r-2),(n=i.lastIndexOf("/"))>=s&&(i=i.substr(0,n)),"/"!==a)return`${i}/${t.substr(r+1)}`;n=r+1}}}a=t[++r]}return i+t.substring(n)}parse(t,e,i){let r,s,n;if(e&&(e.onQuad||e.onPrefix||e.onComment)?(r=e.onQuad,s=e.onPrefix,n=e.onComment):(r=e,s=i),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Qt++}_`,this._prefixCallback=s||Gt,this._inversePredicate=!1,this._quantified=Object.create(null),!r){const e=[];let i;if(this._callback=(t,r)=>{t?i=t:r&&e.push(r)},this._lexer.tokenize(t).every(t=>this._readCallback=this._readCallback(t)),i)throw i;return e}let a=(t,e)=>{null!==t?(this._callback(t),this._callback=Gt):this._readCallback&&(this._readCallback=this._readCallback(e))};n&&(this._lexer.comments=!0,a=(t,e)=>{null!==t?(this._callback(t),this._callback=Gt):this._readCallback&&("comment"===e.type?n(e.value):this._readCallback=this._readCallback(e))}),this._callback=r,this._lexer.tokenize(t,a)}}function Gt(){}function zt(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(_t.rdf.first),t.RDF_REST=e.namedNode(_t.rdf.rest),t.RDF_NIL=e.namedNode(_t.rdf.nil),t.N3_FORALL=e.namedNode(_t.r.forAll),t.N3_FORSOME=e.namedNode(_t.r.forSome),t.ABBREVIATIONS={a:e.namedNode(_t.rdf.type),"=":e.namedNode(_t.owl.sameAs),">":e.namedNode(_t.log.implies),"<":e.namedNode(_t.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}function Yt(t){return!!t&&"DefaultGraph"===t.termType}function Vt(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}zt(Ht.prototype,Nt);const Xt=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Wt=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/;class Zt{constructor(t){this.base=t,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(t.length+1)}static supports(t){return!Xt.test(t)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!Zt.supports(this.base))return this._baseMatcher=/.^/;const t=/^[^:]*:\/*/.exec(this.base)[0],e=["^",Vt(t)],i=[],r=[],s=/[^/?#]*([/?#])/y;let n,a=0,o=0,h=s.lastIndex=t.length;for(;!a&&!o&&(n=s.exec(this.base));)"#"===n[1]?o=s.lastIndex-1:(e.push(Vt(n[0]),"(?:"),i.push(")?"),"?"!==n[1]?r.push(h=s.lastIndex):(a=h=s.lastIndex,o=this.base.indexOf("#",a),this._pathReplacements[a]="?"));for(let t=0;t<r.length;t++)this._pathReplacements[r[t]]="../".repeat(r.length-t-1);return this._pathReplacements[r[r.length-1]]="./",this._baseLength=o>0?o:this.base.length,e.push(Vt(this.base.substring(h,this._baseLength)),a?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...e,...i].join(""))}toRelative(t){const e=this._getBaseMatcher().exec(t);if(!e)return t;const i=e[0].length;if(i===this._baseLength&&i===t.length)return"";const r=this._pathReplacements[i];if(r){const e=t.substring(i);return"?"===r||Wt.test(e)?"./"===r&&/^[^?#]/.test(e)?e:r+e:t}return t.substring(i-1)}}const Kt=Nt.defaultGraph(),{rdf:Jt,xsd:te}=_t,ee=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,ie=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,re={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class se extends jt{equals(t){return t===this}}class ne{constructor(t,e){if(this._prefixRegex=/$0^/,t&&"function"!=typeof t.write&&(e=t,t=null),e=e||{},this._lists=e.lists,t)this._outputStream=t,this._endStream=void 0===e.end||!!e.end;else{let t="";this._outputStream={write(e,i,r){t+=e,r&&r()},end:e=>{e&&e(null,t)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(e.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Kt,this._prefixIRIs=Object.create(null),e.prefixes&&this.addPrefixes(e.prefixes),e.baseIRI&&(this._baseIri=new Zt(e.baseIRI)))}get _inDefaultGraph(){return Kt.equals(this._graph)}_write(t,e){this._outputStream.write(t,"utf8",e)}_writeQuad(t,e,i,r,s){try{r.equals(this._graph)||(this._write((null===this._subject?"":this._inDefaultGraph?".\n":"\n}\n")+(Kt.equals(r)?"":`${this._encodeIriOrBlank(r)} {\n`)),this._graph=r,this._subject=null),t.equals(this._subject)?e.equals(this._predicate)?this._write(`, ${this._encodeObject(i)}`,s):this._write(`;\n ${this._encodePredicate(this._predicate=e)} ${this._encodeObject(i)}`,s):this._write(`${(null===this._subject?"":".\n")+this._encodeSubject(this._subject=t)} ${this._encodePredicate(this._predicate=e)} ${this._encodeObject(i)}`,s)}catch(t){s&&s(t)}}_writeQuadLine(t,e,i,r,s){delete this._prefixMatch,this._write(this.quadToString(t,e,i,r),s)}quadToString(t,e,i,r){return`${this._encodeSubject(t)} ${this._encodeIriOrBlank(e)} ${this._encodeObject(i)}${r&&r.value?` ${this._encodeIriOrBlank(r)} .\n`:" .\n"}`}quadsToString(t){let e="";for(const i of t)e+=this.quadToString(i.subject,i.predicate,i.object,i.graph);return e}_encodeSubject(t){return"Quad"===t.termType?this._encodeQuad(t):this._encodeIriOrBlank(t)}_encodeIriOrBlank(t){if("NamedNode"!==t.termType)return this._lists&&t.value in this._lists&&(t=this.list(this._lists[t.value])),"id"in t?t.id:`_:${t.value}`;let e=t.value;this._baseIri&&(e=this._baseIri.toRelative(e)),ee.test(e)&&(e=e.replace(ie,ae));const i=this._prefixRegex.exec(e);return i?i[1]?this._prefixIRIs[i[1]]+i[2]:e:`<${e}>`}_encodeLiteral(t){let e=t.value;if(ee.test(e)&&(e=e.replace(ie,ae)),t.language)return`"${e}"@${t.language}`;if(this._lineMode){if(t.datatype.value===te.string)return`"${e}"`}else switch(t.datatype.value){case te.string:return`"${e}"`;case te.boolean:if("true"===e||"false"===e)return e;break;case te.integer:if(/^[+-]?\d+$/.test(e))return e;break;case te.decimal:if(/^[+-]?\d*\.\d+$/.test(e))return e;break;case te.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(e))return e}return`"${e}"^^${this._encodeIriOrBlank(t.datatype)}`}_encodePredicate(t){return t.value===Jt.type?"a":this._encodeIriOrBlank(t)}_encodeObject(t){switch(t.termType){case"Quad":return this._encodeQuad(t);case"Literal":return this._encodeLiteral(t);default:return this._encodeIriOrBlank(t)}}_encodeQuad({subject:t,predicate:e,object:i,graph:r}){return`<<${this._encodeSubject(t)} ${this._encodePredicate(e)} ${this._encodeObject(i)}${Yt(r)?"":` ${this._encodeIriOrBlank(r)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(t,e,i,r,s){void 0===i?this._writeQuad(t.subject,t.predicate,t.object,t.graph,e):"function"==typeof r?this._writeQuad(t,e,i,Kt,r):this._writeQuad(t,e,i,r||Kt,s)}addQuads(t){for(let e=0;e<t.length;e++)this.addQuad(t[e])}addPrefix(t,e,i){const r={};r[t]=e,this.addPrefixes(r,i)}addPrefixes(t,e){if(!this._prefixIRIs)return e&&e();let i=!1;for(let e in t){let r=t[e];"string"!=typeof r&&(r=r.value),i=!0,null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null,this._graph=""),this._prefixIRIs[r]=e+=":",this._write(`@prefix ${e} <${r}>.\n`)}if(i){let t="",e="";for(const i in this._prefixIRIs)t+=t?`|${i}`:i,e+=(e?"|":"")+this._prefixIRIs[i];t=Vt(t),this._prefixRegex=new RegExp(`^(?:${e})[^/]*$|^(${t})([_a-zA-Z0-9][\\-_a-zA-Z0-9]*)$`)}this._write(i?"\n":"",e)}blank(t,e){let i,r,s=t;switch(void 0===t?s=[]:t.termType?s=[{predicate:t,object:e}]:"length"in t||(s=[t]),r=s.length){case 0:return new se("[]");case 1:if(i=s[0],!(i.object instanceof se))return new se(`[ ${this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)} ]`);default:let e="[";for(let n=0;n<r;n++)i=s[n],i.predicate.equals(t)?e+=`, ${this._encodeObject(i.object)}`:(e+=`${(n?";\n ":"\n ")+this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)}`,t=i.predicate);return new se(`${e}\n]`)}}list(t){const e=t&&t.length||0,i=new Array(e);for(let r=0;r<e;r++)i[r]=this._encodeObject(t[r]);return new se(`(${i.join(" ")})`)}end(t){null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null),this._write=this._blockedWrite;let e=t&&((i,r)=>{e=null,t(i,r)});if(this._endStream)try{return this._outputStream.end(e)}catch(t){}e&&e()}}function ae(t){let e=re[t];return void 0===e&&(1===t.length?(e=t.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=(1024*(t.charCodeAt(0)-55296)+t.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}class oe{constructor(){}on(){return this}once(){return this}emit(){return this}pipe(){return this}push(){return!1}destroy(){}_read(){}}class he{constructor(){}on(){return this}write(){}end(){}}class ue extends oe{}class le extends ue{}var ce={Readable:oe,Writable:he,Transform:ue,PassThrough:le},de=Object.freeze({__proto__:null,PassThrough:le,Readable:oe,Transform:ue,Writable:he,default:ce});const fe=Symbol("iter");function pe(t,e,i=4){if(0===i)return Object.assign(t,e);for(const r in e)t[r]=pe(t[r]||Object.create(null),e[r],i-1);return t}function _e(t,e,i=4){let r=!1;for(const s in t)if(s in e){const n=0===i?null:_e(t[s],e[s],i-1);if(!1!==n)r=r||Object.create(null),r[s]=n;else if(3===i)return!1}return r}function ge(t,e,i=4){let r=!1;for(const s in t)if(s in e){if(0!==i){const n=ge(t[s],e[s],i-1);if(!1!==n)r=r||Object.create(null),r[s]=n;else if(3===i)return!1}}else r=r||Object.create(null),r[s]=0===i?null:pe({},t[s],i-1);return r}class be{constructor(t={}){this._id=1,this._ids=Object.create(null),this._ids[""]=1,this._entities=Object.create(null),this._entities[1]="",this._blankNodeIndex=0,this._factory=t.factory||Nt}_termFromId(t){if("."===t[0]){const e=this._entities,i=t.split(".");return this._factory.quad(this._termFromId(e[i[1]]),this._termFromId(e[i[2]]),this._termFromId(e[i[3]]),i[4]&&this._termFromId(e[i[4]]))}return At(t,this._factory)}_termToNumericId(t){if("Quad"===t.termType){const e=this._termToNumericId(t.subject),i=this._termToNumericId(t.predicate),r=this._termToNumericId(t.object);let s;return e&&i&&r&&(Yt(t.graph)||(s=this._termToNumericId(t.graph)))&&this._ids[s?`.${e}.${i}.${r}.${s}`:`.${e}.${i}.${r}`]}return this._ids[$t(t)]}_termToNewNumericId(t){const e=t&&"Quad"===t.termType?`.${this._termToNewNumericId(t.subject)}.${this._termToNewNumericId(t.predicate)}.${this._termToNewNumericId(t.object)}${Yt(t.graph)?"":`.${this._termToNewNumericId(t.graph)}`}`:$t(t);return this._ids[e]||(this._ids[this._entities[++this._id]=e]=this._id)}createBlankNode(t){let e,i;if(t)for(e=t=`_:${t}`,i=1;this._ids[e];)e=t+i++;else do{e="_:b"+this._blankNodeIndex++}while(this._ids[e]);return this._ids[e]=++this._id,this._entities[this._id]=e,this._factory.blankNode(e.substr(2))}}class me{constructor(t,e){this._size=0,this._graphs=Object.create(null),e||!t||t[0]||"function"==typeof t.match||(e=t,t=null),e=e||{},this._factory=e.factory||Nt,this._entityIndex=e.entityIndex||new be({factory:this._factory}),this._entities=this._entityIndex._entities,this._termFromId=this._entityIndex._termFromId.bind(this._entityIndex),this._termToNumericId=this._entityIndex._termToNumericId.bind(this._entityIndex),this._termToNewNumericId=this._entityIndex._termToNewNumericId.bind(this._entityIndex),t&&this.addAll(t)}get size(){let t=this._size;if(null!==t)return t;t=0;const e=this._graphs;let i,r;for(const s in e)for(const n in i=e[s].subjects)for(const e in r=i[n])t+=Object.keys(r[e]).length;return this._size=t}_addToIndex(t,e,i,r){const s=t[e]||(t[e]={}),n=s[i]||(s[i]={}),a=r in n;return a||(n[r]=null),!a}_removeFromIndex(t,e,i,r){const s=t[e],n=s[i];delete n[r];for(const t in n)return;delete s[i];for(const t in s)return;delete t[e]}*_findInIndex(t,e,i,r,s,n,a,o){let h,u,l;const c=this._entities,d=this._termFromId(c[o]),f={subject:null,predicate:null,object:null};e&&((h=t,t={})[e]=h[e]);for(const e in t)if(u=t[e]){f[s]=this._termFromId(c[e]),i&&((h=u,u={})[i]=h[i]);for(const t in u)if(l=u[t]){f[n]=this._termFromId(c[t]);const e=r?r in l?[r]:[]:Object.keys(l);for(let t=0;t<e.length;t++)f[a]=this._termFromId(c[e[t]]),yield this._factory.quad(f.subject,f.predicate,f.object,d)}}}_loop(t,e){for(const i in t)e(i)}_loopByKey0(t,e,i){let r,s;if(r=t[e])for(s in r)i(s)}_loopByKey1(t,e,i){let r,s;for(r in t)s=t[r],s[e]&&i(r)}_loopBy2Keys(t,e,i,r){let s,n,a;if((s=t[e])&&(n=s[i]))for(a in n)r(a)}_countInIndex(t,e,i,r){let s,n,a,o=0;e&&((s=t,t={})[e]=s[e]);for(const e in t)if(n=t[e]){i&&((s=n,n={})[i]=s[i]);for(const t in n)(a=n[t])&&(r?r in a&&o++:o+=Object.keys(a).length)}return o}_getGraphs(t){return"number"!=typeof(t=""===t?1:t&&(this._termToNumericId(t)||-1))?this._graphs:{[t]:this._graphs[t]}}_uniqueEntities(t){const e=Object.create(null);return i=>{i in e||(e[i]=!0,t(this._termFromId(this._entities[i],this._factory)))}}add(t){return this.addQuad(t),this}addQuad(t,e,i,r){e||(r=t.graph,i=t.object,e=t.predicate,t=t.subject),r=r?this._termToNewNumericId(r):1;let s=this._graphs[r];return s||(s=this._graphs[r]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),t=this._termToNewNumericId(t),e=this._termToNewNumericId(e),i=this._termToNewNumericId(i),!!this._addToIndex(s.subjects,t,e,i)&&(this._addToIndex(s.predicates,e,i,t),this._addToIndex(s.objects,i,t,e),this._size=null,!0)}addQuads(t){for(let e=0;e<t.length;e++)this.addQuad(t[e])}delete(t){return this.removeQuad(t),this}has(t,e,i,r){return t&&t.subject&&({subject:t,predicate:e,object:i,graph:r}=t),!this.readQuads(t,e,i,r).next().done}import(t){return t.on("data",t=>{this.addQuad(t)}),t}removeQuad(t,e,i,r){e||({subject:t,predicate:e,object:i,graph:r}=t),r=r?this._termToNumericId(r):1;const s=this._graphs;let n,a,o;if(!((t=t&&this._termToNumericId(t))&&(e=e&&this._termToNumericId(e))&&(i=i&&this._termToNumericId(i))&&(n=s[r])&&(a=n.subjects[t])&&(o=a[e])&&i in o))return!1;for(t in this._removeFromIndex(n.subjects,t,e,i),this._removeFromIndex(n.predicates,e,i,t),this._removeFromIndex(n.objects,i,t,e),null!==this._size&&this._size--,n.subjects)return!0;return delete s[r],!0}removeQuads(t){for(let e=0;e<t.length;e++)this.removeQuad(t[e])}remove(t){return t.on("data",t=>{this.removeQuad(t)}),t}removeMatches(t,e,i,r){const s=new oe({objectMode:!0}),n=this.readQuads(t,e,i,r);return s._read=t=>{for(;--t>=0;){const{done:t,value:e}=n.next();if(t)return void s.push(null);s.push(e)}},this.remove(s)}deleteGraph(t){return this.removeMatches(null,null,null,t)}getQuads(t,e,i,r){return[...this.readQuads(t,e,i,r)]}*readQuads(t,e,i,r){const s=this._getGraphs(r);let n,a,o,h;if(!(t&&!(a=this._termToNumericId(t))||e&&!(o=this._termToNumericId(e))||i&&!(h=this._termToNumericId(i))))for(const t in s)(n=s[t])&&(a?h?yield*this._findInIndex(n.objects,h,a,o,"object","subject","predicate",t):yield*this._findInIndex(n.subjects,a,o,null,"subject","predicate","object",t):o?yield*this._findInIndex(n.predicates,o,h,null,"predicate","object","subject",t):h?yield*this._findInIndex(n.objects,h,null,null,"object","subject","predicate",t):yield*this._findInIndex(n.subjects,null,null,null,"subject","predicate","object",t))}match(t,e,i,r){return new xe(this,t,e,i,r,{entityIndex:this._entityIndex})}countQuads(t,e,i,r){const s=this._getGraphs(r);let n,a,o,h,u=0;if(t&&!(a=this._termToNumericId(t))||e&&!(o=this._termToNumericId(e))||i&&!(h=this._termToNumericId(i)))return 0;for(const r in s)(n=s[r])&&(u+=t?i?this._countInIndex(n.objects,h,a,o):this._countInIndex(n.subjects,a,o,h):e?this._countInIndex(n.predicates,o,h,a):this._countInIndex(n.objects,h,a,o));return u}forEach(t,e,i,r,s){this.some(e=>(t(e,this),!1),e,i,r,s)}every(t,e,i,r,s){return!this.some(e=>!t(e,this),e,i,r,s)}some(t,e,i,r,s){for(const n of this.readQuads(e,i,r,s))if(t(n,this))return!0;return!1}getSubjects(t,e,i){const r=[];return this.forSubjects(t=>{r.push(t)},t,e,i),r}forSubjects(t,e,i,r){const s=this._getGraphs(r);let n,a,o;if(t=this._uniqueEntities(t),!(e&&!(a=this._termToNumericId(e))||i&&!(o=this._termToNumericId(i))))for(r in s)(n=s[r])&&(a?o?this._loopBy2Keys(n.predicates,a,o,t):this._loopByKey1(n.subjects,a,t):o?this._loopByKey0(n.objects,o,t):this._loop(n.subjects,t))}getPredicates(t,e,i){const r=[];return this.forPredicates(t=>{r.push(t)},t,e,i),r}forPredicates(t,e,i,r){const s=this._getGraphs(r);let n,a,o;if(t=this._uniqueEntities(t),!(e&&!(a=this._termToNumericId(e))||i&&!(o=this._termToNumericId(i))))for(r in s)(n=s[r])&&(a?o?this._loopBy2Keys(n.objects,o,a,t):this._loopByKey0(n.subjects,a,t):o?this._loopByKey1(n.predicates,o,t):this._loop(n.predicates,t))}getObjects(t,e,i){const r=[];return this.forObjects(t=>{r.push(t)},t,e,i),r}forObjects(t,e,i,r){const s=this._getGraphs(r);let n,a,o;if(t=this._uniqueEntities(t),!(e&&!(a=this._termToNumericId(e))||i&&!(o=this._termToNumericId(i))))for(r in s)(n=s[r])&&(a?o?this._loopBy2Keys(n.subjects,a,o,t):this._loopByKey1(n.objects,a,t):o?this._loopByKey0(n.predicates,o,t):this._loop(n.objects,t))}getGraphs(t,e,i){const r=[];return this.forGraphs(t=>{r.push(t)},t,e,i),r}forGraphs(t,e,i,r){for(const s in this._graphs)this.some(e=>(t(e.graph),!0),e,i,r,this._termFromId(this._entities[s]))}createBlankNode(t){return this._entityIndex.createBlankNode(t)}extractLists({remove:t=!1,ignoreErrors:e=!1}={}){const i={},r=e?()=>!0:(t,e)=>{throw new Error(`${t.value} ${e}`)},s=this.getQuads(null,_t.rdf.rest,_t.rdf.nil,null),n=t?[...s]:[];return s.forEach(e=>{const s=[];let a,o,h=!1;const u=e.graph;let l=e.subject;for(;l&&!h;){const t=this.getQuads(null,null,l,null),e=this.getQuads(l,null,null,null);let i,c=null,d=null,f=null;for(let s=0;s<e.length&&!h;s++)i=e[s],i.graph.equals(u)?a?h=r(l,"has non-list arcs out"):i.predicate.value===_t.rdf.first?c?h=r(l,"has multiple rdf:first arcs"):n.push(c=i):i.predicate.value===_t.rdf.rest?d?h=r(l,"has multiple rdf:rest arcs"):n.push(d=i):t.length?h=r(l,"can't be subject and object"):(a=i,o="subject"):h=r(l,"not confined to single graph");for(let e=0;e<t.length&&!h;++e)i=t[e],a?h=r(l,"can't have coreferences"):i.predicate.value===_t.rdf.rest?f?h=r(l,"has incoming rdf:rest arcs"):f=i:(a=i,o="object");c?s.unshift(c.object):h=r(l,"has no list head"),l=f&&f.subject}h?t=!1:a&&(i[a[o].value]=s)}),t&&this.removeQuads(n),i}addAll(t){if(t instanceof xe&&(t=t.filtered),Array.isArray(t))this.addQuads(t);else if(t instanceof me&&t._entityIndex===this._entityIndex)0!==t._size&&(this._graphs=pe(this._graphs,t._graphs),this._size=null);else for(const e of t)this.add(e);return this}contains(t){if(t instanceof xe&&(t=t.filtered),t===this)return!0;if(!(t instanceof me)||this._entityIndex!==t._entityIndex)return t.every(t=>this.has(t));const e=this._graphs,i=t._graphs;let r,s,n,a,o;for(const t in i){if(!(r=e[t]))return!1;r=r.subjects;for(const e in s=i[t].subjects){if(!(n=r[e]))return!1;for(const t in a=s[e]){if(!(o=n[t]))return!1;for(const e in a[t])if(!(e in o))return!1}}}return!0}deleteMatches(t,e,i,r){for(const s of this.match(t,e,i,r))this.removeQuad(s);return this}difference(t){if(t&&t instanceof xe&&(t=t.filtered),t===this)return new me({entityIndex:this._entityIndex});if(t instanceof me&&t._entityIndex===this._entityIndex){const e=new me({entityIndex:this._entityIndex}),i=ge(this._graphs,t._graphs);return i&&(e._graphs=i,e._size=null),e}return this.filter(e=>!t.has(e))}equals(t){return t instanceof xe&&(t=t.filtered),t===this||this.size===t.size&&this.contains(t)}filter(t){const e=new me({entityIndex:this._entityIndex});for(const i of this)t(i,this)&&e.add(i);return e}intersection(t){if(t instanceof xe&&(t=t.filtered),t===this){const t=new me({entityIndex:this._entityIndex});return t._graphs=pe(Object.create(null),this._graphs),t._size=this._size,t}if(t instanceof me&&this._entityIndex===t._entityIndex){const e=new me({entityIndex:this._entityIndex}),i=_e(t._graphs,this._graphs);return i&&(e._graphs=i,e._size=null),e}return this.filter(e=>t.has(e))}map(t){const e=new me({entityIndex:this._entityIndex});for(const i of this)e.add(t(i,this));return e}reduce(t,e){const i=this.readQuads();let r=void 0===e?i.next().value:e;for(const e of i)r=t(r,e,this);return r}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return(new ne).quadsToString(this)}union(t){const e=new me({entityIndex:this._entityIndex});return e._graphs=pe(Object.create(null),this._graphs),e._size=this._size,e.addAll(t),e}*[Symbol.iterator](){yield*this.readQuads()}}function ye(t,e,i=0){const r=e[i];if(r&&!(r in t))return!1;let s=!1;for(const n in r?{[r]:t[r]}:t){const r=2===i?null:ye(t[n],e,i+1);!1!==r&&(s=s||Object.create(null),s[n]=r)}return s}class xe extends oe{constructor(t,e,i,r,s,n){super({objectMode:!0}),Object.assign(this,{n3Store:t,subject:e,predicate:i,object:r,graph:s,options:n})}get filtered(){if(!this._filtered){const{n3Store:t,graph:e,object:i,predicate:r,subject:s}=this,n=this._filtered=new me({factory:t._factory,entityIndex:this.options.entityIndex});let a,o,h;if(s&&!(a=n._termToNumericId(s))||r&&!(o=n._termToNumericId(r))||i&&!(h=n._termToNumericId(i)))return n;const u=t._getGraphs(e);for(const t in u){let e,i,r,s;(s=u[t])&&(!a&&o?(i=ye(s.predicates,[o,h,a]))&&(e=ye(s.subjects,[a,o,h]),r=ye(s.objects,[h,a,o])):h?(r=ye(s.objects,[h,a,o]))&&(e=ye(s.subjects,[a,o,h]),i=ye(s.predicates,[o,h,a])):(e=ye(s.subjects,[a,o,h]))&&(i=ye(s.predicates,[o,h,a]),r=ye(s.objects,[h,a,o])),e&&(n._graphs[t]={subjects:e,predicates:i,objects:r}))}n._size=null}return this._filtered}get size(){return this.filtered.size}_read(t){t>0&&!this[fe]&&(this[fe]=this[Symbol.iterator]());const e=this[fe];for(;--t>=0;){const{done:t,value:i}=e.next();if(t)return void this.push(null);this.push(i)}}addAll(t){return this.filtered.addAll(t)}contains(t){return this.filtered.contains(t)}deleteMatches(t,e,i,r){return this.filtered.deleteMatches(t,e,i,r)}difference(t){return this.filtered.difference(t)}equals(t){return this.filtered.equals(t)}every(t,e,i,r,s){return this.filtered.every(t,e,i,r,s)}filter(t){return this.filtered.filter(t)}forEach(t,e,i,r,s){return this.filtered.forEach(t,e,i,r,s)}import(t){return this.filtered.import(t)}intersection(t){return this.filtered.intersection(t)}map(t){return this.filtered.map(t)}some(t,e,i,r,s){return this.filtered.some(t,e,i,r,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(t){return this._filtered?this._filtered.union(t):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(t)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(t,e){return this.filtered.reduce(t,e)}toString(){return(new ne).quadsToString(this)}add(t){return this.filtered.add(t)}delete(t){return this.filtered.delete(t)}has(t){return this.filtered.has(t)}match(t,e,i,r){return new xe(this.filtered,t,e,i,r,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}function ve(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if("function"==typeof e){var i=function t(){var i=!1;try{i=this instanceof t}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach(function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})}),i}var we,Te,Ie={},Ee={},Re={},Ne={};function je(){return Te||(Te=1,t=Re,e=Re&&Re.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=Re&&Re.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i(function(){if(we)return Ne;function t(t){const e=[];let r=0;for(;r<t.length;)switch(t[r]){case"/":if("."===t[r+1])if("."===t[r+2]){if(!i(t[r+3])){e.push([]),r++;break}e.pop(),t[r+3]||e.push([]),r+=3}else{if(!i(t[r+2])){e.push([]),r++;break}t[r+2]||e.push([]),r+=2}else e.push([]),r++;break;case"#":case"?":e.length||e.push([]),e[e.length-1].push(t.substr(r)),r=t.length;break;default:e.length||e.push([]),e[e.length-1].push(t[r]),r++}return"/"+e.map(t=>t.join("")).join("/")}function e(e,i){let r=i+1;i>=0?"/"===e[i+1]&&"/"===e[i+2]&&(r=i+3):"/"===e[0]&&"/"===e[1]&&(r=2);const s=e.indexOf("/",r);return s<0?e:e.substr(0,s)+t(e.substr(s))}function i(t){return!t||"#"===t||"?"===t||"/"===t}return we=1,Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.removeDotSegmentsOfPath=Ne.removeDotSegments=Ne.resolve=void 0,Ne.resolve=function(i,r){const s=(r=r||"").indexOf("#");if(s>0&&(r=r.substr(0,s)),!i.length){if(r.indexOf(":")<0)throw new Error(`Found invalid baseIRI '${r}' for value '${i}'`);return r}if(i.startsWith("?")){const t=r.indexOf("?");return t>0&&(r=r.substr(0,t)),r+i}if(i.startsWith("#"))return r+i;if(!r.length){const t=i.indexOf(":");if(t<0)throw new Error(`Found invalid relative IRI '${i}' for a missing baseIRI`);return e(i,t)}const n=i.indexOf(":");if(n>=0){const t=i.indexOf("/");if(t<0||n<t)return e(i,n)}const a=r.indexOf(":");if(a<0)throw new Error(`Found invalid baseIRI '${r}' for value '${i}'`);const o=r.substr(0,a+1);if(0===i.indexOf("//"))return o+e(i,n);let h;if(r.indexOf("//",a)===a+1){if(h=r.indexOf("/",a+3),h<0)return r.length>a+3?r+"/"+e(i,n):o+e(i,n)}else if(h=r.indexOf("/",a+1),h<0)return o+e(i,n);if(0===i.indexOf("/"))return r.substr(0,h)+t(i);let u=r.substr(h);const l=u.lastIndexOf("/");return l>=0&&l<u.length-1&&(u=u.substr(0,l+1),"."===i[0]&&"."!==i[1]&&"/"!==i[1]&&i[2]&&(i=i.substr(1))),i=t(i=u+i),r.substr(0,h)+i},Ne.removeDotSegments=t,Ne.removeDotSegmentsOfPath=e,Ne}(),t)),Re;var t,e,i}var Se,Ce={},Pe={};function ke(){return Se||(Se=1,function(t){
2
2
  /**
3
3
  * Character classes and associated utilities for the 5th edition of XML 1.0.
4
4
  *
@@ -6,7 +6,7 @@ var jsonldUIUtils=function(t){"use strict";async function e(t){const e=new Map,i
6
6
  * @license MIT
7
7
  * @copyright Louis-Dominique Dubeau
8
8
  */
9
- Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR="\t\n\r -퟿-�𐀀-􏿿",t.S=" \t\r\n",t.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",t.NAME_CHAR="-"+t.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",t.CHAR_RE=new RegExp("^["+t.CHAR+"]$","u"),t.S_RE=new RegExp("^["+t.S+"]+$","u"),t.NAME_START_CHAR_RE=new RegExp("^["+t.NAME_START_CHAR+"]$","u"),t.NAME_CHAR_RE=new RegExp("^["+t.NAME_CHAR+"]$","u"),t.NAME_RE=new RegExp("^["+t.NAME_START_CHAR+"]["+t.NAME_CHAR+"]*$","u"),t.NMTOKEN_RE=new RegExp("^["+t.NAME_CHAR+"]+$","u");function e(t){return t>=65&&t<=90||t>=97&&t<=122||58===t||95===t||8204===t||8205===t||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=767||t>=880&&t<=893||t>=895&&t<=8191||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533||t>=65536&&t<=983039}t.S_LIST=[32,10,13,9],t.isChar=function(t){return t>=32&&t<=55295||10===t||13===t||9===t||t>=57344&&t<=65533||t>=65536&&t<=1114111},t.isS=function(t){return 32===t||10===t||13===t||9===t},t.isNameStartChar=e,t.isNameChar=function(t){return e(t)||t>=48&&t<=57||45===t||46===t||183===t||t>=768&&t<=879||t>=8255&&t<=8256}}(Ce)),Ce}var ke,Ae={};function $e(){return ke||(ke=1,function(t){
9
+ Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR="\t\n\r -퟿-�𐀀-􏿿",t.S=" \t\r\n",t.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",t.NAME_CHAR="-"+t.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",t.CHAR_RE=new RegExp("^["+t.CHAR+"]$","u"),t.S_RE=new RegExp("^["+t.S+"]+$","u"),t.NAME_START_CHAR_RE=new RegExp("^["+t.NAME_START_CHAR+"]$","u"),t.NAME_CHAR_RE=new RegExp("^["+t.NAME_CHAR+"]$","u"),t.NAME_RE=new RegExp("^["+t.NAME_START_CHAR+"]["+t.NAME_CHAR+"]*$","u"),t.NMTOKEN_RE=new RegExp("^["+t.NAME_CHAR+"]+$","u");function e(t){return t>=65&&t<=90||t>=97&&t<=122||58===t||95===t||8204===t||8205===t||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=767||t>=880&&t<=893||t>=895&&t<=8191||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533||t>=65536&&t<=983039}t.S_LIST=[32,10,13,9],t.isChar=function(t){return t>=32&&t<=55295||10===t||13===t||9===t||t>=57344&&t<=65533||t>=65536&&t<=1114111},t.isS=function(t){return 32===t||10===t||13===t||9===t},t.isNameStartChar=e,t.isNameChar=function(t){return e(t)||t>=48&&t<=57||45===t||46===t||183===t||t>=768&&t<=879||t>=8255&&t<=8256}}(Pe)),Pe}var Ae,$e={};function De(){return Ae||(Ae=1,function(t){
10
10
  /**
11
11
  * Character classes and associated utilities for the 2nd edition of XML 1.1.
12
12
  *
@@ -14,7 +14,7 @@ Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR="\t\n\r -퟿-�𐀀-
14
14
  * @license MIT
15
15
  * @copyright Louis-Dominique Dubeau
16
16
  */
17
- Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR="-퟿-�𐀀-􏿿",t.RESTRICTED_CHAR="-\b\v\f--„†-Ÿ",t.S=" \t\r\n",t.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",t.NAME_CHAR="-"+t.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",t.CHAR_RE=new RegExp("^["+t.CHAR+"]$","u"),t.RESTRICTED_CHAR_RE=new RegExp("^["+t.RESTRICTED_CHAR+"]$","u"),t.S_RE=new RegExp("^["+t.S+"]+$","u"),t.NAME_START_CHAR_RE=new RegExp("^["+t.NAME_START_CHAR+"]$","u"),t.NAME_CHAR_RE=new RegExp("^["+t.NAME_CHAR+"]$","u"),t.NAME_RE=new RegExp("^["+t.NAME_START_CHAR+"]["+t.NAME_CHAR+"]*$","u"),t.NMTOKEN_RE=new RegExp("^["+t.NAME_CHAR+"]+$","u");function e(t){return t>=65&&t<=90||t>=97&&t<=122||58===t||95===t||8204===t||8205===t||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=767||t>=880&&t<=893||t>=895&&t<=8191||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533||t>=65536&&t<=983039}t.S_LIST=[32,10,13,9],t.isChar=function(t){return t>=1&&t<=55295||t>=57344&&t<=65533||t>=65536&&t<=1114111},t.isRestrictedChar=function(t){return t>=1&&t<=8||11===t||12===t||t>=14&&t<=31||t>=127&&t<=132||t>=134&&t<=159},t.isCharAndNotRestricted=function(t){return 9===t||10===t||13===t||t>31&&t<127||133===t||t>159&&t<=55295||t>=57344&&t<=65533||t>=65536&&t<=1114111},t.isS=function(t){return 32===t||10===t||13===t||9===t},t.isNameStartChar=e,t.isNameChar=function(t){return e(t)||t>=48&&t<=57||45===t||46===t||183===t||t>=768&&t<=879||t>=8255&&t<=8256}}(Ae)),Ae}var De,Oe,Fe={};function Le(){if(Oe)return Se;Oe=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.SaxesParser=Se.EVENTS=void 0;const t=Pe(),e=$e(),i=(De||(De=1,function(t){function e(t){return t>=65&&t<=90||95===t||t>=97&&t<=122||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=767||t>=880&&t<=893||t>=895&&t<=8191||t>=8204&&t<=8205||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533||t>=65536&&t<=983039}
17
+ Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR="-퟿-�𐀀-􏿿",t.RESTRICTED_CHAR="-\b\v\f--„†-Ÿ",t.S=" \t\r\n",t.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",t.NAME_CHAR="-"+t.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",t.CHAR_RE=new RegExp("^["+t.CHAR+"]$","u"),t.RESTRICTED_CHAR_RE=new RegExp("^["+t.RESTRICTED_CHAR+"]$","u"),t.S_RE=new RegExp("^["+t.S+"]+$","u"),t.NAME_START_CHAR_RE=new RegExp("^["+t.NAME_START_CHAR+"]$","u"),t.NAME_CHAR_RE=new RegExp("^["+t.NAME_CHAR+"]$","u"),t.NAME_RE=new RegExp("^["+t.NAME_START_CHAR+"]["+t.NAME_CHAR+"]*$","u"),t.NMTOKEN_RE=new RegExp("^["+t.NAME_CHAR+"]+$","u");function e(t){return t>=65&&t<=90||t>=97&&t<=122||58===t||95===t||8204===t||8205===t||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=767||t>=880&&t<=893||t>=895&&t<=8191||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533||t>=65536&&t<=983039}t.S_LIST=[32,10,13,9],t.isChar=function(t){return t>=1&&t<=55295||t>=57344&&t<=65533||t>=65536&&t<=1114111},t.isRestrictedChar=function(t){return t>=1&&t<=8||11===t||12===t||t>=14&&t<=31||t>=127&&t<=132||t>=134&&t<=159},t.isCharAndNotRestricted=function(t){return 9===t||10===t||13===t||t>31&&t<127||133===t||t>159&&t<=55295||t>=57344&&t<=65533||t>=65536&&t<=1114111},t.isS=function(t){return 32===t||10===t||13===t||9===t},t.isNameStartChar=e,t.isNameChar=function(t){return e(t)||t>=48&&t<=57||45===t||46===t||183===t||t>=768&&t<=879||t>=8255&&t<=8256}}($e)),$e}var Oe,Fe,Le={};function Me(){if(Fe)return Ce;Fe=1,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.SaxesParser=Ce.EVENTS=void 0;const t=ke(),e=De(),i=(Oe||(Oe=1,function(t){function e(t){return t>=65&&t<=90||95===t||t>=97&&t<=122||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=767||t>=880&&t<=893||t>=895&&t<=8191||t>=8204&&t<=8205||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533||t>=65536&&t<=983039}
18
18
  /**
19
19
  * Character class utilities for XML NS 1.0 edition 3.
20
20
  *
@@ -22,5 +22,5 @@ Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR="-퟿-�𐀀-􏿿",
22
22
  * @license MIT
23
23
  * @copyright Louis-Dominique Dubeau
24
24
  */
25
- Object.defineProperty(t,"__esModule",{value:!0}),t.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",t.NC_NAME_CHAR="-"+t.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",t.NC_NAME_START_CHAR_RE=new RegExp("^["+t.NC_NAME_START_CHAR+"]$","u"),t.NC_NAME_CHAR_RE=new RegExp("^["+t.NC_NAME_CHAR+"]$","u"),t.NC_NAME_RE=new RegExp("^["+t.NC_NAME_START_CHAR+"]["+t.NC_NAME_CHAR+"]*$","u"),t.isNCNameStartChar=e,t.isNCNameChar=function(t){return e(t)||45===t||46===t||t>=48&&t<=57||183===t||t>=768&&t<=879||t>=8255&&t<=8256}}(Fe)),Fe);var r=t.isS,s=t.isChar,n=t.isNameStartChar,a=t.isNameChar,o=t.S_LIST,h=t.NAME_RE,u=e.isChar,l=i.isNCNameStartChar,c=i.isNCNameChar,d=i.NC_NAME_RE;const f="http://www.w3.org/XML/1998/namespace",p="http://www.w3.org/2000/xmlns/",_={__proto__:null,xml:f,xmlns:p},g={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},b=-1,m=-2,y=13,x=33,v=10,w=60,T=61,I=62,E=63,R=93,N=t=>34===t||39===t,j=[34,39],S=[...j,91,I],C=[...j,w,R],P=[T,E,...o],k=[...o,I,38,w];function A(t,e,i){switch(e){case"xml":i!==f&&t.fail(`xml prefix must be bound to ${f}.`);break;case"xmlns":i!==p&&t.fail(`xmlns prefix must be bound to ${p}.`)}switch(i){case p:t.fail(""===e?`the default namespace may not be set to ${i}.`:`may not assign a prefix (even "xmlns") to the URI ${p}.`);break;case f:switch(e){case"xml":break;case"":t.fail(`the default namespace may not be set to ${i}.`);break;default:t.fail("may not assign the xml namespace to another prefix.")}}}const $=t=>d.test(t),D=t=>h.test(t);Se.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];const O={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"};return Se.SaxesParser=class{get closed(){return this._closed}constructor(t){this.opt=null!=t?t:{},this.fragmentOpt=!!this.opt.fragment;const e=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=!1!==this.opt.position,this.fileName=this.opt.fileName,e){this.nameStartCheck=l,this.nameCheck=c,this.isName=$,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},_);const t=this.opt.additionalNamespaces;null!=t&&(!function(t,e){for(const i of Object.keys(e))A(t,i,e[i])}(this,t),Object.assign(this.ns,t))}else this.nameStartCheck=n,this.nameCheck=a,this.isName=D,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 t;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=0,this.attribList=[];const{fragmentOpt:e}=this;this.state=e?y:0,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=e,this.xmlDeclPossible=!e,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:i}=this.opt;if(void 0===i){if(!0===this.opt.forceXMLVersion)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");i="1.0"}this.setXMLVersion(i),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(g),null===(t=this.readyHandler)||void 0===t||t.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(t,e){this[O[t]]=e}off(t){this[O[t]]=void 0}makeError(t){var e;let i=null!==(e=this.fileName)&&void 0!==e?e:"";return this.trackPosition&&(i.length>0&&(i+=":"),i+=`${this.line}:${this.column}`),i.length>0&&(i+=": "),new Error(i+t)}fail(t){const e=this.makeError(t),i=this.errorHandler;if(void 0===i)throw e;return i(e),this}write(t){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let e=!1;null===t?(e=!0,t=""):"object"==typeof t&&(t=t.toString()),void 0!==this.carriedFromPrevious&&(t=`${this.carriedFromPrevious}${t}`,this.carriedFromPrevious=void 0);let i=t.length;const r=t.charCodeAt(i-1);!e&&(13===r||r>=55296&&r<=56319)&&(this.carriedFromPrevious=t[i-1],i--,t=t.slice(0,i));const{stateTable:s}=this;for(this.chunk=t,this.i=0;this.i<i;)s[this.state].call(this);return this.chunkPosition+=i,e?this.end():this}close(){return this.write(null)}getCode10(){const{chunk:t,i:e}=this;if(this.prevI=e,this.i=e+1,e>=t.length)return b;const i=t.charCodeAt(e);if(this.column++,i<55296){if(i>=32||9===i)return i;switch(i){case v:return this.line++,this.column=0,this.positionAtNewLine=this.position,v;case 13:return t.charCodeAt(e+1)===v&&(this.i=e+2),this.line++,this.column=0,this.positionAtNewLine=this.position,m;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;const r=65536+1024*(i-55296)+(t.charCodeAt(e+1)-56320);return this.i=e+2,r>1114111&&this.fail("disallowed character."),r}getCode11(){const{chunk:t,i:e}=this;if(this.prevI=e,this.i=e+1,e>=t.length)return b;const i=t.charCodeAt(e);if(this.column++,i<55296){if(i>31&&i<127||i>159&&8232!==i||9===i)return i;switch(i){case v:return this.line++,this.column=0,this.positionAtNewLine=this.position,v;case 13:{const i=t.charCodeAt(e+1);i!==v&&133!==i||(this.i=e+2)}case 133:case 8232:return this.line++,this.column=0,this.positionAtNewLine=this.position,m;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;const r=65536+1024*(i-55296)+(t.charCodeAt(e+1)-56320);return this.i=e+2,r>1114111&&this.fail("disallowed character."),r}getCodeNorm(){const t=this.getCode();return t===m?v:t}unget(){this.i=this.prevI,this.column--}captureTo(t){let{i:e}=this;const{chunk:i}=this;for(;;){const r=this.getCode(),s=r===m,n=s?v:r;if(n===b||t.includes(n))return this.text+=i.slice(e,this.prevI),n;s&&(this.text+=`${i.slice(e,this.prevI)}\n`,e=this.i)}}captureToChar(t){let{i:e}=this;const{chunk:i}=this;for(;;){let r=this.getCode();switch(r){case m:this.text+=`${i.slice(e,this.prevI)}\n`,e=this.i,r=v;break;case b:return this.text+=i.slice(e),!1}if(r===t)return this.text+=i.slice(e,this.prevI),!0}}captureNameChars(){const{chunk:t,i:e}=this;for(;;){const i=this.getCode();if(i===b)return this.name+=t.slice(e),b;if(!a(i))return this.name+=t.slice(e,this.prevI),i===m?v:i}}skipSpaces(){for(;;){const t=this.getCodeNorm();if(t===b||!r(t))return t}}setXMLVersion(t){this.currentXMLVersion=t,"1.0"===t?(this.isChar=s,this.getCode=this.getCode10):(this.isChar=u,this.getCode=this.getCode11)}sBegin(){65279===this.chunk.charCodeAt(0)&&(this.i++,this.column++),this.state=1}sBeginWhitespace(){const t=this.i,e=this.skipSpaces();switch(this.prevI!==t&&(this.xmlDeclPossible=!1),e){case w:if(this.state=15,0!==this.text.length)throw new Error("no-empty text at start");break;case b:break;default:this.unget(),this.state=y,this.xmlDeclPossible=!1}}sDoctype(){var t;const e=this.captureTo(S);switch(e){case I:null===(t=this.doctypeHandler)||void 0===t||t.call(this,this.text),this.text="",this.state=y,this.doctype=!0;break;case b:break;default:this.text+=String.fromCodePoint(e),91===e?this.state=4:N(e)&&(this.state=3,this.q=e)}}sDoctypeQuote(){const t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.q=null,this.state=2)}sDTD(){const t=this.captureTo(C);t!==b&&(this.text+=String.fromCodePoint(t),t===R?this.state=2:t===w?this.state=6:N(t)&&(this.state=5,this.q=t))}sDTDQuoted(){const t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.state=4,this.q=null)}sDTDOpenWaka(){const t=this.getCodeNorm();switch(this.text+=String.fromCodePoint(t),t){case 33:this.state=7,this.openWakaBang="";break;case E:this.state=11;break;default:this.state=4}}sDTDOpenWakaBang(){const t=String.fromCodePoint(this.getCodeNorm()),e=this.openWakaBang+=t;this.text+=t,"-"!==e&&(this.state="--"===e?8:4,this.openWakaBang="")}sDTDComment(){this.captureToChar(45)&&(this.text+="-",this.state=9)}sDTDCommentEnding(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),this.state=45===t?10:8}sDTDCommentEnded(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===I?this.state=4:(this.fail("malformed comment."),this.state=8)}sDTDPI(){this.captureToChar(E)&&(this.text+="?",this.state=12)}sDTDPIEnding(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===I&&(this.state=4)}sText(){0!==this.tags.length?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:t}=this;const{chunk:e}=this;t:for(;;)switch(this.getCode()){case m:this.entity+=`${e.slice(t,this.prevI)}\n`,t=this.i;break;case 59:{const{entityReturnState:i}=this,r=this.entity+e.slice(t,this.prevI);let s;this.state=i,""===r?(this.fail("empty entity name."),s="&;"):(s=this.parseEntity(r),this.entity=""),i===y&&void 0===this.textHandler||(this.text+=s);break t}case b:this.entity+=e.slice(t);break t}}sOpenWaka(){const t=this.getCode();if(n(t))this.state=34,this.unget(),this.xmlDeclPossible=!1;else switch(t){case 47:this.state=43,this.xmlDeclPossible=!1;break;case 33:this.state=16,this.openWakaBang="",this.xmlDeclPossible=!1;break;case E:this.state=23;break;default:this.fail("disallowed character in tag name"),this.state=y,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=20,this.openWakaBang="";break;case"--":this.state=17,this.openWakaBang="";break;case"DOCTYPE":this.state=2,(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(45)&&(this.state=18)}sCommentEnding(){var t;const e=this.getCodeNorm();45===e?(this.state=19,null===(t=this.commentHandler)||void 0===t||t.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(e)}`,this.state=17)}sCommentEnded(){const t=this.getCodeNorm();t!==I?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(t)}`,this.state=17):this.state=y}sCData(){this.captureToChar(R)&&(this.state=21)}sCDataEnding(){const t=this.getCodeNorm();t===R?this.state=22:(this.text+=`]${String.fromCodePoint(t)}`,this.state=20)}sCDataEnding2(){var t;const e=this.getCodeNorm();switch(e){case I:null===(t=this.cdataHandler)||void 0===t||t.call(this,this.text),this.text="",this.state=y;break;case R:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(e)}`,this.state=20}}sPIFirstChar(){const t=this.getCodeNorm();this.nameStartCheck(t)?(this.piTarget+=String.fromCodePoint(t),this.state=24):t===E||r(t)?(this.fail("processing instruction without a target."),this.state=t===E?26:25):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(t),this.state=24)}sPIRest(){const{chunk:t,i:e}=this;for(;;){const i=this.getCodeNorm();if(i===b)return void(this.piTarget+=t.slice(e));if(!this.nameCheck(i)){this.piTarget+=t.slice(e,this.prevI);const s=i===E;s||r(i)?"xml"===this.piTarget?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=s?x:27):this.state=s?26:25:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(i));break}}}sPIBody(){if(0===this.text.length){const t=this.getCodeNorm();t===E?this.state=26:r(t)||(this.text=String.fromCodePoint(t))}else this.captureToChar(E)&&(this.state=26)}sPIEnding(){var t;const e=this.getCodeNorm();if(e===I){const{piTarget:e}=this;"xml"===e.toLowerCase()&&this.fail("the XML declaration must appear at the start of the document."),null===(t=this.piHandler)||void 0===t||t.call(this,{target:e,body:this.text}),this.piTarget=this.text="",this.state=y}else e===E?this.text+="?":(this.text+=`?${String.fromCodePoint(e)}`,this.state=25);this.xmlDeclPossible=!1}sXMLDeclNameStart(){const t=this.skipSpaces();t!==E?t!==b&&(this.state=28,this.name=String.fromCodePoint(t)):this.state=x}sXMLDeclName(){const t=this.captureTo(P);if(t===E)return this.state=x,this.name+=this.text,this.text="",void this.fail("XML declaration is incomplete.");if(r(t)||t===T){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=t===T?30:29}}sXMLDeclEq(){const t=this.getCodeNorm();if(t===E)return this.state=x,void this.fail("XML declaration is incomplete.");r(t)||(t!==T&&this.fail("value required."),this.state=30)}sXMLDeclValueStart(){const t=this.getCodeNorm();if(t===E)return this.state=x,void this.fail("XML declaration is incomplete.");r(t)||(N(t)?this.q=t:(this.fail("value must be quoted."),this.q=32),this.state=31)}sXMLDeclValue(){const t=this.captureTo([this.q,E]);if(t===E)return this.state=x,this.text="",void this.fail("XML declaration is incomplete.");if(t===b)return;const e=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];const t=e;this.xmlDecl.version=t,/^1\.[0-9]+$/.test(t)?this.opt.forceXMLVersion||this.setXMLVersion(t):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(e)||this.fail("encoding value must match \t/^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=e;break;case"standalone":"yes"!==e&&"no"!==e&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=e}this.name="",this.state=32}sXMLDeclSeparator(){const t=this.getCodeNorm();t!==E?(r(t)||(this.fail("whitespace required."),this.unget()),this.state=27):this.state=x}sXMLDeclEnding(){var t;this.getCodeNorm()===I?("xml"!==this.piTarget?this.fail("processing instructions are not allowed before root."):"version"!==this.name&&this.xmlDeclExpects.includes("version")&&this.fail("XML declaration must contain a version."),null===(t=this.xmldeclHandler)||void 0===t||t.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=y):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var t;const e=this.captureNameChars();if(e===b)return;const i=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=i.ns=Object.create(null)),null===(t=this.openTagStartHandler)||void 0===t||t.call(this,i),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),e){case I:this.openTag();break;case 47:this.state=35;break;default:r(e)||this.fail("disallowed character in tag name."),this.state=36}}sOpenTagSlash(){this.getCode()===I?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=36)}sAttrib(){const t=this.skipSpaces();t!==b&&(n(t)?(this.unget(),this.state=37):t===I?this.openTag():47===t?this.state=35:this.fail("disallowed character in attribute name."))}sAttribName(){const t=this.captureNameChars();t===T?this.state=39:r(t)?this.state=38:t===I?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):t!==b&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){const t=this.skipSpaces();switch(t){case b:return;case T:this.state=39;break;default:this.fail("attribute without value."),this.text="",this.name="",t===I?this.openTag():n(t)?(this.unget(),this.state=37):(this.fail("disallowed character in attribute name."),this.state=36)}}sAttribValue(){const t=this.getCodeNorm();N(t)?(this.q=t,this.state=40):r(t)||(this.fail("unquoted attribute value."),this.state=42,this.unget())}sAttribValueQuoted(){const{q:t,chunk:e}=this;let{i:i}=this;for(;;)switch(this.getCode()){case t:return this.pushAttrib(this.name,this.text+e.slice(i,this.prevI)),this.name=this.text="",this.q=null,void(this.state=41);case 38:return this.text+=e.slice(i,this.prevI),this.state=14,void(this.entityReturnState=40);case v:case m:case 9:this.text+=`${e.slice(i,this.prevI)} `,i=this.i;break;case w:return this.text+=e.slice(i,this.prevI),void this.fail("disallowed character.");case b:return void(this.text+=e.slice(i))}}sAttribValueClosed(){const t=this.getCodeNorm();r(t)?this.state=36:t===I?this.openTag():47===t?this.state=35:n(t)?(this.fail("no whitespace between attributes."),this.unget(),this.state=37):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){const t=this.captureTo(k);switch(t){case 38:this.state=14,this.entityReturnState=42;break;case w:this.fail("disallowed character.");break;case b:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",t===I?this.openTag():this.state=36}}sCloseTag(){const t=this.captureNameChars();t===I?this.closeTag():r(t)?this.state=44:t!==b&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case I:this.closeTag();break;case b:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:t,forbiddenState:e}=this;const{chunk:i,textHandler:r}=this;t:for(;;)switch(this.getCode()){case w:if(this.state=15,void 0!==r){const{text:e}=this,s=i.slice(t,this.prevI);0!==e.length?(r(e+s),this.text=""):0!==s.length&&r(s)}e=0;break t;case 38:this.state=14,this.entityReturnState=y,void 0!==r&&(this.text+=i.slice(t,this.prevI)),e=0;break t;case R:switch(e){case 0:e=1;break;case 1:e=2;break;case 2:break;default:throw new Error("impossible state")}break;case I:2===e&&this.fail('the string "]]>" is disallowed in char data.'),e=0;break;case m:void 0!==r&&(this.text+=`${i.slice(t,this.prevI)}\n`),t=this.i,e=0;break;case b:void 0!==r&&(this.text+=i.slice(t));break t;default:e=0}this.forbiddenState=e}handleTextOutsideRoot(){let{i:t}=this;const{chunk:e,textHandler:i}=this;let s=!1;t:for(;;){const n=this.getCode();switch(n){case w:if(this.state=15,void 0!==i){const{text:r}=this,s=e.slice(t,this.prevI);0!==r.length?(i(r+s),this.text=""):0!==s.length&&i(s)}break t;case 38:this.state=14,this.entityReturnState=y,void 0!==i&&(this.text+=e.slice(t,this.prevI)),s=!0;break t;case m:void 0!==i&&(this.text+=`${e.slice(t,this.prevI)}\n`),t=this.i;break;case b:void 0!==i&&(this.text+=e.slice(t));break t;default:r(n)||(s=!0)}}s&&(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(t,e){var i;const{prefix:r,local:s}=this.qname(t),n={name:t,prefix:r,local:s,value:e};if(this.attribList.push(n),null===(i=this.attributeHandler)||void 0===i||i.call(this,n),"xmlns"===r){const t=e.trim();"1.0"===this.currentXMLVersion&&""===t&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[s]=t,A(this,s,t)}else if("xmlns"===t){const t=e.trim();this.topNS[""]=t,A(this,"",t)}}pushAttribPlain(t,e){var i;const r={name:t,value:e};this.attribList.push(r),null===(i=this.attributeHandler)||void 0===i||i.call(this,r)}end(){var t,e;this.sawRoot||this.fail("document must contain a root element.");const{tags:i}=this;for(;i.length>0;){const t=i.pop();this.fail(`unclosed tag: ${t.name}`)}0!==this.state&&this.state!==y&&this.fail("unexpected end.");const{text:r}=this;return 0!==r.length&&(null===(t=this.textHandler)||void 0===t||t.call(this,r),this.text=""),this._closed=!0,null===(e=this.endHandler)||void 0===e||e.call(this),this._init(),this}resolve(t){var e,i;let r=this.topNS[t];if(void 0!==r)return r;const{tags:s}=this;for(let e=s.length-1;e>=0;e--)if(r=s[e].ns[t],void 0!==r)return r;return r=this.ns[t],void 0!==r?r:null===(i=(e=this.opt).resolvePrefix)||void 0===i?void 0:i.call(e,t)}qname(t){const e=t.indexOf(":");if(-1===e)return{prefix:"",local:t};const i=t.slice(e+1),r=t.slice(0,e);return(""===r||""===i||i.includes(":"))&&this.fail(`malformed name: ${t}.`),{prefix:r,local:i}}processAttribsNS(){var t;const{attribList:e}=this,i=this.tag;{const{prefix:e,local:r}=this.qname(i.name);i.prefix=e,i.local=r;const s=i.uri=null!==(t=this.resolve(e))&&void 0!==t?t:"";""!==e&&("xmlns"===e&&this.fail('tags may not have "xmlns" as prefix.'),""===s&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),i.uri=e))}if(0===e.length)return;const{attributes:r}=i,s=new Set;for(const t of e){const{name:e,prefix:i,local:n}=t;let a,o;""===i?(a="xmlns"===e?p:"",o=e):(a=this.resolve(i),void 0===a&&(this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`),a=i),o=`{${a}}${n}`),s.has(o)&&this.fail(`duplicate attribute: ${o}.`),s.add(o),t.uri=a,r[e]=t}this.attribList=[]}processAttribsPlain(){const{attribList:t}=this,e=this.tag.attributes;for(const{name:i,value:r}of t)void 0!==e[i]&&this.fail(`duplicate attribute: ${i}.`),e[i]=r;this.attribList=[]}openTag(){var t;this.processAttribs();const{tags:e}=this,i=this.tag;i.isSelfClosing=!1,null===(t=this.openTagHandler)||void 0===t||t.call(this,i),e.push(i),this.state=y,this.name=""}openSelfClosingTag(){var t,e,i;this.processAttribs();const{tags:r}=this,s=this.tag;s.isSelfClosing=!0,null===(t=this.openTagHandler)||void 0===t||t.call(this,s),null===(e=this.closeTagHandler)||void 0===e||e.call(this,s);null===(this.tag=null!==(i=r[r.length-1])&&void 0!==i?i:null)&&(this.closedRoot=!0),this.state=y,this.name=""}closeTag(){const{tags:t,name:e}=this;if(this.state=y,this.name="",""===e)return this.fail("weird empty close tag."),void(this.text+="</>");const i=this.closeTagHandler;let r=t.length;for(;r-- >0;){const r=this.tag=t.pop();if(this.topNS=r.ns,null==i||i(r),r.name===e)break;this.fail("unexpected close tag.")}0===r?this.closedRoot=!0:r<0&&(this.fail(`unmatched closing tag: ${e}.`),this.text+=`</${e}>`)}parseEntity(t){if("#"!==t[0]){const e=this.ENTITIES[t];return void 0!==e?e:(this.fail(this.isName(t)?"undefined entity.":"disallowed character in entity name."),`&${t};`)}let e=NaN;return"x"===t[1]&&/^#x[0-9a-f]+$/i.test(t)?e=parseInt(t.slice(2),16):/^#[0-9]+$/.test(t)&&(e=parseInt(t.slice(1),10)),this.isChar(e)?String.fromCodePoint(e):(this.fail("malformed character entity."),`&${t};`)}},Se}var Me,Be=xe(ce),qe={};function Ue(){if(Me)return qe;Me=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.ParseError=void 0;let t=class extends Error{constructor(t,e){const i=t.saxParser;super(t.trackPosition?`Line ${i.line} column ${i.column+1}: ${e}`:e)}};return qe.ParseError=t,qe}var Qe,He={},Ge={};function ze(){if(Qe)return Ge;Qe=1,Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.BlankNode=void 0;return Ge.BlankNode=class{constructor(t){this.termType="BlankNode",this.value=t}equals(t){return!!t&&"BlankNode"===t.termType&&t.value===this.value}},Ge}var Ye,Ve={},Xe={};function We(){if(Ye)return Xe;Ye=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.DefaultGraph=void 0;let t=class{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&"DefaultGraph"===t.termType}};return Xe.DefaultGraph=t,t.INSTANCE=new t,Xe}var Ze,Ke,Je={},ti={};function ei(){if(Ze)return ti;Ze=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.NamedNode=void 0;return ti.NamedNode=class{constructor(t){this.termType="NamedNode",this.value=t}equals(t){return!!t&&"NamedNode"===t.termType&&t.value===this.value}},ti}function ii(){if(Ke)return Je;Ke=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.Literal=void 0;const t=ei();let e=class t{constructor(e,i){this.termType="Literal",this.value=e,"string"==typeof i?(this.language=i,this.datatype=t.RDF_LANGUAGE_STRING):i?(this.language="",this.datatype=i):(this.language="",this.datatype=t.XSD_STRING)}equals(t){return!!t&&"Literal"===t.termType&&t.value===this.value&&t.language===this.language&&this.datatype.equals(t.datatype)}};return Je.Literal=e,e.RDF_LANGUAGE_STRING=new t.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),e.XSD_STRING=new t.NamedNode("http://www.w3.org/2001/XMLSchema#string"),Je}var ri,si={};function ni(){if(ri)return si;ri=1,Object.defineProperty(si,"__esModule",{value:!0}),si.Quad=void 0;return si.Quad=class{constructor(t,e,i,r){this.termType="Quad",this.value="",this.subject=t,this.predicate=e,this.object=i,this.graph=r}equals(t){return!!t&&("Quad"===t.termType||!t.termType)&&this.subject.equals(t.subject)&&this.predicate.equals(t.predicate)&&this.object.equals(t.object)&&this.graph.equals(t.graph)}},si}var ai,oi,hi,ui={};function li(){if(ai)return ui;ai=1,Object.defineProperty(ui,"__esModule",{value:!0}),ui.Variable=void 0;return ui.Variable=class{constructor(t){this.termType="Variable",this.value=t}equals(t){return!!t&&"Variable"===t.termType&&t.value===this.value}},ui}function ci(){return hi||(hi=1,t=He,e=He&&He.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=He&&He.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i(ze(),t),i(function(){if(oi)return Ve;oi=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.DataFactory=void 0;const t=ze(),e=We(),i=ii(),r=ei(),s=ni(),n=li();let a=0;return Ve.DataFactory=class{constructor(t){this.blankNodeCounter=0,t=t||{},this.blankNodePrefix=t.blankNodePrefix||`df_${a++}_`}namedNode(t){return new r.NamedNode(t)}blankNode(e){return new t.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(t,e){return new i.Literal(t,e)}variable(t){return new n.Variable(t)}defaultGraph(){return e.DefaultGraph.INSTANCE}quad(t,e,i,r){return new s.Quad(t,e,i,r||this.defaultGraph())}fromTerm(t){switch(t.termType){case"NamedNode":return this.namedNode(t.value);case"BlankNode":return this.blankNode(t.value);case"Literal":return t.language?this.literal(t.value,t.language):t.datatype.equals(i.Literal.XSD_STRING)?this.literal(t.value):this.literal(t.value,this.fromTerm(t.datatype));case"Variable":return this.variable(t.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(t.subject),this.fromTerm(t.predicate),this.fromTerm(t.object),this.fromTerm(t.graph))}}fromQuad(t){return this.fromTerm(t)}resetBlankNodeCounter(){this.blankNodeCounter=0}},Ve}(),t),i(We(),t),i(ii(),t),i(ei(),t),i(ni(),t),i(li(),t)),He;var t,e,i}var di,fi,pi,_i,gi={},bi={};function mi(){return fi||(fi=1,t=gi,e=gi&&gi.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=gi&&gi.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i((di||(di=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateIri=t.IriValidationStrategy=void 0;const e=function(){const t="[!$&'()*+,;=]",e="%[a-fA-F0-9]{2}",i="([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",r=`${i}\\.${i}\\.${i}\\.${i}`,s="[a-fA-F0-9]{1,4}",n=`(${s}:${s}|${r})`,a="[a-zA-Z0-9\\-._~ -퟿豈-﷏ﷰ-￯𐀀-🿽𠀀-𯿽𰀀-𿿽񀀀-񏿽񐀀-񟿽񠀀-񯿽񰀀-񿿽򀀀-򏿽򐀀-򟿽򠀀-򯿽򰀀-򿿽󀀀-󏿽󐀀-󟿽󡀀-󯿽]",o=`(${a}|${e}|${t}|[:@])*`,h=`(${o})+`,u=`(${o})*`;return new RegExp(`^[a-zA-Z][a-zA-Z0-9+\\-.]*:(\\/\\/((${a}|${e}|${t}|:)*@)?(\\[(((${s}:){6}${n}|::(${s}:){5}${n}|(${s})?::(${s}:){4}${n}|((${s}:){0,1}${s})?::(${s}:){3}${n}|((${s}:){0,2}${s})?::(${s}:){2}${n}|((${s}:){0,3}${s})?::${s}:${n}|((${s}:){0,4}${s})?::${n}|((${s}:){0,5}${s})?::${s}|((${s}:){0,6}${s})?::)|v[a-fA-F0-9]+\\.(${t}|${t}|":)+)\\]|${r}|(${a}|${e}|${t})*)(:[0-9]*)?(\\/${u})*|\\/(${h}(\\/${u})*)?|${h}(\\/${u})*|)(\\?(${o}|[-󰀀-󿿽􀀀-􏿽]|[\\/?])*)?(#(${o}|[\\/?])*)?$`,"u")}(),i=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u;var r;!function(t){t.Strict="strict",t.Pragmatic="pragmatic",t.None="none"}(r=t.IriValidationStrategy||(t.IriValidationStrategy={})),t.validateIri=function(t,s=r.Strict){switch(s){case r.Strict:return e.test(t)?void 0:new Error(`Invalid IRI according to RFC 3987: '${t}'`);case r.Pragmatic:return i.test(t)?void 0:new Error(`Invalid IRI according to RDF Turtle: '${t}'`);case r.None:return;default:return new Error(`Not supported validation strategy "${s}"`)}}}(bi)),bi),t)),gi;var t,e,i}function yi(){if(pi)return Ie;pi=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.ParseType=Ie.RdfXmlParser=void 0;const t=Ne(),e=Le(),i=Be,r=Ue(),s=ci(),n=mi();let a=class a extends i.Transform{constructor(t){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},t&&(Object.assign(this,t),this.options=t),this.dataFactory||(this.dataFactory=new s.DataFactory),this.baseIRI||(this.baseIRI=""),this.defaultGraph||(this.defaultGraph=this.dataFactory.defaultGraph()),!1!==this.validateUri&&(this.validateUri=!0),this.iriValidationStrategy||(this.iriValidationStrategy=this.validateUri?n.IriValidationStrategy.Pragmatic:n.IriValidationStrategy.None),this.saxParser=new e.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(t){const e=new i.PassThrough({readableObjectMode:!0});t.on("error",t=>r.emit("error",t)),t.on("data",t=>e.push(t)),t.on("end",()=>e.push(null));const r=e.pipe(new a(this.options));return r}_transform(t,e,i){try{this.saxParser.write(t)}catch(t){return i(t)}i()}newParseError(t){return new r.ParseError(this,t)}valueToUri(e,i){return this.uriToNamedNode((0,t.resolve)(e,i.baseIRI))}uriToNamedNode(t){const e=(0,n.validateIri)(t,this.iriValidationStrategy);if(e instanceof Error)throw this.newParseError(e.message);return this.dataFactory.namedNode(t)}validateNcname(t){if(!a.NCNAME_MATCHER.test(t))throw this.newParseError(`Not a valid NCName: ${t}`)}attachSaxListeners(){this.saxParser.on("error",t=>this.emit("error",t)),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(t){const e=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;let i=o.RESOURCE;if(e&&(e.hadChildren=!0,i=e.childrenParseType),e&&e.childrenStringTags){const i=t.name;let r="";for(const e in t.attributes)r+=` ${e}="${t.attributes[e].value}"`;const s=`<${`${i}${r}`}>`;e.childrenStringTags.push(s);const n={childrenStringTags:e.childrenStringTags};return n.childrenStringEmitClosingTag=`</${i}>`,void this.activeTagStack.push(n)}const r={};e?(r.language=e.language,r.baseIRI=e.baseIRI):r.baseIRI=this.baseIRI,this.activeTagStack.push(r),i===o.RESOURCE?this.onTagResource(t,r,e,!e):this.onTagProperty(t,r,e)}onTagResource(e,i,r,s){i.childrenParseType=o.PROPERTY;let n=!0;if(e.uri===a.RDF){if(!s&&a.FORBIDDEN_NODE_ELEMENTS.indexOf(e.local)>=0)throw this.newParseError(`Illegal node element name: ${e.local}`);switch(e.local){case"RDF":i.childrenParseType=o.RESOURCE;case"Description":n=!1}}const h=[],u=[];let l=null,c=!1,d=!1,f=null;for(const s in e.attributes){const n=e.attributes[s];if(r&&n.uri===a.RDF)switch(n.local){case"about":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);l=n.value;continue;case"ID":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);this.validateNcname(n.value),l="#"+n.value,c=!0;continue;case"nodeID":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);this.validateNcname(n.value),l=n.value,d=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"type":f=n.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(n.uri===a.XML){if("lang"===n.local){i.language=""===n.value?null:n.value.toLowerCase();continue}if("base"===n.local){i.baseIRI=(0,t.resolve)(n.value,i.baseIRI);continue}}"xml"===n.prefix||"xmlns"===n.prefix||""===n.prefix&&"xmlns"===n.local||!n.uri||(h.push(this.uriToNamedNode(n.uri+n.local)),u.push(n.value))}if(null!==l&&(i.subject=d?this.dataFactory.blankNode(l):this.valueToUri(l,i),c&&this.claimNodeId(i.subject)),i.subject||(i.subject=this.dataFactory.blankNode()),n){const t=this.uriToNamedNode(e.uri+e.local);this.emitTriple(i.subject,this.dataFactory.namedNode(a.RDF+"type"),t,r?r.reifiedStatementId:null)}if(r){if(r.predicate)if(r.childrenCollectionSubject){const t=this.dataFactory.blankNode();this.emitTriple(r.childrenCollectionSubject,r.childrenCollectionPredicate,t,r.reifiedStatementId),this.emitTriple(t,this.dataFactory.namedNode(a.RDF+"first"),i.subject,i.reifiedStatementId),r.childrenCollectionSubject=t,r.childrenCollectionPredicate=this.dataFactory.namedNode(a.RDF+"rest")}else{this.emitTriple(r.subject,r.predicate,i.subject,r.reifiedStatementId);for(let t=0;t<r.predicateSubPredicates.length;t++)this.emitTriple(i.subject,r.predicateSubPredicates[t],r.predicateSubObjects[t],null);r.predicateSubPredicates=[],r.predicateSubObjects=[],r.predicateEmitted=!0}for(let t=0;t<h.length;t++){const e=this.dataFactory.literal(u[t],i.datatype||i.language);this.emitTriple(i.subject,h[t],e,r.reifiedStatementId)}f&&this.emitTriple(i.subject,this.dataFactory.namedNode(a.RDF+"type"),this.uriToNamedNode(f),null)}}onTagProperty(t,e,i){if(e.childrenParseType=o.RESOURCE,e.subject=i.subject,t.uri===a.RDF&&"li"===t.local?(i.listItemCounter||(i.listItemCounter=1),e.predicate=this.uriToNamedNode(t.uri+"_"+i.listItemCounter++)):e.predicate=this.uriToNamedNode(t.uri+t.local),t.uri===a.RDF&&a.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(t.local)>=0)throw this.newParseError(`Illegal property element name: ${t.local}`);e.predicateSubPredicates=[],e.predicateSubObjects=[];let r=!1,s=!1,n=null,h=!0;const u=[],l=[];for(const i in t.attributes){const c=t.attributes[i];if(c.uri===a.RDF)switch(c.local){case"resource":if(n)throw this.newParseError(`Found both rdf:resource (${c.value}) and rdf:nodeID (${n}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${c.value})`);e.hadChildren=!0,n=c.value,h=!1;continue;case"datatype":if(s)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${c.value}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${c.value})`);e.datatype=this.valueToUri(c.value,e);continue;case"nodeID":if(s)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${c.value}).`);if(e.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${c.value}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${c.value})`);this.validateNcname(c.value),e.hadChildren=!0,n=c.value,h=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"parseType":if(s)throw this.newParseError("rdf:parseType is not allowed when non-rdf:* property attributes are present");if(e.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${e.datatype.value})`);if(n)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${n})`);if("Resource"===c.value){r=!0,e.childrenParseType=o.PROPERTY;const t=this.dataFactory.blankNode();this.emitTriple(e.subject,e.predicate,t,e.reifiedStatementId),e.subject=t,e.predicate=null}else"Collection"===c.value?(r=!0,e.hadChildren=!0,e.childrenCollectionSubject=e.subject,e.childrenCollectionPredicate=e.predicate,h=!1):"Literal"===c.value&&(r=!0,e.childrenTagsToString=!0,e.childrenStringTags=[]);continue;case"ID":this.validateNcname(c.value),e.reifiedStatementId=this.valueToUri("#"+c.value,e),this.claimNodeId(e.reifiedStatementId);continue}else if(c.uri===a.XML&&"lang"===c.local){e.language=""===c.value?null:c.value.toLowerCase();continue}if("xml"!==c.prefix&&"xmlns"!==c.prefix&&(""!==c.prefix||"xmlns"!==c.local)&&c.uri){if(r||e.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${c.value}`);e.hadChildren=!0,s=!0,u.push(this.uriToNamedNode(c.uri+c.local)),l.push(this.dataFactory.literal(c.value,e.datatype||e.language))}}if(null!==n){const t=e.subject;e.subject=h?this.dataFactory.blankNode(n):this.valueToUri(n,e),this.emitTriple(t,e.predicate,e.subject,e.reifiedStatementId);for(let t=0;t<u.length;t++)this.emitTriple(e.subject,u[t],l[t],null);e.predicateEmitted=!0}else h&&(e.predicateSubPredicates=u,e.predicateSubObjects=l,e.predicateEmitted=!1)}emitTriple(t,e,i,r){this.push(this.dataFactory.quad(t,e,i,this.defaultGraph)),r&&(this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"type"),this.dataFactory.namedNode(a.RDF+"Statement"),this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"subject"),t,this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"predicate"),e,this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"object"),i,this.defaultGraph)))}claimNodeId(t){if(!this.allowDuplicateRdfIds){if(this.nodeIds[t.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${t.value}'.`);this.nodeIds[t.value]=!0}}onText(t){const e=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;e&&(e.childrenStringTags?e.childrenStringTags.push(t):e.predicate&&(e.text=t))}onCloseTag(){const t=this.activeTagStack.pop();if(t.childrenStringEmitClosingTag&&t.childrenStringTags.push(t.childrenStringEmitClosingTag),t.childrenTagsToString&&(t.datatype=this.dataFactory.namedNode(a.RDF+"XMLLiteral"),t.text=t.childrenStringTags.join(""),t.hadChildren=!1),t.childrenCollectionSubject)this.emitTriple(t.childrenCollectionSubject,t.childrenCollectionPredicate,this.dataFactory.namedNode(a.RDF+"nil"),t.reifiedStatementId);else if(t.predicate)if(t.hadChildren||t.childrenParseType===o.PROPERTY){if(!t.predicateEmitted){const e=this.dataFactory.blankNode();this.emitTriple(t.subject,t.predicate,e,t.reifiedStatementId);for(let i=0;i<t.predicateSubPredicates.length;i++)this.emitTriple(e,t.predicateSubPredicates[i],t.predicateSubObjects[i],null)}}else this.emitTriple(t.subject,t.predicate,this.dataFactory.literal(t.text||"",t.datatype||t.language),t.reifiedStatementId)}onDoctype(t){t.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(t,e,i)=>(this.saxParser.ENTITIES[e]=i,""))}};var o;return Ie.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.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,function(t){t[t.RESOURCE=0]="RESOURCE",t[t.PROPERTY=1]="PROPERTY"}(o||(Ie.ParseType=o={})),Ie}function xi(){return _i||(_i=1,t=Te,e=Te&&Te.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=Te&&Te.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i(yi(),t)),Te;var t,e,i}var vi=xi();const wi={labelPredicates:l,descriptionPredicates:c},Ti={},Ii={},Ei=new Set(["text/turtle","text/n3","application/n-triples","application/n-quads","application/trig","text/anot+turtle"]),Ri=["text/turtle","application/n-triples","application/n-quads","application/trig","application/ld+json","application/rdf+xml"].join(", ");function Ni(t,e,i,r=function(){var t;if("undefined"!=typeof navigator&&(null===(t=navigator.languages)||void 0===t?void 0:t.length))return Array.from(navigator.languages);try{return[Intl.DateTimeFormat().resolvedOptions().locale]}catch(t){return[]}}()){const s=Rt.namedNode(e);for(const e of i){const i=t.getQuads(s,Rt.namedNode(e),null,null).filter(t=>"Literal"===t.object.termType);if(!i.length)continue;for(const t of r){const e=t.split("-")[0].toLowerCase(),r=i.find(i=>{var r;const s=null===(r=i.object.language)||void 0===r?void 0:r.toLowerCase();return s===t.toLowerCase()||(null==s?void 0:s.split("-")[0])===e});if(r)return r.object.value}const n=i.find(t=>!t.object.language);if(n)return n.object.value;const a=i.find(t=>{var e;return"en"===(null===(e=t.object.language)||void 0===e?void 0:e.toLowerCase())});return(null!=a?a:i[0]).object.value}return null}function ji(t,e,i){const r=new be,s=new Qt({baseIRI:e,format:"text/anot+turtle"===i?"text/turtle":i});return new Promise((e,i)=>{s.parse(t,(t,s)=>{if(t)return i(t);s?r.addQuad(s):e(r)})})}const Si=t=>t?Array.isArray(t)?t:[t]:[],Ci=t=>`DESCRIBE <${t}>`,Pi=async(t,e)=>{var i;let r;try{if(r=await t(),!r.ok)return null}catch(t){return null}const s=(null===(i=r.headers.get("content-type"))||void 0===i?void 0:i.split(";")[0].trim())||"text/turtle",n=await r.text();try{if(Ei.has(s))return ji(n,e,s);if("application/ld+json"===s)return async function(t,e){const i=await Promise.resolve().then(function(){return Ui});if(!i)throw new Error("jsonld peer dependency is not available");const r=JSON.parse(t);return ji(await i.toRDF(r,{format:"application/n-quads",base:e}),e,"application/n-quads")}(n,e);if("application/rdf+xml"===s)return async function(t,e){const i=new be;return new Promise((r,s)=>{const n=new vi.RdfXmlParser({baseIRI:e});n.on("data",t=>i.addQuad(t)),n.on("error",s),n.on("end",()=>r(i)),n.write(t),n.end()})}(n,e)}catch(t){}return null},ki=(t,e)=>(t in Ii||(Ii[t]=Pi(e,t)),Ii[t]),Ai=async(t,e,i)=>{const r=await t;if(!r)return null;const s=Ni(r,e,i.labelPredicates);return s?{uri:e,label:s,description:Ni(r,e,i.descriptionPredicates)}:null};async function $i(t,e={}){const i={...wi,...e};return t in Ti||(Ti[t]=(async(t,e)=>{const i=t.includes("#")?t.split("#")[0]:t;let r=await Ai(ki(i,()=>fetch(i,{headers:{Accept:Ri}})),t,e);const s=t.includes("#");for(const i of[...Si(e.fallbackRainbowInstances),...Si(e.fallbackRainbowInstance)]){if(r||s)break;const n=new URL(i);n.searchParams.set("uri",t);const a=n.toString();r=await Ai(ki(a,()=>fetch(a,{headers:{Accept:Ri}})),t,e)}for(const i of[...Si(e.fallbackSparqlEndpoints),...Si(e.fallbackSparqlEndpoint)]){if(r)break;const s=new URLSearchParams({query:Ci(t)});r=await Ai(Pi(()=>fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"text/turtle, application/n-triples"},body:s.toString()}),t),t,e)}if(!r)throw new Error(`No label data found for <${t}>`);return r})(t,i)),Ti[t]}async function Di(t){const i=await fetch(t,{headers:{Accept:"application/ld+json, application/json;q=0.9, */*;q=0.1"}});if(!i.ok)throw new Error(`Could not load feature ${t}: ${i.status} - ${i.statusText}`);const r=await i.json();return{feature:r,context:await e(r)}}var Oi=Object.freeze({__proto__:null,defaultFetchResourceOptions:wi,fetchResource:$i,findInStore:Ni,loadFeature:Di});const Fi={replaceElements:!0,...wi};function Li(t,e,i={propertiesField:"properties"}){const r=(t,e,i=!1)=>{if(Array.isArray(e)){for(const i of e){r(t,i).classList.add("array-entry")}return t}if(null==e||"object"!=typeof e){const i=document.createElement("span");return i.classList.add("literal-value"),i.textContent=""+e,t.appendChild(i),i}{const s=document.createElement("table");s.classList.add("object-table"),i&&(s.innerHTML="<thead><tr><th>Property</th><th>Value</th></tr></thead>");const n=document.createElement("tbody");return Object.entries(e).forEach(([t,e])=>{const i=document.createElement("tr"),s=document.createElement("td");s.classList.add("object-property"),s.setAttribute("data-property",t),s.textContent=t,i.appendChild(s);const a=document.createElement("td");a.classList.add("object-value"),r(a,e),i.appendChild(a),n.appendChild(i)}),s.appendChild(n),t.appendChild(s),s}},s=document.createElement("div");s.classList.add("object-properties"),e.appendChild(s),i.propertiesField?r(s,t[i.propertiesField],!0):r(s,t,!0)}async function Mi(t,e,i={}){const r={...Fi,...i},s=(t,e,i=!0,r=!1)=>{if(-1!==t.indexOf("://"))return{"@id":t};let n=null,a=null;for(let i=e.length-1;i>=0;i--){if(t in e[i]){let r,n=e[i][t];if(null==n||"boolean"==typeof n||Array.isArray(n))continue;if("string"==typeof n){if("@type"===n)return{"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"};r=n,n={"@id":n}}else{if("object"!=typeof n||!("@id"in n)||"string"!=typeof n["@id"])continue;r=n["@id"]}const a=r.indexOf(":");if(a>-1){const t=r.substring(0,a),i=r.substring(a+1);if(i.startsWith("//"))return n;const o=s(t,e);return null!==o&&"@id"in o&&"string"==typeof o["@id"]&&(n["@id"]=`${o["@id"]}${i}`),n}}null===n&&e[i]["@vocab"]&&(n=e[i]["@vocab"]),null===a&&e[i]["@base"]&&(a=e[i]["@base"])}if(-1===t.indexOf(":")){if(i&&n)return{"@id":`${n}${t}`};if(r&&a)return{"@id":`${a}${t}`}}return null},n=t=>{const e=[],i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(t){const i=t;return i.classList.contains("object-property")||i.classList.contains("object-value")?NodeFilter.FILTER_REJECT:i.classList.contains("literal-value")?(e.push(i),NodeFilter.FILTER_REJECT):NodeFilter.FILTER_SKIP}});for(;i.nextNode(););return e},a=(t,e,i=!0)=>{if(t.setAttribute("data-uri",e),t.classList.add("resource-loading"),$i(e,r).then(e=>{let i=t.querySelector(".resource-link")||t;e.label&&(t.setAttribute("data-label",e.label),r.replaceElements&&(i.textContent=e.label)),e.description&&(t.setAttribute("data-description",e.description),r.replaceElements&&(i.title=e.description)),t.classList.add("resource-resolved")}).catch(i=>{console.error(`Error resolving URI ${e}: ${i}`,{cause:i}),t.classList.add("resource-error")}).finally(()=>{t.classList.remove("resource-loading")}),i){const i=document.createElement("a");for(i.href=e,i.target="_blank",i.classList.add("resource-link");t.firstChild;)i.appendChild(t.firstChild);t.appendChild(i)}},o=(t,e)=>{var i;const h=(t=>{const e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(e){const i=e;return e!==t&&i.classList.contains("object-value")?NodeFilter.FILTER_REJECT:i.classList.contains("object-property")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),i=[];let r;for(;r=e.nextNode();)i.push(r);return i})(t);for(const t of h){let h=null;h=t.getAttribute("data-property"),h||(h=t.textContent.trim());const u=s(h,e);let l=e;const c=null===(i=t.parentElement)||void 0===i?void 0:i.querySelector(".object-value");if(u&&"@id"in u&&"string"==typeof u["@id"]){const i=u["@id"];if(a(t,i,r.replaceElements),"@context"in u&&(l=[...e,u["@context"]]),"@id"===u["@type"]&&c){n(c).forEach(t=>{const e=s(t.textContent.trim(),l,!1,!0);if(e&&"@id"in e&&"string"==typeof e["@id"]){const i=e["@id"];a(t,i,r.replaceElements)}})}}c&&o(c,l)}};o(t,[e])}var Bi={...Oi,...i,...Object.freeze({__proto__:null,augment:Mi,createPropertiesTable:Li})},qi="undefined"!=typeof jsonld?jsonld:void 0,Ui=Object.freeze({__proto__:null,default:qi});return t.augment=Mi,t.createPropertiesTable=Li,t.default=Bi,t.defaultFetchResourceOptions=wi,t.fetchResource=$i,t.findInStore=Ni,t.loadContext=e,t.loadFeature=Di,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
25
+ Object.defineProperty(t,"__esModule",{value:!0}),t.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",t.NC_NAME_CHAR="-"+t.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",t.NC_NAME_START_CHAR_RE=new RegExp("^["+t.NC_NAME_START_CHAR+"]$","u"),t.NC_NAME_CHAR_RE=new RegExp("^["+t.NC_NAME_CHAR+"]$","u"),t.NC_NAME_RE=new RegExp("^["+t.NC_NAME_START_CHAR+"]["+t.NC_NAME_CHAR+"]*$","u"),t.isNCNameStartChar=e,t.isNCNameChar=function(t){return e(t)||45===t||46===t||t>=48&&t<=57||183===t||t>=768&&t<=879||t>=8255&&t<=8256}}(Le)),Le);var r=t.isS,s=t.isChar,n=t.isNameStartChar,a=t.isNameChar,o=t.S_LIST,h=t.NAME_RE,u=e.isChar,l=i.isNCNameStartChar,c=i.isNCNameChar,d=i.NC_NAME_RE;const f="http://www.w3.org/XML/1998/namespace",p="http://www.w3.org/2000/xmlns/",_={__proto__:null,xml:f,xmlns:p},g={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},b=-1,m=-2,y=13,x=33,v=10,w=60,T=61,I=62,E=63,R=93,N=t=>34===t||39===t,j=[34,39],S=[...j,91,I],C=[...j,w,R],P=[T,E,...o],k=[...o,I,38,w];function A(t,e,i){switch(e){case"xml":i!==f&&t.fail(`xml prefix must be bound to ${f}.`);break;case"xmlns":i!==p&&t.fail(`xmlns prefix must be bound to ${p}.`)}switch(i){case p:t.fail(""===e?`the default namespace may not be set to ${i}.`:`may not assign a prefix (even "xmlns") to the URI ${p}.`);break;case f:switch(e){case"xml":break;case"":t.fail(`the default namespace may not be set to ${i}.`);break;default:t.fail("may not assign the xml namespace to another prefix.")}}}const $=t=>d.test(t),D=t=>h.test(t);Ce.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];const O={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"};return Ce.SaxesParser=class{get closed(){return this._closed}constructor(t){this.opt=null!=t?t:{},this.fragmentOpt=!!this.opt.fragment;const e=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=!1!==this.opt.position,this.fileName=this.opt.fileName,e){this.nameStartCheck=l,this.nameCheck=c,this.isName=$,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},_);const t=this.opt.additionalNamespaces;null!=t&&(!function(t,e){for(const i of Object.keys(e))A(t,i,e[i])}(this,t),Object.assign(this.ns,t))}else this.nameStartCheck=n,this.nameCheck=a,this.isName=D,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 t;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=0,this.attribList=[];const{fragmentOpt:e}=this;this.state=e?y:0,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=e,this.xmlDeclPossible=!e,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:i}=this.opt;if(void 0===i){if(!0===this.opt.forceXMLVersion)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");i="1.0"}this.setXMLVersion(i),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(g),null===(t=this.readyHandler)||void 0===t||t.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(t,e){this[O[t]]=e}off(t){this[O[t]]=void 0}makeError(t){var e;let i=null!==(e=this.fileName)&&void 0!==e?e:"";return this.trackPosition&&(i.length>0&&(i+=":"),i+=`${this.line}:${this.column}`),i.length>0&&(i+=": "),new Error(i+t)}fail(t){const e=this.makeError(t),i=this.errorHandler;if(void 0===i)throw e;return i(e),this}write(t){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let e=!1;null===t?(e=!0,t=""):"object"==typeof t&&(t=t.toString()),void 0!==this.carriedFromPrevious&&(t=`${this.carriedFromPrevious}${t}`,this.carriedFromPrevious=void 0);let i=t.length;const r=t.charCodeAt(i-1);!e&&(13===r||r>=55296&&r<=56319)&&(this.carriedFromPrevious=t[i-1],i--,t=t.slice(0,i));const{stateTable:s}=this;for(this.chunk=t,this.i=0;this.i<i;)s[this.state].call(this);return this.chunkPosition+=i,e?this.end():this}close(){return this.write(null)}getCode10(){const{chunk:t,i:e}=this;if(this.prevI=e,this.i=e+1,e>=t.length)return b;const i=t.charCodeAt(e);if(this.column++,i<55296){if(i>=32||9===i)return i;switch(i){case v:return this.line++,this.column=0,this.positionAtNewLine=this.position,v;case 13:return t.charCodeAt(e+1)===v&&(this.i=e+2),this.line++,this.column=0,this.positionAtNewLine=this.position,m;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;const r=65536+1024*(i-55296)+(t.charCodeAt(e+1)-56320);return this.i=e+2,r>1114111&&this.fail("disallowed character."),r}getCode11(){const{chunk:t,i:e}=this;if(this.prevI=e,this.i=e+1,e>=t.length)return b;const i=t.charCodeAt(e);if(this.column++,i<55296){if(i>31&&i<127||i>159&&8232!==i||9===i)return i;switch(i){case v:return this.line++,this.column=0,this.positionAtNewLine=this.position,v;case 13:{const i=t.charCodeAt(e+1);i!==v&&133!==i||(this.i=e+2)}case 133:case 8232:return this.line++,this.column=0,this.positionAtNewLine=this.position,m;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;const r=65536+1024*(i-55296)+(t.charCodeAt(e+1)-56320);return this.i=e+2,r>1114111&&this.fail("disallowed character."),r}getCodeNorm(){const t=this.getCode();return t===m?v:t}unget(){this.i=this.prevI,this.column--}captureTo(t){let{i:e}=this;const{chunk:i}=this;for(;;){const r=this.getCode(),s=r===m,n=s?v:r;if(n===b||t.includes(n))return this.text+=i.slice(e,this.prevI),n;s&&(this.text+=`${i.slice(e,this.prevI)}\n`,e=this.i)}}captureToChar(t){let{i:e}=this;const{chunk:i}=this;for(;;){let r=this.getCode();switch(r){case m:this.text+=`${i.slice(e,this.prevI)}\n`,e=this.i,r=v;break;case b:return this.text+=i.slice(e),!1}if(r===t)return this.text+=i.slice(e,this.prevI),!0}}captureNameChars(){const{chunk:t,i:e}=this;for(;;){const i=this.getCode();if(i===b)return this.name+=t.slice(e),b;if(!a(i))return this.name+=t.slice(e,this.prevI),i===m?v:i}}skipSpaces(){for(;;){const t=this.getCodeNorm();if(t===b||!r(t))return t}}setXMLVersion(t){this.currentXMLVersion=t,"1.0"===t?(this.isChar=s,this.getCode=this.getCode10):(this.isChar=u,this.getCode=this.getCode11)}sBegin(){65279===this.chunk.charCodeAt(0)&&(this.i++,this.column++),this.state=1}sBeginWhitespace(){const t=this.i,e=this.skipSpaces();switch(this.prevI!==t&&(this.xmlDeclPossible=!1),e){case w:if(this.state=15,0!==this.text.length)throw new Error("no-empty text at start");break;case b:break;default:this.unget(),this.state=y,this.xmlDeclPossible=!1}}sDoctype(){var t;const e=this.captureTo(S);switch(e){case I:null===(t=this.doctypeHandler)||void 0===t||t.call(this,this.text),this.text="",this.state=y,this.doctype=!0;break;case b:break;default:this.text+=String.fromCodePoint(e),91===e?this.state=4:N(e)&&(this.state=3,this.q=e)}}sDoctypeQuote(){const t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.q=null,this.state=2)}sDTD(){const t=this.captureTo(C);t!==b&&(this.text+=String.fromCodePoint(t),t===R?this.state=2:t===w?this.state=6:N(t)&&(this.state=5,this.q=t))}sDTDQuoted(){const t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.state=4,this.q=null)}sDTDOpenWaka(){const t=this.getCodeNorm();switch(this.text+=String.fromCodePoint(t),t){case 33:this.state=7,this.openWakaBang="";break;case E:this.state=11;break;default:this.state=4}}sDTDOpenWakaBang(){const t=String.fromCodePoint(this.getCodeNorm()),e=this.openWakaBang+=t;this.text+=t,"-"!==e&&(this.state="--"===e?8:4,this.openWakaBang="")}sDTDComment(){this.captureToChar(45)&&(this.text+="-",this.state=9)}sDTDCommentEnding(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),this.state=45===t?10:8}sDTDCommentEnded(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===I?this.state=4:(this.fail("malformed comment."),this.state=8)}sDTDPI(){this.captureToChar(E)&&(this.text+="?",this.state=12)}sDTDPIEnding(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===I&&(this.state=4)}sText(){0!==this.tags.length?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:t}=this;const{chunk:e}=this;t:for(;;)switch(this.getCode()){case m:this.entity+=`${e.slice(t,this.prevI)}\n`,t=this.i;break;case 59:{const{entityReturnState:i}=this,r=this.entity+e.slice(t,this.prevI);let s;this.state=i,""===r?(this.fail("empty entity name."),s="&;"):(s=this.parseEntity(r),this.entity=""),i===y&&void 0===this.textHandler||(this.text+=s);break t}case b:this.entity+=e.slice(t);break t}}sOpenWaka(){const t=this.getCode();if(n(t))this.state=34,this.unget(),this.xmlDeclPossible=!1;else switch(t){case 47:this.state=43,this.xmlDeclPossible=!1;break;case 33:this.state=16,this.openWakaBang="",this.xmlDeclPossible=!1;break;case E:this.state=23;break;default:this.fail("disallowed character in tag name"),this.state=y,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=20,this.openWakaBang="";break;case"--":this.state=17,this.openWakaBang="";break;case"DOCTYPE":this.state=2,(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(45)&&(this.state=18)}sCommentEnding(){var t;const e=this.getCodeNorm();45===e?(this.state=19,null===(t=this.commentHandler)||void 0===t||t.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(e)}`,this.state=17)}sCommentEnded(){const t=this.getCodeNorm();t!==I?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(t)}`,this.state=17):this.state=y}sCData(){this.captureToChar(R)&&(this.state=21)}sCDataEnding(){const t=this.getCodeNorm();t===R?this.state=22:(this.text+=`]${String.fromCodePoint(t)}`,this.state=20)}sCDataEnding2(){var t;const e=this.getCodeNorm();switch(e){case I:null===(t=this.cdataHandler)||void 0===t||t.call(this,this.text),this.text="",this.state=y;break;case R:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(e)}`,this.state=20}}sPIFirstChar(){const t=this.getCodeNorm();this.nameStartCheck(t)?(this.piTarget+=String.fromCodePoint(t),this.state=24):t===E||r(t)?(this.fail("processing instruction without a target."),this.state=t===E?26:25):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(t),this.state=24)}sPIRest(){const{chunk:t,i:e}=this;for(;;){const i=this.getCodeNorm();if(i===b)return void(this.piTarget+=t.slice(e));if(!this.nameCheck(i)){this.piTarget+=t.slice(e,this.prevI);const s=i===E;s||r(i)?"xml"===this.piTarget?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=s?x:27):this.state=s?26:25:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(i));break}}}sPIBody(){if(0===this.text.length){const t=this.getCodeNorm();t===E?this.state=26:r(t)||(this.text=String.fromCodePoint(t))}else this.captureToChar(E)&&(this.state=26)}sPIEnding(){var t;const e=this.getCodeNorm();if(e===I){const{piTarget:e}=this;"xml"===e.toLowerCase()&&this.fail("the XML declaration must appear at the start of the document."),null===(t=this.piHandler)||void 0===t||t.call(this,{target:e,body:this.text}),this.piTarget=this.text="",this.state=y}else e===E?this.text+="?":(this.text+=`?${String.fromCodePoint(e)}`,this.state=25);this.xmlDeclPossible=!1}sXMLDeclNameStart(){const t=this.skipSpaces();t!==E?t!==b&&(this.state=28,this.name=String.fromCodePoint(t)):this.state=x}sXMLDeclName(){const t=this.captureTo(P);if(t===E)return this.state=x,this.name+=this.text,this.text="",void this.fail("XML declaration is incomplete.");if(r(t)||t===T){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=t===T?30:29}}sXMLDeclEq(){const t=this.getCodeNorm();if(t===E)return this.state=x,void this.fail("XML declaration is incomplete.");r(t)||(t!==T&&this.fail("value required."),this.state=30)}sXMLDeclValueStart(){const t=this.getCodeNorm();if(t===E)return this.state=x,void this.fail("XML declaration is incomplete.");r(t)||(N(t)?this.q=t:(this.fail("value must be quoted."),this.q=32),this.state=31)}sXMLDeclValue(){const t=this.captureTo([this.q,E]);if(t===E)return this.state=x,this.text="",void this.fail("XML declaration is incomplete.");if(t===b)return;const e=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];const t=e;this.xmlDecl.version=t,/^1\.[0-9]+$/.test(t)?this.opt.forceXMLVersion||this.setXMLVersion(t):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(e)||this.fail("encoding value must match \t/^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=e;break;case"standalone":"yes"!==e&&"no"!==e&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=e}this.name="",this.state=32}sXMLDeclSeparator(){const t=this.getCodeNorm();t!==E?(r(t)||(this.fail("whitespace required."),this.unget()),this.state=27):this.state=x}sXMLDeclEnding(){var t;this.getCodeNorm()===I?("xml"!==this.piTarget?this.fail("processing instructions are not allowed before root."):"version"!==this.name&&this.xmlDeclExpects.includes("version")&&this.fail("XML declaration must contain a version."),null===(t=this.xmldeclHandler)||void 0===t||t.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=y):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var t;const e=this.captureNameChars();if(e===b)return;const i=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=i.ns=Object.create(null)),null===(t=this.openTagStartHandler)||void 0===t||t.call(this,i),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),e){case I:this.openTag();break;case 47:this.state=35;break;default:r(e)||this.fail("disallowed character in tag name."),this.state=36}}sOpenTagSlash(){this.getCode()===I?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=36)}sAttrib(){const t=this.skipSpaces();t!==b&&(n(t)?(this.unget(),this.state=37):t===I?this.openTag():47===t?this.state=35:this.fail("disallowed character in attribute name."))}sAttribName(){const t=this.captureNameChars();t===T?this.state=39:r(t)?this.state=38:t===I?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):t!==b&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){const t=this.skipSpaces();switch(t){case b:return;case T:this.state=39;break;default:this.fail("attribute without value."),this.text="",this.name="",t===I?this.openTag():n(t)?(this.unget(),this.state=37):(this.fail("disallowed character in attribute name."),this.state=36)}}sAttribValue(){const t=this.getCodeNorm();N(t)?(this.q=t,this.state=40):r(t)||(this.fail("unquoted attribute value."),this.state=42,this.unget())}sAttribValueQuoted(){const{q:t,chunk:e}=this;let{i:i}=this;for(;;)switch(this.getCode()){case t:return this.pushAttrib(this.name,this.text+e.slice(i,this.prevI)),this.name=this.text="",this.q=null,void(this.state=41);case 38:return this.text+=e.slice(i,this.prevI),this.state=14,void(this.entityReturnState=40);case v:case m:case 9:this.text+=`${e.slice(i,this.prevI)} `,i=this.i;break;case w:return this.text+=e.slice(i,this.prevI),void this.fail("disallowed character.");case b:return void(this.text+=e.slice(i))}}sAttribValueClosed(){const t=this.getCodeNorm();r(t)?this.state=36:t===I?this.openTag():47===t?this.state=35:n(t)?(this.fail("no whitespace between attributes."),this.unget(),this.state=37):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){const t=this.captureTo(k);switch(t){case 38:this.state=14,this.entityReturnState=42;break;case w:this.fail("disallowed character.");break;case b:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",t===I?this.openTag():this.state=36}}sCloseTag(){const t=this.captureNameChars();t===I?this.closeTag():r(t)?this.state=44:t!==b&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case I:this.closeTag();break;case b:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:t,forbiddenState:e}=this;const{chunk:i,textHandler:r}=this;t:for(;;)switch(this.getCode()){case w:if(this.state=15,void 0!==r){const{text:e}=this,s=i.slice(t,this.prevI);0!==e.length?(r(e+s),this.text=""):0!==s.length&&r(s)}e=0;break t;case 38:this.state=14,this.entityReturnState=y,void 0!==r&&(this.text+=i.slice(t,this.prevI)),e=0;break t;case R:switch(e){case 0:e=1;break;case 1:e=2;break;case 2:break;default:throw new Error("impossible state")}break;case I:2===e&&this.fail('the string "]]>" is disallowed in char data.'),e=0;break;case m:void 0!==r&&(this.text+=`${i.slice(t,this.prevI)}\n`),t=this.i,e=0;break;case b:void 0!==r&&(this.text+=i.slice(t));break t;default:e=0}this.forbiddenState=e}handleTextOutsideRoot(){let{i:t}=this;const{chunk:e,textHandler:i}=this;let s=!1;t:for(;;){const n=this.getCode();switch(n){case w:if(this.state=15,void 0!==i){const{text:r}=this,s=e.slice(t,this.prevI);0!==r.length?(i(r+s),this.text=""):0!==s.length&&i(s)}break t;case 38:this.state=14,this.entityReturnState=y,void 0!==i&&(this.text+=e.slice(t,this.prevI)),s=!0;break t;case m:void 0!==i&&(this.text+=`${e.slice(t,this.prevI)}\n`),t=this.i;break;case b:void 0!==i&&(this.text+=e.slice(t));break t;default:r(n)||(s=!0)}}s&&(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(t,e){var i;const{prefix:r,local:s}=this.qname(t),n={name:t,prefix:r,local:s,value:e};if(this.attribList.push(n),null===(i=this.attributeHandler)||void 0===i||i.call(this,n),"xmlns"===r){const t=e.trim();"1.0"===this.currentXMLVersion&&""===t&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[s]=t,A(this,s,t)}else if("xmlns"===t){const t=e.trim();this.topNS[""]=t,A(this,"",t)}}pushAttribPlain(t,e){var i;const r={name:t,value:e};this.attribList.push(r),null===(i=this.attributeHandler)||void 0===i||i.call(this,r)}end(){var t,e;this.sawRoot||this.fail("document must contain a root element.");const{tags:i}=this;for(;i.length>0;){const t=i.pop();this.fail(`unclosed tag: ${t.name}`)}0!==this.state&&this.state!==y&&this.fail("unexpected end.");const{text:r}=this;return 0!==r.length&&(null===(t=this.textHandler)||void 0===t||t.call(this,r),this.text=""),this._closed=!0,null===(e=this.endHandler)||void 0===e||e.call(this),this._init(),this}resolve(t){var e,i;let r=this.topNS[t];if(void 0!==r)return r;const{tags:s}=this;for(let e=s.length-1;e>=0;e--)if(r=s[e].ns[t],void 0!==r)return r;return r=this.ns[t],void 0!==r?r:null===(i=(e=this.opt).resolvePrefix)||void 0===i?void 0:i.call(e,t)}qname(t){const e=t.indexOf(":");if(-1===e)return{prefix:"",local:t};const i=t.slice(e+1),r=t.slice(0,e);return(""===r||""===i||i.includes(":"))&&this.fail(`malformed name: ${t}.`),{prefix:r,local:i}}processAttribsNS(){var t;const{attribList:e}=this,i=this.tag;{const{prefix:e,local:r}=this.qname(i.name);i.prefix=e,i.local=r;const s=i.uri=null!==(t=this.resolve(e))&&void 0!==t?t:"";""!==e&&("xmlns"===e&&this.fail('tags may not have "xmlns" as prefix.'),""===s&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),i.uri=e))}if(0===e.length)return;const{attributes:r}=i,s=new Set;for(const t of e){const{name:e,prefix:i,local:n}=t;let a,o;""===i?(a="xmlns"===e?p:"",o=e):(a=this.resolve(i),void 0===a&&(this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`),a=i),o=`{${a}}${n}`),s.has(o)&&this.fail(`duplicate attribute: ${o}.`),s.add(o),t.uri=a,r[e]=t}this.attribList=[]}processAttribsPlain(){const{attribList:t}=this,e=this.tag.attributes;for(const{name:i,value:r}of t)void 0!==e[i]&&this.fail(`duplicate attribute: ${i}.`),e[i]=r;this.attribList=[]}openTag(){var t;this.processAttribs();const{tags:e}=this,i=this.tag;i.isSelfClosing=!1,null===(t=this.openTagHandler)||void 0===t||t.call(this,i),e.push(i),this.state=y,this.name=""}openSelfClosingTag(){var t,e,i;this.processAttribs();const{tags:r}=this,s=this.tag;s.isSelfClosing=!0,null===(t=this.openTagHandler)||void 0===t||t.call(this,s),null===(e=this.closeTagHandler)||void 0===e||e.call(this,s);null===(this.tag=null!==(i=r[r.length-1])&&void 0!==i?i:null)&&(this.closedRoot=!0),this.state=y,this.name=""}closeTag(){const{tags:t,name:e}=this;if(this.state=y,this.name="",""===e)return this.fail("weird empty close tag."),void(this.text+="</>");const i=this.closeTagHandler;let r=t.length;for(;r-- >0;){const r=this.tag=t.pop();if(this.topNS=r.ns,null==i||i(r),r.name===e)break;this.fail("unexpected close tag.")}0===r?this.closedRoot=!0:r<0&&(this.fail(`unmatched closing tag: ${e}.`),this.text+=`</${e}>`)}parseEntity(t){if("#"!==t[0]){const e=this.ENTITIES[t];return void 0!==e?e:(this.fail(this.isName(t)?"undefined entity.":"disallowed character in entity name."),`&${t};`)}let e=NaN;return"x"===t[1]&&/^#x[0-9a-f]+$/i.test(t)?e=parseInt(t.slice(2),16):/^#[0-9]+$/.test(t)&&(e=parseInt(t.slice(1),10)),this.isChar(e)?String.fromCodePoint(e):(this.fail("malformed character entity."),`&${t};`)}},Ce}var Be,qe=ve(de),Ue={};function Qe(){if(Be)return Ue;Be=1,Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.ParseError=void 0;let t=class extends Error{constructor(t,e){const i=t.saxParser;super(t.trackPosition?`Line ${i.line} column ${i.column+1}: ${e}`:e)}};return Ue.ParseError=t,Ue}var He,Ge={},ze={};function Ye(){if(He)return ze;He=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.BlankNode=void 0;return ze.BlankNode=class{constructor(t){this.termType="BlankNode",this.value=t}equals(t){return!!t&&"BlankNode"===t.termType&&t.value===this.value}},ze}var Ve,Xe={},We={};function Ze(){if(Ve)return We;Ve=1,Object.defineProperty(We,"__esModule",{value:!0}),We.DefaultGraph=void 0;let t=class{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&"DefaultGraph"===t.termType}};return We.DefaultGraph=t,t.INSTANCE=new t,We}var Ke,Je,ti={},ei={};function ii(){if(Ke)return ei;Ke=1,Object.defineProperty(ei,"__esModule",{value:!0}),ei.NamedNode=void 0;return ei.NamedNode=class{constructor(t){this.termType="NamedNode",this.value=t}equals(t){return!!t&&"NamedNode"===t.termType&&t.value===this.value}},ei}function ri(){if(Je)return ti;Je=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.Literal=void 0;const t=ii();let e=class t{constructor(e,i){this.termType="Literal",this.value=e,"string"==typeof i?(this.language=i,this.datatype=t.RDF_LANGUAGE_STRING):i?(this.language="",this.datatype=i):(this.language="",this.datatype=t.XSD_STRING)}equals(t){return!!t&&"Literal"===t.termType&&t.value===this.value&&t.language===this.language&&this.datatype.equals(t.datatype)}};return ti.Literal=e,e.RDF_LANGUAGE_STRING=new t.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),e.XSD_STRING=new t.NamedNode("http://www.w3.org/2001/XMLSchema#string"),ti}var si,ni={};function ai(){if(si)return ni;si=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.Quad=void 0;return ni.Quad=class{constructor(t,e,i,r){this.termType="Quad",this.value="",this.subject=t,this.predicate=e,this.object=i,this.graph=r}equals(t){return!!t&&("Quad"===t.termType||!t.termType)&&this.subject.equals(t.subject)&&this.predicate.equals(t.predicate)&&this.object.equals(t.object)&&this.graph.equals(t.graph)}},ni}var oi,hi,ui,li={};function ci(){if(oi)return li;oi=1,Object.defineProperty(li,"__esModule",{value:!0}),li.Variable=void 0;return li.Variable=class{constructor(t){this.termType="Variable",this.value=t}equals(t){return!!t&&"Variable"===t.termType&&t.value===this.value}},li}function di(){return ui||(ui=1,t=Ge,e=Ge&&Ge.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=Ge&&Ge.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i(Ye(),t),i(function(){if(hi)return Xe;hi=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.DataFactory=void 0;const t=Ye(),e=Ze(),i=ri(),r=ii(),s=ai(),n=ci();let a=0;return Xe.DataFactory=class{constructor(t){this.blankNodeCounter=0,t=t||{},this.blankNodePrefix=t.blankNodePrefix||`df_${a++}_`}namedNode(t){return new r.NamedNode(t)}blankNode(e){return new t.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(t,e){return new i.Literal(t,e)}variable(t){return new n.Variable(t)}defaultGraph(){return e.DefaultGraph.INSTANCE}quad(t,e,i,r){return new s.Quad(t,e,i,r||this.defaultGraph())}fromTerm(t){switch(t.termType){case"NamedNode":return this.namedNode(t.value);case"BlankNode":return this.blankNode(t.value);case"Literal":return t.language?this.literal(t.value,t.language):t.datatype.equals(i.Literal.XSD_STRING)?this.literal(t.value):this.literal(t.value,this.fromTerm(t.datatype));case"Variable":return this.variable(t.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(t.subject),this.fromTerm(t.predicate),this.fromTerm(t.object),this.fromTerm(t.graph))}}fromQuad(t){return this.fromTerm(t)}resetBlankNodeCounter(){this.blankNodeCounter=0}},Xe}(),t),i(Ze(),t),i(ri(),t),i(ii(),t),i(ai(),t),i(ci(),t)),Ge;var t,e,i}var fi,pi,_i,gi,bi={},mi={};function yi(){return pi||(pi=1,t=bi,e=bi&&bi.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=bi&&bi.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i((fi||(fi=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateIri=t.IriValidationStrategy=void 0;const e=function(){const t="[!$&'()*+,;=]",e="%[a-fA-F0-9]{2}",i="([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",r=`${i}\\.${i}\\.${i}\\.${i}`,s="[a-fA-F0-9]{1,4}",n=`(${s}:${s}|${r})`,a="[a-zA-Z0-9\\-._~ -퟿豈-﷏ﷰ-￯𐀀-🿽𠀀-𯿽𰀀-𿿽񀀀-񏿽񐀀-񟿽񠀀-񯿽񰀀-񿿽򀀀-򏿽򐀀-򟿽򠀀-򯿽򰀀-򿿽󀀀-󏿽󐀀-󟿽󡀀-󯿽]",o=`(${a}|${e}|${t}|[:@])*`,h=`(${o})+`,u=`(${o})*`;return new RegExp(`^[a-zA-Z][a-zA-Z0-9+\\-.]*:(\\/\\/((${a}|${e}|${t}|:)*@)?(\\[(((${s}:){6}${n}|::(${s}:){5}${n}|(${s})?::(${s}:){4}${n}|((${s}:){0,1}${s})?::(${s}:){3}${n}|((${s}:){0,2}${s})?::(${s}:){2}${n}|((${s}:){0,3}${s})?::${s}:${n}|((${s}:){0,4}${s})?::${n}|((${s}:){0,5}${s})?::${s}|((${s}:){0,6}${s})?::)|v[a-fA-F0-9]+\\.(${t}|${t}|":)+)\\]|${r}|(${a}|${e}|${t})*)(:[0-9]*)?(\\/${u})*|\\/(${h}(\\/${u})*)?|${h}(\\/${u})*|)(\\?(${o}|[-󰀀-󿿽􀀀-􏿽]|[\\/?])*)?(#(${o}|[\\/?])*)?$`,"u")}(),i=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u;var r;!function(t){t.Strict="strict",t.Pragmatic="pragmatic",t.None="none"}(r=t.IriValidationStrategy||(t.IriValidationStrategy={})),t.validateIri=function(t,s=r.Strict){switch(s){case r.Strict:return e.test(t)?void 0:new Error(`Invalid IRI according to RFC 3987: '${t}'`);case r.Pragmatic:return i.test(t)?void 0:new Error(`Invalid IRI according to RDF Turtle: '${t}'`);case r.None:return;default:return new Error(`Not supported validation strategy "${s}"`)}}}(mi)),mi),t)),bi;var t,e,i}function xi(){if(_i)return Ee;_i=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.ParseType=Ee.RdfXmlParser=void 0;const t=je(),e=Me(),i=qe,r=Qe(),s=di(),n=yi();let a=class a extends i.Transform{constructor(t){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},t&&(Object.assign(this,t),this.options=t),this.dataFactory||(this.dataFactory=new s.DataFactory),this.baseIRI||(this.baseIRI=""),this.defaultGraph||(this.defaultGraph=this.dataFactory.defaultGraph()),!1!==this.validateUri&&(this.validateUri=!0),this.iriValidationStrategy||(this.iriValidationStrategy=this.validateUri?n.IriValidationStrategy.Pragmatic:n.IriValidationStrategy.None),this.saxParser=new e.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(t){const e=new i.PassThrough({readableObjectMode:!0});t.on("error",t=>r.emit("error",t)),t.on("data",t=>e.push(t)),t.on("end",()=>e.push(null));const r=e.pipe(new a(this.options));return r}_transform(t,e,i){try{this.saxParser.write(t)}catch(t){return i(t)}i()}newParseError(t){return new r.ParseError(this,t)}valueToUri(e,i){return this.uriToNamedNode((0,t.resolve)(e,i.baseIRI))}uriToNamedNode(t){const e=(0,n.validateIri)(t,this.iriValidationStrategy);if(e instanceof Error)throw this.newParseError(e.message);return this.dataFactory.namedNode(t)}validateNcname(t){if(!a.NCNAME_MATCHER.test(t))throw this.newParseError(`Not a valid NCName: ${t}`)}attachSaxListeners(){this.saxParser.on("error",t=>this.emit("error",t)),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(t){const e=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;let i=o.RESOURCE;if(e&&(e.hadChildren=!0,i=e.childrenParseType),e&&e.childrenStringTags){const i=t.name;let r="";for(const e in t.attributes)r+=` ${e}="${t.attributes[e].value}"`;const s=`<${`${i}${r}`}>`;e.childrenStringTags.push(s);const n={childrenStringTags:e.childrenStringTags};return n.childrenStringEmitClosingTag=`</${i}>`,void this.activeTagStack.push(n)}const r={};e?(r.language=e.language,r.baseIRI=e.baseIRI):r.baseIRI=this.baseIRI,this.activeTagStack.push(r),i===o.RESOURCE?this.onTagResource(t,r,e,!e):this.onTagProperty(t,r,e)}onTagResource(e,i,r,s){i.childrenParseType=o.PROPERTY;let n=!0;if(e.uri===a.RDF){if(!s&&a.FORBIDDEN_NODE_ELEMENTS.indexOf(e.local)>=0)throw this.newParseError(`Illegal node element name: ${e.local}`);switch(e.local){case"RDF":i.childrenParseType=o.RESOURCE;case"Description":n=!1}}const h=[],u=[];let l=null,c=!1,d=!1,f=null;for(const s in e.attributes){const n=e.attributes[s];if(r&&n.uri===a.RDF)switch(n.local){case"about":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);l=n.value;continue;case"ID":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);this.validateNcname(n.value),l="#"+n.value,c=!0;continue;case"nodeID":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);this.validateNcname(n.value),l=n.value,d=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"type":f=n.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(n.uri===a.XML){if("lang"===n.local){i.language=""===n.value?null:n.value.toLowerCase();continue}if("base"===n.local){i.baseIRI=(0,t.resolve)(n.value,i.baseIRI);continue}}"xml"===n.prefix||"xmlns"===n.prefix||""===n.prefix&&"xmlns"===n.local||!n.uri||(h.push(this.uriToNamedNode(n.uri+n.local)),u.push(n.value))}if(null!==l&&(i.subject=d?this.dataFactory.blankNode(l):this.valueToUri(l,i),c&&this.claimNodeId(i.subject)),i.subject||(i.subject=this.dataFactory.blankNode()),n){const t=this.uriToNamedNode(e.uri+e.local);this.emitTriple(i.subject,this.dataFactory.namedNode(a.RDF+"type"),t,r?r.reifiedStatementId:null)}if(r){if(r.predicate)if(r.childrenCollectionSubject){const t=this.dataFactory.blankNode();this.emitTriple(r.childrenCollectionSubject,r.childrenCollectionPredicate,t,r.reifiedStatementId),this.emitTriple(t,this.dataFactory.namedNode(a.RDF+"first"),i.subject,i.reifiedStatementId),r.childrenCollectionSubject=t,r.childrenCollectionPredicate=this.dataFactory.namedNode(a.RDF+"rest")}else{this.emitTriple(r.subject,r.predicate,i.subject,r.reifiedStatementId);for(let t=0;t<r.predicateSubPredicates.length;t++)this.emitTriple(i.subject,r.predicateSubPredicates[t],r.predicateSubObjects[t],null);r.predicateSubPredicates=[],r.predicateSubObjects=[],r.predicateEmitted=!0}for(let t=0;t<h.length;t++){const e=this.dataFactory.literal(u[t],i.datatype||i.language);this.emitTriple(i.subject,h[t],e,r.reifiedStatementId)}f&&this.emitTriple(i.subject,this.dataFactory.namedNode(a.RDF+"type"),this.uriToNamedNode(f),null)}}onTagProperty(t,e,i){if(e.childrenParseType=o.RESOURCE,e.subject=i.subject,t.uri===a.RDF&&"li"===t.local?(i.listItemCounter||(i.listItemCounter=1),e.predicate=this.uriToNamedNode(t.uri+"_"+i.listItemCounter++)):e.predicate=this.uriToNamedNode(t.uri+t.local),t.uri===a.RDF&&a.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(t.local)>=0)throw this.newParseError(`Illegal property element name: ${t.local}`);e.predicateSubPredicates=[],e.predicateSubObjects=[];let r=!1,s=!1,n=null,h=!0;const u=[],l=[];for(const i in t.attributes){const c=t.attributes[i];if(c.uri===a.RDF)switch(c.local){case"resource":if(n)throw this.newParseError(`Found both rdf:resource (${c.value}) and rdf:nodeID (${n}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${c.value})`);e.hadChildren=!0,n=c.value,h=!1;continue;case"datatype":if(s)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${c.value}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${c.value})`);e.datatype=this.valueToUri(c.value,e);continue;case"nodeID":if(s)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${c.value}).`);if(e.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${c.value}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${c.value})`);this.validateNcname(c.value),e.hadChildren=!0,n=c.value,h=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"parseType":if(s)throw this.newParseError("rdf:parseType is not allowed when non-rdf:* property attributes are present");if(e.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${e.datatype.value})`);if(n)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${n})`);if("Resource"===c.value){r=!0,e.childrenParseType=o.PROPERTY;const t=this.dataFactory.blankNode();this.emitTriple(e.subject,e.predicate,t,e.reifiedStatementId),e.subject=t,e.predicate=null}else"Collection"===c.value?(r=!0,e.hadChildren=!0,e.childrenCollectionSubject=e.subject,e.childrenCollectionPredicate=e.predicate,h=!1):"Literal"===c.value&&(r=!0,e.childrenTagsToString=!0,e.childrenStringTags=[]);continue;case"ID":this.validateNcname(c.value),e.reifiedStatementId=this.valueToUri("#"+c.value,e),this.claimNodeId(e.reifiedStatementId);continue}else if(c.uri===a.XML&&"lang"===c.local){e.language=""===c.value?null:c.value.toLowerCase();continue}if("xml"!==c.prefix&&"xmlns"!==c.prefix&&(""!==c.prefix||"xmlns"!==c.local)&&c.uri){if(r||e.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${c.value}`);e.hadChildren=!0,s=!0,u.push(this.uriToNamedNode(c.uri+c.local)),l.push(this.dataFactory.literal(c.value,e.datatype||e.language))}}if(null!==n){const t=e.subject;e.subject=h?this.dataFactory.blankNode(n):this.valueToUri(n,e),this.emitTriple(t,e.predicate,e.subject,e.reifiedStatementId);for(let t=0;t<u.length;t++)this.emitTriple(e.subject,u[t],l[t],null);e.predicateEmitted=!0}else h&&(e.predicateSubPredicates=u,e.predicateSubObjects=l,e.predicateEmitted=!1)}emitTriple(t,e,i,r){this.push(this.dataFactory.quad(t,e,i,this.defaultGraph)),r&&(this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"type"),this.dataFactory.namedNode(a.RDF+"Statement"),this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"subject"),t,this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"predicate"),e,this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"object"),i,this.defaultGraph)))}claimNodeId(t){if(!this.allowDuplicateRdfIds){if(this.nodeIds[t.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${t.value}'.`);this.nodeIds[t.value]=!0}}onText(t){const e=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;e&&(e.childrenStringTags?e.childrenStringTags.push(t):e.predicate&&(e.text=t))}onCloseTag(){const t=this.activeTagStack.pop();if(t.childrenStringEmitClosingTag&&t.childrenStringTags.push(t.childrenStringEmitClosingTag),t.childrenTagsToString&&(t.datatype=this.dataFactory.namedNode(a.RDF+"XMLLiteral"),t.text=t.childrenStringTags.join(""),t.hadChildren=!1),t.childrenCollectionSubject)this.emitTriple(t.childrenCollectionSubject,t.childrenCollectionPredicate,this.dataFactory.namedNode(a.RDF+"nil"),t.reifiedStatementId);else if(t.predicate)if(t.hadChildren||t.childrenParseType===o.PROPERTY){if(!t.predicateEmitted){const e=this.dataFactory.blankNode();this.emitTriple(t.subject,t.predicate,e,t.reifiedStatementId);for(let i=0;i<t.predicateSubPredicates.length;i++)this.emitTriple(e,t.predicateSubPredicates[i],t.predicateSubObjects[i],null)}}else this.emitTriple(t.subject,t.predicate,this.dataFactory.literal(t.text||"",t.datatype||t.language),t.reifiedStatementId)}onDoctype(t){t.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(t,e,i)=>(this.saxParser.ENTITIES[e]=i,""))}};var o;return Ee.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.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,function(t){t[t.RESOURCE=0]="RESOURCE",t[t.PROPERTY=1]="PROPERTY"}(o||(Ee.ParseType=o={})),Ee}function vi(){return gi||(gi=1,t=Ie,e=Ie&&Ie.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=Ie&&Ie.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i(xi(),t)),Ie;var t,e,i}var wi=vi();const Ti={labelPredicates:c,descriptionPredicates:d},Ii={},Ei={},Ri=new Set(["text/turtle","text/n3","application/n-triples","application/n-quads","application/trig","text/anot+turtle"]),Ni=["text/turtle","application/n-triples","application/n-quads","application/trig","application/ld+json","application/rdf+xml"].join(", ");function ji(t,e,i,r=function(){var t;if("undefined"!=typeof navigator&&(null===(t=navigator.languages)||void 0===t?void 0:t.length))return Array.from(navigator.languages);try{return[Intl.DateTimeFormat().resolvedOptions().locale]}catch(t){return[]}}()){const s=Nt.namedNode(e);for(const e of i){const i=t.getQuads(s,Nt.namedNode(e),null,null).filter(t=>"Literal"===t.object.termType);if(!i.length)continue;for(const t of r){const e=t.split("-")[0].toLowerCase(),r=i.find(i=>{var r;const s=null===(r=i.object.language)||void 0===r?void 0:r.toLowerCase();return s===t.toLowerCase()||(null==s?void 0:s.split("-")[0])===e});if(r)return r.object.value}const n=i.find(t=>!t.object.language);if(n)return n.object.value;const a=i.find(t=>{var e;return"en"===(null===(e=t.object.language)||void 0===e?void 0:e.toLowerCase())});return(null!=a?a:i[0]).object.value}return null}function Si(t,e,i){const r=new me,s=new Ht({baseIRI:e,format:"text/anot+turtle"===i?"text/turtle":i});return new Promise((e,i)=>{s.parse(t,(t,s)=>{if(t)return i(t);s?r.addQuad(s):e(r)})})}const Ci=t=>t?Array.isArray(t)?t:[t]:[],Pi=t=>`DESCRIBE <${t}>`,ki=async(t,e)=>{var i;let r;try{if(r=await t(),!r.ok)return null}catch(t){return null}const s=(null===(i=r.headers.get("content-type"))||void 0===i?void 0:i.split(";")[0].trim())||"text/turtle",n=await r.text();try{if(Ri.has(s))return Si(n,e,s);if("application/ld+json"===s)return async function(t,e){const i=await Promise.resolve().then(function(){return Qi});if(!i)throw new Error("jsonld peer dependency is not available");const r=JSON.parse(t);return Si(await i.toRDF(r,{format:"application/n-quads",base:e}),e,"application/n-quads")}(n,e);if("application/rdf+xml"===s)return async function(t,e){const i=new me;return new Promise((r,s)=>{const n=new wi.RdfXmlParser({baseIRI:e});n.on("data",t=>i.addQuad(t)),n.on("error",s),n.on("end",()=>r(i)),n.write(t),n.end()})}(n,e)}catch(t){}return null},Ai=(t,e)=>(t in Ei||(Ei[t]=ki(e,t)),Ei[t]),$i=async(t,e,i)=>{const r=await t;if(!r)return null;const s=ji(r,e,i.labelPredicates);return s?{uri:e,label:s,description:ji(r,e,i.descriptionPredicates)}:null};async function Di(t,e={}){const i={...Ti,...e};return t in Ii||(Ii[t]=(async(t,e)=>{const i=t.includes("#")?t.split("#")[0]:t;let r=await $i(Ai(i,()=>fetch(i,{headers:{Accept:Ni}})),t,e);const s=t.includes("#");for(const i of[...Ci(e.fallbackRainbowInstances),...Ci(e.fallbackRainbowInstance)]){if(r||s)break;const n=new URL(i);n.searchParams.set("uri",t);const a=n.toString();r=await $i(Ai(a,()=>fetch(a,{headers:{Accept:Ni}})),t,e)}for(const i of[...Ci(e.fallbackSparqlEndpoints),...Ci(e.fallbackSparqlEndpoint)]){if(r)break;const s=new URLSearchParams({query:Pi(t)});r=await $i(ki(()=>fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"text/turtle, application/n-triples"},body:s.toString()}),t),t,e)}if(!r)throw new Error(`No label data found for <${t}>`);return r})(t,i)),Ii[t]}async function Oi(t){const e=await fetch(t,{headers:{Accept:"application/ld+json, application/json;q=0.9, */*;q=0.1"}});if(!e.ok)throw new Error(`Could not load feature ${t}: ${e.status} - ${e.statusText}`);const r=await e.json();return{feature:r,context:await i(r)}}var Fi=Object.freeze({__proto__:null,defaultFetchResourceOptions:Ti,fetchResource:Di,findInStore:ji,loadFeature:Oi});const Li={replaceElements:!0,...Ti};function Mi(t,e,i={propertiesField:"properties"}){const r=(t,e,i=!1)=>{if(Array.isArray(e)){for(const i of e){r(t,i).classList.add("array-entry")}return t}if(null==e||"object"!=typeof e){const i=document.createElement("span");return i.classList.add("literal-value"),i.textContent=""+e,t.appendChild(i),i}{const s=document.createElement("table");s.classList.add("object-table"),i&&(s.innerHTML="<thead><tr><th>Property</th><th>Value</th></tr></thead>");const n=document.createElement("tbody");return Object.entries(e).forEach(([t,e])=>{const i=document.createElement("tr"),s=document.createElement("td");s.classList.add("object-property"),s.setAttribute("data-property",t),s.textContent=t,i.appendChild(s);const a=document.createElement("td");a.classList.add("object-value"),r(a,e),i.appendChild(a),n.appendChild(i)}),s.appendChild(n),t.appendChild(s),s}},s=document.createElement("div");s.classList.add("object-properties"),e.appendChild(s),i.propertiesField?r(s,t[i.propertiesField],!0):r(s,t,!0)}async function Bi(t,e,i={}){const r={...Li,...i},s=(t,e,i=!0,r=!1)=>{if(-1!==t.indexOf("://"))return{"@id":t};let n=null,a=null;for(let i=e.length-1;i>=0;i--){if(t in e[i]){let r,n=e[i][t];if(null==n||"boolean"==typeof n||Array.isArray(n))continue;if("string"==typeof n){if("@type"===n)return{"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"};r=n,n={"@id":n}}else{if("object"!=typeof n||!("@id"in n)||"string"!=typeof n["@id"])continue;r=n["@id"]}const a=r.indexOf(":");if(a>-1){const t=r.substring(0,a),i=r.substring(a+1);if(i.startsWith("//"))return n;const o=s(t,e);return null!==o&&"@id"in o&&"string"==typeof o["@id"]&&(n["@id"]=`${o["@id"]}${i}`),n}}null===n&&e[i]["@vocab"]&&(n=e[i]["@vocab"]),null===a&&e[i]["@base"]&&(a=e[i]["@base"])}if(-1===t.indexOf(":")){if(i&&n)return{"@id":`${n}${t}`};if(r&&a)return{"@id":`${a}${t}`}}return null},n=t=>{const e=[],i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(t){const i=t;return i.classList.contains("object-property")||i.classList.contains("object-value")?NodeFilter.FILTER_REJECT:i.classList.contains("literal-value")?(e.push(i),NodeFilter.FILTER_REJECT):NodeFilter.FILTER_SKIP}});for(;i.nextNode(););return e},a=(t,e,i=!0)=>{if(t.setAttribute("data-uri",e),t.classList.add("resource-loading"),Di(e,r).then(e=>{let i=t.querySelector(".resource-link")||t;e.label&&(t.setAttribute("data-label",e.label),r.replaceElements&&(i.textContent=e.label)),e.description&&(t.setAttribute("data-description",e.description),r.replaceElements&&(i.title=e.description)),t.classList.add("resource-resolved")}).catch(i=>{console.error(`Error resolving URI ${e}: ${i}`,{cause:i}),t.classList.add("resource-error")}).finally(()=>{t.classList.remove("resource-loading")}),i){const i=document.createElement("a");for(i.href=e,i.target="_blank",i.classList.add("resource-link");t.firstChild;)i.appendChild(t.firstChild);t.appendChild(i)}},o=(t,e)=>{var i;const h=(t=>{const e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(e){const i=e;return e!==t&&i.classList.contains("object-value")?NodeFilter.FILTER_REJECT:i.classList.contains("object-property")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),i=[];let r;for(;r=e.nextNode();)i.push(r);return i})(t);for(const t of h){let h=null;h=t.getAttribute("data-property"),h||(h=t.textContent.trim());const u=s(h,e);let l=e;const c=null===(i=t.parentElement)||void 0===i?void 0:i.querySelector(".object-value");if(u&&"@id"in u&&"string"==typeof u["@id"]){const i=u["@id"];if(a(t,i,r.replaceElements),"@context"in u&&(l=[...e,u["@context"]]),"@id"===u["@type"]&&c){n(c).forEach(t=>{const e=s(t.textContent.trim(),l,!1,!0);if(e&&"@id"in e&&"string"==typeof e["@id"]){const i=e["@id"];a(t,i,r.replaceElements)}})}}c&&o(c,l)}};o(t,[e])}var qi={...Fi,...r,...Object.freeze({__proto__:null,augment:Bi,createPropertiesTable:Mi})},Ui="undefined"!=typeof jsonld?jsonld:void 0,Qi=Object.freeze({__proto__:null,default:Ui});return t.augment=Bi,t.createPropertiesTable=Mi,t.default=qi,t.defaultFetchResourceOptions=Ti,t.fetchResource=Di,t.findInStore=ji,t.loadContext=i,t.loadFeature=Oi,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
26
26
  //# sourceMappingURL=jsonld-ui-utils.min.js.map