UNPKG

atuin

Version:

An RDF and SPARQL editor with graph visualization

2 lines 1.63 MB
/*! For license information please see bundle.js.LICENSE.txt */ (()=>{var t={171:(t,e,n)=>{"use strict";const i=n(7259),r=n(6441),o=n(3343),s=n(5181);function a(t,e){return t.hash<e.hash?-1:t.hash>e.hash?1:0}t.exports=class{constructor({createMessageDigest:t=()=>new r("sha256"),canonicalIdMap:e=new Map,maxDeepIterations:n=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new i("_:c14n",e),this.createMessageDigest=t,this.maxDeepIterations=n,this.quads=null,this.deepIterations=null}async main(t){this.deepIterations=new Map,this.quads=t;for(const e of t)this._addBlankNodeQuadInfo({quad:e,component:e.subject}),this._addBlankNodeQuadInfo({quad:e,component:e.object}),this._addBlankNodeQuadInfo({quad:e,component:e.graph});const e=new Map,n=[...this.blankNodeInfo.keys()];let r=0;for(const t of n)++r%100==0&&await this._yield(),await this._hashAndTrackBlankNode({id:t,hashToBlankNodes:e});const o=[...e.keys()].sort(),g=[];for(const t of o){const n=e.get(t);if(n.length>1){g.push(n);continue}const i=n[0];this.canonicalIssuer.getId(i)}for(const t of g){const e=[];for(const n of t){if(this.canonicalIssuer.hasId(n))continue;const t=new i("_:b");t.getId(n);const r=await this.hashNDegreeQuads(n,t);e.push(r)}e.sort(a);for(const t of e){const e=t.issuer.getOldIds();for(const t of e)this.canonicalIssuer.getId(t)}}const l=[];for(const t of this.quads){const e=s.serializeQuadComponents(this._componentWithCanonicalId(t.subject),t.predicate,this._componentWithCanonicalId(t.object),this._componentWithCanonicalId(t.graph));l.push(e)}return l.sort(),l.join("")}async hashFirstDegreeQuads(t){const e=[],n=this.blankNodeInfo.get(t),i=n.quads;for(const n of i){const i={subject:null,predicate:n.predicate,object:null,graph:null};i.subject=this.modifyFirstDegreeComponent(t,n.subject,"subject"),i.object=this.modifyFirstDegreeComponent(t,n.object,"object"),i.graph=this.modifyFirstDegreeComponent(t,n.graph,"graph"),e.push(s.serializeQuad(i))}e.sort();const r=this.createMessageDigest();for(const t of e)r.update(t);return n.hash=await r.digest(),n.hash}async hashRelatedBlankNode(t,e,n,i){let r;r=this.canonicalIssuer.hasId(t)?this.canonicalIssuer.getId(t):n.hasId(t)?n.getId(t):this.blankNodeInfo.get(t).hash;const o=this.createMessageDigest();return o.update(i),"g"!==i&&o.update(this.getRelatedPredicate(e)),o.update(r),o.digest()}async hashNDegreeQuads(t,e){const n=this.deepIterations.get(t)||0;if(n>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(t,n+1);const i=this.createMessageDigest(),r=await this.createHashToRelated(t,e),s=[...r.keys()].sort();for(const t of s){i.update(t);let n,s="";const a=new o(r.get(t));let g=0;for(;a.hasNext();){const t=a.next();++g%3==0&&await this._yield();let i=e.clone(),r="";const o=[];let l=!1;for(const e of t)if(this.canonicalIssuer.hasId(e)?r+=this.canonicalIssuer.getId(e):(i.hasId(e)||o.push(e),r+=i.getId(e)),0!==s.length&&r>s){l=!0;break}if(!l){for(const t of o){const e=await this.hashNDegreeQuads(t,i);if(r+=i.getId(t),r+=`<${e.hash}>`,i=e.issuer,0!==s.length&&r>s){l=!0;break}}l||(0===s.length||r<s)&&(s=r,n=i)}}i.update(s),e=n}return{hash:await i.digest(),issuer:e}}modifyFirstDegreeComponent(t,e){return"BlankNode"!==e.termType?e:{termType:"BlankNode",value:e.value===t?"_:a":"_:z"}}getRelatedPredicate(t){return`<${t.predicate.value}>`}async createHashToRelated(t,e){const n=new Map,i=this.blankNodeInfo.get(t).quads;let r=0;for(const o of i)++r%100==0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:o,component:o.subject,position:"s",id:t,issuer:e,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:o,component:o.object,position:"o",id:t,issuer:e,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:o,component:o.graph,position:"g",id:t,issuer:e,hashToRelated:n})]);return n}async _hashAndTrackBlankNode({id:t,hashToBlankNodes:e}){const n=await this.hashFirstDegreeQuads(t),i=e.get(n);i?i.push(t):e.set(n,[t])}_addBlankNodeQuadInfo({quad:t,component:e}){if("BlankNode"!==e.termType)return;const n=e.value,i=this.blankNodeInfo.get(n);i?i.quads.add(t):this.blankNodeInfo.set(n,{quads:new Set([t]),hash:null})}async _addRelatedBlankNodeHash({quad:t,component:e,position:n,id:i,issuer:r,hashToRelated:o}){if("BlankNode"!==e.termType||e.value===i)return;const s=e.value,a=await this.hashRelatedBlankNode(s,t,r,n),g=o.get(a);g?g.push(s):o.set(a,[s])}_componentWithCanonicalId(t){return"BlankNode"!==t.termType||t.value.startsWith(this.canonicalIssuer.prefix)?t:{termType:"BlankNode",value:this.canonicalIssuer.getId(t.value)}}async _yield(){return new Promise((t=>setImmediate(t)))}}},202:(t,e,n)=>{"use strict";const i=n(2985),r=n(7920),o=n(9925),s=n(1227);function a(t,e){return t.hash<e.hash?-1:t.hash>e.hash?1:0}t.exports=class{constructor({createMessageDigest:t=null,messageDigestAlgorithm:e="sha256",canonicalIdMap:n=new Map,maxWorkFactor:o=1,maxDeepIterations:s=-1,timeout:a=0}={}){this.name="RDFC-1.0",this.blankNodeInfo=new Map,this.canonicalIssuer=new i("c14n",n),this.createMessageDigest=t||(()=>new r(e)),this.maxWorkFactor=o,this.maxDeepIterations=s,this.remainingDeepIterations=0,this.timeout=a,a>0&&(this.startTime=Date.now()),this.quads=null}main(t){this.quads=t;for(const e of t)this._addBlankNodeQuadInfo({quad:e,component:e.subject}),this._addBlankNodeQuadInfo({quad:e,component:e.object}),this._addBlankNodeQuadInfo({quad:e,component:e.graph});const e=new Map,n=[...this.blankNodeInfo.keys()];for(const t of n)this._hashAndTrackBlankNode({id:t,hashToBlankNodes:e});const r=[...e.keys()].sort(),o=[];for(const t of r){const n=e.get(t);if(n.length>1){o.push(n);continue}const i=n[0];this.canonicalIssuer.getId(i)}if(this.maxDeepIterations<0)if(0===this.maxWorkFactor)this.maxDeepIterations=0;else if(this.maxWorkFactor===1/0)this.maxDeepIterations=1/0;else{const t=o.reduce(((t,e)=>t+e.length),0);this.maxDeepIterations=t**this.maxWorkFactor}this.maxDeepIterations>Number.MAX_SAFE_INTEGER&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(const t of o){const e=[];for(const n of t){if(this.canonicalIssuer.hasId(n))continue;const t=new i("b");t.getId(n);const r=this.hashNDegreeQuads(n,t);e.push(r)}e.sort(a);for(const t of e){const e=t.issuer.getOldIds();for(const t of e)this.canonicalIssuer.getId(t)}}const g=[];for(const t of this.quads){const e=s.serializeQuadComponents(this._componentWithCanonicalId(t.subject),t.predicate,this._componentWithCanonicalId(t.object),this._componentWithCanonicalId(t.graph));g.push(e)}return g.sort(),g.join("")}hashFirstDegreeQuads(t){const e=[],n=this.blankNodeInfo.get(t),i=n.quads;for(const n of i)e.push(s.serializeQuadComponents(this.modifyFirstDegreeComponent(t,n.subject,"subject"),n.predicate,this.modifyFirstDegreeComponent(t,n.object,"object"),this.modifyFirstDegreeComponent(t,n.graph,"graph")));e.sort();const r=this.createMessageDigest();for(const t of e)r.update(t);return n.hash=r.digest(),n.hash}hashRelatedBlankNode(t,e,n,i){const r=this.createMessageDigest();let o;return r.update(i),"g"!==i&&r.update(this.getRelatedPredicate(e)),o=this.canonicalIssuer.hasId(t)?"_:"+this.canonicalIssuer.getId(t):n.hasId(t)?"_:"+n.getId(t):this.blankNodeInfo.get(t).hash,r.update(o),r.digest()}hashNDegreeQuads(t,e){if(0===this.remainingDeepIterations)throw new Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;const n=this.createMessageDigest(),i=this.createHashToRelated(t,e),r=[...i.keys()].sort();for(const t of r){n.update(t);let r,s="";const a=new o(i.get(t));let g=0;for(;a.hasNext();){const t=a.next();if(++g%3==0&&this.timeout>0&&Date.now()-this.startTime>this.timeout)throw new Error("Canonize timeout.");let n=e.clone(),i="";const o=[];let l=!1;for(const e of t)if(this.canonicalIssuer.hasId(e)?i+="_:"+this.canonicalIssuer.getId(e):(n.hasId(e)||o.push(e),i+="_:"+n.getId(e)),0!==s.length&&i>s){l=!0;break}if(!l){for(const t of o){const e=this.hashNDegreeQuads(t,n);if(i+="_:"+n.getId(t),i+=`<${e.hash}>`,n=e.issuer,0!==s.length&&i>s){l=!0;break}}l||(0===s.length||i<s)&&(s=i,r=n)}}n.update(s),e=r}return{hash:n.digest(),issuer:e}}modifyFirstDegreeComponent(t,e){return"BlankNode"!==e.termType?e:{termType:"BlankNode",value:e.value===t?"a":"z"}}getRelatedPredicate(t){return`<${t.predicate.value}>`}createHashToRelated(t,e){const n=new Map,i=this.blankNodeInfo.get(t).quads;for(const r of i)this._addRelatedBlankNodeHash({quad:r,component:r.subject,position:"s",id:t,issuer:e,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:r,component:r.object,position:"o",id:t,issuer:e,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:r,component:r.graph,position:"g",id:t,issuer:e,hashToRelated:n});return n}_hashAndTrackBlankNode({id:t,hashToBlankNodes:e}){const n=this.hashFirstDegreeQuads(t),i=e.get(n);i?i.push(t):e.set(n,[t])}_addBlankNodeQuadInfo({quad:t,component:e}){if("BlankNode"!==e.termType)return;const n=e.value,i=this.blankNodeInfo.get(n);i?i.quads.add(t):this.blankNodeInfo.set(n,{quads:new Set([t]),hash:null})}_addRelatedBlankNodeHash({quad:t,component:e,position:n,id:i,issuer:r,hashToRelated:o}){if("BlankNode"!==e.termType||e.value===i)return;const s=e.value,a=this.hashRelatedBlankNode(s,t,r,n),g=o.get(a);g?g.push(s):o.set(a,[s])}_componentWithCanonicalId(t){return"BlankNode"!==t.termType||t.value.startsWith(this.canonicalIssuer.prefix)?t:{termType:"BlankNode",value:this.canonicalIssuer.getId(t.value)}}}},251:(t,e)=>{e.read=function(t,e,n,i,r){var o,s,a=8*r-i-1,g=(1<<a)-1,l=g>>1,A=-7,c=n?r-1:0,h=n?-1:1,C=t[e+c];for(c+=h,o=C&(1<<-A)-1,C>>=-A,A+=a;A>0;o=256*o+t[e+c],c+=h,A-=8);for(s=o&(1<<-A)-1,o>>=-A,A+=i;A>0;s=256*s+t[e+c],c+=h,A-=8);if(0===o)o=1-l;else{if(o===g)return s?NaN:1/0*(C?-1:1);s+=Math.pow(2,i),o-=l}return(C?-1:1)*s*Math.pow(2,o-i)},e.write=function(t,e,n,i,r,o){var s,a,g,l=8*o-r-1,A=(1<<l)-1,c=A>>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,C=i?0:o-1,I=i?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=A):(s=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-s))<1&&(s--,g*=2),(e+=s+c>=1?h/g:h*Math.pow(2,1-c))*g>=2&&(s++,g/=2),s+c>=A?(a=0,s=A):s+c>=1?(a=(e*g-1)*Math.pow(2,r),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,r),s=0));r>=8;t[n+C]=255&a,C+=I,a/=256,r-=8);for(s=s<<r|a,l+=r;l>0;t[n+C]=255&s,C+=I,s/=256,l-=8);t[n+C-I]|=128*d}},259:t=>{"use strict";t.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}},277:(t,e,n)=>{"use strict";const{ArrayIsArray:i,ArrayPrototypeIncludes:r,ArrayPrototypeJoin:o,ArrayPrototypeMap:s,NumberIsInteger:a,NumberIsNaN:g,NumberMAX_SAFE_INTEGER:l,NumberMIN_SAFE_INTEGER:A,NumberParseInt:c,ObjectPrototypeHasOwnProperty:h,RegExpPrototypeExec:C,String:I,StringPrototypeToUpperCase:d,StringPrototypeTrim:u}=n(4134),{hideStackFrames:f,codes:{ERR_SOCKET_BAD_PORT:p,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:m,ERR_OUT_OF_RANGE:y,ERR_UNKNOWN_SIGNAL:b}}=n(6371),{normalizeEncoding:w}=n(7760),{isAsyncFunction:x,isArrayBufferView:E}=n(7760).types,k={},S=/^[0-7]+$/,T=f(((t,e,n=A,i=l)=>{if("number"!=typeof t)throw new v(e,"number",t);if(!a(t))throw new y(e,"an integer",t);if(t<n||t>i)throw new y(e,`>= ${n} && <= ${i}`,t)})),O=f(((t,e,n=-2147483648,i=2147483647)=>{if("number"!=typeof t)throw new v(e,"number",t);if(!a(t))throw new y(e,"an integer",t);if(t<n||t>i)throw new y(e,`>= ${n} && <= ${i}`,t)})),R=f(((t,e,n=!1)=>{if("number"!=typeof t)throw new v(e,"number",t);if(!a(t))throw new y(e,"an integer",t);const i=n?1:0,r=4294967295;if(t<i||t>r)throw new y(e,`>= ${i} && <= ${r}`,t)}));function _(t,e){if("string"!=typeof t)throw new v(e,"string",t)}const N=f(((t,e,n)=>{if(!r(n,t)){const i=o(s(n,(t=>"string"==typeof t?`'${t}'`:I(t))),", ");throw new m(e,t,"must be one of: "+i)}}));function D(t,e){if("boolean"!=typeof t)throw new v(e,"boolean",t)}function P(t,e,n){return null!=t&&h(t,e)?t[e]:n}const M=f(((t,e,n=null)=>{const r=P(n,"allowArray",!1),o=P(n,"allowFunction",!1);if(!P(n,"nullable",!1)&&null===t||!r&&i(t)||"object"!=typeof t&&(!o||"function"!=typeof t))throw new v(e,"Object",t)})),L=f(((t,e)=>{if(null!=t&&"object"!=typeof t&&"function"!=typeof t)throw new v(e,"a dictionary",t)})),j=f(((t,e,n=0)=>{if(!i(t))throw new v(e,"Array",t);if(t.length<n)throw new m(e,t,`must be longer than ${n}`)})),B=f(((t,e="buffer")=>{if(!E(t))throw new v(e,["Buffer","TypedArray","DataView"],t)})),F=f(((t,e)=>{if(void 0!==t&&(null===t||"object"!=typeof t||!("aborted"in t)))throw new v(e,"AbortSignal",t)})),z=f(((t,e)=>{if("function"!=typeof t)throw new v(e,"Function",t)})),V=f(((t,e)=>{if("function"!=typeof t||x(t))throw new v(e,"Function",t)})),G=f(((t,e)=>{if(void 0!==t)throw new v(e,"undefined",t)})),U=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function W(t,e){if(void 0===t||!C(U,t))throw new m(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}t.exports={isInt32:function(t){return t===(0|t)},isUint32:function(t){return t===t>>>0},parseFileMode:function(t,e,n){if(void 0===t&&(t=n),"string"==typeof t){if(null===C(S,t))throw new m(e,t,"must be a 32-bit unsigned integer or an octal string");t=c(t,8)}return R(t,e),t},validateArray:j,validateStringArray:function(t,e){j(t,e);for(let n=0;n<t.length;n++)_(t[n],`${e}[${n}]`)},validateBooleanArray:function(t,e){j(t,e);for(let n=0;n<t.length;n++)D(t[n],`${e}[${n}]`)},validateAbortSignalArray:function(t,e){j(t,e);for(let n=0;n<t.length;n++){const i=t[n],r=`${e}[${n}]`;if(null==i)throw new v(r,"AbortSignal",i);F(i,r)}},validateBoolean:D,validateBuffer:B,validateDictionary:L,validateEncoding:function(t,e){const n=w(e),i=t.length;if("hex"===n&&i%2!=0)throw new m("encoding",e,`is invalid for data of length ${i}`)},validateFunction:z,validateInt32:O,validateInteger:T,validateNumber:function(t,e,n=void 0,i){if("number"!=typeof t)throw new v(e,"number",t);if(null!=n&&t<n||null!=i&&t>i||(null!=n||null!=i)&&g(t))throw new y(e,`${null!=n?`>= ${n}`:""}${null!=n&&null!=i?" && ":""}${null!=i?`<= ${i}`:""}`,t)},validateObject:M,validateOneOf:N,validatePlainFunction:V,validatePort:function(t,e="Port",n=!0){if("number"!=typeof t&&"string"!=typeof t||"string"==typeof t&&0===u(t).length||+t!=+t>>>0||t>65535||0===t&&!n)throw new p(e,t,n);return 0|t},validateSignalName:function(t,e="signal"){if(_(t,e),void 0===k[t]){if(void 0!==k[d(t)])throw new b(t+" (signals must use all capital letters)");throw new b(t)}},validateString:_,validateUint32:R,validateUndefined:G,validateUnion:function(t,e,n){if(!r(n,t))throw new v(e,`('${o(n,"|")}')`,t)},validateAbortSignal:F,validateLinkHeaderValue:function(t){if("string"==typeof t)return W(t,"hints"),t;if(i(t)){const e=t.length;let n="";if(0===e)return n;for(let i=0;i<e;i++){const r=t[i];W(r,"hints"),n+=r,i!==e-1&&(n+=", ")}return n}throw new m("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}}},345:(t,e,n)=>{"use strict";const{StringPrototypeSlice:i,SymbolIterator:r,TypedArrayPrototypeSet:o,Uint8Array:s}=n(4134),{Buffer:a}=n(8287),{inspect:g}=n(7760);t.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(t){const e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}unshift(t){const e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}shift(){if(0===this.length)return;const t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}clear(){this.head=this.tail=null,this.length=0}join(t){if(0===this.length)return"";let e=this.head,n=""+e.data;for(;null!==(e=e.next);)n+=t+e.data;return n}concat(t){if(0===this.length)return a.alloc(0);const e=a.allocUnsafe(t>>>0);let n=this.head,i=0;for(;n;)o(e,n.data,i),i+=n.data.length,n=n.next;return e}consume(t,e){const n=this.head.data;if(t<n.length){const e=n.slice(0,t);return this.head.data=n.slice(t),e}return t===n.length?this.shift():e?this._getString(t):this._getBuffer(t)}first(){return this.head.data}*[r](){for(let t=this.head;t;t=t.next)yield t.data}_getString(t){let e="",n=this.head,r=0;do{const o=n.data;if(!(t>o.length)){t===o.length?(e+=o,++r,n.next?this.head=n.next:this.head=this.tail=null):(e+=i(o,0,t),this.head=n,n.data=i(o,t));break}e+=o,t-=o.length,++r}while(null!==(n=n.next));return this.length-=r,e}_getBuffer(t){const e=a.allocUnsafe(t),n=t;let i=this.head,r=0;do{const a=i.data;if(!(t>a.length)){t===a.length?(o(e,a,n-t),++r,i.next?this.head=i.next:this.head=this.tail=null):(o(e,new s(a.buffer,a.byteOffset,t),n-t),this.head=i,i.data=a.slice(t));break}o(e,a,n-t),t-=a.length,++r}while(null!==(i=i.next));return this.length-=r,e}[Symbol.for("nodejs.util.inspect.custom")](t,e){return g(this,{...e,depth:0,customInspect:!1})}}},346:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},446:(t,e)=>{"use strict";function n(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}Object.defineProperty(e,"__esModule",{value:!0}),e.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",e.NC_NAME_CHAR="-"+e.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",e.NC_NAME_START_CHAR_RE=new RegExp("^["+e.NC_NAME_START_CHAR+"]$","u"),e.NC_NAME_CHAR_RE=new RegExp("^["+e.NC_NAME_CHAR+"]$","u"),e.NC_NAME_RE=new RegExp("^["+e.NC_NAME_START_CHAR+"]["+e.NC_NAME_CHAR+"]*$","u"),e.isNCNameStartChar=n,e.isNCNameChar=function(t){return n(t)||45===t||46===t||t>=48&&t<=57||183===t||t>=768&&t<=879||t>=8255&&t<=8256}},470:(t,e,n)=>{"use strict";const i=n(5001),r={};t.exports=r,r.parsers={simple:{keys:["href","scheme","authority","path","query","fragment"],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:["href","protocol","scheme","authority","auth","user","password","hostname","port","path","directory","file","query","fragment"],regex:/^(([a-zA-Z][a-zA-Z0-9+-.]*):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},r.parse=(t,e)=>{const n={},i=r.parsers[e||"full"],o=i.regex.exec(t);let s=i.keys.length;for(;s--;)n[i.keys[s]]=void 0===o[s]?null:o[s];return("https"===n.scheme&&"443"===n.port||"http"===n.scheme&&"80"===n.port)&&(n.href=n.href.replace(":"+n.port,""),n.authority=n.authority.replace(":"+n.port,""),n.port=null),n.normalizedPath=r.removeDotSegments(n.path),n},r.prependBase=(t,e)=>{if(null===t)return e;if(r.isAbsolute(e))return e;t&&!i.isString(t)||(t=r.parse(t||""));const n=r.parse(e),o={protocol:t.protocol||""};if(null!==n.authority)o.authority=n.authority,o.path=n.path,o.query=n.query;else if(o.authority=t.authority,""===n.path)o.path=t.path,null!==n.query?o.query=n.query:o.query=t.query;else{if(0===n.path.indexOf("/"))o.path=n.path;else{let e=t.path;e=e.substr(0,e.lastIndexOf("/")+1),(e.length>0||t.authority)&&"/"!==e.substr(-1)&&(e+="/"),e+=n.path,o.path=e}o.query=n.query}""!==n.path&&(o.path=r.removeDotSegments(o.path));let s=o.protocol;return null!==o.authority&&(s+="//"+o.authority),s+=o.path,null!==o.query&&(s+="?"+o.query),null!==n.fragment&&(s+="#"+n.fragment),""===s&&(s="./"),s},r.removeBase=(t,e)=>{if(null===t)return e;t&&!i.isString(t)||(t=r.parse(t||""));let n="";if(""!==t.href?n+=(t.protocol||"")+"//"+(t.authority||""):e.indexOf("//")&&(n+="//"),0!==e.indexOf(n))return e;const o=r.parse(e.substr(n.length)),s=t.normalizedPath.split("/"),a=o.normalizedPath.split("/"),g=o.fragment||o.query?0:1;for(;s.length>0&&a.length>g&&s[0]===a[0];)s.shift(),a.shift();let l="";if(s.length>0){s.pop();for(let t=0;t<s.length;++t)l+="../"}return l+=a.join("/"),null!==o.query&&(l+="?"+o.query),null!==o.fragment&&(l+="#"+o.fragment),""===l&&(l="./"),l},r.removeDotSegments=t=>{if(0===t.length)return"";const e=t.split("/"),n=[];for(;e.length>0;){const t=e.shift(),i=0===e.length;"."!==t?".."!==t?n.push(t):(n.pop(),i&&n.push("")):i&&n.push("")}return"/"===t[0]&&n.length>0&&""!==n[0]&&n.unshift(""),1===n.length&&""===n[0]?"/":n.join("/")};const o=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;r.isAbsolute=t=>i.isString(t)&&o.test(t),r.isRelative=t=>i.isString(t)},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},585:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FetchDocumentLoader=void 0;const i=n(5094),r=n(2384),o=n(742);e.FetchDocumentLoader=class{constructor(t){this.fetcher=t}async load(t){const e=await(this.fetcher||fetch)(t,{headers:new Headers({accept:"application/ld+json"})});if(e.ok&&e.headers){let n=e.headers.get("Content-Type");if(n){const t=n.indexOf(";");t>0&&(n=n.substr(0,t))}if("application/ld+json"===n)return await e.json();if(e.headers.has("Link")){let n;if(e.headers.forEach(((e,i)=>{if("link"===i){const i=(0,r.parse)(e);for(const e of i.get("type","application/ld+json"))if("alternate"===e.rel){if(n)throw new Error("Multiple JSON-LD alternate links were found on "+t);n=(0,o.resolve)(e.uri,t)}}})),n)return this.load(n)}throw new i.ErrorCoded(`Unsupported JSON-LD media type ${n}`,i.ERROR_CODES.LOADING_DOCUMENT_FAILED)}throw new Error(e.statusText||`Status code: ${e.status}`)}}},608:(t,e,n)=>{var{Buffer:i}=n(8287),r={},o=r.LEFT_BRACE=1,s=r.RIGHT_BRACE=2,a=r.LEFT_BRACKET=3,g=r.RIGHT_BRACKET=4,l=r.COLON=5,A=r.COMMA=6,c=r.TRUE=7,h=r.FALSE=8,C=r.NULL=9,I=r.STRING=10,d=r.NUMBER=11,u=r.START=17,f=r.STOP=18,p=r.TRUE1=33,v=r.TRUE2=34,m=r.TRUE3=35,y=r.FALSE1=49,b=r.FALSE2=50,w=r.FALSE3=51,x=r.FALSE4=52,E=r.NULL1=65,k=r.NULL2=66,S=r.NULL3=67,T=r.NUMBER1=81,O=r.NUMBER3=83,R=r.STRING1=97,_=r.STRING2=98,N=r.STRING3=99,D=r.STRING4=100,P=r.STRING5=101,M=r.STRING6=102,L=r.VALUE=113,j=r.KEY=114,B=r.OBJECT=129,F=r.ARRAY=130,z="\\".charCodeAt(0),V="/".charCodeAt(0),G="\b".charCodeAt(0),U="\f".charCodeAt(0),W="\n".charCodeAt(0),Z="\r".charCodeAt(0),H="\t".charCodeAt(0),q=65536;function Y(t){return i.alloc?i.alloc(t):new i(t)}function Q(){this.tState=u,this.value=void 0,this.string=void 0,this.stringBuffer=Y(q),this.stringBufferOffset=0,this.unicode=void 0,this.highSurrogate=void 0,this.key=void 0,this.mode=void 0,this.stack=[],this.state=L,this.bytes_remaining=0,this.bytes_in_sequence=0,this.temp_buffs={2:Y(2),3:Y(3),4:Y(4)},this.offset=-1}Q.toknam=function(t){for(var e=Object.keys(r),n=0,i=e.length;n<i;n++){var o=e[n];if(r[o]===t)return o}return t&&"0x"+t.toString(16)};var K=Q.prototype;K.onError=function(t){throw t},K.charError=function(t,e){this.tState=f,this.onError(new Error("Unexpected "+JSON.stringify(String.fromCharCode(t[e]))+" at position "+e+" in state "+Q.toknam(this.tState)))},K.appendStringChar=function(t){this.stringBufferOffset>=q&&(this.string+=this.stringBuffer.toString("utf8"),this.stringBufferOffset=0),this.stringBuffer[this.stringBufferOffset++]=t},K.appendStringBuf=function(t,e,n){var i=t.length;"number"==typeof e&&(i="number"==typeof n?n<0?t.length-e+n:n-e:t.length-e),i<0&&(i=0),this.stringBufferOffset+i>q&&(this.string+=this.stringBuffer.toString("utf8",0,this.stringBufferOffset),this.stringBufferOffset=0),t.copy(this.stringBuffer,this.stringBufferOffset,e,n),this.stringBufferOffset+=i},K.write=function(t){var e;"string"==typeof t&&(t=new i(t));for(var n=0,r=t.length;n<r;n++)if(this.tState===u){if(e=t[n],this.offset++,123===e)this.onToken(o,"{");else if(125===e)this.onToken(s,"}");else if(91===e)this.onToken(a,"[");else if(93===e)this.onToken(g,"]");else if(58===e)this.onToken(l,":");else if(44===e)this.onToken(A,",");else if(116===e)this.tState=p;else if(102===e)this.tState=y;else if(110===e)this.tState=E;else if(34===e)this.string="",this.stringBufferOffset=0,this.tState=R;else if(45===e)this.string="-",this.tState=T;else if(e>=48&&e<64)this.string=String.fromCharCode(e),this.tState=O;else if(32!==e&&9!==e&&10!==e&&13!==e)return this.charError(t,n)}else if(this.tState===R)if(e=t[n],this.bytes_remaining>0){for(var d=0;d<this.bytes_remaining;d++)this.temp_buffs[this.bytes_in_sequence][this.bytes_in_sequence-this.bytes_remaining+d]=t[d];this.appendStringBuf(this.temp_buffs[this.bytes_in_sequence]),this.bytes_in_sequence=this.bytes_remaining=0,n=n+d-1}else if(0===this.bytes_remaining&&e>=128){if(e<=193||e>244)return this.onError(new Error("Invalid UTF-8 character at position "+n+" in state "+Q.toknam(this.tState)));if(e>=194&&e<=223&&(this.bytes_in_sequence=2),e>=224&&e<=239&&(this.bytes_in_sequence=3),e>=240&&e<=244&&(this.bytes_in_sequence=4),this.bytes_in_sequence+n>t.length){for(var f=0;f<=t.length-1-n;f++)this.temp_buffs[this.bytes_in_sequence][f]=t[n+f];this.bytes_remaining=n+this.bytes_in_sequence-t.length,n=t.length-1}else this.appendStringBuf(t,n,n+this.bytes_in_sequence),n=n+this.bytes_in_sequence-1}else if(34===e)this.tState=u,this.string+=this.stringBuffer.toString("utf8",0,this.stringBufferOffset),this.stringBufferOffset=0,this.onToken(I,this.string),this.offset+=i.byteLength(this.string,"utf8")+1,this.string=void 0;else if(92===e)this.tState=_;else{if(!(e>=32))return this.charError(t,n);this.appendStringChar(e)}else if(this.tState===_)if(34===(e=t[n]))this.appendStringChar(e),this.tState=R;else if(92===e)this.appendStringChar(z),this.tState=R;else if(47===e)this.appendStringChar(V),this.tState=R;else if(98===e)this.appendStringChar(G),this.tState=R;else if(102===e)this.appendStringChar(U),this.tState=R;else if(110===e)this.appendStringChar(W),this.tState=R;else if(114===e)this.appendStringChar(Z),this.tState=R;else if(116===e)this.appendStringChar(H),this.tState=R;else{if(117!==e)return this.charError(t,n);this.unicode="",this.tState=N}else if(this.tState===N||this.tState===D||this.tState===P||this.tState===M){if(!((e=t[n])>=48&&e<64||e>64&&e<=70||e>96&&e<=102))return this.charError(t,n);if(this.unicode+=String.fromCharCode(e),this.tState++===M){var L=parseInt(this.unicode,16);this.unicode=void 0,void 0!==this.highSurrogate&&L>=56320&&L<57344?(this.appendStringBuf(new i(String.fromCharCode(this.highSurrogate,L))),this.highSurrogate=void 0):void 0===this.highSurrogate&&L>=55296&&L<56320?this.highSurrogate=L:(void 0!==this.highSurrogate&&(this.appendStringBuf(new i(String.fromCharCode(this.highSurrogate))),this.highSurrogate=void 0),this.appendStringBuf(new i(String.fromCharCode(L)))),this.tState=R}}else if(this.tState===T||this.tState===O)switch(e=t[n]){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 46:case 101:case 69:case 43:case 45:this.string+=String.fromCharCode(e),this.tState=O;break;default:this.tState=u;var j=this.numberReviver(this.string,t,n);if(j)return j;this.offset+=this.string.length-1,this.string=void 0,n--}else if(this.tState===p){if(114!==t[n])return this.charError(t,n);this.tState=v}else if(this.tState===v){if(117!==t[n])return this.charError(t,n);this.tState=m}else if(this.tState===m){if(101!==t[n])return this.charError(t,n);this.tState=u,this.onToken(c,!0),this.offset+=3}else if(this.tState===y){if(97!==t[n])return this.charError(t,n);this.tState=b}else if(this.tState===b){if(108!==t[n])return this.charError(t,n);this.tState=w}else if(this.tState===w){if(115!==t[n])return this.charError(t,n);this.tState=x}else if(this.tState===x){if(101!==t[n])return this.charError(t,n);this.tState=u,this.onToken(h,!1),this.offset+=4}else if(this.tState===E){if(117!==t[n])return this.charError(t,n);this.tState=k}else if(this.tState===k){if(108!==t[n])return this.charError(t,n);this.tState=S}else if(this.tState===S){if(108!==t[n])return this.charError(t,n);this.tState=u,this.onToken(C,null),this.offset+=3}},K.onToken=function(t,e){},K.parseError=function(t,e){this.tState=f,this.onError(new Error("Unexpected "+Q.toknam(t)+(e?"("+JSON.stringify(e)+")":"")+" in state "+Q.toknam(this.state)))},K.push=function(){this.stack.push({value:this.value,key:this.key,mode:this.mode})},K.pop=function(){var t=this.value,e=this.stack.pop();this.value=e.value,this.key=e.key,this.mode=e.mode,this.emit(t),this.mode||(this.state=L)},K.emit=function(t){this.mode&&(this.state=A),this.onValue(t)},K.onValue=function(t){},K.onToken=function(t,e){if(this.state===L)if(t===I||t===d||t===c||t===h||t===C)this.value&&(this.value[this.key]=e),this.emit(e);else if(t===o)this.push(),this.value?this.value=this.value[this.key]={}:this.value={},this.key=void 0,this.state=j,this.mode=B;else if(t===a)this.push(),this.value?this.value=this.value[this.key]=[]:this.value=[],this.key=0,this.mode=F,this.state=L;else if(t===s){if(this.mode!==B)return this.parseError(t,e);this.pop()}else{if(t!==g)return this.parseError(t,e);if(this.mode!==F)return this.parseError(t,e);this.pop()}else if(this.state===j)if(t===I)this.key=e,this.state=l;else{if(t!==s)return this.parseError(t,e);this.pop()}else if(this.state===l){if(t!==l)return this.parseError(t,e);this.state=L}else{if(this.state!==A)return this.parseError(t,e);if(t===A)this.mode===F?(this.key++,this.state=L):this.mode===B&&(this.state=j);else{if(!(t===g&&this.mode===F||t===s&&this.mode===B))return this.parseError(t,e);this.pop()}}},K.numberReviver=function(t,e,n){var i=Number(t);if(isNaN(i))return this.charError(e,n);t.match(/[0-9]+/)==t&&i.toString()!=t?this.onToken(I,t):this.onToken(d,i)},Q.C=r,t.exports=Q},659:(t,e,n)=>{var i=n(1873),r=Object.prototype,o=r.hasOwnProperty,s=r.toString,a=i?i.toStringTag:void 0;t.exports=function(t){var e=o.call(t,a),n=t[a];try{t[a]=void 0;var i=!0}catch(t){}var r=s.call(t);return i&&(e?t[a]=n:delete t[a]),r}},701:(t,e,n)=>{"use strict";const i=n(6957),r={};t.exports=r,r.setupDocumentLoaders=function(t){"undefined"!=typeof XMLHttpRequest&&(t.documentLoaders.xhr=i,t.useDocumentLoader("xhr"))},r.setupGlobals=function(t){void 0===globalThis.JsonLdProcessor&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:t.JsonLdProcessor})}},736:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EntryHandlerKeywordIncluded=void 0;const i=n(2395),r=n(1548);class o extends r.EntryHandlerKeyword{constructor(){super("@included")}async handle(t,e,n,r,o,s){"object"!=typeof o&&t.emitError(new i.ErrorCoded(`Found illegal @included '${o}'`,i.ERROR_CODES.INVALID_INCLUDED_VALUE));const a=await e.unaliasKeywords(o,r,s,await t.getContext(r));"@value"in a&&t.emitError(new i.ErrorCoded(`Found an illegal @included @value node '${JSON.stringify(o)}'`,i.ERROR_CODES.INVALID_INCLUDED_VALUE)),"@list"in a&&t.emitError(new i.ErrorCoded(`Found an illegal @included @list node '${JSON.stringify(o)}'`,i.ERROR_CODES.INVALID_INCLUDED_VALUE)),t.emittedStack[s]=!1}}e.EntryHandlerKeywordIncluded=o},742:function(t,e,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),r=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(n(4806),e)},823:(t,e,n)=>{"use strict";const i=globalThis.AbortController||n(5568).AbortController,{codes:{ERR_INVALID_ARG_VALUE:r,ERR_INVALID_ARG_TYPE:o,ERR_MISSING_ARGS:s,ERR_OUT_OF_RANGE:a},AbortError:g}=n(6371),{validateAbortSignal:l,validateInteger:A,validateObject:c}=n(277),h=n(4134).Symbol("kWeak"),C=n(4134).Symbol("kResistStopPropagation"),{finished:I}=n(6238),d=n(7830),{addAbortSignalNoValidate:u}=n(4147),{isWritable:f,isNodeStream:p}=n(6115),{deprecate:v}=n(7760),{ArrayPrototypePush:m,Boolean:y,MathFloor:b,Number:w,NumberIsNaN:x,Promise:E,PromiseReject:k,PromiseResolve:S,PromisePrototypeThen:T,Symbol:O}=n(4134),R=O("kEmpty"),_=O("kEof");function N(t,e){if("function"!=typeof t)throw new o("fn",["Function","AsyncFunction"],t);null!=e&&c(e,"options"),null!=(null==e?void 0:e.signal)&&l(e.signal,"options.signal");let i=1;null!=(null==e?void 0:e.concurrency)&&(i=b(e.concurrency));let r=i-1;return null!=(null==e?void 0:e.highWaterMark)&&(r=b(e.highWaterMark)),A(i,"options.concurrency",1),A(r,"options.highWaterMark",0),r+=i,async function*(){const o=n(7760).AbortSignalAny([null==e?void 0:e.signal].filter(y)),s=this,a=[],l={signal:o};let A,c,h=!1,C=0;function I(){h=!0,d()}function d(){C-=1,u()}function u(){c&&!h&&C<i&&a.length<r&&(c(),c=null)}!async function(){try{for await(let e of s){if(h)return;if(o.aborted)throw new g;try{if(e=t(e,l),e===R)continue;e=S(e)}catch(t){e=k(t)}C+=1,T(e,d,I),a.push(e),A&&(A(),A=null),!h&&(a.length>=r||C>=i)&&await new E((t=>{c=t}))}a.push(_)}catch(t){const e=k(t);T(e,d,I),a.push(e)}finally{h=!0,A&&(A(),A=null)}}();try{for(;;){for(;a.length>0;){const t=await a[0];if(t===_)return;if(o.aborted)throw new g;t!==R&&(yield t),a.shift(),u()}await new E((t=>{A=t}))}}finally{h=!0,c&&(c(),c=null)}}.call(this)}async function D(t,e=void 0){for await(const n of P.call(this,t,e))return!0;return!1}function P(t,e){if("function"!=typeof t)throw new o("fn",["Function","AsyncFunction"],t);return N.call(this,(async function(e,n){return await t(e,n)?e:R}),e)}class M extends s{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}function L(t){if(t=w(t),x(t))return 0;if(t<0)throw new a("number",">= 0",t);return t}t.exports.streamReturningOperators={asIndexedPairs:v((function(t=void 0){return null!=t&&c(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal"),async function*(){let e=0;for await(const i of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new g({cause:t.signal.reason});yield[e++,i]}}.call(this)}),"readable.asIndexedPairs will be removed in a future version."),drop:function(t,e=void 0){return null!=e&&c(e,"options"),null!=(null==e?void 0:e.signal)&&l(e.signal,"options.signal"),t=L(t),async function*(){var n;if(null!=e&&null!==(n=e.signal)&&void 0!==n&&n.aborted)throw new g;for await(const n of this){var i;if(null!=e&&null!==(i=e.signal)&&void 0!==i&&i.aborted)throw new g;t--<=0&&(yield n)}}.call(this)},filter:P,flatMap:function(t,e){const n=N.call(this,t,e);return async function*(){for await(const t of n)yield*t}.call(this)},map:N,take:function(t,e=void 0){return null!=e&&c(e,"options"),null!=(null==e?void 0:e.signal)&&l(e.signal,"options.signal"),t=L(t),async function*(){var n;if(null!=e&&null!==(n=e.signal)&&void 0!==n&&n.aborted)throw new g;for await(const n of this){var i;if(null!=e&&null!==(i=e.signal)&&void 0!==i&&i.aborted)throw new g;if(t-- >0&&(yield n),t<=0)return}}.call(this)},compose:function(t,e){if(null!=e&&c(e,"options"),null!=(null==e?void 0:e.signal)&&l(e.signal,"options.signal"),p(t)&&!f(t))throw new r("stream",t,"must be writable");const n=d(this,t);return null!=e&&e.signal&&u(e.signal,n),n}},t.exports.promiseReturningOperators={every:async function(t,e=void 0){if("function"!=typeof t)throw new o("fn",["Function","AsyncFunction"],t);return!await D.call(this,(async(...e)=>!await t(...e)),e)},forEach:async function(t,e){if("function"!=typeof t)throw new o("fn",["Function","AsyncFunction"],t);for await(const n of N.call(this,(async function(e,n){return await t(e,n),R}),e));},reduce:async function(t,e,n){var r;if("function"!=typeof t)throw new o("reducer",["Function","AsyncFunction"],t);null!=n&&c(n,"options"),null!=(null==n?void 0:n.signal)&&l(n.signal,"options.signal");let s=arguments.length>1;if(null!=n&&null!==(r=n.signal)&&void 0!==r&&r.aborted){const t=new g(void 0,{cause:n.signal.reason});throw this.once("error",(()=>{})),await I(this.destroy(t)),t}const a=new i,A=a.signal;if(null!=n&&n.signal){const t={once:!0,[h]:this,[C]:!0};n.signal.addEventListener("abort",(()=>a.abort()),t)}let d=!1;try{for await(const i of this){var u;if(d=!0,null!=n&&null!==(u=n.signal)&&void 0!==u&&u.aborted)throw new g;s?e=await t(e,i,{signal:A}):(e=i,s=!0)}if(!d&&!s)throw new M}finally{a.abort()}return e},toArray:async function(t){null!=t&&c(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal");const e=[];for await(const i of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new g(void 0,{cause:t.signal.reason});m(e,i)}return e},some:D,find:async function(t,e){for await(const n of P.call(this,t,e))return n}}},888:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Util=void 0;const i=n(2395),r=n(7793),o=n(4860),s=n(2341);class a{constructor(t){this.parsingContext=t.parsingContext,this.dataFactory=t.dataFactory||new r.DataFactory,this.rdfFirst=this.dataFactory.namedNode(a.RDF+"first"),this.rdfRest=this.dataFactory.namedNode(a.RDF+"rest"),this.rdfNil=this.dataFactory.namedNode(a.RDF+"nil"),this.rdfType=this.dataFactory.namedNode(a.RDF+"type"),this.rdfJson=this.dataFactory.namedNode(a.RDF+"JSON")}static getContextValue(t,e,n,i){const r=t.getContextRaw()[n];if(!r)return i;const o=r[e];return void 0===o?i:o}static getContextValueContainer(t,e){return a.getContextValue(t,"@container",e,{"@set":!0})}static getContextValueType(t,e){const n=a.getContextValue(t,"@type",e,null);return"@none"===n?null:n}static getContextValueLanguage(t,e){return a.getContextValue(t,"@language",e,t.getContextRaw()["@language"]||null)}static getContextValueDirection(t,e){return a.getContextValue(t,"@direction",e,t.getContextRaw()["@direction"]||null)}static isContextValueReverse(t,e){return!!a.getContextValue(t,"@reverse",e,null)}static getContextValueIndex(t,e){return a.getContextValue(t,"@index",e,t.getContextRaw()["@index"]||null)}static isPropertyReverse(t,e,n){return"@reverse"===n!==a.isContextValueReverse(t,e)}static isPropertyInEmbeddedNode(t){return"@id"===t}static isPropertyInAnnotationObject(t){return"@annotation"===t}static isValidIri(t){return null!==t&&i.Util.isValidIri(t)}static isPrefixArray(t,e){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}async validateValueIndexes(t){if(this.parsingContext.validateValueIndexes){const e={};for(const n of t)if(n&&"object"==typeof n){const t=n["@id"],r=n["@index"];if(t&&r){const n=e[t];if(n&&n!==r)throw new i.ErrorCoded(`Conflicting @index value for ${t}`,i.ERROR_CODES.CONFLICTING_INDEXES);e[t]=r}}}}async valueToTerm(t,e,n,r,o){if("@json"===a.getContextValueType(t,e))return[this.dataFactory.literal(this.valueToJsonString(n),this.rdfJson)];const s=typeof n;switch(s){case"object":if(null==n)return[];if(Array.isArray(n))return"@list"in a.getContextValueContainer(t,e)?0===n.length?[this.rdfNil]:this.parsingContext.idStack[r+1]||[]:(await this.validateValueIndexes(n),[]);if(t=await this.getContextSelfOrPropertyScoped(t,e),"@context"in n&&(t=await this.parsingContext.parseContext(n["@context"],(await this.parsingContext.getContext(o,0)).getContextRaw())),"@value"in(n=await this.unaliasKeywords(n,o,r,t))){let s,a,g,l,A;for(e in n){const t=n[e];switch(e){case"@value":s=t;break;case"@language":a=t;break;case"@direction":g=t;break;case"@type":l=t;break;case"@index":A=t;break;case"@annotation":break;default:throw new i.ErrorCoded(`Unknown value entry '${e}' in @value: ${JSON.stringify(n)}`,i.ERROR_CODES.INVALID_VALUE_OBJECT)}}if("@json"===await this.unaliasKeyword(l,o,r,!0,t))return[this.dataFactory.literal(this.valueToJsonString(s),this.rdfJson)];if(null===s)return[];if("object"==typeof s)throw new i.ErrorCoded(`The value of an '@value' can not be an object, got '${JSON.stringify(s)}'`,i.ERROR_CODES.INVALID_VALUE_OBJECT_VALUE);if(this.parsingContext.validateValueIndexes&&A&&"string"!=typeof A)throw new i.ErrorCoded(`The value of an '@index' must be a string, got '${JSON.stringify(A)}'`,i.ERROR_CODES.INVALID_INDEX_VALUE);if(a){if("string"!=typeof s)throw new i.ErrorCoded(`When an '@language' is set, the value of '@value' must be a string, got '${JSON.stringify(s)}'`,i.ERROR_CODES.INVALID_LANGUAGE_TAGGED_VALUE);if(!i.ContextParser.validateLanguage(a,this.parsingContext.strictValues,i.ERROR_CODES.INVALID_LANGUAGE_TAGGED_STRING))return[];(this.parsingContext.normalizeLanguageTags||1===this.parsingContext.activeProcessingMode)&&(a=a.toLowerCase())}if(g){if("string"!=typeof s)throw new Error(`When an '@direction' is set, the value of '@value' must be a string, got '${JSON.stringify(s)}'`);if(!i.ContextParser.validateDirection(g,this.parsingContext.strictValues))return[]}if(a&&g){if(l)throw new i.ErrorCoded(`Can not have '@language', '@direction' and '@type' in a value: '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_VALUE_OBJECT);return this.nullableTermToArray(this.createLanguageDirectionLiteral(r,s,a,g))}if(a){if(l)throw new i.ErrorCoded(`Can not have both '@language' and '@type' in a value: '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_VALUE_OBJECT);return[this.dataFactory.literal(s,a)]}if(g){if(l)throw new i.ErrorCoded(`Can not have both '@direction' and '@type' in a value: '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_VALUE_OBJECT);return this.nullableTermToArray(this.createLanguageDirectionLiteral(r,s,a,g))}if(l){if("string"!=typeof l)throw new i.ErrorCoded(`The value of an '@type' must be a string, got '${JSON.stringify(l)}'`,i.ERROR_CODES.INVALID_TYPED_VALUE);const e=this.createVocabOrBaseTerm(t,l);if(!e)throw new i.ErrorCoded(`Invalid '@type' value, got '${JSON.stringify(l)}'`,i.ERROR_CODES.INVALID_TYPED_VALUE);if("NamedNode"!==e.termType)throw new i.ErrorCoded(`Illegal value type (${e.termType}): ${l}`,i.ERROR_CODES.INVALID_TYPED_VALUE);return[this.dataFactory.literal(s,e)]}return await this.valueToTerm(new i.JsonLdContextNormalized({}),e,s,r,o)}if("@set"in n){if(Object.keys(n).length>1)throw new i.ErrorCoded(`Found illegal neighbouring entries next to @set for key: '${e}'`,i.ERROR_CODES.INVALID_SET_OR_LIST_OBJECT);return[]}if("@list"in n){if(Object.keys(n).length>1)throw new i.ErrorCoded(`Found illegal neighbouring entries next to @list for key: '${e}'`,i.ERROR_CODES.INVALID_SET_OR_LIST_OBJECT);const t=n["@list"];return Array.isArray(t)?0===t.length?[this.rdfNil]:this.parsingContext.idStack[r+1]||[]:await this.valueToTerm(await this.parsingContext.getContext(o),e,t,r-1,o.slice(0,-1))}if("@reverse"in n&&"boolean"==typeof n["@reverse"])return[];if("@graph"in a.getContextValueContainer(await this.parsingContext.getContext(o),e)){const t=this.parsingContext.graphContainerTermStack[r+1];return t?Object.values(t):[this.dataFactory.blankNode()]}if("@id"in n){if(Object.keys(n).length>1&&(t=await this.parsingContext.getContext(o,0)),"@context"in n&&(t=await this.parsingContext.parseContext(n["@context"],t.getContextRaw())),"@vocab"===n["@type"])return this.nullableTermToArray(this.createVocabOrBaseTerm(t,n["@id"]));{const e=n["@id"];let o;if("object"==typeof e){if(!this.parsingContext.rdfstar)throw new i.ErrorCoded(`Found illegal @id '${n}'`,i.ERROR_CODES.INVALID_ID_VALUE);o=this.parsingContext.idStack[r+1][0]}else o=this.resourceToTerm(t,e);return this.nullableTermToArray(o)}}return this.parsingContext.emittedStack[r+1]||n&&"object"==typeof n&&0===Object.keys(n).length?this.parsingContext.idStack[r+1]||(this.parsingContext.idStack[r+1]=[this.dataFactory.blankNode()]):[];case"string":return this.nullableTermToArray(this.stringValueToTerm(r,await this.getContextSelfOrPropertyScoped(t,e),e,n,null));case"boolean":return this.nullableTermToArray(this.stringValueToTerm(r,await this.getContextSelfOrPropertyScoped(t,e),e,Boolean(n).toString(),this.dataFactory.namedNode(a.XSD_BOOLEAN)));case"number":return this.nullableTermToArray(this.stringValueToTerm(r,await this.getContextSelfOrPropertyScoped(t,e),e,n,this.dataFactory.namedNode(n%1==0&&n<1e21?a.XSD_INTEGER:a.XSD_DOUBLE)));default:return this.parsingContext.emitError(new Error(`Could not determine the RDF type of a ${s}`)),[]}}async getContextSelfOrPropertyScoped(t,e){const n=t.getContextRaw()[e];return n&&"object"==typeof n&&"@context"in n&&(t=await this.parsingContext.parseContext(n,t.getContextRaw(),!0)),t}nullableTermToArray(t){return t?[t]:[]}predicateToTerm(t,e){const n=t.expandTerm(e,!0,this.parsingContext.getExpandOptions());return n?"_"===n[0]&&":"===n[1]?this.parsingContext.produceGeneralizedRdf?this.dataFactory.blankNode(n.substr(2)):null:a.isValidIri(n)?this.dataFactory.namedNode(n):n&&this.parsingContext.strictValues?(this.parsingContext.emitError(new i.ErrorCoded(`Invalid predicate IRI: ${n}`,i.ERROR_CODES.INVALID_IRI_MAPPING)),null):null:null}resourceToTerm(t,e){if(e.startsWith("_:"))return this.dataFactory.blankNode(e.substr(2));const n=t.expandTerm(e,!1,this.parsingContext.getExpandOptions());if(!a.isValidIri(n)){if(!n||!this.parsingContext.strictValues)return null;this.parsingContext.emitError(new Error(`Invalid resource IRI: ${n}`))}return this.dataFactory.namedNode(n)}createVocabOrBaseTerm(t,e){if(e.startsWith("_:"))return this.dataFactory.blankNode(e.substr(2));const n=this.parsingContext.getExpandOptions();let i=t.expandTerm(e,!0,n);if(i===e&&(i=t.expandTerm(e,!1,n)),!a.isValidIri(i)){if(!i||!this.parsingContext.strictValues||i.startsWith("@"))return null;this.parsingContext.emitError(new Error(`Invalid term IRI: ${i}`))}return this.dataFactory.namedNode(i)}intToString(t,e){return"number"==typeof t?Number.isFinite(t)?t%1!=0||e&&e.value===a.XSD_DOUBLE?t.toExponential(15).replace(/(\d)0*e\+?/,"$1E"):Number(t).toString():t>0?"INF":"-INF":t}stringValueToTerm(t,e,n,i,r){const o=a.getContextValueType(e,n);if(o)if("@id"===o){if(!r)return this.resourceToTerm(e,this.intToString(i,r))}else if("@vocab"===o){if(!r)return this.createVocabOrBaseTerm(e,this.intToString(i,r))}else r=this.dataFactory.namedNode(o);if(!r){const o=a.getContextValueLanguage(e,n),s=a.getContextValueDirection(e,n);return s?this.createLanguageDirectionLiteral(t,this.intToString(i,r),o,s):this.dataFactory.literal(this.intToString(i,r),o)}return this.dataFactory.literal(this.intToString(i,r),r)}createLanguageDirectionLiteral(t,e,n,i){if("i18n-datatype"===this.parsingContext.rdfDirection)return n||(n=""),this.dataFactory.literal(e,this.dataFactory.namedNode(`https://www.w3.org/ns/i18n#${n}_${i}`));if("compound-literal"===this.parsingContext.rdfDirection){const r=this.dataFactory.blankNode(),o=this.getDefaultGraph();return this.parsingContext.emitQuad(t,this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"value"),this.dataFactory.literal(e),o)),n&&this.parsingContext.emitQuad(t,this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"language"),this.dataFactory.literal(n),o)),this.parsingContext.emitQuad(t,this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"direction"),this.dataFactory.literal(i),o)),r}return this.dataFactory.literal(e,{language:n||"",direction:i})}valueToJsonString(t){return s(t)}async unaliasKeyword(t,e,n,r,o){if(Number.isInteger(t))return t;if(!r){const t=this.parsingContext.unaliasedKeywordCacheStack[n];if(t)return t}if(!i.Util.isPotentialKeyword(t)){let n=(o=o||await this.parsingContext.getContext(e)).getContextRaw()[t];n&&"object"==typeof n&&(n=n["@id"]),i.Util.isValidKeyword(n)&&(t=n)}return r?t:this.parsingContext.unaliasedKeywordCacheStack[n]=t}async unaliasKeywordParent(t,e){return await this.unaliasKeyword(e>0&&t[e-1],t,e-1)}async unaliasKeywords(t,e,n,i){const r={};for(const o in t)r[await this.unaliasKeyword(o,e,n+1,!0,i)]=t[o];return r}async isLiteral(t,e){for(let n=e;n>=0;n--){if("@annotation"===await this.unaliasKeyword(t[n],t,n))return!1;if(this.parsingContext.literalStack[n]||this.parsingContext.jsonLiteralStack[n])return!0}return!1}async getDepthOffsetGraph(t,e){for(let n=t-1;n>0;n--)if("@graph"===await this.unaliasKeyword(e[n],e,n)){const i=(await o.EntryHandlerContainer.getContainerHandler(this.parsingContext,e,n)).containers;return o.EntryHandlerContainer.isComplexGraphContainer(i)?-1:t-n-1}return-1}validateReverseSubject(t){if("Literal"===t.termType)throw new i.ErrorCoded(`Found illegal literal in subject position: ${t.value}`,i.ERROR_CODES.INVALID_REVERSE_PROPERTY_VALUE)}getDefaultGraph(){return this.parsingContext.defaultGraph||this.dataFactory.defaultGraph()}async getGraphContainerValue(t,e){let n=this.getDefaultGraph();const{containers:i,depth:r}=await o.EntryHandlerContainer.getContainerHandler(this.parsingContext,t,e);if("@graph"in i){const e=o.EntryHandlerContainer.getContainerGraphIndex(i,r,t),s=this.parsingContext.graphContainerTermStack[r];if(n=s?s[e]:null,!n){let o=null;if("@id"in i){const e=await this.getContainerKey(t[r],t,r);null!==e&&(o=await this.resourceToTerm(await this.parsingContext.getContext(t),e))}o||(o=this.dataFactory.blankNode()),this.parsingContext.graphContainerTermStack[r]||(this.parsingContext.graphContainerTermStack[r]={}),n=this.parsingContext.graphContainerTermStack[r][e]=o}}return n}async getPropertiesDepth(t,e){let n=e;for(let i=e-1;i>0;i--)if("number"!=typeof t[i]){const e=await this.unaliasKeyword(t[i],t,i);if("@reverse"===e)return i;if("@nest"!==e)return n;n=i}return n}async getContainerKey(t,e,n){const i=await this.unaliasKeyword(t,e,n);return"@none"===i?null:i}validateReverseInEmbeddedNode(t,e,n){if(n&&e&&!this.parsingContext.rdfstarReverseInEmbedded)throw new i.ErrorCoded(`Illegal reverse property in embedded node in ${t}`,i.ERROR_CODES.INVALID_EMBEDDED_NODE)}emitQuadChecked(t,e,n,r,o,s,a){let g;if(s?(this.validateReverseSubject(r),g=this.dataFactory.quad(r,n,e,o)):g=this.dataFactory.quad(e,n,r,o),a){if("DefaultGraph"!==g.graph.termType&&(g=this.dataFactory.quad(g.subject,g.predicate,g.object)),this.parsingContext.idStack[t-1])throw new i.ErrorCoded("Illegal multiple properties in an embedded node",i.ERROR_CODES.INVALID_EMBEDDED_NODE);this.parsingContext.idStack[t-1]=[g]}else this.parsingContext.emitQuad(t,g);const l=this.parsingContext.annotationsBuffer[t];if(l){for(const e of l)this.emitAnnotation(t,g,e);delete this.parsingContext.annotationsBuffer[t]}}emitAnnotation(t,e,n){let i;n.reverse?(this.validateReverseSubject(n.object),i=this.dataFactory.quad(n.object,n.predicate,e)):i=this.dataFactory.quad(e,n.predicate,n.object),this.parsingContext.emitQuad(t,i);for(const e of n.nestedAnnotations)this.emitAnnotation(t,i,e)}}e.Util=a,a.XSD="http://www.w3.org/2001/XMLSchema#",a.XSD_BOOLEAN=a.XSD+"boolean",a.XSD_INTEGER=a.XSD+"integer",a.XSD_DOUBLE=a.XSD+"double",a.RDF="http://www.w3.or