From 19753fef6215694842b60531be212bd98fa54d40 Mon Sep 17 00:00:00 2001 From: angelo-v Date: Sun, 19 May 2024 19:46:39 +0000 Subject: [PATCH] deploy: cfc0f8c437d7872d76dc384d686c28d5d6100e35 --- dist/rdflib.min.js | 2 +- dist/rdflib.min.js.map | 2 +- doc/classes/BlankNode.html | 38 ++-- doc/classes/Collection.html | 36 ++-- doc/classes/ConnectedStore.html | 186 +++++++++---------- doc/classes/Empty.html | 28 +-- doc/classes/Fetcher.html | 56 +++--- doc/classes/Formula.html | 106 +++++------ doc/classes/Literal.html | 46 ++--- doc/classes/LiveStore.html | 186 +++++++++---------- doc/classes/NamedNode-1.html | 40 ++-- doc/classes/Node.html | 28 +-- doc/classes/Query.html | 4 +- doc/classes/RDFParser.html | 10 +- doc/classes/RDFaProcessor.html | 4 +- doc/classes/Statement.html | 26 +-- doc/classes/Store.html | 186 +++++++++---------- doc/classes/UpdateManager.html | 34 ++-- doc/classes/UpdatesSocket.html | 4 +- doc/classes/UpdatesVia.html | 4 +- doc/classes/Variable.html | 32 ++-- doc/functions/N3Parser.html | 2 +- doc/functions/SPARQLToQuery.html | 2 +- doc/functions/Serializer.html | 2 +- doc/functions/blankNode-1.html | 2 +- doc/functions/defaultGraph.html | 2 +- doc/functions/fetcher-1.html | 2 +- doc/functions/fromNT.html | 2 +- doc/functions/graph.html | 2 +- doc/functions/isBlankNode.html | 2 +- doc/functions/isCollection.html | 2 +- doc/functions/isGraph.html | 2 +- doc/functions/isLiteral.html | 2 +- doc/functions/isNamedNode.html | 2 +- doc/functions/isPredicate.html | 2 +- doc/functions/isQuad.html | 2 +- doc/functions/isRDFObject.html | 2 +- doc/functions/isRDFlibObject.html | 2 +- doc/functions/isRDFlibPredicate.html | 2 +- doc/functions/isRDFlibSubject.html | 2 +- doc/functions/isStatement.html | 2 +- doc/functions/isStore.html | 2 +- doc/functions/isSubject.html | 2 +- doc/functions/isTerm.html | 2 +- doc/functions/isVariable.html | 2 +- doc/functions/lit.html | 2 +- doc/functions/literal-1.html | 2 +- doc/functions/parse.html | 2 +- doc/functions/quad.html | 2 +- doc/functions/queryToSPARQL.html | 2 +- doc/functions/serialize.html | 2 +- doc/functions/sparqlUpdateParser.html | 2 +- doc/functions/st.html | 2 +- doc/functions/sym.html | 2 +- doc/functions/term.html | 2 +- doc/functions/termValue.html | 2 +- doc/functions/triple.html | 2 +- doc/functions/uri.docpart.html | 2 +- doc/functions/uri.document.html | 2 +- doc/functions/uri.hostpart.html | 2 +- doc/functions/uri.join.html | 2 +- doc/functions/uri.protocol.html | 2 +- doc/functions/uri.refTo.html | 2 +- doc/functions/util.DOMParserFactory.html | 2 +- doc/functions/util.RDFArrayRemove.html | 2 +- doc/functions/util.callbackify.html | 2 +- doc/functions/util.domToString.html | 2 +- doc/functions/util.dtstamp.html | 2 +- doc/functions/util.dumpNode.html | 2 +- doc/functions/util.heavyCompare.html | 2 +- doc/functions/util.heavyCompareSPO.html | 2 +- doc/functions/util.linkRelationProperty.html | 2 +- doc/functions/util.mediaTypeClass.html | 2 +- doc/functions/util.output.html | 2 +- doc/functions/util.parseXML.html | 2 +- doc/functions/util.stackString.html | 2 +- doc/functions/util.string_startswith.html | 2 +- doc/functions/variable-1.html | 2 +- doc/interfaces/AutoInitOptions.html | 30 +-- doc/interfaces/ExtendedResponse.html | 8 +- doc/interfaces/FetchError.html | 4 +- doc/modules/uri.html | 2 +- doc/modules/util.html | 2 +- doc/variables/DataFactory.html | 2 +- doc/variables/NextId.html | 2 +- doc/variables/jsonParser.html | 2 +- doc/variables/log.html | 2 +- doc/variables/util.string.html | 2 +- esm/n3parser.js | 2 +- lib/n3parser.js | 2 +- src/n3parser.js | 2 +- 91 files changed, 617 insertions(+), 617 deletions(-) diff --git a/dist/rdflib.min.js b/dist/rdflib.min.js index efd33125c..549772841 100644 --- a/dist/rdflib.min.js +++ b/dist/rdflib.min.js @@ -1,3 +1,3 @@ /*! For license information please see rdflib.min.js.LICENSE.txt */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("window")):"function"==typeof define&&define.amd?define(["window"],e):"object"==typeof exports?exports.$rdf=e(require("window")):t.$rdf=e(t.window)}(self,(t=>(()=>{var e,r,n,i,o={9390:(t,e,r)=>{"use strict";r.d(e,{A:()=>n});const n={Literal:1,Collection:3,Graph:4,NamedNode:5,BlankNode:6,Variable:7}},3787:(t,e,r)=>{"use strict";r.d(e,{A:()=>n});const n={debug:function(t){},warn:function(t){},info:function(t){},error:function(t){},success:function(t){},msg:function(t){}}},3627:(t,e,r)=>{"use strict";r.d(e,{A:()=>v});var n=r(9121),i=r(2937),o=r(365),a=r(8782),s=r(9604),u=r(8175),c=r(9390),l=r(1605),h=r(6866),f=r(362),p=r(546);function d(t,e,r){return e=(0,a.A)(e),(0,o.A)(t,y()?Reflect.construct(e,r||[],(0,a.A)(t).constructor):e.apply(t,r))}function y(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(y=function(){return!!t})()}var v=function(t){function e(t){var r;if((0,n.A)(this,e),r=d(this,e,[(0,f.E)(t)]),(0,u.A)(r,"termType",h.Kk),(0,u.A)(r,"classOrder",c.A.NamedNode),!r.value)throw new Error("Missing IRI for NamedNode");if(!r.value.includes(":"))throw new Error('NamedNode IRI "'+t+'" must be absolute.');if(r.value.includes(" "))throw new Error('Error: NamedNode IRI "'+t+'" must not contain unencoded spaces.');return r}return(0,s.A)(e,t),(0,i.A)(e,[{key:"dir",value:function(){var t=this.value.split("#")[0],r=t.slice(0,-1).lastIndexOf("/"),n=t.indexOf("//");return n>=0&&r"}},{key:"id",value:function(){return this.value.split("#")[1]}},{key:"uri",get:function(){return this.value},set:function(t){this.value=t}}],[{key:"fromValue",value:function(t){return null==t||(0,p.D0)(t)?t:new e(t)}}])}(l.A)},1605:(t,e,r)=>{"use strict";r.d(e,{A:()=>a});var n=r(9121),i=r(2937),o=r(8175),a=function(){return(0,i.A)((function t(e){(0,n.A)(this,t),(0,o.A)(this,"termType",void 0),(0,o.A)(this,"classOrder",void 0),(0,o.A)(this,"value",void 0),this.value=e}),[{key:"substitute",value:function(t){return this}},{key:"compareTerm",value:function(t){return this.classOrdert.classOrder?1:this.valuet.value?1:0}},{key:"equals",value:function(t){return!!t&&this.termType===t.termType&&this.value===t.value}},{key:"hashString",value:function(){return this.toCanonical()}},{key:"sameTerm",value:function(t){return this.equals(t)}},{key:"toCanonical",value:function(){return this.toNT()}},{key:"toNT",value:function(){return this.toString()}},{key:"toNQ",value:function(){return this.toNT()}},{key:"toString",value:function(){throw new Error("Node.toString() is abstract - see the subclasses instead")}}])}();(0,o.A)(a,"fromValue",void 0),(0,o.A)(a,"toJS",void 0)},6866:(t,e,r)=>{"use strict";r.d(e,{$Q:()=>i,BR:()=>y,Fn:()=>w,H:()=>_,JG:()=>m,K9:()=>b,Kk:()=>n,MG:()=>d,P2:()=>a,QW:()=>o,S:()=>c,_0:()=>v,bD:()=>l,bM:()=>g,hu:()=>x,i2:()=>f,ic:()=>s,lc:()=>h,ny:()=>p,r0:()=>u,sT:()=>A});var n="NamedNode",i="BlankNode",o="Literal",a="Variable",s="DefaultGraph",u="Collection",c="Empty",l="Graph",h="text/html",f="application/ld+json",p="text/n3",d="application/n3",y="application/nquads",v="application/n-quads",g="application/n-triples",m="application/rdf+xml",b="application/sparql-update",w="application/sparql-update-single-match",A="text/turtle",x="application/x-turtle",_="application/xhtml+xml"},4221:(t,e,r)=>{"use strict";r.r(e),r.d(e,{docpart:()=>a,document:()=>s,hostpart:()=>u,join:()=>c,protocol:()=>l,refTo:()=>h});var n=r(3627),i=r(6357),o=o||i.log;function a(t){var e;return(e=t.indexOf("#"))<0?t:t.slice(0,e)}function s(t){return new n.A(a(t))}function u(t){var e=/[^\/]*\/\/([^\/]*)\//.exec(t);return e?e[1]:""}function c(t,e){var r,n,i,a,s,u=e.indexOf("#");if(u>0&&(e=e.slice(0,u)),0===t.length)return e;if(0===t.indexOf("#"))return e+t;if(t.indexOf(":")>=0)return t;if(r=e.indexOf(":"),0===e.length)return t;if(r<0)return o("Invalid base: "+e+" in join with given: "+t),t;if(n=e.slice(0,+r+1||9e9),0===t.indexOf("//"))return n+t;if(e.indexOf("//",r)===r+1){if((i=e.indexOf("/",r+3))<0)return e.length-r-3>0?e+"/"+t:n+t}else if((i=e.indexOf("/",r+1))<0)return e.length-r-1>0?e+"/"+t:n+t;if(0===t.indexOf("/"))return e.slice(0,i)+t;if((a=(s=e.slice(i)).lastIndexOf("/"))<0)return n+t;for(a>=0&&a0&&"/"!==e[r-1];)r--;if(r<3)return e;if(t.indexOf("//",r-2)>0||e.indexOf("//",r-2)>0)return e;if(t.indexOf(":",r)>0)return e;for(s=0,c=0,a=(h=t.slice(r)).length;c0)for(l=1,f=s;f>=1?l<=f:l>=f;f>=1?++l:--l)p+="../";return p+e.slice(r)}},7114:(t,e,r)=>{"use strict";r.r(e),r.d(e,{DOMParserFactory:()=>f,RDFArrayRemove:()=>w,callbackify:()=>h,domToString:()=>p,dtstamp:()=>y,dumpNode:()=>d,heavyCompare:()=>v,heavyCompareSPO:()=>g,linkRelationProperty:()=>l,log:()=>n.A,mediaTypeClass:()=>c,output:()=>m,parseXML:()=>b,stackString:()=>x,string:()=>u,string_startswith:()=>A,uri:()=>i});var n=r(3787),i=r(4221),o=r(3627),a=r(8392);t=r.hmd(t);var s=r(6357),u={template:function(t,e){for(var r=t.split("%s"),n="",i=0;i=0;r--)t.callbacks[e[r]]=[];t.addHook=function(e){t.callbacks[e]||(t.callbacks[e]=[])},t.addCallback=function(e,r){t.callbacks[e].push(r)},t.removeCallback=function(e,r){for(var n=0;n=0;n--)(i=t.callbacks[e][n])&&i.apply(t,r)&&o.push(i);for(n=o.length-1;n>=0;n--)a.push(o[n]);for(n=s;n=0;i--){var l=t.attributes[i];if(!(n&&n.length>0&&n[l.name]||/^\d+$/.test(l.name))){if("class"===l.name&&e&&e.replaceClassItemWith&&l.value.split(" ").indexOf(e.replaceClassItemWith.source)>-1){var h=new RegExp(e.replaceClassItemWith.source,"g");l.value=l.value.replace(h,e.replaceClassItemWith.target).trim()}"class"===l.name&&e&&e.skipClassWithValue&&e.skipClassWithValue===l.value||c.push(l.name+"='"+l.value.replace(/&/g,"&").replace(//g,">").replace(/'/g,""")+"'")}}if(c.length>0&&(e&&e.sortAttributes&&c.sort((function(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())})),o+=" "+c.join(" ")),r&&r.ename)o+=" />";else{for(o+=">",o+="html"===u?"\n ":"",a.push("style"===u||"script"===u),i=0;i\n":""}}}else if(8===t.nodeType)o+="\x3c!--"+t.nodeValue+"--\x3e";else if(3===t.nodeType||4===t.nodeType){var f=t.nodeValue.replace(/\n+$/,"");o+=a[a.length-1]?f:f.replace(/&/g,"&").replace(//g,">")}else s.log("Warning; Cannot handle serialising nodes of type: "+t.nodeType),s.log(t);return o}function y(){var t=new Date,e=t.getYear()+1900,r=t.getMonth()+1,n=t.getDate(),i=t.getUTCHours(),o=t.getUTCMinutes(),a=t.getSeconds();return r<10&&(r="0"+r),n<10&&(n="0"+n),i<10&&(i="0"+i),o<10&&(o="0"+o),a<10&&(a="0"+a),e+"-"+r+"-"+n+"T"+i+":"+o+":"+a+"Z"}function v(t,e,r,n){var i=function(t){return"BlankNode"===t.termType?null:t},o=function(t){var e=r.statementsMatching(t).map((function(t){return i(t.subject)+" "+i(t.predicate)+" "+i(t.object)})).concat(r.statementsMatching(void 0,void 0,t).map((function(t){return i(t.subject)+" "+i(t.predicate)+" "+i(t.object)})));return e.sort(),e.join("\n")},a=Object.prototype.hasOwnProperty.call(r,"compareTerms")?r.compareTerms(t,e):t.compareTerm(e);return"BlankNode"===t.termType&&"BlankNode"===e.termType?0===a?0:o(t)>o(e)?1:o(t)-1)break;"("==o.charAt(0)&&(o="function"+o);var a=o.split("@");n.push(a)}for(i=0;i{"use strict";function n(t){return"string"==typeof t?t:t.value}r.d(e,{E:()=>n})},546:(t,e,r)=>{"use strict";r.d(e,{CZ:()=>c,D0:()=>f,DJ:()=>u,DZ:()=>h,GE:()=>b,P3:()=>s,RN:()=>w,SH:()=>o,Y2:()=>y,YC:()=>m,aF:()=>d,c$:()=>p,fY:()=>l,hr:()=>g,jt:()=>v,ok:()=>a});var n=r(4360),i=r(6866);function o(t){return"object"===(0,n.A)(t)&&null!==t&&"subject"in t}function a(t){return"object"===(0,n.A)(t)&&null!==t&&"statements"in t}function s(t){return f(t)&&t.termType===i.r0}function u(t){return t&&Object.prototype.hasOwnProperty.call(t,"termType")&&(t.termType===i.Kk||t.termType===i.P2||t.termType===i.$Q||t.termType===i.r0||t.termType===i.QW||t.termType===i.bD)}function c(t){return t&&Object.prototype.hasOwnProperty.call(t,"termType")&&(t.termType===i.Kk||t.termType===i.P2||t.termType===i.$Q||t.termType===i.r0||t.termType===i.QW||t.termType===i.bD)}function l(t){return f(t)&&(t.termType===i.Kk||t.termType===i.$Q||t.termType===i.P2)}function h(t){return f(t)&&t.termType===i.P2}function f(t){return"object"===(0,n.A)(t)&&null!==t&&"termType"in t}function p(t){return t.termType===i.QW}function d(t){return"object"===(0,n.A)(t)&&null!==t&&"subject"in t&&"predicate"in t&&"object"in t}function y(t){return f(t)&&"NamedNode"===t.termType}function v(t){return f(t)&&"termType"in t&&"BlankNode"===t.termType}function g(t){return f(t)&&(t.termType===i.Kk||t.termType===i.P2||t.termType===i.$Q)}function m(t){return f(t)&&(t.termType===i.Kk||t.termType===i.P2)}function b(t){return f(t)&&(t.termType===i.Kk||t.termType===i.P2||t.termType===i.$Q||t.termType===i.QW)}function w(t){return f(t)&&(t.termType===i.Kk||t.termType===i.P2||t.termType===i.$Q||t.termType===i.ic)}},2312:function(t,e,r){var n,i;void 0===(i="function"==typeof(n=function(){"use strict";function t(e,r,n,i){this.message=e,this.expected=r,this.found=n,this.location=i,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t)}return function(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}(t,Error),t.buildMessage=function(t,e){var r={literal:function(t){return'"'+i(t.text)+'"'},class:function(t){var e,r="";for(e=0;e0){for(e=1,n=1;eArray.isArray(t))).forEach((t=>{t.forEach((t=>{e["@graph"].push(t)}))})),1===e["@graph"].length&&(Object.assign(e,e["@graph"][0]),delete e["@graph"]),e},c=".",l=Hr(".",!1),h=function(t){return t},f="#",p=Hr("#",!1),d=/^[^\n]/,y=$r(["\n"],!0,!1),v="\n",g=Hr("\n",!1),m=function(t){return t.join("")},b="@prefix",w=Hr("@prefix",!1),A=function(t,e){return _n.addPrefix(""===t?"0":t,e),{}},x="@base",_=Hr("@base",!1),k=function(t){return _n.addBase(t),{}},T=/^[Bb]/,E=$r(["B","b"],!1,!1),O=/^[Aa]/,j=$r(["A","a"],!1,!1),N=/^[Ss]/,S=$r(["S","s"],!1,!1),R=/^[Ee]/,I=$r(["E","e"],!1,!1),C=/^[Pp]/,P=$r(["P","p"],!1,!1),F=/^[Rr]/,U=$r(["R","r"],!1,!1),D=/^[Ff]/,L=$r(["F","f"],!1,!1),M=/^[Ii]/,B=$r(["I","i"],!1,!1),q=/^[Xx]/,H=$r(["X","x"],!1,!1),$=function(t,e){var r={};return"string"==typeof t&&"[]"!==t?r["@id"]=t:"object"==typeof t&&Object.assign(r,t),e&&Object.assign(r,e),[r]},z=function(t,e){var r={};return t&&Object.assign(r,t),e&&Object.assign(r,e),[r]},X=";",G=Hr(";",!1),V=function(t,e,r,n){var i={};return i[r]=n,i},W=function(t,e,r){return r},Q=function(t,e,r){var n={};return r.unshift(function(t,e){var r={};return r[t]=e,r}(t,e)),r.forEach((t=>{t&&Object.keys(t).forEach((e=>{t[e].forEach((t=>{"@type"===e&&void 0!==t["@id"]&&(t=t["@id"]),void 0===n[e]?n[e]=t:Array.isArray(n[e])?n[e].push(t):n[e]=[n[e],t]}))}))})),n},Y=",",J=Hr(",",!1),Z=function(t,e){return e},K=function(t,e){return e.unshift(t),e},tt="a",et=Hr("a",!1),rt=function(){return"@type"},nt=function(t){return kn(t,!0)},it=function(t){return kn(t,!1)},ot=function(t){return"[]"===t?{}:{"@id":t}},at=function(t){return{"@id":t}},st="[",ut=Hr("[",!1),ct="]",lt=Hr("]",!1),ht="(",ft=Hr("(",!1),pt=")",dt=Hr(")",!1),yt=function(t){return{"@list":t}},vt=function(t,e){return{"@value":t,"@language":e}},gt="^^",mt=Hr("^^",!1),bt=function(t,e){if("http://www.w3.org/2001/XMLSchema#boolean"===e&&"true"===t)return!0;if("http://www.w3.org/2001/XMLSchema#boolean"===e&&"false"===t)return!1;if("http://www.w3.org/2001/XMLSchema#integer"===e)return parseInt(t);if("http://www.w3.org/2001/XMLSchema#double"===e)return parseFloat(t);const r=_n.resolve(e,!0);if(r){const n=e.split(":")[0];if("http://www.w3.org/2001/XMLSchema#boolean"===r&&"true"===t)return _n.decrement(n),!0;if("http://www.w3.org/2001/XMLSchema#boolean"===r&&"false"===t)return _n.decrement(n),!1;if("http://www.w3.org/2001/XMLSchema#integer"===r)return _n.decrement(n),parseInt(t);if("http://www.w3.org/2001/XMLSchema#double"===r)return _n.decrement(n),parseFloat(t)}return{"@value":t,"@type":e}},wt="true",At=Hr("true",!1),xt=function(){return!0},_t="false",kt=Hr("false",!1),Tt=function(){return!1},Et=function(t){return t+":"},Ot="<",jt=Hr("<",!1),Nt=/^[^\0- <>"{}|\^`\\]/,St=$r([["\0"," "],"<",">",'"',"{","}","|","^","`","\\"],!0,!1),Rt=">",It=Hr(">",!1),Ct=function(t){const e=t.map((t=>65536<=t.codePointAt(0)&&t.codePointAt(0)<=983039?"a":1===t.length?t:6===t.length?String.fromCharCode("0x"+t.substring(2)):10===t.length?String.fromCodePoint("0x"+t.substring(2)):t)).join("");if(e.match(/^[^\u0000-\u0020<>"{}|^`\\]*$/)){var r=t.join("");try{return _n.resolve(r)}catch(t){qr("Invalid IRIREF "+r)}}else qr("Invalid IRIREF "+t.join("")+" / "+e)},Pt=":",Ft=Hr(":",!1),Ut=function(t){return t=t||"0",!1===_n.hasPrefix(t)&&qr("undefined prefix "+t),t},Dt=function(t){return t||""},Lt=function(t,e){return _n.increment(t),_n.resolve(t+":"+e)},Mt="_:",Bt=Hr("_:",!1),qt=/^[0-9]/,Ht=$r([["0","9"]],!1,!1),$t="@",zt=Hr("@",!1),Xt=/^[a-zA-Z]/,Gt=$r([["a","z"],["A","Z"]],!1,!1),Vt="-",Wt=Hr("-",!1),Qt=/^[a-zA-Z0-9]/,Yt=$r([["a","z"],["A","Z"],["0","9"]],!1,!1),Jt=function(t,e){return"-"+e.join("")},Zt=function(t,e){return t.join("")+e.join("")},Kt=/^[+\-]/,te=$r(["+","-"],!1,!1),ee=function(t){return t.match(/^[0+][0-9]+$/)?{"@value":t,"@type":"http://www.w3.org/2001/XMLSchema#integer"}:parseInt(t)},re=function(t){return{"@value":t,"@type":"http://www.w3.org/2001/XMLSchema#decimal"}},ne=function(t){return{"@value":t,"@type":"http://www.w3.org/2001/XMLSchema#double"}},ie=/^[eE]/,oe=$r(["e","E"],!1,!1),ae='"',se=Hr('"',!1),ue=/^[^"\\\n\r]/,ce=$r(['"',"\\","\n","\r"],!0,!1),le="'",he=Hr("'",!1),fe=/^[^'\\\n\r]/,pe=$r(["'","\\","\n","\r"],!0,!1),de="'''",ye=Hr("'''",!1),ve=/^[^'\\]/,ge=$r(["'","\\"],!0,!1),me="''",be=Hr("''",!1),we=function(t,e){return"''"+e.join("")},Ae=function(t,e){return"'"+e.join("")},xe=function(t,e){return t.join("")+e.join("")},_e='"""',ke=Hr('"""',!1),Te=/^[^"\\]/,Ee=$r(['"',"\\"],!0,!1),Oe='""',je=Hr('""',!1),Ne=function(t,e){return'""'+e.join("")},Se=function(t,e){return'"'+e.join("")},Re="\\U",Ie=Hr("\\U",!1),Ce=function(t){return String.fromCodePoint(parseInt(t.join(""),16))},Pe="\\u",Fe=Hr("\\u",!1),Ue=function(t){return String.fromCharCode(parseInt(t.join(""),16))},De="\\t",Le=Hr("\\t",!1),Me=function(){return"\t"},Be="\\b",qe=Hr("\\b",!1),He=function(){return"\b"},$e="\\n",ze=Hr("\\n",!1),Xe=function(){return"\n"},Ge="\\r",Ve=Hr("\\r",!1),We=function(){return"\r"},Qe="\\f",Ye=Hr("\\f",!1),Je=function(){return"\f"},Ze='\\"',Ke=Hr('\\"',!1),tr=function(){return'"'},er="\\'",rr=Hr("\\'",!1),nr=function(){return"'"},ir="\\\\",or=Hr("\\\\",!1),ar=function(){return"\\"},sr=/^[ \t\r\n]/,ur=$r([" ","\t","\r","\n"],!1,!1),cr=function(){return"[]"},lr=/^[\uD800-\uDBFF]/,hr=$r([["\ud800","\udbff"]],!1,!1),fr=/^[\uDC00-\uDFFF]/,pr=$r([["\udc00","\udfff"]],!1,!1),dr=function(t,e){return t+e},yr=/^[A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,vr=$r([["A","Z"],["a","z"],["À","Ö"],["Ø","ö"],["ø","˿"],["Ͱ","ͽ"],["Ϳ","῿"],["‌","‍"],["⁰","↏"],["Ⰰ","⿯"],["、","퟿"],["豈","﷏"],["ﷰ","�"]],!1,!1),gr="_",mr=Hr("_",!1),br="·",wr=Hr("·",!1),Ar=/^[\u0300-\u036F]/,xr=$r([["̀","ͯ"]],!1,!1),_r=/^[\u203F-\u2040]/,kr=$r([["‿","⁀"]],!1,!1),Tr=function(t,e,r,n){return r.join("")+n.join("")},Er=function(t,e,r){return t+e.join("")+r.join("")},Or="%",jr=Hr("%",!1),Nr=/^[0-9A-Fa-f]/,Sr=$r([["0","9"],["A","F"],["a","f"]],!1,!1),Rr="\\",Ir=Hr("\\",!1),Cr=/^[_~.!$&'()*+,;=\/?#@%\-]/,Pr=$r(["_","~",".","!","$","&","'","(",")","*","+",",",";","=","/","?","#","@","%","-"],!1,!1),Fr=0,Ur=0,Dr=[{line:1,column:1}],Lr=0,Mr=[],Br=0;if("startRule"in n){if(!(n.startRule in a))throw new Error("Can't start parsing from rule \""+n.startRule+'".');s=a[n.startRule]}function qr(e,r){throw function(e,r){return new t(e,null,null,r)}(e,r=void 0!==r?r:Xr(Ur,Fr))}function Hr(t,e){return{type:"literal",text:t,ignoreCase:e}}function $r(t,e,r){return{type:"class",parts:t,inverted:e,ignoreCase:r}}function zr(t){var r,n=Dr[t];if(n)return n;for(r=t-1;!Dr[r];)r--;for(n={line:(n=Dr[r]).line,column:n.column};rLr&&(Lr=Fr,Mr=[]),Mr.push(t))}function Vr(){var t,e,r,n;for(t=Fr,e=[],r=Wr();r!==o;)e.push(r),r=Wr();if(e!==o){for(r=[],n=Qr();n!==o;)r.push(n),n=Qr();r!==o?(Ur=t,t=e=u(e)):(Fr=t,t=o)}else Fr=t,t=o;return t}function Wr(){var t,r,n,i;if((t=function(){var t;return(t=function(){var t,r,n,i,a,s,u,h,f;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o)if(e.substr(Fr,7)===b?(n=b,Fr+=7):(n=o,0===Br&&Gr(w)),n!==o){for(i=[],a=Qr();a!==o;)i.push(a),a=Qr();if(i!==o)if((a=un())!==o){for(s=[],u=Qr();u!==o;)s.push(u),u=Qr();if(s!==o)if((u=an())!==o){for(h=[],f=Qr();f!==o;)h.push(f),f=Qr();h!==o?(46===e.charCodeAt(Fr)?(f=c,Fr++):(f=o,0===Br&&Gr(l)),f!==o?(Ur=t,t=r=A(a,u)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;else Fr=t,t=o}else Fr=t,t=o;else Fr=t,t=o}else Fr=t,t=o;else Fr=t,t=o;return t}())===o&&(t=function(){var t,r,n,i,a,s,u;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o)if(e.substr(Fr,5)===x?(n=x,Fr+=5):(n=o,0===Br&&Gr(_)),n!==o){for(i=[],a=Qr();a!==o;)i.push(a),a=Qr();if(i!==o)if((a=an())!==o){for(s=[],u=Qr();u!==o;)s.push(u),u=Qr();s!==o?(46===e.charCodeAt(Fr)?(u=c,Fr++):(u=o,0===Br&&Gr(l)),u!==o?(Ur=t,t=r=k(a)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;else Fr=t,t=o}else Fr=t,t=o;else Fr=t,t=o;return t}())===o&&(t=function(){var t,r,n,i,a,s,u,c,l,h,f,p;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o)if(C.test(e.charAt(Fr))?(n=e.charAt(Fr),Fr++):(n=o,0===Br&&Gr(P)),n!==o)if(F.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(U)),i!==o)if(R.test(e.charAt(Fr))?(a=e.charAt(Fr),Fr++):(a=o,0===Br&&Gr(I)),a!==o)if(D.test(e.charAt(Fr))?(s=e.charAt(Fr),Fr++):(s=o,0===Br&&Gr(L)),s!==o)if(M.test(e.charAt(Fr))?(u=e.charAt(Fr),Fr++):(u=o,0===Br&&Gr(B)),u!==o)if(q.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(H)),c!==o){for(l=[],h=Qr();h!==o;)l.push(h),h=Qr();if(l!==o)if((h=un())!==o){for(f=[],p=Qr();p!==o;)f.push(p),p=Qr();f!==o&&(p=an())!==o?(Ur=t,t=r=A(h,p)):(Fr=t,t=o)}else Fr=t,t=o;else Fr=t,t=o}else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;return t}())===o&&(t=function(){var t,r,n,i,a,s,u,c;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o)if(T.test(e.charAt(Fr))?(n=e.charAt(Fr),Fr++):(n=o,0===Br&&Gr(E)),n!==o)if(O.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(j)),i!==o)if(N.test(e.charAt(Fr))?(a=e.charAt(Fr),Fr++):(a=o,0===Br&&Gr(S)),a!==o)if(R.test(e.charAt(Fr))?(s=e.charAt(Fr),Fr++):(s=o,0===Br&&Gr(I)),s!==o){for(u=[],c=Qr();c!==o;)u.push(c),c=Qr();u!==o&&(c=an())!==o?(Ur=t,t=r=k(c)):(Fr=t,t=o)}else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;return t}()),t}())===o)if(t=Fr,(r=function(){var t,e,r;return t=Fr,(e=function(){var t,e;return t=Fr,(e=en())!==o&&(Ur=t,e=nt(e)),(t=e)===o&&(t=on())===o&&(t=nn()),t}())!==o&&(r=Yr())!==o?(Ur=t,t=e=$(e,r)):(Fr=t,t=o),t===o&&(t=Fr,(e=tn())!==o?((r=Yr())===o&&(r=null),r!==o?(Ur=t,t=e=z(e,r)):(Fr=t,t=o)):(Fr=t,t=o)),t}())!==o){for(n=[],i=Qr();i!==o;)n.push(i),i=Qr();n!==o?(46===e.charCodeAt(Fr)?(i=c,Fr++):(i=o,0===Br&&Gr(l)),i!==o?(Ur=t,t=r=h(r)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;return t}function Qr(){var t;return(t=function(){var t;return sr.test(e.charAt(Fr))?(t=e.charAt(Fr),Fr++):(t=o,0===Br&&Gr(ur)),t}())===o&&(t=function(){var t,r,n,i;if(t=Fr,35===e.charCodeAt(Fr)?(r=f,Fr++):(r=o,0===Br&&Gr(p)),r!==o){for(n=[],d.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(y));i!==o;)n.push(i),d.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(y));n!==o?(10===e.charCodeAt(Fr)?(i=v,Fr++):(i=o,0===Br&&Gr(g)),i!==o?(Ur=t,t=r=m(n)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;return t}()),t}function Yr(){var t,r,n,i,a,s,u,c,l,h;if(t=Fr,(r=Zr())!==o)if((n=Jr())!==o){for(i=[],a=Fr,s=[],u=Qr();u!==o;)s.push(u),u=Qr();for(s!==o?(59===e.charCodeAt(Fr)?(u=X,Fr++):(u=o,0===Br&&Gr(G)),u!==o?(c=Fr,(l=Zr())!==o&&(h=Jr())!==o?(Ur=c,c=l=V(r,n,l,h)):(Fr=c,c=o),c===o&&(c=null),c!==o?(Ur=a,a=s=W(r,n,c)):(Fr=a,a=o)):(Fr=a,a=o)):(Fr=a,a=o);a!==o;){for(i.push(a),a=Fr,s=[],u=Qr();u!==o;)s.push(u),u=Qr();s!==o?(59===e.charCodeAt(Fr)?(u=X,Fr++):(u=o,0===Br&&Gr(G)),u!==o?(c=Fr,(l=Zr())!==o&&(h=Jr())!==o?(Ur=c,c=l=V(r,n,l,h)):(Fr=c,c=o),c===o&&(c=null),c!==o?(Ur=a,a=s=W(r,n,c)):(Fr=a,a=o)):(Fr=a,a=o)):(Fr=a,a=o)}i!==o?(Ur=t,t=r=Q(r,n,i)):(Fr=t,t=o)}else Fr=t,t=o;else Fr=t,t=o;return t}function Jr(){var t,r,n,i,a,s,u;if(t=Fr,(r=Kr())!==o){for(n=[],i=Fr,a=[],s=Qr();s!==o;)a.push(s),s=Qr();for(a!==o?(44===e.charCodeAt(Fr)?(s=Y,Fr++):(s=o,0===Br&&Gr(J)),s!==o&&(u=Kr())!==o?(Ur=i,i=a=Z(r,u)):(Fr=i,i=o)):(Fr=i,i=o);i!==o;){for(n.push(i),i=Fr,a=[],s=Qr();s!==o;)a.push(s),s=Qr();a!==o?(44===e.charCodeAt(Fr)?(s=Y,Fr++):(s=o,0===Br&&Gr(J)),s!==o&&(u=Kr())!==o?(Ur=i,i=a=Z(r,u)):(Fr=i,i=o)):(Fr=i,i=o)}n!==o?(Ur=t,t=r=K(r,n)):(Fr=t,t=o)}else Fr=t,t=o;return t}function Zr(){var t,r,n;if(t=Fr,(r=function(){var t,e,r;for(t=Fr,e=[],r=Qr();r!==o;)e.push(r),r=Qr();return e!==o&&(r=nn())!==o?(Ur=t,t=e=h(r)):(Fr=t,t=o),t}())!==o&&(Ur=t,r=h(r)),(t=r)===o){for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();r!==o?(97===e.charCodeAt(Fr)?(n=tt,Fr++):(n=o,0===Br&&Gr(et)),n!==o?(Ur=t,t=r=rt()):(Fr=t,t=o)):(Fr=t,t=o)}return t}function Kr(){var t,r;return(t=function(){var t;return(t=function(){var t,r,n,i,a,s,u;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o)if((n=rn())!==o){for(i=[],a=Qr();a!==o;)i.push(a),a=Qr();i!==o&&(a=function(){var t,r,n,i,a,s,u,c;if(t=Fr,64===e.charCodeAt(Fr)?(r=$t,Fr++):(r=o,0===Br&&Gr(zt)),r!==o){if(n=[],Xt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(Gt)),i!==o)for(;i!==o;)n.push(i),Xt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(Gt));else n=o;if(n!==o){if(i=[],a=Fr,45===e.charCodeAt(Fr)?(s=Vt,Fr++):(s=o,0===Br&&Gr(Wt)),s!==o){if(u=[],Qt.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Yt)),c!==o)for(;c!==o;)u.push(c),Qt.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Yt));else u=o;u!==o?(Ur=a,a=s=Jt(n,u)):(Fr=a,a=o)}else Fr=a,a=o;for(;a!==o;)if(i.push(a),a=Fr,45===e.charCodeAt(Fr)?(s=Vt,Fr++):(s=o,0===Br&&Gr(Wt)),s!==o){if(u=[],Qt.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Yt)),c!==o)for(;c!==o;)u.push(c),Qt.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Yt));else u=o;u!==o?(Ur=a,a=s=Jt(n,u)):(Fr=a,a=o)}else Fr=a,a=o;i!==o?(Ur=t,t=r=Zt(n,i)):(Fr=t,t=o)}else Fr=t,t=o}else Fr=t,t=o;return t}())!==o?(Ur=t,t=r=vt(n,a)):(Fr=t,t=o)}else Fr=t,t=o;else Fr=t,t=o;if(t===o){for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o)if((n=rn())!==o){for(i=[],a=Qr();a!==o;)i.push(a),a=Qr();if(i!==o)if(e.substr(Fr,2)===gt?(a=gt,Fr+=2):(a=o,0===Br&&Gr(mt)),a!==o){for(s=[],u=Qr();u!==o;)s.push(u),u=Qr();s!==o&&(u=nn())!==o?(Ur=t,t=r=bt(n,u)):(Fr=t,t=o)}else Fr=t,t=o;else Fr=t,t=o}else Fr=t,t=o;else Fr=t,t=o;if(t===o){for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();r!==o&&(n=rn())!==o?(Ur=t,t=r=h(n)):(Fr=t,t=o)}}return t}())===o&&(t=function(){var t,r,n;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();return r!==o?((n=function(){var t,r,n,i,a,s,u,h,f;if(t=Fr,r=Fr,n=Fr,Kt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(te)),i===o&&(i=null),i!==o){if(a=Fr,s=[],qt.test(e.charAt(Fr))?(u=e.charAt(Fr),Fr++):(u=o,0===Br&&Gr(Ht)),u!==o)for(;u!==o;)s.push(u),qt.test(e.charAt(Fr))?(u=e.charAt(Fr),Fr++):(u=o,0===Br&&Gr(Ht));else s=o;if(s!==o)if(46===e.charCodeAt(Fr)?(u=c,Fr++):(u=o,0===Br&&Gr(l)),u!==o){for(h=[],qt.test(e.charAt(Fr))?(f=e.charAt(Fr),Fr++):(f=o,0===Br&&Gr(Ht));f!==o;)h.push(f),qt.test(e.charAt(Fr))?(f=e.charAt(Fr),Fr++):(f=o,0===Br&&Gr(Ht));h!==o&&(f=cn())!==o?a=s=[s,u,h,f]:(Fr=a,a=o)}else Fr=a,a=o;else Fr=a,a=o;if(a===o){if(a=Fr,46===e.charCodeAt(Fr)?(s=c,Fr++):(s=o,0===Br&&Gr(l)),s!==o){if(u=[],qt.test(e.charAt(Fr))?(h=e.charAt(Fr),Fr++):(h=o,0===Br&&Gr(Ht)),h!==o)for(;h!==o;)u.push(h),qt.test(e.charAt(Fr))?(h=e.charAt(Fr),Fr++):(h=o,0===Br&&Gr(Ht));else u=o;u!==o&&(h=cn())!==o?a=s=[s,u,h]:(Fr=a,a=o)}else Fr=a,a=o;if(a===o){if(a=Fr,s=[],qt.test(e.charAt(Fr))?(u=e.charAt(Fr),Fr++):(u=o,0===Br&&Gr(Ht)),u!==o)for(;u!==o;)s.push(u),qt.test(e.charAt(Fr))?(u=e.charAt(Fr),Fr++):(u=o,0===Br&&Gr(Ht));else s=o;s!==o&&(u=cn())!==o?a=s=[s,u]:(Fr=a,a=o)}}a!==o?n=i=[i,a]:(Fr=n,n=o)}else Fr=n,n=o;return(r=n!==o?e.substring(r,Fr):n)!==o&&(Ur=t,r=ne(r)),r}())===o&&(n=function(){var t,r,n,i,a,s,u,h;if(t=Fr,r=Fr,n=Fr,Kt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(te)),i===o&&(i=null),i!==o){for(a=[],qt.test(e.charAt(Fr))?(s=e.charAt(Fr),Fr++):(s=o,0===Br&&Gr(Ht));s!==o;)a.push(s),qt.test(e.charAt(Fr))?(s=e.charAt(Fr),Fr++):(s=o,0===Br&&Gr(Ht));if(a!==o)if(46===e.charCodeAt(Fr)?(s=c,Fr++):(s=o,0===Br&&Gr(l)),s!==o){if(u=[],qt.test(e.charAt(Fr))?(h=e.charAt(Fr),Fr++):(h=o,0===Br&&Gr(Ht)),h!==o)for(;h!==o;)u.push(h),qt.test(e.charAt(Fr))?(h=e.charAt(Fr),Fr++):(h=o,0===Br&&Gr(Ht));else u=o;u!==o?n=i=[i,a,s,u]:(Fr=n,n=o)}else Fr=n,n=o;else Fr=n,n=o}else Fr=n,n=o;return(r=n!==o?e.substring(r,Fr):n)!==o&&(Ur=t,r=re(r)),r}())===o&&(n=function(){var t,r,n,i,a,s;if(t=Fr,r=Fr,n=Fr,Kt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(te)),i===o&&(i=null),i!==o){if(a=[],qt.test(e.charAt(Fr))?(s=e.charAt(Fr),Fr++):(s=o,0===Br&&Gr(Ht)),s!==o)for(;s!==o;)a.push(s),qt.test(e.charAt(Fr))?(s=e.charAt(Fr),Fr++):(s=o,0===Br&&Gr(Ht));else a=o;a!==o?n=i=[i,a]:(Fr=n,n=o)}else Fr=n,n=o;return(r=n!==o?e.substring(r,Fr):n)!==o&&(Ur=t,r=ee(r)),r}()),n!==o?(Ur=t,t=r=h(n)):(Fr=t,t=o)):(Fr=t,t=o),t}())===o&&(t=function(){var t,r,n;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o?(e.substr(Fr,4)===wt?(n=wt,Fr+=4):(n=o,0===Br&&Gr(At)),n!==o?(Ur=t,t=r=xt()):(Fr=t,t=o)):(Fr=t,t=o),t===o){for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();r!==o?(e.substr(Fr,5)===_t?(n=_t,Fr+=5):(n=o,0===Br&&Gr(kt)),n!==o?(Ur=t,t=r=Tt()):(Fr=t,t=o)):(Fr=t,t=o)}return t}()),t}())===o&&(t=Fr,(r=en())!==o&&(Ur=t,r=it(r)),(t=r)===o&&(t=Fr,(r=on())!==o&&(Ur=t,r=ot(r)),(t=r)===o&&(t=Fr,(r=tn())!==o&&(Ur=t,r=h(r)),(t=r)===o&&(t=Fr,(r=nn())!==o&&(Ur=t,r=at(r)),t=r)))),t}function tn(){var t,r,n,i,a,s;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o)if(91===e.charCodeAt(Fr)?(n=st,Fr++):(n=o,0===Br&&Gr(ut)),n!==o)if((i=Yr())!==o){for(a=[],s=Qr();s!==o;)a.push(s),s=Qr();a!==o?(93===e.charCodeAt(Fr)?(s=ct,Fr++):(s=o,0===Br&&Gr(lt)),s!==o?(Ur=t,t=r=h(i)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;return t}function en(){var t,r,n,i,a,s;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o)if(40===e.charCodeAt(Fr)?(n=ht,Fr++):(n=o,0===Br&&Gr(ft)),n!==o){for(i=[],a=Kr();a!==o;)i.push(a),a=Kr();if(i!==o){for(a=[],s=Qr();s!==o;)a.push(s),s=Qr();a!==o?(41===e.charCodeAt(Fr)?(s=pt,Fr++):(s=o,0===Br&&Gr(dt)),s!==o?(Ur=t,t=r=yt(i)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o}else Fr=t,t=o;else Fr=t,t=o;return t}function rn(){var t,r,n;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();return r!==o?((n=function(){var t,r,n,i,a,s,u,c;if(t=Fr,e.substr(Fr,3)===de?(r=de,Fr+=3):(r=o,0===Br&&Gr(ye)),r!==o){for(n=[],ve.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(ge)),i===o&&(i=hn())===o&&(i=ln());i!==o;)n.push(i),ve.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(ge)),i===o&&(i=hn())===o&&(i=ln());if(n!==o){if(i=[],a=Fr,e.substr(Fr,2)===me?(s=me,Fr+=2):(s=o,0===Br&&Gr(be)),s!==o){if(u=[],ve.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(ge)),c===o&&(c=hn())===o&&(c=ln()),c!==o)for(;c!==o;)u.push(c),ve.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(ge)),c===o&&(c=hn())===o&&(c=ln());else u=o;u!==o?(Ur=a,a=s=we(n,u)):(Fr=a,a=o)}else Fr=a,a=o;if(a===o)if(a=Fr,39===e.charCodeAt(Fr)?(s=le,Fr++):(s=o,0===Br&&Gr(he)),s!==o){if(u=[],ve.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(ge)),c===o&&(c=hn())===o&&(c=ln()),c!==o)for(;c!==o;)u.push(c),ve.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(ge)),c===o&&(c=hn())===o&&(c=ln());else u=o;u!==o?(Ur=a,a=s=Ae(n,u)):(Fr=a,a=o)}else Fr=a,a=o;for(;a!==o;){if(i.push(a),a=Fr,e.substr(Fr,2)===me?(s=me,Fr+=2):(s=o,0===Br&&Gr(be)),s!==o){if(u=[],ve.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(ge)),c===o&&(c=hn())===o&&(c=ln()),c!==o)for(;c!==o;)u.push(c),ve.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(ge)),c===o&&(c=hn())===o&&(c=ln());else u=o;u!==o?(Ur=a,a=s=we(n,u)):(Fr=a,a=o)}else Fr=a,a=o;if(a===o)if(a=Fr,39===e.charCodeAt(Fr)?(s=le,Fr++):(s=o,0===Br&&Gr(he)),s!==o){if(u=[],ve.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(ge)),c===o&&(c=hn())===o&&(c=ln()),c!==o)for(;c!==o;)u.push(c),ve.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(ge)),c===o&&(c=hn())===o&&(c=ln());else u=o;u!==o?(Ur=a,a=s=Ae(n,u)):(Fr=a,a=o)}else Fr=a,a=o}i!==o?(e.substr(Fr,3)===de?(a=de,Fr+=3):(a=o,0===Br&&Gr(ye)),a!==o?(Ur=t,t=r=xe(n,i)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o}else Fr=t,t=o;return t}())===o&&(n=function(){var t,r,n,i,a,s,u,c;if(t=Fr,e.substr(Fr,3)===_e?(r=_e,Fr+=3):(r=o,0===Br&&Gr(ke)),r!==o){for(n=[],Te.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(Ee)),i===o&&(i=hn())===o&&(i=ln());i!==o;)n.push(i),Te.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(Ee)),i===o&&(i=hn())===o&&(i=ln());if(n!==o){if(i=[],a=Fr,e.substr(Fr,2)===Oe?(s=Oe,Fr+=2):(s=o,0===Br&&Gr(je)),s!==o){if(u=[],Te.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Ee)),c===o&&(c=hn())===o&&(c=ln()),c!==o)for(;c!==o;)u.push(c),Te.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Ee)),c===o&&(c=hn())===o&&(c=ln());else u=o;u!==o?(Ur=a,a=s=Ne(n,u)):(Fr=a,a=o)}else Fr=a,a=o;if(a===o)if(a=Fr,34===e.charCodeAt(Fr)?(s=ae,Fr++):(s=o,0===Br&&Gr(se)),s!==o){if(u=[],Te.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Ee)),c===o&&(c=hn())===o&&(c=ln()),c!==o)for(;c!==o;)u.push(c),Te.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Ee)),c===o&&(c=hn())===o&&(c=ln());else u=o;u!==o?(Ur=a,a=s=Se(n,u)):(Fr=a,a=o)}else Fr=a,a=o;for(;a!==o;){if(i.push(a),a=Fr,e.substr(Fr,2)===Oe?(s=Oe,Fr+=2):(s=o,0===Br&&Gr(je)),s!==o){if(u=[],Te.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Ee)),c===o&&(c=hn())===o&&(c=ln()),c!==o)for(;c!==o;)u.push(c),Te.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Ee)),c===o&&(c=hn())===o&&(c=ln());else u=o;u!==o?(Ur=a,a=s=Ne(n,u)):(Fr=a,a=o)}else Fr=a,a=o;if(a===o)if(a=Fr,34===e.charCodeAt(Fr)?(s=ae,Fr++):(s=o,0===Br&&Gr(se)),s!==o){if(u=[],Te.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Ee)),c===o&&(c=hn())===o&&(c=ln()),c!==o)for(;c!==o;)u.push(c),Te.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Ee)),c===o&&(c=hn())===o&&(c=ln());else u=o;u!==o?(Ur=a,a=s=Se(n,u)):(Fr=a,a=o)}else Fr=a,a=o}i!==o?(e.substr(Fr,3)===_e?(a=_e,Fr+=3):(a=o,0===Br&&Gr(ke)),a!==o?(Ur=t,t=r=xe(n,i)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o}else Fr=t,t=o;return t}())===o&&(n=function(){var t,r,n,i;if(t=Fr,39===e.charCodeAt(Fr)?(r=le,Fr++):(r=o,0===Br&&Gr(he)),r!==o){for(n=[],fe.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(pe)),i===o&&(i=hn())===o&&(i=ln());i!==o;)n.push(i),fe.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(pe)),i===o&&(i=hn())===o&&(i=ln());n!==o?(39===e.charCodeAt(Fr)?(i=le,Fr++):(i=o,0===Br&&Gr(he)),i!==o?(Ur=t,t=r=m(n)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;return t}())===o&&(n=function(){var t,r,n,i;if(t=Fr,34===e.charCodeAt(Fr)?(r=ae,Fr++):(r=o,0===Br&&Gr(se)),r!==o){for(n=[],ue.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(ce)),i===o&&(i=hn())===o&&(i=ln());i!==o;)n.push(i),ue.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(ce)),i===o&&(i=hn())===o&&(i=ln());n!==o?(34===e.charCodeAt(Fr)?(i=ae,Fr++):(i=o,0===Br&&Gr(se)),i!==o?(Ur=t,t=r=m(n)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;return t}()),n!==o?(Ur=t,t=r=h(n)):(Fr=t,t=o)):(Fr=t,t=o),t}function nn(){var t,r,n;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o&&(n=an())!==o?(Ur=t,t=r=h(n)):(Fr=t,t=o),t===o){for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();r!==o&&(n=function(){var t,r;return(t=function(){var t,r,n;return t=Fr,(r=sn())!==o&&(n=function(){var t,r,n,i,a,s,u,h;if(t=Fr,(r=pn())===o&&(58===e.charCodeAt(Fr)?(r=Pt,Fr++):(r=o,0===Br&&Gr(Ft)),r===o&&(qt.test(e.charAt(Fr))?(r=e.charAt(Fr),Fr++):(r=o,0===Br&&Gr(Ht)),r===o&&(r=vn()))),r!==o){for(n=[],(i=dn())===o&&(58===e.charCodeAt(Fr)?(i=Pt,Fr++):(i=o,0===Br&&Gr(Ft)),i===o&&(i=vn()));i!==o;)n.push(i),(i=dn())===o&&(58===e.charCodeAt(Fr)?(i=Pt,Fr++):(i=o,0===Br&&Gr(Ft)),i===o&&(i=vn()));if(n!==o){if(i=[],a=Fr,s=[],46===e.charCodeAt(Fr)?(u=c,Fr++):(u=o,0===Br&&Gr(l)),u!==o)for(;u!==o;)s.push(u),46===e.charCodeAt(Fr)?(u=c,Fr++):(u=o,0===Br&&Gr(l));else s=o;if(s!==o){if(u=[],(h=dn())===o&&(58===e.charCodeAt(Fr)?(h=Pt,Fr++):(h=o,0===Br&&Gr(Ft)),h===o&&(h=vn())),h!==o)for(;h!==o;)u.push(h),(h=dn())===o&&(58===e.charCodeAt(Fr)?(h=Pt,Fr++):(h=o,0===Br&&Gr(Ft)),h===o&&(h=vn()));else u=o;u!==o?(Ur=a,a=s=Tr(r,n,s,u)):(Fr=a,a=o)}else Fr=a,a=o;for(;a!==o;){if(i.push(a),a=Fr,s=[],46===e.charCodeAt(Fr)?(u=c,Fr++):(u=o,0===Br&&Gr(l)),u!==o)for(;u!==o;)s.push(u),46===e.charCodeAt(Fr)?(u=c,Fr++):(u=o,0===Br&&Gr(l));else s=o;if(s!==o){if(u=[],(h=dn())===o&&(58===e.charCodeAt(Fr)?(h=Pt,Fr++):(h=o,0===Br&&Gr(Ft)),h===o&&(h=vn())),h!==o)for(;h!==o;)u.push(h),(h=dn())===o&&(58===e.charCodeAt(Fr)?(h=Pt,Fr++):(h=o,0===Br&&Gr(Ft)),h===o&&(h=vn()));else u=o;u!==o?(Ur=a,a=s=Tr(r,n,s,u)):(Fr=a,a=o)}else Fr=a,a=o}i!==o?(Ur=t,t=r=Er(r,n,i)):(Fr=t,t=o)}else Fr=t,t=o}else Fr=t,t=o;return t}())!==o?(Ur=t,t=r=Lt(r,n)):(Fr=t,t=o),t}())===o&&(t=Fr,(r=sn())!==o&&(Ur=t,r=Et(r)),t=r),t}())!==o?(Ur=t,t=r=h(n)):(Fr=t,t=o)}return t}function on(){var t,r,n;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o&&(n=function(){var t,r,n,i,a,s,u,h,f,p;if(t=Fr,r=Fr,e.substr(Fr,2)===Mt?(n=Mt,Fr+=2):(n=o,0===Br&&Gr(Bt)),n!==o)if((i=pn())===o&&(qt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(Ht))),i!==o){for(a=[],s=dn();s!==o;)a.push(s),s=dn();if(a!==o){if(s=[],u=Fr,h=[],46===e.charCodeAt(Fr)?(f=c,Fr++):(f=o,0===Br&&Gr(l)),f!==o)for(;f!==o;)h.push(f),46===e.charCodeAt(Fr)?(f=c,Fr++):(f=o,0===Br&&Gr(l));else h=o;if(h!==o){if(f=[],(p=dn())!==o)for(;p!==o;)f.push(p),p=dn();else f=o;f!==o?u=h=[h,f]:(Fr=u,u=o)}else Fr=u,u=o;for(;u!==o;){if(s.push(u),u=Fr,h=[],46===e.charCodeAt(Fr)?(f=c,Fr++):(f=o,0===Br&&Gr(l)),f!==o)for(;f!==o;)h.push(f),46===e.charCodeAt(Fr)?(f=c,Fr++):(f=o,0===Br&&Gr(l));else h=o;if(h!==o){if(f=[],(p=dn())!==o)for(;p!==o;)f.push(p),p=dn();else f=o;f!==o?u=h=[h,f]:(Fr=u,u=o)}else Fr=u,u=o}s!==o?r=n=[n,i,a,s]:(Fr=r,r=o)}else Fr=r,r=o}else Fr=r,r=o;else Fr=r,r=o;return r!==o?e.substring(t,Fr):r}())!==o?(Ur=t,t=r=h(n)):(Fr=t,t=o),t===o){for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();r!==o&&(n=function(){var t,r,n,i;if(t=Fr,91===e.charCodeAt(Fr)?(r=st,Fr++):(r=o,0===Br&&Gr(ut)),r!==o){for(n=[],i=Qr();i!==o;)n.push(i),i=Qr();n!==o?(93===e.charCodeAt(Fr)?(i=ct,Fr++):(i=o,0===Br&&Gr(lt)),i!==o?(Ur=t,t=r=cr()):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;return t}())!==o?(Ur=t,t=r=h(n)):(Fr=t,t=o)}return t}function an(){var t,r,n,i;if(t=Fr,60===e.charCodeAt(Fr)?(r=Ot,Fr++):(r=o,0===Br&&Gr(jt)),r!==o){for(n=[],Nt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(St)),i===o&&(i=ln());i!==o;)n.push(i),Nt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(St)),i===o&&(i=ln());n!==o?(62===e.charCodeAt(Fr)?(i=Rt,Fr++):(i=o,0===Br&&Gr(It)),i!==o?(Ur=t,t=r=Ct(n)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;return t}function sn(){var t,r,n;return t=Fr,(r=yn())===o&&(r=null),r!==o?(58===e.charCodeAt(Fr)?(n=Pt,Fr++):(n=o,0===Br&&Gr(Ft)),n!==o?(Ur=t,t=r=Ut(r)):(Fr=t,t=o)):(Fr=t,t=o),t}function un(){var t,r,n;return t=Fr,(r=yn())===o&&(r=null),r!==o?(58===e.charCodeAt(Fr)?(n=Pt,Fr++):(n=o,0===Br&&Gr(Ft)),n!==o?(Ur=t,t=r=Dt(r)):(Fr=t,t=o)):(Fr=t,t=o),t}function cn(){var t,r,n,i,a,s;if(t=Fr,r=Fr,ie.test(e.charAt(Fr))?(n=e.charAt(Fr),Fr++):(n=o,0===Br&&Gr(oe)),n!==o)if(Kt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(te)),i===o&&(i=null),i!==o){if(a=[],qt.test(e.charAt(Fr))?(s=e.charAt(Fr),Fr++):(s=o,0===Br&&Gr(Ht)),s!==o)for(;s!==o;)a.push(s),qt.test(e.charAt(Fr))?(s=e.charAt(Fr),Fr++):(s=o,0===Br&&Gr(Ht));else a=o;a!==o?r=n=[n,i,a]:(Fr=r,r=o)}else Fr=r,r=o;else Fr=r,r=o;return r!==o?e.substring(t,Fr):r}function ln(){var t,r,n,i,a,s,u,c,l,h,f;return t=Fr,e.substr(Fr,2)===Re?(r=Re,Fr+=2):(r=o,0===Br&&Gr(Ie)),r!==o?(n=Fr,(i=gn())!==o&&(a=gn())!==o&&(s=gn())!==o&&(u=gn())!==o&&(c=gn())!==o&&(l=gn())!==o&&(h=gn())!==o&&(f=gn())!==o?n=i=[i,a,s,u,c,l,h,f]:(Fr=n,n=o),n!==o?(Ur=t,t=r=Ce(n)):(Fr=t,t=o)):(Fr=t,t=o),t===o&&(t=Fr,e.substr(Fr,2)===Pe?(r=Pe,Fr+=2):(r=o,0===Br&&Gr(Fe)),r!==o?(n=Fr,(i=gn())!==o&&(a=gn())!==o&&(s=gn())!==o&&(u=gn())!==o?n=i=[i,a,s,u]:(Fr=n,n=o),n!==o?(Ur=t,t=r=Ue(n)):(Fr=t,t=o)):(Fr=t,t=o)),t}function hn(){var t,r;return t=Fr,e.substr(Fr,2)===De?(r=De,Fr+=2):(r=o,0===Br&&Gr(Le)),r!==o&&(Ur=t,r=Me()),(t=r)===o&&(t=Fr,e.substr(Fr,2)===Be?(r=Be,Fr+=2):(r=o,0===Br&&Gr(qe)),r!==o&&(Ur=t,r=He()),(t=r)===o&&(t=Fr,e.substr(Fr,2)===$e?(r=$e,Fr+=2):(r=o,0===Br&&Gr(ze)),r!==o&&(Ur=t,r=Xe()),(t=r)===o&&(t=Fr,e.substr(Fr,2)===Ge?(r=Ge,Fr+=2):(r=o,0===Br&&Gr(Ve)),r!==o&&(Ur=t,r=We()),(t=r)===o&&(t=Fr,e.substr(Fr,2)===Qe?(r=Qe,Fr+=2):(r=o,0===Br&&Gr(Ye)),r!==o&&(Ur=t,r=Je()),(t=r)===o&&(t=Fr,e.substr(Fr,2)===Ze?(r=Ze,Fr+=2):(r=o,0===Br&&Gr(Ke)),r!==o&&(Ur=t,r=tr()),(t=r)===o&&(t=Fr,e.substr(Fr,2)===er?(r=er,Fr+=2):(r=o,0===Br&&Gr(rr)),r!==o&&(Ur=t,r=nr()),(t=r)===o&&(t=Fr,e.substr(Fr,2)===ir?(r=ir,Fr+=2):(r=o,0===Br&&Gr(or)),r!==o&&(Ur=t,r=ar()),t=r))))))),t}function fn(){var t,r,n;return t=Fr,lr.test(e.charAt(Fr))?(r=e.charAt(Fr),Fr++):(r=o,0===Br&&Gr(hr)),r!==o?(fr.test(e.charAt(Fr))?(n=e.charAt(Fr),Fr++):(n=o,0===Br&&Gr(pr)),n!==o?(Ur=t,t=r=dr(r,n)):(Fr=t,t=o)):(Fr=t,t=o),t===o&&(yr.test(e.charAt(Fr))?(t=e.charAt(Fr),Fr++):(t=o,0===Br&&Gr(vr))),t}function pn(){var t;return(t=fn())===o&&(95===e.charCodeAt(Fr)?(t=gr,Fr++):(t=o,0===Br&&Gr(mr))),t}function dn(){var t;return(t=pn())===o&&(45===e.charCodeAt(Fr)?(t=Vt,Fr++):(t=o,0===Br&&Gr(Wt)),t===o&&(qt.test(e.charAt(Fr))?(t=e.charAt(Fr),Fr++):(t=o,0===Br&&Gr(Ht)),t===o&&(183===e.charCodeAt(Fr)?(t=br,Fr++):(t=o,0===Br&&Gr(wr)),t===o&&(Ar.test(e.charAt(Fr))?(t=e.charAt(Fr),Fr++):(t=o,0===Br&&Gr(xr)),t===o&&(_r.test(e.charAt(Fr))?(t=e.charAt(Fr),Fr++):(t=o,0===Br&&Gr(kr))))))),t}function yn(){var t,r,n,i,a,s,u,h,f;if(t=Fr,r=Fr,(n=fn())!==o){for(i=[],a=dn();a!==o;)i.push(a),a=dn();if(i!==o){if(a=[],s=Fr,u=[],46===e.charCodeAt(Fr)?(h=c,Fr++):(h=o,0===Br&&Gr(l)),h!==o)for(;h!==o;)u.push(h),46===e.charCodeAt(Fr)?(h=c,Fr++):(h=o,0===Br&&Gr(l));else u=o;if(u!==o){if(h=[],(f=dn())!==o)for(;f!==o;)h.push(f),f=dn();else h=o;h!==o?s=u=[u,h]:(Fr=s,s=o)}else Fr=s,s=o;for(;s!==o;){if(a.push(s),s=Fr,u=[],46===e.charCodeAt(Fr)?(h=c,Fr++):(h=o,0===Br&&Gr(l)),h!==o)for(;h!==o;)u.push(h),46===e.charCodeAt(Fr)?(h=c,Fr++):(h=o,0===Br&&Gr(l));else u=o;if(u!==o){if(h=[],(f=dn())!==o)for(;f!==o;)h.push(f),f=dn();else h=o;h!==o?s=u=[u,h]:(Fr=s,s=o)}else Fr=s,s=o}a!==o?r=n=[n,i,a]:(Fr=r,r=o)}else Fr=r,r=o}else Fr=r,r=o;return r!==o?e.substring(t,Fr):r}function vn(){var t;return(t=function(){var t,r,n,i,a;return t=Fr,r=Fr,37===e.charCodeAt(Fr)?(n=Or,Fr++):(n=o,0===Br&&Gr(jr)),n!==o&&(i=gn())!==o&&(a=gn())!==o?r=n=[n,i,a]:(Fr=r,r=o),r!==o?e.substring(t,Fr):r}())===o&&(t=function(){var t,r,n;return t=Fr,92===e.charCodeAt(Fr)?(r=Rr,Fr++):(r=o,0===Br&&Gr(Ir)),r!==o?(Cr.test(e.charAt(Fr))?(n=e.charAt(Fr),Fr++):(n=o,0===Br&&Gr(Pr)),n!==o?(Ur=t,t=r=h(n)):(Fr=t,t=o)):(Fr=t,t=o),t}()),t}function gn(){var t;return Nr.test(e.charAt(Fr))?(t=e.charAt(Fr),Fr++):(t=o,0===Br&&Gr(Sr)),t}var mn,bn,wn,An=new Function("try {return this===window;}catch(e){ return false;}")()?window.URL:r(9533).URL,xn=function(t){return t.match(/^[a-z](.*?):(.+?)/g)},_n={base:[],data:{},addBase:function(t){if(0===_n.base.length)return void _n.base.push(t);const e=_n.base[_n.base.length-1];e!==t&&_n.base.push(new An(t,e).toString())},addPrefix:function(t,e){const r=_n.data[t];void 0===r?_n.data[t]=[{uri:e,count:0}]:r[r.length-1].uri!==e&&r.push({uri:e,count:0})},hasPrefix:function(t){return void 0!==this.data[t]},resolve:function(t,e){const r=Object.keys(_n.data).find((e=>0===t.indexOf(e+":")));if(void 0!==r){const n=_n.data[r];if(1===n.length&&!0!==e&&xn(n[0].uri))return t;const i=n[n.length-1].uri;return t.replace(r+":",i)}var i=0===_n.base.length?n.baseIRI:_n.base[_n.base.length-1];return!i||t.match(/^(http:|https:|urn:|file:)/)?t:0===t.indexOf("//")&&i?i.split("//")[0]+t:new An(t,i).toString()},increment:function(t){const e=_n.data[t];void 0!==e&&e[e.length-1].count++},decrement:function(t){const e=_n.data[t];void 0!==e&&e[e.length-1].count--},toJSON:function(){const t={};return _n.base.length>0&&(void 0===t["@context"]&&(t["@context"]={}),t["@context"]["@base"]=_n.base[0]),Object.keys(_n.data).forEach((e=>{const r=_n.data[e][0];"http://www.w3.org/2001/XMLSchema#"===r.uri&&r.count<1||xn(r.uri)&&(void 0===t["@context"]&&(t["@context"]={}),t["@context"][e]=r.uri)})),t}};function kn(t,e){if(void 0===t["@list"])return t;if(!e&&!t["@list"].find((t=>void 0!==t["@list"])))return t;if(0===t["@list"].length)return{"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"};var r={},n=null;return t["@list"].forEach((t=>{null===n?n=r:(n["http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"]={},n=n["http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"]),n["http://www.w3.org/1999/02/22-rdf-syntax-ns#first"]=kn(t,!0),n["http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"]={"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"}})),r}if((i=s())!==o&&Fr===e.length)return i;throw i!==o&&Fr{"use strict";var n=r(9964),i=r(6357);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}var a,s,u=r(5403).codes,c=u.ERR_AMBIGUOUS_ARGUMENT,l=u.ERR_INVALID_ARG_TYPE,h=u.ERR_INVALID_ARG_VALUE,f=u.ERR_INVALID_RETURN_VALUE,p=u.ERR_MISSING_ARGS,d=r(5416),y=r(7187).inspect,v=r(7187).types,g=v.isPromise,m=v.isRegExp,b=Object.assign?Object.assign:r(6713).assign,w=Object.is?Object.is:r(8527);function A(){var t=r(6781);a=t.isDeepEqual,s=t.isDeepStrictEqual}new Map;var x=!1,_=t.exports=O,k={};function T(t){if(t.message instanceof Error)throw t.message;throw new d(t)}function E(t,e,r,n){if(!r){var i=!1;if(0===e)i=!0,n="No value argument passed to `assert.ok()`";else if(n instanceof Error)throw n;var o=new d({actual:r,expected:!0,message:n,operator:"==",stackStartFn:t});throw o.generatedMessage=i,o}}function O(){for(var t=arguments.length,e=new Array(t),r=0;r1?r-1:0),i=1;i1?r-1:0),i=1;i1?r-1:0),i=1;i1?r-1:0),i=1;i{"use strict";var n=r(9964);function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;rt.length)&&(r=t.length),t.substring(r-e.length,r)===e}var v="",g="",m="",b="",w={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"};function A(t){var e=Object.keys(t),r=Object.create(Object.getPrototypeOf(t));return e.forEach((function(e){r[e]=t[e]})),Object.defineProperty(r,"message",{value:t.message}),r}function x(t){return p(t,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}var _=function(t){function e(t){var r;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),"object"!==f(t)||null===t)throw new d("options","Object",t);var i=t.message,o=t.operator,u=t.stackStartFn,c=t.actual,l=t.expected,p=Error.stackTraceLimit;if(Error.stackTraceLimit=0,null!=i)r=a(this,h(e).call(this,String(i)));else if(n.stderr&&n.stderr.isTTY&&(n.stderr&&n.stderr.getColorDepth&&1!==n.stderr.getColorDepth()?(v="",g="",b="",m=""):(v="",g="",b="",m="")),"object"===f(c)&&null!==c&&"object"===f(l)&&null!==l&&"stack"in c&&c instanceof Error&&"stack"in l&&l instanceof Error&&(c=A(c),l=A(l)),"deepStrictEqual"===o||"strictEqual"===o)r=a(this,h(e).call(this,function(t,e,r){var i="",o="",a=0,s="",u=!1,c=x(t),l=c.split("\n"),h=x(e).split("\n"),p=0,d="";if("strictEqual"===r&&"object"===f(t)&&"object"===f(e)&&null!==t&&null!==e&&(r="strictEqualObject"),1===l.length&&1===h.length&&l[0]!==h[0]){var A=l[0].length+h[0].length;if(A<=10){if(!("object"===f(t)&&null!==t||"object"===f(e)&&null!==e||0===t&&0===e))return"".concat(w[r],"\n\n")+"".concat(l[0]," !== ").concat(h[0],"\n")}else if("strictEqualObject"!==r&&A<(n.stderr&&n.stderr.isTTY?n.stderr.columns:80)){for(;l[0][p]===h[0][p];)p++;p>2&&(d="\n ".concat(function(t,e){if(e=Math.floor(e),0==t.length||0==e)return"";var r=t.length*e;for(e=Math.floor(Math.log(e)/Math.log(2));e;)t+=t,e--;return t+t.substring(0,r-t.length)}(" ",p),"^"),p=0)}}for(var _=l[l.length-1],k=h[h.length-1];_===k&&(p++<2?s="\n ".concat(_).concat(s):i=_,l.pop(),h.pop(),0!==l.length&&0!==h.length);)_=l[l.length-1],k=h[h.length-1];var T=Math.max(l.length,h.length);if(0===T){var E=c.split("\n");if(E.length>30)for(E[26]="".concat(v,"...").concat(b);E.length>27;)E.pop();return"".concat(w.notIdentical,"\n\n").concat(E.join("\n"),"\n")}p>3&&(s="\n".concat(v,"...").concat(b).concat(s),u=!0),""!==i&&(s="\n ".concat(i).concat(s),i="");var O=0,j=w[r]+"\n".concat(g,"+ actual").concat(b," ").concat(m,"- expected").concat(b),N=" ".concat(v,"...").concat(b," Lines skipped");for(p=0;p1&&p>2&&(S>4?(o+="\n".concat(v,"...").concat(b),u=!0):S>3&&(o+="\n ".concat(h[p-2]),O++),o+="\n ".concat(h[p-1]),O++),a=p,i+="\n".concat(m,"-").concat(b," ").concat(h[p]),O++;else if(h.length1&&p>2&&(S>4?(o+="\n".concat(v,"...").concat(b),u=!0):S>3&&(o+="\n ".concat(l[p-2]),O++),o+="\n ".concat(l[p-1]),O++),a=p,o+="\n".concat(g,"+").concat(b," ").concat(l[p]),O++;else{var R=h[p],I=l[p],C=I!==R&&(!y(I,",")||I.slice(0,-1)!==R);C&&y(R,",")&&R.slice(0,-1)===I&&(C=!1,I+=","),C?(S>1&&p>2&&(S>4?(o+="\n".concat(v,"...").concat(b),u=!0):S>3&&(o+="\n ".concat(l[p-2]),O++),o+="\n ".concat(l[p-1]),O++),a=p,o+="\n".concat(g,"+").concat(b," ").concat(I),i+="\n".concat(m,"-").concat(b," ").concat(R),O+=2):(o+=i,i="",1!==S&&0!==p||(o+="\n ".concat(I),O++))}if(O>20&&p30)for(k[26]="".concat(v,"...").concat(b);k.length>27;)k.pop();r=1===k.length?a(this,h(e).call(this,"".concat(_," ").concat(k[0]))):a(this,h(e).call(this,"".concat(_,"\n\n").concat(k.join("\n"),"\n")))}else{var T=x(c),E="",O=w[o];"notDeepEqual"===o||"notEqual"===o?(T="".concat(w[o],"\n\n").concat(T)).length>1024&&(T="".concat(T.slice(0,1021),"...")):(E="".concat(x(l)),T.length>512&&(T="".concat(T.slice(0,509),"...")),E.length>512&&(E="".concat(E.slice(0,509),"...")),"deepEqual"===o||"equal"===o?T="".concat(O,"\n\n").concat(T,"\n\nshould equal\n\n"):E=" ".concat(o," ").concat(E)),r=a(this,h(e).call(this,"".concat(T).concat(E)))}return Error.stackTraceLimit=p,r.generatedMessage=!i,Object.defineProperty(s(r),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),r.code="ERR_ASSERTION",r.actual=c,r.expected=l,r.operator=o,Error.captureStackTrace&&Error.captureStackTrace(s(r),u),r.stack,r.name="AssertionError",a(r)}var r,u;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}(e,t),r=e,u=[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:p.custom,value:function(t,e){return p(this,function(t){for(var e=1;e{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},i(t)}function o(t,e){return o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},o(t,e)}var a,s,u={};function c(t,e,r){r||(r=Error);var a=function(r){function a(r,o,s){var u;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),u=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}(this,i(a).call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,o,s))),u.code=t,u}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}(a,r),a}(r);u[t]=a}function l(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}c("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),c("ERR_INVALID_ARG_TYPE",(function(t,e,i){var o,s,u,c,h;if(void 0===a&&(a=r(182)),a("string"==typeof t,"'name' must be a string"),"string"==typeof e&&(s="not ",e.substr(0,4)===s)?(o="must not be",e=e.replace(/^not /,"")):o="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-9,r)===e}(t," argument"))u="The ".concat(t," ").concat(o," ").concat(l(e,"type"));else{var f=("number"!=typeof h&&(h=0),h+1>(c=t).length||-1===c.indexOf(".",h)?"argument":"property");u='The "'.concat(t,'" ').concat(f," ").concat(o," ").concat(l(e,"type"))}return u+". Received type ".concat(n(i))}),TypeError),c("ERR_INVALID_ARG_VALUE",(function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid";void 0===s&&(s=r(7187));var i=s.inspect(e);return i.length>128&&(i="".concat(i.slice(0,128),"...")),"The argument '".concat(t,"' ").concat(n,". Received ").concat(i)}),TypeError,RangeError),c("ERR_INVALID_RETURN_VALUE",(function(t,e,r){var i;return i=r&&r.constructor&&r.constructor.name?"instance of ".concat(r.constructor.name):"type ".concat(n(r)),"Expected ".concat(t,' to be returned from the "').concat(e,'"')+" function but got ".concat(i,".")}),TypeError),c("ERR_MISSING_ARGS",(function(){for(var t=arguments.length,e=new Array(t),n=0;n0,"At least one arg needs to be specified");var i="The ",o=e.length;switch(e=e.map((function(t){return'"'.concat(t,'"')})),o){case 1:i+="".concat(e[0]," argument");break;case 2:i+="".concat(e[0]," and ").concat(e[1]," arguments");break;default:i+=e.slice(0,o-1).join(", "),i+=", and ".concat(e[o-1]," arguments")}return"".concat(i," must be specified")}),TypeError),t.exports.codes=u},6781:(t,e,r)=>{"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}var o=void 0!==/a/g.flags,a=function(t){var e=[];return t.forEach((function(t){return e.push(t)})),e},s=function(t){var e=[];return t.forEach((function(t,r){return e.push([r,t])})),e},u=Object.is?Object.is:r(8527),c=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},l=Number.isNaN?Number.isNaN:r(7051);function h(t){return t.call.bind(t)}var f=h(Object.prototype.hasOwnProperty),p=h(Object.prototype.propertyIsEnumerable),d=h(Object.prototype.toString),y=r(7187).types,v=y.isAnyArrayBuffer,g=y.isArrayBufferView,m=y.isDate,b=y.isMap,w=y.isRegExp,A=y.isSet,x=y.isNativeError,_=y.isBoxedPrimitive,k=y.isNumberObject,T=y.isStringObject,E=y.isBooleanObject,O=y.isBigIntObject,j=y.isSymbolObject,N=y.isFloat32Array,S=y.isFloat64Array;function R(t){if(0===t.length||t.length>10)return!0;for(var e=0;e57)return!0}return 10===t.length&&t>=Math.pow(2,32)}function I(t){return Object.keys(t).filter(R).concat(c(t).filter(Object.prototype.propertyIsEnumerable.bind(t)))}function C(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i{"use strict";e.byteLength=function(t){var e=s(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,o=s(t),a=o[0],u=o[1],c=new i(function(t,e,r){return 3*(e+r)/4-r}(0,a,u)),l=0,h=u>0?a-4:a;for(r=0;r>16&255,c[l++]=e>>8&255,c[l++]=255&e;return 2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,c[l++]=255&e),1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,c[l++]=e>>8&255,c[l++]=255&e),c},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],a=16383,s=0,c=n-i;sc?c:s+a));return 1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=o[a],n[o.charCodeAt(a)]=a;function s(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function u(t,e,n){for(var i,o,a=[],s=e;s>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},2313:(t,e,r)=>{"use strict";var n=r(6357);const i=r(2504),o=r(9029),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=c,e.IS=50;const s=2147483647;function u(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,c.prototype),e}function c(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return f(t)}return l(t,e,r)}function l(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!c.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|v(t,e);let n=u(r);const i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return p(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return c.from(n,e,r);const i=function(t){if(c.isBuffer(t)){const e=0|y(t.length),r=u(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||J(t.length)?u(0):p(t):"Buffer"===t.type&&Array.isArray(t.data)?p(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return c.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function f(t){return h(t),u(t<0?0:0|y(t))}function p(t){const e=t.length<0?0:0|y(t.length),r=u(e);for(let n=0;n=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function v(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(t).length;default:if(i)return n?-1:V(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return N(this,e,r);case"latin1":case"binary":return S(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=c.from(e,n)),c.isBuffer(e))return 0===e.length?-1:w(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):w(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function w(t,e,r,n,i){let o,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){let n=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){let r=!0;for(let n=0;ni&&(n=i):n=i;const o=e.length;let a;for(n>o/2&&(n=o/2),a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function E(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function O(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+a<=r){let r,n,s,u;switch(a){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],s=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=a}return function(t){const e=t.length;if(e<=j)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn.length?(c.isBuffer(e)||(e=c.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!c.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},c.byteLength=v,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;er&&(t+=" ... "),""},a&&(c.prototype[a]=c.prototype.inspect),c.prototype.compare=function(t,e,r,n,i){if(Y(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0);const s=Math.min(o,a),u=this.slice(n,i),l=t.slice(e,r);for(let t=0;t>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return A(this,t,e,r);case"utf8":case"utf-8":return x(this,t,e,r);case"ascii":case"latin1":case"binary":return _(this,t,e,r);case"base64":return k(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const j=4096;function N(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;in)&&(r=n);let i="";for(let n=e;nr)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,n,i,o){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function F(t,e,r,n,i){$(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=a,a>>=8,t[r++]=a,a>>=8,t[r++]=a,a>>=8,t[r++]=a,r}function U(t,e,r,n,i){$(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=a,a>>=8,t[r+2]=a,a>>=8,t[r+1]=a,a>>=8,t[r]=a,r+8}function D(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(t,e,r,n,i){return e=+e,r>>>=0,i||D(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function M(t,e,r,n,i){return e=+e,r>>>=0,i||D(t,0,r,8),o.write(t,e,r,n,52,8),r+8}c.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||C(t,e,this.length);let n=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,r||C(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readBigUInt64LE=K((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||X(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||X(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<>>=0,e>>>=0,r||C(t,e,this.length);let n=this[t],i=1,o=0;for(;++o=i&&(n-=Math.pow(2,8*e)),n},c.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},c.prototype.readInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){t>>>=0,e||C(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(t,e){t>>>=0,e||C(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=K((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||X(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||X(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<>>=0,e||C(t,4,this.length),o.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return t>>>=0,e||C(t,4,this.length),o.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return t>>>=0,e||C(t,8,this.length),o.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return t>>>=0,e||C(t,8,this.length),o.read(this,t,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||P(this,t,e,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,n||P(this,t,e,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,255,0),this[e]=255&t,e+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigUInt64LE=K((function(t,e=0){return F(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=K((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);P(this,t,e,r,n-1,-n)}let i=0,o=1,a=0;for(this[e]=255&t;++i>>=0,!n){const n=Math.pow(2,8*r-1);P(this,t,e,r,n-1,-n)}let i=r-1,o=1,a=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/o|0)-a&255;return e+r},c.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},c.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigInt64LE=K((function(t,e=0){return F(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=K((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},c.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},c.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},c.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},c.prototype.copy=function(t,e,r,n){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function $(t,e,r,n,i,o){if(t>r||t3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new B.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){z(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||X(e,t.length-(r+1))}(n,i,o)}function z(t,e){if("number"!=typeof t)throw new B.ERR_INVALID_ARG_TYPE(e,"number",t)}function X(t,e,r){if(Math.floor(t)!==t)throw z(t,r),new B.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new B.ERR_BUFFER_OUT_OF_BOUNDS;throw new B.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}q("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),q("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),q("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=H(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=H(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const G=/[^+/0-9A-Za-z-_]/g;function V(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let a=0;a55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function W(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(G,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Q(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function J(t){return t!=t}const Z=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function K(t){return"undefined"==typeof BigInt?tt:t}function tt(){throw new Error("BigInt not supported")}},7913:(t,e,r)=>{"use strict";var n=r(8651),i=r(6601),o=i(n("String.prototype.indexOf"));t.exports=function(t,e){var r=n(t,!!e);return"function"==typeof r&&o(t,".prototype.")>-1?i(r):r}},6601:(t,e,r)=>{"use strict";var n=r(5049),i=r(8651),o=i("%Function.prototype.apply%"),a=i("%Function.prototype.call%"),s=i("%Reflect.apply%",!0)||n.call(a,o),u=i("%Object.getOwnPropertyDescriptor%",!0),c=i("%Object.defineProperty%",!0),l=i("%Math.max%");if(c)try{c({},"a",{value:1})}catch(t){c=null}t.exports=function(t){var e=s(n,a,arguments);return u&&c&&u(e,"length").configurable&&c(e,"length",{value:1+l(0,t.length-(arguments.length-1))}),e};var h=function(){return s(n,o,arguments)};c?c(t.exports,"apply",{value:h}):t.exports.apply=h},6357:(t,e,r)=>{var n=r(7187),i=r(182);function o(){return(new Date).getTime()}var a,s=Array.prototype.slice,u={};a=void 0!==r.g&&r.g.console?r.g.console:"undefined"!=typeof window&&window.console?window.console:{};for(var c=[[function(){},"log"],[function(){a.log.apply(a,arguments)},"info"],[function(){a.log.apply(a,arguments)},"warn"],[function(){a.warn.apply(a,arguments)},"error"],[function(t){u[t]=o()},"time"],[function(t){var e=u[t];if(!e)throw new Error("No such label: "+t);delete u[t];var r=o()-e;a.log(t+": "+r+"ms")},"timeEnd"],[function(){var t=new Error;t.name="Trace",t.message=n.format.apply(null,arguments),a.error(t.stack)},"trace"],[function(t){a.log(n.inspect(t)+"\n")},"dir"],[function(t){if(!t){var e=s.call(arguments,1);i.ok(!1,n.format.apply(null,e))}},"assert"]],l=0;l-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function h(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function f(t){this.map={},t instanceof f?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function d(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=d(e);return e.readAsArrayBuffer(t),r}function v(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=v(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=v(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=p(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=d(e=new FileReader),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function A(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new f(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},g.call(b.prototype),g.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},A.error=function(){var t=new A(null,{status:0,statusText:""});return t.type="error",t};var x=[301,302,303,307,308];A.redirect=function(t,e){if(-1===x.indexOf(e))throw new RangeError("Invalid status code");return new A(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function _(t,r){return new Promise((function(n,o){var a=new b(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new f,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new A(i,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}_.polyfill=!0,t.fetch||(t.fetch=_,t.Headers=f,t.Request=b,t.Response=A),e.Headers=f,e.Request=b,e.Response=A,e.fetch=_,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e},7802:(t,e,r)=>{"use strict";var n=r(5643),i="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,a=Array.prototype.concat,s=Object.defineProperty,u=r(8890)(),c=s&&u,l=function(t,e,r,n){var i;(!(e in t)||"function"==typeof(i=n)&&"[object Function]"===o.call(i)&&n())&&(c?s(t,e,{configurable:!0,enumerable:!1,value:r,writable:!0}):t[e]=r)},h=function(t,e){var r=arguments.length>2?arguments[2]:{},o=n(e);i&&(o=a.call(o,Object.getOwnPropertySymbols(e)));for(var s=0;s{"use strict";function e(t,e){if(null==t)throw new TypeError("Cannot convert first argument to object");for(var r=Object(t),n=1;n{"use strict";var n=r(3746),i=Object.prototype.toString,o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){if(!n(e))throw new TypeError("iterator must be a function");var a;arguments.length>=3&&(a=r),"[object Array]"===i.call(t)?function(t,e,r){for(var n=0,i=t.length;n{"use strict";var e=Array.prototype.slice,r=Object.prototype.toString;t.exports=function(t){var n=this;if("function"!=typeof n||"[object Function]"!==r.call(n))throw new TypeError("Function.prototype.bind called on incompatible "+n);for(var i,o=e.call(arguments,1),a=Math.max(0,n.length-o.length),s=[],u=0;u{"use strict";var n=r(2719);t.exports=Function.prototype.bind||n},8651:(t,e,r)=>{"use strict";var n,i=SyntaxError,o=Function,a=TypeError,s=function(t){try{return o('"use strict"; return ('+t+").constructor;")()}catch(t){}},u=Object.getOwnPropertyDescriptor;if(u)try{u({},"")}catch(t){u=null}var c=function(){throw new a},l=u?function(){try{return c}catch(t){try{return u(arguments,"callee").get}catch(t){return c}}}():c,h=r(3257)(),f=Object.getPrototypeOf||function(t){return t.__proto__},p={},d="undefined"==typeof Uint8Array?n:f(Uint8Array),y={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":h?f([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":p,"%AsyncGenerator%":p,"%AsyncGeneratorFunction%":p,"%AsyncIteratorPrototype%":p,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":p,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h?f(f([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&h?f((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&h?f((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h?f(""[Symbol.iterator]()):n,"%Symbol%":h?Symbol:n,"%SyntaxError%":i,"%ThrowTypeError%":l,"%TypedArray%":d,"%TypeError%":a,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet};try{null.error}catch(t){var v=f(f(t));y["%Error.prototype%"]=v}var g=function t(e){var r;if("%AsyncFunction%"===e)r=s("async function () {}");else if("%GeneratorFunction%"===e)r=s("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=s("async function* () {}");else if("%AsyncGenerator%"===e){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===e){var i=t("%AsyncGenerator%");i&&(r=f(i.prototype))}return y[e]=r,r},m={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},b=r(5049),w=r(8032),A=b.call(Function.call,Array.prototype.concat),x=b.call(Function.apply,Array.prototype.splice),_=b.call(Function.call,String.prototype.replace),k=b.call(Function.call,String.prototype.slice),T=b.call(Function.call,RegExp.prototype.exec),E=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,O=/\\(\\)?/g,j=function(t,e){var r,n=t;if(w(m,n)&&(n="%"+(r=m[n])[0]+"%"),w(y,n)){var o=y[n];if(o===p&&(o=g(n)),void 0===o&&!e)throw new a("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new i("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new a('"allowMissing" argument must be a boolean');if(null===T(/^%?[^%]*%?$/,t))throw new i("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=k(t,0,1),r=k(t,-1);if("%"===e&&"%"!==r)throw new i("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new i("invalid intrinsic syntax, expected opening `%`");var n=[];return _(t,E,(function(t,e,r,i){n[n.length]=r?_(i,O,"$1"):e||t})),n}(t),n=r.length>0?r[0]:"",o=j("%"+n+"%",e),s=o.name,c=o.value,l=!1,h=o.alias;h&&(n=h[0],x(r,A([0,1],h)));for(var f=1,p=!0;f=r.length){var m=u(c,d);c=(p=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:c[d]}else p=w(c,d),c=c[d];p&&!l&&(y[s]=c)}}return c}},8109:(t,e,r)=>{"use strict";var n=r(8651)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(t){n=null}t.exports=n},8890:(t,e,r)=>{"use strict";var n=r(8651)("%Object.defineProperty%",!0),i=function(){if(n)try{return n({},"a",{value:1}),!0}catch(t){return!1}return!1};i.hasArrayLengthDefineBug=function(){if(!i())return null;try{return 1!==n([],"length",{value:1}).length}catch(t){return!0}},t.exports=i},3257:(t,e,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=r(2843);t.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},2843:t=>{"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(t,e);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},6626:(t,e,r)=>{"use strict";var n=r(2843);t.exports=function(){return n()&&!!Symbol.toStringTag}},8032:(t,e,r)=>{"use strict";var n=r(5049);t.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},9029:(t,e)=>{e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,l=-7,h=r?i-1:0,f=r?-1:1,p=t[e+h];for(h+=f,o=p&(1<<-l)-1,p>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=f,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+t[e+h],h+=f,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),o-=c}return(p?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,c=8*o-i-1,l=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=255&s,p+=d,s/=256,i-=8);for(a=a<0;t[r+p]=255&a,p+=d,a/=256,c-=8);t[r+p-d]|=128*y}},9784:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},7906:(t,e,r)=>{"use strict";var n=r(6626)(),i=r(7913)("Object.prototype.toString"),o=function(t){return!(n&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===i(t)},a=function(t){return!!o(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==i(t)&&"[object Function]"===i(t.callee)},s=function(){return o(arguments)}();o.isLegacyArguments=a,t.exports=s?o:a},3746:t=>{"use strict";var e,r,n=Function.prototype.toString,i="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof i&&"function"==typeof Object.defineProperty)try{e=Object.defineProperty({},"length",{get:function(){throw r}}),r={},i((function(){throw 42}),null,e)}catch(t){t!==r&&(i=null)}else i=null;var o=/^\s*class\b/,a=function(t){try{var e=n.call(t);return o.test(e)}catch(t){return!1}},s=function(t){try{return!a(t)&&(n.call(t),!0)}catch(t){return!1}},u=Object.prototype.toString,c="function"==typeof Symbol&&!!Symbol.toStringTag,l=!(0 in[,]),h=function(){return!1};if("object"==typeof document){var f=document.all;u.call(f)===u.call(document.all)&&(h=function(t){if((l||!t)&&(void 0===t||"object"==typeof t))try{var e=u.call(t);return("[object HTMLAllCollection]"===e||"[object HTML document.all class]"===e||"[object HTMLCollection]"===e||"[object Object]"===e)&&null==t("")}catch(t){}return!1})}t.exports=i?function(t){if(h(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;try{i(t,null,e)}catch(t){if(t!==r)return!1}return!a(t)&&s(t)}:function(t){if(h(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(c)return s(t);if(a(t))return!1;var e=u.call(t);return!("[object Function]"!==e&&"[object GeneratorFunction]"!==e&&!/^\[object HTML/.test(e))&&s(t)}},4610:(t,e,r)=>{"use strict";var n,i=Object.prototype.toString,o=Function.prototype.toString,a=/^\s*(?:function)?\*/,s=r(6626)(),u=Object.getPrototypeOf;t.exports=function(t){if("function"!=typeof t)return!1;if(a.test(o.call(t)))return!0;if(!s)return"[object GeneratorFunction]"===i.call(t);if(!u)return!1;if(void 0===n){var e=function(){if(!s)return!1;try{return Function("return function*() {}")()}catch(t){}}();n=!!e&&u(e)}return u(t)===n}},2621:t=>{"use strict";t.exports=function(t){return t!=t}},7051:(t,e,r)=>{"use strict";var n=r(6601),i=r(7802),o=r(2621),a=r(1320),s=r(5074),u=n(a(),Number);i(u,{getPolyfill:a,implementation:o,shim:s}),t.exports=u},1320:(t,e,r)=>{"use strict";var n=r(2621);t.exports=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:n}},5074:(t,e,r)=>{"use strict";var n=r(7802),i=r(1320);t.exports=function(){var t=i();return n(Number,{isNaN:t},{isNaN:function(){return Number.isNaN!==t}}),t}},6094:(t,e,r)=>{"use strict";var n=r(8404),i=r(821),o=r(7913),a=o("Object.prototype.toString"),s=r(6626)(),u=r(8109),c="undefined"==typeof globalThis?r.g:globalThis,l=i(),h=o("Array.prototype.indexOf",!0)||function(t,e){for(var r=0;r-1}return!!u&&function(t){var e=!1;return n(p,(function(r,n){if(!e)try{e=r.call(t)===n}catch(t){}})),e}(t)}},3249:t=>{"use strict";var e=function(t){return t!=t};t.exports=function(t,r){return 0===t&&0===r?1/t==1/r:t===r||!(!e(t)||!e(r))}},8527:(t,e,r)=>{"use strict";var n=r(7802),i=r(6601),o=r(3249),a=r(9636),s=r(3534),u=i(a(),Object);n(u,{getPolyfill:a,implementation:o,shim:s}),t.exports=u},9636:(t,e,r)=>{"use strict";var n=r(3249);t.exports=function(){return"function"==typeof Object.is?Object.is:n}},3534:(t,e,r)=>{"use strict";var n=r(9636),i=r(7802);t.exports=function(){var t=n();return i(Object,{is:t},{is:function(){return Object.is!==t}}),t}},8461:(t,e,r)=>{"use strict";var n;if(!Object.keys){var i=Object.prototype.hasOwnProperty,o=Object.prototype.toString,a=r(6515),s=Object.prototype.propertyIsEnumerable,u=!s.call({toString:null},"toString"),c=s.call((function(){}),"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],h=function(t){var e=t.constructor;return e&&e.prototype===t},f={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},p=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!f["$"+t]&&i.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{h(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();n=function(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===o.call(t),n=a(t),s=e&&"[object String]"===o.call(t),f=[];if(!e&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var d=c&&r;if(s&&t.length>0&&!i.call(t,0))for(var y=0;y0)for(var v=0;v{"use strict";var n=Array.prototype.slice,i=r(6515),o=Object.keys,a=o?function(t){return o(t)}:r(8461),s=Object.keys;a.shim=function(){if(Object.keys){var t=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);t||(Object.keys=function(t){return i(t)?s(n.call(t)):s(t)})}else Object.keys=a;return Object.keys||a},t.exports=a},6515:t=>{"use strict";var e=Object.prototype.toString;t.exports=function(t){var r=e.call(t),n="[object Arguments]"===r;return n||(n="[object Array]"!==r&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===e.call(t.callee)),n}},9964:t=>{var e,r,n=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(t){r=o}}();var s,u=[],c=!1,l=-1;function h(){c&&s&&(c=!1,s.length?u=s.concat(u):l=-1,u.length&&f())}function f(){if(!c){var t=a(h);c=!0;for(var e=u.length;e;){for(s=u,u=[];++l1)for(var r=1;r{"use strict";function e(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,r,n,i){r=r||"&",n=n||"=";var o={};if("string"!=typeof t||0===t.length)return o;var a=/\+/g;t=t.split(r);var s=1e3;i&&"number"==typeof i.maxKeys&&(s=i.maxKeys);var u=t.length;s>0&&u>s&&(u=s);for(var c=0;c=0?(l=d.substr(0,y),h=d.substr(y+1)):(l=d,h=""),f=decodeURIComponent(l),p=decodeURIComponent(h),e(o,f)?Array.isArray(o[f])?o[f].push(p):o[f]=[o[f],p]:o[f]=p}return o}},3016:t=>{"use strict";var e=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,r,n,i){return r=r||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(i){var o=encodeURIComponent(e(i))+n;return Array.isArray(t[i])?t[i].map((function(t){return o+encodeURIComponent(e(t))})).join(r):o+encodeURIComponent(e(t[i]))})).join(r):i?encodeURIComponent(e(i))+n+encodeURIComponent(e(t)):""}},4756:(t,e,r)=>{"use strict";e.decode=e.parse=r(4016),e.encode=e.stringify=r(3016)},5582:(t,e,r)=>{let n;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:r.g):t=>(n||(n=Promise.resolve())).then(t).catch((t=>setTimeout((()=>{throw t}),0)))},8540:t=>{const e={acl:"http://www.w3.org/ns/auth/acl#",arg:"http://www.w3.org/ns/pim/arg#",as:"https://www.w3.org/ns/activitystreams#",cal:"http://www.w3.org/2002/12/cal/ical#",cert:"http://www.w3.org/ns/auth/cert#",contact:"http://www.w3.org/2000/10/swap/pim/contact#",dc:"http://purl.org/dc/elements/1.1/",dct:"http://purl.org/dc/terms/",doap:"http://usefulinc.com/ns/doap#",foaf:"http://xmlns.com/foaf/0.1/",geo:"http://www.w3.org/2003/01/geo/wgs84_pos#",gpx:"http://www.w3.org/ns/pim/gpx#",http:"http://www.w3.org/2007/ont/http#",httph:"http://www.w3.org/2007/ont/httph#",icalTZ:"http://www.w3.org/2002/12/cal/icaltzd#",ldp:"http://www.w3.org/ns/ldp#",link:"http://www.w3.org/2007/ont/link#",log:"http://www.w3.org/2000/10/swap/log#",meeting:"http://www.w3.org/ns/pim/meeting#",mo:"http://purl.org/ontology/mo/",org:"http://www.w3.org/ns/org#",owl:"http://www.w3.org/2002/07/owl#",pad:"http://www.w3.org/ns/pim/pad#",patch:"http://www.w3.org/ns/pim/patch#",prov:"http://www.w3.org/ns/prov#",qu:"http://www.w3.org/2000/10/swap/pim/qif#",trip:"http://www.w3.org/ns/pim/trip#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",rss:"http://purl.org/rss/1.0/",sched:"http://www.w3.org/ns/pim/schedule#",schema:"http://schema.org/",sioc:"http://rdfs.org/sioc/ns#",solid:"http://www.w3.org/ns/solid/terms#",space:"http://www.w3.org/ns/pim/space#",stat:"http://www.w3.org/ns/posix/stat#",tab:"http://www.w3.org/2007/ont/link#",tabont:"http://www.w3.org/2007/ont/link#",ui:"http://www.w3.org/ns/ui#",vcard:"http://www.w3.org/2006/vcard/ns#",wf:"http://www.w3.org/2005/01/wf/flow#",xsd:"http://www.w3.org/2001/XMLSchema#",cco:"http://www.ontologyrepository.com/CommonCoreOntologies/",skos:"http://www.w3.org/2004/02/skos/core#",bookmark:"http://www.w3.org/2002/01/bookmark#",vann:"http://purl.org/vocab/vann/"};t.exports=function(t={namedNode:t=>t}){const r={};for(const n in e){const i=e[n];r[n]=function(e=""){return t.namedNode(i+e)}}return r}},9292:function(t,e,r){var n;t=r.nmd(t),function(i){e&&e.nodeType,t&&t.nodeType;var o="object"==typeof r.g&&r.g;o.global!==o&&o.window!==o&&o.self;var a,s=2147483647,u=36,c=26,l=38,h=700,f=/^xn--/,p=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=u-1,g=Math.floor,m=String.fromCharCode;function b(t){throw RangeError(y[t])}function w(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function A(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+w((t=t.replace(d,".")).split("."),e).join(".")}function x(t){for(var e,r,n=[],i=0,o=t.length;i=55296&&e<=56319&&i65535&&(e+=m((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+m(t)})).join("")}function k(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function T(t,e,r){var n=0;for(t=r?g(t/h):t>>1,t+=g(t/e);t>v*c>>1;n+=u)t=g(t/v);return g(n+(v+1)*t/(t+l))}function E(t){var e,r,n,i,o,a,l,h,f,p,d,y=[],v=t.length,m=0,w=128,A=72;for((r=t.lastIndexOf("-"))<0&&(r=0),n=0;n=128&&b("not-basic"),y.push(t.charCodeAt(n));for(i=r>0?r+1:0;i=v&&b("invalid-input"),((h=(d=t.charCodeAt(i++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:u)>=u||h>g((s-m)/a))&&b("overflow"),m+=h*a,!(h<(f=l<=A?1:l>=A+c?c:l-A));l+=u)a>g(s/(p=u-f))&&b("overflow"),a*=p;A=T(m-o,e=y.length+1,0==o),g(m/e)>s-w&&b("overflow"),w+=g(m/e),m%=e,y.splice(m++,0,w)}return _(y)}function O(t){var e,r,n,i,o,a,l,h,f,p,d,y,v,w,A,_=[];for(y=(t=x(t)).length,e=128,r=0,o=72,a=0;a=e&&dg((s-r)/(v=n+1))&&b("overflow"),r+=(l-e)*v,e=l,a=0;as&&b("overflow"),d==e){for(h=r,f=u;!(h<(p=f<=o?1:f>=o+c?c:f-o));f+=u)A=h-p,w=u-p,_.push(m(k(p+A%w,0))),h=g(A/w);_.push(m(k(h,0))),o=T(r,v,n==i),r=0,++n}++r,++e}return _.join("")}a={version:"1.3.2",ucs2:{decode:x,encode:_},decode:E,encode:O,toASCII:function(t){return A(t,(function(t){return p.test(t)?"xn--"+O(t):t}))},toUnicode:function(t){return A(t,(function(t){return f.test(t)?E(t.slice(4).toLowerCase()):t}))}},void 0===(n=function(){return a}.call(e,r,e,t))||(t.exports=n)}()},9533:(t,e,r)=>{"use strict";var n=r(9292),i=r(8278);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),h=["%","/","?",";","#"].concat(l),f=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=r(4756);o.prototype.parse=function(t,e,r){if(!i.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),s=-1!==o&&o127?C+="x":C+=I[P];if(!C.match(p)){var U=S.slice(0,O),D=S.slice(O+1),L=I.match(d);L&&(U.push(L[1]),D.unshift(L[2])),D.length&&(b="/"+D.join(".")+b),this.hostname=U.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),N||(this.hostname=n.toASCII(this.hostname));var M=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+M,this.href+=this.host,N&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!y[x])for(O=0,R=l.length;O0)&&r.host.split("@"))&&(r.auth=N.shift(),r.host=r.hostname=N.shift())),r.search=t.search,r.query=t.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!_.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var T=_.slice(-1)[0],E=(r.host||t.host||_.length>1)&&("."===T||".."===T)||""===T,O=0,j=_.length;j>=0;j--)"."===(T=_[j])?_.splice(j,1):".."===T?(_.splice(j,1),O++):O&&(_.splice(j,1),O--);if(!A&&!x)for(;O--;O)_.unshift("..");!A||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),E&&"/"!==_.join("/").substr(-1)&&_.push("");var N,S=""===_[0]||_[0]&&"/"===_[0].charAt(0);return k&&(r.hostname=r.host=S?"":_.length?_.shift():"",(N=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=N.shift(),r.host=r.hostname=N.shift())),(A=A||r.host&&_.length)&&!S&&_.unshift(""),_.length?r.pathname=_.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var t=this.host,e=s.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},8278:t=>{"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},1201:t=>{t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},9490:(t,e,r)=>{"use strict";var n=r(7906),i=r(4610),o=r(3381),a=r(6094);function s(t){return t.call.bind(t)}var u="undefined"!=typeof BigInt,c="undefined"!=typeof Symbol,l=s(Object.prototype.toString),h=s(Number.prototype.valueOf),f=s(String.prototype.valueOf),p=s(Boolean.prototype.valueOf);if(u)var d=s(BigInt.prototype.valueOf);if(c)var y=s(Symbol.prototype.valueOf);function v(t,e){if("object"!=typeof t)return!1;try{return e(t),!0}catch(t){return!1}}function g(t){return"[object Map]"===l(t)}function m(t){return"[object Set]"===l(t)}function b(t){return"[object WeakMap]"===l(t)}function w(t){return"[object WeakSet]"===l(t)}function A(t){return"[object ArrayBuffer]"===l(t)}function x(t){return"undefined"!=typeof ArrayBuffer&&(A.working?A(t):t instanceof ArrayBuffer)}function _(t){return"[object DataView]"===l(t)}function k(t){return"undefined"!=typeof DataView&&(_.working?_(t):t instanceof DataView)}e.isArgumentsObject=n,e.isGeneratorFunction=i,e.isTypedArray=a,e.isPromise=function(t){return"undefined"!=typeof Promise&&t instanceof Promise||null!==t&&"object"==typeof t&&"function"==typeof t.then&&"function"==typeof t.catch},e.isArrayBufferView=function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):a(t)||k(t)},e.isUint8Array=function(t){return"Uint8Array"===o(t)},e.isUint8ClampedArray=function(t){return"Uint8ClampedArray"===o(t)},e.isUint16Array=function(t){return"Uint16Array"===o(t)},e.isUint32Array=function(t){return"Uint32Array"===o(t)},e.isInt8Array=function(t){return"Int8Array"===o(t)},e.isInt16Array=function(t){return"Int16Array"===o(t)},e.isInt32Array=function(t){return"Int32Array"===o(t)},e.isFloat32Array=function(t){return"Float32Array"===o(t)},e.isFloat64Array=function(t){return"Float64Array"===o(t)},e.isBigInt64Array=function(t){return"BigInt64Array"===o(t)},e.isBigUint64Array=function(t){return"BigUint64Array"===o(t)},g.working="undefined"!=typeof Map&&g(new Map),e.isMap=function(t){return"undefined"!=typeof Map&&(g.working?g(t):t instanceof Map)},m.working="undefined"!=typeof Set&&m(new Set),e.isSet=function(t){return"undefined"!=typeof Set&&(m.working?m(t):t instanceof Set)},b.working="undefined"!=typeof WeakMap&&b(new WeakMap),e.isWeakMap=function(t){return"undefined"!=typeof WeakMap&&(b.working?b(t):t instanceof WeakMap)},w.working="undefined"!=typeof WeakSet&&w(new WeakSet),e.isWeakSet=function(t){return w(t)},A.working="undefined"!=typeof ArrayBuffer&&A(new ArrayBuffer),e.isArrayBuffer=x,_.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&_(new DataView(new ArrayBuffer(1),0,1)),e.isDataView=k;var T="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function E(t){return"[object SharedArrayBuffer]"===l(t)}function O(t){return void 0!==T&&(void 0===E.working&&(E.working=E(new T)),E.working?E(t):t instanceof T)}function j(t){return v(t,h)}function N(t){return v(t,f)}function S(t){return v(t,p)}function R(t){return u&&v(t,d)}function I(t){return c&&v(t,y)}e.isSharedArrayBuffer=O,e.isAsyncFunction=function(t){return"[object AsyncFunction]"===l(t)},e.isMapIterator=function(t){return"[object Map Iterator]"===l(t)},e.isSetIterator=function(t){return"[object Set Iterator]"===l(t)},e.isGeneratorObject=function(t){return"[object Generator]"===l(t)},e.isWebAssemblyCompiledModule=function(t){return"[object WebAssembly.Module]"===l(t)},e.isNumberObject=j,e.isStringObject=N,e.isBooleanObject=S,e.isBigIntObject=R,e.isSymbolObject=I,e.isBoxedPrimitive=function(t){return j(t)||N(t)||S(t)||R(t)||I(t)},e.isAnyArrayBuffer=function(t){return"undefined"!=typeof Uint8Array&&(x(t)||O(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(e,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}))},7187:(t,e,r)=>{var n=r(9964),i=r(6357),o=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},n=0;n=i)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),s=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(r)?n.showHidden=r:r&&e._extend(n,r),A(n.showHidden)&&(n.showHidden=!1),A(n.depth)&&(n.depth=2),A(n.colors)&&(n.colors=!1),A(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=h),p(n,t,n.depth)}function h(t,e){var r=l.styles[e];return r?"["+l.colors[r][0]+"m"+t+"["+l.colors[r][1]+"m":t}function f(t,e){return t}function p(t,r,n){if(t.customInspect&&r&&E(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,t);return w(i)||(i=p(t,i,n)),i}var o=function(t,e){if(A(e))return t.stylize("undefined","undefined");if(w(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return b(e)?t.stylize(""+e,"number"):g(e)?t.stylize(""+e,"boolean"):m(e)?t.stylize("null","null"):void 0}(t,r);if(o)return o;var a=Object.keys(r),s=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(r)),T(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return d(r);if(0===a.length){if(E(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(x(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(k(r))return t.stylize(Date.prototype.toString.call(r),"date");if(T(r))return d(r)}var c,l="",h=!1,f=["{","}"];return v(r)&&(h=!0,f=["[","]"]),E(r)&&(l=" [Function"+(r.name?": "+r.name:"")+"]"),x(r)&&(l=" "+RegExp.prototype.toString.call(r)),k(r)&&(l=" "+Date.prototype.toUTCString.call(r)),T(r)&&(l=" "+d(r)),0!==a.length||h&&0!=r.length?n<0?x(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),c=h?function(t,e,r,n,i){for(var o=[],a=0,s=e.length;a60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}(c,l,f)):f[0]+l+f[1]}function d(t){return"["+Error.prototype.toString.call(t)+"]"}function y(t,e,r,n,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),S(n,i)||(a="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=m(r)?p(t,u.value,null):p(t,u.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(t){return" "+t})).join("\n").slice(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),A(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.slice(1,-1),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function v(t){return Array.isArray(t)}function g(t){return"boolean"==typeof t}function m(t){return null===t}function b(t){return"number"==typeof t}function w(t){return"string"==typeof t}function A(t){return void 0===t}function x(t){return _(t)&&"[object RegExp]"===O(t)}function _(t){return"object"==typeof t&&null!==t}function k(t){return _(t)&&"[object Date]"===O(t)}function T(t){return _(t)&&("[object Error]"===O(t)||t instanceof Error)}function E(t){return"function"==typeof t}function O(t){return Object.prototype.toString.call(t)}function j(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(t){if(t=t.toUpperCase(),!s[t])if(u.test(t)){var r=n.pid;s[t]=function(){var n=e.format.apply(e,arguments);i.error("%s %d: %s",t,r,n)}}else s[t]=function(){};return s[t]},e.inspect=l,l.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},l.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.types=r(9490),e.isArray=v,e.isBoolean=g,e.isNull=m,e.isNullOrUndefined=function(t){return null==t},e.isNumber=b,e.isString=w,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=A,e.isRegExp=x,e.types.isRegExp=x,e.isObject=_,e.isDate=k,e.types.isDate=k,e.isError=T,e.types.isNativeError=T,e.isFunction=E,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(1201);var N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function S(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){var t,r;i.log("%s - %s",(r=[j((t=new Date).getHours()),j(t.getMinutes()),j(t.getSeconds())].join(":"),[t.getDate(),N[t.getMonth()],r].join(" ")),e.format.apply(e,arguments))},e.inherits=r(9784),e._extend=function(t,e){if(!e||!_(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t};var R="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function I(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(R&&t[R]){var e;if("function"!=typeof(e=t[R]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,R,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,n=new Promise((function(t,n){e=t,r=n})),i=[],o=0;o{"use strict";var n=r(8404),i=r(821),o=r(7913),a=r(8109),s=o("Object.prototype.toString"),u=r(6626)(),c="undefined"==typeof globalThis?r.g:globalThis,l=i(),h=o("String.prototype.slice"),f={},p=Object.getPrototypeOf;u&&a&&p&&n(l,(function(t){if("function"==typeof c[t]){var e=new c[t];if(Symbol.toStringTag in e){var r=p(e),n=a(r,Symbol.toStringTag);if(!n){var i=p(r);n=a(i,Symbol.toStringTag)}f[t]=n.get}}}));var d=r(6094);t.exports=function(t){return!!d(t)&&(u&&Symbol.toStringTag in t?function(t){var e=!1;return n(f,(function(r,n){if(!e)try{var i=r.call(t);i===n&&(e=i)}catch(t){}})),e}(t):h(s(t),8,-1))}},8392:e=>{"use strict";e.exports=t},8541:(t,e,r)=>{var n=r(2990).default;function i(){"use strict";t.exports=i=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var e,r={},o=Object.prototype,a=o.hasOwnProperty,s=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",h=u.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(e){f=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var i=e&&e.prototype instanceof w?e:w,o=Object.create(i.prototype),a=new C(n||[]);return s(o,"_invoke",{value:N(t,r,a)}),o}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=p;var y="suspendedStart",v="suspendedYield",g="executing",m="completed",b={};function w(){}function A(){}function x(){}var _={};f(_,c,(function(){return this}));var k=Object.getPrototypeOf,T=k&&k(k(P([])));T&&T!==o&&a.call(T,c)&&(_=T);var E=x.prototype=w.prototype=Object.create(_);function O(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function r(i,o,s,u){var c=d(t[i],t,o);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==n(h)&&a.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,s,u)}),(function(t){r("throw",t,s,u)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,u)}))}u(c.arg)}var i;s(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}})}function N(t,r,n){var i=y;return function(o,a){if(i===g)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var u=S(s,n);if(u){if(u===b)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===y)throw i=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=g;var c=d(t,r,n);if("normal"===c.type){if(i=n.done?m:v,c.arg===b)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=m,n.method="throw",n.arg=c.arg)}}}function S(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b;var o=d(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,b;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,b):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}function R(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(R,this),this.reset(!0)}function P(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function r(){for(;++i=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=a.call(o,"catchLoc"),c=a.call(o,"finallyLoc");if(u&&c){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),b}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:P(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),b}},r}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},2990:t=>{function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},232:(t,e,r)=>{var n=r(8541)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},821:(t,e,r)=>{"use strict";var n=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],i="undefined"==typeof globalThis?r.g:globalThis;t.exports=function(){for(var t=[],e=0;e{"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}r.d(e,{A:()=>n})},2937:(t,e,r)=>{"use strict";r.d(e,{A:()=>o});var n=r(9812);function i(t,e){for(var r=0;r{"use strict";r.d(e,{A:()=>i});var n=r(9812);function i(t,e,r){return(e=(0,n.A)(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},8782:(t,e,r)=>{"use strict";function n(t){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}r.d(e,{A:()=>n})},9604:(t,e,r)=>{"use strict";function n(t,e){return n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},n(t,e)}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&n(t,e)}r.d(e,{A:()=>i})},365:(t,e,r)=>{"use strict";r.d(e,{A:()=>i});var n=r(4360);function i(t,e){if(e&&("object"===(0,n.A)(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}},9812:(t,e,r)=>{"use strict";r.d(e,{A:()=>i});var n=r(4360);function i(t){var e=function(t,e){if("object"!=(0,n.A)(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,"string");if("object"!=(0,n.A)(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==(0,n.A)(e)?e:e+""}},4360:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}r.d(e,{A:()=>n})}},a={};function s(t){var e=a[t];if(void 0!==e)return e.exports;var r=a[t]={id:t,loaded:!1,exports:{}};return o[t].call(r.exports,r,r.exports,s),r.loaded=!0,r.exports}s.m=o,s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},r=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,s.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var i=Object.create(null);s.r(i);var o={};e=e||[null,r({}),r([]),r(r)];for(var a=2&n&&t;"object"==typeof a&&!~e.indexOf(a);a=r(a))Object.getOwnPropertyNames(a).forEach((e=>o[e]=()=>t[e]));return o.default=()=>t,s.d(i,o),i},s.d=(t,e)=>{for(var r in e)s.o(e,r)&&!s.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},s.f={},s.e=t=>Promise.all(Object.keys(s.f).reduce(((e,r)=>(s.f[r](t,e),e)),[])),s.u=t=>t+".rdflib.min.js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s.hmd=t=>((t=Object.create(t)).children||(t.children=[]),Object.defineProperty(t,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+t.id)}}),t),s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n={},i="$rdf:",s.l=(t,e,r,o)=>{if(n[t])n[t].push(e);else{var a,u;if(void 0!==r)for(var c=document.getElementsByTagName("script"),l=0;l{a.onerror=a.onload=null,clearTimeout(p);var i=n[t];if(delete n[t],a.parentNode&&a.parentNode.removeChild(a),i&&i.forEach((t=>t(r))),e)return e(r)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=f.bind(null,a.onerror),a.onload=f.bind(null,a.onload),u&&document.head.appendChild(a)}},s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{var t;s.g.importScripts&&(t=s.g.location+"");var e=s.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var r=e.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!t||!/^http(s?):/.test(t));)t=r[n--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=t})(),(()=>{var t={792:0};s.f.j=(e,r)=>{var n=s.o(t,e)?t[e]:void 0;if(0!==n)if(n)r.push(n[2]);else{var i=new Promise(((r,i)=>n=t[e]=[r,i]));r.push(n[2]=i);var o=s.p+s.u(e),a=new Error;s.l(o,(r=>{if(s.o(t,e)&&(0!==(n=t[e])&&(t[e]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;a.message="Loading chunk "+e+" failed.\n("+i+": "+o+")",a.name="ChunkLoadError",a.type=i,a.request=o,n[1](a)}}),"chunk-"+e,e)}};var e=(e,r)=>{var n,i,[o,a,u]=r,c=0;if(o.some((e=>0!==t[e]))){for(n in a)s.o(a,n)&&(s.m[n]=a[n]);u&&u(s)}for(e&&e(r);c{"use strict";s.r(u),s.d(u,{BlankNode:()=>p,Collection:()=>k,ConnectedStore:()=>zr,DataFactory:()=>xr,Empty:()=>O,Fetcher:()=>fr,Formula:()=>ht,IndexedFormula:()=>Et,Literal:()=>w,LiveStore:()=>Xr,N3Parser:()=>Yt,NamedNode:()=>y.A,Namespace:()=>W,NextId:()=>$r,Node:()=>ft,Query:()=>yt,RDFParser:()=>He,RDFaProcessor:()=>Be,SPARQLToQuery:()=>yr,Serializer:()=>et,Statement:()=>L,Store:()=>Et,UpdateManager:()=>mr,UpdatesSocket:()=>_r,UpdatesVia:()=>kr,Util:()=>Q,Variable:()=>H,blankNode:()=>Fr,defaultGraph:()=>Ur,fetcher:()=>Nr,fromNT:()=>qr,graph:()=>Sr,isBlankNode:()=>v.jt,isCollection:()=>v.P3,isGraph:()=>v.RN,isLiteral:()=>v.c$,isNamedNode:()=>v.Y2,isPredicate:()=>v.YC,isQuad:()=>v.aF,isRDFObject:()=>v.GE,isRDFlibObject:()=>v.DJ,isRDFlibPredicate:()=>v.fY,isRDFlibSubject:()=>v.CZ,isStatement:()=>v.SH,isStore:()=>v.ok,isSubject:()=>v.hr,isTerm:()=>v.D0,isVariable:()=>v.DZ,jsonParser:()=>pr,lit:()=>Rr,literal:()=>Dr,log:()=>V.A,namedNode:()=>Cr,parse:()=>ze,quad:()=>Lr,queryToSPARQL:()=>dr,serialize:()=>nt,sparqlUpdateParser:()=>$e,st:()=>Ir,sym:()=>Cr,term:()=>Hr,termValue:()=>Ve.E,triple:()=>Mr,uri:()=>M,variable:()=>Pr});var t=s(2937),e=s(9121),r=s(365),n=s(8782),i=s(9604),o=s(8175),a=s(9390),c=s(1605),l=s(6866);function h(t,e,i){return e=(0,n.A)(e),(0,r.A)(t,f()?Reflect.construct(e,i||[],(0,n.A)(t).constructor):e.apply(t,i))}function f(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(f=function(){return!!t})()}var p=function(r){function n(t){var r;return(0,e.A)(this,n),r=h(this,n,[n.getId(t)]),(0,o.A)(r,"termType",l.$Q),(0,o.A)(r,"classOrder",a.A.BlankNode),(0,o.A)(r,"isBlank",1),(0,o.A)(r,"isVar",1),r}return(0,i.A)(n,r),(0,t.A)(n,[{key:"id",get:function(){return this.value},set:function(t){this.value=t}},{key:"compareTerm",value:function(t){return this.classOrdert.classOrder?1:this.idt.id?1:0}},{key:"copy",value:function(t){var e=new n;return t.copyTo(this,e),e}},{key:"toCanonical",value:function(){return n.NTAnonymousNodePrefix+this.value}},{key:"toString",value:function(){return n.NTAnonymousNodePrefix+this.id}}],[{key:"getId",value:function(t){if(t){if("string"!=typeof t)throw new Error("Bad id argument to new blank node: "+t);if(t.includes("#")){var e=t.split("#");return e[e.length-1]}return t}return"n"+n.nextId++}}])}(c.A);(0,o.A)(p,"nextId",0),(0,o.A)(p,"NTAnonymousNodePrefix","_:");var d=s(4360),y=s(3627),v=s(546);const g={boolean:new y.A("http://www.w3.org/2001/XMLSchema#boolean"),dateTime:new y.A("http://www.w3.org/2001/XMLSchema#dateTime"),decimal:new y.A("http://www.w3.org/2001/XMLSchema#decimal"),double:new y.A("http://www.w3.org/2001/XMLSchema#double"),integer:new y.A("http://www.w3.org/2001/XMLSchema#integer"),langString:new y.A("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),string:new y.A("http://www.w3.org/2001/XMLSchema#string")};function m(t,e,i){return e=(0,n.A)(e),(0,r.A)(t,b()?Reflect.construct(e,i||[],(0,n.A)(t).constructor):e.apply(t,i))}function b(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(b=function(){return!!t})()}var w=function(r){function n(t,r,i){var s;return(0,e.A)(this,n),s=m(this,n,[t]),(0,o.A)(s,"termType",l.QW),(0,o.A)(s,"classOrder",a.A.Literal),(0,o.A)(s,"datatype",g.string),(0,o.A)(s,"isVar",0),(0,o.A)(s,"language",""),r?(s.language=r,s.datatype=g.langString):s.datatype=i?y.A.fromValue(i):g.string,s}return(0,i.A)(n,r),(0,t.A)(n,[{key:"copy",value:function(){return new n(this.value,this.lang,this.datatype)}},{key:"equals",value:function(t){return!!t&&this.termType===t.termType&&this.value===t.value&&this.language===t.language&&(!this.datatype&&!t.datatype||this.datatype&&this.datatype.equals(t.datatype))}},{key:"lang",get:function(){return this.language},set:function(t){this.language=t||""}},{key:"toNT",value:function(){return n.toNT(this)}},{key:"toString",value:function(){return""+this.value}}],[{key:"toNT",value:function(t){if("number"==typeof t.value)return""+t.value;if("string"!=typeof t.value)throw new Error("Value of RDF literal is not string or number: "+t.value);var e=t.value;return e='"'+(e=(e=(e=(e=e.replace(/\\/g,"\\\\")).replace(/\"/g,'\\"')).replace(/\n/g,"\\n")).replace(/\r/g,"\\r"))+'"',t.language?e+="@"+t.language:t.datatype.equals(g.string)||(e+="^^"+t.datatype.toCanonical()),e}},{key:"fromBoolean",value:function(t){return new n(t?"1":"0",null,g.boolean)}},{key:"fromDate",value:function(t){if(!(t instanceof Date))throw new TypeError("Invalid argument to Literal.fromDate()");var e=function(t){return(""+(100+t)).slice(1,3)};return new n(t.getUTCFullYear()+"-"+e(t.getUTCMonth()+1)+"-"+e(t.getUTCDate())+"T"+e(t.getUTCHours())+":"+e(t.getUTCMinutes())+":"+e(t.getUTCSeconds())+"Z",null,g.dateTime)}},{key:"fromNumber",value:function(t){if("number"!=typeof t)throw new TypeError("Invalid argument to Literal.fromNumber()");var e,r=t.toString();return e=r.indexOf("e")<0&&Math.abs(t)<=Number.MAX_SAFE_INTEGER?Number.isInteger(t)?g.integer:g.decimal:g.double,new n(r,null,e)}},{key:"fromValue",value:function(t){if((0,v.c$)(t))return t;switch((0,d.A)(t)){case"object":if(t instanceof Date)return n.fromDate(t);case"boolean":return n.fromBoolean(t);case"number":return n.fromNumber(t);case"string":return new n(t)}throw new Error("Can't make literal from "+t+" of type "+(0,d.A)(t))}}])}(c.A);function A(t,e,i){return e=(0,n.A)(e),(0,r.A)(t,x()?Reflect.construct(e,i||[],(0,n.A)(t).constructor):e.apply(t,i))}function x(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(x=function(){return!!t})()}function _(t){return null==t||(0,v.D0)(t)?t:Array.isArray(t)?new k(t):w.fromValue(t)}var k=function(r){function n(t){var r;return(0,e.A)(this,n),r=A(this,n,[(p.nextId++).toString()]),(0,o.A)(r,"termType",l.r0),(0,o.A)(r,"classOrder",a.A.Collection),(0,o.A)(r,"closed",!1),(0,o.A)(r,"compareTerm",p.prototype.compareTerm),(0,o.A)(r,"elements",[]),(0,o.A)(r,"isVar",0),t&&t.length>0&&t.forEach((function(t){r.elements.push(_(t))})),r}return(0,i.A)(n,r),(0,t.A)(n,[{key:"id",get:function(){return this.value},set:function(t){this.value=t}},{key:"append",value:function(t){return this.elements.push(t)}},{key:"close",value:function(){return this.closed=!0,this.closed}},{key:"shift",value:function(){return this.elements.shift()}},{key:"substitute",value:function(t){return new n(this.elements.map((function(e){return e.substitute(t)})))}},{key:"toNT",value:function(){return n.toNT(this)}},{key:"toString",value:function(){return"("+this.elements.join(" ")+")"}},{key:"unshift",value:function(t){return this.elements.unshift(t)}}],[{key:"toNT",value:function(t){return p.NTAnonymousNodePrefix+t.id}}])}(c.A);function T(t,e,i){return e=(0,n.A)(e),(0,r.A)(t,E()?Reflect.construct(e,i||[],(0,n.A)(t).constructor):e.apply(t,i))}function E(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(E=function(){return!!t})()}(0,o.A)(k,"termType",l.r0);var O=function(r){function n(){var t;return(0,e.A)(this,n),t=T(this,n,[""]),(0,o.A)(t,"termType",l.S),t}return(0,i.A)(n,r),(0,t.A)(n,[{key:"toString",value:function(){return"()"}}])}(c.A);function j(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}function N(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(t){j(o,n,i,a,s,"next",t)}function s(t){j(o,n,i,a,s,"throw",t)}a(void 0)}))}}var S=s(232),R=s.n(S),I="chrome:theSession";function C(t,e,i){return e=(0,n.A)(e),(0,r.A)(t,P()?Reflect.construct(e,i||[],(0,n.A)(t).constructor):e.apply(t,i))}function P(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(P=function(){return!!t})()}new y.A(I);var F=function(r){function n(){var t;return(0,e.A)(this,n),t=C(this,n,[""]),(0,o.A)(t,"value",""),(0,o.A)(t,"termType",l.ic),(0,o.A)(t,"uri",I),t}return(0,i.A)(n,r),(0,t.A)(n,[{key:"toCanonical",value:function(){return this.value}},{key:"toString",value:function(){return"DefaultGraph"}}])}(c.A);function U(t){return!!t&&t.termType===l.ic}var D=new F,L=function(){function r(t,n,i,a){(0,e.A)(this,r),(0,o.A)(this,"subject",void 0),(0,o.A)(this,"predicate",void 0),(0,o.A)(this,"object",void 0),(0,o.A)(this,"graph",void 0),this.subject=c.A.fromValue(t),this.predicate=c.A.fromValue(n),this.object=c.A.fromValue(i),this.graph=null==a?D:c.A.fromValue(a)}return(0,t.A)(r,[{key:"why",get:function(){return this.graph},set:function(t){this.graph=t}},{key:"equals",value:function(t){return t.subject.equals(this.subject)&&t.predicate.equals(this.predicate)&&t.object.equals(this.object)&&t.graph.equals(this.graph)}},{key:"substitute",value:function(t){return new r(this.subject.substitute(t),this.predicate.substitute(t),this.object.substitute(t),U(this.graph)?this.graph:this.graph.substitute(t))}},{key:"toCanonical",value:function(){var t=[this.subject.toCanonical(),this.predicate.toCanonical(),this.object.toCanonical()];return this.graph&&this.graph.termType!==l.ic&&t.push(this.graph.toCanonical()),t.join(" ")+" ."}},{key:"toNT",value:function(){return[this.subject.toNT(),this.predicate.toNT(),this.object.toNT()].join(" ")+" ."}},{key:"toNQ",value:function(){return[this.subject.toNT(),this.predicate.toNT(),this.object.toNT(),U(this.graph)?"":this.graph.toNT()].join(" ")+" ."}},{key:"toString",value:function(){return this.toNT()}}])}(),M=s(4221);function B(t,e,i){return e=(0,n.A)(e),(0,r.A)(t,q()?Reflect.construct(e,i||[],(0,n.A)(t).constructor):e.apply(t,i))}function q(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(q=function(){return!!t})()}var H=function(r){function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return(0,e.A)(this,n),t=B(this,n,[r]),(0,o.A)(t,"termType",l.P2),(0,o.A)(t,"base","varid:"),(0,o.A)(t,"classOrder",a.A.Variable),(0,o.A)(t,"isVar",1),(0,o.A)(t,"uri",void 0),t.base="varid:",t.uri=M.join(r,t.base),t}return(0,i.A)(n,r),(0,t.A)(n,[{key:"equals",value:function(t){return!!t&&this.termType===t.termType&&this.value===t.value}},{key:"hashString",value:function(){return this.toString()}},{key:"substitute",value:function(t){var e;return null!=(e=t[this.toNT()])?e:this}},{key:"toString",value:function(){return n.toString(this)}}],[{key:"toString",value:function(t){return t.uri.slice(0,t.base.length)===t.base?"?".concat(t.uri.slice(t.base.length)):"?".concat(t.uri)}}])}(c.A),$=function(t){return t.collections="COLLECTIONS",t.defaultGraphType="DEFAULT_GRAPH_TYPE",t.equalsMethod="EQUALS_METHOD",t.id="ID",t.identity="IDENTITY",t.reversibleId="REVERSIBLE_ID",t.variableType="VARIABLE_TYPE",t}({}),z=new F,X={supports:(0,o.A)((0,o.A)((0,o.A)((0,o.A)((0,o.A)((0,o.A)((0,o.A)({},$.collections,!1),$.defaultGraphType,!1),$.equalsMethod,!0),$.identity,!1),$.id,!0),$.reversibleId,!1),$.variableType,!0),blankNode:function(t){return new p(t)},defaultGraph:function(){return z},equals:function(t,e){return t===e||!t||!e||((0,v.aF)(t)||(0,v.aF)(e)?!(!(0,v.aF)(t)||!(0,v.aF)(e))&&this.equals(t.subject,e.subject)&&this.equals(t.predicate,e.predicate)&&this.equals(t.object,e.object)&&this.equals(t.graph,e.graph):!(!(0,v.D0)(t)||!(0,v.D0)(e))&&this.id(t)===this.id(e))},id:function(t){if(!t)return"undefined";if((0,v.aF)(t))return this.quadToNQ(t);switch(t.termType){case l.ic:return"defaultGraph";case l.P2:return H.toString(t);default:var e=this.termToNQ(t);if(e)return e;throw new Error("Can't id term with type '".concat(t.termType,"'"))}},isQuad:function(t){return t instanceof L},literal:function(t,e){if("string"!=typeof t&&!e)return w.fromValue(t);var r="string"==typeof t?t:""+t;return"string"==typeof e?-1===e.indexOf(":")?new w(r,e):new w(r,null,this.namedNode(e)):new w(r,null,e)},namedNode:function(t){return new y.A(t)},quad:function(t,e,r,n){return new L(t,e,r,n||z)},triple:function(t,e,r,n){return this.quad(t,e,r,n)},quadToNQ:function(t){return"".concat(this.termToNQ(t.subject)," ").concat(this.termToNQ(t.predicate)," ").concat(this.termToNQ(t.object)," ").concat(this.termToNQ(t.graph)," .")},termToNQ:function(t){var e=this;switch(t.termType){case l.$Q:return"_:"+t.value;case l.ic:return"";case l.S:return"";case l.QW:return w.toNT(t);case l.bD:case l.Kk:return"<"+t.value+">";case l.r0:return"("+t.elements.map((function(t){return e.termToNQ(t)})).join(" ")+")";default:throw new Error("Can't serialize nonstandard term type (was '".concat(t.termType,"')"))}},toNQ:function(t){return this.isQuad(t)?this.quadToNQ(t):this.termToNQ(t)},variable:function(t){return new H(t)}};const G=X;var V=s(3787);function W(t,e){var r=e||{namedNode:function(t){return new y.A(t)}};return function(e){return r.namedNode(t+(e||""))}}var Q=s(7114);function Y(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G;return{boolean:t.namedNode("http://www.w3.org/2001/XMLSchema#boolean"),dateTime:t.namedNode("http://www.w3.org/2001/XMLSchema#dateTime"),decimal:t.namedNode("http://www.w3.org/2001/XMLSchema#decimal"),double:t.namedNode("http://www.w3.org/2001/XMLSchema#double"),integer:t.namedNode("http://www.w3.org/2001/XMLSchema#integer"),langString:t.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),string:t.namedNode("http://www.w3.org/2001/XMLSchema#string")}}Y(G);var J=s(8540),Z=s.n(J),K=s(2312),tt=s(6357);function et(t){return new rt(t)}var rt=function(){function r(t){(0,e.A)(this,r),(0,o.A)(this,"_notQNameChars","\t\r\n !\"#$%&'()*.,+/;<=>?@[\\]^`{|}~"),(0,o.A)(this,"_notNameChars",this._notQNameChars+":"),(0,o.A)(this,"validPrefix",new RegExp(/^[a-zA-Z][a-zA-Z0-9]*$/)),(0,o.A)(this,"forbidden1",new RegExp(/[\\"\b\f\r\v\t\n\u0080-\uffff]/gm)),(0,o.A)(this,"forbidden3",new RegExp(/[\\"\b\f\r\v\u0080-\uffff]/gm)),this.flags="",this.base=null,this.prefixes=[],this.namespaces=[];var n=Object.keys(Z()());for(var i in n){var a=Z()()[n[i]](""),s=n[i];this.prefixes[a]=s,this.namespaces[s]=a}this.suggestPrefix("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this.suggestPrefix("xml","reserved:reservedForFutureUse"),this.namespacesUsed=[],this.keywords=["a"],this.prefixchars="abcdefghijklmnopqustuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",this.incoming=null,this.formulas=[],this.store=t,this.rdfFactory=t.rdfFactory||G,this.xsd=Y(this.rdfFactory)}return(0,t.A)(r,[{key:"setBase",value:function(t){return this.base=t,this}},{key:"setFlags",value:function(t){return this.flags=t||"",this}},{key:"toStr",value:function(t){var e=t.toNT();return"Graph"===t.termType&&(this.formulas[e]=t),e}},{key:"fromStr",value:function(t){if("{"===t[0]){var e=this.formulas[t];return e||tt.log("No formula object for "+t),e}return this.store.fromNT(t)}},{key:"setNamespaces",value:function(t){for(var e in t)this.setPrefix(e,t[e]);return this}},{key:"setPrefix",value:function(t,e){if("default"!==t.slice(0,7)&&"ns"!==t.slice(0,2)&&t&&e){for(var r in this.prefixes)this.prefixes[r]==t&&delete this.prefixes[r];this.prefixes[e]=t,this.namespaces[t]=e}}},{key:"suggestPrefix",value:function(t,e){"default"!==t.slice(0,7)&&"ns"!==t.slice(0,2)&&t&&e&&(t in this.namespaces||e in this.prefixes||(this.prefixes[e]=t,this.namespaces[t]=e))}},{key:"suggestNamespaces",value:function(t){for(var e in t)this.suggestPrefix(e,t[e]);return this}},{key:"checkIntegrity",value:function(){var t,e;for(t in this.namespaces)if(this.prefixes[this.namespaces[t]]!==t)throw new Error("Serializer integity error 1: "+t+", "+this.namespaces[t]+", "+this.prefixes[this.namespaces[t]]+"!");for(e in this.prefixes)if(this.namespaces[this.prefixes[e]]!==e)throw new Error("Serializer integity error 2: "+e+", "+this.prefixs[e]+", "+this.namespaces[this.prefixes[e]]+"!")}},{key:"makeUpPrefix",value:function(t){var e=t,r=function(e){return!!this.validPrefix.test(e)&&"ns"!==e&&!(e in this.namespaces)&&(this.prefixes[t]=e,this.namespaces[e]=t,e)}.bind(this);"#/".indexOf(e[e.length-1])>=0&&(e=e.slice(0,-1));var n=e.lastIndexOf("/");n>=0&&(e=e.slice(n+1));for(var i=0;i=0?t=function(t){for(var e,r="",n=0;n65535?"\\U"+("00000000"+e.toString(16)).slice(-8):e>126?"\\u"+("0000"+e.toString(16)).slice(-4):t[n];return r}(t):(e=decodeURI(t),t=encodeURI(e)),"<"+t+">"}},{key:"statementsToNTriples",value:function(t){var e=t.slice();e.sort();for(var r="",n="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i=this,o=this.store,a=this.rdfFactory,s=function t(e){if("Collection"!==e.termType)return i.atomicTermToN3(e);for(var s=e.elements,u=o.sym(n+"nill"),c=s.length-1;c>=0;c--){var l=a.blankNode();r+=t(l)+" "+t(o.sym(n+"first"))+" "+t(s[c])+".\n",r+=t(l)+" "+t(o.sym(n+"rest"))+" "+t(u)+".\n",u=l}return i.atomicTermToN3(u)},u=0;u=0&&(l+=s(c.why)+" "),r+=l+=".\n"}return r}},{key:"statementsToN3",value:function(t){var e=this.store,n={"http://www.w3.org/1999/02/22-rdf-syntax-ns#type":"aaa:00"};t.sort((function(t,r){return Q.heavyCompareSPO(t,r,e,n)})),this.base&&!this.defaultNamespace&&(this.defaultNamespace=this.base+"#");var i={};this.flags.indexOf("s")<0&&(i["http://www.w3.org/2002/07/owl#sameAs"]="="),this.flags.indexOf("t")<0&&(i["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]="a"),this.flags.indexOf("i")<0&&(i["http://www.w3.org/2000/10/swap/log#implies"]="=>");var o=function(t){for(var e="",r=0;r=0){n=n.slice(0,-1),"."==u&&"0123456789.:".includes(n.charAt(n.length-1))&&(n+=" ",i+=1),n+=u+"\n",i+=1;continue}if(i<4*r+4||i+u.length+1<80&&";.".indexOf(n[n.length-2])<0)n=n.slice(0,-1)+" "+u+"\n",i+=u.length+1;else{var h=o(4*r)+u;n+=h+"\n",i=h.length,r<0&&(n+="\n",i=1e5)}}}return n}(p)}},{key:"atomicTermToN3",value:function(t,e){switch(t.termType){case"BlankNode":case"Variable":return t.toNT();case"Literal":var r=t.value;if("string"!=typeof r)throw new TypeError("Value of RDF literal node must be a string");if(t.datatype&&this.flags.indexOf("x")<0)switch(t.datatype.uri){case"http://www.w3.org/2001/XMLSchema#integer":return r;case"http://www.w3.org/2001/XMLSchema#decimal":return r.indexOf(".")<0&&(r+=".0"),r;case"http://www.w3.org/2001/XMLSchema#double":var n=r.toLowerCase().indexOf("e")>0;return r.indexOf(".")<0&&!n&&(r+=".0"),n||(r+="e0"),r;case"http://www.w3.org/2001/XMLSchema#boolean":return"1"===t.value?"true":"false"}var i=this.stringToN3(t.value);return t.language?i+="@"+t.language:t.datatype.equals(this.xsd.string)||(i+="^^"+this.atomicTermToN3(t.datatype,e)),i;case"NamedNode":return this.symbolToN3(t);case"DefaultGraph":return"";default:throw new Error("Internal: atomicTermToN3 cannot handle "+t+" of termType: "+t.termType)}}},{key:"stringToN3",value:function(t,e){e||(e="e");var r,n,i,o,a,s="";for(t.length>20&&'"'!==t.slice(-1)&&e.indexOf("n")<0&&(t.indexOf("\n")>0||t.indexOf('"')>0)?(o='"""',a=this.forbidden3):(o='"',a=this.forbidden1),r=0;r=0?s+="\\"+'bfrtvn\\"'[i]:e.indexOf("e")>=0?s+="\\u"+("000"+u.charCodeAt(0).toString(16).toLowerCase()).slice(-4):s+=u,r=n+1}return o+s+t.slice(r)+o}},{key:"symbolToN3",value:function(t){var e=t.uri,r=e.indexOf("#");if(r<0&&this.flags.indexOf("/")<0&&(r=e.lastIndexOf("/")),r>=0&&this.flags.indexOf("p")<0&&(0===e.indexOf("http")||0===e.indexOf("ws")||0===e.indexOf("file"))){for(var n=!0,i=r+1;i=0){n=!1;break}if(n){var o=e.slice(r+1),a=e.slice(0,r+1);if(this.defaultNamespace&&this.defaultNamespace===a&&this.flags.indexOf("d")<0)return this.flags.indexOf("k")>=0&&this.keyords.indexOf(o)<0?o:":"+o;var s=this.prefixes[a];if(s||(s=this.makeUpPrefix(a)),s)return this.namespacesUsed[a]=!0,s+":"+o}}return this.explicitURI(e)}},{key:"writeStore",value:function(t){var e=this.store,r=e.fetcher,n=r&&r.appNode,i=this.store.index[3];for(var o in i){var a=e.fromNT(o);n&&a.equals(n)||t("\n"+this.atomicTermToN3(a)+" "+this.atomicTermToN3(e.sym("http://www.w3.org/2000/10/swap/log#semantics"))+" { "+this.statementsToN3(e.statementsMatching(void 0,void 0,void 0,a))+" }.\n")}e.statementsMatching(void 0,e.sym("http://www.w3.org/2007/ont/link#requestedURI")).map((function(r){t("\n<"+r.object.value+"> log:metadata {\n");var n=e.statementsMatching(void 0,void 0,void 0,r.subject);t(this.statementsToN3(this.statementsToN3(n))),t("}.\n")}));var s=[];n&&s.push(n);var u=[];s.map((function(t){u=u.concat(e.statementsMatching(void 0,void 0,void 0,t))})),t(this.statementsToN3(u))}},{key:"statementsToXML",value:function(t){var e=[];e["http://www.w3.org/1999/02/22-rdf-syntax-ns#"]=!0;var r="http://www.w3.org/1999/02/22-rdf-syntax-ns#_",n=function(t){for(var e="",r=0;r',u(o.object,e),""]):p.concat(["<"+i+' rdf:nodeID="'+o.object.toNT().slice(2)+'"/>']);break;case"NamedNode":p=p.concat(["<"+i+' rdf:resource="'+s(o.object)+'"/>']);break;case"Literal":p=p.concat(["<"+i+(o.object.datatype.equals(this.xsd.string)?"":' rdf:datatype="'+a(o.object.datatype.uri)+'"')+(o.object.language?' xml:lang="'+o.object.language+'"':"")+">"+a(o.object.value)+""]);break;case"Collection":p=p.concat(["<"+i+' rdf:parseType="Collection">',c(o.object,e),""]);break;default:throw new Error("Can't serialize object of type "+o.object.termType+" into XML")}}else n=o.object;var g=n?h(n):"rdf:Description",m="";return"BlankNode"===t.termType?e.incoming[t]&&1===e.incoming[t].length||(m=' rdf:nodeID="'+t.toNT().slice(2)+'"'):m=' rdf:about="'+s(t)+'"',["<"+g+m+">"].concat([p]).concat([""])}.bind(this);function c(t,e){for(var r=[],n=0;n',""]):r.concat(["<"+h(o.predicate)+' rdf:parseType="Resource">',l(o.object,e),""]);break;case"NamedNode":r=r.concat(["<"+h(o.predicate)+' rdf:resource="'+s(o.object)+'"/>']);break;case"Literal":r=r.concat(["<"+h(o.predicate)+(o.object.datatype.equals(this.xsd.string)?"":' rdf:datatype="'+a(o.object.datatype.value)+'"')+(o.object.language?' xml:lang="'+o.object.language+'"':"")+">"+a(o.object.value)+""]);break;case"Collection":r=r.concat(["<"+h(o.predicate)+' rdf:parseType="Collection">',c(o.object,e),""]);break;default:throw new Error("Can't serialize object of type "+o.object.termType+" into XML")}}return r}.bind(this),h=function(t){var r=t.uri,n=r.indexOf("#");if(n<0&&this.flags.indexOf("/")<0&&(n=r.lastIndexOf("/")),n<0)throw new Error("Cannot make qname out of <"+r+">");for(var i=n+1;i=0)throw new Error('Invalid character "'+r[i]+'" cannot be in XML qname for URI: '+r);var o=r.slice(n+1),a=r.slice(0,n+1);if(this.defaultNamespace&&this.defaultNamespace===a&&this.flags.indexOf("d")<0)return o;var s=this.prefixes[a];return s||(s=this.makeUpPrefix(a)),e[a]=!0,s+":"+o}.bind(this),f=o(t),p=""],-1)}},{key:"statementsToJsonld",value:function(t){var e=this.statementsToN3(t),r=K.parse(e);return JSON.stringify(r,null,2)}}])}();function nt(t,e,r,n,i,o){r=r||(null==t?void 0:t.value);var a=o||{};n=n||l.sT;try{var s=et(e);a.flags&&s.setFlags(a.flags);var u=e.statementsMatching(void 0,void 0,void 0,t);switch("namespaces"in e&&s.suggestNamespaces(e.namespaces),a.namespaces&&s.setNamespaces(a.namespaces),s.setBase(r),n){case l.JG:return c(null,s.statementsToXML(u));case l.ny:case l.MG:return c(null,s.statementsToN3(u));case l.sT:case l.hu:return s.setFlags("si"),c(null,s.statementsToN3(u));case l.bM:return s.setFlags("deinprstux"),c(null,s.statementsToNTriples(u));case l.i2:return s.setFlags("si dr"),c(null,s.statementsToJsonld(u));case l._0:case l.BR:return s.setFlags("deinprstux q"),c(null,s.statementsToNTriples(u));default:throw new Error("Serialize: Content-type "+n+" not supported for data write.")}}catch(t){if(i)return i(t,void 0);throw t}function c(t,e){return i?void i(t,e):e}}var it=["blankNode","defaultGraph","literal","namedNode","quad","variable","supports"],ot={first:"http://www.w3.org/1999/02/22-rdf-syntax-ns#first",rest:"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest",nil:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"};function at(t,e,r){var n=[];return r.reduce((function(e,r,i,o){var a;return n.push(t.quad(e,t.namedNode(ot.first),o[i])),i2&&void 0!==arguments[2]?arguments[2]:0,n=t.length;for(r<0&&(r=n+r);rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};(0,e.A)(this,n),(t=ct(this,n,[""])).statements=r,t.constraints=i,t.initBindings=s,t.optional=u,(0,o.A)(t,"termType",l.bD),(0,o.A)(t,"classOrder",a.A.Graph),(0,o.A)(t,"fetcher",void 0),(0,o.A)(t,"isVar",0),(0,o.A)(t,"ns",W),(0,o.A)(t,"rdfFactory",void 0),t.rdfFactory=c&&c.rdfFactory||G;var h,f=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return ut(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ut(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}(it);try{var p=function(){var e=h.value;t[e]=function(){var r;return(r=t.rdfFactory)[e].apply(r,arguments)}};for(f.s();!(h=f.n()).done;)p()}catch(t){f.e(t)}finally{f.f()}return t}return(0,i.A)(n,r),(0,t.A)(n,[{key:"add",value:function(t,e,r,n){var i=this;return 1===arguments.length&&t.forEach((function(t){return i.add(t.subject,t.predicate,t.object,t.graph)})),this.statements.push(this.rdfFactory.quad(t,e,r,n))}},{key:"addStatement",value:function(t){return this.add(t)}},{key:"bnode",value:function(t){return this.rdfFactory.blankNode(t)}},{key:"addAll",value:function(t){var e=this;t.forEach((function(t){e.add(t.subject,t.predicate,t.object,t.graph)}))}},{key:"any",value:function(t,e,r,n){var i=this.anyStatementMatching(t,e,r,n);return null==i?null:null==t?i.subject:null==e?i.predicate:null==r?i.object:null}},{key:"anyValue",value:function(t,e,r,n){var i=this.any(t,e,r,n);return i?i.value:void 0}},{key:"anyJS",value:function(t,e,r,n){var i=this.any(t,e,r,n);return i?c.A.toJS(i):void 0}},{key:"anyStatementMatching",value:function(t,e,r,n){var i=this.statementsMatching(t,e,r,n,!0);if(i&&0!==i.length)return i[0]}},{key:"id",value:function(t){return this.rdfFactory.id(t)}},{key:"statementsMatching",value:function(t,e,r,n,i){var o=this.statements.filter((function(i){return(!t||t.equals(i.subject))&&(!e||e.equals(i.predicate))&&(!r||r.equals(i.object))&&(!n||n.equals(i.graph))}));return i?0===o.length?[]:[o[0]]:o}},{key:"bottomTypeURIs",value:function(t){var e,r,n,i,o,a;for(var s in e=[],t)if(t.hasOwnProperty(s)){for(a=t[s],r=!0,n=0,i=(o=this.each(void 0,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),this.rdfFactory.namedNode(s))).length;n "+t[e]);return r}function o(t){var e,r="Bindings: ",n=t.length;for(e=0;ei.length)&&(e.index=i)}}return null===e.index&&(e.index=t.statements),!0}function f(t,e){return t.nvars!==e.nvars?t.nvars-e.nvars:t.index.length-e.index.length}l.prototype.reportMatch=function(t){this.results.push(t)},l.prototype.reportDone=function(){V.A.debug("Optional branch finished - results.length = "+this.results.length),0===this.results.length&&(this.results.push({}),V.A.debug("Optional branch FAILED - that's OK.")),this.done=!0,this.junction.checkAllDone()};var p=function t(r,n,o,a,s,c,h){V.A.debug("Match begins, Branch count now: "+h.count+" for "+h.pattern_debug);var f,p,d=n.statements;if(0===d.length){if(V.A.debug("FOUND MATCH WITH BINDINGS:"+i(o)),0===n.optional.length)h.reportMatch(o);else{V.A.debug("OPTIONAL: "+n.optional);var v,g=new u(e,o),m=[];for(v=0;v in query: "+u),t(r,n,o,a,s,c,h)}))};for(p=0;pt.length)&&(e=t.length);for(var r=0,n=new Array(e);r1&&void 0!==arguments[1]?arguments[1]:{};return(0,e.A)(this,n),r=wt(this,n,[void 0,void 0,void 0,void 0,i]),(0,o.A)(r,"updater",void 0),(0,o.A)(r,"namespaces",void 0),(0,o.A)(r,"classActions",void 0),(0,o.A)(r,"propertyActions",void 0),(0,o.A)(r,"redirections",void 0),(0,o.A)(r,"aliases",void 0),(0,o.A)(r,"HTTPRedirects",void 0),(0,o.A)(r,"subjectIndex",void 0),(0,o.A)(r,"predicateIndex",void 0),(0,o.A)(r,"objectIndex",void 0),(0,o.A)(r,"whyIndex",void 0),(0,o.A)(r,"index",void 0),(0,o.A)(r,"features",void 0),(0,o.A)(r,"_universalVariables",void 0),(0,o.A)(r,"_existentialVariables",void 0),(0,o.A)(r,"rdfArrayRemove",void 0),(0,o.A)(r,"dataCallbacks",void 0),r.propertyActions={},r.classActions={},r.redirections=[],r.aliases=[],r.HTTPRedirects=[],r.subjectIndex=[],r.predicateIndex=[],r.objectIndex=[],r.whyIndex=[],r.index=[r.subjectIndex,r.predicateIndex,r.objectIndex,r.whyIndex],r.namespaces={},r.features=t||[],r.rdfArrayRemove=i.rdfArrayRemove||Q.RDFArrayRemove,i.dataCallback&&(r.dataCallbacks=[i.dataCallback]),r.initPropertyActions(r.features),r}return(0,i.A)(n,r),(0,t.A)(n,[{key:"substitute",value:function(t){var e=this.statements.map((function(e){return e.substitute(t)})),r=new n;return r.add(e),r}},{key:"addDataCallback",value:function(t){this.dataCallbacks||(this.dataCallbacks=[]),this.dataCallbacks.push(t)}},{key:"applyPatch",value:function(t,e,r){var n,i=this,o=null;function a(a){if(t.delete){n=t.delete,o&&(n=n.substitute(o)),n=n.statements;var s=[],u=n.map((function(t){var r=i.statementsMatching(t.subject,t.predicate,t.object,e);return 0===r.length?(s.push(t),null):r[0]}));if(s.length)return r("Could not find to delete: "+s.join("\n or "));u.map((function(t){i.remove(t)}))}t.insert&&(n=t.insert,o&&(n=n.substitute(o)),(n=n.statements).map((function(t){t.graph=e,i.add(t.subject,t.predicate,t.object,t.graph)}))),a()}if(t.where){var s=new yt("patch");s.pat=t.where,s.pat.statements.map((function(t){t.graph=Cr(e.value)})),s.sync=!0;var u=[];i.query(s,(function(t){u.push(t)}),i.fetcher,(function(){return 0===u.length?r("No match found to be patched:"+t.where):u.length>1?r("Patch ambiguous. No patch done."):(o=u[0],void a(r))}))}else a(r)}},{key:"declareExistential",value:function(t){return this._existentialVariables||(this._existentialVariables=[]),this._existentialVariables.push(t),t}},{key:"initPropertyActions",value:function(t){this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"))]=[Tt],st(t,"sameAs")>=0&&(this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode("".concat(xt,"sameAs")))]=[function(t,e,r,n,i){return t.equate(e,n),!0}]),st(t,"InverseFunctionalProperty")>=0&&(this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode("".concat(xt,"InverseFunctionalProperty")))]=[function(t,e,r,n,i){return t.newPropertyAction(e,kt)}]),st(t,"FunctionalProperty")>=0&&(this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode("".concat(xt,"FunctionalProperty")))]=[function(t,e,r,n,i){return t.newPropertyAction(e,_t)}])}},{key:"addStatement",value:function(t){return this.add(t.subject,t.predicate,t.object,t.graph),this.statements.length}},{key:"add",value:function(t,e,r,n){var i,o,a;if(1===arguments.length){if(t instanceof Array)for(i=0;i=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}(this.dataCallbacks);try{for(d.s();!(p=d.n()).done;)(0,p.value)(a)}catch(t){d.e(t)}finally{d.f()}}return a}},{key:"canon",value:function(t){if(!t)return t;var e=this.redirections[this.id(t)];if(e)return e;switch(t.termType){case l.$Q:return new p(t.value);case l.r0:return t;case l.ic:return new F;case l.S:case l.bD:return t;case l.QW:return new w(t.value,t.language,t.datatype);case l.Kk:return new y.A(t.value);case l.P2:return new H(t.value);default:throw new Error("Term Type not recognized for canonization: ".concat(t.termType))}}},{key:"check",value:function(){this.checkStatementList(this.statements);for(var t=0;t<4;t++){var e=this.index[t];for(var r in e)e.hasOwnProperty(r)&&this.checkStatementList(e[r],t)}}},{key:"checkStatementList",value:function(t,e){void 0===e&&(e=0);for(var r,n=" found in "+["subject","predicate","object","why"][e]+" index.",i=0;ia.A[e.termType]?1:t.valuee.value?1:0}},{key:"copyTo",value:function(t,e,r){r||(r=[]);var n=this.statementsMatching(t);-1!==st(r,"two-direction")&&n.concat(this.statementsMatching(void 0,void 0,t));for(var i=0;i";return!!this.subjectIndex[e]||!!this.objectIndex[e]||!!this.predicateIndex[e]}},{key:"newExistential",value:function(t){if(!t)return this.bnode();var e=this.sym(t);return this.declareExistential(e)}},{key:"newPropertyAction",value:function(t,e){var r=this.id(t);this.propertyActions[r]||(this.propertyActions[r]=[]),this.propertyActions[r].push(e);for(var n=this.statementsMatching(void 0,t,void 0),i=!1,o=0;o1&&(a=a.slice(0,1)),a||[];var f,p,d=1e10;for(p=0;p=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function jt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0)throw"missing.js: oops nnonempty dict not imp";return[]},Ft=function(t){return t.length},Ut=function(t,e,r){if(void 0===t.slice)throw"@@ mising.js: No .slice function for "+t+" of type "+(0,d.A)(t);return void 0===r||null==r?t.slice(e):t.slice(e,r)},Dt=Error("dummy error stop iteration"),Lt=function(t){return this.last=0,this.li=t,this.next=function(){if(this.last==this.li.length)throw Dt;return this.li[this.last++]},this},Mt=function(t,e){return t.indexOf(e)},Bt=function(t,e){if(!t){if(e)throw"python Assertion failed: "+e;throw"(python) Assertion failed."}};String.prototype.encode=function(t){if("utf-8"!=t)throw"UTF8_converter: can only do utf-8";return function(t){t=t.replace(/\r\n/g,"\n");for(var e="",r=0;r127&&n<2048?(e+=String.fromCharCode(n>>6|192),e+=String.fromCharCode(63&n|128)):(e+=String.fromCharCode(n>>12|224),e+=String.fromCharCode(n>>6&63|128),e+=String.fromCharCode(63&n|128))}return e}(this)},String.prototype.decode=function(t){if("utf-8"!=t)throw"UTF8_converter: can only do utf-8";return this};var qt=function(t,e){return M.join(e,t)},Ht="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil",$t="http://www.w3.org/2002/07/owl#sameAs",zt="\t\r\n !\"#$%&'()*.,+/;<=>?@[\\]^`{|}~",Xt=zt+":",Gt=new RegExp("^([-+]?[0-9]+)(\\.[0-9]+)?(e[-+]?[0-9]+)?","g"),Vt=new RegExp("^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9](T[0-9][0-9]:[0-9][0-9](:[0-9][0-9](\\.[0-9]*)?)?)?Z?"),Wt=new RegExp('[\\\\\\r\\n\\"]',"g"),Qt=new RegExp("^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*","g");const Yt=function(t,e,r,n,i,o,a,s){return new Jt(t,e,r,n,i,o,a,s)};var Jt=function(){return(0,t.A)((function t(r,n,i,o,a,s,u,c){(0,e.A)(this,t),void 0===n&&(n=null),void 0===i&&(i=""),void 0===o&&(o=null),void 0===a&&(a=""),void 0===s&&(s=null),void 0===u&&(u=""),void 0===c&&(c=null),this._bindings=new Pt([]),this._flags=u,""!=i&&(Bt(i.indexOf(":")>=0,"Document URI not absolute: "+i),this._bindings[""]=i+"#"),this._store=r,a&&r.setGenPrefix(a),this._thisDoc=i,this.source=r.sym(i),this.lines=0,this.statementCount=0,this.hasNil=!1,this.startOfLine=0,this.previousLine=0,this._genPrefix=a,this.keywords=new Ct(["a","this","bind","has","is","of","true","false"]),this.keywordsSet=0,this._anonymousNodes=new Pt([]),this._variables=new Pt([]),this._parentVariables=new Pt([]),this._reason=c,this._reason2=null,this._baseURI=o||i||null,Bt(!this._baseURI||this._baseURI.indexOf(":")>=0),this._genPrefix||(this._thisDoc?this._genPrefix=this._thisDoc+"#_g":this._genPrefix=RDFSink_uniqueURI()),null==n?this._thisDoc?this._formula=r.formula(i+"#_formula"):this._formula=r.formula():this._formula=n,this._context=this._formula,this._parentContext=null}),[{key:"here",value:function(t){return this._genPrefix+"_L"+this.lines+"C"+(t-this.startOfLine+1)}},{key:"formula",value:function(){return this._formula}},{key:"loadStream",value:function(t){return this.loadBuf(t.read())}},{key:"loadBuf",value:function(t){return this.startDoc(),this.feed(t),this.endDoc()}},{key:"feed",value:function(t){for(var e=t.decode("utf-8"),r=0;r>=0;){var n=this.skipSpace(e,r);if(n<0)return;if((r=this.directiveOrStatement(e,n))<0)throw Zt(this._thisDoc,this.lines,e,n,"expected directive or statement")}}},{key:"directiveOrStatement",value:function(t,e){var r,n=this.skipSpace(t,e);return n<0?n:(r=this.directive(t,n))>=0||(r=this.statement(t,n))>=0?this.checkDot(t,r):r}},{key:"tok",value:function(t,e,r){if("@"==e.slice(r,r+1))r+=1;else if(st(this.keywords,t)<0)return-1;var n=r+Ft(t);return e.slice(r,n)==t&&zt.indexOf(e.charAt(n))>=0?n:-1}},{key:"directive",value:function(t,e){if((o=this.skipSpace(t,e))<0)return o;var r=new Ct([]);if((o=this.tok("bind",t,e))>0)throw Zt(this._thisDoc,this.lines,t,e,"keyword bind is obsolete: use @prefix");if((o=this.tok("keywords",t,e))>0){if((e=this.commaSeparatedList(t,o,r,!1))<0)throw Zt(this._thisDoc,this.lines,t,e,"'@keywords' needs comma separated list of words");return this.setKeywords(Ut(r,null,null)),e}if((o=this.tok("forAll",t,e))>0){if((e=this.commaSeparatedList(t,o,r,!0))<0)throw Zt(this._thisDoc,this.lines,t,e,"Bad variable list after @forAll");var n=new Lt(r);try{for(;;){var i=n.next();(st(this._variables,i)<0||st(this._parentVariables,i)>=0)&&(this._variables[i]=this._context.newUniversal(i))}}catch(t){if(t!=Dt)throw t}return e}if((o=this.tok("forSome",t,e))>0){if((e=this.commaSeparatedList(t,o,r,this.uri_ref2))<0)throw Zt(this._thisDoc,this.lines,t,e,"Bad variable list after @forSome");n=new Lt(r);try{for(;;)i=n.next(),this._context.declareExistential(i)}catch(t){if(t!=Dt)throw t}return e}if((o=this.tok("prefix",t,e))>=0){var o,a=new Ct([]);if((e=this.qname(t,o,a))<0)throw Zt(this._thisDoc,this.lines,t,o,"expected qname after @prefix");if((o=this.uri_ref2(t,e,a))<0)throw Zt(this._thisDoc,this.lines,t,e,"expected after @prefix _qname_");var s=a[1].uri;return this._baseURI?s=qt(this._baseURI,s):Bt(s.indexOf(":")>=0,"With no base URI, cannot handle relative URI for NS"),Bt(s.indexOf(":")>=0),this._bindings[a[0][0]]=s,this.bind(a[0][0],function(t){return encodeURI(t)}(s)),o}if((o=this.tok("base",t,e))>=0){if(a=new Ct([]),(e=this.uri_ref2(t,o,a))<0)throw Zt(this._thisDoc,this.lines,t,o,"expected after @base ");if(s=a[0].uri,!this._baseURI)throw Zt(this._thisDoc,this.lines,t,o,"With no previous base URI, cannot use relative URI in @base <"+s+">");return s=qt(this._baseURI,s),Bt(s.indexOf(":")>=0),this._baseURI=s,e}return-1}},{key:"bind",value:function(t,e){""==t||this._store.setPrefixForURI(t,e)}},{key:"setKeywords",value:function(t){null==t?this.keywordsSet=0:(this.keywords=t,this.keywordsSet=1)}},{key:"startDoc",value:function(){}},{key:"endDoc",value:function(){return this.hasNil&&this._store.rdfFactory.supports.COLLECTIONS&&St(this._store,this.source),this._formula}},{key:"makeStatement",value:function(t){t[0].add(t[2],t[1],t[3],this.source),(t[2].uri&&t[2].uri===Ht||t[3].uri&&t[3].uri===Ht)&&(this.hasNil=!0),this.statementCount+=1}},{key:"statement",value:function(t,e){var r=new Ct([]);if((e=this.object(t,e,r))<0)return e;var n=this.property_list(t,e,r[0]);if(n<0)throw Zt(this._thisDoc,this.lines,t,e,"expected propertylist");return n}},{key:"subject",value:function(t,e,r){return this.item(t,e,r)}},{key:"verb",value:function(t,e,r){if((i=this.skipSpace(t,e))<0)return i;var n=new Ct([]);if((i=this.tok("has",t,e))>=0){if((e=this.prop(t,i,n))<0)throw Zt(this._thisDoc,this.lines,t,i,"expected property after 'has'");return r.push(new It(["->",n[0]])),e}if((i=this.tok("is",t,e))>=0){if((e=this.prop(t,i,n))<0)throw Zt(this._thisDoc,this.lines,t,i,"expected after 'is'");if((i=this.skipSpace(t,e))<0)throw Zt(this._thisDoc,this.lines,t,e,"End of file found, expected property after 'is'");var i;if(e=i,(i=this.tok("of",t,e))<0)throw Zt(this._thisDoc,this.lines,t,e,"expected 'of' after 'is' ");return r.push(new It(["<-",n[0]])),i}if((i=this.tok("a",t,e))>=0)return r.push(new It(["->",this._store.sym("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")])),i;if("<="==t.slice(e,e+2))return r.push(new It(["<-",this._store.sym(Rt+"implies")])),e+2;if("="==t.slice(e,e+1))return">"==t.slice(e+1,e+2)?(r.push(new It(["->",this._store.sym(Rt+"implies")])),e+2):(r.push(new It(["->",this._store.sym($t)])),e+1);if(":="==t.slice(e,e+2))return r.push(new It(["->",Rt+"becomes"])),e+2;if((i=this.prop(t,e,n))>=0)return r.push(new It(["->",n[0]])),i;if(">-"==t.slice(e,e+2)||"<-"==t.slice(e,e+2))throw Zt(this._thisDoc,this.lines,t,i,">- ... -> syntax is obsolete.");return-1}},{key:"prop",value:function(t,e,r){return this.item(t,e,r)}},{key:"item",value:function(t,e,r){return this.path(t,e,r)}},{key:"blankNode",value:function(t){return this._context.bnode(t,this._reason2)}},{key:"path",value:function(t,e,r){if((o=this.nodeOrLiteral(t,e,r))<0)return o;for(;"!^.".indexOf(t.slice(o,o+1))>=0;){var n=t.slice(o,o+1);if("."==n){var i=t.slice(o+1,o+2);if(!i||Xt.indexOf(i)>=0&&":?<[{(".indexOf(i)<0)break}var o,a=r.pop(),s=this.blankNode(this.here(o));if((o=this.node(t,o+1,r))<0)throw Zt(this._thisDoc,this.lines,t,o,"EOF found in middle of path syntax");var u=r.pop();"^"==n?this.makeStatement(new It([this._context,u,s,a])):this.makeStatement(new It([this._context,u,a,s])),r.push(s)}return o}},{key:"anonymousNode",value:function(t){if(e=this._anonymousNodes[t])return e;var e=this._store.bnode(t);return this._anonymousNodes[t]=e,e}},{key:"node",value:function(t,e,r,n){void 0===n&&(n=null);var i=n;if((l=this.skipSpace(t,e))<0)return l;e=l;var o=t.slice(e,e+1);if("["==o){var a=this.here(e);if((l=this.skipSpace(t,e+1))<0)throw Zt(this._thisDoc,this.lines,t,e,"EOF after '['");if("="==t.slice(l,l+1)){e=l+1;var s=new Ct([]);if(!((l=this.objectList(t,e,s))>=0))throw Zt(this._thisDoc,this.lines,t,e,"objectList expected after [= ");if(i=s[0],Ft(s)>1){var u=new Lt(s);try{for(;;){var c=u.next();this.makeStatement(new It([this._context,this._store.sym($t),i,c]))}}catch(t){if(t!=Dt)throw t}}if((l=this.skipSpace(t,l))<0)throw Zt(this._thisDoc,this.lines,t,e,"EOF when objectList expected after [ = ");if(";"==t.slice(l,l+1))var l=l+1}if(null==i&&(i=this.blankNode(a)),(e=this.property_list(t,l,i))<0)throw Zt(this._thisDoc,this.lines,t,l,"property_list expected");if((l=this.skipSpace(t,e))<0)throw Zt(this._thisDoc,this.lines,t,e,"EOF when ']' expected after [ ");if("]"!=t.slice(l,l+1))throw Zt(this._thisDoc,this.lines,t,l,"']' expected");return r.push(i),l+1}if("{"==o){if("$"==t.slice(e+1,e+2)){l=(e+=1)+1;for(var h=new Ct([]),f=!0;;){if((e=this.skipSpace(t,l))<0)throw Zt(this._thisDoc,this.lines,t,e,"needed '$}', found end.");if("$}"==t.slice(e,e+2)){l=e+2;break}if(f)f=!1;else{if(","!=t.slice(e,e+1))throw Zt(this._thisDoc,this.lines,t,e,"expected: ','");e+=1}var p=new Ct([]);if((l=this.item(t,e,p))<0)throw Zt(this._thisDoc,this.lines,t,e,"expected item in set or '$}'");h.push(p[0])}return r.push(this._store.newSet(h,this._context)),l}l=e+1;var d=this._parentContext;this._parentContext=this._context;var y=this._anonymousNodes,v=this._parentVariables;this._parentVariables=this._variables,this._anonymousNodes=new Pt([]),this._variables=this._variables.slice();var g=this._reason2;for(this._reason2=null,null==i&&(i=this._store.formula()),this._context=i;;){if((e=this.skipSpace(t,l))<0)throw Zt(this._thisDoc,this.lines,t,e,"needed '}', found end.");if("}"==t.slice(e,e+1)){l=e+1;break}if((l=this.directiveOrStatement(t,e))<0)throw Zt(this._thisDoc,this.lines,t,e,"expected statement or '}'")}return this._anonymousNodes=y,this._variables=this._parentVariables,this._parentVariables=v,this._context=this._parentContext,this._reason2=g,this._parentContext=d,r.push(i.close()),l}if("("==o){var m=this._store.list;for("$"==t.slice(e+1,e+2)&&(m=this._store.newSet,e+=1),l=e+1,h=new Ct([]);;){if((e=this.skipSpace(t,l))<0)throw Zt(this._thisDoc,this.lines,t,e,"needed ')', found end.");if(")"==t.slice(e,e+1)){l=e+1;break}if(p=new Ct([]),(l=this.item(t,e,p))<0)throw Zt(this._thisDoc,this.lines,t,e,"expected item in list or ')'");h.push(p[0])}return r.push(m(h,this._context)),l}if((l=this.tok("this",t,e))>=0)throw Zt(this._thisDoc,this.lines,t,e,"Keyword 'this' was ancient N3. Now use @forSome and @forAll keywords.");return(l=this.tok("true",t,e))>=0?(r.push(!0),l):(l=this.tok("false",t,e))>=0?(r.push(!1),l):null==i&&(l=this.uri_ref2(t,e,r))>=0?l:-1}},{key:"property_list",value:function(t,e,r){for(;;){if((l=this.skipSpace(t,e))<0)throw Zt(this._thisDoc,this.lines,t,e,"EOF found when expected verb in property list");if(":-"!=t.slice(l,l+2)){e=l;var n=new Ct([]);if((l=this.verb(t,e,n))<=0)return e;var i=new Ct([]);if((e=this.objectList(t,l,i))<0)throw Zt(this._thisDoc,this.lines,t,l,"objectList expected");var o=new Lt(i);try{for(;;){var a=o.next(),s=n[0],u=s[0],c=s[1];"->"==u?this.makeStatement(new It([this._context,c,r,a])):this.makeStatement(new It([this._context,c,a,r]))}}catch(t){if(t!=Dt)throw t}if((l=this.skipSpace(t,e))<0)throw Zt(this._thisDoc,this.lines,t,l,"EOF found in list of objects");if(";"!=t.slice(e,e+1))return e;e+=1}else{e=l+2;var l,h=new Ct([]);if((l=this.node(t,e,h,r))<0)throw Zt(this._thisDoc,this.lines,t,e,"bad {} or () or [] node after :- ");e=l}}}},{key:"commaSeparatedList",value:function(t,e,r,n){if((i=this.skipSpace(t,e))<0)throw Zt(this._thisDoc,this.lines,t,i,"EOF found expecting comma sep list");if("."==t.charAt(i))return e;if(n)var i=this.uri_ref2(t,i,r);else i=this.bareWord(t,i,r);if(i<0)return-1;for(;;){if((e=this.skipSpace(t,i))<0)return e;var o=t.slice(e,e+1);if(","!=o)return"."!=o?-1:e;if((i=n?this.uri_ref2(t,e+1,r):this.bareWord(t,e+1,r))<0)throw Zt(this._thisDoc,this.lines,t,i,"bad list content")}}},{key:"objectList",value:function(t,e,r){if((e=this.object(t,e,r))<0)return-1;for(;;){var n=this.skipSpace(t,e);if(n<0)throw Zt(this._thisDoc,this.lines,t,n,"EOF found after object");if(","!=t.slice(n,n+1))return n;if((e=this.object(t,n+1,r))<0)return e}}},{key:"checkDot",value:function(t,e){var r=this.skipSpace(t,e);if(r<0)return r;if("."==t.slice(r,r+1))return r+1;if("}"==t.slice(r,r+1))return r;if("]"==t.slice(r,r+1))return r;throw Zt(this._thisDoc,this.lines,t,r,"expected '.' or '}' or ']' at end of statement")}},{key:"uri_ref2",value:function(t,e,r){var n=new Ct([]);if((f=this.qname(t,e,n))>=0){var i=n[0],o=i[0],a=i[1];if(null==o){Bt(0,"not used?");var s=this._baseURI+"#"}else if(!(s=this._bindings[o])){if("_"==o)return r.push(this.anonymousNode(a)),f;throw Zt(this._thisDoc,this.lines,t,e,"Prefix "+o+" not bound.")}var u=this._store.sym(s+a);return st(this._variables,u)>=0?r.push(this._variables[u]):r.push(u),f}if((e=this.skipSpace(t,e))<0)return-1;if("?"==t.charAt(e)){var c=new Ct([]);return(f=this.variable(t,e,c))>0?(r.push(c[0]),f):-1}if("<"==t.charAt(e)){for(var l=e+=1;e"==t.charAt(e)){var h=t.slice(l,e);return this._baseURI?h=qt(this._baseURI,h):Bt(h.indexOf(":")>=0,"With no base URI, cannot deal with relative URIs"),"#"==t.slice(e-1,e)&&"#"!=Ut(h,-1,null)&&(h+="#"),u=this._store.sym(h),st(this._variables,u)>=0?r.push(this._variables[u]):r.push(u),e+1}e+=1}throw Zt(this._thisDoc,this.lines,t,f,"unterminated URI reference")}if(this.keywordsSet){var f;if(c=new Ct([]),(f=this.bareWord(t,e,c))<0)return-1;if(st(this.keywords,c[0])>=0)throw Zt(this._thisDoc,this.lines,t,e,'Keyword "'+c[0]+'" not allowed here.');return r.push(this._store.sym(this._bindings[""]+c[0])),f}return-1}},{key:"skipSpace",value:function(t,e){for(var r=e||0;r=0)throw Zt(this._thisDoc,this.lines,t,n,"Varible name can't start with '"+t.charAt(n)+"s'");for(;e=0)return-1;if(Xt.indexOf(i)>=0)return-1;for(e=n;e=0)return-1;if(Xt.indexOf(n)<0){var i=n;for(e+=1;e=0)return a;if((a=this.skipSpace(t,e))<0)return-1;e=a;var n=null,i=t.charAt(e);if('"'==i||"'"==i){n=t.slice(e,e+3==i+i)?i+i+i:i,e+=Ft(n);var o=this.strconst(t,e,n),a=o[0],s=o[1];return r.push(this._store.literal(s)),a}return-1}},{key:"nodeOrLiteral",value:function(t,e,r){if((u=this.node(t,e,r))>=0)return u;if((u=this.skipSpace(t,e))<0)return-1;e=u;var n=t.charAt(e);if("-+0987654321".indexOf(n)>=0){if(Vt.lastIndex=0,null!=(h=Vt.exec(t.slice(e))))u=e+(i=h[0]).length,i.indexOf("T")>=0?r.push(this._store.literal(i,this._store.sym("http://www.w3.org/2001/XMLSchema#dateTime"))):r.push(this._store.literal(i,this._store.sym("http://www.w3.org/2001/XMLSchema#date")));else{var i;if(Gt.lastIndex=0,null==(h=Gt.exec(t.slice(e))))throw Zt(this._thisDoc,this.lines,t,e,"Bad number or date syntax");u=e+Gt.lastIndex,(i=t.slice(e,u)).indexOf("e")>=0?r.push(this._store.literal(parseFloat(i),this._store.sym("http://www.w3.org/2001/XMLSchema#double"))):t.slice(e,u).indexOf(".")>=0?r.push(this._store.literal(parseFloat(i),this._store.sym("http://www.w3.org/2001/XMLSchema#decimal"))):r.push(this._store.literal(parseInt(i),this._store.sym("http://www.w3.org/2001/XMLSchema#integer")))}return u}if('"'==t.charAt(e)){if('"""'==t.slice(e,e+3))var o='"""';else o='"';e+=Ft(o);var a=null,s=this.strconst(t,e,o),u=s[0],c=s[1],l=null;if("@"==t.slice(u,u+1)){var h;if(Qt.lastIndex=0,null==(h=Qt.exec(t.slice(u+1))))throw Zt(this._thisDoc,startline,t,e,"Bad language code syntax on string literal, after @");e=Qt.lastIndex+u+1,l=t.slice(u+1,e),u=e}if("^^"==t.slice(u,u+2)){var f=new Ct([]);u=this.uri_ref2(t,u+2,f),a=f[0]}return r.push(this._store.literal(c,l||a)),u}return-1}},{key:"strconst",value:function(t,e,r){for(var n=e,i="",o=this.lines;n=0)i+='a\b\f\r\t\v\n\\"'.charAt(a),n+=1;else if("u"==u)n=(s=this.uEscape(t,n+1,o))[0],i+=u=s[1];else{if("U"!=u)throw Zt(this._thisDoc,this.lines,t,e,"bad escape");var s,u;n=(s=this.UEscape(t,n+1,o))[0],i+=u=s[1]}}}else n=e+1;else n=e}else i=i+'"',n=n+1}throw Zt(this._thisDoc,this.lines,t,e,"unterminated string literal")}},{key:"uEscape",value:function(t,e,r){for(var n=e,i=0,o=0;i<4;){var a=t.slice(n,n+1).toLowerCase();if(n+=1,""==a)throw Zt(this._thisDoc,r,t,e,"unterminated string literal(3)");var s=Mt("0123456789abcdef",a);if(s<0)throw Zt(this._thisDoc,r,t,e,"bad string literal hex escape");o=16*o+s,i+=1}var u=String.fromCharCode(o);return new It([n,u])}},{key:"UEscape",value:function(t,e,r){for(var n=e,i=0,o="\\U";i<8;){var a=t.slice(n,n+1).toLowerCase();if(n+=1,""==a)throw Zt(this._thisDoc,r,t,e,"unterminated string literal(3)");if(Mt("0123456789abcdef",a)<0)throw Zt(this._thisDoc,r,t,e,"bad string literal hex escape");o+=a,i+=1}var s,u=(s="0x"+Ut(o,2,10)-0,String.fromCharCode(s));return new It([n,u])}}])}();function Zt(t,e,r,n,i){var o=e+1,a="Line "+o+" of <"+t+">: Bad syntax: "+i+'\nat: "'+r.slice(n,n+30)+'"',s=new SyntaxError(a,t,o);return s.lineNo=o,s.characterInFile=n,s.syntaxProblem=i,s}function Kt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function te(t){for(var e=1;e\\"\{\}\|\^\`]/,be={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},we=/$0^/;class Ae{constructor(t){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,t=t||{},this._lineMode=!!t.lineMode){this._n3Mode=!1;for(const t in this)!(t in be)&&this[t]instanceof RegExp&&(this[t]=we)}else this._n3Mode=!1!==t.n3;this._comments=!!t.comments,this._literalClosingPos=0}_tokenizeToEnd(t,e){let r=this._input,n=r.length;for(;;){let t,a;for(;t=this._newline.exec(r);)this._comments&&(a=this._comment.exec(t[0]))&&i("comment",a[1],"",this._line,t[0].length),r=r.substr(t[0].length,r.length),n=r.length,this._line++;if(!t&&(t=this._whitespace.exec(r))&&(r=r.substr(t[0].length,r.length)),this._endOfFile.test(r))return e&&(this._comments&&(a=this._comment.exec(r))&&i("comment",a[1],"",this._line,r.length),r=null,i("eof","","",this._line,0)),this._input=r;const s=this._line,u=r[0];let c="",l="",h="",f=null,p=0,d=!1;switch(u){case"^":if(r.length<3)break;if("^"!==r[1]){this._n3Mode&&(p=1,c="^");break}if(this._previousMarker="^^",r=r.substr(2),"<"!==r[0]){d=!0;break}case"<":if(f=this._unescapedIri.exec(r))c="IRI",l=f[1];else if(f=this._iri.exec(r)){if(l=this._unescape(f[1]),null===l||me.test(l))return o(this);c="IRI"}else r.length>1&&"<"===r[1]?(c="<<",p=2):this._n3Mode&&r.length>1&&"="===r[1]&&(c="inverse",p=2,l=">");break;case">":r.length>1&&">"===r[1]&&(c=">>",p=2);break;case"_":((f=this._blank.exec(r))||e&&(f=this._blank.exec(`${r} `)))&&(c="blank",h="_",l=f[1]);break;case'"':if(f=this._simpleQuotedString.exec(r))l=f[1];else if(({value:l,matchLength:p}=this._parseLiteral(r)),null===l)return o(this);null===f&&0===p||(c="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(f=this._simpleApostropheString.exec(r))l=f[1];else if(({value:l,matchLength:p}=this._parseLiteral(r)),null===l)return o(this);null===f&&0===p||(c="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(f=this._variable.exec(r))&&(c="var",l=f[0]);break;case"@":"literal"===this._previousMarker&&(f=this._langcode.exec(r))?(c="langcode",l=f[1]):(f=this._keyword.exec(r))&&(c=f[0]);break;case".":if(1===r.length?e:r[1]<"0"||r[1]>"9"){c=".",p=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(f=this._number.exec(r)||e&&(f=this._number.exec(`${r} `)))&&(c="literal",l=f[0],h="string"==typeof f[1]?ye.double:"string"==typeof f[2]?ye.decimal:ye.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(f=this._sparqlKeyword.exec(r))?c=f[0].toUpperCase():d=!0;break;case"f":case"t":(f=this._boolean.exec(r))?(c="literal",l=f[0],h=ye.boolean):d=!0;break;case"a":(f=this._shortPredicates.exec(r))?(c="abbreviation",l="a"):d=!0;break;case"=":this._n3Mode&&r.length>1&&(c="abbreviation",">"!==r[1]?(p=1,l="="):(p=2,l=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(p=1,c=u);break;case"{":!this._lineMode&&r.length>=2&&("|"===r[1]?(c="{|",p=2):(c=u,p=1));break;case"|":r.length>=2&&"}"===r[1]&&(c="|}",p=2);break;default:d=!0}if(d&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(f=this._prefix.exec(r))?((f=this._prefixed.exec(r))||e&&(f=this._prefixed.exec(`${r} `)))&&(c="prefixed",h=f[1]||"",l=this._unescape(f[2])):(c="prefix",l=f[1]||"")),"^^"===this._previousMarker)switch(c){case"prefixed":c="type";break;case"IRI":c="typeIRI";break;default:c=""}if(!c)return e||!/^'''|^"""/.test(r)&&/\n|\r/.test(r)?o(this):this._input=r;const y=p||f[0].length,v=i(c,l,h,s,y);this.previousToken=v,this._previousMarker=c,r=r.substr(y,r.length)}function i(e,i,o,a,s){const u=r?n-r.length:n,c={type:e,value:i,prefix:o,line:a,start:u,end:u+s};return t(null,c),c}function o(e){t(e._syntaxError(/^\S*/.exec(r)[0]))}}_unescape(t){let e=!1;const r=t.replace(ve,((t,r,n,i)=>{if("string"==typeof r)return String.fromCharCode(Number.parseInt(r,16));if("string"==typeof n){let t=Number.parseInt(n,16);return t<=65535?String.fromCharCode(Number.parseInt(n,16)):String.fromCharCode(55296+((t-=65536)>>10),56320+(1023&t))}return i in ge?ge[i]:(e=!0,"")}));return e?null:r}_parseLiteral(t){if(t.length>=3){const e=t.match(/^(?:"""|"|'''|'|)/)[0],r=e.length;let n=Math.max(this._literalClosingPos,r);for(;(n=t.indexOf(e,n))>0;){let e=0;for(;"\\"===t[n-e-1];)e++;if(e%2==0){const e=t.substring(r,n),i=e.split(/\r\n|\r|\n/).length-1,o=n+r;if(1===r&&0!==i||3===r&&this._lineMode)break;return this._line+=i,{value:this._unescape(e),matchLength:o}}n++}this._literalClosingPos=t.length-r+1}return{value:"",matchLength:0}}_syntaxError(t){this._input=null;const e=new Error(`Unexpected "${t}" on line ${this._line}.`);return e.context={token:void 0,line:this._line,previousToken:this.previousToken},e}_readStartingBom(t){return t.startsWith("\ufeff")?t.substr(1):t}tokenize(t,e){if(this._line=1,"string"==typeof t){if(this._input=this._readStartingBom(t),"function"!=typeof e){const t=[];let e;if(this._tokenizeToEnd(((r,n)=>r?e=r:t.push(n)),!0),e)throw e;return t}ce()((()=>this._tokenizeToEnd(e,!0)))}else this._pendingBuffer=null,"function"==typeof t.setEncoding&&t.setEncoding("utf8"),t.on("data",(t=>{null!==this._input&&0!==t.length&&(this._pendingBuffer&&(t=de.concat([this._pendingBuffer,t]),this._pendingBuffer=null),128&t[t.length-1]?this._pendingBuffer=t:(void 0===this._input?this._input=this._readStartingBom("string"==typeof t?t:t.toString()):this._input+=t,this._tokenizeToEnd(e,!1)))})),t.on("end",(()=>{"string"==typeof this._input&&this._tokenizeToEnd(e,!0)})),t.on("error",e)}}const{rdf:xe,xsd:_e}=pe;let ke,Te=0;const Ee={namedNode:function(t){return new je(t)},blankNode:function(t){return new Se(t||"n3-"+Te++)},variable:function(t){return new Re(t)},literal:function(t,e){if("string"==typeof e)return new Ne(`"${t}"@${e.toLowerCase()}`);let r=e?e.value:"";return""===r&&("boolean"==typeof t?r=_e.boolean:"number"==typeof t&&(Number.isFinite(t)?r=Number.isInteger(t)?_e.integer:_e.double:(r=_e.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),""===r||r===_e.string?new Ne(`"${t}"`):new Ne(`"${t}"^^${r}`)},defaultGraph:function(){return ke},quad:Ce,triple:Ce};class Oe{constructor(t){this.id=t}get value(){return this.id}equals(t){return t instanceof Oe?this.id===t.id:!!t&&this.termType===t.termType&&this.value===t.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}class je extends Oe{get termType(){return"NamedNode"}}class Ne extends Oe{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const t=this.id;let e=t.lastIndexOf('"')+1;return enull),this._blankNodePrefix="string"!=typeof t.blankNodePrefix?"":t.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=t.lexer||new Ae({lineMode:s,n3:a}),this._explicitQuantifiers=!!t.explicitQuantifiers}static _resetBlankNodePrefix(){Pe=0}_setBase(t){if(t){const e=t.indexOf("#");e>=0&&(t=t.substr(0,e)),this._base=t,this._basePath=t.indexOf("/")<0?t:t.replace(/[^\/?]*(?:\?.*)?$/,""),t=t.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=t[0],this._baseScheme=t[1]}else this._base="",this._basePath=""}_saveContext(t,e,r,n,i){const o=this._n3Mode;this._contextStack.push({type:t,subject:r,predicate:n,object:i,graph:e,inverse:!!o&&this._inversePredicate,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(t,e){const r=this._contextStack.pop();if(!r||r.type!==t)return this._error(`Unexpected ${e.type}`,e);this._subject=r.subject,this._predicate=r.predicate,this._object=r.object,this._graph=r.graph,this._n3Mode&&(this._inversePredicate=r.inverse,this._prefixes._=r.blankPrefix,this._quantified=r.quantified)}_readInTopContext(t){switch(t.type){case"eof":return null!==this._graph?this._error("Unclosed graph",t):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(t)}}_readEntity(t,e){let r;switch(t.type){case"IRI":case"typeIRI":const e=this._resolveIRI(t.value);if(null===e)return this._error("Invalid IRI",t);r=this._namedNode(e);break;case"type":case"prefixed":const n=this._prefixes[t.prefix];if(void 0===n)return this._error(`Undefined prefix "${t.prefix}:"`,t);r=this._namedNode(n+t.value);break;case"blank":r=this._blankNode(this._prefixes[t.prefix]+t.value);break;case"var":r=this._variable(t.value.substr(1));break;default:return this._error(`Expected entity but got ${t.type}`,t)}return!e&&this._n3Mode&&r.id in this._quantified&&(r=this._quantified[r.id]),r}_readSubject(t){switch(this._predicate=null,t.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._blankNode(),null,null),this._readSubject):this._error("Unexpected graph",t);case"}":return this._readPunctuation(t);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier=this._blankNode,this._readQuantifierList):this._error('Unexpected "@forSome"',t);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier=this._variable,this._readQuantifierList):this._error('Unexpected "@forAll"',t);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",t);if(0===t.prefix.length)return this._literalValue=t.value,this._completeSubjectLiteral;this._subject=this._literal(t.value,this._namedNode(t.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",t);default:if(void 0===(this._subject=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(t){const e=t.type;switch(e){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[t.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${e}`,t):(this._subject=null,"]"===e?this._readBlankNodeTail(t):this._readPunctuation(t));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",t);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",t);default:if(void 0===(this._predicate=this._readEntity(t)))return}return this._readObject}_readObject(t){switch(t.type){case"literal":if(0===t.prefix.length)return this._literalValue=t.value,this._readDataTypeOrLang;this._object=this._literal(t.value,this._namedNode(t.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",t);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",t);default:if(void 0===(this._object=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(t){return"{"===t.type?this._readGraph(t):this._readPredicate(t)}_readGraph(t){return"{"!==t.type?this._error(`Expected graph but got ${t.type}`,t):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(t){return"]"===t.type?(this._subject=null,this._readBlankNodeTail(t)):(this._predicate=null,this._readPredicate(t))}_readBlankNodeTail(t){if("]"!==t.type)return this._readBlankNodePunctuation(t);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const e=null===this._predicate;return this._restoreContext("blank",t),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:e?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(t){switch(t.type){case".":case"}":return this._subject=null,this._readPunctuation(t);default:return this._readPredicate(t)}}_readListItem(t){let e=null,r=null,n=this._readListItem;const i=this._subject,o=this._contextStack,a=o[o.length-1];switch(t.type){case"[":this._saveContext("blank",this._graph,r=this._blankNode(),this.RDF_FIRST,this._subject=e=this._blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,r=this._blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",t),0!==o.length&&"list"===o[o.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(n=this._readPredicate,this._subject===this.RDF_NIL)return n}else if(n=this._getContextEndReader(),this._object===this.RDF_NIL)return n;r=this.RDF_NIL;break;case"literal":0===t.prefix.length?(this._literalValue=t.value,n=this._readListItemDataTypeOrLang):(e=this._literal(t.value,this._namedNode(t.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",t);default:if(void 0===(e=this._readEntity(t)))return}if(null===r&&(this._subject=r=this._blankNode()),null===i?null===a.predicate?a.subject=r:a.object=r:this._emit(i,this.RDF_REST,r,this._graph),null!==e){if(this._n3Mode&&("IRI"===t.type||"prefixed"===t.type))return this._saveContext("item",this._graph,r,this.RDF_FIRST,e),this._subject=e,this._predicate=null,this._getPathReader(this._readListItem);this._emit(r,this.RDF_FIRST,e,this._graph)}return n}_readDataTypeOrLang(t){return this._completeObjectLiteral(t,!1)}_readListItemDataTypeOrLang(t){return this._completeObjectLiteral(t,!0)}_completeLiteral(t){let e=this._literal(this._literalValue);switch(t.type){case"type":case"typeIRI":const r=this._readEntity(t);if(void 0===r)return;e=this._literal(this._literalValue,r),t=null;break;case"langcode":e=this._literal(this._literalValue,t.value),t=null}return{token:t,literal:e}}_completeSubjectLiteral(t){return this._subject=this._completeLiteral(t).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(t,e){const r=this._completeLiteral(t);if(r)return this._object=r.literal,e&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),null===r.token?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(r.token))}_readFormulaTail(t){return"}"!==t.type?this._readPunctuation(t):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",t),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(t){let e,r=this._graph;const n=this._subject,i=this._inversePredicate;switch(t.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",t);if(this._n3Mode)return this._readFormulaTail(t);this._graph=null;case".":this._subject=null,e=this._contextStack.length?this._readSubject:this._readInTopContext,i&&(this._inversePredicate=!1);break;case";":e=this._readPredicate;break;case",":e=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF* syntax",t);const o=this._predicate,a=this._object;this._subject=this._quad(n,o,a,this.DEFAULTGRAPH),e=this._readPredicate;break;case"|}":if("Quad"!==this._subject.termType)return this._error("Unexpected asserted triple closing",t);this._subject=null,e=this._readPunctuation;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(r=this._readEntity(t))){e=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,t)}if(null!==n){const t=this._predicate,e=this._object;i?this._emit(e,t,n,r):this._emit(n,t,e,r)}return e}_readBlankNodePunctuation(t){let e;switch(t.type){case";":e=this._readPredicate;break;case",":e=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,t)}return this._emit(this._subject,this._predicate,this._object,this._graph),e}_readQuadPunctuation(t){return"."!==t.type?this._error("Expected dot to follow quad",t):this._readInTopContext}_readPrefix(t){return"prefix"!==t.type?this._error("Expected prefix to follow @prefix",t):(this._prefix=t.value,this._readPrefixIRI)}_readPrefixIRI(t){if("IRI"!==t.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,t);const e=this._readEntity(t);return this._prefixes[this._prefix]=e.value,this._prefixCallback(this._prefix,e),this._readDeclarationPunctuation}_readBaseIRI(t){const e="IRI"===t.type&&this._resolveIRI(t.value);return e?(this._setBase(e),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",t)}_readNamedGraphLabel(t){switch(t.type){case"IRI":case"blank":case"prefixed":return this._readSubject(t),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",t)}}_readNamedGraphBlankLabel(t){return"]"!==t.type?this._error("Invalid graph label",t):(this._subject=this._blankNode(),this._readGraph)}_readDeclarationPunctuation(t){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(t)):"."!==t.type?this._error("Expected declaration to end with a dot",t):this._readInTopContext}_readQuantifierList(t){let e;switch(t.type){case"IRI":case"prefixed":if(void 0!==(e=this._readEntity(t,!0)))break;default:return this._error(`Unexpected ${t.type}`,t)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,e,this.QUANTIFIERS_GRAPH)):this._quantified[e.id]=this._quantifier(this._blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(t){return","===t.type?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(t))}_getPathReader(t){return this._afterPath=t,this._readPath}_readPath(t){switch(t.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const e=this._contextStack,r=e.length&&e[e.length-1];if(r&&"item"===r.type){const e=this._subject;this._restoreContext("item",t),this._emit(this._subject,this.RDF_FIRST,e,this._graph)}return this._afterPath(t)}}_readForwardPath(t){let e,r;const n=this._blankNode();if(void 0!==(r=this._readEntity(t)))return null===this._predicate?(e=this._subject,this._subject=n):(e=this._object,this._object=n),this._emit(e,r,n,this._graph),this._readPath}_readBackwardPath(t){const e=this._blankNode();let r,n;if(void 0!==(r=this._readEntity(t)))return null===this._predicate?(n=this._subject,this._subject=e):(n=this._object,this._object=e),this._emit(e,r,n,this._graph),this._readPath}_readRDFStarTailOrGraph(t){return">>"!==t.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(t))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,t):this._readRDFStarTail(t)}_readRDFStarTail(t){if(">>"!==t.type)return this._error(`Expected >> but got ${t.type}`,t);const e=this._quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",t),null===this._subject?(this._subject=e,this._readPredicate):(this._object=e,this._getContextEndReader())}_getContextEndReader(){const t=this._contextStack;if(!t.length)return this._readPunctuation;switch(t[t.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(t,e,r,n){this._callback(null,this._quad(t,e,r,n||this.DEFAULTGRAPH))}_error(t,e){const r=new Error(`${t} on line ${e.line}.`);r.context={token:e,line:e.line,previousToken:this._lexer.previousToken},this._callback(r),this._callback=Ue}_resolveIRI(t){return/^[a-z][a-z0-9+.-]*:/i.test(t)?t:this._resolveRelativeIRI(t)}_resolveRelativeIRI(t){if(!t.length)return this._base;switch(t[0]){case"#":return this._base+t;case"?":return this._base.replace(/(?:\?.*)?$/,t);case"/":return("/"===t[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(t);default:return/^[^/:]*:/.test(t)?null:this._removeDotSegments(this._basePath+t)}}_removeDotSegments(t){if(!/(^|\/)\.\.?($|[/#?])/.test(t))return t;const e=t.length;let r="",n=-1,i=-1,o=0,a="/";for(;n=i&&(r=r.substr(0,o)),"/"!==a)return`${r}/${t.substr(n+1)}`;o=n+1}}}a=t[++n]}return r+t.substring(o)}parse(t,e,r){if(this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Pe++}_`,this._prefixCallback=r||Ue,this._inversePredicate=!1,this._quantified=Object.create(null),!e){const e=[];let r;if(this._callback=(t,n)=>{t?r=t:n&&e.push(n)},this._lexer.tokenize(t).every((t=>this._readCallback=this._readCallback(t))),r)throw r;return e}this._callback=e,this._lexer.tokenize(t,((t,e)=>{null!==t?(this._callback(t),this._callback=Ue):this._readCallback&&(this._readCallback=this._readCallback(e))}))}}function Ue(){}function De(t,e){const r=e.namedNode;t._namedNode=r,t._blankNode=e.blankNode,t._literal=e.literal,t._variable=e.variable,t._quad=e.quad,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=r(pe.rdf.first),t.RDF_REST=r(pe.rdf.rest),t.RDF_NIL=r(pe.rdf.nil),t.N3_FORALL=r(pe.r.forAll),t.N3_FORSOME=r(pe.r.forSome),t.ABBREVIATIONS={a:r(pe.rdf.type),"=":r(pe.owl.sameAs),">":r(pe.log.implies)},t.QUANTIFIERS_GRAPH=r("urn:n3:quantifiers")}De(Fe.prototype,Ee);var Le=s(6357);if(void 0===Me)var Me={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 Be=function(){function r(t,n){(0,e.A)(this,r),this.options=n||{},this.kb=t,this.target=n.target||{graph:{subjects:{},prefixes:{},terms:{}}},this.blankNodes=[],this.htmlOptions={selfClosing:"br img input area base basefont col colgroup source wbr isindex link meta param hr"},this.theOne="_:"+(new Date).getTime(),this.language=null,this.vocabulary=null,this.blankCounter=0,this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"}],this.inXHTMLMode=!1,this.absURIRE=/[\w\_\-]+:\S+/,this.finishedHandlers=[],this.init()}return(0,t.A)(r,[{key:"addTriple",value:function(t,e,r,n){var i,o,a,s;i=void 0===e?G.namedNode(this.options.base):this.toRDFNodeObject(e),a=this.toRDFNodeObject(r),o=this.toRDFNodeObject(n),s=G.namedNode(this.options.base),this.kb.add(i,a,o,s)}},{key:"ancestorPath",value:function(t){for(var e="";t&&t.nodeType!==Me.DOCUMENT_NODE;)e="/"+t.localName+e,t=t.parentNode;return e}},{key:"copyMappings",value:function(t){var e={};for(var r in t)e[r]=t[r];return e}},{key:"copyProperties",value:function(){}},{key:"deriveDateTimeType",value:function(t){for(var e=0;e=0){var a=t.substring(0,o);if(""===a)return(i=e[""])?i+t.substring(o+1):null;if("_"===a)return"_:"+t.substring(o+1);if(r.NCNAME.test(a)&&(i=e[a]))return i+t.substring(o+1)}return null}},{key:"parseCURIEOrURI",value:function(t,e,r){return this.parseCURIE(t,e,r)||this.resolveAndNormalize(r,t)}},{key:"parsePredicate",value:function(t,e,r,n,i,o){if(""===t)return null;var a=this.parseTermOrCURIEOrAbsURI(t,e,o?null:r,n,i);return a&&0===a.indexOf("_:")?null:a}},{key:"parsePrefixMappings",value:function(t,e){for(var r=this.tokenize(t),n=null,i=0;i=0&&(t=t.substring(0,r)),e&&e.baseURIMap&&(t=e.baseURIMap(t)),t};for(i.push({current:t,context:this.push(null,o(t.baseURI))});i.length>0;){var a=i.shift();if(a.parent){if(a.context.parent&&a.context.parent.listMapping===a.listMapping)continue;for(var s in a.listMapping){var u=a.listMapping[s];if(0!==u.length){for(var c=[],l=0;l0){k=E;var O=n.spec;this.addTriple(f,O,"http://www.w3.org/ns/rdfa#usesVocabulary",{type:r.objectURI,value:k})}else k=this.vocabulary}for(var j=0;j0?F:null}var U,D,L=f.getAttributeNode("rel"),B=f.getAttributeNode("rev"),q=f.getAttributeNode("typeof"),H=f.getAttributeNode("property"),$=f.getAttributeNode("datatype"),z=this.inHTMLMode?f.getAttributeNode("datetime"):null,X=f.getAttributeNode("content"),G=f.getAttributeNode("about"),V=f.getAttributeNode("src"),W=f.getAttributeNode("resource"),Q=f.getAttributeNode("href"),Y=f.getAttributeNode("inlist"),J=[];if(L){D=this.tokenize(L.value);for(var Z=0;Z=0?e+=t.nodeName.split(":")[1]:e+=t.nodeName),e}.bind(this),i=!0;t.parent;){var o=t.element,a=o.attributes;if(o.nodeType===r.nodeType.TEXT||o.nodeType===r.nodeType.CDATA_SECTION)t.parent.nodeType===t.NODE&&(t.addArc(r.ns.RDF+"value"),t=this.buildFrame(t)),t.addLiteral(o.nodeValue);else if(n(o)!==r.ns.RDF+"RDF")if(t.parent&&t.parent.collection&&(t.addCollectionArc(),(t=this.buildFrame(t,t.element)).parent.element=null),t.parent&&t.parent.nodeType&&t.parent.nodeType!==t.ARC){t.addArc(n(o)),this.reify&&(e=this.getAttributeNodeNS(o,r.ns.RDF,"ID"))&&(t.rdfid=e.nodeValue,o.removeAttributeNode(e));var s=this.getAttributeNodeNS(o,r.ns.RDF,"parseType"),u=this.getAttributeNodeNS(o,r.ns.RDF,"datatype");if(u&&(t.datatype=u.nodeValue,o.removeAttributeNode(u)),s){var c=s.nodeValue;"Literal"===c?(t.datatype=r.ns.RDF+"XMLLiteral",(t=this.buildFrame(t)).addLiteral(o.innerHTML||o.childNodes),i=!1):"Resource"===c?((t=this.buildFrame(t,t.element)).parent.element=null,t.addBNode()):"Collection"===c&&((t=this.buildFrame(t,t.element)).parent.element=null,t.addCollection()),o.removeAttributeNode(s)}if(0!==a.length){var l=this.getAttributeNodeNS(o,r.ns.RDF,"resource"),h=this.getAttributeNodeNS(o,r.ns.RDF,"nodeID");t=this.buildFrame(t),l?(t.addNode(l.nodeValue),o.removeAttributeNode(l)):h?(t.addBNode(h.nodeValue),o.removeAttributeNode(h)):t.addBNode();for(var f=a.length-1;f>=0;f--){var p=this.buildFrame(t);p.addArc(n(a[f])),n(a[f])===r.ns.RDF+"type"?this.buildFrame(p).addNode(a[f].nodeValue):this.buildFrame(p).addLiteral(a[f].nodeValue)}}else 0===o.childNodes.length&&this.buildFrame(t).addLiteral("")}else{var d=this.getAttributeNodeNS(o,r.ns.RDF,"about");if(e=this.getAttributeNodeNS(o,r.ns.RDF,"ID"),d&&e)throw new Error("RDFParser: "+o.nodeName+" has both rdf:id and rdf:about. Halting. Only one of these properties may be specified on a node.");if(!d&&e)t.addNode("#"+e.nodeValue),o.removeAttributeNode(e);else if(null==d&&null==e){var y=this.getAttributeNodeNS(o,r.ns.RDF,"nodeID");y?(t.addBNode(y.nodeValue),o.removeAttributeNode(y)):t.addBNode()}else t.addNode(d.nodeValue),o.removeAttributeNode(d);var v=this.getAttributeNodeNS(o,r.ns.RDF,"type");r.ns.RDF+"Description"!==n(o)&&(v={nodeValue:n(o)}),null!=v&&(this.store.add(t.node,this.store.sym(r.ns.RDF+"type"),this.store.sym(M.join(v.nodeValue,t.base)),this.why),v.nodeName&&o.removeAttributeNode(v));for(var g=a.length-1;g>=0;g--)this.store.add(t.node,this.store.sym(n(a[g])),this.store.literal(a[g].nodeValue,t.lang),this.why)}for(o=t.element;t.parent;){for(var m=t;null==o;)o=(t=t.parent).element;var b=o.childNodes&&o.childNodes[t.lastChild];if(b&&i){if((b.nodeType===r.nodeType.ELEMENT||b.nodeType===r.nodeType.TEXT||b.nodeType===r.nodeType.CDATA_SECTION)&&(b.nodeType!==r.nodeType.TEXT&&b.nodeType!==r.nodeType.CDATA_SECTION||1===o.childNodes.length)){t.lastChild++,t=this.buildFrame(m,o.childNodes[t.lastChild-1]);break}t.lastChild++}else{if(t.terminateFrame(),!(t=t.parent))break;o=t.element,i=!0}}}}},{key:"cleanParser",value:function(){this.bnodes={},this.why=null}},{key:"buildFrame",value:function(t,e){var n=this.frameFactory(this,t,e);if(t&&(n.base=t.base,n.lang=t.lang),!e||e.nodeType===r.nodeType.TEXT||e.nodeType===r.nodeType.CDATA_SECTION)return n;var i=e.attributes,o=e.getAttributeNode("xml:base");null!=o&&(n.base=o.nodeValue,e.removeAttribute("xml:base"));var a=e.getAttributeNode("xml:lang");null!=a&&(n.lang=a.nodeValue,e.removeAttribute("xml:lang"));for(var s=i.length-1;s>=0;s--)if("xml"===i[s].nodeName.substr(0,3)){if("xmlns:"===i[s].name.slice(0,6)){var u=i[s].nodeValue;this.base&&(u=M.join(u,this.base)),this.store.setPrefixForURI(i[s].name.slice(6),u)}e.removeAttributeNode(i[s])}return n}}])}();function $e(t,e,r){var n,i,o,a=["INSERT","DELETE","WHERE"],s=W("http://www.w3.org/ns/pim/patch#"),u=Yt(e,e,r,r,null,null,"",null),c={},l=function(t,e,r,n,i){return"Line "+(e+1)+" of <"+t+">: Bad syntax:\n "+i+'\n at: "'+r.slice(n,n+30)+'"'};n=0;var h=e.sym(r+"#query");for(c.query=h;;){if((i=u.skipSpace(t,n))<0)return c;if(";"===t[i]){if((n=u.skipSpace(t,i+1))<0)return c;i=n}var f=!1;for(o=0;o3&&void 0!==arguments[3]?arguments[3]:"text/turtle",i=arguments.length>4?arguments[4]:void 0;n=(n=n||l.sT).split(";")[0];try{if(n===l.ny||n===l.sT)Yt(e,e,r,r,null,null,"",null).loadBuf(t),a();else if(n===l.JG)new He(e).parse(Q.parseXML(t),r,e.sym(r)),a();else if(n===l.H)qe(Q.parseXML(t,{contentType:l.H}),e,r),a();else if(n===l.lc)qe(Q.parseXML(t,{contentType:l.lc}),e,r),a();else if(n===l.K9||n===l.Fn)$e(t,e,r),a();else if(n===l.i2)ie(t,e,r,a);else{if(n!==l._0&&n!==l.BR)throw void 0===n?new Error("contentType is undefined"):new Error("Don't know how to parse "+n+" yet");var o=new Fe({factory:re});!function(t,r){try{o.parse(r,s)}catch(t){i(t,e)}}(null,t)}}catch(t){!function(t){if(n!==l.i2||n!==l._0||n!==l.BR){if(!i){var o=new Error(t+" while trying to parse <"+r+"> as "+n);throw o.cause=t,o}i(t,e)}}(t)}function a(){i&&i(null,e)}function s(t,r){r?e.add(r.subject,r.predicate,r.object,r.graph):i(t,e)}ze.handled={"text/n3":!0,"text/turtle":!0,"application/rdf+xml":!0,"application/xhtml+xml":!0,"text/html":!0,"application/sparql-update":!0,"application/sparql-update-single-match":!0,"application/ld+json":!0,"application/nquads":!0,"application/n-quads":!0}}(0,o.A)(He,"ns",{RDF:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",RDFS:"http://www.w3.org/2000/01/rdf-schema#"}),(0,o.A)(He,"nodeType",{ELEMENT:1,ATTRIBUTE:2,TEXT:3,CDATA_SECTION:4,ENTITY_REFERENCE:5,ENTITY:6,PROCESSING_INSTRUCTION:7,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,DOCUMENT_FRAGMENT:11,NOTATION:12});var Xe=s(1147),Ge=s.n(Xe),Ve=s(362),We=s(6357);function Qe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&o.add(r.resource,er.dc("title"),o.rdfFactory.literal(a[0].textContent),r.resource);for(var s=this.dom.getElementsByTagName("link"),u=s.length-1;u>=0;u--)i=!1,(n=s[u].getAttribute("rel"))||(n=s[u].getAttribute("rev"),i=!0),n&&t.linkData(r.original,n,s[u].getAttribute("href"),r.resource,i);for(var c=this.dom.getElementsByTagName("script"),l=0;l");return!(-1===e||-1===r||e>r)&&-1!==t.substr(e,r-e).indexOf("XHTML")}(e))return t.addStatus(r.req,"Has XHTML DOCTYPE. Switching to XHTMLHandler.\n"),new ir(this.response).parse(t,e,r);if(function(t){return!!t.match(/[^(/)}(e))return t.addStatus(r.req,"Has default namespace for XHTML, so switching to XHTMLHandler.\n"),new ir(this.response).parse(t,e,r);var i=new RegExp("([\\s\\S]+?)","im").exec(e);return i&&n.add(r.resource,er.dc("title"),n.rdfFactory.literal(i[1]),r.resource),n.add(r.resource,er.rdf("type"),er.link("WebPage"),t.appNode),t.addStatus(r.req,"non-XML HTML document, not parsed for data."),t.doneFetch(r,this.response)}}],[{key:"toString",value:function(){return"HTMLHandler"}},{key:"register",value:function(t){t.mediatypes["text/html"]={q:.9}}}])}(rr);ar.pattern=new RegExp("text/html");var sr=function(r){function n(){return(0,e.A)(this,n),Ye(this,n,arguments)}return(0,i.A)(n,r),(0,t.A)(n,[{key:"parse",value:function(t,e,r,n){var i=t.store;return new Promise((function(o,a){try{ie(e,i,r.original.value,(function(){o(t.doneFetch(r,n))}))}catch(e){var s="Error trying to parse "+r.resource+" as JSON-LD:\n"+e;o(t.failFetch(r,s,"parse_error",n))}}))}}],[{key:"toString",value:function(){return"JsonLdHandler"}},{key:"register",value:function(t){t.mediatypes["application/ld+json"]={q:.9}}}])}(rr);sr.pattern=/application\/ld\+json/;var ur=function(r){function n(){return(0,e.A)(this,n),Ye(this,n,arguments)}return(0,i.A)(n,r),(0,t.A)(n,[{key:"parse",value:function(t,e,r){return hr(e)?(t.addStatus(r.req,"Warning: "+r.resource+" has an XML declaration. We'll assume it's XML but its content-type wasn't XML.\n"),new or(this.response).parse(t,e,r)):e.slice(0,500).match(/xmlns:/)?(t.addStatus(r.req,"May have an XML namespace. We'll assume it's XML but its content-type wasn't XML.\n"),new or(this.response).parse(t,e,r)):(t.addStatus(r.req,"Plain text document, no known RDF semantics."),t.doneFetch(r,this.response))}}],[{key:"toString",value:function(){return"TextHandler"}},{key:"register",value:function(t){t.mediatypes["text/plain"]={q:.5}}}])}(rr);ur.pattern=new RegExp("text/plain");var cr=function(r){function n(){return(0,e.A)(this,n),Ye(this,n,arguments)}return(0,i.A)(n,r),(0,t.A)(n,[{key:"parse",value:function(t,e,r,n){var i=t.store,o=Yt(i,i,r.original.value,r.original.value,null,null,"",null);try{o.loadBuf(e)}catch(e){var a="Error trying to parse "+r.resource+" as Notation3:\n"+e;return t.failFetch(r,a,"parse_error",n)}return t.addStatus(r.req,"N3 parsed: "+o.statementCount+" triples in "+o.lines+" lines."),t.store.add(r.original,er.rdf("type"),er.link("RDFDocument"),t.appNode),t.doneFetch(r,this.response)}}],[{key:"toString",value:function(){return"N3Handler"}},{key:"register",value:function(t){t.mediatypes["text/n3"]={q:"1.0"},t.mediatypes["text/turtle"]={q:1}}}])}(rr);cr.pattern=new RegExp("(application|text)/(x-)?(rdf\\+)?(n3|turtle)");var lr={RDFXMLHandler:nr,XHTMLHandler:ir,XMLHandler:or,HTMLHandler:ar,TextHandler:ur,N3Handler:cr,JsonLdHandler:sr};function hr(t){return!!t.match(/\s*<\?xml\s+version\s*=[^<>]+\?>/)}var fr=function(){function r(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((0,e.A)(this,r),(0,o.A)(this,"store",void 0),(0,o.A)(this,"timeout",void 0),(0,o.A)(this,"_fetch",void 0),(0,o.A)(this,"mediatypes",void 0),(0,o.A)(this,"appNode",void 0),(0,o.A)(this,"requested",void 0),(0,o.A)(this,"timeouts",void 0),(0,o.A)(this,"redirectedTo",void 0),(0,o.A)(this,"fetchQueue",void 0),(0,o.A)(this,"fetchCallbacks",void 0),(0,o.A)(this,"nonexistent",void 0),(0,o.A)(this,"lookedUp",void 0),(0,o.A)(this,"handlers",void 0),(0,o.A)(this,"ns",void 0),(0,o.A)(this,"fireCallbacks",void 0),this.store=t||new Et,this.ns=tr(this.store.rdfFactory),this.timeout=i.timeout||3e4,this._fetch=i.fetch||void 0!==s.g&&(s.g.solidFetcher||s.g.solidFetch)||"undefined"!=typeof window&&(window.solidFetcher||window.solidFetch)||Ge(),!this._fetch)throw new Error("No _fetch function available for Fetcher");this.appNode=this.store.sym("chrome://TheCurrentSession"),this.store.fetcher=this,this.requested={},this.timeouts={},this.redirectedTo={},this.fetchQueue={},this.fetchCallbacks={},this.nonexistent={},this.lookedUp={},this.handlers=[],this.mediatypes={"image/*":{q:.9},"*/*":{q:.1}},Q.callbackify(this,["request","fail","refresh","retract","done"]),Object.keys(i.handlers||lr).map((function(t){return n.addHandler(lr[t])}))}return(0,t.A)(r,[{key:"load",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r=Object.assign({},r),t instanceof Array)return Promise.all(t.map((function(t){return e.load(t,Object.assign({},r))})));var n=t,i=(0,Ve.E)(n);i=i.split("#")[0],r=this.initFetchOptions(i,r);var o,a=this.appNode,s=this.store,u=s.statementsMatching(void 0,this.ns.link("requestedURI"),s.sym(i),a).map((function(t){return t.subject})),c=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return Qe(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Qe(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}(u);try{for(c.s();!(o=c.n()).done;){var l=o.value,h=s.any(l,this.ns.link("response"),null,a);if(null!=h){var f=s.statementsMatching(h,this.ns.link("outOfDate"),!0,a);s.remove(f),r.force=!0,r.clearPreviousData=!0}}}catch(t){c.e(t)}finally{c.f()}var p=this.initFetchOptions(i,r);return this.pendingFetchPromise(i,p.baseURI,p)}},{key:"pendingFetchPromise",value:(i=N(R().mark((function t(e,r,n){var i,o=this;return R().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=!n.force,!t.t0){t.next=5;break}return t.next=4,this.fetchQueue[r];case 4:t.t0=t.sent;case 5:if(!t.t0){t.next=9;break}i=this.fetchQueue[r],t.next=12;break;case 9:i=Promise.race([this.setRequestTimeout(e,n),this.fetchUri(e,n)]),this.fetchQueue[r]=i,this.cleanupFetchRequest(r,void 0,this.timeout);case 12:return t.abrupt("return",i.then((function(t){return e in o.timeouts&&(o.timeouts[e].forEach(clearTimeout),delete o.timeouts[e]),t})));case 13:case"end":return t.stop()}}),t,this)}))),function(t,e,r){return i.apply(this,arguments)})},{key:"cleanupFetchRequest",value:function(t,e,r){var n=this;void 0!==e&&We.warn("_options is deprecated"),this.timeouts[t]=(this.timeouts[t]||[]).concat(setTimeout((function(){n.isPending(t)||delete n.fetchQueue[t]}),r))}},{key:"initFetchOptions",value:function(t,e){var n=this.store;!e.method||"GET"===e.method.toUpperCase()||(e.force=!0),e.resource=n.rdfFactory.namedNode(t),e.baseURI=e.baseURI||t,e.original=n.rdfFactory.namedNode(e.baseURI),e.req=n.bnode(),e.headers=e.headers||new Xe.Headers,e.contentType&&(e.headers["content-type"]=e.contentType),e.force&&(e.cache="no-cache");var i=this.acceptString();e.headers.accept=i;var o=r.offlineOverride(t);e.requestedURI=o,r.setCredentials(o,e);var a=r.proxyIfNecessary(o);return o!==a&&(e.proxyUsed=!0),e.actualProxyURI=a,e}},{key:"fetchUri",value:function(t,e){var n=this;if(!t)return Promise.reject(new Error("Cannot fetch an empty uri"));if(r.unsupportedProtocol(t))return this.failFetch(e,"fetcher: Unsupported protocol","unsupported_protocol");var i=this.getState(t);if(e.force)delete this.nonexistent[t];else{if("fetched"===i)return Promise.resolve(this.doneFetch(e,{status:200,ok:!0,statusText:"Already loaded into quadstore."}));if("failed"===i&&404===this.requested[t]){var o="Previously failed: "+this.requested[t],a={url:t,status:this.requested[t],statusText:o,responseText:o,headers:new Xe.Headers,ok:!1,body:null,bodyUsed:!1,size:0,timeout:0};return this.failFetch(e,o,this.requested[t],a)}}this.fireCallbacks("request",[t]),this.requested[t]=!0,e.noMeta||this.saveRequestMetadata(t,e);var s=e.actualProxyURI;return this._fetch(s,e).then((function(r){return n.handleResponse(r,t,e)}),(function(r){var i={url:s,status:999,statusText:(r.name||"network failure")+": "+(r.errno||r.code||r.type),responseText:r.message,headers:new Xe.Headers,ok:!1,body:null,bodyUsed:!1,size:0,timeout:0};return n.handleError(i,t,e)}))}},{key:"nowOrWhenFetched",value:function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=(0,Ve.E)(t);"function"==typeof e?r=e:void 0===e||((0,v.Y2)(e)?n.referringTerm=e:n=e),this.load(i,n).then((function(t){if(r)if(t)if(t.ok)r(!0,"OK",t);else{var e="HTTP error: Status "+t.status+" ("+t.statusText+")";t.responseText&&(e+=" "+t.responseText),r(!1,e,t)}else r(!1,"@@ nowOrWhenFetched: no response object!")}),(function(t){var e=t.message||t.statusText;e="Failed to load <"+i+"> "+e,t.response&&t.response.status&&(e+=" status: "+t.response.status),r(!1,e,t.response)}))}},{key:"addStatus",value:function(t,e){var r=new Date;e="["+r.getHours()+":"+r.getMinutes()+":"+r.getSeconds()+"."+r.getMilliseconds()+"] "+e;var n=this.store,i=n.the(t,this.ns.link("status"));(0,v.P3)(i)?i.append(n.rdfFactory.literal(e)):V.A.warn("web.js: No list to add to: "+i+","+e)}},{key:"failFetch",value:function(t,e,r,n){this.addStatus(t.req,e),t.noMeta||this.store.add(t.original,this.ns.link("error"),this.store.rdfFactory.literal(e));var i=(t.method||"GET").toUpperCase();("GET"===i||"HEAD"===i)&&(t.resource.equals(t.original),this.requested[M.docpart(t.original.value)]=r,this.fireCallbacks("fail",[t.original.value,e]));var o=new Error("Fetcher: "+e);return o.status=r,o.statusText=e,o.response=n,Promise.reject(o)}},{key:"linkData",value:function(t,e,r,n,i){if(r){var o,a=this.store,s=a.rdfFactory.namedNode(M.join(r,t.value));if("alternate"===e||"seeAlso"===e||"meta"===e||"describedby"===e){if(s.value===t.value)return;o=this.ns.rdfs("seeAlso")}else o="type"===e?a.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"):a.rdfFactory.namedNode(M.join(encodeURIComponent(e),"http://www.iana.org/assignments/link-relations/"));i?a.add(s,o,t,n):a.add(t,o,s,n)}}},{key:"parseLinkHeader",value:function(t,e,r){if(t){var n=/[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*"))/g,i=t.match(/<[^>]*>\s*(\s*;\s*[^()<>@,;:"/[\]?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*")))*(,|$)/g);if(null!=i)for(var o=0;o"),s=a[0].substring(1),u=a[1].match(n);if(null==u)return;for(var c=0;c1&&void 0!==arguments[1]?arguments[1]:{},n=(0,Ve.E)(t),i=new y.A(n).doc();return r.contentType=r["content-type"]||r["Content-Type"]||r.contentType||l.sT,"application/ld+json"===r.contentType?new Promise((function(n,o){nt(i,e.store,i.uri,r.contentType,(function(i,a){i?o(i):(r.data=a,e.webOperation("PUT",t,r).then((function(t){return n(t)})).catch((function(t){return o(t)})))}))})):(r.data=nt(i,this.store,i.value,r.contentType),this.webOperation("PUT",n,r))}},{key:"webCopy",value:function(t,e,r){var n=this;return this.webOperation("GET",t).then((function(t){return n.webOperation("PUT",e,{data:t.responseText,contentType:r})}))}},{key:"delete",value:function(t,e){var r=this;return this.webOperation("DELETE",t,e).then((function(e){return r.requested[t]=404,r.nonexistent[t]=!0,r.unload(r.store.rdfFactory.namedNode(t)),e}))}},{key:"createIfNotExists",value:(n=N(R().mark((function t(e){var r,n,i,o,a=arguments;return R().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:l.sT,n=a.length>2&&void 0!==a[2]?a[2]:"",i=this,t.prev=3,t.next=6,i.load(e);case 6:o=t.sent,t.next=26;break;case 9:if(t.prev=9,t.t0=t.catch(3),404!==t.t0.response.status){t.next=25;break}return t.prev=12,t.next=15,i.webOperation("PUT",e.value,{data:n,contentType:r});case 15:o=t.sent,t.next=21;break;case 18:throw t.prev=18,t.t1=t.catch(12),t.t1;case 21:return delete i.requested[e.value],t.abrupt("return",o);case 25:throw t.t0;case 26:return t.abrupt("return",o);case 27:case"end":return t.stop()}}),t,this,[[3,9],[12,18]])}))),function(t){return n.apply(this,arguments)})},{key:"createContainer",value:function(t,e,r){var n={"content-type":l.sT,link:this.ns.ldp("BasicContainer")+'; rel="type"'};e&&(n.slug=e);var i={headers:n};return r&&(i.body=r),this.webOperation("POST",t,i)}},{key:"invalidateCache",value:function(t){var e=(0,Ve.E)(t),r=this;if(r.fetchQueue&&r.fetchQueue[e]&&(r.fetchQueue[e].PromiseStatus,delete r.fetchQueue[e]),r.requested[e]&&"done"!==r.requested[e]&&"failed"!==r.requested[e]&&404!==r.requested[e]){var n="Rdflib: fetcher: Destructive operation on <".concat(r.requested[e],"> file being fetched! ")+e;We.error(n)}else delete r.requested[e],delete r.nonexistent[e]}},{key:"webOperation",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=(0,Ve.E)(e);n.method=t,n.body=n.data||n.body,n.force=!0;var o=this;if(n.body&&!n.contentType)throw new Error("Web operation sending data must have a defined contentType.");return n.contentType&&(n.headers=n.headers||{},n.headers["content-type"]=n.contentType),r.setCredentials(i,n),new Promise((function(e,r){o._fetch(i,n).then((function(n){if(n.ok)"PUT"!==t&&"PATCH"!==t&&"POST"!==t&&"DELETE"!==t||o.invalidateCache(i),n.text?n.text().then((function(t){n.responseText=t,e(n)})):e(n);else{var a="Web error: "+n.status;n.statusText&&(a+=" ("+n.statusText+")"),a+=" on "+t+" of <"+i+">",n.responseText&&(a+=": "+n.responseText);var s=new Error(a);s.response=n,r(s)}}),(function(e){r(new Error("Fetch error for "+t+" of <"+i+">:"+e))}))}))}},{key:"lookUpThing",value:function(t,e){var r=this,n=this.store.uris(t);return(n=n.map((function(t){return M.docpart(t)}))).forEach((function(t){r.lookedUp[t]=!0})),this.load(n,{referringTerm:e})}},{key:"getHeader",value:function(t,e){for(var r=this.store,n=t.value,i=r.each(void 0,this.ns.link("requestedURI"),r.rdfFactory.literal(n)),o=0;o=400)return 404===t.status&&(this.nonexistent[r.original.value]=!0,this.nonexistent[e]=!0),this.saveErrorResponse(t,s).then((function(){var e=r.resource+" "+t.statusText;return n.failFetch(r,e,t.status,t)}));var l=null,h=null;if(c&&(h=M.join(c,e))!==e&&(l=h),200===t.status){if(this.addType(this.ns.link("Document"),a,i,e),l&&this.addType(this.ns.link("Document"),a,i,l),r.clearPreviousData)for(var f=i.statementsMatching(void 0,void 0,void 0,r.resource).slice(),p=0;p10&&n.add(e,r.ns.http("content"),n.rdfFactory.literal(t),e)}))}},{key:"handlerForContentType",value:function(t,e){if(!t)return null;var r=this.handlers.find((function(e){return t.match(e.pattern)}));return r?new r(e):null}},{key:"guessContentType",value:function(t){return Ke[t.split(".").pop()]}},{key:"normalizedContentType",value:function(t,e){if(t.forceContentType)return t.forceContentType;var r=e.get("content-type");if(!r||r.includes("application/octet-stream")){var n=this.guessContentType(t.resource.value);if(n)return n}var i=M.protocol(t.resource.value);return!r&&["file","chrome"].includes(i)?"text/xml":r}},{key:"redirectToProxy",value:function(t,e){var r=this;this.addStatus(e.req,"BLOCKED -> Cross-site Proxy to <"+t+">"),e.proxyUsed=!0;var n=this.store,i=e.req;e.noMeta||(n.add(i,this.ns.link("redirectedTo"),n.rdfFactory.namedNode(t),i),this.addStatus(i,"redirected to new request")),this.requested[e.resource.value]="redirected",this.redirectedTo[e.resource.value]=t;var o=Object.assign({},e);return o.baseURI=e.resource.value,this.fetchUri(t,o).then((function(t){return o.noMeta||n.add(i,r.ns.link("redirectedRequest"),o.req,r.appNode),t}))}},{key:"setRequestTimeout",value:function(t,e){var r=this;return new Promise((function(n){r.timeouts[t]=(r.timeouts[t]||[]).concat(setTimeout((function(){!r.isPending(t)||e.retriedWithNoCredentials||e.proxyUsed||n(r.failFetch(e,"Request to ".concat(t," timed out"),"timeout"))}),r.timeout))}))}},{key:"addFetchCallback",value:function(t,e){this.fetchCallbacks[t]?this.fetchCallbacks[t].push(e):this.fetchCallbacks[t]=[e]}},{key:"acceptString",value:function(){var t="";for(var e in this.mediatypes)for(var r in""!==t&&(t+=", "),t+=e,this.mediatypes[e])t+=";"+r+"="+this.mediatypes[e][r];return t}}],[{key:"crossSiteProxy",value:function(t){return r.crossSiteProxyTemplate?r.crossSiteProxyTemplate.replace("{uri}",encodeURIComponent(t)):void 0}},{key:"offlineOverride",value:function(t){var e,r=t;return"undefined"!=typeof window&&window.panes&&(e=window.panes.UI)&&e.preferences&&e.preferences.get("offlineModeUsingLocalhost")&&"http://"===r.slice(0,7)&&"localhost/"!==r.slice(7,17)&&(r="http://localhost/"+r.slice(7),V.A.warn("Localhost kludge for offline use: actually getting <"+r+">")),r}},{key:"proxyIfNecessary",value:function(t){var e;if("undefined"!=typeof window&&window.panes&&(e=window.panes.UI)&&e.isExtension)return t;if("undefined"!=typeof $SolidTestEnvironment&&$SolidTestEnvironment.localSiteMap){var n=function t(e,r){var n=r[e.shift()];return n?"string"==typeof n?n+e.join("/"):e?t(e,n):null:null}(t.split("/").slice(2),$SolidTestEnvironment.localSiteMap);if(n)return n}return r.crossSiteProxyTemplate&&"undefined"!=typeof document&&document.location&&"https:"===(""+document.location).slice(0,6)&&"http:"===t.slice(0,5)?r.crossSiteProxyTemplate.replace("{uri}",encodeURIComponent(t)):t}},{key:"unsupportedProtocol",value:function(t){var e=M.protocol(t);return"tel"===e||"mailto"===e||"urn"===e}},{key:"setCredentials",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};void 0===e.credentials&&(void 0!==e.withCredentials?e.credentials=e.withCredentials?"include":"omit":e.credentials="include")}}]);var n,i}();(0,o.A)(fr,"HANDLERS",void 0),(0,o.A)(fr,"CONTENT_TYPE_BY_EXT",void 0),(0,o.A)(fr,"crossSiteProxyTemplate",void 0),fr.HANDLERS=lr,fr.CONTENT_TYPE_BY_EXT=Ke;const pr={parseJSON:function(t,e,r){var n,i,o,a={},s=r.sym(e);for(var u in t){0===u.indexOf("_:")?a[u]?n=a[u]:(n=r.bnode(u),a[u]=n):n=r.sym(u);var c=t[u];for(var l in c){var h=c[l];for(var f in i=r.sym(l),h){var p=h[f];if("uri"===p.type)o=r.sym(p.value),r.add(n,i,o,s);else if("BlankNode"===p.type)a[p.value]?o=a[p.value]:(o=r.bnode(p.value),a[p.value]=o),r.add(n,i,o,s);else{if("Literal"!==p.type)throw new Error("error: unexpected termtype: "+f.type);o=p.datatype?r.literal(p.value,void 0,r.sym(p.datatype)):p.lang?r.literal(p.value,p.lang):r.literal(p.value),r.add(n,i,o,s)}}}}}};function dr(t){var e=0;function r(t){var e="",r=t.statements;for(var n in r)V.A.debug("Found statement: "+r),e+=a()+r[n]+"\n";return e}function n(t){var e="";for(var r in t.constraints){var n=t.constraints[r];e+=a()+"FILTER ( "+n.describe(r)+" ) \n"}return e}function i(t){for(var o="",s=0;s"):t}function u(t){return"string"==typeof t&&t.match(/^<[^>]*>$/)}function c(t){return"string"==typeof t&&(t.match(/^_:/)||t.match(/^$/))}function l(t){return"string"==typeof t&&t.match(/:$/)}function h(t){return"string"==typeof t&&t.match(/^:|^[^_][^:]*:/)}function f(t){return t.split(":")[0]}function p(t){return t.split(":")[1]}function d(t){return u(t)?t.slice(1,t.length-1):t}function y(t){var e=-1===t.indexOf("'")?null:t.indexOf("'"),n=-1===t.indexOf('"')?null:t.indexOf('"');if(!e&&!n){var i=new Array(1);return i[0]=t,i}var o,a,s=new Array(2);if(!e||n&&n/g,"> ").replace(/{/g," { ").replace(/}/g," } ").replace(/[\t\n\r]/g," ").replace(/; /g," ; ").replace(/\. /g," . ").replace(/, /g," , "),V.A.info("New str into spaceDelimit: \n"+t);var e=[],r=t.split(" ");for(var n in r)o(r[n])&&(e=e.concat(r[n]));return e}function g(t,e){for(var r=0;r"===t[1]||"<"===t[1]?(V.A.debug("Constraint added: "+t),e.constraints[t[0]]=new w(t[2])):V.A.warn("I don't know how to handle the constraint: "+t)}function _(t,e){V.A.debug("Optional query: "+t+" not yet implemented.");var n=r.formula();k(t,n),e.optional.push(n)}function k(t,e){var n,o,l=function(t){for(var e=[],n=0;n"),"is"===e[r]&&"of"===e[r+2]){e.splice(r,1),e.splice(r+1,1);var n=e[r-1];e[r-1]=e[r+1],e[r+1]=n}return e}(r),V.A.info("SPARQL Tokens: "+r),r}(t),O=function(t){var e=m("PREFIX",t),r=[];for(var n in e){var i=t[e[n]+1],o=t[e[n]+2];if(l(i))if(u(o)){V.A.info("Prefix found: "+i+" -> "+o);var a=f(i),s=d(o);r[a]=s}else V.A.error("Invalid SPARQL symbol: "+o);else V.A.error("Invalid SPARQL prefix: "+i)}return r}(E);O.rdf||(O.rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"),O.rdfs||(O.rdfs="http://www.w3.org/2000/01/rdf-schema#");var j=g("SELECT",E),N=g("WHERE",E);if(j<0||N<0||j>N)return V.A.error("Invalid or nonexistent SELECT and WHERE tags in SPARQL query"),!1;if(function(t,e){for(var r in V.A.info("SPARQL vars: "+t),t)if(a(t[r])){V.A.info("Added "+t[r]+" to query variables from SPARQL");var n=i(t[r].slice(1));e.vars.push(n),n.label=t[r].slice(1)}else V.A.warn("Incorrect SPARQL variable in SELECT: "+t[r])}(E.slice(j+1,N),T),k(E.slice(N+2,E.length-1),T.pat),e)return T;for(var S in T.pat.statements){var R=T.pat.statements[S];"NamedNode"===R.subject.termType&&r.fetcher&&r.fetcher.lookUpThing(R.subject,"sparql:"+R.subject),"NamedNode"===R.object.termType&&r.fetcher&&r.fetcher.lookUpThing(R.object,"sparql:"+R.object)}return T}function vr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return gr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?gr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function gr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0)return"N3PATCH";if(i.indexOf("application/sparql-update")>=0)return"SPARQL";if(i.indexOf("application/sparql-update-single-match")>=0)return"SPARQL"}var v=e.each(c,this.ns.httph("ms-author-via"));if(v.length)for(var g=0;g=0)return"SPARQL";if(i.indexOf("DAV")>=0)return"DAV"}if(!this.isHttpUri(t))return!!l&&"LOCALFILE";var m=e.each(c,this.ns.http("status"));if(m.length)for(var b=0;b3&&void 0!==arguments[3]?arguments[3]:{};return Promise.resolve().then((function(){if(!t)throw new Error("No URI given for remote editing operation: "+e);return i.noMeta=!0,i.contentType=i.contentType||"application/sparql-update",i.body=e,n.store.fetcher.webOperation("PATCH",t,i)})).then((function(n){if(!n.ok){var i="UpdateManager: update failed for <"+t+"> status="+n.status+", "+n.statusText+"\n for query: "+e;throw new Error(i)}r(t,n.ok,n.responseText,n)})).catch((function(e){r(t,!1,e.message,e)}))}},{key:"update_statement",value:function(t){if(!t||t.graph){var e=this,r=this.statementContext(t);return{statement:t?[t.subject,t.predicate,t.object,t.graph]:void 0,statementNT:t?this.anonymizeNT(t):void 0,where:e.contextWhere(r),set_object:function(t,r){var n=this.where;n+="DELETE DATA { "+this.statementNT+" } ;\n",n+="INSERT DATA { "+this.anonymize(this.statement[0])+" "+this.anonymize(this.statement[1])+" "+this.anonymize(t)+" . }\n",e.fire(this.statement[3].value,n,r)}}}}},{key:"insert_statement",value:function(t,e){var r=t instanceof Array?t[0]:t,n=this.contextWhere(this.statementContext(r));if(t instanceof Array){for(var i="",o=0;o 1 different downstream actions")}else r.downstreamAction=e;else e(t)}},{key:"clearUpstreamCount",value:function(t){this.patchControlFor(t).upstreamCount=0}},{key:"getUpdatesVia",value:function(t){var e=this.store.fetcher.getHeader(t,"updates-via");return e&&e.length?e[0].trim():null}},{key:"addDownstreamChangeListener",value:function(t,e){var r=this,n=this.patchControlFor(t);n.downstreamChangeListeners||(n.downstreamChangeListeners=[]),n.downstreamChangeListeners.push(e),this.setRefreshHandler(t,(function(t){r.reloadAndSync(t)}))}},{key:"reloadAndSync",value:function(t){var e=this.patchControlFor(t),r=this;if(e.reloading)e.outOfDate=!0;else{e.reloading=!0;var n=1e3;!function i(){r.reload(r.store,t,(function(t,r,o){if(t){if(e.downstreamChangeListeners)for(var a=0;a=0))return;c.upstreamCount=0,i.requestDownstreamAction(t,n)}}}(),!0}},{key:"updateMany",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=t.concat(e).map((function(t){return t.why})),n=this,i=[];r.forEach((function(t){i.find((function(e){return e.equals(t)}))||i.push(t)}));var o=i.map((function(r){return n.update(t.filter((function(t){return t.why.equals(r)})),e.filter((function(t){return t.why.equals(r)})))}));return o.length,Promise.all(o)}},{key:"constructSparqlUpdateQuery",value:function(t,e,r){var n=this.contextWhere(r),i="";if(n.length){if(t.length){i+="DELETE { ";for(var o=0;o.\n@prefix ex: .\n\n_:patch\n";return r&&r.length>0&&(i+="\n solid:where {\n ".concat(r.map((function(t){return n.anonymizeNT(t)})).join("\n "),"\n };")),t.length>0&&(i+="\n solid:deletes {\n ".concat(t.map((function(t){return n.anonymizeNT(t)})).join("\n "),"\n };")),e.length>0&&(i+="\n solid:inserts {\n ".concat(e.map((function(t){return n.anonymizeNT(t)})).join("\n "),"\n };")),i+" a solid:InsertDeletePatch .\n"}},{key:"update",value:function(t,e,r,n){var i=this,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if(!r){var a=this;return new Promise((function(r,i){a.update(t,e,(function(t,e,n){e?r():i(new Error(n))}),n,o)}))}try{var s=this.store,u=t?(0,v.ok)(t)?t.statements:t instanceof Array?t:[t]:[],c=e?(0,v.ok)(e)?e.statements:e instanceof Array?e:[e]:[];if(!(u instanceof Array))throw new Error("Type Error "+(0,d.A)(u)+": "+u);if(!(c instanceof Array))throw new Error("Type Error "+(0,d.A)(c)+": "+c);if(0===u.length&&0===c.length)return r(null,!0);var l=u.length?u[0].graph:c[0].graph;if(!l){var h="Error patching: statement does not specify which document to patch:"+u[0]+", "+c[0];throw new Error(h)}if("NamedNode"!==l.termType){var f="Error patching: document not a NamedNode:"+u[0]+", "+c[0];throw new Error(f)}var p=this.patchControlFor(l),y=Date.now(),g=["subject","predicate","object","why"],m={delete:u,insert:c};["insert","delete"].map((function(t){m[t].map((function(t){if(!l.equals(t.graph))throw new Error("update: destination "+l+" inconsistent with delete quad "+t.graph);g.map((function(e){if(void 0===t[e])throw new Error("update: undefined "+e+" of statement.")}))}))}));var b=this.editable(l.value,s);if(!1===b)throw new Error("Update: Can't make changes in uneditable "+l);if(void 0===b){if(n)throw new Error("Update: Loaded "+l+"but still can't figure out what editing protocol it supports.");return void this.store.fetcher.load(l).then((function(n){i.update(t,e,r,!0,o)}),(function(n){if(404!==n.response.status)throw new Error("Update: Can't get updatability status ".concat(l," before patching: ").concat(n));i.update(t,e,r,!0,o)}))}if(b.indexOf("SPARQL")>=0||b.indexOf("N3PATCH")>=0){var w=b.indexOf("SPARQL")>=0,A=[];u.length&&(A=this.statementArrayBnodes(u)),c.length&&(A=A.concat(this.statementArrayBnodes(c)));var x=this.bnodeContext(A,l),_=w?this.constructSparqlUpdateQuery(u,c,x):this.constructN3PatchQuery(u,c,x);o.contentType=w?"application/sparql-update":"text/n3",p.pendingUpstream=p.pendingUpstream?p.pendingUpstream+1:1,"upstreamCount"in p&&(p.upstreamCount+=1),this.fire(l.value,_,(function(t,e,n,i){if(i.elapsedTimeMs=Date.now()-y,e){try{s.remove(u)}catch(t){e=!1,n="Remote Ok BUT error deleting "+u.length+" from store!!! "+t}for(var o=0;o=0)this.updateDav(l,u,c,r,o);else{if(!(b.indexOf("LOCALFILE")>=0))throw new Error("Unhandled edit method: '"+b+"' for "+l);try{this.updateLocalFile(l,u,c,r,o)}catch(t){r(l.value,!1,"Exception trying to write back file <"+l.value+">\n")}}}catch(t){r(void 0,!1,"Exception in update: "+t+"\n"+Q.stackString(t))}}},{key:"updateDav",value:function(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=this.store,a=o.any(t,this.ns.link("request"));if(!a)throw new Error("No record of our HTTP GET request for document: "+t);var s=o.any(a,this.ns.link("response"));if(!s)return null;for(var u=o.the(s,this.ns.httph("content-type")).value,c=o.statementsMatching(void 0,void 0,void 0,t).slice(),l=0;l4&&void 0!==arguments[4]?arguments[4]:{},o=this.store,a=o.statementsMatching(void 0,void 0,void 0,t).slice(),s=0;s0&&void 0!==arguments[0]?arguments[0]:void 0,(arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0)||{rdfFactory:re})},lit:function(t,e,r){return this.literal(""+t,e||r)},st:function(t,e,r,n){return this.quad(t,e,r,n)}});const xr=Ar;var _r=function(){return(0,t.A)((function t(r,n){(0,e.A)(this,t),this.parent=r,this.via=n,this.connected=!1,this.pending={},this.subscribed={},this.socket={};try{this.socket=new WebSocket(n),this.socket.onopen=this.onOpen,this.socket.onclose=this.onClose,this.socket.onmessage=this.onMessage,this.socket.onerror=this.onError}catch(t){this.onError(t)}}),[{key:"_decode",value:function(t){var e,r,n,i,o,a,s;for(r in i={},o=function(){var r,n,i,o;for(o=[],r=0,n=(i=t.split("&")).length;r(()=>{var e,r,n,i,o={9390:(t,e,r)=>{"use strict";r.d(e,{A:()=>n});const n={Literal:1,Collection:3,Graph:4,NamedNode:5,BlankNode:6,Variable:7}},3787:(t,e,r)=>{"use strict";r.d(e,{A:()=>n});const n={debug:function(t){},warn:function(t){},info:function(t){},error:function(t){},success:function(t){},msg:function(t){}}},3627:(t,e,r)=>{"use strict";r.d(e,{A:()=>v});var n=r(9121),i=r(2937),o=r(365),a=r(8782),s=r(9604),u=r(8175),c=r(9390),l=r(1605),h=r(6866),f=r(362),p=r(546);function d(t,e,r){return e=(0,a.A)(e),(0,o.A)(t,y()?Reflect.construct(e,r||[],(0,a.A)(t).constructor):e.apply(t,r))}function y(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(y=function(){return!!t})()}var v=function(t){function e(t){var r;if((0,n.A)(this,e),r=d(this,e,[(0,f.E)(t)]),(0,u.A)(r,"termType",h.Kk),(0,u.A)(r,"classOrder",c.A.NamedNode),!r.value)throw new Error("Missing IRI for NamedNode");if(!r.value.includes(":"))throw new Error('NamedNode IRI "'+t+'" must be absolute.');if(r.value.includes(" "))throw new Error('Error: NamedNode IRI "'+t+'" must not contain unencoded spaces.');return r}return(0,s.A)(e,t),(0,i.A)(e,[{key:"dir",value:function(){var t=this.value.split("#")[0],r=t.slice(0,-1).lastIndexOf("/"),n=t.indexOf("//");return n>=0&&r"}},{key:"id",value:function(){return this.value.split("#")[1]}},{key:"uri",get:function(){return this.value},set:function(t){this.value=t}}],[{key:"fromValue",value:function(t){return null==t||(0,p.D0)(t)?t:new e(t)}}])}(l.A)},1605:(t,e,r)=>{"use strict";r.d(e,{A:()=>a});var n=r(9121),i=r(2937),o=r(8175),a=function(){return(0,i.A)((function t(e){(0,n.A)(this,t),(0,o.A)(this,"termType",void 0),(0,o.A)(this,"classOrder",void 0),(0,o.A)(this,"value",void 0),this.value=e}),[{key:"substitute",value:function(t){return this}},{key:"compareTerm",value:function(t){return this.classOrdert.classOrder?1:this.valuet.value?1:0}},{key:"equals",value:function(t){return!!t&&this.termType===t.termType&&this.value===t.value}},{key:"hashString",value:function(){return this.toCanonical()}},{key:"sameTerm",value:function(t){return this.equals(t)}},{key:"toCanonical",value:function(){return this.toNT()}},{key:"toNT",value:function(){return this.toString()}},{key:"toNQ",value:function(){return this.toNT()}},{key:"toString",value:function(){throw new Error("Node.toString() is abstract - see the subclasses instead")}}])}();(0,o.A)(a,"fromValue",void 0),(0,o.A)(a,"toJS",void 0)},6866:(t,e,r)=>{"use strict";r.d(e,{$Q:()=>i,BR:()=>y,Fn:()=>w,H:()=>_,JG:()=>m,K9:()=>b,Kk:()=>n,MG:()=>d,P2:()=>a,QW:()=>o,S:()=>c,_0:()=>v,bD:()=>l,bM:()=>g,hu:()=>x,i2:()=>f,ic:()=>s,lc:()=>h,ny:()=>p,r0:()=>u,sT:()=>A});var n="NamedNode",i="BlankNode",o="Literal",a="Variable",s="DefaultGraph",u="Collection",c="Empty",l="Graph",h="text/html",f="application/ld+json",p="text/n3",d="application/n3",y="application/nquads",v="application/n-quads",g="application/n-triples",m="application/rdf+xml",b="application/sparql-update",w="application/sparql-update-single-match",A="text/turtle",x="application/x-turtle",_="application/xhtml+xml"},4221:(t,e,r)=>{"use strict";r.r(e),r.d(e,{docpart:()=>a,document:()=>s,hostpart:()=>u,join:()=>c,protocol:()=>l,refTo:()=>h});var n=r(3627),i=r(6357),o=o||i.log;function a(t){var e;return(e=t.indexOf("#"))<0?t:t.slice(0,e)}function s(t){return new n.A(a(t))}function u(t){var e=/[^\/]*\/\/([^\/]*)\//.exec(t);return e?e[1]:""}function c(t,e){var r,n,i,a,s,u=e.indexOf("#");if(u>0&&(e=e.slice(0,u)),0===t.length)return e;if(0===t.indexOf("#"))return e+t;if(t.indexOf(":")>=0)return t;if(r=e.indexOf(":"),0===e.length)return t;if(r<0)return o("Invalid base: "+e+" in join with given: "+t),t;if(n=e.slice(0,+r+1||9e9),0===t.indexOf("//"))return n+t;if(e.indexOf("//",r)===r+1){if((i=e.indexOf("/",r+3))<0)return e.length-r-3>0?e+"/"+t:n+t}else if((i=e.indexOf("/",r+1))<0)return e.length-r-1>0?e+"/"+t:n+t;if(0===t.indexOf("/"))return e.slice(0,i)+t;if((a=(s=e.slice(i)).lastIndexOf("/"))<0)return n+t;for(a>=0&&a0&&"/"!==e[r-1];)r--;if(r<3)return e;if(t.indexOf("//",r-2)>0||e.indexOf("//",r-2)>0)return e;if(t.indexOf(":",r)>0)return e;for(s=0,c=0,a=(h=t.slice(r)).length;c0)for(l=1,f=s;f>=1?l<=f:l>=f;f>=1?++l:--l)p+="../";return p+e.slice(r)}},7114:(t,e,r)=>{"use strict";r.r(e),r.d(e,{DOMParserFactory:()=>f,RDFArrayRemove:()=>w,callbackify:()=>h,domToString:()=>p,dtstamp:()=>y,dumpNode:()=>d,heavyCompare:()=>v,heavyCompareSPO:()=>g,linkRelationProperty:()=>l,log:()=>n.A,mediaTypeClass:()=>c,output:()=>m,parseXML:()=>b,stackString:()=>x,string:()=>u,string_startswith:()=>A,uri:()=>i});var n=r(3787),i=r(4221),o=r(3627),a=r(8392);t=r.hmd(t);var s=r(6357),u={template:function(t,e){for(var r=t.split("%s"),n="",i=0;i=0;r--)t.callbacks[e[r]]=[];t.addHook=function(e){t.callbacks[e]||(t.callbacks[e]=[])},t.addCallback=function(e,r){t.callbacks[e].push(r)},t.removeCallback=function(e,r){for(var n=0;n=0;n--)(i=t.callbacks[e][n])&&i.apply(t,r)&&o.push(i);for(n=o.length-1;n>=0;n--)a.push(o[n]);for(n=s;n=0;i--){var l=t.attributes[i];if(!(n&&n.length>0&&n[l.name]||/^\d+$/.test(l.name))){if("class"===l.name&&e&&e.replaceClassItemWith&&l.value.split(" ").indexOf(e.replaceClassItemWith.source)>-1){var h=new RegExp(e.replaceClassItemWith.source,"g");l.value=l.value.replace(h,e.replaceClassItemWith.target).trim()}"class"===l.name&&e&&e.skipClassWithValue&&e.skipClassWithValue===l.value||c.push(l.name+"='"+l.value.replace(/&/g,"&").replace(//g,">").replace(/'/g,""")+"'")}}if(c.length>0&&(e&&e.sortAttributes&&c.sort((function(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())})),o+=" "+c.join(" ")),r&&r.ename)o+=" />";else{for(o+=">",o+="html"===u?"\n ":"",a.push("style"===u||"script"===u),i=0;i\n":""}}}else if(8===t.nodeType)o+="\x3c!--"+t.nodeValue+"--\x3e";else if(3===t.nodeType||4===t.nodeType){var f=t.nodeValue.replace(/\n+$/,"");o+=a[a.length-1]?f:f.replace(/&/g,"&").replace(//g,">")}else s.log("Warning; Cannot handle serialising nodes of type: "+t.nodeType),s.log(t);return o}function y(){var t=new Date,e=t.getYear()+1900,r=t.getMonth()+1,n=t.getDate(),i=t.getUTCHours(),o=t.getUTCMinutes(),a=t.getSeconds();return r<10&&(r="0"+r),n<10&&(n="0"+n),i<10&&(i="0"+i),o<10&&(o="0"+o),a<10&&(a="0"+a),e+"-"+r+"-"+n+"T"+i+":"+o+":"+a+"Z"}function v(t,e,r,n){var i=function(t){return"BlankNode"===t.termType?null:t},o=function(t){var e=r.statementsMatching(t).map((function(t){return i(t.subject)+" "+i(t.predicate)+" "+i(t.object)})).concat(r.statementsMatching(void 0,void 0,t).map((function(t){return i(t.subject)+" "+i(t.predicate)+" "+i(t.object)})));return e.sort(),e.join("\n")},a=Object.prototype.hasOwnProperty.call(r,"compareTerms")?r.compareTerms(t,e):t.compareTerm(e);return"BlankNode"===t.termType&&"BlankNode"===e.termType?0===a?0:o(t)>o(e)?1:o(t)-1)break;"("==o.charAt(0)&&(o="function"+o);var a=o.split("@");n.push(a)}for(i=0;i{"use strict";function n(t){return"string"==typeof t?t:t.value}r.d(e,{E:()=>n})},546:(t,e,r)=>{"use strict";r.d(e,{CZ:()=>c,D0:()=>f,DJ:()=>u,DZ:()=>h,GE:()=>b,P3:()=>s,RN:()=>w,SH:()=>o,Y2:()=>y,YC:()=>m,aF:()=>d,c$:()=>p,fY:()=>l,hr:()=>g,jt:()=>v,ok:()=>a});var n=r(4360),i=r(6866);function o(t){return"object"===(0,n.A)(t)&&null!==t&&"subject"in t}function a(t){return"object"===(0,n.A)(t)&&null!==t&&"statements"in t}function s(t){return f(t)&&t.termType===i.r0}function u(t){return t&&Object.prototype.hasOwnProperty.call(t,"termType")&&(t.termType===i.Kk||t.termType===i.P2||t.termType===i.$Q||t.termType===i.r0||t.termType===i.QW||t.termType===i.bD)}function c(t){return t&&Object.prototype.hasOwnProperty.call(t,"termType")&&(t.termType===i.Kk||t.termType===i.P2||t.termType===i.$Q||t.termType===i.r0||t.termType===i.QW||t.termType===i.bD)}function l(t){return f(t)&&(t.termType===i.Kk||t.termType===i.$Q||t.termType===i.P2)}function h(t){return f(t)&&t.termType===i.P2}function f(t){return"object"===(0,n.A)(t)&&null!==t&&"termType"in t}function p(t){return t.termType===i.QW}function d(t){return"object"===(0,n.A)(t)&&null!==t&&"subject"in t&&"predicate"in t&&"object"in t}function y(t){return f(t)&&"NamedNode"===t.termType}function v(t){return f(t)&&"termType"in t&&"BlankNode"===t.termType}function g(t){return f(t)&&(t.termType===i.Kk||t.termType===i.P2||t.termType===i.$Q)}function m(t){return f(t)&&(t.termType===i.Kk||t.termType===i.P2)}function b(t){return f(t)&&(t.termType===i.Kk||t.termType===i.P2||t.termType===i.$Q||t.termType===i.QW)}function w(t){return f(t)&&(t.termType===i.Kk||t.termType===i.P2||t.termType===i.$Q||t.termType===i.ic)}},2312:function(t,e,r){var n,i;void 0===(i="function"==typeof(n=function(){"use strict";function t(e,r,n,i){this.message=e,this.expected=r,this.found=n,this.location=i,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t)}return function(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}(t,Error),t.buildMessage=function(t,e){var r={literal:function(t){return'"'+i(t.text)+'"'},class:function(t){var e,r="";for(e=0;e0){for(e=1,n=1;eArray.isArray(t))).forEach((t=>{t.forEach((t=>{e["@graph"].push(t)}))})),1===e["@graph"].length&&(Object.assign(e,e["@graph"][0]),delete e["@graph"]),e},c=".",l=Hr(".",!1),h=function(t){return t},f="#",p=Hr("#",!1),d=/^[^\n]/,y=$r(["\n"],!0,!1),v="\n",g=Hr("\n",!1),m=function(t){return t.join("")},b="@prefix",w=Hr("@prefix",!1),A=function(t,e){return _n.addPrefix(""===t?"0":t,e),{}},x="@base",_=Hr("@base",!1),k=function(t){return _n.addBase(t),{}},T=/^[Bb]/,E=$r(["B","b"],!1,!1),O=/^[Aa]/,j=$r(["A","a"],!1,!1),N=/^[Ss]/,S=$r(["S","s"],!1,!1),R=/^[Ee]/,I=$r(["E","e"],!1,!1),C=/^[Pp]/,P=$r(["P","p"],!1,!1),F=/^[Rr]/,U=$r(["R","r"],!1,!1),D=/^[Ff]/,L=$r(["F","f"],!1,!1),M=/^[Ii]/,B=$r(["I","i"],!1,!1),q=/^[Xx]/,H=$r(["X","x"],!1,!1),$=function(t,e){var r={};return"string"==typeof t&&"[]"!==t?r["@id"]=t:"object"==typeof t&&Object.assign(r,t),e&&Object.assign(r,e),[r]},z=function(t,e){var r={};return t&&Object.assign(r,t),e&&Object.assign(r,e),[r]},X=";",G=Hr(";",!1),V=function(t,e,r,n){var i={};return i[r]=n,i},W=function(t,e,r){return r},Q=function(t,e,r){var n={};return r.unshift(function(t,e){var r={};return r[t]=e,r}(t,e)),r.forEach((t=>{t&&Object.keys(t).forEach((e=>{t[e].forEach((t=>{"@type"===e&&void 0!==t["@id"]&&(t=t["@id"]),void 0===n[e]?n[e]=t:Array.isArray(n[e])?n[e].push(t):n[e]=[n[e],t]}))}))})),n},Y=",",J=Hr(",",!1),Z=function(t,e){return e},K=function(t,e){return e.unshift(t),e},tt="a",et=Hr("a",!1),rt=function(){return"@type"},nt=function(t){return kn(t,!0)},it=function(t){return kn(t,!1)},ot=function(t){return"[]"===t?{}:{"@id":t}},at=function(t){return{"@id":t}},st="[",ut=Hr("[",!1),ct="]",lt=Hr("]",!1),ht="(",ft=Hr("(",!1),pt=")",dt=Hr(")",!1),yt=function(t){return{"@list":t}},vt=function(t,e){return{"@value":t,"@language":e}},gt="^^",mt=Hr("^^",!1),bt=function(t,e){if("http://www.w3.org/2001/XMLSchema#boolean"===e&&"true"===t)return!0;if("http://www.w3.org/2001/XMLSchema#boolean"===e&&"false"===t)return!1;if("http://www.w3.org/2001/XMLSchema#integer"===e)return parseInt(t);if("http://www.w3.org/2001/XMLSchema#double"===e)return parseFloat(t);const r=_n.resolve(e,!0);if(r){const n=e.split(":")[0];if("http://www.w3.org/2001/XMLSchema#boolean"===r&&"true"===t)return _n.decrement(n),!0;if("http://www.w3.org/2001/XMLSchema#boolean"===r&&"false"===t)return _n.decrement(n),!1;if("http://www.w3.org/2001/XMLSchema#integer"===r)return _n.decrement(n),parseInt(t);if("http://www.w3.org/2001/XMLSchema#double"===r)return _n.decrement(n),parseFloat(t)}return{"@value":t,"@type":e}},wt="true",At=Hr("true",!1),xt=function(){return!0},_t="false",kt=Hr("false",!1),Tt=function(){return!1},Et=function(t){return t+":"},Ot="<",jt=Hr("<",!1),Nt=/^[^\0- <>"{}|\^`\\]/,St=$r([["\0"," "],"<",">",'"',"{","}","|","^","`","\\"],!0,!1),Rt=">",It=Hr(">",!1),Ct=function(t){const e=t.map((t=>65536<=t.codePointAt(0)&&t.codePointAt(0)<=983039?"a":1===t.length?t:6===t.length?String.fromCharCode("0x"+t.substring(2)):10===t.length?String.fromCodePoint("0x"+t.substring(2)):t)).join("");if(e.match(/^[^\u0000-\u0020<>"{}|^`\\]*$/)){var r=t.join("");try{return _n.resolve(r)}catch(t){qr("Invalid IRIREF "+r)}}else qr("Invalid IRIREF "+t.join("")+" / "+e)},Pt=":",Ft=Hr(":",!1),Ut=function(t){return t=t||"0",!1===_n.hasPrefix(t)&&qr("undefined prefix "+t),t},Dt=function(t){return t||""},Lt=function(t,e){return _n.increment(t),_n.resolve(t+":"+e)},Mt="_:",Bt=Hr("_:",!1),qt=/^[0-9]/,Ht=$r([["0","9"]],!1,!1),$t="@",zt=Hr("@",!1),Xt=/^[a-zA-Z]/,Gt=$r([["a","z"],["A","Z"]],!1,!1),Vt="-",Wt=Hr("-",!1),Qt=/^[a-zA-Z0-9]/,Yt=$r([["a","z"],["A","Z"],["0","9"]],!1,!1),Jt=function(t,e){return"-"+e.join("")},Zt=function(t,e){return t.join("")+e.join("")},Kt=/^[+\-]/,te=$r(["+","-"],!1,!1),ee=function(t){return t.match(/^[0+][0-9]+$/)?{"@value":t,"@type":"http://www.w3.org/2001/XMLSchema#integer"}:parseInt(t)},re=function(t){return{"@value":t,"@type":"http://www.w3.org/2001/XMLSchema#decimal"}},ne=function(t){return{"@value":t,"@type":"http://www.w3.org/2001/XMLSchema#double"}},ie=/^[eE]/,oe=$r(["e","E"],!1,!1),ae='"',se=Hr('"',!1),ue=/^[^"\\\n\r]/,ce=$r(['"',"\\","\n","\r"],!0,!1),le="'",he=Hr("'",!1),fe=/^[^'\\\n\r]/,pe=$r(["'","\\","\n","\r"],!0,!1),de="'''",ye=Hr("'''",!1),ve=/^[^'\\]/,ge=$r(["'","\\"],!0,!1),me="''",be=Hr("''",!1),we=function(t,e){return"''"+e.join("")},Ae=function(t,e){return"'"+e.join("")},xe=function(t,e){return t.join("")+e.join("")},_e='"""',ke=Hr('"""',!1),Te=/^[^"\\]/,Ee=$r(['"',"\\"],!0,!1),Oe='""',je=Hr('""',!1),Ne=function(t,e){return'""'+e.join("")},Se=function(t,e){return'"'+e.join("")},Re="\\U",Ie=Hr("\\U",!1),Ce=function(t){return String.fromCodePoint(parseInt(t.join(""),16))},Pe="\\u",Fe=Hr("\\u",!1),Ue=function(t){return String.fromCharCode(parseInt(t.join(""),16))},De="\\t",Le=Hr("\\t",!1),Me=function(){return"\t"},Be="\\b",qe=Hr("\\b",!1),He=function(){return"\b"},$e="\\n",ze=Hr("\\n",!1),Xe=function(){return"\n"},Ge="\\r",Ve=Hr("\\r",!1),We=function(){return"\r"},Qe="\\f",Ye=Hr("\\f",!1),Je=function(){return"\f"},Ze='\\"',Ke=Hr('\\"',!1),tr=function(){return'"'},er="\\'",rr=Hr("\\'",!1),nr=function(){return"'"},ir="\\\\",or=Hr("\\\\",!1),ar=function(){return"\\"},sr=/^[ \t\r\n]/,ur=$r([" ","\t","\r","\n"],!1,!1),cr=function(){return"[]"},lr=/^[\uD800-\uDBFF]/,hr=$r([["\ud800","\udbff"]],!1,!1),fr=/^[\uDC00-\uDFFF]/,pr=$r([["\udc00","\udfff"]],!1,!1),dr=function(t,e){return t+e},yr=/^[A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,vr=$r([["A","Z"],["a","z"],["À","Ö"],["Ø","ö"],["ø","˿"],["Ͱ","ͽ"],["Ϳ","῿"],["‌","‍"],["⁰","↏"],["Ⰰ","⿯"],["、","퟿"],["豈","﷏"],["ﷰ","�"]],!1,!1),gr="_",mr=Hr("_",!1),br="·",wr=Hr("·",!1),Ar=/^[\u0300-\u036F]/,xr=$r([["̀","ͯ"]],!1,!1),_r=/^[\u203F-\u2040]/,kr=$r([["‿","⁀"]],!1,!1),Tr=function(t,e,r,n){return r.join("")+n.join("")},Er=function(t,e,r){return t+e.join("")+r.join("")},Or="%",jr=Hr("%",!1),Nr=/^[0-9A-Fa-f]/,Sr=$r([["0","9"],["A","F"],["a","f"]],!1,!1),Rr="\\",Ir=Hr("\\",!1),Cr=/^[_~.!$&'()*+,;=\/?#@%\-]/,Pr=$r(["_","~",".","!","$","&","'","(",")","*","+",",",";","=","/","?","#","@","%","-"],!1,!1),Fr=0,Ur=0,Dr=[{line:1,column:1}],Lr=0,Mr=[],Br=0;if("startRule"in n){if(!(n.startRule in a))throw new Error("Can't start parsing from rule \""+n.startRule+'".');s=a[n.startRule]}function qr(e,r){throw function(e,r){return new t(e,null,null,r)}(e,r=void 0!==r?r:Xr(Ur,Fr))}function Hr(t,e){return{type:"literal",text:t,ignoreCase:e}}function $r(t,e,r){return{type:"class",parts:t,inverted:e,ignoreCase:r}}function zr(t){var r,n=Dr[t];if(n)return n;for(r=t-1;!Dr[r];)r--;for(n={line:(n=Dr[r]).line,column:n.column};rLr&&(Lr=Fr,Mr=[]),Mr.push(t))}function Vr(){var t,e,r,n;for(t=Fr,e=[],r=Wr();r!==o;)e.push(r),r=Wr();if(e!==o){for(r=[],n=Qr();n!==o;)r.push(n),n=Qr();r!==o?(Ur=t,t=e=u(e)):(Fr=t,t=o)}else Fr=t,t=o;return t}function Wr(){var t,r,n,i;if((t=function(){var t;return(t=function(){var t,r,n,i,a,s,u,h,f;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o)if(e.substr(Fr,7)===b?(n=b,Fr+=7):(n=o,0===Br&&Gr(w)),n!==o){for(i=[],a=Qr();a!==o;)i.push(a),a=Qr();if(i!==o)if((a=un())!==o){for(s=[],u=Qr();u!==o;)s.push(u),u=Qr();if(s!==o)if((u=an())!==o){for(h=[],f=Qr();f!==o;)h.push(f),f=Qr();h!==o?(46===e.charCodeAt(Fr)?(f=c,Fr++):(f=o,0===Br&&Gr(l)),f!==o?(Ur=t,t=r=A(a,u)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;else Fr=t,t=o}else Fr=t,t=o;else Fr=t,t=o}else Fr=t,t=o;else Fr=t,t=o;return t}())===o&&(t=function(){var t,r,n,i,a,s,u;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o)if(e.substr(Fr,5)===x?(n=x,Fr+=5):(n=o,0===Br&&Gr(_)),n!==o){for(i=[],a=Qr();a!==o;)i.push(a),a=Qr();if(i!==o)if((a=an())!==o){for(s=[],u=Qr();u!==o;)s.push(u),u=Qr();s!==o?(46===e.charCodeAt(Fr)?(u=c,Fr++):(u=o,0===Br&&Gr(l)),u!==o?(Ur=t,t=r=k(a)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;else Fr=t,t=o}else Fr=t,t=o;else Fr=t,t=o;return t}())===o&&(t=function(){var t,r,n,i,a,s,u,c,l,h,f,p;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o)if(C.test(e.charAt(Fr))?(n=e.charAt(Fr),Fr++):(n=o,0===Br&&Gr(P)),n!==o)if(F.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(U)),i!==o)if(R.test(e.charAt(Fr))?(a=e.charAt(Fr),Fr++):(a=o,0===Br&&Gr(I)),a!==o)if(D.test(e.charAt(Fr))?(s=e.charAt(Fr),Fr++):(s=o,0===Br&&Gr(L)),s!==o)if(M.test(e.charAt(Fr))?(u=e.charAt(Fr),Fr++):(u=o,0===Br&&Gr(B)),u!==o)if(q.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(H)),c!==o){for(l=[],h=Qr();h!==o;)l.push(h),h=Qr();if(l!==o)if((h=un())!==o){for(f=[],p=Qr();p!==o;)f.push(p),p=Qr();f!==o&&(p=an())!==o?(Ur=t,t=r=A(h,p)):(Fr=t,t=o)}else Fr=t,t=o;else Fr=t,t=o}else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;return t}())===o&&(t=function(){var t,r,n,i,a,s,u,c;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o)if(T.test(e.charAt(Fr))?(n=e.charAt(Fr),Fr++):(n=o,0===Br&&Gr(E)),n!==o)if(O.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(j)),i!==o)if(N.test(e.charAt(Fr))?(a=e.charAt(Fr),Fr++):(a=o,0===Br&&Gr(S)),a!==o)if(R.test(e.charAt(Fr))?(s=e.charAt(Fr),Fr++):(s=o,0===Br&&Gr(I)),s!==o){for(u=[],c=Qr();c!==o;)u.push(c),c=Qr();u!==o&&(c=an())!==o?(Ur=t,t=r=k(c)):(Fr=t,t=o)}else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;return t}()),t}())===o)if(t=Fr,(r=function(){var t,e,r;return t=Fr,(e=function(){var t,e;return t=Fr,(e=en())!==o&&(Ur=t,e=nt(e)),(t=e)===o&&(t=on())===o&&(t=nn()),t}())!==o&&(r=Yr())!==o?(Ur=t,t=e=$(e,r)):(Fr=t,t=o),t===o&&(t=Fr,(e=tn())!==o?((r=Yr())===o&&(r=null),r!==o?(Ur=t,t=e=z(e,r)):(Fr=t,t=o)):(Fr=t,t=o)),t}())!==o){for(n=[],i=Qr();i!==o;)n.push(i),i=Qr();n!==o?(46===e.charCodeAt(Fr)?(i=c,Fr++):(i=o,0===Br&&Gr(l)),i!==o?(Ur=t,t=r=h(r)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;return t}function Qr(){var t;return(t=function(){var t;return sr.test(e.charAt(Fr))?(t=e.charAt(Fr),Fr++):(t=o,0===Br&&Gr(ur)),t}())===o&&(t=function(){var t,r,n,i;if(t=Fr,35===e.charCodeAt(Fr)?(r=f,Fr++):(r=o,0===Br&&Gr(p)),r!==o){for(n=[],d.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(y));i!==o;)n.push(i),d.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(y));n!==o?(10===e.charCodeAt(Fr)?(i=v,Fr++):(i=o,0===Br&&Gr(g)),i!==o?(Ur=t,t=r=m(n)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;return t}()),t}function Yr(){var t,r,n,i,a,s,u,c,l,h;if(t=Fr,(r=Zr())!==o)if((n=Jr())!==o){for(i=[],a=Fr,s=[],u=Qr();u!==o;)s.push(u),u=Qr();for(s!==o?(59===e.charCodeAt(Fr)?(u=X,Fr++):(u=o,0===Br&&Gr(G)),u!==o?(c=Fr,(l=Zr())!==o&&(h=Jr())!==o?(Ur=c,c=l=V(r,n,l,h)):(Fr=c,c=o),c===o&&(c=null),c!==o?(Ur=a,a=s=W(r,n,c)):(Fr=a,a=o)):(Fr=a,a=o)):(Fr=a,a=o);a!==o;){for(i.push(a),a=Fr,s=[],u=Qr();u!==o;)s.push(u),u=Qr();s!==o?(59===e.charCodeAt(Fr)?(u=X,Fr++):(u=o,0===Br&&Gr(G)),u!==o?(c=Fr,(l=Zr())!==o&&(h=Jr())!==o?(Ur=c,c=l=V(r,n,l,h)):(Fr=c,c=o),c===o&&(c=null),c!==o?(Ur=a,a=s=W(r,n,c)):(Fr=a,a=o)):(Fr=a,a=o)):(Fr=a,a=o)}i!==o?(Ur=t,t=r=Q(r,n,i)):(Fr=t,t=o)}else Fr=t,t=o;else Fr=t,t=o;return t}function Jr(){var t,r,n,i,a,s,u;if(t=Fr,(r=Kr())!==o){for(n=[],i=Fr,a=[],s=Qr();s!==o;)a.push(s),s=Qr();for(a!==o?(44===e.charCodeAt(Fr)?(s=Y,Fr++):(s=o,0===Br&&Gr(J)),s!==o&&(u=Kr())!==o?(Ur=i,i=a=Z(r,u)):(Fr=i,i=o)):(Fr=i,i=o);i!==o;){for(n.push(i),i=Fr,a=[],s=Qr();s!==o;)a.push(s),s=Qr();a!==o?(44===e.charCodeAt(Fr)?(s=Y,Fr++):(s=o,0===Br&&Gr(J)),s!==o&&(u=Kr())!==o?(Ur=i,i=a=Z(r,u)):(Fr=i,i=o)):(Fr=i,i=o)}n!==o?(Ur=t,t=r=K(r,n)):(Fr=t,t=o)}else Fr=t,t=o;return t}function Zr(){var t,r,n;if(t=Fr,(r=function(){var t,e,r;for(t=Fr,e=[],r=Qr();r!==o;)e.push(r),r=Qr();return e!==o&&(r=nn())!==o?(Ur=t,t=e=h(r)):(Fr=t,t=o),t}())!==o&&(Ur=t,r=h(r)),(t=r)===o){for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();r!==o?(97===e.charCodeAt(Fr)?(n=tt,Fr++):(n=o,0===Br&&Gr(et)),n!==o?(Ur=t,t=r=rt()):(Fr=t,t=o)):(Fr=t,t=o)}return t}function Kr(){var t,r;return(t=function(){var t;return(t=function(){var t,r,n,i,a,s,u;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o)if((n=rn())!==o){for(i=[],a=Qr();a!==o;)i.push(a),a=Qr();i!==o&&(a=function(){var t,r,n,i,a,s,u,c;if(t=Fr,64===e.charCodeAt(Fr)?(r=$t,Fr++):(r=o,0===Br&&Gr(zt)),r!==o){if(n=[],Xt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(Gt)),i!==o)for(;i!==o;)n.push(i),Xt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(Gt));else n=o;if(n!==o){if(i=[],a=Fr,45===e.charCodeAt(Fr)?(s=Vt,Fr++):(s=o,0===Br&&Gr(Wt)),s!==o){if(u=[],Qt.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Yt)),c!==o)for(;c!==o;)u.push(c),Qt.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Yt));else u=o;u!==o?(Ur=a,a=s=Jt(n,u)):(Fr=a,a=o)}else Fr=a,a=o;for(;a!==o;)if(i.push(a),a=Fr,45===e.charCodeAt(Fr)?(s=Vt,Fr++):(s=o,0===Br&&Gr(Wt)),s!==o){if(u=[],Qt.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Yt)),c!==o)for(;c!==o;)u.push(c),Qt.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Yt));else u=o;u!==o?(Ur=a,a=s=Jt(n,u)):(Fr=a,a=o)}else Fr=a,a=o;i!==o?(Ur=t,t=r=Zt(n,i)):(Fr=t,t=o)}else Fr=t,t=o}else Fr=t,t=o;return t}())!==o?(Ur=t,t=r=vt(n,a)):(Fr=t,t=o)}else Fr=t,t=o;else Fr=t,t=o;if(t===o){for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o)if((n=rn())!==o){for(i=[],a=Qr();a!==o;)i.push(a),a=Qr();if(i!==o)if(e.substr(Fr,2)===gt?(a=gt,Fr+=2):(a=o,0===Br&&Gr(mt)),a!==o){for(s=[],u=Qr();u!==o;)s.push(u),u=Qr();s!==o&&(u=nn())!==o?(Ur=t,t=r=bt(n,u)):(Fr=t,t=o)}else Fr=t,t=o;else Fr=t,t=o}else Fr=t,t=o;else Fr=t,t=o;if(t===o){for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();r!==o&&(n=rn())!==o?(Ur=t,t=r=h(n)):(Fr=t,t=o)}}return t}())===o&&(t=function(){var t,r,n;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();return r!==o?((n=function(){var t,r,n,i,a,s,u,h,f;if(t=Fr,r=Fr,n=Fr,Kt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(te)),i===o&&(i=null),i!==o){if(a=Fr,s=[],qt.test(e.charAt(Fr))?(u=e.charAt(Fr),Fr++):(u=o,0===Br&&Gr(Ht)),u!==o)for(;u!==o;)s.push(u),qt.test(e.charAt(Fr))?(u=e.charAt(Fr),Fr++):(u=o,0===Br&&Gr(Ht));else s=o;if(s!==o)if(46===e.charCodeAt(Fr)?(u=c,Fr++):(u=o,0===Br&&Gr(l)),u!==o){for(h=[],qt.test(e.charAt(Fr))?(f=e.charAt(Fr),Fr++):(f=o,0===Br&&Gr(Ht));f!==o;)h.push(f),qt.test(e.charAt(Fr))?(f=e.charAt(Fr),Fr++):(f=o,0===Br&&Gr(Ht));h!==o&&(f=cn())!==o?a=s=[s,u,h,f]:(Fr=a,a=o)}else Fr=a,a=o;else Fr=a,a=o;if(a===o){if(a=Fr,46===e.charCodeAt(Fr)?(s=c,Fr++):(s=o,0===Br&&Gr(l)),s!==o){if(u=[],qt.test(e.charAt(Fr))?(h=e.charAt(Fr),Fr++):(h=o,0===Br&&Gr(Ht)),h!==o)for(;h!==o;)u.push(h),qt.test(e.charAt(Fr))?(h=e.charAt(Fr),Fr++):(h=o,0===Br&&Gr(Ht));else u=o;u!==o&&(h=cn())!==o?a=s=[s,u,h]:(Fr=a,a=o)}else Fr=a,a=o;if(a===o){if(a=Fr,s=[],qt.test(e.charAt(Fr))?(u=e.charAt(Fr),Fr++):(u=o,0===Br&&Gr(Ht)),u!==o)for(;u!==o;)s.push(u),qt.test(e.charAt(Fr))?(u=e.charAt(Fr),Fr++):(u=o,0===Br&&Gr(Ht));else s=o;s!==o&&(u=cn())!==o?a=s=[s,u]:(Fr=a,a=o)}}a!==o?n=i=[i,a]:(Fr=n,n=o)}else Fr=n,n=o;return(r=n!==o?e.substring(r,Fr):n)!==o&&(Ur=t,r=ne(r)),r}())===o&&(n=function(){var t,r,n,i,a,s,u,h;if(t=Fr,r=Fr,n=Fr,Kt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(te)),i===o&&(i=null),i!==o){for(a=[],qt.test(e.charAt(Fr))?(s=e.charAt(Fr),Fr++):(s=o,0===Br&&Gr(Ht));s!==o;)a.push(s),qt.test(e.charAt(Fr))?(s=e.charAt(Fr),Fr++):(s=o,0===Br&&Gr(Ht));if(a!==o)if(46===e.charCodeAt(Fr)?(s=c,Fr++):(s=o,0===Br&&Gr(l)),s!==o){if(u=[],qt.test(e.charAt(Fr))?(h=e.charAt(Fr),Fr++):(h=o,0===Br&&Gr(Ht)),h!==o)for(;h!==o;)u.push(h),qt.test(e.charAt(Fr))?(h=e.charAt(Fr),Fr++):(h=o,0===Br&&Gr(Ht));else u=o;u!==o?n=i=[i,a,s,u]:(Fr=n,n=o)}else Fr=n,n=o;else Fr=n,n=o}else Fr=n,n=o;return(r=n!==o?e.substring(r,Fr):n)!==o&&(Ur=t,r=re(r)),r}())===o&&(n=function(){var t,r,n,i,a,s;if(t=Fr,r=Fr,n=Fr,Kt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(te)),i===o&&(i=null),i!==o){if(a=[],qt.test(e.charAt(Fr))?(s=e.charAt(Fr),Fr++):(s=o,0===Br&&Gr(Ht)),s!==o)for(;s!==o;)a.push(s),qt.test(e.charAt(Fr))?(s=e.charAt(Fr),Fr++):(s=o,0===Br&&Gr(Ht));else a=o;a!==o?n=i=[i,a]:(Fr=n,n=o)}else Fr=n,n=o;return(r=n!==o?e.substring(r,Fr):n)!==o&&(Ur=t,r=ee(r)),r}()),n!==o?(Ur=t,t=r=h(n)):(Fr=t,t=o)):(Fr=t,t=o),t}())===o&&(t=function(){var t,r,n;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o?(e.substr(Fr,4)===wt?(n=wt,Fr+=4):(n=o,0===Br&&Gr(At)),n!==o?(Ur=t,t=r=xt()):(Fr=t,t=o)):(Fr=t,t=o),t===o){for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();r!==o?(e.substr(Fr,5)===_t?(n=_t,Fr+=5):(n=o,0===Br&&Gr(kt)),n!==o?(Ur=t,t=r=Tt()):(Fr=t,t=o)):(Fr=t,t=o)}return t}()),t}())===o&&(t=Fr,(r=en())!==o&&(Ur=t,r=it(r)),(t=r)===o&&(t=Fr,(r=on())!==o&&(Ur=t,r=ot(r)),(t=r)===o&&(t=Fr,(r=tn())!==o&&(Ur=t,r=h(r)),(t=r)===o&&(t=Fr,(r=nn())!==o&&(Ur=t,r=at(r)),t=r)))),t}function tn(){var t,r,n,i,a,s;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o)if(91===e.charCodeAt(Fr)?(n=st,Fr++):(n=o,0===Br&&Gr(ut)),n!==o)if((i=Yr())!==o){for(a=[],s=Qr();s!==o;)a.push(s),s=Qr();a!==o?(93===e.charCodeAt(Fr)?(s=ct,Fr++):(s=o,0===Br&&Gr(lt)),s!==o?(Ur=t,t=r=h(i)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;else Fr=t,t=o;else Fr=t,t=o;return t}function en(){var t,r,n,i,a,s;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o)if(40===e.charCodeAt(Fr)?(n=ht,Fr++):(n=o,0===Br&&Gr(ft)),n!==o){for(i=[],a=Kr();a!==o;)i.push(a),a=Kr();if(i!==o){for(a=[],s=Qr();s!==o;)a.push(s),s=Qr();a!==o?(41===e.charCodeAt(Fr)?(s=pt,Fr++):(s=o,0===Br&&Gr(dt)),s!==o?(Ur=t,t=r=yt(i)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o}else Fr=t,t=o;else Fr=t,t=o;return t}function rn(){var t,r,n;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();return r!==o?((n=function(){var t,r,n,i,a,s,u,c;if(t=Fr,e.substr(Fr,3)===de?(r=de,Fr+=3):(r=o,0===Br&&Gr(ye)),r!==o){for(n=[],ve.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(ge)),i===o&&(i=hn())===o&&(i=ln());i!==o;)n.push(i),ve.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(ge)),i===o&&(i=hn())===o&&(i=ln());if(n!==o){if(i=[],a=Fr,e.substr(Fr,2)===me?(s=me,Fr+=2):(s=o,0===Br&&Gr(be)),s!==o){if(u=[],ve.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(ge)),c===o&&(c=hn())===o&&(c=ln()),c!==o)for(;c!==o;)u.push(c),ve.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(ge)),c===o&&(c=hn())===o&&(c=ln());else u=o;u!==o?(Ur=a,a=s=we(n,u)):(Fr=a,a=o)}else Fr=a,a=o;if(a===o)if(a=Fr,39===e.charCodeAt(Fr)?(s=le,Fr++):(s=o,0===Br&&Gr(he)),s!==o){if(u=[],ve.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(ge)),c===o&&(c=hn())===o&&(c=ln()),c!==o)for(;c!==o;)u.push(c),ve.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(ge)),c===o&&(c=hn())===o&&(c=ln());else u=o;u!==o?(Ur=a,a=s=Ae(n,u)):(Fr=a,a=o)}else Fr=a,a=o;for(;a!==o;){if(i.push(a),a=Fr,e.substr(Fr,2)===me?(s=me,Fr+=2):(s=o,0===Br&&Gr(be)),s!==o){if(u=[],ve.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(ge)),c===o&&(c=hn())===o&&(c=ln()),c!==o)for(;c!==o;)u.push(c),ve.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(ge)),c===o&&(c=hn())===o&&(c=ln());else u=o;u!==o?(Ur=a,a=s=we(n,u)):(Fr=a,a=o)}else Fr=a,a=o;if(a===o)if(a=Fr,39===e.charCodeAt(Fr)?(s=le,Fr++):(s=o,0===Br&&Gr(he)),s!==o){if(u=[],ve.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(ge)),c===o&&(c=hn())===o&&(c=ln()),c!==o)for(;c!==o;)u.push(c),ve.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(ge)),c===o&&(c=hn())===o&&(c=ln());else u=o;u!==o?(Ur=a,a=s=Ae(n,u)):(Fr=a,a=o)}else Fr=a,a=o}i!==o?(e.substr(Fr,3)===de?(a=de,Fr+=3):(a=o,0===Br&&Gr(ye)),a!==o?(Ur=t,t=r=xe(n,i)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o}else Fr=t,t=o;return t}())===o&&(n=function(){var t,r,n,i,a,s,u,c;if(t=Fr,e.substr(Fr,3)===_e?(r=_e,Fr+=3):(r=o,0===Br&&Gr(ke)),r!==o){for(n=[],Te.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(Ee)),i===o&&(i=hn())===o&&(i=ln());i!==o;)n.push(i),Te.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(Ee)),i===o&&(i=hn())===o&&(i=ln());if(n!==o){if(i=[],a=Fr,e.substr(Fr,2)===Oe?(s=Oe,Fr+=2):(s=o,0===Br&&Gr(je)),s!==o){if(u=[],Te.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Ee)),c===o&&(c=hn())===o&&(c=ln()),c!==o)for(;c!==o;)u.push(c),Te.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Ee)),c===o&&(c=hn())===o&&(c=ln());else u=o;u!==o?(Ur=a,a=s=Ne(n,u)):(Fr=a,a=o)}else Fr=a,a=o;if(a===o)if(a=Fr,34===e.charCodeAt(Fr)?(s=ae,Fr++):(s=o,0===Br&&Gr(se)),s!==o){if(u=[],Te.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Ee)),c===o&&(c=hn())===o&&(c=ln()),c!==o)for(;c!==o;)u.push(c),Te.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Ee)),c===o&&(c=hn())===o&&(c=ln());else u=o;u!==o?(Ur=a,a=s=Se(n,u)):(Fr=a,a=o)}else Fr=a,a=o;for(;a!==o;){if(i.push(a),a=Fr,e.substr(Fr,2)===Oe?(s=Oe,Fr+=2):(s=o,0===Br&&Gr(je)),s!==o){if(u=[],Te.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Ee)),c===o&&(c=hn())===o&&(c=ln()),c!==o)for(;c!==o;)u.push(c),Te.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Ee)),c===o&&(c=hn())===o&&(c=ln());else u=o;u!==o?(Ur=a,a=s=Ne(n,u)):(Fr=a,a=o)}else Fr=a,a=o;if(a===o)if(a=Fr,34===e.charCodeAt(Fr)?(s=ae,Fr++):(s=o,0===Br&&Gr(se)),s!==o){if(u=[],Te.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Ee)),c===o&&(c=hn())===o&&(c=ln()),c!==o)for(;c!==o;)u.push(c),Te.test(e.charAt(Fr))?(c=e.charAt(Fr),Fr++):(c=o,0===Br&&Gr(Ee)),c===o&&(c=hn())===o&&(c=ln());else u=o;u!==o?(Ur=a,a=s=Se(n,u)):(Fr=a,a=o)}else Fr=a,a=o}i!==o?(e.substr(Fr,3)===_e?(a=_e,Fr+=3):(a=o,0===Br&&Gr(ke)),a!==o?(Ur=t,t=r=xe(n,i)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o}else Fr=t,t=o;return t}())===o&&(n=function(){var t,r,n,i;if(t=Fr,39===e.charCodeAt(Fr)?(r=le,Fr++):(r=o,0===Br&&Gr(he)),r!==o){for(n=[],fe.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(pe)),i===o&&(i=hn())===o&&(i=ln());i!==o;)n.push(i),fe.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(pe)),i===o&&(i=hn())===o&&(i=ln());n!==o?(39===e.charCodeAt(Fr)?(i=le,Fr++):(i=o,0===Br&&Gr(he)),i!==o?(Ur=t,t=r=m(n)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;return t}())===o&&(n=function(){var t,r,n,i;if(t=Fr,34===e.charCodeAt(Fr)?(r=ae,Fr++):(r=o,0===Br&&Gr(se)),r!==o){for(n=[],ue.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(ce)),i===o&&(i=hn())===o&&(i=ln());i!==o;)n.push(i),ue.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(ce)),i===o&&(i=hn())===o&&(i=ln());n!==o?(34===e.charCodeAt(Fr)?(i=ae,Fr++):(i=o,0===Br&&Gr(se)),i!==o?(Ur=t,t=r=m(n)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;return t}()),n!==o?(Ur=t,t=r=h(n)):(Fr=t,t=o)):(Fr=t,t=o),t}function nn(){var t,r,n;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o&&(n=an())!==o?(Ur=t,t=r=h(n)):(Fr=t,t=o),t===o){for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();r!==o&&(n=function(){var t,r;return(t=function(){var t,r,n;return t=Fr,(r=sn())!==o&&(n=function(){var t,r,n,i,a,s,u,h;if(t=Fr,(r=pn())===o&&(58===e.charCodeAt(Fr)?(r=Pt,Fr++):(r=o,0===Br&&Gr(Ft)),r===o&&(qt.test(e.charAt(Fr))?(r=e.charAt(Fr),Fr++):(r=o,0===Br&&Gr(Ht)),r===o&&(r=vn()))),r!==o){for(n=[],(i=dn())===o&&(58===e.charCodeAt(Fr)?(i=Pt,Fr++):(i=o,0===Br&&Gr(Ft)),i===o&&(i=vn()));i!==o;)n.push(i),(i=dn())===o&&(58===e.charCodeAt(Fr)?(i=Pt,Fr++):(i=o,0===Br&&Gr(Ft)),i===o&&(i=vn()));if(n!==o){if(i=[],a=Fr,s=[],46===e.charCodeAt(Fr)?(u=c,Fr++):(u=o,0===Br&&Gr(l)),u!==o)for(;u!==o;)s.push(u),46===e.charCodeAt(Fr)?(u=c,Fr++):(u=o,0===Br&&Gr(l));else s=o;if(s!==o){if(u=[],(h=dn())===o&&(58===e.charCodeAt(Fr)?(h=Pt,Fr++):(h=o,0===Br&&Gr(Ft)),h===o&&(h=vn())),h!==o)for(;h!==o;)u.push(h),(h=dn())===o&&(58===e.charCodeAt(Fr)?(h=Pt,Fr++):(h=o,0===Br&&Gr(Ft)),h===o&&(h=vn()));else u=o;u!==o?(Ur=a,a=s=Tr(r,n,s,u)):(Fr=a,a=o)}else Fr=a,a=o;for(;a!==o;){if(i.push(a),a=Fr,s=[],46===e.charCodeAt(Fr)?(u=c,Fr++):(u=o,0===Br&&Gr(l)),u!==o)for(;u!==o;)s.push(u),46===e.charCodeAt(Fr)?(u=c,Fr++):(u=o,0===Br&&Gr(l));else s=o;if(s!==o){if(u=[],(h=dn())===o&&(58===e.charCodeAt(Fr)?(h=Pt,Fr++):(h=o,0===Br&&Gr(Ft)),h===o&&(h=vn())),h!==o)for(;h!==o;)u.push(h),(h=dn())===o&&(58===e.charCodeAt(Fr)?(h=Pt,Fr++):(h=o,0===Br&&Gr(Ft)),h===o&&(h=vn()));else u=o;u!==o?(Ur=a,a=s=Tr(r,n,s,u)):(Fr=a,a=o)}else Fr=a,a=o}i!==o?(Ur=t,t=r=Er(r,n,i)):(Fr=t,t=o)}else Fr=t,t=o}else Fr=t,t=o;return t}())!==o?(Ur=t,t=r=Lt(r,n)):(Fr=t,t=o),t}())===o&&(t=Fr,(r=sn())!==o&&(Ur=t,r=Et(r)),t=r),t}())!==o?(Ur=t,t=r=h(n)):(Fr=t,t=o)}return t}function on(){var t,r,n;for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();if(r!==o&&(n=function(){var t,r,n,i,a,s,u,h,f,p;if(t=Fr,r=Fr,e.substr(Fr,2)===Mt?(n=Mt,Fr+=2):(n=o,0===Br&&Gr(Bt)),n!==o)if((i=pn())===o&&(qt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(Ht))),i!==o){for(a=[],s=dn();s!==o;)a.push(s),s=dn();if(a!==o){if(s=[],u=Fr,h=[],46===e.charCodeAt(Fr)?(f=c,Fr++):(f=o,0===Br&&Gr(l)),f!==o)for(;f!==o;)h.push(f),46===e.charCodeAt(Fr)?(f=c,Fr++):(f=o,0===Br&&Gr(l));else h=o;if(h!==o){if(f=[],(p=dn())!==o)for(;p!==o;)f.push(p),p=dn();else f=o;f!==o?u=h=[h,f]:(Fr=u,u=o)}else Fr=u,u=o;for(;u!==o;){if(s.push(u),u=Fr,h=[],46===e.charCodeAt(Fr)?(f=c,Fr++):(f=o,0===Br&&Gr(l)),f!==o)for(;f!==o;)h.push(f),46===e.charCodeAt(Fr)?(f=c,Fr++):(f=o,0===Br&&Gr(l));else h=o;if(h!==o){if(f=[],(p=dn())!==o)for(;p!==o;)f.push(p),p=dn();else f=o;f!==o?u=h=[h,f]:(Fr=u,u=o)}else Fr=u,u=o}s!==o?r=n=[n,i,a,s]:(Fr=r,r=o)}else Fr=r,r=o}else Fr=r,r=o;else Fr=r,r=o;return r!==o?e.substring(t,Fr):r}())!==o?(Ur=t,t=r=h(n)):(Fr=t,t=o),t===o){for(t=Fr,r=[],n=Qr();n!==o;)r.push(n),n=Qr();r!==o&&(n=function(){var t,r,n,i;if(t=Fr,91===e.charCodeAt(Fr)?(r=st,Fr++):(r=o,0===Br&&Gr(ut)),r!==o){for(n=[],i=Qr();i!==o;)n.push(i),i=Qr();n!==o?(93===e.charCodeAt(Fr)?(i=ct,Fr++):(i=o,0===Br&&Gr(lt)),i!==o?(Ur=t,t=r=cr()):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;return t}())!==o?(Ur=t,t=r=h(n)):(Fr=t,t=o)}return t}function an(){var t,r,n,i;if(t=Fr,60===e.charCodeAt(Fr)?(r=Ot,Fr++):(r=o,0===Br&&Gr(jt)),r!==o){for(n=[],Nt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(St)),i===o&&(i=ln());i!==o;)n.push(i),Nt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(St)),i===o&&(i=ln());n!==o?(62===e.charCodeAt(Fr)?(i=Rt,Fr++):(i=o,0===Br&&Gr(It)),i!==o?(Ur=t,t=r=Ct(n)):(Fr=t,t=o)):(Fr=t,t=o)}else Fr=t,t=o;return t}function sn(){var t,r,n;return t=Fr,(r=yn())===o&&(r=null),r!==o?(58===e.charCodeAt(Fr)?(n=Pt,Fr++):(n=o,0===Br&&Gr(Ft)),n!==o?(Ur=t,t=r=Ut(r)):(Fr=t,t=o)):(Fr=t,t=o),t}function un(){var t,r,n;return t=Fr,(r=yn())===o&&(r=null),r!==o?(58===e.charCodeAt(Fr)?(n=Pt,Fr++):(n=o,0===Br&&Gr(Ft)),n!==o?(Ur=t,t=r=Dt(r)):(Fr=t,t=o)):(Fr=t,t=o),t}function cn(){var t,r,n,i,a,s;if(t=Fr,r=Fr,ie.test(e.charAt(Fr))?(n=e.charAt(Fr),Fr++):(n=o,0===Br&&Gr(oe)),n!==o)if(Kt.test(e.charAt(Fr))?(i=e.charAt(Fr),Fr++):(i=o,0===Br&&Gr(te)),i===o&&(i=null),i!==o){if(a=[],qt.test(e.charAt(Fr))?(s=e.charAt(Fr),Fr++):(s=o,0===Br&&Gr(Ht)),s!==o)for(;s!==o;)a.push(s),qt.test(e.charAt(Fr))?(s=e.charAt(Fr),Fr++):(s=o,0===Br&&Gr(Ht));else a=o;a!==o?r=n=[n,i,a]:(Fr=r,r=o)}else Fr=r,r=o;else Fr=r,r=o;return r!==o?e.substring(t,Fr):r}function ln(){var t,r,n,i,a,s,u,c,l,h,f;return t=Fr,e.substr(Fr,2)===Re?(r=Re,Fr+=2):(r=o,0===Br&&Gr(Ie)),r!==o?(n=Fr,(i=gn())!==o&&(a=gn())!==o&&(s=gn())!==o&&(u=gn())!==o&&(c=gn())!==o&&(l=gn())!==o&&(h=gn())!==o&&(f=gn())!==o?n=i=[i,a,s,u,c,l,h,f]:(Fr=n,n=o),n!==o?(Ur=t,t=r=Ce(n)):(Fr=t,t=o)):(Fr=t,t=o),t===o&&(t=Fr,e.substr(Fr,2)===Pe?(r=Pe,Fr+=2):(r=o,0===Br&&Gr(Fe)),r!==o?(n=Fr,(i=gn())!==o&&(a=gn())!==o&&(s=gn())!==o&&(u=gn())!==o?n=i=[i,a,s,u]:(Fr=n,n=o),n!==o?(Ur=t,t=r=Ue(n)):(Fr=t,t=o)):(Fr=t,t=o)),t}function hn(){var t,r;return t=Fr,e.substr(Fr,2)===De?(r=De,Fr+=2):(r=o,0===Br&&Gr(Le)),r!==o&&(Ur=t,r=Me()),(t=r)===o&&(t=Fr,e.substr(Fr,2)===Be?(r=Be,Fr+=2):(r=o,0===Br&&Gr(qe)),r!==o&&(Ur=t,r=He()),(t=r)===o&&(t=Fr,e.substr(Fr,2)===$e?(r=$e,Fr+=2):(r=o,0===Br&&Gr(ze)),r!==o&&(Ur=t,r=Xe()),(t=r)===o&&(t=Fr,e.substr(Fr,2)===Ge?(r=Ge,Fr+=2):(r=o,0===Br&&Gr(Ve)),r!==o&&(Ur=t,r=We()),(t=r)===o&&(t=Fr,e.substr(Fr,2)===Qe?(r=Qe,Fr+=2):(r=o,0===Br&&Gr(Ye)),r!==o&&(Ur=t,r=Je()),(t=r)===o&&(t=Fr,e.substr(Fr,2)===Ze?(r=Ze,Fr+=2):(r=o,0===Br&&Gr(Ke)),r!==o&&(Ur=t,r=tr()),(t=r)===o&&(t=Fr,e.substr(Fr,2)===er?(r=er,Fr+=2):(r=o,0===Br&&Gr(rr)),r!==o&&(Ur=t,r=nr()),(t=r)===o&&(t=Fr,e.substr(Fr,2)===ir?(r=ir,Fr+=2):(r=o,0===Br&&Gr(or)),r!==o&&(Ur=t,r=ar()),t=r))))))),t}function fn(){var t,r,n;return t=Fr,lr.test(e.charAt(Fr))?(r=e.charAt(Fr),Fr++):(r=o,0===Br&&Gr(hr)),r!==o?(fr.test(e.charAt(Fr))?(n=e.charAt(Fr),Fr++):(n=o,0===Br&&Gr(pr)),n!==o?(Ur=t,t=r=dr(r,n)):(Fr=t,t=o)):(Fr=t,t=o),t===o&&(yr.test(e.charAt(Fr))?(t=e.charAt(Fr),Fr++):(t=o,0===Br&&Gr(vr))),t}function pn(){var t;return(t=fn())===o&&(95===e.charCodeAt(Fr)?(t=gr,Fr++):(t=o,0===Br&&Gr(mr))),t}function dn(){var t;return(t=pn())===o&&(45===e.charCodeAt(Fr)?(t=Vt,Fr++):(t=o,0===Br&&Gr(Wt)),t===o&&(qt.test(e.charAt(Fr))?(t=e.charAt(Fr),Fr++):(t=o,0===Br&&Gr(Ht)),t===o&&(183===e.charCodeAt(Fr)?(t=br,Fr++):(t=o,0===Br&&Gr(wr)),t===o&&(Ar.test(e.charAt(Fr))?(t=e.charAt(Fr),Fr++):(t=o,0===Br&&Gr(xr)),t===o&&(_r.test(e.charAt(Fr))?(t=e.charAt(Fr),Fr++):(t=o,0===Br&&Gr(kr))))))),t}function yn(){var t,r,n,i,a,s,u,h,f;if(t=Fr,r=Fr,(n=fn())!==o){for(i=[],a=dn();a!==o;)i.push(a),a=dn();if(i!==o){if(a=[],s=Fr,u=[],46===e.charCodeAt(Fr)?(h=c,Fr++):(h=o,0===Br&&Gr(l)),h!==o)for(;h!==o;)u.push(h),46===e.charCodeAt(Fr)?(h=c,Fr++):(h=o,0===Br&&Gr(l));else u=o;if(u!==o){if(h=[],(f=dn())!==o)for(;f!==o;)h.push(f),f=dn();else h=o;h!==o?s=u=[u,h]:(Fr=s,s=o)}else Fr=s,s=o;for(;s!==o;){if(a.push(s),s=Fr,u=[],46===e.charCodeAt(Fr)?(h=c,Fr++):(h=o,0===Br&&Gr(l)),h!==o)for(;h!==o;)u.push(h),46===e.charCodeAt(Fr)?(h=c,Fr++):(h=o,0===Br&&Gr(l));else u=o;if(u!==o){if(h=[],(f=dn())!==o)for(;f!==o;)h.push(f),f=dn();else h=o;h!==o?s=u=[u,h]:(Fr=s,s=o)}else Fr=s,s=o}a!==o?r=n=[n,i,a]:(Fr=r,r=o)}else Fr=r,r=o}else Fr=r,r=o;return r!==o?e.substring(t,Fr):r}function vn(){var t;return(t=function(){var t,r,n,i,a;return t=Fr,r=Fr,37===e.charCodeAt(Fr)?(n=Or,Fr++):(n=o,0===Br&&Gr(jr)),n!==o&&(i=gn())!==o&&(a=gn())!==o?r=n=[n,i,a]:(Fr=r,r=o),r!==o?e.substring(t,Fr):r}())===o&&(t=function(){var t,r,n;return t=Fr,92===e.charCodeAt(Fr)?(r=Rr,Fr++):(r=o,0===Br&&Gr(Ir)),r!==o?(Cr.test(e.charAt(Fr))?(n=e.charAt(Fr),Fr++):(n=o,0===Br&&Gr(Pr)),n!==o?(Ur=t,t=r=h(n)):(Fr=t,t=o)):(Fr=t,t=o),t}()),t}function gn(){var t;return Nr.test(e.charAt(Fr))?(t=e.charAt(Fr),Fr++):(t=o,0===Br&&Gr(Sr)),t}var mn,bn,wn,An=new Function("try {return this===window;}catch(e){ return false;}")()?window.URL:r(9533).URL,xn=function(t){return t.match(/^[a-z](.*?):(.+?)/g)},_n={base:[],data:{},addBase:function(t){if(0===_n.base.length)return void _n.base.push(t);const e=_n.base[_n.base.length-1];e!==t&&_n.base.push(new An(t,e).toString())},addPrefix:function(t,e){const r=_n.data[t];void 0===r?_n.data[t]=[{uri:e,count:0}]:r[r.length-1].uri!==e&&r.push({uri:e,count:0})},hasPrefix:function(t){return void 0!==this.data[t]},resolve:function(t,e){const r=Object.keys(_n.data).find((e=>0===t.indexOf(e+":")));if(void 0!==r){const n=_n.data[r];if(1===n.length&&!0!==e&&xn(n[0].uri))return t;const i=n[n.length-1].uri;return t.replace(r+":",i)}var i=0===_n.base.length?n.baseIRI:_n.base[_n.base.length-1];return!i||t.match(/^(http:|https:|urn:|file:)/)?t:0===t.indexOf("//")&&i?i.split("//")[0]+t:new An(t,i).toString()},increment:function(t){const e=_n.data[t];void 0!==e&&e[e.length-1].count++},decrement:function(t){const e=_n.data[t];void 0!==e&&e[e.length-1].count--},toJSON:function(){const t={};return _n.base.length>0&&(void 0===t["@context"]&&(t["@context"]={}),t["@context"]["@base"]=_n.base[0]),Object.keys(_n.data).forEach((e=>{const r=_n.data[e][0];"http://www.w3.org/2001/XMLSchema#"===r.uri&&r.count<1||xn(r.uri)&&(void 0===t["@context"]&&(t["@context"]={}),t["@context"][e]=r.uri)})),t}};function kn(t,e){if(void 0===t["@list"])return t;if(!e&&!t["@list"].find((t=>void 0!==t["@list"])))return t;if(0===t["@list"].length)return{"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"};var r={},n=null;return t["@list"].forEach((t=>{null===n?n=r:(n["http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"]={},n=n["http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"]),n["http://www.w3.org/1999/02/22-rdf-syntax-ns#first"]=kn(t,!0),n["http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"]={"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"}})),r}if((i=s())!==o&&Fr===e.length)return i;throw i!==o&&Fr{"use strict";var n=r(9964),i=r(6357);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}var a,s,u=r(5403).codes,c=u.ERR_AMBIGUOUS_ARGUMENT,l=u.ERR_INVALID_ARG_TYPE,h=u.ERR_INVALID_ARG_VALUE,f=u.ERR_INVALID_RETURN_VALUE,p=u.ERR_MISSING_ARGS,d=r(5416),y=r(7187).inspect,v=r(7187).types,g=v.isPromise,m=v.isRegExp,b=Object.assign?Object.assign:r(6713).assign,w=Object.is?Object.is:r(8527);function A(){var t=r(6781);a=t.isDeepEqual,s=t.isDeepStrictEqual}new Map;var x=!1,_=t.exports=O,k={};function T(t){if(t.message instanceof Error)throw t.message;throw new d(t)}function E(t,e,r,n){if(!r){var i=!1;if(0===e)i=!0,n="No value argument passed to `assert.ok()`";else if(n instanceof Error)throw n;var o=new d({actual:r,expected:!0,message:n,operator:"==",stackStartFn:t});throw o.generatedMessage=i,o}}function O(){for(var t=arguments.length,e=new Array(t),r=0;r1?r-1:0),i=1;i1?r-1:0),i=1;i1?r-1:0),i=1;i1?r-1:0),i=1;i{"use strict";var n=r(9964);function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;rt.length)&&(r=t.length),t.substring(r-e.length,r)===e}var v="",g="",m="",b="",w={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"};function A(t){var e=Object.keys(t),r=Object.create(Object.getPrototypeOf(t));return e.forEach((function(e){r[e]=t[e]})),Object.defineProperty(r,"message",{value:t.message}),r}function x(t){return p(t,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}var _=function(t){function e(t){var r;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),"object"!==f(t)||null===t)throw new d("options","Object",t);var i=t.message,o=t.operator,u=t.stackStartFn,c=t.actual,l=t.expected,p=Error.stackTraceLimit;if(Error.stackTraceLimit=0,null!=i)r=a(this,h(e).call(this,String(i)));else if(n.stderr&&n.stderr.isTTY&&(n.stderr&&n.stderr.getColorDepth&&1!==n.stderr.getColorDepth()?(v="",g="",b="",m=""):(v="",g="",b="",m="")),"object"===f(c)&&null!==c&&"object"===f(l)&&null!==l&&"stack"in c&&c instanceof Error&&"stack"in l&&l instanceof Error&&(c=A(c),l=A(l)),"deepStrictEqual"===o||"strictEqual"===o)r=a(this,h(e).call(this,function(t,e,r){var i="",o="",a=0,s="",u=!1,c=x(t),l=c.split("\n"),h=x(e).split("\n"),p=0,d="";if("strictEqual"===r&&"object"===f(t)&&"object"===f(e)&&null!==t&&null!==e&&(r="strictEqualObject"),1===l.length&&1===h.length&&l[0]!==h[0]){var A=l[0].length+h[0].length;if(A<=10){if(!("object"===f(t)&&null!==t||"object"===f(e)&&null!==e||0===t&&0===e))return"".concat(w[r],"\n\n")+"".concat(l[0]," !== ").concat(h[0],"\n")}else if("strictEqualObject"!==r&&A<(n.stderr&&n.stderr.isTTY?n.stderr.columns:80)){for(;l[0][p]===h[0][p];)p++;p>2&&(d="\n ".concat(function(t,e){if(e=Math.floor(e),0==t.length||0==e)return"";var r=t.length*e;for(e=Math.floor(Math.log(e)/Math.log(2));e;)t+=t,e--;return t+t.substring(0,r-t.length)}(" ",p),"^"),p=0)}}for(var _=l[l.length-1],k=h[h.length-1];_===k&&(p++<2?s="\n ".concat(_).concat(s):i=_,l.pop(),h.pop(),0!==l.length&&0!==h.length);)_=l[l.length-1],k=h[h.length-1];var T=Math.max(l.length,h.length);if(0===T){var E=c.split("\n");if(E.length>30)for(E[26]="".concat(v,"...").concat(b);E.length>27;)E.pop();return"".concat(w.notIdentical,"\n\n").concat(E.join("\n"),"\n")}p>3&&(s="\n".concat(v,"...").concat(b).concat(s),u=!0),""!==i&&(s="\n ".concat(i).concat(s),i="");var O=0,j=w[r]+"\n".concat(g,"+ actual").concat(b," ").concat(m,"- expected").concat(b),N=" ".concat(v,"...").concat(b," Lines skipped");for(p=0;p1&&p>2&&(S>4?(o+="\n".concat(v,"...").concat(b),u=!0):S>3&&(o+="\n ".concat(h[p-2]),O++),o+="\n ".concat(h[p-1]),O++),a=p,i+="\n".concat(m,"-").concat(b," ").concat(h[p]),O++;else if(h.length1&&p>2&&(S>4?(o+="\n".concat(v,"...").concat(b),u=!0):S>3&&(o+="\n ".concat(l[p-2]),O++),o+="\n ".concat(l[p-1]),O++),a=p,o+="\n".concat(g,"+").concat(b," ").concat(l[p]),O++;else{var R=h[p],I=l[p],C=I!==R&&(!y(I,",")||I.slice(0,-1)!==R);C&&y(R,",")&&R.slice(0,-1)===I&&(C=!1,I+=","),C?(S>1&&p>2&&(S>4?(o+="\n".concat(v,"...").concat(b),u=!0):S>3&&(o+="\n ".concat(l[p-2]),O++),o+="\n ".concat(l[p-1]),O++),a=p,o+="\n".concat(g,"+").concat(b," ").concat(I),i+="\n".concat(m,"-").concat(b," ").concat(R),O+=2):(o+=i,i="",1!==S&&0!==p||(o+="\n ".concat(I),O++))}if(O>20&&p30)for(k[26]="".concat(v,"...").concat(b);k.length>27;)k.pop();r=1===k.length?a(this,h(e).call(this,"".concat(_," ").concat(k[0]))):a(this,h(e).call(this,"".concat(_,"\n\n").concat(k.join("\n"),"\n")))}else{var T=x(c),E="",O=w[o];"notDeepEqual"===o||"notEqual"===o?(T="".concat(w[o],"\n\n").concat(T)).length>1024&&(T="".concat(T.slice(0,1021),"...")):(E="".concat(x(l)),T.length>512&&(T="".concat(T.slice(0,509),"...")),E.length>512&&(E="".concat(E.slice(0,509),"...")),"deepEqual"===o||"equal"===o?T="".concat(O,"\n\n").concat(T,"\n\nshould equal\n\n"):E=" ".concat(o," ").concat(E)),r=a(this,h(e).call(this,"".concat(T).concat(E)))}return Error.stackTraceLimit=p,r.generatedMessage=!i,Object.defineProperty(s(r),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),r.code="ERR_ASSERTION",r.actual=c,r.expected=l,r.operator=o,Error.captureStackTrace&&Error.captureStackTrace(s(r),u),r.stack,r.name="AssertionError",a(r)}var r,u;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}(e,t),r=e,u=[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:p.custom,value:function(t,e){return p(this,function(t){for(var e=1;e{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},i(t)}function o(t,e){return o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},o(t,e)}var a,s,u={};function c(t,e,r){r||(r=Error);var a=function(r){function a(r,o,s){var u;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),u=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}(this,i(a).call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,o,s))),u.code=t,u}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}(a,r),a}(r);u[t]=a}function l(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}c("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),c("ERR_INVALID_ARG_TYPE",(function(t,e,i){var o,s,u,c,h;if(void 0===a&&(a=r(182)),a("string"==typeof t,"'name' must be a string"),"string"==typeof e&&(s="not ",e.substr(0,4)===s)?(o="must not be",e=e.replace(/^not /,"")):o="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-9,r)===e}(t," argument"))u="The ".concat(t," ").concat(o," ").concat(l(e,"type"));else{var f=("number"!=typeof h&&(h=0),h+1>(c=t).length||-1===c.indexOf(".",h)?"argument":"property");u='The "'.concat(t,'" ').concat(f," ").concat(o," ").concat(l(e,"type"))}return u+". Received type ".concat(n(i))}),TypeError),c("ERR_INVALID_ARG_VALUE",(function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid";void 0===s&&(s=r(7187));var i=s.inspect(e);return i.length>128&&(i="".concat(i.slice(0,128),"...")),"The argument '".concat(t,"' ").concat(n,". Received ").concat(i)}),TypeError,RangeError),c("ERR_INVALID_RETURN_VALUE",(function(t,e,r){var i;return i=r&&r.constructor&&r.constructor.name?"instance of ".concat(r.constructor.name):"type ".concat(n(r)),"Expected ".concat(t,' to be returned from the "').concat(e,'"')+" function but got ".concat(i,".")}),TypeError),c("ERR_MISSING_ARGS",(function(){for(var t=arguments.length,e=new Array(t),n=0;n0,"At least one arg needs to be specified");var i="The ",o=e.length;switch(e=e.map((function(t){return'"'.concat(t,'"')})),o){case 1:i+="".concat(e[0]," argument");break;case 2:i+="".concat(e[0]," and ").concat(e[1]," arguments");break;default:i+=e.slice(0,o-1).join(", "),i+=", and ".concat(e[o-1]," arguments")}return"".concat(i," must be specified")}),TypeError),t.exports.codes=u},6781:(t,e,r)=>{"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}var o=void 0!==/a/g.flags,a=function(t){var e=[];return t.forEach((function(t){return e.push(t)})),e},s=function(t){var e=[];return t.forEach((function(t,r){return e.push([r,t])})),e},u=Object.is?Object.is:r(8527),c=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},l=Number.isNaN?Number.isNaN:r(7051);function h(t){return t.call.bind(t)}var f=h(Object.prototype.hasOwnProperty),p=h(Object.prototype.propertyIsEnumerable),d=h(Object.prototype.toString),y=r(7187).types,v=y.isAnyArrayBuffer,g=y.isArrayBufferView,m=y.isDate,b=y.isMap,w=y.isRegExp,A=y.isSet,x=y.isNativeError,_=y.isBoxedPrimitive,k=y.isNumberObject,T=y.isStringObject,E=y.isBooleanObject,O=y.isBigIntObject,j=y.isSymbolObject,N=y.isFloat32Array,S=y.isFloat64Array;function R(t){if(0===t.length||t.length>10)return!0;for(var e=0;e57)return!0}return 10===t.length&&t>=Math.pow(2,32)}function I(t){return Object.keys(t).filter(R).concat(c(t).filter(Object.prototype.propertyIsEnumerable.bind(t)))}function C(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i{"use strict";e.byteLength=function(t){var e=s(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,o=s(t),a=o[0],u=o[1],c=new i(function(t,e,r){return 3*(e+r)/4-r}(0,a,u)),l=0,h=u>0?a-4:a;for(r=0;r>16&255,c[l++]=e>>8&255,c[l++]=255&e;return 2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,c[l++]=255&e),1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,c[l++]=e>>8&255,c[l++]=255&e),c},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],a=16383,s=0,c=n-i;sc?c:s+a));return 1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=o[a],n[o.charCodeAt(a)]=a;function s(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function u(t,e,n){for(var i,o,a=[],s=e;s>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},2313:(t,e,r)=>{"use strict";var n=r(6357);const i=r(2504),o=r(9029),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=c,e.IS=50;const s=2147483647;function u(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,c.prototype),e}function c(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return f(t)}return l(t,e,r)}function l(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!c.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|v(t,e);let n=u(r);const i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return p(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return c.from(n,e,r);const i=function(t){if(c.isBuffer(t)){const e=0|y(t.length),r=u(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||J(t.length)?u(0):p(t):"Buffer"===t.type&&Array.isArray(t.data)?p(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return c.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function f(t){return h(t),u(t<0?0:0|y(t))}function p(t){const e=t.length<0?0:0|y(t.length),r=u(e);for(let n=0;n=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function v(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(t).length;default:if(i)return n?-1:V(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return N(this,e,r);case"latin1":case"binary":return S(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=c.from(e,n)),c.isBuffer(e))return 0===e.length?-1:w(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):w(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function w(t,e,r,n,i){let o,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){let n=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){let r=!0;for(let n=0;ni&&(n=i):n=i;const o=e.length;let a;for(n>o/2&&(n=o/2),a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function E(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function O(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+a<=r){let r,n,s,u;switch(a){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],s=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=a}return function(t){const e=t.length;if(e<=j)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn.length?(c.isBuffer(e)||(e=c.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!c.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},c.byteLength=v,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;er&&(t+=" ... "),""},a&&(c.prototype[a]=c.prototype.inspect),c.prototype.compare=function(t,e,r,n,i){if(Y(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0);const s=Math.min(o,a),u=this.slice(n,i),l=t.slice(e,r);for(let t=0;t>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return A(this,t,e,r);case"utf8":case"utf-8":return x(this,t,e,r);case"ascii":case"latin1":case"binary":return _(this,t,e,r);case"base64":return k(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const j=4096;function N(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;in)&&(r=n);let i="";for(let n=e;nr)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,n,i,o){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function F(t,e,r,n,i){$(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=a,a>>=8,t[r++]=a,a>>=8,t[r++]=a,a>>=8,t[r++]=a,r}function U(t,e,r,n,i){$(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=a,a>>=8,t[r+2]=a,a>>=8,t[r+1]=a,a>>=8,t[r]=a,r+8}function D(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(t,e,r,n,i){return e=+e,r>>>=0,i||D(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function M(t,e,r,n,i){return e=+e,r>>>=0,i||D(t,0,r,8),o.write(t,e,r,n,52,8),r+8}c.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||C(t,e,this.length);let n=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,r||C(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readBigUInt64LE=K((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||X(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||X(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<>>=0,e>>>=0,r||C(t,e,this.length);let n=this[t],i=1,o=0;for(;++o=i&&(n-=Math.pow(2,8*e)),n},c.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},c.prototype.readInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){t>>>=0,e||C(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(t,e){t>>>=0,e||C(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=K((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||X(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||X(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<>>=0,e||C(t,4,this.length),o.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return t>>>=0,e||C(t,4,this.length),o.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return t>>>=0,e||C(t,8,this.length),o.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return t>>>=0,e||C(t,8,this.length),o.read(this,t,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||P(this,t,e,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,n||P(this,t,e,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,255,0),this[e]=255&t,e+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigUInt64LE=K((function(t,e=0){return F(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=K((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);P(this,t,e,r,n-1,-n)}let i=0,o=1,a=0;for(this[e]=255&t;++i>>=0,!n){const n=Math.pow(2,8*r-1);P(this,t,e,r,n-1,-n)}let i=r-1,o=1,a=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/o|0)-a&255;return e+r},c.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},c.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigInt64LE=K((function(t,e=0){return F(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=K((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},c.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},c.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},c.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},c.prototype.copy=function(t,e,r,n){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function $(t,e,r,n,i,o){if(t>r||t3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new B.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){z(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||X(e,t.length-(r+1))}(n,i,o)}function z(t,e){if("number"!=typeof t)throw new B.ERR_INVALID_ARG_TYPE(e,"number",t)}function X(t,e,r){if(Math.floor(t)!==t)throw z(t,r),new B.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new B.ERR_BUFFER_OUT_OF_BOUNDS;throw new B.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}q("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),q("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),q("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=H(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=H(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const G=/[^+/0-9A-Za-z-_]/g;function V(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let a=0;a55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function W(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(G,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Q(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function J(t){return t!=t}const Z=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function K(t){return"undefined"==typeof BigInt?tt:t}function tt(){throw new Error("BigInt not supported")}},7913:(t,e,r)=>{"use strict";var n=r(8651),i=r(6601),o=i(n("String.prototype.indexOf"));t.exports=function(t,e){var r=n(t,!!e);return"function"==typeof r&&o(t,".prototype.")>-1?i(r):r}},6601:(t,e,r)=>{"use strict";var n=r(5049),i=r(8651),o=i("%Function.prototype.apply%"),a=i("%Function.prototype.call%"),s=i("%Reflect.apply%",!0)||n.call(a,o),u=i("%Object.getOwnPropertyDescriptor%",!0),c=i("%Object.defineProperty%",!0),l=i("%Math.max%");if(c)try{c({},"a",{value:1})}catch(t){c=null}t.exports=function(t){var e=s(n,a,arguments);return u&&c&&u(e,"length").configurable&&c(e,"length",{value:1+l(0,t.length-(arguments.length-1))}),e};var h=function(){return s(n,o,arguments)};c?c(t.exports,"apply",{value:h}):t.exports.apply=h},6357:(t,e,r)=>{var n=r(7187),i=r(182);function o(){return(new Date).getTime()}var a,s=Array.prototype.slice,u={};a=void 0!==r.g&&r.g.console?r.g.console:"undefined"!=typeof window&&window.console?window.console:{};for(var c=[[function(){},"log"],[function(){a.log.apply(a,arguments)},"info"],[function(){a.log.apply(a,arguments)},"warn"],[function(){a.warn.apply(a,arguments)},"error"],[function(t){u[t]=o()},"time"],[function(t){var e=u[t];if(!e)throw new Error("No such label: "+t);delete u[t];var r=o()-e;a.log(t+": "+r+"ms")},"timeEnd"],[function(){var t=new Error;t.name="Trace",t.message=n.format.apply(null,arguments),a.error(t.stack)},"trace"],[function(t){a.log(n.inspect(t)+"\n")},"dir"],[function(t){if(!t){var e=s.call(arguments,1);i.ok(!1,n.format.apply(null,e))}},"assert"]],l=0;l-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function h(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function f(t){this.map={},t instanceof f?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function d(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=d(e);return e.readAsArrayBuffer(t),r}function v(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=v(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=v(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=p(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=d(e=new FileReader),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function A(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new f(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},g.call(b.prototype),g.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},A.error=function(){var t=new A(null,{status:0,statusText:""});return t.type="error",t};var x=[301,302,303,307,308];A.redirect=function(t,e){if(-1===x.indexOf(e))throw new RangeError("Invalid status code");return new A(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function _(t,r){return new Promise((function(n,o){var a=new b(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new f,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new A(i,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}_.polyfill=!0,t.fetch||(t.fetch=_,t.Headers=f,t.Request=b,t.Response=A),e.Headers=f,e.Request=b,e.Response=A,e.fetch=_,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e},7802:(t,e,r)=>{"use strict";var n=r(5643),i="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,a=Array.prototype.concat,s=Object.defineProperty,u=r(8890)(),c=s&&u,l=function(t,e,r,n){var i;(!(e in t)||"function"==typeof(i=n)&&"[object Function]"===o.call(i)&&n())&&(c?s(t,e,{configurable:!0,enumerable:!1,value:r,writable:!0}):t[e]=r)},h=function(t,e){var r=arguments.length>2?arguments[2]:{},o=n(e);i&&(o=a.call(o,Object.getOwnPropertySymbols(e)));for(var s=0;s{"use strict";function e(t,e){if(null==t)throw new TypeError("Cannot convert first argument to object");for(var r=Object(t),n=1;n{"use strict";var n=r(3746),i=Object.prototype.toString,o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){if(!n(e))throw new TypeError("iterator must be a function");var a;arguments.length>=3&&(a=r),"[object Array]"===i.call(t)?function(t,e,r){for(var n=0,i=t.length;n{"use strict";var e=Array.prototype.slice,r=Object.prototype.toString;t.exports=function(t){var n=this;if("function"!=typeof n||"[object Function]"!==r.call(n))throw new TypeError("Function.prototype.bind called on incompatible "+n);for(var i,o=e.call(arguments,1),a=Math.max(0,n.length-o.length),s=[],u=0;u{"use strict";var n=r(2719);t.exports=Function.prototype.bind||n},8651:(t,e,r)=>{"use strict";var n,i=SyntaxError,o=Function,a=TypeError,s=function(t){try{return o('"use strict"; return ('+t+").constructor;")()}catch(t){}},u=Object.getOwnPropertyDescriptor;if(u)try{u({},"")}catch(t){u=null}var c=function(){throw new a},l=u?function(){try{return c}catch(t){try{return u(arguments,"callee").get}catch(t){return c}}}():c,h=r(3257)(),f=Object.getPrototypeOf||function(t){return t.__proto__},p={},d="undefined"==typeof Uint8Array?n:f(Uint8Array),y={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":h?f([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":p,"%AsyncGenerator%":p,"%AsyncGeneratorFunction%":p,"%AsyncIteratorPrototype%":p,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":p,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h?f(f([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&h?f((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&h?f((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h?f(""[Symbol.iterator]()):n,"%Symbol%":h?Symbol:n,"%SyntaxError%":i,"%ThrowTypeError%":l,"%TypedArray%":d,"%TypeError%":a,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet};try{null.error}catch(t){var v=f(f(t));y["%Error.prototype%"]=v}var g=function t(e){var r;if("%AsyncFunction%"===e)r=s("async function () {}");else if("%GeneratorFunction%"===e)r=s("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=s("async function* () {}");else if("%AsyncGenerator%"===e){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===e){var i=t("%AsyncGenerator%");i&&(r=f(i.prototype))}return y[e]=r,r},m={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},b=r(5049),w=r(8032),A=b.call(Function.call,Array.prototype.concat),x=b.call(Function.apply,Array.prototype.splice),_=b.call(Function.call,String.prototype.replace),k=b.call(Function.call,String.prototype.slice),T=b.call(Function.call,RegExp.prototype.exec),E=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,O=/\\(\\)?/g,j=function(t,e){var r,n=t;if(w(m,n)&&(n="%"+(r=m[n])[0]+"%"),w(y,n)){var o=y[n];if(o===p&&(o=g(n)),void 0===o&&!e)throw new a("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new i("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new a('"allowMissing" argument must be a boolean');if(null===T(/^%?[^%]*%?$/,t))throw new i("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=k(t,0,1),r=k(t,-1);if("%"===e&&"%"!==r)throw new i("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new i("invalid intrinsic syntax, expected opening `%`");var n=[];return _(t,E,(function(t,e,r,i){n[n.length]=r?_(i,O,"$1"):e||t})),n}(t),n=r.length>0?r[0]:"",o=j("%"+n+"%",e),s=o.name,c=o.value,l=!1,h=o.alias;h&&(n=h[0],x(r,A([0,1],h)));for(var f=1,p=!0;f=r.length){var m=u(c,d);c=(p=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:c[d]}else p=w(c,d),c=c[d];p&&!l&&(y[s]=c)}}return c}},8109:(t,e,r)=>{"use strict";var n=r(8651)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(t){n=null}t.exports=n},8890:(t,e,r)=>{"use strict";var n=r(8651)("%Object.defineProperty%",!0),i=function(){if(n)try{return n({},"a",{value:1}),!0}catch(t){return!1}return!1};i.hasArrayLengthDefineBug=function(){if(!i())return null;try{return 1!==n([],"length",{value:1}).length}catch(t){return!0}},t.exports=i},3257:(t,e,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,i=r(2843);t.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},2843:t=>{"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(t,e);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},6626:(t,e,r)=>{"use strict";var n=r(2843);t.exports=function(){return n()&&!!Symbol.toStringTag}},8032:(t,e,r)=>{"use strict";var n=r(5049);t.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},9029:(t,e)=>{e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,l=-7,h=r?i-1:0,f=r?-1:1,p=t[e+h];for(h+=f,o=p&(1<<-l)-1,p>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=f,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+t[e+h],h+=f,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),o-=c}return(p?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,c=8*o-i-1,l=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=255&s,p+=d,s/=256,i-=8);for(a=a<0;t[r+p]=255&a,p+=d,a/=256,c-=8);t[r+p-d]|=128*y}},9784:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},7906:(t,e,r)=>{"use strict";var n=r(6626)(),i=r(7913)("Object.prototype.toString"),o=function(t){return!(n&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===i(t)},a=function(t){return!!o(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==i(t)&&"[object Function]"===i(t.callee)},s=function(){return o(arguments)}();o.isLegacyArguments=a,t.exports=s?o:a},3746:t=>{"use strict";var e,r,n=Function.prototype.toString,i="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof i&&"function"==typeof Object.defineProperty)try{e=Object.defineProperty({},"length",{get:function(){throw r}}),r={},i((function(){throw 42}),null,e)}catch(t){t!==r&&(i=null)}else i=null;var o=/^\s*class\b/,a=function(t){try{var e=n.call(t);return o.test(e)}catch(t){return!1}},s=function(t){try{return!a(t)&&(n.call(t),!0)}catch(t){return!1}},u=Object.prototype.toString,c="function"==typeof Symbol&&!!Symbol.toStringTag,l=!(0 in[,]),h=function(){return!1};if("object"==typeof document){var f=document.all;u.call(f)===u.call(document.all)&&(h=function(t){if((l||!t)&&(void 0===t||"object"==typeof t))try{var e=u.call(t);return("[object HTMLAllCollection]"===e||"[object HTML document.all class]"===e||"[object HTMLCollection]"===e||"[object Object]"===e)&&null==t("")}catch(t){}return!1})}t.exports=i?function(t){if(h(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;try{i(t,null,e)}catch(t){if(t!==r)return!1}return!a(t)&&s(t)}:function(t){if(h(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(c)return s(t);if(a(t))return!1;var e=u.call(t);return!("[object Function]"!==e&&"[object GeneratorFunction]"!==e&&!/^\[object HTML/.test(e))&&s(t)}},4610:(t,e,r)=>{"use strict";var n,i=Object.prototype.toString,o=Function.prototype.toString,a=/^\s*(?:function)?\*/,s=r(6626)(),u=Object.getPrototypeOf;t.exports=function(t){if("function"!=typeof t)return!1;if(a.test(o.call(t)))return!0;if(!s)return"[object GeneratorFunction]"===i.call(t);if(!u)return!1;if(void 0===n){var e=function(){if(!s)return!1;try{return Function("return function*() {}")()}catch(t){}}();n=!!e&&u(e)}return u(t)===n}},2621:t=>{"use strict";t.exports=function(t){return t!=t}},7051:(t,e,r)=>{"use strict";var n=r(6601),i=r(7802),o=r(2621),a=r(1320),s=r(5074),u=n(a(),Number);i(u,{getPolyfill:a,implementation:o,shim:s}),t.exports=u},1320:(t,e,r)=>{"use strict";var n=r(2621);t.exports=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:n}},5074:(t,e,r)=>{"use strict";var n=r(7802),i=r(1320);t.exports=function(){var t=i();return n(Number,{isNaN:t},{isNaN:function(){return Number.isNaN!==t}}),t}},6094:(t,e,r)=>{"use strict";var n=r(8404),i=r(821),o=r(7913),a=o("Object.prototype.toString"),s=r(6626)(),u=r(8109),c="undefined"==typeof globalThis?r.g:globalThis,l=i(),h=o("Array.prototype.indexOf",!0)||function(t,e){for(var r=0;r-1}return!!u&&function(t){var e=!1;return n(p,(function(r,n){if(!e)try{e=r.call(t)===n}catch(t){}})),e}(t)}},3249:t=>{"use strict";var e=function(t){return t!=t};t.exports=function(t,r){return 0===t&&0===r?1/t==1/r:t===r||!(!e(t)||!e(r))}},8527:(t,e,r)=>{"use strict";var n=r(7802),i=r(6601),o=r(3249),a=r(9636),s=r(3534),u=i(a(),Object);n(u,{getPolyfill:a,implementation:o,shim:s}),t.exports=u},9636:(t,e,r)=>{"use strict";var n=r(3249);t.exports=function(){return"function"==typeof Object.is?Object.is:n}},3534:(t,e,r)=>{"use strict";var n=r(9636),i=r(7802);t.exports=function(){var t=n();return i(Object,{is:t},{is:function(){return Object.is!==t}}),t}},8461:(t,e,r)=>{"use strict";var n;if(!Object.keys){var i=Object.prototype.hasOwnProperty,o=Object.prototype.toString,a=r(6515),s=Object.prototype.propertyIsEnumerable,u=!s.call({toString:null},"toString"),c=s.call((function(){}),"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],h=function(t){var e=t.constructor;return e&&e.prototype===t},f={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},p=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!f["$"+t]&&i.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{h(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();n=function(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===o.call(t),n=a(t),s=e&&"[object String]"===o.call(t),f=[];if(!e&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var d=c&&r;if(s&&t.length>0&&!i.call(t,0))for(var y=0;y0)for(var v=0;v{"use strict";var n=Array.prototype.slice,i=r(6515),o=Object.keys,a=o?function(t){return o(t)}:r(8461),s=Object.keys;a.shim=function(){if(Object.keys){var t=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);t||(Object.keys=function(t){return i(t)?s(n.call(t)):s(t)})}else Object.keys=a;return Object.keys||a},t.exports=a},6515:t=>{"use strict";var e=Object.prototype.toString;t.exports=function(t){var r=e.call(t),n="[object Arguments]"===r;return n||(n="[object Array]"!==r&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===e.call(t.callee)),n}},9964:t=>{var e,r,n=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(t){r=o}}();var s,u=[],c=!1,l=-1;function h(){c&&s&&(c=!1,s.length?u=s.concat(u):l=-1,u.length&&f())}function f(){if(!c){var t=a(h);c=!0;for(var e=u.length;e;){for(s=u,u=[];++l1)for(var r=1;r{"use strict";function e(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,r,n,i){r=r||"&",n=n||"=";var o={};if("string"!=typeof t||0===t.length)return o;var a=/\+/g;t=t.split(r);var s=1e3;i&&"number"==typeof i.maxKeys&&(s=i.maxKeys);var u=t.length;s>0&&u>s&&(u=s);for(var c=0;c=0?(l=d.substr(0,y),h=d.substr(y+1)):(l=d,h=""),f=decodeURIComponent(l),p=decodeURIComponent(h),e(o,f)?Array.isArray(o[f])?o[f].push(p):o[f]=[o[f],p]:o[f]=p}return o}},3016:t=>{"use strict";var e=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,r,n,i){return r=r||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(i){var o=encodeURIComponent(e(i))+n;return Array.isArray(t[i])?t[i].map((function(t){return o+encodeURIComponent(e(t))})).join(r):o+encodeURIComponent(e(t[i]))})).join(r):i?encodeURIComponent(e(i))+n+encodeURIComponent(e(t)):""}},4756:(t,e,r)=>{"use strict";e.decode=e.parse=r(4016),e.encode=e.stringify=r(3016)},5582:(t,e,r)=>{let n;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:r.g):t=>(n||(n=Promise.resolve())).then(t).catch((t=>setTimeout((()=>{throw t}),0)))},8540:t=>{const e={acl:"http://www.w3.org/ns/auth/acl#",arg:"http://www.w3.org/ns/pim/arg#",as:"https://www.w3.org/ns/activitystreams#",cal:"http://www.w3.org/2002/12/cal/ical#",cert:"http://www.w3.org/ns/auth/cert#",contact:"http://www.w3.org/2000/10/swap/pim/contact#",dc:"http://purl.org/dc/elements/1.1/",dct:"http://purl.org/dc/terms/",doap:"http://usefulinc.com/ns/doap#",foaf:"http://xmlns.com/foaf/0.1/",geo:"http://www.w3.org/2003/01/geo/wgs84_pos#",gpx:"http://www.w3.org/ns/pim/gpx#",http:"http://www.w3.org/2007/ont/http#",httph:"http://www.w3.org/2007/ont/httph#",icalTZ:"http://www.w3.org/2002/12/cal/icaltzd#",ldp:"http://www.w3.org/ns/ldp#",link:"http://www.w3.org/2007/ont/link#",log:"http://www.w3.org/2000/10/swap/log#",meeting:"http://www.w3.org/ns/pim/meeting#",mo:"http://purl.org/ontology/mo/",org:"http://www.w3.org/ns/org#",owl:"http://www.w3.org/2002/07/owl#",pad:"http://www.w3.org/ns/pim/pad#",patch:"http://www.w3.org/ns/pim/patch#",prov:"http://www.w3.org/ns/prov#",qu:"http://www.w3.org/2000/10/swap/pim/qif#",trip:"http://www.w3.org/ns/pim/trip#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",rss:"http://purl.org/rss/1.0/",sched:"http://www.w3.org/ns/pim/schedule#",schema:"http://schema.org/",sioc:"http://rdfs.org/sioc/ns#",solid:"http://www.w3.org/ns/solid/terms#",space:"http://www.w3.org/ns/pim/space#",stat:"http://www.w3.org/ns/posix/stat#",tab:"http://www.w3.org/2007/ont/link#",tabont:"http://www.w3.org/2007/ont/link#",ui:"http://www.w3.org/ns/ui#",vcard:"http://www.w3.org/2006/vcard/ns#",wf:"http://www.w3.org/2005/01/wf/flow#",xsd:"http://www.w3.org/2001/XMLSchema#",cco:"http://www.ontologyrepository.com/CommonCoreOntologies/",skos:"http://www.w3.org/2004/02/skos/core#",bookmark:"http://www.w3.org/2002/01/bookmark#",vann:"http://purl.org/vocab/vann/"};t.exports=function(t={namedNode:t=>t}){const r={};for(const n in e){const i=e[n];r[n]=function(e=""){return t.namedNode(i+e)}}return r}},9292:function(t,e,r){var n;t=r.nmd(t),function(i){e&&e.nodeType,t&&t.nodeType;var o="object"==typeof r.g&&r.g;o.global!==o&&o.window!==o&&o.self;var a,s=2147483647,u=36,c=26,l=38,h=700,f=/^xn--/,p=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=u-1,g=Math.floor,m=String.fromCharCode;function b(t){throw RangeError(y[t])}function w(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function A(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+w((t=t.replace(d,".")).split("."),e).join(".")}function x(t){for(var e,r,n=[],i=0,o=t.length;i=55296&&e<=56319&&i65535&&(e+=m((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+m(t)})).join("")}function k(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function T(t,e,r){var n=0;for(t=r?g(t/h):t>>1,t+=g(t/e);t>v*c>>1;n+=u)t=g(t/v);return g(n+(v+1)*t/(t+l))}function E(t){var e,r,n,i,o,a,l,h,f,p,d,y=[],v=t.length,m=0,w=128,A=72;for((r=t.lastIndexOf("-"))<0&&(r=0),n=0;n=128&&b("not-basic"),y.push(t.charCodeAt(n));for(i=r>0?r+1:0;i=v&&b("invalid-input"),((h=(d=t.charCodeAt(i++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:u)>=u||h>g((s-m)/a))&&b("overflow"),m+=h*a,!(h<(f=l<=A?1:l>=A+c?c:l-A));l+=u)a>g(s/(p=u-f))&&b("overflow"),a*=p;A=T(m-o,e=y.length+1,0==o),g(m/e)>s-w&&b("overflow"),w+=g(m/e),m%=e,y.splice(m++,0,w)}return _(y)}function O(t){var e,r,n,i,o,a,l,h,f,p,d,y,v,w,A,_=[];for(y=(t=x(t)).length,e=128,r=0,o=72,a=0;a=e&&dg((s-r)/(v=n+1))&&b("overflow"),r+=(l-e)*v,e=l,a=0;as&&b("overflow"),d==e){for(h=r,f=u;!(h<(p=f<=o?1:f>=o+c?c:f-o));f+=u)A=h-p,w=u-p,_.push(m(k(p+A%w,0))),h=g(A/w);_.push(m(k(h,0))),o=T(r,v,n==i),r=0,++n}++r,++e}return _.join("")}a={version:"1.3.2",ucs2:{decode:x,encode:_},decode:E,encode:O,toASCII:function(t){return A(t,(function(t){return p.test(t)?"xn--"+O(t):t}))},toUnicode:function(t){return A(t,(function(t){return f.test(t)?E(t.slice(4).toLowerCase()):t}))}},void 0===(n=function(){return a}.call(e,r,e,t))||(t.exports=n)}()},9533:(t,e,r)=>{"use strict";var n=r(9292),i=r(8278);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),h=["%","/","?",";","#"].concat(l),f=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=r(4756);o.prototype.parse=function(t,e,r){if(!i.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),s=-1!==o&&o127?C+="x":C+=I[P];if(!C.match(p)){var U=S.slice(0,O),D=S.slice(O+1),L=I.match(d);L&&(U.push(L[1]),D.unshift(L[2])),D.length&&(b="/"+D.join(".")+b),this.hostname=U.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),N||(this.hostname=n.toASCII(this.hostname));var M=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+M,this.href+=this.host,N&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!y[x])for(O=0,R=l.length;O0)&&r.host.split("@"))&&(r.auth=N.shift(),r.host=r.hostname=N.shift())),r.search=t.search,r.query=t.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!_.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var T=_.slice(-1)[0],E=(r.host||t.host||_.length>1)&&("."===T||".."===T)||""===T,O=0,j=_.length;j>=0;j--)"."===(T=_[j])?_.splice(j,1):".."===T?(_.splice(j,1),O++):O&&(_.splice(j,1),O--);if(!A&&!x)for(;O--;O)_.unshift("..");!A||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),E&&"/"!==_.join("/").substr(-1)&&_.push("");var N,S=""===_[0]||_[0]&&"/"===_[0].charAt(0);return k&&(r.hostname=r.host=S?"":_.length?_.shift():"",(N=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=N.shift(),r.host=r.hostname=N.shift())),(A=A||r.host&&_.length)&&!S&&_.unshift(""),_.length?r.pathname=_.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var t=this.host,e=s.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},8278:t=>{"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},1201:t=>{t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},9490:(t,e,r)=>{"use strict";var n=r(7906),i=r(4610),o=r(3381),a=r(6094);function s(t){return t.call.bind(t)}var u="undefined"!=typeof BigInt,c="undefined"!=typeof Symbol,l=s(Object.prototype.toString),h=s(Number.prototype.valueOf),f=s(String.prototype.valueOf),p=s(Boolean.prototype.valueOf);if(u)var d=s(BigInt.prototype.valueOf);if(c)var y=s(Symbol.prototype.valueOf);function v(t,e){if("object"!=typeof t)return!1;try{return e(t),!0}catch(t){return!1}}function g(t){return"[object Map]"===l(t)}function m(t){return"[object Set]"===l(t)}function b(t){return"[object WeakMap]"===l(t)}function w(t){return"[object WeakSet]"===l(t)}function A(t){return"[object ArrayBuffer]"===l(t)}function x(t){return"undefined"!=typeof ArrayBuffer&&(A.working?A(t):t instanceof ArrayBuffer)}function _(t){return"[object DataView]"===l(t)}function k(t){return"undefined"!=typeof DataView&&(_.working?_(t):t instanceof DataView)}e.isArgumentsObject=n,e.isGeneratorFunction=i,e.isTypedArray=a,e.isPromise=function(t){return"undefined"!=typeof Promise&&t instanceof Promise||null!==t&&"object"==typeof t&&"function"==typeof t.then&&"function"==typeof t.catch},e.isArrayBufferView=function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):a(t)||k(t)},e.isUint8Array=function(t){return"Uint8Array"===o(t)},e.isUint8ClampedArray=function(t){return"Uint8ClampedArray"===o(t)},e.isUint16Array=function(t){return"Uint16Array"===o(t)},e.isUint32Array=function(t){return"Uint32Array"===o(t)},e.isInt8Array=function(t){return"Int8Array"===o(t)},e.isInt16Array=function(t){return"Int16Array"===o(t)},e.isInt32Array=function(t){return"Int32Array"===o(t)},e.isFloat32Array=function(t){return"Float32Array"===o(t)},e.isFloat64Array=function(t){return"Float64Array"===o(t)},e.isBigInt64Array=function(t){return"BigInt64Array"===o(t)},e.isBigUint64Array=function(t){return"BigUint64Array"===o(t)},g.working="undefined"!=typeof Map&&g(new Map),e.isMap=function(t){return"undefined"!=typeof Map&&(g.working?g(t):t instanceof Map)},m.working="undefined"!=typeof Set&&m(new Set),e.isSet=function(t){return"undefined"!=typeof Set&&(m.working?m(t):t instanceof Set)},b.working="undefined"!=typeof WeakMap&&b(new WeakMap),e.isWeakMap=function(t){return"undefined"!=typeof WeakMap&&(b.working?b(t):t instanceof WeakMap)},w.working="undefined"!=typeof WeakSet&&w(new WeakSet),e.isWeakSet=function(t){return w(t)},A.working="undefined"!=typeof ArrayBuffer&&A(new ArrayBuffer),e.isArrayBuffer=x,_.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&_(new DataView(new ArrayBuffer(1),0,1)),e.isDataView=k;var T="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function E(t){return"[object SharedArrayBuffer]"===l(t)}function O(t){return void 0!==T&&(void 0===E.working&&(E.working=E(new T)),E.working?E(t):t instanceof T)}function j(t){return v(t,h)}function N(t){return v(t,f)}function S(t){return v(t,p)}function R(t){return u&&v(t,d)}function I(t){return c&&v(t,y)}e.isSharedArrayBuffer=O,e.isAsyncFunction=function(t){return"[object AsyncFunction]"===l(t)},e.isMapIterator=function(t){return"[object Map Iterator]"===l(t)},e.isSetIterator=function(t){return"[object Set Iterator]"===l(t)},e.isGeneratorObject=function(t){return"[object Generator]"===l(t)},e.isWebAssemblyCompiledModule=function(t){return"[object WebAssembly.Module]"===l(t)},e.isNumberObject=j,e.isStringObject=N,e.isBooleanObject=S,e.isBigIntObject=R,e.isSymbolObject=I,e.isBoxedPrimitive=function(t){return j(t)||N(t)||S(t)||R(t)||I(t)},e.isAnyArrayBuffer=function(t){return"undefined"!=typeof Uint8Array&&(x(t)||O(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(e,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}))},7187:(t,e,r)=>{var n=r(9964),i=r(6357),o=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},n=0;n=i)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),s=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(r)?n.showHidden=r:r&&e._extend(n,r),A(n.showHidden)&&(n.showHidden=!1),A(n.depth)&&(n.depth=2),A(n.colors)&&(n.colors=!1),A(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=h),p(n,t,n.depth)}function h(t,e){var r=l.styles[e];return r?"["+l.colors[r][0]+"m"+t+"["+l.colors[r][1]+"m":t}function f(t,e){return t}function p(t,r,n){if(t.customInspect&&r&&E(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,t);return w(i)||(i=p(t,i,n)),i}var o=function(t,e){if(A(e))return t.stylize("undefined","undefined");if(w(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return b(e)?t.stylize(""+e,"number"):g(e)?t.stylize(""+e,"boolean"):m(e)?t.stylize("null","null"):void 0}(t,r);if(o)return o;var a=Object.keys(r),s=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(r)),T(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return d(r);if(0===a.length){if(E(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(x(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(k(r))return t.stylize(Date.prototype.toString.call(r),"date");if(T(r))return d(r)}var c,l="",h=!1,f=["{","}"];return v(r)&&(h=!0,f=["[","]"]),E(r)&&(l=" [Function"+(r.name?": "+r.name:"")+"]"),x(r)&&(l=" "+RegExp.prototype.toString.call(r)),k(r)&&(l=" "+Date.prototype.toUTCString.call(r)),T(r)&&(l=" "+d(r)),0!==a.length||h&&0!=r.length?n<0?x(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),c=h?function(t,e,r,n,i){for(var o=[],a=0,s=e.length;a60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}(c,l,f)):f[0]+l+f[1]}function d(t){return"["+Error.prototype.toString.call(t)+"]"}function y(t,e,r,n,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),S(n,i)||(a="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=m(r)?p(t,u.value,null):p(t,u.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(t){return" "+t})).join("\n").slice(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),A(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.slice(1,-1),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function v(t){return Array.isArray(t)}function g(t){return"boolean"==typeof t}function m(t){return null===t}function b(t){return"number"==typeof t}function w(t){return"string"==typeof t}function A(t){return void 0===t}function x(t){return _(t)&&"[object RegExp]"===O(t)}function _(t){return"object"==typeof t&&null!==t}function k(t){return _(t)&&"[object Date]"===O(t)}function T(t){return _(t)&&("[object Error]"===O(t)||t instanceof Error)}function E(t){return"function"==typeof t}function O(t){return Object.prototype.toString.call(t)}function j(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(t){if(t=t.toUpperCase(),!s[t])if(u.test(t)){var r=n.pid;s[t]=function(){var n=e.format.apply(e,arguments);i.error("%s %d: %s",t,r,n)}}else s[t]=function(){};return s[t]},e.inspect=l,l.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},l.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.types=r(9490),e.isArray=v,e.isBoolean=g,e.isNull=m,e.isNullOrUndefined=function(t){return null==t},e.isNumber=b,e.isString=w,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=A,e.isRegExp=x,e.types.isRegExp=x,e.isObject=_,e.isDate=k,e.types.isDate=k,e.isError=T,e.types.isNativeError=T,e.isFunction=E,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(1201);var N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function S(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){var t,r;i.log("%s - %s",(r=[j((t=new Date).getHours()),j(t.getMinutes()),j(t.getSeconds())].join(":"),[t.getDate(),N[t.getMonth()],r].join(" ")),e.format.apply(e,arguments))},e.inherits=r(9784),e._extend=function(t,e){if(!e||!_(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t};var R="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function I(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(R&&t[R]){var e;if("function"!=typeof(e=t[R]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,R,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,n=new Promise((function(t,n){e=t,r=n})),i=[],o=0;o{"use strict";var n=r(8404),i=r(821),o=r(7913),a=r(8109),s=o("Object.prototype.toString"),u=r(6626)(),c="undefined"==typeof globalThis?r.g:globalThis,l=i(),h=o("String.prototype.slice"),f={},p=Object.getPrototypeOf;u&&a&&p&&n(l,(function(t){if("function"==typeof c[t]){var e=new c[t];if(Symbol.toStringTag in e){var r=p(e),n=a(r,Symbol.toStringTag);if(!n){var i=p(r);n=a(i,Symbol.toStringTag)}f[t]=n.get}}}));var d=r(6094);t.exports=function(t){return!!d(t)&&(u&&Symbol.toStringTag in t?function(t){var e=!1;return n(f,(function(r,n){if(!e)try{var i=r.call(t);i===n&&(e=i)}catch(t){}})),e}(t):h(s(t),8,-1))}},8392:e=>{"use strict";e.exports=t},8541:(t,e,r)=>{var n=r(2990).default;function i(){"use strict";t.exports=i=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var e,r={},o=Object.prototype,a=o.hasOwnProperty,s=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",h=u.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(e){f=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var i=e&&e.prototype instanceof w?e:w,o=Object.create(i.prototype),a=new C(n||[]);return s(o,"_invoke",{value:N(t,r,a)}),o}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=p;var y="suspendedStart",v="suspendedYield",g="executing",m="completed",b={};function w(){}function A(){}function x(){}var _={};f(_,c,(function(){return this}));var k=Object.getPrototypeOf,T=k&&k(k(P([])));T&&T!==o&&a.call(T,c)&&(_=T);var E=x.prototype=w.prototype=Object.create(_);function O(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function r(i,o,s,u){var c=d(t[i],t,o);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==n(h)&&a.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,s,u)}),(function(t){r("throw",t,s,u)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,u)}))}u(c.arg)}var i;s(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}})}function N(t,r,n){var i=y;return function(o,a){if(i===g)throw Error("Generator is already running");if(i===m){if("throw"===o)throw a;return{value:e,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var u=S(s,n);if(u){if(u===b)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===y)throw i=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=g;var c=d(t,r,n);if("normal"===c.type){if(i=n.done?m:v,c.arg===b)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=m,n.method="throw",n.arg=c.arg)}}}function S(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b;var o=d(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,b;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,b):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}function R(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(R,this),this.reset(!0)}function P(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function r(){for(;++i=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=a.call(o,"catchLoc"),c=a.call(o,"finallyLoc");if(u&&c){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),b}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:P(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),b}},r}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},2990:t=>{function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},232:(t,e,r)=>{var n=r(8541)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},821:(t,e,r)=>{"use strict";var n=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],i="undefined"==typeof globalThis?r.g:globalThis;t.exports=function(){for(var t=[],e=0;e{"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}r.d(e,{A:()=>n})},2937:(t,e,r)=>{"use strict";r.d(e,{A:()=>o});var n=r(9812);function i(t,e){for(var r=0;r{"use strict";r.d(e,{A:()=>i});var n=r(9812);function i(t,e,r){return(e=(0,n.A)(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},8782:(t,e,r)=>{"use strict";function n(t){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}r.d(e,{A:()=>n})},9604:(t,e,r)=>{"use strict";function n(t,e){return n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},n(t,e)}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&n(t,e)}r.d(e,{A:()=>i})},365:(t,e,r)=>{"use strict";r.d(e,{A:()=>i});var n=r(4360);function i(t,e){if(e&&("object"===(0,n.A)(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}},9812:(t,e,r)=>{"use strict";r.d(e,{A:()=>i});var n=r(4360);function i(t){var e=function(t,e){if("object"!=(0,n.A)(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,"string");if("object"!=(0,n.A)(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==(0,n.A)(e)?e:e+""}},4360:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}r.d(e,{A:()=>n})}},a={};function s(t){var e=a[t];if(void 0!==e)return e.exports;var r=a[t]={id:t,loaded:!1,exports:{}};return o[t].call(r.exports,r,r.exports,s),r.loaded=!0,r.exports}s.m=o,s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},r=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,s.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var i=Object.create(null);s.r(i);var o={};e=e||[null,r({}),r([]),r(r)];for(var a=2&n&&t;"object"==typeof a&&!~e.indexOf(a);a=r(a))Object.getOwnPropertyNames(a).forEach((e=>o[e]=()=>t[e]));return o.default=()=>t,s.d(i,o),i},s.d=(t,e)=>{for(var r in e)s.o(e,r)&&!s.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},s.f={},s.e=t=>Promise.all(Object.keys(s.f).reduce(((e,r)=>(s.f[r](t,e),e)),[])),s.u=t=>t+".rdflib.min.js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s.hmd=t=>((t=Object.create(t)).children||(t.children=[]),Object.defineProperty(t,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+t.id)}}),t),s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n={},i="$rdf:",s.l=(t,e,r,o)=>{if(n[t])n[t].push(e);else{var a,u;if(void 0!==r)for(var c=document.getElementsByTagName("script"),l=0;l{a.onerror=a.onload=null,clearTimeout(p);var i=n[t];if(delete n[t],a.parentNode&&a.parentNode.removeChild(a),i&&i.forEach((t=>t(r))),e)return e(r)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=f.bind(null,a.onerror),a.onload=f.bind(null,a.onload),u&&document.head.appendChild(a)}},s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{var t;s.g.importScripts&&(t=s.g.location+"");var e=s.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var r=e.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!t||!/^http(s?):/.test(t));)t=r[n--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=t})(),(()=>{var t={792:0};s.f.j=(e,r)=>{var n=s.o(t,e)?t[e]:void 0;if(0!==n)if(n)r.push(n[2]);else{var i=new Promise(((r,i)=>n=t[e]=[r,i]));r.push(n[2]=i);var o=s.p+s.u(e),a=new Error;s.l(o,(r=>{if(s.o(t,e)&&(0!==(n=t[e])&&(t[e]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;a.message="Loading chunk "+e+" failed.\n("+i+": "+o+")",a.name="ChunkLoadError",a.type=i,a.request=o,n[1](a)}}),"chunk-"+e,e)}};var e=(e,r)=>{var n,i,[o,a,u]=r,c=0;if(o.some((e=>0!==t[e]))){for(n in a)s.o(a,n)&&(s.m[n]=a[n]);u&&u(s)}for(e&&e(r);c{"use strict";s.r(u),s.d(u,{BlankNode:()=>p,Collection:()=>k,ConnectedStore:()=>zr,DataFactory:()=>xr,Empty:()=>O,Fetcher:()=>fr,Formula:()=>ht,IndexedFormula:()=>Et,Literal:()=>w,LiveStore:()=>Xr,N3Parser:()=>Yt,NamedNode:()=>y.A,Namespace:()=>W,NextId:()=>$r,Node:()=>ft,Query:()=>yt,RDFParser:()=>He,RDFaProcessor:()=>Be,SPARQLToQuery:()=>yr,Serializer:()=>et,Statement:()=>L,Store:()=>Et,UpdateManager:()=>mr,UpdatesSocket:()=>_r,UpdatesVia:()=>kr,Util:()=>Q,Variable:()=>H,blankNode:()=>Fr,defaultGraph:()=>Ur,fetcher:()=>Nr,fromNT:()=>qr,graph:()=>Sr,isBlankNode:()=>v.jt,isCollection:()=>v.P3,isGraph:()=>v.RN,isLiteral:()=>v.c$,isNamedNode:()=>v.Y2,isPredicate:()=>v.YC,isQuad:()=>v.aF,isRDFObject:()=>v.GE,isRDFlibObject:()=>v.DJ,isRDFlibPredicate:()=>v.fY,isRDFlibSubject:()=>v.CZ,isStatement:()=>v.SH,isStore:()=>v.ok,isSubject:()=>v.hr,isTerm:()=>v.D0,isVariable:()=>v.DZ,jsonParser:()=>pr,lit:()=>Rr,literal:()=>Dr,log:()=>V.A,namedNode:()=>Cr,parse:()=>ze,quad:()=>Lr,queryToSPARQL:()=>dr,serialize:()=>nt,sparqlUpdateParser:()=>$e,st:()=>Ir,sym:()=>Cr,term:()=>Hr,termValue:()=>Ve.E,triple:()=>Mr,uri:()=>M,variable:()=>Pr});var t=s(2937),e=s(9121),r=s(365),n=s(8782),i=s(9604),o=s(8175),a=s(9390),c=s(1605),l=s(6866);function h(t,e,i){return e=(0,n.A)(e),(0,r.A)(t,f()?Reflect.construct(e,i||[],(0,n.A)(t).constructor):e.apply(t,i))}function f(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(f=function(){return!!t})()}var p=function(r){function n(t){var r;return(0,e.A)(this,n),r=h(this,n,[n.getId(t)]),(0,o.A)(r,"termType",l.$Q),(0,o.A)(r,"classOrder",a.A.BlankNode),(0,o.A)(r,"isBlank",1),(0,o.A)(r,"isVar",1),r}return(0,i.A)(n,r),(0,t.A)(n,[{key:"id",get:function(){return this.value},set:function(t){this.value=t}},{key:"compareTerm",value:function(t){return this.classOrdert.classOrder?1:this.idt.id?1:0}},{key:"copy",value:function(t){var e=new n;return t.copyTo(this,e),e}},{key:"toCanonical",value:function(){return n.NTAnonymousNodePrefix+this.value}},{key:"toString",value:function(){return n.NTAnonymousNodePrefix+this.id}}],[{key:"getId",value:function(t){if(t){if("string"!=typeof t)throw new Error("Bad id argument to new blank node: "+t);if(t.includes("#")){var e=t.split("#");return e[e.length-1]}return t}return"n"+n.nextId++}}])}(c.A);(0,o.A)(p,"nextId",0),(0,o.A)(p,"NTAnonymousNodePrefix","_:");var d=s(4360),y=s(3627),v=s(546);const g={boolean:new y.A("http://www.w3.org/2001/XMLSchema#boolean"),dateTime:new y.A("http://www.w3.org/2001/XMLSchema#dateTime"),decimal:new y.A("http://www.w3.org/2001/XMLSchema#decimal"),double:new y.A("http://www.w3.org/2001/XMLSchema#double"),integer:new y.A("http://www.w3.org/2001/XMLSchema#integer"),langString:new y.A("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),string:new y.A("http://www.w3.org/2001/XMLSchema#string")};function m(t,e,i){return e=(0,n.A)(e),(0,r.A)(t,b()?Reflect.construct(e,i||[],(0,n.A)(t).constructor):e.apply(t,i))}function b(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(b=function(){return!!t})()}var w=function(r){function n(t,r,i){var s;return(0,e.A)(this,n),s=m(this,n,[t]),(0,o.A)(s,"termType",l.QW),(0,o.A)(s,"classOrder",a.A.Literal),(0,o.A)(s,"datatype",g.string),(0,o.A)(s,"isVar",0),(0,o.A)(s,"language",""),r?(s.language=r,s.datatype=g.langString):s.datatype=i?y.A.fromValue(i):g.string,s}return(0,i.A)(n,r),(0,t.A)(n,[{key:"copy",value:function(){return new n(this.value,this.lang,this.datatype)}},{key:"equals",value:function(t){return!!t&&this.termType===t.termType&&this.value===t.value&&this.language===t.language&&(!this.datatype&&!t.datatype||this.datatype&&this.datatype.equals(t.datatype))}},{key:"lang",get:function(){return this.language},set:function(t){this.language=t||""}},{key:"toNT",value:function(){return n.toNT(this)}},{key:"toString",value:function(){return""+this.value}}],[{key:"toNT",value:function(t){if("number"==typeof t.value)return""+t.value;if("string"!=typeof t.value)throw new Error("Value of RDF literal is not string or number: "+t.value);var e=t.value;return e='"'+(e=(e=(e=(e=e.replace(/\\/g,"\\\\")).replace(/\"/g,'\\"')).replace(/\n/g,"\\n")).replace(/\r/g,"\\r"))+'"',t.language?e+="@"+t.language:t.datatype.equals(g.string)||(e+="^^"+t.datatype.toCanonical()),e}},{key:"fromBoolean",value:function(t){return new n(t?"1":"0",null,g.boolean)}},{key:"fromDate",value:function(t){if(!(t instanceof Date))throw new TypeError("Invalid argument to Literal.fromDate()");var e=function(t){return(""+(100+t)).slice(1,3)};return new n(t.getUTCFullYear()+"-"+e(t.getUTCMonth()+1)+"-"+e(t.getUTCDate())+"T"+e(t.getUTCHours())+":"+e(t.getUTCMinutes())+":"+e(t.getUTCSeconds())+"Z",null,g.dateTime)}},{key:"fromNumber",value:function(t){if("number"!=typeof t)throw new TypeError("Invalid argument to Literal.fromNumber()");var e,r=t.toString();return e=r.indexOf("e")<0&&Math.abs(t)<=Number.MAX_SAFE_INTEGER?Number.isInteger(t)?g.integer:g.decimal:g.double,new n(r,null,e)}},{key:"fromValue",value:function(t){if((0,v.c$)(t))return t;switch((0,d.A)(t)){case"object":if(t instanceof Date)return n.fromDate(t);case"boolean":return n.fromBoolean(t);case"number":return n.fromNumber(t);case"string":return new n(t)}throw new Error("Can't make literal from "+t+" of type "+(0,d.A)(t))}}])}(c.A);function A(t,e,i){return e=(0,n.A)(e),(0,r.A)(t,x()?Reflect.construct(e,i||[],(0,n.A)(t).constructor):e.apply(t,i))}function x(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(x=function(){return!!t})()}function _(t){return null==t||(0,v.D0)(t)?t:Array.isArray(t)?new k(t):w.fromValue(t)}var k=function(r){function n(t){var r;return(0,e.A)(this,n),r=A(this,n,[(p.nextId++).toString()]),(0,o.A)(r,"termType",l.r0),(0,o.A)(r,"classOrder",a.A.Collection),(0,o.A)(r,"closed",!1),(0,o.A)(r,"compareTerm",p.prototype.compareTerm),(0,o.A)(r,"elements",[]),(0,o.A)(r,"isVar",0),t&&t.length>0&&t.forEach((function(t){r.elements.push(_(t))})),r}return(0,i.A)(n,r),(0,t.A)(n,[{key:"id",get:function(){return this.value},set:function(t){this.value=t}},{key:"append",value:function(t){return this.elements.push(t)}},{key:"close",value:function(){return this.closed=!0,this.closed}},{key:"shift",value:function(){return this.elements.shift()}},{key:"substitute",value:function(t){return new n(this.elements.map((function(e){return e.substitute(t)})))}},{key:"toNT",value:function(){return n.toNT(this)}},{key:"toString",value:function(){return"("+this.elements.join(" ")+")"}},{key:"unshift",value:function(t){return this.elements.unshift(t)}}],[{key:"toNT",value:function(t){return p.NTAnonymousNodePrefix+t.id}}])}(c.A);function T(t,e,i){return e=(0,n.A)(e),(0,r.A)(t,E()?Reflect.construct(e,i||[],(0,n.A)(t).constructor):e.apply(t,i))}function E(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(E=function(){return!!t})()}(0,o.A)(k,"termType",l.r0);var O=function(r){function n(){var t;return(0,e.A)(this,n),t=T(this,n,[""]),(0,o.A)(t,"termType",l.S),t}return(0,i.A)(n,r),(0,t.A)(n,[{key:"toString",value:function(){return"()"}}])}(c.A);function j(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}function N(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(t){j(o,n,i,a,s,"next",t)}function s(t){j(o,n,i,a,s,"throw",t)}a(void 0)}))}}var S=s(232),R=s.n(S),I="chrome:theSession";function C(t,e,i){return e=(0,n.A)(e),(0,r.A)(t,P()?Reflect.construct(e,i||[],(0,n.A)(t).constructor):e.apply(t,i))}function P(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(P=function(){return!!t})()}new y.A(I);var F=function(r){function n(){var t;return(0,e.A)(this,n),t=C(this,n,[""]),(0,o.A)(t,"value",""),(0,o.A)(t,"termType",l.ic),(0,o.A)(t,"uri",I),t}return(0,i.A)(n,r),(0,t.A)(n,[{key:"toCanonical",value:function(){return this.value}},{key:"toString",value:function(){return"DefaultGraph"}}])}(c.A);function U(t){return!!t&&t.termType===l.ic}var D=new F,L=function(){function r(t,n,i,a){(0,e.A)(this,r),(0,o.A)(this,"subject",void 0),(0,o.A)(this,"predicate",void 0),(0,o.A)(this,"object",void 0),(0,o.A)(this,"graph",void 0),this.subject=c.A.fromValue(t),this.predicate=c.A.fromValue(n),this.object=c.A.fromValue(i),this.graph=null==a?D:c.A.fromValue(a)}return(0,t.A)(r,[{key:"why",get:function(){return this.graph},set:function(t){this.graph=t}},{key:"equals",value:function(t){return t.subject.equals(this.subject)&&t.predicate.equals(this.predicate)&&t.object.equals(this.object)&&t.graph.equals(this.graph)}},{key:"substitute",value:function(t){return new r(this.subject.substitute(t),this.predicate.substitute(t),this.object.substitute(t),U(this.graph)?this.graph:this.graph.substitute(t))}},{key:"toCanonical",value:function(){var t=[this.subject.toCanonical(),this.predicate.toCanonical(),this.object.toCanonical()];return this.graph&&this.graph.termType!==l.ic&&t.push(this.graph.toCanonical()),t.join(" ")+" ."}},{key:"toNT",value:function(){return[this.subject.toNT(),this.predicate.toNT(),this.object.toNT()].join(" ")+" ."}},{key:"toNQ",value:function(){return[this.subject.toNT(),this.predicate.toNT(),this.object.toNT(),U(this.graph)?"":this.graph.toNT()].join(" ")+" ."}},{key:"toString",value:function(){return this.toNT()}}])}(),M=s(4221);function B(t,e,i){return e=(0,n.A)(e),(0,r.A)(t,q()?Reflect.construct(e,i||[],(0,n.A)(t).constructor):e.apply(t,i))}function q(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(q=function(){return!!t})()}var H=function(r){function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return(0,e.A)(this,n),t=B(this,n,[r]),(0,o.A)(t,"termType",l.P2),(0,o.A)(t,"base","varid:"),(0,o.A)(t,"classOrder",a.A.Variable),(0,o.A)(t,"isVar",1),(0,o.A)(t,"uri",void 0),t.base="varid:",t.uri=M.join(r,t.base),t}return(0,i.A)(n,r),(0,t.A)(n,[{key:"equals",value:function(t){return!!t&&this.termType===t.termType&&this.value===t.value}},{key:"hashString",value:function(){return this.toString()}},{key:"substitute",value:function(t){var e;return null!=(e=t[this.toNT()])?e:this}},{key:"toString",value:function(){return n.toString(this)}}],[{key:"toString",value:function(t){return t.uri.slice(0,t.base.length)===t.base?"?".concat(t.uri.slice(t.base.length)):"?".concat(t.uri)}}])}(c.A),$=function(t){return t.collections="COLLECTIONS",t.defaultGraphType="DEFAULT_GRAPH_TYPE",t.equalsMethod="EQUALS_METHOD",t.id="ID",t.identity="IDENTITY",t.reversibleId="REVERSIBLE_ID",t.variableType="VARIABLE_TYPE",t}({}),z=new F,X={supports:(0,o.A)((0,o.A)((0,o.A)((0,o.A)((0,o.A)((0,o.A)((0,o.A)({},$.collections,!1),$.defaultGraphType,!1),$.equalsMethod,!0),$.identity,!1),$.id,!0),$.reversibleId,!1),$.variableType,!0),blankNode:function(t){return new p(t)},defaultGraph:function(){return z},equals:function(t,e){return t===e||!t||!e||((0,v.aF)(t)||(0,v.aF)(e)?!(!(0,v.aF)(t)||!(0,v.aF)(e))&&this.equals(t.subject,e.subject)&&this.equals(t.predicate,e.predicate)&&this.equals(t.object,e.object)&&this.equals(t.graph,e.graph):!(!(0,v.D0)(t)||!(0,v.D0)(e))&&this.id(t)===this.id(e))},id:function(t){if(!t)return"undefined";if((0,v.aF)(t))return this.quadToNQ(t);switch(t.termType){case l.ic:return"defaultGraph";case l.P2:return H.toString(t);default:var e=this.termToNQ(t);if(e)return e;throw new Error("Can't id term with type '".concat(t.termType,"'"))}},isQuad:function(t){return t instanceof L},literal:function(t,e){if("string"!=typeof t&&!e)return w.fromValue(t);var r="string"==typeof t?t:""+t;return"string"==typeof e?-1===e.indexOf(":")?new w(r,e):new w(r,null,this.namedNode(e)):new w(r,null,e)},namedNode:function(t){return new y.A(t)},quad:function(t,e,r,n){return new L(t,e,r,n||z)},triple:function(t,e,r,n){return this.quad(t,e,r,n)},quadToNQ:function(t){return"".concat(this.termToNQ(t.subject)," ").concat(this.termToNQ(t.predicate)," ").concat(this.termToNQ(t.object)," ").concat(this.termToNQ(t.graph)," .")},termToNQ:function(t){var e=this;switch(t.termType){case l.$Q:return"_:"+t.value;case l.ic:return"";case l.S:return"";case l.QW:return w.toNT(t);case l.bD:case l.Kk:return"<"+t.value+">";case l.r0:return"("+t.elements.map((function(t){return e.termToNQ(t)})).join(" ")+")";default:throw new Error("Can't serialize nonstandard term type (was '".concat(t.termType,"')"))}},toNQ:function(t){return this.isQuad(t)?this.quadToNQ(t):this.termToNQ(t)},variable:function(t){return new H(t)}};const G=X;var V=s(3787);function W(t,e){var r=e||{namedNode:function(t){return new y.A(t)}};return function(e){return r.namedNode(t+(e||""))}}var Q=s(7114);function Y(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G;return{boolean:t.namedNode("http://www.w3.org/2001/XMLSchema#boolean"),dateTime:t.namedNode("http://www.w3.org/2001/XMLSchema#dateTime"),decimal:t.namedNode("http://www.w3.org/2001/XMLSchema#decimal"),double:t.namedNode("http://www.w3.org/2001/XMLSchema#double"),integer:t.namedNode("http://www.w3.org/2001/XMLSchema#integer"),langString:t.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),string:t.namedNode("http://www.w3.org/2001/XMLSchema#string")}}Y(G);var J=s(8540),Z=s.n(J),K=s(2312),tt=s(6357);function et(t){return new rt(t)}var rt=function(){function r(t){(0,e.A)(this,r),(0,o.A)(this,"_notQNameChars","\t\r\n !\"#$%&'()*.,+/;<=>?@[\\]^`{|}~"),(0,o.A)(this,"_notNameChars",this._notQNameChars+":"),(0,o.A)(this,"validPrefix",new RegExp(/^[a-zA-Z][a-zA-Z0-9]*$/)),(0,o.A)(this,"forbidden1",new RegExp(/[\\"\b\f\r\v\t\n\u0080-\uffff]/gm)),(0,o.A)(this,"forbidden3",new RegExp(/[\\"\b\f\r\v\u0080-\uffff]/gm)),this.flags="",this.base=null,this.prefixes=[],this.namespaces=[];var n=Object.keys(Z()());for(var i in n){var a=Z()()[n[i]](""),s=n[i];this.prefixes[a]=s,this.namespaces[s]=a}this.suggestPrefix("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this.suggestPrefix("xml","reserved:reservedForFutureUse"),this.namespacesUsed=[],this.keywords=["a"],this.prefixchars="abcdefghijklmnopqustuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",this.incoming=null,this.formulas=[],this.store=t,this.rdfFactory=t.rdfFactory||G,this.xsd=Y(this.rdfFactory)}return(0,t.A)(r,[{key:"setBase",value:function(t){return this.base=t,this}},{key:"setFlags",value:function(t){return this.flags=t||"",this}},{key:"toStr",value:function(t){var e=t.toNT();return"Graph"===t.termType&&(this.formulas[e]=t),e}},{key:"fromStr",value:function(t){if("{"===t[0]){var e=this.formulas[t];return e||tt.log("No formula object for "+t),e}return this.store.fromNT(t)}},{key:"setNamespaces",value:function(t){for(var e in t)this.setPrefix(e,t[e]);return this}},{key:"setPrefix",value:function(t,e){if("default"!==t.slice(0,7)&&"ns"!==t.slice(0,2)&&t&&e){for(var r in this.prefixes)this.prefixes[r]==t&&delete this.prefixes[r];this.prefixes[e]=t,this.namespaces[t]=e}}},{key:"suggestPrefix",value:function(t,e){"default"!==t.slice(0,7)&&"ns"!==t.slice(0,2)&&t&&e&&(t in this.namespaces||e in this.prefixes||(this.prefixes[e]=t,this.namespaces[t]=e))}},{key:"suggestNamespaces",value:function(t){for(var e in t)this.suggestPrefix(e,t[e]);return this}},{key:"checkIntegrity",value:function(){var t,e;for(t in this.namespaces)if(this.prefixes[this.namespaces[t]]!==t)throw new Error("Serializer integity error 1: "+t+", "+this.namespaces[t]+", "+this.prefixes[this.namespaces[t]]+"!");for(e in this.prefixes)if(this.namespaces[this.prefixes[e]]!==e)throw new Error("Serializer integity error 2: "+e+", "+this.prefixs[e]+", "+this.namespaces[this.prefixes[e]]+"!")}},{key:"makeUpPrefix",value:function(t){var e=t,r=function(e){return!!this.validPrefix.test(e)&&"ns"!==e&&!(e in this.namespaces)&&(this.prefixes[t]=e,this.namespaces[e]=t,e)}.bind(this);"#/".indexOf(e[e.length-1])>=0&&(e=e.slice(0,-1));var n=e.lastIndexOf("/");n>=0&&(e=e.slice(n+1));for(var i=0;i=0?t=function(t){for(var e,r="",n=0;n65535?"\\U"+("00000000"+e.toString(16)).slice(-8):e>126?"\\u"+("0000"+e.toString(16)).slice(-4):t[n];return r}(t):(e=decodeURI(t),t=encodeURI(e)),"<"+t+">"}},{key:"statementsToNTriples",value:function(t){var e=t.slice();e.sort();for(var r="",n="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i=this,o=this.store,a=this.rdfFactory,s=function t(e){if("Collection"!==e.termType)return i.atomicTermToN3(e);for(var s=e.elements,u=o.sym(n+"nill"),c=s.length-1;c>=0;c--){var l=a.blankNode();r+=t(l)+" "+t(o.sym(n+"first"))+" "+t(s[c])+".\n",r+=t(l)+" "+t(o.sym(n+"rest"))+" "+t(u)+".\n",u=l}return i.atomicTermToN3(u)},u=0;u=0&&(l+=s(c.why)+" "),r+=l+=".\n"}return r}},{key:"statementsToN3",value:function(t){var e=this.store,n={"http://www.w3.org/1999/02/22-rdf-syntax-ns#type":"aaa:00"};t.sort((function(t,r){return Q.heavyCompareSPO(t,r,e,n)})),this.base&&!this.defaultNamespace&&(this.defaultNamespace=this.base+"#");var i={};this.flags.indexOf("s")<0&&(i["http://www.w3.org/2002/07/owl#sameAs"]="="),this.flags.indexOf("t")<0&&(i["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]="a"),this.flags.indexOf("i")<0&&(i["http://www.w3.org/2000/10/swap/log#implies"]="=>");var o=function(t){for(var e="",r=0;r=0){n=n.slice(0,-1),"."==u&&"0123456789.:".includes(n.charAt(n.length-1))&&(n+=" ",i+=1),n+=u+"\n",i+=1;continue}if(i<4*r+4||i+u.length+1<80&&";.".indexOf(n[n.length-2])<0)n=n.slice(0,-1)+" "+u+"\n",i+=u.length+1;else{var h=o(4*r)+u;n+=h+"\n",i=h.length,r<0&&(n+="\n",i=1e5)}}}return n}(p)}},{key:"atomicTermToN3",value:function(t,e){switch(t.termType){case"BlankNode":case"Variable":return t.toNT();case"Literal":var r=t.value;if("string"!=typeof r)throw new TypeError("Value of RDF literal node must be a string");if(t.datatype&&this.flags.indexOf("x")<0)switch(t.datatype.uri){case"http://www.w3.org/2001/XMLSchema#integer":return r;case"http://www.w3.org/2001/XMLSchema#decimal":return r.indexOf(".")<0&&(r+=".0"),r;case"http://www.w3.org/2001/XMLSchema#double":var n=r.toLowerCase().indexOf("e")>0;return r.indexOf(".")<0&&!n&&(r+=".0"),n||(r+="e0"),r;case"http://www.w3.org/2001/XMLSchema#boolean":return"1"===t.value?"true":"false"}var i=this.stringToN3(t.value);return t.language?i+="@"+t.language:t.datatype.equals(this.xsd.string)||(i+="^^"+this.atomicTermToN3(t.datatype,e)),i;case"NamedNode":return this.symbolToN3(t);case"DefaultGraph":return"";default:throw new Error("Internal: atomicTermToN3 cannot handle "+t+" of termType: "+t.termType)}}},{key:"stringToN3",value:function(t,e){e||(e="e");var r,n,i,o,a,s="";for(t.length>20&&'"'!==t.slice(-1)&&e.indexOf("n")<0&&(t.indexOf("\n")>0||t.indexOf('"')>0)?(o='"""',a=this.forbidden3):(o='"',a=this.forbidden1),r=0;r=0?s+="\\"+'bfrtvn\\"'[i]:e.indexOf("e")>=0?s+="\\u"+("000"+u.charCodeAt(0).toString(16).toLowerCase()).slice(-4):s+=u,r=n+1}return o+s+t.slice(r)+o}},{key:"symbolToN3",value:function(t){var e=t.uri,r=e.indexOf("#");if(r<0&&this.flags.indexOf("/")<0&&(r=e.lastIndexOf("/")),r>=0&&this.flags.indexOf("p")<0&&(0===e.indexOf("http")||0===e.indexOf("ws")||0===e.indexOf("file"))){for(var n=!0,i=r+1;i=0){n=!1;break}if(n){var o=e.slice(r+1),a=e.slice(0,r+1);if(this.defaultNamespace&&this.defaultNamespace===a&&this.flags.indexOf("d")<0)return this.flags.indexOf("k")>=0&&this.keyords.indexOf(o)<0?o:":"+o;var s=this.prefixes[a];if(s||(s=this.makeUpPrefix(a)),s)return this.namespacesUsed[a]=!0,s+":"+o}}return this.explicitURI(e)}},{key:"writeStore",value:function(t){var e=this.store,r=e.fetcher,n=r&&r.appNode,i=this.store.index[3];for(var o in i){var a=e.fromNT(o);n&&a.equals(n)||t("\n"+this.atomicTermToN3(a)+" "+this.atomicTermToN3(e.sym("http://www.w3.org/2000/10/swap/log#semantics"))+" { "+this.statementsToN3(e.statementsMatching(void 0,void 0,void 0,a))+" }.\n")}e.statementsMatching(void 0,e.sym("http://www.w3.org/2007/ont/link#requestedURI")).map((function(r){t("\n<"+r.object.value+"> log:metadata {\n");var n=e.statementsMatching(void 0,void 0,void 0,r.subject);t(this.statementsToN3(this.statementsToN3(n))),t("}.\n")}));var s=[];n&&s.push(n);var u=[];s.map((function(t){u=u.concat(e.statementsMatching(void 0,void 0,void 0,t))})),t(this.statementsToN3(u))}},{key:"statementsToXML",value:function(t){var e=[];e["http://www.w3.org/1999/02/22-rdf-syntax-ns#"]=!0;var r="http://www.w3.org/1999/02/22-rdf-syntax-ns#_",n=function(t){for(var e="",r=0;r',u(o.object,e),""]):p.concat(["<"+i+' rdf:nodeID="'+o.object.toNT().slice(2)+'"/>']);break;case"NamedNode":p=p.concat(["<"+i+' rdf:resource="'+s(o.object)+'"/>']);break;case"Literal":p=p.concat(["<"+i+(o.object.datatype.equals(this.xsd.string)?"":' rdf:datatype="'+a(o.object.datatype.uri)+'"')+(o.object.language?' xml:lang="'+o.object.language+'"':"")+">"+a(o.object.value)+""]);break;case"Collection":p=p.concat(["<"+i+' rdf:parseType="Collection">',c(o.object,e),""]);break;default:throw new Error("Can't serialize object of type "+o.object.termType+" into XML")}}else n=o.object;var g=n?h(n):"rdf:Description",m="";return"BlankNode"===t.termType?e.incoming[t]&&1===e.incoming[t].length||(m=' rdf:nodeID="'+t.toNT().slice(2)+'"'):m=' rdf:about="'+s(t)+'"',["<"+g+m+">"].concat([p]).concat([""])}.bind(this);function c(t,e){for(var r=[],n=0;n',""]):r.concat(["<"+h(o.predicate)+' rdf:parseType="Resource">',l(o.object,e),""]);break;case"NamedNode":r=r.concat(["<"+h(o.predicate)+' rdf:resource="'+s(o.object)+'"/>']);break;case"Literal":r=r.concat(["<"+h(o.predicate)+(o.object.datatype.equals(this.xsd.string)?"":' rdf:datatype="'+a(o.object.datatype.value)+'"')+(o.object.language?' xml:lang="'+o.object.language+'"':"")+">"+a(o.object.value)+""]);break;case"Collection":r=r.concat(["<"+h(o.predicate)+' rdf:parseType="Collection">',c(o.object,e),""]);break;default:throw new Error("Can't serialize object of type "+o.object.termType+" into XML")}}return r}.bind(this),h=function(t){var r=t.uri,n=r.indexOf("#");if(n<0&&this.flags.indexOf("/")<0&&(n=r.lastIndexOf("/")),n<0)throw new Error("Cannot make qname out of <"+r+">");for(var i=n+1;i=0)throw new Error('Invalid character "'+r[i]+'" cannot be in XML qname for URI: '+r);var o=r.slice(n+1),a=r.slice(0,n+1);if(this.defaultNamespace&&this.defaultNamespace===a&&this.flags.indexOf("d")<0)return o;var s=this.prefixes[a];return s||(s=this.makeUpPrefix(a)),e[a]=!0,s+":"+o}.bind(this),f=o(t),p=""],-1)}},{key:"statementsToJsonld",value:function(t){var e=this.statementsToN3(t),r=K.parse(e);return JSON.stringify(r,null,2)}}])}();function nt(t,e,r,n,i,o){r=r||(null==t?void 0:t.value);var a=o||{};n=n||l.sT;try{var s=et(e);a.flags&&s.setFlags(a.flags);var u=e.statementsMatching(void 0,void 0,void 0,t);switch("namespaces"in e&&s.suggestNamespaces(e.namespaces),a.namespaces&&s.setNamespaces(a.namespaces),s.setBase(r),n){case l.JG:return c(null,s.statementsToXML(u));case l.ny:case l.MG:return c(null,s.statementsToN3(u));case l.sT:case l.hu:return s.setFlags("si"),c(null,s.statementsToN3(u));case l.bM:return s.setFlags("deinprstux"),c(null,s.statementsToNTriples(u));case l.i2:return s.setFlags("si dr"),c(null,s.statementsToJsonld(u));case l._0:case l.BR:return s.setFlags("deinprstux q"),c(null,s.statementsToNTriples(u));default:throw new Error("Serialize: Content-type "+n+" not supported for data write.")}}catch(t){if(i)return i(t,void 0);throw t}function c(t,e){return i?void i(t,e):e}}var it=["blankNode","defaultGraph","literal","namedNode","quad","variable","supports"],ot={first:"http://www.w3.org/1999/02/22-rdf-syntax-ns#first",rest:"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest",nil:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"};function at(t,e,r){var n=[];return r.reduce((function(e,r,i,o){var a;return n.push(t.quad(e,t.namedNode(ot.first),o[i])),i2&&void 0!==arguments[2]?arguments[2]:0,n=t.length;for(r<0&&(r=n+r);rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};(0,e.A)(this,n),(t=ct(this,n,[""])).statements=r,t.constraints=i,t.initBindings=s,t.optional=u,(0,o.A)(t,"termType",l.bD),(0,o.A)(t,"classOrder",a.A.Graph),(0,o.A)(t,"fetcher",void 0),(0,o.A)(t,"isVar",0),(0,o.A)(t,"ns",W),(0,o.A)(t,"rdfFactory",void 0),t.rdfFactory=c&&c.rdfFactory||G;var h,f=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return ut(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ut(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}(it);try{var p=function(){var e=h.value;t[e]=function(){var r;return(r=t.rdfFactory)[e].apply(r,arguments)}};for(f.s();!(h=f.n()).done;)p()}catch(t){f.e(t)}finally{f.f()}return t}return(0,i.A)(n,r),(0,t.A)(n,[{key:"add",value:function(t,e,r,n){var i=this;return 1===arguments.length&&t.forEach((function(t){return i.add(t.subject,t.predicate,t.object,t.graph)})),this.statements.push(this.rdfFactory.quad(t,e,r,n))}},{key:"addStatement",value:function(t){return this.add(t)}},{key:"bnode",value:function(t){return this.rdfFactory.blankNode(t)}},{key:"addAll",value:function(t){var e=this;t.forEach((function(t){e.add(t.subject,t.predicate,t.object,t.graph)}))}},{key:"any",value:function(t,e,r,n){var i=this.anyStatementMatching(t,e,r,n);return null==i?null:null==t?i.subject:null==e?i.predicate:null==r?i.object:null}},{key:"anyValue",value:function(t,e,r,n){var i=this.any(t,e,r,n);return i?i.value:void 0}},{key:"anyJS",value:function(t,e,r,n){var i=this.any(t,e,r,n);return i?c.A.toJS(i):void 0}},{key:"anyStatementMatching",value:function(t,e,r,n){var i=this.statementsMatching(t,e,r,n,!0);if(i&&0!==i.length)return i[0]}},{key:"id",value:function(t){return this.rdfFactory.id(t)}},{key:"statementsMatching",value:function(t,e,r,n,i){var o=this.statements.filter((function(i){return(!t||t.equals(i.subject))&&(!e||e.equals(i.predicate))&&(!r||r.equals(i.object))&&(!n||n.equals(i.graph))}));return i?0===o.length?[]:[o[0]]:o}},{key:"bottomTypeURIs",value:function(t){var e,r,n,i,o,a;for(var s in e=[],t)if(t.hasOwnProperty(s)){for(a=t[s],r=!0,n=0,i=(o=this.each(void 0,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),this.rdfFactory.namedNode(s))).length;n "+t[e]);return r}function o(t){var e,r="Bindings: ",n=t.length;for(e=0;ei.length)&&(e.index=i)}}return null===e.index&&(e.index=t.statements),!0}function f(t,e){return t.nvars!==e.nvars?t.nvars-e.nvars:t.index.length-e.index.length}l.prototype.reportMatch=function(t){this.results.push(t)},l.prototype.reportDone=function(){V.A.debug("Optional branch finished - results.length = "+this.results.length),0===this.results.length&&(this.results.push({}),V.A.debug("Optional branch FAILED - that's OK.")),this.done=!0,this.junction.checkAllDone()};var p=function t(r,n,o,a,s,c,h){V.A.debug("Match begins, Branch count now: "+h.count+" for "+h.pattern_debug);var f,p,d=n.statements;if(0===d.length){if(V.A.debug("FOUND MATCH WITH BINDINGS:"+i(o)),0===n.optional.length)h.reportMatch(o);else{V.A.debug("OPTIONAL: "+n.optional);var v,g=new u(e,o),m=[];for(v=0;v in query: "+u),t(r,n,o,a,s,c,h)}))};for(p=0;pt.length)&&(e=t.length);for(var r=0,n=new Array(e);r1&&void 0!==arguments[1]?arguments[1]:{};return(0,e.A)(this,n),r=wt(this,n,[void 0,void 0,void 0,void 0,i]),(0,o.A)(r,"updater",void 0),(0,o.A)(r,"namespaces",void 0),(0,o.A)(r,"classActions",void 0),(0,o.A)(r,"propertyActions",void 0),(0,o.A)(r,"redirections",void 0),(0,o.A)(r,"aliases",void 0),(0,o.A)(r,"HTTPRedirects",void 0),(0,o.A)(r,"subjectIndex",void 0),(0,o.A)(r,"predicateIndex",void 0),(0,o.A)(r,"objectIndex",void 0),(0,o.A)(r,"whyIndex",void 0),(0,o.A)(r,"index",void 0),(0,o.A)(r,"features",void 0),(0,o.A)(r,"_universalVariables",void 0),(0,o.A)(r,"_existentialVariables",void 0),(0,o.A)(r,"rdfArrayRemove",void 0),(0,o.A)(r,"dataCallbacks",void 0),r.propertyActions={},r.classActions={},r.redirections=[],r.aliases=[],r.HTTPRedirects=[],r.subjectIndex=[],r.predicateIndex=[],r.objectIndex=[],r.whyIndex=[],r.index=[r.subjectIndex,r.predicateIndex,r.objectIndex,r.whyIndex],r.namespaces={},r.features=t||[],r.rdfArrayRemove=i.rdfArrayRemove||Q.RDFArrayRemove,i.dataCallback&&(r.dataCallbacks=[i.dataCallback]),r.initPropertyActions(r.features),r}return(0,i.A)(n,r),(0,t.A)(n,[{key:"substitute",value:function(t){var e=this.statements.map((function(e){return e.substitute(t)})),r=new n;return r.add(e),r}},{key:"addDataCallback",value:function(t){this.dataCallbacks||(this.dataCallbacks=[]),this.dataCallbacks.push(t)}},{key:"applyPatch",value:function(t,e,r){var n,i=this,o=null;function a(a){if(t.delete){n=t.delete,o&&(n=n.substitute(o)),n=n.statements;var s=[],u=n.map((function(t){var r=i.statementsMatching(t.subject,t.predicate,t.object,e);return 0===r.length?(s.push(t),null):r[0]}));if(s.length)return r("Could not find to delete: "+s.join("\n or "));u.map((function(t){i.remove(t)}))}t.insert&&(n=t.insert,o&&(n=n.substitute(o)),(n=n.statements).map((function(t){t.graph=e,i.add(t.subject,t.predicate,t.object,t.graph)}))),a()}if(t.where){var s=new yt("patch");s.pat=t.where,s.pat.statements.map((function(t){t.graph=Cr(e.value)})),s.sync=!0;var u=[];i.query(s,(function(t){u.push(t)}),i.fetcher,(function(){return 0===u.length?r("No match found to be patched:"+t.where):u.length>1?r("Patch ambiguous. No patch done."):(o=u[0],void a(r))}))}else a(r)}},{key:"declareExistential",value:function(t){return this._existentialVariables||(this._existentialVariables=[]),this._existentialVariables.push(t),t}},{key:"initPropertyActions",value:function(t){this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"))]=[Tt],st(t,"sameAs")>=0&&(this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode("".concat(xt,"sameAs")))]=[function(t,e,r,n,i){return t.equate(e,n),!0}]),st(t,"InverseFunctionalProperty")>=0&&(this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode("".concat(xt,"InverseFunctionalProperty")))]=[function(t,e,r,n,i){return t.newPropertyAction(e,kt)}]),st(t,"FunctionalProperty")>=0&&(this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode("".concat(xt,"FunctionalProperty")))]=[function(t,e,r,n,i){return t.newPropertyAction(e,_t)}])}},{key:"addStatement",value:function(t){return this.add(t.subject,t.predicate,t.object,t.graph),this.statements.length}},{key:"add",value:function(t,e,r,n){var i,o,a;if(1===arguments.length){if(t instanceof Array)for(i=0;i=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}(this.dataCallbacks);try{for(d.s();!(p=d.n()).done;)(0,p.value)(a)}catch(t){d.e(t)}finally{d.f()}}return a}},{key:"canon",value:function(t){if(!t)return t;var e=this.redirections[this.id(t)];if(e)return e;switch(t.termType){case l.$Q:return new p(t.value);case l.r0:return t;case l.ic:return new F;case l.S:case l.bD:return t;case l.QW:return new w(t.value,t.language,t.datatype);case l.Kk:return new y.A(t.value);case l.P2:return new H(t.value);default:throw new Error("Term Type not recognized for canonization: ".concat(t.termType))}}},{key:"check",value:function(){this.checkStatementList(this.statements);for(var t=0;t<4;t++){var e=this.index[t];for(var r in e)e.hasOwnProperty(r)&&this.checkStatementList(e[r],t)}}},{key:"checkStatementList",value:function(t,e){void 0===e&&(e=0);for(var r,n=" found in "+["subject","predicate","object","why"][e]+" index.",i=0;ia.A[e.termType]?1:t.valuee.value?1:0}},{key:"copyTo",value:function(t,e,r){r||(r=[]);var n=this.statementsMatching(t);-1!==st(r,"two-direction")&&n.concat(this.statementsMatching(void 0,void 0,t));for(var i=0;i";return!!this.subjectIndex[e]||!!this.objectIndex[e]||!!this.predicateIndex[e]}},{key:"newExistential",value:function(t){if(!t)return this.bnode();var e=this.sym(t);return this.declareExistential(e)}},{key:"newPropertyAction",value:function(t,e){var r=this.id(t);this.propertyActions[r]||(this.propertyActions[r]=[]),this.propertyActions[r].push(e);for(var n=this.statementsMatching(void 0,t,void 0),i=!1,o=0;o1&&(a=a.slice(0,1)),a||[];var f,p,d=1e10;for(p=0;p=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function jt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0)throw"missing.js: oops nnonempty dict not imp";return[]},Ft=function(t){return t.length},Ut=function(t,e,r){if(void 0===t.slice)throw"@@ mising.js: No .slice function for "+t+" of type "+(0,d.A)(t);return void 0===r||null==r?t.slice(e):t.slice(e,r)},Dt=Error("dummy error stop iteration"),Lt=function(t){return this.last=0,this.li=t,this.next=function(){if(this.last==this.li.length)throw Dt;return this.li[this.last++]},this},Mt=function(t,e){return t.indexOf(e)},Bt=function(t,e){if(!t){if(e)throw"python Assertion failed: "+e;throw"(python) Assertion failed."}};String.prototype.encode=function(t){if("utf-8"!=t)throw"UTF8_converter: can only do utf-8";return function(t){t=t.replace(/\r\n/g,"\n");for(var e="",r=0;r127&&n<2048?(e+=String.fromCharCode(n>>6|192),e+=String.fromCharCode(63&n|128)):(e+=String.fromCharCode(n>>12|224),e+=String.fromCharCode(n>>6&63|128),e+=String.fromCharCode(63&n|128))}return e}(this)},String.prototype.decode=function(t){if("utf-8"!=t)throw"UTF8_converter: can only do utf-8";return this};var qt=function(t,e){return M.join(e,t)},Ht="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil",$t="http://www.w3.org/2002/07/owl#sameAs",zt="\t\r\n !\"#$%&'()*.,+/;<=>?@[\\]^`{|}~",Xt=zt+":",Gt=new RegExp("^([-+]?[0-9]+)(\\.[0-9]+)?([eE][-+]?[0-9]+)?","g"),Vt=new RegExp("^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9](T[0-9][0-9]:[0-9][0-9](:[0-9][0-9](\\.[0-9]*)?)?)?Z?"),Wt=new RegExp('[\\\\\\r\\n\\"]',"g"),Qt=new RegExp("^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*","g");const Yt=function(t,e,r,n,i,o,a,s){return new Jt(t,e,r,n,i,o,a,s)};var Jt=function(){return(0,t.A)((function t(r,n,i,o,a,s,u,c){(0,e.A)(this,t),void 0===n&&(n=null),void 0===i&&(i=""),void 0===o&&(o=null),void 0===a&&(a=""),void 0===s&&(s=null),void 0===u&&(u=""),void 0===c&&(c=null),this._bindings=new Pt([]),this._flags=u,""!=i&&(Bt(i.indexOf(":")>=0,"Document URI not absolute: "+i),this._bindings[""]=i+"#"),this._store=r,a&&r.setGenPrefix(a),this._thisDoc=i,this.source=r.sym(i),this.lines=0,this.statementCount=0,this.hasNil=!1,this.startOfLine=0,this.previousLine=0,this._genPrefix=a,this.keywords=new Ct(["a","this","bind","has","is","of","true","false"]),this.keywordsSet=0,this._anonymousNodes=new Pt([]),this._variables=new Pt([]),this._parentVariables=new Pt([]),this._reason=c,this._reason2=null,this._baseURI=o||i||null,Bt(!this._baseURI||this._baseURI.indexOf(":")>=0),this._genPrefix||(this._thisDoc?this._genPrefix=this._thisDoc+"#_g":this._genPrefix=RDFSink_uniqueURI()),null==n?this._thisDoc?this._formula=r.formula(i+"#_formula"):this._formula=r.formula():this._formula=n,this._context=this._formula,this._parentContext=null}),[{key:"here",value:function(t){return this._genPrefix+"_L"+this.lines+"C"+(t-this.startOfLine+1)}},{key:"formula",value:function(){return this._formula}},{key:"loadStream",value:function(t){return this.loadBuf(t.read())}},{key:"loadBuf",value:function(t){return this.startDoc(),this.feed(t),this.endDoc()}},{key:"feed",value:function(t){for(var e=t.decode("utf-8"),r=0;r>=0;){var n=this.skipSpace(e,r);if(n<0)return;if((r=this.directiveOrStatement(e,n))<0)throw Zt(this._thisDoc,this.lines,e,n,"expected directive or statement")}}},{key:"directiveOrStatement",value:function(t,e){var r,n=this.skipSpace(t,e);return n<0?n:(r=this.directive(t,n))>=0||(r=this.statement(t,n))>=0?this.checkDot(t,r):r}},{key:"tok",value:function(t,e,r){if("@"==e.slice(r,r+1))r+=1;else if(st(this.keywords,t)<0)return-1;var n=r+Ft(t);return e.slice(r,n)==t&&zt.indexOf(e.charAt(n))>=0?n:-1}},{key:"directive",value:function(t,e){if((o=this.skipSpace(t,e))<0)return o;var r=new Ct([]);if((o=this.tok("bind",t,e))>0)throw Zt(this._thisDoc,this.lines,t,e,"keyword bind is obsolete: use @prefix");if((o=this.tok("keywords",t,e))>0){if((e=this.commaSeparatedList(t,o,r,!1))<0)throw Zt(this._thisDoc,this.lines,t,e,"'@keywords' needs comma separated list of words");return this.setKeywords(Ut(r,null,null)),e}if((o=this.tok("forAll",t,e))>0){if((e=this.commaSeparatedList(t,o,r,!0))<0)throw Zt(this._thisDoc,this.lines,t,e,"Bad variable list after @forAll");var n=new Lt(r);try{for(;;){var i=n.next();(st(this._variables,i)<0||st(this._parentVariables,i)>=0)&&(this._variables[i]=this._context.newUniversal(i))}}catch(t){if(t!=Dt)throw t}return e}if((o=this.tok("forSome",t,e))>0){if((e=this.commaSeparatedList(t,o,r,this.uri_ref2))<0)throw Zt(this._thisDoc,this.lines,t,e,"Bad variable list after @forSome");n=new Lt(r);try{for(;;)i=n.next(),this._context.declareExistential(i)}catch(t){if(t!=Dt)throw t}return e}if((o=this.tok("prefix",t,e))>=0){var o,a=new Ct([]);if((e=this.qname(t,o,a))<0)throw Zt(this._thisDoc,this.lines,t,o,"expected qname after @prefix");if((o=this.uri_ref2(t,e,a))<0)throw Zt(this._thisDoc,this.lines,t,e,"expected after @prefix _qname_");var s=a[1].uri;return this._baseURI?s=qt(this._baseURI,s):Bt(s.indexOf(":")>=0,"With no base URI, cannot handle relative URI for NS"),Bt(s.indexOf(":")>=0),this._bindings[a[0][0]]=s,this.bind(a[0][0],function(t){return encodeURI(t)}(s)),o}if((o=this.tok("base",t,e))>=0){if(a=new Ct([]),(e=this.uri_ref2(t,o,a))<0)throw Zt(this._thisDoc,this.lines,t,o,"expected after @base ");if(s=a[0].uri,!this._baseURI)throw Zt(this._thisDoc,this.lines,t,o,"With no previous base URI, cannot use relative URI in @base <"+s+">");return s=qt(this._baseURI,s),Bt(s.indexOf(":")>=0),this._baseURI=s,e}return-1}},{key:"bind",value:function(t,e){""==t||this._store.setPrefixForURI(t,e)}},{key:"setKeywords",value:function(t){null==t?this.keywordsSet=0:(this.keywords=t,this.keywordsSet=1)}},{key:"startDoc",value:function(){}},{key:"endDoc",value:function(){return this.hasNil&&this._store.rdfFactory.supports.COLLECTIONS&&St(this._store,this.source),this._formula}},{key:"makeStatement",value:function(t){t[0].add(t[2],t[1],t[3],this.source),(t[2].uri&&t[2].uri===Ht||t[3].uri&&t[3].uri===Ht)&&(this.hasNil=!0),this.statementCount+=1}},{key:"statement",value:function(t,e){var r=new Ct([]);if((e=this.object(t,e,r))<0)return e;var n=this.property_list(t,e,r[0]);if(n<0)throw Zt(this._thisDoc,this.lines,t,e,"expected propertylist");return n}},{key:"subject",value:function(t,e,r){return this.item(t,e,r)}},{key:"verb",value:function(t,e,r){if((i=this.skipSpace(t,e))<0)return i;var n=new Ct([]);if((i=this.tok("has",t,e))>=0){if((e=this.prop(t,i,n))<0)throw Zt(this._thisDoc,this.lines,t,i,"expected property after 'has'");return r.push(new It(["->",n[0]])),e}if((i=this.tok("is",t,e))>=0){if((e=this.prop(t,i,n))<0)throw Zt(this._thisDoc,this.lines,t,i,"expected after 'is'");if((i=this.skipSpace(t,e))<0)throw Zt(this._thisDoc,this.lines,t,e,"End of file found, expected property after 'is'");var i;if(e=i,(i=this.tok("of",t,e))<0)throw Zt(this._thisDoc,this.lines,t,e,"expected 'of' after 'is' ");return r.push(new It(["<-",n[0]])),i}if((i=this.tok("a",t,e))>=0)return r.push(new It(["->",this._store.sym("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")])),i;if("<="==t.slice(e,e+2))return r.push(new It(["<-",this._store.sym(Rt+"implies")])),e+2;if("="==t.slice(e,e+1))return">"==t.slice(e+1,e+2)?(r.push(new It(["->",this._store.sym(Rt+"implies")])),e+2):(r.push(new It(["->",this._store.sym($t)])),e+1);if(":="==t.slice(e,e+2))return r.push(new It(["->",Rt+"becomes"])),e+2;if((i=this.prop(t,e,n))>=0)return r.push(new It(["->",n[0]])),i;if(">-"==t.slice(e,e+2)||"<-"==t.slice(e,e+2))throw Zt(this._thisDoc,this.lines,t,i,">- ... -> syntax is obsolete.");return-1}},{key:"prop",value:function(t,e,r){return this.item(t,e,r)}},{key:"item",value:function(t,e,r){return this.path(t,e,r)}},{key:"blankNode",value:function(t){return this._context.bnode(t,this._reason2)}},{key:"path",value:function(t,e,r){if((o=this.nodeOrLiteral(t,e,r))<0)return o;for(;"!^.".indexOf(t.slice(o,o+1))>=0;){var n=t.slice(o,o+1);if("."==n){var i=t.slice(o+1,o+2);if(!i||Xt.indexOf(i)>=0&&":?<[{(".indexOf(i)<0)break}var o,a=r.pop(),s=this.blankNode(this.here(o));if((o=this.node(t,o+1,r))<0)throw Zt(this._thisDoc,this.lines,t,o,"EOF found in middle of path syntax");var u=r.pop();"^"==n?this.makeStatement(new It([this._context,u,s,a])):this.makeStatement(new It([this._context,u,a,s])),r.push(s)}return o}},{key:"anonymousNode",value:function(t){if(e=this._anonymousNodes[t])return e;var e=this._store.bnode(t);return this._anonymousNodes[t]=e,e}},{key:"node",value:function(t,e,r,n){void 0===n&&(n=null);var i=n;if((l=this.skipSpace(t,e))<0)return l;e=l;var o=t.slice(e,e+1);if("["==o){var a=this.here(e);if((l=this.skipSpace(t,e+1))<0)throw Zt(this._thisDoc,this.lines,t,e,"EOF after '['");if("="==t.slice(l,l+1)){e=l+1;var s=new Ct([]);if(!((l=this.objectList(t,e,s))>=0))throw Zt(this._thisDoc,this.lines,t,e,"objectList expected after [= ");if(i=s[0],Ft(s)>1){var u=new Lt(s);try{for(;;){var c=u.next();this.makeStatement(new It([this._context,this._store.sym($t),i,c]))}}catch(t){if(t!=Dt)throw t}}if((l=this.skipSpace(t,l))<0)throw Zt(this._thisDoc,this.lines,t,e,"EOF when objectList expected after [ = ");if(";"==t.slice(l,l+1))var l=l+1}if(null==i&&(i=this.blankNode(a)),(e=this.property_list(t,l,i))<0)throw Zt(this._thisDoc,this.lines,t,l,"property_list expected");if((l=this.skipSpace(t,e))<0)throw Zt(this._thisDoc,this.lines,t,e,"EOF when ']' expected after [ ");if("]"!=t.slice(l,l+1))throw Zt(this._thisDoc,this.lines,t,l,"']' expected");return r.push(i),l+1}if("{"==o){if("$"==t.slice(e+1,e+2)){l=(e+=1)+1;for(var h=new Ct([]),f=!0;;){if((e=this.skipSpace(t,l))<0)throw Zt(this._thisDoc,this.lines,t,e,"needed '$}', found end.");if("$}"==t.slice(e,e+2)){l=e+2;break}if(f)f=!1;else{if(","!=t.slice(e,e+1))throw Zt(this._thisDoc,this.lines,t,e,"expected: ','");e+=1}var p=new Ct([]);if((l=this.item(t,e,p))<0)throw Zt(this._thisDoc,this.lines,t,e,"expected item in set or '$}'");h.push(p[0])}return r.push(this._store.newSet(h,this._context)),l}l=e+1;var d=this._parentContext;this._parentContext=this._context;var y=this._anonymousNodes,v=this._parentVariables;this._parentVariables=this._variables,this._anonymousNodes=new Pt([]),this._variables=this._variables.slice();var g=this._reason2;for(this._reason2=null,null==i&&(i=this._store.formula()),this._context=i;;){if((e=this.skipSpace(t,l))<0)throw Zt(this._thisDoc,this.lines,t,e,"needed '}', found end.");if("}"==t.slice(e,e+1)){l=e+1;break}if((l=this.directiveOrStatement(t,e))<0)throw Zt(this._thisDoc,this.lines,t,e,"expected statement or '}'")}return this._anonymousNodes=y,this._variables=this._parentVariables,this._parentVariables=v,this._context=this._parentContext,this._reason2=g,this._parentContext=d,r.push(i.close()),l}if("("==o){var m=this._store.list;for("$"==t.slice(e+1,e+2)&&(m=this._store.newSet,e+=1),l=e+1,h=new Ct([]);;){if((e=this.skipSpace(t,l))<0)throw Zt(this._thisDoc,this.lines,t,e,"needed ')', found end.");if(")"==t.slice(e,e+1)){l=e+1;break}if(p=new Ct([]),(l=this.item(t,e,p))<0)throw Zt(this._thisDoc,this.lines,t,e,"expected item in list or ')'");h.push(p[0])}return r.push(m(h,this._context)),l}if((l=this.tok("this",t,e))>=0)throw Zt(this._thisDoc,this.lines,t,e,"Keyword 'this' was ancient N3. Now use @forSome and @forAll keywords.");return(l=this.tok("true",t,e))>=0?(r.push(!0),l):(l=this.tok("false",t,e))>=0?(r.push(!1),l):null==i&&(l=this.uri_ref2(t,e,r))>=0?l:-1}},{key:"property_list",value:function(t,e,r){for(;;){if((l=this.skipSpace(t,e))<0)throw Zt(this._thisDoc,this.lines,t,e,"EOF found when expected verb in property list");if(":-"!=t.slice(l,l+2)){e=l;var n=new Ct([]);if((l=this.verb(t,e,n))<=0)return e;var i=new Ct([]);if((e=this.objectList(t,l,i))<0)throw Zt(this._thisDoc,this.lines,t,l,"objectList expected");var o=new Lt(i);try{for(;;){var a=o.next(),s=n[0],u=s[0],c=s[1];"->"==u?this.makeStatement(new It([this._context,c,r,a])):this.makeStatement(new It([this._context,c,a,r]))}}catch(t){if(t!=Dt)throw t}if((l=this.skipSpace(t,e))<0)throw Zt(this._thisDoc,this.lines,t,l,"EOF found in list of objects");if(";"!=t.slice(e,e+1))return e;e+=1}else{e=l+2;var l,h=new Ct([]);if((l=this.node(t,e,h,r))<0)throw Zt(this._thisDoc,this.lines,t,e,"bad {} or () or [] node after :- ");e=l}}}},{key:"commaSeparatedList",value:function(t,e,r,n){if((i=this.skipSpace(t,e))<0)throw Zt(this._thisDoc,this.lines,t,i,"EOF found expecting comma sep list");if("."==t.charAt(i))return e;if(n)var i=this.uri_ref2(t,i,r);else i=this.bareWord(t,i,r);if(i<0)return-1;for(;;){if((e=this.skipSpace(t,i))<0)return e;var o=t.slice(e,e+1);if(","!=o)return"."!=o?-1:e;if((i=n?this.uri_ref2(t,e+1,r):this.bareWord(t,e+1,r))<0)throw Zt(this._thisDoc,this.lines,t,i,"bad list content")}}},{key:"objectList",value:function(t,e,r){if((e=this.object(t,e,r))<0)return-1;for(;;){var n=this.skipSpace(t,e);if(n<0)throw Zt(this._thisDoc,this.lines,t,n,"EOF found after object");if(","!=t.slice(n,n+1))return n;if((e=this.object(t,n+1,r))<0)return e}}},{key:"checkDot",value:function(t,e){var r=this.skipSpace(t,e);if(r<0)return r;if("."==t.slice(r,r+1))return r+1;if("}"==t.slice(r,r+1))return r;if("]"==t.slice(r,r+1))return r;throw Zt(this._thisDoc,this.lines,t,r,"expected '.' or '}' or ']' at end of statement")}},{key:"uri_ref2",value:function(t,e,r){var n=new Ct([]);if((f=this.qname(t,e,n))>=0){var i=n[0],o=i[0],a=i[1];if(null==o){Bt(0,"not used?");var s=this._baseURI+"#"}else if(!(s=this._bindings[o])){if("_"==o)return r.push(this.anonymousNode(a)),f;throw Zt(this._thisDoc,this.lines,t,e,"Prefix "+o+" not bound.")}var u=this._store.sym(s+a);return st(this._variables,u)>=0?r.push(this._variables[u]):r.push(u),f}if((e=this.skipSpace(t,e))<0)return-1;if("?"==t.charAt(e)){var c=new Ct([]);return(f=this.variable(t,e,c))>0?(r.push(c[0]),f):-1}if("<"==t.charAt(e)){for(var l=e+=1;e"==t.charAt(e)){var h=t.slice(l,e);return this._baseURI?h=qt(this._baseURI,h):Bt(h.indexOf(":")>=0,"With no base URI, cannot deal with relative URIs"),"#"==t.slice(e-1,e)&&"#"!=Ut(h,-1,null)&&(h+="#"),u=this._store.sym(h),st(this._variables,u)>=0?r.push(this._variables[u]):r.push(u),e+1}e+=1}throw Zt(this._thisDoc,this.lines,t,f,"unterminated URI reference")}if(this.keywordsSet){var f;if(c=new Ct([]),(f=this.bareWord(t,e,c))<0)return-1;if(st(this.keywords,c[0])>=0)throw Zt(this._thisDoc,this.lines,t,e,'Keyword "'+c[0]+'" not allowed here.');return r.push(this._store.sym(this._bindings[""]+c[0])),f}return-1}},{key:"skipSpace",value:function(t,e){for(var r=e||0;r=0)throw Zt(this._thisDoc,this.lines,t,n,"Varible name can't start with '"+t.charAt(n)+"s'");for(;e=0)return-1;if(Xt.indexOf(i)>=0)return-1;for(e=n;e=0)return-1;if(Xt.indexOf(n)<0){var i=n;for(e+=1;e=0)return a;if((a=this.skipSpace(t,e))<0)return-1;e=a;var n=null,i=t.charAt(e);if('"'==i||"'"==i){n=t.slice(e,e+3==i+i)?i+i+i:i,e+=Ft(n);var o=this.strconst(t,e,n),a=o[0],s=o[1];return r.push(this._store.literal(s)),a}return-1}},{key:"nodeOrLiteral",value:function(t,e,r){if((u=this.node(t,e,r))>=0)return u;if((u=this.skipSpace(t,e))<0)return-1;e=u;var n=t.charAt(e);if("-+0987654321".indexOf(n)>=0){if(Vt.lastIndex=0,null!=(h=Vt.exec(t.slice(e))))u=e+(i=h[0]).length,i.indexOf("T")>=0?r.push(this._store.literal(i,this._store.sym("http://www.w3.org/2001/XMLSchema#dateTime"))):r.push(this._store.literal(i,this._store.sym("http://www.w3.org/2001/XMLSchema#date")));else{var i;if(Gt.lastIndex=0,null==(h=Gt.exec(t.slice(e))))throw Zt(this._thisDoc,this.lines,t,e,"Bad number or date syntax");u=e+Gt.lastIndex,(i=t.slice(e,u)).indexOf("e")>=0?r.push(this._store.literal(parseFloat(i),this._store.sym("http://www.w3.org/2001/XMLSchema#double"))):t.slice(e,u).indexOf(".")>=0?r.push(this._store.literal(parseFloat(i),this._store.sym("http://www.w3.org/2001/XMLSchema#decimal"))):r.push(this._store.literal(parseInt(i),this._store.sym("http://www.w3.org/2001/XMLSchema#integer")))}return u}if('"'==t.charAt(e)){if('"""'==t.slice(e,e+3))var o='"""';else o='"';e+=Ft(o);var a=null,s=this.strconst(t,e,o),u=s[0],c=s[1],l=null;if("@"==t.slice(u,u+1)){var h;if(Qt.lastIndex=0,null==(h=Qt.exec(t.slice(u+1))))throw Zt(this._thisDoc,startline,t,e,"Bad language code syntax on string literal, after @");e=Qt.lastIndex+u+1,l=t.slice(u+1,e),u=e}if("^^"==t.slice(u,u+2)){var f=new Ct([]);u=this.uri_ref2(t,u+2,f),a=f[0]}return r.push(this._store.literal(c,l||a)),u}return-1}},{key:"strconst",value:function(t,e,r){for(var n=e,i="",o=this.lines;n=0)i+='a\b\f\r\t\v\n\\"'.charAt(a),n+=1;else if("u"==u)n=(s=this.uEscape(t,n+1,o))[0],i+=u=s[1];else{if("U"!=u)throw Zt(this._thisDoc,this.lines,t,e,"bad escape");var s,u;n=(s=this.UEscape(t,n+1,o))[0],i+=u=s[1]}}}else n=e+1;else n=e}else i=i+'"',n=n+1}throw Zt(this._thisDoc,this.lines,t,e,"unterminated string literal")}},{key:"uEscape",value:function(t,e,r){for(var n=e,i=0,o=0;i<4;){var a=t.slice(n,n+1).toLowerCase();if(n+=1,""==a)throw Zt(this._thisDoc,r,t,e,"unterminated string literal(3)");var s=Mt("0123456789abcdef",a);if(s<0)throw Zt(this._thisDoc,r,t,e,"bad string literal hex escape");o=16*o+s,i+=1}var u=String.fromCharCode(o);return new It([n,u])}},{key:"UEscape",value:function(t,e,r){for(var n=e,i=0,o="\\U";i<8;){var a=t.slice(n,n+1).toLowerCase();if(n+=1,""==a)throw Zt(this._thisDoc,r,t,e,"unterminated string literal(3)");if(Mt("0123456789abcdef",a)<0)throw Zt(this._thisDoc,r,t,e,"bad string literal hex escape");o+=a,i+=1}var s,u=(s="0x"+Ut(o,2,10)-0,String.fromCharCode(s));return new It([n,u])}}])}();function Zt(t,e,r,n,i){var o=e+1,a="Line "+o+" of <"+t+">: Bad syntax: "+i+'\nat: "'+r.slice(n,n+30)+'"',s=new SyntaxError(a,t,o);return s.lineNo=o,s.characterInFile=n,s.syntaxProblem=i,s}function Kt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function te(t){for(var e=1;e\\"\{\}\|\^\`]/,be={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},we=/$0^/;class Ae{constructor(t){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,t=t||{},this._lineMode=!!t.lineMode){this._n3Mode=!1;for(const t in this)!(t in be)&&this[t]instanceof RegExp&&(this[t]=we)}else this._n3Mode=!1!==t.n3;this._comments=!!t.comments,this._literalClosingPos=0}_tokenizeToEnd(t,e){let r=this._input,n=r.length;for(;;){let t,a;for(;t=this._newline.exec(r);)this._comments&&(a=this._comment.exec(t[0]))&&i("comment",a[1],"",this._line,t[0].length),r=r.substr(t[0].length,r.length),n=r.length,this._line++;if(!t&&(t=this._whitespace.exec(r))&&(r=r.substr(t[0].length,r.length)),this._endOfFile.test(r))return e&&(this._comments&&(a=this._comment.exec(r))&&i("comment",a[1],"",this._line,r.length),r=null,i("eof","","",this._line,0)),this._input=r;const s=this._line,u=r[0];let c="",l="",h="",f=null,p=0,d=!1;switch(u){case"^":if(r.length<3)break;if("^"!==r[1]){this._n3Mode&&(p=1,c="^");break}if(this._previousMarker="^^",r=r.substr(2),"<"!==r[0]){d=!0;break}case"<":if(f=this._unescapedIri.exec(r))c="IRI",l=f[1];else if(f=this._iri.exec(r)){if(l=this._unescape(f[1]),null===l||me.test(l))return o(this);c="IRI"}else r.length>1&&"<"===r[1]?(c="<<",p=2):this._n3Mode&&r.length>1&&"="===r[1]&&(c="inverse",p=2,l=">");break;case">":r.length>1&&">"===r[1]&&(c=">>",p=2);break;case"_":((f=this._blank.exec(r))||e&&(f=this._blank.exec(`${r} `)))&&(c="blank",h="_",l=f[1]);break;case'"':if(f=this._simpleQuotedString.exec(r))l=f[1];else if(({value:l,matchLength:p}=this._parseLiteral(r)),null===l)return o(this);null===f&&0===p||(c="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(f=this._simpleApostropheString.exec(r))l=f[1];else if(({value:l,matchLength:p}=this._parseLiteral(r)),null===l)return o(this);null===f&&0===p||(c="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(f=this._variable.exec(r))&&(c="var",l=f[0]);break;case"@":"literal"===this._previousMarker&&(f=this._langcode.exec(r))?(c="langcode",l=f[1]):(f=this._keyword.exec(r))&&(c=f[0]);break;case".":if(1===r.length?e:r[1]<"0"||r[1]>"9"){c=".",p=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(f=this._number.exec(r)||e&&(f=this._number.exec(`${r} `)))&&(c="literal",l=f[0],h="string"==typeof f[1]?ye.double:"string"==typeof f[2]?ye.decimal:ye.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(f=this._sparqlKeyword.exec(r))?c=f[0].toUpperCase():d=!0;break;case"f":case"t":(f=this._boolean.exec(r))?(c="literal",l=f[0],h=ye.boolean):d=!0;break;case"a":(f=this._shortPredicates.exec(r))?(c="abbreviation",l="a"):d=!0;break;case"=":this._n3Mode&&r.length>1&&(c="abbreviation",">"!==r[1]?(p=1,l="="):(p=2,l=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(p=1,c=u);break;case"{":!this._lineMode&&r.length>=2&&("|"===r[1]?(c="{|",p=2):(c=u,p=1));break;case"|":r.length>=2&&"}"===r[1]&&(c="|}",p=2);break;default:d=!0}if(d&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(f=this._prefix.exec(r))?((f=this._prefixed.exec(r))||e&&(f=this._prefixed.exec(`${r} `)))&&(c="prefixed",h=f[1]||"",l=this._unescape(f[2])):(c="prefix",l=f[1]||"")),"^^"===this._previousMarker)switch(c){case"prefixed":c="type";break;case"IRI":c="typeIRI";break;default:c=""}if(!c)return e||!/^'''|^"""/.test(r)&&/\n|\r/.test(r)?o(this):this._input=r;const y=p||f[0].length,v=i(c,l,h,s,y);this.previousToken=v,this._previousMarker=c,r=r.substr(y,r.length)}function i(e,i,o,a,s){const u=r?n-r.length:n,c={type:e,value:i,prefix:o,line:a,start:u,end:u+s};return t(null,c),c}function o(e){t(e._syntaxError(/^\S*/.exec(r)[0]))}}_unescape(t){let e=!1;const r=t.replace(ve,((t,r,n,i)=>{if("string"==typeof r)return String.fromCharCode(Number.parseInt(r,16));if("string"==typeof n){let t=Number.parseInt(n,16);return t<=65535?String.fromCharCode(Number.parseInt(n,16)):String.fromCharCode(55296+((t-=65536)>>10),56320+(1023&t))}return i in ge?ge[i]:(e=!0,"")}));return e?null:r}_parseLiteral(t){if(t.length>=3){const e=t.match(/^(?:"""|"|'''|'|)/)[0],r=e.length;let n=Math.max(this._literalClosingPos,r);for(;(n=t.indexOf(e,n))>0;){let e=0;for(;"\\"===t[n-e-1];)e++;if(e%2==0){const e=t.substring(r,n),i=e.split(/\r\n|\r|\n/).length-1,o=n+r;if(1===r&&0!==i||3===r&&this._lineMode)break;return this._line+=i,{value:this._unescape(e),matchLength:o}}n++}this._literalClosingPos=t.length-r+1}return{value:"",matchLength:0}}_syntaxError(t){this._input=null;const e=new Error(`Unexpected "${t}" on line ${this._line}.`);return e.context={token:void 0,line:this._line,previousToken:this.previousToken},e}_readStartingBom(t){return t.startsWith("\ufeff")?t.substr(1):t}tokenize(t,e){if(this._line=1,"string"==typeof t){if(this._input=this._readStartingBom(t),"function"!=typeof e){const t=[];let e;if(this._tokenizeToEnd(((r,n)=>r?e=r:t.push(n)),!0),e)throw e;return t}ce()((()=>this._tokenizeToEnd(e,!0)))}else this._pendingBuffer=null,"function"==typeof t.setEncoding&&t.setEncoding("utf8"),t.on("data",(t=>{null!==this._input&&0!==t.length&&(this._pendingBuffer&&(t=de.concat([this._pendingBuffer,t]),this._pendingBuffer=null),128&t[t.length-1]?this._pendingBuffer=t:(void 0===this._input?this._input=this._readStartingBom("string"==typeof t?t:t.toString()):this._input+=t,this._tokenizeToEnd(e,!1)))})),t.on("end",(()=>{"string"==typeof this._input&&this._tokenizeToEnd(e,!0)})),t.on("error",e)}}const{rdf:xe,xsd:_e}=pe;let ke,Te=0;const Ee={namedNode:function(t){return new je(t)},blankNode:function(t){return new Se(t||"n3-"+Te++)},variable:function(t){return new Re(t)},literal:function(t,e){if("string"==typeof e)return new Ne(`"${t}"@${e.toLowerCase()}`);let r=e?e.value:"";return""===r&&("boolean"==typeof t?r=_e.boolean:"number"==typeof t&&(Number.isFinite(t)?r=Number.isInteger(t)?_e.integer:_e.double:(r=_e.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),""===r||r===_e.string?new Ne(`"${t}"`):new Ne(`"${t}"^^${r}`)},defaultGraph:function(){return ke},quad:Ce,triple:Ce};class Oe{constructor(t){this.id=t}get value(){return this.id}equals(t){return t instanceof Oe?this.id===t.id:!!t&&this.termType===t.termType&&this.value===t.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}class je extends Oe{get termType(){return"NamedNode"}}class Ne extends Oe{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const t=this.id;let e=t.lastIndexOf('"')+1;return enull),this._blankNodePrefix="string"!=typeof t.blankNodePrefix?"":t.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=t.lexer||new Ae({lineMode:s,n3:a}),this._explicitQuantifiers=!!t.explicitQuantifiers}static _resetBlankNodePrefix(){Pe=0}_setBase(t){if(t){const e=t.indexOf("#");e>=0&&(t=t.substr(0,e)),this._base=t,this._basePath=t.indexOf("/")<0?t:t.replace(/[^\/?]*(?:\?.*)?$/,""),t=t.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=t[0],this._baseScheme=t[1]}else this._base="",this._basePath=""}_saveContext(t,e,r,n,i){const o=this._n3Mode;this._contextStack.push({type:t,subject:r,predicate:n,object:i,graph:e,inverse:!!o&&this._inversePredicate,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(t,e){const r=this._contextStack.pop();if(!r||r.type!==t)return this._error(`Unexpected ${e.type}`,e);this._subject=r.subject,this._predicate=r.predicate,this._object=r.object,this._graph=r.graph,this._n3Mode&&(this._inversePredicate=r.inverse,this._prefixes._=r.blankPrefix,this._quantified=r.quantified)}_readInTopContext(t){switch(t.type){case"eof":return null!==this._graph?this._error("Unclosed graph",t):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(t)}}_readEntity(t,e){let r;switch(t.type){case"IRI":case"typeIRI":const e=this._resolveIRI(t.value);if(null===e)return this._error("Invalid IRI",t);r=this._namedNode(e);break;case"type":case"prefixed":const n=this._prefixes[t.prefix];if(void 0===n)return this._error(`Undefined prefix "${t.prefix}:"`,t);r=this._namedNode(n+t.value);break;case"blank":r=this._blankNode(this._prefixes[t.prefix]+t.value);break;case"var":r=this._variable(t.value.substr(1));break;default:return this._error(`Expected entity but got ${t.type}`,t)}return!e&&this._n3Mode&&r.id in this._quantified&&(r=this._quantified[r.id]),r}_readSubject(t){switch(this._predicate=null,t.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._blankNode(),null,null),this._readSubject):this._error("Unexpected graph",t);case"}":return this._readPunctuation(t);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier=this._blankNode,this._readQuantifierList):this._error('Unexpected "@forSome"',t);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier=this._variable,this._readQuantifierList):this._error('Unexpected "@forAll"',t);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",t);if(0===t.prefix.length)return this._literalValue=t.value,this._completeSubjectLiteral;this._subject=this._literal(t.value,this._namedNode(t.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",t);default:if(void 0===(this._subject=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(t){const e=t.type;switch(e){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[t.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${e}`,t):(this._subject=null,"]"===e?this._readBlankNodeTail(t):this._readPunctuation(t));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",t);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",t);default:if(void 0===(this._predicate=this._readEntity(t)))return}return this._readObject}_readObject(t){switch(t.type){case"literal":if(0===t.prefix.length)return this._literalValue=t.value,this._readDataTypeOrLang;this._object=this._literal(t.value,this._namedNode(t.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",t);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",t);default:if(void 0===(this._object=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(t){return"{"===t.type?this._readGraph(t):this._readPredicate(t)}_readGraph(t){return"{"!==t.type?this._error(`Expected graph but got ${t.type}`,t):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(t){return"]"===t.type?(this._subject=null,this._readBlankNodeTail(t)):(this._predicate=null,this._readPredicate(t))}_readBlankNodeTail(t){if("]"!==t.type)return this._readBlankNodePunctuation(t);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const e=null===this._predicate;return this._restoreContext("blank",t),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:e?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(t){switch(t.type){case".":case"}":return this._subject=null,this._readPunctuation(t);default:return this._readPredicate(t)}}_readListItem(t){let e=null,r=null,n=this._readListItem;const i=this._subject,o=this._contextStack,a=o[o.length-1];switch(t.type){case"[":this._saveContext("blank",this._graph,r=this._blankNode(),this.RDF_FIRST,this._subject=e=this._blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,r=this._blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",t),0!==o.length&&"list"===o[o.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(n=this._readPredicate,this._subject===this.RDF_NIL)return n}else if(n=this._getContextEndReader(),this._object===this.RDF_NIL)return n;r=this.RDF_NIL;break;case"literal":0===t.prefix.length?(this._literalValue=t.value,n=this._readListItemDataTypeOrLang):(e=this._literal(t.value,this._namedNode(t.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",t);default:if(void 0===(e=this._readEntity(t)))return}if(null===r&&(this._subject=r=this._blankNode()),null===i?null===a.predicate?a.subject=r:a.object=r:this._emit(i,this.RDF_REST,r,this._graph),null!==e){if(this._n3Mode&&("IRI"===t.type||"prefixed"===t.type))return this._saveContext("item",this._graph,r,this.RDF_FIRST,e),this._subject=e,this._predicate=null,this._getPathReader(this._readListItem);this._emit(r,this.RDF_FIRST,e,this._graph)}return n}_readDataTypeOrLang(t){return this._completeObjectLiteral(t,!1)}_readListItemDataTypeOrLang(t){return this._completeObjectLiteral(t,!0)}_completeLiteral(t){let e=this._literal(this._literalValue);switch(t.type){case"type":case"typeIRI":const r=this._readEntity(t);if(void 0===r)return;e=this._literal(this._literalValue,r),t=null;break;case"langcode":e=this._literal(this._literalValue,t.value),t=null}return{token:t,literal:e}}_completeSubjectLiteral(t){return this._subject=this._completeLiteral(t).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(t,e){const r=this._completeLiteral(t);if(r)return this._object=r.literal,e&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),null===r.token?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(r.token))}_readFormulaTail(t){return"}"!==t.type?this._readPunctuation(t):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",t),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(t){let e,r=this._graph;const n=this._subject,i=this._inversePredicate;switch(t.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",t);if(this._n3Mode)return this._readFormulaTail(t);this._graph=null;case".":this._subject=null,e=this._contextStack.length?this._readSubject:this._readInTopContext,i&&(this._inversePredicate=!1);break;case";":e=this._readPredicate;break;case",":e=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF* syntax",t);const o=this._predicate,a=this._object;this._subject=this._quad(n,o,a,this.DEFAULTGRAPH),e=this._readPredicate;break;case"|}":if("Quad"!==this._subject.termType)return this._error("Unexpected asserted triple closing",t);this._subject=null,e=this._readPunctuation;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(r=this._readEntity(t))){e=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,t)}if(null!==n){const t=this._predicate,e=this._object;i?this._emit(e,t,n,r):this._emit(n,t,e,r)}return e}_readBlankNodePunctuation(t){let e;switch(t.type){case";":e=this._readPredicate;break;case",":e=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,t)}return this._emit(this._subject,this._predicate,this._object,this._graph),e}_readQuadPunctuation(t){return"."!==t.type?this._error("Expected dot to follow quad",t):this._readInTopContext}_readPrefix(t){return"prefix"!==t.type?this._error("Expected prefix to follow @prefix",t):(this._prefix=t.value,this._readPrefixIRI)}_readPrefixIRI(t){if("IRI"!==t.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,t);const e=this._readEntity(t);return this._prefixes[this._prefix]=e.value,this._prefixCallback(this._prefix,e),this._readDeclarationPunctuation}_readBaseIRI(t){const e="IRI"===t.type&&this._resolveIRI(t.value);return e?(this._setBase(e),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",t)}_readNamedGraphLabel(t){switch(t.type){case"IRI":case"blank":case"prefixed":return this._readSubject(t),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",t)}}_readNamedGraphBlankLabel(t){return"]"!==t.type?this._error("Invalid graph label",t):(this._subject=this._blankNode(),this._readGraph)}_readDeclarationPunctuation(t){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(t)):"."!==t.type?this._error("Expected declaration to end with a dot",t):this._readInTopContext}_readQuantifierList(t){let e;switch(t.type){case"IRI":case"prefixed":if(void 0!==(e=this._readEntity(t,!0)))break;default:return this._error(`Unexpected ${t.type}`,t)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,e,this.QUANTIFIERS_GRAPH)):this._quantified[e.id]=this._quantifier(this._blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(t){return","===t.type?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(t))}_getPathReader(t){return this._afterPath=t,this._readPath}_readPath(t){switch(t.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const e=this._contextStack,r=e.length&&e[e.length-1];if(r&&"item"===r.type){const e=this._subject;this._restoreContext("item",t),this._emit(this._subject,this.RDF_FIRST,e,this._graph)}return this._afterPath(t)}}_readForwardPath(t){let e,r;const n=this._blankNode();if(void 0!==(r=this._readEntity(t)))return null===this._predicate?(e=this._subject,this._subject=n):(e=this._object,this._object=n),this._emit(e,r,n,this._graph),this._readPath}_readBackwardPath(t){const e=this._blankNode();let r,n;if(void 0!==(r=this._readEntity(t)))return null===this._predicate?(n=this._subject,this._subject=e):(n=this._object,this._object=e),this._emit(e,r,n,this._graph),this._readPath}_readRDFStarTailOrGraph(t){return">>"!==t.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(t))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,t):this._readRDFStarTail(t)}_readRDFStarTail(t){if(">>"!==t.type)return this._error(`Expected >> but got ${t.type}`,t);const e=this._quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",t),null===this._subject?(this._subject=e,this._readPredicate):(this._object=e,this._getContextEndReader())}_getContextEndReader(){const t=this._contextStack;if(!t.length)return this._readPunctuation;switch(t[t.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(t,e,r,n){this._callback(null,this._quad(t,e,r,n||this.DEFAULTGRAPH))}_error(t,e){const r=new Error(`${t} on line ${e.line}.`);r.context={token:e,line:e.line,previousToken:this._lexer.previousToken},this._callback(r),this._callback=Ue}_resolveIRI(t){return/^[a-z][a-z0-9+.-]*:/i.test(t)?t:this._resolveRelativeIRI(t)}_resolveRelativeIRI(t){if(!t.length)return this._base;switch(t[0]){case"#":return this._base+t;case"?":return this._base.replace(/(?:\?.*)?$/,t);case"/":return("/"===t[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(t);default:return/^[^/:]*:/.test(t)?null:this._removeDotSegments(this._basePath+t)}}_removeDotSegments(t){if(!/(^|\/)\.\.?($|[/#?])/.test(t))return t;const e=t.length;let r="",n=-1,i=-1,o=0,a="/";for(;n=i&&(r=r.substr(0,o)),"/"!==a)return`${r}/${t.substr(n+1)}`;o=n+1}}}a=t[++n]}return r+t.substring(o)}parse(t,e,r){if(this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Pe++}_`,this._prefixCallback=r||Ue,this._inversePredicate=!1,this._quantified=Object.create(null),!e){const e=[];let r;if(this._callback=(t,n)=>{t?r=t:n&&e.push(n)},this._lexer.tokenize(t).every((t=>this._readCallback=this._readCallback(t))),r)throw r;return e}this._callback=e,this._lexer.tokenize(t,((t,e)=>{null!==t?(this._callback(t),this._callback=Ue):this._readCallback&&(this._readCallback=this._readCallback(e))}))}}function Ue(){}function De(t,e){const r=e.namedNode;t._namedNode=r,t._blankNode=e.blankNode,t._literal=e.literal,t._variable=e.variable,t._quad=e.quad,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=r(pe.rdf.first),t.RDF_REST=r(pe.rdf.rest),t.RDF_NIL=r(pe.rdf.nil),t.N3_FORALL=r(pe.r.forAll),t.N3_FORSOME=r(pe.r.forSome),t.ABBREVIATIONS={a:r(pe.rdf.type),"=":r(pe.owl.sameAs),">":r(pe.log.implies)},t.QUANTIFIERS_GRAPH=r("urn:n3:quantifiers")}De(Fe.prototype,Ee);var Le=s(6357);if(void 0===Me)var Me={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 Be=function(){function r(t,n){(0,e.A)(this,r),this.options=n||{},this.kb=t,this.target=n.target||{graph:{subjects:{},prefixes:{},terms:{}}},this.blankNodes=[],this.htmlOptions={selfClosing:"br img input area base basefont col colgroup source wbr isindex link meta param hr"},this.theOne="_:"+(new Date).getTime(),this.language=null,this.vocabulary=null,this.blankCounter=0,this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"}],this.inXHTMLMode=!1,this.absURIRE=/[\w\_\-]+:\S+/,this.finishedHandlers=[],this.init()}return(0,t.A)(r,[{key:"addTriple",value:function(t,e,r,n){var i,o,a,s;i=void 0===e?G.namedNode(this.options.base):this.toRDFNodeObject(e),a=this.toRDFNodeObject(r),o=this.toRDFNodeObject(n),s=G.namedNode(this.options.base),this.kb.add(i,a,o,s)}},{key:"ancestorPath",value:function(t){for(var e="";t&&t.nodeType!==Me.DOCUMENT_NODE;)e="/"+t.localName+e,t=t.parentNode;return e}},{key:"copyMappings",value:function(t){var e={};for(var r in t)e[r]=t[r];return e}},{key:"copyProperties",value:function(){}},{key:"deriveDateTimeType",value:function(t){for(var e=0;e=0){var a=t.substring(0,o);if(""===a)return(i=e[""])?i+t.substring(o+1):null;if("_"===a)return"_:"+t.substring(o+1);if(r.NCNAME.test(a)&&(i=e[a]))return i+t.substring(o+1)}return null}},{key:"parseCURIEOrURI",value:function(t,e,r){return this.parseCURIE(t,e,r)||this.resolveAndNormalize(r,t)}},{key:"parsePredicate",value:function(t,e,r,n,i,o){if(""===t)return null;var a=this.parseTermOrCURIEOrAbsURI(t,e,o?null:r,n,i);return a&&0===a.indexOf("_:")?null:a}},{key:"parsePrefixMappings",value:function(t,e){for(var r=this.tokenize(t),n=null,i=0;i=0&&(t=t.substring(0,r)),e&&e.baseURIMap&&(t=e.baseURIMap(t)),t};for(i.push({current:t,context:this.push(null,o(t.baseURI))});i.length>0;){var a=i.shift();if(a.parent){if(a.context.parent&&a.context.parent.listMapping===a.listMapping)continue;for(var s in a.listMapping){var u=a.listMapping[s];if(0!==u.length){for(var c=[],l=0;l0){k=E;var O=n.spec;this.addTriple(f,O,"http://www.w3.org/ns/rdfa#usesVocabulary",{type:r.objectURI,value:k})}else k=this.vocabulary}for(var j=0;j0?F:null}var U,D,L=f.getAttributeNode("rel"),B=f.getAttributeNode("rev"),q=f.getAttributeNode("typeof"),H=f.getAttributeNode("property"),$=f.getAttributeNode("datatype"),z=this.inHTMLMode?f.getAttributeNode("datetime"):null,X=f.getAttributeNode("content"),G=f.getAttributeNode("about"),V=f.getAttributeNode("src"),W=f.getAttributeNode("resource"),Q=f.getAttributeNode("href"),Y=f.getAttributeNode("inlist"),J=[];if(L){D=this.tokenize(L.value);for(var Z=0;Z=0?e+=t.nodeName.split(":")[1]:e+=t.nodeName),e}.bind(this),i=!0;t.parent;){var o=t.element,a=o.attributes;if(o.nodeType===r.nodeType.TEXT||o.nodeType===r.nodeType.CDATA_SECTION)t.parent.nodeType===t.NODE&&(t.addArc(r.ns.RDF+"value"),t=this.buildFrame(t)),t.addLiteral(o.nodeValue);else if(n(o)!==r.ns.RDF+"RDF")if(t.parent&&t.parent.collection&&(t.addCollectionArc(),(t=this.buildFrame(t,t.element)).parent.element=null),t.parent&&t.parent.nodeType&&t.parent.nodeType!==t.ARC){t.addArc(n(o)),this.reify&&(e=this.getAttributeNodeNS(o,r.ns.RDF,"ID"))&&(t.rdfid=e.nodeValue,o.removeAttributeNode(e));var s=this.getAttributeNodeNS(o,r.ns.RDF,"parseType"),u=this.getAttributeNodeNS(o,r.ns.RDF,"datatype");if(u&&(t.datatype=u.nodeValue,o.removeAttributeNode(u)),s){var c=s.nodeValue;"Literal"===c?(t.datatype=r.ns.RDF+"XMLLiteral",(t=this.buildFrame(t)).addLiteral(o.innerHTML||o.childNodes),i=!1):"Resource"===c?((t=this.buildFrame(t,t.element)).parent.element=null,t.addBNode()):"Collection"===c&&((t=this.buildFrame(t,t.element)).parent.element=null,t.addCollection()),o.removeAttributeNode(s)}if(0!==a.length){var l=this.getAttributeNodeNS(o,r.ns.RDF,"resource"),h=this.getAttributeNodeNS(o,r.ns.RDF,"nodeID");t=this.buildFrame(t),l?(t.addNode(l.nodeValue),o.removeAttributeNode(l)):h?(t.addBNode(h.nodeValue),o.removeAttributeNode(h)):t.addBNode();for(var f=a.length-1;f>=0;f--){var p=this.buildFrame(t);p.addArc(n(a[f])),n(a[f])===r.ns.RDF+"type"?this.buildFrame(p).addNode(a[f].nodeValue):this.buildFrame(p).addLiteral(a[f].nodeValue)}}else 0===o.childNodes.length&&this.buildFrame(t).addLiteral("")}else{var d=this.getAttributeNodeNS(o,r.ns.RDF,"about");if(e=this.getAttributeNodeNS(o,r.ns.RDF,"ID"),d&&e)throw new Error("RDFParser: "+o.nodeName+" has both rdf:id and rdf:about. Halting. Only one of these properties may be specified on a node.");if(!d&&e)t.addNode("#"+e.nodeValue),o.removeAttributeNode(e);else if(null==d&&null==e){var y=this.getAttributeNodeNS(o,r.ns.RDF,"nodeID");y?(t.addBNode(y.nodeValue),o.removeAttributeNode(y)):t.addBNode()}else t.addNode(d.nodeValue),o.removeAttributeNode(d);var v=this.getAttributeNodeNS(o,r.ns.RDF,"type");r.ns.RDF+"Description"!==n(o)&&(v={nodeValue:n(o)}),null!=v&&(this.store.add(t.node,this.store.sym(r.ns.RDF+"type"),this.store.sym(M.join(v.nodeValue,t.base)),this.why),v.nodeName&&o.removeAttributeNode(v));for(var g=a.length-1;g>=0;g--)this.store.add(t.node,this.store.sym(n(a[g])),this.store.literal(a[g].nodeValue,t.lang),this.why)}for(o=t.element;t.parent;){for(var m=t;null==o;)o=(t=t.parent).element;var b=o.childNodes&&o.childNodes[t.lastChild];if(b&&i){if((b.nodeType===r.nodeType.ELEMENT||b.nodeType===r.nodeType.TEXT||b.nodeType===r.nodeType.CDATA_SECTION)&&(b.nodeType!==r.nodeType.TEXT&&b.nodeType!==r.nodeType.CDATA_SECTION||1===o.childNodes.length)){t.lastChild++,t=this.buildFrame(m,o.childNodes[t.lastChild-1]);break}t.lastChild++}else{if(t.terminateFrame(),!(t=t.parent))break;o=t.element,i=!0}}}}},{key:"cleanParser",value:function(){this.bnodes={},this.why=null}},{key:"buildFrame",value:function(t,e){var n=this.frameFactory(this,t,e);if(t&&(n.base=t.base,n.lang=t.lang),!e||e.nodeType===r.nodeType.TEXT||e.nodeType===r.nodeType.CDATA_SECTION)return n;var i=e.attributes,o=e.getAttributeNode("xml:base");null!=o&&(n.base=o.nodeValue,e.removeAttribute("xml:base"));var a=e.getAttributeNode("xml:lang");null!=a&&(n.lang=a.nodeValue,e.removeAttribute("xml:lang"));for(var s=i.length-1;s>=0;s--)if("xml"===i[s].nodeName.substr(0,3)){if("xmlns:"===i[s].name.slice(0,6)){var u=i[s].nodeValue;this.base&&(u=M.join(u,this.base)),this.store.setPrefixForURI(i[s].name.slice(6),u)}e.removeAttributeNode(i[s])}return n}}])}();function $e(t,e,r){var n,i,o,a=["INSERT","DELETE","WHERE"],s=W("http://www.w3.org/ns/pim/patch#"),u=Yt(e,e,r,r,null,null,"",null),c={},l=function(t,e,r,n,i){return"Line "+(e+1)+" of <"+t+">: Bad syntax:\n "+i+'\n at: "'+r.slice(n,n+30)+'"'};n=0;var h=e.sym(r+"#query");for(c.query=h;;){if((i=u.skipSpace(t,n))<0)return c;if(";"===t[i]){if((n=u.skipSpace(t,i+1))<0)return c;i=n}var f=!1;for(o=0;o3&&void 0!==arguments[3]?arguments[3]:"text/turtle",i=arguments.length>4?arguments[4]:void 0;n=(n=n||l.sT).split(";")[0];try{if(n===l.ny||n===l.sT)Yt(e,e,r,r,null,null,"",null).loadBuf(t),a();else if(n===l.JG)new He(e).parse(Q.parseXML(t),r,e.sym(r)),a();else if(n===l.H)qe(Q.parseXML(t,{contentType:l.H}),e,r),a();else if(n===l.lc)qe(Q.parseXML(t,{contentType:l.lc}),e,r),a();else if(n===l.K9||n===l.Fn)$e(t,e,r),a();else if(n===l.i2)ie(t,e,r,a);else{if(n!==l._0&&n!==l.BR)throw void 0===n?new Error("contentType is undefined"):new Error("Don't know how to parse "+n+" yet");var o=new Fe({factory:re});!function(t,r){try{o.parse(r,s)}catch(t){i(t,e)}}(null,t)}}catch(t){!function(t){if(n!==l.i2||n!==l._0||n!==l.BR){if(!i){var o=new Error(t+" while trying to parse <"+r+"> as "+n);throw o.cause=t,o}i(t,e)}}(t)}function a(){i&&i(null,e)}function s(t,r){r?e.add(r.subject,r.predicate,r.object,r.graph):i(t,e)}ze.handled={"text/n3":!0,"text/turtle":!0,"application/rdf+xml":!0,"application/xhtml+xml":!0,"text/html":!0,"application/sparql-update":!0,"application/sparql-update-single-match":!0,"application/ld+json":!0,"application/nquads":!0,"application/n-quads":!0}}(0,o.A)(He,"ns",{RDF:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",RDFS:"http://www.w3.org/2000/01/rdf-schema#"}),(0,o.A)(He,"nodeType",{ELEMENT:1,ATTRIBUTE:2,TEXT:3,CDATA_SECTION:4,ENTITY_REFERENCE:5,ENTITY:6,PROCESSING_INSTRUCTION:7,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,DOCUMENT_FRAGMENT:11,NOTATION:12});var Xe=s(1147),Ge=s.n(Xe),Ve=s(362),We=s(6357);function Qe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&o.add(r.resource,er.dc("title"),o.rdfFactory.literal(a[0].textContent),r.resource);for(var s=this.dom.getElementsByTagName("link"),u=s.length-1;u>=0;u--)i=!1,(n=s[u].getAttribute("rel"))||(n=s[u].getAttribute("rev"),i=!0),n&&t.linkData(r.original,n,s[u].getAttribute("href"),r.resource,i);for(var c=this.dom.getElementsByTagName("script"),l=0;l");return!(-1===e||-1===r||e>r)&&-1!==t.substr(e,r-e).indexOf("XHTML")}(e))return t.addStatus(r.req,"Has XHTML DOCTYPE. Switching to XHTMLHandler.\n"),new ir(this.response).parse(t,e,r);if(function(t){return!!t.match(/[^(/)}(e))return t.addStatus(r.req,"Has default namespace for XHTML, so switching to XHTMLHandler.\n"),new ir(this.response).parse(t,e,r);var i=new RegExp("([\\s\\S]+?)","im").exec(e);return i&&n.add(r.resource,er.dc("title"),n.rdfFactory.literal(i[1]),r.resource),n.add(r.resource,er.rdf("type"),er.link("WebPage"),t.appNode),t.addStatus(r.req,"non-XML HTML document, not parsed for data."),t.doneFetch(r,this.response)}}],[{key:"toString",value:function(){return"HTMLHandler"}},{key:"register",value:function(t){t.mediatypes["text/html"]={q:.9}}}])}(rr);ar.pattern=new RegExp("text/html");var sr=function(r){function n(){return(0,e.A)(this,n),Ye(this,n,arguments)}return(0,i.A)(n,r),(0,t.A)(n,[{key:"parse",value:function(t,e,r,n){var i=t.store;return new Promise((function(o,a){try{ie(e,i,r.original.value,(function(){o(t.doneFetch(r,n))}))}catch(e){var s="Error trying to parse "+r.resource+" as JSON-LD:\n"+e;o(t.failFetch(r,s,"parse_error",n))}}))}}],[{key:"toString",value:function(){return"JsonLdHandler"}},{key:"register",value:function(t){t.mediatypes["application/ld+json"]={q:.9}}}])}(rr);sr.pattern=/application\/ld\+json/;var ur=function(r){function n(){return(0,e.A)(this,n),Ye(this,n,arguments)}return(0,i.A)(n,r),(0,t.A)(n,[{key:"parse",value:function(t,e,r){return hr(e)?(t.addStatus(r.req,"Warning: "+r.resource+" has an XML declaration. We'll assume it's XML but its content-type wasn't XML.\n"),new or(this.response).parse(t,e,r)):e.slice(0,500).match(/xmlns:/)?(t.addStatus(r.req,"May have an XML namespace. We'll assume it's XML but its content-type wasn't XML.\n"),new or(this.response).parse(t,e,r)):(t.addStatus(r.req,"Plain text document, no known RDF semantics."),t.doneFetch(r,this.response))}}],[{key:"toString",value:function(){return"TextHandler"}},{key:"register",value:function(t){t.mediatypes["text/plain"]={q:.5}}}])}(rr);ur.pattern=new RegExp("text/plain");var cr=function(r){function n(){return(0,e.A)(this,n),Ye(this,n,arguments)}return(0,i.A)(n,r),(0,t.A)(n,[{key:"parse",value:function(t,e,r,n){var i=t.store,o=Yt(i,i,r.original.value,r.original.value,null,null,"",null);try{o.loadBuf(e)}catch(e){var a="Error trying to parse "+r.resource+" as Notation3:\n"+e;return t.failFetch(r,a,"parse_error",n)}return t.addStatus(r.req,"N3 parsed: "+o.statementCount+" triples in "+o.lines+" lines."),t.store.add(r.original,er.rdf("type"),er.link("RDFDocument"),t.appNode),t.doneFetch(r,this.response)}}],[{key:"toString",value:function(){return"N3Handler"}},{key:"register",value:function(t){t.mediatypes["text/n3"]={q:"1.0"},t.mediatypes["text/turtle"]={q:1}}}])}(rr);cr.pattern=new RegExp("(application|text)/(x-)?(rdf\\+)?(n3|turtle)");var lr={RDFXMLHandler:nr,XHTMLHandler:ir,XMLHandler:or,HTMLHandler:ar,TextHandler:ur,N3Handler:cr,JsonLdHandler:sr};function hr(t){return!!t.match(/\s*<\?xml\s+version\s*=[^<>]+\?>/)}var fr=function(){function r(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((0,e.A)(this,r),(0,o.A)(this,"store",void 0),(0,o.A)(this,"timeout",void 0),(0,o.A)(this,"_fetch",void 0),(0,o.A)(this,"mediatypes",void 0),(0,o.A)(this,"appNode",void 0),(0,o.A)(this,"requested",void 0),(0,o.A)(this,"timeouts",void 0),(0,o.A)(this,"redirectedTo",void 0),(0,o.A)(this,"fetchQueue",void 0),(0,o.A)(this,"fetchCallbacks",void 0),(0,o.A)(this,"nonexistent",void 0),(0,o.A)(this,"lookedUp",void 0),(0,o.A)(this,"handlers",void 0),(0,o.A)(this,"ns",void 0),(0,o.A)(this,"fireCallbacks",void 0),this.store=t||new Et,this.ns=tr(this.store.rdfFactory),this.timeout=i.timeout||3e4,this._fetch=i.fetch||void 0!==s.g&&(s.g.solidFetcher||s.g.solidFetch)||"undefined"!=typeof window&&(window.solidFetcher||window.solidFetch)||Ge(),!this._fetch)throw new Error("No _fetch function available for Fetcher");this.appNode=this.store.sym("chrome://TheCurrentSession"),this.store.fetcher=this,this.requested={},this.timeouts={},this.redirectedTo={},this.fetchQueue={},this.fetchCallbacks={},this.nonexistent={},this.lookedUp={},this.handlers=[],this.mediatypes={"image/*":{q:.9},"*/*":{q:.1}},Q.callbackify(this,["request","fail","refresh","retract","done"]),Object.keys(i.handlers||lr).map((function(t){return n.addHandler(lr[t])}))}return(0,t.A)(r,[{key:"load",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r=Object.assign({},r),t instanceof Array)return Promise.all(t.map((function(t){return e.load(t,Object.assign({},r))})));var n=t,i=(0,Ve.E)(n);i=i.split("#")[0],r=this.initFetchOptions(i,r);var o,a=this.appNode,s=this.store,u=s.statementsMatching(void 0,this.ns.link("requestedURI"),s.sym(i),a).map((function(t){return t.subject})),c=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return Qe(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Qe(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}(u);try{for(c.s();!(o=c.n()).done;){var l=o.value,h=s.any(l,this.ns.link("response"),null,a);if(null!=h){var f=s.statementsMatching(h,this.ns.link("outOfDate"),!0,a);s.remove(f),r.force=!0,r.clearPreviousData=!0}}}catch(t){c.e(t)}finally{c.f()}var p=this.initFetchOptions(i,r);return this.pendingFetchPromise(i,p.baseURI,p)}},{key:"pendingFetchPromise",value:(i=N(R().mark((function t(e,r,n){var i,o=this;return R().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=!n.force,!t.t0){t.next=5;break}return t.next=4,this.fetchQueue[r];case 4:t.t0=t.sent;case 5:if(!t.t0){t.next=9;break}i=this.fetchQueue[r],t.next=12;break;case 9:i=Promise.race([this.setRequestTimeout(e,n),this.fetchUri(e,n)]),this.fetchQueue[r]=i,this.cleanupFetchRequest(r,void 0,this.timeout);case 12:return t.abrupt("return",i.then((function(t){return e in o.timeouts&&(o.timeouts[e].forEach(clearTimeout),delete o.timeouts[e]),t})));case 13:case"end":return t.stop()}}),t,this)}))),function(t,e,r){return i.apply(this,arguments)})},{key:"cleanupFetchRequest",value:function(t,e,r){var n=this;void 0!==e&&We.warn("_options is deprecated"),this.timeouts[t]=(this.timeouts[t]||[]).concat(setTimeout((function(){n.isPending(t)||delete n.fetchQueue[t]}),r))}},{key:"initFetchOptions",value:function(t,e){var n=this.store;!e.method||"GET"===e.method.toUpperCase()||(e.force=!0),e.resource=n.rdfFactory.namedNode(t),e.baseURI=e.baseURI||t,e.original=n.rdfFactory.namedNode(e.baseURI),e.req=n.bnode(),e.headers=e.headers||new Xe.Headers,e.contentType&&(e.headers["content-type"]=e.contentType),e.force&&(e.cache="no-cache");var i=this.acceptString();e.headers.accept=i;var o=r.offlineOverride(t);e.requestedURI=o,r.setCredentials(o,e);var a=r.proxyIfNecessary(o);return o!==a&&(e.proxyUsed=!0),e.actualProxyURI=a,e}},{key:"fetchUri",value:function(t,e){var n=this;if(!t)return Promise.reject(new Error("Cannot fetch an empty uri"));if(r.unsupportedProtocol(t))return this.failFetch(e,"fetcher: Unsupported protocol","unsupported_protocol");var i=this.getState(t);if(e.force)delete this.nonexistent[t];else{if("fetched"===i)return Promise.resolve(this.doneFetch(e,{status:200,ok:!0,statusText:"Already loaded into quadstore."}));if("failed"===i&&404===this.requested[t]){var o="Previously failed: "+this.requested[t],a={url:t,status:this.requested[t],statusText:o,responseText:o,headers:new Xe.Headers,ok:!1,body:null,bodyUsed:!1,size:0,timeout:0};return this.failFetch(e,o,this.requested[t],a)}}this.fireCallbacks("request",[t]),this.requested[t]=!0,e.noMeta||this.saveRequestMetadata(t,e);var s=e.actualProxyURI;return this._fetch(s,e).then((function(r){return n.handleResponse(r,t,e)}),(function(r){var i={url:s,status:999,statusText:(r.name||"network failure")+": "+(r.errno||r.code||r.type),responseText:r.message,headers:new Xe.Headers,ok:!1,body:null,bodyUsed:!1,size:0,timeout:0};return n.handleError(i,t,e)}))}},{key:"nowOrWhenFetched",value:function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=(0,Ve.E)(t);"function"==typeof e?r=e:void 0===e||((0,v.Y2)(e)?n.referringTerm=e:n=e),this.load(i,n).then((function(t){if(r)if(t)if(t.ok)r(!0,"OK",t);else{var e="HTTP error: Status "+t.status+" ("+t.statusText+")";t.responseText&&(e+=" "+t.responseText),r(!1,e,t)}else r(!1,"@@ nowOrWhenFetched: no response object!")}),(function(t){var e=t.message||t.statusText;e="Failed to load <"+i+"> "+e,t.response&&t.response.status&&(e+=" status: "+t.response.status),r(!1,e,t.response)}))}},{key:"addStatus",value:function(t,e){var r=new Date;e="["+r.getHours()+":"+r.getMinutes()+":"+r.getSeconds()+"."+r.getMilliseconds()+"] "+e;var n=this.store,i=n.the(t,this.ns.link("status"));(0,v.P3)(i)?i.append(n.rdfFactory.literal(e)):V.A.warn("web.js: No list to add to: "+i+","+e)}},{key:"failFetch",value:function(t,e,r,n){this.addStatus(t.req,e),t.noMeta||this.store.add(t.original,this.ns.link("error"),this.store.rdfFactory.literal(e));var i=(t.method||"GET").toUpperCase();("GET"===i||"HEAD"===i)&&(t.resource.equals(t.original),this.requested[M.docpart(t.original.value)]=r,this.fireCallbacks("fail",[t.original.value,e]));var o=new Error("Fetcher: "+e);return o.status=r,o.statusText=e,o.response=n,Promise.reject(o)}},{key:"linkData",value:function(t,e,r,n,i){if(r){var o,a=this.store,s=a.rdfFactory.namedNode(M.join(r,t.value));if("alternate"===e||"seeAlso"===e||"meta"===e||"describedby"===e){if(s.value===t.value)return;o=this.ns.rdfs("seeAlso")}else o="type"===e?a.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"):a.rdfFactory.namedNode(M.join(encodeURIComponent(e),"http://www.iana.org/assignments/link-relations/"));i?a.add(s,o,t,n):a.add(t,o,s,n)}}},{key:"parseLinkHeader",value:function(t,e,r){if(t){var n=/[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*"))/g,i=t.match(/<[^>]*>\s*(\s*;\s*[^()<>@,;:"/[\]?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*")))*(,|$)/g);if(null!=i)for(var o=0;o"),s=a[0].substring(1),u=a[1].match(n);if(null==u)return;for(var c=0;c1&&void 0!==arguments[1]?arguments[1]:{},n=(0,Ve.E)(t),i=new y.A(n).doc();return r.contentType=r["content-type"]||r["Content-Type"]||r.contentType||l.sT,"application/ld+json"===r.contentType?new Promise((function(n,o){nt(i,e.store,i.uri,r.contentType,(function(i,a){i?o(i):(r.data=a,e.webOperation("PUT",t,r).then((function(t){return n(t)})).catch((function(t){return o(t)})))}))})):(r.data=nt(i,this.store,i.value,r.contentType),this.webOperation("PUT",n,r))}},{key:"webCopy",value:function(t,e,r){var n=this;return this.webOperation("GET",t).then((function(t){return n.webOperation("PUT",e,{data:t.responseText,contentType:r})}))}},{key:"delete",value:function(t,e){var r=this;return this.webOperation("DELETE",t,e).then((function(e){return r.requested[t]=404,r.nonexistent[t]=!0,r.unload(r.store.rdfFactory.namedNode(t)),e}))}},{key:"createIfNotExists",value:(n=N(R().mark((function t(e){var r,n,i,o,a=arguments;return R().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:l.sT,n=a.length>2&&void 0!==a[2]?a[2]:"",i=this,t.prev=3,t.next=6,i.load(e);case 6:o=t.sent,t.next=26;break;case 9:if(t.prev=9,t.t0=t.catch(3),404!==t.t0.response.status){t.next=25;break}return t.prev=12,t.next=15,i.webOperation("PUT",e.value,{data:n,contentType:r});case 15:o=t.sent,t.next=21;break;case 18:throw t.prev=18,t.t1=t.catch(12),t.t1;case 21:return delete i.requested[e.value],t.abrupt("return",o);case 25:throw t.t0;case 26:return t.abrupt("return",o);case 27:case"end":return t.stop()}}),t,this,[[3,9],[12,18]])}))),function(t){return n.apply(this,arguments)})},{key:"createContainer",value:function(t,e,r){var n={"content-type":l.sT,link:this.ns.ldp("BasicContainer")+'; rel="type"'};e&&(n.slug=e);var i={headers:n};return r&&(i.body=r),this.webOperation("POST",t,i)}},{key:"invalidateCache",value:function(t){var e=(0,Ve.E)(t),r=this;if(r.fetchQueue&&r.fetchQueue[e]&&(r.fetchQueue[e].PromiseStatus,delete r.fetchQueue[e]),r.requested[e]&&"done"!==r.requested[e]&&"failed"!==r.requested[e]&&404!==r.requested[e]){var n="Rdflib: fetcher: Destructive operation on <".concat(r.requested[e],"> file being fetched! ")+e;We.error(n)}else delete r.requested[e],delete r.nonexistent[e]}},{key:"webOperation",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=(0,Ve.E)(e);n.method=t,n.body=n.data||n.body,n.force=!0;var o=this;if(n.body&&!n.contentType)throw new Error("Web operation sending data must have a defined contentType.");return n.contentType&&(n.headers=n.headers||{},n.headers["content-type"]=n.contentType),r.setCredentials(i,n),new Promise((function(e,r){o._fetch(i,n).then((function(n){if(n.ok)"PUT"!==t&&"PATCH"!==t&&"POST"!==t&&"DELETE"!==t||o.invalidateCache(i),n.text?n.text().then((function(t){n.responseText=t,e(n)})):e(n);else{var a="Web error: "+n.status;n.statusText&&(a+=" ("+n.statusText+")"),a+=" on "+t+" of <"+i+">",n.responseText&&(a+=": "+n.responseText);var s=new Error(a);s.response=n,r(s)}}),(function(e){r(new Error("Fetch error for "+t+" of <"+i+">:"+e))}))}))}},{key:"lookUpThing",value:function(t,e){var r=this,n=this.store.uris(t);return(n=n.map((function(t){return M.docpart(t)}))).forEach((function(t){r.lookedUp[t]=!0})),this.load(n,{referringTerm:e})}},{key:"getHeader",value:function(t,e){for(var r=this.store,n=t.value,i=r.each(void 0,this.ns.link("requestedURI"),r.rdfFactory.literal(n)),o=0;o=400)return 404===t.status&&(this.nonexistent[r.original.value]=!0,this.nonexistent[e]=!0),this.saveErrorResponse(t,s).then((function(){var e=r.resource+" "+t.statusText;return n.failFetch(r,e,t.status,t)}));var l=null,h=null;if(c&&(h=M.join(c,e))!==e&&(l=h),200===t.status){if(this.addType(this.ns.link("Document"),a,i,e),l&&this.addType(this.ns.link("Document"),a,i,l),r.clearPreviousData)for(var f=i.statementsMatching(void 0,void 0,void 0,r.resource).slice(),p=0;p10&&n.add(e,r.ns.http("content"),n.rdfFactory.literal(t),e)}))}},{key:"handlerForContentType",value:function(t,e){if(!t)return null;var r=this.handlers.find((function(e){return t.match(e.pattern)}));return r?new r(e):null}},{key:"guessContentType",value:function(t){return Ke[t.split(".").pop()]}},{key:"normalizedContentType",value:function(t,e){if(t.forceContentType)return t.forceContentType;var r=e.get("content-type");if(!r||r.includes("application/octet-stream")){var n=this.guessContentType(t.resource.value);if(n)return n}var i=M.protocol(t.resource.value);return!r&&["file","chrome"].includes(i)?"text/xml":r}},{key:"redirectToProxy",value:function(t,e){var r=this;this.addStatus(e.req,"BLOCKED -> Cross-site Proxy to <"+t+">"),e.proxyUsed=!0;var n=this.store,i=e.req;e.noMeta||(n.add(i,this.ns.link("redirectedTo"),n.rdfFactory.namedNode(t),i),this.addStatus(i,"redirected to new request")),this.requested[e.resource.value]="redirected",this.redirectedTo[e.resource.value]=t;var o=Object.assign({},e);return o.baseURI=e.resource.value,this.fetchUri(t,o).then((function(t){return o.noMeta||n.add(i,r.ns.link("redirectedRequest"),o.req,r.appNode),t}))}},{key:"setRequestTimeout",value:function(t,e){var r=this;return new Promise((function(n){r.timeouts[t]=(r.timeouts[t]||[]).concat(setTimeout((function(){!r.isPending(t)||e.retriedWithNoCredentials||e.proxyUsed||n(r.failFetch(e,"Request to ".concat(t," timed out"),"timeout"))}),r.timeout))}))}},{key:"addFetchCallback",value:function(t,e){this.fetchCallbacks[t]?this.fetchCallbacks[t].push(e):this.fetchCallbacks[t]=[e]}},{key:"acceptString",value:function(){var t="";for(var e in this.mediatypes)for(var r in""!==t&&(t+=", "),t+=e,this.mediatypes[e])t+=";"+r+"="+this.mediatypes[e][r];return t}}],[{key:"crossSiteProxy",value:function(t){return r.crossSiteProxyTemplate?r.crossSiteProxyTemplate.replace("{uri}",encodeURIComponent(t)):void 0}},{key:"offlineOverride",value:function(t){var e,r=t;return"undefined"!=typeof window&&window.panes&&(e=window.panes.UI)&&e.preferences&&e.preferences.get("offlineModeUsingLocalhost")&&"http://"===r.slice(0,7)&&"localhost/"!==r.slice(7,17)&&(r="http://localhost/"+r.slice(7),V.A.warn("Localhost kludge for offline use: actually getting <"+r+">")),r}},{key:"proxyIfNecessary",value:function(t){var e;if("undefined"!=typeof window&&window.panes&&(e=window.panes.UI)&&e.isExtension)return t;if("undefined"!=typeof $SolidTestEnvironment&&$SolidTestEnvironment.localSiteMap){var n=function t(e,r){var n=r[e.shift()];return n?"string"==typeof n?n+e.join("/"):e?t(e,n):null:null}(t.split("/").slice(2),$SolidTestEnvironment.localSiteMap);if(n)return n}return r.crossSiteProxyTemplate&&"undefined"!=typeof document&&document.location&&"https:"===(""+document.location).slice(0,6)&&"http:"===t.slice(0,5)?r.crossSiteProxyTemplate.replace("{uri}",encodeURIComponent(t)):t}},{key:"unsupportedProtocol",value:function(t){var e=M.protocol(t);return"tel"===e||"mailto"===e||"urn"===e}},{key:"setCredentials",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};void 0===e.credentials&&(void 0!==e.withCredentials?e.credentials=e.withCredentials?"include":"omit":e.credentials="include")}}]);var n,i}();(0,o.A)(fr,"HANDLERS",void 0),(0,o.A)(fr,"CONTENT_TYPE_BY_EXT",void 0),(0,o.A)(fr,"crossSiteProxyTemplate",void 0),fr.HANDLERS=lr,fr.CONTENT_TYPE_BY_EXT=Ke;const pr={parseJSON:function(t,e,r){var n,i,o,a={},s=r.sym(e);for(var u in t){0===u.indexOf("_:")?a[u]?n=a[u]:(n=r.bnode(u),a[u]=n):n=r.sym(u);var c=t[u];for(var l in c){var h=c[l];for(var f in i=r.sym(l),h){var p=h[f];if("uri"===p.type)o=r.sym(p.value),r.add(n,i,o,s);else if("BlankNode"===p.type)a[p.value]?o=a[p.value]:(o=r.bnode(p.value),a[p.value]=o),r.add(n,i,o,s);else{if("Literal"!==p.type)throw new Error("error: unexpected termtype: "+f.type);o=p.datatype?r.literal(p.value,void 0,r.sym(p.datatype)):p.lang?r.literal(p.value,p.lang):r.literal(p.value),r.add(n,i,o,s)}}}}}};function dr(t){var e=0;function r(t){var e="",r=t.statements;for(var n in r)V.A.debug("Found statement: "+r),e+=a()+r[n]+"\n";return e}function n(t){var e="";for(var r in t.constraints){var n=t.constraints[r];e+=a()+"FILTER ( "+n.describe(r)+" ) \n"}return e}function i(t){for(var o="",s=0;s"):t}function u(t){return"string"==typeof t&&t.match(/^<[^>]*>$/)}function c(t){return"string"==typeof t&&(t.match(/^_:/)||t.match(/^$/))}function l(t){return"string"==typeof t&&t.match(/:$/)}function h(t){return"string"==typeof t&&t.match(/^:|^[^_][^:]*:/)}function f(t){return t.split(":")[0]}function p(t){return t.split(":")[1]}function d(t){return u(t)?t.slice(1,t.length-1):t}function y(t){var e=-1===t.indexOf("'")?null:t.indexOf("'"),n=-1===t.indexOf('"')?null:t.indexOf('"');if(!e&&!n){var i=new Array(1);return i[0]=t,i}var o,a,s=new Array(2);if(!e||n&&n/g,"> ").replace(/{/g," { ").replace(/}/g," } ").replace(/[\t\n\r]/g," ").replace(/; /g," ; ").replace(/\. /g," . ").replace(/, /g," , "),V.A.info("New str into spaceDelimit: \n"+t);var e=[],r=t.split(" ");for(var n in r)o(r[n])&&(e=e.concat(r[n]));return e}function g(t,e){for(var r=0;r"===t[1]||"<"===t[1]?(V.A.debug("Constraint added: "+t),e.constraints[t[0]]=new w(t[2])):V.A.warn("I don't know how to handle the constraint: "+t)}function _(t,e){V.A.debug("Optional query: "+t+" not yet implemented.");var n=r.formula();k(t,n),e.optional.push(n)}function k(t,e){var n,o,l=function(t){for(var e=[],n=0;n"),"is"===e[r]&&"of"===e[r+2]){e.splice(r,1),e.splice(r+1,1);var n=e[r-1];e[r-1]=e[r+1],e[r+1]=n}return e}(r),V.A.info("SPARQL Tokens: "+r),r}(t),O=function(t){var e=m("PREFIX",t),r=[];for(var n in e){var i=t[e[n]+1],o=t[e[n]+2];if(l(i))if(u(o)){V.A.info("Prefix found: "+i+" -> "+o);var a=f(i),s=d(o);r[a]=s}else V.A.error("Invalid SPARQL symbol: "+o);else V.A.error("Invalid SPARQL prefix: "+i)}return r}(E);O.rdf||(O.rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"),O.rdfs||(O.rdfs="http://www.w3.org/2000/01/rdf-schema#");var j=g("SELECT",E),N=g("WHERE",E);if(j<0||N<0||j>N)return V.A.error("Invalid or nonexistent SELECT and WHERE tags in SPARQL query"),!1;if(function(t,e){for(var r in V.A.info("SPARQL vars: "+t),t)if(a(t[r])){V.A.info("Added "+t[r]+" to query variables from SPARQL");var n=i(t[r].slice(1));e.vars.push(n),n.label=t[r].slice(1)}else V.A.warn("Incorrect SPARQL variable in SELECT: "+t[r])}(E.slice(j+1,N),T),k(E.slice(N+2,E.length-1),T.pat),e)return T;for(var S in T.pat.statements){var R=T.pat.statements[S];"NamedNode"===R.subject.termType&&r.fetcher&&r.fetcher.lookUpThing(R.subject,"sparql:"+R.subject),"NamedNode"===R.object.termType&&r.fetcher&&r.fetcher.lookUpThing(R.object,"sparql:"+R.object)}return T}function vr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return gr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?gr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function gr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0)return"N3PATCH";if(i.indexOf("application/sparql-update")>=0)return"SPARQL";if(i.indexOf("application/sparql-update-single-match")>=0)return"SPARQL"}var v=e.each(c,this.ns.httph("ms-author-via"));if(v.length)for(var g=0;g=0)return"SPARQL";if(i.indexOf("DAV")>=0)return"DAV"}if(!this.isHttpUri(t))return!!l&&"LOCALFILE";var m=e.each(c,this.ns.http("status"));if(m.length)for(var b=0;b3&&void 0!==arguments[3]?arguments[3]:{};return Promise.resolve().then((function(){if(!t)throw new Error("No URI given for remote editing operation: "+e);return i.noMeta=!0,i.contentType=i.contentType||"application/sparql-update",i.body=e,n.store.fetcher.webOperation("PATCH",t,i)})).then((function(n){if(!n.ok){var i="UpdateManager: update failed for <"+t+"> status="+n.status+", "+n.statusText+"\n for query: "+e;throw new Error(i)}r(t,n.ok,n.responseText,n)})).catch((function(e){r(t,!1,e.message,e)}))}},{key:"update_statement",value:function(t){if(!t||t.graph){var e=this,r=this.statementContext(t);return{statement:t?[t.subject,t.predicate,t.object,t.graph]:void 0,statementNT:t?this.anonymizeNT(t):void 0,where:e.contextWhere(r),set_object:function(t,r){var n=this.where;n+="DELETE DATA { "+this.statementNT+" } ;\n",n+="INSERT DATA { "+this.anonymize(this.statement[0])+" "+this.anonymize(this.statement[1])+" "+this.anonymize(t)+" . }\n",e.fire(this.statement[3].value,n,r)}}}}},{key:"insert_statement",value:function(t,e){var r=t instanceof Array?t[0]:t,n=this.contextWhere(this.statementContext(r));if(t instanceof Array){for(var i="",o=0;o 1 different downstream actions")}else r.downstreamAction=e;else e(t)}},{key:"clearUpstreamCount",value:function(t){this.patchControlFor(t).upstreamCount=0}},{key:"getUpdatesVia",value:function(t){var e=this.store.fetcher.getHeader(t,"updates-via");return e&&e.length?e[0].trim():null}},{key:"addDownstreamChangeListener",value:function(t,e){var r=this,n=this.patchControlFor(t);n.downstreamChangeListeners||(n.downstreamChangeListeners=[]),n.downstreamChangeListeners.push(e),this.setRefreshHandler(t,(function(t){r.reloadAndSync(t)}))}},{key:"reloadAndSync",value:function(t){var e=this.patchControlFor(t),r=this;if(e.reloading)e.outOfDate=!0;else{e.reloading=!0;var n=1e3;!function i(){r.reload(r.store,t,(function(t,r,o){if(t){if(e.downstreamChangeListeners)for(var a=0;a=0))return;c.upstreamCount=0,i.requestDownstreamAction(t,n)}}}(),!0}},{key:"updateMany",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=t.concat(e).map((function(t){return t.why})),n=this,i=[];r.forEach((function(t){i.find((function(e){return e.equals(t)}))||i.push(t)}));var o=i.map((function(r){return n.update(t.filter((function(t){return t.why.equals(r)})),e.filter((function(t){return t.why.equals(r)})))}));return o.length,Promise.all(o)}},{key:"constructSparqlUpdateQuery",value:function(t,e,r){var n=this.contextWhere(r),i="";if(n.length){if(t.length){i+="DELETE { ";for(var o=0;o.\n@prefix ex: .\n\n_:patch\n";return r&&r.length>0&&(i+="\n solid:where {\n ".concat(r.map((function(t){return n.anonymizeNT(t)})).join("\n "),"\n };")),t.length>0&&(i+="\n solid:deletes {\n ".concat(t.map((function(t){return n.anonymizeNT(t)})).join("\n "),"\n };")),e.length>0&&(i+="\n solid:inserts {\n ".concat(e.map((function(t){return n.anonymizeNT(t)})).join("\n "),"\n };")),i+" a solid:InsertDeletePatch .\n"}},{key:"update",value:function(t,e,r,n){var i=this,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if(!r){var a=this;return new Promise((function(r,i){a.update(t,e,(function(t,e,n){e?r():i(new Error(n))}),n,o)}))}try{var s=this.store,u=t?(0,v.ok)(t)?t.statements:t instanceof Array?t:[t]:[],c=e?(0,v.ok)(e)?e.statements:e instanceof Array?e:[e]:[];if(!(u instanceof Array))throw new Error("Type Error "+(0,d.A)(u)+": "+u);if(!(c instanceof Array))throw new Error("Type Error "+(0,d.A)(c)+": "+c);if(0===u.length&&0===c.length)return r(null,!0);var l=u.length?u[0].graph:c[0].graph;if(!l){var h="Error patching: statement does not specify which document to patch:"+u[0]+", "+c[0];throw new Error(h)}if("NamedNode"!==l.termType){var f="Error patching: document not a NamedNode:"+u[0]+", "+c[0];throw new Error(f)}var p=this.patchControlFor(l),y=Date.now(),g=["subject","predicate","object","why"],m={delete:u,insert:c};["insert","delete"].map((function(t){m[t].map((function(t){if(!l.equals(t.graph))throw new Error("update: destination "+l+" inconsistent with delete quad "+t.graph);g.map((function(e){if(void 0===t[e])throw new Error("update: undefined "+e+" of statement.")}))}))}));var b=this.editable(l.value,s);if(!1===b)throw new Error("Update: Can't make changes in uneditable "+l);if(void 0===b){if(n)throw new Error("Update: Loaded "+l+"but still can't figure out what editing protocol it supports.");return void this.store.fetcher.load(l).then((function(n){i.update(t,e,r,!0,o)}),(function(n){if(404!==n.response.status)throw new Error("Update: Can't get updatability status ".concat(l," before patching: ").concat(n));i.update(t,e,r,!0,o)}))}if(b.indexOf("SPARQL")>=0||b.indexOf("N3PATCH")>=0){var w=b.indexOf("SPARQL")>=0,A=[];u.length&&(A=this.statementArrayBnodes(u)),c.length&&(A=A.concat(this.statementArrayBnodes(c)));var x=this.bnodeContext(A,l),_=w?this.constructSparqlUpdateQuery(u,c,x):this.constructN3PatchQuery(u,c,x);o.contentType=w?"application/sparql-update":"text/n3",p.pendingUpstream=p.pendingUpstream?p.pendingUpstream+1:1,"upstreamCount"in p&&(p.upstreamCount+=1),this.fire(l.value,_,(function(t,e,n,i){if(i.elapsedTimeMs=Date.now()-y,e){try{s.remove(u)}catch(t){e=!1,n="Remote Ok BUT error deleting "+u.length+" from store!!! "+t}for(var o=0;o=0)this.updateDav(l,u,c,r,o);else{if(!(b.indexOf("LOCALFILE")>=0))throw new Error("Unhandled edit method: '"+b+"' for "+l);try{this.updateLocalFile(l,u,c,r,o)}catch(t){r(l.value,!1,"Exception trying to write back file <"+l.value+">\n")}}}catch(t){r(void 0,!1,"Exception in update: "+t+"\n"+Q.stackString(t))}}},{key:"updateDav",value:function(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=this.store,a=o.any(t,this.ns.link("request"));if(!a)throw new Error("No record of our HTTP GET request for document: "+t);var s=o.any(a,this.ns.link("response"));if(!s)return null;for(var u=o.the(s,this.ns.httph("content-type")).value,c=o.statementsMatching(void 0,void 0,void 0,t).slice(),l=0;l4&&void 0!==arguments[4]?arguments[4]:{},o=this.store,a=o.statementsMatching(void 0,void 0,void 0,t).slice(),s=0;s0&&void 0!==arguments[0]?arguments[0]:void 0,(arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0)||{rdfFactory:re})},lit:function(t,e,r){return this.literal(""+t,e||r)},st:function(t,e,r,n){return this.quad(t,e,r,n)}});const xr=Ar;var _r=function(){return(0,t.A)((function t(r,n){(0,e.A)(this,t),this.parent=r,this.via=n,this.connected=!1,this.pending={},this.subscribed={},this.socket={};try{this.socket=new WebSocket(n),this.socket.onopen=this.onOpen,this.socket.onclose=this.onClose,this.socket.onmessage=this.onMessage,this.socket.onerror=this.onError}catch(t){this.onError(t)}}),[{key:"_decode",value:function(t){var e,r,n,i,o,a,s;for(r in i={},o=function(){var r,n,i,o;for(o=[],r=0,n=(i=t.split("&")).length;r {\nreturn ","var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));\n\t}\n\tdef['default'] = () => (value);\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","var inProgress = {};\nvar dataWebpackPrefix = \"$rdf:\";\n// loadScript function to load a script via script tag\n__webpack_require__.l = (url, done, key, chunkId) => {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url || s.getAttribute(\"data-webpack\") == dataWebpackPrefix + key) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\n\t\tscript.charset = 'utf-8';\n\t\tscript.timeout = 120;\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\t\tscript.setAttribute(\"data-webpack\", dataWebpackPrefix + key);\n\n\t\tscript.src = url;\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = (prev, event) => {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach((fn) => (fn(event)));\n\t\tif(prev) return prev(event);\n\t}\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","/**\n* Class orders\n*/\nconst ClassOrder: {\n [id: string]: number;\n} = {\n 'Literal': 1,\n 'Collection': 3,\n 'Graph': 4,\n 'NamedNode': 5,\n 'BlankNode': 6,\n 'Variable': 7\n}\n\nexport default ClassOrder\n","/**\n * A Dummy log\n * @module log\n */\nconst log = {\n debug (x) {},\n warn (x) {},\n info (x) {},\n error (x) {},\n success (x) {},\n msg (x) {},\n}\nexport default log\n","import ClassOrder from './class-order'\nimport Node from './node-internal'\nimport { NamedNodeTermType } from './types'\nimport { termValue } from './utils/termValue'\nimport { NamedNode as TFNamedNode } from './tf-types'\nimport { isTerm } from './utils/terms'\n\n/**\n * A named (IRI) RDF node\n */\nexport default class NamedNode extends Node implements TFNamedNode {\n termType: typeof NamedNodeTermType = NamedNodeTermType\n classOrder = ClassOrder.NamedNode\n\n /**\n * Create a named (IRI) RDF Node\n * @constructor\n * @param iri - The IRI for this node\n */\n constructor (iri: string) {\n super(termValue(iri))\n\n if (!this.value) {\n throw new Error('Missing IRI for NamedNode')\n }\n\n if (!this.value.includes(':')) {\n throw new Error('NamedNode IRI \"' + iri + '\" must be absolute.')\n }\n\n if (this.value.includes(' ')) {\n var message = 'Error: NamedNode IRI \"' + iri + '\" must not contain unencoded spaces.'\n throw new Error(message)\n }\n }\n\n /**\n * Returns an $rdf node for the containing directory, ending in slash.\n */\n dir (): NamedNode | null {\n var str = this.value.split('#')[0]\n var p = str.slice(0, -1).lastIndexOf('/')\n var q = str.indexOf('//')\n if ((q >= 0 && p < q + 2) || p < 0) return null\n return new NamedNode(str.slice(0, p + 1))\n }\n\n /**\n * Returns an NN for the whole web site, ending in slash.\n * Contrast with the \"origin\" which does NOT have a trailing slash\n */\n site (): NamedNode {\n var str = this.value.split('#')[0]\n var p = str.indexOf('//')\n if (p < 0) throw new Error('This URI does not have a web site part (origin)')\n var q = str.indexOf('/', p+2)\n if (q < 0) {\n return new NamedNode(str.slice(0) + '/') // Add slash to a bare origin\n } else {\n return new NamedNode(str.slice(0, q + 1))\n }\n }\n\n /**\n * Creates the fetchable named node for the document.\n * Removes everything from the # anchor tag.\n */\n doc (): NamedNode {\n if (this.value.indexOf('#') < 0) {\n return this\n } else {\n return new NamedNode(this.value.split('#')[0])\n }\n }\n\n /**\n * Returns the URI including \n */\n toString (): string {\n return '<' + this.value + '>'\n }\n\n /** The local identifier with the document */\n id (): string {\n return this.value.split('#')[1]\n }\n\n /** Alias for value, favored by Tim */\n get uri (): string {\n return this.value\n }\n\n set uri (uri: string) {\n this.value = uri\n }\n\n /**\n * Creates a named node from the specified input value\n * @param value - An input value\n */\n static fromValue (value) {\n if (typeof value === 'undefined' || value === null) {\n return value\n }\n if (isTerm(value)) {\n return value\n }\n return new NamedNode(value)\n }\n}\n","import { ValueType, Bindings, FromValueReturns, TermType } from './types'\nimport { Term } from './tf-types'\n\n/**\n * The superclass of all RDF Statement objects, that is\n * NamedNode, Literal, BlankNode, etc.\n * Should not be instantiated directly.\n * Also called Term.\n * @link https://rdf.js.org/data-model-spec/#term-interface\n * @class Node\n */\nexport default abstract class Node {\n // Specified in './node.ts' to prevent circular dependency\n static fromValue: (value: ValueType) => T\n // Specified in './node.ts' to prevent circular dependency\n static toJS: (term: any) => Date | Number | string | boolean | object | Array;\n\n /** The type of node */\n termType!: TermType;\n\n /** The class order for this node */\n classOrder!: number;\n\n /** The node's value */\n value: string;\n\n protected constructor(value: string) {\n this.value = value\n }\n\n /**\n * Creates the substituted node for this one, according to the specified bindings\n * @param bindings - Bindings of identifiers to nodes\n */\n substitute (bindings: Bindings): T {\n return this as unknown as T\n }\n\n /**\n * Compares this node with another\n * @see {equals} to check if two nodes are equal\n * @param other - The other node\n */\n compareTerm (other: Node): number {\n if (this.classOrder < other.classOrder) {\n return -1\n }\n if (this.classOrder > other.classOrder) {\n return +1\n }\n if (this.value < other.value) {\n return -1\n }\n if (this.value > other.value) {\n return +1\n }\n return 0\n }\n\n /**\n * Compares whether the two nodes are equal\n * @param other The other node\n */\n equals (other: Term): boolean {\n if (!other) {\n return false\n }\n return (this.termType === other.termType) &&\n (this.value === other.value)\n }\n\n /**\n * Creates a hash for this node\n * @deprecated use {rdfFactory.id} instead if possible\n */\n hashString (): string {\n return this.toCanonical()\n }\n\n /**\n * Compares whether this node is the same as the other one\n * @param other - Another node\n */\n sameTerm(other: Node): boolean {\n return this.equals(other)\n\n }\n\n /**\n * Creates a canonical string representation of this node\n */\n toCanonical (): string {\n return this.toNT()\n }\n\n /**\n * Creates a n-triples string representation of this node\n */\n toNT (): string {\n return this.toString()\n }\n\n /**\n * Creates a n-quads string representation of this node\n */\n toNQ (): string {\n return this.toNT();\n }\n\n /**\n * Creates a string representation of this node\n */\n toString (): string {\n throw new Error('Node.toString() is abstract - see the subclasses instead')\n }\n}\n","import Node from './node-internal'\nimport RDFlibVariable from './variable'\nimport RDFlibBlankNode from './blank-node'\nimport Collection from './collection'\nimport RDFlibLiteral from './literal'\nimport RDFlibNamedNode from './named-node'\nimport RDFlibDefaultGraph from './default-graph'\nimport { DataFactory } from './factories/factory-types'\nimport IndexedFormula from './store'\nimport Fetcher from './fetcher'\nimport Statement from './statement'\nimport Empty from './empty'\nimport { NamedNode, Term, Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph } from './tf-types'\n\nexport const NamedNodeTermType = \"NamedNode\" as const\nexport const BlankNodeTermType = \"BlankNode\" as const\nexport const LiteralTermType = \"Literal\" as const\nexport const VariableTermType = \"Variable\" as const\nexport const DefaultGraphTermType = \"DefaultGraph\" as const\n// Non-RDF/JS types:\nexport const CollectionTermType = \"Collection\" as const\nexport const EmptyTermType = \"Empty\" as const\nexport const GraphTermType = \"Graph\" as const\n\nexport type TermType = typeof NamedNodeTermType\n | typeof BlankNodeTermType\n | typeof LiteralTermType\n | typeof VariableTermType\n | typeof DefaultGraphTermType\n | typeof CollectionTermType\n | typeof EmptyTermType\n | typeof GraphTermType\n\nexport const HTMLContentType = \"text/html\" as const\nexport const JSONLDContentType = \"application/ld+json\" as const\nexport const N3ContentType = \"text/n3\" as const\nexport const N3LegacyContentType = \"application/n3\" as const\nexport const NQuadsAltContentType = \"application/nquads\" as const\nexport const NQuadsContentType = \"application/n-quads\" as const\nexport const NTriplesContentType = \"application/n-triples\" as const\nexport const RDFXMLContentType = \"application/rdf+xml\" as const\nexport const SPARQLUpdateContentType = \"application/sparql-update\" as const\nexport const SPARQLUpdateSingleMatchContentType = \"application/sparql-update-single-match\" as const\nexport const TurtleContentType = \"text/turtle\" as const\nexport const TurtleLegacyContentType = \"application/x-turtle\" as const\nexport const XHTMLContentType = \"application/xhtml+xml\" as const\n\n/**\n * A valid mime type header\n */\nexport type ContentType = typeof RDFXMLContentType\n | typeof HTMLContentType\n | typeof JSONLDContentType\n | typeof N3ContentType\n | typeof N3LegacyContentType\n | typeof NQuadsAltContentType\n | typeof NQuadsContentType\n | typeof SPARQLUpdateContentType\n | typeof SPARQLUpdateSingleMatchContentType\n | typeof TurtleContentType\n | typeof TurtleLegacyContentType\n | typeof XHTMLContentType\n\n/** A type for values that serves as inputs */\nexport type ValueType = Term | Node | Date | string | number | boolean | undefined | null | Collection\n\n/**\n * In this project, there exist two types for the same kind of RDF concept.\n * We have RDF/JS spec types (standardized, generic), and RDFlib types (internal, specific).\n * When deciding which type to use in a function, it is preferable to accept generic inputs,\n * whenever possible, and provide strict outputs.\n * In some ways, the TF types in here are a bit more strict.\n * Variables are missing, and the statement requires specific types of terms (e.g. NamedNode instead of Term).\n */\n\n/** An RDF/JS Subject */\nexport type SubjectType = RDFlibBlankNode | RDFlibNamedNode | RDFlibVariable\n/** An RDF/JS Predicate */\nexport type PredicateType = RDFlibNamedNode | RDFlibVariable\n/** An RDF/JS Object */\nexport type ObjectType = RDFlibNamedNode | RDFlibLiteral | Collection | RDFlibBlankNode | RDFlibVariable | Empty\n/** An RDF/JS Graph */\nexport type GraphType = RDFlibDefaultGraph | RDFlibNamedNode | RDFlibVariable // | Formula\n\nexport interface Bindings {\n [id: string]: Term;\n}\n\n/** All the types that a .fromValue() method might return */\nexport type FromValueReturns = Term | undefined | null | Collection\n\nexport interface IRDFlibDataFactory extends DataFactory<\n RDFlibNamedNode | RDFlibBlankNode | RDFlibLiteral | Collection | Statement\n> {\n fetcher: (store: IndexedFormula, options: any) => Fetcher\n lit: (val: string, lang?: string, dt?: NamedNode) => RDFlibLiteral\n graph: (features?, opts?) => IndexedFormula\n st: (\n subject: Quad_Subject,\n predicate: Quad_Predicate,\n object: Quad_Object,\n graph?: Quad_Graph\n ) => Statement\n}\n","/*\n * Implements URI-specific functions\n *\n * See RFC 2386\n *\n * See also:\n * http://www.w3.org/2005/10/ajaw/uri.js\n * http://www.w3.org/2000/10/swap/uripath.py\n *\n */\nvar alert = alert || console.log\n\nimport RDFlibNamedNode from './named-node'\n\n/**\n * Gets the document part of an URI\n * @param uri The URI\n */\nexport function docpart(uri: string): string {\n var i: number\n i = uri.indexOf('#')\n if (i < 0) {\n return uri\n } else {\n return uri.slice(0, i)\n }\n}\n\n/**\n * Gets the document part of an URI as a named node\n * @param x - The URI\n */\nexport function document(x: string): RDFlibNamedNode {\n return new RDFlibNamedNode(docpart(x))\n}\n\n/**\n * Gets the hostname in an URI\n * @param u The URI\n */\nexport function hostpart(u: string): string {\n var m = /[^\\/]*\\/\\/([^\\/]*)\\//.exec(u)\n if (m) {\n return m[1]\n } else {\n return ''\n }\n}\n\n/**\n * Joins an URI with a base\n * @param given - The relative part\n * @param base - The base URI\n */\nexport function join(given: string, base: string): string {\n var baseColon, baseScheme, baseSingle\n var colon, lastSlash, path\n var baseHash = base.indexOf('#')\n if (baseHash > 0) {\n base = base.slice(0, baseHash)\n }\n if (given.length === 0) {\n return base\n }\n if (given.indexOf('#') === 0) {\n return base + given\n }\n colon = given.indexOf(':')\n if (colon >= 0) {\n return given\n }\n baseColon = base.indexOf(':')\n if (base.length === 0) {\n return given\n }\n if (baseColon < 0) {\n alert('Invalid base: ' + base + ' in join with given: ' + given)\n return given\n }\n baseScheme = base.slice(0, +baseColon + 1 || 9e9)\n if (given.indexOf('//') === 0) {\n return baseScheme + given\n }\n if (base.indexOf('//', baseColon) === baseColon + 1) {\n baseSingle = base.indexOf('/', baseColon + 3)\n if (baseSingle < 0) {\n if (base.length - baseColon - 3 > 0) {\n return base + '/' + given\n } else {\n return baseScheme + given\n }\n }\n } else {\n baseSingle = base.indexOf('/', baseColon + 1)\n if (baseSingle < 0) {\n if (base.length - baseColon - 1 > 0) {\n return base + '/' + given\n } else {\n return baseScheme + given\n }\n }\n }\n if (given.indexOf('/') === 0) {\n return base.slice(0, baseSingle) + given\n }\n path = base.slice(baseSingle)\n lastSlash = path.lastIndexOf('/')\n if (lastSlash < 0) {\n return baseScheme + given\n }\n if (lastSlash >= 0 && lastSlash < path.length - 1) {\n path = path.slice(0, +lastSlash + 1 || 9e9)\n }\n path += given\n while (path.match(/[^\\/]*\\/\\.\\.\\//)) {\n path = path.replace(/[^\\/]*\\/\\.\\.\\//, '')\n }\n path = path.replace(/\\.\\//g, '')\n path = path.replace(/\\/\\.$/, '/')\n return base.slice(0, baseSingle) + path\n}\n\n/**\n * Gets the protocol part of an URI\n * @param uri The URI\n */\nexport function protocol(uri: string): string | null {\n const i = uri.indexOf(':')\n if (i < 0) {\n return null\n } else {\n return uri.slice(0, i)\n }\n}\n\n/**\n * Gets a relative uri\n * @param base The base URI\n * @param uri The absolute URI\n */\nexport function refTo(base: string, uri: string): string {\n var c: string,\n i: number,\n k: number,\n l: number,\n len: number,\n len1: number,\n n: number,\n o: number,\n p: number,\n q: number,\n ref: string,\n ref1: number,\n s: string\n var commonHost = new RegExp('^[-_a-zA-Z0-9.]+:(//[^/]*)?/[^/]*$')\n if (!base) {\n return uri\n }\n if (base === uri) {\n return ''\n }\n for (i = o = 0, len = uri.length; o < len; i = ++o) {\n const c = uri[i]\n if (c !== base[i]) {\n break\n }\n }\n if (base.slice(0, i).match(commonHost)) {\n k = uri.indexOf('//')\n if (k < 0) {\n k = -2\n }\n l = uri.indexOf('/', k + 2)\n if (uri[l + 1] !== '/' && base[l + 1] !== '/' && uri.slice(0, l) === base.slice(0, l)) {\n return uri.slice(l)\n }\n }\n if (uri[i] === '#' && base.length === i) {\n return uri.slice(i)\n }\n while (i > 0 && uri[i - 1] !== '/') {\n i--\n }\n if (i < 3) {\n return uri\n }\n if (base.indexOf('//', i - 2) > 0 || uri.indexOf('//', i - 2) > 0) {\n return uri\n }\n if (base.indexOf(':', i) > 0) {\n return uri\n }\n n = 0\n ref = base.slice(i)\n for (p = 0, len1 = ref.length; p < len1; p++) {\n c = ref[p]\n if (c === '/') {\n n++\n }\n }\n if (n === 0 && i < uri.length && uri[i] === '#') {\n return './' + uri.slice(i)\n }\n if (n === 0 && i === uri.length) {\n return './'\n }\n s = ''\n if (n > 0) {\n for (q = 1, ref1 = n; ref1 >= 1 ? q <= ref1 : q >= ref1; ref1 >= 1 ? ++q : --q) {\n s += '../'\n }\n }\n return s + uri.slice(i)\n}\n","/**\n * Utility functions for $rdf\n * @module util\n */\nimport { docpart } from './uri'\nimport log from './log'\nimport * as uri from './uri'\nimport NamedNode from './named-node'\n\nconst string = { template: stringTemplate }\n\nexport { log, uri, string }\n\nexport function mediaTypeClass(mediaType){\n mediaType = mediaType.split(';')[0].trim() // remove media type parameters\n return new NamedNode('http://www.w3.org/ns/iana/media-types/' + mediaType + '#Resource')\n}\n\nexport function linkRelationProperty(relation){\n return new NamedNode('http://www.w3.org/ns/iana/link-relations/relation#' + relation.trim())\n}\n\n/**\n * Adds callback functionality to an object.\n * Callback functions are indexed by a 'hook' string.\n * They return true if they want to be called again.\n * @method callbackify\n * @param obj {Object}\n * @param callbacks {Array}\n */\nexport function callbackify (obj, callbacks) {\n obj.callbacks = {}\n for (var x = callbacks.length - 1; x >= 0; x--) {\n obj.callbacks[callbacks[x]] = []\n }\n\n obj.addHook = function (hook) {\n if (!obj.callbacks[hook]) {\n obj.callbacks[hook] = []\n }\n }\n\n obj.addCallback = function (hook, func) {\n obj.callbacks[hook].push(func)\n }\n\n obj.removeCallback = function (hook, funcName) {\n for (var i = 0;i < obj.callbacks[hook].length;i++) {\n if (obj.callbacks[hook][i].name === funcName) {\n obj.callbacks[hook].splice(i, 1)\n return true\n }\n }\n return false\n }\n\n obj.insertCallback = function (hook, func) {\n obj.callbacks[hook].unshift(func)\n }\n\n obj.fireCallbacks = function fireCallbacks (hook, args) {\n var newCallbacks = []\n var replaceCallbacks = []\n var len = obj.callbacks[hook].length\n var x\n let callback\n\n // log.info('!@$ Firing '+hook+' call back with length'+len)\n for (x = len - 1; x >= 0; x--) {\n // log.info('@@ Firing '+hook+' callback '+ obj.callbacks[hook][x])\n callback = obj.callbacks[hook][x]\n if (callback && callback.apply(obj, args)) {\n newCallbacks.push(callback)\n }\n }\n\n for (x = newCallbacks.length - 1; x >= 0; x--) {\n replaceCallbacks.push(newCallbacks[x])\n }\n\n for (x = len; x < obj.callbacks[hook].length; x++) {\n replaceCallbacks.push(obj.callbacks[hook][x])\n }\n\n obj.callbacks[hook] = replaceCallbacks\n }\n}\n\n/**\n * Returns a DOM parser based on current runtime environment.\n */\nexport function DOMParserFactory () {\n if (window.DOMParser) {\n return new DOMParser()\n } else if (window.ActiveXObject) {\n return new ActiveXObject('Microsoft.XMLDOM')\n } else {\n return false\n }\n}\n\n// From https://github.com/linkeddata/dokieli\nexport function domToString (node, options) {\n options = options || {}\n var selfClosing = []\n if (options && options.selfClosing) {\n options.selfClosing.split(' ').forEach(function (n) {\n selfClosing[n] = true\n })\n }\n var skipAttributes = []\n if (options && options.skipAttributes) {\n options.skipAttributes.split(' ').forEach(function (n) {\n skipAttributes[n] = true\n })\n }\n return dumpNode(node, options, selfClosing, skipAttributes)\n}\n\nexport function dumpNode (node, options, selfClosing, skipAttributes) {\n var i\n var out = ''\n var noEsc = [ false ]\n if (typeof node.nodeType === 'undefined') return out\n if (node.nodeType === 1) {\n if (node.hasAttribute('class') && (options && options.classWithChildText) && node.matches(options.classWithChildText.class)) {\n out += node.querySelector(options.classWithChildText.element).textContent\n } else if (!((options && options.skipNodeWithClass) && node.matches('.' + options.skipNodeWithClass))) {\n var ename = node.nodeName.toLowerCase()\n out += '<' + ename\n\n var attrList = []\n for (i = node.attributes.length - 1; i >= 0; i--) {\n var atn = node.attributes[i]\n if (skipAttributes && skipAttributes.length > 0 && skipAttributes[atn.name]) continue\n if (/^\\d+$/.test(atn.name)) continue\n if (atn.name === 'class' && (options && options.replaceClassItemWith) && (atn.value.split(' ').indexOf(options.replaceClassItemWith.source) > -1)) {\n var re = new RegExp(options.replaceClassItemWith.source, 'g')\n atn.value = atn.value.replace(re, options.replaceClassItemWith.target).trim()\n }\n if (!(atn.name === 'class' && (options && options.skipClassWithValue) && options.skipClassWithValue === atn.value)) {\n attrList.push(atn.name + '=\\'' + atn.value.replace(/&/g, '&').replace(//g, '>').replace(/'/g, '"') + '\\'')\n }\n }\n if (attrList.length > 0) {\n if (options && options.sortAttributes) {\n attrList.sort(function (a, b) {\n return a.toLowerCase().localeCompare(b.toLowerCase())\n })\n }\n out += ' ' + attrList.join(' ')\n }\n if (selfClosing && selfClosing.ename) {\n out += ' />'\n } else {\n out += '>'\n out += (ename === 'html') ? '\\n ' : ''\n noEsc.push(ename === 'style' || ename === 'script')\n for (i = 0; i < node.childNodes.length; i++) out += dumpNode(node.childNodes[i])\n noEsc.pop()\n out += (ename === 'body') ? '' + '\\n' : ''\n }\n }\n } else if (node.nodeType === 8) {\n // FIXME: If comments are not tabbed in source, a new line is not prepended\n out += ''\n } else if (node.nodeType === 3 || node.nodeType === 4) {\n // XXX: Remove new lines which were added after DOM ready\n var nl = node.nodeValue.replace(/\\n+$/, '')\n out += noEsc[noEsc.length - 1] ? nl : nl.replace(/&/g, '&').replace(//g, '>')\n } else {\n console.log('Warning; Cannot handle serialising nodes of type: ' + node.nodeType)\n console.log(node)\n }\n return out\n}\n\nexport function dtstamp () {\n var now = new Date()\n var year = now.getYear() + 1900\n var month = now.getMonth() + 1\n var day = now.getDate()\n var hour = now.getUTCHours()\n var minute = now.getUTCMinutes()\n var second = now.getSeconds()\n if (month < 10) month = '0' + month\n if (day < 10) day = '0' + day\n if (hour < 10) hour = '0' + hour\n if (minute < 10) minute = '0' + minute\n if (second < 10) second = '0' + second\n return year + '-' + month + '-' + day + 'T' +\n hour + ':' + minute + ':' + second + 'Z'\n}\n\n/**\n * Compares statements (heavy comparison for repeatable canonical ordering)\n */\nexport function heavyCompare (x, y, g, uriMap) {\n var nonBlank = function (x) {\n return (x.termType === 'BlankNode') ? null : x\n }\n var signature = function (x) {\n var lis = g.statementsMatching(x).map(function (st) {\n return ('' + nonBlank(st.subject) + ' ' + nonBlank(st.predicate) +\n ' ' + nonBlank(st.object))\n }).concat(g.statementsMatching(undefined, undefined, x).map(function (st) {\n return ('' + nonBlank(st.subject) + ' ' + nonBlank(st.predicate) +\n ' ' + nonBlank(st.object))\n }))\n lis.sort()\n return lis.join('\\n')\n }\n const comparison = Object.prototype.hasOwnProperty.call(g, \"compareTerms\")\n ? g.compareTerms(x, y)\n : x.compareTerm(y)\n\n if ((x.termType === 'BlankNode') && (y.termType === 'BlankNode')) {\n if (comparison === 0) return 0 // Same\n if (signature(x) > signature(y)) return +1\n if (signature(x) < signature(y)) return -1\n return comparison // Too bad -- this order not canonical.\n // throw \"different bnodes indistinquishable for sorting\"\n } else {\n if (uriMap && x.uri && y.uri){\n return (uriMap[x.uri] || x.uri).localeCompare(uriMap[y.uri] || y.uri)\n }\n return comparison\n }\n}\n\nexport function heavyCompareSPO (x, y, g, uriMap) {\n return heavyCompare(x.subject, y.subject, g, uriMap) ||\n heavyCompare(x.predicate, y.predicate, g, uriMap) ||\n heavyCompare(x.object, y.object, g, uriMap)\n}\n\n/**\n * Defines a simple debugging function\n * @method output\n * @param o {String}\n */\nexport function output (o) {\n var k = document.createElement('div')\n k.textContent = o\n document.body.appendChild(k)\n}\n\nimport { DOMParser } from '@xmldom/xmldom'\n\n/**\n * Returns a DOM from parsed XML.\n */\nexport function parseXML (str, options) {\n var dparser\n options = options || {}\n if (typeof module !== 'undefined' && module && module.exports) { // Node.js\n var dom = new DOMParser().parseFromString(str, options.contentType || 'application/xhtml+xml')\n return dom\n } else {\n if (typeof window !== 'undefined' && window.DOMParser) {\n dparser = new window.DOMParser() // seems to actually work\n } else {\n dparser = new DOMParser() // Doc says this works\n }\n }\n return dparser.parseFromString(str, 'application/xml')\n}\n\n/**\n * Removes all statements equal to x from a\n */\nexport function RDFArrayRemove (a, x) {\n for (var i = 0; i < a.length; i++) {\n // TODO: This used to be the following, which didnt always work..why\n // if(a[i] === x)\n if (a[i].subject.equals(x.subject) &&\n a[i].predicate.equals(x.predicate) &&\n a[i].object.equals(x.object) &&\n a[i].why.equals(x.why)) {\n a.splice(i, 1)\n return\n }\n }\n throw new Error('RDFArrayRemove: Array did not contain ' + x + ' ' + x.why)\n}\n\nexport function string_startswith (str, pref) { // missing library routines\n return (str.slice(0, pref.length) === pref)\n}\n\n/**\n * C++, python style %s -> subs\n */\nfunction stringTemplate (base, subs) {\n var baseA = base.split('%s')\n var result = ''\n for (var i = 0;i < subs.length;i++) {\n subs[i] += ''\n result += baseA[i] + subs[i]\n }\n return result + baseA.slice(subs.length).join()\n}\n\n\n// Stack dump on errors - to pass errors back\n\nexport function stackString (e) {\n var str = '' + e + '\\n'\n if (!e.stack) {\n return str + 'No stack available.\\n'\n }\n var lines = e.stack.toString().split('\\n')\n var toprint = []\n for (var i = 0; i < lines.length; i++) {\n var line = lines[i]\n if (line.indexOf('ecmaunit.js') > -1) {\n // remove useless bit of traceback\n break\n }\n if (line.charAt(0) == '(') {\n line = 'function' + line\n }\n var chunks = line.split('@')\n toprint.push(chunks)\n }\n // toprint.reverse(); No - I prefer the latest at the top by the error message -tbl\n\n for (var i = 0; i < toprint.length; i++) {\n str += ' ' + toprint[i][1] + '\\n ' + toprint[i][0]\n }\n return str\n}\n","import { Term } from '../tf-types'\n\n/** Retrieve the value of a term, or self if already a string. */\nexport function termValue (node: Term | string): string {\n if (typeof node === 'string') {\n return node\n }\n\n return node.value\n}\n","import {\n ObjectType, CollectionTermType, NamedNodeTermType, VariableTermType, BlankNodeTermType, LiteralTermType, GraphTermType, DefaultGraphTermType,\n} from '../types'\nimport Collection from '../collection'\nimport IndexedFormula from '../store'\nimport Statement from '../statement'\nimport {\n BlankNode,\n Quad_Graph,\n Literal,\n NamedNode,\n Quad_Object,\n Quad_Predicate,\n Quad,\n Quad_Subject,\n Term,\n Variable,\n} from '../tf-types'\n\n/** TypeGuard for RDFLib Statements */\nexport function isStatement(obj): obj is Statement {\n return typeof obj === 'object' && obj !== null && 'subject' in obj\n}\n\n/** TypeGuard for RDFlib Stores */\nexport function isStore(obj): obj is IndexedFormula {\n return typeof obj === 'object' && obj !== null && 'statements' in obj\n}\n\n/** TypeGuard for RDFLib Collections */\nexport function isCollection(obj: any): obj is Collection {\n return isTerm(obj)\n && (obj as Term).termType === CollectionTermType\n}\n\n/** TypeGuard for valid RDFlib Object types, also allows Collections, Graphs */\nexport function isRDFlibObject(obj: any): obj is ObjectType {\n return obj && Object.prototype.hasOwnProperty.call(obj, 'termType') && (\n obj.termType === NamedNodeTermType ||\n obj.termType === VariableTermType ||\n obj.termType === BlankNodeTermType ||\n obj.termType === CollectionTermType ||\n obj.termType === LiteralTermType ||\n obj.termType === GraphTermType\n )\n}\n\n/** TypeGuard for valid RDFlib Subject types, same as Object as RDFLib symmetrical.\n*/\nexport function isRDFlibSubject(obj: any): obj is ObjectType {\n return obj && Object.prototype.hasOwnProperty.call(obj, 'termType') && (\n obj.termType === NamedNodeTermType ||\n obj.termType === VariableTermType ||\n obj.termType === BlankNodeTermType ||\n obj.termType === CollectionTermType ||\n obj.termType === LiteralTermType ||\n obj.termType === GraphTermType\n )\n}\n\n/** TypeGuard for valid RDF/JS spec Predicate types */\nexport function isRDFlibPredicate(obj: any): obj is Quad_Predicate {\n return isTerm(obj) && (\n obj.termType === NamedNodeTermType ||\n obj.termType === BlankNodeTermType ||\n obj.termType === VariableTermType\n )\n}\n\n/** TypeGuard for RDFLib Variables */\nexport function isVariable(obj: any): obj is Variable {\n return isTerm(obj)\n && (obj as Term).termType === VariableTermType\n}\n\n/** TypeGuard for RDF/JS spec Terms */\nexport function isTerm(obj: any): obj is Term {\n return typeof obj === 'object'\n && obj !== null\n && 'termType' in obj\n}\n\n/** TypeGuard for RDF/JS spec Literals */\nexport function isLiteral(value: any): value is Literal {\n return (value as Term).termType === LiteralTermType\n}\n\n/** TypeGuard for RDF/JS spec Quads */\nexport function isQuad(obj: any): obj is Quad {\n return typeof obj === \"object\" && obj !== null && (\n 'subject' in obj\n && 'predicate' in obj\n && 'object' in obj\n )\n}\n\n/** TypeGuard for RDF/JS spec NamedNodes */\nexport function isNamedNode(obj: any): obj is NamedNode {\n return isTerm(obj) && obj.termType === 'NamedNode'\n}\n\n/** TypeGuard for RDF/JS spec BlankNodes */\nexport function isBlankNode(obj: any): obj is BlankNode {\n return isTerm(obj) && 'termType' in obj && obj.termType === 'BlankNode'\n}\n\n/** TypeGuard for valid RDF/JS spec Subject types */\nexport function isSubject(obj: any): obj is Quad_Subject {\n return isTerm(obj) && (\n obj.termType === NamedNodeTermType ||\n obj.termType === VariableTermType ||\n obj.termType === BlankNodeTermType\n )\n}\n\n/** TypeGuard for valid RDF/JS spec Predicate types */\nexport function isPredicate(obj: any): obj is Quad_Predicate {\n return isTerm(obj) && (\n obj.termType === NamedNodeTermType ||\n obj.termType === VariableTermType\n )\n}\n\n/** TypeGuard for valid RDF/JS spec Object types */\nexport function isRDFObject(obj: any): obj is Quad_Object {\n return isTerm(obj) && (\n obj.termType === NamedNodeTermType ||\n obj.termType === VariableTermType ||\n obj.termType === BlankNodeTermType ||\n obj.termType === LiteralTermType\n )\n}\n\n/** TypeGuard for valid RDF/JS Graph types */\nexport function isGraph(obj: any): obj is Quad_Graph {\n return isTerm(obj) && (\n obj.termType === NamedNodeTermType ||\n obj.termType === VariableTermType ||\n obj.termType === BlankNodeTermType ||\n obj.termType === DefaultGraphTermType\n )\n}\n","/*\n * Generated by PEG.js 0.10.0.\n *\n * http://pegjs.org/\n */\n(function(root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define([], factory);\n } else if (typeof module === \"object\" && module.exports) {\n module.exports = factory();\n } else {\n root.ttl2jsonld = factory();\n }\n})(this, function() {\n \"use strict\";\n\n function peg$subclass(child, parent) {\n function ctor() { this.constructor = child; }\n ctor.prototype = parent.prototype;\n child.prototype = new ctor();\n }\n\n function peg$SyntaxError(message, expected, found, location) {\n this.message = message;\n this.expected = expected;\n this.found = found;\n this.location = location;\n this.name = \"SyntaxError\";\n\n if (typeof Error.captureStackTrace === \"function\") {\n Error.captureStackTrace(this, peg$SyntaxError);\n }\n }\n\n peg$subclass(peg$SyntaxError, Error);\n\n peg$SyntaxError.buildMessage = function(expected, found) {\n var DESCRIBE_EXPECTATION_FNS = {\n literal: function(expectation) {\n return \"\\\"\" + literalEscape(expectation.text) + \"\\\"\";\n },\n\n \"class\": function(expectation) {\n var escapedParts = \"\",\n i;\n\n for (i = 0; i < expectation.parts.length; i++) {\n escapedParts += expectation.parts[i] instanceof Array\n ? classEscape(expectation.parts[i][0]) + \"-\" + classEscape(expectation.parts[i][1])\n : classEscape(expectation.parts[i]);\n }\n\n return \"[\" + (expectation.inverted ? \"^\" : \"\") + escapedParts + \"]\";\n },\n\n any: function(expectation) {\n return \"any character\";\n },\n\n end: function(expectation) {\n return \"end of input\";\n },\n\n other: function(expectation) {\n return expectation.description;\n }\n };\n\n function hex(ch) {\n return ch.charCodeAt(0).toString(16).toUpperCase();\n }\n\n function literalEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function(ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return '\\\\x' + hex(ch); });\n }\n\n function classEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\\]/g, '\\\\]')\n .replace(/\\^/g, '\\\\^')\n .replace(/-/g, '\\\\-')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function(ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return '\\\\x' + hex(ch); });\n }\n\n function describeExpectation(expectation) {\n return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);\n }\n\n function describeExpected(expected) {\n var descriptions = new Array(expected.length),\n i, j;\n\n for (i = 0; i < expected.length; i++) {\n descriptions[i] = describeExpectation(expected[i]);\n }\n\n descriptions.sort();\n\n if (descriptions.length > 0) {\n for (i = 1, j = 1; i < descriptions.length; i++) {\n if (descriptions[i - 1] !== descriptions[i]) {\n descriptions[j] = descriptions[i];\n j++;\n }\n }\n descriptions.length = j;\n }\n\n switch (descriptions.length) {\n case 1:\n return descriptions[0];\n\n case 2:\n return descriptions[0] + \" or \" + descriptions[1];\n\n default:\n return descriptions.slice(0, -1).join(\", \")\n + \", or \"\n + descriptions[descriptions.length - 1];\n }\n }\n\n function describeFound(found) {\n return found ? \"\\\"\" + literalEscape(found) + \"\\\"\" : \"end of input\";\n }\n\n return \"Expected \" + describeExpected(expected) + \" but \" + describeFound(found) + \" found.\";\n };\n\n function peg$parse(input, options) {\n options = options !== void 0 ? options : {};\n\n var peg$FAILED = {},\n\n peg$startRuleFunctions = { turtleDoc: peg$parseturtleDoc },\n peg$startRuleFunction = peg$parseturtleDoc,\n\n peg$c0 = function(statements) {\n var jsonld = context.toJSON();\n jsonld[\"@graph\"] = [];\n statements.filter(a=>Array.isArray(a)).forEach(a=>{\n a.forEach(b=>{\n jsonld[\"@graph\"].push(b);\n });\n });\n\n if(jsonld[\"@graph\"].length===1){\n Object.assign(jsonld,jsonld[\"@graph\"][0]);\n delete jsonld[\"@graph\"];\n }\n\n return jsonld;\n },\n peg$c1 = \".\",\n peg$c2 = peg$literalExpectation(\".\", false),\n peg$c3 = function(a) {return a;},\n peg$c4 = \"#\",\n peg$c5 = peg$literalExpectation(\"#\", false),\n peg$c6 = /^[^\\n]/,\n peg$c7 = peg$classExpectation([\"\\n\"], true, false),\n peg$c8 = \"\\n\",\n peg$c9 = peg$literalExpectation(\"\\n\", false),\n peg$c10 = function(a) {return a.join(\"\");},\n peg$c11 = \"@prefix\",\n peg$c12 = peg$literalExpectation(\"@prefix\", false),\n peg$c13 = function(a, b) {\n context.addPrefix(a===\"\" ? \"0\" : a,b);\n return {};\n },\n peg$c14 = \"@base\",\n peg$c15 = peg$literalExpectation(\"@base\", false),\n peg$c16 = function(a) {\n context.addBase(a);\n return {};\n },\n peg$c17 = /^[Bb]/,\n peg$c18 = peg$classExpectation([\"B\", \"b\"], false, false),\n peg$c19 = /^[Aa]/,\n peg$c20 = peg$classExpectation([\"A\", \"a\"], false, false),\n peg$c21 = /^[Ss]/,\n peg$c22 = peg$classExpectation([\"S\", \"s\"], false, false),\n peg$c23 = /^[Ee]/,\n peg$c24 = peg$classExpectation([\"E\", \"e\"], false, false),\n peg$c25 = /^[Pp]/,\n peg$c26 = peg$classExpectation([\"P\", \"p\"], false, false),\n peg$c27 = /^[Rr]/,\n peg$c28 = peg$classExpectation([\"R\", \"r\"], false, false),\n peg$c29 = /^[Ff]/,\n peg$c30 = peg$classExpectation([\"F\", \"f\"], false, false),\n peg$c31 = /^[Ii]/,\n peg$c32 = peg$classExpectation([\"I\", \"i\"], false, false),\n peg$c33 = /^[Xx]/,\n peg$c34 = peg$classExpectation([\"X\", \"x\"], false, false),\n peg$c35 = function(s, p) {\n var x = {};\n if(typeof s==='string' && s!=='[]') x[\"@id\"] = s;\n else if(typeof s==='object') Object.assign(x,s);\n if(p) Object.assign(x,p);\n return [x];\n },\n peg$c36 = function(s, p) {\n var x = {};\n if(s) Object.assign(x,s);\n if(p) Object.assign(x,p);\n return [x];\n },\n peg$c37 = \";\",\n peg$c38 = peg$literalExpectation(\";\", false),\n peg$c39 = function(a, b, e, f) {var x={};x[e]=f;return x;},\n peg$c40 = function(a, b, d) {return d;},\n peg$c41 = function(a, b, c) {\n var x = {};\n c.unshift(createObject(a,b));\n c.forEach(t=>{\n if(!t) return;\n Object.keys(t).forEach(key=>{\n t[key].forEach(val=>{\n if(key===\"@type\" && val[\"@id\"]!==undefined) val = val[\"@id\"];\n if(x[key]===undefined) x[key] = val;\n else if(Array.isArray(x[key])) x[key].push(val);\n else x[key] = [x[key],val];\n });\n });\n });\n return x;\n },\n peg$c42 = \",\",\n peg$c43 = peg$literalExpectation(\",\", false),\n peg$c44 = function(a, c) {return c;},\n peg$c45 = function(a, b) {\n b.unshift(a);\n return b;\n },\n peg$c46 = \"a\",\n peg$c47 = peg$literalExpectation(\"a\", false),\n peg$c48 = function() {return '@type';},\n peg$c49 = function(a) {return expandList(a,true);},\n peg$c50 = function(a) {return expandList(a,false);},\n peg$c51 = function(a) {return a===\"[]\" ? {} : {\"@id\":a};},\n peg$c52 = function(a) {return {\"@id\":a};},\n peg$c53 = \"[\",\n peg$c54 = peg$literalExpectation(\"[\", false),\n peg$c55 = \"]\",\n peg$c56 = peg$literalExpectation(\"]\", false),\n peg$c57 = \"(\",\n peg$c58 = peg$literalExpectation(\"(\", false),\n peg$c59 = \")\",\n peg$c60 = peg$literalExpectation(\")\", false),\n peg$c61 = function(a) {return {\"@list\":a};},\n peg$c62 = function(a, b) {return {\"@value\":a,\"@language\":b};},\n peg$c63 = \"^^\",\n peg$c64 = peg$literalExpectation(\"^^\", false),\n peg$c65 = function(a, b) {\n if(b===\"http://www.w3.org/2001/XMLSchema#boolean\" && a===\"true\") return true;\n if(b===\"http://www.w3.org/2001/XMLSchema#boolean\" && a===\"false\") return false;\n if(b===\"http://www.w3.org/2001/XMLSchema#integer\") return parseInt(a);\n if(b===\"http://www.w3.org/2001/XMLSchema#double\") return parseFloat(a);\n\n const uri = context.resolve(b,true);\n if(uri){\n const prefix = b.split(\":\")[0];\n if(uri===\"http://www.w3.org/2001/XMLSchema#boolean\" && a===\"true\"){\n context.decrement(prefix);\n return true;\n }\n if(uri===\"http://www.w3.org/2001/XMLSchema#boolean\" && a===\"false\"){\n context.decrement(prefix);\n return false;\n }\n if(uri===\"http://www.w3.org/2001/XMLSchema#integer\"){\n context.decrement(prefix);\n return parseInt(a);\n }\n if(uri===\"http://www.w3.org/2001/XMLSchema#double\"){\n context.decrement(prefix);\n return parseFloat(a);\n }\n }\n return {\"@value\":a,\"@type\":b};\n },\n peg$c66 = \"true\",\n peg$c67 = peg$literalExpectation(\"true\", false),\n peg$c68 = function() {return true;},\n peg$c69 = \"false\",\n peg$c70 = peg$literalExpectation(\"false\", false),\n peg$c71 = function() {return false;},\n peg$c72 = function(a) {return a+\":\";},\n peg$c73 = \"<\",\n peg$c74 = peg$literalExpectation(\"<\", false),\n peg$c75 = /^[^\\0- <>\"{}|\\^`\\\\]/,\n peg$c76 = peg$classExpectation([[\"\\0\", \" \"], \"<\", \">\", \"\\\"\", \"{\", \"}\", \"|\", \"^\", \"`\", \"\\\\\"], true, false),\n peg$c77 = \">\",\n peg$c78 = peg$literalExpectation(\">\", false),\n peg$c79 = function(a) {\n const decoded = a.map(s=> {\n if(0x10000 <= s.codePointAt(0) && s.codePointAt(0) <= 0xeffff) return 'a';\n if(s.length===1) return s;\n if(s.length===6) return String.fromCharCode(\"0x\"+s.substring(2));\n if(s.length===10) return String.fromCodePoint(\"0x\"+s.substring(2));\n return s;\n }).join(\"\");\n if(decoded.match(/^[^\\u0000-\\u0020<>\"{}|^`\\\\]*$/)){\n var join = a.join(\"\");\n try{\n return context.resolve(join);\n }catch(e){\n error(\"Invalid IRIREF \"+join);\n }\n }\n else error(\"Invalid IRIREF \"+a.join(\"\")+\" / \"+decoded);\n },\n peg$c80 = \":\",\n peg$c81 = peg$literalExpectation(\":\", false),\n peg$c82 = function(a) {\n a = a || \"0\";\n if(context.hasPrefix(a)===false)\n error(\"undefined prefix \"+a);\n return a;\n },\n peg$c83 = function(a) {return (a||\"\");},\n peg$c84 = function(a, b) {\n context.increment(a);\n return context.resolve(a+\":\"+b);\n },\n peg$c85 = \"_:\",\n peg$c86 = peg$literalExpectation(\"_:\", false),\n peg$c87 = /^[0-9]/,\n peg$c88 = peg$classExpectation([[\"0\", \"9\"]], false, false),\n peg$c89 = \"@\",\n peg$c90 = peg$literalExpectation(\"@\", false),\n peg$c91 = /^[a-zA-Z]/,\n peg$c92 = peg$classExpectation([[\"a\", \"z\"], [\"A\", \"Z\"]], false, false),\n peg$c93 = \"-\",\n peg$c94 = peg$literalExpectation(\"-\", false),\n peg$c95 = /^[a-zA-Z0-9]/,\n peg$c96 = peg$classExpectation([[\"a\", \"z\"], [\"A\", \"Z\"], [\"0\", \"9\"]], false, false),\n peg$c97 = function(a, s) {return '-'+s.join(\"\");},\n peg$c98 = function(a, b) {return a.join(\"\")+b.join(\"\");},\n peg$c99 = /^[+\\-]/,\n peg$c100 = peg$classExpectation([\"+\", \"-\"], false, false),\n peg$c101 = function(a) {\n if(a.match(/^[0+][0-9]+$/))\n return {\n \"@value\" : a,\n \"@type\" : \"http://www.w3.org/2001/XMLSchema#integer\"\n };\n return parseInt(a);\n },\n peg$c102 = function(a) {\n return {\n \"@value\" : a,\n \"@type\" : \"http://www.w3.org/2001/XMLSchema#decimal\"\n }\n },\n peg$c103 = function(a) {\n return {\n \"@value\" : a,\n \"@type\" : \"http://www.w3.org/2001/XMLSchema#double\"\n };\n },\n peg$c104 = /^[eE]/,\n peg$c105 = peg$classExpectation([\"e\", \"E\"], false, false),\n peg$c106 = \"\\\"\",\n peg$c107 = peg$literalExpectation(\"\\\"\", false),\n peg$c108 = /^[^\"\\\\\\n\\r]/,\n peg$c109 = peg$classExpectation([\"\\\"\", \"\\\\\", \"\\n\", \"\\r\"], true, false),\n peg$c110 = \"'\",\n peg$c111 = peg$literalExpectation(\"'\", false),\n peg$c112 = /^[^'\\\\\\n\\r]/,\n peg$c113 = peg$classExpectation([\"'\", \"\\\\\", \"\\n\", \"\\r\"], true, false),\n peg$c114 = \"'''\",\n peg$c115 = peg$literalExpectation(\"'''\", false),\n peg$c116 = /^[^'\\\\]/,\n peg$c117 = peg$classExpectation([\"'\", \"\\\\\"], true, false),\n peg$c118 = \"''\",\n peg$c119 = peg$literalExpectation(\"''\", false),\n peg$c120 = function(head, a) {return \"''\"+a.join(\"\");},\n peg$c121 = function(head, a) {return \"'\" +a.join(\"\");},\n peg$c122 = function(head, body) {return head.join(\"\")+body.join(\"\");},\n peg$c123 = \"\\\"\\\"\\\"\",\n peg$c124 = peg$literalExpectation(\"\\\"\\\"\\\"\", false),\n peg$c125 = /^[^\"\\\\]/,\n peg$c126 = peg$classExpectation([\"\\\"\", \"\\\\\"], true, false),\n peg$c127 = \"\\\"\\\"\",\n peg$c128 = peg$literalExpectation(\"\\\"\\\"\", false),\n peg$c129 = function(head, a) {return '\"\"'+a.join(\"\");},\n peg$c130 = function(head, a) {return '\"' +a.join(\"\");},\n peg$c131 = \"\\\\U\",\n peg$c132 = peg$literalExpectation(\"\\\\U\", false),\n peg$c133 = function(hex) {\n return String.fromCodePoint(parseInt(hex.join(\"\"),16));\n },\n peg$c134 = \"\\\\u\",\n peg$c135 = peg$literalExpectation(\"\\\\u\", false),\n peg$c136 = function(hex) {\n return String.fromCharCode(parseInt(hex.join(\"\"),16));\n },\n peg$c137 = \"\\\\t\",\n peg$c138 = peg$literalExpectation(\"\\\\t\", false),\n peg$c139 = function() {return '\\t';},\n peg$c140 = \"\\\\b\",\n peg$c141 = peg$literalExpectation(\"\\\\b\", false),\n peg$c142 = function() {return '\\b';},\n peg$c143 = \"\\\\n\",\n peg$c144 = peg$literalExpectation(\"\\\\n\", false),\n peg$c145 = function() {return '\\n';},\n peg$c146 = \"\\\\r\",\n peg$c147 = peg$literalExpectation(\"\\\\r\", false),\n peg$c148 = function() {return '\\r';},\n peg$c149 = \"\\\\f\",\n peg$c150 = peg$literalExpectation(\"\\\\f\", false),\n peg$c151 = function() {return '\\f';},\n peg$c152 = \"\\\\\\\"\",\n peg$c153 = peg$literalExpectation(\"\\\\\\\"\", false),\n peg$c154 = function() {return '\"';},\n peg$c155 = \"\\\\'\",\n peg$c156 = peg$literalExpectation(\"\\\\'\", false),\n peg$c157 = function() {return \"'\";},\n peg$c158 = \"\\\\\\\\\",\n peg$c159 = peg$literalExpectation(\"\\\\\\\\\", false),\n peg$c160 = function() {return '\\\\';},\n peg$c161 = /^[ \\t\\r\\n]/,\n peg$c162 = peg$classExpectation([\" \", \"\\t\", \"\\r\", \"\\n\"], false, false),\n peg$c163 = function() {return \"[]\";},\n peg$c164 = /^[\\uD800-\\uDBFF]/,\n peg$c165 = peg$classExpectation([[\"\\uD800\", \"\\uDBFF\"]], false, false),\n peg$c166 = /^[\\uDC00-\\uDFFF]/,\n peg$c167 = peg$classExpectation([[\"\\uDC00\", \"\\uDFFF\"]], false, false),\n peg$c168 = function(a, b) {return a+b;},\n peg$c169 = /^[A-Za-z\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/,\n peg$c170 = peg$classExpectation([[\"A\", \"Z\"], [\"a\", \"z\"], [\"\\xC0\", \"\\xD6\"], [\"\\xD8\", \"\\xF6\"], [\"\\xF8\", \"\\u02FF\"], [\"\\u0370\", \"\\u037D\"], [\"\\u037F\", \"\\u1FFF\"], [\"\\u200C\", \"\\u200D\"], [\"\\u2070\", \"\\u218F\"], [\"\\u2C00\", \"\\u2FEF\"], [\"\\u3001\", \"\\uD7FF\"], [\"\\uF900\", \"\\uFDCF\"], [\"\\uFDF0\", \"\\uFFFD\"]], false, false),\n peg$c171 = \"_\",\n peg$c172 = peg$literalExpectation(\"_\", false),\n peg$c173 = \"\\xB7\",\n peg$c174 = peg$literalExpectation(\"\\xB7\", false),\n peg$c175 = /^[\\u0300-\\u036F]/,\n peg$c176 = peg$classExpectation([[\"\\u0300\", \"\\u036F\"]], false, false),\n peg$c177 = /^[\\u203F-\\u2040]/,\n peg$c178 = peg$classExpectation([[\"\\u203F\", \"\\u2040\"]], false, false),\n peg$c179 = function(head, body, a, b) {return a.join(\"\")+b.join(\"\");},\n peg$c180 = function(head, body, tail) {return head+body.join(\"\")+tail.join(\"\");},\n peg$c181 = \"%\",\n peg$c182 = peg$literalExpectation(\"%\", false),\n peg$c183 = /^[0-9A-Fa-f]/,\n peg$c184 = peg$classExpectation([[\"0\", \"9\"], [\"A\", \"F\"], [\"a\", \"f\"]], false, false),\n peg$c185 = \"\\\\\",\n peg$c186 = peg$literalExpectation(\"\\\\\", false),\n peg$c187 = /^[_~.!$&'()*+,;=\\/?#@%\\-]/,\n peg$c188 = peg$classExpectation([\"_\", \"~\", \".\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\", \"/\", \"?\", \"#\", \"@\", \"%\", \"-\"], false, false),\n\n peg$currPos = 0,\n peg$savedPos = 0,\n peg$posDetailsCache = [{ line: 1, column: 1 }],\n peg$maxFailPos = 0,\n peg$maxFailExpected = [],\n peg$silentFails = 0,\n\n peg$result;\n\n if (\"startRule\" in options) {\n if (!(options.startRule in peg$startRuleFunctions)) {\n throw new Error(\"Can't start parsing from rule \\\"\" + options.startRule + \"\\\".\");\n }\n\n peg$startRuleFunction = peg$startRuleFunctions[options.startRule];\n }\n\n function text() {\n return input.substring(peg$savedPos, peg$currPos);\n }\n\n function location() {\n return peg$computeLocation(peg$savedPos, peg$currPos);\n }\n\n function expected(description, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildStructuredError(\n [peg$otherExpectation(description)],\n input.substring(peg$savedPos, peg$currPos),\n location\n );\n }\n\n function error(message, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildSimpleError(message, location);\n }\n\n function peg$literalExpectation(text, ignoreCase) {\n return { type: \"literal\", text: text, ignoreCase: ignoreCase };\n }\n\n function peg$classExpectation(parts, inverted, ignoreCase) {\n return { type: \"class\", parts: parts, inverted: inverted, ignoreCase: ignoreCase };\n }\n\n function peg$anyExpectation() {\n return { type: \"any\" };\n }\n\n function peg$endExpectation() {\n return { type: \"end\" };\n }\n\n function peg$otherExpectation(description) {\n return { type: \"other\", description: description };\n }\n\n function peg$computePosDetails(pos) {\n var details = peg$posDetailsCache[pos], p;\n\n if (details) {\n return details;\n } else {\n p = pos - 1;\n while (!peg$posDetailsCache[p]) {\n p--;\n }\n\n details = peg$posDetailsCache[p];\n details = {\n line: details.line,\n column: details.column\n };\n\n while (p < pos) {\n if (input.charCodeAt(p) === 10) {\n details.line++;\n details.column = 1;\n } else {\n details.column++;\n }\n\n p++;\n }\n\n peg$posDetailsCache[pos] = details;\n return details;\n }\n }\n\n function peg$computeLocation(startPos, endPos) {\n var startPosDetails = peg$computePosDetails(startPos),\n endPosDetails = peg$computePosDetails(endPos);\n\n return {\n start: {\n offset: startPos,\n line: startPosDetails.line,\n column: startPosDetails.column\n },\n end: {\n offset: endPos,\n line: endPosDetails.line,\n column: endPosDetails.column\n }\n };\n }\n\n function peg$fail(expected) {\n if (peg$currPos < peg$maxFailPos) { return; }\n\n if (peg$currPos > peg$maxFailPos) {\n peg$maxFailPos = peg$currPos;\n peg$maxFailExpected = [];\n }\n\n peg$maxFailExpected.push(expected);\n }\n\n function peg$buildSimpleError(message, location) {\n return new peg$SyntaxError(message, null, null, location);\n }\n\n function peg$buildStructuredError(expected, found, location) {\n return new peg$SyntaxError(\n peg$SyntaxError.buildMessage(expected, found),\n expected,\n found,\n location\n );\n }\n\n function peg$parseturtleDoc() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parsestatement();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parsestatement();\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseIGNORE();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseIGNORE();\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c0(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsestatement() {\n var s0, s1, s2, s3;\n\n s0 = peg$parsedirective();\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsetriples();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseIGNORE();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseIGNORE();\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s3 = peg$c1;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseCOMMENT() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 35) {\n s1 = peg$c4;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c5); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c6.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c7); }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c6.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c7); }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 10) {\n s3 = peg$c8;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c9); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c10(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseIGNORE() {\n var s0;\n\n s0 = peg$parseWS();\n if (s0 === peg$FAILED) {\n s0 = peg$parseCOMMENT();\n }\n\n return s0;\n }\n\n function peg$parsedirective() {\n var s0;\n\n s0 = peg$parseprefixID();\n if (s0 === peg$FAILED) {\n s0 = peg$parsebase();\n if (s0 === peg$FAILED) {\n s0 = peg$parsesparqlPrefix();\n if (s0 === peg$FAILED) {\n s0 = peg$parsesparqlBase();\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseprefixID() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.substr(peg$currPos, 7) === peg$c11) {\n s2 = peg$c11;\n peg$currPos += 7;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c12); }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseIGNORE();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseIGNORE();\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parsePNAME_NS_NO_CHECK();\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parseIGNORE();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseIGNORE();\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseIRIREF();\n if (s6 !== peg$FAILED) {\n s7 = [];\n s8 = peg$parseIGNORE();\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n s8 = peg$parseIGNORE();\n }\n if (s7 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s8 = peg$c1;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s8 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c13(s4, s6);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsebase() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c14) {\n s2 = peg$c14;\n peg$currPos += 5;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c15); }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseIGNORE();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseIGNORE();\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parseIRIREF();\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parseIGNORE();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseIGNORE();\n }\n if (s5 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c1;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c16(s4);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsesparqlBase() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (peg$c17.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c18); }\n }\n if (s2 !== peg$FAILED) {\n if (peg$c19.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c20); }\n }\n if (s3 !== peg$FAILED) {\n if (peg$c21.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c22); }\n }\n if (s4 !== peg$FAILED) {\n if (peg$c23.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c24); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n s7 = peg$parseIGNORE();\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n s7 = peg$parseIGNORE();\n }\n if (s6 !== peg$FAILED) {\n s7 = peg$parseIRIREF();\n if (s7 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c16(s7);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsesparqlPrefix() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (peg$c25.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c26); }\n }\n if (s2 !== peg$FAILED) {\n if (peg$c27.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c28); }\n }\n if (s3 !== peg$FAILED) {\n if (peg$c23.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c24); }\n }\n if (s4 !== peg$FAILED) {\n if (peg$c29.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c30); }\n }\n if (s5 !== peg$FAILED) {\n if (peg$c31.test(input.charAt(peg$currPos))) {\n s6 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c32); }\n }\n if (s6 !== peg$FAILED) {\n if (peg$c33.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c34); }\n }\n if (s7 !== peg$FAILED) {\n s8 = [];\n s9 = peg$parseIGNORE();\n while (s9 !== peg$FAILED) {\n s8.push(s9);\n s9 = peg$parseIGNORE();\n }\n if (s8 !== peg$FAILED) {\n s9 = peg$parsePNAME_NS_NO_CHECK();\n if (s9 !== peg$FAILED) {\n s10 = [];\n s11 = peg$parseIGNORE();\n while (s11 !== peg$FAILED) {\n s10.push(s11);\n s11 = peg$parseIGNORE();\n }\n if (s10 !== peg$FAILED) {\n s11 = peg$parseIRIREF();\n if (s11 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c13(s9, s11);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsetriples() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsesubject();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsepredicateObjectList();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c35(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseblankNodePropertyList();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsepredicateObjectList();\n if (s2 === peg$FAILED) {\n s2 = null;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c36(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parsepredicateObjectList() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;\n\n s0 = peg$currPos;\n s1 = peg$parseverb();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseobjectList();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n s5 = [];\n s6 = peg$parseIGNORE();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseIGNORE();\n }\n if (s5 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 59) {\n s6 = peg$c37;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c38); }\n }\n if (s6 !== peg$FAILED) {\n s7 = peg$currPos;\n s8 = peg$parseverb();\n if (s8 !== peg$FAILED) {\n s9 = peg$parseobjectList();\n if (s9 !== peg$FAILED) {\n peg$savedPos = s7;\n s8 = peg$c39(s1, s2, s8, s9);\n s7 = s8;\n } else {\n peg$currPos = s7;\n s7 = peg$FAILED;\n }\n } else {\n peg$currPos = s7;\n s7 = peg$FAILED;\n }\n if (s7 === peg$FAILED) {\n s7 = null;\n }\n if (s7 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c40(s1, s2, s7);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n s5 = [];\n s6 = peg$parseIGNORE();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseIGNORE();\n }\n if (s5 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 59) {\n s6 = peg$c37;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c38); }\n }\n if (s6 !== peg$FAILED) {\n s7 = peg$currPos;\n s8 = peg$parseverb();\n if (s8 !== peg$FAILED) {\n s9 = peg$parseobjectList();\n if (s9 !== peg$FAILED) {\n peg$savedPos = s7;\n s8 = peg$c39(s1, s2, s8, s9);\n s7 = s8;\n } else {\n peg$currPos = s7;\n s7 = peg$FAILED;\n }\n } else {\n peg$currPos = s7;\n s7 = peg$FAILED;\n }\n if (s7 === peg$FAILED) {\n s7 = null;\n }\n if (s7 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c40(s1, s2, s7);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c41(s1, s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseobjectList() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n s1 = peg$parseobject();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n s4 = [];\n s5 = peg$parseIGNORE();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parseIGNORE();\n }\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s5 = peg$c42;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseobject();\n if (s6 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c44(s1, s6);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n s4 = [];\n s5 = peg$parseIGNORE();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parseIGNORE();\n }\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s5 = peg$c42;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseobject();\n if (s6 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c44(s1, s6);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c45(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseverb() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsepredicate();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 97) {\n s2 = peg$c46;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c47); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c48();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parsesubject() {\n var s0, s1;\n\n s0 = peg$currPos;\n s1 = peg$parsecollection();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c49(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$parseBlankNode();\n if (s0 === peg$FAILED) {\n s0 = peg$parseiri();\n }\n }\n\n return s0;\n }\n\n function peg$parsepredicate() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseiri();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseobject() {\n var s0, s1;\n\n s0 = peg$parseliteral();\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsecollection();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c50(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseBlankNode();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c51(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseblankNodePropertyList();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseiri();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c52(s1);\n }\n s0 = s1;\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseliteral() {\n var s0;\n\n s0 = peg$parseRDFLiteral();\n if (s0 === peg$FAILED) {\n s0 = peg$parseNumericLiteral();\n if (s0 === peg$FAILED) {\n s0 = peg$parseBooleanLiteral();\n }\n }\n\n return s0;\n }\n\n function peg$parseblankNodePropertyList() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 91) {\n s2 = peg$c53;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c54); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parsepredicateObjectList();\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$parseIGNORE();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parseIGNORE();\n }\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 93) {\n s5 = peg$c55;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c56); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsecollection() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 40) {\n s2 = peg$c57;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c58); }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseobject();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseobject();\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$parseIGNORE();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parseIGNORE();\n }\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c59;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c60); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c61(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseNumericLiteral() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseDOUBLE();\n if (s2 === peg$FAILED) {\n s2 = peg$parseDECIMAL();\n if (s2 === peg$FAILED) {\n s2 = peg$parseINTEGER();\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseRDFLiteral() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseString();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseIGNORE();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseIGNORE();\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parseLANGTAG();\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c62(s2, s4);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseString();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseIGNORE();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseIGNORE();\n }\n if (s3 !== peg$FAILED) {\n if (input.substr(peg$currPos, 2) === peg$c63) {\n s4 = peg$c63;\n peg$currPos += 2;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c64); }\n }\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parseIGNORE();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseIGNORE();\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseiri();\n if (s6 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c65(s2, s6);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseString();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseBooleanLiteral() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c66) {\n s2 = peg$c66;\n peg$currPos += 4;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c67); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c68();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c69) {\n s2 = peg$c69;\n peg$currPos += 5;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c70); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c71();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseString() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseSTRING_LITERAL_LONG_SINGLE_QUOTE();\n if (s2 === peg$FAILED) {\n s2 = peg$parseSTRING_LITERAL_LONG_QUOTE();\n if (s2 === peg$FAILED) {\n s2 = peg$parseSTRING_LITERAL_SINGLE_QUOTE();\n if (s2 === peg$FAILED) {\n s2 = peg$parseSTRING_LITERAL_QUOTE();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseiri() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseIRIREF();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parsePrefixedName();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parsePrefixedName() {\n var s0, s1;\n\n s0 = peg$parsePNAME_LN();\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsePNAME_NS();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c72(s1);\n }\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parseBlankNode() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseBLANK_NODE_LABEL();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseANON();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseIRIREF() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 60) {\n s1 = peg$c73;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c74); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c75.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c76); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c75.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c76); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 62) {\n s3 = peg$c77;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c78); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c79(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsePNAME_NS() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsePN_PREFIX();\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s2 = peg$c80;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c82(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsePNAME_NS_NO_CHECK() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsePN_PREFIX();\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s2 = peg$c80;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c83(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsePNAME_LN() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsePNAME_NS();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsePN_LOCAL();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c84(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseBLANK_NODE_LABEL() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c85) {\n s2 = peg$c85;\n peg$currPos += 2;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c86); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parsePN_CHARS_U();\n if (s3 === peg$FAILED) {\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$parsePN_CHARS();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parsePN_CHARS();\n }\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$currPos;\n s7 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s8 = peg$c1;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s8 !== peg$FAILED) {\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n if (input.charCodeAt(peg$currPos) === 46) {\n s8 = peg$c1;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n }\n } else {\n s7 = peg$FAILED;\n }\n if (s7 !== peg$FAILED) {\n s8 = [];\n s9 = peg$parsePN_CHARS();\n if (s9 !== peg$FAILED) {\n while (s9 !== peg$FAILED) {\n s8.push(s9);\n s9 = peg$parsePN_CHARS();\n }\n } else {\n s8 = peg$FAILED;\n }\n if (s8 !== peg$FAILED) {\n s7 = [s7, s8];\n s6 = s7;\n } else {\n peg$currPos = s6;\n s6 = peg$FAILED;\n }\n } else {\n peg$currPos = s6;\n s6 = peg$FAILED;\n }\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$currPos;\n s7 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s8 = peg$c1;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s8 !== peg$FAILED) {\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n if (input.charCodeAt(peg$currPos) === 46) {\n s8 = peg$c1;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n }\n } else {\n s7 = peg$FAILED;\n }\n if (s7 !== peg$FAILED) {\n s8 = [];\n s9 = peg$parsePN_CHARS();\n if (s9 !== peg$FAILED) {\n while (s9 !== peg$FAILED) {\n s8.push(s9);\n s9 = peg$parsePN_CHARS();\n }\n } else {\n s8 = peg$FAILED;\n }\n if (s8 !== peg$FAILED) {\n s7 = [s7, s8];\n s6 = s7;\n } else {\n peg$currPos = s6;\n s6 = peg$FAILED;\n }\n } else {\n peg$currPos = s6;\n s6 = peg$FAILED;\n }\n }\n if (s5 !== peg$FAILED) {\n s2 = [s2, s3, s4, s5];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parseLANGTAG() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 64) {\n s1 = peg$c89;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c91.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c92); }\n }\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c91.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c92); }\n }\n }\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 45) {\n s5 = peg$c93;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c94); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c95.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c96); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c95.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c96); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c97(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 45) {\n s5 = peg$c93;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c94); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c95.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c96); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c95.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c96); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c97(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c98(s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseINTEGER() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = peg$currPos;\n if (peg$c99.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c100); }\n }\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n if (s5 !== peg$FAILED) {\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n } else {\n s4 = peg$FAILED;\n }\n if (s4 !== peg$FAILED) {\n s3 = [s3, s4];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n s1 = input.substring(s1, peg$currPos);\n } else {\n s1 = s2;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c101(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parseDECIMAL() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = peg$currPos;\n if (peg$c99.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c100); }\n }\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s5 = peg$c1;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n s3 = [s3, s4, s5, s6];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n s1 = input.substring(s1, peg$currPos);\n } else {\n s1 = s2;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c102(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parseDOUBLE() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = peg$currPos;\n if (peg$c99.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c100); }\n }\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$currPos;\n s5 = [];\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s6 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s6 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c1;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s6 !== peg$FAILED) {\n s7 = [];\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s8 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s8 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n if (s7 !== peg$FAILED) {\n s8 = peg$parseEXPONENT();\n if (s8 !== peg$FAILED) {\n s5 = [s5, s6, s7, s8];\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s5 = peg$c1;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n s7 = peg$parseEXPONENT();\n if (s7 !== peg$FAILED) {\n s5 = [s5, s6, s7];\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n s5 = [];\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s6 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s6 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseEXPONENT();\n if (s6 !== peg$FAILED) {\n s5 = [s5, s6];\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n }\n if (s4 !== peg$FAILED) {\n s3 = [s3, s4];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n s1 = input.substring(s1, peg$currPos);\n } else {\n s1 = s2;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c103(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parseEXPONENT() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (peg$c104.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c105); }\n }\n if (s2 !== peg$FAILED) {\n if (peg$c99.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c100); }\n }\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n if (s5 !== peg$FAILED) {\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n } else {\n s4 = peg$FAILED;\n }\n if (s4 !== peg$FAILED) {\n s2 = [s2, s3, s4];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parseSTRING_LITERAL_QUOTE() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s1 = peg$c106;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c107); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c108.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c109); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c108.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c109); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 34) {\n s3 = peg$c106;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c107); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c10(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseSTRING_LITERAL_SINGLE_QUOTE() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 39) {\n s1 = peg$c110;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c111); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c112.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c113); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c112.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c113); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 39) {\n s3 = peg$c110;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c111); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c10(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseSTRING_LITERAL_LONG_SINGLE_QUOTE() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 3) === peg$c114) {\n s1 = peg$c114;\n peg$currPos += 3;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c115); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c118) {\n s5 = peg$c118;\n peg$currPos += 2;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c119); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c120(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 39) {\n s5 = peg$c110;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c111); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c121(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c118) {\n s5 = peg$c118;\n peg$currPos += 2;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c119); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c120(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 39) {\n s5 = peg$c110;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c111); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c121(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n }\n if (s3 !== peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c114) {\n s4 = peg$c114;\n peg$currPos += 3;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c115); }\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c122(s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseSTRING_LITERAL_LONG_QUOTE() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 3) === peg$c123) {\n s1 = peg$c123;\n peg$currPos += 3;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c124); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c127) {\n s5 = peg$c127;\n peg$currPos += 2;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c128); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c129(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s5 = peg$c106;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c107); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c130(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c127) {\n s5 = peg$c127;\n peg$currPos += 2;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c128); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c129(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s5 = peg$c106;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c107); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c130(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n }\n if (s3 !== peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c123) {\n s4 = peg$c123;\n peg$currPos += 3;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c124); }\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c122(s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseUCHAR() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c131) {\n s1 = peg$c131;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c132); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n s3 = peg$parseHEX();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseHEX();\n if (s4 !== peg$FAILED) {\n s5 = peg$parseHEX();\n if (s5 !== peg$FAILED) {\n s6 = peg$parseHEX();\n if (s6 !== peg$FAILED) {\n s7 = peg$parseHEX();\n if (s7 !== peg$FAILED) {\n s8 = peg$parseHEX();\n if (s8 !== peg$FAILED) {\n s9 = peg$parseHEX();\n if (s9 !== peg$FAILED) {\n s10 = peg$parseHEX();\n if (s10 !== peg$FAILED) {\n s3 = [s3, s4, s5, s6, s7, s8, s9, s10];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c133(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c134) {\n s1 = peg$c134;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c135); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n s3 = peg$parseHEX();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseHEX();\n if (s4 !== peg$FAILED) {\n s5 = peg$parseHEX();\n if (s5 !== peg$FAILED) {\n s6 = peg$parseHEX();\n if (s6 !== peg$FAILED) {\n s3 = [s3, s4, s5, s6];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c136(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseECHAR() {\n var s0, s1;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c137) {\n s1 = peg$c137;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c138); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c139();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c140) {\n s1 = peg$c140;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c141); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c142();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c143) {\n s1 = peg$c143;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c144); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c145();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c146) {\n s1 = peg$c146;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c147); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c148();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c149) {\n s1 = peg$c149;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c150); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c151();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c152) {\n s1 = peg$c152;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c153); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c154();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c155) {\n s1 = peg$c155;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c156); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c157();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c158) {\n s1 = peg$c158;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c159); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c160();\n }\n s0 = s1;\n }\n }\n }\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseWS() {\n var s0;\n\n if (peg$c161.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c162); }\n }\n\n return s0;\n }\n\n function peg$parseANON() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 91) {\n s1 = peg$c53;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c54); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseIGNORE();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseIGNORE();\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 93) {\n s3 = peg$c55;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c56); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c163();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsePN_CHARS_BASE() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n if (peg$c164.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c165); }\n }\n if (s1 !== peg$FAILED) {\n if (peg$c166.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c167); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c168(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n if (peg$c169.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c170); }\n }\n }\n\n return s0;\n }\n\n function peg$parsePN_CHARS_U() {\n var s0;\n\n s0 = peg$parsePN_CHARS_BASE();\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 95) {\n s0 = peg$c171;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c172); }\n }\n }\n\n return s0;\n }\n\n function peg$parsePN_CHARS() {\n var s0;\n\n s0 = peg$parsePN_CHARS_U();\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 45) {\n s0 = peg$c93;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c94); }\n }\n if (s0 === peg$FAILED) {\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 183) {\n s0 = peg$c173;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c174); }\n }\n if (s0 === peg$FAILED) {\n if (peg$c175.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c176); }\n }\n if (s0 === peg$FAILED) {\n if (peg$c177.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c178); }\n }\n }\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parsePN_PREFIX() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = peg$parsePN_CHARS_BASE();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parsePN_CHARS();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parsePN_CHARS();\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$currPos;\n s6 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s7 = peg$c1;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (input.charCodeAt(peg$currPos) === 46) {\n s7 = peg$c1;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n s7 = [];\n s8 = peg$parsePN_CHARS();\n if (s8 !== peg$FAILED) {\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n s8 = peg$parsePN_CHARS();\n }\n } else {\n s7 = peg$FAILED;\n }\n if (s7 !== peg$FAILED) {\n s6 = [s6, s7];\n s5 = s6;\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$currPos;\n s6 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s7 = peg$c1;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (input.charCodeAt(peg$currPos) === 46) {\n s7 = peg$c1;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n s7 = [];\n s8 = peg$parsePN_CHARS();\n if (s8 !== peg$FAILED) {\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n s8 = peg$parsePN_CHARS();\n }\n } else {\n s7 = peg$FAILED;\n }\n if (s7 !== peg$FAILED) {\n s6 = [s6, s7];\n s5 = s6;\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n }\n if (s4 !== peg$FAILED) {\n s2 = [s2, s3, s4];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parsePN_LOCAL() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n s1 = peg$parsePN_CHARS_U();\n if (s1 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s1 = peg$c80;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s1 === peg$FAILED) {\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n if (s1 === peg$FAILED) {\n s1 = peg$parsePLX();\n }\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parsePN_CHARS();\n if (s3 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s3 = peg$c80;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parsePLX();\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parsePN_CHARS();\n if (s3 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s3 = peg$c80;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parsePLX();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n s5 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c1;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c1;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n s7 = peg$parsePN_CHARS();\n if (s7 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s7 = peg$c80;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parsePLX();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n s7 = peg$parsePN_CHARS();\n if (s7 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s7 = peg$c80;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parsePLX();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c179(s1, s2, s5, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n s5 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c1;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c1;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n s7 = peg$parsePN_CHARS();\n if (s7 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s7 = peg$c80;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parsePLX();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n s7 = peg$parsePN_CHARS();\n if (s7 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s7 = peg$c80;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parsePLX();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c179(s1, s2, s5, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c180(s1, s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsePLX() {\n var s0;\n\n s0 = peg$parsePERCENT();\n if (s0 === peg$FAILED) {\n s0 = peg$parsePN_LOCAL_ESC();\n }\n\n return s0;\n }\n\n function peg$parsePERCENT() {\n var s0, s1, s2, s3, s4;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 37) {\n s2 = peg$c181;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c182); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parseHEX();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseHEX();\n if (s4 !== peg$FAILED) {\n s2 = [s2, s3, s4];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parseHEX() {\n var s0;\n\n if (peg$c183.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c184); }\n }\n\n return s0;\n }\n\n function peg$parsePN_LOCAL_ESC() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s1 = peg$c185;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c186); }\n }\n if (s1 !== peg$FAILED) {\n if (peg$c187.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c188); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n\n var isBrowser=new Function(\"try {return this===window;}catch(e){ return false;}\");\n var URL = isBrowser() ? window.URL : require(\"url\").URL;\n var isIRI = function(a){return a.match(/^[a-z](.*?):(.+?)/g);};\n function createObject(property,value){var a={};a[property]=value;return a;}\n var context = {\n base : [],\n data : {},\n addBase : function(uri){\n if(context.base.length===0){\n context.base.push(uri);\n return;\n }\n const last = context.base[context.base.length-1];\n if(last!==uri) context.base.push(new URL(uri,last).toString());\n },\n addPrefix : function(prefix,uri){\n const list = context.data[prefix];\n if(list===undefined){\n context.data[prefix] = [{uri:uri,count:0}];\n }else if(list[list.length-1].uri!==uri){\n list.push({uri:uri,count:0});\n }\n },\n hasPrefix : function(prefix){\n return this.data[prefix]!==undefined;\n },\n resolve : function(pname,force){\n const prefix = Object.keys(context.data).find(key=>pname.indexOf(key+\":\")===0);\n if(prefix!==undefined) {\n const list = context.data[prefix];\n if(list.length===1 && force!==true && isIRI(list[0].uri)) return pname;\n const uri = list[list.length-1].uri;\n return pname.replace(prefix+\":\",uri);\n }else{\n var base = context.base.length === 0 ? options.baseIRI : context.base[context.base.length-1];\n if(!base || pname.match(/^(http:|https:|urn:|file:)/)) return pname;\n if(pname.indexOf(\"//\")===0 && base) return base.split(\"//\")[0]+pname;\n return new URL(pname,base).toString();\n }\n },\n increment : function(prefix){\n const list = context.data[prefix];\n if(list!==undefined)list[list.length-1].count++;\n },\n decrement : function(prefix){\n const list = context.data[prefix];\n if(list!==undefined)list[list.length-1].count--;\n },\n toJSON : function(){\n const root = {};\n if(context.base.length>0){\n if(root[\"@context\"]===undefined)root[\"@context\"] = {};\n root[\"@context\"][\"@base\"] = context.base[0];\n }\n Object.keys(context.data).forEach(key=>{\n const head = context.data[key][0];\n if(head.uri===\"http://www.w3.org/2001/XMLSchema#\" && head.count < 1) return;\n if(!isIRI(head.uri)) return;\n if(root[\"@context\"]===undefined) root[\"@context\"] = {};\n root[\"@context\"][key] = head.uri;\n });\n return root;\n }\n };\n\n function expandList(container,force){\n if(container[\"@list\"]===undefined) return container;\n if(!force && !container[\"@list\"].find(x=>x[\"@list\"]!==undefined)) return container;\n\n if(container[\"@list\"].length===0)\n return {\"@id\" : \"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil\"};\n\n var root = {};\n var focus = null;\n container[\"@list\"].forEach(b=>{\n if(focus===null) focus = root;\n else {\n focus[\"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest\"] = {};\n focus = focus[\"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest\"];\n }\n focus[\"http://www.w3.org/1999/02/22-rdf-syntax-ns#first\"] = expandList(b,true);\n focus[\"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest\"] = {\n \"@id\" : \"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil\"\n };\n });\n return root;\n }\n\n\n peg$result = peg$startRuleFunction();\n\n if (peg$result !== peg$FAILED && peg$currPos === input.length) {\n return peg$result;\n } else {\n if (peg$result !== peg$FAILED && peg$currPos < input.length) {\n peg$fail(peg$endExpectation());\n }\n\n throw peg$buildStructuredError(\n peg$maxFailExpected,\n peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,\n peg$maxFailPos < input.length\n ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)\n : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)\n );\n }\n }\n\n return {\n SyntaxError: peg$SyntaxError,\n parse: peg$parse\n };\n});\n","// Currently in sync with Node.js lib/assert.js\n// https://github.com/nodejs/node/commit/2a51ae424a513ec9a6aa3466baa0cc1d55dd4f3b\n// Originally from narwhal.js (http://narwhaljs.org)\n// Copyright (c) 2009 Thomas Robinson <280north.com>\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the 'Software'), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar _require = require('./internal/errors'),\n _require$codes = _require.codes,\n ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE,\n ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE,\n ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;\n\nvar AssertionError = require('./internal/assert/assertion_error');\n\nvar _require2 = require('util/'),\n inspect = _require2.inspect;\n\nvar _require$types = require('util/').types,\n isPromise = _require$types.isPromise,\n isRegExp = _require$types.isRegExp;\n\nvar objectAssign = Object.assign ? Object.assign : require('es6-object-assign').assign;\nvar objectIs = Object.is ? Object.is : require('object-is');\nvar errorCache = new Map();\nvar isDeepEqual;\nvar isDeepStrictEqual;\nvar parseExpressionAt;\nvar findNodeAround;\nvar decoder;\n\nfunction lazyLoadComparison() {\n var comparison = require('./internal/util/comparisons');\n\n isDeepEqual = comparison.isDeepEqual;\n isDeepStrictEqual = comparison.isDeepStrictEqual;\n} // Escape control characters but not \\n and \\t to keep the line breaks and\n// indentation intact.\n// eslint-disable-next-line no-control-regex\n\n\nvar escapeSequencesRegExp = /[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f]/g;\nvar meta = [\"\\\\u0000\", \"\\\\u0001\", \"\\\\u0002\", \"\\\\u0003\", \"\\\\u0004\", \"\\\\u0005\", \"\\\\u0006\", \"\\\\u0007\", '\\\\b', '', '', \"\\\\u000b\", '\\\\f', '', \"\\\\u000e\", \"\\\\u000f\", \"\\\\u0010\", \"\\\\u0011\", \"\\\\u0012\", \"\\\\u0013\", \"\\\\u0014\", \"\\\\u0015\", \"\\\\u0016\", \"\\\\u0017\", \"\\\\u0018\", \"\\\\u0019\", \"\\\\u001a\", \"\\\\u001b\", \"\\\\u001c\", \"\\\\u001d\", \"\\\\u001e\", \"\\\\u001f\"];\n\nvar escapeFn = function escapeFn(str) {\n return meta[str.charCodeAt(0)];\n};\n\nvar warned = false; // The assert module provides functions that throw\n// AssertionError's when particular conditions are not met. The\n// assert module must conform to the following interface.\n\nvar assert = module.exports = ok;\nvar NO_EXCEPTION_SENTINEL = {}; // All of the following functions must throw an AssertionError\n// when a corresponding condition is not met, with a message that\n// may be undefined if not provided. All assertion methods provide\n// both the actual and expected values to the assertion error for\n// display purposes.\n\nfunction innerFail(obj) {\n if (obj.message instanceof Error) throw obj.message;\n throw new AssertionError(obj);\n}\n\nfunction fail(actual, expected, message, operator, stackStartFn) {\n var argsLen = arguments.length;\n var internalMessage;\n\n if (argsLen === 0) {\n internalMessage = 'Failed';\n } else if (argsLen === 1) {\n message = actual;\n actual = undefined;\n } else {\n if (warned === false) {\n warned = true;\n var warn = process.emitWarning ? process.emitWarning : console.warn.bind(console);\n warn('assert.fail() with more than one argument is deprecated. ' + 'Please use assert.strictEqual() instead or only pass a message.', 'DeprecationWarning', 'DEP0094');\n }\n\n if (argsLen === 2) operator = '!=';\n }\n\n if (message instanceof Error) throw message;\n var errArgs = {\n actual: actual,\n expected: expected,\n operator: operator === undefined ? 'fail' : operator,\n stackStartFn: stackStartFn || fail\n };\n\n if (message !== undefined) {\n errArgs.message = message;\n }\n\n var err = new AssertionError(errArgs);\n\n if (internalMessage) {\n err.message = internalMessage;\n err.generatedMessage = true;\n }\n\n throw err;\n}\n\nassert.fail = fail; // The AssertionError is defined in internal/error.\n\nassert.AssertionError = AssertionError;\n\nfunction innerOk(fn, argLen, value, message) {\n if (!value) {\n var generatedMessage = false;\n\n if (argLen === 0) {\n generatedMessage = true;\n message = 'No value argument passed to `assert.ok()`';\n } else if (message instanceof Error) {\n throw message;\n }\n\n var err = new AssertionError({\n actual: value,\n expected: true,\n message: message,\n operator: '==',\n stackStartFn: fn\n });\n err.generatedMessage = generatedMessage;\n throw err;\n }\n} // Pure assertion tests whether a value is truthy, as determined\n// by !!value.\n\n\nfunction ok() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n innerOk.apply(void 0, [ok, args.length].concat(args));\n}\n\nassert.ok = ok; // The equality assertion tests shallow, coercive equality with ==.\n\n/* eslint-disable no-restricted-properties */\n\nassert.equal = function equal(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n } // eslint-disable-next-line eqeqeq\n\n\n if (actual != expected) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: '==',\n stackStartFn: equal\n });\n }\n}; // The non-equality assertion tests for whether two objects are not\n// equal with !=.\n\n\nassert.notEqual = function notEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n } // eslint-disable-next-line eqeqeq\n\n\n if (actual == expected) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: '!=',\n stackStartFn: notEqual\n });\n }\n}; // The equivalence assertion tests a deep equality relation.\n\n\nassert.deepEqual = function deepEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n\n if (!isDeepEqual(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'deepEqual',\n stackStartFn: deepEqual\n });\n }\n}; // The non-equivalence assertion tests for any deep inequality.\n\n\nassert.notDeepEqual = function notDeepEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n\n if (isDeepEqual(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'notDeepEqual',\n stackStartFn: notDeepEqual\n });\n }\n};\n/* eslint-enable */\n\n\nassert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n\n if (!isDeepStrictEqual(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'deepStrictEqual',\n stackStartFn: deepStrictEqual\n });\n }\n};\n\nassert.notDeepStrictEqual = notDeepStrictEqual;\n\nfunction notDeepStrictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n\n if (isDeepStrictEqual(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'notDeepStrictEqual',\n stackStartFn: notDeepStrictEqual\n });\n }\n}\n\nassert.strictEqual = function strictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (!objectIs(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'strictEqual',\n stackStartFn: strictEqual\n });\n }\n};\n\nassert.notStrictEqual = function notStrictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (objectIs(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'notStrictEqual',\n stackStartFn: notStrictEqual\n });\n }\n};\n\nvar Comparison = function Comparison(obj, keys, actual) {\n var _this = this;\n\n _classCallCheck(this, Comparison);\n\n keys.forEach(function (key) {\n if (key in obj) {\n if (actual !== undefined && typeof actual[key] === 'string' && isRegExp(obj[key]) && obj[key].test(actual[key])) {\n _this[key] = actual[key];\n } else {\n _this[key] = obj[key];\n }\n }\n });\n};\n\nfunction compareExceptionKey(actual, expected, key, message, keys, fn) {\n if (!(key in actual) || !isDeepStrictEqual(actual[key], expected[key])) {\n if (!message) {\n // Create placeholder objects to create a nice output.\n var a = new Comparison(actual, keys);\n var b = new Comparison(expected, keys, actual);\n var err = new AssertionError({\n actual: a,\n expected: b,\n operator: 'deepStrictEqual',\n stackStartFn: fn\n });\n err.actual = actual;\n err.expected = expected;\n err.operator = fn.name;\n throw err;\n }\n\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: fn.name,\n stackStartFn: fn\n });\n }\n}\n\nfunction expectedException(actual, expected, msg, fn) {\n if (typeof expected !== 'function') {\n if (isRegExp(expected)) return expected.test(actual); // assert.doesNotThrow does not accept objects.\n\n if (arguments.length === 2) {\n throw new ERR_INVALID_ARG_TYPE('expected', ['Function', 'RegExp'], expected);\n } // Handle primitives properly.\n\n\n if (_typeof(actual) !== 'object' || actual === null) {\n var err = new AssertionError({\n actual: actual,\n expected: expected,\n message: msg,\n operator: 'deepStrictEqual',\n stackStartFn: fn\n });\n err.operator = fn.name;\n throw err;\n }\n\n var keys = Object.keys(expected); // Special handle errors to make sure the name and the message are compared\n // as well.\n\n if (expected instanceof Error) {\n keys.push('name', 'message');\n } else if (keys.length === 0) {\n throw new ERR_INVALID_ARG_VALUE('error', expected, 'may not be an empty object');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n keys.forEach(function (key) {\n if (typeof actual[key] === 'string' && isRegExp(expected[key]) && expected[key].test(actual[key])) {\n return;\n }\n\n compareExceptionKey(actual, expected, key, msg, keys, fn);\n });\n return true;\n } // Guard instanceof against arrow functions as they don't have a prototype.\n\n\n if (expected.prototype !== undefined && actual instanceof expected) {\n return true;\n }\n\n if (Error.isPrototypeOf(expected)) {\n return false;\n }\n\n return expected.call({}, actual) === true;\n}\n\nfunction getActual(fn) {\n if (typeof fn !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn);\n }\n\n try {\n fn();\n } catch (e) {\n return e;\n }\n\n return NO_EXCEPTION_SENTINEL;\n}\n\nfunction checkIsPromise(obj) {\n // Accept native ES6 promises and promises that are implemented in a similar\n // way. Do not accept thenables that use a function as `obj` and that have no\n // `catch` handler.\n // TODO: thenables are checked up until they have the correct methods,\n // but according to documentation, the `then` method should receive\n // the `fulfill` and `reject` arguments as well or it may be never resolved.\n return isPromise(obj) || obj !== null && _typeof(obj) === 'object' && typeof obj.then === 'function' && typeof obj.catch === 'function';\n}\n\nfunction waitForActual(promiseFn) {\n return Promise.resolve().then(function () {\n var resultPromise;\n\n if (typeof promiseFn === 'function') {\n // Return a rejected promise if `promiseFn` throws synchronously.\n resultPromise = promiseFn(); // Fail in case no promise is returned.\n\n if (!checkIsPromise(resultPromise)) {\n throw new ERR_INVALID_RETURN_VALUE('instance of Promise', 'promiseFn', resultPromise);\n }\n } else if (checkIsPromise(promiseFn)) {\n resultPromise = promiseFn;\n } else {\n throw new ERR_INVALID_ARG_TYPE('promiseFn', ['Function', 'Promise'], promiseFn);\n }\n\n return Promise.resolve().then(function () {\n return resultPromise;\n }).then(function () {\n return NO_EXCEPTION_SENTINEL;\n }).catch(function (e) {\n return e;\n });\n });\n}\n\nfunction expectsError(stackStartFn, actual, error, message) {\n if (typeof error === 'string') {\n if (arguments.length === 4) {\n throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);\n }\n\n if (_typeof(actual) === 'object' && actual !== null) {\n if (actual.message === error) {\n throw new ERR_AMBIGUOUS_ARGUMENT('error/message', \"The error message \\\"\".concat(actual.message, \"\\\" is identical to the message.\"));\n }\n } else if (actual === error) {\n throw new ERR_AMBIGUOUS_ARGUMENT('error/message', \"The error \\\"\".concat(actual, \"\\\" is identical to the message.\"));\n }\n\n message = error;\n error = undefined;\n } else if (error != null && _typeof(error) !== 'object' && typeof error !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);\n }\n\n if (actual === NO_EXCEPTION_SENTINEL) {\n var details = '';\n\n if (error && error.name) {\n details += \" (\".concat(error.name, \")\");\n }\n\n details += message ? \": \".concat(message) : '.';\n var fnType = stackStartFn.name === 'rejects' ? 'rejection' : 'exception';\n innerFail({\n actual: undefined,\n expected: error,\n operator: stackStartFn.name,\n message: \"Missing expected \".concat(fnType).concat(details),\n stackStartFn: stackStartFn\n });\n }\n\n if (error && !expectedException(actual, error, message, stackStartFn)) {\n throw actual;\n }\n}\n\nfunction expectsNoError(stackStartFn, actual, error, message) {\n if (actual === NO_EXCEPTION_SENTINEL) return;\n\n if (typeof error === 'string') {\n message = error;\n error = undefined;\n }\n\n if (!error || expectedException(actual, error)) {\n var details = message ? \": \".concat(message) : '.';\n var fnType = stackStartFn.name === 'doesNotReject' ? 'rejection' : 'exception';\n innerFail({\n actual: actual,\n expected: error,\n operator: stackStartFn.name,\n message: \"Got unwanted \".concat(fnType).concat(details, \"\\n\") + \"Actual message: \\\"\".concat(actual && actual.message, \"\\\"\"),\n stackStartFn: stackStartFn\n });\n }\n\n throw actual;\n}\n\nassert.throws = function throws(promiseFn) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args));\n};\n\nassert.rejects = function rejects(promiseFn) {\n for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n args[_key3 - 1] = arguments[_key3];\n }\n\n return waitForActual(promiseFn).then(function (result) {\n return expectsError.apply(void 0, [rejects, result].concat(args));\n });\n};\n\nassert.doesNotThrow = function doesNotThrow(fn) {\n for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n args[_key4 - 1] = arguments[_key4];\n }\n\n expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args));\n};\n\nassert.doesNotReject = function doesNotReject(fn) {\n for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {\n args[_key5 - 1] = arguments[_key5];\n }\n\n return waitForActual(fn).then(function (result) {\n return expectsNoError.apply(void 0, [doesNotReject, result].concat(args));\n });\n};\n\nassert.ifError = function ifError(err) {\n if (err !== null && err !== undefined) {\n var message = 'ifError got unwanted exception: ';\n\n if (_typeof(err) === 'object' && typeof err.message === 'string') {\n if (err.message.length === 0 && err.constructor) {\n message += err.constructor.name;\n } else {\n message += err.message;\n }\n } else {\n message += inspect(err);\n }\n\n var newErr = new AssertionError({\n actual: err,\n expected: null,\n operator: 'ifError',\n message: message,\n stackStartFn: ifError\n }); // Make sure we actually have a stack trace!\n\n var origStack = err.stack;\n\n if (typeof origStack === 'string') {\n // This will remove any duplicated frames from the error frames taken\n // from within `ifError` and add the original error frames to the newly\n // created ones.\n var tmp2 = origStack.split('\\n');\n tmp2.shift(); // Filter all frames existing in err.stack.\n\n var tmp1 = newErr.stack.split('\\n');\n\n for (var i = 0; i < tmp2.length; i++) {\n // Find the first occurrence of the frame.\n var pos = tmp1.indexOf(tmp2[i]);\n\n if (pos !== -1) {\n // Only keep new frames.\n tmp1 = tmp1.slice(0, pos);\n break;\n }\n }\n\n newErr.stack = \"\".concat(tmp1.join('\\n'), \"\\n\").concat(tmp2.join('\\n'));\n }\n\n throw newErr;\n }\n}; // Expose a strict only variant of assert\n\n\nfunction strict() {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n\n innerOk.apply(void 0, [strict, args.length].concat(args));\n}\n\nassert.strict = objectAssign(strict, assert, {\n equal: assert.strictEqual,\n deepEqual: assert.deepStrictEqual,\n notEqual: assert.notStrictEqual,\n notDeepEqual: assert.notDeepStrictEqual\n});\nassert.strict.strict = assert.strict;","// Currently in sync with Node.js lib/internal/assert/assertion_error.js\n// https://github.com/nodejs/node/commit/0817840f775032169ddd70c85ac059f18ffcc81c\n'use strict';\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\n\nfunction isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar _require = require('util/'),\n inspect = _require.inspect;\n\nvar _require2 = require('../errors'),\n ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n\n\nfunction endsWith(str, search, this_len) {\n if (this_len === undefined || this_len > str.length) {\n this_len = str.length;\n }\n\n return str.substring(this_len - search.length, this_len) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat\n\n\nfunction repeat(str, count) {\n count = Math.floor(count);\n if (str.length == 0 || count == 0) return '';\n var maxCount = str.length * count;\n count = Math.floor(Math.log(count) / Math.log(2));\n\n while (count) {\n str += str;\n count--;\n }\n\n str += str.substring(0, maxCount - str.length);\n return str;\n}\n\nvar blue = '';\nvar green = '';\nvar red = '';\nvar white = '';\nvar kReadableOperator = {\n deepStrictEqual: 'Expected values to be strictly deep-equal:',\n strictEqual: 'Expected values to be strictly equal:',\n strictEqualObject: 'Expected \"actual\" to be reference-equal to \"expected\":',\n deepEqual: 'Expected values to be loosely deep-equal:',\n equal: 'Expected values to be loosely equal:',\n notDeepStrictEqual: 'Expected \"actual\" not to be strictly deep-equal to:',\n notStrictEqual: 'Expected \"actual\" to be strictly unequal to:',\n notStrictEqualObject: 'Expected \"actual\" not to be reference-equal to \"expected\":',\n notDeepEqual: 'Expected \"actual\" not to be loosely deep-equal to:',\n notEqual: 'Expected \"actual\" to be loosely unequal to:',\n notIdentical: 'Values identical but not reference-equal:'\n}; // Comparing short primitives should just show === / !== instead of using the\n// diff.\n\nvar kMaxShortLength = 10;\n\nfunction copyError(source) {\n var keys = Object.keys(source);\n var target = Object.create(Object.getPrototypeOf(source));\n keys.forEach(function (key) {\n target[key] = source[key];\n });\n Object.defineProperty(target, 'message', {\n value: source.message\n });\n return target;\n}\n\nfunction inspectValue(val) {\n // The util.inspect default values could be changed. This makes sure the\n // error messages contain the necessary information nevertheless.\n return inspect(val, {\n compact: false,\n customInspect: false,\n depth: 1000,\n maxArrayLength: Infinity,\n // Assert compares only enumerable properties (with a few exceptions).\n showHidden: false,\n // Having a long line as error is better than wrapping the line for\n // comparison for now.\n // TODO(BridgeAR): `breakLength` should be limited as soon as soon as we\n // have meta information about the inspected properties (i.e., know where\n // in what line the property starts and ends).\n breakLength: Infinity,\n // Assert does not detect proxies currently.\n showProxy: false,\n sorted: true,\n // Inspect getters as we also check them when comparing entries.\n getters: true\n });\n}\n\nfunction createErrDiff(actual, expected, operator) {\n var other = '';\n var res = '';\n var lastPos = 0;\n var end = '';\n var skipped = false;\n var actualInspected = inspectValue(actual);\n var actualLines = actualInspected.split('\\n');\n var expectedLines = inspectValue(expected).split('\\n');\n var i = 0;\n var indicator = ''; // In case both values are objects explicitly mark them as not reference equal\n // for the `strictEqual` operator.\n\n if (operator === 'strictEqual' && _typeof(actual) === 'object' && _typeof(expected) === 'object' && actual !== null && expected !== null) {\n operator = 'strictEqualObject';\n } // If \"actual\" and \"expected\" fit on a single line and they are not strictly\n // equal, check further special handling.\n\n\n if (actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) {\n var inputLength = actualLines[0].length + expectedLines[0].length; // If the character length of \"actual\" and \"expected\" together is less than\n // kMaxShortLength and if neither is an object and at least one of them is\n // not `zero`, use the strict equal comparison to visualize the output.\n\n if (inputLength <= kMaxShortLength) {\n if ((_typeof(actual) !== 'object' || actual === null) && (_typeof(expected) !== 'object' || expected === null) && (actual !== 0 || expected !== 0)) {\n // -0 === +0\n return \"\".concat(kReadableOperator[operator], \"\\n\\n\") + \"\".concat(actualLines[0], \" !== \").concat(expectedLines[0], \"\\n\");\n }\n } else if (operator !== 'strictEqualObject') {\n // If the stderr is a tty and the input length is lower than the current\n // columns per line, add a mismatch indicator below the output. If it is\n // not a tty, use a default value of 80 characters.\n var maxLength = process.stderr && process.stderr.isTTY ? process.stderr.columns : 80;\n\n if (inputLength < maxLength) {\n while (actualLines[0][i] === expectedLines[0][i]) {\n i++;\n } // Ignore the first characters.\n\n\n if (i > 2) {\n // Add position indicator for the first mismatch in case it is a\n // single line and the input length is less than the column length.\n indicator = \"\\n \".concat(repeat(' ', i), \"^\");\n i = 0;\n }\n }\n }\n } // Remove all ending lines that match (this optimizes the output for\n // readability by reducing the number of total changed lines).\n\n\n var a = actualLines[actualLines.length - 1];\n var b = expectedLines[expectedLines.length - 1];\n\n while (a === b) {\n if (i++ < 2) {\n end = \"\\n \".concat(a).concat(end);\n } else {\n other = a;\n }\n\n actualLines.pop();\n expectedLines.pop();\n if (actualLines.length === 0 || expectedLines.length === 0) break;\n a = actualLines[actualLines.length - 1];\n b = expectedLines[expectedLines.length - 1];\n }\n\n var maxLines = Math.max(actualLines.length, expectedLines.length); // Strict equal with identical objects that are not identical by reference.\n // E.g., assert.deepStrictEqual({ a: Symbol() }, { a: Symbol() })\n\n if (maxLines === 0) {\n // We have to get the result again. The lines were all removed before.\n var _actualLines = actualInspected.split('\\n'); // Only remove lines in case it makes sense to collapse those.\n // TODO: Accept env to always show the full error.\n\n\n if (_actualLines.length > 30) {\n _actualLines[26] = \"\".concat(blue, \"...\").concat(white);\n\n while (_actualLines.length > 27) {\n _actualLines.pop();\n }\n }\n\n return \"\".concat(kReadableOperator.notIdentical, \"\\n\\n\").concat(_actualLines.join('\\n'), \"\\n\");\n }\n\n if (i > 3) {\n end = \"\\n\".concat(blue, \"...\").concat(white).concat(end);\n skipped = true;\n }\n\n if (other !== '') {\n end = \"\\n \".concat(other).concat(end);\n other = '';\n }\n\n var printedLines = 0;\n var msg = kReadableOperator[operator] + \"\\n\".concat(green, \"+ actual\").concat(white, \" \").concat(red, \"- expected\").concat(white);\n var skippedMsg = \" \".concat(blue, \"...\").concat(white, \" Lines skipped\");\n\n for (i = 0; i < maxLines; i++) {\n // Only extra expected lines exist\n var cur = i - lastPos;\n\n if (actualLines.length < i + 1) {\n // If the last diverging line is more than one line above and the\n // current line is at least line three, add some of the former lines and\n // also add dots to indicate skipped entries.\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += \"\\n\".concat(blue, \"...\").concat(white);\n skipped = true;\n } else if (cur > 3) {\n res += \"\\n \".concat(expectedLines[i - 2]);\n printedLines++;\n }\n\n res += \"\\n \".concat(expectedLines[i - 1]);\n printedLines++;\n } // Mark the current line as the last diverging one.\n\n\n lastPos = i; // Add the expected line to the cache.\n\n other += \"\\n\".concat(red, \"-\").concat(white, \" \").concat(expectedLines[i]);\n printedLines++; // Only extra actual lines exist\n } else if (expectedLines.length < i + 1) {\n // If the last diverging line is more than one line above and the\n // current line is at least line three, add some of the former lines and\n // also add dots to indicate skipped entries.\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += \"\\n\".concat(blue, \"...\").concat(white);\n skipped = true;\n } else if (cur > 3) {\n res += \"\\n \".concat(actualLines[i - 2]);\n printedLines++;\n }\n\n res += \"\\n \".concat(actualLines[i - 1]);\n printedLines++;\n } // Mark the current line as the last diverging one.\n\n\n lastPos = i; // Add the actual line to the result.\n\n res += \"\\n\".concat(green, \"+\").concat(white, \" \").concat(actualLines[i]);\n printedLines++; // Lines diverge\n } else {\n var expectedLine = expectedLines[i];\n var actualLine = actualLines[i]; // If the lines diverge, specifically check for lines that only diverge by\n // a trailing comma. In that case it is actually identical and we should\n // mark it as such.\n\n var divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, ',') || actualLine.slice(0, -1) !== expectedLine); // If the expected line has a trailing comma but is otherwise identical,\n // add a comma at the end of the actual line. Otherwise the output could\n // look weird as in:\n //\n // [\n // 1 // No comma at the end!\n // + 2\n // ]\n //\n\n if (divergingLines && endsWith(expectedLine, ',') && expectedLine.slice(0, -1) === actualLine) {\n divergingLines = false;\n actualLine += ',';\n }\n\n if (divergingLines) {\n // If the last diverging line is more than one line above and the\n // current line is at least line three, add some of the former lines and\n // also add dots to indicate skipped entries.\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += \"\\n\".concat(blue, \"...\").concat(white);\n skipped = true;\n } else if (cur > 3) {\n res += \"\\n \".concat(actualLines[i - 2]);\n printedLines++;\n }\n\n res += \"\\n \".concat(actualLines[i - 1]);\n printedLines++;\n } // Mark the current line as the last diverging one.\n\n\n lastPos = i; // Add the actual line to the result and cache the expected diverging\n // line so consecutive diverging lines show up as +++--- and not +-+-+-.\n\n res += \"\\n\".concat(green, \"+\").concat(white, \" \").concat(actualLine);\n other += \"\\n\".concat(red, \"-\").concat(white, \" \").concat(expectedLine);\n printedLines += 2; // Lines are identical\n } else {\n // Add all cached information to the result before adding other things\n // and reset the cache.\n res += other;\n other = ''; // If the last diverging line is exactly one line above or if it is the\n // very first line, add the line to the result.\n\n if (cur === 1 || i === 0) {\n res += \"\\n \".concat(actualLine);\n printedLines++;\n }\n }\n } // Inspected object to big (Show ~20 rows max)\n\n\n if (printedLines > 20 && i < maxLines - 2) {\n return \"\".concat(msg).concat(skippedMsg, \"\\n\").concat(res, \"\\n\").concat(blue, \"...\").concat(white).concat(other, \"\\n\") + \"\".concat(blue, \"...\").concat(white);\n }\n }\n\n return \"\".concat(msg).concat(skipped ? skippedMsg : '', \"\\n\").concat(res).concat(other).concat(end).concat(indicator);\n}\n\nvar AssertionError =\n/*#__PURE__*/\nfunction (_Error) {\n _inherits(AssertionError, _Error);\n\n function AssertionError(options) {\n var _this;\n\n _classCallCheck(this, AssertionError);\n\n if (_typeof(options) !== 'object' || options === null) {\n throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);\n }\n\n var message = options.message,\n operator = options.operator,\n stackStartFn = options.stackStartFn;\n var actual = options.actual,\n expected = options.expected;\n var limit = Error.stackTraceLimit;\n Error.stackTraceLimit = 0;\n\n if (message != null) {\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, String(message)));\n } else {\n if (process.stderr && process.stderr.isTTY) {\n // Reset on each call to make sure we handle dynamically set environment\n // variables correct.\n if (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1) {\n blue = \"\\x1B[34m\";\n green = \"\\x1B[32m\";\n white = \"\\x1B[39m\";\n red = \"\\x1B[31m\";\n } else {\n blue = '';\n green = '';\n white = '';\n red = '';\n }\n } // Prevent the error stack from being visible by duplicating the error\n // in a very close way to the original in case both sides are actually\n // instances of Error.\n\n\n if (_typeof(actual) === 'object' && actual !== null && _typeof(expected) === 'object' && expected !== null && 'stack' in actual && actual instanceof Error && 'stack' in expected && expected instanceof Error) {\n actual = copyError(actual);\n expected = copyError(expected);\n }\n\n if (operator === 'deepStrictEqual' || operator === 'strictEqual') {\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, createErrDiff(actual, expected, operator)));\n } else if (operator === 'notDeepStrictEqual' || operator === 'notStrictEqual') {\n // In case the objects are equal but the operator requires unequal, show\n // the first object and say A equals B\n var base = kReadableOperator[operator];\n var res = inspectValue(actual).split('\\n'); // In case \"actual\" is an object, it should not be reference equal.\n\n if (operator === 'notStrictEqual' && _typeof(actual) === 'object' && actual !== null) {\n base = kReadableOperator.notStrictEqualObject;\n } // Only remove lines in case it makes sense to collapse those.\n // TODO: Accept env to always show the full error.\n\n\n if (res.length > 30) {\n res[26] = \"\".concat(blue, \"...\").concat(white);\n\n while (res.length > 27) {\n res.pop();\n }\n } // Only print a single input.\n\n\n if (res.length === 1) {\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, \"\".concat(base, \" \").concat(res[0])));\n } else {\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, \"\".concat(base, \"\\n\\n\").concat(res.join('\\n'), \"\\n\")));\n }\n } else {\n var _res = inspectValue(actual);\n\n var other = '';\n var knownOperators = kReadableOperator[operator];\n\n if (operator === 'notDeepEqual' || operator === 'notEqual') {\n _res = \"\".concat(kReadableOperator[operator], \"\\n\\n\").concat(_res);\n\n if (_res.length > 1024) {\n _res = \"\".concat(_res.slice(0, 1021), \"...\");\n }\n } else {\n other = \"\".concat(inspectValue(expected));\n\n if (_res.length > 512) {\n _res = \"\".concat(_res.slice(0, 509), \"...\");\n }\n\n if (other.length > 512) {\n other = \"\".concat(other.slice(0, 509), \"...\");\n }\n\n if (operator === 'deepEqual' || operator === 'equal') {\n _res = \"\".concat(knownOperators, \"\\n\\n\").concat(_res, \"\\n\\nshould equal\\n\\n\");\n } else {\n other = \" \".concat(operator, \" \").concat(other);\n }\n }\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, \"\".concat(_res).concat(other)));\n }\n }\n\n Error.stackTraceLimit = limit;\n _this.generatedMessage = !message;\n Object.defineProperty(_assertThisInitialized(_this), 'name', {\n value: 'AssertionError [ERR_ASSERTION]',\n enumerable: false,\n writable: true,\n configurable: true\n });\n _this.code = 'ERR_ASSERTION';\n _this.actual = actual;\n _this.expected = expected;\n _this.operator = operator;\n\n if (Error.captureStackTrace) {\n // eslint-disable-next-line no-restricted-syntax\n Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn);\n } // Create error message including the error code in the name.\n\n\n _this.stack; // Reset the name.\n\n _this.name = 'AssertionError';\n return _possibleConstructorReturn(_this);\n }\n\n _createClass(AssertionError, [{\n key: \"toString\",\n value: function toString() {\n return \"\".concat(this.name, \" [\").concat(this.code, \"]: \").concat(this.message);\n }\n }, {\n key: inspect.custom,\n value: function value(recurseTimes, ctx) {\n // This limits the `actual` and `expected` property default inspection to\n // the minimum depth. Otherwise those values would be too verbose compared\n // to the actual error message which contains a combined view of these two\n // input values.\n return inspect(this, _objectSpread({}, ctx, {\n customInspect: false,\n depth: 0\n }));\n }\n }]);\n\n return AssertionError;\n}(_wrapNativeSuper(Error));\n\nmodule.exports = AssertionError;","// Currently in sync with Node.js lib/internal/errors.js\n// https://github.com/nodejs/node/commit/3b044962c48fe313905877a96b5d0894a5404f6f\n\n/* eslint node-core/documented-errors: \"error\" */\n\n/* eslint node-core/alphabetize-errors: \"error\" */\n\n/* eslint node-core/prefer-util-format-errors: \"error\" */\n'use strict'; // The whole point behind this internal module is to allow Node.js to no\n// longer be forced to treat every error message change as a semver-major\n// change. The NodeError classes here all expose a `code` property whose\n// value statically and permanently identifies the error. While the error\n// message may change, the code should not.\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nvar codes = {}; // Lazy loaded\n\nvar assert;\nvar util;\n\nfunction createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === 'string') {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n\n var NodeError =\n /*#__PURE__*/\n function (_Base) {\n _inherits(NodeError, _Base);\n\n function NodeError(arg1, arg2, arg3) {\n var _this;\n\n _classCallCheck(this, NodeError);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError).call(this, getMessage(arg1, arg2, arg3)));\n _this.code = code;\n return _this;\n }\n\n return NodeError;\n }(Base);\n\n codes[code] = NodeError;\n} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js\n\n\nfunction oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function (i) {\n return String(i);\n });\n\n if (len > 2) {\n return \"one of \".concat(thing, \" \").concat(expected.slice(0, len - 1).join(', '), \", or \") + expected[len - 1];\n } else if (len === 2) {\n return \"one of \".concat(thing, \" \").concat(expected[0], \" or \").concat(expected[1]);\n } else {\n return \"of \".concat(thing, \" \").concat(expected[0]);\n }\n } else {\n return \"of \".concat(thing, \" \").concat(String(expected));\n }\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith\n\n\nfunction startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n\n\nfunction endsWith(str, search, this_len) {\n if (this_len === undefined || this_len > str.length) {\n this_len = str.length;\n }\n\n return str.substring(this_len - search.length, this_len) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes\n\n\nfunction includes(str, search, start) {\n if (typeof start !== 'number') {\n start = 0;\n }\n\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n}\n\ncreateErrorType('ERR_AMBIGUOUS_ARGUMENT', 'The \"%s\" argument is ambiguous. %s', TypeError);\ncreateErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {\n if (assert === undefined) assert = require('../assert');\n assert(typeof name === 'string', \"'name' must be a string\"); // determiner: 'must be' or 'must not be'\n\n var determiner;\n\n if (typeof expected === 'string' && startsWith(expected, 'not ')) {\n determiner = 'must not be';\n expected = expected.replace(/^not /, '');\n } else {\n determiner = 'must be';\n }\n\n var msg;\n\n if (endsWith(name, ' argument')) {\n // For cases like 'first argument'\n msg = \"The \".concat(name, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n } else {\n var type = includes(name, '.') ? 'property' : 'argument';\n msg = \"The \\\"\".concat(name, \"\\\" \").concat(type, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n } // TODO(BridgeAR): Improve the output by showing `null` and similar.\n\n\n msg += \". Received type \".concat(_typeof(actual));\n return msg;\n}, TypeError);\ncreateErrorType('ERR_INVALID_ARG_VALUE', function (name, value) {\n var reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'is invalid';\n if (util === undefined) util = require('util/');\n var inspected = util.inspect(value);\n\n if (inspected.length > 128) {\n inspected = \"\".concat(inspected.slice(0, 128), \"...\");\n }\n\n return \"The argument '\".concat(name, \"' \").concat(reason, \". Received \").concat(inspected);\n}, TypeError, RangeError);\ncreateErrorType('ERR_INVALID_RETURN_VALUE', function (input, name, value) {\n var type;\n\n if (value && value.constructor && value.constructor.name) {\n type = \"instance of \".concat(value.constructor.name);\n } else {\n type = \"type \".concat(_typeof(value));\n }\n\n return \"Expected \".concat(input, \" to be returned from the \\\"\").concat(name, \"\\\"\") + \" function but got \".concat(type, \".\");\n}, TypeError);\ncreateErrorType('ERR_MISSING_ARGS', function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (assert === undefined) assert = require('../assert');\n assert(args.length > 0, 'At least one arg needs to be specified');\n var msg = 'The ';\n var len = args.length;\n args = args.map(function (a) {\n return \"\\\"\".concat(a, \"\\\"\");\n });\n\n switch (len) {\n case 1:\n msg += \"\".concat(args[0], \" argument\");\n break;\n\n case 2:\n msg += \"\".concat(args[0], \" and \").concat(args[1], \" arguments\");\n break;\n\n default:\n msg += args.slice(0, len - 1).join(', ');\n msg += \", and \".concat(args[len - 1], \" arguments\");\n break;\n }\n\n return \"\".concat(msg, \" must be specified\");\n}, TypeError);\nmodule.exports.codes = codes;","// Currently in sync with Node.js lib/internal/util/comparisons.js\n// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9\n'use strict';\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar regexFlagsSupported = /a/g.flags !== undefined;\n\nvar arrayFromSet = function arrayFromSet(set) {\n var array = [];\n set.forEach(function (value) {\n return array.push(value);\n });\n return array;\n};\n\nvar arrayFromMap = function arrayFromMap(map) {\n var array = [];\n map.forEach(function (value, key) {\n return array.push([key, value]);\n });\n return array;\n};\n\nvar objectIs = Object.is ? Object.is : require('object-is');\nvar objectGetOwnPropertySymbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols : function () {\n return [];\n};\nvar numberIsNaN = Number.isNaN ? Number.isNaN : require('is-nan');\n\nfunction uncurryThis(f) {\n return f.call.bind(f);\n}\n\nvar hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);\nvar propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable);\nvar objectToString = uncurryThis(Object.prototype.toString);\n\nvar _require$types = require('util/').types,\n isAnyArrayBuffer = _require$types.isAnyArrayBuffer,\n isArrayBufferView = _require$types.isArrayBufferView,\n isDate = _require$types.isDate,\n isMap = _require$types.isMap,\n isRegExp = _require$types.isRegExp,\n isSet = _require$types.isSet,\n isNativeError = _require$types.isNativeError,\n isBoxedPrimitive = _require$types.isBoxedPrimitive,\n isNumberObject = _require$types.isNumberObject,\n isStringObject = _require$types.isStringObject,\n isBooleanObject = _require$types.isBooleanObject,\n isBigIntObject = _require$types.isBigIntObject,\n isSymbolObject = _require$types.isSymbolObject,\n isFloat32Array = _require$types.isFloat32Array,\n isFloat64Array = _require$types.isFloat64Array;\n\nfunction isNonIndex(key) {\n if (key.length === 0 || key.length > 10) return true;\n\n for (var i = 0; i < key.length; i++) {\n var code = key.charCodeAt(i);\n if (code < 48 || code > 57) return true;\n } // The maximum size for an array is 2 ** 32 -1.\n\n\n return key.length === 10 && key >= Math.pow(2, 32);\n}\n\nfunction getOwnNonIndexProperties(value) {\n return Object.keys(value).filter(isNonIndex).concat(objectGetOwnPropertySymbols(value).filter(Object.prototype.propertyIsEnumerable.bind(value)));\n} // Taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js\n// original notice:\n\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\n\nfunction compare(a, b) {\n if (a === b) {\n return 0;\n }\n\n var x = a.length;\n var y = b.length;\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break;\n }\n }\n\n if (x < y) {\n return -1;\n }\n\n if (y < x) {\n return 1;\n }\n\n return 0;\n}\n\nvar ONLY_ENUMERABLE = undefined;\nvar kStrict = true;\nvar kLoose = false;\nvar kNoIterator = 0;\nvar kIsArray = 1;\nvar kIsSet = 2;\nvar kIsMap = 3; // Check if they have the same source and flags\n\nfunction areSimilarRegExps(a, b) {\n return regexFlagsSupported ? a.source === b.source && a.flags === b.flags : RegExp.prototype.toString.call(a) === RegExp.prototype.toString.call(b);\n}\n\nfunction areSimilarFloatArrays(a, b) {\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n\n for (var offset = 0; offset < a.byteLength; offset++) {\n if (a[offset] !== b[offset]) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction areSimilarTypedArrays(a, b) {\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n\n return compare(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)) === 0;\n}\n\nfunction areEqualArrayBuffers(buf1, buf2) {\n return buf1.byteLength === buf2.byteLength && compare(new Uint8Array(buf1), new Uint8Array(buf2)) === 0;\n}\n\nfunction isEqualBoxedPrimitive(val1, val2) {\n if (isNumberObject(val1)) {\n return isNumberObject(val2) && objectIs(Number.prototype.valueOf.call(val1), Number.prototype.valueOf.call(val2));\n }\n\n if (isStringObject(val1)) {\n return isStringObject(val2) && String.prototype.valueOf.call(val1) === String.prototype.valueOf.call(val2);\n }\n\n if (isBooleanObject(val1)) {\n return isBooleanObject(val2) && Boolean.prototype.valueOf.call(val1) === Boolean.prototype.valueOf.call(val2);\n }\n\n if (isBigIntObject(val1)) {\n return isBigIntObject(val2) && BigInt.prototype.valueOf.call(val1) === BigInt.prototype.valueOf.call(val2);\n }\n\n return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2);\n} // Notes: Type tags are historical [[Class]] properties that can be set by\n// FunctionTemplate::SetClassName() in C++ or Symbol.toStringTag in JS\n// and retrieved using Object.prototype.toString.call(obj) in JS\n// See https://tc39.github.io/ecma262/#sec-object.prototype.tostring\n// for a list of tags pre-defined in the spec.\n// There are some unspecified tags in the wild too (e.g. typed array tags).\n// Since tags can be altered, they only serve fast failures\n//\n// Typed arrays and buffers are checked by comparing the content in their\n// underlying ArrayBuffer. This optimization requires that it's\n// reasonable to interpret their underlying memory in the same way,\n// which is checked by comparing their type tags.\n// (e.g. a Uint8Array and a Uint16Array with the same memory content\n// could still be different because they will be interpreted differently).\n//\n// For strict comparison, objects should have\n// a) The same built-in type tags\n// b) The same prototypes.\n\n\nfunction innerDeepEqual(val1, val2, strict, memos) {\n // All identical values are equivalent, as determined by ===.\n if (val1 === val2) {\n if (val1 !== 0) return true;\n return strict ? objectIs(val1, val2) : true;\n } // Check more closely if val1 and val2 are equal.\n\n\n if (strict) {\n if (_typeof(val1) !== 'object') {\n return typeof val1 === 'number' && numberIsNaN(val1) && numberIsNaN(val2);\n }\n\n if (_typeof(val2) !== 'object' || val1 === null || val2 === null) {\n return false;\n }\n\n if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) {\n return false;\n }\n } else {\n if (val1 === null || _typeof(val1) !== 'object') {\n if (val2 === null || _typeof(val2) !== 'object') {\n // eslint-disable-next-line eqeqeq\n return val1 == val2;\n }\n\n return false;\n }\n\n if (val2 === null || _typeof(val2) !== 'object') {\n return false;\n }\n }\n\n var val1Tag = objectToString(val1);\n var val2Tag = objectToString(val2);\n\n if (val1Tag !== val2Tag) {\n return false;\n }\n\n if (Array.isArray(val1)) {\n // Check for sparse arrays and general fast path\n if (val1.length !== val2.length) {\n return false;\n }\n\n var keys1 = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);\n var keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);\n\n if (keys1.length !== keys2.length) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kIsArray, keys1);\n } // [browserify] This triggers on certain types in IE (Map/Set) so we don't\n // wan't to early return out of the rest of the checks. However we can check\n // if the second value is one of these values and the first isn't.\n\n\n if (val1Tag === '[object Object]') {\n // return keyCheck(val1, val2, strict, memos, kNoIterator);\n if (!isMap(val1) && isMap(val2) || !isSet(val1) && isSet(val2)) {\n return false;\n }\n }\n\n if (isDate(val1)) {\n if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) {\n return false;\n }\n } else if (isRegExp(val1)) {\n if (!isRegExp(val2) || !areSimilarRegExps(val1, val2)) {\n return false;\n }\n } else if (isNativeError(val1) || val1 instanceof Error) {\n // Do not compare the stack as it might differ even though the error itself\n // is otherwise identical.\n if (val1.message !== val2.message || val1.name !== val2.name) {\n return false;\n }\n } else if (isArrayBufferView(val1)) {\n if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) {\n if (!areSimilarFloatArrays(val1, val2)) {\n return false;\n }\n } else if (!areSimilarTypedArrays(val1, val2)) {\n return false;\n } // Buffer.compare returns true, so val1.length === val2.length. If they both\n // only contain numeric keys, we don't need to exam further than checking\n // the symbols.\n\n\n var _keys = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);\n\n var _keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);\n\n if (_keys.length !== _keys2.length) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kNoIterator, _keys);\n } else if (isSet(val1)) {\n if (!isSet(val2) || val1.size !== val2.size) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kIsSet);\n } else if (isMap(val1)) {\n if (!isMap(val2) || val1.size !== val2.size) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kIsMap);\n } else if (isAnyArrayBuffer(val1)) {\n if (!areEqualArrayBuffers(val1, val2)) {\n return false;\n }\n } else if (isBoxedPrimitive(val1) && !isEqualBoxedPrimitive(val1, val2)) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kNoIterator);\n}\n\nfunction getEnumerables(val, keys) {\n return keys.filter(function (k) {\n return propertyIsEnumerable(val, k);\n });\n}\n\nfunction keyCheck(val1, val2, strict, memos, iterationType, aKeys) {\n // For all remaining Object pairs, including Array, objects and Maps,\n // equivalence is determined by having:\n // a) The same number of owned enumerable properties\n // b) The same set of keys/indexes (although not necessarily the same order)\n // c) Equivalent values for every corresponding key/index\n // d) For Sets and Maps, equal contents\n // Note: this accounts for both named and indexed properties on Arrays.\n if (arguments.length === 5) {\n aKeys = Object.keys(val1);\n var bKeys = Object.keys(val2); // The pair must have the same number of owned properties.\n\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n } // Cheap key test\n\n\n var i = 0;\n\n for (; i < aKeys.length; i++) {\n if (!hasOwnProperty(val2, aKeys[i])) {\n return false;\n }\n }\n\n if (strict && arguments.length === 5) {\n var symbolKeysA = objectGetOwnPropertySymbols(val1);\n\n if (symbolKeysA.length !== 0) {\n var count = 0;\n\n for (i = 0; i < symbolKeysA.length; i++) {\n var key = symbolKeysA[i];\n\n if (propertyIsEnumerable(val1, key)) {\n if (!propertyIsEnumerable(val2, key)) {\n return false;\n }\n\n aKeys.push(key);\n count++;\n } else if (propertyIsEnumerable(val2, key)) {\n return false;\n }\n }\n\n var symbolKeysB = objectGetOwnPropertySymbols(val2);\n\n if (symbolKeysA.length !== symbolKeysB.length && getEnumerables(val2, symbolKeysB).length !== count) {\n return false;\n }\n } else {\n var _symbolKeysB = objectGetOwnPropertySymbols(val2);\n\n if (_symbolKeysB.length !== 0 && getEnumerables(val2, _symbolKeysB).length !== 0) {\n return false;\n }\n }\n }\n\n if (aKeys.length === 0 && (iterationType === kNoIterator || iterationType === kIsArray && val1.length === 0 || val1.size === 0)) {\n return true;\n } // Use memos to handle cycles.\n\n\n if (memos === undefined) {\n memos = {\n val1: new Map(),\n val2: new Map(),\n position: 0\n };\n } else {\n // We prevent up to two map.has(x) calls by directly retrieving the value\n // and checking for undefined. The map can only contain numbers, so it is\n // safe to check for undefined only.\n var val2MemoA = memos.val1.get(val1);\n\n if (val2MemoA !== undefined) {\n var val2MemoB = memos.val2.get(val2);\n\n if (val2MemoB !== undefined) {\n return val2MemoA === val2MemoB;\n }\n }\n\n memos.position++;\n }\n\n memos.val1.set(val1, memos.position);\n memos.val2.set(val2, memos.position);\n var areEq = objEquiv(val1, val2, strict, aKeys, memos, iterationType);\n memos.val1.delete(val1);\n memos.val2.delete(val2);\n return areEq;\n}\n\nfunction setHasEqualElement(set, val1, strict, memo) {\n // Go looking.\n var setValues = arrayFromSet(set);\n\n for (var i = 0; i < setValues.length; i++) {\n var val2 = setValues[i];\n\n if (innerDeepEqual(val1, val2, strict, memo)) {\n // Remove the matching element to make sure we do not check that again.\n set.delete(val2);\n return true;\n }\n }\n\n return false;\n} // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Loose_equality_using\n// Sadly it is not possible to detect corresponding values properly in case the\n// type is a string, number, bigint or boolean. The reason is that those values\n// can match lots of different string values (e.g., 1n == '+00001').\n\n\nfunction findLooseMatchingPrimitives(prim) {\n switch (_typeof(prim)) {\n case 'undefined':\n return null;\n\n case 'object':\n // Only pass in null as object!\n return undefined;\n\n case 'symbol':\n return false;\n\n case 'string':\n prim = +prim;\n // Loose equal entries exist only if the string is possible to convert to\n // a regular number and not NaN.\n // Fall through\n\n case 'number':\n if (numberIsNaN(prim)) {\n return false;\n }\n\n }\n\n return true;\n}\n\nfunction setMightHaveLoosePrim(a, b, prim) {\n var altValue = findLooseMatchingPrimitives(prim);\n if (altValue != null) return altValue;\n return b.has(altValue) && !a.has(altValue);\n}\n\nfunction mapMightHaveLoosePrim(a, b, prim, item, memo) {\n var altValue = findLooseMatchingPrimitives(prim);\n\n if (altValue != null) {\n return altValue;\n }\n\n var curB = b.get(altValue);\n\n if (curB === undefined && !b.has(altValue) || !innerDeepEqual(item, curB, false, memo)) {\n return false;\n }\n\n return !a.has(altValue) && innerDeepEqual(item, curB, false, memo);\n}\n\nfunction setEquiv(a, b, strict, memo) {\n // This is a lazily initiated Set of entries which have to be compared\n // pairwise.\n var set = null;\n var aValues = arrayFromSet(a);\n\n for (var i = 0; i < aValues.length; i++) {\n var val = aValues[i]; // Note: Checking for the objects first improves the performance for object\n // heavy sets but it is a minor slow down for primitives. As they are fast\n // to check this improves the worst case scenario instead.\n\n if (_typeof(val) === 'object' && val !== null) {\n if (set === null) {\n set = new Set();\n } // If the specified value doesn't exist in the second set its an not null\n // object (or non strict only: a not matching primitive) we'll need to go\n // hunting for something thats deep-(strict-)equal to it. To make this\n // O(n log n) complexity we have to copy these values in a new set first.\n\n\n set.add(val);\n } else if (!b.has(val)) {\n if (strict) return false; // Fast path to detect missing string, symbol, undefined and null values.\n\n if (!setMightHaveLoosePrim(a, b, val)) {\n return false;\n }\n\n if (set === null) {\n set = new Set();\n }\n\n set.add(val);\n }\n }\n\n if (set !== null) {\n var bValues = arrayFromSet(b);\n\n for (var _i = 0; _i < bValues.length; _i++) {\n var _val = bValues[_i]; // We have to check if a primitive value is already\n // matching and only if it's not, go hunting for it.\n\n if (_typeof(_val) === 'object' && _val !== null) {\n if (!setHasEqualElement(set, _val, strict, memo)) return false;\n } else if (!strict && !a.has(_val) && !setHasEqualElement(set, _val, strict, memo)) {\n return false;\n }\n }\n\n return set.size === 0;\n }\n\n return true;\n}\n\nfunction mapHasEqualEntry(set, map, key1, item1, strict, memo) {\n // To be able to handle cases like:\n // Map([[{}, 'a'], [{}, 'b']]) vs Map([[{}, 'b'], [{}, 'a']])\n // ... we need to consider *all* matching keys, not just the first we find.\n var setValues = arrayFromSet(set);\n\n for (var i = 0; i < setValues.length; i++) {\n var key2 = setValues[i];\n\n if (innerDeepEqual(key1, key2, strict, memo) && innerDeepEqual(item1, map.get(key2), strict, memo)) {\n set.delete(key2);\n return true;\n }\n }\n\n return false;\n}\n\nfunction mapEquiv(a, b, strict, memo) {\n var set = null;\n var aEntries = arrayFromMap(a);\n\n for (var i = 0; i < aEntries.length; i++) {\n var _aEntries$i = _slicedToArray(aEntries[i], 2),\n key = _aEntries$i[0],\n item1 = _aEntries$i[1];\n\n if (_typeof(key) === 'object' && key !== null) {\n if (set === null) {\n set = new Set();\n }\n\n set.add(key);\n } else {\n // By directly retrieving the value we prevent another b.has(key) check in\n // almost all possible cases.\n var item2 = b.get(key);\n\n if (item2 === undefined && !b.has(key) || !innerDeepEqual(item1, item2, strict, memo)) {\n if (strict) return false; // Fast path to detect missing string, symbol, undefined and null\n // keys.\n\n if (!mapMightHaveLoosePrim(a, b, key, item1, memo)) return false;\n\n if (set === null) {\n set = new Set();\n }\n\n set.add(key);\n }\n }\n }\n\n if (set !== null) {\n var bEntries = arrayFromMap(b);\n\n for (var _i2 = 0; _i2 < bEntries.length; _i2++) {\n var _bEntries$_i = _slicedToArray(bEntries[_i2], 2),\n key = _bEntries$_i[0],\n item = _bEntries$_i[1];\n\n if (_typeof(key) === 'object' && key !== null) {\n if (!mapHasEqualEntry(set, a, key, item, strict, memo)) return false;\n } else if (!strict && (!a.has(key) || !innerDeepEqual(a.get(key), item, false, memo)) && !mapHasEqualEntry(set, a, key, item, false, memo)) {\n return false;\n }\n }\n\n return set.size === 0;\n }\n\n return true;\n}\n\nfunction objEquiv(a, b, strict, keys, memos, iterationType) {\n // Sets and maps don't have their entries accessible via normal object\n // properties.\n var i = 0;\n\n if (iterationType === kIsSet) {\n if (!setEquiv(a, b, strict, memos)) {\n return false;\n }\n } else if (iterationType === kIsMap) {\n if (!mapEquiv(a, b, strict, memos)) {\n return false;\n }\n } else if (iterationType === kIsArray) {\n for (; i < a.length; i++) {\n if (hasOwnProperty(a, i)) {\n if (!hasOwnProperty(b, i) || !innerDeepEqual(a[i], b[i], strict, memos)) {\n return false;\n }\n } else if (hasOwnProperty(b, i)) {\n return false;\n } else {\n // Array is sparse.\n var keysA = Object.keys(a);\n\n for (; i < keysA.length; i++) {\n var key = keysA[i];\n\n if (!hasOwnProperty(b, key) || !innerDeepEqual(a[key], b[key], strict, memos)) {\n return false;\n }\n }\n\n if (keysA.length !== Object.keys(b).length) {\n return false;\n }\n\n return true;\n }\n }\n } // The pair must have equivalent values for every corresponding key.\n // Possibly expensive deep test:\n\n\n for (i = 0; i < keys.length; i++) {\n var _key = keys[i];\n\n if (!innerDeepEqual(a[_key], b[_key], strict, memos)) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction isDeepEqual(val1, val2) {\n return innerDeepEqual(val1, val2, kLoose);\n}\n\nfunction isDeepStrictEqual(val1, val2) {\n return innerDeepEqual(val1, val2, kStrict);\n}\n\nmodule.exports = {\n isDeepEqual: isDeepEqual,\n isDeepStrictEqual: isDeepStrictEqual\n};","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar callBind = require('./');\n\nvar $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));\n\nmodule.exports = function callBoundIntrinsic(name, allowMissing) {\n\tvar intrinsic = GetIntrinsic(name, !!allowMissing);\n\tif (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {\n\t\treturn callBind(intrinsic);\n\t}\n\treturn intrinsic;\n};\n","'use strict';\n\nvar bind = require('function-bind');\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $apply = GetIntrinsic('%Function.prototype.apply%');\nvar $call = GetIntrinsic('%Function.prototype.call%');\nvar $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\nvar $defineProperty = GetIntrinsic('%Object.defineProperty%', true);\nvar $max = GetIntrinsic('%Math.max%');\n\nif ($defineProperty) {\n\ttry {\n\t\t$defineProperty({}, 'a', { value: 1 });\n\t} catch (e) {\n\t\t// IE 8 has a broken defineProperty\n\t\t$defineProperty = null;\n\t}\n}\n\nmodule.exports = function callBind(originalFunction) {\n\tvar func = $reflectApply(bind, $call, arguments);\n\tif ($gOPD && $defineProperty) {\n\t\tvar desc = $gOPD(func, 'length');\n\t\tif (desc.configurable) {\n\t\t\t// original length, plus the receiver, minus any additional arguments (after the receiver)\n\t\t\t$defineProperty(\n\t\t\t\tfunc,\n\t\t\t\t'length',\n\t\t\t\t{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }\n\t\t\t);\n\t\t}\n\t}\n\treturn func;\n};\n\nvar applyBind = function applyBind() {\n\treturn $reflectApply(bind, $apply, arguments);\n};\n\nif ($defineProperty) {\n\t$defineProperty(module.exports, 'apply', { value: applyBind });\n} else {\n\tmodule.exports.apply = applyBind;\n}\n","/*global window, global*/\nvar util = require(\"util\")\nvar assert = require(\"assert\")\nfunction now() { return new Date().getTime() }\n\nvar slice = Array.prototype.slice\nvar console\nvar times = {}\n\nif (typeof global !== \"undefined\" && global.console) {\n console = global.console\n} else if (typeof window !== \"undefined\" && window.console) {\n console = window.console\n} else {\n console = {}\n}\n\nvar functions = [\n [log, \"log\"],\n [info, \"info\"],\n [warn, \"warn\"],\n [error, \"error\"],\n [time, \"time\"],\n [timeEnd, \"timeEnd\"],\n [trace, \"trace\"],\n [dir, \"dir\"],\n [consoleAssert, \"assert\"]\n]\n\nfor (var i = 0; i < functions.length; i++) {\n var tuple = functions[i]\n var f = tuple[0]\n var name = tuple[1]\n\n if (!console[name]) {\n console[name] = f\n }\n}\n\nmodule.exports = console\n\nfunction log() {}\n\nfunction info() {\n console.log.apply(console, arguments)\n}\n\nfunction warn() {\n console.log.apply(console, arguments)\n}\n\nfunction error() {\n console.warn.apply(console, arguments)\n}\n\nfunction time(label) {\n times[label] = now()\n}\n\nfunction timeEnd(label) {\n var time = times[label]\n if (!time) {\n throw new Error(\"No such label: \" + label)\n }\n\n delete times[label]\n var duration = now() - time\n console.log(label + \": \" + duration + \"ms\")\n}\n\nfunction trace() {\n var err = new Error()\n err.name = \"Trace\"\n err.message = util.format.apply(null, arguments)\n console.error(err.stack)\n}\n\nfunction dir(object) {\n console.log(util.inspect(object) + \"\\n\")\n}\n\nfunction consoleAssert(expression) {\n if (!expression) {\n var arr = slice.call(arguments, 1)\n assert.ok(false, util.format.apply(null, arr))\n }\n}\n","var global = typeof self !== 'undefined' ? self : this;\nvar __self__ = (function () {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = global.DOMException\n}\nF.prototype = global;\nreturn new F();\n})();\n(function(self) {\n\nvar irrelevant = (function (exports) {\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob:\n 'FileReader' in self &&\n 'Blob' in self &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n };\n\n function isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue + ', ' + value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push(name);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) {\n items.push(value);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push([name, value]);\n });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsText(blob);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n this._bodyInit = body;\n if (!body) {\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n this._bodyText = body = Object.prototype.toString.call(body);\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n };\n }\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return methods.indexOf(upcased) > -1 ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n this.signal = input.signal;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.signal = options.signal || this.signal;\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n }\n\n Request.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n };\n\n function decode(body) {\n var form = new FormData();\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n headers.append(key, value);\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = 'statusText' in options ? options.statusText : 'OK';\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''});\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n exports.DOMException = self.DOMException;\n try {\n new exports.DOMException();\n } catch (err) {\n exports.DOMException = function(message, name) {\n this.message = message;\n this.name = name;\n var error = Error(message);\n this.stack = error.stack;\n };\n exports.DOMException.prototype = Object.create(Error.prototype);\n exports.DOMException.prototype.constructor = exports.DOMException;\n }\n\n function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n\n if (request.signal && request.signal.aborted) {\n return reject(new exports.DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest();\n\n function abortXhr() {\n xhr.abort();\n }\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n resolve(new Response(body, options));\n };\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.onabort = function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n };\n\n xhr.open(request.method, request.url, true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob';\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr);\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr);\n }\n };\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n }\n\n fetch.polyfill = true;\n\n if (!self.fetch) {\n self.fetch = fetch;\n self.Headers = Headers;\n self.Request = Request;\n self.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n return exports;\n\n})({});\n})(__self__);\n__self__.fetch.ponyfill = true;\n// Remove \"polyfill\" property added by whatwg-fetch\ndelete __self__.fetch.polyfill;\n// Choose between native implementation (global) or custom implementation (__self__)\n// var ctx = global.fetch ? global : __self__;\nvar ctx = __self__; // this line disable service worker support temporarily\nexports = ctx.fetch // To enable: import fetch from 'cross-fetch'\nexports.default = ctx.fetch // For TypeScript consumers without esModuleInterop.\nexports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'\nexports.Headers = ctx.Headers\nexports.Request = ctx.Request\nexports.Response = ctx.Response\nmodule.exports = exports\n","'use strict';\n\nvar keys = require('object-keys');\nvar hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';\n\nvar toStr = Object.prototype.toString;\nvar concat = Array.prototype.concat;\nvar origDefineProperty = Object.defineProperty;\n\nvar isFunction = function (fn) {\n\treturn typeof fn === 'function' && toStr.call(fn) === '[object Function]';\n};\n\nvar hasPropertyDescriptors = require('has-property-descriptors')();\n\nvar supportsDescriptors = origDefineProperty && hasPropertyDescriptors;\n\nvar defineProperty = function (object, name, value, predicate) {\n\tif (name in object && (!isFunction(predicate) || !predicate())) {\n\t\treturn;\n\t}\n\tif (supportsDescriptors) {\n\t\torigDefineProperty(object, name, {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: value,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\tobject[name] = value; // eslint-disable-line no-param-reassign\n\t}\n};\n\nvar defineProperties = function (object, map) {\n\tvar predicates = arguments.length > 2 ? arguments[2] : {};\n\tvar props = keys(map);\n\tif (hasSymbols) {\n\t\tprops = concat.call(props, Object.getOwnPropertySymbols(map));\n\t}\n\tfor (var i = 0; i < props.length; i += 1) {\n\t\tdefineProperty(object, props[i], map[props[i]], predicates[props[i]]);\n\t}\n};\n\ndefineProperties.supportsDescriptors = !!supportsDescriptors;\n\nmodule.exports = defineProperties;\n","/**\n * Code refactored from Mozilla Developer Network:\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n */\n\n'use strict';\n\nfunction assign(target, firstSource) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert first argument to object');\n }\n\n var to = Object(target);\n for (var i = 1; i < arguments.length; i++) {\n var nextSource = arguments[i];\n if (nextSource === undefined || nextSource === null) {\n continue;\n }\n\n var keysArray = Object.keys(Object(nextSource));\n for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {\n var nextKey = keysArray[nextIndex];\n var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);\n if (desc !== undefined && desc.enumerable) {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n return to;\n}\n\nfunction polyfill() {\n if (!Object.assign) {\n Object.defineProperty(Object, 'assign', {\n enumerable: false,\n configurable: true,\n writable: true,\n value: assign\n });\n }\n}\n\nmodule.exports = {\n assign: assign,\n polyfill: polyfill\n};\n","'use strict';\n\nvar isCallable = require('is-callable');\n\nvar toStr = Object.prototype.toString;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar forEachArray = function forEachArray(array, iterator, receiver) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (hasOwnProperty.call(array, i)) {\n if (receiver == null) {\n iterator(array[i], i, array);\n } else {\n iterator.call(receiver, array[i], i, array);\n }\n }\n }\n};\n\nvar forEachString = function forEachString(string, iterator, receiver) {\n for (var i = 0, len = string.length; i < len; i++) {\n // no such thing as a sparse string.\n if (receiver == null) {\n iterator(string.charAt(i), i, string);\n } else {\n iterator.call(receiver, string.charAt(i), i, string);\n }\n }\n};\n\nvar forEachObject = function forEachObject(object, iterator, receiver) {\n for (var k in object) {\n if (hasOwnProperty.call(object, k)) {\n if (receiver == null) {\n iterator(object[k], k, object);\n } else {\n iterator.call(receiver, object[k], k, object);\n }\n }\n }\n};\n\nvar forEach = function forEach(list, iterator, thisArg) {\n if (!isCallable(iterator)) {\n throw new TypeError('iterator must be a function');\n }\n\n var receiver;\n if (arguments.length >= 3) {\n receiver = thisArg;\n }\n\n if (toStr.call(list) === '[object Array]') {\n forEachArray(list, iterator, receiver);\n } else if (typeof list === 'string') {\n forEachString(list, iterator, receiver);\n } else {\n forEachObject(list, iterator, receiver);\n }\n};\n\nmodule.exports = forEach;\n","'use strict';\n\n/* eslint no-invalid-this: 1 */\n\nvar ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';\nvar slice = Array.prototype.slice;\nvar toStr = Object.prototype.toString;\nvar funcType = '[object Function]';\n\nmodule.exports = function bind(that) {\n var target = this;\n if (typeof target !== 'function' || toStr.call(target) !== funcType) {\n throw new TypeError(ERROR_MESSAGE + target);\n }\n var args = slice.call(arguments, 1);\n\n var bound;\n var binder = function () {\n if (this instanceof bound) {\n var result = target.apply(\n this,\n args.concat(slice.call(arguments))\n );\n if (Object(result) === result) {\n return result;\n }\n return this;\n } else {\n return target.apply(\n that,\n args.concat(slice.call(arguments))\n );\n }\n };\n\n var boundLength = Math.max(0, target.length - args.length);\n var boundArgs = [];\n for (var i = 0; i < boundLength; i++) {\n boundArgs.push('$' + i);\n }\n\n bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);\n\n if (target.prototype) {\n var Empty = function Empty() {};\n Empty.prototype = target.prototype;\n bound.prototype = new Empty();\n Empty.prototype = null;\n }\n\n return bound;\n};\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = Function.prototype.bind || implementation;\n","'use strict';\n\nvar undefined;\n\nvar $SyntaxError = SyntaxError;\nvar $Function = Function;\nvar $TypeError = TypeError;\n\n// eslint-disable-next-line consistent-return\nvar getEvalledConstructor = function (expressionSyntax) {\n\ttry {\n\t\treturn $Function('\"use strict\"; return (' + expressionSyntax + ').constructor;')();\n\t} catch (e) {}\n};\n\nvar $gOPD = Object.getOwnPropertyDescriptor;\nif ($gOPD) {\n\ttry {\n\t\t$gOPD({}, '');\n\t} catch (e) {\n\t\t$gOPD = null; // this is IE 8, which has a broken gOPD\n\t}\n}\n\nvar throwTypeError = function () {\n\tthrow new $TypeError();\n};\nvar ThrowTypeError = $gOPD\n\t? (function () {\n\t\ttry {\n\t\t\t// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties\n\t\t\targuments.callee; // IE 8 does not throw here\n\t\t\treturn throwTypeError;\n\t\t} catch (calleeThrows) {\n\t\t\ttry {\n\t\t\t\t// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')\n\t\t\t\treturn $gOPD(arguments, 'callee').get;\n\t\t\t} catch (gOPDthrows) {\n\t\t\t\treturn throwTypeError;\n\t\t\t}\n\t\t}\n\t}())\n\t: throwTypeError;\n\nvar hasSymbols = require('has-symbols')();\n\nvar getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto\n\nvar needsEval = {};\n\nvar TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);\n\nvar INTRINSICS = {\n\t'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,\n\t'%Array%': Array,\n\t'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,\n\t'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,\n\t'%AsyncFromSyncIteratorPrototype%': undefined,\n\t'%AsyncFunction%': needsEval,\n\t'%AsyncGenerator%': needsEval,\n\t'%AsyncGeneratorFunction%': needsEval,\n\t'%AsyncIteratorPrototype%': needsEval,\n\t'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,\n\t'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,\n\t'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,\n\t'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,\n\t'%Boolean%': Boolean,\n\t'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,\n\t'%Date%': Date,\n\t'%decodeURI%': decodeURI,\n\t'%decodeURIComponent%': decodeURIComponent,\n\t'%encodeURI%': encodeURI,\n\t'%encodeURIComponent%': encodeURIComponent,\n\t'%Error%': Error,\n\t'%eval%': eval, // eslint-disable-line no-eval\n\t'%EvalError%': EvalError,\n\t'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,\n\t'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,\n\t'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,\n\t'%Function%': $Function,\n\t'%GeneratorFunction%': needsEval,\n\t'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,\n\t'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,\n\t'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,\n\t'%isFinite%': isFinite,\n\t'%isNaN%': isNaN,\n\t'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,\n\t'%JSON%': typeof JSON === 'object' ? JSON : undefined,\n\t'%Map%': typeof Map === 'undefined' ? undefined : Map,\n\t'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),\n\t'%Math%': Math,\n\t'%Number%': Number,\n\t'%Object%': Object,\n\t'%parseFloat%': parseFloat,\n\t'%parseInt%': parseInt,\n\t'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,\n\t'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,\n\t'%RangeError%': RangeError,\n\t'%ReferenceError%': ReferenceError,\n\t'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,\n\t'%RegExp%': RegExp,\n\t'%Set%': typeof Set === 'undefined' ? undefined : Set,\n\t'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),\n\t'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,\n\t'%String%': String,\n\t'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,\n\t'%Symbol%': hasSymbols ? Symbol : undefined,\n\t'%SyntaxError%': $SyntaxError,\n\t'%ThrowTypeError%': ThrowTypeError,\n\t'%TypedArray%': TypedArray,\n\t'%TypeError%': $TypeError,\n\t'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,\n\t'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,\n\t'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,\n\t'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,\n\t'%URIError%': URIError,\n\t'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,\n\t'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,\n\t'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet\n};\n\ntry {\n\tnull.error; // eslint-disable-line no-unused-expressions\n} catch (e) {\n\t// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229\n\tvar errorProto = getProto(getProto(e));\n\tINTRINSICS['%Error.prototype%'] = errorProto;\n}\n\nvar doEval = function doEval(name) {\n\tvar value;\n\tif (name === '%AsyncFunction%') {\n\t\tvalue = getEvalledConstructor('async function () {}');\n\t} else if (name === '%GeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('function* () {}');\n\t} else if (name === '%AsyncGeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('async function* () {}');\n\t} else if (name === '%AsyncGenerator%') {\n\t\tvar fn = doEval('%AsyncGeneratorFunction%');\n\t\tif (fn) {\n\t\t\tvalue = fn.prototype;\n\t\t}\n\t} else if (name === '%AsyncIteratorPrototype%') {\n\t\tvar gen = doEval('%AsyncGenerator%');\n\t\tif (gen) {\n\t\t\tvalue = getProto(gen.prototype);\n\t\t}\n\t}\n\n\tINTRINSICS[name] = value;\n\n\treturn value;\n};\n\nvar LEGACY_ALIASES = {\n\t'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],\n\t'%ArrayPrototype%': ['Array', 'prototype'],\n\t'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],\n\t'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],\n\t'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],\n\t'%ArrayProto_values%': ['Array', 'prototype', 'values'],\n\t'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],\n\t'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],\n\t'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],\n\t'%BooleanPrototype%': ['Boolean', 'prototype'],\n\t'%DataViewPrototype%': ['DataView', 'prototype'],\n\t'%DatePrototype%': ['Date', 'prototype'],\n\t'%ErrorPrototype%': ['Error', 'prototype'],\n\t'%EvalErrorPrototype%': ['EvalError', 'prototype'],\n\t'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],\n\t'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],\n\t'%FunctionPrototype%': ['Function', 'prototype'],\n\t'%Generator%': ['GeneratorFunction', 'prototype'],\n\t'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],\n\t'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],\n\t'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],\n\t'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],\n\t'%JSONParse%': ['JSON', 'parse'],\n\t'%JSONStringify%': ['JSON', 'stringify'],\n\t'%MapPrototype%': ['Map', 'prototype'],\n\t'%NumberPrototype%': ['Number', 'prototype'],\n\t'%ObjectPrototype%': ['Object', 'prototype'],\n\t'%ObjProto_toString%': ['Object', 'prototype', 'toString'],\n\t'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],\n\t'%PromisePrototype%': ['Promise', 'prototype'],\n\t'%PromiseProto_then%': ['Promise', 'prototype', 'then'],\n\t'%Promise_all%': ['Promise', 'all'],\n\t'%Promise_reject%': ['Promise', 'reject'],\n\t'%Promise_resolve%': ['Promise', 'resolve'],\n\t'%RangeErrorPrototype%': ['RangeError', 'prototype'],\n\t'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],\n\t'%RegExpPrototype%': ['RegExp', 'prototype'],\n\t'%SetPrototype%': ['Set', 'prototype'],\n\t'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],\n\t'%StringPrototype%': ['String', 'prototype'],\n\t'%SymbolPrototype%': ['Symbol', 'prototype'],\n\t'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],\n\t'%TypedArrayPrototype%': ['TypedArray', 'prototype'],\n\t'%TypeErrorPrototype%': ['TypeError', 'prototype'],\n\t'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],\n\t'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],\n\t'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],\n\t'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],\n\t'%URIErrorPrototype%': ['URIError', 'prototype'],\n\t'%WeakMapPrototype%': ['WeakMap', 'prototype'],\n\t'%WeakSetPrototype%': ['WeakSet', 'prototype']\n};\n\nvar bind = require('function-bind');\nvar hasOwn = require('has');\nvar $concat = bind.call(Function.call, Array.prototype.concat);\nvar $spliceApply = bind.call(Function.apply, Array.prototype.splice);\nvar $replace = bind.call(Function.call, String.prototype.replace);\nvar $strSlice = bind.call(Function.call, String.prototype.slice);\nvar $exec = bind.call(Function.call, RegExp.prototype.exec);\n\n/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */\nvar rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\nvar reEscapeChar = /\\\\(\\\\)?/g; /** Used to match backslashes in property paths. */\nvar stringToPath = function stringToPath(string) {\n\tvar first = $strSlice(string, 0, 1);\n\tvar last = $strSlice(string, -1);\n\tif (first === '%' && last !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected closing `%`');\n\t} else if (last === '%' && first !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected opening `%`');\n\t}\n\tvar result = [];\n\t$replace(string, rePropName, function (match, number, quote, subString) {\n\t\tresult[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;\n\t});\n\treturn result;\n};\n/* end adaptation */\n\nvar getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {\n\tvar intrinsicName = name;\n\tvar alias;\n\tif (hasOwn(LEGACY_ALIASES, intrinsicName)) {\n\t\talias = LEGACY_ALIASES[intrinsicName];\n\t\tintrinsicName = '%' + alias[0] + '%';\n\t}\n\n\tif (hasOwn(INTRINSICS, intrinsicName)) {\n\t\tvar value = INTRINSICS[intrinsicName];\n\t\tif (value === needsEval) {\n\t\t\tvalue = doEval(intrinsicName);\n\t\t}\n\t\tif (typeof value === 'undefined' && !allowMissing) {\n\t\t\tthrow new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');\n\t\t}\n\n\t\treturn {\n\t\t\talias: alias,\n\t\t\tname: intrinsicName,\n\t\t\tvalue: value\n\t\t};\n\t}\n\n\tthrow new $SyntaxError('intrinsic ' + name + ' does not exist!');\n};\n\nmodule.exports = function GetIntrinsic(name, allowMissing) {\n\tif (typeof name !== 'string' || name.length === 0) {\n\t\tthrow new $TypeError('intrinsic name must be a non-empty string');\n\t}\n\tif (arguments.length > 1 && typeof allowMissing !== 'boolean') {\n\t\tthrow new $TypeError('\"allowMissing\" argument must be a boolean');\n\t}\n\n\tif ($exec(/^%?[^%]*%?$/, name) === null) {\n\t\tthrow new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');\n\t}\n\tvar parts = stringToPath(name);\n\tvar intrinsicBaseName = parts.length > 0 ? parts[0] : '';\n\n\tvar intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);\n\tvar intrinsicRealName = intrinsic.name;\n\tvar value = intrinsic.value;\n\tvar skipFurtherCaching = false;\n\n\tvar alias = intrinsic.alias;\n\tif (alias) {\n\t\tintrinsicBaseName = alias[0];\n\t\t$spliceApply(parts, $concat([0, 1], alias));\n\t}\n\n\tfor (var i = 1, isOwn = true; i < parts.length; i += 1) {\n\t\tvar part = parts[i];\n\t\tvar first = $strSlice(part, 0, 1);\n\t\tvar last = $strSlice(part, -1);\n\t\tif (\n\t\t\t(\n\t\t\t\t(first === '\"' || first === \"'\" || first === '`')\n\t\t\t\t|| (last === '\"' || last === \"'\" || last === '`')\n\t\t\t)\n\t\t\t&& first !== last\n\t\t) {\n\t\t\tthrow new $SyntaxError('property names with quotes must have matching quotes');\n\t\t}\n\t\tif (part === 'constructor' || !isOwn) {\n\t\t\tskipFurtherCaching = true;\n\t\t}\n\n\t\tintrinsicBaseName += '.' + part;\n\t\tintrinsicRealName = '%' + intrinsicBaseName + '%';\n\n\t\tif (hasOwn(INTRINSICS, intrinsicRealName)) {\n\t\t\tvalue = INTRINSICS[intrinsicRealName];\n\t\t} else if (value != null) {\n\t\t\tif (!(part in value)) {\n\t\t\t\tif (!allowMissing) {\n\t\t\t\t\tthrow new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');\n\t\t\t\t}\n\t\t\t\treturn void undefined;\n\t\t\t}\n\t\t\tif ($gOPD && (i + 1) >= parts.length) {\n\t\t\t\tvar desc = $gOPD(value, part);\n\t\t\t\tisOwn = !!desc;\n\n\t\t\t\t// By convention, when a data property is converted to an accessor\n\t\t\t\t// property to emulate a data property that does not suffer from\n\t\t\t\t// the override mistake, that accessor's getter is marked with\n\t\t\t\t// an `originalValue` property. Here, when we detect this, we\n\t\t\t\t// uphold the illusion by pretending to see that original data\n\t\t\t\t// property, i.e., returning the value rather than the getter\n\t\t\t\t// itself.\n\t\t\t\tif (isOwn && 'get' in desc && !('originalValue' in desc.get)) {\n\t\t\t\t\tvalue = desc.get;\n\t\t\t\t} else {\n\t\t\t\t\tvalue = value[part];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tisOwn = hasOwn(value, part);\n\t\t\t\tvalue = value[part];\n\t\t\t}\n\n\t\t\tif (isOwn && !skipFurtherCaching) {\n\t\t\t\tINTRINSICS[intrinsicRealName] = value;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\n\nif ($gOPD) {\n\ttry {\n\t\t$gOPD([], 'length');\n\t} catch (e) {\n\t\t// IE 8 has a broken gOPD\n\t\t$gOPD = null;\n\t}\n}\n\nmodule.exports = $gOPD;\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $defineProperty = GetIntrinsic('%Object.defineProperty%', true);\n\nvar hasPropertyDescriptors = function hasPropertyDescriptors() {\n\tif ($defineProperty) {\n\t\ttry {\n\t\t\t$defineProperty({}, 'a', { value: 1 });\n\t\t\treturn true;\n\t\t} catch (e) {\n\t\t\t// IE 8 has a broken defineProperty\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn false;\n};\n\nhasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {\n\t// node v0.6 has a bug where array lengths can be Set but not Defined\n\tif (!hasPropertyDescriptors()) {\n\t\treturn null;\n\t}\n\ttry {\n\t\treturn $defineProperty([], 'length', { value: 1 }).length !== 1;\n\t} catch (e) {\n\t\t// In Firefox 4-22, defining length on an array throws an exception.\n\t\treturn true;\n\t}\n};\n\nmodule.exports = hasPropertyDescriptors;\n","'use strict';\n\nvar origSymbol = typeof Symbol !== 'undefined' && Symbol;\nvar hasSymbolSham = require('./shams');\n\nmodule.exports = function hasNativeSymbols() {\n\tif (typeof origSymbol !== 'function') { return false; }\n\tif (typeof Symbol !== 'function') { return false; }\n\tif (typeof origSymbol('foo') !== 'symbol') { return false; }\n\tif (typeof Symbol('bar') !== 'symbol') { return false; }\n\n\treturn hasSymbolSham();\n};\n","'use strict';\n\n/* eslint complexity: [2, 18], max-statements: [2, 33] */\nmodule.exports = function hasSymbols() {\n\tif (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }\n\tif (typeof Symbol.iterator === 'symbol') { return true; }\n\n\tvar obj = {};\n\tvar sym = Symbol('test');\n\tvar symObj = Object(sym);\n\tif (typeof sym === 'string') { return false; }\n\n\tif (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }\n\tif (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }\n\n\t// temp disabled per https://github.com/ljharb/object.assign/issues/17\n\t// if (sym instanceof Symbol) { return false; }\n\t// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4\n\t// if (!(symObj instanceof Symbol)) { return false; }\n\n\t// if (typeof Symbol.prototype.toString !== 'function') { return false; }\n\t// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }\n\n\tvar symVal = 42;\n\tobj[sym] = symVal;\n\tfor (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop\n\tif (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }\n\n\tif (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }\n\n\tvar syms = Object.getOwnPropertySymbols(obj);\n\tif (syms.length !== 1 || syms[0] !== sym) { return false; }\n\n\tif (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }\n\n\tif (typeof Object.getOwnPropertyDescriptor === 'function') {\n\t\tvar descriptor = Object.getOwnPropertyDescriptor(obj, sym);\n\t\tif (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }\n\t}\n\n\treturn true;\n};\n","'use strict';\n\nvar hasSymbols = require('has-symbols/shams');\n\nmodule.exports = function hasToStringTagShams() {\n\treturn hasSymbols() && !!Symbol.toStringTag;\n};\n","'use strict';\n\nvar bind = require('function-bind');\n\nmodule.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n }\n}\n","'use strict';\n\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\n\nvar isStandardArguments = function isArguments(value) {\n\tif (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {\n\t\treturn false;\n\t}\n\treturn $toString(value) === '[object Arguments]';\n};\n\nvar isLegacyArguments = function isArguments(value) {\n\tif (isStandardArguments(value)) {\n\t\treturn true;\n\t}\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.length === 'number' &&\n\t\tvalue.length >= 0 &&\n\t\t$toString(value) !== '[object Array]' &&\n\t\t$toString(value.callee) === '[object Function]';\n};\n\nvar supportsStandardArguments = (function () {\n\treturn isStandardArguments(arguments);\n}());\n\nisStandardArguments.isLegacyArguments = isLegacyArguments; // for tests\n\nmodule.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;\n","'use strict';\n\nvar fnToStr = Function.prototype.toString;\nvar reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;\nvar badArrayLike;\nvar isCallableMarker;\nif (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {\n\ttry {\n\t\tbadArrayLike = Object.defineProperty({}, 'length', {\n\t\t\tget: function () {\n\t\t\t\tthrow isCallableMarker;\n\t\t\t}\n\t\t});\n\t\tisCallableMarker = {};\n\t\t// eslint-disable-next-line no-throw-literal\n\t\treflectApply(function () { throw 42; }, null, badArrayLike);\n\t} catch (_) {\n\t\tif (_ !== isCallableMarker) {\n\t\t\treflectApply = null;\n\t\t}\n\t}\n} else {\n\treflectApply = null;\n}\n\nvar constructorRegex = /^\\s*class\\b/;\nvar isES6ClassFn = function isES6ClassFunction(value) {\n\ttry {\n\t\tvar fnStr = fnToStr.call(value);\n\t\treturn constructorRegex.test(fnStr);\n\t} catch (e) {\n\t\treturn false; // not a function\n\t}\n};\n\nvar tryFunctionObject = function tryFunctionToStr(value) {\n\ttry {\n\t\tif (isES6ClassFn(value)) { return false; }\n\t\tfnToStr.call(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\nvar toStr = Object.prototype.toString;\nvar objectClass = '[object Object]';\nvar fnClass = '[object Function]';\nvar genClass = '[object GeneratorFunction]';\nvar ddaClass = '[object HTMLAllCollection]'; // IE 11\nvar ddaClass2 = '[object HTML document.all class]';\nvar ddaClass3 = '[object HTMLCollection]'; // IE 9-10\nvar hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag`\n\nvar isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing\n\nvar isDDA = function isDocumentDotAll() { return false; };\nif (typeof document === 'object') {\n\t// Firefox 3 canonicalizes DDA to undefined when it's not accessed directly\n\tvar all = document.all;\n\tif (toStr.call(all) === toStr.call(document.all)) {\n\t\tisDDA = function isDocumentDotAll(value) {\n\t\t\t/* globals document: false */\n\t\t\t// in IE 6-8, typeof document.all is \"object\" and it's truthy\n\t\t\tif ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) {\n\t\t\t\ttry {\n\t\t\t\t\tvar str = toStr.call(value);\n\t\t\t\t\treturn (\n\t\t\t\t\t\tstr === ddaClass\n\t\t\t\t\t\t|| str === ddaClass2\n\t\t\t\t\t\t|| str === ddaClass3 // opera 12.16\n\t\t\t\t\t\t|| str === objectClass // IE 6-8\n\t\t\t\t\t) && value('') == null; // eslint-disable-line eqeqeq\n\t\t\t\t} catch (e) { /**/ }\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n\t}\n}\n\nmodule.exports = reflectApply\n\t? function isCallable(value) {\n\t\tif (isDDA(value)) { return true; }\n\t\tif (!value) { return false; }\n\t\tif (typeof value !== 'function' && typeof value !== 'object') { return false; }\n\t\ttry {\n\t\t\treflectApply(value, null, badArrayLike);\n\t\t} catch (e) {\n\t\t\tif (e !== isCallableMarker) { return false; }\n\t\t}\n\t\treturn !isES6ClassFn(value) && tryFunctionObject(value);\n\t}\n\t: function isCallable(value) {\n\t\tif (isDDA(value)) { return true; }\n\t\tif (!value) { return false; }\n\t\tif (typeof value !== 'function' && typeof value !== 'object') { return false; }\n\t\tif (hasToStringTag) { return tryFunctionObject(value); }\n\t\tif (isES6ClassFn(value)) { return false; }\n\t\tvar strClass = toStr.call(value);\n\t\tif (strClass !== fnClass && strClass !== genClass && !(/^\\[object HTML/).test(strClass)) { return false; }\n\t\treturn tryFunctionObject(value);\n\t};\n","'use strict';\n\nvar toStr = Object.prototype.toString;\nvar fnToStr = Function.prototype.toString;\nvar isFnRegex = /^\\s*(?:function)?\\*/;\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar getProto = Object.getPrototypeOf;\nvar getGeneratorFunc = function () { // eslint-disable-line consistent-return\n\tif (!hasToStringTag) {\n\t\treturn false;\n\t}\n\ttry {\n\t\treturn Function('return function*() {}')();\n\t} catch (e) {\n\t}\n};\nvar GeneratorFunction;\n\nmodule.exports = function isGeneratorFunction(fn) {\n\tif (typeof fn !== 'function') {\n\t\treturn false;\n\t}\n\tif (isFnRegex.test(fnToStr.call(fn))) {\n\t\treturn true;\n\t}\n\tif (!hasToStringTag) {\n\t\tvar str = toStr.call(fn);\n\t\treturn str === '[object GeneratorFunction]';\n\t}\n\tif (!getProto) {\n\t\treturn false;\n\t}\n\tif (typeof GeneratorFunction === 'undefined') {\n\t\tvar generatorFunc = getGeneratorFunc();\n\t\tGeneratorFunction = generatorFunc ? getProto(generatorFunc) : false;\n\t}\n\treturn getProto(fn) === GeneratorFunction;\n};\n","'use strict';\n\n/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */\n\nmodule.exports = function isNaN(value) {\n\treturn value !== value;\n};\n","'use strict';\n\nvar callBind = require('call-bind');\nvar define = require('define-properties');\n\nvar implementation = require('./implementation');\nvar getPolyfill = require('./polyfill');\nvar shim = require('./shim');\n\nvar polyfill = callBind(getPolyfill(), Number);\n\n/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */\n\ndefine(polyfill, {\n\tgetPolyfill: getPolyfill,\n\timplementation: implementation,\n\tshim: shim\n});\n\nmodule.exports = polyfill;\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = function getPolyfill() {\n\tif (Number.isNaN && Number.isNaN(NaN) && !Number.isNaN('a')) {\n\t\treturn Number.isNaN;\n\t}\n\treturn implementation;\n};\n","'use strict';\n\nvar define = require('define-properties');\nvar getPolyfill = require('./polyfill');\n\n/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */\n\nmodule.exports = function shimNumberIsNaN() {\n\tvar polyfill = getPolyfill();\n\tdefine(Number, { isNaN: polyfill }, {\n\t\tisNaN: function testIsNaN() {\n\t\t\treturn Number.isNaN !== polyfill;\n\t\t}\n\t});\n\treturn polyfill;\n};\n","'use strict';\n\nvar forEach = require('for-each');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar gOPD = require('gopd');\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\nvar typedArrays = availableTypedArrays();\n\nvar $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {\n\tfor (var i = 0; i < array.length; i += 1) {\n\t\tif (array[i] === value) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n};\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tvar arr = new g[typedArray]();\n\t\tif (Symbol.toStringTag in arr) {\n\t\t\tvar proto = getPrototypeOf(arr);\n\t\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\t\tif (!descriptor) {\n\t\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t\t}\n\t\t\ttoStrTags[typedArray] = descriptor.get;\n\t\t}\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar anyTrue = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!anyTrue) {\n\t\t\ttry {\n\t\t\t\tanyTrue = getter.call(value) === typedArray;\n\t\t\t} catch (e) { /**/ }\n\t\t}\n\t});\n\treturn anyTrue;\n};\n\nmodule.exports = function isTypedArray(value) {\n\tif (!value || typeof value !== 'object') { return false; }\n\tif (!hasToStringTag || !(Symbol.toStringTag in value)) {\n\t\tvar tag = $slice($toString(value), 8, -1);\n\t\treturn $indexOf(typedArrays, tag) > -1;\n\t}\n\tif (!gOPD) { return false; }\n\treturn tryTypedArrays(value);\n};\n","'use strict';\n\nvar numberIsNaN = function (value) {\n\treturn value !== value;\n};\n\nmodule.exports = function is(a, b) {\n\tif (a === 0 && b === 0) {\n\t\treturn 1 / a === 1 / b;\n\t}\n\tif (a === b) {\n\t\treturn true;\n\t}\n\tif (numberIsNaN(a) && numberIsNaN(b)) {\n\t\treturn true;\n\t}\n\treturn false;\n};\n\n","'use strict';\n\nvar define = require('define-properties');\nvar callBind = require('call-bind');\n\nvar implementation = require('./implementation');\nvar getPolyfill = require('./polyfill');\nvar shim = require('./shim');\n\nvar polyfill = callBind(getPolyfill(), Object);\n\ndefine(polyfill, {\n\tgetPolyfill: getPolyfill,\n\timplementation: implementation,\n\tshim: shim\n});\n\nmodule.exports = polyfill;\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = function getPolyfill() {\n\treturn typeof Object.is === 'function' ? Object.is : implementation;\n};\n","'use strict';\n\nvar getPolyfill = require('./polyfill');\nvar define = require('define-properties');\n\nmodule.exports = function shimObjectIs() {\n\tvar polyfill = getPolyfill();\n\tdefine(Object, { is: polyfill }, {\n\t\tis: function testObjectIs() {\n\t\t\treturn Object.is !== polyfill;\n\t\t}\n\t});\n\treturn polyfill;\n};\n","'use strict';\n\nvar keysShim;\nif (!Object.keys) {\n\t// modified from https://github.com/es-shims/es5-shim\n\tvar has = Object.prototype.hasOwnProperty;\n\tvar toStr = Object.prototype.toString;\n\tvar isArgs = require('./isArguments'); // eslint-disable-line global-require\n\tvar isEnumerable = Object.prototype.propertyIsEnumerable;\n\tvar hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');\n\tvar hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');\n\tvar dontEnums = [\n\t\t'toString',\n\t\t'toLocaleString',\n\t\t'valueOf',\n\t\t'hasOwnProperty',\n\t\t'isPrototypeOf',\n\t\t'propertyIsEnumerable',\n\t\t'constructor'\n\t];\n\tvar equalsConstructorPrototype = function (o) {\n\t\tvar ctor = o.constructor;\n\t\treturn ctor && ctor.prototype === o;\n\t};\n\tvar excludedKeys = {\n\t\t$applicationCache: true,\n\t\t$console: true,\n\t\t$external: true,\n\t\t$frame: true,\n\t\t$frameElement: true,\n\t\t$frames: true,\n\t\t$innerHeight: true,\n\t\t$innerWidth: true,\n\t\t$onmozfullscreenchange: true,\n\t\t$onmozfullscreenerror: true,\n\t\t$outerHeight: true,\n\t\t$outerWidth: true,\n\t\t$pageXOffset: true,\n\t\t$pageYOffset: true,\n\t\t$parent: true,\n\t\t$scrollLeft: true,\n\t\t$scrollTop: true,\n\t\t$scrollX: true,\n\t\t$scrollY: true,\n\t\t$self: true,\n\t\t$webkitIndexedDB: true,\n\t\t$webkitStorageInfo: true,\n\t\t$window: true\n\t};\n\tvar hasAutomationEqualityBug = (function () {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined') { return false; }\n\t\tfor (var k in window) {\n\t\t\ttry {\n\t\t\t\tif (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tequalsConstructorPrototype(window[k]);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}());\n\tvar equalsConstructorPrototypeIfNotBuggy = function (o) {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined' || !hasAutomationEqualityBug) {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t}\n\t\ttry {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t};\n\n\tkeysShim = function keys(object) {\n\t\tvar isObject = object !== null && typeof object === 'object';\n\t\tvar isFunction = toStr.call(object) === '[object Function]';\n\t\tvar isArguments = isArgs(object);\n\t\tvar isString = isObject && toStr.call(object) === '[object String]';\n\t\tvar theKeys = [];\n\n\t\tif (!isObject && !isFunction && !isArguments) {\n\t\t\tthrow new TypeError('Object.keys called on a non-object');\n\t\t}\n\n\t\tvar skipProto = hasProtoEnumBug && isFunction;\n\t\tif (isString && object.length > 0 && !has.call(object, 0)) {\n\t\t\tfor (var i = 0; i < object.length; ++i) {\n\t\t\t\ttheKeys.push(String(i));\n\t\t\t}\n\t\t}\n\n\t\tif (isArguments && object.length > 0) {\n\t\t\tfor (var j = 0; j < object.length; ++j) {\n\t\t\t\ttheKeys.push(String(j));\n\t\t\t}\n\t\t} else {\n\t\t\tfor (var name in object) {\n\t\t\t\tif (!(skipProto && name === 'prototype') && has.call(object, name)) {\n\t\t\t\t\ttheKeys.push(String(name));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (hasDontEnumBug) {\n\t\t\tvar skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);\n\n\t\t\tfor (var k = 0; k < dontEnums.length; ++k) {\n\t\t\t\tif (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {\n\t\t\t\t\ttheKeys.push(dontEnums[k]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn theKeys;\n\t};\n}\nmodule.exports = keysShim;\n","'use strict';\n\nvar slice = Array.prototype.slice;\nvar isArgs = require('./isArguments');\n\nvar origKeys = Object.keys;\nvar keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');\n\nvar originalKeys = Object.keys;\n\nkeysShim.shim = function shimObjectKeys() {\n\tif (Object.keys) {\n\t\tvar keysWorksWithArguments = (function () {\n\t\t\t// Safari 5.0 bug\n\t\t\tvar args = Object.keys(arguments);\n\t\t\treturn args && args.length === arguments.length;\n\t\t}(1, 2));\n\t\tif (!keysWorksWithArguments) {\n\t\t\tObject.keys = function keys(object) { // eslint-disable-line func-name-matching\n\t\t\t\tif (isArgs(object)) {\n\t\t\t\t\treturn originalKeys(slice.call(object));\n\t\t\t\t}\n\t\t\t\treturn originalKeys(object);\n\t\t\t};\n\t\t}\n\t} else {\n\t\tObject.keys = keysShim;\n\t}\n\treturn Object.keys || keysShim;\n};\n\nmodule.exports = keysShim;\n","'use strict';\n\nvar toStr = Object.prototype.toString;\n\nmodule.exports = function isArguments(value) {\n\tvar str = toStr.call(value);\n\tvar isArgs = str === '[object Arguments]';\n\tif (!isArgs) {\n\t\tisArgs = str !== '[object Array]' &&\n\t\t\tvalue !== null &&\n\t\t\ttypeof value === 'object' &&\n\t\t\ttypeof value.length === 'number' &&\n\t\t\tvalue.length >= 0 &&\n\t\t\ttoStr.call(value.callee) === '[object Function]';\n\t}\n\treturn isArgs;\n};\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (Array.isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return Object.keys(obj).map(function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (Array.isArray(obj[k])) {\n return obj[k].map(function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n","/*! queue-microtask. MIT License. Feross Aboukhadijeh */\nlet promise\n\nmodule.exports = typeof queueMicrotask === 'function'\n ? queueMicrotask.bind(typeof window !== 'undefined' ? window : global)\n // reuse resolved promise, and allocate it lazily\n : cb => (promise || (promise = Promise.resolve()))\n .then(cb)\n .catch(err => setTimeout(() => { throw err }, 0))\n","/**\n * Provides a way to access commonly used namespaces\n *\n * Usage:\n *\n * ```\n * const $rdf = require('rdflib'); //or any other RDF/JS-compatible library\n * const ns = require('solid-namespace')($rdf);\n * const store = $rdf.graph();\n *\n * let me = ...;\n * let name = store.any(me, ns.vcard(‘fn’)) || store.any(me, ns.foaf(‘name’));\n * ```\n * @module vocab\n */\nconst aliases = {\n acl: 'http://www.w3.org/ns/auth/acl#',\n arg: 'http://www.w3.org/ns/pim/arg#',\n as: 'https://www.w3.org/ns/activitystreams#',\n cal: 'http://www.w3.org/2002/12/cal/ical#',\n cert: 'http://www.w3.org/ns/auth/cert#',\n contact: 'http://www.w3.org/2000/10/swap/pim/contact#',\n dc: 'http://purl.org/dc/elements/1.1/',\n dct: 'http://purl.org/dc/terms/',\n doap: 'http://usefulinc.com/ns/doap#',\n foaf: 'http://xmlns.com/foaf/0.1/',\n geo: 'http://www.w3.org/2003/01/geo/wgs84_pos#',\n gpx: 'http://www.w3.org/ns/pim/gpx#',\n http: 'http://www.w3.org/2007/ont/http#',\n httph: 'http://www.w3.org/2007/ont/httph#',\n icalTZ: 'http://www.w3.org/2002/12/cal/icaltzd#', // Beware: not cal:\n ldp: 'http://www.w3.org/ns/ldp#',\n link: 'http://www.w3.org/2007/ont/link#',\n log: 'http://www.w3.org/2000/10/swap/log#',\n meeting: 'http://www.w3.org/ns/pim/meeting#',\n mo: 'http://purl.org/ontology/mo/',\n org: 'http://www.w3.org/ns/org#',\n owl: 'http://www.w3.org/2002/07/owl#',\n pad: 'http://www.w3.org/ns/pim/pad#',\n patch: 'http://www.w3.org/ns/pim/patch#',\n prov: 'http://www.w3.org/ns/prov#',\n qu: 'http://www.w3.org/2000/10/swap/pim/qif#',\n trip: 'http://www.w3.org/ns/pim/trip#',\n rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n rdfs: 'http://www.w3.org/2000/01/rdf-schema#',\n rss: 'http://purl.org/rss/1.0/',\n sched: 'http://www.w3.org/ns/pim/schedule#',\n schema: 'http://schema.org/', // @@ beware confusion with documents no 303\n sioc: 'http://rdfs.org/sioc/ns#',\n solid: 'http://www.w3.org/ns/solid/terms#',\n space: 'http://www.w3.org/ns/pim/space#',\n stat: 'http://www.w3.org/ns/posix/stat#',\n tab: 'http://www.w3.org/2007/ont/link#',\n tabont: 'http://www.w3.org/2007/ont/link#',\n ui: 'http://www.w3.org/ns/ui#',\n vcard: 'http://www.w3.org/2006/vcard/ns#',\n wf: 'http://www.w3.org/2005/01/wf/flow#',\n xsd: 'http://www.w3.org/2001/XMLSchema#',\n cco: 'http://www.ontologyrepository.com/CommonCoreOntologies/',\n skos: 'http://www.w3.org/2004/02/skos/core#',\n bookmark: 'http://www.w3.org/2002/01/bookmark#',\n vann: 'http://purl.org/vocab/vann/'\n}\n\n/**\n * @param [rdflib] {RDF} Optional RDF Library (such as rdflib.js or rdf-ext) to inject\n */\nfunction vocab (rdf = { namedNode: u => u }) {\n const namespaces = {}\n for (const alias in aliases) {\n const expansion = aliases[alias]\n namespaces[alias] = function (localName = '') {\n return rdf.namedNode(expansion + localName)\n }\n };\n\n return namespaces\n};\n\nmodule.exports = vocab\n","/*! https://mths.be/punycode v1.3.2 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see \n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * http://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.3.2',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see \n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar punycode = require('punycode');\nvar util = require('./util');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n unsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n },\n querystring = require('querystring');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && util.isObject(url) && url instanceof Url) return url;\n\n var u = new Url;\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (!util.isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n }\n\n // Copy chrome, IE, opera backslash-handling behavior.\n // Back slashes before the query string get converted to forward slashes\n // See: https://code.google.com/p/chromium/issues/detail?id=25916\n var queryIndex = url.indexOf('?'),\n splitter =\n (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n\n var rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.path = rest;\n this.href = rest;\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n if (parseQueryString) {\n this.query = querystring.parse(this.search.substr(1));\n } else {\n this.query = this.search.substr(1);\n }\n } else if (parseQueryString) {\n this.search = '';\n this.query = {};\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1)\n hostEnd = rest.length;\n\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost();\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) continue;\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a punycoded representation of \"domain\".\n // It only converts parts of the domain name that\n // have non-ASCII characters, i.e. it doesn't matter if\n // you call it with a domain that already is ASCII-only.\n this.hostname = punycode.toASCII(this.hostname);\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host;\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n }\n\n // now rest is set to the post-host stuff.\n // chop off any delim chars.\n if (!unsafeProtocol[lowerProto]) {\n\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1)\n continue;\n var esc = encodeURIComponent(ae);\n if (esc === ae) {\n esc = escape(ae);\n }\n rest = rest.split(ae).join(esc);\n }\n }\n\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n if (rest) this.pathname = rest;\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '/';\n }\n\n //to support http.request\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n }\n\n // finally, reconstruct the href based on what has been validated.\n this.href = this.format();\n return this;\n};\n\n// format a parsed object into a url string\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (util.isString(obj)) obj = urlParse(obj);\n if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n return obj.format();\n}\n\nUrl.prototype.format = function() {\n var auth = this.auth || '';\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ?\n this.hostname :\n '[' + this.hostname + ']');\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query &&\n util.isObject(this.query) &&\n Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.search || (query && ('?' + query)) || '';\n\n if (protocol && protocol.substr(-1) !== ':') protocol += ':';\n\n // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n if (this.slashes ||\n (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n if (search && search.charAt(0) !== '?') search = '?' + search;\n\n pathname = pathname.replace(/[?#]/g, function(match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function(relative) {\n if (util.isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n\n // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n result.hash = relative.hash;\n\n // if the relative url is empty, then there's nothing left to do here.\n if (relative.href === '') {\n result.href = result.format();\n return result;\n }\n\n // hrefs like //foo/bar always cut to the protocol.\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol')\n result[rkey] = relative[rkey];\n }\n\n //urlParse appends trailing / to urls like http://www.example.com\n if (slashedProtocol[result.protocol] &&\n result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n while (relPath.length && !(relative.host = relPath.shift()));\n if (!relative.host) relative.host = '';\n if (!relative.hostname) relative.hostname = '';\n if (relPath[0] !== '') relPath.unshift('');\n if (relPath.length < 2) relPath.unshift('');\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port;\n // to support http.request\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n isRelAbs = (\n relative.host ||\n relative.pathname && relative.pathname.charAt(0) === '/'\n ),\n mustEndAbs = (isRelAbs || isSourceAbs ||\n (result.host && relative.pathname)),\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n if (result.host) {\n if (srcPath[0] === '') srcPath[0] = result.host;\n else srcPath.unshift(result.host);\n }\n result.host = '';\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n if (relative.host) {\n if (relPath[0] === '') relPath[0] = relative.host;\n else relPath.unshift(relative.host);\n }\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = (relative.host || relative.host === '') ?\n relative.host : result.host;\n result.hostname = (relative.hostname || relative.hostname === '') ?\n relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath;\n // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!util.isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift();\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n result.search = relative.search;\n result.query = relative.query;\n //to support http.request\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null;\n //to support http.request\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n result.href = result.format();\n return result;\n }\n\n // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (\n (result.host || relative.host || srcPath.length > 1) &&\n (last === '.' || last === '..') || last === '');\n\n // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' &&\n (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' ||\n (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n // put the host back\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' :\n srcPath.length ? srcPath.shift() : '';\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n }\n\n //to support request.http\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function() {\n var host = this.host;\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) this.hostname = host;\n};\n","'use strict';\n\nmodule.exports = {\n isString: function(arg) {\n return typeof(arg) === 'string';\n },\n isObject: function(arg) {\n return typeof(arg) === 'object' && arg !== null;\n },\n isNull: function(arg) {\n return arg === null;\n },\n isNullOrUndefined: function(arg) {\n return arg == null;\n }\n};\n","module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}","// Currently in sync with Node.js lib/internal/util/types.js\n// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9\n\n'use strict';\n\nvar isArgumentsObject = require('is-arguments');\nvar isGeneratorFunction = require('is-generator-function');\nvar whichTypedArray = require('which-typed-array');\nvar isTypedArray = require('is-typed-array');\n\nfunction uncurryThis(f) {\n return f.call.bind(f);\n}\n\nvar BigIntSupported = typeof BigInt !== 'undefined';\nvar SymbolSupported = typeof Symbol !== 'undefined';\n\nvar ObjectToString = uncurryThis(Object.prototype.toString);\n\nvar numberValue = uncurryThis(Number.prototype.valueOf);\nvar stringValue = uncurryThis(String.prototype.valueOf);\nvar booleanValue = uncurryThis(Boolean.prototype.valueOf);\n\nif (BigIntSupported) {\n var bigIntValue = uncurryThis(BigInt.prototype.valueOf);\n}\n\nif (SymbolSupported) {\n var symbolValue = uncurryThis(Symbol.prototype.valueOf);\n}\n\nfunction checkBoxedPrimitive(value, prototypeValueOf) {\n if (typeof value !== 'object') {\n return false;\n }\n try {\n prototypeValueOf(value);\n return true;\n } catch(e) {\n return false;\n }\n}\n\nexports.isArgumentsObject = isArgumentsObject;\nexports.isGeneratorFunction = isGeneratorFunction;\nexports.isTypedArray = isTypedArray;\n\n// Taken from here and modified for better browser support\n// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js\nfunction isPromise(input) {\n\treturn (\n\t\t(\n\t\t\ttypeof Promise !== 'undefined' &&\n\t\t\tinput instanceof Promise\n\t\t) ||\n\t\t(\n\t\t\tinput !== null &&\n\t\t\ttypeof input === 'object' &&\n\t\t\ttypeof input.then === 'function' &&\n\t\t\ttypeof input.catch === 'function'\n\t\t)\n\t);\n}\nexports.isPromise = isPromise;\n\nfunction isArrayBufferView(value) {\n if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {\n return ArrayBuffer.isView(value);\n }\n\n return (\n isTypedArray(value) ||\n isDataView(value)\n );\n}\nexports.isArrayBufferView = isArrayBufferView;\n\n\nfunction isUint8Array(value) {\n return whichTypedArray(value) === 'Uint8Array';\n}\nexports.isUint8Array = isUint8Array;\n\nfunction isUint8ClampedArray(value) {\n return whichTypedArray(value) === 'Uint8ClampedArray';\n}\nexports.isUint8ClampedArray = isUint8ClampedArray;\n\nfunction isUint16Array(value) {\n return whichTypedArray(value) === 'Uint16Array';\n}\nexports.isUint16Array = isUint16Array;\n\nfunction isUint32Array(value) {\n return whichTypedArray(value) === 'Uint32Array';\n}\nexports.isUint32Array = isUint32Array;\n\nfunction isInt8Array(value) {\n return whichTypedArray(value) === 'Int8Array';\n}\nexports.isInt8Array = isInt8Array;\n\nfunction isInt16Array(value) {\n return whichTypedArray(value) === 'Int16Array';\n}\nexports.isInt16Array = isInt16Array;\n\nfunction isInt32Array(value) {\n return whichTypedArray(value) === 'Int32Array';\n}\nexports.isInt32Array = isInt32Array;\n\nfunction isFloat32Array(value) {\n return whichTypedArray(value) === 'Float32Array';\n}\nexports.isFloat32Array = isFloat32Array;\n\nfunction isFloat64Array(value) {\n return whichTypedArray(value) === 'Float64Array';\n}\nexports.isFloat64Array = isFloat64Array;\n\nfunction isBigInt64Array(value) {\n return whichTypedArray(value) === 'BigInt64Array';\n}\nexports.isBigInt64Array = isBigInt64Array;\n\nfunction isBigUint64Array(value) {\n return whichTypedArray(value) === 'BigUint64Array';\n}\nexports.isBigUint64Array = isBigUint64Array;\n\nfunction isMapToString(value) {\n return ObjectToString(value) === '[object Map]';\n}\nisMapToString.working = (\n typeof Map !== 'undefined' &&\n isMapToString(new Map())\n);\n\nfunction isMap(value) {\n if (typeof Map === 'undefined') {\n return false;\n }\n\n return isMapToString.working\n ? isMapToString(value)\n : value instanceof Map;\n}\nexports.isMap = isMap;\n\nfunction isSetToString(value) {\n return ObjectToString(value) === '[object Set]';\n}\nisSetToString.working = (\n typeof Set !== 'undefined' &&\n isSetToString(new Set())\n);\nfunction isSet(value) {\n if (typeof Set === 'undefined') {\n return false;\n }\n\n return isSetToString.working\n ? isSetToString(value)\n : value instanceof Set;\n}\nexports.isSet = isSet;\n\nfunction isWeakMapToString(value) {\n return ObjectToString(value) === '[object WeakMap]';\n}\nisWeakMapToString.working = (\n typeof WeakMap !== 'undefined' &&\n isWeakMapToString(new WeakMap())\n);\nfunction isWeakMap(value) {\n if (typeof WeakMap === 'undefined') {\n return false;\n }\n\n return isWeakMapToString.working\n ? isWeakMapToString(value)\n : value instanceof WeakMap;\n}\nexports.isWeakMap = isWeakMap;\n\nfunction isWeakSetToString(value) {\n return ObjectToString(value) === '[object WeakSet]';\n}\nisWeakSetToString.working = (\n typeof WeakSet !== 'undefined' &&\n isWeakSetToString(new WeakSet())\n);\nfunction isWeakSet(value) {\n return isWeakSetToString(value);\n}\nexports.isWeakSet = isWeakSet;\n\nfunction isArrayBufferToString(value) {\n return ObjectToString(value) === '[object ArrayBuffer]';\n}\nisArrayBufferToString.working = (\n typeof ArrayBuffer !== 'undefined' &&\n isArrayBufferToString(new ArrayBuffer())\n);\nfunction isArrayBuffer(value) {\n if (typeof ArrayBuffer === 'undefined') {\n return false;\n }\n\n return isArrayBufferToString.working\n ? isArrayBufferToString(value)\n : value instanceof ArrayBuffer;\n}\nexports.isArrayBuffer = isArrayBuffer;\n\nfunction isDataViewToString(value) {\n return ObjectToString(value) === '[object DataView]';\n}\nisDataViewToString.working = (\n typeof ArrayBuffer !== 'undefined' &&\n typeof DataView !== 'undefined' &&\n isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))\n);\nfunction isDataView(value) {\n if (typeof DataView === 'undefined') {\n return false;\n }\n\n return isDataViewToString.working\n ? isDataViewToString(value)\n : value instanceof DataView;\n}\nexports.isDataView = isDataView;\n\n// Store a copy of SharedArrayBuffer in case it's deleted elsewhere\nvar SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined;\nfunction isSharedArrayBufferToString(value) {\n return ObjectToString(value) === '[object SharedArrayBuffer]';\n}\nfunction isSharedArrayBuffer(value) {\n if (typeof SharedArrayBufferCopy === 'undefined') {\n return false;\n }\n\n if (typeof isSharedArrayBufferToString.working === 'undefined') {\n isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());\n }\n\n return isSharedArrayBufferToString.working\n ? isSharedArrayBufferToString(value)\n : value instanceof SharedArrayBufferCopy;\n}\nexports.isSharedArrayBuffer = isSharedArrayBuffer;\n\nfunction isAsyncFunction(value) {\n return ObjectToString(value) === '[object AsyncFunction]';\n}\nexports.isAsyncFunction = isAsyncFunction;\n\nfunction isMapIterator(value) {\n return ObjectToString(value) === '[object Map Iterator]';\n}\nexports.isMapIterator = isMapIterator;\n\nfunction isSetIterator(value) {\n return ObjectToString(value) === '[object Set Iterator]';\n}\nexports.isSetIterator = isSetIterator;\n\nfunction isGeneratorObject(value) {\n return ObjectToString(value) === '[object Generator]';\n}\nexports.isGeneratorObject = isGeneratorObject;\n\nfunction isWebAssemblyCompiledModule(value) {\n return ObjectToString(value) === '[object WebAssembly.Module]';\n}\nexports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;\n\nfunction isNumberObject(value) {\n return checkBoxedPrimitive(value, numberValue);\n}\nexports.isNumberObject = isNumberObject;\n\nfunction isStringObject(value) {\n return checkBoxedPrimitive(value, stringValue);\n}\nexports.isStringObject = isStringObject;\n\nfunction isBooleanObject(value) {\n return checkBoxedPrimitive(value, booleanValue);\n}\nexports.isBooleanObject = isBooleanObject;\n\nfunction isBigIntObject(value) {\n return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);\n}\nexports.isBigIntObject = isBigIntObject;\n\nfunction isSymbolObject(value) {\n return SymbolSupported && checkBoxedPrimitive(value, symbolValue);\n}\nexports.isSymbolObject = isSymbolObject;\n\nfunction isBoxedPrimitive(value) {\n return (\n isNumberObject(value) ||\n isStringObject(value) ||\n isBooleanObject(value) ||\n isBigIntObject(value) ||\n isSymbolObject(value)\n );\n}\nexports.isBoxedPrimitive = isBoxedPrimitive;\n\nfunction isAnyArrayBuffer(value) {\n return typeof Uint8Array !== 'undefined' && (\n isArrayBuffer(value) ||\n isSharedArrayBuffer(value)\n );\n}\nexports.isAnyArrayBuffer = isAnyArrayBuffer;\n\n['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) {\n Object.defineProperty(exports, method, {\n enumerable: false,\n value: function() {\n throw new Error(method + ' is not supported in userland');\n }\n });\n});\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||\n function getOwnPropertyDescriptors(obj) {\n var keys = Object.keys(obj);\n var descriptors = {};\n for (var i = 0; i < keys.length; i++) {\n descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);\n }\n return descriptors;\n };\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n if (typeof process !== 'undefined' && process.noDeprecation === true) {\n return fn;\n }\n\n // Allow for deprecating things in the process of starting up.\n if (typeof process === 'undefined') {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnvRegex = /^$/;\n\nif (process.env.NODE_DEBUG) {\n var debugEnv = process.env.NODE_DEBUG;\n debugEnv = debugEnv.replace(/[|\\\\{}()[\\]^$+?.]/g, '\\\\$&')\n .replace(/\\*/g, '.*')\n .replace(/,/g, '$|^')\n .toUpperCase();\n debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');\n}\nexports.debuglog = function(set) {\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (debugEnvRegex.test(set)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').slice(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.slice(1, -1);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nexports.types = require('./support/types');\n\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\nexports.types.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\nexports.types.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\nexports.types.isNativeError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nvar kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;\n\nexports.promisify = function promisify(original) {\n if (typeof original !== 'function')\n throw new TypeError('The \"original\" argument must be of type Function');\n\n if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n if (typeof fn !== 'function') {\n throw new TypeError('The \"util.promisify.custom\" argument must be of type Function');\n }\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return fn;\n }\n\n function fn() {\n var promiseResolve, promiseReject;\n var promise = new Promise(function (resolve, reject) {\n promiseResolve = resolve;\n promiseReject = reject;\n });\n\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n args.push(function (err, value) {\n if (err) {\n promiseReject(err);\n } else {\n promiseResolve(value);\n }\n });\n\n try {\n original.apply(this, args);\n } catch (err) {\n promiseReject(err);\n }\n\n return promise;\n }\n\n Object.setPrototypeOf(fn, Object.getPrototypeOf(original));\n\n if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return Object.defineProperties(\n fn,\n getOwnPropertyDescriptors(original)\n );\n}\n\nexports.promisify.custom = kCustomPromisifiedSymbol\n\nfunction callbackifyOnRejected(reason, cb) {\n // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).\n // Because `null` is a special error value in callbacks which means \"no error\n // occurred\", we error-wrap so the callback consumer can distinguish between\n // \"the promise rejected with null\" or \"the promise fulfilled with undefined\".\n if (!reason) {\n var newReason = new Error('Promise was rejected with a falsy value');\n newReason.reason = reason;\n reason = newReason;\n }\n return cb(reason);\n}\n\nfunction callbackify(original) {\n if (typeof original !== 'function') {\n throw new TypeError('The \"original\" argument must be of type Function');\n }\n\n // We DO NOT return the promise as it gives the user a false sense that\n // the promise is actually somehow related to the callback's execution\n // and that the callback throwing will reject the promise.\n function callbackified() {\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n var self = this;\n var cb = function() {\n return maybeCb.apply(self, arguments);\n };\n // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n original.apply(this, args)\n .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) },\n function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) });\n }\n\n Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));\n Object.defineProperties(callbackified,\n getOwnPropertyDescriptors(original));\n return callbackified;\n}\nexports.callbackify = callbackify;\n","'use strict';\n\nvar forEach = require('for-each');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('call-bind/callBound');\nvar gOPD = require('gopd');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\nvar typedArrays = availableTypedArrays();\n\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tif (typeof g[typedArray] === 'function') {\n\t\t\tvar arr = new g[typedArray]();\n\t\t\tif (Symbol.toStringTag in arr) {\n\t\t\t\tvar proto = getPrototypeOf(arr);\n\t\t\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\t\t\tif (!descriptor) {\n\t\t\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t\t\t}\n\t\t\t\ttoStrTags[typedArray] = descriptor.get;\n\t\t\t}\n\t\t}\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar foundName = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!foundName) {\n\t\t\ttry {\n\t\t\t\tvar name = getter.call(value);\n\t\t\t\tif (name === typedArray) {\n\t\t\t\t\tfoundName = name;\n\t\t\t\t}\n\t\t\t} catch (e) {}\n\t\t}\n\t});\n\treturn foundName;\n};\n\nvar isTypedArray = require('is-typed-array');\n\nmodule.exports = function whichTypedArray(value) {\n\tif (!isTypedArray(value)) { return false; }\n\tif (!hasToStringTag || !(Symbol.toStringTag in value)) { return $slice($toString(value), 8, -1); }\n\treturn tryTypedArrays(value);\n};\n","module.exports = __WEBPACK_EXTERNAL_MODULE__8392__;","var _typeof = require(\"./typeof.js\")[\"default\"];\nfunction _regeneratorRuntime() {\n \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */\n module.exports = _regeneratorRuntime = function _regeneratorRuntime() {\n return e;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n var t,\n e = {},\n r = Object.prototype,\n n = r.hasOwnProperty,\n o = Object.defineProperty || function (t, e, r) {\n t[e] = r.value;\n },\n i = \"function\" == typeof Symbol ? Symbol : {},\n a = i.iterator || \"@@iterator\",\n c = i.asyncIterator || \"@@asyncIterator\",\n u = i.toStringTag || \"@@toStringTag\";\n function define(t, e, r) {\n return Object.defineProperty(t, e, {\n value: r,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }), t[e];\n }\n try {\n define({}, \"\");\n } catch (t) {\n define = function define(t, e, r) {\n return t[e] = r;\n };\n }\n function wrap(t, e, r, n) {\n var i = e && e.prototype instanceof Generator ? e : Generator,\n a = Object.create(i.prototype),\n c = new Context(n || []);\n return o(a, \"_invoke\", {\n value: makeInvokeMethod(t, r, c)\n }), a;\n }\n function tryCatch(t, e, r) {\n try {\n return {\n type: \"normal\",\n arg: t.call(e, r)\n };\n } catch (t) {\n return {\n type: \"throw\",\n arg: t\n };\n }\n }\n e.wrap = wrap;\n var h = \"suspendedStart\",\n l = \"suspendedYield\",\n f = \"executing\",\n s = \"completed\",\n y = {};\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n var p = {};\n define(p, a, function () {\n return this;\n });\n var d = Object.getPrototypeOf,\n v = d && d(d(values([])));\n v && v !== r && n.call(v, a) && (p = v);\n var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);\n function defineIteratorMethods(t) {\n [\"next\", \"throw\", \"return\"].forEach(function (e) {\n define(t, e, function (t) {\n return this._invoke(e, t);\n });\n });\n }\n function AsyncIterator(t, e) {\n function invoke(r, o, i, a) {\n var c = tryCatch(t[r], t, o);\n if (\"throw\" !== c.type) {\n var u = c.arg,\n h = u.value;\n return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) {\n invoke(\"next\", t, i, a);\n }, function (t) {\n invoke(\"throw\", t, i, a);\n }) : e.resolve(h).then(function (t) {\n u.value = t, i(u);\n }, function (t) {\n return invoke(\"throw\", t, i, a);\n });\n }\n a(c.arg);\n }\n var r;\n o(this, \"_invoke\", {\n value: function value(t, n) {\n function callInvokeWithMethodAndArg() {\n return new e(function (e, r) {\n invoke(t, n, e, r);\n });\n }\n return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();\n }\n });\n }\n function makeInvokeMethod(e, r, n) {\n var o = h;\n return function (i, a) {\n if (o === f) throw Error(\"Generator is already running\");\n if (o === s) {\n if (\"throw\" === i) throw a;\n return {\n value: t,\n done: !0\n };\n }\n for (n.method = i, n.arg = a;;) {\n var c = n.delegate;\n if (c) {\n var u = maybeInvokeDelegate(c, n);\n if (u) {\n if (u === y) continue;\n return u;\n }\n }\n if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) {\n if (o === h) throw o = s, n.arg;\n n.dispatchException(n.arg);\n } else \"return\" === n.method && n.abrupt(\"return\", n.arg);\n o = f;\n var p = tryCatch(e, r, n);\n if (\"normal\" === p.type) {\n if (o = n.done ? s : l, p.arg === y) continue;\n return {\n value: p.arg,\n done: n.done\n };\n }\n \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg);\n }\n };\n }\n function maybeInvokeDelegate(e, r) {\n var n = r.method,\n o = e.iterator[n];\n if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y;\n var i = tryCatch(o, e.iterator, r.arg);\n if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y;\n var a = i.arg;\n return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y);\n }\n function pushTryEntry(t) {\n var e = {\n tryLoc: t[0]\n };\n 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);\n }\n function resetTryEntry(t) {\n var e = t.completion || {};\n e.type = \"normal\", delete e.arg, t.completion = e;\n }\n function Context(t) {\n this.tryEntries = [{\n tryLoc: \"root\"\n }], t.forEach(pushTryEntry, this), this.reset(!0);\n }\n function values(e) {\n if (e || \"\" === e) {\n var r = e[a];\n if (r) return r.call(e);\n if (\"function\" == typeof e.next) return e;\n if (!isNaN(e.length)) {\n var o = -1,\n i = function next() {\n for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;\n return next.value = t, next.done = !0, next;\n };\n return i.next = i;\n }\n }\n throw new TypeError(_typeof(e) + \" is not iterable\");\n }\n return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", {\n value: GeneratorFunctionPrototype,\n configurable: !0\n }), o(GeneratorFunctionPrototype, \"constructor\", {\n value: GeneratorFunction,\n configurable: !0\n }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) {\n var e = \"function\" == typeof t && t.constructor;\n return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name));\n }, e.mark = function (t) {\n return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t;\n }, e.awrap = function (t) {\n return {\n __await: t\n };\n }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {\n return this;\n }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {\n void 0 === i && (i = Promise);\n var a = new AsyncIterator(wrap(t, r, n, o), i);\n return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {\n return t.done ? t.value : a.next();\n });\n }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () {\n return this;\n }), define(g, \"toString\", function () {\n return \"[object Generator]\";\n }), e.keys = function (t) {\n var e = Object(t),\n r = [];\n for (var n in e) r.push(n);\n return r.reverse(), function next() {\n for (; r.length;) {\n var t = r.pop();\n if (t in e) return next.value = t, next.done = !1, next;\n }\n return next.done = !0, next;\n };\n }, e.values = values, Context.prototype = {\n constructor: Context,\n reset: function reset(e) {\n if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);\n },\n stop: function stop() {\n this.done = !0;\n var t = this.tryEntries[0].completion;\n if (\"throw\" === t.type) throw t.arg;\n return this.rval;\n },\n dispatchException: function dispatchException(e) {\n if (this.done) throw e;\n var r = this;\n function handle(n, o) {\n return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o;\n }\n for (var o = this.tryEntries.length - 1; o >= 0; --o) {\n var i = this.tryEntries[o],\n a = i.completion;\n if (\"root\" === i.tryLoc) return handle(\"end\");\n if (i.tryLoc <= this.prev) {\n var c = n.call(i, \"catchLoc\"),\n u = n.call(i, \"finallyLoc\");\n if (c && u) {\n if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);\n if (this.prev < i.finallyLoc) return handle(i.finallyLoc);\n } else if (c) {\n if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);\n } else {\n if (!u) throw Error(\"try statement without catch or finally\");\n if (this.prev < i.finallyLoc) return handle(i.finallyLoc);\n }\n }\n }\n },\n abrupt: function abrupt(t, e) {\n for (var r = this.tryEntries.length - 1; r >= 0; --r) {\n var o = this.tryEntries[r];\n if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) {\n var i = o;\n break;\n }\n }\n i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);\n var a = i ? i.completion : {};\n return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a);\n },\n complete: function complete(t, e) {\n if (\"throw\" === t.type) throw t.arg;\n return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y;\n },\n finish: function finish(t) {\n for (var e = this.tryEntries.length - 1; e >= 0; --e) {\n var r = this.tryEntries[e];\n if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;\n }\n },\n \"catch\": function _catch(t) {\n for (var e = this.tryEntries.length - 1; e >= 0; --e) {\n var r = this.tryEntries[e];\n if (r.tryLoc === t) {\n var n = r.completion;\n if (\"throw\" === n.type) {\n var o = n.arg;\n resetTryEntry(r);\n }\n return o;\n }\n }\n throw Error(\"illegal catch attempt\");\n },\n delegateYield: function delegateYield(e, r, n) {\n return this.delegate = {\n iterator: values(e),\n resultName: r,\n nextLoc: n\n }, \"next\" === this.method && (this.arg = t), y;\n }\n }, e;\n}\nmodule.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(o);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","// TODO(Babel 8): Remove this file.\n\nvar runtime = require(\"../helpers/regeneratorRuntime\")();\nmodule.exports = runtime;\n\n// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","'use strict';\n\nvar possibleNames = [\n\t'BigInt64Array',\n\t'BigUint64Array',\n\t'Float32Array',\n\t'Float64Array',\n\t'Int16Array',\n\t'Int32Array',\n\t'Int8Array',\n\t'Uint16Array',\n\t'Uint32Array',\n\t'Uint8Array',\n\t'Uint8ClampedArray'\n];\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\n\nmodule.exports = function availableTypedArrays() {\n\tvar out = [];\n\tfor (var i = 0; i < possibleNames.length; i++) {\n\t\tif (typeof g[possibleNames[i]] === 'function') {\n\t\t\tout[out.length] = possibleNames[i];\n\t\t}\n\t}\n\treturn out;\n};\n","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);\n }\n}\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","import _typeof from \"./typeof.js\";\nimport assertThisInitialized from \"./assertThisInitialized.js\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n return assertThisInitialized(self);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n return self;\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}","import _typeof from \"./typeof.js\";\nexport default function toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}","export default function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + chunkId + \".rdflib.min.js\";\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.hmd = (module) => {\n\tmodule = Object.create(module);\n\tif (!module.children) module.children = [];\n\tObject.defineProperty(module, 'exports', {\n\t\tenumerable: true,\n\t\tset: () => {\n\t\t\tthrow new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id);\n\t\t}\n\t});\n\treturn module;\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript)\n\t\tscriptUrl = document.currentScript.src;\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) {\n\t\t\tvar i = scripts.length - 1;\n\t\t\twhile (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;\n\t\t}\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t792: 0\n};\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// JSONP chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[2]);\n\t\t\t} else {\n\t\t\t\tif(true) { // all chunks have JS\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));\n\t\t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n\t\t\t\t\t// start chunk loading\n\t\t\t\t\tvar url = __webpack_require__.p + __webpack_require__.u(chunkId);\n\t\t\t\t\t// create error before stack unwound to get useful stacktrace later\n\t\t\t\t\tvar error = new Error();\n\t\t\t\t\tvar loadingEnded = (event) => {\n\t\t\t\t\t\tif(__webpack_require__.o(installedChunks, chunkId)) {\n\t\t\t\t\t\t\tinstalledChunkData = installedChunks[chunkId];\n\t\t\t\t\t\t\tif(installedChunkData !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\t\tif(installedChunkData) {\n\t\t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n\t\t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n\t\t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n\t\t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n\t\t\t\t\t\t\t\terror.type = errorType;\n\t\t\t\t\t\t\t\terror.request = realSrc;\n\t\t\t\t\t\t\t\tinstalledChunkData[1](error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t__webpack_require__.l(url, loadingEnded, \"chunk-\" + chunkId, chunkId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n};\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n// no on chunks loaded\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunk$rdf\"] = self[\"webpackChunk$rdf\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","import ClassOrder from './class-order'\nimport Node from './node-internal'\nimport IndexedFormula from './store'\nimport { BlankNodeTermType } from './types'\nimport { BlankNode as TFBlankNode } from './tf-types'\n\n/**\n * An RDF blank node is a Node without a URI\n * @link https://rdf.js.org/data-model-spec/#blanknode-interface\n */\nexport default class BlankNode extends Node implements TFBlankNode {\n termType: typeof BlankNodeTermType = BlankNodeTermType;\n /**\n * The next unique identifier for blank nodes\n */\n static nextId: number = 0;\n static NTAnonymousNodePrefix: '_:' = '_:'\n\n private static getId (id: string | unknown): string {\n if (id) {\n if (typeof id !== 'string') {\n throw new Error('Bad id argument to new blank node: ' + id)\n }\n\n if (id.includes('#')) {\n // Is a URI with hash fragment\n let fragments = id.split('#')\n return fragments[fragments.length - 1]\n }\n\n return id\n }\n\n return 'n' + BlankNode.nextId++\n }\n\n classOrder = ClassOrder.BlankNode\n /** Whether this is a blank node */\n isBlank: number = 1\n /**\n * This type of node is a variable.\n *\n * Note that the existence of this property already indicates that it is a variable.\n */\n isVar = 1\n\n /**\n * Initializes this node\n * @param [id] The identifier for the blank node\n */\n constructor (id?: string | unknown) {\n super(BlankNode.getId(id))\n }\n\n /**\n * The identifier for the blank node\n */\n public get id (): string {\n return this.value\n }\n\n public set id (value: string) {\n this.value = value\n }\n\n compareTerm (other: BlankNode): number {\n if (this.classOrder < other.classOrder) {\n return -1\n }\n if (this.classOrder > other.classOrder) {\n return +1\n }\n if (this.id < other.id) {\n return -1\n }\n if (this.id > other.id) {\n return +1\n }\n return 0\n }\n\n /**\n * Gets a copy of this blank node in the specified formula\n * @param formula The formula\n */\n copy (formula: IndexedFormula): BlankNode { // depends on the formula\n var bnodeNew = new BlankNode()\n formula.copyTo(this, bnodeNew)\n return bnodeNew\n }\n\n toCanonical () {\n return BlankNode.NTAnonymousNodePrefix + this.value\n }\n\n toString () {\n return BlankNode.NTAnonymousNodePrefix + this.id\n }\n}\n","import NamedNode from './named-node';\n\nexport default {\n boolean: new NamedNode('http://www.w3.org/2001/XMLSchema#boolean'),\n dateTime: new NamedNode('http://www.w3.org/2001/XMLSchema#dateTime'),\n decimal: new NamedNode('http://www.w3.org/2001/XMLSchema#decimal'),\n double: new NamedNode('http://www.w3.org/2001/XMLSchema#double'),\n integer: new NamedNode('http://www.w3.org/2001/XMLSchema#integer'),\n langString: new NamedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#langString'),\n string: new NamedNode('http://www.w3.org/2001/XMLSchema#string'),\n}\n","import ClassOrder from './class-order'\nimport RDFlibNamedNode from './named-node'\nimport Node from './node-internal'\nimport {\n FromValueReturns,\n LiteralTermType,\n ValueType\n} from './types'\nimport { isLiteral } from './utils/terms'\nimport XSD from './xsd-internal'\nimport { Literal as TFLiteral, Term } from './tf-types'\n\n/**\n * An RDF literal, containing some value which isn't expressed as an IRI.\n * @link https://rdf.js.org/data-model-spec/#literal-interface\n */\nexport default class Literal extends Node implements TFLiteral {\n termType: typeof LiteralTermType = LiteralTermType\n\n classOrder = ClassOrder.Literal\n\n /**\n * The literal's datatype as a named node\n */\n datatype: RDFlibNamedNode = XSD.string\n\n isVar = 0\n\n /**\n * The language for the literal\n */\n language: string = ''\n\n /**\n * Initializes a literal\n * @param value - The literal's lexical value\n * @param language - The language for the literal. Defaults to ''.\n * @param datatype - The literal's datatype as a named node. Defaults to xsd:string.\n */\n constructor (value: string, language?: string | null, datatype?) {\n super(value)\n\n if (language) {\n this.language = language\n this.datatype = XSD.langString\n } else if (datatype) {\n this.datatype = RDFlibNamedNode.fromValue(datatype)\n } else {\n this.datatype = XSD.string\n }\n }\n\n /**\n * Gets a copy of this literal\n */\n copy (): Literal {\n return new Literal(this.value, this.lang, this.datatype)\n }\n\n /**\n * Gets whether two literals are the same\n * @param other The other statement\n */\n equals (other: Term): boolean {\n if (!other) {\n return false\n }\n\n return (this.termType === other.termType) &&\n (this.value === other.value) &&\n (this.language === (other as Literal).language) &&\n ((!this.datatype && !(other as Literal).datatype) ||\n (this.datatype && this.datatype.equals((other as Literal).datatype)))\n }\n\n /**\n * The language for the literal\n * @deprecated use {language} instead\n */\n get lang (): string {\n return this.language\n }\n\n set lang (language: string) {\n this.language = language || ''\n }\n\n toNT(): string {\n return Literal.toNT(this)\n }\n\n /** Serializes a literal to an N-Triples string */\n static toNT (literal: Literal): string {\n if (typeof literal.value === 'number') {\n return '' + literal.value\n } else if (typeof literal.value !== 'string') {\n throw new Error('Value of RDF literal is not string or number: ' +\n literal.value)\n }\n var str = literal.value\n // #x22 (\"), #x5C (\\), #x0A (\\n) and #xD (\\r) are disallowed and need to be replaced\n // see https://www.w3.org/TR/n-triples/#grammar-production-STRING_LITERAL_QUOTE\n str = str.replace(/\\\\/g, '\\\\\\\\')\n str = str.replace(/\\\"/g, '\\\\\"')\n str = str.replace(/\\n/g, '\\\\n')\n str = str.replace(/\\r/g, '\\\\r')\n str = '\"' + str + '\"'\n\n if (literal.language) {\n str += '@' + literal.language\n } else if (!literal.datatype.equals(XSD.string)) {\n // Only add datatype if it's not a string\n str += '^^' + literal.datatype.toCanonical()\n }\n return str\n }\n\n toString () {\n return '' + this.value\n }\n\n /**\n * Builds a literal node from a boolean value\n * @param value - The value\n */\n static fromBoolean (value: boolean): Literal {\n let strValue = value ? '1' : '0'\n return new Literal(strValue, null, XSD.boolean)\n }\n\n /**\n * Builds a literal node from a date value\n * @param value The value\n */\n static fromDate(value: Date): Literal {\n if (!(value instanceof Date)) {\n throw new TypeError('Invalid argument to Literal.fromDate()')\n }\n let d2 = function (x) {\n return ('' + (100 + x)).slice(1, 3)\n }\n let date = '' + value.getUTCFullYear() + '-' + d2(value.getUTCMonth() + 1) +\n '-' + d2(value.getUTCDate()) + 'T' + d2(value.getUTCHours()) + ':' +\n d2(value.getUTCMinutes()) + ':' + d2(value.getUTCSeconds()) + 'Z'\n return new Literal(date, null, XSD.dateTime)\n }\n\n /**\n * Builds a literal node from a number value\n * @param value - The value\n */\n static fromNumber(value: number): Literal {\n if (typeof value !== 'number') {\n throw new TypeError('Invalid argument to Literal.fromNumber()')\n }\n let datatype: RDFlibNamedNode\n const strValue = value.toString()\n if (strValue.indexOf('e') < 0 && Math.abs(value) <= Number.MAX_SAFE_INTEGER) {\n datatype = Number.isInteger(value) ? XSD.integer : XSD.decimal\n } else {\n datatype = XSD.double\n }\n return new Literal(strValue, null, datatype)\n }\n\n /**\n * Builds a literal node from an input value\n * @param value - The input value\n */\n static fromValue(value: ValueType): T {\n if (isLiteral(value)) {\n return value as unknown as T\n }\n switch (typeof value) {\n case 'object':\n if (value instanceof Date) {\n return Literal.fromDate(value) as unknown as T\n }\n case 'boolean':\n return Literal.fromBoolean(value as boolean) as unknown as T\n case 'number':\n return Literal.fromNumber(value as number) as unknown as T\n case 'string':\n return new Literal(value) as unknown as T\n }\n\n throw new Error(\"Can't make literal from \" + value + ' of type ' +\n typeof value)\n }\n}\n","import RdflibBlankNode from './blank-node'\nimport ClassOrder from './class-order'\nimport Literal from './literal'\nimport Node from './node-internal'\nimport {\n Bindings,\n CollectionTermType,\n FromValueReturns,\n ValueType\n} from './types'\nimport Variable from './variable'\nimport { isTerm } from './utils/terms'\nimport { Term } from './tf-types'\n\n/**\n * Creates an RDF Node from a native javascript value.\n * RDF Nodes are returned unchanged, undefined returned as itself.\n * Arrays return Collections.\n * Strings, numbers and booleans return Literals.\n * @param value {Node|Date|String|Number|Boolean|Undefined}\n * @return {Node|Collection}\n */\nexport function fromValue = any, C extends Node = any>(value: ValueType): T {\n if (typeof value === 'undefined' || value === null) {\n return value as T\n }\n\n if (isTerm(value)) { // a Node subclass or a Collection\n return value as T\n }\n\n if (Array.isArray(value)) {\n return new Collection(value) as T\n }\n\n return Literal.fromValue(value)\n}\n\n/**\n * A collection of other RDF nodes\n *\n * Use generic T to control the contents of the array.\n */\nexport default class Collection<\n T extends Node = Node | RdflibBlankNode | Collection | Literal | Variable\n> extends Node implements Term {\n static termType: typeof CollectionTermType = CollectionTermType\n termType: typeof CollectionTermType = CollectionTermType\n\n classOrder = ClassOrder.Collection\n closed: boolean = false\n compareTerm = RdflibBlankNode.prototype.compareTerm\n /**\n * The nodes in this collection\n */\n elements: T[] = []\n isVar = 0\n\n constructor (initial?: ReadonlyArray) {\n super((RdflibBlankNode.nextId++).toString())\n\n if (initial && initial.length > 0) {\n initial.forEach(element => {\n this.elements.push(fromValue(element))\n })\n }\n }\n\n public get id (): string {\n return this.value\n }\n\n public set id (value) {\n this.value = value\n }\n\n /**\n * Appends an element to this collection\n * @param element - The new element\n */\n append (element: T): number {\n return this.elements.push(element)\n }\n\n /**\n * Closes this collection\n */\n close (): boolean {\n this.closed = true\n return this.closed\n }\n\n /**\n * Removes the first element from the collection (and return it)\n */\n shift (): T | undefined {\n return this.elements.shift()\n }\n\n /**\n * Creates a new Collection with the substituting bindings applied\n * @param bindings - The bindings to substitute\n */\n substitute (bindings: Bindings) {\n const elementsCopy = this.elements.map((ea) => ea.substitute(bindings))\n\n return new Collection(elementsCopy) as Collection | Literal | Variable>\n }\n\n toNT () {\n return Collection.toNT(this)\n }\n\n static toNT (collection) {\n // return '(' + collection.elements.map(x => x.toNT()).join(' ') + ')'\n // As lists are not in NT and toNT() must be a reversible function, we kludge it for a list\n return RdflibBlankNode.NTAnonymousNodePrefix + collection.id\n }\n\n /**\n * Serializes the collection to a string.\n * Surrounded by (parentheses) and separated by spaces.\n */\n toString () {\n return '(' + this.elements.join(' ') + ')'\n }\n\n /**\n * Prepends the specified element to the collection's front\n * @param element - The element to prepend\n */\n unshift (element: T): number {\n return this.elements.unshift(element)\n }\n}\n","import Node from './node-internal'\nimport { EmptyTermType } from './types'\nimport { Term } from './tf-types'\n\n/**\n* An empty node\n*/\nexport default class Empty extends Node implements Term {\n termType: typeof EmptyTermType = EmptyTermType\n\n constructor () {\n super('')\n }\n\n toString () {\n return '()'\n }\n}\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n _next(undefined);\n });\n };\n}","// Prevents circular dependencies between data-factory-internal and statement\n\nimport NamedNode from '../named-node'\n\nexport const defaultGraphURI = 'chrome:theSession'\nexport const defaultGraphNode = new NamedNode(defaultGraphURI)\n","import Node from './node-internal'\nimport { DefaultGraphTermType } from './types'\nimport { DefaultGraph as TFDefaultGraph } from './tf-types'\nimport { defaultGraphURI } from './utils/default-graph-uri'\n\n/** The RDF default graph */\nexport default class DefaultGraph extends Node implements TFDefaultGraph {\n value: '' = '';\n termType: typeof DefaultGraphTermType = DefaultGraphTermType;\n uri = defaultGraphURI\n\n constructor () {\n super('')\n }\n\n toCanonical () {\n return this.value\n }\n\n toString () {\n return 'DefaultGraph';\n }\n}\n\nexport function isDefaultGraph(object: any): object is DefaultGraph {\n return !!object && object.termType === DefaultGraphTermType;\n}\n","import Node from './node-internal'\nimport {\n Bindings,\n GraphType,\n ObjectType,\n PredicateType,\n SubjectType,\n DefaultGraphTermType,\n} from './types'\nimport DefaultGraphNode, { isDefaultGraph } from './default-graph'\nimport { Quad, DefaultGraph } from './tf-types'\n\nconst defaultGraph = new DefaultGraphNode()\n\n/** A Statement represents an RDF Triple or Quad. */\nexport default class Statement<\n S extends SubjectType = SubjectType,\n P extends PredicateType = PredicateType,\n O extends ObjectType = ObjectType,\n G extends GraphType = GraphType\n >\n implements Quad {\n\n /** The subject of the triple. What the Statement is about. */\n subject: S\n\n /** The relationship which is asserted between the subject and object */\n predicate: P\n\n /** The thing or data value which is asserted to be related to the subject */\n object: O\n\n /**\n * The graph param is a named node of the document in which the triple when\n * it is stored on the web.\n */\n graph: G | DefaultGraph\n\n /**\n * Construct a new statement\n *\n * @param subject - The subject of the triple. What the fact is about\n * @param predicate - The relationship which is asserted between the subject and object\n * @param object - The thing or data value which is asserted to be related to the subject\n * @param {NamedNode} graph - The document where the triple is or was or will be stored on the web.\n *\n * The graph param is a named node of the document in which the triple when it is stored\n * on the web. It exists because when you have read data from various places in the web,\n * the “graph” tells you _why_ you have the triple. (At the moment, it is just the\n * document, in future it could be an inference step)\n *\n * When you do UpdateManager.update() then the graph’s of all the statements must be the same,\n * and give the document you are patching. In future, we may have a more\n * powerful update() which can update more than one document.\n */\n constructor (\n subject: S,\n predicate: P,\n object: O,\n graph?: G | DefaultGraph,\n ) {\n this.subject = Node.fromValue(subject)\n this.predicate = Node.fromValue(predicate)\n this.object = Node.fromValue(object)\n this.graph = graph == undefined ? defaultGraph : Node.fromValue(graph) // property currently used by rdflib\n }\n\n /** Alias for graph, favored by Tim */\n get why () {\n return this.graph\n }\n\n set why (g) {\n this.graph = g\n }\n\n /**\n * Checks whether two statements are the same\n * @param other - The other statement\n */\n equals (other: Quad): boolean {\n return (\n other.subject.equals(this.subject) &&\n other.predicate.equals(this.predicate) &&\n other.object.equals(this.object) &&\n other.graph.equals(this.graph)\n )\n }\n\n /**\n * Creates a statement with the bindings substituted\n * @param bindings The bindings\n */\n substitute (bindings: Bindings): Statement {\n const y = new Statement(\n this.subject.substitute(bindings),\n this.predicate.substitute(bindings),\n this.object.substitute(bindings),\n isDefaultGraph(this.graph) ? this.graph :\n (this.graph as G).substitute(bindings)\n ) // 2016\n // console.log('@@@ statement substitute:' + y)\n return y\n }\n\n /** Creates a canonical string representation of this statement. */\n toCanonical (): string {\n let terms = [\n this.subject.toCanonical(),\n this.predicate.toCanonical(),\n this.object.toCanonical()\n ]\n if (this.graph && this.graph.termType !== DefaultGraphTermType) {\n terms.push(this.graph.toCanonical())\n }\n return terms.join(' ') + ' .'\n }\n\n /** Creates a n-triples string representation of this statement */\n toNT (): string {\n return [\n this.subject.toNT(),\n this.predicate.toNT(),\n this.object.toNT(),\n ].join(' ') + ' .'\n }\n\n /** Creates a n-quads string representation of this statement */\n toNQ (): string {\n return [\n this.subject.toNT(),\n this.predicate.toNT(),\n this.object.toNT(),\n isDefaultGraph(this.graph) ? '' : (this.graph as G).toNT()\n ].join(' ') + ' .'\n }\n\n /** Creates a string representation of this statement */\n toString (): string {\n /*\n return [\n this.subject.toString(),\n this.predicate.toString(),\n this.object.toString(),\n ].join(' ') + ' .'\n */\n return this.toNT()\n }\n}\n","import ClassOrder from './class-order'\nimport Node from './node-internal'\nimport { VariableTermType } from './types'\nimport * as Uri from './uri'\nimport { Variable as TFVariable } from './tf-types'\n\n/**\n* Variables are placeholders used in patterns to be matched.\n* In cwm they are symbols which are the formula's list of quantified variables.\n* In sparql they are not visibly URIs. Here we compromise, by having\n* a common special base URI for variables. Their names are uris,\n* but the ? notation has an implicit base uri of 'varid:'\n*/\nexport default class Variable extends Node implements TFVariable {\n termType: typeof VariableTermType = VariableTermType\n\n /** The base string for a variable's name */\n base = 'varid:'\n classOrder = ClassOrder.Variable\n isVar = 1\n /** The unique identifier of this variable */\n uri: string\n\n /**\n * Initializes this variable\n * @param name The variable's name\n */\n constructor (name = '') {\n super(name)\n this.base = 'varid:'\n this.uri = Uri.join(name, this.base)\n }\n\n equals (other) {\n if (!other) {\n return false\n }\n\n return (this.termType === other.termType) && (this.value === other.value)\n }\n\n hashString () {\n return this.toString()\n }\n\n substitute (bindings) {\n var ref\n return (ref = bindings[this.toNT()]) != null ? ref : this\n }\n\n toString () {\n return Variable.toString(this)\n }\n\n static toString (variable) {\n if (variable.uri.slice(0, variable.base.length) === variable.base) {\n return `?${variable.uri.slice(variable.base.length)}`\n }\n\n return `?${variable.uri}`\n }\n}\n","import Literal from '../literal'\nimport Statement from '../statement'\nimport NamedNode from '../named-node'\nimport BlankNode from '../blank-node'\nimport Variable from '../variable'\nimport DefaultGraph from '../default-graph'\nimport {\n BlankNode as TFBlankNode,\n RdfJsDataFactory,\n Literal as TFLiteral,\n NamedNode as TFNamedNode,\n Quad,\n Term,\n Variable as TFVariable,\n} from '../tf-types'\n\nexport type Comparable = Term | TFNamedNode | TFBlankNode | TFLiteral | Quad | undefined | null\n\nexport type DefaultFactoryTypes = NamedNode | BlankNode | Literal | Variable | Statement\n\nexport type Indexable = number | string\n\nexport type Namespace = (term:string) => TFNamedNode\n\n/** A set of features that may be supported by a Data Factory */\nexport type SupportTable = Record\n\nexport type TFIDFactoryTypes = TFNamedNode | TFBlankNode | TFLiteral | Quad | TFVariable | Term\n\nexport enum Feature {\n /** Whether the factory supports termType:Collection terms */\n collections = \"COLLECTIONS\",\n /** Whether the factory supports termType:DefaultGraph terms */\n defaultGraphType = \"DEFAULT_GRAPH_TYPE\",\n /** Whether the factory supports equals on produced instances */\n equalsMethod = \"EQUALS_METHOD\",\n /** Whether the factory can create a unique idempotent identifier for the given term. */\n id = \"ID\",\n /**\n * Whether the factory will return the same instance for subsequent calls.\n * This implies `===`, which means methods like `indexOf` can be used.\n */\n identity = \"IDENTITY\",\n /** Whether the factory supports mapping ids back to instances (should adhere to the identity setting) */\n reversibleId = \"REVERSIBLE_ID\",\n /** Whether the factory supports termType:Variable terms */\n variableType = \"VARIABLE_TYPE\",\n}\n\n/**\n * Defines a DataFactory as used in rdflib, based on the RDF/JS: Data model specification,\n * but with additional extensions\n *\n * bnIndex is optional but useful.\n */\nexport interface DataFactory<\n FactoryTypes = DefaultFactoryTypes,\n IndexType = Indexable\n> extends RdfJsDataFactory {\n /**\n * BlankNode index\n * @private\n */\n bnIndex?: number\n\n supports: SupportTable\n\n namedNode(value: string): NamedNode\n\n blankNode(value?: string): BlankNode\n\n literal(value: string, languageOrDatatype?: string | TFNamedNode): Literal\n\n variable(value: string): Variable,\n\n defaultGraph(): DefaultGraph,\n\n isQuad(obj: any): obj is Statement\n\n equals(a: Comparable, b: Comparable): boolean\n\n toNQ(term: Term | FactoryTypes): string\n\n quad(\n subject: Term,\n predicate: Term,\n object: Term,\n graph?: Term,\n ): Statement;\n\n quadToNQ(term: Statement | Quad): string\n\n termToNQ(term: Term): string\n\n /**\n * Generates a unique session-idempotent identifier for the given object.\n *\n * @example NQ serialization (reversible from value)\n * @example MD5 hash of termType + value (irreversible from value, map needed)\n *\n * @return {Indexable} A unique value which must also be a valid JS object key type.\n */\n id(obj: Term | FactoryTypes): IndexType\n}\n","import BlankNode from '../blank-node'\nimport Literal from '../literal'\nimport NamedNode from '../named-node'\nimport Statement from '../statement'\nimport Variable from '../variable'\nimport {\n SubjectType,\n PredicateType,\n ObjectType,\n GraphType,\n EmptyTermType,\n DefaultGraphTermType,\n VariableTermType,\n BlankNodeTermType,\n LiteralTermType,\n NamedNodeTermType,\n CollectionTermType,\n GraphTermType,\n} from '../types'\nimport DefaultGraph from '../default-graph'\nimport {\n Comparable,\n DataFactory,\n DefaultFactoryTypes,\n Feature,\n} from './factory-types'\nimport { isQuad, isTerm } from '../utils/terms'\nimport { NamedNode as TFNamedNode, Quad, Term } from '../tf-types'\nimport Collection from \"../collection\";\n\nexport { defaultGraphURI } from '../utils/default-graph-uri'\n\n/**\n * Gets the default graph\n */\nconst defaultGraph = new DefaultGraph()\n\n/** A basic internal RDFlib datafactory, which does not support Collections */\nconst CanonicalDataFactory: DataFactory = {\n\n supports: {\n [Feature.collections]: false,\n [Feature.defaultGraphType]: false,\n [Feature.equalsMethod]: true,\n [Feature.identity]: false,\n [Feature.id]: true,\n [Feature.reversibleId]: false,\n [Feature.variableType]: true,\n },\n\n /**\n * Creates a new blank node\n * @param value - The blank node's identifier\n */\n blankNode(value?: string): BlankNode {\n return new BlankNode(value)\n },\n\n defaultGraph: () => defaultGraph,\n\n /**\n * Compares to (rdf) objects for equality.\n */\n equals(a: Comparable, b: Comparable): boolean {\n if (a === b || !a || !b) {\n return true\n }\n\n if (isQuad(a) || isQuad(b)) {\n if (isQuad(a) && isQuad(b)) {\n return (\n this.equals(a.subject, b.subject) &&\n this.equals(a.predicate, b.predicate) &&\n this.equals(a.object, b.object) &&\n this.equals(a.graph, b.graph)\n )\n }\n\n return false\n }\n\n if (isTerm(a) && isTerm(b)) {\n return this.id(a) === this.id(b)\n }\n\n return false\n },\n\n /**\n * Generates a uniquely identifiably *idempotent* string for the given {term}.\n *\n * Equivalent to [[Term.hashString]]\n *\n * @example Use this to associate data with a term in an object\n * { obj[id(term)] = \"myData\" }\n */\n id (term: Term | Statement | undefined): string {\n if (!term) {\n return 'undefined'\n }\n\n if (isQuad(term)) {\n return this.quadToNQ(term)\n }\n\n switch (term.termType) {\n case DefaultGraphTermType:\n return 'defaultGraph'\n case VariableTermType:\n return Variable.toString(term)\n default:\n const nq = this.termToNQ(term)\n if (nq) {\n return nq\n }\n\n throw new Error(`Can't id term with type '${term.termType}'`)\n }\n },\n\n isQuad (obj: any): obj is Statement {\n return obj instanceof Statement\n },\n\n /**\n * Creates a new literal node. Does some JS literal parsing for ease of use.\n * @param value - The lexical value\n * @param languageOrDatatype - Either the language or the datatype\n */\n literal(\n value: string | number | boolean | Date,\n languageOrDatatype?: string | TFNamedNode\n ): Literal {\n if (typeof value !== \"string\" && !languageOrDatatype) {\n return Literal.fromValue(value)\n }\n\n const strValue = typeof value === 'string' ? value : '' + value\n if (typeof languageOrDatatype === 'string') {\n if (languageOrDatatype.indexOf(':') === -1) {\n return new Literal(strValue, languageOrDatatype)\n } else {\n return new Literal(strValue, null, this.namedNode(languageOrDatatype))\n }\n } else {\n return new Literal(strValue, null, languageOrDatatype)\n }\n },\n\n /**\n * Creates a new named node\n * @param value - The new named node\n */\n namedNode(value: string): NamedNode {\n return new NamedNode(value)\n },\n\n /**\n * Creates a new statement\n * @param subject - The subject\n * @param predicate - The predicate\n * @param object - The object\n * @param graph - The containing graph\n */\n quad<\n S extends SubjectType = SubjectType,\n P extends PredicateType = PredicateType,\n O extends ObjectType = ObjectType,\n G extends GraphType = GraphType\n >(subject: S, predicate: P, object: O, graph?: G): Statement {\n return new Statement(subject, predicate, object, graph || defaultGraph)\n },\n\n /**\n * Creates a new statement\n * @param subject - The subject\n * @param predicate - The predicate\n * @param object - The object\n * @param graph - The containing graph\n */\n triple(\n subject: Term | SubjectType,\n predicate: Term | PredicateType,\n object: Term | ObjectType,\n graph?: Term | GraphType\n ): Statement {\n return this.quad(subject, predicate, object, graph)\n },\n\n quadToNQ(q: Statement | Quad): string {\n return `${this.termToNQ(q.subject)} ${this.termToNQ(q.predicate)} ${this.termToNQ(q.object)} ${this.termToNQ(q.graph)} .`;\n },\n\n /** Stringify a {term} to n-quads serialization. */\n termToNQ(term: Term): string {\n switch (term.termType) {\n case BlankNodeTermType:\n return '_:' + term.value\n case DefaultGraphTermType:\n return ''\n case EmptyTermType:\n return ''\n case LiteralTermType:\n return Literal.toNT(term as Literal)\n case GraphTermType:\n case NamedNodeTermType:\n return '<' + term.value + '>'\n case CollectionTermType:\n return '(' + (term as Collection).elements.map(t => this.termToNQ(t)).join(' ') + ')'\n default:\n throw new Error(`Can't serialize nonstandard term type (was '${term.termType}')`)\n }\n },\n\n /** Convert an rdf object (term or quad) to n-quads serialization. */\n toNQ (term: Term | (DefaultFactoryTypes & Variable)): string {\n if (this.isQuad(term)) {\n return this.quadToNQ(term);\n }\n\n return this.termToNQ(term);\n },\n\n /**\n * Creates a new variable\n * @param name - The name for the variable\n */\n variable(name?: string): Variable {\n return new Variable(name)\n },\n}\n\n/** Contains the factory methods as defined in the spec, plus id */\nexport default CanonicalDataFactory\n","import RDFlibNamedNode from './named-node'\nimport { RdfJsDataFactory, NamedNode } from './tf-types'\n\n/**\n * Gets a namespace for the specified namespace's URI\n * @param nsuri - The URI for the namespace\n * @param [factory] - The factory for creating named nodes with\n */\nexport default function Namespace (nsuri: string, factory?: RdfJsDataFactory): (ln: string) => NamedNode {\n const dataFactory = factory || { namedNode: (value) => new RDFlibNamedNode(value) as NamedNode }\n\n return function (ln: string): NamedNode {\n return dataFactory.namedNode(nsuri + (ln || ''))\n }\n}\n","import CanonicalDataFactory from \"./factories/canonical-data-factory\";\n\nexport function createXSD(localFactory = CanonicalDataFactory) {\n return {\n boolean: localFactory.namedNode(\"http://www.w3.org/2001/XMLSchema#boolean\"),\n dateTime: localFactory.namedNode(\n \"http://www.w3.org/2001/XMLSchema#dateTime\"\n ),\n decimal: localFactory.namedNode(\"http://www.w3.org/2001/XMLSchema#decimal\"),\n double: localFactory.namedNode(\"http://www.w3.org/2001/XMLSchema#double\"),\n integer: localFactory.namedNode(\"http://www.w3.org/2001/XMLSchema#integer\"),\n langString: localFactory.namedNode(\n \"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString\"\n ),\n string: localFactory.namedNode(\"http://www.w3.org/2001/XMLSchema#string\"),\n };\n}\n\nconst defaultXSD = createXSD(CanonicalDataFactory);\n\nexport default defaultXSD;\n","/* Serialization of RDF Graphs\n**\n** Tim Berners-Lee 2006\n** This is was http://dig.csail.mit.edu/2005/ajar/ajaw/js/rdf/serialize.js\n** This is or was https://github.com/linkeddata/rdflib.js/blob/main/src/serializer.js\n** Licence: MIT\n*/\nimport NamedNode from './named-node'\nimport BlankNode from './blank-node'\nimport * as Uri from './uri'\nimport * as Util from './utils-js'\nimport CanonicalDataFactory from './factories/canonical-data-factory'\nimport { createXSD } from './xsd'\nimport solidNs from 'solid-namespace'\nimport * as ttl2jsonld from '@frogcat/ttl2jsonld'\n\n\nexport default function createSerializer(store) {\n return new Serializer(store);\n};\n\nexport class Serializer {\n constructor(store) {\n this.flags = ''\n this.base = null\n\n this.prefixes = [] // suggested prefixes\n this.namespaces = [] // complementary\n const nsKeys = Object.keys(solidNs())\n for (const i in nsKeys) {\n const uri = solidNs()[nsKeys[i]]('')\n const prefix = nsKeys[i]\n this.prefixes[uri] = prefix\n this.namespaces[prefix] = uri\n }\n\n this.suggestPrefix('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#') // XML code assumes this!\n this.suggestPrefix('xml', 'reserved:reservedForFutureUse') // XML reserves xml: in the spec.\n\n this.namespacesUsed = [] // Count actually used and so needed in @prefixes\n this.keywords = ['a'] // The only one we generate at the moment\n this.prefixchars = 'abcdefghijklmnopqustuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'\n this.incoming = null // Array not calculated yet\n this.formulas = [] // remembering original formulae from hashes\n this.store = store\n this.rdfFactory = store.rdfFactory || CanonicalDataFactory\n this.xsd = createXSD(this.rdfFactory)\n }\n\n setBase(base) {\n this.base = base;\n return this\n }\n\n setFlags(flags) {\n this.flags = flags || '';\n return this\n }\n\n toStr(x) {\n var s = x.toNT()\n if (x.termType === 'Graph') {\n this.formulas[s] = x // remember as reverse does not work\n }\n return s\n }\n\n fromStr(s) {\n if (s[0] === '{') {\n var x = this.formulas[s]\n if (!x) console.log('No formula object for ' + s)\n return x\n }\n return this.store.fromNT(s)\n }\n\n /**\n * Defines a set of [prefix, namespace] pairs to be used by this Serializer instance.\n * Overrides previous prefixes if any\n * @param namespaces\n * @return {Serializer}\n */\n setNamespaces(namespaces) {\n for (var px in namespaces) {\n this.setPrefix(px, namespaces[px])\n }\n return this\n }\n\n /**\n * Defines a namespace prefix, overriding any existing prefix for that URI\n * @param prefix\n * @param uri\n */\n setPrefix(prefix, uri) {\n if (prefix.slice(0, 7) === 'default') return // Try to weed these out\n if (prefix.slice(0, 2) === 'ns') return // From others inferior algos\n if (!prefix || !uri) return // empty strings not suitable\n\n // remove any existing prefix targeting this uri\n // for (let existingPrefix in this.namespaces) {\n // if (this.namespaces[existingPrefix] == uri)\n // delete this.namespaces[existingPrefix];\n // }\n\n // remove any existing mapping for this prefix\n for (let existingNs in this.prefixes) {\n if (this.prefixes[existingNs] == prefix)\n delete this.prefixes[existingNs];\n }\n\n this.prefixes[uri] = prefix\n this.namespaces[prefix] = uri\n }\n\n\n /* Accumulate Namespaces\n **\n ** These are only hints. If two overlap, only one gets used\n ** There is therefore no guarantee in general.\n */\n suggestPrefix(prefix, uri) {\n if (prefix.slice(0, 7) === 'default') return // Try to weed these out\n if (prefix.slice(0, 2) === 'ns') return // From others inferior algos\n if (!prefix || !uri) return // empty strings not suitable\n if (prefix in this.namespaces || uri in this.prefixes) return // already used\n this.prefixes[uri] = prefix\n this.namespaces[prefix] = uri\n }\n\n // Takes a namespace -> prefix map\n suggestNamespaces(namespaces) {\n for (var px in namespaces) {\n this.suggestPrefix(px, namespaces[px])\n }\n return this\n }\n\n checkIntegrity() {\n var p, ns\n for (p in this.namespaces) {\n if (this.prefixes[this.namespaces[p]] !== p) {\n throw new Error('Serializer integity error 1: ' + p + ', ' +\n this.namespaces[p] + ', ' + this.prefixes[this.namespaces[p]] + '!')\n }\n }\n for (ns in this.prefixes) {\n if (this.namespaces[this.prefixes[ns]] !== ns) {\n throw new Error('Serializer integity error 2: ' + ns + ', ' +\n this.prefixs[ns] + ', ' + this.namespaces[this.prefixes[ns]] + '!')\n }\n }\n }\n\n // Make up an unused prefix for a random namespace\n makeUpPrefix(uri) {\n var p = uri\n function canUseMethod (pp) {\n if (!this.validPrefix.test(pp)) return false // bad format\n if (pp === 'ns') return false // boring\n if (pp in this.namespaces) return false // already used\n this.prefixes[uri] = pp\n this.namespaces[pp] = uri\n return pp\n }\n var canUse = canUseMethod.bind(this)\n\n if ('#/'.indexOf(p[p.length - 1]) >= 0) p = p.slice(0, -1)\n var slash = p.lastIndexOf('/')\n if (slash >= 0) p = p.slice(slash + 1)\n var i = 0\n while (i < p.length) {\n if (this.prefixchars.indexOf(p[i])) {\n i++\n } else {\n break\n }\n }\n p = p.slice(0, i)\n\n if (p.length < 6 && (canUse(p))) return p // exact is best\n if (canUse(p.slice(0, 3))) return p.slice(0, 3)\n if (canUse(p.slice(0, 2))) return p.slice(0, 2)\n if (canUse(p.slice(0, 4))) return p.slice(0, 4)\n if (canUse(p.slice(0, 1))) return p.slice(0, 1)\n if (canUse(p.slice(0, 5))) return p.slice(0, 5)\n if (!this.validPrefix.test(p)) {\n p = 'n' // Otherwise the loop below may never termimnate\n }\n for (var j = 0; ; j++) if (canUse(p.slice(0, 3) + j)) return p.slice(0, 3) + j\n }\n\n rootSubjects(sts) {\n var incoming = {}\n var subjects = {}\n var allBnodes = {}\n\n /* This scan is to find out which nodes will have to be the roots of trees\n ** in the serialized form. This will be any symbols, and any bnodes\n ** which hve more or less than one incoming arc, and any bnodes which have\n ** one incoming arc but it is an uninterrupted loop of such nodes back to itself.\n ** This should be kept linear time with repect to the number of statements.\n ** Note it does not use any indexing of the store.\n */\n for (var i = 0; i < sts.length; i++) {\n var st = sts[i]\n var checkMentions = function (x) {\n if (!incoming.hasOwnProperty(x)) incoming[x] = []\n incoming[x].push(st.subject) // List of things which will cause this to be printed\n }\n var st2 = [st.subject, st.predicate, st.object]\n st2.map(function (y) {\n if (y.termType === 'BlankNode') {\n allBnodes[y.toNT()] = true\n } else if (y.termType === 'Collection') {\n y.elements.forEach(function (z) {\n checkMentions(z) // bnodes in collections important\n })\n }\n })\n checkMentions(sts[i].object)\n var ss = subjects[this.toStr(st.subject)] // Statements with this as subject\n if (!ss) ss = []\n ss.push(st)\n subjects[this.toStr(st.subject)] = ss // Make hash. @@ too slow for formula?\n }\n\n var roots = []\n for (var xNT in subjects) {\n if (!subjects.hasOwnProperty(xNT)) continue\n var y = this.fromStr(xNT)\n if ((y.termType !== 'BlankNode') || !incoming[y] || (incoming[y].length !== 1)) {\n roots.push(y)\n continue\n }\n }\n this.incoming = incoming // Keep for serializing @@ Bug for nested formulas\n\n // Now do the scan using existing roots\n var rootsHash = {}\n for (var k = 0; k < roots.length; k++) {\n rootsHash[roots[k].toNT()] = true\n }\n return {'roots': roots, 'subjects': subjects,\n 'rootsHash': rootsHash, 'incoming': incoming}\n }\n\n // //////////////////////////////////////////////////////\n\n toN3(f) {\n return this.statementsToN3(f.statements)\n }\n\n _notQNameChars = '\\t\\r\\n !\"#$%&\\'()*.,+/;<=>?@[\\\\]^`{|}~'\n _notNameChars =\n (this._notQNameChars + ':')\n\n explicitURI(uri) {\n if (this.flags.indexOf('r') < 0 && this.base) {\n uri = Uri.refTo(this.base, uri)\n } else if (this.flags.indexOf('u') >= 0) { // Unicode encoding NTriples style\n uri = backslashUify(uri)\n } else {\n uri = hexify(decodeURI(uri))\n }\n return '<' + uri + '>'\n }\n\n statementsToNTriples(sts) {\n var sorted = sts.slice()\n sorted.sort()\n var str = ''\n var rdfns = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'\n var self = this\n var kb = this.store\n var factory = this.rdfFactory\n var termToNT = function (x) {\n if (x.termType !== 'Collection') {\n return self.atomicTermToN3(x)\n }\n var list = x.elements\n var rest = kb.sym(rdfns + 'nill')\n for (var i = list.length - 1; i >= 0; i--) {\n var bnode = factory.blankNode()\n str += termToNT(bnode) + ' ' + termToNT(kb.sym(rdfns + 'first')) + ' ' + termToNT(list[i]) + '.\\n'\n str += termToNT(bnode) + ' ' + termToNT(kb.sym(rdfns + 'rest')) + ' ' + termToNT(rest) + '.\\n'\n rest = bnode\n }\n return self.atomicTermToN3(rest)\n }\n for (var i = 0; i < sorted.length; i++) {\n var st = sorted[i]\n var s = ''\n s += termToNT(st.subject) + ' '\n s += termToNT(st.predicate) + ' '\n s += termToNT(st.object) + ' '\n if (this.flags.indexOf('q') >= 0) { // Do quads not nrtiples\n s += termToNT(st.why) + ' '\n }\n s += '.\\n'\n str += s\n }\n return str\n }\n\n statementsToN3(sts) {\n var indent = 4\n var width = 80\n var kb = this.store\n // A URI Map alows us to put the type statemnts at the top.\n var uriMap = {'http://www.w3.org/1999/02/22-rdf-syntax-ns#type': 'aaa:00'}\n var SPO = function (x, y) { // Do limited canonicalization of bnodes\n return Util.heavyCompareSPO(x, y, kb, uriMap)\n }\n sts.sort(SPO)\n\n if (this.base && !this.defaultNamespace){\n this.defaultNamespace = this.base + '#'\n }\n\n var predMap = {}\n if (this.flags.indexOf('s') < 0) {\n predMap['http://www.w3.org/2002/07/owl#sameAs'] = '='\n }\n if (this.flags.indexOf('t') < 0) {\n predMap['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'] = 'a'\n }\n if (this.flags.indexOf('i') < 0) {\n predMap['http://www.w3.org/2000/10/swap/log#implies'] = '=>'\n }\n // //////////////////////// Arrange the bits of text\n\n var spaces = function (n) {\n var s = ''\n for (var i = 0; i < n; i++) s += ' '\n return s\n }\n\n var treeToLine = function (tree) {\n var str = ''\n for (var i = 0; i < tree.length; i++) {\n var branch = tree[i]\n var s2 = (typeof branch === 'string') ? branch : treeToLine(branch)\n // Note the space before the dot in case statement ends with 123 or colon. which is in fact allowed but be conservative.\n if (i !== 0) {\n var ch = str.slice(-1) || ' '\n if (s2 === ',' || s2 === ';') {\n // no gap\n } else if (s2 === '.' && !('0123456789.:'.includes(ch))) { // no gap except after number and colon\n // no gap\n } else {\n str += ' ' // separate from previous token\n }\n }\n str += s2\n }\n return str\n }\n\n // Convert a nested tree of lists and strings to a string\n var treeToString = function (tree, level) {\n var str = ''\n var lastLength = 100000\n if (level === undefined) level = -1\n for (var i = 0; i < tree.length; i++) {\n var branch = tree[i]\n if (typeof branch !== 'string') {\n var substr = treeToString(branch, level + 1)\n if (\n substr.length < 10 * (width - indent * level) &&\n substr.indexOf('\"\"\"') < 0) { // Don't mess up multiline strings\n var line = treeToLine(branch)\n if (line.length < (width - indent * level)) {\n branch = line // Note! treat as string below\n substr = ''\n }\n }\n if (substr) lastLength = 10000\n str += substr\n }\n if (typeof branch === 'string') {\n if (branch.length === 1 && str.slice(-1) === '\\n') {\n if (',.;'.indexOf(branch) >= 0) {\n str = str.slice(0, -1)\n // be conservative and ensure a whitespace between some chars and a final dot, as in treeToLine above\n if (branch == '.' && '0123456789.:'.includes(str.charAt(str.length-1))) {\n str += ' '\n lastLength += 1\n }\n str += branch + '\\n' // slip punct'n on end\n lastLength += 1\n continue\n }\n }\n if (lastLength < (indent * level + 4) || // if new line not necessary\n lastLength + branch.length + 1 < width && ';.'.indexOf(str[str.length - 2]) < 0) { // or the string fits on last line\n str = str.slice(0, -1) + ' ' + branch + '\\n' // then continue on this line\n lastLength += branch.length + 1\n } else {\n let line = spaces(indent * level) + branch\n str += line + '\\n'\n lastLength = line.length\n if (level < 0) {\n str += '\\n' // extra blank line\n lastLength = 100000 // don't touch\n }\n }\n }\n }\n return str\n }\n\n // //////////////////////////////////////////// Structure for N3\n // Convert a set of statements into a nested tree of lists and strings\n function statementListToTreeMethod (statements) {\n var stats = this.rootSubjects(statements)\n var roots = stats.roots\n var results = []\n for (var i = 0; i < roots.length; i++) {\n var root = roots[i]\n results.push(subjectTree(root, stats))\n }\n return results\n }\n var statementListToTree = statementListToTreeMethod.bind(this)\n\n // The tree for a subject\n function subjectTree (subject, stats) {\n if (subject.termType === 'BlankNode' && !stats.incoming[subject]) {\n return objectTree(subject, stats, true).concat(['.']) // Anonymous bnode subject\n }\n return [ termToN3(subject, stats) ].concat([propertyTree(subject, stats)]).concat(['.'])\n }\n // The property tree for a single subject or anonymous node\n function propertyTreeMethod (subject, stats) {\n var results = []\n var lastPred = null\n var sts = stats.subjects[this.toStr(subject)] || [] // relevant statements\n if (typeof sts === 'undefined') {\n throw new Error('Cant find statements for ' + subject)\n }\n\n var objects = []\n for (var i = 0; i < sts.length; i++) {\n var st = sts[i]\n if (st.predicate.uri === lastPred) {\n objects.push(',')\n } else {\n if (lastPred) {\n results = results.concat([objects]).concat([';'])\n objects = []\n }\n results.push(predMap[st.predicate.uri]\n ? predMap[st.predicate.uri] : termToN3(st.predicate, stats))\n }\n lastPred = st.predicate.uri\n objects.push(objectTree(st.object, stats))\n }\n results = results.concat([objects])\n return results\n }\n\n var propertyTree = propertyTreeMethod.bind(this)\n\n function objectTreeMethod(obj, stats, force) {\n if (obj.termType === 'BlankNode' &&\n (force || stats.rootsHash[obj.toNT()] === undefined)) {// if not a root\n if (stats.subjects[this.toStr(obj)]) {\n return ['[', propertyTree(obj, stats), ']']\n } else {\n return '[]'\n }\n }\n return termToN3(obj, stats)\n }\n\n var objectTree = objectTreeMethod.bind(this)\n\n function termToN3Method(expr, stats) { //\n var i, res\n switch (expr.termType) {\n case 'Graph':\n res = ['{']\n res = res.concat(statementListToTree(expr.statements))\n return res.concat(['}'])\n\n case 'Collection':\n res = ['(']\n for (i = 0; i < expr.elements.length; i++) {\n res.push([ objectTree(expr.elements[i], stats) ])\n }\n res.push(')')\n return res\n\n default:\n return this.atomicTermToN3(expr)\n }\n }\n Serializer.prototype.termToN3 = termToN3\n var termToN3 = termToN3Method.bind(this)\n\n function prefixDirectivesMethod () {\n var str = ''\n if (this.flags.indexOf('d') < 0 && this.defaultNamespace) {\n str += '@prefix : ' + this.explicitURI(this.defaultNamespace) + '.\\n'\n }\n for (var ns in this.prefixes) {\n if (!this.prefixes.hasOwnProperty(ns)) continue\n if (!this.namespacesUsed[ns]) continue\n str += '@prefix ' + this.prefixes[ns] + ': ' + this.explicitURI(ns) +\n '.\\n'\n }\n return str + '\\n'\n }\n var prefixDirectives = prefixDirectivesMethod.bind(this)\n // Body of statementsToN3:\n var tree = statementListToTree(sts)\n return prefixDirectives() + treeToString(tree)\n }\n // //////////////////////////////////////////// Atomic Terms\n\n // Deal with term level things and nesting with no bnode structure\n atomicTermToN3 (expr, stats) {\n switch (expr.termType) {\n case 'BlankNode':\n case 'Variable':\n return expr.toNT()\n case 'Literal':\n var val = expr.value\n if (typeof val !== 'string') {\n throw new TypeError('Value of RDF literal node must be a string')\n }\n // var val = expr.value.toString() // should be a string already\n if (expr.datatype && this.flags.indexOf('x') < 0) { // Supress native numbers\n switch (expr.datatype.uri) {\n\n case 'http://www.w3.org/2001/XMLSchema#integer':\n return val\n\n case 'http://www.w3.org/2001/XMLSchema#decimal': // In Turtle, must have dot\n if (val.indexOf('.') < 0) val += '.0'\n return val\n\n case 'http://www.w3.org/2001/XMLSchema#double': {\n // Must force use of 'e'\n const eNotation = val.toLowerCase().indexOf('e') > 0;\n if (val.indexOf('.') < 0 && !eNotation) val += '.0'\n if (!eNotation) val += 'e0'\n return val\n }\n\n case 'http://www.w3.org/2001/XMLSchema#boolean':\n return expr.value === '1' ? 'true' : 'false'\n }\n }\n var str = this.stringToN3(expr.value)\n if (expr.language) {\n str += '@' + expr.language\n } else if (!expr.datatype.equals(this.xsd.string)) {\n str += '^^' + this.atomicTermToN3(expr.datatype, stats)\n }\n return str\n case 'NamedNode':\n return this.symbolToN3(expr)\n case 'DefaultGraph':\n return '';\n default:\n throw new Error('Internal: atomicTermToN3 cannot handle ' + expr + ' of termType: ' + expr.termType)\n }\n }\n\n // stringToN3: String escaping for N3\n\n validPrefix = new RegExp(/^[a-zA-Z][a-zA-Z0-9]*$/)\n\n forbidden1 = new RegExp(/[\\\\\"\\b\\f\\r\\v\\t\\n\\u0080-\\uffff]/gm)\n forbidden3 = new RegExp(/[\\\\\"\\b\\f\\r\\v\\u0080-\\uffff]/gm)\n stringToN3(str, flags) {\n if (!flags) flags = 'e'\n var res = ''\n var i, j, k\n var delim\n var forbidden\n if (str.length > 20 && // Long enough to make sense\n str.slice(-1) !== '\"' && // corner case'\n flags.indexOf('n') < 0 && // Force single line\n (str.indexOf('\\n') > 0 || str.indexOf('\"') > 0)) {\n delim = '\"\"\"'\n forbidden = this.forbidden3\n } else {\n delim = '\"'\n forbidden = this.forbidden1\n }\n for (i = 0; i < str.length;) {\n forbidden.lastIndex = 0\n var m = forbidden.exec(str.slice(i))\n if (m == null) break\n j = i + forbidden.lastIndex - 1\n res += str.slice(i, j)\n var ch = str[j]\n if (ch === '\"' && delim === '\"\"\"' && str.slice(j, j + 3) !== '\"\"\"') {\n res += ch\n } else {\n k = '\\b\\f\\r\\t\\v\\n\\\\\"'.indexOf(ch) // No escaping of bell (7)?\n if (k >= 0) {\n res += '\\\\' + 'bfrtvn\\\\\"'[k]\n } else {\n if (flags.indexOf('e') >= 0) { // Unicode escaping in strings not unix style\n res += '\\\\u' + ('000' +\n ch.charCodeAt(0).toString(16).toLowerCase()).slice(-4)\n } else { // no 'e' flag\n res += ch\n }\n }\n }\n i = j + 1\n }\n return delim + res + str.slice(i) + delim\n }\n // A single symbol, either in <> or namespace notation\n\n symbolToN3 (x) { // c.f. symbolString() in notation3.py\n var uri = x.uri\n var j = uri.indexOf('#')\n if (j < 0 && this.flags.indexOf('/') < 0) {\n j = uri.lastIndexOf('/')\n }\n if (j >= 0 && this.flags.indexOf('p') < 0 &&\n // Can split at namespace but only if http[s]: URI or file: or ws[s] (why not others?)\n (uri.indexOf('http') === 0 || uri.indexOf('ws') === 0 || uri.indexOf('file') === 0)) {\n var canSplit = true\n for (var k = j + 1; k < uri.length; k++) {\n if (this._notNameChars.indexOf(uri[k]) >= 0) {\n canSplit = false\n break\n }\n }\n/*\n if (uri.slice(0, j + 1) === this.base + '#') { // base-relative\n if (canSplit) {\n return ':' + uri.slice(j + 1) // assume deafult ns is local\n } else {\n return '<#' + uri.slice(j + 1) + '>'\n }\n }\n*/\n if (canSplit) {\n var localid = uri.slice(j + 1)\n var namesp = uri.slice(0, j + 1)\n if (this.defaultNamespace && this.defaultNamespace === namesp &&\n this.flags.indexOf('d') < 0) { // d -> suppress default\n if (this.flags.indexOf('k') >= 0 &&\n this.keyords.indexOf(localid) < 0) {\n return localid\n }\n return ':' + localid\n }\n // this.checkIntegrity() // @@@ Remove when not testing\n var prefix = this.prefixes[namesp]\n if (!prefix) prefix = this.makeUpPrefix(namesp)\n if (prefix) {\n this.namespacesUsed[namesp] = true\n return prefix + ':' + localid\n }\n // Fall though if can't do qname\n }\n }\n return this.explicitURI(uri)\n }\n\n // /////////////////////////// Quad store serialization\n\n // @para. write - a function taking a single string to be output\n //\n writeStore(write) {\n var kb = this.store\n var fetcher = kb.fetcher\n var session = fetcher && fetcher.appNode\n\n // The core data\n\n var sources = this.store.index[3]\n for (var s in sources) { // -> assume we can use -> as short for log:semantics\n var source = kb.fromNT(s)\n if (session && source.equals(session)) continue\n write('\\n' + this.atomicTermToN3(source) + ' ' +\n this.atomicTermToN3(kb.sym('http://www.w3.org/2000/10/swap/log#semantics')) +\n ' { ' + this.statementsToN3(kb.statementsMatching(\n undefined, undefined, undefined, source)) + ' }.\\n')\n }\n\n // The metadata from HTTP interactions:\n\n kb.statementsMatching(undefined,\n kb.sym('http://www.w3.org/2007/ont/link#requestedURI')).map(\n function (st) {\n write('\\n<' + st.object.value + '> log:metadata {\\n')\n var sts = kb.statementsMatching(undefined, undefined, undefined, st.subject)\n write(this.statementsToN3(this.statementsToN3(sts)))\n write('}.\\n')\n })\n\n // Inferences we have made ourselves not attributable to anyone else\n\n var metaSources = []\n if (session) metaSources.push(session)\n var metadata = []\n metaSources.map(function (source) {\n metadata = metadata.concat(kb.statementsMatching(undefined, undefined, undefined, source))\n })\n write(this.statementsToN3(metadata))\n }\n\n // ////////////////////////////////////////////// XML serialization\n\n statementsToXML(sts) {\n var indent = 4\n var width = 80\n\n var namespaceCounts = [] // which have been used\n namespaceCounts['http://www.w3.org/1999/02/22-rdf-syntax-ns#'] = true\n\n var liPrefix = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_' // prefix for ordered list items\n\n // //////////////////////// Arrange the bits of XML text\n\n var spaces = function (n) {\n var s = ''\n for (var i = 0; i < n; i++) s += ' '\n return s\n }\n\n var XMLtreeToLine = function (tree) {\n var str = ''\n for (var i = 0; i < tree.length; i++) {\n var branch = tree[i]\n var s2 = (typeof branch === 'string') ? branch : XMLtreeToLine(branch)\n str += s2\n }\n return str\n }\n\n // Convert a nested tree of lists and strings to a string\n var XMLtreeToString = function (tree, level) {\n var str = ''\n var line\n var lastLength = 100000\n if (!level) level = 0\n for (var i = 0; i < tree.length; i++) {\n var branch = tree[i]\n if (typeof branch !== 'string') {\n var substr = XMLtreeToString(branch, level + 1)\n if (\n substr.length < 10 * (width - indent * level) &&\n substr.indexOf('\"\"\"') < 0) { // Don't mess up multiline strings\n line = XMLtreeToLine(branch)\n if (line.length < (width - indent * level)) {\n branch = ' ' + line // @@ Hack: treat as string below\n substr = ''\n }\n }\n if (substr) lastLength = 10000\n str += substr\n }\n if (typeof branch === 'string') {\n if (lastLength < (indent * level + 4)) { // continue\n str = str.slice(0, -1) + ' ' + branch + '\\n'\n lastLength += branch.length + 1\n } else {\n line = spaces(indent * level) + branch\n str += line + '\\n'\n lastLength = line.length\n }\n } else { // not string\n }\n }\n return str\n }\n\n function statementListToXMLTreeMethod (statements) {\n this.suggestPrefix('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#')\n var stats = this.rootSubjects(statements)\n var roots = stats.roots\n var results = []\n for (var i = 0; i < roots.length; i++) {\n var root = roots[i]\n results.push(subjectXMLTree(root, stats))\n }\n return results\n }\n var statementListToXMLTree = statementListToXMLTreeMethod.bind(this)\n\n function escapeForXML (str) {\n if (typeof str === 'undefined') return '@@@undefined@@@@'\n return str.replace(/[&<\"]/g, function (m) {\n switch (m[0]) {\n case '&':\n return '&'\n case '<':\n return '<'\n case '\"':\n return '"' // '\n }\n })\n }\n\n function relURIMethod (term) {\n return escapeForXML((this.base) ? Util.uri.refTo(this.base, term.uri) : term.uri)\n }\n var relURI = relURIMethod.bind(this)\n\n // The tree for a subject\n function subjectXMLTreeMethod (subject, stats) {\n var results = []\n var type, t, st, pred\n var sts = stats.subjects[this.toStr(subject)] // relevant statements\n if (typeof sts === 'undefined') { // empty bnode\n return propertyXMLTree(subject, stats)\n }\n\n // Sort only on the predicate, leave the order at object\n // level undisturbed. This leaves multilingual content in\n // the order of entry (for partner literals), which helps\n // readability.\n //\n // For the predicate sort, we attempt to split the uri\n // as a hint to the sequence\n sts.sort(function (a, b) {\n var ap = a.predicate.uri\n var bp = b.predicate.uri\n if (ap.substring(0, liPrefix.length) === liPrefix || bp.substring(0, liPrefix.length) === liPrefix) { // we're only interested in sorting list items\n return ap.localeCompare(bp)\n }\n\n var as = ap.substring(liPrefix.length)\n var bs = bp.substring(liPrefix.length)\n var an = parseInt(as, 10)\n var bn = parseInt(bs, 10)\n if (isNaN(an) || isNaN(bn) ||\n an !== as || bn !== bs) { // we only care about integers\n return ap.localeCompare(bp)\n }\n\n return an - bn\n })\n\n for (var i = 0; i < sts.length; i++) {\n st = sts[i]\n // look for a type\n if (st.predicate.uri === 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' && !type && st.object.termType === 'NamedNode') {\n type = st.object\n continue // don't include it as a child element\n }\n\n // see whether predicate can be replaced with \"li\"\n pred = st.predicate\n if (pred.uri.substr(0, liPrefix.length) === liPrefix) {\n var number = pred.uri.substr(liPrefix.length)\n // make sure these are actually numeric list items\n var intNumber = parseInt(number, 10)\n if (number === intNumber.toString()) {\n // was numeric; don't need to worry about ordering since we've already\n // sorted the statements\n pred = this.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#li')\n }\n }\n\n t = qname(pred)\n switch (st.object.termType) {\n case 'BlankNode':\n if (stats.incoming[st.object].length === 1) { // there should always be something in the incoming array for a bnode\n results = results.concat(['<' + t + ' rdf:parseType=\"Resource\">',\n subjectXMLTree(st.object, stats),\n ''])\n } else {\n results = results.concat(['<' + t + ' rdf:nodeID=\"' +\n st.object.toNT().slice(2) + '\"/>'])\n }\n break\n case 'NamedNode':\n results = results.concat(['<' + t + ' rdf:resource=\"' +\n relURI(st.object) + '\"/>'])\n break\n case 'Literal':\n results = results.concat(['<' + t +\n (st.object.datatype.equals(this.xsd.string)\n ? ''\n : ' rdf:datatype=\"' + escapeForXML(st.object.datatype.uri) + '\"') +\n (st.object.language ? ' xml:lang=\"' + st.object.language + '\"' : '') +\n '>' + escapeForXML(st.object.value) +\n ''])\n break\n case 'Collection':\n results = results.concat(['<' + t + ' rdf:parseType=\"Collection\">',\n collectionXMLTree(st.object, stats),\n ''])\n break\n default:\n throw new Error(\"Can't serialize object of type \" + st.object.termType + ' into XML')\n } // switch\n }\n\n var tag = type ? qname(type) : 'rdf:Description'\n\n var attrs = ''\n if (subject.termType === 'BlankNode') {\n if (!stats.incoming[subject] || stats.incoming[subject].length !== 1) { // not an anonymous bnode\n attrs = ' rdf:nodeID=\"' + subject.toNT().slice(2) + '\"'\n }\n } else {\n attrs = ' rdf:about=\"' + relURI(subject) + '\"'\n }\n\n return [ '<' + tag + attrs + '>' ].concat([results]).concat([''])\n }\n\n var subjectXMLTree = subjectXMLTreeMethod.bind(this)\n\n function collectionXMLTree (subject, stats) {\n var res = []\n for (var i = 0; i < subject.elements.length; i++) {\n res.push(subjectXMLTree(subject.elements[i], stats))\n }\n return res\n }\n\n // The property tree for a single subject or anonymos node\n function propertyXMLTreeMethod (subject, stats) {\n var results = []\n var sts = stats.subjects[this.toStr(subject)] // relevant statements\n if (!sts) return results // No relevant statements\n sts.sort()\n for (var i = 0; i < sts.length; i++) {\n var st = sts[i]\n switch (st.object.termType) {\n case 'BlankNode':\n if (stats.rootsHash[st.object.toNT()]) { // This bnode has been done as a root -- no content here @@ what bout first time\n results = results.concat(['<' + qname(st.predicate) + ' rdf:nodeID=\"' + st.object.toNT().slice(2) + '\">',\n ''])\n } else {\n results = results.concat(['<' + qname(st.predicate) + ' rdf:parseType=\"Resource\">',\n propertyXMLTree(st.object, stats),\n ''])\n }\n break\n case 'NamedNode':\n results = results.concat(['<' + qname(st.predicate) + ' rdf:resource=\"' +\n relURI(st.object) + '\"/>'])\n break\n case 'Literal':\n results = results.concat(['<' + qname(st.predicate) +\n (st.object.datatype.equals(this.xsd.string) ? '' : ' rdf:datatype=\"' + escapeForXML(st.object.datatype.value) + '\"') +\n (st.object.language ? ' xml:lang=\"' + st.object.language + '\"' : '') +\n '>' + escapeForXML(st.object.value) +\n ''])\n break\n case 'Collection':\n results = results.concat(['<' + qname(st.predicate) + ' rdf:parseType=\"Collection\">',\n collectionXMLTree(st.object, stats),\n ''])\n break\n default:\n throw new Error(\"Can't serialize object of type \" + st.object.termType + ' into XML')\n } // switch\n }\n return results\n }\n var propertyXMLTree = propertyXMLTreeMethod.bind(this)\n\n function qnameMethod (term) {\n var uri = term.uri\n\n var j = uri.indexOf('#')\n if (j < 0 && this.flags.indexOf('/') < 0) {\n j = uri.lastIndexOf('/')\n }\n if (j < 0) throw new Error('Cannot make qname out of <' + uri + '>')\n\n for (var k = j + 1; k < uri.length; k++) {\n if (this._notNameChars.indexOf(uri[k]) >= 0) {\n throw new Error('Invalid character \"' + uri[k] + '\" cannot be in XML qname for URI: ' + uri)\n }\n }\n var localid = uri.slice(j + 1)\n var namesp = uri.slice(0, j + 1)\n if (this.defaultNamespace && this.defaultNamespace === namesp &&\n this.flags.indexOf('d') < 0) { // d -> suppress default\n return localid\n }\n var prefix = this.prefixes[namesp]\n if (!prefix) prefix = this.makeUpPrefix(namesp)\n namespaceCounts[namesp] = true\n return prefix + ':' + localid\n }\n var qname = qnameMethod.bind(this)\n\n // Body of toXML:\n\n var tree = statementListToXMLTree(sts)\n var str = ''] // @@ namespace declrations\n return XMLtreeToString(tree2, -1)\n } // End @@ body\n\n statementsToJsonld (sts) {\n // ttl2jsonld creates context keys for all ttl prefix\n // context keys must be absolute IRI ttl2jsonld@0.0.8\n /* function findId (itemObj) {\n if (itemObj['@id']) {\n const item = itemObj['@id'].split(':')\n if (keys[item[0]]) itemObj['@id'] = jsonldObj['@context'][item[0]] + item[1]\n }\n const itemValues = Object.values(itemObj)\n for (const i in itemValues) {\n if (typeof itemValues[i] !== 'string') { // @list contains array\n findId(itemValues[i])\n }\n }\n } */\n const turtleDoc = this.statementsToN3(sts)\n const jsonldObj = ttl2jsonld.parse(turtleDoc)\n return JSON.stringify(jsonldObj, null, 2)\n }\n\n}\n\n// String escaping utilities\n\nfunction hexify (str) { // also used in parser\n return encodeURI(str)\n}\n\nfunction backslashUify (str) {\n var res = ''\n var k\n for (var i = 0; i < str.length; i++) {\n k = str.charCodeAt(i)\n if (k > 65535) {\n res += '\\\\U' + ('00000000' + k.toString(16)).slice(-8) // convert to upper?\n } else if (k > 126) {\n res += '\\\\u' + ('0000' + k.toString(16)).slice(-4)\n } else {\n res += str[i]\n }\n }\n return res\n}\n","import Formula from './formula'\nimport Serializer from './serializer'\nimport {\n ContentType,\n JSONLDContentType,\n N3ContentType,\n N3LegacyContentType,\n NQuadsAltContentType,\n NQuadsContentType,\n NTriplesContentType,\n RDFXMLContentType,\n TurtleContentType,\n TurtleLegacyContentType,\n} from './types'\nimport IndexedFormula from './store'\nimport { BlankNode, NamedNode } from './tf-types'\n\n/**\n * Serialize to the appropriate format\n */\nexport default function serialize (\n /** The graph or nodes that should be serialized */\n target: Formula | NamedNode | BlankNode | null,\n /** The store */\n kb: Formula,\n base?: unknown,\n /**\n * The mime type.\n * Defaults to Turtle.\n */\n contentType?: string | ContentType,\n callback?: (err: Error | undefined | null, result?: string) => any,\n options?: {\n /**\n * A string of letters, each of which set an options\n * e.g. `deinprstux`\n */\n flags?: string,\n /**\n * A set of [prefix, uri] pairs that define namespace prefixes\n */\n namespaces?: Record\n }\n): string | undefined {\n base = base || target?.value\n const opts = options || {}\n contentType = contentType || TurtleContentType // text/n3 if complex?\n var documentString: string | undefined = undefined\n try {\n var sz = Serializer(kb)\n if ((opts as any).flags) sz.setFlags((opts as any).flags)\n var newSts = kb!.statementsMatching(undefined, undefined, undefined, target as NamedNode)\n\n // If an IndexedFormula, use the namespaces from the given graph as suggestions\n if ('namespaces' in kb) {\n sz.suggestNamespaces( (kb as IndexedFormula).namespaces);\n }\n\n // use the provided options.namespaces are mandatory prefixes\n if (opts.namespaces) {\n sz.setNamespaces( opts.namespaces);\n }\n\n sz.setBase(base)\n switch (contentType) {\n case RDFXMLContentType:\n documentString = sz.statementsToXML(newSts)\n return executeCallback(null, documentString)\n case N3ContentType:\n case N3LegacyContentType:\n documentString = sz.statementsToN3(newSts)\n return executeCallback(null, documentString)\n case TurtleContentType:\n case TurtleLegacyContentType:\n sz.setFlags('si') // Suppress = for sameAs and => for implies\n documentString = sz.statementsToN3(newSts)\n return executeCallback(null, documentString)\n case NTriplesContentType:\n sz.setFlags('deinprstux') // Suppress nice parts of N3 to make ntriples\n documentString = sz.statementsToNTriples(newSts)\n return executeCallback(null, documentString)\n case JSONLDContentType:\n sz.setFlags('si dr') // turtle + dr (means no default, no relative prefix)\n documentString = sz.statementsToJsonld(newSts) // convert via turtle\n return executeCallback(null, documentString)\n case NQuadsContentType:\n case NQuadsAltContentType: // @@@ just outpout the quads? Does not work for collections\n sz.setFlags('deinprstux q') // Suppress nice parts of N3 to make ntriples\n documentString = sz.statementsToNTriples(newSts) // q in flag means actually quads\n return executeCallback(null, documentString)\n default:\n throw new Error('Serialize: Content-type ' + contentType + ' not supported for data write.')\n }\n } catch (err) {\n if (callback) {\n // @ts-ignore\n return callback(err, undefined)\n }\n throw err // Don't hide problems from caller in sync mode\n }\n\n function executeCallback (err: Error | null | undefined, result: string | undefined): string | undefined {\n if (callback) {\n callback(err, result)\n return\n } else {\n return result as string\n }\n }\n}\n","import Fetcher from './fetcher'\nimport log from './log'\nimport { docpart } from './uri'\nimport { string_startswith } from './utils-js'\nimport { RdfJsDataFactory, Quad, Quad_Subject, Term } from './tf-types'\n\n/** RDF/JS spec Typeguards */\n\n/**\n * Loads ontologies of the data we load (this is the callback from the kb to\n * the fetcher).\n */\nexport function AJAR_handleNewTerm (kb: { fetcher: Fetcher }, p, requestedBy) {\n var sf: Fetcher | null = null\n if (typeof kb.fetcher !== 'undefined') {\n sf = kb.fetcher\n } else {\n return\n }\n if (p.termType !== 'NamedNode') return\n var docuri = docpart(p.uri)\n var fixuri\n if (p.uri.indexOf('#') < 0) { // No hash\n // @@ major hack for dbpedia Categories, which spread indefinitely\n if (string_startswith(p.uri, 'http://dbpedia.org/resource/Category:')) return\n\n /*\n if (string_startswith(p.uri, 'http://xmlns.com/foaf/0.1/')) {\n fixuri = \"http://dig.csail.mit.edu/2005/ajar/ajaw/test/foaf\"\n // should give HTTP 303 to ontology -- now is :-)\n } else\n */\n if (string_startswith(p.uri,\n 'http://purl.org/dc/elements/1.1/') ||\n string_startswith(p.uri, 'http://purl.org/dc/terms/')) {\n fixuri = 'http://dublincore.org/2005/06/13/dcq'\n // dc fetched multiple times\n } else if (string_startswith(p.uri, 'http://xmlns.com/wot/0.1/')) {\n fixuri = 'http://xmlns.com/wot/0.1/index.rdf'\n } else if (string_startswith(p.uri, 'http://web.resource.org/cc/')) {\n // log.warn(\"creative commons links to html instead of rdf. doesn't seem to content-negotiate.\")\n fixuri = 'http://web.resource.org/cc/schema.rdf'\n }\n }\n if (fixuri) {\n docuri = fixuri\n }\n if (sf && (sf as Fetcher).getState(docuri) !== 'unrequested') return\n\n if (fixuri) { // only give warning once: else happens too often\n log.warn('Assuming server still broken, faking redirect of <' + p.uri +\n '> to <' + docuri + '>')\n }\n\n return (sf as any).fetch(docuri, { referringTerm: requestedBy })\n}\n\nexport const appliedFactoryMethods = [\n 'blankNode',\n 'defaultGraph',\n 'literal',\n 'namedNode',\n 'quad',\n 'variable',\n 'supports',\n]\n\nconst rdf = {\n first: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first',\n rest: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest',\n nil: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'\n}\n\n/**\n * Expands an array of Terms to a set of statements representing the rdf:list.\n * @param rdfFactory - The factory to use\n * @param subject - The iri of the first list item.\n * @param data - The terms to expand into the list.\n * @return The {data} as a set of statements.\n */\nexport function arrayToStatements(\n rdfFactory: RdfJsDataFactory,\n subject: Quad_Subject,\n data: Term[]\n): Quad[] {\n const statements: Quad[] = []\n\n data.reduce((id, _listObj, i, listData) => {\n statements.push(rdfFactory.quad(id, rdfFactory.namedNode(rdf.first), listData[i]))\n\n let nextNode\n if (i < listData.length - 1) {\n nextNode = rdfFactory.blankNode()\n statements.push(rdfFactory.quad(id, rdfFactory.namedNode(rdf.rest), nextNode))\n } else {\n statements.push(rdfFactory.quad(id, rdfFactory.namedNode(rdf.rest), rdfFactory.namedNode(rdf.nil)))\n }\n\n return nextNode\n }, subject)\n\n return statements\n}\n\nexport function ArrayIndexOf (arr, item, i: number = 0) {\n var length = arr.length\n if (i < 0) i = length + i\n for (; i < length; i++) {\n if (arr[i] === item) {\n return i\n }\n }\n return -1\n}\n","import ClassOrder from './class-order'\nimport Collection from './collection'\nimport CanonicalDataFactory from './factories/canonical-data-factory'\nimport log from './log'\nimport RDFlibNamedNode from './named-node'\nimport Namespace from './namespace'\nimport Node from './node-internal'\nimport serialize from './serialize'\nimport Statement from './statement'\nimport {\n Bindings,\n GraphTermType,\n} from './types'\nimport { isStatement } from './utils/terms'\nimport Variable from './variable'\nimport {\n Indexable,\n TFIDFactoryTypes,\n} from './factories/factory-types'\nimport { appliedFactoryMethods, arrayToStatements } from './utils'\nimport {\n RdfJsDataFactory,\n Quad_Graph,\n Quad_Object,\n Quad_Predicate,\n Quad,\n Quad_Subject,\n Term,\n} from './tf-types'\nimport Fetcher from './fetcher'\nimport BlankNode from './blank-node'\nimport NamedNode from './named-node'\n\nexport interface FormulaOpts {\n dataCallback?: (q: Quad) => void\n rdfArrayRemove?: (arr: Quad[], q: Quad) => void\n rdfFactory?: RdfJsDataFactory\n}\n\ninterface BooleanMap {\n [uri: string]: boolean;\n}\n\ninterface MembersMap {\n [uri: string]: Quad;\n}\n\ninterface UriMap {\n [uri: string]: string;\n}\n\n/**\n * A formula, or store of RDF statements\n */\nexport default class Formula extends Node {\n termType: typeof GraphTermType = GraphTermType\n\n classOrder = ClassOrder.Graph\n\n /**\n * The accompanying fetcher instance.\n *\n * Is set by the fetcher when initialized.\n */\n fetcher?: Fetcher\n\n isVar = 0\n\n /**\n * A namespace for the specified namespace's URI\n * @param nsuri The URI for the namespace\n */\n ns = Namespace\n\n /** The factory used to generate statements and terms */\n rdfFactory: any\n\n /**\n * Initializes this formula\n * @constructor\n * @param statements - Initial array of statements\n * @param constraints - initial array of constraints\n * @param initBindings - initial bindings used in Query\n * @param optional - optional\n * @param opts\n * @param opts.rdfFactory - The rdf factory that should be used by the store\n*/\n constructor (\n public statements: Array = [],\n public constraints: ReadonlyArray = [],\n public initBindings: ReadonlyArray = [],\n public optional: ReadonlyArray = [],\n opts: FormulaOpts = {}\n ) {\n super('')\n\n this.rdfFactory = (opts && opts.rdfFactory) || CanonicalDataFactory\n // Enable default factory methods on this while preserving factory context.\n for(const factoryMethod of appliedFactoryMethods) {\n this[factoryMethod] = (...args) => this.rdfFactory[factoryMethod](...args)\n }\n }\n\n /** Add a statement from its parts\n * @param subject - the first part of the statement\n * @param predicate - the second part of the statement\n * @param object - the third part of the statement\n * @param graph - the last part of the statement\n */\n add (\n subject: Quad_Subject | Quad | Quad[],\n predicate?: Quad_Predicate,\n object?: Term | string,\n graph?: Quad_Graph\n ): Statement | null | this | number {\n if (arguments.length === 1) {\n (subject as Quad[]).forEach(st => this.add(st.subject, st.predicate, st.object, st.graph))\n }\n return this.statements.push(this.rdfFactory.quad(subject, predicate, object, graph))\n }\n\n /** Add a statment object\n * @param {Statement} statement - An existing constructed statement to add\n */\n addStatement (statement: Quad): Statement | null | this | number {\n return this.add(statement)\n }\n\n /**\n * Shortcut for adding blankNodes\n * @param [id]\n */\n bnode (id?: string): BlankNode {\n return this.rdfFactory.blankNode(id)\n }\n\n /**\n * Adds all the statements to this formula\n * @param statements - A collection of statements\n */\n addAll (statements: Quad[]): void {\n statements.forEach(quad => {\n this.add(quad.subject, quad.predicate, quad.object, quad.graph)\n })\n }\n\n /** Follow link from one node, using one wildcard, looking for one\n *\n * For example, any(me, knows, null, profile) - a person I know accoring to my profile .\n * any(me, knows, null, null) - a person I know accoring to anything in store .\n * any(null, knows, me, null) - a person who know me accoring to anything in store .\n *\n * @param s - A node to search for as subject, or if null, a wildcard\n * @param p - A node to search for as predicate, or if null, a wildcard\n * @param o - A node to search for as object, or if null, a wildcard\n * @param g - A node to search for as graph, or if null, a wildcard\n * @returns A node which match the wildcard position, or null\n */\n any(\n s?: Quad_Subject | null,\n p?: Quad_Predicate | null,\n o?: Quad_Object | null,\n g?: Quad_Graph | null\n ): Node | null {\n const st = this.anyStatementMatching(s, p, o, g)\n if (st == null) {\n return null\n } else if (s == null) {\n return st.subject\n } else if (p == null) {\n return st.predicate\n } else if (o == null) {\n return st.object\n }\n\n return null\n }\n\n /**\n * Gets the value of a node that matches the specified pattern\n * @param s The subject\n * @param p The predicate\n * @param o The object\n * @param g The graph that contains the statement\n */\n anyValue(\n s?: Quad_Subject | null,\n p?: Quad_Predicate | null,\n o?: Quad_Object | null,\n g?: Quad_Graph | null\n ): string | void {\n const y = this.any(s, p, o, g)\n return y ? y.value : void 0\n }\n\n /**\n * Gets the first JavaScript object equivalent to a node based on the specified pattern\n * @param s The subject\n * @param p The predicate\n * @param o The object\n * @param g The graph that contains the statement\n */\n anyJS(\n s?: Quad_Subject | null,\n p?: Quad_Predicate | null,\n o?: Quad_Object | null,\n g?: Quad_Graph | null\n ): any {\n const y = this.any(s, p, o, g)\n return y ? Node.toJS(y) : void 0\n }\n\n /**\n * Gets the first statement that matches the specified pattern\n */\n anyStatementMatching(\n s?: Quad_Subject | null,\n p?: Quad_Predicate | null,\n o?: Quad_Object | null,\n g?: Quad_Graph | null\n ): Statement | undefined {\n let x = this.statementsMatching(s, p, o, g, true)\n if (!x || x.length === 0) {\n return undefined\n }\n\n return x[0]\n }\n\n /**\n * Returns a unique index-safe identifier for the given term.\n *\n * Falls back to the rdflib hashString implementation if the given factory doesn't support id.\n */\n id (term: TFIDFactoryTypes): Indexable {\n return this.rdfFactory.id(term)\n }\n\n /**\n * Search the Store\n * This is really a teaching method as to do this properly you would use IndexedFormula\n *\n * @param s - A node to search for as subject, or if null, a wildcard\n * @param p - A node to search for as predicate, or if null, a wildcard\n * @param o - A node to search for as object, or if null, a wildcard\n * @param g - A node to search for as graph, or if null, a wildcard\n * @param justOne - flag - stop when found one rather than get all of them?\n * @returns {Array} - An array of nodes which match the wildcard position\n */\n statementsMatching(\n s?: Quad_Subject | null,\n p?: Quad_Predicate | null,\n o?: Quad_Object | null,\n g?: Quad_Graph | null,\n justOne?: boolean\n ): Statement[] {\n const sts = this.statements.filter(st =>\n (!s || s.equals(st.subject)) &&\n (!p || p.equals(st.predicate)) &&\n (!o || o.equals(st.object)) &&\n (!g || g.equals(st.graph))\n )\n\n if (justOne) {\n return sts.length === 0 ? [] : [sts[0]]\n }\n\n return sts\n }\n\n /**\n * Finds the types in the list which have no *stored* subtypes\n * These are a set of classes which provide by themselves complete\n * information -- the other classes are redundant for those who\n * know the class DAG.\n * @param types A map of the types\n */\n bottomTypeURIs (types) {\n let bots\n let bottom\n let elt\n let i\n let len\n let ref\n let subs\n let v\n bots = []\n for (let k in types) {\n if (!types.hasOwnProperty(k)) continue\n v = types[k]\n subs = this.each(\n void 0,\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf'),\n this.rdfFactory.namedNode(k)\n )\n bottom = true\n i = 0\n for (len = subs.length; i < len; i++) {\n elt = subs[i]\n ref = elt.uri\n if (ref in types) { // the subclass is one we know\n bottom = false\n break\n }\n }\n if (bottom) {\n bots[k] = v\n }\n }\n return bots\n }\n\n /** Creates a new collection */\n collection (): Collection {\n return new Collection()\n }\n\n /** Follow links from one node, using one wildcard.\n *\n * For example, each(me, knows, null, profile) - people I know accoring to my profile .\n * each(me, knows, null, null) - people I know accoring to anything in store .\n * each(null, knows, me, null) - people who know me accoring to anything in store .\n *\n * @param s - A node to search for as subject, or if null, a wildcard\n * @param p - A node to search for as predicate, or if null, a wildcard\n * @param o - A node to search for as object, or if null, a wildcard\n * @param g - A node to search for as graph, or if null, a wildcard\n * @returns {Array} - An array of nodes which match the wildcard position\n */\n each(\n s?: Quad_Subject | null,\n p?: Quad_Predicate | null,\n o?: Quad_Object | null,\n g?: Quad_Graph | null\n ): Node[] {\n const results: Node[] = []\n let sts = this.statementsMatching(s, p, o, g, false)\n if (s == null) {\n for (let i = 0, len = sts.length; i < len; i++) {\n results.push(sts[i].subject)\n }\n } else if (p == null) {\n for (let l = 0, len1 = sts.length; l < len1; l++) {\n results.push(sts[l].predicate)\n }\n } else if (o == null) {\n for (let m = 0, len2 = sts.length; m < len2; m++) {\n results.push(sts[m].object)\n }\n } else if (g == null) {\n for (let q = 0, len3 = sts.length; q < len3; q++) {\n results.push(new NamedNode(sts[q].graph.value))\n }\n }\n\n return results\n }\n\n /**\n * Test whether this formula is equals to {other}\n * @param other - The other formula\n */\n equals(other: Formula): boolean {\n if (!other) {\n return false\n }\n return this.hashString() === other.hashString()\n }\n\n /**\n * For thisClass or any subclass, anything which has it is its type\n * or is the object of something which has the type as its range, or subject\n * of something which has the type as its domain\n * We don't bother doing subproperty (yet?)as it doesn't seeem to be used\n * much.\n * Get all the Classes of which we can RDFS-infer the subject is a member\n * @return a hash of URIs\n */\n findMembersNT (thisClass) {\n let len2: number\n let len4: number\n let m: number\n let members: MembersMap\n let pred: Quad_Predicate\n let ref\n let ref1: Quad[]\n let ref2: Term[]\n let ref3: Quad[]\n let ref4: Term[]\n let ref5: Quad[]\n let seeds\n let st\n let u: number\n seeds = {}\n seeds[thisClass.toNT()] = true\n members = {}\n ref = this.transitiveClosure(seeds, this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf'), true)\n for (let t in ref) {\n if (!ref.hasOwnProperty(t)) continue\n ref1 = this.statementsMatching(void 0,\n this.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),\n this.fromNT(t))\n for (let i = 0, len = ref1.length; i < len; i++) {\n st = ref1[i]\n members[st.subject.toNT()] = st\n }\n ref2 = this.each(void 0,\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#domain'),\n this.fromNT(t))\n for (let l = 0, len1 = ref2.length; l < len1; l++) {\n pred = ref2[l] as Quad_Predicate\n ref3 = this.statementsMatching(void 0, pred)\n for (m = 0, len2 = ref3.length; m < len2; m++) {\n st = ref3[m]\n members[st.subject.toNT()] = st\n }\n }\n ref4 = this.each(void 0,\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#range'),\n this.fromNT(t))\n for (let q = 0, len3 = ref4.length; q < len3; q++) {\n pred = ref4[q] as Quad_Predicate\n ref5 = this.statementsMatching(void 0, pred)\n for (u = 0, len4 = ref5.length; u < len4; u++) {\n st = ref5[u]\n members[st.object.toNT()] = st\n }\n }\n }\n\n return members\n }\n\n /**\n * For thisClass or any subclass, anything which has it is its type\n * or is the object of something which has the type as its range, or subject\n * of something which has the type as its domain\n * We don't bother doing subproperty (yet?)as it doesn't seeem to be used\n * much.\n * Get all the Classes of which we can RDFS-infer the subject is a member\n * @param subject - A named node\n */\n findMemberURIs(subject: Node): UriMap {\n return this.NTtoURI(this.findMembersNT(subject))\n }\n\n /**\n * Get all the Classes of which we can RDFS-infer the subject is a superclass\n * Returns a hash table where key is NT of type and value is statement why we\n * think so.\n * Does NOT return terms, returns URI strings.\n * We use NT representations in this version because they handle blank nodes.\n */\n findSubClassesNT(subject: Node): { [uri: string]: boolean } {\n let types = {}\n types[subject.toNT()] = true\n return this.transitiveClosure(\n types,\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf'),\n true\n )\n }\n\n /**\n * Get all the Classes of which we can RDFS-infer the subject is a subclass\n * @param {RDFlibNamedNode} subject - The thing whose classes are to be found\n * @returns a hash table where key is NT of type and value is statement why we\n * think so.\n * Does NOT return terms, returns URI strings.\n * We use NT representations in this version because they handle blank nodes.\n */\n findSuperClassesNT(subject: Node): { [uri: string]: boolean } {\n let types = {}\n types[subject.toNT()] = true\n return this.transitiveClosure(types,\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf'), false)\n }\n\n /**\n * Get all the Classes of which we can RDFS-infer the subject is a member\n * todo: This will loop is there is a class subclass loop (Sublass loops are\n * not illegal)\n * @param {RDFlibNamedNode} subject - The thing whose classes are to be found\n * @returns a hash table where key is NT of type and value is statement why we think so.\n * Does NOT return terms, returns URI strings.\n * We use NT representations in this version because they handle blank nodes.\n */\n findTypesNT (subject) {\n let domain\n let range\n let rdftype\n let ref\n let ref1\n let ref2\n let ref3\n let st\n let types\n rdftype = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'\n types = []\n ref = this.statementsMatching(subject, void 0, void 0)\n for (let i = 0, len = ref.length; i < len; i++) {\n st = ref[i]\n if (st.predicate.uri === rdftype) {\n types[st.object.toNT()] = st\n } else {\n ref1 = this.each(\n st.predicate,\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#domain')\n )\n for (let l = 0, len1 = ref1.length; l < len1; l++) {\n range = ref1[l]\n types[range.toNT()] = st\n }\n }\n }\n ref2 = this.statementsMatching(void 0, void 0, subject)\n for (let m = 0, len2 = ref2.length; m < len2; m++) {\n st = ref2[m]\n ref3 = this.each(\n st.predicate,\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#range')\n )\n for (let q = 0, len3 = ref3.length; q < len3; q++) {\n domain = ref3[q]\n types[domain.toNT()] = st\n }\n }\n return this.transitiveClosure(\n types,\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf'),\n false\n )\n }\n\n /**\n * Get all the Classes of which we can RDFS-infer the subject is a member\n * todo: This will loop is there is a class subclass loop (Sublass loops are\n * not illegal)\n * Returns a hash table where key is NT of type and value is statement why we\n * think so.\n * Does NOT return terms, returns URI strings.\n * We use NT representations in this version because they handle blank nodes.\n * @param subject - A subject node\n */\n findTypeURIs(subject: Quad_Subject): UriMap {\n return this.NTtoURI(this.findTypesNT(subject))\n }\n\n /** Trace statements which connect directly, or through bnodes\n *\n * @param subject - The node to start looking for statments\n * @param doc - The document to be searched, or null to search all documents\n * @returns an array of statements, duplicate statements are suppresssed.\n */\n connectedStatements(\n subject: Quad_Subject,\n doc: Quad_Graph,\n excludePredicateURIs?: ReadonlyArray\n ): Statement[] {\n excludePredicateURIs = excludePredicateURIs || []\n let todo = [subject]\n let done: { [k: string]: boolean } = {}\n let doneArcs: { [k: string]: boolean } = {}\n let result: Statement[] = []\n let self = this\n let follow = function (x) {\n let queue = function (x) {\n if (x.termType === 'BlankNode' && !done[x.value]) {\n done[x.value] = true\n todo.push(x)\n }\n }\n let sts = self.statementsMatching(null, null, x, doc)\n .concat(self.statementsMatching(x, null, null, doc))\n sts = sts.filter(function (st): boolean {\n if (excludePredicateURIs![st.predicate.value]) return false\n let hash = (st as Statement).toNT()\n if (doneArcs[hash]) return false\n doneArcs[hash] = true\n return true\n }\n )\n sts.forEach(function (st) {\n queue(st.subject)\n queue(st.object)\n })\n result = result.concat(sts)\n }\n while (todo.length) {\n follow(todo.shift())\n }\n return result\n }\n\n /**\n * Creates a new empty formula\n *\n * @param _features - Not applicable, but necessary for typing to pass\n */\n formula(_features?: ReadonlyArray): Formula {\n return new Formula()\n }\n\n /**\n * Transforms an NTriples string format into a Node.\n * The blank node bit should not be used on program-external values; designed\n * for internal work such as storing a blank node id in an HTML attribute.\n * This will only parse the strings generated by the various toNT() methods.\n */\n fromNT (str) {\n let dt, k, lang\n switch (str[0]) {\n case '<':\n return this.sym(str.slice(1, -1))\n case '\"':\n lang = void 0\n dt = void 0\n k = str.lastIndexOf('\"')\n if (k < str.length - 1) {\n if (str[k + 1] === '@') {\n lang = str.slice(k + 2)\n } else if (str.slice(k + 1, k + 3) === '^^') {\n dt = this.fromNT(str.slice(k + 3))\n } else {\n throw new Error(\"Can't convert string from NT: \" + str)\n }\n }\n str = str.slice(1, k)\n str = str.replace(/\\\\\"/g, '\"')\n str = str.replace(/\\\\n/g, '\\n')\n str = str.replace(/\\\\\\\\/g, '\\\\')\n return this.rdfFactory.literal(str, lang || dt)\n case '_':\n return this.rdfFactory.blankNode(str.slice(2))\n case '?':\n return new Variable(str.slice(1))\n }\n throw new Error(\"Can't convert from NT: \" + str)\n }\n\n /** Returns true if this formula holds the specified statement(s) */\n holds (s: any | any[], p?, o?, g?): boolean {\n let i\n if (arguments.length === 1) {\n if (!s) {\n return true\n }\n if (s instanceof Array) {\n for (i = 0; i < s.length; i++) {\n if (!this.holds(s[i])) {\n return false\n }\n }\n return true\n } else if (isStatement(s)) {\n return this.holds(s.subject, s.predicate, s.object, s.graph)\n } else if (s.statements) {\n return this.holds(s.statements)\n }\n }\n\n let st = this.anyStatementMatching(s, p, o, g)\n return st != null\n }\n\n /**\n * Returns true if this formula holds the specified {statement}\n */\n holdsStatement (statement) {\n return this.holds(\n statement.subject,\n statement.predicate,\n statement.object,\n statement.graph,\n )\n }\n\n /**\n * Used by the n3parser to generate list elements\n * @param values - The values of the collection\n * @param context - The store\n * @return {BlankNode|Collection} - The term for the statement\n */\n list (values, context) {\n if (context.rdfFactory.supports[\"COLLECTIONS\"]) {\n const collection = context.rdfFactory.collection()\n values.forEach(function (val) {\n collection.append(val)\n })\n return collection\n } else {\n const node = context.rdfFactory.blankNode()\n const statements = arrayToStatements(context.rdfFactory, node, values)\n context.addAll(statements)\n return node\n }\n }\n\n /**\n * Transform a collection of NTriple URIs into their URI strings\n * @param t - Some iterable collection of NTriple URI strings\n * @return A collection of the URIs as strings\n * todo: explain why it is important to go through NT\n */\n NTtoURI (t) {\n let k, v\n let uris = {}\n for (k in t) {\n if (!t.hasOwnProperty(k)) continue\n v = t[k]\n if (k[0] === '<') {\n uris[k.slice(1, -1)] = v\n }\n }\n return uris\n }\n\n /**\n * Serializes this formula\n * @param base - The base string\n * @param contentType - The content type of the syntax to use\n * @param provenance - The provenance URI\n * @param options - options to pass to the serializer, as defined in serialize method\n */\n serialize (base, contentType, provenance, options?) {\n // delegate the graph serialization to the implementation in ./serialize\n return serialize(provenance, this, base, contentType, undefined, options);\n }\n\n /**\n * Creates a new formula with the substituting bindings applied\n * @param bindings - The bindings to substitute\n */\n substitute(bindings: Bindings): T {\n let statementsCopy = this.statements.map(function (ea) {\n return (ea as Statement).substitute(bindings)\n })\n // console.log('Formula subs statmnts:' + statementsCopy)\n const y = new Formula()\n y.addAll(statementsCopy as Quad[])\n // console.log('indexed-form subs formula:' + y)\n return y as unknown as T\n }\n\n sym (uri: string, name?): NamedNode {\n if (name) {\n throw new Error('This feature (kb.sym with 2 args) is removed. Do not assume prefix mappings.')\n }\n return this.rdfFactory.namedNode(uri)\n }\n\n /**\n * Gets the node matching the specified pattern. Throws when no match could be made.\n * @param s - The subject\n * @param p - The predicate\n * @param o - The object\n * @param g - The graph that contains the statement\n */\n the (\n s?: Quad_Subject | null,\n p?: Quad_Predicate | null,\n o?: Quad_Object | null,\n g?: Quad_Graph | null\n ): Node | null | undefined {\n let x = this.any(s, p, o, g)\n if (x == null) {\n log.error('No value found for the() {' + s + ' ' + p + ' ' + o + '}.')\n }\n\n return x\n }\n\n /**\n * RDFS Inference\n * These are hand-written implementations of a backward-chaining reasoner\n * over the RDFS axioms.\n * @param seeds - A hash of NTs of classes to start with\n * @param predicate - The property to trace though\n * @param inverse - Trace inverse direction\n */\n transitiveClosure(\n seeds: BooleanMap,\n predicate: Quad_Predicate,\n inverse?: boolean\n ): {\n [uri: string]: boolean;\n } {\n let elt, i, len, s, sups, t\n let agenda = {}\n Object.assign(agenda, seeds) // make a copy\n let done = {} // classes we have looked up\n while (true) {\n t = (function () {\n for (let p in agenda) {\n if (!agenda.hasOwnProperty(p)) continue\n return p\n }\n })()\n if (t == null) {\n return done\n }\n sups = inverse ?\n this.each(void 0, predicate, this.fromNT(t))\n : this.each(this.fromNT(t) as Quad_Predicate, predicate)\n for (i = 0, len = sups.length; i < len; i++) {\n elt = sups[i]\n s = elt.toNT()\n if (s in done) {\n continue\n }\n if (s in agenda) {\n continue\n }\n agenda[s] = agenda[t]\n }\n done[t] = agenda[t]\n delete agenda[t]\n }\n }\n\n /**\n * Finds the types in the list which have no *stored* supertypes\n * We exclude the universal class, owl:Things and rdf:Resource, as it is\n * information-free.\n * @param types - The types\n */\n topTypeURIs(types: {\n [id: string]: string | RDFlibNamedNode;\n }): {\n [id: string]: string | RDFlibNamedNode;\n } {\n let i\n let j\n let k\n let len\n let n\n let ref\n let tops\n let v\n tops = []\n for (k in types) {\n if (!types.hasOwnProperty(k)) continue\n v = types[k]\n n = 0\n ref = this.each(\n this.rdfFactory.namedNode(k),\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf')\n )\n for (i = 0, len = ref.length; i < len; i++) {\n j = ref[i]\n if (j.uri !== 'http://www.w3.org/2000/01/rdf-schema#Resource') {\n n++\n break\n }\n }\n if (!n) {\n tops[k] = v\n }\n }\n if (tops['http://www.w3.org/2000/01/rdf-schema#Resource']) {\n delete tops['http://www.w3.org/2000/01/rdf-schema#Resource']\n }\n if (tops['http://www.w3.org/2002/07/owl#Thing']) {\n delete tops['http://www.w3.org/2002/07/owl#Thing']\n }\n return tops\n }\n\n /**\n * Serializes this formula to a string\n */\n toString(): string {\n return '{' + this.statements.join('\\n') + '}'\n }\n\n /**\n * Gets a new variable\n * @param name - The variable's name\n */\n public variable(name: string): Variable {\n return new Variable(name)\n }\n\n /**\n * Gets the number of statements in this formula that matches the specified pattern\n * @param s - The subject\n * @param p - The predicate\n * @param o - The object\n * @param g - The graph that contains the statement\n */\n whether(\n s?: Quad_Subject | null,\n p?: Quad_Predicate | null,\n o?: Quad_Object | null,\n g?: Quad_Graph | null\n ): number {\n return this.statementsMatching(s, p, o, g, false).length\n }\n}\n","// This file attaches all functionality to Node\n// that would otherwise require circular dependencies.\nimport { fromValue } from './collection'\nimport Node from './node-internal'\nimport Namespace from './namespace'\nimport { isCollection, isLiteral } from './utils/terms'\nimport { Term } from './tf-types'\n\n/**\n * Creates an RDF Node from a native javascript value.\n * RDF Nodes are returned unchanged, undefined returned as itself.\n * @method fromValue\n * @static\n * @param value {Node|Date|String|Number|Boolean|Undefined}\n * @return {Node|Collection}\n */\nNode.fromValue = fromValue;\n\nexport default Node\n\nconst ns = { xsd: Namespace('http://www.w3.org/2001/XMLSchema#') }\n\n/**\n * Gets the javascript object equivalent to a node\n * @param term The RDF node\n */\nNode.toJS = function (term: Term): Term | boolean | number | Date | string | any[] {\n if (isCollection(term)) {\n return term.elements.map(Node.toJS) // Array node (not standard RDFJS)\n }\n if (!isLiteral(term)) return term\n if (term.datatype.equals(ns.xsd('boolean'))) {\n return term.value === '1' || term.value === 'true'\n }\n if (term.datatype.equals(ns.xsd('dateTime')) ||\n term.datatype.equals(ns.xsd('date'))) {\n return new Date(term.value)\n }\n if (\n term.datatype.equals(ns.xsd('integer')) ||\n term.datatype.equals(ns.xsd('float')) ||\n term.datatype.equals(ns.xsd('decimal'))\n ) {\n return Number(term.value)\n }\n return term.value\n}\n","// Matching a formula against another formula\n// Assync as well as Synchronously\n//\n// W3C open source licence 2005.\n//\n// This builds on term.js, match.js (and identity.js?)\n// to allow a query of a formula.\n//\n// Here we introduce for the first time a subclass of term: variable.\n//\n// SVN ID: $Id: query.js 25116 2008-11-15 16:13:48Z timbl $\n\n// Variable\n//\n// Compare with BlankNode. They are similar, but a variable\n// stands for something whose value is to be returned.\n// Also, users name variables and want the same name back when stuff is printed\n/* jsl:option explicit */ // Turn on JavaScriptLint variable declaration checking\n\nimport IndexedFormula from './store'\nimport { defaultGraphURI as defaultDocumentURI } from './utils/default-graph-uri'\nimport log from './log'\nimport { docpart } from './uri'\n\n/**\n * Query class, for tracking queries the user has in the UI.\n */\nexport class Query {\n constructor (name, id) {\n this.pat = new IndexedFormula() // The pattern to search for\n this.vars = [] // Used by UI code but not in query.js\n // this.orderBy = [] // Not used yet\n this.name = name\n this.id = id\n }\n}\n\n/**\n * This function will match a pattern to the current Store\n *\n * The callback function is called whenever a match is found\n * When fetcher is supplied this will be called to load from the web\n * any new nodes as they are discovered. This will cause the query to traverse the\n * graph of linked data, sometimes called \"Link Following Query\"\n *\n * @param myQuery - a knowledgebase containing a pattern to use as query\n * @param callback - whenever the pattern in myQuery is met this is called with\n * the new bindings as parameter\n * @param fetcher? - If and only if, you want link following, give a fetcher\n * which has been created for the quadstore being queried.\n * @param onDone - callback when query finished\n */\nexport function indexedFormulaQuery (myQuery, callback, fetcher, onDone) {\n /** Debug strings\n */\n function bindingDebug (b) {\n var str = ''\n var v\n for (v in b) {\n if (b.hasOwnProperty(v)) {\n str += ' ' + v + ' -> ' + b[v]\n }\n }\n return str\n }\n\n function bindingsDebug (nbs) {\n var str = 'Bindings: '\n var i\n var n = nbs.length\n for (i = 0; i < n; i++) {\n str += bindingDebug(nbs[i][0]) + ';\\n\\t'\n }\n return str\n } // bindingsDebug\n\n /** Unification\n *\n * Unification finds all bindings such that when the binding is applied\n * to one term it is equal to the other.\n * @returns {Arrray}- a list of bindings, where a binding is an associative array\n * mapping variuable to value.\n */\n function unifyTerm (self, other, bindings, formula) {\n var actual = bindings[self]\n if (actual === undefined) { // Not mapped\n if (self.isVar) {\n var b = []\n b[self] = other\n return [[ b, null ]] // Match\n }\n actual = self\n }\n if (!actual.complexType) {\n if (formula.redirections[actual]) {\n actual = formula.redirections[actual]\n }\n if (formula.redirections[other]) {\n other = formula.redirections[other]\n }\n if (actual.equals(other) || (actual.uri && actual.uri === defaultDocumentURI)) { // Used to mean 'any graph' in a query\n return [[ [], null ]]\n }\n return []\n }\n if (self instanceof Array) {\n if (!(other instanceof Array)) {\n return []\n }\n return unifyContents(self, other, bindings)\n }\n throw new Error('query.js: oops - code not written yet')\n // return undefined; // for lint - no jslint objects to unreachables\n // return actual.unifyContents(other, bindings)\n } // unifyTerm\n\n function unifyContents (self, other, bindings, formula) {\n var nbs2\n if (self.length !== other.length) {\n return [] // no way\n }\n if (!self.length) {\n return [[ [], null ]] // Success\n }\n var nbs = unifyTerm(self[0], other[0], bindings, formula)\n if (nbs.length === 0) {\n return nbs\n }\n var res = []\n var i\n var n = nbs.length\n var nb\n var j\n var m\n var v\n var nb2\n var bindings2\n for (i = 0; i < n; i++) { // for each possibility from the first term\n nb = nbs[i][0] // new bindings\n bindings2 = []\n for (v in nb) {\n if (nb.hasOwnProperty(v)) {\n bindings2[v] = nb[v] // copy\n }\n }\n for (v in bindings) {\n if (bindings.hasOwnProperty(v)) {\n bindings2[v] = bindings[v] // copy\n }\n }\n nbs2 = unifyContents(self.slice(1), other.slice(1), bindings2, formula)\n m = nbs2.length\n for (j = 0; j < m; j++) {\n nb2 = nbs2[j][0] // @@@@ no idea whether this is used or right\n for (v in nb) {\n if (nb.hasOwnProperty(v)) {\n nb2[v] = nb[v]\n }\n }\n res.push([nb2, null])\n }\n }\n return res\n } // unifyContents\n\n // Matching\n //\n // Matching finds all bindings such that when the binding is applied\n // to one term it is equal to the other term. We only match formulae.\n\n /** if x is not in the bindings array, return the var; otherwise, return the bindings **/\n function bind (x, binding) {\n var y = binding[x]\n if (y === undefined) {\n return x\n }\n return y\n }\n\n // When there are OPTIONAL clauses, we must return bindings without them if none of them\n // succeed. However, if any of them do succeed, we should not. (This is what branchCount()\n // tracked. The problem currently is (2011/7) that when several optionals exist, and they\n // all match, multiple sets of bindings are returned, each with one optional filled in.)\n\n function union (a, b) {\n var c = {}\n var x\n for (x in a) {\n if (a.hasOwnProperty(x)) {\n c[x] = a[x]\n }\n }\n for (x in b) {\n if (b.hasOwnProperty(x)) {\n c[x] = b[x]\n }\n }\n return c\n }\n\n function OptionalBranchJunction (originalCallback, trunkBindings) {\n this.trunkBindings = trunkBindings\n this.originalCallback = originalCallback\n this.branches = []\n // this.results = []; // result[i] is an array of bindings for branch i\n // this.done = {}; // done[i] means all/any results are in for branch i\n // this.count = {}\n return this\n }\n\n OptionalBranchJunction.prototype.checkAllDone = function () {\n var i\n for (i = 0; i < this.branches.length; i++) {\n if (!this.branches[i].done) {\n return\n }\n }\n log.debug('OPTIONAL BIDNINGS ALL DONE:')\n this.doCallBacks(this.branches.length - 1, this.trunkBindings)\n }\n // Recrursively generate the cross product of the bindings\n OptionalBranchJunction.prototype.doCallBacks = function (b, bindings) {\n var j\n if (b < 0) {\n return this.originalCallback(bindings)\n }\n for (j = 0; j < this.branches[b].results.length; j++) {\n this.doCallBacks(b - 1, union(bindings, this.branches[b].results[j]))\n }\n }\n\n // A mandatory branch is the normal one, where callbacks\n // are made immediately and no junction is needed.\n // Might be useful for onFinsihed callback for query API.\n function MandatoryBranch (callback, onDone) {\n this.count = 0\n this.success = false\n this.done = false\n // this.results = []\n this.callback = callback\n this.onDone = onDone\n // this.junction = junction\n // junction.branches.push(this)\n return this\n }\n\n MandatoryBranch.prototype.reportMatch = function (bindings) {\n // log.error(\"@@@@ query.js 1\"); // @@\n this.callback(bindings)\n this.success = true\n }\n\n MandatoryBranch.prototype.reportDone = function () {\n this.done = true\n log.info('Mandatory query branch finished.***')\n if (this.onDone !== undefined) {\n this.onDone()\n }\n }\n\n // An optional branch hoards its results.\n var OptionalBranch = function (junction) {\n this.count = 0\n this.done = false\n this.results = []\n this.junction = junction\n junction.branches.push(this)\n return this\n }\n\n OptionalBranch.prototype.reportMatch = function (bindings) {\n this.results.push(bindings)\n }\n\n OptionalBranch.prototype.reportDone = function () {\n log.debug('Optional branch finished - results.length = ' + this.results.length)\n if (this.results.length === 0) { // This is what optional means: if no hits,\n this.results.push({}) // mimic success, but with no bindings\n log.debug(\"Optional branch FAILED - that's OK.\")\n }\n this.done = true\n this.junction.checkAllDone()\n }\n\n /** prepare -- sets the index of the item to the possible matches\n * @param f - formula\n * @param item - an Statement, possibly w/ vars in it\n * @param bindings - Bindings so far\n * @returns false if the query fails -- there are no items that match\n */\n function prepare (f, item, bindings) {\n var terms, termIndex, i, ind\n item.nvars = 0\n item.index = null\n // if (!f.statements) log.warn(\"@@@ prepare: f is \"+f)\n // log.debug(\"Prepare: f has \"+ f.statements.length)\n // log.debug(\"Prepare: Kb size \"+f.statements.length+\" Preparing \"+item)\n\n terms = [item.subject, item.predicate, item.object, item.why]\n ind = [f.subjectIndex, f.predicateIndex, f.objectIndex, f.whyIndex]\n for (i = 0; i < 4; i++) {\n let t = terms[i]\n // console.log(\" Prepare (\" + t + \") \"+(t in bindings))\n if (t.uri && t.uri === defaultDocumentURI) { // chrome:session\n // console.log(' query: Ignoring slot ' + i)\n } else if (t.isVar && !(bindings[t] !== undefined)) {\n item.nvars++\n } else {\n t = bind(terms[i], bindings) // returns the RDF binding if bound, otherwise itself\n // if (terms[i]!=bind(terms[i],bindings) alert(\"Term: \"+terms[i]+\"Binding: \"+bind(terms[i], bindings))\n if (f.redirections[f.id(t)]) {\n t = f.redirections[f.id(t)] // redirect\n }\n termIndex = ind[i][f.id(t)]\n\n if (!termIndex) {\n item.index = []\n return false // Query line cannot match\n }\n if ((item.index === null) || (item.index.length > termIndex.length)) { // Find smallest index\n item.index = termIndex\n }\n }\n }\n\n if (item.index === null) { // All 4 are variables?\n item.index = f.statements\n }\n return true\n } // prepare\n\n /** sorting function -- negative if self is easier **/\n // We always prefer to start with a URI to be able to browse a graph\n // this is why we put off items with more variables till later.\n function easiestQuery (self, other) {\n if (self.nvars !== other.nvars) {\n return self.nvars - other.nvars\n }\n return self.index.length - other.index.length\n }\n\n var matchIndex = 0 // index\n /** matches a pattern formula against the knowledge base, e.g. to find matches for table-view\n *\n * @param f - knowledge base formula\n * @param g - pattern formula (may have vars)\n * @param bindingsSoFar - bindings accumulated in matching to date\n * @param level - spaces to indent stuff also lets you know what level of recursion you're at\n * @param fetcher - function (term, requestedBy) If you want link following\n * @param localCallback - function(bindings, pattern, branch) called on sucess\n * @returns nothing\n *\n * Will fetch linked data from the web iff the knowledge base an associated source fetcher (f.fetcher)\n ***/\n var match = function (f, g, bindingsSoFar, level, fetcher, localCallback, branch) {\n log.debug('Match begins, Branch count now: ' + branch.count + ' for ' + branch.pattern_debug)\n\n // log.debug(\"match: f has \"+f.statements.length+\", g has \"+g.statements.length)\n var pattern = g.statements\n if (pattern.length === 0) { // when it's satisfied all the pattern triples\n log.debug('FOUND MATCH WITH BINDINGS:' + bindingDebug(bindingsSoFar))\n if (g.optional.length === 0) {\n branch.reportMatch(bindingsSoFar)\n } else {\n log.debug('OPTIONAL: ' + g.optional)\n var junction = new OptionalBranchJunction(callback, bindingsSoFar) // @@ won't work with nested optionals? nest callbacks\n var br = []\n var b\n for (b = 0; b < g.optional.length; b++) {\n br[b] = new OptionalBranch(junction) // Allocate branches to prevent premature ending\n br[b].pattern_debug = g.optional[b] // for diagnotics only\n }\n for (b = 0; b < g.optional.length; b++) {\n br[b].count = br[b].count + 1 // Count how many matches we have yet to complete\n match(f, g.optional[b], bindingsSoFar, '', fetcher, callback, br[b])\n }\n }\n branch.count--\n log.debug('Match ends -- success , Branch count now: ' + branch.count + ' for ' + branch.pattern_debug)\n return // Success\n }\n\n var item\n var i\n var n = pattern.length\n // log.debug(level + \"Match \"+n+\" left, bs so far:\"+bindingDebug(bindingsSoFar))\n\n // Follow links from variables in query\n if (fetcher) { // Fetcher is used to fetch URIs, function first term is a URI term, second is the requester\n var id = 'match' + matchIndex++\n var fetchResource = function (requestedTerm, id) {\n var docuri = requestedTerm.uri.split('#')[0]\n fetcher.nowOrWhenFetched(docuri, undefined, function (ok, body, xhr) {\n if (!ok) {\n console.log('Error following link to <' + requestedTerm.uri + '> in query: ' + body)\n }\n match(f, g, bindingsSoFar, level, fetcher, // match not match2 to look up any others necessary.\n localCallback, branch)\n })\n }\n for (i = 0; i < n; i++) {\n item = pattern[i] // for each of the triples in the query\n if (bindingsSoFar[item.subject] !== undefined &&\n bindingsSoFar[item.subject].uri && fetcher &&\n fetcher.getState(docpart(bindingsSoFar[item.subject].uri)) === 'unrequested') {\n // fetch the subject info and return to id\n fetchResource(bindingsSoFar[item.subject], id)\n return // only look up one per line this time, but we will come back again though match\n }\n if (bindingsSoFar[item.object] !== undefined &&\n bindingsSoFar[item.object].uri && fetcher &&\n fetcher.getState(docpart(bindingsSoFar[item.object].uri)) === 'unrequested') {\n fetchResource(bindingsSoFar[item.object], id)\n return\n }\n }\n } // if fetcher\n match2(f, g, bindingsSoFar, level, fetcher, localCallback, branch)\n } // match\n\n var constraintsSatisfied = function (bindings, constraints) {\n var res = true\n var x\n var test\n for (x in bindings) {\n if (bindings.hasOwnProperty(x)) {\n if (constraints[x]) {\n test = constraints[x].test\n if (test && !test(bindings[x])) {\n res = false\n }\n }\n }\n }\n return res\n }\n\n /** match2 -- stuff after the fetch **/\n var match2 = function (f, g, bindingsSoFar, level, fetcher, callback, branch) { // post fetch\n var pattern = g.statements\n var n = pattern.length\n var i\n var k\n var nk\n var v\n var bindings2\n var newBindings1\n var item\n for (i = 0; i < n; i++) { // For each statement left in the query, run prepare\n item = pattern[i]\n // log.info('match2: item=' + item + ', bindingsSoFar=' + bindingDebug(bindingsSoFar))\n prepare(f, item, bindingsSoFar)\n // if (item.index) console.log(' item.index.length ' + item.index.length)\n }\n pattern.sort(easiestQuery)\n item = pattern[0]\n // log.debug(\"Sorted pattern:\\n\"+pattern)\n var rest = f.formula()\n rest.optional = g.optional\n rest.constraints = g.constraints\n rest.statements = pattern.slice(1) // No indexes: we will not query g.\n log.debug(level + 'match2 searching ' + item.index.length + ' for ' + item +\n '; bindings so far=' + bindingDebug(bindingsSoFar))\n // var results = []\n var c\n var nc = item.index.length\n var nbs1\n var st\n var onward = 0\n // var x\n for (c = 0; c < nc; c++) { // For each candidate statement\n st = item.index[c] // for each statement in the item's index, spawn a new match with that binding\n nbs1 = unifyContents(\n [item.subject, item.predicate, item.object, item.why],\n [st.subject, st.predicate, st.object, st.why], bindingsSoFar, f)\n log.info(level + ' From first: ' + nbs1.length + ': ' + bindingsDebug(nbs1))\n nk = nbs1.length\n // branch.count += nk\n // log.debug(\"Branch count bumped \"+nk+\" to: \"+branch.count)\n for (k = 0; k < nk; k++) { // For each way that statement binds\n bindings2 = []\n newBindings1 = nbs1[k][0]\n if (!constraintsSatisfied(newBindings1, g.constraints)) {\n // branch.count--\n log.debug('Branch count CS: ' + branch.count)\n } else {\n for (v in newBindings1) {\n if (newBindings1.hasOwnProperty(v)) {\n bindings2[v] = newBindings1[v] // copy\n }\n }\n for (v in bindingsSoFar) {\n if (bindingsSoFar.hasOwnProperty(v)) {\n bindings2[v] = bindingsSoFar[v] // copy\n }\n }\n\n branch.count++ // Count how many matches we have yet to complete\n onward++\n match(f, rest, bindings2, level + ' ', fetcher, callback, branch) // call match\n }\n }\n }\n branch.count--\n if (onward === 0) {\n log.debug('Match2 fails completely on ' + item)\n }\n log.debug('Match2 ends, Branch count: ' + branch.count + ' for ' + branch.pattern_debug)\n if (branch.count === 0) {\n log.debug('Branch finished.')\n branch.reportDone()\n }\n } // match2\n // ////////////////////////// Body of query() ///////////////////////\n var f = this\n log.debug('Query on ' + this.statements.length)\n var trunck = new MandatoryBranch(callback, onDone)\n trunck.count++ // count one branch to complete at the moment\n if (myQuery.sync) {\n match(f, myQuery.pat, myQuery.pat.initBindings, '', fetcher, callback, trunck)\n } else { // Give up thread: Allow other activities to run\n setTimeout(function () {\n match(f, myQuery.pat, myQuery.pat.initBindings, '', fetcher, callback, trunck)\n }, 0)\n }\n\n // returns nothing; callback does the work\n} // query\n","/* Identity management and indexing for RDF\n *\n * This file provides IndexedFormula a formula (set of triples) which\n * indexed by predicate, subject and object.\n *\n * It \"smushes\" (merges into a single node) things which are identical\n * according to owl:sameAs or an owl:InverseFunctionalProperty\n * or an owl:FunctionalProperty\n *\n *\n * 2005-10 Written Tim Berners-Lee\n * 2007 Changed so as not to munge statements from documents when smushing\n * 2019 Converted to typescript\n *\n *\n*/\n\n/** @module store */\n\nimport ClassOrder from './class-order'\nimport { defaultGraphURI } from './factories/canonical-data-factory'\nimport Formula, { FormulaOpts } from './formula'\nimport { ArrayIndexOf } from './utils'\nimport { RDFArrayRemove } from './utils-js'\nimport {\n isRDFlibSubject,\n isRDFlibPredicate,\n isRDFlibObject,\n isStore,\n isGraph,\n // isPredicate,\n isQuad,\n // isSubject\n} from './utils/terms'\nimport Node from './node'\nimport Variable from './variable'\nimport { Query, indexedFormulaQuery } from './query'\nimport UpdateManager from './update-manager'\nimport {\n Bindings, BlankNodeTermType, CollectionTermType, DefaultGraphTermType, EmptyTermType, GraphTermType, LiteralTermType, NamedNodeTermType, VariableTermType\n} from './types'\nimport Statement from './statement'\nimport { Indexable } from './factories/factory-types'\nimport NamedNode from './named-node'\nimport Fetcher from './fetcher'\nimport {\n Quad_Graph,\n Literal as TFLiteral,\n NamedNode as TFNamedNode,\n Quad_Object,\n Quad_Predicate,\n Quad,\n Quad_Subject,\n Term,\n} from './tf-types'\nimport { namedNode } from './index'\nimport serialize from \"./serialize\";\nimport BlankNode from './blank-node'\nimport DefaultGraph from './default-graph'\nimport Empty from './empty'\nimport Literal from './literal'\nimport Collection from './collection'\n\nconst owlNamespaceURI = 'http://www.w3.org/2002/07/owl#'\n\ntype FeaturesType = Array<('sameAs' | 'InverseFunctionalProperty' | 'FunctionalProperty')> | undefined\n\nexport { defaultGraphURI }\n// var link_ns = 'http://www.w3.org/2007/ont/link#'\n\n// Handle Functional Property\nfunction handleFP (\n formula: IndexedFormula,\n subj: Quad_Subject,\n pred: Quad_Predicate,\n obj: Quad_Object\n): boolean {\n var o1 = formula.any(subj, pred, undefined)\n if (!o1) {\n return false // First time with this value\n }\n // log.warn(\"Equating \"+o1.uri+\" and \"+obj.uri + \" because FP \"+pred.uri); //@@\n formula.equate(o1, obj)\n return true\n} // handleFP\n\n// Handle Inverse Functional Property\nfunction handleIFP (\n formula: IndexedFormula,\n subj: Quad_Subject,\n pred: Quad_Predicate,\n obj: Quad_Object\n): boolean {\n var s1 = formula.any(undefined, pred, obj)\n if (!s1) {\n return false // First time with this value\n }\n // log.warn(\"Equating \"+s1.uri+\" and \"+subj.uri + \" because IFP \"+pred.uri); //@@\n formula.equate(s1, subj)\n return true\n} // handleIFP\n\nfunction handleRDFType (\n formula: IndexedFormula,\n subj: Quad_Subject,\n pred: Quad_Predicate,\n obj: Quad_Object,\n why: Quad_Graph\n) {\n //@ts-ignore this method does not seem to exist in this library\n if (formula.typeCallback) {\n (formula as any).typeCallback(formula, obj, why)\n }\n\n var x = formula.classActions[formula.id(obj)]\n var done = false\n if (x) {\n for (var i = 0; i < x.length; i++) {\n done = done || x[i](formula, subj, pred, obj, why)\n }\n }\n return done // statement given is not needed if true\n}\n\n/**\n * Indexed Formula aka Store\n */\nexport default class IndexedFormula extends Formula { // IN future - allow pass array of statements to constructor\n /**\n * An UpdateManager initialised to this store\n */\n updater?: UpdateManager\n\n /**\n * Dictionary of namespace prefixes\n */\n namespaces: {[key: string]: string}\n\n /** Map of iri predicates to functions to call when adding { s type X } */\n classActions: { [k: string]: Function[] }\n /** Map of iri predicates to functions to call when getting statement with {s X o} */\n propertyActions: { [k: string]: Function[] }\n /** Redirect to lexically smaller equivalent symbol */\n redirections: any[]\n /** Reverse mapping to redirection: aliases for this */\n aliases: any[]\n /** Redirections we got from HTTP */\n HTTPRedirects: Statement[]\n /** Array of statements with this X as subject */\n subjectIndex: Statement[]\n /** Array of statements with this X as predicate */\n predicateIndex: Statement[]\n /** Array of statements with this X as object */\n objectIndex: Statement[]\n /** Array of statements with X as provenance */\n whyIndex: Statement[]\n index: [\n Statement[],\n Statement[],\n Statement[],\n Statement[]\n ]\n features: FeaturesType\n static handleRDFType: Function\n _universalVariables?: NamedNode[]\n _existentialVariables?: BlankNode[]\n\n /** Function to remove quads from the store arrays with */\n private rdfArrayRemove: (arr: Quad[], q: Quad) => void\n /** Callbacks which are triggered after a statement has been added to the store */\n private dataCallbacks?: Array<(q: Quad) => void>\n\n /**\n * Creates a new formula\n * @param features - What sort of automatic processing to do? Array of string\n * @param features.sameAs - Smush together A and B nodes whenever { A sameAs B }\n * @param opts\n * @param [opts.rdfFactory] - The data factory that should be used by the store\n * @param [opts.rdfArrayRemove] - Function which removes statements from the store\n * @param [opts.dataCallback] - Callback when a statement is added to the store, will not trigger when adding duplicates\n */\n constructor (features?: FeaturesType, opts: FormulaOpts = {}) {\n super(undefined, undefined, undefined, undefined, opts)\n\n this.propertyActions = {}\n this.classActions = {}\n this.redirections = []\n this.aliases = []\n this.HTTPRedirects = []\n this.subjectIndex = []\n this.predicateIndex = []\n this.objectIndex = []\n this.whyIndex = []\n this.index = [\n this.subjectIndex,\n this.predicateIndex,\n this.objectIndex,\n this.whyIndex\n ]\n this.namespaces = {} // Dictionary of namespace prefixes\n this.features = features || [ // By default, devs do not expect these features.\n// See https://github.com/linkeddata/rdflib.js/issues/458\n// 'sameAs',\n// 'InverseFunctionalProperty',\n// 'FunctionalProperty',\n ]\n this.rdfArrayRemove = opts.rdfArrayRemove || RDFArrayRemove\n if (opts.dataCallback) {\n this.dataCallbacks = [opts.dataCallback]\n }\n\n this.initPropertyActions(this.features)\n }\n\n /**\n * Gets the URI of the default graph\n */\n static get defaultGraphURI(): string {\n return defaultGraphURI\n }\n\n /**\n * Gets this graph with the bindings substituted\n * @param bindings The bindings\n */\n substitute (bindings: Bindings): T {\n var statementsCopy = this.statements.map(function (ea: Quad) {\n return (ea as Statement).substitute(bindings)\n })\n var y = new IndexedFormula()\n y.add(statementsCopy)\n return y as unknown as T\n }\n\n /**\n * Add a callback which will be triggered after a statement has been added to the store.\n * @param cb\n */\n addDataCallback(cb: (q: Quad) => void): void {\n if (!this.dataCallbacks) {\n this.dataCallbacks = []\n }\n this.dataCallbacks.push(cb)\n }\n\n /**\n * Apply a set of statements to be deleted and to be inserted\n *\n * @param patch - The set of statements to be deleted and to be inserted\n * @param target - The name of the document to patch\n * @param patchCallback - Callback to be called when patching is complete\n */\n applyPatch(\n patch: {\n delete?: ReadonlyArray,\n patch?: ReadonlyArray,\n where?: any\n },\n target: TFNamedNode,\n patchCallback: (errorString?: string) => void\n ): void {\n var targetKB = this\n var ds\n var binding: Bindings | null = null\n\n function doPatch (onDonePatch: (errorString?: string) => void) {\n if (patch['delete']) {\n ds = patch['delete']\n // console.log(bindingDebug(binding))\n // console.log('ds before substitute: ' + ds)\n if (binding) ds = ds.substitute(binding)\n // console.log('applyPatch: delete: ' + ds)\n ds = ds.statements as Statement[]\n var bad: Quad[] = []\n var ds2 = ds.map(function (st: Quad) { // Find the actual statements in the store\n var sts = targetKB.statementsMatching(st.subject, st.predicate, st.object, target)\n if (sts.length === 0) {\n // log.info(\"NOT FOUND deletable \" + st)\n bad.push(st)\n return null\n } else {\n // log.info(\"Found deletable \" + st)\n return sts[0]\n }\n })\n if (bad.length) {\n // console.log('Could not find to delete ' + bad.length + 'statements')\n // console.log('despite ' + targetKB.statementsMatching(bad[0].subject, bad[0].predicate)[0])\n return patchCallback('Could not find to delete: ' + bad.join('\\n or '))\n }\n ds2.map(function (st: Quad) {\n targetKB.remove(st)\n })\n }\n if (patch['insert']) {\n // log.info(\"doPatch insert \"+patch['insert'])\n ds = patch['insert']\n if (binding) ds = ds.substitute(binding)\n ds = ds.statements\n ds.map(function (st: Quad) {\n st.graph = target\n targetKB.add(st.subject, st.predicate, st.object, st.graph)\n })\n }\n onDonePatch()\n }\n if (patch.where) {\n // log.info(\"Processing WHERE: \" + patch.where + '\\n')\n var query = new Query('patch')\n query.pat = patch.where\n query.pat.statements.map(function (st) {\n st.graph = namedNode(target.value)\n })\n //@ts-ignore TODO: add sync property to Query when converting Query to typescript\n query.sync = true\n\n var bindingsFound: Bindings[] = []\n\n targetKB.query(\n query,\n function onBinding (binding) {\n bindingsFound.push(binding)\n // console.log(' got a binding: ' + bindingDebug(binding))\n },\n targetKB.fetcher,\n function onDone () {\n if (bindingsFound.length === 0) {\n return patchCallback('No match found to be patched:' + patch.where)\n }\n if (bindingsFound.length > 1) {\n return patchCallback('Patch ambiguous. No patch done.')\n }\n binding = bindingsFound[0]\n doPatch(patchCallback)\n })\n } else {\n doPatch(patchCallback)\n }\n }\n\n /**\n * N3 allows for declaring blank nodes, this function enables that support\n *\n * @param x The blank node to be declared, supported in N3\n */\n declareExistential(x: BlankNode): BlankNode {\n if (!this._existentialVariables) this._existentialVariables = []\n this._existentialVariables.push(x)\n return x\n }\n\n /**\n * @param features\n */\n initPropertyActions(features: FeaturesType) {\n // If the predicate is #type, use handleRDFType to create a typeCallback on the object\n this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'))] =\n [ handleRDFType ]\n\n // Assumption: these terms are not redirected @@fixme\n if (ArrayIndexOf(features, 'sameAs') >= 0) {\n this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode(`${owlNamespaceURI}sameAs`))] = [\n function (formula, subj, pred, obj, why) {\n // log.warn(\"Equating \"+subj.uri+\" sameAs \"+obj.uri); //@@\n formula.equate(subj, obj)\n return true // true if statement given is NOT needed in the store\n }\n ] // sameAs -> equate & don't add to index\n }\n if (ArrayIndexOf(features, 'InverseFunctionalProperty') >= 0) {\n this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode(`${owlNamespaceURI}InverseFunctionalProperty`))] = [\n function (formula, subj, pred, obj, addFn) {\n // yes subj not pred!\n return formula.newPropertyAction(subj, handleIFP)\n }\n ] // IFP -> handleIFP, do add to index\n }\n if (ArrayIndexOf(features, 'FunctionalProperty') >= 0) {\n this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode(`${owlNamespaceURI}FunctionalProperty`))] = [\n function (formula, subj, proj, obj, addFn) {\n return formula.newPropertyAction(subj, handleFP)\n }\n ] // FP => handleFP, do add to index\n }\n }\n\n /** @deprecated Use {add} instead */\n addStatement (st: Quad): number {\n this.add(st.subject, st.predicate, st.object, st.graph)\n return this.statements.length\n }\n\n /**\n * Adds a triple (quad) to the store.\n *\n * @param subj - The thing about which the fact a relationship is asserted.\n * Also accepts a statement or an array of Statements.\n * @param pred - The relationship which is asserted\n * @param obj - The object of the relationship, e.g. another thing or a value. If passed a string, this will become a literal.\n * @param why - The document in which the triple (S,P,O) was or will be stored on the web\n * @returns The statement added to the store, or the store\n */\n add (\n subj: Quad_Subject | Quad | Quad[] | Statement | Statement[],\n pred?: Quad_Predicate,\n obj?: Term | string,\n why?: Quad_Graph\n ): Statement | null | this | number {\n var i: number\n if (arguments.length === 1) {\n if (subj instanceof Array) {\n for (i = 0; i < subj.length; i++) {\n this.add(subj[i])\n }\n } else if (isQuad(subj)) {\n this.add(subj.subject, subj.predicate, subj.object, subj.graph)\n } else if (isStore(subj)) {\n this.add((subj as any).statements)\n }\n return this\n }\n var actions: Function[]\n var st: Statement\n if (!why) {\n // system generated\n why = this.fetcher ? this.fetcher.appNode : this.rdfFactory.defaultGraph()\n }\n if (typeof subj == 'string') {\n subj = this.rdfFactory.namedNode(subj)\n }\n pred = Node.fromValue(pred)\n const objNode = Node.fromValue(obj) as Term\n why = Node.fromValue(why)\n if (!isRDFlibSubject(subj)) {\n throw new Error('Subject is not a subject type')\n }\n if (!isRDFlibPredicate(pred)) {\n throw new Error(`Predicate ${pred} is not a predicate type`)\n }\n if (!isRDFlibObject(objNode)) {\n throw new Error(`Object ${objNode} is not an object type`)\n }\n if (!isGraph(why)) {\n throw new Error(\"Why is not a graph type\")\n }\n //@ts-ignore This is not used internally\n if (this.predicateCallback) {\n //@ts-ignore This is not used internally\n this.predicateCallback(this, pred, why)\n }\n // Action return true if the statement does not need to be added\n var predHash = this.id(this.canon(pred!))\n actions = this.propertyActions[predHash] // Predicate hash\n var done = false\n if (actions) {\n // alert('type: '+typeof actions +' @@ actions='+actions)\n for (i = 0; i < actions.length; i++) {\n done = done || actions[i](this, subj, pred, objNode, why)\n }\n }\n if (this.holds(subj, pred, objNode, why)) { // Takes time but saves duplicates\n // console.log('rdflib: Ignoring dup! {' + subj + ' ' + pred + ' ' + obj + ' ' + why + '}')\n return null // @@better to return self in all cases?\n }\n // If we are tracking provenance, every thing should be loaded into the store\n // if (done) return this.rdfFactory.quad(subj, pred, obj, why)\n // Don't put it in the store\n // still return this statement for owl:sameAs input\n var hash = [\n this.id(this.canon(subj)),\n predHash,\n this.id(this.canon(objNode)),\n this.id(this.canon(why))\n ]\n // @ts-ignore this will fail if you pass a collection and the factory does not allow Collections\n st = this.rdfFactory.quad(subj, pred, objNode, why)\n for (i = 0; i < 4; i++) {\n var ix = this.index[i]\n var h = hash[i]\n if (!ix[h]) {\n ix[h] = []\n }\n ix[h].push(st) // Set of things with this as subject, etc\n }\n\n // log.debug(\"ADDING {\"+subj+\" \"+pred+\" \"+objNode+\"} \"+why)\n this.statements.push(st)\n\n if (this.dataCallbacks) {\n for (const callback of this.dataCallbacks) {\n callback(st)\n }\n }\n\n return st\n }\n\n /**\n * Returns the symbol with canonical URI as smushed\n * @param term - An RDF node\n */\n canon(term?: Term): Node {\n if (!term) {\n // @@ TODO Should improve this to return proper value - doing this to keep it backward compatible\n return term as unknown as Node\n }\n const y = this.redirections[this.id(term)]\n if (y) {\n return y\n }\n switch (term.termType) {\n case BlankNodeTermType:\n return new BlankNode(term.value)\n case CollectionTermType:\n return term as Collection // non-RDF/JS type, should just need to cast\n case DefaultGraphTermType:\n return new DefaultGraph()\n case EmptyTermType: // non-RDF/JS type, should just need to cast\n return term as Empty\n case GraphTermType: // non-RDF/JS type, should just need to cast\n return term as IndexedFormula\n case LiteralTermType:\n return new Literal(term.value, (term as TFLiteral).language, (term as TFLiteral).datatype)\n case NamedNodeTermType:\n return new NamedNode(term.value)\n case VariableTermType:\n return new Variable(term.value)\n default:\n throw new Error(`Term Type not recognized for canonization: ${term.termType}`)\n }\n }\n\n\n /**\n * Checks this formula for consistency\n */\n check(): void {\n this.checkStatementList(this.statements)\n for (var p = 0; p < 4; p++) {\n var ix = this.index[p]\n for (var key in ix) {\n if (ix.hasOwnProperty(key)) {\n // @ts-ignore should this pass an array or a single statement? checkStateMentsList expects an array.\n this.checkStatementList(ix[key], p)\n }\n }\n }\n }\n\n /**\n * Checks a list of statements for consistency\n * @param sts - The list of statements to check\n * @param from - An index with the array ['subject', 'predicate', 'object', 'why']\n */\n checkStatementList(\n sts: ReadonlyArray,\n from?: number\n ): boolean | void {\n if (from === undefined) {\n from = 0\n }\n var names = ['subject', 'predicate', 'object', 'why']\n var origin = ' found in ' + names[from] + ' index.'\n var st: Quad\n for (var j = 0; j < sts.length; j++) {\n st = sts[j]\n var term = [ st.subject, st.predicate, st.object, st.graph ]\n var arrayContains = function (a: Array, x: Quad) {\n for (var i = 0; i < a.length; i++) {\n if (a[i].subject.equals(x.subject) &&\n a[i].predicate.equals(x.predicate) &&\n a[i].object.equals(x.object) &&\n a[i].why.equals(x.graph)) {\n return true\n }\n }\n }\n for (var p = 0; p < 4; p++) {\n var c = this.canon(term[p])\n var h = this.id(c)\n if (!this.index[p][h]) {\n // throw new Error('No ' + name[p] + ' index for statement ' + st + '@' + st.why + origin)\n } else {\n if (!arrayContains(this.index[p][h], st)) {\n // throw new Error('Index for ' + name[p] + ' does not have statement ' + st + '@' + st.why + origin)\n }\n }\n }\n if (!arrayContains(this.statements, st)) {\n throw new Error('Statement list does not statement ' + st + '@' + st.graph + origin)\n }\n }\n }\n\n /**\n * Closes this formula (and return it)\n */\n close(): IndexedFormula {\n return this\n }\n\n compareTerms(u1: Term, u2: Term): number {\n // Keep compatibility with downstream classOrder changes\n if (Object.prototype.hasOwnProperty.call(u1, \"compareTerm\")) {\n return (u1 as Node).compareTerm(u2 as Node)\n }\n if (ClassOrder[u1.termType] < ClassOrder[u2.termType]) {\n return -1\n }\n if (ClassOrder[u1.termType] > ClassOrder[u2.termType]) {\n return +1\n }\n if (u1.value < u2.value) {\n return -1\n }\n if (u1.value > u2.value) {\n return +1\n }\n return 0\n }\n\n\n /**\n * replaces @template with @target and add appropriate triples\n * removes no triples by default and is a one-direction replication\n * @param template node to copy\n * @param target node to copy to\n * @param flags Whether or not to do a two-directional copy and/or delete triples\n */\n copyTo(\n template: Quad_Subject,\n target: Quad_Subject,\n flags?: Array<('two-direction' | 'delete')>\n ): void {\n if (!flags) flags = []\n var statList = this.statementsMatching(template)\n if (ArrayIndexOf(flags, 'two-direction') !== -1) {\n statList.concat(this.statementsMatching(undefined, undefined, template))\n }\n for (var i = 0; i < statList.length; i++) {\n var st = statList[i]\n switch (st.object.termType) {\n case 'NamedNode':\n this.add(target, st.predicate, st.object)\n break\n case 'Literal':\n case 'BlankNode':\n // @ts-ignore Collections can appear here\n case 'Collection':\n // @ts-ignore Possible bug: copy is not available on Collections\n this.add(target, st.predicate, st.object.copy(this))\n }\n if (ArrayIndexOf(flags, 'delete') !== -1) {\n this.remove(st)\n }\n }\n }\n\n /**\n * Simplify graph in store when we realize two identifiers are equivalent\n * We replace the bigger with the smaller.\n * @param u1in The first node\n * @param u2in The second node\n */\n equate(u1in: Term, u2in : Term): boolean {\n // log.warn(\"Equating \"+u1+\" and \"+u2); // @@\n // @@JAMBO Must canonicalize the uris to prevent errors from a=b=c\n // 03-21-2010\n const u1 = this.canon(u1in) as Quad_Subject\n const u2 = this.canon(u2in) as Quad_Subject\n var d = this.compareTerms(u1, u2)\n if (!d) {\n return true // No information in {a = a}\n }\n // var big\n // var small\n if (d < 0) { // u1 less than u2\n return this.replaceWith(u2, u1)\n } else {\n return this.replaceWith(u1, u2)\n }\n }\n\n /**\n * Creates a new empty indexed formula\n * Only applicable for IndexedFormula, but TypeScript won't allow a subclass to override a property\n * @param features The list of features\n */\n formula(features: FeaturesType): IndexedFormula {\n return new IndexedFormula(features)\n }\n\n /**\n * Returns the number of statements contained in this IndexedFormula.\n * (Getter proxy to this.statements).\n * Usage:\n * ```\n * var kb = rdf.graph()\n * kb.length // -> 0\n * ```\n * @returns {Number}\n */\n get length (): number {\n return this.statements.length\n }\n\n /**\n * Returns any quads matching the given arguments.\n * Standard RDFJS spec method for Source objects, implemented as an\n * alias to `statementsMatching()`\n * @param subject The subject\n * @param predicate The predicate\n * @param object The object\n * @param graph The graph that contains the statement\n */\n match(\n subject?: Quad_Subject | null,\n predicate?: Quad_Predicate | null,\n object?: Quad_Object | null,\n graph?: Quad_Graph | null\n ): Quad[] {\n return this.statementsMatching(\n Node.fromValue(subject),\n Node.fromValue(predicate),\n Node.fromValue(object),\n Node.fromValue(graph)\n )\n }\n\n /**\n * Find out whether a given URI is used as symbol in the formula\n * @param uri The URI to look for\n */\n mentionsURI(uri: string): boolean {\n var hash = '<' + uri + '>'\n return (!!this.subjectIndex[hash] ||\n !!this.objectIndex[hash] ||\n !!this.predicateIndex[hash])\n }\n\n /**\n * Existentials are BNodes - something exists without naming\n * @param uri An URI\n */\n newExistential(uri: string): Term {\n if (!uri) return this.bnode()\n var x = this.sym(uri)\n // @ts-ignore x should be blanknode, but is namedNode.\n return this.declareExistential(x)\n }\n\n /**\n * Adds a new property action\n * @param pred the predicate that the function should be triggered on\n * @param action the function that should trigger\n */\n newPropertyAction(\n pred: Quad_Predicate,\n action: (\n store: IndexedFormula,\n subject: Quad_Subject,\n predicate: Quad_Predicate,\n object: Quad_Object\n ) => boolean\n ): boolean {\n // log.debug(\"newPropertyAction: \"+pred)\n var hash = this.id(pred)\n if (!this.propertyActions[hash]) {\n this.propertyActions[hash] = []\n }\n this.propertyActions[hash].push(action)\n // Now apply the function to to statements already in the store\n var toBeFixed = this.statementsMatching(undefined, pred, undefined)\n var done = false\n for (var i = 0; i < toBeFixed.length; i++) { // NOT optimized - sort toBeFixed etc\n done = done || action(this, toBeFixed[i].subject, pred, toBeFixed[i].object)\n }\n return done\n }\n\n /**\n * Creates a new universal node\n * Universals are Variables\n * @param uri An URI\n */\n newUniversal(uri: string): TFNamedNode {\n var x = this.sym(uri)\n if (!this._universalVariables) this._universalVariables = []\n this._universalVariables.push(x)\n return x\n }\n\n // convenience function used by N3 parser\n variable (name: string) {\n return new Variable(name)\n }\n\n /**\n * Find an unused id for a file being edited: return a symbol\n * (Note: Slow iff a lot of them -- could be O(log(k)) )\n * @param doc A document named node\n */\n nextSymbol(doc: TFNamedNode): TFNamedNode {\n for (var i = 0; ;i++) {\n var uri = doc.value + '#n' + i\n if (!this.mentionsURI(uri)) return this.sym(uri)\n }\n }\n\n /**\n * Query this store asynchronously, return bindings in callback\n *\n * @param myQuery The query to be run\n * @param callback Function to call when bindings\n * @param Fetcher | null If you want the query to do link following\n * @param onDone OBSOLETE - do not use this // @@ Why not ?? Called when query complete\n */\n query(\n myQuery: Query,\n callback: (bindings: Bindings) => void,\n fetcher?: Fetcher | null,\n onDone?: () => void\n ): void {\n return indexedFormulaQuery.call(this, myQuery, callback, fetcher, onDone)\n }\n\n /**\n * Query this store synchronously and return bindings\n *\n * @param myQuery The query to be run\n */\n querySync(myQuery: Query): any[] {\n var results: Bindings[] = []\n function saveBinginds (bindings: Bindings) {\n results.push(bindings)\n }\n function onDone () {\n done = true\n }\n var done = false\n // @ts-ignore TODO: Add .sync to Query\n myQuery.sync = true\n\n indexedFormulaQuery.call(this, myQuery, saveBinginds, null, onDone)\n if (!done) {\n throw new Error('Sync query should have called done function')\n }\n return results\n }\n\n /**\n * Removes one or multiple statement(s) from this formula\n * @param st - A Statement or array of Statements to remove\n */\n remove(st: Quad | Quad[]): IndexedFormula {\n if (st instanceof Array) {\n for (var i = 0; i < st.length; i++) {\n this.remove(st[i])\n }\n return this\n }\n if (isStore(st)) {\n return this.remove(st.statements)\n }\n var sts = this.statementsMatching(st.subject, st.predicate, st.object, st.graph)\n if (!sts.length) {\n throw new Error('Statement to be removed is not on store: ' + st)\n }\n this.removeStatement(sts[0])\n return this\n }\n\n /**\n * Removes all statements in a doc, along with the related metadata including request/response/status\n * @param doc - The document / graph\n */\n removeDocument(doc: Quad_Graph): IndexedFormula {\n this.removeMetadata(doc)\n // remove document\n var sts: Quad[] = this.statementsMatching(undefined, undefined, undefined, doc).slice() // Take a copy as this is the actual index\n for (var i = 0; i < sts.length; i++) {\n this.removeStatement(sts[i])\n }\n this.removeMatches(doc as Quad_Subject, null, null)\n return this\n }\n\n removeMetadata(doc: Quad_Graph): IndexedFormula {\n const meta = this.sym('chrome://TheCurrentSession') // or this.rdfFactory.namedNode('chrome://TheCurrentSession')\n const linkNamespaceURI = 'http://www.w3.org/2007/ont/link#'\n // remove status/response/request metadata\n const requests = this.statementsMatching(undefined, this.sym(`${linkNamespaceURI}requestedURI`), this.rdfFactory.literal(doc.value), meta).map(st => st.subject)\n for (var r = 0; r < requests.length; r++) {\n const request = requests[r]\n if (request != undefined) {\n // removeMatches unresolved issue with collection https://github.com/linkeddata/rdflib.js/issues/631\n let sts: Quad[]\n // status collection\n const status = this.any(request, this.sym(`${linkNamespaceURI}status`), null, meta) as Quad_Subject\n if (status != undefined) {\n sts = this.statementsMatching(status, this.sym(`${linkNamespaceURI}status`), null, meta).slice()\n for (var i = 0; i < sts.length; i++) {\n this.removeStatement(sts[i])\n }\n }\n // response items list\n const response = this.any(request, this.sym(`${linkNamespaceURI}response`), null, meta) as Quad_Subject\n if (response != undefined) {\n sts = this.statementsMatching(response, null, null, meta).slice()\n for (var i = 0; i < sts.length; i++) {\n this.removeStatement(sts[i])\n }\n }\n // request triples\n sts = this.statementsMatching(request, null, null, meta).slice()\n for (var i = 0; i < sts.length; i++) {\n this.removeStatement(sts[i])\n }\n\n }\n }\n this.removeMatches(this.sym(doc.value), null, null, meta) // content-type\n return this\n }\n\n /**\n * Remove all statements matching args (within limit) *\n * @param subj The subject\n * @param pred The predicate\n * @param obj The object\n * @param why The graph that contains the statement\n * @param limit The number of statements to remove\n */\n removeMany(\n subj?: Quad_Subject | null,\n pred?: Quad_Predicate | null,\n obj?: Quad_Object | null,\n why?: Quad_Graph | null,\n limit?: number\n ): void {\n // log.debug(\"entering removeMany w/ subj,pred,obj,why,limit = \" + subj +\", \"+ pred+\", \" + obj+\", \" + why+\", \" + limit)\n var sts = this.statementsMatching(subj, pred, obj, why, false)\n // This is a subtle bug that occurred in updateCenter.js too.\n // The fact is, this.statementsMatching returns this.whyIndex instead of a copy of it\n // but for perfromance consideration, it's better to just do that\n // so make a copy here.\n var statements: Quad[] = []\n for (var i = 0; i < sts.length; i++) statements.push(sts[i])\n if (limit) statements = statements.slice(0, limit)\n for (i = 0; i < statements.length; i++) this.remove(statements[i])\n }\n\n /**\n * Remove all matching statements\n * @param subject The subject\n * @param predicate The predicate\n * @param object The object\n * @param graph The graph that contains the statement\n */\n removeMatches(\n subject?: Quad_Subject | null,\n predicate?: Quad_Predicate | null,\n object?: Quad_Object | null,\n graph?: Quad_Graph | null\n ): IndexedFormula {\n this.removeMany(subject, predicate, object, graph)\n return this\n }\n\n /**\n * Remove a particular statement object from the store\n *\n * @param st - a statement which is already in the store and indexed.\n * Make sure you only use this for these.\n * Otherwise, you should use remove() above.\n */\n removeStatement(st: Quad): IndexedFormula {\n // log.debug(\"entering remove w/ st=\" + st)\n var term = [ st.subject, st.predicate, st.object, st.graph ]\n for (var p = 0; p < 4; p++) {\n var c = this.canon(term[p])\n var h = this.id(c)\n if (!this.index[p][h]) {\n // log.warn (\"Statement removal: no index '+p+': \"+st)\n } else {\n this.rdfArrayRemove(this.index[p][h], st)\n }\n }\n this.rdfArrayRemove(this.statements, st)\n return this\n }\n\n /**\n * Removes statements\n * @param sts The statements to remove\n */\n removeStatements(sts: ReadonlyArray): IndexedFormula {\n for (var i = 0; i < sts.length; i++) {\n this.remove(sts[i])\n }\n return this\n }\n\n /**\n * Replace big with small, obsoleted with obsoleting.\n */\n replaceWith (big: Quad_Subject, small: Quad_Subject): boolean {\n // log.debug(\"Replacing \"+big+\" with \"+small) // this.id(@@\n var oldhash = this.id(big)\n var newhash = this.id(small)\n var moveIndex = function (ix) {\n var oldlist = ix[oldhash]\n if (!oldlist) {\n return // none to move\n }\n var newlist = ix[newhash]\n if (!newlist) {\n ix[newhash] = oldlist\n } else {\n ix[newhash] = oldlist.concat(newlist)\n }\n delete ix[oldhash]\n }\n // the canonical one carries all the indexes\n for (var i = 0; i < 4; i++) {\n moveIndex(this.index[i])\n }\n this.redirections[oldhash] = small\n if (big.value) {\n // @@JAMBO: must update redirections,aliases from sub-items, too.\n if (!this.aliases[newhash]) {\n this.aliases[newhash] = []\n }\n this.aliases[newhash].push(big) // Back link\n if (this.aliases[oldhash]) {\n for (i = 0; i < this.aliases[oldhash].length; i++) {\n this.redirections[this.id(this.aliases[oldhash][i])] = small\n this.aliases[newhash].push(this.aliases[oldhash][i])\n }\n }\n this.add(small, this.sym('http://www.w3.org/2007/ont/link#uri'), big)\n // If two things are equal, and one is requested, we should request the other.\n if (this.fetcher) {\n this.fetcher.nowKnownAs(big, small)\n }\n }\n moveIndex(this.classActions)\n moveIndex(this.propertyActions)\n // log.debug(\"Equate done. \"+big+\" to be known as \"+small)\n return true // true means the statement does not need to be put in\n }\n\n /**\n * Return all equivalent URIs by which this is known\n * @param x A named node\n */\n allAliases(x: NamedNode): NamedNode[] {\n var a = this.aliases[this.id(this.canon(x))] || []\n a.push(this.canon(x))\n return a\n }\n\n /**\n * Compare by canonical URI as smushed\n * @param x A named node\n * @param y Another named node\n */\n sameThings(x: NamedNode, y: NamedNode): boolean {\n if (x.equals(y)) {\n return true\n }\n var x1 = this.canon(x)\n // alert('x1='+x1)\n if (!x1) return false\n var y1 = this.canon(y)\n // alert('y1='+y1); //@@\n if (!y1) return false\n return (x1.value === y1.value)\n }\n\n setPrefixForURI (prefix: string, nsuri: string): void {\n // TODO: This is a hack for our own issues, which ought to be fixed\n // post-release\n // See http://dig.csail.mit.edu/cgi-bin/roundup.cgi/$rdf/issue227\n if (prefix === 'tab' && this.namespaces['tab']) {\n return\n } // There are files around with long badly generated prefixes like this\n if (prefix.slice(0, 2) === 'ns' || prefix.slice(0, 7) === 'default') {\n return\n }\n\n // remove any prefix that currently targets nsuri\n for (let existingPrefix in this.namespaces) {\n if (this.namespaces[existingPrefix] == nsuri)\n delete this.namespaces[existingPrefix];\n }\n\n this.namespaces[prefix] = nsuri\n }\n\n /** Search the Store\n *\n * ALL CONVENIENCE LOOKUP FUNCTIONS RELY ON THIS!\n * @param subj - A node to search for as subject, or if null, a wildcard\n * @param pred - A node to search for as predicate, or if null, a wildcard\n * @param obj - A node to search for as object, or if null, a wildcard\n * @param why - A node to search for as graph, or if null, a wildcard\n * @param justOne - flag - stop when found one rather than get all of them?\n * @returns An array of nodes which match the wildcard position\n */\n statementsMatching (\n subj?: Quad_Subject | null,\n pred?: Quad_Predicate | null,\n obj?: Quad_Object | null,\n why?: Quad_Graph | null,\n justOne?: boolean\n ): Statement[] {\n // log.debug(\"Matching {\"+subj+\" \"+pred+\" \"+obj+\"}\")\n var pat = [ subj, pred, obj, why ]\n var pattern: Term[] = []\n var hash: Indexable[] = []\n var wild: number[] = [] // wildcards\n var given: number[] = [] // Not wild\n var p: number\n var list\n for (p = 0; p < 4; p++) {\n pattern[p] = this.canon(Node.fromValue(pat[p]))\n if (!pattern[p]) {\n wild.push(p)\n } else {\n given.push(p)\n hash[p] = this.id(pattern[p])\n }\n }\n if (given.length === 0) {\n return this.statements\n }\n if (given.length === 1) { // Easy too, we have an index for that\n p = given[0]\n list = this.index[p][hash[p]]\n if (list && justOne) {\n if (list.length > 1) {\n list = list.slice(0, 1)\n }\n }\n list = list || []\n return list\n }\n // Now given.length is 2, 3 or 4.\n // We hope that the scale-free nature of the data will mean we tend to get\n // a short index in there somewhere!\n var best = 1e10 // really bad\n var iBest\n var i\n for (i = 0; i < given.length; i++) {\n p = given[i] // Which part we are dealing with\n list = this.index[p][hash[p]]\n if (!list) {\n return [] // No occurrences\n }\n if (list.length < best) {\n best = list.length\n iBest = i // (not p!)\n }\n }\n // Ok, we have picked the shortest index but now we have to filter it\n var pBest = given[iBest]\n var possibles: Statement[] = this.index[pBest][hash[pBest]]\n var check = given.slice(0, iBest).concat(given.slice(iBest + 1)) // remove iBest\n var results: Statement[] = []\n var parts = [ 'subject', 'predicate', 'object', 'why' ]\n for (var j = 0; j < possibles.length; j++) {\n var st: Statement | null = possibles[j]\n\n for (i = 0; i < check.length; i++) { // for each position to be checked\n p = check[i]\n if (!this.canon(st[parts[p]]).equals(pattern[p])) {\n st = null\n break\n }\n }\n if (st != null) {\n results.push(st)\n if (justOne) break\n }\n }\n return results\n }\n\n /**\n * A list of all the URIs by which this thing is known\n * @param term\n */\n uris(term: Quad_Subject): string[] {\n var cterm = this.canon(term)\n var terms = this.aliases[this.id(cterm)]\n if (!cterm.value) return []\n var res = [ cterm.value ]\n if (terms) {\n for (var i = 0; i < terms.length; i++) {\n res.push(terms[i].uri)\n }\n }\n return res\n }\n\n serialize (base, contentType, provenance, options?) {\n\n // override Formula.serialize to force the serializer namespace prefixes\n // to those of this IndexedFormula\n\n // if namespaces are explicitly passed in options, let them override the existing namespaces in this formula\n const namespaces = options?.namespaces ? {...this.namespaces, ...options.namespaces} : {...this.namespaces};\n\n options = {\n ...(options || {}),\n namespaces\n }\n return serialize(provenance, this, base, contentType, undefined, options);\n }\n}\nIndexedFormula.handleRDFType = handleRDFType\n","/* Lists form conversion\n*/\n\n\n// import DataFactory from './factories/extended-term-factory'\n// import jsonldParser from './jsonldparser'\n// @ts-ignore is this injected?\nimport { Parser as N3jsParser } from 'n3' // @@ Goal: remove this dependency\n// import N3Parser from './n3parser'\n// import { parseRDFaDOM } from './rdfaparser'\n// import RDFParser from './rdfxmlparser'\n// import sparqlUpdateParser from './patch-parser'\n// import * as Util from './utils-js'\nimport Node from './node-internal'\n// import BlankNode from './blank-node'\n// import NamedNode from './named-node'\nimport Collection from './collection'\nimport Statement from './statement'\n// import Formula from './formula'\nimport Store from './store'\n// import { ContentType, TurtleContentType, N3ContentType, RDFXMLContentType, XHTMLContentType, HTMLContentType, SPARQLUpdateContentType, SPARQLUpdateSingleMatchContentType, JSONLDContentType, NQuadsContentType, NQuadsAltContentType } from './types'\n\n// import { Quad } from './tf-types'\n\nimport {BlankNode, NamedNode, Quad, Term,} from './tf-types'\nimport Namespace from './namespace'\n\nconst RDF = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')\n\n/* Replace a given node with another node throughout a given document\n*\n* we do the predicate as well for complenesss though we don't expect Collections to use it\n*/\nexport function substituteInDoc (store:Store, x:Term, y:Term, doc?: NamedNode ) {\n // console.log(`substituteInDoc put ${x} for ${y} in ${doc}}`)\n for (const quad of store.statementsMatching(y as any, null, null, doc as any)) {\n const newStatement = new Statement(x as any, quad.predicate, quad.object, doc as any)\n store.remove(quad)\n store.add(newStatement)\n }\n for (const quad of store.statementsMatching(null, y as any, null, doc) as any) {\n store.remove(quad)\n // console.log(` substituteInDoc predicate ${x} in ${quad}}`)\n store.add(new Statement(quad.subject, x as any, quad.object, doc as any))\n }\n for (const quad of store.statementsMatching(null, null, y as any, doc) as any) {\n store.remove(quad)\n store.add(new Statement(quad.subject, quad.predicate, x as any, doc as any))\n }\n}\n\n/* Change all lone rdf:nil nodes into empty Collections\n*/\nexport function substituteNillsInDoc (store:Store, doc?: NamedNode) {\n const x = RDF('nil')\n for (const quad of store.statementsMatching(x as any, null, null, doc as any)) {\n store.remove(quad)\n const y = new Collection()\n store.add(new Statement(y as any, quad.predicate, quad.object, doc as any))\n }\n for (const quad of store.statementsMatching(null, null, x as any, doc) as any) {\n if (!quad.predicate.sameTerm(RDF('rest'))) { // If not a tail\n store.remove(quad)\n const y = new Collection()\n store.add(new Statement(quad.subject, quad.predicate, y as any, doc as any))\n }\n }\n}\n/**\n * Convert lists reified as rdf:first, rest\n * Normal method is sync.\n * Unfortunately jsdonld is currently written to need to be called async.\n * Hence the mess below with executeCallback.\n * @param store - The quadstore\n * @param doc - The document in which the conversion is done\n */\n\n\nexport function convertFirstRestNil (\n store: Store,\n doc: NamedNode | undefined, // Do whole store?\n) {\n\n function preceding (ele:BlankNode, listSoFar: Node[], trash: Quad[]): undefined {\n\n const rests = store.statementsMatching(ele, RDF('rest'), null, doc)\n if (rests.length !== 1) throw new Error(`Bad list structure: no rest at ${ele}`)\n\n const firsts = store.statementsMatching(ele, RDF('first'), null, doc)\n if (firsts.length !== 1) throw new Error(`Bad list structure: rest but ${firsts.length} firsts at ${ele}`)\n const value = firsts[0].object\n const total = [value].concat(listSoFar as any)\n // console.log(' List now is: ', total)\n const totalTrash = trash.concat(rests).concat(firsts)\n\n const pres = store.statementsMatching(null, RDF('rest'), ele, doc)\n if (pres.length === 0) { // Head of the list\n const newList = new Collection(total)\n store.remove(totalTrash)\n // Replace old list with new list:\n substituteInDoc(store, newList, ele, doc)\n return\n }\n if (pres.length !== 1) throw new Error(`Bad list structure: ${pres.length} pres at ${ele}`)\n const pre = pres[0].subject\n if (pre.termType !== 'BlankNode') throw new Error(`Bad list element node ${pre} type: ${pre.termType} `)\n\n preceding(pre, total, totalTrash)\n return\n }\n\n substituteNillsInDoc(store, doc) // lone ones only\n\n const tails = store.statementsMatching(null, RDF('rest'), RDF('nil'), doc)\n tails.forEach(tail => {\n if (tail.subject.termType !== 'BlankNode')\n throw new Error(`Bad list element node ${tail.subject} type: ${tail.subject.termType} `)\n preceding(tail.subject, [], [])\n })\n\n}\n","/**\n*\n* UTF-8 data encode / decode\n* http://www.webtoolkit.info/\n*\n**/\nimport * as Uri from './uri'\nimport { ArrayIndexOf } from './utils'\nimport { convertFirstRestNil } from './lists'\n\nfunction hexify (str) { // also used in parser\n return encodeURI(str);\n}\n\nvar Utf8 = {\n // public method for url encoding\n encode : function (string) {\n string = string.replace(/\\r\\n/g,\"\\n\");\n var utftext = \"\";\n\n for (var n = 0; n < string.length; n++) {\n\n var c = string.charCodeAt(n);\n\n if (c < 128) {\n utftext += String.fromCharCode(c);\n }\n else if((c > 127) && (c < 2048)) {\n utftext += String.fromCharCode((c >> 6) | 192);\n utftext += String.fromCharCode((c & 63) | 128);\n }\n else {\n utftext += String.fromCharCode((c >> 12) | 224);\n utftext += String.fromCharCode(((c >> 6) & 63) | 128);\n utftext += String.fromCharCode((c & 63) | 128);\n }\n\n }\n\n return utftext;\n },\n // public method for url decoding\n decode : function (utftext) {\n var string = \"\";\n var i = 0;\n\n while ( i < utftext.length ) {\n\n var c = utftext.charCodeAt(i);\n if (c < 128) {\n string += String.fromCharCode(c);\n i++;\n }\n else if((c > 191) && (c < 224)) {\n string += String.fromCharCode(((c & 31) << 6)\n | (utftext.charCodeAt(i+1) & 63));\n i += 2;\n }\n else {\n string += String.fromCharCode(((c & 15) << 12)\n | ((utftext.charCodeAt(i+1) & 63) << 6)\n | (utftext.charCodeAt(i+2) & 63));\n i += 3;\n }\n }\n return string;\n }\n}// Things we need to define to make converted pythn code work in js\n// environment of $rdf\n\nvar RDFSink_forSomeSym = \"http://www.w3.org/2000/10/swap/log#forSome\";\nvar RDFSink_forAllSym = \"http://www.w3.org/2000/10/swap/log#forAll\";\nvar Logic_NS = \"http://www.w3.org/2000/10/swap/log#\";\n\n// pyjs seems to reference runtime library which I didn't find\n\nvar pyjslib_Tuple = function(theList) { return theList };\n\nvar pyjslib_List = function(theList) { return theList };\n\nvar pyjslib_Dict = function(listOfPairs) {\n if (listOfPairs.length > 0)\n\tthrow \"missing.js: oops nnonempty dict not imp\";\n return [];\n}\n\nvar pyjslib_len = function(s) { return s.length }\n\nvar pyjslib_slice = function(str, i, j) {\n if (typeof str.slice == 'undefined')\n throw '@@ mising.js: No .slice function for '+str+' of type '+(typeof str)\n if ((typeof j == 'undefined') || (j ==null)) return str.slice(i);\n return str.slice(i, j) // @ exactly the same spec?\n}\nvar StopIteration = Error('dummy error stop iteration');\n\nvar pyjslib_Iterator = function(theList) {\n this.last = 0;\n this.li = theList;\n this.next = function() {\n\tif (this.last == this.li.length) throw StopIteration;\n\treturn this.li[this.last++];\n }\n return this;\n};\n\nvar ord = function(str) {\n return str.charCodeAt(0)\n}\n\nvar string_find = function(str, s) {\n return str.indexOf(s)\n}\n\nvar assertFudge = function(condition, desc) {\n if (condition) return;\n if (desc) throw \"python Assertion failed: \"+desc;\n throw \"(python) Assertion failed.\";\n}\n\n\nvar stringFromCharCode = function(uesc) {\n return String.fromCharCode(uesc);\n}\n\n\nString.prototype.encode = function(encoding) {\n if (encoding != 'utf-8') throw \"UTF8_converter: can only do utf-8\"\n return Utf8.encode(this);\n}\nString.prototype.decode = function(encoding) {\n if (encoding != 'utf-8') throw \"UTF8_converter: can only do utf-8\"\n //return Utf8.decode(this);\n return this;\n}\n\n\n\nvar uripath_join = function(base, given) {\n return Uri.join(given, base) // sad but true\n}\n\nvar becauseSubexpression = null; // No reason needed\nvar diag_tracking = 0;\nvar diag_chatty_flag = 0;\nvar diag_progress = function(str) { /*$rdf.log.debug(str);*/ }\n\n// why_BecauseOfData = function(doc, reason) { return doc };\n\n\nvar RDF_type_URI = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\";\nvar RDF_nil_URI = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil\";\nvar DAML_sameAs_URI = \"http://www.w3.org/2002/07/owl#sameAs\";\n\n/*\nfunction SyntaxError(details) {\n return new __SyntaxError(details);\n}\n*/\n\nfunction __SyntaxError(details) {\n this.details = details\n}\n\n/*\n\n$Id: n3parser.js 14561 2008-02-23 06:37:26Z kennyluck $\n\nHAND EDITED FOR CONVERSION TO JAVASCRIPT\n\nThis module implements a Nptation3 parser, and the final\npart of a notation3 serializer.\n\nSee also:\n\nNotation 3\nhttp://www.w3.org/DesignIssues/Notation3\n\nClosed World Machine - and RDF Processor\nhttp://www.w3.org/2000/10/swap/cwm\n\nTo DO: See also \"@@\" in comments\n\n- Clean up interfaces\n______________________________________________\n\nModule originally by Dan Connolly, includeing notation3\nparser and RDF generator. TimBL added RDF stream model\nand N3 generation, replaced stream model with use\nof common store/formula API. Yosi Scharf developped\nthe module, including tests and test harness.\n\n*/\n\nvar ADDED_HASH = \"#\";\nvar LOG_implies_URI = \"http://www.w3.org/2000/10/swap/log#implies\";\nvar INTEGER_DATATYPE = \"http://www.w3.org/2001/XMLSchema#integer\";\nvar FLOAT_DATATYPE = \"http://www.w3.org/2001/XMLSchema#double\";\nvar DECIMAL_DATATYPE = \"http://www.w3.org/2001/XMLSchema#decimal\";\nvar DATE_DATATYPE = \"http://www.w3.org/2001/XMLSchema#date\";\nvar DATETIME_DATATYPE = \"http://www.w3.org/2001/XMLSchema#dateTime\";\nvar BOOLEAN_DATATYPE = \"http://www.w3.org/2001/XMLSchema#boolean\";\nvar option_noregen = 0;\nvar _notQNameChars = \"\\t\\r\\n !\\\"#$%&'()*.,+/;<=>?@[\\\\]^`{|}~\";\nvar _notNameChars = ( _notQNameChars + \":\" ) ;\nvar _rdfns = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\";\nvar N3CommentCharacter = \"#\";\nvar eol = new RegExp(\"^[ \\\\t]*(#[^\\\\n]*)?\\\\r?\\\\n\", 'g');\nvar eof = new RegExp(\"^[ \\\\t]*(#[^\\\\n]*)?$\", 'g');\nvar ws = new RegExp(\"^[ \\\\t]*\", 'g');\nvar signed_integer = new RegExp(\"^[-+]?[0-9]+\", 'g');\nvar number_syntax = new RegExp(\"^([-+]?[0-9]+)(\\\\.[0-9]+)?(e[-+]?[0-9]+)?\", 'g');\nvar datetime_syntax = new RegExp('^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9](T[0-9][0-9]:[0-9][0-9](:[0-9][0-9](\\\\.[0-9]*)?)?)?Z?');\n\nvar digitstring = new RegExp(\"^[0-9]+\", 'g');\nvar interesting = new RegExp(\"[\\\\\\\\\\\\r\\\\n\\\\\\\"]\", 'g');\nvar langcode = new RegExp(\"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*\", 'g');\n\nfunction createSinkParser(store, openFormula, thisDoc, baseURI, genPrefix, metaURI, flags, why) {\n return new SinkParser(store, openFormula, thisDoc, baseURI, genPrefix, metaURI, flags, why);\n}\n\nexport default createSinkParser;\n\nexport class SinkParser {\n constructor(store, openFormula, thisDoc, baseURI, genPrefix, metaURI, flags, why) {\n if (typeof openFormula == 'undefined') openFormula=null;\n if (typeof thisDoc == 'undefined') thisDoc=\"\";\n if (typeof baseURI == 'undefined') baseURI=null;\n if (typeof genPrefix == 'undefined') genPrefix=\"\";\n if (typeof metaURI == 'undefined') metaURI=null;\n if (typeof flags == 'undefined') flags=\"\";\n if (typeof why == 'undefined') why=null;\n /*\n note: namespace names should *not* end in #;\n the # will get added during qname processing */\n\n this._bindings = new pyjslib_Dict([]);\n this._flags = flags;\n if ((thisDoc != \"\")) {\n assertFudge((thisDoc.indexOf(\":\") >= 0), ( \"Document URI not absolute: \" + thisDoc ) );\n this._bindings[\"\"] = ( ( thisDoc + \"#\" ) );\n }\n this._store = store;\n if (genPrefix) {\n store.setGenPrefix(genPrefix);\n }\n this._thisDoc = thisDoc;\n this.source = store.sym(thisDoc);\n this.lines = 0;\n this.statementCount = 0;\n this.hasNil = false;\n this.startOfLine = 0;\n this.previousLine = 0;\n this._genPrefix = genPrefix;\n this.keywords = new pyjslib_List([\"a\", \"this\", \"bind\", \"has\", \"is\", \"of\", \"true\", \"false\"]);\n this.keywordsSet = 0;\n this._anonymousNodes = new pyjslib_Dict([]);\n this._variables = new pyjslib_Dict([]);\n this._parentVariables = new pyjslib_Dict([]);\n this._reason = why;\n this._reason2 = null;\n if (diag_tracking) {\n this._reason2 = why_BecauseOfData(store.sym(thisDoc), this._reason);\n }\n if (baseURI) {\n this._baseURI = baseURI;\n }\n else {\n if (thisDoc) {\n this._baseURI = thisDoc;\n }\n else {\n this._baseURI = null;\n }\n }\n assertFudge(!(this._baseURI) || (this._baseURI.indexOf(\":\") >= 0));\n if (!(this._genPrefix)) {\n if (this._thisDoc) {\n this._genPrefix = ( this._thisDoc + \"#_g\" ) ;\n }\n else {\n this._genPrefix = RDFSink_uniqueURI();\n }\n }\n if ((openFormula == null)) {\n if (this._thisDoc) {\n this._formula = store.formula( ( thisDoc + \"#_formula\" ) );\n }\n else {\n this._formula = store.formula();\n }\n }\n else {\n this._formula = openFormula;\n }\n this._context = this._formula;\n this._parentContext = null;\n }\n\n\n here(i) {\n return ( ( ( ( this._genPrefix + \"_L\" ) + this.lines ) + \"C\" ) + ( ( i - this.startOfLine ) + 1 ) ) ;\n };\n formula() {\n return this._formula;\n };\n loadStream(stream) {\n return this.loadBuf(stream.read());\n };\n loadBuf(buf) {\n /*\n Parses a buffer and returns its top level formula*/\n\n this.startDoc();\n this.feed(buf);\n return this.endDoc();\n };\n feed(octets) {\n /*\n Feed an octet stream tothe parser\n\n if BadSyntax is raised, the string\n passed in the exception object is the\n remainder after any statements have been parsed.\n So if there is more data to feed to the\n parser, it should be straightforward to recover.*/\n\n var str = octets.decode(\"utf-8\");\n var i = 0;\n while ((i >= 0)) {\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return;\n }\n var i = this.directiveOrStatement(str, j);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected directive or statement\");\n }\n }\n };\n directiveOrStatement(str, h) {\n var i = this.skipSpace(str, h);\n if ((i < 0)) {\n return i;\n }\n var j = this.directive(str, i);\n if ((j >= 0)) {\n return this.checkDot(str, j);\n }\n var j = this.statement(str, i);\n if ((j >= 0)) {\n return this.checkDot(str, j);\n }\n return j;\n };\n tok(tok, str, i) {\n /*\n Check for keyword. Space must have been stripped on entry and\n we must not be at end of file.*/\n var whitespace = \"\\t\\n\\v\\f\\r \";\n if ((str.slice( i, ( i + 1 ) ) == \"@\")) {\n var i = ( i + 1 ) ;\n }\n else {\n if ((ArrayIndexOf(this.keywords,tok) < 0)) {\n return -1;\n }\n }\n var k = ( i + pyjslib_len(tok) ) ;\n if ((str.slice( i, k) == tok) && (_notQNameChars.indexOf(str.charAt(k)) >= 0)) {\n return k;\n }\n else {\n return -1;\n }\n };\n directive(str, i) {\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return j;\n }\n var res = new pyjslib_List([]);\n var j = this.tok(\"bind\", str, i);\n if ((j > 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"keyword bind is obsolete: use @prefix\");\n }\n var j = this.tok(\"keywords\", str, i);\n if ((j > 0)) {\n var i = this.commaSeparatedList(str, j, res, false);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"'@keywords' needs comma separated list of words\");\n }\n this.setKeywords(pyjslib_slice(res, null, null));\n if ((diag_chatty_flag > 80)) {\n diag_progress(\"Keywords \", this.keywords);\n }\n return i;\n }\n var j = this.tok(\"forAll\", str, i);\n if ((j > 0)) {\n var i = this.commaSeparatedList(str, j, res, true);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"Bad variable list after @forAll\");\n }\n\n var __x = new pyjslib_Iterator(res);\n try {\n while (true) {\n var x = __x.next();\n\n\n if (ArrayIndexOf(this._variables,x) < 0 || (ArrayIndexOf(this._parentVariables,x) >= 0)) {\n this._variables[x] = ( this._context.newUniversal(x));\n }\n\n }\n } catch (e) {\n if (e != StopIteration) {\n throw e;\n }\n }\n\n return i;\n }\n var j = this.tok(\"forSome\", str, i);\n if ((j > 0)) {\n var i = this.commaSeparatedList(str, j, res, this.uri_ref2);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"Bad variable list after @forSome\");\n }\n\n var __x = new pyjslib_Iterator(res);\n try {\n while (true) {\n var x = __x.next();\n\n\n this._context.declareExistential(x);\n\n }\n } catch (e) {\n if (e != StopIteration) {\n throw e;\n }\n }\n\n return i;\n }\n var j = this.tok(\"prefix\", str, i);\n if ((j >= 0)) {\n var t = new pyjslib_List([]);\n var i = this.qname(str, j, t);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected qname after @prefix\");\n }\n var j = this.uri_ref2(str, i, t);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected after @prefix _qname_\");\n }\n var ns = t[1].uri;\n if (this._baseURI) {\n var ns = uripath_join(this._baseURI, ns);\n }\n else {\n assertFudge((ns.indexOf(\":\") >= 0), \"With no base URI, cannot handle relative URI for NS\");\n }\n assertFudge((ns.indexOf(\":\") >= 0));\n this._bindings[t[0][0]] = ( ns);\n\n this.bind(t[0][0], hexify(ns));\n return j;\n }\n var j = this.tok(\"base\", str, i);\n if ((j >= 0)) {\n var t = new pyjslib_List([]);\n var i = this.uri_ref2(str, j, t);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected after @base \");\n }\n var ns = t[0].uri;\n if (this._baseURI) {\n var ns = uripath_join(this._baseURI, ns);\n }\n else {\n throw BadSyntax(this._thisDoc, this.lines, str, j, ( ( \"With no previous base URI, cannot use relative URI in @base <\" + ns ) + \">\" ) );\n }\n assertFudge((ns.indexOf(\":\") >= 0));\n this._baseURI = ns;\n return i;\n }\n return -1;\n };\n bind(qn, uri) {\n if ((qn == \"\")) {\n }\n else {\n this._store.setPrefixForURI(qn, uri);\n }\n };\n setKeywords(k) {\n /*\n Takes a list of strings*/\n\n if ((k == null)) {\n this.keywordsSet = 0;\n }\n else {\n this.keywords = k;\n this.keywordsSet = 1;\n }\n };\n startDoc() {\n };\n\n /* Signal end of document and stop parsing. returns formula */\n endDoc() {\n if (this.hasNil && this._store.rdfFactory.supports[\"COLLECTIONS\"]) {\n convertFirstRestNil(this._store, this.source)\n }\n return this._formula;\n };\n makeStatement(quad) {\n quad[0].add(quad[2], quad[1], quad[3], this.source);\n if ((quad[2].uri && quad[2].uri === RDF_nil_URI)\n || (quad[3].uri && quad[3].uri === RDF_nil_URI)) {\n this.hasNil = true\n }\n this.statementCount += 1;\n };\n statement(str, i) {\n var r = new pyjslib_List([]);\n var i = this.object(str, i, r);\n if ((i < 0)) {\n return i;\n }\n var j = this.property_list(str, i, r[0]);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected propertylist\");\n }\n return j;\n };\n subject(str, i, res) {\n return this.item(str, i, res);\n };\n verb(str, i, res) {\n /*\n has _prop_\n is _prop_ of\n a\n =\n _prop_\n >- prop ->\n <- prop -<\n _operator_*/\n\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return j;\n }\n var r = new pyjslib_List([]);\n var j = this.tok(\"has\", str, i);\n if ((j >= 0)) {\n var i = this.prop(str, j, r);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected property after 'has'\");\n }\n res.push(new pyjslib_Tuple([\"->\", r[0]]));\n return i;\n }\n var j = this.tok(\"is\", str, i);\n if ((j >= 0)) {\n var i = this.prop(str, j, r);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected after 'is'\");\n }\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"End of file found, expected property after 'is'\");\n return j;\n }\n var i = j;\n var j = this.tok(\"of\", str, i);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected 'of' after 'is' \");\n }\n res.push(new pyjslib_Tuple([\"<-\", r[0]]));\n return j;\n }\n var j = this.tok(\"a\", str, i);\n if ((j >= 0)) {\n res.push(new pyjslib_Tuple([\"->\", this._store.sym(RDF_type_URI)]));\n return j;\n }\n if ((str.slice( i, ( i + 2 ) ) == \"<=\")) {\n res.push(new pyjslib_Tuple([\"<-\", this._store.sym( ( Logic_NS + \"implies\" ) )]));\n return ( i + 2 ) ;\n }\n if ((str.slice( i, ( i + 1 ) ) == \"=\")) {\n if ((str.slice( ( i + 1 ) , ( i + 2 ) ) == \">\")) {\n res.push(new pyjslib_Tuple([\"->\", this._store.sym( ( Logic_NS + \"implies\" ) )]));\n return ( i + 2 ) ;\n }\n res.push(new pyjslib_Tuple([\"->\", this._store.sym(DAML_sameAs_URI)]));\n return ( i + 1 ) ;\n }\n if ((str.slice( i, ( i + 2 ) ) == \":=\")) {\n res.push(new pyjslib_Tuple([\"->\", ( Logic_NS + \"becomes\" ) ]));\n return ( i + 2 ) ;\n }\n var j = this.prop(str, i, r);\n if ((j >= 0)) {\n res.push(new pyjslib_Tuple([\"->\", r[0]]));\n return j;\n }\n if ((str.slice( i, ( i + 2 ) ) == \">-\") || (str.slice( i, ( i + 2 ) ) == \"<-\")) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \">- ... -> syntax is obsolete.\");\n }\n return -1;\n };\n prop(str, i, res) {\n return this.item(str, i, res);\n };\n item(str, i, res) {\n return this.path(str, i, res);\n };\n blankNode(uri) {\n return this._context.bnode(uri, this._reason2);\n };\n path(str, i, res) {\n /*\n Parse the path production.\n */\n\n var j = this.nodeOrLiteral(str, i, res);\n if ((j < 0)) {\n return j;\n }\n while ((\"!^.\".indexOf(str.slice( j, ( j + 1 ) )) >= 0)) {\n var ch = str.slice( j, ( j + 1 ) );\n if ((ch == \".\")) {\n var ahead = str.slice( ( j + 1 ) , ( j + 2 ) );\n if (!(ahead) || (_notNameChars.indexOf(ahead) >= 0) && (\":?<[{(\".indexOf(ahead) < 0)) {\n break;\n }\n }\n var subj = res.pop();\n var obj = this.blankNode(this.here(j));\n var j = this.node(str, ( j + 1 ) , res);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"EOF found in middle of path syntax\");\n }\n var pred = res.pop();\n if ((ch == \"^\")) {\n this.makeStatement(new pyjslib_Tuple([this._context, pred, obj, subj]));\n }\n else {\n this.makeStatement(new pyjslib_Tuple([this._context, pred, subj, obj]));\n }\n res.push(obj);\n }\n return j;\n };\n anonymousNode(ln) {\n /*\n Remember or generate a term for one of these _: anonymous nodes*/\n\n var term = this._anonymousNodes[ln];\n if (term) {\n return term;\n }\n var term = this._store.bnode(ln);\n // var term = this._store.bnode(this._context, this._reason2); eh?\n this._anonymousNodes[ln] = ( term);\n return term;\n };\n node(str, i, res, subjectAlready) {\n if (typeof subjectAlready == 'undefined') subjectAlready=null;\n /*\n Parse the production.\n Space is now skipped once at the beginning\n instead of in multipe calls to self.skipSpace().\n */\n\n var subj = subjectAlready;\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return j;\n }\n var i = j;\n var ch = str.slice( i, ( i + 1 ) );\n if ((ch == \"[\")) {\n var bnodeID = this.here(i);\n var j = this.skipSpace(str, ( i + 1 ) );\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"EOF after '['\");\n }\n if ((str.slice( j, ( j + 1 ) ) == \"=\")) {\n var i = ( j + 1 ) ;\n var objs = new pyjslib_List([]);\n var j = this.objectList(str, i, objs);\n\n if ((j >= 0)) {\n var subj = objs[0];\n if ((pyjslib_len(objs) > 1)) {\n\n var __obj = new pyjslib_Iterator(objs);\n try {\n while (true) {\n var obj = __obj.next();\n\n\n this.makeStatement(new pyjslib_Tuple([this._context, this._store.sym(DAML_sameAs_URI), subj, obj]));\n\n }\n } catch (e) {\n if (e != StopIteration) {\n throw e;\n }\n }\n\n }\n var j = this.skipSpace(str, j);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"EOF when objectList expected after [ = \");\n }\n if ((str.slice( j, ( j + 1 ) ) == \";\")) {\n var j = ( j + 1 ) ;\n }\n }\n else {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"objectList expected after [= \");\n }\n }\n if ((subj == null)) {\n var subj = this.blankNode(bnodeID);\n }\n var i = this.property_list(str, j, subj);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"property_list expected\");\n }\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"EOF when ']' expected after [ \");\n }\n if ((str.slice( j, ( j + 1 ) ) != \"]\")) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"']' expected\");\n }\n res.push(subj);\n return ( j + 1 ) ;\n }\n if ((ch == \"{\")) {\n var ch2 = str.slice( ( i + 1 ) , ( i + 2 ) );\n if ((ch2 == \"$\")) {\n i += 1;\n var j = ( i + 1 ) ;\n var mylist = new pyjslib_List([]);\n var first_run = true;\n while (1) {\n var i = this.skipSpace(str, j);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"needed '$}', found end.\");\n }\n if ((str.slice( i, ( i + 2 ) ) == \"$}\")) {\n var j = ( i + 2 ) ;\n break;\n }\n if (!(first_run)) {\n if ((str.slice( i, ( i + 1 ) ) == \",\")) {\n i += 1;\n }\n else {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected: ','\");\n }\n }\n else {\n var first_run = false;\n }\n var item = new pyjslib_List([]);\n var j = this.item(str, i, item);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected item in set or '$}'\");\n }\n mylist.push(item[0]);\n }\n res.push(this._store.newSet(mylist, this._context));\n return j;\n }\n else {\n var j = ( i + 1 ) ;\n var oldParentContext = this._parentContext;\n this._parentContext = this._context;\n var parentAnonymousNodes = this._anonymousNodes;\n var grandParentVariables = this._parentVariables;\n this._parentVariables = this._variables;\n this._anonymousNodes = new pyjslib_Dict([]);\n this._variables = this._variables.slice();\n var reason2 = this._reason2;\n this._reason2 = becauseSubexpression;\n if ((subj == null)) {\n var subj = this._store.formula();\n }\n this._context = subj;\n while (1) {\n var i = this.skipSpace(str, j);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"needed '}', found end.\");\n }\n if ((str.slice( i, ( i + 1 ) ) == \"}\")) {\n var j = ( i + 1 ) ;\n break;\n }\n var j = this.directiveOrStatement(str, i);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected statement or '}'\");\n }\n }\n this._anonymousNodes = parentAnonymousNodes;\n this._variables = this._parentVariables;\n this._parentVariables = grandParentVariables;\n this._context = this._parentContext;\n this._reason2 = reason2;\n this._parentContext = oldParentContext;\n res.push(subj.close());\n return j;\n }\n }\n if ((ch == \"(\")) {\n var thing_type = this._store.list;\n var ch2 = str.slice( ( i + 1 ) , ( i + 2 ) );\n if ((ch2 == \"$\")) {\n var thing_type = this._store.newSet;\n i += 1;\n }\n var j = ( i + 1 ) ;\n var mylist = new pyjslib_List([]);\n while (1) {\n var i = this.skipSpace(str, j);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"needed ')', found end.\");\n }\n if ((str.slice( i, ( i + 1 ) ) == \")\")) {\n var j = ( i + 1 ) ;\n break;\n }\n var item = new pyjslib_List([]);\n var j = this.item(str, i, item);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected item in list or ')'\");\n }\n mylist.push(item[0]);\n }\n res.push(thing_type(mylist, this._context));\n return j;\n }\n var j = this.tok(\"this\", str, i);\n if ((j >= 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"Keyword 'this' was ancient N3. Now use @forSome and @forAll keywords.\");\n res.push(this._context);\n return j;\n }\n var j = this.tok(\"true\", str, i);\n if ((j >= 0)) {\n res.push(true);\n return j;\n }\n var j = this.tok(\"false\", str, i);\n if ((j >= 0)) {\n res.push(false);\n return j;\n }\n if ((subj == null)) {\n var j = this.uri_ref2(str, i, res);\n if ((j >= 0)) {\n return j;\n }\n }\n return -1;\n };\n property_list(str, i, subj) {\n /*\n Parse property list\n Leaves the terminating punctuation in the buffer\n */\n\n while (1) {\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"EOF found when expected verb in property list\");\n return j;\n }\n if ((str.slice( j, ( j + 2 ) ) == \":-\")) {\n var i = ( j + 2 ) ;\n var res = new pyjslib_List([]);\n var j = this.node(str, i, res, subj);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"bad {} or () or [] node after :- \");\n }\n var i = j;\n continue;\n }\n var i = j;\n var v = new pyjslib_List([]);\n var j = this.verb(str, i, v);\n if ((j <= 0)) {\n return i;\n }\n var objs = new pyjslib_List([]);\n var i = this.objectList(str, j, objs);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"objectList expected\");\n }\n\n var __obj = new pyjslib_Iterator(objs);\n try {\n while (true) {\n var obj = __obj.next();\n\n\n var pairFudge = v[0];\n var dir = pairFudge[0];\n var sym = pairFudge[1];\n if ((dir == \"->\")) {\n this.makeStatement(new pyjslib_Tuple([this._context, sym, subj, obj]));\n }\n else {\n this.makeStatement(new pyjslib_Tuple([this._context, sym, obj, subj]));\n }\n\n }\n } catch (e) {\n if (e != StopIteration) {\n throw e;\n }\n }\n\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"EOF found in list of objects\");\n return j;\n }\n if ((str.slice( i, ( i + 1 ) ) != \";\")) {\n return i;\n }\n var i = ( i + 1 ) ;\n }\n };\n commaSeparatedList(str, j, res, ofUris) {\n /*\n return value: -1 bad syntax; >1 new position in str\n res has things found appended\n\n Used to use a final value of the function to be called, e.g. this.bareWord\n but passing the function didn't work fo js converion pyjs\n */\n\n var i = this.skipSpace(str, j);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"EOF found expecting comma sep list\");\n return i;\n }\n if ((str.charAt(i) == \".\")) {\n return j;\n }\n if (ofUris) {\n var i = this.uri_ref2(str, i, res);\n }\n else {\n var i = this.bareWord(str, i, res);\n }\n if ((i < 0)) {\n return -1;\n }\n while (1) {\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return j;\n }\n var ch = str.slice( j, ( j + 1 ) );\n if ((ch != \",\")) {\n if ((ch != \".\")) {\n return -1;\n }\n return j;\n }\n if (ofUris) {\n var i = this.uri_ref2(str, ( j + 1 ) , res);\n }\n else {\n var i = this.bareWord(str, ( j + 1 ) , res);\n }\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"bad list content\");\n return i;\n }\n }\n };\n objectList(str, i, res) {\n var i = this.object(str, i, res);\n if ((i < 0)) {\n return -1;\n }\n while (1) {\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"EOF found after object\");\n return j;\n }\n if ((str.slice( j, ( j + 1 ) ) != \",\")) {\n return j;\n }\n var i = this.object(str, ( j + 1 ) , res);\n if ((i < 0)) {\n return i;\n }\n }\n };\n checkDot(str, i) {\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return j;\n }\n if ((str.slice( j, ( j + 1 ) ) == \".\")) {\n return ( j + 1 ) ;\n }\n if ((str.slice( j, ( j + 1 ) ) == \"}\")) {\n return j;\n }\n if ((str.slice( j, ( j + 1 ) ) == \"]\")) {\n return j;\n }\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected '.' or '}' or ']' at end of statement\");\n return i;\n };\n uri_ref2(str, i, res) {\n /*\n Generate uri from n3 representation.\n\n Note that the RDF convention of directly concatenating\n NS and local name is now used though I prefer inserting a '#'\n to make the namesapces look more like what XML folks expect.\n */\n\n var qn = new pyjslib_List([]);\n var j = this.qname(str, i, qn);\n if ((j >= 0)) {\n var pairFudge = qn[0];\n var pfx = pairFudge[0];\n var ln = pairFudge[1];\n if ((pfx == null)) {\n assertFudge(0, \"not used?\");\n var ns = ( this._baseURI + ADDED_HASH ) ;\n }\n else {\n var ns = this._bindings[pfx];\n if (!(ns)) {\n if ((pfx == \"_\")) {\n res.push(this.anonymousNode(ln));\n return j;\n }\n throw BadSyntax(this._thisDoc, this.lines, str, i, ( ( \"Prefix \" + pfx ) + \" not bound.\" ) );\n }\n }\n var symb = this._store.sym( ( ns + ln ) );\n if ((ArrayIndexOf(this._variables, symb) >= 0)) {\n res.push(this._variables[symb]);\n }\n else {\n res.push(symb);\n }\n return j;\n }\n var i = this.skipSpace(str, i);\n if ((i < 0)) {\n return -1;\n }\n if ((str.charAt(i) == \"?\")) {\n var v = new pyjslib_List([]);\n var j = this.variable(str, i, v);\n if ((j > 0)) {\n res.push(v[0]);\n return j;\n }\n return -1;\n }\n else if ((str.charAt(i) == \"<\")) {\n var i = ( i + 1 ) ;\n var st = i;\n while ((i < pyjslib_len(str))) {\n if ((str.charAt(i) == \">\")) {\n var uref = str.slice( st, i);\n if (this._baseURI) {\n var uref = uripath_join(this._baseURI, uref);\n }\n else {\n assertFudge((uref.indexOf(\":\") >= 0), \"With no base URI, cannot deal with relative URIs\");\n }\n if ((str.slice( ( i - 1 ) , i) == \"#\") && !((pyjslib_slice(uref, -1, null) == \"#\"))) {\n var uref = ( uref + \"#\" ) ;\n }\n var symb = this._store.sym(uref);\n if ((ArrayIndexOf(this._variables,symb) >= 0)) {\n res.push(this._variables[symb]);\n }\n else {\n res.push(symb);\n }\n return ( i + 1 ) ;\n }\n var i = ( i + 1 ) ;\n }\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"unterminated URI reference\");\n }\n else if (this.keywordsSet) {\n var v = new pyjslib_List([]);\n var j = this.bareWord(str, i, v);\n if ((j < 0)) {\n return -1;\n }\n if ((ArrayIndexOf(this.keywords, v[0]) >= 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, ( ( \"Keyword \\\"\" + v[0] ) + \"\\\" not allowed here.\" ) );\n }\n res.push(this._store.sym( ( this._bindings[\"\"] + v[0] ) ));\n return j;\n }\n else {\n return -1;\n }\n };\n skipSpace(str, i) {\n /*\n Skip white space, newlines and comments.\n return -1 if EOF, else position of first non-ws character*/\n\n var whitespace = ' \\n\\r\\t\\f\\x0b\\xa0\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u200b\\u2028\\u2029\\u3000';\n for (var j = (i ? i : 0); j < str.length; j++) {\n var ch = str.charAt(j);\n // console.log(\" skipspace j= \"+j + \" i= \" + i + \" n= \" + str.length);\n // console.log(\" skipspace ch <\" + ch + \">\");\n if (whitespace.indexOf(ch) < 0 ) { //not ws\n // console.log(\" skipspace 2 ch <\" + ch + \">\");\n if( str.charAt(j)==='#' ) {\n for (;; j++) {\n // console.log(\" skipspace2 j= \"+j + \" i= \" + i + \" n= \" + str.length);\n if (j === str.length) {\n return -1; // EOF\n }\n if (str.charAt(j) === '\\n') {\n this.lines = this.lines + 1;\n break;\n }\n };\n } else { // Not hash - something interesting\n // console.log(\" skipspace 3 ch <\" + ch + \">\");\n return j\n }\n } else { // Whitespace\n // console.log(\" skipspace 5 ch <\" + ch + \">\");\n if (str.charAt(j) === '\\n') {\n this.lines = this.lines + 1;\n }\n }\n } // next j\n return -1; // EOF\n };\n\n variable(str, i, res) {\n /*\n ?abc -> variable(:abc)\n */\n\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return -1;\n }\n if ((str.slice( j, ( j + 1 ) ) != \"?\")) {\n return -1;\n }\n var j = ( j + 1 ) ;\n var i = j;\n if ((\"0123456789-\".indexOf(str.charAt(j)) >= 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, ( ( \"Varible name can't start with '\" + str.charAt(j) ) + \"s'\" ) );\n return -1;\n }\n while ((i < pyjslib_len(str)) && (_notNameChars.indexOf(str.charAt(i)) < 0)) {\n var i = ( i + 1 ) ;\n }\n if ((this._parentContext == null)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, ( \"Can't use ?xxx syntax for variable in outermost level: \" + str.slice( ( j - 1 ) , i) ) );\n }\n res.push(this._store.variable(str.slice( j, i)));\n return i;\n };\n bareWord(str, i, res) {\n /*\n abc -> :abc\n */\n\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return -1;\n }\n var ch = str.charAt(j);\n if ((\"0123456789-\".indexOf(ch) >= 0)) {\n return -1;\n }\n if ((_notNameChars.indexOf(ch) >= 0)) {\n return -1;\n }\n var i = j;\n while ((i < pyjslib_len(str)) && (_notNameChars.indexOf(str.charAt(i)) < 0)) {\n var i = ( i + 1 ) ;\n }\n res.push(str.slice( j, i));\n return i;\n };\n qname(str, i, res) {\n /*\n\n xyz:def -> ('xyz', 'def')\n If not in keywords and keywordsSet: def -> ('', 'def')\n :def -> ('', 'def')\n */\n\n var i = this.skipSpace(str, i);\n if ((i < 0)) {\n return -1;\n }\n var c = str.charAt(i);\n if ((\"0123456789-+\".indexOf(c) >= 0)) {\n return -1;\n }\n if ((_notNameChars.indexOf(c) < 0)) {\n var ln = c;\n var i = ( i + 1 ) ;\n while ((i < pyjslib_len(str))) {\n var c = str.charAt(i);\n if ((_notNameChars.indexOf(c) < 0)) {\n var ln = ( ln + c ) ;\n var i = ( i + 1 ) ;\n }\n else {\n break;\n }\n }\n }\n else {\n var ln = \"\";\n }\n if ((i < pyjslib_len(str)) && (str.charAt(i) == \":\")) {\n var pfx = ln;\n var i = ( i + 1 ) ;\n var ln = \"\";\n while ((i < pyjslib_len(str))) {\n var c = str.charAt(i);\n if ((_notNameChars.indexOf(c) < 0)) {\n var ln = ( ln + c ) ;\n var i = ( i + 1 ) ;\n }\n else {\n break;\n }\n }\n res.push(new pyjslib_Tuple([pfx, ln]));\n return i;\n }\n else {\n if (ln && this.keywordsSet && (ArrayIndexOf(this.keywords, ln) < 0)) {\n res.push(new pyjslib_Tuple([\"\", ln]));\n return i;\n }\n return -1;\n }\n };\n object(str, i, res) {\n var j = this.subject(str, i, res);\n if ((j >= 0)) {\n return j;\n }\n else {\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return -1;\n }\n else {\n var i = j;\n }\n var delim = null\n let ch = str.charAt(i)\n if ((ch == \"\\\"\" || ch == \"'\")) {\n if (str.slice(i, ( i + 3 ) == ch + ch)) {\n delim = ch + ch + ch;\n }\n else {\n delim = ch;\n }\n var i = ( i + pyjslib_len(delim) ) ;\n var pairFudge = this.strconst(str, i, delim);\n var j = pairFudge[0];\n var s = pairFudge[1];\n res.push(this._store.literal(s));\n diag_progress(\"New string const \", s, j);\n return j;\n }\n else {\n return -1;\n }\n }\n };\n nodeOrLiteral(str, i, res) {\n var j = this.node(str, i, res);\n if ((j >= 0)) {\n return j;\n }\n else {\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return -1;\n }\n else {\n var i = j;\n }\n var ch = str.charAt(i);\n if ((\"-+0987654321\".indexOf(ch) >= 0)) {\n\n datetime_syntax.lastIndex = 0;\n var m = datetime_syntax.exec(str.slice(i));\n if ((m != null)) {\n // j = ( i + datetime_syntax.lastIndex ) ;\n var val = m[0];\n j = i + val.length;\n if ((val.indexOf(\"T\") >= 0)) {\n res.push(this._store.literal(val, this._store.sym(DATETIME_DATATYPE)));\n } else {\n res.push(this._store.literal(val, this._store.sym(DATE_DATATYPE)));\n }\n\n } else {\n number_syntax.lastIndex = 0;\n var m = number_syntax.exec(str.slice(i));\n if ((m == null)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"Bad number or date syntax\");\n }\n j = ( i + number_syntax.lastIndex ) ;\n var val = str.slice( i, j);\n if ((val.indexOf(\"e\") >= 0)) {\n res.push(this._store.literal(parseFloat(val), this._store.sym(FLOAT_DATATYPE)));\n }\n else if ((str.slice( i, j).indexOf(\".\") >= 0)) {\n res.push(this._store.literal(parseFloat(val), this._store.sym(DECIMAL_DATATYPE)));\n }\n else {\n res.push(this._store.literal(parseInt(val), this._store.sym(INTEGER_DATATYPE)));\n }\n };\n return j; // Where we have got up to\n }\n if ((str.charAt(i) == \"\\\"\")) {\n if ((str.slice( i, ( i + 3 ) ) == \"\\\"\\\"\\\"\")) {\n var delim = \"\\\"\\\"\\\"\";\n }\n else {\n var delim = \"\\\"\";\n }\n var i = ( i + pyjslib_len(delim) ) ;\n var dt = null;\n var pairFudge = this.strconst(str, i, delim);\n var j = pairFudge[0];\n var s = pairFudge[1];\n var lang = null;\n if ((str.slice( j, ( j + 1 ) ) == \"@\")) {\n langcode.lastIndex = 0;\n\n var m = langcode.exec(str.slice( ( j + 1 ) ));\n if ((m == null)) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"Bad language code syntax on string literal, after @\");\n }\n var i = ( ( langcode.lastIndex + j ) + 1 ) ;\n\n var lang = str.slice( ( j + 1 ) , i);\n var j = i;\n }\n if ((str.slice( j, ( j + 2 ) ) == \"^^\")) {\n var res2 = new pyjslib_List([]);\n var j = this.uri_ref2(str, ( j + 2 ) , res2);\n var dt = res2[0];\n }\n res.push(this._store.literal(s, lang || dt));\n return j;\n }\n else {\n return -1;\n }\n }\n };\n strconst(str, i, delim) {\n /*\n parse an N3 string constant delimited by delim.\n return index, val\n */\n\n var j = i;\n var ustr = \"\";\n var startline = this.lines;\n while ((j < pyjslib_len(str))) {\n var i = ( j + pyjslib_len(delim) ) ;\n if ((str.slice( j, i) == delim)) {\n return new pyjslib_Tuple([i, ustr]);\n }\n if ((str.charAt(j) == \"\\\"\")) {\n var ustr = ( ustr + \"\\\"\" ) ;\n var j = ( j + 1 ) ;\n continue;\n }\n interesting.lastIndex = 0;\n var m = interesting.exec(str.slice(j));\n if (!(m)) {\n throw BadSyntax(this._thisDoc, startline, str, j, ( ( ( \"Closing quote missing in string at ^ in \" + str.slice( ( j - 20 ) , j) ) + \"^\" ) + str.slice( j, ( j + 20 ) ) ) );\n }\n var i = ( ( j + interesting.lastIndex ) - 1 ) ;\n var ustr = ( ustr + str.slice( j, i) ) ;\n var ch = str.charAt(i);\n if ((ch == \"\\\"\")) {\n var j = i;\n continue;\n }\n else if ((ch == \"\\r\")) {\n var j = ( i + 1 ) ;\n continue;\n }\n else if ((ch == \"\\n\")) {\n if ((delim == \"\\\"\")) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"newline found in string literal\");\n }\n this.lines = ( this.lines + 1 ) ;\n var ustr = ( ustr + ch ) ;\n var j = ( i + 1 ) ;\n this.previousLine = this.startOfLine;\n this.startOfLine = j;\n }\n else if ((ch == \"\\\\\")) {\n var j = ( i + 1 ) ;\n var ch = str.slice( j, ( j + 1 ) );\n if (!(ch)) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"unterminated string literal (2)\");\n }\n var k = string_find(\"abfrtvn\\\\\\\"\", ch);\n if ((k >= 0)) {\n var uch = \"\\a\\b\\f\\r\\t\\v\\n\\\\\\\"\".charAt(k);\n var ustr = ( ustr + uch ) ;\n var j = ( j + 1 ) ;\n }\n else if ((ch == \"u\")) {\n var pairFudge = this.uEscape(str, ( j + 1 ) , startline);\n var j = pairFudge[0];\n var ch = pairFudge[1];\n var ustr = ( ustr + ch ) ;\n }\n else if ((ch == \"U\")) {\n var pairFudge = this.UEscape(str, ( j + 1 ) , startline);\n var j = pairFudge[0];\n var ch = pairFudge[1];\n var ustr = ( ustr + ch ) ;\n }\n else {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"bad escape\");\n }\n }\n }\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"unterminated string literal\");\n };\n uEscape(str, i, startline) {\n var j = i;\n var count = 0;\n var value = 0;\n while ((count < 4)) {\n var chFudge = str.slice( j, ( j + 1 ) );\n var ch = chFudge.toLowerCase();\n var j = ( j + 1 ) ;\n if ((ch == \"\")) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"unterminated string literal(3)\");\n }\n var k = string_find(\"0123456789abcdef\", ch);\n if ((k < 0)) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"bad string literal hex escape\");\n }\n var value = ( ( value * 16 ) + k ) ;\n var count = ( count + 1 ) ;\n }\n var uch = String.fromCharCode(value);\n return new pyjslib_Tuple([j, uch]);\n };\n UEscape(str, i, startline) {\n var j = i;\n var count = 0;\n var value = \"\\\\U\";\n while ((count < 8)) {\n var chFudge = str.slice( j, ( j + 1 ) );\n var ch = chFudge.toLowerCase();\n var j = ( j + 1 ) ;\n if ((ch == \"\")) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"unterminated string literal(3)\");\n }\n var k = string_find(\"0123456789abcdef\", ch);\n if ((k < 0)) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"bad string literal hex escape\");\n }\n var value = ( value + ch ) ;\n var count = ( count + 1 ) ;\n }\n var uch = stringFromCharCode( ( ( \"0x\" + pyjslib_slice(value, 2, 10) ) - 0 ) );\n return new pyjslib_Tuple([j, uch]);\n };\n}\n\nfunction OLD_BadSyntax(uri, lines, str, i, why) {\n return new __OLD_BadSyntax(uri, lines, str, i, why);\n}\nfunction __OLD_BadSyntax(uri, lines, str, i, why) {\n this._str = str.encode(\"utf-8\");\n this._str = str;\n this._i = i;\n this._why = why;\n this.lines = lines;\n this._uri = uri;\n}\n__OLD_BadSyntax.prototype.toString = function() {\n var str = this._str;\n var i = this._i;\n var st = 0;\n if ((i > 60)) {\n var pre = \"...\";\n var st = ( i - 60 ) ;\n }\n else {\n var pre = \"\";\n }\n if (( ( pyjslib_len(str) - i ) > 60)) {\n var post = \"...\";\n }\n else {\n var post = \"\";\n }\n return \"Line %i of <%s>: Bad syntax (%s) at ^ in:\\n\\\"%s%s^%s%s\\\"\" % new pyjslib_Tuple([ ( this.lines + 1 ) , this._uri, this._why, pre, str.slice( st, i), str.slice( i, ( i + 60 ) ), post]);\n}\n\nfunction BadSyntax(uri, lines, str, i, why) {\n let lineNo = lines + 1\n let msg = ( ( ( ( ( ( ( ( \"Line \" + ( lineNo ) ) + \" of <\" ) + uri ) + \">: Bad syntax: \" ) + why ) + \"\\nat: \\\"\" ) + str.slice( i, ( i + 30 ) ) ) + \"\\\"\" ) ;\n let e = new SyntaxError(msg, uri , lineNo)\n e.lineNo = lineNo\n e.characterInFile = i\n e.syntaxProblem = why\n return e\n}\n\nfunction stripCR(str) {\n var res = \"\";\n\n var __ch = new pyjslib_Iterator(str);\n try {\n while (true) {\n var ch = __ch.next();\n\n\n if ((ch != \"\\r\")) {\n var res = ( res + ch ) ;\n }\n\n }\n } catch (e) {\n if (e != StopIteration) {\n throw e;\n }\n }\n\n return res;\n}\n\n\nfunction dummyWrite(x) {\n}\n","import Collection from '../collection'\nimport CanonicalDataFactory from './canonical-data-factory'\nimport { ValueType, CollectionTermType } from '../types'\nimport { DataFactory, DefaultFactoryTypes, Feature, Indexable } from './factory-types'\nimport { isCollection, isVariable } from '../utils/terms'\nimport Variable from '../variable'\nimport { Term } from '../tf-types'\n\ninterface CollectionFactory extends DataFactory {\n collection(elements: ReadonlyArray): Collection\n}\n\n/**\n * Data factory which also supports Collections\n *\n * Necessary for preventing circular dependencies.\n */\nconst ExtendedTermFactory: CollectionFactory = {\n ...CanonicalDataFactory,\n\n supports: {\n [Feature.collections]: true,\n [Feature.defaultGraphType]: false,\n [Feature.equalsMethod]: true,\n [Feature.identity]: false,\n [Feature.id]: true,\n [Feature.reversibleId]: false,\n [Feature.variableType]: true,\n },\n\n /**\n * Creates a new collection\n * @param elements - The initial element\n */\n collection (elements: ReadonlyArray): Collection {\n return new Collection(elements)\n },\n\n id (term: Term | DefaultFactoryTypes): Indexable {\n if (isCollection(term)) {\n return `( ${term.elements.map((e) => {\n return this.id(e) }).join(', ')} )`\n }\n\n if (isVariable(term)) {\n return Variable.toString(term)\n }\n\n return CanonicalDataFactory.id(term)\n },\n\n termToNQ (term: Term): string {\n if (term.termType === CollectionTermType) {\n return Collection.toNT(term)\n }\n\n return CanonicalDataFactory.termToNQ(term)\n }\n}\n\nexport default ExtendedTermFactory\n","import { arrayToStatements } from './utils'\n\n/**\n * Parses json-ld formatted JS objects to a rdf Term.\n * @param kb - The DataFactory to use.\n * @param obj - The json-ld object to process.\n * @return {Literal|NamedNode|BlankNode|Collection}\n */\nexport function jsonldObjectToTerm (kb, obj) {\n if (typeof obj === 'string') {\n return kb.rdfFactory.literal(obj)\n }\n\n if (Object.prototype.hasOwnProperty.call(obj, '@list')) {\n if (kb.rdfFactory.supports[\"COLLECTIONS\"] === true) {\n return listToCollection(kb, obj['@list'])\n }\n\n return listToStatements(kb, obj)\n }\n\n if (Object.prototype.hasOwnProperty.call(obj, '@id')) {\n return nodeType(kb, obj)\n }\n\n if (Object.prototype.hasOwnProperty.call(obj, '@language')) {\n return kb.rdfFactory.literal(obj['@value'], obj['@language'])\n }\n\n if (Object.prototype.hasOwnProperty.call(obj, '@type')) {\n return kb.rdfFactory.literal(obj['@value'], kb.rdfFactory.namedNode(obj['@type']))\n }\n\n if (Object.prototype.hasOwnProperty.call(obj, '@value')) {\n return kb.rdfFactory.literal(obj['@value'])\n }\n\n return kb.rdfFactory.literal(obj)\n}\n\n/**\n * Adds the statements in a json-ld list object to {kb}.\n */\nfunction listToStatements (kb, obj) {\n const listId = obj['@id'] ? nodeType(kb, obj) : kb.rdfFactory.blankNode()\n\n const items = obj['@list'].map((listItem => jsonldObjectToTerm(kb, listItem)))\n const statements = arrayToStatements(kb.rdfFactory, listId, items)\n kb.addAll(statements)\n\n return listId\n}\n\nfunction listToCollection (kb, obj) {\n if (!Array.isArray(obj)) {\n throw new TypeError(\"Object must be an array\")\n }\n return kb.rdfFactory.collection(obj.map((o) => jsonldObjectToTerm(kb, o)))\n}\n\n/**\n * Takes a json-ld formatted string {str} and adds its statements to {kb}.\n *\n * Ensure that {kb.rdfFactory} is a DataFactory.\n */\nexport default function jsonldParser (str, kb, base, callback) {\n const baseString = base && Object.prototype.hasOwnProperty.call(base, 'termType')\n ? base.value\n : base\n\n return import('jsonld')\n .then(jsonld => { return jsonld.flatten(JSON.parse(str), null, { base: baseString }) })\n .then((flattened) => flattened.reduce((store, flatResource) => {\n\n kb = processResource(kb, base, flatResource)\n\n return kb\n }, kb))\n .then(callback)\n .catch(callback)\n}\n\nfunction nodeType (kb, obj) {\n if (obj['@id'].startsWith('_:')) {\n // This object is a Blank Node. Pass the id without the `_:` prefix\n return kb.rdfFactory.blankNode(obj['@id'].substring(2));\n } else {\n // This object is a Named Node\n return kb.rdfFactory.namedNode(obj['@id']);\n }\n}\n\nfunction processResource(kb, base, flatResource) {\n const id = flatResource['@id']\n ? nodeType(kb, flatResource)\n : kb.rdfFactory.blankNode()\n\n for (const property of Object.keys(flatResource)) {\n if (property === '@id') {\n continue\n } else if (property == '@graph') {\n // the JSON-LD flattened structure may contain nested graphs\n // the id value for this object is the new base (named graph id) for all nested flat resources\n const graphId = id\n // this is an array of resources\n const nestedFlatResources = flatResource[property]\n\n // recursively process all flat resources in the array, but with the graphId as base.\n for (let i = 0; i < nestedFlatResources.length; i++ ) {\n kb = processResource(kb, graphId, nestedFlatResources[i])\n }\n }\n\n const value = flatResource[property]\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n kb.addStatement(createStatement(kb, id, property, value[i], base))\n }\n } else {\n kb.addStatement(createStatement(kb, id, property, value, base))\n }\n }\n\n return kb\n}\n\n/**\n * Create statement quad depending on @type being a type node\n * @param kb\n * @param subject id\n * @param property\n * @param value\n * @return quad statement\n */\nfunction createStatement(kb, id, property, value, base) {\n let predicate, object\n\n if (property === \"@type\") {\n predicate = kb.rdfFactory.namedNode(\"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\")\n object = kb.rdfFactory.namedNode(value)\n } else {\n predicate = kb.rdfFactory.namedNode(property)\n object = jsonldObjectToTerm(kb, value)\n }\n return kb.rdfFactory.quad(id, predicate, object, kb.rdfFactory.namedNode(base))\n}","const RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n XSD = 'http://www.w3.org/2001/XMLSchema#',\n SWAP = 'http://www.w3.org/2000/10/swap/';\n\nexport default {\n xsd: {\n decimal: `${XSD}decimal`,\n boolean: `${XSD}boolean`,\n double: `${XSD}double`,\n integer: `${XSD}integer`,\n string: `${XSD}string`,\n },\n rdf: {\n type: `${RDF}type`,\n nil: `${RDF}nil`,\n first: `${RDF}first`,\n rest: `${RDF}rest`,\n langString: `${RDF}langString`,\n },\n owl: {\n sameAs: 'http://www.w3.org/2002/07/owl#sameAs',\n },\n r: {\n forSome: `${SWAP}reify#forSome`,\n forAll: `${SWAP}reify#forAll`,\n },\n log: {\n implies: `${SWAP}log#implies`,\n },\n};\n","// **N3Lexer** tokenizes N3 documents.\nimport queueMicrotask from 'queue-microtask';\nimport namespaces from './IRIs';\n\nconst { xsd } = namespaces;\n\n// Regular expression and replacement string to escape N3 strings\nconst escapeSequence = /\\\\u([a-fA-F0-9]{4})|\\\\U([a-fA-F0-9]{8})|\\\\([^])/g;\nconst escapeReplacements = {\n '\\\\': '\\\\', \"'\": \"'\", '\"': '\"',\n 'n': '\\n', 'r': '\\r', 't': '\\t', 'f': '\\f', 'b': '\\b',\n '_': '_', '~': '~', '.': '.', '-': '-', '!': '!', '$': '$', '&': '&',\n '(': '(', ')': ')', '*': '*', '+': '+', ',': ',', ';': ';', '=': '=',\n '/': '/', '?': '?', '#': '#', '@': '@', '%': '%',\n};\nconst illegalIriChars = /[\\x00-\\x20<>\\\\\"\\{\\}\\|\\^\\`]/;\n\nconst lineModeRegExps = {\n _iri: true,\n _unescapedIri: true,\n _simpleQuotedString: true,\n _langcode: true,\n _blank: true,\n _newline: true,\n _comment: true,\n _whitespace: true,\n _endOfFile: true,\n};\nconst invalidRegExp = /$0^/;\n\n// ## Constructor\nexport default class N3Lexer {\n constructor(options) {\n // ## Regular expressions\n // It's slightly faster to have these as properties than as in-scope variables\n this._iri = /^<((?:[^ <>{}\\\\]|\\\\[uU])+)>[ \\t]*/; // IRI with escape sequences; needs sanity check after unescaping\n this._unescapedIri = /^<([^\\x00-\\x20<>\\\\\"\\{\\}\\|\\^\\`]*)>[ \\t]*/; // IRI without escape sequences; no unescaping\n this._simpleQuotedString = /^\"([^\"\\\\\\r\\n]*)\"(?=[^\"])/; // string without escape sequences\n this._simpleApostropheString = /^'([^'\\\\\\r\\n]*)'(?=[^'])/;\n this._langcode = /^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\\-])/i;\n this._prefix = /^((?:[A-Za-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])(?:\\.?[\\-0-9A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])*)?:(?=[#\\s<])/;\n this._prefixed = /^((?:[A-Za-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])(?:\\.?[\\-0-9A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])*)?:((?:(?:[0-:A-Z_a-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff]|%[0-9a-fA-F]{2}|\\\\[!#-\\/;=?\\-@_~])(?:(?:[\\.\\-0-:A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff]|%[0-9a-fA-F]{2}|\\\\[!#-\\/;=?\\-@_~])*(?:[\\-0-:A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff]|%[0-9a-fA-F]{2}|\\\\[!#-\\/;=?\\-@_~]))?)?)(?:[ \\t]+|(?=\\.?[,;!\\^\\s#()\\[\\]\\{\\}\"'<>]))/;\n this._variable = /^\\?(?:(?:[A-Z_a-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])(?:[\\-0-:A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])*)(?=[.,;!\\^\\s#()\\[\\]\\{\\}\"'<>])/;\n this._blank = /^_:((?:[0-9A-Z_a-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])(?:\\.?[\\-0-9A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])*)(?:[ \\t]+|(?=\\.?[,;:\\s#()\\[\\]\\{\\}\"'<>]))/;\n this._number = /^[\\-+]?(?:(\\d+\\.\\d*|\\.?\\d+)[eE][\\-+]?|\\d*(\\.)?)\\d+(?=\\.?[,;:\\s#()\\[\\]\\{\\}\"'<>])/;\n this._boolean = /^(?:true|false)(?=[.,;\\s#()\\[\\]\\{\\}\"'<>])/;\n this._keyword = /^@[a-z]+(?=[\\s#<:])/i;\n this._sparqlKeyword = /^(?:PREFIX|BASE|GRAPH)(?=[\\s#<])/i;\n this._shortPredicates = /^a(?=[\\s#()\\[\\]\\{\\}\"'<>])/;\n this._newline = /^[ \\t]*(?:#[^\\n\\r]*)?(?:\\r\\n|\\n|\\r)[ \\t]*/;\n this._comment = /#([^\\n\\r]*)/;\n this._whitespace = /^[ \\t]+/;\n this._endOfFile = /^(?:#[^\\n\\r]*)?$/;\n options = options || {};\n\n // In line mode (N-Triples or N-Quads), only simple features may be parsed\n if (this._lineMode = !!options.lineMode) {\n this._n3Mode = false;\n // Don't tokenize special literals\n for (const key in this) {\n if (!(key in lineModeRegExps) && this[key] instanceof RegExp)\n this[key] = invalidRegExp;\n }\n }\n // When not in line mode, enable N3 functionality by default\n else {\n this._n3Mode = options.n3 !== false;\n }\n // Don't output comment tokens by default\n this._comments = !!options.comments;\n // Cache the last tested closing position of long literals\n this._literalClosingPos = 0;\n }\n\n // ## Private methods\n\n // ### `_tokenizeToEnd` tokenizes as for as possible, emitting tokens through the callback\n _tokenizeToEnd(callback, inputFinished) {\n // Continue parsing as far as possible; the loop will return eventually\n let input = this._input;\n let currentLineLength = input.length;\n while (true) {\n // Count and skip whitespace lines\n let whiteSpaceMatch, comment;\n while (whiteSpaceMatch = this._newline.exec(input)) {\n // Try to find a comment\n if (this._comments && (comment = this._comment.exec(whiteSpaceMatch[0])))\n emitToken('comment', comment[1], '', this._line, whiteSpaceMatch[0].length);\n // Advance the input\n input = input.substr(whiteSpaceMatch[0].length, input.length);\n currentLineLength = input.length;\n this._line++;\n }\n // Skip whitespace on current line\n if (!whiteSpaceMatch && (whiteSpaceMatch = this._whitespace.exec(input)))\n input = input.substr(whiteSpaceMatch[0].length, input.length);\n\n // Stop for now if we're at the end\n if (this._endOfFile.test(input)) {\n // If the input is finished, emit EOF\n if (inputFinished) {\n // Try to find a final comment\n if (this._comments && (comment = this._comment.exec(input)))\n emitToken('comment', comment[1], '', this._line, input.length);\n input = null;\n emitToken('eof', '', '', this._line, 0);\n }\n return this._input = input;\n }\n\n // Look for specific token types based on the first character\n const line = this._line, firstChar = input[0];\n let type = '', value = '', prefix = '',\n match = null, matchLength = 0, inconclusive = false;\n switch (firstChar) {\n case '^':\n // We need at least 3 tokens lookahead to distinguish ^^ and ^^pre:fixed\n if (input.length < 3)\n break;\n // Try to match a type\n else if (input[1] === '^') {\n this._previousMarker = '^^';\n // Move to type IRI or prefixed name\n input = input.substr(2);\n if (input[0] !== '<') {\n inconclusive = true;\n break;\n }\n }\n // If no type, it must be a path expression\n else {\n if (this._n3Mode) {\n matchLength = 1;\n type = '^';\n }\n break;\n }\n // Fall through in case the type is an IRI\n case '<':\n // Try to find a full IRI without escape sequences\n if (match = this._unescapedIri.exec(input))\n type = 'IRI', value = match[1];\n // Try to find a full IRI with escape sequences\n else if (match = this._iri.exec(input)) {\n value = this._unescape(match[1]);\n if (value === null || illegalIriChars.test(value))\n return reportSyntaxError(this);\n type = 'IRI';\n }\n // Try to find a nested triple\n else if (input.length > 1 && input[1] === '<')\n type = '<<', matchLength = 2;\n // Try to find a backwards implication arrow\n else if (this._n3Mode && input.length > 1 && input[1] === '=')\n type = 'inverse', matchLength = 2, value = '>';\n break;\n\n case '>':\n if (input.length > 1 && input[1] === '>')\n type = '>>', matchLength = 2;\n break;\n\n case '_':\n // Try to find a blank node. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a blank node.\n // Therefore, try inserting a space if we're at the end of the input.\n if ((match = this._blank.exec(input)) ||\n inputFinished && (match = this._blank.exec(`${input} `)))\n type = 'blank', prefix = '_', value = match[1];\n break;\n\n case '\"':\n // Try to find a literal without escape sequences\n if (match = this._simpleQuotedString.exec(input))\n value = match[1];\n // Try to find a literal wrapped in three pairs of quotes\n else {\n ({ value, matchLength } = this._parseLiteral(input));\n if (value === null)\n return reportSyntaxError(this);\n }\n if (match !== null || matchLength !== 0) {\n type = 'literal';\n this._literalClosingPos = 0;\n }\n break;\n\n case \"'\":\n if (!this._lineMode) {\n // Try to find a literal without escape sequences\n if (match = this._simpleApostropheString.exec(input))\n value = match[1];\n // Try to find a literal wrapped in three pairs of quotes\n else {\n ({ value, matchLength } = this._parseLiteral(input));\n if (value === null)\n return reportSyntaxError(this);\n }\n if (match !== null || matchLength !== 0) {\n type = 'literal';\n this._literalClosingPos = 0;\n }\n }\n break;\n\n case '?':\n // Try to find a variable\n if (this._n3Mode && (match = this._variable.exec(input)))\n type = 'var', value = match[0];\n break;\n\n case '@':\n // Try to find a language code\n if (this._previousMarker === 'literal' && (match = this._langcode.exec(input)))\n type = 'langcode', value = match[1];\n // Try to find a keyword\n else if (match = this._keyword.exec(input))\n type = match[0];\n break;\n\n case '.':\n // Try to find a dot as punctuation\n if (input.length === 1 ? inputFinished : (input[1] < '0' || input[1] > '9')) {\n type = '.';\n matchLength = 1;\n break;\n }\n // Fall through to numerical case (could be a decimal dot)\n\n case '0':\n case '1':\n case '2':\n case '3':\n case '4':\n case '5':\n case '6':\n case '7':\n case '8':\n case '9':\n case '+':\n case '-':\n // Try to find a number. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a number.\n // Therefore, try inserting a space if we're at the end of the input.\n if (match = this._number.exec(input) ||\n inputFinished && (match = this._number.exec(`${input} `))) {\n type = 'literal', value = match[0];\n prefix = (typeof match[1] === 'string' ? xsd.double :\n (typeof match[2] === 'string' ? xsd.decimal : xsd.integer));\n }\n break;\n\n case 'B':\n case 'b':\n case 'p':\n case 'P':\n case 'G':\n case 'g':\n // Try to find a SPARQL-style keyword\n if (match = this._sparqlKeyword.exec(input))\n type = match[0].toUpperCase();\n else\n inconclusive = true;\n break;\n\n case 'f':\n case 't':\n // Try to match a boolean\n if (match = this._boolean.exec(input))\n type = 'literal', value = match[0], prefix = xsd.boolean;\n else\n inconclusive = true;\n break;\n\n case 'a':\n // Try to find an abbreviated predicate\n if (match = this._shortPredicates.exec(input))\n type = 'abbreviation', value = 'a';\n else\n inconclusive = true;\n break;\n\n case '=':\n // Try to find an implication arrow or equals sign\n if (this._n3Mode && input.length > 1) {\n type = 'abbreviation';\n if (input[1] !== '>')\n matchLength = 1, value = '=';\n else\n matchLength = 2, value = '>';\n }\n break;\n\n case '!':\n if (!this._n3Mode)\n break;\n case ',':\n case ';':\n case '[':\n case ']':\n case '(':\n case ')':\n case '}':\n if (!this._lineMode) {\n matchLength = 1;\n type = firstChar;\n }\n break;\n case '{':\n // We need at least 2 tokens lookahead to distinguish \"{|\" and \"{ \"\n if (!this._lineMode && input.length >= 2) {\n // Try to find a quoted triple annotation start\n if (input[1] === '|')\n type = '{|', matchLength = 2;\n else\n type = firstChar, matchLength = 1;\n }\n break;\n case '|':\n // We need 2 tokens lookahead to parse \"|}\"\n // Try to find a quoted triple annotation end\n if (input.length >= 2 && input[1] === '}')\n type = '|}', matchLength = 2;\n break;\n\n default:\n inconclusive = true;\n }\n\n // Some first characters do not allow an immediate decision, so inspect more\n if (inconclusive) {\n // Try to find a prefix\n if ((this._previousMarker === '@prefix' || this._previousMarker === 'PREFIX') &&\n (match = this._prefix.exec(input)))\n type = 'prefix', value = match[1] || '';\n // Try to find a prefixed name. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a prefixed name.\n // Therefore, try inserting a space if we're at the end of the input.\n else if ((match = this._prefixed.exec(input)) ||\n inputFinished && (match = this._prefixed.exec(`${input} `)))\n type = 'prefixed', prefix = match[1] || '', value = this._unescape(match[2]);\n }\n\n // A type token is special: it can only be emitted after an IRI or prefixed name is read\n if (this._previousMarker === '^^') {\n switch (type) {\n case 'prefixed': type = 'type'; break;\n case 'IRI': type = 'typeIRI'; break;\n default: type = '';\n }\n }\n\n // What if nothing of the above was found?\n if (!type) {\n // We could be in streaming mode, and then we just wait for more input to arrive.\n // Otherwise, a syntax error has occurred in the input.\n // One exception: error on an unaccounted linebreak (= not inside a triple-quoted literal).\n if (inputFinished || (!/^'''|^\"\"\"/.test(input) && /\\n|\\r/.test(input)))\n return reportSyntaxError(this);\n else\n return this._input = input;\n }\n\n // Emit the parsed token\n const length = matchLength || match[0].length;\n const token = emitToken(type, value, prefix, line, length);\n this.previousToken = token;\n this._previousMarker = type;\n\n // Advance to next part to tokenize\n input = input.substr(length, input.length);\n }\n\n // Emits the token through the callback\n function emitToken(type, value, prefix, line, length) {\n const start = input ? currentLineLength - input.length : currentLineLength;\n const end = start + length;\n const token = { type, value, prefix, line, start, end };\n callback(null, token);\n return token;\n }\n // Signals the syntax error through the callback\n function reportSyntaxError(self) { callback(self._syntaxError(/^\\S*/.exec(input)[0])); }\n }\n\n // ### `_unescape` replaces N3 escape codes by their corresponding characters\n _unescape(item) {\n let invalid = false;\n const replaced = item.replace(escapeSequence, (sequence, unicode4, unicode8, escapedChar) => {\n // 4-digit unicode character\n if (typeof unicode4 === 'string')\n return String.fromCharCode(Number.parseInt(unicode4, 16));\n // 8-digit unicode character\n if (typeof unicode8 === 'string') {\n let charCode = Number.parseInt(unicode8, 16);\n return charCode <= 0xFFFF ? String.fromCharCode(Number.parseInt(unicode8, 16)) :\n String.fromCharCode(0xD800 + ((charCode -= 0x10000) >> 10), 0xDC00 + (charCode & 0x3FF));\n }\n // fixed escape sequence\n if (escapedChar in escapeReplacements)\n return escapeReplacements[escapedChar];\n // invalid escape sequence\n invalid = true;\n return '';\n });\n return invalid ? null : replaced;\n }\n\n // ### `_parseLiteral` parses a literal into an unescaped value\n _parseLiteral(input) {\n // Ensure we have enough lookahead to identify triple-quoted strings\n if (input.length >= 3) {\n // Identify the opening quote(s)\n const opening = input.match(/^(?:\"\"\"|\"|'''|'|)/)[0];\n const openingLength = opening.length;\n\n // Find the next candidate closing quotes\n let closingPos = Math.max(this._literalClosingPos, openingLength);\n while ((closingPos = input.indexOf(opening, closingPos)) > 0) {\n // Count backslashes right before the closing quotes\n let backslashCount = 0;\n while (input[closingPos - backslashCount - 1] === '\\\\')\n backslashCount++;\n\n // An even number of backslashes (in particular 0)\n // means these are actual, non-escaped closing quotes\n if (backslashCount % 2 === 0) {\n // Extract and unescape the value\n const raw = input.substring(openingLength, closingPos);\n const lines = raw.split(/\\r\\n|\\r|\\n/).length - 1;\n const matchLength = closingPos + openingLength;\n // Only triple-quoted strings can be multi-line\n if (openingLength === 1 && lines !== 0 ||\n openingLength === 3 && this._lineMode)\n break;\n this._line += lines;\n return { value: this._unescape(raw), matchLength };\n }\n closingPos++;\n }\n this._literalClosingPos = input.length - openingLength + 1;\n }\n return { value: '', matchLength: 0 };\n }\n\n // ### `_syntaxError` creates a syntax error for the given issue\n _syntaxError(issue) {\n this._input = null;\n const err = new Error(`Unexpected \"${issue}\" on line ${this._line}.`);\n err.context = {\n token: undefined,\n line: this._line,\n previousToken: this.previousToken,\n };\n return err;\n }\n\n // ### Strips off any starting UTF BOM mark.\n _readStartingBom(input) {\n return input.startsWith('\\ufeff') ? input.substr(1) : input;\n }\n\n // ## Public methods\n\n // ### `tokenize` starts the transformation of an N3 document into an array of tokens.\n // The input can be a string or a stream.\n tokenize(input, callback) {\n this._line = 1;\n\n // If the input is a string, continuously emit tokens through the callback until the end\n if (typeof input === 'string') {\n this._input = this._readStartingBom(input);\n // If a callback was passed, asynchronously call it\n if (typeof callback === 'function')\n queueMicrotask(() => this._tokenizeToEnd(callback, true));\n // If no callback was passed, tokenize synchronously and return\n else {\n const tokens = [];\n let error;\n this._tokenizeToEnd((e, t) => e ? (error = e) : tokens.push(t), true);\n if (error) throw error;\n return tokens;\n }\n }\n // Otherwise, the input must be a stream\n else {\n this._pendingBuffer = null;\n if (typeof input.setEncoding === 'function')\n input.setEncoding('utf8');\n // Adds the data chunk to the buffer and parses as far as possible\n input.on('data', data => {\n if (this._input !== null && data.length !== 0) {\n // Prepend any previous pending writes\n if (this._pendingBuffer) {\n data = Buffer.concat([this._pendingBuffer, data]);\n this._pendingBuffer = null;\n }\n // Hold if the buffer ends in an incomplete unicode sequence\n if (data[data.length - 1] & 0x80) {\n this._pendingBuffer = data;\n }\n // Otherwise, tokenize as far as possible\n else {\n // Only read a BOM at the start\n if (typeof this._input === 'undefined')\n this._input = this._readStartingBom(typeof data === 'string' ? data : data.toString());\n else\n this._input += data;\n this._tokenizeToEnd(callback, false);\n }\n }\n });\n // Parses until the end\n input.on('end', () => {\n if (typeof this._input === 'string')\n this._tokenizeToEnd(callback, true);\n });\n input.on('error', callback);\n }\n }\n}\n","// N3.js implementations of the RDF/JS core data types\n// See https://github.com/rdfjs/representation-task-force/blob/master/interface-spec.md\n\nimport namespaces from './IRIs';\n\nconst { rdf, xsd } = namespaces;\n\n// eslint-disable-next-line prefer-const\nlet DEFAULTGRAPH;\nlet _blankNodeCounter = 0;\n\nconst escapedLiteral = /^\"(.*\".*)(?=\"[^\"]*$)/;\n\n// ## DataFactory singleton\nconst DataFactory = {\n namedNode,\n blankNode,\n variable,\n literal,\n defaultGraph,\n quad,\n triple: quad,\n};\nexport default DataFactory;\n\n// ## Term constructor\nexport class Term {\n constructor(id) {\n this.id = id;\n }\n\n // ### The value of this term\n get value() {\n return this.id;\n }\n\n // ### Returns whether this object represents the same term as the other\n equals(other) {\n // If both terms were created by this library,\n // equality can be computed through ids\n if (other instanceof Term)\n return this.id === other.id;\n // Otherwise, compare term type and value\n return !!other && this.termType === other.termType &&\n this.value === other.value;\n }\n\n // ### Implement hashCode for Immutable.js, since we implement `equals`\n // https://immutable-js.com/docs/v4.0.0/ValueObject/#hashCode()\n hashCode() {\n return 0;\n }\n\n // ### Returns a plain object representation of this term\n toJSON() {\n return {\n termType: this.termType,\n value: this.value,\n };\n }\n}\n\n\n// ## NamedNode constructor\nexport class NamedNode extends Term {\n // ### The term type of this term\n get termType() {\n return 'NamedNode';\n }\n}\n\n// ## Literal constructor\nexport class Literal extends Term {\n // ### The term type of this term\n get termType() {\n return 'Literal';\n }\n\n // ### The text value of this literal\n get value() {\n return this.id.substring(1, this.id.lastIndexOf('\"'));\n }\n\n // ### The language of this literal\n get language() {\n // Find the last quotation mark (e.g., '\"abc\"@en-us')\n const id = this.id;\n let atPos = id.lastIndexOf('\"') + 1;\n // If \"@\" it follows, return the remaining substring; empty otherwise\n return atPos < id.length && id[atPos++] === '@' ? id.substr(atPos).toLowerCase() : '';\n }\n\n // ### The datatype IRI of this literal\n get datatype() {\n return new NamedNode(this.datatypeString);\n }\n\n // ### The datatype string of this literal\n get datatypeString() {\n // Find the last quotation mark (e.g., '\"abc\"^^http://ex.org/types#t')\n const id = this.id, dtPos = id.lastIndexOf('\"') + 1;\n const char = dtPos < id.length ? id[dtPos] : '';\n // If \"^\" it follows, return the remaining substring\n return char === '^' ? id.substr(dtPos + 2) :\n // If \"@\" follows, return rdf:langString; xsd:string otherwise\n (char !== '@' ? xsd.string : rdf.langString);\n }\n\n // ### Returns whether this object represents the same term as the other\n equals(other) {\n // If both literals were created by this library,\n // equality can be computed through ids\n if (other instanceof Literal)\n return this.id === other.id;\n // Otherwise, compare term type, value, language, and datatype\n return !!other && !!other.datatype &&\n this.termType === other.termType &&\n this.value === other.value &&\n this.language === other.language &&\n this.datatype.value === other.datatype.value;\n }\n\n toJSON() {\n return {\n termType: this.termType,\n value: this.value,\n language: this.language,\n datatype: { termType: 'NamedNode', value: this.datatypeString },\n };\n }\n}\n\n// ## BlankNode constructor\nexport class BlankNode extends Term {\n constructor(name) {\n super(`_:${name}`);\n }\n\n // ### The term type of this term\n get termType() {\n return 'BlankNode';\n }\n\n // ### The name of this blank node\n get value() {\n return this.id.substr(2);\n }\n}\n\nexport class Variable extends Term {\n constructor(name) {\n super(`?${name}`);\n }\n\n // ### The term type of this term\n get termType() {\n return 'Variable';\n }\n\n // ### The name of this variable\n get value() {\n return this.id.substr(1);\n }\n}\n\n// ## DefaultGraph constructor\nexport class DefaultGraph extends Term {\n constructor() {\n super('');\n return DEFAULTGRAPH || this;\n }\n\n // ### The term type of this term\n get termType() {\n return 'DefaultGraph';\n }\n\n // ### Returns whether this object represents the same term as the other\n equals(other) {\n // If both terms were created by this library,\n // equality can be computed through strict equality;\n // otherwise, compare term types.\n return (this === other) || (!!other && (this.termType === other.termType));\n }\n}\n\n// ## DefaultGraph singleton\nDEFAULTGRAPH = new DefaultGraph();\n\n// ### Constructs a term from the given internal string ID\n// The third 'nested' parameter of this function is to aid\n// with recursion over nested terms. It should not be used\n// by consumers of this library.\n// See https://github.com/rdfjs/N3.js/pull/311#discussion_r1061042725\nexport function termFromId(id, factory, nested) {\n factory = factory || DataFactory;\n\n // Falsy value or empty string indicate the default graph\n if (!id)\n return factory.defaultGraph();\n\n // Identify the term type based on the first character\n switch (id[0]) {\n case '?':\n return factory.variable(id.substr(1));\n case '_':\n return factory.blankNode(id.substr(2));\n case '\"':\n // Shortcut for internal literals\n if (factory === DataFactory)\n return new Literal(id);\n // Literal without datatype or language\n if (id[id.length - 1] === '\"')\n return factory.literal(id.substr(1, id.length - 2));\n // Literal with datatype or language\n const endPos = id.lastIndexOf('\"', id.length - 1);\n return factory.literal(id.substr(1, endPos - 1),\n id[endPos + 1] === '@' ? id.substr(endPos + 2)\n : factory.namedNode(id.substr(endPos + 3)));\n case '[':\n id = JSON.parse(id);\n break;\n default:\n if (!nested || !Array.isArray(id)) {\n return factory.namedNode(id);\n }\n }\n return factory.quad(\n termFromId(id[0], factory, true),\n termFromId(id[1], factory, true),\n termFromId(id[2], factory, true),\n id[3] && termFromId(id[3], factory, true)\n );\n}\n\n// ### Constructs an internal string ID from the given term or ID string\n// The third 'nested' parameter of this function is to aid\n// with recursion over nested terms. It should not be used\n// by consumers of this library.\n// See https://github.com/rdfjs/N3.js/pull/311#discussion_r1061042725\nexport function termToId(term, nested) {\n if (typeof term === 'string')\n return term;\n if (term instanceof Term && term.termType !== 'Quad')\n return term.id;\n if (!term)\n return DEFAULTGRAPH.id;\n\n // Term instantiated with another library\n switch (term.termType) {\n case 'NamedNode': return term.value;\n case 'BlankNode': return `_:${term.value}`;\n case 'Variable': return `?${term.value}`;\n case 'DefaultGraph': return '';\n case 'Literal': return `\"${term.value}\"${\n term.language ? `@${term.language}` :\n (term.datatype && term.datatype.value !== xsd.string ? `^^${term.datatype.value}` : '')}`;\n case 'Quad':\n const res = [\n termToId(term.subject, true),\n termToId(term.predicate, true),\n termToId(term.object, true),\n ];\n if (term.graph && term.graph.termType !== 'DefaultGraph') {\n res.push(termToId(term.graph, true));\n }\n return nested ? res : JSON.stringify(res);\n default: throw new Error(`Unexpected termType: ${term.termType}`);\n }\n}\n\n\n// ## Quad constructor\nexport class Quad extends Term {\n constructor(subject, predicate, object, graph) {\n super('');\n this._subject = subject;\n this._predicate = predicate;\n this._object = object;\n this._graph = graph || DEFAULTGRAPH;\n }\n\n // ### The term type of this term\n get termType() {\n return 'Quad';\n }\n\n get subject() {\n return this._subject;\n }\n\n get predicate() {\n return this._predicate;\n }\n\n get object() {\n return this._object;\n }\n\n get graph() {\n return this._graph;\n }\n\n // ### Returns a plain object representation of this quad\n toJSON() {\n return {\n termType: this.termType,\n subject: this._subject.toJSON(),\n predicate: this._predicate.toJSON(),\n object: this._object.toJSON(),\n graph: this._graph.toJSON(),\n };\n }\n\n // ### Returns whether this object represents the same quad as the other\n equals(other) {\n return !!other && this._subject.equals(other.subject) &&\n this._predicate.equals(other.predicate) &&\n this._object.equals(other.object) &&\n this._graph.equals(other.graph);\n }\n}\nexport { Quad as Triple };\n\n// ### Escapes the quotes within the given literal\nexport function escapeQuotes(id) {\n return id.replace(escapedLiteral, (_, quoted) => `\"${quoted.replace(/\"/g, '\"\"')}`);\n}\n\n// ### Unescapes the quotes within the given literal\nexport function unescapeQuotes(id) {\n return id.replace(escapedLiteral, (_, quoted) => `\"${quoted.replace(/\"\"/g, '\"')}`);\n}\n\n// ### Creates an IRI\nfunction namedNode(iri) {\n return new NamedNode(iri);\n}\n\n// ### Creates a blank node\nfunction blankNode(name) {\n return new BlankNode(name || `n3-${_blankNodeCounter++}`);\n}\n\n// ### Creates a literal\nfunction literal(value, languageOrDataType) {\n // Create a language-tagged string\n if (typeof languageOrDataType === 'string')\n return new Literal(`\"${value}\"@${languageOrDataType.toLowerCase()}`);\n\n // Automatically determine datatype for booleans and numbers\n let datatype = languageOrDataType ? languageOrDataType.value : '';\n if (datatype === '') {\n // Convert a boolean\n if (typeof value === 'boolean')\n datatype = xsd.boolean;\n // Convert an integer or double\n else if (typeof value === 'number') {\n if (Number.isFinite(value))\n datatype = Number.isInteger(value) ? xsd.integer : xsd.double;\n else {\n datatype = xsd.double;\n if (!Number.isNaN(value))\n value = value > 0 ? 'INF' : '-INF';\n }\n }\n }\n\n // Create a datatyped literal\n return (datatype === '' || datatype === xsd.string) ?\n new Literal(`\"${value}\"`) :\n new Literal(`\"${value}\"^^${datatype}`);\n}\n\n// ### Creates a variable\nfunction variable(name) {\n return new Variable(name);\n}\n\n// ### Returns the default graph\nfunction defaultGraph() {\n return DEFAULTGRAPH;\n}\n\n// ### Creates a quad\nfunction quad(subject, predicate, object, graph) {\n return new Quad(subject, predicate, object, graph);\n}\n","// **N3Parser** parses N3 documents.\nimport N3Lexer from './N3Lexer';\nimport N3DataFactory from './N3DataFactory';\nimport namespaces from './IRIs';\n\nlet blankNodePrefix = 0;\n\n// ## Constructor\nexport default class N3Parser {\n constructor(options) {\n this._contextStack = [];\n this._graph = null;\n\n // Set the document IRI\n options = options || {};\n this._setBase(options.baseIRI);\n options.factory && initDataFactory(this, options.factory);\n\n // Set supported features depending on the format\n const format = (typeof options.format === 'string') ?\n options.format.match(/\\w*$/)[0].toLowerCase() : '',\n isTurtle = /turtle/.test(format), isTriG = /trig/.test(format),\n isNTriples = /triple/.test(format), isNQuads = /quad/.test(format),\n isN3 = this._n3Mode = /n3/.test(format),\n isLineMode = isNTriples || isNQuads;\n if (!(this._supportsNamedGraphs = !(isTurtle || isN3)))\n this._readPredicateOrNamedGraph = this._readPredicate;\n // Support triples in other graphs\n this._supportsQuads = !(isTurtle || isTriG || isNTriples || isN3);\n // Support nesting of triples\n this._supportsRDFStar = format === '' || /star|\\*$/.test(format);\n // Disable relative IRIs in N-Triples or N-Quads mode\n if (isLineMode)\n this._resolveRelativeIRI = iri => { return null; };\n this._blankNodePrefix = typeof options.blankNodePrefix !== 'string' ? '' :\n options.blankNodePrefix.replace(/^(?!_:)/, '_:');\n this._lexer = options.lexer || new N3Lexer({ lineMode: isLineMode, n3: isN3 });\n // Disable explicit quantifiers by default\n this._explicitQuantifiers = !!options.explicitQuantifiers;\n }\n\n // ## Static class methods\n\n // ### `_resetBlankNodePrefix` restarts blank node prefix identification\n static _resetBlankNodePrefix() {\n blankNodePrefix = 0;\n }\n\n // ## Private methods\n\n // ### `_setBase` sets the base IRI to resolve relative IRIs\n _setBase(baseIRI) {\n if (!baseIRI) {\n this._base = '';\n this._basePath = '';\n }\n else {\n // Remove fragment if present\n const fragmentPos = baseIRI.indexOf('#');\n if (fragmentPos >= 0)\n baseIRI = baseIRI.substr(0, fragmentPos);\n // Set base IRI and its components\n this._base = baseIRI;\n this._basePath = baseIRI.indexOf('/') < 0 ? baseIRI :\n baseIRI.replace(/[^\\/?]*(?:\\?.*)?$/, '');\n baseIRI = baseIRI.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\\/\\/[^\\/]*)?/i);\n this._baseRoot = baseIRI[0];\n this._baseScheme = baseIRI[1];\n }\n }\n\n // ### `_saveContext` stores the current parsing context\n // when entering a new scope (list, blank node, formula)\n _saveContext(type, graph, subject, predicate, object) {\n const n3Mode = this._n3Mode;\n this._contextStack.push({\n type,\n subject, predicate, object, graph,\n inverse: n3Mode ? this._inversePredicate : false,\n blankPrefix: n3Mode ? this._prefixes._ : '',\n quantified: n3Mode ? this._quantified : null,\n });\n // The settings below only apply to N3 streams\n if (n3Mode) {\n // Every new scope resets the predicate direction\n this._inversePredicate = false;\n // In N3, blank nodes are scoped to a formula\n // (using a dot as separator, as a blank node label cannot start with it)\n this._prefixes._ = (this._graph ? `${this._graph.value}.` : '.');\n // Quantifiers are scoped to a formula\n this._quantified = Object.create(this._quantified);\n }\n }\n\n // ### `_restoreContext` restores the parent context\n // when leaving a scope (list, blank node, formula)\n _restoreContext(type, token) {\n // Obtain the previous context\n const context = this._contextStack.pop();\n if (!context || context.type !== type)\n return this._error(`Unexpected ${token.type}`, token);\n\n // Restore the quad of the previous context\n this._subject = context.subject;\n this._predicate = context.predicate;\n this._object = context.object;\n this._graph = context.graph;\n\n // Restore N3 context settings\n if (this._n3Mode) {\n this._inversePredicate = context.inverse;\n this._prefixes._ = context.blankPrefix;\n this._quantified = context.quantified;\n }\n }\n\n // ### `_readInTopContext` reads a token when in the top context\n _readInTopContext(token) {\n switch (token.type) {\n // If an EOF token arrives in the top context, signal that we're done\n case 'eof':\n if (this._graph !== null)\n return this._error('Unclosed graph', token);\n delete this._prefixes._;\n return this._callback(null, null, this._prefixes);\n // It could be a prefix declaration\n case 'PREFIX':\n this._sparqlStyle = true;\n case '@prefix':\n return this._readPrefix;\n // It could be a base declaration\n case 'BASE':\n this._sparqlStyle = true;\n case '@base':\n return this._readBaseIRI;\n // It could be a graph\n case '{':\n if (this._supportsNamedGraphs) {\n this._graph = '';\n this._subject = null;\n return this._readSubject;\n }\n case 'GRAPH':\n if (this._supportsNamedGraphs)\n return this._readNamedGraphLabel;\n // Otherwise, the next token must be a subject\n default:\n return this._readSubject(token);\n }\n }\n\n // ### `_readEntity` reads an IRI, prefixed name, blank node, or variable\n _readEntity(token, quantifier) {\n let value;\n switch (token.type) {\n // Read a relative or absolute IRI\n case 'IRI':\n case 'typeIRI':\n const iri = this._resolveIRI(token.value);\n if (iri === null)\n return this._error('Invalid IRI', token);\n value = this._namedNode(iri);\n break;\n // Read a prefixed name\n case 'type':\n case 'prefixed':\n const prefix = this._prefixes[token.prefix];\n if (prefix === undefined)\n return this._error(`Undefined prefix \"${token.prefix}:\"`, token);\n value = this._namedNode(prefix + token.value);\n break;\n // Read a blank node\n case 'blank':\n value = this._blankNode(this._prefixes[token.prefix] + token.value);\n break;\n // Read a variable\n case 'var':\n value = this._variable(token.value.substr(1));\n break;\n // Everything else is not an entity\n default:\n return this._error(`Expected entity but got ${token.type}`, token);\n }\n // In N3 mode, replace the entity if it is quantified\n if (!quantifier && this._n3Mode && (value.id in this._quantified))\n value = this._quantified[value.id];\n return value;\n }\n\n // ### `_readSubject` reads a quad's subject\n _readSubject(token) {\n this._predicate = null;\n switch (token.type) {\n case '[':\n // Start a new quad with a new blank node as subject\n this._saveContext('blank', this._graph,\n this._subject = this._blankNode(), null, null);\n return this._readBlankNodeHead;\n case '(':\n // Start a new list\n this._saveContext('list', this._graph, this.RDF_NIL, null, null);\n this._subject = null;\n return this._readListItem;\n case '{':\n // Start a new formula\n if (!this._n3Mode)\n return this._error('Unexpected graph', token);\n this._saveContext('formula', this._graph,\n this._graph = this._blankNode(), null, null);\n return this._readSubject;\n case '}':\n // No subject; the graph in which we are reading is closed instead\n return this._readPunctuation(token);\n case '@forSome':\n if (!this._n3Mode)\n return this._error('Unexpected \"@forSome\"', token);\n this._subject = null;\n this._predicate = this.N3_FORSOME;\n this._quantifier = this._blankNode;\n return this._readQuantifierList;\n case '@forAll':\n if (!this._n3Mode)\n return this._error('Unexpected \"@forAll\"', token);\n this._subject = null;\n this._predicate = this.N3_FORALL;\n this._quantifier = this._variable;\n return this._readQuantifierList;\n case 'literal':\n if (!this._n3Mode)\n return this._error('Unexpected literal', token);\n\n if (token.prefix.length === 0) {\n this._literalValue = token.value;\n return this._completeSubjectLiteral;\n }\n else\n this._subject = this._literal(token.value, this._namedNode(token.prefix));\n\n break;\n case '<<':\n if (!this._supportsRDFStar)\n return this._error('Unexpected RDF* syntax', token);\n this._saveContext('<<', this._graph, null, null, null);\n this._graph = null;\n return this._readSubject;\n default:\n // Read the subject entity\n if ((this._subject = this._readEntity(token)) === undefined)\n return;\n // In N3 mode, the subject might be a path\n if (this._n3Mode)\n return this._getPathReader(this._readPredicateOrNamedGraph);\n }\n\n // The next token must be a predicate,\n // or, if the subject was actually a graph IRI, a named graph\n return this._readPredicateOrNamedGraph;\n }\n\n // ### `_readPredicate` reads a quad's predicate\n _readPredicate(token) {\n const type = token.type;\n switch (type) {\n case 'inverse':\n this._inversePredicate = true;\n case 'abbreviation':\n this._predicate = this.ABBREVIATIONS[token.value];\n break;\n case '.':\n case ']':\n case '}':\n // Expected predicate didn't come, must have been trailing semicolon\n if (this._predicate === null)\n return this._error(`Unexpected ${type}`, token);\n this._subject = null;\n return type === ']' ? this._readBlankNodeTail(token) : this._readPunctuation(token);\n case ';':\n // Additional semicolons can be safely ignored\n return this._predicate !== null ? this._readPredicate :\n this._error('Expected predicate but got ;', token);\n case '[':\n if (this._n3Mode) {\n // Start a new quad with a new blank node as subject\n this._saveContext('blank', this._graph, this._subject,\n this._subject = this._blankNode(), null);\n return this._readBlankNodeHead;\n }\n case 'blank':\n if (!this._n3Mode)\n return this._error('Disallowed blank node as predicate', token);\n default:\n if ((this._predicate = this._readEntity(token)) === undefined)\n return;\n }\n // The next token must be an object\n return this._readObject;\n }\n\n // ### `_readObject` reads a quad's object\n _readObject(token) {\n switch (token.type) {\n case 'literal':\n // Regular literal, can still get a datatype or language\n if (token.prefix.length === 0) {\n this._literalValue = token.value;\n return this._readDataTypeOrLang;\n }\n // Pre-datatyped string literal (prefix stores the datatype)\n else\n this._object = this._literal(token.value, this._namedNode(token.prefix));\n break;\n case '[':\n // Start a new quad with a new blank node as subject\n this._saveContext('blank', this._graph, this._subject, this._predicate,\n this._subject = this._blankNode());\n return this._readBlankNodeHead;\n case '(':\n // Start a new list\n this._saveContext('list', this._graph, this._subject, this._predicate, this.RDF_NIL);\n this._subject = null;\n return this._readListItem;\n case '{':\n // Start a new formula\n if (!this._n3Mode)\n return this._error('Unexpected graph', token);\n this._saveContext('formula', this._graph, this._subject, this._predicate,\n this._graph = this._blankNode());\n return this._readSubject;\n case '<<':\n if (!this._supportsRDFStar)\n return this._error('Unexpected RDF* syntax', token);\n this._saveContext('<<', this._graph, this._subject, this._predicate, null);\n this._graph = null;\n return this._readSubject;\n default:\n // Read the object entity\n if ((this._object = this._readEntity(token)) === undefined)\n return;\n // In N3 mode, the object might be a path\n if (this._n3Mode)\n return this._getPathReader(this._getContextEndReader());\n }\n return this._getContextEndReader();\n }\n\n // ### `_readPredicateOrNamedGraph` reads a quad's predicate, or a named graph\n _readPredicateOrNamedGraph(token) {\n return token.type === '{' ? this._readGraph(token) : this._readPredicate(token);\n }\n\n // ### `_readGraph` reads a graph\n _readGraph(token) {\n if (token.type !== '{')\n return this._error(`Expected graph but got ${token.type}`, token);\n // The \"subject\" we read is actually the GRAPH's label\n this._graph = this._subject, this._subject = null;\n return this._readSubject;\n }\n\n // ### `_readBlankNodeHead` reads the head of a blank node\n _readBlankNodeHead(token) {\n if (token.type === ']') {\n this._subject = null;\n return this._readBlankNodeTail(token);\n }\n else {\n this._predicate = null;\n return this._readPredicate(token);\n }\n }\n\n // ### `_readBlankNodeTail` reads the end of a blank node\n _readBlankNodeTail(token) {\n if (token.type !== ']')\n return this._readBlankNodePunctuation(token);\n\n // Store blank node quad\n if (this._subject !== null)\n this._emit(this._subject, this._predicate, this._object, this._graph);\n\n // Restore the parent context containing this blank node\n const empty = this._predicate === null;\n this._restoreContext('blank', token);\n // If the blank node was the object, restore previous context and read punctuation\n if (this._object !== null)\n return this._getContextEndReader();\n // If the blank node was the predicate, continue reading the object\n else if (this._predicate !== null)\n return this._readObject;\n // If the blank node was the subject, continue reading the predicate\n else\n // If the blank node was empty, it could be a named graph label\n return empty ? this._readPredicateOrNamedGraph : this._readPredicateAfterBlank;\n }\n\n // ### `_readPredicateAfterBlank` reads a predicate after an anonymous blank node\n _readPredicateAfterBlank(token) {\n switch (token.type) {\n case '.':\n case '}':\n // No predicate is coming if the triple is terminated here\n this._subject = null;\n return this._readPunctuation(token);\n default:\n return this._readPredicate(token);\n }\n }\n\n // ### `_readListItem` reads items from a list\n _readListItem(token) {\n let item = null, // The item of the list\n list = null, // The list itself\n next = this._readListItem; // The next function to execute\n const previousList = this._subject, // The previous list that contains this list\n stack = this._contextStack, // The stack of parent contexts\n parent = stack[stack.length - 1]; // The parent containing the current list\n\n switch (token.type) {\n case '[':\n // Stack the current list quad and start a new quad with a blank node as subject\n this._saveContext('blank', this._graph,\n list = this._blankNode(), this.RDF_FIRST,\n this._subject = item = this._blankNode());\n next = this._readBlankNodeHead;\n break;\n case '(':\n // Stack the current list quad and start a new list\n this._saveContext('list', this._graph,\n list = this._blankNode(), this.RDF_FIRST, this.RDF_NIL);\n this._subject = null;\n break;\n case ')':\n // Closing the list; restore the parent context\n this._restoreContext('list', token);\n // If this list is contained within a parent list, return the membership quad here.\n // This will be ` rdf:first .`.\n if (stack.length !== 0 && stack[stack.length - 1].type === 'list')\n this._emit(this._subject, this._predicate, this._object, this._graph);\n // Was this list the parent's subject?\n if (this._predicate === null) {\n // The next token is the predicate\n next = this._readPredicate;\n // No list tail if this was an empty list\n if (this._subject === this.RDF_NIL)\n return next;\n }\n // The list was in the parent context's object\n else {\n next = this._getContextEndReader();\n // No list tail if this was an empty list\n if (this._object === this.RDF_NIL)\n return next;\n }\n // Close the list by making the head nil\n list = this.RDF_NIL;\n break;\n case 'literal':\n // Regular literal, can still get a datatype or language\n if (token.prefix.length === 0) {\n this._literalValue = token.value;\n next = this._readListItemDataTypeOrLang;\n }\n // Pre-datatyped string literal (prefix stores the datatype)\n else {\n item = this._literal(token.value, this._namedNode(token.prefix));\n next = this._getContextEndReader();\n }\n break;\n case '{':\n // Start a new formula\n if (!this._n3Mode)\n return this._error('Unexpected graph', token);\n this._saveContext('formula', this._graph, this._subject, this._predicate,\n this._graph = this._blankNode());\n return this._readSubject;\n default:\n if ((item = this._readEntity(token)) === undefined)\n return;\n }\n\n // Create a new blank node if no item head was assigned yet\n if (list === null)\n this._subject = list = this._blankNode();\n\n // Is this the first element of the list?\n if (previousList === null) {\n // This list is either the subject or the object of its parent\n if (parent.predicate === null)\n parent.subject = list;\n else\n parent.object = list;\n }\n else {\n // Continue the previous list with the current list\n this._emit(previousList, this.RDF_REST, list, this._graph);\n }\n // If an item was read, add it to the list\n if (item !== null) {\n // In N3 mode, the item might be a path\n if (this._n3Mode && (token.type === 'IRI' || token.type === 'prefixed')) {\n // Create a new context to add the item's path\n this._saveContext('item', this._graph, list, this.RDF_FIRST, item);\n this._subject = item, this._predicate = null;\n // _readPath will restore the context and output the item\n return this._getPathReader(this._readListItem);\n }\n // Output the item\n this._emit(list, this.RDF_FIRST, item, this._graph);\n }\n return next;\n }\n\n // ### `_readDataTypeOrLang` reads an _optional_ datatype or language\n _readDataTypeOrLang(token) {\n return this._completeObjectLiteral(token, false);\n }\n\n\n // ### `_readListItemDataTypeOrLang` reads an _optional_ datatype or language in a list\n _readListItemDataTypeOrLang(token) {\n return this._completeObjectLiteral(token, true);\n }\n\n // ### `_completeLiteral` completes a literal with an optional datatype or language\n _completeLiteral(token) {\n // Create a simple string literal by default\n let literal = this._literal(this._literalValue);\n\n switch (token.type) {\n // Create a datatyped literal\n case 'type':\n case 'typeIRI':\n const datatype = this._readEntity(token);\n if (datatype === undefined) return; // No datatype means an error occurred\n literal = this._literal(this._literalValue, datatype);\n token = null;\n break;\n // Create a language-tagged string\n case 'langcode':\n literal = this._literal(this._literalValue, token.value);\n token = null;\n break;\n }\n\n return { token, literal };\n }\n\n // Completes a literal in subject position\n _completeSubjectLiteral(token) {\n this._subject = this._completeLiteral(token).literal;\n return this._readPredicateOrNamedGraph;\n }\n\n // Completes a literal in object position\n _completeObjectLiteral(token, listItem) {\n const completed = this._completeLiteral(token);\n if (!completed)\n return;\n this._object = completed.literal;\n\n // If this literal was part of a list, write the item\n // (we could also check the context stack, but passing in a flag is faster)\n if (listItem)\n this._emit(this._subject, this.RDF_FIRST, this._object, this._graph);\n // If the token was consumed, continue with the rest of the input\n if (completed.token === null)\n return this._getContextEndReader();\n // Otherwise, consume the token now\n else {\n this._readCallback = this._getContextEndReader();\n return this._readCallback(completed.token);\n }\n }\n\n // ### `_readFormulaTail` reads the end of a formula\n _readFormulaTail(token) {\n if (token.type !== '}')\n return this._readPunctuation(token);\n\n // Store the last quad of the formula\n if (this._subject !== null)\n this._emit(this._subject, this._predicate, this._object, this._graph);\n\n // Restore the parent context containing this formula\n this._restoreContext('formula', token);\n // If the formula was the subject, continue reading the predicate.\n // If the formula was the object, read punctuation.\n return this._object === null ? this._readPredicate : this._getContextEndReader();\n }\n\n // ### `_readPunctuation` reads punctuation between quads or quad parts\n _readPunctuation(token) {\n let next, graph = this._graph;\n const subject = this._subject, inversePredicate = this._inversePredicate;\n switch (token.type) {\n // A closing brace ends a graph\n case '}':\n if (this._graph === null)\n return this._error('Unexpected graph closing', token);\n if (this._n3Mode)\n return this._readFormulaTail(token);\n this._graph = null;\n // A dot just ends the statement, without sharing anything with the next\n case '.':\n this._subject = null;\n next = this._contextStack.length ? this._readSubject : this._readInTopContext;\n if (inversePredicate) this._inversePredicate = false;\n break;\n // Semicolon means the subject is shared; predicate and object are different\n case ';':\n next = this._readPredicate;\n break;\n // Comma means both the subject and predicate are shared; the object is different\n case ',':\n next = this._readObject;\n break;\n // {| means that the current triple is annotated with predicate-object pairs.\n case '{|':\n if (!this._supportsRDFStar)\n return this._error('Unexpected RDF* syntax', token);\n // Continue using the last triple as quoted triple subject for the predicate-object pairs.\n const predicate = this._predicate, object = this._object;\n this._subject = this._quad(subject, predicate, object, this.DEFAULTGRAPH);\n next = this._readPredicate;\n break;\n // |} means that the current quoted triple in annotation syntax is finalized.\n case '|}':\n if (this._subject.termType !== 'Quad')\n return this._error('Unexpected asserted triple closing', token);\n this._subject = null;\n next = this._readPunctuation;\n break;\n default:\n // An entity means this is a quad (only allowed if not already inside a graph)\n if (this._supportsQuads && this._graph === null && (graph = this._readEntity(token)) !== undefined) {\n next = this._readQuadPunctuation;\n break;\n }\n return this._error(`Expected punctuation to follow \"${this._object.id}\"`, token);\n }\n // A quad has been completed now, so return it\n if (subject !== null) {\n const predicate = this._predicate, object = this._object;\n if (!inversePredicate)\n this._emit(subject, predicate, object, graph);\n else\n this._emit(object, predicate, subject, graph);\n }\n return next;\n }\n\n // ### `_readBlankNodePunctuation` reads punctuation in a blank node\n _readBlankNodePunctuation(token) {\n let next;\n switch (token.type) {\n // Semicolon means the subject is shared; predicate and object are different\n case ';':\n next = this._readPredicate;\n break;\n // Comma means both the subject and predicate are shared; the object is different\n case ',':\n next = this._readObject;\n break;\n default:\n return this._error(`Expected punctuation to follow \"${this._object.id}\"`, token);\n }\n // A quad has been completed now, so return it\n this._emit(this._subject, this._predicate, this._object, this._graph);\n return next;\n }\n\n // ### `_readQuadPunctuation` reads punctuation after a quad\n _readQuadPunctuation(token) {\n if (token.type !== '.')\n return this._error('Expected dot to follow quad', token);\n return this._readInTopContext;\n }\n\n // ### `_readPrefix` reads the prefix of a prefix declaration\n _readPrefix(token) {\n if (token.type !== 'prefix')\n return this._error('Expected prefix to follow @prefix', token);\n this._prefix = token.value;\n return this._readPrefixIRI;\n }\n\n // ### `_readPrefixIRI` reads the IRI of a prefix declaration\n _readPrefixIRI(token) {\n if (token.type !== 'IRI')\n return this._error(`Expected IRI to follow prefix \"${this._prefix}:\"`, token);\n const prefixNode = this._readEntity(token);\n this._prefixes[this._prefix] = prefixNode.value;\n this._prefixCallback(this._prefix, prefixNode);\n return this._readDeclarationPunctuation;\n }\n\n // ### `_readBaseIRI` reads the IRI of a base declaration\n _readBaseIRI(token) {\n const iri = token.type === 'IRI' && this._resolveIRI(token.value);\n if (!iri)\n return this._error('Expected valid IRI to follow base declaration', token);\n this._setBase(iri);\n return this._readDeclarationPunctuation;\n }\n\n // ### `_readNamedGraphLabel` reads the label of a named graph\n _readNamedGraphLabel(token) {\n switch (token.type) {\n case 'IRI':\n case 'blank':\n case 'prefixed':\n return this._readSubject(token), this._readGraph;\n case '[':\n return this._readNamedGraphBlankLabel;\n default:\n return this._error('Invalid graph label', token);\n }\n }\n\n // ### `_readNamedGraphLabel` reads a blank node label of a named graph\n _readNamedGraphBlankLabel(token) {\n if (token.type !== ']')\n return this._error('Invalid graph label', token);\n this._subject = this._blankNode();\n return this._readGraph;\n }\n\n // ### `_readDeclarationPunctuation` reads the punctuation of a declaration\n _readDeclarationPunctuation(token) {\n // SPARQL-style declarations don't have punctuation\n if (this._sparqlStyle) {\n this._sparqlStyle = false;\n return this._readInTopContext(token);\n }\n\n if (token.type !== '.')\n return this._error('Expected declaration to end with a dot', token);\n return this._readInTopContext;\n }\n\n // Reads a list of quantified symbols from a @forSome or @forAll statement\n _readQuantifierList(token) {\n let entity;\n switch (token.type) {\n case 'IRI':\n case 'prefixed':\n if ((entity = this._readEntity(token, true)) !== undefined)\n break;\n default:\n return this._error(`Unexpected ${token.type}`, token);\n }\n // Without explicit quantifiers, map entities to a quantified entity\n if (!this._explicitQuantifiers)\n this._quantified[entity.id] = this._quantifier(this._blankNode().value);\n // With explicit quantifiers, output the reified quantifier\n else {\n // If this is the first item, start a new quantifier list\n if (this._subject === null)\n this._emit(this._graph || this.DEFAULTGRAPH, this._predicate,\n this._subject = this._blankNode(), this.QUANTIFIERS_GRAPH);\n // Otherwise, continue the previous list\n else\n this._emit(this._subject, this.RDF_REST,\n this._subject = this._blankNode(), this.QUANTIFIERS_GRAPH);\n // Output the list item\n this._emit(this._subject, this.RDF_FIRST, entity, this.QUANTIFIERS_GRAPH);\n }\n return this._readQuantifierPunctuation;\n }\n\n // Reads punctuation from a @forSome or @forAll statement\n _readQuantifierPunctuation(token) {\n // Read more quantifiers\n if (token.type === ',')\n return this._readQuantifierList;\n // End of the quantifier list\n else {\n // With explicit quantifiers, close the quantifier list\n if (this._explicitQuantifiers) {\n this._emit(this._subject, this.RDF_REST, this.RDF_NIL, this.QUANTIFIERS_GRAPH);\n this._subject = null;\n }\n // Read a dot\n this._readCallback = this._getContextEndReader();\n return this._readCallback(token);\n }\n }\n\n // ### `_getPathReader` reads a potential path and then resumes with the given function\n _getPathReader(afterPath) {\n this._afterPath = afterPath;\n return this._readPath;\n }\n\n // ### `_readPath` reads a potential path\n _readPath(token) {\n switch (token.type) {\n // Forward path\n case '!': return this._readForwardPath;\n // Backward path\n case '^': return this._readBackwardPath;\n // Not a path; resume reading where we left off\n default:\n const stack = this._contextStack, parent = stack.length && stack[stack.length - 1];\n // If we were reading a list item, we still need to output it\n if (parent && parent.type === 'item') {\n // The list item is the remaining subejct after reading the path\n const item = this._subject;\n // Switch back to the context of the list\n this._restoreContext('item', token);\n // Output the list item\n this._emit(this._subject, this.RDF_FIRST, item, this._graph);\n }\n return this._afterPath(token);\n }\n }\n\n // ### `_readForwardPath` reads a '!' path\n _readForwardPath(token) {\n let subject, predicate;\n const object = this._blankNode();\n // The next token is the predicate\n if ((predicate = this._readEntity(token)) === undefined)\n return;\n // If we were reading a subject, replace the subject by the path's object\n if (this._predicate === null)\n subject = this._subject, this._subject = object;\n // If we were reading an object, replace the subject by the path's object\n else\n subject = this._object, this._object = object;\n // Emit the path's current quad and read its next section\n this._emit(subject, predicate, object, this._graph);\n return this._readPath;\n }\n\n // ### `_readBackwardPath` reads a '^' path\n _readBackwardPath(token) {\n const subject = this._blankNode();\n let predicate, object;\n // The next token is the predicate\n if ((predicate = this._readEntity(token)) === undefined)\n return;\n // If we were reading a subject, replace the subject by the path's subject\n if (this._predicate === null)\n object = this._subject, this._subject = subject;\n // If we were reading an object, replace the subject by the path's subject\n else\n object = this._object, this._object = subject;\n // Emit the path's current quad and read its next section\n this._emit(subject, predicate, object, this._graph);\n return this._readPath;\n }\n\n // ### `_readRDFStarTailOrGraph` reads the graph of a nested RDF* quad or the end of a nested RDF* triple\n _readRDFStarTailOrGraph(token) {\n if (token.type !== '>>') {\n // An entity means this is a quad (only allowed if not already inside a graph)\n if (this._supportsQuads && this._graph === null && (this._graph = this._readEntity(token)) !== undefined)\n return this._readRDFStarTail;\n return this._error(`Expected >> to follow \"${this._object.id}\"`, token);\n }\n return this._readRDFStarTail(token);\n }\n\n // ### `_readRDFStarTail` reads the end of a nested RDF* triple\n _readRDFStarTail(token) {\n if (token.type !== '>>')\n return this._error(`Expected >> but got ${token.type}`, token);\n // Read the quad and restore the previous context\n const quad = this._quad(this._subject, this._predicate, this._object,\n this._graph || this.DEFAULTGRAPH);\n this._restoreContext('<<', token);\n // If the triple was the subject, continue by reading the predicate.\n if (this._subject === null) {\n this._subject = quad;\n return this._readPredicate;\n }\n // If the triple was the object, read context end.\n else {\n this._object = quad;\n return this._getContextEndReader();\n }\n }\n\n // ### `_getContextEndReader` gets the next reader function at the end of a context\n _getContextEndReader() {\n const contextStack = this._contextStack;\n if (!contextStack.length)\n return this._readPunctuation;\n\n switch (contextStack[contextStack.length - 1].type) {\n case 'blank':\n return this._readBlankNodeTail;\n case 'list':\n return this._readListItem;\n case 'formula':\n return this._readFormulaTail;\n case '<<':\n return this._readRDFStarTailOrGraph;\n }\n }\n\n // ### `_emit` sends a quad through the callback\n _emit(subject, predicate, object, graph) {\n this._callback(null, this._quad(subject, predicate, object, graph || this.DEFAULTGRAPH));\n }\n\n // ### `_error` emits an error message through the callback\n _error(message, token) {\n const err = new Error(`${message} on line ${token.line}.`);\n err.context = {\n token: token,\n line: token.line,\n previousToken: this._lexer.previousToken,\n };\n this._callback(err);\n this._callback = noop;\n }\n\n // ### `_resolveIRI` resolves an IRI against the base path\n _resolveIRI(iri) {\n return /^[a-z][a-z0-9+.-]*:/i.test(iri) ? iri : this._resolveRelativeIRI(iri);\n }\n\n // ### `_resolveRelativeIRI` resolves an IRI against the base path,\n // assuming that a base path has been set and that the IRI is indeed relative\n _resolveRelativeIRI(iri) {\n // An empty relative IRI indicates the base IRI\n if (!iri.length)\n return this._base;\n // Decide resolving strategy based in the first character\n switch (iri[0]) {\n // Resolve relative fragment IRIs against the base IRI\n case '#': return this._base + iri;\n // Resolve relative query string IRIs by replacing the query string\n case '?': return this._base.replace(/(?:\\?.*)?$/, iri);\n // Resolve root-relative IRIs at the root of the base IRI\n case '/':\n // Resolve scheme-relative IRIs to the scheme\n return (iri[1] === '/' ? this._baseScheme : this._baseRoot) + this._removeDotSegments(iri);\n // Resolve all other IRIs at the base IRI's path\n default:\n // Relative IRIs cannot contain a colon in the first path segment\n return (/^[^/:]*:/.test(iri)) ? null : this._removeDotSegments(this._basePath + iri);\n }\n }\n\n // ### `_removeDotSegments` resolves './' and '../' path segments in an IRI as per RFC3986\n _removeDotSegments(iri) {\n // Don't modify the IRI if it does not contain any dot segments\n if (!/(^|\\/)\\.\\.?($|[/#?])/.test(iri))\n return iri;\n\n // Start with an imaginary slash before the IRI in order to resolve trailing './' and '../'\n const length = iri.length;\n let result = '', i = -1, pathStart = -1, segmentStart = 0, next = '/';\n\n while (i < length) {\n switch (next) {\n // The path starts with the first slash after the authority\n case ':':\n if (pathStart < 0) {\n // Skip two slashes before the authority\n if (iri[++i] === '/' && iri[++i] === '/')\n // Skip to slash after the authority\n while ((pathStart = i + 1) < length && iri[pathStart] !== '/')\n i = pathStart;\n }\n break;\n // Don't modify a query string or fragment\n case '?':\n case '#':\n i = length;\n break;\n // Handle '/.' or '/..' path segments\n case '/':\n if (iri[i + 1] === '.') {\n next = iri[++i + 1];\n switch (next) {\n // Remove a '/.' segment\n case '/':\n result += iri.substring(segmentStart, i - 1);\n segmentStart = i + 1;\n break;\n // Remove a trailing '/.' segment\n case undefined:\n case '?':\n case '#':\n return result + iri.substring(segmentStart, i) + iri.substr(i + 1);\n // Remove a '/..' segment\n case '.':\n next = iri[++i + 1];\n if (next === undefined || next === '/' || next === '?' || next === '#') {\n result += iri.substring(segmentStart, i - 2);\n // Try to remove the parent path from result\n if ((segmentStart = result.lastIndexOf('/')) >= pathStart)\n result = result.substr(0, segmentStart);\n // Remove a trailing '/..' segment\n if (next !== '/')\n return `${result}/${iri.substr(i + 1)}`;\n segmentStart = i + 1;\n }\n }\n }\n }\n next = iri[++i];\n }\n return result + iri.substring(segmentStart);\n }\n\n // ## Public methods\n\n // ### `parse` parses the N3 input and emits each parsed quad through the callback\n parse(input, quadCallback, prefixCallback) {\n // The read callback is the next function to be executed when a token arrives.\n // We start reading in the top context.\n this._readCallback = this._readInTopContext;\n this._sparqlStyle = false;\n this._prefixes = Object.create(null);\n this._prefixes._ = this._blankNodePrefix ? this._blankNodePrefix.substr(2)\n : `b${blankNodePrefix++}_`;\n this._prefixCallback = prefixCallback || noop;\n this._inversePredicate = false;\n this._quantified = Object.create(null);\n\n // Parse synchronously if no quad callback is given\n if (!quadCallback) {\n const quads = [];\n let error;\n this._callback = (e, t) => { e ? (error = e) : t && quads.push(t); };\n this._lexer.tokenize(input).every(token => {\n return this._readCallback = this._readCallback(token);\n });\n if (error) throw error;\n return quads;\n }\n\n // Parse asynchronously otherwise, executing the read callback when a token arrives\n this._callback = quadCallback;\n this._lexer.tokenize(input, (error, token) => {\n if (error !== null)\n this._callback(error), this._callback = noop;\n else if (this._readCallback)\n this._readCallback = this._readCallback(token);\n });\n }\n}\n\n// The empty function\nfunction noop() {}\n\n// Initializes the parser with the given data factory\nfunction initDataFactory(parser, factory) {\n // Set factory methods\n const namedNode = factory.namedNode;\n parser._namedNode = namedNode;\n parser._blankNode = factory.blankNode;\n parser._literal = factory.literal;\n parser._variable = factory.variable;\n parser._quad = factory.quad;\n parser.DEFAULTGRAPH = factory.defaultGraph();\n\n // Set common named nodes\n parser.RDF_FIRST = namedNode(namespaces.rdf.first);\n parser.RDF_REST = namedNode(namespaces.rdf.rest);\n parser.RDF_NIL = namedNode(namespaces.rdf.nil);\n parser.N3_FORALL = namedNode(namespaces.r.forAll);\n parser.N3_FORSOME = namedNode(namespaces.r.forSome);\n parser.ABBREVIATIONS = {\n 'a': namedNode(namespaces.rdf.type),\n '=': namedNode(namespaces.owl.sameAs),\n '>': namedNode(namespaces.log.implies),\n };\n parser.QUANTIFIERS_GRAPH = namedNode('urn:n3:quantifiers');\n}\ninitDataFactory(N3Parser.prototype, N3DataFactory);\n","// RDFa Parser for rdflib.js\n\n// Originally by: Alex Milowski\n// From https://github.com/alexmilowski/green-turtle\n// Converted: timbl 2015-08-25 not yet working\n// Added wrapper: csarven 2016-05-09 working\n\n// RDFaProcessor.prototype = new Object() // Was URIResolver\n\n// RDFaProcessor.prototype.constructor=RDFaProcessor\n\n// options.base = base URI not really an option, shopuld always be set.\n//\n\nimport BlankNode from './blank-node'\nimport Literal from './literal'\nimport NamedNode from './named-node'\nimport * as Uri from './uri'\nimport * as Util from './utils-js'\nimport rdf from './factories/canonical-data-factory'\n\nif (typeof Node === 'undefined') { // @@@@@@ Global. Interface to xmldom.\n var Node = {\n ELEMENT_NODE: 1,\n ATTRIBUTE_NODE: 2,\n TEXT_NODE: 3,\n CDATA_SECTION_NODE: 4,\n ENTITY_REFERENCE_NODE: 5,\n ENTITY_NODE: 6,\n PROCESSING_INSTRUCTION_NODE: 7,\n COMMENT_NODE: 8,\n DOCUMENT_NODE: 9,\n DOCUMENT_TYPE_NODE: 10,\n DOCUMENT_FRAGMENT_NODE: 11,\n NOTATION_NODE: 12\n }\n}\n\nexport default class RDFaProcessor {\n constructor (kb, options) {\n this.options = options || {}\n this.kb = kb\n this.target = options.target || {\n graph: {\n subjects: {},\n prefixes: {},\n terms: {}\n }\n }\n // XXX: Added to track bnodes\n this.blankNodes = []\n // XXX: Added for normalisation\n this.htmlOptions = {\n 'selfClosing': 'br img input area base basefont col colgroup source wbr isindex link meta param hr'\n }\n this.theOne = '_:' + (new Date()).getTime()\n this.language = null\n this.vocabulary = null\n this.blankCounter = 0\n this.langAttributes = [ { namespaceURI: 'http://www.w3.org/XML/1998/namespace', localName: 'lang' } ]\n this.inXHTMLMode = false\n this.absURIRE = /[\\w\\_\\-]+:\\S+/\n this.finishedHandlers = []\n this.init()\n }\n\n addTriple (origin, subject, predicate, object) {\n var su, ob, pr, or\n if (typeof subject === 'undefined') {\n su = rdf.namedNode(this.options.base)\n } else {\n su = this.toRDFNodeObject(subject)\n }\n pr = this.toRDFNodeObject(predicate)\n ob = this.toRDFNodeObject(object)\n or = rdf.namedNode(this.options.base)\n // console.log('Adding { ' + su + ' ' + pr + ' ' + ob + ' ' + or + ' }')\n this.kb.add(su, pr, ob, or)\n }\n\n ancestorPath (node) {\n var path = ''\n while (node && node.nodeType !== Node.DOCUMENT_NODE) {\n path = '/' + node.localName + path\n node = node.parentNode\n }\n return path\n }\n\n copyMappings (mappings) {\n var newMappings = {}\n for (var k in mappings) {\n newMappings[k] = mappings[k]\n }\n return newMappings\n }\n\n copyProperties () {\n }\n\n deriveDateTimeType (value) {\n for (var i = 0; i < RDFaProcessor.dateTimeTypes.length; i++) {\n // console.log(\"Checking \"+value+\" against \"+RDFaProcessor.dateTimeTypes[i].type)\n var matched = RDFaProcessor.dateTimeTypes[i].pattern.exec(value)\n if (matched && matched[0].length === value.length) {\n // console.log(\"Matched!\")\n return RDFaProcessor.dateTimeTypes[i].type\n }\n }\n return null\n }\n\n init () {\n }\n\n newBlankNode () {\n this.blankCounter++\n return '_:' + this.blankCounter\n }\n\n newSubjectOrigin (origin, subject) {\n }\n\n parseCURIE (value, prefixes, base) {\n var colon = value.indexOf(':')\n var uri\n if (colon >= 0) {\n var prefix = value.substring(0, colon)\n if (prefix === '') {\n // default prefix\n uri = prefixes['']\n return uri ? uri + value.substring(colon + 1) : null\n } else if (prefix === '_') {\n // blank node\n return '_:' + value.substring(colon + 1)\n } else if (RDFaProcessor.NCNAME.test(prefix)) {\n uri = prefixes[prefix]\n if (uri) {\n return uri + value.substring(colon + 1)\n }\n }\n }\n return null\n }\n\n parseCURIEOrURI (value, prefixes, base) {\n var curie = this.parseCURIE(value, prefixes, base)\n if (curie) {\n return curie\n }\n return this.resolveAndNormalize(base, value)\n }\n\n parsePredicate (value, defaultVocabulary, terms, prefixes, base,\n ignoreTerms) {\n if (value === '') {\n return null\n }\n var predicate = this.parseTermOrCURIEOrAbsURI(value, defaultVocabulary, ignoreTerms ? null : terms, prefixes, base)\n if (predicate && predicate.indexOf('_:') === 0) {\n return null\n }\n return predicate\n }\n\n parsePrefixMappings (str, target) {\n var values = this.tokenize(str)\n var prefix = null\n // var uri = null\n for (var i = 0; i < values.length; i++) {\n if (values[i][values[i].length - 1] === ':') {\n prefix = values[i].substring(0, values[i].length - 1)\n } else if (prefix) {\n target[prefix] = this.options.base ? Uri.join(values[i], this.options.base) : values[i]\n prefix = null\n }\n }\n }\n\n static parseRDFaDOM (dom, kb, base) {\n var p = new RDFaProcessor(kb, { 'base': base })\n // Cannot assign to read only property 'baseURI' of object '#':\n if (!dom.baseURI) { // Note this became a read-only attribute some time before 2018\n dom.baseURI = base // oinly set if not already set\n }\n p.process(dom, { baseURI: base})\n }\n\n parseSafeCURIEOrCURIEOrURI (value, prefixes, base) {\n value = this.trim(value)\n if (value.charAt(0) === '[' && value.charAt(value.length - 1) === ']') {\n value = value.substring(1, value.length - 1)\n value = value.trim(value)\n if (value.length === 0) {\n return null\n }\n if (value === '_:') {\n // the one node\n return this.theOne\n }\n return this.parseCURIE(value, prefixes, base)\n } else {\n return this.parseCURIEOrURI(value, prefixes, base)\n }\n }\n\n parseTermOrCURIEOrAbsURI (value, defaultVocabulary, terms, prefixes, base) {\n // alert(\"Parsing \"+value+\" with default vocab \"+defaultVocabulary)\n value = this.trim(value)\n var curie = this.parseCURIE(value, prefixes, base)\n if (curie) {\n return curie\n } else if (terms) {\n if (defaultVocabulary && !this.absURIRE.exec(value)) {\n return defaultVocabulary + value\n }\n var term = terms[value]\n if (term) {\n return term\n }\n var lcvalue = value.toLowerCase()\n term = terms[lcvalue]\n if (term) {\n return term\n }\n }\n if (this.absURIRE.exec(value)) {\n return this.resolveAndNormalize(base, value)\n }\n return null\n }\n\n parseTermOrCURIEOrURI (value, defaultVocabulary, terms, prefixes, base) {\n // alert(\"Parsing \"+value+\" with default vocab \"+defaultVocabulary)\n value = this.trim(value)\n var curie = this.parseCURIE(value, prefixes, base)\n if (curie) {\n return curie\n } else {\n var term = terms[value]\n if (term) {\n return term\n }\n var lcvalue = value.toLowerCase()\n term = terms[lcvalue]\n if (term) {\n return term\n }\n if (defaultVocabulary && !this.absURIRE.exec(value)) {\n return defaultVocabulary + value\n }\n }\n return this.resolveAndNormalize(base, value)\n }\n\n parseURI (uri) {\n return uri // We just use strings as URIs, not objects now.\n }\n\n process (node, options) {\n /*\n if (!window.console) {\n window.console = { log: function() {} }\n } */\n options = options || {}\n var base\n if (node.nodeType === Node.DOCUMENT_NODE) {\n if (node.baseURI && !options.baseURI) {\n options.baseURI = node.baseURI // be defensive as DOM implementations vary\n }\n base = node.baseURI\n node = node.documentElement\n if (!node.baseURI) {\n node.baseURI = base\n }\n this.setContext(node)\n } else if (node.parentNode.nodeType === Node.DOCUMENT_NODE) {\n this.setContext(node)\n }\n var queue = []\n // Fix for Firefox that includes the hash in the base URI\n var removeHash = function (baseURI) {\n // Fix for undefined baseURI property\n if (!baseURI && options && options.baseURI) {\n return options.baseURI\n }\n\n var hash = baseURI.indexOf('#')\n if (hash >= 0) {\n baseURI = baseURI.substring(0, hash)\n }\n if (options && options.baseURIMap) {\n baseURI = options.baseURIMap(baseURI)\n }\n return baseURI\n }\n queue.push({ current: node,\n context: this.push(null, removeHash(node.baseURI))\n })\n while (queue.length > 0) {\n var item = queue.shift()\n if (item.parent) {\n // Sequence Step 14: list triple generation\n if (item.context.parent && item.context.parent.listMapping === item.listMapping) {\n // Skip a child context with exactly the same mapping\n continue\n }\n // console.log(\"Generating lists for \"+item.subject+\", tag \"+item.parent.localName)\n for (let predicate in item.listMapping) {\n var list = item.listMapping[predicate]\n if (list.length === 0) {\n this.addTriple(item.parent, item.subject, predicate, { type: RDFaProcessor.objectURI, value: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil' })\n continue\n }\n var bnodes = []\n for (let i = 0; i < list.length; i++) {\n bnodes.push(this.newBlankNode())\n // this.newSubject(item.parent,bnodes[i])\n }\n for (let i = 0; i < bnodes.length; i++) {\n this.addTriple(item.parent, bnodes[i], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', list[i])\n this.addTriple(item.parent, bnodes[i], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', { type: RDFaProcessor.objectURI, value: (i + 1) < bnodes.length ? bnodes[i + 1] : 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil' })\n }\n this.addTriple(item.parent, item.subject, predicate, { type: RDFaProcessor.objectURI, value: bnodes[0] })\n }\n continue\n }\n var current = item.current\n var context = item.context\n // console.log(\"Tag: \"+current.localName+\", listMapping=\"+JSON.stringify(context.listMapping))\n // Sequence Step 1\n var skip = false\n var newSubject = null\n var currentObjectResource = null\n var typedResource = null\n var prefixes = context.prefixes\n var prefixesCopied = false\n var incomplete = []\n var listMapping = context.listMapping\n var listMappingDifferent = !context.parent\n var language = context.language\n var vocabulary = context.vocabulary\n // TODO: the \"base\" element may be used for HTML+RDFa 1.1\n base = this.parseURI(removeHash(current.baseURI))\n current.item = null\n // Sequence Step 2: set the default vocabulary\n var vocabAtt = current.getAttributeNode('vocab')\n if (vocabAtt) {\n let value = this.trim(vocabAtt.value)\n if (value.length > 0) {\n vocabulary = value\n var baseSubject = base.spec\n // this.newSubject(current,baseSubject)\n this.addTriple(current, baseSubject, 'http://www.w3.org/ns/rdfa#usesVocabulary', { type: RDFaProcessor.objectURI, value: vocabulary })\n } else {\n vocabulary = this.vocabulary\n }\n }\n // Sequence Step 3: IRI mappings\n // handle xmlns attributes\n for (var i = 0; i < current.attributes.length; i++) {\n var att = current.attributes[i]\n // if (att.namespaceURI==\"http://www.w3.org/2000/xmlns/\") {\n if (att.nodeName.charAt(0) === 'x' && att.nodeName.indexOf('xmlns:') === 0) {\n if (!prefixesCopied) {\n prefixes = this.copyMappings(prefixes)\n prefixesCopied = true\n }\n var prefix = att.nodeName.substring(6)\n // TODO: resolve relative?\n var ref = RDFaProcessor.trim(att.value)\n prefixes[prefix] = this.options.base ? Uri.join(ref, this.options.base) : ref\n }\n }\n // Handle prefix mappings (@prefix)\n var prefixAtt = current.getAttributeNode('prefix')\n if (prefixAtt) {\n if (!prefixesCopied) {\n prefixes = this.copyMappings(prefixes)\n prefixesCopied = true\n }\n this.parsePrefixMappings(prefixAtt.value, prefixes)\n }\n // Sequence Step 4: language\n var xmlLangAtt = null\n for (let i = 0; !xmlLangAtt && i < this.langAttributes.length; i++) {\n xmlLangAtt = current.getAttributeNodeNS(this.langAttributes[i].namespaceURI, this.langAttributes[i].localName)\n }\n if (xmlLangAtt) {\n let value = RDFaProcessor.trim(xmlLangAtt.value)\n if (value.length > 0) {\n language = value\n } else {\n language = null\n }\n }\n var relAtt = current.getAttributeNode('rel')\n var revAtt = current.getAttributeNode('rev')\n var typeofAtt = current.getAttributeNode('typeof')\n var propertyAtt = current.getAttributeNode('property')\n var datatypeAtt = current.getAttributeNode('datatype')\n var datetimeAtt = this.inHTMLMode\n ? current.getAttributeNode('datetime')\n : null\n var contentAtt = current.getAttributeNode('content')\n var aboutAtt = current.getAttributeNode('about')\n var srcAtt = current.getAttributeNode('src')\n var resourceAtt = current.getAttributeNode('resource')\n var hrefAtt = current.getAttributeNode('href')\n var inlistAtt = current.getAttributeNode('inlist')\n var relAttPredicates = []\n var predicate, values\n if (relAtt) {\n values = this.tokenize(relAtt.value)\n for (let i = 0; i < values.length; i++) {\n predicate = this.parsePredicate(values[i], vocabulary, context.terms, prefixes, base, this.inHTMLMode && propertyAtt !== null)\n if (predicate) {\n relAttPredicates.push(predicate)\n }\n }\n }\n var revAttPredicates = []\n if (revAtt) {\n values = this.tokenize(revAtt.value)\n for (let i = 0; i < values.length; i++) {\n predicate = this.parsePredicate(values[i], vocabulary, context.terms, prefixes, base, this.inHTMLMode && propertyAtt)\n if (predicate) {\n revAttPredicates.push(predicate)\n }\n }\n }\n // Section 3.1, bullet 7\n if (this.inHTMLMode && (relAtt || revAtt) && propertyAtt) {\n if (relAttPredicates.length === 0) {\n relAtt = null\n }\n if (revAttPredicates.length === 0) {\n revAtt = null\n }\n }\n if (relAtt || revAtt) {\n // Sequence Step 6: establish new subject and value\n if (aboutAtt) {\n newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base)\n }\n if (typeofAtt) {\n typedResource = newSubject\n }\n if (!newSubject) {\n if (current.parentNode.nodeType === Node.DOCUMENT_NODE) {\n newSubject = removeHash(current.baseURI)\n } else if (context.parentObject) {\n // TODO: Verify: If the xml:base has been set and the parentObject is the baseURI of the parent, then the subject needs to be the new base URI\n newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject\n }\n }\n if (resourceAtt) {\n currentObjectResource = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base)\n }\n if (!currentObjectResource) {\n if (hrefAtt) {\n currentObjectResource = this.resolveAndNormalize(base, encodeURI(hrefAtt.value))\n } else if (srcAtt) {\n currentObjectResource = this.resolveAndNormalize(base, encodeURI(srcAtt.value))\n } else if (typeofAtt && !aboutAtt && !(this.inXHTMLMode && (current.localName === 'head' || current.localName === 'body'))) {\n currentObjectResource = this.newBlankNode()\n }\n }\n if (typeofAtt && !aboutAtt && this.inXHTMLMode && (current.localName === 'head' || current.localName === 'body')) {\n typedResource = newSubject\n } else if (typeofAtt && !aboutAtt) {\n typedResource = currentObjectResource\n }\n } else if (propertyAtt && !contentAtt && !datatypeAtt) {\n // Sequence Step 5.1: establish a new subject\n if (aboutAtt) {\n newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base)\n if (typeofAtt) {\n typedResource = newSubject\n }\n }\n if (!newSubject && current.parentNode.nodeType === Node.DOCUMENT_NODE) {\n newSubject = removeHash(current.baseURI)\n if (typeofAtt) {\n typedResource = newSubject\n }\n } else if (!newSubject && context.parentObject) {\n // TODO: Verify: If the xml:base has been set and the parentObject is the baseURI of the parent, then the subject needs to be the new base URI\n newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject\n }\n if (typeofAtt && !typedResource) {\n if (resourceAtt) {\n typedResource = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base)\n }\n if (!typedResource && hrefAtt) {\n typedResource = this.resolveAndNormalize(base, encodeURI(hrefAtt.value))\n }\n if (!typedResource && srcAtt) {\n typedResource = this.resolveAndNormalize(base, encodeURI(srcAtt.value))\n }\n if (!typedResource && (this.inXHTMLMode || this.inHTMLMode) && (current.localName === 'head' || current.localName === 'body')) {\n typedResource = newSubject\n }\n if (!typedResource) {\n typedResource = this.newBlankNode()\n }\n currentObjectResource = typedResource\n }\n // console.log(current.localName+\", newSubject=\"+newSubject+\", typedResource=\"+typedResource+\", currentObjectResource=\"+currentObjectResource)\n } else {\n // Sequence Step 5.2: establish a new subject\n if (aboutAtt) {\n newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base)\n }\n if (!newSubject && resourceAtt) {\n newSubject = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base)\n }\n if (!newSubject && hrefAtt) {\n newSubject = this.resolveAndNormalize(base, encodeURI(hrefAtt.value))\n }\n if (!newSubject && srcAtt) {\n newSubject = this.resolveAndNormalize(base, encodeURI(srcAtt.value))\n }\n if (!newSubject) {\n if (current.parentNode.nodeType === Node.DOCUMENT_NODE) {\n newSubject = removeHash(current.baseURI)\n } else if ((this.inXHTMLMode || this.inHTMLMode) && (current.localName === 'head' || current.localName === 'body')) {\n newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject\n } else if (typeofAtt) {\n newSubject = this.newBlankNode()\n } else if (context.parentObject) {\n // TODO: Verify: If the xml:base has been set and the parentObject is the baseURI of the parent, then the subject needs to be the new base URI\n newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject\n if (!propertyAtt) {\n skip = true\n }\n }\n }\n if (typeofAtt) {\n typedResource = newSubject\n }\n }\n // console.log(current.tagName+\": newSubject=\"+newSubject+\", currentObjectResource=\"+currentObjectResource+\", typedResource=\"+typedResource+\", skip=\"+skip)\n // var rdfaData = null\n if (newSubject) {\n // this.newSubject(current,newSubject)\n if (aboutAtt || resourceAtt || typedResource) {\n var id = newSubject\n if (typeofAtt && !aboutAtt && !resourceAtt && currentObjectResource) {\n id = currentObjectResource\n }\n // console.log(\"Setting data attribute for \"+current.localName+\" for subject \"+id)\n this.newSubjectOrigin(current, id)\n }\n }\n // Sequence Step 7: generate type triple\n if (typedResource) {\n values = this.tokenize(typeofAtt.value)\n for (let i = 0; i < values.length; i++) {\n var object = this.parseTermOrCURIEOrAbsURI(values[i], vocabulary, context.terms, prefixes, base)\n if (object) {\n this.addTriple(current, typedResource, RDFaProcessor.typeURI, { type: RDFaProcessor.objectURI, value: object })\n }\n }\n }\n // Sequence Step 8: new list mappings if there is a new subject\n // console.log(\"Step 8: newSubject=\"+newSubject+\", context.parentObject=\"+context.parentObject)\n if (newSubject && newSubject !== context.parentObject) {\n // console.log(\"Generating new list mapping for \"+newSubject)\n listMapping = {}\n listMappingDifferent = true\n }\n // Sequence Step 9: generate object triple\n if (currentObjectResource) {\n if (relAtt && inlistAtt) {\n for (let i = 0; i < relAttPredicates.length; i++) {\n let list = listMapping[relAttPredicates[i]]\n if (!list) {\n list = []\n listMapping[relAttPredicates[i]] = list\n }\n list.push({ type: RDFaProcessor.objectURI, value: currentObjectResource })\n }\n } else if (relAtt) {\n for (let i = 0; i < relAttPredicates.length; i++) {\n this.addTriple(current, newSubject, relAttPredicates[i], { type: RDFaProcessor.objectURI, value: currentObjectResource })\n }\n }\n if (revAtt) {\n for (let i = 0; i < revAttPredicates.length; i++) {\n this.addTriple(current, currentObjectResource, revAttPredicates[i], { type: RDFaProcessor.objectURI, value: newSubject })\n }\n }\n } else {\n // Sequence Step 10: incomplete triples\n if (newSubject && !currentObjectResource && (relAtt || revAtt)) {\n currentObjectResource = this.newBlankNode()\n // alert(current.tagName+\": generated blank node, newSubject=\"+newSubject+\" currentObjectResource=\"+currentObjectResource)\n }\n if (relAtt && inlistAtt) {\n for (let i = 0; i < relAttPredicates.length; i++) {\n let list = listMapping[relAttPredicates[i]]\n if (!list) {\n list = []\n listMapping[predicate] = list\n }\n // console.log(\"Adding incomplete list for \"+predicate)\n incomplete.push({ predicate: relAttPredicates[i], list: list })\n }\n } else if (relAtt) {\n for (let i = 0; i < relAttPredicates.length; i++) {\n incomplete.push({ predicate: relAttPredicates[i], forward: true })\n }\n }\n if (revAtt) {\n for (let i = 0; i < revAttPredicates.length; i++) {\n incomplete.push({ predicate: revAttPredicates[i], forward: false })\n }\n }\n }\n // Step 11: Current property values\n if (propertyAtt) {\n var datatype = null\n var content = null\n if (datatypeAtt) {\n datatype = datatypeAtt.value === '' ? RDFaProcessor.PlainLiteralURI : this.parseTermOrCURIEOrAbsURI(datatypeAtt.value, vocabulary, context.terms, prefixes, base)\n if (datetimeAtt && !contentAtt) {\n content = datetimeAtt.value\n } else {\n content = datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI ? null : (contentAtt ? contentAtt.value : current.textContent)\n }\n } else if (contentAtt) {\n datatype = RDFaProcessor.PlainLiteralURI\n content = contentAtt.value\n } else if (datetimeAtt) {\n content = datetimeAtt.value\n datatype = RDFaProcessor.deriveDateTimeType(content)\n if (!datatype) {\n datatype = RDFaProcessor.PlainLiteralURI\n }\n } else if (!relAtt && !revAtt) {\n if (resourceAtt) {\n content = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base)\n }\n if (!content && hrefAtt) {\n content = this.resolveAndNormalize(base, encodeURI(hrefAtt.value))\n } else if (!content && srcAtt) {\n content = this.resolveAndNormalize(base, encodeURI(srcAtt.value))\n }\n if (content) {\n datatype = RDFaProcessor.objectURI\n }\n }\n if (!datatype) {\n if (typeofAtt && !aboutAtt) {\n datatype = RDFaProcessor.objectURI\n content = typedResource\n } else {\n content = current.textContent\n if (this.inHTMLMode && current.localName === 'time') {\n datatype = RDFaProcessor.deriveDateTimeType(content)\n }\n if (!datatype) {\n datatype = RDFaProcessor.PlainLiteralURI\n }\n }\n }\n values = this.tokenize(propertyAtt.value)\n for (let i = 0; i < values.length; i++) {\n let predicate = this.parsePredicate(values[i], vocabulary, context.terms, prefixes, base)\n if (predicate) {\n if (inlistAtt) {\n let list = listMapping[predicate]\n if (!list) {\n list = []\n listMapping[predicate] = list\n }\n list.push((datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI) ? { type: datatype, value: current.childNodes } : { type: datatype || RDFaProcessor.PlainLiteralURI, value: content, language: language })\n } else {\n if (datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI) {\n this.addTriple(current, newSubject, predicate, { type: datatype, value: current.childNodes })\n } else {\n this.addTriple(current, newSubject, predicate, { type: datatype || RDFaProcessor.PlainLiteralURI, value: content, language: language })\n // console.log(newSubject+\" \"+predicate+\"=\"+content)\n }\n }\n }\n }\n }\n // Sequence Step 12: complete incomplete triples with new subject\n if (newSubject && !skip) {\n for (let i = 0; i < context.incomplete.length; i++) {\n if (context.incomplete[i].list) {\n // console.log(\"Adding subject \"+newSubject+\" to list for \"+context.incomplete[i].predicate)\n // TODO: it is unclear what to do here\n context.incomplete[i].list.push({ type: RDFaProcessor.objectURI, value: newSubject })\n } else if (context.incomplete[i].forward) {\n // console.log(current.tagName+\": completing forward triple \"+context.incomplete[i].predicate+\" with object=\"+newSubject)\n this.addTriple(current, context.subject, context.incomplete[i].predicate, { type: RDFaProcessor.objectURI, value: newSubject })\n } else {\n // console.log(current.tagName+\": completing reverse triple with object=\"+context.subject)\n this.addTriple(current, newSubject, context.incomplete[i].predicate, { type: RDFaProcessor.objectURI, value: context.subject })\n }\n }\n }\n var childContext = null\n var listSubject = newSubject\n if (skip) {\n // TODO: should subject be null?\n childContext = this.push(context, context.subject)\n // TODO: should the entObject be passed along? If not, then intermediary children will keep properties from being associated with incomplete triples.\n // TODO: Verify: if the current baseURI has changed and the parentObject is the parent's base URI, then the baseURI should change\n childContext.parentObject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject\n childContext.incomplete = context.incomplete\n childContext.language = language\n childContext.prefixes = prefixes\n childContext.vocabulary = vocabulary\n } else {\n childContext = this.push(context, newSubject)\n childContext.parentObject = currentObjectResource || (newSubject || context.subject)\n childContext.prefixes = prefixes\n childContext.incomplete = incomplete\n if (currentObjectResource) {\n // console.log(\"Generating new list mapping for \"+currentObjectResource)\n listSubject = currentObjectResource\n listMapping = {}\n listMappingDifferent = true\n }\n childContext.listMapping = listMapping\n childContext.language = language\n childContext.vocabulary = vocabulary\n }\n if (listMappingDifferent) {\n // console.log(\"Pushing list parent \"+current.localName)\n queue.unshift({ parent: current, context: context, subject: listSubject, listMapping: listMapping })\n }\n for (var child = current.lastChild; child; child = child.previousSibling) {\n if (child.nodeType === Node.ELEMENT_NODE) {\n // console.log(\"Pushing child \"+child.localName)\n // child.baseURI = current.baseURI\n queue.unshift({ current: child, context: childContext })\n }\n }\n }\n if (this.inHTMLMode) {\n this.copyProperties()\n }\n for (let i = 0; i < this.finishedHandlers.length; i++) {\n this.finishedHandlers[i](node)\n }\n }\n\n push (parent, subject) {\n return {\n parent: parent,\n subject: subject || (parent ? parent.subject : null),\n parentObject: null,\n incomplete: [],\n listMapping: parent ? parent.listMapping : {},\n language: parent ? parent.language : this.language,\n prefixes: parent ? parent.prefixes : this.target.graph.prefixes,\n terms: parent ? parent.terms : this.target.graph.terms,\n vocabulary: parent ? parent.vocabulary : this.vocabulary\n }\n }\n\n resolveAndNormalize (base, uri) {\n // console.log(\"Joining \" + uri + \" to \" + base + \" making \" + Uri.join(uri, base))\n return Uri.join(uri, base) // @@ normalize?\n }\n\n setContext (node) {\n // We only recognized XHTML+RDFa 1.1 if the version is set propertyly\n if (node.localName === 'html' && node.getAttribute('version') === 'XHTML+RDFa 1.1') {\n this.setXHTMLContext()\n } else if (node.localName === 'html' || node.namespaceURI === 'http://www.w3.org/1999/xhtml') {\n if (typeof document !== 'undefined' && document.doctype) {\n if (document.doctype.publicId === '-//W3C//DTD XHTML+RDFa 1.0//EN' && document.doctype.systemId === 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd') {\n console.log('WARNING: RDF 1.0 is not supported. Defaulting to HTML5 mode.')\n this.setHTMLContext()\n } else if (document.doctype.publicId === '-//W3C//DTD XHTML+RDFa 1.1//EN' && document.doctype.systemId === 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd') {\n this.setXHTMLContext()\n } else {\n this.setHTMLContext()\n }\n } else {\n this.setHTMLContext()\n }\n } else {\n this.setXMLContext()\n }\n }\n\n setHTMLContext () {\n this.setInitialContext()\n this.langAttributes = [\n {\n namespaceURI: 'http://www.w3.org/XML/1998/namespace',\n localName: 'lang'\n },\n { namespaceURI: null, localName: 'lang' }\n ]\n this.inXHTMLMode = false\n this.inHTMLMode = true\n }\n\n setInitialContext () {\n this.vocabulary = null\n // By default, the prefixes are terms are loaded to the RDFa 1.1. standard within the graph constructor\n this.langAttributes = [\n {\n namespaceURI: 'http://www.w3.org/XML/1998/namespace',\n localName: 'lang'\n }\n ]\n }\n\n setXHTMLContext () {\n this.setInitialContext()\n this.inXHTMLMode = true\n this.inHTMLMode = false\n this.langAttributes = [\n {\n namespaceURI: 'http://www.w3.org/XML/1998/namespace',\n localName: 'lang' },\n { namespaceURI: null, localName: 'lang' }\n ]\n // From http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1\n this.target.graph.terms['alternate'] = 'http://www.w3.org/1999/xhtml/vocab#alternate'\n this.target.graph.terms['appendix'] = 'http://www.w3.org/1999/xhtml/vocab#appendix'\n this.target.graph.terms['bookmark'] = 'http://www.w3.org/1999/xhtml/vocab#bookmark'\n this.target.graph.terms['cite'] = 'http://www.w3.org/1999/xhtml/vocab#cite'\n this.target.graph.terms['chapter'] = 'http://www.w3.org/1999/xhtml/vocab#chapter'\n this.target.graph.terms['contents'] = 'http://www.w3.org/1999/xhtml/vocab#contents'\n this.target.graph.terms['copyright'] = 'http://www.w3.org/1999/xhtml/vocab#copyright'\n this.target.graph.terms['first'] = 'http://www.w3.org/1999/xhtml/vocab#first'\n this.target.graph.terms['glossary'] = 'http://www.w3.org/1999/xhtml/vocab#glossary'\n this.target.graph.terms['help'] = 'http://www.w3.org/1999/xhtml/vocab#help'\n this.target.graph.terms['icon'] = 'http://www.w3.org/1999/xhtml/vocab#icon'\n this.target.graph.terms['index'] = 'http://www.w3.org/1999/xhtml/vocab#index'\n this.target.graph.terms['last'] = 'http://www.w3.org/1999/xhtml/vocab#last'\n this.target.graph.terms['license'] = 'http://www.w3.org/1999/xhtml/vocab#license'\n this.target.graph.terms['meta'] = 'http://www.w3.org/1999/xhtml/vocab#meta'\n this.target.graph.terms['next'] = 'http://www.w3.org/1999/xhtml/vocab#next'\n this.target.graph.terms['prev'] = 'http://www.w3.org/1999/xhtml/vocab#prev'\n this.target.graph.terms['previous'] = 'http://www.w3.org/1999/xhtml/vocab#previous'\n this.target.graph.terms['section'] = 'http://www.w3.org/1999/xhtml/vocab#section'\n this.target.graph.terms['stylesheet'] = 'http://www.w3.org/1999/xhtml/vocab#stylesheet'\n this.target.graph.terms['subsection'] = 'http://www.w3.org/1999/xhtml/vocab#subsection'\n this.target.graph.terms['start'] = 'http://www.w3.org/1999/xhtml/vocab#start'\n this.target.graph.terms['top'] = 'http://www.w3.org/1999/xhtml/vocab#top'\n this.target.graph.terms['up'] = 'http://www.w3.org/1999/xhtml/vocab#up'\n this.target.graph.terms['p3pv1'] = 'http://www.w3.org/1999/xhtml/vocab#p3pv1'\n // other\n this.target.graph.terms['related'] = 'http://www.w3.org/1999/xhtml/vocab#related'\n this.target.graph.terms['role'] = 'http://www.w3.org/1999/xhtml/vocab#role'\n this.target.graph.terms['transformation'] = 'http://www.w3.org/1999/xhtml/vocab#transformation'\n }\n\n setXMLContext () {\n this.setInitialContext()\n this.inXHTMLMode = false\n this.inHTMLMode = false\n }\n\n tokenize (str) {\n return this.trim(str).split(/\\s+/)\n }\n static tokenize (str) {\n return this.trim(str).split(/\\s+/)\n }\n\n toRDFNodeObject (x) {\n if (typeof x === 'undefined') return undefined\n if (typeof x === 'string') {\n if (x.substring(0, 2) === '_:') {\n if (typeof this.blankNodes[x.substring(2)] === 'undefined') {\n this.blankNodes[x.substring(2)] = new BlankNode(x.substring(2))\n }\n return this.blankNodes[x.substring(2)]\n }\n return rdf.namedNode(x)\n }\n switch (x.type) {\n case RDFaProcessor.objectURI:\n if (x.value.substring(0, 2) === '_:') {\n if (typeof this.blankNodes[x.value.substring(2)] === 'undefined') {\n this.blankNodes[x.value.substring(2)] = new BlankNode(x.value.substring(2))\n }\n return this.blankNodes[x.value.substring(2)]\n }\n return rdf.namedNode(x.value)\n case RDFaProcessor.PlainLiteralURI:\n return new Literal(x.value, x.language || '')\n case RDFaProcessor.XMLLiteralURI:\n case RDFaProcessor.HTMLLiteralURI:\n var string = ''\n Object.keys(x.value).forEach(i => {\n string += Util.domToString(x.value[i], this.htmlOptions)\n })\n return new Literal(string, '', new NamedNode(x.type))\n default:\n return new Literal(x.value, '', new NamedNode(x.type))\n }\n }\n\n trim (str) {\n return str.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '')\n }\n static trim (str) {\n return str.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '')\n }\n}\n\nRDFaProcessor.XMLLiteralURI =\n 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral'\nRDFaProcessor.HTMLLiteralURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML'\nRDFaProcessor.PlainLiteralURI =\n 'http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral'\nRDFaProcessor.objectURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#object'\nRDFaProcessor.typeURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'\nRDFaProcessor.nameChar =\n '[-A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u10000-\\uEFFFF\\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]'\nRDFaProcessor.nameStartChar =\n '[\\u0041-\\u005A\\u0061-\\u007A\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u00FF\\u0100-\\u0131\\u0134-\\u013E\\u0141-\\u0148\\u014A-\\u017E\\u0180-\\u01C3\\u01CD-\\u01F0\\u01F4-\\u01F5\\u01FA-\\u0217\\u0250-\\u02A8\\u02BB-\\u02C1\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03CE\\u03D0-\\u03D6\\u03DA\\u03DC\\u03DE\\u03E0\\u03E2-\\u03F3\\u0401-\\u040C\\u040E-\\u044F\\u0451-\\u045C\\u045E-\\u0481\\u0490-\\u04C4\\u04C7-\\u04C8\\u04CB-\\u04CC\\u04D0-\\u04EB\\u04EE-\\u04F5\\u04F8-\\u04F9\\u0531-\\u0556\\u0559\\u0561-\\u0586\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0621-\\u063A\\u0641-\\u064A\\u0671-\\u06B7\\u06BA-\\u06BE\\u06C0-\\u06CE\\u06D0-\\u06D3\\u06D5\\u06E5-\\u06E6\\u0905-\\u0939\\u093D\\u0958-\\u0961\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09DC-\\u09DD\\u09DF-\\u09E1\\u09F0-\\u09F1\\u0A05-\\u0A0A\\u0A0F-\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32-\\u0A33\\u0A35-\\u0A36\\u0A38-\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8B\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2-\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AE0\\u0B05-\\u0B0C\\u0B0F-\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32-\\u0B33\\u0B36-\\u0B39\\u0B3D\\u0B5C-\\u0B5D\\u0B5F-\\u0B61\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99-\\u0B9A\\u0B9C\\u0B9E-\\u0B9F\\u0BA3-\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB5\\u0BB7-\\u0BB9\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C60-\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CDE\\u0CE0-\\u0CE1\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D28\\u0D2A-\\u0D39\\u0D60-\\u0D61\\u0E01-\\u0E2E\\u0E30\\u0E32-\\u0E33\\u0E40-\\u0E45\\u0E81-\\u0E82\\u0E84\\u0E87-\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA-\\u0EAB\\u0EAD-\\u0EAE\\u0EB0\\u0EB2-\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0F40-\\u0F47\\u0F49-\\u0F69\\u10A0-\\u10C5\\u10D0-\\u10F6\\u1100\\u1102-\\u1103\\u1105-\\u1107\\u1109\\u110B-\\u110C\\u110E-\\u1112\\u113C\\u113E\\u1140\\u114C\\u114E\\u1150\\u1154-\\u1155\\u1159\\u115F-\\u1161\\u1163\\u1165\\u1167\\u1169\\u116D-\\u116E\\u1172-\\u1173\\u1175\\u119E\\u11A8\\u11AB\\u11AE-\\u11AF\\u11B7-\\u11B8\\u11BA\\u11BC-\\u11C2\\u11EB\\u11F0\\u11F9\\u1E00-\\u1E9B\\u1EA0-\\u1EF9\\u1F00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2126\\u212A-\\u212B\\u212E\\u2180-\\u2182\\u3041-\\u3094\\u30A1-\\u30FA\\u3105-\\u312C\\uAC00-\\uD7A3\\u4E00-\\u9FA5\\u3007\\u3021-\\u3029_]'\nRDFaProcessor.NCNAME = new RegExp('^' + RDFaProcessor.nameStartChar +\n RDFaProcessor.nameChar + '*$')\n\n/*\nRDFaProcessor.prototype.resolveAndNormalize = function(base,href) {\n var u = base.resolve(href)\n var parsed = this.parseURI(u)\n parsed.normalize()\n return parsed.spec\n}\n*/\n\nRDFaProcessor.dateTimeTypes = [\n { pattern: /-?P(?:[0-9]+Y)?(?:[0-9]+M)?(?:[0-9]+D)?(?:T(?:[0-9]+H)?(?:[0-9]+M)?(?:[0-9]+(?:\\.[0-9]+)?S)?)?/,\n type: 'http://www.w3.org/2001/XMLSchema#duration' },\n { pattern: /-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]-[0-9][0-9]T(?:[0-1][0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]+)?(?:Z|[+\\-][0-9][0-9]:[0-9][0-9])?/,\n type: 'http://www.w3.org/2001/XMLSchema#dateTime' },\n { pattern: /-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]-[0-9][0-9](?:Z|[+\\-][0-9][0-9]:[0-9][0-9])?/,\n type: 'http://www.w3.org/2001/XMLSchema#date' },\n { pattern: /(?:[0-1][0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]+)?(?:Z|[+\\-][0-9][0-9]:[0-9][0-9])?/,\n type: 'http://www.w3.org/2001/XMLSchema#time' },\n { pattern: /-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]/,\n type: 'http://www.w3.org/2001/XMLSchema#gYearMonth' },\n { pattern: /-?[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9]/,\n type: 'http://www.w3.org/2001/XMLSchema#gYear' }\n]\n\nconst parseRDFaDOM = RDFaProcessor.parseRDFaDOM\nexport { parseRDFaDOM }\n","/**\n * RDF/XML PARSER\n *\n * Parser believed to be in full positive RDF/XML parsing compliance\n * with the possible exception of handling deprecated RDF attributes\n * appropriately. Parser is believed to comply fully with other W3C\n * and industry standards where appropriate (DOM, ECMAScript, &c.)\n *\n * Author: David Sheets \n *\n * W3C® SOFTWARE NOTICE AND LICENSE\n * http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231\n * This work (and included software, documentation such as READMEs, or\n * other related items) is being provided by the copyright holders under\n * the following license. By obtaining, using and/or copying this work,\n * you (the licensee) agree that you have read, understood, and will\n * comply with the following terms and conditions.\n *\n * Permission to copy, modify, and distribute this software and its\n * documentation, with or without modification, for any purpose and\n * without fee or royalty is hereby granted, provided that you include\n * the following on ALL copies of the software and documentation or\n * portions thereof, including modifications:\n *\n * 1. The full text of this NOTICE in a location viewable to users of\n * the redistributed or derivative work.\n * 2. Any pre-existing intellectual property disclaimers, notices, or terms and\n * conditions. If none exist, the W3C Software Short Notice should be\n * included (hypertext is preferred, text is permitted) within the body\n * of any redistributed or derivative code.\n * 3. Notice of any changes or modifications to the files, including the\n * date changes were made. (We recommend you provide URIs to the location\n * from which the code is derived.)\n *\n * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED \"AS IS,\" AND COPYRIGHT\n * HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,\n * INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS\n * FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR\n * DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,\n * TRADEMARKS OR OTHER RIGHTS.\n *\n * COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL\n * OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR\n * DOCUMENTATION.\n *\n * The name and trademarks of copyright holders may NOT be used in\n * advertising or publicity pertaining to the software without specific,\n * written prior permission. Title to copyright in this software and any\n * associated documentation will at all times remain with copyright\n * holders.\n */\n/**\n * @class RDFParser resource object tied to an RDFStore\n *\n * @author David Sheets \n *\n*/\nimport * as uriUtil from './uri'\n\n\nexport default class RDFParser {\n\n /*\n * @constructor\n * @param {RDFStore} store An RDFStore object\n */\n constructor(store) {\n /** Our triple store reference @private */\n\n this.store = store /** Our identified blank nodes @private */\n this.bnodes = {} /** A context for context-aware stores @private */\n this.why = null /** Reification flag */\n this.reify = false\n }\n\n /** Standard namespaces that we know how to handle @final\n * @member RDFParser\n */\n static ns = {'RDF': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'RDFS': 'http://www.w3.org/2000/01/rdf-schema#'}\n\n /** DOM Level 2 node type magic numbers @final\n * @member RDFParser\n */\n static nodeType = {'ELEMENT': 1, 'ATTRIBUTE': 2, 'TEXT': 3,\n 'CDATA_SECTION': 4, 'ENTITY_REFERENCE': 5,\n 'ENTITY': 6, 'PROCESSING_INSTRUCTION': 7,\n 'COMMENT': 8, 'DOCUMENT': 9, 'DOCUMENT_TYPE': 10,\n 'DOCUMENT_FRAGMENT': 11, 'NOTATION': 12}\n\n /**\n * Frame class for namespace and base URI lookups\n * Base lookups will always resolve because the parser knows\n * the default base.\n *\n * @private\n */\n\n frameFactory(parser, parent, element) {\n return {'NODE': 1, 'ARC': 2, 'parent': parent, 'parser': parser, 'store': parser.store, 'element': element,\n 'lastChild': 0, 'base': null, 'lang': null, 'node': null, 'nodeType': null, 'listIndex': 1, 'rdfid': null, 'datatype': null, 'collection': false, /** Terminate the frame and notify the store that we're done */\n 'terminateFrame': function () {\n if (this.collection) {\n this.node.close()\n }\n }, /** Add a symbol of a certain type to the this frame */'addSymbol': function (type, uri) {\n uri = uriUtil.join(uri, this.base)\n this.node = this.store.sym(uri)\n\n this.nodeType = type\n }, /** Load any constructed triples into the store */'loadTriple': function () {\n if (this.parent.parent.collection) {\n this.parent.parent.node.append(this.node)\n } else {\n this.store.add(this.parent.parent.node, this.parent.node, this.node, this.parser.why)\n }\n if (this.parent.rdfid != null) {\n // reify\n var triple = this.store.sym(uriUtil.join('#' + this.parent.rdfid, this.base))\n this.store.add(triple, this.store.sym(RDFParser.ns.RDF + 'type'), this.store.sym(RDFParser.ns.RDF + 'Statement'), this.parser.why)\n this.store.add(triple, this.store.sym(RDFParser.ns.RDF + 'subject'), this.parent.parent.node, this.parser.why)\n this.store.add(triple, this.store.sym(RDFParser.ns.RDF + 'predicate'), this.parent.node, this.parser.why)\n\n this.store.add(triple, this.store.sym(RDFParser.ns.RDF + 'object'), this.node, this.parser.why)\n }\n }, /** Check if it's OK to load a triple */'isTripleToLoad': function () {\n return (this.parent != null && this.parent.parent != null && this.nodeType === this.NODE && this.parent.nodeType ===\n this.ARC && this.parent.parent.nodeType === this.NODE)\n }, /** Add a symbolic node to this frame */'addNode': function (uri) {\n this.addSymbol(this.NODE, uri)\n if (this.isTripleToLoad()) {\n this.loadTriple()\n }\n }, /** Add a collection node to this frame */'addCollection': function () {\n this.nodeType = this.NODE\n this.node = this.store.collection()\n this.collection = true\n if (this.isTripleToLoad()) {\n this.loadTriple()\n }\n }, /** Add a collection arc to this frame */'addCollectionArc': function () {\n this.nodeType = this.ARC\n }, /** Add a bnode to this frame */'addBNode': function (id) {\n if (id != null) {\n if (this.parser.bnodes[id] != null) {\n this.node = this.parser.bnodes[id]\n } else {\n this.node = this.parser.bnodes[id] = this.store.bnode()\n }\n } else {\n this.node = this.store.bnode()\n }\n this.nodeType = this.NODE\n if (this.isTripleToLoad()) {\n this.loadTriple()\n }\n }, /** Add an arc or property to this frame */'addArc': function (uri) {\n if (uri === RDFParser.ns.RDF + 'li') {\n uri = RDFParser.ns.RDF + '_' + this.parent.listIndex\n this.parent.listIndex++\n }\n\n this.addSymbol(this.ARC, uri)\n }, /** Add a literal to this frame */'addLiteral': function (value) {\n if (this.parent.datatype && this.parent.datatype !== RDFParser.ns.RDF +'langString') {\n this.node = this.store.literal(value, this.store.sym(this.parent.datatype))\n } else {\n this.node = this.store.literal(value, this.lang)\n }\n this.nodeType = this.NODE\n if (this.isTripleToLoad()) {\n this.loadTriple()\n }\n }\n }\n }\n\n // from the OpenLayers source .. needed to get around IE problems.\n getAttributeNodeNS(node, uri, name) {\n var attributeNode = null\n if (node.getAttributeNodeNS) {\n attributeNode = node.getAttributeNodeNS(uri, name)\n } else {\n var attributes = node.attributes\n var potentialNode, fullName\n for (var i = 0;i < attributes.length; ++i) {\n potentialNode = attributes[i]\n if (potentialNode.namespaceURI === uri) {\n fullName = (potentialNode.prefix) ? (potentialNode.prefix + ':' + name) : name\n if (fullName === potentialNode.nodeName) {\n attributeNode = potentialNode\n break\n }\n }\n }\n }\n return attributeNode\n }\n\n /**\n * Build our initial scope frame and parse the DOM into triples\n * @param {HTMLDocument} document The DOM to parse\n * @param {String} base The base URL to use\n * @param {Object} why The context to which this resource belongs\n */\n\n parse(document, base, why) {\n var children = document.childNodes // clean up for the next run\n this.cleanParser() // figure out the root element\n var root\n if (document.nodeType === RDFParser.nodeType.DOCUMENT) {\n for (var c = 0;c < children.length;c++) {\n if (children[c].nodeType === RDFParser.nodeType.ELEMENT) {\n root = children[c]\n break\n }\n }\n } else if (document.nodeType === RDFParser.nodeType.ELEMENT) {\n root = document\n } else {\n throw new Error(\"RDFParser: can't find root in \" + base + '. Halting. ')\n // return false\n }\n this.why = why // our topmost frame\n var f = this.frameFactory(this)\n this.base = base\n f.base = base\n f.lang = null // was '' but can't have langs like that 2015 (!)\n this.parseDOM(this.buildFrame(f, root))\n return true\n }\n\n parseDOM(frame) {\n // a DOM utility function used in parsing\n var rdfid\n var elementURI = function (el) {\n var result = ''\n if (el.namespaceURI == null) {\n throw new Error('RDF/XML syntax error: No namespace for ' + el.localName + ' in ' + this.base)\n }\n if (el.namespaceURI) {\n result = result + el.namespaceURI\n }\n if (el.localName) {\n result = result + el.localName\n } else if (el.nodeName) {\n if (el.nodeName.indexOf(':') >= 0)result = result + el.nodeName.split(':')[1]\n else result = result + el.nodeName\n }\n return result\n }.bind(this)\n var dig = true // if we'll dig down in the tree on the next iter\n while (frame.parent) {\n var dom = frame.element\n var attrs = dom.attributes\n if (dom.nodeType === RDFParser.nodeType.TEXT || dom.nodeType === RDFParser.nodeType.CDATA_SECTION) {\n // we have a literal\n if (frame.parent.nodeType === frame.NODE) {\n // must have had attributes, store as rdf:value\n frame.addArc(RDFParser.ns.RDF + 'value')\n frame = this.buildFrame(frame)\n }\n frame.addLiteral(dom.nodeValue)\n } else if (elementURI(dom) !== RDFParser.ns.RDF + 'RDF') {\n // not root\n if (frame.parent && frame.parent.collection) {\n // we're a collection element\n frame.addCollectionArc()\n frame = this.buildFrame(frame, frame.element)\n frame.parent.element = null\n }\n if (!frame.parent || !frame.parent.nodeType || frame.parent.nodeType === frame.ARC) {\n // we need a node\n var about = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'about')\n rdfid = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'ID')\n if (about && rdfid) {\n throw new Error('RDFParser: ' + dom.nodeName + ' has both rdf:id and rdf:about.' +\n ' Halting. Only one of these' + ' properties may be specified on a' + ' node.')\n }\n if (!about && rdfid) {\n frame.addNode('#' + rdfid.nodeValue)\n dom.removeAttributeNode(rdfid)\n } else if (about == null && rdfid == null) {\n var bnid = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'nodeID')\n if (bnid) {\n frame.addBNode(bnid.nodeValue)\n dom.removeAttributeNode(bnid)\n } else {\n frame.addBNode()\n }\n } else {\n frame.addNode(about.nodeValue)\n dom.removeAttributeNode(about)\n }\n // Typed nodes\n var rdftype = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'type')\n if (RDFParser.ns.RDF + 'Description' !== elementURI(dom)) {\n rdftype = {'nodeValue': elementURI(dom)}\n }\n if (rdftype != null) {\n this.store.add(frame.node, this.store.sym(RDFParser.ns.RDF + 'type'), this.store.sym(uriUtil.join(rdftype.nodeValue,\n frame.base)), this.why)\n if (rdftype.nodeName) {\n dom.removeAttributeNode(rdftype)\n }\n }\n // Property Attributes\n for (var x = attrs.length - 1; x >= 0; x--) {\n this.store.add(frame.node, this.store.sym(elementURI(attrs[x])), this.store.literal(attrs[x].nodeValue,\n frame.lang), this.why)\n }\n } else {\n // we should add an arc (or implicit bnode+arc)\n frame.addArc(elementURI(dom)) // save the arc's rdf:ID if it has one\n if (this.reify) {\n rdfid = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'ID')\n if (rdfid) {\n frame.rdfid = rdfid.nodeValue\n dom.removeAttributeNode(rdfid)\n }\n }\n var parsetype = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'parseType')\n var datatype = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'datatype')\n if (datatype) {\n frame.datatype = datatype.nodeValue\n dom.removeAttributeNode(datatype)\n }\n if (parsetype) {\n var nv = parsetype.nodeValue\n if (nv === 'Literal') {\n frame.datatype = RDFParser.ns.RDF + 'XMLLiteral'\n frame = this.buildFrame(frame)\n // Don't include the literal node, only its children\n // see https://github.com/linkeddata/rdflib.js/issues/75\n frame.addLiteral(dom.innerHTML || dom.childNodes)\n dig = false\n } else if (nv === 'Resource') {\n frame = this.buildFrame(frame, frame.element)\n frame.parent.element = null\n frame.addBNode()\n } else if (nv === 'Collection') {\n frame = this.buildFrame(frame, frame.element)\n frame.parent.element = null\n frame.addCollection()\n }\n dom.removeAttributeNode(parsetype)\n }\n if (attrs.length !== 0) {\n var resource = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'resource')\n var bnid2 = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'nodeID')\n frame = this.buildFrame(frame)\n if (resource) {\n frame.addNode(resource.nodeValue)\n dom.removeAttributeNode(resource)\n } else {\n if (bnid2) {\n frame.addBNode(bnid2.nodeValue)\n dom.removeAttributeNode(bnid2)\n } else {\n frame.addBNode()\n }\n }\n for (var x1 = attrs.length - 1; x1 >= 0; x1--) {\n var f = this.buildFrame(frame)\n f.addArc(elementURI(attrs[x1]))\n if (elementURI(attrs[x1]) === RDFParser.ns.RDF + 'type') {\n (this.buildFrame(f)).addNode(attrs[x1].nodeValue)\n } else {\n (this.buildFrame(f)).addLiteral(attrs[x1].nodeValue)\n }\n }\n } else if (dom.childNodes.length === 0) {\n (this.buildFrame(frame)).addLiteral('')\n }\n }\n } // rdf:RDF\n // dig dug\n dom = frame.element\n while (frame.parent) {\n var pframe = frame\n while (dom == null) {\n frame = frame.parent\n dom = frame.element\n }\n var candidate = dom.childNodes && dom.childNodes[frame.lastChild]\n if (!candidate || !dig) {\n frame.terminateFrame()\n if (!(frame = frame.parent)) {\n break\n } // done\n dom = frame.element\n dig = true\n } else if ((candidate.nodeType !== RDFParser.nodeType.ELEMENT &&\n candidate.nodeType !== RDFParser.nodeType.TEXT &&\n candidate.nodeType !== RDFParser.nodeType.CDATA_SECTION) ||\n ((candidate.nodeType === RDFParser.nodeType.TEXT ||\n candidate.nodeType === RDFParser.nodeType.CDATA_SECTION) &&\n dom.childNodes.length !== 1)) {\n frame.lastChild++\n } else {\n // not a leaf\n frame.lastChild++\n frame = this.buildFrame(pframe, dom.childNodes[frame.lastChild - 1])\n break\n }\n }\n } // while\n }\n\n /**\n * Cleans out state from a previous parse run\n * @private\n */\n cleanParser() {\n this.bnodes = {}\n this.why = null\n }\n\n /**\n * Builds scope frame\n * @private\n */\n buildFrame(parent, element) {\n var frame = this.frameFactory(this, parent, element)\n if (parent) {\n frame.base = parent.base\n frame.lang = parent.lang\n }\n if (!element || element.nodeType === RDFParser.nodeType.TEXT ||\n element.nodeType === RDFParser.nodeType.CDATA_SECTION) {\n return frame\n }\n var attrs = element.attributes\n var base = element.getAttributeNode('xml:base')\n if (base != null) {\n frame.base = base.nodeValue\n element.removeAttribute('xml:base')\n }\n var lang = element.getAttributeNode('xml:lang')\n if (lang != null) {\n frame.lang = lang.nodeValue\n element.removeAttribute('xml:lang')\n }\n // remove all extraneous xml and xmlns attributes\n for (var x = attrs.length - 1;x >= 0;x--) {\n if (attrs[x].nodeName.substr(0, 3) === 'xml') {\n if (attrs[x].name.slice(0, 6) === 'xmlns:') {\n var uri = attrs[x].nodeValue // alert('base for namespac attr:'+this.base)\n if (this.base) uri = uriUtil.join(uri, this.base)\n this.store.setPrefixForURI(attrs[x].name.slice(6), uri)\n }\n //\t\talert('rdfparser: xml atribute: '+attrs[x].name) //@@\n element.removeAttributeNode(attrs[x])\n }\n }\n return frame\n }\n}\n","// Parse a simple SPARL-Update subset syntax for patches.\n//\n// This parses\n// WHERE {xxx} DELETE {yyy} INSERT DATA {zzz}\n// (not necessarily in that order)\n// as though it were the n3\n// <#query> patch:where {xxx}; patch:delete {yyy}; patch:insert {zzz}.\nimport N3Parser from './n3parser'\nimport Namespace from './namespace'\n\nexport default function sparqlUpdateParser (str, kb, base) {\n var i, j, k\n var keywords = [ 'INSERT', 'DELETE', 'WHERE' ]\n var SQNS = Namespace('http://www.w3.org/ns/pim/patch#')\n var p = N3Parser(kb, kb, base, base, null, null, '', null)\n var clauses = {}\n\n var badSyntax = function (uri, lines, str, i, why) {\n return ('Line ' + (lines + 1) + ' of <' + uri + '>: Bad syntax:\\n ' +\n why + '\\n at: \"' + str.slice(i, (i + 30)) + '\"')\n }\n\n // var check = function (next, last, message) {\n // if (next < 0) {\n // throw badSyntax(p._thisDoc, p.lines, str, j, last, message)\n // }\n // return next\n // }\n i = 0\n var query = kb.sym(base + '#query') // Invent a URI for the query\n clauses['query'] = query // A way of accessing it in its N3 model.\n\n while (true) {\n // console.log(\"A Now at i = \" + i)\n j = p.skipSpace(str, i)\n if (j < 0) {\n return clauses\n }\n // console.log(\"B After space at j= \" + j)\n if (str[j] === ';') {\n i = p.skipSpace(str, j + 1)\n if (i < 0) {\n return clauses // Allow end in a\n }\n j = i\n }\n var found = false\n for (k = 0; k < keywords.length; k++) {\n var key = keywords[k]\n if (str.slice(j, j + key.length) === key) {\n i = p.skipSpace(str, j + key.length)\n if (i < 0) {\n throw badSyntax(p._thisDoc, p.lines, str, j + key.length, 'found EOF, needed {...} after ' + key)\n }\n if (((key === 'INSERT') || (key === 'DELETE')) && str.slice(i, i + 4) === 'DATA') { // Some wanted 'DATA'. Whatever\n j = p.skipSpace(str, i + 4)\n if (j < 0) {\n throw badSyntax(p._thisDoc, p.lines, str, i + 4, 'needed {...} after INSERT DATA ' + key)\n }\n i = j\n }\n var res2 = []\n j = p.node(str, i, res2) // Parse all the complexity of the clause\n\n if (j < 0) {\n throw badSyntax(p._thisDoc, p.lines, str, i,\n 'bad syntax or EOF in {...} after ' + key)\n }\n clauses[key.toLowerCase()] = res2[0]\n kb.add(query, SQNS(key.toLowerCase()), res2[0]) // , kb.sym(base)\n // key is the keyword and res2 has the contents\n found = true\n i = j\n }\n }\n if (!found && str.slice(j, j + 7) === '@prefix') {\n i = p.directive(str, j)\n if (i < 0) {\n throw badSyntax(p._thisDoc, p.lines, str, i,\n 'bad syntax or EOF after @prefix ')\n }\n // console.log(\"P before dot i= \" + i)\n i = p.checkDot(str, i)\n // console.log(\"Q after dot i= \" + i)\n found = true\n }\n if (!found) {\n // console.log(\"Bad syntax \" + j)\n throw badSyntax(p._thisDoc, p.lines, str, j,\n \"Unknown syntax at start of statememt: '\" + str.slice(j).slice(0, 20) + \"'\")\n }\n } // while\n// return clauses\n}\n","import DataFactory from './factories/extended-term-factory'\nimport jsonldParser from './jsonldparser'\n// @ts-ignore is this injected?\nimport { Parser as N3jsParser } from 'n3' // @@ Goal: remove this dependency\nimport N3Parser from './n3parser'\nimport { parseRDFaDOM } from './rdfaparser'\nimport RDFParser from './rdfxmlparser'\nimport sparqlUpdateParser from './patch-parser'\nimport * as Util from './utils-js'\nimport Formula from './formula'\nimport { ContentType, TurtleContentType, N3ContentType, RDFXMLContentType, XHTMLContentType, HTMLContentType, SPARQLUpdateContentType, SPARQLUpdateSingleMatchContentType, JSONLDContentType, NQuadsContentType, NQuadsAltContentType } from './types'\nimport { Quad } from './tf-types'\n\ntype CallbackFunc = (error: any, kb: Formula | null) => void\n\n/**\n * Parse a string and put the result into the graph kb.\n * Normal method is sync.\n * Unfortunately jsdonld is currently written to need to be called async.\n * Hence the mess below with executeCallback.\n * @param str - The input string to parse\n * @param kb - The store to use\n * @param base - The base URI to use\n * @param contentType - The MIME content type string for the input - defaults to text/turtle\n * @param [callback] - The callback to call when the data has been loaded\n */\nexport default function parse (\n str: string,\n kb: Formula,\n base: string,\n contentType: string | ContentType = 'text/turtle',\n callback?: CallbackFunc\n) {\n contentType = contentType || TurtleContentType\n contentType = contentType.split(';')[0] as ContentType\n try {\n if (contentType === N3ContentType || contentType === TurtleContentType) {\n var p = N3Parser(kb, kb, base, base, null, null, '', null)\n p.loadBuf(str)\n executeCallback()\n } else if (contentType === RDFXMLContentType) {\n var parser = new RDFParser(kb)\n parser.parse(Util.parseXML(str), base, kb.sym(base))\n executeCallback()\n } else if (contentType === XHTMLContentType) {\n parseRDFaDOM(Util.parseXML(str, {contentType: XHTMLContentType}), kb, base)\n executeCallback()\n } else if (contentType === HTMLContentType) {\n parseRDFaDOM(Util.parseXML(str, {contentType: HTMLContentType}), kb, base)\n executeCallback()\n } else if ((contentType === SPARQLUpdateContentType) || (contentType === SPARQLUpdateSingleMatchContentType)) { // @@ we handle a subset\n sparqlUpdateParser(str, kb, base)\n executeCallback()\n } else if (contentType === JSONLDContentType) {\n jsonldParser(str, kb, base, executeCallback)\n } else if (contentType === NQuadsContentType ||\n contentType === NQuadsAltContentType) {\n var n3Parser = new N3jsParser({ factory: DataFactory })\n nquadCallback(null, str)\n } else if (contentType === undefined) {\n throw new Error(\"contentType is undefined\")\n } else {\n throw new Error(\"Don't know how to parse \" + contentType + ' yet')\n }\n } catch (e) {\n // @ts-ignore\n executeErrorCallback(e)\n }\n\n (parse as any).handled= {\n 'text/n3': true,\n 'text/turtle': true,\n 'application/rdf+xml': true,\n 'application/xhtml+xml': true,\n 'text/html': true,\n 'application/sparql-update': true,\n 'application/sparql-update-single-match': true,\n 'application/ld+json': true,\n 'application/nquads' : true,\n 'application/n-quads' : true\n }\n\n function executeCallback () {\n if (callback) {\n callback(null, kb)\n } else {\n return\n }\n }\n\n function executeErrorCallback (e: Error): void {\n if (\n // TODO: Always true, what is the right behavior\n contentType !== JSONLDContentType ||\n // @ts-ignore always true?\n contentType !== NQuadsContentType ||\n // @ts-ignore always true?\n contentType !== NQuadsAltContentType\n ) {\n if (callback) {\n callback(e, kb)\n } else {\n let e2 = new Error('' + e + ' while trying to parse <' + base + '> as ' + contentType)\n //@ts-ignore .cause is not a default error property\n e2.cause = e\n throw e2\n }\n }\n }\n/*\n function setJsonLdBase (doc, base) {\n if (doc instanceof Array) {\n return\n }\n if (!('@context' in doc)) {\n doc['@context'] = {}\n }\n doc['@context']['@base'] = base\n }\n*/\n function nquadCallback (err?: Error | null, nquads?: string): void {\n if (err) {\n (callback as CallbackFunc)(err, kb)\n }\n try {\n n3Parser.parse(nquads, tripleCallback)\n } catch (err) {\n (callback as CallbackFunc)(err, kb)\n }\n }\n\n function tripleCallback (err: Error, triple: Quad) {\n if (triple) {\n kb.add(triple.subject, triple.predicate, triple.object, triple.graph)\n } else {\n (callback as CallbackFunc)(err, kb)\n }\n }\n}\n","/* global $SolidTestEnvironment */\n/**\n *\n * Project: rdflib.js\n *\n * @file: fetcher.js\n *\n * Description: contains functions for requesting/fetching/retracting\n * This implements quite a lot of the web architecture.\n * A fetcher is bound to a specific quad store, into which\n * it loads stuff and into which it writes its metadata\n * @@ The metadata could be optionally a separate graph\n *\n * - implements semantics of HTTP headers, Internet Content Types\n * - selects parsers for rdf/xml, n3, rdfa, grddl\n *\n * TO do:\n * - Implement a runtime registry for parsers and serializers\n * -\n */\n\n/**\n * Things to test: callbacks on request, refresh, retract\n * loading from HTTP, HTTPS, FTP, FILE, others?\n * To do:\n * Firing up a mail client for mid: (message:) URLs\n */\nimport IndexedFormula from './store'\nimport log from './log'\nimport N3Parser from './n3parser'\nimport RDFlibNamedNode from './named-node'\nimport Namespace from './namespace'\nimport rdfParse from './parse'\nimport { parseRDFaDOM } from './rdfaparser'\nimport RDFParser from './rdfxmlparser'\nimport * as Uri from './uri'\nimport { isCollection, isNamedNode} from './utils/terms'\nimport * as Util from './utils-js'\nimport serialize from './serialize'\nimport crossFetch, { Headers } from 'cross-fetch'\n\nimport {\n ContentType, TurtleContentType, RDFXMLContentType, XHTMLContentType\n} from './types'\nimport { termValue } from './utils/termValue'\nimport {\n BlankNode,\n RdfJsDataFactory,\n Quad_Graph,\n NamedNode,\n Quad_Predicate,\n Quad_Subject\n} from './tf-types'\nimport jsonldParser from './jsonldparser'\n\nconst Parsable = {\n 'text/n3': true,\n 'text/turtle': true,\n 'application/rdf+xml': true,\n 'application/xhtml+xml': true,\n 'text/html': true,\n 'application/ld+json': true\n}\n\n// This is a minimal set to allow the use of damaged servers if necessary\nconst CONTENT_TYPE_BY_EXT = {\n 'rdf': RDFXMLContentType,\n 'owl': RDFXMLContentType,\n 'n3': 'text/n3',\n 'ttl': 'text/turtle',\n 'nt': 'text/n3',\n 'acl': 'text/n3',\n 'html': 'text/html',\n 'xml': 'text/xml'\n}\n\n// Convenience namespaces needed in this module.\n// These are deliberately not exported as the user application should\n// make its own list and not rely on the prefixes used here,\n// and not be tempted to add to them, and them clash with those of another\n// application.\nconst getNS = (factory?: RdfJsDataFactory) => {\n return {\n link: Namespace('http://www.w3.org/2007/ont/link#', factory),\n http: Namespace('http://www.w3.org/2007/ont/http#', factory),\n httph: Namespace('http://www.w3.org/2007/ont/httph#', factory), // headers\n rdf: Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#', factory),\n rdfs: Namespace('http://www.w3.org/2000/01/rdf-schema#', factory),\n dc: Namespace('http://purl.org/dc/elements/1.1/', factory),\n ldp: Namespace('http://www.w3.org/ns/ldp#', factory)\n }\n}\nconst ns = getNS()\n\nexport interface FetchError extends Error {\n statusText?: string\n status?: StatusValues\n response?: ExtendedResponse\n}\n\n/** An extended interface of Response, since RDFlib.js adds some properties. */\nexport interface ExtendedResponse extends Response {\n /** String representation of the Body */\n responseText?: string\n /** Identifier of the reqest */\n req?: Quad_Subject\n size?: number\n timeout?: number\n /** Used in UpdateManager.updateDav */\n error?: string\n}\n\n/** tell typescript that a 'panes' child may exist on Window */\ndeclare global {\n interface Window {\n panes?: any\n solidFetcher?: any\n solidFetch?: any\n }\n var solidFetcher: Function\n var solidFetch: Function\n}\ndeclare var $SolidTestEnvironment: {\n localSiteMap?: any\n}\n\ntype UserCallback = (\n ok: boolean,\n message: string,\n response?: any\n) => void\n\ntype HTTPMethods = 'GET' | 'PUT' | 'POST' | 'PATCH' | 'HEAD' | 'DELETE' | 'CONNECT' | 'TRACE' | 'OPTIONS'\n\n/** All valid inputs for initFetchOptions */\nexport type Options = Partial\n\n/** Initiated by initFetchOptions, which runs on load */\nexport interface AutoInitOptions extends RequestInit{\n /** The used Fetch function */\n fetch?: Fetch\n /**\n * Referring term, the resource which\n * referred to this (for tracking bad links).\n * The document in which this link was found.\n */\n referringTerm?: NamedNode\n /** Provided content type (for writes) */\n contentType?: string\n /**\n * Override the incoming header to\n * force the data to be treated as this content-type (for reads)\n */\n forceContentType?: ContentType\n /**\n * Load the data even if loaded before.\n * Also sets the `Cache-Control:` header to `no-cache`\n */\n force?: boolean\n /**\n * Original uri to preserve\n * through proxying etc (`xhr.original`).\n */\n baseURI: string\n /**\n * Whether this request is a retry via\n * a proxy (generally done from an error handler)\n */\n proxyUsed?: boolean\n actualProxyURI?: string\n /** flag for XHR/CORS etc */\n withCredentials?: boolean\n /** Before we parse new data, clear old, but only on status 200 responses */\n clearPreviousData?: boolean\n /** Prevents the addition of various metadata triples (about the fetch request) to the store*/\n noMeta?: boolean\n noRDFa?: boolean\n handlers?: Handler[]\n timeout?: number\n method?: HTTPMethods\n retriedWithNoCredentials?: boolean\n requestedURI?: string\n // Seems to be required in some functions, such as XHTML parse and RedirectToProxy\n resource: Quad_Subject\n /** The serialized resource in the body*/\n // Used for storing metadata of requests\n original: NamedNode\n // Like requeststatus? Can contain text with error.\n data?: string\n // Probably an identifier for request?s\n req: BlankNode\n // Might be the same as Options.data\n body?: string\n headers: HeadersInit\n credentials?: 'include' | 'omit'\n}\n\nclass Handler {\n // TODO: Document, type\n response: ExtendedResponse\n // TODO: Document, type\n dom: Document\n static pattern: RegExp\n\n constructor (response: ExtendedResponse, dom?: Document) {\n this.response = response\n // The type assertion operator here might need to be removed.\n this.dom = dom!\n }\n}\n\nclass RDFXMLHandler extends Handler {\n static toString () {\n return 'RDFXMLHandler'\n }\n\n static register (fetcher: Fetcher) {\n fetcher.mediatypes[RDFXMLContentType] = {\n 'q': 0.9\n }\n }\n\n parse (\n fetcher: Fetcher,\n /** An XML String */\n responseText: String,\n /** Requires .original */\n options: {\n original: Quad_Subject\n req: Quad_Subject\n } & Options,\n ) {\n let kb = fetcher.store\n if (!this.dom) {\n this.dom = Util.parseXML(responseText)\n }\n let root = this.dom.documentElement\n if (root.nodeName === 'parsererror') { // Mozilla only See issue/issue110\n // have to fail the request\n return fetcher.failFetch(options, 'Badly formed XML in ' +\n options.resource!.value, 'parse_error')\n }\n let parser = new RDFParser(kb)\n try {\n parser.parse(this.dom, options.original.value, options.original)\n } catch (err) {\n return fetcher.failFetch(options, 'Syntax error parsing RDF/XML! ' + err,\n 'parse_error')\n }\n if (!options.noMeta) {\n kb.add(options.original, ns.rdf('type'), ns.link('RDFDocument'), fetcher.appNode)\n }\n\n return fetcher.doneFetch(options, this.response)\n }\n}\nRDFXMLHandler.pattern = new RegExp('application/rdf\\\\+xml')\n\nclass XHTMLHandler extends Handler {\n static toString () {\n return 'XHTMLHandler'\n }\n\n static register (fetcher: Fetcher) {\n fetcher.mediatypes[XHTMLContentType] = {}\n }\n\n parse (\n fetcher: Fetcher,\n responseText: string,\n options: {\n resource: Quad_Subject\n original: Quad_Subject\n } & Options,\n ): Promise | ExtendedResponse {\n let relation, reverse: boolean\n if (!this.dom) {\n this.dom = Util.parseXML(responseText)\n }\n let kb = fetcher.store\n\n // dc:title\n let title = this.dom.getElementsByTagName('title')\n if (title.length > 0) {\n kb.add(options.resource, ns.dc('title'), kb.rdfFactory.literal(title[0].textContent as string),\n options.resource)\n // log.info(\"Inferring title of \" + xhr.resource)\n }\n\n // link rel\n let links = this.dom.getElementsByTagName('link')\n for (let x = links.length - 1; x >= 0; x--) { // @@ rev\n relation = links[x].getAttribute('rel')\n reverse = false\n if (!relation) {\n relation = links[x].getAttribute('rev')\n reverse = true\n }\n if (relation) {\n fetcher.linkData(options.original, relation,\n links[x].getAttribute('href') as string, options.resource, reverse)\n }\n }\n\n // Data Islands\n let scripts = this.dom.getElementsByTagName('script')\n for (let i = 0; i < scripts.length; i++) {\n let contentType = scripts[i].getAttribute('type')\n if (Parsable[contentType!]) {\n // @ts-ignore incompatibility between Store.add and Formula.add\n rdfParse(scripts[i].textContent as string, kb, options.original.value, contentType)\n // @ts-ignore incompatibility between Store.add and Formula.add\n rdfParse(scripts[i].textContent as string, kb, options.original.value, contentType)\n }\n }\n\n if (!options.noMeta) {\n kb.add(options.resource, ns.rdf('type'), ns.link('WebPage'), fetcher.appNode)\n }\n\n if (!options.noRDFa && parseRDFaDOM) { // enable by default\n try {\n parseRDFaDOM(this.dom, kb, options.original.value)\n } catch (err) {\n // @ts-ignore\n let msg = 'Error trying to parse ' + options.resource + ' as RDFa:\\n' + err + ':\\n' + err.stack\n return fetcher.failFetch(options as AutoInitOptions, msg, 'parse_error')\n }\n }\n\n return fetcher.doneFetch(options as AutoInitOptions, this.response)\n }\n}\nXHTMLHandler.pattern = new RegExp('application/xhtml')\n\nclass XMLHandler extends Handler {\n static toString () {\n return 'XMLHandler'\n }\n\n static register (fetcher: Fetcher) {\n fetcher.mediatypes['text/xml'] = { 'q': 0.5 }\n fetcher.mediatypes['application/xml'] = { 'q': 0.5 }\n }\n\n static isElement(node: Node): node is Element {\n return node.nodeType === Node.ELEMENT_NODE;\n }\n\n\n parse (\n fetcher: Fetcher,\n responseText: string,\n options: {\n original: Quad_Subject\n req: BlankNode\n resource: Quad_Subject\n } & Options,\n ): ExtendedResponse | Promise {\n let dom = Util.parseXML(responseText)\n\n // XML Semantics defined by root element namespace\n // figure out the root element\n for (let c = 0; c < dom.childNodes.length; c++) {\n const node = dom.childNodes[c]\n // is this node an element?\n if (XMLHandler.isElement(node)) {\n\n // We've found the first element, it's the root\n let ns = node.namespaceURI\n\n // Is it RDF/XML?\n if (ns && ns === ns['rdf']) {\n fetcher.addStatus(options.req,\n 'Has XML root element in the RDF namespace, so assume RDF/XML.')\n\n let rdfHandler = new RDFXMLHandler(this.response, dom)\n return rdfHandler.parse(fetcher, responseText, options)\n }\n\n break\n }\n }\n\n // Or it could be XHTML?\n // Maybe it has an XHTML DOCTYPE?\n if (dom.doctype) {\n // log.info(\"We found a DOCTYPE in \" + xhr.resource)\n if (dom.doctype.name === 'html' &&\n dom.doctype.publicId.match(/^-\\/\\/W3C\\/\\/DTD XHTML/) &&\n dom.doctype.systemId.match(/http:\\/\\/www.w3.org\\/TR\\/xhtml/)) {\n fetcher.addStatus(options.req,\n 'Has XHTML DOCTYPE. Switching to XHTML Handler.\\n')\n\n let xhtmlHandler = new XHTMLHandler(this.response, dom)\n return xhtmlHandler.parse(fetcher, responseText, options)\n }\n }\n\n // Or what about an XHTML namespace?\n let html = dom.getElementsByTagName('html')[0]\n if (html) {\n let xmlns = html.getAttribute('xmlns')\n if (xmlns && xmlns.match(/^http:\\/\\/www.w3.org\\/1999\\/xhtml/)) {\n fetcher.addStatus(options.req,\n 'Has a default namespace for ' + 'XHTML. Switching to XHTMLHandler.\\n')\n\n let xhtmlHandler = new XHTMLHandler(this.response, dom)\n return xhtmlHandler.parse(fetcher, responseText, options)\n }\n }\n\n // At this point we should check the namespace document (cache it!) and\n // look for a GRDDL transform\n // @@ Get namespace document , parse it, look for grddl:namespaceTransform ?y\n // Apply ?y to dom\n // We give up. What dialect is this?\n return fetcher.failFetch(options,\n 'Unsupported dialect of XML: not RDF or XHTML namespace, etc.\\n' +\n responseText.slice(0, 80), 901)\n }\n}\nXMLHandler.pattern = new RegExp('(text|application)/(.*)xml')\n\nclass HTMLHandler extends Handler {\n static toString () {\n return 'HTMLHandler'\n }\n\n static register (fetcher: Fetcher) {\n fetcher.mediatypes['text/html'] = {\n 'q': 0.9\n }\n }\n\n parse (\n fetcher: Fetcher,\n responseText: string,\n options: {\n req: BlankNode,\n resource: Quad_Subject,\n original: Quad_Subject,\n } & Options\n ): Promise | ExtendedResponse {\n let kb = fetcher.store\n\n // We only handle XHTML so we have to figure out if this is XML\n // log.info(\"Sniffing HTML \" + xhr.resource + \" for XHTML.\")\n if (isXML(responseText)) {\n fetcher.addStatus(options.req, \"Has an XML declaration. We'll assume \" +\n \"it's XHTML as the content-type was text/html.\\n\")\n\n let xhtmlHandler = new XHTMLHandler(this.response)\n return xhtmlHandler.parse(fetcher, responseText, options)\n }\n\n // DOCTYPE html\n if (isXHTML(responseText)) {\n fetcher.addStatus(options.req,\n 'Has XHTML DOCTYPE. Switching to XHTMLHandler.\\n')\n\n let xhtmlHandler = new XHTMLHandler(this.response)\n return xhtmlHandler.parse(fetcher, responseText, options)\n }\n\n // xmlns\n if (isXMLNS(responseText)) {\n fetcher.addStatus(options.req,\n 'Has default namespace for XHTML, so switching to XHTMLHandler.\\n')\n\n let xhtmlHandler = new XHTMLHandler(this.response)\n return xhtmlHandler.parse(fetcher, responseText, options)\n }\n\n // dc:title\n // no need to escape '/' here\n let titleMatch = (new RegExp('([\\\\s\\\\S]+?)', 'im')).exec(responseText)\n if (titleMatch) {\n kb.add(options.resource, ns.dc('title'), kb.rdfFactory.literal(titleMatch[1]),\n options.resource) // think about xml:lang later\n }\n kb.add(options.resource, ns.rdf('type'), ns.link('WebPage'), fetcher.appNode)\n fetcher.addStatus(options.req, 'non-XML HTML document, not parsed for data.')\n\n return fetcher.doneFetch(options, this.response)\n }\n}\nHTMLHandler.pattern = new RegExp('text/html')\n\nclass JsonLdHandler extends Handler {\n static toString () {\n return 'JsonLdHandler'\n }\n static register (fetcher: Fetcher) {\n fetcher.mediatypes['application/ld+json'] = {\n 'q': 0.9\n }\n }\n parse (\n fetcher: Fetcher,\n responseText: string,\n options: {\n req: Quad_Subject\n original: Quad_Subject\n resource: Quad_Subject\n } & Options,\n response: ExtendedResponse\n ): Promise {\n const kb = fetcher.store\n return new Promise((resolve, reject) => {\n try {\n jsonldParser (responseText, kb, options.original.value, () => {\n resolve(fetcher.doneFetch(options, response))\n })\n } catch (err) {\n const msg = 'Error trying to parse ' + options.resource +\n ' as JSON-LD:\\n' + err // not err.stack -- irrelevant\n resolve(fetcher.failFetch(options, msg, 'parse_error', response))\n }\n })\n }\n}\nJsonLdHandler.pattern = /application\\/ld\\+json/\n\nclass TextHandler extends Handler {\n static toString () {\n return 'TextHandler'\n }\n\n static register (fetcher: Fetcher) {\n fetcher.mediatypes['text/plain'] = {\n 'q': 0.5\n }\n }\n\n parse (\n fetcher: Fetcher,\n responseText: string,\n options: {\n req: Quad_Subject\n original: Quad_Subject\n resource: Quad_Subject\n } & Options\n ): ExtendedResponse | Promise {\n // We only speak dialects of XML right now. Is this XML?\n\n // Look for an XML declaration\n if (isXML(responseText)) {\n fetcher.addStatus(options.req, 'Warning: ' + options.resource +\n \" has an XML declaration. We'll assume \" +\n \"it's XML but its content-type wasn't XML.\\n\")\n\n let xmlHandler = new XMLHandler(this.response)\n return xmlHandler.parse(fetcher, responseText, options)\n }\n\n // Look for an XML declaration\n if (responseText.slice(0, 500).match(/xmlns:/)) {\n fetcher.addStatus(options.req, \"May have an XML namespace. We'll assume \" +\n \"it's XML but its content-type wasn't XML.\\n\")\n\n let xmlHandler = new XMLHandler(this.response)\n return xmlHandler.parse(fetcher, responseText, options)\n }\n\n // We give up finding semantics - this is not an error, just no data\n fetcher.addStatus(options.req, 'Plain text document, no known RDF semantics.')\n\n return fetcher.doneFetch(options, this.response)\n }\n}\nTextHandler.pattern = new RegExp('text/plain')\n\nclass N3Handler extends Handler {\n static toString () {\n return 'N3Handler'\n }\n\n static register (fetcher: Fetcher) {\n fetcher.mediatypes['text/n3'] = {\n 'q': '1.0'\n } // as per 2008 spec\n /*\n fetcher.mediatypes['application/x-turtle'] = {\n 'q': 1.0\n } // pre 2008\n */\n fetcher.mediatypes['text/turtle'] = {\n 'q': 1.0\n } // post 2008\n }\n\n parse (\n fetcher: Fetcher,\n responseText: string,\n options: {\n original: NamedNode\n req: Quad_Subject\n } & Options,\n response: ExtendedResponse\n ): ExtendedResponse | Promise {\n // Parse the text of this N3 file\n let kb = fetcher.store\n let p = N3Parser(kb, kb, options.original.value, options.original.value,\n null, null, '', null)\n // p.loadBuf(xhr.responseText)\n try {\n p.loadBuf(responseText)\n } catch (err) {\n let msg = 'Error trying to parse ' + options.resource +\n ' as Notation3:\\n' + err // not err.stack -- irrelevant\n return fetcher.failFetch(options, msg, 'parse_error', response)\n }\n\n fetcher.addStatus(options.req, 'N3 parsed: ' + p.statementCount + ' triples in ' + p.lines + ' lines.')\n fetcher.store.add(options.original, ns.rdf('type'), ns.link('RDFDocument'), fetcher.appNode)\n\n return fetcher.doneFetch(options, this.response)\n }\n}\nN3Handler.pattern = new RegExp('(application|text)/(x-)?(rdf\\\\+)?(n3|turtle)')\n\nconst defaultHandlers = {\n RDFXMLHandler, XHTMLHandler, XMLHandler, HTMLHandler, TextHandler, N3Handler, JsonLdHandler\n}\n\nfunction isXHTML (responseText) {\n const docTypeStart = responseText.indexOf('')\n if (docTypeStart === -1 || docTypeEnd === -1 || docTypeStart > docTypeEnd) {\n return false\n }\n return responseText.substr(docTypeStart, docTypeEnd - docTypeStart).indexOf('XHTML') !== -1\n}\n\nfunction isXML (responseText: string): boolean {\n const match = responseText.match(/\\s*<\\?xml\\s+version\\s*=[^<>]+\\?>/)\n return !!match\n}\n\nfunction isXMLNS (responseText: string): boolean {\n const match = responseText.match(/[^(/)\n return !!match\n}\n\ntype StatusValues =\n /** No record of web access or record reset */\n undefined |\n /** Has been requested, fetch in progress */\n true |\n /** Received, OK */\n 'done' |\n /** Not logged in */\n 401 |\n /** HTTP status unauthorized */\n 403 |\n /** Not found, resource does not exist */\n 404 |\n /** In attempt to counter CORS problems retried */\n 'redirected' |\n /** If it did fail */\n 'failed' |\n 'parse_error' |\n /**\n * URI is not a protocol Fetcher can deal with\n * other strings mean various other errors.\n */\n 'unsupported_protocol' |\n 'timeout' |\n /** Any other HTTP status code */\n number\n\ninterface MediatypesMap {\n [id: string]: {\n // Either string '1.0' or number 1.0 is allowed\n 'q'?: number | string\n };\n}\n\ninterface RequestedMap {\n [uri: string]: StatusValues\n}\n\ninterface TimeOutsMap {\n [uri: string]: number[]\n}\n\ninterface FetchQueue {\n [uri: string]: Promise\n}\n\ninterface FetchCallbacks {\n [uri: string]: UserCallback[]\n}\n\ninterface BooleanMap {\n [uri: string]: boolean\n}\n\n// Not sure about the shapes of this. Response? FetchError?\ntype Result = Response\n\n/** Differs from normal Fetch, has an extended Response type */\ntype Fetch = (input: RequestInfo, init?: RequestInit) => Promise;\n\ninterface CallbackifyInterface {\n fireCallbacks: Function\n}\n\n/** Fetcher\n *\n * The Fetcher object is a helper object for a quadstore\n * which turns it from an offline store to an online store.\n * The fetcher deals with loading data files rom the web,\n * figuring how to parse them. It will also refresh, remove, the data\n * and put back the data to the web.\n */\nexport default class Fetcher implements CallbackifyInterface {\n store: IndexedFormula\n timeout: number\n _fetch: Fetch\n mediatypes: MediatypesMap\n /** Denoting this session */\n appNode: NamedNode\n /**\n * this.requested[uri] states:\n * undefined no record of web access or records reset\n * true has been requested, fetch in progress\n * 'done' received, Ok\n * 401 Not logged in\n * 403 HTTP status unauthorized\n * 404 Resource does not exist. Can be created etc.\n * 'redirected' In attempt to counter CORS problems retried.\n * 'parse_error' Parse error\n * 'unsupported_protocol' URI is not a protocol Fetcher can deal with\n * other strings mean various other errors.\n */\n requested: RequestedMap\n /** List of timeouts associated with a requested URL */\n timeouts: TimeOutsMap\n /** Redirected from *key uri* to *value uri* */\n redirectedTo: Record\n fetchQueue: FetchQueue\n /** fetchCallbacks[uri].push(callback) */\n fetchCallbacks: FetchCallbacks\n /** Keep track of explicit 404s -> we can overwrite etc */\n nonexistent: BooleanMap\n lookedUp: BooleanMap\n handlers: Array\n ns: { [k: string]: (ln: string) => Quad_Predicate }\n static HANDLERS: {\n [handlerName: number]: Handler\n }\n static CONTENT_TYPE_BY_EXT: Record\n // TODO: Document this\n static crossSiteProxyTemplate: any\n\n /** Methods added by calling Util.callbackify in the constructor*/\n fireCallbacks!: Function\n\n constructor (store: IndexedFormula, options: Options = {}) {\n this.store = store || new IndexedFormula()\n this.ns = getNS(this.store.rdfFactory)\n this.timeout = options.timeout || 30000\n\n // solidFetcher is deprecated\n this._fetch = options.fetch\n || (typeof global !== 'undefined' && (global.solidFetcher || global.solidFetch))\n || (typeof window !== 'undefined' && (window.solidFetcher || window.solidFetch))\n || crossFetch\n if (!this._fetch) {\n throw new Error('No _fetch function available for Fetcher')\n }\n // This is the name of the graph we store all the HTTP metadata in\n this.appNode = this.store.sym('chrome://TheCurrentSession')\n // this.appNode = this.store.rdfFactory.blankNode() // Needs to have a URI in tests\n this.store.fetcher = this // Bi-linked\n this.requested = {}\n this.timeouts = {}\n this.redirectedTo = {}\n this.fetchQueue = {}\n this.fetchCallbacks = {}\n this.nonexistent = {}\n this.lookedUp = {}\n this.handlers = []\n this.mediatypes = {\n 'image/*': { 'q': 0.9 },\n '*/*': { 'q': 0.1 } // Must allow access to random content\n }\n\n // Util.callbackify(this, ['request', 'recv', 'headers', 'load', 'fail',\n // 'refresh', 'retract', 'done'])\n // In switching to fetch(), 'recv', 'headers' and 'load' do not make sense\n Util.callbackify(this, ['request', 'fail', 'refresh', 'retract', 'done'])\n\n Object.keys(options.handlers || defaultHandlers).map(key => this.addHandler(defaultHandlers[key]))\n }\n\n static crossSiteProxy (uri: string): undefined | any {\n if (Fetcher.crossSiteProxyTemplate) {\n return Fetcher.crossSiteProxyTemplate\n .replace('{uri}', encodeURIComponent(uri))\n } else {\n return undefined\n }\n }\n\n static offlineOverride (uri: string): string {\n // Map the URI to a localhost proxy if we are running on localhost\n // This is used for working offline, e.g. on planes.\n // Is the script itself is running in localhost, then access all\n // data in a localhost mirror.\n // Do not remove without checking with TimBL\n let requestedURI = uri\n\n var UI\n if (typeof window !== 'undefined' && window.panes && (UI = window.panes.UI) &&\n UI.preferences && UI.preferences.get('offlineModeUsingLocalhost')) {\n if (requestedURI.slice(0, 7) === 'http://' && requestedURI.slice(7, 17) !== 'localhost/') {\n requestedURI = 'http://localhost/' + requestedURI.slice(7)\n log.warn('Localhost kludge for offline use: actually getting <' +\n requestedURI + '>')\n } else {\n // log.warn(\"Localhost kludge NOT USED <\" + requestedURI + \">\")\n }\n } else {\n // log.warn(\"Localhost kludge OFF offline use: actually getting <\" +\n // requestedURI + \">\")\n }\n\n return requestedURI\n }\n\n static proxyIfNecessary (uri: string) {\n var UI\n if (\n typeof window !== 'undefined' &&\n (window as any).panes &&\n (UI = (window as any).panes.UI) &&\n UI.isExtension\n ) {\n return uri\n } // Extension does not need proxy\n\n if (typeof $SolidTestEnvironment !== 'undefined' &&\n $SolidTestEnvironment.localSiteMap) {\n // nested dictionaries of URI parts from origin down\n let hostpath = uri.split('/').slice(2) // the bit after the //\n\n const lookup = (parts, index) => {\n let z = index[parts.shift()]\n\n if (!z) { return null }\n\n if (typeof z === 'string') {\n return z + parts.join('/')\n }\n\n if (!parts) { return null }\n\n return lookup(parts, z)\n }\n\n const y = lookup(hostpath, $SolidTestEnvironment.localSiteMap)\n\n if (y) {\n return y\n }\n }\n\n // browser does 2014 on as https browser script not trusted\n // If the web app origin is https: then the mixed content rules\n // prevent it loading insecure http: stuff so we need proxy.\n if (Fetcher.crossSiteProxyTemplate &&\n typeof document !== 'undefined' && document.location &&\n ('' + document.location).slice(0, 6) === 'https:' && // origin is secure\n uri.slice(0, 5) === 'http:') { // requested data is not\n return Fetcher.crossSiteProxyTemplate\n .replace('{uri}', encodeURIComponent(uri))\n }\n\n return uri\n }\n\n /**\n * Tests whether the uri's protocol is supported by the Fetcher.\n * @param uri\n */\n static unsupportedProtocol (uri: string): boolean {\n let pcol = Uri.protocol(uri)\n\n return (pcol === 'tel' || pcol === 'mailto' || pcol === 'urn')\n }\n\n /** Decide on credentials using old XXHR api or new fetch() one\n * @param requestedURI\n * @param options\n */\n static setCredentials (requestedURI: string, options: Options = {}) {\n // 2014 CORS problem:\n // XMLHttpRequest cannot load http://www.w3.org/People/Berners-Lee/card.\n // A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin'\n // header when the credentials flag is true.\n // @ Many ontology files under http: and need CORS wildcard ->\n // can't have credentials\n if (options.credentials === undefined) { // Caller using new fetch convention\n if (options.withCredentials !== undefined) { // XHR style is what Fetcher specified before\n options.credentials = options.withCredentials ? 'include' : 'omit'\n } else {\n options.credentials = 'include' // default is to be logged on\n }\n }\n }\n\n /**\n * Promise-based load function\n *\n * Loads a web resource or resources into the store.\n *\n * A resource may be given as NamedNode object, or as a plain URI.\n * an array of resources will be given, in which they will be fetched in parallel.\n * By default, the HTTP headers are recorded also, in the same store, in a separate graph.\n * This allows code like editable() for example to test things about the resource.\n *\n * @param uri {Array|Array|RDFlibNamedNode|string}\n *\n * @param [options={}] {Object}\n *\n * @param [options.fetch] {Function}\n *\n * @param [options.referringTerm] {RDFlibNamedNode} Referring term, the resource which\n * referred to this (for tracking bad links)\n *\n * @param [options.contentType] {string} Provided content type (for writes)\n *\n * @param [options.forceContentType] {string} Override the incoming header to\n * force the data to be treated as this content-type (for reads)\n *\n * @param [options.force] {boolean} Load the data even if loaded before.\n * Also sets the `Cache-Control:` header to `no-cache`\n *\n * @param [options.baseURI=docuri] {Node|string} Original uri to preserve\n * through proxying etc (`xhr.original`).\n *\n * @param [options.proxyUsed] {boolean} Whether this request is a retry via\n * a proxy (generally done from an error handler)\n *\n * @param [options.withCredentials] {boolean} flag for XHR/CORS etc\n *\n * @param [options.clearPreviousData] {boolean} Before we parse new data,\n * clear old, but only on status 200 responses\n *\n * @param [options.noMeta] {boolean} Prevents the addition of various metadata\n * triples (about the fetch request) to the store\n *\n * @param [options.noRDFa] {boolean}\n *\n * @returns {Promise}\n */\n load >(\n uri: T,\n options: Options = {}\n ): T extends Array ? Promise : Promise {\n options = Object.assign({}, options) // Take a copy as we add stuff to the options!!\n if (uri instanceof Array) {\n return Promise.all(uri.map((x) => {\n return this.load(x, Object.assign({}, options)) as unknown as Promise\n })) as T extends Array ? Promise : Promise\n }\n\n const uriIn: NamedNode | string = uri as NamedNode\n\n let docuri = termValue(uriIn)\n docuri = docuri.split('#')[0]\n\n options = this.initFetchOptions(docuri, options)\n // if metadata flaged clear cache and removeDocument\n const meta = this.appNode\n const kb = this.store\n const requests = kb.statementsMatching(undefined, this.ns.link('requestedURI'), kb.sym(docuri), meta).map(st => st.subject)\n for (const request of requests) {\n const response = kb.any(request, this.ns.link('response'), null, meta) as Quad_Subject\n if (response != undefined) { // ts\n const quad = kb.statementsMatching(response, this.ns.link('outOfDate'), true as any, meta)\n kb.remove(quad)\n options.force = true\n options.clearPreviousData = true\n }\n }\n\n const initialisedOptions = this.initFetchOptions(docuri, options)\n\n return this.pendingFetchPromise(docuri, initialisedOptions.baseURI, initialisedOptions) as any\n }\n\n async pendingFetchPromise (\n uri: string,\n originalUri: string,\n options: AutoInitOptions\n ): Promise {\n let pendingPromise\n\n // Check to see if some request is already dealing with this uri\n if (!options.force && await this.fetchQueue[originalUri]) {\n pendingPromise = this.fetchQueue[originalUri]\n } else {\n pendingPromise = Promise\n .race([\n this.setRequestTimeout(uri, options),\n this.fetchUri(uri, options)\n ])\n this.fetchQueue[originalUri] = pendingPromise\n\n // Clean up the queued promise after a time, if it's resolved\n this.cleanupFetchRequest(originalUri, undefined, this.timeout)\n }\n\n return pendingPromise.then(x => {\n if (uri in this.timeouts) {\n this.timeouts[uri].forEach(clearTimeout)\n delete this.timeouts[uri]\n }\n return x\n })\n }\n\n /**\n * @param _options - DEPRECATED\n */\n cleanupFetchRequest (\n originalUri: string,\n _options,\n timeout: number\n ) {\n if (_options !== undefined) {\n console.warn(\"_options is deprecated\")\n }\n this.timeouts[originalUri] = (this.timeouts[originalUri] || []).concat(setTimeout(() => {\n if (!this.isPending(originalUri)) {\n delete this.fetchQueue[originalUri]\n }\n }, timeout) as unknown as number)\n }\n\n initFetchOptions (\n uri: string,\n options: Options\n ): AutoInitOptions {\n let kb = this.store\n\n let isGet = !options.method || options.method.toUpperCase() === 'GET'\n if (!isGet) {\n options.force = true\n }\n\n options.resource = kb.rdfFactory.namedNode(uri) // This might be proxified\n options.baseURI = options.baseURI || uri // Preserve though proxying etc\n options.original = kb.rdfFactory.namedNode(options.baseURI)\n options.req = kb.bnode()\n options.headers = options.headers || new Headers()\n\n if (options.contentType) {\n // @ts-ignore\n options.headers['content-type'] = options.contentType\n }\n\n if (options.force) {\n options.cache = 'no-cache'\n }\n\n let acceptString = this.acceptString()\n // @ts-ignore\n options.headers['accept'] = acceptString\n\n let requestedURI = Fetcher.offlineOverride(uri)\n options.requestedURI = requestedURI\n\n Fetcher.setCredentials(requestedURI, options)\n\n let actualProxyURI = Fetcher.proxyIfNecessary(requestedURI)\n if (requestedURI !== actualProxyURI) {\n options.proxyUsed = true\n }\n options.actualProxyURI = actualProxyURI\n\n return options as AutoInitOptions\n }\n\n /**\n * (The promise chain ends in either a `failFetch()` or a `doneFetch()`)\n *\n * @param docuri {string}\n * @param options {Object}\n *\n * @returns {Promise} fetch() result or an { error, status } object\n */\n fetchUri (docuri: string, options: AutoInitOptions): Promise {\n if (!docuri) {\n return Promise.reject(new Error('Cannot fetch an empty uri'))\n }\n\n if (Fetcher.unsupportedProtocol(docuri)) {\n return this.failFetch(options, 'fetcher: Unsupported protocol', 'unsupported_protocol')\n }\n\n let state = this.getState(docuri)\n\n if (!options.force) {\n if (state === 'fetched') { // URI already fetched and added to store\n return Promise.resolve(\n // @ts-ignore This is not a valid response object\n this.doneFetch(options, {\n status: 200,\n ok: true,\n statusText: 'Already loaded into quadstore.'\n })\n )\n }\n if (state === 'failed' && this.requested[docuri] === 404) { // Remember nonexistence\n let message = 'Previously failed: ' + this.requested[docuri]\n // @ts-ignore This is not a valid response object\n let dummyResponse: ExtendedResponse = {\n url: docuri,\n // This does not comply to Fetch spec, it can be a string value in rdflib\n status: this.requested[docuri] as number,\n statusText: message,\n responseText: message,\n headers: new Headers, // Headers() ???\n ok: false,\n body: null,\n bodyUsed: false,\n size: 0,\n timeout: 0\n }\n return this.failFetch(options, message,\n this.requested[docuri], dummyResponse)\n }\n } else {\n // options.force == true\n delete this.nonexistent[docuri]\n }\n\n this.fireCallbacks('request', [docuri])\n\n this.requested[docuri] = true // mark this uri as 'requested'\n\n if (!options.noMeta) {\n this.saveRequestMetadata(docuri, options)\n }\n\n let { actualProxyURI } = options\n\n // Map might get mistakenly added into headers\n // error TS2339: Property 'map' does not exist on type 'Headers'.\n /* let map\n if (options.headers && map in options.headers) {\n delete options.headers.map\n } */\n\n return this._fetch((actualProxyURI as string), options)\n .then(response => this.handleResponse(response, docuri, options),\n error => { // @@ handleError?\n // @ts-ignore Invalid response object\n let dummyResponse: ExtendedResponse = {\n url: actualProxyURI as string,\n status: 999, // @@ what number/string should fetch failures report?\n statusText: (error.name || 'network failure') + ': ' +\n (error.errno || error.code || error.type),\n responseText: error.message,\n headers: new Headers(), // Headers() ???\n ok: false,\n body: null,\n bodyUsed: false,\n size: 0,\n timeout: 0\n }\n // console.log('Fetcher: <' + actualProxyURI + '> Non-HTTP fetch exception: ' + error)\n return this.handleError(dummyResponse, docuri, options) // possible credentials retry\n // return this.failFetch(options, 'fetch failed: ' + error, 999, dummyResponse) // Fake status code: fetch exception\n\n // handleError expects a response so we fake some important bits.\n /*\n this.handleError(, docuri, options)\n */\n }\n )\n }\n\n /**\n * Asks for a doc to be loaded if necessary then calls back\n *\n * Calling methods:\n * nowOrWhenFetched (uri, userCallback)\n * nowOrWhenFetched (uri, options, userCallback)\n * nowOrWhenFetched (uri, referringTerm, userCallback, options) <-- old\n * nowOrWhenFetched (uri, referringTerm, userCallback) <-- old\n *\n * Options include:\n * referringTerm The document in which this link was found.\n * this is valuable when finding the source of bad URIs\n * force boolean. Never mind whether you have tried before,\n * load this from scratch.\n * forceContentType Override the incoming header to force the data to be\n * treated as this content-type.\n *\n * Callback function takes:\n *\n * ok True if the fetch worked, and got a 200 response.\n * False if any error happened\n *\n * errmessage Text error message if not OK.\n *\n * response The fetch Response object (was: XHR) if there was was one\n * includes response.status as the HTTP status if any.\n */\n nowOrWhenFetched (\n uriIn: string | NamedNode,\n p2?: UserCallback | Options,\n userCallback?: UserCallback,\n options: Options = {}\n ): void {\n const uri = termValue(uriIn)\n\n if (typeof p2 === 'function') {\n // nowOrWhenFetched (uri, userCallback)\n userCallback = p2\n } else if (typeof p2 === 'undefined') { // original calling signature\n // referringTerm = undefined\n } else if (isNamedNode(p2)) {\n // referringTerm = p2\n options.referringTerm = p2\n } else {\n // nowOrWhenFetched (uri, options, userCallback)\n options = p2\n }\n\n (this.load(uri, options) as Promise)\n .then((fetchResponse: ExtendedResponse) => {\n if (userCallback) {\n if (fetchResponse) {\n if ((fetchResponse as Response).ok) {\n userCallback(true, 'OK', fetchResponse)\n } else {\n let oops = 'HTTP error: Status ' + fetchResponse.status + ' (' + fetchResponse.statusText + ')'\n if (fetchResponse.responseText) {\n oops += ' ' + fetchResponse.responseText // not in 404, dns error, nock failure\n }\n userCallback(false, oops, fetchResponse)\n }\n } else {\n let oops = ('@@ nowOrWhenFetched: no response object!')\n userCallback(false, oops)\n }\n }\n }, function (err: FetchError) {\n var message = err.message || err.statusText\n message = 'Failed to load <' + uri + '> ' + message\n if (err.response && err.response.status) {\n message += ' status: ' + err.response.status\n }\n (userCallback as any)(false, message, err.response)\n })\n }\n\n /**\n * Records a status message (as a literal node) by appending it to the\n * request's metadata status collection.\n *\n */\n addStatus (req: BlankNode, statusMessage: string) {\n // \n let now = new Date()\n statusMessage = '[' + now.getHours() + ':' + now.getMinutes() + ':' +\n now.getSeconds() + '.' + now.getMilliseconds() + '] ' + statusMessage\n // \n let kb = this.store\n\n const statusNode = kb.the(req, this.ns.link('status'))\n if (isCollection(statusNode)) {\n statusNode.append(kb.rdfFactory.literal(statusMessage))\n } else {\n log.warn('web.js: No list to add to: ' + statusNode + ',' + statusMessage)\n }\n }\n\n /**\n * Records errors in the system on failure:\n *\n * - Adds an entry to the request status collection\n * - Adds an error triple with the fail message to the metadata\n * - Fires the 'fail' callback\n * - Rejects with an error result object, which has a response object if any\n */\n failFetch (\n options: {\n req: BlankNode\n original: Quad_Subject\n } & Options,\n errorMessage: string,\n statusCode: StatusValues,\n response?: ExtendedResponse\n ): Promise {\n this.addStatus(options.req, errorMessage)\n\n if (!options.noMeta) {\n this.store.add(\n options.original,\n this.ns.link('error'),\n this.store.rdfFactory.literal(errorMessage)\n )\n }\n\n let meth = (options.method || 'GET').toUpperCase()\n let isGet = meth === 'GET' || meth === 'HEAD'\n\n if (isGet) { // only cache the status code on GET or HEAD\n if (!(options as any).resource.equals(options.original)) {\n // console.log('@@ Recording failure ' + meth + ' original ' + options.original +option '( as ' + options.resource + ') : ' + statusCode)\n } else {\n // console.log('@@ Recording ' + meth + ' failure for ' + options.original + ': ' + statusCode)\n }\n this.requested[Uri.docpart(options.original.value)] = statusCode\n this.fireCallbacks('fail', [options.original.value, errorMessage])\n }\n\n var err: FetchError = new Error('Fetcher: ' + errorMessage)\n\n // err.ok = false // Is taken as a response, will work too @@ phase out?\n err.status = statusCode\n err.statusText = errorMessage\n err.response = response\n\n return Promise.reject(err)\n }\n\n // in the why part of the quad distinguish between HTML and HTTP header\n // Reverse is set iif the link was rev= as opposed to rel=\n linkData (\n originalUri: NamedNode,\n rel: string,\n uri: string,\n why: Quad_Graph,\n reverse?: boolean\n ) {\n if (!uri) return\n let kb = this.store\n let predicate\n // See http://www.w3.org/TR/powder-dr/#httplink for describedby 2008-12-10\n let obj = kb.rdfFactory.namedNode(Uri.join(uri, originalUri.value))\n\n if (rel === 'alternate' || rel === 'seeAlso' || rel === 'meta' ||\n rel === 'describedby') {\n if (obj.value === originalUri.value) { return }\n predicate = this.ns.rdfs('seeAlso')\n } else if (rel === 'type') {\n predicate = kb.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type')\n } else {\n // See https://www.iana.org/assignments/link-relations/link-relations.xml\n // Alas not yet in RDF yet for each predicate\n // encode space in e.g. rel=\"shortcut icon\"\n predicate = kb.rdfFactory.namedNode(\n Uri.join(encodeURIComponent(rel),\n 'http://www.iana.org/assignments/link-relations/')\n )\n }\n if (reverse) {\n kb.add(obj, predicate, originalUri, why)\n } else {\n kb.add(originalUri, predicate, obj, why)\n }\n }\n\n parseLinkHeader (\n linkHeader: string,\n originalUri: NamedNode,\n reqNode: Quad_Graph\n ): void {\n if (!linkHeader) { return }\n\n // const linkexp = /<[^>]*>\\s*(\\s*;\\s*[^()<>@,;:\"/[\\]?={} \\t]+=(([^()<>@,;:\"/[]?={} \\t]+)|(\"[^\"]*\")))*(,|$)/g\n // const paramexp = /[^()<>@,;:\"/[]?={} \\t]+=(([^()<>@,;:\"/[]?={} \\t]+)|(\"[^\"]*\"))/g\n\n // From https://www.dcode.fr/regular-expression-simplificator:\n // const linkexp = /<[^>]*>\\s*(\\s*;\\s*[^()<>@,;:\"/[\\]?={} t]+=[\"]))*[,$]/g\n // const paramexp = /[^\\\\<>@,;:\"\\/\\[\\]?={} \\t]+=[\"])/g\n // Original:\n const linkexp = /<[^>]*>\\s*(\\s*;\\s*[^()<>@,;:\"/[\\]?={} \\t]+=(([^\\(\\)<>@,;:\"\\/\\[\\]\\?={} \\t]+)|(\"[^\"]*\")))*(,|$)/g\n const paramexp = /[^\\(\\)<>@,;:\"\\/\\[\\]\\?={} \\t]+=(([^\\(\\)<>@,;:\"\\/\\[\\]\\?={} \\t]+)|(\"[^\"]*\"))/g\n\n const matches = linkHeader.match(linkexp)\n\n if (matches == null) return;\n\n for (let i = 0; i < matches.length; i++) {\n let split = matches[i].split('>')\n let href = split[0].substring(1)\n let ps = split[1]\n let s = ps.match(paramexp)\n if (s == null) return\n for (let j = 0; j < s.length; j++) {\n let p = s[j]\n let paramsplit = p.split('=')\n // var name = paramsplit[0]\n let rel = paramsplit[1].replace(/[\"']/g, '') // '\"\n this.linkData(originalUri, rel, href, reqNode)\n }\n }\n }\n\n doneFetch (\n options: {\n req: Quad_Subject,\n original: Quad_Subject\n } & Options,\n response: ExtendedResponse\n ): Response {\n this.addStatus(options.req, 'Done.')\n this.requested[options.original.value] = 'done'\n\n this.fireCallbacks('done', [options.original.value])\n\n response.req = options.req // Set the request meta blank node\n\n return response\n }\n\n /**\n * Note two nodes are now smushed\n * If only one was flagged as looked up, then the new node is looked up again,\n * which will make sure all the URIs are dereferenced\n */\n nowKnownAs (was: Quad_Subject, now: Quad_Subject): void {\n if (this.lookedUp[was.value]) {\n // Transfer userCallback\n if (!this.lookedUp[now.value]) {\n this.lookUpThing(now, was)\n }\n } else if (this.lookedUp[now.value]) {\n if (!this.lookedUp[was.value]) {\n this.lookUpThing(was, now)\n }\n }\n }\n\n /**\n * Writes back to the web what we have in the store for this uri\n */\n putBack (\n uri: NamedNode | string,\n options: Options = {}\n ): Promise {\n const uriSting = termValue(uri)\n let doc = new RDFlibNamedNode(uriSting).doc() // strip off #\n options.contentType = options[\"content-type\"] || options[\"Content-Type\"] || options.contentType || TurtleContentType\n if (options.contentType === 'application/ld+json') {\n return new Promise((resolve, reject) => {\n serialize(doc, this.store, doc.uri, options.contentType, (err, jsonString) => {\n if (err) {\n reject(err)\n } else {\n // @ts-ignore\n options.data = jsonString\n this.webOperation('PUT', uri, options)\n .then((res) => resolve(res))\n .catch((error) => reject(error))\n }\n })\n })\n }\n options.data = serialize(doc, this.store, doc.value, options.contentType) as string\n return this.webOperation('PUT', uriSting, options)\n }\n\n webCopy (here: string, there: string, contentType): Promise {\n return this.webOperation('GET', here)\n .then((result) => {\n return this.webOperation(\n 'PUT', // change to binary from text\n there, { data: result.responseText, contentType })\n })\n }\n\n delete (uri: string, options?: Options): Promise {\n return this.webOperation('DELETE', uri, options)\n .then(response => {\n this.requested[uri] = 404\n this.nonexistent[uri] = true\n this.unload(this.store.rdfFactory.namedNode(uri))\n\n return response\n })\n }\n\n /** Create an empty resource if it really does not exist\n * Be absolutely sure something does not exist before creating a new empty file\n * as otherwise existing could be deleted.\n * @param doc - The resource\n */\n async createIfNotExists (\n doc: RDFlibNamedNode,\n contentType = TurtleContentType,\n data = ''\n ): Promise {\n const fetcher = this\n try {\n var response = await fetcher.load(doc as NamedNode)\n } catch (err) {\n // @ts-ignore\n if (err.response.status === 404) {\n // console.log('createIfNotExists: doc does NOT exist, will create... ' + doc)\n try {\n response = await fetcher.webOperation('PUT', doc.value, {data, contentType})\n } catch (err) {\n // console.log('createIfNotExists doc FAILED: ' + doc + ': ' + err)\n throw err\n }\n delete fetcher.requested[doc.value] // delete cached 404 error\n // console.log('createIfNotExists doc created ok ' + doc)\n return response\n } else {\n // console.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + err)\n throw err\n }\n }\n // console.log('createIfNotExists: doc exists, all good: ' + doc)\n return response as Response\n }\n\n /**\n * @param parentURI URI of parent container\n * @param folderName - Optional folder name (slug)\n * @param data - Optional folder metadata\n */\n createContainer (\n parentURI: string,\n folderName: string,\n data: string\n ): Promise {\n let headers = {\n // Force the right mime type for containers\n 'content-type': TurtleContentType,\n 'link': this.ns.ldp('BasicContainer') + '; rel=\"type\"'\n }\n\n if (folderName) {\n headers['slug'] = folderName\n }\n\n // @ts-ignore These headers lack some of the required operators.\n let options: Options = { headers }\n\n if (data) {\n options.body = data\n }\n\n return this.webOperation('POST', parentURI, options)\n }\n\n invalidateCache (iri: string | NamedNode): void {\n const uri = termValue(iri)\n const fetcher = this\n // @ts-ignore\n if (fetcher.fetchQueue && fetcher.fetchQueue[uri]) {\n // console.log('Internal error - fetchQueue exists ' + uri)\n var promise = fetcher.fetchQueue[uri]\n if (promise['PromiseStatus'] === 'resolved') {\n delete fetcher.fetchQueue[uri]\n } else { // pending\n delete fetcher.fetchQueue[uri]\n // console.log('*** Fetcher: pending fetchQueue deleted ' + uri)\n }\n } if (fetcher.requested[uri] && fetcher.requested[uri] !== 'done' &&\n fetcher.requested[uri] !== 'failed' && fetcher.requested[uri] !== 404) {\n let msg = `Rdflib: fetcher: Destructive operation on <${fetcher.requested[uri]}> file being fetched! ` + uri\n console.error(msg)\n // alert(msg)\n } else {\n delete fetcher.requested[uri] // invalidate read cache -- @@ messes up logic if request in progress ??\n delete fetcher.nonexistent[uri]\n }\n }\n\n /**\n * A generic web operation, at the fetch() level.\n * does not involve the quad store.\n *\n * Returns promise of Response\n * If data is returned, copies it to response.responseText before returning\n */\n webOperation (\n method: HTTPMethods,\n uriIn: string | NamedNode,\n // Not sure about this type. Maybe this Options is different?\n options: Options = {}\n ): Promise {\n const uri = termValue(uriIn)\n options.method = method\n options.body = options.data || options.body\n options.force = true\n const fetcher = this\n\n if (options.body && !options.contentType) {\n throw new Error('Web operation sending data must have a defined contentType.')\n }\n if (options.contentType) {\n (options as any).headers = options.headers || {};\n (options as any).headers['content-type'] = options.contentType\n }\n Fetcher.setCredentials(uri, options)\n\n return new Promise(function (resolve, reject) {\n fetcher._fetch(uri, options).then(response => {\n if (response.ok) {\n if (method === 'PUT' || method === 'PATCH' || method === 'POST' || method === 'DELETE') {\n fetcher.invalidateCache (uri)\n } // response.body with Chrome can't be relied on\n if (response.text) { // Was: response.body https://github.com/linkeddata/rdflib.js/issues/506\n response.text().then(data => {\n response.responseText = data\n resolve(response)\n })\n } else {\n resolve(response)\n }\n } else {\n let msg = 'Web error: ' + response.status\n if (response.statusText) msg += ' (' + response.statusText + ')'\n msg += ' on ' + method + ' of <' + uri + '>'\n if (response.responseText) msg += ': ' + response.responseText\n let e2: FetchError = new Error(msg)\n e2.response = response\n reject(e2)\n }\n }, (err: Error) => {\n let msg = 'Fetch error for ' + method + ' of <' + uri + '>:' + err\n reject(new Error(msg))\n })\n })\n }\n\n /**\n * Looks up something.\n * Looks up all the URIs a things has.\n *\n * @param term - canonical term for the thing whose URI is\n * to be dereferenced\n * @param rterm - the resource which referred to this\n * (for tracking bad links)\n */\n lookUpThing (\n term: Quad_Subject,\n rterm: Quad_Subject\n ): Promise | Promise[] {\n let uris = this.store.uris(term) // Get all URIs\n uris = uris.map(u => Uri.docpart(u)) // Drop hash fragments\n\n uris.forEach(u => {\n this.lookedUp[u] = true\n })\n\n // @ts-ignore Recursive type\n return this.load(uris, { referringTerm: rterm })\n }\n\n /**\n * Looks up response header.\n *\n * @returns {Array|undefined} a list of header values found in a stored HTTP\n * response, or [] if response was found but no header found,\n * or undefined if no response is available.\n * Looks for { [] link:requestedURI ?uri; link:response [ httph:header-name ?value ] }\n */\n getHeader (\n doc: NamedNode,\n header: string\n ): undefined | string[] {\n const kb = this.store // look for the URI (AS A STRING NOT A NODE) for a stored request\n const docuri: string = doc.value\n const requests = kb.each(undefined, this.ns.link('requestedURI'), kb.rdfFactory.literal(docuri)) as Quad_Subject[]\n\n for (let r = 0; r < requests.length; r++) {\n let request = requests[r]\n if (request !== undefined) {\n let response = kb.any(request, this.ns.link('response')) as Quad_Subject\n if (response !== undefined && kb.anyValue(response, this.ns.http('status')) && (kb.anyValue(response, this.ns.http('status')) as string).startsWith('2')) {\n // Only look at success returns - not 401 error messagess etc\n let results = kb.each(response, this.ns.httph(header.toLowerCase()))\n\n if (results.length) {\n return results.map(v => { return v.value })\n }\n\n return []\n }\n }\n }\n return undefined\n }\n\n saveRequestMetadata (\n docuri: string,\n options: AutoInitOptions\n ) {\n let req = options.req\n let kb = this.store\n let rterm = options.referringTerm\n\n this.addStatus(options.req, 'Accept: ' + options.headers['accept'])\n\n if (isNamedNode(rterm)) {\n kb.add(kb.rdfFactory.namedNode(docuri), this.ns.link('requestedBy'), rterm, this.appNode)\n }\n\n if (options.original && options.original.value !== docuri) {\n kb.add(req, this.ns.link('orginalURI'), kb.rdfFactory.literal(options.original.value),\n this.appNode)\n }\n\n const now = new Date()\n const timeNow = '[' + now.getHours() + ':' + now.getMinutes() + ':' +\n now.getSeconds() + '] '\n\n kb.add(req, this.ns.rdfs('label'),\n kb.rdfFactory.literal(timeNow + ' Request for ' + docuri), this.appNode)\n // We store the docuri as a string, not as a node,\n // see https://github.com/linkeddata/rdflib.js/pull/427#pullrequestreview-447910061\n kb.add(req, this.ns.link('requestedURI'), kb.rdfFactory.literal(docuri), this.appNode)\n kb.add(req, this.ns.link('status'), kb.collection(), this.appNode)\n }\n\n saveResponseMetadata (\n response: Response,\n options: {\n req: BlankNode,\n resource: Quad_Subject\n } & Options\n ): BlankNode {\n const kb = this.store\n\n let responseNode = kb.bnode()\n\n kb.add(options.req, this.ns.link('response'), responseNode, this.appNode)\n kb.add(responseNode, this.ns.http('status'),\n kb.rdfFactory.literal(response.status as any), this.appNode)\n kb.add(responseNode, this.ns.http('statusText'),\n kb.rdfFactory.literal(response.statusText), this.appNode)\n\n // Save the response headers\n response.headers.forEach((value, header) => {\n kb.add(responseNode, this.ns.httph(header), this.store.rdfFactory.literal(value), this.appNode)\n\n if (header === 'content-type') {\n kb.add(\n options.resource,\n this.ns.rdf('type'),\n kb.rdfFactory.namedNode(Util.mediaTypeClass(value).value),\n this.appNode // responseNode\n )\n }\n })\n\n return responseNode\n }\n\n objectRefresh (term: NamedNode): void {\n let uris = this.store.uris(term) // Get all URIs\n if (typeof uris !== 'undefined') {\n for (let i = 0; i < uris.length; i++) {\n this.refresh(this.store.rdfFactory.namedNode(Uri.docpart(uris[i])))\n // what about rterm?\n }\n }\n }\n\n /* refresh Reload data from a given document\n **\n ** @param term - An RDF Named Node for the eodcument in question\n ** @param userCallback - A function userCallback(ok, message, response)\n */\n refresh (\n term: NamedNode,\n userCallback?: UserCallback\n ): void { // sources_refresh\n this.fireCallbacks('refresh', arguments)\n\n this.nowOrWhenFetched(term, { force: true, clearPreviousData: true },\n userCallback)\n }\n\n /* refreshIfExpired Conditional refresh if Expired\n **\n ** @param term - An RDF Named Node for the eodcument in question\n ** @param userCallback - A function userCallback(ok, message, response)\n */\n refreshIfExpired (\n term: NamedNode,\n userCallback: UserCallback\n ): void {\n let exp = this.getHeader(term, 'Expires')\n if (!exp || (new Date(exp[0]).getTime()) <= (new Date().getTime())) {\n this.refresh(term, userCallback)\n } else {\n userCallback(true, 'Not expired', {})\n }\n }\n\n retract (term: Quad_Graph) { // sources_retract\n this.store.removeMany(undefined, undefined, undefined, term)\n if (term.value) {\n delete this.requested[Uri.docpart(term.value)]\n }\n this.fireCallbacks('retract', arguments)\n }\n\n getState (docuri: string) {\n if (typeof this.requested[docuri] === 'undefined') {\n return 'unrequested'\n } else if (this.requested[docuri] === true) {\n return 'requested'\n } else if (this.requested[docuri] === 'done') {\n return 'fetched'\n } else if (this.requested[docuri] === 'redirected') {\n return this.getState(this.redirectedTo[docuri])\n } else { // An non-200 HTTP error status\n return 'failed'\n }\n }\n\n isPending (docuri: string) { // sources_pending\n // doing anyStatementMatching is wasting time\n // if it's not pending: false -> flailed\n // 'done' -> done 'redirected' -> redirected\n return this.requested[docuri] === true\n }\n\n unload (term: NamedNode) {\n this.store.removeDocument(term)\n delete this.requested[term.value] // So it can be load2ed again\n }\n\n addHandler (handler: typeof Handler) {\n this.handlers.push(handler);\n (handler as any).register(this)\n }\n\n retryNoCredentials (\n docuri: string,\n options\n ): Promise {\n // console.log('Fetcher: CORS: RETRYING with NO CREDENTIALS for ' + options.resource)\n\n options.retriedWithNoCredentials = true // protect against being called twice\n\n delete this.requested[docuri] // forget the original request happened\n delete this.fetchQueue[docuri]\n // Note: XHR property was withCredentials, but fetch property is just credentials\n let newOptions = Object.assign({}, options, { credentials: 'omit' })\n\n this.addStatus(options.req,\n 'Abort: Will retry with credentials SUPPRESSED to see if that helps')\n\n return this.load(docuri, newOptions) as Promise\n }\n\n /**\n * Tests whether a request is being made to a cross-site URI (for purposes\n * of retrying with a proxy)\n */\n isCrossSite (uri: string): boolean {\n // Mashup situation, not node etc\n if (typeof document === 'undefined' || !document.location) {\n return false\n }\n\n const hostpart = Uri.hostpart\n const here = '' + document.location\n return (hostpart(here) && hostpart(uri) && hostpart(here)) !== hostpart(uri)\n }\n\n /**\n * Called when there's a network error in fetch(), or a response\n * with status of 0.\n */\n handleError (\n response: ExtendedResponse | Error,\n docuri: string,\n options: AutoInitOptions\n ): Promise {\n if (this.isCrossSite(docuri)) {\n // Make sure we haven't retried already\n if (options.credentials && options.credentials === 'include' && !options.retriedWithNoCredentials) {\n return this.retryNoCredentials(docuri, options)\n }\n\n // Now attempt retry via proxy\n let proxyUri = Fetcher.crossSiteProxy(docuri)\n\n if (proxyUri && !options.proxyUsed) {\n // console.log('web: Direct failed so trying proxy ' + proxyUri)\n return this.redirectToProxy(proxyUri, options)\n }\n }\n\n var message\n if (response instanceof Error) {\n message = 'Fetch error: ' + response.message\n } else {\n message = response.statusText\n if (response.responseText) {\n message += ` ${response.responseText}`\n }\n }\n\n // This is either not a CORS error, or retries have been made\n return this.failFetch(options, message, (response as Response).status || 998, (response as Response))\n }\n\n // deduce some things from the HTTP transaction\n addType (\n rdfType: NamedNode,\n req: Quad_Subject,\n kb: IndexedFormula,\n locURI: string\n ): void { // add type to all redirected resources too\n let prev = req\n if (locURI) {\n var reqURI = kb.any(prev, this.ns.link('requestedURI'))\n if (reqURI && reqURI.value !== locURI) {\n kb.add(kb.rdfFactory.namedNode(locURI), this.ns.rdf('type'), rdfType, this.appNode)\n }\n }\n for (;;) {\n const doc = kb.any(prev, this.ns.link('requestedURI'))\n if (doc && doc.value) {\n kb.add(kb.rdfFactory.namedNode(doc.value), this.ns.rdf('type'), rdfType, this.appNode)\n } // convert Literal\n prev = kb.any(undefined, kb.rdfFactory.namedNode('http://www.w3.org/2007/ont/link#redirectedRequest'), prev) as Quad_Subject\n if (!prev) { break }\n var response = kb.any(prev, kb.rdfFactory.namedNode('http://www.w3.org/2007/ont/link#response'))\n if (!response) { break }\n var redirection = kb.any((response as NamedNode), kb.rdfFactory.namedNode('http://www.w3.org/2007/ont/http#status'))\n if (!redirection) { break }\n // @ts-ignore always true?\n if ((redirection !== '301') && (redirection !== '302')) { break }\n }\n }\n\n /**\n * Handle fetch() response\n */\n handleResponse (\n response: ExtendedResponse,\n docuri: string,\n options: AutoInitOptions\n ): Promise | ExtendedResponse {\n\n const kb = this.store\n const headers = (response as Response).headers\n\n const reqNode = options.req\n\n const responseNode = this.saveResponseMetadata(response, options)\n\n const contentType = this.normalizedContentType(options, headers) || ''\n let contentLocation = headers.get('content-location')\n\n // this.fireCallbacks('recv', xhr.args)\n // this.fireCallbacks('headers', [{uri: docuri, headers: xhr.headers}])\n\n // Check for masked errors (CORS, etc)\n if (response.status === 0) {\n // console.log('Masked error - status 0 for ' + docuri)\n return this.handleError(response, docuri, options)\n }\n\n if (response.status >= 400) {\n if (response.status === 404) {\n this.nonexistent[options.original.value] = true\n this.nonexistent[docuri] = true\n }\n\n return this.saveErrorResponse(response, responseNode)\n .then(() => {\n let errorMessage = options.resource + ' ' + response.statusText\n\n return this.failFetch(options, errorMessage, response.status, response)\n })\n }\n\n var diffLocation: null | string = null\n var absContentLocation: null | string = null\n if (contentLocation) {\n absContentLocation = Uri.join(contentLocation, docuri)\n if (absContentLocation !== docuri) {\n diffLocation = absContentLocation\n }\n }\n if (response.status === 200) {\n this.addType(this.ns.link('Document') as NamedNode, reqNode, kb, docuri)\n if (diffLocation) {\n this.addType(this.ns.link('Document') as NamedNode, reqNode, kb,\n diffLocation)\n }\n\n // Before we parse new data clear old but only on 200\n if (options.clearPreviousData) {\n // kb.removeDocument(options.resource)\n // only remove content, keep metatdata\n const sts = kb.statementsMatching(undefined, undefined, undefined, options.resource).slice() // Take a copy as this is the actual index\n for (let i = 0; i < sts.length; i++) {\n kb.removeStatement(sts[i])\n }\n }\n\n let isImage = contentType.includes('image/') ||\n contentType.includes('application/pdf')\n\n if (contentType && isImage) {\n this.addType(kb.rdfFactory.namedNode('http://purl.org/dc/terms/Image'), reqNode, kb,\n docuri)\n if (diffLocation) {\n this.addType(kb.rdfFactory.namedNode('http://purl.org/dc/terms/Image'), reqNode, kb,\n diffLocation)\n }\n }\n }\n\n // If we have already got the thing at this location, abort\n if (contentLocation) {\n if (!options.force && diffLocation && this.requested[absContentLocation as string] === 'done') {\n // we have already fetched this\n // should we smush too?\n // log.info(\"HTTP headers indicate we have already\" + \" retrieved \" +\n // xhr.resource + \" as \" + absContentLocation + \". Aborting.\")\n return this.doneFetch(options, response)\n }\n\n this.requested[absContentLocation as string] = true\n }\n\n this.parseLinkHeader(headers.get('link') as string, options.original, reqNode)\n\n let handler = this.handlerForContentType(contentType, response) as Handler\n\n if (!handler) {\n // Not a problem, we just don't extract data\n this.addStatus(reqNode, 'Fetch over. No data handled.')\n return this.doneFetch(options, response)\n }\n\n return response\n .text()\n // @ts-ignore Types seem right\n .then(responseText => {\n response.responseText = responseText\n return (handler as N3Handler).parse(this, responseText, options, response)\n })\n }\n\n saveErrorResponse (\n response: ExtendedResponse,\n responseNode: Quad_Subject\n ): Promise {\n let kb = this.store\n\n return response.text()\n .then(content => {\n if (content.length > 10) {\n kb.add(responseNode, this.ns.http('content'), kb.rdfFactory.literal(content), responseNode)\n }\n })\n }\n\n handlerForContentType (contentType: string, response: ExtendedResponse): Handler | null {\n if (!contentType) {\n return null\n }\n\n let Handler = this.handlers.find(handler => {\n return contentType.match(handler.pattern)\n })\n\n // @ts-ignore in practice all Handlers have constructors.\n return Handler ? new Handler(response) : null\n }\n\n guessContentType (uri: string): ContentType | undefined {\n return CONTENT_TYPE_BY_EXT[uri.split('.').pop() as string]\n }\n\n normalizedContentType (\n options: AutoInitOptions,\n headers: Headers\n ): ContentType | string | null {\n if (options.forceContentType) {\n return options.forceContentType\n }\n\n let contentType = headers.get('content-type')\n if (!contentType || contentType.includes('application/octet-stream')) {\n let guess = this.guessContentType(options.resource.value)\n\n if (guess) {\n return guess\n }\n }\n\n let protocol = Uri.protocol(options.resource.value) as string\n\n if (!contentType && ['file', 'chrome'].includes(protocol)) {\n return 'text/xml'\n }\n\n return contentType\n }\n\n /**\n * Sends a new request to the specified uri. (Extracted from `onerrorFactory()`)\n */\n redirectToProxy (\n newURI: string,\n options: AutoInitOptions\n ): Promise {\n this.addStatus(options.req, 'BLOCKED -> Cross-site Proxy to <' + newURI + '>')\n\n options.proxyUsed = true\n\n const kb = this.store\n const oldReq = options.req // request metadata blank node\n\n if (!options.noMeta) {\n kb.add(oldReq, this.ns.link('redirectedTo'), kb.rdfFactory.namedNode(newURI), oldReq)\n this.addStatus(oldReq, 'redirected to new request') // why\n }\n\n this.requested[options.resource.value] = 'redirected'\n this.redirectedTo[options.resource.value] = newURI\n\n let newOptions = Object.assign({}, options)\n newOptions.baseURI = options.resource.value\n\n return this.fetchUri(newURI, newOptions)\n .then(response => {\n if (!newOptions.noMeta) {\n kb.add(oldReq, this.ns.link('redirectedRequest'), newOptions.req, this.appNode)\n }\n\n return response\n })\n }\n\n setRequestTimeout (\n uri: string,\n options: {\n req: Quad_Subject\n original: Quad_Subject\n } & Options\n ): Promise {\n return new Promise((resolve) => {\n this.timeouts[uri] = (this.timeouts[uri] || []).concat(setTimeout(() => {\n if (this.isPending(uri) &&\n !options.retriedWithNoCredentials &&\n !options.proxyUsed) {\n resolve(this.failFetch(options, `Request to ${uri} timed out`, 'timeout'))\n }\n }, this.timeout) as unknown as number)\n })\n }\n\n addFetchCallback (\n uri: string,\n callback: UserCallback\n ): void {\n if (!this.fetchCallbacks[uri]) {\n this.fetchCallbacks[uri] = [callback]\n } else {\n this.fetchCallbacks[uri].push(callback)\n }\n }\n\n acceptString () {\n let acceptstring = ''\n\n for (let mediaType in this.mediatypes) {\n if (acceptstring !== '') {\n acceptstring += ', '\n }\n\n acceptstring += mediaType\n\n for (let property in this.mediatypes[mediaType]) {\n acceptstring += ';' + property + '=' + this.mediatypes[mediaType][property]\n }\n }\n\n return acceptstring\n }\n // var updatesVia = new $rdf.UpdatesVia(this) // Subscribe to headers\n// @@@@@@@@ This is turned off because it causes a websocket to be set up for ANY fetch\n// whether we want to track it ot not. including ontologies loaed though the XSSproxy\n}\n\nFetcher.HANDLERS = defaultHandlers\nFetcher.CONTENT_TYPE_BY_EXT = CONTENT_TYPE_BY_EXT\n","export default (function () {\r\n return {\r\n parseJSON: function (data, source, store) {\r\n var subject, predicate, object\r\n var bnodes = {}\r\n var why = store.sym(source)\r\n for (var x in data) {\r\n if (x.indexOf('_:') === 0) {\r\n if (bnodes[x]) {\r\n subject = bnodes[x]\r\n } else {\r\n subject = store.bnode(x)\r\n bnodes[x] = subject\r\n }\r\n } else {\r\n subject = store.sym(x)\r\n }\r\n var preds = data[x]\r\n for (var y in preds) {\r\n var objects = preds[y]\r\n predicate = store.sym(y)\r\n for (var z in objects) {\r\n var obj = objects[z]\r\n if (obj.type === 'uri') {\r\n object = store.sym(obj.value)\r\n store.add(subject, predicate, object, why)\r\n } else if (obj.type === 'BlankNode') {\r\n if (bnodes[obj.value]) {\r\n object = bnodes[obj.value]\r\n } else {\r\n object = store.bnode(obj.value)\r\n bnodes[obj.value] = object\r\n }\r\n store.add(subject, predicate, object, why)\r\n } else if (obj.type === 'Literal') {\r\n // var datatype\r\n if (obj.datatype) {\r\n object = store.literal(obj.value, undefined, store.sym(obj.datatype))\r\n } else if (obj.lang) {\r\n object = store.literal(obj.value, obj.lang)\r\n } else {\r\n object = store.literal(obj.value)\r\n }\r\n store.add(subject, predicate, object, why)\r\n } else {\r\n throw new Error('error: unexpected termtype: ' + z.type)\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n})()\r\n","import log from './log'\n\nexport default function queryToSPARQL (query) {\n var indent = 0\n function getSelect (query) {\n var str = addIndent() + 'SELECT '\n for (var i = 0; i < query.vars.length; i++) {\n str += query.vars[i] + ' '\n }\n str += '\\n'\n return str\n }\n\n function getPattern (pat) {\n var str = ''\n var st = pat.statements\n for (var x in st) {\n log.debug('Found statement: ' + st)\n str += addIndent() + st[x] + '\\n'\n }\n return str\n }\n\n function getConstraints (pat) {\n var str = ''\n for (var v in pat.constraints) {\n var foo = pat.constraints[v]\n str += addIndent() + 'FILTER ( ' + foo.describe(v) + ' ) ' + '\\n'\n }\n return str\n }\n\n function getOptionals (pat) {\n var str = ''\n for (var x = 0; x < pat.optional.length; x++) {\n // alert(pat.optional.termType)\n log.debug('Found optional query')\n str += addIndent() + 'OPTIONAL { ' + '\\n'\n indent++\n str += getPattern(pat.optional[x])\n str += getConstraints(pat.optional[x])\n str += getOptionals(pat.optional[x])\n indent--\n str += addIndent() + '}' + '\\n'\n }\n return str\n }\n\n function getWhere (pat) {\n var str = addIndent() + 'WHERE \\n' + '{ \\n'\n indent++\n str += getPattern(pat)\n str += getConstraints(pat)\n str += getOptionals(pat)\n indent--\n str += '}'\n return str\n }\n\n function addIndent () {\n var str = ''\n for (var i = 0; i < indent; i++) {\n str += ' '\n }\n return str\n }\n\n function getSPARQL (query) {\n return getSelect(query) + getWhere(query.pat)\n }\n\n return getSPARQL(query)\n}\n","// Converting between SPARQL queries and the $rdf query API\n/*\n\nfunction SQuery () {\n this.terms = []\n return this\n}\n\nSTerm.prototype.toString = STerm.val\nSQuery.prototype.add = function (str) {this.terms.push()}*/\n\nimport log from './log'\nimport { Query } from './query'\n\n/**\n * @SPARQL: SPARQL text that is converted to a query object which is returned.\n * @testMode: testing flag. Prevents loading of sources.\n */\nexport default function SPARQLToQuery (SPARQL, testMode, kb) {\n // AJAR_ClearTable()\n var variableHash = []\n function makeVar (name) {\n if (variableHash[name]) {\n return variableHash[name]\n }\n var newVar = kb.variable(name)\n variableHash[name] = newVar\n return newVar\n }\n\n // term type functions\n function isRealText (term) {\n return (typeof term === 'string' && term.match(/[^ \\n\\t]/))\n }\n function isVar (term) {\n return (typeof term === 'string' && term.match(/^[\\?\\$]/))\n }\n function fixSymbolBrackets (term) {\n if (typeof term === 'string') {\n return term.replace(/^</, '<').replace(/>$/, '>')\n } else {\n return term\n }\n }\n function isSymbol (term) {\n return (typeof term === 'string' && term.match(/^<[^>]*>$/))\n }\n function isBnode (term) {\n return (typeof term === 'string' && (term.match(/^_:/) || term.match(/^$/)))\n }\n function isPrefix (term) {\n return (typeof term === 'string' && term.match(/:$/))\n }\n function isPrefixedSymbol (term) {\n return (typeof term === 'string' && term.match(/^:|^[^_][^:]*:/))\n }\n function getPrefix (term) {\n var a = term.split(':')\n return a[0]\n }\n function getSuffix (term) {\n var a = term.split(':')\n return a[1]\n }\n function removeBrackets (term) {\n if (isSymbol(term)) {\n return term.slice(1, term.length - 1)\n } else {\n return term\n }\n }\n // takes a string and returns an array of strings and Literals in the place of literals\n function parseLiterals (str) {\n // var sin = (str.indexOf(/[ \\n]\\'/)==-1)?null:str.indexOf(/[ \\n]\\'/), doub = (str.indexOf(/[ \\n]\\\"/)==-1)?null:str.indexOf(/[ \\n]\\\"/)\n var sin = (str.indexOf(\"'\") === -1)\n ? null\n : str.indexOf(\"'\")\n var doub = (str.indexOf('\"') === -1)\n ? null\n : str.indexOf('\"')\n // alert(\"S: \"+sin+\" D: \"+doub)\n if (!sin && !doub) {\n var a = new Array(1)\n a[0] = str\n return a\n }\n var res = new Array(2)\n var br\n var ind\n if (!sin || (doub && doub < sin)) {\n br = '\"'\n ind = doub\n } else if (!doub || (sin && sin < doub)) {\n br = \"'\"\n ind = sin\n } else {\n log.error('SQARQL QUERY OOPS!')\n return res\n }\n res[0] = str.slice(0, ind)\n var end = str.slice(ind + 1).indexOf(br)\n if (end === -1) {\n log.error('SPARQL parsing error: no matching parentheses in literal ' + str)\n return str\n }\n // alert(str.slice(end + ind + 2).match(/^\\^\\^/))\n var end2\n if (str.slice(end + ind + 2).match(/^\\^\\^/)) {\n end2 = str.slice(end + ind + 2).indexOf(' ')\n // alert(end2)\n res[1] = kb.literal(\n str.slice(ind + 1, ind + 1 + end),\n kb.sym(removeBrackets(\n str.slice(ind + 4 + end, ind + 2 + end + end2))\n )\n )\n // alert(res[1].datatype.uri)\n res = res.concat(parseLiterals(str.slice(end + ind + 3 + end2)))\n } else if (str.slice(end + ind + 2).match(/^@/)) {\n end2 = str.slice(end + ind + 2).indexOf(' ')\n // alert(end2)\n res[1] = kb.literal(\n str.slice(ind + 1, ind + 1 + end),\n str.slice(ind + 3 + end, ind + 2 + end + end2), null\n )\n // alert(res[1].datatype.uri)\n res = res.concat(\n parseLiterals(str.slice(end + ind + 2 + end2))\n )\n } else {\n res[1] = kb.literal(str.slice(ind + 1, ind + 1 + end))\n log.info('Literal found: ' + res[1])\n res = res.concat(parseLiterals(str.slice(end + ind + 2))) // finds any other literals\n }\n return res\n }\n\n function spaceDelimit (str) {\n str = str.replace(/\\(/g, ' ( ')\n .replace(/\\)/g, ' ) ')\n .replace(//g, '> ')\n .replace(/{/g, ' { ')\n .replace(/}/g, ' } ')\n .replace(/[\\t\\n\\r]/g, ' ')\n .replace(/; /g, ' ; ')\n .replace(/\\. /g, ' . ')\n .replace(/, /g, ' , ')\n log.info('New str into spaceDelimit: \\n' + str)\n var res = []\n var br = str.split(' ')\n for (var x in br) {\n if (isRealText(br[x])) {\n res = res.concat(br[x])\n }\n }\n return res\n }\n\n function replaceKeywords (input) {\n var strarr = input\n for (var x = 0; x < strarr.length; x++) {\n if (strarr[x] === 'a') {\n strarr[x] = ''\n }\n if (strarr[x] === 'is' && strarr[x + 2] === 'of') {\n strarr.splice(x, 1)\n strarr.splice(x + 1, 1)\n var s = strarr[x - 1]\n strarr[x - 1] = strarr[x + 1]\n strarr[x + 1] = s\n }\n }\n return strarr\n }\n\n function toTerms (input) {\n var res = []\n for (var x = 0; x < input.length; x++) {\n if (typeof input[x] !== 'string') {\n res[x] = input[x]\n continue\n }\n input[x] = fixSymbolBrackets(input[x])\n if (isVar(input[x])) {\n res[x] = makeVar(input[x].slice(1))\n } else if (isBnode(input[x])) {\n log.info(input[x] + ' was identified as a bnode.')\n res[x] = kb.bnode()\n } else if (isSymbol(input[x])) {\n log.info(input[x] + ' was identified as a symbol.')\n res[x] = kb.sym(removeBrackets(input[x]))\n } else if (isPrefixedSymbol(input[x])) {\n log.info(input[x] + ' was identified as a prefixed symbol')\n if (prefixes[getPrefix(input[x])]) {\n res[x] = kb.sym(input[x] = prefixes[getPrefix(input[x])] +\n getSuffix(input[x]))\n } else {\n log.error('SPARQL error: ' + input[x] + ' with prefix ' +\n getPrefix(input[x]) + ' does not have a correct prefix entry.')\n res[x] = input[x]\n }\n } else {\n res[x] = input[x]\n }\n }\n return res\n }\n\n function tokenize (str) {\n var token1 = parseLiterals(str)\n var token2 = []\n for (var x in token1) {\n if (typeof token1[x] === 'string') {\n token2 = token2.concat(spaceDelimit(token1[x]))\n } else {\n token2 = token2.concat(token1[x])\n }\n }\n token2 = replaceKeywords(token2)\n log.info('SPARQL Tokens: ' + token2)\n return token2\n }\n\n // CASE-INSENSITIVE\n function arrayIndexOf (str, arr) {\n for (var i = 0; i < arr.length; i++) {\n if (typeof arr[i] !== 'string') {\n continue\n }\n if (arr[i].toLowerCase() === str.toLowerCase()) {\n return i\n }\n }\n // log.warn(\"No instance of \"+str+\" in array \"+arr)\n return null\n }\n\n // CASE-INSENSITIVE\n function arrayIndicesOf (str, arr) {\n var ind = []\n for (var i = 0; i < arr.length; i++) {\n if (typeof arr[i] !== 'string') {\n continue\n }\n if (arr[i].toLowerCase() === str.toLowerCase()) {\n ind.push(i)\n }\n }\n return ind\n }\n\n function setVars (input, query) {\n log.info('SPARQL vars: ' + input)\n for (var x in input) {\n if (isVar(input[x])) {\n log.info('Added ' + input[x] + ' to query variables from SPARQL')\n var v = makeVar(input[x].slice(1))\n query.vars.push(v)\n v.label = input[x].slice(1)\n } else {\n log.warn('Incorrect SPARQL variable in SELECT: ' + input[x])\n }\n }\n }\n\n function getPrefixDeclarations (input) {\n var prefInd = arrayIndicesOf('PREFIX', input)\n var res = []\n for (var i in prefInd) {\n var a = input[prefInd[i] + 1]\n var b = input[prefInd[i] + 2]\n if (!isPrefix(a)) {\n log.error('Invalid SPARQL prefix: ' + a)\n } else if (!isSymbol(b)) {\n log.error('Invalid SPARQL symbol: ' + b)\n } else {\n log.info('Prefix found: ' + a + ' -> ' + b)\n var pref = getPrefix(a)\n var symbol = removeBrackets(b)\n res[pref] = symbol\n }\n }\n return res\n }\n\n function getMatchingBracket (arr, open, close) {\n log.info('Looking for a close bracket of type ' + close + ' in ' + arr)\n var index = 0\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] === open) {\n index++\n }\n if (arr[i] === close) {\n index--\n }\n if (index < 0) {\n return i\n }\n }\n log.error('Statement had no close parenthesis in SPARQL query')\n return 0\n }\n\n function constraintGreaterThan (value) {\n this.describe = function (varstr) {\n return varstr + ' > ' + value.toNT()\n }\n this.test = function (term) {\n if (term.value.match(/[0-9]+(\\.[0-9]+)?([eE][+-]?[0-9]+)?/)) {\n return (parseFloat(term.value) > parseFloat(value))\n } else {\n return (term.toNT() > value.toNT())\n }\n }\n return this\n }\n\n function constraintLessThan (value) { // this is not the recommended usage. Should only work on literal, numeric, dateTime\n this.describe = function (varstr) {\n return varstr + ' < ' + value.toNT()\n }\n this.test = function (term) {\n // this.describe = function (varstr) { return varstr + \" < \"+value }\n if (term.value.match(/[0-9]+(\\.[0-9]+)?([eE][+-]?[0-9]+)?/)) {\n return (parseFloat(term.value) < parseFloat(value))\n } else {\n return (term.toNT() < value.toNT())\n }\n }\n return this\n }\n // This should only work on literals but doesn't.\n function ConstraintEqualTo (value) {\n this.describe = function (varstr) {\n return varstr + ' = ' + value.toNT()\n }\n this.test = function (term) {\n return value.equals(term)\n }\n return this\n }\n\n // value must be a literal\n function ConstraintRegexp (value) {\n this.describe = function (varstr) {\n return \"REGEXP( '\" + value + \"' , \" + varstr + ' )'\n }\n this.test = function (term) {\n var str = value\n // str = str.replace(/^//,\"\").replace(//$/,\"\")\n var rg = new RegExp(str)\n if (term.value) {\n return rg.test(term.value)\n } else {\n return false\n }\n }\n }\n\n function setConstraint (input, pat) {\n if (input.length === 3 && input[0].termType === 'Variable' &&\n (input[2].termType === 'NamedNode' || input[2].termType === 'Literal')) {\n if (input[1] === '=') {\n log.debug('Constraint added: ' + input)\n pat.constraints[input[0]] = new ConstraintEqualTo(input[2])\n } else if (input[1] === '>') {\n log.debug('Constraint added: ' + input)\n pat.constraints[input[0]] = new ConstraintEqualTo(input[2])\n } else if (input[1] === '<') {\n log.debug('Constraint added: ' + input)\n pat.constraints[input[0]] = new ConstraintEqualTo(input[2])\n } else {\n log.warn(\"I don't know how to handle the constraint: \" + input)\n }\n } else if (input.length === 6 && typeof input[0] === 'string' &&\n input[0].toLowerCase() === 'regexp' &&\n input[1] === '(' && input[5] === ')' && input[3] === ',' &&\n input[4].termType === 'Variable' && input[2].termType === 'Literal') {\n log.debug('Constraint added: ' + input)\n pat.constraints[input[4]] = new ConstraintRegexp(input[2].value)\n }\n // log.warn(\"I don't know how to handle the constraint: \"+input)\n // alert(\"length: \"+input.length+\" input 0 type: \"+input[0].termType+\" input 1: \"+input[1]+\" input[2] type: \"+input[2].termType)\n }\n\n function setOptional (terms, pat) {\n log.debug('Optional query: ' + terms + ' not yet implemented.')\n var opt = kb.formula()\n setWhere(terms, opt)\n pat.optional.push(opt)\n }\n\n function setWhere (input, pat) {\n var terms = toTerms(input)\n var end\n log.debug('WHERE: ' + terms)\n var opt\n // var opt = arrayIndicesOf(\"OPTIONAL\",terms)\n while (arrayIndexOf('OPTIONAL', terms)) {\n opt = arrayIndexOf('OPTIONAL', terms)\n log.debug('OPT: ' + opt + ' ' + terms[opt] + ' in ' + terms)\n if (terms[opt + 1] !== '{') {\n log.warn('Bad optional opening bracket in word ' + opt)\n }\n end = getMatchingBracket(terms.slice(opt + 2), '{', '}')\n if (end === -1) {\n log.error('No matching bracket in word ' + opt)\n } else {\n setOptional(terms.slice(opt + 2, opt + 2 + end), pat)\n // alert(pat.statements[0].toNT())\n opt = arrayIndexOf('OPTIONAL', terms)\n end = getMatchingBracket(terms.slice(opt + 2), '{', '}')\n terms.splice(opt, end + 3)\n }\n }\n log.debug('WHERE after optionals: ' + terms)\n while (arrayIndexOf('FILTER', terms)) {\n var filt = arrayIndexOf('FILTER', terms)\n if (terms[filt + 1] !== '(') {\n log.warn('Bad filter opening bracket in word ' + filt)\n }\n end = getMatchingBracket(terms.slice(filt + 2), '(', ')')\n if (end === -1) {\n log.error('No matching bracket in word ' + filt)\n } else {\n setConstraint(terms.slice(filt + 2, filt + 2 + end), pat)\n filt = arrayIndexOf('FILTER', terms)\n end = getMatchingBracket(terms.slice(filt + 2), '(', ')')\n terms.splice(filt, end + 3)\n }\n }\n log.debug('WHERE after filters and optionals: ' + terms)\n extractStatements(terms, pat)\n }\n\n function extractStatements (terms, formula) {\n var arrayZero = new Array(1)\n arrayZero[0] = -1 // this is just to add the beginning of the where to the periods index.\n var per = arrayZero.concat(arrayIndicesOf('.', terms))\n var stat = []\n for (var x = 0; x < per.length - 1; x++) {\n stat[x] = terms.slice(per[x] + 1, per[x + 1])\n }\n // Now it's in an array of statements\n for (x in stat) { // THIS MUST BE CHANGED FOR COMMA, SEMICOLON\n log.info('s+p+o ' + x + ' = ' + stat[x])\n var subj = stat[x][0]\n stat[x].splice(0, 1)\n var sem = arrayZero.concat(arrayIndicesOf(';', stat[x]))\n sem.push(stat[x].length)\n var stat2 = []\n for (var y = 0; y < sem.length - 1; y++) {\n stat2[y] = stat[x].slice(sem[y] + 1, sem[y + 1])\n }\n for (x in stat2) {\n log.info('p+o ' + x + ' = ' + stat[x])\n var pred = stat2[x][0]\n stat2[x].splice(0, 1)\n var com = arrayZero.concat(arrayIndicesOf(',', stat2[x]))\n com.push(stat2[x].length)\n var stat3 = []\n for (y = 0; y < com.length - 1; y++) {\n stat3[y] = stat2[x].slice(com[y] + 1, com[y + 1])\n }\n for (x in stat3) {\n var obj = stat3[x][0]\n log.info('Subj=' + subj + ' Pred=' + pred + ' Obj=' + obj)\n formula.add(subj, pred, obj)\n }\n }\n }\n }\n\n // ******************************* Body of SPARQLToQuery ***************************//\n log.info('SPARQL input: \\n' + SPARQL)\n var q = new Query()\n var sp = tokenize(SPARQL) // first tokenize everything\n var prefixes = getPrefixDeclarations(sp)\n if (!prefixes.rdf) {\n prefixes.rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'\n }\n if (!prefixes.rdfs) {\n prefixes.rdfs = 'http://www.w3.org/2000/01/rdf-schema#'\n }\n var selectLoc = arrayIndexOf('SELECT', sp)\n var whereLoc = arrayIndexOf('WHERE', sp)\n if (selectLoc < 0 || whereLoc < 0 || selectLoc > whereLoc) {\n log.error('Invalid or nonexistent SELECT and WHERE tags in SPARQL query')\n return false\n }\n setVars(sp.slice(selectLoc + 1, whereLoc), q)\n\n setWhere(sp.slice(whereLoc + 2, sp.length - 1), q.pat)\n\n if (testMode) {\n return q\n }\n\n for (var x in q.pat.statements) {\n var st = q.pat.statements[x]\n if (st.subject.termType === 'NamedNode') {\n if (kb.fetcher) {\n kb.fetcher.lookUpThing(st.subject, 'sparql:' + st.subject)\n }\n }\n if (st.object.termType === 'NamedNode') {\n if (kb.fetcher) {\n kb.fetcher.lookUpThing(st.object, 'sparql:' + st.object)\n }\n }\n }\n // alert(q.pat)\n return q\n// checkVars()\n// *******************************************************************//\n}\n","/* @file Update Manager Class\n**\n** 2007-07-15 original SPARQL Update module by Joe Presbrey \n** 2010-08-08 TimBL folded in Kenny's WEBDAV\n** 2010-12-07 TimBL added local file write code\n*/\nimport IndexedFormula from './store'\nimport { docpart, join as uriJoin } from './uri'\nimport Fetcher, { Options } from './fetcher'\nimport Namespace from './namespace'\nimport Serializer from './serializer'\nimport { isBlankNode, isStore } from './utils/terms'\nimport * as Util from './utils-js'\nimport Statement from './statement'\nimport RDFlibNamedNode from './named-node'\nimport { termValue } from './utils/termValue'\nimport { BlankNode, NamedNode, Quad, Quad_Graph, Quad_Object, Quad_Predicate, Quad_Subject, Term, } from './tf-types'\n\ninterface UpdateManagerFormula extends IndexedFormula {\n fetcher: Fetcher\n}\n\ntype CallBackFunction = (uri: string, ok: boolean, message: string, response: Error | Response) => {} | void\n\n/**\n* The UpdateManager is a helper object for a store.\n* Just as a Fetcher provides the store with the ability to read and write,\n* the Update Manager provides functionality for making small patches in real time,\n* and also looking out for concurrent updates from other agents\n*/\nexport default class UpdateManager {\n\n store: UpdateManagerFormula\n\n ifps: {}\n\n fps: {}\n\n /** Index of objects for coordinating incoming and outgoing patches */\n patchControl: []\n\n /** Object of namespaces */\n ns: any\n\n /**\n * @param store - The quadstore to store data and metadata. Created if not passed.\n */\n constructor(store?: IndexedFormula) {\n store = store || new IndexedFormula()\n if (store.updater) {\n throw new Error(\"You can't have two UpdateManagers for the same store\")\n }\n if (!(store as UpdateManagerFormula).fetcher) {\n (store as UpdateManagerFormula).fetcher = new Fetcher(store)\n }\n this.store = store as UpdateManagerFormula\n store.updater = this\n this.ifps = {}\n this.fps = {}\n this.ns = {}\n this.ns.link = Namespace('http://www.w3.org/2007/ont/link#')\n this.ns.http = Namespace('http://www.w3.org/2007/ont/http#')\n this.ns.httph = Namespace('http://www.w3.org/2007/ont/httph#')\n this.ns.ldp = Namespace('http://www.w3.org/ns/ldp#')\n this.ns.rdf = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')\n this.ns.rdfs = Namespace('http://www.w3.org/2000/01/rdf-schema#')\n this.ns.rdf = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')\n this.ns.owl = Namespace('http://www.w3.org/2002/07/owl#')\n\n this.patchControl = []\n }\n\n patchControlFor(doc: NamedNode) {\n if (!this.patchControl[doc.value]) {\n this.patchControl[doc.value] = []\n }\n return this.patchControl[doc.value]\n }\n\n isHttpUri(uri: string) {\n return (uri.slice(0, 4) === 'http')\n }\n\n /** Remove from the store HTTP authorization metadata\n * The editable function below relies on copies we have in the store\n * of the results of previous HTTP transactions. However, when\n * the user logs in, then that data misrepresents what would happen\n * if the user tried again.\n */\n flagAuthorizationMetadata(kb?: IndexedFormula) {\n if (!kb) {\n kb = this.store\n }\n const meta = kb.fetcher?.appNode\n const requests = kb.statementsMatching(undefined, this.ns.link('requestedURI'), undefined, meta).map(st => st.subject)\n for (const request of requests) {\n const response = kb.any(request, this.ns.link('response'), null, meta) as Quad_Subject\n if (response != undefined) { // ts\n kb.add(response, this.ns.link('outOfDate'), true as any, meta) // @@ Boolean is fine - fix types\n }\n }\n }\n\n /**\n * Tests whether a file is editable.\n * If the file has a specific annotation that it is machine written,\n * for safety, it is editable (this doesn't actually check for write access)\n * If the file has wac-allow and accept patch headers, those are respected.\n * and local write access is determined by those headers.\n * This async version not only looks at past HTTP requests, it also makes new ones if necessary.\n *\n * @returns The method string N3PATCH or SPARQL or DAV or\n * LOCALFILE or false if known, undefined if not known.\n */\n async checkEditable(uri: string | NamedNode, kb?: IndexedFormula): Promise {\n if (!uri) {\n return false // Eg subject is bnode, no known doc to write to\n }\n if (!kb) {\n kb = this.store\n }\n\n const initial = this.editable(uri, kb)\n if (initial !== undefined) {\n return initial\n }\n await kb.fetcher?.load(uri)\n const final = this.editable(uri, kb)\n // console.log(`Loaded ${uri} just to check editable, result: ${final}.`)\n return final\n }\n /**\n * Tests whether a file is editable.\n * If the file has a specific annotation that it is machine written,\n * for safety, it is editable (this doesn't actually check for write access)\n * If the file has wac-allow and accept patch headers, those are respected.\n * and local write access is determined by those headers.\n * This synchronous version only looks at past HTTP requests, does not make new ones.\n *\n * @returns The method string SPARQL or DAV or\n * LOCALFILE or false if known, undefined if not known.\n */\n editable(uri: string | NamedNode, kb?: IndexedFormula): string | boolean | undefined {\n if (!uri) {\n return false // Eg subject is bnode, no known doc to write to\n }\n if (!kb) {\n kb = this.store\n }\n uri = termValue(uri)\n\n if (!this.isHttpUri(uri as string)) {\n if (kb.holds(\n kb.rdfFactory.namedNode(uri),\n kb.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),\n kb.rdfFactory.namedNode('http://www.w3.org/2007/ont/link#MachineEditableDocument'))) {\n return 'LOCALFILE'\n }\n }\n\n var request\n var definitive = false\n const meta = kb.fetcher?.appNode\n // const kb = s\n\n // @ts-ignore passes a string to kb.each, which expects a term. Should this work?\n var requests = kb.each(undefined, this.ns.link('requestedURI'), docpart(uri), meta)\n var method: string\n for (var r = 0; r < requests.length; r++) {\n request = requests[r]\n if (request !== undefined) {\n const response = kb.any(request, this.ns.link('response'), null, meta) as Quad_Subject\n if (response !== undefined) { // ts\n\n const outOfDate = kb.anyJS(response, this.ns.link('outOfDate'), null, meta) as Quad_Subject\n if (outOfDate) continue\n\n var wacAllow = kb.anyValue(response, this.ns.httph('wac-allow'))\n if (wacAllow) {\n for (var bit of wacAllow.split(',')) {\n var lr = bit.split('=')\n if (lr[0].includes('user') && !lr[1].includes('write') && !lr[1].includes('append')) {\n // console.log(' editable? excluded by WAC-Allow: ', wacAllow)\n return false\n }\n }\n }\n var acceptPatch = kb.each(response, this.ns.httph('accept-patch'))\n if (acceptPatch.length) {\n for (let i = 0; i < acceptPatch.length; i++) {\n method = acceptPatch[i].value.trim()\n if (method.indexOf('text/n3') >= 0) return 'N3PATCH'\n if (method.indexOf('application/sparql-update') >= 0) return 'SPARQL'\n if (method.indexOf('application/sparql-update-single-match') >= 0) return 'SPARQL'\n }\n }\n var authorVia = kb.each(response, this.ns.httph('ms-author-via'))\n if (authorVia.length) {\n for (let i = 0; i < authorVia.length; i++) {\n method = authorVia[i].value.trim()\n if (method.indexOf('SPARQL') >= 0) {\n return 'SPARQL'\n }\n if (method.indexOf('DAV') >= 0) {\n return 'DAV'\n }\n }\n }\n\n if (!this.isHttpUri(uri as string)) {\n if (!wacAllow) return false;\n else return 'LOCALFILE';\n }\n\n var status = kb.each(response, this.ns.http('status'))\n if (status.length) {\n for (let i = 0; i < status.length; i++) {\n // @ts-ignore since statuses should be TFTerms, this should always be false\n if (status[i] === 200 || status[i] === 404) {\n definitive = true\n // return false // A definitive answer\n }\n }\n }\n } else {\n // console.log('UpdateManager.editable: No response for ' + uri + '\\n')\n }\n }\n }\n if (requests.length === 0) {\n // console.log('UpdateManager.editable: No request for ' + uri + '\\n')\n } else {\n if (definitive) {\n return false // We have got a request and it did NOT say editable => not editable\n }\n }\n // console.log('UpdateManager.editable: inconclusive for ' + uri + '\\n')\n return undefined // We don't know (yet) as we haven't had a response (yet)\n }\n\n anonymize(obj) {\n let anonymized = (obj.toNT().substr(0, 2) === '_:' && this.mentioned(obj))\n ? '?' + obj.toNT().substr(2)\n : obj.toNT();\n\n return anonymized;\n }\n\n anonymizeNT(stmt: Quad) {\n return this.anonymize(stmt.subject) + ' ' +\n this.anonymize(stmt.predicate) + ' ' +\n this.anonymize(stmt.object) + ' .'\n }\n\n nTriples(stmt) {\n return `${stmt.subject.toNT()} ${stmt.predicate.toNT()} ${stmt.object.toNT()} .`\n }\n\n /**\n * Returns a list of all bnodes occurring in a statement\n * @private\n */\n statementBnodes(st: Quad): BlankNode[] {\n return [st.subject, st.predicate, st.object].filter(function (x) {\n return isBlankNode(x)\n }) as BlankNode[]\n }\n\n /**\n * Returns a list of all bnodes occurring in a list of statements\n * @private\n */\n statementArrayBnodes(sts: ReadonlyArray) {\n var bnodes: BlankNode[] = []\n for (let i = 0; i < sts.length; i++) {\n bnodes = bnodes.concat(this.statementBnodes(sts[i]))\n }\n bnodes.sort() // in place sort - result may have duplicates\n var bnodes2: BlankNode[] = []\n for (let j = 0; j < bnodes.length; j++) {\n if (j === 0 || !bnodes[j].equals(bnodes[j - 1])) {\n bnodes2.push(bnodes[j])\n }\n }\n return bnodes2\n }\n\n /**\n * Makes a cached list of [Inverse-]Functional properties\n * @private\n */\n cacheIfps() {\n this.ifps = {}\n var a = this.store.each(undefined, this.ns.rdf('type'),\n this.ns.owl('InverseFunctionalProperty'))\n for (let i = 0; i < a.length; i++) {\n this.ifps[a[i].value] = true\n }\n this.fps = {}\n a = this.store.each(undefined, this.ns.rdf('type'), this.ns.owl('FunctionalProperty'))\n for (let i = 0; i < a.length; i++) {\n this.fps[a[i].value] = true\n }\n }\n\n /**\n * Returns a context to bind a given node, up to a given depth\n * @private\n */\n bnodeContext2(x, source, depth) {\n // Return a list of statements which indirectly identify a node\n // Depth > 1 if try further indirection.\n // Return array of statements (possibly empty), or null if failure\n var sts = this.store.statementsMatching(undefined, undefined, x, source) // incoming links\n var y\n var res\n for (let i = 0; i < sts.length; i++) {\n if (this.fps[sts[i].predicate.value]) {\n y = sts[i].subject\n if (!y.isBlank) {\n return [sts[i]]\n }\n if (depth) {\n res = this.bnodeContext2(y, source, depth - 1)\n if (res) {\n return res.concat([sts[i]])\n }\n }\n }\n }\n // outgoing links\n sts = this.store.statementsMatching(x, undefined, undefined, source)\n for (let i = 0; i < sts.length; i++) {\n if (this.ifps[sts[i].predicate.value]) {\n y = sts[i].object\n if (!y.isBlank) {\n return [sts[i]]\n }\n if (depth) {\n res = this.bnodeContext2(y, source, depth - 1)\n if (res) {\n return res.concat([sts[i]])\n }\n }\n }\n }\n return null // Failure\n }\n\n /**\n * Returns the smallest context to bind a given single bnode\n * @private\n */\n bnodeContext1(x, source) {\n // Return a list of statements which indirectly identify a node\n // Breadth-first\n for (var depth = 0; depth < 3; depth++) { // Try simple first\n var con = this.bnodeContext2(x, source, depth)\n if (con !== null) return con\n }\n // If we can't guarantee unique with logic just send all info about node\n return this.store.connectedStatements(x, source) // was:\n // throw new Error('Unable to uniquely identify bnode: ' + x.toNT())\n }\n\n /**\n * @private\n */\n mentioned(x) {\n return this.store.statementsMatching(x, null, null, null).length !== 0 || // Don't pin fresh bnodes\n this.store.statementsMatching(null, x).length !== 0 ||\n this.store.statementsMatching(null, null, x).length !== 0\n }\n\n /**\n * @private\n */\n bnodeContext(bnodes, doc) {\n var context = []\n if (bnodes.length) {\n this.cacheIfps()\n for (let i = 0; i < bnodes.length; i++) { // Does this occur in old graph?\n var bnode = bnodes[i]\n if (!this.mentioned(bnode)) continue\n context = context.concat(this.bnodeContext1(bnode, doc))\n }\n }\n return context\n }\n\n /**\n * Returns the best context for a single statement\n * @private\n */\n statementContext(st: Quad) {\n var bnodes = this.statementBnodes(st)\n return this.bnodeContext(bnodes, st.graph)\n }\n\n /**\n * @private\n */\n contextWhere(context) {\n var updater = this\n return (!context || context.length === 0)\n ? ''\n : 'WHERE { ' +\n context.map(function (x) {\n return updater.anonymizeNT(x)\n }).join('\\n') + ' }\\n'\n }\n\n /**\n * @private\n */\n fire(\n uri: string,\n query: string,\n callbackFunction: CallBackFunction,\n options: Options = {}\n ): Promise {\n return Promise.resolve()\n .then(() => {\n if (!uri) {\n throw new Error('No URI given for remote editing operation: ' + query)\n }\n // console.log('UpdateManager: sending update to <' + uri + '>')\n\n options.noMeta = true;\n options.contentType = options.contentType || 'application/sparql-update';\n options.body = query;\n\n return this.store.fetcher.webOperation('PATCH', uri, options)\n })\n .then(response => {\n if (!response.ok) {\n let message = 'UpdateManager: update failed for <' + uri + '> status=' +\n response.status + ', ' + response.statusText +\n '\\n for query: ' + query\n // console.log(message)\n throw new Error(message)\n }\n\n // console.log('UpdateManager: update Ok for <' + uri + '>')\n\n callbackFunction(uri, response.ok, response.responseText as string, response)\n })\n .catch(err => {\n callbackFunction(uri, false, err.message, err)\n })\n }\n\n // ARE THESE THREE FUNCTIONS USED? DEPRECATE?\n\n /** return a statemnet updating function\n *\n * This does NOT update the statement.\n * It returns an object which includes\n * function which can be used to change the object of the statement.\n */\n update_statement(statement: Quad) {\n if (statement && !statement.graph) {\n return\n }\n var updater = this\n var context = this.statementContext(statement)\n\n return {\n statement: statement ? [statement.subject, statement.predicate, statement.object, statement.graph] : undefined,\n statementNT: statement ? this.anonymizeNT(statement) : undefined,\n where: updater.contextWhere(context),\n\n set_object: function (obj, callbackFunction) {\n var query = this.where\n query += 'DELETE DATA { ' + this.statementNT + ' } ;\\n'\n query += 'INSERT DATA { ' +\n // @ts-ignore `this` might refer to the wrong scope. Does this work?\n this.anonymize(this.statement[0]) + ' ' +\n // @ts-ignore\n this.anonymize(this.statement[1]) + ' ' +\n // @ts-ignore\n this.anonymize(obj) + ' ' + ' . }\\n'\n\n updater.fire((this.statement as [Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph])[3].value, query, callbackFunction)\n }\n }\n }\n\n insert_statement(st: Quad, callbackFunction: CallBackFunction): void {\n var st0 = st instanceof Array ? st[0] : st\n var query = this.contextWhere(this.statementContext(st0))\n\n if (st instanceof Array) {\n var stText = ''\n for (let i = 0; i < st.length; i++) stText += st[i] + '\\n'\n query += 'INSERT DATA { ' + stText + ' }\\n'\n } else {\n query += 'INSERT DATA { ' +\n this.anonymize(st.subject) + ' ' +\n this.anonymize(st.predicate) + ' ' +\n this.anonymize(st.object) + ' ' + ' . }\\n'\n }\n\n this.fire(st0.graph.value, query, callbackFunction)\n }\n\n delete_statement(st: Quad | Quad[], callbackFunction: CallBackFunction): void {\n var st0 = st instanceof Array ? st[0] : st\n var query = this.contextWhere(this.statementContext(st0))\n\n if (st instanceof Array) {\n var stText = ''\n for (let i = 0; i < st.length; i++) stText += st[i] + '\\n'\n query += 'DELETE DATA { ' + stText + ' }\\n'\n } else {\n query += 'DELETE DATA { ' +\n this.anonymize(st.subject) + ' ' +\n this.anonymize(st.predicate) + ' ' +\n this.anonymize(st.object) + ' ' + ' . }\\n'\n }\n\n this.fire(st0.graph.value, query, callbackFunction)\n }\n\n /// //////////////////////\n\n /**\n * Requests a now or future action to refresh changes coming downstream\n * This is designed to allow the system to re-request the server version,\n * when a websocket has pinged to say there are changes.\n * If the websocket, by contrast, has sent a patch, then this may not be necessary.\n *\n * @param doc\n * @param action\n */\n requestDownstreamAction(doc: NamedNode, action): void {\n var control = this.patchControlFor(doc)\n if (!control.pendingUpstream) {\n action(doc)\n } else {\n if (control.downstreamAction) {\n if ('' + control.downstreamAction !== '' + action) { // Kludge compare\n throw new Error(\"Can't wait for > 1 different downstream actions\")\n }\n } else {\n control.downstreamAction = action\n }\n }\n }\n\n /**\n * We want to start counting websocket notifications\n * to distinguish the ones from others from our own.\n */\n clearUpstreamCount(doc: NamedNode): void {\n var control = this.patchControlFor(doc)\n control.upstreamCount = 0\n }\n\n getUpdatesVia(doc: NamedNode): string | null {\n var linkHeaders = this.store.fetcher.getHeader(doc, 'updates-via')\n if (!linkHeaders || !linkHeaders.length) return null\n return linkHeaders[0].trim()\n }\n\n addDownstreamChangeListener(doc: NamedNode, listener): void {\n var control = this.patchControlFor(doc)\n if (!control.downstreamChangeListeners) { control.downstreamChangeListeners = [] }\n control.downstreamChangeListeners.push(listener)\n this.setRefreshHandler(doc, (doc: NamedNode) => {\n this.reloadAndSync(doc)\n })\n }\n\n reloadAndSync(doc: NamedNode): void {\n var control = this.patchControlFor(doc)\n var updater = this\n\n if (control.reloading) {\n // console.log(' Already reloading - note this load may be out of date')\n control.outOfDate = true\n return // once only needed @@ Not true, has changed again\n }\n control.reloading = true\n var retryTimeout = 1000 // ms\n var tryReload = function () {\n // console.log('try reload - timeout = ' + retryTimeout)\n updater.reload(updater.store, doc, function (ok, message, response) {\n if (ok) {\n if (control.downstreamChangeListeners) {\n for (let i = 0; i < control.downstreamChangeListeners.length; i++) {\n // console.log(' Calling downstream listener ' + i)\n control.downstreamChangeListeners[i]()\n }\n }\n control.reloading = false\n if (control.outOfDate) {\n // console.log(' Extra reload because of extra update.')\n control.outOfDate = false\n tryReload()\n }\n } else {\n control.reloading = false\n if (response && (response as Response).status === 0) {\n // console.log('Network error refreshing the data. Retrying in ' +\n // retryTimeout / 1000)\n control.reloading = true\n retryTimeout = retryTimeout * 2\n setTimeout(tryReload, retryTimeout)\n } else {\n // console.log('Error ' + (response as Response).status + 'refreshing the data:' +\n // message + '. Stopped' + doc)\n }\n }\n })\n }\n tryReload()\n }\n\n /**\n * Sets up websocket to listen on\n *\n * There is coordination between upstream changes and downstream ones\n * so that a reload is not done in the middle of an upstream patch.\n * If you use this API then you get called when a change happens, and you\n * have to reload the file yourself, and then refresh the UI.\n * Alternative is addDownstreamChangeListener(), where you do not\n * have to do the reload yourself. Do mot mix them.\n *\n * kb contains the HTTP metadata from previous operations\n *\n * @param doc\n * @param handler\n *\n * @returns {boolean}\n */\n setRefreshHandler(doc: NamedNode, handler): boolean {\n let wssURI = this.getUpdatesVia(doc) // relative\n // var kb = this.store\n var theHandler = handler\n var self = this\n var updater = this\n var retryTimeout = 1500 // *2 will be 3 Seconds, 6, 12, etc\n var retries = 0\n\n if (!wssURI) {\n // console.log('Server does not support live updates through Updates-Via :-(')\n return false\n }\n\n wssURI = uriJoin(wssURI, doc.value)\n const validWssURI = wssURI.replace(/^http:/, 'ws:').replace(/^https:/, 'wss:')\n // console.log('Web socket URI ' + wssURI)\n\n var openWebsocket = function () {\n // From https://github.com/solid/solid-spec#live-updates\n var socket\n if (typeof WebSocket !== 'undefined') {\n socket = new WebSocket(validWssURI)\n } else if (typeof window !== 'undefined' && window.WebSocket) {\n socket = (window as any).WebSocket(validWssURI)\n } else {\n // console.log('Live update disabled, as WebSocket not supported by platform :-(')\n return\n }\n socket.onopen = function () {\n // console.log(' websocket open')\n retryTimeout = 1500 // reset timeout to fast on success\n this.send('sub ' + doc.value)\n if (retries) {\n // console.log('Web socket has been down, better check for any news.')\n updater.requestDownstreamAction(doc, theHandler)\n }\n }\n var control = self.patchControlFor(doc)\n control.upstreamCount = 0\n\n socket.onerror = function onerror(err: Error) {\n // console.log('Error on Websocket:', err)\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent\n //\n // 1000 CLOSE_NORMAL Normal closure; the connection successfully completed whatever purpose for which it was created.\n // 1001 CLOSE_GOING_AWAY The endpoint is going away, either\n // because of a server failure or because the browser is navigating away from the page that opened the connection.\n // 1002 CLOSE_PROTOCOL_ERROR The endpoint is terminating the connection due to a protocol error.\n // 1003 CLOSE_UNSUPPORTED The connection is being terminated because the endpoint\n // received data of a type it cannot accept (for example, a text-only endpoint received binary data).\n // 1004 Reserved. A meaning might be defined in the future.\n // 1005 CLOSE_NO_STATUS Reserved. Indicates that no status code was provided even though one was expected.\n // 1006 CLOSE_ABNORMAL Reserved. Used to indicate that a connection was closed abnormally (\n //\n //\n socket.onclose = function (event: CloseEvent) {\n // console.log('*** Websocket closed with code ' + event.code +\n // \", reason '\" + event.reason + \"' clean = \" + event.wasClean)\n retryTimeout *= 2\n retries += 1\n // console.log('Retrying in ' + retryTimeout + 'ms') // (ask user?)\n setTimeout(function () {\n // console.log('Trying websocket again')\n openWebsocket()\n }, retryTimeout)\n }\n socket.onmessage = function (msg: MessageEvent) {\n if (msg.data && msg.data.slice(0, 3) === 'pub') {\n if ('upstreamCount' in control) {\n control.upstreamCount -= 1\n if (control.upstreamCount >= 0) {\n // console.log('just an echo: ' + control.upstreamCount)\n return // Just an echo\n }\n }\n // console.log('Assume a real downstream change: ' + control.upstreamCount + ' -> 0')\n control.upstreamCount = 0\n self.requestDownstreamAction(doc, theHandler)\n }\n }\n } // openWebsocket\n openWebsocket()\n\n return true\n }\n\n /**\n * This high-level function updates the local store iff the web is changed successfully.\n * Deletions, insertions may be undefined or single statements or lists or formulae (may contain bnodes which can be indirectly identified by a where clause).\n * The `why` property of each statement must be the give the web document to be updated.\n * The statements to be deleted and inserted may span more than one web document.\n * @param deletions - Statement or statements to be deleted.\n * @param insertions - Statement or statements to be inserted.\n * @returns a promise\n */\n updateMany(\n deletions: ReadonlyArray,\n insertions: ReadonlyArray = []\n ): Promise {\n const docs = deletions.concat(insertions).map(st => st.why)\n const thisUpdater = this\n const uniqueDocs: Array = []\n docs.forEach(doc => {\n if (!uniqueDocs.find(uniqueDoc => uniqueDoc.equals(doc))) uniqueDocs.push(doc as NamedNode)\n })\n const updates = uniqueDocs.map(doc =>\n thisUpdater.update(deletions.filter(st => st.why.equals(doc)),\n insertions.filter(st => st.why.equals(doc))))\n if (updates.length > 1) {\n // console.log(`@@ updateMany to ${updates.length}: ${uniqueDocs}`)\n }\n return Promise.all(updates)\n }\n\n /**\n * @private\n * \n * This helper function constructs SPARQL Update query from resolved arguments.\n * \n * @param ds: deletions array.\n * @param is: insertions array.\n * @param bnodes_context: Additional context to uniquely identify any blank nodes.\n */\n constructSparqlUpdateQuery(\n ds: ReadonlyArray,\n is: ReadonlyArray,\n bnodes_context,\n ): string {\n var whereClause = this.contextWhere(bnodes_context)\n var query = ''\n if (whereClause.length) { // Is there a WHERE clause?\n if (ds.length) {\n query += 'DELETE { '\n for (let i = 0; i < ds.length; i++) {\n query += this.anonymizeNT(ds[i]) + '\\n'\n }\n query += ' }\\n'\n }\n if (is.length) {\n query += 'INSERT { '\n for (let i = 0; i < is.length; i++) {\n query += this.anonymizeNT(is[i]) + '\\n'\n }\n query += ' }\\n'\n }\n query += whereClause\n } else { // no where clause\n if (ds.length) {\n query += 'DELETE DATA { '\n for (let i = 0; i < ds.length; i++) {\n query += this.anonymizeNT(ds[i]) + '\\n'\n }\n query += ' } \\n'\n }\n if (is.length) {\n if (ds.length) query += ' ; '\n query += 'INSERT DATA { '\n for (let i = 0; i < is.length; i++) {\n query += this.nTriples(is[i]) + '\\n'\n }\n query += ' }\\n'\n }\n }\n return query;\n }\n\n /**\n * @private\n * \n * This helper function constructs n3-patch query from resolved arguments.\n * \n * @param ds: deletions array.\n * @param is: insertions array.\n * @param bnodes_context: Additional context to uniquely identify any blanknodes.\n */\n constructN3PatchQuery(\n ds: ReadonlyArray,\n is: ReadonlyArray,\n bnodes_context,\n ): string {\n var query = `\n@prefix solid: .\n@prefix ex: .\n\n_:patch\n`;\n // If bnode context is non trivial, express it as ?conditions formula.\n if (bnodes_context && bnodes_context.length > 0) {\n query += `\n solid:where {\n ${bnodes_context.map((x) => this.anonymizeNT(x)).join('\\n ')}\n };`\n }\n if (ds.length > 0) {\n query += `\n solid:deletes {\n ${ds.map((x) => this.anonymizeNT(x)).join('\\n ')}\n };`\n }\n if (is.length > 0) {\n query += `\n solid:inserts {\n ${is.map((x) => this.anonymizeNT(x)).join('\\n ')}\n };`\n }\n query += \" a solid:InsertDeletePatch .\\n\"\n\n return query;\n }\n\n /**\n * This high-level function updates the local store if the web is changed successfully.\n * Deletions, insertions may be undefined or single statements or lists or formulae (may contain bnodes which can be indirectly identified by a where clause).\n * The `why` property of each statement must be the same and give the web document to be updated.\n * @param deletions - Statement or statements to be deleted.\n * @param insertions - Statement or statements to be inserted.\n * @param callback - called as callbackFunction(uri, success, errorbody)\n * OR returns a promise\n * @param options - Options for the fetch call\n */\n update(\n deletions: ReadonlyArray,\n insertions: ReadonlyArray,\n callback?: (\n uri: string | undefined | null,\n success: boolean,\n errorBody?: string,\n response?: Response | Error\n ) => void,\n secondTry?: boolean,\n options: Options = {}\n ): void | Promise {\n if (!callback) {\n var thisUpdater = this\n return new Promise(function (resolve, reject) { // Promise version\n thisUpdater.update(deletions, insertions, function (uri, ok, errorBody) {\n if (!ok) {\n reject(new Error(errorBody))\n } else {\n resolve()\n }\n }, secondTry, options) // callbackFunction\n }) // promise\n } // if\n\n try {\n var kb = this.store\n var ds = !deletions ? []\n : isStore(deletions) ? deletions.statements\n : deletions instanceof Array ? deletions : [deletions]\n var is = !insertions ? []\n : isStore(insertions) ? insertions.statements\n : insertions instanceof Array ? insertions : [insertions]\n if (!(ds instanceof Array)) {\n throw new Error('Type Error ' + (typeof ds) + ': ' + ds)\n }\n if (!(is instanceof Array)) {\n throw new Error('Type Error ' + (typeof is) + ': ' + is)\n }\n if (ds.length === 0 && is.length === 0) {\n return callback(null, true) // success -- nothing needed to be done.\n }\n var doc = ds.length ? ds[0].graph : is[0].graph\n if (!doc) {\n let message = 'Error patching: statement does not specify which document to patch:' + ds[0] + ', ' + is[0]\n // console.log(message)\n throw new Error(message)\n }\n if (doc.termType !== 'NamedNode') {\n let message = 'Error patching: document not a NamedNode:' + ds[0] + ', ' + is[0]\n // console.log(message)\n throw new Error(message)\n }\n var control = this.patchControlFor(doc)\n\n var startTime = Date.now()\n\n var props = ['subject', 'predicate', 'object', 'why']\n var verbs = ['insert', 'delete']\n var clauses = { 'delete': ds, 'insert': is }\n verbs.map(function (verb) {\n clauses[verb].map(function (st: Quad) {\n if (!doc.equals(st.graph)) {\n throw new Error('update: destination ' + doc +\n ' inconsistent with delete quad ' + st.graph)\n }\n props.map(function (prop) {\n if (typeof st[prop] === 'undefined') {\n throw new Error('update: undefined ' + prop + ' of statement.')\n }\n })\n })\n })\n\n var protocol = this.editable(doc.value, kb);\n\n if (protocol === false) {\n throw new Error('Update: Can\\'t make changes in uneditable ' + doc)\n }\n if (protocol === undefined) { // Not enough metadata\n if (secondTry) {\n throw new Error('Update: Loaded ' + doc + \"but still can't figure out what editing protocol it supports.\")\n }\n // console.log(`Update: have not loaded ${doc} before: loading now...`);\n (this.store.fetcher.load(doc as NamedNode) as Promise).then(response => {\n this.update(deletions, insertions, callback, true, options)\n }, err => {\n if (err.response.status === 404) { // nonexistent files are fine\n this.update(deletions, insertions, callback, true, options)\n } else {\n throw new Error(`Update: Can't get updatability status ${doc} before patching: ${err}`)\n }\n })\n return\n } else if ((protocol as string).indexOf('SPARQL') >= 0 || (protocol as string).indexOf('N3PATCH') >= 0) {\n var isSparql = (protocol as string).indexOf('SPARQL') >= 0\n\n var bnodes: BlankNode[] = []\n // change ReadOnly type to Mutable type\n type Mutable = {\n -readonly [Key in keyof Type]: Type[Key];\n }\n\n if (ds.length) bnodes = this.statementArrayBnodes(ds as Mutable)\n if (is.length) bnodes = bnodes.concat(this.statementArrayBnodes(is as Mutable))\n var context = this.bnodeContext(bnodes, doc)\n\n var query = isSparql ? this.constructSparqlUpdateQuery(ds, is, context) : this.constructN3PatchQuery(ds, is, context);\n options.contentType = isSparql ? 'application/sparql-update' : 'text/n3' \n \n // Track pending upstream patches until they have finished their callbackFunction\n control.pendingUpstream = control.pendingUpstream ? control.pendingUpstream + 1 : 1\n if ('upstreamCount' in control) {\n control.upstreamCount += 1 // count changes we originated ourselves\n // console.log('upstream count up to : ' + control.upstreamCount)\n }\n\n this.fire(doc.value, query, (uri, success, body, response) => {\n (response as any).elapsedTimeMs = Date.now() - startTime\n /* console.log(' UpdateManager: Return ' +\n (success ? 'success ' : 'FAILURE ') + (response as Response).status +\n ' elapsed ' + (response as any).elapsedTimeMs + 'ms')\n */\n if (success) {\n try {\n kb.remove(ds as Mutable)\n } catch (e) {\n success = false\n body = 'Remote Ok BUT error deleting ' + ds.length + ' from store!!! ' + e\n } // Add in any case -- help recover from weirdness??\n for (let i = 0; i < is.length; i++) {\n kb.add(is[i].subject, is[i].predicate, is[i].object, doc)\n }\n }\n\n callback(uri, success, body, response)\n control.pendingUpstream -= 1\n // When upstream patches have been sent, reload state if downstream waiting\n if (control.pendingUpstream === 0 && control.downstreamAction) {\n var downstreamAction = control.downstreamAction\n delete control.downstreamAction\n // console.log('delayed downstream action:')\n downstreamAction(doc)\n }\n }, options)\n } else if ((protocol as string).indexOf('DAV') >= 0) {\n this.updateDav(doc as NamedNode, ds, is, callback, options)\n } else {\n if ((protocol as string).indexOf('LOCALFILE') >= 0) {\n try {\n this.updateLocalFile(doc as NamedNode, ds, is, callback, options)\n } catch (e) {\n callback(doc.value, false,\n 'Exception trying to write back file <' + doc.value + '>\\n'\n // + tabulator.Util.stackString(e))\n )\n }\n } else {\n throw new Error(\"Unhandled edit method: '\" + protocol + \"' for \" + doc)\n }\n }\n } catch (e) {\n callback(undefined, false, 'Exception in update: ' + e + '\\n' +\n Util.stackString(e))\n }\n }\n\n updateDav(\n doc: Quad_Subject,\n ds,\n is,\n callbackFunction,\n options: Options = {}\n ): null | Promise {\n let kb = this.store\n // The code below is derived from Kenny's UpdateCenter.js\n var request = kb.any(doc, this.ns.link('request'))\n if (!request) {\n throw new Error('No record of our HTTP GET request for document: ' +\n doc)\n } // should not happen\n var response = kb.any(request as NamedNode, this.ns.link('response')) as Quad_Subject\n if (!response) {\n return null // throw \"No record HTTP GET response for document: \"+doc\n }\n var contentType = (kb.the(response, this.ns.httph('content-type')) as Term).value\n\n // prepare contents of revised document\n let newSts = kb.statementsMatching(undefined, undefined, undefined, doc).slice() // copy!\n for (let i = 0; i < ds.length; i++) {\n Util.RDFArrayRemove(newSts, ds[i])\n }\n for (let i = 0; i < is.length; i++) {\n newSts.push(is[i])\n }\n\n const documentString = this.serialize(doc.value, newSts, contentType)\n\n // Write the new version back\n var candidateTarget = kb.the(response, this.ns.httph('content-location'))\n var targetURI\n if (candidateTarget) {\n targetURI = uriJoin(candidateTarget.value, targetURI)\n }\n\n options.contentType = contentType\n options.noMeta = true\n options.body = documentString\n\n return kb.fetcher.webOperation('PUT', targetURI, options)\n .then(response => {\n if (!response.ok) {\n throw new Error(response.error)\n }\n\n for (let i = 0; i < ds.length; i++) {\n kb.remove(ds[i])\n }\n for (let i = 0; i < is.length; i++) {\n kb.add(is[i].subject, is[i].predicate, is[i].object, doc)\n }\n\n callbackFunction(doc.value, response.ok, response.responseText, response)\n })\n .catch(err => {\n callbackFunction(doc.value, false, err.message, err)\n })\n }\n\n /**\n * Likely deprecated, since this lib no longer deals with browser extension\n *\n * @param doc\n * @param ds\n * @param is\n * @param callbackFunction\n * @param options\n */\n updateLocalFile(doc: NamedNode, ds, is, callbackFunction, options: Options = {}): void {\n const kb = this.store\n // console.log('Writing back to local file\\n')\n\n // prepare contents of revised document\n let newSts = kb.statementsMatching(undefined, undefined, undefined, doc).slice() // copy!\n\n for (let i = 0; i < ds.length; i++) {\n Util.RDFArrayRemove(newSts, ds[i])\n }\n for (let i = 0; i < is.length; i++) {\n newSts.push(is[i])\n }\n // serialize to the appropriate format\n var dot = doc.value.lastIndexOf('.')\n if (dot < 1) {\n throw new Error('Rewriting file: No filename extension: ' + doc.value)\n }\n var ext = doc.value.slice(dot + 1)\n\n let contentType = Fetcher.CONTENT_TYPE_BY_EXT[ext]\n if (!contentType) {\n throw new Error('File extension .' + ext + ' not supported for data write')\n }\n\n options.body = this.serialize(doc.value, newSts, contentType);\n options.contentType = contentType;\n\n kb.fetcher.webOperation('PUT', doc.value, options).then((response) => {\n if (!response.ok) return callbackFunction(doc.value, false, response.error)\n for (let i = 0; i < ds.length; i++) {\n kb.remove(ds[i]);\n }\n for (let i = 0; i < is.length; i++) {\n kb.add(is[i].subject, is[i].predicate, is[i].object, doc);\n }\n callbackFunction(doc.value, true, '') // success!\n })\n }\n\n /**\n * @throws {Error} On unsupported content type\n *\n * @returns {string}\n */\n serialize(uri: string, data: string | Quad[], contentType: string): string {\n const kb = this.store\n let documentString\n\n if (typeof data === 'string') {\n return data\n }\n\n // serialize to the appropriate format\n var sz = Serializer(kb)\n sz.suggestNamespaces(kb.namespaces)\n sz.setBase(uri)\n switch (contentType) {\n case 'text/xml':\n case 'application/rdf+xml':\n documentString = sz.statementsToXML(data)\n break\n case 'text/n3':\n case 'text/turtle':\n case 'application/x-turtle': // Legacy\n case 'application/n3': // Legacy\n documentString = sz.statementsToN3(data)\n break\n default:\n throw new Error('Content-type ' + contentType +\n ' not supported for data serialization')\n }\n\n return documentString\n }\n\n /**\n * This is suitable for an initial creation of a document.\n */\n put(\n doc: RDFlibNamedNode,\n data: string | Quad[],\n contentType: string,\n callback: (uri: string, ok: boolean, errorMessage?: string, response?: unknown) => void,\n ): Promise {\n const kb = this.store\n let documentString: string\n\n return Promise.resolve()\n .then(() => {\n documentString = this.serialize(doc.value, data, contentType)\n\n return kb.fetcher\n .webOperation('PUT', doc.value, { contentType, body: documentString })\n })\n .then(response => {\n if (!response.ok) {\n return callback(doc.value, response.ok, response.error, response)\n }\n\n delete kb.fetcher.nonexistent[doc.value]\n delete kb.fetcher.requested[doc.value] // @@ could this mess with the requested state machine? if a fetch is in progress\n\n if (typeof data !== 'string') {\n data.map((st) => {\n kb.addStatement(st)\n })\n }\n\n callback(doc.value, response.ok, '', response)\n })\n .catch(err => {\n callback(doc.value, false, err.message)\n })\n }\n\n /**\n * Reloads a document.\n *\n * Fast and cheap, no metadata. Measure times for the document.\n * Load it provisionally.\n * Don't delete the statements before the load, or it will leave a broken\n * document in the meantime.\n *\n * @param kb\n * @param doc {RDFlibNamedNode}\n * @param callbackFunction\n */\n reload(\n kb: IndexedFormula,\n doc: docReloadType,\n callbackFunction: (ok: boolean, message?: string, response?: Error | Response) => {} | void\n ): void {\n var startTime = Date.now()\n // force sets no-cache and\n const options = {\n force: true,\n noMeta: true,\n clearPreviousData: true,\n };\n\n (kb as any).fetcher.nowOrWhenFetched(doc.value, options, function (ok: boolean, body: Body, response: Response) {\n if (!ok) {\n // console.log(' ERROR reloading data: ' + body)\n callbackFunction(false, 'Error reloading data: ' + body, response)\n //@ts-ignore Where does onErrorWasCalled come from?\n } else if (response.onErrorWasCalled || response.status !== 200) {\n // console.log(' Non-HTTP error reloading data! onErrorWasCalled=' +\n //@ts-ignore Where does onErrorWasCalled come from?\n // response.onErrorWasCalled + ' status: ' + response.status)\n callbackFunction(false, 'Non-HTTP error reloading data: ' + body, response)\n } else {\n var elapsedTimeMs = Date.now() - startTime\n\n if (!doc.reloadTimeTotal) doc.reloadTimeTotal = 0\n if (!doc.reloadTimeCount) doc.reloadTimeCount = 0\n\n doc.reloadTimeTotal += elapsedTimeMs\n doc.reloadTimeCount += 1\n\n // console.log(' Fetch took ' + elapsedTimeMs + 'ms, av. of ' +\n // doc.reloadTimeCount + ' = ' +\n // (doc.reloadTimeTotal / doc.reloadTimeCount) + 'ms.')\n\n callbackFunction(true)\n }\n })\n }\n}\n\ninterface docReloadType extends NamedNode {\n reloadTimeCount?: number\n reloadTimeTotal?: number\n}\n","import {\n IRDFlibDataFactory,\n} from '../types'\nimport Literal from '../literal'\nimport Statement from '../statement'\nimport IndexedFormula from '../store'\nimport Fetcher from '../fetcher'\nimport ExtendedTermFactory from './extended-term-factory'\nimport { NamedNode, Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph } from '../tf-types'\n\n/** Full RDFLib.js Data Factory */\nconst RDFlibDataFactory: IRDFlibDataFactory = {\n ...ExtendedTermFactory,\n\n /**\n * Creates a new fetcher\n * @param store - The store to use\n * @param options - The options\n */\n fetcher (store: IndexedFormula, options: any): Fetcher {\n return new Fetcher(store, options)\n },\n\n /**\n * Creates a new graph (store)\n */\n graph (features = undefined, opts = undefined): IndexedFormula {\n return new IndexedFormula(features, opts || {rdfFactory: ExtendedTermFactory})\n },\n\n /**\n * Creates a new literal node\n * @param val The lexical value\n * @param lang The language\n * @param dt The datatype\n */\n lit (val: string, lang?: string, dt?: NamedNode): Literal {\n return this.literal('' + val, lang || dt)\n },\n\n /**\n * Creates a new statement\n * @param subject The subject\n * @param predicate The predicate\n * @param object The object\n * @param graph The containing graph\n */\n st (\n subject: Quad_Subject,\n predicate: Quad_Predicate,\n object: Quad_Object,\n graph?: Quad_Graph\n ): Statement {\n return this.quad(subject, predicate, object, graph)\n },\n}\n\nexport default RDFlibDataFactory\n","/*\n * Updates-Via\n */\nimport DataFactory from './factories/rdflib-data-factory'\n\nexport class UpdatesSocket {\n constructor (parent, via) {\n this.parent = parent\n this.via = via\n this.connected = false\n this.pending = {}\n this.subscribed = {}\n this.socket = {}\n try {\n this.socket = new WebSocket(via)\n this.socket.onopen = this.onOpen\n this.socket.onclose = this.onClose\n this.socket.onmessage = this.onMessage\n this.socket.onerror = this.onError\n } catch (error) {\n this.onError(error)\n }\n }\n _decode (q) {\n var elt\n var i\n var k\n var r\n var ref\n var ref1\n var v\n r = {}\n ref = (function () {\n var j, len, ref, results\n ref = q.split('&')\n results = []\n for (j = 0, len = ref.length; j < len; j++) {\n elt = ref[j]\n results.push(elt.split('='))\n }\n return results\n })()\n for (i in ref) {\n elt = ref[i]\n ref1 = [decodeURIComponent(elt[0]), decodeURIComponent(elt[1])]\n k = ref1[0]\n v = ref1[1]\n if (r[k] == null) {\n r[k] = []\n }\n r[k].push(v)\n }\n return r\n }\n _send (method, uri, data) {\n var base, message\n message = [method, uri, data].join(' ')\n return typeof (base = this.socket).send === 'function' ? base.send(message) : void 0\n }\n _subscribe (uri) {\n this._send('sub', uri, '')\n this.subscribed[uri] = true\n return this.subscribed[uri]\n }\n onClose (e) {\n var uri\n this.connected = false\n for (uri in this.subscribed) {\n this.pending[uri] = true\n }\n this.subscribed = {}\n return this.subscribed\n }\n onError (e) {\n throw new Error('onError' + e)\n }\n onMessage (e) {\n var base, message\n message = e.data.split(' ')\n if (message[0] === 'ping') {\n return typeof (base = this.socket).send === 'function' ? base.send('pong ' + message.slice(1).join(' ')) : void 0\n } else if (message[0] === 'pub') {\n return this.parent.onUpdate(message[1], this._decode(message[2]))\n }\n }\n onOpen (e) {\n var results, uri\n this.connected = true\n results = []\n for (uri in this.pending) {\n delete this.pending[uri]\n results.push(this._subscribe(uri))\n }\n return results\n }\n subscribe (uri) {\n if (this.connected) {\n return this._subscribe(uri)\n } else {\n this.pending[uri] = true\n return this.pending[uri]\n }\n }\n}\n\nexport class UpdatesVia {\n constructor (fetcher) {\n this.fetcher = fetcher\n this.graph = {}\n this.via = {}\n this.fetcher.addCallback('headers', this.onHeaders)\n }\n onHeaders (d) {\n var etag, uri, via\n if (d.headers == null) {\n return true\n }\n if (typeof WebSocket === 'undefined' || WebSocket === null) {\n return true\n }\n etag = d.headers['etag']\n via = d.headers['updates-via']\n uri = d.uri\n if (etag && via) {\n this.graph[uri] = {\n etag: etag,\n via: via\n }\n this.register(via, uri)\n }\n return true\n }\n onUpdate (uri, d) {\n return this.fetcher.refresh(DataFactory.namedNode(uri))\n }\n register (via, uri) {\n if (this.via[via] == null) {\n this.via[via] = new UpdatesSocket(this, via)\n }\n return this.via[via].subscribe(uri)\n }\n}\n","import { IRDFlibDataFactory } from './types'\n\nimport BlankNode from './blank-node'\nimport Collection from './collection'\nimport Empty from './empty'\nimport Fetcher from './fetcher'\nimport Formula from './formula'\nimport Store from './store'\nimport jsonParser from './jsonparser'\nimport Literal from './literal'\nimport log from './log'\nimport N3Parser from './n3parser'\nimport NamedNode from './named-node'\nimport Namespace from './namespace'\nimport Node from './node'\nimport parse from './parse'\nimport { Query } from './query'\nimport queryToSPARQL from './query-to-sparql'\nimport RDFaProcessor from './rdfaparser'\nimport RDFParser from './rdfxmlparser'\nimport serialize from './serialize'\nimport Serializer from './serializer'\nimport SPARQLToQuery from './sparql-to-query'\nimport sparqlUpdateParser from './patch-parser'\nimport Statement from './statement'\nimport UpdateManager from './update-manager'\nimport { UpdatesSocket } from './updates-via'\nimport { UpdatesVia } from './updates-via'\nimport * as uri from './uri'\nimport * as Util from './utils-js'\nimport Variable from './variable'\nimport DataFactory from './factories/rdflib-data-factory'\n\n// Prepare bound versions of data factory methods for export\nconst boundDataFactory = {} as IRDFlibDataFactory\nfor (const name in DataFactory) {\n if (typeof DataFactory[name] === 'function')\n boundDataFactory[name] = DataFactory[name].bind(DataFactory);\n}\nconst {\n fetcher,\n graph,\n lit,\n st,\n namedNode,\n variable,\n blankNode,\n defaultGraph,\n literal,\n quad,\n triple,\n} = boundDataFactory\n\nconst formula = new Formula();\nconst fromNT = str => formula.fromNT(str);\n\nconst term = Node.fromValue\n\n// TODO: this export is broken;\n// it exports the _current_ value of nextId, which is always 0\nconst NextId = BlankNode.nextId\n\nexport * from './utils/terms'\nexport type { AutoInitOptions, ExtendedResponse, FetchError } from './fetcher'\nexport {\n BlankNode,\n Collection,\n DataFactory,\n Empty,\n Fetcher,\n Formula,\n Store,\n jsonParser,\n Literal,\n log,\n N3Parser,\n NamedNode,\n Namespace,\n Node,\n parse,\n Query,\n queryToSPARQL,\n RDFaProcessor,\n RDFParser,\n serialize,\n Serializer,\n SPARQLToQuery,\n sparqlUpdateParser,\n Statement,\n term,\n UpdateManager,\n UpdatesSocket,\n UpdatesVia,\n uri,\n Util,\n Variable,\n\n Store as IndexedFormula, // Alias\n\n NextId,\n\n fromNT,\n fetcher,\n graph,\n lit,\n st,\n namedNode as sym,\n\n // RDFJS DataFactory interface\n blankNode,\n defaultGraph,\n literal,\n namedNode,\n quad,\n triple,\n variable,\n}\nexport { termValue } from './utils/termValue'\n\nexport class ConnectedStore extends Store {\n\n fetcher: Fetcher;\n\n constructor (features) {\n super(features)\n this.fetcher = new Fetcher(this, {})\n }\n}\n\nexport class LiveStore extends ConnectedStore {\n\n updater: UpdateManager;\n \n constructor (features) {\n super(features)\n this.updater = new UpdateManager(this)\n }\n}\n"],"names":["root","factory","exports","module","require","define","amd","self","__WEBPACK_EXTERNAL_MODULE__8392__","leafPrototypes","getProto","inProgress","dataWebpackPrefix","debug","x","warn","info","error","success","msg","NamedNode","_Node","iri","_this","_classCallCheck","_callSuper","termValue","_defineProperty","NamedNodeTermType","ClassOrder","value","Error","includes","_inherits","_createClass","key","str","this","split","p","slice","lastIndexOf","q","indexOf","get","set","uri","isTerm","Node","bindings","other","classOrder","termType","toCanonical","equals","toNT","toString","BlankNodeTermType","LiteralTermType","VariableTermType","DefaultGraphTermType","CollectionTermType","EmptyTermType","GraphTermType","HTMLContentType","JSONLDContentType","N3ContentType","N3LegacyContentType","NQuadsAltContentType","NQuadsContentType","NTriplesContentType","RDFXMLContentType","SPARQLUpdateContentType","SPARQLUpdateSingleMatchContentType","TurtleContentType","TurtleLegacyContentType","XHTMLContentType","alert","console","log","docpart","i","document","RDFlibNamedNode","hostpart","u","m","exec","join","given","base","baseColon","baseScheme","baseSingle","lastSlash","path","baseHash","length","match","replace","protocol","refTo","k","l","len","len1","n","o","ref","ref1","s","commonHost","RegExp","string","template","subs","baseA","result","mediaTypeClass","mediaType","trim","linkRelationProperty","relation","callbackify","obj","callbacks","addHook","hook","addCallback","func","push","removeCallback","funcName","name","splice","insertCallback","unshift","fireCallbacks","args","callback","newCallbacks","replaceCallbacks","apply","DOMParserFactory","window","DOMParser","ActiveXObject","domToString","node","options","selfClosing","forEach","skipAttributes","dumpNode","out","noEsc","nodeType","hasAttribute","classWithChildText","matches","class","querySelector","element","textContent","skipNodeWithClass","ename","nodeName","toLowerCase","attrList","attributes","atn","test","replaceClassItemWith","source","re","target","skipClassWithValue","sortAttributes","sort","a","b","localeCompare","childNodes","pop","nodeValue","nl","dtstamp","now","Date","year","getYear","month","getMonth","day","getDate","hour","getUTCHours","minute","getUTCMinutes","second","getSeconds","heavyCompare","y","g","uriMap","nonBlank","signature","lis","statementsMatching","map","st","subject","predicate","object","concat","undefined","comparison","Object","prototype","hasOwnProperty","call","compareTerms","compareTerm","heavyCompareSPO","output","createElement","body","appendChild","parseXML","parseFromString","contentType","RDFArrayRemove","why","string_startswith","pref","stackString","e","stack","lines","toprint","line","charAt","chunks","isStatement","_typeof","isStore","isCollection","isRDFlibObject","isRDFlibSubject","isRDFlibPredicate","isVariable","isLiteral","isQuad","isNamedNode","isBlankNode","isSubject","isPredicate","isRDFObject","isGraph","peg$SyntaxError","message","expected","found","location","captureStackTrace","child","parent","ctor","constructor","peg$subclass","buildMessage","DESCRIBE_EXPECTATION_FNS","literal","expectation","literalEscape","text","escapedParts","parts","Array","classEscape","inverted","any","end","description","hex","ch","charCodeAt","toUpperCase","j","descriptions","type","describeExpected","describeFound","SyntaxError","parse","input","peg$result","peg$FAILED","peg$startRuleFunctions","turtleDoc","peg$parseturtleDoc","peg$startRuleFunction","peg$c0","statements","jsonld","context","toJSON","filter","isArray","assign","peg$c1","peg$c2","peg$literalExpectation","peg$c3","peg$c4","peg$c5","peg$c6","peg$c7","peg$classExpectation","peg$c8","peg$c9","peg$c10","peg$c11","peg$c12","peg$c13","addPrefix","peg$c14","peg$c15","peg$c16","addBase","peg$c17","peg$c18","peg$c19","peg$c20","peg$c21","peg$c22","peg$c23","peg$c24","peg$c25","peg$c26","peg$c27","peg$c28","peg$c29","peg$c30","peg$c31","peg$c32","peg$c33","peg$c34","peg$c35","peg$c36","peg$c37","peg$c38","peg$c39","f","peg$c40","d","peg$c41","c","property","createObject","t","keys","val","peg$c42","peg$c43","peg$c44","peg$c45","peg$c46","peg$c47","peg$c48","peg$c49","expandList","peg$c50","peg$c51","peg$c52","peg$c53","peg$c54","peg$c55","peg$c56","peg$c57","peg$c58","peg$c59","peg$c60","peg$c61","peg$c62","peg$c63","peg$c64","peg$c65","parseInt","parseFloat","resolve","prefix","decrement","peg$c66","peg$c67","peg$c68","peg$c69","peg$c70","peg$c71","peg$c72","peg$c73","peg$c74","peg$c75","peg$c76","peg$c77","peg$c78","peg$c79","decoded","codePointAt","String","fromCharCode","substring","fromCodePoint","peg$c80","peg$c81","peg$c82","hasPrefix","peg$c83","peg$c84","increment","peg$c85","peg$c86","peg$c87","peg$c88","peg$c89","peg$c90","peg$c91","peg$c92","peg$c93","peg$c94","peg$c95","peg$c96","peg$c97","peg$c98","peg$c99","peg$c100","peg$c101","peg$c102","peg$c103","peg$c104","peg$c105","peg$c106","peg$c107","peg$c108","peg$c109","peg$c110","peg$c111","peg$c112","peg$c113","peg$c114","peg$c115","peg$c116","peg$c117","peg$c118","peg$c119","peg$c120","head","peg$c121","peg$c122","peg$c123","peg$c124","peg$c125","peg$c126","peg$c127","peg$c128","peg$c129","peg$c130","peg$c131","peg$c132","peg$c133","peg$c134","peg$c135","peg$c136","peg$c137","peg$c138","peg$c139","peg$c140","peg$c141","peg$c142","peg$c143","peg$c144","peg$c145","peg$c146","peg$c147","peg$c148","peg$c149","peg$c150","peg$c151","peg$c152","peg$c153","peg$c154","peg$c155","peg$c156","peg$c157","peg$c158","peg$c159","peg$c160","peg$c161","peg$c162","peg$c163","peg$c164","peg$c165","peg$c166","peg$c167","peg$c168","peg$c169","peg$c170","peg$c171","peg$c172","peg$c173","peg$c174","peg$c175","peg$c176","peg$c177","peg$c178","peg$c179","peg$c180","tail","peg$c181","peg$c182","peg$c183","peg$c184","peg$c185","peg$c186","peg$c187","peg$c188","peg$currPos","peg$savedPos","peg$posDetailsCache","column","peg$maxFailPos","peg$maxFailExpected","peg$silentFails","startRule","peg$buildSimpleError","peg$computeLocation","ignoreCase","peg$computePosDetails","pos","details","startPos","endPos","startPosDetails","endPosDetails","start","offset","peg$fail","s0","s1","s2","s3","peg$parsestatement","peg$parseIGNORE","s4","s5","s6","s7","s8","substr","peg$parsePNAME_NS_NO_CHECK","peg$parseIRIREF","peg$parseprefixID","peg$parsebase","s9","s10","s11","peg$parsesparqlPrefix","peg$parsesparqlBase","peg$parsedirective","peg$parsecollection","peg$parseBlankNode","peg$parseiri","peg$parsesubject","peg$parsepredicateObjectList","peg$parseblankNodePropertyList","peg$parsetriples","peg$parseWS","peg$parseCOMMENT","peg$parseverb","peg$parseobjectList","peg$parseobject","peg$parsepredicate","peg$parseString","peg$parseLANGTAG","peg$parseRDFLiteral","peg$parseEXPONENT","peg$parseDOUBLE","peg$parseDECIMAL","peg$parseINTEGER","peg$parseNumericLiteral","peg$parseBooleanLiteral","peg$parseliteral","peg$parseECHAR","peg$parseUCHAR","peg$parseSTRING_LITERAL_LONG_SINGLE_QUOTE","peg$parseSTRING_LITERAL_LONG_QUOTE","peg$parseSTRING_LITERAL_SINGLE_QUOTE","peg$parseSTRING_LITERAL_QUOTE","peg$parsePNAME_NS","peg$parsePN_CHARS_U","peg$parsePLX","peg$parsePN_CHARS","peg$parsePN_LOCAL","peg$parsePNAME_LN","peg$parsePrefixedName","peg$parseBLANK_NODE_LABEL","peg$parseANON","peg$parsePN_PREFIX","peg$parseHEX","peg$parsePN_CHARS_BASE","peg$parsePERCENT","peg$parsePN_LOCAL_ESC","URL","Function","isBrowser","isIRI","data","last","list","count","pname","force","find","baseIRI","container","focus","Symbol","iterator","isDeepEqual","isDeepStrictEqual","_require$codes","codes","ERR_AMBIGUOUS_ARGUMENT","ERR_INVALID_ARG_TYPE","ERR_INVALID_ARG_VALUE","ERR_INVALID_RETURN_VALUE","ERR_MISSING_ARGS","AssertionError","inspect","_require$types","isPromise","isRegExp","objectAssign","objectIs","is","lazyLoadComparison","Map","warned","assert","ok","NO_EXCEPTION_SENTINEL","innerFail","innerOk","fn","argLen","generatedMessage","err","actual","operator","stackStartFn","_len","arguments","_key","fail","internalMessage","argsLen","process","emitWarning","bind","errArgs","equal","notEqual","deepEqual","notDeepEqual","deepStrictEqual","notDeepStrictEqual","strictEqual","notStrictEqual","Comparison","instance","Constructor","TypeError","expectedException","compareExceptionKey","isPrototypeOf","getActual","checkIsPromise","then","catch","waitForActual","promiseFn","Promise","resultPromise","expectsError","fnType","expectsNoError","strict","_len6","_key6","throws","_len2","_key2","rejects","_len3","_key3","doesNotThrow","_len4","_key4","doesNotReject","_len5","_key5","ifError","newErr","origStack","tmp2","shift","tmp1","defineProperty","enumerable","configurable","writable","_defineProperties","props","descriptor","_possibleConstructorReturn","_assertThisInitialized","ReferenceError","_wrapNativeSuper","Class","_cache","has","Wrapper","_construct","_getPrototypeOf","create","_setPrototypeOf","Parent","Reflect","construct","sham","Proxy","isNativeReflectConstruct","setPrototypeOf","__proto__","getPrototypeOf","endsWith","search","this_len","blue","green","red","white","kReadableOperator","strictEqualObject","notStrictEqualObject","notIdentical","copyError","inspectValue","compact","customInspect","depth","maxArrayLength","Infinity","showHidden","breakLength","showProxy","sorted","getters","_Error","limit","stackTraceLimit","stderr","isTTY","getColorDepth","res","lastPos","skipped","actualInspected","actualLines","expectedLines","indicator","inputLength","columns","Math","floor","maxCount","repeat","maxLines","max","_actualLines","printedLines","skippedMsg","cur","expectedLine","actualLine","divergingLines","createErrDiff","_res","knownOperators","code","protoProps","subClass","superClass","custom","recurseTimes","ctx","ownKeys","getOwnPropertySymbols","sym","getOwnPropertyDescriptor","_objectSpread","util","createErrorType","Base","NodeError","_Base","arg1","arg2","arg3","getMessage","oneOf","thing","determiner","reason","inspected","RangeError","_slicedToArray","arr","_arrayWithHoles","_arr","_n","_d","_e","_s","_i","next","done","_iterableToArrayLimit","_nonIterableRest","regexFlagsSupported","flags","arrayFromSet","array","arrayFromMap","objectGetOwnPropertySymbols","numberIsNaN","Number","isNaN","uncurryThis","propertyIsEnumerable","objectToString","isAnyArrayBuffer","isArrayBufferView","isDate","isMap","isSet","isNativeError","isBoxedPrimitive","isNumberObject","isStringObject","isBooleanObject","isBigIntObject","isSymbolObject","isFloat32Array","isFloat64Array","isNonIndex","pow","getOwnNonIndexProperties","compare","min","kNoIterator","kIsArray","kIsSet","kIsMap","innerDeepEqual","val1","val2","memos","buf1","buf2","val1Tag","keys1","keys2","keyCheck","getTime","byteLength","Uint8Array","buffer","byteOffset","areSimilarTypedArrays","areSimilarFloatArrays","_keys","_keys2","size","valueOf","Boolean","BigInt","isEqualBoxedPrimitive","getEnumerables","iterationType","aKeys","bKeys","symbolKeysA","symbolKeysB","_symbolKeysB","position","val2MemoA","val2MemoB","areEq","memo","aValues","Set","add","setMightHaveLoosePrim","bValues","_val","setHasEqualElement","setEquiv","aEntries","_aEntries$i","item1","item2","mapMightHaveLoosePrim","bEntries","_i2","_bEntries$_i","item","mapHasEqualEntry","mapEquiv","keysA","objEquiv","delete","setValues","findLooseMatchingPrimitives","prim","altValue","curB","key1","key2","b64","lens","getLens","validLen","placeHoldersLen","toByteArray","tmp","Arr","_byteLength","curByte","revLookup","fromByteArray","uint8","extraBytes","maxChunkLength","len2","encodeChunk","lookup","num","base64","ieee754","customInspectSymbol","Buffer","K_MAX_LENGTH","createBuffer","buf","arg","encodingOrOffset","allocUnsafe","from","encoding","isEncoding","write","fromString","ArrayBuffer","isView","arrayView","isInstance","copy","fromArrayBuffer","fromArrayLike","fromArrayView","SharedArrayBuffer","isBuffer","checked","fromObject","toPrimitive","assertSize","mustMatch","loweredCase","utf8ToBytes","base64ToBytes","slowToString","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","bidirectionalIndexOf","dir","arrayIndexOf","indexSize","arrLength","valLength","read","readUInt16BE","foundIndex","hexWrite","remaining","strLen","parsed","utf8Write","blitBuffer","asciiWrite","byteArray","asciiToBytes","base64Write","ucs2Write","units","hi","lo","utf16leToBytes","firstByte","codePoint","bytesPerSequence","secondByte","thirdByte","fourthByte","tempCodePoint","codePoints","MAX_ARGUMENTS_LENGTH","decodeCodePointsArray","TYPED_ARRAY_SUPPORT","proto","foo","typedArraySupport","poolSize","alloc","fill","allocUnsafeSlow","_isBuffer","swap16","swap32","swap64","toLocaleString","thisStart","thisEnd","thisCopy","targetCopy","isFinite","ret","hexSliceLookupTable","bytes","checkOffset","ext","checkInt","wrtBigUInt64LE","checkIntBI","wrtBigUInt64BE","checkIEEE754","writeFloat","littleEndian","noAssert","writeDouble","newBuf","subarray","readUintLE","readUIntLE","mul","readUintBE","readUIntBE","readUint8","readUInt8","readUint16LE","readUInt16LE","readUint16BE","readUint32LE","readUInt32LE","readUint32BE","readUInt32BE","readBigUInt64LE","defineBigIntMethod","validateNumber","first","boundsError","readBigUInt64BE","readIntLE","readIntBE","readInt8","readInt16LE","readInt16BE","readInt32LE","readInt32BE","readBigInt64LE","readBigInt64BE","readFloatLE","readFloatBE","readDoubleLE","readDoubleBE","writeUintLE","writeUIntLE","writeUintBE","writeUIntBE","writeUint8","writeUInt8","writeUint16LE","writeUInt16LE","writeUint16BE","writeUInt16BE","writeUint32LE","writeUInt32LE","writeUint32BE","writeUInt32BE","writeBigUInt64LE","writeBigUInt64BE","writeIntLE","sub","writeIntBE","writeInt8","writeInt16LE","writeInt16BE","writeInt32LE","writeInt32BE","writeBigInt64LE","writeBigInt64BE","writeFloatLE","writeFloatBE","writeDoubleLE","writeDoubleBE","targetStart","copyWithin","errors","E","super","addNumericalSeparator","range","ERR_OUT_OF_RANGE","checkBounds","ERR_BUFFER_OUT_OF_BOUNDS","received","isInteger","abs","INVALID_BASE64_RE","leadSurrogate","base64clean","src","dst","alphabet","table","i16","BufferBigIntNotDefined","GetIntrinsic","callBind","$indexOf","allowMissing","intrinsic","$apply","$call","$reflectApply","$gOPD","$defineProperty","$max","originalFunction","applyBind","times","functions","label","time","duration","format","expression","tuple","global","__self__","F","fetch","DOMException","support","Blob","viewClasses","normalizeName","normalizeValue","iteratorFor","items","Headers","headers","append","header","getOwnPropertyNames","consumed","bodyUsed","reject","fileReaderReady","reader","onload","onerror","readBlobAsArrayBuffer","blob","FileReader","promise","readAsArrayBuffer","bufferClone","view","Body","_initBody","_bodyInit","_bodyText","_bodyBlob","FormData","_bodyFormData","URLSearchParams","DataView","_bodyArrayBuffer","rejected","arrayBuffer","readAsText","chars","readArrayBufferAsText","formData","decode","json","JSON","oldValue","thisArg","values","entries","methods","Request","method","upcased","url","credentials","mode","signal","referrer","form","decodeURIComponent","Response","bodyInit","status","statusText","clone","response","redirectStatuses","redirect","init","request","aborted","xhr","XMLHttpRequest","abortXhr","abort","rawHeaders","getAllResponseHeaders","responseURL","responseText","ontimeout","onabort","open","withCredentials","responseType","setRequestHeader","addEventListener","onreadystatechange","readyState","removeEventListener","send","polyfill","ponyfill","hasSymbols","toStr","origDefineProperty","hasPropertyDescriptors","supportsDescriptors","defineProperties","predicates","firstSource","to","nextSource","keysArray","nextIndex","nextKey","desc","isCallable","receiver","forEachArray","forEachString","forEachObject","that","bound","boundLength","boundArgs","Empty","implementation","$SyntaxError","$Function","$TypeError","getEvalledConstructor","expressionSyntax","throwTypeError","ThrowTypeError","calleeThrows","gOPDthrows","needsEval","TypedArray","INTRINSICS","AggregateError","Atomics","BigInt64Array","BigUint64Array","decodeURI","encodeURI","encodeURIComponent","eval","EvalError","Float32Array","Float64Array","FinalizationRegistry","Int8Array","Int16Array","Int32Array","Uint8ClampedArray","Uint16Array","Uint32Array","URIError","WeakMap","WeakRef","WeakSet","errorProto","doEval","gen","LEGACY_ALIASES","hasOwn","$concat","$spliceApply","$replace","$strSlice","$exec","rePropName","reEscapeChar","getBaseIntrinsic","alias","intrinsicName","number","quote","subString","stringToPath","intrinsicBaseName","intrinsicRealName","skipFurtherCaching","isOwn","part","hasArrayLengthDefineBug","origSymbol","hasSymbolSham","symObj","syms","toStringTag","isLE","mLen","nBytes","eLen","eMax","eBias","nBits","NaN","rt","LN2","superCtor","super_","TempCtor","hasToStringTag","$toString","callBound","isStandardArguments","isLegacyArguments","callee","supportsStandardArguments","badArrayLike","isCallableMarker","fnToStr","reflectApply","_","constructorRegex","isES6ClassFn","fnStr","tryFunctionObject","isIE68","isDDA","all","strClass","GeneratorFunction","isFnRegex","generatorFunc","getGeneratorFunc","getPolyfill","shim","availableTypedArrays","gOPD","globalThis","typedArrays","$slice","toStrTags","typedArray","superProto","tag","anyTrue","getter","tryTypedArrays","keysShim","isArgs","isEnumerable","hasDontEnumBug","hasProtoEnumBug","dontEnums","equalsConstructorPrototype","excludedKeys","$applicationCache","$console","$external","$frame","$frameElement","$frames","$innerHeight","$innerWidth","$onmozfullscreenchange","$onmozfullscreenerror","$outerHeight","$outerWidth","$pageXOffset","$pageYOffset","$parent","$scrollLeft","$scrollTop","$scrollX","$scrollY","$self","$webkitIndexedDB","$webkitStorageInfo","$window","hasAutomationEqualityBug","isObject","isFunction","isArguments","isString","theKeys","skipProto","skipConstructor","equalsConstructorPrototypeIfNotBuggy","origKeys","originalKeys","keysWorksWithArguments","cachedSetTimeout","cachedClearTimeout","defaultSetTimout","defaultClearTimeout","runTimeout","fun","setTimeout","clearTimeout","currentQueue","queue","draining","queueIndex","cleanUpNextTick","drainQueue","timeout","run","marker","runClearTimeout","Item","noop","nextTick","title","browser","env","argv","version","versions","on","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","binding","cwd","chdir","umask","prop","qs","sep","eq","regexp","maxKeys","kstr","vstr","v","idx","stringifyPrimitive","ks","encode","stringify","queueMicrotask","cb","aliases","acl","as","cal","cert","contact","dc","dct","doap","foaf","geo","gpx","http","httph","icalTZ","ldp","link","meeting","mo","org","owl","pad","patch","prov","qu","trip","rdf","rdfs","rss","sched","schema","sioc","solid","space","stat","tab","tabont","ui","vcard","wf","xsd","cco","skos","bookmark","vann","namedNode","namespaces","expansion","localName","freeGlobal","punycode","maxInt","tMax","skew","damp","regexPunycode","regexNonASCII","regexSeparators","baseMinusTMin","stringFromCharCode","mapDomain","ucs2decode","extra","counter","ucs2encode","digitToBasic","digit","flag","adapt","delta","numPoints","firstTime","basic","index","oldi","w","baseMinusT","bias","handledCPCount","basicLength","currentValue","handledCPCountPlusOne","qMinusT","Url","slashes","auth","host","port","hostname","hash","query","pathname","href","protocolPattern","portPattern","simplePathPattern","unwise","autoEscape","nonHostChars","hostEndingChars","hostnamePartPattern","hostnamePartStart","unsafeProtocol","hostlessProtocol","slashedProtocol","querystring","parseQueryString","slashesDenoteHost","queryIndex","splitter","uSplit","rest","simplePath","lowerProto","atSign","hostEnd","hec","parseHost","ipv6Hostname","hostparts","newpart","validParts","notHost","bit","toASCII","h","ae","esc","escape","qm","relative","resolveObject","urlParse","rel","tkeys","tk","tkey","rkeys","rk","rkey","relPath","isSourceAbs","isRelAbs","mustEndAbs","removeAllDots","srcPath","psychotic","isNullOrUndefined","authInHost","isNull","hasTrailingSlash","up","isAbsolute","isArgumentsObject","isGeneratorFunction","whichTypedArray","isTypedArray","BigIntSupported","SymbolSupported","ObjectToString","numberValue","stringValue","booleanValue","bigIntValue","symbolValue","checkBoxedPrimitive","prototypeValueOf","isMapToString","isSetToString","isWeakMapToString","isWeakSetToString","isArrayBufferToString","isArrayBuffer","working","isDataViewToString","isDataView","isUint8Array","isUint8ClampedArray","isUint16Array","isUint32Array","isInt8Array","isInt16Array","isInt32Array","isBigInt64Array","isBigUint64Array","isWeakMap","isWeakSet","SharedArrayBufferCopy","isSharedArrayBufferToString","isSharedArrayBuffer","isAsyncFunction","isMapIterator","isSetIterator","isGeneratorObject","isWebAssemblyCompiledModule","getOwnPropertyDescriptors","descriptors","formatRegExp","objects","deprecate","noDeprecation","throwDeprecation","traceDeprecation","trace","debugs","debugEnvRegex","NODE_DEBUG","debugEnv","opts","seen","stylize","stylizeNoColor","colors","isBoolean","_extend","isUndefined","stylizeWithColor","formatValue","styleType","style","styles","primitive","simple","isNumber","formatPrimitive","visibleKeys","arrayToHash","isError","formatError","braces","toUTCString","formatProperty","formatArray","reduce","prev","reduceToSingleString","ar","debuglog","pid","types","isSymbol","isPrimitive","months","getHours","getMinutes","inherits","origin","kCustomPromisifiedSymbol","callbackifyOnRejected","newReason","promisify","original","promiseResolve","promiseReject","callbackified","maybeCb","rej","foundName","_regeneratorRuntime","__esModule","r","asyncIterator","wrap","Generator","Context","makeInvokeMethod","tryCatch","GeneratorFunctionPrototype","defineIteratorMethods","_invoke","AsyncIterator","invoke","__await","callInvokeWithMethodAndArg","delegate","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","resultName","nextLoc","pushTryEntry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","displayName","mark","awrap","async","reverse","stop","rval","handle","complete","finish","delegateYield","runtime","regeneratorRuntime","accidentalStrictMode","possibleNames","staticProps","toPropertyKey","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","id","loaded","__webpack_modules__","ns","def","current","definition","chunkId","promises","hmd","children","script","needAttach","scripts","getElementsByTagName","getAttribute","charset","nc","setAttribute","onScriptComplete","event","doneFns","parentNode","removeChild","nmd","paths","scriptUrl","importScripts","currentScript","installedChunks","installedChunkData","errorType","realSrc","webpackJsonpCallback","parentChunkLoadingFunction","chunkIds","moreModules","some","chunkLoadingGlobal","BlankNode","getId","formula","bnodeNew","copyTo","NTAnonymousNodePrefix","fragments","nextId","boolean","dateTime","decimal","double","integer","langString","Literal","language","datatype","XSD","fromValue","lang","d2","getUTCFullYear","getUTCMonth","getUTCDate","getUTCSeconds","strValue","MAX_SAFE_INTEGER","fromDate","fromBoolean","fromNumber","Collection","initial","RdflibBlankNode","elements","closed","ea","substitute","collection","asyncGeneratorStep","_next","_throw","_asyncToGenerator","defaultGraphURI","DefaultGraph","isDefaultGraph","defaultGraph","DefaultGraphNode","Statement","graph","terms","Variable","Uri","variable","Feature","CanonicalDataFactory","supports","collections","defaultGraphType","equalsMethod","identity","reversibleId","variableType","blankNode","term","quadToNQ","nq","termToNQ","languageOrDatatype","quad","triple","toNQ","Namespace","nsuri","dataFactory","ln","createXSD","localFactory","createSerializer","store","Serializer","_notQNameChars","prefixes","nsKeys","solidNs","suggestPrefix","namespacesUsed","keywords","prefixchars","incoming","formulas","rdfFactory","fromNT","px","setPrefix","existingNs","prefixs","canUse","pp","validPrefix","slash","sts","subjects","allBnodes","checkMentions","z","ss","roots","xNT","fromStr","rootsHash","statementsToN3","backslashUify","rdfns","kb","termToNT","atomicTermToN3","bnode","Util","defaultNamespace","predMap","spaces","treeToLine","tree","branch","statementListToTree","stats","rootSubjects","results","subjectTree","termToN3","propertyTree","objectTree","lastPred","expr","prefixDirectives","explicitURI","treeToString","level","lastLength","eNotation","stringToN3","symbolToN3","delim","forbidden","forbidden3","forbidden1","lastIndex","canSplit","_notNameChars","localid","namesp","keyords","makeUpPrefix","fetcher","session","appNode","sources","metaSources","metadata","namespaceCounts","liPrefix","XMLtreeToLine","statementListToXMLTree","subjectXMLTree","escapeForXML","relURI","pred","propertyXMLTree","ap","bp","bs","an","bn","qname","collectionXMLTree","attrs","ns2","XMLtreeToString","jsonldObj","ttl2jsonld","serialize","sz","setFlags","newSts","suggestNamespaces","setNamespaces","setBase","executeCallback","statementsToXML","statementsToNTriples","statementsToJsonld","appliedFactoryMethods","nil","arrayToStatements","_listObj","listData","nextNode","ArrayIndexOf","Formula","constraints","initBindings","optional","Graph","_step","_iterator","_createForOfIteratorHelper","_loop","factoryMethod","_this$rdfFactory","_this2","statement","_this3","anyStatementMatching","toJS","justOne","bots","bottom","each","len3","hashString","thisClass","len4","members","ref2","ref3","ref4","ref5","seeds","transitiveClosure","NTtoURI","findMembersNT","findTypesNT","doc","excludePredicateURIs","todo","doneArcs","follow","_features","dt","holds","addAll","uris","provenance","statementsCopy","inverse","sups","agenda","tops","Query","pat","IndexedFormula","vars","indexedFormulaQuery","myQuery","onDone","bindingDebug","bindingsDebug","nbs","unifyContents","nbs2","isVar","complexType","redirections","defaultDocumentURI","unifyTerm","nb","nb2","bindings2","union","OptionalBranchJunction","originalCallback","trunkBindings","branches","MandatoryBranch","checkAllDone","doCallBacks","reportMatch","reportDone","OptionalBranch","junction","prepare","termIndex","ind","nvars","subjectIndex","predicateIndex","objectIndex","whyIndex","easiestQuery","bindingsSoFar","localCallback","pattern_debug","pattern","br","fetchResource","requestedTerm","docuri","nowOrWhenFetched","getState","match2","constraintsSatisfied","nk","newBindings1","nbs1","onward","trunck","sync","owlNamespaceURI","handleFP","subj","o1","equate","handleIFP","handleRDFType","typeCallback","classActions","_Formula","features","propertyActions","HTTPRedirects","rdfArrayRemove","dataCallback","dataCallbacks","initPropertyActions","patchCallback","ds","targetKB","doPatch","onDonePatch","bad","ds2","remove","where","bindingsFound","_existentialVariables","addFn","newPropertyAction","proj","actions","objNode","predicateCallback","predHash","canon","ix","checkStatementList","arrayContains","u1","u2","statList","u1in","u2in","replaceWith","declareExistential","action","toBeFixed","_universalVariables","mentionsURI","removeStatement","removeMetadata","removeMatches","meta","linkNamespaceURI","requests","removeMany","big","small","oldhash","newhash","moveIndex","oldlist","newlist","nowKnownAs","x1","y1","existingPrefix","wild","iBest","best","pBest","possibles","check","cterm","_options","RDF","convertFirstRestNil","preceding","ele","listSoFar","trash","rests","firsts","total","totalTrash","pres","newList","newStatement","_step2","_iterator2","_step3","_iterator3","substituteInDoc","pre","_step4","_iterator4","_step5","_iterator5","sameTerm","substituteNillsInDoc","Logic_NS","pyjslib_Tuple","theList","pyjslib_List","pyjslib_Dict","listOfPairs","pyjslib_len","pyjslib_slice","StopIteration","pyjslib_Iterator","li","string_find","assertFudge","condition","utftext","Utf8","uripath_join","RDF_nil_URI","DAML_sameAs_URI","number_syntax","datetime_syntax","interesting","langcode","openFormula","thisDoc","baseURI","genPrefix","metaURI","SinkParser","_bindings","_flags","_store","setGenPrefix","_thisDoc","statementCount","hasNil","startOfLine","previousLine","_genPrefix","keywordsSet","_anonymousNodes","_variables","_parentVariables","_reason","_reason2","_baseURI","RDFSink_uniqueURI","_formula","_context","_parentContext","stream","loadBuf","startDoc","feed","endDoc","octets","skipSpace","directiveOrStatement","BadSyntax","directive","checkDot","tok","commaSeparatedList","setKeywords","__x","newUniversal","uri_ref2","hexify","qn","setPrefixForURI","property_list","nodeOrLiteral","ahead","here","makeStatement","subjectAlready","bnodeID","objs","objectList","__obj","mylist","first_run","newSet","oldParentContext","parentAnonymousNodes","grandParentVariables","reason2","close","thing_type","verb","pairFudge","ofUris","bareWord","pfx","anonymousNode","symb","uref","strconst","startline","res2","ustr","uEscape","UEscape","uch","uesc","lineNo","characterInFile","syntaxProblem","ExtendedTermFactory","jsonldObjectToTerm","listToCollection","listId","listItem","listToStatements","jsonldParser","baseString","flatten","flattened","flatResource","processResource","startsWith","_Object$keys","graphId","nestedFlatResources","addStatement","createStatement","SWAP","sameAs","forSome","forAll","implies","escapeSequence","escapeReplacements","illegalIriChars","lineModeRegExps","_iri","_unescapedIri","_simpleQuotedString","_langcode","_blank","_newline","_comment","_whitespace","_endOfFile","invalidRegExp","N3Lexer","_simpleApostropheString","_prefix","_prefixed","_variable","_number","_boolean","_keyword","_sparqlKeyword","_shortPredicates","_lineMode","lineMode","_n3Mode","n3","_comments","comments","_literalClosingPos","_tokenizeToEnd","inputFinished","_input","currentLineLength","whiteSpaceMatch","comment","emitToken","_line","firstChar","matchLength","inconclusive","_previousMarker","_unescape","reportSyntaxError","_parseLiteral","token","previousToken","_syntaxError","invalid","replaced","sequence","unicode4","unicode8","escapedChar","charCode","opening","openingLength","closingPos","backslashCount","raw","issue","_readStartingBom","tokenize","tokens","_pendingBuffer","setEncoding","DEFAULTGRAPH","_blankNodeCounter","languageOrDataType","Term","hashCode","atPos","datatypeString","dtPos","char","Quad","_subject","_predicate","_object","_graph","blankNodePrefix","N3Parser","_contextStack","_setBase","initDataFactory","isTurtle","isTriG","isNTriples","isNQuads","isN3","isLineMode","_supportsNamedGraphs","_readPredicateOrNamedGraph","_readPredicate","_supportsQuads","_supportsRDFStar","_resolveRelativeIRI","_blankNodePrefix","_lexer","lexer","_explicitQuantifiers","explicitQuantifiers","_resetBlankNodePrefix","fragmentPos","_base","_basePath","_baseRoot","_baseScheme","_saveContext","n3Mode","_inversePredicate","blankPrefix","_prefixes","quantified","_quantified","_restoreContext","_error","_readInTopContext","_callback","_sparqlStyle","_readPrefix","_readBaseIRI","_readSubject","_readNamedGraphLabel","_readEntity","quantifier","_resolveIRI","_namedNode","_blankNode","_readBlankNodeHead","RDF_NIL","_readListItem","_readPunctuation","N3_FORSOME","_quantifier","_readQuantifierList","N3_FORALL","_literalValue","_completeSubjectLiteral","_literal","_getPathReader","ABBREVIATIONS","_readBlankNodeTail","_readObject","_readDataTypeOrLang","_getContextEndReader","_readGraph","_readBlankNodePunctuation","_emit","empty","_readPredicateAfterBlank","previousList","RDF_FIRST","_readListItemDataTypeOrLang","RDF_REST","_completeObjectLiteral","_completeLiteral","completed","_readCallback","_readFormulaTail","inversePredicate","_quad","_readQuadPunctuation","_readPrefixIRI","prefixNode","_prefixCallback","_readDeclarationPunctuation","_readNamedGraphBlankLabel","entity","QUANTIFIERS_GRAPH","_readQuantifierPunctuation","afterPath","_afterPath","_readPath","_readForwardPath","_readBackwardPath","_readRDFStarTailOrGraph","_readRDFStarTail","contextStack","_removeDotSegments","pathStart","segmentStart","quadCallback","prefixCallback","quads","every","parser","N3DataFactory","ELEMENT_NODE","ATTRIBUTE_NODE","TEXT_NODE","CDATA_SECTION_NODE","ENTITY_REFERENCE_NODE","ENTITY_NODE","PROCESSING_INSTRUCTION_NODE","COMMENT_NODE","DOCUMENT_NODE","DOCUMENT_TYPE_NODE","DOCUMENT_FRAGMENT_NODE","NOTATION_NODE","RDFaProcessor","blankNodes","htmlOptions","theOne","vocabulary","blankCounter","langAttributes","namespaceURI","inXHTMLMode","absURIRE","finishedHandlers","su","ob","pr","or","toRDFNodeObject","mappings","newMappings","dateTimeTypes","matched","colon","NCNAME","parseCURIE","resolveAndNormalize","defaultVocabulary","ignoreTerms","parseTermOrCURIEOrAbsURI","parseCURIEOrURI","curie","documentElement","setContext","removeHash","baseURIMap","listMapping","bnodes","newBlankNode","addTriple","objectURI","skip","newSubject","currentObjectResource","typedResource","prefixesCopied","incomplete","listMappingDifferent","parseURI","vocabAtt","getAttributeNode","baseSubject","spec","att","copyMappings","prefixAtt","parsePrefixMappings","xmlLangAtt","getAttributeNodeNS","relAtt","revAtt","typeofAtt","propertyAtt","datatypeAtt","datetimeAtt","inHTMLMode","contentAtt","aboutAtt","srcAtt","resourceAtt","hrefAtt","inlistAtt","relAttPredicates","parsePredicate","revAttPredicates","parseSafeCURIEOrCURIEOrURI","parentObject","newSubjectOrigin","typeURI","forward","content","PlainLiteralURI","XMLLiteralURI","HTMLLiteralURI","deriveDateTimeType","childContext","listSubject","lastChild","previousSibling","copyProperties","setXHTMLContext","doctype","publicId","systemId","setHTMLContext","setXMLContext","setInitialContext","dom","nameChar","nameStartChar","parseRDFaDOM","RDFParser","reify","uriUtil","rdfid","NODE","ARC","addSymbol","isTripleToLoad","loadTriple","listIndex","attributeNode","potentialNode","cleanParser","DOCUMENT","ELEMENT","frameFactory","parseDOM","buildFrame","frame","elementURI","el","dig","TEXT","CDATA_SECTION","addArc","addLiteral","addCollectionArc","removeAttributeNode","parsetype","nv","innerHTML","addBNode","addCollection","resource","bnid2","addNode","about","bnid","rdftype","pframe","candidate","terminateFrame","removeAttribute","sparqlUpdateParser","SQNS","clauses","badSyntax","n3Parser","N3jsParser","DataFactory","nquads","tripleCallback","nquadCallback","e2","cause","executeErrorCallback","handled","Parsable","CONTENT_TYPE_BY_EXT","getNS","Handler","RDFXMLHandler","_Handler2","failFetch","noMeta","doneFetch","mediatypes","XHTMLHandler","_Handler3","links","linkData","rdfParse","noRDFa","XMLHandler","_Handler4","isElement","addStatus","req","html","xmlns","HTMLHandler","_Handler5","isXML","docTypeStart","docTypeEnd","isXHTML","isXMLNS","titleMatch","JsonLdHandler","_Handler6","TextHandler","_Handler7","N3Handler","_Handler8","defaultHandlers","Fetcher","_fetch","solidFetcher","solidFetch","crossFetch","requested","timeouts","redirectedTo","fetchQueue","fetchCallbacks","nonexistent","lookedUp","handlers","addHandler","load","uriIn","initFetchOptions","clearPreviousData","initialisedOptions","pendingFetchPromise","_pendingFetchPromise","_callee","originalUri","pendingPromise","t0","race","setRequestTimeout","fetchUri","cleanupFetchRequest","_x","_x2","_x3","_this4","isPending","cache","acceptString","requestedURI","offlineOverride","setCredentials","actualProxyURI","proxyIfNecessary","proxyUsed","_this5","unsupportedProtocol","state","dummyResponse","saveRequestMetadata","handleResponse","errno","handleError","p2","userCallback","referringTerm","fetchResponse","oops","statusMessage","getMilliseconds","statusNode","the","errorMessage","statusCode","meth","linkHeader","reqNode","paramexp","was","lookUpThing","_this6","uriSting","jsonString","webOperation","there","_this7","_this8","unload","_createIfNotExists","_callee2","_args2","_context2","t1","_x4","parentURI","folderName","invalidateCache","rterm","_this9","anyValue","timeNow","_this10","responseNode","refresh","exp","getHeader","removeDocument","handler","register","retriedWithNoCredentials","newOptions","isCrossSite","retryNoCredentials","proxyUri","crossSiteProxy","redirectToProxy","rdfType","locURI","reqURI","redirection","_this11","saveResponseMetadata","normalizedContentType","contentLocation","saveErrorResponse","diffLocation","absContentLocation","addType","isImage","parseLinkHeader","handlerForContentType","_this12","forceContentType","guess","guessContentType","newURI","_this13","oldReq","_this14","acceptstring","crossSiteProxyTemplate","UI","panes","preferences","isExtension","$SolidTestEnvironment","localSiteMap","pcol","HANDLERS","parseJSON","preds","queryToSPARQL","indent","getPattern","addIndent","getConstraints","describe","getOptionals","getWhere","getSelect","getSPARQL","SPARQLToQuery","SPARQL","testMode","variableHash","makeVar","newVar","isRealText","fixSymbolBrackets","isBnode","isPrefix","isPrefixedSymbol","getPrefix","getSuffix","removeBrackets","parseLiterals","sin","doub","end2","spaceDelimit","arrayIndicesOf","getMatchingBracket","ConstraintEqualTo","varstr","ConstraintRegexp","rg","setConstraint","setOptional","opt","setWhere","toTerms","filt","arrayZero","per","sem","stat2","com","stat3","extractStatements","sp","token1","token2","strarr","replaceKeywords","prefInd","symbol","getPrefixDeclarations","selectLoc","whereLoc","setVars","UpdateManager","updater","ifps","fps","patchControl","_kb$fetcher","_checkEditable","_kb$fetcher2","final","editable","_kb$fetcher3","isHttpUri","definitive","anyJS","wacAllow","lr","acceptPatch","authorVia","mentioned","stmt","anonymize","statementBnodes","bnodes2","isBlank","bnodeContext2","con","connectedStatements","cacheIfps","bnodeContext1","bnodeContext","anonymizeNT","callbackFunction","statementContext","statementNT","contextWhere","set_object","fire","st0","stText","control","patchControlFor","pendingUpstream","downstreamAction","upstreamCount","linkHeaders","listener","downstreamChangeListeners","setRefreshHandler","reloadAndSync","reloading","outOfDate","retryTimeout","tryReload","reload","wssURI","getUpdatesVia","theHandler","retries","validWssURI","uriJoin","openWebsocket","socket","WebSocket","onopen","requestDownstreamAction","onclose","onmessage","deletions","insertions","docs","thisUpdater","uniqueDocs","uniqueDoc","updates","update","bnodes_context","whereClause","nTriples","secondTry","errorBody","startTime","isSparql","statementArrayBnodes","constructSparqlUpdateQuery","constructN3PatchQuery","elapsedTimeMs","updateDav","updateLocalFile","targetURI","documentString","candidateTarget","dot","onErrorWasCalled","reloadTimeTotal","reloadTimeCount","RDFlibDataFactory","lit","UpdatesSocket","via","connected","pending","subscribed","onOpen","onClose","onMessage","onError","elt","_send","onUpdate","_decode","_subscribe","UpdatesVia","onHeaders","etag","subscribe","boundDataFactory","NextId","ConnectedStore","_Store","Store","LiveStore","_ConnectedStore2"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"rdflib.min.js","mappings":";CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,WACR,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,UAAWJ,GACO,iBAAZC,QACdA,QAAc,KAAID,EAAQG,QAAQ,WAElCJ,EAAW,KAAIC,EAAQD,EAAa,OACrC,CATD,CASGO,MAAOC,aCRNC,EADAC,ECAAC,EACAC,kDCaJ,QATI,CACF,QAAW,EACX,WAAc,EACd,MAAS,EACT,UAAa,EACb,UAAa,EACb,SAAY,iDCCd,QARY,CACVC,MAAK,SAAEC,GAAI,EACXC,KAAI,SAAED,GAAI,EACVE,KAAI,SAAEF,GAAI,EACVG,MAAK,SAAEH,GAAI,EACXI,QAAO,SAAEJ,GAAI,EACbK,IAAG,SAAEL,GAAI,qaCHX,IAGqBM,EAAS,SAAAC,GAS5B,SAAAD,EAAaE,GAAa,IAAAC,EAGxB,IA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AIZ4sC,GAAS9tC,EAAUO,OA2DZwtC,GAAc,SAAAC,GAIzB,SAAAD,EAAal6B,GAAU,IAAA3mE,EAEe,OAFfC,EAAAA,EAAAA,GAAA,KAAA4gG,GACrB7gG,EAAAE,GAAA,KAAA2gG,EAAA,CAAMl6B,KAASvmE,EAAAA,EAAAA,GAAAJ,EAAA,kBACfA,EAAKu8D,QAAU,IAAI4wB,GAAOntF,EAAO,CAAC,GAAEA,CACtC,CAAC,OAAAU,EAAAA,EAAAA,GAAAmgG,EAAAC,IAAAngG,EAAAA,EAAAA,GAAAkgG,EAAA,CAPwB,CAASE,IAUtBC,GAAS,SAAAC,GAIrB,SAAAD,EAAar6B,GAAU,IAAA5G,EAEiB,OAFjB9/D,EAAAA,EAAAA,GAAA,KAAA+gG,GACrBjhC,EAAA7/D,GAAA,KAAA8gG,EAAA,CAAMr6B,KAASvmE,EAAAA,EAAAA,GAAA2/D,EAAA,kBACfA,EAAK05B,QAAU,IAAID,GAAaz5B,GAAMA,CACxC,CAAC,OAAAr/D,EAAAA,EAAAA,GAAAsgG,EAAAC,IAAAtgG,EAAAA,EAAAA,GAAAqgG,EAAA,CAPoB,CAASH","sources":["webpack://$rdf/webpack/universalModuleDefinition","webpack://$rdf/webpack/runtime/create fake namespace object","webpack://$rdf/webpack/runtime/load script","webpack://$rdf/./src/class-order.ts","webpack://$rdf/./src/log.js","webpack://$rdf/./src/named-node.ts","webpack://$rdf/./src/node-internal.ts","webpack://$rdf/./src/types.ts","webpack://$rdf/./src/uri.ts","webpack://$rdf/./src/utils-js.js","webpack://$rdf/./src/utils/termValue.ts","webpack://$rdf/./src/utils/terms.ts","webpack://$rdf/./node_modules/@frogcat/ttl2jsonld/ttl2jsonld.js","webpack://$rdf/./node_modules/assert/build/assert.js","webpack://$rdf/./node_modules/assert/build/internal/assert/assertion_error.js","webpack://$rdf/./node_modules/assert/build/internal/errors.js","webpack://$rdf/./node_modules/assert/build/internal/util/comparisons.js","webpack://$rdf/./node_modules/base64-js/index.js","webpack://$rdf/./node_modules/buffer/index.js","webpack://$rdf/./node_modules/call-bind/callBound.js","webpack://$rdf/./node_modules/call-bind/index.js","webpack://$rdf/./node_modules/console-browserify/index.js","webpack://$rdf/./node_modules/cross-fetch/dist/browser-ponyfill.js","webpack://$rdf/./node_modules/define-properties/index.js","webpack://$rdf/./node_modules/es6-object-assign/index.js","webpack://$rdf/./node_modules/for-each/index.js","webpack://$rdf/./node_modules/function-bind/implementation.js","webpack://$rdf/./node_modules/function-bind/index.js","webpack://$rdf/./node_modules/get-intrinsic/index.js","webpack://$rdf/./node_modules/gopd/index.js","webpack://$rdf/./node_modules/has-property-descriptors/index.js","webpack://$rdf/./node_modules/has-symbols/index.js","webpack://$rdf/./node_modules/has-symbols/shams.js","webpack://$rdf/./node_modules/has-tostringtag/shams.js","webpack://$rdf/./node_modules/has/src/index.js","webpack://$rdf/./node_modules/ieee754/index.js","webpack://$rdf/./node_modules/inherits/inherits_browser.js","webpack://$rdf/./node_modules/is-arguments/index.js","webpack://$rdf/./node_modules/is-callable/index.js","webpack://$rdf/./node_modules/is-generator-function/index.js","webpack://$rdf/./node_modules/is-nan/implementation.js","webpack://$rdf/./node_modules/is-nan/index.js","webpack://$rdf/./node_modules/is-nan/polyfill.js","webpack://$rdf/./node_modules/is-nan/shim.js","webpack://$rdf/./node_modules/is-typed-array/index.js","webpack://$rdf/./node_modules/object-is/implementation.js","webpack://$rdf/./node_modules/object-is/index.js","webpack://$rdf/./node_modules/object-is/polyfill.js","webpack://$rdf/./node_modules/object-is/shim.js","webpack://$rdf/./node_modules/object-keys/implementation.js","webpack://$rdf/./node_modules/object-keys/index.js","webpack://$rdf/./node_modules/object-keys/isArguments.js","webpack://$rdf/./node_modules/process/browser.js","webpack://$rdf/./node_modules/querystring/decode.js","webpack://$rdf/./node_modules/querystring/encode.js","webpack://$rdf/./node_modules/querystring/index.js","webpack://$rdf/./node_modules/queue-microtask/index.js","webpack://$rdf/./node_modules/solid-namespace/index.js","webpack://$rdf/./node_modules/url/node_modules/punycode/punycode.js","webpack://$rdf/./node_modules/url/url.js","webpack://$rdf/./node_modules/url/util.js","webpack://$rdf/./node_modules/util/support/isBufferBrowser.js","webpack://$rdf/./node_modules/util/support/types.js","webpack://$rdf/./node_modules/util/util.js","webpack://$rdf/./node_modules/which-typed-array/index.js","webpack://$rdf/external umd \"window\"","webpack://$rdf/./node_modules/@babel/runtime/helpers/regeneratorRuntime.js","webpack://$rdf/./node_modules/@babel/runtime/helpers/typeof.js","webpack://$rdf/./node_modules/@babel/runtime/regenerator/index.js","webpack://$rdf/./node_modules/available-typed-arrays/index.js","webpack://$rdf/./node_modules/@babel/runtime/helpers/esm/classCallCheck.js","webpack://$rdf/./node_modules/@babel/runtime/helpers/esm/createClass.js","webpack://$rdf/./node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://$rdf/./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","webpack://$rdf/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://$rdf/./node_modules/@babel/runtime/helpers/esm/inherits.js","webpack://$rdf/./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","webpack://$rdf/./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","webpack://$rdf/./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","webpack://$rdf/./node_modules/@babel/runtime/helpers/esm/toPrimitive.js","webpack://$rdf/./node_modules/@babel/runtime/helpers/esm/typeof.js","webpack://$rdf/webpack/bootstrap","webpack://$rdf/webpack/runtime/compat get default export","webpack://$rdf/webpack/runtime/define property getters","webpack://$rdf/webpack/runtime/ensure chunk","webpack://$rdf/webpack/runtime/get javascript chunk filename","webpack://$rdf/webpack/runtime/global","webpack://$rdf/webpack/runtime/harmony module decorator","webpack://$rdf/webpack/runtime/hasOwnProperty shorthand","webpack://$rdf/webpack/runtime/make namespace object","webpack://$rdf/webpack/runtime/node module decorator","webpack://$rdf/webpack/runtime/publicPath","webpack://$rdf/webpack/runtime/jsonp chunk loading","webpack://$rdf/./src/blank-node.ts","webpack://$rdf/./src/xsd-internal.js","webpack://$rdf/./src/literal.ts","webpack://$rdf/./src/collection.ts","webpack://$rdf/./src/empty.ts","webpack://$rdf/./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","webpack://$rdf/./src/utils/default-graph-uri.ts","webpack://$rdf/./src/default-graph.ts","webpack://$rdf/./src/statement.ts","webpack://$rdf/./src/variable.ts","webpack://$rdf/./src/factories/factory-types.ts","webpack://$rdf/./src/factories/canonical-data-factory.ts","webpack://$rdf/./src/namespace.ts","webpack://$rdf/./src/xsd.js","webpack://$rdf/./src/serializer.js","webpack://$rdf/./src/serialize.ts","webpack://$rdf/./src/utils.ts","webpack://$rdf/./src/formula.ts","webpack://$rdf/./src/node.ts","webpack://$rdf/./src/query.js","webpack://$rdf/./src/store.ts","webpack://$rdf/./src/lists.ts","webpack://$rdf/./src/n3parser.js","webpack://$rdf/./src/factories/extended-term-factory.ts","webpack://$rdf/./src/jsonldparser.js","webpack://$rdf/./node_modules/n3/src/IRIs.js","webpack://$rdf/./node_modules/n3/src/N3Lexer.js","webpack://$rdf/./node_modules/n3/src/N3DataFactory.js","webpack://$rdf/./node_modules/n3/src/N3Parser.js","webpack://$rdf/./src/rdfaparser.js","webpack://$rdf/./src/rdfxmlparser.js","webpack://$rdf/./src/patch-parser.js","webpack://$rdf/./src/parse.ts","webpack://$rdf/./src/fetcher.ts","webpack://$rdf/./src/jsonparser.js","webpack://$rdf/./src/query-to-sparql.js","webpack://$rdf/./src/sparql-to-query.js","webpack://$rdf/./src/update-manager.ts","webpack://$rdf/./src/factories/rdflib-data-factory.ts","webpack://$rdf/./src/updates-via.js","webpack://$rdf/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"window\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"window\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"$rdf\"] = factory(require(\"window\"));\n\telse\n\t\troot[\"$rdf\"] = factory(root[\"window\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__8392__) => {\nreturn ","var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));\n\t}\n\tdef['default'] = () => (value);\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","var inProgress = {};\nvar dataWebpackPrefix = \"$rdf:\";\n// loadScript function to load a script via script tag\n__webpack_require__.l = (url, done, key, chunkId) => {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url || s.getAttribute(\"data-webpack\") == dataWebpackPrefix + key) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\n\t\tscript.charset = 'utf-8';\n\t\tscript.timeout = 120;\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\t\tscript.setAttribute(\"data-webpack\", dataWebpackPrefix + key);\n\n\t\tscript.src = url;\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = (prev, event) => {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach((fn) => (fn(event)));\n\t\tif(prev) return prev(event);\n\t}\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","/**\n* Class orders\n*/\nconst ClassOrder: {\n [id: string]: number;\n} = {\n 'Literal': 1,\n 'Collection': 3,\n 'Graph': 4,\n 'NamedNode': 5,\n 'BlankNode': 6,\n 'Variable': 7\n}\n\nexport default ClassOrder\n","/**\n * A Dummy log\n * @module log\n */\nconst log = {\n debug (x) {},\n warn (x) {},\n info (x) {},\n error (x) {},\n success (x) {},\n msg (x) {},\n}\nexport default log\n","import ClassOrder from './class-order'\nimport Node from './node-internal'\nimport { NamedNodeTermType } from './types'\nimport { termValue } from './utils/termValue'\nimport { NamedNode as TFNamedNode } from './tf-types'\nimport { isTerm } from './utils/terms'\n\n/**\n * A named (IRI) RDF node\n */\nexport default class NamedNode extends Node implements TFNamedNode {\n termType: typeof NamedNodeTermType = NamedNodeTermType\n classOrder = ClassOrder.NamedNode\n\n /**\n * Create a named (IRI) RDF Node\n * @constructor\n * @param iri - The IRI for this node\n */\n constructor (iri: string) {\n super(termValue(iri))\n\n if (!this.value) {\n throw new Error('Missing IRI for NamedNode')\n }\n\n if (!this.value.includes(':')) {\n throw new Error('NamedNode IRI \"' + iri + '\" must be absolute.')\n }\n\n if (this.value.includes(' ')) {\n var message = 'Error: NamedNode IRI \"' + iri + '\" must not contain unencoded spaces.'\n throw new Error(message)\n }\n }\n\n /**\n * Returns an $rdf node for the containing directory, ending in slash.\n */\n dir (): NamedNode | null {\n var str = this.value.split('#')[0]\n var p = str.slice(0, -1).lastIndexOf('/')\n var q = str.indexOf('//')\n if ((q >= 0 && p < q + 2) || p < 0) return null\n return new NamedNode(str.slice(0, p + 1))\n }\n\n /**\n * Returns an NN for the whole web site, ending in slash.\n * Contrast with the \"origin\" which does NOT have a trailing slash\n */\n site (): NamedNode {\n var str = this.value.split('#')[0]\n var p = str.indexOf('//')\n if (p < 0) throw new Error('This URI does not have a web site part (origin)')\n var q = str.indexOf('/', p+2)\n if (q < 0) {\n return new NamedNode(str.slice(0) + '/') // Add slash to a bare origin\n } else {\n return new NamedNode(str.slice(0, q + 1))\n }\n }\n\n /**\n * Creates the fetchable named node for the document.\n * Removes everything from the # anchor tag.\n */\n doc (): NamedNode {\n if (this.value.indexOf('#') < 0) {\n return this\n } else {\n return new NamedNode(this.value.split('#')[0])\n }\n }\n\n /**\n * Returns the URI including \n */\n toString (): string {\n return '<' + this.value + '>'\n }\n\n /** The local identifier with the document */\n id (): string {\n return this.value.split('#')[1]\n }\n\n /** Alias for value, favored by Tim */\n get uri (): string {\n return this.value\n }\n\n set uri (uri: string) {\n this.value = uri\n }\n\n /**\n * Creates a named node from the specified input value\n * @param value - An input value\n */\n static fromValue (value) {\n if (typeof value === 'undefined' || value === null) {\n return value\n }\n if (isTerm(value)) {\n return value\n }\n return new NamedNode(value)\n }\n}\n","import { ValueType, Bindings, FromValueReturns, TermType } from './types'\nimport { Term } from './tf-types'\n\n/**\n * The superclass of all RDF Statement objects, that is\n * NamedNode, Literal, BlankNode, etc.\n * Should not be instantiated directly.\n * Also called Term.\n * @link https://rdf.js.org/data-model-spec/#term-interface\n * @class Node\n */\nexport default abstract class Node {\n // Specified in './node.ts' to prevent circular dependency\n static fromValue: (value: ValueType) => T\n // Specified in './node.ts' to prevent circular dependency\n static toJS: (term: any) => Date | Number | string | boolean | object | Array;\n\n /** The type of node */\n termType!: TermType;\n\n /** The class order for this node */\n classOrder!: number;\n\n /** The node's value */\n value: string;\n\n protected constructor(value: string) {\n this.value = value\n }\n\n /**\n * Creates the substituted node for this one, according to the specified bindings\n * @param bindings - Bindings of identifiers to nodes\n */\n substitute (bindings: Bindings): T {\n return this as unknown as T\n }\n\n /**\n * Compares this node with another\n * @see {equals} to check if two nodes are equal\n * @param other - The other node\n */\n compareTerm (other: Node): number {\n if (this.classOrder < other.classOrder) {\n return -1\n }\n if (this.classOrder > other.classOrder) {\n return +1\n }\n if (this.value < other.value) {\n return -1\n }\n if (this.value > other.value) {\n return +1\n }\n return 0\n }\n\n /**\n * Compares whether the two nodes are equal\n * @param other The other node\n */\n equals (other: Term): boolean {\n if (!other) {\n return false\n }\n return (this.termType === other.termType) &&\n (this.value === other.value)\n }\n\n /**\n * Creates a hash for this node\n * @deprecated use {rdfFactory.id} instead if possible\n */\n hashString (): string {\n return this.toCanonical()\n }\n\n /**\n * Compares whether this node is the same as the other one\n * @param other - Another node\n */\n sameTerm(other: Node): boolean {\n return this.equals(other)\n\n }\n\n /**\n * Creates a canonical string representation of this node\n */\n toCanonical (): string {\n return this.toNT()\n }\n\n /**\n * Creates a n-triples string representation of this node\n */\n toNT (): string {\n return this.toString()\n }\n\n /**\n * Creates a n-quads string representation of this node\n */\n toNQ (): string {\n return this.toNT();\n }\n\n /**\n * Creates a string representation of this node\n */\n toString (): string {\n throw new Error('Node.toString() is abstract - see the subclasses instead')\n }\n}\n","import Node from './node-internal'\nimport RDFlibVariable from './variable'\nimport RDFlibBlankNode from './blank-node'\nimport Collection from './collection'\nimport RDFlibLiteral from './literal'\nimport RDFlibNamedNode from './named-node'\nimport RDFlibDefaultGraph from './default-graph'\nimport { DataFactory } from './factories/factory-types'\nimport IndexedFormula from './store'\nimport Fetcher from './fetcher'\nimport Statement from './statement'\nimport Empty from './empty'\nimport { NamedNode, Term, Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph } from './tf-types'\n\nexport const NamedNodeTermType = \"NamedNode\" as const\nexport const BlankNodeTermType = \"BlankNode\" as const\nexport const LiteralTermType = \"Literal\" as const\nexport const VariableTermType = \"Variable\" as const\nexport const DefaultGraphTermType = \"DefaultGraph\" as const\n// Non-RDF/JS types:\nexport const CollectionTermType = \"Collection\" as const\nexport const EmptyTermType = \"Empty\" as const\nexport const GraphTermType = \"Graph\" as const\n\nexport type TermType = typeof NamedNodeTermType\n | typeof BlankNodeTermType\n | typeof LiteralTermType\n | typeof VariableTermType\n | typeof DefaultGraphTermType\n | typeof CollectionTermType\n | typeof EmptyTermType\n | typeof GraphTermType\n\nexport const HTMLContentType = \"text/html\" as const\nexport const JSONLDContentType = \"application/ld+json\" as const\nexport const N3ContentType = \"text/n3\" as const\nexport const N3LegacyContentType = \"application/n3\" as const\nexport const NQuadsAltContentType = \"application/nquads\" as const\nexport const NQuadsContentType = \"application/n-quads\" as const\nexport const NTriplesContentType = \"application/n-triples\" as const\nexport const RDFXMLContentType = \"application/rdf+xml\" as const\nexport const SPARQLUpdateContentType = \"application/sparql-update\" as const\nexport const SPARQLUpdateSingleMatchContentType = \"application/sparql-update-single-match\" as const\nexport const TurtleContentType = \"text/turtle\" as const\nexport const TurtleLegacyContentType = \"application/x-turtle\" as const\nexport const XHTMLContentType = \"application/xhtml+xml\" as const\n\n/**\n * A valid mime type header\n */\nexport type ContentType = typeof RDFXMLContentType\n | typeof HTMLContentType\n | typeof JSONLDContentType\n | typeof N3ContentType\n | typeof N3LegacyContentType\n | typeof NQuadsAltContentType\n | typeof NQuadsContentType\n | typeof SPARQLUpdateContentType\n | typeof SPARQLUpdateSingleMatchContentType\n | typeof TurtleContentType\n | typeof TurtleLegacyContentType\n | typeof XHTMLContentType\n\n/** A type for values that serves as inputs */\nexport type ValueType = Term | Node | Date | string | number | boolean | undefined | null | Collection\n\n/**\n * In this project, there exist two types for the same kind of RDF concept.\n * We have RDF/JS spec types (standardized, generic), and RDFlib types (internal, specific).\n * When deciding which type to use in a function, it is preferable to accept generic inputs,\n * whenever possible, and provide strict outputs.\n * In some ways, the TF types in here are a bit more strict.\n * Variables are missing, and the statement requires specific types of terms (e.g. NamedNode instead of Term).\n */\n\n/** An RDF/JS Subject */\nexport type SubjectType = RDFlibBlankNode | RDFlibNamedNode | RDFlibVariable\n/** An RDF/JS Predicate */\nexport type PredicateType = RDFlibNamedNode | RDFlibVariable\n/** An RDF/JS Object */\nexport type ObjectType = RDFlibNamedNode | RDFlibLiteral | Collection | RDFlibBlankNode | RDFlibVariable | Empty\n/** An RDF/JS Graph */\nexport type GraphType = RDFlibDefaultGraph | RDFlibNamedNode | RDFlibVariable // | Formula\n\nexport interface Bindings {\n [id: string]: Term;\n}\n\n/** All the types that a .fromValue() method might return */\nexport type FromValueReturns = Term | undefined | null | Collection\n\nexport interface IRDFlibDataFactory extends DataFactory<\n RDFlibNamedNode | RDFlibBlankNode | RDFlibLiteral | Collection | Statement\n> {\n fetcher: (store: IndexedFormula, options: any) => Fetcher\n lit: (val: string, lang?: string, dt?: NamedNode) => RDFlibLiteral\n graph: (features?, opts?) => IndexedFormula\n st: (\n subject: Quad_Subject,\n predicate: Quad_Predicate,\n object: Quad_Object,\n graph?: Quad_Graph\n ) => Statement\n}\n","/*\n * Implements URI-specific functions\n *\n * See RFC 2386\n *\n * See also:\n * http://www.w3.org/2005/10/ajaw/uri.js\n * http://www.w3.org/2000/10/swap/uripath.py\n *\n */\nvar alert = alert || console.log\n\nimport RDFlibNamedNode from './named-node'\n\n/**\n * Gets the document part of an URI\n * @param uri The URI\n */\nexport function docpart(uri: string): string {\n var i: number\n i = uri.indexOf('#')\n if (i < 0) {\n return uri\n } else {\n return uri.slice(0, i)\n }\n}\n\n/**\n * Gets the document part of an URI as a named node\n * @param x - The URI\n */\nexport function document(x: string): RDFlibNamedNode {\n return new RDFlibNamedNode(docpart(x))\n}\n\n/**\n * Gets the hostname in an URI\n * @param u The URI\n */\nexport function hostpart(u: string): string {\n var m = /[^\\/]*\\/\\/([^\\/]*)\\//.exec(u)\n if (m) {\n return m[1]\n } else {\n return ''\n }\n}\n\n/**\n * Joins an URI with a base\n * @param given - The relative part\n * @param base - The base URI\n */\nexport function join(given: string, base: string): string {\n var baseColon, baseScheme, baseSingle\n var colon, lastSlash, path\n var baseHash = base.indexOf('#')\n if (baseHash > 0) {\n base = base.slice(0, baseHash)\n }\n if (given.length === 0) {\n return base\n }\n if (given.indexOf('#') === 0) {\n return base + given\n }\n colon = given.indexOf(':')\n if (colon >= 0) {\n return given\n }\n baseColon = base.indexOf(':')\n if (base.length === 0) {\n return given\n }\n if (baseColon < 0) {\n alert('Invalid base: ' + base + ' in join with given: ' + given)\n return given\n }\n baseScheme = base.slice(0, +baseColon + 1 || 9e9)\n if (given.indexOf('//') === 0) {\n return baseScheme + given\n }\n if (base.indexOf('//', baseColon) === baseColon + 1) {\n baseSingle = base.indexOf('/', baseColon + 3)\n if (baseSingle < 0) {\n if (base.length - baseColon - 3 > 0) {\n return base + '/' + given\n } else {\n return baseScheme + given\n }\n }\n } else {\n baseSingle = base.indexOf('/', baseColon + 1)\n if (baseSingle < 0) {\n if (base.length - baseColon - 1 > 0) {\n return base + '/' + given\n } else {\n return baseScheme + given\n }\n }\n }\n if (given.indexOf('/') === 0) {\n return base.slice(0, baseSingle) + given\n }\n path = base.slice(baseSingle)\n lastSlash = path.lastIndexOf('/')\n if (lastSlash < 0) {\n return baseScheme + given\n }\n if (lastSlash >= 0 && lastSlash < path.length - 1) {\n path = path.slice(0, +lastSlash + 1 || 9e9)\n }\n path += given\n while (path.match(/[^\\/]*\\/\\.\\.\\//)) {\n path = path.replace(/[^\\/]*\\/\\.\\.\\//, '')\n }\n path = path.replace(/\\.\\//g, '')\n path = path.replace(/\\/\\.$/, '/')\n return base.slice(0, baseSingle) + path\n}\n\n/**\n * Gets the protocol part of an URI\n * @param uri The URI\n */\nexport function protocol(uri: string): string | null {\n const i = uri.indexOf(':')\n if (i < 0) {\n return null\n } else {\n return uri.slice(0, i)\n }\n}\n\n/**\n * Gets a relative uri\n * @param base The base URI\n * @param uri The absolute URI\n */\nexport function refTo(base: string, uri: string): string {\n var c: string,\n i: number,\n k: number,\n l: number,\n len: number,\n len1: number,\n n: number,\n o: number,\n p: number,\n q: number,\n ref: string,\n ref1: number,\n s: string\n var commonHost = new RegExp('^[-_a-zA-Z0-9.]+:(//[^/]*)?/[^/]*$')\n if (!base) {\n return uri\n }\n if (base === uri) {\n return ''\n }\n for (i = o = 0, len = uri.length; o < len; i = ++o) {\n const c = uri[i]\n if (c !== base[i]) {\n break\n }\n }\n if (base.slice(0, i).match(commonHost)) {\n k = uri.indexOf('//')\n if (k < 0) {\n k = -2\n }\n l = uri.indexOf('/', k + 2)\n if (uri[l + 1] !== '/' && base[l + 1] !== '/' && uri.slice(0, l) === base.slice(0, l)) {\n return uri.slice(l)\n }\n }\n if (uri[i] === '#' && base.length === i) {\n return uri.slice(i)\n }\n while (i > 0 && uri[i - 1] !== '/') {\n i--\n }\n if (i < 3) {\n return uri\n }\n if (base.indexOf('//', i - 2) > 0 || uri.indexOf('//', i - 2) > 0) {\n return uri\n }\n if (base.indexOf(':', i) > 0) {\n return uri\n }\n n = 0\n ref = base.slice(i)\n for (p = 0, len1 = ref.length; p < len1; p++) {\n c = ref[p]\n if (c === '/') {\n n++\n }\n }\n if (n === 0 && i < uri.length && uri[i] === '#') {\n return './' + uri.slice(i)\n }\n if (n === 0 && i === uri.length) {\n return './'\n }\n s = ''\n if (n > 0) {\n for (q = 1, ref1 = n; ref1 >= 1 ? q <= ref1 : q >= ref1; ref1 >= 1 ? ++q : --q) {\n s += '../'\n }\n }\n return s + uri.slice(i)\n}\n","/**\n * Utility functions for $rdf\n * @module util\n */\nimport { docpart } from './uri'\nimport log from './log'\nimport * as uri from './uri'\nimport NamedNode from './named-node'\n\nconst string = { template: stringTemplate }\n\nexport { log, uri, string }\n\nexport function mediaTypeClass(mediaType){\n mediaType = mediaType.split(';')[0].trim() // remove media type parameters\n return new NamedNode('http://www.w3.org/ns/iana/media-types/' + mediaType + '#Resource')\n}\n\nexport function linkRelationProperty(relation){\n return new NamedNode('http://www.w3.org/ns/iana/link-relations/relation#' + relation.trim())\n}\n\n/**\n * Adds callback functionality to an object.\n * Callback functions are indexed by a 'hook' string.\n * They return true if they want to be called again.\n * @method callbackify\n * @param obj {Object}\n * @param callbacks {Array}\n */\nexport function callbackify (obj, callbacks) {\n obj.callbacks = {}\n for (var x = callbacks.length - 1; x >= 0; x--) {\n obj.callbacks[callbacks[x]] = []\n }\n\n obj.addHook = function (hook) {\n if (!obj.callbacks[hook]) {\n obj.callbacks[hook] = []\n }\n }\n\n obj.addCallback = function (hook, func) {\n obj.callbacks[hook].push(func)\n }\n\n obj.removeCallback = function (hook, funcName) {\n for (var i = 0;i < obj.callbacks[hook].length;i++) {\n if (obj.callbacks[hook][i].name === funcName) {\n obj.callbacks[hook].splice(i, 1)\n return true\n }\n }\n return false\n }\n\n obj.insertCallback = function (hook, func) {\n obj.callbacks[hook].unshift(func)\n }\n\n obj.fireCallbacks = function fireCallbacks (hook, args) {\n var newCallbacks = []\n var replaceCallbacks = []\n var len = obj.callbacks[hook].length\n var x\n let callback\n\n // log.info('!@$ Firing '+hook+' call back with length'+len)\n for (x = len - 1; x >= 0; x--) {\n // log.info('@@ Firing '+hook+' callback '+ obj.callbacks[hook][x])\n callback = obj.callbacks[hook][x]\n if (callback && callback.apply(obj, args)) {\n newCallbacks.push(callback)\n }\n }\n\n for (x = newCallbacks.length - 1; x >= 0; x--) {\n replaceCallbacks.push(newCallbacks[x])\n }\n\n for (x = len; x < obj.callbacks[hook].length; x++) {\n replaceCallbacks.push(obj.callbacks[hook][x])\n }\n\n obj.callbacks[hook] = replaceCallbacks\n }\n}\n\n/**\n * Returns a DOM parser based on current runtime environment.\n */\nexport function DOMParserFactory () {\n if (window.DOMParser) {\n return new DOMParser()\n } else if (window.ActiveXObject) {\n return new ActiveXObject('Microsoft.XMLDOM')\n } else {\n return false\n }\n}\n\n// From https://github.com/linkeddata/dokieli\nexport function domToString (node, options) {\n options = options || {}\n var selfClosing = []\n if (options && options.selfClosing) {\n options.selfClosing.split(' ').forEach(function (n) {\n selfClosing[n] = true\n })\n }\n var skipAttributes = []\n if (options && options.skipAttributes) {\n options.skipAttributes.split(' ').forEach(function (n) {\n skipAttributes[n] = true\n })\n }\n return dumpNode(node, options, selfClosing, skipAttributes)\n}\n\nexport function dumpNode (node, options, selfClosing, skipAttributes) {\n var i\n var out = ''\n var noEsc = [ false ]\n if (typeof node.nodeType === 'undefined') return out\n if (node.nodeType === 1) {\n if (node.hasAttribute('class') && (options && options.classWithChildText) && node.matches(options.classWithChildText.class)) {\n out += node.querySelector(options.classWithChildText.element).textContent\n } else if (!((options && options.skipNodeWithClass) && node.matches('.' + options.skipNodeWithClass))) {\n var ename = node.nodeName.toLowerCase()\n out += '<' + ename\n\n var attrList = []\n for (i = node.attributes.length - 1; i >= 0; i--) {\n var atn = node.attributes[i]\n if (skipAttributes && skipAttributes.length > 0 && skipAttributes[atn.name]) continue\n if (/^\\d+$/.test(atn.name)) continue\n if (atn.name === 'class' && (options && options.replaceClassItemWith) && (atn.value.split(' ').indexOf(options.replaceClassItemWith.source) > -1)) {\n var re = new RegExp(options.replaceClassItemWith.source, 'g')\n atn.value = atn.value.replace(re, options.replaceClassItemWith.target).trim()\n }\n if (!(atn.name === 'class' && (options && options.skipClassWithValue) && options.skipClassWithValue === atn.value)) {\n attrList.push(atn.name + '=\\'' + atn.value.replace(/&/g, '&').replace(//g, '>').replace(/'/g, '"') + '\\'')\n }\n }\n if (attrList.length > 0) {\n if (options && options.sortAttributes) {\n attrList.sort(function (a, b) {\n return a.toLowerCase().localeCompare(b.toLowerCase())\n })\n }\n out += ' ' + attrList.join(' ')\n }\n if (selfClosing && selfClosing.ename) {\n out += ' />'\n } else {\n out += '>'\n out += (ename === 'html') ? '\\n ' : ''\n noEsc.push(ename === 'style' || ename === 'script')\n for (i = 0; i < node.childNodes.length; i++) out += dumpNode(node.childNodes[i])\n noEsc.pop()\n out += (ename === 'body') ? '' + '\\n' : ''\n }\n }\n } else if (node.nodeType === 8) {\n // FIXME: If comments are not tabbed in source, a new line is not prepended\n out += ''\n } else if (node.nodeType === 3 || node.nodeType === 4) {\n // XXX: Remove new lines which were added after DOM ready\n var nl = node.nodeValue.replace(/\\n+$/, '')\n out += noEsc[noEsc.length - 1] ? nl : nl.replace(/&/g, '&').replace(//g, '>')\n } else {\n console.log('Warning; Cannot handle serialising nodes of type: ' + node.nodeType)\n console.log(node)\n }\n return out\n}\n\nexport function dtstamp () {\n var now = new Date()\n var year = now.getYear() + 1900\n var month = now.getMonth() + 1\n var day = now.getDate()\n var hour = now.getUTCHours()\n var minute = now.getUTCMinutes()\n var second = now.getSeconds()\n if (month < 10) month = '0' + month\n if (day < 10) day = '0' + day\n if (hour < 10) hour = '0' + hour\n if (minute < 10) minute = '0' + minute\n if (second < 10) second = '0' + second\n return year + '-' + month + '-' + day + 'T' +\n hour + ':' + minute + ':' + second + 'Z'\n}\n\n/**\n * Compares statements (heavy comparison for repeatable canonical ordering)\n */\nexport function heavyCompare (x, y, g, uriMap) {\n var nonBlank = function (x) {\n return (x.termType === 'BlankNode') ? null : x\n }\n var signature = function (x) {\n var lis = g.statementsMatching(x).map(function (st) {\n return ('' + nonBlank(st.subject) + ' ' + nonBlank(st.predicate) +\n ' ' + nonBlank(st.object))\n }).concat(g.statementsMatching(undefined, undefined, x).map(function (st) {\n return ('' + nonBlank(st.subject) + ' ' + nonBlank(st.predicate) +\n ' ' + nonBlank(st.object))\n }))\n lis.sort()\n return lis.join('\\n')\n }\n const comparison = Object.prototype.hasOwnProperty.call(g, \"compareTerms\")\n ? g.compareTerms(x, y)\n : x.compareTerm(y)\n\n if ((x.termType === 'BlankNode') && (y.termType === 'BlankNode')) {\n if (comparison === 0) return 0 // Same\n if (signature(x) > signature(y)) return +1\n if (signature(x) < signature(y)) return -1\n return comparison // Too bad -- this order not canonical.\n // throw \"different bnodes indistinquishable for sorting\"\n } else {\n if (uriMap && x.uri && y.uri){\n return (uriMap[x.uri] || x.uri).localeCompare(uriMap[y.uri] || y.uri)\n }\n return comparison\n }\n}\n\nexport function heavyCompareSPO (x, y, g, uriMap) {\n return heavyCompare(x.subject, y.subject, g, uriMap) ||\n heavyCompare(x.predicate, y.predicate, g, uriMap) ||\n heavyCompare(x.object, y.object, g, uriMap)\n}\n\n/**\n * Defines a simple debugging function\n * @method output\n * @param o {String}\n */\nexport function output (o) {\n var k = document.createElement('div')\n k.textContent = o\n document.body.appendChild(k)\n}\n\nimport { DOMParser } from '@xmldom/xmldom'\n\n/**\n * Returns a DOM from parsed XML.\n */\nexport function parseXML (str, options) {\n var dparser\n options = options || {}\n if (typeof module !== 'undefined' && module && module.exports) { // Node.js\n var dom = new DOMParser().parseFromString(str, options.contentType || 'application/xhtml+xml')\n return dom\n } else {\n if (typeof window !== 'undefined' && window.DOMParser) {\n dparser = new window.DOMParser() // seems to actually work\n } else {\n dparser = new DOMParser() // Doc says this works\n }\n }\n return dparser.parseFromString(str, 'application/xml')\n}\n\n/**\n * Removes all statements equal to x from a\n */\nexport function RDFArrayRemove (a, x) {\n for (var i = 0; i < a.length; i++) {\n // TODO: This used to be the following, which didnt always work..why\n // if(a[i] === x)\n if (a[i].subject.equals(x.subject) &&\n a[i].predicate.equals(x.predicate) &&\n a[i].object.equals(x.object) &&\n a[i].why.equals(x.why)) {\n a.splice(i, 1)\n return\n }\n }\n throw new Error('RDFArrayRemove: Array did not contain ' + x + ' ' + x.why)\n}\n\nexport function string_startswith (str, pref) { // missing library routines\n return (str.slice(0, pref.length) === pref)\n}\n\n/**\n * C++, python style %s -> subs\n */\nfunction stringTemplate (base, subs) {\n var baseA = base.split('%s')\n var result = ''\n for (var i = 0;i < subs.length;i++) {\n subs[i] += ''\n result += baseA[i] + subs[i]\n }\n return result + baseA.slice(subs.length).join()\n}\n\n\n// Stack dump on errors - to pass errors back\n\nexport function stackString (e) {\n var str = '' + e + '\\n'\n if (!e.stack) {\n return str + 'No stack available.\\n'\n }\n var lines = e.stack.toString().split('\\n')\n var toprint = []\n for (var i = 0; i < lines.length; i++) {\n var line = lines[i]\n if (line.indexOf('ecmaunit.js') > -1) {\n // remove useless bit of traceback\n break\n }\n if (line.charAt(0) == '(') {\n line = 'function' + line\n }\n var chunks = line.split('@')\n toprint.push(chunks)\n }\n // toprint.reverse(); No - I prefer the latest at the top by the error message -tbl\n\n for (var i = 0; i < toprint.length; i++) {\n str += ' ' + toprint[i][1] + '\\n ' + toprint[i][0]\n }\n return str\n}\n","import { Term } from '../tf-types'\n\n/** Retrieve the value of a term, or self if already a string. */\nexport function termValue (node: Term | string): string {\n if (typeof node === 'string') {\n return node\n }\n\n return node.value\n}\n","import {\n ObjectType, CollectionTermType, NamedNodeTermType, VariableTermType, BlankNodeTermType, LiteralTermType, GraphTermType, DefaultGraphTermType,\n} from '../types'\nimport Collection from '../collection'\nimport IndexedFormula from '../store'\nimport Statement from '../statement'\nimport {\n BlankNode,\n Quad_Graph,\n Literal,\n NamedNode,\n Quad_Object,\n Quad_Predicate,\n Quad,\n Quad_Subject,\n Term,\n Variable,\n} from '../tf-types'\n\n/** TypeGuard for RDFLib Statements */\nexport function isStatement(obj): obj is Statement {\n return typeof obj === 'object' && obj !== null && 'subject' in obj\n}\n\n/** TypeGuard for RDFlib Stores */\nexport function isStore(obj): obj is IndexedFormula {\n return typeof obj === 'object' && obj !== null && 'statements' in obj\n}\n\n/** TypeGuard for RDFLib Collections */\nexport function isCollection(obj: any): obj is Collection {\n return isTerm(obj)\n && (obj as Term).termType === CollectionTermType\n}\n\n/** TypeGuard for valid RDFlib Object types, also allows Collections, Graphs */\nexport function isRDFlibObject(obj: any): obj is ObjectType {\n return obj && Object.prototype.hasOwnProperty.call(obj, 'termType') && (\n obj.termType === NamedNodeTermType ||\n obj.termType === VariableTermType ||\n obj.termType === BlankNodeTermType ||\n obj.termType === CollectionTermType ||\n obj.termType === LiteralTermType ||\n obj.termType === GraphTermType\n )\n}\n\n/** TypeGuard for valid RDFlib Subject types, same as Object as RDFLib symmetrical.\n*/\nexport function isRDFlibSubject(obj: any): obj is ObjectType {\n return obj && Object.prototype.hasOwnProperty.call(obj, 'termType') && (\n obj.termType === NamedNodeTermType ||\n obj.termType === VariableTermType ||\n obj.termType === BlankNodeTermType ||\n obj.termType === CollectionTermType ||\n obj.termType === LiteralTermType ||\n obj.termType === GraphTermType\n )\n}\n\n/** TypeGuard for valid RDF/JS spec Predicate types */\nexport function isRDFlibPredicate(obj: any): obj is Quad_Predicate {\n return isTerm(obj) && (\n obj.termType === NamedNodeTermType ||\n obj.termType === BlankNodeTermType ||\n obj.termType === VariableTermType\n )\n}\n\n/** TypeGuard for RDFLib Variables */\nexport function isVariable(obj: any): obj is Variable {\n return isTerm(obj)\n && (obj as Term).termType === VariableTermType\n}\n\n/** TypeGuard for RDF/JS spec Terms */\nexport function isTerm(obj: any): obj is Term {\n return typeof obj === 'object'\n && obj !== null\n && 'termType' in obj\n}\n\n/** TypeGuard for RDF/JS spec Literals */\nexport function isLiteral(value: any): value is Literal {\n return (value as Term).termType === LiteralTermType\n}\n\n/** TypeGuard for RDF/JS spec Quads */\nexport function isQuad(obj: any): obj is Quad {\n return typeof obj === \"object\" && obj !== null && (\n 'subject' in obj\n && 'predicate' in obj\n && 'object' in obj\n )\n}\n\n/** TypeGuard for RDF/JS spec NamedNodes */\nexport function isNamedNode(obj: any): obj is NamedNode {\n return isTerm(obj) && obj.termType === 'NamedNode'\n}\n\n/** TypeGuard for RDF/JS spec BlankNodes */\nexport function isBlankNode(obj: any): obj is BlankNode {\n return isTerm(obj) && 'termType' in obj && obj.termType === 'BlankNode'\n}\n\n/** TypeGuard for valid RDF/JS spec Subject types */\nexport function isSubject(obj: any): obj is Quad_Subject {\n return isTerm(obj) && (\n obj.termType === NamedNodeTermType ||\n obj.termType === VariableTermType ||\n obj.termType === BlankNodeTermType\n )\n}\n\n/** TypeGuard for valid RDF/JS spec Predicate types */\nexport function isPredicate(obj: any): obj is Quad_Predicate {\n return isTerm(obj) && (\n obj.termType === NamedNodeTermType ||\n obj.termType === VariableTermType\n )\n}\n\n/** TypeGuard for valid RDF/JS spec Object types */\nexport function isRDFObject(obj: any): obj is Quad_Object {\n return isTerm(obj) && (\n obj.termType === NamedNodeTermType ||\n obj.termType === VariableTermType ||\n obj.termType === BlankNodeTermType ||\n obj.termType === LiteralTermType\n )\n}\n\n/** TypeGuard for valid RDF/JS Graph types */\nexport function isGraph(obj: any): obj is Quad_Graph {\n return isTerm(obj) && (\n obj.termType === NamedNodeTermType ||\n obj.termType === VariableTermType ||\n obj.termType === BlankNodeTermType ||\n obj.termType === DefaultGraphTermType\n )\n}\n","/*\n * Generated by PEG.js 0.10.0.\n *\n * http://pegjs.org/\n */\n(function(root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define([], factory);\n } else if (typeof module === \"object\" && module.exports) {\n module.exports = factory();\n } else {\n root.ttl2jsonld = factory();\n }\n})(this, function() {\n \"use strict\";\n\n function peg$subclass(child, parent) {\n function ctor() { this.constructor = child; }\n ctor.prototype = parent.prototype;\n child.prototype = new ctor();\n }\n\n function peg$SyntaxError(message, expected, found, location) {\n this.message = message;\n this.expected = expected;\n this.found = found;\n this.location = location;\n this.name = \"SyntaxError\";\n\n if (typeof Error.captureStackTrace === \"function\") {\n Error.captureStackTrace(this, peg$SyntaxError);\n }\n }\n\n peg$subclass(peg$SyntaxError, Error);\n\n peg$SyntaxError.buildMessage = function(expected, found) {\n var DESCRIBE_EXPECTATION_FNS = {\n literal: function(expectation) {\n return \"\\\"\" + literalEscape(expectation.text) + \"\\\"\";\n },\n\n \"class\": function(expectation) {\n var escapedParts = \"\",\n i;\n\n for (i = 0; i < expectation.parts.length; i++) {\n escapedParts += expectation.parts[i] instanceof Array\n ? classEscape(expectation.parts[i][0]) + \"-\" + classEscape(expectation.parts[i][1])\n : classEscape(expectation.parts[i]);\n }\n\n return \"[\" + (expectation.inverted ? \"^\" : \"\") + escapedParts + \"]\";\n },\n\n any: function(expectation) {\n return \"any character\";\n },\n\n end: function(expectation) {\n return \"end of input\";\n },\n\n other: function(expectation) {\n return expectation.description;\n }\n };\n\n function hex(ch) {\n return ch.charCodeAt(0).toString(16).toUpperCase();\n }\n\n function literalEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function(ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return '\\\\x' + hex(ch); });\n }\n\n function classEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\\]/g, '\\\\]')\n .replace(/\\^/g, '\\\\^')\n .replace(/-/g, '\\\\-')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function(ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return '\\\\x' + hex(ch); });\n }\n\n function describeExpectation(expectation) {\n return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);\n }\n\n function describeExpected(expected) {\n var descriptions = new Array(expected.length),\n i, j;\n\n for (i = 0; i < expected.length; i++) {\n descriptions[i] = describeExpectation(expected[i]);\n }\n\n descriptions.sort();\n\n if (descriptions.length > 0) {\n for (i = 1, j = 1; i < descriptions.length; i++) {\n if (descriptions[i - 1] !== descriptions[i]) {\n descriptions[j] = descriptions[i];\n j++;\n }\n }\n descriptions.length = j;\n }\n\n switch (descriptions.length) {\n case 1:\n return descriptions[0];\n\n case 2:\n return descriptions[0] + \" or \" + descriptions[1];\n\n default:\n return descriptions.slice(0, -1).join(\", \")\n + \", or \"\n + descriptions[descriptions.length - 1];\n }\n }\n\n function describeFound(found) {\n return found ? \"\\\"\" + literalEscape(found) + \"\\\"\" : \"end of input\";\n }\n\n return \"Expected \" + describeExpected(expected) + \" but \" + describeFound(found) + \" found.\";\n };\n\n function peg$parse(input, options) {\n options = options !== void 0 ? options : {};\n\n var peg$FAILED = {},\n\n peg$startRuleFunctions = { turtleDoc: peg$parseturtleDoc },\n peg$startRuleFunction = peg$parseturtleDoc,\n\n peg$c0 = function(statements) {\n var jsonld = context.toJSON();\n jsonld[\"@graph\"] = [];\n statements.filter(a=>Array.isArray(a)).forEach(a=>{\n a.forEach(b=>{\n jsonld[\"@graph\"].push(b);\n });\n });\n\n if(jsonld[\"@graph\"].length===1){\n Object.assign(jsonld,jsonld[\"@graph\"][0]);\n delete jsonld[\"@graph\"];\n }\n\n return jsonld;\n },\n peg$c1 = \".\",\n peg$c2 = peg$literalExpectation(\".\", false),\n peg$c3 = function(a) {return a;},\n peg$c4 = \"#\",\n peg$c5 = peg$literalExpectation(\"#\", false),\n peg$c6 = /^[^\\n]/,\n peg$c7 = peg$classExpectation([\"\\n\"], true, false),\n peg$c8 = \"\\n\",\n peg$c9 = peg$literalExpectation(\"\\n\", false),\n peg$c10 = function(a) {return a.join(\"\");},\n peg$c11 = \"@prefix\",\n peg$c12 = peg$literalExpectation(\"@prefix\", false),\n peg$c13 = function(a, b) {\n context.addPrefix(a===\"\" ? \"0\" : a,b);\n return {};\n },\n peg$c14 = \"@base\",\n peg$c15 = peg$literalExpectation(\"@base\", false),\n peg$c16 = function(a) {\n context.addBase(a);\n return {};\n },\n peg$c17 = /^[Bb]/,\n peg$c18 = peg$classExpectation([\"B\", \"b\"], false, false),\n peg$c19 = /^[Aa]/,\n peg$c20 = peg$classExpectation([\"A\", \"a\"], false, false),\n peg$c21 = /^[Ss]/,\n peg$c22 = peg$classExpectation([\"S\", \"s\"], false, false),\n peg$c23 = /^[Ee]/,\n peg$c24 = peg$classExpectation([\"E\", \"e\"], false, false),\n peg$c25 = /^[Pp]/,\n peg$c26 = peg$classExpectation([\"P\", \"p\"], false, false),\n peg$c27 = /^[Rr]/,\n peg$c28 = peg$classExpectation([\"R\", \"r\"], false, false),\n peg$c29 = /^[Ff]/,\n peg$c30 = peg$classExpectation([\"F\", \"f\"], false, false),\n peg$c31 = /^[Ii]/,\n peg$c32 = peg$classExpectation([\"I\", \"i\"], false, false),\n peg$c33 = /^[Xx]/,\n peg$c34 = peg$classExpectation([\"X\", \"x\"], false, false),\n peg$c35 = function(s, p) {\n var x = {};\n if(typeof s==='string' && s!=='[]') x[\"@id\"] = s;\n else if(typeof s==='object') Object.assign(x,s);\n if(p) Object.assign(x,p);\n return [x];\n },\n peg$c36 = function(s, p) {\n var x = {};\n if(s) Object.assign(x,s);\n if(p) Object.assign(x,p);\n return [x];\n },\n peg$c37 = \";\",\n peg$c38 = peg$literalExpectation(\";\", false),\n peg$c39 = function(a, b, e, f) {var x={};x[e]=f;return x;},\n peg$c40 = function(a, b, d) {return d;},\n peg$c41 = function(a, b, c) {\n var x = {};\n c.unshift(createObject(a,b));\n c.forEach(t=>{\n if(!t) return;\n Object.keys(t).forEach(key=>{\n t[key].forEach(val=>{\n if(key===\"@type\" && val[\"@id\"]!==undefined) val = val[\"@id\"];\n if(x[key]===undefined) x[key] = val;\n else if(Array.isArray(x[key])) x[key].push(val);\n else x[key] = [x[key],val];\n });\n });\n });\n return x;\n },\n peg$c42 = \",\",\n peg$c43 = peg$literalExpectation(\",\", false),\n peg$c44 = function(a, c) {return c;},\n peg$c45 = function(a, b) {\n b.unshift(a);\n return b;\n },\n peg$c46 = \"a\",\n peg$c47 = peg$literalExpectation(\"a\", false),\n peg$c48 = function() {return '@type';},\n peg$c49 = function(a) {return expandList(a,true);},\n peg$c50 = function(a) {return expandList(a,false);},\n peg$c51 = function(a) {return a===\"[]\" ? {} : {\"@id\":a};},\n peg$c52 = function(a) {return {\"@id\":a};},\n peg$c53 = \"[\",\n peg$c54 = peg$literalExpectation(\"[\", false),\n peg$c55 = \"]\",\n peg$c56 = peg$literalExpectation(\"]\", false),\n peg$c57 = \"(\",\n peg$c58 = peg$literalExpectation(\"(\", false),\n peg$c59 = \")\",\n peg$c60 = peg$literalExpectation(\")\", false),\n peg$c61 = function(a) {return {\"@list\":a};},\n peg$c62 = function(a, b) {return {\"@value\":a,\"@language\":b};},\n peg$c63 = \"^^\",\n peg$c64 = peg$literalExpectation(\"^^\", false),\n peg$c65 = function(a, b) {\n if(b===\"http://www.w3.org/2001/XMLSchema#boolean\" && a===\"true\") return true;\n if(b===\"http://www.w3.org/2001/XMLSchema#boolean\" && a===\"false\") return false;\n if(b===\"http://www.w3.org/2001/XMLSchema#integer\") return parseInt(a);\n if(b===\"http://www.w3.org/2001/XMLSchema#double\") return parseFloat(a);\n\n const uri = context.resolve(b,true);\n if(uri){\n const prefix = b.split(\":\")[0];\n if(uri===\"http://www.w3.org/2001/XMLSchema#boolean\" && a===\"true\"){\n context.decrement(prefix);\n return true;\n }\n if(uri===\"http://www.w3.org/2001/XMLSchema#boolean\" && a===\"false\"){\n context.decrement(prefix);\n return false;\n }\n if(uri===\"http://www.w3.org/2001/XMLSchema#integer\"){\n context.decrement(prefix);\n return parseInt(a);\n }\n if(uri===\"http://www.w3.org/2001/XMLSchema#double\"){\n context.decrement(prefix);\n return parseFloat(a);\n }\n }\n return {\"@value\":a,\"@type\":b};\n },\n peg$c66 = \"true\",\n peg$c67 = peg$literalExpectation(\"true\", false),\n peg$c68 = function() {return true;},\n peg$c69 = \"false\",\n peg$c70 = peg$literalExpectation(\"false\", false),\n peg$c71 = function() {return false;},\n peg$c72 = function(a) {return a+\":\";},\n peg$c73 = \"<\",\n peg$c74 = peg$literalExpectation(\"<\", false),\n peg$c75 = /^[^\\0- <>\"{}|\\^`\\\\]/,\n peg$c76 = peg$classExpectation([[\"\\0\", \" \"], \"<\", \">\", \"\\\"\", \"{\", \"}\", \"|\", \"^\", \"`\", \"\\\\\"], true, false),\n peg$c77 = \">\",\n peg$c78 = peg$literalExpectation(\">\", false),\n peg$c79 = function(a) {\n const decoded = a.map(s=> {\n if(0x10000 <= s.codePointAt(0) && s.codePointAt(0) <= 0xeffff) return 'a';\n if(s.length===1) return s;\n if(s.length===6) return String.fromCharCode(\"0x\"+s.substring(2));\n if(s.length===10) return String.fromCodePoint(\"0x\"+s.substring(2));\n return s;\n }).join(\"\");\n if(decoded.match(/^[^\\u0000-\\u0020<>\"{}|^`\\\\]*$/)){\n var join = a.join(\"\");\n try{\n return context.resolve(join);\n }catch(e){\n error(\"Invalid IRIREF \"+join);\n }\n }\n else error(\"Invalid IRIREF \"+a.join(\"\")+\" / \"+decoded);\n },\n peg$c80 = \":\",\n peg$c81 = peg$literalExpectation(\":\", false),\n peg$c82 = function(a) {\n a = a || \"0\";\n if(context.hasPrefix(a)===false)\n error(\"undefined prefix \"+a);\n return a;\n },\n peg$c83 = function(a) {return (a||\"\");},\n peg$c84 = function(a, b) {\n context.increment(a);\n return context.resolve(a+\":\"+b);\n },\n peg$c85 = \"_:\",\n peg$c86 = peg$literalExpectation(\"_:\", false),\n peg$c87 = /^[0-9]/,\n peg$c88 = peg$classExpectation([[\"0\", \"9\"]], false, false),\n peg$c89 = \"@\",\n peg$c90 = peg$literalExpectation(\"@\", false),\n peg$c91 = /^[a-zA-Z]/,\n peg$c92 = peg$classExpectation([[\"a\", \"z\"], [\"A\", \"Z\"]], false, false),\n peg$c93 = \"-\",\n peg$c94 = peg$literalExpectation(\"-\", false),\n peg$c95 = /^[a-zA-Z0-9]/,\n peg$c96 = peg$classExpectation([[\"a\", \"z\"], [\"A\", \"Z\"], [\"0\", \"9\"]], false, false),\n peg$c97 = function(a, s) {return '-'+s.join(\"\");},\n peg$c98 = function(a, b) {return a.join(\"\")+b.join(\"\");},\n peg$c99 = /^[+\\-]/,\n peg$c100 = peg$classExpectation([\"+\", \"-\"], false, false),\n peg$c101 = function(a) {\n if(a.match(/^[0+][0-9]+$/))\n return {\n \"@value\" : a,\n \"@type\" : \"http://www.w3.org/2001/XMLSchema#integer\"\n };\n return parseInt(a);\n },\n peg$c102 = function(a) {\n return {\n \"@value\" : a,\n \"@type\" : \"http://www.w3.org/2001/XMLSchema#decimal\"\n }\n },\n peg$c103 = function(a) {\n return {\n \"@value\" : a,\n \"@type\" : \"http://www.w3.org/2001/XMLSchema#double\"\n };\n },\n peg$c104 = /^[eE]/,\n peg$c105 = peg$classExpectation([\"e\", \"E\"], false, false),\n peg$c106 = \"\\\"\",\n peg$c107 = peg$literalExpectation(\"\\\"\", false),\n peg$c108 = /^[^\"\\\\\\n\\r]/,\n peg$c109 = peg$classExpectation([\"\\\"\", \"\\\\\", \"\\n\", \"\\r\"], true, false),\n peg$c110 = \"'\",\n peg$c111 = peg$literalExpectation(\"'\", false),\n peg$c112 = /^[^'\\\\\\n\\r]/,\n peg$c113 = peg$classExpectation([\"'\", \"\\\\\", \"\\n\", \"\\r\"], true, false),\n peg$c114 = \"'''\",\n peg$c115 = peg$literalExpectation(\"'''\", false),\n peg$c116 = /^[^'\\\\]/,\n peg$c117 = peg$classExpectation([\"'\", \"\\\\\"], true, false),\n peg$c118 = \"''\",\n peg$c119 = peg$literalExpectation(\"''\", false),\n peg$c120 = function(head, a) {return \"''\"+a.join(\"\");},\n peg$c121 = function(head, a) {return \"'\" +a.join(\"\");},\n peg$c122 = function(head, body) {return head.join(\"\")+body.join(\"\");},\n peg$c123 = \"\\\"\\\"\\\"\",\n peg$c124 = peg$literalExpectation(\"\\\"\\\"\\\"\", false),\n peg$c125 = /^[^\"\\\\]/,\n peg$c126 = peg$classExpectation([\"\\\"\", \"\\\\\"], true, false),\n peg$c127 = \"\\\"\\\"\",\n peg$c128 = peg$literalExpectation(\"\\\"\\\"\", false),\n peg$c129 = function(head, a) {return '\"\"'+a.join(\"\");},\n peg$c130 = function(head, a) {return '\"' +a.join(\"\");},\n peg$c131 = \"\\\\U\",\n peg$c132 = peg$literalExpectation(\"\\\\U\", false),\n peg$c133 = function(hex) {\n return String.fromCodePoint(parseInt(hex.join(\"\"),16));\n },\n peg$c134 = \"\\\\u\",\n peg$c135 = peg$literalExpectation(\"\\\\u\", false),\n peg$c136 = function(hex) {\n return String.fromCharCode(parseInt(hex.join(\"\"),16));\n },\n peg$c137 = \"\\\\t\",\n peg$c138 = peg$literalExpectation(\"\\\\t\", false),\n peg$c139 = function() {return '\\t';},\n peg$c140 = \"\\\\b\",\n peg$c141 = peg$literalExpectation(\"\\\\b\", false),\n peg$c142 = function() {return '\\b';},\n peg$c143 = \"\\\\n\",\n peg$c144 = peg$literalExpectation(\"\\\\n\", false),\n peg$c145 = function() {return '\\n';},\n peg$c146 = \"\\\\r\",\n peg$c147 = peg$literalExpectation(\"\\\\r\", false),\n peg$c148 = function() {return '\\r';},\n peg$c149 = \"\\\\f\",\n peg$c150 = peg$literalExpectation(\"\\\\f\", false),\n peg$c151 = function() {return '\\f';},\n peg$c152 = \"\\\\\\\"\",\n peg$c153 = peg$literalExpectation(\"\\\\\\\"\", false),\n peg$c154 = function() {return '\"';},\n peg$c155 = \"\\\\'\",\n peg$c156 = peg$literalExpectation(\"\\\\'\", false),\n peg$c157 = function() {return \"'\";},\n peg$c158 = \"\\\\\\\\\",\n peg$c159 = peg$literalExpectation(\"\\\\\\\\\", false),\n peg$c160 = function() {return '\\\\';},\n peg$c161 = /^[ \\t\\r\\n]/,\n peg$c162 = peg$classExpectation([\" \", \"\\t\", \"\\r\", \"\\n\"], false, false),\n peg$c163 = function() {return \"[]\";},\n peg$c164 = /^[\\uD800-\\uDBFF]/,\n peg$c165 = peg$classExpectation([[\"\\uD800\", \"\\uDBFF\"]], false, false),\n peg$c166 = /^[\\uDC00-\\uDFFF]/,\n peg$c167 = peg$classExpectation([[\"\\uDC00\", \"\\uDFFF\"]], false, false),\n peg$c168 = function(a, b) {return a+b;},\n peg$c169 = /^[A-Za-z\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/,\n peg$c170 = peg$classExpectation([[\"A\", \"Z\"], [\"a\", \"z\"], [\"\\xC0\", \"\\xD6\"], [\"\\xD8\", \"\\xF6\"], [\"\\xF8\", \"\\u02FF\"], [\"\\u0370\", \"\\u037D\"], [\"\\u037F\", \"\\u1FFF\"], [\"\\u200C\", \"\\u200D\"], [\"\\u2070\", \"\\u218F\"], [\"\\u2C00\", \"\\u2FEF\"], [\"\\u3001\", \"\\uD7FF\"], [\"\\uF900\", \"\\uFDCF\"], [\"\\uFDF0\", \"\\uFFFD\"]], false, false),\n peg$c171 = \"_\",\n peg$c172 = peg$literalExpectation(\"_\", false),\n peg$c173 = \"\\xB7\",\n peg$c174 = peg$literalExpectation(\"\\xB7\", false),\n peg$c175 = /^[\\u0300-\\u036F]/,\n peg$c176 = peg$classExpectation([[\"\\u0300\", \"\\u036F\"]], false, false),\n peg$c177 = /^[\\u203F-\\u2040]/,\n peg$c178 = peg$classExpectation([[\"\\u203F\", \"\\u2040\"]], false, false),\n peg$c179 = function(head, body, a, b) {return a.join(\"\")+b.join(\"\");},\n peg$c180 = function(head, body, tail) {return head+body.join(\"\")+tail.join(\"\");},\n peg$c181 = \"%\",\n peg$c182 = peg$literalExpectation(\"%\", false),\n peg$c183 = /^[0-9A-Fa-f]/,\n peg$c184 = peg$classExpectation([[\"0\", \"9\"], [\"A\", \"F\"], [\"a\", \"f\"]], false, false),\n peg$c185 = \"\\\\\",\n peg$c186 = peg$literalExpectation(\"\\\\\", false),\n peg$c187 = /^[_~.!$&'()*+,;=\\/?#@%\\-]/,\n peg$c188 = peg$classExpectation([\"_\", \"~\", \".\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\", \"/\", \"?\", \"#\", \"@\", \"%\", \"-\"], false, false),\n\n peg$currPos = 0,\n peg$savedPos = 0,\n peg$posDetailsCache = [{ line: 1, column: 1 }],\n peg$maxFailPos = 0,\n peg$maxFailExpected = [],\n peg$silentFails = 0,\n\n peg$result;\n\n if (\"startRule\" in options) {\n if (!(options.startRule in peg$startRuleFunctions)) {\n throw new Error(\"Can't start parsing from rule \\\"\" + options.startRule + \"\\\".\");\n }\n\n peg$startRuleFunction = peg$startRuleFunctions[options.startRule];\n }\n\n function text() {\n return input.substring(peg$savedPos, peg$currPos);\n }\n\n function location() {\n return peg$computeLocation(peg$savedPos, peg$currPos);\n }\n\n function expected(description, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildStructuredError(\n [peg$otherExpectation(description)],\n input.substring(peg$savedPos, peg$currPos),\n location\n );\n }\n\n function error(message, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildSimpleError(message, location);\n }\n\n function peg$literalExpectation(text, ignoreCase) {\n return { type: \"literal\", text: text, ignoreCase: ignoreCase };\n }\n\n function peg$classExpectation(parts, inverted, ignoreCase) {\n return { type: \"class\", parts: parts, inverted: inverted, ignoreCase: ignoreCase };\n }\n\n function peg$anyExpectation() {\n return { type: \"any\" };\n }\n\n function peg$endExpectation() {\n return { type: \"end\" };\n }\n\n function peg$otherExpectation(description) {\n return { type: \"other\", description: description };\n }\n\n function peg$computePosDetails(pos) {\n var details = peg$posDetailsCache[pos], p;\n\n if (details) {\n return details;\n } else {\n p = pos - 1;\n while (!peg$posDetailsCache[p]) {\n p--;\n }\n\n details = peg$posDetailsCache[p];\n details = {\n line: details.line,\n column: details.column\n };\n\n while (p < pos) {\n if (input.charCodeAt(p) === 10) {\n details.line++;\n details.column = 1;\n } else {\n details.column++;\n }\n\n p++;\n }\n\n peg$posDetailsCache[pos] = details;\n return details;\n }\n }\n\n function peg$computeLocation(startPos, endPos) {\n var startPosDetails = peg$computePosDetails(startPos),\n endPosDetails = peg$computePosDetails(endPos);\n\n return {\n start: {\n offset: startPos,\n line: startPosDetails.line,\n column: startPosDetails.column\n },\n end: {\n offset: endPos,\n line: endPosDetails.line,\n column: endPosDetails.column\n }\n };\n }\n\n function peg$fail(expected) {\n if (peg$currPos < peg$maxFailPos) { return; }\n\n if (peg$currPos > peg$maxFailPos) {\n peg$maxFailPos = peg$currPos;\n peg$maxFailExpected = [];\n }\n\n peg$maxFailExpected.push(expected);\n }\n\n function peg$buildSimpleError(message, location) {\n return new peg$SyntaxError(message, null, null, location);\n }\n\n function peg$buildStructuredError(expected, found, location) {\n return new peg$SyntaxError(\n peg$SyntaxError.buildMessage(expected, found),\n expected,\n found,\n location\n );\n }\n\n function peg$parseturtleDoc() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parsestatement();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parsestatement();\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseIGNORE();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseIGNORE();\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c0(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsestatement() {\n var s0, s1, s2, s3;\n\n s0 = peg$parsedirective();\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsetriples();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseIGNORE();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseIGNORE();\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s3 = peg$c1;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseCOMMENT() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 35) {\n s1 = peg$c4;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c5); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c6.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c7); }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c6.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c7); }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 10) {\n s3 = peg$c8;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c9); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c10(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseIGNORE() {\n var s0;\n\n s0 = peg$parseWS();\n if (s0 === peg$FAILED) {\n s0 = peg$parseCOMMENT();\n }\n\n return s0;\n }\n\n function peg$parsedirective() {\n var s0;\n\n s0 = peg$parseprefixID();\n if (s0 === peg$FAILED) {\n s0 = peg$parsebase();\n if (s0 === peg$FAILED) {\n s0 = peg$parsesparqlPrefix();\n if (s0 === peg$FAILED) {\n s0 = peg$parsesparqlBase();\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseprefixID() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.substr(peg$currPos, 7) === peg$c11) {\n s2 = peg$c11;\n peg$currPos += 7;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c12); }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseIGNORE();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseIGNORE();\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parsePNAME_NS_NO_CHECK();\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parseIGNORE();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseIGNORE();\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseIRIREF();\n if (s6 !== peg$FAILED) {\n s7 = [];\n s8 = peg$parseIGNORE();\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n s8 = peg$parseIGNORE();\n }\n if (s7 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s8 = peg$c1;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s8 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c13(s4, s6);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsebase() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c14) {\n s2 = peg$c14;\n peg$currPos += 5;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c15); }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseIGNORE();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseIGNORE();\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parseIRIREF();\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parseIGNORE();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseIGNORE();\n }\n if (s5 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c1;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c16(s4);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsesparqlBase() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (peg$c17.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c18); }\n }\n if (s2 !== peg$FAILED) {\n if (peg$c19.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c20); }\n }\n if (s3 !== peg$FAILED) {\n if (peg$c21.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c22); }\n }\n if (s4 !== peg$FAILED) {\n if (peg$c23.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c24); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n s7 = peg$parseIGNORE();\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n s7 = peg$parseIGNORE();\n }\n if (s6 !== peg$FAILED) {\n s7 = peg$parseIRIREF();\n if (s7 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c16(s7);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsesparqlPrefix() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (peg$c25.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c26); }\n }\n if (s2 !== peg$FAILED) {\n if (peg$c27.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c28); }\n }\n if (s3 !== peg$FAILED) {\n if (peg$c23.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c24); }\n }\n if (s4 !== peg$FAILED) {\n if (peg$c29.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c30); }\n }\n if (s5 !== peg$FAILED) {\n if (peg$c31.test(input.charAt(peg$currPos))) {\n s6 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c32); }\n }\n if (s6 !== peg$FAILED) {\n if (peg$c33.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c34); }\n }\n if (s7 !== peg$FAILED) {\n s8 = [];\n s9 = peg$parseIGNORE();\n while (s9 !== peg$FAILED) {\n s8.push(s9);\n s9 = peg$parseIGNORE();\n }\n if (s8 !== peg$FAILED) {\n s9 = peg$parsePNAME_NS_NO_CHECK();\n if (s9 !== peg$FAILED) {\n s10 = [];\n s11 = peg$parseIGNORE();\n while (s11 !== peg$FAILED) {\n s10.push(s11);\n s11 = peg$parseIGNORE();\n }\n if (s10 !== peg$FAILED) {\n s11 = peg$parseIRIREF();\n if (s11 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c13(s9, s11);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsetriples() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsesubject();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsepredicateObjectList();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c35(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseblankNodePropertyList();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsepredicateObjectList();\n if (s2 === peg$FAILED) {\n s2 = null;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c36(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parsepredicateObjectList() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;\n\n s0 = peg$currPos;\n s1 = peg$parseverb();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseobjectList();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n s5 = [];\n s6 = peg$parseIGNORE();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseIGNORE();\n }\n if (s5 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 59) {\n s6 = peg$c37;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c38); }\n }\n if (s6 !== peg$FAILED) {\n s7 = peg$currPos;\n s8 = peg$parseverb();\n if (s8 !== peg$FAILED) {\n s9 = peg$parseobjectList();\n if (s9 !== peg$FAILED) {\n peg$savedPos = s7;\n s8 = peg$c39(s1, s2, s8, s9);\n s7 = s8;\n } else {\n peg$currPos = s7;\n s7 = peg$FAILED;\n }\n } else {\n peg$currPos = s7;\n s7 = peg$FAILED;\n }\n if (s7 === peg$FAILED) {\n s7 = null;\n }\n if (s7 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c40(s1, s2, s7);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n s5 = [];\n s6 = peg$parseIGNORE();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseIGNORE();\n }\n if (s5 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 59) {\n s6 = peg$c37;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c38); }\n }\n if (s6 !== peg$FAILED) {\n s7 = peg$currPos;\n s8 = peg$parseverb();\n if (s8 !== peg$FAILED) {\n s9 = peg$parseobjectList();\n if (s9 !== peg$FAILED) {\n peg$savedPos = s7;\n s8 = peg$c39(s1, s2, s8, s9);\n s7 = s8;\n } else {\n peg$currPos = s7;\n s7 = peg$FAILED;\n }\n } else {\n peg$currPos = s7;\n s7 = peg$FAILED;\n }\n if (s7 === peg$FAILED) {\n s7 = null;\n }\n if (s7 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c40(s1, s2, s7);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c41(s1, s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseobjectList() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n s1 = peg$parseobject();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n s4 = [];\n s5 = peg$parseIGNORE();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parseIGNORE();\n }\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s5 = peg$c42;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseobject();\n if (s6 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c44(s1, s6);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n s4 = [];\n s5 = peg$parseIGNORE();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parseIGNORE();\n }\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s5 = peg$c42;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c43); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseobject();\n if (s6 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c44(s1, s6);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c45(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseverb() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsepredicate();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 97) {\n s2 = peg$c46;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c47); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c48();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parsesubject() {\n var s0, s1;\n\n s0 = peg$currPos;\n s1 = peg$parsecollection();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c49(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$parseBlankNode();\n if (s0 === peg$FAILED) {\n s0 = peg$parseiri();\n }\n }\n\n return s0;\n }\n\n function peg$parsepredicate() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseiri();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseobject() {\n var s0, s1;\n\n s0 = peg$parseliteral();\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsecollection();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c50(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseBlankNode();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c51(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseblankNodePropertyList();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseiri();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c52(s1);\n }\n s0 = s1;\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseliteral() {\n var s0;\n\n s0 = peg$parseRDFLiteral();\n if (s0 === peg$FAILED) {\n s0 = peg$parseNumericLiteral();\n if (s0 === peg$FAILED) {\n s0 = peg$parseBooleanLiteral();\n }\n }\n\n return s0;\n }\n\n function peg$parseblankNodePropertyList() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 91) {\n s2 = peg$c53;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c54); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parsepredicateObjectList();\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$parseIGNORE();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parseIGNORE();\n }\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 93) {\n s5 = peg$c55;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c56); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsecollection() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 40) {\n s2 = peg$c57;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c58); }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseobject();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseobject();\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$parseIGNORE();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parseIGNORE();\n }\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c59;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c60); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c61(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseNumericLiteral() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseDOUBLE();\n if (s2 === peg$FAILED) {\n s2 = peg$parseDECIMAL();\n if (s2 === peg$FAILED) {\n s2 = peg$parseINTEGER();\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseRDFLiteral() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseString();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseIGNORE();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseIGNORE();\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parseLANGTAG();\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c62(s2, s4);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseString();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseIGNORE();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseIGNORE();\n }\n if (s3 !== peg$FAILED) {\n if (input.substr(peg$currPos, 2) === peg$c63) {\n s4 = peg$c63;\n peg$currPos += 2;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c64); }\n }\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parseIGNORE();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseIGNORE();\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseiri();\n if (s6 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c65(s2, s6);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseString();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseBooleanLiteral() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c66) {\n s2 = peg$c66;\n peg$currPos += 4;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c67); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c68();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c69) {\n s2 = peg$c69;\n peg$currPos += 5;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c70); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c71();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseString() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseSTRING_LITERAL_LONG_SINGLE_QUOTE();\n if (s2 === peg$FAILED) {\n s2 = peg$parseSTRING_LITERAL_LONG_QUOTE();\n if (s2 === peg$FAILED) {\n s2 = peg$parseSTRING_LITERAL_SINGLE_QUOTE();\n if (s2 === peg$FAILED) {\n s2 = peg$parseSTRING_LITERAL_QUOTE();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseiri() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseIRIREF();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parsePrefixedName();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parsePrefixedName() {\n var s0, s1;\n\n s0 = peg$parsePNAME_LN();\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsePNAME_NS();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c72(s1);\n }\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parseBlankNode() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseBLANK_NODE_LABEL();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseANON();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseIRIREF() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 60) {\n s1 = peg$c73;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c74); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c75.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c76); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c75.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c76); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 62) {\n s3 = peg$c77;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c78); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c79(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsePNAME_NS() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsePN_PREFIX();\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s2 = peg$c80;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c82(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsePNAME_NS_NO_CHECK() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsePN_PREFIX();\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s2 = peg$c80;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c83(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsePNAME_LN() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsePNAME_NS();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsePN_LOCAL();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c84(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseBLANK_NODE_LABEL() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c85) {\n s2 = peg$c85;\n peg$currPos += 2;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c86); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parsePN_CHARS_U();\n if (s3 === peg$FAILED) {\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$parsePN_CHARS();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parsePN_CHARS();\n }\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$currPos;\n s7 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s8 = peg$c1;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s8 !== peg$FAILED) {\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n if (input.charCodeAt(peg$currPos) === 46) {\n s8 = peg$c1;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n }\n } else {\n s7 = peg$FAILED;\n }\n if (s7 !== peg$FAILED) {\n s8 = [];\n s9 = peg$parsePN_CHARS();\n if (s9 !== peg$FAILED) {\n while (s9 !== peg$FAILED) {\n s8.push(s9);\n s9 = peg$parsePN_CHARS();\n }\n } else {\n s8 = peg$FAILED;\n }\n if (s8 !== peg$FAILED) {\n s7 = [s7, s8];\n s6 = s7;\n } else {\n peg$currPos = s6;\n s6 = peg$FAILED;\n }\n } else {\n peg$currPos = s6;\n s6 = peg$FAILED;\n }\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$currPos;\n s7 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s8 = peg$c1;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s8 !== peg$FAILED) {\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n if (input.charCodeAt(peg$currPos) === 46) {\n s8 = peg$c1;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n }\n } else {\n s7 = peg$FAILED;\n }\n if (s7 !== peg$FAILED) {\n s8 = [];\n s9 = peg$parsePN_CHARS();\n if (s9 !== peg$FAILED) {\n while (s9 !== peg$FAILED) {\n s8.push(s9);\n s9 = peg$parsePN_CHARS();\n }\n } else {\n s8 = peg$FAILED;\n }\n if (s8 !== peg$FAILED) {\n s7 = [s7, s8];\n s6 = s7;\n } else {\n peg$currPos = s6;\n s6 = peg$FAILED;\n }\n } else {\n peg$currPos = s6;\n s6 = peg$FAILED;\n }\n }\n if (s5 !== peg$FAILED) {\n s2 = [s2, s3, s4, s5];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parseLANGTAG() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 64) {\n s1 = peg$c89;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c91.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c92); }\n }\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c91.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c92); }\n }\n }\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 45) {\n s5 = peg$c93;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c94); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c95.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c96); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c95.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c96); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c97(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 45) {\n s5 = peg$c93;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c94); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c95.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c96); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c95.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c96); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c97(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c98(s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseINTEGER() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = peg$currPos;\n if (peg$c99.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c100); }\n }\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n if (s5 !== peg$FAILED) {\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n } else {\n s4 = peg$FAILED;\n }\n if (s4 !== peg$FAILED) {\n s3 = [s3, s4];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n s1 = input.substring(s1, peg$currPos);\n } else {\n s1 = s2;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c101(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parseDECIMAL() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = peg$currPos;\n if (peg$c99.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c100); }\n }\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s5 = peg$c1;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n s3 = [s3, s4, s5, s6];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n s1 = input.substring(s1, peg$currPos);\n } else {\n s1 = s2;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c102(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parseDOUBLE() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = peg$currPos;\n if (peg$c99.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c100); }\n }\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$currPos;\n s5 = [];\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s6 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s6 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c1;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s6 !== peg$FAILED) {\n s7 = [];\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s8 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s8 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n if (s7 !== peg$FAILED) {\n s8 = peg$parseEXPONENT();\n if (s8 !== peg$FAILED) {\n s5 = [s5, s6, s7, s8];\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s5 = peg$c1;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n s7 = peg$parseEXPONENT();\n if (s7 !== peg$FAILED) {\n s5 = [s5, s6, s7];\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n s5 = [];\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s6 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s6 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseEXPONENT();\n if (s6 !== peg$FAILED) {\n s5 = [s5, s6];\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n }\n if (s4 !== peg$FAILED) {\n s3 = [s3, s4];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n s1 = input.substring(s1, peg$currPos);\n } else {\n s1 = s2;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c103(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parseEXPONENT() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (peg$c104.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c105); }\n }\n if (s2 !== peg$FAILED) {\n if (peg$c99.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c100); }\n }\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n if (s5 !== peg$FAILED) {\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n }\n } else {\n s4 = peg$FAILED;\n }\n if (s4 !== peg$FAILED) {\n s2 = [s2, s3, s4];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parseSTRING_LITERAL_QUOTE() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s1 = peg$c106;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c107); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c108.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c109); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c108.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c109); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 34) {\n s3 = peg$c106;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c107); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c10(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseSTRING_LITERAL_SINGLE_QUOTE() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 39) {\n s1 = peg$c110;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c111); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c112.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c113); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c112.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c113); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 39) {\n s3 = peg$c110;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c111); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c10(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseSTRING_LITERAL_LONG_SINGLE_QUOTE() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 3) === peg$c114) {\n s1 = peg$c114;\n peg$currPos += 3;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c115); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c118) {\n s5 = peg$c118;\n peg$currPos += 2;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c119); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c120(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 39) {\n s5 = peg$c110;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c111); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c121(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c118) {\n s5 = peg$c118;\n peg$currPos += 2;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c119); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c120(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 39) {\n s5 = peg$c110;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c111); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c116.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c121(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n }\n if (s3 !== peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c114) {\n s4 = peg$c114;\n peg$currPos += 3;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c115); }\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c122(s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseSTRING_LITERAL_LONG_QUOTE() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 3) === peg$c123) {\n s1 = peg$c123;\n peg$currPos += 3;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c124); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c127) {\n s5 = peg$c127;\n peg$currPos += 2;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c128); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c129(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s5 = peg$c106;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c107); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c130(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c127) {\n s5 = peg$c127;\n peg$currPos += 2;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c128); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c129(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s5 = peg$c106;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c107); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c125.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c130(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n }\n if (s3 !== peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c123) {\n s4 = peg$c123;\n peg$currPos += 3;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c124); }\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c122(s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseUCHAR() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c131) {\n s1 = peg$c131;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c132); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n s3 = peg$parseHEX();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseHEX();\n if (s4 !== peg$FAILED) {\n s5 = peg$parseHEX();\n if (s5 !== peg$FAILED) {\n s6 = peg$parseHEX();\n if (s6 !== peg$FAILED) {\n s7 = peg$parseHEX();\n if (s7 !== peg$FAILED) {\n s8 = peg$parseHEX();\n if (s8 !== peg$FAILED) {\n s9 = peg$parseHEX();\n if (s9 !== peg$FAILED) {\n s10 = peg$parseHEX();\n if (s10 !== peg$FAILED) {\n s3 = [s3, s4, s5, s6, s7, s8, s9, s10];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c133(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c134) {\n s1 = peg$c134;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c135); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n s3 = peg$parseHEX();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseHEX();\n if (s4 !== peg$FAILED) {\n s5 = peg$parseHEX();\n if (s5 !== peg$FAILED) {\n s6 = peg$parseHEX();\n if (s6 !== peg$FAILED) {\n s3 = [s3, s4, s5, s6];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c136(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseECHAR() {\n var s0, s1;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c137) {\n s1 = peg$c137;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c138); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c139();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c140) {\n s1 = peg$c140;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c141); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c142();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c143) {\n s1 = peg$c143;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c144); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c145();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c146) {\n s1 = peg$c146;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c147); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c148();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c149) {\n s1 = peg$c149;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c150); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c151();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c152) {\n s1 = peg$c152;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c153); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c154();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c155) {\n s1 = peg$c155;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c156); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c157();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c158) {\n s1 = peg$c158;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c159); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c160();\n }\n s0 = s1;\n }\n }\n }\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseWS() {\n var s0;\n\n if (peg$c161.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c162); }\n }\n\n return s0;\n }\n\n function peg$parseANON() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 91) {\n s1 = peg$c53;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c54); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseIGNORE();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseIGNORE();\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 93) {\n s3 = peg$c55;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c56); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c163();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsePN_CHARS_BASE() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n if (peg$c164.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c165); }\n }\n if (s1 !== peg$FAILED) {\n if (peg$c166.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c167); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c168(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n if (peg$c169.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c170); }\n }\n }\n\n return s0;\n }\n\n function peg$parsePN_CHARS_U() {\n var s0;\n\n s0 = peg$parsePN_CHARS_BASE();\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 95) {\n s0 = peg$c171;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c172); }\n }\n }\n\n return s0;\n }\n\n function peg$parsePN_CHARS() {\n var s0;\n\n s0 = peg$parsePN_CHARS_U();\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 45) {\n s0 = peg$c93;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c94); }\n }\n if (s0 === peg$FAILED) {\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 183) {\n s0 = peg$c173;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c174); }\n }\n if (s0 === peg$FAILED) {\n if (peg$c175.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c176); }\n }\n if (s0 === peg$FAILED) {\n if (peg$c177.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c178); }\n }\n }\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parsePN_PREFIX() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = peg$parsePN_CHARS_BASE();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parsePN_CHARS();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parsePN_CHARS();\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$currPos;\n s6 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s7 = peg$c1;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (input.charCodeAt(peg$currPos) === 46) {\n s7 = peg$c1;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n s7 = [];\n s8 = peg$parsePN_CHARS();\n if (s8 !== peg$FAILED) {\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n s8 = peg$parsePN_CHARS();\n }\n } else {\n s7 = peg$FAILED;\n }\n if (s7 !== peg$FAILED) {\n s6 = [s6, s7];\n s5 = s6;\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$currPos;\n s6 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s7 = peg$c1;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (input.charCodeAt(peg$currPos) === 46) {\n s7 = peg$c1;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n s7 = [];\n s8 = peg$parsePN_CHARS();\n if (s8 !== peg$FAILED) {\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n s8 = peg$parsePN_CHARS();\n }\n } else {\n s7 = peg$FAILED;\n }\n if (s7 !== peg$FAILED) {\n s6 = [s6, s7];\n s5 = s6;\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n }\n if (s4 !== peg$FAILED) {\n s2 = [s2, s3, s4];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parsePN_LOCAL() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n s1 = peg$parsePN_CHARS_U();\n if (s1 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s1 = peg$c80;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s1 === peg$FAILED) {\n if (peg$c87.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n if (s1 === peg$FAILED) {\n s1 = peg$parsePLX();\n }\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parsePN_CHARS();\n if (s3 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s3 = peg$c80;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parsePLX();\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parsePN_CHARS();\n if (s3 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s3 = peg$c80;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parsePLX();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n s5 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c1;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c1;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n s7 = peg$parsePN_CHARS();\n if (s7 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s7 = peg$c80;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parsePLX();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n s7 = peg$parsePN_CHARS();\n if (s7 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s7 = peg$c80;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parsePLX();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c179(s1, s2, s5, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n s5 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c1;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c1;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n s7 = peg$parsePN_CHARS();\n if (s7 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s7 = peg$c80;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parsePLX();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n s7 = peg$parsePN_CHARS();\n if (s7 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s7 = peg$c80;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c81); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parsePLX();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c179(s1, s2, s5, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c180(s1, s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsePLX() {\n var s0;\n\n s0 = peg$parsePERCENT();\n if (s0 === peg$FAILED) {\n s0 = peg$parsePN_LOCAL_ESC();\n }\n\n return s0;\n }\n\n function peg$parsePERCENT() {\n var s0, s1, s2, s3, s4;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 37) {\n s2 = peg$c181;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c182); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parseHEX();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseHEX();\n if (s4 !== peg$FAILED) {\n s2 = [s2, s3, s4];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parseHEX() {\n var s0;\n\n if (peg$c183.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c184); }\n }\n\n return s0;\n }\n\n function peg$parsePN_LOCAL_ESC() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s1 = peg$c185;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c186); }\n }\n if (s1 !== peg$FAILED) {\n if (peg$c187.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c188); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c3(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n\n var isBrowser=new Function(\"try {return this===window;}catch(e){ return false;}\");\n var URL = isBrowser() ? window.URL : require(\"url\").URL;\n var isIRI = function(a){return a.match(/^[a-z](.*?):(.+?)/g);};\n function createObject(property,value){var a={};a[property]=value;return a;}\n var context = {\n base : [],\n data : {},\n addBase : function(uri){\n if(context.base.length===0){\n context.base.push(uri);\n return;\n }\n const last = context.base[context.base.length-1];\n if(last!==uri) context.base.push(new URL(uri,last).toString());\n },\n addPrefix : function(prefix,uri){\n const list = context.data[prefix];\n if(list===undefined){\n context.data[prefix] = [{uri:uri,count:0}];\n }else if(list[list.length-1].uri!==uri){\n list.push({uri:uri,count:0});\n }\n },\n hasPrefix : function(prefix){\n return this.data[prefix]!==undefined;\n },\n resolve : function(pname,force){\n const prefix = Object.keys(context.data).find(key=>pname.indexOf(key+\":\")===0);\n if(prefix!==undefined) {\n const list = context.data[prefix];\n if(list.length===1 && force!==true && isIRI(list[0].uri)) return pname;\n const uri = list[list.length-1].uri;\n return pname.replace(prefix+\":\",uri);\n }else{\n var base = context.base.length === 0 ? options.baseIRI : context.base[context.base.length-1];\n if(!base || pname.match(/^(http:|https:|urn:|file:)/)) return pname;\n if(pname.indexOf(\"//\")===0 && base) return base.split(\"//\")[0]+pname;\n return new URL(pname,base).toString();\n }\n },\n increment : function(prefix){\n const list = context.data[prefix];\n if(list!==undefined)list[list.length-1].count++;\n },\n decrement : function(prefix){\n const list = context.data[prefix];\n if(list!==undefined)list[list.length-1].count--;\n },\n toJSON : function(){\n const root = {};\n if(context.base.length>0){\n if(root[\"@context\"]===undefined)root[\"@context\"] = {};\n root[\"@context\"][\"@base\"] = context.base[0];\n }\n Object.keys(context.data).forEach(key=>{\n const head = context.data[key][0];\n if(head.uri===\"http://www.w3.org/2001/XMLSchema#\" && head.count < 1) return;\n if(!isIRI(head.uri)) return;\n if(root[\"@context\"]===undefined) root[\"@context\"] = {};\n root[\"@context\"][key] = head.uri;\n });\n return root;\n }\n };\n\n function expandList(container,force){\n if(container[\"@list\"]===undefined) return container;\n if(!force && !container[\"@list\"].find(x=>x[\"@list\"]!==undefined)) return container;\n\n if(container[\"@list\"].length===0)\n return {\"@id\" : \"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil\"};\n\n var root = {};\n var focus = null;\n container[\"@list\"].forEach(b=>{\n if(focus===null) focus = root;\n else {\n focus[\"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest\"] = {};\n focus = focus[\"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest\"];\n }\n focus[\"http://www.w3.org/1999/02/22-rdf-syntax-ns#first\"] = expandList(b,true);\n focus[\"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest\"] = {\n \"@id\" : \"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil\"\n };\n });\n return root;\n }\n\n\n peg$result = peg$startRuleFunction();\n\n if (peg$result !== peg$FAILED && peg$currPos === input.length) {\n return peg$result;\n } else {\n if (peg$result !== peg$FAILED && peg$currPos < input.length) {\n peg$fail(peg$endExpectation());\n }\n\n throw peg$buildStructuredError(\n peg$maxFailExpected,\n peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,\n peg$maxFailPos < input.length\n ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)\n : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)\n );\n }\n }\n\n return {\n SyntaxError: peg$SyntaxError,\n parse: peg$parse\n };\n});\n","// Currently in sync with Node.js lib/assert.js\n// https://github.com/nodejs/node/commit/2a51ae424a513ec9a6aa3466baa0cc1d55dd4f3b\n// Originally from narwhal.js (http://narwhaljs.org)\n// Copyright (c) 2009 Thomas Robinson <280north.com>\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the 'Software'), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar _require = require('./internal/errors'),\n _require$codes = _require.codes,\n ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE,\n ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE,\n ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;\n\nvar AssertionError = require('./internal/assert/assertion_error');\n\nvar _require2 = require('util/'),\n inspect = _require2.inspect;\n\nvar _require$types = require('util/').types,\n isPromise = _require$types.isPromise,\n isRegExp = _require$types.isRegExp;\n\nvar objectAssign = Object.assign ? Object.assign : require('es6-object-assign').assign;\nvar objectIs = Object.is ? Object.is : require('object-is');\nvar errorCache = new Map();\nvar isDeepEqual;\nvar isDeepStrictEqual;\nvar parseExpressionAt;\nvar findNodeAround;\nvar decoder;\n\nfunction lazyLoadComparison() {\n var comparison = require('./internal/util/comparisons');\n\n isDeepEqual = comparison.isDeepEqual;\n isDeepStrictEqual = comparison.isDeepStrictEqual;\n} // Escape control characters but not \\n and \\t to keep the line breaks and\n// indentation intact.\n// eslint-disable-next-line no-control-regex\n\n\nvar escapeSequencesRegExp = /[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f]/g;\nvar meta = [\"\\\\u0000\", \"\\\\u0001\", \"\\\\u0002\", \"\\\\u0003\", \"\\\\u0004\", \"\\\\u0005\", \"\\\\u0006\", \"\\\\u0007\", '\\\\b', '', '', \"\\\\u000b\", '\\\\f', '', \"\\\\u000e\", \"\\\\u000f\", \"\\\\u0010\", \"\\\\u0011\", \"\\\\u0012\", \"\\\\u0013\", \"\\\\u0014\", \"\\\\u0015\", \"\\\\u0016\", \"\\\\u0017\", \"\\\\u0018\", \"\\\\u0019\", \"\\\\u001a\", \"\\\\u001b\", \"\\\\u001c\", \"\\\\u001d\", \"\\\\u001e\", \"\\\\u001f\"];\n\nvar escapeFn = function escapeFn(str) {\n return meta[str.charCodeAt(0)];\n};\n\nvar warned = false; // The assert module provides functions that throw\n// AssertionError's when particular conditions are not met. The\n// assert module must conform to the following interface.\n\nvar assert = module.exports = ok;\nvar NO_EXCEPTION_SENTINEL = {}; // All of the following functions must throw an AssertionError\n// when a corresponding condition is not met, with a message that\n// may be undefined if not provided. All assertion methods provide\n// both the actual and expected values to the assertion error for\n// display purposes.\n\nfunction innerFail(obj) {\n if (obj.message instanceof Error) throw obj.message;\n throw new AssertionError(obj);\n}\n\nfunction fail(actual, expected, message, operator, stackStartFn) {\n var argsLen = arguments.length;\n var internalMessage;\n\n if (argsLen === 0) {\n internalMessage = 'Failed';\n } else if (argsLen === 1) {\n message = actual;\n actual = undefined;\n } else {\n if (warned === false) {\n warned = true;\n var warn = process.emitWarning ? process.emitWarning : console.warn.bind(console);\n warn('assert.fail() with more than one argument is deprecated. ' + 'Please use assert.strictEqual() instead or only pass a message.', 'DeprecationWarning', 'DEP0094');\n }\n\n if (argsLen === 2) operator = '!=';\n }\n\n if (message instanceof Error) throw message;\n var errArgs = {\n actual: actual,\n expected: expected,\n operator: operator === undefined ? 'fail' : operator,\n stackStartFn: stackStartFn || fail\n };\n\n if (message !== undefined) {\n errArgs.message = message;\n }\n\n var err = new AssertionError(errArgs);\n\n if (internalMessage) {\n err.message = internalMessage;\n err.generatedMessage = true;\n }\n\n throw err;\n}\n\nassert.fail = fail; // The AssertionError is defined in internal/error.\n\nassert.AssertionError = AssertionError;\n\nfunction innerOk(fn, argLen, value, message) {\n if (!value) {\n var generatedMessage = false;\n\n if (argLen === 0) {\n generatedMessage = true;\n message = 'No value argument passed to `assert.ok()`';\n } else if (message instanceof Error) {\n throw message;\n }\n\n var err = new AssertionError({\n actual: value,\n expected: true,\n message: message,\n operator: '==',\n stackStartFn: fn\n });\n err.generatedMessage = generatedMessage;\n throw err;\n }\n} // Pure assertion tests whether a value is truthy, as determined\n// by !!value.\n\n\nfunction ok() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n innerOk.apply(void 0, [ok, args.length].concat(args));\n}\n\nassert.ok = ok; // The equality assertion tests shallow, coercive equality with ==.\n\n/* eslint-disable no-restricted-properties */\n\nassert.equal = function equal(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n } // eslint-disable-next-line eqeqeq\n\n\n if (actual != expected) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: '==',\n stackStartFn: equal\n });\n }\n}; // The non-equality assertion tests for whether two objects are not\n// equal with !=.\n\n\nassert.notEqual = function notEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n } // eslint-disable-next-line eqeqeq\n\n\n if (actual == expected) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: '!=',\n stackStartFn: notEqual\n });\n }\n}; // The equivalence assertion tests a deep equality relation.\n\n\nassert.deepEqual = function deepEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n\n if (!isDeepEqual(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'deepEqual',\n stackStartFn: deepEqual\n });\n }\n}; // The non-equivalence assertion tests for any deep inequality.\n\n\nassert.notDeepEqual = function notDeepEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n\n if (isDeepEqual(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'notDeepEqual',\n stackStartFn: notDeepEqual\n });\n }\n};\n/* eslint-enable */\n\n\nassert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n\n if (!isDeepStrictEqual(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'deepStrictEqual',\n stackStartFn: deepStrictEqual\n });\n }\n};\n\nassert.notDeepStrictEqual = notDeepStrictEqual;\n\nfunction notDeepStrictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n\n if (isDeepStrictEqual(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'notDeepStrictEqual',\n stackStartFn: notDeepStrictEqual\n });\n }\n}\n\nassert.strictEqual = function strictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (!objectIs(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'strictEqual',\n stackStartFn: strictEqual\n });\n }\n};\n\nassert.notStrictEqual = function notStrictEqual(actual, expected, message) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('actual', 'expected');\n }\n\n if (objectIs(actual, expected)) {\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: 'notStrictEqual',\n stackStartFn: notStrictEqual\n });\n }\n};\n\nvar Comparison = function Comparison(obj, keys, actual) {\n var _this = this;\n\n _classCallCheck(this, Comparison);\n\n keys.forEach(function (key) {\n if (key in obj) {\n if (actual !== undefined && typeof actual[key] === 'string' && isRegExp(obj[key]) && obj[key].test(actual[key])) {\n _this[key] = actual[key];\n } else {\n _this[key] = obj[key];\n }\n }\n });\n};\n\nfunction compareExceptionKey(actual, expected, key, message, keys, fn) {\n if (!(key in actual) || !isDeepStrictEqual(actual[key], expected[key])) {\n if (!message) {\n // Create placeholder objects to create a nice output.\n var a = new Comparison(actual, keys);\n var b = new Comparison(expected, keys, actual);\n var err = new AssertionError({\n actual: a,\n expected: b,\n operator: 'deepStrictEqual',\n stackStartFn: fn\n });\n err.actual = actual;\n err.expected = expected;\n err.operator = fn.name;\n throw err;\n }\n\n innerFail({\n actual: actual,\n expected: expected,\n message: message,\n operator: fn.name,\n stackStartFn: fn\n });\n }\n}\n\nfunction expectedException(actual, expected, msg, fn) {\n if (typeof expected !== 'function') {\n if (isRegExp(expected)) return expected.test(actual); // assert.doesNotThrow does not accept objects.\n\n if (arguments.length === 2) {\n throw new ERR_INVALID_ARG_TYPE('expected', ['Function', 'RegExp'], expected);\n } // Handle primitives properly.\n\n\n if (_typeof(actual) !== 'object' || actual === null) {\n var err = new AssertionError({\n actual: actual,\n expected: expected,\n message: msg,\n operator: 'deepStrictEqual',\n stackStartFn: fn\n });\n err.operator = fn.name;\n throw err;\n }\n\n var keys = Object.keys(expected); // Special handle errors to make sure the name and the message are compared\n // as well.\n\n if (expected instanceof Error) {\n keys.push('name', 'message');\n } else if (keys.length === 0) {\n throw new ERR_INVALID_ARG_VALUE('error', expected, 'may not be an empty object');\n }\n\n if (isDeepEqual === undefined) lazyLoadComparison();\n keys.forEach(function (key) {\n if (typeof actual[key] === 'string' && isRegExp(expected[key]) && expected[key].test(actual[key])) {\n return;\n }\n\n compareExceptionKey(actual, expected, key, msg, keys, fn);\n });\n return true;\n } // Guard instanceof against arrow functions as they don't have a prototype.\n\n\n if (expected.prototype !== undefined && actual instanceof expected) {\n return true;\n }\n\n if (Error.isPrototypeOf(expected)) {\n return false;\n }\n\n return expected.call({}, actual) === true;\n}\n\nfunction getActual(fn) {\n if (typeof fn !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn);\n }\n\n try {\n fn();\n } catch (e) {\n return e;\n }\n\n return NO_EXCEPTION_SENTINEL;\n}\n\nfunction checkIsPromise(obj) {\n // Accept native ES6 promises and promises that are implemented in a similar\n // way. Do not accept thenables that use a function as `obj` and that have no\n // `catch` handler.\n // TODO: thenables are checked up until they have the correct methods,\n // but according to documentation, the `then` method should receive\n // the `fulfill` and `reject` arguments as well or it may be never resolved.\n return isPromise(obj) || obj !== null && _typeof(obj) === 'object' && typeof obj.then === 'function' && typeof obj.catch === 'function';\n}\n\nfunction waitForActual(promiseFn) {\n return Promise.resolve().then(function () {\n var resultPromise;\n\n if (typeof promiseFn === 'function') {\n // Return a rejected promise if `promiseFn` throws synchronously.\n resultPromise = promiseFn(); // Fail in case no promise is returned.\n\n if (!checkIsPromise(resultPromise)) {\n throw new ERR_INVALID_RETURN_VALUE('instance of Promise', 'promiseFn', resultPromise);\n }\n } else if (checkIsPromise(promiseFn)) {\n resultPromise = promiseFn;\n } else {\n throw new ERR_INVALID_ARG_TYPE('promiseFn', ['Function', 'Promise'], promiseFn);\n }\n\n return Promise.resolve().then(function () {\n return resultPromise;\n }).then(function () {\n return NO_EXCEPTION_SENTINEL;\n }).catch(function (e) {\n return e;\n });\n });\n}\n\nfunction expectsError(stackStartFn, actual, error, message) {\n if (typeof error === 'string') {\n if (arguments.length === 4) {\n throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);\n }\n\n if (_typeof(actual) === 'object' && actual !== null) {\n if (actual.message === error) {\n throw new ERR_AMBIGUOUS_ARGUMENT('error/message', \"The error message \\\"\".concat(actual.message, \"\\\" is identical to the message.\"));\n }\n } else if (actual === error) {\n throw new ERR_AMBIGUOUS_ARGUMENT('error/message', \"The error \\\"\".concat(actual, \"\\\" is identical to the message.\"));\n }\n\n message = error;\n error = undefined;\n } else if (error != null && _typeof(error) !== 'object' && typeof error !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);\n }\n\n if (actual === NO_EXCEPTION_SENTINEL) {\n var details = '';\n\n if (error && error.name) {\n details += \" (\".concat(error.name, \")\");\n }\n\n details += message ? \": \".concat(message) : '.';\n var fnType = stackStartFn.name === 'rejects' ? 'rejection' : 'exception';\n innerFail({\n actual: undefined,\n expected: error,\n operator: stackStartFn.name,\n message: \"Missing expected \".concat(fnType).concat(details),\n stackStartFn: stackStartFn\n });\n }\n\n if (error && !expectedException(actual, error, message, stackStartFn)) {\n throw actual;\n }\n}\n\nfunction expectsNoError(stackStartFn, actual, error, message) {\n if (actual === NO_EXCEPTION_SENTINEL) return;\n\n if (typeof error === 'string') {\n message = error;\n error = undefined;\n }\n\n if (!error || expectedException(actual, error)) {\n var details = message ? \": \".concat(message) : '.';\n var fnType = stackStartFn.name === 'doesNotReject' ? 'rejection' : 'exception';\n innerFail({\n actual: actual,\n expected: error,\n operator: stackStartFn.name,\n message: \"Got unwanted \".concat(fnType).concat(details, \"\\n\") + \"Actual message: \\\"\".concat(actual && actual.message, \"\\\"\"),\n stackStartFn: stackStartFn\n });\n }\n\n throw actual;\n}\n\nassert.throws = function throws(promiseFn) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args));\n};\n\nassert.rejects = function rejects(promiseFn) {\n for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n args[_key3 - 1] = arguments[_key3];\n }\n\n return waitForActual(promiseFn).then(function (result) {\n return expectsError.apply(void 0, [rejects, result].concat(args));\n });\n};\n\nassert.doesNotThrow = function doesNotThrow(fn) {\n for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n args[_key4 - 1] = arguments[_key4];\n }\n\n expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args));\n};\n\nassert.doesNotReject = function doesNotReject(fn) {\n for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {\n args[_key5 - 1] = arguments[_key5];\n }\n\n return waitForActual(fn).then(function (result) {\n return expectsNoError.apply(void 0, [doesNotReject, result].concat(args));\n });\n};\n\nassert.ifError = function ifError(err) {\n if (err !== null && err !== undefined) {\n var message = 'ifError got unwanted exception: ';\n\n if (_typeof(err) === 'object' && typeof err.message === 'string') {\n if (err.message.length === 0 && err.constructor) {\n message += err.constructor.name;\n } else {\n message += err.message;\n }\n } else {\n message += inspect(err);\n }\n\n var newErr = new AssertionError({\n actual: err,\n expected: null,\n operator: 'ifError',\n message: message,\n stackStartFn: ifError\n }); // Make sure we actually have a stack trace!\n\n var origStack = err.stack;\n\n if (typeof origStack === 'string') {\n // This will remove any duplicated frames from the error frames taken\n // from within `ifError` and add the original error frames to the newly\n // created ones.\n var tmp2 = origStack.split('\\n');\n tmp2.shift(); // Filter all frames existing in err.stack.\n\n var tmp1 = newErr.stack.split('\\n');\n\n for (var i = 0; i < tmp2.length; i++) {\n // Find the first occurrence of the frame.\n var pos = tmp1.indexOf(tmp2[i]);\n\n if (pos !== -1) {\n // Only keep new frames.\n tmp1 = tmp1.slice(0, pos);\n break;\n }\n }\n\n newErr.stack = \"\".concat(tmp1.join('\\n'), \"\\n\").concat(tmp2.join('\\n'));\n }\n\n throw newErr;\n }\n}; // Expose a strict only variant of assert\n\n\nfunction strict() {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n\n innerOk.apply(void 0, [strict, args.length].concat(args));\n}\n\nassert.strict = objectAssign(strict, assert, {\n equal: assert.strictEqual,\n deepEqual: assert.deepStrictEqual,\n notEqual: assert.notStrictEqual,\n notDeepEqual: assert.notDeepStrictEqual\n});\nassert.strict.strict = assert.strict;","// Currently in sync with Node.js lib/internal/assert/assertion_error.js\n// https://github.com/nodejs/node/commit/0817840f775032169ddd70c85ac059f18ffcc81c\n'use strict';\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\n\nfunction isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar _require = require('util/'),\n inspect = _require.inspect;\n\nvar _require2 = require('../errors'),\n ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n\n\nfunction endsWith(str, search, this_len) {\n if (this_len === undefined || this_len > str.length) {\n this_len = str.length;\n }\n\n return str.substring(this_len - search.length, this_len) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat\n\n\nfunction repeat(str, count) {\n count = Math.floor(count);\n if (str.length == 0 || count == 0) return '';\n var maxCount = str.length * count;\n count = Math.floor(Math.log(count) / Math.log(2));\n\n while (count) {\n str += str;\n count--;\n }\n\n str += str.substring(0, maxCount - str.length);\n return str;\n}\n\nvar blue = '';\nvar green = '';\nvar red = '';\nvar white = '';\nvar kReadableOperator = {\n deepStrictEqual: 'Expected values to be strictly deep-equal:',\n strictEqual: 'Expected values to be strictly equal:',\n strictEqualObject: 'Expected \"actual\" to be reference-equal to \"expected\":',\n deepEqual: 'Expected values to be loosely deep-equal:',\n equal: 'Expected values to be loosely equal:',\n notDeepStrictEqual: 'Expected \"actual\" not to be strictly deep-equal to:',\n notStrictEqual: 'Expected \"actual\" to be strictly unequal to:',\n notStrictEqualObject: 'Expected \"actual\" not to be reference-equal to \"expected\":',\n notDeepEqual: 'Expected \"actual\" not to be loosely deep-equal to:',\n notEqual: 'Expected \"actual\" to be loosely unequal to:',\n notIdentical: 'Values identical but not reference-equal:'\n}; // Comparing short primitives should just show === / !== instead of using the\n// diff.\n\nvar kMaxShortLength = 10;\n\nfunction copyError(source) {\n var keys = Object.keys(source);\n var target = Object.create(Object.getPrototypeOf(source));\n keys.forEach(function (key) {\n target[key] = source[key];\n });\n Object.defineProperty(target, 'message', {\n value: source.message\n });\n return target;\n}\n\nfunction inspectValue(val) {\n // The util.inspect default values could be changed. This makes sure the\n // error messages contain the necessary information nevertheless.\n return inspect(val, {\n compact: false,\n customInspect: false,\n depth: 1000,\n maxArrayLength: Infinity,\n // Assert compares only enumerable properties (with a few exceptions).\n showHidden: false,\n // Having a long line as error is better than wrapping the line for\n // comparison for now.\n // TODO(BridgeAR): `breakLength` should be limited as soon as soon as we\n // have meta information about the inspected properties (i.e., know where\n // in what line the property starts and ends).\n breakLength: Infinity,\n // Assert does not detect proxies currently.\n showProxy: false,\n sorted: true,\n // Inspect getters as we also check them when comparing entries.\n getters: true\n });\n}\n\nfunction createErrDiff(actual, expected, operator) {\n var other = '';\n var res = '';\n var lastPos = 0;\n var end = '';\n var skipped = false;\n var actualInspected = inspectValue(actual);\n var actualLines = actualInspected.split('\\n');\n var expectedLines = inspectValue(expected).split('\\n');\n var i = 0;\n var indicator = ''; // In case both values are objects explicitly mark them as not reference equal\n // for the `strictEqual` operator.\n\n if (operator === 'strictEqual' && _typeof(actual) === 'object' && _typeof(expected) === 'object' && actual !== null && expected !== null) {\n operator = 'strictEqualObject';\n } // If \"actual\" and \"expected\" fit on a single line and they are not strictly\n // equal, check further special handling.\n\n\n if (actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) {\n var inputLength = actualLines[0].length + expectedLines[0].length; // If the character length of \"actual\" and \"expected\" together is less than\n // kMaxShortLength and if neither is an object and at least one of them is\n // not `zero`, use the strict equal comparison to visualize the output.\n\n if (inputLength <= kMaxShortLength) {\n if ((_typeof(actual) !== 'object' || actual === null) && (_typeof(expected) !== 'object' || expected === null) && (actual !== 0 || expected !== 0)) {\n // -0 === +0\n return \"\".concat(kReadableOperator[operator], \"\\n\\n\") + \"\".concat(actualLines[0], \" !== \").concat(expectedLines[0], \"\\n\");\n }\n } else if (operator !== 'strictEqualObject') {\n // If the stderr is a tty and the input length is lower than the current\n // columns per line, add a mismatch indicator below the output. If it is\n // not a tty, use a default value of 80 characters.\n var maxLength = process.stderr && process.stderr.isTTY ? process.stderr.columns : 80;\n\n if (inputLength < maxLength) {\n while (actualLines[0][i] === expectedLines[0][i]) {\n i++;\n } // Ignore the first characters.\n\n\n if (i > 2) {\n // Add position indicator for the first mismatch in case it is a\n // single line and the input length is less than the column length.\n indicator = \"\\n \".concat(repeat(' ', i), \"^\");\n i = 0;\n }\n }\n }\n } // Remove all ending lines that match (this optimizes the output for\n // readability by reducing the number of total changed lines).\n\n\n var a = actualLines[actualLines.length - 1];\n var b = expectedLines[expectedLines.length - 1];\n\n while (a === b) {\n if (i++ < 2) {\n end = \"\\n \".concat(a).concat(end);\n } else {\n other = a;\n }\n\n actualLines.pop();\n expectedLines.pop();\n if (actualLines.length === 0 || expectedLines.length === 0) break;\n a = actualLines[actualLines.length - 1];\n b = expectedLines[expectedLines.length - 1];\n }\n\n var maxLines = Math.max(actualLines.length, expectedLines.length); // Strict equal with identical objects that are not identical by reference.\n // E.g., assert.deepStrictEqual({ a: Symbol() }, { a: Symbol() })\n\n if (maxLines === 0) {\n // We have to get the result again. The lines were all removed before.\n var _actualLines = actualInspected.split('\\n'); // Only remove lines in case it makes sense to collapse those.\n // TODO: Accept env to always show the full error.\n\n\n if (_actualLines.length > 30) {\n _actualLines[26] = \"\".concat(blue, \"...\").concat(white);\n\n while (_actualLines.length > 27) {\n _actualLines.pop();\n }\n }\n\n return \"\".concat(kReadableOperator.notIdentical, \"\\n\\n\").concat(_actualLines.join('\\n'), \"\\n\");\n }\n\n if (i > 3) {\n end = \"\\n\".concat(blue, \"...\").concat(white).concat(end);\n skipped = true;\n }\n\n if (other !== '') {\n end = \"\\n \".concat(other).concat(end);\n other = '';\n }\n\n var printedLines = 0;\n var msg = kReadableOperator[operator] + \"\\n\".concat(green, \"+ actual\").concat(white, \" \").concat(red, \"- expected\").concat(white);\n var skippedMsg = \" \".concat(blue, \"...\").concat(white, \" Lines skipped\");\n\n for (i = 0; i < maxLines; i++) {\n // Only extra expected lines exist\n var cur = i - lastPos;\n\n if (actualLines.length < i + 1) {\n // If the last diverging line is more than one line above and the\n // current line is at least line three, add some of the former lines and\n // also add dots to indicate skipped entries.\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += \"\\n\".concat(blue, \"...\").concat(white);\n skipped = true;\n } else if (cur > 3) {\n res += \"\\n \".concat(expectedLines[i - 2]);\n printedLines++;\n }\n\n res += \"\\n \".concat(expectedLines[i - 1]);\n printedLines++;\n } // Mark the current line as the last diverging one.\n\n\n lastPos = i; // Add the expected line to the cache.\n\n other += \"\\n\".concat(red, \"-\").concat(white, \" \").concat(expectedLines[i]);\n printedLines++; // Only extra actual lines exist\n } else if (expectedLines.length < i + 1) {\n // If the last diverging line is more than one line above and the\n // current line is at least line three, add some of the former lines and\n // also add dots to indicate skipped entries.\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += \"\\n\".concat(blue, \"...\").concat(white);\n skipped = true;\n } else if (cur > 3) {\n res += \"\\n \".concat(actualLines[i - 2]);\n printedLines++;\n }\n\n res += \"\\n \".concat(actualLines[i - 1]);\n printedLines++;\n } // Mark the current line as the last diverging one.\n\n\n lastPos = i; // Add the actual line to the result.\n\n res += \"\\n\".concat(green, \"+\").concat(white, \" \").concat(actualLines[i]);\n printedLines++; // Lines diverge\n } else {\n var expectedLine = expectedLines[i];\n var actualLine = actualLines[i]; // If the lines diverge, specifically check for lines that only diverge by\n // a trailing comma. In that case it is actually identical and we should\n // mark it as such.\n\n var divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, ',') || actualLine.slice(0, -1) !== expectedLine); // If the expected line has a trailing comma but is otherwise identical,\n // add a comma at the end of the actual line. Otherwise the output could\n // look weird as in:\n //\n // [\n // 1 // No comma at the end!\n // + 2\n // ]\n //\n\n if (divergingLines && endsWith(expectedLine, ',') && expectedLine.slice(0, -1) === actualLine) {\n divergingLines = false;\n actualLine += ',';\n }\n\n if (divergingLines) {\n // If the last diverging line is more than one line above and the\n // current line is at least line three, add some of the former lines and\n // also add dots to indicate skipped entries.\n if (cur > 1 && i > 2) {\n if (cur > 4) {\n res += \"\\n\".concat(blue, \"...\").concat(white);\n skipped = true;\n } else if (cur > 3) {\n res += \"\\n \".concat(actualLines[i - 2]);\n printedLines++;\n }\n\n res += \"\\n \".concat(actualLines[i - 1]);\n printedLines++;\n } // Mark the current line as the last diverging one.\n\n\n lastPos = i; // Add the actual line to the result and cache the expected diverging\n // line so consecutive diverging lines show up as +++--- and not +-+-+-.\n\n res += \"\\n\".concat(green, \"+\").concat(white, \" \").concat(actualLine);\n other += \"\\n\".concat(red, \"-\").concat(white, \" \").concat(expectedLine);\n printedLines += 2; // Lines are identical\n } else {\n // Add all cached information to the result before adding other things\n // and reset the cache.\n res += other;\n other = ''; // If the last diverging line is exactly one line above or if it is the\n // very first line, add the line to the result.\n\n if (cur === 1 || i === 0) {\n res += \"\\n \".concat(actualLine);\n printedLines++;\n }\n }\n } // Inspected object to big (Show ~20 rows max)\n\n\n if (printedLines > 20 && i < maxLines - 2) {\n return \"\".concat(msg).concat(skippedMsg, \"\\n\").concat(res, \"\\n\").concat(blue, \"...\").concat(white).concat(other, \"\\n\") + \"\".concat(blue, \"...\").concat(white);\n }\n }\n\n return \"\".concat(msg).concat(skipped ? skippedMsg : '', \"\\n\").concat(res).concat(other).concat(end).concat(indicator);\n}\n\nvar AssertionError =\n/*#__PURE__*/\nfunction (_Error) {\n _inherits(AssertionError, _Error);\n\n function AssertionError(options) {\n var _this;\n\n _classCallCheck(this, AssertionError);\n\n if (_typeof(options) !== 'object' || options === null) {\n throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);\n }\n\n var message = options.message,\n operator = options.operator,\n stackStartFn = options.stackStartFn;\n var actual = options.actual,\n expected = options.expected;\n var limit = Error.stackTraceLimit;\n Error.stackTraceLimit = 0;\n\n if (message != null) {\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, String(message)));\n } else {\n if (process.stderr && process.stderr.isTTY) {\n // Reset on each call to make sure we handle dynamically set environment\n // variables correct.\n if (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1) {\n blue = \"\\x1B[34m\";\n green = \"\\x1B[32m\";\n white = \"\\x1B[39m\";\n red = \"\\x1B[31m\";\n } else {\n blue = '';\n green = '';\n white = '';\n red = '';\n }\n } // Prevent the error stack from being visible by duplicating the error\n // in a very close way to the original in case both sides are actually\n // instances of Error.\n\n\n if (_typeof(actual) === 'object' && actual !== null && _typeof(expected) === 'object' && expected !== null && 'stack' in actual && actual instanceof Error && 'stack' in expected && expected instanceof Error) {\n actual = copyError(actual);\n expected = copyError(expected);\n }\n\n if (operator === 'deepStrictEqual' || operator === 'strictEqual') {\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, createErrDiff(actual, expected, operator)));\n } else if (operator === 'notDeepStrictEqual' || operator === 'notStrictEqual') {\n // In case the objects are equal but the operator requires unequal, show\n // the first object and say A equals B\n var base = kReadableOperator[operator];\n var res = inspectValue(actual).split('\\n'); // In case \"actual\" is an object, it should not be reference equal.\n\n if (operator === 'notStrictEqual' && _typeof(actual) === 'object' && actual !== null) {\n base = kReadableOperator.notStrictEqualObject;\n } // Only remove lines in case it makes sense to collapse those.\n // TODO: Accept env to always show the full error.\n\n\n if (res.length > 30) {\n res[26] = \"\".concat(blue, \"...\").concat(white);\n\n while (res.length > 27) {\n res.pop();\n }\n } // Only print a single input.\n\n\n if (res.length === 1) {\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, \"\".concat(base, \" \").concat(res[0])));\n } else {\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, \"\".concat(base, \"\\n\\n\").concat(res.join('\\n'), \"\\n\")));\n }\n } else {\n var _res = inspectValue(actual);\n\n var other = '';\n var knownOperators = kReadableOperator[operator];\n\n if (operator === 'notDeepEqual' || operator === 'notEqual') {\n _res = \"\".concat(kReadableOperator[operator], \"\\n\\n\").concat(_res);\n\n if (_res.length > 1024) {\n _res = \"\".concat(_res.slice(0, 1021), \"...\");\n }\n } else {\n other = \"\".concat(inspectValue(expected));\n\n if (_res.length > 512) {\n _res = \"\".concat(_res.slice(0, 509), \"...\");\n }\n\n if (other.length > 512) {\n other = \"\".concat(other.slice(0, 509), \"...\");\n }\n\n if (operator === 'deepEqual' || operator === 'equal') {\n _res = \"\".concat(knownOperators, \"\\n\\n\").concat(_res, \"\\n\\nshould equal\\n\\n\");\n } else {\n other = \" \".concat(operator, \" \").concat(other);\n }\n }\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, \"\".concat(_res).concat(other)));\n }\n }\n\n Error.stackTraceLimit = limit;\n _this.generatedMessage = !message;\n Object.defineProperty(_assertThisInitialized(_this), 'name', {\n value: 'AssertionError [ERR_ASSERTION]',\n enumerable: false,\n writable: true,\n configurable: true\n });\n _this.code = 'ERR_ASSERTION';\n _this.actual = actual;\n _this.expected = expected;\n _this.operator = operator;\n\n if (Error.captureStackTrace) {\n // eslint-disable-next-line no-restricted-syntax\n Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn);\n } // Create error message including the error code in the name.\n\n\n _this.stack; // Reset the name.\n\n _this.name = 'AssertionError';\n return _possibleConstructorReturn(_this);\n }\n\n _createClass(AssertionError, [{\n key: \"toString\",\n value: function toString() {\n return \"\".concat(this.name, \" [\").concat(this.code, \"]: \").concat(this.message);\n }\n }, {\n key: inspect.custom,\n value: function value(recurseTimes, ctx) {\n // This limits the `actual` and `expected` property default inspection to\n // the minimum depth. Otherwise those values would be too verbose compared\n // to the actual error message which contains a combined view of these two\n // input values.\n return inspect(this, _objectSpread({}, ctx, {\n customInspect: false,\n depth: 0\n }));\n }\n }]);\n\n return AssertionError;\n}(_wrapNativeSuper(Error));\n\nmodule.exports = AssertionError;","// Currently in sync with Node.js lib/internal/errors.js\n// https://github.com/nodejs/node/commit/3b044962c48fe313905877a96b5d0894a5404f6f\n\n/* eslint node-core/documented-errors: \"error\" */\n\n/* eslint node-core/alphabetize-errors: \"error\" */\n\n/* eslint node-core/prefer-util-format-errors: \"error\" */\n'use strict'; // The whole point behind this internal module is to allow Node.js to no\n// longer be forced to treat every error message change as a semver-major\n// change. The NodeError classes here all expose a `code` property whose\n// value statically and permanently identifies the error. While the error\n// message may change, the code should not.\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nvar codes = {}; // Lazy loaded\n\nvar assert;\nvar util;\n\nfunction createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === 'string') {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n\n var NodeError =\n /*#__PURE__*/\n function (_Base) {\n _inherits(NodeError, _Base);\n\n function NodeError(arg1, arg2, arg3) {\n var _this;\n\n _classCallCheck(this, NodeError);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError).call(this, getMessage(arg1, arg2, arg3)));\n _this.code = code;\n return _this;\n }\n\n return NodeError;\n }(Base);\n\n codes[code] = NodeError;\n} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js\n\n\nfunction oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function (i) {\n return String(i);\n });\n\n if (len > 2) {\n return \"one of \".concat(thing, \" \").concat(expected.slice(0, len - 1).join(', '), \", or \") + expected[len - 1];\n } else if (len === 2) {\n return \"one of \".concat(thing, \" \").concat(expected[0], \" or \").concat(expected[1]);\n } else {\n return \"of \".concat(thing, \" \").concat(expected[0]);\n }\n } else {\n return \"of \".concat(thing, \" \").concat(String(expected));\n }\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith\n\n\nfunction startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n\n\nfunction endsWith(str, search, this_len) {\n if (this_len === undefined || this_len > str.length) {\n this_len = str.length;\n }\n\n return str.substring(this_len - search.length, this_len) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes\n\n\nfunction includes(str, search, start) {\n if (typeof start !== 'number') {\n start = 0;\n }\n\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n}\n\ncreateErrorType('ERR_AMBIGUOUS_ARGUMENT', 'The \"%s\" argument is ambiguous. %s', TypeError);\ncreateErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {\n if (assert === undefined) assert = require('../assert');\n assert(typeof name === 'string', \"'name' must be a string\"); // determiner: 'must be' or 'must not be'\n\n var determiner;\n\n if (typeof expected === 'string' && startsWith(expected, 'not ')) {\n determiner = 'must not be';\n expected = expected.replace(/^not /, '');\n } else {\n determiner = 'must be';\n }\n\n var msg;\n\n if (endsWith(name, ' argument')) {\n // For cases like 'first argument'\n msg = \"The \".concat(name, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n } else {\n var type = includes(name, '.') ? 'property' : 'argument';\n msg = \"The \\\"\".concat(name, \"\\\" \").concat(type, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n } // TODO(BridgeAR): Improve the output by showing `null` and similar.\n\n\n msg += \". Received type \".concat(_typeof(actual));\n return msg;\n}, TypeError);\ncreateErrorType('ERR_INVALID_ARG_VALUE', function (name, value) {\n var reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'is invalid';\n if (util === undefined) util = require('util/');\n var inspected = util.inspect(value);\n\n if (inspected.length > 128) {\n inspected = \"\".concat(inspected.slice(0, 128), \"...\");\n }\n\n return \"The argument '\".concat(name, \"' \").concat(reason, \". Received \").concat(inspected);\n}, TypeError, RangeError);\ncreateErrorType('ERR_INVALID_RETURN_VALUE', function (input, name, value) {\n var type;\n\n if (value && value.constructor && value.constructor.name) {\n type = \"instance of \".concat(value.constructor.name);\n } else {\n type = \"type \".concat(_typeof(value));\n }\n\n return \"Expected \".concat(input, \" to be returned from the \\\"\").concat(name, \"\\\"\") + \" function but got \".concat(type, \".\");\n}, TypeError);\ncreateErrorType('ERR_MISSING_ARGS', function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (assert === undefined) assert = require('../assert');\n assert(args.length > 0, 'At least one arg needs to be specified');\n var msg = 'The ';\n var len = args.length;\n args = args.map(function (a) {\n return \"\\\"\".concat(a, \"\\\"\");\n });\n\n switch (len) {\n case 1:\n msg += \"\".concat(args[0], \" argument\");\n break;\n\n case 2:\n msg += \"\".concat(args[0], \" and \").concat(args[1], \" arguments\");\n break;\n\n default:\n msg += args.slice(0, len - 1).join(', ');\n msg += \", and \".concat(args[len - 1], \" arguments\");\n break;\n }\n\n return \"\".concat(msg, \" must be specified\");\n}, TypeError);\nmodule.exports.codes = codes;","// Currently in sync with Node.js lib/internal/util/comparisons.js\n// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9\n'use strict';\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar regexFlagsSupported = /a/g.flags !== undefined;\n\nvar arrayFromSet = function arrayFromSet(set) {\n var array = [];\n set.forEach(function (value) {\n return array.push(value);\n });\n return array;\n};\n\nvar arrayFromMap = function arrayFromMap(map) {\n var array = [];\n map.forEach(function (value, key) {\n return array.push([key, value]);\n });\n return array;\n};\n\nvar objectIs = Object.is ? Object.is : require('object-is');\nvar objectGetOwnPropertySymbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols : function () {\n return [];\n};\nvar numberIsNaN = Number.isNaN ? Number.isNaN : require('is-nan');\n\nfunction uncurryThis(f) {\n return f.call.bind(f);\n}\n\nvar hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);\nvar propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable);\nvar objectToString = uncurryThis(Object.prototype.toString);\n\nvar _require$types = require('util/').types,\n isAnyArrayBuffer = _require$types.isAnyArrayBuffer,\n isArrayBufferView = _require$types.isArrayBufferView,\n isDate = _require$types.isDate,\n isMap = _require$types.isMap,\n isRegExp = _require$types.isRegExp,\n isSet = _require$types.isSet,\n isNativeError = _require$types.isNativeError,\n isBoxedPrimitive = _require$types.isBoxedPrimitive,\n isNumberObject = _require$types.isNumberObject,\n isStringObject = _require$types.isStringObject,\n isBooleanObject = _require$types.isBooleanObject,\n isBigIntObject = _require$types.isBigIntObject,\n isSymbolObject = _require$types.isSymbolObject,\n isFloat32Array = _require$types.isFloat32Array,\n isFloat64Array = _require$types.isFloat64Array;\n\nfunction isNonIndex(key) {\n if (key.length === 0 || key.length > 10) return true;\n\n for (var i = 0; i < key.length; i++) {\n var code = key.charCodeAt(i);\n if (code < 48 || code > 57) return true;\n } // The maximum size for an array is 2 ** 32 -1.\n\n\n return key.length === 10 && key >= Math.pow(2, 32);\n}\n\nfunction getOwnNonIndexProperties(value) {\n return Object.keys(value).filter(isNonIndex).concat(objectGetOwnPropertySymbols(value).filter(Object.prototype.propertyIsEnumerable.bind(value)));\n} // Taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js\n// original notice:\n\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\n\nfunction compare(a, b) {\n if (a === b) {\n return 0;\n }\n\n var x = a.length;\n var y = b.length;\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break;\n }\n }\n\n if (x < y) {\n return -1;\n }\n\n if (y < x) {\n return 1;\n }\n\n return 0;\n}\n\nvar ONLY_ENUMERABLE = undefined;\nvar kStrict = true;\nvar kLoose = false;\nvar kNoIterator = 0;\nvar kIsArray = 1;\nvar kIsSet = 2;\nvar kIsMap = 3; // Check if they have the same source and flags\n\nfunction areSimilarRegExps(a, b) {\n return regexFlagsSupported ? a.source === b.source && a.flags === b.flags : RegExp.prototype.toString.call(a) === RegExp.prototype.toString.call(b);\n}\n\nfunction areSimilarFloatArrays(a, b) {\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n\n for (var offset = 0; offset < a.byteLength; offset++) {\n if (a[offset] !== b[offset]) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction areSimilarTypedArrays(a, b) {\n if (a.byteLength !== b.byteLength) {\n return false;\n }\n\n return compare(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)) === 0;\n}\n\nfunction areEqualArrayBuffers(buf1, buf2) {\n return buf1.byteLength === buf2.byteLength && compare(new Uint8Array(buf1), new Uint8Array(buf2)) === 0;\n}\n\nfunction isEqualBoxedPrimitive(val1, val2) {\n if (isNumberObject(val1)) {\n return isNumberObject(val2) && objectIs(Number.prototype.valueOf.call(val1), Number.prototype.valueOf.call(val2));\n }\n\n if (isStringObject(val1)) {\n return isStringObject(val2) && String.prototype.valueOf.call(val1) === String.prototype.valueOf.call(val2);\n }\n\n if (isBooleanObject(val1)) {\n return isBooleanObject(val2) && Boolean.prototype.valueOf.call(val1) === Boolean.prototype.valueOf.call(val2);\n }\n\n if (isBigIntObject(val1)) {\n return isBigIntObject(val2) && BigInt.prototype.valueOf.call(val1) === BigInt.prototype.valueOf.call(val2);\n }\n\n return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2);\n} // Notes: Type tags are historical [[Class]] properties that can be set by\n// FunctionTemplate::SetClassName() in C++ or Symbol.toStringTag in JS\n// and retrieved using Object.prototype.toString.call(obj) in JS\n// See https://tc39.github.io/ecma262/#sec-object.prototype.tostring\n// for a list of tags pre-defined in the spec.\n// There are some unspecified tags in the wild too (e.g. typed array tags).\n// Since tags can be altered, they only serve fast failures\n//\n// Typed arrays and buffers are checked by comparing the content in their\n// underlying ArrayBuffer. This optimization requires that it's\n// reasonable to interpret their underlying memory in the same way,\n// which is checked by comparing their type tags.\n// (e.g. a Uint8Array and a Uint16Array with the same memory content\n// could still be different because they will be interpreted differently).\n//\n// For strict comparison, objects should have\n// a) The same built-in type tags\n// b) The same prototypes.\n\n\nfunction innerDeepEqual(val1, val2, strict, memos) {\n // All identical values are equivalent, as determined by ===.\n if (val1 === val2) {\n if (val1 !== 0) return true;\n return strict ? objectIs(val1, val2) : true;\n } // Check more closely if val1 and val2 are equal.\n\n\n if (strict) {\n if (_typeof(val1) !== 'object') {\n return typeof val1 === 'number' && numberIsNaN(val1) && numberIsNaN(val2);\n }\n\n if (_typeof(val2) !== 'object' || val1 === null || val2 === null) {\n return false;\n }\n\n if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) {\n return false;\n }\n } else {\n if (val1 === null || _typeof(val1) !== 'object') {\n if (val2 === null || _typeof(val2) !== 'object') {\n // eslint-disable-next-line eqeqeq\n return val1 == val2;\n }\n\n return false;\n }\n\n if (val2 === null || _typeof(val2) !== 'object') {\n return false;\n }\n }\n\n var val1Tag = objectToString(val1);\n var val2Tag = objectToString(val2);\n\n if (val1Tag !== val2Tag) {\n return false;\n }\n\n if (Array.isArray(val1)) {\n // Check for sparse arrays and general fast path\n if (val1.length !== val2.length) {\n return false;\n }\n\n var keys1 = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);\n var keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);\n\n if (keys1.length !== keys2.length) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kIsArray, keys1);\n } // [browserify] This triggers on certain types in IE (Map/Set) so we don't\n // wan't to early return out of the rest of the checks. However we can check\n // if the second value is one of these values and the first isn't.\n\n\n if (val1Tag === '[object Object]') {\n // return keyCheck(val1, val2, strict, memos, kNoIterator);\n if (!isMap(val1) && isMap(val2) || !isSet(val1) && isSet(val2)) {\n return false;\n }\n }\n\n if (isDate(val1)) {\n if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) {\n return false;\n }\n } else if (isRegExp(val1)) {\n if (!isRegExp(val2) || !areSimilarRegExps(val1, val2)) {\n return false;\n }\n } else if (isNativeError(val1) || val1 instanceof Error) {\n // Do not compare the stack as it might differ even though the error itself\n // is otherwise identical.\n if (val1.message !== val2.message || val1.name !== val2.name) {\n return false;\n }\n } else if (isArrayBufferView(val1)) {\n if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) {\n if (!areSimilarFloatArrays(val1, val2)) {\n return false;\n }\n } else if (!areSimilarTypedArrays(val1, val2)) {\n return false;\n } // Buffer.compare returns true, so val1.length === val2.length. If they both\n // only contain numeric keys, we don't need to exam further than checking\n // the symbols.\n\n\n var _keys = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);\n\n var _keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);\n\n if (_keys.length !== _keys2.length) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kNoIterator, _keys);\n } else if (isSet(val1)) {\n if (!isSet(val2) || val1.size !== val2.size) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kIsSet);\n } else if (isMap(val1)) {\n if (!isMap(val2) || val1.size !== val2.size) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kIsMap);\n } else if (isAnyArrayBuffer(val1)) {\n if (!areEqualArrayBuffers(val1, val2)) {\n return false;\n }\n } else if (isBoxedPrimitive(val1) && !isEqualBoxedPrimitive(val1, val2)) {\n return false;\n }\n\n return keyCheck(val1, val2, strict, memos, kNoIterator);\n}\n\nfunction getEnumerables(val, keys) {\n return keys.filter(function (k) {\n return propertyIsEnumerable(val, k);\n });\n}\n\nfunction keyCheck(val1, val2, strict, memos, iterationType, aKeys) {\n // For all remaining Object pairs, including Array, objects and Maps,\n // equivalence is determined by having:\n // a) The same number of owned enumerable properties\n // b) The same set of keys/indexes (although not necessarily the same order)\n // c) Equivalent values for every corresponding key/index\n // d) For Sets and Maps, equal contents\n // Note: this accounts for both named and indexed properties on Arrays.\n if (arguments.length === 5) {\n aKeys = Object.keys(val1);\n var bKeys = Object.keys(val2); // The pair must have the same number of owned properties.\n\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n } // Cheap key test\n\n\n var i = 0;\n\n for (; i < aKeys.length; i++) {\n if (!hasOwnProperty(val2, aKeys[i])) {\n return false;\n }\n }\n\n if (strict && arguments.length === 5) {\n var symbolKeysA = objectGetOwnPropertySymbols(val1);\n\n if (symbolKeysA.length !== 0) {\n var count = 0;\n\n for (i = 0; i < symbolKeysA.length; i++) {\n var key = symbolKeysA[i];\n\n if (propertyIsEnumerable(val1, key)) {\n if (!propertyIsEnumerable(val2, key)) {\n return false;\n }\n\n aKeys.push(key);\n count++;\n } else if (propertyIsEnumerable(val2, key)) {\n return false;\n }\n }\n\n var symbolKeysB = objectGetOwnPropertySymbols(val2);\n\n if (symbolKeysA.length !== symbolKeysB.length && getEnumerables(val2, symbolKeysB).length !== count) {\n return false;\n }\n } else {\n var _symbolKeysB = objectGetOwnPropertySymbols(val2);\n\n if (_symbolKeysB.length !== 0 && getEnumerables(val2, _symbolKeysB).length !== 0) {\n return false;\n }\n }\n }\n\n if (aKeys.length === 0 && (iterationType === kNoIterator || iterationType === kIsArray && val1.length === 0 || val1.size === 0)) {\n return true;\n } // Use memos to handle cycles.\n\n\n if (memos === undefined) {\n memos = {\n val1: new Map(),\n val2: new Map(),\n position: 0\n };\n } else {\n // We prevent up to two map.has(x) calls by directly retrieving the value\n // and checking for undefined. The map can only contain numbers, so it is\n // safe to check for undefined only.\n var val2MemoA = memos.val1.get(val1);\n\n if (val2MemoA !== undefined) {\n var val2MemoB = memos.val2.get(val2);\n\n if (val2MemoB !== undefined) {\n return val2MemoA === val2MemoB;\n }\n }\n\n memos.position++;\n }\n\n memos.val1.set(val1, memos.position);\n memos.val2.set(val2, memos.position);\n var areEq = objEquiv(val1, val2, strict, aKeys, memos, iterationType);\n memos.val1.delete(val1);\n memos.val2.delete(val2);\n return areEq;\n}\n\nfunction setHasEqualElement(set, val1, strict, memo) {\n // Go looking.\n var setValues = arrayFromSet(set);\n\n for (var i = 0; i < setValues.length; i++) {\n var val2 = setValues[i];\n\n if (innerDeepEqual(val1, val2, strict, memo)) {\n // Remove the matching element to make sure we do not check that again.\n set.delete(val2);\n return true;\n }\n }\n\n return false;\n} // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Loose_equality_using\n// Sadly it is not possible to detect corresponding values properly in case the\n// type is a string, number, bigint or boolean. The reason is that those values\n// can match lots of different string values (e.g., 1n == '+00001').\n\n\nfunction findLooseMatchingPrimitives(prim) {\n switch (_typeof(prim)) {\n case 'undefined':\n return null;\n\n case 'object':\n // Only pass in null as object!\n return undefined;\n\n case 'symbol':\n return false;\n\n case 'string':\n prim = +prim;\n // Loose equal entries exist only if the string is possible to convert to\n // a regular number and not NaN.\n // Fall through\n\n case 'number':\n if (numberIsNaN(prim)) {\n return false;\n }\n\n }\n\n return true;\n}\n\nfunction setMightHaveLoosePrim(a, b, prim) {\n var altValue = findLooseMatchingPrimitives(prim);\n if (altValue != null) return altValue;\n return b.has(altValue) && !a.has(altValue);\n}\n\nfunction mapMightHaveLoosePrim(a, b, prim, item, memo) {\n var altValue = findLooseMatchingPrimitives(prim);\n\n if (altValue != null) {\n return altValue;\n }\n\n var curB = b.get(altValue);\n\n if (curB === undefined && !b.has(altValue) || !innerDeepEqual(item, curB, false, memo)) {\n return false;\n }\n\n return !a.has(altValue) && innerDeepEqual(item, curB, false, memo);\n}\n\nfunction setEquiv(a, b, strict, memo) {\n // This is a lazily initiated Set of entries which have to be compared\n // pairwise.\n var set = null;\n var aValues = arrayFromSet(a);\n\n for (var i = 0; i < aValues.length; i++) {\n var val = aValues[i]; // Note: Checking for the objects first improves the performance for object\n // heavy sets but it is a minor slow down for primitives. As they are fast\n // to check this improves the worst case scenario instead.\n\n if (_typeof(val) === 'object' && val !== null) {\n if (set === null) {\n set = new Set();\n } // If the specified value doesn't exist in the second set its an not null\n // object (or non strict only: a not matching primitive) we'll need to go\n // hunting for something thats deep-(strict-)equal to it. To make this\n // O(n log n) complexity we have to copy these values in a new set first.\n\n\n set.add(val);\n } else if (!b.has(val)) {\n if (strict) return false; // Fast path to detect missing string, symbol, undefined and null values.\n\n if (!setMightHaveLoosePrim(a, b, val)) {\n return false;\n }\n\n if (set === null) {\n set = new Set();\n }\n\n set.add(val);\n }\n }\n\n if (set !== null) {\n var bValues = arrayFromSet(b);\n\n for (var _i = 0; _i < bValues.length; _i++) {\n var _val = bValues[_i]; // We have to check if a primitive value is already\n // matching and only if it's not, go hunting for it.\n\n if (_typeof(_val) === 'object' && _val !== null) {\n if (!setHasEqualElement(set, _val, strict, memo)) return false;\n } else if (!strict && !a.has(_val) && !setHasEqualElement(set, _val, strict, memo)) {\n return false;\n }\n }\n\n return set.size === 0;\n }\n\n return true;\n}\n\nfunction mapHasEqualEntry(set, map, key1, item1, strict, memo) {\n // To be able to handle cases like:\n // Map([[{}, 'a'], [{}, 'b']]) vs Map([[{}, 'b'], [{}, 'a']])\n // ... we need to consider *all* matching keys, not just the first we find.\n var setValues = arrayFromSet(set);\n\n for (var i = 0; i < setValues.length; i++) {\n var key2 = setValues[i];\n\n if (innerDeepEqual(key1, key2, strict, memo) && innerDeepEqual(item1, map.get(key2), strict, memo)) {\n set.delete(key2);\n return true;\n }\n }\n\n return false;\n}\n\nfunction mapEquiv(a, b, strict, memo) {\n var set = null;\n var aEntries = arrayFromMap(a);\n\n for (var i = 0; i < aEntries.length; i++) {\n var _aEntries$i = _slicedToArray(aEntries[i], 2),\n key = _aEntries$i[0],\n item1 = _aEntries$i[1];\n\n if (_typeof(key) === 'object' && key !== null) {\n if (set === null) {\n set = new Set();\n }\n\n set.add(key);\n } else {\n // By directly retrieving the value we prevent another b.has(key) check in\n // almost all possible cases.\n var item2 = b.get(key);\n\n if (item2 === undefined && !b.has(key) || !innerDeepEqual(item1, item2, strict, memo)) {\n if (strict) return false; // Fast path to detect missing string, symbol, undefined and null\n // keys.\n\n if (!mapMightHaveLoosePrim(a, b, key, item1, memo)) return false;\n\n if (set === null) {\n set = new Set();\n }\n\n set.add(key);\n }\n }\n }\n\n if (set !== null) {\n var bEntries = arrayFromMap(b);\n\n for (var _i2 = 0; _i2 < bEntries.length; _i2++) {\n var _bEntries$_i = _slicedToArray(bEntries[_i2], 2),\n key = _bEntries$_i[0],\n item = _bEntries$_i[1];\n\n if (_typeof(key) === 'object' && key !== null) {\n if (!mapHasEqualEntry(set, a, key, item, strict, memo)) return false;\n } else if (!strict && (!a.has(key) || !innerDeepEqual(a.get(key), item, false, memo)) && !mapHasEqualEntry(set, a, key, item, false, memo)) {\n return false;\n }\n }\n\n return set.size === 0;\n }\n\n return true;\n}\n\nfunction objEquiv(a, b, strict, keys, memos, iterationType) {\n // Sets and maps don't have their entries accessible via normal object\n // properties.\n var i = 0;\n\n if (iterationType === kIsSet) {\n if (!setEquiv(a, b, strict, memos)) {\n return false;\n }\n } else if (iterationType === kIsMap) {\n if (!mapEquiv(a, b, strict, memos)) {\n return false;\n }\n } else if (iterationType === kIsArray) {\n for (; i < a.length; i++) {\n if (hasOwnProperty(a, i)) {\n if (!hasOwnProperty(b, i) || !innerDeepEqual(a[i], b[i], strict, memos)) {\n return false;\n }\n } else if (hasOwnProperty(b, i)) {\n return false;\n } else {\n // Array is sparse.\n var keysA = Object.keys(a);\n\n for (; i < keysA.length; i++) {\n var key = keysA[i];\n\n if (!hasOwnProperty(b, key) || !innerDeepEqual(a[key], b[key], strict, memos)) {\n return false;\n }\n }\n\n if (keysA.length !== Object.keys(b).length) {\n return false;\n }\n\n return true;\n }\n }\n } // The pair must have equivalent values for every corresponding key.\n // Possibly expensive deep test:\n\n\n for (i = 0; i < keys.length; i++) {\n var _key = keys[i];\n\n if (!innerDeepEqual(a[_key], b[_key], strict, memos)) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction isDeepEqual(val1, val2) {\n return innerDeepEqual(val1, val2, kLoose);\n}\n\nfunction isDeepStrictEqual(val1, val2) {\n return innerDeepEqual(val1, val2, kStrict);\n}\n\nmodule.exports = {\n isDeepEqual: isDeepEqual,\n isDeepStrictEqual: isDeepStrictEqual\n};","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar callBind = require('./');\n\nvar $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));\n\nmodule.exports = function callBoundIntrinsic(name, allowMissing) {\n\tvar intrinsic = GetIntrinsic(name, !!allowMissing);\n\tif (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {\n\t\treturn callBind(intrinsic);\n\t}\n\treturn intrinsic;\n};\n","'use strict';\n\nvar bind = require('function-bind');\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $apply = GetIntrinsic('%Function.prototype.apply%');\nvar $call = GetIntrinsic('%Function.prototype.call%');\nvar $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\nvar $defineProperty = GetIntrinsic('%Object.defineProperty%', true);\nvar $max = GetIntrinsic('%Math.max%');\n\nif ($defineProperty) {\n\ttry {\n\t\t$defineProperty({}, 'a', { value: 1 });\n\t} catch (e) {\n\t\t// IE 8 has a broken defineProperty\n\t\t$defineProperty = null;\n\t}\n}\n\nmodule.exports = function callBind(originalFunction) {\n\tvar func = $reflectApply(bind, $call, arguments);\n\tif ($gOPD && $defineProperty) {\n\t\tvar desc = $gOPD(func, 'length');\n\t\tif (desc.configurable) {\n\t\t\t// original length, plus the receiver, minus any additional arguments (after the receiver)\n\t\t\t$defineProperty(\n\t\t\t\tfunc,\n\t\t\t\t'length',\n\t\t\t\t{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }\n\t\t\t);\n\t\t}\n\t}\n\treturn func;\n};\n\nvar applyBind = function applyBind() {\n\treturn $reflectApply(bind, $apply, arguments);\n};\n\nif ($defineProperty) {\n\t$defineProperty(module.exports, 'apply', { value: applyBind });\n} else {\n\tmodule.exports.apply = applyBind;\n}\n","/*global window, global*/\nvar util = require(\"util\")\nvar assert = require(\"assert\")\nfunction now() { return new Date().getTime() }\n\nvar slice = Array.prototype.slice\nvar console\nvar times = {}\n\nif (typeof global !== \"undefined\" && global.console) {\n console = global.console\n} else if (typeof window !== \"undefined\" && window.console) {\n console = window.console\n} else {\n console = {}\n}\n\nvar functions = [\n [log, \"log\"],\n [info, \"info\"],\n [warn, \"warn\"],\n [error, \"error\"],\n [time, \"time\"],\n [timeEnd, \"timeEnd\"],\n [trace, \"trace\"],\n [dir, \"dir\"],\n [consoleAssert, \"assert\"]\n]\n\nfor (var i = 0; i < functions.length; i++) {\n var tuple = functions[i]\n var f = tuple[0]\n var name = tuple[1]\n\n if (!console[name]) {\n console[name] = f\n }\n}\n\nmodule.exports = console\n\nfunction log() {}\n\nfunction info() {\n console.log.apply(console, arguments)\n}\n\nfunction warn() {\n console.log.apply(console, arguments)\n}\n\nfunction error() {\n console.warn.apply(console, arguments)\n}\n\nfunction time(label) {\n times[label] = now()\n}\n\nfunction timeEnd(label) {\n var time = times[label]\n if (!time) {\n throw new Error(\"No such label: \" + label)\n }\n\n delete times[label]\n var duration = now() - time\n console.log(label + \": \" + duration + \"ms\")\n}\n\nfunction trace() {\n var err = new Error()\n err.name = \"Trace\"\n err.message = util.format.apply(null, arguments)\n console.error(err.stack)\n}\n\nfunction dir(object) {\n console.log(util.inspect(object) + \"\\n\")\n}\n\nfunction consoleAssert(expression) {\n if (!expression) {\n var arr = slice.call(arguments, 1)\n assert.ok(false, util.format.apply(null, arr))\n }\n}\n","var global = typeof self !== 'undefined' ? self : this;\nvar __self__ = (function () {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = global.DOMException\n}\nF.prototype = global;\nreturn new F();\n})();\n(function(self) {\n\nvar irrelevant = (function (exports) {\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob:\n 'FileReader' in self &&\n 'Blob' in self &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n };\n\n function isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue + ', ' + value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push(name);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) {\n items.push(value);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push([name, value]);\n });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsText(blob);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n this._bodyInit = body;\n if (!body) {\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n this._bodyText = body = Object.prototype.toString.call(body);\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n };\n }\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return methods.indexOf(upcased) > -1 ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n this.signal = input.signal;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.signal = options.signal || this.signal;\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n }\n\n Request.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n };\n\n function decode(body) {\n var form = new FormData();\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n headers.append(key, value);\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = 'statusText' in options ? options.statusText : 'OK';\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''});\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n exports.DOMException = self.DOMException;\n try {\n new exports.DOMException();\n } catch (err) {\n exports.DOMException = function(message, name) {\n this.message = message;\n this.name = name;\n var error = Error(message);\n this.stack = error.stack;\n };\n exports.DOMException.prototype = Object.create(Error.prototype);\n exports.DOMException.prototype.constructor = exports.DOMException;\n }\n\n function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n\n if (request.signal && request.signal.aborted) {\n return reject(new exports.DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest();\n\n function abortXhr() {\n xhr.abort();\n }\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n resolve(new Response(body, options));\n };\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.onabort = function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n };\n\n xhr.open(request.method, request.url, true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob';\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr);\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr);\n }\n };\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n }\n\n fetch.polyfill = true;\n\n if (!self.fetch) {\n self.fetch = fetch;\n self.Headers = Headers;\n self.Request = Request;\n self.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n return exports;\n\n})({});\n})(__self__);\n__self__.fetch.ponyfill = true;\n// Remove \"polyfill\" property added by whatwg-fetch\ndelete __self__.fetch.polyfill;\n// Choose between native implementation (global) or custom implementation (__self__)\n// var ctx = global.fetch ? global : __self__;\nvar ctx = __self__; // this line disable service worker support temporarily\nexports = ctx.fetch // To enable: import fetch from 'cross-fetch'\nexports.default = ctx.fetch // For TypeScript consumers without esModuleInterop.\nexports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'\nexports.Headers = ctx.Headers\nexports.Request = ctx.Request\nexports.Response = ctx.Response\nmodule.exports = exports\n","'use strict';\n\nvar keys = require('object-keys');\nvar hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';\n\nvar toStr = Object.prototype.toString;\nvar concat = Array.prototype.concat;\nvar origDefineProperty = Object.defineProperty;\n\nvar isFunction = function (fn) {\n\treturn typeof fn === 'function' && toStr.call(fn) === '[object Function]';\n};\n\nvar hasPropertyDescriptors = require('has-property-descriptors')();\n\nvar supportsDescriptors = origDefineProperty && hasPropertyDescriptors;\n\nvar defineProperty = function (object, name, value, predicate) {\n\tif (name in object && (!isFunction(predicate) || !predicate())) {\n\t\treturn;\n\t}\n\tif (supportsDescriptors) {\n\t\torigDefineProperty(object, name, {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: value,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\tobject[name] = value; // eslint-disable-line no-param-reassign\n\t}\n};\n\nvar defineProperties = function (object, map) {\n\tvar predicates = arguments.length > 2 ? arguments[2] : {};\n\tvar props = keys(map);\n\tif (hasSymbols) {\n\t\tprops = concat.call(props, Object.getOwnPropertySymbols(map));\n\t}\n\tfor (var i = 0; i < props.length; i += 1) {\n\t\tdefineProperty(object, props[i], map[props[i]], predicates[props[i]]);\n\t}\n};\n\ndefineProperties.supportsDescriptors = !!supportsDescriptors;\n\nmodule.exports = defineProperties;\n","/**\n * Code refactored from Mozilla Developer Network:\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n */\n\n'use strict';\n\nfunction assign(target, firstSource) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert first argument to object');\n }\n\n var to = Object(target);\n for (var i = 1; i < arguments.length; i++) {\n var nextSource = arguments[i];\n if (nextSource === undefined || nextSource === null) {\n continue;\n }\n\n var keysArray = Object.keys(Object(nextSource));\n for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {\n var nextKey = keysArray[nextIndex];\n var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);\n if (desc !== undefined && desc.enumerable) {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n return to;\n}\n\nfunction polyfill() {\n if (!Object.assign) {\n Object.defineProperty(Object, 'assign', {\n enumerable: false,\n configurable: true,\n writable: true,\n value: assign\n });\n }\n}\n\nmodule.exports = {\n assign: assign,\n polyfill: polyfill\n};\n","'use strict';\n\nvar isCallable = require('is-callable');\n\nvar toStr = Object.prototype.toString;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar forEachArray = function forEachArray(array, iterator, receiver) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (hasOwnProperty.call(array, i)) {\n if (receiver == null) {\n iterator(array[i], i, array);\n } else {\n iterator.call(receiver, array[i], i, array);\n }\n }\n }\n};\n\nvar forEachString = function forEachString(string, iterator, receiver) {\n for (var i = 0, len = string.length; i < len; i++) {\n // no such thing as a sparse string.\n if (receiver == null) {\n iterator(string.charAt(i), i, string);\n } else {\n iterator.call(receiver, string.charAt(i), i, string);\n }\n }\n};\n\nvar forEachObject = function forEachObject(object, iterator, receiver) {\n for (var k in object) {\n if (hasOwnProperty.call(object, k)) {\n if (receiver == null) {\n iterator(object[k], k, object);\n } else {\n iterator.call(receiver, object[k], k, object);\n }\n }\n }\n};\n\nvar forEach = function forEach(list, iterator, thisArg) {\n if (!isCallable(iterator)) {\n throw new TypeError('iterator must be a function');\n }\n\n var receiver;\n if (arguments.length >= 3) {\n receiver = thisArg;\n }\n\n if (toStr.call(list) === '[object Array]') {\n forEachArray(list, iterator, receiver);\n } else if (typeof list === 'string') {\n forEachString(list, iterator, receiver);\n } else {\n forEachObject(list, iterator, receiver);\n }\n};\n\nmodule.exports = forEach;\n","'use strict';\n\n/* eslint no-invalid-this: 1 */\n\nvar ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';\nvar slice = Array.prototype.slice;\nvar toStr = Object.prototype.toString;\nvar funcType = '[object Function]';\n\nmodule.exports = function bind(that) {\n var target = this;\n if (typeof target !== 'function' || toStr.call(target) !== funcType) {\n throw new TypeError(ERROR_MESSAGE + target);\n }\n var args = slice.call(arguments, 1);\n\n var bound;\n var binder = function () {\n if (this instanceof bound) {\n var result = target.apply(\n this,\n args.concat(slice.call(arguments))\n );\n if (Object(result) === result) {\n return result;\n }\n return this;\n } else {\n return target.apply(\n that,\n args.concat(slice.call(arguments))\n );\n }\n };\n\n var boundLength = Math.max(0, target.length - args.length);\n var boundArgs = [];\n for (var i = 0; i < boundLength; i++) {\n boundArgs.push('$' + i);\n }\n\n bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);\n\n if (target.prototype) {\n var Empty = function Empty() {};\n Empty.prototype = target.prototype;\n bound.prototype = new Empty();\n Empty.prototype = null;\n }\n\n return bound;\n};\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = Function.prototype.bind || implementation;\n","'use strict';\n\nvar undefined;\n\nvar $SyntaxError = SyntaxError;\nvar $Function = Function;\nvar $TypeError = TypeError;\n\n// eslint-disable-next-line consistent-return\nvar getEvalledConstructor = function (expressionSyntax) {\n\ttry {\n\t\treturn $Function('\"use strict\"; return (' + expressionSyntax + ').constructor;')();\n\t} catch (e) {}\n};\n\nvar $gOPD = Object.getOwnPropertyDescriptor;\nif ($gOPD) {\n\ttry {\n\t\t$gOPD({}, '');\n\t} catch (e) {\n\t\t$gOPD = null; // this is IE 8, which has a broken gOPD\n\t}\n}\n\nvar throwTypeError = function () {\n\tthrow new $TypeError();\n};\nvar ThrowTypeError = $gOPD\n\t? (function () {\n\t\ttry {\n\t\t\t// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties\n\t\t\targuments.callee; // IE 8 does not throw here\n\t\t\treturn throwTypeError;\n\t\t} catch (calleeThrows) {\n\t\t\ttry {\n\t\t\t\t// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')\n\t\t\t\treturn $gOPD(arguments, 'callee').get;\n\t\t\t} catch (gOPDthrows) {\n\t\t\t\treturn throwTypeError;\n\t\t\t}\n\t\t}\n\t}())\n\t: throwTypeError;\n\nvar hasSymbols = require('has-symbols')();\n\nvar getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto\n\nvar needsEval = {};\n\nvar TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);\n\nvar INTRINSICS = {\n\t'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,\n\t'%Array%': Array,\n\t'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,\n\t'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,\n\t'%AsyncFromSyncIteratorPrototype%': undefined,\n\t'%AsyncFunction%': needsEval,\n\t'%AsyncGenerator%': needsEval,\n\t'%AsyncGeneratorFunction%': needsEval,\n\t'%AsyncIteratorPrototype%': needsEval,\n\t'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,\n\t'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,\n\t'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,\n\t'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,\n\t'%Boolean%': Boolean,\n\t'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,\n\t'%Date%': Date,\n\t'%decodeURI%': decodeURI,\n\t'%decodeURIComponent%': decodeURIComponent,\n\t'%encodeURI%': encodeURI,\n\t'%encodeURIComponent%': encodeURIComponent,\n\t'%Error%': Error,\n\t'%eval%': eval, // eslint-disable-line no-eval\n\t'%EvalError%': EvalError,\n\t'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,\n\t'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,\n\t'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,\n\t'%Function%': $Function,\n\t'%GeneratorFunction%': needsEval,\n\t'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,\n\t'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,\n\t'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,\n\t'%isFinite%': isFinite,\n\t'%isNaN%': isNaN,\n\t'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,\n\t'%JSON%': typeof JSON === 'object' ? JSON : undefined,\n\t'%Map%': typeof Map === 'undefined' ? undefined : Map,\n\t'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),\n\t'%Math%': Math,\n\t'%Number%': Number,\n\t'%Object%': Object,\n\t'%parseFloat%': parseFloat,\n\t'%parseInt%': parseInt,\n\t'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,\n\t'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,\n\t'%RangeError%': RangeError,\n\t'%ReferenceError%': ReferenceError,\n\t'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,\n\t'%RegExp%': RegExp,\n\t'%Set%': typeof Set === 'undefined' ? undefined : Set,\n\t'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),\n\t'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,\n\t'%String%': String,\n\t'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,\n\t'%Symbol%': hasSymbols ? Symbol : undefined,\n\t'%SyntaxError%': $SyntaxError,\n\t'%ThrowTypeError%': ThrowTypeError,\n\t'%TypedArray%': TypedArray,\n\t'%TypeError%': $TypeError,\n\t'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,\n\t'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,\n\t'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,\n\t'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,\n\t'%URIError%': URIError,\n\t'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,\n\t'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,\n\t'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet\n};\n\ntry {\n\tnull.error; // eslint-disable-line no-unused-expressions\n} catch (e) {\n\t// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229\n\tvar errorProto = getProto(getProto(e));\n\tINTRINSICS['%Error.prototype%'] = errorProto;\n}\n\nvar doEval = function doEval(name) {\n\tvar value;\n\tif (name === '%AsyncFunction%') {\n\t\tvalue = getEvalledConstructor('async function () {}');\n\t} else if (name === '%GeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('function* () {}');\n\t} else if (name === '%AsyncGeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('async function* () {}');\n\t} else if (name === '%AsyncGenerator%') {\n\t\tvar fn = doEval('%AsyncGeneratorFunction%');\n\t\tif (fn) {\n\t\t\tvalue = fn.prototype;\n\t\t}\n\t} else if (name === '%AsyncIteratorPrototype%') {\n\t\tvar gen = doEval('%AsyncGenerator%');\n\t\tif (gen) {\n\t\t\tvalue = getProto(gen.prototype);\n\t\t}\n\t}\n\n\tINTRINSICS[name] = value;\n\n\treturn value;\n};\n\nvar LEGACY_ALIASES = {\n\t'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],\n\t'%ArrayPrototype%': ['Array', 'prototype'],\n\t'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],\n\t'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],\n\t'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],\n\t'%ArrayProto_values%': ['Array', 'prototype', 'values'],\n\t'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],\n\t'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],\n\t'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],\n\t'%BooleanPrototype%': ['Boolean', 'prototype'],\n\t'%DataViewPrototype%': ['DataView', 'prototype'],\n\t'%DatePrototype%': ['Date', 'prototype'],\n\t'%ErrorPrototype%': ['Error', 'prototype'],\n\t'%EvalErrorPrototype%': ['EvalError', 'prototype'],\n\t'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],\n\t'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],\n\t'%FunctionPrototype%': ['Function', 'prototype'],\n\t'%Generator%': ['GeneratorFunction', 'prototype'],\n\t'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],\n\t'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],\n\t'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],\n\t'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],\n\t'%JSONParse%': ['JSON', 'parse'],\n\t'%JSONStringify%': ['JSON', 'stringify'],\n\t'%MapPrototype%': ['Map', 'prototype'],\n\t'%NumberPrototype%': ['Number', 'prototype'],\n\t'%ObjectPrototype%': ['Object', 'prototype'],\n\t'%ObjProto_toString%': ['Object', 'prototype', 'toString'],\n\t'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],\n\t'%PromisePrototype%': ['Promise', 'prototype'],\n\t'%PromiseProto_then%': ['Promise', 'prototype', 'then'],\n\t'%Promise_all%': ['Promise', 'all'],\n\t'%Promise_reject%': ['Promise', 'reject'],\n\t'%Promise_resolve%': ['Promise', 'resolve'],\n\t'%RangeErrorPrototype%': ['RangeError', 'prototype'],\n\t'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],\n\t'%RegExpPrototype%': ['RegExp', 'prototype'],\n\t'%SetPrototype%': ['Set', 'prototype'],\n\t'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],\n\t'%StringPrototype%': ['String', 'prototype'],\n\t'%SymbolPrototype%': ['Symbol', 'prototype'],\n\t'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],\n\t'%TypedArrayPrototype%': ['TypedArray', 'prototype'],\n\t'%TypeErrorPrototype%': ['TypeError', 'prototype'],\n\t'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],\n\t'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],\n\t'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],\n\t'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],\n\t'%URIErrorPrototype%': ['URIError', 'prototype'],\n\t'%WeakMapPrototype%': ['WeakMap', 'prototype'],\n\t'%WeakSetPrototype%': ['WeakSet', 'prototype']\n};\n\nvar bind = require('function-bind');\nvar hasOwn = require('has');\nvar $concat = bind.call(Function.call, Array.prototype.concat);\nvar $spliceApply = bind.call(Function.apply, Array.prototype.splice);\nvar $replace = bind.call(Function.call, String.prototype.replace);\nvar $strSlice = bind.call(Function.call, String.prototype.slice);\nvar $exec = bind.call(Function.call, RegExp.prototype.exec);\n\n/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */\nvar rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\nvar reEscapeChar = /\\\\(\\\\)?/g; /** Used to match backslashes in property paths. */\nvar stringToPath = function stringToPath(string) {\n\tvar first = $strSlice(string, 0, 1);\n\tvar last = $strSlice(string, -1);\n\tif (first === '%' && last !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected closing `%`');\n\t} else if (last === '%' && first !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected opening `%`');\n\t}\n\tvar result = [];\n\t$replace(string, rePropName, function (match, number, quote, subString) {\n\t\tresult[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;\n\t});\n\treturn result;\n};\n/* end adaptation */\n\nvar getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {\n\tvar intrinsicName = name;\n\tvar alias;\n\tif (hasOwn(LEGACY_ALIASES, intrinsicName)) {\n\t\talias = LEGACY_ALIASES[intrinsicName];\n\t\tintrinsicName = '%' + alias[0] + '%';\n\t}\n\n\tif (hasOwn(INTRINSICS, intrinsicName)) {\n\t\tvar value = INTRINSICS[intrinsicName];\n\t\tif (value === needsEval) {\n\t\t\tvalue = doEval(intrinsicName);\n\t\t}\n\t\tif (typeof value === 'undefined' && !allowMissing) {\n\t\t\tthrow new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');\n\t\t}\n\n\t\treturn {\n\t\t\talias: alias,\n\t\t\tname: intrinsicName,\n\t\t\tvalue: value\n\t\t};\n\t}\n\n\tthrow new $SyntaxError('intrinsic ' + name + ' does not exist!');\n};\n\nmodule.exports = function GetIntrinsic(name, allowMissing) {\n\tif (typeof name !== 'string' || name.length === 0) {\n\t\tthrow new $TypeError('intrinsic name must be a non-empty string');\n\t}\n\tif (arguments.length > 1 && typeof allowMissing !== 'boolean') {\n\t\tthrow new $TypeError('\"allowMissing\" argument must be a boolean');\n\t}\n\n\tif ($exec(/^%?[^%]*%?$/, name) === null) {\n\t\tthrow new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');\n\t}\n\tvar parts = stringToPath(name);\n\tvar intrinsicBaseName = parts.length > 0 ? parts[0] : '';\n\n\tvar intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);\n\tvar intrinsicRealName = intrinsic.name;\n\tvar value = intrinsic.value;\n\tvar skipFurtherCaching = false;\n\n\tvar alias = intrinsic.alias;\n\tif (alias) {\n\t\tintrinsicBaseName = alias[0];\n\t\t$spliceApply(parts, $concat([0, 1], alias));\n\t}\n\n\tfor (var i = 1, isOwn = true; i < parts.length; i += 1) {\n\t\tvar part = parts[i];\n\t\tvar first = $strSlice(part, 0, 1);\n\t\tvar last = $strSlice(part, -1);\n\t\tif (\n\t\t\t(\n\t\t\t\t(first === '\"' || first === \"'\" || first === '`')\n\t\t\t\t|| (last === '\"' || last === \"'\" || last === '`')\n\t\t\t)\n\t\t\t&& first !== last\n\t\t) {\n\t\t\tthrow new $SyntaxError('property names with quotes must have matching quotes');\n\t\t}\n\t\tif (part === 'constructor' || !isOwn) {\n\t\t\tskipFurtherCaching = true;\n\t\t}\n\n\t\tintrinsicBaseName += '.' + part;\n\t\tintrinsicRealName = '%' + intrinsicBaseName + '%';\n\n\t\tif (hasOwn(INTRINSICS, intrinsicRealName)) {\n\t\t\tvalue = INTRINSICS[intrinsicRealName];\n\t\t} else if (value != null) {\n\t\t\tif (!(part in value)) {\n\t\t\t\tif (!allowMissing) {\n\t\t\t\t\tthrow new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');\n\t\t\t\t}\n\t\t\t\treturn void undefined;\n\t\t\t}\n\t\t\tif ($gOPD && (i + 1) >= parts.length) {\n\t\t\t\tvar desc = $gOPD(value, part);\n\t\t\t\tisOwn = !!desc;\n\n\t\t\t\t// By convention, when a data property is converted to an accessor\n\t\t\t\t// property to emulate a data property that does not suffer from\n\t\t\t\t// the override mistake, that accessor's getter is marked with\n\t\t\t\t// an `originalValue` property. Here, when we detect this, we\n\t\t\t\t// uphold the illusion by pretending to see that original data\n\t\t\t\t// property, i.e., returning the value rather than the getter\n\t\t\t\t// itself.\n\t\t\t\tif (isOwn && 'get' in desc && !('originalValue' in desc.get)) {\n\t\t\t\t\tvalue = desc.get;\n\t\t\t\t} else {\n\t\t\t\t\tvalue = value[part];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tisOwn = hasOwn(value, part);\n\t\t\t\tvalue = value[part];\n\t\t\t}\n\n\t\t\tif (isOwn && !skipFurtherCaching) {\n\t\t\t\tINTRINSICS[intrinsicRealName] = value;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\n\nif ($gOPD) {\n\ttry {\n\t\t$gOPD([], 'length');\n\t} catch (e) {\n\t\t// IE 8 has a broken gOPD\n\t\t$gOPD = null;\n\t}\n}\n\nmodule.exports = $gOPD;\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $defineProperty = GetIntrinsic('%Object.defineProperty%', true);\n\nvar hasPropertyDescriptors = function hasPropertyDescriptors() {\n\tif ($defineProperty) {\n\t\ttry {\n\t\t\t$defineProperty({}, 'a', { value: 1 });\n\t\t\treturn true;\n\t\t} catch (e) {\n\t\t\t// IE 8 has a broken defineProperty\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn false;\n};\n\nhasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {\n\t// node v0.6 has a bug where array lengths can be Set but not Defined\n\tif (!hasPropertyDescriptors()) {\n\t\treturn null;\n\t}\n\ttry {\n\t\treturn $defineProperty([], 'length', { value: 1 }).length !== 1;\n\t} catch (e) {\n\t\t// In Firefox 4-22, defining length on an array throws an exception.\n\t\treturn true;\n\t}\n};\n\nmodule.exports = hasPropertyDescriptors;\n","'use strict';\n\nvar origSymbol = typeof Symbol !== 'undefined' && Symbol;\nvar hasSymbolSham = require('./shams');\n\nmodule.exports = function hasNativeSymbols() {\n\tif (typeof origSymbol !== 'function') { return false; }\n\tif (typeof Symbol !== 'function') { return false; }\n\tif (typeof origSymbol('foo') !== 'symbol') { return false; }\n\tif (typeof Symbol('bar') !== 'symbol') { return false; }\n\n\treturn hasSymbolSham();\n};\n","'use strict';\n\n/* eslint complexity: [2, 18], max-statements: [2, 33] */\nmodule.exports = function hasSymbols() {\n\tif (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }\n\tif (typeof Symbol.iterator === 'symbol') { return true; }\n\n\tvar obj = {};\n\tvar sym = Symbol('test');\n\tvar symObj = Object(sym);\n\tif (typeof sym === 'string') { return false; }\n\n\tif (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }\n\tif (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }\n\n\t// temp disabled per https://github.com/ljharb/object.assign/issues/17\n\t// if (sym instanceof Symbol) { return false; }\n\t// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4\n\t// if (!(symObj instanceof Symbol)) { return false; }\n\n\t// if (typeof Symbol.prototype.toString !== 'function') { return false; }\n\t// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }\n\n\tvar symVal = 42;\n\tobj[sym] = symVal;\n\tfor (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop\n\tif (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }\n\n\tif (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }\n\n\tvar syms = Object.getOwnPropertySymbols(obj);\n\tif (syms.length !== 1 || syms[0] !== sym) { return false; }\n\n\tif (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }\n\n\tif (typeof Object.getOwnPropertyDescriptor === 'function') {\n\t\tvar descriptor = Object.getOwnPropertyDescriptor(obj, sym);\n\t\tif (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }\n\t}\n\n\treturn true;\n};\n","'use strict';\n\nvar hasSymbols = require('has-symbols/shams');\n\nmodule.exports = function hasToStringTagShams() {\n\treturn hasSymbols() && !!Symbol.toStringTag;\n};\n","'use strict';\n\nvar bind = require('function-bind');\n\nmodule.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n }\n}\n","'use strict';\n\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\n\nvar isStandardArguments = function isArguments(value) {\n\tif (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {\n\t\treturn false;\n\t}\n\treturn $toString(value) === '[object Arguments]';\n};\n\nvar isLegacyArguments = function isArguments(value) {\n\tif (isStandardArguments(value)) {\n\t\treturn true;\n\t}\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.length === 'number' &&\n\t\tvalue.length >= 0 &&\n\t\t$toString(value) !== '[object Array]' &&\n\t\t$toString(value.callee) === '[object Function]';\n};\n\nvar supportsStandardArguments = (function () {\n\treturn isStandardArguments(arguments);\n}());\n\nisStandardArguments.isLegacyArguments = isLegacyArguments; // for tests\n\nmodule.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;\n","'use strict';\n\nvar fnToStr = Function.prototype.toString;\nvar reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;\nvar badArrayLike;\nvar isCallableMarker;\nif (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {\n\ttry {\n\t\tbadArrayLike = Object.defineProperty({}, 'length', {\n\t\t\tget: function () {\n\t\t\t\tthrow isCallableMarker;\n\t\t\t}\n\t\t});\n\t\tisCallableMarker = {};\n\t\t// eslint-disable-next-line no-throw-literal\n\t\treflectApply(function () { throw 42; }, null, badArrayLike);\n\t} catch (_) {\n\t\tif (_ !== isCallableMarker) {\n\t\t\treflectApply = null;\n\t\t}\n\t}\n} else {\n\treflectApply = null;\n}\n\nvar constructorRegex = /^\\s*class\\b/;\nvar isES6ClassFn = function isES6ClassFunction(value) {\n\ttry {\n\t\tvar fnStr = fnToStr.call(value);\n\t\treturn constructorRegex.test(fnStr);\n\t} catch (e) {\n\t\treturn false; // not a function\n\t}\n};\n\nvar tryFunctionObject = function tryFunctionToStr(value) {\n\ttry {\n\t\tif (isES6ClassFn(value)) { return false; }\n\t\tfnToStr.call(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\nvar toStr = Object.prototype.toString;\nvar objectClass = '[object Object]';\nvar fnClass = '[object Function]';\nvar genClass = '[object GeneratorFunction]';\nvar ddaClass = '[object HTMLAllCollection]'; // IE 11\nvar ddaClass2 = '[object HTML document.all class]';\nvar ddaClass3 = '[object HTMLCollection]'; // IE 9-10\nvar hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag`\n\nvar isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing\n\nvar isDDA = function isDocumentDotAll() { return false; };\nif (typeof document === 'object') {\n\t// Firefox 3 canonicalizes DDA to undefined when it's not accessed directly\n\tvar all = document.all;\n\tif (toStr.call(all) === toStr.call(document.all)) {\n\t\tisDDA = function isDocumentDotAll(value) {\n\t\t\t/* globals document: false */\n\t\t\t// in IE 6-8, typeof document.all is \"object\" and it's truthy\n\t\t\tif ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) {\n\t\t\t\ttry {\n\t\t\t\t\tvar str = toStr.call(value);\n\t\t\t\t\treturn (\n\t\t\t\t\t\tstr === ddaClass\n\t\t\t\t\t\t|| str === ddaClass2\n\t\t\t\t\t\t|| str === ddaClass3 // opera 12.16\n\t\t\t\t\t\t|| str === objectClass // IE 6-8\n\t\t\t\t\t) && value('') == null; // eslint-disable-line eqeqeq\n\t\t\t\t} catch (e) { /**/ }\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n\t}\n}\n\nmodule.exports = reflectApply\n\t? function isCallable(value) {\n\t\tif (isDDA(value)) { return true; }\n\t\tif (!value) { return false; }\n\t\tif (typeof value !== 'function' && typeof value !== 'object') { return false; }\n\t\ttry {\n\t\t\treflectApply(value, null, badArrayLike);\n\t\t} catch (e) {\n\t\t\tif (e !== isCallableMarker) { return false; }\n\t\t}\n\t\treturn !isES6ClassFn(value) && tryFunctionObject(value);\n\t}\n\t: function isCallable(value) {\n\t\tif (isDDA(value)) { return true; }\n\t\tif (!value) { return false; }\n\t\tif (typeof value !== 'function' && typeof value !== 'object') { return false; }\n\t\tif (hasToStringTag) { return tryFunctionObject(value); }\n\t\tif (isES6ClassFn(value)) { return false; }\n\t\tvar strClass = toStr.call(value);\n\t\tif (strClass !== fnClass && strClass !== genClass && !(/^\\[object HTML/).test(strClass)) { return false; }\n\t\treturn tryFunctionObject(value);\n\t};\n","'use strict';\n\nvar toStr = Object.prototype.toString;\nvar fnToStr = Function.prototype.toString;\nvar isFnRegex = /^\\s*(?:function)?\\*/;\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar getProto = Object.getPrototypeOf;\nvar getGeneratorFunc = function () { // eslint-disable-line consistent-return\n\tif (!hasToStringTag) {\n\t\treturn false;\n\t}\n\ttry {\n\t\treturn Function('return function*() {}')();\n\t} catch (e) {\n\t}\n};\nvar GeneratorFunction;\n\nmodule.exports = function isGeneratorFunction(fn) {\n\tif (typeof fn !== 'function') {\n\t\treturn false;\n\t}\n\tif (isFnRegex.test(fnToStr.call(fn))) {\n\t\treturn true;\n\t}\n\tif (!hasToStringTag) {\n\t\tvar str = toStr.call(fn);\n\t\treturn str === '[object GeneratorFunction]';\n\t}\n\tif (!getProto) {\n\t\treturn false;\n\t}\n\tif (typeof GeneratorFunction === 'undefined') {\n\t\tvar generatorFunc = getGeneratorFunc();\n\t\tGeneratorFunction = generatorFunc ? getProto(generatorFunc) : false;\n\t}\n\treturn getProto(fn) === GeneratorFunction;\n};\n","'use strict';\n\n/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */\n\nmodule.exports = function isNaN(value) {\n\treturn value !== value;\n};\n","'use strict';\n\nvar callBind = require('call-bind');\nvar define = require('define-properties');\n\nvar implementation = require('./implementation');\nvar getPolyfill = require('./polyfill');\nvar shim = require('./shim');\n\nvar polyfill = callBind(getPolyfill(), Number);\n\n/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */\n\ndefine(polyfill, {\n\tgetPolyfill: getPolyfill,\n\timplementation: implementation,\n\tshim: shim\n});\n\nmodule.exports = polyfill;\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = function getPolyfill() {\n\tif (Number.isNaN && Number.isNaN(NaN) && !Number.isNaN('a')) {\n\t\treturn Number.isNaN;\n\t}\n\treturn implementation;\n};\n","'use strict';\n\nvar define = require('define-properties');\nvar getPolyfill = require('./polyfill');\n\n/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */\n\nmodule.exports = function shimNumberIsNaN() {\n\tvar polyfill = getPolyfill();\n\tdefine(Number, { isNaN: polyfill }, {\n\t\tisNaN: function testIsNaN() {\n\t\t\treturn Number.isNaN !== polyfill;\n\t\t}\n\t});\n\treturn polyfill;\n};\n","'use strict';\n\nvar forEach = require('for-each');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar gOPD = require('gopd');\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\nvar typedArrays = availableTypedArrays();\n\nvar $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {\n\tfor (var i = 0; i < array.length; i += 1) {\n\t\tif (array[i] === value) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n};\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tvar arr = new g[typedArray]();\n\t\tif (Symbol.toStringTag in arr) {\n\t\t\tvar proto = getPrototypeOf(arr);\n\t\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\t\tif (!descriptor) {\n\t\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t\t}\n\t\t\ttoStrTags[typedArray] = descriptor.get;\n\t\t}\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar anyTrue = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!anyTrue) {\n\t\t\ttry {\n\t\t\t\tanyTrue = getter.call(value) === typedArray;\n\t\t\t} catch (e) { /**/ }\n\t\t}\n\t});\n\treturn anyTrue;\n};\n\nmodule.exports = function isTypedArray(value) {\n\tif (!value || typeof value !== 'object') { return false; }\n\tif (!hasToStringTag || !(Symbol.toStringTag in value)) {\n\t\tvar tag = $slice($toString(value), 8, -1);\n\t\treturn $indexOf(typedArrays, tag) > -1;\n\t}\n\tif (!gOPD) { return false; }\n\treturn tryTypedArrays(value);\n};\n","'use strict';\n\nvar numberIsNaN = function (value) {\n\treturn value !== value;\n};\n\nmodule.exports = function is(a, b) {\n\tif (a === 0 && b === 0) {\n\t\treturn 1 / a === 1 / b;\n\t}\n\tif (a === b) {\n\t\treturn true;\n\t}\n\tif (numberIsNaN(a) && numberIsNaN(b)) {\n\t\treturn true;\n\t}\n\treturn false;\n};\n\n","'use strict';\n\nvar define = require('define-properties');\nvar callBind = require('call-bind');\n\nvar implementation = require('./implementation');\nvar getPolyfill = require('./polyfill');\nvar shim = require('./shim');\n\nvar polyfill = callBind(getPolyfill(), Object);\n\ndefine(polyfill, {\n\tgetPolyfill: getPolyfill,\n\timplementation: implementation,\n\tshim: shim\n});\n\nmodule.exports = polyfill;\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = function getPolyfill() {\n\treturn typeof Object.is === 'function' ? Object.is : implementation;\n};\n","'use strict';\n\nvar getPolyfill = require('./polyfill');\nvar define = require('define-properties');\n\nmodule.exports = function shimObjectIs() {\n\tvar polyfill = getPolyfill();\n\tdefine(Object, { is: polyfill }, {\n\t\tis: function testObjectIs() {\n\t\t\treturn Object.is !== polyfill;\n\t\t}\n\t});\n\treturn polyfill;\n};\n","'use strict';\n\nvar keysShim;\nif (!Object.keys) {\n\t// modified from https://github.com/es-shims/es5-shim\n\tvar has = Object.prototype.hasOwnProperty;\n\tvar toStr = Object.prototype.toString;\n\tvar isArgs = require('./isArguments'); // eslint-disable-line global-require\n\tvar isEnumerable = Object.prototype.propertyIsEnumerable;\n\tvar hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');\n\tvar hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');\n\tvar dontEnums = [\n\t\t'toString',\n\t\t'toLocaleString',\n\t\t'valueOf',\n\t\t'hasOwnProperty',\n\t\t'isPrototypeOf',\n\t\t'propertyIsEnumerable',\n\t\t'constructor'\n\t];\n\tvar equalsConstructorPrototype = function (o) {\n\t\tvar ctor = o.constructor;\n\t\treturn ctor && ctor.prototype === o;\n\t};\n\tvar excludedKeys = {\n\t\t$applicationCache: true,\n\t\t$console: true,\n\t\t$external: true,\n\t\t$frame: true,\n\t\t$frameElement: true,\n\t\t$frames: true,\n\t\t$innerHeight: true,\n\t\t$innerWidth: true,\n\t\t$onmozfullscreenchange: true,\n\t\t$onmozfullscreenerror: true,\n\t\t$outerHeight: true,\n\t\t$outerWidth: true,\n\t\t$pageXOffset: true,\n\t\t$pageYOffset: true,\n\t\t$parent: true,\n\t\t$scrollLeft: true,\n\t\t$scrollTop: true,\n\t\t$scrollX: true,\n\t\t$scrollY: true,\n\t\t$self: true,\n\t\t$webkitIndexedDB: true,\n\t\t$webkitStorageInfo: true,\n\t\t$window: true\n\t};\n\tvar hasAutomationEqualityBug = (function () {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined') { return false; }\n\t\tfor (var k in window) {\n\t\t\ttry {\n\t\t\t\tif (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tequalsConstructorPrototype(window[k]);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}());\n\tvar equalsConstructorPrototypeIfNotBuggy = function (o) {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined' || !hasAutomationEqualityBug) {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t}\n\t\ttry {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t};\n\n\tkeysShim = function keys(object) {\n\t\tvar isObject = object !== null && typeof object === 'object';\n\t\tvar isFunction = toStr.call(object) === '[object Function]';\n\t\tvar isArguments = isArgs(object);\n\t\tvar isString = isObject && toStr.call(object) === '[object String]';\n\t\tvar theKeys = [];\n\n\t\tif (!isObject && !isFunction && !isArguments) {\n\t\t\tthrow new TypeError('Object.keys called on a non-object');\n\t\t}\n\n\t\tvar skipProto = hasProtoEnumBug && isFunction;\n\t\tif (isString && object.length > 0 && !has.call(object, 0)) {\n\t\t\tfor (var i = 0; i < object.length; ++i) {\n\t\t\t\ttheKeys.push(String(i));\n\t\t\t}\n\t\t}\n\n\t\tif (isArguments && object.length > 0) {\n\t\t\tfor (var j = 0; j < object.length; ++j) {\n\t\t\t\ttheKeys.push(String(j));\n\t\t\t}\n\t\t} else {\n\t\t\tfor (var name in object) {\n\t\t\t\tif (!(skipProto && name === 'prototype') && has.call(object, name)) {\n\t\t\t\t\ttheKeys.push(String(name));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (hasDontEnumBug) {\n\t\t\tvar skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);\n\n\t\t\tfor (var k = 0; k < dontEnums.length; ++k) {\n\t\t\t\tif (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {\n\t\t\t\t\ttheKeys.push(dontEnums[k]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn theKeys;\n\t};\n}\nmodule.exports = keysShim;\n","'use strict';\n\nvar slice = Array.prototype.slice;\nvar isArgs = require('./isArguments');\n\nvar origKeys = Object.keys;\nvar keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');\n\nvar originalKeys = Object.keys;\n\nkeysShim.shim = function shimObjectKeys() {\n\tif (Object.keys) {\n\t\tvar keysWorksWithArguments = (function () {\n\t\t\t// Safari 5.0 bug\n\t\t\tvar args = Object.keys(arguments);\n\t\t\treturn args && args.length === arguments.length;\n\t\t}(1, 2));\n\t\tif (!keysWorksWithArguments) {\n\t\t\tObject.keys = function keys(object) { // eslint-disable-line func-name-matching\n\t\t\t\tif (isArgs(object)) {\n\t\t\t\t\treturn originalKeys(slice.call(object));\n\t\t\t\t}\n\t\t\t\treturn originalKeys(object);\n\t\t\t};\n\t\t}\n\t} else {\n\t\tObject.keys = keysShim;\n\t}\n\treturn Object.keys || keysShim;\n};\n\nmodule.exports = keysShim;\n","'use strict';\n\nvar toStr = Object.prototype.toString;\n\nmodule.exports = function isArguments(value) {\n\tvar str = toStr.call(value);\n\tvar isArgs = str === '[object Arguments]';\n\tif (!isArgs) {\n\t\tisArgs = str !== '[object Array]' &&\n\t\t\tvalue !== null &&\n\t\t\ttypeof value === 'object' &&\n\t\t\ttypeof value.length === 'number' &&\n\t\t\tvalue.length >= 0 &&\n\t\t\ttoStr.call(value.callee) === '[object Function]';\n\t}\n\treturn isArgs;\n};\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (Array.isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return Object.keys(obj).map(function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (Array.isArray(obj[k])) {\n return obj[k].map(function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n","/*! queue-microtask. MIT License. Feross Aboukhadijeh */\nlet promise\n\nmodule.exports = typeof queueMicrotask === 'function'\n ? queueMicrotask.bind(typeof window !== 'undefined' ? window : global)\n // reuse resolved promise, and allocate it lazily\n : cb => (promise || (promise = Promise.resolve()))\n .then(cb)\n .catch(err => setTimeout(() => { throw err }, 0))\n","/**\n * Provides a way to access commonly used namespaces\n *\n * Usage:\n *\n * ```\n * const $rdf = require('rdflib'); //or any other RDF/JS-compatible library\n * const ns = require('solid-namespace')($rdf);\n * const store = $rdf.graph();\n *\n * let me = ...;\n * let name = store.any(me, ns.vcard(‘fn’)) || store.any(me, ns.foaf(‘name’));\n * ```\n * @module vocab\n */\nconst aliases = {\n acl: 'http://www.w3.org/ns/auth/acl#',\n arg: 'http://www.w3.org/ns/pim/arg#',\n as: 'https://www.w3.org/ns/activitystreams#',\n cal: 'http://www.w3.org/2002/12/cal/ical#',\n cert: 'http://www.w3.org/ns/auth/cert#',\n contact: 'http://www.w3.org/2000/10/swap/pim/contact#',\n dc: 'http://purl.org/dc/elements/1.1/',\n dct: 'http://purl.org/dc/terms/',\n doap: 'http://usefulinc.com/ns/doap#',\n foaf: 'http://xmlns.com/foaf/0.1/',\n geo: 'http://www.w3.org/2003/01/geo/wgs84_pos#',\n gpx: 'http://www.w3.org/ns/pim/gpx#',\n http: 'http://www.w3.org/2007/ont/http#',\n httph: 'http://www.w3.org/2007/ont/httph#',\n icalTZ: 'http://www.w3.org/2002/12/cal/icaltzd#', // Beware: not cal:\n ldp: 'http://www.w3.org/ns/ldp#',\n link: 'http://www.w3.org/2007/ont/link#',\n log: 'http://www.w3.org/2000/10/swap/log#',\n meeting: 'http://www.w3.org/ns/pim/meeting#',\n mo: 'http://purl.org/ontology/mo/',\n org: 'http://www.w3.org/ns/org#',\n owl: 'http://www.w3.org/2002/07/owl#',\n pad: 'http://www.w3.org/ns/pim/pad#',\n patch: 'http://www.w3.org/ns/pim/patch#',\n prov: 'http://www.w3.org/ns/prov#',\n qu: 'http://www.w3.org/2000/10/swap/pim/qif#',\n trip: 'http://www.w3.org/ns/pim/trip#',\n rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n rdfs: 'http://www.w3.org/2000/01/rdf-schema#',\n rss: 'http://purl.org/rss/1.0/',\n sched: 'http://www.w3.org/ns/pim/schedule#',\n schema: 'http://schema.org/', // @@ beware confusion with documents no 303\n sioc: 'http://rdfs.org/sioc/ns#',\n solid: 'http://www.w3.org/ns/solid/terms#',\n space: 'http://www.w3.org/ns/pim/space#',\n stat: 'http://www.w3.org/ns/posix/stat#',\n tab: 'http://www.w3.org/2007/ont/link#',\n tabont: 'http://www.w3.org/2007/ont/link#',\n ui: 'http://www.w3.org/ns/ui#',\n vcard: 'http://www.w3.org/2006/vcard/ns#',\n wf: 'http://www.w3.org/2005/01/wf/flow#',\n xsd: 'http://www.w3.org/2001/XMLSchema#',\n cco: 'http://www.ontologyrepository.com/CommonCoreOntologies/',\n skos: 'http://www.w3.org/2004/02/skos/core#',\n bookmark: 'http://www.w3.org/2002/01/bookmark#',\n vann: 'http://purl.org/vocab/vann/'\n}\n\n/**\n * @param [rdflib] {RDF} Optional RDF Library (such as rdflib.js or rdf-ext) to inject\n */\nfunction vocab (rdf = { namedNode: u => u }) {\n const namespaces = {}\n for (const alias in aliases) {\n const expansion = aliases[alias]\n namespaces[alias] = function (localName = '') {\n return rdf.namedNode(expansion + localName)\n }\n };\n\n return namespaces\n};\n\nmodule.exports = vocab\n","/*! https://mths.be/punycode v1.3.2 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see \n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * http://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.3.2',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see \n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar punycode = require('punycode');\nvar util = require('./util');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n unsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n },\n querystring = require('querystring');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && util.isObject(url) && url instanceof Url) return url;\n\n var u = new Url;\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (!util.isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n }\n\n // Copy chrome, IE, opera backslash-handling behavior.\n // Back slashes before the query string get converted to forward slashes\n // See: https://code.google.com/p/chromium/issues/detail?id=25916\n var queryIndex = url.indexOf('?'),\n splitter =\n (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n\n var rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.path = rest;\n this.href = rest;\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n if (parseQueryString) {\n this.query = querystring.parse(this.search.substr(1));\n } else {\n this.query = this.search.substr(1);\n }\n } else if (parseQueryString) {\n this.search = '';\n this.query = {};\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1)\n hostEnd = rest.length;\n\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost();\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) continue;\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a punycoded representation of \"domain\".\n // It only converts parts of the domain name that\n // have non-ASCII characters, i.e. it doesn't matter if\n // you call it with a domain that already is ASCII-only.\n this.hostname = punycode.toASCII(this.hostname);\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host;\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n }\n\n // now rest is set to the post-host stuff.\n // chop off any delim chars.\n if (!unsafeProtocol[lowerProto]) {\n\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1)\n continue;\n var esc = encodeURIComponent(ae);\n if (esc === ae) {\n esc = escape(ae);\n }\n rest = rest.split(ae).join(esc);\n }\n }\n\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n if (rest) this.pathname = rest;\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '/';\n }\n\n //to support http.request\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n }\n\n // finally, reconstruct the href based on what has been validated.\n this.href = this.format();\n return this;\n};\n\n// format a parsed object into a url string\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (util.isString(obj)) obj = urlParse(obj);\n if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n return obj.format();\n}\n\nUrl.prototype.format = function() {\n var auth = this.auth || '';\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ?\n this.hostname :\n '[' + this.hostname + ']');\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query &&\n util.isObject(this.query) &&\n Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.search || (query && ('?' + query)) || '';\n\n if (protocol && protocol.substr(-1) !== ':') protocol += ':';\n\n // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n if (this.slashes ||\n (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n if (search && search.charAt(0) !== '?') search = '?' + search;\n\n pathname = pathname.replace(/[?#]/g, function(match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function(relative) {\n if (util.isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n\n // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n result.hash = relative.hash;\n\n // if the relative url is empty, then there's nothing left to do here.\n if (relative.href === '') {\n result.href = result.format();\n return result;\n }\n\n // hrefs like //foo/bar always cut to the protocol.\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol')\n result[rkey] = relative[rkey];\n }\n\n //urlParse appends trailing / to urls like http://www.example.com\n if (slashedProtocol[result.protocol] &&\n result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n while (relPath.length && !(relative.host = relPath.shift()));\n if (!relative.host) relative.host = '';\n if (!relative.hostname) relative.hostname = '';\n if (relPath[0] !== '') relPath.unshift('');\n if (relPath.length < 2) relPath.unshift('');\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port;\n // to support http.request\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n isRelAbs = (\n relative.host ||\n relative.pathname && relative.pathname.charAt(0) === '/'\n ),\n mustEndAbs = (isRelAbs || isSourceAbs ||\n (result.host && relative.pathname)),\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n if (result.host) {\n if (srcPath[0] === '') srcPath[0] = result.host;\n else srcPath.unshift(result.host);\n }\n result.host = '';\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n if (relative.host) {\n if (relPath[0] === '') relPath[0] = relative.host;\n else relPath.unshift(relative.host);\n }\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = (relative.host || relative.host === '') ?\n relative.host : result.host;\n result.hostname = (relative.hostname || relative.hostname === '') ?\n relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath;\n // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!util.isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift();\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n result.search = relative.search;\n result.query = relative.query;\n //to support http.request\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null;\n //to support http.request\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n result.href = result.format();\n return result;\n }\n\n // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (\n (result.host || relative.host || srcPath.length > 1) &&\n (last === '.' || last === '..') || last === '');\n\n // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' &&\n (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' ||\n (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n // put the host back\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' :\n srcPath.length ? srcPath.shift() : '';\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n }\n\n //to support request.http\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function() {\n var host = this.host;\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) this.hostname = host;\n};\n","'use strict';\n\nmodule.exports = {\n isString: function(arg) {\n return typeof(arg) === 'string';\n },\n isObject: function(arg) {\n return typeof(arg) === 'object' && arg !== null;\n },\n isNull: function(arg) {\n return arg === null;\n },\n isNullOrUndefined: function(arg) {\n return arg == null;\n }\n};\n","module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}","// Currently in sync with Node.js lib/internal/util/types.js\n// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9\n\n'use strict';\n\nvar isArgumentsObject = require('is-arguments');\nvar isGeneratorFunction = require('is-generator-function');\nvar whichTypedArray = require('which-typed-array');\nvar isTypedArray = require('is-typed-array');\n\nfunction uncurryThis(f) {\n return f.call.bind(f);\n}\n\nvar BigIntSupported = typeof BigInt !== 'undefined';\nvar SymbolSupported = typeof Symbol !== 'undefined';\n\nvar ObjectToString = uncurryThis(Object.prototype.toString);\n\nvar numberValue = uncurryThis(Number.prototype.valueOf);\nvar stringValue = uncurryThis(String.prototype.valueOf);\nvar booleanValue = uncurryThis(Boolean.prototype.valueOf);\n\nif (BigIntSupported) {\n var bigIntValue = uncurryThis(BigInt.prototype.valueOf);\n}\n\nif (SymbolSupported) {\n var symbolValue = uncurryThis(Symbol.prototype.valueOf);\n}\n\nfunction checkBoxedPrimitive(value, prototypeValueOf) {\n if (typeof value !== 'object') {\n return false;\n }\n try {\n prototypeValueOf(value);\n return true;\n } catch(e) {\n return false;\n }\n}\n\nexports.isArgumentsObject = isArgumentsObject;\nexports.isGeneratorFunction = isGeneratorFunction;\nexports.isTypedArray = isTypedArray;\n\n// Taken from here and modified for better browser support\n// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js\nfunction isPromise(input) {\n\treturn (\n\t\t(\n\t\t\ttypeof Promise !== 'undefined' &&\n\t\t\tinput instanceof Promise\n\t\t) ||\n\t\t(\n\t\t\tinput !== null &&\n\t\t\ttypeof input === 'object' &&\n\t\t\ttypeof input.then === 'function' &&\n\t\t\ttypeof input.catch === 'function'\n\t\t)\n\t);\n}\nexports.isPromise = isPromise;\n\nfunction isArrayBufferView(value) {\n if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {\n return ArrayBuffer.isView(value);\n }\n\n return (\n isTypedArray(value) ||\n isDataView(value)\n );\n}\nexports.isArrayBufferView = isArrayBufferView;\n\n\nfunction isUint8Array(value) {\n return whichTypedArray(value) === 'Uint8Array';\n}\nexports.isUint8Array = isUint8Array;\n\nfunction isUint8ClampedArray(value) {\n return whichTypedArray(value) === 'Uint8ClampedArray';\n}\nexports.isUint8ClampedArray = isUint8ClampedArray;\n\nfunction isUint16Array(value) {\n return whichTypedArray(value) === 'Uint16Array';\n}\nexports.isUint16Array = isUint16Array;\n\nfunction isUint32Array(value) {\n return whichTypedArray(value) === 'Uint32Array';\n}\nexports.isUint32Array = isUint32Array;\n\nfunction isInt8Array(value) {\n return whichTypedArray(value) === 'Int8Array';\n}\nexports.isInt8Array = isInt8Array;\n\nfunction isInt16Array(value) {\n return whichTypedArray(value) === 'Int16Array';\n}\nexports.isInt16Array = isInt16Array;\n\nfunction isInt32Array(value) {\n return whichTypedArray(value) === 'Int32Array';\n}\nexports.isInt32Array = isInt32Array;\n\nfunction isFloat32Array(value) {\n return whichTypedArray(value) === 'Float32Array';\n}\nexports.isFloat32Array = isFloat32Array;\n\nfunction isFloat64Array(value) {\n return whichTypedArray(value) === 'Float64Array';\n}\nexports.isFloat64Array = isFloat64Array;\n\nfunction isBigInt64Array(value) {\n return whichTypedArray(value) === 'BigInt64Array';\n}\nexports.isBigInt64Array = isBigInt64Array;\n\nfunction isBigUint64Array(value) {\n return whichTypedArray(value) === 'BigUint64Array';\n}\nexports.isBigUint64Array = isBigUint64Array;\n\nfunction isMapToString(value) {\n return ObjectToString(value) === '[object Map]';\n}\nisMapToString.working = (\n typeof Map !== 'undefined' &&\n isMapToString(new Map())\n);\n\nfunction isMap(value) {\n if (typeof Map === 'undefined') {\n return false;\n }\n\n return isMapToString.working\n ? isMapToString(value)\n : value instanceof Map;\n}\nexports.isMap = isMap;\n\nfunction isSetToString(value) {\n return ObjectToString(value) === '[object Set]';\n}\nisSetToString.working = (\n typeof Set !== 'undefined' &&\n isSetToString(new Set())\n);\nfunction isSet(value) {\n if (typeof Set === 'undefined') {\n return false;\n }\n\n return isSetToString.working\n ? isSetToString(value)\n : value instanceof Set;\n}\nexports.isSet = isSet;\n\nfunction isWeakMapToString(value) {\n return ObjectToString(value) === '[object WeakMap]';\n}\nisWeakMapToString.working = (\n typeof WeakMap !== 'undefined' &&\n isWeakMapToString(new WeakMap())\n);\nfunction isWeakMap(value) {\n if (typeof WeakMap === 'undefined') {\n return false;\n }\n\n return isWeakMapToString.working\n ? isWeakMapToString(value)\n : value instanceof WeakMap;\n}\nexports.isWeakMap = isWeakMap;\n\nfunction isWeakSetToString(value) {\n return ObjectToString(value) === '[object WeakSet]';\n}\nisWeakSetToString.working = (\n typeof WeakSet !== 'undefined' &&\n isWeakSetToString(new WeakSet())\n);\nfunction isWeakSet(value) {\n return isWeakSetToString(value);\n}\nexports.isWeakSet = isWeakSet;\n\nfunction isArrayBufferToString(value) {\n return ObjectToString(value) === '[object ArrayBuffer]';\n}\nisArrayBufferToString.working = (\n typeof ArrayBuffer !== 'undefined' &&\n isArrayBufferToString(new ArrayBuffer())\n);\nfunction isArrayBuffer(value) {\n if (typeof ArrayBuffer === 'undefined') {\n return false;\n }\n\n return isArrayBufferToString.working\n ? isArrayBufferToString(value)\n : value instanceof ArrayBuffer;\n}\nexports.isArrayBuffer = isArrayBuffer;\n\nfunction isDataViewToString(value) {\n return ObjectToString(value) === '[object DataView]';\n}\nisDataViewToString.working = (\n typeof ArrayBuffer !== 'undefined' &&\n typeof DataView !== 'undefined' &&\n isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))\n);\nfunction isDataView(value) {\n if (typeof DataView === 'undefined') {\n return false;\n }\n\n return isDataViewToString.working\n ? isDataViewToString(value)\n : value instanceof DataView;\n}\nexports.isDataView = isDataView;\n\n// Store a copy of SharedArrayBuffer in case it's deleted elsewhere\nvar SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined;\nfunction isSharedArrayBufferToString(value) {\n return ObjectToString(value) === '[object SharedArrayBuffer]';\n}\nfunction isSharedArrayBuffer(value) {\n if (typeof SharedArrayBufferCopy === 'undefined') {\n return false;\n }\n\n if (typeof isSharedArrayBufferToString.working === 'undefined') {\n isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());\n }\n\n return isSharedArrayBufferToString.working\n ? isSharedArrayBufferToString(value)\n : value instanceof SharedArrayBufferCopy;\n}\nexports.isSharedArrayBuffer = isSharedArrayBuffer;\n\nfunction isAsyncFunction(value) {\n return ObjectToString(value) === '[object AsyncFunction]';\n}\nexports.isAsyncFunction = isAsyncFunction;\n\nfunction isMapIterator(value) {\n return ObjectToString(value) === '[object Map Iterator]';\n}\nexports.isMapIterator = isMapIterator;\n\nfunction isSetIterator(value) {\n return ObjectToString(value) === '[object Set Iterator]';\n}\nexports.isSetIterator = isSetIterator;\n\nfunction isGeneratorObject(value) {\n return ObjectToString(value) === '[object Generator]';\n}\nexports.isGeneratorObject = isGeneratorObject;\n\nfunction isWebAssemblyCompiledModule(value) {\n return ObjectToString(value) === '[object WebAssembly.Module]';\n}\nexports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;\n\nfunction isNumberObject(value) {\n return checkBoxedPrimitive(value, numberValue);\n}\nexports.isNumberObject = isNumberObject;\n\nfunction isStringObject(value) {\n return checkBoxedPrimitive(value, stringValue);\n}\nexports.isStringObject = isStringObject;\n\nfunction isBooleanObject(value) {\n return checkBoxedPrimitive(value, booleanValue);\n}\nexports.isBooleanObject = isBooleanObject;\n\nfunction isBigIntObject(value) {\n return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);\n}\nexports.isBigIntObject = isBigIntObject;\n\nfunction isSymbolObject(value) {\n return SymbolSupported && checkBoxedPrimitive(value, symbolValue);\n}\nexports.isSymbolObject = isSymbolObject;\n\nfunction isBoxedPrimitive(value) {\n return (\n isNumberObject(value) ||\n isStringObject(value) ||\n isBooleanObject(value) ||\n isBigIntObject(value) ||\n isSymbolObject(value)\n );\n}\nexports.isBoxedPrimitive = isBoxedPrimitive;\n\nfunction isAnyArrayBuffer(value) {\n return typeof Uint8Array !== 'undefined' && (\n isArrayBuffer(value) ||\n isSharedArrayBuffer(value)\n );\n}\nexports.isAnyArrayBuffer = isAnyArrayBuffer;\n\n['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) {\n Object.defineProperty(exports, method, {\n enumerable: false,\n value: function() {\n throw new Error(method + ' is not supported in userland');\n }\n });\n});\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||\n function getOwnPropertyDescriptors(obj) {\n var keys = Object.keys(obj);\n var descriptors = {};\n for (var i = 0; i < keys.length; i++) {\n descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);\n }\n return descriptors;\n };\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n if (typeof process !== 'undefined' && process.noDeprecation === true) {\n return fn;\n }\n\n // Allow for deprecating things in the process of starting up.\n if (typeof process === 'undefined') {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnvRegex = /^$/;\n\nif (process.env.NODE_DEBUG) {\n var debugEnv = process.env.NODE_DEBUG;\n debugEnv = debugEnv.replace(/[|\\\\{}()[\\]^$+?.]/g, '\\\\$&')\n .replace(/\\*/g, '.*')\n .replace(/,/g, '$|^')\n .toUpperCase();\n debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');\n}\nexports.debuglog = function(set) {\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (debugEnvRegex.test(set)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').slice(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.slice(1, -1);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nexports.types = require('./support/types');\n\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\nexports.types.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\nexports.types.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\nexports.types.isNativeError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nvar kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;\n\nexports.promisify = function promisify(original) {\n if (typeof original !== 'function')\n throw new TypeError('The \"original\" argument must be of type Function');\n\n if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n if (typeof fn !== 'function') {\n throw new TypeError('The \"util.promisify.custom\" argument must be of type Function');\n }\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return fn;\n }\n\n function fn() {\n var promiseResolve, promiseReject;\n var promise = new Promise(function (resolve, reject) {\n promiseResolve = resolve;\n promiseReject = reject;\n });\n\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n args.push(function (err, value) {\n if (err) {\n promiseReject(err);\n } else {\n promiseResolve(value);\n }\n });\n\n try {\n original.apply(this, args);\n } catch (err) {\n promiseReject(err);\n }\n\n return promise;\n }\n\n Object.setPrototypeOf(fn, Object.getPrototypeOf(original));\n\n if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return Object.defineProperties(\n fn,\n getOwnPropertyDescriptors(original)\n );\n}\n\nexports.promisify.custom = kCustomPromisifiedSymbol\n\nfunction callbackifyOnRejected(reason, cb) {\n // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).\n // Because `null` is a special error value in callbacks which means \"no error\n // occurred\", we error-wrap so the callback consumer can distinguish between\n // \"the promise rejected with null\" or \"the promise fulfilled with undefined\".\n if (!reason) {\n var newReason = new Error('Promise was rejected with a falsy value');\n newReason.reason = reason;\n reason = newReason;\n }\n return cb(reason);\n}\n\nfunction callbackify(original) {\n if (typeof original !== 'function') {\n throw new TypeError('The \"original\" argument must be of type Function');\n }\n\n // We DO NOT return the promise as it gives the user a false sense that\n // the promise is actually somehow related to the callback's execution\n // and that the callback throwing will reject the promise.\n function callbackified() {\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n var self = this;\n var cb = function() {\n return maybeCb.apply(self, arguments);\n };\n // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n original.apply(this, args)\n .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) },\n function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) });\n }\n\n Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));\n Object.defineProperties(callbackified,\n getOwnPropertyDescriptors(original));\n return callbackified;\n}\nexports.callbackify = callbackify;\n","'use strict';\n\nvar forEach = require('for-each');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('call-bind/callBound');\nvar gOPD = require('gopd');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\nvar typedArrays = availableTypedArrays();\n\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tif (typeof g[typedArray] === 'function') {\n\t\t\tvar arr = new g[typedArray]();\n\t\t\tif (Symbol.toStringTag in arr) {\n\t\t\t\tvar proto = getPrototypeOf(arr);\n\t\t\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\t\t\tif (!descriptor) {\n\t\t\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t\t\t}\n\t\t\t\ttoStrTags[typedArray] = descriptor.get;\n\t\t\t}\n\t\t}\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar foundName = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!foundName) {\n\t\t\ttry {\n\t\t\t\tvar name = getter.call(value);\n\t\t\t\tif (name === typedArray) {\n\t\t\t\t\tfoundName = name;\n\t\t\t\t}\n\t\t\t} catch (e) {}\n\t\t}\n\t});\n\treturn foundName;\n};\n\nvar isTypedArray = require('is-typed-array');\n\nmodule.exports = function whichTypedArray(value) {\n\tif (!isTypedArray(value)) { return false; }\n\tif (!hasToStringTag || !(Symbol.toStringTag in value)) { return $slice($toString(value), 8, -1); }\n\treturn tryTypedArrays(value);\n};\n","module.exports = __WEBPACK_EXTERNAL_MODULE__8392__;","var _typeof = require(\"./typeof.js\")[\"default\"];\nfunction _regeneratorRuntime() {\n \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */\n module.exports = _regeneratorRuntime = function _regeneratorRuntime() {\n return e;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n var t,\n e = {},\n r = Object.prototype,\n n = r.hasOwnProperty,\n o = Object.defineProperty || function (t, e, r) {\n t[e] = r.value;\n },\n i = \"function\" == typeof Symbol ? Symbol : {},\n a = i.iterator || \"@@iterator\",\n c = i.asyncIterator || \"@@asyncIterator\",\n u = i.toStringTag || \"@@toStringTag\";\n function define(t, e, r) {\n return Object.defineProperty(t, e, {\n value: r,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }), t[e];\n }\n try {\n define({}, \"\");\n } catch (t) {\n define = function define(t, e, r) {\n return t[e] = r;\n };\n }\n function wrap(t, e, r, n) {\n var i = e && e.prototype instanceof Generator ? e : Generator,\n a = Object.create(i.prototype),\n c = new Context(n || []);\n return o(a, \"_invoke\", {\n value: makeInvokeMethod(t, r, c)\n }), a;\n }\n function tryCatch(t, e, r) {\n try {\n return {\n type: \"normal\",\n arg: t.call(e, r)\n };\n } catch (t) {\n return {\n type: \"throw\",\n arg: t\n };\n }\n }\n e.wrap = wrap;\n var h = \"suspendedStart\",\n l = \"suspendedYield\",\n f = \"executing\",\n s = \"completed\",\n y = {};\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n var p = {};\n define(p, a, function () {\n return this;\n });\n var d = Object.getPrototypeOf,\n v = d && d(d(values([])));\n v && v !== r && n.call(v, a) && (p = v);\n var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);\n function defineIteratorMethods(t) {\n [\"next\", \"throw\", \"return\"].forEach(function (e) {\n define(t, e, function (t) {\n return this._invoke(e, t);\n });\n });\n }\n function AsyncIterator(t, e) {\n function invoke(r, o, i, a) {\n var c = tryCatch(t[r], t, o);\n if (\"throw\" !== c.type) {\n var u = c.arg,\n h = u.value;\n return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) {\n invoke(\"next\", t, i, a);\n }, function (t) {\n invoke(\"throw\", t, i, a);\n }) : e.resolve(h).then(function (t) {\n u.value = t, i(u);\n }, function (t) {\n return invoke(\"throw\", t, i, a);\n });\n }\n a(c.arg);\n }\n var r;\n o(this, \"_invoke\", {\n value: function value(t, n) {\n function callInvokeWithMethodAndArg() {\n return new e(function (e, r) {\n invoke(t, n, e, r);\n });\n }\n return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();\n }\n });\n }\n function makeInvokeMethod(e, r, n) {\n var o = h;\n return function (i, a) {\n if (o === f) throw Error(\"Generator is already running\");\n if (o === s) {\n if (\"throw\" === i) throw a;\n return {\n value: t,\n done: !0\n };\n }\n for (n.method = i, n.arg = a;;) {\n var c = n.delegate;\n if (c) {\n var u = maybeInvokeDelegate(c, n);\n if (u) {\n if (u === y) continue;\n return u;\n }\n }\n if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) {\n if (o === h) throw o = s, n.arg;\n n.dispatchException(n.arg);\n } else \"return\" === n.method && n.abrupt(\"return\", n.arg);\n o = f;\n var p = tryCatch(e, r, n);\n if (\"normal\" === p.type) {\n if (o = n.done ? s : l, p.arg === y) continue;\n return {\n value: p.arg,\n done: n.done\n };\n }\n \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg);\n }\n };\n }\n function maybeInvokeDelegate(e, r) {\n var n = r.method,\n o = e.iterator[n];\n if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y;\n var i = tryCatch(o, e.iterator, r.arg);\n if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y;\n var a = i.arg;\n return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y);\n }\n function pushTryEntry(t) {\n var e = {\n tryLoc: t[0]\n };\n 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);\n }\n function resetTryEntry(t) {\n var e = t.completion || {};\n e.type = \"normal\", delete e.arg, t.completion = e;\n }\n function Context(t) {\n this.tryEntries = [{\n tryLoc: \"root\"\n }], t.forEach(pushTryEntry, this), this.reset(!0);\n }\n function values(e) {\n if (e || \"\" === e) {\n var r = e[a];\n if (r) return r.call(e);\n if (\"function\" == typeof e.next) return e;\n if (!isNaN(e.length)) {\n var o = -1,\n i = function next() {\n for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;\n return next.value = t, next.done = !0, next;\n };\n return i.next = i;\n }\n }\n throw new TypeError(_typeof(e) + \" is not iterable\");\n }\n return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", {\n value: GeneratorFunctionPrototype,\n configurable: !0\n }), o(GeneratorFunctionPrototype, \"constructor\", {\n value: GeneratorFunction,\n configurable: !0\n }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) {\n var e = \"function\" == typeof t && t.constructor;\n return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name));\n }, e.mark = function (t) {\n return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t;\n }, e.awrap = function (t) {\n return {\n __await: t\n };\n }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {\n return this;\n }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {\n void 0 === i && (i = Promise);\n var a = new AsyncIterator(wrap(t, r, n, o), i);\n return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {\n return t.done ? t.value : a.next();\n });\n }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () {\n return this;\n }), define(g, \"toString\", function () {\n return \"[object Generator]\";\n }), e.keys = function (t) {\n var e = Object(t),\n r = [];\n for (var n in e) r.push(n);\n return r.reverse(), function next() {\n for (; r.length;) {\n var t = r.pop();\n if (t in e) return next.value = t, next.done = !1, next;\n }\n return next.done = !0, next;\n };\n }, e.values = values, Context.prototype = {\n constructor: Context,\n reset: function reset(e) {\n if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);\n },\n stop: function stop() {\n this.done = !0;\n var t = this.tryEntries[0].completion;\n if (\"throw\" === t.type) throw t.arg;\n return this.rval;\n },\n dispatchException: function dispatchException(e) {\n if (this.done) throw e;\n var r = this;\n function handle(n, o) {\n return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o;\n }\n for (var o = this.tryEntries.length - 1; o >= 0; --o) {\n var i = this.tryEntries[o],\n a = i.completion;\n if (\"root\" === i.tryLoc) return handle(\"end\");\n if (i.tryLoc <= this.prev) {\n var c = n.call(i, \"catchLoc\"),\n u = n.call(i, \"finallyLoc\");\n if (c && u) {\n if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);\n if (this.prev < i.finallyLoc) return handle(i.finallyLoc);\n } else if (c) {\n if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);\n } else {\n if (!u) throw Error(\"try statement without catch or finally\");\n if (this.prev < i.finallyLoc) return handle(i.finallyLoc);\n }\n }\n }\n },\n abrupt: function abrupt(t, e) {\n for (var r = this.tryEntries.length - 1; r >= 0; --r) {\n var o = this.tryEntries[r];\n if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) {\n var i = o;\n break;\n }\n }\n i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);\n var a = i ? i.completion : {};\n return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a);\n },\n complete: function complete(t, e) {\n if (\"throw\" === t.type) throw t.arg;\n return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y;\n },\n finish: function finish(t) {\n for (var e = this.tryEntries.length - 1; e >= 0; --e) {\n var r = this.tryEntries[e];\n if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;\n }\n },\n \"catch\": function _catch(t) {\n for (var e = this.tryEntries.length - 1; e >= 0; --e) {\n var r = this.tryEntries[e];\n if (r.tryLoc === t) {\n var n = r.completion;\n if (\"throw\" === n.type) {\n var o = n.arg;\n resetTryEntry(r);\n }\n return o;\n }\n }\n throw Error(\"illegal catch attempt\");\n },\n delegateYield: function delegateYield(e, r, n) {\n return this.delegate = {\n iterator: values(e),\n resultName: r,\n nextLoc: n\n }, \"next\" === this.method && (this.arg = t), y;\n }\n }, e;\n}\nmodule.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(o);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","// TODO(Babel 8): Remove this file.\n\nvar runtime = require(\"../helpers/regeneratorRuntime\")();\nmodule.exports = runtime;\n\n// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","'use strict';\n\nvar possibleNames = [\n\t'BigInt64Array',\n\t'BigUint64Array',\n\t'Float32Array',\n\t'Float64Array',\n\t'Int16Array',\n\t'Int32Array',\n\t'Int8Array',\n\t'Uint16Array',\n\t'Uint32Array',\n\t'Uint8Array',\n\t'Uint8ClampedArray'\n];\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\n\nmodule.exports = function availableTypedArrays() {\n\tvar out = [];\n\tfor (var i = 0; i < possibleNames.length; i++) {\n\t\tif (typeof g[possibleNames[i]] === 'function') {\n\t\t\tout[out.length] = possibleNames[i];\n\t\t}\n\t}\n\treturn out;\n};\n","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);\n }\n}\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","import _typeof from \"./typeof.js\";\nimport assertThisInitialized from \"./assertThisInitialized.js\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n return assertThisInitialized(self);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n return self;\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}","import _typeof from \"./typeof.js\";\nexport default function toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}","export default function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + chunkId + \".rdflib.min.js\";\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.hmd = (module) => {\n\tmodule = Object.create(module);\n\tif (!module.children) module.children = [];\n\tObject.defineProperty(module, 'exports', {\n\t\tenumerable: true,\n\t\tset: () => {\n\t\t\tthrow new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id);\n\t\t}\n\t});\n\treturn module;\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript)\n\t\tscriptUrl = document.currentScript.src;\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) {\n\t\t\tvar i = scripts.length - 1;\n\t\t\twhile (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;\n\t\t}\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t792: 0\n};\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// JSONP chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[2]);\n\t\t\t} else {\n\t\t\t\tif(true) { // all chunks have JS\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));\n\t\t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n\t\t\t\t\t// start chunk loading\n\t\t\t\t\tvar url = __webpack_require__.p + __webpack_require__.u(chunkId);\n\t\t\t\t\t// create error before stack unwound to get useful stacktrace later\n\t\t\t\t\tvar error = new Error();\n\t\t\t\t\tvar loadingEnded = (event) => {\n\t\t\t\t\t\tif(__webpack_require__.o(installedChunks, chunkId)) {\n\t\t\t\t\t\t\tinstalledChunkData = installedChunks[chunkId];\n\t\t\t\t\t\t\tif(installedChunkData !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\t\tif(installedChunkData) {\n\t\t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n\t\t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n\t\t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n\t\t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n\t\t\t\t\t\t\t\terror.type = errorType;\n\t\t\t\t\t\t\t\terror.request = realSrc;\n\t\t\t\t\t\t\t\tinstalledChunkData[1](error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t__webpack_require__.l(url, loadingEnded, \"chunk-\" + chunkId, chunkId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n};\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n// no on chunks loaded\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunk$rdf\"] = self[\"webpackChunk$rdf\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","import ClassOrder from './class-order'\nimport Node from './node-internal'\nimport IndexedFormula from './store'\nimport { BlankNodeTermType } from './types'\nimport { BlankNode as TFBlankNode } from './tf-types'\n\n/**\n * An RDF blank node is a Node without a URI\n * @link https://rdf.js.org/data-model-spec/#blanknode-interface\n */\nexport default class BlankNode extends Node implements TFBlankNode {\n termType: typeof BlankNodeTermType = BlankNodeTermType;\n /**\n * The next unique identifier for blank nodes\n */\n static nextId: number = 0;\n static NTAnonymousNodePrefix: '_:' = '_:'\n\n private static getId (id: string | unknown): string {\n if (id) {\n if (typeof id !== 'string') {\n throw new Error('Bad id argument to new blank node: ' + id)\n }\n\n if (id.includes('#')) {\n // Is a URI with hash fragment\n let fragments = id.split('#')\n return fragments[fragments.length - 1]\n }\n\n return id\n }\n\n return 'n' + BlankNode.nextId++\n }\n\n classOrder = ClassOrder.BlankNode\n /** Whether this is a blank node */\n isBlank: number = 1\n /**\n * This type of node is a variable.\n *\n * Note that the existence of this property already indicates that it is a variable.\n */\n isVar = 1\n\n /**\n * Initializes this node\n * @param [id] The identifier for the blank node\n */\n constructor (id?: string | unknown) {\n super(BlankNode.getId(id))\n }\n\n /**\n * The identifier for the blank node\n */\n public get id (): string {\n return this.value\n }\n\n public set id (value: string) {\n this.value = value\n }\n\n compareTerm (other: BlankNode): number {\n if (this.classOrder < other.classOrder) {\n return -1\n }\n if (this.classOrder > other.classOrder) {\n return +1\n }\n if (this.id < other.id) {\n return -1\n }\n if (this.id > other.id) {\n return +1\n }\n return 0\n }\n\n /**\n * Gets a copy of this blank node in the specified formula\n * @param formula The formula\n */\n copy (formula: IndexedFormula): BlankNode { // depends on the formula\n var bnodeNew = new BlankNode()\n formula.copyTo(this, bnodeNew)\n return bnodeNew\n }\n\n toCanonical () {\n return BlankNode.NTAnonymousNodePrefix + this.value\n }\n\n toString () {\n return BlankNode.NTAnonymousNodePrefix + this.id\n }\n}\n","import NamedNode from './named-node';\n\nexport default {\n boolean: new NamedNode('http://www.w3.org/2001/XMLSchema#boolean'),\n dateTime: new NamedNode('http://www.w3.org/2001/XMLSchema#dateTime'),\n decimal: new NamedNode('http://www.w3.org/2001/XMLSchema#decimal'),\n double: new NamedNode('http://www.w3.org/2001/XMLSchema#double'),\n integer: new NamedNode('http://www.w3.org/2001/XMLSchema#integer'),\n langString: new NamedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#langString'),\n string: new NamedNode('http://www.w3.org/2001/XMLSchema#string'),\n}\n","import ClassOrder from './class-order'\nimport RDFlibNamedNode from './named-node'\nimport Node from './node-internal'\nimport {\n FromValueReturns,\n LiteralTermType,\n ValueType\n} from './types'\nimport { isLiteral } from './utils/terms'\nimport XSD from './xsd-internal'\nimport { Literal as TFLiteral, Term } from './tf-types'\n\n/**\n * An RDF literal, containing some value which isn't expressed as an IRI.\n * @link https://rdf.js.org/data-model-spec/#literal-interface\n */\nexport default class Literal extends Node implements TFLiteral {\n termType: typeof LiteralTermType = LiteralTermType\n\n classOrder = ClassOrder.Literal\n\n /**\n * The literal's datatype as a named node\n */\n datatype: RDFlibNamedNode = XSD.string\n\n isVar = 0\n\n /**\n * The language for the literal\n */\n language: string = ''\n\n /**\n * Initializes a literal\n * @param value - The literal's lexical value\n * @param language - The language for the literal. Defaults to ''.\n * @param datatype - The literal's datatype as a named node. Defaults to xsd:string.\n */\n constructor (value: string, language?: string | null, datatype?) {\n super(value)\n\n if (language) {\n this.language = language\n this.datatype = XSD.langString\n } else if (datatype) {\n this.datatype = RDFlibNamedNode.fromValue(datatype)\n } else {\n this.datatype = XSD.string\n }\n }\n\n /**\n * Gets a copy of this literal\n */\n copy (): Literal {\n return new Literal(this.value, this.lang, this.datatype)\n }\n\n /**\n * Gets whether two literals are the same\n * @param other The other statement\n */\n equals (other: Term): boolean {\n if (!other) {\n return false\n }\n\n return (this.termType === other.termType) &&\n (this.value === other.value) &&\n (this.language === (other as Literal).language) &&\n ((!this.datatype && !(other as Literal).datatype) ||\n (this.datatype && this.datatype.equals((other as Literal).datatype)))\n }\n\n /**\n * The language for the literal\n * @deprecated use {language} instead\n */\n get lang (): string {\n return this.language\n }\n\n set lang (language: string) {\n this.language = language || ''\n }\n\n toNT(): string {\n return Literal.toNT(this)\n }\n\n /** Serializes a literal to an N-Triples string */\n static toNT (literal: Literal): string {\n if (typeof literal.value === 'number') {\n return '' + literal.value\n } else if (typeof literal.value !== 'string') {\n throw new Error('Value of RDF literal is not string or number: ' +\n literal.value)\n }\n var str = literal.value\n // #x22 (\"), #x5C (\\), #x0A (\\n) and #xD (\\r) are disallowed and need to be replaced\n // see https://www.w3.org/TR/n-triples/#grammar-production-STRING_LITERAL_QUOTE\n str = str.replace(/\\\\/g, '\\\\\\\\')\n str = str.replace(/\\\"/g, '\\\\\"')\n str = str.replace(/\\n/g, '\\\\n')\n str = str.replace(/\\r/g, '\\\\r')\n str = '\"' + str + '\"'\n\n if (literal.language) {\n str += '@' + literal.language\n } else if (!literal.datatype.equals(XSD.string)) {\n // Only add datatype if it's not a string\n str += '^^' + literal.datatype.toCanonical()\n }\n return str\n }\n\n toString () {\n return '' + this.value\n }\n\n /**\n * Builds a literal node from a boolean value\n * @param value - The value\n */\n static fromBoolean (value: boolean): Literal {\n let strValue = value ? '1' : '0'\n return new Literal(strValue, null, XSD.boolean)\n }\n\n /**\n * Builds a literal node from a date value\n * @param value The value\n */\n static fromDate(value: Date): Literal {\n if (!(value instanceof Date)) {\n throw new TypeError('Invalid argument to Literal.fromDate()')\n }\n let d2 = function (x) {\n return ('' + (100 + x)).slice(1, 3)\n }\n let date = '' + value.getUTCFullYear() + '-' + d2(value.getUTCMonth() + 1) +\n '-' + d2(value.getUTCDate()) + 'T' + d2(value.getUTCHours()) + ':' +\n d2(value.getUTCMinutes()) + ':' + d2(value.getUTCSeconds()) + 'Z'\n return new Literal(date, null, XSD.dateTime)\n }\n\n /**\n * Builds a literal node from a number value\n * @param value - The value\n */\n static fromNumber(value: number): Literal {\n if (typeof value !== 'number') {\n throw new TypeError('Invalid argument to Literal.fromNumber()')\n }\n let datatype: RDFlibNamedNode\n const strValue = value.toString()\n if (strValue.indexOf('e') < 0 && Math.abs(value) <= Number.MAX_SAFE_INTEGER) {\n datatype = Number.isInteger(value) ? XSD.integer : XSD.decimal\n } else {\n datatype = XSD.double\n }\n return new Literal(strValue, null, datatype)\n }\n\n /**\n * Builds a literal node from an input value\n * @param value - The input value\n */\n static fromValue(value: ValueType): T {\n if (isLiteral(value)) {\n return value as unknown as T\n }\n switch (typeof value) {\n case 'object':\n if (value instanceof Date) {\n return Literal.fromDate(value) as unknown as T\n }\n case 'boolean':\n return Literal.fromBoolean(value as boolean) as unknown as T\n case 'number':\n return Literal.fromNumber(value as number) as unknown as T\n case 'string':\n return new Literal(value) as unknown as T\n }\n\n throw new Error(\"Can't make literal from \" + value + ' of type ' +\n typeof value)\n }\n}\n","import RdflibBlankNode from './blank-node'\nimport ClassOrder from './class-order'\nimport Literal from './literal'\nimport Node from './node-internal'\nimport {\n Bindings,\n CollectionTermType,\n FromValueReturns,\n ValueType\n} from './types'\nimport Variable from './variable'\nimport { isTerm } from './utils/terms'\nimport { Term } from './tf-types'\n\n/**\n * Creates an RDF Node from a native javascript value.\n * RDF Nodes are returned unchanged, undefined returned as itself.\n * Arrays return Collections.\n * Strings, numbers and booleans return Literals.\n * @param value {Node|Date|String|Number|Boolean|Undefined}\n * @return {Node|Collection}\n */\nexport function fromValue = any, C extends Node = any>(value: ValueType): T {\n if (typeof value === 'undefined' || value === null) {\n return value as T\n }\n\n if (isTerm(value)) { // a Node subclass or a Collection\n return value as T\n }\n\n if (Array.isArray(value)) {\n return new Collection(value) as T\n }\n\n return Literal.fromValue(value)\n}\n\n/**\n * A collection of other RDF nodes\n *\n * Use generic T to control the contents of the array.\n */\nexport default class Collection<\n T extends Node = Node | RdflibBlankNode | Collection | Literal | Variable\n> extends Node implements Term {\n static termType: typeof CollectionTermType = CollectionTermType\n termType: typeof CollectionTermType = CollectionTermType\n\n classOrder = ClassOrder.Collection\n closed: boolean = false\n compareTerm = RdflibBlankNode.prototype.compareTerm\n /**\n * The nodes in this collection\n */\n elements: T[] = []\n isVar = 0\n\n constructor (initial?: ReadonlyArray) {\n super((RdflibBlankNode.nextId++).toString())\n\n if (initial && initial.length > 0) {\n initial.forEach(element => {\n this.elements.push(fromValue(element))\n })\n }\n }\n\n public get id (): string {\n return this.value\n }\n\n public set id (value) {\n this.value = value\n }\n\n /**\n * Appends an element to this collection\n * @param element - The new element\n */\n append (element: T): number {\n return this.elements.push(element)\n }\n\n /**\n * Closes this collection\n */\n close (): boolean {\n this.closed = true\n return this.closed\n }\n\n /**\n * Removes the first element from the collection (and return it)\n */\n shift (): T | undefined {\n return this.elements.shift()\n }\n\n /**\n * Creates a new Collection with the substituting bindings applied\n * @param bindings - The bindings to substitute\n */\n substitute (bindings: Bindings) {\n const elementsCopy = this.elements.map((ea) => ea.substitute(bindings))\n\n return new Collection(elementsCopy) as Collection | Literal | Variable>\n }\n\n toNT () {\n return Collection.toNT(this)\n }\n\n static toNT (collection) {\n // return '(' + collection.elements.map(x => x.toNT()).join(' ') + ')'\n // As lists are not in NT and toNT() must be a reversible function, we kludge it for a list\n return RdflibBlankNode.NTAnonymousNodePrefix + collection.id\n }\n\n /**\n * Serializes the collection to a string.\n * Surrounded by (parentheses) and separated by spaces.\n */\n toString () {\n return '(' + this.elements.join(' ') + ')'\n }\n\n /**\n * Prepends the specified element to the collection's front\n * @param element - The element to prepend\n */\n unshift (element: T): number {\n return this.elements.unshift(element)\n }\n}\n","import Node from './node-internal'\nimport { EmptyTermType } from './types'\nimport { Term } from './tf-types'\n\n/**\n* An empty node\n*/\nexport default class Empty extends Node implements Term {\n termType: typeof EmptyTermType = EmptyTermType\n\n constructor () {\n super('')\n }\n\n toString () {\n return '()'\n }\n}\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n _next(undefined);\n });\n };\n}","// Prevents circular dependencies between data-factory-internal and statement\n\nimport NamedNode from '../named-node'\n\nexport const defaultGraphURI = 'chrome:theSession'\nexport const defaultGraphNode = new NamedNode(defaultGraphURI)\n","import Node from './node-internal'\nimport { DefaultGraphTermType } from './types'\nimport { DefaultGraph as TFDefaultGraph } from './tf-types'\nimport { defaultGraphURI } from './utils/default-graph-uri'\n\n/** The RDF default graph */\nexport default class DefaultGraph extends Node implements TFDefaultGraph {\n value: '' = '';\n termType: typeof DefaultGraphTermType = DefaultGraphTermType;\n uri = defaultGraphURI\n\n constructor () {\n super('')\n }\n\n toCanonical () {\n return this.value\n }\n\n toString () {\n return 'DefaultGraph';\n }\n}\n\nexport function isDefaultGraph(object: any): object is DefaultGraph {\n return !!object && object.termType === DefaultGraphTermType;\n}\n","import Node from './node-internal'\nimport {\n Bindings,\n GraphType,\n ObjectType,\n PredicateType,\n SubjectType,\n DefaultGraphTermType,\n} from './types'\nimport DefaultGraphNode, { isDefaultGraph } from './default-graph'\nimport { Quad, DefaultGraph } from './tf-types'\n\nconst defaultGraph = new DefaultGraphNode()\n\n/** A Statement represents an RDF Triple or Quad. */\nexport default class Statement<\n S extends SubjectType = SubjectType,\n P extends PredicateType = PredicateType,\n O extends ObjectType = ObjectType,\n G extends GraphType = GraphType\n >\n implements Quad {\n\n /** The subject of the triple. What the Statement is about. */\n subject: S\n\n /** The relationship which is asserted between the subject and object */\n predicate: P\n\n /** The thing or data value which is asserted to be related to the subject */\n object: O\n\n /**\n * The graph param is a named node of the document in which the triple when\n * it is stored on the web.\n */\n graph: G | DefaultGraph\n\n /**\n * Construct a new statement\n *\n * @param subject - The subject of the triple. What the fact is about\n * @param predicate - The relationship which is asserted between the subject and object\n * @param object - The thing or data value which is asserted to be related to the subject\n * @param {NamedNode} graph - The document where the triple is or was or will be stored on the web.\n *\n * The graph param is a named node of the document in which the triple when it is stored\n * on the web. It exists because when you have read data from various places in the web,\n * the “graph” tells you _why_ you have the triple. (At the moment, it is just the\n * document, in future it could be an inference step)\n *\n * When you do UpdateManager.update() then the graph’s of all the statements must be the same,\n * and give the document you are patching. In future, we may have a more\n * powerful update() which can update more than one document.\n */\n constructor (\n subject: S,\n predicate: P,\n object: O,\n graph?: G | DefaultGraph,\n ) {\n this.subject = Node.fromValue(subject)\n this.predicate = Node.fromValue(predicate)\n this.object = Node.fromValue(object)\n this.graph = graph == undefined ? defaultGraph : Node.fromValue(graph) // property currently used by rdflib\n }\n\n /** Alias for graph, favored by Tim */\n get why () {\n return this.graph\n }\n\n set why (g) {\n this.graph = g\n }\n\n /**\n * Checks whether two statements are the same\n * @param other - The other statement\n */\n equals (other: Quad): boolean {\n return (\n other.subject.equals(this.subject) &&\n other.predicate.equals(this.predicate) &&\n other.object.equals(this.object) &&\n other.graph.equals(this.graph)\n )\n }\n\n /**\n * Creates a statement with the bindings substituted\n * @param bindings The bindings\n */\n substitute (bindings: Bindings): Statement {\n const y = new Statement(\n this.subject.substitute(bindings),\n this.predicate.substitute(bindings),\n this.object.substitute(bindings),\n isDefaultGraph(this.graph) ? this.graph :\n (this.graph as G).substitute(bindings)\n ) // 2016\n // console.log('@@@ statement substitute:' + y)\n return y\n }\n\n /** Creates a canonical string representation of this statement. */\n toCanonical (): string {\n let terms = [\n this.subject.toCanonical(),\n this.predicate.toCanonical(),\n this.object.toCanonical()\n ]\n if (this.graph && this.graph.termType !== DefaultGraphTermType) {\n terms.push(this.graph.toCanonical())\n }\n return terms.join(' ') + ' .'\n }\n\n /** Creates a n-triples string representation of this statement */\n toNT (): string {\n return [\n this.subject.toNT(),\n this.predicate.toNT(),\n this.object.toNT(),\n ].join(' ') + ' .'\n }\n\n /** Creates a n-quads string representation of this statement */\n toNQ (): string {\n return [\n this.subject.toNT(),\n this.predicate.toNT(),\n this.object.toNT(),\n isDefaultGraph(this.graph) ? '' : (this.graph as G).toNT()\n ].join(' ') + ' .'\n }\n\n /** Creates a string representation of this statement */\n toString (): string {\n /*\n return [\n this.subject.toString(),\n this.predicate.toString(),\n this.object.toString(),\n ].join(' ') + ' .'\n */\n return this.toNT()\n }\n}\n","import ClassOrder from './class-order'\nimport Node from './node-internal'\nimport { VariableTermType } from './types'\nimport * as Uri from './uri'\nimport { Variable as TFVariable } from './tf-types'\n\n/**\n* Variables are placeholders used in patterns to be matched.\n* In cwm they are symbols which are the formula's list of quantified variables.\n* In sparql they are not visibly URIs. Here we compromise, by having\n* a common special base URI for variables. Their names are uris,\n* but the ? notation has an implicit base uri of 'varid:'\n*/\nexport default class Variable extends Node implements TFVariable {\n termType: typeof VariableTermType = VariableTermType\n\n /** The base string for a variable's name */\n base = 'varid:'\n classOrder = ClassOrder.Variable\n isVar = 1\n /** The unique identifier of this variable */\n uri: string\n\n /**\n * Initializes this variable\n * @param name The variable's name\n */\n constructor (name = '') {\n super(name)\n this.base = 'varid:'\n this.uri = Uri.join(name, this.base)\n }\n\n equals (other) {\n if (!other) {\n return false\n }\n\n return (this.termType === other.termType) && (this.value === other.value)\n }\n\n hashString () {\n return this.toString()\n }\n\n substitute (bindings) {\n var ref\n return (ref = bindings[this.toNT()]) != null ? ref : this\n }\n\n toString () {\n return Variable.toString(this)\n }\n\n static toString (variable) {\n if (variable.uri.slice(0, variable.base.length) === variable.base) {\n return `?${variable.uri.slice(variable.base.length)}`\n }\n\n return `?${variable.uri}`\n }\n}\n","import Literal from '../literal'\nimport Statement from '../statement'\nimport NamedNode from '../named-node'\nimport BlankNode from '../blank-node'\nimport Variable from '../variable'\nimport DefaultGraph from '../default-graph'\nimport {\n BlankNode as TFBlankNode,\n RdfJsDataFactory,\n Literal as TFLiteral,\n NamedNode as TFNamedNode,\n Quad,\n Term,\n Variable as TFVariable,\n} from '../tf-types'\n\nexport type Comparable = Term | TFNamedNode | TFBlankNode | TFLiteral | Quad | undefined | null\n\nexport type DefaultFactoryTypes = NamedNode | BlankNode | Literal | Variable | Statement\n\nexport type Indexable = number | string\n\nexport type Namespace = (term:string) => TFNamedNode\n\n/** A set of features that may be supported by a Data Factory */\nexport type SupportTable = Record\n\nexport type TFIDFactoryTypes = TFNamedNode | TFBlankNode | TFLiteral | Quad | TFVariable | Term\n\nexport enum Feature {\n /** Whether the factory supports termType:Collection terms */\n collections = \"COLLECTIONS\",\n /** Whether the factory supports termType:DefaultGraph terms */\n defaultGraphType = \"DEFAULT_GRAPH_TYPE\",\n /** Whether the factory supports equals on produced instances */\n equalsMethod = \"EQUALS_METHOD\",\n /** Whether the factory can create a unique idempotent identifier for the given term. */\n id = \"ID\",\n /**\n * Whether the factory will return the same instance for subsequent calls.\n * This implies `===`, which means methods like `indexOf` can be used.\n */\n identity = \"IDENTITY\",\n /** Whether the factory supports mapping ids back to instances (should adhere to the identity setting) */\n reversibleId = \"REVERSIBLE_ID\",\n /** Whether the factory supports termType:Variable terms */\n variableType = \"VARIABLE_TYPE\",\n}\n\n/**\n * Defines a DataFactory as used in rdflib, based on the RDF/JS: Data model specification,\n * but with additional extensions\n *\n * bnIndex is optional but useful.\n */\nexport interface DataFactory<\n FactoryTypes = DefaultFactoryTypes,\n IndexType = Indexable\n> extends RdfJsDataFactory {\n /**\n * BlankNode index\n * @private\n */\n bnIndex?: number\n\n supports: SupportTable\n\n namedNode(value: string): NamedNode\n\n blankNode(value?: string): BlankNode\n\n literal(value: string, languageOrDatatype?: string | TFNamedNode): Literal\n\n variable(value: string): Variable,\n\n defaultGraph(): DefaultGraph,\n\n isQuad(obj: any): obj is Statement\n\n equals(a: Comparable, b: Comparable): boolean\n\n toNQ(term: Term | FactoryTypes): string\n\n quad(\n subject: Term,\n predicate: Term,\n object: Term,\n graph?: Term,\n ): Statement;\n\n quadToNQ(term: Statement | Quad): string\n\n termToNQ(term: Term): string\n\n /**\n * Generates a unique session-idempotent identifier for the given object.\n *\n * @example NQ serialization (reversible from value)\n * @example MD5 hash of termType + value (irreversible from value, map needed)\n *\n * @return {Indexable} A unique value which must also be a valid JS object key type.\n */\n id(obj: Term | FactoryTypes): IndexType\n}\n","import BlankNode from '../blank-node'\nimport Literal from '../literal'\nimport NamedNode from '../named-node'\nimport Statement from '../statement'\nimport Variable from '../variable'\nimport {\n SubjectType,\n PredicateType,\n ObjectType,\n GraphType,\n EmptyTermType,\n DefaultGraphTermType,\n VariableTermType,\n BlankNodeTermType,\n LiteralTermType,\n NamedNodeTermType,\n CollectionTermType,\n GraphTermType,\n} from '../types'\nimport DefaultGraph from '../default-graph'\nimport {\n Comparable,\n DataFactory,\n DefaultFactoryTypes,\n Feature,\n} from './factory-types'\nimport { isQuad, isTerm } from '../utils/terms'\nimport { NamedNode as TFNamedNode, Quad, Term } from '../tf-types'\nimport Collection from \"../collection\";\n\nexport { defaultGraphURI } from '../utils/default-graph-uri'\n\n/**\n * Gets the default graph\n */\nconst defaultGraph = new DefaultGraph()\n\n/** A basic internal RDFlib datafactory, which does not support Collections */\nconst CanonicalDataFactory: DataFactory = {\n\n supports: {\n [Feature.collections]: false,\n [Feature.defaultGraphType]: false,\n [Feature.equalsMethod]: true,\n [Feature.identity]: false,\n [Feature.id]: true,\n [Feature.reversibleId]: false,\n [Feature.variableType]: true,\n },\n\n /**\n * Creates a new blank node\n * @param value - The blank node's identifier\n */\n blankNode(value?: string): BlankNode {\n return new BlankNode(value)\n },\n\n defaultGraph: () => defaultGraph,\n\n /**\n * Compares to (rdf) objects for equality.\n */\n equals(a: Comparable, b: Comparable): boolean {\n if (a === b || !a || !b) {\n return true\n }\n\n if (isQuad(a) || isQuad(b)) {\n if (isQuad(a) && isQuad(b)) {\n return (\n this.equals(a.subject, b.subject) &&\n this.equals(a.predicate, b.predicate) &&\n this.equals(a.object, b.object) &&\n this.equals(a.graph, b.graph)\n )\n }\n\n return false\n }\n\n if (isTerm(a) && isTerm(b)) {\n return this.id(a) === this.id(b)\n }\n\n return false\n },\n\n /**\n * Generates a uniquely identifiably *idempotent* string for the given {term}.\n *\n * Equivalent to [[Term.hashString]]\n *\n * @example Use this to associate data with a term in an object\n * { obj[id(term)] = \"myData\" }\n */\n id (term: Term | Statement | undefined): string {\n if (!term) {\n return 'undefined'\n }\n\n if (isQuad(term)) {\n return this.quadToNQ(term)\n }\n\n switch (term.termType) {\n case DefaultGraphTermType:\n return 'defaultGraph'\n case VariableTermType:\n return Variable.toString(term)\n default:\n const nq = this.termToNQ(term)\n if (nq) {\n return nq\n }\n\n throw new Error(`Can't id term with type '${term.termType}'`)\n }\n },\n\n isQuad (obj: any): obj is Statement {\n return obj instanceof Statement\n },\n\n /**\n * Creates a new literal node. Does some JS literal parsing for ease of use.\n * @param value - The lexical value\n * @param languageOrDatatype - Either the language or the datatype\n */\n literal(\n value: string | number | boolean | Date,\n languageOrDatatype?: string | TFNamedNode\n ): Literal {\n if (typeof value !== \"string\" && !languageOrDatatype) {\n return Literal.fromValue(value)\n }\n\n const strValue = typeof value === 'string' ? value : '' + value\n if (typeof languageOrDatatype === 'string') {\n if (languageOrDatatype.indexOf(':') === -1) {\n return new Literal(strValue, languageOrDatatype)\n } else {\n return new Literal(strValue, null, this.namedNode(languageOrDatatype))\n }\n } else {\n return new Literal(strValue, null, languageOrDatatype)\n }\n },\n\n /**\n * Creates a new named node\n * @param value - The new named node\n */\n namedNode(value: string): NamedNode {\n return new NamedNode(value)\n },\n\n /**\n * Creates a new statement\n * @param subject - The subject\n * @param predicate - The predicate\n * @param object - The object\n * @param graph - The containing graph\n */\n quad<\n S extends SubjectType = SubjectType,\n P extends PredicateType = PredicateType,\n O extends ObjectType = ObjectType,\n G extends GraphType = GraphType\n >(subject: S, predicate: P, object: O, graph?: G): Statement {\n return new Statement(subject, predicate, object, graph || defaultGraph)\n },\n\n /**\n * Creates a new statement\n * @param subject - The subject\n * @param predicate - The predicate\n * @param object - The object\n * @param graph - The containing graph\n */\n triple(\n subject: Term | SubjectType,\n predicate: Term | PredicateType,\n object: Term | ObjectType,\n graph?: Term | GraphType\n ): Statement {\n return this.quad(subject, predicate, object, graph)\n },\n\n quadToNQ(q: Statement | Quad): string {\n return `${this.termToNQ(q.subject)} ${this.termToNQ(q.predicate)} ${this.termToNQ(q.object)} ${this.termToNQ(q.graph)} .`;\n },\n\n /** Stringify a {term} to n-quads serialization. */\n termToNQ(term: Term): string {\n switch (term.termType) {\n case BlankNodeTermType:\n return '_:' + term.value\n case DefaultGraphTermType:\n return ''\n case EmptyTermType:\n return ''\n case LiteralTermType:\n return Literal.toNT(term as Literal)\n case GraphTermType:\n case NamedNodeTermType:\n return '<' + term.value + '>'\n case CollectionTermType:\n return '(' + (term as Collection).elements.map(t => this.termToNQ(t)).join(' ') + ')'\n default:\n throw new Error(`Can't serialize nonstandard term type (was '${term.termType}')`)\n }\n },\n\n /** Convert an rdf object (term or quad) to n-quads serialization. */\n toNQ (term: Term | (DefaultFactoryTypes & Variable)): string {\n if (this.isQuad(term)) {\n return this.quadToNQ(term);\n }\n\n return this.termToNQ(term);\n },\n\n /**\n * Creates a new variable\n * @param name - The name for the variable\n */\n variable(name?: string): Variable {\n return new Variable(name)\n },\n}\n\n/** Contains the factory methods as defined in the spec, plus id */\nexport default CanonicalDataFactory\n","import RDFlibNamedNode from './named-node'\nimport { RdfJsDataFactory, NamedNode } from './tf-types'\n\n/**\n * Gets a namespace for the specified namespace's URI\n * @param nsuri - The URI for the namespace\n * @param [factory] - The factory for creating named nodes with\n */\nexport default function Namespace (nsuri: string, factory?: RdfJsDataFactory): (ln: string) => NamedNode {\n const dataFactory = factory || { namedNode: (value) => new RDFlibNamedNode(value) as NamedNode }\n\n return function (ln: string): NamedNode {\n return dataFactory.namedNode(nsuri + (ln || ''))\n }\n}\n","import CanonicalDataFactory from \"./factories/canonical-data-factory\";\n\nexport function createXSD(localFactory = CanonicalDataFactory) {\n return {\n boolean: localFactory.namedNode(\"http://www.w3.org/2001/XMLSchema#boolean\"),\n dateTime: localFactory.namedNode(\n \"http://www.w3.org/2001/XMLSchema#dateTime\"\n ),\n decimal: localFactory.namedNode(\"http://www.w3.org/2001/XMLSchema#decimal\"),\n double: localFactory.namedNode(\"http://www.w3.org/2001/XMLSchema#double\"),\n integer: localFactory.namedNode(\"http://www.w3.org/2001/XMLSchema#integer\"),\n langString: localFactory.namedNode(\n \"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString\"\n ),\n string: localFactory.namedNode(\"http://www.w3.org/2001/XMLSchema#string\"),\n };\n}\n\nconst defaultXSD = createXSD(CanonicalDataFactory);\n\nexport default defaultXSD;\n","/* Serialization of RDF Graphs\n**\n** Tim Berners-Lee 2006\n** This is was http://dig.csail.mit.edu/2005/ajar/ajaw/js/rdf/serialize.js\n** This is or was https://github.com/linkeddata/rdflib.js/blob/main/src/serializer.js\n** Licence: MIT\n*/\nimport NamedNode from './named-node'\nimport BlankNode from './blank-node'\nimport * as Uri from './uri'\nimport * as Util from './utils-js'\nimport CanonicalDataFactory from './factories/canonical-data-factory'\nimport { createXSD } from './xsd'\nimport solidNs from 'solid-namespace'\nimport * as ttl2jsonld from '@frogcat/ttl2jsonld'\n\n\nexport default function createSerializer(store) {\n return new Serializer(store);\n};\n\nexport class Serializer {\n constructor(store) {\n this.flags = ''\n this.base = null\n\n this.prefixes = [] // suggested prefixes\n this.namespaces = [] // complementary\n const nsKeys = Object.keys(solidNs())\n for (const i in nsKeys) {\n const uri = solidNs()[nsKeys[i]]('')\n const prefix = nsKeys[i]\n this.prefixes[uri] = prefix\n this.namespaces[prefix] = uri\n }\n\n this.suggestPrefix('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#') // XML code assumes this!\n this.suggestPrefix('xml', 'reserved:reservedForFutureUse') // XML reserves xml: in the spec.\n\n this.namespacesUsed = [] // Count actually used and so needed in @prefixes\n this.keywords = ['a'] // The only one we generate at the moment\n this.prefixchars = 'abcdefghijklmnopqustuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'\n this.incoming = null // Array not calculated yet\n this.formulas = [] // remembering original formulae from hashes\n this.store = store\n this.rdfFactory = store.rdfFactory || CanonicalDataFactory\n this.xsd = createXSD(this.rdfFactory)\n }\n\n setBase(base) {\n this.base = base;\n return this\n }\n\n setFlags(flags) {\n this.flags = flags || '';\n return this\n }\n\n toStr(x) {\n var s = x.toNT()\n if (x.termType === 'Graph') {\n this.formulas[s] = x // remember as reverse does not work\n }\n return s\n }\n\n fromStr(s) {\n if (s[0] === '{') {\n var x = this.formulas[s]\n if (!x) console.log('No formula object for ' + s)\n return x\n }\n return this.store.fromNT(s)\n }\n\n /**\n * Defines a set of [prefix, namespace] pairs to be used by this Serializer instance.\n * Overrides previous prefixes if any\n * @param namespaces\n * @return {Serializer}\n */\n setNamespaces(namespaces) {\n for (var px in namespaces) {\n this.setPrefix(px, namespaces[px])\n }\n return this\n }\n\n /**\n * Defines a namespace prefix, overriding any existing prefix for that URI\n * @param prefix\n * @param uri\n */\n setPrefix(prefix, uri) {\n if (prefix.slice(0, 7) === 'default') return // Try to weed these out\n if (prefix.slice(0, 2) === 'ns') return // From others inferior algos\n if (!prefix || !uri) return // empty strings not suitable\n\n // remove any existing prefix targeting this uri\n // for (let existingPrefix in this.namespaces) {\n // if (this.namespaces[existingPrefix] == uri)\n // delete this.namespaces[existingPrefix];\n // }\n\n // remove any existing mapping for this prefix\n for (let existingNs in this.prefixes) {\n if (this.prefixes[existingNs] == prefix)\n delete this.prefixes[existingNs];\n }\n\n this.prefixes[uri] = prefix\n this.namespaces[prefix] = uri\n }\n\n\n /* Accumulate Namespaces\n **\n ** These are only hints. If two overlap, only one gets used\n ** There is therefore no guarantee in general.\n */\n suggestPrefix(prefix, uri) {\n if (prefix.slice(0, 7) === 'default') return // Try to weed these out\n if (prefix.slice(0, 2) === 'ns') return // From others inferior algos\n if (!prefix || !uri) return // empty strings not suitable\n if (prefix in this.namespaces || uri in this.prefixes) return // already used\n this.prefixes[uri] = prefix\n this.namespaces[prefix] = uri\n }\n\n // Takes a namespace -> prefix map\n suggestNamespaces(namespaces) {\n for (var px in namespaces) {\n this.suggestPrefix(px, namespaces[px])\n }\n return this\n }\n\n checkIntegrity() {\n var p, ns\n for (p in this.namespaces) {\n if (this.prefixes[this.namespaces[p]] !== p) {\n throw new Error('Serializer integity error 1: ' + p + ', ' +\n this.namespaces[p] + ', ' + this.prefixes[this.namespaces[p]] + '!')\n }\n }\n for (ns in this.prefixes) {\n if (this.namespaces[this.prefixes[ns]] !== ns) {\n throw new Error('Serializer integity error 2: ' + ns + ', ' +\n this.prefixs[ns] + ', ' + this.namespaces[this.prefixes[ns]] + '!')\n }\n }\n }\n\n // Make up an unused prefix for a random namespace\n makeUpPrefix(uri) {\n var p = uri\n function canUseMethod (pp) {\n if (!this.validPrefix.test(pp)) return false // bad format\n if (pp === 'ns') return false // boring\n if (pp in this.namespaces) return false // already used\n this.prefixes[uri] = pp\n this.namespaces[pp] = uri\n return pp\n }\n var canUse = canUseMethod.bind(this)\n\n if ('#/'.indexOf(p[p.length - 1]) >= 0) p = p.slice(0, -1)\n var slash = p.lastIndexOf('/')\n if (slash >= 0) p = p.slice(slash + 1)\n var i = 0\n while (i < p.length) {\n if (this.prefixchars.indexOf(p[i])) {\n i++\n } else {\n break\n }\n }\n p = p.slice(0, i)\n\n if (p.length < 6 && (canUse(p))) return p // exact is best\n if (canUse(p.slice(0, 3))) return p.slice(0, 3)\n if (canUse(p.slice(0, 2))) return p.slice(0, 2)\n if (canUse(p.slice(0, 4))) return p.slice(0, 4)\n if (canUse(p.slice(0, 1))) return p.slice(0, 1)\n if (canUse(p.slice(0, 5))) return p.slice(0, 5)\n if (!this.validPrefix.test(p)) {\n p = 'n' // Otherwise the loop below may never termimnate\n }\n for (var j = 0; ; j++) if (canUse(p.slice(0, 3) + j)) return p.slice(0, 3) + j\n }\n\n rootSubjects(sts) {\n var incoming = {}\n var subjects = {}\n var allBnodes = {}\n\n /* This scan is to find out which nodes will have to be the roots of trees\n ** in the serialized form. This will be any symbols, and any bnodes\n ** which hve more or less than one incoming arc, and any bnodes which have\n ** one incoming arc but it is an uninterrupted loop of such nodes back to itself.\n ** This should be kept linear time with repect to the number of statements.\n ** Note it does not use any indexing of the store.\n */\n for (var i = 0; i < sts.length; i++) {\n var st = sts[i]\n var checkMentions = function (x) {\n if (!incoming.hasOwnProperty(x)) incoming[x] = []\n incoming[x].push(st.subject) // List of things which will cause this to be printed\n }\n var st2 = [st.subject, st.predicate, st.object]\n st2.map(function (y) {\n if (y.termType === 'BlankNode') {\n allBnodes[y.toNT()] = true\n } else if (y.termType === 'Collection') {\n y.elements.forEach(function (z) {\n checkMentions(z) // bnodes in collections important\n })\n }\n })\n checkMentions(sts[i].object)\n var ss = subjects[this.toStr(st.subject)] // Statements with this as subject\n if (!ss) ss = []\n ss.push(st)\n subjects[this.toStr(st.subject)] = ss // Make hash. @@ too slow for formula?\n }\n\n var roots = []\n for (var xNT in subjects) {\n if (!subjects.hasOwnProperty(xNT)) continue\n var y = this.fromStr(xNT)\n if ((y.termType !== 'BlankNode') || !incoming[y] || (incoming[y].length !== 1)) {\n roots.push(y)\n continue\n }\n }\n this.incoming = incoming // Keep for serializing @@ Bug for nested formulas\n\n // Now do the scan using existing roots\n var rootsHash = {}\n for (var k = 0; k < roots.length; k++) {\n rootsHash[roots[k].toNT()] = true\n }\n return {'roots': roots, 'subjects': subjects,\n 'rootsHash': rootsHash, 'incoming': incoming}\n }\n\n // //////////////////////////////////////////////////////\n\n toN3(f) {\n return this.statementsToN3(f.statements)\n }\n\n _notQNameChars = '\\t\\r\\n !\"#$%&\\'()*.,+/;<=>?@[\\\\]^`{|}~'\n _notNameChars =\n (this._notQNameChars + ':')\n\n explicitURI(uri) {\n if (this.flags.indexOf('r') < 0 && this.base) {\n uri = Uri.refTo(this.base, uri)\n } else if (this.flags.indexOf('u') >= 0) { // Unicode encoding NTriples style\n uri = backslashUify(uri)\n } else {\n uri = hexify(decodeURI(uri))\n }\n return '<' + uri + '>'\n }\n\n statementsToNTriples(sts) {\n var sorted = sts.slice()\n sorted.sort()\n var str = ''\n var rdfns = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'\n var self = this\n var kb = this.store\n var factory = this.rdfFactory\n var termToNT = function (x) {\n if (x.termType !== 'Collection') {\n return self.atomicTermToN3(x)\n }\n var list = x.elements\n var rest = kb.sym(rdfns + 'nill')\n for (var i = list.length - 1; i >= 0; i--) {\n var bnode = factory.blankNode()\n str += termToNT(bnode) + ' ' + termToNT(kb.sym(rdfns + 'first')) + ' ' + termToNT(list[i]) + '.\\n'\n str += termToNT(bnode) + ' ' + termToNT(kb.sym(rdfns + 'rest')) + ' ' + termToNT(rest) + '.\\n'\n rest = bnode\n }\n return self.atomicTermToN3(rest)\n }\n for (var i = 0; i < sorted.length; i++) {\n var st = sorted[i]\n var s = ''\n s += termToNT(st.subject) + ' '\n s += termToNT(st.predicate) + ' '\n s += termToNT(st.object) + ' '\n if (this.flags.indexOf('q') >= 0) { // Do quads not nrtiples\n s += termToNT(st.why) + ' '\n }\n s += '.\\n'\n str += s\n }\n return str\n }\n\n statementsToN3(sts) {\n var indent = 4\n var width = 80\n var kb = this.store\n // A URI Map alows us to put the type statemnts at the top.\n var uriMap = {'http://www.w3.org/1999/02/22-rdf-syntax-ns#type': 'aaa:00'}\n var SPO = function (x, y) { // Do limited canonicalization of bnodes\n return Util.heavyCompareSPO(x, y, kb, uriMap)\n }\n sts.sort(SPO)\n\n if (this.base && !this.defaultNamespace){\n this.defaultNamespace = this.base + '#'\n }\n\n var predMap = {}\n if (this.flags.indexOf('s') < 0) {\n predMap['http://www.w3.org/2002/07/owl#sameAs'] = '='\n }\n if (this.flags.indexOf('t') < 0) {\n predMap['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'] = 'a'\n }\n if (this.flags.indexOf('i') < 0) {\n predMap['http://www.w3.org/2000/10/swap/log#implies'] = '=>'\n }\n // //////////////////////// Arrange the bits of text\n\n var spaces = function (n) {\n var s = ''\n for (var i = 0; i < n; i++) s += ' '\n return s\n }\n\n var treeToLine = function (tree) {\n var str = ''\n for (var i = 0; i < tree.length; i++) {\n var branch = tree[i]\n var s2 = (typeof branch === 'string') ? branch : treeToLine(branch)\n // Note the space before the dot in case statement ends with 123 or colon. which is in fact allowed but be conservative.\n if (i !== 0) {\n var ch = str.slice(-1) || ' '\n if (s2 === ',' || s2 === ';') {\n // no gap\n } else if (s2 === '.' && !('0123456789.:'.includes(ch))) { // no gap except after number and colon\n // no gap\n } else {\n str += ' ' // separate from previous token\n }\n }\n str += s2\n }\n return str\n }\n\n // Convert a nested tree of lists and strings to a string\n var treeToString = function (tree, level) {\n var str = ''\n var lastLength = 100000\n if (level === undefined) level = -1\n for (var i = 0; i < tree.length; i++) {\n var branch = tree[i]\n if (typeof branch !== 'string') {\n var substr = treeToString(branch, level + 1)\n if (\n substr.length < 10 * (width - indent * level) &&\n substr.indexOf('\"\"\"') < 0) { // Don't mess up multiline strings\n var line = treeToLine(branch)\n if (line.length < (width - indent * level)) {\n branch = line // Note! treat as string below\n substr = ''\n }\n }\n if (substr) lastLength = 10000\n str += substr\n }\n if (typeof branch === 'string') {\n if (branch.length === 1 && str.slice(-1) === '\\n') {\n if (',.;'.indexOf(branch) >= 0) {\n str = str.slice(0, -1)\n // be conservative and ensure a whitespace between some chars and a final dot, as in treeToLine above\n if (branch == '.' && '0123456789.:'.includes(str.charAt(str.length-1))) {\n str += ' '\n lastLength += 1\n }\n str += branch + '\\n' // slip punct'n on end\n lastLength += 1\n continue\n }\n }\n if (lastLength < (indent * level + 4) || // if new line not necessary\n lastLength + branch.length + 1 < width && ';.'.indexOf(str[str.length - 2]) < 0) { // or the string fits on last line\n str = str.slice(0, -1) + ' ' + branch + '\\n' // then continue on this line\n lastLength += branch.length + 1\n } else {\n let line = spaces(indent * level) + branch\n str += line + '\\n'\n lastLength = line.length\n if (level < 0) {\n str += '\\n' // extra blank line\n lastLength = 100000 // don't touch\n }\n }\n }\n }\n return str\n }\n\n // //////////////////////////////////////////// Structure for N3\n // Convert a set of statements into a nested tree of lists and strings\n function statementListToTreeMethod (statements) {\n var stats = this.rootSubjects(statements)\n var roots = stats.roots\n var results = []\n for (var i = 0; i < roots.length; i++) {\n var root = roots[i]\n results.push(subjectTree(root, stats))\n }\n return results\n }\n var statementListToTree = statementListToTreeMethod.bind(this)\n\n // The tree for a subject\n function subjectTree (subject, stats) {\n if (subject.termType === 'BlankNode' && !stats.incoming[subject]) {\n return objectTree(subject, stats, true).concat(['.']) // Anonymous bnode subject\n }\n return [ termToN3(subject, stats) ].concat([propertyTree(subject, stats)]).concat(['.'])\n }\n // The property tree for a single subject or anonymous node\n function propertyTreeMethod (subject, stats) {\n var results = []\n var lastPred = null\n var sts = stats.subjects[this.toStr(subject)] || [] // relevant statements\n if (typeof sts === 'undefined') {\n throw new Error('Cant find statements for ' + subject)\n }\n\n var objects = []\n for (var i = 0; i < sts.length; i++) {\n var st = sts[i]\n if (st.predicate.uri === lastPred) {\n objects.push(',')\n } else {\n if (lastPred) {\n results = results.concat([objects]).concat([';'])\n objects = []\n }\n results.push(predMap[st.predicate.uri]\n ? predMap[st.predicate.uri] : termToN3(st.predicate, stats))\n }\n lastPred = st.predicate.uri\n objects.push(objectTree(st.object, stats))\n }\n results = results.concat([objects])\n return results\n }\n\n var propertyTree = propertyTreeMethod.bind(this)\n\n function objectTreeMethod(obj, stats, force) {\n if (obj.termType === 'BlankNode' &&\n (force || stats.rootsHash[obj.toNT()] === undefined)) {// if not a root\n if (stats.subjects[this.toStr(obj)]) {\n return ['[', propertyTree(obj, stats), ']']\n } else {\n return '[]'\n }\n }\n return termToN3(obj, stats)\n }\n\n var objectTree = objectTreeMethod.bind(this)\n\n function termToN3Method(expr, stats) { //\n var i, res\n switch (expr.termType) {\n case 'Graph':\n res = ['{']\n res = res.concat(statementListToTree(expr.statements))\n return res.concat(['}'])\n\n case 'Collection':\n res = ['(']\n for (i = 0; i < expr.elements.length; i++) {\n res.push([ objectTree(expr.elements[i], stats) ])\n }\n res.push(')')\n return res\n\n default:\n return this.atomicTermToN3(expr)\n }\n }\n Serializer.prototype.termToN3 = termToN3\n var termToN3 = termToN3Method.bind(this)\n\n function prefixDirectivesMethod () {\n var str = ''\n if (this.flags.indexOf('d') < 0 && this.defaultNamespace) {\n str += '@prefix : ' + this.explicitURI(this.defaultNamespace) + '.\\n'\n }\n for (var ns in this.prefixes) {\n if (!this.prefixes.hasOwnProperty(ns)) continue\n if (!this.namespacesUsed[ns]) continue\n str += '@prefix ' + this.prefixes[ns] + ': ' + this.explicitURI(ns) +\n '.\\n'\n }\n return str + '\\n'\n }\n var prefixDirectives = prefixDirectivesMethod.bind(this)\n // Body of statementsToN3:\n var tree = statementListToTree(sts)\n return prefixDirectives() + treeToString(tree)\n }\n // //////////////////////////////////////////// Atomic Terms\n\n // Deal with term level things and nesting with no bnode structure\n atomicTermToN3 (expr, stats) {\n switch (expr.termType) {\n case 'BlankNode':\n case 'Variable':\n return expr.toNT()\n case 'Literal':\n var val = expr.value\n if (typeof val !== 'string') {\n throw new TypeError('Value of RDF literal node must be a string')\n }\n // var val = expr.value.toString() // should be a string already\n if (expr.datatype && this.flags.indexOf('x') < 0) { // Supress native numbers\n switch (expr.datatype.uri) {\n\n case 'http://www.w3.org/2001/XMLSchema#integer':\n return val\n\n case 'http://www.w3.org/2001/XMLSchema#decimal': // In Turtle, must have dot\n if (val.indexOf('.') < 0) val += '.0'\n return val\n\n case 'http://www.w3.org/2001/XMLSchema#double': {\n // Must force use of 'e'\n const eNotation = val.toLowerCase().indexOf('e') > 0;\n if (val.indexOf('.') < 0 && !eNotation) val += '.0'\n if (!eNotation) val += 'e0'\n return val\n }\n\n case 'http://www.w3.org/2001/XMLSchema#boolean':\n return expr.value === '1' ? 'true' : 'false'\n }\n }\n var str = this.stringToN3(expr.value)\n if (expr.language) {\n str += '@' + expr.language\n } else if (!expr.datatype.equals(this.xsd.string)) {\n str += '^^' + this.atomicTermToN3(expr.datatype, stats)\n }\n return str\n case 'NamedNode':\n return this.symbolToN3(expr)\n case 'DefaultGraph':\n return '';\n default:\n throw new Error('Internal: atomicTermToN3 cannot handle ' + expr + ' of termType: ' + expr.termType)\n }\n }\n\n // stringToN3: String escaping for N3\n\n validPrefix = new RegExp(/^[a-zA-Z][a-zA-Z0-9]*$/)\n\n forbidden1 = new RegExp(/[\\\\\"\\b\\f\\r\\v\\t\\n\\u0080-\\uffff]/gm)\n forbidden3 = new RegExp(/[\\\\\"\\b\\f\\r\\v\\u0080-\\uffff]/gm)\n stringToN3(str, flags) {\n if (!flags) flags = 'e'\n var res = ''\n var i, j, k\n var delim\n var forbidden\n if (str.length > 20 && // Long enough to make sense\n str.slice(-1) !== '\"' && // corner case'\n flags.indexOf('n') < 0 && // Force single line\n (str.indexOf('\\n') > 0 || str.indexOf('\"') > 0)) {\n delim = '\"\"\"'\n forbidden = this.forbidden3\n } else {\n delim = '\"'\n forbidden = this.forbidden1\n }\n for (i = 0; i < str.length;) {\n forbidden.lastIndex = 0\n var m = forbidden.exec(str.slice(i))\n if (m == null) break\n j = i + forbidden.lastIndex - 1\n res += str.slice(i, j)\n var ch = str[j]\n if (ch === '\"' && delim === '\"\"\"' && str.slice(j, j + 3) !== '\"\"\"') {\n res += ch\n } else {\n k = '\\b\\f\\r\\t\\v\\n\\\\\"'.indexOf(ch) // No escaping of bell (7)?\n if (k >= 0) {\n res += '\\\\' + 'bfrtvn\\\\\"'[k]\n } else {\n if (flags.indexOf('e') >= 0) { // Unicode escaping in strings not unix style\n res += '\\\\u' + ('000' +\n ch.charCodeAt(0).toString(16).toLowerCase()).slice(-4)\n } else { // no 'e' flag\n res += ch\n }\n }\n }\n i = j + 1\n }\n return delim + res + str.slice(i) + delim\n }\n // A single symbol, either in <> or namespace notation\n\n symbolToN3 (x) { // c.f. symbolString() in notation3.py\n var uri = x.uri\n var j = uri.indexOf('#')\n if (j < 0 && this.flags.indexOf('/') < 0) {\n j = uri.lastIndexOf('/')\n }\n if (j >= 0 && this.flags.indexOf('p') < 0 &&\n // Can split at namespace but only if http[s]: URI or file: or ws[s] (why not others?)\n (uri.indexOf('http') === 0 || uri.indexOf('ws') === 0 || uri.indexOf('file') === 0)) {\n var canSplit = true\n for (var k = j + 1; k < uri.length; k++) {\n if (this._notNameChars.indexOf(uri[k]) >= 0) {\n canSplit = false\n break\n }\n }\n/*\n if (uri.slice(0, j + 1) === this.base + '#') { // base-relative\n if (canSplit) {\n return ':' + uri.slice(j + 1) // assume deafult ns is local\n } else {\n return '<#' + uri.slice(j + 1) + '>'\n }\n }\n*/\n if (canSplit) {\n var localid = uri.slice(j + 1)\n var namesp = uri.slice(0, j + 1)\n if (this.defaultNamespace && this.defaultNamespace === namesp &&\n this.flags.indexOf('d') < 0) { // d -> suppress default\n if (this.flags.indexOf('k') >= 0 &&\n this.keyords.indexOf(localid) < 0) {\n return localid\n }\n return ':' + localid\n }\n // this.checkIntegrity() // @@@ Remove when not testing\n var prefix = this.prefixes[namesp]\n if (!prefix) prefix = this.makeUpPrefix(namesp)\n if (prefix) {\n this.namespacesUsed[namesp] = true\n return prefix + ':' + localid\n }\n // Fall though if can't do qname\n }\n }\n return this.explicitURI(uri)\n }\n\n // /////////////////////////// Quad store serialization\n\n // @para. write - a function taking a single string to be output\n //\n writeStore(write) {\n var kb = this.store\n var fetcher = kb.fetcher\n var session = fetcher && fetcher.appNode\n\n // The core data\n\n var sources = this.store.index[3]\n for (var s in sources) { // -> assume we can use -> as short for log:semantics\n var source = kb.fromNT(s)\n if (session && source.equals(session)) continue\n write('\\n' + this.atomicTermToN3(source) + ' ' +\n this.atomicTermToN3(kb.sym('http://www.w3.org/2000/10/swap/log#semantics')) +\n ' { ' + this.statementsToN3(kb.statementsMatching(\n undefined, undefined, undefined, source)) + ' }.\\n')\n }\n\n // The metadata from HTTP interactions:\n\n kb.statementsMatching(undefined,\n kb.sym('http://www.w3.org/2007/ont/link#requestedURI')).map(\n function (st) {\n write('\\n<' + st.object.value + '> log:metadata {\\n')\n var sts = kb.statementsMatching(undefined, undefined, undefined, st.subject)\n write(this.statementsToN3(this.statementsToN3(sts)))\n write('}.\\n')\n })\n\n // Inferences we have made ourselves not attributable to anyone else\n\n var metaSources = []\n if (session) metaSources.push(session)\n var metadata = []\n metaSources.map(function (source) {\n metadata = metadata.concat(kb.statementsMatching(undefined, undefined, undefined, source))\n })\n write(this.statementsToN3(metadata))\n }\n\n // ////////////////////////////////////////////// XML serialization\n\n statementsToXML(sts) {\n var indent = 4\n var width = 80\n\n var namespaceCounts = [] // which have been used\n namespaceCounts['http://www.w3.org/1999/02/22-rdf-syntax-ns#'] = true\n\n var liPrefix = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_' // prefix for ordered list items\n\n // //////////////////////// Arrange the bits of XML text\n\n var spaces = function (n) {\n var s = ''\n for (var i = 0; i < n; i++) s += ' '\n return s\n }\n\n var XMLtreeToLine = function (tree) {\n var str = ''\n for (var i = 0; i < tree.length; i++) {\n var branch = tree[i]\n var s2 = (typeof branch === 'string') ? branch : XMLtreeToLine(branch)\n str += s2\n }\n return str\n }\n\n // Convert a nested tree of lists and strings to a string\n var XMLtreeToString = function (tree, level) {\n var str = ''\n var line\n var lastLength = 100000\n if (!level) level = 0\n for (var i = 0; i < tree.length; i++) {\n var branch = tree[i]\n if (typeof branch !== 'string') {\n var substr = XMLtreeToString(branch, level + 1)\n if (\n substr.length < 10 * (width - indent * level) &&\n substr.indexOf('\"\"\"') < 0) { // Don't mess up multiline strings\n line = XMLtreeToLine(branch)\n if (line.length < (width - indent * level)) {\n branch = ' ' + line // @@ Hack: treat as string below\n substr = ''\n }\n }\n if (substr) lastLength = 10000\n str += substr\n }\n if (typeof branch === 'string') {\n if (lastLength < (indent * level + 4)) { // continue\n str = str.slice(0, -1) + ' ' + branch + '\\n'\n lastLength += branch.length + 1\n } else {\n line = spaces(indent * level) + branch\n str += line + '\\n'\n lastLength = line.length\n }\n } else { // not string\n }\n }\n return str\n }\n\n function statementListToXMLTreeMethod (statements) {\n this.suggestPrefix('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#')\n var stats = this.rootSubjects(statements)\n var roots = stats.roots\n var results = []\n for (var i = 0; i < roots.length; i++) {\n var root = roots[i]\n results.push(subjectXMLTree(root, stats))\n }\n return results\n }\n var statementListToXMLTree = statementListToXMLTreeMethod.bind(this)\n\n function escapeForXML (str) {\n if (typeof str === 'undefined') return '@@@undefined@@@@'\n return str.replace(/[&<\"]/g, function (m) {\n switch (m[0]) {\n case '&':\n return '&'\n case '<':\n return '<'\n case '\"':\n return '"' // '\n }\n })\n }\n\n function relURIMethod (term) {\n return escapeForXML((this.base) ? Util.uri.refTo(this.base, term.uri) : term.uri)\n }\n var relURI = relURIMethod.bind(this)\n\n // The tree for a subject\n function subjectXMLTreeMethod (subject, stats) {\n var results = []\n var type, t, st, pred\n var sts = stats.subjects[this.toStr(subject)] // relevant statements\n if (typeof sts === 'undefined') { // empty bnode\n return propertyXMLTree(subject, stats)\n }\n\n // Sort only on the predicate, leave the order at object\n // level undisturbed. This leaves multilingual content in\n // the order of entry (for partner literals), which helps\n // readability.\n //\n // For the predicate sort, we attempt to split the uri\n // as a hint to the sequence\n sts.sort(function (a, b) {\n var ap = a.predicate.uri\n var bp = b.predicate.uri\n if (ap.substring(0, liPrefix.length) === liPrefix || bp.substring(0, liPrefix.length) === liPrefix) { // we're only interested in sorting list items\n return ap.localeCompare(bp)\n }\n\n var as = ap.substring(liPrefix.length)\n var bs = bp.substring(liPrefix.length)\n var an = parseInt(as, 10)\n var bn = parseInt(bs, 10)\n if (isNaN(an) || isNaN(bn) ||\n an !== as || bn !== bs) { // we only care about integers\n return ap.localeCompare(bp)\n }\n\n return an - bn\n })\n\n for (var i = 0; i < sts.length; i++) {\n st = sts[i]\n // look for a type\n if (st.predicate.uri === 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' && !type && st.object.termType === 'NamedNode') {\n type = st.object\n continue // don't include it as a child element\n }\n\n // see whether predicate can be replaced with \"li\"\n pred = st.predicate\n if (pred.uri.substr(0, liPrefix.length) === liPrefix) {\n var number = pred.uri.substr(liPrefix.length)\n // make sure these are actually numeric list items\n var intNumber = parseInt(number, 10)\n if (number === intNumber.toString()) {\n // was numeric; don't need to worry about ordering since we've already\n // sorted the statements\n pred = this.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#li')\n }\n }\n\n t = qname(pred)\n switch (st.object.termType) {\n case 'BlankNode':\n if (stats.incoming[st.object].length === 1) { // there should always be something in the incoming array for a bnode\n results = results.concat(['<' + t + ' rdf:parseType=\"Resource\">',\n subjectXMLTree(st.object, stats),\n ''])\n } else {\n results = results.concat(['<' + t + ' rdf:nodeID=\"' +\n st.object.toNT().slice(2) + '\"/>'])\n }\n break\n case 'NamedNode':\n results = results.concat(['<' + t + ' rdf:resource=\"' +\n relURI(st.object) + '\"/>'])\n break\n case 'Literal':\n results = results.concat(['<' + t +\n (st.object.datatype.equals(this.xsd.string)\n ? ''\n : ' rdf:datatype=\"' + escapeForXML(st.object.datatype.uri) + '\"') +\n (st.object.language ? ' xml:lang=\"' + st.object.language + '\"' : '') +\n '>' + escapeForXML(st.object.value) +\n ''])\n break\n case 'Collection':\n results = results.concat(['<' + t + ' rdf:parseType=\"Collection\">',\n collectionXMLTree(st.object, stats),\n ''])\n break\n default:\n throw new Error(\"Can't serialize object of type \" + st.object.termType + ' into XML')\n } // switch\n }\n\n var tag = type ? qname(type) : 'rdf:Description'\n\n var attrs = ''\n if (subject.termType === 'BlankNode') {\n if (!stats.incoming[subject] || stats.incoming[subject].length !== 1) { // not an anonymous bnode\n attrs = ' rdf:nodeID=\"' + subject.toNT().slice(2) + '\"'\n }\n } else {\n attrs = ' rdf:about=\"' + relURI(subject) + '\"'\n }\n\n return [ '<' + tag + attrs + '>' ].concat([results]).concat([''])\n }\n\n var subjectXMLTree = subjectXMLTreeMethod.bind(this)\n\n function collectionXMLTree (subject, stats) {\n var res = []\n for (var i = 0; i < subject.elements.length; i++) {\n res.push(subjectXMLTree(subject.elements[i], stats))\n }\n return res\n }\n\n // The property tree for a single subject or anonymos node\n function propertyXMLTreeMethod (subject, stats) {\n var results = []\n var sts = stats.subjects[this.toStr(subject)] // relevant statements\n if (!sts) return results // No relevant statements\n sts.sort()\n for (var i = 0; i < sts.length; i++) {\n var st = sts[i]\n switch (st.object.termType) {\n case 'BlankNode':\n if (stats.rootsHash[st.object.toNT()]) { // This bnode has been done as a root -- no content here @@ what bout first time\n results = results.concat(['<' + qname(st.predicate) + ' rdf:nodeID=\"' + st.object.toNT().slice(2) + '\">',\n ''])\n } else {\n results = results.concat(['<' + qname(st.predicate) + ' rdf:parseType=\"Resource\">',\n propertyXMLTree(st.object, stats),\n ''])\n }\n break\n case 'NamedNode':\n results = results.concat(['<' + qname(st.predicate) + ' rdf:resource=\"' +\n relURI(st.object) + '\"/>'])\n break\n case 'Literal':\n results = results.concat(['<' + qname(st.predicate) +\n (st.object.datatype.equals(this.xsd.string) ? '' : ' rdf:datatype=\"' + escapeForXML(st.object.datatype.value) + '\"') +\n (st.object.language ? ' xml:lang=\"' + st.object.language + '\"' : '') +\n '>' + escapeForXML(st.object.value) +\n ''])\n break\n case 'Collection':\n results = results.concat(['<' + qname(st.predicate) + ' rdf:parseType=\"Collection\">',\n collectionXMLTree(st.object, stats),\n ''])\n break\n default:\n throw new Error(\"Can't serialize object of type \" + st.object.termType + ' into XML')\n } // switch\n }\n return results\n }\n var propertyXMLTree = propertyXMLTreeMethod.bind(this)\n\n function qnameMethod (term) {\n var uri = term.uri\n\n var j = uri.indexOf('#')\n if (j < 0 && this.flags.indexOf('/') < 0) {\n j = uri.lastIndexOf('/')\n }\n if (j < 0) throw new Error('Cannot make qname out of <' + uri + '>')\n\n for (var k = j + 1; k < uri.length; k++) {\n if (this._notNameChars.indexOf(uri[k]) >= 0) {\n throw new Error('Invalid character \"' + uri[k] + '\" cannot be in XML qname for URI: ' + uri)\n }\n }\n var localid = uri.slice(j + 1)\n var namesp = uri.slice(0, j + 1)\n if (this.defaultNamespace && this.defaultNamespace === namesp &&\n this.flags.indexOf('d') < 0) { // d -> suppress default\n return localid\n }\n var prefix = this.prefixes[namesp]\n if (!prefix) prefix = this.makeUpPrefix(namesp)\n namespaceCounts[namesp] = true\n return prefix + ':' + localid\n }\n var qname = qnameMethod.bind(this)\n\n // Body of toXML:\n\n var tree = statementListToXMLTree(sts)\n var str = ''] // @@ namespace declrations\n return XMLtreeToString(tree2, -1)\n } // End @@ body\n\n statementsToJsonld (sts) {\n // ttl2jsonld creates context keys for all ttl prefix\n // context keys must be absolute IRI ttl2jsonld@0.0.8\n /* function findId (itemObj) {\n if (itemObj['@id']) {\n const item = itemObj['@id'].split(':')\n if (keys[item[0]]) itemObj['@id'] = jsonldObj['@context'][item[0]] + item[1]\n }\n const itemValues = Object.values(itemObj)\n for (const i in itemValues) {\n if (typeof itemValues[i] !== 'string') { // @list contains array\n findId(itemValues[i])\n }\n }\n } */\n const turtleDoc = this.statementsToN3(sts)\n const jsonldObj = ttl2jsonld.parse(turtleDoc)\n return JSON.stringify(jsonldObj, null, 2)\n }\n\n}\n\n// String escaping utilities\n\nfunction hexify (str) { // also used in parser\n return encodeURI(str)\n}\n\nfunction backslashUify (str) {\n var res = ''\n var k\n for (var i = 0; i < str.length; i++) {\n k = str.charCodeAt(i)\n if (k > 65535) {\n res += '\\\\U' + ('00000000' + k.toString(16)).slice(-8) // convert to upper?\n } else if (k > 126) {\n res += '\\\\u' + ('0000' + k.toString(16)).slice(-4)\n } else {\n res += str[i]\n }\n }\n return res\n}\n","import Formula from './formula'\nimport Serializer from './serializer'\nimport {\n ContentType,\n JSONLDContentType,\n N3ContentType,\n N3LegacyContentType,\n NQuadsAltContentType,\n NQuadsContentType,\n NTriplesContentType,\n RDFXMLContentType,\n TurtleContentType,\n TurtleLegacyContentType,\n} from './types'\nimport IndexedFormula from './store'\nimport { BlankNode, NamedNode } from './tf-types'\n\n/**\n * Serialize to the appropriate format\n */\nexport default function serialize (\n /** The graph or nodes that should be serialized */\n target: Formula | NamedNode | BlankNode | null,\n /** The store */\n kb: Formula,\n base?: unknown,\n /**\n * The mime type.\n * Defaults to Turtle.\n */\n contentType?: string | ContentType,\n callback?: (err: Error | undefined | null, result?: string) => any,\n options?: {\n /**\n * A string of letters, each of which set an options\n * e.g. `deinprstux`\n */\n flags?: string,\n /**\n * A set of [prefix, uri] pairs that define namespace prefixes\n */\n namespaces?: Record\n }\n): string | undefined {\n base = base || target?.value\n const opts = options || {}\n contentType = contentType || TurtleContentType // text/n3 if complex?\n var documentString: string | undefined = undefined\n try {\n var sz = Serializer(kb)\n if ((opts as any).flags) sz.setFlags((opts as any).flags)\n var newSts = kb!.statementsMatching(undefined, undefined, undefined, target as NamedNode)\n\n // If an IndexedFormula, use the namespaces from the given graph as suggestions\n if ('namespaces' in kb) {\n sz.suggestNamespaces( (kb as IndexedFormula).namespaces);\n }\n\n // use the provided options.namespaces are mandatory prefixes\n if (opts.namespaces) {\n sz.setNamespaces( opts.namespaces);\n }\n\n sz.setBase(base)\n switch (contentType) {\n case RDFXMLContentType:\n documentString = sz.statementsToXML(newSts)\n return executeCallback(null, documentString)\n case N3ContentType:\n case N3LegacyContentType:\n documentString = sz.statementsToN3(newSts)\n return executeCallback(null, documentString)\n case TurtleContentType:\n case TurtleLegacyContentType:\n sz.setFlags('si') // Suppress = for sameAs and => for implies\n documentString = sz.statementsToN3(newSts)\n return executeCallback(null, documentString)\n case NTriplesContentType:\n sz.setFlags('deinprstux') // Suppress nice parts of N3 to make ntriples\n documentString = sz.statementsToNTriples(newSts)\n return executeCallback(null, documentString)\n case JSONLDContentType:\n sz.setFlags('si dr') // turtle + dr (means no default, no relative prefix)\n documentString = sz.statementsToJsonld(newSts) // convert via turtle\n return executeCallback(null, documentString)\n case NQuadsContentType:\n case NQuadsAltContentType: // @@@ just outpout the quads? Does not work for collections\n sz.setFlags('deinprstux q') // Suppress nice parts of N3 to make ntriples\n documentString = sz.statementsToNTriples(newSts) // q in flag means actually quads\n return executeCallback(null, documentString)\n default:\n throw new Error('Serialize: Content-type ' + contentType + ' not supported for data write.')\n }\n } catch (err) {\n if (callback) {\n // @ts-ignore\n return callback(err, undefined)\n }\n throw err // Don't hide problems from caller in sync mode\n }\n\n function executeCallback (err: Error | null | undefined, result: string | undefined): string | undefined {\n if (callback) {\n callback(err, result)\n return\n } else {\n return result as string\n }\n }\n}\n","import Fetcher from './fetcher'\nimport log from './log'\nimport { docpart } from './uri'\nimport { string_startswith } from './utils-js'\nimport { RdfJsDataFactory, Quad, Quad_Subject, Term } from './tf-types'\n\n/** RDF/JS spec Typeguards */\n\n/**\n * Loads ontologies of the data we load (this is the callback from the kb to\n * the fetcher).\n */\nexport function AJAR_handleNewTerm (kb: { fetcher: Fetcher }, p, requestedBy) {\n var sf: Fetcher | null = null\n if (typeof kb.fetcher !== 'undefined') {\n sf = kb.fetcher\n } else {\n return\n }\n if (p.termType !== 'NamedNode') return\n var docuri = docpart(p.uri)\n var fixuri\n if (p.uri.indexOf('#') < 0) { // No hash\n // @@ major hack for dbpedia Categories, which spread indefinitely\n if (string_startswith(p.uri, 'http://dbpedia.org/resource/Category:')) return\n\n /*\n if (string_startswith(p.uri, 'http://xmlns.com/foaf/0.1/')) {\n fixuri = \"http://dig.csail.mit.edu/2005/ajar/ajaw/test/foaf\"\n // should give HTTP 303 to ontology -- now is :-)\n } else\n */\n if (string_startswith(p.uri,\n 'http://purl.org/dc/elements/1.1/') ||\n string_startswith(p.uri, 'http://purl.org/dc/terms/')) {\n fixuri = 'http://dublincore.org/2005/06/13/dcq'\n // dc fetched multiple times\n } else if (string_startswith(p.uri, 'http://xmlns.com/wot/0.1/')) {\n fixuri = 'http://xmlns.com/wot/0.1/index.rdf'\n } else if (string_startswith(p.uri, 'http://web.resource.org/cc/')) {\n // log.warn(\"creative commons links to html instead of rdf. doesn't seem to content-negotiate.\")\n fixuri = 'http://web.resource.org/cc/schema.rdf'\n }\n }\n if (fixuri) {\n docuri = fixuri\n }\n if (sf && (sf as Fetcher).getState(docuri) !== 'unrequested') return\n\n if (fixuri) { // only give warning once: else happens too often\n log.warn('Assuming server still broken, faking redirect of <' + p.uri +\n '> to <' + docuri + '>')\n }\n\n return (sf as any).fetch(docuri, { referringTerm: requestedBy })\n}\n\nexport const appliedFactoryMethods = [\n 'blankNode',\n 'defaultGraph',\n 'literal',\n 'namedNode',\n 'quad',\n 'variable',\n 'supports',\n]\n\nconst rdf = {\n first: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first',\n rest: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest',\n nil: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'\n}\n\n/**\n * Expands an array of Terms to a set of statements representing the rdf:list.\n * @param rdfFactory - The factory to use\n * @param subject - The iri of the first list item.\n * @param data - The terms to expand into the list.\n * @return The {data} as a set of statements.\n */\nexport function arrayToStatements(\n rdfFactory: RdfJsDataFactory,\n subject: Quad_Subject,\n data: Term[]\n): Quad[] {\n const statements: Quad[] = []\n\n data.reduce((id, _listObj, i, listData) => {\n statements.push(rdfFactory.quad(id, rdfFactory.namedNode(rdf.first), listData[i]))\n\n let nextNode\n if (i < listData.length - 1) {\n nextNode = rdfFactory.blankNode()\n statements.push(rdfFactory.quad(id, rdfFactory.namedNode(rdf.rest), nextNode))\n } else {\n statements.push(rdfFactory.quad(id, rdfFactory.namedNode(rdf.rest), rdfFactory.namedNode(rdf.nil)))\n }\n\n return nextNode\n }, subject)\n\n return statements\n}\n\nexport function ArrayIndexOf (arr, item, i: number = 0) {\n var length = arr.length\n if (i < 0) i = length + i\n for (; i < length; i++) {\n if (arr[i] === item) {\n return i\n }\n }\n return -1\n}\n","import ClassOrder from './class-order'\nimport Collection from './collection'\nimport CanonicalDataFactory from './factories/canonical-data-factory'\nimport log from './log'\nimport RDFlibNamedNode from './named-node'\nimport Namespace from './namespace'\nimport Node from './node-internal'\nimport serialize from './serialize'\nimport Statement from './statement'\nimport {\n Bindings,\n GraphTermType,\n} from './types'\nimport { isStatement } from './utils/terms'\nimport Variable from './variable'\nimport {\n Indexable,\n TFIDFactoryTypes,\n} from './factories/factory-types'\nimport { appliedFactoryMethods, arrayToStatements } from './utils'\nimport {\n RdfJsDataFactory,\n Quad_Graph,\n Quad_Object,\n Quad_Predicate,\n Quad,\n Quad_Subject,\n Term,\n} from './tf-types'\nimport Fetcher from './fetcher'\nimport BlankNode from './blank-node'\nimport NamedNode from './named-node'\n\nexport interface FormulaOpts {\n dataCallback?: (q: Quad) => void\n rdfArrayRemove?: (arr: Quad[], q: Quad) => void\n rdfFactory?: RdfJsDataFactory\n}\n\ninterface BooleanMap {\n [uri: string]: boolean;\n}\n\ninterface MembersMap {\n [uri: string]: Quad;\n}\n\ninterface UriMap {\n [uri: string]: string;\n}\n\n/**\n * A formula, or store of RDF statements\n */\nexport default class Formula extends Node {\n termType: typeof GraphTermType = GraphTermType\n\n classOrder = ClassOrder.Graph\n\n /**\n * The accompanying fetcher instance.\n *\n * Is set by the fetcher when initialized.\n */\n fetcher?: Fetcher\n\n isVar = 0\n\n /**\n * A namespace for the specified namespace's URI\n * @param nsuri The URI for the namespace\n */\n ns = Namespace\n\n /** The factory used to generate statements and terms */\n rdfFactory: any\n\n /**\n * Initializes this formula\n * @constructor\n * @param statements - Initial array of statements\n * @param constraints - initial array of constraints\n * @param initBindings - initial bindings used in Query\n * @param optional - optional\n * @param opts\n * @param opts.rdfFactory - The rdf factory that should be used by the store\n*/\n constructor (\n public statements: Array = [],\n public constraints: ReadonlyArray = [],\n public initBindings: ReadonlyArray = [],\n public optional: ReadonlyArray = [],\n opts: FormulaOpts = {}\n ) {\n super('')\n\n this.rdfFactory = (opts && opts.rdfFactory) || CanonicalDataFactory\n // Enable default factory methods on this while preserving factory context.\n for(const factoryMethod of appliedFactoryMethods) {\n this[factoryMethod] = (...args) => this.rdfFactory[factoryMethod](...args)\n }\n }\n\n /** Add a statement from its parts\n * @param subject - the first part of the statement\n * @param predicate - the second part of the statement\n * @param object - the third part of the statement\n * @param graph - the last part of the statement\n */\n add (\n subject: Quad_Subject | Quad | Quad[],\n predicate?: Quad_Predicate,\n object?: Term | string,\n graph?: Quad_Graph\n ): Statement | null | this | number {\n if (arguments.length === 1) {\n (subject as Quad[]).forEach(st => this.add(st.subject, st.predicate, st.object, st.graph))\n }\n return this.statements.push(this.rdfFactory.quad(subject, predicate, object, graph))\n }\n\n /** Add a statment object\n * @param {Statement} statement - An existing constructed statement to add\n */\n addStatement (statement: Quad): Statement | null | this | number {\n return this.add(statement)\n }\n\n /**\n * Shortcut for adding blankNodes\n * @param [id]\n */\n bnode (id?: string): BlankNode {\n return this.rdfFactory.blankNode(id)\n }\n\n /**\n * Adds all the statements to this formula\n * @param statements - A collection of statements\n */\n addAll (statements: Quad[]): void {\n statements.forEach(quad => {\n this.add(quad.subject, quad.predicate, quad.object, quad.graph)\n })\n }\n\n /** Follow link from one node, using one wildcard, looking for one\n *\n * For example, any(me, knows, null, profile) - a person I know accoring to my profile .\n * any(me, knows, null, null) - a person I know accoring to anything in store .\n * any(null, knows, me, null) - a person who know me accoring to anything in store .\n *\n * @param s - A node to search for as subject, or if null, a wildcard\n * @param p - A node to search for as predicate, or if null, a wildcard\n * @param o - A node to search for as object, or if null, a wildcard\n * @param g - A node to search for as graph, or if null, a wildcard\n * @returns A node which match the wildcard position, or null\n */\n any(\n s?: Quad_Subject | null,\n p?: Quad_Predicate | null,\n o?: Quad_Object | null,\n g?: Quad_Graph | null\n ): Node | null {\n const st = this.anyStatementMatching(s, p, o, g)\n if (st == null) {\n return null\n } else if (s == null) {\n return st.subject\n } else if (p == null) {\n return st.predicate\n } else if (o == null) {\n return st.object\n }\n\n return null\n }\n\n /**\n * Gets the value of a node that matches the specified pattern\n * @param s The subject\n * @param p The predicate\n * @param o The object\n * @param g The graph that contains the statement\n */\n anyValue(\n s?: Quad_Subject | null,\n p?: Quad_Predicate | null,\n o?: Quad_Object | null,\n g?: Quad_Graph | null\n ): string | void {\n const y = this.any(s, p, o, g)\n return y ? y.value : void 0\n }\n\n /**\n * Gets the first JavaScript object equivalent to a node based on the specified pattern\n * @param s The subject\n * @param p The predicate\n * @param o The object\n * @param g The graph that contains the statement\n */\n anyJS(\n s?: Quad_Subject | null,\n p?: Quad_Predicate | null,\n o?: Quad_Object | null,\n g?: Quad_Graph | null\n ): any {\n const y = this.any(s, p, o, g)\n return y ? Node.toJS(y) : void 0\n }\n\n /**\n * Gets the first statement that matches the specified pattern\n */\n anyStatementMatching(\n s?: Quad_Subject | null,\n p?: Quad_Predicate | null,\n o?: Quad_Object | null,\n g?: Quad_Graph | null\n ): Statement | undefined {\n let x = this.statementsMatching(s, p, o, g, true)\n if (!x || x.length === 0) {\n return undefined\n }\n\n return x[0]\n }\n\n /**\n * Returns a unique index-safe identifier for the given term.\n *\n * Falls back to the rdflib hashString implementation if the given factory doesn't support id.\n */\n id (term: TFIDFactoryTypes): Indexable {\n return this.rdfFactory.id(term)\n }\n\n /**\n * Search the Store\n * This is really a teaching method as to do this properly you would use IndexedFormula\n *\n * @param s - A node to search for as subject, or if null, a wildcard\n * @param p - A node to search for as predicate, or if null, a wildcard\n * @param o - A node to search for as object, or if null, a wildcard\n * @param g - A node to search for as graph, or if null, a wildcard\n * @param justOne - flag - stop when found one rather than get all of them?\n * @returns {Array} - An array of nodes which match the wildcard position\n */\n statementsMatching(\n s?: Quad_Subject | null,\n p?: Quad_Predicate | null,\n o?: Quad_Object | null,\n g?: Quad_Graph | null,\n justOne?: boolean\n ): Statement[] {\n const sts = this.statements.filter(st =>\n (!s || s.equals(st.subject)) &&\n (!p || p.equals(st.predicate)) &&\n (!o || o.equals(st.object)) &&\n (!g || g.equals(st.graph))\n )\n\n if (justOne) {\n return sts.length === 0 ? [] : [sts[0]]\n }\n\n return sts\n }\n\n /**\n * Finds the types in the list which have no *stored* subtypes\n * These are a set of classes which provide by themselves complete\n * information -- the other classes are redundant for those who\n * know the class DAG.\n * @param types A map of the types\n */\n bottomTypeURIs (types) {\n let bots\n let bottom\n let elt\n let i\n let len\n let ref\n let subs\n let v\n bots = []\n for (let k in types) {\n if (!types.hasOwnProperty(k)) continue\n v = types[k]\n subs = this.each(\n void 0,\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf'),\n this.rdfFactory.namedNode(k)\n )\n bottom = true\n i = 0\n for (len = subs.length; i < len; i++) {\n elt = subs[i]\n ref = elt.uri\n if (ref in types) { // the subclass is one we know\n bottom = false\n break\n }\n }\n if (bottom) {\n bots[k] = v\n }\n }\n return bots\n }\n\n /** Creates a new collection */\n collection (): Collection {\n return new Collection()\n }\n\n /** Follow links from one node, using one wildcard.\n *\n * For example, each(me, knows, null, profile) - people I know accoring to my profile .\n * each(me, knows, null, null) - people I know accoring to anything in store .\n * each(null, knows, me, null) - people who know me accoring to anything in store .\n *\n * @param s - A node to search for as subject, or if null, a wildcard\n * @param p - A node to search for as predicate, or if null, a wildcard\n * @param o - A node to search for as object, or if null, a wildcard\n * @param g - A node to search for as graph, or if null, a wildcard\n * @returns {Array} - An array of nodes which match the wildcard position\n */\n each(\n s?: Quad_Subject | null,\n p?: Quad_Predicate | null,\n o?: Quad_Object | null,\n g?: Quad_Graph | null\n ): Node[] {\n const results: Node[] = []\n let sts = this.statementsMatching(s, p, o, g, false)\n if (s == null) {\n for (let i = 0, len = sts.length; i < len; i++) {\n results.push(sts[i].subject)\n }\n } else if (p == null) {\n for (let l = 0, len1 = sts.length; l < len1; l++) {\n results.push(sts[l].predicate)\n }\n } else if (o == null) {\n for (let m = 0, len2 = sts.length; m < len2; m++) {\n results.push(sts[m].object)\n }\n } else if (g == null) {\n for (let q = 0, len3 = sts.length; q < len3; q++) {\n results.push(new NamedNode(sts[q].graph.value))\n }\n }\n\n return results\n }\n\n /**\n * Test whether this formula is equals to {other}\n * @param other - The other formula\n */\n equals(other: Formula): boolean {\n if (!other) {\n return false\n }\n return this.hashString() === other.hashString()\n }\n\n /**\n * For thisClass or any subclass, anything which has it is its type\n * or is the object of something which has the type as its range, or subject\n * of something which has the type as its domain\n * We don't bother doing subproperty (yet?)as it doesn't seeem to be used\n * much.\n * Get all the Classes of which we can RDFS-infer the subject is a member\n * @return a hash of URIs\n */\n findMembersNT (thisClass) {\n let len2: number\n let len4: number\n let m: number\n let members: MembersMap\n let pred: Quad_Predicate\n let ref\n let ref1: Quad[]\n let ref2: Term[]\n let ref3: Quad[]\n let ref4: Term[]\n let ref5: Quad[]\n let seeds\n let st\n let u: number\n seeds = {}\n seeds[thisClass.toNT()] = true\n members = {}\n ref = this.transitiveClosure(seeds, this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf'), true)\n for (let t in ref) {\n if (!ref.hasOwnProperty(t)) continue\n ref1 = this.statementsMatching(void 0,\n this.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),\n this.fromNT(t))\n for (let i = 0, len = ref1.length; i < len; i++) {\n st = ref1[i]\n members[st.subject.toNT()] = st\n }\n ref2 = this.each(void 0,\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#domain'),\n this.fromNT(t))\n for (let l = 0, len1 = ref2.length; l < len1; l++) {\n pred = ref2[l] as Quad_Predicate\n ref3 = this.statementsMatching(void 0, pred)\n for (m = 0, len2 = ref3.length; m < len2; m++) {\n st = ref3[m]\n members[st.subject.toNT()] = st\n }\n }\n ref4 = this.each(void 0,\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#range'),\n this.fromNT(t))\n for (let q = 0, len3 = ref4.length; q < len3; q++) {\n pred = ref4[q] as Quad_Predicate\n ref5 = this.statementsMatching(void 0, pred)\n for (u = 0, len4 = ref5.length; u < len4; u++) {\n st = ref5[u]\n members[st.object.toNT()] = st\n }\n }\n }\n\n return members\n }\n\n /**\n * For thisClass or any subclass, anything which has it is its type\n * or is the object of something which has the type as its range, or subject\n * of something which has the type as its domain\n * We don't bother doing subproperty (yet?)as it doesn't seeem to be used\n * much.\n * Get all the Classes of which we can RDFS-infer the subject is a member\n * @param subject - A named node\n */\n findMemberURIs(subject: Node): UriMap {\n return this.NTtoURI(this.findMembersNT(subject))\n }\n\n /**\n * Get all the Classes of which we can RDFS-infer the subject is a superclass\n * Returns a hash table where key is NT of type and value is statement why we\n * think so.\n * Does NOT return terms, returns URI strings.\n * We use NT representations in this version because they handle blank nodes.\n */\n findSubClassesNT(subject: Node): { [uri: string]: boolean } {\n let types = {}\n types[subject.toNT()] = true\n return this.transitiveClosure(\n types,\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf'),\n true\n )\n }\n\n /**\n * Get all the Classes of which we can RDFS-infer the subject is a subclass\n * @param {RDFlibNamedNode} subject - The thing whose classes are to be found\n * @returns a hash table where key is NT of type and value is statement why we\n * think so.\n * Does NOT return terms, returns URI strings.\n * We use NT representations in this version because they handle blank nodes.\n */\n findSuperClassesNT(subject: Node): { [uri: string]: boolean } {\n let types = {}\n types[subject.toNT()] = true\n return this.transitiveClosure(types,\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf'), false)\n }\n\n /**\n * Get all the Classes of which we can RDFS-infer the subject is a member\n * todo: This will loop is there is a class subclass loop (Sublass loops are\n * not illegal)\n * @param {RDFlibNamedNode} subject - The thing whose classes are to be found\n * @returns a hash table where key is NT of type and value is statement why we think so.\n * Does NOT return terms, returns URI strings.\n * We use NT representations in this version because they handle blank nodes.\n */\n findTypesNT (subject) {\n let domain\n let range\n let rdftype\n let ref\n let ref1\n let ref2\n let ref3\n let st\n let types\n rdftype = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'\n types = []\n ref = this.statementsMatching(subject, void 0, void 0)\n for (let i = 0, len = ref.length; i < len; i++) {\n st = ref[i]\n if (st.predicate.uri === rdftype) {\n types[st.object.toNT()] = st\n } else {\n ref1 = this.each(\n st.predicate,\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#domain')\n )\n for (let l = 0, len1 = ref1.length; l < len1; l++) {\n range = ref1[l]\n types[range.toNT()] = st\n }\n }\n }\n ref2 = this.statementsMatching(void 0, void 0, subject)\n for (let m = 0, len2 = ref2.length; m < len2; m++) {\n st = ref2[m]\n ref3 = this.each(\n st.predicate,\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#range')\n )\n for (let q = 0, len3 = ref3.length; q < len3; q++) {\n domain = ref3[q]\n types[domain.toNT()] = st\n }\n }\n return this.transitiveClosure(\n types,\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf'),\n false\n )\n }\n\n /**\n * Get all the Classes of which we can RDFS-infer the subject is a member\n * todo: This will loop is there is a class subclass loop (Sublass loops are\n * not illegal)\n * Returns a hash table where key is NT of type and value is statement why we\n * think so.\n * Does NOT return terms, returns URI strings.\n * We use NT representations in this version because they handle blank nodes.\n * @param subject - A subject node\n */\n findTypeURIs(subject: Quad_Subject): UriMap {\n return this.NTtoURI(this.findTypesNT(subject))\n }\n\n /** Trace statements which connect directly, or through bnodes\n *\n * @param subject - The node to start looking for statments\n * @param doc - The document to be searched, or null to search all documents\n * @returns an array of statements, duplicate statements are suppresssed.\n */\n connectedStatements(\n subject: Quad_Subject,\n doc: Quad_Graph,\n excludePredicateURIs?: ReadonlyArray\n ): Statement[] {\n excludePredicateURIs = excludePredicateURIs || []\n let todo = [subject]\n let done: { [k: string]: boolean } = {}\n let doneArcs: { [k: string]: boolean } = {}\n let result: Statement[] = []\n let self = this\n let follow = function (x) {\n let queue = function (x) {\n if (x.termType === 'BlankNode' && !done[x.value]) {\n done[x.value] = true\n todo.push(x)\n }\n }\n let sts = self.statementsMatching(null, null, x, doc)\n .concat(self.statementsMatching(x, null, null, doc))\n sts = sts.filter(function (st): boolean {\n if (excludePredicateURIs![st.predicate.value]) return false\n let hash = (st as Statement).toNT()\n if (doneArcs[hash]) return false\n doneArcs[hash] = true\n return true\n }\n )\n sts.forEach(function (st) {\n queue(st.subject)\n queue(st.object)\n })\n result = result.concat(sts)\n }\n while (todo.length) {\n follow(todo.shift())\n }\n return result\n }\n\n /**\n * Creates a new empty formula\n *\n * @param _features - Not applicable, but necessary for typing to pass\n */\n formula(_features?: ReadonlyArray): Formula {\n return new Formula()\n }\n\n /**\n * Transforms an NTriples string format into a Node.\n * The blank node bit should not be used on program-external values; designed\n * for internal work such as storing a blank node id in an HTML attribute.\n * This will only parse the strings generated by the various toNT() methods.\n */\n fromNT (str) {\n let dt, k, lang\n switch (str[0]) {\n case '<':\n return this.sym(str.slice(1, -1))\n case '\"':\n lang = void 0\n dt = void 0\n k = str.lastIndexOf('\"')\n if (k < str.length - 1) {\n if (str[k + 1] === '@') {\n lang = str.slice(k + 2)\n } else if (str.slice(k + 1, k + 3) === '^^') {\n dt = this.fromNT(str.slice(k + 3))\n } else {\n throw new Error(\"Can't convert string from NT: \" + str)\n }\n }\n str = str.slice(1, k)\n str = str.replace(/\\\\\"/g, '\"')\n str = str.replace(/\\\\n/g, '\\n')\n str = str.replace(/\\\\\\\\/g, '\\\\')\n return this.rdfFactory.literal(str, lang || dt)\n case '_':\n return this.rdfFactory.blankNode(str.slice(2))\n case '?':\n return new Variable(str.slice(1))\n }\n throw new Error(\"Can't convert from NT: \" + str)\n }\n\n /** Returns true if this formula holds the specified statement(s) */\n holds (s: any | any[], p?, o?, g?): boolean {\n let i\n if (arguments.length === 1) {\n if (!s) {\n return true\n }\n if (s instanceof Array) {\n for (i = 0; i < s.length; i++) {\n if (!this.holds(s[i])) {\n return false\n }\n }\n return true\n } else if (isStatement(s)) {\n return this.holds(s.subject, s.predicate, s.object, s.graph)\n } else if (s.statements) {\n return this.holds(s.statements)\n }\n }\n\n let st = this.anyStatementMatching(s, p, o, g)\n return st != null\n }\n\n /**\n * Returns true if this formula holds the specified {statement}\n */\n holdsStatement (statement) {\n return this.holds(\n statement.subject,\n statement.predicate,\n statement.object,\n statement.graph,\n )\n }\n\n /**\n * Used by the n3parser to generate list elements\n * @param values - The values of the collection\n * @param context - The store\n * @return {BlankNode|Collection} - The term for the statement\n */\n list (values, context) {\n if (context.rdfFactory.supports[\"COLLECTIONS\"]) {\n const collection = context.rdfFactory.collection()\n values.forEach(function (val) {\n collection.append(val)\n })\n return collection\n } else {\n const node = context.rdfFactory.blankNode()\n const statements = arrayToStatements(context.rdfFactory, node, values)\n context.addAll(statements)\n return node\n }\n }\n\n /**\n * Transform a collection of NTriple URIs into their URI strings\n * @param t - Some iterable collection of NTriple URI strings\n * @return A collection of the URIs as strings\n * todo: explain why it is important to go through NT\n */\n NTtoURI (t) {\n let k, v\n let uris = {}\n for (k in t) {\n if (!t.hasOwnProperty(k)) continue\n v = t[k]\n if (k[0] === '<') {\n uris[k.slice(1, -1)] = v\n }\n }\n return uris\n }\n\n /**\n * Serializes this formula\n * @param base - The base string\n * @param contentType - The content type of the syntax to use\n * @param provenance - The provenance URI\n * @param options - options to pass to the serializer, as defined in serialize method\n */\n serialize (base, contentType, provenance, options?) {\n // delegate the graph serialization to the implementation in ./serialize\n return serialize(provenance, this, base, contentType, undefined, options);\n }\n\n /**\n * Creates a new formula with the substituting bindings applied\n * @param bindings - The bindings to substitute\n */\n substitute(bindings: Bindings): T {\n let statementsCopy = this.statements.map(function (ea) {\n return (ea as Statement).substitute(bindings)\n })\n // console.log('Formula subs statmnts:' + statementsCopy)\n const y = new Formula()\n y.addAll(statementsCopy as Quad[])\n // console.log('indexed-form subs formula:' + y)\n return y as unknown as T\n }\n\n sym (uri: string, name?): NamedNode {\n if (name) {\n throw new Error('This feature (kb.sym with 2 args) is removed. Do not assume prefix mappings.')\n }\n return this.rdfFactory.namedNode(uri)\n }\n\n /**\n * Gets the node matching the specified pattern. Throws when no match could be made.\n * @param s - The subject\n * @param p - The predicate\n * @param o - The object\n * @param g - The graph that contains the statement\n */\n the (\n s?: Quad_Subject | null,\n p?: Quad_Predicate | null,\n o?: Quad_Object | null,\n g?: Quad_Graph | null\n ): Node | null | undefined {\n let x = this.any(s, p, o, g)\n if (x == null) {\n log.error('No value found for the() {' + s + ' ' + p + ' ' + o + '}.')\n }\n\n return x\n }\n\n /**\n * RDFS Inference\n * These are hand-written implementations of a backward-chaining reasoner\n * over the RDFS axioms.\n * @param seeds - A hash of NTs of classes to start with\n * @param predicate - The property to trace though\n * @param inverse - Trace inverse direction\n */\n transitiveClosure(\n seeds: BooleanMap,\n predicate: Quad_Predicate,\n inverse?: boolean\n ): {\n [uri: string]: boolean;\n } {\n let elt, i, len, s, sups, t\n let agenda = {}\n Object.assign(agenda, seeds) // make a copy\n let done = {} // classes we have looked up\n while (true) {\n t = (function () {\n for (let p in agenda) {\n if (!agenda.hasOwnProperty(p)) continue\n return p\n }\n })()\n if (t == null) {\n return done\n }\n sups = inverse ?\n this.each(void 0, predicate, this.fromNT(t))\n : this.each(this.fromNT(t) as Quad_Predicate, predicate)\n for (i = 0, len = sups.length; i < len; i++) {\n elt = sups[i]\n s = elt.toNT()\n if (s in done) {\n continue\n }\n if (s in agenda) {\n continue\n }\n agenda[s] = agenda[t]\n }\n done[t] = agenda[t]\n delete agenda[t]\n }\n }\n\n /**\n * Finds the types in the list which have no *stored* supertypes\n * We exclude the universal class, owl:Things and rdf:Resource, as it is\n * information-free.\n * @param types - The types\n */\n topTypeURIs(types: {\n [id: string]: string | RDFlibNamedNode;\n }): {\n [id: string]: string | RDFlibNamedNode;\n } {\n let i\n let j\n let k\n let len\n let n\n let ref\n let tops\n let v\n tops = []\n for (k in types) {\n if (!types.hasOwnProperty(k)) continue\n v = types[k]\n n = 0\n ref = this.each(\n this.rdfFactory.namedNode(k),\n this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf')\n )\n for (i = 0, len = ref.length; i < len; i++) {\n j = ref[i]\n if (j.uri !== 'http://www.w3.org/2000/01/rdf-schema#Resource') {\n n++\n break\n }\n }\n if (!n) {\n tops[k] = v\n }\n }\n if (tops['http://www.w3.org/2000/01/rdf-schema#Resource']) {\n delete tops['http://www.w3.org/2000/01/rdf-schema#Resource']\n }\n if (tops['http://www.w3.org/2002/07/owl#Thing']) {\n delete tops['http://www.w3.org/2002/07/owl#Thing']\n }\n return tops\n }\n\n /**\n * Serializes this formula to a string\n */\n toString(): string {\n return '{' + this.statements.join('\\n') + '}'\n }\n\n /**\n * Gets a new variable\n * @param name - The variable's name\n */\n public variable(name: string): Variable {\n return new Variable(name)\n }\n\n /**\n * Gets the number of statements in this formula that matches the specified pattern\n * @param s - The subject\n * @param p - The predicate\n * @param o - The object\n * @param g - The graph that contains the statement\n */\n whether(\n s?: Quad_Subject | null,\n p?: Quad_Predicate | null,\n o?: Quad_Object | null,\n g?: Quad_Graph | null\n ): number {\n return this.statementsMatching(s, p, o, g, false).length\n }\n}\n","// This file attaches all functionality to Node\n// that would otherwise require circular dependencies.\nimport { fromValue } from './collection'\nimport Node from './node-internal'\nimport Namespace from './namespace'\nimport { isCollection, isLiteral } from './utils/terms'\nimport { Term } from './tf-types'\n\n/**\n * Creates an RDF Node from a native javascript value.\n * RDF Nodes are returned unchanged, undefined returned as itself.\n * @method fromValue\n * @static\n * @param value {Node|Date|String|Number|Boolean|Undefined}\n * @return {Node|Collection}\n */\nNode.fromValue = fromValue;\n\nexport default Node\n\nconst ns = { xsd: Namespace('http://www.w3.org/2001/XMLSchema#') }\n\n/**\n * Gets the javascript object equivalent to a node\n * @param term The RDF node\n */\nNode.toJS = function (term: Term): Term | boolean | number | Date | string | any[] {\n if (isCollection(term)) {\n return term.elements.map(Node.toJS) // Array node (not standard RDFJS)\n }\n if (!isLiteral(term)) return term\n if (term.datatype.equals(ns.xsd('boolean'))) {\n return term.value === '1' || term.value === 'true'\n }\n if (term.datatype.equals(ns.xsd('dateTime')) ||\n term.datatype.equals(ns.xsd('date'))) {\n return new Date(term.value)\n }\n if (\n term.datatype.equals(ns.xsd('integer')) ||\n term.datatype.equals(ns.xsd('float')) ||\n term.datatype.equals(ns.xsd('decimal'))\n ) {\n return Number(term.value)\n }\n return term.value\n}\n","// Matching a formula against another formula\n// Assync as well as Synchronously\n//\n// W3C open source licence 2005.\n//\n// This builds on term.js, match.js (and identity.js?)\n// to allow a query of a formula.\n//\n// Here we introduce for the first time a subclass of term: variable.\n//\n// SVN ID: $Id: query.js 25116 2008-11-15 16:13:48Z timbl $\n\n// Variable\n//\n// Compare with BlankNode. They are similar, but a variable\n// stands for something whose value is to be returned.\n// Also, users name variables and want the same name back when stuff is printed\n/* jsl:option explicit */ // Turn on JavaScriptLint variable declaration checking\n\nimport IndexedFormula from './store'\nimport { defaultGraphURI as defaultDocumentURI } from './utils/default-graph-uri'\nimport log from './log'\nimport { docpart } from './uri'\n\n/**\n * Query class, for tracking queries the user has in the UI.\n */\nexport class Query {\n constructor (name, id) {\n this.pat = new IndexedFormula() // The pattern to search for\n this.vars = [] // Used by UI code but not in query.js\n // this.orderBy = [] // Not used yet\n this.name = name\n this.id = id\n }\n}\n\n/**\n * This function will match a pattern to the current Store\n *\n * The callback function is called whenever a match is found\n * When fetcher is supplied this will be called to load from the web\n * any new nodes as they are discovered. This will cause the query to traverse the\n * graph of linked data, sometimes called \"Link Following Query\"\n *\n * @param myQuery - a knowledgebase containing a pattern to use as query\n * @param callback - whenever the pattern in myQuery is met this is called with\n * the new bindings as parameter\n * @param fetcher? - If and only if, you want link following, give a fetcher\n * which has been created for the quadstore being queried.\n * @param onDone - callback when query finished\n */\nexport function indexedFormulaQuery (myQuery, callback, fetcher, onDone) {\n /** Debug strings\n */\n function bindingDebug (b) {\n var str = ''\n var v\n for (v in b) {\n if (b.hasOwnProperty(v)) {\n str += ' ' + v + ' -> ' + b[v]\n }\n }\n return str\n }\n\n function bindingsDebug (nbs) {\n var str = 'Bindings: '\n var i\n var n = nbs.length\n for (i = 0; i < n; i++) {\n str += bindingDebug(nbs[i][0]) + ';\\n\\t'\n }\n return str\n } // bindingsDebug\n\n /** Unification\n *\n * Unification finds all bindings such that when the binding is applied\n * to one term it is equal to the other.\n * @returns {Arrray}- a list of bindings, where a binding is an associative array\n * mapping variuable to value.\n */\n function unifyTerm (self, other, bindings, formula) {\n var actual = bindings[self]\n if (actual === undefined) { // Not mapped\n if (self.isVar) {\n var b = []\n b[self] = other\n return [[ b, null ]] // Match\n }\n actual = self\n }\n if (!actual.complexType) {\n if (formula.redirections[actual]) {\n actual = formula.redirections[actual]\n }\n if (formula.redirections[other]) {\n other = formula.redirections[other]\n }\n if (actual.equals(other) || (actual.uri && actual.uri === defaultDocumentURI)) { // Used to mean 'any graph' in a query\n return [[ [], null ]]\n }\n return []\n }\n if (self instanceof Array) {\n if (!(other instanceof Array)) {\n return []\n }\n return unifyContents(self, other, bindings)\n }\n throw new Error('query.js: oops - code not written yet')\n // return undefined; // for lint - no jslint objects to unreachables\n // return actual.unifyContents(other, bindings)\n } // unifyTerm\n\n function unifyContents (self, other, bindings, formula) {\n var nbs2\n if (self.length !== other.length) {\n return [] // no way\n }\n if (!self.length) {\n return [[ [], null ]] // Success\n }\n var nbs = unifyTerm(self[0], other[0], bindings, formula)\n if (nbs.length === 0) {\n return nbs\n }\n var res = []\n var i\n var n = nbs.length\n var nb\n var j\n var m\n var v\n var nb2\n var bindings2\n for (i = 0; i < n; i++) { // for each possibility from the first term\n nb = nbs[i][0] // new bindings\n bindings2 = []\n for (v in nb) {\n if (nb.hasOwnProperty(v)) {\n bindings2[v] = nb[v] // copy\n }\n }\n for (v in bindings) {\n if (bindings.hasOwnProperty(v)) {\n bindings2[v] = bindings[v] // copy\n }\n }\n nbs2 = unifyContents(self.slice(1), other.slice(1), bindings2, formula)\n m = nbs2.length\n for (j = 0; j < m; j++) {\n nb2 = nbs2[j][0] // @@@@ no idea whether this is used or right\n for (v in nb) {\n if (nb.hasOwnProperty(v)) {\n nb2[v] = nb[v]\n }\n }\n res.push([nb2, null])\n }\n }\n return res\n } // unifyContents\n\n // Matching\n //\n // Matching finds all bindings such that when the binding is applied\n // to one term it is equal to the other term. We only match formulae.\n\n /** if x is not in the bindings array, return the var; otherwise, return the bindings **/\n function bind (x, binding) {\n var y = binding[x]\n if (y === undefined) {\n return x\n }\n return y\n }\n\n // When there are OPTIONAL clauses, we must return bindings without them if none of them\n // succeed. However, if any of them do succeed, we should not. (This is what branchCount()\n // tracked. The problem currently is (2011/7) that when several optionals exist, and they\n // all match, multiple sets of bindings are returned, each with one optional filled in.)\n\n function union (a, b) {\n var c = {}\n var x\n for (x in a) {\n if (a.hasOwnProperty(x)) {\n c[x] = a[x]\n }\n }\n for (x in b) {\n if (b.hasOwnProperty(x)) {\n c[x] = b[x]\n }\n }\n return c\n }\n\n function OptionalBranchJunction (originalCallback, trunkBindings) {\n this.trunkBindings = trunkBindings\n this.originalCallback = originalCallback\n this.branches = []\n // this.results = []; // result[i] is an array of bindings for branch i\n // this.done = {}; // done[i] means all/any results are in for branch i\n // this.count = {}\n return this\n }\n\n OptionalBranchJunction.prototype.checkAllDone = function () {\n var i\n for (i = 0; i < this.branches.length; i++) {\n if (!this.branches[i].done) {\n return\n }\n }\n log.debug('OPTIONAL BIDNINGS ALL DONE:')\n this.doCallBacks(this.branches.length - 1, this.trunkBindings)\n }\n // Recrursively generate the cross product of the bindings\n OptionalBranchJunction.prototype.doCallBacks = function (b, bindings) {\n var j\n if (b < 0) {\n return this.originalCallback(bindings)\n }\n for (j = 0; j < this.branches[b].results.length; j++) {\n this.doCallBacks(b - 1, union(bindings, this.branches[b].results[j]))\n }\n }\n\n // A mandatory branch is the normal one, where callbacks\n // are made immediately and no junction is needed.\n // Might be useful for onFinsihed callback for query API.\n function MandatoryBranch (callback, onDone) {\n this.count = 0\n this.success = false\n this.done = false\n // this.results = []\n this.callback = callback\n this.onDone = onDone\n // this.junction = junction\n // junction.branches.push(this)\n return this\n }\n\n MandatoryBranch.prototype.reportMatch = function (bindings) {\n // log.error(\"@@@@ query.js 1\"); // @@\n this.callback(bindings)\n this.success = true\n }\n\n MandatoryBranch.prototype.reportDone = function () {\n this.done = true\n log.info('Mandatory query branch finished.***')\n if (this.onDone !== undefined) {\n this.onDone()\n }\n }\n\n // An optional branch hoards its results.\n var OptionalBranch = function (junction) {\n this.count = 0\n this.done = false\n this.results = []\n this.junction = junction\n junction.branches.push(this)\n return this\n }\n\n OptionalBranch.prototype.reportMatch = function (bindings) {\n this.results.push(bindings)\n }\n\n OptionalBranch.prototype.reportDone = function () {\n log.debug('Optional branch finished - results.length = ' + this.results.length)\n if (this.results.length === 0) { // This is what optional means: if no hits,\n this.results.push({}) // mimic success, but with no bindings\n log.debug(\"Optional branch FAILED - that's OK.\")\n }\n this.done = true\n this.junction.checkAllDone()\n }\n\n /** prepare -- sets the index of the item to the possible matches\n * @param f - formula\n * @param item - an Statement, possibly w/ vars in it\n * @param bindings - Bindings so far\n * @returns false if the query fails -- there are no items that match\n */\n function prepare (f, item, bindings) {\n var terms, termIndex, i, ind\n item.nvars = 0\n item.index = null\n // if (!f.statements) log.warn(\"@@@ prepare: f is \"+f)\n // log.debug(\"Prepare: f has \"+ f.statements.length)\n // log.debug(\"Prepare: Kb size \"+f.statements.length+\" Preparing \"+item)\n\n terms = [item.subject, item.predicate, item.object, item.why]\n ind = [f.subjectIndex, f.predicateIndex, f.objectIndex, f.whyIndex]\n for (i = 0; i < 4; i++) {\n let t = terms[i]\n // console.log(\" Prepare (\" + t + \") \"+(t in bindings))\n if (t.uri && t.uri === defaultDocumentURI) { // chrome:session\n // console.log(' query: Ignoring slot ' + i)\n } else if (t.isVar && !(bindings[t] !== undefined)) {\n item.nvars++\n } else {\n t = bind(terms[i], bindings) // returns the RDF binding if bound, otherwise itself\n // if (terms[i]!=bind(terms[i],bindings) alert(\"Term: \"+terms[i]+\"Binding: \"+bind(terms[i], bindings))\n if (f.redirections[f.id(t)]) {\n t = f.redirections[f.id(t)] // redirect\n }\n termIndex = ind[i][f.id(t)]\n\n if (!termIndex) {\n item.index = []\n return false // Query line cannot match\n }\n if ((item.index === null) || (item.index.length > termIndex.length)) { // Find smallest index\n item.index = termIndex\n }\n }\n }\n\n if (item.index === null) { // All 4 are variables?\n item.index = f.statements\n }\n return true\n } // prepare\n\n /** sorting function -- negative if self is easier **/\n // We always prefer to start with a URI to be able to browse a graph\n // this is why we put off items with more variables till later.\n function easiestQuery (self, other) {\n if (self.nvars !== other.nvars) {\n return self.nvars - other.nvars\n }\n return self.index.length - other.index.length\n }\n\n var matchIndex = 0 // index\n /** matches a pattern formula against the knowledge base, e.g. to find matches for table-view\n *\n * @param f - knowledge base formula\n * @param g - pattern formula (may have vars)\n * @param bindingsSoFar - bindings accumulated in matching to date\n * @param level - spaces to indent stuff also lets you know what level of recursion you're at\n * @param fetcher - function (term, requestedBy) If you want link following\n * @param localCallback - function(bindings, pattern, branch) called on sucess\n * @returns nothing\n *\n * Will fetch linked data from the web iff the knowledge base an associated source fetcher (f.fetcher)\n ***/\n var match = function (f, g, bindingsSoFar, level, fetcher, localCallback, branch) {\n log.debug('Match begins, Branch count now: ' + branch.count + ' for ' + branch.pattern_debug)\n\n // log.debug(\"match: f has \"+f.statements.length+\", g has \"+g.statements.length)\n var pattern = g.statements\n if (pattern.length === 0) { // when it's satisfied all the pattern triples\n log.debug('FOUND MATCH WITH BINDINGS:' + bindingDebug(bindingsSoFar))\n if (g.optional.length === 0) {\n branch.reportMatch(bindingsSoFar)\n } else {\n log.debug('OPTIONAL: ' + g.optional)\n var junction = new OptionalBranchJunction(callback, bindingsSoFar) // @@ won't work with nested optionals? nest callbacks\n var br = []\n var b\n for (b = 0; b < g.optional.length; b++) {\n br[b] = new OptionalBranch(junction) // Allocate branches to prevent premature ending\n br[b].pattern_debug = g.optional[b] // for diagnotics only\n }\n for (b = 0; b < g.optional.length; b++) {\n br[b].count = br[b].count + 1 // Count how many matches we have yet to complete\n match(f, g.optional[b], bindingsSoFar, '', fetcher, callback, br[b])\n }\n }\n branch.count--\n log.debug('Match ends -- success , Branch count now: ' + branch.count + ' for ' + branch.pattern_debug)\n return // Success\n }\n\n var item\n var i\n var n = pattern.length\n // log.debug(level + \"Match \"+n+\" left, bs so far:\"+bindingDebug(bindingsSoFar))\n\n // Follow links from variables in query\n if (fetcher) { // Fetcher is used to fetch URIs, function first term is a URI term, second is the requester\n var id = 'match' + matchIndex++\n var fetchResource = function (requestedTerm, id) {\n var docuri = requestedTerm.uri.split('#')[0]\n fetcher.nowOrWhenFetched(docuri, undefined, function (ok, body, xhr) {\n if (!ok) {\n console.log('Error following link to <' + requestedTerm.uri + '> in query: ' + body)\n }\n match(f, g, bindingsSoFar, level, fetcher, // match not match2 to look up any others necessary.\n localCallback, branch)\n })\n }\n for (i = 0; i < n; i++) {\n item = pattern[i] // for each of the triples in the query\n if (bindingsSoFar[item.subject] !== undefined &&\n bindingsSoFar[item.subject].uri && fetcher &&\n fetcher.getState(docpart(bindingsSoFar[item.subject].uri)) === 'unrequested') {\n // fetch the subject info and return to id\n fetchResource(bindingsSoFar[item.subject], id)\n return // only look up one per line this time, but we will come back again though match\n }\n if (bindingsSoFar[item.object] !== undefined &&\n bindingsSoFar[item.object].uri && fetcher &&\n fetcher.getState(docpart(bindingsSoFar[item.object].uri)) === 'unrequested') {\n fetchResource(bindingsSoFar[item.object], id)\n return\n }\n }\n } // if fetcher\n match2(f, g, bindingsSoFar, level, fetcher, localCallback, branch)\n } // match\n\n var constraintsSatisfied = function (bindings, constraints) {\n var res = true\n var x\n var test\n for (x in bindings) {\n if (bindings.hasOwnProperty(x)) {\n if (constraints[x]) {\n test = constraints[x].test\n if (test && !test(bindings[x])) {\n res = false\n }\n }\n }\n }\n return res\n }\n\n /** match2 -- stuff after the fetch **/\n var match2 = function (f, g, bindingsSoFar, level, fetcher, callback, branch) { // post fetch\n var pattern = g.statements\n var n = pattern.length\n var i\n var k\n var nk\n var v\n var bindings2\n var newBindings1\n var item\n for (i = 0; i < n; i++) { // For each statement left in the query, run prepare\n item = pattern[i]\n // log.info('match2: item=' + item + ', bindingsSoFar=' + bindingDebug(bindingsSoFar))\n prepare(f, item, bindingsSoFar)\n // if (item.index) console.log(' item.index.length ' + item.index.length)\n }\n pattern.sort(easiestQuery)\n item = pattern[0]\n // log.debug(\"Sorted pattern:\\n\"+pattern)\n var rest = f.formula()\n rest.optional = g.optional\n rest.constraints = g.constraints\n rest.statements = pattern.slice(1) // No indexes: we will not query g.\n log.debug(level + 'match2 searching ' + item.index.length + ' for ' + item +\n '; bindings so far=' + bindingDebug(bindingsSoFar))\n // var results = []\n var c\n var nc = item.index.length\n var nbs1\n var st\n var onward = 0\n // var x\n for (c = 0; c < nc; c++) { // For each candidate statement\n st = item.index[c] // for each statement in the item's index, spawn a new match with that binding\n nbs1 = unifyContents(\n [item.subject, item.predicate, item.object, item.why],\n [st.subject, st.predicate, st.object, st.why], bindingsSoFar, f)\n log.info(level + ' From first: ' + nbs1.length + ': ' + bindingsDebug(nbs1))\n nk = nbs1.length\n // branch.count += nk\n // log.debug(\"Branch count bumped \"+nk+\" to: \"+branch.count)\n for (k = 0; k < nk; k++) { // For each way that statement binds\n bindings2 = []\n newBindings1 = nbs1[k][0]\n if (!constraintsSatisfied(newBindings1, g.constraints)) {\n // branch.count--\n log.debug('Branch count CS: ' + branch.count)\n } else {\n for (v in newBindings1) {\n if (newBindings1.hasOwnProperty(v)) {\n bindings2[v] = newBindings1[v] // copy\n }\n }\n for (v in bindingsSoFar) {\n if (bindingsSoFar.hasOwnProperty(v)) {\n bindings2[v] = bindingsSoFar[v] // copy\n }\n }\n\n branch.count++ // Count how many matches we have yet to complete\n onward++\n match(f, rest, bindings2, level + ' ', fetcher, callback, branch) // call match\n }\n }\n }\n branch.count--\n if (onward === 0) {\n log.debug('Match2 fails completely on ' + item)\n }\n log.debug('Match2 ends, Branch count: ' + branch.count + ' for ' + branch.pattern_debug)\n if (branch.count === 0) {\n log.debug('Branch finished.')\n branch.reportDone()\n }\n } // match2\n // ////////////////////////// Body of query() ///////////////////////\n var f = this\n log.debug('Query on ' + this.statements.length)\n var trunck = new MandatoryBranch(callback, onDone)\n trunck.count++ // count one branch to complete at the moment\n if (myQuery.sync) {\n match(f, myQuery.pat, myQuery.pat.initBindings, '', fetcher, callback, trunck)\n } else { // Give up thread: Allow other activities to run\n setTimeout(function () {\n match(f, myQuery.pat, myQuery.pat.initBindings, '', fetcher, callback, trunck)\n }, 0)\n }\n\n // returns nothing; callback does the work\n} // query\n","/* Identity management and indexing for RDF\n *\n * This file provides IndexedFormula a formula (set of triples) which\n * indexed by predicate, subject and object.\n *\n * It \"smushes\" (merges into a single node) things which are identical\n * according to owl:sameAs or an owl:InverseFunctionalProperty\n * or an owl:FunctionalProperty\n *\n *\n * 2005-10 Written Tim Berners-Lee\n * 2007 Changed so as not to munge statements from documents when smushing\n * 2019 Converted to typescript\n *\n *\n*/\n\n/** @module store */\n\nimport ClassOrder from './class-order'\nimport { defaultGraphURI } from './factories/canonical-data-factory'\nimport Formula, { FormulaOpts } from './formula'\nimport { ArrayIndexOf } from './utils'\nimport { RDFArrayRemove } from './utils-js'\nimport {\n isRDFlibSubject,\n isRDFlibPredicate,\n isRDFlibObject,\n isStore,\n isGraph,\n // isPredicate,\n isQuad,\n // isSubject\n} from './utils/terms'\nimport Node from './node'\nimport Variable from './variable'\nimport { Query, indexedFormulaQuery } from './query'\nimport UpdateManager from './update-manager'\nimport {\n Bindings, BlankNodeTermType, CollectionTermType, DefaultGraphTermType, EmptyTermType, GraphTermType, LiteralTermType, NamedNodeTermType, VariableTermType\n} from './types'\nimport Statement from './statement'\nimport { Indexable } from './factories/factory-types'\nimport NamedNode from './named-node'\nimport Fetcher from './fetcher'\nimport {\n Quad_Graph,\n Literal as TFLiteral,\n NamedNode as TFNamedNode,\n Quad_Object,\n Quad_Predicate,\n Quad,\n Quad_Subject,\n Term,\n} from './tf-types'\nimport { namedNode } from './index'\nimport serialize from \"./serialize\";\nimport BlankNode from './blank-node'\nimport DefaultGraph from './default-graph'\nimport Empty from './empty'\nimport Literal from './literal'\nimport Collection from './collection'\n\nconst owlNamespaceURI = 'http://www.w3.org/2002/07/owl#'\n\ntype FeaturesType = Array<('sameAs' | 'InverseFunctionalProperty' | 'FunctionalProperty')> | undefined\n\nexport { defaultGraphURI }\n// var link_ns = 'http://www.w3.org/2007/ont/link#'\n\n// Handle Functional Property\nfunction handleFP (\n formula: IndexedFormula,\n subj: Quad_Subject,\n pred: Quad_Predicate,\n obj: Quad_Object\n): boolean {\n var o1 = formula.any(subj, pred, undefined)\n if (!o1) {\n return false // First time with this value\n }\n // log.warn(\"Equating \"+o1.uri+\" and \"+obj.uri + \" because FP \"+pred.uri); //@@\n formula.equate(o1, obj)\n return true\n} // handleFP\n\n// Handle Inverse Functional Property\nfunction handleIFP (\n formula: IndexedFormula,\n subj: Quad_Subject,\n pred: Quad_Predicate,\n obj: Quad_Object\n): boolean {\n var s1 = formula.any(undefined, pred, obj)\n if (!s1) {\n return false // First time with this value\n }\n // log.warn(\"Equating \"+s1.uri+\" and \"+subj.uri + \" because IFP \"+pred.uri); //@@\n formula.equate(s1, subj)\n return true\n} // handleIFP\n\nfunction handleRDFType (\n formula: IndexedFormula,\n subj: Quad_Subject,\n pred: Quad_Predicate,\n obj: Quad_Object,\n why: Quad_Graph\n) {\n //@ts-ignore this method does not seem to exist in this library\n if (formula.typeCallback) {\n (formula as any).typeCallback(formula, obj, why)\n }\n\n var x = formula.classActions[formula.id(obj)]\n var done = false\n if (x) {\n for (var i = 0; i < x.length; i++) {\n done = done || x[i](formula, subj, pred, obj, why)\n }\n }\n return done // statement given is not needed if true\n}\n\n/**\n * Indexed Formula aka Store\n */\nexport default class IndexedFormula extends Formula { // IN future - allow pass array of statements to constructor\n /**\n * An UpdateManager initialised to this store\n */\n updater?: UpdateManager\n\n /**\n * Dictionary of namespace prefixes\n */\n namespaces: {[key: string]: string}\n\n /** Map of iri predicates to functions to call when adding { s type X } */\n classActions: { [k: string]: Function[] }\n /** Map of iri predicates to functions to call when getting statement with {s X o} */\n propertyActions: { [k: string]: Function[] }\n /** Redirect to lexically smaller equivalent symbol */\n redirections: any[]\n /** Reverse mapping to redirection: aliases for this */\n aliases: any[]\n /** Redirections we got from HTTP */\n HTTPRedirects: Statement[]\n /** Array of statements with this X as subject */\n subjectIndex: Statement[]\n /** Array of statements with this X as predicate */\n predicateIndex: Statement[]\n /** Array of statements with this X as object */\n objectIndex: Statement[]\n /** Array of statements with X as provenance */\n whyIndex: Statement[]\n index: [\n Statement[],\n Statement[],\n Statement[],\n Statement[]\n ]\n features: FeaturesType\n static handleRDFType: Function\n _universalVariables?: NamedNode[]\n _existentialVariables?: BlankNode[]\n\n /** Function to remove quads from the store arrays with */\n private rdfArrayRemove: (arr: Quad[], q: Quad) => void\n /** Callbacks which are triggered after a statement has been added to the store */\n private dataCallbacks?: Array<(q: Quad) => void>\n\n /**\n * Creates a new formula\n * @param features - What sort of automatic processing to do? Array of string\n * @param features.sameAs - Smush together A and B nodes whenever { A sameAs B }\n * @param opts\n * @param [opts.rdfFactory] - The data factory that should be used by the store\n * @param [opts.rdfArrayRemove] - Function which removes statements from the store\n * @param [opts.dataCallback] - Callback when a statement is added to the store, will not trigger when adding duplicates\n */\n constructor (features?: FeaturesType, opts: FormulaOpts = {}) {\n super(undefined, undefined, undefined, undefined, opts)\n\n this.propertyActions = {}\n this.classActions = {}\n this.redirections = []\n this.aliases = []\n this.HTTPRedirects = []\n this.subjectIndex = []\n this.predicateIndex = []\n this.objectIndex = []\n this.whyIndex = []\n this.index = [\n this.subjectIndex,\n this.predicateIndex,\n this.objectIndex,\n this.whyIndex\n ]\n this.namespaces = {} // Dictionary of namespace prefixes\n this.features = features || [ // By default, devs do not expect these features.\n// See https://github.com/linkeddata/rdflib.js/issues/458\n// 'sameAs',\n// 'InverseFunctionalProperty',\n// 'FunctionalProperty',\n ]\n this.rdfArrayRemove = opts.rdfArrayRemove || RDFArrayRemove\n if (opts.dataCallback) {\n this.dataCallbacks = [opts.dataCallback]\n }\n\n this.initPropertyActions(this.features)\n }\n\n /**\n * Gets the URI of the default graph\n */\n static get defaultGraphURI(): string {\n return defaultGraphURI\n }\n\n /**\n * Gets this graph with the bindings substituted\n * @param bindings The bindings\n */\n substitute (bindings: Bindings): T {\n var statementsCopy = this.statements.map(function (ea: Quad) {\n return (ea as Statement).substitute(bindings)\n })\n var y = new IndexedFormula()\n y.add(statementsCopy)\n return y as unknown as T\n }\n\n /**\n * Add a callback which will be triggered after a statement has been added to the store.\n * @param cb\n */\n addDataCallback(cb: (q: Quad) => void): void {\n if (!this.dataCallbacks) {\n this.dataCallbacks = []\n }\n this.dataCallbacks.push(cb)\n }\n\n /**\n * Apply a set of statements to be deleted and to be inserted\n *\n * @param patch - The set of statements to be deleted and to be inserted\n * @param target - The name of the document to patch\n * @param patchCallback - Callback to be called when patching is complete\n */\n applyPatch(\n patch: {\n delete?: ReadonlyArray,\n patch?: ReadonlyArray,\n where?: any\n },\n target: TFNamedNode,\n patchCallback: (errorString?: string) => void\n ): void {\n var targetKB = this\n var ds\n var binding: Bindings | null = null\n\n function doPatch (onDonePatch: (errorString?: string) => void) {\n if (patch['delete']) {\n ds = patch['delete']\n // console.log(bindingDebug(binding))\n // console.log('ds before substitute: ' + ds)\n if (binding) ds = ds.substitute(binding)\n // console.log('applyPatch: delete: ' + ds)\n ds = ds.statements as Statement[]\n var bad: Quad[] = []\n var ds2 = ds.map(function (st: Quad) { // Find the actual statements in the store\n var sts = targetKB.statementsMatching(st.subject, st.predicate, st.object, target)\n if (sts.length === 0) {\n // log.info(\"NOT FOUND deletable \" + st)\n bad.push(st)\n return null\n } else {\n // log.info(\"Found deletable \" + st)\n return sts[0]\n }\n })\n if (bad.length) {\n // console.log('Could not find to delete ' + bad.length + 'statements')\n // console.log('despite ' + targetKB.statementsMatching(bad[0].subject, bad[0].predicate)[0])\n return patchCallback('Could not find to delete: ' + bad.join('\\n or '))\n }\n ds2.map(function (st: Quad) {\n targetKB.remove(st)\n })\n }\n if (patch['insert']) {\n // log.info(\"doPatch insert \"+patch['insert'])\n ds = patch['insert']\n if (binding) ds = ds.substitute(binding)\n ds = ds.statements\n ds.map(function (st: Quad) {\n st.graph = target\n targetKB.add(st.subject, st.predicate, st.object, st.graph)\n })\n }\n onDonePatch()\n }\n if (patch.where) {\n // log.info(\"Processing WHERE: \" + patch.where + '\\n')\n var query = new Query('patch')\n query.pat = patch.where\n query.pat.statements.map(function (st) {\n st.graph = namedNode(target.value)\n })\n //@ts-ignore TODO: add sync property to Query when converting Query to typescript\n query.sync = true\n\n var bindingsFound: Bindings[] = []\n\n targetKB.query(\n query,\n function onBinding (binding) {\n bindingsFound.push(binding)\n // console.log(' got a binding: ' + bindingDebug(binding))\n },\n targetKB.fetcher,\n function onDone () {\n if (bindingsFound.length === 0) {\n return patchCallback('No match found to be patched:' + patch.where)\n }\n if (bindingsFound.length > 1) {\n return patchCallback('Patch ambiguous. No patch done.')\n }\n binding = bindingsFound[0]\n doPatch(patchCallback)\n })\n } else {\n doPatch(patchCallback)\n }\n }\n\n /**\n * N3 allows for declaring blank nodes, this function enables that support\n *\n * @param x The blank node to be declared, supported in N3\n */\n declareExistential(x: BlankNode): BlankNode {\n if (!this._existentialVariables) this._existentialVariables = []\n this._existentialVariables.push(x)\n return x\n }\n\n /**\n * @param features\n */\n initPropertyActions(features: FeaturesType) {\n // If the predicate is #type, use handleRDFType to create a typeCallback on the object\n this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'))] =\n [ handleRDFType ]\n\n // Assumption: these terms are not redirected @@fixme\n if (ArrayIndexOf(features, 'sameAs') >= 0) {\n this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode(`${owlNamespaceURI}sameAs`))] = [\n function (formula, subj, pred, obj, why) {\n // log.warn(\"Equating \"+subj.uri+\" sameAs \"+obj.uri); //@@\n formula.equate(subj, obj)\n return true // true if statement given is NOT needed in the store\n }\n ] // sameAs -> equate & don't add to index\n }\n if (ArrayIndexOf(features, 'InverseFunctionalProperty') >= 0) {\n this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode(`${owlNamespaceURI}InverseFunctionalProperty`))] = [\n function (formula, subj, pred, obj, addFn) {\n // yes subj not pred!\n return formula.newPropertyAction(subj, handleIFP)\n }\n ] // IFP -> handleIFP, do add to index\n }\n if (ArrayIndexOf(features, 'FunctionalProperty') >= 0) {\n this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode(`${owlNamespaceURI}FunctionalProperty`))] = [\n function (formula, subj, proj, obj, addFn) {\n return formula.newPropertyAction(subj, handleFP)\n }\n ] // FP => handleFP, do add to index\n }\n }\n\n /** @deprecated Use {add} instead */\n addStatement (st: Quad): number {\n this.add(st.subject, st.predicate, st.object, st.graph)\n return this.statements.length\n }\n\n /**\n * Adds a triple (quad) to the store.\n *\n * @param subj - The thing about which the fact a relationship is asserted.\n * Also accepts a statement or an array of Statements.\n * @param pred - The relationship which is asserted\n * @param obj - The object of the relationship, e.g. another thing or a value. If passed a string, this will become a literal.\n * @param why - The document in which the triple (S,P,O) was or will be stored on the web\n * @returns The statement added to the store, or the store\n */\n add (\n subj: Quad_Subject | Quad | Quad[] | Statement | Statement[],\n pred?: Quad_Predicate,\n obj?: Term | string,\n why?: Quad_Graph\n ): Statement | null | this | number {\n var i: number\n if (arguments.length === 1) {\n if (subj instanceof Array) {\n for (i = 0; i < subj.length; i++) {\n this.add(subj[i])\n }\n } else if (isQuad(subj)) {\n this.add(subj.subject, subj.predicate, subj.object, subj.graph)\n } else if (isStore(subj)) {\n this.add((subj as any).statements)\n }\n return this\n }\n var actions: Function[]\n var st: Statement\n if (!why) {\n // system generated\n why = this.fetcher ? this.fetcher.appNode : this.rdfFactory.defaultGraph()\n }\n if (typeof subj == 'string') {\n subj = this.rdfFactory.namedNode(subj)\n }\n pred = Node.fromValue(pred)\n const objNode = Node.fromValue(obj) as Term\n why = Node.fromValue(why)\n if (!isRDFlibSubject(subj)) {\n throw new Error('Subject is not a subject type')\n }\n if (!isRDFlibPredicate(pred)) {\n throw new Error(`Predicate ${pred} is not a predicate type`)\n }\n if (!isRDFlibObject(objNode)) {\n throw new Error(`Object ${objNode} is not an object type`)\n }\n if (!isGraph(why)) {\n throw new Error(\"Why is not a graph type\")\n }\n //@ts-ignore This is not used internally\n if (this.predicateCallback) {\n //@ts-ignore This is not used internally\n this.predicateCallback(this, pred, why)\n }\n // Action return true if the statement does not need to be added\n var predHash = this.id(this.canon(pred!))\n actions = this.propertyActions[predHash] // Predicate hash\n var done = false\n if (actions) {\n // alert('type: '+typeof actions +' @@ actions='+actions)\n for (i = 0; i < actions.length; i++) {\n done = done || actions[i](this, subj, pred, objNode, why)\n }\n }\n if (this.holds(subj, pred, objNode, why)) { // Takes time but saves duplicates\n // console.log('rdflib: Ignoring dup! {' + subj + ' ' + pred + ' ' + obj + ' ' + why + '}')\n return null // @@better to return self in all cases?\n }\n // If we are tracking provenance, every thing should be loaded into the store\n // if (done) return this.rdfFactory.quad(subj, pred, obj, why)\n // Don't put it in the store\n // still return this statement for owl:sameAs input\n var hash = [\n this.id(this.canon(subj)),\n predHash,\n this.id(this.canon(objNode)),\n this.id(this.canon(why))\n ]\n // @ts-ignore this will fail if you pass a collection and the factory does not allow Collections\n st = this.rdfFactory.quad(subj, pred, objNode, why)\n for (i = 0; i < 4; i++) {\n var ix = this.index[i]\n var h = hash[i]\n if (!ix[h]) {\n ix[h] = []\n }\n ix[h].push(st) // Set of things with this as subject, etc\n }\n\n // log.debug(\"ADDING {\"+subj+\" \"+pred+\" \"+objNode+\"} \"+why)\n this.statements.push(st)\n\n if (this.dataCallbacks) {\n for (const callback of this.dataCallbacks) {\n callback(st)\n }\n }\n\n return st\n }\n\n /**\n * Returns the symbol with canonical URI as smushed\n * @param term - An RDF node\n */\n canon(term?: Term): Node {\n if (!term) {\n // @@ TODO Should improve this to return proper value - doing this to keep it backward compatible\n return term as unknown as Node\n }\n const y = this.redirections[this.id(term)]\n if (y) {\n return y\n }\n switch (term.termType) {\n case BlankNodeTermType:\n return new BlankNode(term.value)\n case CollectionTermType:\n return term as Collection // non-RDF/JS type, should just need to cast\n case DefaultGraphTermType:\n return new DefaultGraph()\n case EmptyTermType: // non-RDF/JS type, should just need to cast\n return term as Empty\n case GraphTermType: // non-RDF/JS type, should just need to cast\n return term as IndexedFormula\n case LiteralTermType:\n return new Literal(term.value, (term as TFLiteral).language, (term as TFLiteral).datatype)\n case NamedNodeTermType:\n return new NamedNode(term.value)\n case VariableTermType:\n return new Variable(term.value)\n default:\n throw new Error(`Term Type not recognized for canonization: ${term.termType}`)\n }\n }\n\n\n /**\n * Checks this formula for consistency\n */\n check(): void {\n this.checkStatementList(this.statements)\n for (var p = 0; p < 4; p++) {\n var ix = this.index[p]\n for (var key in ix) {\n if (ix.hasOwnProperty(key)) {\n // @ts-ignore should this pass an array or a single statement? checkStateMentsList expects an array.\n this.checkStatementList(ix[key], p)\n }\n }\n }\n }\n\n /**\n * Checks a list of statements for consistency\n * @param sts - The list of statements to check\n * @param from - An index with the array ['subject', 'predicate', 'object', 'why']\n */\n checkStatementList(\n sts: ReadonlyArray,\n from?: number\n ): boolean | void {\n if (from === undefined) {\n from = 0\n }\n var names = ['subject', 'predicate', 'object', 'why']\n var origin = ' found in ' + names[from] + ' index.'\n var st: Quad\n for (var j = 0; j < sts.length; j++) {\n st = sts[j]\n var term = [ st.subject, st.predicate, st.object, st.graph ]\n var arrayContains = function (a: Array, x: Quad) {\n for (var i = 0; i < a.length; i++) {\n if (a[i].subject.equals(x.subject) &&\n a[i].predicate.equals(x.predicate) &&\n a[i].object.equals(x.object) &&\n a[i].why.equals(x.graph)) {\n return true\n }\n }\n }\n for (var p = 0; p < 4; p++) {\n var c = this.canon(term[p])\n var h = this.id(c)\n if (!this.index[p][h]) {\n // throw new Error('No ' + name[p] + ' index for statement ' + st + '@' + st.why + origin)\n } else {\n if (!arrayContains(this.index[p][h], st)) {\n // throw new Error('Index for ' + name[p] + ' does not have statement ' + st + '@' + st.why + origin)\n }\n }\n }\n if (!arrayContains(this.statements, st)) {\n throw new Error('Statement list does not statement ' + st + '@' + st.graph + origin)\n }\n }\n }\n\n /**\n * Closes this formula (and return it)\n */\n close(): IndexedFormula {\n return this\n }\n\n compareTerms(u1: Term, u2: Term): number {\n // Keep compatibility with downstream classOrder changes\n if (Object.prototype.hasOwnProperty.call(u1, \"compareTerm\")) {\n return (u1 as Node).compareTerm(u2 as Node)\n }\n if (ClassOrder[u1.termType] < ClassOrder[u2.termType]) {\n return -1\n }\n if (ClassOrder[u1.termType] > ClassOrder[u2.termType]) {\n return +1\n }\n if (u1.value < u2.value) {\n return -1\n }\n if (u1.value > u2.value) {\n return +1\n }\n return 0\n }\n\n\n /**\n * replaces @template with @target and add appropriate triples\n * removes no triples by default and is a one-direction replication\n * @param template node to copy\n * @param target node to copy to\n * @param flags Whether or not to do a two-directional copy and/or delete triples\n */\n copyTo(\n template: Quad_Subject,\n target: Quad_Subject,\n flags?: Array<('two-direction' | 'delete')>\n ): void {\n if (!flags) flags = []\n var statList = this.statementsMatching(template)\n if (ArrayIndexOf(flags, 'two-direction') !== -1) {\n statList.concat(this.statementsMatching(undefined, undefined, template))\n }\n for (var i = 0; i < statList.length; i++) {\n var st = statList[i]\n switch (st.object.termType) {\n case 'NamedNode':\n this.add(target, st.predicate, st.object)\n break\n case 'Literal':\n case 'BlankNode':\n // @ts-ignore Collections can appear here\n case 'Collection':\n // @ts-ignore Possible bug: copy is not available on Collections\n this.add(target, st.predicate, st.object.copy(this))\n }\n if (ArrayIndexOf(flags, 'delete') !== -1) {\n this.remove(st)\n }\n }\n }\n\n /**\n * Simplify graph in store when we realize two identifiers are equivalent\n * We replace the bigger with the smaller.\n * @param u1in The first node\n * @param u2in The second node\n */\n equate(u1in: Term, u2in : Term): boolean {\n // log.warn(\"Equating \"+u1+\" and \"+u2); // @@\n // @@JAMBO Must canonicalize the uris to prevent errors from a=b=c\n // 03-21-2010\n const u1 = this.canon(u1in) as Quad_Subject\n const u2 = this.canon(u2in) as Quad_Subject\n var d = this.compareTerms(u1, u2)\n if (!d) {\n return true // No information in {a = a}\n }\n // var big\n // var small\n if (d < 0) { // u1 less than u2\n return this.replaceWith(u2, u1)\n } else {\n return this.replaceWith(u1, u2)\n }\n }\n\n /**\n * Creates a new empty indexed formula\n * Only applicable for IndexedFormula, but TypeScript won't allow a subclass to override a property\n * @param features The list of features\n */\n formula(features: FeaturesType): IndexedFormula {\n return new IndexedFormula(features)\n }\n\n /**\n * Returns the number of statements contained in this IndexedFormula.\n * (Getter proxy to this.statements).\n * Usage:\n * ```\n * var kb = rdf.graph()\n * kb.length // -> 0\n * ```\n * @returns {Number}\n */\n get length (): number {\n return this.statements.length\n }\n\n /**\n * Returns any quads matching the given arguments.\n * Standard RDFJS spec method for Source objects, implemented as an\n * alias to `statementsMatching()`\n * @param subject The subject\n * @param predicate The predicate\n * @param object The object\n * @param graph The graph that contains the statement\n */\n match(\n subject?: Quad_Subject | null,\n predicate?: Quad_Predicate | null,\n object?: Quad_Object | null,\n graph?: Quad_Graph | null\n ): Quad[] {\n return this.statementsMatching(\n Node.fromValue(subject),\n Node.fromValue(predicate),\n Node.fromValue(object),\n Node.fromValue(graph)\n )\n }\n\n /**\n * Find out whether a given URI is used as symbol in the formula\n * @param uri The URI to look for\n */\n mentionsURI(uri: string): boolean {\n var hash = '<' + uri + '>'\n return (!!this.subjectIndex[hash] ||\n !!this.objectIndex[hash] ||\n !!this.predicateIndex[hash])\n }\n\n /**\n * Existentials are BNodes - something exists without naming\n * @param uri An URI\n */\n newExistential(uri: string): Term {\n if (!uri) return this.bnode()\n var x = this.sym(uri)\n // @ts-ignore x should be blanknode, but is namedNode.\n return this.declareExistential(x)\n }\n\n /**\n * Adds a new property action\n * @param pred the predicate that the function should be triggered on\n * @param action the function that should trigger\n */\n newPropertyAction(\n pred: Quad_Predicate,\n action: (\n store: IndexedFormula,\n subject: Quad_Subject,\n predicate: Quad_Predicate,\n object: Quad_Object\n ) => boolean\n ): boolean {\n // log.debug(\"newPropertyAction: \"+pred)\n var hash = this.id(pred)\n if (!this.propertyActions[hash]) {\n this.propertyActions[hash] = []\n }\n this.propertyActions[hash].push(action)\n // Now apply the function to to statements already in the store\n var toBeFixed = this.statementsMatching(undefined, pred, undefined)\n var done = false\n for (var i = 0; i < toBeFixed.length; i++) { // NOT optimized - sort toBeFixed etc\n done = done || action(this, toBeFixed[i].subject, pred, toBeFixed[i].object)\n }\n return done\n }\n\n /**\n * Creates a new universal node\n * Universals are Variables\n * @param uri An URI\n */\n newUniversal(uri: string): TFNamedNode {\n var x = this.sym(uri)\n if (!this._universalVariables) this._universalVariables = []\n this._universalVariables.push(x)\n return x\n }\n\n // convenience function used by N3 parser\n variable (name: string) {\n return new Variable(name)\n }\n\n /**\n * Find an unused id for a file being edited: return a symbol\n * (Note: Slow iff a lot of them -- could be O(log(k)) )\n * @param doc A document named node\n */\n nextSymbol(doc: TFNamedNode): TFNamedNode {\n for (var i = 0; ;i++) {\n var uri = doc.value + '#n' + i\n if (!this.mentionsURI(uri)) return this.sym(uri)\n }\n }\n\n /**\n * Query this store asynchronously, return bindings in callback\n *\n * @param myQuery The query to be run\n * @param callback Function to call when bindings\n * @param Fetcher | null If you want the query to do link following\n * @param onDone OBSOLETE - do not use this // @@ Why not ?? Called when query complete\n */\n query(\n myQuery: Query,\n callback: (bindings: Bindings) => void,\n fetcher?: Fetcher | null,\n onDone?: () => void\n ): void {\n return indexedFormulaQuery.call(this, myQuery, callback, fetcher, onDone)\n }\n\n /**\n * Query this store synchronously and return bindings\n *\n * @param myQuery The query to be run\n */\n querySync(myQuery: Query): any[] {\n var results: Bindings[] = []\n function saveBinginds (bindings: Bindings) {\n results.push(bindings)\n }\n function onDone () {\n done = true\n }\n var done = false\n // @ts-ignore TODO: Add .sync to Query\n myQuery.sync = true\n\n indexedFormulaQuery.call(this, myQuery, saveBinginds, null, onDone)\n if (!done) {\n throw new Error('Sync query should have called done function')\n }\n return results\n }\n\n /**\n * Removes one or multiple statement(s) from this formula\n * @param st - A Statement or array of Statements to remove\n */\n remove(st: Quad | Quad[]): IndexedFormula {\n if (st instanceof Array) {\n for (var i = 0; i < st.length; i++) {\n this.remove(st[i])\n }\n return this\n }\n if (isStore(st)) {\n return this.remove(st.statements)\n }\n var sts = this.statementsMatching(st.subject, st.predicate, st.object, st.graph)\n if (!sts.length) {\n throw new Error('Statement to be removed is not on store: ' + st)\n }\n this.removeStatement(sts[0])\n return this\n }\n\n /**\n * Removes all statements in a doc, along with the related metadata including request/response/status\n * @param doc - The document / graph\n */\n removeDocument(doc: Quad_Graph): IndexedFormula {\n this.removeMetadata(doc)\n // remove document\n var sts: Quad[] = this.statementsMatching(undefined, undefined, undefined, doc).slice() // Take a copy as this is the actual index\n for (var i = 0; i < sts.length; i++) {\n this.removeStatement(sts[i])\n }\n this.removeMatches(doc as Quad_Subject, null, null)\n return this\n }\n\n removeMetadata(doc: Quad_Graph): IndexedFormula {\n const meta = this.sym('chrome://TheCurrentSession') // or this.rdfFactory.namedNode('chrome://TheCurrentSession')\n const linkNamespaceURI = 'http://www.w3.org/2007/ont/link#'\n // remove status/response/request metadata\n const requests = this.statementsMatching(undefined, this.sym(`${linkNamespaceURI}requestedURI`), this.rdfFactory.literal(doc.value), meta).map(st => st.subject)\n for (var r = 0; r < requests.length; r++) {\n const request = requests[r]\n if (request != undefined) {\n // removeMatches unresolved issue with collection https://github.com/linkeddata/rdflib.js/issues/631\n let sts: Quad[]\n // status collection\n const status = this.any(request, this.sym(`${linkNamespaceURI}status`), null, meta) as Quad_Subject\n if (status != undefined) {\n sts = this.statementsMatching(status, this.sym(`${linkNamespaceURI}status`), null, meta).slice()\n for (var i = 0; i < sts.length; i++) {\n this.removeStatement(sts[i])\n }\n }\n // response items list\n const response = this.any(request, this.sym(`${linkNamespaceURI}response`), null, meta) as Quad_Subject\n if (response != undefined) {\n sts = this.statementsMatching(response, null, null, meta).slice()\n for (var i = 0; i < sts.length; i++) {\n this.removeStatement(sts[i])\n }\n }\n // request triples\n sts = this.statementsMatching(request, null, null, meta).slice()\n for (var i = 0; i < sts.length; i++) {\n this.removeStatement(sts[i])\n }\n\n }\n }\n this.removeMatches(this.sym(doc.value), null, null, meta) // content-type\n return this\n }\n\n /**\n * Remove all statements matching args (within limit) *\n * @param subj The subject\n * @param pred The predicate\n * @param obj The object\n * @param why The graph that contains the statement\n * @param limit The number of statements to remove\n */\n removeMany(\n subj?: Quad_Subject | null,\n pred?: Quad_Predicate | null,\n obj?: Quad_Object | null,\n why?: Quad_Graph | null,\n limit?: number\n ): void {\n // log.debug(\"entering removeMany w/ subj,pred,obj,why,limit = \" + subj +\", \"+ pred+\", \" + obj+\", \" + why+\", \" + limit)\n var sts = this.statementsMatching(subj, pred, obj, why, false)\n // This is a subtle bug that occurred in updateCenter.js too.\n // The fact is, this.statementsMatching returns this.whyIndex instead of a copy of it\n // but for perfromance consideration, it's better to just do that\n // so make a copy here.\n var statements: Quad[] = []\n for (var i = 0; i < sts.length; i++) statements.push(sts[i])\n if (limit) statements = statements.slice(0, limit)\n for (i = 0; i < statements.length; i++) this.remove(statements[i])\n }\n\n /**\n * Remove all matching statements\n * @param subject The subject\n * @param predicate The predicate\n * @param object The object\n * @param graph The graph that contains the statement\n */\n removeMatches(\n subject?: Quad_Subject | null,\n predicate?: Quad_Predicate | null,\n object?: Quad_Object | null,\n graph?: Quad_Graph | null\n ): IndexedFormula {\n this.removeMany(subject, predicate, object, graph)\n return this\n }\n\n /**\n * Remove a particular statement object from the store\n *\n * @param st - a statement which is already in the store and indexed.\n * Make sure you only use this for these.\n * Otherwise, you should use remove() above.\n */\n removeStatement(st: Quad): IndexedFormula {\n // log.debug(\"entering remove w/ st=\" + st)\n var term = [ st.subject, st.predicate, st.object, st.graph ]\n for (var p = 0; p < 4; p++) {\n var c = this.canon(term[p])\n var h = this.id(c)\n if (!this.index[p][h]) {\n // log.warn (\"Statement removal: no index '+p+': \"+st)\n } else {\n this.rdfArrayRemove(this.index[p][h], st)\n }\n }\n this.rdfArrayRemove(this.statements, st)\n return this\n }\n\n /**\n * Removes statements\n * @param sts The statements to remove\n */\n removeStatements(sts: ReadonlyArray): IndexedFormula {\n for (var i = 0; i < sts.length; i++) {\n this.remove(sts[i])\n }\n return this\n }\n\n /**\n * Replace big with small, obsoleted with obsoleting.\n */\n replaceWith (big: Quad_Subject, small: Quad_Subject): boolean {\n // log.debug(\"Replacing \"+big+\" with \"+small) // this.id(@@\n var oldhash = this.id(big)\n var newhash = this.id(small)\n var moveIndex = function (ix) {\n var oldlist = ix[oldhash]\n if (!oldlist) {\n return // none to move\n }\n var newlist = ix[newhash]\n if (!newlist) {\n ix[newhash] = oldlist\n } else {\n ix[newhash] = oldlist.concat(newlist)\n }\n delete ix[oldhash]\n }\n // the canonical one carries all the indexes\n for (var i = 0; i < 4; i++) {\n moveIndex(this.index[i])\n }\n this.redirections[oldhash] = small\n if (big.value) {\n // @@JAMBO: must update redirections,aliases from sub-items, too.\n if (!this.aliases[newhash]) {\n this.aliases[newhash] = []\n }\n this.aliases[newhash].push(big) // Back link\n if (this.aliases[oldhash]) {\n for (i = 0; i < this.aliases[oldhash].length; i++) {\n this.redirections[this.id(this.aliases[oldhash][i])] = small\n this.aliases[newhash].push(this.aliases[oldhash][i])\n }\n }\n this.add(small, this.sym('http://www.w3.org/2007/ont/link#uri'), big)\n // If two things are equal, and one is requested, we should request the other.\n if (this.fetcher) {\n this.fetcher.nowKnownAs(big, small)\n }\n }\n moveIndex(this.classActions)\n moveIndex(this.propertyActions)\n // log.debug(\"Equate done. \"+big+\" to be known as \"+small)\n return true // true means the statement does not need to be put in\n }\n\n /**\n * Return all equivalent URIs by which this is known\n * @param x A named node\n */\n allAliases(x: NamedNode): NamedNode[] {\n var a = this.aliases[this.id(this.canon(x))] || []\n a.push(this.canon(x))\n return a\n }\n\n /**\n * Compare by canonical URI as smushed\n * @param x A named node\n * @param y Another named node\n */\n sameThings(x: NamedNode, y: NamedNode): boolean {\n if (x.equals(y)) {\n return true\n }\n var x1 = this.canon(x)\n // alert('x1='+x1)\n if (!x1) return false\n var y1 = this.canon(y)\n // alert('y1='+y1); //@@\n if (!y1) return false\n return (x1.value === y1.value)\n }\n\n setPrefixForURI (prefix: string, nsuri: string): void {\n // TODO: This is a hack for our own issues, which ought to be fixed\n // post-release\n // See http://dig.csail.mit.edu/cgi-bin/roundup.cgi/$rdf/issue227\n if (prefix === 'tab' && this.namespaces['tab']) {\n return\n } // There are files around with long badly generated prefixes like this\n if (prefix.slice(0, 2) === 'ns' || prefix.slice(0, 7) === 'default') {\n return\n }\n\n // remove any prefix that currently targets nsuri\n for (let existingPrefix in this.namespaces) {\n if (this.namespaces[existingPrefix] == nsuri)\n delete this.namespaces[existingPrefix];\n }\n\n this.namespaces[prefix] = nsuri\n }\n\n /** Search the Store\n *\n * ALL CONVENIENCE LOOKUP FUNCTIONS RELY ON THIS!\n * @param subj - A node to search for as subject, or if null, a wildcard\n * @param pred - A node to search for as predicate, or if null, a wildcard\n * @param obj - A node to search for as object, or if null, a wildcard\n * @param why - A node to search for as graph, or if null, a wildcard\n * @param justOne - flag - stop when found one rather than get all of them?\n * @returns An array of nodes which match the wildcard position\n */\n statementsMatching (\n subj?: Quad_Subject | null,\n pred?: Quad_Predicate | null,\n obj?: Quad_Object | null,\n why?: Quad_Graph | null,\n justOne?: boolean\n ): Statement[] {\n // log.debug(\"Matching {\"+subj+\" \"+pred+\" \"+obj+\"}\")\n var pat = [ subj, pred, obj, why ]\n var pattern: Term[] = []\n var hash: Indexable[] = []\n var wild: number[] = [] // wildcards\n var given: number[] = [] // Not wild\n var p: number\n var list\n for (p = 0; p < 4; p++) {\n pattern[p] = this.canon(Node.fromValue(pat[p]))\n if (!pattern[p]) {\n wild.push(p)\n } else {\n given.push(p)\n hash[p] = this.id(pattern[p])\n }\n }\n if (given.length === 0) {\n return this.statements\n }\n if (given.length === 1) { // Easy too, we have an index for that\n p = given[0]\n list = this.index[p][hash[p]]\n if (list && justOne) {\n if (list.length > 1) {\n list = list.slice(0, 1)\n }\n }\n list = list || []\n return list\n }\n // Now given.length is 2, 3 or 4.\n // We hope that the scale-free nature of the data will mean we tend to get\n // a short index in there somewhere!\n var best = 1e10 // really bad\n var iBest\n var i\n for (i = 0; i < given.length; i++) {\n p = given[i] // Which part we are dealing with\n list = this.index[p][hash[p]]\n if (!list) {\n return [] // No occurrences\n }\n if (list.length < best) {\n best = list.length\n iBest = i // (not p!)\n }\n }\n // Ok, we have picked the shortest index but now we have to filter it\n var pBest = given[iBest]\n var possibles: Statement[] = this.index[pBest][hash[pBest]]\n var check = given.slice(0, iBest).concat(given.slice(iBest + 1)) // remove iBest\n var results: Statement[] = []\n var parts = [ 'subject', 'predicate', 'object', 'why' ]\n for (var j = 0; j < possibles.length; j++) {\n var st: Statement | null = possibles[j]\n\n for (i = 0; i < check.length; i++) { // for each position to be checked\n p = check[i]\n if (!this.canon(st[parts[p]]).equals(pattern[p])) {\n st = null\n break\n }\n }\n if (st != null) {\n results.push(st)\n if (justOne) break\n }\n }\n return results\n }\n\n /**\n * A list of all the URIs by which this thing is known\n * @param term\n */\n uris(term: Quad_Subject): string[] {\n var cterm = this.canon(term)\n var terms = this.aliases[this.id(cterm)]\n if (!cterm.value) return []\n var res = [ cterm.value ]\n if (terms) {\n for (var i = 0; i < terms.length; i++) {\n res.push(terms[i].uri)\n }\n }\n return res\n }\n\n serialize (base, contentType, provenance, options?) {\n\n // override Formula.serialize to force the serializer namespace prefixes\n // to those of this IndexedFormula\n\n // if namespaces are explicitly passed in options, let them override the existing namespaces in this formula\n const namespaces = options?.namespaces ? {...this.namespaces, ...options.namespaces} : {...this.namespaces};\n\n options = {\n ...(options || {}),\n namespaces\n }\n return serialize(provenance, this, base, contentType, undefined, options);\n }\n}\nIndexedFormula.handleRDFType = handleRDFType\n","/* Lists form conversion\n*/\n\n\n// import DataFactory from './factories/extended-term-factory'\n// import jsonldParser from './jsonldparser'\n// @ts-ignore is this injected?\nimport { Parser as N3jsParser } from 'n3' // @@ Goal: remove this dependency\n// import N3Parser from './n3parser'\n// import { parseRDFaDOM } from './rdfaparser'\n// import RDFParser from './rdfxmlparser'\n// import sparqlUpdateParser from './patch-parser'\n// import * as Util from './utils-js'\nimport Node from './node-internal'\n// import BlankNode from './blank-node'\n// import NamedNode from './named-node'\nimport Collection from './collection'\nimport Statement from './statement'\n// import Formula from './formula'\nimport Store from './store'\n// import { ContentType, TurtleContentType, N3ContentType, RDFXMLContentType, XHTMLContentType, HTMLContentType, SPARQLUpdateContentType, SPARQLUpdateSingleMatchContentType, JSONLDContentType, NQuadsContentType, NQuadsAltContentType } from './types'\n\n// import { Quad } from './tf-types'\n\nimport {BlankNode, NamedNode, Quad, Term,} from './tf-types'\nimport Namespace from './namespace'\n\nconst RDF = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')\n\n/* Replace a given node with another node throughout a given document\n*\n* we do the predicate as well for complenesss though we don't expect Collections to use it\n*/\nexport function substituteInDoc (store:Store, x:Term, y:Term, doc?: NamedNode ) {\n // console.log(`substituteInDoc put ${x} for ${y} in ${doc}}`)\n for (const quad of store.statementsMatching(y as any, null, null, doc as any)) {\n const newStatement = new Statement(x as any, quad.predicate, quad.object, doc as any)\n store.remove(quad)\n store.add(newStatement)\n }\n for (const quad of store.statementsMatching(null, y as any, null, doc) as any) {\n store.remove(quad)\n // console.log(` substituteInDoc predicate ${x} in ${quad}}`)\n store.add(new Statement(quad.subject, x as any, quad.object, doc as any))\n }\n for (const quad of store.statementsMatching(null, null, y as any, doc) as any) {\n store.remove(quad)\n store.add(new Statement(quad.subject, quad.predicate, x as any, doc as any))\n }\n}\n\n/* Change all lone rdf:nil nodes into empty Collections\n*/\nexport function substituteNillsInDoc (store:Store, doc?: NamedNode) {\n const x = RDF('nil')\n for (const quad of store.statementsMatching(x as any, null, null, doc as any)) {\n store.remove(quad)\n const y = new Collection()\n store.add(new Statement(y as any, quad.predicate, quad.object, doc as any))\n }\n for (const quad of store.statementsMatching(null, null, x as any, doc) as any) {\n if (!quad.predicate.sameTerm(RDF('rest'))) { // If not a tail\n store.remove(quad)\n const y = new Collection()\n store.add(new Statement(quad.subject, quad.predicate, y as any, doc as any))\n }\n }\n}\n/**\n * Convert lists reified as rdf:first, rest\n * Normal method is sync.\n * Unfortunately jsdonld is currently written to need to be called async.\n * Hence the mess below with executeCallback.\n * @param store - The quadstore\n * @param doc - The document in which the conversion is done\n */\n\n\nexport function convertFirstRestNil (\n store: Store,\n doc: NamedNode | undefined, // Do whole store?\n) {\n\n function preceding (ele:BlankNode, listSoFar: Node[], trash: Quad[]): undefined {\n\n const rests = store.statementsMatching(ele, RDF('rest'), null, doc)\n if (rests.length !== 1) throw new Error(`Bad list structure: no rest at ${ele}`)\n\n const firsts = store.statementsMatching(ele, RDF('first'), null, doc)\n if (firsts.length !== 1) throw new Error(`Bad list structure: rest but ${firsts.length} firsts at ${ele}`)\n const value = firsts[0].object\n const total = [value].concat(listSoFar as any)\n // console.log(' List now is: ', total)\n const totalTrash = trash.concat(rests).concat(firsts)\n\n const pres = store.statementsMatching(null, RDF('rest'), ele, doc)\n if (pres.length === 0) { // Head of the list\n const newList = new Collection(total)\n store.remove(totalTrash)\n // Replace old list with new list:\n substituteInDoc(store, newList, ele, doc)\n return\n }\n if (pres.length !== 1) throw new Error(`Bad list structure: ${pres.length} pres at ${ele}`)\n const pre = pres[0].subject\n if (pre.termType !== 'BlankNode') throw new Error(`Bad list element node ${pre} type: ${pre.termType} `)\n\n preceding(pre, total, totalTrash)\n return\n }\n\n substituteNillsInDoc(store, doc) // lone ones only\n\n const tails = store.statementsMatching(null, RDF('rest'), RDF('nil'), doc)\n tails.forEach(tail => {\n if (tail.subject.termType !== 'BlankNode')\n throw new Error(`Bad list element node ${tail.subject} type: ${tail.subject.termType} `)\n preceding(tail.subject, [], [])\n })\n\n}\n","/**\n*\n* UTF-8 data encode / decode\n* http://www.webtoolkit.info/\n*\n**/\nimport * as Uri from './uri'\nimport { ArrayIndexOf } from './utils'\nimport { convertFirstRestNil } from './lists'\n\nfunction hexify (str) { // also used in parser\n return encodeURI(str);\n}\n\nvar Utf8 = {\n // public method for url encoding\n encode : function (string) {\n string = string.replace(/\\r\\n/g,\"\\n\");\n var utftext = \"\";\n\n for (var n = 0; n < string.length; n++) {\n\n var c = string.charCodeAt(n);\n\n if (c < 128) {\n utftext += String.fromCharCode(c);\n }\n else if((c > 127) && (c < 2048)) {\n utftext += String.fromCharCode((c >> 6) | 192);\n utftext += String.fromCharCode((c & 63) | 128);\n }\n else {\n utftext += String.fromCharCode((c >> 12) | 224);\n utftext += String.fromCharCode(((c >> 6) & 63) | 128);\n utftext += String.fromCharCode((c & 63) | 128);\n }\n\n }\n\n return utftext;\n },\n // public method for url decoding\n decode : function (utftext) {\n var string = \"\";\n var i = 0;\n\n while ( i < utftext.length ) {\n\n var c = utftext.charCodeAt(i);\n if (c < 128) {\n string += String.fromCharCode(c);\n i++;\n }\n else if((c > 191) && (c < 224)) {\n string += String.fromCharCode(((c & 31) << 6)\n | (utftext.charCodeAt(i+1) & 63));\n i += 2;\n }\n else {\n string += String.fromCharCode(((c & 15) << 12)\n | ((utftext.charCodeAt(i+1) & 63) << 6)\n | (utftext.charCodeAt(i+2) & 63));\n i += 3;\n }\n }\n return string;\n }\n}// Things we need to define to make converted pythn code work in js\n// environment of $rdf\n\nvar RDFSink_forSomeSym = \"http://www.w3.org/2000/10/swap/log#forSome\";\nvar RDFSink_forAllSym = \"http://www.w3.org/2000/10/swap/log#forAll\";\nvar Logic_NS = \"http://www.w3.org/2000/10/swap/log#\";\n\n// pyjs seems to reference runtime library which I didn't find\n\nvar pyjslib_Tuple = function(theList) { return theList };\n\nvar pyjslib_List = function(theList) { return theList };\n\nvar pyjslib_Dict = function(listOfPairs) {\n if (listOfPairs.length > 0)\n\tthrow \"missing.js: oops nnonempty dict not imp\";\n return [];\n}\n\nvar pyjslib_len = function(s) { return s.length }\n\nvar pyjslib_slice = function(str, i, j) {\n if (typeof str.slice == 'undefined')\n throw '@@ mising.js: No .slice function for '+str+' of type '+(typeof str)\n if ((typeof j == 'undefined') || (j ==null)) return str.slice(i);\n return str.slice(i, j) // @ exactly the same spec?\n}\nvar StopIteration = Error('dummy error stop iteration');\n\nvar pyjslib_Iterator = function(theList) {\n this.last = 0;\n this.li = theList;\n this.next = function() {\n\tif (this.last == this.li.length) throw StopIteration;\n\treturn this.li[this.last++];\n }\n return this;\n};\n\nvar ord = function(str) {\n return str.charCodeAt(0)\n}\n\nvar string_find = function(str, s) {\n return str.indexOf(s)\n}\n\nvar assertFudge = function(condition, desc) {\n if (condition) return;\n if (desc) throw \"python Assertion failed: \"+desc;\n throw \"(python) Assertion failed.\";\n}\n\n\nvar stringFromCharCode = function(uesc) {\n return String.fromCharCode(uesc);\n}\n\n\nString.prototype.encode = function(encoding) {\n if (encoding != 'utf-8') throw \"UTF8_converter: can only do utf-8\"\n return Utf8.encode(this);\n}\nString.prototype.decode = function(encoding) {\n if (encoding != 'utf-8') throw \"UTF8_converter: can only do utf-8\"\n //return Utf8.decode(this);\n return this;\n}\n\n\n\nvar uripath_join = function(base, given) {\n return Uri.join(given, base) // sad but true\n}\n\nvar becauseSubexpression = null; // No reason needed\nvar diag_tracking = 0;\nvar diag_chatty_flag = 0;\nvar diag_progress = function(str) { /*$rdf.log.debug(str);*/ }\n\n// why_BecauseOfData = function(doc, reason) { return doc };\n\n\nvar RDF_type_URI = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\";\nvar RDF_nil_URI = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil\";\nvar DAML_sameAs_URI = \"http://www.w3.org/2002/07/owl#sameAs\";\n\n/*\nfunction SyntaxError(details) {\n return new __SyntaxError(details);\n}\n*/\n\nfunction __SyntaxError(details) {\n this.details = details\n}\n\n/*\n\n$Id: n3parser.js 14561 2008-02-23 06:37:26Z kennyluck $\n\nHAND EDITED FOR CONVERSION TO JAVASCRIPT\n\nThis module implements a Nptation3 parser, and the final\npart of a notation3 serializer.\n\nSee also:\n\nNotation 3\nhttp://www.w3.org/DesignIssues/Notation3\n\nClosed World Machine - and RDF Processor\nhttp://www.w3.org/2000/10/swap/cwm\n\nTo DO: See also \"@@\" in comments\n\n- Clean up interfaces\n______________________________________________\n\nModule originally by Dan Connolly, includeing notation3\nparser and RDF generator. TimBL added RDF stream model\nand N3 generation, replaced stream model with use\nof common store/formula API. Yosi Scharf developped\nthe module, including tests and test harness.\n\n*/\n\nvar ADDED_HASH = \"#\";\nvar LOG_implies_URI = \"http://www.w3.org/2000/10/swap/log#implies\";\nvar INTEGER_DATATYPE = \"http://www.w3.org/2001/XMLSchema#integer\";\nvar FLOAT_DATATYPE = \"http://www.w3.org/2001/XMLSchema#double\";\nvar DECIMAL_DATATYPE = \"http://www.w3.org/2001/XMLSchema#decimal\";\nvar DATE_DATATYPE = \"http://www.w3.org/2001/XMLSchema#date\";\nvar DATETIME_DATATYPE = \"http://www.w3.org/2001/XMLSchema#dateTime\";\nvar BOOLEAN_DATATYPE = \"http://www.w3.org/2001/XMLSchema#boolean\";\nvar option_noregen = 0;\nvar _notQNameChars = \"\\t\\r\\n !\\\"#$%&'()*.,+/;<=>?@[\\\\]^`{|}~\";\nvar _notNameChars = ( _notQNameChars + \":\" ) ;\nvar _rdfns = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\";\nvar N3CommentCharacter = \"#\";\nvar eol = new RegExp(\"^[ \\\\t]*(#[^\\\\n]*)?\\\\r?\\\\n\", 'g');\nvar eof = new RegExp(\"^[ \\\\t]*(#[^\\\\n]*)?$\", 'g');\nvar ws = new RegExp(\"^[ \\\\t]*\", 'g');\nvar signed_integer = new RegExp(\"^[-+]?[0-9]+\", 'g');\nvar number_syntax = new RegExp(\"^([-+]?[0-9]+)(\\\\.[0-9]+)?([eE][-+]?[0-9]+)?\", 'g');\nvar datetime_syntax = new RegExp('^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9](T[0-9][0-9]:[0-9][0-9](:[0-9][0-9](\\\\.[0-9]*)?)?)?Z?');\n\nvar digitstring = new RegExp(\"^[0-9]+\", 'g');\nvar interesting = new RegExp(\"[\\\\\\\\\\\\r\\\\n\\\\\\\"]\", 'g');\nvar langcode = new RegExp(\"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*\", 'g');\n\nfunction createSinkParser(store, openFormula, thisDoc, baseURI, genPrefix, metaURI, flags, why) {\n return new SinkParser(store, openFormula, thisDoc, baseURI, genPrefix, metaURI, flags, why);\n}\n\nexport default createSinkParser;\n\nexport class SinkParser {\n constructor(store, openFormula, thisDoc, baseURI, genPrefix, metaURI, flags, why) {\n if (typeof openFormula == 'undefined') openFormula=null;\n if (typeof thisDoc == 'undefined') thisDoc=\"\";\n if (typeof baseURI == 'undefined') baseURI=null;\n if (typeof genPrefix == 'undefined') genPrefix=\"\";\n if (typeof metaURI == 'undefined') metaURI=null;\n if (typeof flags == 'undefined') flags=\"\";\n if (typeof why == 'undefined') why=null;\n /*\n note: namespace names should *not* end in #;\n the # will get added during qname processing */\n\n this._bindings = new pyjslib_Dict([]);\n this._flags = flags;\n if ((thisDoc != \"\")) {\n assertFudge((thisDoc.indexOf(\":\") >= 0), ( \"Document URI not absolute: \" + thisDoc ) );\n this._bindings[\"\"] = ( ( thisDoc + \"#\" ) );\n }\n this._store = store;\n if (genPrefix) {\n store.setGenPrefix(genPrefix);\n }\n this._thisDoc = thisDoc;\n this.source = store.sym(thisDoc);\n this.lines = 0;\n this.statementCount = 0;\n this.hasNil = false;\n this.startOfLine = 0;\n this.previousLine = 0;\n this._genPrefix = genPrefix;\n this.keywords = new pyjslib_List([\"a\", \"this\", \"bind\", \"has\", \"is\", \"of\", \"true\", \"false\"]);\n this.keywordsSet = 0;\n this._anonymousNodes = new pyjslib_Dict([]);\n this._variables = new pyjslib_Dict([]);\n this._parentVariables = new pyjslib_Dict([]);\n this._reason = why;\n this._reason2 = null;\n if (diag_tracking) {\n this._reason2 = why_BecauseOfData(store.sym(thisDoc), this._reason);\n }\n if (baseURI) {\n this._baseURI = baseURI;\n }\n else {\n if (thisDoc) {\n this._baseURI = thisDoc;\n }\n else {\n this._baseURI = null;\n }\n }\n assertFudge(!(this._baseURI) || (this._baseURI.indexOf(\":\") >= 0));\n if (!(this._genPrefix)) {\n if (this._thisDoc) {\n this._genPrefix = ( this._thisDoc + \"#_g\" ) ;\n }\n else {\n this._genPrefix = RDFSink_uniqueURI();\n }\n }\n if ((openFormula == null)) {\n if (this._thisDoc) {\n this._formula = store.formula( ( thisDoc + \"#_formula\" ) );\n }\n else {\n this._formula = store.formula();\n }\n }\n else {\n this._formula = openFormula;\n }\n this._context = this._formula;\n this._parentContext = null;\n }\n\n\n here(i) {\n return ( ( ( ( this._genPrefix + \"_L\" ) + this.lines ) + \"C\" ) + ( ( i - this.startOfLine ) + 1 ) ) ;\n };\n formula() {\n return this._formula;\n };\n loadStream(stream) {\n return this.loadBuf(stream.read());\n };\n loadBuf(buf) {\n /*\n Parses a buffer and returns its top level formula*/\n\n this.startDoc();\n this.feed(buf);\n return this.endDoc();\n };\n feed(octets) {\n /*\n Feed an octet stream tothe parser\n\n if BadSyntax is raised, the string\n passed in the exception object is the\n remainder after any statements have been parsed.\n So if there is more data to feed to the\n parser, it should be straightforward to recover.*/\n\n var str = octets.decode(\"utf-8\");\n var i = 0;\n while ((i >= 0)) {\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return;\n }\n var i = this.directiveOrStatement(str, j);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected directive or statement\");\n }\n }\n };\n directiveOrStatement(str, h) {\n var i = this.skipSpace(str, h);\n if ((i < 0)) {\n return i;\n }\n var j = this.directive(str, i);\n if ((j >= 0)) {\n return this.checkDot(str, j);\n }\n var j = this.statement(str, i);\n if ((j >= 0)) {\n return this.checkDot(str, j);\n }\n return j;\n };\n tok(tok, str, i) {\n /*\n Check for keyword. Space must have been stripped on entry and\n we must not be at end of file.*/\n var whitespace = \"\\t\\n\\v\\f\\r \";\n if ((str.slice( i, ( i + 1 ) ) == \"@\")) {\n var i = ( i + 1 ) ;\n }\n else {\n if ((ArrayIndexOf(this.keywords,tok) < 0)) {\n return -1;\n }\n }\n var k = ( i + pyjslib_len(tok) ) ;\n if ((str.slice( i, k) == tok) && (_notQNameChars.indexOf(str.charAt(k)) >= 0)) {\n return k;\n }\n else {\n return -1;\n }\n };\n directive(str, i) {\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return j;\n }\n var res = new pyjslib_List([]);\n var j = this.tok(\"bind\", str, i);\n if ((j > 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"keyword bind is obsolete: use @prefix\");\n }\n var j = this.tok(\"keywords\", str, i);\n if ((j > 0)) {\n var i = this.commaSeparatedList(str, j, res, false);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"'@keywords' needs comma separated list of words\");\n }\n this.setKeywords(pyjslib_slice(res, null, null));\n if ((diag_chatty_flag > 80)) {\n diag_progress(\"Keywords \", this.keywords);\n }\n return i;\n }\n var j = this.tok(\"forAll\", str, i);\n if ((j > 0)) {\n var i = this.commaSeparatedList(str, j, res, true);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"Bad variable list after @forAll\");\n }\n\n var __x = new pyjslib_Iterator(res);\n try {\n while (true) {\n var x = __x.next();\n\n\n if (ArrayIndexOf(this._variables,x) < 0 || (ArrayIndexOf(this._parentVariables,x) >= 0)) {\n this._variables[x] = ( this._context.newUniversal(x));\n }\n\n }\n } catch (e) {\n if (e != StopIteration) {\n throw e;\n }\n }\n\n return i;\n }\n var j = this.tok(\"forSome\", str, i);\n if ((j > 0)) {\n var i = this.commaSeparatedList(str, j, res, this.uri_ref2);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"Bad variable list after @forSome\");\n }\n\n var __x = new pyjslib_Iterator(res);\n try {\n while (true) {\n var x = __x.next();\n\n\n this._context.declareExistential(x);\n\n }\n } catch (e) {\n if (e != StopIteration) {\n throw e;\n }\n }\n\n return i;\n }\n var j = this.tok(\"prefix\", str, i);\n if ((j >= 0)) {\n var t = new pyjslib_List([]);\n var i = this.qname(str, j, t);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected qname after @prefix\");\n }\n var j = this.uri_ref2(str, i, t);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected after @prefix _qname_\");\n }\n var ns = t[1].uri;\n if (this._baseURI) {\n var ns = uripath_join(this._baseURI, ns);\n }\n else {\n assertFudge((ns.indexOf(\":\") >= 0), \"With no base URI, cannot handle relative URI for NS\");\n }\n assertFudge((ns.indexOf(\":\") >= 0));\n this._bindings[t[0][0]] = ( ns);\n\n this.bind(t[0][0], hexify(ns));\n return j;\n }\n var j = this.tok(\"base\", str, i);\n if ((j >= 0)) {\n var t = new pyjslib_List([]);\n var i = this.uri_ref2(str, j, t);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected after @base \");\n }\n var ns = t[0].uri;\n if (this._baseURI) {\n var ns = uripath_join(this._baseURI, ns);\n }\n else {\n throw BadSyntax(this._thisDoc, this.lines, str, j, ( ( \"With no previous base URI, cannot use relative URI in @base <\" + ns ) + \">\" ) );\n }\n assertFudge((ns.indexOf(\":\") >= 0));\n this._baseURI = ns;\n return i;\n }\n return -1;\n };\n bind(qn, uri) {\n if ((qn == \"\")) {\n }\n else {\n this._store.setPrefixForURI(qn, uri);\n }\n };\n setKeywords(k) {\n /*\n Takes a list of strings*/\n\n if ((k == null)) {\n this.keywordsSet = 0;\n }\n else {\n this.keywords = k;\n this.keywordsSet = 1;\n }\n };\n startDoc() {\n };\n\n /* Signal end of document and stop parsing. returns formula */\n endDoc() {\n if (this.hasNil && this._store.rdfFactory.supports[\"COLLECTIONS\"]) {\n convertFirstRestNil(this._store, this.source)\n }\n return this._formula;\n };\n makeStatement(quad) {\n quad[0].add(quad[2], quad[1], quad[3], this.source);\n if ((quad[2].uri && quad[2].uri === RDF_nil_URI)\n || (quad[3].uri && quad[3].uri === RDF_nil_URI)) {\n this.hasNil = true\n }\n this.statementCount += 1;\n };\n statement(str, i) {\n var r = new pyjslib_List([]);\n var i = this.object(str, i, r);\n if ((i < 0)) {\n return i;\n }\n var j = this.property_list(str, i, r[0]);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected propertylist\");\n }\n return j;\n };\n subject(str, i, res) {\n return this.item(str, i, res);\n };\n verb(str, i, res) {\n /*\n has _prop_\n is _prop_ of\n a\n =\n _prop_\n >- prop ->\n <- prop -<\n _operator_*/\n\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return j;\n }\n var r = new pyjslib_List([]);\n var j = this.tok(\"has\", str, i);\n if ((j >= 0)) {\n var i = this.prop(str, j, r);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected property after 'has'\");\n }\n res.push(new pyjslib_Tuple([\"->\", r[0]]));\n return i;\n }\n var j = this.tok(\"is\", str, i);\n if ((j >= 0)) {\n var i = this.prop(str, j, r);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected after 'is'\");\n }\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"End of file found, expected property after 'is'\");\n return j;\n }\n var i = j;\n var j = this.tok(\"of\", str, i);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected 'of' after 'is' \");\n }\n res.push(new pyjslib_Tuple([\"<-\", r[0]]));\n return j;\n }\n var j = this.tok(\"a\", str, i);\n if ((j >= 0)) {\n res.push(new pyjslib_Tuple([\"->\", this._store.sym(RDF_type_URI)]));\n return j;\n }\n if ((str.slice( i, ( i + 2 ) ) == \"<=\")) {\n res.push(new pyjslib_Tuple([\"<-\", this._store.sym( ( Logic_NS + \"implies\" ) )]));\n return ( i + 2 ) ;\n }\n if ((str.slice( i, ( i + 1 ) ) == \"=\")) {\n if ((str.slice( ( i + 1 ) , ( i + 2 ) ) == \">\")) {\n res.push(new pyjslib_Tuple([\"->\", this._store.sym( ( Logic_NS + \"implies\" ) )]));\n return ( i + 2 ) ;\n }\n res.push(new pyjslib_Tuple([\"->\", this._store.sym(DAML_sameAs_URI)]));\n return ( i + 1 ) ;\n }\n if ((str.slice( i, ( i + 2 ) ) == \":=\")) {\n res.push(new pyjslib_Tuple([\"->\", ( Logic_NS + \"becomes\" ) ]));\n return ( i + 2 ) ;\n }\n var j = this.prop(str, i, r);\n if ((j >= 0)) {\n res.push(new pyjslib_Tuple([\"->\", r[0]]));\n return j;\n }\n if ((str.slice( i, ( i + 2 ) ) == \">-\") || (str.slice( i, ( i + 2 ) ) == \"<-\")) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \">- ... -> syntax is obsolete.\");\n }\n return -1;\n };\n prop(str, i, res) {\n return this.item(str, i, res);\n };\n item(str, i, res) {\n return this.path(str, i, res);\n };\n blankNode(uri) {\n return this._context.bnode(uri, this._reason2);\n };\n path(str, i, res) {\n /*\n Parse the path production.\n */\n\n var j = this.nodeOrLiteral(str, i, res);\n if ((j < 0)) {\n return j;\n }\n while ((\"!^.\".indexOf(str.slice( j, ( j + 1 ) )) >= 0)) {\n var ch = str.slice( j, ( j + 1 ) );\n if ((ch == \".\")) {\n var ahead = str.slice( ( j + 1 ) , ( j + 2 ) );\n if (!(ahead) || (_notNameChars.indexOf(ahead) >= 0) && (\":?<[{(\".indexOf(ahead) < 0)) {\n break;\n }\n }\n var subj = res.pop();\n var obj = this.blankNode(this.here(j));\n var j = this.node(str, ( j + 1 ) , res);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"EOF found in middle of path syntax\");\n }\n var pred = res.pop();\n if ((ch == \"^\")) {\n this.makeStatement(new pyjslib_Tuple([this._context, pred, obj, subj]));\n }\n else {\n this.makeStatement(new pyjslib_Tuple([this._context, pred, subj, obj]));\n }\n res.push(obj);\n }\n return j;\n };\n anonymousNode(ln) {\n /*\n Remember or generate a term for one of these _: anonymous nodes*/\n\n var term = this._anonymousNodes[ln];\n if (term) {\n return term;\n }\n var term = this._store.bnode(ln);\n // var term = this._store.bnode(this._context, this._reason2); eh?\n this._anonymousNodes[ln] = ( term);\n return term;\n };\n node(str, i, res, subjectAlready) {\n if (typeof subjectAlready == 'undefined') subjectAlready=null;\n /*\n Parse the production.\n Space is now skipped once at the beginning\n instead of in multipe calls to self.skipSpace().\n */\n\n var subj = subjectAlready;\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return j;\n }\n var i = j;\n var ch = str.slice( i, ( i + 1 ) );\n if ((ch == \"[\")) {\n var bnodeID = this.here(i);\n var j = this.skipSpace(str, ( i + 1 ) );\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"EOF after '['\");\n }\n if ((str.slice( j, ( j + 1 ) ) == \"=\")) {\n var i = ( j + 1 ) ;\n var objs = new pyjslib_List([]);\n var j = this.objectList(str, i, objs);\n\n if ((j >= 0)) {\n var subj = objs[0];\n if ((pyjslib_len(objs) > 1)) {\n\n var __obj = new pyjslib_Iterator(objs);\n try {\n while (true) {\n var obj = __obj.next();\n\n\n this.makeStatement(new pyjslib_Tuple([this._context, this._store.sym(DAML_sameAs_URI), subj, obj]));\n\n }\n } catch (e) {\n if (e != StopIteration) {\n throw e;\n }\n }\n\n }\n var j = this.skipSpace(str, j);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"EOF when objectList expected after [ = \");\n }\n if ((str.slice( j, ( j + 1 ) ) == \";\")) {\n var j = ( j + 1 ) ;\n }\n }\n else {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"objectList expected after [= \");\n }\n }\n if ((subj == null)) {\n var subj = this.blankNode(bnodeID);\n }\n var i = this.property_list(str, j, subj);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"property_list expected\");\n }\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"EOF when ']' expected after [ \");\n }\n if ((str.slice( j, ( j + 1 ) ) != \"]\")) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"']' expected\");\n }\n res.push(subj);\n return ( j + 1 ) ;\n }\n if ((ch == \"{\")) {\n var ch2 = str.slice( ( i + 1 ) , ( i + 2 ) );\n if ((ch2 == \"$\")) {\n i += 1;\n var j = ( i + 1 ) ;\n var mylist = new pyjslib_List([]);\n var first_run = true;\n while (1) {\n var i = this.skipSpace(str, j);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"needed '$}', found end.\");\n }\n if ((str.slice( i, ( i + 2 ) ) == \"$}\")) {\n var j = ( i + 2 ) ;\n break;\n }\n if (!(first_run)) {\n if ((str.slice( i, ( i + 1 ) ) == \",\")) {\n i += 1;\n }\n else {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected: ','\");\n }\n }\n else {\n var first_run = false;\n }\n var item = new pyjslib_List([]);\n var j = this.item(str, i, item);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected item in set or '$}'\");\n }\n mylist.push(item[0]);\n }\n res.push(this._store.newSet(mylist, this._context));\n return j;\n }\n else {\n var j = ( i + 1 ) ;\n var oldParentContext = this._parentContext;\n this._parentContext = this._context;\n var parentAnonymousNodes = this._anonymousNodes;\n var grandParentVariables = this._parentVariables;\n this._parentVariables = this._variables;\n this._anonymousNodes = new pyjslib_Dict([]);\n this._variables = this._variables.slice();\n var reason2 = this._reason2;\n this._reason2 = becauseSubexpression;\n if ((subj == null)) {\n var subj = this._store.formula();\n }\n this._context = subj;\n while (1) {\n var i = this.skipSpace(str, j);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"needed '}', found end.\");\n }\n if ((str.slice( i, ( i + 1 ) ) == \"}\")) {\n var j = ( i + 1 ) ;\n break;\n }\n var j = this.directiveOrStatement(str, i);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected statement or '}'\");\n }\n }\n this._anonymousNodes = parentAnonymousNodes;\n this._variables = this._parentVariables;\n this._parentVariables = grandParentVariables;\n this._context = this._parentContext;\n this._reason2 = reason2;\n this._parentContext = oldParentContext;\n res.push(subj.close());\n return j;\n }\n }\n if ((ch == \"(\")) {\n var thing_type = this._store.list;\n var ch2 = str.slice( ( i + 1 ) , ( i + 2 ) );\n if ((ch2 == \"$\")) {\n var thing_type = this._store.newSet;\n i += 1;\n }\n var j = ( i + 1 ) ;\n var mylist = new pyjslib_List([]);\n while (1) {\n var i = this.skipSpace(str, j);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"needed ')', found end.\");\n }\n if ((str.slice( i, ( i + 1 ) ) == \")\")) {\n var j = ( i + 1 ) ;\n break;\n }\n var item = new pyjslib_List([]);\n var j = this.item(str, i, item);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected item in list or ')'\");\n }\n mylist.push(item[0]);\n }\n res.push(thing_type(mylist, this._context));\n return j;\n }\n var j = this.tok(\"this\", str, i);\n if ((j >= 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"Keyword 'this' was ancient N3. Now use @forSome and @forAll keywords.\");\n res.push(this._context);\n return j;\n }\n var j = this.tok(\"true\", str, i);\n if ((j >= 0)) {\n res.push(true);\n return j;\n }\n var j = this.tok(\"false\", str, i);\n if ((j >= 0)) {\n res.push(false);\n return j;\n }\n if ((subj == null)) {\n var j = this.uri_ref2(str, i, res);\n if ((j >= 0)) {\n return j;\n }\n }\n return -1;\n };\n property_list(str, i, subj) {\n /*\n Parse property list\n Leaves the terminating punctuation in the buffer\n */\n\n while (1) {\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"EOF found when expected verb in property list\");\n return j;\n }\n if ((str.slice( j, ( j + 2 ) ) == \":-\")) {\n var i = ( j + 2 ) ;\n var res = new pyjslib_List([]);\n var j = this.node(str, i, res, subj);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"bad {} or () or [] node after :- \");\n }\n var i = j;\n continue;\n }\n var i = j;\n var v = new pyjslib_List([]);\n var j = this.verb(str, i, v);\n if ((j <= 0)) {\n return i;\n }\n var objs = new pyjslib_List([]);\n var i = this.objectList(str, j, objs);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"objectList expected\");\n }\n\n var __obj = new pyjslib_Iterator(objs);\n try {\n while (true) {\n var obj = __obj.next();\n\n\n var pairFudge = v[0];\n var dir = pairFudge[0];\n var sym = pairFudge[1];\n if ((dir == \"->\")) {\n this.makeStatement(new pyjslib_Tuple([this._context, sym, subj, obj]));\n }\n else {\n this.makeStatement(new pyjslib_Tuple([this._context, sym, obj, subj]));\n }\n\n }\n } catch (e) {\n if (e != StopIteration) {\n throw e;\n }\n }\n\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"EOF found in list of objects\");\n return j;\n }\n if ((str.slice( i, ( i + 1 ) ) != \";\")) {\n return i;\n }\n var i = ( i + 1 ) ;\n }\n };\n commaSeparatedList(str, j, res, ofUris) {\n /*\n return value: -1 bad syntax; >1 new position in str\n res has things found appended\n\n Used to use a final value of the function to be called, e.g. this.bareWord\n but passing the function didn't work fo js converion pyjs\n */\n\n var i = this.skipSpace(str, j);\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"EOF found expecting comma sep list\");\n return i;\n }\n if ((str.charAt(i) == \".\")) {\n return j;\n }\n if (ofUris) {\n var i = this.uri_ref2(str, i, res);\n }\n else {\n var i = this.bareWord(str, i, res);\n }\n if ((i < 0)) {\n return -1;\n }\n while (1) {\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return j;\n }\n var ch = str.slice( j, ( j + 1 ) );\n if ((ch != \",\")) {\n if ((ch != \".\")) {\n return -1;\n }\n return j;\n }\n if (ofUris) {\n var i = this.uri_ref2(str, ( j + 1 ) , res);\n }\n else {\n var i = this.bareWord(str, ( j + 1 ) , res);\n }\n if ((i < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"bad list content\");\n return i;\n }\n }\n };\n objectList(str, i, res) {\n var i = this.object(str, i, res);\n if ((i < 0)) {\n return -1;\n }\n while (1) {\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"EOF found after object\");\n return j;\n }\n if ((str.slice( j, ( j + 1 ) ) != \",\")) {\n return j;\n }\n var i = this.object(str, ( j + 1 ) , res);\n if ((i < 0)) {\n return i;\n }\n }\n };\n checkDot(str, i) {\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return j;\n }\n if ((str.slice( j, ( j + 1 ) ) == \".\")) {\n return ( j + 1 ) ;\n }\n if ((str.slice( j, ( j + 1 ) ) == \"}\")) {\n return j;\n }\n if ((str.slice( j, ( j + 1 ) ) == \"]\")) {\n return j;\n }\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected '.' or '}' or ']' at end of statement\");\n return i;\n };\n uri_ref2(str, i, res) {\n /*\n Generate uri from n3 representation.\n\n Note that the RDF convention of directly concatenating\n NS and local name is now used though I prefer inserting a '#'\n to make the namesapces look more like what XML folks expect.\n */\n\n var qn = new pyjslib_List([]);\n var j = this.qname(str, i, qn);\n if ((j >= 0)) {\n var pairFudge = qn[0];\n var pfx = pairFudge[0];\n var ln = pairFudge[1];\n if ((pfx == null)) {\n assertFudge(0, \"not used?\");\n var ns = ( this._baseURI + ADDED_HASH ) ;\n }\n else {\n var ns = this._bindings[pfx];\n if (!(ns)) {\n if ((pfx == \"_\")) {\n res.push(this.anonymousNode(ln));\n return j;\n }\n throw BadSyntax(this._thisDoc, this.lines, str, i, ( ( \"Prefix \" + pfx ) + \" not bound.\" ) );\n }\n }\n var symb = this._store.sym( ( ns + ln ) );\n if ((ArrayIndexOf(this._variables, symb) >= 0)) {\n res.push(this._variables[symb]);\n }\n else {\n res.push(symb);\n }\n return j;\n }\n var i = this.skipSpace(str, i);\n if ((i < 0)) {\n return -1;\n }\n if ((str.charAt(i) == \"?\")) {\n var v = new pyjslib_List([]);\n var j = this.variable(str, i, v);\n if ((j > 0)) {\n res.push(v[0]);\n return j;\n }\n return -1;\n }\n else if ((str.charAt(i) == \"<\")) {\n var i = ( i + 1 ) ;\n var st = i;\n while ((i < pyjslib_len(str))) {\n if ((str.charAt(i) == \">\")) {\n var uref = str.slice( st, i);\n if (this._baseURI) {\n var uref = uripath_join(this._baseURI, uref);\n }\n else {\n assertFudge((uref.indexOf(\":\") >= 0), \"With no base URI, cannot deal with relative URIs\");\n }\n if ((str.slice( ( i - 1 ) , i) == \"#\") && !((pyjslib_slice(uref, -1, null) == \"#\"))) {\n var uref = ( uref + \"#\" ) ;\n }\n var symb = this._store.sym(uref);\n if ((ArrayIndexOf(this._variables,symb) >= 0)) {\n res.push(this._variables[symb]);\n }\n else {\n res.push(symb);\n }\n return ( i + 1 ) ;\n }\n var i = ( i + 1 ) ;\n }\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"unterminated URI reference\");\n }\n else if (this.keywordsSet) {\n var v = new pyjslib_List([]);\n var j = this.bareWord(str, i, v);\n if ((j < 0)) {\n return -1;\n }\n if ((ArrayIndexOf(this.keywords, v[0]) >= 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, ( ( \"Keyword \\\"\" + v[0] ) + \"\\\" not allowed here.\" ) );\n }\n res.push(this._store.sym( ( this._bindings[\"\"] + v[0] ) ));\n return j;\n }\n else {\n return -1;\n }\n };\n skipSpace(str, i) {\n /*\n Skip white space, newlines and comments.\n return -1 if EOF, else position of first non-ws character*/\n\n var whitespace = ' \\n\\r\\t\\f\\x0b\\xa0\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u200b\\u2028\\u2029\\u3000';\n for (var j = (i ? i : 0); j < str.length; j++) {\n var ch = str.charAt(j);\n // console.log(\" skipspace j= \"+j + \" i= \" + i + \" n= \" + str.length);\n // console.log(\" skipspace ch <\" + ch + \">\");\n if (whitespace.indexOf(ch) < 0 ) { //not ws\n // console.log(\" skipspace 2 ch <\" + ch + \">\");\n if( str.charAt(j)==='#' ) {\n for (;; j++) {\n // console.log(\" skipspace2 j= \"+j + \" i= \" + i + \" n= \" + str.length);\n if (j === str.length) {\n return -1; // EOF\n }\n if (str.charAt(j) === '\\n') {\n this.lines = this.lines + 1;\n break;\n }\n };\n } else { // Not hash - something interesting\n // console.log(\" skipspace 3 ch <\" + ch + \">\");\n return j\n }\n } else { // Whitespace\n // console.log(\" skipspace 5 ch <\" + ch + \">\");\n if (str.charAt(j) === '\\n') {\n this.lines = this.lines + 1;\n }\n }\n } // next j\n return -1; // EOF\n };\n\n variable(str, i, res) {\n /*\n ?abc -> variable(:abc)\n */\n\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return -1;\n }\n if ((str.slice( j, ( j + 1 ) ) != \"?\")) {\n return -1;\n }\n var j = ( j + 1 ) ;\n var i = j;\n if ((\"0123456789-\".indexOf(str.charAt(j)) >= 0)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, ( ( \"Varible name can't start with '\" + str.charAt(j) ) + \"s'\" ) );\n return -1;\n }\n while ((i < pyjslib_len(str)) && (_notNameChars.indexOf(str.charAt(i)) < 0)) {\n var i = ( i + 1 ) ;\n }\n if ((this._parentContext == null)) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, ( \"Can't use ?xxx syntax for variable in outermost level: \" + str.slice( ( j - 1 ) , i) ) );\n }\n res.push(this._store.variable(str.slice( j, i)));\n return i;\n };\n bareWord(str, i, res) {\n /*\n abc -> :abc\n */\n\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return -1;\n }\n var ch = str.charAt(j);\n if ((\"0123456789-\".indexOf(ch) >= 0)) {\n return -1;\n }\n if ((_notNameChars.indexOf(ch) >= 0)) {\n return -1;\n }\n var i = j;\n while ((i < pyjslib_len(str)) && (_notNameChars.indexOf(str.charAt(i)) < 0)) {\n var i = ( i + 1 ) ;\n }\n res.push(str.slice( j, i));\n return i;\n };\n qname(str, i, res) {\n /*\n\n xyz:def -> ('xyz', 'def')\n If not in keywords and keywordsSet: def -> ('', 'def')\n :def -> ('', 'def')\n */\n\n var i = this.skipSpace(str, i);\n if ((i < 0)) {\n return -1;\n }\n var c = str.charAt(i);\n if ((\"0123456789-+\".indexOf(c) >= 0)) {\n return -1;\n }\n if ((_notNameChars.indexOf(c) < 0)) {\n var ln = c;\n var i = ( i + 1 ) ;\n while ((i < pyjslib_len(str))) {\n var c = str.charAt(i);\n if ((_notNameChars.indexOf(c) < 0)) {\n var ln = ( ln + c ) ;\n var i = ( i + 1 ) ;\n }\n else {\n break;\n }\n }\n }\n else {\n var ln = \"\";\n }\n if ((i < pyjslib_len(str)) && (str.charAt(i) == \":\")) {\n var pfx = ln;\n var i = ( i + 1 ) ;\n var ln = \"\";\n while ((i < pyjslib_len(str))) {\n var c = str.charAt(i);\n if ((_notNameChars.indexOf(c) < 0)) {\n var ln = ( ln + c ) ;\n var i = ( i + 1 ) ;\n }\n else {\n break;\n }\n }\n res.push(new pyjslib_Tuple([pfx, ln]));\n return i;\n }\n else {\n if (ln && this.keywordsSet && (ArrayIndexOf(this.keywords, ln) < 0)) {\n res.push(new pyjslib_Tuple([\"\", ln]));\n return i;\n }\n return -1;\n }\n };\n object(str, i, res) {\n var j = this.subject(str, i, res);\n if ((j >= 0)) {\n return j;\n }\n else {\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return -1;\n }\n else {\n var i = j;\n }\n var delim = null\n let ch = str.charAt(i)\n if ((ch == \"\\\"\" || ch == \"'\")) {\n if (str.slice(i, ( i + 3 ) == ch + ch)) {\n delim = ch + ch + ch;\n }\n else {\n delim = ch;\n }\n var i = ( i + pyjslib_len(delim) ) ;\n var pairFudge = this.strconst(str, i, delim);\n var j = pairFudge[0];\n var s = pairFudge[1];\n res.push(this._store.literal(s));\n diag_progress(\"New string const \", s, j);\n return j;\n }\n else {\n return -1;\n }\n }\n };\n nodeOrLiteral(str, i, res) {\n var j = this.node(str, i, res);\n if ((j >= 0)) {\n return j;\n }\n else {\n var j = this.skipSpace(str, i);\n if ((j < 0)) {\n return -1;\n }\n else {\n var i = j;\n }\n var ch = str.charAt(i);\n if ((\"-+0987654321\".indexOf(ch) >= 0)) {\n\n datetime_syntax.lastIndex = 0;\n var m = datetime_syntax.exec(str.slice(i));\n if ((m != null)) {\n // j = ( i + datetime_syntax.lastIndex ) ;\n var val = m[0];\n j = i + val.length;\n if ((val.indexOf(\"T\") >= 0)) {\n res.push(this._store.literal(val, this._store.sym(DATETIME_DATATYPE)));\n } else {\n res.push(this._store.literal(val, this._store.sym(DATE_DATATYPE)));\n }\n\n } else {\n number_syntax.lastIndex = 0;\n var m = number_syntax.exec(str.slice(i));\n if ((m == null)) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"Bad number or date syntax\");\n }\n j = ( i + number_syntax.lastIndex ) ;\n var val = str.slice( i, j);\n if ((val.indexOf(\"e\") >= 0)) {\n res.push(this._store.literal(parseFloat(val), this._store.sym(FLOAT_DATATYPE)));\n }\n else if ((str.slice( i, j).indexOf(\".\") >= 0)) {\n res.push(this._store.literal(parseFloat(val), this._store.sym(DECIMAL_DATATYPE)));\n }\n else {\n res.push(this._store.literal(parseInt(val), this._store.sym(INTEGER_DATATYPE)));\n }\n };\n return j; // Where we have got up to\n }\n if ((str.charAt(i) == \"\\\"\")) {\n if ((str.slice( i, ( i + 3 ) ) == \"\\\"\\\"\\\"\")) {\n var delim = \"\\\"\\\"\\\"\";\n }\n else {\n var delim = \"\\\"\";\n }\n var i = ( i + pyjslib_len(delim) ) ;\n var dt = null;\n var pairFudge = this.strconst(str, i, delim);\n var j = pairFudge[0];\n var s = pairFudge[1];\n var lang = null;\n if ((str.slice( j, ( j + 1 ) ) == \"@\")) {\n langcode.lastIndex = 0;\n\n var m = langcode.exec(str.slice( ( j + 1 ) ));\n if ((m == null)) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"Bad language code syntax on string literal, after @\");\n }\n var i = ( ( langcode.lastIndex + j ) + 1 ) ;\n\n var lang = str.slice( ( j + 1 ) , i);\n var j = i;\n }\n if ((str.slice( j, ( j + 2 ) ) == \"^^\")) {\n var res2 = new pyjslib_List([]);\n var j = this.uri_ref2(str, ( j + 2 ) , res2);\n var dt = res2[0];\n }\n res.push(this._store.literal(s, lang || dt));\n return j;\n }\n else {\n return -1;\n }\n }\n };\n strconst(str, i, delim) {\n /*\n parse an N3 string constant delimited by delim.\n return index, val\n */\n\n var j = i;\n var ustr = \"\";\n var startline = this.lines;\n while ((j < pyjslib_len(str))) {\n var i = ( j + pyjslib_len(delim) ) ;\n if ((str.slice( j, i) == delim)) {\n return new pyjslib_Tuple([i, ustr]);\n }\n if ((str.charAt(j) == \"\\\"\")) {\n var ustr = ( ustr + \"\\\"\" ) ;\n var j = ( j + 1 ) ;\n continue;\n }\n interesting.lastIndex = 0;\n var m = interesting.exec(str.slice(j));\n if (!(m)) {\n throw BadSyntax(this._thisDoc, startline, str, j, ( ( ( \"Closing quote missing in string at ^ in \" + str.slice( ( j - 20 ) , j) ) + \"^\" ) + str.slice( j, ( j + 20 ) ) ) );\n }\n var i = ( ( j + interesting.lastIndex ) - 1 ) ;\n var ustr = ( ustr + str.slice( j, i) ) ;\n var ch = str.charAt(i);\n if ((ch == \"\\\"\")) {\n var j = i;\n continue;\n }\n else if ((ch == \"\\r\")) {\n var j = ( i + 1 ) ;\n continue;\n }\n else if ((ch == \"\\n\")) {\n if ((delim == \"\\\"\")) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"newline found in string literal\");\n }\n this.lines = ( this.lines + 1 ) ;\n var ustr = ( ustr + ch ) ;\n var j = ( i + 1 ) ;\n this.previousLine = this.startOfLine;\n this.startOfLine = j;\n }\n else if ((ch == \"\\\\\")) {\n var j = ( i + 1 ) ;\n var ch = str.slice( j, ( j + 1 ) );\n if (!(ch)) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"unterminated string literal (2)\");\n }\n var k = string_find(\"abfrtvn\\\\\\\"\", ch);\n if ((k >= 0)) {\n var uch = \"\\a\\b\\f\\r\\t\\v\\n\\\\\\\"\".charAt(k);\n var ustr = ( ustr + uch ) ;\n var j = ( j + 1 ) ;\n }\n else if ((ch == \"u\")) {\n var pairFudge = this.uEscape(str, ( j + 1 ) , startline);\n var j = pairFudge[0];\n var ch = pairFudge[1];\n var ustr = ( ustr + ch ) ;\n }\n else if ((ch == \"U\")) {\n var pairFudge = this.UEscape(str, ( j + 1 ) , startline);\n var j = pairFudge[0];\n var ch = pairFudge[1];\n var ustr = ( ustr + ch ) ;\n }\n else {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"bad escape\");\n }\n }\n }\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"unterminated string literal\");\n };\n uEscape(str, i, startline) {\n var j = i;\n var count = 0;\n var value = 0;\n while ((count < 4)) {\n var chFudge = str.slice( j, ( j + 1 ) );\n var ch = chFudge.toLowerCase();\n var j = ( j + 1 ) ;\n if ((ch == \"\")) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"unterminated string literal(3)\");\n }\n var k = string_find(\"0123456789abcdef\", ch);\n if ((k < 0)) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"bad string literal hex escape\");\n }\n var value = ( ( value * 16 ) + k ) ;\n var count = ( count + 1 ) ;\n }\n var uch = String.fromCharCode(value);\n return new pyjslib_Tuple([j, uch]);\n };\n UEscape(str, i, startline) {\n var j = i;\n var count = 0;\n var value = \"\\\\U\";\n while ((count < 8)) {\n var chFudge = str.slice( j, ( j + 1 ) );\n var ch = chFudge.toLowerCase();\n var j = ( j + 1 ) ;\n if ((ch == \"\")) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"unterminated string literal(3)\");\n }\n var k = string_find(\"0123456789abcdef\", ch);\n if ((k < 0)) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"bad string literal hex escape\");\n }\n var value = ( value + ch ) ;\n var count = ( count + 1 ) ;\n }\n var uch = stringFromCharCode( ( ( \"0x\" + pyjslib_slice(value, 2, 10) ) - 0 ) );\n return new pyjslib_Tuple([j, uch]);\n };\n}\n\nfunction OLD_BadSyntax(uri, lines, str, i, why) {\n return new __OLD_BadSyntax(uri, lines, str, i, why);\n}\nfunction __OLD_BadSyntax(uri, lines, str, i, why) {\n this._str = str.encode(\"utf-8\");\n this._str = str;\n this._i = i;\n this._why = why;\n this.lines = lines;\n this._uri = uri;\n}\n__OLD_BadSyntax.prototype.toString = function() {\n var str = this._str;\n var i = this._i;\n var st = 0;\n if ((i > 60)) {\n var pre = \"...\";\n var st = ( i - 60 ) ;\n }\n else {\n var pre = \"\";\n }\n if (( ( pyjslib_len(str) - i ) > 60)) {\n var post = \"...\";\n }\n else {\n var post = \"\";\n }\n return \"Line %i of <%s>: Bad syntax (%s) at ^ in:\\n\\\"%s%s^%s%s\\\"\" % new pyjslib_Tuple([ ( this.lines + 1 ) , this._uri, this._why, pre, str.slice( st, i), str.slice( i, ( i + 60 ) ), post]);\n}\n\nfunction BadSyntax(uri, lines, str, i, why) {\n let lineNo = lines + 1\n let msg = ( ( ( ( ( ( ( ( \"Line \" + ( lineNo ) ) + \" of <\" ) + uri ) + \">: Bad syntax: \" ) + why ) + \"\\nat: \\\"\" ) + str.slice( i, ( i + 30 ) ) ) + \"\\\"\" ) ;\n let e = new SyntaxError(msg, uri , lineNo)\n e.lineNo = lineNo\n e.characterInFile = i\n e.syntaxProblem = why\n return e\n}\n\nfunction stripCR(str) {\n var res = \"\";\n\n var __ch = new pyjslib_Iterator(str);\n try {\n while (true) {\n var ch = __ch.next();\n\n\n if ((ch != \"\\r\")) {\n var res = ( res + ch ) ;\n }\n\n }\n } catch (e) {\n if (e != StopIteration) {\n throw e;\n }\n }\n\n return res;\n}\n\n\nfunction dummyWrite(x) {\n}\n","import Collection from '../collection'\nimport CanonicalDataFactory from './canonical-data-factory'\nimport { ValueType, CollectionTermType } from '../types'\nimport { DataFactory, DefaultFactoryTypes, Feature, Indexable } from './factory-types'\nimport { isCollection, isVariable } from '../utils/terms'\nimport Variable from '../variable'\nimport { Term } from '../tf-types'\n\ninterface CollectionFactory extends DataFactory {\n collection(elements: ReadonlyArray): Collection\n}\n\n/**\n * Data factory which also supports Collections\n *\n * Necessary for preventing circular dependencies.\n */\nconst ExtendedTermFactory: CollectionFactory = {\n ...CanonicalDataFactory,\n\n supports: {\n [Feature.collections]: true,\n [Feature.defaultGraphType]: false,\n [Feature.equalsMethod]: true,\n [Feature.identity]: false,\n [Feature.id]: true,\n [Feature.reversibleId]: false,\n [Feature.variableType]: true,\n },\n\n /**\n * Creates a new collection\n * @param elements - The initial element\n */\n collection (elements: ReadonlyArray): Collection {\n return new Collection(elements)\n },\n\n id (term: Term | DefaultFactoryTypes): Indexable {\n if (isCollection(term)) {\n return `( ${term.elements.map((e) => {\n return this.id(e) }).join(', ')} )`\n }\n\n if (isVariable(term)) {\n return Variable.toString(term)\n }\n\n return CanonicalDataFactory.id(term)\n },\n\n termToNQ (term: Term): string {\n if (term.termType === CollectionTermType) {\n return Collection.toNT(term)\n }\n\n return CanonicalDataFactory.termToNQ(term)\n }\n}\n\nexport default ExtendedTermFactory\n","import { arrayToStatements } from './utils'\n\n/**\n * Parses json-ld formatted JS objects to a rdf Term.\n * @param kb - The DataFactory to use.\n * @param obj - The json-ld object to process.\n * @return {Literal|NamedNode|BlankNode|Collection}\n */\nexport function jsonldObjectToTerm (kb, obj) {\n if (typeof obj === 'string') {\n return kb.rdfFactory.literal(obj)\n }\n\n if (Object.prototype.hasOwnProperty.call(obj, '@list')) {\n if (kb.rdfFactory.supports[\"COLLECTIONS\"] === true) {\n return listToCollection(kb, obj['@list'])\n }\n\n return listToStatements(kb, obj)\n }\n\n if (Object.prototype.hasOwnProperty.call(obj, '@id')) {\n return nodeType(kb, obj)\n }\n\n if (Object.prototype.hasOwnProperty.call(obj, '@language')) {\n return kb.rdfFactory.literal(obj['@value'], obj['@language'])\n }\n\n if (Object.prototype.hasOwnProperty.call(obj, '@type')) {\n return kb.rdfFactory.literal(obj['@value'], kb.rdfFactory.namedNode(obj['@type']))\n }\n\n if (Object.prototype.hasOwnProperty.call(obj, '@value')) {\n return kb.rdfFactory.literal(obj['@value'])\n }\n\n return kb.rdfFactory.literal(obj)\n}\n\n/**\n * Adds the statements in a json-ld list object to {kb}.\n */\nfunction listToStatements (kb, obj) {\n const listId = obj['@id'] ? nodeType(kb, obj) : kb.rdfFactory.blankNode()\n\n const items = obj['@list'].map((listItem => jsonldObjectToTerm(kb, listItem)))\n const statements = arrayToStatements(kb.rdfFactory, listId, items)\n kb.addAll(statements)\n\n return listId\n}\n\nfunction listToCollection (kb, obj) {\n if (!Array.isArray(obj)) {\n throw new TypeError(\"Object must be an array\")\n }\n return kb.rdfFactory.collection(obj.map((o) => jsonldObjectToTerm(kb, o)))\n}\n\n/**\n * Takes a json-ld formatted string {str} and adds its statements to {kb}.\n *\n * Ensure that {kb.rdfFactory} is a DataFactory.\n */\nexport default function jsonldParser (str, kb, base, callback) {\n const baseString = base && Object.prototype.hasOwnProperty.call(base, 'termType')\n ? base.value\n : base\n\n return import('jsonld')\n .then(jsonld => { return jsonld.flatten(JSON.parse(str), null, { base: baseString }) })\n .then((flattened) => flattened.reduce((store, flatResource) => {\n\n kb = processResource(kb, base, flatResource)\n\n return kb\n }, kb))\n .then(callback)\n .catch(callback)\n}\n\nfunction nodeType (kb, obj) {\n if (obj['@id'].startsWith('_:')) {\n // This object is a Blank Node. Pass the id without the `_:` prefix\n return kb.rdfFactory.blankNode(obj['@id'].substring(2));\n } else {\n // This object is a Named Node\n return kb.rdfFactory.namedNode(obj['@id']);\n }\n}\n\nfunction processResource(kb, base, flatResource) {\n const id = flatResource['@id']\n ? nodeType(kb, flatResource)\n : kb.rdfFactory.blankNode()\n\n for (const property of Object.keys(flatResource)) {\n if (property === '@id') {\n continue\n } else if (property == '@graph') {\n // the JSON-LD flattened structure may contain nested graphs\n // the id value for this object is the new base (named graph id) for all nested flat resources\n const graphId = id\n // this is an array of resources\n const nestedFlatResources = flatResource[property]\n\n // recursively process all flat resources in the array, but with the graphId as base.\n for (let i = 0; i < nestedFlatResources.length; i++ ) {\n kb = processResource(kb, graphId, nestedFlatResources[i])\n }\n }\n\n const value = flatResource[property]\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n kb.addStatement(createStatement(kb, id, property, value[i], base))\n }\n } else {\n kb.addStatement(createStatement(kb, id, property, value, base))\n }\n }\n\n return kb\n}\n\n/**\n * Create statement quad depending on @type being a type node\n * @param kb\n * @param subject id\n * @param property\n * @param value\n * @return quad statement\n */\nfunction createStatement(kb, id, property, value, base) {\n let predicate, object\n\n if (property === \"@type\") {\n predicate = kb.rdfFactory.namedNode(\"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\")\n object = kb.rdfFactory.namedNode(value)\n } else {\n predicate = kb.rdfFactory.namedNode(property)\n object = jsonldObjectToTerm(kb, value)\n }\n return kb.rdfFactory.quad(id, predicate, object, kb.rdfFactory.namedNode(base))\n}","const RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n XSD = 'http://www.w3.org/2001/XMLSchema#',\n SWAP = 'http://www.w3.org/2000/10/swap/';\n\nexport default {\n xsd: {\n decimal: `${XSD}decimal`,\n boolean: `${XSD}boolean`,\n double: `${XSD}double`,\n integer: `${XSD}integer`,\n string: `${XSD}string`,\n },\n rdf: {\n type: `${RDF}type`,\n nil: `${RDF}nil`,\n first: `${RDF}first`,\n rest: `${RDF}rest`,\n langString: `${RDF}langString`,\n },\n owl: {\n sameAs: 'http://www.w3.org/2002/07/owl#sameAs',\n },\n r: {\n forSome: `${SWAP}reify#forSome`,\n forAll: `${SWAP}reify#forAll`,\n },\n log: {\n implies: `${SWAP}log#implies`,\n },\n};\n","// **N3Lexer** tokenizes N3 documents.\nimport queueMicrotask from 'queue-microtask';\nimport namespaces from './IRIs';\n\nconst { xsd } = namespaces;\n\n// Regular expression and replacement string to escape N3 strings\nconst escapeSequence = /\\\\u([a-fA-F0-9]{4})|\\\\U([a-fA-F0-9]{8})|\\\\([^])/g;\nconst escapeReplacements = {\n '\\\\': '\\\\', \"'\": \"'\", '\"': '\"',\n 'n': '\\n', 'r': '\\r', 't': '\\t', 'f': '\\f', 'b': '\\b',\n '_': '_', '~': '~', '.': '.', '-': '-', '!': '!', '$': '$', '&': '&',\n '(': '(', ')': ')', '*': '*', '+': '+', ',': ',', ';': ';', '=': '=',\n '/': '/', '?': '?', '#': '#', '@': '@', '%': '%',\n};\nconst illegalIriChars = /[\\x00-\\x20<>\\\\\"\\{\\}\\|\\^\\`]/;\n\nconst lineModeRegExps = {\n _iri: true,\n _unescapedIri: true,\n _simpleQuotedString: true,\n _langcode: true,\n _blank: true,\n _newline: true,\n _comment: true,\n _whitespace: true,\n _endOfFile: true,\n};\nconst invalidRegExp = /$0^/;\n\n// ## Constructor\nexport default class N3Lexer {\n constructor(options) {\n // ## Regular expressions\n // It's slightly faster to have these as properties than as in-scope variables\n this._iri = /^<((?:[^ <>{}\\\\]|\\\\[uU])+)>[ \\t]*/; // IRI with escape sequences; needs sanity check after unescaping\n this._unescapedIri = /^<([^\\x00-\\x20<>\\\\\"\\{\\}\\|\\^\\`]*)>[ \\t]*/; // IRI without escape sequences; no unescaping\n this._simpleQuotedString = /^\"([^\"\\\\\\r\\n]*)\"(?=[^\"])/; // string without escape sequences\n this._simpleApostropheString = /^'([^'\\\\\\r\\n]*)'(?=[^'])/;\n this._langcode = /^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\\-])/i;\n this._prefix = /^((?:[A-Za-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])(?:\\.?[\\-0-9A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])*)?:(?=[#\\s<])/;\n this._prefixed = /^((?:[A-Za-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])(?:\\.?[\\-0-9A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])*)?:((?:(?:[0-:A-Z_a-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff]|%[0-9a-fA-F]{2}|\\\\[!#-\\/;=?\\-@_~])(?:(?:[\\.\\-0-:A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff]|%[0-9a-fA-F]{2}|\\\\[!#-\\/;=?\\-@_~])*(?:[\\-0-:A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff]|%[0-9a-fA-F]{2}|\\\\[!#-\\/;=?\\-@_~]))?)?)(?:[ \\t]+|(?=\\.?[,;!\\^\\s#()\\[\\]\\{\\}\"'<>]))/;\n this._variable = /^\\?(?:(?:[A-Z_a-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])(?:[\\-0-:A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])*)(?=[.,;!\\^\\s#()\\[\\]\\{\\}\"'<>])/;\n this._blank = /^_:((?:[0-9A-Z_a-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])(?:\\.?[\\-0-9A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])*)(?:[ \\t]+|(?=\\.?[,;:\\s#()\\[\\]\\{\\}\"'<>]))/;\n this._number = /^[\\-+]?(?:(\\d+\\.\\d*|\\.?\\d+)[eE][\\-+]?|\\d*(\\.)?)\\d+(?=\\.?[,;:\\s#()\\[\\]\\{\\}\"'<>])/;\n this._boolean = /^(?:true|false)(?=[.,;\\s#()\\[\\]\\{\\}\"'<>])/;\n this._keyword = /^@[a-z]+(?=[\\s#<:])/i;\n this._sparqlKeyword = /^(?:PREFIX|BASE|GRAPH)(?=[\\s#<])/i;\n this._shortPredicates = /^a(?=[\\s#()\\[\\]\\{\\}\"'<>])/;\n this._newline = /^[ \\t]*(?:#[^\\n\\r]*)?(?:\\r\\n|\\n|\\r)[ \\t]*/;\n this._comment = /#([^\\n\\r]*)/;\n this._whitespace = /^[ \\t]+/;\n this._endOfFile = /^(?:#[^\\n\\r]*)?$/;\n options = options || {};\n\n // In line mode (N-Triples or N-Quads), only simple features may be parsed\n if (this._lineMode = !!options.lineMode) {\n this._n3Mode = false;\n // Don't tokenize special literals\n for (const key in this) {\n if (!(key in lineModeRegExps) && this[key] instanceof RegExp)\n this[key] = invalidRegExp;\n }\n }\n // When not in line mode, enable N3 functionality by default\n else {\n this._n3Mode = options.n3 !== false;\n }\n // Don't output comment tokens by default\n this._comments = !!options.comments;\n // Cache the last tested closing position of long literals\n this._literalClosingPos = 0;\n }\n\n // ## Private methods\n\n // ### `_tokenizeToEnd` tokenizes as for as possible, emitting tokens through the callback\n _tokenizeToEnd(callback, inputFinished) {\n // Continue parsing as far as possible; the loop will return eventually\n let input = this._input;\n let currentLineLength = input.length;\n while (true) {\n // Count and skip whitespace lines\n let whiteSpaceMatch, comment;\n while (whiteSpaceMatch = this._newline.exec(input)) {\n // Try to find a comment\n if (this._comments && (comment = this._comment.exec(whiteSpaceMatch[0])))\n emitToken('comment', comment[1], '', this._line, whiteSpaceMatch[0].length);\n // Advance the input\n input = input.substr(whiteSpaceMatch[0].length, input.length);\n currentLineLength = input.length;\n this._line++;\n }\n // Skip whitespace on current line\n if (!whiteSpaceMatch && (whiteSpaceMatch = this._whitespace.exec(input)))\n input = input.substr(whiteSpaceMatch[0].length, input.length);\n\n // Stop for now if we're at the end\n if (this._endOfFile.test(input)) {\n // If the input is finished, emit EOF\n if (inputFinished) {\n // Try to find a final comment\n if (this._comments && (comment = this._comment.exec(input)))\n emitToken('comment', comment[1], '', this._line, input.length);\n input = null;\n emitToken('eof', '', '', this._line, 0);\n }\n return this._input = input;\n }\n\n // Look for specific token types based on the first character\n const line = this._line, firstChar = input[0];\n let type = '', value = '', prefix = '',\n match = null, matchLength = 0, inconclusive = false;\n switch (firstChar) {\n case '^':\n // We need at least 3 tokens lookahead to distinguish ^^ and ^^pre:fixed\n if (input.length < 3)\n break;\n // Try to match a type\n else if (input[1] === '^') {\n this._previousMarker = '^^';\n // Move to type IRI or prefixed name\n input = input.substr(2);\n if (input[0] !== '<') {\n inconclusive = true;\n break;\n }\n }\n // If no type, it must be a path expression\n else {\n if (this._n3Mode) {\n matchLength = 1;\n type = '^';\n }\n break;\n }\n // Fall through in case the type is an IRI\n case '<':\n // Try to find a full IRI without escape sequences\n if (match = this._unescapedIri.exec(input))\n type = 'IRI', value = match[1];\n // Try to find a full IRI with escape sequences\n else if (match = this._iri.exec(input)) {\n value = this._unescape(match[1]);\n if (value === null || illegalIriChars.test(value))\n return reportSyntaxError(this);\n type = 'IRI';\n }\n // Try to find a nested triple\n else if (input.length > 1 && input[1] === '<')\n type = '<<', matchLength = 2;\n // Try to find a backwards implication arrow\n else if (this._n3Mode && input.length > 1 && input[1] === '=')\n type = 'inverse', matchLength = 2, value = '>';\n break;\n\n case '>':\n if (input.length > 1 && input[1] === '>')\n type = '>>', matchLength = 2;\n break;\n\n case '_':\n // Try to find a blank node. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a blank node.\n // Therefore, try inserting a space if we're at the end of the input.\n if ((match = this._blank.exec(input)) ||\n inputFinished && (match = this._blank.exec(`${input} `)))\n type = 'blank', prefix = '_', value = match[1];\n break;\n\n case '\"':\n // Try to find a literal without escape sequences\n if (match = this._simpleQuotedString.exec(input))\n value = match[1];\n // Try to find a literal wrapped in three pairs of quotes\n else {\n ({ value, matchLength } = this._parseLiteral(input));\n if (value === null)\n return reportSyntaxError(this);\n }\n if (match !== null || matchLength !== 0) {\n type = 'literal';\n this._literalClosingPos = 0;\n }\n break;\n\n case \"'\":\n if (!this._lineMode) {\n // Try to find a literal without escape sequences\n if (match = this._simpleApostropheString.exec(input))\n value = match[1];\n // Try to find a literal wrapped in three pairs of quotes\n else {\n ({ value, matchLength } = this._parseLiteral(input));\n if (value === null)\n return reportSyntaxError(this);\n }\n if (match !== null || matchLength !== 0) {\n type = 'literal';\n this._literalClosingPos = 0;\n }\n }\n break;\n\n case '?':\n // Try to find a variable\n if (this._n3Mode && (match = this._variable.exec(input)))\n type = 'var', value = match[0];\n break;\n\n case '@':\n // Try to find a language code\n if (this._previousMarker === 'literal' && (match = this._langcode.exec(input)))\n type = 'langcode', value = match[1];\n // Try to find a keyword\n else if (match = this._keyword.exec(input))\n type = match[0];\n break;\n\n case '.':\n // Try to find a dot as punctuation\n if (input.length === 1 ? inputFinished : (input[1] < '0' || input[1] > '9')) {\n type = '.';\n matchLength = 1;\n break;\n }\n // Fall through to numerical case (could be a decimal dot)\n\n case '0':\n case '1':\n case '2':\n case '3':\n case '4':\n case '5':\n case '6':\n case '7':\n case '8':\n case '9':\n case '+':\n case '-':\n // Try to find a number. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a number.\n // Therefore, try inserting a space if we're at the end of the input.\n if (match = this._number.exec(input) ||\n inputFinished && (match = this._number.exec(`${input} `))) {\n type = 'literal', value = match[0];\n prefix = (typeof match[1] === 'string' ? xsd.double :\n (typeof match[2] === 'string' ? xsd.decimal : xsd.integer));\n }\n break;\n\n case 'B':\n case 'b':\n case 'p':\n case 'P':\n case 'G':\n case 'g':\n // Try to find a SPARQL-style keyword\n if (match = this._sparqlKeyword.exec(input))\n type = match[0].toUpperCase();\n else\n inconclusive = true;\n break;\n\n case 'f':\n case 't':\n // Try to match a boolean\n if (match = this._boolean.exec(input))\n type = 'literal', value = match[0], prefix = xsd.boolean;\n else\n inconclusive = true;\n break;\n\n case 'a':\n // Try to find an abbreviated predicate\n if (match = this._shortPredicates.exec(input))\n type = 'abbreviation', value = 'a';\n else\n inconclusive = true;\n break;\n\n case '=':\n // Try to find an implication arrow or equals sign\n if (this._n3Mode && input.length > 1) {\n type = 'abbreviation';\n if (input[1] !== '>')\n matchLength = 1, value = '=';\n else\n matchLength = 2, value = '>';\n }\n break;\n\n case '!':\n if (!this._n3Mode)\n break;\n case ',':\n case ';':\n case '[':\n case ']':\n case '(':\n case ')':\n case '}':\n if (!this._lineMode) {\n matchLength = 1;\n type = firstChar;\n }\n break;\n case '{':\n // We need at least 2 tokens lookahead to distinguish \"{|\" and \"{ \"\n if (!this._lineMode && input.length >= 2) {\n // Try to find a quoted triple annotation start\n if (input[1] === '|')\n type = '{|', matchLength = 2;\n else\n type = firstChar, matchLength = 1;\n }\n break;\n case '|':\n // We need 2 tokens lookahead to parse \"|}\"\n // Try to find a quoted triple annotation end\n if (input.length >= 2 && input[1] === '}')\n type = '|}', matchLength = 2;\n break;\n\n default:\n inconclusive = true;\n }\n\n // Some first characters do not allow an immediate decision, so inspect more\n if (inconclusive) {\n // Try to find a prefix\n if ((this._previousMarker === '@prefix' || this._previousMarker === 'PREFIX') &&\n (match = this._prefix.exec(input)))\n type = 'prefix', value = match[1] || '';\n // Try to find a prefixed name. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a prefixed name.\n // Therefore, try inserting a space if we're at the end of the input.\n else if ((match = this._prefixed.exec(input)) ||\n inputFinished && (match = this._prefixed.exec(`${input} `)))\n type = 'prefixed', prefix = match[1] || '', value = this._unescape(match[2]);\n }\n\n // A type token is special: it can only be emitted after an IRI or prefixed name is read\n if (this._previousMarker === '^^') {\n switch (type) {\n case 'prefixed': type = 'type'; break;\n case 'IRI': type = 'typeIRI'; break;\n default: type = '';\n }\n }\n\n // What if nothing of the above was found?\n if (!type) {\n // We could be in streaming mode, and then we just wait for more input to arrive.\n // Otherwise, a syntax error has occurred in the input.\n // One exception: error on an unaccounted linebreak (= not inside a triple-quoted literal).\n if (inputFinished || (!/^'''|^\"\"\"/.test(input) && /\\n|\\r/.test(input)))\n return reportSyntaxError(this);\n else\n return this._input = input;\n }\n\n // Emit the parsed token\n const length = matchLength || match[0].length;\n const token = emitToken(type, value, prefix, line, length);\n this.previousToken = token;\n this._previousMarker = type;\n\n // Advance to next part to tokenize\n input = input.substr(length, input.length);\n }\n\n // Emits the token through the callback\n function emitToken(type, value, prefix, line, length) {\n const start = input ? currentLineLength - input.length : currentLineLength;\n const end = start + length;\n const token = { type, value, prefix, line, start, end };\n callback(null, token);\n return token;\n }\n // Signals the syntax error through the callback\n function reportSyntaxError(self) { callback(self._syntaxError(/^\\S*/.exec(input)[0])); }\n }\n\n // ### `_unescape` replaces N3 escape codes by their corresponding characters\n _unescape(item) {\n let invalid = false;\n const replaced = item.replace(escapeSequence, (sequence, unicode4, unicode8, escapedChar) => {\n // 4-digit unicode character\n if (typeof unicode4 === 'string')\n return String.fromCharCode(Number.parseInt(unicode4, 16));\n // 8-digit unicode character\n if (typeof unicode8 === 'string') {\n let charCode = Number.parseInt(unicode8, 16);\n return charCode <= 0xFFFF ? String.fromCharCode(Number.parseInt(unicode8, 16)) :\n String.fromCharCode(0xD800 + ((charCode -= 0x10000) >> 10), 0xDC00 + (charCode & 0x3FF));\n }\n // fixed escape sequence\n if (escapedChar in escapeReplacements)\n return escapeReplacements[escapedChar];\n // invalid escape sequence\n invalid = true;\n return '';\n });\n return invalid ? null : replaced;\n }\n\n // ### `_parseLiteral` parses a literal into an unescaped value\n _parseLiteral(input) {\n // Ensure we have enough lookahead to identify triple-quoted strings\n if (input.length >= 3) {\n // Identify the opening quote(s)\n const opening = input.match(/^(?:\"\"\"|\"|'''|'|)/)[0];\n const openingLength = opening.length;\n\n // Find the next candidate closing quotes\n let closingPos = Math.max(this._literalClosingPos, openingLength);\n while ((closingPos = input.indexOf(opening, closingPos)) > 0) {\n // Count backslashes right before the closing quotes\n let backslashCount = 0;\n while (input[closingPos - backslashCount - 1] === '\\\\')\n backslashCount++;\n\n // An even number of backslashes (in particular 0)\n // means these are actual, non-escaped closing quotes\n if (backslashCount % 2 === 0) {\n // Extract and unescape the value\n const raw = input.substring(openingLength, closingPos);\n const lines = raw.split(/\\r\\n|\\r|\\n/).length - 1;\n const matchLength = closingPos + openingLength;\n // Only triple-quoted strings can be multi-line\n if (openingLength === 1 && lines !== 0 ||\n openingLength === 3 && this._lineMode)\n break;\n this._line += lines;\n return { value: this._unescape(raw), matchLength };\n }\n closingPos++;\n }\n this._literalClosingPos = input.length - openingLength + 1;\n }\n return { value: '', matchLength: 0 };\n }\n\n // ### `_syntaxError` creates a syntax error for the given issue\n _syntaxError(issue) {\n this._input = null;\n const err = new Error(`Unexpected \"${issue}\" on line ${this._line}.`);\n err.context = {\n token: undefined,\n line: this._line,\n previousToken: this.previousToken,\n };\n return err;\n }\n\n // ### Strips off any starting UTF BOM mark.\n _readStartingBom(input) {\n return input.startsWith('\\ufeff') ? input.substr(1) : input;\n }\n\n // ## Public methods\n\n // ### `tokenize` starts the transformation of an N3 document into an array of tokens.\n // The input can be a string or a stream.\n tokenize(input, callback) {\n this._line = 1;\n\n // If the input is a string, continuously emit tokens through the callback until the end\n if (typeof input === 'string') {\n this._input = this._readStartingBom(input);\n // If a callback was passed, asynchronously call it\n if (typeof callback === 'function')\n queueMicrotask(() => this._tokenizeToEnd(callback, true));\n // If no callback was passed, tokenize synchronously and return\n else {\n const tokens = [];\n let error;\n this._tokenizeToEnd((e, t) => e ? (error = e) : tokens.push(t), true);\n if (error) throw error;\n return tokens;\n }\n }\n // Otherwise, the input must be a stream\n else {\n this._pendingBuffer = null;\n if (typeof input.setEncoding === 'function')\n input.setEncoding('utf8');\n // Adds the data chunk to the buffer and parses as far as possible\n input.on('data', data => {\n if (this._input !== null && data.length !== 0) {\n // Prepend any previous pending writes\n if (this._pendingBuffer) {\n data = Buffer.concat([this._pendingBuffer, data]);\n this._pendingBuffer = null;\n }\n // Hold if the buffer ends in an incomplete unicode sequence\n if (data[data.length - 1] & 0x80) {\n this._pendingBuffer = data;\n }\n // Otherwise, tokenize as far as possible\n else {\n // Only read a BOM at the start\n if (typeof this._input === 'undefined')\n this._input = this._readStartingBom(typeof data === 'string' ? data : data.toString());\n else\n this._input += data;\n this._tokenizeToEnd(callback, false);\n }\n }\n });\n // Parses until the end\n input.on('end', () => {\n if (typeof this._input === 'string')\n this._tokenizeToEnd(callback, true);\n });\n input.on('error', callback);\n }\n }\n}\n","// N3.js implementations of the RDF/JS core data types\n// See https://github.com/rdfjs/representation-task-force/blob/master/interface-spec.md\n\nimport namespaces from './IRIs';\n\nconst { rdf, xsd } = namespaces;\n\n// eslint-disable-next-line prefer-const\nlet DEFAULTGRAPH;\nlet _blankNodeCounter = 0;\n\nconst escapedLiteral = /^\"(.*\".*)(?=\"[^\"]*$)/;\n\n// ## DataFactory singleton\nconst DataFactory = {\n namedNode,\n blankNode,\n variable,\n literal,\n defaultGraph,\n quad,\n triple: quad,\n};\nexport default DataFactory;\n\n// ## Term constructor\nexport class Term {\n constructor(id) {\n this.id = id;\n }\n\n // ### The value of this term\n get value() {\n return this.id;\n }\n\n // ### Returns whether this object represents the same term as the other\n equals(other) {\n // If both terms were created by this library,\n // equality can be computed through ids\n if (other instanceof Term)\n return this.id === other.id;\n // Otherwise, compare term type and value\n return !!other && this.termType === other.termType &&\n this.value === other.value;\n }\n\n // ### Implement hashCode for Immutable.js, since we implement `equals`\n // https://immutable-js.com/docs/v4.0.0/ValueObject/#hashCode()\n hashCode() {\n return 0;\n }\n\n // ### Returns a plain object representation of this term\n toJSON() {\n return {\n termType: this.termType,\n value: this.value,\n };\n }\n}\n\n\n// ## NamedNode constructor\nexport class NamedNode extends Term {\n // ### The term type of this term\n get termType() {\n return 'NamedNode';\n }\n}\n\n// ## Literal constructor\nexport class Literal extends Term {\n // ### The term type of this term\n get termType() {\n return 'Literal';\n }\n\n // ### The text value of this literal\n get value() {\n return this.id.substring(1, this.id.lastIndexOf('\"'));\n }\n\n // ### The language of this literal\n get language() {\n // Find the last quotation mark (e.g., '\"abc\"@en-us')\n const id = this.id;\n let atPos = id.lastIndexOf('\"') + 1;\n // If \"@\" it follows, return the remaining substring; empty otherwise\n return atPos < id.length && id[atPos++] === '@' ? id.substr(atPos).toLowerCase() : '';\n }\n\n // ### The datatype IRI of this literal\n get datatype() {\n return new NamedNode(this.datatypeString);\n }\n\n // ### The datatype string of this literal\n get datatypeString() {\n // Find the last quotation mark (e.g., '\"abc\"^^http://ex.org/types#t')\n const id = this.id, dtPos = id.lastIndexOf('\"') + 1;\n const char = dtPos < id.length ? id[dtPos] : '';\n // If \"^\" it follows, return the remaining substring\n return char === '^' ? id.substr(dtPos + 2) :\n // If \"@\" follows, return rdf:langString; xsd:string otherwise\n (char !== '@' ? xsd.string : rdf.langString);\n }\n\n // ### Returns whether this object represents the same term as the other\n equals(other) {\n // If both literals were created by this library,\n // equality can be computed through ids\n if (other instanceof Literal)\n return this.id === other.id;\n // Otherwise, compare term type, value, language, and datatype\n return !!other && !!other.datatype &&\n this.termType === other.termType &&\n this.value === other.value &&\n this.language === other.language &&\n this.datatype.value === other.datatype.value;\n }\n\n toJSON() {\n return {\n termType: this.termType,\n value: this.value,\n language: this.language,\n datatype: { termType: 'NamedNode', value: this.datatypeString },\n };\n }\n}\n\n// ## BlankNode constructor\nexport class BlankNode extends Term {\n constructor(name) {\n super(`_:${name}`);\n }\n\n // ### The term type of this term\n get termType() {\n return 'BlankNode';\n }\n\n // ### The name of this blank node\n get value() {\n return this.id.substr(2);\n }\n}\n\nexport class Variable extends Term {\n constructor(name) {\n super(`?${name}`);\n }\n\n // ### The term type of this term\n get termType() {\n return 'Variable';\n }\n\n // ### The name of this variable\n get value() {\n return this.id.substr(1);\n }\n}\n\n// ## DefaultGraph constructor\nexport class DefaultGraph extends Term {\n constructor() {\n super('');\n return DEFAULTGRAPH || this;\n }\n\n // ### The term type of this term\n get termType() {\n return 'DefaultGraph';\n }\n\n // ### Returns whether this object represents the same term as the other\n equals(other) {\n // If both terms were created by this library,\n // equality can be computed through strict equality;\n // otherwise, compare term types.\n return (this === other) || (!!other && (this.termType === other.termType));\n }\n}\n\n// ## DefaultGraph singleton\nDEFAULTGRAPH = new DefaultGraph();\n\n// ### Constructs a term from the given internal string ID\n// The third 'nested' parameter of this function is to aid\n// with recursion over nested terms. It should not be used\n// by consumers of this library.\n// See https://github.com/rdfjs/N3.js/pull/311#discussion_r1061042725\nexport function termFromId(id, factory, nested) {\n factory = factory || DataFactory;\n\n // Falsy value or empty string indicate the default graph\n if (!id)\n return factory.defaultGraph();\n\n // Identify the term type based on the first character\n switch (id[0]) {\n case '?':\n return factory.variable(id.substr(1));\n case '_':\n return factory.blankNode(id.substr(2));\n case '\"':\n // Shortcut for internal literals\n if (factory === DataFactory)\n return new Literal(id);\n // Literal without datatype or language\n if (id[id.length - 1] === '\"')\n return factory.literal(id.substr(1, id.length - 2));\n // Literal with datatype or language\n const endPos = id.lastIndexOf('\"', id.length - 1);\n return factory.literal(id.substr(1, endPos - 1),\n id[endPos + 1] === '@' ? id.substr(endPos + 2)\n : factory.namedNode(id.substr(endPos + 3)));\n case '[':\n id = JSON.parse(id);\n break;\n default:\n if (!nested || !Array.isArray(id)) {\n return factory.namedNode(id);\n }\n }\n return factory.quad(\n termFromId(id[0], factory, true),\n termFromId(id[1], factory, true),\n termFromId(id[2], factory, true),\n id[3] && termFromId(id[3], factory, true)\n );\n}\n\n// ### Constructs an internal string ID from the given term or ID string\n// The third 'nested' parameter of this function is to aid\n// with recursion over nested terms. It should not be used\n// by consumers of this library.\n// See https://github.com/rdfjs/N3.js/pull/311#discussion_r1061042725\nexport function termToId(term, nested) {\n if (typeof term === 'string')\n return term;\n if (term instanceof Term && term.termType !== 'Quad')\n return term.id;\n if (!term)\n return DEFAULTGRAPH.id;\n\n // Term instantiated with another library\n switch (term.termType) {\n case 'NamedNode': return term.value;\n case 'BlankNode': return `_:${term.value}`;\n case 'Variable': return `?${term.value}`;\n case 'DefaultGraph': return '';\n case 'Literal': return `\"${term.value}\"${\n term.language ? `@${term.language}` :\n (term.datatype && term.datatype.value !== xsd.string ? `^^${term.datatype.value}` : '')}`;\n case 'Quad':\n const res = [\n termToId(term.subject, true),\n termToId(term.predicate, true),\n termToId(term.object, true),\n ];\n if (term.graph && term.graph.termType !== 'DefaultGraph') {\n res.push(termToId(term.graph, true));\n }\n return nested ? res : JSON.stringify(res);\n default: throw new Error(`Unexpected termType: ${term.termType}`);\n }\n}\n\n\n// ## Quad constructor\nexport class Quad extends Term {\n constructor(subject, predicate, object, graph) {\n super('');\n this._subject = subject;\n this._predicate = predicate;\n this._object = object;\n this._graph = graph || DEFAULTGRAPH;\n }\n\n // ### The term type of this term\n get termType() {\n return 'Quad';\n }\n\n get subject() {\n return this._subject;\n }\n\n get predicate() {\n return this._predicate;\n }\n\n get object() {\n return this._object;\n }\n\n get graph() {\n return this._graph;\n }\n\n // ### Returns a plain object representation of this quad\n toJSON() {\n return {\n termType: this.termType,\n subject: this._subject.toJSON(),\n predicate: this._predicate.toJSON(),\n object: this._object.toJSON(),\n graph: this._graph.toJSON(),\n };\n }\n\n // ### Returns whether this object represents the same quad as the other\n equals(other) {\n return !!other && this._subject.equals(other.subject) &&\n this._predicate.equals(other.predicate) &&\n this._object.equals(other.object) &&\n this._graph.equals(other.graph);\n }\n}\nexport { Quad as Triple };\n\n// ### Escapes the quotes within the given literal\nexport function escapeQuotes(id) {\n return id.replace(escapedLiteral, (_, quoted) => `\"${quoted.replace(/\"/g, '\"\"')}`);\n}\n\n// ### Unescapes the quotes within the given literal\nexport function unescapeQuotes(id) {\n return id.replace(escapedLiteral, (_, quoted) => `\"${quoted.replace(/\"\"/g, '\"')}`);\n}\n\n// ### Creates an IRI\nfunction namedNode(iri) {\n return new NamedNode(iri);\n}\n\n// ### Creates a blank node\nfunction blankNode(name) {\n return new BlankNode(name || `n3-${_blankNodeCounter++}`);\n}\n\n// ### Creates a literal\nfunction literal(value, languageOrDataType) {\n // Create a language-tagged string\n if (typeof languageOrDataType === 'string')\n return new Literal(`\"${value}\"@${languageOrDataType.toLowerCase()}`);\n\n // Automatically determine datatype for booleans and numbers\n let datatype = languageOrDataType ? languageOrDataType.value : '';\n if (datatype === '') {\n // Convert a boolean\n if (typeof value === 'boolean')\n datatype = xsd.boolean;\n // Convert an integer or double\n else if (typeof value === 'number') {\n if (Number.isFinite(value))\n datatype = Number.isInteger(value) ? xsd.integer : xsd.double;\n else {\n datatype = xsd.double;\n if (!Number.isNaN(value))\n value = value > 0 ? 'INF' : '-INF';\n }\n }\n }\n\n // Create a datatyped literal\n return (datatype === '' || datatype === xsd.string) ?\n new Literal(`\"${value}\"`) :\n new Literal(`\"${value}\"^^${datatype}`);\n}\n\n// ### Creates a variable\nfunction variable(name) {\n return new Variable(name);\n}\n\n// ### Returns the default graph\nfunction defaultGraph() {\n return DEFAULTGRAPH;\n}\n\n// ### Creates a quad\nfunction quad(subject, predicate, object, graph) {\n return new Quad(subject, predicate, object, graph);\n}\n","// **N3Parser** parses N3 documents.\nimport N3Lexer from './N3Lexer';\nimport N3DataFactory from './N3DataFactory';\nimport namespaces from './IRIs';\n\nlet blankNodePrefix = 0;\n\n// ## Constructor\nexport default class N3Parser {\n constructor(options) {\n this._contextStack = [];\n this._graph = null;\n\n // Set the document IRI\n options = options || {};\n this._setBase(options.baseIRI);\n options.factory && initDataFactory(this, options.factory);\n\n // Set supported features depending on the format\n const format = (typeof options.format === 'string') ?\n options.format.match(/\\w*$/)[0].toLowerCase() : '',\n isTurtle = /turtle/.test(format), isTriG = /trig/.test(format),\n isNTriples = /triple/.test(format), isNQuads = /quad/.test(format),\n isN3 = this._n3Mode = /n3/.test(format),\n isLineMode = isNTriples || isNQuads;\n if (!(this._supportsNamedGraphs = !(isTurtle || isN3)))\n this._readPredicateOrNamedGraph = this._readPredicate;\n // Support triples in other graphs\n this._supportsQuads = !(isTurtle || isTriG || isNTriples || isN3);\n // Support nesting of triples\n this._supportsRDFStar = format === '' || /star|\\*$/.test(format);\n // Disable relative IRIs in N-Triples or N-Quads mode\n if (isLineMode)\n this._resolveRelativeIRI = iri => { return null; };\n this._blankNodePrefix = typeof options.blankNodePrefix !== 'string' ? '' :\n options.blankNodePrefix.replace(/^(?!_:)/, '_:');\n this._lexer = options.lexer || new N3Lexer({ lineMode: isLineMode, n3: isN3 });\n // Disable explicit quantifiers by default\n this._explicitQuantifiers = !!options.explicitQuantifiers;\n }\n\n // ## Static class methods\n\n // ### `_resetBlankNodePrefix` restarts blank node prefix identification\n static _resetBlankNodePrefix() {\n blankNodePrefix = 0;\n }\n\n // ## Private methods\n\n // ### `_setBase` sets the base IRI to resolve relative IRIs\n _setBase(baseIRI) {\n if (!baseIRI) {\n this._base = '';\n this._basePath = '';\n }\n else {\n // Remove fragment if present\n const fragmentPos = baseIRI.indexOf('#');\n if (fragmentPos >= 0)\n baseIRI = baseIRI.substr(0, fragmentPos);\n // Set base IRI and its components\n this._base = baseIRI;\n this._basePath = baseIRI.indexOf('/') < 0 ? baseIRI :\n baseIRI.replace(/[^\\/?]*(?:\\?.*)?$/, '');\n baseIRI = baseIRI.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\\/\\/[^\\/]*)?/i);\n this._baseRoot = baseIRI[0];\n this._baseScheme = baseIRI[1];\n }\n }\n\n // ### `_saveContext` stores the current parsing context\n // when entering a new scope (list, blank node, formula)\n _saveContext(type, graph, subject, predicate, object) {\n const n3Mode = this._n3Mode;\n this._contextStack.push({\n type,\n subject, predicate, object, graph,\n inverse: n3Mode ? this._inversePredicate : false,\n blankPrefix: n3Mode ? this._prefixes._ : '',\n quantified: n3Mode ? this._quantified : null,\n });\n // The settings below only apply to N3 streams\n if (n3Mode) {\n // Every new scope resets the predicate direction\n this._inversePredicate = false;\n // In N3, blank nodes are scoped to a formula\n // (using a dot as separator, as a blank node label cannot start with it)\n this._prefixes._ = (this._graph ? `${this._graph.value}.` : '.');\n // Quantifiers are scoped to a formula\n this._quantified = Object.create(this._quantified);\n }\n }\n\n // ### `_restoreContext` restores the parent context\n // when leaving a scope (list, blank node, formula)\n _restoreContext(type, token) {\n // Obtain the previous context\n const context = this._contextStack.pop();\n if (!context || context.type !== type)\n return this._error(`Unexpected ${token.type}`, token);\n\n // Restore the quad of the previous context\n this._subject = context.subject;\n this._predicate = context.predicate;\n this._object = context.object;\n this._graph = context.graph;\n\n // Restore N3 context settings\n if (this._n3Mode) {\n this._inversePredicate = context.inverse;\n this._prefixes._ = context.blankPrefix;\n this._quantified = context.quantified;\n }\n }\n\n // ### `_readInTopContext` reads a token when in the top context\n _readInTopContext(token) {\n switch (token.type) {\n // If an EOF token arrives in the top context, signal that we're done\n case 'eof':\n if (this._graph !== null)\n return this._error('Unclosed graph', token);\n delete this._prefixes._;\n return this._callback(null, null, this._prefixes);\n // It could be a prefix declaration\n case 'PREFIX':\n this._sparqlStyle = true;\n case '@prefix':\n return this._readPrefix;\n // It could be a base declaration\n case 'BASE':\n this._sparqlStyle = true;\n case '@base':\n return this._readBaseIRI;\n // It could be a graph\n case '{':\n if (this._supportsNamedGraphs) {\n this._graph = '';\n this._subject = null;\n return this._readSubject;\n }\n case 'GRAPH':\n if (this._supportsNamedGraphs)\n return this._readNamedGraphLabel;\n // Otherwise, the next token must be a subject\n default:\n return this._readSubject(token);\n }\n }\n\n // ### `_readEntity` reads an IRI, prefixed name, blank node, or variable\n _readEntity(token, quantifier) {\n let value;\n switch (token.type) {\n // Read a relative or absolute IRI\n case 'IRI':\n case 'typeIRI':\n const iri = this._resolveIRI(token.value);\n if (iri === null)\n return this._error('Invalid IRI', token);\n value = this._namedNode(iri);\n break;\n // Read a prefixed name\n case 'type':\n case 'prefixed':\n const prefix = this._prefixes[token.prefix];\n if (prefix === undefined)\n return this._error(`Undefined prefix \"${token.prefix}:\"`, token);\n value = this._namedNode(prefix + token.value);\n break;\n // Read a blank node\n case 'blank':\n value = this._blankNode(this._prefixes[token.prefix] + token.value);\n break;\n // Read a variable\n case 'var':\n value = this._variable(token.value.substr(1));\n break;\n // Everything else is not an entity\n default:\n return this._error(`Expected entity but got ${token.type}`, token);\n }\n // In N3 mode, replace the entity if it is quantified\n if (!quantifier && this._n3Mode && (value.id in this._quantified))\n value = this._quantified[value.id];\n return value;\n }\n\n // ### `_readSubject` reads a quad's subject\n _readSubject(token) {\n this._predicate = null;\n switch (token.type) {\n case '[':\n // Start a new quad with a new blank node as subject\n this._saveContext('blank', this._graph,\n this._subject = this._blankNode(), null, null);\n return this._readBlankNodeHead;\n case '(':\n // Start a new list\n this._saveContext('list', this._graph, this.RDF_NIL, null, null);\n this._subject = null;\n return this._readListItem;\n case '{':\n // Start a new formula\n if (!this._n3Mode)\n return this._error('Unexpected graph', token);\n this._saveContext('formula', this._graph,\n this._graph = this._blankNode(), null, null);\n return this._readSubject;\n case '}':\n // No subject; the graph in which we are reading is closed instead\n return this._readPunctuation(token);\n case '@forSome':\n if (!this._n3Mode)\n return this._error('Unexpected \"@forSome\"', token);\n this._subject = null;\n this._predicate = this.N3_FORSOME;\n this._quantifier = this._blankNode;\n return this._readQuantifierList;\n case '@forAll':\n if (!this._n3Mode)\n return this._error('Unexpected \"@forAll\"', token);\n this._subject = null;\n this._predicate = this.N3_FORALL;\n this._quantifier = this._variable;\n return this._readQuantifierList;\n case 'literal':\n if (!this._n3Mode)\n return this._error('Unexpected literal', token);\n\n if (token.prefix.length === 0) {\n this._literalValue = token.value;\n return this._completeSubjectLiteral;\n }\n else\n this._subject = this._literal(token.value, this._namedNode(token.prefix));\n\n break;\n case '<<':\n if (!this._supportsRDFStar)\n return this._error('Unexpected RDF* syntax', token);\n this._saveContext('<<', this._graph, null, null, null);\n this._graph = null;\n return this._readSubject;\n default:\n // Read the subject entity\n if ((this._subject = this._readEntity(token)) === undefined)\n return;\n // In N3 mode, the subject might be a path\n if (this._n3Mode)\n return this._getPathReader(this._readPredicateOrNamedGraph);\n }\n\n // The next token must be a predicate,\n // or, if the subject was actually a graph IRI, a named graph\n return this._readPredicateOrNamedGraph;\n }\n\n // ### `_readPredicate` reads a quad's predicate\n _readPredicate(token) {\n const type = token.type;\n switch (type) {\n case 'inverse':\n this._inversePredicate = true;\n case 'abbreviation':\n this._predicate = this.ABBREVIATIONS[token.value];\n break;\n case '.':\n case ']':\n case '}':\n // Expected predicate didn't come, must have been trailing semicolon\n if (this._predicate === null)\n return this._error(`Unexpected ${type}`, token);\n this._subject = null;\n return type === ']' ? this._readBlankNodeTail(token) : this._readPunctuation(token);\n case ';':\n // Additional semicolons can be safely ignored\n return this._predicate !== null ? this._readPredicate :\n this._error('Expected predicate but got ;', token);\n case '[':\n if (this._n3Mode) {\n // Start a new quad with a new blank node as subject\n this._saveContext('blank', this._graph, this._subject,\n this._subject = this._blankNode(), null);\n return this._readBlankNodeHead;\n }\n case 'blank':\n if (!this._n3Mode)\n return this._error('Disallowed blank node as predicate', token);\n default:\n if ((this._predicate = this._readEntity(token)) === undefined)\n return;\n }\n // The next token must be an object\n return this._readObject;\n }\n\n // ### `_readObject` reads a quad's object\n _readObject(token) {\n switch (token.type) {\n case 'literal':\n // Regular literal, can still get a datatype or language\n if (token.prefix.length === 0) {\n this._literalValue = token.value;\n return this._readDataTypeOrLang;\n }\n // Pre-datatyped string literal (prefix stores the datatype)\n else\n this._object = this._literal(token.value, this._namedNode(token.prefix));\n break;\n case '[':\n // Start a new quad with a new blank node as subject\n this._saveContext('blank', this._graph, this._subject, this._predicate,\n this._subject = this._blankNode());\n return this._readBlankNodeHead;\n case '(':\n // Start a new list\n this._saveContext('list', this._graph, this._subject, this._predicate, this.RDF_NIL);\n this._subject = null;\n return this._readListItem;\n case '{':\n // Start a new formula\n if (!this._n3Mode)\n return this._error('Unexpected graph', token);\n this._saveContext('formula', this._graph, this._subject, this._predicate,\n this._graph = this._blankNode());\n return this._readSubject;\n case '<<':\n if (!this._supportsRDFStar)\n return this._error('Unexpected RDF* syntax', token);\n this._saveContext('<<', this._graph, this._subject, this._predicate, null);\n this._graph = null;\n return this._readSubject;\n default:\n // Read the object entity\n if ((this._object = this._readEntity(token)) === undefined)\n return;\n // In N3 mode, the object might be a path\n if (this._n3Mode)\n return this._getPathReader(this._getContextEndReader());\n }\n return this._getContextEndReader();\n }\n\n // ### `_readPredicateOrNamedGraph` reads a quad's predicate, or a named graph\n _readPredicateOrNamedGraph(token) {\n return token.type === '{' ? this._readGraph(token) : this._readPredicate(token);\n }\n\n // ### `_readGraph` reads a graph\n _readGraph(token) {\n if (token.type !== '{')\n return this._error(`Expected graph but got ${token.type}`, token);\n // The \"subject\" we read is actually the GRAPH's label\n this._graph = this._subject, this._subject = null;\n return this._readSubject;\n }\n\n // ### `_readBlankNodeHead` reads the head of a blank node\n _readBlankNodeHead(token) {\n if (token.type === ']') {\n this._subject = null;\n return this._readBlankNodeTail(token);\n }\n else {\n this._predicate = null;\n return this._readPredicate(token);\n }\n }\n\n // ### `_readBlankNodeTail` reads the end of a blank node\n _readBlankNodeTail(token) {\n if (token.type !== ']')\n return this._readBlankNodePunctuation(token);\n\n // Store blank node quad\n if (this._subject !== null)\n this._emit(this._subject, this._predicate, this._object, this._graph);\n\n // Restore the parent context containing this blank node\n const empty = this._predicate === null;\n this._restoreContext('blank', token);\n // If the blank node was the object, restore previous context and read punctuation\n if (this._object !== null)\n return this._getContextEndReader();\n // If the blank node was the predicate, continue reading the object\n else if (this._predicate !== null)\n return this._readObject;\n // If the blank node was the subject, continue reading the predicate\n else\n // If the blank node was empty, it could be a named graph label\n return empty ? this._readPredicateOrNamedGraph : this._readPredicateAfterBlank;\n }\n\n // ### `_readPredicateAfterBlank` reads a predicate after an anonymous blank node\n _readPredicateAfterBlank(token) {\n switch (token.type) {\n case '.':\n case '}':\n // No predicate is coming if the triple is terminated here\n this._subject = null;\n return this._readPunctuation(token);\n default:\n return this._readPredicate(token);\n }\n }\n\n // ### `_readListItem` reads items from a list\n _readListItem(token) {\n let item = null, // The item of the list\n list = null, // The list itself\n next = this._readListItem; // The next function to execute\n const previousList = this._subject, // The previous list that contains this list\n stack = this._contextStack, // The stack of parent contexts\n parent = stack[stack.length - 1]; // The parent containing the current list\n\n switch (token.type) {\n case '[':\n // Stack the current list quad and start a new quad with a blank node as subject\n this._saveContext('blank', this._graph,\n list = this._blankNode(), this.RDF_FIRST,\n this._subject = item = this._blankNode());\n next = this._readBlankNodeHead;\n break;\n case '(':\n // Stack the current list quad and start a new list\n this._saveContext('list', this._graph,\n list = this._blankNode(), this.RDF_FIRST, this.RDF_NIL);\n this._subject = null;\n break;\n case ')':\n // Closing the list; restore the parent context\n this._restoreContext('list', token);\n // If this list is contained within a parent list, return the membership quad here.\n // This will be ` rdf:first .`.\n if (stack.length !== 0 && stack[stack.length - 1].type === 'list')\n this._emit(this._subject, this._predicate, this._object, this._graph);\n // Was this list the parent's subject?\n if (this._predicate === null) {\n // The next token is the predicate\n next = this._readPredicate;\n // No list tail if this was an empty list\n if (this._subject === this.RDF_NIL)\n return next;\n }\n // The list was in the parent context's object\n else {\n next = this._getContextEndReader();\n // No list tail if this was an empty list\n if (this._object === this.RDF_NIL)\n return next;\n }\n // Close the list by making the head nil\n list = this.RDF_NIL;\n break;\n case 'literal':\n // Regular literal, can still get a datatype or language\n if (token.prefix.length === 0) {\n this._literalValue = token.value;\n next = this._readListItemDataTypeOrLang;\n }\n // Pre-datatyped string literal (prefix stores the datatype)\n else {\n item = this._literal(token.value, this._namedNode(token.prefix));\n next = this._getContextEndReader();\n }\n break;\n case '{':\n // Start a new formula\n if (!this._n3Mode)\n return this._error('Unexpected graph', token);\n this._saveContext('formula', this._graph, this._subject, this._predicate,\n this._graph = this._blankNode());\n return this._readSubject;\n default:\n if ((item = this._readEntity(token)) === undefined)\n return;\n }\n\n // Create a new blank node if no item head was assigned yet\n if (list === null)\n this._subject = list = this._blankNode();\n\n // Is this the first element of the list?\n if (previousList === null) {\n // This list is either the subject or the object of its parent\n if (parent.predicate === null)\n parent.subject = list;\n else\n parent.object = list;\n }\n else {\n // Continue the previous list with the current list\n this._emit(previousList, this.RDF_REST, list, this._graph);\n }\n // If an item was read, add it to the list\n if (item !== null) {\n // In N3 mode, the item might be a path\n if (this._n3Mode && (token.type === 'IRI' || token.type === 'prefixed')) {\n // Create a new context to add the item's path\n this._saveContext('item', this._graph, list, this.RDF_FIRST, item);\n this._subject = item, this._predicate = null;\n // _readPath will restore the context and output the item\n return this._getPathReader(this._readListItem);\n }\n // Output the item\n this._emit(list, this.RDF_FIRST, item, this._graph);\n }\n return next;\n }\n\n // ### `_readDataTypeOrLang` reads an _optional_ datatype or language\n _readDataTypeOrLang(token) {\n return this._completeObjectLiteral(token, false);\n }\n\n\n // ### `_readListItemDataTypeOrLang` reads an _optional_ datatype or language in a list\n _readListItemDataTypeOrLang(token) {\n return this._completeObjectLiteral(token, true);\n }\n\n // ### `_completeLiteral` completes a literal with an optional datatype or language\n _completeLiteral(token) {\n // Create a simple string literal by default\n let literal = this._literal(this._literalValue);\n\n switch (token.type) {\n // Create a datatyped literal\n case 'type':\n case 'typeIRI':\n const datatype = this._readEntity(token);\n if (datatype === undefined) return; // No datatype means an error occurred\n literal = this._literal(this._literalValue, datatype);\n token = null;\n break;\n // Create a language-tagged string\n case 'langcode':\n literal = this._literal(this._literalValue, token.value);\n token = null;\n break;\n }\n\n return { token, literal };\n }\n\n // Completes a literal in subject position\n _completeSubjectLiteral(token) {\n this._subject = this._completeLiteral(token).literal;\n return this._readPredicateOrNamedGraph;\n }\n\n // Completes a literal in object position\n _completeObjectLiteral(token, listItem) {\n const completed = this._completeLiteral(token);\n if (!completed)\n return;\n this._object = completed.literal;\n\n // If this literal was part of a list, write the item\n // (we could also check the context stack, but passing in a flag is faster)\n if (listItem)\n this._emit(this._subject, this.RDF_FIRST, this._object, this._graph);\n // If the token was consumed, continue with the rest of the input\n if (completed.token === null)\n return this._getContextEndReader();\n // Otherwise, consume the token now\n else {\n this._readCallback = this._getContextEndReader();\n return this._readCallback(completed.token);\n }\n }\n\n // ### `_readFormulaTail` reads the end of a formula\n _readFormulaTail(token) {\n if (token.type !== '}')\n return this._readPunctuation(token);\n\n // Store the last quad of the formula\n if (this._subject !== null)\n this._emit(this._subject, this._predicate, this._object, this._graph);\n\n // Restore the parent context containing this formula\n this._restoreContext('formula', token);\n // If the formula was the subject, continue reading the predicate.\n // If the formula was the object, read punctuation.\n return this._object === null ? this._readPredicate : this._getContextEndReader();\n }\n\n // ### `_readPunctuation` reads punctuation between quads or quad parts\n _readPunctuation(token) {\n let next, graph = this._graph;\n const subject = this._subject, inversePredicate = this._inversePredicate;\n switch (token.type) {\n // A closing brace ends a graph\n case '}':\n if (this._graph === null)\n return this._error('Unexpected graph closing', token);\n if (this._n3Mode)\n return this._readFormulaTail(token);\n this._graph = null;\n // A dot just ends the statement, without sharing anything with the next\n case '.':\n this._subject = null;\n next = this._contextStack.length ? this._readSubject : this._readInTopContext;\n if (inversePredicate) this._inversePredicate = false;\n break;\n // Semicolon means the subject is shared; predicate and object are different\n case ';':\n next = this._readPredicate;\n break;\n // Comma means both the subject and predicate are shared; the object is different\n case ',':\n next = this._readObject;\n break;\n // {| means that the current triple is annotated with predicate-object pairs.\n case '{|':\n if (!this._supportsRDFStar)\n return this._error('Unexpected RDF* syntax', token);\n // Continue using the last triple as quoted triple subject for the predicate-object pairs.\n const predicate = this._predicate, object = this._object;\n this._subject = this._quad(subject, predicate, object, this.DEFAULTGRAPH);\n next = this._readPredicate;\n break;\n // |} means that the current quoted triple in annotation syntax is finalized.\n case '|}':\n if (this._subject.termType !== 'Quad')\n return this._error('Unexpected asserted triple closing', token);\n this._subject = null;\n next = this._readPunctuation;\n break;\n default:\n // An entity means this is a quad (only allowed if not already inside a graph)\n if (this._supportsQuads && this._graph === null && (graph = this._readEntity(token)) !== undefined) {\n next = this._readQuadPunctuation;\n break;\n }\n return this._error(`Expected punctuation to follow \"${this._object.id}\"`, token);\n }\n // A quad has been completed now, so return it\n if (subject !== null) {\n const predicate = this._predicate, object = this._object;\n if (!inversePredicate)\n this._emit(subject, predicate, object, graph);\n else\n this._emit(object, predicate, subject, graph);\n }\n return next;\n }\n\n // ### `_readBlankNodePunctuation` reads punctuation in a blank node\n _readBlankNodePunctuation(token) {\n let next;\n switch (token.type) {\n // Semicolon means the subject is shared; predicate and object are different\n case ';':\n next = this._readPredicate;\n break;\n // Comma means both the subject and predicate are shared; the object is different\n case ',':\n next = this._readObject;\n break;\n default:\n return this._error(`Expected punctuation to follow \"${this._object.id}\"`, token);\n }\n // A quad has been completed now, so return it\n this._emit(this._subject, this._predicate, this._object, this._graph);\n return next;\n }\n\n // ### `_readQuadPunctuation` reads punctuation after a quad\n _readQuadPunctuation(token) {\n if (token.type !== '.')\n return this._error('Expected dot to follow quad', token);\n return this._readInTopContext;\n }\n\n // ### `_readPrefix` reads the prefix of a prefix declaration\n _readPrefix(token) {\n if (token.type !== 'prefix')\n return this._error('Expected prefix to follow @prefix', token);\n this._prefix = token.value;\n return this._readPrefixIRI;\n }\n\n // ### `_readPrefixIRI` reads the IRI of a prefix declaration\n _readPrefixIRI(token) {\n if (token.type !== 'IRI')\n return this._error(`Expected IRI to follow prefix \"${this._prefix}:\"`, token);\n const prefixNode = this._readEntity(token);\n this._prefixes[this._prefix] = prefixNode.value;\n this._prefixCallback(this._prefix, prefixNode);\n return this._readDeclarationPunctuation;\n }\n\n // ### `_readBaseIRI` reads the IRI of a base declaration\n _readBaseIRI(token) {\n const iri = token.type === 'IRI' && this._resolveIRI(token.value);\n if (!iri)\n return this._error('Expected valid IRI to follow base declaration', token);\n this._setBase(iri);\n return this._readDeclarationPunctuation;\n }\n\n // ### `_readNamedGraphLabel` reads the label of a named graph\n _readNamedGraphLabel(token) {\n switch (token.type) {\n case 'IRI':\n case 'blank':\n case 'prefixed':\n return this._readSubject(token), this._readGraph;\n case '[':\n return this._readNamedGraphBlankLabel;\n default:\n return this._error('Invalid graph label', token);\n }\n }\n\n // ### `_readNamedGraphLabel` reads a blank node label of a named graph\n _readNamedGraphBlankLabel(token) {\n if (token.type !== ']')\n return this._error('Invalid graph label', token);\n this._subject = this._blankNode();\n return this._readGraph;\n }\n\n // ### `_readDeclarationPunctuation` reads the punctuation of a declaration\n _readDeclarationPunctuation(token) {\n // SPARQL-style declarations don't have punctuation\n if (this._sparqlStyle) {\n this._sparqlStyle = false;\n return this._readInTopContext(token);\n }\n\n if (token.type !== '.')\n return this._error('Expected declaration to end with a dot', token);\n return this._readInTopContext;\n }\n\n // Reads a list of quantified symbols from a @forSome or @forAll statement\n _readQuantifierList(token) {\n let entity;\n switch (token.type) {\n case 'IRI':\n case 'prefixed':\n if ((entity = this._readEntity(token, true)) !== undefined)\n break;\n default:\n return this._error(`Unexpected ${token.type}`, token);\n }\n // Without explicit quantifiers, map entities to a quantified entity\n if (!this._explicitQuantifiers)\n this._quantified[entity.id] = this._quantifier(this._blankNode().value);\n // With explicit quantifiers, output the reified quantifier\n else {\n // If this is the first item, start a new quantifier list\n if (this._subject === null)\n this._emit(this._graph || this.DEFAULTGRAPH, this._predicate,\n this._subject = this._blankNode(), this.QUANTIFIERS_GRAPH);\n // Otherwise, continue the previous list\n else\n this._emit(this._subject, this.RDF_REST,\n this._subject = this._blankNode(), this.QUANTIFIERS_GRAPH);\n // Output the list item\n this._emit(this._subject, this.RDF_FIRST, entity, this.QUANTIFIERS_GRAPH);\n }\n return this._readQuantifierPunctuation;\n }\n\n // Reads punctuation from a @forSome or @forAll statement\n _readQuantifierPunctuation(token) {\n // Read more quantifiers\n if (token.type === ',')\n return this._readQuantifierList;\n // End of the quantifier list\n else {\n // With explicit quantifiers, close the quantifier list\n if (this._explicitQuantifiers) {\n this._emit(this._subject, this.RDF_REST, this.RDF_NIL, this.QUANTIFIERS_GRAPH);\n this._subject = null;\n }\n // Read a dot\n this._readCallback = this._getContextEndReader();\n return this._readCallback(token);\n }\n }\n\n // ### `_getPathReader` reads a potential path and then resumes with the given function\n _getPathReader(afterPath) {\n this._afterPath = afterPath;\n return this._readPath;\n }\n\n // ### `_readPath` reads a potential path\n _readPath(token) {\n switch (token.type) {\n // Forward path\n case '!': return this._readForwardPath;\n // Backward path\n case '^': return this._readBackwardPath;\n // Not a path; resume reading where we left off\n default:\n const stack = this._contextStack, parent = stack.length && stack[stack.length - 1];\n // If we were reading a list item, we still need to output it\n if (parent && parent.type === 'item') {\n // The list item is the remaining subejct after reading the path\n const item = this._subject;\n // Switch back to the context of the list\n this._restoreContext('item', token);\n // Output the list item\n this._emit(this._subject, this.RDF_FIRST, item, this._graph);\n }\n return this._afterPath(token);\n }\n }\n\n // ### `_readForwardPath` reads a '!' path\n _readForwardPath(token) {\n let subject, predicate;\n const object = this._blankNode();\n // The next token is the predicate\n if ((predicate = this._readEntity(token)) === undefined)\n return;\n // If we were reading a subject, replace the subject by the path's object\n if (this._predicate === null)\n subject = this._subject, this._subject = object;\n // If we were reading an object, replace the subject by the path's object\n else\n subject = this._object, this._object = object;\n // Emit the path's current quad and read its next section\n this._emit(subject, predicate, object, this._graph);\n return this._readPath;\n }\n\n // ### `_readBackwardPath` reads a '^' path\n _readBackwardPath(token) {\n const subject = this._blankNode();\n let predicate, object;\n // The next token is the predicate\n if ((predicate = this._readEntity(token)) === undefined)\n return;\n // If we were reading a subject, replace the subject by the path's subject\n if (this._predicate === null)\n object = this._subject, this._subject = subject;\n // If we were reading an object, replace the subject by the path's subject\n else\n object = this._object, this._object = subject;\n // Emit the path's current quad and read its next section\n this._emit(subject, predicate, object, this._graph);\n return this._readPath;\n }\n\n // ### `_readRDFStarTailOrGraph` reads the graph of a nested RDF* quad or the end of a nested RDF* triple\n _readRDFStarTailOrGraph(token) {\n if (token.type !== '>>') {\n // An entity means this is a quad (only allowed if not already inside a graph)\n if (this._supportsQuads && this._graph === null && (this._graph = this._readEntity(token)) !== undefined)\n return this._readRDFStarTail;\n return this._error(`Expected >> to follow \"${this._object.id}\"`, token);\n }\n return this._readRDFStarTail(token);\n }\n\n // ### `_readRDFStarTail` reads the end of a nested RDF* triple\n _readRDFStarTail(token) {\n if (token.type !== '>>')\n return this._error(`Expected >> but got ${token.type}`, token);\n // Read the quad and restore the previous context\n const quad = this._quad(this._subject, this._predicate, this._object,\n this._graph || this.DEFAULTGRAPH);\n this._restoreContext('<<', token);\n // If the triple was the subject, continue by reading the predicate.\n if (this._subject === null) {\n this._subject = quad;\n return this._readPredicate;\n }\n // If the triple was the object, read context end.\n else {\n this._object = quad;\n return this._getContextEndReader();\n }\n }\n\n // ### `_getContextEndReader` gets the next reader function at the end of a context\n _getContextEndReader() {\n const contextStack = this._contextStack;\n if (!contextStack.length)\n return this._readPunctuation;\n\n switch (contextStack[contextStack.length - 1].type) {\n case 'blank':\n return this._readBlankNodeTail;\n case 'list':\n return this._readListItem;\n case 'formula':\n return this._readFormulaTail;\n case '<<':\n return this._readRDFStarTailOrGraph;\n }\n }\n\n // ### `_emit` sends a quad through the callback\n _emit(subject, predicate, object, graph) {\n this._callback(null, this._quad(subject, predicate, object, graph || this.DEFAULTGRAPH));\n }\n\n // ### `_error` emits an error message through the callback\n _error(message, token) {\n const err = new Error(`${message} on line ${token.line}.`);\n err.context = {\n token: token,\n line: token.line,\n previousToken: this._lexer.previousToken,\n };\n this._callback(err);\n this._callback = noop;\n }\n\n // ### `_resolveIRI` resolves an IRI against the base path\n _resolveIRI(iri) {\n return /^[a-z][a-z0-9+.-]*:/i.test(iri) ? iri : this._resolveRelativeIRI(iri);\n }\n\n // ### `_resolveRelativeIRI` resolves an IRI against the base path,\n // assuming that a base path has been set and that the IRI is indeed relative\n _resolveRelativeIRI(iri) {\n // An empty relative IRI indicates the base IRI\n if (!iri.length)\n return this._base;\n // Decide resolving strategy based in the first character\n switch (iri[0]) {\n // Resolve relative fragment IRIs against the base IRI\n case '#': return this._base + iri;\n // Resolve relative query string IRIs by replacing the query string\n case '?': return this._base.replace(/(?:\\?.*)?$/, iri);\n // Resolve root-relative IRIs at the root of the base IRI\n case '/':\n // Resolve scheme-relative IRIs to the scheme\n return (iri[1] === '/' ? this._baseScheme : this._baseRoot) + this._removeDotSegments(iri);\n // Resolve all other IRIs at the base IRI's path\n default:\n // Relative IRIs cannot contain a colon in the first path segment\n return (/^[^/:]*:/.test(iri)) ? null : this._removeDotSegments(this._basePath + iri);\n }\n }\n\n // ### `_removeDotSegments` resolves './' and '../' path segments in an IRI as per RFC3986\n _removeDotSegments(iri) {\n // Don't modify the IRI if it does not contain any dot segments\n if (!/(^|\\/)\\.\\.?($|[/#?])/.test(iri))\n return iri;\n\n // Start with an imaginary slash before the IRI in order to resolve trailing './' and '../'\n const length = iri.length;\n let result = '', i = -1, pathStart = -1, segmentStart = 0, next = '/';\n\n while (i < length) {\n switch (next) {\n // The path starts with the first slash after the authority\n case ':':\n if (pathStart < 0) {\n // Skip two slashes before the authority\n if (iri[++i] === '/' && iri[++i] === '/')\n // Skip to slash after the authority\n while ((pathStart = i + 1) < length && iri[pathStart] !== '/')\n i = pathStart;\n }\n break;\n // Don't modify a query string or fragment\n case '?':\n case '#':\n i = length;\n break;\n // Handle '/.' or '/..' path segments\n case '/':\n if (iri[i + 1] === '.') {\n next = iri[++i + 1];\n switch (next) {\n // Remove a '/.' segment\n case '/':\n result += iri.substring(segmentStart, i - 1);\n segmentStart = i + 1;\n break;\n // Remove a trailing '/.' segment\n case undefined:\n case '?':\n case '#':\n return result + iri.substring(segmentStart, i) + iri.substr(i + 1);\n // Remove a '/..' segment\n case '.':\n next = iri[++i + 1];\n if (next === undefined || next === '/' || next === '?' || next === '#') {\n result += iri.substring(segmentStart, i - 2);\n // Try to remove the parent path from result\n if ((segmentStart = result.lastIndexOf('/')) >= pathStart)\n result = result.substr(0, segmentStart);\n // Remove a trailing '/..' segment\n if (next !== '/')\n return `${result}/${iri.substr(i + 1)}`;\n segmentStart = i + 1;\n }\n }\n }\n }\n next = iri[++i];\n }\n return result + iri.substring(segmentStart);\n }\n\n // ## Public methods\n\n // ### `parse` parses the N3 input and emits each parsed quad through the callback\n parse(input, quadCallback, prefixCallback) {\n // The read callback is the next function to be executed when a token arrives.\n // We start reading in the top context.\n this._readCallback = this._readInTopContext;\n this._sparqlStyle = false;\n this._prefixes = Object.create(null);\n this._prefixes._ = this._blankNodePrefix ? this._blankNodePrefix.substr(2)\n : `b${blankNodePrefix++}_`;\n this._prefixCallback = prefixCallback || noop;\n this._inversePredicate = false;\n this._quantified = Object.create(null);\n\n // Parse synchronously if no quad callback is given\n if (!quadCallback) {\n const quads = [];\n let error;\n this._callback = (e, t) => { e ? (error = e) : t && quads.push(t); };\n this._lexer.tokenize(input).every(token => {\n return this._readCallback = this._readCallback(token);\n });\n if (error) throw error;\n return quads;\n }\n\n // Parse asynchronously otherwise, executing the read callback when a token arrives\n this._callback = quadCallback;\n this._lexer.tokenize(input, (error, token) => {\n if (error !== null)\n this._callback(error), this._callback = noop;\n else if (this._readCallback)\n this._readCallback = this._readCallback(token);\n });\n }\n}\n\n// The empty function\nfunction noop() {}\n\n// Initializes the parser with the given data factory\nfunction initDataFactory(parser, factory) {\n // Set factory methods\n const namedNode = factory.namedNode;\n parser._namedNode = namedNode;\n parser._blankNode = factory.blankNode;\n parser._literal = factory.literal;\n parser._variable = factory.variable;\n parser._quad = factory.quad;\n parser.DEFAULTGRAPH = factory.defaultGraph();\n\n // Set common named nodes\n parser.RDF_FIRST = namedNode(namespaces.rdf.first);\n parser.RDF_REST = namedNode(namespaces.rdf.rest);\n parser.RDF_NIL = namedNode(namespaces.rdf.nil);\n parser.N3_FORALL = namedNode(namespaces.r.forAll);\n parser.N3_FORSOME = namedNode(namespaces.r.forSome);\n parser.ABBREVIATIONS = {\n 'a': namedNode(namespaces.rdf.type),\n '=': namedNode(namespaces.owl.sameAs),\n '>': namedNode(namespaces.log.implies),\n };\n parser.QUANTIFIERS_GRAPH = namedNode('urn:n3:quantifiers');\n}\ninitDataFactory(N3Parser.prototype, N3DataFactory);\n","// RDFa Parser for rdflib.js\n\n// Originally by: Alex Milowski\n// From https://github.com/alexmilowski/green-turtle\n// Converted: timbl 2015-08-25 not yet working\n// Added wrapper: csarven 2016-05-09 working\n\n// RDFaProcessor.prototype = new Object() // Was URIResolver\n\n// RDFaProcessor.prototype.constructor=RDFaProcessor\n\n// options.base = base URI not really an option, shopuld always be set.\n//\n\nimport BlankNode from './blank-node'\nimport Literal from './literal'\nimport NamedNode from './named-node'\nimport * as Uri from './uri'\nimport * as Util from './utils-js'\nimport rdf from './factories/canonical-data-factory'\n\nif (typeof Node === 'undefined') { // @@@@@@ Global. Interface to xmldom.\n var Node = {\n ELEMENT_NODE: 1,\n ATTRIBUTE_NODE: 2,\n TEXT_NODE: 3,\n CDATA_SECTION_NODE: 4,\n ENTITY_REFERENCE_NODE: 5,\n ENTITY_NODE: 6,\n PROCESSING_INSTRUCTION_NODE: 7,\n COMMENT_NODE: 8,\n DOCUMENT_NODE: 9,\n DOCUMENT_TYPE_NODE: 10,\n DOCUMENT_FRAGMENT_NODE: 11,\n NOTATION_NODE: 12\n }\n}\n\nexport default class RDFaProcessor {\n constructor (kb, options) {\n this.options = options || {}\n this.kb = kb\n this.target = options.target || {\n graph: {\n subjects: {},\n prefixes: {},\n terms: {}\n }\n }\n // XXX: Added to track bnodes\n this.blankNodes = []\n // XXX: Added for normalisation\n this.htmlOptions = {\n 'selfClosing': 'br img input area base basefont col colgroup source wbr isindex link meta param hr'\n }\n this.theOne = '_:' + (new Date()).getTime()\n this.language = null\n this.vocabulary = null\n this.blankCounter = 0\n this.langAttributes = [ { namespaceURI: 'http://www.w3.org/XML/1998/namespace', localName: 'lang' } ]\n this.inXHTMLMode = false\n this.absURIRE = /[\\w\\_\\-]+:\\S+/\n this.finishedHandlers = []\n this.init()\n }\n\n addTriple (origin, subject, predicate, object) {\n var su, ob, pr, or\n if (typeof subject === 'undefined') {\n su = rdf.namedNode(this.options.base)\n } else {\n su = this.toRDFNodeObject(subject)\n }\n pr = this.toRDFNodeObject(predicate)\n ob = this.toRDFNodeObject(object)\n or = rdf.namedNode(this.options.base)\n // console.log('Adding { ' + su + ' ' + pr + ' ' + ob + ' ' + or + ' }')\n this.kb.add(su, pr, ob, or)\n }\n\n ancestorPath (node) {\n var path = ''\n while (node && node.nodeType !== Node.DOCUMENT_NODE) {\n path = '/' + node.localName + path\n node = node.parentNode\n }\n return path\n }\n\n copyMappings (mappings) {\n var newMappings = {}\n for (var k in mappings) {\n newMappings[k] = mappings[k]\n }\n return newMappings\n }\n\n copyProperties () {\n }\n\n deriveDateTimeType (value) {\n for (var i = 0; i < RDFaProcessor.dateTimeTypes.length; i++) {\n // console.log(\"Checking \"+value+\" against \"+RDFaProcessor.dateTimeTypes[i].type)\n var matched = RDFaProcessor.dateTimeTypes[i].pattern.exec(value)\n if (matched && matched[0].length === value.length) {\n // console.log(\"Matched!\")\n return RDFaProcessor.dateTimeTypes[i].type\n }\n }\n return null\n }\n\n init () {\n }\n\n newBlankNode () {\n this.blankCounter++\n return '_:' + this.blankCounter\n }\n\n newSubjectOrigin (origin, subject) {\n }\n\n parseCURIE (value, prefixes, base) {\n var colon = value.indexOf(':')\n var uri\n if (colon >= 0) {\n var prefix = value.substring(0, colon)\n if (prefix === '') {\n // default prefix\n uri = prefixes['']\n return uri ? uri + value.substring(colon + 1) : null\n } else if (prefix === '_') {\n // blank node\n return '_:' + value.substring(colon + 1)\n } else if (RDFaProcessor.NCNAME.test(prefix)) {\n uri = prefixes[prefix]\n if (uri) {\n return uri + value.substring(colon + 1)\n }\n }\n }\n return null\n }\n\n parseCURIEOrURI (value, prefixes, base) {\n var curie = this.parseCURIE(value, prefixes, base)\n if (curie) {\n return curie\n }\n return this.resolveAndNormalize(base, value)\n }\n\n parsePredicate (value, defaultVocabulary, terms, prefixes, base,\n ignoreTerms) {\n if (value === '') {\n return null\n }\n var predicate = this.parseTermOrCURIEOrAbsURI(value, defaultVocabulary, ignoreTerms ? null : terms, prefixes, base)\n if (predicate && predicate.indexOf('_:') === 0) {\n return null\n }\n return predicate\n }\n\n parsePrefixMappings (str, target) {\n var values = this.tokenize(str)\n var prefix = null\n // var uri = null\n for (var i = 0; i < values.length; i++) {\n if (values[i][values[i].length - 1] === ':') {\n prefix = values[i].substring(0, values[i].length - 1)\n } else if (prefix) {\n target[prefix] = this.options.base ? Uri.join(values[i], this.options.base) : values[i]\n prefix = null\n }\n }\n }\n\n static parseRDFaDOM (dom, kb, base) {\n var p = new RDFaProcessor(kb, { 'base': base })\n // Cannot assign to read only property 'baseURI' of object '#':\n if (!dom.baseURI) { // Note this became a read-only attribute some time before 2018\n dom.baseURI = base // oinly set if not already set\n }\n p.process(dom, { baseURI: base})\n }\n\n parseSafeCURIEOrCURIEOrURI (value, prefixes, base) {\n value = this.trim(value)\n if (value.charAt(0) === '[' && value.charAt(value.length - 1) === ']') {\n value = value.substring(1, value.length - 1)\n value = value.trim(value)\n if (value.length === 0) {\n return null\n }\n if (value === '_:') {\n // the one node\n return this.theOne\n }\n return this.parseCURIE(value, prefixes, base)\n } else {\n return this.parseCURIEOrURI(value, prefixes, base)\n }\n }\n\n parseTermOrCURIEOrAbsURI (value, defaultVocabulary, terms, prefixes, base) {\n // alert(\"Parsing \"+value+\" with default vocab \"+defaultVocabulary)\n value = this.trim(value)\n var curie = this.parseCURIE(value, prefixes, base)\n if (curie) {\n return curie\n } else if (terms) {\n if (defaultVocabulary && !this.absURIRE.exec(value)) {\n return defaultVocabulary + value\n }\n var term = terms[value]\n if (term) {\n return term\n }\n var lcvalue = value.toLowerCase()\n term = terms[lcvalue]\n if (term) {\n return term\n }\n }\n if (this.absURIRE.exec(value)) {\n return this.resolveAndNormalize(base, value)\n }\n return null\n }\n\n parseTermOrCURIEOrURI (value, defaultVocabulary, terms, prefixes, base) {\n // alert(\"Parsing \"+value+\" with default vocab \"+defaultVocabulary)\n value = this.trim(value)\n var curie = this.parseCURIE(value, prefixes, base)\n if (curie) {\n return curie\n } else {\n var term = terms[value]\n if (term) {\n return term\n }\n var lcvalue = value.toLowerCase()\n term = terms[lcvalue]\n if (term) {\n return term\n }\n if (defaultVocabulary && !this.absURIRE.exec(value)) {\n return defaultVocabulary + value\n }\n }\n return this.resolveAndNormalize(base, value)\n }\n\n parseURI (uri) {\n return uri // We just use strings as URIs, not objects now.\n }\n\n process (node, options) {\n /*\n if (!window.console) {\n window.console = { log: function() {} }\n } */\n options = options || {}\n var base\n if (node.nodeType === Node.DOCUMENT_NODE) {\n if (node.baseURI && !options.baseURI) {\n options.baseURI = node.baseURI // be defensive as DOM implementations vary\n }\n base = node.baseURI\n node = node.documentElement\n if (!node.baseURI) {\n node.baseURI = base\n }\n this.setContext(node)\n } else if (node.parentNode.nodeType === Node.DOCUMENT_NODE) {\n this.setContext(node)\n }\n var queue = []\n // Fix for Firefox that includes the hash in the base URI\n var removeHash = function (baseURI) {\n // Fix for undefined baseURI property\n if (!baseURI && options && options.baseURI) {\n return options.baseURI\n }\n\n var hash = baseURI.indexOf('#')\n if (hash >= 0) {\n baseURI = baseURI.substring(0, hash)\n }\n if (options && options.baseURIMap) {\n baseURI = options.baseURIMap(baseURI)\n }\n return baseURI\n }\n queue.push({ current: node,\n context: this.push(null, removeHash(node.baseURI))\n })\n while (queue.length > 0) {\n var item = queue.shift()\n if (item.parent) {\n // Sequence Step 14: list triple generation\n if (item.context.parent && item.context.parent.listMapping === item.listMapping) {\n // Skip a child context with exactly the same mapping\n continue\n }\n // console.log(\"Generating lists for \"+item.subject+\", tag \"+item.parent.localName)\n for (let predicate in item.listMapping) {\n var list = item.listMapping[predicate]\n if (list.length === 0) {\n this.addTriple(item.parent, item.subject, predicate, { type: RDFaProcessor.objectURI, value: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil' })\n continue\n }\n var bnodes = []\n for (let i = 0; i < list.length; i++) {\n bnodes.push(this.newBlankNode())\n // this.newSubject(item.parent,bnodes[i])\n }\n for (let i = 0; i < bnodes.length; i++) {\n this.addTriple(item.parent, bnodes[i], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', list[i])\n this.addTriple(item.parent, bnodes[i], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', { type: RDFaProcessor.objectURI, value: (i + 1) < bnodes.length ? bnodes[i + 1] : 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil' })\n }\n this.addTriple(item.parent, item.subject, predicate, { type: RDFaProcessor.objectURI, value: bnodes[0] })\n }\n continue\n }\n var current = item.current\n var context = item.context\n // console.log(\"Tag: \"+current.localName+\", listMapping=\"+JSON.stringify(context.listMapping))\n // Sequence Step 1\n var skip = false\n var newSubject = null\n var currentObjectResource = null\n var typedResource = null\n var prefixes = context.prefixes\n var prefixesCopied = false\n var incomplete = []\n var listMapping = context.listMapping\n var listMappingDifferent = !context.parent\n var language = context.language\n var vocabulary = context.vocabulary\n // TODO: the \"base\" element may be used for HTML+RDFa 1.1\n base = this.parseURI(removeHash(current.baseURI))\n current.item = null\n // Sequence Step 2: set the default vocabulary\n var vocabAtt = current.getAttributeNode('vocab')\n if (vocabAtt) {\n let value = this.trim(vocabAtt.value)\n if (value.length > 0) {\n vocabulary = value\n var baseSubject = base.spec\n // this.newSubject(current,baseSubject)\n this.addTriple(current, baseSubject, 'http://www.w3.org/ns/rdfa#usesVocabulary', { type: RDFaProcessor.objectURI, value: vocabulary })\n } else {\n vocabulary = this.vocabulary\n }\n }\n // Sequence Step 3: IRI mappings\n // handle xmlns attributes\n for (var i = 0; i < current.attributes.length; i++) {\n var att = current.attributes[i]\n // if (att.namespaceURI==\"http://www.w3.org/2000/xmlns/\") {\n if (att.nodeName.charAt(0) === 'x' && att.nodeName.indexOf('xmlns:') === 0) {\n if (!prefixesCopied) {\n prefixes = this.copyMappings(prefixes)\n prefixesCopied = true\n }\n var prefix = att.nodeName.substring(6)\n // TODO: resolve relative?\n var ref = RDFaProcessor.trim(att.value)\n prefixes[prefix] = this.options.base ? Uri.join(ref, this.options.base) : ref\n }\n }\n // Handle prefix mappings (@prefix)\n var prefixAtt = current.getAttributeNode('prefix')\n if (prefixAtt) {\n if (!prefixesCopied) {\n prefixes = this.copyMappings(prefixes)\n prefixesCopied = true\n }\n this.parsePrefixMappings(prefixAtt.value, prefixes)\n }\n // Sequence Step 4: language\n var xmlLangAtt = null\n for (let i = 0; !xmlLangAtt && i < this.langAttributes.length; i++) {\n xmlLangAtt = current.getAttributeNodeNS(this.langAttributes[i].namespaceURI, this.langAttributes[i].localName)\n }\n if (xmlLangAtt) {\n let value = RDFaProcessor.trim(xmlLangAtt.value)\n if (value.length > 0) {\n language = value\n } else {\n language = null\n }\n }\n var relAtt = current.getAttributeNode('rel')\n var revAtt = current.getAttributeNode('rev')\n var typeofAtt = current.getAttributeNode('typeof')\n var propertyAtt = current.getAttributeNode('property')\n var datatypeAtt = current.getAttributeNode('datatype')\n var datetimeAtt = this.inHTMLMode\n ? current.getAttributeNode('datetime')\n : null\n var contentAtt = current.getAttributeNode('content')\n var aboutAtt = current.getAttributeNode('about')\n var srcAtt = current.getAttributeNode('src')\n var resourceAtt = current.getAttributeNode('resource')\n var hrefAtt = current.getAttributeNode('href')\n var inlistAtt = current.getAttributeNode('inlist')\n var relAttPredicates = []\n var predicate, values\n if (relAtt) {\n values = this.tokenize(relAtt.value)\n for (let i = 0; i < values.length; i++) {\n predicate = this.parsePredicate(values[i], vocabulary, context.terms, prefixes, base, this.inHTMLMode && propertyAtt !== null)\n if (predicate) {\n relAttPredicates.push(predicate)\n }\n }\n }\n var revAttPredicates = []\n if (revAtt) {\n values = this.tokenize(revAtt.value)\n for (let i = 0; i < values.length; i++) {\n predicate = this.parsePredicate(values[i], vocabulary, context.terms, prefixes, base, this.inHTMLMode && propertyAtt)\n if (predicate) {\n revAttPredicates.push(predicate)\n }\n }\n }\n // Section 3.1, bullet 7\n if (this.inHTMLMode && (relAtt || revAtt) && propertyAtt) {\n if (relAttPredicates.length === 0) {\n relAtt = null\n }\n if (revAttPredicates.length === 0) {\n revAtt = null\n }\n }\n if (relAtt || revAtt) {\n // Sequence Step 6: establish new subject and value\n if (aboutAtt) {\n newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base)\n }\n if (typeofAtt) {\n typedResource = newSubject\n }\n if (!newSubject) {\n if (current.parentNode.nodeType === Node.DOCUMENT_NODE) {\n newSubject = removeHash(current.baseURI)\n } else if (context.parentObject) {\n // TODO: Verify: If the xml:base has been set and the parentObject is the baseURI of the parent, then the subject needs to be the new base URI\n newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject\n }\n }\n if (resourceAtt) {\n currentObjectResource = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base)\n }\n if (!currentObjectResource) {\n if (hrefAtt) {\n currentObjectResource = this.resolveAndNormalize(base, encodeURI(hrefAtt.value))\n } else if (srcAtt) {\n currentObjectResource = this.resolveAndNormalize(base, encodeURI(srcAtt.value))\n } else if (typeofAtt && !aboutAtt && !(this.inXHTMLMode && (current.localName === 'head' || current.localName === 'body'))) {\n currentObjectResource = this.newBlankNode()\n }\n }\n if (typeofAtt && !aboutAtt && this.inXHTMLMode && (current.localName === 'head' || current.localName === 'body')) {\n typedResource = newSubject\n } else if (typeofAtt && !aboutAtt) {\n typedResource = currentObjectResource\n }\n } else if (propertyAtt && !contentAtt && !datatypeAtt) {\n // Sequence Step 5.1: establish a new subject\n if (aboutAtt) {\n newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base)\n if (typeofAtt) {\n typedResource = newSubject\n }\n }\n if (!newSubject && current.parentNode.nodeType === Node.DOCUMENT_NODE) {\n newSubject = removeHash(current.baseURI)\n if (typeofAtt) {\n typedResource = newSubject\n }\n } else if (!newSubject && context.parentObject) {\n // TODO: Verify: If the xml:base has been set and the parentObject is the baseURI of the parent, then the subject needs to be the new base URI\n newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject\n }\n if (typeofAtt && !typedResource) {\n if (resourceAtt) {\n typedResource = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base)\n }\n if (!typedResource && hrefAtt) {\n typedResource = this.resolveAndNormalize(base, encodeURI(hrefAtt.value))\n }\n if (!typedResource && srcAtt) {\n typedResource = this.resolveAndNormalize(base, encodeURI(srcAtt.value))\n }\n if (!typedResource && (this.inXHTMLMode || this.inHTMLMode) && (current.localName === 'head' || current.localName === 'body')) {\n typedResource = newSubject\n }\n if (!typedResource) {\n typedResource = this.newBlankNode()\n }\n currentObjectResource = typedResource\n }\n // console.log(current.localName+\", newSubject=\"+newSubject+\", typedResource=\"+typedResource+\", currentObjectResource=\"+currentObjectResource)\n } else {\n // Sequence Step 5.2: establish a new subject\n if (aboutAtt) {\n newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base)\n }\n if (!newSubject && resourceAtt) {\n newSubject = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base)\n }\n if (!newSubject && hrefAtt) {\n newSubject = this.resolveAndNormalize(base, encodeURI(hrefAtt.value))\n }\n if (!newSubject && srcAtt) {\n newSubject = this.resolveAndNormalize(base, encodeURI(srcAtt.value))\n }\n if (!newSubject) {\n if (current.parentNode.nodeType === Node.DOCUMENT_NODE) {\n newSubject = removeHash(current.baseURI)\n } else if ((this.inXHTMLMode || this.inHTMLMode) && (current.localName === 'head' || current.localName === 'body')) {\n newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject\n } else if (typeofAtt) {\n newSubject = this.newBlankNode()\n } else if (context.parentObject) {\n // TODO: Verify: If the xml:base has been set and the parentObject is the baseURI of the parent, then the subject needs to be the new base URI\n newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject\n if (!propertyAtt) {\n skip = true\n }\n }\n }\n if (typeofAtt) {\n typedResource = newSubject\n }\n }\n // console.log(current.tagName+\": newSubject=\"+newSubject+\", currentObjectResource=\"+currentObjectResource+\", typedResource=\"+typedResource+\", skip=\"+skip)\n // var rdfaData = null\n if (newSubject) {\n // this.newSubject(current,newSubject)\n if (aboutAtt || resourceAtt || typedResource) {\n var id = newSubject\n if (typeofAtt && !aboutAtt && !resourceAtt && currentObjectResource) {\n id = currentObjectResource\n }\n // console.log(\"Setting data attribute for \"+current.localName+\" for subject \"+id)\n this.newSubjectOrigin(current, id)\n }\n }\n // Sequence Step 7: generate type triple\n if (typedResource) {\n values = this.tokenize(typeofAtt.value)\n for (let i = 0; i < values.length; i++) {\n var object = this.parseTermOrCURIEOrAbsURI(values[i], vocabulary, context.terms, prefixes, base)\n if (object) {\n this.addTriple(current, typedResource, RDFaProcessor.typeURI, { type: RDFaProcessor.objectURI, value: object })\n }\n }\n }\n // Sequence Step 8: new list mappings if there is a new subject\n // console.log(\"Step 8: newSubject=\"+newSubject+\", context.parentObject=\"+context.parentObject)\n if (newSubject && newSubject !== context.parentObject) {\n // console.log(\"Generating new list mapping for \"+newSubject)\n listMapping = {}\n listMappingDifferent = true\n }\n // Sequence Step 9: generate object triple\n if (currentObjectResource) {\n if (relAtt && inlistAtt) {\n for (let i = 0; i < relAttPredicates.length; i++) {\n let list = listMapping[relAttPredicates[i]]\n if (!list) {\n list = []\n listMapping[relAttPredicates[i]] = list\n }\n list.push({ type: RDFaProcessor.objectURI, value: currentObjectResource })\n }\n } else if (relAtt) {\n for (let i = 0; i < relAttPredicates.length; i++) {\n this.addTriple(current, newSubject, relAttPredicates[i], { type: RDFaProcessor.objectURI, value: currentObjectResource })\n }\n }\n if (revAtt) {\n for (let i = 0; i < revAttPredicates.length; i++) {\n this.addTriple(current, currentObjectResource, revAttPredicates[i], { type: RDFaProcessor.objectURI, value: newSubject })\n }\n }\n } else {\n // Sequence Step 10: incomplete triples\n if (newSubject && !currentObjectResource && (relAtt || revAtt)) {\n currentObjectResource = this.newBlankNode()\n // alert(current.tagName+\": generated blank node, newSubject=\"+newSubject+\" currentObjectResource=\"+currentObjectResource)\n }\n if (relAtt && inlistAtt) {\n for (let i = 0; i < relAttPredicates.length; i++) {\n let list = listMapping[relAttPredicates[i]]\n if (!list) {\n list = []\n listMapping[predicate] = list\n }\n // console.log(\"Adding incomplete list for \"+predicate)\n incomplete.push({ predicate: relAttPredicates[i], list: list })\n }\n } else if (relAtt) {\n for (let i = 0; i < relAttPredicates.length; i++) {\n incomplete.push({ predicate: relAttPredicates[i], forward: true })\n }\n }\n if (revAtt) {\n for (let i = 0; i < revAttPredicates.length; i++) {\n incomplete.push({ predicate: revAttPredicates[i], forward: false })\n }\n }\n }\n // Step 11: Current property values\n if (propertyAtt) {\n var datatype = null\n var content = null\n if (datatypeAtt) {\n datatype = datatypeAtt.value === '' ? RDFaProcessor.PlainLiteralURI : this.parseTermOrCURIEOrAbsURI(datatypeAtt.value, vocabulary, context.terms, prefixes, base)\n if (datetimeAtt && !contentAtt) {\n content = datetimeAtt.value\n } else {\n content = datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI ? null : (contentAtt ? contentAtt.value : current.textContent)\n }\n } else if (contentAtt) {\n datatype = RDFaProcessor.PlainLiteralURI\n content = contentAtt.value\n } else if (datetimeAtt) {\n content = datetimeAtt.value\n datatype = RDFaProcessor.deriveDateTimeType(content)\n if (!datatype) {\n datatype = RDFaProcessor.PlainLiteralURI\n }\n } else if (!relAtt && !revAtt) {\n if (resourceAtt) {\n content = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base)\n }\n if (!content && hrefAtt) {\n content = this.resolveAndNormalize(base, encodeURI(hrefAtt.value))\n } else if (!content && srcAtt) {\n content = this.resolveAndNormalize(base, encodeURI(srcAtt.value))\n }\n if (content) {\n datatype = RDFaProcessor.objectURI\n }\n }\n if (!datatype) {\n if (typeofAtt && !aboutAtt) {\n datatype = RDFaProcessor.objectURI\n content = typedResource\n } else {\n content = current.textContent\n if (this.inHTMLMode && current.localName === 'time') {\n datatype = RDFaProcessor.deriveDateTimeType(content)\n }\n if (!datatype) {\n datatype = RDFaProcessor.PlainLiteralURI\n }\n }\n }\n values = this.tokenize(propertyAtt.value)\n for (let i = 0; i < values.length; i++) {\n let predicate = this.parsePredicate(values[i], vocabulary, context.terms, prefixes, base)\n if (predicate) {\n if (inlistAtt) {\n let list = listMapping[predicate]\n if (!list) {\n list = []\n listMapping[predicate] = list\n }\n list.push((datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI) ? { type: datatype, value: current.childNodes } : { type: datatype || RDFaProcessor.PlainLiteralURI, value: content, language: language })\n } else {\n if (datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI) {\n this.addTriple(current, newSubject, predicate, { type: datatype, value: current.childNodes })\n } else {\n this.addTriple(current, newSubject, predicate, { type: datatype || RDFaProcessor.PlainLiteralURI, value: content, language: language })\n // console.log(newSubject+\" \"+predicate+\"=\"+content)\n }\n }\n }\n }\n }\n // Sequence Step 12: complete incomplete triples with new subject\n if (newSubject && !skip) {\n for (let i = 0; i < context.incomplete.length; i++) {\n if (context.incomplete[i].list) {\n // console.log(\"Adding subject \"+newSubject+\" to list for \"+context.incomplete[i].predicate)\n // TODO: it is unclear what to do here\n context.incomplete[i].list.push({ type: RDFaProcessor.objectURI, value: newSubject })\n } else if (context.incomplete[i].forward) {\n // console.log(current.tagName+\": completing forward triple \"+context.incomplete[i].predicate+\" with object=\"+newSubject)\n this.addTriple(current, context.subject, context.incomplete[i].predicate, { type: RDFaProcessor.objectURI, value: newSubject })\n } else {\n // console.log(current.tagName+\": completing reverse triple with object=\"+context.subject)\n this.addTriple(current, newSubject, context.incomplete[i].predicate, { type: RDFaProcessor.objectURI, value: context.subject })\n }\n }\n }\n var childContext = null\n var listSubject = newSubject\n if (skip) {\n // TODO: should subject be null?\n childContext = this.push(context, context.subject)\n // TODO: should the entObject be passed along? If not, then intermediary children will keep properties from being associated with incomplete triples.\n // TODO: Verify: if the current baseURI has changed and the parentObject is the parent's base URI, then the baseURI should change\n childContext.parentObject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject\n childContext.incomplete = context.incomplete\n childContext.language = language\n childContext.prefixes = prefixes\n childContext.vocabulary = vocabulary\n } else {\n childContext = this.push(context, newSubject)\n childContext.parentObject = currentObjectResource || (newSubject || context.subject)\n childContext.prefixes = prefixes\n childContext.incomplete = incomplete\n if (currentObjectResource) {\n // console.log(\"Generating new list mapping for \"+currentObjectResource)\n listSubject = currentObjectResource\n listMapping = {}\n listMappingDifferent = true\n }\n childContext.listMapping = listMapping\n childContext.language = language\n childContext.vocabulary = vocabulary\n }\n if (listMappingDifferent) {\n // console.log(\"Pushing list parent \"+current.localName)\n queue.unshift({ parent: current, context: context, subject: listSubject, listMapping: listMapping })\n }\n for (var child = current.lastChild; child; child = child.previousSibling) {\n if (child.nodeType === Node.ELEMENT_NODE) {\n // console.log(\"Pushing child \"+child.localName)\n // child.baseURI = current.baseURI\n queue.unshift({ current: child, context: childContext })\n }\n }\n }\n if (this.inHTMLMode) {\n this.copyProperties()\n }\n for (let i = 0; i < this.finishedHandlers.length; i++) {\n this.finishedHandlers[i](node)\n }\n }\n\n push (parent, subject) {\n return {\n parent: parent,\n subject: subject || (parent ? parent.subject : null),\n parentObject: null,\n incomplete: [],\n listMapping: parent ? parent.listMapping : {},\n language: parent ? parent.language : this.language,\n prefixes: parent ? parent.prefixes : this.target.graph.prefixes,\n terms: parent ? parent.terms : this.target.graph.terms,\n vocabulary: parent ? parent.vocabulary : this.vocabulary\n }\n }\n\n resolveAndNormalize (base, uri) {\n // console.log(\"Joining \" + uri + \" to \" + base + \" making \" + Uri.join(uri, base))\n return Uri.join(uri, base) // @@ normalize?\n }\n\n setContext (node) {\n // We only recognized XHTML+RDFa 1.1 if the version is set propertyly\n if (node.localName === 'html' && node.getAttribute('version') === 'XHTML+RDFa 1.1') {\n this.setXHTMLContext()\n } else if (node.localName === 'html' || node.namespaceURI === 'http://www.w3.org/1999/xhtml') {\n if (typeof document !== 'undefined' && document.doctype) {\n if (document.doctype.publicId === '-//W3C//DTD XHTML+RDFa 1.0//EN' && document.doctype.systemId === 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd') {\n console.log('WARNING: RDF 1.0 is not supported. Defaulting to HTML5 mode.')\n this.setHTMLContext()\n } else if (document.doctype.publicId === '-//W3C//DTD XHTML+RDFa 1.1//EN' && document.doctype.systemId === 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd') {\n this.setXHTMLContext()\n } else {\n this.setHTMLContext()\n }\n } else {\n this.setHTMLContext()\n }\n } else {\n this.setXMLContext()\n }\n }\n\n setHTMLContext () {\n this.setInitialContext()\n this.langAttributes = [\n {\n namespaceURI: 'http://www.w3.org/XML/1998/namespace',\n localName: 'lang'\n },\n { namespaceURI: null, localName: 'lang' }\n ]\n this.inXHTMLMode = false\n this.inHTMLMode = true\n }\n\n setInitialContext () {\n this.vocabulary = null\n // By default, the prefixes are terms are loaded to the RDFa 1.1. standard within the graph constructor\n this.langAttributes = [\n {\n namespaceURI: 'http://www.w3.org/XML/1998/namespace',\n localName: 'lang'\n }\n ]\n }\n\n setXHTMLContext () {\n this.setInitialContext()\n this.inXHTMLMode = true\n this.inHTMLMode = false\n this.langAttributes = [\n {\n namespaceURI: 'http://www.w3.org/XML/1998/namespace',\n localName: 'lang' },\n { namespaceURI: null, localName: 'lang' }\n ]\n // From http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1\n this.target.graph.terms['alternate'] = 'http://www.w3.org/1999/xhtml/vocab#alternate'\n this.target.graph.terms['appendix'] = 'http://www.w3.org/1999/xhtml/vocab#appendix'\n this.target.graph.terms['bookmark'] = 'http://www.w3.org/1999/xhtml/vocab#bookmark'\n this.target.graph.terms['cite'] = 'http://www.w3.org/1999/xhtml/vocab#cite'\n this.target.graph.terms['chapter'] = 'http://www.w3.org/1999/xhtml/vocab#chapter'\n this.target.graph.terms['contents'] = 'http://www.w3.org/1999/xhtml/vocab#contents'\n this.target.graph.terms['copyright'] = 'http://www.w3.org/1999/xhtml/vocab#copyright'\n this.target.graph.terms['first'] = 'http://www.w3.org/1999/xhtml/vocab#first'\n this.target.graph.terms['glossary'] = 'http://www.w3.org/1999/xhtml/vocab#glossary'\n this.target.graph.terms['help'] = 'http://www.w3.org/1999/xhtml/vocab#help'\n this.target.graph.terms['icon'] = 'http://www.w3.org/1999/xhtml/vocab#icon'\n this.target.graph.terms['index'] = 'http://www.w3.org/1999/xhtml/vocab#index'\n this.target.graph.terms['last'] = 'http://www.w3.org/1999/xhtml/vocab#last'\n this.target.graph.terms['license'] = 'http://www.w3.org/1999/xhtml/vocab#license'\n this.target.graph.terms['meta'] = 'http://www.w3.org/1999/xhtml/vocab#meta'\n this.target.graph.terms['next'] = 'http://www.w3.org/1999/xhtml/vocab#next'\n this.target.graph.terms['prev'] = 'http://www.w3.org/1999/xhtml/vocab#prev'\n this.target.graph.terms['previous'] = 'http://www.w3.org/1999/xhtml/vocab#previous'\n this.target.graph.terms['section'] = 'http://www.w3.org/1999/xhtml/vocab#section'\n this.target.graph.terms['stylesheet'] = 'http://www.w3.org/1999/xhtml/vocab#stylesheet'\n this.target.graph.terms['subsection'] = 'http://www.w3.org/1999/xhtml/vocab#subsection'\n this.target.graph.terms['start'] = 'http://www.w3.org/1999/xhtml/vocab#start'\n this.target.graph.terms['top'] = 'http://www.w3.org/1999/xhtml/vocab#top'\n this.target.graph.terms['up'] = 'http://www.w3.org/1999/xhtml/vocab#up'\n this.target.graph.terms['p3pv1'] = 'http://www.w3.org/1999/xhtml/vocab#p3pv1'\n // other\n this.target.graph.terms['related'] = 'http://www.w3.org/1999/xhtml/vocab#related'\n this.target.graph.terms['role'] = 'http://www.w3.org/1999/xhtml/vocab#role'\n this.target.graph.terms['transformation'] = 'http://www.w3.org/1999/xhtml/vocab#transformation'\n }\n\n setXMLContext () {\n this.setInitialContext()\n this.inXHTMLMode = false\n this.inHTMLMode = false\n }\n\n tokenize (str) {\n return this.trim(str).split(/\\s+/)\n }\n static tokenize (str) {\n return this.trim(str).split(/\\s+/)\n }\n\n toRDFNodeObject (x) {\n if (typeof x === 'undefined') return undefined\n if (typeof x === 'string') {\n if (x.substring(0, 2) === '_:') {\n if (typeof this.blankNodes[x.substring(2)] === 'undefined') {\n this.blankNodes[x.substring(2)] = new BlankNode(x.substring(2))\n }\n return this.blankNodes[x.substring(2)]\n }\n return rdf.namedNode(x)\n }\n switch (x.type) {\n case RDFaProcessor.objectURI:\n if (x.value.substring(0, 2) === '_:') {\n if (typeof this.blankNodes[x.value.substring(2)] === 'undefined') {\n this.blankNodes[x.value.substring(2)] = new BlankNode(x.value.substring(2))\n }\n return this.blankNodes[x.value.substring(2)]\n }\n return rdf.namedNode(x.value)\n case RDFaProcessor.PlainLiteralURI:\n return new Literal(x.value, x.language || '')\n case RDFaProcessor.XMLLiteralURI:\n case RDFaProcessor.HTMLLiteralURI:\n var string = ''\n Object.keys(x.value).forEach(i => {\n string += Util.domToString(x.value[i], this.htmlOptions)\n })\n return new Literal(string, '', new NamedNode(x.type))\n default:\n return new Literal(x.value, '', new NamedNode(x.type))\n }\n }\n\n trim (str) {\n return str.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '')\n }\n static trim (str) {\n return str.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '')\n }\n}\n\nRDFaProcessor.XMLLiteralURI =\n 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral'\nRDFaProcessor.HTMLLiteralURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML'\nRDFaProcessor.PlainLiteralURI =\n 'http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral'\nRDFaProcessor.objectURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#object'\nRDFaProcessor.typeURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'\nRDFaProcessor.nameChar =\n '[-A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u10000-\\uEFFFF\\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]'\nRDFaProcessor.nameStartChar =\n '[\\u0041-\\u005A\\u0061-\\u007A\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u00FF\\u0100-\\u0131\\u0134-\\u013E\\u0141-\\u0148\\u014A-\\u017E\\u0180-\\u01C3\\u01CD-\\u01F0\\u01F4-\\u01F5\\u01FA-\\u0217\\u0250-\\u02A8\\u02BB-\\u02C1\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03CE\\u03D0-\\u03D6\\u03DA\\u03DC\\u03DE\\u03E0\\u03E2-\\u03F3\\u0401-\\u040C\\u040E-\\u044F\\u0451-\\u045C\\u045E-\\u0481\\u0490-\\u04C4\\u04C7-\\u04C8\\u04CB-\\u04CC\\u04D0-\\u04EB\\u04EE-\\u04F5\\u04F8-\\u04F9\\u0531-\\u0556\\u0559\\u0561-\\u0586\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0621-\\u063A\\u0641-\\u064A\\u0671-\\u06B7\\u06BA-\\u06BE\\u06C0-\\u06CE\\u06D0-\\u06D3\\u06D5\\u06E5-\\u06E6\\u0905-\\u0939\\u093D\\u0958-\\u0961\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09DC-\\u09DD\\u09DF-\\u09E1\\u09F0-\\u09F1\\u0A05-\\u0A0A\\u0A0F-\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32-\\u0A33\\u0A35-\\u0A36\\u0A38-\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8B\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2-\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AE0\\u0B05-\\u0B0C\\u0B0F-\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32-\\u0B33\\u0B36-\\u0B39\\u0B3D\\u0B5C-\\u0B5D\\u0B5F-\\u0B61\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99-\\u0B9A\\u0B9C\\u0B9E-\\u0B9F\\u0BA3-\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB5\\u0BB7-\\u0BB9\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C60-\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CDE\\u0CE0-\\u0CE1\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D28\\u0D2A-\\u0D39\\u0D60-\\u0D61\\u0E01-\\u0E2E\\u0E30\\u0E32-\\u0E33\\u0E40-\\u0E45\\u0E81-\\u0E82\\u0E84\\u0E87-\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA-\\u0EAB\\u0EAD-\\u0EAE\\u0EB0\\u0EB2-\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0F40-\\u0F47\\u0F49-\\u0F69\\u10A0-\\u10C5\\u10D0-\\u10F6\\u1100\\u1102-\\u1103\\u1105-\\u1107\\u1109\\u110B-\\u110C\\u110E-\\u1112\\u113C\\u113E\\u1140\\u114C\\u114E\\u1150\\u1154-\\u1155\\u1159\\u115F-\\u1161\\u1163\\u1165\\u1167\\u1169\\u116D-\\u116E\\u1172-\\u1173\\u1175\\u119E\\u11A8\\u11AB\\u11AE-\\u11AF\\u11B7-\\u11B8\\u11BA\\u11BC-\\u11C2\\u11EB\\u11F0\\u11F9\\u1E00-\\u1E9B\\u1EA0-\\u1EF9\\u1F00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2126\\u212A-\\u212B\\u212E\\u2180-\\u2182\\u3041-\\u3094\\u30A1-\\u30FA\\u3105-\\u312C\\uAC00-\\uD7A3\\u4E00-\\u9FA5\\u3007\\u3021-\\u3029_]'\nRDFaProcessor.NCNAME = new RegExp('^' + RDFaProcessor.nameStartChar +\n RDFaProcessor.nameChar + '*$')\n\n/*\nRDFaProcessor.prototype.resolveAndNormalize = function(base,href) {\n var u = base.resolve(href)\n var parsed = this.parseURI(u)\n parsed.normalize()\n return parsed.spec\n}\n*/\n\nRDFaProcessor.dateTimeTypes = [\n { pattern: /-?P(?:[0-9]+Y)?(?:[0-9]+M)?(?:[0-9]+D)?(?:T(?:[0-9]+H)?(?:[0-9]+M)?(?:[0-9]+(?:\\.[0-9]+)?S)?)?/,\n type: 'http://www.w3.org/2001/XMLSchema#duration' },\n { pattern: /-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]-[0-9][0-9]T(?:[0-1][0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]+)?(?:Z|[+\\-][0-9][0-9]:[0-9][0-9])?/,\n type: 'http://www.w3.org/2001/XMLSchema#dateTime' },\n { pattern: /-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]-[0-9][0-9](?:Z|[+\\-][0-9][0-9]:[0-9][0-9])?/,\n type: 'http://www.w3.org/2001/XMLSchema#date' },\n { pattern: /(?:[0-1][0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]+)?(?:Z|[+\\-][0-9][0-9]:[0-9][0-9])?/,\n type: 'http://www.w3.org/2001/XMLSchema#time' },\n { pattern: /-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]/,\n type: 'http://www.w3.org/2001/XMLSchema#gYearMonth' },\n { pattern: /-?[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9]/,\n type: 'http://www.w3.org/2001/XMLSchema#gYear' }\n]\n\nconst parseRDFaDOM = RDFaProcessor.parseRDFaDOM\nexport { parseRDFaDOM }\n","/**\n * RDF/XML PARSER\n *\n * Parser believed to be in full positive RDF/XML parsing compliance\n * with the possible exception of handling deprecated RDF attributes\n * appropriately. Parser is believed to comply fully with other W3C\n * and industry standards where appropriate (DOM, ECMAScript, &c.)\n *\n * Author: David Sheets \n *\n * W3C® SOFTWARE NOTICE AND LICENSE\n * http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231\n * This work (and included software, documentation such as READMEs, or\n * other related items) is being provided by the copyright holders under\n * the following license. By obtaining, using and/or copying this work,\n * you (the licensee) agree that you have read, understood, and will\n * comply with the following terms and conditions.\n *\n * Permission to copy, modify, and distribute this software and its\n * documentation, with or without modification, for any purpose and\n * without fee or royalty is hereby granted, provided that you include\n * the following on ALL copies of the software and documentation or\n * portions thereof, including modifications:\n *\n * 1. The full text of this NOTICE in a location viewable to users of\n * the redistributed or derivative work.\n * 2. Any pre-existing intellectual property disclaimers, notices, or terms and\n * conditions. If none exist, the W3C Software Short Notice should be\n * included (hypertext is preferred, text is permitted) within the body\n * of any redistributed or derivative code.\n * 3. Notice of any changes or modifications to the files, including the\n * date changes were made. (We recommend you provide URIs to the location\n * from which the code is derived.)\n *\n * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED \"AS IS,\" AND COPYRIGHT\n * HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,\n * INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS\n * FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR\n * DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,\n * TRADEMARKS OR OTHER RIGHTS.\n *\n * COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL\n * OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR\n * DOCUMENTATION.\n *\n * The name and trademarks of copyright holders may NOT be used in\n * advertising or publicity pertaining to the software without specific,\n * written prior permission. Title to copyright in this software and any\n * associated documentation will at all times remain with copyright\n * holders.\n */\n/**\n * @class RDFParser resource object tied to an RDFStore\n *\n * @author David Sheets \n *\n*/\nimport * as uriUtil from './uri'\n\n\nexport default class RDFParser {\n\n /*\n * @constructor\n * @param {RDFStore} store An RDFStore object\n */\n constructor(store) {\n /** Our triple store reference @private */\n\n this.store = store /** Our identified blank nodes @private */\n this.bnodes = {} /** A context for context-aware stores @private */\n this.why = null /** Reification flag */\n this.reify = false\n }\n\n /** Standard namespaces that we know how to handle @final\n * @member RDFParser\n */\n static ns = {'RDF': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'RDFS': 'http://www.w3.org/2000/01/rdf-schema#'}\n\n /** DOM Level 2 node type magic numbers @final\n * @member RDFParser\n */\n static nodeType = {'ELEMENT': 1, 'ATTRIBUTE': 2, 'TEXT': 3,\n 'CDATA_SECTION': 4, 'ENTITY_REFERENCE': 5,\n 'ENTITY': 6, 'PROCESSING_INSTRUCTION': 7,\n 'COMMENT': 8, 'DOCUMENT': 9, 'DOCUMENT_TYPE': 10,\n 'DOCUMENT_FRAGMENT': 11, 'NOTATION': 12}\n\n /**\n * Frame class for namespace and base URI lookups\n * Base lookups will always resolve because the parser knows\n * the default base.\n *\n * @private\n */\n\n frameFactory(parser, parent, element) {\n return {'NODE': 1, 'ARC': 2, 'parent': parent, 'parser': parser, 'store': parser.store, 'element': element,\n 'lastChild': 0, 'base': null, 'lang': null, 'node': null, 'nodeType': null, 'listIndex': 1, 'rdfid': null, 'datatype': null, 'collection': false, /** Terminate the frame and notify the store that we're done */\n 'terminateFrame': function () {\n if (this.collection) {\n this.node.close()\n }\n }, /** Add a symbol of a certain type to the this frame */'addSymbol': function (type, uri) {\n uri = uriUtil.join(uri, this.base)\n this.node = this.store.sym(uri)\n\n this.nodeType = type\n }, /** Load any constructed triples into the store */'loadTriple': function () {\n if (this.parent.parent.collection) {\n this.parent.parent.node.append(this.node)\n } else {\n this.store.add(this.parent.parent.node, this.parent.node, this.node, this.parser.why)\n }\n if (this.parent.rdfid != null) {\n // reify\n var triple = this.store.sym(uriUtil.join('#' + this.parent.rdfid, this.base))\n this.store.add(triple, this.store.sym(RDFParser.ns.RDF + 'type'), this.store.sym(RDFParser.ns.RDF + 'Statement'), this.parser.why)\n this.store.add(triple, this.store.sym(RDFParser.ns.RDF + 'subject'), this.parent.parent.node, this.parser.why)\n this.store.add(triple, this.store.sym(RDFParser.ns.RDF + 'predicate'), this.parent.node, this.parser.why)\n\n this.store.add(triple, this.store.sym(RDFParser.ns.RDF + 'object'), this.node, this.parser.why)\n }\n }, /** Check if it's OK to load a triple */'isTripleToLoad': function () {\n return (this.parent != null && this.parent.parent != null && this.nodeType === this.NODE && this.parent.nodeType ===\n this.ARC && this.parent.parent.nodeType === this.NODE)\n }, /** Add a symbolic node to this frame */'addNode': function (uri) {\n this.addSymbol(this.NODE, uri)\n if (this.isTripleToLoad()) {\n this.loadTriple()\n }\n }, /** Add a collection node to this frame */'addCollection': function () {\n this.nodeType = this.NODE\n this.node = this.store.collection()\n this.collection = true\n if (this.isTripleToLoad()) {\n this.loadTriple()\n }\n }, /** Add a collection arc to this frame */'addCollectionArc': function () {\n this.nodeType = this.ARC\n }, /** Add a bnode to this frame */'addBNode': function (id) {\n if (id != null) {\n if (this.parser.bnodes[id] != null) {\n this.node = this.parser.bnodes[id]\n } else {\n this.node = this.parser.bnodes[id] = this.store.bnode()\n }\n } else {\n this.node = this.store.bnode()\n }\n this.nodeType = this.NODE\n if (this.isTripleToLoad()) {\n this.loadTriple()\n }\n }, /** Add an arc or property to this frame */'addArc': function (uri) {\n if (uri === RDFParser.ns.RDF + 'li') {\n uri = RDFParser.ns.RDF + '_' + this.parent.listIndex\n this.parent.listIndex++\n }\n\n this.addSymbol(this.ARC, uri)\n }, /** Add a literal to this frame */'addLiteral': function (value) {\n if (this.parent.datatype && this.parent.datatype !== RDFParser.ns.RDF +'langString') {\n this.node = this.store.literal(value, this.store.sym(this.parent.datatype))\n } else {\n this.node = this.store.literal(value, this.lang)\n }\n this.nodeType = this.NODE\n if (this.isTripleToLoad()) {\n this.loadTriple()\n }\n }\n }\n }\n\n // from the OpenLayers source .. needed to get around IE problems.\n getAttributeNodeNS(node, uri, name) {\n var attributeNode = null\n if (node.getAttributeNodeNS) {\n attributeNode = node.getAttributeNodeNS(uri, name)\n } else {\n var attributes = node.attributes\n var potentialNode, fullName\n for (var i = 0;i < attributes.length; ++i) {\n potentialNode = attributes[i]\n if (potentialNode.namespaceURI === uri) {\n fullName = (potentialNode.prefix) ? (potentialNode.prefix + ':' + name) : name\n if (fullName === potentialNode.nodeName) {\n attributeNode = potentialNode\n break\n }\n }\n }\n }\n return attributeNode\n }\n\n /**\n * Build our initial scope frame and parse the DOM into triples\n * @param {HTMLDocument} document The DOM to parse\n * @param {String} base The base URL to use\n * @param {Object} why The context to which this resource belongs\n */\n\n parse(document, base, why) {\n var children = document.childNodes // clean up for the next run\n this.cleanParser() // figure out the root element\n var root\n if (document.nodeType === RDFParser.nodeType.DOCUMENT) {\n for (var c = 0;c < children.length;c++) {\n if (children[c].nodeType === RDFParser.nodeType.ELEMENT) {\n root = children[c]\n break\n }\n }\n } else if (document.nodeType === RDFParser.nodeType.ELEMENT) {\n root = document\n } else {\n throw new Error(\"RDFParser: can't find root in \" + base + '. Halting. ')\n // return false\n }\n this.why = why // our topmost frame\n var f = this.frameFactory(this)\n this.base = base\n f.base = base\n f.lang = null // was '' but can't have langs like that 2015 (!)\n this.parseDOM(this.buildFrame(f, root))\n return true\n }\n\n parseDOM(frame) {\n // a DOM utility function used in parsing\n var rdfid\n var elementURI = function (el) {\n var result = ''\n if (el.namespaceURI == null) {\n throw new Error('RDF/XML syntax error: No namespace for ' + el.localName + ' in ' + this.base)\n }\n if (el.namespaceURI) {\n result = result + el.namespaceURI\n }\n if (el.localName) {\n result = result + el.localName\n } else if (el.nodeName) {\n if (el.nodeName.indexOf(':') >= 0)result = result + el.nodeName.split(':')[1]\n else result = result + el.nodeName\n }\n return result\n }.bind(this)\n var dig = true // if we'll dig down in the tree on the next iter\n while (frame.parent) {\n var dom = frame.element\n var attrs = dom.attributes\n if (dom.nodeType === RDFParser.nodeType.TEXT || dom.nodeType === RDFParser.nodeType.CDATA_SECTION) {\n // we have a literal\n if (frame.parent.nodeType === frame.NODE) {\n // must have had attributes, store as rdf:value\n frame.addArc(RDFParser.ns.RDF + 'value')\n frame = this.buildFrame(frame)\n }\n frame.addLiteral(dom.nodeValue)\n } else if (elementURI(dom) !== RDFParser.ns.RDF + 'RDF') {\n // not root\n if (frame.parent && frame.parent.collection) {\n // we're a collection element\n frame.addCollectionArc()\n frame = this.buildFrame(frame, frame.element)\n frame.parent.element = null\n }\n if (!frame.parent || !frame.parent.nodeType || frame.parent.nodeType === frame.ARC) {\n // we need a node\n var about = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'about')\n rdfid = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'ID')\n if (about && rdfid) {\n throw new Error('RDFParser: ' + dom.nodeName + ' has both rdf:id and rdf:about.' +\n ' Halting. Only one of these' + ' properties may be specified on a' + ' node.')\n }\n if (!about && rdfid) {\n frame.addNode('#' + rdfid.nodeValue)\n dom.removeAttributeNode(rdfid)\n } else if (about == null && rdfid == null) {\n var bnid = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'nodeID')\n if (bnid) {\n frame.addBNode(bnid.nodeValue)\n dom.removeAttributeNode(bnid)\n } else {\n frame.addBNode()\n }\n } else {\n frame.addNode(about.nodeValue)\n dom.removeAttributeNode(about)\n }\n // Typed nodes\n var rdftype = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'type')\n if (RDFParser.ns.RDF + 'Description' !== elementURI(dom)) {\n rdftype = {'nodeValue': elementURI(dom)}\n }\n if (rdftype != null) {\n this.store.add(frame.node, this.store.sym(RDFParser.ns.RDF + 'type'), this.store.sym(uriUtil.join(rdftype.nodeValue,\n frame.base)), this.why)\n if (rdftype.nodeName) {\n dom.removeAttributeNode(rdftype)\n }\n }\n // Property Attributes\n for (var x = attrs.length - 1; x >= 0; x--) {\n this.store.add(frame.node, this.store.sym(elementURI(attrs[x])), this.store.literal(attrs[x].nodeValue,\n frame.lang), this.why)\n }\n } else {\n // we should add an arc (or implicit bnode+arc)\n frame.addArc(elementURI(dom)) // save the arc's rdf:ID if it has one\n if (this.reify) {\n rdfid = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'ID')\n if (rdfid) {\n frame.rdfid = rdfid.nodeValue\n dom.removeAttributeNode(rdfid)\n }\n }\n var parsetype = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'parseType')\n var datatype = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'datatype')\n if (datatype) {\n frame.datatype = datatype.nodeValue\n dom.removeAttributeNode(datatype)\n }\n if (parsetype) {\n var nv = parsetype.nodeValue\n if (nv === 'Literal') {\n frame.datatype = RDFParser.ns.RDF + 'XMLLiteral'\n frame = this.buildFrame(frame)\n // Don't include the literal node, only its children\n // see https://github.com/linkeddata/rdflib.js/issues/75\n frame.addLiteral(dom.innerHTML || dom.childNodes)\n dig = false\n } else if (nv === 'Resource') {\n frame = this.buildFrame(frame, frame.element)\n frame.parent.element = null\n frame.addBNode()\n } else if (nv === 'Collection') {\n frame = this.buildFrame(frame, frame.element)\n frame.parent.element = null\n frame.addCollection()\n }\n dom.removeAttributeNode(parsetype)\n }\n if (attrs.length !== 0) {\n var resource = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'resource')\n var bnid2 = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'nodeID')\n frame = this.buildFrame(frame)\n if (resource) {\n frame.addNode(resource.nodeValue)\n dom.removeAttributeNode(resource)\n } else {\n if (bnid2) {\n frame.addBNode(bnid2.nodeValue)\n dom.removeAttributeNode(bnid2)\n } else {\n frame.addBNode()\n }\n }\n for (var x1 = attrs.length - 1; x1 >= 0; x1--) {\n var f = this.buildFrame(frame)\n f.addArc(elementURI(attrs[x1]))\n if (elementURI(attrs[x1]) === RDFParser.ns.RDF + 'type') {\n (this.buildFrame(f)).addNode(attrs[x1].nodeValue)\n } else {\n (this.buildFrame(f)).addLiteral(attrs[x1].nodeValue)\n }\n }\n } else if (dom.childNodes.length === 0) {\n (this.buildFrame(frame)).addLiteral('')\n }\n }\n } // rdf:RDF\n // dig dug\n dom = frame.element\n while (frame.parent) {\n var pframe = frame\n while (dom == null) {\n frame = frame.parent\n dom = frame.element\n }\n var candidate = dom.childNodes && dom.childNodes[frame.lastChild]\n if (!candidate || !dig) {\n frame.terminateFrame()\n if (!(frame = frame.parent)) {\n break\n } // done\n dom = frame.element\n dig = true\n } else if ((candidate.nodeType !== RDFParser.nodeType.ELEMENT &&\n candidate.nodeType !== RDFParser.nodeType.TEXT &&\n candidate.nodeType !== RDFParser.nodeType.CDATA_SECTION) ||\n ((candidate.nodeType === RDFParser.nodeType.TEXT ||\n candidate.nodeType === RDFParser.nodeType.CDATA_SECTION) &&\n dom.childNodes.length !== 1)) {\n frame.lastChild++\n } else {\n // not a leaf\n frame.lastChild++\n frame = this.buildFrame(pframe, dom.childNodes[frame.lastChild - 1])\n break\n }\n }\n } // while\n }\n\n /**\n * Cleans out state from a previous parse run\n * @private\n */\n cleanParser() {\n this.bnodes = {}\n this.why = null\n }\n\n /**\n * Builds scope frame\n * @private\n */\n buildFrame(parent, element) {\n var frame = this.frameFactory(this, parent, element)\n if (parent) {\n frame.base = parent.base\n frame.lang = parent.lang\n }\n if (!element || element.nodeType === RDFParser.nodeType.TEXT ||\n element.nodeType === RDFParser.nodeType.CDATA_SECTION) {\n return frame\n }\n var attrs = element.attributes\n var base = element.getAttributeNode('xml:base')\n if (base != null) {\n frame.base = base.nodeValue\n element.removeAttribute('xml:base')\n }\n var lang = element.getAttributeNode('xml:lang')\n if (lang != null) {\n frame.lang = lang.nodeValue\n element.removeAttribute('xml:lang')\n }\n // remove all extraneous xml and xmlns attributes\n for (var x = attrs.length - 1;x >= 0;x--) {\n if (attrs[x].nodeName.substr(0, 3) === 'xml') {\n if (attrs[x].name.slice(0, 6) === 'xmlns:') {\n var uri = attrs[x].nodeValue // alert('base for namespac attr:'+this.base)\n if (this.base) uri = uriUtil.join(uri, this.base)\n this.store.setPrefixForURI(attrs[x].name.slice(6), uri)\n }\n //\t\talert('rdfparser: xml atribute: '+attrs[x].name) //@@\n element.removeAttributeNode(attrs[x])\n }\n }\n return frame\n }\n}\n","// Parse a simple SPARL-Update subset syntax for patches.\n//\n// This parses\n// WHERE {xxx} DELETE {yyy} INSERT DATA {zzz}\n// (not necessarily in that order)\n// as though it were the n3\n// <#query> patch:where {xxx}; patch:delete {yyy}; patch:insert {zzz}.\nimport N3Parser from './n3parser'\nimport Namespace from './namespace'\n\nexport default function sparqlUpdateParser (str, kb, base) {\n var i, j, k\n var keywords = [ 'INSERT', 'DELETE', 'WHERE' ]\n var SQNS = Namespace('http://www.w3.org/ns/pim/patch#')\n var p = N3Parser(kb, kb, base, base, null, null, '', null)\n var clauses = {}\n\n var badSyntax = function (uri, lines, str, i, why) {\n return ('Line ' + (lines + 1) + ' of <' + uri + '>: Bad syntax:\\n ' +\n why + '\\n at: \"' + str.slice(i, (i + 30)) + '\"')\n }\n\n // var check = function (next, last, message) {\n // if (next < 0) {\n // throw badSyntax(p._thisDoc, p.lines, str, j, last, message)\n // }\n // return next\n // }\n i = 0\n var query = kb.sym(base + '#query') // Invent a URI for the query\n clauses['query'] = query // A way of accessing it in its N3 model.\n\n while (true) {\n // console.log(\"A Now at i = \" + i)\n j = p.skipSpace(str, i)\n if (j < 0) {\n return clauses\n }\n // console.log(\"B After space at j= \" + j)\n if (str[j] === ';') {\n i = p.skipSpace(str, j + 1)\n if (i < 0) {\n return clauses // Allow end in a\n }\n j = i\n }\n var found = false\n for (k = 0; k < keywords.length; k++) {\n var key = keywords[k]\n if (str.slice(j, j + key.length) === key) {\n i = p.skipSpace(str, j + key.length)\n if (i < 0) {\n throw badSyntax(p._thisDoc, p.lines, str, j + key.length, 'found EOF, needed {...} after ' + key)\n }\n if (((key === 'INSERT') || (key === 'DELETE')) && str.slice(i, i + 4) === 'DATA') { // Some wanted 'DATA'. Whatever\n j = p.skipSpace(str, i + 4)\n if (j < 0) {\n throw badSyntax(p._thisDoc, p.lines, str, i + 4, 'needed {...} after INSERT DATA ' + key)\n }\n i = j\n }\n var res2 = []\n j = p.node(str, i, res2) // Parse all the complexity of the clause\n\n if (j < 0) {\n throw badSyntax(p._thisDoc, p.lines, str, i,\n 'bad syntax or EOF in {...} after ' + key)\n }\n clauses[key.toLowerCase()] = res2[0]\n kb.add(query, SQNS(key.toLowerCase()), res2[0]) // , kb.sym(base)\n // key is the keyword and res2 has the contents\n found = true\n i = j\n }\n }\n if (!found && str.slice(j, j + 7) === '@prefix') {\n i = p.directive(str, j)\n if (i < 0) {\n throw badSyntax(p._thisDoc, p.lines, str, i,\n 'bad syntax or EOF after @prefix ')\n }\n // console.log(\"P before dot i= \" + i)\n i = p.checkDot(str, i)\n // console.log(\"Q after dot i= \" + i)\n found = true\n }\n if (!found) {\n // console.log(\"Bad syntax \" + j)\n throw badSyntax(p._thisDoc, p.lines, str, j,\n \"Unknown syntax at start of statememt: '\" + str.slice(j).slice(0, 20) + \"'\")\n }\n } // while\n// return clauses\n}\n","import DataFactory from './factories/extended-term-factory'\nimport jsonldParser from './jsonldparser'\n// @ts-ignore is this injected?\nimport { Parser as N3jsParser } from 'n3' // @@ Goal: remove this dependency\nimport N3Parser from './n3parser'\nimport { parseRDFaDOM } from './rdfaparser'\nimport RDFParser from './rdfxmlparser'\nimport sparqlUpdateParser from './patch-parser'\nimport * as Util from './utils-js'\nimport Formula from './formula'\nimport { ContentType, TurtleContentType, N3ContentType, RDFXMLContentType, XHTMLContentType, HTMLContentType, SPARQLUpdateContentType, SPARQLUpdateSingleMatchContentType, JSONLDContentType, NQuadsContentType, NQuadsAltContentType } from './types'\nimport { Quad } from './tf-types'\n\ntype CallbackFunc = (error: any, kb: Formula | null) => void\n\n/**\n * Parse a string and put the result into the graph kb.\n * Normal method is sync.\n * Unfortunately jsdonld is currently written to need to be called async.\n * Hence the mess below with executeCallback.\n * @param str - The input string to parse\n * @param kb - The store to use\n * @param base - The base URI to use\n * @param contentType - The MIME content type string for the input - defaults to text/turtle\n * @param [callback] - The callback to call when the data has been loaded\n */\nexport default function parse (\n str: string,\n kb: Formula,\n base: string,\n contentType: string | ContentType = 'text/turtle',\n callback?: CallbackFunc\n) {\n contentType = contentType || TurtleContentType\n contentType = contentType.split(';')[0] as ContentType\n try {\n if (contentType === N3ContentType || contentType === TurtleContentType) {\n var p = N3Parser(kb, kb, base, base, null, null, '', null)\n p.loadBuf(str)\n executeCallback()\n } else if (contentType === RDFXMLContentType) {\n var parser = new RDFParser(kb)\n parser.parse(Util.parseXML(str), base, kb.sym(base))\n executeCallback()\n } else if (contentType === XHTMLContentType) {\n parseRDFaDOM(Util.parseXML(str, {contentType: XHTMLContentType}), kb, base)\n executeCallback()\n } else if (contentType === HTMLContentType) {\n parseRDFaDOM(Util.parseXML(str, {contentType: HTMLContentType}), kb, base)\n executeCallback()\n } else if ((contentType === SPARQLUpdateContentType) || (contentType === SPARQLUpdateSingleMatchContentType)) { // @@ we handle a subset\n sparqlUpdateParser(str, kb, base)\n executeCallback()\n } else if (contentType === JSONLDContentType) {\n jsonldParser(str, kb, base, executeCallback)\n } else if (contentType === NQuadsContentType ||\n contentType === NQuadsAltContentType) {\n var n3Parser = new N3jsParser({ factory: DataFactory })\n nquadCallback(null, str)\n } else if (contentType === undefined) {\n throw new Error(\"contentType is undefined\")\n } else {\n throw new Error(\"Don't know how to parse \" + contentType + ' yet')\n }\n } catch (e) {\n // @ts-ignore\n executeErrorCallback(e)\n }\n\n (parse as any).handled= {\n 'text/n3': true,\n 'text/turtle': true,\n 'application/rdf+xml': true,\n 'application/xhtml+xml': true,\n 'text/html': true,\n 'application/sparql-update': true,\n 'application/sparql-update-single-match': true,\n 'application/ld+json': true,\n 'application/nquads' : true,\n 'application/n-quads' : true\n }\n\n function executeCallback () {\n if (callback) {\n callback(null, kb)\n } else {\n return\n }\n }\n\n function executeErrorCallback (e: Error): void {\n if (\n // TODO: Always true, what is the right behavior\n contentType !== JSONLDContentType ||\n // @ts-ignore always true?\n contentType !== NQuadsContentType ||\n // @ts-ignore always true?\n contentType !== NQuadsAltContentType\n ) {\n if (callback) {\n callback(e, kb)\n } else {\n let e2 = new Error('' + e + ' while trying to parse <' + base + '> as ' + contentType)\n //@ts-ignore .cause is not a default error property\n e2.cause = e\n throw e2\n }\n }\n }\n/*\n function setJsonLdBase (doc, base) {\n if (doc instanceof Array) {\n return\n }\n if (!('@context' in doc)) {\n doc['@context'] = {}\n }\n doc['@context']['@base'] = base\n }\n*/\n function nquadCallback (err?: Error | null, nquads?: string): void {\n if (err) {\n (callback as CallbackFunc)(err, kb)\n }\n try {\n n3Parser.parse(nquads, tripleCallback)\n } catch (err) {\n (callback as CallbackFunc)(err, kb)\n }\n }\n\n function tripleCallback (err: Error, triple: Quad) {\n if (triple) {\n kb.add(triple.subject, triple.predicate, triple.object, triple.graph)\n } else {\n (callback as CallbackFunc)(err, kb)\n }\n }\n}\n","/* global $SolidTestEnvironment */\n/**\n *\n * Project: rdflib.js\n *\n * @file: fetcher.js\n *\n * Description: contains functions for requesting/fetching/retracting\n * This implements quite a lot of the web architecture.\n * A fetcher is bound to a specific quad store, into which\n * it loads stuff and into which it writes its metadata\n * @@ The metadata could be optionally a separate graph\n *\n * - implements semantics of HTTP headers, Internet Content Types\n * - selects parsers for rdf/xml, n3, rdfa, grddl\n *\n * TO do:\n * - Implement a runtime registry for parsers and serializers\n * -\n */\n\n/**\n * Things to test: callbacks on request, refresh, retract\n * loading from HTTP, HTTPS, FTP, FILE, others?\n * To do:\n * Firing up a mail client for mid: (message:) URLs\n */\nimport IndexedFormula from './store'\nimport log from './log'\nimport N3Parser from './n3parser'\nimport RDFlibNamedNode from './named-node'\nimport Namespace from './namespace'\nimport rdfParse from './parse'\nimport { parseRDFaDOM } from './rdfaparser'\nimport RDFParser from './rdfxmlparser'\nimport * as Uri from './uri'\nimport { isCollection, isNamedNode} from './utils/terms'\nimport * as Util from './utils-js'\nimport serialize from './serialize'\nimport crossFetch, { Headers } from 'cross-fetch'\n\nimport {\n ContentType, TurtleContentType, RDFXMLContentType, XHTMLContentType\n} from './types'\nimport { termValue } from './utils/termValue'\nimport {\n BlankNode,\n RdfJsDataFactory,\n Quad_Graph,\n NamedNode,\n Quad_Predicate,\n Quad_Subject\n} from './tf-types'\nimport jsonldParser from './jsonldparser'\n\nconst Parsable = {\n 'text/n3': true,\n 'text/turtle': true,\n 'application/rdf+xml': true,\n 'application/xhtml+xml': true,\n 'text/html': true,\n 'application/ld+json': true\n}\n\n// This is a minimal set to allow the use of damaged servers if necessary\nconst CONTENT_TYPE_BY_EXT = {\n 'rdf': RDFXMLContentType,\n 'owl': RDFXMLContentType,\n 'n3': 'text/n3',\n 'ttl': 'text/turtle',\n 'nt': 'text/n3',\n 'acl': 'text/n3',\n 'html': 'text/html',\n 'xml': 'text/xml'\n}\n\n// Convenience namespaces needed in this module.\n// These are deliberately not exported as the user application should\n// make its own list and not rely on the prefixes used here,\n// and not be tempted to add to them, and them clash with those of another\n// application.\nconst getNS = (factory?: RdfJsDataFactory) => {\n return {\n link: Namespace('http://www.w3.org/2007/ont/link#', factory),\n http: Namespace('http://www.w3.org/2007/ont/http#', factory),\n httph: Namespace('http://www.w3.org/2007/ont/httph#', factory), // headers\n rdf: Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#', factory),\n rdfs: Namespace('http://www.w3.org/2000/01/rdf-schema#', factory),\n dc: Namespace('http://purl.org/dc/elements/1.1/', factory),\n ldp: Namespace('http://www.w3.org/ns/ldp#', factory)\n }\n}\nconst ns = getNS()\n\nexport interface FetchError extends Error {\n statusText?: string\n status?: StatusValues\n response?: ExtendedResponse\n}\n\n/** An extended interface of Response, since RDFlib.js adds some properties. */\nexport interface ExtendedResponse extends Response {\n /** String representation of the Body */\n responseText?: string\n /** Identifier of the reqest */\n req?: Quad_Subject\n size?: number\n timeout?: number\n /** Used in UpdateManager.updateDav */\n error?: string\n}\n\n/** tell typescript that a 'panes' child may exist on Window */\ndeclare global {\n interface Window {\n panes?: any\n solidFetcher?: any\n solidFetch?: any\n }\n var solidFetcher: Function\n var solidFetch: Function\n}\ndeclare var $SolidTestEnvironment: {\n localSiteMap?: any\n}\n\ntype UserCallback = (\n ok: boolean,\n message: string,\n response?: any\n) => void\n\ntype HTTPMethods = 'GET' | 'PUT' | 'POST' | 'PATCH' | 'HEAD' | 'DELETE' | 'CONNECT' | 'TRACE' | 'OPTIONS'\n\n/** All valid inputs for initFetchOptions */\nexport type Options = Partial\n\n/** Initiated by initFetchOptions, which runs on load */\nexport interface AutoInitOptions extends RequestInit{\n /** The used Fetch function */\n fetch?: Fetch\n /**\n * Referring term, the resource which\n * referred to this (for tracking bad links).\n * The document in which this link was found.\n */\n referringTerm?: NamedNode\n /** Provided content type (for writes) */\n contentType?: string\n /**\n * Override the incoming header to\n * force the data to be treated as this content-type (for reads)\n */\n forceContentType?: ContentType\n /**\n * Load the data even if loaded before.\n * Also sets the `Cache-Control:` header to `no-cache`\n */\n force?: boolean\n /**\n * Original uri to preserve\n * through proxying etc (`xhr.original`).\n */\n baseURI: string\n /**\n * Whether this request is a retry via\n * a proxy (generally done from an error handler)\n */\n proxyUsed?: boolean\n actualProxyURI?: string\n /** flag for XHR/CORS etc */\n withCredentials?: boolean\n /** Before we parse new data, clear old, but only on status 200 responses */\n clearPreviousData?: boolean\n /** Prevents the addition of various metadata triples (about the fetch request) to the store*/\n noMeta?: boolean\n noRDFa?: boolean\n handlers?: Handler[]\n timeout?: number\n method?: HTTPMethods\n retriedWithNoCredentials?: boolean\n requestedURI?: string\n // Seems to be required in some functions, such as XHTML parse and RedirectToProxy\n resource: Quad_Subject\n /** The serialized resource in the body*/\n // Used for storing metadata of requests\n original: NamedNode\n // Like requeststatus? Can contain text with error.\n data?: string\n // Probably an identifier for request?s\n req: BlankNode\n // Might be the same as Options.data\n body?: string\n headers: HeadersInit\n credentials?: 'include' | 'omit'\n}\n\nclass Handler {\n // TODO: Document, type\n response: ExtendedResponse\n // TODO: Document, type\n dom: Document\n static pattern: RegExp\n\n constructor (response: ExtendedResponse, dom?: Document) {\n this.response = response\n // The type assertion operator here might need to be removed.\n this.dom = dom!\n }\n}\n\nclass RDFXMLHandler extends Handler {\n static toString () {\n return 'RDFXMLHandler'\n }\n\n static register (fetcher: Fetcher) {\n fetcher.mediatypes[RDFXMLContentType] = {\n 'q': 0.9\n }\n }\n\n parse (\n fetcher: Fetcher,\n /** An XML String */\n responseText: String,\n /** Requires .original */\n options: {\n original: Quad_Subject\n req: Quad_Subject\n } & Options,\n ) {\n let kb = fetcher.store\n if (!this.dom) {\n this.dom = Util.parseXML(responseText)\n }\n let root = this.dom.documentElement\n if (root.nodeName === 'parsererror') { // Mozilla only See issue/issue110\n // have to fail the request\n return fetcher.failFetch(options, 'Badly formed XML in ' +\n options.resource!.value, 'parse_error')\n }\n let parser = new RDFParser(kb)\n try {\n parser.parse(this.dom, options.original.value, options.original)\n } catch (err) {\n return fetcher.failFetch(options, 'Syntax error parsing RDF/XML! ' + err,\n 'parse_error')\n }\n if (!options.noMeta) {\n kb.add(options.original, ns.rdf('type'), ns.link('RDFDocument'), fetcher.appNode)\n }\n\n return fetcher.doneFetch(options, this.response)\n }\n}\nRDFXMLHandler.pattern = new RegExp('application/rdf\\\\+xml')\n\nclass XHTMLHandler extends Handler {\n static toString () {\n return 'XHTMLHandler'\n }\n\n static register (fetcher: Fetcher) {\n fetcher.mediatypes[XHTMLContentType] = {}\n }\n\n parse (\n fetcher: Fetcher,\n responseText: string,\n options: {\n resource: Quad_Subject\n original: Quad_Subject\n } & Options,\n ): Promise | ExtendedResponse {\n let relation, reverse: boolean\n if (!this.dom) {\n this.dom = Util.parseXML(responseText)\n }\n let kb = fetcher.store\n\n // dc:title\n let title = this.dom.getElementsByTagName('title')\n if (title.length > 0) {\n kb.add(options.resource, ns.dc('title'), kb.rdfFactory.literal(title[0].textContent as string),\n options.resource)\n // log.info(\"Inferring title of \" + xhr.resource)\n }\n\n // link rel\n let links = this.dom.getElementsByTagName('link')\n for (let x = links.length - 1; x >= 0; x--) { // @@ rev\n relation = links[x].getAttribute('rel')\n reverse = false\n if (!relation) {\n relation = links[x].getAttribute('rev')\n reverse = true\n }\n if (relation) {\n fetcher.linkData(options.original, relation,\n links[x].getAttribute('href') as string, options.resource, reverse)\n }\n }\n\n // Data Islands\n let scripts = this.dom.getElementsByTagName('script')\n for (let i = 0; i < scripts.length; i++) {\n let contentType = scripts[i].getAttribute('type')\n if (Parsable[contentType!]) {\n // @ts-ignore incompatibility between Store.add and Formula.add\n rdfParse(scripts[i].textContent as string, kb, options.original.value, contentType)\n // @ts-ignore incompatibility between Store.add and Formula.add\n rdfParse(scripts[i].textContent as string, kb, options.original.value, contentType)\n }\n }\n\n if (!options.noMeta) {\n kb.add(options.resource, ns.rdf('type'), ns.link('WebPage'), fetcher.appNode)\n }\n\n if (!options.noRDFa && parseRDFaDOM) { // enable by default\n try {\n parseRDFaDOM(this.dom, kb, options.original.value)\n } catch (err) {\n // @ts-ignore\n let msg = 'Error trying to parse ' + options.resource + ' as RDFa:\\n' + err + ':\\n' + err.stack\n return fetcher.failFetch(options as AutoInitOptions, msg, 'parse_error')\n }\n }\n\n return fetcher.doneFetch(options as AutoInitOptions, this.response)\n }\n}\nXHTMLHandler.pattern = new RegExp('application/xhtml')\n\nclass XMLHandler extends Handler {\n static toString () {\n return 'XMLHandler'\n }\n\n static register (fetcher: Fetcher) {\n fetcher.mediatypes['text/xml'] = { 'q': 0.5 }\n fetcher.mediatypes['application/xml'] = { 'q': 0.5 }\n }\n\n static isElement(node: Node): node is Element {\n return node.nodeType === Node.ELEMENT_NODE;\n }\n\n\n parse (\n fetcher: Fetcher,\n responseText: string,\n options: {\n original: Quad_Subject\n req: BlankNode\n resource: Quad_Subject\n } & Options,\n ): ExtendedResponse | Promise {\n let dom = Util.parseXML(responseText)\n\n // XML Semantics defined by root element namespace\n // figure out the root element\n for (let c = 0; c < dom.childNodes.length; c++) {\n const node = dom.childNodes[c]\n // is this node an element?\n if (XMLHandler.isElement(node)) {\n\n // We've found the first element, it's the root\n let ns = node.namespaceURI\n\n // Is it RDF/XML?\n if (ns && ns === ns['rdf']) {\n fetcher.addStatus(options.req,\n 'Has XML root element in the RDF namespace, so assume RDF/XML.')\n\n let rdfHandler = new RDFXMLHandler(this.response, dom)\n return rdfHandler.parse(fetcher, responseText, options)\n }\n\n break\n }\n }\n\n // Or it could be XHTML?\n // Maybe it has an XHTML DOCTYPE?\n if (dom.doctype) {\n // log.info(\"We found a DOCTYPE in \" + xhr.resource)\n if (dom.doctype.name === 'html' &&\n dom.doctype.publicId.match(/^-\\/\\/W3C\\/\\/DTD XHTML/) &&\n dom.doctype.systemId.match(/http:\\/\\/www.w3.org\\/TR\\/xhtml/)) {\n fetcher.addStatus(options.req,\n 'Has XHTML DOCTYPE. Switching to XHTML Handler.\\n')\n\n let xhtmlHandler = new XHTMLHandler(this.response, dom)\n return xhtmlHandler.parse(fetcher, responseText, options)\n }\n }\n\n // Or what about an XHTML namespace?\n let html = dom.getElementsByTagName('html')[0]\n if (html) {\n let xmlns = html.getAttribute('xmlns')\n if (xmlns && xmlns.match(/^http:\\/\\/www.w3.org\\/1999\\/xhtml/)) {\n fetcher.addStatus(options.req,\n 'Has a default namespace for ' + 'XHTML. Switching to XHTMLHandler.\\n')\n\n let xhtmlHandler = new XHTMLHandler(this.response, dom)\n return xhtmlHandler.parse(fetcher, responseText, options)\n }\n }\n\n // At this point we should check the namespace document (cache it!) and\n // look for a GRDDL transform\n // @@ Get namespace document , parse it, look for grddl:namespaceTransform ?y\n // Apply ?y to dom\n // We give up. What dialect is this?\n return fetcher.failFetch(options,\n 'Unsupported dialect of XML: not RDF or XHTML namespace, etc.\\n' +\n responseText.slice(0, 80), 901)\n }\n}\nXMLHandler.pattern = new RegExp('(text|application)/(.*)xml')\n\nclass HTMLHandler extends Handler {\n static toString () {\n return 'HTMLHandler'\n }\n\n static register (fetcher: Fetcher) {\n fetcher.mediatypes['text/html'] = {\n 'q': 0.9\n }\n }\n\n parse (\n fetcher: Fetcher,\n responseText: string,\n options: {\n req: BlankNode,\n resource: Quad_Subject,\n original: Quad_Subject,\n } & Options\n ): Promise | ExtendedResponse {\n let kb = fetcher.store\n\n // We only handle XHTML so we have to figure out if this is XML\n // log.info(\"Sniffing HTML \" + xhr.resource + \" for XHTML.\")\n if (isXML(responseText)) {\n fetcher.addStatus(options.req, \"Has an XML declaration. We'll assume \" +\n \"it's XHTML as the content-type was text/html.\\n\")\n\n let xhtmlHandler = new XHTMLHandler(this.response)\n return xhtmlHandler.parse(fetcher, responseText, options)\n }\n\n // DOCTYPE html\n if (isXHTML(responseText)) {\n fetcher.addStatus(options.req,\n 'Has XHTML DOCTYPE. Switching to XHTMLHandler.\\n')\n\n let xhtmlHandler = new XHTMLHandler(this.response)\n return xhtmlHandler.parse(fetcher, responseText, options)\n }\n\n // xmlns\n if (isXMLNS(responseText)) {\n fetcher.addStatus(options.req,\n 'Has default namespace for XHTML, so switching to XHTMLHandler.\\n')\n\n let xhtmlHandler = new XHTMLHandler(this.response)\n return xhtmlHandler.parse(fetcher, responseText, options)\n }\n\n // dc:title\n // no need to escape '/' here\n let titleMatch = (new RegExp('([\\\\s\\\\S]+?)', 'im')).exec(responseText)\n if (titleMatch) {\n kb.add(options.resource, ns.dc('title'), kb.rdfFactory.literal(titleMatch[1]),\n options.resource) // think about xml:lang later\n }\n kb.add(options.resource, ns.rdf('type'), ns.link('WebPage'), fetcher.appNode)\n fetcher.addStatus(options.req, 'non-XML HTML document, not parsed for data.')\n\n return fetcher.doneFetch(options, this.response)\n }\n}\nHTMLHandler.pattern = new RegExp('text/html')\n\nclass JsonLdHandler extends Handler {\n static toString () {\n return 'JsonLdHandler'\n }\n static register (fetcher: Fetcher) {\n fetcher.mediatypes['application/ld+json'] = {\n 'q': 0.9\n }\n }\n parse (\n fetcher: Fetcher,\n responseText: string,\n options: {\n req: Quad_Subject\n original: Quad_Subject\n resource: Quad_Subject\n } & Options,\n response: ExtendedResponse\n ): Promise {\n const kb = fetcher.store\n return new Promise((resolve, reject) => {\n try {\n jsonldParser (responseText, kb, options.original.value, () => {\n resolve(fetcher.doneFetch(options, response))\n })\n } catch (err) {\n const msg = 'Error trying to parse ' + options.resource +\n ' as JSON-LD:\\n' + err // not err.stack -- irrelevant\n resolve(fetcher.failFetch(options, msg, 'parse_error', response))\n }\n })\n }\n}\nJsonLdHandler.pattern = /application\\/ld\\+json/\n\nclass TextHandler extends Handler {\n static toString () {\n return 'TextHandler'\n }\n\n static register (fetcher: Fetcher) {\n fetcher.mediatypes['text/plain'] = {\n 'q': 0.5\n }\n }\n\n parse (\n fetcher: Fetcher,\n responseText: string,\n options: {\n req: Quad_Subject\n original: Quad_Subject\n resource: Quad_Subject\n } & Options\n ): ExtendedResponse | Promise {\n // We only speak dialects of XML right now. Is this XML?\n\n // Look for an XML declaration\n if (isXML(responseText)) {\n fetcher.addStatus(options.req, 'Warning: ' + options.resource +\n \" has an XML declaration. We'll assume \" +\n \"it's XML but its content-type wasn't XML.\\n\")\n\n let xmlHandler = new XMLHandler(this.response)\n return xmlHandler.parse(fetcher, responseText, options)\n }\n\n // Look for an XML declaration\n if (responseText.slice(0, 500).match(/xmlns:/)) {\n fetcher.addStatus(options.req, \"May have an XML namespace. We'll assume \" +\n \"it's XML but its content-type wasn't XML.\\n\")\n\n let xmlHandler = new XMLHandler(this.response)\n return xmlHandler.parse(fetcher, responseText, options)\n }\n\n // We give up finding semantics - this is not an error, just no data\n fetcher.addStatus(options.req, 'Plain text document, no known RDF semantics.')\n\n return fetcher.doneFetch(options, this.response)\n }\n}\nTextHandler.pattern = new RegExp('text/plain')\n\nclass N3Handler extends Handler {\n static toString () {\n return 'N3Handler'\n }\n\n static register (fetcher: Fetcher) {\n fetcher.mediatypes['text/n3'] = {\n 'q': '1.0'\n } // as per 2008 spec\n /*\n fetcher.mediatypes['application/x-turtle'] = {\n 'q': 1.0\n } // pre 2008\n */\n fetcher.mediatypes['text/turtle'] = {\n 'q': 1.0\n } // post 2008\n }\n\n parse (\n fetcher: Fetcher,\n responseText: string,\n options: {\n original: NamedNode\n req: Quad_Subject\n } & Options,\n response: ExtendedResponse\n ): ExtendedResponse | Promise {\n // Parse the text of this N3 file\n let kb = fetcher.store\n let p = N3Parser(kb, kb, options.original.value, options.original.value,\n null, null, '', null)\n // p.loadBuf(xhr.responseText)\n try {\n p.loadBuf(responseText)\n } catch (err) {\n let msg = 'Error trying to parse ' + options.resource +\n ' as Notation3:\\n' + err // not err.stack -- irrelevant\n return fetcher.failFetch(options, msg, 'parse_error', response)\n }\n\n fetcher.addStatus(options.req, 'N3 parsed: ' + p.statementCount + ' triples in ' + p.lines + ' lines.')\n fetcher.store.add(options.original, ns.rdf('type'), ns.link('RDFDocument'), fetcher.appNode)\n\n return fetcher.doneFetch(options, this.response)\n }\n}\nN3Handler.pattern = new RegExp('(application|text)/(x-)?(rdf\\\\+)?(n3|turtle)')\n\nconst defaultHandlers = {\n RDFXMLHandler, XHTMLHandler, XMLHandler, HTMLHandler, TextHandler, N3Handler, JsonLdHandler\n}\n\nfunction isXHTML (responseText) {\n const docTypeStart = responseText.indexOf('')\n if (docTypeStart === -1 || docTypeEnd === -1 || docTypeStart > docTypeEnd) {\n return false\n }\n return responseText.substr(docTypeStart, docTypeEnd - docTypeStart).indexOf('XHTML') !== -1\n}\n\nfunction isXML (responseText: string): boolean {\n const match = responseText.match(/\\s*<\\?xml\\s+version\\s*=[^<>]+\\?>/)\n return !!match\n}\n\nfunction isXMLNS (responseText: string): boolean {\n const match = responseText.match(/[^(/)\n return !!match\n}\n\ntype StatusValues =\n /** No record of web access or record reset */\n undefined |\n /** Has been requested, fetch in progress */\n true |\n /** Received, OK */\n 'done' |\n /** Not logged in */\n 401 |\n /** HTTP status unauthorized */\n 403 |\n /** Not found, resource does not exist */\n 404 |\n /** In attempt to counter CORS problems retried */\n 'redirected' |\n /** If it did fail */\n 'failed' |\n 'parse_error' |\n /**\n * URI is not a protocol Fetcher can deal with\n * other strings mean various other errors.\n */\n 'unsupported_protocol' |\n 'timeout' |\n /** Any other HTTP status code */\n number\n\ninterface MediatypesMap {\n [id: string]: {\n // Either string '1.0' or number 1.0 is allowed\n 'q'?: number | string\n };\n}\n\ninterface RequestedMap {\n [uri: string]: StatusValues\n}\n\ninterface TimeOutsMap {\n [uri: string]: number[]\n}\n\ninterface FetchQueue {\n [uri: string]: Promise\n}\n\ninterface FetchCallbacks {\n [uri: string]: UserCallback[]\n}\n\ninterface BooleanMap {\n [uri: string]: boolean\n}\n\n// Not sure about the shapes of this. Response? FetchError?\ntype Result = Response\n\n/** Differs from normal Fetch, has an extended Response type */\ntype Fetch = (input: RequestInfo, init?: RequestInit) => Promise;\n\ninterface CallbackifyInterface {\n fireCallbacks: Function\n}\n\n/** Fetcher\n *\n * The Fetcher object is a helper object for a quadstore\n * which turns it from an offline store to an online store.\n * The fetcher deals with loading data files rom the web,\n * figuring how to parse them. It will also refresh, remove, the data\n * and put back the data to the web.\n */\nexport default class Fetcher implements CallbackifyInterface {\n store: IndexedFormula\n timeout: number\n _fetch: Fetch\n mediatypes: MediatypesMap\n /** Denoting this session */\n appNode: NamedNode\n /**\n * this.requested[uri] states:\n * undefined no record of web access or records reset\n * true has been requested, fetch in progress\n * 'done' received, Ok\n * 401 Not logged in\n * 403 HTTP status unauthorized\n * 404 Resource does not exist. Can be created etc.\n * 'redirected' In attempt to counter CORS problems retried.\n * 'parse_error' Parse error\n * 'unsupported_protocol' URI is not a protocol Fetcher can deal with\n * other strings mean various other errors.\n */\n requested: RequestedMap\n /** List of timeouts associated with a requested URL */\n timeouts: TimeOutsMap\n /** Redirected from *key uri* to *value uri* */\n redirectedTo: Record\n fetchQueue: FetchQueue\n /** fetchCallbacks[uri].push(callback) */\n fetchCallbacks: FetchCallbacks\n /** Keep track of explicit 404s -> we can overwrite etc */\n nonexistent: BooleanMap\n lookedUp: BooleanMap\n handlers: Array\n ns: { [k: string]: (ln: string) => Quad_Predicate }\n static HANDLERS: {\n [handlerName: number]: Handler\n }\n static CONTENT_TYPE_BY_EXT: Record\n // TODO: Document this\n static crossSiteProxyTemplate: any\n\n /** Methods added by calling Util.callbackify in the constructor*/\n fireCallbacks!: Function\n\n constructor (store: IndexedFormula, options: Options = {}) {\n this.store = store || new IndexedFormula()\n this.ns = getNS(this.store.rdfFactory)\n this.timeout = options.timeout || 30000\n\n // solidFetcher is deprecated\n this._fetch = options.fetch\n || (typeof global !== 'undefined' && (global.solidFetcher || global.solidFetch))\n || (typeof window !== 'undefined' && (window.solidFetcher || window.solidFetch))\n || crossFetch\n if (!this._fetch) {\n throw new Error('No _fetch function available for Fetcher')\n }\n // This is the name of the graph we store all the HTTP metadata in\n this.appNode = this.store.sym('chrome://TheCurrentSession')\n // this.appNode = this.store.rdfFactory.blankNode() // Needs to have a URI in tests\n this.store.fetcher = this // Bi-linked\n this.requested = {}\n this.timeouts = {}\n this.redirectedTo = {}\n this.fetchQueue = {}\n this.fetchCallbacks = {}\n this.nonexistent = {}\n this.lookedUp = {}\n this.handlers = []\n this.mediatypes = {\n 'image/*': { 'q': 0.9 },\n '*/*': { 'q': 0.1 } // Must allow access to random content\n }\n\n // Util.callbackify(this, ['request', 'recv', 'headers', 'load', 'fail',\n // 'refresh', 'retract', 'done'])\n // In switching to fetch(), 'recv', 'headers' and 'load' do not make sense\n Util.callbackify(this, ['request', 'fail', 'refresh', 'retract', 'done'])\n\n Object.keys(options.handlers || defaultHandlers).map(key => this.addHandler(defaultHandlers[key]))\n }\n\n static crossSiteProxy (uri: string): undefined | any {\n if (Fetcher.crossSiteProxyTemplate) {\n return Fetcher.crossSiteProxyTemplate\n .replace('{uri}', encodeURIComponent(uri))\n } else {\n return undefined\n }\n }\n\n static offlineOverride (uri: string): string {\n // Map the URI to a localhost proxy if we are running on localhost\n // This is used for working offline, e.g. on planes.\n // Is the script itself is running in localhost, then access all\n // data in a localhost mirror.\n // Do not remove without checking with TimBL\n let requestedURI = uri\n\n var UI\n if (typeof window !== 'undefined' && window.panes && (UI = window.panes.UI) &&\n UI.preferences && UI.preferences.get('offlineModeUsingLocalhost')) {\n if (requestedURI.slice(0, 7) === 'http://' && requestedURI.slice(7, 17) !== 'localhost/') {\n requestedURI = 'http://localhost/' + requestedURI.slice(7)\n log.warn('Localhost kludge for offline use: actually getting <' +\n requestedURI + '>')\n } else {\n // log.warn(\"Localhost kludge NOT USED <\" + requestedURI + \">\")\n }\n } else {\n // log.warn(\"Localhost kludge OFF offline use: actually getting <\" +\n // requestedURI + \">\")\n }\n\n return requestedURI\n }\n\n static proxyIfNecessary (uri: string) {\n var UI\n if (\n typeof window !== 'undefined' &&\n (window as any).panes &&\n (UI = (window as any).panes.UI) &&\n UI.isExtension\n ) {\n return uri\n } // Extension does not need proxy\n\n if (typeof $SolidTestEnvironment !== 'undefined' &&\n $SolidTestEnvironment.localSiteMap) {\n // nested dictionaries of URI parts from origin down\n let hostpath = uri.split('/').slice(2) // the bit after the //\n\n const lookup = (parts, index) => {\n let z = index[parts.shift()]\n\n if (!z) { return null }\n\n if (typeof z === 'string') {\n return z + parts.join('/')\n }\n\n if (!parts) { return null }\n\n return lookup(parts, z)\n }\n\n const y = lookup(hostpath, $SolidTestEnvironment.localSiteMap)\n\n if (y) {\n return y\n }\n }\n\n // browser does 2014 on as https browser script not trusted\n // If the web app origin is https: then the mixed content rules\n // prevent it loading insecure http: stuff so we need proxy.\n if (Fetcher.crossSiteProxyTemplate &&\n typeof document !== 'undefined' && document.location &&\n ('' + document.location).slice(0, 6) === 'https:' && // origin is secure\n uri.slice(0, 5) === 'http:') { // requested data is not\n return Fetcher.crossSiteProxyTemplate\n .replace('{uri}', encodeURIComponent(uri))\n }\n\n return uri\n }\n\n /**\n * Tests whether the uri's protocol is supported by the Fetcher.\n * @param uri\n */\n static unsupportedProtocol (uri: string): boolean {\n let pcol = Uri.protocol(uri)\n\n return (pcol === 'tel' || pcol === 'mailto' || pcol === 'urn')\n }\n\n /** Decide on credentials using old XXHR api or new fetch() one\n * @param requestedURI\n * @param options\n */\n static setCredentials (requestedURI: string, options: Options = {}) {\n // 2014 CORS problem:\n // XMLHttpRequest cannot load http://www.w3.org/People/Berners-Lee/card.\n // A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin'\n // header when the credentials flag is true.\n // @ Many ontology files under http: and need CORS wildcard ->\n // can't have credentials\n if (options.credentials === undefined) { // Caller using new fetch convention\n if (options.withCredentials !== undefined) { // XHR style is what Fetcher specified before\n options.credentials = options.withCredentials ? 'include' : 'omit'\n } else {\n options.credentials = 'include' // default is to be logged on\n }\n }\n }\n\n /**\n * Promise-based load function\n *\n * Loads a web resource or resources into the store.\n *\n * A resource may be given as NamedNode object, or as a plain URI.\n * an array of resources will be given, in which they will be fetched in parallel.\n * By default, the HTTP headers are recorded also, in the same store, in a separate graph.\n * This allows code like editable() for example to test things about the resource.\n *\n * @param uri {Array|Array|RDFlibNamedNode|string}\n *\n * @param [options={}] {Object}\n *\n * @param [options.fetch] {Function}\n *\n * @param [options.referringTerm] {RDFlibNamedNode} Referring term, the resource which\n * referred to this (for tracking bad links)\n *\n * @param [options.contentType] {string} Provided content type (for writes)\n *\n * @param [options.forceContentType] {string} Override the incoming header to\n * force the data to be treated as this content-type (for reads)\n *\n * @param [options.force] {boolean} Load the data even if loaded before.\n * Also sets the `Cache-Control:` header to `no-cache`\n *\n * @param [options.baseURI=docuri] {Node|string} Original uri to preserve\n * through proxying etc (`xhr.original`).\n *\n * @param [options.proxyUsed] {boolean} Whether this request is a retry via\n * a proxy (generally done from an error handler)\n *\n * @param [options.withCredentials] {boolean} flag for XHR/CORS etc\n *\n * @param [options.clearPreviousData] {boolean} Before we parse new data,\n * clear old, but only on status 200 responses\n *\n * @param [options.noMeta] {boolean} Prevents the addition of various metadata\n * triples (about the fetch request) to the store\n *\n * @param [options.noRDFa] {boolean}\n *\n * @returns {Promise}\n */\n load >(\n uri: T,\n options: Options = {}\n ): T extends Array ? Promise : Promise {\n options = Object.assign({}, options) // Take a copy as we add stuff to the options!!\n if (uri instanceof Array) {\n return Promise.all(uri.map((x) => {\n return this.load(x, Object.assign({}, options)) as unknown as Promise\n })) as T extends Array ? Promise : Promise\n }\n\n const uriIn: NamedNode | string = uri as NamedNode\n\n let docuri = termValue(uriIn)\n docuri = docuri.split('#')[0]\n\n options = this.initFetchOptions(docuri, options)\n // if metadata flaged clear cache and removeDocument\n const meta = this.appNode\n const kb = this.store\n const requests = kb.statementsMatching(undefined, this.ns.link('requestedURI'), kb.sym(docuri), meta).map(st => st.subject)\n for (const request of requests) {\n const response = kb.any(request, this.ns.link('response'), null, meta) as Quad_Subject\n if (response != undefined) { // ts\n const quad = kb.statementsMatching(response, this.ns.link('outOfDate'), true as any, meta)\n kb.remove(quad)\n options.force = true\n options.clearPreviousData = true\n }\n }\n\n const initialisedOptions = this.initFetchOptions(docuri, options)\n\n return this.pendingFetchPromise(docuri, initialisedOptions.baseURI, initialisedOptions) as any\n }\n\n async pendingFetchPromise (\n uri: string,\n originalUri: string,\n options: AutoInitOptions\n ): Promise {\n let pendingPromise\n\n // Check to see if some request is already dealing with this uri\n if (!options.force && await this.fetchQueue[originalUri]) {\n pendingPromise = this.fetchQueue[originalUri]\n } else {\n pendingPromise = Promise\n .race([\n this.setRequestTimeout(uri, options),\n this.fetchUri(uri, options)\n ])\n this.fetchQueue[originalUri] = pendingPromise\n\n // Clean up the queued promise after a time, if it's resolved\n this.cleanupFetchRequest(originalUri, undefined, this.timeout)\n }\n\n return pendingPromise.then(x => {\n if (uri in this.timeouts) {\n this.timeouts[uri].forEach(clearTimeout)\n delete this.timeouts[uri]\n }\n return x\n })\n }\n\n /**\n * @param _options - DEPRECATED\n */\n cleanupFetchRequest (\n originalUri: string,\n _options,\n timeout: number\n ) {\n if (_options !== undefined) {\n console.warn(\"_options is deprecated\")\n }\n this.timeouts[originalUri] = (this.timeouts[originalUri] || []).concat(setTimeout(() => {\n if (!this.isPending(originalUri)) {\n delete this.fetchQueue[originalUri]\n }\n }, timeout) as unknown as number)\n }\n\n initFetchOptions (\n uri: string,\n options: Options\n ): AutoInitOptions {\n let kb = this.store\n\n let isGet = !options.method || options.method.toUpperCase() === 'GET'\n if (!isGet) {\n options.force = true\n }\n\n options.resource = kb.rdfFactory.namedNode(uri) // This might be proxified\n options.baseURI = options.baseURI || uri // Preserve though proxying etc\n options.original = kb.rdfFactory.namedNode(options.baseURI)\n options.req = kb.bnode()\n options.headers = options.headers || new Headers()\n\n if (options.contentType) {\n // @ts-ignore\n options.headers['content-type'] = options.contentType\n }\n\n if (options.force) {\n options.cache = 'no-cache'\n }\n\n let acceptString = this.acceptString()\n // @ts-ignore\n options.headers['accept'] = acceptString\n\n let requestedURI = Fetcher.offlineOverride(uri)\n options.requestedURI = requestedURI\n\n Fetcher.setCredentials(requestedURI, options)\n\n let actualProxyURI = Fetcher.proxyIfNecessary(requestedURI)\n if (requestedURI !== actualProxyURI) {\n options.proxyUsed = true\n }\n options.actualProxyURI = actualProxyURI\n\n return options as AutoInitOptions\n }\n\n /**\n * (The promise chain ends in either a `failFetch()` or a `doneFetch()`)\n *\n * @param docuri {string}\n * @param options {Object}\n *\n * @returns {Promise} fetch() result or an { error, status } object\n */\n fetchUri (docuri: string, options: AutoInitOptions): Promise {\n if (!docuri) {\n return Promise.reject(new Error('Cannot fetch an empty uri'))\n }\n\n if (Fetcher.unsupportedProtocol(docuri)) {\n return this.failFetch(options, 'fetcher: Unsupported protocol', 'unsupported_protocol')\n }\n\n let state = this.getState(docuri)\n\n if (!options.force) {\n if (state === 'fetched') { // URI already fetched and added to store\n return Promise.resolve(\n // @ts-ignore This is not a valid response object\n this.doneFetch(options, {\n status: 200,\n ok: true,\n statusText: 'Already loaded into quadstore.'\n })\n )\n }\n if (state === 'failed' && this.requested[docuri] === 404) { // Remember nonexistence\n let message = 'Previously failed: ' + this.requested[docuri]\n // @ts-ignore This is not a valid response object\n let dummyResponse: ExtendedResponse = {\n url: docuri,\n // This does not comply to Fetch spec, it can be a string value in rdflib\n status: this.requested[docuri] as number,\n statusText: message,\n responseText: message,\n headers: new Headers, // Headers() ???\n ok: false,\n body: null,\n bodyUsed: false,\n size: 0,\n timeout: 0\n }\n return this.failFetch(options, message,\n this.requested[docuri], dummyResponse)\n }\n } else {\n // options.force == true\n delete this.nonexistent[docuri]\n }\n\n this.fireCallbacks('request', [docuri])\n\n this.requested[docuri] = true // mark this uri as 'requested'\n\n if (!options.noMeta) {\n this.saveRequestMetadata(docuri, options)\n }\n\n let { actualProxyURI } = options\n\n // Map might get mistakenly added into headers\n // error TS2339: Property 'map' does not exist on type 'Headers'.\n /* let map\n if (options.headers && map in options.headers) {\n delete options.headers.map\n } */\n\n return this._fetch((actualProxyURI as string), options)\n .then(response => this.handleResponse(response, docuri, options),\n error => { // @@ handleError?\n // @ts-ignore Invalid response object\n let dummyResponse: ExtendedResponse = {\n url: actualProxyURI as string,\n status: 999, // @@ what number/string should fetch failures report?\n statusText: (error.name || 'network failure') + ': ' +\n (error.errno || error.code || error.type),\n responseText: error.message,\n headers: new Headers(), // Headers() ???\n ok: false,\n body: null,\n bodyUsed: false,\n size: 0,\n timeout: 0\n }\n // console.log('Fetcher: <' + actualProxyURI + '> Non-HTTP fetch exception: ' + error)\n return this.handleError(dummyResponse, docuri, options) // possible credentials retry\n // return this.failFetch(options, 'fetch failed: ' + error, 999, dummyResponse) // Fake status code: fetch exception\n\n // handleError expects a response so we fake some important bits.\n /*\n this.handleError(, docuri, options)\n */\n }\n )\n }\n\n /**\n * Asks for a doc to be loaded if necessary then calls back\n *\n * Calling methods:\n * nowOrWhenFetched (uri, userCallback)\n * nowOrWhenFetched (uri, options, userCallback)\n * nowOrWhenFetched (uri, referringTerm, userCallback, options) <-- old\n * nowOrWhenFetched (uri, referringTerm, userCallback) <-- old\n *\n * Options include:\n * referringTerm The document in which this link was found.\n * this is valuable when finding the source of bad URIs\n * force boolean. Never mind whether you have tried before,\n * load this from scratch.\n * forceContentType Override the incoming header to force the data to be\n * treated as this content-type.\n *\n * Callback function takes:\n *\n * ok True if the fetch worked, and got a 200 response.\n * False if any error happened\n *\n * errmessage Text error message if not OK.\n *\n * response The fetch Response object (was: XHR) if there was was one\n * includes response.status as the HTTP status if any.\n */\n nowOrWhenFetched (\n uriIn: string | NamedNode,\n p2?: UserCallback | Options,\n userCallback?: UserCallback,\n options: Options = {}\n ): void {\n const uri = termValue(uriIn)\n\n if (typeof p2 === 'function') {\n // nowOrWhenFetched (uri, userCallback)\n userCallback = p2\n } else if (typeof p2 === 'undefined') { // original calling signature\n // referringTerm = undefined\n } else if (isNamedNode(p2)) {\n // referringTerm = p2\n options.referringTerm = p2\n } else {\n // nowOrWhenFetched (uri, options, userCallback)\n options = p2\n }\n\n (this.load(uri, options) as Promise)\n .then((fetchResponse: ExtendedResponse) => {\n if (userCallback) {\n if (fetchResponse) {\n if ((fetchResponse as Response).ok) {\n userCallback(true, 'OK', fetchResponse)\n } else {\n let oops = 'HTTP error: Status ' + fetchResponse.status + ' (' + fetchResponse.statusText + ')'\n if (fetchResponse.responseText) {\n oops += ' ' + fetchResponse.responseText // not in 404, dns error, nock failure\n }\n userCallback(false, oops, fetchResponse)\n }\n } else {\n let oops = ('@@ nowOrWhenFetched: no response object!')\n userCallback(false, oops)\n }\n }\n }, function (err: FetchError) {\n var message = err.message || err.statusText\n message = 'Failed to load <' + uri + '> ' + message\n if (err.response && err.response.status) {\n message += ' status: ' + err.response.status\n }\n (userCallback as any)(false, message, err.response)\n })\n }\n\n /**\n * Records a status message (as a literal node) by appending it to the\n * request's metadata status collection.\n *\n */\n addStatus (req: BlankNode, statusMessage: string) {\n // \n let now = new Date()\n statusMessage = '[' + now.getHours() + ':' + now.getMinutes() + ':' +\n now.getSeconds() + '.' + now.getMilliseconds() + '] ' + statusMessage\n // \n let kb = this.store\n\n const statusNode = kb.the(req, this.ns.link('status'))\n if (isCollection(statusNode)) {\n statusNode.append(kb.rdfFactory.literal(statusMessage))\n } else {\n log.warn('web.js: No list to add to: ' + statusNode + ',' + statusMessage)\n }\n }\n\n /**\n * Records errors in the system on failure:\n *\n * - Adds an entry to the request status collection\n * - Adds an error triple with the fail message to the metadata\n * - Fires the 'fail' callback\n * - Rejects with an error result object, which has a response object if any\n */\n failFetch (\n options: {\n req: BlankNode\n original: Quad_Subject\n } & Options,\n errorMessage: string,\n statusCode: StatusValues,\n response?: ExtendedResponse\n ): Promise {\n this.addStatus(options.req, errorMessage)\n\n if (!options.noMeta) {\n this.store.add(\n options.original,\n this.ns.link('error'),\n this.store.rdfFactory.literal(errorMessage)\n )\n }\n\n let meth = (options.method || 'GET').toUpperCase()\n let isGet = meth === 'GET' || meth === 'HEAD'\n\n if (isGet) { // only cache the status code on GET or HEAD\n if (!(options as any).resource.equals(options.original)) {\n // console.log('@@ Recording failure ' + meth + ' original ' + options.original +option '( as ' + options.resource + ') : ' + statusCode)\n } else {\n // console.log('@@ Recording ' + meth + ' failure for ' + options.original + ': ' + statusCode)\n }\n this.requested[Uri.docpart(options.original.value)] = statusCode\n this.fireCallbacks('fail', [options.original.value, errorMessage])\n }\n\n var err: FetchError = new Error('Fetcher: ' + errorMessage)\n\n // err.ok = false // Is taken as a response, will work too @@ phase out?\n err.status = statusCode\n err.statusText = errorMessage\n err.response = response\n\n return Promise.reject(err)\n }\n\n // in the why part of the quad distinguish between HTML and HTTP header\n // Reverse is set iif the link was rev= as opposed to rel=\n linkData (\n originalUri: NamedNode,\n rel: string,\n uri: string,\n why: Quad_Graph,\n reverse?: boolean\n ) {\n if (!uri) return\n let kb = this.store\n let predicate\n // See http://www.w3.org/TR/powder-dr/#httplink for describedby 2008-12-10\n let obj = kb.rdfFactory.namedNode(Uri.join(uri, originalUri.value))\n\n if (rel === 'alternate' || rel === 'seeAlso' || rel === 'meta' ||\n rel === 'describedby') {\n if (obj.value === originalUri.value) { return }\n predicate = this.ns.rdfs('seeAlso')\n } else if (rel === 'type') {\n predicate = kb.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type')\n } else {\n // See https://www.iana.org/assignments/link-relations/link-relations.xml\n // Alas not yet in RDF yet for each predicate\n // encode space in e.g. rel=\"shortcut icon\"\n predicate = kb.rdfFactory.namedNode(\n Uri.join(encodeURIComponent(rel),\n 'http://www.iana.org/assignments/link-relations/')\n )\n }\n if (reverse) {\n kb.add(obj, predicate, originalUri, why)\n } else {\n kb.add(originalUri, predicate, obj, why)\n }\n }\n\n parseLinkHeader (\n linkHeader: string,\n originalUri: NamedNode,\n reqNode: Quad_Graph\n ): void {\n if (!linkHeader) { return }\n\n // const linkexp = /<[^>]*>\\s*(\\s*;\\s*[^()<>@,;:\"/[\\]?={} \\t]+=(([^()<>@,;:\"/[]?={} \\t]+)|(\"[^\"]*\")))*(,|$)/g\n // const paramexp = /[^()<>@,;:\"/[]?={} \\t]+=(([^()<>@,;:\"/[]?={} \\t]+)|(\"[^\"]*\"))/g\n\n // From https://www.dcode.fr/regular-expression-simplificator:\n // const linkexp = /<[^>]*>\\s*(\\s*;\\s*[^()<>@,;:\"/[\\]?={} t]+=[\"]))*[,$]/g\n // const paramexp = /[^\\\\<>@,;:\"\\/\\[\\]?={} \\t]+=[\"])/g\n // Original:\n const linkexp = /<[^>]*>\\s*(\\s*;\\s*[^()<>@,;:\"/[\\]?={} \\t]+=(([^\\(\\)<>@,;:\"\\/\\[\\]\\?={} \\t]+)|(\"[^\"]*\")))*(,|$)/g\n const paramexp = /[^\\(\\)<>@,;:\"\\/\\[\\]\\?={} \\t]+=(([^\\(\\)<>@,;:\"\\/\\[\\]\\?={} \\t]+)|(\"[^\"]*\"))/g\n\n const matches = linkHeader.match(linkexp)\n\n if (matches == null) return;\n\n for (let i = 0; i < matches.length; i++) {\n let split = matches[i].split('>')\n let href = split[0].substring(1)\n let ps = split[1]\n let s = ps.match(paramexp)\n if (s == null) return\n for (let j = 0; j < s.length; j++) {\n let p = s[j]\n let paramsplit = p.split('=')\n // var name = paramsplit[0]\n let rel = paramsplit[1].replace(/[\"']/g, '') // '\"\n this.linkData(originalUri, rel, href, reqNode)\n }\n }\n }\n\n doneFetch (\n options: {\n req: Quad_Subject,\n original: Quad_Subject\n } & Options,\n response: ExtendedResponse\n ): Response {\n this.addStatus(options.req, 'Done.')\n this.requested[options.original.value] = 'done'\n\n this.fireCallbacks('done', [options.original.value])\n\n response.req = options.req // Set the request meta blank node\n\n return response\n }\n\n /**\n * Note two nodes are now smushed\n * If only one was flagged as looked up, then the new node is looked up again,\n * which will make sure all the URIs are dereferenced\n */\n nowKnownAs (was: Quad_Subject, now: Quad_Subject): void {\n if (this.lookedUp[was.value]) {\n // Transfer userCallback\n if (!this.lookedUp[now.value]) {\n this.lookUpThing(now, was)\n }\n } else if (this.lookedUp[now.value]) {\n if (!this.lookedUp[was.value]) {\n this.lookUpThing(was, now)\n }\n }\n }\n\n /**\n * Writes back to the web what we have in the store for this uri\n */\n putBack (\n uri: NamedNode | string,\n options: Options = {}\n ): Promise {\n const uriSting = termValue(uri)\n let doc = new RDFlibNamedNode(uriSting).doc() // strip off #\n options.contentType = options[\"content-type\"] || options[\"Content-Type\"] || options.contentType || TurtleContentType\n if (options.contentType === 'application/ld+json') {\n return new Promise((resolve, reject) => {\n serialize(doc, this.store, doc.uri, options.contentType, (err, jsonString) => {\n if (err) {\n reject(err)\n } else {\n // @ts-ignore\n options.data = jsonString\n this.webOperation('PUT', uri, options)\n .then((res) => resolve(res))\n .catch((error) => reject(error))\n }\n })\n })\n }\n options.data = serialize(doc, this.store, doc.value, options.contentType) as string\n return this.webOperation('PUT', uriSting, options)\n }\n\n webCopy (here: string, there: string, contentType): Promise {\n return this.webOperation('GET', here)\n .then((result) => {\n return this.webOperation(\n 'PUT', // change to binary from text\n there, { data: result.responseText, contentType })\n })\n }\n\n delete (uri: string, options?: Options): Promise {\n return this.webOperation('DELETE', uri, options)\n .then(response => {\n this.requested[uri] = 404\n this.nonexistent[uri] = true\n this.unload(this.store.rdfFactory.namedNode(uri))\n\n return response\n })\n }\n\n /** Create an empty resource if it really does not exist\n * Be absolutely sure something does not exist before creating a new empty file\n * as otherwise existing could be deleted.\n * @param doc - The resource\n */\n async createIfNotExists (\n doc: RDFlibNamedNode,\n contentType = TurtleContentType,\n data = ''\n ): Promise {\n const fetcher = this\n try {\n var response = await fetcher.load(doc as NamedNode)\n } catch (err) {\n // @ts-ignore\n if (err.response.status === 404) {\n // console.log('createIfNotExists: doc does NOT exist, will create... ' + doc)\n try {\n response = await fetcher.webOperation('PUT', doc.value, {data, contentType})\n } catch (err) {\n // console.log('createIfNotExists doc FAILED: ' + doc + ': ' + err)\n throw err\n }\n delete fetcher.requested[doc.value] // delete cached 404 error\n // console.log('createIfNotExists doc created ok ' + doc)\n return response\n } else {\n // console.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + err)\n throw err\n }\n }\n // console.log('createIfNotExists: doc exists, all good: ' + doc)\n return response as Response\n }\n\n /**\n * @param parentURI URI of parent container\n * @param folderName - Optional folder name (slug)\n * @param data - Optional folder metadata\n */\n createContainer (\n parentURI: string,\n folderName: string,\n data: string\n ): Promise {\n let headers = {\n // Force the right mime type for containers\n 'content-type': TurtleContentType,\n 'link': this.ns.ldp('BasicContainer') + '; rel=\"type\"'\n }\n\n if (folderName) {\n headers['slug'] = folderName\n }\n\n // @ts-ignore These headers lack some of the required operators.\n let options: Options = { headers }\n\n if (data) {\n options.body = data\n }\n\n return this.webOperation('POST', parentURI, options)\n }\n\n invalidateCache (iri: string | NamedNode): void {\n const uri = termValue(iri)\n const fetcher = this\n // @ts-ignore\n if (fetcher.fetchQueue && fetcher.fetchQueue[uri]) {\n // console.log('Internal error - fetchQueue exists ' + uri)\n var promise = fetcher.fetchQueue[uri]\n if (promise['PromiseStatus'] === 'resolved') {\n delete fetcher.fetchQueue[uri]\n } else { // pending\n delete fetcher.fetchQueue[uri]\n // console.log('*** Fetcher: pending fetchQueue deleted ' + uri)\n }\n } if (fetcher.requested[uri] && fetcher.requested[uri] !== 'done' &&\n fetcher.requested[uri] !== 'failed' && fetcher.requested[uri] !== 404) {\n let msg = `Rdflib: fetcher: Destructive operation on <${fetcher.requested[uri]}> file being fetched! ` + uri\n console.error(msg)\n // alert(msg)\n } else {\n delete fetcher.requested[uri] // invalidate read cache -- @@ messes up logic if request in progress ??\n delete fetcher.nonexistent[uri]\n }\n }\n\n /**\n * A generic web operation, at the fetch() level.\n * does not involve the quad store.\n *\n * Returns promise of Response\n * If data is returned, copies it to response.responseText before returning\n */\n webOperation (\n method: HTTPMethods,\n uriIn: string | NamedNode,\n // Not sure about this type. Maybe this Options is different?\n options: Options = {}\n ): Promise {\n const uri = termValue(uriIn)\n options.method = method\n options.body = options.data || options.body\n options.force = true\n const fetcher = this\n\n if (options.body && !options.contentType) {\n throw new Error('Web operation sending data must have a defined contentType.')\n }\n if (options.contentType) {\n (options as any).headers = options.headers || {};\n (options as any).headers['content-type'] = options.contentType\n }\n Fetcher.setCredentials(uri, options)\n\n return new Promise(function (resolve, reject) {\n fetcher._fetch(uri, options).then(response => {\n if (response.ok) {\n if (method === 'PUT' || method === 'PATCH' || method === 'POST' || method === 'DELETE') {\n fetcher.invalidateCache (uri)\n } // response.body with Chrome can't be relied on\n if (response.text) { // Was: response.body https://github.com/linkeddata/rdflib.js/issues/506\n response.text().then(data => {\n response.responseText = data\n resolve(response)\n })\n } else {\n resolve(response)\n }\n } else {\n let msg = 'Web error: ' + response.status\n if (response.statusText) msg += ' (' + response.statusText + ')'\n msg += ' on ' + method + ' of <' + uri + '>'\n if (response.responseText) msg += ': ' + response.responseText\n let e2: FetchError = new Error(msg)\n e2.response = response\n reject(e2)\n }\n }, (err: Error) => {\n let msg = 'Fetch error for ' + method + ' of <' + uri + '>:' + err\n reject(new Error(msg))\n })\n })\n }\n\n /**\n * Looks up something.\n * Looks up all the URIs a things has.\n *\n * @param term - canonical term for the thing whose URI is\n * to be dereferenced\n * @param rterm - the resource which referred to this\n * (for tracking bad links)\n */\n lookUpThing (\n term: Quad_Subject,\n rterm: Quad_Subject\n ): Promise | Promise[] {\n let uris = this.store.uris(term) // Get all URIs\n uris = uris.map(u => Uri.docpart(u)) // Drop hash fragments\n\n uris.forEach(u => {\n this.lookedUp[u] = true\n })\n\n // @ts-ignore Recursive type\n return this.load(uris, { referringTerm: rterm })\n }\n\n /**\n * Looks up response header.\n *\n * @returns {Array|undefined} a list of header values found in a stored HTTP\n * response, or [] if response was found but no header found,\n * or undefined if no response is available.\n * Looks for { [] link:requestedURI ?uri; link:response [ httph:header-name ?value ] }\n */\n getHeader (\n doc: NamedNode,\n header: string\n ): undefined | string[] {\n const kb = this.store // look for the URI (AS A STRING NOT A NODE) for a stored request\n const docuri: string = doc.value\n const requests = kb.each(undefined, this.ns.link('requestedURI'), kb.rdfFactory.literal(docuri)) as Quad_Subject[]\n\n for (let r = 0; r < requests.length; r++) {\n let request = requests[r]\n if (request !== undefined) {\n let response = kb.any(request, this.ns.link('response')) as Quad_Subject\n if (response !== undefined && kb.anyValue(response, this.ns.http('status')) && (kb.anyValue(response, this.ns.http('status')) as string).startsWith('2')) {\n // Only look at success returns - not 401 error messagess etc\n let results = kb.each(response, this.ns.httph(header.toLowerCase()))\n\n if (results.length) {\n return results.map(v => { return v.value })\n }\n\n return []\n }\n }\n }\n return undefined\n }\n\n saveRequestMetadata (\n docuri: string,\n options: AutoInitOptions\n ) {\n let req = options.req\n let kb = this.store\n let rterm = options.referringTerm\n\n this.addStatus(options.req, 'Accept: ' + options.headers['accept'])\n\n if (isNamedNode(rterm)) {\n kb.add(kb.rdfFactory.namedNode(docuri), this.ns.link('requestedBy'), rterm, this.appNode)\n }\n\n if (options.original && options.original.value !== docuri) {\n kb.add(req, this.ns.link('orginalURI'), kb.rdfFactory.literal(options.original.value),\n this.appNode)\n }\n\n const now = new Date()\n const timeNow = '[' + now.getHours() + ':' + now.getMinutes() + ':' +\n now.getSeconds() + '] '\n\n kb.add(req, this.ns.rdfs('label'),\n kb.rdfFactory.literal(timeNow + ' Request for ' + docuri), this.appNode)\n // We store the docuri as a string, not as a node,\n // see https://github.com/linkeddata/rdflib.js/pull/427#pullrequestreview-447910061\n kb.add(req, this.ns.link('requestedURI'), kb.rdfFactory.literal(docuri), this.appNode)\n kb.add(req, this.ns.link('status'), kb.collection(), this.appNode)\n }\n\n saveResponseMetadata (\n response: Response,\n options: {\n req: BlankNode,\n resource: Quad_Subject\n } & Options\n ): BlankNode {\n const kb = this.store\n\n let responseNode = kb.bnode()\n\n kb.add(options.req, this.ns.link('response'), responseNode, this.appNode)\n kb.add(responseNode, this.ns.http('status'),\n kb.rdfFactory.literal(response.status as any), this.appNode)\n kb.add(responseNode, this.ns.http('statusText'),\n kb.rdfFactory.literal(response.statusText), this.appNode)\n\n // Save the response headers\n response.headers.forEach((value, header) => {\n kb.add(responseNode, this.ns.httph(header), this.store.rdfFactory.literal(value), this.appNode)\n\n if (header === 'content-type') {\n kb.add(\n options.resource,\n this.ns.rdf('type'),\n kb.rdfFactory.namedNode(Util.mediaTypeClass(value).value),\n this.appNode // responseNode\n )\n }\n })\n\n return responseNode\n }\n\n objectRefresh (term: NamedNode): void {\n let uris = this.store.uris(term) // Get all URIs\n if (typeof uris !== 'undefined') {\n for (let i = 0; i < uris.length; i++) {\n this.refresh(this.store.rdfFactory.namedNode(Uri.docpart(uris[i])))\n // what about rterm?\n }\n }\n }\n\n /* refresh Reload data from a given document\n **\n ** @param term - An RDF Named Node for the eodcument in question\n ** @param userCallback - A function userCallback(ok, message, response)\n */\n refresh (\n term: NamedNode,\n userCallback?: UserCallback\n ): void { // sources_refresh\n this.fireCallbacks('refresh', arguments)\n\n this.nowOrWhenFetched(term, { force: true, clearPreviousData: true },\n userCallback)\n }\n\n /* refreshIfExpired Conditional refresh if Expired\n **\n ** @param term - An RDF Named Node for the eodcument in question\n ** @param userCallback - A function userCallback(ok, message, response)\n */\n refreshIfExpired (\n term: NamedNode,\n userCallback: UserCallback\n ): void {\n let exp = this.getHeader(term, 'Expires')\n if (!exp || (new Date(exp[0]).getTime()) <= (new Date().getTime())) {\n this.refresh(term, userCallback)\n } else {\n userCallback(true, 'Not expired', {})\n }\n }\n\n retract (term: Quad_Graph) { // sources_retract\n this.store.removeMany(undefined, undefined, undefined, term)\n if (term.value) {\n delete this.requested[Uri.docpart(term.value)]\n }\n this.fireCallbacks('retract', arguments)\n }\n\n getState (docuri: string) {\n if (typeof this.requested[docuri] === 'undefined') {\n return 'unrequested'\n } else if (this.requested[docuri] === true) {\n return 'requested'\n } else if (this.requested[docuri] === 'done') {\n return 'fetched'\n } else if (this.requested[docuri] === 'redirected') {\n return this.getState(this.redirectedTo[docuri])\n } else { // An non-200 HTTP error status\n return 'failed'\n }\n }\n\n isPending (docuri: string) { // sources_pending\n // doing anyStatementMatching is wasting time\n // if it's not pending: false -> flailed\n // 'done' -> done 'redirected' -> redirected\n return this.requested[docuri] === true\n }\n\n unload (term: NamedNode) {\n this.store.removeDocument(term)\n delete this.requested[term.value] // So it can be load2ed again\n }\n\n addHandler (handler: typeof Handler) {\n this.handlers.push(handler);\n (handler as any).register(this)\n }\n\n retryNoCredentials (\n docuri: string,\n options\n ): Promise {\n // console.log('Fetcher: CORS: RETRYING with NO CREDENTIALS for ' + options.resource)\n\n options.retriedWithNoCredentials = true // protect against being called twice\n\n delete this.requested[docuri] // forget the original request happened\n delete this.fetchQueue[docuri]\n // Note: XHR property was withCredentials, but fetch property is just credentials\n let newOptions = Object.assign({}, options, { credentials: 'omit' })\n\n this.addStatus(options.req,\n 'Abort: Will retry with credentials SUPPRESSED to see if that helps')\n\n return this.load(docuri, newOptions) as Promise\n }\n\n /**\n * Tests whether a request is being made to a cross-site URI (for purposes\n * of retrying with a proxy)\n */\n isCrossSite (uri: string): boolean {\n // Mashup situation, not node etc\n if (typeof document === 'undefined' || !document.location) {\n return false\n }\n\n const hostpart = Uri.hostpart\n const here = '' + document.location\n return (hostpart(here) && hostpart(uri) && hostpart(here)) !== hostpart(uri)\n }\n\n /**\n * Called when there's a network error in fetch(), or a response\n * with status of 0.\n */\n handleError (\n response: ExtendedResponse | Error,\n docuri: string,\n options: AutoInitOptions\n ): Promise {\n if (this.isCrossSite(docuri)) {\n // Make sure we haven't retried already\n if (options.credentials && options.credentials === 'include' && !options.retriedWithNoCredentials) {\n return this.retryNoCredentials(docuri, options)\n }\n\n // Now attempt retry via proxy\n let proxyUri = Fetcher.crossSiteProxy(docuri)\n\n if (proxyUri && !options.proxyUsed) {\n // console.log('web: Direct failed so trying proxy ' + proxyUri)\n return this.redirectToProxy(proxyUri, options)\n }\n }\n\n var message\n if (response instanceof Error) {\n message = 'Fetch error: ' + response.message\n } else {\n message = response.statusText\n if (response.responseText) {\n message += ` ${response.responseText}`\n }\n }\n\n // This is either not a CORS error, or retries have been made\n return this.failFetch(options, message, (response as Response).status || 998, (response as Response))\n }\n\n // deduce some things from the HTTP transaction\n addType (\n rdfType: NamedNode,\n req: Quad_Subject,\n kb: IndexedFormula,\n locURI: string\n ): void { // add type to all redirected resources too\n let prev = req\n if (locURI) {\n var reqURI = kb.any(prev, this.ns.link('requestedURI'))\n if (reqURI && reqURI.value !== locURI) {\n kb.add(kb.rdfFactory.namedNode(locURI), this.ns.rdf('type'), rdfType, this.appNode)\n }\n }\n for (;;) {\n const doc = kb.any(prev, this.ns.link('requestedURI'))\n if (doc && doc.value) {\n kb.add(kb.rdfFactory.namedNode(doc.value), this.ns.rdf('type'), rdfType, this.appNode)\n } // convert Literal\n prev = kb.any(undefined, kb.rdfFactory.namedNode('http://www.w3.org/2007/ont/link#redirectedRequest'), prev) as Quad_Subject\n if (!prev) { break }\n var response = kb.any(prev, kb.rdfFactory.namedNode('http://www.w3.org/2007/ont/link#response'))\n if (!response) { break }\n var redirection = kb.any((response as NamedNode), kb.rdfFactory.namedNode('http://www.w3.org/2007/ont/http#status'))\n if (!redirection) { break }\n // @ts-ignore always true?\n if ((redirection !== '301') && (redirection !== '302')) { break }\n }\n }\n\n /**\n * Handle fetch() response\n */\n handleResponse (\n response: ExtendedResponse,\n docuri: string,\n options: AutoInitOptions\n ): Promise | ExtendedResponse {\n\n const kb = this.store\n const headers = (response as Response).headers\n\n const reqNode = options.req\n\n const responseNode = this.saveResponseMetadata(response, options)\n\n const contentType = this.normalizedContentType(options, headers) || ''\n let contentLocation = headers.get('content-location')\n\n // this.fireCallbacks('recv', xhr.args)\n // this.fireCallbacks('headers', [{uri: docuri, headers: xhr.headers}])\n\n // Check for masked errors (CORS, etc)\n if (response.status === 0) {\n // console.log('Masked error - status 0 for ' + docuri)\n return this.handleError(response, docuri, options)\n }\n\n if (response.status >= 400) {\n if (response.status === 404) {\n this.nonexistent[options.original.value] = true\n this.nonexistent[docuri] = true\n }\n\n return this.saveErrorResponse(response, responseNode)\n .then(() => {\n let errorMessage = options.resource + ' ' + response.statusText\n\n return this.failFetch(options, errorMessage, response.status, response)\n })\n }\n\n var diffLocation: null | string = null\n var absContentLocation: null | string = null\n if (contentLocation) {\n absContentLocation = Uri.join(contentLocation, docuri)\n if (absContentLocation !== docuri) {\n diffLocation = absContentLocation\n }\n }\n if (response.status === 200) {\n this.addType(this.ns.link('Document') as NamedNode, reqNode, kb, docuri)\n if (diffLocation) {\n this.addType(this.ns.link('Document') as NamedNode, reqNode, kb,\n diffLocation)\n }\n\n // Before we parse new data clear old but only on 200\n if (options.clearPreviousData) {\n // kb.removeDocument(options.resource)\n // only remove content, keep metatdata\n const sts = kb.statementsMatching(undefined, undefined, undefined, options.resource).slice() // Take a copy as this is the actual index\n for (let i = 0; i < sts.length; i++) {\n kb.removeStatement(sts[i])\n }\n }\n\n let isImage = contentType.includes('image/') ||\n contentType.includes('application/pdf')\n\n if (contentType && isImage) {\n this.addType(kb.rdfFactory.namedNode('http://purl.org/dc/terms/Image'), reqNode, kb,\n docuri)\n if (diffLocation) {\n this.addType(kb.rdfFactory.namedNode('http://purl.org/dc/terms/Image'), reqNode, kb,\n diffLocation)\n }\n }\n }\n\n // If we have already got the thing at this location, abort\n if (contentLocation) {\n if (!options.force && diffLocation && this.requested[absContentLocation as string] === 'done') {\n // we have already fetched this\n // should we smush too?\n // log.info(\"HTTP headers indicate we have already\" + \" retrieved \" +\n // xhr.resource + \" as \" + absContentLocation + \". Aborting.\")\n return this.doneFetch(options, response)\n }\n\n this.requested[absContentLocation as string] = true\n }\n\n this.parseLinkHeader(headers.get('link') as string, options.original, reqNode)\n\n let handler = this.handlerForContentType(contentType, response) as Handler\n\n if (!handler) {\n // Not a problem, we just don't extract data\n this.addStatus(reqNode, 'Fetch over. No data handled.')\n return this.doneFetch(options, response)\n }\n\n return response\n .text()\n // @ts-ignore Types seem right\n .then(responseText => {\n response.responseText = responseText\n return (handler as N3Handler).parse(this, responseText, options, response)\n })\n }\n\n saveErrorResponse (\n response: ExtendedResponse,\n responseNode: Quad_Subject\n ): Promise {\n let kb = this.store\n\n return response.text()\n .then(content => {\n if (content.length > 10) {\n kb.add(responseNode, this.ns.http('content'), kb.rdfFactory.literal(content), responseNode)\n }\n })\n }\n\n handlerForContentType (contentType: string, response: ExtendedResponse): Handler | null {\n if (!contentType) {\n return null\n }\n\n let Handler = this.handlers.find(handler => {\n return contentType.match(handler.pattern)\n })\n\n // @ts-ignore in practice all Handlers have constructors.\n return Handler ? new Handler(response) : null\n }\n\n guessContentType (uri: string): ContentType | undefined {\n return CONTENT_TYPE_BY_EXT[uri.split('.').pop() as string]\n }\n\n normalizedContentType (\n options: AutoInitOptions,\n headers: Headers\n ): ContentType | string | null {\n if (options.forceContentType) {\n return options.forceContentType\n }\n\n let contentType = headers.get('content-type')\n if (!contentType || contentType.includes('application/octet-stream')) {\n let guess = this.guessContentType(options.resource.value)\n\n if (guess) {\n return guess\n }\n }\n\n let protocol = Uri.protocol(options.resource.value) as string\n\n if (!contentType && ['file', 'chrome'].includes(protocol)) {\n return 'text/xml'\n }\n\n return contentType\n }\n\n /**\n * Sends a new request to the specified uri. (Extracted from `onerrorFactory()`)\n */\n redirectToProxy (\n newURI: string,\n options: AutoInitOptions\n ): Promise {\n this.addStatus(options.req, 'BLOCKED -> Cross-site Proxy to <' + newURI + '>')\n\n options.proxyUsed = true\n\n const kb = this.store\n const oldReq = options.req // request metadata blank node\n\n if (!options.noMeta) {\n kb.add(oldReq, this.ns.link('redirectedTo'), kb.rdfFactory.namedNode(newURI), oldReq)\n this.addStatus(oldReq, 'redirected to new request') // why\n }\n\n this.requested[options.resource.value] = 'redirected'\n this.redirectedTo[options.resource.value] = newURI\n\n let newOptions = Object.assign({}, options)\n newOptions.baseURI = options.resource.value\n\n return this.fetchUri(newURI, newOptions)\n .then(response => {\n if (!newOptions.noMeta) {\n kb.add(oldReq, this.ns.link('redirectedRequest'), newOptions.req, this.appNode)\n }\n\n return response\n })\n }\n\n setRequestTimeout (\n uri: string,\n options: {\n req: Quad_Subject\n original: Quad_Subject\n } & Options\n ): Promise {\n return new Promise((resolve) => {\n this.timeouts[uri] = (this.timeouts[uri] || []).concat(setTimeout(() => {\n if (this.isPending(uri) &&\n !options.retriedWithNoCredentials &&\n !options.proxyUsed) {\n resolve(this.failFetch(options, `Request to ${uri} timed out`, 'timeout'))\n }\n }, this.timeout) as unknown as number)\n })\n }\n\n addFetchCallback (\n uri: string,\n callback: UserCallback\n ): void {\n if (!this.fetchCallbacks[uri]) {\n this.fetchCallbacks[uri] = [callback]\n } else {\n this.fetchCallbacks[uri].push(callback)\n }\n }\n\n acceptString () {\n let acceptstring = ''\n\n for (let mediaType in this.mediatypes) {\n if (acceptstring !== '') {\n acceptstring += ', '\n }\n\n acceptstring += mediaType\n\n for (let property in this.mediatypes[mediaType]) {\n acceptstring += ';' + property + '=' + this.mediatypes[mediaType][property]\n }\n }\n\n return acceptstring\n }\n // var updatesVia = new $rdf.UpdatesVia(this) // Subscribe to headers\n// @@@@@@@@ This is turned off because it causes a websocket to be set up for ANY fetch\n// whether we want to track it ot not. including ontologies loaed though the XSSproxy\n}\n\nFetcher.HANDLERS = defaultHandlers\nFetcher.CONTENT_TYPE_BY_EXT = CONTENT_TYPE_BY_EXT\n","export default (function () {\r\n return {\r\n parseJSON: function (data, source, store) {\r\n var subject, predicate, object\r\n var bnodes = {}\r\n var why = store.sym(source)\r\n for (var x in data) {\r\n if (x.indexOf('_:') === 0) {\r\n if (bnodes[x]) {\r\n subject = bnodes[x]\r\n } else {\r\n subject = store.bnode(x)\r\n bnodes[x] = subject\r\n }\r\n } else {\r\n subject = store.sym(x)\r\n }\r\n var preds = data[x]\r\n for (var y in preds) {\r\n var objects = preds[y]\r\n predicate = store.sym(y)\r\n for (var z in objects) {\r\n var obj = objects[z]\r\n if (obj.type === 'uri') {\r\n object = store.sym(obj.value)\r\n store.add(subject, predicate, object, why)\r\n } else if (obj.type === 'BlankNode') {\r\n if (bnodes[obj.value]) {\r\n object = bnodes[obj.value]\r\n } else {\r\n object = store.bnode(obj.value)\r\n bnodes[obj.value] = object\r\n }\r\n store.add(subject, predicate, object, why)\r\n } else if (obj.type === 'Literal') {\r\n // var datatype\r\n if (obj.datatype) {\r\n object = store.literal(obj.value, undefined, store.sym(obj.datatype))\r\n } else if (obj.lang) {\r\n object = store.literal(obj.value, obj.lang)\r\n } else {\r\n object = store.literal(obj.value)\r\n }\r\n store.add(subject, predicate, object, why)\r\n } else {\r\n throw new Error('error: unexpected termtype: ' + z.type)\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n})()\r\n","import log from './log'\n\nexport default function queryToSPARQL (query) {\n var indent = 0\n function getSelect (query) {\n var str = addIndent() + 'SELECT '\n for (var i = 0; i < query.vars.length; i++) {\n str += query.vars[i] + ' '\n }\n str += '\\n'\n return str\n }\n\n function getPattern (pat) {\n var str = ''\n var st = pat.statements\n for (var x in st) {\n log.debug('Found statement: ' + st)\n str += addIndent() + st[x] + '\\n'\n }\n return str\n }\n\n function getConstraints (pat) {\n var str = ''\n for (var v in pat.constraints) {\n var foo = pat.constraints[v]\n str += addIndent() + 'FILTER ( ' + foo.describe(v) + ' ) ' + '\\n'\n }\n return str\n }\n\n function getOptionals (pat) {\n var str = ''\n for (var x = 0; x < pat.optional.length; x++) {\n // alert(pat.optional.termType)\n log.debug('Found optional query')\n str += addIndent() + 'OPTIONAL { ' + '\\n'\n indent++\n str += getPattern(pat.optional[x])\n str += getConstraints(pat.optional[x])\n str += getOptionals(pat.optional[x])\n indent--\n str += addIndent() + '}' + '\\n'\n }\n return str\n }\n\n function getWhere (pat) {\n var str = addIndent() + 'WHERE \\n' + '{ \\n'\n indent++\n str += getPattern(pat)\n str += getConstraints(pat)\n str += getOptionals(pat)\n indent--\n str += '}'\n return str\n }\n\n function addIndent () {\n var str = ''\n for (var i = 0; i < indent; i++) {\n str += ' '\n }\n return str\n }\n\n function getSPARQL (query) {\n return getSelect(query) + getWhere(query.pat)\n }\n\n return getSPARQL(query)\n}\n","// Converting between SPARQL queries and the $rdf query API\n/*\n\nfunction SQuery () {\n this.terms = []\n return this\n}\n\nSTerm.prototype.toString = STerm.val\nSQuery.prototype.add = function (str) {this.terms.push()}*/\n\nimport log from './log'\nimport { Query } from './query'\n\n/**\n * @SPARQL: SPARQL text that is converted to a query object which is returned.\n * @testMode: testing flag. Prevents loading of sources.\n */\nexport default function SPARQLToQuery (SPARQL, testMode, kb) {\n // AJAR_ClearTable()\n var variableHash = []\n function makeVar (name) {\n if (variableHash[name]) {\n return variableHash[name]\n }\n var newVar = kb.variable(name)\n variableHash[name] = newVar\n return newVar\n }\n\n // term type functions\n function isRealText (term) {\n return (typeof term === 'string' && term.match(/[^ \\n\\t]/))\n }\n function isVar (term) {\n return (typeof term === 'string' && term.match(/^[\\?\\$]/))\n }\n function fixSymbolBrackets (term) {\n if (typeof term === 'string') {\n return term.replace(/^</, '<').replace(/>$/, '>')\n } else {\n return term\n }\n }\n function isSymbol (term) {\n return (typeof term === 'string' && term.match(/^<[^>]*>$/))\n }\n function isBnode (term) {\n return (typeof term === 'string' && (term.match(/^_:/) || term.match(/^$/)))\n }\n function isPrefix (term) {\n return (typeof term === 'string' && term.match(/:$/))\n }\n function isPrefixedSymbol (term) {\n return (typeof term === 'string' && term.match(/^:|^[^_][^:]*:/))\n }\n function getPrefix (term) {\n var a = term.split(':')\n return a[0]\n }\n function getSuffix (term) {\n var a = term.split(':')\n return a[1]\n }\n function removeBrackets (term) {\n if (isSymbol(term)) {\n return term.slice(1, term.length - 1)\n } else {\n return term\n }\n }\n // takes a string and returns an array of strings and Literals in the place of literals\n function parseLiterals (str) {\n // var sin = (str.indexOf(/[ \\n]\\'/)==-1)?null:str.indexOf(/[ \\n]\\'/), doub = (str.indexOf(/[ \\n]\\\"/)==-1)?null:str.indexOf(/[ \\n]\\\"/)\n var sin = (str.indexOf(\"'\") === -1)\n ? null\n : str.indexOf(\"'\")\n var doub = (str.indexOf('\"') === -1)\n ? null\n : str.indexOf('\"')\n // alert(\"S: \"+sin+\" D: \"+doub)\n if (!sin && !doub) {\n var a = new Array(1)\n a[0] = str\n return a\n }\n var res = new Array(2)\n var br\n var ind\n if (!sin || (doub && doub < sin)) {\n br = '\"'\n ind = doub\n } else if (!doub || (sin && sin < doub)) {\n br = \"'\"\n ind = sin\n } else {\n log.error('SQARQL QUERY OOPS!')\n return res\n }\n res[0] = str.slice(0, ind)\n var end = str.slice(ind + 1).indexOf(br)\n if (end === -1) {\n log.error('SPARQL parsing error: no matching parentheses in literal ' + str)\n return str\n }\n // alert(str.slice(end + ind + 2).match(/^\\^\\^/))\n var end2\n if (str.slice(end + ind + 2).match(/^\\^\\^/)) {\n end2 = str.slice(end + ind + 2).indexOf(' ')\n // alert(end2)\n res[1] = kb.literal(\n str.slice(ind + 1, ind + 1 + end),\n kb.sym(removeBrackets(\n str.slice(ind + 4 + end, ind + 2 + end + end2))\n )\n )\n // alert(res[1].datatype.uri)\n res = res.concat(parseLiterals(str.slice(end + ind + 3 + end2)))\n } else if (str.slice(end + ind + 2).match(/^@/)) {\n end2 = str.slice(end + ind + 2).indexOf(' ')\n // alert(end2)\n res[1] = kb.literal(\n str.slice(ind + 1, ind + 1 + end),\n str.slice(ind + 3 + end, ind + 2 + end + end2), null\n )\n // alert(res[1].datatype.uri)\n res = res.concat(\n parseLiterals(str.slice(end + ind + 2 + end2))\n )\n } else {\n res[1] = kb.literal(str.slice(ind + 1, ind + 1 + end))\n log.info('Literal found: ' + res[1])\n res = res.concat(parseLiterals(str.slice(end + ind + 2))) // finds any other literals\n }\n return res\n }\n\n function spaceDelimit (str) {\n str = str.replace(/\\(/g, ' ( ')\n .replace(/\\)/g, ' ) ')\n .replace(//g, '> ')\n .replace(/{/g, ' { ')\n .replace(/}/g, ' } ')\n .replace(/[\\t\\n\\r]/g, ' ')\n .replace(/; /g, ' ; ')\n .replace(/\\. /g, ' . ')\n .replace(/, /g, ' , ')\n log.info('New str into spaceDelimit: \\n' + str)\n var res = []\n var br = str.split(' ')\n for (var x in br) {\n if (isRealText(br[x])) {\n res = res.concat(br[x])\n }\n }\n return res\n }\n\n function replaceKeywords (input) {\n var strarr = input\n for (var x = 0; x < strarr.length; x++) {\n if (strarr[x] === 'a') {\n strarr[x] = ''\n }\n if (strarr[x] === 'is' && strarr[x + 2] === 'of') {\n strarr.splice(x, 1)\n strarr.splice(x + 1, 1)\n var s = strarr[x - 1]\n strarr[x - 1] = strarr[x + 1]\n strarr[x + 1] = s\n }\n }\n return strarr\n }\n\n function toTerms (input) {\n var res = []\n for (var x = 0; x < input.length; x++) {\n if (typeof input[x] !== 'string') {\n res[x] = input[x]\n continue\n }\n input[x] = fixSymbolBrackets(input[x])\n if (isVar(input[x])) {\n res[x] = makeVar(input[x].slice(1))\n } else if (isBnode(input[x])) {\n log.info(input[x] + ' was identified as a bnode.')\n res[x] = kb.bnode()\n } else if (isSymbol(input[x])) {\n log.info(input[x] + ' was identified as a symbol.')\n res[x] = kb.sym(removeBrackets(input[x]))\n } else if (isPrefixedSymbol(input[x])) {\n log.info(input[x] + ' was identified as a prefixed symbol')\n if (prefixes[getPrefix(input[x])]) {\n res[x] = kb.sym(input[x] = prefixes[getPrefix(input[x])] +\n getSuffix(input[x]))\n } else {\n log.error('SPARQL error: ' + input[x] + ' with prefix ' +\n getPrefix(input[x]) + ' does not have a correct prefix entry.')\n res[x] = input[x]\n }\n } else {\n res[x] = input[x]\n }\n }\n return res\n }\n\n function tokenize (str) {\n var token1 = parseLiterals(str)\n var token2 = []\n for (var x in token1) {\n if (typeof token1[x] === 'string') {\n token2 = token2.concat(spaceDelimit(token1[x]))\n } else {\n token2 = token2.concat(token1[x])\n }\n }\n token2 = replaceKeywords(token2)\n log.info('SPARQL Tokens: ' + token2)\n return token2\n }\n\n // CASE-INSENSITIVE\n function arrayIndexOf (str, arr) {\n for (var i = 0; i < arr.length; i++) {\n if (typeof arr[i] !== 'string') {\n continue\n }\n if (arr[i].toLowerCase() === str.toLowerCase()) {\n return i\n }\n }\n // log.warn(\"No instance of \"+str+\" in array \"+arr)\n return null\n }\n\n // CASE-INSENSITIVE\n function arrayIndicesOf (str, arr) {\n var ind = []\n for (var i = 0; i < arr.length; i++) {\n if (typeof arr[i] !== 'string') {\n continue\n }\n if (arr[i].toLowerCase() === str.toLowerCase()) {\n ind.push(i)\n }\n }\n return ind\n }\n\n function setVars (input, query) {\n log.info('SPARQL vars: ' + input)\n for (var x in input) {\n if (isVar(input[x])) {\n log.info('Added ' + input[x] + ' to query variables from SPARQL')\n var v = makeVar(input[x].slice(1))\n query.vars.push(v)\n v.label = input[x].slice(1)\n } else {\n log.warn('Incorrect SPARQL variable in SELECT: ' + input[x])\n }\n }\n }\n\n function getPrefixDeclarations (input) {\n var prefInd = arrayIndicesOf('PREFIX', input)\n var res = []\n for (var i in prefInd) {\n var a = input[prefInd[i] + 1]\n var b = input[prefInd[i] + 2]\n if (!isPrefix(a)) {\n log.error('Invalid SPARQL prefix: ' + a)\n } else if (!isSymbol(b)) {\n log.error('Invalid SPARQL symbol: ' + b)\n } else {\n log.info('Prefix found: ' + a + ' -> ' + b)\n var pref = getPrefix(a)\n var symbol = removeBrackets(b)\n res[pref] = symbol\n }\n }\n return res\n }\n\n function getMatchingBracket (arr, open, close) {\n log.info('Looking for a close bracket of type ' + close + ' in ' + arr)\n var index = 0\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] === open) {\n index++\n }\n if (arr[i] === close) {\n index--\n }\n if (index < 0) {\n return i\n }\n }\n log.error('Statement had no close parenthesis in SPARQL query')\n return 0\n }\n\n function constraintGreaterThan (value) {\n this.describe = function (varstr) {\n return varstr + ' > ' + value.toNT()\n }\n this.test = function (term) {\n if (term.value.match(/[0-9]+(\\.[0-9]+)?([eE][+-]?[0-9]+)?/)) {\n return (parseFloat(term.value) > parseFloat(value))\n } else {\n return (term.toNT() > value.toNT())\n }\n }\n return this\n }\n\n function constraintLessThan (value) { // this is not the recommended usage. Should only work on literal, numeric, dateTime\n this.describe = function (varstr) {\n return varstr + ' < ' + value.toNT()\n }\n this.test = function (term) {\n // this.describe = function (varstr) { return varstr + \" < \"+value }\n if (term.value.match(/[0-9]+(\\.[0-9]+)?([eE][+-]?[0-9]+)?/)) {\n return (parseFloat(term.value) < parseFloat(value))\n } else {\n return (term.toNT() < value.toNT())\n }\n }\n return this\n }\n // This should only work on literals but doesn't.\n function ConstraintEqualTo (value) {\n this.describe = function (varstr) {\n return varstr + ' = ' + value.toNT()\n }\n this.test = function (term) {\n return value.equals(term)\n }\n return this\n }\n\n // value must be a literal\n function ConstraintRegexp (value) {\n this.describe = function (varstr) {\n return \"REGEXP( '\" + value + \"' , \" + varstr + ' )'\n }\n this.test = function (term) {\n var str = value\n // str = str.replace(/^//,\"\").replace(//$/,\"\")\n var rg = new RegExp(str)\n if (term.value) {\n return rg.test(term.value)\n } else {\n return false\n }\n }\n }\n\n function setConstraint (input, pat) {\n if (input.length === 3 && input[0].termType === 'Variable' &&\n (input[2].termType === 'NamedNode' || input[2].termType === 'Literal')) {\n if (input[1] === '=') {\n log.debug('Constraint added: ' + input)\n pat.constraints[input[0]] = new ConstraintEqualTo(input[2])\n } else if (input[1] === '>') {\n log.debug('Constraint added: ' + input)\n pat.constraints[input[0]] = new ConstraintEqualTo(input[2])\n } else if (input[1] === '<') {\n log.debug('Constraint added: ' + input)\n pat.constraints[input[0]] = new ConstraintEqualTo(input[2])\n } else {\n log.warn(\"I don't know how to handle the constraint: \" + input)\n }\n } else if (input.length === 6 && typeof input[0] === 'string' &&\n input[0].toLowerCase() === 'regexp' &&\n input[1] === '(' && input[5] === ')' && input[3] === ',' &&\n input[4].termType === 'Variable' && input[2].termType === 'Literal') {\n log.debug('Constraint added: ' + input)\n pat.constraints[input[4]] = new ConstraintRegexp(input[2].value)\n }\n // log.warn(\"I don't know how to handle the constraint: \"+input)\n // alert(\"length: \"+input.length+\" input 0 type: \"+input[0].termType+\" input 1: \"+input[1]+\" input[2] type: \"+input[2].termType)\n }\n\n function setOptional (terms, pat) {\n log.debug('Optional query: ' + terms + ' not yet implemented.')\n var opt = kb.formula()\n setWhere(terms, opt)\n pat.optional.push(opt)\n }\n\n function setWhere (input, pat) {\n var terms = toTerms(input)\n var end\n log.debug('WHERE: ' + terms)\n var opt\n // var opt = arrayIndicesOf(\"OPTIONAL\",terms)\n while (arrayIndexOf('OPTIONAL', terms)) {\n opt = arrayIndexOf('OPTIONAL', terms)\n log.debug('OPT: ' + opt + ' ' + terms[opt] + ' in ' + terms)\n if (terms[opt + 1] !== '{') {\n log.warn('Bad optional opening bracket in word ' + opt)\n }\n end = getMatchingBracket(terms.slice(opt + 2), '{', '}')\n if (end === -1) {\n log.error('No matching bracket in word ' + opt)\n } else {\n setOptional(terms.slice(opt + 2, opt + 2 + end), pat)\n // alert(pat.statements[0].toNT())\n opt = arrayIndexOf('OPTIONAL', terms)\n end = getMatchingBracket(terms.slice(opt + 2), '{', '}')\n terms.splice(opt, end + 3)\n }\n }\n log.debug('WHERE after optionals: ' + terms)\n while (arrayIndexOf('FILTER', terms)) {\n var filt = arrayIndexOf('FILTER', terms)\n if (terms[filt + 1] !== '(') {\n log.warn('Bad filter opening bracket in word ' + filt)\n }\n end = getMatchingBracket(terms.slice(filt + 2), '(', ')')\n if (end === -1) {\n log.error('No matching bracket in word ' + filt)\n } else {\n setConstraint(terms.slice(filt + 2, filt + 2 + end), pat)\n filt = arrayIndexOf('FILTER', terms)\n end = getMatchingBracket(terms.slice(filt + 2), '(', ')')\n terms.splice(filt, end + 3)\n }\n }\n log.debug('WHERE after filters and optionals: ' + terms)\n extractStatements(terms, pat)\n }\n\n function extractStatements (terms, formula) {\n var arrayZero = new Array(1)\n arrayZero[0] = -1 // this is just to add the beginning of the where to the periods index.\n var per = arrayZero.concat(arrayIndicesOf('.', terms))\n var stat = []\n for (var x = 0; x < per.length - 1; x++) {\n stat[x] = terms.slice(per[x] + 1, per[x + 1])\n }\n // Now it's in an array of statements\n for (x in stat) { // THIS MUST BE CHANGED FOR COMMA, SEMICOLON\n log.info('s+p+o ' + x + ' = ' + stat[x])\n var subj = stat[x][0]\n stat[x].splice(0, 1)\n var sem = arrayZero.concat(arrayIndicesOf(';', stat[x]))\n sem.push(stat[x].length)\n var stat2 = []\n for (var y = 0; y < sem.length - 1; y++) {\n stat2[y] = stat[x].slice(sem[y] + 1, sem[y + 1])\n }\n for (x in stat2) {\n log.info('p+o ' + x + ' = ' + stat[x])\n var pred = stat2[x][0]\n stat2[x].splice(0, 1)\n var com = arrayZero.concat(arrayIndicesOf(',', stat2[x]))\n com.push(stat2[x].length)\n var stat3 = []\n for (y = 0; y < com.length - 1; y++) {\n stat3[y] = stat2[x].slice(com[y] + 1, com[y + 1])\n }\n for (x in stat3) {\n var obj = stat3[x][0]\n log.info('Subj=' + subj + ' Pred=' + pred + ' Obj=' + obj)\n formula.add(subj, pred, obj)\n }\n }\n }\n }\n\n // ******************************* Body of SPARQLToQuery ***************************//\n log.info('SPARQL input: \\n' + SPARQL)\n var q = new Query()\n var sp = tokenize(SPARQL) // first tokenize everything\n var prefixes = getPrefixDeclarations(sp)\n if (!prefixes.rdf) {\n prefixes.rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'\n }\n if (!prefixes.rdfs) {\n prefixes.rdfs = 'http://www.w3.org/2000/01/rdf-schema#'\n }\n var selectLoc = arrayIndexOf('SELECT', sp)\n var whereLoc = arrayIndexOf('WHERE', sp)\n if (selectLoc < 0 || whereLoc < 0 || selectLoc > whereLoc) {\n log.error('Invalid or nonexistent SELECT and WHERE tags in SPARQL query')\n return false\n }\n setVars(sp.slice(selectLoc + 1, whereLoc), q)\n\n setWhere(sp.slice(whereLoc + 2, sp.length - 1), q.pat)\n\n if (testMode) {\n return q\n }\n\n for (var x in q.pat.statements) {\n var st = q.pat.statements[x]\n if (st.subject.termType === 'NamedNode') {\n if (kb.fetcher) {\n kb.fetcher.lookUpThing(st.subject, 'sparql:' + st.subject)\n }\n }\n if (st.object.termType === 'NamedNode') {\n if (kb.fetcher) {\n kb.fetcher.lookUpThing(st.object, 'sparql:' + st.object)\n }\n }\n }\n // alert(q.pat)\n return q\n// checkVars()\n// *******************************************************************//\n}\n","/* @file Update Manager Class\n**\n** 2007-07-15 original SPARQL Update module by Joe Presbrey \n** 2010-08-08 TimBL folded in Kenny's WEBDAV\n** 2010-12-07 TimBL added local file write code\n*/\nimport IndexedFormula from './store'\nimport { docpart, join as uriJoin } from './uri'\nimport Fetcher, { Options } from './fetcher'\nimport Namespace from './namespace'\nimport Serializer from './serializer'\nimport { isBlankNode, isStore } from './utils/terms'\nimport * as Util from './utils-js'\nimport Statement from './statement'\nimport RDFlibNamedNode from './named-node'\nimport { termValue } from './utils/termValue'\nimport { BlankNode, NamedNode, Quad, Quad_Graph, Quad_Object, Quad_Predicate, Quad_Subject, Term, } from './tf-types'\n\ninterface UpdateManagerFormula extends IndexedFormula {\n fetcher: Fetcher\n}\n\ntype CallBackFunction = (uri: string, ok: boolean, message: string, response: Error | Response) => {} | void\n\n/**\n* The UpdateManager is a helper object for a store.\n* Just as a Fetcher provides the store with the ability to read and write,\n* the Update Manager provides functionality for making small patches in real time,\n* and also looking out for concurrent updates from other agents\n*/\nexport default class UpdateManager {\n\n store: UpdateManagerFormula\n\n ifps: {}\n\n fps: {}\n\n /** Index of objects for coordinating incoming and outgoing patches */\n patchControl: []\n\n /** Object of namespaces */\n ns: any\n\n /**\n * @param store - The quadstore to store data and metadata. Created if not passed.\n */\n constructor(store?: IndexedFormula) {\n store = store || new IndexedFormula()\n if (store.updater) {\n throw new Error(\"You can't have two UpdateManagers for the same store\")\n }\n if (!(store as UpdateManagerFormula).fetcher) {\n (store as UpdateManagerFormula).fetcher = new Fetcher(store)\n }\n this.store = store as UpdateManagerFormula\n store.updater = this\n this.ifps = {}\n this.fps = {}\n this.ns = {}\n this.ns.link = Namespace('http://www.w3.org/2007/ont/link#')\n this.ns.http = Namespace('http://www.w3.org/2007/ont/http#')\n this.ns.httph = Namespace('http://www.w3.org/2007/ont/httph#')\n this.ns.ldp = Namespace('http://www.w3.org/ns/ldp#')\n this.ns.rdf = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')\n this.ns.rdfs = Namespace('http://www.w3.org/2000/01/rdf-schema#')\n this.ns.rdf = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')\n this.ns.owl = Namespace('http://www.w3.org/2002/07/owl#')\n\n this.patchControl = []\n }\n\n patchControlFor(doc: NamedNode) {\n if (!this.patchControl[doc.value]) {\n this.patchControl[doc.value] = []\n }\n return this.patchControl[doc.value]\n }\n\n isHttpUri(uri: string) {\n return (uri.slice(0, 4) === 'http')\n }\n\n /** Remove from the store HTTP authorization metadata\n * The editable function below relies on copies we have in the store\n * of the results of previous HTTP transactions. However, when\n * the user logs in, then that data misrepresents what would happen\n * if the user tried again.\n */\n flagAuthorizationMetadata(kb?: IndexedFormula) {\n if (!kb) {\n kb = this.store\n }\n const meta = kb.fetcher?.appNode\n const requests = kb.statementsMatching(undefined, this.ns.link('requestedURI'), undefined, meta).map(st => st.subject)\n for (const request of requests) {\n const response = kb.any(request, this.ns.link('response'), null, meta) as Quad_Subject\n if (response != undefined) { // ts\n kb.add(response, this.ns.link('outOfDate'), true as any, meta) // @@ Boolean is fine - fix types\n }\n }\n }\n\n /**\n * Tests whether a file is editable.\n * If the file has a specific annotation that it is machine written,\n * for safety, it is editable (this doesn't actually check for write access)\n * If the file has wac-allow and accept patch headers, those are respected.\n * and local write access is determined by those headers.\n * This async version not only looks at past HTTP requests, it also makes new ones if necessary.\n *\n * @returns The method string N3PATCH or SPARQL or DAV or\n * LOCALFILE or false if known, undefined if not known.\n */\n async checkEditable(uri: string | NamedNode, kb?: IndexedFormula): Promise {\n if (!uri) {\n return false // Eg subject is bnode, no known doc to write to\n }\n if (!kb) {\n kb = this.store\n }\n\n const initial = this.editable(uri, kb)\n if (initial !== undefined) {\n return initial\n }\n await kb.fetcher?.load(uri)\n const final = this.editable(uri, kb)\n // console.log(`Loaded ${uri} just to check editable, result: ${final}.`)\n return final\n }\n /**\n * Tests whether a file is editable.\n * If the file has a specific annotation that it is machine written,\n * for safety, it is editable (this doesn't actually check for write access)\n * If the file has wac-allow and accept patch headers, those are respected.\n * and local write access is determined by those headers.\n * This synchronous version only looks at past HTTP requests, does not make new ones.\n *\n * @returns The method string SPARQL or DAV or\n * LOCALFILE or false if known, undefined if not known.\n */\n editable(uri: string | NamedNode, kb?: IndexedFormula): string | boolean | undefined {\n if (!uri) {\n return false // Eg subject is bnode, no known doc to write to\n }\n if (!kb) {\n kb = this.store\n }\n uri = termValue(uri)\n\n if (!this.isHttpUri(uri as string)) {\n if (kb.holds(\n kb.rdfFactory.namedNode(uri),\n kb.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),\n kb.rdfFactory.namedNode('http://www.w3.org/2007/ont/link#MachineEditableDocument'))) {\n return 'LOCALFILE'\n }\n }\n\n var request\n var definitive = false\n const meta = kb.fetcher?.appNode\n // const kb = s\n\n // @ts-ignore passes a string to kb.each, which expects a term. Should this work?\n var requests = kb.each(undefined, this.ns.link('requestedURI'), docpart(uri), meta)\n var method: string\n for (var r = 0; r < requests.length; r++) {\n request = requests[r]\n if (request !== undefined) {\n const response = kb.any(request, this.ns.link('response'), null, meta) as Quad_Subject\n if (response !== undefined) { // ts\n\n const outOfDate = kb.anyJS(response, this.ns.link('outOfDate'), null, meta) as Quad_Subject\n if (outOfDate) continue\n\n var wacAllow = kb.anyValue(response, this.ns.httph('wac-allow'))\n if (wacAllow) {\n for (var bit of wacAllow.split(',')) {\n var lr = bit.split('=')\n if (lr[0].includes('user') && !lr[1].includes('write') && !lr[1].includes('append')) {\n // console.log(' editable? excluded by WAC-Allow: ', wacAllow)\n return false\n }\n }\n }\n var acceptPatch = kb.each(response, this.ns.httph('accept-patch'))\n if (acceptPatch.length) {\n for (let i = 0; i < acceptPatch.length; i++) {\n method = acceptPatch[i].value.trim()\n if (method.indexOf('text/n3') >= 0) return 'N3PATCH'\n if (method.indexOf('application/sparql-update') >= 0) return 'SPARQL'\n if (method.indexOf('application/sparql-update-single-match') >= 0) return 'SPARQL'\n }\n }\n var authorVia = kb.each(response, this.ns.httph('ms-author-via'))\n if (authorVia.length) {\n for (let i = 0; i < authorVia.length; i++) {\n method = authorVia[i].value.trim()\n if (method.indexOf('SPARQL') >= 0) {\n return 'SPARQL'\n }\n if (method.indexOf('DAV') >= 0) {\n return 'DAV'\n }\n }\n }\n\n if (!this.isHttpUri(uri as string)) {\n if (!wacAllow) return false;\n else return 'LOCALFILE';\n }\n\n var status = kb.each(response, this.ns.http('status'))\n if (status.length) {\n for (let i = 0; i < status.length; i++) {\n // @ts-ignore since statuses should be TFTerms, this should always be false\n if (status[i] === 200 || status[i] === 404) {\n definitive = true\n // return false // A definitive answer\n }\n }\n }\n } else {\n // console.log('UpdateManager.editable: No response for ' + uri + '\\n')\n }\n }\n }\n if (requests.length === 0) {\n // console.log('UpdateManager.editable: No request for ' + uri + '\\n')\n } else {\n if (definitive) {\n return false // We have got a request and it did NOT say editable => not editable\n }\n }\n // console.log('UpdateManager.editable: inconclusive for ' + uri + '\\n')\n return undefined // We don't know (yet) as we haven't had a response (yet)\n }\n\n anonymize(obj) {\n let anonymized = (obj.toNT().substr(0, 2) === '_:' && this.mentioned(obj))\n ? '?' + obj.toNT().substr(2)\n : obj.toNT();\n\n return anonymized;\n }\n\n anonymizeNT(stmt: Quad) {\n return this.anonymize(stmt.subject) + ' ' +\n this.anonymize(stmt.predicate) + ' ' +\n this.anonymize(stmt.object) + ' .'\n }\n\n nTriples(stmt) {\n return `${stmt.subject.toNT()} ${stmt.predicate.toNT()} ${stmt.object.toNT()} .`\n }\n\n /**\n * Returns a list of all bnodes occurring in a statement\n * @private\n */\n statementBnodes(st: Quad): BlankNode[] {\n return [st.subject, st.predicate, st.object].filter(function (x) {\n return isBlankNode(x)\n }) as BlankNode[]\n }\n\n /**\n * Returns a list of all bnodes occurring in a list of statements\n * @private\n */\n statementArrayBnodes(sts: ReadonlyArray) {\n var bnodes: BlankNode[] = []\n for (let i = 0; i < sts.length; i++) {\n bnodes = bnodes.concat(this.statementBnodes(sts[i]))\n }\n bnodes.sort() // in place sort - result may have duplicates\n var bnodes2: BlankNode[] = []\n for (let j = 0; j < bnodes.length; j++) {\n if (j === 0 || !bnodes[j].equals(bnodes[j - 1])) {\n bnodes2.push(bnodes[j])\n }\n }\n return bnodes2\n }\n\n /**\n * Makes a cached list of [Inverse-]Functional properties\n * @private\n */\n cacheIfps() {\n this.ifps = {}\n var a = this.store.each(undefined, this.ns.rdf('type'),\n this.ns.owl('InverseFunctionalProperty'))\n for (let i = 0; i < a.length; i++) {\n this.ifps[a[i].value] = true\n }\n this.fps = {}\n a = this.store.each(undefined, this.ns.rdf('type'), this.ns.owl('FunctionalProperty'))\n for (let i = 0; i < a.length; i++) {\n this.fps[a[i].value] = true\n }\n }\n\n /**\n * Returns a context to bind a given node, up to a given depth\n * @private\n */\n bnodeContext2(x, source, depth) {\n // Return a list of statements which indirectly identify a node\n // Depth > 1 if try further indirection.\n // Return array of statements (possibly empty), or null if failure\n var sts = this.store.statementsMatching(undefined, undefined, x, source) // incoming links\n var y\n var res\n for (let i = 0; i < sts.length; i++) {\n if (this.fps[sts[i].predicate.value]) {\n y = sts[i].subject\n if (!y.isBlank) {\n return [sts[i]]\n }\n if (depth) {\n res = this.bnodeContext2(y, source, depth - 1)\n if (res) {\n return res.concat([sts[i]])\n }\n }\n }\n }\n // outgoing links\n sts = this.store.statementsMatching(x, undefined, undefined, source)\n for (let i = 0; i < sts.length; i++) {\n if (this.ifps[sts[i].predicate.value]) {\n y = sts[i].object\n if (!y.isBlank) {\n return [sts[i]]\n }\n if (depth) {\n res = this.bnodeContext2(y, source, depth - 1)\n if (res) {\n return res.concat([sts[i]])\n }\n }\n }\n }\n return null // Failure\n }\n\n /**\n * Returns the smallest context to bind a given single bnode\n * @private\n */\n bnodeContext1(x, source) {\n // Return a list of statements which indirectly identify a node\n // Breadth-first\n for (var depth = 0; depth < 3; depth++) { // Try simple first\n var con = this.bnodeContext2(x, source, depth)\n if (con !== null) return con\n }\n // If we can't guarantee unique with logic just send all info about node\n return this.store.connectedStatements(x, source) // was:\n // throw new Error('Unable to uniquely identify bnode: ' + x.toNT())\n }\n\n /**\n * @private\n */\n mentioned(x) {\n return this.store.statementsMatching(x, null, null, null).length !== 0 || // Don't pin fresh bnodes\n this.store.statementsMatching(null, x).length !== 0 ||\n this.store.statementsMatching(null, null, x).length !== 0\n }\n\n /**\n * @private\n */\n bnodeContext(bnodes, doc) {\n var context = []\n if (bnodes.length) {\n this.cacheIfps()\n for (let i = 0; i < bnodes.length; i++) { // Does this occur in old graph?\n var bnode = bnodes[i]\n if (!this.mentioned(bnode)) continue\n context = context.concat(this.bnodeContext1(bnode, doc))\n }\n }\n return context\n }\n\n /**\n * Returns the best context for a single statement\n * @private\n */\n statementContext(st: Quad) {\n var bnodes = this.statementBnodes(st)\n return this.bnodeContext(bnodes, st.graph)\n }\n\n /**\n * @private\n */\n contextWhere(context) {\n var updater = this\n return (!context || context.length === 0)\n ? ''\n : 'WHERE { ' +\n context.map(function (x) {\n return updater.anonymizeNT(x)\n }).join('\\n') + ' }\\n'\n }\n\n /**\n * @private\n */\n fire(\n uri: string,\n query: string,\n callbackFunction: CallBackFunction,\n options: Options = {}\n ): Promise {\n return Promise.resolve()\n .then(() => {\n if (!uri) {\n throw new Error('No URI given for remote editing operation: ' + query)\n }\n // console.log('UpdateManager: sending update to <' + uri + '>')\n\n options.noMeta = true;\n options.contentType = options.contentType || 'application/sparql-update';\n options.body = query;\n\n return this.store.fetcher.webOperation('PATCH', uri, options)\n })\n .then(response => {\n if (!response.ok) {\n let message = 'UpdateManager: update failed for <' + uri + '> status=' +\n response.status + ', ' + response.statusText +\n '\\n for query: ' + query\n // console.log(message)\n throw new Error(message)\n }\n\n // console.log('UpdateManager: update Ok for <' + uri + '>')\n\n callbackFunction(uri, response.ok, response.responseText as string, response)\n })\n .catch(err => {\n callbackFunction(uri, false, err.message, err)\n })\n }\n\n // ARE THESE THREE FUNCTIONS USED? DEPRECATE?\n\n /** return a statemnet updating function\n *\n * This does NOT update the statement.\n * It returns an object which includes\n * function which can be used to change the object of the statement.\n */\n update_statement(statement: Quad) {\n if (statement && !statement.graph) {\n return\n }\n var updater = this\n var context = this.statementContext(statement)\n\n return {\n statement: statement ? [statement.subject, statement.predicate, statement.object, statement.graph] : undefined,\n statementNT: statement ? this.anonymizeNT(statement) : undefined,\n where: updater.contextWhere(context),\n\n set_object: function (obj, callbackFunction) {\n var query = this.where\n query += 'DELETE DATA { ' + this.statementNT + ' } ;\\n'\n query += 'INSERT DATA { ' +\n // @ts-ignore `this` might refer to the wrong scope. Does this work?\n this.anonymize(this.statement[0]) + ' ' +\n // @ts-ignore\n this.anonymize(this.statement[1]) + ' ' +\n // @ts-ignore\n this.anonymize(obj) + ' ' + ' . }\\n'\n\n updater.fire((this.statement as [Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph])[3].value, query, callbackFunction)\n }\n }\n }\n\n insert_statement(st: Quad, callbackFunction: CallBackFunction): void {\n var st0 = st instanceof Array ? st[0] : st\n var query = this.contextWhere(this.statementContext(st0))\n\n if (st instanceof Array) {\n var stText = ''\n for (let i = 0; i < st.length; i++) stText += st[i] + '\\n'\n query += 'INSERT DATA { ' + stText + ' }\\n'\n } else {\n query += 'INSERT DATA { ' +\n this.anonymize(st.subject) + ' ' +\n this.anonymize(st.predicate) + ' ' +\n this.anonymize(st.object) + ' ' + ' . }\\n'\n }\n\n this.fire(st0.graph.value, query, callbackFunction)\n }\n\n delete_statement(st: Quad | Quad[], callbackFunction: CallBackFunction): void {\n var st0 = st instanceof Array ? st[0] : st\n var query = this.contextWhere(this.statementContext(st0))\n\n if (st instanceof Array) {\n var stText = ''\n for (let i = 0; i < st.length; i++) stText += st[i] + '\\n'\n query += 'DELETE DATA { ' + stText + ' }\\n'\n } else {\n query += 'DELETE DATA { ' +\n this.anonymize(st.subject) + ' ' +\n this.anonymize(st.predicate) + ' ' +\n this.anonymize(st.object) + ' ' + ' . }\\n'\n }\n\n this.fire(st0.graph.value, query, callbackFunction)\n }\n\n /// //////////////////////\n\n /**\n * Requests a now or future action to refresh changes coming downstream\n * This is designed to allow the system to re-request the server version,\n * when a websocket has pinged to say there are changes.\n * If the websocket, by contrast, has sent a patch, then this may not be necessary.\n *\n * @param doc\n * @param action\n */\n requestDownstreamAction(doc: NamedNode, action): void {\n var control = this.patchControlFor(doc)\n if (!control.pendingUpstream) {\n action(doc)\n } else {\n if (control.downstreamAction) {\n if ('' + control.downstreamAction !== '' + action) { // Kludge compare\n throw new Error(\"Can't wait for > 1 different downstream actions\")\n }\n } else {\n control.downstreamAction = action\n }\n }\n }\n\n /**\n * We want to start counting websocket notifications\n * to distinguish the ones from others from our own.\n */\n clearUpstreamCount(doc: NamedNode): void {\n var control = this.patchControlFor(doc)\n control.upstreamCount = 0\n }\n\n getUpdatesVia(doc: NamedNode): string | null {\n var linkHeaders = this.store.fetcher.getHeader(doc, 'updates-via')\n if (!linkHeaders || !linkHeaders.length) return null\n return linkHeaders[0].trim()\n }\n\n addDownstreamChangeListener(doc: NamedNode, listener): void {\n var control = this.patchControlFor(doc)\n if (!control.downstreamChangeListeners) { control.downstreamChangeListeners = [] }\n control.downstreamChangeListeners.push(listener)\n this.setRefreshHandler(doc, (doc: NamedNode) => {\n this.reloadAndSync(doc)\n })\n }\n\n reloadAndSync(doc: NamedNode): void {\n var control = this.patchControlFor(doc)\n var updater = this\n\n if (control.reloading) {\n // console.log(' Already reloading - note this load may be out of date')\n control.outOfDate = true\n return // once only needed @@ Not true, has changed again\n }\n control.reloading = true\n var retryTimeout = 1000 // ms\n var tryReload = function () {\n // console.log('try reload - timeout = ' + retryTimeout)\n updater.reload(updater.store, doc, function (ok, message, response) {\n if (ok) {\n if (control.downstreamChangeListeners) {\n for (let i = 0; i < control.downstreamChangeListeners.length; i++) {\n // console.log(' Calling downstream listener ' + i)\n control.downstreamChangeListeners[i]()\n }\n }\n control.reloading = false\n if (control.outOfDate) {\n // console.log(' Extra reload because of extra update.')\n control.outOfDate = false\n tryReload()\n }\n } else {\n control.reloading = false\n if (response && (response as Response).status === 0) {\n // console.log('Network error refreshing the data. Retrying in ' +\n // retryTimeout / 1000)\n control.reloading = true\n retryTimeout = retryTimeout * 2\n setTimeout(tryReload, retryTimeout)\n } else {\n // console.log('Error ' + (response as Response).status + 'refreshing the data:' +\n // message + '. Stopped' + doc)\n }\n }\n })\n }\n tryReload()\n }\n\n /**\n * Sets up websocket to listen on\n *\n * There is coordination between upstream changes and downstream ones\n * so that a reload is not done in the middle of an upstream patch.\n * If you use this API then you get called when a change happens, and you\n * have to reload the file yourself, and then refresh the UI.\n * Alternative is addDownstreamChangeListener(), where you do not\n * have to do the reload yourself. Do mot mix them.\n *\n * kb contains the HTTP metadata from previous operations\n *\n * @param doc\n * @param handler\n *\n * @returns {boolean}\n */\n setRefreshHandler(doc: NamedNode, handler): boolean {\n let wssURI = this.getUpdatesVia(doc) // relative\n // var kb = this.store\n var theHandler = handler\n var self = this\n var updater = this\n var retryTimeout = 1500 // *2 will be 3 Seconds, 6, 12, etc\n var retries = 0\n\n if (!wssURI) {\n // console.log('Server does not support live updates through Updates-Via :-(')\n return false\n }\n\n wssURI = uriJoin(wssURI, doc.value)\n const validWssURI = wssURI.replace(/^http:/, 'ws:').replace(/^https:/, 'wss:')\n // console.log('Web socket URI ' + wssURI)\n\n var openWebsocket = function () {\n // From https://github.com/solid/solid-spec#live-updates\n var socket\n if (typeof WebSocket !== 'undefined') {\n socket = new WebSocket(validWssURI)\n } else if (typeof window !== 'undefined' && window.WebSocket) {\n socket = (window as any).WebSocket(validWssURI)\n } else {\n // console.log('Live update disabled, as WebSocket not supported by platform :-(')\n return\n }\n socket.onopen = function () {\n // console.log(' websocket open')\n retryTimeout = 1500 // reset timeout to fast on success\n this.send('sub ' + doc.value)\n if (retries) {\n // console.log('Web socket has been down, better check for any news.')\n updater.requestDownstreamAction(doc, theHandler)\n }\n }\n var control = self.patchControlFor(doc)\n control.upstreamCount = 0\n\n socket.onerror = function onerror(err: Error) {\n // console.log('Error on Websocket:', err)\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent\n //\n // 1000 CLOSE_NORMAL Normal closure; the connection successfully completed whatever purpose for which it was created.\n // 1001 CLOSE_GOING_AWAY The endpoint is going away, either\n // because of a server failure or because the browser is navigating away from the page that opened the connection.\n // 1002 CLOSE_PROTOCOL_ERROR The endpoint is terminating the connection due to a protocol error.\n // 1003 CLOSE_UNSUPPORTED The connection is being terminated because the endpoint\n // received data of a type it cannot accept (for example, a text-only endpoint received binary data).\n // 1004 Reserved. A meaning might be defined in the future.\n // 1005 CLOSE_NO_STATUS Reserved. Indicates that no status code was provided even though one was expected.\n // 1006 CLOSE_ABNORMAL Reserved. Used to indicate that a connection was closed abnormally (\n //\n //\n socket.onclose = function (event: CloseEvent) {\n // console.log('*** Websocket closed with code ' + event.code +\n // \", reason '\" + event.reason + \"' clean = \" + event.wasClean)\n retryTimeout *= 2\n retries += 1\n // console.log('Retrying in ' + retryTimeout + 'ms') // (ask user?)\n setTimeout(function () {\n // console.log('Trying websocket again')\n openWebsocket()\n }, retryTimeout)\n }\n socket.onmessage = function (msg: MessageEvent) {\n if (msg.data && msg.data.slice(0, 3) === 'pub') {\n if ('upstreamCount' in control) {\n control.upstreamCount -= 1\n if (control.upstreamCount >= 0) {\n // console.log('just an echo: ' + control.upstreamCount)\n return // Just an echo\n }\n }\n // console.log('Assume a real downstream change: ' + control.upstreamCount + ' -> 0')\n control.upstreamCount = 0\n self.requestDownstreamAction(doc, theHandler)\n }\n }\n } // openWebsocket\n openWebsocket()\n\n return true\n }\n\n /**\n * This high-level function updates the local store iff the web is changed successfully.\n * Deletions, insertions may be undefined or single statements or lists or formulae (may contain bnodes which can be indirectly identified by a where clause).\n * The `why` property of each statement must be the give the web document to be updated.\n * The statements to be deleted and inserted may span more than one web document.\n * @param deletions - Statement or statements to be deleted.\n * @param insertions - Statement or statements to be inserted.\n * @returns a promise\n */\n updateMany(\n deletions: ReadonlyArray,\n insertions: ReadonlyArray = []\n ): Promise {\n const docs = deletions.concat(insertions).map(st => st.why)\n const thisUpdater = this\n const uniqueDocs: Array = []\n docs.forEach(doc => {\n if (!uniqueDocs.find(uniqueDoc => uniqueDoc.equals(doc))) uniqueDocs.push(doc as NamedNode)\n })\n const updates = uniqueDocs.map(doc =>\n thisUpdater.update(deletions.filter(st => st.why.equals(doc)),\n insertions.filter(st => st.why.equals(doc))))\n if (updates.length > 1) {\n // console.log(`@@ updateMany to ${updates.length}: ${uniqueDocs}`)\n }\n return Promise.all(updates)\n }\n\n /**\n * @private\n * \n * This helper function constructs SPARQL Update query from resolved arguments.\n * \n * @param ds: deletions array.\n * @param is: insertions array.\n * @param bnodes_context: Additional context to uniquely identify any blank nodes.\n */\n constructSparqlUpdateQuery(\n ds: ReadonlyArray,\n is: ReadonlyArray,\n bnodes_context,\n ): string {\n var whereClause = this.contextWhere(bnodes_context)\n var query = ''\n if (whereClause.length) { // Is there a WHERE clause?\n if (ds.length) {\n query += 'DELETE { '\n for (let i = 0; i < ds.length; i++) {\n query += this.anonymizeNT(ds[i]) + '\\n'\n }\n query += ' }\\n'\n }\n if (is.length) {\n query += 'INSERT { '\n for (let i = 0; i < is.length; i++) {\n query += this.anonymizeNT(is[i]) + '\\n'\n }\n query += ' }\\n'\n }\n query += whereClause\n } else { // no where clause\n if (ds.length) {\n query += 'DELETE DATA { '\n for (let i = 0; i < ds.length; i++) {\n query += this.anonymizeNT(ds[i]) + '\\n'\n }\n query += ' } \\n'\n }\n if (is.length) {\n if (ds.length) query += ' ; '\n query += 'INSERT DATA { '\n for (let i = 0; i < is.length; i++) {\n query += this.nTriples(is[i]) + '\\n'\n }\n query += ' }\\n'\n }\n }\n return query;\n }\n\n /**\n * @private\n * \n * This helper function constructs n3-patch query from resolved arguments.\n * \n * @param ds: deletions array.\n * @param is: insertions array.\n * @param bnodes_context: Additional context to uniquely identify any blanknodes.\n */\n constructN3PatchQuery(\n ds: ReadonlyArray,\n is: ReadonlyArray,\n bnodes_context,\n ): string {\n var query = `\n@prefix solid: .\n@prefix ex: .\n\n_:patch\n`;\n // If bnode context is non trivial, express it as ?conditions formula.\n if (bnodes_context && bnodes_context.length > 0) {\n query += `\n solid:where {\n ${bnodes_context.map((x) => this.anonymizeNT(x)).join('\\n ')}\n };`\n }\n if (ds.length > 0) {\n query += `\n solid:deletes {\n ${ds.map((x) => this.anonymizeNT(x)).join('\\n ')}\n };`\n }\n if (is.length > 0) {\n query += `\n solid:inserts {\n ${is.map((x) => this.anonymizeNT(x)).join('\\n ')}\n };`\n }\n query += \" a solid:InsertDeletePatch .\\n\"\n\n return query;\n }\n\n /**\n * This high-level function updates the local store if the web is changed successfully.\n * Deletions, insertions may be undefined or single statements or lists or formulae (may contain bnodes which can be indirectly identified by a where clause).\n * The `why` property of each statement must be the same and give the web document to be updated.\n * @param deletions - Statement or statements to be deleted.\n * @param insertions - Statement or statements to be inserted.\n * @param callback - called as callbackFunction(uri, success, errorbody)\n * OR returns a promise\n * @param options - Options for the fetch call\n */\n update(\n deletions: ReadonlyArray,\n insertions: ReadonlyArray,\n callback?: (\n uri: string | undefined | null,\n success: boolean,\n errorBody?: string,\n response?: Response | Error\n ) => void,\n secondTry?: boolean,\n options: Options = {}\n ): void | Promise {\n if (!callback) {\n var thisUpdater = this\n return new Promise(function (resolve, reject) { // Promise version\n thisUpdater.update(deletions, insertions, function (uri, ok, errorBody) {\n if (!ok) {\n reject(new Error(errorBody))\n } else {\n resolve()\n }\n }, secondTry, options) // callbackFunction\n }) // promise\n } // if\n\n try {\n var kb = this.store\n var ds = !deletions ? []\n : isStore(deletions) ? deletions.statements\n : deletions instanceof Array ? deletions : [deletions]\n var is = !insertions ? []\n : isStore(insertions) ? insertions.statements\n : insertions instanceof Array ? insertions : [insertions]\n if (!(ds instanceof Array)) {\n throw new Error('Type Error ' + (typeof ds) + ': ' + ds)\n }\n if (!(is instanceof Array)) {\n throw new Error('Type Error ' + (typeof is) + ': ' + is)\n }\n if (ds.length === 0 && is.length === 0) {\n return callback(null, true) // success -- nothing needed to be done.\n }\n var doc = ds.length ? ds[0].graph : is[0].graph\n if (!doc) {\n let message = 'Error patching: statement does not specify which document to patch:' + ds[0] + ', ' + is[0]\n // console.log(message)\n throw new Error(message)\n }\n if (doc.termType !== 'NamedNode') {\n let message = 'Error patching: document not a NamedNode:' + ds[0] + ', ' + is[0]\n // console.log(message)\n throw new Error(message)\n }\n var control = this.patchControlFor(doc)\n\n var startTime = Date.now()\n\n var props = ['subject', 'predicate', 'object', 'why']\n var verbs = ['insert', 'delete']\n var clauses = { 'delete': ds, 'insert': is }\n verbs.map(function (verb) {\n clauses[verb].map(function (st: Quad) {\n if (!doc.equals(st.graph)) {\n throw new Error('update: destination ' + doc +\n ' inconsistent with delete quad ' + st.graph)\n }\n props.map(function (prop) {\n if (typeof st[prop] === 'undefined') {\n throw new Error('update: undefined ' + prop + ' of statement.')\n }\n })\n })\n })\n\n var protocol = this.editable(doc.value, kb);\n\n if (protocol === false) {\n throw new Error('Update: Can\\'t make changes in uneditable ' + doc)\n }\n if (protocol === undefined) { // Not enough metadata\n if (secondTry) {\n throw new Error('Update: Loaded ' + doc + \"but still can't figure out what editing protocol it supports.\")\n }\n // console.log(`Update: have not loaded ${doc} before: loading now...`);\n (this.store.fetcher.load(doc as NamedNode) as Promise).then(response => {\n this.update(deletions, insertions, callback, true, options)\n }, err => {\n if (err.response.status === 404) { // nonexistent files are fine\n this.update(deletions, insertions, callback, true, options)\n } else {\n throw new Error(`Update: Can't get updatability status ${doc} before patching: ${err}`)\n }\n })\n return\n } else if ((protocol as string).indexOf('SPARQL') >= 0 || (protocol as string).indexOf('N3PATCH') >= 0) {\n var isSparql = (protocol as string).indexOf('SPARQL') >= 0\n\n var bnodes: BlankNode[] = []\n // change ReadOnly type to Mutable type\n type Mutable = {\n -readonly [Key in keyof Type]: Type[Key];\n }\n\n if (ds.length) bnodes = this.statementArrayBnodes(ds as Mutable)\n if (is.length) bnodes = bnodes.concat(this.statementArrayBnodes(is as Mutable))\n var context = this.bnodeContext(bnodes, doc)\n\n var query = isSparql ? this.constructSparqlUpdateQuery(ds, is, context) : this.constructN3PatchQuery(ds, is, context);\n options.contentType = isSparql ? 'application/sparql-update' : 'text/n3' \n \n // Track pending upstream patches until they have finished their callbackFunction\n control.pendingUpstream = control.pendingUpstream ? control.pendingUpstream + 1 : 1\n if ('upstreamCount' in control) {\n control.upstreamCount += 1 // count changes we originated ourselves\n // console.log('upstream count up to : ' + control.upstreamCount)\n }\n\n this.fire(doc.value, query, (uri, success, body, response) => {\n (response as any).elapsedTimeMs = Date.now() - startTime\n /* console.log(' UpdateManager: Return ' +\n (success ? 'success ' : 'FAILURE ') + (response as Response).status +\n ' elapsed ' + (response as any).elapsedTimeMs + 'ms')\n */\n if (success) {\n try {\n kb.remove(ds as Mutable)\n } catch (e) {\n success = false\n body = 'Remote Ok BUT error deleting ' + ds.length + ' from store!!! ' + e\n } // Add in any case -- help recover from weirdness??\n for (let i = 0; i < is.length; i++) {\n kb.add(is[i].subject, is[i].predicate, is[i].object, doc)\n }\n }\n\n callback(uri, success, body, response)\n control.pendingUpstream -= 1\n // When upstream patches have been sent, reload state if downstream waiting\n if (control.pendingUpstream === 0 && control.downstreamAction) {\n var downstreamAction = control.downstreamAction\n delete control.downstreamAction\n // console.log('delayed downstream action:')\n downstreamAction(doc)\n }\n }, options)\n } else if ((protocol as string).indexOf('DAV') >= 0) {\n this.updateDav(doc as NamedNode, ds, is, callback, options)\n } else {\n if ((protocol as string).indexOf('LOCALFILE') >= 0) {\n try {\n this.updateLocalFile(doc as NamedNode, ds, is, callback, options)\n } catch (e) {\n callback(doc.value, false,\n 'Exception trying to write back file <' + doc.value + '>\\n'\n // + tabulator.Util.stackString(e))\n )\n }\n } else {\n throw new Error(\"Unhandled edit method: '\" + protocol + \"' for \" + doc)\n }\n }\n } catch (e) {\n callback(undefined, false, 'Exception in update: ' + e + '\\n' +\n Util.stackString(e))\n }\n }\n\n updateDav(\n doc: Quad_Subject,\n ds,\n is,\n callbackFunction,\n options: Options = {}\n ): null | Promise {\n let kb = this.store\n // The code below is derived from Kenny's UpdateCenter.js\n var request = kb.any(doc, this.ns.link('request'))\n if (!request) {\n throw new Error('No record of our HTTP GET request for document: ' +\n doc)\n } // should not happen\n var response = kb.any(request as NamedNode, this.ns.link('response')) as Quad_Subject\n if (!response) {\n return null // throw \"No record HTTP GET response for document: \"+doc\n }\n var contentType = (kb.the(response, this.ns.httph('content-type')) as Term).value\n\n // prepare contents of revised document\n let newSts = kb.statementsMatching(undefined, undefined, undefined, doc).slice() // copy!\n for (let i = 0; i < ds.length; i++) {\n Util.RDFArrayRemove(newSts, ds[i])\n }\n for (let i = 0; i < is.length; i++) {\n newSts.push(is[i])\n }\n\n const documentString = this.serialize(doc.value, newSts, contentType)\n\n // Write the new version back\n var candidateTarget = kb.the(response, this.ns.httph('content-location'))\n var targetURI\n if (candidateTarget) {\n targetURI = uriJoin(candidateTarget.value, targetURI)\n }\n\n options.contentType = contentType\n options.noMeta = true\n options.body = documentString\n\n return kb.fetcher.webOperation('PUT', targetURI, options)\n .then(response => {\n if (!response.ok) {\n throw new Error(response.error)\n }\n\n for (let i = 0; i < ds.length; i++) {\n kb.remove(ds[i])\n }\n for (let i = 0; i < is.length; i++) {\n kb.add(is[i].subject, is[i].predicate, is[i].object, doc)\n }\n\n callbackFunction(doc.value, response.ok, response.responseText, response)\n })\n .catch(err => {\n callbackFunction(doc.value, false, err.message, err)\n })\n }\n\n /**\n * Likely deprecated, since this lib no longer deals with browser extension\n *\n * @param doc\n * @param ds\n * @param is\n * @param callbackFunction\n * @param options\n */\n updateLocalFile(doc: NamedNode, ds, is, callbackFunction, options: Options = {}): void {\n const kb = this.store\n // console.log('Writing back to local file\\n')\n\n // prepare contents of revised document\n let newSts = kb.statementsMatching(undefined, undefined, undefined, doc).slice() // copy!\n\n for (let i = 0; i < ds.length; i++) {\n Util.RDFArrayRemove(newSts, ds[i])\n }\n for (let i = 0; i < is.length; i++) {\n newSts.push(is[i])\n }\n // serialize to the appropriate format\n var dot = doc.value.lastIndexOf('.')\n if (dot < 1) {\n throw new Error('Rewriting file: No filename extension: ' + doc.value)\n }\n var ext = doc.value.slice(dot + 1)\n\n let contentType = Fetcher.CONTENT_TYPE_BY_EXT[ext]\n if (!contentType) {\n throw new Error('File extension .' + ext + ' not supported for data write')\n }\n\n options.body = this.serialize(doc.value, newSts, contentType);\n options.contentType = contentType;\n\n kb.fetcher.webOperation('PUT', doc.value, options).then((response) => {\n if (!response.ok) return callbackFunction(doc.value, false, response.error)\n for (let i = 0; i < ds.length; i++) {\n kb.remove(ds[i]);\n }\n for (let i = 0; i < is.length; i++) {\n kb.add(is[i].subject, is[i].predicate, is[i].object, doc);\n }\n callbackFunction(doc.value, true, '') // success!\n })\n }\n\n /**\n * @throws {Error} On unsupported content type\n *\n * @returns {string}\n */\n serialize(uri: string, data: string | Quad[], contentType: string): string {\n const kb = this.store\n let documentString\n\n if (typeof data === 'string') {\n return data\n }\n\n // serialize to the appropriate format\n var sz = Serializer(kb)\n sz.suggestNamespaces(kb.namespaces)\n sz.setBase(uri)\n switch (contentType) {\n case 'text/xml':\n case 'application/rdf+xml':\n documentString = sz.statementsToXML(data)\n break\n case 'text/n3':\n case 'text/turtle':\n case 'application/x-turtle': // Legacy\n case 'application/n3': // Legacy\n documentString = sz.statementsToN3(data)\n break\n default:\n throw new Error('Content-type ' + contentType +\n ' not supported for data serialization')\n }\n\n return documentString\n }\n\n /**\n * This is suitable for an initial creation of a document.\n */\n put(\n doc: RDFlibNamedNode,\n data: string | Quad[],\n contentType: string,\n callback: (uri: string, ok: boolean, errorMessage?: string, response?: unknown) => void,\n ): Promise {\n const kb = this.store\n let documentString: string\n\n return Promise.resolve()\n .then(() => {\n documentString = this.serialize(doc.value, data, contentType)\n\n return kb.fetcher\n .webOperation('PUT', doc.value, { contentType, body: documentString })\n })\n .then(response => {\n if (!response.ok) {\n return callback(doc.value, response.ok, response.error, response)\n }\n\n delete kb.fetcher.nonexistent[doc.value]\n delete kb.fetcher.requested[doc.value] // @@ could this mess with the requested state machine? if a fetch is in progress\n\n if (typeof data !== 'string') {\n data.map((st) => {\n kb.addStatement(st)\n })\n }\n\n callback(doc.value, response.ok, '', response)\n })\n .catch(err => {\n callback(doc.value, false, err.message)\n })\n }\n\n /**\n * Reloads a document.\n *\n * Fast and cheap, no metadata. Measure times for the document.\n * Load it provisionally.\n * Don't delete the statements before the load, or it will leave a broken\n * document in the meantime.\n *\n * @param kb\n * @param doc {RDFlibNamedNode}\n * @param callbackFunction\n */\n reload(\n kb: IndexedFormula,\n doc: docReloadType,\n callbackFunction: (ok: boolean, message?: string, response?: Error | Response) => {} | void\n ): void {\n var startTime = Date.now()\n // force sets no-cache and\n const options = {\n force: true,\n noMeta: true,\n clearPreviousData: true,\n };\n\n (kb as any).fetcher.nowOrWhenFetched(doc.value, options, function (ok: boolean, body: Body, response: Response) {\n if (!ok) {\n // console.log(' ERROR reloading data: ' + body)\n callbackFunction(false, 'Error reloading data: ' + body, response)\n //@ts-ignore Where does onErrorWasCalled come from?\n } else if (response.onErrorWasCalled || response.status !== 200) {\n // console.log(' Non-HTTP error reloading data! onErrorWasCalled=' +\n //@ts-ignore Where does onErrorWasCalled come from?\n // response.onErrorWasCalled + ' status: ' + response.status)\n callbackFunction(false, 'Non-HTTP error reloading data: ' + body, response)\n } else {\n var elapsedTimeMs = Date.now() - startTime\n\n if (!doc.reloadTimeTotal) doc.reloadTimeTotal = 0\n if (!doc.reloadTimeCount) doc.reloadTimeCount = 0\n\n doc.reloadTimeTotal += elapsedTimeMs\n doc.reloadTimeCount += 1\n\n // console.log(' Fetch took ' + elapsedTimeMs + 'ms, av. of ' +\n // doc.reloadTimeCount + ' = ' +\n // (doc.reloadTimeTotal / doc.reloadTimeCount) + 'ms.')\n\n callbackFunction(true)\n }\n })\n }\n}\n\ninterface docReloadType extends NamedNode {\n reloadTimeCount?: number\n reloadTimeTotal?: number\n}\n","import {\n IRDFlibDataFactory,\n} from '../types'\nimport Literal from '../literal'\nimport Statement from '../statement'\nimport IndexedFormula from '../store'\nimport Fetcher from '../fetcher'\nimport ExtendedTermFactory from './extended-term-factory'\nimport { NamedNode, Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph } from '../tf-types'\n\n/** Full RDFLib.js Data Factory */\nconst RDFlibDataFactory: IRDFlibDataFactory = {\n ...ExtendedTermFactory,\n\n /**\n * Creates a new fetcher\n * @param store - The store to use\n * @param options - The options\n */\n fetcher (store: IndexedFormula, options: any): Fetcher {\n return new Fetcher(store, options)\n },\n\n /**\n * Creates a new graph (store)\n */\n graph (features = undefined, opts = undefined): IndexedFormula {\n return new IndexedFormula(features, opts || {rdfFactory: ExtendedTermFactory})\n },\n\n /**\n * Creates a new literal node\n * @param val The lexical value\n * @param lang The language\n * @param dt The datatype\n */\n lit (val: string, lang?: string, dt?: NamedNode): Literal {\n return this.literal('' + val, lang || dt)\n },\n\n /**\n * Creates a new statement\n * @param subject The subject\n * @param predicate The predicate\n * @param object The object\n * @param graph The containing graph\n */\n st (\n subject: Quad_Subject,\n predicate: Quad_Predicate,\n object: Quad_Object,\n graph?: Quad_Graph\n ): Statement {\n return this.quad(subject, predicate, object, graph)\n },\n}\n\nexport default RDFlibDataFactory\n","/*\n * Updates-Via\n */\nimport DataFactory from './factories/rdflib-data-factory'\n\nexport class UpdatesSocket {\n constructor (parent, via) {\n this.parent = parent\n this.via = via\n this.connected = false\n this.pending = {}\n this.subscribed = {}\n this.socket = {}\n try {\n this.socket = new WebSocket(via)\n this.socket.onopen = this.onOpen\n this.socket.onclose = this.onClose\n this.socket.onmessage = this.onMessage\n this.socket.onerror = this.onError\n } catch (error) {\n this.onError(error)\n }\n }\n _decode (q) {\n var elt\n var i\n var k\n var r\n var ref\n var ref1\n var v\n r = {}\n ref = (function () {\n var j, len, ref, results\n ref = q.split('&')\n results = []\n for (j = 0, len = ref.length; j < len; j++) {\n elt = ref[j]\n results.push(elt.split('='))\n }\n return results\n })()\n for (i in ref) {\n elt = ref[i]\n ref1 = [decodeURIComponent(elt[0]), decodeURIComponent(elt[1])]\n k = ref1[0]\n v = ref1[1]\n if (r[k] == null) {\n r[k] = []\n }\n r[k].push(v)\n }\n return r\n }\n _send (method, uri, data) {\n var base, message\n message = [method, uri, data].join(' ')\n return typeof (base = this.socket).send === 'function' ? base.send(message) : void 0\n }\n _subscribe (uri) {\n this._send('sub', uri, '')\n this.subscribed[uri] = true\n return this.subscribed[uri]\n }\n onClose (e) {\n var uri\n this.connected = false\n for (uri in this.subscribed) {\n this.pending[uri] = true\n }\n this.subscribed = {}\n return this.subscribed\n }\n onError (e) {\n throw new Error('onError' + e)\n }\n onMessage (e) {\n var base, message\n message = e.data.split(' ')\n if (message[0] === 'ping') {\n return typeof (base = this.socket).send === 'function' ? base.send('pong ' + message.slice(1).join(' ')) : void 0\n } else if (message[0] === 'pub') {\n return this.parent.onUpdate(message[1], this._decode(message[2]))\n }\n }\n onOpen (e) {\n var results, uri\n this.connected = true\n results = []\n for (uri in this.pending) {\n delete this.pending[uri]\n results.push(this._subscribe(uri))\n }\n return results\n }\n subscribe (uri) {\n if (this.connected) {\n return this._subscribe(uri)\n } else {\n this.pending[uri] = true\n return this.pending[uri]\n }\n }\n}\n\nexport class UpdatesVia {\n constructor (fetcher) {\n this.fetcher = fetcher\n this.graph = {}\n this.via = {}\n this.fetcher.addCallback('headers', this.onHeaders)\n }\n onHeaders (d) {\n var etag, uri, via\n if (d.headers == null) {\n return true\n }\n if (typeof WebSocket === 'undefined' || WebSocket === null) {\n return true\n }\n etag = d.headers['etag']\n via = d.headers['updates-via']\n uri = d.uri\n if (etag && via) {\n this.graph[uri] = {\n etag: etag,\n via: via\n }\n this.register(via, uri)\n }\n return true\n }\n onUpdate (uri, d) {\n return this.fetcher.refresh(DataFactory.namedNode(uri))\n }\n register (via, uri) {\n if (this.via[via] == null) {\n this.via[via] = new UpdatesSocket(this, via)\n }\n return this.via[via].subscribe(uri)\n }\n}\n","import { IRDFlibDataFactory } from './types'\n\nimport BlankNode from './blank-node'\nimport Collection from './collection'\nimport Empty from './empty'\nimport Fetcher from './fetcher'\nimport Formula from './formula'\nimport Store from './store'\nimport jsonParser from './jsonparser'\nimport Literal from './literal'\nimport log from './log'\nimport N3Parser from './n3parser'\nimport NamedNode from './named-node'\nimport Namespace from './namespace'\nimport Node from './node'\nimport parse from './parse'\nimport { Query } from './query'\nimport queryToSPARQL from './query-to-sparql'\nimport RDFaProcessor from './rdfaparser'\nimport RDFParser from './rdfxmlparser'\nimport serialize from './serialize'\nimport Serializer from './serializer'\nimport SPARQLToQuery from './sparql-to-query'\nimport sparqlUpdateParser from './patch-parser'\nimport Statement from './statement'\nimport UpdateManager from './update-manager'\nimport { UpdatesSocket } from './updates-via'\nimport { UpdatesVia } from './updates-via'\nimport * as uri from './uri'\nimport * as Util from './utils-js'\nimport Variable from './variable'\nimport DataFactory from './factories/rdflib-data-factory'\n\n// Prepare bound versions of data factory methods for export\nconst boundDataFactory = {} as IRDFlibDataFactory\nfor (const name in DataFactory) {\n if (typeof DataFactory[name] === 'function')\n boundDataFactory[name] = DataFactory[name].bind(DataFactory);\n}\nconst {\n fetcher,\n graph,\n lit,\n st,\n namedNode,\n variable,\n blankNode,\n defaultGraph,\n literal,\n quad,\n triple,\n} = boundDataFactory\n\nconst formula = new Formula();\nconst fromNT = str => formula.fromNT(str);\n\nconst term = Node.fromValue\n\n// TODO: this export is broken;\n// it exports the _current_ value of nextId, which is always 0\nconst NextId = BlankNode.nextId\n\nexport * from './utils/terms'\nexport type { AutoInitOptions, ExtendedResponse, FetchError } from './fetcher'\nexport {\n BlankNode,\n Collection,\n DataFactory,\n Empty,\n Fetcher,\n Formula,\n Store,\n jsonParser,\n Literal,\n log,\n N3Parser,\n NamedNode,\n Namespace,\n Node,\n parse,\n Query,\n queryToSPARQL,\n RDFaProcessor,\n RDFParser,\n serialize,\n Serializer,\n SPARQLToQuery,\n sparqlUpdateParser,\n Statement,\n term,\n UpdateManager,\n UpdatesSocket,\n UpdatesVia,\n uri,\n Util,\n Variable,\n\n Store as IndexedFormula, // Alias\n\n NextId,\n\n fromNT,\n fetcher,\n graph,\n lit,\n st,\n namedNode as sym,\n\n // RDFJS DataFactory interface\n blankNode,\n defaultGraph,\n literal,\n namedNode,\n quad,\n triple,\n variable,\n}\nexport { termValue } from './utils/termValue'\n\nexport class ConnectedStore extends Store {\n\n fetcher: Fetcher;\n\n constructor (features) {\n super(features)\n this.fetcher = new Fetcher(this, {})\n }\n}\n\nexport class LiveStore extends ConnectedStore {\n\n updater: UpdateManager;\n \n constructor (features) {\n super(features)\n this.updater = new UpdateManager(this)\n }\n}\n"],"names":["root","factory","exports","module","require","define","amd","self","__WEBPACK_EXTERNAL_MODULE__8392__","leafPrototypes","getProto","inProgress","dataWebpackPrefix","debug","x","warn","info","error","success","msg","NamedNode","_Node","iri","_this","_classCallCheck","_callSuper","termValue","_defineProperty","NamedNodeTermType","ClassOrder","value","Error","includes","_inherits","_createClass","key","str","this","split","p","slice","lastIndexOf","q","indexOf","get","set","uri","isTerm","Node","bindings","other","classOrder","termType","toCanonical","equals","toNT","toString","BlankNodeTermType","LiteralTermType","VariableTermType","DefaultGraphTermType","CollectionTermType","EmptyTermType","GraphTermType","HTMLContentType","JSONLDContentType","N3ContentType","N3LegacyContentType","NQuadsAltContentType","NQuadsContentType","NTriplesContentType","RDFXMLContentType","SPARQLUpdateContentType","SPARQLUpdateSingleMatchContentType","TurtleContentType","TurtleLegacyContentType","XHTMLContentType","alert","console","log","docpart","i","document","RDFlibNamedNode","hostpart","u","m","exec","join","given","base","baseColon","baseScheme","baseSingle","lastSlash","path","baseHash","length","match","replace","protocol","refTo","k","l","len","len1","n","o","ref","ref1","s","commonHost","RegExp","string","template","subs","baseA","result","mediaTypeClass","mediaType","trim","linkRelationProperty","relation","callbackify","obj","callbacks","addHook","hook","addCallback","func","push","removeCallback","funcName","name","splice","insertCallback","unshift","fireCallbacks","args","callback","newCallbacks","replaceCallbacks","apply","DOMParserFactory","window","DOMParser","ActiveXObject","domToString","node","options","selfClosing","forEach","skipAttributes","dumpNode","out","noEsc","nodeType","hasAttribute","classWithChildText","matches","class","querySelector","element","textContent","skipNodeWithClass","ename","nodeName","toLowerCase","attrList","attributes","atn","test","replaceClassItemWith","source","re","target","skipClassWithValue","sortAttributes","sort","a","b","localeCompare","childNodes","pop","nodeValue","nl","dtstamp","now","Date","year","getYear","month","getMonth","day","getDate","hour","getUTCHours","minute","getUTCMinutes","second","getSeconds","heavyCompare","y","g","uriMap","nonBlank","signature","lis","statementsMatching","map","st","subject","predicate","object","concat","undefined","comparison","Object","prototype","hasOwnProperty","call","compareTerms","compareTerm","heavyCompareSPO","output","createElement","body","appendChild","parseXML","parseFromString","contentType","RDFArrayRemove","why","string_startswith","pref","stackString","e","stack","lines","toprint","line","charAt","chunks","isStatement","_typeof","isStore","isCollection","isRDFlibObject","isRDFlibSubject","isRDFlibPredicate","isVariable","isLiteral","isQuad","isNamedNode","isBlankNode","isSubject","isPredicate","isRDFObject","isGraph","peg$SyntaxError","message","expected","found","location","captureStackTrace","child","parent","ctor","constructor","peg$subclass","buildMessage","DESCRIBE_EXPECTATION_FNS","literal","expectation","literalEscape","text","escapedParts","parts","Array","classEscape","inverted","any","end","description","hex","ch","charCodeAt","toUpperCase","j","descriptions","type","describeExpected","describeFound","SyntaxError","parse","input","peg$result","peg$FAILED","peg$startRuleFunctions","turtleDoc","peg$parseturtleDoc","peg$startRuleFunction","peg$c0","statements","jsonld","context","toJSON","filter","isArray","assign","peg$c1","peg$c2","peg$literalExpectation","peg$c3","peg$c4","peg$c5","peg$c6","peg$c7","peg$classExpectation","peg$c8","peg$c9","peg$c10","peg$c11","peg$c12","peg$c13","addPrefix","peg$c14","peg$c15","peg$c16","addBase","peg$c17","peg$c18","peg$c19","peg$c20","peg$c21","peg$c22","peg$c23","peg$c24","peg$c25","peg$c26","peg$c27","peg$c28","peg$c29","peg$c30","peg$c31","peg$c32","peg$c33","peg$c34","peg$c35","peg$c36","peg$c37","peg$c38","peg$c39","f","peg$c40","d","peg$c41","c","property","createObject","t","keys","val","peg$c42","peg$c43","peg$c44","peg$c45","peg$c46","peg$c47","peg$c48","peg$c49","expandList","peg$c50","peg$c51","peg$c52","peg$c53","peg$c54","peg$c55","peg$c56","peg$c57","peg$c58","peg$c59","peg$c60","peg$c61","peg$c62","peg$c63","peg$c64","peg$c65","parseInt","parseFloat","resolve","prefix","decrement","peg$c66","peg$c67","peg$c68","peg$c69","peg$c70","peg$c71","peg$c72","peg$c73","peg$c74","peg$c75","peg$c76","peg$c77","peg$c78","peg$c79","decoded","codePointAt","String","fromCharCode","substring","fromCodePoint","peg$c80","peg$c81","peg$c82","hasPrefix","peg$c83","peg$c84","increment","peg$c85","peg$c86","peg$c87","peg$c88","peg$c89","peg$c90","peg$c91","peg$c92","peg$c93","peg$c94","peg$c95","peg$c96","peg$c97","peg$c98","peg$c99","peg$c100","peg$c101","peg$c102","peg$c103","peg$c104","peg$c105","peg$c106","peg$c107","peg$c108","peg$c109","peg$c110","peg$c111","peg$c112","peg$c113","peg$c114","peg$c115","peg$c116","peg$c117","peg$c118","peg$c119","peg$c120","head","peg$c121","peg$c122","peg$c123","peg$c124","peg$c125","peg$c126","peg$c127","peg$c128","peg$c129","peg$c130","peg$c131","peg$c132","peg$c133","peg$c134","peg$c135","peg$c136","peg$c137","peg$c138","peg$c139","peg$c140","peg$c141","peg$c142","peg$c143","peg$c144","peg$c145","peg$c146","peg$c147","peg$c148","peg$c149","peg$c150","peg$c151","peg$c152","peg$c153","peg$c154","peg$c155","peg$c156","peg$c157","peg$c158","peg$c159","peg$c160","peg$c161","peg$c162","peg$c163","peg$c164","peg$c165","peg$c166","peg$c167","peg$c168","peg$c169","peg$c170","peg$c171","peg$c172","peg$c173","peg$c174","peg$c175","peg$c176","peg$c177","peg$c178","peg$c179","peg$c180","tail","peg$c181","peg$c182","peg$c183","peg$c184","peg$c185","peg$c186","peg$c187","peg$c188","peg$currPos","peg$savedPos","peg$posDetailsCache","column","peg$maxFailPos","peg$maxFailExpected","peg$silentFails","startRule","peg$buildSimpleError","peg$computeLocation","ignoreCase","peg$computePosDetails","pos","details","startPos","endPos","startPosDetails","endPosDetails","start","offset","peg$fail","s0","s1","s2","s3","peg$parsestatement","peg$parseIGNORE","s4","s5","s6","s7","s8","substr","peg$parsePNAME_NS_NO_CHECK","peg$parseIRIREF","peg$parseprefixID","peg$parsebase","s9","s10","s11","peg$parsesparqlPrefix","peg$parsesparqlBase","peg$parsedirective","peg$parsecollection","peg$parseBlankNode","peg$parseiri","peg$parsesubject","peg$parsepredicateObjectList","peg$parseblankNodePropertyList","peg$parsetriples","peg$parseWS","peg$parseCOMMENT","peg$parseverb","peg$parseobjectList","peg$parseobject","peg$parsepredicate","peg$parseString","peg$parseLANGTAG","peg$parseRDFLiteral","peg$parseEXPONENT","peg$parseDOUBLE","peg$parseDECIMAL","peg$parseINTEGER","peg$parseNumericLiteral","peg$parseBooleanLiteral","peg$parseliteral","peg$parseECHAR","peg$parseUCHAR","peg$parseSTRING_LITERAL_LONG_SINGLE_QUOTE","peg$parseSTRING_LITERAL_LONG_QUOTE","peg$parseSTRING_LITERAL_SINGLE_QUOTE","peg$parseSTRING_LITERAL_QUOTE","peg$parsePNAME_NS","peg$parsePN_CHARS_U","peg$parsePLX","peg$parsePN_CHARS","peg$parsePN_LOCAL","peg$parsePNAME_LN","peg$parsePrefixedName","peg$parseBLANK_NODE_LABEL","peg$parseANON","peg$parsePN_PREFIX","peg$parseHEX","peg$parsePN_CHARS_BASE","peg$parsePERCENT","peg$parsePN_LOCAL_ESC","URL","Function","isBrowser","isIRI","data","last","list","count","pname","force","find","baseIRI","container","focus","Symbol","iterator","isDeepEqual","isDeepStrictEqual","_require$codes","codes","ERR_AMBIGUOUS_ARGUMENT","ERR_INVALID_ARG_TYPE","ERR_INVALID_ARG_VALUE","ERR_INVALID_RETURN_VALUE","ERR_MISSING_ARGS","AssertionError","inspect","_require$types","isPromise","isRegExp","objectAssign","objectIs","is","lazyLoadComparison","Map","warned","assert","ok","NO_EXCEPTION_SENTINEL","innerFail","innerOk","fn","argLen","generatedMessage","err","actual","operator","stackStartFn","_len","arguments","_key","fail","internalMessage","argsLen","process","emitWarning","bind","errArgs","equal","notEqual","deepEqual","notDeepEqual","deepStrictEqual","notDeepStrictEqual","strictEqual","notStrictEqual","Comparison","instance","Constructor","TypeError","expectedException","compareExceptionKey","isPrototypeOf","getActual","checkIsPromise","then","catch","waitForActual","promiseFn","Promise","resultPromise","expectsError","fnType","expectsNoError","strict","_len6","_key6","throws","_len2","_key2","rejects","_len3","_key3","doesNotThrow","_len4","_key4","doesNotReject","_len5","_key5","ifError","newErr","origStack","tmp2","shift","tmp1","defineProperty","enumerable","configurable","writable","_defineProperties","props","descriptor","_possibleConstructorReturn","_assertThisInitialized","ReferenceError","_wrapNativeSuper","Class","_cache","has","Wrapper","_construct","_getPrototypeOf","create","_setPrototypeOf","Parent","Reflect","construct","sham","Proxy","isNativeReflectConstruct","setPrototypeOf","__proto__","getPrototypeOf","endsWith","search","this_len","blue","green","red","white","kReadableOperator","strictEqualObject","notStrictEqualObject","notIdentical","copyError","inspectValue","compact","customInspect","depth","maxArrayLength","Infinity","showHidden","breakLength","showProxy","sorted","getters","_Error","limit","stackTraceLimit","stderr","isTTY","getColorDepth","res","lastPos","skipped","actualInspected","actualLines","expectedLines","indicator","inputLength","columns","Math","floor","maxCount","repeat","maxLines","max","_actualLines","printedLines","skippedMsg","cur","expectedLine","actualLine","divergingLines","createErrDiff","_res","knownOperators","code","protoProps","subClass","superClass","custom","recurseTimes","ctx","ownKeys","getOwnPropertySymbols","sym","getOwnPropertyDescriptor","_objectSpread","util","createErrorType","Base","NodeError","_Base","arg1","arg2","arg3","getMessage","oneOf","thing","determiner","reason","inspected","RangeError","_slicedToArray","arr","_arrayWithHoles","_arr","_n","_d","_e","_s","_i","next","done","_iterableToArrayLimit","_nonIterableRest","regexFlagsSupported","flags","arrayFromSet","array","arrayFromMap","objectGetOwnPropertySymbols","numberIsNaN","Number","isNaN","uncurryThis","propertyIsEnumerable","objectToString","isAnyArrayBuffer","isArrayBufferView","isDate","isMap","isSet","isNativeError","isBoxedPrimitive","isNumberObject","isStringObject","isBooleanObject","isBigIntObject","isSymbolObject","isFloat32Array","isFloat64Array","isNonIndex","pow","getOwnNonIndexProperties","compare","min","kNoIterator","kIsArray","kIsSet","kIsMap","innerDeepEqual","val1","val2","memos","buf1","buf2","val1Tag","keys1","keys2","keyCheck","getTime","byteLength","Uint8Array","buffer","byteOffset","areSimilarTypedArrays","areSimilarFloatArrays","_keys","_keys2","size","valueOf","Boolean","BigInt","isEqualBoxedPrimitive","getEnumerables","iterationType","aKeys","bKeys","symbolKeysA","symbolKeysB","_symbolKeysB","position","val2MemoA","val2MemoB","areEq","memo","aValues","Set","add","setMightHaveLoosePrim","bValues","_val","setHasEqualElement","setEquiv","aEntries","_aEntries$i","item1","item2","mapMightHaveLoosePrim","bEntries","_i2","_bEntries$_i","item","mapHasEqualEntry","mapEquiv","keysA","objEquiv","delete","setValues","findLooseMatchingPrimitives","prim","altValue","curB","key1","key2","b64","lens","getLens","validLen","placeHoldersLen","toByteArray","tmp","Arr","_byteLength","curByte","revLookup","fromByteArray","uint8","extraBytes","maxChunkLength","len2","encodeChunk","lookup","num","base64","ieee754","customInspectSymbol","Buffer","K_MAX_LENGTH","createBuffer","buf","arg","encodingOrOffset","allocUnsafe","from","encoding","isEncoding","write","fromString","ArrayBuffer","isView","arrayView","isInstance","copy","fromArrayBuffer","fromArrayLike","fromArrayView","SharedArrayBuffer","isBuffer","checked","fromObject","toPrimitive","assertSize","mustMatch","loweredCase","utf8ToBytes","base64ToBytes","slowToString","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","bidirectionalIndexOf","dir","arrayIndexOf","indexSize","arrLength","valLength","read","readUInt16BE","foundIndex","hexWrite","remaining","strLen","parsed","utf8Write","blitBuffer","asciiWrite","byteArray","asciiToBytes","base64Write","ucs2Write","units","hi","lo","utf16leToBytes","firstByte","codePoint","bytesPerSequence","secondByte","thirdByte","fourthByte","tempCodePoint","codePoints","MAX_ARGUMENTS_LENGTH","decodeCodePointsArray","TYPED_ARRAY_SUPPORT","proto","foo","typedArraySupport","poolSize","alloc","fill","allocUnsafeSlow","_isBuffer","swap16","swap32","swap64","toLocaleString","thisStart","thisEnd","thisCopy","targetCopy","isFinite","ret","hexSliceLookupTable","bytes","checkOffset","ext","checkInt","wrtBigUInt64LE","checkIntBI","wrtBigUInt64BE","checkIEEE754","writeFloat","littleEndian","noAssert","writeDouble","newBuf","subarray","readUintLE","readUIntLE","mul","readUintBE","readUIntBE","readUint8","readUInt8","readUint16LE","readUInt16LE","readUint16BE","readUint32LE","readUInt32LE","readUint32BE","readUInt32BE","readBigUInt64LE","defineBigIntMethod","validateNumber","first","boundsError","readBigUInt64BE","readIntLE","readIntBE","readInt8","readInt16LE","readInt16BE","readInt32LE","readInt32BE","readBigInt64LE","readBigInt64BE","readFloatLE","readFloatBE","readDoubleLE","readDoubleBE","writeUintLE","writeUIntLE","writeUintBE","writeUIntBE","writeUint8","writeUInt8","writeUint16LE","writeUInt16LE","writeUint16BE","writeUInt16BE","writeUint32LE","writeUInt32LE","writeUint32BE","writeUInt32BE","writeBigUInt64LE","writeBigUInt64BE","writeIntLE","sub","writeIntBE","writeInt8","writeInt16LE","writeInt16BE","writeInt32LE","writeInt32BE","writeBigInt64LE","writeBigInt64BE","writeFloatLE","writeFloatBE","writeDoubleLE","writeDoubleBE","targetStart","copyWithin","errors","E","super","addNumericalSeparator","range","ERR_OUT_OF_RANGE","checkBounds","ERR_BUFFER_OUT_OF_BOUNDS","received","isInteger","abs","INVALID_BASE64_RE","leadSurrogate","base64clean","src","dst","alphabet","table","i16","BufferBigIntNotDefined","GetIntrinsic","callBind","$indexOf","allowMissing","intrinsic","$apply","$call","$reflectApply","$gOPD","$defineProperty","$max","originalFunction","applyBind","times","functions","label","time","duration","format","expression","tuple","global","__self__","F","fetch","DOMException","support","Blob","viewClasses","normalizeName","normalizeValue","iteratorFor","items","Headers","headers","append","header","getOwnPropertyNames","consumed","bodyUsed","reject","fileReaderReady","reader","onload","onerror","readBlobAsArrayBuffer","blob","FileReader","promise","readAsArrayBuffer","bufferClone","view","Body","_initBody","_bodyInit","_bodyText","_bodyBlob","FormData","_bodyFormData","URLSearchParams","DataView","_bodyArrayBuffer","rejected","arrayBuffer","readAsText","chars","readArrayBufferAsText","formData","decode","json","JSON","oldValue","thisArg","values","entries","methods","Request","method","upcased","url","credentials","mode","signal","referrer","form","decodeURIComponent","Response","bodyInit","status","statusText","clone","response","redirectStatuses","redirect","init","request","aborted","xhr","XMLHttpRequest","abortXhr","abort","rawHeaders","getAllResponseHeaders","responseURL","responseText","ontimeout","onabort","open","withCredentials","responseType","setRequestHeader","addEventListener","onreadystatechange","readyState","removeEventListener","send","polyfill","ponyfill","hasSymbols","toStr","origDefineProperty","hasPropertyDescriptors","supportsDescriptors","defineProperties","predicates","firstSource","to","nextSource","keysArray","nextIndex","nextKey","desc","isCallable","receiver","forEachArray","forEachString","forEachObject","that","bound","boundLength","boundArgs","Empty","implementation","$SyntaxError","$Function","$TypeError","getEvalledConstructor","expressionSyntax","throwTypeError","ThrowTypeError","calleeThrows","gOPDthrows","needsEval","TypedArray","INTRINSICS","AggregateError","Atomics","BigInt64Array","BigUint64Array","decodeURI","encodeURI","encodeURIComponent","eval","EvalError","Float32Array","Float64Array","FinalizationRegistry","Int8Array","Int16Array","Int32Array","Uint8ClampedArray","Uint16Array","Uint32Array","URIError","WeakMap","WeakRef","WeakSet","errorProto","doEval","gen","LEGACY_ALIASES","hasOwn","$concat","$spliceApply","$replace","$strSlice","$exec","rePropName","reEscapeChar","getBaseIntrinsic","alias","intrinsicName","number","quote","subString","stringToPath","intrinsicBaseName","intrinsicRealName","skipFurtherCaching","isOwn","part","hasArrayLengthDefineBug","origSymbol","hasSymbolSham","symObj","syms","toStringTag","isLE","mLen","nBytes","eLen","eMax","eBias","nBits","NaN","rt","LN2","superCtor","super_","TempCtor","hasToStringTag","$toString","callBound","isStandardArguments","isLegacyArguments","callee","supportsStandardArguments","badArrayLike","isCallableMarker","fnToStr","reflectApply","_","constructorRegex","isES6ClassFn","fnStr","tryFunctionObject","isIE68","isDDA","all","strClass","GeneratorFunction","isFnRegex","generatorFunc","getGeneratorFunc","getPolyfill","shim","availableTypedArrays","gOPD","globalThis","typedArrays","$slice","toStrTags","typedArray","superProto","tag","anyTrue","getter","tryTypedArrays","keysShim","isArgs","isEnumerable","hasDontEnumBug","hasProtoEnumBug","dontEnums","equalsConstructorPrototype","excludedKeys","$applicationCache","$console","$external","$frame","$frameElement","$frames","$innerHeight","$innerWidth","$onmozfullscreenchange","$onmozfullscreenerror","$outerHeight","$outerWidth","$pageXOffset","$pageYOffset","$parent","$scrollLeft","$scrollTop","$scrollX","$scrollY","$self","$webkitIndexedDB","$webkitStorageInfo","$window","hasAutomationEqualityBug","isObject","isFunction","isArguments","isString","theKeys","skipProto","skipConstructor","equalsConstructorPrototypeIfNotBuggy","origKeys","originalKeys","keysWorksWithArguments","cachedSetTimeout","cachedClearTimeout","defaultSetTimout","defaultClearTimeout","runTimeout","fun","setTimeout","clearTimeout","currentQueue","queue","draining","queueIndex","cleanUpNextTick","drainQueue","timeout","run","marker","runClearTimeout","Item","noop","nextTick","title","browser","env","argv","version","versions","on","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","binding","cwd","chdir","umask","prop","qs","sep","eq","regexp","maxKeys","kstr","vstr","v","idx","stringifyPrimitive","ks","encode","stringify","queueMicrotask","cb","aliases","acl","as","cal","cert","contact","dc","dct","doap","foaf","geo","gpx","http","httph","icalTZ","ldp","link","meeting","mo","org","owl","pad","patch","prov","qu","trip","rdf","rdfs","rss","sched","schema","sioc","solid","space","stat","tab","tabont","ui","vcard","wf","xsd","cco","skos","bookmark","vann","namedNode","namespaces","expansion","localName","freeGlobal","punycode","maxInt","tMax","skew","damp","regexPunycode","regexNonASCII","regexSeparators","baseMinusTMin","stringFromCharCode","mapDomain","ucs2decode","extra","counter","ucs2encode","digitToBasic","digit","flag","adapt","delta","numPoints","firstTime","basic","index","oldi","w","baseMinusT","bias","handledCPCount","basicLength","currentValue","handledCPCountPlusOne","qMinusT","Url","slashes","auth","host","port","hostname","hash","query","pathname","href","protocolPattern","portPattern","simplePathPattern","unwise","autoEscape","nonHostChars","hostEndingChars","hostnamePartPattern","hostnamePartStart","unsafeProtocol","hostlessProtocol","slashedProtocol","querystring","parseQueryString","slashesDenoteHost","queryIndex","splitter","uSplit","rest","simplePath","lowerProto","atSign","hostEnd","hec","parseHost","ipv6Hostname","hostparts","newpart","validParts","notHost","bit","toASCII","h","ae","esc","escape","qm","relative","resolveObject","urlParse","rel","tkeys","tk","tkey","rkeys","rk","rkey","relPath","isSourceAbs","isRelAbs","mustEndAbs","removeAllDots","srcPath","psychotic","isNullOrUndefined","authInHost","isNull","hasTrailingSlash","up","isAbsolute","isArgumentsObject","isGeneratorFunction","whichTypedArray","isTypedArray","BigIntSupported","SymbolSupported","ObjectToString","numberValue","stringValue","booleanValue","bigIntValue","symbolValue","checkBoxedPrimitive","prototypeValueOf","isMapToString","isSetToString","isWeakMapToString","isWeakSetToString","isArrayBufferToString","isArrayBuffer","working","isDataViewToString","isDataView","isUint8Array","isUint8ClampedArray","isUint16Array","isUint32Array","isInt8Array","isInt16Array","isInt32Array","isBigInt64Array","isBigUint64Array","isWeakMap","isWeakSet","SharedArrayBufferCopy","isSharedArrayBufferToString","isSharedArrayBuffer","isAsyncFunction","isMapIterator","isSetIterator","isGeneratorObject","isWebAssemblyCompiledModule","getOwnPropertyDescriptors","descriptors","formatRegExp","objects","deprecate","noDeprecation","throwDeprecation","traceDeprecation","trace","debugs","debugEnvRegex","NODE_DEBUG","debugEnv","opts","seen","stylize","stylizeNoColor","colors","isBoolean","_extend","isUndefined","stylizeWithColor","formatValue","styleType","style","styles","primitive","simple","isNumber","formatPrimitive","visibleKeys","arrayToHash","isError","formatError","braces","toUTCString","formatProperty","formatArray","reduce","prev","reduceToSingleString","ar","debuglog","pid","types","isSymbol","isPrimitive","months","getHours","getMinutes","inherits","origin","kCustomPromisifiedSymbol","callbackifyOnRejected","newReason","promisify","original","promiseResolve","promiseReject","callbackified","maybeCb","rej","foundName","_regeneratorRuntime","__esModule","r","asyncIterator","wrap","Generator","Context","makeInvokeMethod","tryCatch","GeneratorFunctionPrototype","defineIteratorMethods","_invoke","AsyncIterator","invoke","__await","callInvokeWithMethodAndArg","delegate","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","resultName","nextLoc","pushTryEntry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","displayName","mark","awrap","async","reverse","stop","rval","handle","complete","finish","delegateYield","runtime","regeneratorRuntime","accidentalStrictMode","possibleNames","staticProps","toPropertyKey","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","id","loaded","__webpack_modules__","ns","def","current","definition","chunkId","promises","hmd","children","script","needAttach","scripts","getElementsByTagName","getAttribute","charset","nc","setAttribute","onScriptComplete","event","doneFns","parentNode","removeChild","nmd","paths","scriptUrl","importScripts","currentScript","installedChunks","installedChunkData","errorType","realSrc","webpackJsonpCallback","parentChunkLoadingFunction","chunkIds","moreModules","some","chunkLoadingGlobal","BlankNode","getId","formula","bnodeNew","copyTo","NTAnonymousNodePrefix","fragments","nextId","boolean","dateTime","decimal","double","integer","langString","Literal","language","datatype","XSD","fromValue","lang","d2","getUTCFullYear","getUTCMonth","getUTCDate","getUTCSeconds","strValue","MAX_SAFE_INTEGER","fromDate","fromBoolean","fromNumber","Collection","initial","RdflibBlankNode","elements","closed","ea","substitute","collection","asyncGeneratorStep","_next","_throw","_asyncToGenerator","defaultGraphURI","DefaultGraph","isDefaultGraph","defaultGraph","DefaultGraphNode","Statement","graph","terms","Variable","Uri","variable","Feature","CanonicalDataFactory","supports","collections","defaultGraphType","equalsMethod","identity","reversibleId","variableType","blankNode","term","quadToNQ","nq","termToNQ","languageOrDatatype","quad","triple","toNQ","Namespace","nsuri","dataFactory","ln","createXSD","localFactory","createSerializer","store","Serializer","_notQNameChars","prefixes","nsKeys","solidNs","suggestPrefix","namespacesUsed","keywords","prefixchars","incoming","formulas","rdfFactory","fromNT","px","setPrefix","existingNs","prefixs","canUse","pp","validPrefix","slash","sts","subjects","allBnodes","checkMentions","z","ss","roots","xNT","fromStr","rootsHash","statementsToN3","backslashUify","rdfns","kb","termToNT","atomicTermToN3","bnode","Util","defaultNamespace","predMap","spaces","treeToLine","tree","branch","statementListToTree","stats","rootSubjects","results","subjectTree","termToN3","propertyTree","objectTree","lastPred","expr","prefixDirectives","explicitURI","treeToString","level","lastLength","eNotation","stringToN3","symbolToN3","delim","forbidden","forbidden3","forbidden1","lastIndex","canSplit","_notNameChars","localid","namesp","keyords","makeUpPrefix","fetcher","session","appNode","sources","metaSources","metadata","namespaceCounts","liPrefix","XMLtreeToLine","statementListToXMLTree","subjectXMLTree","escapeForXML","relURI","pred","propertyXMLTree","ap","bp","bs","an","bn","qname","collectionXMLTree","attrs","ns2","XMLtreeToString","jsonldObj","ttl2jsonld","serialize","sz","setFlags","newSts","suggestNamespaces","setNamespaces","setBase","executeCallback","statementsToXML","statementsToNTriples","statementsToJsonld","appliedFactoryMethods","nil","arrayToStatements","_listObj","listData","nextNode","ArrayIndexOf","Formula","constraints","initBindings","optional","Graph","_step","_iterator","_createForOfIteratorHelper","_loop","factoryMethod","_this$rdfFactory","_this2","statement","_this3","anyStatementMatching","toJS","justOne","bots","bottom","each","len3","hashString","thisClass","len4","members","ref2","ref3","ref4","ref5","seeds","transitiveClosure","NTtoURI","findMembersNT","findTypesNT","doc","excludePredicateURIs","todo","doneArcs","follow","_features","dt","holds","addAll","uris","provenance","statementsCopy","inverse","sups","agenda","tops","Query","pat","IndexedFormula","vars","indexedFormulaQuery","myQuery","onDone","bindingDebug","bindingsDebug","nbs","unifyContents","nbs2","isVar","complexType","redirections","defaultDocumentURI","unifyTerm","nb","nb2","bindings2","union","OptionalBranchJunction","originalCallback","trunkBindings","branches","MandatoryBranch","checkAllDone","doCallBacks","reportMatch","reportDone","OptionalBranch","junction","prepare","termIndex","ind","nvars","subjectIndex","predicateIndex","objectIndex","whyIndex","easiestQuery","bindingsSoFar","localCallback","pattern_debug","pattern","br","fetchResource","requestedTerm","docuri","nowOrWhenFetched","getState","match2","constraintsSatisfied","nk","newBindings1","nbs1","onward","trunck","sync","owlNamespaceURI","handleFP","subj","o1","equate","handleIFP","handleRDFType","typeCallback","classActions","_Formula","features","propertyActions","HTTPRedirects","rdfArrayRemove","dataCallback","dataCallbacks","initPropertyActions","patchCallback","ds","targetKB","doPatch","onDonePatch","bad","ds2","remove","where","bindingsFound","_existentialVariables","addFn","newPropertyAction","proj","actions","objNode","predicateCallback","predHash","canon","ix","checkStatementList","arrayContains","u1","u2","statList","u1in","u2in","replaceWith","declareExistential","action","toBeFixed","_universalVariables","mentionsURI","removeStatement","removeMetadata","removeMatches","meta","linkNamespaceURI","requests","removeMany","big","small","oldhash","newhash","moveIndex","oldlist","newlist","nowKnownAs","x1","y1","existingPrefix","wild","iBest","best","pBest","possibles","check","cterm","_options","RDF","convertFirstRestNil","preceding","ele","listSoFar","trash","rests","firsts","total","totalTrash","pres","newList","newStatement","_step2","_iterator2","_step3","_iterator3","substituteInDoc","pre","_step4","_iterator4","_step5","_iterator5","sameTerm","substituteNillsInDoc","Logic_NS","pyjslib_Tuple","theList","pyjslib_List","pyjslib_Dict","listOfPairs","pyjslib_len","pyjslib_slice","StopIteration","pyjslib_Iterator","li","string_find","assertFudge","condition","utftext","Utf8","uripath_join","RDF_nil_URI","DAML_sameAs_URI","number_syntax","datetime_syntax","interesting","langcode","openFormula","thisDoc","baseURI","genPrefix","metaURI","SinkParser","_bindings","_flags","_store","setGenPrefix","_thisDoc","statementCount","hasNil","startOfLine","previousLine","_genPrefix","keywordsSet","_anonymousNodes","_variables","_parentVariables","_reason","_reason2","_baseURI","RDFSink_uniqueURI","_formula","_context","_parentContext","stream","loadBuf","startDoc","feed","endDoc","octets","skipSpace","directiveOrStatement","BadSyntax","directive","checkDot","tok","commaSeparatedList","setKeywords","__x","newUniversal","uri_ref2","hexify","qn","setPrefixForURI","property_list","nodeOrLiteral","ahead","here","makeStatement","subjectAlready","bnodeID","objs","objectList","__obj","mylist","first_run","newSet","oldParentContext","parentAnonymousNodes","grandParentVariables","reason2","close","thing_type","verb","pairFudge","ofUris","bareWord","pfx","anonymousNode","symb","uref","strconst","startline","res2","ustr","uEscape","UEscape","uch","uesc","lineNo","characterInFile","syntaxProblem","ExtendedTermFactory","jsonldObjectToTerm","listToCollection","listId","listItem","listToStatements","jsonldParser","baseString","flatten","flattened","flatResource","processResource","startsWith","_Object$keys","graphId","nestedFlatResources","addStatement","createStatement","SWAP","sameAs","forSome","forAll","implies","escapeSequence","escapeReplacements","illegalIriChars","lineModeRegExps","_iri","_unescapedIri","_simpleQuotedString","_langcode","_blank","_newline","_comment","_whitespace","_endOfFile","invalidRegExp","N3Lexer","_simpleApostropheString","_prefix","_prefixed","_variable","_number","_boolean","_keyword","_sparqlKeyword","_shortPredicates","_lineMode","lineMode","_n3Mode","n3","_comments","comments","_literalClosingPos","_tokenizeToEnd","inputFinished","_input","currentLineLength","whiteSpaceMatch","comment","emitToken","_line","firstChar","matchLength","inconclusive","_previousMarker","_unescape","reportSyntaxError","_parseLiteral","token","previousToken","_syntaxError","invalid","replaced","sequence","unicode4","unicode8","escapedChar","charCode","opening","openingLength","closingPos","backslashCount","raw","issue","_readStartingBom","tokenize","tokens","_pendingBuffer","setEncoding","DEFAULTGRAPH","_blankNodeCounter","languageOrDataType","Term","hashCode","atPos","datatypeString","dtPos","char","Quad","_subject","_predicate","_object","_graph","blankNodePrefix","N3Parser","_contextStack","_setBase","initDataFactory","isTurtle","isTriG","isNTriples","isNQuads","isN3","isLineMode","_supportsNamedGraphs","_readPredicateOrNamedGraph","_readPredicate","_supportsQuads","_supportsRDFStar","_resolveRelativeIRI","_blankNodePrefix","_lexer","lexer","_explicitQuantifiers","explicitQuantifiers","_resetBlankNodePrefix","fragmentPos","_base","_basePath","_baseRoot","_baseScheme","_saveContext","n3Mode","_inversePredicate","blankPrefix","_prefixes","quantified","_quantified","_restoreContext","_error","_readInTopContext","_callback","_sparqlStyle","_readPrefix","_readBaseIRI","_readSubject","_readNamedGraphLabel","_readEntity","quantifier","_resolveIRI","_namedNode","_blankNode","_readBlankNodeHead","RDF_NIL","_readListItem","_readPunctuation","N3_FORSOME","_quantifier","_readQuantifierList","N3_FORALL","_literalValue","_completeSubjectLiteral","_literal","_getPathReader","ABBREVIATIONS","_readBlankNodeTail","_readObject","_readDataTypeOrLang","_getContextEndReader","_readGraph","_readBlankNodePunctuation","_emit","empty","_readPredicateAfterBlank","previousList","RDF_FIRST","_readListItemDataTypeOrLang","RDF_REST","_completeObjectLiteral","_completeLiteral","completed","_readCallback","_readFormulaTail","inversePredicate","_quad","_readQuadPunctuation","_readPrefixIRI","prefixNode","_prefixCallback","_readDeclarationPunctuation","_readNamedGraphBlankLabel","entity","QUANTIFIERS_GRAPH","_readQuantifierPunctuation","afterPath","_afterPath","_readPath","_readForwardPath","_readBackwardPath","_readRDFStarTailOrGraph","_readRDFStarTail","contextStack","_removeDotSegments","pathStart","segmentStart","quadCallback","prefixCallback","quads","every","parser","N3DataFactory","ELEMENT_NODE","ATTRIBUTE_NODE","TEXT_NODE","CDATA_SECTION_NODE","ENTITY_REFERENCE_NODE","ENTITY_NODE","PROCESSING_INSTRUCTION_NODE","COMMENT_NODE","DOCUMENT_NODE","DOCUMENT_TYPE_NODE","DOCUMENT_FRAGMENT_NODE","NOTATION_NODE","RDFaProcessor","blankNodes","htmlOptions","theOne","vocabulary","blankCounter","langAttributes","namespaceURI","inXHTMLMode","absURIRE","finishedHandlers","su","ob","pr","or","toRDFNodeObject","mappings","newMappings","dateTimeTypes","matched","colon","NCNAME","parseCURIE","resolveAndNormalize","defaultVocabulary","ignoreTerms","parseTermOrCURIEOrAbsURI","parseCURIEOrURI","curie","documentElement","setContext","removeHash","baseURIMap","listMapping","bnodes","newBlankNode","addTriple","objectURI","skip","newSubject","currentObjectResource","typedResource","prefixesCopied","incomplete","listMappingDifferent","parseURI","vocabAtt","getAttributeNode","baseSubject","spec","att","copyMappings","prefixAtt","parsePrefixMappings","xmlLangAtt","getAttributeNodeNS","relAtt","revAtt","typeofAtt","propertyAtt","datatypeAtt","datetimeAtt","inHTMLMode","contentAtt","aboutAtt","srcAtt","resourceAtt","hrefAtt","inlistAtt","relAttPredicates","parsePredicate","revAttPredicates","parseSafeCURIEOrCURIEOrURI","parentObject","newSubjectOrigin","typeURI","forward","content","PlainLiteralURI","XMLLiteralURI","HTMLLiteralURI","deriveDateTimeType","childContext","listSubject","lastChild","previousSibling","copyProperties","setXHTMLContext","doctype","publicId","systemId","setHTMLContext","setXMLContext","setInitialContext","dom","nameChar","nameStartChar","parseRDFaDOM","RDFParser","reify","uriUtil","rdfid","NODE","ARC","addSymbol","isTripleToLoad","loadTriple","listIndex","attributeNode","potentialNode","cleanParser","DOCUMENT","ELEMENT","frameFactory","parseDOM","buildFrame","frame","elementURI","el","dig","TEXT","CDATA_SECTION","addArc","addLiteral","addCollectionArc","removeAttributeNode","parsetype","nv","innerHTML","addBNode","addCollection","resource","bnid2","addNode","about","bnid","rdftype","pframe","candidate","terminateFrame","removeAttribute","sparqlUpdateParser","SQNS","clauses","badSyntax","n3Parser","N3jsParser","DataFactory","nquads","tripleCallback","nquadCallback","e2","cause","executeErrorCallback","handled","Parsable","CONTENT_TYPE_BY_EXT","getNS","Handler","RDFXMLHandler","_Handler2","failFetch","noMeta","doneFetch","mediatypes","XHTMLHandler","_Handler3","links","linkData","rdfParse","noRDFa","XMLHandler","_Handler4","isElement","addStatus","req","html","xmlns","HTMLHandler","_Handler5","isXML","docTypeStart","docTypeEnd","isXHTML","isXMLNS","titleMatch","JsonLdHandler","_Handler6","TextHandler","_Handler7","N3Handler","_Handler8","defaultHandlers","Fetcher","_fetch","solidFetcher","solidFetch","crossFetch","requested","timeouts","redirectedTo","fetchQueue","fetchCallbacks","nonexistent","lookedUp","handlers","addHandler","load","uriIn","initFetchOptions","clearPreviousData","initialisedOptions","pendingFetchPromise","_pendingFetchPromise","_callee","originalUri","pendingPromise","t0","race","setRequestTimeout","fetchUri","cleanupFetchRequest","_x","_x2","_x3","_this4","isPending","cache","acceptString","requestedURI","offlineOverride","setCredentials","actualProxyURI","proxyIfNecessary","proxyUsed","_this5","unsupportedProtocol","state","dummyResponse","saveRequestMetadata","handleResponse","errno","handleError","p2","userCallback","referringTerm","fetchResponse","oops","statusMessage","getMilliseconds","statusNode","the","errorMessage","statusCode","meth","linkHeader","reqNode","paramexp","was","lookUpThing","_this6","uriSting","jsonString","webOperation","there","_this7","_this8","unload","_createIfNotExists","_callee2","_args2","_context2","t1","_x4","parentURI","folderName","invalidateCache","rterm","_this9","anyValue","timeNow","_this10","responseNode","refresh","exp","getHeader","removeDocument","handler","register","retriedWithNoCredentials","newOptions","isCrossSite","retryNoCredentials","proxyUri","crossSiteProxy","redirectToProxy","rdfType","locURI","reqURI","redirection","_this11","saveResponseMetadata","normalizedContentType","contentLocation","saveErrorResponse","diffLocation","absContentLocation","addType","isImage","parseLinkHeader","handlerForContentType","_this12","forceContentType","guess","guessContentType","newURI","_this13","oldReq","_this14","acceptstring","crossSiteProxyTemplate","UI","panes","preferences","isExtension","$SolidTestEnvironment","localSiteMap","pcol","HANDLERS","parseJSON","preds","queryToSPARQL","indent","getPattern","addIndent","getConstraints","describe","getOptionals","getWhere","getSelect","getSPARQL","SPARQLToQuery","SPARQL","testMode","variableHash","makeVar","newVar","isRealText","fixSymbolBrackets","isBnode","isPrefix","isPrefixedSymbol","getPrefix","getSuffix","removeBrackets","parseLiterals","sin","doub","end2","spaceDelimit","arrayIndicesOf","getMatchingBracket","ConstraintEqualTo","varstr","ConstraintRegexp","rg","setConstraint","setOptional","opt","setWhere","toTerms","filt","arrayZero","per","sem","stat2","com","stat3","extractStatements","sp","token1","token2","strarr","replaceKeywords","prefInd","symbol","getPrefixDeclarations","selectLoc","whereLoc","setVars","UpdateManager","updater","ifps","fps","patchControl","_kb$fetcher","_checkEditable","_kb$fetcher2","final","editable","_kb$fetcher3","isHttpUri","definitive","anyJS","wacAllow","lr","acceptPatch","authorVia","mentioned","stmt","anonymize","statementBnodes","bnodes2","isBlank","bnodeContext2","con","connectedStatements","cacheIfps","bnodeContext1","bnodeContext","anonymizeNT","callbackFunction","statementContext","statementNT","contextWhere","set_object","fire","st0","stText","control","patchControlFor","pendingUpstream","downstreamAction","upstreamCount","linkHeaders","listener","downstreamChangeListeners","setRefreshHandler","reloadAndSync","reloading","outOfDate","retryTimeout","tryReload","reload","wssURI","getUpdatesVia","theHandler","retries","validWssURI","uriJoin","openWebsocket","socket","WebSocket","onopen","requestDownstreamAction","onclose","onmessage","deletions","insertions","docs","thisUpdater","uniqueDocs","uniqueDoc","updates","update","bnodes_context","whereClause","nTriples","secondTry","errorBody","startTime","isSparql","statementArrayBnodes","constructSparqlUpdateQuery","constructN3PatchQuery","elapsedTimeMs","updateDav","updateLocalFile","targetURI","documentString","candidateTarget","dot","onErrorWasCalled","reloadTimeTotal","reloadTimeCount","RDFlibDataFactory","lit","UpdatesSocket","via","connected","pending","subscribed","onOpen","onClose","onMessage","onError","elt","_send","onUpdate","_decode","_subscribe","UpdatesVia","onHeaders","etag","subscribe","boundDataFactory","NextId","ConnectedStore","_Store","Store","LiveStore","_ConnectedStore2"],"sourceRoot":""} \ No newline at end of file diff --git a/doc/classes/BlankNode.html b/doc/classes/BlankNode.html index f95b4aecc..d89364d76 100644 --- a/doc/classes/BlankNode.html +++ b/doc/classes/BlankNode.html @@ -1,6 +1,6 @@ BlankNode | rdflib

Class BlankNode

An RDF blank node is a Node without a URI

Hierarchy (view full)

Implements

  • BlankNode

Constructors

Hierarchy (view full)

Implements

  • BlankNode

Constructors

Properties

classOrder isBlank isVar @@ -23,29 +23,29 @@ toString

Constructors

Properties

classOrder: number = ClassOrder.BlankNode

The class order for this node

-
isBlank: number = 1

Whether this is a blank node

-
isVar: number = 1

This type of node is a variable.

+

Returns BlankNode

Properties

classOrder: number = ClassOrder.BlankNode

The class order for this node

+
isBlank: number = 1

Whether this is a blank node

+
isVar: number = 1

This type of node is a variable.

Note that the existence of this property already indicates that it is a variable.

-
termType: "BlankNode" = BlankNodeTermType

The type of node

-
value: string

The node's value

-
NTAnonymousNodePrefix: "_:" = '_:'
fromValue: (<T>(value) => T)

Type declaration

    • <T>(value): T
    • Type Parameters

      • T extends FromValueReturns

      Parameters

      • value: ValueType

      Returns T

nextId: number = 0

The next unique identifier for blank nodes

-
toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

Type declaration

    • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
    • Parameters

      • term: any

      Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

Accessors

Methods

termType: "BlankNode" = BlankNodeTermType

The type of node

+
value: string

The node's value

+
NTAnonymousNodePrefix: "_:" = '_:'
fromValue: (<T>(value) => T)

Type declaration

    • <T>(value): T
    • Type Parameters

      • T extends FromValueReturns

      Parameters

      • value: ValueType

      Returns T

nextId: number = 0

The next unique identifier for blank nodes

+
toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

Type declaration

    • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
    • Parameters

      • term: any

      Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

Accessors

Methods

  • Compares whether the two nodes are equal

    +

Returns BlankNode

  • Compares whether the two nodes are equal

    Parameters

    • other: Term

      The other node

      -

    Returns boolean

  • Creates a hash for this node

    +

Returns boolean

  • Creates the substituted node for this one, according to the specified bindings

    +

Returns boolean

  • Creates the substituted node for this one, according to the specified bindings

    Type Parameters

    Parameters

    • bindings: Bindings

      Bindings of identifiers to nodes

      -

    Returns T

\ No newline at end of file +

Returns T

\ No newline at end of file diff --git a/doc/classes/Collection.html b/doc/classes/Collection.html index 4e1f698ce..93f1a405c 100644 --- a/doc/classes/Collection.html +++ b/doc/classes/Collection.html @@ -1,6 +1,6 @@ Collection | rdflib

Class Collection<T>

A collection of other RDF nodes

Use generic T to control the contents of the array.

-

Type Parameters

Hierarchy (view full)

Implements

  • Term

Constructors

Type Parameters

Hierarchy (view full)

Implements

  • Term

Constructors

Properties

Constructors

Properties

classOrder: number = ClassOrder.Collection

The class order for this node

-
closed: boolean = false
compareTerm: ((other) => number) = RdflibBlankNode.prototype.compareTerm

Type declaration

    • (other): number
    • Parameters

      Returns number

elements: T[] = []

The nodes in this collection

-
isVar: number = 0
termType: "Collection" = CollectionTermType

The type of node

-
value: string

The node's value

-
fromValue: (<T>(value) => T)

Type declaration

    • <T>(value): T
    • Type Parameters

      • T extends FromValueReturns

      Parameters

      • value: ValueType

      Returns T

termType: "Collection" = CollectionTermType
toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

Type declaration

    • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
    • Parameters

      • term: any

      Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

Accessors

Methods

  • Appends an element to this collection

    +

Constructors

Properties

classOrder: number = ClassOrder.Collection

The class order for this node

+
closed: boolean = false
compareTerm: ((other) => number) = RdflibBlankNode.prototype.compareTerm

Type declaration

    • (other): number
    • Parameters

      Returns number

elements: T[] = []

The nodes in this collection

+
isVar: number = 0
termType: "Collection" = CollectionTermType

The type of node

+
value: string

The node's value

+
fromValue: (<T>(value) => T)

Type declaration

    • <T>(value): T
    • Type Parameters

      • T extends FromValueReturns

      Parameters

      • value: ValueType

      Returns T

termType: "Collection" = CollectionTermType
toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

Type declaration

    • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
    • Parameters

      • term: any

      Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

Accessors

Methods

  • Appends an element to this collection

    Parameters

    • element: T

      The new element

      -

    Returns number

  • Compares whether the two nodes are equal

    +

Returns number

  • Compares whether the two nodes are equal

    Parameters

    • other: Term

      The other node

      -

    Returns boolean

  • Creates a hash for this node

    +

Returns boolean

  • Removes the first element from the collection (and return it)

    -

    Returns undefined | T

  • Creates a new Collection with the substituting bindings applied

    +

Returns boolean

  • Removes the first element from the collection (and return it)

    +

    Returns undefined | T

  • Creates a new Collection with the substituting bindings applied

    Parameters

    • bindings: Bindings

      The bindings to substitute

      -

    Returns any

  • Serializes the collection to a string. +

Returns any

  • Serializes the collection to a string. Surrounded by (parentheses) and separated by spaces.

    -

    Returns string

  • Prepends the specified element to the collection's front

    Parameters

    • element: T

      The element to prepend

      -

    Returns number

\ No newline at end of file +

Returns number

\ No newline at end of file diff --git a/doc/classes/ConnectedStore.html b/doc/classes/ConnectedStore.html index b5298c5c8..ac2198801 100644 --- a/doc/classes/ConnectedStore.html +++ b/doc/classes/ConnectedStore.html @@ -1,5 +1,5 @@ ConnectedStore | rdflib

Class ConnectedStore

Indexed Formula aka Store

-

Hierarchy (view full)

Constructors

Hierarchy (view full)

Constructors

Properties

HTTPRedirects: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

Redirections we got from HTTP

-
_existentialVariables?: BlankNode[]
_universalVariables?: NamedNode[]
aliases: any[]

Reverse mapping to redirection: aliases for this

-
classActions: {
    [k: string]: Function[];
}

Map of iri predicates to functions to call when adding { s type X }

-

Type declaration

  • [k: string]: Function[]
classOrder: number = ClassOrder.Graph

The class order for this node

-
constraints: readonly any[] = []

initial array of constraints

-
features: FeaturesType
fetcher: Fetcher

The accompanying fetcher instance.

+

Constructors

Properties

HTTPRedirects: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

Redirections we got from HTTP

+
_existentialVariables?: BlankNode[]
_universalVariables?: NamedNode[]
aliases: any[]

Reverse mapping to redirection: aliases for this

+
classActions: {
    [k: string]: Function[];
}

Map of iri predicates to functions to call when adding { s type X }

+

Type declaration

  • [k: string]: Function[]
classOrder: number = ClassOrder.Graph

The class order for this node

+
constraints: readonly any[] = []

initial array of constraints

+
features: FeaturesType
fetcher: Fetcher

The accompanying fetcher instance.

Is set by the fetcher when initialized.

-
index: [Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[]]
initBindings: readonly any[] = []

initial bindings used in Query

-
isVar: number = 0
namespaces: {
    [key: string]: string;
}

Dictionary of namespace prefixes

-

Type declaration

  • [key: string]: string
ns: ((nsuri, factory?) => ((ln) => NamedNode)) = Namespace

A namespace for the specified namespace's URI

+
index: [Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[]]
initBindings: readonly any[] = []

initial bindings used in Query

+
isVar: number = 0
namespaces: {
    [key: string]: string;
}

Dictionary of namespace prefixes

+

Type declaration

  • [key: string]: string
ns: ((nsuri, factory?) => ((ln) => NamedNode)) = Namespace

A namespace for the specified namespace's URI

Type declaration

    • (nsuri, factory?): ((ln) => NamedNode)
    • Parameters

      • nsuri: string

        The URI for the namespace

        -
      • Optional factory: RdfJsDataFactory

      Returns ((ln) => NamedNode)

        • (ln): NamedNode
        • Parameters

          • ln: string

          Returns NamedNode

objectIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

Array of statements with this X as object

-
optional: readonly any[] = []

optional

-
predicateIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

Array of statements with this X as predicate

-
propertyActions: {
    [k: string]: Function[];
}

Map of iri predicates to functions to call when getting statement with {s X o}

-

Type declaration

  • [k: string]: Function[]
rdfFactory: any

The factory used to generate statements and terms

-
redirections: any[]

Redirect to lexically smaller equivalent symbol

-
statements: Statement<SubjectType, PredicateType, ObjectType, GraphType>[] = []

Initial array of statements

-
subjectIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

Array of statements with this X as subject

-
termType: "Graph" = GraphTermType

The type of node

-
updater?: UpdateManager

An UpdateManager initialised to this store

-
value: string

The node's value

-
whyIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

Array of statements with X as provenance

-
fromValue: (<T>(value) => T)

Type declaration

    • <T>(value): T
    • Type Parameters

      • T extends FromValueReturns

      Parameters

      • value: ValueType

      Returns T

handleRDFType: Function
toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

Type declaration

    • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
    • Parameters

      • term: any

      Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

Accessors

  • get length(): number
  • Returns the number of statements contained in this IndexedFormula. +

  • Optional factory: RdfJsDataFactory

Returns ((ln) => NamedNode)

    • (ln): NamedNode
    • Parameters

      • ln: string

      Returns NamedNode

objectIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

Array of statements with this X as object

+
optional: readonly any[] = []

optional

+
predicateIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

Array of statements with this X as predicate

+
propertyActions: {
    [k: string]: Function[];
}

Map of iri predicates to functions to call when getting statement with {s X o}

+

Type declaration

  • [k: string]: Function[]
rdfFactory: any

The factory used to generate statements and terms

+
redirections: any[]

Redirect to lexically smaller equivalent symbol

+
statements: Statement<SubjectType, PredicateType, ObjectType, GraphType>[] = []

Initial array of statements

+
subjectIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

Array of statements with this X as subject

+
termType: "Graph" = GraphTermType

The type of node

+
updater?: UpdateManager

An UpdateManager initialised to this store

+
value: string

The node's value

+
whyIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

Array of statements with X as provenance

+
fromValue: (<T>(value) => T)

Type declaration

    • <T>(value): T
    • Type Parameters

      • T extends FromValueReturns

      Parameters

      • value: ValueType

      Returns T

handleRDFType: Function
toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

Type declaration

    • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
    • Parameters

      • term: any

      Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

Accessors

  • get length(): number
  • Returns the number of statements contained in this IndexedFormula. (Getter proxy to this.statements). Usage:

    var kb = rdf.graph()
    kb.length // -> 0
    -

    Returns number

  • get defaultGraphURI(): string
  • Gets the URI of the default graph

    -

    Returns string

Methods

  • Transform a collection of NTriple URIs into their URI strings

    +

    Returns number

  • get defaultGraphURI(): string
  • Gets the URI of the default graph

    +

    Returns string

Methods

  • Transform a collection of NTriple URIs into their URI strings

    Parameters

    • t: any

      Some iterable collection of NTriple URI strings

    Returns {}

    A collection of the URIs as strings todo: explain why it is important to go through NT

    -
    • Adds a triple (quad) to the store.

      Parameters

      • subj: Quad_Subject | Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph> | Statement<SubjectType, PredicateType, ObjectType, GraphType> | Statement<SubjectType, PredicateType, ObjectType, GraphType>[] | Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

        The thing about which the fact a relationship is asserted. Also accepts a statement or an array of Statements.

      • Optional pred: Quad_Predicate

        The relationship which is asserted

      • Optional obj: string | Term

        The object of the relationship, e.g. another thing or a value. If passed a string, this will become a literal.

      • Optional why: Quad_Graph

        The document in which the triple (S,P,O) was or will be stored on the web

      Returns null | number | Statement<SubjectType, PredicateType, ObjectType, GraphType> | ConnectedStore

      The statement added to the store, or the store

      -
    • Adds all the statements to this formula

      Parameters

      • statements: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

        A collection of statements

        -

      Returns void

    • Add a callback which will be triggered after a statement has been added to the store.

      -

      Parameters

      • cb: ((q) => void)
          • (q): void
          • Parameters

            • q: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

            Returns void

      Returns void

    • Parameters

      • st: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

      Returns number

      Deprecated

      Use {add} instead

      -
    • Return all equivalent URIs by which this is known

      +

    Returns void

    • Add a callback which will be triggered after a statement has been added to the store.

      +

      Parameters

      • cb: ((q) => void)
          • (q): void
          • Parameters

            • q: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

            Returns void

      Returns void

    • Parameters

      • st: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

      Returns number

      Deprecated

      Use {add} instead

      +
    • Follow link from one node, using one wildcard, looking for one

      +

    Returns NamedNode[]

    • Follow link from one node, using one wildcard, looking for one

      For example, any(me, knows, null, profile) - a person I know accoring to my profile . any(me, knows, null, null) - a person I know accoring to anything in store . any(null, knows, me, null) - a person who know me accoring to anything in store .

      @@ -159,51 +159,51 @@
    • Optional o: null | Quad_Object

      A node to search for as object, or if null, a wildcard

    • Optional g: null | Quad_Graph

      A node to search for as graph, or if null, a wildcard

    Returns null | Node

    A node which match the wildcard position, or null

    -
    • Gets the first JavaScript object equivalent to a node based on the specified pattern

      +
    • Gets the first JavaScript object equivalent to a node based on the specified pattern

      Parameters

      • Optional s: null | Quad_Subject

        The subject

      • Optional p: null | Quad_Predicate

        The predicate

      • Optional o: null | Quad_Object

        The object

      • Optional g: null | Quad_Graph

        The graph that contains the statement

        -

      Returns any

    • Gets the first statement that matches the specified pattern

      -

      Parameters

      • Optional s: null | Quad_Subject
      • Optional p: null | Quad_Predicate
      • Optional o: null | Quad_Object
      • Optional g: null | Quad_Graph

      Returns undefined | Statement<SubjectType, PredicateType, ObjectType, GraphType>

    • Gets the value of a node that matches the specified pattern

      +

    Returns any

    • Gets the first statement that matches the specified pattern

      +

      Parameters

      • Optional s: null | Quad_Subject
      • Optional p: null | Quad_Predicate
      • Optional o: null | Quad_Object
      • Optional g: null | Quad_Graph

      Returns undefined | Statement<SubjectType, PredicateType, ObjectType, GraphType>

    • Gets the value of a node that matches the specified pattern

      Parameters

      • Optional s: null | Quad_Subject

        The subject

      • Optional p: null | Quad_Predicate

        The predicate

      • Optional o: null | Quad_Object

        The object

      • Optional g: null | Quad_Graph

        The graph that contains the statement

        -

      Returns string | void

    • Apply a set of statements to be deleted and to be inserted

      +

    Returns string | void

    • Apply a set of statements to be deleted and to be inserted

      Parameters

      • patch: {
            delete?: readonly Statement<SubjectType, PredicateType, ObjectType, GraphType>[];
            patch?: readonly Statement<SubjectType, PredicateType, ObjectType, GraphType>[];
            where?: any;
        }

        The set of statements to be deleted and to be inserted

        • Optional delete?: readonly Statement<SubjectType, PredicateType, ObjectType, GraphType>[]
        • Optional patch?: readonly Statement<SubjectType, PredicateType, ObjectType, GraphType>[]
        • Optional where?: any
      • target: NamedNode

        The name of the document to patch

      • patchCallback: ((errorString?) => void)

        Callback to be called when patching is complete

        -
          • (errorString?): void
          • Parameters

            • Optional errorString: string

            Returns void

      Returns void

    • Finds the types in the list which have no stored subtypes +

        • (errorString?): void
        • Parameters

          • Optional errorString: string

          Returns void

    Returns void

    • Finds the types in the list which have no stored subtypes These are a set of classes which provide by themselves complete information -- the other classes are redundant for those who know the class DAG.

      Parameters

      • types: any

        A map of the types

        -

      Returns any

    • Returns the symbol with canonical URI as smushed

      +

    Returns any

    • Returns the symbol with canonical URI as smushed

      Parameters

      • Optional term: Term

        An RDF node

        -

      Returns Node

    • Checks a list of statements for consistency

      +

    Returns Node

    • Checks a list of statements for consistency

      Parameters

      • sts: readonly Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

        The list of statements to check

      • Optional from: number

        An index with the array ['subject', 'predicate', 'object', 'why']

        -

      Returns boolean | void

    • Compares this node with another

      +

    Returns boolean | void

    • Trace statements which connect directly, or through bnodes

      +
    • Trace statements which connect directly, or through bnodes

      Parameters

      • subject: Quad_Subject

        The node to start looking for statments

      • doc: Quad_Graph

        The document to be searched, or null to search all documents

      • Optional excludePredicateURIs: readonly string[]

      Returns Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

      an array of statements, duplicate statements are suppresssed.

      -
    • replaces

      Parameters

      • template: Quad_Subject

        node to copy

      • target: Quad_Subject

        node to copy to

      • Optional flags: ("delete" | "two-direction")[]

        Whether or not to do a two-directional copy and/or delete triples

      Returns void

      Target

      and add appropriate triples removes no triples by default and is a one-direction replication

      -
    • Follow links from one node, using one wildcard.

      +

    Returns BlankNode

    • Follow links from one node, using one wildcard.

      For example, each(me, knows, null, profile) - people I know accoring to my profile . each(me, knows, null, null) - people I know accoring to anything in store . each(null, knows, me, null) - people who know me accoring to anything in store .

      @@ -214,38 +214,38 @@

    Returns Node[]

    • An array of nodes which match the wildcard position
    -
    • Test whether this formula is equals to {other}

      Parameters

      Returns boolean

    • Simplify graph in store when we realize two identifiers are equivalent +

    Returns boolean

    • Simplify graph in store when we realize two identifiers are equivalent We replace the bigger with the smaller.

      Parameters

      • u1in: Term

        The first node

      • u2in: Term

        The second node

        -

      Returns boolean

    • For thisClass or any subclass, anything which has it is its type +

    Returns boolean

    • For thisClass or any subclass, anything which has it is its type or is the object of something which has the type as its range, or subject of something which has the type as its domain We don't bother doing subproperty (yet?)as it doesn't seeem to be used much. Get all the Classes of which we can RDFS-infer the subject is a member

      Parameters

      • subject: Node

        A named node

        -

      Returns UriMap

    • For thisClass or any subclass, anything which has it is its type +

    Returns UriMap

    • For thisClass or any subclass, anything which has it is its type or is the object of something which has the type as its range, or subject of something which has the type as its domain We don't bother doing subproperty (yet?)as it doesn't seeem to be used much. Get all the Classes of which we can RDFS-infer the subject is a member

      Parameters

      • thisClass: any

      Returns MembersMap

      a hash of URIs

      -
    • Get all the Classes of which we can RDFS-infer the subject is a superclass +

    • Get all the Classes of which we can RDFS-infer the subject is a superclass Returns a hash table where key is NT of type and value is statement why we think so. Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

      -

      Parameters

      Returns {
          [uri: string]: boolean;
      }

      • [uri: string]: boolean
    • Get all the Classes of which we can RDFS-infer the subject is a subclass

      +

      Parameters

      Returns {
          [uri: string]: boolean;
      }

      • [uri: string]: boolean
    • Get all the Classes of which we can RDFS-infer the subject is a subclass

      Parameters

      • subject: Node

        The thing whose classes are to be found

      Returns {
          [uri: string]: boolean;
      }

      a hash table where key is NT of type and value is statement why we think so. Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

      -
      • [uri: string]: boolean
    • Get all the Classes of which we can RDFS-infer the subject is a member todo: This will loop is there is a class subclass loop (Sublass loops are not illegal) Returns a hash table where key is NT of type and value is statement why we @@ -253,91 +253,91 @@ Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

      Parameters

      • subject: Quad_Subject

        A subject node

        -

      Returns UriMap

    • Get all the Classes of which we can RDFS-infer the subject is a member +

    Returns UriMap

    • Get all the Classes of which we can RDFS-infer the subject is a member todo: This will loop is there is a class subclass loop (Sublass loops are not illegal)

      Parameters

      • subject: any

        The thing whose classes are to be found

      Returns {
          [uri: string]: boolean;
      }

      a hash table where key is NT of type and value is statement why we think so. Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

      -
      • [uri: string]: boolean
    • Creates a new empty indexed formula Only applicable for IndexedFormula, but TypeScript won't allow a subclass to override a property

      Parameters

      • features: FeaturesType

        The list of features

        -

      Returns Store

    • Transforms an NTriples string format into a Node. +

    Returns Store

    • Transforms an NTriples string format into a Node. The blank node bit should not be used on program-external values; designed for internal work such as storing a blank node id in an HTML attribute. This will only parse the strings generated by the various toNT() methods.

      -

      Parameters

      • str: any

      Returns any

    • Returns true if this formula holds the specified statement(s)

      -

      Parameters

      • s: any
      • Optional p: any
      • Optional o: any
      • Optional g: any

      Returns boolean

    • Returns true if this formula holds the specified {statement}

      -

      Parameters

      • statement: any

      Returns boolean

    • Returns true if this formula holds the specified statement(s)

      +

      Parameters

      • s: any
      • Optional p: any
      • Optional o: any
      • Optional g: any

      Returns boolean

    • Returns true if this formula holds the specified {statement}

      +

      Parameters

      • statement: any

      Returns boolean

    • Returns a unique index-safe identifier for the given term.

      Falls back to the rdflib hashString implementation if the given factory doesn't support id.

      -

      Parameters

      • term: TFIDFactoryTypes

      Returns Indexable

    • Used by the n3parser to generate list elements

      +

      Parameters

      • term: TFIDFactoryTypes

      Returns Indexable

    • Used by the n3parser to generate list elements

      Parameters

      • values: any

        The values of the collection

      • context: any

        The store

      Returns any

      • The term for the statement
      -
    • Returns any quads matching the given arguments. +

    • Returns any quads matching the given arguments. Standard RDFJS spec method for Source objects, implemented as an alias to statementsMatching()

      Parameters

      • Optional subject: null | Quad_Subject

        The subject

      • Optional predicate: null | Quad_Predicate

        The predicate

      • Optional object: null | Quad_Object

        The object

      • Optional graph: null | Quad_Graph

        The graph that contains the statement

        -

      Returns Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

    • Find out whether a given URI is used as symbol in the formula

      +

    Returns Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

    • Find out whether a given URI is used as symbol in the formula

      Parameters

      • uri: string

        The URI to look for

        -

      Returns boolean

    • Existentials are BNodes - something exists without naming

      +

    Returns boolean

    • Existentials are BNodes - something exists without naming

      Parameters

      • uri: string

        An URI

        -

      Returns Term

    • Adds a new property action

      +

    Returns Term

    • Adds a new property action

      Parameters

      • pred: Quad_Predicate

        the predicate that the function should be triggered on

      • action: ((store, subject, predicate, object) => boolean)

        the function that should trigger

        -
          • (store, subject, predicate, object): boolean
          • Parameters

            • store: Store
            • subject: Quad_Subject
            • predicate: Quad_Predicate
            • object: Quad_Object

            Returns boolean

      Returns boolean

    • Creates a new universal node +

        • (store, subject, predicate, object): boolean
        • Parameters

          • store: Store
          • subject: Quad_Subject
          • predicate: Quad_Predicate
          • object: Quad_Object

          Returns boolean

    Returns boolean

    • Creates a new universal node Universals are Variables

      Parameters

      • uri: string

        An URI

        -

      Returns NamedNode

    • Find an unused id for a file being edited: return a symbol +

    Returns NamedNode

    • Find an unused id for a file being edited: return a symbol (Note: Slow iff a lot of them -- could be O(log(k)) )

      Parameters

      • doc: NamedNode

        A document named node

        -

      Returns NamedNode

    • Query this store asynchronously, return bindings in callback

      +

    Returns NamedNode

    • Query this store asynchronously, return bindings in callback

      Parameters

      • myQuery: Query

        The query to be run

      • callback: ((bindings) => void)

        Function to call when bindings

          • (bindings): void
          • Parameters

            • bindings: Bindings

            Returns void

      • Optional fetcher: null | Fetcher
      • Optional onDone: (() => void)

        OBSOLETE - do not use this // @@ Why not ?? Called when query complete

        -
          • (): void
          • Returns void

      Returns void

    • Query this store synchronously and return bindings

      +
        • (): void
        • Returns void

    Returns void

    • Query this store synchronously and return bindings

      Parameters

      • myQuery: Query

        The query to be run

        -

      Returns any[]

    • Removes one or multiple statement(s) from this formula

      +

    Returns any[]

    • Removes one or multiple statement(s) from this formula

      Parameters

      • st: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph> | Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

        A Statement or array of Statements to remove

        -

      Returns Store

    • Removes all statements in a doc, along with the related metadata including request/response/status

      +

    Returns Store

    • Removes all statements in a doc, along with the related metadata including request/response/status

      Parameters

      • doc: Quad_Graph

        The document / graph

        -

      Returns Store

    • Remove all statements matching args (within limit) *

      +

    Returns Store

    • Remove all statements matching args (within limit) *

      Parameters

      • Optional subj: null | Quad_Subject

        The subject

      • Optional pred: null | Quad_Predicate

        The predicate

      • Optional obj: null | Quad_Object

        The object

      • Optional why: null | Quad_Graph

        The graph that contains the statement

      • Optional limit: number

        The number of statements to remove

        -

      Returns void

    • Remove all matching statements

      +

    Returns void

    • Remove all matching statements

      Parameters

      • Optional subject: null | Quad_Subject

        The subject

      • Optional predicate: null | Quad_Predicate

        The predicate

      • Optional object: null | Quad_Object

        The object

      • Optional graph: null | Quad_Graph

        The graph that contains the statement

        -

      Returns Store

    • Remove a particular statement object from the store

      +

    Returns Store

    • Remove a particular statement object from the store

      Parameters

      • st: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

        a statement which is already in the store and indexed. Make sure you only use this for these. Otherwise, you should use remove() above.

        -

      Returns Store

    • Removes statements

      +

    Returns Store

    • Removes statements

      Parameters

      • sts: readonly Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

        The statements to remove

        -

      Returns Store

    • Replace big with small, obsoleted with obsoleting.

      -

      Parameters

      • big: Quad_Subject
      • small: Quad_Subject

      Returns boolean

    • Compares whether this node is the same as the other one

      +

    Returns Store

    • Replace big with small, obsoleted with obsoleting.

      +

      Parameters

      • big: Quad_Subject
      • small: Quad_Subject

      Returns boolean

    • Compare by canonical URI as smushed

      +

    Returns boolean

    • Serializes this formula

      +

    Returns boolean

    • Serializes this formula

      Parameters

      • base: any

        The base string

      • contentType: any

        The content type of the syntax to use

      • provenance: any

        The provenance URI

      • Optional options: any

        options to pass to the serializer, as defined in serialize method

        -

      Returns undefined | string

    • Search the Store

      +

    Returns undefined | string

    • Search the Store

      ALL CONVENIENCE LOOKUP FUNCTIONS RELY ON THIS!

      Parameters

      • Optional subj: null | Quad_Subject

        A node to search for as subject, or if null, a wildcard

      • Optional pred: null | Quad_Predicate

        A node to search for as predicate, or if null, a wildcard

        @@ -345,33 +345,33 @@
      • Optional why: null | Quad_Graph

        A node to search for as graph, or if null, a wildcard

      • Optional justOne: boolean

        flag - stop when found one rather than get all of them?

      Returns Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

      An array of nodes which match the wildcard position

      -
    • Gets this graph with the bindings substituted

      Type Parameters

      Parameters

      • bindings: Bindings

        The bindings

        -

      Returns T

    • Gets the node matching the specified pattern. Throws when no match could be made.

      +

    Returns T

    • Gets the node matching the specified pattern. Throws when no match could be made.

      Parameters

      • Optional s: null | Quad_Subject

        The subject

      • Optional p: null | Quad_Predicate

        The predicate

      • Optional o: null | Quad_Object

        The object

      • Optional g: null | Quad_Graph

        The graph that contains the statement

        -

      Returns undefined | null | Node

    • Finds the types in the list which have no stored supertypes +

    Returns undefined | null | Node

    • Finds the types in the list which have no stored supertypes We exclude the universal class, owl:Things and rdf:Resource, as it is information-free.

      Parameters

      • types: {
            [id: string]: string | NamedNode;
        }

        The types

        -

      Returns {
          [id: string]: string | NamedNode;
      }

    • RDFS Inference +

    Returns {
        [id: string]: string | NamedNode;
    }

    • RDFS Inference These are hand-written implementations of a backward-chaining reasoner over the RDFS axioms.

      Parameters

      • seeds: BooleanMap

        A hash of NTs of classes to start with

      • predicate: Quad_Predicate

        The property to trace though

      • Optional inverse: boolean

        Trace inverse direction

        -

      Returns {
          [uri: string]: boolean;
      }

      • [uri: string]: boolean
    • A list of all the URIs by which this thing is known

      -

      Parameters

      • term: Quad_Subject

      Returns string[]

    • Gets a new variable

      +

    Returns {
        [uri: string]: boolean;
    }

    • [uri: string]: boolean
    • A list of all the URIs by which this thing is known

      +

      Parameters

      • term: Quad_Subject

      Returns string[]

    • Gets the number of statements in this formula that matches the specified pattern

      +

    Returns Variable

    • Gets the number of statements in this formula that matches the specified pattern

      Parameters

      • Optional s: null | Quad_Subject

        The subject

      • Optional p: null | Quad_Predicate

        The predicate

      • Optional o: null | Quad_Object

        The object

      • Optional g: null | Quad_Graph

        The graph that contains the statement

        -

      Returns number

    \ No newline at end of file +

    Returns number

    \ No newline at end of file diff --git a/doc/classes/Empty.html b/doc/classes/Empty.html index 1971c353d..d5fe5e829 100644 --- a/doc/classes/Empty.html +++ b/doc/classes/Empty.html @@ -1,5 +1,5 @@ Empty | rdflib

    Class Empty

    An empty node

    -

    Hierarchy (view full)

    Implements

    • Term

    Constructors

    Hierarchy (view full)

    Implements

    • Term

    Constructors

    Properties

    classOrder termType value @@ -14,22 +14,22 @@ toNQ toNT toString -

    Constructors

    Properties

    classOrder: number

    The class order for this node

    -
    termType: "Empty" = EmptyTermType

    The type of node

    -
    value: string

    The node's value

    -
    fromValue: (<T>(value) => T)

    Type declaration

      • <T>(value): T
      • Type Parameters

        • T extends FromValueReturns

        Parameters

        • value: ValueType

        Returns T

    toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

    Type declaration

      • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
      • Parameters

        • term: any

        Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

    Methods

    • Compares this node with another

      +

    Constructors

    Properties

    classOrder: number

    The class order for this node

    +
    termType: "Empty" = EmptyTermType

    The type of node

    +
    value: string

    The node's value

    +
    fromValue: (<T>(value) => T)

    Type declaration

      • <T>(value): T
      • Type Parameters

        • T extends FromValueReturns

        Parameters

        • value: ValueType

        Returns T

    toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

    Type declaration

      • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
      • Parameters

        • term: any

        Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

    Methods

    • Compares whether the two nodes are equal

      Parameters

      • other: Term

        The other node

        -

      Returns boolean

    • Creates a hash for this node

      +

    Returns boolean

    • Creates the substituted node for this one, according to the specified bindings

      +

    Returns boolean

    • Creates the substituted node for this one, according to the specified bindings

      Type Parameters

      Parameters

      • bindings: Bindings

        Bindings of identifiers to nodes

        -

      Returns T

    \ No newline at end of file +

    Returns T

    \ No newline at end of file diff --git a/doc/classes/Fetcher.html b/doc/classes/Fetcher.html index 16ed55253..d070d7682 100644 --- a/doc/classes/Fetcher.html +++ b/doc/classes/Fetcher.html @@ -6,7 +6,7 @@
  • figuring how to parse them. It will also refresh, remove, the data
  • and put back the data to the web.
  • -

    Implements

    • CallbackifyInterface

    Constructors

    Implements

    • CallbackifyInterface

    Constructors

    Properties

    _fetch: Fetch
    appNode: NamedNode

    Denoting this session

    -
    fetchCallbacks: FetchCallbacks

    fetchCallbacks[uri].push(callback)

    -
    fetchQueue: FetchQueue
    fireCallbacks: Function

    Methods added by calling Util.callbackify in the constructor

    -
    handlers: typeof Handler[]
    lookedUp: BooleanMap
    mediatypes: MediatypesMap
    nonexistent: BooleanMap

    Keep track of explicit 404s -> we can overwrite etc

    -
    ns: {
        [k: string]: ((ln) => Quad_Predicate);
    }

    Type declaration

    • [k: string]: ((ln) => Quad_Predicate)
        • (ln): Quad_Predicate
        • Parameters

          • ln: string

          Returns Quad_Predicate

    redirectedTo: Record<string, string>

    Redirected from key uri to value uri

    -
    requested: RequestedMap

    this.requested[uri] states: +

    Constructors

    Properties

    _fetch: Fetch
    appNode: NamedNode

    Denoting this session

    +
    fetchCallbacks: FetchCallbacks

    fetchCallbacks[uri].push(callback)

    +
    fetchQueue: FetchQueue
    fireCallbacks: Function

    Methods added by calling Util.callbackify in the constructor

    +
    handlers: typeof Handler[]
    lookedUp: BooleanMap
    mediatypes: MediatypesMap
    nonexistent: BooleanMap

    Keep track of explicit 404s -> we can overwrite etc

    +
    ns: {
        [k: string]: ((ln) => Quad_Predicate);
    }

    Type declaration

    • [k: string]: ((ln) => Quad_Predicate)
        • (ln): Quad_Predicate
        • Parameters

          • ln: string

          Returns Quad_Predicate

    redirectedTo: Record<string, string>

    Redirected from key uri to value uri

    +
    requested: RequestedMap

    this.requested[uri] states: undefined no record of web access or records reset true has been requested, fetch in progress 'done' received, Ok @@ -90,39 +90,39 @@ 'parse_error' Parse error 'unsupported_protocol' URI is not a protocol Fetcher can deal with other strings mean various other errors.

    -
    store: Store
    timeout: number
    timeouts: TimeOutsMap

    List of timeouts associated with a requested URL

    -
    CONTENT_TYPE_BY_EXT: Record<string, string>
    HANDLERS: {
        [handlerName: number]: Handler;
    }

    Type declaration

    • [handlerName: number]: Handler
    crossSiteProxyTemplate: any

    Methods

    • Parameters

      • uri: string
      • callback: UserCallback

      Returns void

    • Parameters

      • handler: typeof Handler

      Returns void

    • Records a status message (as a literal node) by appending it to the +

    store: Store
    timeout: number
    timeouts: TimeOutsMap

    List of timeouts associated with a requested URL

    +
    CONTENT_TYPE_BY_EXT: Record<string, string>
    HANDLERS: {
        [handlerName: number]: Handler;
    }

    Type declaration

    • [handlerName: number]: Handler
    crossSiteProxyTemplate: any

    Methods

    • Parameters

      • uri: string
      • callback: UserCallback

      Returns void

    • Parameters

      • handler: typeof Handler

      Returns void

    • Records a status message (as a literal node) by appending it to the request's metadata status collection.

      -

      Parameters

      • req: BlankNode
      • statusMessage: string

      Returns void

    • Parameters

      • rdfType: NamedNode
      • req: Quad_Subject
      • kb: Store
      • locURI: string

      Returns void

    • Parameters

      • originalUri: string
      • _options: any

        DEPRECATED

        -
      • timeout: number

      Returns void

    • Parameters

      • parentURI: string

        URI of parent container

        +

        Parameters

        • req: BlankNode
        • statusMessage: string

        Returns void

    • Parameters

      • rdfType: NamedNode
      • req: Quad_Subject
      • kb: Store
      • locURI: string

      Returns void

    • Parameters

      • originalUri: string
      • _options: any

        DEPRECATED

        +
      • timeout: number

      Returns void

    • Parameters

      • parentURI: string

        URI of parent container

      • folderName: string

        Optional folder name (slug)

      • data: string

        Optional folder metadata

        -

      Returns Promise<Response>

    • Create an empty resource if it really does not exist +

    Returns Promise<Response>

    • Create an empty resource if it really does not exist Be absolutely sure something does not exist before creating a new empty file as otherwise existing could be deleted.

      Parameters

      • doc: NamedNode

        The resource

        -
      • contentType: "text/turtle" = TurtleContentType
      • data: string = ''

      Returns Promise<ExtendedResponse>

    • Records errors in the system on failure:

      +
    • contentType: "text/turtle" = TurtleContentType
    • data: string = ''

    Returns Promise<ExtendedResponse>

    • Records errors in the system on failure:

      • Adds an entry to the request status collection
      • Adds an error triple with the fail message to the metadata
      • Fires the 'fail' callback
      • Rejects with an error result object, which has a response object if any
      -

      Parameters

      • options: {
            original: Quad_Subject;
            req: BlankNode;
        } & Partial<AutoInitOptions>
      • errorMessage: string
      • statusCode: StatusValues
      • Optional response: ExtendedResponse

      Returns Promise<FetchError>

    • Looks up response header.

      +
    • Looks up response header.

      Parameters

      • doc: NamedNode
      • header: string

      Returns undefined | string[]

      a list of header values found in a stored HTTP response, or [] if response was found but no header found, or undefined if no response is available. Looks for { [] link:requestedURI ?uri; link:response [ httph:header-name ?value ] }

      -
    • Parameters

      • uri: string

      Returns undefined | ContentType

    • Parameters

      • uri: string

      Returns undefined | ContentType

    • Parameters

      • iri: string | NamedNode

      Returns void

    • Parameters

      • iri: string | NamedNode

      Returns void

    • Tests whether a request is being made to a cross-site URI (for purposes of retrying with a proxy)

      -

      Parameters

      • uri: string

      Returns boolean

    • Parameters

      • docuri: string

      Returns boolean

    • Parameters

      • originalUri: NamedNode
      • rel: string
      • uri: string
      • why: Quad_Graph
      • Optional reverse: boolean

      Returns void

    • Promise-based load function

      +

      Parameters

      • uri: string

      Returns boolean

    • Parameters

      • docuri: string

      Returns boolean

    • Parameters

      • originalUri: NamedNode
      • rel: string
      • uri: string
      • why: Quad_Graph
      • Optional reverse: boolean

      Returns void

    • Promise-based load function

      Loads a web resource or resources into the store.

      A resource may be given as NamedNode object, or as a plain URI. an array of resources will be given, in which they will be fetched in parallel. @@ -130,16 +130,16 @@ This allows code like editable() for example to test things about the resource.

      Type Parameters

      • T extends string | NamedNode | (string | NamedNode)[]

      Parameters

      • uri: T

        {Array|Array|RDFlibNamedNode|string}

      • Optional options: Partial<AutoInitOptions> = {}

        {Object}

        -

      Returns T extends (string | NamedNode)[]
          ? Promise<Response[]>
          : Promise<Response>

    • Looks up something. +

    Returns T extends (string | NamedNode)[]
        ? Promise<Response[]>
        : Promise<Response>

    • Looks up something. Looks up all the URIs a things has.

      Parameters

      • term: Quad_Subject

        canonical term for the thing whose URI is to be dereferenced

      • rterm: Quad_Subject

        the resource which referred to this (for tracking bad links)

        -

      Returns Promise<Response> | Promise<Response>[]

    • Note two nodes are now smushed +

    Returns Promise<Response> | Promise<Response>[]

    • Note two nodes are now smushed If only one was flagged as looked up, then the new node is looked up again, which will make sure all the URIs are dereferenced

      -

      Parameters

      • was: Quad_Subject
      • now: Quad_Subject

      Returns void

    • Asks for a doc to be loaded if necessary then calls back

      +

      Parameters

      • was: Quad_Subject
      • now: Quad_Subject

      Returns void

    • Asks for a doc to be loaded if necessary then calls back

      Calling methods: nowOrWhenFetched (uri, userCallback) nowOrWhenFetched (uri, options, userCallback) @@ -158,12 +158,12 @@

      errmessage Text error message if not OK.

      response The fetch Response object (was: XHR) if there was was one includes response.status as the HTTP status if any.

      -

      Parameters

      • uriIn: string | NamedNode
      • Optional p2: Partial<AutoInitOptions> | UserCallback
      • Optional userCallback: UserCallback
      • options: Partial<AutoInitOptions> = {}

      Returns void

    • Parameters

      • linkHeader: string
      • originalUri: NamedNode
      • reqNode: Quad_Graph

      Returns void

    • Parameters

      Returns Promise<Response>

    • Writes back to the web what we have in the store for this uri

      -

      Parameters

      Returns Promise<Response>

    • Parameters

      • term: NamedNode
      • Optional userCallback: UserCallback

      Returns void

    • Parameters

      • term: NamedNode
      • userCallback: UserCallback

      Returns void

    • Parameters

      • docuri: string
      • options: any

      Returns Promise<Response>

    • Parameters

      • response: Response
      • options: {
            req: BlankNode;
            resource: Quad_Subject;
        } & Partial<AutoInitOptions>

      Returns BlankNode

    • Parameters

      • linkHeader: string
      • originalUri: NamedNode
      • reqNode: Quad_Graph

      Returns void

    • Parameters

      Returns Promise<Response>

    • Writes back to the web what we have in the store for this uri

      +

      Parameters

      Returns Promise<Response>

    • Parameters

      • term: NamedNode
      • Optional userCallback: UserCallback

      Returns void

    • Parameters

      • term: NamedNode
      • userCallback: UserCallback

      Returns void

    • Parameters

      • docuri: string
      • options: any

      Returns Promise<Response>

    • Parameters

      • response: Response
      • options: {
            req: BlankNode;
            resource: Quad_Subject;
        } & Partial<AutoInitOptions>

      Returns BlankNode

    • A generic web operation, at the fetch() level. does not involve the quad store.

      Returns promise of Response If data is returned, copies it to response.responseText before returning

      -

      Parameters

      • method: HTTPMethods
      • uriIn: string | NamedNode
      • options: Partial<AutoInitOptions> = {}

      Returns Promise<ExtendedResponse>

    • Parameters

      • uri: string

      Returns string

    • Decide on credentials using old XXHR api or new fetch() one

      -

      Parameters

      Returns void

    • Tests whether the uri's protocol is supported by the Fetcher.

      -

      Parameters

      • uri: string

      Returns boolean

    \ No newline at end of file +

    Parameters

    • method: HTTPMethods
    • uriIn: string | NamedNode
    • options: Partial<AutoInitOptions> = {}

    Returns Promise<ExtendedResponse>

    • Parameters

      • uri: string

      Returns string

    • Decide on credentials using old XXHR api or new fetch() one

      +

      Parameters

      Returns void

    • Tests whether the uri's protocol is supported by the Fetcher.

      +

      Parameters

      • uri: string

      Returns boolean

    \ No newline at end of file diff --git a/doc/classes/Formula.html b/doc/classes/Formula.html index 3cf8c979c..db4ff4962 100644 --- a/doc/classes/Formula.html +++ b/doc/classes/Formula.html @@ -1,5 +1,5 @@ Formula | rdflib

    Class Formula

    A formula, or store of RDF statements

    -

    Hierarchy (view full)

    Constructors

    Hierarchy (view full)

    Constructors

    Properties

    classOrder constraints fetcher? @@ -60,32 +60,32 @@
  • constraints: readonly any[] = []

    initial array of constraints

  • initBindings: readonly any[] = []

    initial bindings used in Query

  • optional: readonly any[] = []

    optional

    -
  • opts: FormulaOpts = {}
  • Returns Formula

    Properties

    classOrder: number = ClassOrder.Graph

    The class order for this node

    -
    constraints: readonly any[] = []

    initial array of constraints

    -
    fetcher?: Fetcher

    The accompanying fetcher instance.

    +
  • opts: FormulaOpts = {}
  • Returns Formula

    Properties

    classOrder: number = ClassOrder.Graph

    The class order for this node

    +
    constraints: readonly any[] = []

    initial array of constraints

    +
    fetcher?: Fetcher

    The accompanying fetcher instance.

    Is set by the fetcher when initialized.

    -
    initBindings: readonly any[] = []

    initial bindings used in Query

    -
    isVar: number = 0
    ns: ((nsuri, factory?) => ((ln) => NamedNode)) = Namespace

    A namespace for the specified namespace's URI

    +
    initBindings: readonly any[] = []

    initial bindings used in Query

    +
    isVar: number = 0
    ns: ((nsuri, factory?) => ((ln) => NamedNode)) = Namespace

    A namespace for the specified namespace's URI

    Type declaration

      • (nsuri, factory?): ((ln) => NamedNode)
      • Parameters

        • nsuri: string

          The URI for the namespace

          -
        • Optional factory: RdfJsDataFactory

        Returns ((ln) => NamedNode)

          • (ln): NamedNode
          • Parameters

            • ln: string

            Returns NamedNode

    optional: readonly any[] = []

    optional

    -
    rdfFactory: any

    The factory used to generate statements and terms

    -
    statements: Statement<SubjectType, PredicateType, ObjectType, GraphType>[] = []

    Initial array of statements

    -
    termType: "Graph" = GraphTermType

    The type of node

    -
    value: string

    The node's value

    -
    fromValue: (<T>(value) => T)

    Type declaration

      • <T>(value): T
      • Type Parameters

        • T extends FromValueReturns

        Parameters

        • value: ValueType

        Returns T

    toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

    Type declaration

      • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
      • Parameters

        • term: any

        Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

    Methods

    • Transform a collection of NTriple URIs into their URI strings

      +
    • Optional factory: RdfJsDataFactory

    Returns ((ln) => NamedNode)

      • (ln): NamedNode
      • Parameters

        • ln: string

        Returns NamedNode

    optional: readonly any[] = []

    optional

    +
    rdfFactory: any

    The factory used to generate statements and terms

    +
    statements: Statement<SubjectType, PredicateType, ObjectType, GraphType>[] = []

    Initial array of statements

    +
    termType: "Graph" = GraphTermType

    The type of node

    +
    value: string

    The node's value

    +
    fromValue: (<T>(value) => T)

    Type declaration

      • <T>(value): T
      • Type Parameters

        • T extends FromValueReturns

        Parameters

        • value: ValueType

        Returns T

    toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

    Type declaration

      • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
      • Parameters

        • term: any

        Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

    Methods

    • Transform a collection of NTriple URIs into their URI strings

      Parameters

      • t: any

        Some iterable collection of NTriple URI strings

      Returns {}

      A collection of the URIs as strings todo: explain why it is important to go through NT

      -
      • Add a statement from its parts

        +
        • Add a statement from its parts

          Parameters

          • subject: Quad_Subject | Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph> | Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

            the first part of the statement

          • Optional predicate: Quad_Predicate

            the second part of the statement

          • Optional object: string | Term

            the third part of the statement

          • Optional graph: Quad_Graph

            the last part of the statement

            -

          Returns null | number | Statement<SubjectType, PredicateType, ObjectType, GraphType> | Formula

        • Adds all the statements to this formula

          +

        Returns null | number | Statement<SubjectType, PredicateType, ObjectType, GraphType> | Formula

        • Adds all the statements to this formula

          Parameters

          • statements: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

            A collection of statements

            -

          Returns void

        • Add a statment object

          +

        Returns void

        • Add a statment object

          Parameters

          • statement: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

            An existing constructed statement to add

            -

          Returns null | number | Statement<SubjectType, PredicateType, ObjectType, GraphType> | Formula

        • Follow link from one node, using one wildcard, looking for one

          +

        Returns null | number | Statement<SubjectType, PredicateType, ObjectType, GraphType> | Formula

        • Follow link from one node, using one wildcard, looking for one

          For example, any(me, knows, null, profile) - a person I know accoring to my profile . any(me, knows, null, null) - a person I know accoring to anything in store . any(null, knows, me, null) - a person who know me accoring to anything in store .

          @@ -94,32 +94,32 @@
        • Optional o: null | Quad_Object

          A node to search for as object, or if null, a wildcard

        • Optional g: null | Quad_Graph

          A node to search for as graph, or if null, a wildcard

        Returns null | Node

        A node which match the wildcard position, or null

        -
        • Gets the first JavaScript object equivalent to a node based on the specified pattern

          +
        • Gets the first JavaScript object equivalent to a node based on the specified pattern

          Parameters

          • Optional s: null | Quad_Subject

            The subject

          • Optional p: null | Quad_Predicate

            The predicate

          • Optional o: null | Quad_Object

            The object

          • Optional g: null | Quad_Graph

            The graph that contains the statement

            -

          Returns any

        • Gets the first statement that matches the specified pattern

          -

          Parameters

          • Optional s: null | Quad_Subject
          • Optional p: null | Quad_Predicate
          • Optional o: null | Quad_Object
          • Optional g: null | Quad_Graph

          Returns undefined | Statement<SubjectType, PredicateType, ObjectType, GraphType>

        • Gets the value of a node that matches the specified pattern

          +

        Returns any

        • Gets the first statement that matches the specified pattern

          +

          Parameters

          • Optional s: null | Quad_Subject
          • Optional p: null | Quad_Predicate
          • Optional o: null | Quad_Object
          • Optional g: null | Quad_Graph

          Returns undefined | Statement<SubjectType, PredicateType, ObjectType, GraphType>

        • Gets the value of a node that matches the specified pattern

          Parameters

          • Optional s: null | Quad_Subject

            The subject

          • Optional p: null | Quad_Predicate

            The predicate

          • Optional o: null | Quad_Object

            The object

          • Optional g: null | Quad_Graph

            The graph that contains the statement

            -

          Returns string | void

        • Finds the types in the list which have no stored subtypes +

        Returns string | void

        • Finds the types in the list which have no stored subtypes These are a set of classes which provide by themselves complete information -- the other classes are redundant for those who know the class DAG.

          Parameters

          • types: any

            A map of the types

            -

          Returns any

        • Compares this node with another

          +

        Returns any

        • Trace statements which connect directly, or through bnodes

          +
        • Trace statements which connect directly, or through bnodes

          Parameters

          • subject: Quad_Subject

            The node to start looking for statments

          • doc: Quad_Graph

            The document to be searched, or null to search all documents

          • Optional excludePredicateURIs: readonly string[]

          Returns Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

          an array of statements, duplicate statements are suppresssed.

          -
        • Follow links from one node, using one wildcard.

          For example, each(me, knows, null, profile) - people I know accoring to my profile . each(me, knows, null, null) - people I know accoring to anything in store . each(null, knows, me, null) - people who know me accoring to anything in store .

          @@ -130,34 +130,34 @@

        Returns Node[]

        • An array of nodes which match the wildcard position
        -
        • Test whether this formula is equals to {other}

          +
        • Test whether this formula is equals to {other}

          Parameters

          Returns boolean

        • For thisClass or any subclass, anything which has it is its type +

        Returns boolean

        • For thisClass or any subclass, anything which has it is its type or is the object of something which has the type as its range, or subject of something which has the type as its domain We don't bother doing subproperty (yet?)as it doesn't seeem to be used much. Get all the Classes of which we can RDFS-infer the subject is a member

          Parameters

          • subject: Node

            A named node

            -

          Returns UriMap

        • For thisClass or any subclass, anything which has it is its type +

        Returns UriMap

        • For thisClass or any subclass, anything which has it is its type or is the object of something which has the type as its range, or subject of something which has the type as its domain We don't bother doing subproperty (yet?)as it doesn't seeem to be used much. Get all the Classes of which we can RDFS-infer the subject is a member

          Parameters

          • thisClass: any

          Returns MembersMap

          a hash of URIs

          -
        • Get all the Classes of which we can RDFS-infer the subject is a superclass +

        • Get all the Classes of which we can RDFS-infer the subject is a superclass Returns a hash table where key is NT of type and value is statement why we think so. Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

          -

          Parameters

          Returns {
              [uri: string]: boolean;
          }

          • [uri: string]: boolean
        • Get all the Classes of which we can RDFS-infer the subject is a subclass

          +

          Parameters

          Returns {
              [uri: string]: boolean;
          }

          • [uri: string]: boolean
        • Get all the Classes of which we can RDFS-infer the subject is a subclass

          Parameters

          • subject: Node

            The thing whose classes are to be found

          Returns {
              [uri: string]: boolean;
          }

          a hash table where key is NT of type and value is statement why we think so. Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

          -
          • [uri: string]: boolean
        • Get all the Classes of which we can RDFS-infer the subject is a member +

          • [uri: string]: boolean
        • Get all the Classes of which we can RDFS-infer the subject is a member todo: This will loop is there is a class subclass loop (Sublass loops are not illegal) Returns a hash table where key is NT of type and value is statement why we @@ -165,39 +165,39 @@ Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

          Parameters

          • subject: Quad_Subject

            A subject node

            -

          Returns UriMap

        • Get all the Classes of which we can RDFS-infer the subject is a member +

        Returns UriMap

        • Get all the Classes of which we can RDFS-infer the subject is a member todo: This will loop is there is a class subclass loop (Sublass loops are not illegal)

          Parameters

          • subject: any

            The thing whose classes are to be found

          Returns {
              [uri: string]: boolean;
          }

          a hash table where key is NT of type and value is statement why we think so. Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

          -
          • [uri: string]: boolean
        • Creates a new empty formula

          Parameters

          • Optional _features: readonly string[]

            Not applicable, but necessary for typing to pass

            -

          Returns Formula

        • Transforms an NTriples string format into a Node. +

        Returns Formula

        • Transforms an NTriples string format into a Node. The blank node bit should not be used on program-external values; designed for internal work such as storing a blank node id in an HTML attribute. This will only parse the strings generated by the various toNT() methods.

          -

          Parameters

          • str: any

          Returns any

        • Creates a hash for this node

          +

          Parameters

          • str: any

          Returns any

        • Returns true if this formula holds the specified statement(s)

          -

          Parameters

          • s: any
          • Optional p: any
          • Optional o: any
          • Optional g: any

          Returns boolean

        • Returns true if this formula holds the specified {statement}

          -

          Parameters

          • statement: any

          Returns boolean

        • Returns true if this formula holds the specified statement(s)

          +

          Parameters

          • s: any
          • Optional p: any
          • Optional o: any
          • Optional g: any

          Returns boolean

        • Returns true if this formula holds the specified {statement}

          +

          Parameters

          • statement: any

          Returns boolean

        • Returns a unique index-safe identifier for the given term.

          Falls back to the rdflib hashString implementation if the given factory doesn't support id.

          -

          Parameters

          • term: TFIDFactoryTypes

          Returns Indexable

        • Used by the n3parser to generate list elements

          +

          Parameters

          • term: TFIDFactoryTypes

          Returns Indexable

        • Used by the n3parser to generate list elements

          Parameters

          • values: any

            The values of the collection

          • context: any

            The store

          Returns any

          • The term for the statement
          -
        • Compares whether this node is the same as the other one

          +
        • Serializes this formula

          +

        Returns boolean

        • Serializes this formula

          Parameters

          • base: any

            The base string

          • contentType: any

            The content type of the syntax to use

          • provenance: any

            The provenance URI

          • Optional options: any

            options to pass to the serializer, as defined in serialize method

            -

          Returns undefined | string

        • Search the Store +

        Returns undefined | string

        • Search the Store This is really a teaching method as to do this properly you would use IndexedFormula

          Type Parameters

          • JustOne extends boolean = false

          Parameters

          • Optional s: null | Quad_Subject

            A node to search for as subject, or if null, a wildcard

          • Optional p: null | Quad_Predicate

            A node to search for as predicate, or if null, a wildcard

            @@ -207,32 +207,32 @@

          Returns Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

          • An array of nodes which match the wildcard position
          -
        • Creates a new formula with the substituting bindings applied

          +
        • Creates a new formula with the substituting bindings applied

          Type Parameters

          Parameters

          • bindings: Bindings

            The bindings to substitute

            -

          Returns T

        • Gets the node matching the specified pattern. Throws when no match could be made.

          +

        Returns T

        • Gets the node matching the specified pattern. Throws when no match could be made.

          Parameters

          • Optional s: null | Quad_Subject

            The subject

          • Optional p: null | Quad_Predicate

            The predicate

          • Optional o: null | Quad_Object

            The object

          • Optional g: null | Quad_Graph

            The graph that contains the statement

            -

          Returns undefined | null | Node

        • Finds the types in the list which have no stored supertypes +

        Returns undefined | null | Node

        • Finds the types in the list which have no stored supertypes We exclude the universal class, owl:Things and rdf:Resource, as it is information-free.

          Parameters

          • types: {
                [id: string]: string | NamedNode;
            }

            The types

            -

          Returns {
              [id: string]: string | NamedNode;
          }

        • RDFS Inference +

        Returns {
            [id: string]: string | NamedNode;
        }

        • RDFS Inference These are hand-written implementations of a backward-chaining reasoner over the RDFS axioms.

          Parameters

          • seeds: BooleanMap

            A hash of NTs of classes to start with

          • predicate: Quad_Predicate

            The property to trace though

          • Optional inverse: boolean

            Trace inverse direction

            -

          Returns {
              [uri: string]: boolean;
          }

          • [uri: string]: boolean
        • Gets a new variable

          +

        Returns {
            [uri: string]: boolean;
        }

        • [uri: string]: boolean
        • Gets the number of statements in this formula that matches the specified pattern

          +

        Returns Variable

        • Gets the number of statements in this formula that matches the specified pattern

          Parameters

          • Optional s: null | Quad_Subject

            The subject

          • Optional p: null | Quad_Predicate

            The predicate

          • Optional o: null | Quad_Object

            The object

          • Optional g: null | Quad_Graph

            The graph that contains the statement

            -

          Returns number

        \ No newline at end of file +

        Returns number

        \ No newline at end of file diff --git a/doc/classes/Literal.html b/doc/classes/Literal.html index dd3b834a5..0fcbbe18d 100644 --- a/doc/classes/Literal.html +++ b/doc/classes/Literal.html @@ -1,6 +1,6 @@ Literal | rdflib

        Class Literal

        An RDF literal, containing some value which isn't expressed as an IRI.

        Hierarchy (view full)

        Implements

        • Literal

        Constructors

        Hierarchy (view full)

        Implements

        • Literal

        Constructors

        Properties

        classOrder datatype isVar @@ -28,36 +28,36 @@

        Parameters

        • value: string

          The literal's lexical value

        • Optional language: null | string

          The language for the literal. Defaults to ''.

        • Optional datatype: any

          The literal's datatype as a named node. Defaults to xsd:string.

          -

        Returns Literal

        Properties

        classOrder: number = ClassOrder.Literal

        The class order for this node

        -
        datatype: NamedNode = XSD.string

        The literal's datatype as a named node

        -
        isVar: number = 0
        language: string = ''

        The language for the literal

        -
        termType: "Literal" = LiteralTermType

        The type of node

        -
        value: string

        The node's value

        -
        toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

        Type declaration

          • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
          • Parameters

            • term: any

            Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

        Accessors

        • get lang(): string
        • The language for the literal

          +

        Returns Literal

        Properties

        classOrder: number = ClassOrder.Literal

        The class order for this node

        +
        datatype: NamedNode = XSD.string

        The literal's datatype as a named node

        +
        isVar: number = 0
        language: string = ''

        The language for the literal

        +
        termType: "Literal" = LiteralTermType

        The type of node

        +
        value: string

        The node's value

        +
        toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

        Type declaration

          • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
          • Parameters

            • term: any

            Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

        Accessors

        • get lang(): string
        • The language for the literal

          Returns string

          Deprecated

          use {language} instead

          -
        • set lang(language): void
        • Parameters

          • language: string

          Returns void

        Methods

        • Compares this node with another

          +
        • set lang(language): void
        • Parameters

          • language: string

          Returns void

        Methods

        • Gets whether two literals are the same

          Parameters

          • other: Term

            The other statement

            -

          Returns boolean

        • Creates a hash for this node

          +

        Returns boolean

        • Creates the substituted node for this one, according to the specified bindings

          +

        Returns boolean

        • Creates the substituted node for this one, according to the specified bindings

          Type Parameters

          Parameters

          • bindings: Bindings

            Bindings of identifiers to nodes

            -

          Returns T

        • Creates a n-triples string representation of this node

          -

          Returns string

        • Builds a literal node from a boolean value

          +

        Returns T

        • Creates a n-triples string representation of this node

          +

          Returns string

        • Builds a literal node from a date value

          +

        Returns Literal

        • Builds a literal node from a number value

          +

        Returns Literal

        • Builds a literal node from an input value

          +

        Returns Literal

        • Builds a literal node from an input value

          Type Parameters

          • T extends FromValueReturns

          Parameters

          • value: ValueType

            The input value

            -

          Returns T

        • Serializes a literal to an N-Triples string

          -

          Parameters

          Returns string

        \ No newline at end of file +

        Returns T

        • Serializes a literal to an N-Triples string

          +

          Parameters

          Returns string

        \ No newline at end of file diff --git a/doc/classes/LiveStore.html b/doc/classes/LiveStore.html index d2dcf76da..1f1b13590 100644 --- a/doc/classes/LiveStore.html +++ b/doc/classes/LiveStore.html @@ -1,5 +1,5 @@ LiveStore | rdflib

        Class LiveStore

        Indexed Formula aka Store

        -

        Hierarchy (view full)

        Constructors

        Hierarchy (view full)

        Constructors

        Properties

        HTTPRedirects: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

        Redirections we got from HTTP

        -
        _existentialVariables?: BlankNode[]
        _universalVariables?: NamedNode[]
        aliases: any[]

        Reverse mapping to redirection: aliases for this

        -
        classActions: {
            [k: string]: Function[];
        }

        Map of iri predicates to functions to call when adding { s type X }

        -

        Type declaration

        • [k: string]: Function[]
        classOrder: number = ClassOrder.Graph

        The class order for this node

        -
        constraints: readonly any[] = []

        initial array of constraints

        -
        features: FeaturesType
        fetcher: Fetcher

        The accompanying fetcher instance.

        +

        Constructors

        Properties

        HTTPRedirects: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

        Redirections we got from HTTP

        +
        _existentialVariables?: BlankNode[]
        _universalVariables?: NamedNode[]
        aliases: any[]

        Reverse mapping to redirection: aliases for this

        +
        classActions: {
            [k: string]: Function[];
        }

        Map of iri predicates to functions to call when adding { s type X }

        +

        Type declaration

        • [k: string]: Function[]
        classOrder: number = ClassOrder.Graph

        The class order for this node

        +
        constraints: readonly any[] = []

        initial array of constraints

        +
        features: FeaturesType
        fetcher: Fetcher

        The accompanying fetcher instance.

        Is set by the fetcher when initialized.

        -
        index: [Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[]]
        initBindings: readonly any[] = []

        initial bindings used in Query

        -
        isVar: number = 0
        namespaces: {
            [key: string]: string;
        }

        Dictionary of namespace prefixes

        -

        Type declaration

        • [key: string]: string
        ns: ((nsuri, factory?) => ((ln) => NamedNode)) = Namespace

        A namespace for the specified namespace's URI

        +
        index: [Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[]]
        initBindings: readonly any[] = []

        initial bindings used in Query

        +
        isVar: number = 0
        namespaces: {
            [key: string]: string;
        }

        Dictionary of namespace prefixes

        +

        Type declaration

        • [key: string]: string
        ns: ((nsuri, factory?) => ((ln) => NamedNode)) = Namespace

        A namespace for the specified namespace's URI

        Type declaration

          • (nsuri, factory?): ((ln) => NamedNode)
          • Parameters

            • nsuri: string

              The URI for the namespace

              -
            • Optional factory: RdfJsDataFactory

            Returns ((ln) => NamedNode)

              • (ln): NamedNode
              • Parameters

                • ln: string

                Returns NamedNode

        objectIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

        Array of statements with this X as object

        -
        optional: readonly any[] = []

        optional

        -
        predicateIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

        Array of statements with this X as predicate

        -
        propertyActions: {
            [k: string]: Function[];
        }

        Map of iri predicates to functions to call when getting statement with {s X o}

        -

        Type declaration

        • [k: string]: Function[]
        rdfFactory: any

        The factory used to generate statements and terms

        -
        redirections: any[]

        Redirect to lexically smaller equivalent symbol

        -
        statements: Statement<SubjectType, PredicateType, ObjectType, GraphType>[] = []

        Initial array of statements

        -
        subjectIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

        Array of statements with this X as subject

        -
        termType: "Graph" = GraphTermType

        The type of node

        -
        updater: UpdateManager

        An UpdateManager initialised to this store

        -
        value: string

        The node's value

        -
        whyIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

        Array of statements with X as provenance

        -
        fromValue: (<T>(value) => T)

        Type declaration

          • <T>(value): T
          • Type Parameters

            • T extends FromValueReturns

            Parameters

            • value: ValueType

            Returns T

        handleRDFType: Function
        toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

        Type declaration

          • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
          • Parameters

            • term: any

            Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

        Accessors

        • get length(): number
        • Returns the number of statements contained in this IndexedFormula. +

        • Optional factory: RdfJsDataFactory

        Returns ((ln) => NamedNode)

          • (ln): NamedNode
          • Parameters

            • ln: string

            Returns NamedNode

        objectIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

        Array of statements with this X as object

        +
        optional: readonly any[] = []

        optional

        +
        predicateIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

        Array of statements with this X as predicate

        +
        propertyActions: {
            [k: string]: Function[];
        }

        Map of iri predicates to functions to call when getting statement with {s X o}

        +

        Type declaration

        • [k: string]: Function[]
        rdfFactory: any

        The factory used to generate statements and terms

        +
        redirections: any[]

        Redirect to lexically smaller equivalent symbol

        +
        statements: Statement<SubjectType, PredicateType, ObjectType, GraphType>[] = []

        Initial array of statements

        +
        subjectIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

        Array of statements with this X as subject

        +
        termType: "Graph" = GraphTermType

        The type of node

        +
        updater: UpdateManager

        An UpdateManager initialised to this store

        +
        value: string

        The node's value

        +
        whyIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

        Array of statements with X as provenance

        +
        fromValue: (<T>(value) => T)

        Type declaration

          • <T>(value): T
          • Type Parameters

            • T extends FromValueReturns

            Parameters

            • value: ValueType

            Returns T

        handleRDFType: Function
        toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

        Type declaration

          • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
          • Parameters

            • term: any

            Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

        Accessors

        • get length(): number
        • Returns the number of statements contained in this IndexedFormula. (Getter proxy to this.statements). Usage:

          var kb = rdf.graph()
          kb.length // -> 0
          -

          Returns number

        • get defaultGraphURI(): string
        • Gets the URI of the default graph

          -

          Returns string

        Methods

        • Transform a collection of NTriple URIs into their URI strings

          +

          Returns number

        • get defaultGraphURI(): string
        • Gets the URI of the default graph

          +

          Returns string

        Methods

        • Transform a collection of NTriple URIs into their URI strings

          Parameters

          • t: any

            Some iterable collection of NTriple URI strings

          Returns {}

          A collection of the URIs as strings todo: explain why it is important to go through NT

          -
          • Adds a triple (quad) to the store.

            Parameters

            • subj: Quad_Subject | Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph> | Statement<SubjectType, PredicateType, ObjectType, GraphType> | Statement<SubjectType, PredicateType, ObjectType, GraphType>[] | Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

              The thing about which the fact a relationship is asserted. Also accepts a statement or an array of Statements.

            • Optional pred: Quad_Predicate

              The relationship which is asserted

            • Optional obj: string | Term

              The object of the relationship, e.g. another thing or a value. If passed a string, this will become a literal.

            • Optional why: Quad_Graph

              The document in which the triple (S,P,O) was or will be stored on the web

            Returns null | number | Statement<SubjectType, PredicateType, ObjectType, GraphType> | LiveStore

            The statement added to the store, or the store

            -
          • Adds all the statements to this formula

            Parameters

            • statements: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

              A collection of statements

              -

            Returns void

          • Add a callback which will be triggered after a statement has been added to the store.

            -

            Parameters

            • cb: ((q) => void)
                • (q): void
                • Parameters

                  • q: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

                  Returns void

            Returns void

          • Return all equivalent URIs by which this is known

            +

          Returns void

          • Add a callback which will be triggered after a statement has been added to the store.

            +

            Parameters

            • cb: ((q) => void)
                • (q): void
                • Parameters

                  • q: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

                  Returns void

            Returns void

          • Follow link from one node, using one wildcard, looking for one

            +

          Returns NamedNode[]

          • Follow link from one node, using one wildcard, looking for one

            For example, any(me, knows, null, profile) - a person I know accoring to my profile . any(me, knows, null, null) - a person I know accoring to anything in store . any(null, knows, me, null) - a person who know me accoring to anything in store .

            @@ -159,51 +159,51 @@
          • Optional o: null | Quad_Object

            A node to search for as object, or if null, a wildcard

          • Optional g: null | Quad_Graph

            A node to search for as graph, or if null, a wildcard

          Returns null | Node

          A node which match the wildcard position, or null

          -
          • Gets the first JavaScript object equivalent to a node based on the specified pattern

            Parameters

            • Optional s: null | Quad_Subject

              The subject

            • Optional p: null | Quad_Predicate

              The predicate

            • Optional o: null | Quad_Object

              The object

            • Optional g: null | Quad_Graph

              The graph that contains the statement

              -

            Returns any

          • Gets the first statement that matches the specified pattern

            -

            Parameters

            • Optional s: null | Quad_Subject
            • Optional p: null | Quad_Predicate
            • Optional o: null | Quad_Object
            • Optional g: null | Quad_Graph

            Returns undefined | Statement<SubjectType, PredicateType, ObjectType, GraphType>

          • Gets the value of a node that matches the specified pattern

            +

          Returns any

          • Gets the first statement that matches the specified pattern

            +

            Parameters

            • Optional s: null | Quad_Subject
            • Optional p: null | Quad_Predicate
            • Optional o: null | Quad_Object
            • Optional g: null | Quad_Graph

            Returns undefined | Statement<SubjectType, PredicateType, ObjectType, GraphType>

          • Gets the value of a node that matches the specified pattern

            Parameters

            • Optional s: null | Quad_Subject

              The subject

            • Optional p: null | Quad_Predicate

              The predicate

            • Optional o: null | Quad_Object

              The object

            • Optional g: null | Quad_Graph

              The graph that contains the statement

              -

            Returns string | void

          • Apply a set of statements to be deleted and to be inserted

            +

          Returns string | void

          • Apply a set of statements to be deleted and to be inserted

            Parameters

            • patch: {
                  delete?: readonly Statement<SubjectType, PredicateType, ObjectType, GraphType>[];
                  patch?: readonly Statement<SubjectType, PredicateType, ObjectType, GraphType>[];
                  where?: any;
              }

              The set of statements to be deleted and to be inserted

              • Optional delete?: readonly Statement<SubjectType, PredicateType, ObjectType, GraphType>[]
              • Optional patch?: readonly Statement<SubjectType, PredicateType, ObjectType, GraphType>[]
              • Optional where?: any
            • target: NamedNode

              The name of the document to patch

            • patchCallback: ((errorString?) => void)

              Callback to be called when patching is complete

              -
                • (errorString?): void
                • Parameters

                  • Optional errorString: string

                  Returns void

            Returns void

          • Finds the types in the list which have no stored subtypes +

              • (errorString?): void
              • Parameters

                • Optional errorString: string

                Returns void

          Returns void

          • Finds the types in the list which have no stored subtypes These are a set of classes which provide by themselves complete information -- the other classes are redundant for those who know the class DAG.

            Parameters

            • types: any

              A map of the types

              -

            Returns any

          • Returns the symbol with canonical URI as smushed

            +

          Returns any

          • Checks a list of statements for consistency

            +

          Returns Node

          • Checks a list of statements for consistency

            Parameters

            • sts: readonly Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

              The list of statements to check

            • Optional from: number

              An index with the array ['subject', 'predicate', 'object', 'why']

              -

            Returns boolean | void

          • Compares this node with another

            +

          Returns boolean | void

          • Trace statements which connect directly, or through bnodes

            Parameters

            • subject: Quad_Subject

              The node to start looking for statments

            • doc: Quad_Graph

              The document to be searched, or null to search all documents

            • Optional excludePredicateURIs: readonly string[]

            Returns Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

            an array of statements, duplicate statements are suppresssed.

            -
          • replaces

            Parameters

            • template: Quad_Subject

              node to copy

            • target: Quad_Subject

              node to copy to

            • Optional flags: ("delete" | "two-direction")[]

              Whether or not to do a two-directional copy and/or delete triples

            Returns void

            Target

            and add appropriate triples removes no triples by default and is a one-direction replication

            -
          • Follow links from one node, using one wildcard.

            +

          Returns BlankNode

          • Follow links from one node, using one wildcard.

            For example, each(me, knows, null, profile) - people I know accoring to my profile . each(me, knows, null, null) - people I know accoring to anything in store . each(null, knows, me, null) - people who know me accoring to anything in store .

            @@ -214,38 +214,38 @@

          Returns Node[]

          • An array of nodes which match the wildcard position
          -
          • Simplify graph in store when we realize two identifiers are equivalent +

          Returns boolean

          • Simplify graph in store when we realize two identifiers are equivalent We replace the bigger with the smaller.

            Parameters

            • u1in: Term

              The first node

            • u2in: Term

              The second node

              -

            Returns boolean

          • For thisClass or any subclass, anything which has it is its type +

          Returns boolean

          • For thisClass or any subclass, anything which has it is its type or is the object of something which has the type as its range, or subject of something which has the type as its domain We don't bother doing subproperty (yet?)as it doesn't seeem to be used much. Get all the Classes of which we can RDFS-infer the subject is a member

            Parameters

            • subject: Node

              A named node

              -

            Returns UriMap

          • For thisClass or any subclass, anything which has it is its type +

          Returns UriMap

          • For thisClass or any subclass, anything which has it is its type or is the object of something which has the type as its range, or subject of something which has the type as its domain We don't bother doing subproperty (yet?)as it doesn't seeem to be used much. Get all the Classes of which we can RDFS-infer the subject is a member

            Parameters

            • thisClass: any

            Returns MembersMap

            a hash of URIs

            -
          • Get all the Classes of which we can RDFS-infer the subject is a superclass Returns a hash table where key is NT of type and value is statement why we think so. Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

            -

            Parameters

            Returns {
                [uri: string]: boolean;
            }

            • [uri: string]: boolean
          • Get all the Classes of which we can RDFS-infer the subject is a subclass

            +

            Parameters

            Returns {
                [uri: string]: boolean;
            }

            • [uri: string]: boolean
          • Get all the Classes of which we can RDFS-infer the subject is a subclass

            Parameters

            • subject: Node

              The thing whose classes are to be found

            Returns {
                [uri: string]: boolean;
            }

            a hash table where key is NT of type and value is statement why we think so. Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

            -
            • [uri: string]: boolean
          • Get all the Classes of which we can RDFS-infer the subject is a member todo: This will loop is there is a class subclass loop (Sublass loops are not illegal) Returns a hash table where key is NT of type and value is statement why we @@ -253,91 +253,91 @@ Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

            Parameters

            • subject: Quad_Subject

              A subject node

              -

            Returns UriMap

          • Get all the Classes of which we can RDFS-infer the subject is a member +

          Returns UriMap

          • Get all the Classes of which we can RDFS-infer the subject is a member todo: This will loop is there is a class subclass loop (Sublass loops are not illegal)

            Parameters

            • subject: any

              The thing whose classes are to be found

            Returns {
                [uri: string]: boolean;
            }

            a hash table where key is NT of type and value is statement why we think so. Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

            -
            • [uri: string]: boolean
          • Creates a new empty indexed formula Only applicable for IndexedFormula, but TypeScript won't allow a subclass to override a property

            Parameters

            • features: FeaturesType

              The list of features

              -

            Returns Store

          • Transforms an NTriples string format into a Node. +

          Returns Store

          • Transforms an NTriples string format into a Node. The blank node bit should not be used on program-external values; designed for internal work such as storing a blank node id in an HTML attribute. This will only parse the strings generated by the various toNT() methods.

            -

            Parameters

            • str: any

            Returns any

          • Returns true if this formula holds the specified statement(s)

            -

            Parameters

            • s: any
            • Optional p: any
            • Optional o: any
            • Optional g: any

            Returns boolean

          • Returns true if this formula holds the specified statement(s)

            +

            Parameters

            • s: any
            • Optional p: any
            • Optional o: any
            • Optional g: any

            Returns boolean

          • Returns a unique index-safe identifier for the given term.

            Falls back to the rdflib hashString implementation if the given factory doesn't support id.

            -

            Parameters

            • term: TFIDFactoryTypes

            Returns Indexable

          • Used by the n3parser to generate list elements

            +

            Parameters

            • term: TFIDFactoryTypes

            Returns Indexable

          • Used by the n3parser to generate list elements

            Parameters

            • values: any

              The values of the collection

            • context: any

              The store

            Returns any

            • The term for the statement
            -
          • Returns any quads matching the given arguments. +

          • Returns any quads matching the given arguments. Standard RDFJS spec method for Source objects, implemented as an alias to statementsMatching()

            Parameters

            • Optional subject: null | Quad_Subject

              The subject

            • Optional predicate: null | Quad_Predicate

              The predicate

            • Optional object: null | Quad_Object

              The object

            • Optional graph: null | Quad_Graph

              The graph that contains the statement

              -

            Returns Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

          • Find out whether a given URI is used as symbol in the formula

            +

          Returns Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

          • Find out whether a given URI is used as symbol in the formula

            Parameters

            • uri: string

              The URI to look for

              -

            Returns boolean

          • Existentials are BNodes - something exists without naming

            +

          Returns boolean

          • Adds a new property action

            +

          Returns Term

          • Adds a new property action

            Parameters

            • pred: Quad_Predicate

              the predicate that the function should be triggered on

            • action: ((store, subject, predicate, object) => boolean)

              the function that should trigger

              -
                • (store, subject, predicate, object): boolean
                • Parameters

                  • store: Store
                  • subject: Quad_Subject
                  • predicate: Quad_Predicate
                  • object: Quad_Object

                  Returns boolean

            Returns boolean

          • Creates a new universal node +

              • (store, subject, predicate, object): boolean
              • Parameters

                • store: Store
                • subject: Quad_Subject
                • predicate: Quad_Predicate
                • object: Quad_Object

                Returns boolean

          Returns boolean

          • Find an unused id for a file being edited: return a symbol +

          Returns NamedNode

          • Find an unused id for a file being edited: return a symbol (Note: Slow iff a lot of them -- could be O(log(k)) )

            Parameters

            • doc: NamedNode

              A document named node

              -

            Returns NamedNode

          • Query this store asynchronously, return bindings in callback

            +

          Returns NamedNode

          • Query this store asynchronously, return bindings in callback

            Parameters

            • myQuery: Query

              The query to be run

            • callback: ((bindings) => void)

              Function to call when bindings

                • (bindings): void
                • Parameters

                  • bindings: Bindings

                  Returns void

            • Optional fetcher: null | Fetcher
            • Optional onDone: (() => void)

              OBSOLETE - do not use this // @@ Why not ?? Called when query complete

              -
                • (): void
                • Returns void

            Returns void

          • Query this store synchronously and return bindings

            +
              • (): void
              • Returns void

          Returns void

          • Removes one or multiple statement(s) from this formula

            +

          Returns any[]

          • Removes one or multiple statement(s) from this formula

            Parameters

            • st: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph> | Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

              A Statement or array of Statements to remove

              -

            Returns Store

          • Removes all statements in a doc, along with the related metadata including request/response/status

            +

          Returns Store

          • Remove all statements matching args (within limit) *

            +

          Returns Store

          • Remove all statements matching args (within limit) *

            Parameters

            • Optional subj: null | Quad_Subject

              The subject

            • Optional pred: null | Quad_Predicate

              The predicate

            • Optional obj: null | Quad_Object

              The object

            • Optional why: null | Quad_Graph

              The graph that contains the statement

            • Optional limit: number

              The number of statements to remove

              -

            Returns void

          • Remove all matching statements

            +

          Returns void

          • Remove all matching statements

            Parameters

            • Optional subject: null | Quad_Subject

              The subject

            • Optional predicate: null | Quad_Predicate

              The predicate

            • Optional object: null | Quad_Object

              The object

            • Optional graph: null | Quad_Graph

              The graph that contains the statement

              -

            Returns Store

          • Remove a particular statement object from the store

            +

          Returns Store

          • Remove a particular statement object from the store

            Parameters

            • st: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

              a statement which is already in the store and indexed. Make sure you only use this for these. Otherwise, you should use remove() above.

              -

            Returns Store

          • Removes statements

            +

          Returns Store

          • Replace big with small, obsoleted with obsoleting.

            -

            Parameters

            • big: Quad_Subject
            • small: Quad_Subject

            Returns boolean

          • Compares whether this node is the same as the other one

            +

          Returns Store

          • Replace big with small, obsoleted with obsoleting.

            +

            Parameters

            • big: Quad_Subject
            • small: Quad_Subject

            Returns boolean

          • Compare by canonical URI as smushed

            +

          Returns boolean

          • Serializes this formula

            +

          Returns boolean

          • Serializes this formula

            Parameters

            • base: any

              The base string

            • contentType: any

              The content type of the syntax to use

            • provenance: any

              The provenance URI

            • Optional options: any

              options to pass to the serializer, as defined in serialize method

              -

            Returns undefined | string

          • Search the Store

            +

          Returns undefined | string

          • Search the Store

            ALL CONVENIENCE LOOKUP FUNCTIONS RELY ON THIS!

            Parameters

            • Optional subj: null | Quad_Subject

              A node to search for as subject, or if null, a wildcard

            • Optional pred: null | Quad_Predicate

              A node to search for as predicate, or if null, a wildcard

              @@ -345,33 +345,33 @@
            • Optional why: null | Quad_Graph

              A node to search for as graph, or if null, a wildcard

            • Optional justOne: boolean

              flag - stop when found one rather than get all of them?

            Returns Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

            An array of nodes which match the wildcard position

            -
          • Gets the node matching the specified pattern. Throws when no match could be made.

            +

          Returns T

          • Gets the node matching the specified pattern. Throws when no match could be made.

            Parameters

            • Optional s: null | Quad_Subject

              The subject

            • Optional p: null | Quad_Predicate

              The predicate

            • Optional o: null | Quad_Object

              The object

            • Optional g: null | Quad_Graph

              The graph that contains the statement

              -

            Returns undefined | null | Node

          • Finds the types in the list which have no stored supertypes +

          Returns undefined | null | Node

          • Finds the types in the list which have no stored supertypes We exclude the universal class, owl:Things and rdf:Resource, as it is information-free.

            Parameters

            • types: {
                  [id: string]: string | NamedNode;
              }

              The types

              -

            Returns {
                [id: string]: string | NamedNode;
            }

          • RDFS Inference +

          Returns {
              [id: string]: string | NamedNode;
          }

          • RDFS Inference These are hand-written implementations of a backward-chaining reasoner over the RDFS axioms.

            Parameters

            • seeds: BooleanMap

              A hash of NTs of classes to start with

            • predicate: Quad_Predicate

              The property to trace though

            • Optional inverse: boolean

              Trace inverse direction

              -

            Returns {
                [uri: string]: boolean;
            }

            • [uri: string]: boolean
          • A list of all the URIs by which this thing is known

            -

            Parameters

            • term: Quad_Subject

            Returns string[]

          • Gets a new variable

            +

          Returns {
              [uri: string]: boolean;
          }

          • [uri: string]: boolean
          • A list of all the URIs by which this thing is known

            +

            Parameters

            • term: Quad_Subject

            Returns string[]

          • Gets the number of statements in this formula that matches the specified pattern

            +

          Returns Variable

          • Gets the number of statements in this formula that matches the specified pattern

            Parameters

            • Optional s: null | Quad_Subject

              The subject

            • Optional p: null | Quad_Predicate

              The predicate

            • Optional o: null | Quad_Object

              The object

            • Optional g: null | Quad_Graph

              The graph that contains the statement

              -

            Returns number

          \ No newline at end of file +

          Returns number

          \ No newline at end of file diff --git a/doc/classes/NamedNode-1.html b/doc/classes/NamedNode-1.html index 29a0340ad..e9731d7fa 100644 --- a/doc/classes/NamedNode-1.html +++ b/doc/classes/NamedNode-1.html @@ -1,5 +1,5 @@ NamedNode | rdflib

          Class NamedNode

          A named (IRI) RDF node

          -

          Hierarchy (view full)

          Implements

          • NamedNode

          Constructors

          Hierarchy (view full)

          Implements

          • NamedNode

          Constructors

          Properties

          classOrder termType value @@ -21,31 +21,31 @@ fromValue

          Constructors

          Properties

          classOrder: number = ClassOrder.NamedNode

          The class order for this node

          -
          termType: "NamedNode" = NamedNodeTermType

          The type of node

          -
          value: string

          The node's value

          -
          toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

          Type declaration

            • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
            • Parameters

              • term: any

              Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

          Accessors

          Methods

          • Compares this node with another

            +

          Returns NamedNode

          Properties

          classOrder: number = ClassOrder.NamedNode

          The class order for this node

          +
          termType: "NamedNode" = NamedNodeTermType

          The type of node

          +
          value: string

          The node's value

          +
          toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

          Type declaration

            • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
            • Parameters

              • term: any

              Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

          Accessors

          Methods

          • Compares whether the two nodes are equal

            Parameters

            • other: Term

              The other node

              -

            Returns boolean

          • Creates a hash for this node

            +

          Returns boolean

          • Returns an NN for the whole web site, ending in slash. +

          Returns boolean

          • Creates the substituted node for this one, according to the specified bindings

            Type Parameters

            Parameters

            • bindings: Bindings

              Bindings of identifiers to nodes

              -

            Returns T

          • Creates a named node from the specified input value

            +

          Returns T

          • Creates a named node from the specified input value

            Parameters

            • value: any

              An input value

              -

            Returns any

          \ No newline at end of file +

          Returns any

          \ No newline at end of file diff --git a/doc/classes/Node.html b/doc/classes/Node.html index 71fdd6dc0..341f9fe9e 100644 --- a/doc/classes/Node.html +++ b/doc/classes/Node.html @@ -4,7 +4,7 @@ Also called Term.

          Hierarchy (view full)

          Constructors

          Hierarchy (view full)

          Constructors

          Properties

          classOrder termType value @@ -19,22 +19,22 @@ toNQ toNT toString -

          Constructors

          Properties

          classOrder: number

          The class order for this node

          -
          termType: TermType

          The type of node

          -
          value: string

          The node's value

          -
          fromValue: (<T>(value) => T)

          Type declaration

            • <T>(value): T
            • Type Parameters

              • T extends FromValueReturns

              Parameters

              • value: ValueType

              Returns T

          toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

          Type declaration

            • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
            • Parameters

              • term: any

              Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

          Methods

          • Compares this node with another

            +

          Constructors

          Properties

          classOrder: number

          The class order for this node

          +
          termType: TermType

          The type of node

          +
          value: string

          The node's value

          +
          fromValue: (<T>(value) => T)

          Type declaration

            • <T>(value): T
            • Type Parameters

              • T extends FromValueReturns

              Parameters

              • value: ValueType

              Returns T

          toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

          Type declaration

            • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
            • Parameters

              • term: any

              Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

          Methods

          • Compares this node with another

            Parameters

            • other: Node

              The other node

            Returns number

            See

            to check if two nodes are equal

            -
          • Compares whether the two nodes are equal

            Parameters

            • other: Term

              The other node

              -

            Returns boolean

          • Creates a hash for this node

            +

          Returns boolean

          • Creates a hash for this node

            Returns string

            Deprecated

            use {rdfFactory.id} instead if possible

            -
          • Compares whether this node is the same as the other one

            +
          • Compares whether this node is the same as the other one

            Parameters

            • other: Node

              Another node

              -

            Returns boolean

          • Creates the substituted node for this one, according to the specified bindings

            +

          Returns boolean

          • Creates the substituted node for this one, according to the specified bindings

            Type Parameters

            Parameters

            • bindings: Bindings

              Bindings of identifiers to nodes

              -

            Returns T

          • Creates a canonical string representation of this node

            -

            Returns string

          • Creates a n-triples string representation of this node

            -

            Returns string

          \ No newline at end of file +

          Returns T

          • Creates a canonical string representation of this node

            +

            Returns string

          • Creates a n-triples string representation of this node

            +

            Returns string

          \ No newline at end of file diff --git a/doc/classes/Query.html b/doc/classes/Query.html index 17c3e1343..7d21df099 100644 --- a/doc/classes/Query.html +++ b/doc/classes/Query.html @@ -1,7 +1,7 @@ Query | rdflib

          Class Query

          Query class, for tracking queries the user has in the UI.

          -

          Constructors

          Constructors

          Properties

          Constructors

          Properties

          id: any
          name: any
          pat: Store
          vars: any[]
          \ No newline at end of file +

          Constructors

          Properties

          id: any
          name: any
          pat: Store
          vars: any[]
          \ No newline at end of file diff --git a/doc/classes/RDFParser.html b/doc/classes/RDFParser.html index 58b34b502..7a68286c3 100644 --- a/doc/classes/RDFParser.html +++ b/doc/classes/RDFParser.html @@ -1,4 +1,4 @@ -RDFParser | rdflib

          Class RDFParser

          Constructors

          constructor +RDFParser | rdflib

          Class RDFParser

          Constructors

          Properties

          base bnodes reify @@ -8,12 +8,12 @@

          Methods

          Constructors

          Properties

          base: undefined | string
          bnodes: {}

          Type declaration

            reify: boolean
            why: any
            nodeType: {
                ATTRIBUTE: number;
                CDATA_SECTION: number;
                COMMENT: number;
                DOCUMENT: number;
                DOCUMENT_FRAGMENT: number;
                DOCUMENT_TYPE: number;
                ELEMENT: number;
                ENTITY: number;
                ENTITY_REFERENCE: number;
                NOTATION: number;
                PROCESSING_INSTRUCTION: number;
                TEXT: number;
            } = ...

            DOM Level 2 node type magic numbers

            +

            Constructors

            Properties

            base: undefined | string
            bnodes: {}

            Type declaration

              reify: boolean
              why: any
              nodeType: {
                  ATTRIBUTE: number;
                  CDATA_SECTION: number;
                  COMMENT: number;
                  DOCUMENT: number;
                  DOCUMENT_FRAGMENT: number;
                  DOCUMENT_TYPE: number;
                  ELEMENT: number;
                  ENTITY: number;
                  ENTITY_REFERENCE: number;
                  NOTATION: number;
                  PROCESSING_INSTRUCTION: number;
                  TEXT: number;
              } = ...

              DOM Level 2 node type magic numbers

              Type declaration

              • ATTRIBUTE: number
              • CDATA_SECTION: number
              • COMMENT: number
              • DOCUMENT: number
              • DOCUMENT_FRAGMENT: number
              • DOCUMENT_TYPE: number
              • ELEMENT: number
              • ENTITY: number
              • ENTITY_REFERENCE: number
              • NOTATION: number
              • PROCESSING_INSTRUCTION: number
              • TEXT: number

              Final

              Member

              RDFParser

              -
              ns: {
                  RDF: string;
                  RDFS: string;
              } = ...

              Standard namespaces that we know how to handle

              +
              ns: {
                  RDF: string;
                  RDFS: string;
              } = ...

              Standard namespaces that we know how to handle

              Type declaration

              • RDF: string
              • RDFS: string

              Final

              Member

              RDFParser

              -

              Methods

              • Parameters

                • node: any
                • uri: any
                • name: any

                Returns any

              • Build our initial scope frame and parse the DOM into triples

                +

              Methods

              • Parameters

                • node: any
                • uri: any
                • name: any

                Returns any

              • Build our initial scope frame and parse the DOM into triples

                Parameters

                • document: HTMLDocument

                  The DOM to parse

                • base: string

                  The base URL to use

                • why: any

                  The context to which this resource belongs

                  -

                Returns boolean

              \ No newline at end of file +

              Returns boolean

              \ No newline at end of file diff --git a/doc/classes/RDFaProcessor.html b/doc/classes/RDFaProcessor.html index c311618ce..c02b7194a 100644 --- a/doc/classes/RDFaProcessor.html +++ b/doc/classes/RDFaProcessor.html @@ -1,4 +1,4 @@ -RDFaProcessor | rdflib

              Class RDFaProcessor

              Constructors

              constructor +RDFaProcessor | rdflib

              Class RDFaProcessor

              Constructors

              Properties

              Constructors

              Properties

              absURIRE: RegExp
              blankCounter: number
              blankNodes: any[]
              finishedHandlers: any[]
              htmlOptions: {
                  selfClosing: string;
              }

              Type declaration

              • selfClosing: string
              inHTMLMode: undefined | boolean
              inXHTMLMode: boolean
              kb: any
              langAttributes: {
                  localName: string;
                  namespaceURI: string;
              }[]

              Type declaration

              • localName: string
              • namespaceURI: string
              language: any
              options: any
              target: any
              theOne: string
              vocabulary: any
              HTMLLiteralURI: string
              NCNAME: RegExp
              PlainLiteralURI: string
              XMLLiteralURI: string
              dateTimeTypes: {
                  pattern: RegExp;
                  type: string;
              }[]

              Type declaration

              • pattern: RegExp
              • type: string
              nameChar: string
              nameStartChar: string
              objectURI: string
              typeURI: string

              Methods

              • Parameters

                • origin: any
                • subject: any
                • predicate: any
                • object: any

                Returns void

              • Parameters

                • value: any

                Returns null | string

              • Parameters

                • origin: any
                • subject: any

                Returns void

              • Parameters

                • value: any
                • prefixes: any
                • base: any

                Returns any

              • Parameters

                • value: any
                • prefixes: any
                • base: any

                Returns any

              • Parameters

                • value: any
                • defaultVocabulary: any
                • terms: any
                • prefixes: any
                • base: any
                • ignoreTerms: any

                Returns any

              • Parameters

                • str: any
                • target: any

                Returns void

              • Parameters

                • value: any
                • prefixes: any
                • base: any

                Returns any

              • Parameters

                • value: any
                • defaultVocabulary: any
                • terms: any
                • prefixes: any
                • base: any

                Returns any

              • Parameters

                • value: any
                • defaultVocabulary: any
                • terms: any
                • prefixes: any
                • base: any

                Returns any

              • Parameters

                • parent: any
                • subject: any

                Returns {
                    incomplete: never[];
                    language: any;
                    listMapping: any;
                    parent: any;
                    parentObject: null;
                    prefixes: any;
                    subject: any;
                    terms: any;
                    vocabulary: any;
                }

                • incomplete: never[]
                • language: any
                • listMapping: any
                • parent: any
                • parentObject: null
                • prefixes: any
                • subject: any
                • terms: any
                • vocabulary: any
              • Parameters

                • base: any
                • uri: any

                Returns string

              • Parameters

                • dom: any
                • kb: any
                • base: any

                Returns void

              \ No newline at end of file +

              Constructors

              Properties

              absURIRE: RegExp
              blankCounter: number
              blankNodes: any[]
              finishedHandlers: any[]
              htmlOptions: {
                  selfClosing: string;
              }

              Type declaration

              • selfClosing: string
              inHTMLMode: undefined | boolean
              inXHTMLMode: boolean
              kb: any
              langAttributes: {
                  localName: string;
                  namespaceURI: string;
              }[]

              Type declaration

              • localName: string
              • namespaceURI: string
              language: any
              options: any
              target: any
              theOne: string
              vocabulary: any
              HTMLLiteralURI: string
              NCNAME: RegExp
              PlainLiteralURI: string
              XMLLiteralURI: string
              dateTimeTypes: {
                  pattern: RegExp;
                  type: string;
              }[]

              Type declaration

              • pattern: RegExp
              • type: string
              nameChar: string
              nameStartChar: string
              objectURI: string
              typeURI: string

              Methods

              • Parameters

                • origin: any
                • subject: any
                • predicate: any
                • object: any

                Returns void

              • Parameters

                • value: any

                Returns null | string

              • Parameters

                • origin: any
                • subject: any

                Returns void

              • Parameters

                • value: any
                • prefixes: any
                • base: any

                Returns any

              • Parameters

                • value: any
                • prefixes: any
                • base: any

                Returns any

              • Parameters

                • value: any
                • defaultVocabulary: any
                • terms: any
                • prefixes: any
                • base: any
                • ignoreTerms: any

                Returns any

              • Parameters

                • str: any
                • target: any

                Returns void

              • Parameters

                • value: any
                • prefixes: any
                • base: any

                Returns any

              • Parameters

                • value: any
                • defaultVocabulary: any
                • terms: any
                • prefixes: any
                • base: any

                Returns any

              • Parameters

                • value: any
                • defaultVocabulary: any
                • terms: any
                • prefixes: any
                • base: any

                Returns any

              • Parameters

                • parent: any
                • subject: any

                Returns {
                    incomplete: never[];
                    language: any;
                    listMapping: any;
                    parent: any;
                    parentObject: null;
                    prefixes: any;
                    subject: any;
                    terms: any;
                    vocabulary: any;
                }

                • incomplete: never[]
                • language: any
                • listMapping: any
                • parent: any
                • parentObject: null
                • prefixes: any
                • subject: any
                • terms: any
                • vocabulary: any
              • Parameters

                • base: any
                • uri: any

                Returns string

              • Parameters

                • dom: any
                • kb: any
                • base: any

                Returns void

              \ No newline at end of file diff --git a/doc/classes/Statement.html b/doc/classes/Statement.html index bfdfb6e3f..33c80d54f 100644 --- a/doc/classes/Statement.html +++ b/doc/classes/Statement.html @@ -1,5 +1,5 @@ Statement | rdflib

              Class Statement<S, P, O, G>

              A Statement represents an RDF Triple or Quad.

              -

              Type Parameters

              • S extends SubjectType = SubjectType
              • P extends PredicateType = PredicateType
              • O extends ObjectType = ObjectType
              • G extends GraphType = GraphType

              Implements

              • Quad<S, P, O, G | DefaultGraph>

              Constructors

              Type Parameters

              • S extends SubjectType = SubjectType
              • P extends PredicateType = PredicateType
              • O extends ObjectType = ObjectType
              • G extends GraphType = GraphType

              Implements

              • Quad<S, P, O, G | DefaultGraph>

              Constructors

              Properties

              graph object predicate @@ -23,18 +23,18 @@

              When you do UpdateManager.update() then the graph’s of all the statements must be the same, and give the document you are patching. In future, we may have a more powerful update() which can update more than one document.

              -

              Returns Statement<S, P, O, G>

              Properties

              graph: DefaultGraph | G

              The graph param is a named node of the document in which the triple when +

              Returns Statement<S, P, O, G>

              Properties

              graph: DefaultGraph | G

              The graph param is a named node of the document in which the triple when it is stored on the web.

              -
              object: O

              The thing or data value which is asserted to be related to the subject

              -
              predicate: P

              The relationship which is asserted between the subject and object

              -
              subject: S

              The subject of the triple. What the Statement is about.

              -

              Accessors

              Methods

              • Checks whether two statements are the same

                +
              object: O

              The thing or data value which is asserted to be related to the subject

              +
              predicate: P

              The relationship which is asserted between the subject and object

              +
              subject: S

              The subject of the triple. What the Statement is about.

              +

              Accessors

              Methods

              • Checks whether two statements are the same

                Parameters

                • other: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

                  The other statement

                  -

                Returns boolean

              • Creates a statement with the bindings substituted

                +

              Returns boolean

              • Creates a statement with the bindings substituted

                Parameters

                • bindings: Bindings

                  The bindings

                  -

                Returns Statement<SubjectType, PredicateType, ObjectType, GraphType>

              • Creates a canonical string representation of this statement.

                -

                Returns string

              • Creates a n-quads string representation of this statement

                -

                Returns string

              • Creates a n-triples string representation of this statement

                -

                Returns string

              • Creates a string representation of this statement

                -

                Returns string

              \ No newline at end of file +

              Returns Statement<SubjectType, PredicateType, ObjectType, GraphType>

              • Creates a canonical string representation of this statement.

                +

                Returns string

              • Creates a n-quads string representation of this statement

                +

                Returns string

              • Creates a n-triples string representation of this statement

                +

                Returns string

              • Creates a string representation of this statement

                +

                Returns string

              \ No newline at end of file diff --git a/doc/classes/Store.html b/doc/classes/Store.html index 722834430..a4c40f1af 100644 --- a/doc/classes/Store.html +++ b/doc/classes/Store.html @@ -1,5 +1,5 @@ Store | rdflib

              Class Store

              Indexed Formula aka Store

              -

              Hierarchy (view full)

              Constructors

              Hierarchy (view full)

              Constructors

              Properties

              Constructors

              • Creates a new formula

                Parameters

                • Optional features: FeaturesType

                  What sort of automatic processing to do? Array of string

                  -
                • opts: FormulaOpts = {}

                Returns Store

              Properties

              HTTPRedirects: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

              Redirections we got from HTTP

              -
              _existentialVariables?: BlankNode[]
              _universalVariables?: NamedNode[]
              aliases: any[]

              Reverse mapping to redirection: aliases for this

              -
              classActions: {
                  [k: string]: Function[];
              }

              Map of iri predicates to functions to call when adding { s type X }

              -

              Type declaration

              • [k: string]: Function[]
              classOrder: number = ClassOrder.Graph

              The class order for this node

              -
              constraints: readonly any[] = []

              initial array of constraints

              -
              features: FeaturesType
              fetcher?: Fetcher

              The accompanying fetcher instance.

              +
            • opts: FormulaOpts = {}
            • Returns Store

              Properties

              HTTPRedirects: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

              Redirections we got from HTTP

              +
              _existentialVariables?: BlankNode[]
              _universalVariables?: NamedNode[]
              aliases: any[]

              Reverse mapping to redirection: aliases for this

              +
              classActions: {
                  [k: string]: Function[];
              }

              Map of iri predicates to functions to call when adding { s type X }

              +

              Type declaration

              • [k: string]: Function[]
              classOrder: number = ClassOrder.Graph

              The class order for this node

              +
              constraints: readonly any[] = []

              initial array of constraints

              +
              features: FeaturesType
              fetcher?: Fetcher

              The accompanying fetcher instance.

              Is set by the fetcher when initialized.

              -
              index: [Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[]]
              initBindings: readonly any[] = []

              initial bindings used in Query

              -
              isVar: number = 0
              namespaces: {
                  [key: string]: string;
              }

              Dictionary of namespace prefixes

              -

              Type declaration

              • [key: string]: string
              ns: ((nsuri, factory?) => ((ln) => NamedNode)) = Namespace

              A namespace for the specified namespace's URI

              +
              index: [Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[], Statement<SubjectType, PredicateType, ObjectType, GraphType>[]]
              initBindings: readonly any[] = []

              initial bindings used in Query

              +
              isVar: number = 0
              namespaces: {
                  [key: string]: string;
              }

              Dictionary of namespace prefixes

              +

              Type declaration

              • [key: string]: string
              ns: ((nsuri, factory?) => ((ln) => NamedNode)) = Namespace

              A namespace for the specified namespace's URI

              Type declaration

                • (nsuri, factory?): ((ln) => NamedNode)
                • Parameters

                  • nsuri: string

                    The URI for the namespace

                    -
                  • Optional factory: RdfJsDataFactory

                  Returns ((ln) => NamedNode)

                    • (ln): NamedNode
                    • Parameters

                      • ln: string

                      Returns NamedNode

              objectIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

              Array of statements with this X as object

              -
              optional: readonly any[] = []

              optional

              -
              predicateIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

              Array of statements with this X as predicate

              -
              propertyActions: {
                  [k: string]: Function[];
              }

              Map of iri predicates to functions to call when getting statement with {s X o}

              -

              Type declaration

              • [k: string]: Function[]
              rdfFactory: any

              The factory used to generate statements and terms

              -
              redirections: any[]

              Redirect to lexically smaller equivalent symbol

              -
              statements: Statement<SubjectType, PredicateType, ObjectType, GraphType>[] = []

              Initial array of statements

              -
              subjectIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

              Array of statements with this X as subject

              -
              termType: "Graph" = GraphTermType

              The type of node

              -
              updater?: UpdateManager

              An UpdateManager initialised to this store

              -
              value: string

              The node's value

              -
              whyIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

              Array of statements with X as provenance

              -
              fromValue: (<T>(value) => T)

              Type declaration

                • <T>(value): T
                • Type Parameters

                  • T extends FromValueReturns

                  Parameters

                  • value: ValueType

                  Returns T

              handleRDFType: Function
              toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

              Type declaration

                • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
                • Parameters

                  • term: any

                  Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

              Accessors

              • get length(): number
              • Returns the number of statements contained in this IndexedFormula. +

              • Optional factory: RdfJsDataFactory

              Returns ((ln) => NamedNode)

                • (ln): NamedNode
                • Parameters

                  • ln: string

                  Returns NamedNode

              objectIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

              Array of statements with this X as object

              +
              optional: readonly any[] = []

              optional

              +
              predicateIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

              Array of statements with this X as predicate

              +
              propertyActions: {
                  [k: string]: Function[];
              }

              Map of iri predicates to functions to call when getting statement with {s X o}

              +

              Type declaration

              • [k: string]: Function[]
              rdfFactory: any

              The factory used to generate statements and terms

              +
              redirections: any[]

              Redirect to lexically smaller equivalent symbol

              +
              statements: Statement<SubjectType, PredicateType, ObjectType, GraphType>[] = []

              Initial array of statements

              +
              subjectIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

              Array of statements with this X as subject

              +
              termType: "Graph" = GraphTermType

              The type of node

              +
              updater?: UpdateManager

              An UpdateManager initialised to this store

              +
              value: string

              The node's value

              +
              whyIndex: Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

              Array of statements with X as provenance

              +
              fromValue: (<T>(value) => T)

              Type declaration

                • <T>(value): T
                • Type Parameters

                  • T extends FromValueReturns

                  Parameters

                  • value: ValueType

                  Returns T

              handleRDFType: Function
              toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

              Type declaration

                • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
                • Parameters

                  • term: any

                  Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

              Accessors

              • get length(): number
              • Returns the number of statements contained in this IndexedFormula. (Getter proxy to this.statements). Usage:

                var kb = rdf.graph()
                kb.length // -> 0
                -

                Returns number

              • get defaultGraphURI(): string
              • Gets the URI of the default graph

                -

                Returns string

              Methods

              • Transform a collection of NTriple URIs into their URI strings

                +

                Returns number

              • get defaultGraphURI(): string
              • Gets the URI of the default graph

                +

                Returns string

              Methods

              • Transform a collection of NTriple URIs into their URI strings

                Parameters

                • t: any

                  Some iterable collection of NTriple URI strings

                Returns {}

                A collection of the URIs as strings todo: explain why it is important to go through NT

                -
                • Adds a triple (quad) to the store.

                  Parameters

                  • subj: Quad_Subject | Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph> | Statement<SubjectType, PredicateType, ObjectType, GraphType> | Statement<SubjectType, PredicateType, ObjectType, GraphType>[] | Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

                    The thing about which the fact a relationship is asserted. Also accepts a statement or an array of Statements.

                  • Optional pred: Quad_Predicate

                    The relationship which is asserted

                  • Optional obj: string | Term

                    The object of the relationship, e.g. another thing or a value. If passed a string, this will become a literal.

                  • Optional why: Quad_Graph

                    The document in which the triple (S,P,O) was or will be stored on the web

                  Returns null | number | Statement<SubjectType, PredicateType, ObjectType, GraphType> | Store

                  The statement added to the store, or the store

                  -
                • Adds all the statements to this formula

                  Parameters

                  • statements: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

                    A collection of statements

                    -

                  Returns void

                • Add a callback which will be triggered after a statement has been added to the store.

                  -

                  Parameters

                  • cb: ((q) => void)
                      • (q): void
                      • Parameters

                        • q: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

                        Returns void

                  Returns void

                • Parameters

                  • st: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

                  Returns number

                  Deprecated

                  Use {add} instead

                  -
                • Return all equivalent URIs by which this is known

                  +

                Returns void

                • Add a callback which will be triggered after a statement has been added to the store.

                  +

                  Parameters

                  • cb: ((q) => void)
                      • (q): void
                      • Parameters

                        • q: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

                        Returns void

                  Returns void

                • Parameters

                  • st: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

                  Returns number

                  Deprecated

                  Use {add} instead

                  +
                • Follow link from one node, using one wildcard, looking for one

                  +

                Returns NamedNode[]

                • Follow link from one node, using one wildcard, looking for one

                  For example, any(me, knows, null, profile) - a person I know accoring to my profile . any(me, knows, null, null) - a person I know accoring to anything in store . any(null, knows, me, null) - a person who know me accoring to anything in store .

                  @@ -161,51 +161,51 @@
                • Optional o: null | Quad_Object

                  A node to search for as object, or if null, a wildcard

                • Optional g: null | Quad_Graph

                  A node to search for as graph, or if null, a wildcard

                Returns null | Node

                A node which match the wildcard position, or null

                -
                • Gets the first JavaScript object equivalent to a node based on the specified pattern

                  +
                • Gets the first JavaScript object equivalent to a node based on the specified pattern

                  Parameters

                  • Optional s: null | Quad_Subject

                    The subject

                  • Optional p: null | Quad_Predicate

                    The predicate

                  • Optional o: null | Quad_Object

                    The object

                  • Optional g: null | Quad_Graph

                    The graph that contains the statement

                    -

                  Returns any

                • Gets the first statement that matches the specified pattern

                  -

                  Parameters

                  • Optional s: null | Quad_Subject
                  • Optional p: null | Quad_Predicate
                  • Optional o: null | Quad_Object
                  • Optional g: null | Quad_Graph

                  Returns undefined | Statement<SubjectType, PredicateType, ObjectType, GraphType>

                • Gets the value of a node that matches the specified pattern

                  +

                Returns any

                • Gets the first statement that matches the specified pattern

                  +

                  Parameters

                  • Optional s: null | Quad_Subject
                  • Optional p: null | Quad_Predicate
                  • Optional o: null | Quad_Object
                  • Optional g: null | Quad_Graph

                  Returns undefined | Statement<SubjectType, PredicateType, ObjectType, GraphType>

                • Gets the value of a node that matches the specified pattern

                  Parameters

                  • Optional s: null | Quad_Subject

                    The subject

                  • Optional p: null | Quad_Predicate

                    The predicate

                  • Optional o: null | Quad_Object

                    The object

                  • Optional g: null | Quad_Graph

                    The graph that contains the statement

                    -

                  Returns string | void

                • Apply a set of statements to be deleted and to be inserted

                  +

                Returns string | void

                • Apply a set of statements to be deleted and to be inserted

                  Parameters

                  • patch: {
                        delete?: readonly Statement<SubjectType, PredicateType, ObjectType, GraphType>[];
                        patch?: readonly Statement<SubjectType, PredicateType, ObjectType, GraphType>[];
                        where?: any;
                    }

                    The set of statements to be deleted and to be inserted

                    • Optional delete?: readonly Statement<SubjectType, PredicateType, ObjectType, GraphType>[]
                    • Optional patch?: readonly Statement<SubjectType, PredicateType, ObjectType, GraphType>[]
                    • Optional where?: any
                  • target: NamedNode

                    The name of the document to patch

                  • patchCallback: ((errorString?) => void)

                    Callback to be called when patching is complete

                    -
                      • (errorString?): void
                      • Parameters

                        • Optional errorString: string

                        Returns void

                  Returns void

                • Finds the types in the list which have no stored subtypes +

                    • (errorString?): void
                    • Parameters

                      • Optional errorString: string

                      Returns void

                Returns void

                • Finds the types in the list which have no stored subtypes These are a set of classes which provide by themselves complete information -- the other classes are redundant for those who know the class DAG.

                  Parameters

                  • types: any

                    A map of the types

                    -

                  Returns any

                • Returns the symbol with canonical URI as smushed

                  +

                Returns any

                • Returns the symbol with canonical URI as smushed

                  Parameters

                  • Optional term: Term

                    An RDF node

                    -

                  Returns Node

                • Checks this formula for consistency

                  -

                  Returns void

                • Checks a list of statements for consistency

                  +

                Returns Node

                • Checks this formula for consistency

                  +

                  Returns void

                • Checks a list of statements for consistency

                  Parameters

                  • sts: readonly Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

                    The list of statements to check

                  • Optional from: number

                    An index with the array ['subject', 'predicate', 'object', 'why']

                    -

                  Returns boolean | void

                • Compares this node with another

                  +

                Returns boolean | void

                • Parameters

                  • u1: Term
                  • u2: Term

                  Returns number

                • Parameters

                  • u1: Term
                  • u2: Term

                  Returns number

                • Trace statements which connect directly, or through bnodes

                  Parameters

                  • subject: Quad_Subject

                    The node to start looking for statments

                  • doc: Quad_Graph

                    The document to be searched, or null to search all documents

                  • Optional excludePredicateURIs: readonly string[]

                  Returns Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

                  an array of statements, duplicate statements are suppresssed.

                  -
                • replaces

                  Parameters

                  • template: Quad_Subject

                    node to copy

                  • target: Quad_Subject

                    node to copy to

                  • Optional flags: ("delete" | "two-direction")[]

                    Whether or not to do a two-directional copy and/or delete triples

                  Returns void

                  Target

                  and add appropriate triples removes no triples by default and is a one-direction replication

                  -
                • N3 allows for declaring blank nodes, this function enables that support

                  +
                • N3 allows for declaring blank nodes, this function enables that support

                  Parameters

                  • x: BlankNode

                    The blank node to be declared, supported in N3

                    -

                  Returns BlankNode

                • Follow links from one node, using one wildcard.

                  +

                Returns BlankNode

                • Follow links from one node, using one wildcard.

                  For example, each(me, knows, null, profile) - people I know accoring to my profile . each(me, knows, null, null) - people I know accoring to anything in store . each(null, knows, me, null) - people who know me accoring to anything in store .

                  @@ -216,38 +216,38 @@

                Returns Node[]

                • An array of nodes which match the wildcard position
                -
                • Simplify graph in store when we realize two identifiers are equivalent +

                Returns boolean

                • Simplify graph in store when we realize two identifiers are equivalent We replace the bigger with the smaller.

                  Parameters

                  • u1in: Term

                    The first node

                  • u2in: Term

                    The second node

                    -

                  Returns boolean

                • For thisClass or any subclass, anything which has it is its type +

                Returns boolean

                • For thisClass or any subclass, anything which has it is its type or is the object of something which has the type as its range, or subject of something which has the type as its domain We don't bother doing subproperty (yet?)as it doesn't seeem to be used much. Get all the Classes of which we can RDFS-infer the subject is a member

                  Parameters

                  • subject: Node

                    A named node

                    -

                  Returns UriMap

                • For thisClass or any subclass, anything which has it is its type +

                Returns UriMap

                • For thisClass or any subclass, anything which has it is its type or is the object of something which has the type as its range, or subject of something which has the type as its domain We don't bother doing subproperty (yet?)as it doesn't seeem to be used much. Get all the Classes of which we can RDFS-infer the subject is a member

                  Parameters

                  • thisClass: any

                  Returns MembersMap

                  a hash of URIs

                  -
                • Get all the Classes of which we can RDFS-infer the subject is a superclass +

                • Get all the Classes of which we can RDFS-infer the subject is a superclass Returns a hash table where key is NT of type and value is statement why we think so. Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

                  -

                  Parameters

                  Returns {
                      [uri: string]: boolean;
                  }

                  • [uri: string]: boolean
                • Get all the Classes of which we can RDFS-infer the subject is a subclass

                  +

                  Parameters

                  Returns {
                      [uri: string]: boolean;
                  }

                  • [uri: string]: boolean
                • Get all the Classes of which we can RDFS-infer the subject is a subclass

                  Parameters

                  • subject: Node

                    The thing whose classes are to be found

                  Returns {
                      [uri: string]: boolean;
                  }

                  a hash table where key is NT of type and value is statement why we think so. Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

                  -
                  • [uri: string]: boolean
                • Get all the Classes of which we can RDFS-infer the subject is a member todo: This will loop is there is a class subclass loop (Sublass loops are not illegal) Returns a hash table where key is NT of type and value is statement why we @@ -255,91 +255,91 @@ Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

                  Parameters

                  • subject: Quad_Subject

                    A subject node

                    -

                  Returns UriMap

                • Get all the Classes of which we can RDFS-infer the subject is a member +

                Returns UriMap

                • Get all the Classes of which we can RDFS-infer the subject is a member todo: This will loop is there is a class subclass loop (Sublass loops are not illegal)

                  Parameters

                  • subject: any

                    The thing whose classes are to be found

                  Returns {
                      [uri: string]: boolean;
                  }

                  a hash table where key is NT of type and value is statement why we think so. Does NOT return terms, returns URI strings. We use NT representations in this version because they handle blank nodes.

                  -
                  • [uri: string]: boolean
                • Creates a new empty indexed formula Only applicable for IndexedFormula, but TypeScript won't allow a subclass to override a property

                  Parameters

                  • features: FeaturesType

                    The list of features

                    -

                  Returns Store

                • Transforms an NTriples string format into a Node. +

                Returns Store

                • Transforms an NTriples string format into a Node. The blank node bit should not be used on program-external values; designed for internal work such as storing a blank node id in an HTML attribute. This will only parse the strings generated by the various toNT() methods.

                  -

                  Parameters

                  • str: any

                  Returns any

                • Returns true if this formula holds the specified statement(s)

                  -

                  Parameters

                  • s: any
                  • Optional p: any
                  • Optional o: any
                  • Optional g: any

                  Returns boolean

                • Returns true if this formula holds the specified {statement}

                  -

                  Parameters

                  • statement: any

                  Returns boolean

                • Returns true if this formula holds the specified statement(s)

                  +

                  Parameters

                  • s: any
                  • Optional p: any
                  • Optional o: any
                  • Optional g: any

                  Returns boolean

                • Returns true if this formula holds the specified {statement}

                  +

                  Parameters

                  • statement: any

                  Returns boolean

                • Returns a unique index-safe identifier for the given term.

                  Falls back to the rdflib hashString implementation if the given factory doesn't support id.

                  -

                  Parameters

                  • term: TFIDFactoryTypes

                  Returns Indexable

                • Parameters

                  • features: FeaturesType

                  Returns void

                • Used by the n3parser to generate list elements

                  +

                  Parameters

                  • term: TFIDFactoryTypes

                  Returns Indexable

                • Parameters

                  • features: FeaturesType

                  Returns void

                • Used by the n3parser to generate list elements

                  Parameters

                  • values: any

                    The values of the collection

                  • context: any

                    The store

                  Returns any

                  • The term for the statement
                  -
                • Returns any quads matching the given arguments. +

                • Returns any quads matching the given arguments. Standard RDFJS spec method for Source objects, implemented as an alias to statementsMatching()

                  Parameters

                  • Optional subject: null | Quad_Subject

                    The subject

                  • Optional predicate: null | Quad_Predicate

                    The predicate

                  • Optional object: null | Quad_Object

                    The object

                  • Optional graph: null | Quad_Graph

                    The graph that contains the statement

                    -

                  Returns Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

                • Find out whether a given URI is used as symbol in the formula

                  +

                Returns Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

                • Find out whether a given URI is used as symbol in the formula

                  Parameters

                  • uri: string

                    The URI to look for

                    -

                  Returns boolean

                • Existentials are BNodes - something exists without naming

                  +

                Returns boolean

                • Existentials are BNodes - something exists without naming

                  Parameters

                  • uri: string

                    An URI

                    -

                  Returns Term

                • Adds a new property action

                  +

                Returns Term

                • Adds a new property action

                  Parameters

                  • pred: Quad_Predicate

                    the predicate that the function should be triggered on

                  • action: ((store, subject, predicate, object) => boolean)

                    the function that should trigger

                    -
                      • (store, subject, predicate, object): boolean
                      • Parameters

                        • store: Store
                        • subject: Quad_Subject
                        • predicate: Quad_Predicate
                        • object: Quad_Object

                        Returns boolean

                  Returns boolean

                • Creates a new universal node +

                    • (store, subject, predicate, object): boolean
                    • Parameters

                      • store: Store
                      • subject: Quad_Subject
                      • predicate: Quad_Predicate
                      • object: Quad_Object

                      Returns boolean

                Returns boolean

                • Creates a new universal node Universals are Variables

                  Parameters

                  • uri: string

                    An URI

                    -

                  Returns NamedNode

                • Find an unused id for a file being edited: return a symbol +

                Returns NamedNode

                • Find an unused id for a file being edited: return a symbol (Note: Slow iff a lot of them -- could be O(log(k)) )

                  Parameters

                  • doc: NamedNode

                    A document named node

                    -

                  Returns NamedNode

                • Query this store asynchronously, return bindings in callback

                  +

                Returns NamedNode

                • Query this store asynchronously, return bindings in callback

                  Parameters

                  • myQuery: Query

                    The query to be run

                  • callback: ((bindings) => void)

                    Function to call when bindings

                      • (bindings): void
                      • Parameters

                        • bindings: Bindings

                        Returns void

                  • Optional fetcher: null | Fetcher
                  • Optional onDone: (() => void)

                    OBSOLETE - do not use this // @@ Why not ?? Called when query complete

                    -
                      • (): void
                      • Returns void

                  Returns void

                • Query this store synchronously and return bindings

                  +
                    • (): void
                    • Returns void

                Returns void

                • Query this store synchronously and return bindings

                  Parameters

                  • myQuery: Query

                    The query to be run

                    -

                  Returns any[]

                • Removes one or multiple statement(s) from this formula

                  +

                Returns any[]

                • Removes one or multiple statement(s) from this formula

                  Parameters

                  • st: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph> | Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

                    A Statement or array of Statements to remove

                    -

                  Returns Store

                • Removes all statements in a doc, along with the related metadata including request/response/status

                  +

                Returns Store

                • Removes all statements in a doc, along with the related metadata including request/response/status

                  Parameters

                  • doc: Quad_Graph

                    The document / graph

                    -

                  Returns Store

                • Remove all statements matching args (within limit) *

                  +

                Returns Store

                • Remove all statements matching args (within limit) *

                  Parameters

                  • Optional subj: null | Quad_Subject

                    The subject

                  • Optional pred: null | Quad_Predicate

                    The predicate

                  • Optional obj: null | Quad_Object

                    The object

                  • Optional why: null | Quad_Graph

                    The graph that contains the statement

                  • Optional limit: number

                    The number of statements to remove

                    -

                  Returns void

                • Remove all matching statements

                  +

                Returns void

                • Remove all matching statements

                  Parameters

                  • Optional subject: null | Quad_Subject

                    The subject

                  • Optional predicate: null | Quad_Predicate

                    The predicate

                  • Optional object: null | Quad_Object

                    The object

                  • Optional graph: null | Quad_Graph

                    The graph that contains the statement

                    -

                  Returns Store

                • Remove a particular statement object from the store

                  +

                Returns Store

                • Remove a particular statement object from the store

                  Parameters

                  • st: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

                    a statement which is already in the store and indexed. Make sure you only use this for these. Otherwise, you should use remove() above.

                    -

                  Returns Store

                • Removes statements

                  +

                Returns Store

                • Removes statements

                  Parameters

                  • sts: readonly Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]

                    The statements to remove

                    -

                  Returns Store

                • Replace big with small, obsoleted with obsoleting.

                  -

                  Parameters

                  • big: Quad_Subject
                  • small: Quad_Subject

                  Returns boolean

                • Compares whether this node is the same as the other one

                  +

                Returns Store

                • Replace big with small, obsoleted with obsoleting.

                  +

                  Parameters

                  • big: Quad_Subject
                  • small: Quad_Subject

                  Returns boolean

                • Compare by canonical URI as smushed

                  +

                Returns boolean

                • Serializes this formula

                  +

                Returns boolean

                • Serializes this formula

                  Parameters

                  • base: any

                    The base string

                  • contentType: any

                    The content type of the syntax to use

                  • provenance: any

                    The provenance URI

                  • Optional options: any

                    options to pass to the serializer, as defined in serialize method

                    -

                  Returns undefined | string

                • Parameters

                  • prefix: string
                  • nsuri: string

                  Returns void

                • Search the Store

                  +

                Returns undefined | string

                • Parameters

                  • prefix: string
                  • nsuri: string

                  Returns void

                • Search the Store

                  ALL CONVENIENCE LOOKUP FUNCTIONS RELY ON THIS!

                  Parameters

                  • Optional subj: null | Quad_Subject

                    A node to search for as subject, or if null, a wildcard

                  • Optional pred: null | Quad_Predicate

                    A node to search for as predicate, or if null, a wildcard

                    @@ -347,33 +347,33 @@
                  • Optional why: null | Quad_Graph

                    A node to search for as graph, or if null, a wildcard

                  • Optional justOne: boolean

                    flag - stop when found one rather than get all of them?

                  Returns Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

                  An array of nodes which match the wildcard position

                  -
                • Gets the node matching the specified pattern. Throws when no match could be made.

                  +

                Returns T

                • Gets the node matching the specified pattern. Throws when no match could be made.

                  Parameters

                  • Optional s: null | Quad_Subject

                    The subject

                  • Optional p: null | Quad_Predicate

                    The predicate

                  • Optional o: null | Quad_Object

                    The object

                  • Optional g: null | Quad_Graph

                    The graph that contains the statement

                    -

                  Returns undefined | null | Node

                • Finds the types in the list which have no stored supertypes +

                Returns undefined | null | Node

                • Finds the types in the list which have no stored supertypes We exclude the universal class, owl:Things and rdf:Resource, as it is information-free.

                  Parameters

                  • types: {
                        [id: string]: string | NamedNode;
                    }

                    The types

                    -

                  Returns {
                      [id: string]: string | NamedNode;
                  }

                • RDFS Inference +

                Returns {
                    [id: string]: string | NamedNode;
                }

                • RDFS Inference These are hand-written implementations of a backward-chaining reasoner over the RDFS axioms.

                  Parameters

                  • seeds: BooleanMap

                    A hash of NTs of classes to start with

                  • predicate: Quad_Predicate

                    The property to trace though

                  • Optional inverse: boolean

                    Trace inverse direction

                    -

                  Returns {
                      [uri: string]: boolean;
                  }

                  • [uri: string]: boolean
                • A list of all the URIs by which this thing is known

                  -

                  Parameters

                  • term: Quad_Subject

                  Returns string[]

                • Gets a new variable

                  +

                Returns {
                    [uri: string]: boolean;
                }

                • [uri: string]: boolean
                • A list of all the URIs by which this thing is known

                  +

                  Parameters

                  • term: Quad_Subject

                  Returns string[]

                • Gets the number of statements in this formula that matches the specified pattern

                  +

                Returns Variable

                • Gets the number of statements in this formula that matches the specified pattern

                  Parameters

                  • Optional s: null | Quad_Subject

                    The subject

                  • Optional p: null | Quad_Predicate

                    The predicate

                  • Optional o: null | Quad_Object

                    The object

                  • Optional g: null | Quad_Graph

                    The graph that contains the statement

                    -

                  Returns number

                \ No newline at end of file +

                Returns number

                \ No newline at end of file diff --git a/doc/classes/UpdateManager.html b/doc/classes/UpdateManager.html index 4d2349440..ca540c012 100644 --- a/doc/classes/UpdateManager.html +++ b/doc/classes/UpdateManager.html @@ -2,7 +2,7 @@ Just as a Fetcher provides the store with the ability to read and write, the Update Manager provides functionality for making small patches in real time, and also looking out for concurrent updates from other agents

                -

                Constructors

                Constructors

                Properties

                Constructors

                Properties

                fps: {}

                Type declaration

                  ifps: {}

                  Type declaration

                    ns: any

                    Object of namespaces

                    -
                    patchControl: []

                    Index of objects for coordinating incoming and outgoing patches

                    -
                    store: UpdateManagerFormula

                    Methods

                    • Parameters

                      • doc: NamedNode
                      • listener: any

                      Returns void

                    • Parameters

                      • stmt: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

                      Returns string

                    • Tests whether a file is editable. +

                    Returns UpdateManager

                    Properties

                    fps: {}

                    Type declaration

                      ifps: {}

                      Type declaration

                        ns: any

                        Object of namespaces

                        +
                        patchControl: []

                        Index of objects for coordinating incoming and outgoing patches

                        +
                        store: UpdateManagerFormula

                        Methods

                        • Parameters

                          • doc: NamedNode
                          • listener: any

                          Returns void

                        • Parameters

                          • stmt: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

                          Returns string

                        • Tests whether a file is editable. If the file has a specific annotation that it is machine written, for safety, it is editable (this doesn't actually check for write access) If the file has wac-allow and accept patch headers, those are respected. @@ -43,9 +43,9 @@ This async version not only looks at past HTTP requests, it also makes new ones if necessary.

                          Parameters

                          • uri: string | NamedNode
                          • Optional kb: Store

                          Returns Promise<undefined | string | boolean>

                          The method string N3PATCH or SPARQL or DAV or LOCALFILE or false if known, undefined if not known.

                          -
                        • We want to start counting websocket notifications to distinguish the ones from others from our own.

                          -

                          Parameters

                          • doc: NamedNode

                          Returns void

                        • Parameters

                          • st: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph> | Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]
                          • callbackFunction: CallBackFunction

                          Returns void

                        • Tests whether a file is editable. +

                          Parameters

                          • doc: NamedNode

                          Returns void

                        • Parameters

                          • st: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph> | Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]
                          • callbackFunction: CallBackFunction

                          Returns void

                        • Tests whether a file is editable. If the file has a specific annotation that it is machine written, for safety, it is editable (this doesn't actually check for write access) If the file has wac-allow and accept patch headers, those are respected. @@ -53,24 +53,24 @@ This synchronous version only looks at past HTTP requests, does not make new ones.

                          Parameters

                          • uri: string | NamedNode
                          • Optional kb: Store

                          Returns undefined | string | boolean

                          The method string SPARQL or DAV or LOCALFILE or false if known, undefined if not known.

                          -
                        • Remove from the store HTTP authorization metadata The editable function below relies on copies we have in the store of the results of previous HTTP transactions. However, when the user logs in, then that data misrepresents what would happen if the user tried again.

                          -

                          Parameters

                          Returns void

                        • Parameters

                          • st: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>
                          • callbackFunction: CallBackFunction

                          Returns void

                        • This is suitable for an initial creation of a document.

                          -

                          Parameters

                          • doc: NamedNode
                          • data: string | Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]
                          • contentType: string
                          • callback: ((uri, ok, errorMessage?, response?) => void)
                              • (uri, ok, errorMessage?, response?): void
                              • Parameters

                                • uri: string
                                • ok: boolean
                                • Optional errorMessage: string
                                • Optional response: unknown

                                Returns void

                          Returns Promise<void>

                        • Parameters

                          • st: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>
                          • callbackFunction: CallBackFunction

                          Returns void

                        • This is suitable for an initial creation of a document.

                          +

                          Parameters

                          • doc: NamedNode
                          • data: string | Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]
                          • contentType: string
                          • callback: ((uri, ok, errorMessage?, response?) => void)
                              • (uri, ok, errorMessage?, response?): void
                              • Parameters

                                • uri: string
                                • ok: boolean
                                • Optional errorMessage: string
                                • Optional response: unknown

                                Returns void

                          Returns Promise<void>

                        • Reloads a document.

                          Fast and cheap, no metadata. Measure times for the document. Load it provisionally. Don't delete the statements before the load, or it will leave a broken document in the meantime.

                          Parameters

                          • kb: Store
                          • doc: docReloadType

                            {RDFlibNamedNode}

                            -
                          • callbackFunction: ((ok, message?, response?) => void | {})
                              • (ok, message?, response?): void | {}
                              • Parameters

                                • ok: boolean
                                • Optional message: string
                                • Optional response: Error | Response

                                Returns void | {}

                          Returns void

                        • Requests a now or future action to refresh changes coming downstream +

                        • callbackFunction: ((ok, message?, response?) => void | {})
                            • (ok, message?, response?): void | {}
                            • Parameters

                              • ok: boolean
                              • Optional message: string
                              • Optional response: Error | Response

                              Returns void | {}

                        Returns void

                        • Requests a now or future action to refresh changes coming downstream This is designed to allow the system to re-request the server version, when a websocket has pinged to say there are changes. If the websocket, by contrast, has sent a patch, then this may not be necessary.

                          -

                          Parameters

                          • doc: NamedNode
                          • action: any

                          Returns void

                        • Parameters

                          • uri: string
                          • data: string | Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]
                          • contentType: string

                          Returns string

                          Throws

                          On unsupported content type

                          -
                        • Sets up websocket to listen on

                          +

                          Parameters

                          • doc: NamedNode
                          • action: any

                          Returns void

                        • Parameters

                          • uri: string
                          • data: string | Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>[]
                          • contentType: string

                          Returns string

                          Throws

                          On unsupported content type

                          +
                        • Sets up websocket to listen on

                          There is coordination between upstream changes and downstream ones so that a reload is not done in the middle of an upstream patch. If you use this API then you get called when a change happens, and you @@ -78,7 +78,7 @@ Alternative is addDownstreamChangeListener(), where you do not have to do the reload yourself. Do mot mix them.

                          kb contains the HTTP metadata from previous operations

                          -

                          Parameters

                          • doc: NamedNode
                          • handler: any

                          Returns boolean

                        • This high-level function updates the local store if the web is changed successfully. +

                          Parameters

                          • doc: NamedNode
                          • handler: any

                          Returns boolean

                        • This high-level function updates the local store if the web is changed successfully. Deletions, insertions may be undefined or single statements or lists or formulae (may contain bnodes which can be indirectly identified by a where clause). The why property of each statement must be the same and give the web document to be updated.

                          Parameters

                          • deletions: readonly Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

                            Statement or statements to be deleted.

                            @@ -86,16 +86,16 @@
                          • Optional callback: ((uri, success, errorBody?, response?) => void)

                            called as callbackFunction(uri, success, errorbody) OR returns a promise

                              • (uri, success, errorBody?, response?): void
                              • Parameters

                                • uri: undefined | null | string
                                • success: boolean
                                • Optional errorBody: string
                                • Optional response: Error | Response

                                Returns void

                          • Optional secondTry: boolean
                          • options: Partial<AutoInitOptions> = {}

                            Options for the fetch call

                            -

                          Returns void | Promise<void>

                        • Parameters

                          • doc: Quad_Subject
                          • ds: any
                          • is: any
                          • callbackFunction: any
                          • options: Partial<AutoInitOptions> = {}

                          Returns null | Promise<void>

                        • Likely deprecated, since this lib no longer deals with browser extension

                          -

                          Parameters

                          • doc: NamedNode
                          • ds: any
                          • is: any
                          • callbackFunction: any
                          • options: Partial<AutoInitOptions> = {}

                          Returns void

                        • This high-level function updates the local store iff the web is changed successfully. +

                        Returns void | Promise<void>

                        • Parameters

                          • doc: Quad_Subject
                          • ds: any
                          • is: any
                          • callbackFunction: any
                          • options: Partial<AutoInitOptions> = {}

                          Returns null | Promise<void>

                        • Likely deprecated, since this lib no longer deals with browser extension

                          +

                          Parameters

                          • doc: NamedNode
                          • ds: any
                          • is: any
                          • callbackFunction: any
                          • options: Partial<AutoInitOptions> = {}

                          Returns void

                        • This high-level function updates the local store iff the web is changed successfully. Deletions, insertions may be undefined or single statements or lists or formulae (may contain bnodes which can be indirectly identified by a where clause). The why property of each statement must be the give the web document to be updated. The statements to be deleted and inserted may span more than one web document.

                          Parameters

                          • deletions: readonly Statement<SubjectType, PredicateType, ObjectType, GraphType>[]

                            Statement or statements to be deleted.

                          • insertions: readonly Statement<SubjectType, PredicateType, ObjectType, GraphType>[] = []

                            Statement or statements to be inserted.

                          Returns Promise<void[]>

                          a promise

                          -
                        • return a statemnet updating function

                          +
                        • return a statemnet updating function

                          This does NOT update the statement. It returns an object which includes function which can be used to change the object of the statement.

                          -

                          Parameters

                          • statement: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

                          Returns undefined | {
                              set_object: ((obj, callbackFunction) => void);
                              statement: undefined | Term[];
                              statementNT: undefined | string;
                              where: string;
                          }

                        \ No newline at end of file +

                        Parameters

                        • statement: Quad<Quad_Subject, Quad_Predicate, Quad_Object, Quad_Graph>

                        Returns undefined | {
                            set_object: ((obj, callbackFunction) => void);
                            statement: undefined | Term[];
                            statementNT: undefined | string;
                            where: string;
                        }

                        \ No newline at end of file diff --git a/doc/classes/UpdatesSocket.html b/doc/classes/UpdatesSocket.html index bb3e5d087..4956b42bc 100644 --- a/doc/classes/UpdatesSocket.html +++ b/doc/classes/UpdatesSocket.html @@ -1,4 +1,4 @@ -UpdatesSocket | rdflib

                        Class UpdatesSocket

                        Constructors

                        constructor +UpdatesSocket | rdflib

                        Class UpdatesSocket

                        Constructors

                        Properties

                        Constructors

                        Properties

                        connected: boolean
                        parent: any
                        pending: {}

                        Type declaration

                          socket: {}

                          Type declaration

                            subscribed: {}

                            Type declaration

                              via: any

                              Methods

                              • Parameters

                                • method: any
                                • uri: any
                                • data: any

                                Returns any

                              \ No newline at end of file +

                              Constructors

                              Properties

                              connected: boolean
                              parent: any
                              pending: {}

                              Type declaration

                                socket: {}

                                Type declaration

                                  subscribed: {}

                                  Type declaration

                                    via: any

                                    Methods

                                    • Parameters

                                      • method: any
                                      • uri: any
                                      • data: any

                                      Returns any

                                    \ No newline at end of file diff --git a/doc/classes/UpdatesVia.html b/doc/classes/UpdatesVia.html index 9faab1d24..bf869b8f1 100644 --- a/doc/classes/UpdatesVia.html +++ b/doc/classes/UpdatesVia.html @@ -1,8 +1,8 @@ -UpdatesVia | rdflib

                                    Class UpdatesVia

                                    Constructors

                                    constructor +UpdatesVia | rdflib

                                    Class UpdatesVia

                                    Constructors

                                    Properties

                                    Methods

                                    Constructors

                                    Properties

                                    fetcher: any
                                    graph: {}

                                    Type declaration

                                      via: {}

                                      Type declaration

                                        Methods

                                        \ No newline at end of file +

                                        Constructors

                                        Properties

                                        fetcher: any
                                        graph: {}

                                        Type declaration

                                          via: {}

                                          Type declaration

                                            Methods

                                            \ No newline at end of file diff --git a/doc/classes/Variable.html b/doc/classes/Variable.html index 5bb0dde2d..8b4b192e0 100644 --- a/doc/classes/Variable.html +++ b/doc/classes/Variable.html @@ -3,7 +3,7 @@ In sparql they are not visibly URIs. Here we compromise, by having a common special base URI for variables. Their names are uris, but the ? notation has an implicit base uri of 'varid:'

                                            -

                                            Hierarchy (view full)

                                            Implements

                                            • Variable

                                            Constructors

                                            Hierarchy (view full)

                                            Implements

                                            • Variable

                                            Constructors

                                            Properties

                                            base classOrder isVar @@ -24,24 +24,24 @@ toString

                                            Constructors

                                            Properties

                                            base: string = 'varid:'

                                            The base string for a variable's name

                                            -
                                            classOrder: number = ClassOrder.Variable

                                            The class order for this node

                                            -
                                            isVar: number = 1
                                            termType: "Variable" = VariableTermType

                                            The type of node

                                            -
                                            uri: string

                                            The unique identifier of this variable

                                            -
                                            value: string

                                            The node's value

                                            -
                                            fromValue: (<T>(value) => T)

                                            Type declaration

                                              • <T>(value): T
                                              • Type Parameters

                                                • T extends FromValueReturns

                                                Parameters

                                                • value: ValueType

                                                Returns T

                                            toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

                                            Type declaration

                                              • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
                                              • Parameters

                                                • term: any

                                                Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

                                            Methods

                                            • Compares this node with another

                                              +

                                            Returns Variable

                                            Properties

                                            base: string = 'varid:'

                                            The base string for a variable's name

                                            +
                                            classOrder: number = ClassOrder.Variable

                                            The class order for this node

                                            +
                                            isVar: number = 1
                                            termType: "Variable" = VariableTermType

                                            The type of node

                                            +
                                            uri: string

                                            The unique identifier of this variable

                                            +
                                            value: string

                                            The node's value

                                            +
                                            fromValue: (<T>(value) => T)

                                            Type declaration

                                              • <T>(value): T
                                              • Type Parameters

                                                • T extends FromValueReturns

                                                Parameters

                                                • value: ValueType

                                                Returns T

                                            toJS: ((term) => string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[])

                                            Type declaration

                                              • (term): string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]
                                              • Parameters

                                                • term: any

                                                Returns string | boolean | object | Number | Date | (string | boolean | object | Number | Date)[]

                                            Methods

                                            • Compares whether the two nodes are equal

                                              Parameters

                                              • other: any

                                                The other node

                                                -

                                              Returns boolean

                                            • Creates a hash for this node

                                              +

                                            Returns boolean

                                            • Creates a hash for this node

                                              Returns string

                                              Deprecated

                                              use {rdfFactory.id} instead if possible

                                              -
                                            • Creates the substituted node for this one, according to the specified bindings

                                              +

                                            Returns boolean

                                            • Creates the substituted node for this one, according to the specified bindings

                                              Parameters

                                              • bindings: any

                                                Bindings of identifiers to nodes

                                                -

                                              Returns any

                                            • Parameters

                                              • variable: any

                                              Returns string

                                            \ No newline at end of file +

                                            Returns any

                                            • Parameters

                                              • variable: any

                                              Returns string

                                            \ No newline at end of file diff --git a/doc/functions/N3Parser.html b/doc/functions/N3Parser.html index 195f8f5ca..771a88f3f 100644 --- a/doc/functions/N3Parser.html +++ b/doc/functions/N3Parser.html @@ -1 +1 @@ -N3Parser | rdflib

                                            Function N3Parser

                                            • Parameters

                                              • store: any
                                              • openFormula: any
                                              • thisDoc: any
                                              • baseURI: any
                                              • genPrefix: any
                                              • metaURI: any
                                              • flags: any
                                              • why: any

                                              Returns SinkParser

                                            \ No newline at end of file +N3Parser | rdflib

                                            Function N3Parser

                                            • Parameters

                                              • store: any
                                              • openFormula: any
                                              • thisDoc: any
                                              • baseURI: any
                                              • genPrefix: any
                                              • metaURI: any
                                              • flags: any
                                              • why: any

                                              Returns SinkParser

                                            \ No newline at end of file diff --git a/doc/functions/SPARQLToQuery.html b/doc/functions/SPARQLToQuery.html index 8e303e339..64ece5398 100644 --- a/doc/functions/SPARQLToQuery.html +++ b/doc/functions/SPARQLToQuery.html @@ -1,3 +1,3 @@ SPARQLToQuery | rdflib

                                            Function SPARQLToQuery

                                            • @SPARQL: SPARQL text that is converted to a query object which is returned. @testMode: testing flag. Prevents loading of sources.

                                              -

                                              Parameters

                                              • SPARQL: any
                                              • testMode: any
                                              • kb: any

                                              Returns false | Query

                                            \ No newline at end of file +

                                            Parameters

                                            • SPARQL: any
                                            • testMode: any
                                            • kb: any

                                            Returns false | Query

                                            \ No newline at end of file diff --git a/doc/functions/Serializer.html b/doc/functions/Serializer.html index 6d6d07d99..95229e789 100644 --- a/doc/functions/Serializer.html +++ b/doc/functions/Serializer.html @@ -1 +1 @@ -Serializer | rdflib

                                            Function Serializer

                                            \ No newline at end of file +Serializer | rdflib

                                            Function Serializer

                                            \ No newline at end of file diff --git a/doc/functions/blankNode-1.html b/doc/functions/blankNode-1.html index 9ab31410e..457418d8f 100644 --- a/doc/functions/blankNode-1.html +++ b/doc/functions/blankNode-1.html @@ -1 +1 @@ -blankNode | rdflib

                                            Function blankNode

                                            \ No newline at end of file +blankNode | rdflib

                                            Function blankNode

                                            \ No newline at end of file diff --git a/doc/functions/defaultGraph.html b/doc/functions/defaultGraph.html index 6dd7bfd29..f984197fb 100644 --- a/doc/functions/defaultGraph.html +++ b/doc/functions/defaultGraph.html @@ -1 +1 @@ -defaultGraph | rdflib

                                            Function defaultGraph

                                            \ No newline at end of file +defaultGraph | rdflib

                                            Function defaultGraph

                                            \ No newline at end of file diff --git a/doc/functions/fetcher-1.html b/doc/functions/fetcher-1.html index a3d14f851..add1b03cc 100644 --- a/doc/functions/fetcher-1.html +++ b/doc/functions/fetcher-1.html @@ -1 +1 @@ -fetcher | rdflib

                                            Function fetcher

                                            \ No newline at end of file +fetcher | rdflib

                                            Function fetcher

                                            \ No newline at end of file diff --git a/doc/functions/fromNT.html b/doc/functions/fromNT.html index 02fd76f65..fcd8bac96 100644 --- a/doc/functions/fromNT.html +++ b/doc/functions/fromNT.html @@ -1 +1 @@ -fromNT | rdflib

                                            Function fromNT

                                            \ No newline at end of file +fromNT | rdflib

                                            Function fromNT

                                            \ No newline at end of file diff --git a/doc/functions/graph.html b/doc/functions/graph.html index 57a50f056..1353e03ff 100644 --- a/doc/functions/graph.html +++ b/doc/functions/graph.html @@ -1 +1 @@ -graph | rdflib

                                            Function graph

                                            \ No newline at end of file +graph | rdflib

                                            Function graph

                                            \ No newline at end of file diff --git a/doc/functions/isBlankNode.html b/doc/functions/isBlankNode.html index c053d75e0..4e2cd969d 100644 --- a/doc/functions/isBlankNode.html +++ b/doc/functions/isBlankNode.html @@ -1,2 +1,2 @@ isBlankNode | rdflib

                                            Function isBlankNode

                                            • TypeGuard for RDF/JS spec BlankNodes

                                              -

                                              Parameters

                                              • obj: any

                                              Returns obj is BlankNode

                                            \ No newline at end of file +

                                            Parameters

                                            • obj: any

                                            Returns obj is BlankNode

                                            \ No newline at end of file diff --git a/doc/functions/isCollection.html b/doc/functions/isCollection.html index 5bc2affb1..00f42cf57 100644 --- a/doc/functions/isCollection.html +++ b/doc/functions/isCollection.html @@ -1,2 +1,2 @@ isCollection | rdflib

                                            Function isCollection

                                            \ No newline at end of file +

                                            Parameters

                                            • obj: any

                                            Returns obj is Collection<any>

                                            \ No newline at end of file diff --git a/doc/functions/isGraph.html b/doc/functions/isGraph.html index 6678887d0..2f465ed33 100644 --- a/doc/functions/isGraph.html +++ b/doc/functions/isGraph.html @@ -1,2 +1,2 @@ isGraph | rdflib

                                            Function isGraph

                                            • TypeGuard for valid RDF/JS Graph types

                                              -

                                              Parameters

                                              • obj: any

                                              Returns obj is Quad_Graph

                                            \ No newline at end of file +

                                            Parameters

                                            • obj: any

                                            Returns obj is Quad_Graph

                                            \ No newline at end of file diff --git a/doc/functions/isLiteral.html b/doc/functions/isLiteral.html index 64abf2de0..d7fc69139 100644 --- a/doc/functions/isLiteral.html +++ b/doc/functions/isLiteral.html @@ -1,2 +1,2 @@ isLiteral | rdflib

                                            Function isLiteral

                                            • TypeGuard for RDF/JS spec Literals

                                              -

                                              Parameters

                                              • value: any

                                              Returns value is Literal

                                            \ No newline at end of file +

                                            Parameters

                                            • value: any

                                            Returns value is Literal

                                            \ No newline at end of file diff --git a/doc/functions/isNamedNode.html b/doc/functions/isNamedNode.html index 8f76b6fdf..44f2006b3 100644 --- a/doc/functions/isNamedNode.html +++ b/doc/functions/isNamedNode.html @@ -1,2 +1,2 @@ isNamedNode | rdflib

                                            Function isNamedNode

                                            • TypeGuard for RDF/JS spec NamedNodes

                                              -

                                              Parameters

                                              • obj: any

                                              Returns obj is NamedNode

                                            \ No newline at end of file +

                                            Parameters

                                            • obj: any

                                            Returns obj is NamedNode

                                            \ No newline at end of file diff --git a/doc/functions/isPredicate.html b/doc/functions/isPredicate.html index 424bdba32..857dca305 100644 --- a/doc/functions/isPredicate.html +++ b/doc/functions/isPredicate.html @@ -1,2 +1,2 @@ isPredicate | rdflib

                                            Function isPredicate

                                            • TypeGuard for valid RDF/JS spec Predicate types

                                              -

                                              Parameters

                                              • obj: any

                                              Returns obj is Quad_Predicate

                                            \ No newline at end of file +

                                            Parameters

                                            • obj: any

                                            Returns obj is Quad_Predicate

                                            \ No newline at end of file diff --git a/doc/functions/isQuad.html b/doc/functions/isQuad.html index c19d831ba..62017a40d 100644 --- a/doc/functions/isQuad.html +++ b/doc/functions/isQuad.html @@ -1,2 +1,2 @@ isQuad | rdflib

                                            Function isQuad

                                            • TypeGuard for RDF/JS spec Quads

                                              -

                                              Parameters

                                              • obj: any

                                              Returns obj is Quad<any, any, any, any>

                                            \ No newline at end of file +

                                            Parameters

                                            • obj: any

                                            Returns obj is Quad<any, any, any, any>

                                            \ No newline at end of file diff --git a/doc/functions/isRDFObject.html b/doc/functions/isRDFObject.html index 8e24889cf..fcb577a5e 100644 --- a/doc/functions/isRDFObject.html +++ b/doc/functions/isRDFObject.html @@ -1,2 +1,2 @@ isRDFObject | rdflib

                                            Function isRDFObject

                                            • TypeGuard for valid RDF/JS spec Object types

                                              -

                                              Parameters

                                              • obj: any

                                              Returns obj is Quad_Object

                                            \ No newline at end of file +

                                            Parameters

                                            • obj: any

                                            Returns obj is Quad_Object

                                            \ No newline at end of file diff --git a/doc/functions/isRDFlibObject.html b/doc/functions/isRDFlibObject.html index 94b3e6e1a..d6e2254a6 100644 --- a/doc/functions/isRDFlibObject.html +++ b/doc/functions/isRDFlibObject.html @@ -1,2 +1,2 @@ isRDFlibObject | rdflib

                                            Function isRDFlibObject

                                            • TypeGuard for valid RDFlib Object types, also allows Collections, Graphs

                                              -

                                              Parameters

                                              • obj: any

                                              Returns obj is ObjectType

                                            \ No newline at end of file +

                                            Parameters

                                            • obj: any

                                            Returns obj is ObjectType

                                            \ No newline at end of file diff --git a/doc/functions/isRDFlibPredicate.html b/doc/functions/isRDFlibPredicate.html index 15ad19a4d..596eac229 100644 --- a/doc/functions/isRDFlibPredicate.html +++ b/doc/functions/isRDFlibPredicate.html @@ -1,2 +1,2 @@ isRDFlibPredicate | rdflib

                                            Function isRDFlibPredicate

                                            • TypeGuard for valid RDF/JS spec Predicate types

                                              -

                                              Parameters

                                              • obj: any

                                              Returns obj is Quad_Predicate

                                            \ No newline at end of file +

                                            Parameters

                                            • obj: any

                                            Returns obj is Quad_Predicate

                                            \ No newline at end of file diff --git a/doc/functions/isRDFlibSubject.html b/doc/functions/isRDFlibSubject.html index 84b4dcd39..e88f734d2 100644 --- a/doc/functions/isRDFlibSubject.html +++ b/doc/functions/isRDFlibSubject.html @@ -1,2 +1,2 @@ isRDFlibSubject | rdflib

                                            Function isRDFlibSubject

                                            • TypeGuard for valid RDFlib Subject types, same as Object as RDFLib symmetrical.

                                              -

                                              Parameters

                                              • obj: any

                                              Returns obj is ObjectType

                                            \ No newline at end of file +

                                            Parameters

                                            • obj: any

                                            Returns obj is ObjectType

                                            \ No newline at end of file diff --git a/doc/functions/isStatement.html b/doc/functions/isStatement.html index 58b6a7334..8e64af681 100644 --- a/doc/functions/isStatement.html +++ b/doc/functions/isStatement.html @@ -1,2 +1,2 @@ isStatement | rdflib

                                            Function isStatement

                                            • TypeGuard for RDFLib Statements

                                              -

                                              Parameters

                                              • obj: any

                                              Returns obj is Statement<SubjectType, PredicateType, ObjectType, GraphType>

                                            \ No newline at end of file +

                                            Parameters

                                            • obj: any

                                            Returns obj is Statement<SubjectType, PredicateType, ObjectType, GraphType>

                                            \ No newline at end of file diff --git a/doc/functions/isStore.html b/doc/functions/isStore.html index 479ea24a3..7f9e6bb5f 100644 --- a/doc/functions/isStore.html +++ b/doc/functions/isStore.html @@ -1,2 +1,2 @@ isStore | rdflib

                                            Function isStore

                                            \ No newline at end of file +

                                            Parameters

                                            • obj: any

                                            Returns obj is Store

                                            \ No newline at end of file diff --git a/doc/functions/isSubject.html b/doc/functions/isSubject.html index c09254c87..479645a2c 100644 --- a/doc/functions/isSubject.html +++ b/doc/functions/isSubject.html @@ -1,2 +1,2 @@ isSubject | rdflib

                                            Function isSubject

                                            • TypeGuard for valid RDF/JS spec Subject types

                                              -

                                              Parameters

                                              • obj: any

                                              Returns obj is Quad_Subject

                                            \ No newline at end of file +

                                            Parameters

                                            • obj: any

                                            Returns obj is Quad_Subject

                                            \ No newline at end of file diff --git a/doc/functions/isTerm.html b/doc/functions/isTerm.html index 89165c555..c1f276349 100644 --- a/doc/functions/isTerm.html +++ b/doc/functions/isTerm.html @@ -1,2 +1,2 @@ isTerm | rdflib

                                            Function isTerm

                                            • TypeGuard for RDF/JS spec Terms

                                              -

                                              Parameters

                                              • obj: any

                                              Returns obj is Term

                                            \ No newline at end of file +

                                            Parameters

                                            • obj: any

                                            Returns obj is Term

                                            \ No newline at end of file diff --git a/doc/functions/isVariable.html b/doc/functions/isVariable.html index 591b3a104..f69807e6b 100644 --- a/doc/functions/isVariable.html +++ b/doc/functions/isVariable.html @@ -1,2 +1,2 @@ isVariable | rdflib

                                            Function isVariable

                                            • TypeGuard for RDFLib Variables

                                              -

                                              Parameters

                                              • obj: any

                                              Returns obj is Variable

                                            \ No newline at end of file +

                                            Parameters

                                            • obj: any

                                            Returns obj is Variable

                                            \ No newline at end of file diff --git a/doc/functions/lit.html b/doc/functions/lit.html index acfd37da2..14e1bb26b 100644 --- a/doc/functions/lit.html +++ b/doc/functions/lit.html @@ -1 +1 @@ -lit | rdflib

                                            Function lit

                                            \ No newline at end of file +lit | rdflib

                                            Function lit

                                            \ No newline at end of file diff --git a/doc/functions/literal-1.html b/doc/functions/literal-1.html index af6d1c279..f827333ec 100644 --- a/doc/functions/literal-1.html +++ b/doc/functions/literal-1.html @@ -1 +1 @@ -literal | rdflib

                                            Function literal

                                            • Parameters

                                              • value: string
                                              • Optional languageOrDatatype: string | NamedNode

                                              Returns Literal

                                            \ No newline at end of file +literal | rdflib

                                            Function literal

                                            • Parameters

                                              • value: string
                                              • Optional languageOrDatatype: string | NamedNode

                                              Returns Literal

                                            \ No newline at end of file diff --git a/doc/functions/parse.html b/doc/functions/parse.html index d77411267..ae9ed6cca 100644 --- a/doc/functions/parse.html +++ b/doc/functions/parse.html @@ -7,4 +7,4 @@
                                          • base: string

                                            The base URI to use

                                          • contentType: string = 'text/turtle'

                                            The MIME content type string for the input - defaults to text/turtle

                                          • Optional callback: CallbackFunc

                                            The callback to call when the data has been loaded

                                            -
                                          • Returns void

                                            \ No newline at end of file +

                                            Returns void

                                            \ No newline at end of file diff --git a/doc/functions/quad.html b/doc/functions/quad.html index b9bb6d2c6..a5f52a563 100644 --- a/doc/functions/quad.html +++ b/doc/functions/quad.html @@ -1 +1 @@ -quad | rdflib

                                            Function quad

                                            • Parameters

                                              • subject: Term
                                              • predicate: Term
                                              • object: Term
                                              • Optional graph: Term

                                              Returns Statement<SubjectType, PredicateType, ObjectType, GraphType>

                                            \ No newline at end of file +quad | rdflib

                                            Function quad

                                            • Parameters

                                              • subject: Term
                                              • predicate: Term
                                              • object: Term
                                              • Optional graph: Term

                                              Returns Statement<SubjectType, PredicateType, ObjectType, GraphType>

                                            \ No newline at end of file diff --git a/doc/functions/queryToSPARQL.html b/doc/functions/queryToSPARQL.html index 693a2338d..b79a32e03 100644 --- a/doc/functions/queryToSPARQL.html +++ b/doc/functions/queryToSPARQL.html @@ -1 +1 @@ -queryToSPARQL | rdflib

                                            Function queryToSPARQL

                                            \ No newline at end of file +queryToSPARQL | rdflib

                                            Function queryToSPARQL

                                            \ No newline at end of file diff --git a/doc/functions/serialize.html b/doc/functions/serialize.html index e7451b1ce..f8c618887 100644 --- a/doc/functions/serialize.html +++ b/doc/functions/serialize.html @@ -6,4 +6,4 @@
                                          • Optional callback: ((err, result?) => any)
                                              • (err, result?): any
                                              • Parameters

                                                • err: undefined | null | Error
                                                • Optional result: string

                                                Returns any

                                          • Optional options: {
                                                flags?: string;
                                                namespaces?: Record<string, string>;
                                            }
                                            • Optional flags?: string

                                              A string of letters, each of which set an options e.g. deinprstux

                                            • Optional namespaces?: Record<string, string>

                                              A set of [prefix, uri] pairs that define namespace prefixes

                                              -
                                          • Returns string | undefined

                                            \ No newline at end of file +

                                            Returns string | undefined

                                            \ No newline at end of file diff --git a/doc/functions/sparqlUpdateParser.html b/doc/functions/sparqlUpdateParser.html index d1d82a5a7..d0921da42 100644 --- a/doc/functions/sparqlUpdateParser.html +++ b/doc/functions/sparqlUpdateParser.html @@ -1 +1 @@ -sparqlUpdateParser | rdflib

                                            Function sparqlUpdateParser

                                            • Parameters

                                              • str: any
                                              • kb: any
                                              • base: any

                                              Returns {
                                                  query: any;
                                              }

                                              • query: any
                                            \ No newline at end of file +sparqlUpdateParser | rdflib

                                            Function sparqlUpdateParser

                                            • Parameters

                                              • str: any
                                              • kb: any
                                              • base: any

                                              Returns {
                                                  query: any;
                                              }

                                              • query: any
                                            \ No newline at end of file diff --git a/doc/functions/st.html b/doc/functions/st.html index 683ac7628..f54ac3aa2 100644 --- a/doc/functions/st.html +++ b/doc/functions/st.html @@ -1 +1 @@ -st | rdflib

                                            Function st

                                            • Parameters

                                              • subject: Quad_Subject
                                              • predicate: Quad_Predicate
                                              • object: Quad_Object
                                              • Optional graph: Quad_Graph

                                              Returns Statement<SubjectType, PredicateType, ObjectType, GraphType>

                                            \ No newline at end of file +st | rdflib

                                            Function st

                                            • Parameters

                                              • subject: Quad_Subject
                                              • predicate: Quad_Predicate
                                              • object: Quad_Object
                                              • Optional graph: Quad_Graph

                                              Returns Statement<SubjectType, PredicateType, ObjectType, GraphType>

                                            \ No newline at end of file diff --git a/doc/functions/sym.html b/doc/functions/sym.html index ddddc7e2e..d2d9a28c1 100644 --- a/doc/functions/sym.html +++ b/doc/functions/sym.html @@ -1 +1 @@ -sym | rdflib

                                            Function sym

                                            \ No newline at end of file +sym | rdflib

                                            Function sym

                                            \ No newline at end of file diff --git a/doc/functions/term.html b/doc/functions/term.html index fe4deec07..a99389ea3 100644 --- a/doc/functions/term.html +++ b/doc/functions/term.html @@ -1 +1 @@ -term | rdflib

                                            Function term

                                            • Type Parameters

                                              • T extends FromValueReturns

                                              Parameters

                                              • value: ValueType

                                              Returns T

                                            \ No newline at end of file +term | rdflib

                                            Function term

                                            • Type Parameters

                                              • T extends FromValueReturns

                                              Parameters

                                              • value: ValueType

                                              Returns T

                                            \ No newline at end of file diff --git a/doc/functions/termValue.html b/doc/functions/termValue.html index b115cc254..cb73b7352 100644 --- a/doc/functions/termValue.html +++ b/doc/functions/termValue.html @@ -1,2 +1,2 @@ termValue | rdflib

                                            Function termValue

                                            • Retrieve the value of a term, or self if already a string.

                                              -

                                              Parameters

                                              • node: string | Term

                                              Returns string

                                            \ No newline at end of file +

                                            Parameters

                                            • node: string | Term

                                            Returns string

                                            \ No newline at end of file diff --git a/doc/functions/triple.html b/doc/functions/triple.html index 57db5fdb9..413717ca8 100644 --- a/doc/functions/triple.html +++ b/doc/functions/triple.html @@ -1 +1 @@ -triple | rdflib

                                            Function triple

                                            • Parameters

                                              • subject: Term
                                              • predicate: Term
                                              • object: Term
                                              • Optional graph: Term

                                              Returns Quad<any, any, any, any>

                                            \ No newline at end of file +triple | rdflib

                                            Function triple

                                            • Parameters

                                              • subject: Term
                                              • predicate: Term
                                              • object: Term
                                              • Optional graph: Term

                                              Returns Quad<any, any, any, any>

                                            \ No newline at end of file diff --git a/doc/functions/uri.docpart.html b/doc/functions/uri.docpart.html index 651277a6d..20cb70836 100644 --- a/doc/functions/uri.docpart.html +++ b/doc/functions/uri.docpart.html @@ -1,3 +1,3 @@ docpart | rdflib

                                            Function docpart

                                            • Gets the document part of an URI

                                              Parameters

                                              • uri: string

                                                The URI

                                                -

                                              Returns string

                                            \ No newline at end of file +

                                            Returns string

                                            \ No newline at end of file diff --git a/doc/functions/uri.document.html b/doc/functions/uri.document.html index a47fea14c..eea9d2199 100644 --- a/doc/functions/uri.document.html +++ b/doc/functions/uri.document.html @@ -1,3 +1,3 @@ document | rdflib

                                            Function document

                                            \ No newline at end of file +

                                            Returns NamedNode

                                            \ No newline at end of file diff --git a/doc/functions/uri.hostpart.html b/doc/functions/uri.hostpart.html index 42da63ba1..3c455f7df 100644 --- a/doc/functions/uri.hostpart.html +++ b/doc/functions/uri.hostpart.html @@ -1,3 +1,3 @@ hostpart | rdflib

                                            Function hostpart

                                            • Gets the hostname in an URI

                                              Parameters

                                              • u: string

                                                The URI

                                                -

                                              Returns string

                                            \ No newline at end of file +

                                            Returns string

                                            \ No newline at end of file diff --git a/doc/functions/uri.join.html b/doc/functions/uri.join.html index 1f8465bd1..4ce7e64fc 100644 --- a/doc/functions/uri.join.html +++ b/doc/functions/uri.join.html @@ -1,4 +1,4 @@ join | rdflib

                                            Function join

                                            • Joins an URI with a base

                                              Parameters

                                              • given: string

                                                The relative part

                                              • base: string

                                                The base URI

                                                -

                                              Returns string

                                            \ No newline at end of file +

                                            Returns string

                                            \ No newline at end of file diff --git a/doc/functions/uri.protocol.html b/doc/functions/uri.protocol.html index df9358094..edba95419 100644 --- a/doc/functions/uri.protocol.html +++ b/doc/functions/uri.protocol.html @@ -1,3 +1,3 @@ protocol | rdflib

                                            Function protocol

                                            • Gets the protocol part of an URI

                                              Parameters

                                              • uri: string

                                                The URI

                                                -

                                              Returns string | null

                                            \ No newline at end of file +

                                            Returns string | null

                                            \ No newline at end of file diff --git a/doc/functions/uri.refTo.html b/doc/functions/uri.refTo.html index d903ccd03..54d0d5b5b 100644 --- a/doc/functions/uri.refTo.html +++ b/doc/functions/uri.refTo.html @@ -1,4 +1,4 @@ refTo | rdflib

                                            Function refTo

                                            • Gets a relative uri

                                              Parameters

                                              • base: string

                                                The base URI

                                              • uri: string

                                                The absolute URI

                                                -

                                              Returns string

                                            \ No newline at end of file +

                                            Returns string

                                            \ No newline at end of file diff --git a/doc/functions/util.DOMParserFactory.html b/doc/functions/util.DOMParserFactory.html index 0a92dd468..3d229a533 100644 --- a/doc/functions/util.DOMParserFactory.html +++ b/doc/functions/util.DOMParserFactory.html @@ -1,2 +1,2 @@ DOMParserFactory | rdflib

                                            Function DOMParserFactory

                                            • Returns a DOM parser based on current runtime environment.

                                              -

                                              Returns any

                                            \ No newline at end of file +

                                            Returns any

                                            \ No newline at end of file diff --git a/doc/functions/util.RDFArrayRemove.html b/doc/functions/util.RDFArrayRemove.html index 9644dd9c6..ced2acf2f 100644 --- a/doc/functions/util.RDFArrayRemove.html +++ b/doc/functions/util.RDFArrayRemove.html @@ -1,2 +1,2 @@ RDFArrayRemove | rdflib

                                            Function RDFArrayRemove

                                            • Removes all statements equal to x from a

                                              -

                                              Parameters

                                              • a: any
                                              • x: any

                                              Returns void

                                            \ No newline at end of file +

                                            Parameters

                                            • a: any
                                            • x: any

                                            Returns void

                                            \ No newline at end of file diff --git a/doc/functions/util.callbackify.html b/doc/functions/util.callbackify.html index 2a3b1fca0..3f0a670e4 100644 --- a/doc/functions/util.callbackify.html +++ b/doc/functions/util.callbackify.html @@ -4,4 +4,4 @@

                                            Parameters

                                            • obj: any

                                              {Object}

                                            • callbacks: string[]

                                              {Array}

                                            Returns void

                                            Method

                                            callbackify

                                            -
                                            \ No newline at end of file +
                                            \ No newline at end of file diff --git a/doc/functions/util.domToString.html b/doc/functions/util.domToString.html index 6eff447bc..a381578ed 100644 --- a/doc/functions/util.domToString.html +++ b/doc/functions/util.domToString.html @@ -1 +1 @@ -domToString | rdflib

                                            Function domToString

                                            • Parameters

                                              • node: any
                                              • options: any

                                              Returns string

                                            \ No newline at end of file +domToString | rdflib

                                            Function domToString

                                            • Parameters

                                              • node: any
                                              • options: any

                                              Returns string

                                            \ No newline at end of file diff --git a/doc/functions/util.dtstamp.html b/doc/functions/util.dtstamp.html index a49bf51c9..c1f5e4ab0 100644 --- a/doc/functions/util.dtstamp.html +++ b/doc/functions/util.dtstamp.html @@ -1 +1 @@ -dtstamp | rdflib

                                            Function dtstamp

                                            \ No newline at end of file +dtstamp | rdflib

                                            Function dtstamp

                                            \ No newline at end of file diff --git a/doc/functions/util.dumpNode.html b/doc/functions/util.dumpNode.html index 2260c4656..ad3edd5a5 100644 --- a/doc/functions/util.dumpNode.html +++ b/doc/functions/util.dumpNode.html @@ -1 +1 @@ -dumpNode | rdflib

                                            Function dumpNode

                                            • Parameters

                                              • node: any
                                              • options: any
                                              • selfClosing: any
                                              • skipAttributes: any

                                              Returns string

                                            \ No newline at end of file +dumpNode | rdflib

                                            Function dumpNode

                                            • Parameters

                                              • node: any
                                              • options: any
                                              • selfClosing: any
                                              • skipAttributes: any

                                              Returns string

                                            \ No newline at end of file diff --git a/doc/functions/util.heavyCompare.html b/doc/functions/util.heavyCompare.html index 285c6bacf..8598bdb2f 100644 --- a/doc/functions/util.heavyCompare.html +++ b/doc/functions/util.heavyCompare.html @@ -1,2 +1,2 @@ heavyCompare | rdflib

                                            Function heavyCompare

                                            • Compares statements (heavy comparison for repeatable canonical ordering)

                                              -

                                              Parameters

                                              • x: any
                                              • y: any
                                              • g: any
                                              • uriMap: any

                                              Returns any

                                            \ No newline at end of file +

                                            Parameters

                                            • x: any
                                            • y: any
                                            • g: any
                                            • uriMap: any

                                            Returns any

                                            \ No newline at end of file diff --git a/doc/functions/util.heavyCompareSPO.html b/doc/functions/util.heavyCompareSPO.html index 2a6472887..2b419b34f 100644 --- a/doc/functions/util.heavyCompareSPO.html +++ b/doc/functions/util.heavyCompareSPO.html @@ -1 +1 @@ -heavyCompareSPO | rdflib

                                            Function heavyCompareSPO

                                            • Parameters

                                              • x: any
                                              • y: any
                                              • g: any
                                              • uriMap: any

                                              Returns any

                                            \ No newline at end of file +heavyCompareSPO | rdflib

                                            Function heavyCompareSPO

                                            • Parameters

                                              • x: any
                                              • y: any
                                              • g: any
                                              • uriMap: any

                                              Returns any

                                            \ No newline at end of file diff --git a/doc/functions/util.linkRelationProperty.html b/doc/functions/util.linkRelationProperty.html index e33903db6..02f305c7d 100644 --- a/doc/functions/util.linkRelationProperty.html +++ b/doc/functions/util.linkRelationProperty.html @@ -1 +1 @@ -linkRelationProperty | rdflib

                                            Function linkRelationProperty

                                            \ No newline at end of file +linkRelationProperty | rdflib

                                            Function linkRelationProperty

                                            \ No newline at end of file diff --git a/doc/functions/util.mediaTypeClass.html b/doc/functions/util.mediaTypeClass.html index 1040ba14d..40e9c494d 100644 --- a/doc/functions/util.mediaTypeClass.html +++ b/doc/functions/util.mediaTypeClass.html @@ -1 +1 @@ -mediaTypeClass | rdflib

                                            Function mediaTypeClass

                                            \ No newline at end of file +mediaTypeClass | rdflib

                                            Function mediaTypeClass

                                            \ No newline at end of file diff --git a/doc/functions/util.output.html b/doc/functions/util.output.html index d37c3e6e8..20717a2c9 100644 --- a/doc/functions/util.output.html +++ b/doc/functions/util.output.html @@ -1,4 +1,4 @@ output | rdflib

                                            Function output

                                            • Defines a simple debugging function

                                              Parameters

                                              • o: string

                                                {String}

                                              Returns void

                                              Method

                                              output

                                              -
                                            \ No newline at end of file +
                                            \ No newline at end of file diff --git a/doc/functions/util.parseXML.html b/doc/functions/util.parseXML.html index 9afb479d5..89a32ce37 100644 --- a/doc/functions/util.parseXML.html +++ b/doc/functions/util.parseXML.html @@ -1,2 +1,2 @@ parseXML | rdflib

                                            Function parseXML

                                            • Returns a DOM from parsed XML.

                                              -

                                              Parameters

                                              • str: any
                                              • options: any

                                              Returns Document

                                            \ No newline at end of file +

                                            Parameters

                                            • str: any
                                            • options: any

                                            Returns Document

                                            \ No newline at end of file diff --git a/doc/functions/util.stackString.html b/doc/functions/util.stackString.html index b11cfad1a..0edf41690 100644 --- a/doc/functions/util.stackString.html +++ b/doc/functions/util.stackString.html @@ -1 +1 @@ -stackString | rdflib

                                            Function stackString

                                            \ No newline at end of file +stackString | rdflib

                                            Function stackString

                                            \ No newline at end of file diff --git a/doc/functions/util.string_startswith.html b/doc/functions/util.string_startswith.html index 4907fd20c..5d9e00566 100644 --- a/doc/functions/util.string_startswith.html +++ b/doc/functions/util.string_startswith.html @@ -1 +1 @@ -string_startswith | rdflib

                                            Function string_startswith

                                            • Parameters

                                              • str: any
                                              • pref: any

                                              Returns boolean

                                            \ No newline at end of file +string_startswith | rdflib

                                            Function string_startswith

                                            • Parameters

                                              • str: any
                                              • pref: any

                                              Returns boolean

                                            \ No newline at end of file diff --git a/doc/functions/variable-1.html b/doc/functions/variable-1.html index e84c51a78..fdfa626f7 100644 --- a/doc/functions/variable-1.html +++ b/doc/functions/variable-1.html @@ -1 +1 @@ -variable | rdflib

                                            Function variable

                                            \ No newline at end of file +variable | rdflib

                                            Function variable

                                            \ No newline at end of file diff --git a/doc/interfaces/AutoInitOptions.html b/doc/interfaces/AutoInitOptions.html index caae4ca20..763135786 100644 --- a/doc/interfaces/AutoInitOptions.html +++ b/doc/interfaces/AutoInitOptions.html @@ -1,5 +1,5 @@ AutoInitOptions | rdflib

                                            Interface AutoInitOptions

                                            Initiated by initFetchOptions, which runs on load

                                            -
                                            interface AutoInitOptions {
                                                actualProxyURI?: string;
                                                baseURI: string;
                                                body?: string;
                                                cache?: RequestCache;
                                                clearPreviousData?: boolean;
                                                contentType?: string;
                                                credentials?: "include" | "omit";
                                                data?: string;
                                                fetch?: Fetch;
                                                force?: boolean;
                                                forceContentType?: ContentType;
                                                handlers?: Handler[];
                                                headers: HeadersInit;
                                                integrity?: string;
                                                keepalive?: boolean;
                                                method?: HTTPMethods;
                                                mode?: RequestMode;
                                                noMeta?: boolean;
                                                noRDFa?: boolean;
                                                original: NamedNode;
                                                proxyUsed?: boolean;
                                                redirect?: RequestRedirect;
                                                referrer?: string;
                                                referrerPolicy?: ReferrerPolicy;
                                                referringTerm?: NamedNode;
                                                req: BlankNode;
                                                requestedURI?: string;
                                                resource: Quad_Subject;
                                                retriedWithNoCredentials?: boolean;
                                                signal?: null | AbortSignal;
                                                timeout?: number;
                                                window?: null;
                                                withCredentials?: boolean;
                                            }

                                            Hierarchy

                                            • RequestInit
                                              • AutoInitOptions

                                            Properties

                                            interface AutoInitOptions {
                                                actualProxyURI?: string;
                                                baseURI: string;
                                                body?: string;
                                                cache?: RequestCache;
                                                clearPreviousData?: boolean;
                                                contentType?: string;
                                                credentials?: "include" | "omit";
                                                data?: string;
                                                fetch?: Fetch;
                                                force?: boolean;
                                                forceContentType?: ContentType;
                                                handlers?: Handler[];
                                                headers: HeadersInit;
                                                integrity?: string;
                                                keepalive?: boolean;
                                                method?: HTTPMethods;
                                                mode?: RequestMode;
                                                noMeta?: boolean;
                                                noRDFa?: boolean;
                                                original: NamedNode;
                                                proxyUsed?: boolean;
                                                redirect?: RequestRedirect;
                                                referrer?: string;
                                                referrerPolicy?: ReferrerPolicy;
                                                referringTerm?: NamedNode;
                                                req: BlankNode;
                                                requestedURI?: string;
                                                resource: Quad_Subject;
                                                retriedWithNoCredentials?: boolean;
                                                signal?: null | AbortSignal;
                                                timeout?: number;
                                                window?: null;
                                                withCredentials?: boolean;
                                            }

                                            Hierarchy

                                            • RequestInit
                                              • AutoInitOptions

                                            Properties

                                            actualProxyURI?: string
                                            baseURI: string

                                            Original uri to preserve +

                                            Properties

                                            actualProxyURI?: string
                                            baseURI: string

                                            Original uri to preserve through proxying etc (xhr.original).

                                            -
                                            body?: string
                                            cache?: RequestCache

                                            A string indicating how the request will interact with the browser's cache to set request's cache.

                                            +
                                            body?: string
                                            cache?: RequestCache

                                            A string indicating how the request will interact with the browser's cache to set request's cache.

                                            clearPreviousData?: boolean

                                            Before we parse new data, clear old, but only on status 200 responses

                                            -
                                            contentType?: string

                                            Provided content type (for writes)

                                            -
                                            credentials?: "include" | "omit"
                                            data?: string
                                            fetch?: Fetch

                                            The used Fetch function

                                            -
                                            force?: boolean

                                            Load the data even if loaded before. +

                                            contentType?: string

                                            Provided content type (for writes)

                                            +
                                            credentials?: "include" | "omit"
                                            data?: string
                                            fetch?: Fetch

                                            The used Fetch function

                                            +
                                            force?: boolean

                                            Load the data even if loaded before. Also sets the Cache-Control: header to no-cache

                                            -
                                            forceContentType?: ContentType

                                            Override the incoming header to +

                                            forceContentType?: ContentType

                                            Override the incoming header to force the data to be treated as this content-type (for reads)

                                            -
                                            handlers?: Handler[]
                                            headers: HeadersInit
                                            integrity?: string

                                            A cryptographic hash of the resource to be fetched by request. Sets request's integrity.

                                            +
                                            handlers?: Handler[]
                                            headers: HeadersInit
                                            integrity?: string

                                            A cryptographic hash of the resource to be fetched by request. Sets request's integrity.

                                            keepalive?: boolean

                                            A boolean to set request's keepalive.

                                            -
                                            method?: HTTPMethods
                                            mode?: RequestMode

                                            A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode.

                                            +
                                            method?: HTTPMethods
                                            mode?: RequestMode

                                            A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode.

                                            noMeta?: boolean

                                            Prevents the addition of various metadata triples (about the fetch request) to the store

                                            -
                                            noRDFa?: boolean
                                            original: NamedNode

                                            The serialized resource in the body

                                            -
                                            proxyUsed?: boolean

                                            Whether this request is a retry via +

                                            noRDFa?: boolean
                                            original: NamedNode

                                            The serialized resource in the body

                                            +
                                            proxyUsed?: boolean

                                            Whether this request is a retry via a proxy (generally done from an error handler)

                                            -
                                            redirect?: RequestRedirect

                                            A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect.

                                            +
                                            redirect?: RequestRedirect

                                            A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect.

                                            referrer?: string

                                            A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer.

                                            referrerPolicy?: ReferrerPolicy

                                            A referrer policy to set request's referrerPolicy.

                                            referringTerm?: NamedNode

                                            Referring term, the resource which referred to this (for tracking bad links). The document in which this link was found.

                                            -
                                            req: BlankNode
                                            requestedURI?: string
                                            resource: Quad_Subject
                                            retriedWithNoCredentials?: boolean
                                            signal?: null | AbortSignal

                                            An AbortSignal to set request's signal.

                                            -
                                            timeout?: number
                                            window?: null

                                            Can only be null. Used to disassociate request from any Window.

                                            +
                                            req: BlankNode
                                            requestedURI?: string
                                            resource: Quad_Subject
                                            retriedWithNoCredentials?: boolean
                                            signal?: null | AbortSignal

                                            An AbortSignal to set request's signal.

                                            +
                                            timeout?: number
                                            window?: null

                                            Can only be null. Used to disassociate request from any Window.

                                            withCredentials?: boolean

                                            flag for XHR/CORS etc

                                            -
                                            \ No newline at end of file +
                                            \ No newline at end of file diff --git a/doc/interfaces/ExtendedResponse.html b/doc/interfaces/ExtendedResponse.html index a2bac495c..22c8f8013 100644 --- a/doc/interfaces/ExtendedResponse.html +++ b/doc/interfaces/ExtendedResponse.html @@ -1,5 +1,5 @@ ExtendedResponse | rdflib

                                            Interface ExtendedResponse

                                            An extended interface of Response, since RDFlib.js adds some properties.

                                            -
                                            interface ExtendedResponse {
                                                body: null | ReadableStream<Uint8Array>;
                                                bodyUsed: boolean;
                                                error?: string;
                                                headers: Headers;
                                                ok: boolean;
                                                redirected: boolean;
                                                req?: Quad_Subject;
                                                responseText?: string;
                                                size?: number;
                                                status: number;
                                                statusText: string;
                                                timeout?: number;
                                                type: ResponseType;
                                                url: string;
                                                arrayBuffer(): Promise<ArrayBuffer>;
                                                blob(): Promise<Blob>;
                                                clone(): Response;
                                                formData(): Promise<FormData>;
                                                json(): Promise<any>;
                                                text(): Promise<string>;
                                            }

                                            Hierarchy

                                            • Response
                                              • ExtendedResponse

                                            Properties

                                            interface ExtendedResponse {
                                                body: null | ReadableStream<Uint8Array>;
                                                bodyUsed: boolean;
                                                error?: string;
                                                headers: Headers;
                                                ok: boolean;
                                                redirected: boolean;
                                                req?: Quad_Subject;
                                                responseText?: string;
                                                size?: number;
                                                status: number;
                                                statusText: string;
                                                timeout?: number;
                                                type: ResponseType;
                                                url: string;
                                                arrayBuffer(): Promise<ArrayBuffer>;
                                                blob(): Promise<Blob>;
                                                clone(): Response;
                                                formData(): Promise<FormData>;
                                                json(): Promise<any>;
                                                text(): Promise<string>;
                                            }

                                            Hierarchy

                                            • Response
                                              • ExtendedResponse

                                            Properties

                                            body bodyUsed error? headers @@ -20,6 +20,6 @@ json text

                                            Properties

                                            body: null | ReadableStream<Uint8Array>
                                            bodyUsed: boolean
                                            error?: string

                                            Used in UpdateManager.updateDav

                                            -
                                            headers: Headers
                                            ok: boolean
                                            redirected: boolean
                                            req?: Quad_Subject

                                            Identifier of the reqest

                                            -
                                            responseText?: string

                                            String representation of the Body

                                            -
                                            size?: number
                                            status: number
                                            statusText: string
                                            timeout?: number
                                            type: ResponseType
                                            url: string

                                            Methods

                                            • Returns Promise<ArrayBuffer>

                                            • Returns Promise<Blob>

                                            • Returns Response

                                            • Returns Promise<FormData>

                                            • Returns Promise<any>

                                            • Returns Promise<string>

                                            \ No newline at end of file +
                                            headers: Headers
                                            ok: boolean
                                            redirected: boolean
                                            req?: Quad_Subject

                                            Identifier of the reqest

                                            +
                                            responseText?: string

                                            String representation of the Body

                                            +
                                            size?: number
                                            status: number
                                            statusText: string
                                            timeout?: number
                                            type: ResponseType
                                            url: string

                                            Methods

                                            • Returns Promise<ArrayBuffer>

                                            • Returns Promise<Blob>

                                            • Returns Response

                                            • Returns Promise<FormData>

                                            • Returns Promise<any>

                                            • Returns Promise<string>

                                            \ No newline at end of file diff --git a/doc/interfaces/FetchError.html b/doc/interfaces/FetchError.html index b0d508bdd..861bbb0f0 100644 --- a/doc/interfaces/FetchError.html +++ b/doc/interfaces/FetchError.html @@ -1,7 +1,7 @@ -FetchError | rdflib

                                            Interface FetchError

                                            interface FetchError {
                                                message: string;
                                                name: string;
                                                response?: ExtendedResponse;
                                                stack?: string;
                                                status?: StatusValues;
                                                statusText?: string;
                                            }

                                            Hierarchy

                                            • Error
                                              • FetchError

                                            Properties

                                            message +FetchError | rdflib

                                            Interface FetchError

                                            interface FetchError {
                                                message: string;
                                                name: string;
                                                response?: ExtendedResponse;
                                                stack?: string;
                                                status?: StatusValues;
                                                statusText?: string;
                                            }

                                            Hierarchy

                                            • Error
                                              • FetchError

                                            Properties

                                            message: string
                                            name: string
                                            response?: ExtendedResponse
                                            stack?: string
                                            status?: StatusValues
                                            statusText?: string
                                            \ No newline at end of file +

                                            Properties

                                            message: string
                                            name: string
                                            response?: ExtendedResponse
                                            stack?: string
                                            status?: StatusValues
                                            statusText?: string
                                            \ No newline at end of file diff --git a/doc/modules/uri.html b/doc/modules/uri.html index a5df66a4c..8b45e2b5b 100644 --- a/doc/modules/uri.html +++ b/doc/modules/uri.html @@ -1,4 +1,4 @@ -uri | rdflib

                                            Namespace uri

                                            Index

                                            Functions

                                            docpart +uri | rdflib

                                            Namespace uri

                                            Index

                                            Functions

                                            docpart document hostpart join diff --git a/doc/modules/util.html b/doc/modules/util.html index 451379919..ecb4a0bac 100644 --- a/doc/modules/util.html +++ b/doc/modules/util.html @@ -1,5 +1,5 @@ util | rdflib

                                            Namespace util

                                            Utility functions for $rdf

                                            -

                                            References

                                            log +

                                            References

                                            Variables

                                            Functions

                                            DOMParserFactory diff --git a/doc/variables/DataFactory.html b/doc/variables/DataFactory.html index e2609d655..4ce235e39 100644 --- a/doc/variables/DataFactory.html +++ b/doc/variables/DataFactory.html @@ -1,2 +1,2 @@ DataFactory | rdflib

                                            Variable DataFactoryConst

                                            DataFactory: IRDFlibDataFactory = ...

                                            Full RDFLib.js Data Factory

                                            -
                                            \ No newline at end of file +
                                            \ No newline at end of file diff --git a/doc/variables/NextId.html b/doc/variables/NextId.html index 341a95a68..b3971578c 100644 --- a/doc/variables/NextId.html +++ b/doc/variables/NextId.html @@ -1 +1 @@ -NextId | rdflib

                                            Variable NextIdConst

                                            NextId: number = BlankNode.nextId
                                            \ No newline at end of file +NextId | rdflib

                                            Variable NextIdConst

                                            NextId: number = BlankNode.nextId
                                            \ No newline at end of file diff --git a/doc/variables/jsonParser.html b/doc/variables/jsonParser.html index fa772a7f9..5bc39d325 100644 --- a/doc/variables/jsonParser.html +++ b/doc/variables/jsonParser.html @@ -1 +1 @@ -jsonParser | rdflib

                                            Variable jsonParser

                                            jsonParser: {
                                                parseJSON: ((data, source, store) => void);
                                            }

                                            Type declaration

                                            • parseJSON: ((data, source, store) => void)
                                                • (data, source, store): void
                                                • Parameters

                                                  • data: any
                                                  • source: any
                                                  • store: any

                                                  Returns void

                                            \ No newline at end of file +jsonParser | rdflib

                                            Variable jsonParser

                                            jsonParser: {
                                                parseJSON: ((data, source, store) => void);
                                            }

                                            Type declaration

                                            • parseJSON: ((data, source, store) => void)
                                                • (data, source, store): void
                                                • Parameters

                                                  • data: any
                                                  • source: any
                                                  • store: any

                                                  Returns void

                                            \ No newline at end of file diff --git a/doc/variables/log.html b/doc/variables/log.html index 4761304ca..f05a7e132 100644 --- a/doc/variables/log.html +++ b/doc/variables/log.html @@ -1 +1 @@ -log | rdflib

                                            Variable logConst

                                            log: {
                                                debug(x): void;
                                                error(x): void;
                                                info(x): void;
                                                msg(x): void;
                                                success(x): void;
                                                warn(x): void;
                                            } = ...

                                            Type declaration

                                            • debug:function
                                              • Parameters

                                                • x: any

                                                Returns void

                                            • error:function
                                              • Parameters

                                                • x: any

                                                Returns void

                                            • info:function
                                              • Parameters

                                                • x: any

                                                Returns void

                                            • msg:function
                                            • success:function
                                              • Parameters

                                                • x: any

                                                Returns void

                                            • warn:function
                                              • Parameters

                                                • x: any

                                                Returns void

                                            \ No newline at end of file +log | rdflib

                                            Variable logConst

                                            log: {
                                                debug(x): void;
                                                error(x): void;
                                                info(x): void;
                                                msg(x): void;
                                                success(x): void;
                                                warn(x): void;
                                            } = ...

                                            Type declaration

                                            • debug:function
                                              • Parameters

                                                • x: any

                                                Returns void

                                            • error:function
                                              • Parameters

                                                • x: any

                                                Returns void

                                            • info:function
                                              • Parameters

                                                • x: any

                                                Returns void

                                            • msg:function
                                            • success:function
                                              • Parameters

                                                • x: any

                                                Returns void

                                            • warn:function
                                              • Parameters

                                                • x: any

                                                Returns void

                                            \ No newline at end of file diff --git a/doc/variables/util.string.html b/doc/variables/util.string.html index 4814a4224..a8bc4985d 100644 --- a/doc/variables/util.string.html +++ b/doc/variables/util.string.html @@ -1,2 +1,2 @@ string | rdflib

                                            Variable stringConst

                                            string: {
                                                template: ((base, subs) => string);
                                            } = ...

                                            Type declaration

                                            • template: ((base, subs) => string)
                                                • (base, subs): string
                                                • C++, python style %s -> subs

                                                  -

                                                  Parameters

                                                  • base: any
                                                  • subs: any

                                                  Returns string

                                            \ No newline at end of file +

                                            Parameters

                                            • base: any
                                            • subs: any

                                            Returns string

                                            \ No newline at end of file diff --git a/esm/n3parser.js b/esm/n3parser.js index bb93d4135..673fefee4 100644 --- a/esm/n3parser.js +++ b/esm/n3parser.js @@ -184,7 +184,7 @@ var eol = new RegExp("^[ \\t]*(#[^\\n]*)?\\r?\\n", 'g'); var eof = new RegExp("^[ \\t]*(#[^\\n]*)?$", 'g'); var ws = new RegExp("^[ \\t]*", 'g'); var signed_integer = new RegExp("^[-+]?[0-9]+", 'g'); -var number_syntax = new RegExp("^([-+]?[0-9]+)(\\.[0-9]+)?(e[-+]?[0-9]+)?", 'g'); +var number_syntax = new RegExp("^([-+]?[0-9]+)(\\.[0-9]+)?([eE][-+]?[0-9]+)?", 'g'); var datetime_syntax = new RegExp('^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9](T[0-9][0-9]:[0-9][0-9](:[0-9][0-9](\\.[0-9]*)?)?)?Z?'); var digitstring = new RegExp("^[0-9]+", 'g'); var interesting = new RegExp("[\\\\\\r\\n\\\"]", 'g'); diff --git a/lib/n3parser.js b/lib/n3parser.js index d2430f030..23c9743b1 100644 --- a/lib/n3parser.js +++ b/lib/n3parser.js @@ -195,7 +195,7 @@ var eol = new RegExp("^[ \\t]*(#[^\\n]*)?\\r?\\n", 'g'); var eof = new RegExp("^[ \\t]*(#[^\\n]*)?$", 'g'); var ws = new RegExp("^[ \\t]*", 'g'); var signed_integer = new RegExp("^[-+]?[0-9]+", 'g'); -var number_syntax = new RegExp("^([-+]?[0-9]+)(\\.[0-9]+)?(e[-+]?[0-9]+)?", 'g'); +var number_syntax = new RegExp("^([-+]?[0-9]+)(\\.[0-9]+)?([eE][-+]?[0-9]+)?", 'g'); var datetime_syntax = new RegExp('^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9](T[0-9][0-9]:[0-9][0-9](:[0-9][0-9](\\.[0-9]*)?)?)?Z?'); var digitstring = new RegExp("^[0-9]+", 'g'); var interesting = new RegExp("[\\\\\\r\\n\\\"]", 'g'); diff --git a/src/n3parser.js b/src/n3parser.js index 50e8bb79a..64bb5db5d 100644 --- a/src/n3parser.js +++ b/src/n3parser.js @@ -209,7 +209,7 @@ var eol = new RegExp("^[ \\t]*(#[^\\n]*)?\\r?\\n", 'g'); var eof = new RegExp("^[ \\t]*(#[^\\n]*)?$", 'g'); var ws = new RegExp("^[ \\t]*", 'g'); var signed_integer = new RegExp("^[-+]?[0-9]+", 'g'); -var number_syntax = new RegExp("^([-+]?[0-9]+)(\\.[0-9]+)?(e[-+]?[0-9]+)?", 'g'); +var number_syntax = new RegExp("^([-+]?[0-9]+)(\\.[0-9]+)?([eE][-+]?[0-9]+)?", 'g'); var datetime_syntax = new RegExp('^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9](T[0-9][0-9]:[0-9][0-9](:[0-9][0-9](\\.[0-9]*)?)?)?Z?'); var digitstring = new RegExp("^[0-9]+", 'g');