text: !function(){var e="undefined"!=typeof process&&process.versions&&process.versions.node,n=!e&&("undefined"!=typeof window||"undefined"!=typeof self);n&&"undefined"==typeof global&&("undefined"!=typeof window?global=window:"undefined"!=typeof self?global=self:"undefined"!=typeof $&&(global=$));var t=function(t){function r(){}function a(e){for(var n=[],t=Object.keys(e).sort(),r=0;r<t.length;++r){var a=t[r],o=e[a];V(o)||(o=[o]);for(var i=0;i<o.length;++i){var l=o[i];if(!F(l))throw new Cn("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:e});n.push({"@value":l,"@language":a.toLowerCase()})}}return n}function o(e,n){if(V(n))for(var t=0;t<n.length;++t)n[t]=o(e,n[t]);else if(Q(n))n["@list"]=o(e,n["@list"]);else if(_(n)){Z(n)&&(n["@id"]=e.getName(n["@id"]));for(var r=Object.keys(n).sort(),a=0;a<r.length;++a){var i=r[a];"@id"!==i&&(n[i]=o(e,n[i]))}}return n}function i(e,n,r){if(null===r||void 0===r)return null;var a=R(e,n,{vocab:!0});if("@id"===a)return R(e,r,{base:!0});if("@type"===a)return R(e,r,{vocab:!0,base:!0});var o=t.getContextValue(e,n,"@type");if("@id"===o||"@graph"===a&&F(r))return{"@id":R(e,r,{base:!0})};if("@vocab"===o)return{"@id":R(e,r,{vocab:!0,base:!0})};if(A(a))return r;var i={};if(null!==o)i["@type"]=o;else if(F(r)){var l=t.getContextValue(e,n,"@language");null!==l&&(i["@language"]=l)}return-1===["boolean","number","string"].indexOf(typeof r)&&(r=r.toString()),i["@value"]=r,i}function l(e,n,t){for(var r=[],a=Object.keys(e).sort(),o=0;o<a.length;++o)for(var i=a[o],l=e[i],c=Object.keys(l).sort(),d=0;d<c.length;++d){var f=c[d],p=l[f];if("@type"===f)f=In;else if(A(f))continue;for(var v=0;v<p.length;++v){var h=p[v],g={};if(g.type=0===i.indexOf("_:")?"blank node":"IRI",g.value=i,K(i)){var y={};if(y.type=0===f.indexOf("_:")?"blank node":"IRI",y.value=f,K(f)&&("blank node"!==y.type||t.produceGeneralizedRdf))if(Q(h))u(h["@list"],n,g,y,r);else{var m=s(h);m&&r.push({subject:g,predicate:y,object:m})}}}}return r}function u(e,n,t,r,a){for(var o={type:"IRI",value:bn},i={type:"IRI",value:wn},l={type:"IRI",value:jn},u=0;u<e.length;++u){var c=e[u],d={type:"blank node",value:n.getName()};a.push({subject:t,predicate:r,object:d}),t=d,r=o;var f=s(c);f&&a.push({subject:t,predicate:r,object:f}),r=i}a.push({subject:t,predicate:r,object:l})}function s(e){var n={};if(Y(e)){n.type="literal";var t=e["@value"],r=e["@type"]||null;B(t)?(n.value=t.toString(),n.datatype=r||vn):z(t)||r===hn?(z(t)||(t=parseFloat(t)),n.value=t.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),n.datatype=r||hn):M(t)?(n.value=t.toFixed(0),n.datatype=r||gn):"@language"in e?(n.value=t,n.datatype=r||Sn,n.language=e["@language"]):(n.value=t,n.datatype=r||yn)}else{var a=_(e)?e["@id"]:e;n.type=0===a.indexOf("_:")?"blank node":"IRI",n.value=a}return"IRI"!==n.type||K(n.value)?n:null}function c(e,n){if("IRI"===e.type||"blank node"===e.type)return{"@id":e.value};var t={"@value":e.value};if(e.language)t["@language"]=e.language;else{var r=e.datatype;if(r||(r=yn),n){if(r===vn)"true"===t["@value"]?t["@value"]=!0:"false"===t["@value"]&&(t["@value"]=!1);else if(H(t["@value"]))if(r===gn){var a=parseInt(t["@value"],10);a.toFixed(0)===t["@value"]&&(t["@value"]=a)}else r===hn&&(t["@value"]=parseFloat(t["@value"]));-1===[vn,gn,hn,yn].indexOf(r)&&(t["@type"]=r)}else r!==yn&&(t["@type"]=r)}return t}function d(e,n){for(var t=["subject","predicate","object"],r=0;r<t.length;++r){var a=t[r];if(e[a].type!==n[a].type||e[a].value!==n[a].value)return!1}return e.object.language!==n.object.language?!1:e.object.datatype!==n.object.datatype?!1:!0}function f(e,n){if("hash"in n[e])return n[e].hash;for(var t=n[e].quads,r=[],a=0;a<t.length;++a)r.push(an(t[a],t[a].name?t[a].name.value:null,e));r.sort();var o=n[e].hash=Un.hash(r);return o}function p(e,n,r,a,o){function i(o){if(o===d.length)return u=Object.keys(c).sort(),l(0);var s=d[o],p=v(s.subject,e),h=null;if(null!==p?h="p":(p=v(s.object,e),null!==p&&(h="r")),null!==p){var g;g=r.isNamed(p)?r.getName(p):a.isNamed(p)?a.getName(p):f(p,n);var y=Un.create();y.update(h),y.update(s.predicate.value),y.update(g);var m=y.digest();m in c?c[m].push(p):c[m]=[p]}t.setImmediate(function(){i(o+1)})}function l(e){function i(){function u(e){if(e===m.length)return c(!1);var t=m[e];p(t,n,r,g,function(n,r){return n?o(n):(y+=g.getName(t)+"<"+r.hash+">",g=r.pathNamer,null!==f&&y.length>=f.length&&y>f?c(!0):void u(e+1))})}function c(n){!n&&(null===f||f>y)&&(f=y,v=g),h.hasNext()?t.setImmediate(function(){i()}):(s.update(f),a=v,l(e+1))}var d=h.next(),g=a.clone(),y="",m=[];for(var x in d){var b=d[x];if(r.isNamed(b)?y+=r.getName(b):(g.isNamed(b)||m.push(b),y+=g.getName(b)),null!==f&&y.length>=f.length&&y>f)return c(!0)}u(0)}if(e===u.length)return o(null,{hash:s.digest(),pathNamer:a});var d=u[e];s.update(d);var f=null,v=null,h=new Rn(c[d]);t.setImmediate(function(){i()})}var u,s=Un.create(),c={},d=n[e].quads;t.setImmediate(function(){i(0)})}function v(e,n){return"blank node"===e.type&&e.value!==n?e.value:null}function h(e,n,r,a,o,i){if(V(e))for(var l=0;l<e.length;++l)h(e[l],n,r,a,void 0,i);else{if(!_(e))return void(i&&i.push(e));if(Y(e)){if("@type"in e){var u=e["@type"];0===u.indexOf("_:")&&(e["@type"]=u=a.getName(u))}return void(i&&i.push(e))}if("@type"in e)for(var s=e["@type"],l=0;l<s.length;++l){var u=s[l];0===u.indexOf("_:")&&a.getName(u)}X(o)&&(o=Z(e)?a.getName(e["@id"]):e["@id"]),i&&i.push({"@id":o});var c=n[r],d=c[o]=c[o]||{};d["@id"]=o;for(var f=Object.keys(e).sort(),p=0;p<f.length;++p){var v=f[p];if("@id"!==v)if("@reverse"!==v)if("@graph"!==v)if("@type"!==v&&A(v)){if("@index"===v&&"@index"in d)throw new Cn("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:d});d[v]=e[v]}else{var g=e[v];if(0===v.indexOf("_:")&&(v=a.getName(v)),0!==g.length)for(var y=0;y<g.length;++y){var m=g[y];if("@type"===v&&(m=0===m.indexOf("_:")?a.getName(m):m),$(m)||G(m)){var x=Z(m)?a.getName(m["@id"]):m["@id"];t.addValue(d,v,{"@id":x},{propertyIsArray:!0,allowDuplicate:!1}),h(m,n,r,a,x)}else if(Q(m)){var b=[];h(m["@list"],n,r,a,o,b),m={"@list":b},t.addValue(d,v,m,{propertyIsArray:!0,allowDuplicate:!1})}else h(m,n,r,a,o),t.addValue(d,v,m,{propertyIsArray:!0,allowDuplicate:!1})}else t.addValue(d,v,[],{propertyIsArray:!0})}else{o in n||(n[o]={});var w="@merged"===r?r:o;h(e[v],n,w,a)}else{var j={"@id":o},I=e["@reverse"];for(var O in I)for(var k=I[O],L=0;L<k.length;++L){var S=k[L],E=S["@id"];Z(S)&&(E=a.getName(E)),h(S,n,r,a,E),t.addValue(c[E],O,j,{propertyIsArray:!0,allowDuplicate:!1})}}}}}function g(e){for(var n=e["@default"],t=Object.keys(e).sort(),r=0;r<t.length;++r){var a=t[r];if("@default"!==a){var o=e[a],i=n[a];i?"@graph"in i||(i["@graph"]=[]):n[a]=i={"@id":a,"@graph":[]};for(var l=i["@graph"],u=Object.keys(o).sort(),s=0;s<u.length;++s){var c=o[u[s]];G(c)||l.push(c)}}}return n}function y(e,n,t,r,a){w(t),t=t[0];var o=e.options,i={embed:b(t,o,"embed"),explicit:b(t,o,"explicit"),requireAll:b(t,o,"requireAll")},l=j(e,n,t,i),u=Object.keys(l).sort();for(var s in u){var c=u[s],d=l[c];if("@link"===i.embed&&c in e.link)k(r,a,e.link[c]);else{null===a&&(e.uniqueEmbeds={});var f={};if(f["@id"]=c,e.link[c]=f,"@never"===i.embed||x(d,e.subjectStack))k(r,a,f);else{"@last"===i.embed&&(c in e.uniqueEmbeds&&O(e,c),e.uniqueEmbeds[c]={parent:r,property:a}),e.subjectStack.push(d);for(var p=Object.keys(d).sort(),v=0;v<p.length;v++){var h=p[v];if(A(h))f[h]=W(d[h]);else if(!i.explicit||h in t)for(var g=d[h],I=0;I<g.length;++I){var L=g[I];if(Q(L)){var S={"@list":[]};k(f,h,S);var E=L["@list"];for(var N in E)if(L=E[N],G(L)){var C=h in t?t[h][0]["@list"]:m(i);y(e,[L["@id"]],C,S,"@list")}else k(S,"@list",W(L))}else if(G(L)){var C=h in t?t[h]:m(i);y(e,[L["@id"]],C,f,h)}else k(f,h,W(L))}}for(var p=Object.keys(t).sort(),v=0;v<p.length;++v){var h=p[v];if(!A(h)){var D=t[h][0],R=b(D,o,"omitDefault");if(!(R||h in f)){var U="@null";"@default"in D&&(U=W(D["@default"])),V(U)||(U=[U]),f[h]=[{"@preserve":U}]}}}k(r,a,f),e.subjectStack.pop()}}}}function m(e){var n={};for(var t in e)void 0!==e[t]&&(n["@"+t]=[e[t]]);return[n]}function x(e,n){for(var t=n.length-1;t>=0;--t)if(n[t]["@id"]===e["@id"])return!0;return!1}function b(e,n,t){var r="@"+t,a=r in e?e[r][0]:n[t];return"embed"===t&&(a===!0?a="@last":a===!1?a="@never":"@always"!==a&&"@never"!==a&&"@link"!==a&&(a="@last")),a}function w(e){if(!V(e)||1!==e.length||!_(e[0]))throw new Cn("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:e})}function j(e,n,t,r){for(var a={},o=0;o<n.length;++o){var i=n[o],l=e.subjects[i];I(l,t,r)&&(a[i]=l)}return a}function I(e,n,r){if("@type"in n&&(1!==n["@type"].length||!_(n["@type"][0]))){for(var a=n["@type"],o=0;o<a.length;++o)if(t.hasValue(e,"@type",a[o]))return!0;return!1}var i=!0,l=!1;for(var u in n){if(A(u)){if("@id"!==u&&"@type"!==u)continue;if(i=!1,"@id"===u&&F(n[u])){if(e[u]!==n[u])return!1;l=!0;continue}}if(i=!1,u in e){if(V(n[u])&&0===n[u].length&&void 0!==e[u])return!1;l=!0}else{var s=V(n[u])&&_(n[u][0])&&"@default"in n[u][0];if(r.requireAll&&!s)return!1}}return i||l}function O(e,n){var r=e.uniqueEmbeds,a=r[n],o=a.parent,i=a.property,l={"@id":n};if(V(o)){for(var u=0;u<o.length;++u)if(t.compareValues(o[u],l)){o[u]=l;break}}else{var s=V(o[i]);t.removeValue(o,i,l,{propertyIsArray:s}),t.addValue(o,i,l,{propertyIsArray:s})}var c=function(e){for(var n=Object.keys(r),t=0;t<n.length;++t){var a=n[t];a in r&&_(r[a].parent)&&r[a].parent["@id"]===e&&(delete r[a],c(a))}};c(n)}function k(e,n,r){_(e)?t.addValue(e,n,r,{propertyIsArray:!0}):e.push(r)}function L(e,n,r){if(V(n)){for(var a=[],o=0;o<n.length;++o){var i=L(e,n[o],r);null!==i&&a.push(i)}n=a}else if(_(n)){if("@preserve"in n)return"@null"===n["@preserve"]?null:n["@preserve"];if(Y(n))return n;if(Q(n))return n["@list"]=L(e,n["@list"],r),n;var l=N(e,"@id");if(l in n){var u=n[l];if(u in r.link){var s=r.link[u].indexOf(n);if(-1!==s)return r.link[u][s];r.link[u].push(n)}else r.link[u]=[n]}for(var c in n){var i=L(e,n[c],r),d=t.getContextValue(e,c,"@container");r.compactArrays&&V(i)&&1===i.length&&null===d&&(i=i[0]),n[c]=i}}return n}function S(e,n){return e.length<n.length?-1:n.length<e.length?1:e===n?0:n>e?-1:1}function E(e,n,t,r,a,o){null===o&&(o="@null");var i=[];if("@id"!==o&&"@reverse"!==o||!G(t))i.push(o);else{"@reverse"===o&&i.push("@reverse");var l=N(e,t["@id"],null,{vocab:!0});l in e.mappings&&e.mappings[l]&&e.mappings[l]["@id"]===t["@id"]?i.push.apply(i,["@vocab","@id"]):i.push.apply(i,["@id","@vocab"])}i.push("@none");for(var u=e.inverse[n],s=0;s<r.length;++s){var c=r[s];if(c in u)for(var d=u[c][a],f=0;f<i.length;++f){var p=i[f];if(p in d)return d[p]}}return null}function N(e,n,t,r,a){if(null===n)return n;if(X(t)&&(t=null),X(a)&&(a=!1),r=r||{},A(n)&&(r.vocab=!0),r.vocab&&n in e.getInverse()){var o=e["@language"]||"@none",i=[];_(t)&&"@index"in t&&i.push("@index");var l="@language",u="@null";if(a)l="@type",u="@reverse",i.push("@set");else if(Q(t)){"@index"in t||i.push("@list");for(var s=t["@list"],c=0===s.length?o:null,d=null,f=0;f<s.length;++f){var p=s[f],v="@none",h="@none";if(Y(p)?"@language"in p?v=p["@language"]:"@type"in p?h=p["@type"]:v="@null":h="@id",null===c?c=v:v!==c&&Y(p)&&(c="@none"),null===d?d=h:h!==d&&(d="@none"),"@none"===c&&"@none"===d)break}c=c||"@none",d=d||"@none","@none"!==d?(l="@type",u=d):u=c}else Y(t)?"@language"in t&&!("@index"in t)?(i.push("@language"),u=t["@language"]):"@type"in t&&(l="@type",u=t["@type"]):(l="@type",u="@id"),i.push("@set");i.push("@none");var g=E(e,n,t,i,l,u);if(null!==g)return g}if(r.vocab&&"@vocab"in e){var y=e["@vocab"];if(0===n.indexOf(y)&&n!==y){var m=n.substr(y.length);if(!(m in e.mappings))return m}}var x=null;for(var g in e.mappings)if(-1===g.indexOf(":")){var b=e.mappings[g];if(b&&b["@id"]!==n&&0===n.indexOf(b["@id"])){var w=g+":"+n.substr(b["@id"].length),j=!(w in e.mappings)||null===t&&e.mappings[w]&&e.mappings[w]["@id"]===n;j&&(null===x||S(w,x)<0)&&(x=w)}}return null!==x?x:r.vocab?n:T(e["@base"],n)}function C(e,n,r){if(Y(r)){var a=t.getContextValue(e,n,"@type"),o=t.getContextValue(e,n,"@language"),i=t.getContextValue(e,n,"@container"),l="@index"in r&&"@index"!==i;if(!l&&(r["@type"]===a||r["@language"]===o))return r["@value"];var u=Object.keys(r).length,s=1===u||2===u&&"@index"in r&&!l,c="@language"in e,d=F(r["@value"]),f=e.mappings[n]&&null===e.mappings[n]["@language"];if(s&&(!c||!d||f))return r["@value"];var p={};return l&&(p[N(e,"@index")]=r["@index"]),"@type"in r?p[N(e,"@type")]=N(e,r["@type"],null,{vocab:!0}):"@language"in r&&(p[N(e,"@language")]=r["@language"]),p[N(e,"@value")]=r["@value"],p}var v=R(e,n,{vocab:!0}),a=t.getContextValue(e,n,"@type"),h=N(e,r["@id"],null,{vocab:"@vocab"===a});if("@id"===a||"@vocab"===a||"@graph"===v)return h;var p={};return p[N(e,"@id")]=h,p}function D(e,n,t,r){if(t in r){if(r[t])return;throw new Cn("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:n,term:t})}if(r[t]=!1,A(t))throw new Cn("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:n,term:t});if(""===t)throw new Cn("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:n});e.mappings[t]&&delete e.mappings[t];var a=n[t];if(null===a||_(a)&&null===a["@id"])return e.mappings[t]=null,void(r[t]=!0);if(F(a)&&(a={"@id":a}),!_(a))throw new Cn("Invalid JSON-LD syntax; @context property values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:n});var o=e.mappings[t]={};if(o.reverse=!1,"@reverse"in a){if("@id"in a)throw new Cn("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:n});var i=a["@reverse"];if(!F(i))throw new Cn("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:n});var l=R(e,i,{vocab:!0,base:!1},n,r);if(!K(l))throw new Cn("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:n});o["@id"]=l,o.reverse=!0}else if("@id"in a){var l=a["@id"];if(!F(l))throw new Cn("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:n});if(l!==t){if(l=R(e,l,{vocab:!0,base:!1},n,r),!K(l)&&!A(l))throw new Cn("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:n});o["@id"]=l}}if(!("@id"in o)){var u=t.indexOf(":");if(-1!==u){var s=t.substr(0,u);if(s in n&&D(e,n,s,r),e.mappings[s]){var c=t.substr(u+1);o["@id"]=e.mappings[s]["@id"]+c}else o["@id"]=t}else{if(!("@vocab"in e))throw new Cn("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:n,term:t});o["@id"]=e["@vocab"]+t}}if(r[t]=!0,"@type"in a){var d=a["@type"];if(!F(d))throw new Cn("Invalid JSON-LD syntax; an @context @type values must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:n});if("@id"!==d&&"@vocab"!==d){if(d=R(e,d,{vocab:!0,base:!1},n,r),!K(d))throw new Cn("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:n});if(0===d.indexOf("_:"))throw new Cn("Invalid JSON-LD syntax; an @context @type values must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:n})}o["@type"]=d}if("@container"in a){var f=a["@container"];if("@list"!==f&&"@set"!==f&&"@index"!==f&&"@language"!==f)throw new Cn("Invalid JSON-LD syntax; @context @container value must be one of the following: @list, @set, @index, or @language.","jsonld.SyntaxError",{code:"invalid container mapping",context:n});if(o.reverse&&"@index"!==f&&"@set"!==f&&null!==f)throw new Cn("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:n});o["@container"]=f}if("@language"in a&&!("@type"in a)){var p=a["@language"];if(null!==p&&!F(p))throw new Cn("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:n});null!==p&&(p=p.toLowerCase()),o["@language"]=p}var l=o["@id"];if("@context"===l||"@preserve"===l)throw new Cn("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:n})}function R(e,n,t,r,a){if(null===n||A(n))return n;if(r&&n in r&&a[n]!==!0&&D(e,r,n,a),t=t||{},t.vocab){var o=e.mappings[n];if(null===o)return null;if(o)return o["@id"]}var i=n.indexOf(":");if(-1!==i){var l=n.substr(0,i),u=n.substr(i+1);if("_"===l||0===u.indexOf("//"))return n;r&&l in r&&D(e,r,l,a);var o=e.mappings[l];return o?o["@id"]+u:n}if(t.vocab&&"@vocab"in e)return e["@vocab"]+n;var s=n;return t.base&&(s=U(e["@base"],s)),s}function U(e,n){if(null===e)return n;if(-1!==n.indexOf(":"))return n;F(e)&&(e=t.url.parse(e||""));var r=t.url.parse(n),a={protocol:e.protocol||""};if(null!==r.authority)a.authority=r.authority,a.path=r.path,a.query=r.query;else if(a.authority=e.authority,""===r.path)a.path=e.path,a.query=null!==r.query?r.query:e.query;else{if(0===r.path.indexOf("/"))a.path=r.path;else{var o=e.path;""!==r.path&&(o=o.substr(0,o.lastIndexOf("/")+1),o.length>0&&"/"!==o.substr(-1)&&(o+="/"),o+=r.path),a.path=o}a.query=r.query}a.path=un(a.path,!!a.authority);var i=a.protocol;return null!==a.authority&&(i+="//"+a.authority),i+=a.path,null!==a.query&&(i+="?"+a.query),null!==r.fragment&&(i+="#"+r.fragment),""===i&&(i="./"),i}function T(e,n){if(null===e)return n;F(e)&&(e=t.url.parse(e||""));var r="";if(""!==e.href?r+=(e.protocol||"")+"//"+(e.authority||""):n.indexOf("//")&&(r+="//"),0!==n.indexOf(r))return n;for(var a=t.url.parse(n.substr(r.length)),o=e.normalizedPath.split("/"),i=a.normalizedPath.split("/"),l=a.fragment||a.query?0:1;o.length>0&&i.length>l&&o[0]===i[0];)o.shift(),i.shift();var u="";if(o.length>0){o.pop();for(var s=0;s<o.length;++s)u+="../"}return u+=i.join("/"),null!==a.query&&(u+="?"+a.query),null!==a.fragment&&(u+="#"+a.fragment),""===u&&(u="./"),u}function J(e){function n(){var e=this;if(e.inverse)return e.inverse;for(var n=e.inverse={},t=e["@language"]||"@none",a=e.mappings,o=Object.keys(a).sort(S),i=0;i<o.length;++i){var l=o[i],u=a[l];if(null!==u){var s=u["@container"]||"@none",c=u["@id"];V(c)||(c=[c]);for(var d=0;d<c.length;++d){var f=c[d],p=n[f];if(p||(n[f]=p={}),p[s]||(p[s]={"@language":{},"@type":{}}),p=p[s],u.reverse)r(u,l,p["@type"],"@reverse");else if("@type"in u)r(u,l,p["@type"],u["@type"]);else if("@language"in u){var v=u["@language"]||"@null";r(u,l,p["@language"],v)}else r(u,l,p["@language"],t),r(u,l,p["@type"],"@none"),r(u,l,p["@language"],"@none")}}}return n}function r(e,n,t,r){r in t||(t[r]=n)}function a(){var e={};return e["@base"]=this["@base"],e.mappings=W(this.mappings),e.clone=this.clone,e.inverse=null,e.getInverse=this.getInverse,"@language"in this&&(e["@language"]=this["@language"]),"@vocab"in this&&(e["@vocab"]=this["@vocab"]),e}var o=t.url.parse(e.base||"");return{"@base":o,mappings:{},inverse:null,getInverse:n,clone:a}}function A(e){if(!F(e))return!1;switch(e){case"@base":case"@context":case"@container":case"@default":case"@embed":case"@explicit":case"@graph":case"@id":case"@index":case"@language":case"@list":case"@omitDefault":case"@preserve":case"@requireAll":case"@reverse":case"@set":case"@type":case"@value":case"@vocab":return!0}return!1}function _(e){return"[object Object]"===Object.prototype.toString.call(e)}function q(e){return _(e)&&0===Object.keys(e).length}function V(e){return Array.isArray(e)}function P(e){if(!F(e)&&!q(e)){var n=!1;if(V(e)){n=!0;for(var t=0;t<e.length;++t)if(!F(e[t])){n=!1;break}}if(!n)throw new Cn('Invalid JSON-LD syntax; "@type" value must a string, an array of strings, or an empty object.',"jsonld.SyntaxError",{code:"invalid type value",value:e})}}function F(e){return"string"==typeof e||"[object String]"===Object.prototype.toString.call(e)}function M(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function z(e){return M(e)&&-1!==String(e).indexOf(".")}function H(e){return!isNaN(parseFloat(e))&&isFinite(e)}function B(e){return"boolean"==typeof e||"[object Boolean]"===Object.prototype.toString.call(e)}function X(e){return"undefined"==typeof e}function $(e){var n=!1;if(_(e)&&!("@value"in e||"@set"in e||"@list"in e)){var t=Object.keys(e).length;n=t>1||!("@id"in e)}return n}function G(e){return _(e)&&1===Object.keys(e).length&&"@id"in e}function Y(e){return _(e)&&"@value"in e}function Q(e){return _(e)&&"@list"in e}function Z(e){var n=!1;return _(e)&&(n="@id"in e?0===e["@id"].indexOf("_:"):0===Object.keys(e).length||!("@value"in e||"@set"in e||"@list"in e)),n}function K(e){return F(e)&&-1!==e.indexOf(":")}function W(e){if(e&&"object"==typeof e){var n;if(V(e)){n=[];for(var t=0;t<e.length;++t)n[t]=W(e[t])}else if(_(e)){n={};for(var r in e)n[r]=W(e[r])}else n=e.toString();return n}return e}function en(e,n,t,r){var a=Object.keys(n).length;if(V(e)){for(var o=0;o<e.length;++o)en(e[o],n,t,r);return a<Object.keys(n).length}if(_(e)){for(var i in e)if("@context"===i){var l=e[i];if(V(l))for(var u=l.length,o=0;u>o;++o){var s=l[o];F(s)&&(s=U(r,s),t?(s=n[s],V(s)?(Array.prototype.splice.apply(l,[o,1].concat(s)),o+=s.length-1,u=l.length):l[o]=s):s in n||(n[s]=!1))}else F(l)&&(l=U(r,l),t?e[i]=n[l]:l in n||(n[l]=!1))}else en(e[i],n,t,r);return a<Object.keys(n).length}return!1}function nn(e,n,t){var r=null,a=n.documentLoader,o=function(e,n,t,a,i){if(Object.keys(n).length>Nn)return r=new Cn("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"loading remote context failed",max:Nn}),i(r);var l={},u=function(){en(e,l,!0,a),i(null,e)};en(e,l,!1,a)||u();var s=[];for(var c in l)l[c]===!1&&s.push(c);for(var d=s.length,f=0;f<s.length;++f)!function(e){if(e in n)return r=new Cn("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"recursive context inclusion",url:e}),i(r);var a=W(n);a[e]=!0;var s=function(n,s){if(!r){var c=s?s.document:null;if(!n&&F(c))try{c=JSON.parse(c)}catch(f){n=f}if(n?n=new Cn("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.","jsonld.InvalidUrl",{code:"loading remote context failed",url:e,cause:n}):_(c)||(n=new Cn("Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.","jsonld.InvalidUrl",{code:"invalid remote context",url:e,cause:n})),n)return r=n,i(r);c="@context"in c?{"@context":c["@context"]}:{"@context":{}},s.contextUrl&&(V(c["@context"])||(c["@context"]=[c["@context"]]),c["@context"].push(s.contextUrl)),o(c,a,t,e,function(n,t){return n?i(n):(l[e]=t["@context"],d-=1,void(0===d&&u()))})}},c=t(e,s);c&&"then"in c&&c.then(s.bind(null,null),s)}(s[f])};o(e,{},a,n.base,t)}function tn(e){for(var n="(?:<([^:]+:[^>]*)>)",t="(_:(?:[A-Za-z0-9]+))",r='"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"',a="(?:\\^\\^"+n+")",o="(?:@([a-z]+(?:-[a-z0-9]+)*))",i="(?:"+r+"(?:"+a+"|"+o+")?)",l="[ \\t]+",u="[ \\t]*",s=/(?:\r\n)|(?:\n)|(?:\r)/g,c=new RegExp("^"+u+"$"),f="(?:"+n+"|"+t+")"+l,p=n+l,v="(?:"+n+"|"+t+"|"+i+")"+u,h="(?:\\.|(?:(?:"+n+"|"+t+")"+u+"\\.))",g=new RegExp("^"+u+f+p+v+h+u+"$"),y={},m=e.split(s),x=0,b=0;b<m.length;++b){var w=m[b];if(x++,!c.test(w)){var j=w.match(g);if(null===j)throw new Cn("Error while parsing N-Quads; invalid quad.","jsonld.ParseError",{line:x});var I={};if(I.subject=X(j[1])?{type:"blank node",value:j[2]}:{type:"IRI",value:j[1]},I.predicate={type:"IRI",value:j[3]},X(j[4]))if(X(j[5])){I.object={type:"literal"},X(j[7])?X(j[8])?I.object.datatype=yn:(I.object.datatype=Sn,I.object.language=j[8]):I.object.datatype=j[7];var O=j[6].replace(/\\"/g,'"').replace(/\\t/g,"	").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\\\/g,"\\");I.object.value=O}else I.object={type:"blank node",value:j[5]};else I.object={type:"IRI",value:j[4]};var k="@default";if(X(j[9])?X(j[10])||(k=j[10]):k=j[9],k in y){for(var L=!0,S=y[k],E=0;L&&E<S.length;++E)d(S[E],I)&&(L=!1);L&&S.push(I)}else y[k]=[I]}}return y}function rn(e){var n=[];for(var t in e)for(var r=e[t],a=0;a<r.length;++a){var o=r[a];"@default"===t&&(t=null),n.push(an(o,t))}return n.sort(),n.join("")}function an(e,n,t){var r=e.subject,a=e.predicate,o=e.object,i=n,l="";if(l+="IRI"===r.type?"<"+r.value+">":t?r.value===t?"_:a":"_:z":r.value,l+=" ",l+="IRI"===a.type?"<"+a.value+">":t?"_:p":a.value,l+=" ","IRI"===o.type)l+="<"+o.value+">";else if("blank node"===o.type)l+=t?o.value===t?"_:a":"_:z":o.value;else{var u=o.value.replace(/\\/g,"\\\\").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\"/g,'\\"');l+='"'+u+'"',o.datatype===Sn?o.language&&(l+="@"+o.language):o.datatype!==yn&&(l+="^^<"+o.datatype+">")}return null!==i&&(l+=0!==i.indexOf("_:")?" <"+i+">":t?" _:g":" "+i),l+=" .\n"}function on(e){var n={};n["@default"]=[];for(var t=e.getSubjects(),r=0;r<t.length;++r){var a=t[r];if(null!==a){var o=e.getSubjectTriples(a);if(null!==o){var i=o.predicates;for(var l in i)for(var u=i[l].objects,s=0;s<u.length;++s){var c=u[s],d={};d.subject=0===a.indexOf("_:")?{type:"blank node",value:a}:{type:"IRI",value:a},d.predicate=0===l.indexOf("_:")?{type:"blank node",value:l}:{type:"IRI",value:l};var f=c.value;if(c.type===kn){fn||An();var p=new fn;f="";for(var v=0;v<c.value.length;v++)c.value[v].nodeType===pn.ELEMENT_NODE?f+=p.serializeToString(c.value[v]):c.value[v].nodeType===pn.TEXT_NODE&&(f+=c.value[v].nodeValue)}d.object={},c.type===Ln?d.object.type=0===c.value.indexOf("_:")?"blank node":"IRI":(d.object.type="literal",c.type===On?c.language?(d.object.datatype=Sn,d.object.language=c.language):d.object.datatype=yn:d.object.datatype=c.type),d.object.value=f,n["@default"].push(d)}}}}return n}function ln(e){this.prefix=e,this.counter=0,this.existing={}}function un(e,n){var t="";0===e.indexOf("/")&&(t="/");for(var r=e.split("/"),a=[];r.length>0;)"."===r[0]||""===r[0]&&r.length>1?r.shift():".."!==r[0]?a.push(r.shift()):(r.shift(),n||a.length>0&&".."!==a[a.length-1]?a.pop():a.push(".."));return t+a.join("/")}t.compact=function(e,n,r,a){function o(e,t,r,o){if(e)return a(e);o.compactArrays&&!o.graph&&V(t)?1===t.length?t=t[0]:0===t.length&&(t={}):o.graph&&_(t)&&(t=[t]),_(n)&&"@context"in n&&(n=n["@context"]),n=W(n),V(n)||(n=[n]);var i=n;n=[];for(var l=0;l<i.length;++l)(!_(i[l])||Object.keys(i[l]).length>0)&&n.push(i[l]);var u=n.length>0;if(1===n.length&&(n=n[0]),V(t)){var s=N(r,"@graph"),c=t;t={},u&&(t["@context"]=n),t[s]=c}else if(_(t)&&u){var c=t;t={"@context":n};for(var d in c)t[d]=c[d]}a(null,t,r)}if(arguments.length<2)return t.nextTick(function(){a(new TypeError("Could not compact, too few arguments."))});if("function"==typeof r&&(a=r,r={}),r=r||{},null===n)return t.nextTick(function(){a(new Cn("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"}))});if(null===e)return t.nextTick(function(){a(null,null)});"base"in r||(r.base="string"==typeof e?e:""),"compactArrays"in r||(r.compactArrays=!0),"graph"in r||(r.graph=!1),"skipExpansion"in r||(r.skipExpansion=!1),"documentLoader"in r||(r.documentLoader=t.loadDocument),"link"in r||(r.link=!1),r.link&&(r.skipExpansion=!0);var i=function(e,n,r){t.nextTick(function(){return n.skipExpansion?r(null,e):void t.expand(e,n,r)})};i(e,r,function(e,i){if(e)return a(new Cn("Could not expand input before compaction.","jsonld.CompactError",{cause:e}));var l=J(r);t.processContext(l,n,r,function(e,n){if(e)return a(new Cn("Could not process context before compaction.","jsonld.CompactError",{cause:e}));var t;try{t=(new Dn).compact(n,null,i,r)}catch(l){return a(l)}o(null,t,n,r)})})},t.expand=function(e,n,r){function a(e){"base"in n||(n.base=e.documentUrl||"");var t={document:W(e.document),remoteContext:{"@context":e.contextUrl}};if("expandContext"in n){var a=W(n.expandContext);t.expandContext="object"==typeof a&&"@context"in a?a:{"@context":a}}nn(t,n,function(e,t){if(e)return r(e);var a;try{var o=new Dn,i=J(n),l=t.document,u=t.remoteContext["@context"];t.expandContext&&(i=o.processContext(i,t.expandContext["@context"],n)),u&&(i=o.processContext(i,u,n)),a=o.expand(i,null,l,n,!1),_(a)&&"@graph"in a&&1===Object.keys(a).length?a=a["@graph"]:null===a&&(a=[]),V(a)||(a=[a])}catch(s){return r(s)}r(null,a)})}return arguments.length<1?t.nextTick(function(){r(new TypeError("Could not expand, too few arguments."))}):("function"==typeof n&&(r=n,n={}),n=n||{},"documentLoader"in n||(n.documentLoader=t.loadDocument),"keepFreeFloatingNodes"in n||(n.keepFreeFloatingNodes=!1),void t.nextTick(function(){if("string"==typeof e){var t=function(e,n){if(e)return r(e);try{if(!n.document)throw new Cn("No remote document found at the given URL.","jsonld.NullRemoteDocument");"string"==typeof n.document&&(n.document=JSON.parse(n.document))}catch(t){return r(new Cn("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",cause:t,remoteDoc:n}))}a(n)},o=n.documentLoader(e,t);return void(o&&"then"in o&&o.then(t.bind(null,null),t))}a({contextUrl:null,documentUrl:null,document:e})}))},t.flatten=function(e,n,r,a){return arguments.length<1?t.nextTick(function(){a(new TypeError("Could not flatten, too few arguments."))}):("function"==typeof r?(a=r,r={}):"function"==typeof n&&(a=n,n=null,r={}),r=r||{},"base"in r||(r.base="string"==typeof e?e:""),"documentLoader"in r||(r.documentLoader=t.loadDocument),void t.expand(e,r,function(e,o){if(e)return a(new Cn("Could not expand input before flattening.","jsonld.FlattenError",{cause:e}));var i;try{i=(new Dn).flatten(o)}catch(l){return a(l)}return null===n?a(null,i):(r.graph=!0,r.skipExpansion=!0,void t.compact(i,n,r,function(e,n){return e?a(new Cn("Could not compact flattened output.","jsonld.FlattenError",{cause:e})):void a(null,n)}))}))},t.frame=function(e,n,r,a){function o(n){var o,i=n.document;i?(o=i["@context"],n.contextUrl?(o?V(o)?o.push(n.contextUrl):o=[o,n.contextUrl]:o=n.contextUrl,i["@context"]=o):o=o||{}):o={},t.expand(e,r,function(e,n){if(e)return a(new Cn("Could not expand input before framing.","jsonld.FrameError",{cause:e}));var l=W(r);l.isFrame=!0,l.keepFreeFloatingNodes=!0,t.expand(i,l,function(e,r){if(e)return a(new Cn("Could not expand frame before framing.","jsonld.FrameError",{cause:e}));var i;try{i=(new Dn).frame(n,r,l)}catch(u){return a(u)}l.graph=!0,l.skipExpansion=!0,l.link={},t.compact(i,o,l,function(e,n,t){if(e)return a(new Cn("Could not compact framed output.","jsonld.FrameError",{cause:e}));var r=N(t,"@graph");l.link={},n[r]=L(t,n[r],l),a(null,n)})})})}return arguments.length<2?t.nextTick(function(){a(new TypeError("Could not frame, too few arguments."))}):("function"==typeof r&&(a=r,r={}),r=r||{},"base"in r||(r.base="string"==typeof e?e:""),"documentLoader"in r||(r.documentLoader=t.loadDocument),"embed"in r||(r.embed="@last"),r.explicit=r.explicit||!1,"requireAll"in r||(r.requireAll=!0),r.omitDefault=r.omitDefault||!1,void t.nextTick(function(){if("string"==typeof n){var e=function(e,n){if(e)return a(e);try{if(!n.document)throw new Cn("No remote document found at the given URL.","jsonld.NullRemoteDocument");"string"==typeof n.document&&(n.document=JSON.parse(n.document))}catch(t){return a(new Cn("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",cause:t,remoteDoc:n}))}o(n)},t=r.documentLoader(n,e);return void(t&&"then"in t&&t.then(e.bind(null,null),e))}o({contextUrl:null,documentUrl:null,document:n})
  }))},t.link=function(e,n,r,a){var o={};n&&(o["@context"]=n),o["@embed"]="@link",t.frame(e,o,r,a)},t.objectify=function(e,n,r,a){"function"==typeof r&&(a=r,r={}),r=r||{},"base"in r||(r.base="string"==typeof e?e:""),"documentLoader"in r||(r.documentLoader=t.loadDocument),t.expand(e,r,function(e,o){if(e)return a(new Cn("Could not expand input before linking.","jsonld.LinkError",{cause:e}));var i;try{i=(new Dn).flatten(o)}catch(l){return a(l)}r.graph=!0,r.skipExpansion=!0,t.compact(i,n,r,function(e,n,r){if(e)return a(new Cn("Could not compact flattened output before linking.","jsonld.LinkError",{cause:e}));var o=N(r,"@graph"),i=n[o][0],l=function(e){if(_(e)||V(e)){if(_(e)){if(l.visited[e["@id"]])return;l.visited[e["@id"]]=!0}for(var n in e){var a=e[n],o="@id"===t.getContextValue(r,n,"@type");if(V(a)||_(a)||o)if(F(a)&&o)e[n]=a=i[a],l(a);else if(V(a))for(var u=0;u<a.length;++u)F(a[u])&&o?a[u]=i[a[u]]:_(a[u])&&"@id"in a[u]&&(a[u]=i[a[u]["@id"]]),l(a[u]);else if(_(a)){var s=a["@id"];e[n]=a=i[s],l(a)}}}};l.visited={},l(i),n.of_type={};for(var u in i)if("@type"in i[u]){var s=i[u]["@type"];V(s)||(s=[s]);for(var c in s)s[c]in n.of_type||(n.of_type[s[c]]=[]),n.of_type[s[c]].push(i[u])}a(null,n)})})},t.normalize=function(e,n,r){if(arguments.length<1)return t.nextTick(function(){r(new TypeError("Could not normalize, too few arguments."))});"function"==typeof n&&(r=n,n={}),n=n||{},"base"in n||(n.base="string"==typeof e?e:""),"documentLoader"in n||(n.documentLoader=t.loadDocument);var a=W(n);delete a.format,a.produceGeneralizedRdf=!1,t.toRDF(e,a,function(e,t){return e?r(new Cn("Could not convert input to RDF dataset before normalization.","jsonld.NormalizeError",{cause:e})):void(new Dn).normalize(t,n,r)})},t.fromRDF=function(e,n,r){return arguments.length<1?t.nextTick(function(){r(new TypeError("Could not convert from RDF, too few arguments."))}):("function"==typeof n&&(r=n,n={}),n=n||{},"useRdfType"in n||(n.useRdfType=!1),"useNativeTypes"in n||(n.useNativeTypes=!1),"format"in n||!F(e)||"format"in n||(n.format="application/nquads"),void t.nextTick(function(){function t(e,n,t){(new Dn).fromRDF(e,n,t)}var a;if(n.format){if(a=n.rdfParser||dn[n.format],!a)return r(new Cn("Unknown input format.","jsonld.UnknownFormat",{format:n.format}))}else a=function(){return e};if(e=a(e,function(e,a){return e?r(e):void t(a,n,r)})){if("then"in e)return e.then(function(e){t(e,n,r)},r);t(e,n,r)}}))},t.toRDF=function(e,n,r){return arguments.length<1?t.nextTick(function(){r(new TypeError("Could not convert to RDF, too few arguments."))}):("function"==typeof n&&(r=n,n={}),n=n||{},"base"in n||(n.base="string"==typeof e?e:""),"documentLoader"in n||(n.documentLoader=t.loadDocument),void t.expand(e,n,function(e,t){if(e)return r(new Cn("Could not expand input before serialization to RDF.","jsonld.RdfError",{cause:e}));var a;try{if(a=Dn.prototype.toRDF(t,n),n.format){if("application/nquads"===n.format)return r(null,rn(a));throw new Cn("Unknown output format.","jsonld.UnknownFormat",{format:n.format})}}catch(o){return r(o)}r(null,a)}))},t.createNodeMap=function(e,n,r){return arguments.length<1?t.nextTick(function(){r(new TypeError("Could not create node map, too few arguments."))}):("function"==typeof n&&(r=n,n={}),n=n||{},"base"in n||(n.base="string"==typeof e?e:""),"documentLoader"in n||(n.documentLoader=t.loadDocument),void t.expand(e,n,function(e,t){if(e)return r(new Cn("Could not expand input before creating node map.","jsonld.CreateNodeMapError",{cause:e}));var a;try{a=(new Dn).createNodeMap(t,n)}catch(o){return r(o)}r(null,a)}))},t.merge=function(e,n,r,a){function o(e,n){if(!u){if(e)return u=e,a(new Cn("Could not expand input before flattening.","jsonld.FlattenError",{cause:e}));l.push(n),0===--s&&i(l)}}function i(e){var o=!0;"mergeNodes"in r&&(o=r.mergeNodes);var i,l=r.namer||new ln("_:b"),u={"@default":{}};try{for(var s=0;s<e.length;++s){var c=e[s];c=t.relabelBlankNodes(c,{namer:new ln("_:b"+s+"-")});var d=o||0===s?u:{"@default":{}};if(h(c,d,"@default",l),d!==u)for(var f in d){var p=d[f];if(f in u){var v=u[f];for(var y in p)y in v||(v[y]=p[y])}else u[f]=p}}i=g(u)}catch(m){return a(m)}for(var x=[],b=Object.keys(i).sort(),w=0;w<b.length;++w){var j=i[b[w]];G(j)||x.push(j)}return null===n?a(null,x):(r.graph=!0,r.skipExpansion=!0,void t.compact(x,n,r,function(e,n){return e?a(new Cn("Could not compact merged output.","jsonld.MergeError",{cause:e})):void a(null,n)}))}if(arguments.length<1)return t.nextTick(function(){a(new TypeError("Could not merge, too few arguments."))});if(!V(e))return t.nextTick(function(){a(new TypeError('Could not merge, "docs" must be an array.'))});"function"==typeof r?(a=r,r={}):"function"==typeof n&&(a=n,n=null,r={}),r=r||{};for(var l=[],u=null,s=e.length,c=0;c<e.length;++c){var d={};for(var f in r)d[f]=r[f];t.expand(e[c],d,o)}},t.relabelBlankNodes=function(e,n){n=n||{};var t=n.namer||new ln("_:b");return o(t,e)},t.documentLoader=function(n,r){var a=new Cn("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed"});return e?r(a,{contextUrl:null,documentUrl:n,document:null}):t.promisify(function(e){e(a)})},t.loadDocument=function(e,n){var r=t.documentLoader(e,n);r&&"then"in r&&r.then(n.bind(null,null),n)},t.promises=function(e){e=e||{};var n=Array.prototype.slice,r=t.promisify,a=e.api||{},o=e.version||"jsonld.js";"string"==typeof e.api&&(e.version||(o=e.api),a={}),a.expand=function(){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");return r.apply(null,[t.expand].concat(n.call(arguments)))},a.compact=function(){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");var e=function(e,n,r,a){t.compact(e,n,r,function(e,n){a(e,n)})};return r.apply(null,[e].concat(n.call(arguments)))},a.flatten=function(){if(arguments.length<1)throw new TypeError("Could not flatten, too few arguments.");return r.apply(null,[t.flatten].concat(n.call(arguments)))},a.frame=function(){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");return r.apply(null,[t.frame].concat(n.call(arguments)))},a.fromRDF=function(){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");return r.apply(null,[t.fromRDF].concat(n.call(arguments)))},a.toRDF=function(){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");return r.apply(null,[t.toRDF].concat(n.call(arguments)))},a.normalize=function(){if(arguments.length<1)throw new TypeError("Could not normalize, too few arguments.");return r.apply(null,[t.normalize].concat(n.call(arguments)))},"jsonld.js"===o&&(a.link=function(){if(arguments.length<2)throw new TypeError("Could not link, too few arguments.");return r.apply(null,[t.link].concat(n.call(arguments)))},a.objectify=function(){return r.apply(null,[t.objectify].concat(n.call(arguments)))},a.createNodeMap=function(){return r.apply(null,[t.createNodeMap].concat(n.call(arguments)))},a.merge=function(){return r.apply(null,[t.merge].concat(n.call(arguments)))});try{t.Promise=global.Promise||require("es6-promise").Promise}catch(i){var l=function(){throw new Error("Unable to find a Promise implementation.")};for(var u in a)a[u]=l}return a},t.promisify=function(e){if(!t.Promise)try{t.Promise=global.Promise||require("es6-promise").Promise}catch(n){throw new Error("Unable to find a Promise implementation.")}var r=Array.prototype.slice.call(arguments,1);return new t.Promise(function(n,t){e.apply(null,r.concat(function(e,r){e?t(e):n(r)}))})},t.promises({api:t.promises}),r.prototype=t.promises({version:"json-ld-1.0"}),r.prototype.toString=function(){return this instanceof r?"[object JsonLdProcessor]":"[object JsonLdProcessorPrototype]"},t.JsonLdProcessor=r;var sn=!!Object.defineProperty;if(sn)try{Object.defineProperty({},"x",{})}catch(cn){sn=!1}sn&&(Object.defineProperty(r,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(r.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:r})),n&&"undefined"==typeof global.JsonLdProcessor&&(sn?Object.defineProperty(global,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:r}):global.JsonLdProcessor=r),"undefined"!=typeof process&&process.nextTick?(t.nextTick=process.nextTick,t.setImmediate="function"==typeof setImmediate?setImmediate:t.nextTick):"function"==typeof setImmediate?t.setImmediate=t.nextTick=function(e){return setImmediate(e)}:(t.setImmediate=function(e){setTimeout(e,0)},t.nextTick=t.setImmediate),t.parseLinkHeader=function(e){for(var n={},t=e.match(/(?:<[^>]*?>|"[^"]*?"|[^,])+/g),r=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,a=0;a<t.length;++a){var o=t[a].match(r);if(o){for(var i={target:o[1]},l=o[2],u=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g;o=u.exec(l);)i[o[1]]=void 0===o[2]?o[3]:o[2];var s=i.rel||"";V(n[s])?n[s].push(i):n[s]=s in n?[n[s],i]:i}}return n},t.DocumentCache=function(e){this.order=[],this.cache={},this.size=e||50,this.expires=3e4},t.DocumentCache.prototype.get=function(e){if(e in this.cache){var n=this.cache[e];if(n.expires>=+new Date)return n.ctx;delete this.cache[e],this.order.splice(this.order.indexOf(e),1)}return null},t.DocumentCache.prototype.set=function(e,n){this.order.length===this.size&&delete this.cache[this.order.shift()],this.order.push(e),this.cache[e]={ctx:n,expires:+new Date+this.expires}},t.ActiveContextCache=function(e){this.order=[],this.cache={},this.size=e||100},t.ActiveContextCache.prototype.get=function(e,n){var t=JSON.stringify(e),r=JSON.stringify(n),a=this.cache[t];return a&&r in a?a[r]:null},t.ActiveContextCache.prototype.set=function(e,n,t){if(this.order.length===this.size){var r=this.order.shift();delete this.cache[r.activeCtx][r.localCtx]}var a=JSON.stringify(e),o=JSON.stringify(n);this.order.push({activeCtx:a,localCtx:o}),a in this.cache||(this.cache[a]={}),this.cache[a][o]=W(t)},t.cache={activeCtx:new t.ActiveContextCache},t.documentLoaders={},t.documentLoaders.jquery=function(e,n){n=n||{};var r=function(r,a){return 0!==r.indexOf("http:")&&0!==r.indexOf("https:")?a(new Cn('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:r}),{contextUrl:null,documentUrl:r,document:null}):n.secure&&0!==r.indexOf("https")?a(new Cn('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:r}),{contextUrl:null,documentUrl:r,document:null}):void e.ajax({url:r,accepts:{json:"application/ld+json, application/json"},headers:{Accept:"application/ld+json, application/json"},dataType:"json",crossDomain:!0,success:function(e,n,o){var i={contextUrl:null,documentUrl:r,document:e},l=o.getResponseHeader("Content-Type"),u=o.getResponseHeader("Link");if(u&&"application/ld+json"!==l){if(u=t.parseLinkHeader(u)[En],V(u))return a(new Cn("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:r}),i);u&&(i.contextUrl=u.target)}a(null,i)},error:function(e,n,t){a(new Cn("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:r,cause:t}),{contextUrl:null,documentUrl:r,document:null})}})},a="undefined"!=typeof Promise;return"usePromise"in n&&(a=n.usePromise),a?function(e){return t.promisify(r,e)}:r},t.documentLoaders.node=function(e){function n(u,s,c){function d(e,r,o){if(f={contextUrl:null,documentUrl:u,document:o||null},e)return c(new Cn("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:u,cause:e}),f);var d=i.STATUS_CODES[r.statusCode];if(r.statusCode>=400)return c(new Cn("URL could not be dereferenced: "+d,"jsonld.InvalidUrl",{code:"loading document failed",url:u,httpStatusCode:r.statusCode}),f);if(r.headers.link&&"application/ld+json"!==r.headers["content-type"]){var p=t.parseLinkHeader(r.headers.link)[En];if(V(p))return c(new Cn("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:u}),f);p&&(f.contextUrl=p.target)}if(r.statusCode>=300&&r.statusCode<400&&r.headers.location)return s.length===a?c(new Cn("URL could not be dereferenced; there were too many redirects.","jsonld.TooManyRedirects",{code:"loading document failed",url:u,httpStatusCode:r.statusCode,redirects:s}),f):-1!==s.indexOf(u)?c(new Cn("URL could not be dereferenced; infinite redirection was detected.","jsonld.InfiniteRedirectDetected",{code:"recursive context inclusion",url:u,httpStatusCode:r.statusCode,redirects:s}),f):(s.push(u),n(r.headers.location,s,c));s.push(u);for(var v=0;v<s.length;++v)l.set(s[v],{contextUrl:null,documentUrl:s[v],document:o});c(e,f)}if(0!==u.indexOf("http:")&&0!==u.indexOf("https:"))return c(new Cn('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:u}),{contextUrl:null,documentUrl:u,document:null});if(e.secure&&0!==u.indexOf("https"))return c(new Cn('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:u}),{contextUrl:null,documentUrl:u,document:null});var f=l.get(u);return null!==f?c(null,f):void o({url:u,headers:{Accept:"application/ld+json, application/json"},strictSSL:r,followRedirect:!1},d)}e=e||{};var r="strictSSL"in e?e.strictSSL:!0,a="maxRedirects"in e?e.maxRedirects:-1,o=require("request"),i=require("http"),l=new t.DocumentCache,u=function(e,t){n(e,[],t)};return e.usePromise?function(e){return t.promisify(u,e)}:u},t.documentLoaders.xhr=function(e){var n=/(^|(\r\n))link:/i;e=e||{};var r=function(r,a){if(0!==r.indexOf("http:")&&0!==r.indexOf("https:"))return a(new Cn('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:r}),{contextUrl:null,documentUrl:r,document:null});if(e.secure&&0!==r.indexOf("https"))return a(new Cn('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:r}),{contextUrl:null,documentUrl:r,document:null});var o=e.xhr||XMLHttpRequest,i=new o;i.onload=function(){if(i.status>=400)return a(new Cn("URL could not be dereferenced: "+i.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:r,httpStatusCode:i.status}),{contextUrl:null,documentUrl:r,document:null});var e,o={contextUrl:null,documentUrl:r,document:i.response},l=i.getResponseHeader("Content-Type");if(n.test(i.getAllResponseHeaders())&&(e=i.getResponseHeader("Link")),e&&"application/ld+json"!==l){if(e=t.parseLinkHeader(e)[En],V(e))return a(new Cn("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:r}),o);e&&(o.contextUrl=e.target)}a(null,o)},i.onerror=function(){a(new Cn("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:r}),{contextUrl:null,documentUrl:r,document:null})},i.open("GET",r,!0),i.setRequestHeader("Accept","application/ld+json, application/json"),i.send()},a="undefined"!=typeof Promise;return"usePromise"in e&&(a=e.usePromise),a?function(e){return t.promisify(r,e)}:r},t.useDocumentLoader=function(e){if(!(e in t.documentLoaders))throw new Cn('Unknown document loader type: "'+e+'"',"jsonld.UnknownDocumentLoader",{type:e});t.documentLoader=t.documentLoaders[e].apply(t,Array.prototype.slice.call(arguments,1))},t.processContext=function(e,n){var r={},a=2;arguments.length>3&&(r=arguments[2]||{},a+=1);var o=arguments[a];return"base"in r||(r.base=""),"documentLoader"in r||(r.documentLoader=t.loadDocument),null===n?o(null,J(r)):(n=W(n),_(n)&&"@context"in n||(n={"@context":n}),void nn(n,r,function(n,t){if(n)return o(n);try{t=(new Dn).processContext(e,t,r)}catch(a){return o(a)}o(null,t)}))},t.hasProperty=function(e,n){var t=!1;if(n in e){var r=e[n];t=!V(r)||r.length>0}return t},t.hasValue=function(e,n,r){var a=!1;if(t.hasProperty(e,n)){var o=e[n],i=Q(o);if(V(o)||i){i&&(o=o["@list"]);for(var l=0;l<o.length;++l)if(t.compareValues(r,o[l])){a=!0;break}}else V(r)||(a=t.compareValues(r,o))}return a},t.addValue=function(e,n,r,a){if(a=a||{},"propertyIsArray"in a||(a.propertyIsArray=!1),"allowDuplicate"in a||(a.allowDuplicate=!0),V(r)){0!==r.length||!a.propertyIsArray||n in e||(e[n]=[]);for(var o=0;o<r.length;++o)t.addValue(e,n,r[o],a)}else if(n in e){var i=!a.allowDuplicate&&t.hasValue(e,n,r);V(e[n])||i&&!a.propertyIsArray||(e[n]=[e[n]]),i||e[n].push(r)}else e[n]=a.propertyIsArray?[r]:r},t.getValues=function(e,n){var t=e[n]||[];return V(t)||(t=[t]),t},t.removeProperty=function(e,n){delete e[n]},t.removeValue=function(e,n,r,a){a=a||{},"propertyIsArray"in a||(a.propertyIsArray=!1);var o=t.getValues(e,n).filter(function(e){return!t.compareValues(e,r)});0===o.length?t.removeProperty(e,n):e[n]=1!==o.length||a.propertyIsArray?o:o[0]},t.compareValues=function(e,n){return e===n?!0:Y(e)&&Y(n)&&e["@value"]===n["@value"]&&e["@type"]===n["@type"]&&e["@language"]===n["@language"]&&e["@index"]===n["@index"]?!0:_(e)&&"@id"in e&&_(n)&&"@id"in n?e["@id"]===n["@id"]:!1},t.getContextValue=function(e,n,t){var r=null;if(null===n)return r;if("@language"===t&&t in e&&(r=e[t]),e.mappings[n]){var a=e.mappings[n];X(t)?r=a:t in a&&(r=a[t])}return r};var dn={};if(t.registerRDFParser=function(e,n){dn[e]=n},t.unregisterRDFParser=function(e){delete dn[e]},e){if("undefined"==typeof fn)var fn=null;if("undefined"==typeof pn)var pn={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12}}var vn="http://www.w3.org/2001/XMLSchema#boolean",hn="http://www.w3.org/2001/XMLSchema#double",gn="http://www.w3.org/2001/XMLSchema#integer",yn="http://www.w3.org/2001/XMLSchema#string",mn="http://www.w3.org/1999/02/22-rdf-syntax-ns#",xn=mn+"List",bn=mn+"first",wn=mn+"rest",jn=mn+"nil",In=mn+"type",On=mn+"PlainLiteral",kn=mn+"XMLLiteral",Ln=mn+"object",Sn=mn+"langString",En="http://www.w3.org/ns/json-ld#context",Nn=10,Cn=function(n,t,r){e?(Error.call(this),Error.captureStackTrace(this,this.constructor)):"undefined"!=typeof Error&&(this.stack=(new Error).stack),this.name=t||"jsonld.Error",this.message=n||"An unspecified JSON-LD error occurred.",this.details=r||{}};e?require("util").inherits(Cn,Error):"undefined"!=typeof Error&&(Cn.prototype=new Error);var Dn=function(){};Dn.prototype.compact=function(e,n,r,a){if(V(r)){for(var o=[],i=0;i<r.length;++i){var l=this.compact(e,n,r[i],a);null!==l&&o.push(l)}if(a.compactArrays&&1===o.length){var u=t.getContextValue(e,n,"@container");null===u&&(o=o[0])}return o}if(_(r)){if(a.link&&"@id"in r&&r["@id"]in a.link)for(var s=a.link[r["@id"]],i=0;i<s.length;++i)if(s[i].expanded===r)return s[i].compacted;if(Y(r)||G(r)){var o=C(e,n,r);return a.link&&G(r)&&(r["@id"]in a.link||(a.link[r["@id"]]=[]),a.link[r["@id"]].push({expanded:r,compacted:o})),o}var c="@reverse"===n,o={};a.link&&"@id"in r&&(r["@id"]in a.link||(a.link[r["@id"]]=[]),a.link[r["@id"]].push({expanded:r,compacted:o}));for(var d=Object.keys(r).sort(),f=0;f<d.length;++f){var p=d[f],v=r[p];if("@id"!==p&&"@type"!==p)if("@reverse"!==p)if("@index"!==p)if("@graph"!==p&&"@list"!==p&&A(p)){var h=N(e,p);t.addValue(o,h,v)}else{if(0===v.length){var g=N(e,p,v,{vocab:!0},c);t.addValue(o,g,v,{propertyIsArray:!0})}for(var y=0;y<v.length;++y){var m=v[y],g=N(e,p,m,{vocab:!0},c),u=t.getContextValue(e,g,"@container"),x=Q(m),b=null;x&&(b=m["@list"]);var w=this.compact(e,g,x?b:m,a);if(x)if(V(w)||(w=[w]),"@list"!==u){var j={};j[N(e,"@list")]=w,w=j,"@index"in m&&(w[N(e,"@index")]=m["@index"])}else if(g in o)throw new Cn('JSON-LD compact error; property has a "@list" @container rule but there is more than a single @list that matches the compacted term in the document. Compaction might mix unwanted items into the list.',"jsonld.SyntaxError",{code:"compaction to list of lists"});if("@language"===u||"@index"===u){var I;g in o?I=o[g]:o[g]=I={},"@language"===u&&Y(w)&&(w=w["@value"]),t.addValue(I,m[u],w)}else{var O=!a.compactArrays||"@set"===u||"@list"===u||V(w)&&0===w.length||"@list"===p||"@graph"===p;t.addValue(o,g,w,{propertyIsArray:O})}}}else{var u=t.getContextValue(e,n,"@container");if("@index"===u)continue;var h=N(e,p);t.addValue(o,h,v)}else{var k=this.compact(e,"@reverse",v,a);for(var L in k)if(e.mappings[L]&&e.mappings[L].reverse){var S=k[L],u=t.getContextValue(e,L,"@container"),E="@set"===u||!a.compactArrays;t.addValue(o,L,S,{propertyIsArray:E}),delete k[L]}if(Object.keys(k).length>0){var h=N(e,p);t.addValue(o,h,k)}}else{var k;if(F(v))k=N(e,v,null,{vocab:"@type"===p});else{k=[];for(var y=0;y<v.length;++y)k.push(N(e,v[y],null,{vocab:!0}))}var h=N(e,p),O=V(k)&&0===v.length;t.addValue(o,h,k,{propertyIsArray:O})}}return o}return r},Dn.prototype.expand=function(e,n,r,o,l){var u=this;if(null===r||void 0===r)return null;if(!V(r)&&!_(r))return l||null!==n&&"@graph"!==R(e,n,{vocab:!0})?i(e,n,r):null;if(V(r)){var s=[],c=t.getContextValue(e,n,"@container");l=l||"@list"===c;for(var d=0;d<r.length;++d){var f=u.expand(e,n,r[d],o);if(l&&(V(f)||Q(f)))throw new Cn("Invalid JSON-LD syntax; lists of lists are not permitted.","jsonld.SyntaxError",{code:"list of lists"});null!==f&&(V(f)?s=s.concat(f):s.push(f))}return s}"@context"in r&&(e=u.processContext(e,r["@context"],o));for(var p=R(e,n,{vocab:!0}),s={},v=Object.keys(r).sort(),h=0;h<v.length;++h){var g,y=v[h],m=r[y];if("@context"!==y){var x=R(e,y,{vocab:!0});if(null!==x&&(K(x)||A(x))){if(A(x)){if("@reverse"===p)throw new Cn("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:m});if(x in s)throw new Cn("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:x})}if("@id"===x&&!F(m)){if(!o.isFrame)throw new Cn('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:m});if(!_(m))throw new Cn('Invalid JSON-LD syntax; "@id" value must be a string or an object.',"jsonld.SyntaxError",{code:"invalid @id value",value:m})}if("@type"===x&&P(m),"@graph"===x&&!_(m)&&!V(m))throw new Cn('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:m});if("@value"===x&&(_(m)||V(m)))throw new Cn('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",value:m});if("@language"===x){if(!F(m))throw new Cn('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:m});m=m.toLowerCase()}if("@index"===x&&!F(m))throw new Cn('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:m});if("@reverse"!==x){var c=t.getContextValue(e,y,"@container");if("@language"===c&&_(m))g=a(m);else if("@index"===c&&_(m))g=function(n){for(var t=[],r=Object.keys(m).sort(),a=0;a<r.length;++a){var i=r[a],l=m[i];V(l)||(l=[l]),l=u.expand(e,n,l,o,!1);for(var s=0;s<l.length;++s){var c=l[s];"@index"in c||(c["@index"]=i),t.push(c)}}return t}(y);else{var b="@list"===x;if(b||"@set"===x){var w=n;if(b&&"@graph"===p&&(w=null),g=u.expand(e,w,m,o,b),b&&Q(g))throw new Cn("Invalid JSON-LD syntax; lists of lists are not permitted.","jsonld.SyntaxError",{code:"list of lists"})}else g=u.expand(e,y,m,o,!1)}if(null!==g||"@value"===x)if("@list"===x||Q(g)||"@list"!==c||(g=V(g)?g:[g],g={"@list":g}),e.mappings[y]&&e.mappings[y].reverse){var j=s["@reverse"]=s["@reverse"]||{};V(g)||(g=[g]);for(var I=0;I<g.length;++I){var O=g[I];if(Y(O)||Q(O))throw new Cn('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:g});t.addValue(j,x,O,{propertyIsArray:!0})}}else{var k=-1===["@index","@id","@type","@value","@language"].indexOf(x);t.addValue(s,x,g,{propertyIsArray:k})}}else{if(!_(m))throw new Cn('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:m});if(g=u.expand(e,"@reverse",m,o),"@reverse"in g)for(var L in g["@reverse"])t.addValue(s,L,g["@reverse"][L],{propertyIsArray:!0});var j=s["@reverse"]||null;for(var L in g)if("@reverse"!==L){null===j&&(j=s["@reverse"]={}),t.addValue(j,L,[],{propertyIsArray:!0});for(var S=g[L],I=0;I<S.length;++I){var O=S[I];if(Y(O)||Q(O))throw new Cn('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:g});t.addValue(j,L,O,{propertyIsArray:!0})}}}}}}v=Object.keys(s);var E=v.length;if("@value"in s){if("@type"in s&&"@language"in s)throw new Cn('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and "@language".',"jsonld.SyntaxError",{code:"invalid value object",element:s});var N=E-1;if("@type"in s&&(N-=1),"@index"in s&&(N-=1),"@language"in s&&(N-=1),0!==N)throw new Cn('Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and at most one other property which can be "@type" or "@language".',"jsonld.SyntaxError",{code:"invalid value object",element:s});if(null===s["@value"])s=null;else{if("@language"in s&&!F(s["@value"]))throw new Cn("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:s});if("@type"in s&&(!K(s["@type"])||0===s["@type"].indexOf("_:")))throw new Cn('Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".',"jsonld.SyntaxError",{code:"invalid typed value",element:s})}}else if("@type"in s&&!V(s["@type"]))s["@type"]=[s["@type"]];else if("@set"in s||"@list"in s){if(E>1&&!(2===E&&"@index"in s))throw new Cn('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',"jsonld.SyntaxError",{code:"invalid set or list object",element:s});"@set"in s&&(s=s["@set"],v=Object.keys(s),E=v.length)}else 1===E&&"@language"in s&&(s=null);return!_(s)||o.keepFreeFloatingNodes||l||null!==n&&"@graph"!==p||(0===E||"@value"in s||"@list"in s||1===E&&"@id"in s)&&(s=null),s},Dn.prototype.createNodeMap=function(e,n){n=n||{};var t=n.namer||new ln("_:b"),r={"@default":{}};return h(e,r,"@default",t),g(r)},Dn.prototype.flatten=function(e){for(var n=this.createNodeMap(e),t=[],r=Object.keys(n).sort(),a=0;a<r.length;++a){var o=n[r[a]];G(o)||t.push(o)}return t},Dn.prototype.frame=function(e,n,t){var r={options:t,graphs:{"@default":{},"@merged":{}},subjectStack:[],link:{}},a=new ln("_:b");h(e,r.graphs,"@merged",a),r.subjects=r.graphs["@merged"];var o=[];return y(r,Object.keys(r.subjects).sort(),n,o,null),o},Dn.prototype.normalize=function(e,n,r){function a(e){function n(l){if(l===e.length)return o(i,a,r);var u=e[l],c=f(u,s);c in a?(a[c].push(u),r.push(u)):c in i?(a[c]=[i[c],u],r.push(i[c]),r.push(u),delete i[c]):i[c]=u,t.setImmediate(function(){n(l+1)})}var r=[],a={},i={};t.setImmediate(function(){n(0)})}function o(e,n,t){for(var r=!1,o=Object.keys(e).sort(),l=0;l<o.length;++l){var u=e[o[l]];b.getName(u),r=!0}r?a(t):i(n)}function i(e){function n(a){function o(e,t){if(t===e.length){u.sort(function(e,n){return e=e.hash,n=n.hash,n>e?-1:e>n?1:0});for(var i in u)for(var l in u[i].pathNamer.existing)b.getName(l);return n(a+1)}var c=e[t];if(b.isNamed(c))return o(e,t+1);var d=new ln("_:b");d.getName(c),p(c,s,b,d,function(n,a){return n?r(n):(u.push(a),void o(e,t+1))})}if(a===t.length)return l();var i=e[t[a]],u=[];o(i,0)}var t=Object.keys(e).sort();n(0)}function l(){for(var e=[],t=0;t<u.length;++t){for(var a=u[t],o=["subject","object","name"],i=0;i<o.length;++i){var l=o[i];a[l]&&"blank node"===a[l].type&&0!==a[l].value.indexOf("_:c14n")&&(a[l].value=b.getName(a[l].value))}e.push(an(a,a.name?a.name.value:null))}return e.sort(),n.format?"application/nquads"===n.format?r(null,e.join("")):r(new Cn("Unknown output format.","jsonld.UnknownFormat",{format:n.format})):void r(null,tn(e.join("")))}var u=[],s={};for(var c in e){var d=e[c];"@default"===c&&(c=null);for(var v=0;v<d.length;++v){var h=d[v];null!==c&&(h.name=0===c.indexOf("_:")?{type:"blank node",value:c}:{type:"IRI",value:c}),u.push(h);for(var g=["subject","object","name"],y=0;y<g.length;++y){var m=g[y];if(h[m]&&"blank node"===h[m].type){var x=h[m].value;x in s?s[x].quads.push(h):s[x]={quads:[h]}}}}}var b=new ln("_:c14n");return a(Object.keys(s))},Dn.prototype.fromRDF=function(e,n,r){var a={},o={"@default":a},i={};for(var l in e){var u=e[l];l in o||(o[l]={}),"@default"===l||l in a||(a[l]={"@id":l});for(var s=o[l],d=0;d<u.length;++d){var f=u[d],p=f.subject.value,v=f.predicate.value,h=f.object;p in s||(s[p]={"@id":p});var g=s[p],y="IRI"===h.type||"blank node"===h.type;if(!y||h.value in s||(s[h.value]={"@id":h.value}),v!==In||n.useRdfType||!y){var m=c(h,n.useNativeTypes);if(t.addValue(g,v,m,{propertyIsArray:!0}),y)if(h.value===jn){var x=s[h.value];"usages"in x||(x.usages=[]),x.usages.push({node:g,property:v,value:m})}else i[h.value]=h.value in i?!1:{node:g,property:v,value:m}}else t.addValue(g,"@type",h.value,{propertyIsArray:!0})}}for(var l in o){var b=o[l];if(jn in b){for(var w=b[jn],j=0;j<w.usages.length;++j){for(var I=w.usages[j],g=I.node,O=I.property,k=I.value,L=[],S=[],E=Object.keys(g).length;O===wn&&_(i[g["@id"]])&&V(g[bn])&&1===g[bn].length&&V(g[wn])&&1===g[wn].length&&(3===E||4===E&&V(g["@type"])&&1===g["@type"].length&&g["@type"][0]===xn)&&(L.push(g[bn][0]),S.push(g["@id"]),I=i[g["@id"]],g=I.node,O=I.property,k=I.value,E=Object.keys(g).length,0===g["@id"].indexOf("_:")););if(O===bn){if(g["@id"]===jn)continue;k=b[k["@id"]][wn][0],L.pop(),S.pop()}delete k["@id"],k["@list"]=L.reverse();for(var N=0;N<S.length;++N)delete b[S[N]]}delete w.usages}}for(var C=[],D=Object.keys(a).sort(),j=0;j<D.length;++j){var R=D[j],g=a[R];if(R in o)for(var u=g["@graph"]=[],b=o[R],U=Object.keys(b).sort(),T=0;T<U.length;++T){var J=b[U[T]];G(J)||u.push(J)}G(g)||C.push(g)}r(null,C)},Dn.prototype.toRDF=function(e,n){var t=new ln("_:b"),r={"@default":{}};h(e,r,"@default",t);for(var a={},o=Object.keys(r).sort(),i=0;i<o.length;++i){var u=o[i];("@default"===u||K(u))&&(a[u]=l(r[u],t,n))}return a},Dn.prototype.processContext=function(e,n,r){_(n)&&"@context"in n&&V(n["@context"])&&(n=n["@context"]);var a=V(n)?n:[n];if(0===a.length)return e.clone();for(var o=e,i=0;i<a.length;++i){var l=a[i];if(null!==l){if(_(l)&&"@context"in l&&(l=l["@context"]),!_(l))throw new Cn("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:l});if(t.cache.activeCtx){var u=t.cache.activeCtx.get(e,l);if(u){o=e=u;continue}}e=o,o=o.clone();var s={};if("@base"in l){var c=l["@base"];if(null===c)c=null;else{if(!F(c))throw new Cn('Invalid JSON-LD syntax; the value of "@base" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid base IRI",context:l});if(""!==c&&!K(c))throw new Cn('Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI or the empty string.',"jsonld.SyntaxError",{code:"invalid base IRI",context:l})}null!==c&&(c=t.url.parse(c||"")),o["@base"]=c,s["@base"]=!0}if("@vocab"in l){var d=l["@vocab"];if(null===d)delete o["@vocab"];else{if(!F(d))throw new Cn('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:l});if(!K(d))throw new Cn('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:l});o["@vocab"]=d}s["@vocab"]=!0}if("@language"in l){var d=l["@language"];if(null===d)delete o["@language"];
  else{if(!F(d))throw new Cn('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:l});o["@language"]=d.toLowerCase()}s["@language"]=!0}for(var f in l)D(o,l,f,s);t.cache.activeCtx&&t.cache.activeCtx.set(e,l,o)}else o=e=J(r)}return o},Object.keys||(Object.keys=function(e){if(e!==Object(e))throw new TypeError("Object.keys called on non-object");var n=[];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.push(t);return n}),t.registerRDFParser("application/nquads",tn),t.registerRDFParser("rdfa-api",on),t.UniqueNamer=ln,ln.prototype.clone=function(){var e=new ln(this.prefix);return e.counter=this.counter,e.existing=W(this.existing),e},ln.prototype.getName=function(e){if(e&&e in this.existing)return this.existing[e];var n=this.prefix+this.counter;return this.counter+=1,e&&(this.existing[e]=n),n},ln.prototype.isNamed=function(e){return e in this.existing};var Rn=function(e){this.list=e.sort(),this.done=!1,this.left={};for(var n=0;n<e.length;++n)this.left[e[n]]=!0};Rn.prototype.hasNext=function(){return!this.done},Rn.prototype.next=function(){for(var e=this.list.slice(),n=null,t=0,r=this.list.length,a=0;r>a;++a){var o=this.list[a],i=this.left[o];(null===n||o>n)&&(i&&a>0&&o>this.list[a-1]||!i&&r-1>a&&o>this.list[a+1])&&(n=o,t=a)}if(null===n)this.done=!0;else{var l=this.left[n]?t-1:t+1;this.list[t]=this.list[l],this.list[l]=n;for(var a=0;r>a;++a)this.list[a]>n&&(this.left[this.list[a]]=!this.left[this.list[a]])}return e};var Un=t.sha1={};if(e){var Tn=require("crypto");Un.create=function(){var e=Tn.createHash("sha1");return{update:function(n){e.update(n,"utf8")},digest:function(){return e.digest("hex")}}}}else Un.create=function(){return new Un.MessageDigest};if(Un.hash=function(e){for(var n=Un.create(),t=0;t<e.length;++t)n.update(e[t]);return n.digest()},!e){Un.Buffer=function(){this.data="",this.read=0},Un.Buffer.prototype.putInt32=function(e){this.data+=String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)},Un.Buffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},Un.Buffer.prototype.bytes=function(){return this.data.slice(this.read)},Un.Buffer.prototype.length=function(){return this.data.length-this.read},Un.Buffer.prototype.compact=function(){this.data=this.data.slice(this.read),this.read=0},Un.Buffer.prototype.toHex=function(){for(var e="",n=this.read;n<this.data.length;++n){var t=this.data.charCodeAt(n);16>t&&(e+="0"),e+=t.toString(16)}return e},Un.MessageDigest=function(){Jn.initialized||Jn.init(),this.blockLength=64,this.digestLength=20,this.messageLength=0,this.input=new Un.Buffer,this.words=new Array(80),this.state={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520}},Un.MessageDigest.prototype.update=function(e){e=unescape(encodeURIComponent(e)),this.messageLength+=e.length,this.input.data+=e,Jn.update(this.state,this.words,this.input),(this.input.read>2048||0===this.input.length())&&this.input.compact()},Un.MessageDigest.prototype.digest=function(){var e=this.messageLength,n=new Un.Buffer;n.data+=this.input.bytes(),n.data+=Jn.padding.substr(0,64-(e+8)%64),n.putInt32(e>>>29&255),n.putInt32(e<<3&4294967295),Jn.update(this.state,this.words,n);var t=new Un.Buffer;return t.putInt32(this.state.h0),t.putInt32(this.state.h1),t.putInt32(this.state.h2),t.putInt32(this.state.h3),t.putInt32(this.state.h4),t.toHex()};var Jn={padding:null,initialized:!1};Jn.init=function(){Jn.padding=String.fromCharCode(128);for(var e=String.fromCharCode(0),n=64;n>0;)1&n&&(Jn.padding+=e),n>>>=1,n>0&&(e+=e);Jn.initialized=!0},Jn.update=function(e,n,t){for(var r,a,o,i,l,u,s,c,d=t.length();d>=64;){for(a=e.h0,o=e.h1,i=e.h2,l=e.h3,u=e.h4,c=0;16>c;++c)r=t.getInt32(),n[c]=r,s=l^o&(i^l),r=(a<<5|a>>>27)+s+u+1518500249+r,u=l,l=i,i=o<<30|o>>>2,o=a,a=r;for(;20>c;++c)r=n[c-3]^n[c-8]^n[c-14]^n[c-16],r=r<<1|r>>>31,n[c]=r,s=l^o&(i^l),r=(a<<5|a>>>27)+s+u+1518500249+r,u=l,l=i,i=o<<30|o>>>2,o=a,a=r;for(;32>c;++c)r=n[c-3]^n[c-8]^n[c-14]^n[c-16],r=r<<1|r>>>31,n[c]=r,s=o^i^l,r=(a<<5|a>>>27)+s+u+1859775393+r,u=l,l=i,i=o<<30|o>>>2,o=a,a=r;for(;40>c;++c)r=n[c-6]^n[c-16]^n[c-28]^n[c-32],r=r<<2|r>>>30,n[c]=r,s=o^i^l,r=(a<<5|a>>>27)+s+u+1859775393+r,u=l,l=i,i=o<<30|o>>>2,o=a,a=r;for(;60>c;++c)r=n[c-6]^n[c-16]^n[c-28]^n[c-32],r=r<<2|r>>>30,n[c]=r,s=o&i|l&(o^i),r=(a<<5|a>>>27)+s+u+2400959708+r,u=l,l=i,i=o<<30|o>>>2,o=a,a=r;for(;80>c;++c)r=n[c-6]^n[c-16]^n[c-28]^n[c-32],r=r<<2|r>>>30,n[c]=r,s=o^i^l,r=(a<<5|a>>>27)+s+u+3395469782+r,u=l,l=i,i=o<<30|o>>>2,o=a,a=r;e.h0+=a,e.h1+=o,e.h2+=i,e.h3+=l,e.h4+=u,d-=64}}}if(!fn)var An=function(){fn=require("xmldom").XMLSerializer};if(t.url={},t.url.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:/^(([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},t.url.parse=function(e,n){for(var r={},a=t.url.parsers[n||"full"],o=a.regex.exec(e),i=a.keys.length;i--;)r[a.keys[i]]=void 0===o[i]?null:o[i];return r.normalizedPath=un(r.path,!!r.authority),r},e?t.useDocumentLoader("node"):"undefined"!=typeof XMLHttpRequest&&t.useDocumentLoader("xhr"),e){t.use=function(e){switch(e){case"request":t.request=require("./request");break;default:throw new Cn("Unknown extension.","jsonld.UnknownExtension",{extension:e})}};var _n={exports:{}};require("pkginfo")(_n,"version"),t.version=_n.exports.version}return t},r=function(){return t(function(){return r()})};t(r),e?module.exports=r:"function"==typeof define&&define.amd?define([],function(){return r}):n&&("undefined"==typeof jsonld?jsonld=jsonldjs=r:jsonldjs=r)}();