rdflib 2.3.1 → 2.3.2-2bc27df4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/515.rdflib.min.js +1 -1
- package/dist/515.rdflib.min.js.LICENSE.txt +6 -2
- package/dist/515.rdflib.min.js.map +1 -1
- package/dist/rdflib.min.js +1 -1
- package/dist/rdflib.min.js.LICENSE.txt +0 -9
- package/dist/rdflib.min.js.map +1 -1
- package/esm/factories/rdflib-data-factory.js +1 -3
- package/esm/fetcher.js +9 -15
- package/esm/formula.js +2 -11
- package/esm/parse.js +1 -3
- package/esm/serializer.js +7 -9
- package/esm/store.js +1 -2
- package/esm/update-manager.js +5 -10
- package/esm/utils.js +1 -2
- package/esm/variable.js +1 -2
- package/esm/xsd.js +1 -2
- package/lib/collection.d.ts +1 -1
- package/lib/factories/rdflib-data-factory.js +1 -3
- package/lib/fetcher.js +9 -15
- package/lib/formula.js +2 -11
- package/lib/index.d.ts +1 -1
- package/lib/parse.js +1 -3
- package/lib/rdfaparser.d.ts +9 -9
- package/lib/rdfxmlparser.d.ts +1 -1
- package/lib/serializer.d.ts +10 -11
- package/lib/serializer.js +7 -9
- package/lib/store.js +1 -2
- package/lib/update-manager.js +5 -10
- package/lib/utils.js +1 -2
- package/lib/variable.js +1 -2
- package/lib/xsd-internal.d.ts +7 -7
- package/lib/xsd.d.ts +7 -7
- package/lib/xsd.js +1 -2
- package/package.json +41 -36
- package/src/jsonldparser.js +2 -2
- package/src/n3parser.js +669 -669
- package/src/serializer.js +19 -20
- package/src/xsd-internal.js +1 -1
- package/src/xsd.js +4 -4
- package/dist/789.rdflib.min.js +0 -1
package/dist/rdflib.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see rdflib.min.js.LICENSE.txt */
|
|
2
|
-
!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,s={78:t=>{"use strict";t.exports=Function.prototype.call},182:(t,e,r)=>{"use strict";var n=r(9964),i=r(6357);function s(t){return s="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},s(t)}var o,a,c=r(5403).codes,u=c.ERR_AMBIGUOUS_ARGUMENT,l=c.ERR_INVALID_ARG_TYPE,h=c.ERR_INVALID_ARG_VALUE,f=c.ERR_INVALID_RETURN_VALUE,p=c.ERR_MISSING_ARGS,d=r(5416),y=r(7187).inspect,g=r(7187).types,m=g.isPromise,b=g.isRegExp,w=Object.assign?Object.assign:r(6713).assign,v=Object.is?Object.is:r(8527);function x(){var t=r(6781);o=t.isDeepEqual,a=t.isDeepStrictEqual}new Map;var _=!1,A=t.exports=O,T={};function E(t){if(t.message instanceof Error)throw t.message;throw new d(t)}function N(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 s=new d({actual:r,expected:!0,message:n,operator:"==",stackStartFn:t});throw s.generatedMessage=i,s}}function O(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];N.apply(void 0,[O,e.length].concat(e))}A.fail=function t(e,r,s,o,a){var c,u=arguments.length;if(0===u?c="Failed":1===u?(s=e,e=void 0):(!1===_&&(_=!0,(n.emitWarning?n.emitWarning:i.warn.bind(i))("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.","DeprecationWarning","DEP0094")),2===u&&(o="!=")),s instanceof Error)throw s;var l={actual:e,expected:r,operator:void 0===o?"fail":o,stackStartFn:a||t};void 0!==s&&(l.message=s);var h=new d(l);throw c&&(h.message=c,h.generatedMessage=!0),h},A.AssertionError=d,A.ok=O,A.equal=function t(e,r,n){if(arguments.length<2)throw new p("actual","expected");e!=r&&E({actual:e,expected:r,message:n,operator:"==",stackStartFn:t})},A.notEqual=function t(e,r,n){if(arguments.length<2)throw new p("actual","expected");e==r&&E({actual:e,expected:r,message:n,operator:"!=",stackStartFn:t})},A.deepEqual=function t(e,r,n){if(arguments.length<2)throw new p("actual","expected");void 0===o&&x(),o(e,r)||E({actual:e,expected:r,message:n,operator:"deepEqual",stackStartFn:t})},A.notDeepEqual=function t(e,r,n){if(arguments.length<2)throw new p("actual","expected");void 0===o&&x(),o(e,r)&&E({actual:e,expected:r,message:n,operator:"notDeepEqual",stackStartFn:t})},A.deepStrictEqual=function t(e,r,n){if(arguments.length<2)throw new p("actual","expected");void 0===o&&x(),a(e,r)||E({actual:e,expected:r,message:n,operator:"deepStrictEqual",stackStartFn:t})},A.notDeepStrictEqual=function t(e,r,n){if(arguments.length<2)throw new p("actual","expected");void 0===o&&x(),a(e,r)&&E({actual:e,expected:r,message:n,operator:"notDeepStrictEqual",stackStartFn:t})},A.strictEqual=function t(e,r,n){if(arguments.length<2)throw new p("actual","expected");v(e,r)||E({actual:e,expected:r,message:n,operator:"strictEqual",stackStartFn:t})},A.notStrictEqual=function t(e,r,n){if(arguments.length<2)throw new p("actual","expected");v(e,r)&&E({actual:e,expected:r,message:n,operator:"notStrictEqual",stackStartFn:t})};var j=function t(e,r,n){var i=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r.forEach((function(t){t in e&&(void 0!==n&&"string"==typeof n[t]&&b(e[t])&&e[t].test(n[t])?i[t]=n[t]:i[t]=e[t])}))};function S(t,e,r,n){if("function"!=typeof e){if(b(e))return e.test(t);if(2===arguments.length)throw new l("expected",["Function","RegExp"],e);if("object"!==s(t)||null===t){var i=new d({actual:t,expected:e,message:r,operator:"deepStrictEqual",stackStartFn:n});throw i.operator=n.name,i}var c=Object.keys(e);if(e instanceof Error)c.push("name","message");else if(0===c.length)throw new h("error",e,"may not be an empty object");return void 0===o&&x(),c.forEach((function(i){"string"==typeof t[i]&&b(e[i])&&e[i].test(t[i])||function(t,e,r,n,i,s){if(!(r in t)||!a(t[r],e[r])){if(!n){var o=new j(t,i),c=new j(e,i,t),u=new d({actual:o,expected:c,operator:"deepStrictEqual",stackStartFn:s});throw u.actual=t,u.expected=e,u.operator=s.name,u}E({actual:t,expected:e,message:n,operator:s.name,stackStartFn:s})}}(t,e,i,r,c,n)})),!0}return void 0!==e.prototype&&t instanceof e||!Error.isPrototypeOf(e)&&!0===e.call({},t)}function R(t){if("function"!=typeof t)throw new l("fn","Function",t);try{t()}catch(t){return t}return T}function k(t){return m(t)||null!==t&&"object"===s(t)&&"function"==typeof t.then&&"function"==typeof t.catch}function I(t){return Promise.resolve().then((function(){var e;if("function"==typeof t){if(!k(e=t()))throw new f("instance of Promise","promiseFn",e)}else{if(!k(t))throw new l("promiseFn",["Function","Promise"],t);e=t}return Promise.resolve().then((function(){return e})).then((function(){return T})).catch((function(t){return t}))}))}function C(t,e,r,n){if("string"==typeof r){if(4===arguments.length)throw new l("error",["Object","Error","Function","RegExp"],r);if("object"===s(e)&&null!==e){if(e.message===r)throw new u("error/message",'The error message "'.concat(e.message,'" is identical to the message.'))}else if(e===r)throw new u("error/message",'The error "'.concat(e,'" is identical to the message.'));n=r,r=void 0}else if(null!=r&&"object"!==s(r)&&"function"!=typeof r)throw new l("error",["Object","Error","Function","RegExp"],r);if(e===T){var i="";r&&r.name&&(i+=" (".concat(r.name,")")),i+=n?": ".concat(n):".";var o="rejects"===t.name?"rejection":"exception";E({actual:void 0,expected:r,operator:t.name,message:"Missing expected ".concat(o).concat(i),stackStartFn:t})}if(r&&!S(e,r,n,t))throw e}function P(t,e,r,n){if(e!==T){if("string"==typeof r&&(n=r,r=void 0),!r||S(e,r)){var i=n?": ".concat(n):".",s="doesNotReject"===t.name?"rejection":"exception";E({actual:e,expected:r,operator:t.name,message:"Got unwanted ".concat(s).concat(i,"\n")+'Actual message: "'.concat(e&&e.message,'"'),stackStartFn:t})}throw e}}function F(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];N.apply(void 0,[F,e.length].concat(e))}A.throws=function t(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];C.apply(void 0,[t,R(e)].concat(n))},A.rejects=function t(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return I(e).then((function(e){return C.apply(void 0,[t,e].concat(n))}))},A.doesNotThrow=function t(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];P.apply(void 0,[t,R(e)].concat(n))},A.doesNotReject=function t(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return I(e).then((function(e){return P.apply(void 0,[t,e].concat(n))}))},A.ifError=function t(e){if(null!=e){var r="ifError got unwanted exception: ";"object"===s(e)&&"string"==typeof e.message?0===e.message.length&&e.constructor?r+=e.constructor.name:r+=e.message:r+=y(e);var n=new d({actual:e,expected:null,operator:"ifError",message:r,stackStartFn:t}),i=e.stack;if("string"==typeof i){var o=i.split("\n");o.shift();for(var a=n.stack.split("\n"),c=0;c<o.length;c++){var u=a.indexOf(o[c]);if(-1!==u){a=a.slice(0,u);break}}n.stack="".concat(a.join("\n"),"\n").concat(o.join("\n"))}throw n}},A.strict=w(F,A,{equal:A.strictEqual,deepEqual:A.deepStrictEqual,notEqual:A.notStrictEqual,notDeepEqual:A.notDeepStrictEqual}),A.strict.strict=A.strict},362:(t,e,r)=>{"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:()=>h,DJ:()=>a,DZ:()=>l,GE:()=>b,P3:()=>o,RN:()=>w,SH:()=>i,Y2:()=>d,YC:()=>m,aF:()=>p,c$:()=>f,fY:()=>u,hr:()=>g,jt:()=>y,ok:()=>s});var n=r(6866);function i(t){return"object"==typeof t&&null!==t&&"subject"in t}function s(t){return"object"==typeof t&&null!==t&&"statements"in t}function o(t){return h(t)&&t.termType===n.r0}function a(t){return t&&Object.prototype.hasOwnProperty.call(t,"termType")&&(t.termType===n.Kk||t.termType===n.P2||t.termType===n.$Q||t.termType===n.r0||t.termType===n.QW||t.termType===n.bD)}function c(t){return t&&Object.prototype.hasOwnProperty.call(t,"termType")&&(t.termType===n.Kk||t.termType===n.P2||t.termType===n.$Q||t.termType===n.r0||t.termType===n.QW||t.termType===n.bD)}function u(t){return h(t)&&(t.termType===n.Kk||t.termType===n.$Q||t.termType===n.P2)}function l(t){return h(t)&&t.termType===n.P2}function h(t){return"object"==typeof t&&null!==t&&"termType"in t}function f(t){return t.termType===n.QW}function p(t){return"object"==typeof t&&null!==t&&"subject"in t&&"predicate"in t&&"object"in t}function d(t){return h(t)&&"NamedNode"===t.termType}function y(t){return h(t)&&"termType"in t&&"BlankNode"===t.termType}function g(t){return h(t)&&(t.termType===n.Kk||t.termType===n.P2||t.termType===n.$Q)}function m(t){return h(t)&&(t.termType===n.Kk||t.termType===n.P2)}function b(t){return h(t)&&(t.termType===n.Kk||t.termType===n.P2||t.termType===n.$Q||t.termType===n.QW)}function w(t){return h(t)&&(t.termType===n.Kk||t.termType===n.P2||t.termType===n.$Q||t.termType===n.ic)}},713:t=>{"use strict";t.exports=Number.isNaN||function(t){return t!=t}},716:t=>{"use strict";t.exports=Math.abs},821:(t,e,r)=>{"use strict";var n=r(884),i="undefined"==typeof globalThis?r.g:globalThis;t.exports=function(){for(var t=[],e=0;e<n.length;e++)"function"==typeof i[n[e]]&&(t[t.length]=n[e]);return t}},884:t=>{"use strict";t.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},939:(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)}function i(t,e,r){return(e=function(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.d(e,{A:()=>i})},1147:(t,e,r)=>{var n=r(6357),i="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==r.g&&r.g,s=function(){function t(){this.fetch=!1,this.DOMException=i.DOMException}return t.prototype=i,new t}();!function(t){!function(e){var i=void 0!==t&&t||"undefined"!=typeof self&&self||void 0!==r.g&&r.g||{},s="URLSearchParams"in i,o="Symbol"in i&&"iterator"in Symbol,a="FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch(t){return!1}}(),c="FormData"in i,u="ArrayBuffer"in i;if(u)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(t){return t&&l.indexOf(Object.prototype.toString.call(t))>-1};function f(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function p(t){return"string"!=typeof t&&(t=String(t)),t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return o&&(e[Symbol.iterator]=function(){return e}),e}function y(t){this.map={},t instanceof y?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function g(t){if(!t._noBody)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function m(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function b(t){var e=new FileReader,r=m(e);return e.readAsArrayBuffer(t),r}function w(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:a&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:c&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:s&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():u&&a&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=w(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u&&(ArrayBuffer.prototype.isPrototypeOf(t)||h(t))?this._bodyArrayBuffer=w(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,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):s&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a&&(this.blob=function(){var t=g(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(){if(this._bodyArrayBuffer)return g(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer));if(a)return this.blob().then(b);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t,e,r,n,i,s=g(this);if(s)return s;if(this._bodyBlob)return t=this._bodyBlob,r=m(e=new FileReader),i=(n=/charset=([A-Za-z0-9_-]+)/.exec(t.type))?n[1]:"utf-8",e.readAsText(t,i),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c&&(this.formData=function(){return this.text().then(A)}),this.json=function(){return this.text().then(JSON.parse)},this}y.prototype.append=function(t,e){t=f(t),e=p(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},y.prototype.delete=function(t){delete this.map[f(t)]},y.prototype.get=function(t){return t=f(t),this.has(t)?this.map[t]:null},y.prototype.has=function(t){return this.map.hasOwnProperty(f(t))},y.prototype.set=function(t,e){this.map[f(t)]=p(e)},y.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},y.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),d(t)},y.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),d(t)},y.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),d(t)},o&&(y.prototype[Symbol.iterator]=y.prototype.entries);var x=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function _(t,e){if(!(this instanceof _))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,n,s=(e=e||{}).body;if(t instanceof _){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new y(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,s||null==t._bodyInit||(s=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new y(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),x.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in i)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(s),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var o=/([?&])_=[^&]*/;o.test(this.url)?this.url=this.url.replace(o,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function A(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 T(t,e){if(!(this instanceof T))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new y(e.headers),this.url=e.url||"",this._initBody(t)}_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},v.call(_.prototype),v.call(T.prototype),T.prototype.clone=function(){return new T(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},T.error=function(){var t=new T(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var E=[301,302,303,307,308];T.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new T(null,{status:e,headers:{location:t}})},e.DOMException=i.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 N(t,r){return new Promise((function(s,o){var c=new _(t,r);if(c.signal&&c.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var l=new XMLHttpRequest;function h(){l.abort()}if(l.onload=function(){var t,e,r={statusText:l.statusText,headers:(t=l.getAllResponseHeaders()||"",e=new y,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var s=r.join(":").trim();try{e.append(i,s)}catch(t){n.warn("Response "+t.message)}}})),e)};0===c.url.indexOf("file://")&&(l.status<200||l.status>599)?r.status=200:r.status=l.status,r.url="responseURL"in l?l.responseURL:r.headers.get("X-Request-URL");var i="response"in l?l.response:l.responseText;setTimeout((function(){s(new T(i,r))}),0)},l.onerror=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},l.ontimeout=function(){setTimeout((function(){o(new TypeError("Network request timed out"))}),0)},l.onabort=function(){setTimeout((function(){o(new e.DOMException("Aborted","AbortError"))}),0)},l.open(c.method,function(t){try{return""===t&&i.location.href?i.location.href:t}catch(e){return t}}(c.url),!0),"include"===c.credentials?l.withCredentials=!0:"omit"===c.credentials&&(l.withCredentials=!1),"responseType"in l&&(a?l.responseType="blob":u&&(l.responseType="arraybuffer")),r&&"object"==typeof r.headers&&!(r.headers instanceof y||i.Headers&&r.headers instanceof i.Headers)){var d=[];Object.getOwnPropertyNames(r.headers).forEach((function(t){d.push(f(t)),l.setRequestHeader(t,p(r.headers[t]))})),c.headers.forEach((function(t,e){-1===d.indexOf(e)&&l.setRequestHeader(e,t)}))}else c.headers.forEach((function(t,e){l.setRequestHeader(e,t)}));c.signal&&(c.signal.addEventListener("abort",h),l.onreadystatechange=function(){4===l.readyState&&c.signal.removeEventListener("abort",h)}),l.send(void 0===c._bodyInit?null:c._bodyInit)}))}N.polyfill=!0,i.fetch||(i.fetch=N,i.Headers=y,i.Request=_,i.Response=T),e.Headers=y,e.Request=_,e.Response=T,e.fetch=N,Object.defineProperty(e,"__esModule",{value:!0})}({})}(s),s.fetch.ponyfill=!0,delete s.fetch.polyfill;var o=i.fetch?i:s;(e=o.fetch).default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e},1201:t=>{t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},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}},1605:(t,e,r)=>{"use strict";r.d(e,{A:()=>i});var n=r(939);class i{constructor(t){(0,n.A)(this,"termType",void 0),(0,n.A)(this,"classOrder",void 0),(0,n.A)(this,"value",void 0),this.value=t}substitute(t){return this}compareTerm(t){return this.classOrder<t.classOrder?-1:this.classOrder>t.classOrder?1:this.value<t.value?-1:this.value>t.value?1:0}equals(t){return!!t&&this.termType===t.termType&&this.value===t.value}hashString(){return this.toCanonical()}sameTerm(t){return this.equals(t)}toCanonical(){return this.toNT()}toNT(){return this.toString()}toNQ(){return this.toNT()}toString(){throw new Error("Node.toString() is abstract - see the subclasses instead")}}(0,n.A)(i,"fromValue",void 0),(0,n.A)(i,"toJS",void 0)},1909:t=>{"use strict";t.exports="undefined"!=typeof Reflect&&Reflect&&Reflect.apply},2312:function(t,e){var r,n;void 0===(n="function"==typeof(r=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;e<t.parts.length;e++)r+=t.parts[e]instanceof Array?s(t.parts[e][0])+"-"+s(t.parts[e][1]):s(t.parts[e]);return"["+(t.inverted?"^":"")+r+"]"},any:function(t){return"any character"},end:function(t){return"end of input"},other:function(t){return t.description}};function n(t){return t.charCodeAt(0).toString(16).toUpperCase()}function i(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+n(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+n(t)}))}function s(t){return t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+n(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+n(t)}))}return"Expected "+function(t){var e,n,i,s=new Array(t.length);for(e=0;e<t.length;e++)s[e]=(i=t[e],r[i.type](i));if(s.sort(),s.length>0){for(e=1,n=1;e<s.length;e++)s[e-1]!==s[e]&&(s[n]=s[e],n++);s.length=n}switch(s.length){case 1:return s[0];case 2:return s[0]+" or "+s[1];default:return s.slice(0,-1).join(", ")+", or "+s[s.length-1]}}(t)+" but "+function(t){return t?'"'+i(t)+'"':"end of input"}(e)+" found."},{SyntaxError:t,parse:function(e,r){r=void 0!==r?r:{};var n,i={},s={turtleDoc:Qr},o=Qr,a=function(t){var e=Tn.toJSON();return e["@graph"]=[],t.filter((t=>Array.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="\ufeff",u=Hr("\ufeff",!1),l=".",h=Hr(".",!1),f=function(t){return t},p="#",d=Hr("#",!1),y=/^[^\n]/,g=zr(["\n"],!0,!1),m="\n",b=Hr("\n",!1),w=function(t){return t.join("")},v="@prefix",x=Hr("@prefix",!1),_=function(t,e){return Tn.addPrefix(""===t?"0":t,e),{}},A="@base",T=Hr("@base",!1),E=function(t){return Tn.addBase(t),{}},N=/^[Bb]/,O=zr(["B","b"],!1,!1),j=/^[Aa]/,S=zr(["A","a"],!1,!1),R=/^[Ss]/,k=zr(["S","s"],!1,!1),I=/^[Ee]/,C=zr(["E","e"],!1,!1),P=/^[Pp]/,F=zr(["P","p"],!1,!1),U=/^[Rr]/,D=zr(["R","r"],!1,!1),M=/^[Ff]/,L=zr(["F","f"],!1,!1),B=/^[Ii]/,q=zr(["I","i"],!1,!1),$=/^[Xx]/,H=zr(["X","x"],!1,!1),z=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]},X=function(t,e){var r={};return t&&Object.assign(r,t),e&&Object.assign(r,e),[r]},V=";",G=Hr(";",!1),Q=function(t,e,r,n){var i={};return i[r]=n,i},W=function(t,e,r){return r},J=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=",",Z=Hr(",",!1),K=function(t,e){return e},tt=function(t,e){return e.unshift(t),e},et="a",rt=Hr("a",!1),nt=function(){return"@type"},it=function(t){return En(t,!0)},st=function(t){return En(t,!1)},ot=function(t){return"[]"===t?{}:{"@id":t}},at=function(t){return{"@id":t}},ct="[",ut=Hr("[",!1),lt="]",ht=Hr("]",!1),ft="(",pt=Hr("(",!1),dt=")",yt=Hr(")",!1),gt=function(t){return{"@list":t}},mt=function(t,e){return{"@value":t,"@language":e}},bt="^^",wt=Hr("^^",!1),vt=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=Tn.resolve(e,!0);if(r){const n=e.split(":")[0];if("http://www.w3.org/2001/XMLSchema#boolean"===r&&"true"===t)return Tn.decrement(n),!0;if("http://www.w3.org/2001/XMLSchema#boolean"===r&&"false"===t)return Tn.decrement(n),!1;if("http://www.w3.org/2001/XMLSchema#integer"===r)return Tn.decrement(n),parseInt(t);if("http://www.w3.org/2001/XMLSchema#double"===r)return Tn.decrement(n),parseFloat(t)}return{"@value":t,"@type":e}},xt="true",_t=Hr("true",!1),At=function(){return!0},Tt="false",Et=Hr("false",!1),Nt=function(){return!1},Ot=function(t){return t+":"},jt="<",St=Hr("<",!1),Rt=/^[^\0- <>"{}|\^`\\]/,kt=zr([["\0"," "],"<",">",'"',"{","}","|","^","`","\\"],!0,!1),It=">",Ct=Hr(">",!1),Pt=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 Tn.resolve(r)}catch(t){$r("Invalid IRIREF "+r)}}else $r("Invalid IRIREF "+t.join("")+" / "+e)},Ft=":",Ut=Hr(":",!1),Dt=function(t){return t=t||"0",!1===Tn.hasPrefix(t)&&$r("undefined prefix "+t),t},Mt=function(t){return t||""},Lt=function(t,e){return Tn.increment(t),Tn.resolve(t+":"+e)},Bt="_:",qt=Hr("_:",!1),$t=/^[0-9]/,Ht=zr([["0","9"]],!1,!1),zt="@",Xt=Hr("@",!1),Vt=/^[a-zA-Z]/,Gt=zr([["a","z"],["A","Z"]],!1,!1),Qt="-",Wt=Hr("-",!1),Jt=/^[a-zA-Z0-9]/,Yt=zr([["a","z"],["A","Z"],["0","9"]],!1,!1),Zt=function(t,e){return"-"+e.join("")},Kt=function(t,e){return t.join("")+e.join("")},te=/^[+\-]/,ee=zr(["+","-"],!1,!1),re=function(t){return t.match(/^[0+][0-9]+$/)?{"@value":t,"@type":"http://www.w3.org/2001/XMLSchema#integer"}:parseInt(t)},ne=function(t){return{"@value":t,"@type":"http://www.w3.org/2001/XMLSchema#decimal"}},ie=function(t){return{"@value":t,"@type":"http://www.w3.org/2001/XMLSchema#double"}},se=/^[eE]/,oe=zr(["e","E"],!1,!1),ae='"',ce=Hr('"',!1),ue=/^[^"\\\n\r]/,le=zr(['"',"\\","\n","\r"],!0,!1),he="'",fe=Hr("'",!1),pe=/^[^'\\\n\r]/,de=zr(["'","\\","\n","\r"],!0,!1),ye="'''",ge=Hr("'''",!1),me=/^[^'\\]/,be=zr(["'","\\"],!0,!1),we="''",ve=Hr("''",!1),xe=function(t,e){return"''"+e.join("")},_e=function(t,e){return"'"+e.join("")},Ae=function(t,e){return t.join("")+e.join("")},Te='"""',Ee=Hr('"""',!1),Ne=/^[^"\\]/,Oe=zr(['"',"\\"],!0,!1),je='""',Se=Hr('""',!1),Re=function(t,e){return'""'+e.join("")},ke=function(t,e){return'"'+e.join("")},Ie="\\U",Ce=Hr("\\U",!1),Pe=function(t){return String.fromCodePoint(parseInt(t.join(""),16))},Fe="\\u",Ue=Hr("\\u",!1),De=function(t){return String.fromCharCode(parseInt(t.join(""),16))},Me="\\t",Le=Hr("\\t",!1),Be=function(){return"\t"},qe="\\b",$e=Hr("\\b",!1),He=function(){return"\b"},ze="\\n",Xe=Hr("\\n",!1),Ve=function(){return"\n"},Ge="\\r",Qe=Hr("\\r",!1),We=function(){return"\r"},Je="\\f",Ye=Hr("\\f",!1),Ze=function(){return"\f"},Ke='\\"',tr=Hr('\\"',!1),er=function(){return'"'},rr="\\'",nr=Hr("\\'",!1),ir=function(){return"'"},sr="\\\\",or=Hr("\\\\",!1),ar=function(){return"\\"},cr=/^[ \t\r\n]/,ur=zr([" ","\t","\r","\n"],!1,!1),lr=function(){return"[]"},hr=/^[\uD800-\uDBFF]/,fr=zr([["\ud800","\udbff"]],!1,!1),pr=/^[\uDC00-\uDFFF]/,dr=zr([["\udc00","\udfff"]],!1,!1),yr=function(t,e){return t+e},gr=/^[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]/,mr=zr([["A","Z"],["a","z"],["À","Ö"],["Ø","ö"],["ø","˿"],["Ͱ","ͽ"],["Ϳ",""],["",""],["⁰",""],["Ⰰ",""],["、",""],["豈","﷏"],["ﷰ","�"]],!1,!1),br="_",wr=Hr("_",!1),vr="·",xr=Hr("·",!1),_r=/^[\u0300-\u036F]/,Ar=zr([["̀","ͯ"]],!1,!1),Tr=/^[\u203F-\u2040]/,Er=zr([["‿","⁀"]],!1,!1),Nr=function(t,e,r,n){return r.join("")+n.join("")},Or=function(t,e,r){return t+e.join("")+r.join("")},jr="%",Sr=Hr("%",!1),Rr=/^[0-9A-Fa-f]/,kr=zr([["0","9"],["A","F"],["a","f"]],!1,!1),Ir="\\",Cr=Hr("\\",!1),Pr=/^[_~.!$&'()*+,;=\/?#@%\-]/,Fr=zr(["_","~",".","!","$","&","'","(",")","*","+",",",";","=","/","?","#","@","%","-"],!1,!1),Ur=0,Dr=0,Mr=[{line:1,column:1}],Lr=0,Br=[],qr=0;if("startRule"in r){if(!(r.startRule in s))throw new Error("Can't start parsing from rule \""+r.startRule+'".');o=s[r.startRule]}function $r(e,r){throw function(e,r){return new t(e,null,null,r)}(e,r=void 0!==r?r:Vr(Dr,Ur))}function Hr(t,e){return{type:"literal",text:t,ignoreCase:e}}function zr(t,e,r){return{type:"class",parts:t,inverted:e,ignoreCase:r}}function Xr(t){var r,n=Mr[t];if(n)return n;for(r=t-1;!Mr[r];)r--;for(n={line:(n=Mr[r]).line,column:n.column};r<t;)10===e.charCodeAt(r)?(n.line++,n.column=1):n.column++,r++;return Mr[t]=n,n}function Vr(t,e){var r=Xr(t),n=Xr(e);return{start:{offset:t,line:r.line,column:r.column},end:{offset:e,line:n.line,column:n.column}}}function Gr(t){Ur<Lr||(Ur>Lr&&(Lr=Ur,Br=[]),Br.push(t))}function Qr(){var t,e,r,n,s;for(t=Ur,e=[],r=Wr();r!==i;)e.push(r),r=Wr();if(e!==i){for(r=[],n=Jr();n!==i;)r.push(n),n=Jr();if(r!==i){for(n=[],s=Yr();s!==i;)n.push(s),s=Yr();n!==i?(Dr=t,t=e=a(r)):(Ur=t,t=i)}else Ur=t,t=i}else Ur=t,t=i;return t}function Wr(){var t;return 65279===e.charCodeAt(Ur)?(t=c,Ur++):(t=i,0===qr&&Gr(u)),t}function Jr(){var t,r,n,s;if((t=function(){var t;return(t=function(){var t,r,n,s,o,a,c,u,f;for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();if(r!==i)if(e.substr(Ur,7)===v?(n=v,Ur+=7):(n=i,0===qr&&Gr(x)),n!==i){for(s=[],o=Yr();o!==i;)s.push(o),o=Yr();if(s!==i)if((o=ln())!==i){for(a=[],c=Yr();c!==i;)a.push(c),c=Yr();if(a!==i)if((c=cn())!==i){for(u=[],f=Yr();f!==i;)u.push(f),f=Yr();u!==i?(46===e.charCodeAt(Ur)?(f=l,Ur++):(f=i,0===qr&&Gr(h)),f!==i?(Dr=t,t=r=_(o,c)):(Ur=t,t=i)):(Ur=t,t=i)}else Ur=t,t=i;else Ur=t,t=i}else Ur=t,t=i;else Ur=t,t=i}else Ur=t,t=i;else Ur=t,t=i;return t}())===i&&(t=function(){var t,r,n,s,o,a,c;for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();if(r!==i)if(e.substr(Ur,5)===A?(n=A,Ur+=5):(n=i,0===qr&&Gr(T)),n!==i){for(s=[],o=Yr();o!==i;)s.push(o),o=Yr();if(s!==i)if((o=cn())!==i){for(a=[],c=Yr();c!==i;)a.push(c),c=Yr();a!==i?(46===e.charCodeAt(Ur)?(c=l,Ur++):(c=i,0===qr&&Gr(h)),c!==i?(Dr=t,t=r=E(o)):(Ur=t,t=i)):(Ur=t,t=i)}else Ur=t,t=i;else Ur=t,t=i}else Ur=t,t=i;else Ur=t,t=i;return t}())===i&&(t=function(){var t,r,n,s,o,a,c,u,l,h,f,p;for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();if(r!==i)if(P.test(e.charAt(Ur))?(n=e.charAt(Ur),Ur++):(n=i,0===qr&&Gr(F)),n!==i)if(U.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(D)),s!==i)if(I.test(e.charAt(Ur))?(o=e.charAt(Ur),Ur++):(o=i,0===qr&&Gr(C)),o!==i)if(M.test(e.charAt(Ur))?(a=e.charAt(Ur),Ur++):(a=i,0===qr&&Gr(L)),a!==i)if(B.test(e.charAt(Ur))?(c=e.charAt(Ur),Ur++):(c=i,0===qr&&Gr(q)),c!==i)if($.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(H)),u!==i){for(l=[],h=Yr();h!==i;)l.push(h),h=Yr();if(l!==i)if((h=ln())!==i){for(f=[],p=Yr();p!==i;)f.push(p),p=Yr();f!==i&&(p=cn())!==i?(Dr=t,t=r=_(h,p)):(Ur=t,t=i)}else Ur=t,t=i;else Ur=t,t=i}else Ur=t,t=i;else Ur=t,t=i;else Ur=t,t=i;else Ur=t,t=i;else Ur=t,t=i;else Ur=t,t=i;else Ur=t,t=i;return t}())===i&&(t=function(){var t,r,n,s,o,a,c,u;for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();if(r!==i)if(N.test(e.charAt(Ur))?(n=e.charAt(Ur),Ur++):(n=i,0===qr&&Gr(O)),n!==i)if(j.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(S)),s!==i)if(R.test(e.charAt(Ur))?(o=e.charAt(Ur),Ur++):(o=i,0===qr&&Gr(k)),o!==i)if(I.test(e.charAt(Ur))?(a=e.charAt(Ur),Ur++):(a=i,0===qr&&Gr(C)),a!==i){for(c=[],u=Yr();u!==i;)c.push(u),u=Yr();c!==i&&(u=cn())!==i?(Dr=t,t=r=E(u)):(Ur=t,t=i)}else Ur=t,t=i;else Ur=t,t=i;else Ur=t,t=i;else Ur=t,t=i;else Ur=t,t=i;return t}()),t}())===i)if(t=Ur,(r=function(){var t,e,r;return t=Ur,(e=function(){var t,e;return t=Ur,(e=nn())!==i&&(Dr=t,e=it(e)),(t=e)===i&&(t=an())===i&&(t=on()),t}())!==i&&(r=Zr())!==i?(Dr=t,t=e=z(e,r)):(Ur=t,t=i),t===i&&(t=Ur,(e=rn())!==i?((r=Zr())===i&&(r=null),r!==i?(Dr=t,t=e=X(e,r)):(Ur=t,t=i)):(Ur=t,t=i)),t}())!==i){for(n=[],s=Yr();s!==i;)n.push(s),s=Yr();n!==i?(46===e.charCodeAt(Ur)?(s=l,Ur++):(s=i,0===qr&&Gr(h)),s!==i?(Dr=t,t=r=f(r)):(Ur=t,t=i)):(Ur=t,t=i)}else Ur=t,t=i;return t}function Yr(){var t;return(t=function(){var t;return cr.test(e.charAt(Ur))?(t=e.charAt(Ur),Ur++):(t=i,0===qr&&Gr(ur)),t}())===i&&(t=function(){var t,r,n,s;if(t=Ur,35===e.charCodeAt(Ur)?(r=p,Ur++):(r=i,0===qr&&Gr(d)),r!==i){for(n=[],y.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(g));s!==i;)n.push(s),y.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(g));n!==i?(10===e.charCodeAt(Ur)?(s=m,Ur++):(s=i,0===qr&&Gr(b)),s!==i?(Dr=t,t=r=w(n)):(Ur=t,t=i)):(Ur=t,t=i)}else Ur=t,t=i;return t}()),t}function Zr(){var t,r,n,s,o,a,c,u,l,h;if(t=Ur,(r=tn())!==i)if((n=Kr())!==i){for(s=[],o=Ur,a=[],c=Yr();c!==i;)a.push(c),c=Yr();for(a!==i?(59===e.charCodeAt(Ur)?(c=V,Ur++):(c=i,0===qr&&Gr(G)),c!==i?(u=Ur,(l=tn())!==i&&(h=Kr())!==i?(Dr=u,u=l=Q(r,n,l,h)):(Ur=u,u=i),u===i&&(u=null),u!==i?(Dr=o,o=a=W(r,n,u)):(Ur=o,o=i)):(Ur=o,o=i)):(Ur=o,o=i);o!==i;){for(s.push(o),o=Ur,a=[],c=Yr();c!==i;)a.push(c),c=Yr();a!==i?(59===e.charCodeAt(Ur)?(c=V,Ur++):(c=i,0===qr&&Gr(G)),c!==i?(u=Ur,(l=tn())!==i&&(h=Kr())!==i?(Dr=u,u=l=Q(r,n,l,h)):(Ur=u,u=i),u===i&&(u=null),u!==i?(Dr=o,o=a=W(r,n,u)):(Ur=o,o=i)):(Ur=o,o=i)):(Ur=o,o=i)}s!==i?(Dr=t,t=r=J(r,n,s)):(Ur=t,t=i)}else Ur=t,t=i;else Ur=t,t=i;return t}function Kr(){var t,r,n,s,o,a,c;if(t=Ur,(r=en())!==i){for(n=[],s=Ur,o=[],a=Yr();a!==i;)o.push(a),a=Yr();for(o!==i?(44===e.charCodeAt(Ur)?(a=Y,Ur++):(a=i,0===qr&&Gr(Z)),a!==i&&(c=en())!==i?(Dr=s,s=o=K(r,c)):(Ur=s,s=i)):(Ur=s,s=i);s!==i;){for(n.push(s),s=Ur,o=[],a=Yr();a!==i;)o.push(a),a=Yr();o!==i?(44===e.charCodeAt(Ur)?(a=Y,Ur++):(a=i,0===qr&&Gr(Z)),a!==i&&(c=en())!==i?(Dr=s,s=o=K(r,c)):(Ur=s,s=i)):(Ur=s,s=i)}n!==i?(Dr=t,t=r=tt(r,n)):(Ur=t,t=i)}else Ur=t,t=i;return t}function tn(){var t,r,n;if(t=Ur,(r=function(){var t,e,r;for(t=Ur,e=[],r=Yr();r!==i;)e.push(r),r=Yr();return e!==i&&(r=on())!==i?(Dr=t,t=e=f(r)):(Ur=t,t=i),t}())!==i&&(Dr=t,r=f(r)),(t=r)===i){for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();r!==i?(97===e.charCodeAt(Ur)?(n=et,Ur++):(n=i,0===qr&&Gr(rt)),n!==i?(Dr=t,t=r=nt()):(Ur=t,t=i)):(Ur=t,t=i)}return t}function en(){var t,r;return(t=function(){var t;return(t=function(){var t,r,n,s,o,a,c;for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();if(r!==i)if((n=sn())!==i){for(s=[],o=Yr();o!==i;)s.push(o),o=Yr();s!==i&&(o=function(){var t,r,n,s,o,a,c,u;if(t=Ur,64===e.charCodeAt(Ur)?(r=zt,Ur++):(r=i,0===qr&&Gr(Xt)),r!==i){if(n=[],Vt.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(Gt)),s!==i)for(;s!==i;)n.push(s),Vt.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(Gt));else n=i;if(n!==i){if(s=[],o=Ur,45===e.charCodeAt(Ur)?(a=Qt,Ur++):(a=i,0===qr&&Gr(Wt)),a!==i){if(c=[],Jt.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(Yt)),u!==i)for(;u!==i;)c.push(u),Jt.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(Yt));else c=i;c!==i?(Dr=o,o=a=Zt(n,c)):(Ur=o,o=i)}else Ur=o,o=i;for(;o!==i;)if(s.push(o),o=Ur,45===e.charCodeAt(Ur)?(a=Qt,Ur++):(a=i,0===qr&&Gr(Wt)),a!==i){if(c=[],Jt.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(Yt)),u!==i)for(;u!==i;)c.push(u),Jt.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(Yt));else c=i;c!==i?(Dr=o,o=a=Zt(n,c)):(Ur=o,o=i)}else Ur=o,o=i;s!==i?(Dr=t,t=r=Kt(n,s)):(Ur=t,t=i)}else Ur=t,t=i}else Ur=t,t=i;return t}())!==i?(Dr=t,t=r=mt(n,o)):(Ur=t,t=i)}else Ur=t,t=i;else Ur=t,t=i;if(t===i){for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();if(r!==i)if((n=sn())!==i){for(s=[],o=Yr();o!==i;)s.push(o),o=Yr();if(s!==i)if(e.substr(Ur,2)===bt?(o=bt,Ur+=2):(o=i,0===qr&&Gr(wt)),o!==i){for(a=[],c=Yr();c!==i;)a.push(c),c=Yr();a!==i&&(c=on())!==i?(Dr=t,t=r=vt(n,c)):(Ur=t,t=i)}else Ur=t,t=i;else Ur=t,t=i}else Ur=t,t=i;else Ur=t,t=i;if(t===i){for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();r!==i&&(n=sn())!==i?(Dr=t,t=r=f(n)):(Ur=t,t=i)}}return t}())===i&&(t=function(){var t,r,n;for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();return r!==i?((n=function(){var t,r,n,s,o,a,c,u,f;if(t=Ur,r=Ur,n=Ur,te.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(ee)),s===i&&(s=null),s!==i){if(o=Ur,a=[],$t.test(e.charAt(Ur))?(c=e.charAt(Ur),Ur++):(c=i,0===qr&&Gr(Ht)),c!==i)for(;c!==i;)a.push(c),$t.test(e.charAt(Ur))?(c=e.charAt(Ur),Ur++):(c=i,0===qr&&Gr(Ht));else a=i;if(a!==i)if(46===e.charCodeAt(Ur)?(c=l,Ur++):(c=i,0===qr&&Gr(h)),c!==i){for(u=[],$t.test(e.charAt(Ur))?(f=e.charAt(Ur),Ur++):(f=i,0===qr&&Gr(Ht));f!==i;)u.push(f),$t.test(e.charAt(Ur))?(f=e.charAt(Ur),Ur++):(f=i,0===qr&&Gr(Ht));u!==i&&(f=hn())!==i?o=a=[a,c,u,f]:(Ur=o,o=i)}else Ur=o,o=i;else Ur=o,o=i;if(o===i){if(o=Ur,46===e.charCodeAt(Ur)?(a=l,Ur++):(a=i,0===qr&&Gr(h)),a!==i){if(c=[],$t.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(Ht)),u!==i)for(;u!==i;)c.push(u),$t.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(Ht));else c=i;c!==i&&(u=hn())!==i?o=a=[a,c,u]:(Ur=o,o=i)}else Ur=o,o=i;if(o===i){if(o=Ur,a=[],$t.test(e.charAt(Ur))?(c=e.charAt(Ur),Ur++):(c=i,0===qr&&Gr(Ht)),c!==i)for(;c!==i;)a.push(c),$t.test(e.charAt(Ur))?(c=e.charAt(Ur),Ur++):(c=i,0===qr&&Gr(Ht));else a=i;a!==i&&(c=hn())!==i?o=a=[a,c]:(Ur=o,o=i)}}o!==i?n=s=[s,o]:(Ur=n,n=i)}else Ur=n,n=i;return(r=n!==i?e.substring(r,Ur):n)!==i&&(Dr=t,r=ie(r)),r}())===i&&(n=function(){var t,r,n,s,o,a,c,u;if(t=Ur,r=Ur,n=Ur,te.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(ee)),s===i&&(s=null),s!==i){for(o=[],$t.test(e.charAt(Ur))?(a=e.charAt(Ur),Ur++):(a=i,0===qr&&Gr(Ht));a!==i;)o.push(a),$t.test(e.charAt(Ur))?(a=e.charAt(Ur),Ur++):(a=i,0===qr&&Gr(Ht));if(o!==i)if(46===e.charCodeAt(Ur)?(a=l,Ur++):(a=i,0===qr&&Gr(h)),a!==i){if(c=[],$t.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(Ht)),u!==i)for(;u!==i;)c.push(u),$t.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(Ht));else c=i;c!==i?n=s=[s,o,a,c]:(Ur=n,n=i)}else Ur=n,n=i;else Ur=n,n=i}else Ur=n,n=i;return(r=n!==i?e.substring(r,Ur):n)!==i&&(Dr=t,r=ne(r)),r}())===i&&(n=function(){var t,r,n,s,o,a;if(t=Ur,r=Ur,n=Ur,te.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(ee)),s===i&&(s=null),s!==i){if(o=[],$t.test(e.charAt(Ur))?(a=e.charAt(Ur),Ur++):(a=i,0===qr&&Gr(Ht)),a!==i)for(;a!==i;)o.push(a),$t.test(e.charAt(Ur))?(a=e.charAt(Ur),Ur++):(a=i,0===qr&&Gr(Ht));else o=i;o!==i?n=s=[s,o]:(Ur=n,n=i)}else Ur=n,n=i;return(r=n!==i?e.substring(r,Ur):n)!==i&&(Dr=t,r=re(r)),r}()),n!==i?(Dr=t,t=r=f(n)):(Ur=t,t=i)):(Ur=t,t=i),t}())===i&&(t=function(){var t,r,n;for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();if(r!==i?(e.substr(Ur,4)===xt?(n=xt,Ur+=4):(n=i,0===qr&&Gr(_t)),n!==i?(Dr=t,t=r=At()):(Ur=t,t=i)):(Ur=t,t=i),t===i){for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();r!==i?(e.substr(Ur,5)===Tt?(n=Tt,Ur+=5):(n=i,0===qr&&Gr(Et)),n!==i?(Dr=t,t=r=Nt()):(Ur=t,t=i)):(Ur=t,t=i)}return t}()),t}())===i&&(t=Ur,(r=nn())!==i&&(Dr=t,r=st(r)),(t=r)===i&&(t=Ur,(r=an())!==i&&(Dr=t,r=ot(r)),(t=r)===i&&(t=Ur,(r=rn())!==i&&(Dr=t,r=f(r)),(t=r)===i&&(t=Ur,(r=on())!==i&&(Dr=t,r=at(r)),t=r)))),t}function rn(){var t,r,n,s,o,a;for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();if(r!==i)if(91===e.charCodeAt(Ur)?(n=ct,Ur++):(n=i,0===qr&&Gr(ut)),n!==i)if((s=Zr())!==i){for(o=[],a=Yr();a!==i;)o.push(a),a=Yr();o!==i?(93===e.charCodeAt(Ur)?(a=lt,Ur++):(a=i,0===qr&&Gr(ht)),a!==i?(Dr=t,t=r=f(s)):(Ur=t,t=i)):(Ur=t,t=i)}else Ur=t,t=i;else Ur=t,t=i;else Ur=t,t=i;return t}function nn(){var t,r,n,s,o,a;for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();if(r!==i)if(40===e.charCodeAt(Ur)?(n=ft,Ur++):(n=i,0===qr&&Gr(pt)),n!==i){for(s=[],o=en();o!==i;)s.push(o),o=en();if(s!==i){for(o=[],a=Yr();a!==i;)o.push(a),a=Yr();o!==i?(41===e.charCodeAt(Ur)?(a=dt,Ur++):(a=i,0===qr&&Gr(yt)),a!==i?(Dr=t,t=r=gt(s)):(Ur=t,t=i)):(Ur=t,t=i)}else Ur=t,t=i}else Ur=t,t=i;else Ur=t,t=i;return t}function sn(){var t,r,n;for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();return r!==i?((n=function(){var t,r,n,s,o,a,c,u;if(t=Ur,e.substr(Ur,3)===ye?(r=ye,Ur+=3):(r=i,0===qr&&Gr(ge)),r!==i){for(n=[],me.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(be)),s===i&&(s=pn())===i&&(s=fn());s!==i;)n.push(s),me.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(be)),s===i&&(s=pn())===i&&(s=fn());if(n!==i){if(s=[],o=Ur,e.substr(Ur,2)===we?(a=we,Ur+=2):(a=i,0===qr&&Gr(ve)),a!==i){if(c=[],me.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(be)),u===i&&(u=pn())===i&&(u=fn()),u!==i)for(;u!==i;)c.push(u),me.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(be)),u===i&&(u=pn())===i&&(u=fn());else c=i;c!==i?(Dr=o,o=a=xe(n,c)):(Ur=o,o=i)}else Ur=o,o=i;if(o===i)if(o=Ur,39===e.charCodeAt(Ur)?(a=he,Ur++):(a=i,0===qr&&Gr(fe)),a!==i){if(c=[],me.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(be)),u===i&&(u=pn())===i&&(u=fn()),u!==i)for(;u!==i;)c.push(u),me.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(be)),u===i&&(u=pn())===i&&(u=fn());else c=i;c!==i?(Dr=o,o=a=_e(n,c)):(Ur=o,o=i)}else Ur=o,o=i;for(;o!==i;){if(s.push(o),o=Ur,e.substr(Ur,2)===we?(a=we,Ur+=2):(a=i,0===qr&&Gr(ve)),a!==i){if(c=[],me.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(be)),u===i&&(u=pn())===i&&(u=fn()),u!==i)for(;u!==i;)c.push(u),me.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(be)),u===i&&(u=pn())===i&&(u=fn());else c=i;c!==i?(Dr=o,o=a=xe(n,c)):(Ur=o,o=i)}else Ur=o,o=i;if(o===i)if(o=Ur,39===e.charCodeAt(Ur)?(a=he,Ur++):(a=i,0===qr&&Gr(fe)),a!==i){if(c=[],me.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(be)),u===i&&(u=pn())===i&&(u=fn()),u!==i)for(;u!==i;)c.push(u),me.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(be)),u===i&&(u=pn())===i&&(u=fn());else c=i;c!==i?(Dr=o,o=a=_e(n,c)):(Ur=o,o=i)}else Ur=o,o=i}s!==i?(e.substr(Ur,3)===ye?(o=ye,Ur+=3):(o=i,0===qr&&Gr(ge)),o!==i?(Dr=t,t=r=Ae(n,s)):(Ur=t,t=i)):(Ur=t,t=i)}else Ur=t,t=i}else Ur=t,t=i;return t}())===i&&(n=function(){var t,r,n,s,o,a,c,u;if(t=Ur,e.substr(Ur,3)===Te?(r=Te,Ur+=3):(r=i,0===qr&&Gr(Ee)),r!==i){for(n=[],Ne.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(Oe)),s===i&&(s=pn())===i&&(s=fn());s!==i;)n.push(s),Ne.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(Oe)),s===i&&(s=pn())===i&&(s=fn());if(n!==i){if(s=[],o=Ur,e.substr(Ur,2)===je?(a=je,Ur+=2):(a=i,0===qr&&Gr(Se)),a!==i){if(c=[],Ne.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(Oe)),u===i&&(u=pn())===i&&(u=fn()),u!==i)for(;u!==i;)c.push(u),Ne.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(Oe)),u===i&&(u=pn())===i&&(u=fn());else c=i;c!==i?(Dr=o,o=a=Re(n,c)):(Ur=o,o=i)}else Ur=o,o=i;if(o===i)if(o=Ur,34===e.charCodeAt(Ur)?(a=ae,Ur++):(a=i,0===qr&&Gr(ce)),a!==i){if(c=[],Ne.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(Oe)),u===i&&(u=pn())===i&&(u=fn()),u!==i)for(;u!==i;)c.push(u),Ne.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(Oe)),u===i&&(u=pn())===i&&(u=fn());else c=i;c!==i?(Dr=o,o=a=ke(n,c)):(Ur=o,o=i)}else Ur=o,o=i;for(;o!==i;){if(s.push(o),o=Ur,e.substr(Ur,2)===je?(a=je,Ur+=2):(a=i,0===qr&&Gr(Se)),a!==i){if(c=[],Ne.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(Oe)),u===i&&(u=pn())===i&&(u=fn()),u!==i)for(;u!==i;)c.push(u),Ne.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(Oe)),u===i&&(u=pn())===i&&(u=fn());else c=i;c!==i?(Dr=o,o=a=Re(n,c)):(Ur=o,o=i)}else Ur=o,o=i;if(o===i)if(o=Ur,34===e.charCodeAt(Ur)?(a=ae,Ur++):(a=i,0===qr&&Gr(ce)),a!==i){if(c=[],Ne.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(Oe)),u===i&&(u=pn())===i&&(u=fn()),u!==i)for(;u!==i;)c.push(u),Ne.test(e.charAt(Ur))?(u=e.charAt(Ur),Ur++):(u=i,0===qr&&Gr(Oe)),u===i&&(u=pn())===i&&(u=fn());else c=i;c!==i?(Dr=o,o=a=ke(n,c)):(Ur=o,o=i)}else Ur=o,o=i}s!==i?(e.substr(Ur,3)===Te?(o=Te,Ur+=3):(o=i,0===qr&&Gr(Ee)),o!==i?(Dr=t,t=r=Ae(n,s)):(Ur=t,t=i)):(Ur=t,t=i)}else Ur=t,t=i}else Ur=t,t=i;return t}())===i&&(n=function(){var t,r,n,s;if(t=Ur,39===e.charCodeAt(Ur)?(r=he,Ur++):(r=i,0===qr&&Gr(fe)),r!==i){for(n=[],pe.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(de)),s===i&&(s=pn())===i&&(s=fn());s!==i;)n.push(s),pe.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(de)),s===i&&(s=pn())===i&&(s=fn());n!==i?(39===e.charCodeAt(Ur)?(s=he,Ur++):(s=i,0===qr&&Gr(fe)),s!==i?(Dr=t,t=r=w(n)):(Ur=t,t=i)):(Ur=t,t=i)}else Ur=t,t=i;return t}())===i&&(n=function(){var t,r,n,s;if(t=Ur,34===e.charCodeAt(Ur)?(r=ae,Ur++):(r=i,0===qr&&Gr(ce)),r!==i){for(n=[],ue.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(le)),s===i&&(s=pn())===i&&(s=fn());s!==i;)n.push(s),ue.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(le)),s===i&&(s=pn())===i&&(s=fn());n!==i?(34===e.charCodeAt(Ur)?(s=ae,Ur++):(s=i,0===qr&&Gr(ce)),s!==i?(Dr=t,t=r=w(n)):(Ur=t,t=i)):(Ur=t,t=i)}else Ur=t,t=i;return t}()),n!==i?(Dr=t,t=r=f(n)):(Ur=t,t=i)):(Ur=t,t=i),t}function on(){var t,r,n;for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();if(r!==i&&(n=cn())!==i?(Dr=t,t=r=f(n)):(Ur=t,t=i),t===i){for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();r!==i&&(n=function(){var t,r;return(t=function(){var t,r,n;return t=Ur,(r=un())!==i&&(n=function(){var t,r,n,s,o,a,c,u;if(t=Ur,(r=yn())===i&&(58===e.charCodeAt(Ur)?(r=Ft,Ur++):(r=i,0===qr&&Gr(Ut)),r===i&&($t.test(e.charAt(Ur))?(r=e.charAt(Ur),Ur++):(r=i,0===qr&&Gr(Ht)),r===i&&(r=bn()))),r!==i){for(n=[],(s=gn())===i&&(58===e.charCodeAt(Ur)?(s=Ft,Ur++):(s=i,0===qr&&Gr(Ut)),s===i&&(s=bn()));s!==i;)n.push(s),(s=gn())===i&&(58===e.charCodeAt(Ur)?(s=Ft,Ur++):(s=i,0===qr&&Gr(Ut)),s===i&&(s=bn()));if(n!==i){if(s=[],o=Ur,a=[],46===e.charCodeAt(Ur)?(c=l,Ur++):(c=i,0===qr&&Gr(h)),c!==i)for(;c!==i;)a.push(c),46===e.charCodeAt(Ur)?(c=l,Ur++):(c=i,0===qr&&Gr(h));else a=i;if(a!==i){if(c=[],(u=gn())===i&&(58===e.charCodeAt(Ur)?(u=Ft,Ur++):(u=i,0===qr&&Gr(Ut)),u===i&&(u=bn())),u!==i)for(;u!==i;)c.push(u),(u=gn())===i&&(58===e.charCodeAt(Ur)?(u=Ft,Ur++):(u=i,0===qr&&Gr(Ut)),u===i&&(u=bn()));else c=i;c!==i?(Dr=o,o=a=Nr(r,n,a,c)):(Ur=o,o=i)}else Ur=o,o=i;for(;o!==i;){if(s.push(o),o=Ur,a=[],46===e.charCodeAt(Ur)?(c=l,Ur++):(c=i,0===qr&&Gr(h)),c!==i)for(;c!==i;)a.push(c),46===e.charCodeAt(Ur)?(c=l,Ur++):(c=i,0===qr&&Gr(h));else a=i;if(a!==i){if(c=[],(u=gn())===i&&(58===e.charCodeAt(Ur)?(u=Ft,Ur++):(u=i,0===qr&&Gr(Ut)),u===i&&(u=bn())),u!==i)for(;u!==i;)c.push(u),(u=gn())===i&&(58===e.charCodeAt(Ur)?(u=Ft,Ur++):(u=i,0===qr&&Gr(Ut)),u===i&&(u=bn()));else c=i;c!==i?(Dr=o,o=a=Nr(r,n,a,c)):(Ur=o,o=i)}else Ur=o,o=i}s!==i?(Dr=t,t=r=Or(r,n,s)):(Ur=t,t=i)}else Ur=t,t=i}else Ur=t,t=i;return t}())!==i?(Dr=t,t=r=Lt(r,n)):(Ur=t,t=i),t}())===i&&(t=Ur,(r=un())!==i&&(Dr=t,r=Ot(r)),t=r),t}())!==i?(Dr=t,t=r=f(n)):(Ur=t,t=i)}return t}function an(){var t,r,n;for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();if(r!==i&&(n=function(){var t,r,n,s,o,a,c,u,f,p;if(t=Ur,r=Ur,e.substr(Ur,2)===Bt?(n=Bt,Ur+=2):(n=i,0===qr&&Gr(qt)),n!==i)if((s=yn())===i&&($t.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(Ht))),s!==i){for(o=[],a=gn();a!==i;)o.push(a),a=gn();if(o!==i){if(a=[],c=Ur,u=[],46===e.charCodeAt(Ur)?(f=l,Ur++):(f=i,0===qr&&Gr(h)),f!==i)for(;f!==i;)u.push(f),46===e.charCodeAt(Ur)?(f=l,Ur++):(f=i,0===qr&&Gr(h));else u=i;if(u!==i){if(f=[],(p=gn())!==i)for(;p!==i;)f.push(p),p=gn();else f=i;f!==i?c=u=[u,f]:(Ur=c,c=i)}else Ur=c,c=i;for(;c!==i;){if(a.push(c),c=Ur,u=[],46===e.charCodeAt(Ur)?(f=l,Ur++):(f=i,0===qr&&Gr(h)),f!==i)for(;f!==i;)u.push(f),46===e.charCodeAt(Ur)?(f=l,Ur++):(f=i,0===qr&&Gr(h));else u=i;if(u!==i){if(f=[],(p=gn())!==i)for(;p!==i;)f.push(p),p=gn();else f=i;f!==i?c=u=[u,f]:(Ur=c,c=i)}else Ur=c,c=i}a!==i?r=n=[n,s,o,a]:(Ur=r,r=i)}else Ur=r,r=i}else Ur=r,r=i;else Ur=r,r=i;return r!==i?e.substring(t,Ur):r}())!==i?(Dr=t,t=r=f(n)):(Ur=t,t=i),t===i){for(t=Ur,r=[],n=Yr();n!==i;)r.push(n),n=Yr();r!==i&&(n=function(){var t,r,n,s;if(t=Ur,91===e.charCodeAt(Ur)?(r=ct,Ur++):(r=i,0===qr&&Gr(ut)),r!==i){for(n=[],s=Yr();s!==i;)n.push(s),s=Yr();n!==i?(93===e.charCodeAt(Ur)?(s=lt,Ur++):(s=i,0===qr&&Gr(ht)),s!==i?(Dr=t,t=r=lr()):(Ur=t,t=i)):(Ur=t,t=i)}else Ur=t,t=i;return t}())!==i?(Dr=t,t=r=f(n)):(Ur=t,t=i)}return t}function cn(){var t,r,n,s;if(t=Ur,60===e.charCodeAt(Ur)?(r=jt,Ur++):(r=i,0===qr&&Gr(St)),r!==i){for(n=[],Rt.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(kt)),s===i&&(s=fn());s!==i;)n.push(s),Rt.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(kt)),s===i&&(s=fn());n!==i?(62===e.charCodeAt(Ur)?(s=It,Ur++):(s=i,0===qr&&Gr(Ct)),s!==i?(Dr=t,t=r=Pt(n)):(Ur=t,t=i)):(Ur=t,t=i)}else Ur=t,t=i;return t}function un(){var t,r,n;return t=Ur,(r=mn())===i&&(r=null),r!==i?(58===e.charCodeAt(Ur)?(n=Ft,Ur++):(n=i,0===qr&&Gr(Ut)),n!==i?(Dr=t,t=r=Dt(r)):(Ur=t,t=i)):(Ur=t,t=i),t}function ln(){var t,r,n;return t=Ur,(r=mn())===i&&(r=null),r!==i?(58===e.charCodeAt(Ur)?(n=Ft,Ur++):(n=i,0===qr&&Gr(Ut)),n!==i?(Dr=t,t=r=Mt(r)):(Ur=t,t=i)):(Ur=t,t=i),t}function hn(){var t,r,n,s,o,a;if(t=Ur,r=Ur,se.test(e.charAt(Ur))?(n=e.charAt(Ur),Ur++):(n=i,0===qr&&Gr(oe)),n!==i)if(te.test(e.charAt(Ur))?(s=e.charAt(Ur),Ur++):(s=i,0===qr&&Gr(ee)),s===i&&(s=null),s!==i){if(o=[],$t.test(e.charAt(Ur))?(a=e.charAt(Ur),Ur++):(a=i,0===qr&&Gr(Ht)),a!==i)for(;a!==i;)o.push(a),$t.test(e.charAt(Ur))?(a=e.charAt(Ur),Ur++):(a=i,0===qr&&Gr(Ht));else o=i;o!==i?r=n=[n,s,o]:(Ur=r,r=i)}else Ur=r,r=i;else Ur=r,r=i;return r!==i?e.substring(t,Ur):r}function fn(){var t,r,n,s,o,a,c,u,l,h,f;return t=Ur,e.substr(Ur,2)===Ie?(r=Ie,Ur+=2):(r=i,0===qr&&Gr(Ce)),r!==i?(n=Ur,(s=wn())!==i&&(o=wn())!==i&&(a=wn())!==i&&(c=wn())!==i&&(u=wn())!==i&&(l=wn())!==i&&(h=wn())!==i&&(f=wn())!==i?n=s=[s,o,a,c,u,l,h,f]:(Ur=n,n=i),n!==i?(Dr=t,t=r=Pe(n)):(Ur=t,t=i)):(Ur=t,t=i),t===i&&(t=Ur,e.substr(Ur,2)===Fe?(r=Fe,Ur+=2):(r=i,0===qr&&Gr(Ue)),r!==i?(n=Ur,(s=wn())!==i&&(o=wn())!==i&&(a=wn())!==i&&(c=wn())!==i?n=s=[s,o,a,c]:(Ur=n,n=i),n!==i?(Dr=t,t=r=De(n)):(Ur=t,t=i)):(Ur=t,t=i)),t}function pn(){var t,r;return t=Ur,e.substr(Ur,2)===Me?(r=Me,Ur+=2):(r=i,0===qr&&Gr(Le)),r!==i&&(Dr=t,r=Be()),(t=r)===i&&(t=Ur,e.substr(Ur,2)===qe?(r=qe,Ur+=2):(r=i,0===qr&&Gr($e)),r!==i&&(Dr=t,r=He()),(t=r)===i&&(t=Ur,e.substr(Ur,2)===ze?(r=ze,Ur+=2):(r=i,0===qr&&Gr(Xe)),r!==i&&(Dr=t,r=Ve()),(t=r)===i&&(t=Ur,e.substr(Ur,2)===Ge?(r=Ge,Ur+=2):(r=i,0===qr&&Gr(Qe)),r!==i&&(Dr=t,r=We()),(t=r)===i&&(t=Ur,e.substr(Ur,2)===Je?(r=Je,Ur+=2):(r=i,0===qr&&Gr(Ye)),r!==i&&(Dr=t,r=Ze()),(t=r)===i&&(t=Ur,e.substr(Ur,2)===Ke?(r=Ke,Ur+=2):(r=i,0===qr&&Gr(tr)),r!==i&&(Dr=t,r=er()),(t=r)===i&&(t=Ur,e.substr(Ur,2)===rr?(r=rr,Ur+=2):(r=i,0===qr&&Gr(nr)),r!==i&&(Dr=t,r=ir()),(t=r)===i&&(t=Ur,e.substr(Ur,2)===sr?(r=sr,Ur+=2):(r=i,0===qr&&Gr(or)),r!==i&&(Dr=t,r=ar()),t=r))))))),t}function dn(){var t,r,n;return t=Ur,hr.test(e.charAt(Ur))?(r=e.charAt(Ur),Ur++):(r=i,0===qr&&Gr(fr)),r!==i?(pr.test(e.charAt(Ur))?(n=e.charAt(Ur),Ur++):(n=i,0===qr&&Gr(dr)),n!==i?(Dr=t,t=r=yr(r,n)):(Ur=t,t=i)):(Ur=t,t=i),t===i&&(gr.test(e.charAt(Ur))?(t=e.charAt(Ur),Ur++):(t=i,0===qr&&Gr(mr))),t}function yn(){var t;return(t=dn())===i&&(95===e.charCodeAt(Ur)?(t=br,Ur++):(t=i,0===qr&&Gr(wr))),t}function gn(){var t;return(t=yn())===i&&(45===e.charCodeAt(Ur)?(t=Qt,Ur++):(t=i,0===qr&&Gr(Wt)),t===i&&($t.test(e.charAt(Ur))?(t=e.charAt(Ur),Ur++):(t=i,0===qr&&Gr(Ht)),t===i&&(183===e.charCodeAt(Ur)?(t=vr,Ur++):(t=i,0===qr&&Gr(xr)),t===i&&(_r.test(e.charAt(Ur))?(t=e.charAt(Ur),Ur++):(t=i,0===qr&&Gr(Ar)),t===i&&(Tr.test(e.charAt(Ur))?(t=e.charAt(Ur),Ur++):(t=i,0===qr&&Gr(Er))))))),t}function mn(){var t,r,n,s,o,a,c,u,f;if(t=Ur,r=Ur,(n=dn())!==i){for(s=[],o=gn();o!==i;)s.push(o),o=gn();if(s!==i){if(o=[],a=Ur,c=[],46===e.charCodeAt(Ur)?(u=l,Ur++):(u=i,0===qr&&Gr(h)),u!==i)for(;u!==i;)c.push(u),46===e.charCodeAt(Ur)?(u=l,Ur++):(u=i,0===qr&&Gr(h));else c=i;if(c!==i){if(u=[],(f=gn())!==i)for(;f!==i;)u.push(f),f=gn();else u=i;u!==i?a=c=[c,u]:(Ur=a,a=i)}else Ur=a,a=i;for(;a!==i;){if(o.push(a),a=Ur,c=[],46===e.charCodeAt(Ur)?(u=l,Ur++):(u=i,0===qr&&Gr(h)),u!==i)for(;u!==i;)c.push(u),46===e.charCodeAt(Ur)?(u=l,Ur++):(u=i,0===qr&&Gr(h));else c=i;if(c!==i){if(u=[],(f=gn())!==i)for(;f!==i;)u.push(f),f=gn();else u=i;u!==i?a=c=[c,u]:(Ur=a,a=i)}else Ur=a,a=i}o!==i?r=n=[n,s,o]:(Ur=r,r=i)}else Ur=r,r=i}else Ur=r,r=i;return r!==i?e.substring(t,Ur):r}function bn(){var t;return(t=function(){var t,r,n,s,o;return t=Ur,r=Ur,37===e.charCodeAt(Ur)?(n=jr,Ur++):(n=i,0===qr&&Gr(Sr)),n!==i&&(s=wn())!==i&&(o=wn())!==i?r=n=[n,s,o]:(Ur=r,r=i),r!==i?e.substring(t,Ur):r}())===i&&(t=function(){var t,r,n;return t=Ur,92===e.charCodeAt(Ur)?(r=Ir,Ur++):(r=i,0===qr&&Gr(Cr)),r!==i?(Pr.test(e.charAt(Ur))?(n=e.charAt(Ur),Ur++):(n=i,0===qr&&Gr(Fr)),n!==i?(Dr=t,t=r=f(n)):(Ur=t,t=i)):(Ur=t,t=i),t}()),t}function wn(){var t;return Rr.test(e.charAt(Ur))?(t=e.charAt(Ur),Ur++):(t=i,0===qr&&Gr(kr)),t}var vn,xn,_n,An=function(t){return t.match(/^[a-z](.*?):(.+?)/g)},Tn={base:[],data:{},addBase:function(t){if(0===Tn.base.length)return void Tn.base.push(t);const e=Tn.base[Tn.base.length-1];e!==t&&Tn.base.push(new URL(t,e).toString())},addPrefix:function(t,e){const r=Tn.data[t];void 0===r?Tn.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 n=Object.keys(Tn.data).find((e=>0===t.indexOf(e+":")));if(void 0!==n){const r=Tn.data[n];if(1===r.length&&!0!==e&&An(r[0].uri))return t;const i=r[r.length-1].uri;return t.replace(n+":",i)}var i=0===Tn.base.length?r.baseIRI:Tn.base[Tn.base.length-1];return!i||t.match(/^(http:|https:|urn:|file:)/)?t:0===t.indexOf("//")&&i?i.split("//")[0]+t:new URL(t,i).toString()},increment:function(t){const e=Tn.data[t];void 0!==e&&e[e.length-1].count++},decrement:function(t){const e=Tn.data[t];void 0!==e&&e[e.length-1].count--},toJSON:function(){const t={};return Tn.base.length>0&&(void 0===t["@context"]&&(t["@context"]={}),t["@context"]["@base"]=Tn.base[0]),Object.keys(Tn.data).forEach((e=>{const r=Tn.data[e][0];"http://www.w3.org/2001/XMLSchema#"===r.uri&&r.count<1||An(r.uri)&&(void 0===t["@context"]&&(t["@context"]={}),t["@context"][e]=r.uri)})),t}};function En(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"]=En(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((n=o())!==i&&Ur===e.length)return n;throw n!==i&&Ur<e.length&&Gr({type:"end"}),vn=Br,xn=Lr<e.length?e.charAt(Lr):null,_n=Lr<e.length?Vr(Lr,Lr+1):Vr(Lr,Lr),new t(t.buildMessage(vn,xn),vn,xn,_n)}}})?r.apply(e,[]):r)||(t.exports=n)},2313:(t,e,r)=>{"use strict";var n=r(6357);const i=r(2504),s=r(9029),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=u,e.IS=50;const a=2147483647;function c(t){if(t>a)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(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"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|g(t,e);let n=c(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(J(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(J(t,ArrayBuffer)||t&&J(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(J(t,SharedArrayBuffer)||t&&J(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 u.from(n,e,r);const i=function(t){if(u.isBuffer(t)){const e=0|y(t.length),r=c(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||Y(t.length)?c(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 u.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),c(t<0?0:0|y(t))}function p(t){const e=t.length<0?0:0|y(t.length),r=c(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function y(t){if(t>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||J(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 G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Q(t).length;default:if(i)return n?-1:G(t).length;e=(""+e).toLowerCase(),i=!0}}function m(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 k(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return R(this,e,r);case"base64":return N(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 b(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function w(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),Y(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=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:v(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):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){let s,o=1,a=t.length,c=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;o=2,a/=2,c/=2,r/=2}function u(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){let n=-1;for(s=r;s<a;s++)if(u(t,s)===u(e,-1===n?0:s-n)){if(-1===n&&(n=s),s-n+1===c)return n*o}else-1!==n&&(s-=s-n),n=-1}else for(r+c>a&&(r=a-c),s=r;s>=0;s--){let r=!0;for(let n=0;n<c;n++)if(u(t,s+n)!==u(e,n)){r=!1;break}if(r)return s}return-1}function x(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const s=e.length;let o;for(n>s/2&&(n=s/2),o=0;o<n;++o){const n=parseInt(e.substr(2*o,2),16);if(Y(n))return o;t[r+o]=n}return o}function _(t,e,r,n){return W(G(e,t.length-r),t,r,n)}function A(t,e,r,n){return W(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function T(t,e,r,n){return W(Q(e),t,r,n)}function E(t,e,r,n){return W(function(t,e){let r,n,i;const s=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),n=r>>8,i=r%256,s.push(i),s.push(n);return s}(e,t.length-r),t,r,n)}function N(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(;i<r;){const e=t[i];let s=null,o=e>239?4:e>223?3:e>191?2:1;if(i+o<=r){let r,n,a,c;switch(o){case 1:e<128&&(s=e);break;case 2:r=t[i+1],128==(192&r)&&(c=(31&e)<<6|63&r,c>127&&(s=c));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(c=(15&e)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(s=c));break;case 4:r=t[i+1],n=t[i+2],a=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(s=c))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=o}return function(t){const e=t.length;if(e<=j)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=j));return r}(n)}u.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||void 0===n||"function"!=typeof n.error||n.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return l(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return h(t),t<=0?c(t):void 0!==e?"string"==typeof r?c(t).fill(e,r):c(t).fill(e):c(t)}(t,e,r)},u.allocUnsafe=function(t){return f(t)},u.allocUnsafeSlow=function(t){return f(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(J(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),J(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,s=Math.min(r,n);i<s;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=u.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(J(e,Uint8Array))i+e.length>n.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.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;e<t;e+=2)b(this,e,e+1);return this},u.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)b(this,e,e+3),b(this,e+1,e+2);return this},u.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)b(this,e,e+7),b(this,e+1,e+6),b(this,e+2,e+5),b(this,e+3,e+4);return this},u.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?O(this,0,t):m.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){let t="";const r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(J(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.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 s=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(e>>>=0);const a=Math.min(s,o),c=this.slice(n,i),l=t.slice(e,r);for(let t=0;t<a;++t)if(c[t]!==l[t]){s=c[t],o=l[t];break}return s<o?-1:o<s?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return w(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return w(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=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 s=!1;for(;;)switch(n){case"hex":return x(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":case"latin1":case"binary":return A(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const j=4096;function S(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function R(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function k(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=Z[t[n]];return i}function I(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function C(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,n,i,s){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function F(t,e,r,n,i){H(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,r}function U(t,e,r,n,i){H(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s>>=8,t[r+6]=s,s>>=8,t[r+5]=s,s>>=8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o>>=8,t[r+2]=o,o>>=8,t[r+1]=o,o>>=8,t[r]=o,r+8}function D(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(t,e,r,n,i){return e=+e,r>>>=0,i||D(t,0,r,4),s.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,i){return e=+e,r>>>=0,i||D(t,0,r,8),s.write(t,e,r,n,52,8),r+8}u.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<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);let n=this[t],i=1,s=0;for(;++s<e&&(i*=256);)n+=this[t+s]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=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},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.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]},u.prototype.readUint32BE=u.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])},u.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)<<BigInt(32))})),u.prototype.readBigUInt64BE=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*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)<<BigInt(32))+BigInt(i)})),u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);let n=this[t],i=1,s=0;for(;++s<e&&(i*=256);)n+=this[t+s]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);let n=e,i=1,s=this[t+--n];for(;n>0&&(i*=256);)s+=this[t+--n]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*e)),s},u.prototype.readInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.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},u.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},u.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},u.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]},u.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)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),u.prototype.readBigInt64BE=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<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),u.prototype.readFloatLE=function(t,e){return t>>>=0,e||C(t,4,this.length),s.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||C(t,4,this.length),s.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||C(t,8,this.length),s.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||C(t,8,this.length),s.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.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,s=0;for(this[e]=255&t;++s<r&&(i*=256);)this[e+s]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=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=r-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+r},u.prototype.writeUint8=u.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},u.prototype.writeUint16LE=u.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},u.prototype.writeUint16BE=u.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},u.prototype.writeUint32LE=u.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},u.prototype.writeUint32BE=u.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},u.prototype.writeBigUInt64LE=K((function(t,e=0){return F(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=K((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.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,s=1,o=0;for(this[e]=255&t;++i<r&&(s*=256);)t<0&&0===o&&0!==this[e+i-1]&&(o=1),this[e+i]=(t/s|0)-o&255;return e+r},u.prototype.writeIntBE=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=r-1,s=1,o=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===o&&0!==this[e+i+1]&&(o=1),this[e+i]=(t/s|0)-o&255;return e+r},u.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},u.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},u.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},u.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},u.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},u.prototype.writeBigInt64LE=K((function(t,e=0){return F(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=K((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(t,e,r){return M(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return M(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.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<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=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<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{const s=u.isBuffer(t)?t:u.from(t,n),o=s.length;if(0===o)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=s[i%o]}return this};const B={};function q(t,e,r){B[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function $(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function H(t,e,r,n,i,s){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let i;throw i=s>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(s+1)}${n}`:`>= -(2${n} ** ${8*(s+1)-1}${n}) and < 2 ** ${8*(s+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,s)}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=$(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=$(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function G(t,e){let r;e=e||1/0;const n=t.length;let i=null;const s=[];for(let o=0;o<n;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.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;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function Q(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function W(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function J(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Y(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")}},2504:(t,e)=>{"use strict";e.byteLength=function(t){var e=a(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,s=a(t),o=s[0],c=s[1],u=new i(function(t,e,r){return 3*(e+r)/4-r}(0,o,c)),l=0,h=c>0?o-4:o;for(r=0;r<h;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;return 2===c&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,u[l++]=255&e),1===c&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e),u},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,s=[],o=16383,a=0,u=n-i;a<u;a+=o)s.push(c(t,a,a+o>u?u:a+o));return 1===i?(e=t[n-1],s.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],s.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),s.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)r[o]=s[o],n[s.charCodeAt(o)]=o;function a(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 c(t,e,n){for(var i,s,o=[],a=e;a<n;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),o.push(r[(s=i)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},2621:t=>{"use strict";t.exports=function(t){return t!=t}},2719:t=>{"use strict";var e=Object.prototype.toString,r=Math.max,n=function(t,e){for(var r=[],n=0;n<t.length;n+=1)r[n]=t[n];for(var i=0;i<e.length;i+=1)r[i+t.length]=e[i];return r};t.exports=function(t){var i=this;if("function"!=typeof i||"[object Function]"!==e.apply(i))throw new TypeError("Function.prototype.bind called on incompatible "+i);for(var s,o=function(t){for(var e=[],r=1,n=0;r<t.length;r+=1,n+=1)e[n]=t[r];return e}(arguments),a=r(0,i.length-o.length),c=[],u=0;u<a;u++)c[u]="$"+u;if(s=Function("binder","return function ("+function(t){for(var e="",r=0;r<t.length;r+=1)e+=t[r],r+1<t.length&&(e+=",");return e}(c)+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof s){var e=i.apply(this,n(o,arguments));return Object(e)===e?e:this}return i.apply(t,n(o,arguments))})),i.prototype){var l=function(){};l.prototype=i.prototype,s.prototype=new l,l.prototype=null}return s}},2774:(t,e,r)=>{"use strict";var n=r(8651),i=r(6688),s=i([n("%String.prototype.indexOf%")]);t.exports=function(t,e){var r=n(t,!!e);return"function"==typeof r&&s(t,".prototype.")>-1?i([r]):r}},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(var n 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 i=Object.getOwnPropertySymbols(t);if(1!==i.length||i[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var s=Object.getOwnPropertyDescriptor(t,e);if(42!==s.value||!0!==s.enumerable)return!1}return!0}},3036:t=>{"use strict";t.exports=Function.prototype.apply},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))}},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()}},3381:(t,e,r)=>{"use strict";var n=r(8404),i=r(821),s=r(6601),o=r(2774),a=r(8109),c=r(7106),u=o("Object.prototype.toString"),l=r(6626)(),h="undefined"==typeof globalThis?r.g:globalThis,f=i(),p=o("String.prototype.slice"),d=o("Array.prototype.indexOf",!0)||function(t,e){for(var r=0;r<t.length;r+=1)if(t[r]===e)return r;return-1},y={__proto__:null};n(f,l&&a&&c?function(t){var e=new h[t];if(Symbol.toStringTag in e&&c){var r=c(e),n=a(r,Symbol.toStringTag);if(!n&&r){var i=c(r);n=a(i,Symbol.toStringTag)}y["$"+t]=s(n.get)}}:function(t){var e=new h[t],r=e.slice||e.set;r&&(y["$"+t]=s(r))}),t.exports=function(t){if(!t||"object"!=typeof t)return!1;if(!l){var e=p(u(t),8,-1);return d(f,e)>-1?e:"Object"===e&&function(t){var e=!1;return n(y,(function(r,n){if(!e)try{r(t),e=p(n,1)}catch(t){}})),e}(t)}return a?function(t){var e=!1;return n(y,(function(r,n){if(!e)try{"$"+r(t)===n&&(e=p(n,1))}catch(t){}})),e}(t):null}},3534:(t,e,r)=>{"use strict";var n=r(9636),i=r(5421);t.exports=function(){var t=n();return i(Object,{is:t},{is:function(){return Object.is!==t}}),t}},3627:(t,e,r)=>{"use strict";r.d(e,{A:()=>u});var n=r(939),i=r(9390),s=r(1605),o=r(6866),a=r(362),c=r(546);class u extends s.A{constructor(t){if(super((0,a.E)(t)),(0,n.A)(this,"termType",o.Kk),(0,n.A)(this,"classOrder",i.A.NamedNode),!this.value)throw new Error("Missing IRI for NamedNode");if(!this.value.includes(":"))throw new Error('NamedNode IRI "'+t+'" must be absolute.');if(this.value.includes(" "))throw new Error('Error: NamedNode IRI "'+t+'" must not contain unencoded spaces.')}dir(){var t=this.value.split("#")[0],e=t.slice(0,-1).lastIndexOf("/"),r=t.indexOf("//");return r>=0&&e<r+2||e<0?null:new u(t.slice(0,e+1))}site(){var t=this.value.split("#")[0],e=t.indexOf("//");if(e<0)throw new Error("This URI does not have a web site part (origin)");var r=t.indexOf("/",e+2);return new u(r<0?t.slice(0)+"/":t.slice(0,r+1))}doc(){return this.value.indexOf("#")<0?this:new u(this.value.split("#")[0])}toString(){return"<"+this.value+">"}id(){return this.value.split("#")[1]}get uri(){return this.value}set uri(t){this.value=t}static fromValue(t){return null==t||(0,c.D0)(t)?t:new u(t)}}},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 s=/^\s*class\b/,o=function(t){try{var e=n.call(t);return s.test(e)}catch(t){return!1}},a=function(t){try{return!o(t)&&(n.call(t),!0)}catch(t){return!1}},c=Object.prototype.toString,u="function"==typeof Symbol&&!!Symbol.toStringTag,l=!(0 in[,]),h=function(){return!1};if("object"==typeof document){var f=document.all;c.call(f)===c.call(document.all)&&(h=function(t){if((l||!t)&&(void 0===t||"object"==typeof t))try{var e=c.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!o(t)&&a(t)}:function(t){if(h(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(u)return a(t);if(o(t))return!1;var e=c.call(t);return!("[object Function]"!==e&&"[object GeneratorFunction]"!==e&&!/^\[object HTML/.test(e))&&a(t)}},3766:(t,e,r)=>{"use strict";var n=r(5846);t.exports=n.getPrototypeOf||null},3774:t=>{"use strict";t.exports=Math.max},3787:(t,e,r)=>{"use strict";r.d(e,{A:()=>n});const n={debug(t){},warn(t){},info(t){},error(t){},success(t){},msg(t){}}},4055:t=>{"use strict";t.exports=URIError},4221:(t,e,r)=>{"use strict";r.r(e),r.d(e,{docpart:()=>o,document:()=>a,hostpart:()=>c,join:()=>u,protocol:()=>l,refTo:()=>h});var n=r(3627),i=r(6357),s=s||i.log;function o(t){var e;return(e=t.indexOf("#"))<0?t:t.slice(0,e)}function a(t){return new n.A(o(t))}function c(t){var e=/[^\/]*\/\/([^\/]*)\//.exec(t);return e?e[1]:""}function u(t,e){var r,n,i,o,a,c=e.indexOf("#");if(c>0&&(e=e.slice(0,c)),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 s("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((o=(a=e.slice(i)).lastIndexOf("/"))<0)return n+t;for(o>=0&&o<a.length-1&&(a=a.slice(0,+o+1||9e9)),a+=t;a.match(/[^\/]*\/\.\.\//);)a=a.replace(/[^\/]*\/\.\.\//,"");return a=(a=a.replace(/\.\//g,"")).replace(/\/\.$/,"/"),e.slice(0,i)+a}function l(t){const e=t.indexOf(":");return e<0?null:t.slice(0,e)}function h(t,e){var r,n,i,s,o,a,c,u,l,h,f,p,d=new RegExp("^[-_a-zA-Z0-9.]+:(//[^/]*)?/[^/]*$");if(!t)return e;if(t===e)return"";for(r=c=0,s=e.length;c<s&&e[r]===t[r];r=++c);if(t.slice(0,r).match(d)&&((n=e.indexOf("//"))<0&&(n=-2),i=e.indexOf("/",n+2),"/"!==e[i+1]&&"/"!==t[i+1]&&e.slice(0,i)===t.slice(0,i)))return e.slice(i);if("#"===e[r]&&t.length===r)return e.slice(r);for(;r>0&&"/"!==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(a=0,u=0,o=(h=t.slice(r)).length;u<o;u++)"/"===h[u]&&a++;if(0===a&&r<e.length&&"#"===e[r])return"./"+e.slice(r);if(0===a&&r===e.length)return"./";if(p="",a>0)for(l=1,f=a;f>=1?l<=f:l>=f;f>=1?++l:--l)p+="../";return p+e.slice(r)}},4610:(t,e,r)=>{"use strict";var n,i=Object.prototype.toString,s=Function.prototype.toString,o=/^\s*(?:function)?\*/,a=r(6626)(),c=Object.getPrototypeOf;t.exports=function(t){if("function"!=typeof t)return!1;if(o.test(s.call(t)))return!0;if(!a)return"[object GeneratorFunction]"===i.call(t);if(!c)return!1;if(void 0===n){var e=function(){if(!a)return!1;try{return Function("return function*() {}")()}catch(t){}}();n=!!e&&c(e)}return c(t)===n}},5049:(t,e,r)=>{"use strict";var n=r(2719);t.exports=Function.prototype.bind||n},5074:(t,e,r)=>{"use strict";var n=r(5421),i=r(1320);t.exports=function(){var t=i();return n(Number,{isNaN:t},{isNaN:function(){return Number.isNaN!==t}}),t}},5215:(t,e,r)=>{"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,s=r(5049);t.exports=s.call(n,i)},5293:t=>{"use strict";t.exports=Error},5403:(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)}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},i(t)}function s(t,e){return s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},s(t,e)}var o,a,c={};function u(t,e,r){r||(r=Error);var o=function(r){function o(r,s,a){var c;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),c=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(o).call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,s,a))),c.code=t,c}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&&s(t,e)}(o,r),o}(r);c[t]=o}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))}u("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),u("ERR_INVALID_ARG_TYPE",(function(t,e,i){var s,a,c,u,h;if(void 0===o&&(o=r(182)),o("string"==typeof t,"'name' must be a string"),"string"==typeof e&&(a="not ",e.substr(0,4)===a)?(s="must not be",e=e.replace(/^not /,"")):s="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-9,r)===e}(t," argument"))c="The ".concat(t," ").concat(s," ").concat(l(e,"type"));else{var f=("number"!=typeof h&&(h=0),h+1>(u=t).length||-1===u.indexOf(".",h)?"argument":"property");c='The "'.concat(t,'" ').concat(f," ").concat(s," ").concat(l(e,"type"))}return c+". Received type ".concat(n(i))}),TypeError),u("ERR_INVALID_ARG_VALUE",(function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid";void 0===a&&(a=r(7187));var i=a.inspect(e);return i.length>128&&(i="".concat(i.slice(0,128),"...")),"The argument '".concat(t,"' ").concat(n,". Received ").concat(i)}),TypeError,RangeError),u("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),u("ERR_MISSING_ARGS",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];void 0===o&&(o=r(182)),o(e.length>0,"At least one arg needs to be specified");var i="The ",s=e.length;switch(e=e.map((function(t){return'"'.concat(t,'"')})),s){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,s-1).join(", "),i+=", and ".concat(e[s-1]," arguments")}return"".concat(i," must be specified")}),TypeError),t.exports.codes=c},5416:(t,e,r)=>{"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 s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return!e||"object"!==f(e)&&"function"!=typeof e?a(t):e}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function c(t){var e="function"==typeof Map?new Map:void 0;return c=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return u(t,arguments,h(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),l(n,t)},c(t)}function u(t,e,r){return u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&l(i,r.prototype),i},u.apply(null,arguments)}function l(t,e){return l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},l(t,e)}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}function f(t){return f="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},f(t)}var p=r(7187).inspect,d=r(5403).codes.ERR_INVALID_ARG_TYPE;function y(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}var g="",m="",b="",w="",v={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 x(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 _(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 A=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,s=t.operator,c=t.stackStartFn,u=t.actual,l=t.expected,p=Error.stackTraceLimit;if(Error.stackTraceLimit=0,null!=i)r=o(this,h(e).call(this,String(i)));else if(n.stderr&&n.stderr.isTTY&&(n.stderr&&n.stderr.getColorDepth&&1!==n.stderr.getColorDepth()?(g="[34m",m="[32m",w="[39m",b="[31m"):(g="",m="",w="",b="")),"object"===f(u)&&null!==u&&"object"===f(l)&&null!==l&&"stack"in u&&u instanceof Error&&"stack"in l&&l instanceof Error&&(u=x(u),l=x(l)),"deepStrictEqual"===s||"strictEqual"===s)r=o(this,h(e).call(this,function(t,e,r){var i="",s="",o=0,a="",c=!1,u=_(t),l=u.split("\n"),h=_(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 x=l[0].length+h[0].length;if(x<=10){if(!("object"===f(t)&&null!==t||"object"===f(e)&&null!==e||0===t&&0===e))return"".concat(v[r],"\n\n")+"".concat(l[0]," !== ").concat(h[0],"\n")}else if("strictEqualObject"!==r&&x<(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 A=l[l.length-1],T=h[h.length-1];A===T&&(p++<2?a="\n ".concat(A).concat(a):i=A,l.pop(),h.pop(),0!==l.length&&0!==h.length);)A=l[l.length-1],T=h[h.length-1];var E=Math.max(l.length,h.length);if(0===E){var N=u.split("\n");if(N.length>30)for(N[26]="".concat(g,"...").concat(w);N.length>27;)N.pop();return"".concat(v.notIdentical,"\n\n").concat(N.join("\n"),"\n")}p>3&&(a="\n".concat(g,"...").concat(w).concat(a),c=!0),""!==i&&(a="\n ".concat(i).concat(a),i="");var O=0,j=v[r]+"\n".concat(m,"+ actual").concat(w," ").concat(b,"- expected").concat(w),S=" ".concat(g,"...").concat(w," Lines skipped");for(p=0;p<E;p++){var R=p-o;if(l.length<p+1)R>1&&p>2&&(R>4?(s+="\n".concat(g,"...").concat(w),c=!0):R>3&&(s+="\n ".concat(h[p-2]),O++),s+="\n ".concat(h[p-1]),O++),o=p,i+="\n".concat(b,"-").concat(w," ").concat(h[p]),O++;else if(h.length<p+1)R>1&&p>2&&(R>4?(s+="\n".concat(g,"...").concat(w),c=!0):R>3&&(s+="\n ".concat(l[p-2]),O++),s+="\n ".concat(l[p-1]),O++),o=p,s+="\n".concat(m,"+").concat(w," ").concat(l[p]),O++;else{var k=h[p],I=l[p],C=I!==k&&(!y(I,",")||I.slice(0,-1)!==k);C&&y(k,",")&&k.slice(0,-1)===I&&(C=!1,I+=","),C?(R>1&&p>2&&(R>4?(s+="\n".concat(g,"...").concat(w),c=!0):R>3&&(s+="\n ".concat(l[p-2]),O++),s+="\n ".concat(l[p-1]),O++),o=p,s+="\n".concat(m,"+").concat(w," ").concat(I),i+="\n".concat(b,"-").concat(w," ").concat(k),O+=2):(s+=i,i="",1!==R&&0!==p||(s+="\n ".concat(I),O++))}if(O>20&&p<E-2)return"".concat(j).concat(S,"\n").concat(s,"\n").concat(g,"...").concat(w).concat(i,"\n")+"".concat(g,"...").concat(w)}return"".concat(j).concat(c?S:"","\n").concat(s).concat(i).concat(a).concat(d)}(u,l,s)));else if("notDeepStrictEqual"===s||"notStrictEqual"===s){var A=v[s],T=_(u).split("\n");if("notStrictEqual"===s&&"object"===f(u)&&null!==u&&(A=v.notStrictEqualObject),T.length>30)for(T[26]="".concat(g,"...").concat(w);T.length>27;)T.pop();r=1===T.length?o(this,h(e).call(this,"".concat(A," ").concat(T[0]))):o(this,h(e).call(this,"".concat(A,"\n\n").concat(T.join("\n"),"\n")))}else{var E=_(u),N="",O=v[s];"notDeepEqual"===s||"notEqual"===s?(E="".concat(v[s],"\n\n").concat(E)).length>1024&&(E="".concat(E.slice(0,1021),"...")):(N="".concat(_(l)),E.length>512&&(E="".concat(E.slice(0,509),"...")),N.length>512&&(N="".concat(N.slice(0,509),"...")),"deepEqual"===s||"equal"===s?E="".concat(O,"\n\n").concat(E,"\n\nshould equal\n\n"):N=" ".concat(s," ").concat(N)),r=o(this,h(e).call(this,"".concat(E).concat(N)))}return Error.stackTraceLimit=p,r.generatedMessage=!i,Object.defineProperty(a(r),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),r.code="ERR_ASSERTION",r.actual=u,r.expected=l,r.operator=s,Error.captureStackTrace&&Error.captureStackTrace(a(r),c),r.stack,r.name="AssertionError",o(r)}var r,c;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,c=[{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<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})))),n.forEach((function(e){i(t,e,r[e])}))}return t}({},e,{customInspect:!1,depth:0}))}}],c&&s(r.prototype,c),e}(c(Error));t.exports=A},5421:(t,e,r)=>{"use strict";var n=r(5643),i="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),s=Object.prototype.toString,o=Array.prototype.concat,a=Object.defineProperty,c=r(8890)(),u=a&&c,l=function(t,e,r,n){var i;(!(e in t)||"function"==typeof(i=n)&&"[object Function]"===s.call(i)&&n())&&(u?a(t,e,{configurable:!0,enumerable:!1,value:r,writable:!0}):t[e]=r)},h=function(t,e){var r=arguments.length>2?arguments[2]:{},s=n(e);i&&(s=o.call(s,Object.getOwnPropertySymbols(e)));for(var a=0;a<s.length;a+=1)l(t,s[a],e[s[a]],r[s[a]])};h.supportsDescriptors=!!u,t.exports=h},5567:t=>{"use strict";t.exports=Object.getOwnPropertyDescriptor},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)))},5643:(t,e,r)=>{"use strict";var n=Array.prototype.slice,i=r(6515),s=Object.keys,o=s?function(t){return s(t)}:r(8461),a=Object.keys;o.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)?a(n.call(t)):a(t)})}else Object.keys=o;return Object.keys||o},t.exports=o},5846:t=>{"use strict";t.exports=Object},5874:t=>{"use strict";t.exports=Math.pow},6071:(t,e,r)=>{"use strict";var n=r(713);t.exports=function(t){return n(t)||0===t?t:t<0?-1:1}},6094:(t,e,r)=>{"use strict";var n=r(3381);t.exports=function(t){return!!n(t)}},6255:(t,e,r)=>{"use strict";var n=r(8651),i=r(9295),s=r(8890)(),o=r(8109),a=r(6785),c=n("%Math.floor%");t.exports=function(t,e){if("function"!=typeof t)throw new a("`fn` is not a function");if("number"!=typeof e||e<0||e>4294967295||c(e)!==e)throw new a("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,u=!0;if("length"in t&&o){var l=o(t,"length");l&&!l.configurable&&(n=!1),l&&!l.writable&&(u=!1)}return(n||u||!r)&&(s?i(t,"length",e,!0,!0):i(t,"length",e)),t}},6357:(t,e,r)=>{var n=r(7187),i=r(182);function s(){return(new Date).getTime()}var o,a=Array.prototype.slice,c={};o=void 0!==r.g&&r.g.console?r.g.console:"undefined"!=typeof window&&window.console?window.console:{};for(var u=[[function(){},"log"],[function(){o.log.apply(o,arguments)},"info"],[function(){o.log.apply(o,arguments)},"warn"],[function(){o.warn.apply(o,arguments)},"error"],[function(t){c[t]=s()},"time"],[function(t){var e=c[t];if(!e)throw new Error("No such label: "+t);delete c[t];var r=s()-e;o.log(t+": "+r+"ms")},"timeEnd"],[function(){var t=new Error;t.name="Trace",t.message=n.format.apply(null,arguments),o.error(t.stack)},"trace"],[function(t){o.log(n.inspect(t)+"\n")},"dir"],[function(t){if(!t){var e=a.call(arguments,1);i.ok(!1,n.format.apply(null,e))}},"assert"]],l=0;l<u.length;l++){var h=u[l],f=h[0],p=h[1];o[p]||(o[p]=f)}t.exports=o},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}},6601:(t,e,r)=>{"use strict";var n=r(6255),i=r(6649),s=r(6688),o=r(8619);t.exports=function(t){var e=s(arguments),r=t.length-(arguments.length-1);return n(e,1+(r>0?r:0),!0)},i?i(t.exports,"apply",{value:o}):t.exports.apply=o},6626:(t,e,r)=>{"use strict";var n=r(2843);t.exports=function(){return n()&&!!Symbol.toStringTag}},6649:t=>{"use strict";var e=Object.defineProperty||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}t.exports=e},6688:(t,e,r)=>{"use strict";var n=r(5049),i=r(6785),s=r(78),o=r(7802);t.exports=function(t){if(t.length<1||"function"!=typeof t[0])throw new i("a function is required");return o(n,s,t)}},6713:t=>{"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<arguments.length;n++){var i=arguments[n];if(null!=i)for(var s=Object.keys(Object(i)),o=0,a=s.length;o<a;o++){var c=s[o],u=Object.getOwnPropertyDescriptor(i,c);void 0!==u&&u.enumerable&&(r[c]=i[c])}}return r}t.exports={assign:e,polyfill:function(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:e})}}},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,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(n=(o=a.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(t){i=!0,s=t}finally{try{n||null==a.return||a.return()}finally{if(i)throw s}}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 s=void 0!==/a/g.flags,o=function(t){var e=[];return t.forEach((function(t){return e.push(t)})),e},a=function(t){var e=[];return t.forEach((function(t,r){return e.push([r,t])})),e},c=Object.is?Object.is:r(8527),u=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,g=y.isAnyArrayBuffer,m=y.isArrayBufferView,b=y.isDate,w=y.isMap,v=y.isRegExp,x=y.isSet,_=y.isNativeError,A=y.isBoxedPrimitive,T=y.isNumberObject,E=y.isStringObject,N=y.isBooleanObject,O=y.isBigIntObject,j=y.isSymbolObject,S=y.isFloat32Array,R=y.isFloat64Array;function k(t){if(0===t.length||t.length>10)return!0;for(var e=0;e<t.length;e++){var r=t.charCodeAt(e);if(r<48||r>57)return!0}return 10===t.length&&t>=Math.pow(2,32)}function I(t){return Object.keys(t).filter(k).concat(u(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,s=Math.min(r,n);i<s;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0}function P(t,e,r,n){if(t===e)return 0!==t||!r||c(t,e);if(r){if("object"!==i(t))return"number"==typeof t&&l(t)&&l(e);if("object"!==i(e)||null===t||null===e)return!1;if(Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1}else{if(null===t||"object"!==i(t))return(null===e||"object"!==i(e))&&t==e;if(null===e||"object"!==i(e))return!1}var o,a,u,h,f=d(t);if(f!==d(e))return!1;if(Array.isArray(t)){if(t.length!==e.length)return!1;var p=I(t),y=I(e);return p.length===y.length&&U(t,e,r,n,1,p)}if("[object Object]"===f&&(!w(t)&&w(e)||!x(t)&&x(e)))return!1;if(b(t)){if(!b(e)||Date.prototype.getTime.call(t)!==Date.prototype.getTime.call(e))return!1}else if(v(t)){if(!v(e)||(u=t,h=e,!(s?u.source===h.source&&u.flags===h.flags:RegExp.prototype.toString.call(u)===RegExp.prototype.toString.call(h))))return!1}else if(_(t)||t instanceof Error){if(t.message!==e.message||t.name!==e.name)return!1}else{if(m(t)){if(r||!S(t)&&!R(t)){if(!function(t,e){return t.byteLength===e.byteLength&&0===C(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}(t,e))return!1}else if(!function(t,e){if(t.byteLength!==e.byteLength)return!1;for(var r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}(t,e))return!1;var k=I(t),P=I(e);return k.length===P.length&&U(t,e,r,n,0,k)}if(x(t))return!(!x(e)||t.size!==e.size)&&U(t,e,r,n,2);if(w(t))return!(!w(e)||t.size!==e.size)&&U(t,e,r,n,3);if(g(t)){if(a=e,(o=t).byteLength!==a.byteLength||0!==C(new Uint8Array(o),new Uint8Array(a)))return!1}else if(A(t)&&!function(t,e){return T(t)?T(e)&&c(Number.prototype.valueOf.call(t),Number.prototype.valueOf.call(e)):E(t)?E(e)&&String.prototype.valueOf.call(t)===String.prototype.valueOf.call(e):N(t)?N(e)&&Boolean.prototype.valueOf.call(t)===Boolean.prototype.valueOf.call(e):O(t)?O(e)&&BigInt.prototype.valueOf.call(t)===BigInt.prototype.valueOf.call(e):j(e)&&Symbol.prototype.valueOf.call(t)===Symbol.prototype.valueOf.call(e)}(t,e))return!1}return U(t,e,r,n,0)}function F(t,e){return e.filter((function(e){return p(t,e)}))}function U(t,e,r,s,c,l){if(5===arguments.length){l=Object.keys(t);var h=Object.keys(e);if(l.length!==h.length)return!1}for(var d=0;d<l.length;d++)if(!f(e,l[d]))return!1;if(r&&5===arguments.length){var y=u(t);if(0!==y.length){var g=0;for(d=0;d<y.length;d++){var m=y[d];if(p(t,m)){if(!p(e,m))return!1;l.push(m),g++}else if(p(e,m))return!1}var b=u(e);if(y.length!==b.length&&F(e,b).length!==g)return!1}else{var w=u(e);if(0!==w.length&&0!==F(e,w).length)return!1}}if(0===l.length&&(0===c||1===c&&0===t.length||0===t.size))return!0;if(void 0===s)s={val1:new Map,val2:new Map,position:0};else{var v=s.val1.get(t);if(void 0!==v){var x=s.val2.get(e);if(void 0!==x)return v===x}s.position++}s.val1.set(t,s.position),s.val2.set(e,s.position);var _=function(t,e,r,s,c,u){var l=0;if(2===u){if(!function(t,e,r,n){for(var s=null,a=o(t),c=0;c<a.length;c++){var u=a[c];if("object"===i(u)&&null!==u)null===s&&(s=new Set),s.add(u);else if(!e.has(u)){if(r)return!1;if(!L(t,e,u))return!1;null===s&&(s=new Set),s.add(u)}}if(null!==s){for(var l=o(e),h=0;h<l.length;h++){var f=l[h];if("object"===i(f)&&null!==f){if(!D(s,f,r,n))return!1}else if(!r&&!t.has(f)&&!D(s,f,r,n))return!1}return 0===s.size}return!0}(t,e,r,c))return!1}else if(3===u){if(!function(t,e,r,s){for(var o=null,c=a(t),u=0;u<c.length;u++){var l=n(c[u],2),h=l[0],f=l[1];if("object"===i(h)&&null!==h)null===o&&(o=new Set),o.add(h);else{var p=e.get(h);if(void 0===p&&!e.has(h)||!P(f,p,r,s)){if(r)return!1;if(!B(t,e,h,f,s))return!1;null===o&&(o=new Set),o.add(h)}}}if(null!==o){for(var d=a(e),y=0;y<d.length;y++){var g=n(d[y],2),m=(h=g[0],g[1]);if("object"===i(h)&&null!==h){if(!q(o,t,h,m,r,s))return!1}else if(!(r||t.has(h)&&P(t.get(h),m,!1,s)||q(o,t,h,m,!1,s)))return!1}return 0===o.size}return!0}(t,e,r,c))return!1}else if(1===u)for(;l<t.length;l++){if(!f(t,l)){if(f(e,l))return!1;for(var h=Object.keys(t);l<h.length;l++){var p=h[l];if(!f(e,p)||!P(t[p],e[p],r,c))return!1}return h.length===Object.keys(e).length}if(!f(e,l)||!P(t[l],e[l],r,c))return!1}for(l=0;l<s.length;l++){var d=s[l];if(!P(t[d],e[d],r,c))return!1}return!0}(t,e,r,l,s,c);return s.val1.delete(t),s.val2.delete(e),_}function D(t,e,r,n){for(var i=o(t),s=0;s<i.length;s++){var a=i[s];if(P(e,a,r,n))return t.delete(a),!0}return!1}function M(t){switch(i(t)){case"undefined":return null;case"object":return;case"symbol":return!1;case"string":t=+t;case"number":if(l(t))return!1}return!0}function L(t,e,r){var n=M(r);return null!=n?n:e.has(n)&&!t.has(n)}function B(t,e,r,n,i){var s=M(r);if(null!=s)return s;var o=e.get(s);return!(void 0===o&&!e.has(s)||!P(n,o,!1,i))&&!t.has(s)&&P(n,o,!1,i)}function q(t,e,r,n,i,s){for(var a=o(t),c=0;c<a.length;c++){var u=a[c];if(P(r,u,i,s)&&P(n,e.get(u),i,s))return t.delete(u),!0}return!1}t.exports={isDeepEqual:function(t,e){return P(t,e,!1)},isDeepStrictEqual:function(t,e){return P(t,e,!0)}}},6785:t=>{"use strict";t.exports=TypeError},6822:t=>{"use strict";t.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null},6866:(t,e,r)=>{"use strict";r.d(e,{$Q:()=>i,BR:()=>y,Fn:()=>v,H:()=>A,JG:()=>b,K9:()=>w,Kk:()=>n,MG:()=>d,P2:()=>o,QW:()=>s,S:()=>u,_0:()=>g,bD:()=>l,bM:()=>m,hu:()=>_,i2:()=>f,ic:()=>a,lc:()=>h,ny:()=>p,r0:()=>c,sT:()=>x});const n="NamedNode",i="BlankNode",s="Literal",o="Variable",a="DefaultGraph",c="Collection",u="Empty",l="Graph",h="text/html",f="application/ld+json",p="text/n3",d="application/n3",y="application/nquads",g="application/n-quads",m="application/n-triples",b="application/rdf+xml",w="application/sparql-update",v="application/sparql-update-single-match",x="text/turtle",_="application/x-turtle",A="application/xhtml+xml"},7051:(t,e,r)=>{"use strict";var n=r(6601),i=r(5421),s=r(2621),o=r(1320),a=r(5074),c=n(o(),Number);i(c,{getPolyfill:o,implementation:s,shim:a}),t.exports=c},7106:(t,e,r)=>{"use strict";var n=r(6822),i=r(3766),s=r(9302);t.exports=n?function(t){return n(t)}:i?function(t){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("getProto: not an object");return i(t)}:s?function(t){return s(t)}:null},7114:(t,e,r)=>{"use strict";r.r(e),r.d(e,{DOMParserFactory:()=>f,RDFArrayRemove:()=>v,callbackify:()=>h,domToString:()=>p,dtstamp:()=>y,dumpNode:()=>d,heavyCompare:()=>g,heavyCompareSPO:()=>m,linkRelationProperty:()=>l,log:()=>n.A,mediaTypeClass:()=>u,output:()=>b,parseXML:()=>w,stackString:()=>_,string:()=>c,string_startswith:()=>x,uri:()=>i});var n=r(3787),i=r(4221),s=r(3627),o=r(8392);t=r.hmd(t);var a=r(6357);const c={template:function(t,e){for(var r=t.split("%s"),n="",i=0;i<e.length;i++)e[i]+="",n+=r[i]+e[i];return n+r.slice(e.length).join()}};function u(t){return t=t.split(";")[0].trim(),new s.A("http://www.w3.org/ns/iana/media-types/"+t+"#Resource")}function l(t){return new s.A("http://www.w3.org/ns/iana/link-relations/relation#"+t.trim())}function h(t,e){t.callbacks={};for(var r=e.length-1;r>=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<t.callbacks[e].length;n++)if(t.callbacks[e][n].name===r)return t.callbacks[e].splice(n,1),!0;return!1},t.insertCallback=function(e,r){t.callbacks[e].unshift(r)},t.fireCallbacks=function(e,r){var n,i=[],s=[],o=t.callbacks[e].length;let a;for(n=o-1;n>=0;n--)a=t.callbacks[e][n],a&&a.apply(t,r)&&i.push(a);for(n=i.length-1;n>=0;n--)s.push(i[n]);for(n=o;n<t.callbacks[e].length;n++)s.push(t.callbacks[e][n]);t.callbacks[e]=s}}function f(){return window.DOMParser?new o.DOMParser:!!window.ActiveXObject&&new ActiveXObject("Microsoft.XMLDOM")}function p(t,e){var r=[];(e=e||{})&&e.selfClosing&&e.selfClosing.split(" ").forEach((function(t){r[t]=!0}));var n=[];return e&&e.skipAttributes&&e.skipAttributes.split(" ").forEach((function(t){n[t]=!0})),d(t,e,r,n)}function d(t,e,r,n){var i,s="",o=[!1];if(void 0===t.nodeType)return s;if(1===t.nodeType){if(t.hasAttribute("class")&&e&&e.classWithChildText&&t.matches(e.classWithChildText.class))s+=t.querySelector(e.classWithChildText.element).textContent;else if(!(e&&e.skipNodeWithClass&&t.matches("."+e.skipNodeWithClass))){var c=t.nodeName.toLowerCase();s+="<"+c;var u=[];for(i=t.attributes.length-1;i>=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||u.push(l.name+"='"+l.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,""")+"'")}}if(u.length>0&&(e&&e.sortAttributes&&u.sort((function(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())})),s+=" "+u.join(" ")),r&&r.ename)s+=" />";else{for(s+=">",s+="html"===c?"\n ":"",o.push("style"===c||"script"===c),i=0;i<t.childNodes.length;i++)s+=d(t.childNodes[i]);o.pop(),s+="body"===c?"</"+c+">\n":"</"+c+">"}}}else if(8===t.nodeType)s+="\x3c!--"+t.nodeValue+"--\x3e";else if(3===t.nodeType||4===t.nodeType){var f=t.nodeValue.replace(/\n+$/,"");s+=o[o.length-1]?f:f.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}else a.log("Warning; Cannot handle serialising nodes of type: "+t.nodeType),a.log(t);return s}function y(){var t=new Date,e=t.getYear()+1900,r=t.getMonth()+1,n=t.getDate(),i=t.getUTCHours(),s=t.getUTCMinutes(),o=t.getSeconds();return r<10&&(r="0"+r),n<10&&(n="0"+n),i<10&&(i="0"+i),s<10&&(s="0"+s),o<10&&(o="0"+o),e+"-"+r+"-"+n+"T"+i+":"+s+":"+o+"Z"}function g(t,e,r,n){var i=function(t){return"BlankNode"===t.termType?null:t},s=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")};const o=Object.prototype.hasOwnProperty.call(r,"compareTerms")?r.compareTerms(t,e):t.compareTerm(e);return"BlankNode"===t.termType&&"BlankNode"===e.termType?0===o?0:s(t)>s(e)?1:s(t)<s(e)?-1:o:n&&t.uri&&e.uri?(n[t.uri]||t.uri).localeCompare(n[e.uri]||e.uri):o}function m(t,e,r,n){return g(t.subject,e.subject,r,n)||g(t.predicate,e.predicate,r,n)||g(t.object,e.object,r,n)}function b(t){var e=document.createElement("div");e.textContent=t,document.body.appendChild(e)}function w(e,r){return r=r||{},t&&t.exports?(new o.DOMParser).parseFromString(e,r.contentType||"application/xhtml+xml"):("undefined"!=typeof window&&window.DOMParser?new window.DOMParser:new o.DOMParser).parseFromString(e,"application/xml")}function v(t,e){for(var r=0;r<t.length;r++)if(t[r].subject.equals(e.subject)&&t[r].predicate.equals(e.predicate)&&t[r].object.equals(e.object)&&t[r].why.equals(e.why))return void t.splice(r,1);throw new Error("RDFArrayRemove: Array did not contain "+e+" "+e.why)}function x(t,e){return t.slice(0,e.length)===e}function _(t){var e=t+"\n";if(!t.stack)return e+"No stack available.\n";for(var r=t.stack.toString().split("\n"),n=[],i=0;i<r.length;i++){var s=r[i];if(s.indexOf("ecmaunit.js")>-1)break;"("==s.charAt(0)&&(s="function"+s);var o=s.split("@");n.push(o)}for(i=0;i<n.length;i++)e+=" "+n[i][1]+"\n "+n[i][0];return e}},7187:(t,e,r)=>{var n=r(9964),i=r(6357),s=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},n=0;n<e.length;n++)r[e[n]]=Object.getOwnPropertyDescriptor(t,e[n]);return r},o=/%[sdj%]/g;e.format=function(t){if(!v(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(l(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,i=n.length,s=String(t).replace(o,(function(t){if("%%"===t)return"%";if(r>=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}})),a=n[r];r<i;a=n[++r])b(a)||!A(a)?s+=" "+a:s+=" "+l(a);return s},e.deprecate=function(t,r){if(void 0!==n&&!0===n.noDeprecation)return t;if(void 0===n)return function(){return e.deprecate(t,r).apply(this,arguments)};var s=!1;return function(){if(!s){if(n.throwDeprecation)throw new Error(r);n.traceDeprecation?i.trace(r):i.error(r),s=!0}return t.apply(this,arguments)}};var a={},c=/^$/;if(n.env.NODE_DEBUG){var u=n.env.NODE_DEBUG;u=u.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),c=new RegExp("^"+u+"$","i")}function l(t,r){var n={seen:[],stylize:f};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),m(r)?n.showHidden=r:r&&e._extend(n,r),x(n.showHidden)&&(n.showHidden=!1),x(n.depth)&&(n.depth=2),x(n.colors)&&(n.colors=!1),x(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&&N(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,t);return v(i)||(i=p(t,i,n)),i}var s=function(t,e){if(x(e))return t.stylize("undefined","undefined");if(v(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return w(e)?t.stylize(""+e,"number"):m(e)?t.stylize(""+e,"boolean"):b(e)?t.stylize("null","null"):void 0}(t,r);if(s)return s;var o=Object.keys(r),a=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(r)),E(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return d(r);if(0===o.length){if(N(r)){var c=r.name?": "+r.name:"";return t.stylize("[Function"+c+"]","special")}if(_(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(T(r))return t.stylize(Date.prototype.toString.call(r),"date");if(E(r))return d(r)}var u,l="",h=!1,f=["{","}"];return g(r)&&(h=!0,f=["[","]"]),N(r)&&(l=" [Function"+(r.name?": "+r.name:"")+"]"),_(r)&&(l=" "+RegExp.prototype.toString.call(r)),T(r)&&(l=" "+Date.prototype.toUTCString.call(r)),E(r)&&(l=" "+d(r)),0!==o.length||h&&0!=r.length?n<0?_(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),u=h?function(t,e,r,n,i){for(var s=[],o=0,a=e.length;o<a;++o)R(e,String(o))?s.push(y(t,e,r,n,String(o),!0)):s.push("");return i.forEach((function(i){i.match(/^\d+$/)||s.push(y(t,e,r,n,i,!0))})),s}(t,r,n,a,o):o.map((function(e){return y(t,r,n,a,e,h)})),t.seen.pop(),function(t,e,r){return t.reduce((function(t,e){return e.indexOf("\n"),t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}(u,l,f)):f[0]+l+f[1]}function d(t){return"["+Error.prototype.toString.call(t)+"]"}function y(t,e,r,n,i,s){var o,a,c;if((c=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?a=c.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):c.set&&(a=t.stylize("[Setter]","special")),R(n,i)||(o="["+i+"]"),a||(t.seen.indexOf(c.value)<0?(a=b(r)?p(t,c.value,null):p(t,c.value,r-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(t){return" "+t})).join("\n").slice(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),x(o)){if(s&&i.match(/^\d+$/))return a;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.slice(1,-1),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function g(t){return Array.isArray(t)}function m(t){return"boolean"==typeof t}function b(t){return null===t}function w(t){return"number"==typeof t}function v(t){return"string"==typeof t}function x(t){return void 0===t}function _(t){return A(t)&&"[object RegExp]"===O(t)}function A(t){return"object"==typeof t&&null!==t}function T(t){return A(t)&&"[object Date]"===O(t)}function E(t){return A(t)&&("[object Error]"===O(t)||t instanceof Error)}function N(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(),!a[t])if(c.test(t)){var r=n.pid;a[t]=function(){var n=e.format.apply(e,arguments);i.error("%s %d: %s",t,r,n)}}else a[t]=function(){};return a[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=g,e.isBoolean=m,e.isNull=b,e.isNullOrUndefined=function(t){return null==t},e.isNumber=w,e.isString=v,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=x,e.isRegExp=_,e.types.isRegExp=_,e.isObject=A,e.isDate=T,e.types.isDate=T,e.isError=E,e.types.isNativeError=E,e.isFunction=N,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 S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function R(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(),S[t.getMonth()],r].join(" ")),e.format.apply(e,arguments))},e.inherits=r(9784),e._extend=function(t,e){if(!e||!A(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t};var k="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(k&&t[k]){var e;if("function"!=typeof(e=t[k]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,k,{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=[],s=0;s<arguments.length;s++)i.push(arguments[s]);i.push((function(t,n){t?r(t):e(n)}));try{t.apply(this,i)}catch(t){r(t)}return n}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),k&&Object.defineProperty(e,k,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,s(t))},e.promisify.custom=k,e.callbackify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function e(){for(var e=[],r=0;r<arguments.length;r++)e.push(arguments[r]);var i=e.pop();if("function"!=typeof i)throw new TypeError("The last argument must be of type Function");var s=this,o=function(){return i.apply(s,arguments)};t.apply(this,e).then((function(t){n.nextTick(o.bind(null,null,t))}),(function(t){n.nextTick(I.bind(null,t,o))}))}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,s(t)),e}},7450:t=>{"use strict";t.exports=Math.floor},7552:t=>{"use strict";t.exports=Math.min},7770:t=>{"use strict";t.exports=SyntaxError},7802:(t,e,r)=>{"use strict";var n=r(5049),i=r(3036),s=r(78),o=r(1909);t.exports=o||n.call(s,i)},7900:t=>{"use strict";t.exports=ReferenceError},7906:(t,e,r)=>{"use strict";var n=r(6626)(),i=r(7913)("Object.prototype.toString"),s=function(t){return!(n&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===i(t)},o=function(t){return!!s(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==i(t)&&"[object Function]"===i(t.callee)},a=function(){return s(arguments)}();s.isLegacyArguments=o,t.exports=a?s:o},7913:(t,e,r)=>{"use strict";var n=r(8651),i=r(6601),s=i(n("String.prototype.indexOf"));t.exports=function(t,e){var r=n(t,!!e);return"function"==typeof r&&s(t,".prototype.")>-1?i(r):r}},8109:(t,e,r)=>{"use strict";var n=r(5567);if(n)try{n([],"length")}catch(t){n=null}t.exports=n},8392:e=>{"use strict";e.exports=t},8404:(t,e,r)=>{"use strict";var n=r(3746),i=Object.prototype.toString,s=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){if(!n(e))throw new TypeError("iterator must be a function");var o,a;arguments.length>=3&&(o=r),a=t,"[object Array]"===i.call(a)?function(t,e,r){for(var n=0,i=t.length;n<i;n++)s.call(t,n)&&(null==r?e(t[n],n,t):e.call(r,t[n],n,t))}(t,e,o):"string"==typeof t?function(t,e,r){for(var n=0,i=t.length;n<i;n++)null==r?e(t.charAt(n),n,t):e.call(r,t.charAt(n),n,t)}(t,e,o):function(t,e,r){for(var n in t)s.call(t,n)&&(null==r?e(t[n],n,t):e.call(r,t[n],n,t))}(t,e,o)}},8461:(t,e,r)=>{"use strict";var n;if(!Object.keys){var i=Object.prototype.hasOwnProperty,s=Object.prototype.toString,o=r(6515),a=Object.prototype.propertyIsEnumerable,c=!a.call({toString:null},"toString"),u=a.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]"===s.call(t),n=o(t),a=e&&"[object String]"===s.call(t),f=[];if(!e&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var d=u&&r;if(a&&t.length>0&&!i.call(t,0))for(var y=0;y<t.length;++y)f.push(String(y));if(n&&t.length>0)for(var g=0;g<t.length;++g)f.push(String(g));else for(var m in t)d&&"prototype"===m||!i.call(t,m)||f.push(String(m));if(c)for(var b=function(t){if("undefined"==typeof window||!p)return h(t);try{return h(t)}catch(t){return!1}}(t),w=0;w<l.length;++w)b&&"constructor"===l[w]||!i.call(t,l[w])||f.push(l[w]);return f}}t.exports=n},8527:(t,e,r)=>{"use strict";var n=r(5421),i=r(6601),s=r(3249),o=r(9636),a=r(3534),c=i(o(),Object);n(c,{getPolyfill:o,implementation:s,shim:a}),t.exports=c},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#",bookmark:"http://www.w3.org/2002/01/bookmark#",cal:"http://www.w3.org/2002/12/cal/ical#",cco:"http://www.ontologyrepository.com/CommonCoreOntologies/",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#",gr:"http://purl.org/goodrelations/v1#",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#",pto:"http://www.productontology.org/id/",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#",skos:"http://www.w3.org/2004/02/skos/core#",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#",vann:"http://purl.org/vocab/vann/",vcard:"http://www.w3.org/2006/vcard/ns#",wf:"http://www.w3.org/2005/01/wf/flow#",xsd:"http://www.w3.org/2001/XMLSchema#"};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}},8619:(t,e,r)=>{"use strict";var n=r(5049),i=r(3036),s=r(7802);t.exports=function(){return s(n,i,arguments)}},8651:(t,e,r)=>{"use strict";var n,i=r(5846),s=r(5293),o=r(9055),a=r(8888),c=r(7900),u=r(7770),l=r(6785),h=r(4055),f=r(716),p=r(7450),d=r(3774),y=r(7552),g=r(5874),m=r(9292),b=r(6071),w=Function,v=function(t){try{return w('"use strict"; return ('+t+").constructor;")()}catch(t){}},x=r(8109),_=r(6649),A=function(){throw new l},T=x?function(){try{return A}catch(t){try{return x(arguments,"callee").get}catch(t){return A}}}():A,E=r(3257)(),N=r(7106),O=r(3766),j=r(6822),S=r(3036),R=r(78),k={},I="undefined"!=typeof Uint8Array&&N?N(Uint8Array):n,C={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":E&&N?N([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":k,"%AsyncGenerator%":k,"%AsyncGeneratorFunction%":k,"%AsyncIteratorPrototype%":k,"%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%":s,"%eval%":eval,"%EvalError%":o,"%Float16Array%":"undefined"==typeof Float16Array?n:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":w,"%GeneratorFunction%":k,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":E&&N?N(N([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&E&&N?N((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":i,"%Object.getOwnPropertyDescriptor%":x,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":a,"%ReferenceError%":c,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&E&&N?N((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":E&&N?N(""[Symbol.iterator]()):n,"%Symbol%":E?Symbol:n,"%SyntaxError%":u,"%ThrowTypeError%":T,"%TypedArray%":I,"%TypeError%":l,"%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%":h,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet,"%Function.prototype.call%":R,"%Function.prototype.apply%":S,"%Object.defineProperty%":_,"%Object.getPrototypeOf%":O,"%Math.abs%":f,"%Math.floor%":p,"%Math.max%":d,"%Math.min%":y,"%Math.pow%":g,"%Math.round%":m,"%Math.sign%":b,"%Reflect.getPrototypeOf%":j};if(N)try{null.error}catch(t){var P=N(N(t));C["%Error.prototype%"]=P}var F=function t(e){var r;if("%AsyncFunction%"===e)r=v("async function () {}");else if("%GeneratorFunction%"===e)r=v("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=v("async function* () {}");else if("%AsyncGenerator%"===e){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===e){var i=t("%AsyncGenerator%");i&&N&&(r=N(i.prototype))}return C[e]=r,r},U={__proto__:null,"%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"]},D=r(5049),M=r(5215),L=D.call(R,Array.prototype.concat),B=D.call(S,Array.prototype.splice),q=D.call(R,String.prototype.replace),$=D.call(R,String.prototype.slice),H=D.call(R,RegExp.prototype.exec),z=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,X=/\\(\\)?/g,V=function(t,e){var r,n=t;if(M(U,n)&&(n="%"+(r=U[n])[0]+"%"),M(C,n)){var i=C[n];if(i===k&&(i=F(n)),void 0===i&&!e)throw new l("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new u("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new l("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new l('"allowMissing" argument must be a boolean');if(null===H(/^%?[^%]*%?$/,t))throw new u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=$(t,0,1),r=$(t,-1);if("%"===e&&"%"!==r)throw new u("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new u("invalid intrinsic syntax, expected opening `%`");var n=[];return q(t,z,(function(t,e,r,i){n[n.length]=r?q(i,X,"$1"):e||t})),n}(t),n=r.length>0?r[0]:"",i=V("%"+n+"%",e),s=i.name,o=i.value,a=!1,c=i.alias;c&&(n=c[0],B(r,L([0,1],c)));for(var h=1,f=!0;h<r.length;h+=1){var p=r[h],d=$(p,0,1),y=$(p,-1);if(('"'===d||"'"===d||"`"===d||'"'===y||"'"===y||"`"===y)&&d!==y)throw new u("property names with quotes must have matching quotes");if("constructor"!==p&&f||(a=!0),M(C,s="%"+(n+="."+p)+"%"))o=C[s];else if(null!=o){if(!(p in o)){if(!e)throw new l("base intrinsic for "+t+" exists, but the property is not available.");return}if(x&&h+1>=r.length){var g=x(o,p);o=(f=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:o[p]}else f=M(o,p),o=o[p];f&&!a&&(C[s]=o)}}return o}},8888:t=>{"use strict";t.exports=RangeError},8890:(t,e,r)=>{"use strict";var n=r(6649),i=function(){return!!n};i.hasArrayLengthDefineBug=function(){if(!n)return null;try{return 1!==n([],"length",{value:1}).length}catch(t){return!0}},t.exports=i},9029:(t,e)=>{e.read=function(t,e,r,n,i){var s,o,a=8*i-n-1,c=(1<<a)-1,u=c>>1,l=-7,h=r?i-1:0,f=r?-1:1,p=t[e+h];for(h+=f,s=p&(1<<-l)-1,p>>=-l,l+=a;l>0;s=256*s+t[e+h],h+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=256*o+t[e+h],h+=f,l-=8);if(0===s)s=1-u;else{if(s===c)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),s-=u}return(p?-1:1)*o*Math.pow(2,s-n)},e.write=function(t,e,r,n,i,s){var o,a,c,u=8*s-i-1,l=(1<<u)-1,h=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:s-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?(a=isNaN(e)?1:0,o=l):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),(e+=o+h>=1?f/c:f*Math.pow(2,1-h))*c>=2&&(o++,c/=2),o+h>=l?(a=0,o=l):o+h>=1?(a=(e*c-1)*Math.pow(2,i),o+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+p]=255&a,p+=d,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;t[r+p]=255&o,p+=d,o/=256,u-=8);t[r+p-d]|=128*y}},9055:t=>{"use strict";t.exports=EvalError},9292:t=>{"use strict";t.exports=Math.round},9295:(t,e,r)=>{"use strict";var n=r(6649),i=r(7770),s=r(6785),o=r(8109);t.exports=function(t,e,r){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new s("`obj` must be an object or a function`");if("string"!=typeof e&&"symbol"!=typeof e)throw new s("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new s("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new s("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new s("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new s("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,l=arguments.length>6&&arguments[6],h=!!o&&o(t,e);if(n)n(t,e,{configurable:null===u&&h?h.configurable:!u,enumerable:null===a&&h?h.enumerable:!a,value:r,writable:null===c&&h?h.writable:!c});else{if(!l&&(a||c||u))throw new i("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");t[e]=r}}},9302:(t,e,r)=>{"use strict";var n,i=r(6688),s=r(8109);try{n=[].__proto__===Array.prototype}catch(t){if(!t||"object"!=typeof t||!("code"in t)||"ERR_PROTO_ACCESS"!==t.code)throw t}var o=!!n&&s&&s(Object.prototype,"__proto__"),a=Object,c=a.getPrototypeOf;t.exports=o&&"function"==typeof o.get?i([o.get]):"function"==typeof c&&function(t){return c(null==t?t:a(t))}},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}},9490:(t,e,r)=>{"use strict";var n=r(7906),i=r(4610),s=r(3381),o=r(6094);function a(t){return t.call.bind(t)}var c="undefined"!=typeof BigInt,u="undefined"!=typeof Symbol,l=a(Object.prototype.toString),h=a(Number.prototype.valueOf),f=a(String.prototype.valueOf),p=a(Boolean.prototype.valueOf);if(c)var d=a(BigInt.prototype.valueOf);if(u)var y=a(Symbol.prototype.valueOf);function g(t,e){if("object"!=typeof t)return!1;try{return e(t),!0}catch(t){return!1}}function m(t){return"[object Map]"===l(t)}function b(t){return"[object Set]"===l(t)}function w(t){return"[object WeakMap]"===l(t)}function v(t){return"[object WeakSet]"===l(t)}function x(t){return"[object ArrayBuffer]"===l(t)}function _(t){return"undefined"!=typeof ArrayBuffer&&(x.working?x(t):t instanceof ArrayBuffer)}function A(t){return"[object DataView]"===l(t)}function T(t){return"undefined"!=typeof DataView&&(A.working?A(t):t instanceof DataView)}e.isArgumentsObject=n,e.isGeneratorFunction=i,e.isTypedArray=o,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):o(t)||T(t)},e.isUint8Array=function(t){return"Uint8Array"===s(t)},e.isUint8ClampedArray=function(t){return"Uint8ClampedArray"===s(t)},e.isUint16Array=function(t){return"Uint16Array"===s(t)},e.isUint32Array=function(t){return"Uint32Array"===s(t)},e.isInt8Array=function(t){return"Int8Array"===s(t)},e.isInt16Array=function(t){return"Int16Array"===s(t)},e.isInt32Array=function(t){return"Int32Array"===s(t)},e.isFloat32Array=function(t){return"Float32Array"===s(t)},e.isFloat64Array=function(t){return"Float64Array"===s(t)},e.isBigInt64Array=function(t){return"BigInt64Array"===s(t)},e.isBigUint64Array=function(t){return"BigUint64Array"===s(t)},m.working="undefined"!=typeof Map&&m(new Map),e.isMap=function(t){return"undefined"!=typeof Map&&(m.working?m(t):t instanceof Map)},b.working="undefined"!=typeof Set&&b(new Set),e.isSet=function(t){return"undefined"!=typeof Set&&(b.working?b(t):t instanceof Set)},w.working="undefined"!=typeof WeakMap&&w(new WeakMap),e.isWeakMap=function(t){return"undefined"!=typeof WeakMap&&(w.working?w(t):t instanceof WeakMap)},v.working="undefined"!=typeof WeakSet&&v(new WeakSet),e.isWeakSet=function(t){return v(t)},x.working="undefined"!=typeof ArrayBuffer&&x(new ArrayBuffer),e.isArrayBuffer=_,A.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&A(new DataView(new ArrayBuffer(1),0,1)),e.isDataView=T;var E="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function N(t){return"[object SharedArrayBuffer]"===l(t)}function O(t){return void 0!==E&&(void 0===N.working&&(N.working=N(new E)),N.working?N(t):t instanceof E)}function j(t){return g(t,h)}function S(t){return g(t,f)}function R(t){return g(t,p)}function k(t){return c&&g(t,d)}function I(t){return u&&g(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=S,e.isBooleanObject=R,e.isBigIntObject=k,e.isSymbolObject=I,e.isBoxedPrimitive=function(t){return j(t)||S(t)||R(t)||k(t)||I(t)},e.isAnyArrayBuffer=function(t){return"undefined"!=typeof Uint8Array&&(_(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")}})}))},9636:(t,e,r)=>{"use strict";var n=r(3249);t.exports=function(){return"function"==typeof Object.is?Object.is:n}},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}}},9964:t=>{var e,r,n=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(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:s}catch(t){r=s}}();var a,c=[],u=!1,l=-1;function h(){u&&a&&(u=!1,a.length?c=a.concat(c):l=-1,c.length&&f())}function f(){if(!u){var t=o(h);u=!0;for(var e=c.length;e;){for(a=c,c=[];++l<e;)a&&a[l].run();l=-1,e=c.length}a=null,u=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{return r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function d(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new p(t,e)),1!==c.length||u||o(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=d,n.addListener=d,n.once=d,n.off=d,n.removeListener=d,n.removeAllListeners=d,n.emit=d,n.prependListener=d,n.prependOnceListener=d,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}}},o={};function a(t){var e=o[t];if(void 0!==e)return e.exports;var r=o[t]={id:t,loaded:!1,exports:{}};return s[t].call(r.exports,r,r.exports,a),r.loaded=!0,r.exports}a.m=s,a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},r=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,a.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);a.r(i);var s={};e=e||[null,r({}),r([]),r(r)];for(var o=2&n&&t;"object"==typeof o&&!~e.indexOf(o);o=r(o))Object.getOwnPropertyNames(o).forEach((e=>s[e]=()=>t[e]));return s.default=()=>t,a.d(i,s),i},a.d=(t,e)=>{for(var r in e)a.o(e,r)&&!a.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},a.f={},a.e=t=>Promise.all(Object.keys(a.f).reduce(((e,r)=>(a.f[r](t,e),e)),[])),a.u=t=>t+".rdflib.min.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.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),a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n={},i="$rdf:",a.l=(t,e,r,s)=>{if(n[t])n[t].push(e);else{var o,c;if(void 0!==r)for(var u=document.getElementsByTagName("script"),l=0;l<u.length;l++){var h=u[l];if(h.getAttribute("src")==t||h.getAttribute("data-webpack")==i+r){o=h;break}}o||(c=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,a.nc&&o.setAttribute("nonce",a.nc),o.setAttribute("data-webpack",i+r),o.src=t),n[t]=[e];var f=(e,r)=>{o.onerror=o.onload=null,clearTimeout(p);var i=n[t];if(delete n[t],o.parentNode&&o.parentNode.removeChild(o),i&&i.forEach((t=>t(r))),e)return e(r)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=f.bind(null,o.onerror),o.onload=f.bind(null,o.onload),c&&document.head.appendChild(o)}},a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;a.g.importScripts&&(t=a.g.location+"");var e=a.g.document;if(!t&&e&&(e.currentScript&&"SCRIPT"===e.currentScript.tagName.toUpperCase()&&(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(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=t})(),(()=>{var t={792:0};a.f.j=(e,r)=>{var n=a.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 s=a.p+a.u(e),o=new Error;a.l(s,(r=>{if(a.o(t,e)&&(0!==(n=t[e])&&(t[e]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),s=r&&r.target&&r.target.src;o.message="Loading chunk "+e+" failed.\n("+i+": "+s+")",o.name="ChunkLoadError",o.type=i,o.request=s,n[1](o)}}),"chunk-"+e,e)}};var e=(e,r)=>{var n,i,[s,o,c]=r,u=0;if(s.some((e=>0!==t[e]))){for(n in o)a.o(o,n)&&(a.m[n]=o[n]);c&&c(a)}for(e&&e(r);u<s.length;u++)i=s[u],a.o(t,i)&&t[i]&&t[i][0](),t[i]=0},r=self.webpackChunk$rdf=self.webpackChunk$rdf||[];r.forEach(e.bind(null,0)),r.push=e.bind(null,r.push.bind(r))})();var c={};return(()=>{"use strict";a.r(c),a.d(c,{BlankNode:()=>i,Collection:()=>f,ConnectedStore:()=>cr,DataFactory:()=>He,Empty:()=>p,Fetcher:()=>De,Formula:()=>B,IndexedFormula:()=>J,Literal:()=>l,LiveStore:()=>ur,N3Parser:()=>vt,NamedNode:()=>s.A,Namespace:()=>N,NextId:()=>ar,Node:()=>q,Query:()=>z,RDFParser:()=>ge,RDFaProcessor:()=>de,SPARQLToQuery:()=>Be,Serializer:()=>C,Statement:()=>b,Store:()=>J,UpdateManager:()=>qe,UpdatesSocket:()=>ze,UpdatesVia:()=>Xe,Util:()=>O,Variable:()=>v,blankNode:()=>Ke,defaultGraph:()=>tr,fetcher:()=>Ge,fromNT:()=>sr,graph:()=>Qe,isBlankNode:()=>o.jt,isCollection:()=>o.P3,isGraph:()=>o.RN,isLiteral:()=>o.c$,isNamedNode:()=>o.Y2,isPredicate:()=>o.YC,isQuad:()=>o.aF,isRDFObject:()=>o.GE,isRDFlibObject:()=>o.DJ,isRDFlibPredicate:()=>o.fY,isRDFlibSubject:()=>o.CZ,isStatement:()=>o.SH,isStore:()=>o.ok,isSubject:()=>o.hr,isTerm:()=>o.D0,isVariable:()=>o.DZ,jsonParser:()=>Me,lit:()=>We,literal:()=>er,log:()=>E.A,namedNode:()=>Ye,parse:()=>be,quad:()=>rr,queryToSPARQL:()=>Le,serialize:()=>F,sparqlUpdateParser:()=>me,st:()=>Je,sym:()=>Ye,term:()=>or,termValue:()=>xe.E,triple:()=>nr,uri:()=>w,variable:()=>Ze});var t=a(939),e=a(9390),r=a(1605),n=a(6866);class i extends r.A{static getId(t){if(t){if("string"!=typeof t)throw new Error("Bad id argument to new blank node: "+t);if(t.includes("#")){let e=t.split("#");return e[e.length-1]}return t}return"n"+i.nextId++}constructor(r){super(i.getId(r)),(0,t.A)(this,"termType",n.$Q),(0,t.A)(this,"classOrder",e.A.BlankNode),(0,t.A)(this,"isBlank",1),(0,t.A)(this,"isVar",1)}get id(){return this.value}set id(t){this.value=t}compareTerm(t){return this.classOrder<t.classOrder?-1:this.classOrder>t.classOrder?1:this.id<t.id?-1:this.id>t.id?1:0}copy(t){var e=new i;return t.copyTo(this,e),e}toCanonical(){return i.NTAnonymousNodePrefix+this.value}toString(){return i.NTAnonymousNodePrefix+this.id}}(0,t.A)(i,"nextId",0),(0,t.A)(i,"NTAnonymousNodePrefix","_:");var s=a(3627),o=a(546);const u={boolean:new s.A("http://www.w3.org/2001/XMLSchema#boolean"),dateTime:new s.A("http://www.w3.org/2001/XMLSchema#dateTime"),decimal:new s.A("http://www.w3.org/2001/XMLSchema#decimal"),double:new s.A("http://www.w3.org/2001/XMLSchema#double"),integer:new s.A("http://www.w3.org/2001/XMLSchema#integer"),langString:new s.A("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),string:new s.A("http://www.w3.org/2001/XMLSchema#string")};class l extends r.A{constructor(r,i,o){super(r),(0,t.A)(this,"termType",n.QW),(0,t.A)(this,"classOrder",e.A.Literal),(0,t.A)(this,"datatype",u.string),(0,t.A)(this,"isVar",0),(0,t.A)(this,"language",""),i?(this.language=i,this.datatype=u.langString):this.datatype=o?s.A.fromValue(o):u.string}copy(){return new l(this.value,this.lang,this.datatype)}equals(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))}get lang(){return this.language}set lang(t){this.language=t||""}toNT(){return l.toNT(this)}static toNT(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(u.string)||(e+="^^"+t.datatype.toCanonical()),e}toString(){return""+this.value}static fromBoolean(t){return new l(t?"1":"0",null,u.boolean)}static fromDate(t){if(!(t instanceof Date))throw new TypeError("Invalid argument to Literal.fromDate()");let e=function(t){return(""+(100+t)).slice(1,3)},r=t.getUTCFullYear()+"-"+e(t.getUTCMonth()+1)+"-"+e(t.getUTCDate())+"T"+e(t.getUTCHours())+":"+e(t.getUTCMinutes())+":"+e(t.getUTCSeconds())+"Z";return new l(r,null,u.dateTime)}static fromNumber(t){if("number"!=typeof t)throw new TypeError("Invalid argument to Literal.fromNumber()");let e;const r=t.toString();return e=r.indexOf("e")<0&&Math.abs(t)<=Number.MAX_SAFE_INTEGER?Number.isInteger(t)?u.integer:u.decimal:u.double,new l(r,null,e)}static fromValue(t){if((0,o.c$)(t))return t;switch(typeof t){case"object":if(t instanceof Date)return l.fromDate(t);case"boolean":return l.fromBoolean(t);case"number":return l.fromNumber(t);case"string":return new l(t)}throw new Error("Can't make literal from "+t+" of type "+typeof t)}}function h(t){return null==t||(0,o.D0)(t)?t:Array.isArray(t)?new f(t):l.fromValue(t)}class f extends r.A{constructor(r){super((i.nextId++).toString()),(0,t.A)(this,"termType",n.r0),(0,t.A)(this,"classOrder",e.A.Collection),(0,t.A)(this,"closed",!1),(0,t.A)(this,"compareTerm",i.prototype.compareTerm),(0,t.A)(this,"elements",[]),(0,t.A)(this,"isVar",0),r&&r.length>0&&r.forEach((t=>{this.elements.push(h(t))}))}get id(){return this.value}set id(t){this.value=t}append(t){return this.elements.push(t)}close(){return this.closed=!0,this.closed}shift(){return this.elements.shift()}substitute(t){const e=this.elements.map((e=>e.substitute(t)));return new f(e)}toNT(){return f.toNT(this)}static toNT(t){return i.NTAnonymousNodePrefix+t.id}toString(){return"("+this.elements.join(" ")+")"}unshift(t){return this.elements.unshift(t)}}(0,t.A)(f,"termType",n.r0);class p extends r.A{constructor(){super(""),(0,t.A)(this,"termType",n.S)}toString(){return"()"}}const d="chrome:theSession";new s.A(d);class y extends r.A{constructor(){super(""),(0,t.A)(this,"value",""),(0,t.A)(this,"termType",n.ic),(0,t.A)(this,"uri",d)}toCanonical(){return this.value}toString(){return"DefaultGraph"}}function g(t){return!!t&&t.termType===n.ic}const m=new y;class b{constructor(e,n,i,s){(0,t.A)(this,"subject",void 0),(0,t.A)(this,"predicate",void 0),(0,t.A)(this,"object",void 0),(0,t.A)(this,"graph",void 0),this.subject=r.A.fromValue(e),this.predicate=r.A.fromValue(n),this.object=r.A.fromValue(i),this.graph=null==s?m:r.A.fromValue(s)}get why(){return this.graph}set why(t){this.graph=t}equals(t){return t.subject.equals(this.subject)&&t.predicate.equals(this.predicate)&&t.object.equals(this.object)&&t.graph.equals(this.graph)}substitute(t){return new b(this.subject.substitute(t),this.predicate.substitute(t),this.object.substitute(t),g(this.graph)?this.graph:this.graph.substitute(t))}toCanonical(){let t=[this.subject.toCanonical(),this.predicate.toCanonical(),this.object.toCanonical()];return this.graph&&this.graph.termType!==n.ic&&t.push(this.graph.toCanonical()),t.join(" ")+" ."}toNT(){return[this.subject.toNT(),this.predicate.toNT(),this.object.toNT()].join(" ")+" ."}toNQ(){return[this.subject.toNT(),this.predicate.toNT(),this.object.toNT(),g(this.graph)?"":this.graph.toNT()].join(" ")+" ."}toString(){return this.toNT()}}var w=a(4221);class v extends r.A{constructor(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";super(r),(0,t.A)(this,"termType",n.P2),(0,t.A)(this,"base","varid:"),(0,t.A)(this,"classOrder",e.A.Variable),(0,t.A)(this,"isVar",1),(0,t.A)(this,"uri",void 0),this.base="varid:",this.uri=w.join(r,this.base)}equals(t){return!!t&&this.termType===t.termType&&this.value===t.value}hashString(){return this.toString()}substitute(t){var e;return null!=(e=t[this.toNT()])?e:this}toString(){return v.toString(this)}static toString(t){return t.uri.slice(0,t.base.length)===t.base?`?${t.uri.slice(t.base.length)}`:`?${t.uri}`}}let x=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}({});const _=new y,A={supports:{[x.collections]:!1,[x.defaultGraphType]:!1,[x.equalsMethod]:!0,[x.identity]:!1,[x.id]:!0,[x.reversibleId]:!1,[x.variableType]:!0},blankNode:t=>new i(t),defaultGraph:()=>_,equals(t,e){return t===e||!t||!e||((0,o.aF)(t)||(0,o.aF)(e)?!(!(0,o.aF)(t)||!(0,o.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,o.D0)(t)||!(0,o.D0)(e))&&this.id(t)===this.id(e))},id(t){if(!t)return"undefined";if((0,o.aF)(t))return this.quadToNQ(t);switch(t.termType){case n.ic:return"defaultGraph";case n.P2:return v.toString(t);default:const e=this.termToNQ(t);if(e)return e;throw new Error(`Can't id term with type '${t.termType}'`)}},isQuad:t=>t instanceof b,literal(t,e){if("string"!=typeof t&&!e)return l.fromValue(t);const r="string"==typeof t?t:""+t;return"string"==typeof e?-1===e.indexOf(":")?new l(r,e):new l(r,null,this.namedNode(e)):new l(r,null,e)},namedNode:t=>new s.A(t),quad:(t,e,r,n)=>new b(t,e,r,n||_),triple(t,e,r,n){return this.quad(t,e,r,n)},quadToNQ(t){return`${this.termToNQ(t.subject)} ${this.termToNQ(t.predicate)} ${this.termToNQ(t.object)} ${this.termToNQ(t.graph)} .`},termToNQ(t){switch(t.termType){case n.$Q:return"_:"+t.value;case n.ic:return"";case n.S:return"<http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>";case n.QW:return l.toNT(t);case n.bD:case n.Kk:return"<"+t.value+">";case n.r0:return"("+t.elements.map((t=>this.termToNQ(t))).join(" ")+")";default:throw new Error(`Can't serialize nonstandard term type (was '${t.termType}')`)}},toNQ(t){return this.isQuad(t)?this.quadToNQ(t):this.termToNQ(t)},variable:t=>new v(t)},T=A;var E=a(3787);function N(t,e){const r=e||{namedNode:t=>new s.A(t)};return function(e){return r.namedNode(t+(e||""))}}var O=a(7114);function j(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:T;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")}}j(T);var S=a(8540),R=a.n(S),k=a(2312),I=a(6357);function C(t){return new P(t)}class P{constructor(e){(0,t.A)(this,"_notQNameChars","\t\r\n !\"#$%&'()*,+/;<=>?@[\\]^`{|}~"),(0,t.A)(this,"_notNameChars",this._notQNameChars+":"),(0,t.A)(this,"validPrefix",new RegExp(/^[a-zA-Z][a-zA-Z0-9]*$/)),(0,t.A)(this,"forbidden1",new RegExp(/[\\"\b\f\r\v\t\n\u0080-\uffff]/gm)),(0,t.A)(this,"forbidden3",new RegExp(/[\\"\b\f\r\v\u0080-\uffff]/gm)),this.flags="",this.base=null,this.prefixes=[],this.namespaces=[];const r=Object.keys(R()());for(const t in r){const e=R()()[r[t]](""),n=r[t];this.prefixes[e]=n,this.namespaces[n]=e}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=e,this.rdfFactory=e.rdfFactory||T,this.xsd=j(this.rdfFactory)}setBase(t){return this.base=t,this}setFlags(t){return this.flags=t||"",this}toStr(t){var e=t.toNT();return"Graph"===t.termType&&(this.formulas[e]=t),e}fromStr(t){if("{"===t[0]){var e=this.formulas[t];return e||I.log("No formula object for "+t),e}return this.store.fromNT(t)}setNamespaces(t){for(var e in t)this.setPrefix(e,t[e]);return this}setPrefix(t,e){if("default"!==t.slice(0,7)&&"ns"!==t.slice(0,2)&&t&&e){for(let e in this.prefixes)this.prefixes[e]==t&&delete this.prefixes[e];this.prefixes[e]=t,this.namespaces[t]=e}}suggestPrefix(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))}suggestNamespaces(t){for(var e in t)this.suggestPrefix(e,t[e]);return this}checkIntegrity(){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]]+"!")}makeUpPrefix(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<e.length&&this.prefixchars.indexOf(e[i]);)i++;if((e=e.slice(0,i)).length<6&&r(e))return e;if(r(e.slice(0,3)))return e.slice(0,3);if(r(e.slice(0,2)))return e.slice(0,2);if(r(e.slice(0,4)))return e.slice(0,4);if(r(e.slice(0,1)))return e.slice(0,1);if(r(e.slice(0,5)))return e.slice(0,5);this.validPrefix.test(e)||(e="n");for(var s=0;;s++)if(r(e.slice(0,3)+s))return e.slice(0,3)+s}rootSubjects(t){for(var e={},r={},n={},i=0;i<t.length;i++){var s=t[i],o=function(t){e.hasOwnProperty(t)||(e[t]=[]),e[t].push(s.subject)};[s.subject,s.predicate,s.object].map((function(t){"BlankNode"===t.termType?n[t.toNT()]=!0:"Collection"===t.termType&&t.elements.forEach((function(t){o(t)}))})),o(t[i].object);var a=r[this.toStr(s.subject)];a||(a=[]),a.push(s),r[this.toStr(s.subject)]=a}var c=[];for(var u in r)if(r.hasOwnProperty(u)){var l=this.fromStr(u);"BlankNode"===l.termType&&e[l]&&1===e[l].length||c.push(l)}this.incoming=e;for(var h={},f=0;f<c.length;f++)h[c[f].toNT()]=!0;return{roots:c,subjects:r,rootsHash:h,incoming:e}}toN3(t){return this.statementsToN3(t.statements)}isValidPNLocal(t){if(0===t.length)return!0;if("."===t[t.length-1])return!1;for(var e=0;e<t.length;e++){var r=t[e];if("."!==r&&this._notNameChars.indexOf(r)>=0)return!1}return!0}explicitURI(t){var e;return this.flags.indexOf("r")<0&&this.base?t=w.refTo(this.base,t):this.flags.indexOf("u")>=0?t=function(t){for(var e,r="",n=0;n<t.length;n++)r+=(e=t.charCodeAt(n))>65535?"\\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+">"}statementsToNTriples(t){var e=t.slice();e.sort();for(var r="",n="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i=this,s=this.store,o=this.rdfFactory,a=function(t){if("Collection"!==t.termType)return i.atomicTermToN3(t);for(var e=t.elements,c=s.sym(n+"nill"),u=e.length-1;u>=0;u--){var l=o.blankNode();r+=a(l)+" "+a(s.sym(n+"first"))+" "+a(e[u])+".\n",r+=a(l)+" "+a(s.sym(n+"rest"))+" "+a(c)+".\n",c=l}return i.atomicTermToN3(c)},c=0;c<e.length;c++){var u=e[c],l="";l+=a(u.subject)+" ",l+=a(u.predicate)+" ",l+=a(u.object)+" ",this.flags.indexOf("q")>=0&&(l+=a(u.why)+" "),r+=l+=".\n"}return r}statementsToN3(t){var e=this.store,r={"http://www.w3.org/1999/02/22-rdf-syntax-ns#type":"aaa:00"};t.sort((function(t,n){return O.heavyCompareSPO(t,n,e,r)})),this.base&&!this.defaultNamespace&&(this.defaultNamespace=this.base+"#");var n={};this.flags.indexOf("s")<0&&(n["http://www.w3.org/2002/07/owl#sameAs"]="="),this.flags.indexOf("t")<0&&(n["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]="a"),this.flags.indexOf("i")<0&&(n["http://www.w3.org/2000/10/swap/log#implies"]="=>");var i=function(t){for(var e="",r=0;r<t;r++)e+=" ";return e},s=function(t){for(var e="",r=0;r<t.length;r++){var n=t[r],i="string"==typeof n?n:s(n);if(0!==r){var o=e.slice(-1)||" ";","===i||";"===i||("."!==i||"0123456789.:".includes(o))&&(e+=" ")}e+=i}return e},o=function(t,e){var r="",n=1e5;void 0===e&&(e=-1);for(var a=0;a<t.length;a++){var c=t[a];if("string"!=typeof c){var u=o(c,e+1);if(u.length<10*(80-4*e)&&u.indexOf('"""')<0){var l=s(c);l.length<80-4*e&&(c=l,u="")}u&&(n=1e4),r+=u}if("string"==typeof c){if(1===c.length&&"\n"===r.slice(-1)&&",.;".indexOf(c)>=0){r=r.slice(0,-1),"."==c&&"0123456789.:".includes(r.charAt(r.length-1))&&(r+=" ",n+=1),r+=c+"\n",n+=1;continue}if(n<4*e+4||n+c.length+1<80&&";.".indexOf(r[r.length-2])<0)r=r.slice(0,-1)+" "+c+"\n",n+=c.length+1;else{let t=i(4*e)+c;r+=t+"\n",n=t.length,e<0&&(r+="\n",n=1e5)}}}return r},a=function(t){for(var e=this.rootSubjects(t),r=e.roots,n=[],i=0;i<r.length;i++){var s=r[i];n.push(c(s,e))}return n}.bind(this);function c(t,e){return"BlankNode"!==t.termType||e.incoming[t]?[h(t,e)].concat([u(t,e)]).concat(["."]):l(t,e,!0).concat(["."])}var u=function(t,e){var r=[],i=null,s=e.subjects[this.toStr(t)]||[];if(void 0===s)throw new Error("Cant find statements for "+t);for(var o=[],a=0;a<s.length;a++){var c=s[a];c.predicate.uri===i?o.push(","):(i&&(r=r.concat([o]).concat([";"]),o=[]),r.push(n[c.predicate.uri]?n[c.predicate.uri]:h(c.predicate,e))),i=c.predicate.uri,o.push(l(c.object,e))}return r.concat([o])}.bind(this),l=function(t,e,r){return"BlankNode"!==t.termType||!r&&void 0!==e.rootsHash[t.toNT()]?h(t,e):e.subjects[this.toStr(t)]?["[",u(t,e),"]"]:"[]"}.bind(this);P.prototype.termToN3=h;var h=function(t,e){var r,n;switch(t.termType){case"Graph":return(n=(n=["{"]).concat(a(t.statements))).concat(["}"]);case"Collection":for(n=["("],r=0;r<t.elements.length;r++)n.push([l(t.elements[r],e)]);return n.push(")"),n;default:return this.atomicTermToN3(t)}}.bind(this),f=function(){var t="";for(var e in this.flags.indexOf("d")<0&&this.defaultNamespace&&(t+="@prefix : "+this.explicitURI(this.defaultNamespace)+".\n"),this.prefixes)this.prefixes.hasOwnProperty(e)&&this.namespacesUsed[e]&&(t+="@prefix "+this.prefixes[e]+": "+this.explicitURI(e)+".\n");return t+"\n"}.bind(this),p=a(t);return f()+o(p)}atomicTermToN3(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":{const t=r.toLowerCase().indexOf("e")>0;return r.indexOf(".")<0&&!t&&(r+=".0"),t||(r+="e0"),r}case"http://www.w3.org/2001/XMLSchema#boolean":return"1"===t.value?"true":"false"}var n=this.stringToN3(t.value,this.flags);return t.language?n+="@"+t.language:t.datatype.equals(this.xsd.string)||(n+="^^"+this.atomicTermToN3(t.datatype,e)),n;case"NamedNode":return this.symbolToN3(t);case"DefaultGraph":return"";default:throw new Error("Internal: atomicTermToN3 cannot handle "+t+" of termType: "+t.termType)}}stringToN3(t,e){e||(e="e");var r,n,i,s,o,a="";for(t.length>20&&'"'!==t.slice(-1)&&e.indexOf("n")<0&&(t.indexOf("\n")>0||t.indexOf('"')>0)?(s='"""',o=this.forbidden3):(s='"',o=this.forbidden1),r=0;r<t.length&&(o.lastIndex=0,null!=o.exec(t.slice(r)));){n=r+o.lastIndex-1,a+=t.slice(r,n);var c=t[n];'"'===c&&'"""'===s&&'"""'!==t.slice(n,n+3)?a+=c:(i='\b\f\r\t\v\n\\"'.indexOf(c))>=0?a+="\\"+'bfrtvn\\"'[i]:e.indexOf("e")>=0?a+="\\u"+("000"+c.charCodeAt(0).toString(16).toLowerCase()).slice(-4):a+=c,r=n+1}return s+a+t.slice(r)+s}symbolToN3(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"))){var n=e.slice(r+1),i=e.slice(0,r+1),s=e.indexOf("://")+4,o=this.base?this.base.slice(0,Math.max(this.base.lastIndexOf("/"),this.base.lastIndexOf("#"))+1):null,a=o&&i===o,c=this.flags.indexOf("o")>=0&&n.indexOf(".")>=0;if(!a&&!c&&i.length>s&&this.isValidPNLocal(n)){if(this.defaultNamespace&&this.defaultNamespace===i&&this.flags.indexOf("d")<0)return this.flags.indexOf("k")>=0&&this.keyords.indexOf(n)<0?n:":"+n;var u=this.prefixes[i];if(u||(u=this.makeUpPrefix(i)),u)return this.namespacesUsed[i]=!0,u+":"+n}}return this.explicitURI(e)}writeStore(t){var e=this.store,r=e.fetcher,n=r&&r.appNode,i=this.store.index[3];for(var s in i){var o=e.fromNT(s);n&&o.equals(n)||t("\n"+this.atomicTermToN3(o)+" "+this.atomicTermToN3(e.sym("http://www.w3.org/2000/10/swap/log#semantics"))+" { "+this.statementsToN3(e.statementsMatching(void 0,void 0,void 0,o))+" }.\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 a=[];n&&a.push(n);var c=[];a.map((function(t){c=c.concat(e.statementsMatching(void 0,void 0,void 0,t))})),t(this.statementsToN3(c))}statementsToXML(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<t;r++)e+=" ";return e},i=function(t){for(var e="",r=0;r<t.length;r++){var n=t[r];e+="string"==typeof n?n:i(n)}return e},s=function(t,e){var r,o="",a=1e5;e||(e=0);for(var c=0;c<t.length;c++){var u=t[c];if("string"!=typeof u){var l=s(u,e+1);l.length<10*(80-4*e)&&l.indexOf('"""')<0&&(r=i(u)).length<80-4*e&&(u=" "+r,l=""),l&&(a=1e4),o+=l}"string"==typeof u&&(a<4*e+4?(o=o.slice(0,-1)+" "+u+"\n",a+=u.length+1):(o+=(r=n(4*e)+u)+"\n",a=r.length))}return o},o=function(t){this.suggestPrefix("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");for(var e=this.rootSubjects(t),r=e.roots,n=[],i=0;i<r.length;i++){var s=r[i];n.push(u(s,e))}return n}.bind(this);function a(t){return void 0===t?"@@@undefined@@@@":t.replace(/[&<"]/g,(function(t){switch(t[0]){case"&":return"&";case"<":return"<";case'"':return"""}}))}var c=function(t){return a(this.base?w.refTo(this.base,t.uri):t.uri)}.bind(this),u=function(t,e){var n,i,s,o,p=[],d=e.subjects[this.toStr(t)];if(void 0===d)return h(t,e);d.sort((function(t,e){var n=t.predicate.uri,i=e.predicate.uri;if(n.substring(0,44)===r||i.substring(0,44)===r)return n.localeCompare(i);var s=n.substring(44),o=i.substring(44),a=parseInt(s,10),c=parseInt(o,10);return isNaN(a)||isNaN(c)||a!==s||c!==o?n.localeCompare(i):a-c}));for(var y=0;y<d.length;y++)if("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"!==(s=d[y]).predicate.uri||n||"NamedNode"!==s.object.termType){if((o=s.predicate).uri.substr(0,44)===r){var g=o.uri.substr(44);g===parseInt(g,10).toString()&&(o=this.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#li"))}switch(i=f(o),s.object.termType){case"BlankNode":p=1===e.incoming[s.object].length?p.concat(["<"+i+' rdf:parseType="Resource">',u(s.object,e),"</"+i+">"]):p.concat(["<"+i+' rdf:nodeID="'+s.object.toNT().slice(2)+'"/>']);break;case"NamedNode":p=p.concat(["<"+i+' rdf:resource="'+c(s.object)+'"/>']);break;case"Literal":p=p.concat(["<"+i+(s.object.datatype.equals(this.xsd.string)?"":' rdf:datatype="'+a(s.object.datatype.uri)+'"')+(s.object.language?' xml:lang="'+s.object.language+'"':"")+">"+a(s.object.value)+"</"+i+">"]);break;case"Collection":p=p.concat(["<"+i+' rdf:parseType="Collection">',l(s.object,e),"</"+i+">"]);break;default:throw new Error("Can't serialize object of type "+s.object.termType+" into XML")}}else n=s.object;var m=n?f(n):"rdf:Description",b="";return"BlankNode"===t.termType?e.incoming[t]&&1===e.incoming[t].length||(b=' rdf:nodeID="'+t.toNT().slice(2)+'"'):b=' rdf:about="'+c(t)+'"',["<"+m+b+">"].concat([p]).concat(["</"+m+">"])}.bind(this);function l(t,e){for(var r=[],n=0;n<t.elements.length;n++)r.push(u(t.elements[n],e));return r}var h=function(t,e){var r=[],n=e.subjects[this.toStr(t)];if(!n)return r;n.sort();for(var i=0;i<n.length;i++){var s=n[i];switch(s.object.termType){case"BlankNode":r=e.rootsHash[s.object.toNT()]?r.concat(["<"+f(s.predicate)+' rdf:nodeID="'+s.object.toNT().slice(2)+'">',"</"+f(s.predicate)+">"]):r.concat(["<"+f(s.predicate)+' rdf:parseType="Resource">',h(s.object,e),"</"+f(s.predicate)+">"]);break;case"NamedNode":r=r.concat(["<"+f(s.predicate)+' rdf:resource="'+c(s.object)+'"/>']);break;case"Literal":r=r.concat(["<"+f(s.predicate)+(s.object.datatype.equals(this.xsd.string)?"":' rdf:datatype="'+a(s.object.datatype.value)+'"')+(s.object.language?' xml:lang="'+s.object.language+'"':"")+">"+a(s.object.value)+"</"+f(s.predicate)+">"]);break;case"Collection":r=r.concat(["<"+f(s.predicate)+' rdf:parseType="Collection">',l(s.object,e),"</"+f(s.predicate)+">"]);break;default:throw new Error("Can't serialize object of type "+s.object.termType+" into XML")}}return r}.bind(this),f=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<r.length;i++)if(this._notNameChars.indexOf(r[i])>=0)throw new Error('Invalid character "'+r[i]+'" cannot be in XML qname for URI: '+r);var s=r.slice(n+1),o=r.slice(0,n+1);if(this.defaultNamespace&&this.defaultNamespace===o&&this.flags.indexOf("d")<0)return s;var a=this.prefixes[o];return a||(a=this.makeUpPrefix(o)),e[o]=!0,a+":"+s}.bind(this),p=o(t),d="<rdf:RDF";for(var y in this.defaultNamespace&&(d+=' xmlns="'+a(this.defaultNamespace)+'"'),e)if(e.hasOwnProperty(y)){var g=this.base&&this.flags.includes("z")?w.refTo(this.base,y):y;d+="\n xmlns:"+this.prefixes[y]+'="'+a(g)+'"'}return s([d+=">",p,"</rdf:RDF>"],-1)}statementsToJsonld(t){const e=this.statementsToN3(t),r=k.parse(e);return JSON.stringify(r,null,2)}}function F(t,e,r,i,s,o){r=r||t?.value;const a=o||{};i=i||n.sT;try{var c=C(e);a.flags&&c.setFlags(a.flags);var u=e.statementsMatching(void 0,void 0,void 0,t);switch("namespaces"in e&&c.suggestNamespaces(e.namespaces),a.namespaces&&c.setNamespaces(a.namespaces),c.setBase(r),i){case n.JG:return l(null,c.statementsToXML(u));case n.ny:case n.MG:return l(null,c.statementsToN3(u));case n.sT:case n.hu:return c.setFlags("si"+(a.flags?" "+a.flags:"")),l(null,c.statementsToN3(u));case n.bM:return c.setFlags("deinprstux"),l(null,c.statementsToNTriples(u));case n.i2:return c.setFlags("si dr"+(a.flags?" "+a.flags:"")),l(null,c.statementsToJsonld(u));case n._0:case n.BR:return c.setFlags("deinprstux q"),l(null,c.statementsToNTriples(u));default:throw new Error("Serialize: Content-type "+i+" not supported for data write.")}}catch(t){if(s)return s(t,void 0);throw t}function l(t,e){return s?void s(t,e):e}}const U=["blankNode","defaultGraph","literal","namedNode","quad","variable","supports"],D={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 M(t,e,r){const n=[];return r.reduce(((e,r,i,s)=>{let o;return n.push(t.quad(e,t.namedNode(D.first),s[i])),i<s.length-1?(o=t.blankNode(),n.push(t.quad(e,t.namedNode(D.rest),o))):n.push(t.quad(e,t.namedNode(D.rest),t.namedNode(D.nil))),o}),e),n}function L(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;var n=t.length;for(r<0&&(r=n+r);r<n;r++)if(t[r]===e)return r;return-1}class B extends r.A{constructor(){var r;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};super(""),r=this,this.statements=i,this.constraints=s,this.initBindings=o,this.optional=a,(0,t.A)(this,"termType",n.bD),(0,t.A)(this,"classOrder",e.A.Graph),(0,t.A)(this,"fetcher",void 0),(0,t.A)(this,"isVar",0),(0,t.A)(this,"ns",N),(0,t.A)(this,"rdfFactory",void 0),this.rdfFactory=c&&c.rdfFactory||T;for(const t of U)this[t]=function(){return r.rdfFactory[t](...arguments)}}add(t,e,r,n){return 1===arguments.length&&t.forEach((t=>this.add(t.subject,t.predicate,t.object,t.graph))),this.statements.push(this.rdfFactory.quad(t,e,r,n))}addStatement(t){return this.add(t)}bnode(t){return this.rdfFactory.blankNode(t)}addAll(t){t.forEach((t=>{this.add(t.subject,t.predicate,t.object,t.graph)}))}any(t,e,r,n){const i=this.anyStatementMatching(t,e,r,n);return null==i?null:null==t?i.subject:null==e?i.predicate:null==r?i.object:null}anyValue(t,e,r,n){const i=this.any(t,e,r,n);return i?i.value:void 0}anyJS(t,e,n,i){const s=this.any(t,e,n,i);return s?r.A.toJS(s):void 0}anyStatementMatching(t,e,r,n){let i=this.statementsMatching(t,e,r,n,!0);if(i&&0!==i.length)return i[0]}id(t){return this.rdfFactory.id(t)}statementsMatching(t,e,r,n,i){const s=this.statements.filter((i=>(!t||t.equals(i.subject))&&(!e||e.equals(i.predicate))&&(!r||r.equals(i.object))&&(!n||n.equals(i.graph))));return i?0===s.length?[]:[s[0]]:s}bottomTypeURIs(t){let e,r,n,i,s,o,a,c;e=[];for(let u in t)if(t.hasOwnProperty(u)){for(c=t[u],a=this.each(void 0,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),this.rdfFactory.namedNode(u)),r=!0,i=0,s=a.length;i<s;i++)if(n=a[i],o=n.uri,o in t){r=!1;break}r&&(e[u]=c)}return e}collection(){return new f}each(t,e,r,n){const i=[];let o=this.statementsMatching(t,e,r,n,!1);if(null==t)for(let t=0,e=o.length;t<e;t++)i.push(o[t].subject);else if(null==e)for(let t=0,e=o.length;t<e;t++)i.push(o[t].predicate);else if(null==r)for(let t=0,e=o.length;t<e;t++)i.push(o[t].object);else if(null==n)for(let t=0,e=o.length;t<e;t++)i.push(new s.A(o[t].graph.value));return i}equals(t){return!!t&&this.hashString()===t.hashString()}findMembersNT(t){let e,r,n,i,s,o,a,c,u,l,h,f,p,d;f={},f[t.toNT()]=!0,i={},o=this.transitiveClosure(f,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!0);for(let t in o)if(o.hasOwnProperty(t)){a=this.statementsMatching(void 0,this.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),this.fromNT(t));for(let t=0,e=a.length;t<e;t++)p=a[t],i[p.subject.toNT()]=p;c=this.each(void 0,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#domain"),this.fromNT(t));for(let t=0,r=c.length;t<r;t++)for(s=c[t],u=this.statementsMatching(void 0,s),n=0,e=u.length;n<e;n++)p=u[n],i[p.subject.toNT()]=p;l=this.each(void 0,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#range"),this.fromNT(t));for(let t=0,e=l.length;t<e;t++)for(s=l[t],h=this.statementsMatching(void 0,s),d=0,r=h.length;d<r;d++)p=h[d],i[p.object.toNT()]=p}return i}findMemberURIs(t){return this.NTtoURI(this.findMembersNT(t))}findSubClassesNT(t){let e={};return e[t.toNT()]=!0,this.transitiveClosure(e,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!0)}findSuperClassesNT(t){let e={};return e[t.toNT()]=!0,this.transitiveClosure(e,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!1)}findTypesNT(t){let e,r,n,i,s,o,a,c,u;n="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",u=[],i=this.statementsMatching(t,void 0,void 0);for(let t=0,e=i.length;t<e;t++)if(c=i[t],"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"===c.predicate.uri)u[c.object.toNT()]=c;else{s=this.each(c.predicate,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#domain"));for(let t=0,e=s.length;t<e;t++)r=s[t],u[r.toNT()]=c}o=this.statementsMatching(void 0,void 0,t);for(let t=0,r=o.length;t<r;t++){c=o[t],a=this.each(c.predicate,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#range"));for(let t=0,r=a.length;t<r;t++)e=a[t],u[e.toNT()]=c}return this.transitiveClosure(u,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!1)}findTypeURIs(t){return this.NTtoURI(this.findTypesNT(t))}connectedStatements(t,e,r){r=r||[];let n=[t],i={},s={},o=[],a=this,c=function(t){let c=function(t){"BlankNode"!==t.termType||i[t.value]||(i[t.value]=!0,n.push(t))},u=a.statementsMatching(null,null,t,e).concat(a.statementsMatching(t,null,null,e));u=u.filter((function(t){if(r[t.predicate.value])return!1;let e=t.toNT();return!s[e]&&(s[e]=!0,!0)})),u.forEach((function(t){c(t.subject),c(t.object)})),o=o.concat(u)};for(;n.length;)c(n.shift());return o}formula(t){return new B}fromNT(t){let e,r,n;switch(t[0]){case"<":return this.sym(t.slice(1,-1));case'"':if(n=void 0,e=void 0,r=t.lastIndexOf('"'),r<t.length-1)if("@"===t[r+1])n=t.slice(r+2);else{if("^^"!==t.slice(r+1,r+3))throw new Error("Can't convert string from NT: "+t);e=this.fromNT(t.slice(r+3))}return t=(t=(t=(t=t.slice(1,r)).replace(/\\"/g,'"')).replace(/\\n/g,"\n")).replace(/\\\\/g,"\\"),this.rdfFactory.literal(t,n||e);case"_":return this.rdfFactory.blankNode(t.slice(2));case"?":return new v(t.slice(1))}throw new Error("Can't convert from NT: "+t)}holds(t,e,r,n){let i;if(1===arguments.length){if(!t)return!0;if(t instanceof Array){for(i=0;i<t.length;i++)if(!this.holds(t[i]))return!1;return!0}if((0,o.SH)(t))return this.holds(t.subject,t.predicate,t.object,t.graph);if(t.statements)return this.holds(t.statements)}return null!=this.anyStatementMatching(t,e,r,n)}holdsStatement(t){return this.holds(t.subject,t.predicate,t.object,t.graph)}list(t,e){if(e.rdfFactory.supports.COLLECTIONS){const r=e.rdfFactory.collection();return t.forEach((function(t){r.append(t)})),r}{const r=e.rdfFactory.blankNode(),n=M(e.rdfFactory,r,t);return e.addAll(n),r}}NTtoURI(t){let e,r,n={};for(e in t)t.hasOwnProperty(e)&&(r=t[e],"<"===e[0]&&(n[e.slice(1,-1)]=r));return n}serialize(t,e,r,n){return F(r,this,t,e,void 0,n)}substitute(t){let e=this.statements.map((function(e){return e.substitute(t)}));const r=new B;return r.addAll(e),r}sym(t,e){if(e)throw new Error("This feature (kb.sym with 2 args) is removed. Do not assume prefix mappings.");return this.rdfFactory.namedNode(t)}the(t,e,r,n){let i=this.any(t,e,r,n);return null==i&&E.A.error("No value found for the() {"+t+" "+e+" "+r+"}."),i}transitiveClosure(t,e,r){let n,i,s,o,a,c,u={};Object.assign(u,t);let l={};for(;;){if(c=function(){for(let t in u)if(u.hasOwnProperty(t))return t}(),null==c)return l;for(a=r?this.each(void 0,e,this.fromNT(c)):this.each(this.fromNT(c),e),i=0,s=a.length;i<s;i++)n=a[i],o=n.toNT(),o in l||o in u||(u[o]=u[c]);l[c]=u[c],delete u[c]}}topTypeURIs(t){let e,r,n,i,s,o,a,c;for(n in a=[],t)if(t.hasOwnProperty(n)){for(c=t[n],s=0,o=this.each(this.rdfFactory.namedNode(n),this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf")),e=0,i=o.length;e<i;e++)if(r=o[e],"http://www.w3.org/2000/01/rdf-schema#Resource"!==r.uri){s++;break}s||(a[n]=c)}return a["http://www.w3.org/2000/01/rdf-schema#Resource"]&&delete a["http://www.w3.org/2000/01/rdf-schema#Resource"],a["http://www.w3.org/2002/07/owl#Thing"]&&delete a["http://www.w3.org/2002/07/owl#Thing"],a}toString(){return"{"+this.statements.join("\n")+"}"}variable(t){return new v(t)}whether(t,e,r,n){return this.statementsMatching(t,e,r,n,!1).length}}r.A.fromValue=h;const q=r.A,$={xsd:N("http://www.w3.org/2001/XMLSchema#")};r.A.toJS=function(t){return(0,o.P3)(t)?t.elements.map(r.A.toJS):(0,o.c$)(t)?t.datatype.equals($.xsd("boolean"))?"1"===t.value||"true"===t.value:t.datatype.equals($.xsd("dateTime"))||t.datatype.equals($.xsd("date"))?new Date(t.value):t.datatype.equals($.xsd("integer"))||t.datatype.equals($.xsd("float"))||t.datatype.equals($.xsd("decimal"))?Number(t.value):t.value:t};var H=a(6357);class z{constructor(t,e){this.pat=new J,this.vars=[],this.name=t,this.id=e}}function X(t,e,r,n){function i(t){var e,r="";for(e in t)t.hasOwnProperty(e)&&(r+=" "+e+" -> "+t[e]);return r}function s(t){var e,r="Bindings: ",n=t.length;for(e=0;e<n;e++)r+=i(t[e][0])+";\n\t";return r}function o(t,e,r,n){var i;if(t.length!==e.length)return[];if(!t.length)return[[[],null]];var s=function(t,e,r,n){var i=r[t];if(void 0===i){if(t.isVar){var s=[];return s[t]=e,[[s,null]]}i=t}if(!i.complexType)return n.redirections[i]&&(i=n.redirections[i]),n.redirections[e]&&(e=n.redirections[e]),i.equals(e)||i.uri&&i.uri===d?[[[],null]]:[];if(t instanceof Array)return e instanceof Array?o(t,e,r):[];throw new Error("query.js: oops - code not written yet")}(t[0],e[0],r,n);if(0===s.length)return s;var a,c,u,l,h,f,p,y=[],g=s.length;for(a=0;a<g;a++){for(h in p=[],c=s[a][0])c.hasOwnProperty(h)&&(p[h]=c[h]);for(h in r)r.hasOwnProperty(h)&&(p[h]=r[h]);for(l=(i=o(t.slice(1),e.slice(1),p,n)).length,u=0;u<l;u++){for(h in f=i[u][0],c)c.hasOwnProperty(h)&&(f[h]=c[h]);y.push([f,null])}}return y}function a(t,e){var r,n={};for(r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);for(r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return n}function c(t,e){return this.trunkBindings=e,this.originalCallback=t,this.branches=[],this}function u(t,e){return this.count=0,this.success=!1,this.done=!1,this.callback=t,this.onDone=e,this}c.prototype.checkAllDone=function(){var t;for(t=0;t<this.branches.length;t++)if(!this.branches[t].done)return;E.A.debug("OPTIONAL BIDNINGS ALL DONE:"),this.doCallBacks(this.branches.length-1,this.trunkBindings)},c.prototype.doCallBacks=function(t,e){var r;if(t<0)return this.originalCallback(e);for(r=0;r<this.branches[t].results.length;r++)this.doCallBacks(t-1,a(e,this.branches[t].results[r]))},u.prototype.reportMatch=function(t){this.callback(t),this.success=!0},u.prototype.reportDone=function(){this.done=!0,E.A.info("Mandatory query branch finished.***"),void 0!==this.onDone&&this.onDone()};var l=function(t){return this.count=0,this.done=!1,this.results=[],this.junction=t,t.branches.push(this),this};function h(t,e,r){var n,i,s,o,a,c;for(e.nvars=0,e.index=null,n=[e.subject,e.predicate,e.object,e.why],o=[t.subjectIndex,t.predicateIndex,t.objectIndex,t.whyIndex],s=0;s<4;s++){let u=n[s];if(u.uri&&u.uri===d);else if(u.isVar&&void 0===r[u])e.nvars++;else{if(void 0,u=void 0===(c=r[a=n[s]])?a:c,t.redirections[t.id(u)]&&(u=t.redirections[t.id(u)]),!(i=o[s][t.id(u)]))return e.index=[],!1;(null===e.index||e.index.length>i.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(){E.A.debug("Optional branch finished - results.length = "+this.results.length),0===this.results.length&&(this.results.push({}),E.A.debug("Optional branch FAILED - that's OK.")),this.done=!0,this.junction.checkAllDone()};var p=function(t,r,n,s,o,a,u){E.A.debug("Match begins, Branch count now: "+u.count+" for "+u.pattern_debug);var h,f,d=r.statements;if(0===d.length){if(E.A.debug("FOUND MATCH WITH BINDINGS:"+i(n)),0===r.optional.length)u.reportMatch(n);else{E.A.debug("OPTIONAL: "+r.optional);var y,m=new c(e,n),b=[];for(y=0;y<r.optional.length;y++)b[y]=new l(m),b[y].pattern_debug=r.optional[y];for(y=0;y<r.optional.length;y++)b[y].count=b[y].count+1,p(t,r.optional[y],n,"",o,e,b[y])}return u.count--,void E.A.debug("Match ends -- success , Branch count now: "+u.count+" for "+u.pattern_debug)}var v=d.length;if(o){var x=function(e,i){var c=e.uri.split("#")[0];o.nowOrWhenFetched(c,void 0,(function(i,c,l){i||H.log("Error following link to <"+e.uri+"> in query: "+c),p(t,r,n,s,o,a,u)}))};for(f=0;f<v;f++){if(h=d[f],void 0!==n[h.subject]&&n[h.subject].uri&&o&&"unrequested"===o.getState((0,w.docpart)(n[h.subject].uri)))return void x(n[h.subject]);if(void 0!==n[h.object]&&n[h.object].uri&&o&&"unrequested"===o.getState((0,w.docpart)(n[h.object].uri)))return void x(n[h.object])}}g(t,r,n,s,o,a,u)},y=function(t,e){var r,n,i=!0;for(r in t)t.hasOwnProperty(r)&&e[r]&&(n=e[r].test)&&!n(t[r])&&(i=!1);return i},g=function(t,e,r,n,a,c,u){var l,d,g,m,b,w,v,x=e.statements,_=x.length;for(l=0;l<_;l++)h(t,v=x[l],r);x.sort(f),v=x[0];var A,T=t.formula();T.optional=e.optional,T.constraints=e.constraints,T.statements=x.slice(1),E.A.debug(n+"match2 searching "+v.index.length+" for "+v+"; bindings so far="+i(r));var N,O,j=v.index.length,S=0;for(A=0;A<j;A++)for(O=v.index[A],N=o([v.subject,v.predicate,v.object,v.why],[O.subject,O.predicate,O.object,O.why],r,t),E.A.info(n+" From first: "+N.length+": "+s(N)),g=N.length,d=0;d<g;d++)if(b=[],w=N[d][0],y(w,e.constraints)){for(m in w)w.hasOwnProperty(m)&&(b[m]=w[m]);for(m in r)r.hasOwnProperty(m)&&(b[m]=r[m]);u.count++,S++,p(t,T,b,n+" ",a,c,u)}else E.A.debug("Branch count CS: "+u.count);u.count--,0===S&&E.A.debug("Match2 fails completely on "+v),E.A.debug("Match2 ends, Branch count: "+u.count+" for "+u.pattern_debug),0===u.count&&(E.A.debug("Branch finished."),u.reportDone())},m=this;E.A.debug("Query on "+this.statements.length);var b=new u(e,n);b.count++,t.sync?p(m,t.pat,t.pat.initBindings,"",r,e,b):setTimeout((function(){p(m,t.pat,t.pat.initBindings,"",r,e,b)}),0)}const V="http://www.w3.org/2002/07/owl#";function G(t,e,r,n){var i=t.any(e,r,void 0);return!!i&&(t.equate(i,n),!0)}function Q(t,e,r,n){var i=t.any(void 0,r,n);return!!i&&(t.equate(i,e),!0)}function W(t,e,r,n,i){t.typeCallback&&t.typeCallback(t,n,i);var s=t.classActions[t.id(n)],o=!1;if(s)for(var a=0;a<s.length;a++)o=o||s[a](t,e,r,n,i);return o}class J extends B{constructor(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(void 0,void 0,void 0,void 0,r),(0,t.A)(this,"updater",void 0),(0,t.A)(this,"namespaces",void 0),(0,t.A)(this,"classActions",void 0),(0,t.A)(this,"propertyActions",void 0),(0,t.A)(this,"redirections",void 0),(0,t.A)(this,"aliases",void 0),(0,t.A)(this,"HTTPRedirects",void 0),(0,t.A)(this,"subjectIndex",void 0),(0,t.A)(this,"predicateIndex",void 0),(0,t.A)(this,"objectIndex",void 0),(0,t.A)(this,"whyIndex",void 0),(0,t.A)(this,"index",void 0),(0,t.A)(this,"features",void 0),(0,t.A)(this,"_universalVariables",void 0),(0,t.A)(this,"_existentialVariables",void 0),(0,t.A)(this,"rdfArrayRemove",void 0),(0,t.A)(this,"dataCallbacks",[]),(0,t.A)(this,"dataRemovalCallbacks",[]),this.propertyActions={},this.classActions={},this.redirections=[],this.aliases=[],this.HTTPRedirects=[],this.subjectIndex=[],this.predicateIndex=[],this.objectIndex=[],this.whyIndex=[],this.index=[this.subjectIndex,this.predicateIndex,this.objectIndex,this.whyIndex],this.namespaces={},this.features=e||[],this.rdfArrayRemove=r.rdfArrayRemove||O.RDFArrayRemove,r.dataCallback&&(this.dataCallbacks=[r.dataCallback]),r.dataRemovalCallback&&(this.dataRemovalCallbacks=[r.dataRemovalCallback]),this.initPropertyActions(this.features)}static get defaultGraphURI(){return d}substitute(t){var e=this.statements.map((function(e){return e.substitute(t)})),r=new J;return r.add(e),r}addDataCallback(t){this.dataCallbacks.push(t)}addDataRemovalCallback(t){this.dataRemovalCallbacks.push(t)}applyPatch(t,e,r){var n,i=this,s=null;function o(o){if(t.delete){n=t.delete,s&&(n=n.substitute(s)),n=n.statements;var a=[],c=n.map((function(t){var r=i.statementsMatching(t.subject,t.predicate,t.object,e);return 0===r.length?(a.push(t),null):r[0]}));if(a.length)return r("Could not find to delete: "+a.join("\n or "));c.map((function(t){i.remove(t)}))}t.insert&&(n=t.insert,s&&(n=n.substitute(s)),(n=n.statements).map((function(t){t.graph=e,i.add(t.subject,t.predicate,t.object,t.graph)}))),o()}if(t.where){var a=new z("patch");a.pat=t.where,a.pat.statements.map((function(t){t.graph=Ye(e.value)})),a.sync=!0;var c=[];i.query(a,(function(t){c.push(t)}),i.fetcher,(function(){return 0===c.length?r("No match found to be patched:"+t.where):c.length>1?r("Patch ambiguous. No patch done."):(s=c[0],void o(r))}))}else o(r)}declareExistential(t){return this._existentialVariables||(this._existentialVariables=[]),this._existentialVariables.push(t),t}initPropertyActions(t){this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"))]=[W],L(t,"sameAs")>=0&&(this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode(`${V}sameAs`))]=[function(t,e,r,n,i){return t.equate(e,n),!0}]),L(t,"InverseFunctionalProperty")>=0&&(this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode(`${V}InverseFunctionalProperty`))]=[function(t,e,r,n,i){return t.newPropertyAction(e,Q)}]),L(t,"FunctionalProperty")>=0&&(this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode(`${V}FunctionalProperty`))]=[function(t,e,r,n,i){return t.newPropertyAction(e,G)}])}addStatement(t){return this.add(t.subject,t.predicate,t.object,t.graph),this.statements.length}add(t,e,r,n){var i,s,a;if(1===arguments.length){if(t instanceof Array)for(i=0;i<t.length;i++)this.add(t[i]);else(0,o.aF)(t)?this.add(t.subject,t.predicate,t.object,t.graph):(0,o.ok)(t)&&this.add(t.statements);return this}n||(n=this.fetcher?this.fetcher.appNode:this.rdfFactory.defaultGraph()),"string"==typeof t&&(t=this.rdfFactory.namedNode(t)),e=q.fromValue(e);const c=q.fromValue(r);if(n=q.fromValue(n),!(0,o.CZ)(t))throw new Error("Subject is not a subject type");if(!(0,o.fY)(e))throw new Error(`Predicate ${e} is not a predicate type`);if(!(0,o.DJ)(c))throw new Error(`Object ${c} is not an object type`);if(!(0,o.RN)(n))throw new Error("Why is not a graph type");this.predicateCallback&&this.predicateCallback(this,e,n);var u=this.id(this.canon(e)),l=!1;if(s=this.propertyActions[u])for(i=0;i<s.length;i++)l=l||s[i](this,t,e,c,n);if(this.holds(t,e,c,n))return null;var h=[this.id(this.canon(t)),u,this.id(this.canon(c)),this.id(this.canon(n))];for(a=this.rdfFactory.quad(t,e,c,n),i=0;i<4;i++){var f=this.index[i],p=h[i];f[p]||(f[p]=[]),f[p].push(a)}this.statements.push(a);for(const t of this.dataCallbacks)t(a);return a}canon(t){if(!t)return t;const e=this.redirections[this.id(t)];if(e)return e;switch(t.termType){case n.$Q:return new i(t.value);case n.r0:return t;case n.ic:return new y;case n.S:case n.bD:return t;case n.QW:return new l(t.value,t.language,t.datatype);case n.Kk:return new s.A(t.value);case n.P2:return new v(t.value);default:throw new Error(`Term Type not recognized for canonization: ${t.termType}`)}}check(){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)}}checkStatementList(t,e){void 0===e&&(e=0);for(var r,n=" found in "+["subject","predicate","object","why"][e]+" index.",i=0;i<t.length;i++){for(var s=[(r=t[i]).subject,r.predicate,r.object,r.graph],o=function(t,e){for(var r=0;r<t.length;r++)if(t[r].subject.equals(e.subject)&&t[r].predicate.equals(e.predicate)&&t[r].object.equals(e.object)&&t[r].why.equals(e.graph))return!0},a=0;a<4;a++){var c=this.canon(s[a]),u=this.id(c);this.index[a][u]&&o(this.index[a][u],r)}if(!o(this.statements,r))throw new Error("Statement list does not statement "+r+"@"+r.graph+n)}}close(){return this}compareTerms(t,r){return Object.prototype.hasOwnProperty.call(t,"compareTerm")?t.compareTerm(r):e.A[t.termType]<e.A[r.termType]?-1:e.A[t.termType]>e.A[r.termType]?1:t.value<r.value?-1:t.value>r.value?1:0}copyTo(t,e,r){r||(r=[]);var n=this.statementsMatching(t);-1!==L(r,"two-direction")&&n.concat(this.statementsMatching(void 0,void 0,t));for(var i=0;i<n.length;i++){var s=n[i];switch(s.object.termType){case"NamedNode":this.add(e,s.predicate,s.object);break;case"Literal":case"BlankNode":case"Collection":this.add(e,s.predicate,s.object.copy(this))}-1!==L(r,"delete")&&this.remove(s)}}equate(t,e){const r=this.canon(t),n=this.canon(e);var i=this.compareTerms(r,n);return!i||(i<0?this.replaceWith(n,r):this.replaceWith(r,n))}formula(t){return new J(t)}get length(){return this.statements.length}match(t,e,r,n){return this.statementsMatching(q.fromValue(t),q.fromValue(e),q.fromValue(r),q.fromValue(n))}mentionsURI(t){var e="<"+t+">";return!!this.subjectIndex[e]||!!this.objectIndex[e]||!!this.predicateIndex[e]}newExistential(t){if(!t)return this.bnode();var e=this.sym(t);return this.declareExistential(e)}newPropertyAction(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,s=0;s<n.length;s++)i=i||e(this,n[s].subject,t,n[s].object);return i}newUniversal(t){var e=this.sym(t);return this._universalVariables||(this._universalVariables=[]),this._universalVariables.push(e),e}variable(t){return new v(t)}nextSymbol(t){for(var e=0;;e++){var r=t.value+"#n"+e;if(!this.mentionsURI(r))return this.sym(r)}}query(t,e,r,n){return X.call(this,t,e,r,n)}querySync(t){var e=[],r=!1;if(t.sync=!0,X.call(this,t,(function(t){e.push(t)}),null,(function(){r=!0})),!r)throw new Error("Sync query should have called done function");return e}remove(t){if(t instanceof Array){for(var e=0;e<t.length;e++)this.remove(t[e]);return this}if((0,o.ok)(t))return this.remove(t.statements);var r=this.statementsMatching(t.subject,t.predicate,t.object,t.graph);if(!r.length)throw new Error("Statement to be removed is not on store: "+t);return this.removeStatement(r[0]),this}removeDocument(t){this.removeMetadata(t);for(var e=this.statementsMatching(void 0,void 0,void 0,t).slice(),r=0;r<e.length;r++)this.removeStatement(e[r]);return this.removeMatches(t,null,null),this}removeMetadata(t){const e=this.sym("chrome://TheCurrentSession"),r="http://www.w3.org/2007/ont/link#",n=this.statementsMatching(void 0,this.sym(`${r}requestedURI`),this.rdfFactory.literal(t.value),e).map((t=>t.subject));for(var i=0;i<n.length;i++){const t=n[i];if(null!=t){let n;const i=this.any(t,this.sym(`${r}status`),null,e);if(null!=i){n=this.statementsMatching(i,this.sym(`${r}status`),null,e).slice();for(var s=0;s<n.length;s++)this.removeStatement(n[s])}const o=this.any(t,this.sym(`${r}response`),null,e);if(null!=o)for(n=this.statementsMatching(o,null,null,e).slice(),s=0;s<n.length;s++)this.removeStatement(n[s]);for(n=this.statementsMatching(t,null,null,e).slice(),s=0;s<n.length;s++)this.removeStatement(n[s])}}return this.removeMatches(this.sym(t.value),null,null,e),this}removeMany(t,e,r,n,i){for(var s=this.statementsMatching(t,e,r,n,!1),o=[],a=0;a<s.length;a++)o.push(s[a]);for(i&&(o=o.slice(0,i)),a=0;a<o.length;a++)this.remove(o[a])}removeMatches(t,e,r,n){return this.removeMany(t,e,r,n),this}removeStatement(t){for(var e=[t.subject,t.predicate,t.object,t.graph],r=0;r<4;r++){var n=this.canon(e[r]),i=this.id(n);this.index[r][i]&&this.rdfArrayRemove(this.index[r][i],t)}this.rdfArrayRemove(this.statements,t);for(const e of this.dataRemovalCallbacks)e(t);return this}removeStatements(t){for(var e=0;e<t.length;e++)this.remove(t[e]);return this}replaceWith(t,e){for(var r=this.id(t),n=this.id(e),i=function(t){var e=t[r];if(e){var i=t[n];t[n]=i?e.concat(i):e,delete t[r]}},s=0;s<4;s++)i(this.index[s]);if(this.redirections[r]=e,t.value){if(this.aliases[n]||(this.aliases[n]=[]),this.aliases[n].push(t),this.aliases[r])for(s=0;s<this.aliases[r].length;s++)this.redirections[this.id(this.aliases[r][s])]=e,this.aliases[n].push(this.aliases[r][s]);this.add(e,this.sym("http://www.w3.org/2007/ont/link#uri"),t),this.fetcher&&this.fetcher.nowKnownAs(t,e)}return i(this.classActions),i(this.propertyActions),!0}allAliases(t){var e=this.aliases[this.id(this.canon(t))]||[];return e.push(this.canon(t)),e}sameThings(t,e){if(t.equals(e))return!0;var r=this.canon(t);if(!r)return!1;var n=this.canon(e);return!!n&&r.value===n.value}setPrefixForURI(t,e){if(("tab"!==t||!this.namespaces.tab)&&"ns"!==t.slice(0,2)&&"default"!==t.slice(0,7)){for(let t in this.namespaces)this.namespaces[t]==e&&delete this.namespaces[t];this.namespaces[t]=e}}statementsMatching(t,e,r,n,i){var s,o,a=[t,e,r,n],c=[],u=[],l=[],h=[];for(s=0;s<4;s++)c[s]=this.canon(q.fromValue(a[s])),c[s]?(h.push(s),u[s]=this.id(c[s])):l.push(s);if(0===h.length)return this.statements;if(1===h.length)return s=h[0],(o=this.index[s][u[s]])&&i&&o.length>1&&(o=o.slice(0,1)),o||[];var f,p,d=1e10;for(p=0;p<h.length;p++){if(s=h[p],!(o=this.index[s][u[s]]))return[];o.length<d&&(d=o.length,f=p)}for(var y=h[f],g=this.index[y][u[y]],m=h.slice(0,f).concat(h.slice(f+1)),b=[],w=["subject","predicate","object","why"],v=0;v<g.length;v++){var x=g[v];for(p=0;p<m.length;p++)if(s=m[p],!this.canon(x[w[s]]).equals(c[s])){x=null;break}if(null!=x&&(b.push(x),i))break}return b}uris(t){var e=this.canon(t),r=this.aliases[this.id(e)];if(!e.value)return[];var n=[e.value];if(r)for(var i=0;i<r.length;i++)n.push(r[i].uri);return n}serialize(t,e,r,n){return F(r,this,t,e,void 0,n={...n||{},namespaces:n?.namespaces?{...this.namespaces,...n.namespaces}:{...this.namespaces}})}}(0,t.A)(J,"handleRDFType",void 0),J.handleRDFType=W;const Y=N("http://www.w3.org/1999/02/22-rdf-syntax-ns#");function Z(t,e){function r(n,i,s){const o=t.statementsMatching(n,Y("rest"),null,e);if(1!==o.length)throw new Error(`Bad list structure: no rest at ${n}`);const a=t.statementsMatching(n,Y("first"),null,e);if(1!==a.length)throw new Error(`Bad list structure: rest but ${a.length} firsts at ${n}`);const c=[a[0].object].concat(i),u=s.concat(o).concat(a),l=t.statementsMatching(null,Y("rest"),n,e);if(0===l.length){const r=new f(c);return t.remove(u),void function(t,e,r,n){for(const i of t.statementsMatching(r,null,null,n)){const r=new b(e,i.predicate,i.object,n);t.remove(i),t.add(r)}for(const i of t.statementsMatching(null,r,null,n))t.remove(i),t.add(new b(i.subject,e,i.object,n));for(const i of t.statementsMatching(null,null,r,n))t.remove(i),t.add(new b(i.subject,i.predicate,e,n))}(t,r,n,e)}if(1!==l.length)throw new Error(`Bad list structure: ${l.length} pres at ${n}`);const h=l[0].subject;if("BlankNode"!==h.termType)throw new Error(`Bad list element node ${h} type: ${h.termType} `);r(h,c,u)}!function(t,e){const r=Y("nil");for(const n of t.statementsMatching(r,null,null,e)){t.remove(n);const r=new f;t.add(new b(r,n.predicate,n.object,e))}for(const n of t.statementsMatching(null,null,r,e))if(!n.predicate.sameTerm(Y("rest"))){t.remove(n);const r=new f;t.add(new b(n.subject,n.predicate,r,e))}}(t,e),t.statementsMatching(null,Y("rest"),Y("nil"),e).forEach((t=>{if("BlankNode"!==t.subject.termType)throw new Error(`Bad list element node ${t.subject} type: ${t.subject.termType} `);r(t.subject,[],[])}))}var K="http://www.w3.org/2000/10/swap/log#",tt=function(t){return t},et=function(t){return t},rt=function(t){if(t.length>0)throw"missing.js: oops nnonempty dict not imp";return[]},nt=function(t){return t.length},it=function(t,e,r){if(void 0===t.slice)throw"@@ mising.js: No .slice function for "+t+" of type "+typeof t;return void 0===r||null==r?t.slice(e):t.slice(e,r)},st=Error("dummy error stop iteration"),ot=function(t){return this.last=0,this.li=t,this.next=function(){if(this.last==this.li.length)throw st;return this.li[this.last++]},this},at=function(t,e){return t.indexOf(e)},ct=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;r<t.length;r++){var n=t.charCodeAt(r);n<128?e+=String.fromCharCode(n):n>127&&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 ut=function(t,e){return w.join(e,t)},lt="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil",ht="http://www.w3.org/2002/07/owl#sameAs",ft="\t\r\n !\"#$%&'()*.,+/;<=>?@[\\]^`{|}~",pt=ft+":",dt=new RegExp("^([-+]?[0-9]+)(\\.[0-9]+)?([eE][-+]?[0-9]+)?","g"),yt=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?"),gt=new RegExp("[\\s#]"),mt=new RegExp('[\\\\\\r\\n\\"]',"g"),bt=new RegExp("^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*","g");function wt(t,e){var r=t.charAt(e+1);return""===r||gt.test(r)}const vt=function(t,e,r,n,i,s,o,a){return new xt(t,e,r,n,i,s,o,a)};class xt{constructor(t,e,r,n,i,s,o,a){void 0===e&&(e=null),void 0===r&&(r=""),void 0===n&&(n=null),void 0===i&&(i=""),void 0===s&&(s=null),void 0===o&&(o=""),void 0===a&&(a=null),this._bindings=new rt([]),this._flags=o,""!=r&&(ct(r.indexOf(":")>=0,"Document URI not absolute: "+r),this._bindings[""]=r+"#"),this._store=t,i&&t.setGenPrefix(i),this._thisDoc=r,this.source=t.sym(r),this.lines=0,this.statementCount=0,this.hasNil=!1,this.startOfLine=0,this.previousLine=0,this._genPrefix=i,this.keywords=new et(["a","this","bind","has","is","of","true","false"]),this.keywordsSet=0,this._anonymousNodes=new rt([]),this._variables=new rt([]),this._parentVariables=new rt([]),this._reason=a,this._reason2=null,this._baseURI=n||r||null,ct(!this._baseURI||this._baseURI.indexOf(":")>=0),this._genPrefix||(this._thisDoc?this._genPrefix=this._thisDoc+"#_g":this._genPrefix=RDFSink_uniqueURI()),null==e?this._thisDoc?this._formula=t.formula(r+"#_formula"):this._formula=t.formula():this._formula=e,this._context=this._formula,this._parentContext=null}here(t){return this._genPrefix+"_L"+this.lines+"C"+(t-this.startOfLine+1)}formula(){return this._formula}loadStream(t){return this.loadBuf(t.read())}loadBuf(t){return this.startDoc(),this.feed(t),this.endDoc()}feed(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 _t(this._thisDoc,this.lines,e,n,"expected directive or statement")}}directiveOrStatement(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}tok(t,e,r){if("@"==e.slice(r,r+1))r+=1;else if(L(this.keywords,t)<0)return-1;var n=r+nt(t);return e.slice(r,n)==t&&ft.indexOf(e.charAt(n))>=0?n:-1}directive(t,e){if((s=this.skipSpace(t,e))<0)return s;var r=new et([]);if((s=this.tok("bind",t,e))>0)throw _t(this._thisDoc,this.lines,t,e,"keyword bind is obsolete: use @prefix");if((s=this.tok("keywords",t,e))>0){if((e=this.commaSeparatedList(t,s,r,!1))<0)throw _t(this._thisDoc,this.lines,t,e,"'@keywords' needs comma separated list of words");return this.setKeywords(it(r,null,null)),e}if((s=this.tok("forAll",t,e))>0){if((e=this.commaSeparatedList(t,s,r,!0))<0)throw _t(this._thisDoc,this.lines,t,e,"Bad variable list after @forAll");var n=new ot(r);try{for(;;){var i=n.next();(L(this._variables,i)<0||L(this._parentVariables,i)>=0)&&(this._variables[i]=this._context.newUniversal(i))}}catch(t){if(t!=st)throw t}return e}if((s=this.tok("forSome",t,e))>0){if((e=this.commaSeparatedList(t,s,r,this.uri_ref2))<0)throw _t(this._thisDoc,this.lines,t,e,"Bad variable list after @forSome");n=new ot(r);try{for(;;)i=n.next(),this._context.declareExistential(i)}catch(t){if(t!=st)throw t}return e}if((s=this.tok("prefix",t,e))>=0){var s,o=new et([]);if((e=this.qname(t,s,o))<0)throw _t(this._thisDoc,this.lines,t,s,"expected qname after @prefix");if((s=this.uri_ref2(t,e,o))<0)throw _t(this._thisDoc,this.lines,t,e,"expected <uriref> after @prefix _qname_");var a=o[1].uri;return this._baseURI?a=ut(this._baseURI,a):ct(a.indexOf(":")>=0,"With no base URI, cannot handle relative URI for NS"),ct(a.indexOf(":")>=0),this._bindings[o[0][0]]=a,this.bind(o[0][0],function(t){return encodeURI(t)}(a)),s}if((s=this.tok("base",t,e))>=0){if(o=new et([]),(e=this.uri_ref2(t,s,o))<0)throw _t(this._thisDoc,this.lines,t,s,"expected <uri> after @base ");if(a=o[0].uri,!this._baseURI)throw _t(this._thisDoc,this.lines,t,s,"With no previous base URI, cannot use relative URI in @base <"+a+">");return a=ut(this._baseURI,a),ct(a.indexOf(":")>=0),this._baseURI=a,e}return-1}bind(t,e){""==t||this._store.setPrefixForURI(t,e)}setKeywords(t){null==t?this.keywordsSet=0:(this.keywords=t,this.keywordsSet=1)}startDoc(){}endDoc(){return this.hasNil&&this._store.rdfFactory.supports.COLLECTIONS&&Z(this._store,this.source),this._formula}makeStatement(t){t[0].add(t[2],t[1],t[3],this.source),(t[2].uri&&t[2].uri===lt||t[3].uri&&t[3].uri===lt)&&(this.hasNil=!0),this.statementCount+=1}statement(t,e){var r=new et([]);if((e=this.object(t,e,r))<0)return e;var n=this.property_list(t,e,r[0]);if(n<0)throw _t(this._thisDoc,this.lines,t,e,"expected propertylist");return n}subject(t,e,r){return this.item(t,e,r)}verb(t,e,r){if((i=this.skipSpace(t,e))<0)return i;var n=new et([]);if((i=this.tok("has",t,e))>=0){if((e=this.prop(t,i,n))<0)throw _t(this._thisDoc,this.lines,t,i,"expected property after 'has'");return r.push(new tt(["->",n[0]])),e}if((i=this.tok("is",t,e))>=0){if((e=this.prop(t,i,n))<0)throw _t(this._thisDoc,this.lines,t,i,"expected <property> after 'is'");if((i=this.skipSpace(t,e))<0)throw _t(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 _t(this._thisDoc,this.lines,t,e,"expected 'of' after 'is' <prop>");return r.push(new tt(["<-",n[0]])),i}if((i=this.tok("a",t,e))>=0)return r.push(new tt(["->",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 tt(["<-",this._store.sym(K+"implies")])),e+2;if("="==t.slice(e,e+1))return">"==t.slice(e+1,e+2)?(r.push(new tt(["->",this._store.sym(K+"implies")])),e+2):(r.push(new tt(["->",this._store.sym(ht)])),e+1);if(":="==t.slice(e,e+2))return r.push(new tt(["->",K+"becomes"])),e+2;if((i=this.prop(t,e,n))>=0)return r.push(new tt(["->",n[0]])),i;if(">-"==t.slice(e,e+2)||"<-"==t.slice(e,e+2))throw _t(this._thisDoc,this.lines,t,i,">- ... -> syntax is obsolete.");return-1}prop(t,e,r){return this.item(t,e,r)}item(t,e,r){return this.path(t,e,r)}blankNode(t){return this._context.bnode(t,this._reason2)}path(t,e,r){if((s=this.nodeOrLiteral(t,e,r))<0)return s;for(;"!^.".indexOf(t.slice(s,s+1))>=0;){var n=t.slice(s,s+1);if("."==n){var i=t.slice(s+1,s+2);if(!i||pt.indexOf(i)>=0&&":?<[{(".indexOf(i)<0)break}var s,o=r.pop(),a=this.blankNode(this.here(s));if((s=this.node(t,s+1,r))<0)throw _t(this._thisDoc,this.lines,t,s,"EOF found in middle of path syntax");var c=r.pop();"^"==n?this.makeStatement(new tt([this._context,c,a,o])):this.makeStatement(new tt([this._context,c,o,a])),r.push(a)}return s}anonymousNode(t){if(e=this._anonymousNodes[t])return e;var e=this._store.bnode(t);return this._anonymousNodes[t]=e,e}node(t,e,r,n){void 0===n&&(n=null);var i=n;if((l=this.skipSpace(t,e))<0)return l;e=l;var s=t.slice(e,e+1);if("["==s){var o=this.here(e);if((l=this.skipSpace(t,e+1))<0)throw _t(this._thisDoc,this.lines,t,e,"EOF after '['");if("="==t.slice(l,l+1)){e=l+1;var a=new et([]);if(!((l=this.objectList(t,e,a))>=0))throw _t(this._thisDoc,this.lines,t,e,"objectList expected after [= ");if(i=a[0],nt(a)>1){var c=new ot(a);try{for(;;){var u=c.next();this.makeStatement(new tt([this._context,this._store.sym(ht),i,u]))}}catch(t){if(t!=st)throw t}}if((l=this.skipSpace(t,l))<0)throw _t(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(o)),(e=this.property_list(t,l,i))<0)throw _t(this._thisDoc,this.lines,t,l,"property_list expected");if((l=this.skipSpace(t,e))<0)throw _t(this._thisDoc,this.lines,t,e,"EOF when ']' expected after [ <propertyList>");if("."==t.slice(l,l+1))return r.push(i),l;if("]"!=t.slice(l,l+1))throw _t(this._thisDoc,this.lines,t,l,"']' expected");return r.push(i),l+1}if("{"==s){if("$"==t.slice(e+1,e+2)){l=(e+=1)+1;for(var h=new et([]),f=!0;;){if((e=this.skipSpace(t,l))<0)throw _t(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 _t(this._thisDoc,this.lines,t,e,"expected: ','");e+=1}var p=new et([]);if((l=this.item(t,e,p))<0)throw _t(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,g=this._parentVariables;this._parentVariables=this._variables,this._anonymousNodes=new rt([]),this._variables=this._variables.slice();var m=this._reason2;for(this._reason2=null,null==i&&(i=this._store.formula()),this._context=i;;){if((e=this.skipSpace(t,l))<0)throw _t(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 _t(this._thisDoc,this.lines,t,e,"expected statement or '}'")}return this._anonymousNodes=y,this._variables=this._parentVariables,this._parentVariables=g,this._context=this._parentContext,this._reason2=m,this._parentContext=d,r.push(i.close()),l}if("("==s){var b=this._store.list;for("$"==t.slice(e+1,e+2)&&(b=this._store.newSet,e+=1),l=e+1,h=new et([]);;){if((e=this.skipSpace(t,l))<0)throw _t(this._thisDoc,this.lines,t,e,"needed ')', found end.");if(")"==t.slice(e,e+1)){l=e+1;break}if(p=new et([]),(l=this.item(t,e,p))<0)throw _t(this._thisDoc,this.lines,t,e,"expected item in list or ')'");h.push(p[0])}return r.push(b(h,this._context)),l}if((l=this.tok("this",t,e))>=0)throw _t(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}property_list(t,e,r){for(;;){if((l=this.skipSpace(t,e))<0)throw _t(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 et([]);if((l=this.verb(t,e,n))<=0)return e;var i=new et([]);if((e=this.objectList(t,l,i))<0)throw _t(this._thisDoc,this.lines,t,l,"objectList expected");var s=new ot(i);try{for(;;){var o=s.next(),a=n[0],c=a[0],u=a[1];"->"==c?this.makeStatement(new tt([this._context,u,r,o])):this.makeStatement(new tt([this._context,u,o,r]))}}catch(t){if(t!=st)throw t}if((l=this.skipSpace(t,e))<0)throw _t(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 et([]);if((l=this.node(t,e,h,r))<0)throw _t(this._thisDoc,this.lines,t,e,"bad {} or () or [] node after :- ");e=l}}}commaSeparatedList(t,e,r,n){if((i=this.skipSpace(t,e))<0)throw _t(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 s=t.slice(e,e+1);if(","!=s)return"."!=s?-1:e;if((i=n?this.uri_ref2(t,e+1,r):this.bareWord(t,e+1,r))<0)throw _t(this._thisDoc,this.lines,t,i,"bad list content")}}objectList(t,e,r){if((e=this.object(t,e,r))<0)return-1;for(;;){var n=this.skipSpace(t,e);if(n<0)throw _t(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}}checkDot(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 _t(this._thisDoc,this.lines,t,r,"expected '.' or '}' or ']' at end of statement")}uri_ref2(t,e,r){var n=new et([]);if((f=this.qname(t,e,n))>=0){var i=n[0],s=i[0],o=i[1];if(null==s){ct(0,"not used?");var a=this._baseURI+"#"}else if(!(a=this._bindings[s])){if("_"==s)return r.push(this.anonymousNode(o)),f;throw _t(this._thisDoc,this.lines,t,e,"Prefix "+s+" not bound.")}var c=this._store.sym(a+o);return L(this._variables,c)>=0?r.push(this._variables[c]):r.push(c),f}if((e=this.skipSpace(t,e))<0)return-1;if("?"==t.charAt(e)){var u=new et([]);return(f=this.variable(t,e,u))>0?(r.push(u[0]),f):-1}if("<"==t.charAt(e)){for(var l=e+=1;e<nt(t);){if(">"==t.charAt(e)){var h=t.slice(l,e);return this._baseURI?h=ut(this._baseURI,h):ct(h.indexOf(":")>=0,"With no base URI, cannot deal with relative URIs"),"#"==t.slice(e-1,e)&&"#"!=it(h,-1,null)&&(h+="#"),c=this._store.sym(h),L(this._variables,c)>=0?r.push(this._variables[c]):r.push(c),e+1}e+=1}throw _t(this._thisDoc,this.lines,t,f,"unterminated URI reference")}if(this.keywordsSet){var f;if(u=new et([]),(f=this.bareWord(t,e,u))<0)return-1;if(L(this.keywords,u[0])>=0)throw _t(this._thisDoc,this.lines,t,e,'Keyword "'+u[0]+'" not allowed here.');return r.push(this._store.sym(this._bindings[""]+u[0])),f}return-1}skipSpace(t,e){for(var r=e||0;r<t.length;r++){var n=t.charAt(r);if(" \n\r\t\f\v \u2028\u2029 ".indexOf(n)<0){if("#"!==t.charAt(r))return r;for(;;r++){if(r===t.length)return-1;if("\n"===t.charAt(r)){this.lines=this.lines+1;break}}}else"\n"===t.charAt(r)&&(this.lines=this.lines+1)}return-1}variable(t,e,r){if((n=this.skipSpace(t,e))<0)return-1;if("?"!=t.slice(n,n+1))return-1;var n;if(e=n+=1,"0123456789-".indexOf(t.charAt(n))>=0)throw _t(this._thisDoc,this.lines,t,n,"Varible name can't start with '"+t.charAt(n)+"s'");for(;e<nt(t)&&pt.indexOf(t.charAt(e))<0;)e+=1;if(null==this._parentContext)throw _t(this._thisDoc,this.lines,t,n,"Can't use ?xxx syntax for variable in outermost level: "+t.slice(n-1,e));return r.push(this._store.variable(t.slice(n,e))),e}bareWord(t,e,r){var n=this.skipSpace(t,e);if(n<0)return-1;var i=t.charAt(n);if("0123456789-".indexOf(i)>=0)return-1;if(pt.indexOf(i)>=0)return-1;for(e=n;e<nt(t);){var s=t.charAt(e);if("."===s){if(wt(t,e))break}else if(pt.indexOf(s)>=0)break;e+=1}return r.push(t.slice(n,e)),e}qname(t,e,r){if((e=this.skipSpace(t,e))<0)return-1;var n=t.charAt(e);if("0123456789-+".indexOf(n)>=0)return-1;if(pt.indexOf(n)<0){var i=n;for(e+=1;e<nt(t);){if("."===(n=t.charAt(e))){if(wt(t,e))break}else if(pt.indexOf(n)>=0)break;i+=n,e+=1}}else i="";if(e<nt(t)&&":"==t.charAt(e)){var s=i;for(e+=1,i="";e<nt(t);){if("."===(n=t.charAt(e))){if(wt(t,e))break}else if(pt.indexOf(n)>=0)break;i+=n,e+=1}return r.push(new tt([s,i])),e}return i&&this.keywordsSet&&L(this.keywords,i)<0?(r.push(new tt(["",i])),e):-1}object(t,e,r){if((s=this.subject(t,e,r))>=0)return s;{if((s=this.skipSpace(t,e))<0)return-1;e=s;var n=null;let a=t.charAt(e);if('"'==a||"'"==a){n=t.slice(e,e+3==a+a)?a+a+a:a,e+=nt(n);var i=this.strconst(t,e,n),s=i[0],o=i[1];return r.push(this._store.literal(o)),s}return-1}}nodeOrLiteral(t,e,r){if((c=this.node(t,e,r))>=0)return c;if((c=this.skipSpace(t,e))<0)return-1;e=c;var n=t.charAt(e);if("-+0987654321".indexOf(n)>=0){if(yt.lastIndex=0,null!=(h=yt.exec(t.slice(e))))c=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(dt.lastIndex=0,null==(h=dt.exec(t.slice(e))))throw _t(this._thisDoc,this.lines,t,e,"Bad number or date syntax");c=e+dt.lastIndex,(i=t.slice(e,c)).indexOf("e")>=0?r.push(this._store.literal(parseFloat(i),this._store.sym("http://www.w3.org/2001/XMLSchema#double"))):t.slice(e,c).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 c}if('"'==t.charAt(e)){if('"""'==t.slice(e,e+3))var s='"""';else s='"';e+=nt(s);var o=null,a=this.strconst(t,e,s),c=a[0],u=a[1],l=null;if("@"==t.slice(c,c+1)){var h;if(bt.lastIndex=0,null==(h=bt.exec(t.slice(c+1))))throw _t(this._thisDoc,startline,t,e,"Bad language code syntax on string literal, after @");e=bt.lastIndex+c+1,l=t.slice(c+1,e),c=e}if("^^"==t.slice(c,c+2)){var f=new et([]);c=this.uri_ref2(t,c+2,f),o=f[0]}return r.push(this._store.literal(u,l||o)),c}return-1}strconst(t,e,r){for(var n=e,i="",s=this.lines;n<nt(t);){if(e=n+nt(r),t.slice(n,e)==r)return new tt([e,i]);if('"'!=t.charAt(n)){if(mt.lastIndex=0,!mt.exec(t.slice(n)))throw _t(this._thisDoc,s,t,n,"Closing quote missing in string at ^ in "+t.slice(n-20,n)+"^"+t.slice(n,n+20));if(e=n+mt.lastIndex-1,i+=t.slice(n,e),'"'!=(c=t.charAt(e)))if("\r"!=c){if("\n"==c){if('"'==r)throw _t(this._thisDoc,s,t,e,"newline found in string literal");this.lines=this.lines+1,i+=c,n=e+1,this.previousLine=this.startOfLine,this.startOfLine=n}else if("\\"==c){if(n=e+1,!(c=t.slice(n,n+1)))throw _t(this._thisDoc,s,t,e,"unterminated string literal (2)");var o=at('abfrtvn\\"',c);if(o>=0)i+='a\b\f\r\t\v\n\\"'.charAt(o),n+=1;else if("u"==c)n=(a=this.uEscape(t,n+1,s))[0],i+=c=a[1];else{if("U"!=c)throw _t(this._thisDoc,this.lines,t,e,"bad escape");var a,c;n=(a=this.UEscape(t,n+1,s))[0],i+=c=a[1]}}}else n=e+1;else n=e}else i=i+'"',n=n+1}throw _t(this._thisDoc,this.lines,t,e,"unterminated string literal")}uEscape(t,e,r){for(var n=e,i=0,s=0;i<4;){var o=t.slice(n,n+1).toLowerCase();if(n+=1,""==o)throw _t(this._thisDoc,r,t,e,"unterminated string literal(3)");var a=at("0123456789abcdef",o);if(a<0)throw _t(this._thisDoc,r,t,e,"bad string literal hex escape");s=16*s+a,i+=1}var c=String.fromCharCode(s);return new tt([n,c])}UEscape(t,e,r){for(var n=e,i=0,s="\\U";i<8;){var o=t.slice(n,n+1).toLowerCase();if(n+=1,""==o)throw _t(this._thisDoc,r,t,e,"unterminated string literal(3)");if(at("0123456789abcdef",o)<0)throw _t(this._thisDoc,r,t,e,"bad string literal hex escape");s+=o,i+=1}var a,c=(a="0x"+it(s,2,10)-0,String.fromCharCode(a));return new tt([n,c])}}function _t(t,e,r,n,i){let s=e+1,o="Line "+s+" of <"+t+">: Bad syntax: "+i+'\nat: "'+r.slice(n,n+30)+'"',a=new SyntaxError(o,t,s);return a.lineNo=s,a.characterInFile=n,a.syntaxProblem=i,a}const At={...T,supports:{[x.collections]:!0,[x.defaultGraphType]:!1,[x.equalsMethod]:!0,[x.identity]:!1,[x.id]:!0,[x.reversibleId]:!1,[x.variableType]:!0},collection:t=>new f(t),id(t){return(0,o.P3)(t)?`( ${t.elements.map((t=>this.id(t))).join(", ")} )`:(0,o.DZ)(t)?v.toString(t):T.id(t)},termToNQ:t=>t.termType===n.r0?f.toNT(t):T.termToNQ(t)},Tt=At;function Et(t,e){return"string"==typeof e?t.rdfFactory.literal(e):Object.prototype.hasOwnProperty.call(e,"@list")?!0===t.rdfFactory.supports.COLLECTIONS?function(t,e){if(!Array.isArray(e))throw new TypeError("Object must be an array");return t.rdfFactory.collection(e.map((e=>Et(t,e))))}(t,e["@list"]):function(t,e){const r=e["@id"]?Ot(t,e):t.rdfFactory.blankNode(),n=e["@list"].map((e=>Et(t,e))),i=M(t.rdfFactory,r,n);return t.addAll(i),r}(t,e):Object.prototype.hasOwnProperty.call(e,"@id")?Ot(t,e):Object.prototype.hasOwnProperty.call(e,"@language")?t.rdfFactory.literal(e["@value"],e["@language"]):Object.prototype.hasOwnProperty.call(e,"@type")?t.rdfFactory.literal(e["@value"],t.rdfFactory.namedNode(e["@type"])):Object.prototype.hasOwnProperty.call(e,"@value")?t.rdfFactory.literal(e["@value"]):t.rdfFactory.literal(e)}async function Nt(t,e,r){const n=r&&Object.prototype.hasOwnProperty.call(r,"termType")?r.value:r,i=await Promise.all([a.e(515),a.e(789)]).then(a.t.bind(a,8515,23));return(await i.default.flatten(JSON.parse(t),null,{base:n})).reduce(((t,e)=>jt(t,r,e)),e)}function Ot(t,e){return e["@id"].startsWith("_:")?t.rdfFactory.blankNode(e["@id"].substring(2)):t.rdfFactory.namedNode(e["@id"])}function jt(t,e,r){const n=r["@id"]?Ot(t,r):t.rdfFactory.blankNode();for(const i of Object.keys(r)){if("@id"===i)continue;if("@graph"==i){const e=n,s=r[i];for(let r=0;r<s.length;r++)t=jt(t,e,s[r])}const s=r[i];if(Array.isArray(s))for(let r=0;r<s.length;r++)t.addStatement(St(t,n,i,s[r],e));else t.addStatement(St(t,n,i,s,e))}return t}function St(t,e,r,n,i){let s,o;return"@type"===r?(s=t.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),o=t.rdfFactory.namedNode(n)):(s=t.rdfFactory.namedNode(r),o=Et(t,n)),t.rdfFactory.quad(e,s,o,t.rdfFactory.namedNode(i))}var Rt=a(2313),kt=a(5582),It=a.n(kt);const Ct="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Pt="http://www.w3.org/2001/XMLSchema#",Ft="http://www.w3.org/2000/10/swap/",Ut={xsd:{decimal:`${Pt}decimal`,boolean:`${Pt}boolean`,double:`${Pt}double`,integer:`${Pt}integer`,string:`${Pt}string`},rdf:{type:`${Ct}type`,nil:`${Ct}nil`,first:`${Ct}first`,rest:`${Ct}rest`,langString:`${Ct}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${Ft}reify#forSome`,forAll:`${Ft}reify#forAll`},log:{implies:`${Ft}log#implies`}},{xsd:Dt}=Ut,Mt=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Lt={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Bt=/[\x00-\x20<>\\"\{\}\|\^\`]/,qt={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},$t=/$0^/;class Ht{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 qt)&&this[t]instanceof RegExp&&(this[t]=$t)}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,o;for(;t=this._newline.exec(r);)this.comments&&(o=this._comment.exec(t[0]))&&i("comment",o[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&&(o=this._comment.exec(r))&&i("comment",o[1],"",this._line,r.length),r=null,i("eof","","",this._line,0)),this._input=r;const a=this._line,c=r[0];let u="",l="",h="",f=null,p=0,d=!1;switch(c){case"^":if(r.length<3)break;if("^"!==r[1]){this._n3Mode&&(p=1,u="^");break}if(this._previousMarker="^^",r=r.substr(2),"<"!==r[0]){d=!0;break}case"<":if(f=this._unescapedIri.exec(r))u="IRI",l=f[1];else if(f=this._iri.exec(r)){if(l=this._unescape(f[1]),null===l||Bt.test(l))return s(this);u="IRI"}else r.length>1&&"<"===r[1]?(u="<<",p=2):this._n3Mode&&r.length>1&&"="===r[1]&&(u="inverse",p=2,l=">");break;case">":r.length>1&&">"===r[1]&&(u=">>",p=2);break;case"_":((f=this._blank.exec(r))||e&&(f=this._blank.exec(`${r} `)))&&(u="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 s(this);null===f&&0===p||(u="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 s(this);null===f&&0===p||(u="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(f=this._variable.exec(r))&&(u="var",l=f[0]);break;case"@":"literal"===this._previousMarker&&(f=this._langcode.exec(r))?(u="langcode",l=f[1]):(f=this._keyword.exec(r))&&(u=f[0]);break;case".":if(1===r.length?e:r[1]<"0"||r[1]>"9"){u=".",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} `)))&&(u="literal",l=f[0],h="string"==typeof f[1]?Dt.double:"string"==typeof f[2]?Dt.decimal:Dt.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(f=this._sparqlKeyword.exec(r))?u=f[0].toUpperCase():d=!0;break;case"f":case"t":(f=this._boolean.exec(r))?(u="literal",l=f[0],h=Dt.boolean):d=!0;break;case"a":(f=this._shortPredicates.exec(r))?(u="abbreviation",l="a"):d=!0;break;case"=":this._n3Mode&&r.length>1&&(u="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,u=c);break;case"{":!this._lineMode&&r.length>=2&&("|"===r[1]?(u="{|",p=2):(u=c,p=1));break;case"|":r.length>=2&&"}"===r[1]&&(u="|}",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} `)))&&(u="prefixed",h=f[1]||"",l=this._unescape(f[2])):(u="prefix",l=f[1]||"")),"^^"===this._previousMarker)switch(u){case"prefixed":u="type";break;case"IRI":u="typeIRI";break;default:u=""}if(!u)return e||!/^'''|^"""/.test(r)&&/\n|\r/.test(r)?s(this):this._input=r;const y=p||f[0].length,g=i(u,l,h,a,y);this.previousToken=g,this._previousMarker=u,r=r.substr(y,r.length)}function i(e,i,s,o,a){const c=r?n-r.length:n,u={type:e,value:i,prefix:s,line:o,start:c,end:c+a};return t(null,u),u}function s(e){t(e._syntaxError(/^\S*/.exec(r)[0]))}}_unescape(t){let e=!1;const r=t.replace(Mt,((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 Lt?Lt[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,s=n+r;if(1===r&&0!==i||3===r&&this._lineMode)break;return this._line+=i,{value:this._unescape(e),matchLength:s}}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}It()((()=>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=Rt.hp.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:zt,xsd:Xt}=Ut;let Vt,Gt=0;const Qt={namedNode:ee,blankNode:re,variable:ie,literal:ne,defaultGraph:function(){return Vt},quad:se,triple:se,fromTerm:oe,fromQuad:ae};class Wt{constructor(t){this.id=t}get value(){return this.id}equals(t){return t instanceof Wt?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 Jt extends Wt{get termType(){return"NamedNode"}}class Yt extends Wt{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const t=this.id;let e=t.lastIndexOf('"')+1;return e<t.length&&"@"===t[e++]?t.substr(e).toLowerCase():""}get datatype(){return new Jt(this.datatypeString)}get datatypeString(){const t=this.id,e=t.lastIndexOf('"')+1,r=e<t.length?t[e]:"";return"^"===r?t.substr(e+2):"@"!==r?Xt.string:zt.langString}equals(t){return t instanceof Yt?this.id===t.id:!!t&&!!t.datatype&&this.termType===t.termType&&this.value===t.value&&this.language===t.language&&this.datatype.value===t.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}}class Zt extends Wt{constructor(t){super(`_:${t}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}}class Kt extends Wt{constructor(t){super(`?${t}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}}Vt=new class extends Wt{constructor(){return super(""),Vt||this}get termType(){return"DefaultGraph"}equals(t){return this===t||!!t&&this.termType===t.termType}};class te extends Wt{constructor(t,e,r,n){super(""),this._subject=t,this._predicate=e,this._object=r,this._graph=n||Vt}get termType(){return"Quad"}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}get graph(){return this._graph}toJSON(){return{termType:this.termType,subject:this._subject.toJSON(),predicate:this._predicate.toJSON(),object:this._object.toJSON(),graph:this._graph.toJSON()}}equals(t){return!!t&&this._subject.equals(t.subject)&&this._predicate.equals(t.predicate)&&this._object.equals(t.object)&&this._graph.equals(t.graph)}}function ee(t){return new Jt(t)}function re(t){return new Zt(t||"n3-"+Gt++)}function ne(t,e){if("string"==typeof e)return new Yt(`"${t}"@${e.toLowerCase()}`);let r=e?e.value:"";return""===r&&("boolean"==typeof t?r=Xt.boolean:"number"==typeof t&&(Number.isFinite(t)?r=Number.isInteger(t)?Xt.integer:Xt.double:(r=Xt.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),""===r||r===Xt.string?new Yt(`"${t}"`):new Yt(`"${t}"^^${r}`)}function ie(t){return new Kt(t)}function se(t,e,r,n){return new te(t,e,r,n)}function oe(t){if(t instanceof Wt)return t;switch(t.termType){case"NamedNode":return ee(t.value);case"BlankNode":return re(t.value);case"Variable":return ie(t.value);case"DefaultGraph":return Vt;case"Literal":return ne(t.value,t.language||t.datatype);case"Quad":return ae(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function ae(t){if(t instanceof te)return t;if("Quad"!==t.termType)throw new Error(`Unexpected termType: ${t.termType}`);return se(oe(t.subject),oe(t.predicate),oe(t.object),oe(t.graph))}let ce=0;class ue{constructor(t){this._contextStack=[],this._graph=null,t=t||{},this._setBase(t.baseIRI),t.factory&&he(this,t.factory);const e="string"==typeof t.format?t.format.match(/\w*$/)[0].toLowerCase():"",r=/turtle/.test(e),n=/trig/.test(e),i=/triple/.test(e),s=/quad/.test(e),o=this._n3Mode=/n3/.test(e),a=i||s;(this._supportsNamedGraphs=!(r||o))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(r||n||i||o),this._supportsRDFStar=""===e||/star|\*$/.test(e),a&&(this._resolveRelativeIRI=t=>null),this._blankNodePrefix="string"!=typeof t.blankNodePrefix?"":t.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=t.lexer||new Ht({lineMode:a,n3:o}),this._explicitQuantifiers=!!t.explicitQuantifiers}static _resetBlankNodePrefix(){ce=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 s=this._n3Mode;this._contextStack.push({type:t,subject:r,predicate:n,object:i,graph:e,inverse:!!s&&this._inversePredicate,blankPrefix:s?this._prefixes._:"",quantified:s?this._quantified:null}),s&&(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._factory.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._factory.namedNode(n+t.value);break;case"blank":r=this._factory.blankNode(this._prefixes[t.prefix]+t.value);break;case"var":r=this._factory.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._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._factory.blankNode(),null,null),this._readSubject):this._error("Unexpected graph",t);case"}":return this._readPunctuation(t);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',t);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',t);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",t);if(0===t.prefix.length)return this._literalValue=t.value,this._completeSubjectLiteral;this._subject=this._factory.literal(t.value,this._factory.namedNode(t.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",t);default:if(void 0===(this._subject=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(t){const e=t.type;switch(e){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[t.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${e}`,t):(this._subject=null,"]"===e?this._readBlankNodeTail(t):this._readPunctuation(t));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",t);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",t);default:if(void 0===(this._predicate=this._readEntity(t)))return}return this._readObject}_readObject(t){switch(t.type){case"literal":if(0===t.prefix.length)return this._literalValue=t.value,this._readDataTypeOrLang;this._object=this._factory.literal(t.value,this._factory.namedNode(t.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",t);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",t);default:if(void 0===(this._object=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(t){return"{"===t.type?this._readGraph(t):this._readPredicate(t)}_readGraph(t){return"{"!==t.type?this._error(`Expected graph but got ${t.type}`,t):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(t){return"]"===t.type?(this._subject=null,this._readBlankNodeTail(t)):(this._predicate=null,this._readPredicate(t))}_readBlankNodeTail(t){if("]"!==t.type)return this._readBlankNodePunctuation(t);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const e=null===this._predicate;return this._restoreContext("blank",t),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:e?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(t){switch(t.type){case".":case"}":return this._subject=null,this._readPunctuation(t);default:return this._readPredicate(t)}}_readListItem(t){let e=null,r=null,n=this._readListItem;const i=this._subject,s=this._contextStack,o=s[s.length-1];switch(t.type){case"[":this._saveContext("blank",this._graph,r=this._factory.blankNode(),this.RDF_FIRST,this._subject=e=this._factory.blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,r=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",t),0!==s.length&&"list"===s[s.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._factory.literal(t.value,this._factory.namedNode(t.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",t);default:if(void 0===(e=this._readEntity(t)))return}if(null===r&&(this._subject=r=this._factory.blankNode()),null===i?null===o.predicate?o.subject=r:o.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._factory.literal(this._literalValue);switch(t.type){case"type":case"typeIRI":const r=this._readEntity(t);if(void 0===r)return;e=this._factory.literal(this._literalValue,r),t=null;break;case"langcode":e=this._factory.literal(this._literalValue,t.value),t=null}return{token:t,literal:e}}_completeSubjectLiteral(t){return this._subject=this._completeLiteral(t).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(t,e){const 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-star syntax",t);const s=this._predicate,o=this._object;this._subject=this._factory.quad(n,s,o,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._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(t){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(t)):"."!==t.type?this._error("Expected declaration to end with a dot",t):this._readInTopContext}_readQuantifierList(t){let e;switch(t.type){case"IRI":case"prefixed":if(void 0!==(e=this._readEntity(t,!0)))break;default:return this._error(`Unexpected ${t.type}`,t)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,e,this.QUANTIFIERS_GRAPH)):this._quantified[e.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(t){return","===t.type?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(t))}_getPathReader(t){return this._afterPath=t,this._readPath}_readPath(t){switch(t.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const e=this._contextStack,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._factory.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._factory.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._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",t),null===this._subject?(this._subject=e,this._readPredicate):(this._object=e,this._getContextEndReader())}_getContextEndReader(){const t=this._contextStack;if(!t.length)return this._readPunctuation;switch(t[t.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(t,e,r,n){this._callback(null,this._factory.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=le}_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,s=0,o="/";for(;n<e;){switch(o){case":":if(i<0&&"/"===t[++n]&&"/"===t[++n])for(;(i=n+1)<e&&"/"!==t[i];)n=i;break;case"?":case"#":n=e;break;case"/":if("."===t[n+1])switch(o=t[1+ ++n],o){case"/":r+=t.substring(s,n-1),s=n+1;break;case void 0:case"?":case"#":return r+t.substring(s,n)+t.substr(n+1);case".":if(o=t[1+ ++n],void 0===o||"/"===o||"?"===o||"#"===o){if(r+=t.substring(s,n-2),(s=r.lastIndexOf("/"))>=i&&(r=r.substr(0,s)),"/"!==o)return`${r}/${t.substr(n+1)}`;s=n+1}}}o=t[++n]}return r+t.substring(s)}parse(t,e,r){let n,i,s;if(e&&(e.onQuad||e.onPrefix||e.onComment)?(n=e.onQuad,i=e.onPrefix,s=e.onComment):(n=e,i=r),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${ce++}_`,this._prefixCallback=i||le,this._inversePredicate=!1,this._quantified=Object.create(null),!n){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}let o=(t,e)=>{null!==t?(this._callback(t),this._callback=le):this._readCallback&&(this._readCallback=this._readCallback(e))};s&&(this._lexer.comments=!0,o=(t,e)=>{null!==t?(this._callback(t),this._callback=le):this._readCallback&&("comment"===e.type?s(e.value):this._readCallback=this._readCallback(e))}),this._callback=n,this._lexer.tokenize(t,o)}}function le(){}function he(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(Ut.rdf.first),t.RDF_REST=e.namedNode(Ut.rdf.rest),t.RDF_NIL=e.namedNode(Ut.rdf.nil),t.N3_FORALL=e.namedNode(Ut.r.forAll),t.N3_FORSOME=e.namedNode(Ut.r.forSome),t.ABBREVIATIONS={a:e.namedNode(Ut.rdf.type),"=":e.namedNode(Ut.owl.sameAs),">":e.namedNode(Ut.log.implies)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}he(ue.prototype,Qt);var fe=a(6357);if(void 0===pe)var pe={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};class de{constructor(t,e){this.options=e||{},this.kb=t,this.target=e.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()}addTriple(t,e,r,n){var i,s,o,a;i=void 0===e?T.namedNode(this.options.base):this.toRDFNodeObject(e),o=this.toRDFNodeObject(r),s=this.toRDFNodeObject(n),a=T.namedNode(this.options.base),this.kb.add(i,o,s,a)}ancestorPath(t){for(var e="";t&&t.nodeType!==pe.DOCUMENT_NODE;)e="/"+t.localName+e,t=t.parentNode;return e}copyMappings(t){var e={};for(var r in t)e[r]=t[r];return e}copyProperties(){}deriveDateTimeType(t){for(var e=0;e<de.dateTimeTypes.length;e++){var r=de.dateTimeTypes[e].pattern.exec(t);if(r&&r[0].length===t.length)return de.dateTimeTypes[e].type}return null}init(){}newBlankNode(){return this.blankCounter++,"_:"+this.blankCounter}newSubjectOrigin(t,e){}parseCURIE(t,e,r){var n,i=t.indexOf(":");if(i>=0){var s=t.substring(0,i);if(""===s)return(n=e[""])?n+t.substring(i+1):null;if("_"===s)return"_:"+t.substring(i+1);if(de.NCNAME.test(s)&&(n=e[s]))return n+t.substring(i+1)}return null}parseCURIEOrURI(t,e,r){return this.parseCURIE(t,e,r)||this.resolveAndNormalize(r,t)}parsePredicate(t,e,r,n,i,s){if(""===t)return null;var o=this.parseTermOrCURIEOrAbsURI(t,e,s?null:r,n,i);return o&&0===o.indexOf("_:")?null:o}parsePrefixMappings(t,e){for(var r=this.tokenize(t),n=null,i=0;i<r.length;i++)":"===r[i][r[i].length-1]?n=r[i].substring(0,r[i].length-1):n&&(e[n]=this.options.base?w.join(r[i],this.options.base):r[i],n=null)}static parseRDFaDOM(t,e,r){var n=new de(e,{base:r});t.baseURI||(t.baseURI=r),n.process(t,{baseURI:r})}parseSafeCURIEOrCURIEOrURI(t,e,r){return"["===(t=this.trim(t)).charAt(0)&&"]"===t.charAt(t.length-1)?0===(t=(t=t.substring(1,t.length-1)).trim(t)).length?null:"_:"===t?this.theOne:this.parseCURIE(t,e,r):this.parseCURIEOrURI(t,e,r)}parseTermOrCURIEOrAbsURI(t,e,r,n,i){t=this.trim(t);var s=this.parseCURIE(t,n,i);if(s)return s;if(r){if(e&&!this.absURIRE.exec(t))return e+t;var o=r[t];if(o)return o;if(o=r[t.toLowerCase()])return o}return this.absURIRE.exec(t)?this.resolveAndNormalize(i,t):null}parseTermOrCURIEOrURI(t,e,r,n,i){t=this.trim(t);var s=this.parseCURIE(t,n,i);if(s)return s;var o=r[t];return o||((o=r[t.toLowerCase()])?o:e&&!this.absURIRE.exec(t)?e+t:this.resolveAndNormalize(i,t))}parseURI(t){return t}process(t,e){var r;e=e||{},t.nodeType===pe.DOCUMENT_NODE?(t.baseURI&&!e.baseURI&&(e.baseURI=t.baseURI),r=t.baseURI,(t=t.documentElement).baseURI||(t.baseURI=r),this.setContext(t)):t.parentNode.nodeType===pe.DOCUMENT_NODE&&this.setContext(t);var n=[],i=function(t){if(!t&&e&&e.baseURI)return e.baseURI;var r=t.indexOf("#");return r>=0&&(t=t.substring(0,r)),e&&e.baseURIMap&&(t=e.baseURIMap(t)),t};for(n.push({current:t,context:this.push(null,i(t.baseURI))});n.length>0;){var s=n.shift();if(s.parent){if(s.context.parent&&s.context.parent.listMapping===s.listMapping)continue;for(let t in s.listMapping){var o=s.listMapping[t];if(0!==o.length){var a=[];for(let t=0;t<o.length;t++)a.push(this.newBlankNode());for(let t=0;t<a.length;t++)this.addTriple(s.parent,a[t],"http://www.w3.org/1999/02/22-rdf-syntax-ns#first",o[t]),this.addTriple(s.parent,a[t],"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest",{type:de.objectURI,value:t+1<a.length?a[t+1]:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"});this.addTriple(s.parent,s.subject,t,{type:de.objectURI,value:a[0]})}else this.addTriple(s.parent,s.subject,t,{type:de.objectURI,value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"})}}else{var c=s.current,u=s.context,l=!1,h=null,f=null,p=null,d=u.prefixes,y=!1,g=[],m=u.listMapping,b=!u.parent,v=u.language,x=u.vocabulary;r=this.parseURI(i(c.baseURI)),c.item=null;var _=c.getAttributeNode("vocab");if(_){let t=this.trim(_.value);if(t.length>0){x=t;var A=r.spec;this.addTriple(c,A,"http://www.w3.org/ns/rdfa#usesVocabulary",{type:de.objectURI,value:x})}else x=this.vocabulary}for(var T=0;T<c.attributes.length;T++){var E=c.attributes[T];if("x"===E.nodeName.charAt(0)&&0===E.nodeName.indexOf("xmlns:")){y||(d=this.copyMappings(d),y=!0);var N=E.nodeName.substring(6),O=de.trim(E.value);d[N]=this.options.base?w.join(O,this.options.base):O}}var j=c.getAttributeNode("prefix");j&&(y||(d=this.copyMappings(d),y=!0),this.parsePrefixMappings(j.value,d));var S=null;for(let t=0;!S&&t<this.langAttributes.length;t++)S=c.getAttributeNodeNS(this.langAttributes[t].namespaceURI,this.langAttributes[t].localName);if(S){let t=de.trim(S.value);v=t.length>0?t:null}var R,k,I=c.getAttributeNode("rel"),C=c.getAttributeNode("rev"),P=c.getAttributeNode("typeof"),F=c.getAttributeNode("property"),U=c.getAttributeNode("datatype"),D=this.inHTMLMode?c.getAttributeNode("datetime"):null,M=c.getAttributeNode("content"),L=c.getAttributeNode("about"),B=c.getAttributeNode("src"),q=c.getAttributeNode("resource"),$=c.getAttributeNode("href"),H=c.getAttributeNode("inlist"),z=[];if(I){k=this.tokenize(I.value);for(let t=0;t<k.length;t++)(R=this.parsePredicate(k[t],x,u.terms,d,r,this.inHTMLMode&&null!==F))&&z.push(R)}var X=[];if(C){k=this.tokenize(C.value);for(let t=0;t<k.length;t++)(R=this.parsePredicate(k[t],x,u.terms,d,r,this.inHTMLMode&&F))&&X.push(R)}if(this.inHTMLMode&&(I||C)&&F&&(0===z.length&&(I=null),0===X.length&&(C=null)),I||C?(L&&(h=this.parseSafeCURIEOrCURIEOrURI(L.value,d,r)),P&&(p=h),h||(c.parentNode.nodeType===pe.DOCUMENT_NODE?h=i(c.baseURI):u.parentObject&&(h=i(c.parentNode.baseURI)===u.parentObject?i(c.baseURI):u.parentObject)),q&&(f=this.parseSafeCURIEOrCURIEOrURI(q.value,d,r)),f||($?f=this.resolveAndNormalize(r,encodeURI($.value)):B?f=this.resolveAndNormalize(r,encodeURI(B.value)):!P||L||this.inXHTMLMode&&("head"===c.localName||"body"===c.localName)||(f=this.newBlankNode())),!P||L||!this.inXHTMLMode||"head"!==c.localName&&"body"!==c.localName?P&&!L&&(p=f):p=h):!F||M||U?(L&&(h=this.parseSafeCURIEOrCURIEOrURI(L.value,d,r)),!h&&q&&(h=this.parseSafeCURIEOrCURIEOrURI(q.value,d,r)),!h&&$&&(h=this.resolveAndNormalize(r,encodeURI($.value))),!h&&B&&(h=this.resolveAndNormalize(r,encodeURI(B.value))),h||(c.parentNode.nodeType===pe.DOCUMENT_NODE?h=i(c.baseURI):!this.inXHTMLMode&&!this.inHTMLMode||"head"!==c.localName&&"body"!==c.localName?P?h=this.newBlankNode():u.parentObject&&(h=i(c.parentNode.baseURI)===u.parentObject?i(c.baseURI):u.parentObject,F||(l=!0)):h=i(c.parentNode.baseURI)===u.parentObject?i(c.baseURI):u.parentObject),P&&(p=h)):(L&&(h=this.parseSafeCURIEOrCURIEOrURI(L.value,d,r),P&&(p=h)),h||c.parentNode.nodeType!==pe.DOCUMENT_NODE?!h&&u.parentObject&&(h=i(c.parentNode.baseURI)===u.parentObject?i(c.baseURI):u.parentObject):(h=i(c.baseURI),P&&(p=h)),P&&!p&&(q&&(p=this.parseSafeCURIEOrCURIEOrURI(q.value,d,r)),!p&&$&&(p=this.resolveAndNormalize(r,encodeURI($.value))),!p&&B&&(p=this.resolveAndNormalize(r,encodeURI(B.value))),p||!this.inXHTMLMode&&!this.inHTMLMode||"head"!==c.localName&&"body"!==c.localName||(p=h),p||(p=this.newBlankNode()),f=p)),h&&(L||q||p)){var V=h;P&&!L&&!q&&f&&(V=f),this.newSubjectOrigin(c,V)}if(p){k=this.tokenize(P.value);for(let t=0;t<k.length;t++){var G=this.parseTermOrCURIEOrAbsURI(k[t],x,u.terms,d,r);G&&this.addTriple(c,p,de.typeURI,{type:de.objectURI,value:G})}}if(h&&h!==u.parentObject&&(m={},b=!0),f){if(I&&H)for(let t=0;t<z.length;t++){let e=m[z[t]];e||(e=[],m[z[t]]=e),e.push({type:de.objectURI,value:f})}else if(I)for(let t=0;t<z.length;t++)this.addTriple(c,h,z[t],{type:de.objectURI,value:f});if(C)for(let t=0;t<X.length;t++)this.addTriple(c,f,X[t],{type:de.objectURI,value:h})}else{if(h&&!f&&(I||C)&&(f=this.newBlankNode()),I&&H)for(let t=0;t<z.length;t++){let e=m[z[t]];e||(e=[],m[R]=e),g.push({predicate:z[t],list:e})}else if(I)for(let t=0;t<z.length;t++)g.push({predicate:z[t],forward:!0});if(C)for(let t=0;t<X.length;t++)g.push({predicate:X[t],forward:!1})}if(F){var Q=null,W=null;U?(Q=""===U.value?de.PlainLiteralURI:this.parseTermOrCURIEOrAbsURI(U.value,x,u.terms,d,r),W=D&&!M?D.value:Q===de.XMLLiteralURI||Q===de.HTMLLiteralURI?null:M?M.value:c.textContent):M?(Q=de.PlainLiteralURI,W=M.value):D?(W=D.value,(Q=de.deriveDateTimeType(W))||(Q=de.PlainLiteralURI)):I||C||(q&&(W=this.parseSafeCURIEOrCURIEOrURI(q.value,d,r)),!W&&$?W=this.resolveAndNormalize(r,encodeURI($.value)):!W&&B&&(W=this.resolveAndNormalize(r,encodeURI(B.value))),W&&(Q=de.objectURI)),Q||(P&&!L?(Q=de.objectURI,W=p):(W=c.textContent,this.inHTMLMode&&"time"===c.localName&&(Q=de.deriveDateTimeType(W)),Q||(Q=de.PlainLiteralURI))),k=this.tokenize(F.value);for(let t=0;t<k.length;t++){let e=this.parsePredicate(k[t],x,u.terms,d,r);if(e)if(H){let t=m[e];t||(t=[],m[e]=t),t.push(Q===de.XMLLiteralURI||Q===de.HTMLLiteralURI?{type:Q,value:c.childNodes}:{type:Q||de.PlainLiteralURI,value:W,language:v})}else Q===de.XMLLiteralURI||Q===de.HTMLLiteralURI?this.addTriple(c,h,e,{type:Q,value:c.childNodes}):this.addTriple(c,h,e,{type:Q||de.PlainLiteralURI,value:W,language:v})}}if(h&&!l)for(let t=0;t<u.incomplete.length;t++)u.incomplete[t].list?u.incomplete[t].list.push({type:de.objectURI,value:h}):u.incomplete[t].forward?this.addTriple(c,u.subject,u.incomplete[t].predicate,{type:de.objectURI,value:h}):this.addTriple(c,h,u.incomplete[t].predicate,{type:de.objectURI,value:u.subject});var J=null,Y=h;l?((J=this.push(u,u.subject)).parentObject=i(c.parentNode.baseURI)===u.parentObject?i(c.baseURI):u.parentObject,J.incomplete=u.incomplete,J.language=v,J.prefixes=d,J.vocabulary=x):((J=this.push(u,h)).parentObject=f||h||u.subject,J.prefixes=d,J.incomplete=g,f&&(Y=f,m={},b=!0),J.listMapping=m,J.language=v,J.vocabulary=x),b&&n.unshift({parent:c,context:u,subject:Y,listMapping:m});for(var Z=c.lastChild;Z;Z=Z.previousSibling)Z.nodeType===pe.ELEMENT_NODE&&n.unshift({current:Z,context:J})}}this.inHTMLMode&&this.copyProperties();for(let e=0;e<this.finishedHandlers.length;e++)this.finishedHandlers[e](t)}push(t,e){return{parent:t,subject:e||(t?t.subject:null),parentObject:null,incomplete:[],listMapping:t?t.listMapping:{},language:t?t.language:this.language,prefixes:t?t.prefixes:this.target.graph.prefixes,terms:t?t.terms:this.target.graph.terms,vocabulary:t?t.vocabulary:this.vocabulary}}resolveAndNormalize(t,e){return w.join(e,t)}setContext(t){"html"===t.localName&&"XHTML+RDFa 1.1"===t.getAttribute("version")?this.setXHTMLContext():"html"===t.localName||"http://www.w3.org/1999/xhtml"===t.namespaceURI?"undefined"!=typeof document&&document.doctype?"-//W3C//DTD XHTML+RDFa 1.0//EN"===document.doctype.publicId&&"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"===document.doctype.systemId?(fe.log("WARNING: RDF 1.0 is not supported. Defaulting to HTML5 mode."),this.setHTMLContext()):"-//W3C//DTD XHTML+RDFa 1.1//EN"===document.doctype.publicId&&"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd"===document.doctype.systemId?this.setXHTMLContext():this.setHTMLContext():this.setHTMLContext():this.setXMLContext()}setHTMLContext(){this.setInitialContext(),this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"},{namespaceURI:null,localName:"lang"}],this.inXHTMLMode=!1,this.inHTMLMode=!0}setInitialContext(){this.vocabulary=null,this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"}]}setXHTMLContext(){this.setInitialContext(),this.inXHTMLMode=!0,this.inHTMLMode=!1,this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"},{namespaceURI:null,localName:"lang"}],this.target.graph.terms.alternate="http://www.w3.org/1999/xhtml/vocab#alternate",this.target.graph.terms.appendix="http://www.w3.org/1999/xhtml/vocab#appendix",this.target.graph.terms.bookmark="http://www.w3.org/1999/xhtml/vocab#bookmark",this.target.graph.terms.cite="http://www.w3.org/1999/xhtml/vocab#cite",this.target.graph.terms.chapter="http://www.w3.org/1999/xhtml/vocab#chapter",this.target.graph.terms.contents="http://www.w3.org/1999/xhtml/vocab#contents",this.target.graph.terms.copyright="http://www.w3.org/1999/xhtml/vocab#copyright",this.target.graph.terms.first="http://www.w3.org/1999/xhtml/vocab#first",this.target.graph.terms.glossary="http://www.w3.org/1999/xhtml/vocab#glossary",this.target.graph.terms.help="http://www.w3.org/1999/xhtml/vocab#help",this.target.graph.terms.icon="http://www.w3.org/1999/xhtml/vocab#icon",this.target.graph.terms.index="http://www.w3.org/1999/xhtml/vocab#index",this.target.graph.terms.last="http://www.w3.org/1999/xhtml/vocab#last",this.target.graph.terms.license="http://www.w3.org/1999/xhtml/vocab#license",this.target.graph.terms.meta="http://www.w3.org/1999/xhtml/vocab#meta",this.target.graph.terms.next="http://www.w3.org/1999/xhtml/vocab#next",this.target.graph.terms.prev="http://www.w3.org/1999/xhtml/vocab#prev",this.target.graph.terms.previous="http://www.w3.org/1999/xhtml/vocab#previous",this.target.graph.terms.section="http://www.w3.org/1999/xhtml/vocab#section",this.target.graph.terms.stylesheet="http://www.w3.org/1999/xhtml/vocab#stylesheet",this.target.graph.terms.subsection="http://www.w3.org/1999/xhtml/vocab#subsection",this.target.graph.terms.start="http://www.w3.org/1999/xhtml/vocab#start",this.target.graph.terms.top="http://www.w3.org/1999/xhtml/vocab#top",this.target.graph.terms.up="http://www.w3.org/1999/xhtml/vocab#up",this.target.graph.terms.p3pv1="http://www.w3.org/1999/xhtml/vocab#p3pv1",this.target.graph.terms.related="http://www.w3.org/1999/xhtml/vocab#related",this.target.graph.terms.role="http://www.w3.org/1999/xhtml/vocab#role",this.target.graph.terms.transformation="http://www.w3.org/1999/xhtml/vocab#transformation"}setXMLContext(){this.setInitialContext(),this.inXHTMLMode=!1,this.inHTMLMode=!1}tokenize(t){return this.trim(t).split(/\s+/)}static tokenize(t){return this.trim(t).split(/\s+/)}toRDFNodeObject(t){if(void 0!==t){if("string"==typeof t)return"_:"===t.substring(0,2)?(void 0===this.blankNodes[t.substring(2)]&&(this.blankNodes[t.substring(2)]=new i(t.substring(2))),this.blankNodes[t.substring(2)]):T.namedNode(t);switch(t.type){case de.objectURI:return"_:"===t.value.substring(0,2)?(void 0===this.blankNodes[t.value.substring(2)]&&(this.blankNodes[t.value.substring(2)]=new i(t.value.substring(2))),this.blankNodes[t.value.substring(2)]):T.namedNode(t.value);case de.PlainLiteralURI:return new l(t.value,t.language||"");case de.XMLLiteralURI:case de.HTMLLiteralURI:var e="";return Object.keys(t.value).forEach((r=>{e+=O.domToString(t.value[r],this.htmlOptions)})),new l(e,"",new s.A(t.type));default:return new l(t.value,"",new s.A(t.type))}}}trim(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}static trim(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}}de.XMLLiteralURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral",de.HTMLLiteralURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML",de.PlainLiteralURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral",de.objectURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#object",de.typeURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",de.nameChar="[-A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�က0-F.0-9·̀-ͯ‿-⁀]",de.nameStartChar="[A-Za-zÀ-ÖØ-öø-ÿĀ-ıĴ-ľŁ-ňŊ-žƀ-ǃǍ-ǰǴ-ǵǺ-ȗɐ-ʨʻ-ˁΆΈ-ΊΌΎ-ΡΣ-ώϐ-ϖϚϜϞϠϢ-ϳЁ-ЌЎ-яё-ќў-ҁҐ-ӄӇ-ӈӋ-ӌӐ-ӫӮ-ӵӸ-ӹԱ-Ֆՙա-ֆא-תװ-ײء-غف-يٱ-ڷں-ھۀ-ێې-ۓەۥ-ۦअ-हऽक़-ॡঅ-ঌএ-ঐও-নপ-রলশ-হড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઋઍએ-ઑઓ-નપ-રલ-ળવ-હઽૠଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଶ-ହଽଡ଼-ଢ଼ୟ-ୡஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-வஷ-ஹఅ-ఌఎ-ఐఒ-నప-ళవ-హౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹൠ-ൡก-ฮะา-ำเ-ๅກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ຮະາ-ຳຽເ-ໄཀ-ཇཉ-ཀྵႠ-Ⴥა-ჶᄀᄂ-ᄃᄅ-ᄇᄉᄋ-ᄌᄎ-ᄒᄼᄾᅀᅌᅎᅐᅔ-ᅕᅙᅟ-ᅡᅣᅥᅧᅩᅭ-ᅮᅲ-ᅳᅵᆞᆨᆫᆮ-ᆯᆷ-ᆸᆺᆼ-ᇂᇫᇰᇹḀ-ẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼΩK-Å℮ↀ-ↂぁ-ゔァ-ヺㄅ-ㄬ가-힣一-龥〇〡-〩_]",de.NCNAME=new RegExp("^"+de.nameStartChar+de.nameChar+"*$"),de.dateTimeTypes=[{pattern:/-?P(?:[0-9]+Y)?(?:[0-9]+M)?(?:[0-9]+D)?(?:T(?:[0-9]+H)?(?:[0-9]+M)?(?:[0-9]+(?:\.[0-9]+)?S)?)?/,type:"http://www.w3.org/2001/XMLSchema#duration"},{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])?/,type:"http://www.w3.org/2001/XMLSchema#dateTime"},{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])?/,type:"http://www.w3.org/2001/XMLSchema#date"},{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])?/,type:"http://www.w3.org/2001/XMLSchema#time"},{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]/,type:"http://www.w3.org/2001/XMLSchema#gYearMonth"},{pattern:/-?[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9]/,type:"http://www.w3.org/2001/XMLSchema#gYear"}];const ye=de.parseRDFaDOM;class ge{constructor(t){this.store=t,this.bnodes={},this.why=null,this.reify=!1}frameFactory(t,e,r){return{NODE:1,ARC:2,parent:e,parser:t,store:t.store,element:r,lastChild:0,base:null,lang:null,node:null,nodeType:null,listIndex:1,rdfid:null,datatype:null,collection:!1,terminateFrame:function(){this.collection&&this.node.close()},addSymbol:function(t,e){e=w.join(e,this.base),this.node=this.store.sym(e),this.nodeType=t},loadTriple:function(){if(this.parent.parent.collection?this.parent.parent.node.append(this.node):this.store.add(this.parent.parent.node,this.parent.node,this.node,this.parser.why),null!=this.parent.rdfid){var t=this.store.sym(w.join("#"+this.parent.rdfid,this.base));this.store.add(t,this.store.sym(ge.ns.RDF+"type"),this.store.sym(ge.ns.RDF+"Statement"),this.parser.why),this.store.add(t,this.store.sym(ge.ns.RDF+"subject"),this.parent.parent.node,this.parser.why),this.store.add(t,this.store.sym(ge.ns.RDF+"predicate"),this.parent.node,this.parser.why),this.store.add(t,this.store.sym(ge.ns.RDF+"object"),this.node,this.parser.why)}},isTripleToLoad:function(){return null!=this.parent&&null!=this.parent.parent&&this.nodeType===this.NODE&&this.parent.nodeType===this.ARC&&this.parent.parent.nodeType===this.NODE},addNode:function(t){this.addSymbol(this.NODE,t),this.isTripleToLoad()&&this.loadTriple()},addCollection:function(){this.nodeType=this.NODE,this.node=this.store.collection(),this.collection=!0,this.isTripleToLoad()&&this.loadTriple()},addCollectionArc:function(){this.nodeType=this.ARC},addBNode:function(t){null!=t?null!=this.parser.bnodes[t]?this.node=this.parser.bnodes[t]:this.node=this.parser.bnodes[t]=this.store.bnode():this.node=this.store.bnode(),this.nodeType=this.NODE,this.isTripleToLoad()&&this.loadTriple()},addArc:function(t){t===ge.ns.RDF+"li"&&(t=ge.ns.RDF+"_"+this.parent.listIndex,this.parent.listIndex++),this.addSymbol(this.ARC,t)},addLiteral:function(t){this.parent.datatype&&this.parent.datatype!==ge.ns.RDF+"langString"?this.node=this.store.literal(t,this.store.sym(this.parent.datatype)):this.node=this.store.literal(t,this.lang),this.nodeType=this.NODE,this.isTripleToLoad()&&this.loadTriple()}}}getAttributeNodeNS(t,e,r){var n=null;if(t.getAttributeNodeNS)n=t.getAttributeNodeNS(e,r);else for(var i,s=t.attributes,o=0;o<s.length;++o)if((i=s[o]).namespaceURI===e&&(i.prefix?i.prefix+":"+r:r)===i.nodeName){n=i;break}return n}parse(t,e,r){var n,i=t.childNodes;if(this.cleanParser(),t.nodeType===ge.nodeType.DOCUMENT){for(var s=0;s<i.length;s++)if(i[s].nodeType===ge.nodeType.ELEMENT){n=i[s];break}}else{if(t.nodeType!==ge.nodeType.ELEMENT)throw new Error("RDFParser: can't find root in "+e+". Halting. ");n=t}this.why=r;var o=this.frameFactory(this);return this.base=e,o.base=e,o.lang=null,this.parseDOM(this.buildFrame(o,n)),!0}parseDOM(t){for(var e,r=function(t){var e="";if(null==t.namespaceURI)throw new Error("RDF/XML syntax error: No namespace for "+t.localName+" in "+this.base);return t.namespaceURI&&(e+=t.namespaceURI),t.localName?e+=t.localName:t.nodeName&&(t.nodeName.indexOf(":")>=0?e+=t.nodeName.split(":")[1]:e+=t.nodeName),e}.bind(this),n=!0;t.parent;){var i=t.element,s=i.attributes;if(i.nodeType===ge.nodeType.TEXT||i.nodeType===ge.nodeType.CDATA_SECTION)t.parent.nodeType===t.NODE&&(t.addArc(ge.ns.RDF+"value"),t=this.buildFrame(t)),t.addLiteral(i.nodeValue);else if(r(i)!==ge.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(r(i)),this.reify&&(e=this.getAttributeNodeNS(i,ge.ns.RDF,"ID"))&&(t.rdfid=e.nodeValue,i.removeAttributeNode(e));var o=this.getAttributeNodeNS(i,ge.ns.RDF,"parseType"),a=this.getAttributeNodeNS(i,ge.ns.RDF,"datatype");if(a&&(t.datatype=a.nodeValue,i.removeAttributeNode(a)),o){var c=o.nodeValue;"Literal"===c?(t.datatype=ge.ns.RDF+"XMLLiteral",(t=this.buildFrame(t)).addLiteral(i.innerHTML||i.childNodes),n=!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()),i.removeAttributeNode(o)}if(0!==s.length){var u=this.getAttributeNodeNS(i,ge.ns.RDF,"resource"),l=this.getAttributeNodeNS(i,ge.ns.RDF,"nodeID");t=this.buildFrame(t),u?(t.addNode(u.nodeValue),i.removeAttributeNode(u)):l?(t.addBNode(l.nodeValue),i.removeAttributeNode(l)):t.addBNode();for(var h=s.length-1;h>=0;h--){var f=this.buildFrame(t);f.addArc(r(s[h])),r(s[h])===ge.ns.RDF+"type"?this.buildFrame(f).addNode(s[h].nodeValue):this.buildFrame(f).addLiteral(s[h].nodeValue)}}else 0===i.childNodes.length&&this.buildFrame(t).addLiteral("")}else{var p=this.getAttributeNodeNS(i,ge.ns.RDF,"about");if(e=this.getAttributeNodeNS(i,ge.ns.RDF,"ID"),p&&e)throw new Error("RDFParser: "+i.nodeName+" has both rdf:id and rdf:about. Halting. Only one of these properties may be specified on a node.");if(!p&&e)t.addNode("#"+e.nodeValue),i.removeAttributeNode(e);else if(null==p&&null==e){var d=this.getAttributeNodeNS(i,ge.ns.RDF,"nodeID");d?(t.addBNode(d.nodeValue),i.removeAttributeNode(d)):t.addBNode()}else t.addNode(p.nodeValue),i.removeAttributeNode(p);var y=this.getAttributeNodeNS(i,ge.ns.RDF,"type");ge.ns.RDF+"Description"!==r(i)&&(y={nodeValue:r(i)}),null!=y&&(this.store.add(t.node,this.store.sym(ge.ns.RDF+"type"),this.store.sym(w.join(y.nodeValue,t.base)),this.why),y.nodeName&&i.removeAttributeNode(y));for(var g=s.length-1;g>=0;g--)this.store.add(t.node,this.store.sym(r(s[g])),this.store.literal(s[g].nodeValue,t.lang),this.why)}for(i=t.element;t.parent;){for(var m=t;null==i;)i=(t=t.parent).element;var b=i.childNodes&&i.childNodes[t.lastChild];if(b&&n){if((b.nodeType===ge.nodeType.ELEMENT||b.nodeType===ge.nodeType.TEXT||b.nodeType===ge.nodeType.CDATA_SECTION)&&(b.nodeType!==ge.nodeType.TEXT&&b.nodeType!==ge.nodeType.CDATA_SECTION||1===i.childNodes.length)){t.lastChild++,t=this.buildFrame(m,i.childNodes[t.lastChild-1]);break}t.lastChild++}else{if(t.terminateFrame(),!(t=t.parent))break;i=t.element,n=!0}}}}cleanParser(){this.bnodes={},this.why=null}buildFrame(t,e){var r=this.frameFactory(this,t,e);if(t&&(r.base=t.base,r.lang=t.lang),!e||e.nodeType===ge.nodeType.TEXT||e.nodeType===ge.nodeType.CDATA_SECTION)return r;var n=e.attributes,i=e.getAttributeNode("xml:base");null!=i&&(r.base=i.nodeValue,e.removeAttribute("xml:base"));var s=e.getAttributeNode("xml:lang");null!=s&&(r.lang=s.nodeValue,e.removeAttribute("xml:lang"));for(var o=n.length-1;o>=0;o--)if("xml"===n[o].nodeName.substr(0,3)){if("xmlns:"===n[o].name.slice(0,6)){var a=n[o].nodeValue;this.base&&(a=w.join(a,this.base)),this.store.setPrefixForURI(n[o].name.slice(6),a)}e.removeAttributeNode(n[o])}return r}}function me(t,e,r){var n,i,s,o=["INSERT","DELETE","WHERE"],a=N("http://www.w3.org/ns/pim/patch#"),c=vt(e,e,r,r,null,null,"",null),u={},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(u.query=h;;){if((i=c.skipSpace(t,n))<0)return u;if(";"===t[i]){if((n=c.skipSpace(t,i+1))<0)return u;i=n}var f=!1;for(s=0;s<o.length;s++){var p=o[s];if(t.slice(i,i+p.length)===p){if((n=c.skipSpace(t,i+p.length))<0)throw l(c._thisDoc,c.lines,t,i+p.length,"found EOF, needed {...} after "+p);if(("INSERT"===p||"DELETE"===p)&&"DATA"===t.slice(n,n+4)){if((i=c.skipSpace(t,n+4))<0)throw l(c._thisDoc,c.lines,t,n+4,"needed {...} after INSERT DATA "+p);n=i}var d=[];if((i=c.node(t,n,d))<0)throw l(c._thisDoc,c.lines,t,n,"bad syntax or EOF in {...} after "+p);u[p.toLowerCase()]=d[0],e.add(h,a(p.toLowerCase()),d[0]),f=!0,n=i}}if(!f&&"@prefix"===t.slice(i,i+7)){if((n=c.directive(t,i))<0)throw l(c._thisDoc,c.lines,t,n,"bad syntax or EOF after @prefix ");n=c.checkDot(t,n),f=!0}if(!f)throw l(c._thisDoc,c.lines,t,i,"Unknown syntax at start of statememt: '"+t.slice(i).slice(0,20)+"'")}}function be(t,e,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"text/turtle",s=arguments.length>4?arguments[4]:void 0;i=i||n.sT,i=i.split(";")[0];try{if(i===n.ny||i===n.sT)vt(e,e,r,r,null,null,"",null).loadBuf(t),a();else if(i===n.JG)new ge(e).parse(O.parseXML(t),r,e.sym(r)),a();else if(i===n.H)ye(O.parseXML(t,{contentType:n.H}),e,r),a();else if(i===n.lc)ye(O.parseXML(t,{contentType:n.lc}),e,r),a();else if(i===n.K9||i===n.Fn)me(t,e,r),a();else if(i===n.i2)Nt(t,e,r).then(a).catch(c);else{if(i!==n._0&&i!==n.BR)throw void 0===i?new Error("contentType is undefined"):new Error("Don't know how to parse "+i+" yet");var o=new ue({factory:Tt});!function(t,r){try{o.parse(r,u)}catch(t){s(t,e)}}(null,t)}}catch(t){c(t)}function a(){s&&s(null,e)}function c(t){if(i!==n.i2||i!==n._0||i!==n.BR){if(!s){let e=new Error(t+" while trying to parse <"+r+"> as "+i);throw e.cause=t,e}s(t,e)}}function u(t,r){r?e.add(r.subject,r.predicate,r.object,r.graph):s(t,e)}be.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,t.A)(ge,"ns",{RDF:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",RDFS:"http://www.w3.org/2000/01/rdf-schema#"}),(0,t.A)(ge,"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 we=a(1147),ve=a.n(we),xe=a(362),_e=a(6357);const Ae={"text/n3":!0,"text/turtle":!0,"application/rdf+xml":!0,"application/xhtml+xml":!0,"text/html":!0,"application/ld+json":!0},Te={rdf:n.JG,owl:n.JG,n3:"text/n3",ttl:"text/turtle",nt:"text/n3",acl:"text/n3",html:"text/html",xml:"text/xml"},Ee=t=>({link:N("http://www.w3.org/2007/ont/link#",t),http:N("http://www.w3.org/2007/ont/http#",t),httph:N("http://www.w3.org/2007/ont/httph#",t),rdf:N("http://www.w3.org/1999/02/22-rdf-syntax-ns#",t),rdfs:N("http://www.w3.org/2000/01/rdf-schema#",t),dc:N("http://purl.org/dc/elements/1.1/",t),ldp:N("http://www.w3.org/ns/ldp#",t)}),Ne=Ee();class Oe{constructor(e,r){(0,t.A)(this,"response",void 0),(0,t.A)(this,"dom",void 0),this.response=e,this.dom=r}}(0,t.A)(Oe,"pattern",void 0);class je extends Oe{static toString(){return"RDFXMLHandler"}static register(t){t.mediatypes[n.JG]={q:.9}}parse(t,e,r){let n=t.store;if(this.dom||(this.dom=O.parseXML(e)),"parsererror"===this.dom.documentElement.nodeName)return t.failFetch(r,"Badly formed XML in "+r.resource.value,"parse_error");let i=new ge(n);try{i.parse(this.dom,r.original.value,r.original)}catch(e){return t.failFetch(r,"Syntax error parsing RDF/XML! "+e,"parse_error")}return r.noMeta||n.add(r.original,Ne.rdf("type"),Ne.link("RDFDocument"),t.appNode),t.doneFetch(r,this.response)}}je.pattern=new RegExp("application/rdf\\+xml");class Se extends Oe{static toString(){return"XHTMLHandler"}static register(t){t.mediatypes[n.H]={q:.8}}parse(t,e,r){let n,i;this.dom||(this.dom=O.parseXML(e));let s=t.store,o=this.dom.getElementsByTagName("title");o.length>0&&s.add(r.resource,Ne.dc("title"),s.rdfFactory.literal(o[0].textContent),r.resource);let a=this.dom.getElementsByTagName("link");for(let e=a.length-1;e>=0;e--)n=a[e].getAttribute("rel"),i=!1,n||(n=a[e].getAttribute("rev"),i=!0),n&&t.linkData(r.original,n,a[e].getAttribute("href"),r.resource,i);let c=this.dom.getElementsByTagName("script");for(let t=0;t<c.length;t++){let e=c[t].getAttribute("type");Ae[e]&&(be(c[t].textContent,s,r.original.value,e),be(c[t].textContent,s,r.original.value,e))}if(r.noMeta||s.add(r.resource,Ne.rdf("type"),Ne.link("WebPage"),t.appNode),!r.noRDFa&&ye)try{ye(this.dom,s,r.original.value)}catch(e){let n="Error trying to parse "+r.resource+" as RDFa:\n"+e+":\n"+e.stack;return t.failFetch(r,n,"parse_error")}return t.doneFetch(r,this.response)}}Se.pattern=new RegExp("application/xhtml");class Re extends Oe{static toString(){return"XMLHandler"}static register(t){t.mediatypes["text/xml"]={q:.5},t.mediatypes["application/xml"]={q:.5}}static isElement(t){return t.nodeType===Node.ELEMENT_NODE}parse(t,e,r){let n=O.parseXML(e);for(let i=0;i<n.childNodes.length;i++){const s=n.childNodes[i];if(Re.isElement(s)){let i=s.namespaceURI;if(i&&i===i.rdf)return t.addStatus(r.req,"Has XML root element in the RDF namespace, so assume RDF/XML."),new je(this.response,n).parse(t,e,r);break}}if(n.doctype&&"html"===n.doctype.name&&n.doctype.publicId.match(/^-\/\/W3C\/\/DTD XHTML/)&&n.doctype.systemId.match(/http:\/\/www.w3.org\/TR\/xhtml/))return t.addStatus(r.req,"Has XHTML DOCTYPE. Switching to XHTML Handler.\n"),new Se(this.response,n).parse(t,e,r);let i=n.getElementsByTagName("html")[0];if(i){let s=i.getAttribute("xmlns");if(s&&s.match(/^http:\/\/www.w3.org\/1999\/xhtml/))return t.addStatus(r.req,"Has a default namespace for XHTML. Switching to XHTMLHandler.\n"),new Se(this.response,n).parse(t,e,r)}return t.failFetch(r,"Unsupported dialect of XML: not RDF or XHTML namespace, etc.\n"+e.slice(0,80),901)}}Re.pattern=new RegExp("(text|application)/(.*)xml");class ke extends Oe{static toString(){return"HTMLHandler"}static register(t){t.mediatypes["text/html"]={q:.8}}parse(t,e,r){let n=t.store;if(Ue(e))return t.addStatus(r.req,"Has an XML declaration. We'll assume it's XHTML as the content-type was text/html.\n"),new Se(this.response).parse(t,e,r);if(function(t){const e=t.indexOf("<!DOCTYPE html"),r=t.indexOf(">");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 Se(this.response).parse(t,e,r);if(function(t){return!!t.match(/[^(<html)]*<html\s+[^<]*xmlns=['"]http:\/\/www.w3.org\/1999\/xhtml["'][^<]*>/)}(e))return t.addStatus(r.req,"Has default namespace for XHTML, so switching to XHTMLHandler.\n"),new Se(this.response).parse(t,e,r);let i=new RegExp("<title>([\\s\\S]+?)</title>","im").exec(e);return i&&n.add(r.resource,Ne.dc("title"),n.rdfFactory.literal(i[1]),r.resource),n.add(r.resource,Ne.rdf("type"),Ne.link("WebPage"),t.appNode),t.addStatus(r.req,"non-XML HTML document, not parsed for data."),t.doneFetch(r,this.response)}}ke.pattern=new RegExp("text/html");class Ie extends Oe{static toString(){return"JsonLdHandler"}static register(t){t.mediatypes["application/ld+json"]={q:.9}}async parse(t,e,r,n){const i=t.store;try{return await Nt(e,i,r.original.value),t.store.add(r.original,Ne.rdf("type"),Ne.link("RDFDocument"),t.appNode),t.doneFetch(r,n)}catch(e){const i="Error trying to parse "+r.resource+" as JSON-LD:\n"+e;return t.failFetch(r,i,"parse_error",n)}}}Ie.pattern=/application\/(ld\+json|activity\+json)/;class Ce extends Oe{static toString(){return"TextHandler"}static register(t){t.mediatypes["text/plain"]={q:.5}}parse(t,e,r){return Ue(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 Re(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 Re(this.response).parse(t,e,r)):(t.addStatus(r.req,"Plain text document, no known RDF semantics."),t.doneFetch(r,this.response))}}Ce.pattern=new RegExp("text/plain");class Pe extends Oe{static toString(){return"N3Handler"}static register(t){t.mediatypes["text/n3"]={},t.mediatypes["text/turtle"]={}}parse(t,e,r,n){let i=t.store,s=vt(i,i,r.original.value,r.original.value,null,null,"",null);try{s.loadBuf(e)}catch(e){let i="Error trying to parse "+r.resource+" as Notation3:\n"+e;return t.failFetch(r,i,"parse_error",n)}return t.addStatus(r.req,"N3 parsed: "+s.statementCount+" triples in "+s.lines+" lines."),t.store.add(r.original,Ne.rdf("type"),Ne.link("RDFDocument"),t.appNode),t.doneFetch(r,this.response)}}Pe.pattern=new RegExp("(application|text)/(x-)?(rdf\\+)?(n3|turtle)");const Fe={RDFXMLHandler:je,XHTMLHandler:Se,XMLHandler:Re,HTMLHandler:ke,TextHandler:Ce,N3Handler:Pe,JsonLdHandler:Ie};function Ue(t){return!!t.match(/\s*<\?xml\s+version\s*=[^<>]+\?>/)}class De{constructor(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((0,t.A)(this,"store",void 0),(0,t.A)(this,"timeout",void 0),(0,t.A)(this,"_fetch",void 0),(0,t.A)(this,"mediatypes",void 0),(0,t.A)(this,"appNode",void 0),(0,t.A)(this,"requested",void 0),(0,t.A)(this,"timeouts",void 0),(0,t.A)(this,"redirectedTo",void 0),(0,t.A)(this,"fetchQueue",void 0),(0,t.A)(this,"fetchCallbacks",void 0),(0,t.A)(this,"nonexistent",void 0),(0,t.A)(this,"lookedUp",void 0),(0,t.A)(this,"handlers",void 0),(0,t.A)(this,"ns",void 0),(0,t.A)(this,"fireCallbacks",void 0),this.store=e||new J,this.ns=Ee(this.store.rdfFactory),this.timeout=r.timeout||3e4,this._fetch=r.fetch||void 0!==a.g&&(a.g.solidFetcher||a.g.solidFetch)||"undefined"!=typeof window&&(window.solidFetcher||window.solidFetch)||ve(),!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}},O.callbackify(this,["request","fail","refresh","retract","done"]),Object.keys(r.handlers||Fe).map((t=>this.addHandler(Fe[t])))}static crossSiteProxy(t){return De.crossSiteProxyTemplate?De.crossSiteProxyTemplate.replace("{uri}",encodeURIComponent(t)):void 0}static offlineOverride(t){let e=t;var r;return"undefined"!=typeof window&&window.panes&&(r=window.panes.UI)&&r.preferences&&r.preferences.get("offlineModeUsingLocalhost")&&"http://"===e.slice(0,7)&&"localhost/"!==e.slice(7,17)&&(e="http://localhost/"+e.slice(7),E.A.warn("Localhost kludge for offline use: actually getting <"+e+">")),e}static proxyIfNecessary(t){var e;if("undefined"!=typeof window&&window.panes&&(e=window.panes.UI)&&e.isExtension)return t;if("undefined"!=typeof $SolidTestEnvironment&&$SolidTestEnvironment.localSiteMap){let e=t.split("/").slice(2);const r=(t,e)=>{let n=e[t.shift()];return n?"string"==typeof n?n+t.join("/"):t?r(t,n):null:null},n=r(e,$SolidTestEnvironment.localSiteMap);if(n)return n}return De.crossSiteProxyTemplate&&"undefined"!=typeof document&&document.location&&"https:"===(""+document.location).slice(0,6)&&"http:"===t.slice(0,5)?De.crossSiteProxyTemplate.replace("{uri}",encodeURIComponent(t)):t}static unsupportedProtocol(t){let e=w.protocol(t);return"tel"===e||"mailto"===e||"urn"===e}static setCredentials(t){let 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")}load(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e=Object.assign({},e),t instanceof Array)return Promise.all(t.map((t=>this.load(t,Object.assign({},e)))));const r=t;let n=(0,xe.E)(r);n=n.split("#")[0],e=this.initFetchOptions(n,e);const i=this.appNode,s=this.store,o=s.statementsMatching(void 0,this.ns.link("requestedURI"),s.sym(n),i).map((t=>t.subject));for(const t of o){const r=s.any(t,this.ns.link("response"),null,i);if(null!=r){const t=s.statementsMatching(r,this.ns.link("outOfDate"),!0,i);s.remove(t),e.force=!0,e.clearPreviousData=!0}}const a=this.initFetchOptions(n,e);return this.pendingFetchPromise(n,a.baseURI,a)}async pendingFetchPromise(t,e,r){let n;return!r.force&&await this.fetchQueue[e]?n=this.fetchQueue[e]:(n=Promise.race([this.setRequestTimeout(t,r),this.fetchUri(t,r)]),this.fetchQueue[e]=n,this.cleanupFetchRequest(e,void 0,this.timeout)),n.then((e=>(t in this.timeouts&&(this.timeouts[t].forEach(clearTimeout),delete this.timeouts[t]),e)))}cleanupFetchRequest(t,e,r){void 0!==e&&_e.warn("_options is deprecated"),this.timeouts[t]=(this.timeouts[t]||[]).concat(setTimeout((()=>{this.isPending(t)||delete this.fetchQueue[t]}),r))}initFetchOptions(t,e){let r=this.store;!e.method||"GET"===e.method.toUpperCase()||(e.force=!0),e.resource=r.rdfFactory.namedNode(t),e.baseURI=e.baseURI||t,e.original=r.rdfFactory.namedNode(e.baseURI),e.req=r.bnode(),e.headers=e.headers||{},e.contentType&&(e.headers["content-type"]=e.contentType),e.force&&(e.cache="no-cache");let n=this.acceptString();e.headers.accept=n;let i=De.offlineOverride(t);e.requestedURI=i,De.setCredentials(i,e);let s=De.proxyIfNecessary(i);return i!==s&&(e.proxyUsed=!0),e.actualProxyURI=s,e}fetchUri(t,e){if(!t)return Promise.reject(new Error("Cannot fetch an empty uri"));if(De.unsupportedProtocol(t))return this.failFetch(e,"fetcher: Unsupported protocol","unsupported_protocol");let r=this.getState(t);if(e.force)delete this.nonexistent[t];else{if("fetched"===r)return Promise.resolve(this.doneFetch(e,{status:200,ok:!0,statusText:"Already loaded into quadstore."}));if("failed"===r&&404===this.requested[t]){let r="Previously failed: "+this.requested[t],n={url:t,status:this.requested[t],statusText:r,responseText:r,headers:new we.Headers,ok:!1,body:null,bodyUsed:!1,size:0,timeout:0};return this.failFetch(e,r,this.requested[t],n)}}this.fireCallbacks("request",[t]),this.requested[t]=!0,e.noMeta||this.saveRequestMetadata(t,e);let{actualProxyURI:n}=e;return this._fetch(n,e).then((r=>this.handleResponse(r,t,e)),(r=>{let i={url:n,status:999,statusText:(r.name||"network failure")+": "+(r.errno||r.code||r.type),responseText:r.message,headers:new we.Headers,ok:!1,body:null,bodyUsed:!1,size:0,timeout:0};return this.handleError(i,t,e)}))}nowOrWhenFetched(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const i=(0,xe.E)(t);"function"==typeof e?r=e:void 0===e||((0,o.Y2)(e)?n.referringTerm=e:n=e),this.load(i,n).then((t=>{if(r)if(t)if(t.ok)r(!0,"OK",t);else{let 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)}))}addStatus(t,e){let r=new Date;e="["+r.getHours()+":"+r.getMinutes()+":"+r.getSeconds()+"."+r.getMilliseconds()+"] "+e;let n=this.store;const i=n.the(t,this.ns.link("status"));(0,o.P3)(i)?i.append(n.rdfFactory.literal(e)):E.A.warn("web.js: No list to add to: "+i+","+e)}failFetch(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));let i=(t.method||"GET").toUpperCase();("GET"===i||"HEAD"===i)&&(t.resource.equals(t.original),this.requested[w.docpart(t.original.value)]=r,this.fireCallbacks("fail",[t.original.value,e]));var s=new Error("Fetcher: "+e);return s.status=r,s.statusText=e,s.response=n,Promise.reject(s)}linkData(t,e,r,n,i){if(!r)return;let s,o=this.store,a=o.rdfFactory.namedNode(w.join(r,t.value));if("alternate"===e||"seeAlso"===e||"meta"===e||"describedby"===e){if(a.value===t.value)return;s=this.ns.rdfs("seeAlso")}else s="type"===e?o.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"):o.rdfFactory.namedNode(w.join(encodeURIComponent(e),"http://www.iana.org/assignments/link-relations/"));i?o.add(a,s,t,n):o.add(t,s,a,n)}parseLinkHeader(t,e,r){if(!t)return;const n=/[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*"))/g,i=t.match(/<[^>]*>\s*(\s*;\s*[^()<>@,;:"/[\]?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*")))*(,|$)/g);if(null!=i)for(let t=0;t<i.length;t++){let s=i[t].split(">"),o=s[0].substring(1),a=s[1].match(n);if(null==a)return;for(let t=0;t<a.length;t++){let n=a[t].split("=")[1].replace(/["']/g,"");this.linkData(e,n,o,r)}}}doneFetch(t,e){return this.addStatus(t.req,"Done."),this.requested[t.original.value]="done",this.fireCallbacks("done",[t.original.value]),e.req=t.req,e}nowKnownAs(t,e){this.lookedUp[t.value]?this.lookedUp[e.value]||this.lookUpThing(e,t):this.lookedUp[e.value]&&(this.lookedUp[t.value]||this.lookUpThing(t,e))}putBack(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=(0,xe.E)(t);let i=new s.A(r).doc();return e.contentType=e["content-type"]||e["Content-Type"]||e.contentType||n.sT,"application/ld+json"===e.contentType?new Promise(((r,n)=>{F(i,this.store,i.uri,e.contentType,((i,s)=>{i?n(i):(e.data=s,this.webOperation("PUT",t,e).then((t=>r(t))).catch((t=>n(t))))}))})):(e.data=F(i,this.store,i.value,e.contentType),this.webOperation("PUT",r,e))}webCopy(t,e,r){return this.webOperation("GET",t).then((t=>this.webOperation("PUT",e,{data:t.responseText,contentType:r})))}delete(t,e){return this.webOperation("DELETE",t,e).then((e=>(this.requested[t]=404,this.nonexistent[t]=!0,this.unload(this.store.rdfFactory.namedNode(t)),e)))}async createIfNotExists(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.sT,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const i=this;try{var s=await i.load(t)}catch(n){if(404===n.response.status){try{s=await i.webOperation("PUT",t.value,{data:r,contentType:e})}catch(t){throw t}return delete i.requested[t.value],s}throw n}return s}createContainer(t,e,r){let i={"content-type":n.sT,link:this.ns.ldp("BasicContainer")+'; rel="type"'};e&&(i.slug=e);let s={headers:i};return r&&(s.body=r),this.webOperation("POST",t,s)}invalidateCache(t){const e=(0,xe.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]){let t=`Rdflib: fetcher: Destructive operation on <${r.requested[e]}> file being fetched! `+e;_e.error(t)}else delete r.requested[e],delete r.nonexistent[e]}webOperation(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=(0,xe.E)(e);r.method=t,r.body=r.data||r.body,r.force=!0;const i=this;if(r.body&&!r.contentType)throw new Error("Web operation sending data must have a defined contentType.");return r.contentType&&(r.headers=r.headers||{},r.headers["content-type"]=r.contentType),De.setCredentials(n,r),new Promise((function(e,s){i._fetch(n,r).then((r=>{if(r.ok)"PUT"!==t&&"PATCH"!==t&&"POST"!==t&&"DELETE"!==t||i.invalidateCache(n),r.text?r.text().then((t=>{r.responseText=t,e(r)})):e(r);else{let e="Web error: "+r.status;r.statusText&&(e+=" ("+r.statusText+")"),e+=" on "+t+" of <"+n+">",r.responseText&&(e+=": "+r.responseText);let i=new Error(e);i.response=r,s(i)}}),(e=>{s(new Error("Fetch error for "+t+" of <"+n+">:"+e))}))}))}lookUpThing(t,e){let r=this.store.uris(t);return r=r.map((t=>w.docpart(t))),r.forEach((t=>{this.lookedUp[t]=!0})),this.load(r,{referringTerm:e})}getHeader(t,e){const r=this.store,n=t.value,i=r.each(void 0,this.ns.link("requestedURI"),r.rdfFactory.literal(n));for(let t=0;t<i.length;t++){let n=i[t];if(void 0!==n){let t=r.any(n,this.ns.link("response"));if(void 0!==t&&r.anyValue(t,this.ns.http("status"))&&r.anyValue(t,this.ns.http("status")).startsWith("2")){let n=r.each(t,this.ns.httph(e.toLowerCase()));return n.length?n.map((t=>t.value)):[]}}}}saveRequestMetadata(t,e){let r=e.req,n=this.store,i=e.referringTerm;this.addStatus(e.req,"Accept: "+e.headers.accept),(0,o.Y2)(i)&&n.add(n.rdfFactory.namedNode(t),this.ns.link("requestedBy"),i,this.appNode),e.original&&e.original.value!==t&&n.add(r,this.ns.link("orginalURI"),n.rdfFactory.literal(e.original.value),this.appNode);const s=new Date,a="["+s.getHours()+":"+s.getMinutes()+":"+s.getSeconds()+"] ";n.add(r,this.ns.rdfs("label"),n.rdfFactory.literal(a+" Request for "+t),this.appNode),n.add(r,this.ns.link("requestedURI"),n.rdfFactory.literal(t),this.appNode),n.add(r,this.ns.link("status"),n.collection(),this.appNode)}saveResponseMetadata(t,e){const r=this.store;let n=r.bnode();return r.add(e.req,this.ns.link("response"),n,this.appNode),r.add(n,this.ns.http("status"),r.rdfFactory.literal(t.status),this.appNode),r.add(n,this.ns.http("statusText"),r.rdfFactory.literal(t.statusText),this.appNode),t.headers.forEach(((t,i)=>{r.add(n,this.ns.httph(i),this.store.rdfFactory.literal(t),this.appNode),"content-type"===i&&r.add(e.resource,this.ns.rdf("type"),r.rdfFactory.namedNode(O.mediaTypeClass(t).value),this.appNode)})),n}objectRefresh(t){let e=this.store.uris(t);if(void 0!==e)for(let t=0;t<e.length;t++)this.refresh(this.store.rdfFactory.namedNode(w.docpart(e[t])))}refresh(t,e){this.fireCallbacks("refresh",arguments),this.nowOrWhenFetched(t,{force:!0,clearPreviousData:!0},e)}refreshIfExpired(t,e){let r=this.getHeader(t,"Expires");!r||new Date(r[0]).getTime()<=(new Date).getTime()?this.refresh(t,e):e(!0,"Not expired",{})}retract(t){this.store.removeMany(void 0,void 0,void 0,t),t.value&&delete this.requested[w.docpart(t.value)],this.fireCallbacks("retract",arguments)}getState(t){return void 0===this.requested[t]?"unrequested":!0===this.requested[t]?"requested":"done"===this.requested[t]?"fetched":"redirected"===this.requested[t]?this.getState(this.redirectedTo[t]):"failed"}isPending(t){return!0===this.requested[t]}unload(t){this.store.removeDocument(t),delete this.requested[t.value]}addHandler(t){this.handlers.push(t),t.register(this)}retryNoCredentials(t,e){e.retriedWithNoCredentials=!0,delete this.requested[t],delete this.fetchQueue[t];let r=Object.assign({},e,{credentials:"omit"});return this.addStatus(e.req,"Abort: Will retry with credentials SUPPRESSED to see if that helps"),this.load(t,r)}isCrossSite(t){if("undefined"==typeof document||!document.location)return!1;const e=w.hostpart,r=""+document.location;return(e(r)&&e(t)&&e(r))!==e(t)}handleError(t,e,r){if(this.isCrossSite(e)){if(r.credentials&&"include"===r.credentials&&!r.retriedWithNoCredentials)return this.retryNoCredentials(e,r);let t=De.crossSiteProxy(e);if(t&&!r.proxyUsed)return this.redirectToProxy(t,r)}var n;return t instanceof Error?n="Fetch error: "+t.message:(n=t.statusText,t.responseText&&(n+=` ${t.responseText}`)),this.failFetch(r,n,t.status||998,t)}addType(t,e,r,n){let i=e;if(n){var s=r.any(i,this.ns.link("requestedURI"));s&&s.value!==n&&r.add(r.rdfFactory.namedNode(n),this.ns.rdf("type"),t,this.appNode)}for(;;){const e=r.any(i,this.ns.link("requestedURI"));if(e&&e.value&&r.add(r.rdfFactory.namedNode(e.value),this.ns.rdf("type"),t,this.appNode),i=r.any(void 0,r.rdfFactory.namedNode("http://www.w3.org/2007/ont/link#redirectedRequest"),i),!i)break;var o=r.any(i,r.rdfFactory.namedNode("http://www.w3.org/2007/ont/link#response"));if(!o)break;var a=r.any(o,r.rdfFactory.namedNode("http://www.w3.org/2007/ont/http#status"));if(!a)break;if("301"!==a&&"302"!==a)break}}handleResponse(t,e,r){const n=this.store,i=t.headers,s=r.req,o=this.saveResponseMetadata(t,r),a=this.normalizedContentType(r,i)||"";let c=i.get("content-location");if(0===t.status)return this.handleError(t,e,r);if(t.status>=400)return 404===t.status&&(this.nonexistent[r.original.value]=!0,this.nonexistent[e]=!0),this.saveErrorResponse(t,o).then((()=>{let e=r.resource+" "+t.statusText;return this.failFetch(r,e,t.status,t)}));var u=null,l=null;if(c&&(l=w.join(c,e))!==e&&(u=l),200===t.status){if(this.addType(this.ns.link("Document"),s,n,e),u&&this.addType(this.ns.link("Document"),s,n,u),r.clearPreviousData){const t=n.statementsMatching(void 0,void 0,void 0,r.resource).slice();for(let e=0;e<t.length;e++)n.removeStatement(t[e])}let t=a.includes("image/")||a.includes("application/pdf");a&&t&&(this.addType(n.rdfFactory.namedNode("http://purl.org/dc/terms/Image"),s,n,e),u&&this.addType(n.rdfFactory.namedNode("http://purl.org/dc/terms/Image"),s,n,u))}if(c){if(!r.force&&u&&"done"===this.requested[l])return this.doneFetch(r,t);this.requested[l]=!0}this.parseLinkHeader(i.get("link"),r.original,s);let h=this.handlerForContentType(a,t);return h?t.text().then((e=>(t.responseText=e,h.parse(this,e,r,t)))):(this.addStatus(s,"Fetch over. No data handled."),this.doneFetch(r,t))}saveErrorResponse(t,e){let r=this.store;return t.text().then((t=>{t.length>10&&r.add(e,this.ns.http("content"),r.rdfFactory.literal(t),e)}))}handlerForContentType(t,e){if(!t)return null;let r=this.handlers.find((e=>t.match(e.pattern)));return r?new r(e):null}guessContentType(t){return Te[t.split(".").pop()]}normalizedContentType(t,e){if(t.forceContentType)return t.forceContentType;let r=e.get("content-type");if(!r||r.includes("application/octet-stream")){let e=this.guessContentType(t.resource.value);if(e)return e}let n=w.protocol(t.resource.value);return!r&&["file","chrome"].includes(n)?"text/xml":r}redirectToProxy(t,e){this.addStatus(e.req,"BLOCKED -> Cross-site Proxy to <"+t+">"),e.proxyUsed=!0;const r=this.store,n=e.req;e.noMeta||(r.add(n,this.ns.link("redirectedTo"),r.rdfFactory.namedNode(t),n),this.addStatus(n,"redirected to new request")),this.requested[e.resource.value]="redirected",this.redirectedTo[e.resource.value]=t;let i=Object.assign({},e);return i.baseURI=e.resource.value,this.fetchUri(t,i).then((t=>(i.noMeta||r.add(n,this.ns.link("redirectedRequest"),i.req,this.appNode),t)))}setRequestTimeout(t,e){return new Promise((r=>{this.timeouts[t]=(this.timeouts[t]||[]).concat(setTimeout((()=>{!this.isPending(t)||e.retriedWithNoCredentials||e.proxyUsed||r(this.failFetch(e,`Request to ${t} timed out`,"timeout"))}),this.timeout))}))}addFetchCallback(t,e){this.fetchCallbacks[t]?this.fetchCallbacks[t].push(e):this.fetchCallbacks[t]=[e]}acceptString(){let t="";for(let e in this.mediatypes){""!==t&&(t+=", "),t+=e;for(let r in this.mediatypes[e])t+=";"+r+"="+this.mediatypes[e][r]}return t}}(0,t.A)(De,"HANDLERS",void 0),(0,t.A)(De,"CONTENT_TYPE_BY_EXT",void 0),(0,t.A)(De,"crossSiteProxyTemplate",void 0),De.HANDLERS=Fe,De.CONTENT_TYPE_BY_EXT=Te;const Me={parseJSON:function(t,e,r){var n,i,s,o={},a=r.sym(e);for(var c in t){0===c.indexOf("_:")?o[c]?n=o[c]:(n=r.bnode(c),o[c]=n):n=r.sym(c);var u=t[c];for(var l in u){var h=u[l];for(var f in i=r.sym(l),h){var p=h[f];if("uri"===p.type)s=r.sym(p.value),r.add(n,i,s,a);else if("BlankNode"===p.type)o[p.value]?s=o[p.value]:(s=r.bnode(p.value),o[p.value]=s),r.add(n,i,s,a);else{if("Literal"!==p.type)throw new Error("error: unexpected termtype: "+f.type);s=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,s,a)}}}}}};function Le(t){var e=0;function r(t){var e="",r=t.statements;for(var n in r)E.A.debug("Found statement: "+r),e+=o()+r[n]+"\n";return e}function n(t){var e="";for(var r in t.constraints){var n=t.constraints[r];e+=o()+"FILTER ( "+n.describe(r)+" ) \n"}return e}function i(t){for(var s="",a=0;a<t.optional.length;a++)E.A.debug("Found optional query"),s+=o()+"OPTIONAL { \n",e++,s+=r(t.optional[a]),s+=n(t.optional[a]),s+=i(t.optional[a]),e--,s+=o()+"}\n";return s}function s(t){var s=o()+"WHERE \n{ \n";return e++,s+=r(t),s+=n(t),s+=i(t),e--,s+"}"}function o(){for(var t="",r=0;r<e;r++)t+=" ";return t}return function(t){return function(t){for(var e=o()+"SELECT ",r=0;r<t.vars.length;r++)e+=t.vars[r]+" ";return e+"\n"}(t)+s(t.pat)}(t)}function Be(t,e,r){var n=[];function i(t){if(n[t])return n[t];var e=r.variable(t);return n[t]=e,e}function s(t){return"string"==typeof t&&t.match(/[^ \n\t]/)}function o(t){return"string"==typeof t&&t.match(/^[\?\$]/)}function a(t){return"string"==typeof t?t.replace(/^</,"<").replace(/>$/,">"):t}function c(t){return"string"==typeof t&&t.match(/^<[^>]*>$/)}function u(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 c(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 s,o,a=new Array(2);if(!e||n&&n<e)s='"',o=n;else{if(n&&!(e&&e<n))return E.A.error("SQARQL QUERY OOPS!"),a;s="'",o=e}a[0]=t.slice(0,o);var c,u=t.slice(o+1).indexOf(s);return-1===u?(E.A.error("SPARQL parsing error: no matching parentheses in literal "+t),t):(t.slice(u+o+2).match(/^\^\^/)?(c=t.slice(u+o+2).indexOf(" "),a[1]=r.literal(t.slice(o+1,o+1+u),r.sym(d(t.slice(o+4+u,o+2+u+c)))),a=a.concat(y(t.slice(u+o+3+c)))):t.slice(u+o+2).match(/^@/)?(c=t.slice(u+o+2).indexOf(" "),a[1]=r.literal(t.slice(o+1,o+1+u),t.slice(o+3+u,o+2+u+c),null),a=a.concat(y(t.slice(u+o+2+c)))):(a[1]=r.literal(t.slice(o+1,o+1+u)),E.A.info("Literal found: "+a[1]),a=a.concat(y(t.slice(u+o+2)))),a)}function g(t){t=t.replace(/\(/g," ( ").replace(/\)/g," ) ").replace(/</g," <").replace(/>/g,"> ").replace(/{/g," { ").replace(/}/g," } ").replace(/[\t\n\r]/g," ").replace(/; /g," ; ").replace(/\. /g," . ").replace(/, /g," , "),E.A.info("New str into spaceDelimit: \n"+t);var e=[],r=t.split(" ");for(var n in r)s(r[n])&&(e=e.concat(r[n]));return e}function m(t,e){for(var r=0;r<e.length;r++)if("string"==typeof e[r]&&e[r].toLowerCase()===t.toLowerCase())return r;return null}function b(t,e){for(var r=[],n=0;n<e.length;n++)"string"==typeof e[n]&&e[n].toLowerCase()===t.toLowerCase()&&r.push(n);return r}function w(t,e,r){E.A.info("Looking for a close bracket of type "+r+" in "+t);for(var n=0,i=0;i<t.length;i++)if(t[i]===e&&n++,t[i]===r&&n--,n<0)return i;return E.A.error("Statement had no close parenthesis in SPARQL query"),0}function v(t){return this.describe=function(e){return e+" = "+t.toNT()},this.test=function(e){return t.equals(e)},this}function x(t){this.describe=function(e){return"REGEXP( '"+t+"' , "+e+" )"},this.test=function(e){var r=new RegExp(t);return!!e.value&&r.test(e.value)}}function _(t,e){3!==t.length||"Variable"!==t[0].termType||"NamedNode"!==t[2].termType&&"Literal"!==t[2].termType?6===t.length&&"string"==typeof t[0]&&"regexp"===t[0].toLowerCase()&&"("===t[1]&&")"===t[5]&&","===t[3]&&"Variable"===t[4].termType&&"Literal"===t[2].termType&&(E.A.debug("Constraint added: "+t),e.constraints[t[4]]=new x(t[2].value)):"="===t[1]||">"===t[1]||"<"===t[1]?(E.A.debug("Constraint added: "+t),e.constraints[t[0]]=new v(t[2])):E.A.warn("I don't know how to handle the constraint: "+t)}function A(t,e){E.A.debug("Optional query: "+t+" not yet implemented.");var n=r.formula();T(t,n),e.optional.push(n)}function T(t,e){var n,s,l=function(t){for(var e=[],n=0;n<t.length;n++)"string"==typeof t[n]?(t[n]=a(t[n]),o(t[n])?e[n]=i(t[n].slice(1)):u(t[n])?(E.A.info(t[n]+" was identified as a bnode."),e[n]=r.bnode()):c(t[n])?(E.A.info(t[n]+" was identified as a symbol."),e[n]=r.sym(d(t[n]))):h(t[n])?(E.A.info(t[n]+" was identified as a prefixed symbol"),j[f(t[n])]?e[n]=r.sym(t[n]=j[f(t[n])]+p(t[n])):(E.A.error("SPARQL error: "+t[n]+" with prefix "+f(t[n])+" does not have a correct prefix entry."),e[n]=t[n])):e[n]=t[n]):e[n]=t[n];return e}(t);for(E.A.debug("WHERE: "+l);m("OPTIONAL",l);)s=m("OPTIONAL",l),E.A.debug("OPT: "+s+" "+l[s]+" in "+l),"{"!==l[s+1]&&E.A.warn("Bad optional opening bracket in word "+s),-1===(n=w(l.slice(s+2),"{","}"))?E.A.error("No matching bracket in word "+s):(A(l.slice(s+2,s+2+n),e),s=m("OPTIONAL",l),n=w(l.slice(s+2),"{","}"),l.splice(s,n+3));for(E.A.debug("WHERE after optionals: "+l);m("FILTER",l);){var y=m("FILTER",l);"("!==l[y+1]&&E.A.warn("Bad filter opening bracket in word "+y),-1===(n=w(l.slice(y+2),"(",")"))?E.A.error("No matching bracket in word "+y):(_(l.slice(y+2,y+2+n),e),y=m("FILTER",l),n=w(l.slice(y+2),"(",")"),l.splice(y,n+3))}E.A.debug("WHERE after filters and optionals: "+l),function(t,e){var r=new Array(1);r[0]=-1;for(var n=r.concat(b(".",t)),i=[],s=0;s<n.length-1;s++)i[s]=t.slice(n[s]+1,n[s+1]);for(s in i){E.A.info("s+p+o "+s+" = "+i[s]);var o=i[s][0];i[s].splice(0,1);var a=r.concat(b(";",i[s]));a.push(i[s].length);for(var c=[],u=0;u<a.length-1;u++)c[u]=i[s].slice(a[u]+1,a[u+1]);for(s in c){E.A.info("p+o "+s+" = "+i[s]);var l=c[s][0];c[s].splice(0,1);var h=r.concat(b(",",c[s]));h.push(c[s].length);var f=[];for(u=0;u<h.length-1;u++)f[u]=c[s].slice(h[u]+1,h[u+1]);for(s in f){var p=f[s][0];E.A.info("Subj="+o+" Pred="+l+" Obj="+p),e.add(o,l,p)}}}}(l,e)}E.A.info("SPARQL input: \n"+t);var N=new z,O=function(t){var e=y(t),r=[];for(var n in e)r="string"==typeof e[n]?r.concat(g(e[n])):r.concat(e[n]);return r=function(t){for(var e=t,r=0;r<e.length;r++)if("a"===e[r]&&(e[r]="<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>"),"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),E.A.info("SPARQL Tokens: "+r),r}(t),j=function(t){var e=b("PREFIX",t),r=[];for(var n in e){var i=t[e[n]+1],s=t[e[n]+2];if(l(i))if(c(s)){E.A.info("Prefix found: "+i+" -> "+s);var o=f(i),a=d(s);r[o]=a}else E.A.error("Invalid SPARQL symbol: "+s);else E.A.error("Invalid SPARQL prefix: "+i)}return r}(O);j.rdf||(j.rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"),j.rdfs||(j.rdfs="http://www.w3.org/2000/01/rdf-schema#");var S=m("SELECT",O),R=m("WHERE",O);if(S<0||R<0||S>R)return E.A.error("Invalid or nonexistent SELECT and WHERE tags in SPARQL query"),!1;if(function(t,e){for(var r in E.A.info("SPARQL vars: "+t),t)if(o(t[r])){E.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 E.A.warn("Incorrect SPARQL variable in SELECT: "+t[r])}(O.slice(S+1,R),N),T(O.slice(R+2,O.length-1),N.pat),e)return N;for(var k in N.pat.statements){var I=N.pat.statements[k];"NamedNode"===I.subject.termType&&r.fetcher&&r.fetcher.lookUpThing(I.subject,"sparql:"+I.subject),"NamedNode"===I.object.termType&&r.fetcher&&r.fetcher.lookUpThing(I.object,"sparql:"+I.object)}return N}class qe{constructor(e){if((0,t.A)(this,"store",void 0),(0,t.A)(this,"ifps",void 0),(0,t.A)(this,"fps",void 0),(0,t.A)(this,"patchControl",void 0),(0,t.A)(this,"ns",void 0),(e=e||new J).updater)throw new Error("You can't have two UpdateManagers for the same store");e.fetcher||(e.fetcher=new De(e)),this.store=e,e.updater=this,this.ifps={},this.fps={},this.ns={},this.ns.link=N("http://www.w3.org/2007/ont/link#"),this.ns.http=N("http://www.w3.org/2007/ont/http#"),this.ns.httph=N("http://www.w3.org/2007/ont/httph#"),this.ns.ldp=N("http://www.w3.org/ns/ldp#"),this.ns.rdf=N("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this.ns.rdfs=N("http://www.w3.org/2000/01/rdf-schema#"),this.ns.rdf=N("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this.ns.owl=N("http://www.w3.org/2002/07/owl#"),this.patchControl=[]}patchControlFor(t){return this.patchControl[t.value]||(this.patchControl[t.value]=[]),this.patchControl[t.value]}isHttpUri(t){return"http"===t.slice(0,4)}flagAuthorizationMetadata(t){t||(t=this.store);const e=t.fetcher?.appNode,r=t.statementsMatching(void 0,this.ns.link("requestedURI"),void 0,e).map((t=>t.subject));for(const n of r){const r=t.any(n,this.ns.link("response"),null,e);null!=r&&t.add(r,this.ns.link("outOfDate"),!0,e)}}async checkEditable(t,e){if(!t)return!1;e||(e=this.store);const r=this.editable(t,e);return void 0!==r?r:(await(e.fetcher?.load(t)),this.editable(t,e))}editable(t,e){if(!t)return!1;if(e||(e=this.store),t=(0,xe.E)(t),!this.isHttpUri(t)&&e.holds(e.rdfFactory.namedNode(t),e.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),e.rdfFactory.namedNode("http://www.w3.org/2007/ont/link#MachineEditableDocument")))return"LOCALFILE";var r,n=!1;const i=e.fetcher?.appNode;for(var s,o=e.each(void 0,this.ns.link("requestedURI"),(0,w.docpart)(t),i),a=0;a<o.length;a++)if(void 0!==(r=o[a])){const o=e.any(r,this.ns.link("response"),null,i);if(void 0!==o){if(e.anyJS(o,this.ns.link("outOfDate"),null,i))continue;var c=e.anyValue(o,this.ns.httph("wac-allow"));if(c)for(var u of c.split(",")){var l=u.split("=");if(l[0].includes("user")&&!l[1].includes("write")&&!l[1].includes("append"))return!1}var h=e.each(o,this.ns.httph("accept-patch"));if(h.length)for(let t=0;t<h.length;t++){if((s=h[t].value.trim()).indexOf("application/sparql-update")>=0)return"SPARQL";if(s.indexOf("application/sparql-update-single-match")>=0)return"SPARQL";if(s.indexOf("text/n3")>=0)return"N3PATCH"}var f=e.each(o,this.ns.httph("ms-author-via"));if(f.length)for(let t=0;t<f.length;t++){if((s=f[t].value.trim()).indexOf("SPARQL")>=0)return"SPARQL";if(s.indexOf("DAV")>=0)return"DAV"}if(!this.isHttpUri(t))return!!c&&"LOCALFILE";var p=e.each(o,this.ns.http("status"));if(p.length)for(let t=0;t<p.length;t++)200!==p[t]&&404!==p[t]||(n=!0)}}if(0===o.length);else if(n)return!1}anonymize(t){return"_:"===t.toNT().substr(0,2)&&this.mentioned(t)?"?"+t.toNT().substr(2):t.toNT()}anonymizeNT(t){return this.anonymize(t.subject)+" "+this.anonymize(t.predicate)+" "+this.anonymize(t.object)+" ."}nTriples(t){return`${t.subject.toNT()} ${t.predicate.toNT()} ${t.object.toNT()} .`}statementBnodes(t){return[t.subject,t.predicate,t.object].filter((function(t){return(0,o.jt)(t)}))}statementArrayBnodes(t){var e=[];for(let r=0;r<t.length;r++)e=e.concat(this.statementBnodes(t[r]));e.sort();var r=[];for(let t=0;t<e.length;t++)0!==t&&e[t].equals(e[t-1])||r.push(e[t]);return r}cacheIfps(){this.ifps={};var t=this.store.each(void 0,this.ns.rdf("type"),this.ns.owl("InverseFunctionalProperty"));for(let e=0;e<t.length;e++)this.ifps[t[e].value]=!0;this.fps={},t=this.store.each(void 0,this.ns.rdf("type"),this.ns.owl("FunctionalProperty"));for(let e=0;e<t.length;e++)this.fps[t[e].value]=!0}bnodeContext2(t,e,r){var n,i,s=this.store.statementsMatching(void 0,void 0,t,e);for(let t=0;t<s.length;t++)if(this.fps[s[t].predicate.value]){if(!(n=s[t].subject).isBlank)return[s[t]];if(r&&(i=this.bnodeContext2(n,e,r-1)))return i.concat([s[t]])}s=this.store.statementsMatching(t,void 0,void 0,e);for(let t=0;t<s.length;t++)if(this.ifps[s[t].predicate.value]){if(!(n=s[t].object).isBlank)return[s[t]];if(r&&(i=this.bnodeContext2(n,e,r-1)))return i.concat([s[t]])}return null}bnodeContext1(t,e){for(var r=0;r<3;r++){var n=this.bnodeContext2(t,e,r);if(null!==n)return n}return this.store.connectedStatements(t,e)}mentioned(t){return 0!==this.store.statementsMatching(t,null,null,null).length||0!==this.store.statementsMatching(null,t).length||0!==this.store.statementsMatching(null,null,t).length}bnodeContext(t,e){var r=[];if(t.length){this.cacheIfps();for(let i=0;i<t.length;i++){var n=t[i];this.mentioned(n)&&(r=r.concat(this.bnodeContext1(n,e)))}}return r}statementContext(t){var e=this.statementBnodes(t);return this.bnodeContext(e,t.graph)}contextWhere(t){var e=this;return t&&0!==t.length?"WHERE { "+t.map((function(t){return e.anonymizeNT(t)})).join("\n")+" }\n":""}fire(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Promise.resolve().then((()=>{if(!t)throw new Error("No URI given for remote editing operation: "+e);return n.noMeta=!0,n.contentType=n.contentType||"application/sparql-update",n.body=e,this.store.fetcher.webOperation("PATCH",t,n)})).then((n=>{if(!n.ok){let r="UpdateManager: update failed for <"+t+"> status="+n.status+", "+n.statusText+"\n for query: "+e;throw new Error(r)}r(t,n.ok,n.responseText,n)})).catch((e=>{r(t,!1,e.message,e)}))}update_statement(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)}}}}insert_statement(t,e){var r=t instanceof Array?t[0]:t,n=this.contextWhere(this.statementContext(r));if(t instanceof Array){var i="";for(let e=0;e<t.length;e++)i+=t[e]+"\n";n+="INSERT DATA { "+i+" }\n"}else n+="INSERT DATA { "+this.anonymize(t.subject)+" "+this.anonymize(t.predicate)+" "+this.anonymize(t.object)+" . }\n";this.fire(r.graph.value,n,e)}delete_statement(t,e){var r=t instanceof Array?t[0]:t,n=this.contextWhere(this.statementContext(r));if(t instanceof Array){var i="";for(let e=0;e<t.length;e++)i+=t[e]+"\n";n+="DELETE DATA { "+i+" }\n"}else n+="DELETE DATA { "+this.anonymize(t.subject)+" "+this.anonymize(t.predicate)+" "+this.anonymize(t.object)+" . }\n";this.fire(r.graph.value,n,e)}requestDownstreamAction(t,e){var r=this.patchControlFor(t);if(r.pendingUpstream)if(r.downstreamAction){if(""+r.downstreamAction!=""+e)throw new Error("Can't wait for > 1 different downstream actions")}else r.downstreamAction=e;else e(t)}clearUpstreamCount(t){this.patchControlFor(t).upstreamCount=0}getUpdatesVia(t){var e=this.store.fetcher.getHeader(t,"updates-via");return e&&e.length?e[0].trim():null}addDownstreamChangeListener(t,e){var r=this.patchControlFor(t);r.downstreamChangeListeners||(r.downstreamChangeListeners=[]),r.downstreamChangeListeners.push(e),this.setRefreshHandler(t,(t=>{this.reloadAndSync(t)}))}reloadAndSync(t){var e=this.patchControlFor(t),r=this;if(e.reloading)e.outOfDate=!0;else{e.reloading=!0;var n=1e3,i=function(){r.reload(r.store,t,(function(t,r,s){if(t){if(e.downstreamChangeListeners)for(let t=0;t<e.downstreamChangeListeners.length;t++)e.downstreamChangeListeners[t]();e.reloading=!1,e.outOfDate&&(e.outOfDate=!1,i())}else e.reloading=!1,s&&0===s.status&&(e.reloading=!0,setTimeout(i,n*=2))}))};i()}}setRefreshHandler(t,e){let r=this.getUpdatesVia(t);var n=e,i=this,s=this,o=1500,a=0;if(!r)return!1;r=(0,w.join)(r,t.value);const c=r.replace(/^http:/,"ws:").replace(/^https:/,"wss:");var u=function(){var e;if("undefined"!=typeof WebSocket)e=new WebSocket(c);else{if("undefined"==typeof window||!window.WebSocket)return;e=window.WebSocket(c)}e.onopen=function(){o=1500,this.send("sub "+t.value),a&&s.requestDownstreamAction(t,n)};var r=i.patchControlFor(t);r.upstreamCount=0,e.onerror=function(t){},e.onclose=function(t){o*=2,a+=1,setTimeout((function(){u()}),o)},e.onmessage=function(e){if(e.data&&"pub"===e.data.slice(0,3)){if("upstreamCount"in r&&(r.upstreamCount-=1,r.upstreamCount>=0))return;r.upstreamCount=0,i.requestDownstreamAction(t,n)}}};return u(),!0}updateMany(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=t.concat(e).map((t=>t.why)),n=this,i=[];r.forEach((t=>{i.find((e=>e.equals(t)))||i.push(t)}));const s=i.map((r=>n.update(t.filter((t=>t.why.equals(r))),e.filter((t=>t.why.equals(r))))));return s.length,Promise.all(s)}constructSparqlUpdateQuery(t,e,r){var n=this.contextWhere(r),i="";if(n.length){if(t.length){i+="DELETE { ";for(let e=0;e<t.length;e++)i+=this.anonymizeNT(t[e])+"\n";i+=" }\n"}if(e.length){i+="INSERT { ";for(let t=0;t<e.length;t++)i+=this.anonymizeNT(e[t])+"\n";i+=" }\n"}i+=n}else{if(t.length){i+="DELETE DATA { ";for(let e=0;e<t.length;e++)i+=this.anonymizeNT(t[e])+"\n";i+=" } \n"}if(e.length){t.length&&(i+=" ; "),i+="INSERT DATA { ";for(let t=0;t<e.length;t++)i+=this.nTriples(e[t])+"\n";i+=" }\n"}}return i}constructN3PatchQuery(t,e,r){var n="\n@prefix solid: <http://www.w3.org/ns/solid/terms#>.\n@prefix ex: <http://www.example.org/terms#>.\n\n_:patch\n";return r&&r.length>0&&(n+=`\n solid:where {\n ${r.map((t=>this.anonymizeNT(t))).join("\n ")}\n };`),t.length>0&&(n+=`\n solid:deletes {\n ${t.map((t=>this.anonymizeNT(t))).join("\n ")}\n };`),e.length>0&&(n+=`\n solid:inserts {\n ${e.map((t=>this.anonymizeNT(t))).join("\n ")}\n };`),n+" a solid:InsertDeletePatch .\n"}update(t,e,r,n){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if(!r){var s=this;return new Promise((function(r,o){s.update(t,e,(function(t,e,n){e?r():o(new Error(n))}),n,i)}))}try{var a=this.store,c=t?(0,o.ok)(t)?t.statements:t instanceof Array?t:[t]:[],u=e?(0,o.ok)(e)?e.statements:e instanceof Array?e:[e]:[];if(!(c instanceof Array))throw new Error("Type Error "+typeof c+": "+c);if(!(u instanceof Array))throw new Error("Type Error "+typeof u+": "+u);if(0===c.length&&0===u.length)return r(null,!0);var l=c.length?c[0].graph:u[0].graph;if(!l){let t="Error patching: statement does not specify which document to patch:"+c[0]+", "+u[0];throw new Error(t)}if("NamedNode"!==l.termType){let t="Error patching: document not a NamedNode:"+c[0]+", "+u[0];throw new Error(t)}var h=this.patchControlFor(l),f=Date.now(),p=["subject","predicate","object","why"],d={delete:c,insert:u};["insert","delete"].map((function(t){d[t].map((function(t){if(!l.equals(t.graph))throw new Error("update: destination "+l+" inconsistent with delete quad "+t.graph);p.map((function(e){if(void 0===t[e])throw new Error("update: undefined "+e+" of statement.")}))}))}));var y=this.editable(l.value,a);if(!1===y)throw new Error("Update: Can't make changes in uneditable "+l);if(void 0===y){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((n=>{this.update(t,e,r,!0,i)}),(n=>{if(404!==n.response.status)throw new Error(`Update: Can't get updatability status ${l} before patching: ${n}`);this.update(t,e,r,!0,i)}))}if(y.indexOf("SPARQL")>=0||y.indexOf("N3PATCH")>=0){var g=y.indexOf("SPARQL")>=0,m=[];c.length&&(m=this.statementArrayBnodes(c)),u.length&&(m=m.concat(this.statementArrayBnodes(u)));var b=this.bnodeContext(m,l),w=g?this.constructSparqlUpdateQuery(c,u,b):this.constructN3PatchQuery(c,u,b);i.contentType=g?"application/sparql-update":"text/n3",h.pendingUpstream=h.pendingUpstream?h.pendingUpstream+1:1,"upstreamCount"in h&&(h.upstreamCount+=1),this.fire(l.value,w,((t,e,n,i)=>{if(i.elapsedTimeMs=Date.now()-f,e){try{a.remove(c)}catch(t){e=!1,n="Remote Ok BUT error deleting "+c.length+" from store!!! "+t}for(let t=0;t<u.length;t++)a.add(u[t].subject,u[t].predicate,u[t].object,l)}if(r(t,e,n,i),h.pendingUpstream-=1,0===h.pendingUpstream&&h.downstreamAction){var s=h.downstreamAction;delete h.downstreamAction,s(l)}}),i)}else if(y.indexOf("DAV")>=0)this.updateDav(l,c,u,r,i);else{if(!(y.indexOf("LOCALFILE")>=0))throw new Error("Unhandled edit method: '"+y+"' for "+l);try{this.updateLocalFile(l,c,u,r,i)}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"+O.stackString(t))}}updateDav(t,e,r,n){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},s=this.store;var o=s.any(t,this.ns.link("request"));if(!o)throw new Error("No record of our HTTP GET request for document: "+t);var a=s.any(o,this.ns.link("response"));if(!a)return null;var c=s.the(a,this.ns.httph("content-type")).value;let u=s.statementsMatching(void 0,void 0,void 0,t).slice();for(let t=0;t<e.length;t++)O.RDFArrayRemove(u,e[t]);for(let t=0;t<r.length;t++)u.push(r[t]);const l=this.serialize(t.value,u,c);var h,f=s.the(a,this.ns.httph("content-location"));return f&&(h=(0,w.join)(f.value,h)),i.contentType=c,i.noMeta=!0,i.body=l,s.fetcher.webOperation("PUT",h,i).then((i=>{if(!i.ok)throw new Error(i.error);for(let t=0;t<e.length;t++)s.remove(e[t]);for(let e=0;e<r.length;e++)s.add(r[e].subject,r[e].predicate,r[e].object,t);n(t.value,i.ok,i.responseText,i)})).catch((e=>{n(t.value,!1,e.message,e)}))}updateLocalFile(t,e,r,n){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s=this.store;let o=s.statementsMatching(void 0,void 0,void 0,t).slice();for(let t=0;t<e.length;t++)O.RDFArrayRemove(o,e[t]);for(let t=0;t<r.length;t++)o.push(r[t]);var a=t.value.lastIndexOf(".");if(a<1)throw new Error("Rewriting file: No filename extension: "+t.value);var c=t.value.slice(a+1);let u=De.CONTENT_TYPE_BY_EXT[c];if(!u)throw new Error("File extension ."+c+" not supported for data write");i.body=this.serialize(t.value,o,u),i.contentType=u,s.fetcher.webOperation("PUT",t.value,i).then((i=>{if(!i.ok)return n(t.value,!1,i.error);for(let t=0;t<e.length;t++)s.remove(e[t]);for(let e=0;e<r.length;e++)s.add(r[e].subject,r[e].predicate,r[e].object,t);n(t.value,!0,"")}))}serialize(t,e,r){const n=this.store;let i;if("string"==typeof e)return e;var s=C(n);switch(s.suggestNamespaces(n.namespaces),s.setBase(t),r){case"text/xml":case"application/rdf+xml":i=s.statementsToXML(e);break;case"text/n3":case"text/turtle":case"application/x-turtle":case"application/n3":i=s.statementsToN3(e);break;default:throw new Error("Content-type "+r+" not supported for data serialization")}return i}put(t,e,r,n){const i=this.store;let s;return Promise.resolve().then((()=>(s=this.serialize(t.value,e,r),i.fetcher.webOperation("PUT",t.value,{contentType:r,body:s})))).then((r=>{if(!r.ok)return n(t.value,r.ok,r.error,r);delete i.fetcher.nonexistent[t.value],delete i.fetcher.requested[t.value],"string"!=typeof e&&e.map((t=>{i.addStatement(t)})),n(t.value,r.ok,"",r)})).catch((e=>{n(t.value,!1,e.message)}))}reload(t,e,r){var n=Date.now();t.fetcher.nowOrWhenFetched(e.value,{force:!0,noMeta:!0,clearPreviousData:!0},(function(t,i,s){if(t)if(s.onErrorWasCalled||200!==s.status)r(!1,"Non-HTTP error reloading data: "+i,s);else{var o=Date.now()-n;e.reloadTimeTotal||(e.reloadTimeTotal=0),e.reloadTimeCount||(e.reloadTimeCount=0),e.reloadTimeTotal+=o,e.reloadTimeCount+=1,r(!0)}else r(!1,"Error reloading data: "+i,s)}))}}const $e={...Tt,fetcher:(t,e)=>new De(t,e),graph(){return new J(arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,(arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0)||{rdfFactory:Tt})},lit(t,e,r){return this.literal(""+t,e||r)},st(t,e,r,n){return this.quad(t,e,r,n)}},He=$e;class ze{constructor(t,e){this.parent=t,this.via=e,this.connected=!1,this.pending={},this.subscribed={},this.socket={};try{this.socket=new WebSocket(e),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)}}_decode(t){var e,r,n,i,s,o,a;for(r in i={},s=function(){var r,n,i,s;for(s=[],r=0,n=(i=t.split("&")).length;r<n;r++)e=i[r],s.push(e.split("="));return s}())e=s[r],a=(o=[decodeURIComponent(e[0]),decodeURIComponent(e[1])])[1],null==i[n=o[0]]&&(i[n]=[]),i[n].push(a);return i}_send(t,e,r){var n,i;return i=[t,e,r].join(" "),"function"==typeof(n=this.socket).send?n.send(i):void 0}_subscribe(t){return this._send("sub",t,""),this.subscribed[t]=!0,this.subscribed[t]}onClose(t){var e;for(e in this.connected=!1,this.subscribed)this.pending[e]=!0;return this.subscribed={},this.subscribed}onError(t){throw new Error("onError"+t)}onMessage(t){var e,r;return"ping"===(r=t.data.split(" "))[0]?"function"==typeof(e=this.socket).send?e.send("pong "+r.slice(1).join(" ")):void 0:"pub"===r[0]?this.parent.onUpdate(r[1],this._decode(r[2])):void 0}onOpen(t){var e,r;for(r in this.connected=!0,e=[],this.pending)delete this.pending[r],e.push(this._subscribe(r));return e}subscribe(t){return this.connected?this._subscribe(t):(this.pending[t]=!0,this.pending[t])}}class Xe{constructor(t){this.fetcher=t,this.graph={},this.via={},this.fetcher.addCallback("headers",this.onHeaders)}onHeaders(t){var e,r,n;return null==t.headers||"undefined"==typeof WebSocket||null===WebSocket||(e=t.headers.etag,n=t.headers["updates-via"],r=t.uri,e&&n&&(this.graph[r]={etag:e,via:n},this.register(n,r))),!0}onUpdate(t,e){return this.fetcher.refresh(He.namedNode(t))}register(t,e){return null==this.via[t]&&(this.via[t]=new ze(this,t)),this.via[t].subscribe(e)}}const Ve={};for(const t in He)"function"==typeof He[t]&&(Ve[t]=He[t].bind(He));const{fetcher:Ge,graph:Qe,lit:We,st:Je,namedNode:Ye,variable:Ze,blankNode:Ke,defaultGraph:tr,literal:er,quad:rr,triple:nr}=Ve,ir=new B,sr=t=>ir.fromNT(t),or=q.fromValue,ar=i.nextId;class cr extends J{constructor(e){super(e),(0,t.A)(this,"fetcher",void 0),this.fetcher=new De(this,{})}}class ur extends cr{constructor(e){super(e),(0,t.A)(this,"updater",void 0),this.updater=new qe(this)}}})(),c})()));
|
|
2
|
+
!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,i,n,s={362:(t,e,r)=>{"use strict";function i(t){return"string"==typeof t?t:t.value}r.d(e,{E:()=>i})},546:(t,e,r)=>{"use strict";r.d(e,{CZ:()=>h,D0:()=>c,DJ:()=>o,DZ:()=>u,GE:()=>y,P3:()=>a,RN:()=>b,SH:()=>n,Y2:()=>p,YC:()=>w,aF:()=>d,c$:()=>f,fY:()=>l,hr:()=>m,jt:()=>g,ok:()=>s});var i=r(6866);function n(t){return"object"==typeof t&&null!==t&&"subject"in t}function s(t){return"object"==typeof t&&null!==t&&"statements"in t}function a(t){return c(t)&&t.termType===i.r0}function o(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 h(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 c(t)&&(t.termType===i.Kk||t.termType===i.$Q||t.termType===i.P2)}function u(t){return c(t)&&t.termType===i.P2}function c(t){return"object"==typeof t&&null!==t&&"termType"in t}function f(t){return t.termType===i.QW}function d(t){return"object"==typeof t&&null!==t&&"subject"in t&&"predicate"in t&&"object"in t}function p(t){return c(t)&&"NamedNode"===t.termType}function g(t){return c(t)&&"termType"in t&&"BlankNode"===t.termType}function m(t){return c(t)&&(t.termType===i.Kk||t.termType===i.P2||t.termType===i.$Q)}function w(t){return c(t)&&(t.termType===i.Kk||t.termType===i.P2)}function y(t){return c(t)&&(t.termType===i.Kk||t.termType===i.P2||t.termType===i.$Q||t.termType===i.QW)}function b(t){return c(t)&&(t.termType===i.Kk||t.termType===i.P2||t.termType===i.$Q||t.termType===i.ic)}},939:(t,e,r)=>{"use strict";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)}function n(t,e,r){return(e=function(t){var e=function(t){if("object"!=i(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==i(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.d(e,{A:()=>n})},1147:(t,e,r)=>{var i="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==r.g&&r.g,n=function(){function t(){this.fetch=!1,this.DOMException=i.DOMException}return t.prototype=i,new t}();!function(t){!function(e){var i=void 0!==t&&t||"undefined"!=typeof self&&self||void 0!==r.g&&r.g||{},n="URLSearchParams"in i,s="Symbol"in i&&"iterator"in Symbol,a="FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in i,h="ArrayBuffer"in i;if(h)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&l.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return s&&(e[Symbol.iterator]=function(){return e}),e}function p(t){this.map={},t instanceof p?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function g(t){if(!t._noBody)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function m(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function w(t){var e=new FileReader,r=m(e);return e.readAsArrayBuffer(t),r}function y(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:a&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():h&&a&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=y(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):h&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=y(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,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):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a&&(this.blob=function(){var t=g(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(){if(this._bodyArrayBuffer)return g(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer));if(a)return this.blob().then(w);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t,e,r,i,n,s=g(this);if(s)return s;if(this._bodyBlob)return t=this._bodyBlob,r=m(e=new FileReader),n=(i=/charset=([A-Za-z0-9_-]+)/.exec(t.type))?i[1]:"utf-8",e.readAsText(t,n),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),i=0;i<e.length;i++)r[i]=String.fromCharCode(e[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(x)}),this.json=function(){return this.text().then(JSON.parse)},this}p.prototype.append=function(t,e){t=c(t),e=f(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},p.prototype.delete=function(t){delete this.map[c(t)]},p.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},p.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},p.prototype.set=function(t,e){this.map[c(t)]=f(e)},p.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},p.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),d(t)},p.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),d(t)},p.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),d(t)},s&&(p.prototype[Symbol.iterator]=p.prototype.entries);var v=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function _(t,e){if(!(this instanceof _))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,n,s=(e=e||{}).body;if(t instanceof _){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new p(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,s||null==t._bodyInit||(s=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new p(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),v.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in i)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(s),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var a=/([?&])_=[^&]*/;a.test(this.url)?this.url=this.url.replace(a,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function x(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(n))}})),e}function T(t,e){if(!(this instanceof T))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new p(e.headers),this.url=e.url||"",this._initBody(t)}_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},b.call(_.prototype),b.call(T.prototype),T.prototype.clone=function(){return new T(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},T.error=function(){var t=new T(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var A=[301,302,303,307,308];T.redirect=function(t,e){if(-1===A.indexOf(e))throw new RangeError("Invalid status code");return new T(null,{status:e,headers:{location:t}})},e.DOMException=i.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 N(t,r){return new Promise((function(n,s){var o=new _(t,r);if(o.signal&&o.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var l=new XMLHttpRequest;function u(){l.abort()}if(l.onload=function(){var t,e,r={statusText:l.statusText,headers:(t=l.getAllResponseHeaders()||"",e=new p,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();try{e.append(i,n)}catch(t){console.warn("Response "+t.message)}}})),e)};0===o.url.indexOf("file://")&&(l.status<200||l.status>599)?r.status=200:r.status=l.status,r.url="responseURL"in l?l.responseURL:r.headers.get("X-Request-URL");var i="response"in l?l.response:l.responseText;setTimeout((function(){n(new T(i,r))}),0)},l.onerror=function(){setTimeout((function(){s(new TypeError("Network request failed"))}),0)},l.ontimeout=function(){setTimeout((function(){s(new TypeError("Network request timed out"))}),0)},l.onabort=function(){setTimeout((function(){s(new e.DOMException("Aborted","AbortError"))}),0)},l.open(o.method,function(t){try{return""===t&&i.location.href?i.location.href:t}catch(e){return t}}(o.url),!0),"include"===o.credentials?l.withCredentials=!0:"omit"===o.credentials&&(l.withCredentials=!1),"responseType"in l&&(a?l.responseType="blob":h&&(l.responseType="arraybuffer")),r&&"object"==typeof r.headers&&!(r.headers instanceof p||i.Headers&&r.headers instanceof i.Headers)){var d=[];Object.getOwnPropertyNames(r.headers).forEach((function(t){d.push(c(t)),l.setRequestHeader(t,f(r.headers[t]))})),o.headers.forEach((function(t,e){-1===d.indexOf(e)&&l.setRequestHeader(e,t)}))}else o.headers.forEach((function(t,e){l.setRequestHeader(e,t)}));o.signal&&(o.signal.addEventListener("abort",u),l.onreadystatechange=function(){4===l.readyState&&o.signal.removeEventListener("abort",u)}),l.send(void 0===o._bodyInit?null:o._bodyInit)}))}N.polyfill=!0,i.fetch||(i.fetch=N,i.Headers=p,i.Request=_,i.Response=T),e.Headers=p,e.Request=_,e.Response=T,e.fetch=N}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var s=i.fetch?i:n;(e=s.fetch).default=s.fetch,e.fetch=s.fetch,e.Headers=s.Headers,e.Request=s.Request,e.Response=s.Response,t.exports=e},1605:(t,e,r)=>{"use strict";r.d(e,{A:()=>n});var i=r(939);class n{constructor(t){(0,i.A)(this,"termType",void 0),(0,i.A)(this,"classOrder",void 0),(0,i.A)(this,"value",void 0),this.value=t}substitute(t){return this}compareTerm(t){return this.classOrder<t.classOrder?-1:this.classOrder>t.classOrder?1:this.value<t.value?-1:this.value>t.value?1:0}equals(t){return!!t&&this.termType===t.termType&&this.value===t.value}hashString(){return this.toCanonical()}sameTerm(t){return this.equals(t)}toCanonical(){return this.toNT()}toNT(){return this.toString()}toNQ(){return this.toNT()}toString(){throw new Error("Node.toString() is abstract - see the subclasses instead")}}(0,i.A)(n,"fromValue",void 0),(0,i.A)(n,"toJS",void 0)},2312:function(t,e){var r,i;void 0===(i="function"==typeof(r=function(){"use strict";function t(e,r,i,n){this.message=e,this.expected=r,this.found=i,this.location=n,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'"'+n(t.text)+'"'},class:function(t){var e,r="";for(e=0;e<t.parts.length;e++)r+=t.parts[e]instanceof Array?s(t.parts[e][0])+"-"+s(t.parts[e][1]):s(t.parts[e]);return"["+(t.inverted?"^":"")+r+"]"},any:function(t){return"any character"},end:function(t){return"end of input"},other:function(t){return t.description}};function i(t){return t.charCodeAt(0).toString(16).toUpperCase()}function n(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+i(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+i(t)}))}function s(t){return t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+i(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+i(t)}))}return"Expected "+function(t){var e,i,n,s=new Array(t.length);for(e=0;e<t.length;e++)s[e]=(n=t[e],r[n.type](n));if(s.sort(),s.length>0){for(e=1,i=1;e<s.length;e++)s[e-1]!==s[e]&&(s[i]=s[e],i++);s.length=i}switch(s.length){case 1:return s[0];case 2:return s[0]+" or "+s[1];default:return s.slice(0,-1).join(", ")+", or "+s[s.length-1]}}(t)+" but "+function(t){return t?'"'+n(t)+'"':"end of input"}(e)+" found."},{SyntaxError:t,parse:function(e,r){r=void 0!==r?r:{};var i,n={},s={turtleDoc:Gr},a=Gr,o=function(t){var e=Ti.toJSON();return e["@graph"]=[],t.filter((t=>Array.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},h="\ufeff",l=Hr("\ufeff",!1),u=".",c=Hr(".",!1),f=function(t){return t},d="#",p=Hr("#",!1),g=/^[^\n]/,m=Xr(["\n"],!0,!1),w="\n",y=Hr("\n",!1),b=function(t){return t.join("")},v="@prefix",_=Hr("@prefix",!1),x=function(t,e){return Ti.addPrefix(""===t?"0":t,e),{}},T="@base",A=Hr("@base",!1),N=function(t){return Ti.addBase(t),{}},E=/^[Bb]/,R=Xr(["B","b"],!1,!1),k=/^[Aa]/,I=Xr(["A","a"],!1,!1),C=/^[Ss]/,O=Xr(["S","s"],!1,!1),j=/^[Ee]/,S=Xr(["E","e"],!1,!1),F=/^[Pp]/,U=Xr(["P","p"],!1,!1),D=/^[Rr]/,L=Xr(["R","r"],!1,!1),M=/^[Ff]/,P=Xr(["F","f"],!1,!1),B=/^[Ii]/,q=Xr(["I","i"],!1,!1),$=/^[Xx]/,H=Xr(["X","x"],!1,!1),X=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]},Q=";",V=Hr(";",!1),G=function(t,e,r,i){var n={};return n[r]=i,n},W=function(t,e,r){return r},Y=function(t,e,r){var i={};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===i[e]?i[e]=t:Array.isArray(i[e])?i[e].push(t):i[e]=[i[e],t]}))}))})),i},Z=",",J=Hr(",",!1),K=function(t,e){return e},tt=function(t,e){return e.unshift(t),e},et="a",rt=Hr("a",!1),it=function(){return"@type"},nt=function(t){return Ai(t,!0)},st=function(t){return Ai(t,!1)},at=function(t){return"[]"===t?{}:{"@id":t}},ot=function(t){return{"@id":t}},ht="[",lt=Hr("[",!1),ut="]",ct=Hr("]",!1),ft="(",dt=Hr("(",!1),pt=")",gt=Hr(")",!1),mt=function(t){return{"@list":t}},wt=function(t,e){return{"@value":t,"@language":e}},yt="^^",bt=Hr("^^",!1),vt=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=Ti.resolve(e,!0);if(r){const i=e.split(":")[0];if("http://www.w3.org/2001/XMLSchema#boolean"===r&&"true"===t)return Ti.decrement(i),!0;if("http://www.w3.org/2001/XMLSchema#boolean"===r&&"false"===t)return Ti.decrement(i),!1;if("http://www.w3.org/2001/XMLSchema#integer"===r)return Ti.decrement(i),parseInt(t);if("http://www.w3.org/2001/XMLSchema#double"===r)return Ti.decrement(i),parseFloat(t)}return{"@value":t,"@type":e}},_t="true",xt=Hr("true",!1),Tt=function(){return!0},At="false",Nt=Hr("false",!1),Et=function(){return!1},Rt=function(t){return t+":"},kt="<",It=Hr("<",!1),Ct=/^[^\0- <>"{}|\^`\\]/,Ot=Xr([["\0"," "],"<",">",'"',"{","}","|","^","`","\\"],!0,!1),jt=">",St=Hr(">",!1),Ft=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 Ti.resolve(r)}catch(t){$r("Invalid IRIREF "+r)}}else $r("Invalid IRIREF "+t.join("")+" / "+e)},Ut=":",Dt=Hr(":",!1),Lt=function(t){return t=t||"0",!1===Ti.hasPrefix(t)&&$r("undefined prefix "+t),t},Mt=function(t){return t||""},Pt=function(t,e){return Ti.increment(t),Ti.resolve(t+":"+e)},Bt="_:",qt=Hr("_:",!1),$t=/^[0-9]/,Ht=Xr([["0","9"]],!1,!1),Xt="@",zt=Hr("@",!1),Qt=/^[a-zA-Z]/,Vt=Xr([["a","z"],["A","Z"]],!1,!1),Gt="-",Wt=Hr("-",!1),Yt=/^[a-zA-Z0-9]/,Zt=Xr([["a","z"],["A","Z"],["0","9"]],!1,!1),Jt=function(t,e){return"-"+e.join("")},Kt=function(t,e){return t.join("")+e.join("")},te=/^[+\-]/,ee=Xr(["+","-"],!1,!1),re=function(t){return t.match(/^[0+][0-9]+$/)?{"@value":t,"@type":"http://www.w3.org/2001/XMLSchema#integer"}:parseInt(t)},ie=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"}},se=/^[eE]/,ae=Xr(["e","E"],!1,!1),oe='"',he=Hr('"',!1),le=/^[^"\\\n\r]/,ue=Xr(['"',"\\","\n","\r"],!0,!1),ce="'",fe=Hr("'",!1),de=/^[^'\\\n\r]/,pe=Xr(["'","\\","\n","\r"],!0,!1),ge="'''",me=Hr("'''",!1),we=/^[^'\\]/,ye=Xr(["'","\\"],!0,!1),be="''",ve=Hr("''",!1),_e=function(t,e){return"''"+e.join("")},xe=function(t,e){return"'"+e.join("")},Te=function(t,e){return t.join("")+e.join("")},Ae='"""',Ne=Hr('"""',!1),Ee=/^[^"\\]/,Re=Xr(['"',"\\"],!0,!1),ke='""',Ie=Hr('""',!1),Ce=function(t,e){return'""'+e.join("")},Oe=function(t,e){return'"'+e.join("")},je="\\U",Se=Hr("\\U",!1),Fe=function(t){return String.fromCodePoint(parseInt(t.join(""),16))},Ue="\\u",De=Hr("\\u",!1),Le=function(t){return String.fromCharCode(parseInt(t.join(""),16))},Me="\\t",Pe=Hr("\\t",!1),Be=function(){return"\t"},qe="\\b",$e=Hr("\\b",!1),He=function(){return"\b"},Xe="\\n",ze=Hr("\\n",!1),Qe=function(){return"\n"},Ve="\\r",Ge=Hr("\\r",!1),We=function(){return"\r"},Ye="\\f",Ze=Hr("\\f",!1),Je=function(){return"\f"},Ke='\\"',tr=Hr('\\"',!1),er=function(){return'"'},rr="\\'",ir=Hr("\\'",!1),nr=function(){return"'"},sr="\\\\",ar=Hr("\\\\",!1),or=function(){return"\\"},hr=/^[ \t\r\n]/,lr=Xr([" ","\t","\r","\n"],!1,!1),ur=function(){return"[]"},cr=/^[\uD800-\uDBFF]/,fr=Xr([["\ud800","\udbff"]],!1,!1),dr=/^[\uDC00-\uDFFF]/,pr=Xr([["\udc00","\udfff"]],!1,!1),gr=function(t,e){return t+e},mr=/^[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]/,wr=Xr([["A","Z"],["a","z"],["À","Ö"],["Ø","ö"],["ø","˿"],["Ͱ","ͽ"],["Ϳ",""],["",""],["⁰",""],["Ⰰ",""],["、",""],["豈","﷏"],["ﷰ","�"]],!1,!1),yr="_",br=Hr("_",!1),vr="·",_r=Hr("·",!1),xr=/^[\u0300-\u036F]/,Tr=Xr([["̀","ͯ"]],!1,!1),Ar=/^[\u203F-\u2040]/,Nr=Xr([["‿","⁀"]],!1,!1),Er=function(t,e,r,i){return r.join("")+i.join("")},Rr=function(t,e,r){return t+e.join("")+r.join("")},kr="%",Ir=Hr("%",!1),Cr=/^[0-9A-Fa-f]/,Or=Xr([["0","9"],["A","F"],["a","f"]],!1,!1),jr="\\",Sr=Hr("\\",!1),Fr=/^[_~.!$&'()*+,;=\/?#@%\-]/,Ur=Xr(["_","~",".","!","$","&","'","(",")","*","+",",",";","=","/","?","#","@","%","-"],!1,!1),Dr=0,Lr=0,Mr=[{line:1,column:1}],Pr=0,Br=[],qr=0;if("startRule"in r){if(!(r.startRule in s))throw new Error("Can't start parsing from rule \""+r.startRule+'".');a=s[r.startRule]}function $r(e,r){throw function(e,r){return new t(e,null,null,r)}(e,r=void 0!==r?r:Qr(Lr,Dr))}function Hr(t,e){return{type:"literal",text:t,ignoreCase:e}}function Xr(t,e,r){return{type:"class",parts:t,inverted:e,ignoreCase:r}}function zr(t){var r,i=Mr[t];if(i)return i;for(r=t-1;!Mr[r];)r--;for(i={line:(i=Mr[r]).line,column:i.column};r<t;)10===e.charCodeAt(r)?(i.line++,i.column=1):i.column++,r++;return Mr[t]=i,i}function Qr(t,e){var r=zr(t),i=zr(e);return{start:{offset:t,line:r.line,column:r.column},end:{offset:e,line:i.line,column:i.column}}}function Vr(t){Dr<Pr||(Dr>Pr&&(Pr=Dr,Br=[]),Br.push(t))}function Gr(){var t,e,r,i,s;for(t=Dr,e=[],r=Wr();r!==n;)e.push(r),r=Wr();if(e!==n){for(r=[],i=Yr();i!==n;)r.push(i),i=Yr();if(r!==n){for(i=[],s=Zr();s!==n;)i.push(s),s=Zr();i!==n?(Lr=t,t=e=o(r)):(Dr=t,t=n)}else Dr=t,t=n}else Dr=t,t=n;return t}function Wr(){var t;return 65279===e.charCodeAt(Dr)?(t=h,Dr++):(t=n,0===qr&&Vr(l)),t}function Yr(){var t,r,i,s;if((t=function(){var t;return(t=function(){var t,r,i,s,a,o,h,l,f;for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();if(r!==n)if(e.substr(Dr,7)===v?(i=v,Dr+=7):(i=n,0===qr&&Vr(_)),i!==n){for(s=[],a=Zr();a!==n;)s.push(a),a=Zr();if(s!==n)if((a=li())!==n){for(o=[],h=Zr();h!==n;)o.push(h),h=Zr();if(o!==n)if((h=oi())!==n){for(l=[],f=Zr();f!==n;)l.push(f),f=Zr();l!==n?(46===e.charCodeAt(Dr)?(f=u,Dr++):(f=n,0===qr&&Vr(c)),f!==n?(Lr=t,t=r=x(a,h)):(Dr=t,t=n)):(Dr=t,t=n)}else Dr=t,t=n;else Dr=t,t=n}else Dr=t,t=n;else Dr=t,t=n}else Dr=t,t=n;else Dr=t,t=n;return t}())===n&&(t=function(){var t,r,i,s,a,o,h;for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();if(r!==n)if(e.substr(Dr,5)===T?(i=T,Dr+=5):(i=n,0===qr&&Vr(A)),i!==n){for(s=[],a=Zr();a!==n;)s.push(a),a=Zr();if(s!==n)if((a=oi())!==n){for(o=[],h=Zr();h!==n;)o.push(h),h=Zr();o!==n?(46===e.charCodeAt(Dr)?(h=u,Dr++):(h=n,0===qr&&Vr(c)),h!==n?(Lr=t,t=r=N(a)):(Dr=t,t=n)):(Dr=t,t=n)}else Dr=t,t=n;else Dr=t,t=n}else Dr=t,t=n;else Dr=t,t=n;return t}())===n&&(t=function(){var t,r,i,s,a,o,h,l,u,c,f,d;for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();if(r!==n)if(F.test(e.charAt(Dr))?(i=e.charAt(Dr),Dr++):(i=n,0===qr&&Vr(U)),i!==n)if(D.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(L)),s!==n)if(j.test(e.charAt(Dr))?(a=e.charAt(Dr),Dr++):(a=n,0===qr&&Vr(S)),a!==n)if(M.test(e.charAt(Dr))?(o=e.charAt(Dr),Dr++):(o=n,0===qr&&Vr(P)),o!==n)if(B.test(e.charAt(Dr))?(h=e.charAt(Dr),Dr++):(h=n,0===qr&&Vr(q)),h!==n)if($.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(H)),l!==n){for(u=[],c=Zr();c!==n;)u.push(c),c=Zr();if(u!==n)if((c=li())!==n){for(f=[],d=Zr();d!==n;)f.push(d),d=Zr();f!==n&&(d=oi())!==n?(Lr=t,t=r=x(c,d)):(Dr=t,t=n)}else Dr=t,t=n;else Dr=t,t=n}else Dr=t,t=n;else Dr=t,t=n;else Dr=t,t=n;else Dr=t,t=n;else Dr=t,t=n;else Dr=t,t=n;else Dr=t,t=n;return t}())===n&&(t=function(){var t,r,i,s,a,o,h,l;for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();if(r!==n)if(E.test(e.charAt(Dr))?(i=e.charAt(Dr),Dr++):(i=n,0===qr&&Vr(R)),i!==n)if(k.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(I)),s!==n)if(C.test(e.charAt(Dr))?(a=e.charAt(Dr),Dr++):(a=n,0===qr&&Vr(O)),a!==n)if(j.test(e.charAt(Dr))?(o=e.charAt(Dr),Dr++):(o=n,0===qr&&Vr(S)),o!==n){for(h=[],l=Zr();l!==n;)h.push(l),l=Zr();h!==n&&(l=oi())!==n?(Lr=t,t=r=N(l)):(Dr=t,t=n)}else Dr=t,t=n;else Dr=t,t=n;else Dr=t,t=n;else Dr=t,t=n;else Dr=t,t=n;return t}()),t}())===n)if(t=Dr,(r=function(){var t,e,r;return t=Dr,(e=function(){var t,e;return t=Dr,(e=ii())!==n&&(Lr=t,e=nt(e)),(t=e)===n&&(t=ai())===n&&(t=si()),t}())!==n&&(r=Jr())!==n?(Lr=t,t=e=X(e,r)):(Dr=t,t=n),t===n&&(t=Dr,(e=ri())!==n?((r=Jr())===n&&(r=null),r!==n?(Lr=t,t=e=z(e,r)):(Dr=t,t=n)):(Dr=t,t=n)),t}())!==n){for(i=[],s=Zr();s!==n;)i.push(s),s=Zr();i!==n?(46===e.charCodeAt(Dr)?(s=u,Dr++):(s=n,0===qr&&Vr(c)),s!==n?(Lr=t,t=r=f(r)):(Dr=t,t=n)):(Dr=t,t=n)}else Dr=t,t=n;return t}function Zr(){var t;return(t=function(){var t;return hr.test(e.charAt(Dr))?(t=e.charAt(Dr),Dr++):(t=n,0===qr&&Vr(lr)),t}())===n&&(t=function(){var t,r,i,s;if(t=Dr,35===e.charCodeAt(Dr)?(r=d,Dr++):(r=n,0===qr&&Vr(p)),r!==n){for(i=[],g.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(m));s!==n;)i.push(s),g.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(m));i!==n?(10===e.charCodeAt(Dr)?(s=w,Dr++):(s=n,0===qr&&Vr(y)),s!==n?(Lr=t,t=r=b(i)):(Dr=t,t=n)):(Dr=t,t=n)}else Dr=t,t=n;return t}()),t}function Jr(){var t,r,i,s,a,o,h,l,u,c;if(t=Dr,(r=ti())!==n)if((i=Kr())!==n){for(s=[],a=Dr,o=[],h=Zr();h!==n;)o.push(h),h=Zr();for(o!==n?(59===e.charCodeAt(Dr)?(h=Q,Dr++):(h=n,0===qr&&Vr(V)),h!==n?(l=Dr,(u=ti())!==n&&(c=Kr())!==n?(Lr=l,l=u=G(r,i,u,c)):(Dr=l,l=n),l===n&&(l=null),l!==n?(Lr=a,a=o=W(r,i,l)):(Dr=a,a=n)):(Dr=a,a=n)):(Dr=a,a=n);a!==n;){for(s.push(a),a=Dr,o=[],h=Zr();h!==n;)o.push(h),h=Zr();o!==n?(59===e.charCodeAt(Dr)?(h=Q,Dr++):(h=n,0===qr&&Vr(V)),h!==n?(l=Dr,(u=ti())!==n&&(c=Kr())!==n?(Lr=l,l=u=G(r,i,u,c)):(Dr=l,l=n),l===n&&(l=null),l!==n?(Lr=a,a=o=W(r,i,l)):(Dr=a,a=n)):(Dr=a,a=n)):(Dr=a,a=n)}s!==n?(Lr=t,t=r=Y(r,i,s)):(Dr=t,t=n)}else Dr=t,t=n;else Dr=t,t=n;return t}function Kr(){var t,r,i,s,a,o,h;if(t=Dr,(r=ei())!==n){for(i=[],s=Dr,a=[],o=Zr();o!==n;)a.push(o),o=Zr();for(a!==n?(44===e.charCodeAt(Dr)?(o=Z,Dr++):(o=n,0===qr&&Vr(J)),o!==n&&(h=ei())!==n?(Lr=s,s=a=K(r,h)):(Dr=s,s=n)):(Dr=s,s=n);s!==n;){for(i.push(s),s=Dr,a=[],o=Zr();o!==n;)a.push(o),o=Zr();a!==n?(44===e.charCodeAt(Dr)?(o=Z,Dr++):(o=n,0===qr&&Vr(J)),o!==n&&(h=ei())!==n?(Lr=s,s=a=K(r,h)):(Dr=s,s=n)):(Dr=s,s=n)}i!==n?(Lr=t,t=r=tt(r,i)):(Dr=t,t=n)}else Dr=t,t=n;return t}function ti(){var t,r,i;if(t=Dr,(r=function(){var t,e,r;for(t=Dr,e=[],r=Zr();r!==n;)e.push(r),r=Zr();return e!==n&&(r=si())!==n?(Lr=t,t=e=f(r)):(Dr=t,t=n),t}())!==n&&(Lr=t,r=f(r)),(t=r)===n){for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();r!==n?(97===e.charCodeAt(Dr)?(i=et,Dr++):(i=n,0===qr&&Vr(rt)),i!==n?(Lr=t,t=r=it()):(Dr=t,t=n)):(Dr=t,t=n)}return t}function ei(){var t,r;return(t=function(){var t;return(t=function(){var t,r,i,s,a,o,h;for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();if(r!==n)if((i=ni())!==n){for(s=[],a=Zr();a!==n;)s.push(a),a=Zr();s!==n&&(a=function(){var t,r,i,s,a,o,h,l;if(t=Dr,64===e.charCodeAt(Dr)?(r=Xt,Dr++):(r=n,0===qr&&Vr(zt)),r!==n){if(i=[],Qt.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(Vt)),s!==n)for(;s!==n;)i.push(s),Qt.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(Vt));else i=n;if(i!==n){if(s=[],a=Dr,45===e.charCodeAt(Dr)?(o=Gt,Dr++):(o=n,0===qr&&Vr(Wt)),o!==n){if(h=[],Yt.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(Zt)),l!==n)for(;l!==n;)h.push(l),Yt.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(Zt));else h=n;h!==n?(Lr=a,a=o=Jt(i,h)):(Dr=a,a=n)}else Dr=a,a=n;for(;a!==n;)if(s.push(a),a=Dr,45===e.charCodeAt(Dr)?(o=Gt,Dr++):(o=n,0===qr&&Vr(Wt)),o!==n){if(h=[],Yt.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(Zt)),l!==n)for(;l!==n;)h.push(l),Yt.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(Zt));else h=n;h!==n?(Lr=a,a=o=Jt(i,h)):(Dr=a,a=n)}else Dr=a,a=n;s!==n?(Lr=t,t=r=Kt(i,s)):(Dr=t,t=n)}else Dr=t,t=n}else Dr=t,t=n;return t}())!==n?(Lr=t,t=r=wt(i,a)):(Dr=t,t=n)}else Dr=t,t=n;else Dr=t,t=n;if(t===n){for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();if(r!==n)if((i=ni())!==n){for(s=[],a=Zr();a!==n;)s.push(a),a=Zr();if(s!==n)if(e.substr(Dr,2)===yt?(a=yt,Dr+=2):(a=n,0===qr&&Vr(bt)),a!==n){for(o=[],h=Zr();h!==n;)o.push(h),h=Zr();o!==n&&(h=si())!==n?(Lr=t,t=r=vt(i,h)):(Dr=t,t=n)}else Dr=t,t=n;else Dr=t,t=n}else Dr=t,t=n;else Dr=t,t=n;if(t===n){for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();r!==n&&(i=ni())!==n?(Lr=t,t=r=f(i)):(Dr=t,t=n)}}return t}())===n&&(t=function(){var t,r,i;for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();return r!==n?((i=function(){var t,r,i,s,a,o,h,l,f;if(t=Dr,r=Dr,i=Dr,te.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(ee)),s===n&&(s=null),s!==n){if(a=Dr,o=[],$t.test(e.charAt(Dr))?(h=e.charAt(Dr),Dr++):(h=n,0===qr&&Vr(Ht)),h!==n)for(;h!==n;)o.push(h),$t.test(e.charAt(Dr))?(h=e.charAt(Dr),Dr++):(h=n,0===qr&&Vr(Ht));else o=n;if(o!==n)if(46===e.charCodeAt(Dr)?(h=u,Dr++):(h=n,0===qr&&Vr(c)),h!==n){for(l=[],$t.test(e.charAt(Dr))?(f=e.charAt(Dr),Dr++):(f=n,0===qr&&Vr(Ht));f!==n;)l.push(f),$t.test(e.charAt(Dr))?(f=e.charAt(Dr),Dr++):(f=n,0===qr&&Vr(Ht));l!==n&&(f=ui())!==n?a=o=[o,h,l,f]:(Dr=a,a=n)}else Dr=a,a=n;else Dr=a,a=n;if(a===n){if(a=Dr,46===e.charCodeAt(Dr)?(o=u,Dr++):(o=n,0===qr&&Vr(c)),o!==n){if(h=[],$t.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(Ht)),l!==n)for(;l!==n;)h.push(l),$t.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(Ht));else h=n;h!==n&&(l=ui())!==n?a=o=[o,h,l]:(Dr=a,a=n)}else Dr=a,a=n;if(a===n){if(a=Dr,o=[],$t.test(e.charAt(Dr))?(h=e.charAt(Dr),Dr++):(h=n,0===qr&&Vr(Ht)),h!==n)for(;h!==n;)o.push(h),$t.test(e.charAt(Dr))?(h=e.charAt(Dr),Dr++):(h=n,0===qr&&Vr(Ht));else o=n;o!==n&&(h=ui())!==n?a=o=[o,h]:(Dr=a,a=n)}}a!==n?i=s=[s,a]:(Dr=i,i=n)}else Dr=i,i=n;return(r=i!==n?e.substring(r,Dr):i)!==n&&(Lr=t,r=ne(r)),r}())===n&&(i=function(){var t,r,i,s,a,o,h,l;if(t=Dr,r=Dr,i=Dr,te.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(ee)),s===n&&(s=null),s!==n){for(a=[],$t.test(e.charAt(Dr))?(o=e.charAt(Dr),Dr++):(o=n,0===qr&&Vr(Ht));o!==n;)a.push(o),$t.test(e.charAt(Dr))?(o=e.charAt(Dr),Dr++):(o=n,0===qr&&Vr(Ht));if(a!==n)if(46===e.charCodeAt(Dr)?(o=u,Dr++):(o=n,0===qr&&Vr(c)),o!==n){if(h=[],$t.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(Ht)),l!==n)for(;l!==n;)h.push(l),$t.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(Ht));else h=n;h!==n?i=s=[s,a,o,h]:(Dr=i,i=n)}else Dr=i,i=n;else Dr=i,i=n}else Dr=i,i=n;return(r=i!==n?e.substring(r,Dr):i)!==n&&(Lr=t,r=ie(r)),r}())===n&&(i=function(){var t,r,i,s,a,o;if(t=Dr,r=Dr,i=Dr,te.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(ee)),s===n&&(s=null),s!==n){if(a=[],$t.test(e.charAt(Dr))?(o=e.charAt(Dr),Dr++):(o=n,0===qr&&Vr(Ht)),o!==n)for(;o!==n;)a.push(o),$t.test(e.charAt(Dr))?(o=e.charAt(Dr),Dr++):(o=n,0===qr&&Vr(Ht));else a=n;a!==n?i=s=[s,a]:(Dr=i,i=n)}else Dr=i,i=n;return(r=i!==n?e.substring(r,Dr):i)!==n&&(Lr=t,r=re(r)),r}()),i!==n?(Lr=t,t=r=f(i)):(Dr=t,t=n)):(Dr=t,t=n),t}())===n&&(t=function(){var t,r,i;for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();if(r!==n?(e.substr(Dr,4)===_t?(i=_t,Dr+=4):(i=n,0===qr&&Vr(xt)),i!==n?(Lr=t,t=r=Tt()):(Dr=t,t=n)):(Dr=t,t=n),t===n){for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();r!==n?(e.substr(Dr,5)===At?(i=At,Dr+=5):(i=n,0===qr&&Vr(Nt)),i!==n?(Lr=t,t=r=Et()):(Dr=t,t=n)):(Dr=t,t=n)}return t}()),t}())===n&&(t=Dr,(r=ii())!==n&&(Lr=t,r=st(r)),(t=r)===n&&(t=Dr,(r=ai())!==n&&(Lr=t,r=at(r)),(t=r)===n&&(t=Dr,(r=ri())!==n&&(Lr=t,r=f(r)),(t=r)===n&&(t=Dr,(r=si())!==n&&(Lr=t,r=ot(r)),t=r)))),t}function ri(){var t,r,i,s,a,o;for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();if(r!==n)if(91===e.charCodeAt(Dr)?(i=ht,Dr++):(i=n,0===qr&&Vr(lt)),i!==n)if((s=Jr())!==n){for(a=[],o=Zr();o!==n;)a.push(o),o=Zr();a!==n?(93===e.charCodeAt(Dr)?(o=ut,Dr++):(o=n,0===qr&&Vr(ct)),o!==n?(Lr=t,t=r=f(s)):(Dr=t,t=n)):(Dr=t,t=n)}else Dr=t,t=n;else Dr=t,t=n;else Dr=t,t=n;return t}function ii(){var t,r,i,s,a,o;for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();if(r!==n)if(40===e.charCodeAt(Dr)?(i=ft,Dr++):(i=n,0===qr&&Vr(dt)),i!==n){for(s=[],a=ei();a!==n;)s.push(a),a=ei();if(s!==n){for(a=[],o=Zr();o!==n;)a.push(o),o=Zr();a!==n?(41===e.charCodeAt(Dr)?(o=pt,Dr++):(o=n,0===qr&&Vr(gt)),o!==n?(Lr=t,t=r=mt(s)):(Dr=t,t=n)):(Dr=t,t=n)}else Dr=t,t=n}else Dr=t,t=n;else Dr=t,t=n;return t}function ni(){var t,r,i;for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();return r!==n?((i=function(){var t,r,i,s,a,o,h,l;if(t=Dr,e.substr(Dr,3)===ge?(r=ge,Dr+=3):(r=n,0===qr&&Vr(me)),r!==n){for(i=[],we.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(ye)),s===n&&(s=fi())===n&&(s=ci());s!==n;)i.push(s),we.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(ye)),s===n&&(s=fi())===n&&(s=ci());if(i!==n){if(s=[],a=Dr,e.substr(Dr,2)===be?(o=be,Dr+=2):(o=n,0===qr&&Vr(ve)),o!==n){if(h=[],we.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(ye)),l===n&&(l=fi())===n&&(l=ci()),l!==n)for(;l!==n;)h.push(l),we.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(ye)),l===n&&(l=fi())===n&&(l=ci());else h=n;h!==n?(Lr=a,a=o=_e(i,h)):(Dr=a,a=n)}else Dr=a,a=n;if(a===n)if(a=Dr,39===e.charCodeAt(Dr)?(o=ce,Dr++):(o=n,0===qr&&Vr(fe)),o!==n){if(h=[],we.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(ye)),l===n&&(l=fi())===n&&(l=ci()),l!==n)for(;l!==n;)h.push(l),we.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(ye)),l===n&&(l=fi())===n&&(l=ci());else h=n;h!==n?(Lr=a,a=o=xe(i,h)):(Dr=a,a=n)}else Dr=a,a=n;for(;a!==n;){if(s.push(a),a=Dr,e.substr(Dr,2)===be?(o=be,Dr+=2):(o=n,0===qr&&Vr(ve)),o!==n){if(h=[],we.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(ye)),l===n&&(l=fi())===n&&(l=ci()),l!==n)for(;l!==n;)h.push(l),we.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(ye)),l===n&&(l=fi())===n&&(l=ci());else h=n;h!==n?(Lr=a,a=o=_e(i,h)):(Dr=a,a=n)}else Dr=a,a=n;if(a===n)if(a=Dr,39===e.charCodeAt(Dr)?(o=ce,Dr++):(o=n,0===qr&&Vr(fe)),o!==n){if(h=[],we.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(ye)),l===n&&(l=fi())===n&&(l=ci()),l!==n)for(;l!==n;)h.push(l),we.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(ye)),l===n&&(l=fi())===n&&(l=ci());else h=n;h!==n?(Lr=a,a=o=xe(i,h)):(Dr=a,a=n)}else Dr=a,a=n}s!==n?(e.substr(Dr,3)===ge?(a=ge,Dr+=3):(a=n,0===qr&&Vr(me)),a!==n?(Lr=t,t=r=Te(i,s)):(Dr=t,t=n)):(Dr=t,t=n)}else Dr=t,t=n}else Dr=t,t=n;return t}())===n&&(i=function(){var t,r,i,s,a,o,h,l;if(t=Dr,e.substr(Dr,3)===Ae?(r=Ae,Dr+=3):(r=n,0===qr&&Vr(Ne)),r!==n){for(i=[],Ee.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(Re)),s===n&&(s=fi())===n&&(s=ci());s!==n;)i.push(s),Ee.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(Re)),s===n&&(s=fi())===n&&(s=ci());if(i!==n){if(s=[],a=Dr,e.substr(Dr,2)===ke?(o=ke,Dr+=2):(o=n,0===qr&&Vr(Ie)),o!==n){if(h=[],Ee.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(Re)),l===n&&(l=fi())===n&&(l=ci()),l!==n)for(;l!==n;)h.push(l),Ee.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(Re)),l===n&&(l=fi())===n&&(l=ci());else h=n;h!==n?(Lr=a,a=o=Ce(i,h)):(Dr=a,a=n)}else Dr=a,a=n;if(a===n)if(a=Dr,34===e.charCodeAt(Dr)?(o=oe,Dr++):(o=n,0===qr&&Vr(he)),o!==n){if(h=[],Ee.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(Re)),l===n&&(l=fi())===n&&(l=ci()),l!==n)for(;l!==n;)h.push(l),Ee.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(Re)),l===n&&(l=fi())===n&&(l=ci());else h=n;h!==n?(Lr=a,a=o=Oe(i,h)):(Dr=a,a=n)}else Dr=a,a=n;for(;a!==n;){if(s.push(a),a=Dr,e.substr(Dr,2)===ke?(o=ke,Dr+=2):(o=n,0===qr&&Vr(Ie)),o!==n){if(h=[],Ee.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(Re)),l===n&&(l=fi())===n&&(l=ci()),l!==n)for(;l!==n;)h.push(l),Ee.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(Re)),l===n&&(l=fi())===n&&(l=ci());else h=n;h!==n?(Lr=a,a=o=Ce(i,h)):(Dr=a,a=n)}else Dr=a,a=n;if(a===n)if(a=Dr,34===e.charCodeAt(Dr)?(o=oe,Dr++):(o=n,0===qr&&Vr(he)),o!==n){if(h=[],Ee.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(Re)),l===n&&(l=fi())===n&&(l=ci()),l!==n)for(;l!==n;)h.push(l),Ee.test(e.charAt(Dr))?(l=e.charAt(Dr),Dr++):(l=n,0===qr&&Vr(Re)),l===n&&(l=fi())===n&&(l=ci());else h=n;h!==n?(Lr=a,a=o=Oe(i,h)):(Dr=a,a=n)}else Dr=a,a=n}s!==n?(e.substr(Dr,3)===Ae?(a=Ae,Dr+=3):(a=n,0===qr&&Vr(Ne)),a!==n?(Lr=t,t=r=Te(i,s)):(Dr=t,t=n)):(Dr=t,t=n)}else Dr=t,t=n}else Dr=t,t=n;return t}())===n&&(i=function(){var t,r,i,s;if(t=Dr,39===e.charCodeAt(Dr)?(r=ce,Dr++):(r=n,0===qr&&Vr(fe)),r!==n){for(i=[],de.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(pe)),s===n&&(s=fi())===n&&(s=ci());s!==n;)i.push(s),de.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(pe)),s===n&&(s=fi())===n&&(s=ci());i!==n?(39===e.charCodeAt(Dr)?(s=ce,Dr++):(s=n,0===qr&&Vr(fe)),s!==n?(Lr=t,t=r=b(i)):(Dr=t,t=n)):(Dr=t,t=n)}else Dr=t,t=n;return t}())===n&&(i=function(){var t,r,i,s;if(t=Dr,34===e.charCodeAt(Dr)?(r=oe,Dr++):(r=n,0===qr&&Vr(he)),r!==n){for(i=[],le.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(ue)),s===n&&(s=fi())===n&&(s=ci());s!==n;)i.push(s),le.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(ue)),s===n&&(s=fi())===n&&(s=ci());i!==n?(34===e.charCodeAt(Dr)?(s=oe,Dr++):(s=n,0===qr&&Vr(he)),s!==n?(Lr=t,t=r=b(i)):(Dr=t,t=n)):(Dr=t,t=n)}else Dr=t,t=n;return t}()),i!==n?(Lr=t,t=r=f(i)):(Dr=t,t=n)):(Dr=t,t=n),t}function si(){var t,r,i;for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();if(r!==n&&(i=oi())!==n?(Lr=t,t=r=f(i)):(Dr=t,t=n),t===n){for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();r!==n&&(i=function(){var t,r;return(t=function(){var t,r,i;return t=Dr,(r=hi())!==n&&(i=function(){var t,r,i,s,a,o,h,l;if(t=Dr,(r=pi())===n&&(58===e.charCodeAt(Dr)?(r=Ut,Dr++):(r=n,0===qr&&Vr(Dt)),r===n&&($t.test(e.charAt(Dr))?(r=e.charAt(Dr),Dr++):(r=n,0===qr&&Vr(Ht)),r===n&&(r=wi()))),r!==n){for(i=[],(s=gi())===n&&(58===e.charCodeAt(Dr)?(s=Ut,Dr++):(s=n,0===qr&&Vr(Dt)),s===n&&(s=wi()));s!==n;)i.push(s),(s=gi())===n&&(58===e.charCodeAt(Dr)?(s=Ut,Dr++):(s=n,0===qr&&Vr(Dt)),s===n&&(s=wi()));if(i!==n){if(s=[],a=Dr,o=[],46===e.charCodeAt(Dr)?(h=u,Dr++):(h=n,0===qr&&Vr(c)),h!==n)for(;h!==n;)o.push(h),46===e.charCodeAt(Dr)?(h=u,Dr++):(h=n,0===qr&&Vr(c));else o=n;if(o!==n){if(h=[],(l=gi())===n&&(58===e.charCodeAt(Dr)?(l=Ut,Dr++):(l=n,0===qr&&Vr(Dt)),l===n&&(l=wi())),l!==n)for(;l!==n;)h.push(l),(l=gi())===n&&(58===e.charCodeAt(Dr)?(l=Ut,Dr++):(l=n,0===qr&&Vr(Dt)),l===n&&(l=wi()));else h=n;h!==n?(Lr=a,a=o=Er(r,i,o,h)):(Dr=a,a=n)}else Dr=a,a=n;for(;a!==n;){if(s.push(a),a=Dr,o=[],46===e.charCodeAt(Dr)?(h=u,Dr++):(h=n,0===qr&&Vr(c)),h!==n)for(;h!==n;)o.push(h),46===e.charCodeAt(Dr)?(h=u,Dr++):(h=n,0===qr&&Vr(c));else o=n;if(o!==n){if(h=[],(l=gi())===n&&(58===e.charCodeAt(Dr)?(l=Ut,Dr++):(l=n,0===qr&&Vr(Dt)),l===n&&(l=wi())),l!==n)for(;l!==n;)h.push(l),(l=gi())===n&&(58===e.charCodeAt(Dr)?(l=Ut,Dr++):(l=n,0===qr&&Vr(Dt)),l===n&&(l=wi()));else h=n;h!==n?(Lr=a,a=o=Er(r,i,o,h)):(Dr=a,a=n)}else Dr=a,a=n}s!==n?(Lr=t,t=r=Rr(r,i,s)):(Dr=t,t=n)}else Dr=t,t=n}else Dr=t,t=n;return t}())!==n?(Lr=t,t=r=Pt(r,i)):(Dr=t,t=n),t}())===n&&(t=Dr,(r=hi())!==n&&(Lr=t,r=Rt(r)),t=r),t}())!==n?(Lr=t,t=r=f(i)):(Dr=t,t=n)}return t}function ai(){var t,r,i;for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();if(r!==n&&(i=function(){var t,r,i,s,a,o,h,l,f,d;if(t=Dr,r=Dr,e.substr(Dr,2)===Bt?(i=Bt,Dr+=2):(i=n,0===qr&&Vr(qt)),i!==n)if((s=pi())===n&&($t.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(Ht))),s!==n){for(a=[],o=gi();o!==n;)a.push(o),o=gi();if(a!==n){if(o=[],h=Dr,l=[],46===e.charCodeAt(Dr)?(f=u,Dr++):(f=n,0===qr&&Vr(c)),f!==n)for(;f!==n;)l.push(f),46===e.charCodeAt(Dr)?(f=u,Dr++):(f=n,0===qr&&Vr(c));else l=n;if(l!==n){if(f=[],(d=gi())!==n)for(;d!==n;)f.push(d),d=gi();else f=n;f!==n?h=l=[l,f]:(Dr=h,h=n)}else Dr=h,h=n;for(;h!==n;){if(o.push(h),h=Dr,l=[],46===e.charCodeAt(Dr)?(f=u,Dr++):(f=n,0===qr&&Vr(c)),f!==n)for(;f!==n;)l.push(f),46===e.charCodeAt(Dr)?(f=u,Dr++):(f=n,0===qr&&Vr(c));else l=n;if(l!==n){if(f=[],(d=gi())!==n)for(;d!==n;)f.push(d),d=gi();else f=n;f!==n?h=l=[l,f]:(Dr=h,h=n)}else Dr=h,h=n}o!==n?r=i=[i,s,a,o]:(Dr=r,r=n)}else Dr=r,r=n}else Dr=r,r=n;else Dr=r,r=n;return r!==n?e.substring(t,Dr):r}())!==n?(Lr=t,t=r=f(i)):(Dr=t,t=n),t===n){for(t=Dr,r=[],i=Zr();i!==n;)r.push(i),i=Zr();r!==n&&(i=function(){var t,r,i,s;if(t=Dr,91===e.charCodeAt(Dr)?(r=ht,Dr++):(r=n,0===qr&&Vr(lt)),r!==n){for(i=[],s=Zr();s!==n;)i.push(s),s=Zr();i!==n?(93===e.charCodeAt(Dr)?(s=ut,Dr++):(s=n,0===qr&&Vr(ct)),s!==n?(Lr=t,t=r=ur()):(Dr=t,t=n)):(Dr=t,t=n)}else Dr=t,t=n;return t}())!==n?(Lr=t,t=r=f(i)):(Dr=t,t=n)}return t}function oi(){var t,r,i,s;if(t=Dr,60===e.charCodeAt(Dr)?(r=kt,Dr++):(r=n,0===qr&&Vr(It)),r!==n){for(i=[],Ct.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(Ot)),s===n&&(s=ci());s!==n;)i.push(s),Ct.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(Ot)),s===n&&(s=ci());i!==n?(62===e.charCodeAt(Dr)?(s=jt,Dr++):(s=n,0===qr&&Vr(St)),s!==n?(Lr=t,t=r=Ft(i)):(Dr=t,t=n)):(Dr=t,t=n)}else Dr=t,t=n;return t}function hi(){var t,r,i;return t=Dr,(r=mi())===n&&(r=null),r!==n?(58===e.charCodeAt(Dr)?(i=Ut,Dr++):(i=n,0===qr&&Vr(Dt)),i!==n?(Lr=t,t=r=Lt(r)):(Dr=t,t=n)):(Dr=t,t=n),t}function li(){var t,r,i;return t=Dr,(r=mi())===n&&(r=null),r!==n?(58===e.charCodeAt(Dr)?(i=Ut,Dr++):(i=n,0===qr&&Vr(Dt)),i!==n?(Lr=t,t=r=Mt(r)):(Dr=t,t=n)):(Dr=t,t=n),t}function ui(){var t,r,i,s,a,o;if(t=Dr,r=Dr,se.test(e.charAt(Dr))?(i=e.charAt(Dr),Dr++):(i=n,0===qr&&Vr(ae)),i!==n)if(te.test(e.charAt(Dr))?(s=e.charAt(Dr),Dr++):(s=n,0===qr&&Vr(ee)),s===n&&(s=null),s!==n){if(a=[],$t.test(e.charAt(Dr))?(o=e.charAt(Dr),Dr++):(o=n,0===qr&&Vr(Ht)),o!==n)for(;o!==n;)a.push(o),$t.test(e.charAt(Dr))?(o=e.charAt(Dr),Dr++):(o=n,0===qr&&Vr(Ht));else a=n;a!==n?r=i=[i,s,a]:(Dr=r,r=n)}else Dr=r,r=n;else Dr=r,r=n;return r!==n?e.substring(t,Dr):r}function ci(){var t,r,i,s,a,o,h,l,u,c,f;return t=Dr,e.substr(Dr,2)===je?(r=je,Dr+=2):(r=n,0===qr&&Vr(Se)),r!==n?(i=Dr,(s=yi())!==n&&(a=yi())!==n&&(o=yi())!==n&&(h=yi())!==n&&(l=yi())!==n&&(u=yi())!==n&&(c=yi())!==n&&(f=yi())!==n?i=s=[s,a,o,h,l,u,c,f]:(Dr=i,i=n),i!==n?(Lr=t,t=r=Fe(i)):(Dr=t,t=n)):(Dr=t,t=n),t===n&&(t=Dr,e.substr(Dr,2)===Ue?(r=Ue,Dr+=2):(r=n,0===qr&&Vr(De)),r!==n?(i=Dr,(s=yi())!==n&&(a=yi())!==n&&(o=yi())!==n&&(h=yi())!==n?i=s=[s,a,o,h]:(Dr=i,i=n),i!==n?(Lr=t,t=r=Le(i)):(Dr=t,t=n)):(Dr=t,t=n)),t}function fi(){var t,r;return t=Dr,e.substr(Dr,2)===Me?(r=Me,Dr+=2):(r=n,0===qr&&Vr(Pe)),r!==n&&(Lr=t,r=Be()),(t=r)===n&&(t=Dr,e.substr(Dr,2)===qe?(r=qe,Dr+=2):(r=n,0===qr&&Vr($e)),r!==n&&(Lr=t,r=He()),(t=r)===n&&(t=Dr,e.substr(Dr,2)===Xe?(r=Xe,Dr+=2):(r=n,0===qr&&Vr(ze)),r!==n&&(Lr=t,r=Qe()),(t=r)===n&&(t=Dr,e.substr(Dr,2)===Ve?(r=Ve,Dr+=2):(r=n,0===qr&&Vr(Ge)),r!==n&&(Lr=t,r=We()),(t=r)===n&&(t=Dr,e.substr(Dr,2)===Ye?(r=Ye,Dr+=2):(r=n,0===qr&&Vr(Ze)),r!==n&&(Lr=t,r=Je()),(t=r)===n&&(t=Dr,e.substr(Dr,2)===Ke?(r=Ke,Dr+=2):(r=n,0===qr&&Vr(tr)),r!==n&&(Lr=t,r=er()),(t=r)===n&&(t=Dr,e.substr(Dr,2)===rr?(r=rr,Dr+=2):(r=n,0===qr&&Vr(ir)),r!==n&&(Lr=t,r=nr()),(t=r)===n&&(t=Dr,e.substr(Dr,2)===sr?(r=sr,Dr+=2):(r=n,0===qr&&Vr(ar)),r!==n&&(Lr=t,r=or()),t=r))))))),t}function di(){var t,r,i;return t=Dr,cr.test(e.charAt(Dr))?(r=e.charAt(Dr),Dr++):(r=n,0===qr&&Vr(fr)),r!==n?(dr.test(e.charAt(Dr))?(i=e.charAt(Dr),Dr++):(i=n,0===qr&&Vr(pr)),i!==n?(Lr=t,t=r=gr(r,i)):(Dr=t,t=n)):(Dr=t,t=n),t===n&&(mr.test(e.charAt(Dr))?(t=e.charAt(Dr),Dr++):(t=n,0===qr&&Vr(wr))),t}function pi(){var t;return(t=di())===n&&(95===e.charCodeAt(Dr)?(t=yr,Dr++):(t=n,0===qr&&Vr(br))),t}function gi(){var t;return(t=pi())===n&&(45===e.charCodeAt(Dr)?(t=Gt,Dr++):(t=n,0===qr&&Vr(Wt)),t===n&&($t.test(e.charAt(Dr))?(t=e.charAt(Dr),Dr++):(t=n,0===qr&&Vr(Ht)),t===n&&(183===e.charCodeAt(Dr)?(t=vr,Dr++):(t=n,0===qr&&Vr(_r)),t===n&&(xr.test(e.charAt(Dr))?(t=e.charAt(Dr),Dr++):(t=n,0===qr&&Vr(Tr)),t===n&&(Ar.test(e.charAt(Dr))?(t=e.charAt(Dr),Dr++):(t=n,0===qr&&Vr(Nr))))))),t}function mi(){var t,r,i,s,a,o,h,l,f;if(t=Dr,r=Dr,(i=di())!==n){for(s=[],a=gi();a!==n;)s.push(a),a=gi();if(s!==n){if(a=[],o=Dr,h=[],46===e.charCodeAt(Dr)?(l=u,Dr++):(l=n,0===qr&&Vr(c)),l!==n)for(;l!==n;)h.push(l),46===e.charCodeAt(Dr)?(l=u,Dr++):(l=n,0===qr&&Vr(c));else h=n;if(h!==n){if(l=[],(f=gi())!==n)for(;f!==n;)l.push(f),f=gi();else l=n;l!==n?o=h=[h,l]:(Dr=o,o=n)}else Dr=o,o=n;for(;o!==n;){if(a.push(o),o=Dr,h=[],46===e.charCodeAt(Dr)?(l=u,Dr++):(l=n,0===qr&&Vr(c)),l!==n)for(;l!==n;)h.push(l),46===e.charCodeAt(Dr)?(l=u,Dr++):(l=n,0===qr&&Vr(c));else h=n;if(h!==n){if(l=[],(f=gi())!==n)for(;f!==n;)l.push(f),f=gi();else l=n;l!==n?o=h=[h,l]:(Dr=o,o=n)}else Dr=o,o=n}a!==n?r=i=[i,s,a]:(Dr=r,r=n)}else Dr=r,r=n}else Dr=r,r=n;return r!==n?e.substring(t,Dr):r}function wi(){var t;return(t=function(){var t,r,i,s,a;return t=Dr,r=Dr,37===e.charCodeAt(Dr)?(i=kr,Dr++):(i=n,0===qr&&Vr(Ir)),i!==n&&(s=yi())!==n&&(a=yi())!==n?r=i=[i,s,a]:(Dr=r,r=n),r!==n?e.substring(t,Dr):r}())===n&&(t=function(){var t,r,i;return t=Dr,92===e.charCodeAt(Dr)?(r=jr,Dr++):(r=n,0===qr&&Vr(Sr)),r!==n?(Fr.test(e.charAt(Dr))?(i=e.charAt(Dr),Dr++):(i=n,0===qr&&Vr(Ur)),i!==n?(Lr=t,t=r=f(i)):(Dr=t,t=n)):(Dr=t,t=n),t}()),t}function yi(){var t;return Cr.test(e.charAt(Dr))?(t=e.charAt(Dr),Dr++):(t=n,0===qr&&Vr(Or)),t}var bi,vi,_i,xi=function(t){return t.match(/^[a-z](.*?):(.+?)/g)},Ti={base:[],data:{},addBase:function(t){if(0===Ti.base.length)return void Ti.base.push(t);const e=Ti.base[Ti.base.length-1];e!==t&&Ti.base.push(new URL(t,e).toString())},addPrefix:function(t,e){const r=Ti.data[t];void 0===r?Ti.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 i=Object.keys(Ti.data).find((e=>0===t.indexOf(e+":")));if(void 0!==i){const r=Ti.data[i];if(1===r.length&&!0!==e&&xi(r[0].uri))return t;const n=r[r.length-1].uri;return t.replace(i+":",n)}var n=0===Ti.base.length?r.baseIRI:Ti.base[Ti.base.length-1];return!n||t.match(/^(http:|https:|urn:|file:)/)?t:0===t.indexOf("//")&&n?n.split("//")[0]+t:new URL(t,n).toString()},increment:function(t){const e=Ti.data[t];void 0!==e&&e[e.length-1].count++},decrement:function(t){const e=Ti.data[t];void 0!==e&&e[e.length-1].count--},toJSON:function(){const t={};return Ti.base.length>0&&(void 0===t["@context"]&&(t["@context"]={}),t["@context"]["@base"]=Ti.base[0]),Object.keys(Ti.data).forEach((e=>{const r=Ti.data[e][0];"http://www.w3.org/2001/XMLSchema#"===r.uri&&r.count<1||xi(r.uri)&&(void 0===t["@context"]&&(t["@context"]={}),t["@context"][e]=r.uri)})),t}};function Ai(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={},i=null;return t["@list"].forEach((t=>{null===i?i=r:(i["http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"]={},i=i["http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"]),i["http://www.w3.org/1999/02/22-rdf-syntax-ns#first"]=Ai(t,!0),i["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=a())!==n&&Dr===e.length)return i;throw i!==n&&Dr<e.length&&Vr({type:"end"}),bi=Br,vi=Pr<e.length?e.charAt(Pr):null,_i=Pr<e.length?Qr(Pr,Pr+1):Qr(Pr,Pr),new t(t.buildMessage(bi,vi),bi,vi,_i)}}})?r.apply(e,[]):r)||(t.exports=i)},2313:(t,e,r)=>{"use strict";const i=r(2504),n=r(9029),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=h,e.IS=50;const a=2147483647;function o(t){if(t>a)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,h.prototype),e}function h(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 c(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"),!h.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|g(t,e);let i=o(r);const n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}(t,e);if(ArrayBuffer.isView(t))return function(t){if(W(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return f(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(W(t,ArrayBuffer)||t&&W(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(W(t,SharedArrayBuffer)||t&&W(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 i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return h.from(i,e,r);const n=function(t){if(h.isBuffer(t)){const e=0|p(t.length),r=o(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||Y(t.length)?o(0):f(t):"Buffer"===t.type&&Array.isArray(t.data)?f(t.data):void 0}(t);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return h.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 u(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 c(t){return u(t),o(t<0?0:0|p(t))}function f(t){const e=t.length<0?0:0|p(t.length),r=o(e);for(let i=0;i<e;i+=1)r[i]=255&t[i];return r}function d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(i,h.prototype),i}function p(t){if(t>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function g(t,e){if(h.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||W(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,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(t).length;default:if(n)return i?-1:Q(t).length;e=(""+e).toLowerCase(),n=!0}}function m(t,e,r){let i=!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 C(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return I(this,e,r);case"base64":return N(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function w(t,e,r){const i=t[e];t[e]=t[r],t[r]=i}function y(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Y(r=+r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=h.from(e,i)),h.isBuffer(e))return 0===e.length?-1:b(t,e,r,i,n);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,i,n){let s,a=1,o=t.length,h=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;a=2,o/=2,h/=2,r/=2}function l(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(n){let i=-1;for(s=r;s<o;s++)if(l(t,s)===l(e,-1===i?0:s-i)){if(-1===i&&(i=s),s-i+1===h)return i*a}else-1!==i&&(s-=s-i),i=-1}else for(r+h>o&&(r=o-h),s=r;s>=0;s--){let r=!0;for(let i=0;i<h;i++)if(l(t,s+i)!==l(e,i)){r=!1;break}if(r)return s}return-1}function v(t,e,r,i){r=Number(r)||0;const n=t.length-r;i?(i=Number(i))>n&&(i=n):i=n;const s=e.length;let a;for(i>s/2&&(i=s/2),a=0;a<i;++a){const i=parseInt(e.substr(2*a,2),16);if(Y(i))return a;t[r+a]=i}return a}function _(t,e,r,i){return G(Q(e,t.length-r),t,r,i)}function x(t,e,r,i){return G(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,i)}function T(t,e,r,i){return G(V(e),t,r,i)}function A(t,e,r,i){return G(function(t,e){let r,i,n;const s=[];for(let a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),i=r>>8,n=r%256,s.push(n),s.push(i);return s}(e,t.length-r),t,r,i)}function N(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);const i=[];let n=e;for(;n<r;){const e=t[n];let s=null,a=e>239?4:e>223?3:e>191?2:1;if(n+a<=r){let r,i,o,h;switch(a){case 1:e<128&&(s=e);break;case 2:r=t[n+1],128==(192&r)&&(h=(31&e)<<6|63&r,h>127&&(s=h));break;case 3:r=t[n+1],i=t[n+2],128==(192&r)&&128==(192&i)&&(h=(15&e)<<12|(63&r)<<6|63&i,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:r=t[n+1],i=t[n+2],o=t[n+3],128==(192&r)&&128==(192&i)&&128==(192&o)&&(h=(15&e)<<18|(63&r)<<12|(63&i)<<6|63&o,h>65535&&h<1114112&&(s=h))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),n+=a}return function(t){const e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);let r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=R));return r}(i)}h.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),h.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(h.prototype,"parent",{enumerable:!0,get:function(){if(h.isBuffer(this))return this.buffer}}),Object.defineProperty(h.prototype,"offset",{enumerable:!0,get:function(){if(h.isBuffer(this))return this.byteOffset}}),h.poolSize=8192,h.from=function(t,e,r){return l(t,e,r)},Object.setPrototypeOf(h.prototype,Uint8Array.prototype),Object.setPrototypeOf(h,Uint8Array),h.alloc=function(t,e,r){return function(t,e,r){return u(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}(t,e,r)},h.allocUnsafe=function(t){return c(t)},h.allocUnsafeSlow=function(t){return c(t)},h.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==h.prototype},h.compare=function(t,e){if(W(t,Uint8Array)&&(t=h.from(t,t.offset,t.byteLength)),W(e,Uint8Array)&&(e=h.from(e,e.offset,e.byteLength)),!h.isBuffer(t)||!h.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,i=e.length;for(let n=0,s=Math.min(r,i);n<s;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:i<r?1:0},h.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},h.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return h.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const i=h.allocUnsafe(e);let n=0;for(r=0;r<t.length;++r){let e=t[r];if(W(e,Uint8Array))n+e.length>i.length?(h.isBuffer(e)||(e=h.from(e)),e.copy(i,n)):Uint8Array.prototype.set.call(i,e,n);else{if(!h.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(i,n)}n+=e.length}return i},h.byteLength=g,h.prototype._isBuffer=!0,h.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;e<t;e+=2)w(this,e,e+1);return this},h.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)w(this,e,e+3),w(this,e+1,e+2);return this},h.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},h.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?E(this,0,t):m.apply(this,arguments)},h.prototype.toLocaleString=h.prototype.toString,h.prototype.equals=function(t){if(!h.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===h.compare(this,t)},h.prototype.inspect=function(){let t="";const r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},s&&(h.prototype[s]=h.prototype.inspect),h.prototype.compare=function(t,e,r,i,n){if(W(t,Uint8Array)&&(t=h.from(t,t.offset,t.byteLength)),!h.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===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;let s=(n>>>=0)-(i>>>=0),a=(r>>>=0)-(e>>>=0);const o=Math.min(s,a),l=this.slice(i,n),u=t.slice(e,r);for(let t=0;t<o;++t)if(l[t]!==u[t]){s=l[t],a=u[t];break}return s<a?-1:a<s?1:0},h.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},h.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},h.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},h.prototype.write=function(t,e,r,i){if(void 0===e)i="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)i=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}const n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":case"latin1":case"binary":return x(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function k(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(127&t[n]);return i}function I(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function C(t,e,r){const i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);let n="";for(let i=e;i<r;++i)n+=Z[t[i]];return n}function O(t,e,r){const i=t.slice(e,r);let n="";for(let t=0;t<i.length-1;t+=2)n+=String.fromCharCode(i[t]+256*i[t+1]);return n}function j(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function S(t,e,r,i,n,s){if(!h.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}function F(t,e,r,i,n){$(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s;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,i,n){$(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s>>=8,t[r+6]=s,s>>=8,t[r+5]=s,s>>=8,t[r+4]=s;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,i,n,s){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(t,e,r,i,s){return e=+e,r>>>=0,s||D(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function M(t,e,r,i,s){return e=+e,r>>>=0,s||D(t,0,r,8),n.write(t,e,r,i,52,8),r+8}h.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<t&&(e=t);const i=this.subarray(t,e);return Object.setPrototypeOf(i,h.prototype),i},h.prototype.readUintLE=h.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);let i=this[t],n=1,s=0;for(;++s<e&&(n*=256);)i+=this[t+s]*n;return i},h.prototype.readUintBE=h.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);let i=this[t+--e],n=1;for(;e>0&&(n*=256);)i+=this[t+--e]*n;return i},h.prototype.readUint8=h.prototype.readUInt8=function(t,e){return t>>>=0,e||j(t,1,this.length),this[t]},h.prototype.readUint16LE=h.prototype.readUInt16LE=function(t,e){return t>>>=0,e||j(t,2,this.length),this[t]|this[t+1]<<8},h.prototype.readUint16BE=h.prototype.readUInt16BE=function(t,e){return t>>>=0,e||j(t,2,this.length),this[t]<<8|this[t+1]},h.prototype.readUint32LE=h.prototype.readUInt32LE=function(t,e){return t>>>=0,e||j(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},h.prototype.readUint32BE=h.prototype.readUInt32BE=function(t,e){return t>>>=0,e||j(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},h.prototype.readBigUInt64LE=J((function(t){H(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||X(t,this.length-8);const i=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,n=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(i)+(BigInt(n)<<BigInt(32))})),h.prototype.readBigUInt64BE=J((function(t){H(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||X(t,this.length-8);const i=e*2**24+65536*this[++t]+256*this[++t]+this[++t],n=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(i)<<BigInt(32))+BigInt(n)})),h.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);let i=this[t],n=1,s=0;for(;++s<e&&(n*=256);)i+=this[t+s]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*e)),i},h.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||j(t,e,this.length);let i=e,n=1,s=this[t+--i];for(;i>0&&(n*=256);)s+=this[t+--i]*n;return n*=128,s>=n&&(s-=Math.pow(2,8*e)),s},h.prototype.readInt8=function(t,e){return t>>>=0,e||j(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},h.prototype.readInt16LE=function(t,e){t>>>=0,e||j(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt16BE=function(t,e){t>>>=0,e||j(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt32LE=function(t,e){return t>>>=0,e||j(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},h.prototype.readInt32BE=function(t,e){return t>>>=0,e||j(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},h.prototype.readBigInt64LE=J((function(t){H(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||X(t,this.length-8);const i=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(i)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),h.prototype.readBigInt64BE=J((function(t){H(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||X(t,this.length-8);const i=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),h.prototype.readFloatLE=function(t,e){return t>>>=0,e||j(t,4,this.length),n.read(this,t,!0,23,4)},h.prototype.readFloatBE=function(t,e){return t>>>=0,e||j(t,4,this.length),n.read(this,t,!1,23,4)},h.prototype.readDoubleLE=function(t,e){return t>>>=0,e||j(t,8,this.length),n.read(this,t,!0,52,8)},h.prototype.readDoubleBE=function(t,e){return t>>>=0,e||j(t,8,this.length),n.read(this,t,!1,52,8)},h.prototype.writeUintLE=h.prototype.writeUIntLE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||S(this,t,e,r,Math.pow(2,8*r)-1,0);let n=1,s=0;for(this[e]=255&t;++s<r&&(n*=256);)this[e+s]=t/n&255;return e+r},h.prototype.writeUintBE=h.prototype.writeUIntBE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||S(this,t,e,r,Math.pow(2,8*r)-1,0);let n=r-1,s=1;for(this[e+n]=255&t;--n>=0&&(s*=256);)this[e+n]=t/s&255;return e+r},h.prototype.writeUint8=h.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,1,255,0),this[e]=255&t,e+1},h.prototype.writeUint16LE=h.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},h.prototype.writeUint16BE=h.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},h.prototype.writeUint32LE=h.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||S(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},h.prototype.writeUint32BE=h.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||S(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},h.prototype.writeBigUInt64LE=J((function(t,e=0){return F(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),h.prototype.writeBigUInt64BE=J((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),h.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e>>>=0,!i){const i=Math.pow(2,8*r-1);S(this,t,e,r,i-1,-i)}let n=0,s=1,a=0;for(this[e]=255&t;++n<r&&(s*=256);)t<0&&0===a&&0!==this[e+n-1]&&(a=1),this[e+n]=(t/s|0)-a&255;return e+r},h.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e>>>=0,!i){const i=Math.pow(2,8*r-1);S(this,t,e,r,i-1,-i)}let n=r-1,s=1,a=0;for(this[e+n]=255&t;--n>=0&&(s*=256);)t<0&&0===a&&0!==this[e+n+1]&&(a=1),this[e+n]=(t/s|0)-a&255;return e+r},h.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},h.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},h.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},h.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||S(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},h.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||S(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},h.prototype.writeBigInt64LE=J((function(t,e=0){return F(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),h.prototype.writeBigInt64BE=J((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),h.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},h.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},h.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},h.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},h.prototype.copy=function(t,e,r,i){if(!h.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);const n=i-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,i):Uint8Array.prototype.set.call(t,this.subarray(r,i),e),n},h.prototype.fill=function(t,e,r,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!h.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){const e=t.charCodeAt(0);("utf8"===i&&e<128||"latin1"===i)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let n;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(n=e;n<r;++n)this[n]=t;else{const s=h.isBuffer(t)?t:h.from(t,i),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(n=0;n<r-e;++n)this[n+e]=s[n%a]}return this};const P={};function B(t,e,r){P[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function q(t){let e="",r=t.length;const i="-"===t[0]?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function $(t,e,r,i,n,s){if(t>r||t<e){const i="bigint"==typeof e?"n":"";let n;throw n=s>3?0===e||e===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${e}${i} and <= ${r}${i}`,new P.ERR_OUT_OF_RANGE("value",n,t)}!function(t,e,r){H(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||X(e,t.length-(r+1))}(i,n,s)}function H(t,e){if("number"!=typeof t)throw new P.ERR_INVALID_ARG_TYPE(e,"number",t)}function X(t,e,r){if(Math.floor(t)!==t)throw H(t,r),new P.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new P.ERR_BUFFER_OUT_OF_BOUNDS;throw new P.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}B("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),B("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),B("ERR_OUT_OF_RANGE",(function(t,e,r){let i=`The value of "${t}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=q(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=q(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i}),RangeError);const z=/[^+/0-9A-Za-z-_]/g;function Q(t,e){let r;e=e||1/0;const i=t.length;let n=null;const s=[];for(let a=0;a<i;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(a+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.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;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function V(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function G(t,e,r,i){let n;for(n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function W(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Y(t){return t!=t}const Z=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const i=16*r;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e}();function J(t){return"undefined"==typeof BigInt?K:t}function K(){throw new Error("BigInt not supported")}},2504:(t,e)=>{"use strict";e.byteLength=function(t){var e=o(t),r=e[0],i=e[1];return 3*(r+i)/4-i},e.toByteArray=function(t){var e,r,s=o(t),a=s[0],h=s[1],l=new n(function(t,e,r){return 3*(e+r)/4-r}(0,a,h)),u=0,c=h>0?a-4:a;for(r=0;r<c;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],l[u++]=e>>16&255,l[u++]=e>>8&255,l[u++]=255&e;return 2===h&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,l[u++]=255&e),1===h&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,l[u++]=e>>8&255,l[u++]=255&e),l},e.fromByteArray=function(t){for(var e,i=t.length,n=i%3,s=[],a=16383,o=0,l=i-n;o<l;o+=a)s.push(h(t,o,o+a>l?l:o+a));return 1===n?(e=t[i-1],s.push(r[e>>2]+r[e<<4&63]+"==")):2===n&&(e=(t[i-2]<<8)+t[i-1],s.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),s.join("")};for(var r=[],i=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function o(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 h(t,e,i){for(var n,s,a=[],o=e;o<i;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),a.push(r[(s=n)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},3627:(t,e,r)=>{"use strict";r.d(e,{A:()=>l});var i=r(939),n=r(9390),s=r(1605),a=r(6866),o=r(362),h=r(546);class l extends s.A{constructor(t){if(super((0,o.E)(t)),(0,i.A)(this,"termType",a.Kk),(0,i.A)(this,"classOrder",n.A.NamedNode),!this.value)throw new Error("Missing IRI for NamedNode");if(!this.value.includes(":"))throw new Error('NamedNode IRI "'+t+'" must be absolute.');if(this.value.includes(" "))throw new Error('Error: NamedNode IRI "'+t+'" must not contain unencoded spaces.')}dir(){var t=this.value.split("#")[0],e=t.slice(0,-1).lastIndexOf("/"),r=t.indexOf("//");return r>=0&&e<r+2||e<0?null:new l(t.slice(0,e+1))}site(){var t=this.value.split("#")[0],e=t.indexOf("//");if(e<0)throw new Error("This URI does not have a web site part (origin)");var r=t.indexOf("/",e+2);return new l(r<0?t.slice(0)+"/":t.slice(0,r+1))}doc(){return this.value.indexOf("#")<0?this:new l(this.value.split("#")[0])}toString(){return"<"+this.value+">"}id(){return this.value.split("#")[1]}get uri(){return this.value}set uri(t){this.value=t}static fromValue(t){return null==t||(0,h.D0)(t)?t:new l(t)}}},3787:(t,e,r)=>{"use strict";r.d(e,{A:()=>i});const i={debug(t){},warn(t){},info(t){},error(t){},success(t){},msg(t){}}},4221:(t,e,r)=>{"use strict";r.r(e),r.d(e,{docpart:()=>s,document:()=>a,hostpart:()=>o,join:()=>h,protocol:()=>l,refTo:()=>u});var i=r(3627),n=n||console.log;function s(t){var e;return(e=t.indexOf("#"))<0?t:t.slice(0,e)}function a(t){return new i.A(s(t))}function o(t){var e=/[^\/]*\/\/([^\/]*)\//.exec(t);return e?e[1]:""}function h(t,e){var r,i,s,a,o,h=e.indexOf("#");if(h>0&&(e=e.slice(0,h)),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 n("Invalid base: "+e+" in join with given: "+t),t;if(i=e.slice(0,+r+1||9e9),0===t.indexOf("//"))return i+t;if(e.indexOf("//",r)===r+1){if((s=e.indexOf("/",r+3))<0)return e.length-r-3>0?e+"/"+t:i+t}else if((s=e.indexOf("/",r+1))<0)return e.length-r-1>0?e+"/"+t:i+t;if(0===t.indexOf("/"))return e.slice(0,s)+t;if((a=(o=e.slice(s)).lastIndexOf("/"))<0)return i+t;for(a>=0&&a<o.length-1&&(o=o.slice(0,+a+1||9e9)),o+=t;o.match(/[^\/]*\/\.\.\//);)o=o.replace(/[^\/]*\/\.\.\//,"");return o=(o=o.replace(/\.\//g,"")).replace(/\/\.$/,"/"),e.slice(0,s)+o}function l(t){const e=t.indexOf(":");return e<0?null:t.slice(0,e)}function u(t,e){var r,i,n,s,a,o,h,l,u,c,f,d,p=new RegExp("^[-_a-zA-Z0-9.]+:(//[^/]*)?/[^/]*$");if(!t)return e;if(t===e)return"";for(r=h=0,s=e.length;h<s&&e[r]===t[r];r=++h);if(t.slice(0,r).match(p)&&((i=e.indexOf("//"))<0&&(i=-2),n=e.indexOf("/",i+2),"/"!==e[n+1]&&"/"!==t[n+1]&&e.slice(0,n)===t.slice(0,n)))return e.slice(n);if("#"===e[r]&&t.length===r)return e.slice(r);for(;r>0&&"/"!==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(o=0,l=0,a=(c=t.slice(r)).length;l<a;l++)"/"===c[l]&&o++;if(0===o&&r<e.length&&"#"===e[r])return"./"+e.slice(r);if(0===o&&r===e.length)return"./";if(d="",o>0)for(u=1,f=o;f>=1?u<=f:u>=f;f>=1?++u:--u)d+="../";return d+e.slice(r)}},6866:(t,e,r)=>{"use strict";r.d(e,{$Q:()=>n,BR:()=>g,Fn:()=>v,H:()=>T,JG:()=>y,K9:()=>b,Kk:()=>i,MG:()=>p,P2:()=>a,QW:()=>s,S:()=>l,_0:()=>m,bD:()=>u,bM:()=>w,hu:()=>x,i2:()=>f,ic:()=>o,lc:()=>c,ny:()=>d,r0:()=>h,sT:()=>_});const i="NamedNode",n="BlankNode",s="Literal",a="Variable",o="DefaultGraph",h="Collection",l="Empty",u="Graph",c="text/html",f="application/ld+json",d="text/n3",p="application/n3",g="application/nquads",m="application/n-quads",w="application/n-triples",y="application/rdf+xml",b="application/sparql-update",v="application/sparql-update-single-match",_="text/turtle",x="application/x-turtle",T="application/xhtml+xml"},7114:(t,e,r)=>{"use strict";r.r(e),r.d(e,{DOMParserFactory:()=>c,RDFArrayRemove:()=>b,callbackify:()=>u,domToString:()=>f,dtstamp:()=>p,dumpNode:()=>d,heavyCompare:()=>g,heavyCompareSPO:()=>m,linkRelationProperty:()=>l,log:()=>i.A,mediaTypeClass:()=>h,output:()=>w,parseXML:()=>y,stackString:()=>_,string:()=>o,string_startswith:()=>v,uri:()=>n});var i=r(3787),n=r(4221),s=r(3627),a=r(8392);t=r.hmd(t);const o={template:function(t,e){for(var r=t.split("%s"),i="",n=0;n<e.length;n++)e[n]+="",i+=r[n]+e[n];return i+r.slice(e.length).join()}};function h(t){return t=t.split(";")[0].trim(),new s.A("http://www.w3.org/ns/iana/media-types/"+t+"#Resource")}function l(t){return new s.A("http://www.w3.org/ns/iana/link-relations/relation#"+t.trim())}function u(t,e){t.callbacks={};for(var r=e.length-1;r>=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 i=0;i<t.callbacks[e].length;i++)if(t.callbacks[e][i].name===r)return t.callbacks[e].splice(i,1),!0;return!1},t.insertCallback=function(e,r){t.callbacks[e].unshift(r)},t.fireCallbacks=function(e,r){var i,n=[],s=[],a=t.callbacks[e].length;let o;for(i=a-1;i>=0;i--)o=t.callbacks[e][i],o&&o.apply(t,r)&&n.push(o);for(i=n.length-1;i>=0;i--)s.push(n[i]);for(i=a;i<t.callbacks[e].length;i++)s.push(t.callbacks[e][i]);t.callbacks[e]=s}}function c(){return window.DOMParser?new a.DOMParser:!!window.ActiveXObject&&new ActiveXObject("Microsoft.XMLDOM")}function f(t,e){var r=[];(e=e||{})&&e.selfClosing&&e.selfClosing.split(" ").forEach((function(t){r[t]=!0}));var i=[];return e&&e.skipAttributes&&e.skipAttributes.split(" ").forEach((function(t){i[t]=!0})),d(t,e,r,i)}function d(t,e,r,i){var n,s="",a=[!1];if(void 0===t.nodeType)return s;if(1===t.nodeType){if(t.hasAttribute("class")&&e&&e.classWithChildText&&t.matches(e.classWithChildText.class))s+=t.querySelector(e.classWithChildText.element).textContent;else if(!(e&&e.skipNodeWithClass&&t.matches("."+e.skipNodeWithClass))){var o=t.nodeName.toLowerCase();s+="<"+o;var h=[];for(n=t.attributes.length-1;n>=0;n--){var l=t.attributes[n];if(!(i&&i.length>0&&i[l.name]||/^\d+$/.test(l.name))){if("class"===l.name&&e&&e.replaceClassItemWith&&l.value.split(" ").indexOf(e.replaceClassItemWith.source)>-1){var u=new RegExp(e.replaceClassItemWith.source,"g");l.value=l.value.replace(u,e.replaceClassItemWith.target).trim()}"class"===l.name&&e&&e.skipClassWithValue&&e.skipClassWithValue===l.value||h.push(l.name+"='"+l.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,""")+"'")}}if(h.length>0&&(e&&e.sortAttributes&&h.sort((function(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())})),s+=" "+h.join(" ")),r&&r.ename)s+=" />";else{for(s+=">",s+="html"===o?"\n ":"",a.push("style"===o||"script"===o),n=0;n<t.childNodes.length;n++)s+=d(t.childNodes[n]);a.pop(),s+="body"===o?"</"+o+">\n":"</"+o+">"}}}else if(8===t.nodeType)s+="\x3c!--"+t.nodeValue+"--\x3e";else if(3===t.nodeType||4===t.nodeType){var c=t.nodeValue.replace(/\n+$/,"");s+=a[a.length-1]?c:c.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}else console.log("Warning; Cannot handle serialising nodes of type: "+t.nodeType),console.log(t);return s}function p(){var t=new Date,e=t.getYear()+1900,r=t.getMonth()+1,i=t.getDate(),n=t.getUTCHours(),s=t.getUTCMinutes(),a=t.getSeconds();return r<10&&(r="0"+r),i<10&&(i="0"+i),n<10&&(n="0"+n),s<10&&(s="0"+s),a<10&&(a="0"+a),e+"-"+r+"-"+i+"T"+n+":"+s+":"+a+"Z"}function g(t,e,r,i){var n=function(t){return"BlankNode"===t.termType?null:t},s=function(t){var e=r.statementsMatching(t).map((function(t){return n(t.subject)+" "+n(t.predicate)+" "+n(t.object)})).concat(r.statementsMatching(void 0,void 0,t).map((function(t){return n(t.subject)+" "+n(t.predicate)+" "+n(t.object)})));return e.sort(),e.join("\n")};const a=Object.prototype.hasOwnProperty.call(r,"compareTerms")?r.compareTerms(t,e):t.compareTerm(e);return"BlankNode"===t.termType&&"BlankNode"===e.termType?0===a?0:s(t)>s(e)?1:s(t)<s(e)?-1:a:i&&t.uri&&e.uri?(i[t.uri]||t.uri).localeCompare(i[e.uri]||e.uri):a}function m(t,e,r,i){return g(t.subject,e.subject,r,i)||g(t.predicate,e.predicate,r,i)||g(t.object,e.object,r,i)}function w(t){var e=document.createElement("div");e.textContent=t,document.body.appendChild(e)}function y(e,r){return r=r||{},t&&t.exports?(new a.DOMParser).parseFromString(e,r.contentType||"application/xhtml+xml"):("undefined"!=typeof window&&window.DOMParser?new window.DOMParser:new a.DOMParser).parseFromString(e,"application/xml")}function b(t,e){for(var r=0;r<t.length;r++)if(t[r].subject.equals(e.subject)&&t[r].predicate.equals(e.predicate)&&t[r].object.equals(e.object)&&t[r].why.equals(e.why))return void t.splice(r,1);throw new Error("RDFArrayRemove: Array did not contain "+e+" "+e.why)}function v(t,e){return t.slice(0,e.length)===e}function _(t){var e=t+"\n";if(!t.stack)return e+"No stack available.\n";for(var r=t.stack.toString().split("\n"),i=[],n=0;n<r.length;n++){var s=r[n];if(s.indexOf("ecmaunit.js")>-1)break;"("==s.charAt(0)&&(s="function"+s);var a=s.split("@");i.push(a)}for(n=0;n<i.length;n++)e+=" "+i[n][1]+"\n "+i[n][0];return e}},8392:e=>{"use strict";e.exports=t},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#",bookmark:"http://www.w3.org/2002/01/bookmark#",cal:"http://www.w3.org/2002/12/cal/ical#",cco:"http://www.ontologyrepository.com/CommonCoreOntologies/",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#",gr:"http://purl.org/goodrelations/v1#",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#",pto:"http://www.productontology.org/id/",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#",skos:"http://www.w3.org/2004/02/skos/core#",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#",vann:"http://purl.org/vocab/vann/",vcard:"http://www.w3.org/2006/vcard/ns#",wf:"http://www.w3.org/2005/01/wf/flow#",xsd:"http://www.w3.org/2001/XMLSchema#"};t.exports=function(t={namedNode:t=>t}){const r={};for(const i in e){const n=e[i];r[i]=function(e=""){return t.namedNode(n+e)}}return r}},9029:(t,e)=>{e.read=function(t,e,r,i,n){var s,a,o=8*n-i-1,h=(1<<o)-1,l=h>>1,u=-7,c=r?n-1:0,f=r?-1:1,d=t[e+c];for(c+=f,s=d&(1<<-u)-1,d>>=-u,u+=o;u>0;s=256*s+t[e+c],c+=f,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=i;u>0;a=256*a+t[e+c],c+=f,u-=8);if(0===s)s=1-l;else{if(s===h)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,i),s-=l}return(d?-1:1)*a*Math.pow(2,s-i)},e.write=function(t,e,r,i,n,s){var a,o,h,l=8*s-n-1,u=(1<<l)-1,c=u>>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:s-1,p=i?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-a))<1&&(a--,h*=2),(e+=a+c>=1?f/h:f*Math.pow(2,1-c))*h>=2&&(a++,h/=2),a+c>=u?(o=0,a=u):a+c>=1?(o=(e*h-1)*Math.pow(2,n),a+=c):(o=e*Math.pow(2,c-1)*Math.pow(2,n),a=0));n>=8;t[r+d]=255&o,d+=p,o/=256,n-=8);for(a=a<<n|o,l+=n;l>0;t[r+d]=255&a,d+=p,a/=256,l-=8);t[r+d-p]|=128*g}},9390:(t,e,r)=>{"use strict";r.d(e,{A:()=>i});const i={Literal:1,Collection:3,Graph:4,NamedNode:5,BlankNode:6,Variable:7}}},a={};function o(t){var e=a[t];if(void 0!==e)return e.exports;var r=a[t]={id:t,loaded:!1,exports:{}};return s[t].call(r.exports,r,r.exports,o),r.loaded=!0,r.exports}o.m=s,o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},r=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,o.t=function(t,i){if(1&i&&(t=this(t)),8&i)return t;if("object"==typeof t&&t){if(4&i&&t.__esModule)return t;if(16&i&&"function"==typeof t.then)return t}var n=Object.create(null);o.r(n);var s={};e=e||[null,r({}),r([]),r(r)];for(var a=2&i&&t;("object"==typeof a||"function"==typeof a)&&!~e.indexOf(a);a=r(a))Object.getOwnPropertyNames(a).forEach((e=>s[e]=()=>t[e]));return s.default=()=>t,o.d(n,s),n},o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.f={},o.e=t=>Promise.all(Object.keys(o.f).reduce(((e,r)=>(o.f[r](t,e),e)),[])),o.u=t=>t+".rdflib.min.js",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.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),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i={},n="$rdf:",o.l=(t,e,r,s)=>{if(i[t])i[t].push(e);else{var a,h;if(void 0!==r)for(var l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var c=l[u];if(c.getAttribute("src")==t||c.getAttribute("data-webpack")==n+r){a=c;break}}a||(h=!0,(a=document.createElement("script")).charset="utf-8",o.nc&&a.setAttribute("nonce",o.nc),a.setAttribute("data-webpack",n+r),a.src=t),i[t]=[e];var f=(e,r)=>{a.onerror=a.onload=null,clearTimeout(d);var n=i[t];if(delete i[t],a.parentNode&&a.parentNode.removeChild(a),n&&n.forEach((t=>t(r))),e)return e(r)},d=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),h&&document.head.appendChild(a)}},o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;o.g.importScripts&&(t=o.g.location+"");var e=o.g.document;if(!t&&e&&(e.currentScript&&"SCRIPT"===e.currentScript.tagName.toUpperCase()&&(t=e.currentScript.src),!t)){var r=e.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!t||!/^http(s?):/.test(t));)t=r[i--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=t})(),(()=>{var t={792:0};o.f.j=(e,r)=>{var i=o.o(t,e)?t[e]:void 0;if(0!==i)if(i)r.push(i[2]);else{var n=new Promise(((r,n)=>i=t[e]=[r,n]));r.push(i[2]=n);var s=o.p+o.u(e),a=new Error;o.l(s,(r=>{if(o.o(t,e)&&(0!==(i=t[e])&&(t[e]=void 0),i)){var n=r&&("load"===r.type?"missing":r.type),s=r&&r.target&&r.target.src;a.message="Loading chunk "+e+" failed.\n("+n+": "+s+")",a.name="ChunkLoadError",a.type=n,a.request=s,i[1](a)}}),"chunk-"+e,e)}};var e=(e,r)=>{var i,n,[s,a,h]=r,l=0;if(s.some((e=>0!==t[e]))){for(i in a)o.o(a,i)&&(o.m[i]=a[i]);h&&h(o)}for(e&&e(r);l<s.length;l++)n=s[l],o.o(t,n)&&t[n]&&t[n][0](),t[n]=0},r=self.webpackChunk$rdf=self.webpackChunk$rdf||[];r.forEach(e.bind(null,0)),r.push=e.bind(null,r.push.bind(r))})();var h={};return(()=>{"use strict";o.r(h),o.d(h,{BlankNode:()=>n,Collection:()=>f,ConnectedStore:()=>rr,DataFactory:()=>Le,Empty:()=>d,Fetcher:()=>Oe,Formula:()=>P,IndexedFormula:()=>G,Literal:()=>u,LiveStore:()=>ir,N3Parser:()=>yt,NamedNode:()=>s.A,Namespace:()=>E,NextId:()=>er,Node:()=>B,Query:()=>$,RDFParser:()=>ce,RDFaProcessor:()=>le,SPARQLToQuery:()=>Fe,Serializer:()=>j,Statement:()=>y,Store:()=>G,UpdateManager:()=>Ue,UpdatesSocket:()=>Me,UpdatesVia:()=>Pe,Util:()=>C,Variable:()=>v,blankNode:()=>Ve,defaultGraph:()=>Ge,fetcher:()=>qe,fromNT:()=>Ke,graph:()=>$e,isBlankNode:()=>a.jt,isCollection:()=>a.P3,isGraph:()=>a.RN,isLiteral:()=>a.c$,isNamedNode:()=>a.Y2,isPredicate:()=>a.YC,isQuad:()=>a.aF,isRDFObject:()=>a.GE,isRDFlibObject:()=>a.DJ,isRDFlibPredicate:()=>a.fY,isRDFlibSubject:()=>a.CZ,isStatement:()=>a.SH,isStore:()=>a.ok,isSubject:()=>a.hr,isTerm:()=>a.D0,isVariable:()=>a.DZ,jsonParser:()=>je,lit:()=>He,literal:()=>We,log:()=>N.A,namedNode:()=>ze,parse:()=>de,quad:()=>Ye,queryToSPARQL:()=>Se,serialize:()=>F,sparqlUpdateParser:()=>fe,st:()=>Xe,sym:()=>ze,term:()=>tr,termValue:()=>me.E,triple:()=>Ze,uri:()=>b,variable:()=>Qe});var t=o(939),e=o(9390),r=o(1605),i=o(6866);class n extends r.A{static getId(t){if(t){if("string"!=typeof t)throw new Error("Bad id argument to new blank node: "+t);if(t.includes("#")){let e=t.split("#");return e[e.length-1]}return t}return"n"+n.nextId++}constructor(r){super(n.getId(r)),(0,t.A)(this,"termType",i.$Q),(0,t.A)(this,"classOrder",e.A.BlankNode),(0,t.A)(this,"isBlank",1),(0,t.A)(this,"isVar",1)}get id(){return this.value}set id(t){this.value=t}compareTerm(t){return this.classOrder<t.classOrder?-1:this.classOrder>t.classOrder?1:this.id<t.id?-1:this.id>t.id?1:0}copy(t){var e=new n;return t.copyTo(this,e),e}toCanonical(){return n.NTAnonymousNodePrefix+this.value}toString(){return n.NTAnonymousNodePrefix+this.id}}(0,t.A)(n,"nextId",0),(0,t.A)(n,"NTAnonymousNodePrefix","_:");var s=o(3627),a=o(546);const l={boolean:new s.A("http://www.w3.org/2001/XMLSchema#boolean"),dateTime:new s.A("http://www.w3.org/2001/XMLSchema#dateTime"),decimal:new s.A("http://www.w3.org/2001/XMLSchema#decimal"),double:new s.A("http://www.w3.org/2001/XMLSchema#double"),integer:new s.A("http://www.w3.org/2001/XMLSchema#integer"),langString:new s.A("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),string:new s.A("http://www.w3.org/2001/XMLSchema#string")};class u extends r.A{constructor(r,n,a){super(r),(0,t.A)(this,"termType",i.QW),(0,t.A)(this,"classOrder",e.A.Literal),(0,t.A)(this,"datatype",l.string),(0,t.A)(this,"isVar",0),(0,t.A)(this,"language",""),n?(this.language=n,this.datatype=l.langString):this.datatype=a?s.A.fromValue(a):l.string}copy(){return new u(this.value,this.lang,this.datatype)}equals(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))}get lang(){return this.language}set lang(t){this.language=t||""}toNT(){return u.toNT(this)}static toNT(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(l.string)||(e+="^^"+t.datatype.toCanonical()),e}toString(){return""+this.value}static fromBoolean(t){return new u(t?"1":"0",null,l.boolean)}static fromDate(t){if(!(t instanceof Date))throw new TypeError("Invalid argument to Literal.fromDate()");let e=function(t){return(""+(100+t)).slice(1,3)},r=t.getUTCFullYear()+"-"+e(t.getUTCMonth()+1)+"-"+e(t.getUTCDate())+"T"+e(t.getUTCHours())+":"+e(t.getUTCMinutes())+":"+e(t.getUTCSeconds())+"Z";return new u(r,null,l.dateTime)}static fromNumber(t){if("number"!=typeof t)throw new TypeError("Invalid argument to Literal.fromNumber()");let e;const r=t.toString();return e=r.indexOf("e")<0&&Math.abs(t)<=Number.MAX_SAFE_INTEGER?Number.isInteger(t)?l.integer:l.decimal:l.double,new u(r,null,e)}static fromValue(t){if((0,a.c$)(t))return t;switch(typeof t){case"object":if(t instanceof Date)return u.fromDate(t);case"boolean":return u.fromBoolean(t);case"number":return u.fromNumber(t);case"string":return new u(t)}throw new Error("Can't make literal from "+t+" of type "+typeof t)}}function c(t){return null==t||(0,a.D0)(t)?t:Array.isArray(t)?new f(t):u.fromValue(t)}class f extends r.A{constructor(r){super((n.nextId++).toString()),(0,t.A)(this,"termType",i.r0),(0,t.A)(this,"classOrder",e.A.Collection),(0,t.A)(this,"closed",!1),(0,t.A)(this,"compareTerm",n.prototype.compareTerm),(0,t.A)(this,"elements",[]),(0,t.A)(this,"isVar",0),r&&r.length>0&&r.forEach((t=>{this.elements.push(c(t))}))}get id(){return this.value}set id(t){this.value=t}append(t){return this.elements.push(t)}close(){return this.closed=!0,this.closed}shift(){return this.elements.shift()}substitute(t){const e=this.elements.map((e=>e.substitute(t)));return new f(e)}toNT(){return f.toNT(this)}static toNT(t){return n.NTAnonymousNodePrefix+t.id}toString(){return"("+this.elements.join(" ")+")"}unshift(t){return this.elements.unshift(t)}}(0,t.A)(f,"termType",i.r0);class d extends r.A{constructor(){super(""),(0,t.A)(this,"termType",i.S)}toString(){return"()"}}const p="chrome:theSession";new s.A(p);class g extends r.A{constructor(){super(""),(0,t.A)(this,"value",""),(0,t.A)(this,"termType",i.ic),(0,t.A)(this,"uri",p)}toCanonical(){return this.value}toString(){return"DefaultGraph"}}function m(t){return!!t&&t.termType===i.ic}const w=new g;class y{constructor(e,i,n,s){(0,t.A)(this,"subject",void 0),(0,t.A)(this,"predicate",void 0),(0,t.A)(this,"object",void 0),(0,t.A)(this,"graph",void 0),this.subject=r.A.fromValue(e),this.predicate=r.A.fromValue(i),this.object=r.A.fromValue(n),this.graph=null==s?w:r.A.fromValue(s)}get why(){return this.graph}set why(t){this.graph=t}equals(t){return t.subject.equals(this.subject)&&t.predicate.equals(this.predicate)&&t.object.equals(this.object)&&t.graph.equals(this.graph)}substitute(t){return new y(this.subject.substitute(t),this.predicate.substitute(t),this.object.substitute(t),m(this.graph)?this.graph:this.graph.substitute(t))}toCanonical(){let t=[this.subject.toCanonical(),this.predicate.toCanonical(),this.object.toCanonical()];return this.graph&&this.graph.termType!==i.ic&&t.push(this.graph.toCanonical()),t.join(" ")+" ."}toNT(){return[this.subject.toNT(),this.predicate.toNT(),this.object.toNT()].join(" ")+" ."}toNQ(){return[this.subject.toNT(),this.predicate.toNT(),this.object.toNT(),m(this.graph)?"":this.graph.toNT()].join(" ")+" ."}toString(){return this.toNT()}}var b=o(4221);class v extends r.A{constructor(r=""){super(r),(0,t.A)(this,"termType",i.P2),(0,t.A)(this,"base","varid:"),(0,t.A)(this,"classOrder",e.A.Variable),(0,t.A)(this,"isVar",1),(0,t.A)(this,"uri",void 0),this.base="varid:",this.uri=b.join(r,this.base)}equals(t){return!!t&&this.termType===t.termType&&this.value===t.value}hashString(){return this.toString()}substitute(t){var e;return null!=(e=t[this.toNT()])?e:this}toString(){return v.toString(this)}static toString(t){return t.uri.slice(0,t.base.length)===t.base?`?${t.uri.slice(t.base.length)}`:`?${t.uri}`}}let _=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}({});const x=new g,T={supports:{[_.collections]:!1,[_.defaultGraphType]:!1,[_.equalsMethod]:!0,[_.identity]:!1,[_.id]:!0,[_.reversibleId]:!1,[_.variableType]:!0},blankNode:t=>new n(t),defaultGraph:()=>x,equals(t,e){return t===e||!t||!e||((0,a.aF)(t)||(0,a.aF)(e)?!(!(0,a.aF)(t)||!(0,a.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,a.D0)(t)||!(0,a.D0)(e))&&this.id(t)===this.id(e))},id(t){if(!t)return"undefined";if((0,a.aF)(t))return this.quadToNQ(t);switch(t.termType){case i.ic:return"defaultGraph";case i.P2:return v.toString(t);default:const e=this.termToNQ(t);if(e)return e;throw new Error(`Can't id term with type '${t.termType}'`)}},isQuad:t=>t instanceof y,literal(t,e){if("string"!=typeof t&&!e)return u.fromValue(t);const r="string"==typeof t?t:""+t;return"string"==typeof e?-1===e.indexOf(":")?new u(r,e):new u(r,null,this.namedNode(e)):new u(r,null,e)},namedNode:t=>new s.A(t),quad:(t,e,r,i)=>new y(t,e,r,i||x),triple(t,e,r,i){return this.quad(t,e,r,i)},quadToNQ(t){return`${this.termToNQ(t.subject)} ${this.termToNQ(t.predicate)} ${this.termToNQ(t.object)} ${this.termToNQ(t.graph)} .`},termToNQ(t){switch(t.termType){case i.$Q:return"_:"+t.value;case i.ic:return"";case i.S:return"<http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>";case i.QW:return u.toNT(t);case i.bD:case i.Kk:return"<"+t.value+">";case i.r0:return"("+t.elements.map((t=>this.termToNQ(t))).join(" ")+")";default:throw new Error(`Can't serialize nonstandard term type (was '${t.termType}')`)}},toNQ(t){return this.isQuad(t)?this.quadToNQ(t):this.termToNQ(t)},variable:t=>new v(t)},A=T;var N=o(3787);function E(t,e){const r=e||{namedNode:t=>new s.A(t)};return function(e){return r.namedNode(t+(e||""))}}var R=o(2312),k=o(8540),I=o.n(k),C=o(7114);function O(t=A){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")}}function j(t){return new S(t)}O(A);class S{constructor(e){(0,t.A)(this,"_notQNameChars","\t\r\n !\"#$%&'()*,+/;<=>?@[\\]^`{|}~"),(0,t.A)(this,"_notNameChars",this._notQNameChars+":"),(0,t.A)(this,"validPrefix",new RegExp(/^[a-zA-Z][a-zA-Z0-9]*$/)),(0,t.A)(this,"forbidden1",new RegExp(/[\\"\b\f\r\v\t\n\u0080-\uffff]/gm)),(0,t.A)(this,"forbidden3",new RegExp(/[\\"\b\f\r\v\u0080-\uffff]/gm)),this.flags="",this.base=null,this.prefixes=[],this.namespaces=[];const r=Object.keys(I()());for(const t in r){const e=I()()[r[t]](""),i=r[t];this.prefixes[e]=i,this.namespaces[i]=e}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="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",this.incoming=null,this.formulas=[],this.store=e,this.rdfFactory=e.rdfFactory||A,this.xsd=O(this.rdfFactory)}setBase(t){return this.base=t,this}setFlags(t){return this.flags=t||"",this}toStr(t){var e=t.toNT();return"Graph"===t.termType&&(this.formulas[e]=t),e}fromStr(t){if("{"===t[0]){var e=this.formulas[t];return e||console.log("No formula object for "+t),e}return this.store.fromNT(t)}setNamespaces(t){for(var e in t)this.setPrefix(e,t[e]);return this}setPrefix(t,e){if("default"!==t.slice(0,7)&&"ns"!==t.slice(0,2)&&t&&e){for(let e in this.prefixes)this.prefixes[e]==t&&delete this.prefixes[e];this.prefixes[e]=t,this.namespaces[t]=e}}suggestPrefix(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))}suggestNamespaces(t){for(var e in t)this.suggestPrefix(e,t[e]);return this}checkIntegrity(){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]]+"!")}makeUpPrefix(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 i=e.lastIndexOf("/");i>=0&&(e=e.slice(i+1));for(var n=0;n<e.length&&this.prefixchars.indexOf(e[n])>=0;)n++;if((e=e.slice(0,n)).length<6&&r(e))return e;if(r(e.slice(0,3)))return e.slice(0,3);if(r(e.slice(0,2)))return e.slice(0,2);if(r(e.slice(0,4)))return e.slice(0,4);if(r(e.slice(0,1)))return e.slice(0,1);if(r(e.slice(0,5)))return e.slice(0,5);this.validPrefix.test(e)||(e="n");for(var s=0;;s++)if(r(e.slice(0,3)+s))return e.slice(0,3)+s}rootSubjects(t){for(var e={},r={},i={},n=0;n<t.length;n++){var s=t[n],a=function(t){e.hasOwnProperty(t)||(e[t]=[]),e[t].push(s.subject)};[s.subject,s.predicate,s.object].map((function(t){"BlankNode"===t.termType?i[t.toNT()]=!0:"Collection"===t.termType&&t.elements.forEach((function(t){a(t)}))})),a(t[n].object);var o=r[this.toStr(s.subject)];o||(o=[]),o.push(s),r[this.toStr(s.subject)]=o}var h=[];for(var l in r)if(r.hasOwnProperty(l)){var u=this.fromStr(l);"BlankNode"===u.termType&&e[u]&&1===e[u].length||h.push(u)}this.incoming=e;for(var c={},f=0;f<h.length;f++)c[h[f].toNT()]=!0;return{roots:h,subjects:r,rootsHash:c,incoming:e}}toN3(t){return this.statementsToN3(t.statements)}isValidPNLocal(t){if(0===t.length)return!0;if("."===t[t.length-1])return!1;for(var e=0;e<t.length;e++){var r=t[e];if("."!==r&&this._notNameChars.indexOf(r)>=0)return!1}return!0}explicitURI(t){var e;return this.flags.indexOf("r")<0&&this.base?t=b.refTo(this.base,t):this.flags.indexOf("u")>=0?t=function(t){for(var e,r="",i=0;i<t.length;i++)r+=(e=t.charCodeAt(i))>65535?"\\U"+("00000000"+e.toString(16)).slice(-8):e>126?"\\u"+("0000"+e.toString(16)).slice(-4):t[i];return r}(t):(e=decodeURI(t),t=encodeURI(e)),"<"+t+">"}statementsToNTriples(t){var e=t.slice();e.sort();for(var r="",i="http://www.w3.org/1999/02/22-rdf-syntax-ns#",n=this,s=this.store,a=this.rdfFactory,o=function(t){if("Collection"!==t.termType)return n.atomicTermToN3(t);for(var e=t.elements,h=s.sym(i+"nill"),l=e.length-1;l>=0;l--){var u=a.blankNode();r+=o(u)+" "+o(s.sym(i+"first"))+" "+o(e[l])+".\n",r+=o(u)+" "+o(s.sym(i+"rest"))+" "+o(h)+".\n",h=u}return n.atomicTermToN3(h)},h=0;h<e.length;h++){var l=e[h],u="";u+=o(l.subject)+" ",u+=o(l.predicate)+" ",u+=o(l.object)+" ",this.flags.indexOf("q")>=0&&(u+=o(l.why)+" "),r+=u+=".\n"}return r}statementsToN3(t){var e=this.store,r={"http://www.w3.org/1999/02/22-rdf-syntax-ns#type":"aaa:00"};t.sort((function(t,i){return C.heavyCompareSPO(t,i,e,r)})),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 n=function(t){for(var e="",r=0;r<t;r++)e+=" ";return e},s=function(t){for(var e="",r=0;r<t.length;r++){var i=t[r],n="string"==typeof i?i:s(i);if(0!==r){var a=e.slice(-1)||" ";","===n||";"===n||("."!==n||"0123456789.:".includes(a))&&(e+=" ")}e+=n}return e},a=function(t,e){var r="",i=1e5;void 0===e&&(e=-1);for(var o=0;o<t.length;o++){var h=t[o];if("string"!=typeof h){var l=a(h,e+1);if(l.length<10*(80-4*e)&&l.indexOf('"""')<0){var u=s(h);u.length<80-4*e&&(h=u,l="")}l&&(i=1e4),r+=l}if("string"==typeof h){if(1===h.length&&"\n"===r.slice(-1)&&",.;".indexOf(h)>=0){r=r.slice(0,-1),"."==h&&"0123456789.:".includes(r.charAt(r.length-1))&&(r+=" ",i+=1),r+=h+"\n",i+=1;continue}if(i<4*e+4||i+h.length+1<80&&";.".indexOf(r[r.length-2])<0)r=r.slice(0,-1)+" "+h+"\n",i+=h.length+1;else{let t=n(4*e)+h;r+=t+"\n",i=t.length,e<0&&(r+="\n",i=1e5)}}}return r},o=function(t){for(var e=this.rootSubjects(t),r=e.roots,i=[],n=0;n<r.length;n++){var s=r[n];i.push(h(s,e))}return i}.bind(this);function h(t,e){return"BlankNode"!==t.termType||e.incoming[t]?[c(t,e)].concat([l(t,e)]).concat(["."]):u(t,e,!0).concat(["."])}var l=function(t,e){var r=[],n=null,s=e.subjects[this.toStr(t)]||[];if(void 0===s)throw new Error("Cant find statements for "+t);for(var a=[],o=0;o<s.length;o++){var h=s[o];h.predicate.uri===n?a.push(","):(n&&(r=r.concat([a]).concat([";"]),a=[]),r.push(i[h.predicate.uri]?i[h.predicate.uri]:c(h.predicate,e))),n=h.predicate.uri,a.push(u(h.object,e))}return r.concat([a])}.bind(this),u=function(t,e,r){return"BlankNode"!==t.termType||!r&&void 0!==e.rootsHash[t.toNT()]?c(t,e):e.subjects[this.toStr(t)]?["[",l(t,e),"]"]:"[]"}.bind(this);S.prototype.termToN3=c;var c=function(t,e){var r,i;switch(t.termType){case"Graph":return(i=(i=["{"]).concat(o(t.statements))).concat(["}"]);case"Collection":for(i=["("],r=0;r<t.elements.length;r++)i.push([u(t.elements[r],e)]);return i.push(")"),i;default:return this.atomicTermToN3(t)}}.bind(this),f=function(){var t="";for(var e in this.flags.indexOf("d")<0&&this.defaultNamespace&&(t+="@prefix : "+this.explicitURI(this.defaultNamespace)+".\n"),this.prefixes)this.prefixes.hasOwnProperty(e)&&this.namespacesUsed[e]&&(t+="@prefix "+this.prefixes[e]+": "+this.explicitURI(e)+".\n");return t+"\n"}.bind(this),d=o(t);return f()+a(d)}atomicTermToN3(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":{const t=r.toLowerCase().indexOf("e")>0;return r.indexOf(".")<0&&!t&&(r+=".0"),t||(r+="e0"),r}case"http://www.w3.org/2001/XMLSchema#boolean":return"1"===t.value?"true":"false"}var i=this.stringToN3(t.value,this.flags);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)}}stringToN3(t,e){e||(e="e");var r,i,n,s,a,o="";for(t.length>20&&'"'!==t.slice(-1)&&e.indexOf("n")<0&&(t.indexOf("\n")>0||t.indexOf('"')>0)?(s='"""',a=this.forbidden3):(s='"',a=this.forbidden1),r=0;r<t.length&&(a.lastIndex=0,null!=a.exec(t.slice(r)));){i=r+a.lastIndex-1,o+=t.slice(r,i);var h=t[i];'"'===h&&'"""'===s&&'"""'!==t.slice(i,i+3)?o+=h:(n='\b\f\r\t\v\n\\"'.indexOf(h))>=0?o+="\\"+'bfrtvn\\"'[n]:e.indexOf("e")>=0?o+="\\u"+("000"+h.charCodeAt(0).toString(16).toLowerCase()).slice(-4):o+=h,r=i+1}return s+o+t.slice(r)+s}symbolToN3(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"))){var i=e.slice(r+1),n=e.slice(0,r+1),s=e.indexOf("://")+4,a=this.base?this.base.slice(0,Math.max(this.base.lastIndexOf("/"),this.base.lastIndexOf("#"))+1):null,o=a&&n===a,h=this.flags.indexOf("o")>=0&&i.indexOf(".")>=0;if(!o&&!h&&n.length>s&&this.isValidPNLocal(i)){if(this.defaultNamespace&&this.defaultNamespace===n&&this.flags.indexOf("d")<0)return this.flags.indexOf("k")>=0&&this.keyords.indexOf(i)<0?i:":"+i;var l=this.prefixes[n];if(l||(l=this.makeUpPrefix(n)),l)return this.namespacesUsed[n]=!0,l+":"+i}}return this.explicitURI(e)}writeStore(t){var e=this.store,r=e.fetcher,i=r&&r.appNode,n=this.store.index[3];for(var s in n){var a=e.fromNT(s);i&&a.equals(i)||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 i=e.statementsMatching(void 0,void 0,void 0,r.subject);t(this.statementsToN3(this.statementsToN3(i))),t("}.\n")}));var o=[];i&&o.push(i);var h=[];o.map((function(t){h=h.concat(e.statementsMatching(void 0,void 0,void 0,t))})),t(this.statementsToN3(h))}statementsToXML(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#_",i=function(t){for(var e="",r=0;r<t;r++)e+=" ";return e},n=function(t){for(var e="",r=0;r<t.length;r++){var i=t[r];e+="string"==typeof i?i:n(i)}return e},s=function(t,e){var r,a="",o=1e5;e||(e=0);for(var h=0;h<t.length;h++){var l=t[h];if("string"!=typeof l){var u=s(l,e+1);u.length<10*(80-4*e)&&u.indexOf('"""')<0&&(r=n(l)).length<80-4*e&&(l=" "+r,u=""),u&&(o=1e4),a+=u}"string"==typeof l&&(o<4*e+4?(a=a.slice(0,-1)+" "+l+"\n",o+=l.length+1):(a+=(r=i(4*e)+l)+"\n",o=r.length))}return a},a=function(t){this.suggestPrefix("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");for(var e=this.rootSubjects(t),r=e.roots,i=[],n=0;n<r.length;n++){var s=r[n];i.push(l(s,e))}return i}.bind(this);function o(t){return void 0===t?"@@@undefined@@@@":t.replace(/[&<"]/g,(function(t){switch(t[0]){case"&":return"&";case"<":return"<";case'"':return"""}}))}var h=function(t){return o(this.base?b.refTo(this.base,t.uri):t.uri)}.bind(this),l=function(t,e){var i,n,s,a,d=[],p=e.subjects[this.toStr(t)];if(void 0===p)return c(t,e);p.sort((function(t,e){var i=t.predicate.uri,n=e.predicate.uri;if(i.substring(0,44)===r||n.substring(0,44)===r)return i.localeCompare(n);var s=i.substring(44),a=n.substring(44),o=parseInt(s,10),h=parseInt(a,10);return isNaN(o)||isNaN(h)||o!==s||h!==a?i.localeCompare(n):o-h}));for(var g=0;g<p.length;g++)if("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"!==(s=p[g]).predicate.uri||i||"NamedNode"!==s.object.termType){if((a=s.predicate).uri.substr(0,44)===r){var m=a.uri.substr(44);m===parseInt(m,10).toString()&&(a=this.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#li"))}switch(n=f(a),s.object.termType){case"BlankNode":d=1===e.incoming[s.object].length?d.concat(["<"+n+' rdf:parseType="Resource">',l(s.object,e),"</"+n+">"]):d.concat(["<"+n+' rdf:nodeID="'+s.object.toNT().slice(2)+'"/>']);break;case"NamedNode":d=d.concat(["<"+n+' rdf:resource="'+h(s.object)+'"/>']);break;case"Literal":d=d.concat(["<"+n+(s.object.language?' xml:lang="'+s.object.language+'"':s.object.datatype.equals(this.xsd.string)?"":' rdf:datatype="'+o(s.object.datatype.uri)+'"')+">"+o(s.object.value)+"</"+n+">"]);break;case"Collection":d=d.concat(["<"+n+' rdf:parseType="Collection">',u(s.object,e),"</"+n+">"]);break;default:throw new Error("Can't serialize object of type "+s.object.termType+" into XML")}}else i=s.object;var w=i?f(i):"rdf:Description",y="";return"BlankNode"===t.termType?e.incoming[t]&&1===e.incoming[t].length||(y=' rdf:nodeID="'+t.toNT().slice(2)+'"'):y=' rdf:about="'+h(t)+'"',["<"+w+y+">"].concat([d]).concat(["</"+w+">"])}.bind(this);function u(t,e){for(var r=[],i=0;i<t.elements.length;i++)r.push(l(t.elements[i],e));return r}var c=function(t,e){var r=[],i=e.subjects[this.toStr(t)];if(!i)return r;i.sort();for(var n=0;n<i.length;n++){var s=i[n];switch(s.object.termType){case"BlankNode":r=e.rootsHash[s.object.toNT()]?r.concat(["<"+f(s.predicate)+' rdf:nodeID="'+s.object.toNT().slice(2)+'">',"</"+f(s.predicate)+">"]):r.concat(["<"+f(s.predicate)+' rdf:parseType="Resource">',c(s.object,e),"</"+f(s.predicate)+">"]);break;case"NamedNode":r=r.concat(["<"+f(s.predicate)+' rdf:resource="'+h(s.object)+'"/>']);break;case"Literal":r=r.concat(["<"+f(s.predicate)+(s.object.language?' xml:lang="'+s.object.language+'"':s.object.datatype.equals(this.xsd.string)?"":' rdf:datatype="'+o(s.object.datatype.value)+'"')+">"+o(s.object.value)+"</"+f(s.predicate)+">"]);break;case"Collection":r=r.concat(["<"+f(s.predicate)+' rdf:parseType="Collection">',u(s.object,e),"</"+f(s.predicate)+">"]);break;default:throw new Error("Can't serialize object of type "+s.object.termType+" into XML")}}return r}.bind(this),f=function(t){var r=t.uri,i=r.indexOf("#");if(i<0&&this.flags.indexOf("/")<0&&(i=r.lastIndexOf("/")),i<0)throw new Error("Cannot make qname out of <"+r+">");for(var n=i+1;n<r.length;n++)if(this._notNameChars.indexOf(r[n])>=0)throw new Error('Invalid character "'+r[n]+'" cannot be in XML qname for URI: '+r);var s=r.slice(i+1),a=r.slice(0,i+1);if(this.defaultNamespace&&this.defaultNamespace===a&&this.flags.indexOf("d")<0)return s;var o=this.prefixes[a];return o||(o=this.makeUpPrefix(a)),e[a]=!0,o+":"+s}.bind(this),d=a(t),p="<rdf:RDF";for(var g in this.defaultNamespace&&(p+=' xmlns="'+o(this.defaultNamespace)+'"'),e)if(e.hasOwnProperty(g)){var m=this.base&&this.flags.includes("z")?b.refTo(this.base,g):g;p+="\n xmlns:"+this.prefixes[g]+'="'+o(m)+'"'}return s([p+=">",d,"</rdf:RDF>"],-1)}statementsToJsonld(t){const e=this.statementsToN3(t),r=R.parse(e);return JSON.stringify(r,null,2)}}function F(t,e,r,n,s,a){r=r||t?.value;const o=a||{};n=n||i.sT;try{var h=j(e);o.flags&&h.setFlags(o.flags);var l=e.statementsMatching(void 0,void 0,void 0,t);switch("namespaces"in e&&h.suggestNamespaces(e.namespaces),o.namespaces&&h.setNamespaces(o.namespaces),h.setBase(r),n){case i.JG:return u(null,h.statementsToXML(l));case i.ny:case i.MG:return u(null,h.statementsToN3(l));case i.sT:case i.hu:return h.setFlags("si"+(o.flags?" "+o.flags:"")),u(null,h.statementsToN3(l));case i.bM:return h.setFlags("deinprstux"),u(null,h.statementsToNTriples(l));case i.i2:return h.setFlags("si dr"+(o.flags?" "+o.flags:"")),u(null,h.statementsToJsonld(l));case i._0:case i.BR:return h.setFlags("deinprstux q"),u(null,h.statementsToNTriples(l));default:throw new Error("Serialize: Content-type "+n+" not supported for data write.")}}catch(t){if(s)return s(t,void 0);throw t}function u(t,e){return s?void s(t,e):e}}const U=["blankNode","defaultGraph","literal","namedNode","quad","variable","supports"],D={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 L(t,e,r){const i=[];return r.reduce(((e,r,n,s)=>{let a;return i.push(t.quad(e,t.namedNode(D.first),s[n])),n<s.length-1?(a=t.blankNode(),i.push(t.quad(e,t.namedNode(D.rest),a))):i.push(t.quad(e,t.namedNode(D.rest),t.namedNode(D.nil))),a}),e),i}function M(t,e,r=0){var i=t.length;for(r<0&&(r=i+r);r<i;r++)if(t[r]===e)return r;return-1}class P extends r.A{constructor(r=[],n=[],s=[],a=[],o={}){super(""),this.statements=r,this.constraints=n,this.initBindings=s,this.optional=a,(0,t.A)(this,"termType",i.bD),(0,t.A)(this,"classOrder",e.A.Graph),(0,t.A)(this,"fetcher",void 0),(0,t.A)(this,"isVar",0),(0,t.A)(this,"ns",E),(0,t.A)(this,"rdfFactory",void 0),this.rdfFactory=o&&o.rdfFactory||A;for(const t of U)this[t]=(...e)=>this.rdfFactory[t](...e)}add(t,e,r,i){return 1===arguments.length&&t.forEach((t=>this.add(t.subject,t.predicate,t.object,t.graph))),this.statements.push(this.rdfFactory.quad(t,e,r,i))}addStatement(t){return this.add(t)}bnode(t){return this.rdfFactory.blankNode(t)}addAll(t){t.forEach((t=>{this.add(t.subject,t.predicate,t.object,t.graph)}))}any(t,e,r,i){const n=this.anyStatementMatching(t,e,r,i);return null==n?null:null==t?n.subject:null==e?n.predicate:null==r?n.object:null}anyValue(t,e,r,i){const n=this.any(t,e,r,i);return n?n.value:void 0}anyJS(t,e,i,n){const s=this.any(t,e,i,n);return s?r.A.toJS(s):void 0}anyStatementMatching(t,e,r,i){let n=this.statementsMatching(t,e,r,i,!0);if(n&&0!==n.length)return n[0]}id(t){return this.rdfFactory.id(t)}statementsMatching(t,e,r,i,n){const s=this.statements.filter((n=>(!t||t.equals(n.subject))&&(!e||e.equals(n.predicate))&&(!r||r.equals(n.object))&&(!i||i.equals(n.graph))));return n?0===s.length?[]:[s[0]]:s}bottomTypeURIs(t){let e,r,i,n,s,a,o,h;e=[];for(let l in t)if(t.hasOwnProperty(l)){for(h=t[l],o=this.each(void 0,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),this.rdfFactory.namedNode(l)),r=!0,n=0,s=o.length;n<s;n++)if(i=o[n],a=i.uri,a in t){r=!1;break}r&&(e[l]=h)}return e}collection(){return new f}each(t,e,r,i){const n=[];let a=this.statementsMatching(t,e,r,i,!1);if(null==t)for(let t=0,e=a.length;t<e;t++)n.push(a[t].subject);else if(null==e)for(let t=0,e=a.length;t<e;t++)n.push(a[t].predicate);else if(null==r)for(let t=0,e=a.length;t<e;t++)n.push(a[t].object);else if(null==i)for(let t=0,e=a.length;t<e;t++)n.push(new s.A(a[t].graph.value));return n}equals(t){return!!t&&this.hashString()===t.hashString()}findMembersNT(t){let e,r,i,n,s,a,o,h,l,u,c,f,d,p;f={},f[t.toNT()]=!0,n={},a=this.transitiveClosure(f,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!0);for(let t in a)if(a.hasOwnProperty(t)){o=this.statementsMatching(void 0,this.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),this.fromNT(t));for(let t=0,e=o.length;t<e;t++)d=o[t],n[d.subject.toNT()]=d;h=this.each(void 0,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#domain"),this.fromNT(t));for(let t=0,r=h.length;t<r;t++)for(s=h[t],l=this.statementsMatching(void 0,s),i=0,e=l.length;i<e;i++)d=l[i],n[d.subject.toNT()]=d;u=this.each(void 0,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#range"),this.fromNT(t));for(let t=0,e=u.length;t<e;t++)for(s=u[t],c=this.statementsMatching(void 0,s),p=0,r=c.length;p<r;p++)d=c[p],n[d.object.toNT()]=d}return n}findMemberURIs(t){return this.NTtoURI(this.findMembersNT(t))}findSubClassesNT(t){let e={};return e[t.toNT()]=!0,this.transitiveClosure(e,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!0)}findSuperClassesNT(t){let e={};return e[t.toNT()]=!0,this.transitiveClosure(e,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!1)}findTypesNT(t){let e,r,i,n,s,a,o,h,l;i="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",l=[],n=this.statementsMatching(t,void 0,void 0);for(let t=0,e=n.length;t<e;t++)if(h=n[t],"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"===h.predicate.uri)l[h.object.toNT()]=h;else{s=this.each(h.predicate,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#domain"));for(let t=0,e=s.length;t<e;t++)r=s[t],l[r.toNT()]=h}a=this.statementsMatching(void 0,void 0,t);for(let t=0,r=a.length;t<r;t++){h=a[t],o=this.each(h.predicate,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#range"));for(let t=0,r=o.length;t<r;t++)e=o[t],l[e.toNT()]=h}return this.transitiveClosure(l,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!1)}findTypeURIs(t){return this.NTtoURI(this.findTypesNT(t))}connectedStatements(t,e,r){r=r||[];let i=[t],n={},s={},a=[],o=this,h=function(t){let h=function(t){"BlankNode"!==t.termType||n[t.value]||(n[t.value]=!0,i.push(t))},l=o.statementsMatching(null,null,t,e).concat(o.statementsMatching(t,null,null,e));l=l.filter((function(t){if(r[t.predicate.value])return!1;let e=t.toNT();return!s[e]&&(s[e]=!0,!0)})),l.forEach((function(t){h(t.subject),h(t.object)})),a=a.concat(l)};for(;i.length;)h(i.shift());return a}formula(t){return new P}fromNT(t){let e,r,i;switch(t[0]){case"<":return this.sym(t.slice(1,-1));case'"':if(i=void 0,e=void 0,r=t.lastIndexOf('"'),r<t.length-1)if("@"===t[r+1])i=t.slice(r+2);else{if("^^"!==t.slice(r+1,r+3))throw new Error("Can't convert string from NT: "+t);e=this.fromNT(t.slice(r+3))}return t=(t=(t=(t=t.slice(1,r)).replace(/\\"/g,'"')).replace(/\\n/g,"\n")).replace(/\\\\/g,"\\"),this.rdfFactory.literal(t,i||e);case"_":return this.rdfFactory.blankNode(t.slice(2));case"?":return new v(t.slice(1))}throw new Error("Can't convert from NT: "+t)}holds(t,e,r,i){let n;if(1===arguments.length){if(!t)return!0;if(t instanceof Array){for(n=0;n<t.length;n++)if(!this.holds(t[n]))return!1;return!0}if((0,a.SH)(t))return this.holds(t.subject,t.predicate,t.object,t.graph);if(t.statements)return this.holds(t.statements)}return null!=this.anyStatementMatching(t,e,r,i)}holdsStatement(t){return this.holds(t.subject,t.predicate,t.object,t.graph)}list(t,e){if(e.rdfFactory.supports.COLLECTIONS){const r=e.rdfFactory.collection();return t.forEach((function(t){r.append(t)})),r}{const r=e.rdfFactory.blankNode(),i=L(e.rdfFactory,r,t);return e.addAll(i),r}}NTtoURI(t){let e,r,i={};for(e in t)t.hasOwnProperty(e)&&(r=t[e],"<"===e[0]&&(i[e.slice(1,-1)]=r));return i}serialize(t,e,r,i){return F(r,this,t,e,void 0,i)}substitute(t){let e=this.statements.map((function(e){return e.substitute(t)}));const r=new P;return r.addAll(e),r}sym(t,e){if(e)throw new Error("This feature (kb.sym with 2 args) is removed. Do not assume prefix mappings.");return this.rdfFactory.namedNode(t)}the(t,e,r,i){let n=this.any(t,e,r,i);return null==n&&N.A.error("No value found for the() {"+t+" "+e+" "+r+"}."),n}transitiveClosure(t,e,r){let i,n,s,a,o,h,l={};Object.assign(l,t);let u={};for(;;){if(h=function(){for(let t in l)if(l.hasOwnProperty(t))return t}(),null==h)return u;for(o=r?this.each(void 0,e,this.fromNT(h)):this.each(this.fromNT(h),e),n=0,s=o.length;n<s;n++)i=o[n],a=i.toNT(),a in u||a in l||(l[a]=l[h]);u[h]=l[h],delete l[h]}}topTypeURIs(t){let e,r,i,n,s,a,o,h;for(i in o=[],t)if(t.hasOwnProperty(i)){for(h=t[i],s=0,a=this.each(this.rdfFactory.namedNode(i),this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf")),e=0,n=a.length;e<n;e++)if(r=a[e],"http://www.w3.org/2000/01/rdf-schema#Resource"!==r.uri){s++;break}s||(o[i]=h)}return o["http://www.w3.org/2000/01/rdf-schema#Resource"]&&delete o["http://www.w3.org/2000/01/rdf-schema#Resource"],o["http://www.w3.org/2002/07/owl#Thing"]&&delete o["http://www.w3.org/2002/07/owl#Thing"],o}toString(){return"{"+this.statements.join("\n")+"}"}variable(t){return new v(t)}whether(t,e,r,i){return this.statementsMatching(t,e,r,i,!1).length}}r.A.fromValue=c;const B=r.A,q={xsd:E("http://www.w3.org/2001/XMLSchema#")};r.A.toJS=function(t){return(0,a.P3)(t)?t.elements.map(r.A.toJS):(0,a.c$)(t)?t.datatype.equals(q.xsd("boolean"))?"1"===t.value||"true"===t.value:t.datatype.equals(q.xsd("dateTime"))||t.datatype.equals(q.xsd("date"))?new Date(t.value):t.datatype.equals(q.xsd("integer"))||t.datatype.equals(q.xsd("float"))||t.datatype.equals(q.xsd("decimal"))?Number(t.value):t.value:t};class ${constructor(t,e){this.pat=new G,this.vars=[],this.name=t,this.id=e}}function H(t,e,r,i){function n(t){var e,r="";for(e in t)t.hasOwnProperty(e)&&(r+=" "+e+" -> "+t[e]);return r}function s(t){var e,r="Bindings: ",i=t.length;for(e=0;e<i;e++)r+=n(t[e][0])+";\n\t";return r}function a(t,e,r,i){var n;if(t.length!==e.length)return[];if(!t.length)return[[[],null]];var s=function(t,e,r,i){var n=r[t];if(void 0===n){if(t.isVar){var s=[];return s[t]=e,[[s,null]]}n=t}if(!n.complexType)return i.redirections[n]&&(n=i.redirections[n]),i.redirections[e]&&(e=i.redirections[e]),n.equals(e)||n.uri&&n.uri===p?[[[],null]]:[];if(t instanceof Array)return e instanceof Array?a(t,e,r):[];throw new Error("query.js: oops - code not written yet")}(t[0],e[0],r,i);if(0===s.length)return s;var o,h,l,u,c,f,d,g=[],m=s.length;for(o=0;o<m;o++){for(c in d=[],h=s[o][0])h.hasOwnProperty(c)&&(d[c]=h[c]);for(c in r)r.hasOwnProperty(c)&&(d[c]=r[c]);for(u=(n=a(t.slice(1),e.slice(1),d,i)).length,l=0;l<u;l++){for(c in f=n[l][0],h)h.hasOwnProperty(c)&&(f[c]=h[c]);g.push([f,null])}}return g}function o(t,e){var r,i={};for(r in t)t.hasOwnProperty(r)&&(i[r]=t[r]);for(r in e)e.hasOwnProperty(r)&&(i[r]=e[r]);return i}function h(t,e){return this.trunkBindings=e,this.originalCallback=t,this.branches=[],this}function l(t,e){return this.count=0,this.success=!1,this.done=!1,this.callback=t,this.onDone=e,this}h.prototype.checkAllDone=function(){var t;for(t=0;t<this.branches.length;t++)if(!this.branches[t].done)return;N.A.debug("OPTIONAL BIDNINGS ALL DONE:"),this.doCallBacks(this.branches.length-1,this.trunkBindings)},h.prototype.doCallBacks=function(t,e){var r;if(t<0)return this.originalCallback(e);for(r=0;r<this.branches[t].results.length;r++)this.doCallBacks(t-1,o(e,this.branches[t].results[r]))},l.prototype.reportMatch=function(t){this.callback(t),this.success=!0},l.prototype.reportDone=function(){this.done=!0,N.A.info("Mandatory query branch finished.***"),void 0!==this.onDone&&this.onDone()};var u=function(t){return this.count=0,this.done=!1,this.results=[],this.junction=t,t.branches.push(this),this};function c(t,e,r){var i,n,s,a,o,h;for(e.nvars=0,e.index=null,i=[e.subject,e.predicate,e.object,e.why],a=[t.subjectIndex,t.predicateIndex,t.objectIndex,t.whyIndex],s=0;s<4;s++){let l=i[s];if(l.uri&&l.uri===p);else if(l.isVar&&void 0===r[l])e.nvars++;else{if(void 0,l=void 0===(h=r[o=i[s]])?o:h,t.redirections[t.id(l)]&&(l=t.redirections[t.id(l)]),!(n=a[s][t.id(l)]))return e.index=[],!1;(null===e.index||e.index.length>n.length)&&(e.index=n)}}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}u.prototype.reportMatch=function(t){this.results.push(t)},u.prototype.reportDone=function(){N.A.debug("Optional branch finished - results.length = "+this.results.length),0===this.results.length&&(this.results.push({}),N.A.debug("Optional branch FAILED - that's OK.")),this.done=!0,this.junction.checkAllDone()};var d=function(t,r,i,s,a,o,l){N.A.debug("Match begins, Branch count now: "+l.count+" for "+l.pattern_debug);var c,f,p=r.statements;if(0===p.length){if(N.A.debug("FOUND MATCH WITH BINDINGS:"+n(i)),0===r.optional.length)l.reportMatch(i);else{N.A.debug("OPTIONAL: "+r.optional);var g,w=new h(e,i),y=[];for(g=0;g<r.optional.length;g++)y[g]=new u(w),y[g].pattern_debug=r.optional[g];for(g=0;g<r.optional.length;g++)y[g].count=y[g].count+1,d(t,r.optional[g],i,"",a,e,y[g])}return l.count--,void N.A.debug("Match ends -- success , Branch count now: "+l.count+" for "+l.pattern_debug)}var v=p.length;if(a){var _=function(e,n){var h=e.uri.split("#")[0];a.nowOrWhenFetched(h,void 0,(function(n,h,u){n||console.log("Error following link to <"+e.uri+"> in query: "+h),d(t,r,i,s,a,o,l)}))};for(f=0;f<v;f++){if(c=p[f],void 0!==i[c.subject]&&i[c.subject].uri&&a&&"unrequested"===a.getState((0,b.docpart)(i[c.subject].uri)))return void _(i[c.subject]);if(void 0!==i[c.object]&&i[c.object].uri&&a&&"unrequested"===a.getState((0,b.docpart)(i[c.object].uri)))return void _(i[c.object])}}m(t,r,i,s,a,o,l)},g=function(t,e){var r,i,n=!0;for(r in t)t.hasOwnProperty(r)&&e[r]&&(i=e[r].test)&&!i(t[r])&&(n=!1);return n},m=function(t,e,r,i,o,h,l){var u,p,m,w,y,b,v,_=e.statements,x=_.length;for(u=0;u<x;u++)c(t,v=_[u],r);_.sort(f),v=_[0];var T,A=t.formula();A.optional=e.optional,A.constraints=e.constraints,A.statements=_.slice(1),N.A.debug(i+"match2 searching "+v.index.length+" for "+v+"; bindings so far="+n(r));var E,R,k=v.index.length,I=0;for(T=0;T<k;T++)for(R=v.index[T],E=a([v.subject,v.predicate,v.object,v.why],[R.subject,R.predicate,R.object,R.why],r,t),N.A.info(i+" From first: "+E.length+": "+s(E)),m=E.length,p=0;p<m;p++)if(y=[],b=E[p][0],g(b,e.constraints)){for(w in b)b.hasOwnProperty(w)&&(y[w]=b[w]);for(w in r)r.hasOwnProperty(w)&&(y[w]=r[w]);l.count++,I++,d(t,A,y,i+" ",o,h,l)}else N.A.debug("Branch count CS: "+l.count);l.count--,0===I&&N.A.debug("Match2 fails completely on "+v),N.A.debug("Match2 ends, Branch count: "+l.count+" for "+l.pattern_debug),0===l.count&&(N.A.debug("Branch finished."),l.reportDone())},w=this;N.A.debug("Query on "+this.statements.length);var y=new l(e,i);y.count++,t.sync?d(w,t.pat,t.pat.initBindings,"",r,e,y):setTimeout((function(){d(w,t.pat,t.pat.initBindings,"",r,e,y)}),0)}const X="http://www.w3.org/2002/07/owl#";function z(t,e,r,i){var n=t.any(e,r,void 0);return!!n&&(t.equate(n,i),!0)}function Q(t,e,r,i){var n=t.any(void 0,r,i);return!!n&&(t.equate(n,e),!0)}function V(t,e,r,i,n){t.typeCallback&&t.typeCallback(t,i,n);var s=t.classActions[t.id(i)],a=!1;if(s)for(var o=0;o<s.length;o++)a=a||s[o](t,e,r,i,n);return a}class G extends P{constructor(e,r={}){super(void 0,void 0,void 0,void 0,r),(0,t.A)(this,"updater",void 0),(0,t.A)(this,"namespaces",void 0),(0,t.A)(this,"classActions",void 0),(0,t.A)(this,"propertyActions",void 0),(0,t.A)(this,"redirections",void 0),(0,t.A)(this,"aliases",void 0),(0,t.A)(this,"HTTPRedirects",void 0),(0,t.A)(this,"subjectIndex",void 0),(0,t.A)(this,"predicateIndex",void 0),(0,t.A)(this,"objectIndex",void 0),(0,t.A)(this,"whyIndex",void 0),(0,t.A)(this,"index",void 0),(0,t.A)(this,"features",void 0),(0,t.A)(this,"_universalVariables",void 0),(0,t.A)(this,"_existentialVariables",void 0),(0,t.A)(this,"rdfArrayRemove",void 0),(0,t.A)(this,"dataCallbacks",[]),(0,t.A)(this,"dataRemovalCallbacks",[]),this.propertyActions={},this.classActions={},this.redirections=[],this.aliases=[],this.HTTPRedirects=[],this.subjectIndex=[],this.predicateIndex=[],this.objectIndex=[],this.whyIndex=[],this.index=[this.subjectIndex,this.predicateIndex,this.objectIndex,this.whyIndex],this.namespaces={},this.features=e||[],this.rdfArrayRemove=r.rdfArrayRemove||C.RDFArrayRemove,r.dataCallback&&(this.dataCallbacks=[r.dataCallback]),r.dataRemovalCallback&&(this.dataRemovalCallbacks=[r.dataRemovalCallback]),this.initPropertyActions(this.features)}static get defaultGraphURI(){return p}substitute(t){var e=this.statements.map((function(e){return e.substitute(t)})),r=new G;return r.add(e),r}addDataCallback(t){this.dataCallbacks.push(t)}addDataRemovalCallback(t){this.dataRemovalCallbacks.push(t)}applyPatch(t,e,r){var i,n=this,s=null;function a(a){if(t.delete){i=t.delete,s&&(i=i.substitute(s)),i=i.statements;var o=[],h=i.map((function(t){var r=n.statementsMatching(t.subject,t.predicate,t.object,e);return 0===r.length?(o.push(t),null):r[0]}));if(o.length)return r("Could not find to delete: "+o.join("\n or "));h.map((function(t){n.remove(t)}))}t.insert&&(i=t.insert,s&&(i=i.substitute(s)),(i=i.statements).map((function(t){t.graph=e,n.add(t.subject,t.predicate,t.object,t.graph)}))),a()}if(t.where){var o=new $("patch");o.pat=t.where,o.pat.statements.map((function(t){t.graph=ze(e.value)})),o.sync=!0;var h=[];n.query(o,(function(t){h.push(t)}),n.fetcher,(function(){return 0===h.length?r("No match found to be patched:"+t.where):h.length>1?r("Patch ambiguous. No patch done."):(s=h[0],void a(r))}))}else a(r)}declareExistential(t){return this._existentialVariables||(this._existentialVariables=[]),this._existentialVariables.push(t),t}initPropertyActions(t){this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"))]=[V],M(t,"sameAs")>=0&&(this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode(`${X}sameAs`))]=[function(t,e,r,i,n){return t.equate(e,i),!0}]),M(t,"InverseFunctionalProperty")>=0&&(this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode(`${X}InverseFunctionalProperty`))]=[function(t,e,r,i,n){return t.newPropertyAction(e,Q)}]),M(t,"FunctionalProperty")>=0&&(this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode(`${X}FunctionalProperty`))]=[function(t,e,r,i,n){return t.newPropertyAction(e,z)}])}addStatement(t){return this.add(t.subject,t.predicate,t.object,t.graph),this.statements.length}add(t,e,r,i){var n,s,o;if(1===arguments.length){if(t instanceof Array)for(n=0;n<t.length;n++)this.add(t[n]);else(0,a.aF)(t)?this.add(t.subject,t.predicate,t.object,t.graph):(0,a.ok)(t)&&this.add(t.statements);return this}i||(i=this.fetcher?this.fetcher.appNode:this.rdfFactory.defaultGraph()),"string"==typeof t&&(t=this.rdfFactory.namedNode(t)),e=B.fromValue(e);const h=B.fromValue(r);if(i=B.fromValue(i),!(0,a.CZ)(t))throw new Error("Subject is not a subject type");if(!(0,a.fY)(e))throw new Error(`Predicate ${e} is not a predicate type`);if(!(0,a.DJ)(h))throw new Error(`Object ${h} is not an object type`);if(!(0,a.RN)(i))throw new Error("Why is not a graph type");this.predicateCallback&&this.predicateCallback(this,e,i);var l=this.id(this.canon(e)),u=!1;if(s=this.propertyActions[l])for(n=0;n<s.length;n++)u=u||s[n](this,t,e,h,i);if(this.holds(t,e,h,i))return null;var c=[this.id(this.canon(t)),l,this.id(this.canon(h)),this.id(this.canon(i))];for(o=this.rdfFactory.quad(t,e,h,i),n=0;n<4;n++){var f=this.index[n],d=c[n];f[d]||(f[d]=[]),f[d].push(o)}this.statements.push(o);for(const t of this.dataCallbacks)t(o);return o}canon(t){if(!t)return t;const e=this.redirections[this.id(t)];if(e)return e;switch(t.termType){case i.$Q:return new n(t.value);case i.r0:return t;case i.ic:return new g;case i.S:case i.bD:return t;case i.QW:return new u(t.value,t.language,t.datatype);case i.Kk:return new s.A(t.value);case i.P2:return new v(t.value);default:throw new Error(`Term Type not recognized for canonization: ${t.termType}`)}}check(){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)}}checkStatementList(t,e){void 0===e&&(e=0);for(var r,i=" found in "+["subject","predicate","object","why"][e]+" index.",n=0;n<t.length;n++){for(var s=[(r=t[n]).subject,r.predicate,r.object,r.graph],a=function(t,e){for(var r=0;r<t.length;r++)if(t[r].subject.equals(e.subject)&&t[r].predicate.equals(e.predicate)&&t[r].object.equals(e.object)&&t[r].why.equals(e.graph))return!0},o=0;o<4;o++){var h=this.canon(s[o]),l=this.id(h);this.index[o][l]&&a(this.index[o][l],r)}if(!a(this.statements,r))throw new Error("Statement list does not statement "+r+"@"+r.graph+i)}}close(){return this}compareTerms(t,r){return Object.prototype.hasOwnProperty.call(t,"compareTerm")?t.compareTerm(r):e.A[t.termType]<e.A[r.termType]?-1:e.A[t.termType]>e.A[r.termType]?1:t.value<r.value?-1:t.value>r.value?1:0}copyTo(t,e,r){r||(r=[]);var i=this.statementsMatching(t);-1!==M(r,"two-direction")&&i.concat(this.statementsMatching(void 0,void 0,t));for(var n=0;n<i.length;n++){var s=i[n];switch(s.object.termType){case"NamedNode":this.add(e,s.predicate,s.object);break;case"Literal":case"BlankNode":case"Collection":this.add(e,s.predicate,s.object.copy(this))}-1!==M(r,"delete")&&this.remove(s)}}equate(t,e){const r=this.canon(t),i=this.canon(e);var n=this.compareTerms(r,i);return!n||(n<0?this.replaceWith(i,r):this.replaceWith(r,i))}formula(t){return new G(t)}get length(){return this.statements.length}match(t,e,r,i){return this.statementsMatching(B.fromValue(t),B.fromValue(e),B.fromValue(r),B.fromValue(i))}mentionsURI(t){var e="<"+t+">";return!!this.subjectIndex[e]||!!this.objectIndex[e]||!!this.predicateIndex[e]}newExistential(t){if(!t)return this.bnode();var e=this.sym(t);return this.declareExistential(e)}newPropertyAction(t,e){var r=this.id(t);this.propertyActions[r]||(this.propertyActions[r]=[]),this.propertyActions[r].push(e);for(var i=this.statementsMatching(void 0,t,void 0),n=!1,s=0;s<i.length;s++)n=n||e(this,i[s].subject,t,i[s].object);return n}newUniversal(t){var e=this.sym(t);return this._universalVariables||(this._universalVariables=[]),this._universalVariables.push(e),e}variable(t){return new v(t)}nextSymbol(t){for(var e=0;;e++){var r=t.value+"#n"+e;if(!this.mentionsURI(r))return this.sym(r)}}query(t,e,r,i){return H.call(this,t,e,r,i)}querySync(t){var e=[],r=!1;if(t.sync=!0,H.call(this,t,(function(t){e.push(t)}),null,(function(){r=!0})),!r)throw new Error("Sync query should have called done function");return e}remove(t){if(t instanceof Array){for(var e=0;e<t.length;e++)this.remove(t[e]);return this}if((0,a.ok)(t))return this.remove(t.statements);var r=this.statementsMatching(t.subject,t.predicate,t.object,t.graph);if(!r.length)throw new Error("Statement to be removed is not on store: "+t);return this.removeStatement(r[0]),this}removeDocument(t){this.removeMetadata(t);for(var e=this.statementsMatching(void 0,void 0,void 0,t).slice(),r=0;r<e.length;r++)this.removeStatement(e[r]);return this.removeMatches(t,null,null),this}removeMetadata(t){const e=this.sym("chrome://TheCurrentSession"),r="http://www.w3.org/2007/ont/link#",i=this.statementsMatching(void 0,this.sym(`${r}requestedURI`),this.rdfFactory.literal(t.value),e).map((t=>t.subject));for(var n=0;n<i.length;n++){const t=i[n];if(null!=t){let i;const n=this.any(t,this.sym(`${r}status`),null,e);if(null!=n){i=this.statementsMatching(n,this.sym(`${r}status`),null,e).slice();for(var s=0;s<i.length;s++)this.removeStatement(i[s])}const a=this.any(t,this.sym(`${r}response`),null,e);if(null!=a)for(i=this.statementsMatching(a,null,null,e).slice(),s=0;s<i.length;s++)this.removeStatement(i[s]);for(i=this.statementsMatching(t,null,null,e).slice(),s=0;s<i.length;s++)this.removeStatement(i[s])}}return this.removeMatches(this.sym(t.value),null,null,e),this}removeMany(t,e,r,i,n){for(var s=this.statementsMatching(t,e,r,i,!1),a=[],o=0;o<s.length;o++)a.push(s[o]);for(n&&(a=a.slice(0,n)),o=0;o<a.length;o++)this.remove(a[o])}removeMatches(t,e,r,i){return this.removeMany(t,e,r,i),this}removeStatement(t){for(var e=[t.subject,t.predicate,t.object,t.graph],r=0;r<4;r++){var i=this.canon(e[r]),n=this.id(i);this.index[r][n]&&this.rdfArrayRemove(this.index[r][n],t)}this.rdfArrayRemove(this.statements,t);for(const e of this.dataRemovalCallbacks)e(t);return this}removeStatements(t){for(var e=0;e<t.length;e++)this.remove(t[e]);return this}replaceWith(t,e){for(var r=this.id(t),i=this.id(e),n=function(t){var e=t[r];if(e){var n=t[i];t[i]=n?e.concat(n):e,delete t[r]}},s=0;s<4;s++)n(this.index[s]);if(this.redirections[r]=e,t.value){if(this.aliases[i]||(this.aliases[i]=[]),this.aliases[i].push(t),this.aliases[r])for(s=0;s<this.aliases[r].length;s++)this.redirections[this.id(this.aliases[r][s])]=e,this.aliases[i].push(this.aliases[r][s]);this.add(e,this.sym("http://www.w3.org/2007/ont/link#uri"),t),this.fetcher&&this.fetcher.nowKnownAs(t,e)}return n(this.classActions),n(this.propertyActions),!0}allAliases(t){var e=this.aliases[this.id(this.canon(t))]||[];return e.push(this.canon(t)),e}sameThings(t,e){if(t.equals(e))return!0;var r=this.canon(t);if(!r)return!1;var i=this.canon(e);return!!i&&r.value===i.value}setPrefixForURI(t,e){if(("tab"!==t||!this.namespaces.tab)&&"ns"!==t.slice(0,2)&&"default"!==t.slice(0,7)){for(let t in this.namespaces)this.namespaces[t]==e&&delete this.namespaces[t];this.namespaces[t]=e}}statementsMatching(t,e,r,i,n){var s,a,o=[t,e,r,i],h=[],l=[],u=[],c=[];for(s=0;s<4;s++)h[s]=this.canon(B.fromValue(o[s])),h[s]?(c.push(s),l[s]=this.id(h[s])):u.push(s);if(0===c.length)return this.statements;if(1===c.length)return s=c[0],(a=this.index[s][l[s]])&&n&&a.length>1&&(a=a.slice(0,1)),a||[];var f,d,p=1e10;for(d=0;d<c.length;d++){if(s=c[d],!(a=this.index[s][l[s]]))return[];a.length<p&&(p=a.length,f=d)}for(var g=c[f],m=this.index[g][l[g]],w=c.slice(0,f).concat(c.slice(f+1)),y=[],b=["subject","predicate","object","why"],v=0;v<m.length;v++){var _=m[v];for(d=0;d<w.length;d++)if(s=w[d],!this.canon(_[b[s]]).equals(h[s])){_=null;break}if(null!=_&&(y.push(_),n))break}return y}uris(t){var e=this.canon(t),r=this.aliases[this.id(e)];if(!e.value)return[];var i=[e.value];if(r)for(var n=0;n<r.length;n++)i.push(r[n].uri);return i}serialize(t,e,r,i){return F(r,this,t,e,void 0,i={...i||{},namespaces:i?.namespaces?{...this.namespaces,...i.namespaces}:{...this.namespaces}})}}(0,t.A)(G,"handleRDFType",void 0),G.handleRDFType=V;const W=E("http://www.w3.org/1999/02/22-rdf-syntax-ns#");function Y(t,e){function r(i,n,s){const a=t.statementsMatching(i,W("rest"),null,e);if(1!==a.length)throw new Error(`Bad list structure: no rest at ${i}`);const o=t.statementsMatching(i,W("first"),null,e);if(1!==o.length)throw new Error(`Bad list structure: rest but ${o.length} firsts at ${i}`);const h=[o[0].object].concat(n),l=s.concat(a).concat(o),u=t.statementsMatching(null,W("rest"),i,e);if(0===u.length){const r=new f(h);return t.remove(l),void function(t,e,r,i){for(const n of t.statementsMatching(r,null,null,i)){const r=new y(e,n.predicate,n.object,i);t.remove(n),t.add(r)}for(const n of t.statementsMatching(null,r,null,i))t.remove(n),t.add(new y(n.subject,e,n.object,i));for(const n of t.statementsMatching(null,null,r,i))t.remove(n),t.add(new y(n.subject,n.predicate,e,i))}(t,r,i,e)}if(1!==u.length)throw new Error(`Bad list structure: ${u.length} pres at ${i}`);const c=u[0].subject;if("BlankNode"!==c.termType)throw new Error(`Bad list element node ${c} type: ${c.termType} `);r(c,h,l)}!function(t,e){const r=W("nil");for(const i of t.statementsMatching(r,null,null,e)){t.remove(i);const r=new f;t.add(new y(r,i.predicate,i.object,e))}for(const i of t.statementsMatching(null,null,r,e))if(!i.predicate.sameTerm(W("rest"))){t.remove(i);const r=new f;t.add(new y(i.subject,i.predicate,r,e))}}(t,e),t.statementsMatching(null,W("rest"),W("nil"),e).forEach((t=>{if("BlankNode"!==t.subject.termType)throw new Error(`Bad list element node ${t.subject} type: ${t.subject.termType} `);r(t.subject,[],[])}))}var Z="http://www.w3.org/2000/10/swap/log#",J=function(t){return t},K=function(t){return t},tt=function(t){if(t.length>0)throw"missing.js: oops nnonempty dict not imp";return[]},et=function(t){return t.length},rt=function(t,e,r){if(void 0===t.slice)throw"@@ mising.js: No .slice function for "+t+" of type "+typeof t;return void 0===r||null==r?t.slice(e):t.slice(e,r)},it=Error("dummy error stop iteration"),nt=function(t){return this.last=0,this.li=t,this.next=function(){if(this.last==this.li.length)throw it;return this.li[this.last++]},this},st=function(t,e){return t.indexOf(e)},at=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;r<t.length;r++){var i=t.charCodeAt(r);i<128?e+=String.fromCharCode(i):i>127&&i<2048?(e+=String.fromCharCode(i>>6|192),e+=String.fromCharCode(63&i|128)):(e+=String.fromCharCode(i>>12|224),e+=String.fromCharCode(i>>6&63|128),e+=String.fromCharCode(63&i|128))}return e}(this)},String.prototype.decode=function(t){if("utf-8"!=t)throw"UTF8_converter: can only do utf-8";return this};var ot=function(t,e){return b.join(e,t)},ht="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil",lt="http://www.w3.org/2002/07/owl#sameAs",ut="\t\r\n !\"#$%&'()*.,+/;<=>?@[\\]^`{|}~",ct=ut+":",ft=new RegExp("^([-+]?[0-9]+)(\\.[0-9]+)?([eE][-+]?[0-9]+)?","g"),dt=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?"),pt=new RegExp("[\\s#]"),gt=new RegExp('[\\\\\\r\\n\\"]',"g"),mt=new RegExp("^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*","g");function wt(t,e){var r=t.charAt(e+1);return""===r||pt.test(r)}const yt=function(t,e,r,i,n,s,a,o){return new bt(t,e,r,i,n,s,a,o)};class bt{constructor(t,e,r,i,n,s,a,o){void 0===e&&(e=null),void 0===r&&(r=""),void 0===i&&(i=null),void 0===n&&(n=""),void 0===s&&(s=null),void 0===a&&(a=""),void 0===o&&(o=null),this._bindings=new tt([]),this._flags=a,""!=r&&(at(r.indexOf(":")>=0,"Document URI not absolute: "+r),this._bindings[""]=r+"#"),this._store=t,n&&t.setGenPrefix(n),this._thisDoc=r,this.source=t.sym(r),this.lines=0,this.statementCount=0,this.hasNil=!1,this.startOfLine=0,this.previousLine=0,this._genPrefix=n,this.keywords=new K(["a","this","bind","has","is","of","true","false"]),this.keywordsSet=0,this._anonymousNodes=new tt([]),this._variables=new tt([]),this._parentVariables=new tt([]),this._reason=o,this._reason2=null,this._baseURI=i||r||null,at(!this._baseURI||this._baseURI.indexOf(":")>=0),this._genPrefix||(this._thisDoc?this._genPrefix=this._thisDoc+"#_g":this._genPrefix=RDFSink_uniqueURI()),null==e?this._thisDoc?this._formula=t.formula(r+"#_formula"):this._formula=t.formula():this._formula=e,this._context=this._formula,this._parentContext=null}here(t){return this._genPrefix+"_L"+this.lines+"C"+(t-this.startOfLine+1)}formula(){return this._formula}loadStream(t){return this.loadBuf(t.read())}loadBuf(t){return this.startDoc(),this.feed(t),this.endDoc()}feed(t){for(var e=t.decode("utf-8"),r=0;r>=0;){var i=this.skipSpace(e,r);if(i<0)return;if((r=this.directiveOrStatement(e,i))<0)throw vt(this._thisDoc,this.lines,e,i,"expected directive or statement")}}directiveOrStatement(t,e){var r,i=this.skipSpace(t,e);return i<0?i:(r=this.directive(t,i))>=0||(r=this.statement(t,i))>=0?this.checkDot(t,r):r}tok(t,e,r){if("@"==e.slice(r,r+1))r+=1;else if(M(this.keywords,t)<0)return-1;var i=r+et(t);return e.slice(r,i)==t&&ut.indexOf(e.charAt(i))>=0?i:-1}directive(t,e){if((s=this.skipSpace(t,e))<0)return s;var r=new K([]);if((s=this.tok("bind",t,e))>0)throw vt(this._thisDoc,this.lines,t,e,"keyword bind is obsolete: use @prefix");if((s=this.tok("keywords",t,e))>0){if((e=this.commaSeparatedList(t,s,r,!1))<0)throw vt(this._thisDoc,this.lines,t,e,"'@keywords' needs comma separated list of words");return this.setKeywords(rt(r,null,null)),e}if((s=this.tok("forAll",t,e))>0){if((e=this.commaSeparatedList(t,s,r,!0))<0)throw vt(this._thisDoc,this.lines,t,e,"Bad variable list after @forAll");var i=new nt(r);try{for(;;){var n=i.next();(M(this._variables,n)<0||M(this._parentVariables,n)>=0)&&(this._variables[n]=this._context.newUniversal(n))}}catch(t){if(t!=it)throw t}return e}if((s=this.tok("forSome",t,e))>0){if((e=this.commaSeparatedList(t,s,r,this.uri_ref2))<0)throw vt(this._thisDoc,this.lines,t,e,"Bad variable list after @forSome");i=new nt(r);try{for(;;)n=i.next(),this._context.declareExistential(n)}catch(t){if(t!=it)throw t}return e}if((s=this.tok("prefix",t,e))>=0){var s,a=new K([]);if((e=this.qname(t,s,a))<0)throw vt(this._thisDoc,this.lines,t,s,"expected qname after @prefix");if((s=this.uri_ref2(t,e,a))<0)throw vt(this._thisDoc,this.lines,t,e,"expected <uriref> after @prefix _qname_");var o=a[1].uri;return this._baseURI?o=ot(this._baseURI,o):at(o.indexOf(":")>=0,"With no base URI, cannot handle relative URI for NS"),at(o.indexOf(":")>=0),this._bindings[a[0][0]]=o,this.bind(a[0][0],function(t){return encodeURI(t)}(o)),s}if((s=this.tok("base",t,e))>=0){if(a=new K([]),(e=this.uri_ref2(t,s,a))<0)throw vt(this._thisDoc,this.lines,t,s,"expected <uri> after @base ");if(o=a[0].uri,!this._baseURI)throw vt(this._thisDoc,this.lines,t,s,"With no previous base URI, cannot use relative URI in @base <"+o+">");return o=ot(this._baseURI,o),at(o.indexOf(":")>=0),this._baseURI=o,e}return-1}bind(t,e){""==t||this._store.setPrefixForURI(t,e)}setKeywords(t){null==t?this.keywordsSet=0:(this.keywords=t,this.keywordsSet=1)}startDoc(){}endDoc(){return this.hasNil&&this._store.rdfFactory.supports.COLLECTIONS&&Y(this._store,this.source),this._formula}makeStatement(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}statement(t,e){var r=new K([]);if((e=this.object(t,e,r))<0)return e;var i=this.property_list(t,e,r[0]);if(i<0)throw vt(this._thisDoc,this.lines,t,e,"expected propertylist");return i}subject(t,e,r){return this.item(t,e,r)}verb(t,e,r){if((n=this.skipSpace(t,e))<0)return n;var i=new K([]);if((n=this.tok("has",t,e))>=0){if((e=this.prop(t,n,i))<0)throw vt(this._thisDoc,this.lines,t,n,"expected property after 'has'");return r.push(new J(["->",i[0]])),e}if((n=this.tok("is",t,e))>=0){if((e=this.prop(t,n,i))<0)throw vt(this._thisDoc,this.lines,t,n,"expected <property> after 'is'");if((n=this.skipSpace(t,e))<0)throw vt(this._thisDoc,this.lines,t,e,"End of file found, expected property after 'is'");var n;if(e=n,(n=this.tok("of",t,e))<0)throw vt(this._thisDoc,this.lines,t,e,"expected 'of' after 'is' <prop>");return r.push(new J(["<-",i[0]])),n}if((n=this.tok("a",t,e))>=0)return r.push(new J(["->",this._store.sym("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")])),n;if("<="==t.slice(e,e+2))return r.push(new J(["<-",this._store.sym(Z+"implies")])),e+2;if("="==t.slice(e,e+1))return">"==t.slice(e+1,e+2)?(r.push(new J(["->",this._store.sym(Z+"implies")])),e+2):(r.push(new J(["->",this._store.sym(lt)])),e+1);if(":="==t.slice(e,e+2))return r.push(new J(["->",Z+"becomes"])),e+2;if((n=this.prop(t,e,i))>=0)return r.push(new J(["->",i[0]])),n;if(">-"==t.slice(e,e+2)||"<-"==t.slice(e,e+2))throw vt(this._thisDoc,this.lines,t,n,">- ... -> syntax is obsolete.");return-1}prop(t,e,r){return this.item(t,e,r)}item(t,e,r){return this.path(t,e,r)}blankNode(t){return this._context.bnode(t,this._reason2)}path(t,e,r){if((s=this.nodeOrLiteral(t,e,r))<0)return s;for(;"!^.".indexOf(t.slice(s,s+1))>=0;){var i=t.slice(s,s+1);if("."==i){var n=t.slice(s+1,s+2);if(!n||ct.indexOf(n)>=0&&":?<[{(".indexOf(n)<0)break}var s,a=r.pop(),o=this.blankNode(this.here(s));if((s=this.node(t,s+1,r))<0)throw vt(this._thisDoc,this.lines,t,s,"EOF found in middle of path syntax");var h=r.pop();"^"==i?this.makeStatement(new J([this._context,h,o,a])):this.makeStatement(new J([this._context,h,a,o])),r.push(o)}return s}anonymousNode(t){if(e=this._anonymousNodes[t])return e;var e=this._store.bnode(t);return this._anonymousNodes[t]=e,e}node(t,e,r,i){void 0===i&&(i=null);var n=i;if((u=this.skipSpace(t,e))<0)return u;e=u;var s=t.slice(e,e+1);if("["==s){var a=this.here(e);if((u=this.skipSpace(t,e+1))<0)throw vt(this._thisDoc,this.lines,t,e,"EOF after '['");if("="==t.slice(u,u+1)){e=u+1;var o=new K([]);if(!((u=this.objectList(t,e,o))>=0))throw vt(this._thisDoc,this.lines,t,e,"objectList expected after [= ");if(n=o[0],et(o)>1){var h=new nt(o);try{for(;;){var l=h.next();this.makeStatement(new J([this._context,this._store.sym(lt),n,l]))}}catch(t){if(t!=it)throw t}}if((u=this.skipSpace(t,u))<0)throw vt(this._thisDoc,this.lines,t,e,"EOF when objectList expected after [ = ");if(";"==t.slice(u,u+1))var u=u+1}if(null==n&&(n=this.blankNode(a)),(e=this.property_list(t,u,n))<0)throw vt(this._thisDoc,this.lines,t,u,"property_list expected");if((u=this.skipSpace(t,e))<0)throw vt(this._thisDoc,this.lines,t,e,"EOF when ']' expected after [ <propertyList>");if("."==t.slice(u,u+1))return r.push(n),u;if("]"!=t.slice(u,u+1))throw vt(this._thisDoc,this.lines,t,u,"']' expected");return r.push(n),u+1}if("{"==s){if("$"==t.slice(e+1,e+2)){u=(e+=1)+1;for(var c=new K([]),f=!0;;){if((e=this.skipSpace(t,u))<0)throw vt(this._thisDoc,this.lines,t,e,"needed '$}', found end.");if("$}"==t.slice(e,e+2)){u=e+2;break}if(f)f=!1;else{if(","!=t.slice(e,e+1))throw vt(this._thisDoc,this.lines,t,e,"expected: ','");e+=1}var d=new K([]);if((u=this.item(t,e,d))<0)throw vt(this._thisDoc,this.lines,t,e,"expected item in set or '$}'");c.push(d[0])}return r.push(this._store.newSet(c,this._context)),u}u=e+1;var p=this._parentContext;this._parentContext=this._context;var g=this._anonymousNodes,m=this._parentVariables;this._parentVariables=this._variables,this._anonymousNodes=new tt([]),this._variables=this._variables.slice();var w=this._reason2;for(this._reason2=null,null==n&&(n=this._store.formula()),this._context=n;;){if((e=this.skipSpace(t,u))<0)throw vt(this._thisDoc,this.lines,t,e,"needed '}', found end.");if("}"==t.slice(e,e+1)){u=e+1;break}if((u=this.directiveOrStatement(t,e))<0)throw vt(this._thisDoc,this.lines,t,e,"expected statement or '}'")}return this._anonymousNodes=g,this._variables=this._parentVariables,this._parentVariables=m,this._context=this._parentContext,this._reason2=w,this._parentContext=p,r.push(n.close()),u}if("("==s){var y=this._store.list;for("$"==t.slice(e+1,e+2)&&(y=this._store.newSet,e+=1),u=e+1,c=new K([]);;){if((e=this.skipSpace(t,u))<0)throw vt(this._thisDoc,this.lines,t,e,"needed ')', found end.");if(")"==t.slice(e,e+1)){u=e+1;break}if(d=new K([]),(u=this.item(t,e,d))<0)throw vt(this._thisDoc,this.lines,t,e,"expected item in list or ')'");c.push(d[0])}return r.push(y(c,this._context)),u}if((u=this.tok("this",t,e))>=0)throw vt(this._thisDoc,this.lines,t,e,"Keyword 'this' was ancient N3. Now use @forSome and @forAll keywords.");return(u=this.tok("true",t,e))>=0?(r.push(!0),u):(u=this.tok("false",t,e))>=0?(r.push(!1),u):null==n&&(u=this.uri_ref2(t,e,r))>=0?u:-1}property_list(t,e,r){for(;;){if((u=this.skipSpace(t,e))<0)throw vt(this._thisDoc,this.lines,t,e,"EOF found when expected verb in property list");if(":-"!=t.slice(u,u+2)){e=u;var i=new K([]);if((u=this.verb(t,e,i))<=0)return e;var n=new K([]);if((e=this.objectList(t,u,n))<0)throw vt(this._thisDoc,this.lines,t,u,"objectList expected");var s=new nt(n);try{for(;;){var a=s.next(),o=i[0],h=o[0],l=o[1];"->"==h?this.makeStatement(new J([this._context,l,r,a])):this.makeStatement(new J([this._context,l,a,r]))}}catch(t){if(t!=it)throw t}if((u=this.skipSpace(t,e))<0)throw vt(this._thisDoc,this.lines,t,u,"EOF found in list of objects");if(";"!=t.slice(e,e+1))return e;e+=1}else{e=u+2;var u,c=new K([]);if((u=this.node(t,e,c,r))<0)throw vt(this._thisDoc,this.lines,t,e,"bad {} or () or [] node after :- ");e=u}}}commaSeparatedList(t,e,r,i){if((n=this.skipSpace(t,e))<0)throw vt(this._thisDoc,this.lines,t,n,"EOF found expecting comma sep list");if("."==t.charAt(n))return e;if(i)var n=this.uri_ref2(t,n,r);else n=this.bareWord(t,n,r);if(n<0)return-1;for(;;){if((e=this.skipSpace(t,n))<0)return e;var s=t.slice(e,e+1);if(","!=s)return"."!=s?-1:e;if((n=i?this.uri_ref2(t,e+1,r):this.bareWord(t,e+1,r))<0)throw vt(this._thisDoc,this.lines,t,n,"bad list content")}}objectList(t,e,r){if((e=this.object(t,e,r))<0)return-1;for(;;){var i=this.skipSpace(t,e);if(i<0)throw vt(this._thisDoc,this.lines,t,i,"EOF found after object");if(","!=t.slice(i,i+1))return i;if((e=this.object(t,i+1,r))<0)return e}}checkDot(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 vt(this._thisDoc,this.lines,t,r,"expected '.' or '}' or ']' at end of statement")}uri_ref2(t,e,r){var i=new K([]);if((f=this.qname(t,e,i))>=0){var n=i[0],s=n[0],a=n[1];if(null==s){at(0,"not used?");var o=this._baseURI+"#"}else if(!(o=this._bindings[s])){if("_"==s)return r.push(this.anonymousNode(a)),f;throw vt(this._thisDoc,this.lines,t,e,"Prefix "+s+" not bound.")}var h=this._store.sym(o+a);return M(this._variables,h)>=0?r.push(this._variables[h]):r.push(h),f}if((e=this.skipSpace(t,e))<0)return-1;if("?"==t.charAt(e)){var l=new K([]);return(f=this.variable(t,e,l))>0?(r.push(l[0]),f):-1}if("<"==t.charAt(e)){for(var u=e+=1;e<et(t);){if(">"==t.charAt(e)){var c=t.slice(u,e);return this._baseURI?c=ot(this._baseURI,c):at(c.indexOf(":")>=0,"With no base URI, cannot deal with relative URIs"),"#"==t.slice(e-1,e)&&"#"!=rt(c,-1,null)&&(c+="#"),h=this._store.sym(c),M(this._variables,h)>=0?r.push(this._variables[h]):r.push(h),e+1}e+=1}throw vt(this._thisDoc,this.lines,t,f,"unterminated URI reference")}if(this.keywordsSet){var f;if(l=new K([]),(f=this.bareWord(t,e,l))<0)return-1;if(M(this.keywords,l[0])>=0)throw vt(this._thisDoc,this.lines,t,e,'Keyword "'+l[0]+'" not allowed here.');return r.push(this._store.sym(this._bindings[""]+l[0])),f}return-1}skipSpace(t,e){for(var r=e||0;r<t.length;r++){var i=t.charAt(r);if(" \n\r\t\f\v \u2028\u2029 ".indexOf(i)<0){if("#"!==t.charAt(r))return r;for(;;r++){if(r===t.length)return-1;if("\n"===t.charAt(r)){this.lines=this.lines+1;break}}}else"\n"===t.charAt(r)&&(this.lines=this.lines+1)}return-1}variable(t,e,r){if((i=this.skipSpace(t,e))<0)return-1;if("?"!=t.slice(i,i+1))return-1;var i;if(e=i+=1,"0123456789-".indexOf(t.charAt(i))>=0)throw vt(this._thisDoc,this.lines,t,i,"Varible name can't start with '"+t.charAt(i)+"s'");for(;e<et(t)&&ct.indexOf(t.charAt(e))<0;)e+=1;if(null==this._parentContext)throw vt(this._thisDoc,this.lines,t,i,"Can't use ?xxx syntax for variable in outermost level: "+t.slice(i-1,e));return r.push(this._store.variable(t.slice(i,e))),e}bareWord(t,e,r){var i=this.skipSpace(t,e);if(i<0)return-1;var n=t.charAt(i);if("0123456789-".indexOf(n)>=0)return-1;if(ct.indexOf(n)>=0)return-1;for(e=i;e<et(t);){var s=t.charAt(e);if("."===s){if(wt(t,e))break}else if(ct.indexOf(s)>=0)break;e+=1}return r.push(t.slice(i,e)),e}qname(t,e,r){if((e=this.skipSpace(t,e))<0)return-1;var i=t.charAt(e);if("0123456789-+".indexOf(i)>=0)return-1;if(ct.indexOf(i)<0){var n=i;for(e+=1;e<et(t);){if("."===(i=t.charAt(e))){if(wt(t,e))break}else if(ct.indexOf(i)>=0)break;n+=i,e+=1}}else n="";if(e<et(t)&&":"==t.charAt(e)){var s=n;for(e+=1,n="";e<et(t);){if("."===(i=t.charAt(e))){if(wt(t,e))break}else if(ct.indexOf(i)>=0)break;n+=i,e+=1}return r.push(new J([s,n])),e}return n&&this.keywordsSet&&M(this.keywords,n)<0?(r.push(new J(["",n])),e):-1}object(t,e,r){if((s=this.subject(t,e,r))>=0)return s;{if((s=this.skipSpace(t,e))<0)return-1;e=s;var i=null;let o=t.charAt(e);if('"'==o||"'"==o){i=t.slice(e,e+3==o+o)?o+o+o:o,e+=et(i);var n=this.strconst(t,e,i),s=n[0],a=n[1];return r.push(this._store.literal(a)),s}return-1}}nodeOrLiteral(t,e,r){if((h=this.node(t,e,r))>=0)return h;if((h=this.skipSpace(t,e))<0)return-1;e=h;var i=t.charAt(e);if("-+0987654321".indexOf(i)>=0){if(dt.lastIndex=0,null!=(c=dt.exec(t.slice(e))))h=e+(n=c[0]).length,n.indexOf("T")>=0?r.push(this._store.literal(n,this._store.sym("http://www.w3.org/2001/XMLSchema#dateTime"))):r.push(this._store.literal(n,this._store.sym("http://www.w3.org/2001/XMLSchema#date")));else{var n;if(ft.lastIndex=0,null==(c=ft.exec(t.slice(e))))throw vt(this._thisDoc,this.lines,t,e,"Bad number or date syntax");h=e+ft.lastIndex,(n=t.slice(e,h)).indexOf("e")>=0?r.push(this._store.literal(parseFloat(n),this._store.sym("http://www.w3.org/2001/XMLSchema#double"))):t.slice(e,h).indexOf(".")>=0?r.push(this._store.literal(parseFloat(n),this._store.sym("http://www.w3.org/2001/XMLSchema#decimal"))):r.push(this._store.literal(parseInt(n),this._store.sym("http://www.w3.org/2001/XMLSchema#integer")))}return h}if('"'==t.charAt(e)){if('"""'==t.slice(e,e+3))var s='"""';else s='"';e+=et(s);var a=null,o=this.strconst(t,e,s),h=o[0],l=o[1],u=null;if("@"==t.slice(h,h+1)){var c;if(mt.lastIndex=0,null==(c=mt.exec(t.slice(h+1))))throw vt(this._thisDoc,startline,t,e,"Bad language code syntax on string literal, after @");e=mt.lastIndex+h+1,u=t.slice(h+1,e),h=e}if("^^"==t.slice(h,h+2)){var f=new K([]);h=this.uri_ref2(t,h+2,f),a=f[0]}return r.push(this._store.literal(l,u||a)),h}return-1}strconst(t,e,r){for(var i=e,n="",s=this.lines;i<et(t);){if(e=i+et(r),t.slice(i,e)==r)return new J([e,n]);if('"'!=t.charAt(i)){if(gt.lastIndex=0,!gt.exec(t.slice(i)))throw vt(this._thisDoc,s,t,i,"Closing quote missing in string at ^ in "+t.slice(i-20,i)+"^"+t.slice(i,i+20));if(e=i+gt.lastIndex-1,n+=t.slice(i,e),'"'!=(h=t.charAt(e)))if("\r"!=h){if("\n"==h){if('"'==r)throw vt(this._thisDoc,s,t,e,"newline found in string literal");this.lines=this.lines+1,n+=h,i=e+1,this.previousLine=this.startOfLine,this.startOfLine=i}else if("\\"==h){if(i=e+1,!(h=t.slice(i,i+1)))throw vt(this._thisDoc,s,t,e,"unterminated string literal (2)");var a=st('abfrtvn\\"',h);if(a>=0)n+='a\b\f\r\t\v\n\\"'.charAt(a),i+=1;else if("u"==h)i=(o=this.uEscape(t,i+1,s))[0],n+=h=o[1];else{if("U"!=h)throw vt(this._thisDoc,this.lines,t,e,"bad escape");var o,h;i=(o=this.UEscape(t,i+1,s))[0],n+=h=o[1]}}}else i=e+1;else i=e}else n=n+'"',i=i+1}throw vt(this._thisDoc,this.lines,t,e,"unterminated string literal")}uEscape(t,e,r){for(var i=e,n=0,s=0;n<4;){var a=t.slice(i,i+1).toLowerCase();if(i+=1,""==a)throw vt(this._thisDoc,r,t,e,"unterminated string literal(3)");var o=st("0123456789abcdef",a);if(o<0)throw vt(this._thisDoc,r,t,e,"bad string literal hex escape");s=16*s+o,n+=1}var h=String.fromCharCode(s);return new J([i,h])}UEscape(t,e,r){for(var i=e,n=0,s="\\U";n<8;){var a=t.slice(i,i+1).toLowerCase();if(i+=1,""==a)throw vt(this._thisDoc,r,t,e,"unterminated string literal(3)");if(st("0123456789abcdef",a)<0)throw vt(this._thisDoc,r,t,e,"bad string literal hex escape");s+=a,n+=1}var o,h=(o="0x"+rt(s,2,10)-0,String.fromCharCode(o));return new J([i,h])}}function vt(t,e,r,i,n){let s=e+1,a="Line "+s+" of <"+t+">: Bad syntax: "+n+'\nat: "'+r.slice(i,i+30)+'"',o=new SyntaxError(a,t,s);return o.lineNo=s,o.characterInFile=i,o.syntaxProblem=n,o}const _t={...A,supports:{[_.collections]:!0,[_.defaultGraphType]:!1,[_.equalsMethod]:!0,[_.identity]:!1,[_.id]:!0,[_.reversibleId]:!1,[_.variableType]:!0},collection:t=>new f(t),id(t){return(0,a.P3)(t)?`( ${t.elements.map((t=>this.id(t))).join(", ")} )`:(0,a.DZ)(t)?v.toString(t):A.id(t)},termToNQ:t=>t.termType===i.r0?f.toNT(t):A.termToNQ(t)},xt=_t;function Tt(t,e){return"string"==typeof e?t.rdfFactory.literal(e):Object.prototype.hasOwnProperty.call(e,"@list")?!0===t.rdfFactory.supports.COLLECTIONS?function(t,e){if(!Array.isArray(e))throw new TypeError("Object must be an array");return t.rdfFactory.collection(e.map((e=>Tt(t,e))))}(t,e["@list"]):function(t,e){const r=e["@id"]?Nt(t,e):t.rdfFactory.blankNode(),i=e["@list"].map((e=>Tt(t,e))),n=L(t.rdfFactory,r,i);return t.addAll(n),r}(t,e):Object.prototype.hasOwnProperty.call(e,"@id")?Nt(t,e):Object.prototype.hasOwnProperty.call(e,"@language")?t.rdfFactory.literal(e["@value"],e["@language"]):Object.prototype.hasOwnProperty.call(e,"@type")?t.rdfFactory.literal(e["@value"],t.rdfFactory.namedNode(e["@type"])):Object.prototype.hasOwnProperty.call(e,"@value")?t.rdfFactory.literal(e["@value"]):t.rdfFactory.literal(e)}async function At(t,e,r){const i=r&&Object.prototype.hasOwnProperty.call(r,"termType")?r.value:r,n=await o.e(515).then(o.t.bind(o,8515,23));return(await n.default.flatten(JSON.parse(t),null,{base:i})).reduce(((t,e)=>Et(t,r,e)),e)}function Nt(t,e){return e["@id"].startsWith("_:")?t.rdfFactory.blankNode(e["@id"].substring(2)):t.rdfFactory.namedNode(e["@id"])}function Et(t,e,r){const i=r["@id"]?Nt(t,r):t.rdfFactory.blankNode();for(const n of Object.keys(r)){if("@id"===n)continue;if("@graph"==n){const e=i,s=r[n];for(let r=0;r<s.length;r++)t=Et(t,e,s[r])}const s=r[n];if(Array.isArray(s))for(let r=0;r<s.length;r++)t.addStatement(Rt(t,i,n,s[r],e));else t.addStatement(Rt(t,i,n,s,e))}return t}function Rt(t,e,r,i,n){let s,a;return"@type"===r?(s=t.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),a=t.rdfFactory.namedNode(i)):(s=t.rdfFactory.namedNode(r),a=Tt(t,i)),t.rdfFactory.quad(e,s,a,t.rdfFactory.namedNode(n))}var kt=o(2313);const It="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Ct="http://www.w3.org/2001/XMLSchema#",Ot="http://www.w3.org/2000/10/swap/",jt={xsd:{decimal:`${Ct}decimal`,boolean:`${Ct}boolean`,double:`${Ct}double`,integer:`${Ct}integer`,string:`${Ct}string`},rdf:{type:`${It}type`,nil:`${It}nil`,first:`${It}first`,rest:`${It}rest`,langString:`${It}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${Ot}reify#forSome`,forAll:`${Ot}reify#forAll`},log:{implies:`${Ot}log#implies`,isImpliedBy:`${Ot}log#isImpliedBy`}},{xsd:St}=jt,Ft=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Ut={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Dt=/[\x00-\x20<>\\"\{\}\|\^\`]/,Lt={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},Mt=/$0^/;class Pt{constructor(t){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,t=t||{},this._isImpliedBy=t.isImpliedBy,this._lineMode=!!t.lineMode){this._n3Mode=!1;for(const t in this)!(t in Lt)&&this[t]instanceof RegExp&&(this[t]=Mt)}else this._n3Mode=!1!==t.n3;this.comments=!!t.comments,this._literalClosingPos=0}_tokenizeToEnd(t,e){let r=this._input,i=r.length;for(;;){let t,a;for(;t=this._newline.exec(r);)this.comments&&(a=this._comment.exec(t[0]))&&n("comment",a[1],"",this._line,t[0].length),r=r.substr(t[0].length,r.length),i=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))&&n("comment",a[1],"",this._line,r.length),r=null,n("eof","","",this._line,0)),this._input=r;const o=this._line,h=r[0];let l="",u="",c="",f=null,d=0,p=!1;switch(h){case"^":if(r.length<3)break;if("^"!==r[1]){this._n3Mode&&(d=1,l="^");break}if(this._previousMarker="^^",r=r.substr(2),"<"!==r[0]){p=!0;break}case"<":if(f=this._unescapedIri.exec(r))l="IRI",u=f[1];else if(f=this._iri.exec(r)){if(u=this._unescape(f[1]),null===u||Dt.test(u))return s(this);l="IRI"}else r.length>1&&"<"===r[1]?(l="<<",d=2):this._n3Mode&&r.length>1&&"="===r[1]&&(d=2,this._isImpliedBy?(l="abbreviation",u="<"):(l="inverse",u=">"));break;case">":r.length>1&&">"===r[1]&&(l=">>",d=2);break;case"_":((f=this._blank.exec(r))||e&&(f=this._blank.exec(`${r} `)))&&(l="blank",c="_",u=f[1]);break;case'"':if(f=this._simpleQuotedString.exec(r))u=f[1];else if(({value:u,matchLength:d}=this._parseLiteral(r)),null===u)return s(this);null===f&&0===d||(l="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(f=this._simpleApostropheString.exec(r))u=f[1];else if(({value:u,matchLength:d}=this._parseLiteral(r)),null===u)return s(this);null===f&&0===d||(l="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(f=this._variable.exec(r))&&(l="var",u=f[0]);break;case"@":"literal"===this._previousMarker&&(f=this._langcode.exec(r))?(l="langcode",u=f[1]):(f=this._keyword.exec(r))&&(l=f[0]);break;case".":if(1===r.length?e:r[1]<"0"||r[1]>"9"){l=".",d=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} `)))&&(l="literal",u=f[0],c="string"==typeof f[1]?St.double:"string"==typeof f[2]?St.decimal:St.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(f=this._sparqlKeyword.exec(r))?l=f[0].toUpperCase():p=!0;break;case"f":case"t":(f=this._boolean.exec(r))?(l="literal",u=f[0],c=St.boolean):p=!0;break;case"a":(f=this._shortPredicates.exec(r))?(l="abbreviation",u="a"):p=!0;break;case"=":this._n3Mode&&r.length>1&&(l="abbreviation",">"!==r[1]?(d=1,u="="):(d=2,u=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(d=1,l=h);break;case"{":!this._lineMode&&r.length>=2&&("|"===r[1]?(l="{|",d=2):(l=h,d=1));break;case"|":r.length>=2&&"}"===r[1]&&(l="|}",d=2);break;default:p=!0}if(p&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(f=this._prefix.exec(r))?((f=this._prefixed.exec(r))||e&&(f=this._prefixed.exec(`${r} `)))&&(l="prefixed",c=f[1]||"",u=this._unescape(f[2])):(l="prefix",u=f[1]||"")),"^^"===this._previousMarker)switch(l){case"prefixed":l="type";break;case"IRI":l="typeIRI";break;default:l=""}if(!l)return e||!/^'''|^"""/.test(r)&&/\n|\r/.test(r)?s(this):this._input=r;const g=d||f[0].length,m=n(l,u,c,o,g);this.previousToken=m,this._previousMarker=l,r=r.substr(g,r.length)}function n(e,n,s,a,o){const h=r?i-r.length:i,l={type:e,value:n,prefix:s,line:a,start:h,end:h+o};return t(null,l),l}function s(e){t(e._syntaxError(/^\S*/.exec(r)[0]))}}_unescape(t){let e=!1;const r=t.replace(Ft,((t,r,i,n)=>{if("string"==typeof r)return String.fromCharCode(Number.parseInt(r,16));if("string"==typeof i){let t=Number.parseInt(i,16);return t<=65535?String.fromCharCode(Number.parseInt(i,16)):String.fromCharCode(55296+((t-=65536)>>10),56320+(1023&t))}return n in Ut?Ut[n]:(e=!0,"")}));return e?null:r}_parseLiteral(t){if(t.length>=3){const e=t.match(/^(?:"""|"|'''|'|)/)[0],r=e.length;let i=Math.max(this._literalClosingPos,r);for(;(i=t.indexOf(e,i))>0;){let e=0;for(;"\\"===t[i-e-1];)e++;if(e%2==0){const e=t.substring(r,i),n=e.split(/\r\n|\r|\n/).length-1,s=i+r;if(1===r&&0!==n||3===r&&this._lineMode)break;return this._line+=n,{value:this._unescape(e),matchLength:s}}i++}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,i)=>r?e=r:t.push(i)),!0),e)throw e;return t}queueMicrotask((()=>this._tokenizeToEnd(e,!0)))}else this._pendingBuffer=null,"function"==typeof t.setEncoding&&t.setEncoding("utf8"),t.on("data",(t=>{null!==this._input&&0!==t.length&&(this._pendingBuffer&&(t=kt.hp.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:Bt,xsd:qt}=jt;let $t,Ht=0;const Xt={namedNode:Zt,blankNode:Jt,variable:te,literal:Kt,defaultGraph:function(){return $t},quad:ee,triple:ee,fromTerm:re,fromQuad:ie};class zt{constructor(t){this.id=t}get value(){return this.id}equals(t){return t instanceof zt?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 Qt extends zt{get termType(){return"NamedNode"}}class Vt extends zt{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const t=this.id;let e=t.lastIndexOf('"')+1;return e<t.length&&"@"===t[e++]?t.substr(e).toLowerCase():""}get datatype(){return new Qt(this.datatypeString)}get datatypeString(){const t=this.id,e=t.lastIndexOf('"')+1,r=e<t.length?t[e]:"";return"^"===r?t.substr(e+2):"@"!==r?qt.string:Bt.langString}equals(t){return t instanceof Vt?this.id===t.id:!!t&&!!t.datatype&&this.termType===t.termType&&this.value===t.value&&this.language===t.language&&this.datatype.value===t.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}}class Gt extends zt{constructor(t){super(`_:${t}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}}class Wt extends zt{constructor(t){super(`?${t}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}}$t=new class extends zt{constructor(){return super(""),$t||this}get termType(){return"DefaultGraph"}equals(t){return this===t||!!t&&this.termType===t.termType}};class Yt extends zt{constructor(t,e,r,i){super(""),this._subject=t,this._predicate=e,this._object=r,this._graph=i||$t}get termType(){return"Quad"}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}get graph(){return this._graph}toJSON(){return{termType:this.termType,subject:this._subject.toJSON(),predicate:this._predicate.toJSON(),object:this._object.toJSON(),graph:this._graph.toJSON()}}equals(t){return!!t&&this._subject.equals(t.subject)&&this._predicate.equals(t.predicate)&&this._object.equals(t.object)&&this._graph.equals(t.graph)}}function Zt(t){return new Qt(t)}function Jt(t){return new Gt(t||"n3-"+Ht++)}function Kt(t,e){if("string"==typeof e)return new Vt(`"${t}"@${e.toLowerCase()}`);let r=e?e.value:"";return""===r&&("boolean"==typeof t?r=qt.boolean:"number"==typeof t&&(Number.isFinite(t)?r=Number.isInteger(t)?qt.integer:qt.double:(r=qt.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),""===r||r===qt.string?new Vt(`"${t}"`):new Vt(`"${t}"^^${r}`)}function te(t){return new Wt(t)}function ee(t,e,r,i){return new Yt(t,e,r,i)}function re(t){if(t instanceof zt)return t;switch(t.termType){case"NamedNode":return Zt(t.value);case"BlankNode":return Jt(t.value);case"Variable":return te(t.value);case"DefaultGraph":return $t;case"Literal":return Kt(t.value,t.language||t.datatype);case"Quad":return ie(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function ie(t){if(t instanceof Yt)return t;if("Quad"!==t.termType)throw new Error(`Unexpected termType: ${t.termType}`);return ee(re(t.subject),re(t.predicate),re(t.object),re(t.graph))}let ne=0;class se{constructor(t){this._contextStack=[],this._graph=null,t=t||{},this._setBase(t.baseIRI),t.factory&&oe(this,t.factory);const e="string"==typeof t.format?t.format.match(/\w*$/)[0].toLowerCase():"",r=/turtle/.test(e),i=/trig/.test(e),n=/triple/.test(e),s=/quad/.test(e),a=this._n3Mode=/n3/.test(e),o=n||s;(this._supportsNamedGraphs=!(r||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(r||i||n||a),this._isImpliedBy=t.isImpliedBy,this._supportsRDFStar=""===e||/star|\*$/.test(e),o&&(this._resolveRelativeIRI=t=>null),this._blankNodePrefix="string"!=typeof t.blankNodePrefix?"":t.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=t.lexer||new Pt({lineMode:o,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!t.explicitQuantifiers}static _resetBlankNodePrefix(){ne=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,i,n){const s=this._n3Mode;this._contextStack.push({type:t,subject:r,predicate:i,object:n,graph:e,inverse:!!s&&this._inversePredicate,blankPrefix:s?this._prefixes._:"",quantified:s?this._quantified:null}),s&&(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._factory.namedNode(e);break;case"type":case"prefixed":const i=this._prefixes[t.prefix];if(void 0===i)return this._error(`Undefined prefix "${t.prefix}:"`,t);r=this._factory.namedNode(i+t.value);break;case"blank":r=this._factory.blankNode(this._prefixes[t.prefix]+t.value);break;case"var":r=this._factory.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._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._factory.blankNode(),null,null),this._readSubject):this._error("Unexpected graph",t);case"}":return this._readPunctuation(t);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',t);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',t);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",t);if(0===t.prefix.length)return this._literalValue=t.value,this._completeSubjectLiteral;this._subject=this._factory.literal(t.value,this._factory.namedNode(t.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",t);default:if(void 0===(this._subject=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(t){const e=t.type;switch(e){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[t.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${e}`,t):(this._subject=null,"]"===e?this._readBlankNodeTail(t):this._readPunctuation(t));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",t);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",t);default:if(void 0===(this._predicate=this._readEntity(t)))return}return this._readObject}_readObject(t){switch(t.type){case"literal":if(0===t.prefix.length)return this._literalValue=t.value,this._readDataTypeOrLang;this._object=this._factory.literal(t.value,this._factory.namedNode(t.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",t);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",t);default:if(void 0===(this._object=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(t){return"{"===t.type?this._readGraph(t):this._readPredicate(t)}_readGraph(t){return"{"!==t.type?this._error(`Expected graph but got ${t.type}`,t):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(t){return"]"===t.type?(this._subject=null,this._readBlankNodeTail(t)):(this._predicate=null,this._readPredicate(t))}_readBlankNodeTail(t){if("]"!==t.type)return this._readBlankNodePunctuation(t);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const e=null===this._predicate;return this._restoreContext("blank",t),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:e?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(t){switch(t.type){case".":case"}":return this._subject=null,this._readPunctuation(t);default:return this._readPredicate(t)}}_readListItem(t){let e=null,r=null,i=this._readListItem;const n=this._subject,s=this._contextStack,a=s[s.length-1];switch(t.type){case"[":this._saveContext("blank",this._graph,r=this._factory.blankNode(),this.RDF_FIRST,this._subject=e=this._factory.blankNode()),i=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,r=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",t),0!==s.length&&"list"===s[s.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(i=this._readPredicate,this._subject===this.RDF_NIL)return i}else if(i=this._getContextEndReader(),this._object===this.RDF_NIL)return i;r=this.RDF_NIL;break;case"literal":0===t.prefix.length?(this._literalValue=t.value,i=this._readListItemDataTypeOrLang):(e=this._factory.literal(t.value,this._factory.namedNode(t.prefix)),i=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",t);default:if(void 0===(e=this._readEntity(t)))return}if(null===r&&(this._subject=r=this._factory.blankNode()),null===n?null===a.predicate?a.subject=r:a.object=r:this._emit(n,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 i}_readDataTypeOrLang(t){return this._completeObjectLiteral(t,!1)}_readListItemDataTypeOrLang(t){return this._completeObjectLiteral(t,!0)}_completeLiteral(t){let e=this._factory.literal(this._literalValue);switch(t.type){case"type":case"typeIRI":const r=this._readEntity(t);if(void 0===r)return;e=this._factory.literal(this._literalValue,r),t=null;break;case"langcode":e=this._factory.literal(this._literalValue,t.value),t=null}return{token:t,literal:e}}_completeSubjectLiteral(t){return this._subject=this._completeLiteral(t).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(t,e){const 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 i=this._subject,n=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,n&&(this._inversePredicate=!1);break;case";":e=this._readPredicate;break;case",":e=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF-star syntax",t);const s=this._predicate,a=this._object;this._subject=this._factory.quad(i,s,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!==i){const t=this._predicate,e=this._object;n?this._emit(e,t,i,r):this._emit(i,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._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(t){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(t)):"."!==t.type?this._error("Expected declaration to end with a dot",t):this._readInTopContext}_readQuantifierList(t){let e;switch(t.type){case"IRI":case"prefixed":if(void 0!==(e=this._readEntity(t,!0)))break;default:return this._error(`Unexpected ${t.type}`,t)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,e,this.QUANTIFIERS_GRAPH)):this._quantified[e.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(t){return","===t.type?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(t))}_getPathReader(t){return this._afterPath=t,this._readPath}_readPath(t){switch(t.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const e=this._contextStack,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 i=this._factory.blankNode();if(void 0!==(r=this._readEntity(t)))return null===this._predicate?(e=this._subject,this._subject=i):(e=this._object,this._object=i),this._emit(e,r,i,this._graph),this._readPath}_readBackwardPath(t){const e=this._factory.blankNode();let r,i;if(void 0!==(r=this._readEntity(t)))return null===this._predicate?(i=this._subject,this._subject=e):(i=this._object,this._object=e),this._emit(e,r,i,this._graph),this._readPath}_readRDFStarTailOrGraph(t){return">>"!==t.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(t))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,t):this._readRDFStarTail(t)}_readRDFStarTail(t){if(">>"!==t.type)return this._error(`Expected >> but got ${t.type}`,t);const e=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",t),null===this._subject?(this._subject=e,this._readPredicate):(this._object=e,this._getContextEndReader())}_getContextEndReader(){const t=this._contextStack;if(!t.length)return this._readPunctuation;switch(t[t.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(t,e,r,i){this._callback(null,this._factory.quad(t,e,r,i||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=ae}_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="",i=-1,n=-1,s=0,a="/";for(;i<e;){switch(a){case":":if(n<0&&"/"===t[++i]&&"/"===t[++i])for(;(n=i+1)<e&&"/"!==t[n];)i=n;break;case"?":case"#":i=e;break;case"/":if("."===t[i+1])switch(a=t[1+ ++i],a){case"/":r+=t.substring(s,i-1),s=i+1;break;case void 0:case"?":case"#":return r+t.substring(s,i)+t.substr(i+1);case".":if(a=t[1+ ++i],void 0===a||"/"===a||"?"===a||"#"===a){if(r+=t.substring(s,i-2),(s=r.lastIndexOf("/"))>=n&&(r=r.substr(0,s)),"/"!==a)return`${r}/${t.substr(i+1)}`;s=i+1}}}a=t[++i]}return r+t.substring(s)}parse(t,e,r){let i,n,s;if(e&&(e.onQuad||e.onPrefix||e.onComment)?(i=e.onQuad,n=e.onPrefix,s=e.onComment):(i=e,n=r),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${ne++}_`,this._prefixCallback=n||ae,this._inversePredicate=!1,this._quantified=Object.create(null),!i){const e=[];let r;if(this._callback=(t,i)=>{t?r=t:i&&e.push(i)},this._lexer.tokenize(t).every((t=>this._readCallback=this._readCallback(t))),r)throw r;return e}let a=(t,e)=>{null!==t?(this._callback(t),this._callback=ae):this._readCallback&&(this._readCallback=this._readCallback(e))};s&&(this._lexer.comments=!0,a=(t,e)=>{null!==t?(this._callback(t),this._callback=ae):this._readCallback&&("comment"===e.type?s(e.value):this._readCallback=this._readCallback(e))}),this._callback=i,this._lexer.tokenize(t,a)}}function ae(){}function oe(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(jt.rdf.first),t.RDF_REST=e.namedNode(jt.rdf.rest),t.RDF_NIL=e.namedNode(jt.rdf.nil),t.N3_FORALL=e.namedNode(jt.r.forAll),t.N3_FORSOME=e.namedNode(jt.r.forSome),t.ABBREVIATIONS={a:e.namedNode(jt.rdf.type),"=":e.namedNode(jt.owl.sameAs),">":e.namedNode(jt.log.implies),"<":e.namedNode(jt.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}if(oe(se.prototype,Xt),void 0===he)var he={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};class le{constructor(t,e){this.options=e||{},this.kb=t,this.target=e.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()}addTriple(t,e,r,i){var n,s,a,o;n=void 0===e?A.namedNode(this.options.base):this.toRDFNodeObject(e),a=this.toRDFNodeObject(r),s=this.toRDFNodeObject(i),o=A.namedNode(this.options.base),this.kb.add(n,a,s,o)}ancestorPath(t){for(var e="";t&&t.nodeType!==he.DOCUMENT_NODE;)e="/"+t.localName+e,t=t.parentNode;return e}copyMappings(t){var e={};for(var r in t)e[r]=t[r];return e}copyProperties(){}deriveDateTimeType(t){for(var e=0;e<le.dateTimeTypes.length;e++){var r=le.dateTimeTypes[e].pattern.exec(t);if(r&&r[0].length===t.length)return le.dateTimeTypes[e].type}return null}init(){}newBlankNode(){return this.blankCounter++,"_:"+this.blankCounter}newSubjectOrigin(t,e){}parseCURIE(t,e,r){var i,n=t.indexOf(":");if(n>=0){var s=t.substring(0,n);if(""===s)return(i=e[""])?i+t.substring(n+1):null;if("_"===s)return"_:"+t.substring(n+1);if(le.NCNAME.test(s)&&(i=e[s]))return i+t.substring(n+1)}return null}parseCURIEOrURI(t,e,r){return this.parseCURIE(t,e,r)||this.resolveAndNormalize(r,t)}parsePredicate(t,e,r,i,n,s){if(""===t)return null;var a=this.parseTermOrCURIEOrAbsURI(t,e,s?null:r,i,n);return a&&0===a.indexOf("_:")?null:a}parsePrefixMappings(t,e){for(var r=this.tokenize(t),i=null,n=0;n<r.length;n++)":"===r[n][r[n].length-1]?i=r[n].substring(0,r[n].length-1):i&&(e[i]=this.options.base?b.join(r[n],this.options.base):r[n],i=null)}static parseRDFaDOM(t,e,r){var i=new le(e,{base:r});t.baseURI||(t.baseURI=r),i.process(t,{baseURI:r})}parseSafeCURIEOrCURIEOrURI(t,e,r){return"["===(t=this.trim(t)).charAt(0)&&"]"===t.charAt(t.length-1)?0===(t=(t=t.substring(1,t.length-1)).trim(t)).length?null:"_:"===t?this.theOne:this.parseCURIE(t,e,r):this.parseCURIEOrURI(t,e,r)}parseTermOrCURIEOrAbsURI(t,e,r,i,n){t=this.trim(t);var s=this.parseCURIE(t,i,n);if(s)return s;if(r){if(e&&!this.absURIRE.exec(t))return e+t;var a=r[t];if(a)return a;if(a=r[t.toLowerCase()])return a}return this.absURIRE.exec(t)?this.resolveAndNormalize(n,t):null}parseTermOrCURIEOrURI(t,e,r,i,n){t=this.trim(t);var s=this.parseCURIE(t,i,n);if(s)return s;var a=r[t];return a||((a=r[t.toLowerCase()])?a:e&&!this.absURIRE.exec(t)?e+t:this.resolveAndNormalize(n,t))}parseURI(t){return t}process(t,e){var r;e=e||{},t.nodeType===he.DOCUMENT_NODE?(t.baseURI&&!e.baseURI&&(e.baseURI=t.baseURI),r=t.baseURI,(t=t.documentElement).baseURI||(t.baseURI=r),this.setContext(t)):t.parentNode.nodeType===he.DOCUMENT_NODE&&this.setContext(t);var i=[],n=function(t){if(!t&&e&&e.baseURI)return e.baseURI;var r=t.indexOf("#");return r>=0&&(t=t.substring(0,r)),e&&e.baseURIMap&&(t=e.baseURIMap(t)),t};for(i.push({current:t,context:this.push(null,n(t.baseURI))});i.length>0;){var s=i.shift();if(s.parent){if(s.context.parent&&s.context.parent.listMapping===s.listMapping)continue;for(let t in s.listMapping){var a=s.listMapping[t];if(0!==a.length){var o=[];for(let t=0;t<a.length;t++)o.push(this.newBlankNode());for(let t=0;t<o.length;t++)this.addTriple(s.parent,o[t],"http://www.w3.org/1999/02/22-rdf-syntax-ns#first",a[t]),this.addTriple(s.parent,o[t],"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest",{type:le.objectURI,value:t+1<o.length?o[t+1]:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"});this.addTriple(s.parent,s.subject,t,{type:le.objectURI,value:o[0]})}else this.addTriple(s.parent,s.subject,t,{type:le.objectURI,value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"})}}else{var h=s.current,l=s.context,u=!1,c=null,f=null,d=null,p=l.prefixes,g=!1,m=[],w=l.listMapping,y=!l.parent,v=l.language,_=l.vocabulary;r=this.parseURI(n(h.baseURI)),h.item=null;var x=h.getAttributeNode("vocab");if(x){let t=this.trim(x.value);if(t.length>0){_=t;var T=r.spec;this.addTriple(h,T,"http://www.w3.org/ns/rdfa#usesVocabulary",{type:le.objectURI,value:_})}else _=this.vocabulary}for(var A=0;A<h.attributes.length;A++){var N=h.attributes[A];if("x"===N.nodeName.charAt(0)&&0===N.nodeName.indexOf("xmlns:")){g||(p=this.copyMappings(p),g=!0);var E=N.nodeName.substring(6),R=le.trim(N.value);p[E]=this.options.base?b.join(R,this.options.base):R}}var k=h.getAttributeNode("prefix");k&&(g||(p=this.copyMappings(p),g=!0),this.parsePrefixMappings(k.value,p));var I=null;for(let t=0;!I&&t<this.langAttributes.length;t++)I=h.getAttributeNodeNS(this.langAttributes[t].namespaceURI,this.langAttributes[t].localName);if(I){let t=le.trim(I.value);v=t.length>0?t:null}var C,O,j=h.getAttributeNode("rel"),S=h.getAttributeNode("rev"),F=h.getAttributeNode("typeof"),U=h.getAttributeNode("property"),D=h.getAttributeNode("datatype"),L=this.inHTMLMode?h.getAttributeNode("datetime"):null,M=h.getAttributeNode("content"),P=h.getAttributeNode("about"),B=h.getAttributeNode("src"),q=h.getAttributeNode("resource"),$=h.getAttributeNode("href"),H=h.getAttributeNode("inlist"),X=[];if(j){O=this.tokenize(j.value);for(let t=0;t<O.length;t++)(C=this.parsePredicate(O[t],_,l.terms,p,r,this.inHTMLMode&&null!==U))&&X.push(C)}var z=[];if(S){O=this.tokenize(S.value);for(let t=0;t<O.length;t++)(C=this.parsePredicate(O[t],_,l.terms,p,r,this.inHTMLMode&&U))&&z.push(C)}if(this.inHTMLMode&&(j||S)&&U&&(0===X.length&&(j=null),0===z.length&&(S=null)),j||S?(P&&(c=this.parseSafeCURIEOrCURIEOrURI(P.value,p,r)),F&&(d=c),c||(h.parentNode.nodeType===he.DOCUMENT_NODE?c=n(h.baseURI):l.parentObject&&(c=n(h.parentNode.baseURI)===l.parentObject?n(h.baseURI):l.parentObject)),q&&(f=this.parseSafeCURIEOrCURIEOrURI(q.value,p,r)),f||($?f=this.resolveAndNormalize(r,encodeURI($.value)):B?f=this.resolveAndNormalize(r,encodeURI(B.value)):!F||P||this.inXHTMLMode&&("head"===h.localName||"body"===h.localName)||(f=this.newBlankNode())),!F||P||!this.inXHTMLMode||"head"!==h.localName&&"body"!==h.localName?F&&!P&&(d=f):d=c):!U||M||D?(P&&(c=this.parseSafeCURIEOrCURIEOrURI(P.value,p,r)),!c&&q&&(c=this.parseSafeCURIEOrCURIEOrURI(q.value,p,r)),!c&&$&&(c=this.resolveAndNormalize(r,encodeURI($.value))),!c&&B&&(c=this.resolveAndNormalize(r,encodeURI(B.value))),c||(h.parentNode.nodeType===he.DOCUMENT_NODE?c=n(h.baseURI):!this.inXHTMLMode&&!this.inHTMLMode||"head"!==h.localName&&"body"!==h.localName?F?c=this.newBlankNode():l.parentObject&&(c=n(h.parentNode.baseURI)===l.parentObject?n(h.baseURI):l.parentObject,U||(u=!0)):c=n(h.parentNode.baseURI)===l.parentObject?n(h.baseURI):l.parentObject),F&&(d=c)):(P&&(c=this.parseSafeCURIEOrCURIEOrURI(P.value,p,r),F&&(d=c)),c||h.parentNode.nodeType!==he.DOCUMENT_NODE?!c&&l.parentObject&&(c=n(h.parentNode.baseURI)===l.parentObject?n(h.baseURI):l.parentObject):(c=n(h.baseURI),F&&(d=c)),F&&!d&&(q&&(d=this.parseSafeCURIEOrCURIEOrURI(q.value,p,r)),!d&&$&&(d=this.resolveAndNormalize(r,encodeURI($.value))),!d&&B&&(d=this.resolveAndNormalize(r,encodeURI(B.value))),d||!this.inXHTMLMode&&!this.inHTMLMode||"head"!==h.localName&&"body"!==h.localName||(d=c),d||(d=this.newBlankNode()),f=d)),c&&(P||q||d)){var Q=c;F&&!P&&!q&&f&&(Q=f),this.newSubjectOrigin(h,Q)}if(d){O=this.tokenize(F.value);for(let t=0;t<O.length;t++){var V=this.parseTermOrCURIEOrAbsURI(O[t],_,l.terms,p,r);V&&this.addTriple(h,d,le.typeURI,{type:le.objectURI,value:V})}}if(c&&c!==l.parentObject&&(w={},y=!0),f){if(j&&H)for(let t=0;t<X.length;t++){let e=w[X[t]];e||(e=[],w[X[t]]=e),e.push({type:le.objectURI,value:f})}else if(j)for(let t=0;t<X.length;t++)this.addTriple(h,c,X[t],{type:le.objectURI,value:f});if(S)for(let t=0;t<z.length;t++)this.addTriple(h,f,z[t],{type:le.objectURI,value:c})}else{if(c&&!f&&(j||S)&&(f=this.newBlankNode()),j&&H)for(let t=0;t<X.length;t++){let e=w[X[t]];e||(e=[],w[C]=e),m.push({predicate:X[t],list:e})}else if(j)for(let t=0;t<X.length;t++)m.push({predicate:X[t],forward:!0});if(S)for(let t=0;t<z.length;t++)m.push({predicate:z[t],forward:!1})}if(U){var G=null,W=null;D?(G=""===D.value?le.PlainLiteralURI:this.parseTermOrCURIEOrAbsURI(D.value,_,l.terms,p,r),W=L&&!M?L.value:G===le.XMLLiteralURI||G===le.HTMLLiteralURI?null:M?M.value:h.textContent):M?(G=le.PlainLiteralURI,W=M.value):L?(W=L.value,(G=le.deriveDateTimeType(W))||(G=le.PlainLiteralURI)):j||S||(q&&(W=this.parseSafeCURIEOrCURIEOrURI(q.value,p,r)),!W&&$?W=this.resolveAndNormalize(r,encodeURI($.value)):!W&&B&&(W=this.resolveAndNormalize(r,encodeURI(B.value))),W&&(G=le.objectURI)),G||(F&&!P?(G=le.objectURI,W=d):(W=h.textContent,this.inHTMLMode&&"time"===h.localName&&(G=le.deriveDateTimeType(W)),G||(G=le.PlainLiteralURI))),O=this.tokenize(U.value);for(let t=0;t<O.length;t++){let e=this.parsePredicate(O[t],_,l.terms,p,r);if(e)if(H){let t=w[e];t||(t=[],w[e]=t),t.push(G===le.XMLLiteralURI||G===le.HTMLLiteralURI?{type:G,value:h.childNodes}:{type:G||le.PlainLiteralURI,value:W,language:v})}else G===le.XMLLiteralURI||G===le.HTMLLiteralURI?this.addTriple(h,c,e,{type:G,value:h.childNodes}):this.addTriple(h,c,e,{type:G||le.PlainLiteralURI,value:W,language:v})}}if(c&&!u)for(let t=0;t<l.incomplete.length;t++)l.incomplete[t].list?l.incomplete[t].list.push({type:le.objectURI,value:c}):l.incomplete[t].forward?this.addTriple(h,l.subject,l.incomplete[t].predicate,{type:le.objectURI,value:c}):this.addTriple(h,c,l.incomplete[t].predicate,{type:le.objectURI,value:l.subject});var Y=null,Z=c;u?((Y=this.push(l,l.subject)).parentObject=n(h.parentNode.baseURI)===l.parentObject?n(h.baseURI):l.parentObject,Y.incomplete=l.incomplete,Y.language=v,Y.prefixes=p,Y.vocabulary=_):((Y=this.push(l,c)).parentObject=f||c||l.subject,Y.prefixes=p,Y.incomplete=m,f&&(Z=f,w={},y=!0),Y.listMapping=w,Y.language=v,Y.vocabulary=_),y&&i.unshift({parent:h,context:l,subject:Z,listMapping:w});for(var J=h.lastChild;J;J=J.previousSibling)J.nodeType===he.ELEMENT_NODE&&i.unshift({current:J,context:Y})}}this.inHTMLMode&&this.copyProperties();for(let e=0;e<this.finishedHandlers.length;e++)this.finishedHandlers[e](t)}push(t,e){return{parent:t,subject:e||(t?t.subject:null),parentObject:null,incomplete:[],listMapping:t?t.listMapping:{},language:t?t.language:this.language,prefixes:t?t.prefixes:this.target.graph.prefixes,terms:t?t.terms:this.target.graph.terms,vocabulary:t?t.vocabulary:this.vocabulary}}resolveAndNormalize(t,e){return b.join(e,t)}setContext(t){"html"===t.localName&&"XHTML+RDFa 1.1"===t.getAttribute("version")?this.setXHTMLContext():"html"===t.localName||"http://www.w3.org/1999/xhtml"===t.namespaceURI?"undefined"!=typeof document&&document.doctype?"-//W3C//DTD XHTML+RDFa 1.0//EN"===document.doctype.publicId&&"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"===document.doctype.systemId?(console.log("WARNING: RDF 1.0 is not supported. Defaulting to HTML5 mode."),this.setHTMLContext()):"-//W3C//DTD XHTML+RDFa 1.1//EN"===document.doctype.publicId&&"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd"===document.doctype.systemId?this.setXHTMLContext():this.setHTMLContext():this.setHTMLContext():this.setXMLContext()}setHTMLContext(){this.setInitialContext(),this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"},{namespaceURI:null,localName:"lang"}],this.inXHTMLMode=!1,this.inHTMLMode=!0}setInitialContext(){this.vocabulary=null,this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"}]}setXHTMLContext(){this.setInitialContext(),this.inXHTMLMode=!0,this.inHTMLMode=!1,this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"},{namespaceURI:null,localName:"lang"}],this.target.graph.terms.alternate="http://www.w3.org/1999/xhtml/vocab#alternate",this.target.graph.terms.appendix="http://www.w3.org/1999/xhtml/vocab#appendix",this.target.graph.terms.bookmark="http://www.w3.org/1999/xhtml/vocab#bookmark",this.target.graph.terms.cite="http://www.w3.org/1999/xhtml/vocab#cite",this.target.graph.terms.chapter="http://www.w3.org/1999/xhtml/vocab#chapter",this.target.graph.terms.contents="http://www.w3.org/1999/xhtml/vocab#contents",this.target.graph.terms.copyright="http://www.w3.org/1999/xhtml/vocab#copyright",this.target.graph.terms.first="http://www.w3.org/1999/xhtml/vocab#first",this.target.graph.terms.glossary="http://www.w3.org/1999/xhtml/vocab#glossary",this.target.graph.terms.help="http://www.w3.org/1999/xhtml/vocab#help",this.target.graph.terms.icon="http://www.w3.org/1999/xhtml/vocab#icon",this.target.graph.terms.index="http://www.w3.org/1999/xhtml/vocab#index",this.target.graph.terms.last="http://www.w3.org/1999/xhtml/vocab#last",this.target.graph.terms.license="http://www.w3.org/1999/xhtml/vocab#license",this.target.graph.terms.meta="http://www.w3.org/1999/xhtml/vocab#meta",this.target.graph.terms.next="http://www.w3.org/1999/xhtml/vocab#next",this.target.graph.terms.prev="http://www.w3.org/1999/xhtml/vocab#prev",this.target.graph.terms.previous="http://www.w3.org/1999/xhtml/vocab#previous",this.target.graph.terms.section="http://www.w3.org/1999/xhtml/vocab#section",this.target.graph.terms.stylesheet="http://www.w3.org/1999/xhtml/vocab#stylesheet",this.target.graph.terms.subsection="http://www.w3.org/1999/xhtml/vocab#subsection",this.target.graph.terms.start="http://www.w3.org/1999/xhtml/vocab#start",this.target.graph.terms.top="http://www.w3.org/1999/xhtml/vocab#top",this.target.graph.terms.up="http://www.w3.org/1999/xhtml/vocab#up",this.target.graph.terms.p3pv1="http://www.w3.org/1999/xhtml/vocab#p3pv1",this.target.graph.terms.related="http://www.w3.org/1999/xhtml/vocab#related",this.target.graph.terms.role="http://www.w3.org/1999/xhtml/vocab#role",this.target.graph.terms.transformation="http://www.w3.org/1999/xhtml/vocab#transformation"}setXMLContext(){this.setInitialContext(),this.inXHTMLMode=!1,this.inHTMLMode=!1}tokenize(t){return this.trim(t).split(/\s+/)}static tokenize(t){return this.trim(t).split(/\s+/)}toRDFNodeObject(t){if(void 0!==t){if("string"==typeof t)return"_:"===t.substring(0,2)?(void 0===this.blankNodes[t.substring(2)]&&(this.blankNodes[t.substring(2)]=new n(t.substring(2))),this.blankNodes[t.substring(2)]):A.namedNode(t);switch(t.type){case le.objectURI:return"_:"===t.value.substring(0,2)?(void 0===this.blankNodes[t.value.substring(2)]&&(this.blankNodes[t.value.substring(2)]=new n(t.value.substring(2))),this.blankNodes[t.value.substring(2)]):A.namedNode(t.value);case le.PlainLiteralURI:return new u(t.value,t.language||"");case le.XMLLiteralURI:case le.HTMLLiteralURI:var e="";return Object.keys(t.value).forEach((r=>{e+=C.domToString(t.value[r],this.htmlOptions)})),new u(e,"",new s.A(t.type));default:return new u(t.value,"",new s.A(t.type))}}}trim(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}static trim(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}}le.XMLLiteralURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral",le.HTMLLiteralURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML",le.PlainLiteralURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral",le.objectURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#object",le.typeURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",le.nameChar="[-A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�က0-F.0-9·̀-ͯ‿-⁀]",le.nameStartChar="[A-Za-zÀ-ÖØ-öø-ÿĀ-ıĴ-ľŁ-ňŊ-žƀ-ǃǍ-ǰǴ-ǵǺ-ȗɐ-ʨʻ-ˁΆΈ-ΊΌΎ-ΡΣ-ώϐ-ϖϚϜϞϠϢ-ϳЁ-ЌЎ-яё-ќў-ҁҐ-ӄӇ-ӈӋ-ӌӐ-ӫӮ-ӵӸ-ӹԱ-Ֆՙա-ֆא-תװ-ײء-غف-يٱ-ڷں-ھۀ-ێې-ۓەۥ-ۦअ-हऽक़-ॡঅ-ঌএ-ঐও-নপ-রলশ-হড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઋઍએ-ઑઓ-નપ-રલ-ળવ-હઽૠଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଶ-ହଽଡ଼-ଢ଼ୟ-ୡஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-வஷ-ஹఅ-ఌఎ-ఐఒ-నప-ళవ-హౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹൠ-ൡก-ฮะา-ำเ-ๅກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ຮະາ-ຳຽເ-ໄཀ-ཇཉ-ཀྵႠ-Ⴥა-ჶᄀᄂ-ᄃᄅ-ᄇᄉᄋ-ᄌᄎ-ᄒᄼᄾᅀᅌᅎᅐᅔ-ᅕᅙᅟ-ᅡᅣᅥᅧᅩᅭ-ᅮᅲ-ᅳᅵᆞᆨᆫᆮ-ᆯᆷ-ᆸᆺᆼ-ᇂᇫᇰᇹḀ-ẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼΩK-Å℮ↀ-ↂぁ-ゔァ-ヺㄅ-ㄬ가-힣一-龥〇〡-〩_]",le.NCNAME=new RegExp("^"+le.nameStartChar+le.nameChar+"*$"),le.dateTimeTypes=[{pattern:/-?P(?:[0-9]+Y)?(?:[0-9]+M)?(?:[0-9]+D)?(?:T(?:[0-9]+H)?(?:[0-9]+M)?(?:[0-9]+(?:\.[0-9]+)?S)?)?/,type:"http://www.w3.org/2001/XMLSchema#duration"},{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])?/,type:"http://www.w3.org/2001/XMLSchema#dateTime"},{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])?/,type:"http://www.w3.org/2001/XMLSchema#date"},{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])?/,type:"http://www.w3.org/2001/XMLSchema#time"},{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]/,type:"http://www.w3.org/2001/XMLSchema#gYearMonth"},{pattern:/-?[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9]/,type:"http://www.w3.org/2001/XMLSchema#gYear"}];const ue=le.parseRDFaDOM;class ce{constructor(t){this.store=t,this.bnodes={},this.why=null,this.reify=!1}frameFactory(t,e,r){return{NODE:1,ARC:2,parent:e,parser:t,store:t.store,element:r,lastChild:0,base:null,lang:null,node:null,nodeType:null,listIndex:1,rdfid:null,datatype:null,collection:!1,terminateFrame:function(){this.collection&&this.node.close()},addSymbol:function(t,e){e=b.join(e,this.base),this.node=this.store.sym(e),this.nodeType=t},loadTriple:function(){if(this.parent.parent.collection?this.parent.parent.node.append(this.node):this.store.add(this.parent.parent.node,this.parent.node,this.node,this.parser.why),null!=this.parent.rdfid){var t=this.store.sym(b.join("#"+this.parent.rdfid,this.base));this.store.add(t,this.store.sym(ce.ns.RDF+"type"),this.store.sym(ce.ns.RDF+"Statement"),this.parser.why),this.store.add(t,this.store.sym(ce.ns.RDF+"subject"),this.parent.parent.node,this.parser.why),this.store.add(t,this.store.sym(ce.ns.RDF+"predicate"),this.parent.node,this.parser.why),this.store.add(t,this.store.sym(ce.ns.RDF+"object"),this.node,this.parser.why)}},isTripleToLoad:function(){return null!=this.parent&&null!=this.parent.parent&&this.nodeType===this.NODE&&this.parent.nodeType===this.ARC&&this.parent.parent.nodeType===this.NODE},addNode:function(t){this.addSymbol(this.NODE,t),this.isTripleToLoad()&&this.loadTriple()},addCollection:function(){this.nodeType=this.NODE,this.node=this.store.collection(),this.collection=!0,this.isTripleToLoad()&&this.loadTriple()},addCollectionArc:function(){this.nodeType=this.ARC},addBNode:function(t){null!=t?null!=this.parser.bnodes[t]?this.node=this.parser.bnodes[t]:this.node=this.parser.bnodes[t]=this.store.bnode():this.node=this.store.bnode(),this.nodeType=this.NODE,this.isTripleToLoad()&&this.loadTriple()},addArc:function(t){t===ce.ns.RDF+"li"&&(t=ce.ns.RDF+"_"+this.parent.listIndex,this.parent.listIndex++),this.addSymbol(this.ARC,t)},addLiteral:function(t){this.parent.datatype&&this.parent.datatype!==ce.ns.RDF+"langString"?this.node=this.store.literal(t,this.store.sym(this.parent.datatype)):this.node=this.store.literal(t,this.lang),this.nodeType=this.NODE,this.isTripleToLoad()&&this.loadTriple()}}}getAttributeNodeNS(t,e,r){var i=null;if(t.getAttributeNodeNS)i=t.getAttributeNodeNS(e,r);else for(var n,s=t.attributes,a=0;a<s.length;++a)if((n=s[a]).namespaceURI===e&&(n.prefix?n.prefix+":"+r:r)===n.nodeName){i=n;break}return i}parse(t,e,r){var i,n=t.childNodes;if(this.cleanParser(),t.nodeType===ce.nodeType.DOCUMENT){for(var s=0;s<n.length;s++)if(n[s].nodeType===ce.nodeType.ELEMENT){i=n[s];break}}else{if(t.nodeType!==ce.nodeType.ELEMENT)throw new Error("RDFParser: can't find root in "+e+". Halting. ");i=t}this.why=r;var a=this.frameFactory(this);return this.base=e,a.base=e,a.lang=null,this.parseDOM(this.buildFrame(a,i)),!0}parseDOM(t){for(var e,r=function(t){var e="";if(null==t.namespaceURI)throw new Error("RDF/XML syntax error: No namespace for "+t.localName+" in "+this.base);return t.namespaceURI&&(e+=t.namespaceURI),t.localName?e+=t.localName:t.nodeName&&(t.nodeName.indexOf(":")>=0?e+=t.nodeName.split(":")[1]:e+=t.nodeName),e}.bind(this),i=!0;t.parent;){var n=t.element,s=n.attributes;if(n.nodeType===ce.nodeType.TEXT||n.nodeType===ce.nodeType.CDATA_SECTION)t.parent.nodeType===t.NODE&&(t.addArc(ce.ns.RDF+"value"),t=this.buildFrame(t)),t.addLiteral(n.nodeValue);else if(r(n)!==ce.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(r(n)),this.reify&&(e=this.getAttributeNodeNS(n,ce.ns.RDF,"ID"))&&(t.rdfid=e.nodeValue,n.removeAttributeNode(e));var a=this.getAttributeNodeNS(n,ce.ns.RDF,"parseType"),o=this.getAttributeNodeNS(n,ce.ns.RDF,"datatype");if(o&&(t.datatype=o.nodeValue,n.removeAttributeNode(o)),a){var h=a.nodeValue;"Literal"===h?(t.datatype=ce.ns.RDF+"XMLLiteral",(t=this.buildFrame(t)).addLiteral(n.innerHTML||n.childNodes),i=!1):"Resource"===h?((t=this.buildFrame(t,t.element)).parent.element=null,t.addBNode()):"Collection"===h&&((t=this.buildFrame(t,t.element)).parent.element=null,t.addCollection()),n.removeAttributeNode(a)}if(0!==s.length){var l=this.getAttributeNodeNS(n,ce.ns.RDF,"resource"),u=this.getAttributeNodeNS(n,ce.ns.RDF,"nodeID");t=this.buildFrame(t),l?(t.addNode(l.nodeValue),n.removeAttributeNode(l)):u?(t.addBNode(u.nodeValue),n.removeAttributeNode(u)):t.addBNode();for(var c=s.length-1;c>=0;c--){var f=this.buildFrame(t);f.addArc(r(s[c])),r(s[c])===ce.ns.RDF+"type"?this.buildFrame(f).addNode(s[c].nodeValue):this.buildFrame(f).addLiteral(s[c].nodeValue)}}else 0===n.childNodes.length&&this.buildFrame(t).addLiteral("")}else{var d=this.getAttributeNodeNS(n,ce.ns.RDF,"about");if(e=this.getAttributeNodeNS(n,ce.ns.RDF,"ID"),d&&e)throw new Error("RDFParser: "+n.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),n.removeAttributeNode(e);else if(null==d&&null==e){var p=this.getAttributeNodeNS(n,ce.ns.RDF,"nodeID");p?(t.addBNode(p.nodeValue),n.removeAttributeNode(p)):t.addBNode()}else t.addNode(d.nodeValue),n.removeAttributeNode(d);var g=this.getAttributeNodeNS(n,ce.ns.RDF,"type");ce.ns.RDF+"Description"!==r(n)&&(g={nodeValue:r(n)}),null!=g&&(this.store.add(t.node,this.store.sym(ce.ns.RDF+"type"),this.store.sym(b.join(g.nodeValue,t.base)),this.why),g.nodeName&&n.removeAttributeNode(g));for(var m=s.length-1;m>=0;m--)this.store.add(t.node,this.store.sym(r(s[m])),this.store.literal(s[m].nodeValue,t.lang),this.why)}for(n=t.element;t.parent;){for(var w=t;null==n;)n=(t=t.parent).element;var y=n.childNodes&&n.childNodes[t.lastChild];if(y&&i){if((y.nodeType===ce.nodeType.ELEMENT||y.nodeType===ce.nodeType.TEXT||y.nodeType===ce.nodeType.CDATA_SECTION)&&(y.nodeType!==ce.nodeType.TEXT&&y.nodeType!==ce.nodeType.CDATA_SECTION||1===n.childNodes.length)){t.lastChild++,t=this.buildFrame(w,n.childNodes[t.lastChild-1]);break}t.lastChild++}else{if(t.terminateFrame(),!(t=t.parent))break;n=t.element,i=!0}}}}cleanParser(){this.bnodes={},this.why=null}buildFrame(t,e){var r=this.frameFactory(this,t,e);if(t&&(r.base=t.base,r.lang=t.lang),!e||e.nodeType===ce.nodeType.TEXT||e.nodeType===ce.nodeType.CDATA_SECTION)return r;var i=e.attributes,n=e.getAttributeNode("xml:base");null!=n&&(r.base=n.nodeValue,e.removeAttribute("xml:base"));var s=e.getAttributeNode("xml:lang");null!=s&&(r.lang=s.nodeValue,e.removeAttribute("xml:lang"));for(var a=i.length-1;a>=0;a--)if("xml"===i[a].nodeName.substr(0,3)){if("xmlns:"===i[a].name.slice(0,6)){var o=i[a].nodeValue;this.base&&(o=b.join(o,this.base)),this.store.setPrefixForURI(i[a].name.slice(6),o)}e.removeAttributeNode(i[a])}return r}}function fe(t,e,r){var i,n,s,a=["INSERT","DELETE","WHERE"],o=E("http://www.w3.org/ns/pim/patch#"),h=yt(e,e,r,r,null,null,"",null),l={},u=function(t,e,r,i,n){return"Line "+(e+1)+" of <"+t+">: Bad syntax:\n "+n+'\n at: "'+r.slice(i,i+30)+'"'};i=0;var c=e.sym(r+"#query");for(l.query=c;;){if((n=h.skipSpace(t,i))<0)return l;if(";"===t[n]){if((i=h.skipSpace(t,n+1))<0)return l;n=i}var f=!1;for(s=0;s<a.length;s++){var d=a[s];if(t.slice(n,n+d.length)===d){if((i=h.skipSpace(t,n+d.length))<0)throw u(h._thisDoc,h.lines,t,n+d.length,"found EOF, needed {...} after "+d);if(("INSERT"===d||"DELETE"===d)&&"DATA"===t.slice(i,i+4)){if((n=h.skipSpace(t,i+4))<0)throw u(h._thisDoc,h.lines,t,i+4,"needed {...} after INSERT DATA "+d);i=n}var p=[];if((n=h.node(t,i,p))<0)throw u(h._thisDoc,h.lines,t,i,"bad syntax or EOF in {...} after "+d);l[d.toLowerCase()]=p[0],e.add(c,o(d.toLowerCase()),p[0]),f=!0,i=n}}if(!f&&"@prefix"===t.slice(n,n+7)){if((i=h.directive(t,n))<0)throw u(h._thisDoc,h.lines,t,i,"bad syntax or EOF after @prefix ");i=h.checkDot(t,i),f=!0}if(!f)throw u(h._thisDoc,h.lines,t,n,"Unknown syntax at start of statememt: '"+t.slice(n).slice(0,20)+"'")}}function de(t,e,r,n="text/turtle",s){n=(n=n||i.sT).split(";")[0];try{if(n===i.ny||n===i.sT)yt(e,e,r,r,null,null,"",null).loadBuf(t),o();else if(n===i.JG)new ce(e).parse(C.parseXML(t),r,e.sym(r)),o();else if(n===i.H)ue(C.parseXML(t,{contentType:i.H}),e,r),o();else if(n===i.lc)ue(C.parseXML(t,{contentType:i.lc}),e,r),o();else if(n===i.K9||n===i.Fn)fe(t,e,r),o();else if(n===i.i2)At(t,e,r).then(o).catch(h);else{if(n!==i._0&&n!==i.BR)throw void 0===n?new Error("contentType is undefined"):new Error("Don't know how to parse "+n+" yet");var a=new se({factory:xt});!function(t,r){try{a.parse(r,l)}catch(t){s(t,e)}}(null,t)}}catch(t){h(t)}function o(){s&&s(null,e)}function h(t){if(n!==i.i2||n!==i._0||n!==i.BR){if(!s){let e=new Error(t+" while trying to parse <"+r+"> as "+n);throw e.cause=t,e}s(t,e)}}function l(t,r){r?e.add(r.subject,r.predicate,r.object,r.graph):s(t,e)}de.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,t.A)(ce,"ns",{RDF:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",RDFS:"http://www.w3.org/2000/01/rdf-schema#"}),(0,t.A)(ce,"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 pe=o(1147),ge=o.n(pe),me=o(362);const we={"text/n3":!0,"text/turtle":!0,"application/rdf+xml":!0,"application/xhtml+xml":!0,"text/html":!0,"application/ld+json":!0},ye={rdf:i.JG,owl:i.JG,n3:"text/n3",ttl:"text/turtle",nt:"text/n3",acl:"text/n3",html:"text/html",xml:"text/xml"},be=t=>({link:E("http://www.w3.org/2007/ont/link#",t),http:E("http://www.w3.org/2007/ont/http#",t),httph:E("http://www.w3.org/2007/ont/httph#",t),rdf:E("http://www.w3.org/1999/02/22-rdf-syntax-ns#",t),rdfs:E("http://www.w3.org/2000/01/rdf-schema#",t),dc:E("http://purl.org/dc/elements/1.1/",t),ldp:E("http://www.w3.org/ns/ldp#",t)}),ve=be();class _e{constructor(e,r){(0,t.A)(this,"response",void 0),(0,t.A)(this,"dom",void 0),this.response=e,this.dom=r}}(0,t.A)(_e,"pattern",void 0);class xe extends _e{static toString(){return"RDFXMLHandler"}static register(t){t.mediatypes[i.JG]={q:.9}}parse(t,e,r){let i=t.store;if(this.dom||(this.dom=C.parseXML(e)),"parsererror"===this.dom.documentElement.nodeName)return t.failFetch(r,"Badly formed XML in "+r.resource.value,"parse_error");let n=new ce(i);try{n.parse(this.dom,r.original.value,r.original)}catch(e){return t.failFetch(r,"Syntax error parsing RDF/XML! "+e,"parse_error")}return r.noMeta||i.add(r.original,ve.rdf("type"),ve.link("RDFDocument"),t.appNode),t.doneFetch(r,this.response)}}xe.pattern=new RegExp("application/rdf\\+xml");class Te extends _e{static toString(){return"XHTMLHandler"}static register(t){t.mediatypes[i.H]={q:.8}}parse(t,e,r){let i,n;this.dom||(this.dom=C.parseXML(e));let s=t.store,a=this.dom.getElementsByTagName("title");a.length>0&&s.add(r.resource,ve.dc("title"),s.rdfFactory.literal(a[0].textContent),r.resource);let o=this.dom.getElementsByTagName("link");for(let e=o.length-1;e>=0;e--)i=o[e].getAttribute("rel"),n=!1,i||(i=o[e].getAttribute("rev"),n=!0),i&&t.linkData(r.original,i,o[e].getAttribute("href"),r.resource,n);let h=this.dom.getElementsByTagName("script");for(let t=0;t<h.length;t++){let e=h[t].getAttribute("type");we[e]&&(de(h[t].textContent,s,r.original.value,e),de(h[t].textContent,s,r.original.value,e))}if(r.noMeta||s.add(r.resource,ve.rdf("type"),ve.link("WebPage"),t.appNode),!r.noRDFa&&ue)try{ue(this.dom,s,r.original.value)}catch(e){let i="Error trying to parse "+r.resource+" as RDFa:\n"+e+":\n"+e.stack;return t.failFetch(r,i,"parse_error")}return t.doneFetch(r,this.response)}}Te.pattern=new RegExp("application/xhtml");class Ae extends _e{static toString(){return"XMLHandler"}static register(t){t.mediatypes["text/xml"]={q:.5},t.mediatypes["application/xml"]={q:.5}}static isElement(t){return t.nodeType===Node.ELEMENT_NODE}parse(t,e,r){let i=C.parseXML(e);for(let n=0;n<i.childNodes.length;n++){const s=i.childNodes[n];if(Ae.isElement(s)){let n=s.namespaceURI;if(n&&n===n.rdf)return t.addStatus(r.req,"Has XML root element in the RDF namespace, so assume RDF/XML."),new xe(this.response,i).parse(t,e,r);break}}if(i.doctype&&"html"===i.doctype.name&&i.doctype.publicId.match(/^-\/\/W3C\/\/DTD XHTML/)&&i.doctype.systemId.match(/http:\/\/www.w3.org\/TR\/xhtml/))return t.addStatus(r.req,"Has XHTML DOCTYPE. Switching to XHTML Handler.\n"),new Te(this.response,i).parse(t,e,r);let n=i.getElementsByTagName("html")[0];if(n){let s=n.getAttribute("xmlns");if(s&&s.match(/^http:\/\/www.w3.org\/1999\/xhtml/))return t.addStatus(r.req,"Has a default namespace for XHTML. Switching to XHTMLHandler.\n"),new Te(this.response,i).parse(t,e,r)}return t.failFetch(r,"Unsupported dialect of XML: not RDF or XHTML namespace, etc.\n"+e.slice(0,80),901)}}Ae.pattern=new RegExp("(text|application)/(.*)xml");class Ne extends _e{static toString(){return"HTMLHandler"}static register(t){t.mediatypes["text/html"]={q:.8}}parse(t,e,r){let i=t.store;if(Ce(e))return t.addStatus(r.req,"Has an XML declaration. We'll assume it's XHTML as the content-type was text/html.\n"),new Te(this.response).parse(t,e,r);if(function(t){const e=t.indexOf("<!DOCTYPE html"),r=t.indexOf(">");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 Te(this.response).parse(t,e,r);if(function(t){return!!t.match(/[^(<html)]*<html\s+[^<]*xmlns=['"]http:\/\/www.w3.org\/1999\/xhtml["'][^<]*>/)}(e))return t.addStatus(r.req,"Has default namespace for XHTML, so switching to XHTMLHandler.\n"),new Te(this.response).parse(t,e,r);let n=new RegExp("<title>([\\s\\S]+?)</title>","im").exec(e);return n&&i.add(r.resource,ve.dc("title"),i.rdfFactory.literal(n[1]),r.resource),i.add(r.resource,ve.rdf("type"),ve.link("WebPage"),t.appNode),t.addStatus(r.req,"non-XML HTML document, not parsed for data."),t.doneFetch(r,this.response)}}Ne.pattern=new RegExp("text/html");class Ee extends _e{static toString(){return"JsonLdHandler"}static register(t){t.mediatypes["application/ld+json"]={q:.9}}async parse(t,e,r,i){const n=t.store;try{return await At(e,n,r.original.value),t.store.add(r.original,ve.rdf("type"),ve.link("RDFDocument"),t.appNode),t.doneFetch(r,i)}catch(e){const n="Error trying to parse "+r.resource+" as JSON-LD:\n"+e;return t.failFetch(r,n,"parse_error",i)}}}Ee.pattern=/application\/(ld\+json|activity\+json)/;class Re extends _e{static toString(){return"TextHandler"}static register(t){t.mediatypes["text/plain"]={q:.5}}parse(t,e,r){return Ce(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 Ae(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 Ae(this.response).parse(t,e,r)):(t.addStatus(r.req,"Plain text document, no known RDF semantics."),t.doneFetch(r,this.response))}}Re.pattern=new RegExp("text/plain");class ke extends _e{static toString(){return"N3Handler"}static register(t){t.mediatypes["text/n3"]={},t.mediatypes["text/turtle"]={}}parse(t,e,r,i){let n=t.store,s=yt(n,n,r.original.value,r.original.value,null,null,"",null);try{s.loadBuf(e)}catch(e){let n="Error trying to parse "+r.resource+" as Notation3:\n"+e;return t.failFetch(r,n,"parse_error",i)}return t.addStatus(r.req,"N3 parsed: "+s.statementCount+" triples in "+s.lines+" lines."),t.store.add(r.original,ve.rdf("type"),ve.link("RDFDocument"),t.appNode),t.doneFetch(r,this.response)}}ke.pattern=new RegExp("(application|text)/(x-)?(rdf\\+)?(n3|turtle)");const Ie={RDFXMLHandler:xe,XHTMLHandler:Te,XMLHandler:Ae,HTMLHandler:Ne,TextHandler:Re,N3Handler:ke,JsonLdHandler:Ee};function Ce(t){return!!t.match(/\s*<\?xml\s+version\s*=[^<>]+\?>/)}class Oe{constructor(e,r={}){if((0,t.A)(this,"store",void 0),(0,t.A)(this,"timeout",void 0),(0,t.A)(this,"_fetch",void 0),(0,t.A)(this,"mediatypes",void 0),(0,t.A)(this,"appNode",void 0),(0,t.A)(this,"requested",void 0),(0,t.A)(this,"timeouts",void 0),(0,t.A)(this,"redirectedTo",void 0),(0,t.A)(this,"fetchQueue",void 0),(0,t.A)(this,"fetchCallbacks",void 0),(0,t.A)(this,"nonexistent",void 0),(0,t.A)(this,"lookedUp",void 0),(0,t.A)(this,"handlers",void 0),(0,t.A)(this,"ns",void 0),(0,t.A)(this,"fireCallbacks",void 0),this.store=e||new G,this.ns=be(this.store.rdfFactory),this.timeout=r.timeout||3e4,this._fetch=r.fetch||void 0!==o.g&&(o.g.solidFetcher||o.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}},C.callbackify(this,["request","fail","refresh","retract","done"]),Object.keys(r.handlers||Ie).map((t=>this.addHandler(Ie[t])))}static crossSiteProxy(t){return Oe.crossSiteProxyTemplate?Oe.crossSiteProxyTemplate.replace("{uri}",encodeURIComponent(t)):void 0}static offlineOverride(t){let e=t;var r;return"undefined"!=typeof window&&window.panes&&(r=window.panes.UI)&&r.preferences&&r.preferences.get("offlineModeUsingLocalhost")&&"http://"===e.slice(0,7)&&"localhost/"!==e.slice(7,17)&&(e="http://localhost/"+e.slice(7),N.A.warn("Localhost kludge for offline use: actually getting <"+e+">")),e}static proxyIfNecessary(t){var e;if("undefined"!=typeof window&&window.panes&&(e=window.panes.UI)&&e.isExtension)return t;if("undefined"!=typeof $SolidTestEnvironment&&$SolidTestEnvironment.localSiteMap){let e=t.split("/").slice(2);const r=(t,e)=>{let i=e[t.shift()];return i?"string"==typeof i?i+t.join("/"):t?r(t,i):null:null},i=r(e,$SolidTestEnvironment.localSiteMap);if(i)return i}return Oe.crossSiteProxyTemplate&&"undefined"!=typeof document&&document.location&&"https:"===(""+document.location).slice(0,6)&&"http:"===t.slice(0,5)?Oe.crossSiteProxyTemplate.replace("{uri}",encodeURIComponent(t)):t}static unsupportedProtocol(t){let e=b.protocol(t);return"tel"===e||"mailto"===e||"urn"===e}static setCredentials(t,e={}){void 0===e.credentials&&(void 0!==e.withCredentials?e.credentials=e.withCredentials?"include":"omit":e.credentials="include")}load(t,e={}){if(e=Object.assign({},e),t instanceof Array)return Promise.all(t.map((t=>this.load(t,Object.assign({},e)))));const r=t;let i=(0,me.E)(r);i=i.split("#")[0],e=this.initFetchOptions(i,e);const n=this.appNode,s=this.store,a=s.statementsMatching(void 0,this.ns.link("requestedURI"),s.sym(i),n).map((t=>t.subject));for(const t of a){const r=s.any(t,this.ns.link("response"),null,n);if(null!=r){const t=s.statementsMatching(r,this.ns.link("outOfDate"),!0,n);s.remove(t),e.force=!0,e.clearPreviousData=!0}}const o=this.initFetchOptions(i,e);return this.pendingFetchPromise(i,o.baseURI,o)}async pendingFetchPromise(t,e,r){let i;return!r.force&&await this.fetchQueue[e]?i=this.fetchQueue[e]:(i=Promise.race([this.setRequestTimeout(t,r),this.fetchUri(t,r)]),this.fetchQueue[e]=i,this.cleanupFetchRequest(e,void 0,this.timeout)),i.then((e=>(t in this.timeouts&&(this.timeouts[t].forEach(clearTimeout),delete this.timeouts[t]),e)))}cleanupFetchRequest(t,e,r){void 0!==e&&console.warn("_options is deprecated"),this.timeouts[t]=(this.timeouts[t]||[]).concat(setTimeout((()=>{this.isPending(t)||delete this.fetchQueue[t]}),r))}initFetchOptions(t,e){let r=this.store;!e.method||"GET"===e.method.toUpperCase()||(e.force=!0),e.resource=r.rdfFactory.namedNode(t),e.baseURI=e.baseURI||t,e.original=r.rdfFactory.namedNode(e.baseURI),e.req=r.bnode(),e.headers=e.headers||{},e.contentType&&(e.headers["content-type"]=e.contentType),e.force&&(e.cache="no-cache");let i=this.acceptString();e.headers.accept=i;let n=Oe.offlineOverride(t);e.requestedURI=n,Oe.setCredentials(n,e);let s=Oe.proxyIfNecessary(n);return n!==s&&(e.proxyUsed=!0),e.actualProxyURI=s,e}fetchUri(t,e){if(!t)return Promise.reject(new Error("Cannot fetch an empty uri"));if(Oe.unsupportedProtocol(t))return this.failFetch(e,"fetcher: Unsupported protocol","unsupported_protocol");let r=this.getState(t);if(e.force)delete this.nonexistent[t];else{if("fetched"===r)return Promise.resolve(this.doneFetch(e,{status:200,ok:!0,statusText:"Already loaded into quadstore."}));if("failed"===r&&404===this.requested[t]){let r="Previously failed: "+this.requested[t],i={url:t,status:this.requested[t],statusText:r,responseText:r,headers:new pe.Headers,ok:!1,body:null,bodyUsed:!1,size:0,timeout:0};return this.failFetch(e,r,this.requested[t],i)}}this.fireCallbacks("request",[t]),this.requested[t]=!0,e.noMeta||this.saveRequestMetadata(t,e);let{actualProxyURI:i}=e;return this._fetch(i,e).then((r=>this.handleResponse(r,t,e)),(r=>{let n={url:i,status:999,statusText:(r.name||"network failure")+": "+(r.errno||r.code||r.type),responseText:r.message,headers:new pe.Headers,ok:!1,body:null,bodyUsed:!1,size:0,timeout:0};return this.handleError(n,t,e)}))}nowOrWhenFetched(t,e,r,i={}){const n=(0,me.E)(t);"function"==typeof e?r=e:void 0===e||((0,a.Y2)(e)?i.referringTerm=e:i=e),this.load(n,i).then((t=>{if(r)if(t)if(t.ok)r(!0,"OK",t);else{let 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 <"+n+"> "+e,t.response&&t.response.status&&(e+=" status: "+t.response.status),r(!1,e,t.response)}))}addStatus(t,e){let r=new Date;e="["+r.getHours()+":"+r.getMinutes()+":"+r.getSeconds()+"."+r.getMilliseconds()+"] "+e;let i=this.store;const n=i.the(t,this.ns.link("status"));(0,a.P3)(n)?n.append(i.rdfFactory.literal(e)):N.A.warn("web.js: No list to add to: "+n+","+e)}failFetch(t,e,r,i){this.addStatus(t.req,e),t.noMeta||this.store.add(t.original,this.ns.link("error"),this.store.rdfFactory.literal(e));let n=(t.method||"GET").toUpperCase();("GET"===n||"HEAD"===n)&&(t.resource.equals(t.original),this.requested[b.docpart(t.original.value)]=r,this.fireCallbacks("fail",[t.original.value,e]));var s=new Error("Fetcher: "+e);return s.status=r,s.statusText=e,s.response=i,Promise.reject(s)}linkData(t,e,r,i,n){if(!r)return;let s,a=this.store,o=a.rdfFactory.namedNode(b.join(r,t.value));if("alternate"===e||"seeAlso"===e||"meta"===e||"describedby"===e){if(o.value===t.value)return;s=this.ns.rdfs("seeAlso")}else s="type"===e?a.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"):a.rdfFactory.namedNode(b.join(encodeURIComponent(e),"http://www.iana.org/assignments/link-relations/"));n?a.add(o,s,t,i):a.add(t,s,o,i)}parseLinkHeader(t,e,r){if(!t)return;const i=/[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*"))/g,n=t.match(/<[^>]*>\s*(\s*;\s*[^()<>@,;:"/[\]?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*")))*(,|$)/g);if(null!=n)for(let t=0;t<n.length;t++){let s=n[t].split(">"),a=s[0].substring(1),o=s[1].match(i);if(null==o)return;for(let t=0;t<o.length;t++){let i=o[t].split("=")[1].replace(/["']/g,"");this.linkData(e,i,a,r)}}}doneFetch(t,e){return this.addStatus(t.req,"Done."),this.requested[t.original.value]="done",this.fireCallbacks("done",[t.original.value]),e.req=t.req,e}nowKnownAs(t,e){this.lookedUp[t.value]?this.lookedUp[e.value]||this.lookUpThing(e,t):this.lookedUp[e.value]&&(this.lookedUp[t.value]||this.lookUpThing(t,e))}putBack(t,e={}){const r=(0,me.E)(t);let n=new s.A(r).doc();return e.contentType=e["content-type"]||e["Content-Type"]||e.contentType||i.sT,"application/ld+json"===e.contentType?new Promise(((r,i)=>{F(n,this.store,n.uri,e.contentType,((n,s)=>{n?i(n):(e.data=s,this.webOperation("PUT",t,e).then((t=>r(t))).catch((t=>i(t))))}))})):(e.data=F(n,this.store,n.value,e.contentType),this.webOperation("PUT",r,e))}webCopy(t,e,r){return this.webOperation("GET",t).then((t=>this.webOperation("PUT",e,{data:t.responseText,contentType:r})))}delete(t,e){return this.webOperation("DELETE",t,e).then((e=>(this.requested[t]=404,this.nonexistent[t]=!0,this.unload(this.store.rdfFactory.namedNode(t)),e)))}async createIfNotExists(t,e=i.sT,r=""){const n=this;try{var s=await n.load(t)}catch(i){if(404===i.response.status){try{s=await n.webOperation("PUT",t.value,{data:r,contentType:e})}catch(t){throw t}return delete n.requested[t.value],s}throw i}return s}createContainer(t,e,r){let n={"content-type":i.sT,link:this.ns.ldp("BasicContainer")+'; rel="type"'};e&&(n.slug=e);let s={headers:n};return r&&(s.body=r),this.webOperation("POST",t,s)}invalidateCache(t){const e=(0,me.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]){let t=`Rdflib: fetcher: Destructive operation on <${r.requested[e]}> file being fetched! `+e;console.error(t)}else delete r.requested[e],delete r.nonexistent[e]}webOperation(t,e,r={}){const i=(0,me.E)(e);r.method=t,r.body=r.data||r.body,r.force=!0;const n=this;if(r.body&&!r.contentType)throw new Error("Web operation sending data must have a defined contentType.");return r.contentType&&(r.headers=r.headers||{},r.headers["content-type"]=r.contentType),Oe.setCredentials(i,r),new Promise((function(e,s){n._fetch(i,r).then((r=>{if(r.ok)"PUT"!==t&&"PATCH"!==t&&"POST"!==t&&"DELETE"!==t||n.invalidateCache(i),r.text?r.text().then((t=>{r.responseText=t,e(r)})):e(r);else{let e="Web error: "+r.status;r.statusText&&(e+=" ("+r.statusText+")"),e+=" on "+t+" of <"+i+">",r.responseText&&(e+=": "+r.responseText);let n=new Error(e);n.response=r,s(n)}}),(e=>{s(new Error("Fetch error for "+t+" of <"+i+">:"+e))}))}))}lookUpThing(t,e){let r=this.store.uris(t);return r=r.map((t=>b.docpart(t))),r.forEach((t=>{this.lookedUp[t]=!0})),this.load(r,{referringTerm:e})}getHeader(t,e){const r=this.store,i=t.value,n=r.each(void 0,this.ns.link("requestedURI"),r.rdfFactory.literal(i));for(let t=0;t<n.length;t++){let i=n[t];if(void 0!==i){let t=r.any(i,this.ns.link("response"));if(void 0!==t&&r.anyValue(t,this.ns.http("status"))&&r.anyValue(t,this.ns.http("status")).startsWith("2")){let i=r.each(t,this.ns.httph(e.toLowerCase()));return i.length?i.map((t=>t.value)):[]}}}}saveRequestMetadata(t,e){let r=e.req,i=this.store,n=e.referringTerm;this.addStatus(e.req,"Accept: "+e.headers.accept),(0,a.Y2)(n)&&i.add(i.rdfFactory.namedNode(t),this.ns.link("requestedBy"),n,this.appNode),e.original&&e.original.value!==t&&i.add(r,this.ns.link("orginalURI"),i.rdfFactory.literal(e.original.value),this.appNode);const s=new Date,o="["+s.getHours()+":"+s.getMinutes()+":"+s.getSeconds()+"] ";i.add(r,this.ns.rdfs("label"),i.rdfFactory.literal(o+" Request for "+t),this.appNode),i.add(r,this.ns.link("requestedURI"),i.rdfFactory.literal(t),this.appNode),i.add(r,this.ns.link("status"),i.collection(),this.appNode)}saveResponseMetadata(t,e){const r=this.store;let i=r.bnode();return r.add(e.req,this.ns.link("response"),i,this.appNode),r.add(i,this.ns.http("status"),r.rdfFactory.literal(t.status),this.appNode),r.add(i,this.ns.http("statusText"),r.rdfFactory.literal(t.statusText),this.appNode),t.headers.forEach(((t,n)=>{r.add(i,this.ns.httph(n),this.store.rdfFactory.literal(t),this.appNode),"content-type"===n&&r.add(e.resource,this.ns.rdf("type"),r.rdfFactory.namedNode(C.mediaTypeClass(t).value),this.appNode)})),i}objectRefresh(t){let e=this.store.uris(t);if(void 0!==e)for(let t=0;t<e.length;t++)this.refresh(this.store.rdfFactory.namedNode(b.docpart(e[t])))}refresh(t,e){this.fireCallbacks("refresh",arguments),this.nowOrWhenFetched(t,{force:!0,clearPreviousData:!0},e)}refreshIfExpired(t,e){let r=this.getHeader(t,"Expires");!r||new Date(r[0]).getTime()<=(new Date).getTime()?this.refresh(t,e):e(!0,"Not expired",{})}retract(t){this.store.removeMany(void 0,void 0,void 0,t),t.value&&delete this.requested[b.docpart(t.value)],this.fireCallbacks("retract",arguments)}getState(t){return void 0===this.requested[t]?"unrequested":!0===this.requested[t]?"requested":"done"===this.requested[t]?"fetched":"redirected"===this.requested[t]?this.getState(this.redirectedTo[t]):"failed"}isPending(t){return!0===this.requested[t]}unload(t){this.store.removeDocument(t),delete this.requested[t.value]}addHandler(t){this.handlers.push(t),t.register(this)}retryNoCredentials(t,e){e.retriedWithNoCredentials=!0,delete this.requested[t],delete this.fetchQueue[t];let r=Object.assign({},e,{credentials:"omit"});return this.addStatus(e.req,"Abort: Will retry with credentials SUPPRESSED to see if that helps"),this.load(t,r)}isCrossSite(t){if("undefined"==typeof document||!document.location)return!1;const e=b.hostpart,r=""+document.location;return(e(r)&&e(t)&&e(r))!==e(t)}handleError(t,e,r){if(this.isCrossSite(e)){if(r.credentials&&"include"===r.credentials&&!r.retriedWithNoCredentials)return this.retryNoCredentials(e,r);let t=Oe.crossSiteProxy(e);if(t&&!r.proxyUsed)return this.redirectToProxy(t,r)}var i;return t instanceof Error?i="Fetch error: "+t.message:(i=t.statusText,t.responseText&&(i+=` ${t.responseText}`)),this.failFetch(r,i,t.status||998,t)}addType(t,e,r,i){let n=e;if(i){var s=r.any(n,this.ns.link("requestedURI"));s&&s.value!==i&&r.add(r.rdfFactory.namedNode(i),this.ns.rdf("type"),t,this.appNode)}for(;;){const e=r.any(n,this.ns.link("requestedURI"));if(e&&e.value&&r.add(r.rdfFactory.namedNode(e.value),this.ns.rdf("type"),t,this.appNode),n=r.any(void 0,r.rdfFactory.namedNode("http://www.w3.org/2007/ont/link#redirectedRequest"),n),!n)break;var a=r.any(n,r.rdfFactory.namedNode("http://www.w3.org/2007/ont/link#response"));if(!a)break;var o=r.any(a,r.rdfFactory.namedNode("http://www.w3.org/2007/ont/http#status"));if(!o)break;if("301"!==o&&"302"!==o)break}}handleResponse(t,e,r){const i=this.store,n=t.headers,s=r.req,a=this.saveResponseMetadata(t,r),o=this.normalizedContentType(r,n)||"";let h=n.get("content-location");if(0===t.status)return this.handleError(t,e,r);if(t.status>=400)return 404===t.status&&(this.nonexistent[r.original.value]=!0,this.nonexistent[e]=!0),this.saveErrorResponse(t,a).then((()=>{let e=r.resource+" "+t.statusText;return this.failFetch(r,e,t.status,t)}));var l=null,u=null;if(h&&(u=b.join(h,e))!==e&&(l=u),200===t.status){if(this.addType(this.ns.link("Document"),s,i,e),l&&this.addType(this.ns.link("Document"),s,i,l),r.clearPreviousData){const t=i.statementsMatching(void 0,void 0,void 0,r.resource).slice();for(let e=0;e<t.length;e++)i.removeStatement(t[e])}let t=o.includes("image/")||o.includes("application/pdf");o&&t&&(this.addType(i.rdfFactory.namedNode("http://purl.org/dc/terms/Image"),s,i,e),l&&this.addType(i.rdfFactory.namedNode("http://purl.org/dc/terms/Image"),s,i,l))}if(h){if(!r.force&&l&&"done"===this.requested[u])return this.doneFetch(r,t);this.requested[u]=!0}this.parseLinkHeader(n.get("link"),r.original,s);let c=this.handlerForContentType(o,t);return c?t.text().then((e=>(t.responseText=e,c.parse(this,e,r,t)))):(this.addStatus(s,"Fetch over. No data handled."),this.doneFetch(r,t))}saveErrorResponse(t,e){let r=this.store;return t.text().then((t=>{t.length>10&&r.add(e,this.ns.http("content"),r.rdfFactory.literal(t),e)}))}handlerForContentType(t,e){if(!t)return null;let r=this.handlers.find((e=>t.match(e.pattern)));return r?new r(e):null}guessContentType(t){return ye[t.split(".").pop()]}normalizedContentType(t,e){if(t.forceContentType)return t.forceContentType;let r=e.get("content-type");if(!r||r.includes("application/octet-stream")){let e=this.guessContentType(t.resource.value);if(e)return e}let i=b.protocol(t.resource.value);return!r&&["file","chrome"].includes(i)?"text/xml":r}redirectToProxy(t,e){this.addStatus(e.req,"BLOCKED -> Cross-site Proxy to <"+t+">"),e.proxyUsed=!0;const r=this.store,i=e.req;e.noMeta||(r.add(i,this.ns.link("redirectedTo"),r.rdfFactory.namedNode(t),i),this.addStatus(i,"redirected to new request")),this.requested[e.resource.value]="redirected",this.redirectedTo[e.resource.value]=t;let n=Object.assign({},e);return n.baseURI=e.resource.value,this.fetchUri(t,n).then((t=>(n.noMeta||r.add(i,this.ns.link("redirectedRequest"),n.req,this.appNode),t)))}setRequestTimeout(t,e){return new Promise((r=>{this.timeouts[t]=(this.timeouts[t]||[]).concat(setTimeout((()=>{!this.isPending(t)||e.retriedWithNoCredentials||e.proxyUsed||r(this.failFetch(e,`Request to ${t} timed out`,"timeout"))}),this.timeout))}))}addFetchCallback(t,e){this.fetchCallbacks[t]?this.fetchCallbacks[t].push(e):this.fetchCallbacks[t]=[e]}acceptString(){let t="";for(let e in this.mediatypes){""!==t&&(t+=", "),t+=e;for(let r in this.mediatypes[e])t+=";"+r+"="+this.mediatypes[e][r]}return t}}(0,t.A)(Oe,"HANDLERS",void 0),(0,t.A)(Oe,"CONTENT_TYPE_BY_EXT",void 0),(0,t.A)(Oe,"crossSiteProxyTemplate",void 0),Oe.HANDLERS=Ie,Oe.CONTENT_TYPE_BY_EXT=ye;const je={parseJSON:function(t,e,r){var i,n,s,a={},o=r.sym(e);for(var h in t){0===h.indexOf("_:")?a[h]?i=a[h]:(i=r.bnode(h),a[h]=i):i=r.sym(h);var l=t[h];for(var u in l){var c=l[u];for(var f in n=r.sym(u),c){var d=c[f];if("uri"===d.type)s=r.sym(d.value),r.add(i,n,s,o);else if("BlankNode"===d.type)a[d.value]?s=a[d.value]:(s=r.bnode(d.value),a[d.value]=s),r.add(i,n,s,o);else{if("Literal"!==d.type)throw new Error("error: unexpected termtype: "+f.type);s=d.datatype?r.literal(d.value,void 0,r.sym(d.datatype)):d.lang?r.literal(d.value,d.lang):r.literal(d.value),r.add(i,n,s,o)}}}}}};function Se(t){var e=0;function r(t){var e="",r=t.statements;for(var i in r)N.A.debug("Found statement: "+r),e+=a()+r[i]+"\n";return e}function i(t){var e="";for(var r in t.constraints){var i=t.constraints[r];e+=a()+"FILTER ( "+i.describe(r)+" ) \n"}return e}function n(t){for(var s="",o=0;o<t.optional.length;o++)N.A.debug("Found optional query"),s+=a()+"OPTIONAL { \n",e++,s+=r(t.optional[o]),s+=i(t.optional[o]),s+=n(t.optional[o]),e--,s+=a()+"}\n";return s}function s(t){var s=a()+"WHERE \n{ \n";return e++,s+=r(t),s+=i(t),s+=n(t),e--,s+"}"}function a(){for(var t="",r=0;r<e;r++)t+=" ";return t}return function(t){return function(t){for(var e=a()+"SELECT ",r=0;r<t.vars.length;r++)e+=t.vars[r]+" ";return e+"\n"}(t)+s(t.pat)}(t)}function Fe(t,e,r){var i=[];function n(t){if(i[t])return i[t];var e=r.variable(t);return i[t]=e,e}function s(t){return"string"==typeof t&&t.match(/[^ \n\t]/)}function a(t){return"string"==typeof t&&t.match(/^[\?\$]/)}function o(t){return"string"==typeof t?t.replace(/^</,"<").replace(/>$/,">"):t}function h(t){return"string"==typeof t&&t.match(/^<[^>]*>$/)}function l(t){return"string"==typeof t&&(t.match(/^_:/)||t.match(/^$/))}function u(t){return"string"==typeof t&&t.match(/:$/)}function c(t){return"string"==typeof t&&t.match(/^:|^[^_][^:]*:/)}function f(t){return t.split(":")[0]}function d(t){return t.split(":")[1]}function p(t){return h(t)?t.slice(1,t.length-1):t}function g(t){var e=-1===t.indexOf("'")?null:t.indexOf("'"),i=-1===t.indexOf('"')?null:t.indexOf('"');if(!e&&!i){var n=new Array(1);return n[0]=t,n}var s,a,o=new Array(2);if(!e||i&&i<e)s='"',a=i;else{if(i&&!(e&&e<i))return N.A.error("SQARQL QUERY OOPS!"),o;s="'",a=e}o[0]=t.slice(0,a);var h,l=t.slice(a+1).indexOf(s);return-1===l?(N.A.error("SPARQL parsing error: no matching parentheses in literal "+t),t):(t.slice(l+a+2).match(/^\^\^/)?(h=t.slice(l+a+2).indexOf(" "),o[1]=r.literal(t.slice(a+1,a+1+l),r.sym(p(t.slice(a+4+l,a+2+l+h)))),o=o.concat(g(t.slice(l+a+3+h)))):t.slice(l+a+2).match(/^@/)?(h=t.slice(l+a+2).indexOf(" "),o[1]=r.literal(t.slice(a+1,a+1+l),t.slice(a+3+l,a+2+l+h),null),o=o.concat(g(t.slice(l+a+2+h)))):(o[1]=r.literal(t.slice(a+1,a+1+l)),N.A.info("Literal found: "+o[1]),o=o.concat(g(t.slice(l+a+2)))),o)}function m(t){t=t.replace(/\(/g," ( ").replace(/\)/g," ) ").replace(/</g," <").replace(/>/g,"> ").replace(/{/g," { ").replace(/}/g," } ").replace(/[\t\n\r]/g," ").replace(/; /g," ; ").replace(/\. /g," . ").replace(/, /g," , "),N.A.info("New str into spaceDelimit: \n"+t);var e=[],r=t.split(" ");for(var i in r)s(r[i])&&(e=e.concat(r[i]));return e}function w(t,e){for(var r=0;r<e.length;r++)if("string"==typeof e[r]&&e[r].toLowerCase()===t.toLowerCase())return r;return null}function y(t,e){for(var r=[],i=0;i<e.length;i++)"string"==typeof e[i]&&e[i].toLowerCase()===t.toLowerCase()&&r.push(i);return r}function b(t,e,r){N.A.info("Looking for a close bracket of type "+r+" in "+t);for(var i=0,n=0;n<t.length;n++)if(t[n]===e&&i++,t[n]===r&&i--,i<0)return n;return N.A.error("Statement had no close parenthesis in SPARQL query"),0}function v(t){return this.describe=function(e){return e+" = "+t.toNT()},this.test=function(e){return t.equals(e)},this}function _(t){this.describe=function(e){return"REGEXP( '"+t+"' , "+e+" )"},this.test=function(e){var r=new RegExp(t);return!!e.value&&r.test(e.value)}}function x(t,e){3!==t.length||"Variable"!==t[0].termType||"NamedNode"!==t[2].termType&&"Literal"!==t[2].termType?6===t.length&&"string"==typeof t[0]&&"regexp"===t[0].toLowerCase()&&"("===t[1]&&")"===t[5]&&","===t[3]&&"Variable"===t[4].termType&&"Literal"===t[2].termType&&(N.A.debug("Constraint added: "+t),e.constraints[t[4]]=new _(t[2].value)):"="===t[1]||">"===t[1]||"<"===t[1]?(N.A.debug("Constraint added: "+t),e.constraints[t[0]]=new v(t[2])):N.A.warn("I don't know how to handle the constraint: "+t)}function T(t,e){N.A.debug("Optional query: "+t+" not yet implemented.");var i=r.formula();A(t,i),e.optional.push(i)}function A(t,e){var i,s,u=function(t){for(var e=[],i=0;i<t.length;i++)"string"==typeof t[i]?(t[i]=o(t[i]),a(t[i])?e[i]=n(t[i].slice(1)):l(t[i])?(N.A.info(t[i]+" was identified as a bnode."),e[i]=r.bnode()):h(t[i])?(N.A.info(t[i]+" was identified as a symbol."),e[i]=r.sym(p(t[i]))):c(t[i])?(N.A.info(t[i]+" was identified as a prefixed symbol"),k[f(t[i])]?e[i]=r.sym(t[i]=k[f(t[i])]+d(t[i])):(N.A.error("SPARQL error: "+t[i]+" with prefix "+f(t[i])+" does not have a correct prefix entry."),e[i]=t[i])):e[i]=t[i]):e[i]=t[i];return e}(t);for(N.A.debug("WHERE: "+u);w("OPTIONAL",u);)s=w("OPTIONAL",u),N.A.debug("OPT: "+s+" "+u[s]+" in "+u),"{"!==u[s+1]&&N.A.warn("Bad optional opening bracket in word "+s),-1===(i=b(u.slice(s+2),"{","}"))?N.A.error("No matching bracket in word "+s):(T(u.slice(s+2,s+2+i),e),s=w("OPTIONAL",u),i=b(u.slice(s+2),"{","}"),u.splice(s,i+3));for(N.A.debug("WHERE after optionals: "+u);w("FILTER",u);){var g=w("FILTER",u);"("!==u[g+1]&&N.A.warn("Bad filter opening bracket in word "+g),-1===(i=b(u.slice(g+2),"(",")"))?N.A.error("No matching bracket in word "+g):(x(u.slice(g+2,g+2+i),e),g=w("FILTER",u),i=b(u.slice(g+2),"(",")"),u.splice(g,i+3))}N.A.debug("WHERE after filters and optionals: "+u),function(t,e){var r=new Array(1);r[0]=-1;for(var i=r.concat(y(".",t)),n=[],s=0;s<i.length-1;s++)n[s]=t.slice(i[s]+1,i[s+1]);for(s in n){N.A.info("s+p+o "+s+" = "+n[s]);var a=n[s][0];n[s].splice(0,1);var o=r.concat(y(";",n[s]));o.push(n[s].length);for(var h=[],l=0;l<o.length-1;l++)h[l]=n[s].slice(o[l]+1,o[l+1]);for(s in h){N.A.info("p+o "+s+" = "+n[s]);var u=h[s][0];h[s].splice(0,1);var c=r.concat(y(",",h[s]));c.push(h[s].length);var f=[];for(l=0;l<c.length-1;l++)f[l]=h[s].slice(c[l]+1,c[l+1]);for(s in f){var d=f[s][0];N.A.info("Subj="+a+" Pred="+u+" Obj="+d),e.add(a,u,d)}}}}(u,e)}N.A.info("SPARQL input: \n"+t);var E=new $,R=function(t){var e=g(t),r=[];for(var i in e)r="string"==typeof e[i]?r.concat(m(e[i])):r.concat(e[i]);return r=function(t){for(var e=t,r=0;r<e.length;r++)if("a"===e[r]&&(e[r]="<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>"),"is"===e[r]&&"of"===e[r+2]){e.splice(r,1),e.splice(r+1,1);var i=e[r-1];e[r-1]=e[r+1],e[r+1]=i}return e}(r),N.A.info("SPARQL Tokens: "+r),r}(t),k=function(t){var e=y("PREFIX",t),r=[];for(var i in e){var n=t[e[i]+1],s=t[e[i]+2];if(u(n))if(h(s)){N.A.info("Prefix found: "+n+" -> "+s);var a=f(n),o=p(s);r[a]=o}else N.A.error("Invalid SPARQL symbol: "+s);else N.A.error("Invalid SPARQL prefix: "+n)}return r}(R);k.rdf||(k.rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"),k.rdfs||(k.rdfs="http://www.w3.org/2000/01/rdf-schema#");var I=w("SELECT",R),C=w("WHERE",R);if(I<0||C<0||I>C)return N.A.error("Invalid or nonexistent SELECT and WHERE tags in SPARQL query"),!1;if(function(t,e){for(var r in N.A.info("SPARQL vars: "+t),t)if(a(t[r])){N.A.info("Added "+t[r]+" to query variables from SPARQL");var i=n(t[r].slice(1));e.vars.push(i),i.label=t[r].slice(1)}else N.A.warn("Incorrect SPARQL variable in SELECT: "+t[r])}(R.slice(I+1,C),E),A(R.slice(C+2,R.length-1),E.pat),e)return E;for(var O in E.pat.statements){var j=E.pat.statements[O];"NamedNode"===j.subject.termType&&r.fetcher&&r.fetcher.lookUpThing(j.subject,"sparql:"+j.subject),"NamedNode"===j.object.termType&&r.fetcher&&r.fetcher.lookUpThing(j.object,"sparql:"+j.object)}return E}class Ue{constructor(e){if((0,t.A)(this,"store",void 0),(0,t.A)(this,"ifps",void 0),(0,t.A)(this,"fps",void 0),(0,t.A)(this,"patchControl",void 0),(0,t.A)(this,"ns",void 0),(e=e||new G).updater)throw new Error("You can't have two UpdateManagers for the same store");e.fetcher||(e.fetcher=new Oe(e)),this.store=e,e.updater=this,this.ifps={},this.fps={},this.ns={},this.ns.link=E("http://www.w3.org/2007/ont/link#"),this.ns.http=E("http://www.w3.org/2007/ont/http#"),this.ns.httph=E("http://www.w3.org/2007/ont/httph#"),this.ns.ldp=E("http://www.w3.org/ns/ldp#"),this.ns.rdf=E("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this.ns.rdfs=E("http://www.w3.org/2000/01/rdf-schema#"),this.ns.rdf=E("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this.ns.owl=E("http://www.w3.org/2002/07/owl#"),this.patchControl=[]}patchControlFor(t){return this.patchControl[t.value]||(this.patchControl[t.value]=[]),this.patchControl[t.value]}isHttpUri(t){return"http"===t.slice(0,4)}flagAuthorizationMetadata(t){t||(t=this.store);const e=t.fetcher?.appNode,r=t.statementsMatching(void 0,this.ns.link("requestedURI"),void 0,e).map((t=>t.subject));for(const i of r){const r=t.any(i,this.ns.link("response"),null,e);null!=r&&t.add(r,this.ns.link("outOfDate"),!0,e)}}async checkEditable(t,e){if(!t)return!1;e||(e=this.store);const r=this.editable(t,e);return void 0!==r?r:(await(e.fetcher?.load(t)),this.editable(t,e))}editable(t,e){if(!t)return!1;if(e||(e=this.store),t=(0,me.E)(t),!this.isHttpUri(t)&&e.holds(e.rdfFactory.namedNode(t),e.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),e.rdfFactory.namedNode("http://www.w3.org/2007/ont/link#MachineEditableDocument")))return"LOCALFILE";var r,i=!1;const n=e.fetcher?.appNode;for(var s,a=e.each(void 0,this.ns.link("requestedURI"),(0,b.docpart)(t),n),o=0;o<a.length;o++)if(void 0!==(r=a[o])){const a=e.any(r,this.ns.link("response"),null,n);if(void 0!==a){if(e.anyJS(a,this.ns.link("outOfDate"),null,n))continue;var h=e.anyValue(a,this.ns.httph("wac-allow"));if(h)for(var l of h.split(",")){var u=l.split("=");if(u[0].includes("user")&&!u[1].includes("write")&&!u[1].includes("append"))return!1}var c=e.each(a,this.ns.httph("accept-patch"));if(c.length)for(let t=0;t<c.length;t++){if((s=c[t].value.trim()).indexOf("application/sparql-update")>=0)return"SPARQL";if(s.indexOf("application/sparql-update-single-match")>=0)return"SPARQL";if(s.indexOf("text/n3")>=0)return"N3PATCH"}var f=e.each(a,this.ns.httph("ms-author-via"));if(f.length)for(let t=0;t<f.length;t++){if((s=f[t].value.trim()).indexOf("SPARQL")>=0)return"SPARQL";if(s.indexOf("DAV")>=0)return"DAV"}if(!this.isHttpUri(t))return!!h&&"LOCALFILE";var d=e.each(a,this.ns.http("status"));if(d.length)for(let t=0;t<d.length;t++)200!==d[t]&&404!==d[t]||(i=!0)}}if(0===a.length);else if(i)return!1}anonymize(t){return"_:"===t.toNT().substr(0,2)&&this.mentioned(t)?"?"+t.toNT().substr(2):t.toNT()}anonymizeNT(t){return this.anonymize(t.subject)+" "+this.anonymize(t.predicate)+" "+this.anonymize(t.object)+" ."}nTriples(t){return`${t.subject.toNT()} ${t.predicate.toNT()} ${t.object.toNT()} .`}statementBnodes(t){return[t.subject,t.predicate,t.object].filter((function(t){return(0,a.jt)(t)}))}statementArrayBnodes(t){var e=[];for(let r=0;r<t.length;r++)e=e.concat(this.statementBnodes(t[r]));e.sort();var r=[];for(let t=0;t<e.length;t++)0!==t&&e[t].equals(e[t-1])||r.push(e[t]);return r}cacheIfps(){this.ifps={};var t=this.store.each(void 0,this.ns.rdf("type"),this.ns.owl("InverseFunctionalProperty"));for(let e=0;e<t.length;e++)this.ifps[t[e].value]=!0;this.fps={},t=this.store.each(void 0,this.ns.rdf("type"),this.ns.owl("FunctionalProperty"));for(let e=0;e<t.length;e++)this.fps[t[e].value]=!0}bnodeContext2(t,e,r){var i,n,s=this.store.statementsMatching(void 0,void 0,t,e);for(let t=0;t<s.length;t++)if(this.fps[s[t].predicate.value]){if(!(i=s[t].subject).isBlank)return[s[t]];if(r&&(n=this.bnodeContext2(i,e,r-1)))return n.concat([s[t]])}s=this.store.statementsMatching(t,void 0,void 0,e);for(let t=0;t<s.length;t++)if(this.ifps[s[t].predicate.value]){if(!(i=s[t].object).isBlank)return[s[t]];if(r&&(n=this.bnodeContext2(i,e,r-1)))return n.concat([s[t]])}return null}bnodeContext1(t,e){for(var r=0;r<3;r++){var i=this.bnodeContext2(t,e,r);if(null!==i)return i}return this.store.connectedStatements(t,e)}mentioned(t){return 0!==this.store.statementsMatching(t,null,null,null).length||0!==this.store.statementsMatching(null,t).length||0!==this.store.statementsMatching(null,null,t).length}bnodeContext(t,e){var r=[];if(t.length){this.cacheIfps();for(let n=0;n<t.length;n++){var i=t[n];this.mentioned(i)&&(r=r.concat(this.bnodeContext1(i,e)))}}return r}statementContext(t){var e=this.statementBnodes(t);return this.bnodeContext(e,t.graph)}contextWhere(t){var e=this;return t&&0!==t.length?"WHERE { "+t.map((function(t){return e.anonymizeNT(t)})).join("\n")+" }\n":""}fire(t,e,r,i={}){return Promise.resolve().then((()=>{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,this.store.fetcher.webOperation("PATCH",t,i)})).then((i=>{if(!i.ok){let r="UpdateManager: update failed for <"+t+"> status="+i.status+", "+i.statusText+"\n for query: "+e;throw new Error(r)}r(t,i.ok,i.responseText,i)})).catch((e=>{r(t,!1,e.message,e)}))}update_statement(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 i=this.where;i+="DELETE DATA { "+this.statementNT+" } ;\n",i+="INSERT DATA { "+this.anonymize(this.statement[0])+" "+this.anonymize(this.statement[1])+" "+this.anonymize(t)+" . }\n",e.fire(this.statement[3].value,i,r)}}}}insert_statement(t,e){var r=t instanceof Array?t[0]:t,i=this.contextWhere(this.statementContext(r));if(t instanceof Array){var n="";for(let e=0;e<t.length;e++)n+=t[e]+"\n";i+="INSERT DATA { "+n+" }\n"}else i+="INSERT DATA { "+this.anonymize(t.subject)+" "+this.anonymize(t.predicate)+" "+this.anonymize(t.object)+" . }\n";this.fire(r.graph.value,i,e)}delete_statement(t,e){var r=t instanceof Array?t[0]:t,i=this.contextWhere(this.statementContext(r));if(t instanceof Array){var n="";for(let e=0;e<t.length;e++)n+=t[e]+"\n";i+="DELETE DATA { "+n+" }\n"}else i+="DELETE DATA { "+this.anonymize(t.subject)+" "+this.anonymize(t.predicate)+" "+this.anonymize(t.object)+" . }\n";this.fire(r.graph.value,i,e)}requestDownstreamAction(t,e){var r=this.patchControlFor(t);if(r.pendingUpstream)if(r.downstreamAction){if(""+r.downstreamAction!=""+e)throw new Error("Can't wait for > 1 different downstream actions")}else r.downstreamAction=e;else e(t)}clearUpstreamCount(t){this.patchControlFor(t).upstreamCount=0}getUpdatesVia(t){var e=this.store.fetcher.getHeader(t,"updates-via");return e&&e.length?e[0].trim():null}addDownstreamChangeListener(t,e){var r=this.patchControlFor(t);r.downstreamChangeListeners||(r.downstreamChangeListeners=[]),r.downstreamChangeListeners.push(e),this.setRefreshHandler(t,(t=>{this.reloadAndSync(t)}))}reloadAndSync(t){var e=this.patchControlFor(t),r=this;if(e.reloading)e.outOfDate=!0;else{e.reloading=!0;var i=1e3,n=function(){r.reload(r.store,t,(function(t,r,s){if(t){if(e.downstreamChangeListeners)for(let t=0;t<e.downstreamChangeListeners.length;t++)e.downstreamChangeListeners[t]();e.reloading=!1,e.outOfDate&&(e.outOfDate=!1,n())}else e.reloading=!1,s&&0===s.status&&(e.reloading=!0,setTimeout(n,i*=2))}))};n()}}setRefreshHandler(t,e){let r=this.getUpdatesVia(t);var i=e,n=this,s=this,a=1500,o=0;if(!r)return!1;r=(0,b.join)(r,t.value);const h=r.replace(/^http:/,"ws:").replace(/^https:/,"wss:");var l=function(){var e;if("undefined"!=typeof WebSocket)e=new WebSocket(h);else{if("undefined"==typeof window||!window.WebSocket)return;e=window.WebSocket(h)}e.onopen=function(){a=1500,this.send("sub "+t.value),o&&s.requestDownstreamAction(t,i)};var r=n.patchControlFor(t);r.upstreamCount=0,e.onerror=function(t){},e.onclose=function(t){a*=2,o+=1,setTimeout((function(){l()}),a)},e.onmessage=function(e){if(e.data&&"pub"===e.data.slice(0,3)){if("upstreamCount"in r&&(r.upstreamCount-=1,r.upstreamCount>=0))return;r.upstreamCount=0,n.requestDownstreamAction(t,i)}}};return l(),!0}updateMany(t,e=[]){const r=t.concat(e).map((t=>t.why)),i=this,n=[];r.forEach((t=>{n.find((e=>e.equals(t)))||n.push(t)}));const s=n.map((r=>i.update(t.filter((t=>t.why.equals(r))),e.filter((t=>t.why.equals(r))))));return s.length,Promise.all(s)}constructSparqlUpdateQuery(t,e,r){var i=this.contextWhere(r),n="";if(i.length){if(t.length){n+="DELETE { ";for(let e=0;e<t.length;e++)n+=this.anonymizeNT(t[e])+"\n";n+=" }\n"}if(e.length){n+="INSERT { ";for(let t=0;t<e.length;t++)n+=this.anonymizeNT(e[t])+"\n";n+=" }\n"}n+=i}else{if(t.length){n+="DELETE DATA { ";for(let e=0;e<t.length;e++)n+=this.anonymizeNT(t[e])+"\n";n+=" } \n"}if(e.length){t.length&&(n+=" ; "),n+="INSERT DATA { ";for(let t=0;t<e.length;t++)n+=this.nTriples(e[t])+"\n";n+=" }\n"}}return n}constructN3PatchQuery(t,e,r){var i="\n@prefix solid: <http://www.w3.org/ns/solid/terms#>.\n@prefix ex: <http://www.example.org/terms#>.\n\n_:patch\n";return r&&r.length>0&&(i+=`\n solid:where {\n ${r.map((t=>this.anonymizeNT(t))).join("\n ")}\n };`),t.length>0&&(i+=`\n solid:deletes {\n ${t.map((t=>this.anonymizeNT(t))).join("\n ")}\n };`),e.length>0&&(i+=`\n solid:inserts {\n ${e.map((t=>this.anonymizeNT(t))).join("\n ")}\n };`),i+" a solid:InsertDeletePatch .\n"}update(t,e,r,i,n={}){if(!r){var s=this;return new Promise((function(r,a){s.update(t,e,(function(t,e,i){e?r():a(new Error(i))}),i,n)}))}try{var o=this.store,h=t?(0,a.ok)(t)?t.statements:t instanceof Array?t:[t]:[],l=e?(0,a.ok)(e)?e.statements:e instanceof Array?e:[e]:[];if(!(h instanceof Array))throw new Error("Type Error "+typeof h+": "+h);if(!(l instanceof Array))throw new Error("Type Error "+typeof l+": "+l);if(0===h.length&&0===l.length)return r(null,!0);var u=h.length?h[0].graph:l[0].graph;if(!u){let t="Error patching: statement does not specify which document to patch:"+h[0]+", "+l[0];throw new Error(t)}if("NamedNode"!==u.termType){let t="Error patching: document not a NamedNode:"+h[0]+", "+l[0];throw new Error(t)}var c=this.patchControlFor(u),f=Date.now(),d=["subject","predicate","object","why"],p={delete:h,insert:l};["insert","delete"].map((function(t){p[t].map((function(t){if(!u.equals(t.graph))throw new Error("update: destination "+u+" inconsistent with delete quad "+t.graph);d.map((function(e){if(void 0===t[e])throw new Error("update: undefined "+e+" of statement.")}))}))}));var g=this.editable(u.value,o);if(!1===g)throw new Error("Update: Can't make changes in uneditable "+u);if(void 0===g){if(i)throw new Error("Update: Loaded "+u+"but still can't figure out what editing protocol it supports.");return void this.store.fetcher.load(u).then((i=>{this.update(t,e,r,!0,n)}),(i=>{if(404!==i.response.status)throw new Error(`Update: Can't get updatability status ${u} before patching: ${i}`);this.update(t,e,r,!0,n)}))}if(g.indexOf("SPARQL")>=0||g.indexOf("N3PATCH")>=0){var m=g.indexOf("SPARQL")>=0,w=[];h.length&&(w=this.statementArrayBnodes(h)),l.length&&(w=w.concat(this.statementArrayBnodes(l)));var y=this.bnodeContext(w,u),b=m?this.constructSparqlUpdateQuery(h,l,y):this.constructN3PatchQuery(h,l,y);n.contentType=m?"application/sparql-update":"text/n3",c.pendingUpstream=c.pendingUpstream?c.pendingUpstream+1:1,"upstreamCount"in c&&(c.upstreamCount+=1),this.fire(u.value,b,((t,e,i,n)=>{if(n.elapsedTimeMs=Date.now()-f,e){try{o.remove(h)}catch(t){e=!1,i="Remote Ok BUT error deleting "+h.length+" from store!!! "+t}for(let t=0;t<l.length;t++)o.add(l[t].subject,l[t].predicate,l[t].object,u)}if(r(t,e,i,n),c.pendingUpstream-=1,0===c.pendingUpstream&&c.downstreamAction){var s=c.downstreamAction;delete c.downstreamAction,s(u)}}),n)}else if(g.indexOf("DAV")>=0)this.updateDav(u,h,l,r,n);else{if(!(g.indexOf("LOCALFILE")>=0))throw new Error("Unhandled edit method: '"+g+"' for "+u);try{this.updateLocalFile(u,h,l,r,n)}catch(t){r(u.value,!1,"Exception trying to write back file <"+u.value+">\n")}}}catch(t){r(void 0,!1,"Exception in update: "+t+"\n"+C.stackString(t))}}updateDav(t,e,r,i,n={}){let s=this.store;var a=s.any(t,this.ns.link("request"));if(!a)throw new Error("No record of our HTTP GET request for document: "+t);var o=s.any(a,this.ns.link("response"));if(!o)return null;var h=s.the(o,this.ns.httph("content-type")).value;let l=s.statementsMatching(void 0,void 0,void 0,t).slice();for(let t=0;t<e.length;t++)C.RDFArrayRemove(l,e[t]);for(let t=0;t<r.length;t++)l.push(r[t]);const u=this.serialize(t.value,l,h);var c,f=s.the(o,this.ns.httph("content-location"));return f&&(c=(0,b.join)(f.value,c)),n.contentType=h,n.noMeta=!0,n.body=u,s.fetcher.webOperation("PUT",c,n).then((n=>{if(!n.ok)throw new Error(n.error);for(let t=0;t<e.length;t++)s.remove(e[t]);for(let e=0;e<r.length;e++)s.add(r[e].subject,r[e].predicate,r[e].object,t);i(t.value,n.ok,n.responseText,n)})).catch((e=>{i(t.value,!1,e.message,e)}))}updateLocalFile(t,e,r,i,n={}){const s=this.store;let a=s.statementsMatching(void 0,void 0,void 0,t).slice();for(let t=0;t<e.length;t++)C.RDFArrayRemove(a,e[t]);for(let t=0;t<r.length;t++)a.push(r[t]);var o=t.value.lastIndexOf(".");if(o<1)throw new Error("Rewriting file: No filename extension: "+t.value);var h=t.value.slice(o+1);let l=Oe.CONTENT_TYPE_BY_EXT[h];if(!l)throw new Error("File extension ."+h+" not supported for data write");n.body=this.serialize(t.value,a,l),n.contentType=l,s.fetcher.webOperation("PUT",t.value,n).then((n=>{if(!n.ok)return i(t.value,!1,n.error);for(let t=0;t<e.length;t++)s.remove(e[t]);for(let e=0;e<r.length;e++)s.add(r[e].subject,r[e].predicate,r[e].object,t);i(t.value,!0,"")}))}serialize(t,e,r){const i=this.store;let n;if("string"==typeof e)return e;var s=j(i);switch(s.suggestNamespaces(i.namespaces),s.setBase(t),r){case"text/xml":case"application/rdf+xml":n=s.statementsToXML(e);break;case"text/n3":case"text/turtle":case"application/x-turtle":case"application/n3":n=s.statementsToN3(e);break;default:throw new Error("Content-type "+r+" not supported for data serialization")}return n}put(t,e,r,i){const n=this.store;let s;return Promise.resolve().then((()=>(s=this.serialize(t.value,e,r),n.fetcher.webOperation("PUT",t.value,{contentType:r,body:s})))).then((r=>{if(!r.ok)return i(t.value,r.ok,r.error,r);delete n.fetcher.nonexistent[t.value],delete n.fetcher.requested[t.value],"string"!=typeof e&&e.map((t=>{n.addStatement(t)})),i(t.value,r.ok,"",r)})).catch((e=>{i(t.value,!1,e.message)}))}reload(t,e,r){var i=Date.now();t.fetcher.nowOrWhenFetched(e.value,{force:!0,noMeta:!0,clearPreviousData:!0},(function(t,n,s){if(t)if(s.onErrorWasCalled||200!==s.status)r(!1,"Non-HTTP error reloading data: "+n,s);else{var a=Date.now()-i;e.reloadTimeTotal||(e.reloadTimeTotal=0),e.reloadTimeCount||(e.reloadTimeCount=0),e.reloadTimeTotal+=a,e.reloadTimeCount+=1,r(!0)}else r(!1,"Error reloading data: "+n,s)}))}}const De={...xt,fetcher:(t,e)=>new Oe(t,e),graph:(t=void 0,e=void 0)=>new G(t,e||{rdfFactory:xt}),lit(t,e,r){return this.literal(""+t,e||r)},st(t,e,r,i){return this.quad(t,e,r,i)}},Le=De;class Me{constructor(t,e){this.parent=t,this.via=e,this.connected=!1,this.pending={},this.subscribed={},this.socket={};try{this.socket=new WebSocket(e),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)}}_decode(t){var e,r,i,n,s,a,o;for(r in n={},s=function(){var r,i,n,s;for(s=[],r=0,i=(n=t.split("&")).length;r<i;r++)e=n[r],s.push(e.split("="));return s}())e=s[r],o=(a=[decodeURIComponent(e[0]),decodeURIComponent(e[1])])[1],null==n[i=a[0]]&&(n[i]=[]),n[i].push(o);return n}_send(t,e,r){var i,n;return n=[t,e,r].join(" "),"function"==typeof(i=this.socket).send?i.send(n):void 0}_subscribe(t){return this._send("sub",t,""),this.subscribed[t]=!0,this.subscribed[t]}onClose(t){var e;for(e in this.connected=!1,this.subscribed)this.pending[e]=!0;return this.subscribed={},this.subscribed}onError(t){throw new Error("onError"+t)}onMessage(t){var e,r;return"ping"===(r=t.data.split(" "))[0]?"function"==typeof(e=this.socket).send?e.send("pong "+r.slice(1).join(" ")):void 0:"pub"===r[0]?this.parent.onUpdate(r[1],this._decode(r[2])):void 0}onOpen(t){var e,r;for(r in this.connected=!0,e=[],this.pending)delete this.pending[r],e.push(this._subscribe(r));return e}subscribe(t){return this.connected?this._subscribe(t):(this.pending[t]=!0,this.pending[t])}}class Pe{constructor(t){this.fetcher=t,this.graph={},this.via={},this.fetcher.addCallback("headers",this.onHeaders)}onHeaders(t){var e,r,i;return null==t.headers||"undefined"==typeof WebSocket||null===WebSocket||(e=t.headers.etag,i=t.headers["updates-via"],r=t.uri,e&&i&&(this.graph[r]={etag:e,via:i},this.register(i,r))),!0}onUpdate(t,e){return this.fetcher.refresh(Le.namedNode(t))}register(t,e){return null==this.via[t]&&(this.via[t]=new Me(this,t)),this.via[t].subscribe(e)}}const Be={};for(const t in Le)"function"==typeof Le[t]&&(Be[t]=Le[t].bind(Le));const{fetcher:qe,graph:$e,lit:He,st:Xe,namedNode:ze,variable:Qe,blankNode:Ve,defaultGraph:Ge,literal:We,quad:Ye,triple:Ze}=Be,Je=new P,Ke=t=>Je.fromNT(t),tr=B.fromValue,er=n.nextId;class rr extends G{constructor(e){super(e),(0,t.A)(this,"fetcher",void 0),this.fetcher=new Oe(this,{})}}class ir extends rr{constructor(e){super(e),(0,t.A)(this,"updater",void 0),this.updater=new Ue(this)}}})(),h})()));
|
|
3
3
|
//# sourceMappingURL=rdflib.min.js.map
|