UNPKG

jsonld

Version:

A JSON-LD Processor and API implementation in JavaScript.

2 lines 197 kB
/*! For license information please see jsonld.min.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.jsonld=t():e.jsonld=t()}(this,()=>(()=>{var e={34:(e,t,n)=>{"use strict";var r=n(4901);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},81:(e,t,n)=>{"use strict";var r=n(9565),o=n(9306),i=n(8551),a=n(6823),s=n(851),c=TypeError;e.exports=function(e,t){var n=arguments.length<2?s(e):t;if(o(n))return i(r(n,e));throw new c(a(e)+" is not iterable")}},256:(e,t,n)=>{"use strict";const r=n(8937),{isArray:o,isObject:i,isString:a,isUndefined:s}=n(4340),{isList:c,isValue:u,isGraph:l,isSimpleGraph:d,isSubjectReference:p}=n(2460),{expandIri:f,getContextValue:h,isKeyword:v,process:g,processingMode:y}=n(394),{removeBase:x,prependBase:m}=n(4540),{REGEX_KEYWORD:w,addValue:b,asArray:I,compareShortestLeast:S}=n(1869),j={};function E(e,t,n){if("@nest"!==f(e,t,{vocab:!0},n))throw new r("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}e.exports=j,j.compact=async({activeCtx:e,activeProperty:t=null,element:n,options:f={}})=>{if(o(n)){let r=[];for(let o=0;o<n.length;++o){const i=await j.compact({activeCtx:e,activeProperty:t,element:n[o],options:f});null!==i&&r.push(i)}return f.compactArrays&&1===r.length&&0===(h(e,t,"@container")||[]).length&&(r=r[0]),r}const x=h(e,t,"@context");if(s(x)||(e=await g({activeCtx:e,localCtx:x,propagate:!0,overrideProtected:!0,options:f})),i(n)){if(f.link&&"@id"in n&&f.link.hasOwnProperty(n["@id"])){const e=f.link[n["@id"]];for(let t=0;t<e.length;++t)if(e[t].expanded===n)return e[t].compacted}if(u(n)||p(n)){const r=j.compactValue({activeCtx:e,activeProperty:t,value:n,options:f});return f.link&&p(n)&&(f.link.hasOwnProperty(n["@id"])||(f.link[n["@id"]]=[]),f.link[n["@id"]].push({expanded:n,compacted:r})),r}if(c(n)&&(h(e,t,"@container")||[]).includes("@list"))return j.compact({activeCtx:e,activeProperty:t,element:n["@list"],options:f});const x="@reverse"===t,m={},w=e;u(n)||p(n)||(e=e.revertToPreviousContext());const S=h(w,t,"@context");s(S)||(e=await g({activeCtx:e,localCtx:S,propagate:!0,overrideProtected:!0,options:f})),f.link&&"@id"in n&&(f.link.hasOwnProperty(n["@id"])||(f.link[n["@id"]]=[]),f.link[n["@id"]].push({expanded:n,compacted:m}));let O=n["@type"]||[];O.length>1&&(O=Array.from(O).sort());const A=e;for(const t of O){const n=j.compactIri({activeCtx:A,iri:t,relativeTo:{vocab:!0}}),r=h(w,n,"@context");s(r)||(e=await g({activeCtx:e,localCtx:r,options:f,propagate:!1}))}const D=Object.keys(n).sort();for(const s of D){const p=n[s];if("@id"===s){let t=I(p).map(t=>j.compactIri({activeCtx:e,iri:t,relativeTo:{vocab:!1},base:f.base}));1===t.length&&(t=t[0]),m[j.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]=t;continue}if("@type"===s){let t=I(p).map(e=>j.compactIri({activeCtx:w,iri:e,relativeTo:{vocab:!0}}));1===t.length&&(t=t[0]);const n=j.compactIri({activeCtx:e,iri:"@type",relativeTo:{vocab:!0}}),r=(h(e,n,"@container")||[]).includes("@set")&&y(e,1.1)||o(t)&&0===p.length;b(m,n,t,{propertyIsArray:r});continue}if("@reverse"===s){const t=await j.compact({activeCtx:e,activeProperty:"@reverse",element:p,options:f});for(const n in t)if(e.mappings.has(n)&&e.mappings.get(n).reverse){const r=t[n],o=(h(e,n,"@container")||[]).includes("@set")||!f.compactArrays;b(m,n,r,{propertyIsArray:o}),delete t[n]}if(Object.keys(t).length>0){const n=j.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});b(m,n,t)}continue}if("@preserve"===s){const n=await j.compact({activeCtx:e,activeProperty:t,element:p,options:f});o(n)&&0===n.length||b(m,s,n);continue}if("@index"===s){if((h(e,t,"@container")||[]).includes("@index"))continue;const n=j.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});b(m,n,p);continue}if("@graph"!==s&&"@list"!==s&&"@included"!==s&&v(s)){const t=j.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});b(m,t,p);continue}if(!o(p))throw new r("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(0===p.length){const t=j.compactIri({activeCtx:e,iri:s,value:p,relativeTo:{vocab:!0},reverse:x}),n=e.mappings.has(t)?e.mappings.get(t)["@nest"]:null;let r=m;n&&(E(e,n,f),i(m[n])||(m[n]={}),r=m[n]),b(r,t,p,{propertyIsArray:!0})}for(const t of p){const n=j.compactIri({activeCtx:e,iri:s,value:t,relativeTo:{vocab:!0},reverse:x}),r=e.mappings.has(n)?e.mappings.get(n)["@nest"]:null;let p=m;r&&(E(e,r,f),i(m[r])||(m[r]={}),p=m[r]);const v=h(e,n,"@container")||[],g=l(t),y=c(t);let w;y?w=t["@list"]:g&&(w=t["@graph"]);let S=await j.compact({activeCtx:e,activeProperty:n,element:y||g?w:t,options:f});if(y){if(o(S)||(S=[S]),v.includes("@list")){b(p,n,S,{valueIsArray:!0,allowDuplicate:!0});continue}S={[j.compactIri({activeCtx:e,iri:"@list",relativeTo:{vocab:!0}})]:S},"@index"in t&&(S[j.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=t["@index"])}if(g)if(v.includes("@graph")&&(v.includes("@id")||v.includes("@index")&&d(t))){let r;p.hasOwnProperty(n)?r=p[n]:p[n]=r={};const o=(v.includes("@id")?t["@id"]:t["@index"])||j.compactIri({activeCtx:e,iri:"@none",relativeTo:{vocab:!0}});b(r,o,S,{propertyIsArray:!f.compactArrays||v.includes("@set")})}else v.includes("@graph")&&d(t)?(o(S)&&S.length>1&&(S={"@included":S}),b(p,n,S,{propertyIsArray:!f.compactArrays||v.includes("@set")})):(o(S)&&1===S.length&&f.compactArrays&&(S=S[0]),S={[j.compactIri({activeCtx:e,iri:"@graph",relativeTo:{vocab:!0}})]:S},"@id"in t&&(S[j.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]=t["@id"]),"@index"in t&&(S[j.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=t["@index"]),b(p,n,S,{propertyIsArray:!f.compactArrays||v.includes("@set")}));else if(v.includes("@language")||v.includes("@index")||v.includes("@id")||v.includes("@type")){let r,o;if(p.hasOwnProperty(n)?r=p[n]:p[n]=r={},v.includes("@language"))u(S)&&(S=S["@value"]),o=t["@language"];else if(v.includes("@index")){const r=h(e,n,"@index")||"@index",i=j.compactIri({activeCtx:e,iri:r,relativeTo:{vocab:!0}});if("@index"===r)o=t["@index"],delete S[i];else{let e;if([o,...e]=I(S[r]||[]),a(o))switch(e.length){case 0:delete S[r];break;case 1:S[r]=e[0];break;default:S[r]=e}else o=null}}else if(v.includes("@id")){const t=j.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}});o=S[t],delete S[t]}else if(v.includes("@type")){const r=j.compactIri({activeCtx:e,iri:"@type",relativeTo:{vocab:!0}});let i;switch([o,...i]=I(S[r]||[]),i.length){case 0:delete S[r];break;case 1:S[r]=i[0];break;default:S[r]=i}1===Object.keys(S).length&&"@id"in t&&(S=await j.compact({activeCtx:e,activeProperty:n,element:{"@id":t["@id"]},options:f}))}o||(o=j.compactIri({activeCtx:e,iri:"@none",relativeTo:{vocab:!0}})),b(r,o,S,{propertyIsArray:v.includes("@set")})}else{const e=!f.compactArrays||v.includes("@set")||v.includes("@list")||o(S)&&0===S.length||"@list"===s||"@graph"===s;b(p,n,S,{propertyIsArray:e})}}}return m}return n},j.compactIri=({activeCtx:e,iri:t,value:n=null,relativeTo:o={vocab:!1},reverse:a=!1,base:s=null})=>{if(null===t)return t;e.isPropertyTermScoped&&e.previousContext&&(e=e.previousContext);const d=e.getInverse();if(v(t)&&t in d&&"@none"in d[t]&&"@type"in d[t]["@none"]&&"@none"in d[t]["@none"]["@type"])return d[t]["@none"]["@type"]["@none"];if(o.vocab&&t in d){const r=e["@language"]||"@none",o=[];i(n)&&"@index"in n&&!("@graph"in n)&&o.push("@index","@index@set"),i(n)&&"@preserve"in n&&(n=n["@preserve"][0]),l(n)?("@index"in n&&o.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in n&&o.push("@graph@id","@graph@id@set"),o.push("@graph","@graph@set","@set"),"@index"in n||o.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in n||o.push("@graph@id","@graph@id@set")):i(n)&&!u(n)&&o.push("@id","@id@set","@type","@set@type");let s="@language",d="@null";if(a)s="@type",d="@reverse",o.push("@set");else if(c(n)){"@index"in n||o.push("@list");const e=n["@list"];if(0===e.length)s="@any",d="@none";else{let t=0===e.length?r:null,n=null;for(let r=0;r<e.length;++r){const o=e[r];let i="@none",a="@none";if(u(o)?"@direction"in o?i=`${(o["@language"]||"").toLowerCase()}_${o["@direction"]}`:"@language"in o?i=o["@language"].toLowerCase():"@type"in o?a=o["@type"]:i="@null":a="@id",null===t?t=i:i!==t&&u(o)&&(t="@none"),null===n?n=a:a!==n&&(n="@none"),"@none"===t&&"@none"===n)break}t=t||"@none",n=n||"@none","@none"!==n?(s="@type",d=n):d=t}}else{if(u(n))if("@language"in n&&!("@index"in n)){o.push("@language","@language@set"),d=n["@language"];const e=n["@direction"];e&&(d=`${d}_${e}`)}else"@direction"in n&&!("@index"in n)?d=`_${n["@direction"]}`:"@type"in n&&(s="@type",d=n["@type"]);else s="@type",d="@id";o.push("@set")}o.push("@none"),i(n)&&!("@index"in n)&&o.push("@index","@index@set"),u(n)&&1===Object.keys(n).length&&o.push("@language","@language@set");const p=function(e,t,n,r,o,a){null===a&&(a="@null");const s=[];if(("@id"===a||"@reverse"===a)&&i(n)&&"@id"in n){"@reverse"===a&&s.push("@reverse");const t=j.compactIri({activeCtx:e,iri:n["@id"],relativeTo:{vocab:!0}});e.mappings.has(t)&&e.mappings.get(t)&&e.mappings.get(t)["@id"]===n["@id"]?s.push.apply(s,["@vocab","@id"]):s.push.apply(s,["@id","@vocab"])}else{s.push(a);const e=s.find(e=>e.includes("_"));e&&s.push(e.replace(/^[^_]+_/,"_"))}s.push("@none");const c=e.inverse[t];for(const e of r){if(!(e in c))continue;const t=c[e][o];for(const e of s)if(e in t)return t[e]}return null}(e,t,n,o,s,d);if(null!==p)return p}if(o.vocab&&"@vocab"in e){const n=e["@vocab"];if(0===t.indexOf(n)&&t!==n){const r=t.substr(n.length);if(!e.mappings.has(r))return r}}let p=null;const f=[];let h=e.fastCurieMap;const g=t.length-1;for(let e=0;e<g&&t[e]in h;++e)h=h[t[e]],""in h&&f.push(h[""][0]);for(let r=f.length-1;r>=0;--r){const o=f[r],i=o.terms;for(const r of i){const i=r+":"+t.substr(o.iri.length);e.mappings.get(r)._prefix&&(!e.mappings.has(i)||null===n&&e.mappings.get(i)["@id"]===t)&&(null===p||S(i,p)<0)&&(p=i)}}if(null!==p)return p;for(const[n,o]of e.mappings)if(o&&o._prefix&&t.startsWith(n+":"))throw new r(`Absolute IRI "${t}" confused with prefix "${n}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:e});if(!o.vocab){if("@base"in e){if(e["@base"]){const n=x(m(s,e["@base"]),t);return w.test(n)?`./${n}`:n}return t}return x(s,t)}return t},j.compactValue=({activeCtx:e,activeProperty:t,value:n,options:r})=>{if(u(n)){const r=h(e,t,"@type"),o=h(e,t,"@language"),i=h(e,t,"@direction"),s=h(e,t,"@container")||[],c="@index"in n&&!s.includes("@index");if(!c&&"@none"!==r){if(n["@type"]===r)return n["@value"];if("@language"in n&&n["@language"]===o&&"@direction"in n&&n["@direction"]===i)return n["@value"];if("@language"in n&&n["@language"]===o)return n["@value"];if("@direction"in n&&n["@direction"]===i)return n["@value"]}const u=Object.keys(n).length,l=1===u||2===u&&"@index"in n&&!c,d="@language"in e,p=a(n["@value"]),f=e.mappings.has(t)&&null===e.mappings.get(t)["@language"];if(l&&"@none"!==r&&(!d||!p||f))return n["@value"];const v={};return c&&(v[j.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=n["@index"]),"@type"in n?v[j.compactIri({activeCtx:e,iri:"@type",relativeTo:{vocab:!0}})]=j.compactIri({activeCtx:e,iri:n["@type"],relativeTo:{vocab:!0}}):"@language"in n&&(v[j.compactIri({activeCtx:e,iri:"@language",relativeTo:{vocab:!0}})]=n["@language"]),"@direction"in n&&(v[j.compactIri({activeCtx:e,iri:"@direction",relativeTo:{vocab:!0}})]=n["@direction"]),v[j.compactIri({activeCtx:e,iri:"@value",relativeTo:{vocab:!0}})]=n["@value"],v}const o=f(e,t,{vocab:!0},r),i=h(e,t,"@type"),s=j.compactIri({activeCtx:e,iri:n["@id"],relativeTo:{vocab:"@vocab"===i},base:r.base});return"@id"===i||"@vocab"===i||"@graph"===o?s:{[j.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]:s}}},283:(e,t,n)=>{"use strict";var r=n(9504),o=n(9039),i=n(4901),a=n(9297),s=n(3724),c=n(350).CONFIGURABLE,u=n(3706),l=n(1181),d=l.enforce,p=l.get,f=String,h=Object.defineProperty,v=r("".slice),g=r("".replace),y=r([].join),x=s&&!o(function(){return 8!==h(function(){},"length",{value:8}).length}),m=String(String).split("String"),w=e.exports=function(e,t,n){"Symbol("===v(f(t),0,7)&&(t="["+g(f(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!a(e,"name")||c&&e.name!==t)&&(s?h(e,"name",{value:t,configurable:!0}):e.name=t),x&&n&&a(n,"arity")&&e.length!==n.arity&&h(e,"length",{value:n.arity});try{n&&a(n,"constructor")&&n.constructor?s&&h(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=d(e);return a(r,"source")||(r.source=y(m,"string"==typeof t?t:"")),e};Function.prototype.toString=w(function(){return i(this)&&p(this).source||u(this)},"toString")},350:(e,t,n)=>{"use strict";var r=n(3724),o=n(9297),i=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,s=o(i,"name"),c=s&&"something"===function(){}.name,u=s&&(!r||r&&a(i,"name").configurable);e.exports={EXISTS:s,PROPER:c,CONFIGURABLE:u}},370:(e,t,n)=>{"use strict";const{createNodeMap:r}=n(1523),{isKeyword:o}=n(394),i=n(2460),a=n(831),s=n(8937),c=n(4340),u=n(1869),{handleEvent:l}=n(9792),{RDF_FIRST:d,RDF_REST:p,RDF_NIL:f,RDF_TYPE:h,RDF_JSON_LITERAL:v,RDF_LANGSTRING:g,XSD_BOOLEAN:y,XSD_DOUBLE:x,XSD_INTEGER:m,XSD_STRING:w}=n(8260),{isAbsolute:b}=n(4540),I={};function S(e,t,n,r,i){const a=Object.keys(t).sort();for(const s of a){const a=t[s],c=Object.keys(a).sort();for(let t of c){const c=a[t];if("@type"===t)t=h;else if(o(t))continue;for(const o of c){const a=E(s);if(!b(s)){i.eventHandler&&l({event:{type:["JsonLdEvent"],code:"relative subject reference",level:"warning",message:"Relative subject reference found.",details:{subject:s}},options:i});continue}const c=E(t);if(!b(t)){i.eventHandler&&l({event:{type:["JsonLdEvent"],code:"relative predicate reference",level:"warning",message:"Relative predicate reference found.",details:{predicate:t}},options:i});continue}if("BlankNode"===c.termType&&!i.produceGeneralizedRdf){i.eventHandler&&l({event:{type:["JsonLdEvent"],code:"blank node predicate",level:"warning",message:"Dropping blank node predicate.",details:{property:r.getOldIds().find(e=>r.getId(e)===t)}},options:i});continue}const u=j(o,r,e,n,i.rdfDirection,i);u&&e.push({subject:a,predicate:c,object:u,graph:n})}}}}function j(e,t,n,r,o,u){let h;if(i.isValue(e)){h={termType:"Literal",value:void 0,datatype:{termType:"NamedNode"}};let t=e["@value"];const n=e["@type"]||null;if("@json"===n)h.value=a(t),h.datatype.value=v;else if(c.isBoolean(t))h.value=t.toString(),h.datatype.value=n||y;else if(c.isDouble(t)||n===x)c.isDouble(t)||(t=parseFloat(t)),h.value=t.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),h.datatype.value=n||x;else if(c.isNumber(t))h.value=t.toFixed(0),h.datatype.value=n||m;else if("@direction"in e&&"i18n-datatype"===o){const n=`https://www.w3.org/ns/i18n#${(e["@language"]||"").toLowerCase()}_${e["@direction"]}`;h.datatype.value=n,h.value=t}else{if("@direction"in e&&"compound-literal"===o)throw new s("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:o});if("@direction"in e&&o)throw new s("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:o});"@language"in e?("@direction"in e&&!o&&u.eventHandler&&l({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:h.value}},options:u}),h.value=t,h.datatype.value=n||g,h.language=e["@language"]):("@direction"in e&&!o&&u.eventHandler&&l({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:h.value}},options:u}),h.value=t,h.datatype.value=n||w)}}else if(i.isList(e)){const i=function(e,t,n,r,o,i){const a={termType:"NamedNode",value:d},s={termType:"NamedNode",value:p},c={termType:"NamedNode",value:f},u=e.pop(),l=u?{termType:"BlankNode",value:t.getId().slice(2)}:c;let h=l;for(const c of e){const e=j(c,t,n,r,o,i),u={termType:"BlankNode",value:t.getId().slice(2)};n.push({subject:h,predicate:a,object:e,graph:r}),n.push({subject:h,predicate:s,object:u,graph:r}),h=u}if(u){const e=j(u,t,n,r,o,i);n.push({subject:h,predicate:a,object:e,graph:r}),n.push({subject:h,predicate:s,object:c,graph:r})}return l}(e["@list"],t,n,r,o,u);h={termType:i.termType,value:i.value}}else h=E(c.isObject(e)?e["@id"]:e);return"NamedNode"!==h.termType||b(h.value)?h:(u.eventHandler&&l({event:{type:["JsonLdEvent"],code:"relative object reference",level:"warning",message:"Relative object reference found.",details:{object:h.value}},options:u}),null)}function E(e){return e.startsWith("_:")?{termType:"BlankNode",value:e.slice(2)}:{termType:"NamedNode",value:e}}e.exports=I,I.toRDF=(e,t)=>{const n=new u.IdentifierIssuer("_:b"),o={"@default":{}};r(e,o,"@default",n);const i=[],a=Object.keys(o).sort();for(const e of a){let r;if("@default"===e)r={termType:"DefaultGraph",value:""};else{if(!b(e)){t.eventHandler&&l({event:{type:["JsonLdEvent"],code:"relative graph reference",level:"warning",message:"Relative graph reference found.",details:{graph:e}},options:t});continue}r=E(e)}S(i,o[e],r,n,t)}return i}},373:(e,t,n)=>{"use strict";var r=n(4576),o=n(7476),i=n(9039),a=n(9306),s=n(4488),c=n(4644),u=n(3709),l=n(3763),d=n(9519),p=n(3607),f=c.aTypedArray,h=c.exportTypedArrayMethod,v=r.Uint16Array,g=v&&o(v.prototype.sort),y=!(!g||i(function(){g(new v(2),null)})&&i(function(){g(new v(2),{})})),x=!!g&&!i(function(){if(d)return d<74;if(u)return u<67;if(l)return!0;if(p)return p<602;var e,t,n=new v(516),r=Array(516);for(e=0;e<516;e++)t=e%4,n[e]=515-e,r[e]=e-2*t+3;for(g(n,function(e,t){return(e/4|0)-(t/4|0)}),e=0;e<516;e++)if(n[e]!==r[e])return!0});h("sort",function(e){return void 0!==e&&a(e),x?g(this,e):s(f(this),function(e){return function(t,n){return void 0!==e?+e(t,n)||0:n!=n?-1:t!=t?1:0===t&&0===n?1/t>0&&1/n<0?1:-1:t>n}}(e))},!x||y)},394:(e,t,n)=>{"use strict";const r=n(1869),o=n(8937),{isArray:i,isObject:a,isString:s,isUndefined:c}=n(4340),{isAbsolute:u,isRelative:l,prependBase:d}=n(4540),{handleEvent:p}=n(9792),{REGEX_BCP47:f,REGEX_KEYWORD:h,asArray:v,compareShortestLeast:g}=n(1869),y=new Map,x={};function m(e,t,n,r,o,i){if(null===t||!s(t)||x.isKeyword(t))return t;if(t.match(h))return null;if(r&&r.hasOwnProperty(t)&&!0!==o.get(t)&&x.createTermDefinition({activeCtx:e,localCtx:r,term:t,defined:o,options:i}),(n=n||{}).vocab){const n=e.mappings.get(t);if(null===n)return null;if(a(n)&&"@id"in n)return n["@id"]}const c=t.indexOf(":");if(c>0){const n=t.substr(0,c),a=t.substr(c+1);if("_"===n||0===a.indexOf("//"))return t;r&&r.hasOwnProperty(n)&&x.createTermDefinition({activeCtx:e,localCtx:r,term:n,defined:o,options:i});const s=e.mappings.get(n);if(s&&s._prefix)return s["@id"]+a;if(u(t))return t}if(n.vocab&&"@vocab"in e)t=e["@vocab"]+t;else if(n.base){let n,r;"@base"in e?e["@base"]?(r=d(i.base,e["@base"]),n=d(r,t)):(r=e["@base"],n=t):(r=i.base,n=d(i.base,t)),t=n}return t}function w(e,t){if(!e||"object"!=typeof e||!t||"object"!=typeof t)return e===t;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!w(e[n],t[n]))return!1;return!0}const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(const n in e){let r=e[n],o=t[n];if("@container"===n&&Array.isArray(r)&&Array.isArray(o)&&(r=r.slice().sort(),o=o.slice().sort()),!w(r,o))return!1}return!0}e.exports=x,x.process=async({activeCtx:e,localCtx:t,options:n,propagate:r=!0,overrideProtected:c=!1,cycles:h=new Set})=>{if(a(t)&&"@context"in t&&i(t["@context"])&&(t=t["@context"]),0===v(t).length)return e;const g=[],y=[({event:e,next:t})=>{g.push(e),t()}];n.eventHandler&&y.push(n.eventHandler);const w=n;n={...n,eventHandler:y};const b=await n.contextResolver.resolve({activeCtx:e,context:t,documentLoader:n.documentLoader,base:n.base});a(b[0].document)&&"boolean"==typeof b[0].document["@propagate"]&&(r=b[0].document["@propagate"]);let I=e;r||I.previousContext||(I=I.clone(),I.previousContext=e);for(const r of b){let{document:i}=r;if(e=I,null===i){if(!c&&0!==Object.keys(e.protected).length)throw new o("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});I=e=x.getInitialContext(n).clone();continue}const v=r.getProcessed(e);if(v){if(w.eventHandler)for(const e of v.events)p({event:e,options:w});I=e=v.context;continue}if(a(i)&&"@context"in i&&(i=i["@context"]),!a(i))throw new o("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:i});I=I.clone();const y=new Map;if("@version"in i){if(1.1!==i["@version"])throw new o("Unsupported JSON-LD version: "+i["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:i});if(e.processingMode&&"json-ld-1.0"===e.processingMode)throw new o("@version: "+i["@version"]+" not compatible with "+e.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:i});I.processingMode="json-ld-1.1",I["@version"]=i["@version"],y.set("@version",!0)}if(I.processingMode=I.processingMode||e.processingMode,"@base"in i){let e=i["@base"];if(null===e||u(e));else{if(!l(e))throw new o('Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI, a relative IRI, or null.',"jsonld.SyntaxError",{code:"invalid base IRI",context:i});e=d(I["@base"],e)}I["@base"]=e,y.set("@base",!0)}if("@vocab"in i){const e=i["@vocab"];if(null===e)delete I["@vocab"];else{if(!s(e))throw new o('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:i});if(!u(e)&&x.processingMode(I,1))throw new o('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:i});{const t=m(I,e,{vocab:!0,base:!0},void 0,void 0,n);u(t)||n.eventHandler&&p({event:{type:["JsonLdEvent"],code:"relative @vocab reference",level:"warning",message:"Relative @vocab reference found.",details:{vocab:t}},options:n}),I["@vocab"]=t}}y.set("@vocab",!0)}if("@language"in i){const e=i["@language"];if(null===e)delete I["@language"];else{if(!s(e))throw new o('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:i});e.match(f)||n.eventHandler&&p({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:e}},options:n}),I["@language"]=e.toLowerCase()}y.set("@language",!0)}if("@direction"in i){const t=i["@direction"];if("json-ld-1.0"===e.processingMode)throw new o("Invalid JSON-LD syntax; @direction not compatible with "+e.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:i});if(null===t)delete I["@direction"];else{if("ltr"!==t&&"rtl"!==t)throw new o('Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:i});I["@direction"]=t}y.set("@direction",!0)}if("@propagate"in i){const n=i["@propagate"];if("json-ld-1.0"===e.processingMode)throw new o("Invalid JSON-LD syntax; @propagate not compatible with "+e.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:i});if("boolean"!=typeof n)throw new o("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:t});y.set("@propagate",!0)}if("@import"in i){const r=i["@import"];if("json-ld-1.0"===e.processingMode)throw new o("Invalid JSON-LD syntax; @import not compatible with "+e.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:i});if(!s(r))throw new o("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:t});const a=await n.contextResolver.resolve({activeCtx:e,context:r,documentLoader:n.documentLoader,base:n.base});if(1!==a.length)throw new o("Invalid JSON-LD syntax; @import must reference a single context.","jsonld.SyntaxError",{code:"invalid remote context",context:t});const c=a[0].getProcessed(e);if(c)i=c;else{const n=a[0].document;if("@import"in n)throw new o("Invalid JSON-LD syntax: imported context must not include @import.","jsonld.SyntaxError",{code:"invalid context entry",context:t});for(const e in n)i.hasOwnProperty(e)||(i[e]=n[e]);a[0].setProcessed(e,i)}y.set("@import",!0)}y.set("@protected",i["@protected"]||!1);for(const e in i)if(x.createTermDefinition({activeCtx:I,localCtx:i,term:e,defined:y,options:n,overrideProtected:c}),a(i[e])&&"@context"in i[e]){const t=i[e]["@context"];let r=!0;if(s(t)){const e=d(n.base,t);h.has(e)?r=!1:h.add(e)}if(r)try{await x.process({activeCtx:I.clone(),localCtx:i[e]["@context"],overrideProtected:!0,options:n,cycles:h})}catch(t){throw new o("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:i[e]["@context"],term:e})}}r.setProcessed(e,{context:I,events:g})}return I},x.createTermDefinition=({activeCtx:e,localCtx:t,term:n,defined:r,options:c,overrideProtected:l=!1})=>{if(r.has(n)){if(r.get(n))return;throw new o("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:t,term:n})}let d;if(r.set(n,!1),t.hasOwnProperty(n)&&(d=t[n]),"@type"===n&&a(d)&&"@set"===(d["@container"]||"@set")&&x.processingMode(e,1.1)){const e=["@container","@id","@protected"],r=Object.keys(d);if(0===r.length||r.some(t=>!e.includes(t)))throw new o("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:t,term:n})}else{if(x.isKeyword(n))throw new o("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:t,term:n});if(n.match(h))return void(c.eventHandler&&p({event:{type:["JsonLdEvent"],code:"reserved term",level:"warning",message:'Terms beginning with "@" are reserved for future use and dropped.',details:{term:n}},options:c}));if(""===n)throw new o("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:t})}const f=e.mappings.get(n);e.mappings.has(n)&&e.mappings.delete(n);let v=!1;if((s(d)||null===d)&&(v=!0,d={"@id":d}),!a(d))throw new o("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:t});const g={};e.mappings.set(n,g),g.reverse=!1;const y=["@container","@id","@language","@reverse","@type"];x.processingMode(e,1.1)&&y.push("@context","@direction","@index","@nest","@prefix","@protected");for(const e in d)if(!y.includes(e))throw new o("Invalid JSON-LD syntax; a term definition must not contain "+e,"jsonld.SyntaxError",{code:"invalid term definition",context:t});const b=n.indexOf(":");if(g._termHasColon=b>0,"@reverse"in d){if("@id"in d)throw new o("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});if("@nest"in d)throw new o("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});const i=d["@reverse"];if(!s(i))throw new o("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});if(i.match(h))return c.eventHandler&&p({event:{type:["JsonLdEvent"],code:"reserved @reverse value",level:"warning",message:'@reverse values beginning with "@" are reserved for future use and dropped.',details:{reverse:i}},options:c}),void(f?e.mappings.set(n,f):e.mappings.delete(n));const a=m(e,i,{vocab:!0,base:!1},t,r,c);if(!u(a))throw new o("Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});g["@id"]=a,g.reverse=!0}else if("@id"in d){let i=d["@id"];if(i&&!s(i))throw new o("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});if(null===i)g["@id"]=null;else{if(!x.isKeyword(i)&&i.match(h))return c.eventHandler&&p({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:'@id values beginning with "@" are reserved for future use and dropped.',details:{id:i}},options:c}),void(f?e.mappings.set(n,f):e.mappings.delete(n));if(i!==n){if(i=m(e,i,{vocab:!0,base:!1},t,r,c),!u(i)&&!x.isKeyword(i))throw new o("Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});if(n.match(/(?::[^:])|\//)&&m(e,n,{vocab:!0,base:!1},t,new Map(r).set(n,!0),c)!==i)throw new o("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});g["@id"]=i,g._prefix=v&&!g._termHasColon&&null!==i.match(/[:\/\?#\[\]@]$/)}}}if(!("@id"in g))if(g._termHasColon){const o=n.substr(0,b);if(t.hasOwnProperty(o)&&x.createTermDefinition({activeCtx:e,localCtx:t,term:o,defined:r,options:c}),e.mappings.has(o)){const t=n.substr(b+1);g["@id"]=e.mappings.get(o)["@id"]+t}else g["@id"]=n}else if("@type"===n)g["@id"]=n;else{if(!("@vocab"in e))throw new o("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t,term:n});g["@id"]=e["@vocab"]+n}if((!0===d["@protected"]||!0===r.get("@protected")&&!1!==d["@protected"])&&(e.protected[n]=!0,g.protected=!0),r.set(n,!0),"@type"in d){let n=d["@type"];if(!s(n))throw new o("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if("@json"===n||"@none"===n){if(x.processingMode(e,1))throw new o(`Invalid JSON-LD syntax; an @context @type value must not be "${n}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:t})}else if("@id"!==n&&"@vocab"!==n){if(n=m(e,n,{vocab:!0,base:!1},t,r,c),!u(n))throw new o("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if(0===n.indexOf("_:"))throw new o("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:t})}g["@type"]=n}if("@container"in d){const n=s(d["@container"])?[d["@container"]]:d["@container"]||[],r=["@list","@set","@index","@language"];let a=!0;const c=n.includes("@set");if(x.processingMode(e,1.1)){if(r.push("@graph","@id","@type"),n.includes("@list")){if(1!==n.length)throw new o("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:t})}else if(n.includes("@graph")){if(n.some(e=>"@graph"!==e&&"@id"!==e&&"@index"!==e&&"@set"!==e))throw new o("Invalid JSON-LD syntax; @context @container with @graph must have no other values other than @id, @index, and @set","jsonld.SyntaxError",{code:"invalid container mapping",context:t})}else a&=n.length<=(c?2:1);if(n.includes("@type")&&(g["@type"]=g["@type"]||"@id",!["@id","@vocab"].includes(g["@type"])))throw new o("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:t})}else a&=!i(d["@container"]),a&=n.length<=1;if(a&=n.every(e=>r.includes(e)),a&=!(c&&n.includes("@list")),!a)throw new o("Invalid JSON-LD syntax; @context @container value must be one of the following: "+r.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:t});if(g.reverse&&!n.every(e=>["@index","@set"].includes(e)))throw new o("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});g["@container"]=n}if("@index"in d){if(!("@container"in d)||!g["@container"].includes("@index"))throw new o(`Invalid JSON-LD syntax; @index without @index in @container: "${d["@index"]}" on term "${n}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:t});if(!s(d["@index"])||0===d["@index"].indexOf("@"))throw new o(`Invalid JSON-LD syntax; @index must expand to an IRI: "${d["@index"]}" on term "${n}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:t});g["@index"]=d["@index"]}if("@context"in d&&(g["@context"]=d["@context"]),"@language"in d&&!("@type"in d)){let e=d["@language"];if(null!==e&&!s(e))throw new o("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:t});null!==e&&(e=e.toLowerCase()),g["@language"]=e}if("@prefix"in d){if(n.match(/:|\//))throw new o("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:t});if(x.isKeyword(g["@id"]))throw new o("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:t});if("boolean"!=typeof d["@prefix"])throw new o("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:t});g._prefix=!0===d["@prefix"]}if("@direction"in d){const e=d["@direction"];if(null!==e&&"ltr"!==e&&"rtl"!==e)throw new o('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:t});g["@direction"]=e}if("@nest"in d){const e=d["@nest"];if(!s(e)||"@nest"!==e&&0===e.indexOf("@"))throw new o("Invalid JSON-LD syntax; @context @nest value must be a string which is not a keyword other than @nest.","jsonld.SyntaxError",{code:"invalid @nest value",context:t});g["@nest"]=e}const I=g["@id"];if("@context"===I||"@preserve"===I)throw new o("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:t});if(f&&f.protected&&!l&&(e.protected[n]=!0,g.protected=!0,!w(f,g)))throw new o("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:t,term:n})},x.expandIri=(e,t,n,r)=>m(e,t,n,void 0,void 0,r),x.getInitialContext=e=>{const t=JSON.stringify({processingMode:e.processingMode}),n=y.get(t);if(n)return n;const o={processingMode:e.processingMode,mappings:new Map,inverse:null,getInverse:function(){const e=this;if(e.inverse)return e.inverse;const t=e.inverse={},n=e.fastCurieMap={},r={},o=(e["@language"]||"@none").toLowerCase(),s=e["@direction"],c=e.mappings,u=[...c.keys()].sort(g);for(const e of u){const i=c.get(e);if(null===i)continue;let u=i["@container"]||"@none";if(u=[].concat(u).sort().join(""),null===i["@id"])continue;const l=v(i["@id"]);for(const c of l){let l=t[c];const d=x.isKeyword(c);if(l)d||i._termHasColon||r[c].push(e);else if(t[c]=l={},!d&&!i._termHasColon){r[c]=[e];const t={iri:c,terms:r[c]};c[0]in n?n[c[0]].push(t):n[c[0]]=[t]}if(l[u]||(l[u]={"@language":{},"@type":{},"@any":{}}),l=l[u],a(e,l["@any"],"@none"),i.reverse)a(e,l["@type"],"@reverse");else if("@none"===i["@type"])a(e,l["@any"],"@none"),a(e,l["@language"],"@none"),a(e,l["@type"],"@none");else if("@type"in i)a(e,l["@type"],i["@type"]);else if("@language"in i&&"@direction"in i){const t=i["@language"],n=i["@direction"];a(e,l["@language"],t&&n?`${t}_${n}`.toLowerCase():t?t.toLowerCase():n?`_${n}`:"@null")}else"@language"in i?a(e,l["@language"],(i["@language"]||"@null").toLowerCase()):"@direction"in i?i["@direction"]?a(e,l["@language"],`_${i["@direction"]}`):a(e,l["@language"],"@none"):s?(a(e,l["@language"],`_${s}`),a(e,l["@language"],"@none"),a(e,l["@type"],"@none")):(a(e,l["@language"],o),a(e,l["@language"],"@none"),a(e,l["@type"],"@none"))}}for(const e in n)i(n,e,1);return t},clone:function(){const e={};return e.mappings=r.clone(this.mappings),e.clone=this.clone,e.inverse=null,e.getInverse=this.getInverse,e.protected=r.clone(this.protected),this.previousContext&&(e.previousContext=this.previousContext.clone()),e.revertToPreviousContext=this.revertToPreviousContext,"@base"in this&&(e["@base"]=this["@base"]),"@language"in this&&(e["@language"]=this["@language"]),"@vocab"in this&&(e["@vocab"]=this["@vocab"]),e},revertToPreviousContext:function(){return this.previousContext?this.previousContext.clone():this},protected:{}};return 1e4===y.size&&y.clear(),y.set(t,o),o;function i(e,t,n){const r=e[t],o=e[t]={};let a,s;for(const e of r)a=e.iri,s=n>=a.length?"":a[n],s in o?o[s].push(e):o[s]=[e];for(const e in o)""!==e&&i(o,e,n+1)}function a(e,t,n){t.hasOwnProperty(n)||(t[n]=e)}},x.getContextValue=(e,t,n)=>{if(null===t){if("@context"===n)return;return null}if(e.mappings.has(t)){const r=e.mappings.get(t);if(c(n))return r;if(r.hasOwnProperty(n))return r[n]}return"@language"===n&&n in e||"@direction"===n&&n in e?e[n]:"@context"!==n?null:void 0},x.processingMode=(e,t)=>t.toString()>="1.1"?!e.processingMode||e.processingMode>="json-ld-"+t.toString():"json-ld-1.0"===e.processingMode,x.isKeyword=e=>{if(!s(e)||"@"!==e[0])return!1;switch(e){case"@base":case"@container":case"@context":case"@default":case"@direction":case"@embed":case"@explicit":case"@graph":case"@id":case"@included":case"@index":case"@json":case"@language":case"@list":case"@nest":case"@none":case"@omitDefault":case"@prefix":case"@preserve":case"@protected":case"@requireAll":case"@reverse":case"@set":case"@type":case"@value":case"@version":case"@vocab":return!0}return!1}},396:(e,t,n)=>{"use strict";const{isArray:r,isObject:o,isString:i}=n(4340),{asArray:a}=n(1869),{prependBase:s}=n(4540),c=n(8937),u=n(1498);function l(e){throw new c("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:e})}function d({context:e,base:t}){if(!e)return;const n=e["@context"];if(i(n))e["@context"]=s(t,n);else if(r(n))for(let e=0;e<n.length;++e){const r=n[e];i(r)?n[e]=s(t,r):o(r)&&d({context:{"@context":r},base:t})}else if(o(n))for(const e in n)d({context:n[e],base:t})}e.exports=class{constructor({sharedCache:e}){this.perOpCache=new Map,this.sharedCache=e}async resolve({activeCtx:e,context:t,documentLoader:n,base:s,cycles:c=new Set}){t&&o(t)&&t["@context"]&&(t=t["@context"]),t=a(t);const d=[];for(const a of t){if(i(a)){let t=this._get(a);t||(t=await this._resolveRemoteContext({activeCtx:e,url:a,documentLoader:n,base:s,cycles:c})),r(t)?d.push(...t):d.push(t);continue}if(null===a){d.push(new u({document:null}));continue}o(a)||l(t);const p=JSON.stringify(a);let f=this._get(p);f||(f=new u({document:a}),this._cacheResolvedContext({key:p,resolved:f,tag:"static"})),d.push(f)}return d}_get(e){let t=this.perOpCache.get(e);if(!t){const n=this.sharedCache.get(e);n&&(t=n.get("static"),t&&this.perOpCache.set(e,t))}return t}_cacheResolvedContext({key:e,resolved:t,tag:n}){if(this.perOpCache.set(e,t),void 0!==n){let r=this.sharedCache.get(e);r||(r=new Map,this.sharedCache.set(e,r)),r.set(n,t)}return t}async _resolveRemoteContext({activeCtx:e,url:t,documentLoader:n,base:r,cycles:o}){t=s(r,t);const{context:i,remoteDoc:a}=await this._fetchContext({activeCtx:e,url:t,documentLoader:n,cycles:o});d({context:i,base:r=a.documentUrl||t});const c=await this.resolve({activeCtx:e,context:i,documentLoader:n,base:r,cycles:o});return this._cacheResolvedContext({key:t,resolved:c,tag:a.tag}),c}async _fetchContext({activeCtx:e,url:t,documentLoader:n,cycles:a}){if(a.size>10)throw new c("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"json-ld-1.0"===e.processingMode?"loading remote context failed":"context overflow",max:10});if(a.has(t))throw new c("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"json-ld-1.0"===e.processingMode?"recursive context inclusion":"context overflow",url:t});let s,u;a.add(t);try{u=await n(t),s=u.document||null,i(s)&&(s=JSON.parse(s))}catch(e){throw new c(`Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context. URL: "${t}".`,"jsonld.InvalidUrl",{code:"loading remote context failed",url:t,cause:e})}if(!o(s))throw new c(`Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object. URL: "${t}".`,"jsonld.InvalidUrl",{code:"invalid remote context",url:t});return s="@context"in s?{"@context":s["@context"]}:{"@context":{}},u.contextUrl&&(r(s["@context"])||(s["@context"]=[s["@context"]]),s["@context"].push(u.contextUrl)),{context:s,remoteDoc:u}}}},397:(e,t,n)=>{"use strict";var r=n(7751);e.exports=r("document","documentElement")},421:e=>{"use strict";e.exports={}},456:(e,t,n)=>{"use strict";var r=n(6518),o=n(4576),i=n(9504),a=n(4154),s=n(5169),c=i(1.1.toString),u=o.Uint8Array,l=!u||!u.prototype.toHex||!function(){try{return"ffffffffffffffff"===new u([255,255,255,255,255,255,255,255]).toHex()}catch(e){return!1}}();u&&r({target:"Uint8Array",proto:!0,forced:l},{toHex:function(){a(this),s(this.buffer);for(var e="",t=0,n=this.length;t<n;t++){var r=c(this[t],16);e+=1===r.length?"0"+r:r}return e}})},507:(e,t,n)=>{"use strict";var r=n(9565);e.exports=function(e,t,n){for(var o,i,a=n?e:e.iterator,s=e.next;!(o=r(s,a)).done;)if(void 0!==(i=t(o.value)))return i}},616:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})},655:(e,t,n)=>{"use strict";var r=n(6955),o=String;e.exports=function(e){if("Symbol"===r(e))throw new TypeError("Cannot convert a Symbol value to a string");return o(e)}},679:(e,t,n)=>{"use strict";var r=n(1625),o=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new o("Incorrect invocation")}},684:e=>{"use strict";e.exports=function(e,t){var n="function"==typeof Iterator&&Iterator.prototype[e];if(n)try{n.call({next:null},t).next()}catch(e){return!0}}},687:(e,t,n)=>{"use strict";var r=n(4913).f,o=n(9297),i=n(8227)("toStringTag");e.exports=function(e,t,n){e&&!n&&(e=e.prototype),e&&!o(e,i)&&r(e,i,{configurable:!0,value:t})}},741:e=>{"use strict";var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},747:(e,t,n)=>{"use strict";var r=n(6699),o=n(6193),i=n(4659),a=Error.captureStackTrace;e.exports=function(e,t,n,s){i&&(a?a(e,t):r(e,"stack",o(n,s)))}},757:(e,t,n)=>{"use strict";var r=n(7751),o=n(4901),i=n(1625),a=n(7040),s=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return o(t)&&i(t.prototype,s(e))}},788:(e,t,n)=>{"use strict";var r=n(34),o=n(2195),i=n(8227)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[i])?!!t:"RegExp"===o(e))}},831:(e,t,n)=>{"use strict";n(6280),n(6910),n(8111),n(8237),n(3110),e.exports=function e(t){if("number"==typeof t&&isNaN(t))throw new Error("NaN is not allowed");if("number"==typeof t&&!isFinite(t))throw new Error("Infinity is not allowed");return null===t||"object"!=typeof t?JSON.stringify(t):t.toJSON instanceof Function?e(t.toJSON()):Array.isArray(t)?`[${t.reduce((t,n,r)=>`${t}${0===r?"":","}${e(void 0===n||"symbol"==typeof n?null:n)}`,"")}]`:`{${Object.keys(t).sort().reduce((n,r)=>void 0===t[r]||"symbol"==typeof t[r]?n:`${n}${0===n.length?"":","}${e(r)}:${e(t[r])}`,"")}}`}},851:(e,t,n)=>{"use strict";var r=n(6955),o=n(5966),i=n(4117),a=n(6269),s=n(8227)("iterator");e.exports=function(e){if(!i(e))return o(e,s)||o(e,"@@iterator")||a[r(e)]}},931:(e,t,n)=>{"use strict";n(6910),n(2953),e.exports=class{constructor(e){this.current=e.sort(),this.done=!1,this.dir=new Map;for(let t=0;t<e.length;++t)this.dir.set(e[t],!0)}hasNext(){return!this.done}next(){const{current:e,dir:t}=this,n=e.slice();let r=null,o=0;const i=e.length;for(let n=0;n<i;++n){const a=e[n],s=t.get(a);(null===r||a>r)&&(s&&n>0&&a>e[n-1]||!s&&n<i-1&&a>e[n+1])&&(r=a,o=n)}if(null===r)this.done=!0;else{const n=t.get(r)?o-1:o+1;e[o]=e[n],e[n]=r;for(const n of e)n>r&&t.set(n,!t.get(n))}return n}}},944:e=>{"use strict";var t=TypeError;e.exports=function(e){var n=e&&e.alphabet;if(void 0===n||"base64"===n||"base64url"===n)return n||"base64";throw new t("Incorrect `alphabet` option")}},1034:(e,t,n)=>{"use strict";var r=n(9565),o=n(9297),i=n(1625),a=n(5213),s=n(7979),c=RegExp.prototype;e.exports=a.correct?function(e){return e.flags}:function(e){return a.correct||!i(c,e)||o(e,"flags")?e.flags:r(s,e)}},1056:(e,t,n)=>{"use strict";var r=n(4913).f;e.exports=function(e,t,n){n in e||r(e,n,{configurable:!0,get:function(){return t[n]},set:function(e){t[n]=e}})}},1072:(e,t,n)=>{"use strict";var r=n(1828),o=n(8727);e.exports=Object.keys||function(e){return r(e,o)}},1088:(e,t,n)=>{"use strict";var r=n(6518),o=n(9565),i=n(6395),a=n(350),s=n(4901),c=n(3994),u=n(2787),l=n(2967),d=n(687),p=n(6699),f=n(6840),h=n(8227),v=n(6269),g=n(7657),y=a.PROPER,x=a.CONFIGURABLE,m=g.IteratorPrototype,w=g.BUGGY_SAFARI_ITERATORS,b=h("iterator"),I="keys",S="values",j="entries",E=function(){return this};e.exports=function(e,t,n,a,h,g,O){c(n,t,a);var A,D,N,C=function(e){if(e===h&&_)return _;if(!w&&e&&e in R)return R[e];switch(e){case I:case S:case j:return function(){return new n(this,e)}}return function(){return new n(this)}},k=t+" Iterator",T=!1,R=e.prototype,L=R[b]||R["@@iterator"]||h&&R[h],_=!w&&L||C(h),P="Array"===t&&R.entries||L;if(P&&(A=u(P.call(new e)))!==Object.prototype&&A.next&&(i||u(A)===m||(l?l(A,m):s(A[b])||f(A,b,E)),d(A,k,!0,!0),i&&(v[k]=E)),y&&h===S&&L&&L.name!==S&&(!i&&x?p(R,"name",S):(T=!0,_=function(){return o(L,this)})),h)if(D={values:C(S),keys:g?_:C(I),entries:C(j)},O)for(N in D)(w||T||!(N in R))&&f(R,N,D[N]);else r({target:t,proto:!0,forced:w||T},D);return i&&!O||R[b]===_||f(R,b,_,{name:h}),v[t]=_,D}},1108:(e,t,n)=>{"use strict";var r=n(6955);e.exports=function(e){var t=r(e);return"BigInt64Array"===t||"BigUint64Array"===t}},1134:(e,t,n)=>{"use strict";var r=n(4644),o=n(3839).findLastIndex,i=r.aTypedArray;(0,r.exportTypedArrayMethod)("findLastIndex",function(e){return o(i(this),e,arguments.length>1?arguments[1]:void 0)})},1181:(e,t,n)=>{"use strict";var r,o,i,a=n(8622),s=n(4576),c=n(34),u=n(6699),l=n(9297),d=n(7629),p=n(6119),f=n(421),h="Object already initialized",v=s.TypeError,g=s.WeakMap;if(a||d.state){var y=d.state||(d.state=new g);y.get=y.get,y.has=y.has,y.set=y.set,r=function(e,t){if(y.has(e))throw new v(h);return t.facade=e,y.set(e,t),t},o=function(e){return y.get(e)||{}},i=function(e){return y.has(e)}}else{var x=p("state");f[x]=!0,r=function(e,t){if(l(e,x))throw new v(h);return t.facade=e,u(e,x,t),t},o=function(e){return l(e,x)?e[x]:{}},i=function(e){return l(e,x)}}e.exports={set:r,get:o,has:i,enforce:function(e){return i(e)?o(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=o(t)).type!==e)throw new v("Incompatible receiver, "+e+" required");return n}}}},1291:(e,t,n)=>{"use strict";var r=n(741);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},1385:(e,t,n)=>{"use strict";var r=n(9539);e.exports=function(e,t,n){for(var o=e.length-1;o>=0;o--)if(void 0!==e[o])try{n=r(e[o].iterator,t,n)}catch(e){t="throw",n=e}if("throw"===t)throw n;return n}},1469:(e,t,n)=>{"use strict";var r=n(7433);e.exports=function(e,t){return new(r(e))(0===t?0:t)}},1489:(e,t,n)=>{"use strict";n(5823)("Uint8",function(e){return function(t,n,r){return e(this,t,n,r)}})},1498:(e,t,n)=>{"use strict";const r=n(5967);e.exports=class{constructor({document:e}){this.document=e,this.cache=new r({max:10})}getProcessed(e){return this.cache.get(e)}setProcessed(e,t){this.cache.set(e,t)}}},1523:(e,t,n)=>{"use strict";const{isKeyword:r}=n(394),o=n(2460),i=n(4340),a=n(1869),s=n(8937),c={};e.exports=c,c.createMergedNodeMap=(e,t)=>{const n=(t=t||{}).issuer||new a.IdentifierIssuer("_:b"),r={"@default":{}};return c.createNodeMap(e,r,"@default",n),c.mergeNodeMaps(r)},c.createNodeMap=(e,t,n,u,l,d)=>{if(i.isArray(e)){for(const r of e)c.createNodeMap(r,t,n,u,void 0,d);return}if(!i.isObject(e))return void(d&&d.push(e));if(o.isValue(e)){if("@type"in e){let t=e["@type"];0===t.indexOf("_:")&&(e["@type"]=t=u.getId(t))}return void(d&&d.push(e))}if(d&&o.isList(e)){const r=[];return c.createNodeMap(e["@list"],t,n,u,l,r),void d.push({"@list":r})}if("@type"in e){const t=e["@type"];for(const e of t)0===e.indexOf("_:")&&u.getId(e)}i.isUndefined(l)&&(l=o.isBlankNode(e)?u.getId(e["@id"]):e["@id"]),d&&d.push({"@id":l});const p=t[n],f=p[l]=p[l]||{};f["@id"]=l;const h=Object.keys(e).sort();for(let i of h){if("@id"===i)continue;if("@reverse"===i){const r={"@id":l},i=e["@reverse"];for(const e in i){const s=i[e];for(const i of s){let s=i["@id"];o.isBlankNode(i)&&(s=u.getId(s)),c.createNodeMap(i,t,n,u,s),a.addValue(p[s],e,r,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if("@graph"===i){l in t||(t[l]={}),c.createNodeMap(e[i],t,l,u);continue}if("@included"===i){c.createNodeMap(e[i],t,n,u);continue}if("@type"!==i&&r(i)){if("@index"===i&&i in f&&(e[i]!==f[i]||e[i]["@id"]!==f[i]["@id"]))throw new s("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:f});f[i]=e[i];continue}const d=e[i];if(0===i.indexOf("_:")&&(i=u.getId(i)),0!==d.length)for(let e of d)if("@type"===i&&(e=0===e.indexOf("_:")?u.getId(e):e),o.isSubject(e)||o.isSubjectReference(e)){if("@id"in e&&!e["@id"])continue;const r=o.isBlankNode(e)?u.getId(e["@id"]):e["@id"];a.addValue(f,i,{"@id":r},{propertyIsArray:!0,allowDuplicate:!1}),c.createNodeMap(e,t,n,u,r)}else if(o.isValue(e))a.addValue(f,i,e,{propertyIsArray:!0,allowDuplicate:!1});else if(o.isList(e)){const r=[];c.createNodeMap(e["@list"],t,n,u,l,r),e={"@list":r},a.addValue(f,i,e,{propertyIsArray:!0,allowDuplicate:!1})}else c.createNodeMap(e,t,n,u,l),a.addValue(f,i,e,{propertyIsArray:!0,allowDuplicate:!1});else a.addValue(f,i,[],{propertyIsArray:!0})}},c.mergeNode