@noeldemartin/solid-utils 0.4.0-next.30aceafb9d58f505d02a146d8e81f2e3a041b92f → 0.4.0-next.a79c7155bfd5797638ebe4fcd41739c2831c89fc
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/noeldemartin-solid-utils.cjs.js +1 -1
- package/dist/noeldemartin-solid-utils.cjs.js.map +1 -1
- package/dist/noeldemartin-solid-utils.d.ts +3 -0
- package/dist/noeldemartin-solid-utils.esm.js +1 -1
- package/dist/noeldemartin-solid-utils.esm.js.map +1 -1
- package/dist/noeldemartin-solid-utils.umd.js +1 -1
- package/dist/noeldemartin-solid-utils.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/interop.ts +2 -4
- package/src/helpers/io.ts +40 -2
- package/src/plugins/jest/matchers.ts +12 -2
- package/src/plugins/jest/types.d.ts +1 -0
|
@@ -86,5 +86,5 @@ if("@preserve"in t)return t["@preserve"][0];if(i.isValue(t))return t;if(i.isList
|
|
|
86
86
|
*/
|
|
87
87
|
var n=r(46),i=r(47),o=r(48);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return c(this,e,t,r)}function c(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=h(e,t),e}(e,t,r,n):"string"==typeof t?function(e,t,r){if("string"==typeof r&&""!==r||(r="utf8"),!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(t,r),i=(e=s(e,n)).write(t,r);return i!==n&&(e=e.slice(0,i)),e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|d(t.length);return 0===(e=s(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?s(e,0):h(e,t);if("Buffer"===t.type&&o(t.data))return h(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(l(t),e=s(e,t<0?0:0|d(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function h(e,t){var r=t.length<0?0:0|d(t.length);e=s(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function d(e){if(e>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(e).length;default:if(n)return B(e).length;t=(""+t).toLowerCase(),n=!0}}function v(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return E(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,i){var o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var l=-1;for(o=r;o<s;o++)if(c(e,o)===c(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*a}else-1!==l&&(o-=o-l),l=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){for(var f=!0,h=0;h<u;h++)if(c(e,o+h)!==c(t,h)){f=!1;break}if(f)return o}return-1}function b(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[r+a]=s}return a}function w(e,t,r,n){return z(B(t,e.length-r),e,r,n)}function x(e,t,r,n){return z(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function _(e,t,r,n){return x(e,t,r,n)}function j(e,t,r,n){return z(q(t),e,r,n)}function S(e,t,r,n){return z(function(e,t){for(var r,n,i,o=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function I(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function k(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,a,s,u,c=e[i],l=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}function R(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function E(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function O(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=F(e[o]);return i}function T(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function A(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,n,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function N(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i<o;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function L(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i<o;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function C(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,n,o){return o||C(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function M(e,t,r,n,o){return o||C(e,0,r,8),i.write(e,t,r,n,52,8),r+8}t.Buffer=u,t.SlowBuffer=function(e){return+e!=e&&(e=0),u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=a(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return c(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return function(e,t,r,n){return l(t),t<=0?s(e,t):void 0!==r?"string"==typeof n?s(e,t).fill(r,n):s(e,t).fill(r):s(e,t)}(null,e,t,r)},u.allocUnsafe=function(e){return f(null,e)},u.allocUnsafeSlow=function(e){return f(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).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(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=u.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?k(this,0,e):v.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,r,n,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(o,a),c=this.slice(n,i),l=e.slice(t,r),f=0;f<s;++f)if(c[f]!==l[f]){o=c[f],a=l[f];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":return x(this,e,t,r);case"latin1":case"binary":return _(this,e,t,r);case"base64":return j(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},u.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=u.prototype;else{var i=t-e;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+e]}return r},u.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||A(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},u.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||A(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return t||A(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||A(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||A(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||A(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||A(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||A(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||A(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||A(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||A(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||A(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||A(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||A(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||A(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||P(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},u.prototype.writeUIntBE=function(e,t,r,n){e=+e,t|=0,r|=0,n||P(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<r&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return M(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return M(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,o=n-r;if(this===e&&r<t&&t<n)for(i=o-1;i>=0;--i)e[i+t]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+o),t);return o},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(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)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var a=u.isBuffer(e)?e:B(new u(e,n).toString()),s=a.length;for(o=0;o<r-t;++o)this[o+t]=a[o%s]}return this};var U=/[^+\/0-9A-Za-z-_]/g;function F(e){return e<16?"0"+e.toString(16):e.toString(16)}function B(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function q(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(U,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(8))},function(e,t,r){t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=c(e),a=n[0],s=n[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,a,s)),l=0,f=s>0?a-4:a;for(r=0;r<f;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;return 2===s&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t),1===s&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t),u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],a=0,s=r-i;a<s;a+=16383)o.push(l(e,a,a+16383>s?s:a+16383));return 1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var i,o,a=[],s=t;s<r;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
|
|
88
88
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
89
|
-
t.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,c=u>>1,l=-7,f=r?i-1:0,h=r?-1:1,d=e[t+f];for(f+=h,o=d&(1<<-l)-1,d>>=-l,l+=s;l>0;o=256*o+e[t+f],f+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+e[t+f],f+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=c}return(d?-1:1)*a*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,f=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(t*u-1)*Math.pow(2,i),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;e[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;e[r+d]=255&a,d+=p,a/=256,c-=8);e[r+d-p]|=128*v}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){r.r(t),r.d(t,"createBlankNode",(function(){return N})),r.d(t,"createQuad",(function(){return L})),r.d(t,"jsonLDFromRDF",(function(){return m.fromRDF})),r.d(t,"jsonLDToRDF",(function(){return m.toRDF})),r.d(t,"compactJsonLD",(function(){return m.compact})),r.d(t,"TurtleParser",(function(){return x})),r.d(t,"TurtleWriter",(function(){return A}));var n=r(0);function i(e){return!!e&&"DefaultGraph"===e.termType}const{rdf:o,xsd:a}=n.a;let s,u=0;const c={namedNode:function(e){return new h(e)},blankNode:function(e){return new p(e||"n3-"+u++)},variable:function(e){return new v(e)},literal:function(e,t){if("string"==typeof t)return new d(`"${e}"@${t.toLowerCase()}`);let r=t?t.value:"";return""===r&&("boolean"==typeof e?r=a.boolean:"number"==typeof e&&(Number.isFinite(e)?r=Number.isInteger(e)?a.integer:a.double:(r=a.double,Number.isNaN(e)||(e=e>0?"INF":"-INF")))),""===r||r===a.string?new d(`"${e}"`):new d(`"${e}"^^${r}`)},defaultGraph:function(){return s},quad:y,triple:y};var l=c;class f{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof f?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}toJSON(){return{termType:this.termType,value:this.value}}}class h extends f{get termType(){return"NamedNode"}}class d extends f{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const e=this.id;let t=e.lastIndexOf('"')+1;return t<e.length&&"@"===e[t++]?e.substr(t).toLowerCase():""}get datatype(){return new h(this.datatypeString)}get datatypeString(){const e=this.id,t=e.lastIndexOf('"')+1,r=t<e.length?e[t]:"";return"^"===r?e.substr(t+2):"@"!==r?a.string:o.langString}equals(e){return e instanceof d?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&this.datatype.value===e.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}}class p extends f{constructor(e){super("_:"+e)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}}class v extends f{constructor(e){super("?"+e)}get termType(){return"Variable"}get value(){return this.id.substr(1)}}s=new class extends f{constructor(){return super(""),s||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};class g extends f{constructor(e,t,r,n){super(""),this._subject=e,this._predicate=t,this._object=r,this._graph=n||s}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(e){return!!e&&this._subject.equals(e.subject)&&this._predicate.equals(e.predicate)&&this._object.equals(e.object)&&this._graph.equals(e.graph)}}function y(e,t,r,n){return new g(e,t,r,n)}var m=r(7),b=r(21);let w=0;class x{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&j(this,e.factory);const t="string"==typeof e.format?e.format.match(/\w*$/)[0].toLowerCase():"",r=/turtle/.test(t),n=/trig/.test(t),i=/triple/.test(t),o=/quad/.test(t),a=this._n3Mode=/n3/.test(t),s=i||o;(this._supportsNamedGraphs=!(r||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(r||n||i||a),this._supportsRDFStar=""===t||/star|\*$/.test(t),s&&(this._resolveRelativeIRI=e=>null),this._blankNodePrefix="string"!=typeof e.blankNodePrefix?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new b.a({lineMode:s,n3:a}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){w=0}_setBase(e){if(e){const t=e.indexOf("#");t>=0&&(e=e.substr(0,t)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}else this._base="",this._basePath=""}_saveContext(e,t,r,n,i){const o=this._n3Mode;this._contextStack.push({subject:r,predicate:n,object:i,graph:t,type:e,inverse:!!o&&this._inversePredicate,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?this._graph.id.substr(2)+".":".",this._quantified=Object.create(this._quantified))}_restoreContext(){const e=this._contextStack.pop(),t=this._n3Mode;this._subject=e.subject,this._predicate=e.predicate,this._object=e.object,this._graph=e.graph,t&&(this._inversePredicate=e.inverse,this._prefixes._=e.blankPrefix,this._quantified=e.quantified)}_readInTopContext(e){switch(e.type){case"eof":return null!==this._graph?this._error("Unclosed graph",e):(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(e)}}_readEntity(e,t){let r;switch(e.type){case"IRI":case"typeIRI":const t=this._resolveIRI(e.value);if(null===t)return this._error("Invalid IRI",e);r=this._namedNode(t);break;case"type":case"prefixed":const n=this._prefixes[e.prefix];if(void 0===n)return this._error(`Undefined prefix "${e.prefix}:"`,e);r=this._namedNode(n+e.value);break;case"blank":r=this._blankNode(this._prefixes[e.prefix]+e.value);break;case"var":r=this._variable(e.value.substr(1));break;default:return this._error("Expected entity but got "+e.type,e)}return!t&&this._n3Mode&&r.id in this._quantified&&(r=this._quantified[r.id]),r}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier=this._blankNode,this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier=this._variable,this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(0===e.prefix.length)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._literal(e.value,this._namedNode(e.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",e);default:if(void 0===(this._subject=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){const t=e.type;switch(t){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":return null===this._predicate?this._error("Unexpected "+t,e):(this._subject=null,"]"===t?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",e);case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if(void 0===(this._predicate=this._readEntity(e)))return}return this._readObject}_readObject(e){switch(e.type){case"literal":if(0===e.prefix.length)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._literal(e.value,this._namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",e);default:if(void 0===(this._object=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return"{"===e.type?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return"{"!==e.type?this._error("Expected graph but got "+e.type,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){return"]"===e.type?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if("]"!==e.type)return this._readBlankNodePunctuation(e);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const t=null===this._predicate;return this._restoreContext(),null===this._object?t?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank:this._getContextEndReader()}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let t=null,r=null,n=this._readListItem;const i=this._subject,o=this._contextStack,a=o[o.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,r=this._blankNode(),this.RDF_FIRST,this._subject=t=this._blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,r=this._blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext(),0!==o.length&&"list"===o[o.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(n=this._readPredicate,this._subject===this.RDF_NIL)return n}else if(n=this._getContextEndReader(),this._object===this.RDF_NIL)return n;r=this.RDF_NIL;break;case"literal":0===e.prefix.length?(this._literalValue=e.value,n=this._readListItemDataTypeOrLang):(t=this._literal(e.value,this._namedNode(e.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if(void 0===(t=this._readEntity(e)))return}if(null===r&&(this._subject=r=this._blankNode()),null===i?null===a.predicate?a.subject=r:a.object=r:this._emit(i,this.RDF_REST,r,this._graph),null!==t){if(this._n3Mode&&("IRI"===e.type||"prefixed"===e.type))return this._saveContext("item",this._graph,r,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(r,this.RDF_FIRST,t,this._graph)}return n}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let t=this._literal(this._literalValue);switch(e.type){case"type":case"typeIRI":const r=this._readEntity(e);if(void 0===r)return;t=this._literal(this._literalValue,r),e=null;break;case"langcode":t=this._literal(this._literalValue,e.value),e=null}return{token:e,literal:t}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,t){const r=this._completeLiteral(e);if(r)return this._object=r.literal,t&&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(e){return"}"!==e.type?this._readPunctuation(e):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext(),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let t,r=this._graph;const n=this._subject,i=this._inversePredicate;switch(e.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,i&&(this._inversePredicate=!1);break;case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(r=this._readEntity(e))){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(null!==n){const e=this._predicate,t=this._object;i?this._emit(t,e,n,r):this._emit(n,e,t,r)}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),t}_readQuadPunctuation(e){return"."!==e.type?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return"prefix"!==e.type?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if("IRI"!==e.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);const t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){const t="IRI"===e.type&&this._resolveIRI(e.value);return t?(this._setBase(t),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",e)}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return"]"!==e.type?this._error("Invalid graph label",e):(this._subject=this._blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):"."!==e.type?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let t;switch(e.type){case"IRI":case"prefixed":if(void 0!==(t=this._readEntity(e,!0)))break;default:return this._error("Unexpected "+e.type,e)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._quantifier(this._blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return","===e.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(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const t=this._contextStack,r=t.length&&t[t.length-1];if(r&&"item"===r.type){const e=this._subject;this._restoreContext(),this._emit(this._subject,this.RDF_FIRST,e,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let t,r;const n=this._blankNode();if(void 0!==(r=this._readEntity(e)))return null===this._predicate?(t=this._subject,this._subject=n):(t=this._object,this._object=n),this._emit(t,r,n,this._graph),this._readPath}_readBackwardPath(e){const t=this._blankNode();let r,n;if(void 0!==(r=this._readEntity(e)))return null===this._predicate?(n=this._subject,this._subject=t):(n=this._object,this._object=t),this._emit(t,r,n,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return">>"!==e.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(e))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e):this._readRDFStarTail(e)}_readRDFStarTail(e){if(">>"!==e.type)return this._error("Expected >> but got "+e.type,e);const t=this._quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext(),null===this._subject?(this._subject=t,this._readPredicate):(this._object=t,this._getContextEndReader())}_getContextEndReader(){const e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(e,t,r,n){this._callback(null,this._quad(e,t,r,n||this.DEFAULTGRAPH))}_error(e,t){const r=new Error(`${e} on line ${t.line}.`);r.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(r),this._callback=_}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return("/"===e[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;const t=e.length;let r="",n=-1,i=-1,o=0,a="/";for(;n<t;){switch(a){case":":if(i<0&&"/"===e[++n]&&"/"===e[++n])for(;(i=n+1)<t&&"/"!==e[i];)n=i;break;case"?":case"#":n=t;break;case"/":if("."===e[n+1])switch(a=e[1+ ++n],a){case"/":r+=e.substring(o,n-1),o=n+1;break;case void 0:case"?":case"#":return r+e.substring(o,n)+e.substr(n+1);case".":if(a=e[1+ ++n],void 0===a||"/"===a||"?"===a||"#"===a){if(r+=e.substring(o,n-2),(o=r.lastIndexOf("/"))>=i&&(r=r.substr(0,o)),"/"!==a)return`${r}/${e.substr(n+1)}`;o=n+1}}}a=e[++n]}return r+e.substring(o)}parse(e,t,r){if(this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${w++}_`,this._prefixCallback=r||_,this._inversePredicate=!1,this._quantified=Object.create(null),!t){const t=[];let r;if(this._callback=(e,n)=>{e?r=e:n&&t.push(n)},this._lexer.tokenize(e).every((e=>this._readCallback=this._readCallback(e))),r)throw r;return t}this._callback=t,this._lexer.tokenize(e,((e,t)=>{null!==e?(this._callback(e),this._callback=_):this._readCallback&&(this._readCallback=this._readCallback(t))}))}}function _(){}function j(e,t){const r=t.namedNode;e._namedNode=r,e._blankNode=t.blankNode,e._literal=t.literal,e._variable=t.variable,e._quad=t.quad,e.DEFAULTGRAPH=t.defaultGraph(),e.RDF_FIRST=r(n.a.rdf.first),e.RDF_REST=r(n.a.rdf.rest),e.RDF_NIL=r(n.a.rdf.nil),e.N3_FORALL=r(n.a.r.forAll),e.N3_FORSOME=r(n.a.r.forSome),e.ABBREVIATIONS={a:r(n.a.rdf.type),"=":r(n.a.owl.sameAs),">":r(n.a.log.implies)},e.QUANTIFIERS_GRAPH=r("urn:n3:quantifiers")}j(x.prototype,l);const S=l.defaultGraph(),{rdf:I,xsd:k}=n.a,R=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,E=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,O={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class T extends f{equals(){return!1}}class A{constructor(e,t){if(this._prefixRegex=/$0^/,e&&"function"!=typeof e.write&&(t=e,e=null),t=t||{},this._lists=t.lists,e)this._outputStream=e,this._endStream=void 0===t.end||!!t.end;else{let e="";this._outputStream={write(t,r,n){e+=t,n&&n()},end:t=>{t&&t(null,e)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=S,this._baseIRI=t.baseIRI,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes))}get _inDefaultGraph(){return S.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t)}_writeQuad(e,t,r,n,i){try{n.equals(this._graph)||(this._write((null===this._subject?"":this._inDefaultGraph?".\n":"\n}\n")+(S.equals(n)?"":this._encodeIriOrBlank(n)+" {\n")),this._graph=n,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(", "+this._encodeObject(r),i):this._write(`;\n ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,i):this._write(`${(null===this._subject?"":".\n")+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,i)}catch(e){i&&i(e)}}_writeQuadLine(e,t,r,n,i){delete this._prefixMatch,this._write(this.quadToString(e,t,r,n),i)}quadToString(e,t,r,n){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(r)}${n&&n.value?` ${this._encodeIriOrBlank(n)} .\n`:" .\n"}`}quadsToString(e){return e.map((e=>this.quadToString(e.subject,e.predicate,e.object,e.graph))).join("")}_encodeSubject(e){return"Quad"===e.termType?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if("NamedNode"!==e.termType)return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:"_:"+e.value;let t=e.value;this._baseIRI&&t.startsWith(this._baseIRI)&&(t=t.substr(this._baseIRI.length)),R.test(t)&&(t=t.replace(E,P));const r=this._prefixRegex.exec(t);return r?r[1]?this._prefixIRIs[r[1]]+r[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(R.test(t)&&(t=t.replace(E,P)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===k.string)return`"${t}"`}else switch(e.datatype.value){case k.string:return`"${t}"`;case k.boolean:if("true"===t||"false"===t)return t;break;case k.integer:if(/^[+-]?\d+$/.test(t))return t;break;case k.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case k.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===I.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:t,object:r,graph:n}){return`<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(r)}${i(n)?"":" "+this._encodeIriOrBlank(n)}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,r,n,i){void 0===r?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):"function"==typeof n?this._writeQuad(e,t,r,S,n):this._writeQuad(e,t,r,n||S,i)}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}addPrefix(e,t,r){const n={};n[e]=t,this.addPrefixes(n,r)}addPrefixes(e,t){if(!this._prefixIRIs)return t&&t();let r=!1;for(let t in e){let n=e[t];"string"!=typeof n&&(n=n.value),r=!0,null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null,this._graph=""),this._prefixIRIs[n]=t+=":",this._write(`@prefix ${t} <${n}>.\n`)}if(r){let e="",t="";for(const r in this._prefixIRIs)e+=e?"|"+r:r,t+=(t?"|":"")+this._prefixIRIs[r];e=e.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&"),this._prefixRegex=new RegExp(`^(?:${t})[^/]*$|^(${e})([a-zA-Z][\\-_a-zA-Z0-9]*)$`)}this._write(r?"\n":"",t)}blank(e,t){let r,n,i=e;switch(void 0===e?i=[]:e.termType?i=[{predicate:e,object:t}]:"length"in e||(i=[e]),n=i.length){case 0:return new T("[]");case 1:if(r=i[0],!(r.object instanceof T))return new T(`[ ${this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)} ]`);default:let t="[";for(let o=0;o<n;o++)r=i[o],r.predicate.equals(e)?t+=", "+this._encodeObject(r.object):(t+=`${(o?";\n ":"\n ")+this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)}`,e=r.predicate);return new T(t+"\n]")}}list(e){const t=e&&e.length||0,r=new Array(t);for(let n=0;n<t;n++)r[n]=this._encodeObject(e[n]);return new T(`(${r.join(" ")})`)}end(e){null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null),this._write=this._blockedWrite;let t=e&&((r,n)=>{t=null,e(r,n)});if(this._endStream)try{return this._outputStream.end(t)}catch(e){}t&&t()}}function P(e){let t=O[e];return void 0===t&&(1===e.length?(t=e.charCodeAt(0).toString(16),t="\\u0000".substr(0,6-t.length)+t):(t=(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)+9216).toString(16),t="\\U00000000".substr(0,10-t.length)+t)),t}function N(e){return new p(e)}function L(e,t,r,n){return new g(e,t,r,n)}}])}));e.SolidDocumentPermission=void 0,(Cb=e.SolidDocumentPermission||(e.SolidDocumentPermission={})).Read="read",Cb.Write="write",Cb.Append="append",Cb.Control="control";var Ub=function(t){c(n,t);var r=p(n);function n(e,t,i){var a;return o(this,n),u(h(a=r.call(this,t)),"url",void 0),u(h(a),"headers",void 0),a.url=e,a.headers=i,a}return s(n,[{key:"isACPResource",value:function(){var e;return!(null===(e=this.headers.get("Link"))||void 0===e||!e.match(/<http:\/\/www\.w3\.org\/ns\/solid\/acp#AccessControlResource>;[^,]+rel="type"/))}},{key:"isPersonalProfile",value:function(){return!!this.statement(this.url,Rb("rdf:type"),Rb("foaf:PersonalProfileDocument"))}},{key:"isStorage",value:function(){var e;return!(null===(e=this.headers.get("Link"))||void 0===e||!e.match(/<http:\/\/www\.w3\.org\/ns\/pim\/space#Storage>;[^,]+rel="type"/))}},{key:"isUserWritable",value:function(){return this.getUserPermissions().includes(e.SolidDocumentPermission.Write)}},{key:"getUserPermissions",value:function(){return this.getPermissionsFromWAC("user")}},{key:"getPublicPermissions",value:function(){return this.getPermissionsFromWAC("public")}},{key:"getLastModified",value:function(){var e,t,r,n;return null!==(e=null!==(t=null!==(r=Km(this.headers.get("last-modified")))&&void 0!==r?r:Km(null===(n=this.statement(this.url,"purl:modified"))||void 0===n?void 0:n.object.value))&&void 0!==t?t:this.getLatestDocumentDate())&&void 0!==e?e:null}},{key:"expandIRI",value:function(e){return Rb(e,{defaultPrefix:this.url})}},{key:"getLatestDocumentDate",value:function(){var e=[].concat(g(this.statements(void 0,"purl:modified")),g(this.statements(void 0,"purl:created"))).map((function(e){return Km(e.object.value)})).filter((function(e){return null!==e}));return e.length>0?e.reduce((function(e,t){return e>t?e:t})):null}},{key:"getPermissionsFromWAC",value:function(t){var r,n,i,o,a,s=null!==(r=this.headers.get("WAC-Allow"))&&void 0!==r?r:"",u=null!==(n=null===(o=s,a=new RegExp("".concat(t,'="([^"]+)"')),i=o.match(a))||void 0===i?void 0:i[1])&&void 0!==n?n:"";return Gm([u.includes("read")&&e.SolidDocumentPermission.Read,u.includes("write")&&e.SolidDocumentPermission.Write,u.includes("append")&&e.SolidDocumentPermission.Append,u.includes("control")&&e.SolidDocumentPermission.Control])}}]),n}(Ob);function Fb(){return(Fb=i(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Mb.compactJsonLD(t,{});case 2:if(!("@graph"in(r=e.sent))){e.next=5;break}return e.abrupt("return",r);case 5:if(!("@id"in r)){e.next=7;break}return e.abrupt("return",{"@graph":[r]});case 7:return e.abrupt("return",{"@graph":[]});case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Bb(e){return"@graph"in e}function qb(e,t){return zb.apply(this,arguments)}function zb(){return(zb=i(regeneratorRuntime.mark((function e(t,r){var n,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={headers:{Accept:"text/turtle"}},e.prev=1,e.next=4,r(t,n);case 4:if(404!==(i=e.sent).status){e.next=7;break}throw new _b(t);case 7:if(![401,403].includes(i.status)){e.next=9;break}throw new jb(t,i.status);case 9:return e.next=11,i.text();case 11:return o=e.sent,e.abrupt("return",{body:o,headers:i.headers});case 15:if(e.prev=15,e.t0=e.catch(1),!(e.t0 instanceof jb)){e.next=19;break}throw e.t0;case 19:if(!(e.t0 instanceof _b)){e.next=21;break}throw e.t0;case 21:throw new xb(t,{cause:e.t0});case 22:case"end":return e.stop()}}),e,null,[[1,15]])})))).apply(this,arguments)}function Jb(e){var t,r=e.slice(0),n={},i=mb(e).flatMap((function(e,t){return yb(Gm(["BlankNode"===e.object.termType?e.object.value:null,"BlankNode"===e.subject.termType?e.subject.value:null]),(function(e){return e.forEach((function(e){var r;return(null!==(r=n[e])&&void 0!==r?r:n[e]=new Set).add(t)}))}))})).filter().unique(),o=b(i);try{var a=function(){var i,o=t.value,a=n[o],s=Db(mb(a).map((function(t){return e[t]})).filter((function(e){var t=e.subject,r=t.termType,n=t.value;return"BlankNode"===r&&n===o})).map((function(e){var t=e.predicate,r=e.object;return"BlankNode"===r.termType?t.value:t.value+r.value})).sorted().join()),u=b(a);try{for(u.s();!(i=u.n()).done;){for(var c=i.value,l=r[c],f={subject:l.subject,object:l.object},h=0,d=Object.entries(f);h<d.length;h++){var p=v(d[h],2),g=p[0],y=p[1];"BlankNode"===y.termType&&y.value===o&&(f[g]=Mb.createBlankNode(s))}Qm(r,l,Mb.createQuad(f.subject,l.predicate,f.object))}}catch(e){u.e(e)}finally{u.f()}};for(o.s();!(t=o.n()).done;)a()}catch(e){o.e(e)}finally{o.f()}return r}function $b(e,t,r){return Gb.apply(this,arguments)}function Gb(){return(Gb=i(regeneratorRuntime.mark((function e(t,r,n){var i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null!==(i=n)&&void 0!==i?i:window.fetch.bind(window),e.next=3,sw(r);case 3:return o=e.sent,e.next=6,n(t,{method:"PUT",headers:{"Content-Type":"text/turtle"},body:r});case 6:return e.abrupt("return",new Ub(t,o,new Headers({})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Hb(e,t){return Qb.apply(this,arguments)}function Qb(){return Qb=i(regeneratorRuntime.mark((function e(t,r){var n,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,qb(t,null!=r?r:window.fetch);case 2:return n=e.sent,i=n.body,o=n.headers,e.next=7,sw(i,{baseIRI:t});case 7:return a=e.sent,e.abrupt("return",new Ub(t,a,o));case 9:case"end":return e.stop()}}),e)}))),Qb.apply(this,arguments)}function Vb(e,t){return Wb.apply(this,arguments)}function Wb(){return(Wb=i(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Hb(t,r);case 3:return n=e.sent,e.abrupt("return",n);case 7:if(e.prev=7,e.t0=e.catch(0),e.t0 instanceof _b){e.next=11;break}throw e.t0;case 11:return e.abrupt("return",null);case 12:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function Yb(e,t){return Kb.apply(this,arguments)}function Kb(){return(Kb=i(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Bb(t)){e.next=5;break}return e.next=3,Promise.all(t["@graph"].map((function(e){return Yb(e,r)})));case 3:return n=e.sent,e.abrupt("return",n.flat());case 5:return e.abrupt("return",Mb.jsonLDToRDF(t,{base:r}));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Xb(e){var t=aw(e);return Object.entries(t).reduce((function(e,t){var r=v(t,2),n=r[0],i=r[1].map((function(e){return" "+rw(e)})).sort().join("\n");return e.concat("".concat(n.toUpperCase()," DATA {\n").concat(i,"\n}"))}),[]).join(" ;\n")}function Zb(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Mm({baseIRI:r.baseIRI}),i=new Mb.TurtleParser(n),o={quads:[],containsRelativeIRIs:!1};return new Promise((function(n,a){var s=i._resolveRelativeIRI;i._resolveRelativeIRI=function(){return o.containsRelativeIRIs=!0,i._resolveRelativeIRI=s,i._resolveRelativeIRI.apply(i,arguments)},i.parse(t,(function(t,i){var s;t?a(new wb(null!==(s=r.baseIRI)&&void 0!==s?s:null,e.SolidDocumentFormat.Turtle,t.message)):i?o.quads.push(i):n(o)}))}))}function ew(){return(ew=i(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Mb.jsonLDFromRDF(t);case 2:return r=e.sent,e.abrupt("return",{"@graph":r});case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function tw(e){return(new Mb.TurtleWriter).quadsToString(e)}function rw(e){return(new Mb.TurtleWriter).quadsToString([e]).slice(0,-1)}function nw(e,t){return iw.apply(this,arguments)}function iw(){return(iw=i(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Hb(t,r);case 3:return n=e.sent,e.abrupt("return",!n.isEmpty());case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function ow(){return ow=i(regeneratorRuntime.mark((function e(t){var r,n,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:{},n=rb(t,/(\w+) DATA {([^}]+)}/g),o={},e.next=5,Promise.all(g(n).map(function(){var e=i(regeneratorRuntime.mark((function e(t){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t[1].toLowerCase(),i=t[2],e.next=4,sw(i,r);case 4:o[n]=e.sent;case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 5:return e.abrupt("return",o);case 6:case"end":return e.stop()}}),e)}))),ow.apply(this,arguments)}function aw(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=rb(e,/(\w+) DATA {([^}]+)}/g),i={},o=b(n);try{for(o.s();!(t=o.n()).done;){var a=t.value,s=a[1].toLowerCase(),u=a[2];i[s]=cw(u,r)}}catch(e){o.e(e)}finally{o.f()}return i}function sw(e){return uw.apply(this,arguments)}function uw(){return uw=i(regeneratorRuntime.mark((function e(t){var r,n,i,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.length>1&&void 0!==o[1]?o[1]:{},e.next=3,Zb(t,r);case 3:return n=e.sent,i=n.quads,e.abrupt("return",i);case 6:case"end":return e.stop()}}),e)}))),uw.apply(this,arguments)}function cw(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Mm({baseIRI:r.baseIRI}),i=new Mb.TurtleParser(n);try{var o=i.parse(t);return r.normalizeBlankNodes?Jb(o):o}catch(t){var a,s;throw new wb(null!==(a=r.baseIRI)&&void 0!==a?a:null,e.SolidDocumentFormat.Turtle,null!==(s=t.message)&&void 0!==s?s:"")}}function lw(e,t,r){return fw.apply(this,arguments)}function fw(){return(fw=i(regeneratorRuntime.mark((function e(t,r,n){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null!==(i=n)&&void 0!==i?i:window.fetch.bind(window),e.next=3,n(t,{method:"PATCH",headers:{"Content-Type":"application/sparql-update"},body:r});case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function hw(e,t){return dw.apply(this,arguments)}function dw(){return dw=i(regeneratorRuntime.mark((function e(t,r){var n,o,a,s,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=new Ob(t.getQuads()),s=u({},t.url,t),c=function(e){e.statements(void 0,"foaf:isPrimaryTopicOf").map((function(e){return e.object.value})).forEach((function(e){var t;return s[e]=null!==(t=s[e])&&void 0!==t?t:null})),e.statements(void 0,"foaf:primaryTopic").map((function(e){return e.subject.value})).forEach((function(e){var t;return s[e]=null!==(t=s[e])&&void 0!==t?t:null}))},l=function(){var e=i(regeneratorRuntime.mark((function e(){var t,n,i,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=0,n=Object.entries(s);case 1:if(!(t<n.length)){e.next=23;break}if(i=v(n[t],2),o=i[0],null===i[1]){e.next=5;break}return e.abrupt("continue",20);case 5:return e.prev=5,e.next=8,Hb(o,r);case 8:u=e.sent,s[o]=u,a.addQuads(u.getQuads()),c(u),e.next=20;break;case 14:if(e.prev=14,e.t0=e.catch(5),!(e.t0 instanceof jb)){e.next=19;break}return s[o]=!1,e.abrupt("continue",20);case 19:throw e.t0;case 20:t++,e.next=1;break;case 23:case"end":return e.stop()}}),e,null,[[5,14]])})));return function(){return e.apply(this,arguments)}}(),c(t);case 5:return e.next=7,l();case 7:if(Object.values(s).some((function(e){return null===e}))){e.next=5;break}case 8:return e.abrupt("return",{store:a,cloaked:Object.values(s).some((function(e){return!1===e})),writableProfileUrl:t.isUserWritable()?t.url:null!==(n=null===(o=Object.values(s).find((function(e){return!!e&&e.isUserWritable()})))||void 0===o?void 0:o.url)&&void 0!==n?n:null});case 9:case"end":return e.stop()}}),e)}))),dw.apply(this,arguments)}function pw(e,t){return vw.apply(this,arguments)}function vw(){return vw=i(regeneratorRuntime.mark((function e(t,n){var i,o,a,s,u,c,l,f,h,d,p,v,g,y,m,b,w,x;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f=cb(t),e.next=3,Hb(f,n);case 3:if((h=e.sent).isPersonalProfile()||h.contains(t,"solid:oidcIssuer")){e.next=6;break}throw new Error("".concat(t," is not a valid webId."));case 6:return e.next=8,hw(h,n);case 8:d=e.sent,p=d.store,v=d.writableProfileUrl,g=d.cloaked,y=p.statements(t,"pim:storage").map((function(e){return e.object.value})),m=p.statement(t,"solid:publicTypeIndex"),b=p.statement(t,"solid:privateTypeIndex"),w=sb(f);case 16:if(!w||0!==y.length){e.next=26;break}return e.next=19,tb(Hb(w,n));case 19:if(null==(x=e.sent)||!x.isStorage()){e.next=23;break}return y.push(w),e.abrupt("break",26);case 23:w=sb(w),e.next=16;break;case 26:if(0!==y.length){e.next=28;break}throw new Error("Could not find any storage for ".concat(t,"."));case 28:return e.abrupt("return",r({webId:t,cloaked:g,writableProfileUrl:v,storageUrls:Vm(y)},Mm({name:null!==(i=null===(o=p.statement(t,"vcard:fn"))||void 0===o?void 0:o.object.value)&&void 0!==i?i:null===(a=p.statement(t,"foaf:name"))||void 0===a?void 0:a.object.value,avatarUrl:null!==(s=null===(u=p.statement(t,"vcard:hasPhoto"))||void 0===u?void 0:u.object.value)&&void 0!==s?s:null===(c=p.statement(t,"foaf:img"))||void 0===c?void 0:c.object.value,oidcIssuerUrl:null===(l=p.statement(t,"solid:oidcIssuer"))||void 0===l?void 0:l.object.value,publicTypeIndexUrl:null==m?void 0:m.object.value,privateTypeIndexUrl:null==b?void 0:b.object.value})));case 29:case"end":return e.stop()}}),e)}))),vw.apply(this,arguments)}function gw(){return gw=i(regeneratorRuntime.mark((function e(t){var r,n,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=a.length>1&&void 0!==a[1]?a[1]:{}).required){e.next=3;break}return e.abrupt("return",pw(t,i.fetch));case 3:return o=tb((function(e){return pw(e,i.fetch)})),e.next=6,o(t);case 6:if(e.t2=n=e.sent,e.t1=null!==e.t2,!e.t1){e.next=10;break}e.t1=void 0!==n;case 10:if(!e.t1){e.next=14;break}e.t3=n,e.next=17;break;case 14:return e.next=16,o(t.replace(/\/$/,"").concat("/profile/card#me"));case 16:e.t3=e.sent;case 17:if(e.t4=r=e.t3,e.t0=null!==e.t4,!e.t0){e.next=21;break}e.t0=void 0!==r;case 21:if(!e.t0){e.next=25;break}e.t5=r,e.next=28;break;case 25:return e.next=27,o(ab(t).concat("/profile/card#me"));case 27:e.t5=e.sent;case 28:return e.abrupt("return",e.t5);case 29:case"end":return e.stop()}}),e)}))),gw.apply(this,arguments)}function yw(e){var t=function(e){return e.path&&e.path.startsWith("/")?e.path.match(/^\/[^/]*$/)?"/":"/".concat(mb(e.path.split("/")).filter().slice(0,-1).join("/"),"/").replace("//","/"):null}(e);return e.protocol&&e.domain?"".concat(e.protocol,"://").concat(e.domain).concat(null!=t?t:"/"):t}function mw(e){var t;if("@type"in e&&!("@value"in e)){e["@id"]=null!==(t=e["@id"])&&void 0!==t?t:eb();for(var r=0,n=Object.values(e);r<n.length;r++){var i=n[r];Nm(i)&&mw(i),Am(i)&&i.forEach((function(e){return Nm(e)&&mw(e)}))}}}function bw(e,t,r){return ww.apply(this,arguments)}function ww(){return(ww=i(regeneratorRuntime.mark((function e(t,r,n){var i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null!==(i=n)&&void 0!==i?i:window.fetch.bind(n),o=t.storageUrls[0],a="".concat(o,"settings/").concat(r,"TypeIndex"),e.next=5,nw(a,n);case 5:if(!e.sent){e.next=9;break}e.t0="".concat(o,"settings/").concat(r,"TypeIndex-").concat(eb()),e.next=10;break;case 9:e.t0=a;case 10:return e.abrupt("return",e.t0);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xw(e,t,r){return _w.apply(this,arguments)}function _w(){return(_w=i(regeneratorRuntime.mark((function e(t,r,n){var i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==t.writableProfileUrl){e.next=2;break}throw new Error("Can't create type index without a writable profile document");case 2:return n=null!==(i=n)&&void 0!==i?i:window.fetch.bind(n),e.next=5,bw(t,r,n);case 5:return o=e.sent,a="public"===r?"<> a <http://www.w3.org/ns/solid/terms#TypeIndex> .":"\n <> a\n <http://www.w3.org/ns/solid/terms#TypeIndex>,\n <http://www.w3.org/ns/solid/terms#UnlistedDocument> .\n ",s="\n INSERT DATA {\n <".concat(t.webId,"> <http://www.w3.org/ns/solid/terms#").concat(r,"TypeIndex> <").concat(o,"> .\n }\n "),e.next=10,Promise.all([$b(o,a,n),lw(t.writableProfileUrl,s,n)]);case 10:return e.abrupt("return",o);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function jw(e,t,r,n){return Sw.apply(this,arguments)}function Sw(){return(Sw=i(regeneratorRuntime.mark((function e(t,r,n,i){var o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Hb(t,i);case 2:return o=e.sent,a=Array.isArray(r)?r:[r],e.abrupt("return",a.map((function(e){return o.statements(void 0,"rdf:type","solid:TypeRegistration").filter((function(t){return o.contains(t.subject.value,"solid:forClass",e)})).map((function(e){return o.statements(e.subject.value,n)})).flat().map((function(e){return e.object.value})).filter((function(e){return!!e}))})).flat());case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Iw(){return(Iw=i(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",xw(t,"public",r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kw(){return(kw=i(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",xw(t,"private",r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Rw(){return(Rw=i(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",jw(t,r,"solid:instanceContainer",n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ew(){return(Ew=i(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",jw(t,r,"solid:instance",n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ow={},Tw={"%uuid%":"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},Aw=function(e){c(ExpectedQuadAssertionError,e);var t=p(ExpectedQuadAssertionError);function ExpectedQuadAssertionError(e){var r;return o(this,ExpectedQuadAssertionError),u(h(r=t.call(this,"Couldn't find the following triple: ".concat(rw(e)))),"expectedQuad",void 0),r.expectedQuad=e,r}return ExpectedQuadAssertionError}(Rm);function Pw(e,t){var r,n=b(e);try{var i=function(){var e=r.value,n=t.find((function(t){return n=t,function(e,t){if(e.termType!==t.termType)return!1;if("Literal"===e.termType&&"Literal"===t.termType){if(e.datatype.value!==t.datatype.value)return!1;if(!Nw(e.value))return"http://www.w3.org/2001/XMLSchema#dateTime"===e.datatype.value?new Date(e.value).getTime()===new Date(t.value).getTime():e.value===t.value}return Lw(e.value,t.value)}((r=e).object,n.object)&&Lw(r.subject.value,n.subject.value)&&Lw(r.predicate.value,n.predicate.value);var r,n}));if(!n)throw new Aw(e);Hm(t,n)};for(n.s();!(r=n.n()).done;)i()}catch(e){n.e(e)}finally{n.f()}}function Nw(e){return/\[\[(.*\]\[)?([^\]]+)\]\]/.test(e)}function Lw(e,t){var r,n;return Nw(e)?(null!==(n=(r=Ow)[e])&&void 0!==n?n:r[e]=function(e){var t,r=[],n=[],i=e,o=b(rb(e,/\[\[((.*?)\]\[)?([^\]]+)\]\]/g));try{for(o.s();!(t=o.n()).done;){var a=t.value;a[2]&&r.push(a[2]),n.push(a[3]),i=i.replace(a[0],"%PATTERN".concat(n.length-1,"%"))}}catch(e){o.e(e)}finally{o.f()}i=i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");for(var s=0,u=Object.entries(n);s<u.length;s++){var c,l=v(u[s],2),f=l[0],h=l[1];i=i.replace("%PATTERN".concat(f,"%"),null!==(c=Tw[h])&&void 0!==c?c:h)}return new RegExp(i)}(e)).test(t):e===t}function Cw(){Ow={}}function Dw(e,t){return Mw.apply(this,arguments)}function Mw(){return(Mw=i(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Cw(),e.next=3,Yb(t);case 3:return n=e.sent,e.next=6,Yb(r);case 6:if(i=e.sent,o=tw(n),a=tw(i),s=function(e,t){return{success:e,message:t,expected:o,actual:a}},n.length===i.length){e.next=12;break}return e.abrupt("return",s(!1,"Expected ".concat(n.length," triples, found ").concat(i.length,".")));case 12:e.prev=12,Pw(n,i),e.next=21;break;case 16:if(e.prev=16,e.t0=e.catch(12),e.t0 instanceof Aw){e.next=20;break}throw e.t0;case 20:return e.abrupt("return",s(!1,e.t0.message));case 21:return e.abrupt("return",s(!0,"jsonld matches"));case 22:case"end":return e.stop()}}),e,null,[[12,16]])})))).apply(this,arguments)}function Uw(e,t){var r;Cw();for(var n=aw(e,{normalizeBlankNodes:!0}),i=aw(t,{normalizeBlankNodes:!0}),o=function(r,n){return{success:r,message:n,expected:e,actual:t}},a=0,s=Object.keys(n);a<s.length;a++){var u=s[a];if(!(u in i))return o(!1,"Couldn't find expected ".concat(u," operation."));var c=bb(n,u),l=bb(i,u);if(c.length!==l.length)return o(!1,"Expected ".concat(c.length," ").concat(u," triples, found ").concat(l.length,"."));try{Pw(c,l)}catch(e){if(!(e instanceof Aw))throw e;return o(!1,"Couldn't find the following ".concat(u," triple: ").concat(rw(e.expectedQuad)))}}var f=null!==(r=Object.keys(i)[0])&&void 0!==r?r:null;return f?o(!1,"Did not expect to find ".concat(f," triples.")):o(!0,"sparql matches")}function Fw(e,t){Cw();var r=cw(e,{normalizeBlankNodes:!0}),n=cw(t,{normalizeBlankNodes:!0}),i=function(r,n){return{success:r,message:n,expected:e,actual:t}};if(r.length!==n.length)return i(!1,"Expected ".concat(r.length," triples, found ").concat(n.length,"."));try{Pw(r,n)}catch(e){if(!(e instanceof Aw))throw e;return i(!1,e.message)}return i(!0,"turtle matches")}function Bw(e,t){return qw.apply(this,arguments)}function qw(){return(qw=i(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=null!==(n=r)&&void 0!==n?n:window.fetch.bind(window),e.next=3,r(t,{method:"HEAD"});case 3:if(s=e.sent,u=null!==(i=s.headers.get("Link"))&&void 0!==i?i:"",c=null!==(o=null===(a=u.match(/<([^>]+)>;\s*rel="acl"/))||void 0===a?void 0:a[1])&&void 0!==o?o:null){e.next=8;break}throw new Error("Could not find ACL Resource for '".concat(t,"'"));case 8:return e.abrupt("return",ob(ib(t),c));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function zw(e,t,r){return Jw.apply(this,arguments)}function Jw(){return(Jw=i(regeneratorRuntime.mark((function e(t,r,n){var i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(i=n)||void 0===i){e.next=4;break}e.t0=i,e.next=7;break;case 4:return e.next=6,Bw(t,r);case 6:e.t0=e.sent;case 7:return n=e.t0,e.next=10,Vb(null!==(o=n)&&void 0!==o?o:"",r);case 10:if(a=e.sent){e.next=13;break}return e.abrupt("return",zw(ib(t),r));case 13:if(!a.isACPResource()){e.next=15;break}throw new Ib(t,"ACP");case 15:return e.abrupt("return",a);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $w(){return($w=i(regeneratorRuntime.mark((function e(t,r){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Bw(t,r);case 2:return n=e.sent,e.next=5,zw(t,r,n);case 5:return i=e.sent,e.abrupt("return",Mm({url:n,effectiveUrl:i.url,document:i}));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Gw={turtle:function(e){var t=this._obj,r=this.assert.bind(this),n=Fw(e,t);r(n.success,n.message,"",n.expected,n.actual)},sparql:function(e){var t=this._obj,r=this.assert.bind(this),n=Uw(e,t);r(n.success,n.message,"",n.expected,n.actual)}};function Hw(e,t){var r=e.success,n=t.context.utils;return{pass:r,message:r?function(){return[e.message,n.matcherHint(t.hint)].join("\n\n")}:function(){return[e.message,n.matcherHint(t.hint),["Expected: not ".concat(n.printExpected(t.expected)),"Received: ".concat(n.printReceived(t.received))].join("\n")].join("\n\n")}}}var Qw={toEqualJsonLD:function(e,t){var r=this;return i(regeneratorRuntime.mark((function n(){var i;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,Dw(t,e);case 2:return i=n.sent,n.abrupt("return",Hw(i,{context:r,hint:"toEqualJsonLD",expected:t,received:e}));case 4:case"end":return n.stop()}}),n)})))()},toEqualSparql:function(e,t){return Hw(Uw(t,e),{context:this,hint:"toEqualSparql",expected:Xb(t),received:Xb(e)})}};var Vw=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200;o(this,e),u(this,"rawBody",void 0),u(this,"body",void 0),u(this,"bodyUsed",void 0),u(this,"headers",void 0),u(this,"ok",void 0),u(this,"redirected",void 0),u(this,"status",void 0),u(this,"statusText",void 0),u(this,"trailer",void 0),u(this,"type",void 0),u(this,"url",void 0),this.rawBody=t,this.headers=new Headers(r),this.status=n}var t,n,a,c,l;return s(e,[{key:"arrayBuffer",value:(l=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("ResponseStub.arrayBuffer is not implemented");case 1:case"end":return e.stop()}}),e)}))),function(){return l.apply(this,arguments)})},{key:"blob",value:(c=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("ResponseStub.blob is not implemented");case 1:case"end":return e.stop()}}),e)}))),function(){return c.apply(this,arguments)})},{key:"formData",value:(a=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("ResponseStub.formData is not implemented");case 1:case"end":return e.stop()}}),e)}))),function(){return a.apply(this,arguments)})},{key:"json",value:(n=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",JSON.parse(this.rawBody));case 1:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"text",value:(t=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.rawBody);case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"clone",value:function(){return r({},this)}}]),e}();e.MalformedSolidDocumentError=wb,e.NetworkRequestError=xb,e.NotFoundError=_b,e.ResponseStub=Vw,e.SolidDocument=Ub,e.SolidStore=Ob,e.SolidThing=Eb,e.UnauthorizedError=jb,e.UnsuccessfulNetworkRequestError=Sb,e.UnsupportedAuthorizationProtocolError=Ib,e.compactJsonLDGraph=function(e){return Fb.apply(this,arguments)},e.createPrivateTypeIndex=function(e,t){return kw.apply(this,arguments)},e.createPublicTypeIndex=function(e,t){return Iw.apply(this,arguments)},e.createSolidDocument=$b,e.defineIRIPrefix=function(e,t){kb[e]=t},e.expandIRI=Rb,e.fetchLoginUserProfile=function(e){return gw.apply(this,arguments)},e.fetchSolidDocument=Hb,e.fetchSolidDocumentACL=function(e,t){return $w.apply(this,arguments)},e.fetchSolidDocumentIfFound=Vb,e.findContainerRegistrations=function(e,t,r){return Rw.apply(this,arguments)},e.findInstanceRegistrations=function(e,t,r){return Ew.apply(this,arguments)},e.installChaiPlugin=function(){chai.use((function(e){return Object.entries(Gw).forEach((function(t){var r=v(t,2),n=r[0],i=r[1];return e.Assertion.addMethod(n,i)}))}))},e.installJestPlugin=function(){expect.extend(Qw)},e.isJsonLDGraph=Bb,e.jsonldEquals=Dw,e.jsonldToQuads=Yb,e.mintJsonLDIdentifiers=function(e){return yb(Cm(e),(function(e){return mw(e)}))},e.mockFetch=function(){var e=[],t={mockResponse:function(t,r,n){e.push(new Vw(t,r,n))},mockNotFoundResponse:function(){e.push(new Vw("",{},404))}},r=jest.fn(i(regeneratorRuntime.mark((function t(){var r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",null!==(r=e.shift())&&void 0!==r?r:Xm("fetch mock called without response"));case 1:case"end":return t.stop()}}),t)}))));return Object.assign(r,t),r},e.normalizeSparql=Xb,e.parseResourceSubject=function(e){var t=ub(e);return t?Mm({containerUrl:yw(t),documentName:t.path?t.path.split("/").pop():null,resourceHash:t.fragment}):{}},e.parseTurtle=Zb,e.quadToTurtle=rw,e.quadsToJsonLD=function(e){return ew.apply(this,arguments)},e.quadsToTurtle=tw,e.solidDocumentExists=nw,e.sparqlEquals=Uw,e.sparqlToQuads=function(e){return ow.apply(this,arguments)},e.sparqlToQuadsSync=aw,e.turtleEquals=Fw,e.turtleToQuads=sw,e.turtleToQuadsSync=cw,e.updateSolidDocument=lw,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
89
|
+
t.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,c=u>>1,l=-7,f=r?i-1:0,h=r?-1:1,d=e[t+f];for(f+=h,o=d&(1<<-l)-1,d>>=-l,l+=s;l>0;o=256*o+e[t+f],f+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+e[t+f],f+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=c}return(d?-1:1)*a*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,f=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(t*u-1)*Math.pow(2,i),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;e[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;e[r+d]=255&a,d+=p,a/=256,c-=8);e[r+d-p]|=128*v}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){r.r(t),r.d(t,"createBlankNode",(function(){return N})),r.d(t,"createQuad",(function(){return L})),r.d(t,"jsonLDFromRDF",(function(){return m.fromRDF})),r.d(t,"jsonLDToRDF",(function(){return m.toRDF})),r.d(t,"compactJsonLD",(function(){return m.compact})),r.d(t,"TurtleParser",(function(){return x})),r.d(t,"TurtleWriter",(function(){return A}));var n=r(0);function i(e){return!!e&&"DefaultGraph"===e.termType}const{rdf:o,xsd:a}=n.a;let s,u=0;const c={namedNode:function(e){return new h(e)},blankNode:function(e){return new p(e||"n3-"+u++)},variable:function(e){return new v(e)},literal:function(e,t){if("string"==typeof t)return new d(`"${e}"@${t.toLowerCase()}`);let r=t?t.value:"";return""===r&&("boolean"==typeof e?r=a.boolean:"number"==typeof e&&(Number.isFinite(e)?r=Number.isInteger(e)?a.integer:a.double:(r=a.double,Number.isNaN(e)||(e=e>0?"INF":"-INF")))),""===r||r===a.string?new d(`"${e}"`):new d(`"${e}"^^${r}`)},defaultGraph:function(){return s},quad:y,triple:y};var l=c;class f{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof f?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}toJSON(){return{termType:this.termType,value:this.value}}}class h extends f{get termType(){return"NamedNode"}}class d extends f{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const e=this.id;let t=e.lastIndexOf('"')+1;return t<e.length&&"@"===e[t++]?e.substr(t).toLowerCase():""}get datatype(){return new h(this.datatypeString)}get datatypeString(){const e=this.id,t=e.lastIndexOf('"')+1,r=t<e.length?e[t]:"";return"^"===r?e.substr(t+2):"@"!==r?a.string:o.langString}equals(e){return e instanceof d?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&this.datatype.value===e.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}}class p extends f{constructor(e){super("_:"+e)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}}class v extends f{constructor(e){super("?"+e)}get termType(){return"Variable"}get value(){return this.id.substr(1)}}s=new class extends f{constructor(){return super(""),s||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};class g extends f{constructor(e,t,r,n){super(""),this._subject=e,this._predicate=t,this._object=r,this._graph=n||s}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(e){return!!e&&this._subject.equals(e.subject)&&this._predicate.equals(e.predicate)&&this._object.equals(e.object)&&this._graph.equals(e.graph)}}function y(e,t,r,n){return new g(e,t,r,n)}var m=r(7),b=r(21);let w=0;class x{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&j(this,e.factory);const t="string"==typeof e.format?e.format.match(/\w*$/)[0].toLowerCase():"",r=/turtle/.test(t),n=/trig/.test(t),i=/triple/.test(t),o=/quad/.test(t),a=this._n3Mode=/n3/.test(t),s=i||o;(this._supportsNamedGraphs=!(r||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(r||n||i||a),this._supportsRDFStar=""===t||/star|\*$/.test(t),s&&(this._resolveRelativeIRI=e=>null),this._blankNodePrefix="string"!=typeof e.blankNodePrefix?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new b.a({lineMode:s,n3:a}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){w=0}_setBase(e){if(e){const t=e.indexOf("#");t>=0&&(e=e.substr(0,t)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}else this._base="",this._basePath=""}_saveContext(e,t,r,n,i){const o=this._n3Mode;this._contextStack.push({subject:r,predicate:n,object:i,graph:t,type:e,inverse:!!o&&this._inversePredicate,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?this._graph.id.substr(2)+".":".",this._quantified=Object.create(this._quantified))}_restoreContext(){const e=this._contextStack.pop(),t=this._n3Mode;this._subject=e.subject,this._predicate=e.predicate,this._object=e.object,this._graph=e.graph,t&&(this._inversePredicate=e.inverse,this._prefixes._=e.blankPrefix,this._quantified=e.quantified)}_readInTopContext(e){switch(e.type){case"eof":return null!==this._graph?this._error("Unclosed graph",e):(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(e)}}_readEntity(e,t){let r;switch(e.type){case"IRI":case"typeIRI":const t=this._resolveIRI(e.value);if(null===t)return this._error("Invalid IRI",e);r=this._namedNode(t);break;case"type":case"prefixed":const n=this._prefixes[e.prefix];if(void 0===n)return this._error(`Undefined prefix "${e.prefix}:"`,e);r=this._namedNode(n+e.value);break;case"blank":r=this._blankNode(this._prefixes[e.prefix]+e.value);break;case"var":r=this._variable(e.value.substr(1));break;default:return this._error("Expected entity but got "+e.type,e)}return!t&&this._n3Mode&&r.id in this._quantified&&(r=this._quantified[r.id]),r}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier=this._blankNode,this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier=this._variable,this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(0===e.prefix.length)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._literal(e.value,this._namedNode(e.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",e);default:if(void 0===(this._subject=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){const t=e.type;switch(t){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":return null===this._predicate?this._error("Unexpected "+t,e):(this._subject=null,"]"===t?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",e);case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if(void 0===(this._predicate=this._readEntity(e)))return}return this._readObject}_readObject(e){switch(e.type){case"literal":if(0===e.prefix.length)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._literal(e.value,this._namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",e);default:if(void 0===(this._object=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return"{"===e.type?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return"{"!==e.type?this._error("Expected graph but got "+e.type,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){return"]"===e.type?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if("]"!==e.type)return this._readBlankNodePunctuation(e);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const t=null===this._predicate;return this._restoreContext(),null===this._object?t?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank:this._getContextEndReader()}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let t=null,r=null,n=this._readListItem;const i=this._subject,o=this._contextStack,a=o[o.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,r=this._blankNode(),this.RDF_FIRST,this._subject=t=this._blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,r=this._blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext(),0!==o.length&&"list"===o[o.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(n=this._readPredicate,this._subject===this.RDF_NIL)return n}else if(n=this._getContextEndReader(),this._object===this.RDF_NIL)return n;r=this.RDF_NIL;break;case"literal":0===e.prefix.length?(this._literalValue=e.value,n=this._readListItemDataTypeOrLang):(t=this._literal(e.value,this._namedNode(e.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if(void 0===(t=this._readEntity(e)))return}if(null===r&&(this._subject=r=this._blankNode()),null===i?null===a.predicate?a.subject=r:a.object=r:this._emit(i,this.RDF_REST,r,this._graph),null!==t){if(this._n3Mode&&("IRI"===e.type||"prefixed"===e.type))return this._saveContext("item",this._graph,r,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(r,this.RDF_FIRST,t,this._graph)}return n}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let t=this._literal(this._literalValue);switch(e.type){case"type":case"typeIRI":const r=this._readEntity(e);if(void 0===r)return;t=this._literal(this._literalValue,r),e=null;break;case"langcode":t=this._literal(this._literalValue,e.value),e=null}return{token:e,literal:t}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,t){const r=this._completeLiteral(e);if(r)return this._object=r.literal,t&&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(e){return"}"!==e.type?this._readPunctuation(e):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext(),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let t,r=this._graph;const n=this._subject,i=this._inversePredicate;switch(e.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,i&&(this._inversePredicate=!1);break;case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(r=this._readEntity(e))){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(null!==n){const e=this._predicate,t=this._object;i?this._emit(t,e,n,r):this._emit(n,e,t,r)}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),t}_readQuadPunctuation(e){return"."!==e.type?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return"prefix"!==e.type?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if("IRI"!==e.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);const t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){const t="IRI"===e.type&&this._resolveIRI(e.value);return t?(this._setBase(t),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",e)}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return"]"!==e.type?this._error("Invalid graph label",e):(this._subject=this._blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):"."!==e.type?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let t;switch(e.type){case"IRI":case"prefixed":if(void 0!==(t=this._readEntity(e,!0)))break;default:return this._error("Unexpected "+e.type,e)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._quantifier(this._blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return","===e.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(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const t=this._contextStack,r=t.length&&t[t.length-1];if(r&&"item"===r.type){const e=this._subject;this._restoreContext(),this._emit(this._subject,this.RDF_FIRST,e,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let t,r;const n=this._blankNode();if(void 0!==(r=this._readEntity(e)))return null===this._predicate?(t=this._subject,this._subject=n):(t=this._object,this._object=n),this._emit(t,r,n,this._graph),this._readPath}_readBackwardPath(e){const t=this._blankNode();let r,n;if(void 0!==(r=this._readEntity(e)))return null===this._predicate?(n=this._subject,this._subject=t):(n=this._object,this._object=t),this._emit(t,r,n,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return">>"!==e.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(e))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e):this._readRDFStarTail(e)}_readRDFStarTail(e){if(">>"!==e.type)return this._error("Expected >> but got "+e.type,e);const t=this._quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext(),null===this._subject?(this._subject=t,this._readPredicate):(this._object=t,this._getContextEndReader())}_getContextEndReader(){const e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(e,t,r,n){this._callback(null,this._quad(e,t,r,n||this.DEFAULTGRAPH))}_error(e,t){const r=new Error(`${e} on line ${t.line}.`);r.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(r),this._callback=_}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return("/"===e[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;const t=e.length;let r="",n=-1,i=-1,o=0,a="/";for(;n<t;){switch(a){case":":if(i<0&&"/"===e[++n]&&"/"===e[++n])for(;(i=n+1)<t&&"/"!==e[i];)n=i;break;case"?":case"#":n=t;break;case"/":if("."===e[n+1])switch(a=e[1+ ++n],a){case"/":r+=e.substring(o,n-1),o=n+1;break;case void 0:case"?":case"#":return r+e.substring(o,n)+e.substr(n+1);case".":if(a=e[1+ ++n],void 0===a||"/"===a||"?"===a||"#"===a){if(r+=e.substring(o,n-2),(o=r.lastIndexOf("/"))>=i&&(r=r.substr(0,o)),"/"!==a)return`${r}/${e.substr(n+1)}`;o=n+1}}}a=e[++n]}return r+e.substring(o)}parse(e,t,r){if(this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${w++}_`,this._prefixCallback=r||_,this._inversePredicate=!1,this._quantified=Object.create(null),!t){const t=[];let r;if(this._callback=(e,n)=>{e?r=e:n&&t.push(n)},this._lexer.tokenize(e).every((e=>this._readCallback=this._readCallback(e))),r)throw r;return t}this._callback=t,this._lexer.tokenize(e,((e,t)=>{null!==e?(this._callback(e),this._callback=_):this._readCallback&&(this._readCallback=this._readCallback(t))}))}}function _(){}function j(e,t){const r=t.namedNode;e._namedNode=r,e._blankNode=t.blankNode,e._literal=t.literal,e._variable=t.variable,e._quad=t.quad,e.DEFAULTGRAPH=t.defaultGraph(),e.RDF_FIRST=r(n.a.rdf.first),e.RDF_REST=r(n.a.rdf.rest),e.RDF_NIL=r(n.a.rdf.nil),e.N3_FORALL=r(n.a.r.forAll),e.N3_FORSOME=r(n.a.r.forSome),e.ABBREVIATIONS={a:r(n.a.rdf.type),"=":r(n.a.owl.sameAs),">":r(n.a.log.implies)},e.QUANTIFIERS_GRAPH=r("urn:n3:quantifiers")}j(x.prototype,l);const S=l.defaultGraph(),{rdf:I,xsd:k}=n.a,R=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,E=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,O={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class T extends f{equals(){return!1}}class A{constructor(e,t){if(this._prefixRegex=/$0^/,e&&"function"!=typeof e.write&&(t=e,e=null),t=t||{},this._lists=t.lists,e)this._outputStream=e,this._endStream=void 0===t.end||!!t.end;else{let e="";this._outputStream={write(t,r,n){e+=t,n&&n()},end:t=>{t&&t(null,e)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=S,this._baseIRI=t.baseIRI,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes))}get _inDefaultGraph(){return S.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t)}_writeQuad(e,t,r,n,i){try{n.equals(this._graph)||(this._write((null===this._subject?"":this._inDefaultGraph?".\n":"\n}\n")+(S.equals(n)?"":this._encodeIriOrBlank(n)+" {\n")),this._graph=n,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(", "+this._encodeObject(r),i):this._write(`;\n ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,i):this._write(`${(null===this._subject?"":".\n")+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,i)}catch(e){i&&i(e)}}_writeQuadLine(e,t,r,n,i){delete this._prefixMatch,this._write(this.quadToString(e,t,r,n),i)}quadToString(e,t,r,n){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(r)}${n&&n.value?` ${this._encodeIriOrBlank(n)} .\n`:" .\n"}`}quadsToString(e){return e.map((e=>this.quadToString(e.subject,e.predicate,e.object,e.graph))).join("")}_encodeSubject(e){return"Quad"===e.termType?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if("NamedNode"!==e.termType)return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:"_:"+e.value;let t=e.value;this._baseIRI&&t.startsWith(this._baseIRI)&&(t=t.substr(this._baseIRI.length)),R.test(t)&&(t=t.replace(E,P));const r=this._prefixRegex.exec(t);return r?r[1]?this._prefixIRIs[r[1]]+r[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(R.test(t)&&(t=t.replace(E,P)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===k.string)return`"${t}"`}else switch(e.datatype.value){case k.string:return`"${t}"`;case k.boolean:if("true"===t||"false"===t)return t;break;case k.integer:if(/^[+-]?\d+$/.test(t))return t;break;case k.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case k.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===I.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:t,object:r,graph:n}){return`<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(r)}${i(n)?"":" "+this._encodeIriOrBlank(n)}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,r,n,i){void 0===r?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):"function"==typeof n?this._writeQuad(e,t,r,S,n):this._writeQuad(e,t,r,n||S,i)}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}addPrefix(e,t,r){const n={};n[e]=t,this.addPrefixes(n,r)}addPrefixes(e,t){if(!this._prefixIRIs)return t&&t();let r=!1;for(let t in e){let n=e[t];"string"!=typeof n&&(n=n.value),r=!0,null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null,this._graph=""),this._prefixIRIs[n]=t+=":",this._write(`@prefix ${t} <${n}>.\n`)}if(r){let e="",t="";for(const r in this._prefixIRIs)e+=e?"|"+r:r,t+=(t?"|":"")+this._prefixIRIs[r];e=e.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&"),this._prefixRegex=new RegExp(`^(?:${t})[^/]*$|^(${e})([a-zA-Z][\\-_a-zA-Z0-9]*)$`)}this._write(r?"\n":"",t)}blank(e,t){let r,n,i=e;switch(void 0===e?i=[]:e.termType?i=[{predicate:e,object:t}]:"length"in e||(i=[e]),n=i.length){case 0:return new T("[]");case 1:if(r=i[0],!(r.object instanceof T))return new T(`[ ${this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)} ]`);default:let t="[";for(let o=0;o<n;o++)r=i[o],r.predicate.equals(e)?t+=", "+this._encodeObject(r.object):(t+=`${(o?";\n ":"\n ")+this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)}`,e=r.predicate);return new T(t+"\n]")}}list(e){const t=e&&e.length||0,r=new Array(t);for(let n=0;n<t;n++)r[n]=this._encodeObject(e[n]);return new T(`(${r.join(" ")})`)}end(e){null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null),this._write=this._blockedWrite;let t=e&&((r,n)=>{t=null,e(r,n)});if(this._endStream)try{return this._outputStream.end(t)}catch(e){}t&&t()}}function P(e){let t=O[e];return void 0===t&&(1===e.length?(t=e.charCodeAt(0).toString(16),t="\\u0000".substr(0,6-t.length)+t):(t=(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)+9216).toString(16),t="\\U00000000".substr(0,10-t.length)+t)),t}function N(e){return new p(e)}function L(e,t,r,n){return new g(e,t,r,n)}}])}));e.SolidDocumentPermission=void 0,(Cb=e.SolidDocumentPermission||(e.SolidDocumentPermission={})).Read="read",Cb.Write="write",Cb.Append="append",Cb.Control="control";var Ub=function(t){c(n,t);var r=p(n);function n(e,t,i){var a;return o(this,n),u(h(a=r.call(this,t)),"url",void 0),u(h(a),"headers",void 0),a.url=e,a.headers=i,a}return s(n,[{key:"isACPResource",value:function(){var e;return!(null===(e=this.headers.get("Link"))||void 0===e||!e.match(/<http:\/\/www\.w3\.org\/ns\/solid\/acp#AccessControlResource>;[^,]+rel="type"/))}},{key:"isPersonalProfile",value:function(){return!!this.statement(this.url,Rb("rdf:type"),Rb("foaf:PersonalProfileDocument"))}},{key:"isStorage",value:function(){var e;return!(null===(e=this.headers.get("Link"))||void 0===e||!e.match(/<http:\/\/www\.w3\.org\/ns\/pim\/space#Storage>;[^,]+rel="type"/))}},{key:"isUserWritable",value:function(){return this.getUserPermissions().includes(e.SolidDocumentPermission.Write)}},{key:"getUserPermissions",value:function(){return this.getPermissionsFromWAC("user")}},{key:"getPublicPermissions",value:function(){return this.getPermissionsFromWAC("public")}},{key:"getLastModified",value:function(){var e,t,r,n;return null!==(e=null!==(t=null!==(r=Km(this.headers.get("last-modified")))&&void 0!==r?r:Km(null===(n=this.statement(this.url,"purl:modified"))||void 0===n?void 0:n.object.value))&&void 0!==t?t:this.getLatestDocumentDate())&&void 0!==e?e:null}},{key:"expandIRI",value:function(e){return Rb(e,{defaultPrefix:this.url})}},{key:"getLatestDocumentDate",value:function(){var e=[].concat(g(this.statements(void 0,"purl:modified")),g(this.statements(void 0,"purl:created"))).map((function(e){return Km(e.object.value)})).filter((function(e){return null!==e}));return e.length>0?e.reduce((function(e,t){return e>t?e:t})):null}},{key:"getPermissionsFromWAC",value:function(t){var r,n,i,o,a,s=null!==(r=this.headers.get("WAC-Allow"))&&void 0!==r?r:"",u=null!==(n=null===(o=s,a=new RegExp("".concat(t,'="([^"]+)"')),i=o.match(a))||void 0===i?void 0:i[1])&&void 0!==n?n:"";return Gm([u.includes("read")&&e.SolidDocumentPermission.Read,u.includes("write")&&e.SolidDocumentPermission.Write,u.includes("append")&&e.SolidDocumentPermission.Append,u.includes("control")&&e.SolidDocumentPermission.Control])}}]),n}(Ob);function Fb(){return(Fb=i(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Mb.compactJsonLD(t,{});case 2:if(!("@graph"in(r=e.sent))){e.next=5;break}return e.abrupt("return",r);case 5:if(!("@id"in r)){e.next=7;break}return e.abrupt("return",{"@graph":[r]});case 7:return e.abrupt("return",{"@graph":[]});case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Bb(e){return"@graph"in e}var qb="anonymous://",zb=qb.length;function Jb(e,t){return $b.apply(this,arguments)}function $b(){return($b=i(regeneratorRuntime.mark((function e(t,r){var n,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={headers:{Accept:"text/turtle"}},e.prev=1,e.next=4,r(t,n);case 4:if(404!==(i=e.sent).status){e.next=7;break}throw new _b(t);case 7:if(![401,403].includes(i.status)){e.next=9;break}throw new jb(t,i.status);case 9:return e.next=11,i.text();case 11:return o=e.sent,e.abrupt("return",{body:o,headers:i.headers});case 15:if(e.prev=15,e.t0=e.catch(1),!(e.t0 instanceof jb)){e.next=19;break}throw e.t0;case 19:if(!(e.t0 instanceof _b)){e.next=21;break}throw e.t0;case 21:throw new xb(t,{cause:e.t0});case 22:case"end":return e.stop()}}),e,null,[[1,15]])})))).apply(this,arguments)}function Gb(e){var t,r=e.slice(0),n={},i=mb(e).flatMap((function(e,t){return yb(Gm(["BlankNode"===e.object.termType?e.object.value:null,"BlankNode"===e.subject.termType?e.subject.value:null]),(function(e){return e.forEach((function(e){var r;return(null!==(r=n[e])&&void 0!==r?r:n[e]=new Set).add(t)}))}))})).filter().unique(),o=b(i);try{var a=function(){var i,o=t.value,a=n[o],s=Db(mb(a).map((function(t){return e[t]})).filter((function(e){var t=e.subject,r=t.termType,n=t.value;return"BlankNode"===r&&n===o})).map((function(e){var t=e.predicate,r=e.object;return"BlankNode"===r.termType?t.value:t.value+r.value})).sorted().join()),u=b(a);try{for(u.s();!(i=u.n()).done;){for(var c=i.value,l=r[c],f={subject:l.subject,object:l.object},h=0,d=Object.entries(f);h<d.length;h++){var p=v(d[h],2),g=p[0],y=p[1];"BlankNode"===y.termType&&y.value===o&&(f[g]=Mb.createBlankNode(s))}Qm(r,l,Mb.createQuad(f.subject,l.predicate,f.object))}}catch(e){u.e(e)}finally{u.f()}};for(o.s();!(t=o.n()).done;)a()}catch(e){o.e(e)}finally{o.f()}return r}function Hb(e){return e.map((function(e){return" "+uw(e)})).sort().join("\n")}function Qb(e){var t;null!==(t=e["@id"])&&void 0!==t&&t.startsWith("#")&&(e["@id"]=qb+e["@id"])}function Vb(e){var t,r=b(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;n.subject.value.startsWith(qb)&&(n.subject.value=n.subject.value.slice(zb))}}catch(e){r.e(e)}finally{r.f()}}function Wb(e,t,r){return Yb.apply(this,arguments)}function Yb(){return(Yb=i(regeneratorRuntime.mark((function e(t,r,n){var i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null!==(i=n)&&void 0!==i?i:window.fetch.bind(window),e.next=3,dw(r);case 3:return o=e.sent,e.next=6,n(t,{method:"PUT",headers:{"Content-Type":"text/turtle"},body:r});case 6:return e.abrupt("return",new Ub(t,o,new Headers({})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Kb(e,t){return Xb.apply(this,arguments)}function Xb(){return Xb=i(regeneratorRuntime.mark((function e(t,r){var n,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Jb(t,null!=r?r:window.fetch);case 2:return n=e.sent,i=n.body,o=n.headers,e.next=7,dw(i,{baseIRI:t});case 7:return a=e.sent,e.abrupt("return",new Ub(t,a,o));case 9:case"end":return e.stop()}}),e)}))),Xb.apply(this,arguments)}function Zb(e,t){return ew.apply(this,arguments)}function ew(){return(ew=i(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Kb(t,r);case 3:return n=e.sent,e.abrupt("return",n);case 7:if(e.prev=7,e.t0=e.catch(0),e.t0 instanceof _b){e.next=11;break}throw e.t0;case 11:return e.abrupt("return",null);case 12:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function tw(e,t){return rw.apply(this,arguments)}function rw(){return(rw=i(regeneratorRuntime.mark((function e(t,r){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Bb(t)){e.next=5;break}return e.next=3,Promise.all(t["@graph"].map((function(e){return tw(e,r)})));case 3:return n=e.sent,e.abrupt("return",n.flat());case 5:return Qb(t),e.next=8,Mb.jsonLDToRDF(t,{base:r});case 8:return Vb(i=e.sent),e.abrupt("return",i);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function nw(e){var t=hw(e);return Object.entries(t).reduce((function(e,t){var r=v(t,2),n=r[0],i=Hb(r[1]);return e.concat("".concat(n.toUpperCase()," DATA {\n").concat(i,"\n}"))}),[]).join(" ;\n")}function iw(e){return Hb(vw(e))}function ow(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Mm({baseIRI:r.baseIRI}),i=new Mb.TurtleParser(n),o={quads:[],containsRelativeIRIs:!1};return new Promise((function(n,a){var s=i._resolveRelativeIRI;i._resolveRelativeIRI=function(){return o.containsRelativeIRIs=!0,i._resolveRelativeIRI=s,i._resolveRelativeIRI.apply(i,arguments)},i.parse(t,(function(t,i){var s;t?a(new wb(null!==(s=r.baseIRI)&&void 0!==s?s:null,e.SolidDocumentFormat.Turtle,t.message)):i?o.quads.push(i):n(o)}))}))}function aw(){return(aw=i(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Mb.jsonLDFromRDF(t);case 2:return r=e.sent,e.abrupt("return",{"@graph":r});case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function sw(e){return(new Mb.TurtleWriter).quadsToString(e)}function uw(e){return(new Mb.TurtleWriter).quadsToString([e]).slice(0,-1)}function cw(e,t){return lw.apply(this,arguments)}function lw(){return(lw=i(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Kb(t,r);case 3:return n=e.sent,e.abrupt("return",!n.isEmpty());case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function fw(){return fw=i(regeneratorRuntime.mark((function e(t){var r,n,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:{},n=rb(t,/(\w+) DATA {([^}]+)}/g),o={},e.next=5,Promise.all(g(n).map(function(){var e=i(regeneratorRuntime.mark((function e(t){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t[1].toLowerCase(),i=t[2],e.next=4,dw(i,r);case 4:o[n]=e.sent;case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 5:return e.abrupt("return",o);case 6:case"end":return e.stop()}}),e)}))),fw.apply(this,arguments)}function hw(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=rb(e,/(\w+) DATA {([^}]+)}/g),i={},o=b(n);try{for(o.s();!(t=o.n()).done;){var a=t.value,s=a[1].toLowerCase(),u=a[2];i[s]=vw(u,r)}}catch(e){o.e(e)}finally{o.f()}return i}function dw(e){return pw.apply(this,arguments)}function pw(){return pw=i(regeneratorRuntime.mark((function e(t){var r,n,i,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.length>1&&void 0!==o[1]?o[1]:{},e.next=3,ow(t,r);case 3:return n=e.sent,i=n.quads,e.abrupt("return",i);case 6:case"end":return e.stop()}}),e)}))),pw.apply(this,arguments)}function vw(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Mm({baseIRI:r.baseIRI}),i=new Mb.TurtleParser(n);try{var o=i.parse(t);return r.normalizeBlankNodes?Gb(o):o}catch(t){var a,s;throw new wb(null!==(a=r.baseIRI)&&void 0!==a?a:null,e.SolidDocumentFormat.Turtle,null!==(s=t.message)&&void 0!==s?s:"")}}function gw(e,t,r){return yw.apply(this,arguments)}function yw(){return(yw=i(regeneratorRuntime.mark((function e(t,r,n){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null!==(i=n)&&void 0!==i?i:window.fetch.bind(window),e.next=3,n(t,{method:"PATCH",headers:{"Content-Type":"application/sparql-update"},body:r});case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mw(e,t){return bw.apply(this,arguments)}function bw(){return bw=i(regeneratorRuntime.mark((function e(t,r){var n,o,a,s,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=new Ob(t.getQuads()),s=u({},t.url,t),c=function(e){e.statements(void 0,"foaf:isPrimaryTopicOf").map((function(e){return e.object.value})).forEach((function(e){var t;return s[e]=null!==(t=s[e])&&void 0!==t?t:null})),e.statements(void 0,"foaf:primaryTopic").map((function(e){return e.subject.value})).forEach((function(e){var t;return s[e]=null!==(t=s[e])&&void 0!==t?t:null}))},l=function(){var e=i(regeneratorRuntime.mark((function e(){var t,n,i,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=0,n=Object.entries(s);case 1:if(!(t<n.length)){e.next=23;break}if(i=v(n[t],2),o=i[0],null===i[1]){e.next=5;break}return e.abrupt("continue",20);case 5:return e.prev=5,e.next=8,Kb(o,r);case 8:u=e.sent,s[o]=u,a.addQuads(u.getQuads()),c(u),e.next=20;break;case 14:if(e.prev=14,e.t0=e.catch(5),!(e.t0 instanceof jb)){e.next=19;break}return s[o]=!1,e.abrupt("continue",20);case 19:throw e.t0;case 20:t++,e.next=1;break;case 23:case"end":return e.stop()}}),e,null,[[5,14]])})));return function(){return e.apply(this,arguments)}}(),c(t);case 5:return e.next=7,l();case 7:if(Object.values(s).some((function(e){return null===e}))){e.next=5;break}case 8:return e.abrupt("return",{store:a,cloaked:Object.values(s).some((function(e){return!1===e})),writableProfileUrl:t.isUserWritable()?t.url:null!==(n=null===(o=Object.values(s).find((function(e){return!!e&&e.isUserWritable()})))||void 0===o?void 0:o.url)&&void 0!==n?n:null});case 9:case"end":return e.stop()}}),e)}))),bw.apply(this,arguments)}function ww(e,t){return xw.apply(this,arguments)}function xw(){return xw=i(regeneratorRuntime.mark((function e(t,n){var i,o,a,s,u,c,l,f,h,d,p,v,g,y,m,b,w,x;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f=cb(t),e.next=3,Kb(f,n);case 3:if((h=e.sent).isPersonalProfile()||h.contains(t,"solid:oidcIssuer")){e.next=6;break}throw new Error("".concat(t," is not a valid webId."));case 6:return e.next=8,mw(h,n);case 8:d=e.sent,p=d.store,v=d.writableProfileUrl,g=d.cloaked,y=p.statements(t,"pim:storage").map((function(e){return e.object.value})),m=p.statement(t,"solid:publicTypeIndex"),b=p.statement(t,"solid:privateTypeIndex"),w=sb(f);case 16:if(!w||0!==y.length){e.next=26;break}return e.next=19,tb(Kb(w,n));case 19:if(null==(x=e.sent)||!x.isStorage()){e.next=23;break}return y.push(w),e.abrupt("break",26);case 23:w=sb(w),e.next=16;break;case 26:if(0!==y.length){e.next=28;break}throw new Error("Could not find any storage for ".concat(t,"."));case 28:return e.abrupt("return",r({webId:t,cloaked:g,writableProfileUrl:v,storageUrls:Vm(y)},Mm({name:null!==(i=null===(o=p.statement(t,"vcard:fn"))||void 0===o?void 0:o.object.value)&&void 0!==i?i:null===(a=p.statement(t,"foaf:name"))||void 0===a?void 0:a.object.value,avatarUrl:null!==(s=null===(u=p.statement(t,"vcard:hasPhoto"))||void 0===u?void 0:u.object.value)&&void 0!==s?s:null===(c=p.statement(t,"foaf:img"))||void 0===c?void 0:c.object.value,oidcIssuerUrl:null===(l=p.statement(t,"solid:oidcIssuer"))||void 0===l?void 0:l.object.value,publicTypeIndexUrl:null==m?void 0:m.object.value,privateTypeIndexUrl:null==b?void 0:b.object.value})));case 29:case"end":return e.stop()}}),e)}))),xw.apply(this,arguments)}function _w(){return _w=i(regeneratorRuntime.mark((function e(t){var r,n,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=a.length>1&&void 0!==a[1]?a[1]:{}).required){e.next=3;break}return e.abrupt("return",ww(t,i.fetch));case 3:return o=tb((function(e){return ww(e,i.fetch)})),e.next=6,o(t);case 6:if(e.t2=n=e.sent,e.t1=null!==e.t2,!e.t1){e.next=10;break}e.t1=void 0!==n;case 10:if(!e.t1){e.next=14;break}e.t3=n,e.next=17;break;case 14:return e.next=16,o(t.replace(/\/$/,"").concat("/profile/card#me"));case 16:e.t3=e.sent;case 17:if(e.t4=r=e.t3,e.t0=null!==e.t4,!e.t0){e.next=21;break}e.t0=void 0!==r;case 21:if(!e.t0){e.next=25;break}e.t5=r,e.next=28;break;case 25:return e.next=27,o(ab(t).concat("/profile/card#me"));case 27:e.t5=e.sent;case 28:return e.abrupt("return",e.t5);case 29:case"end":return e.stop()}}),e)}))),_w.apply(this,arguments)}function jw(e){var t=function(e){return e.path&&e.path.startsWith("/")?e.path.match(/^\/[^/]*$/)?"/":"/".concat(mb(e.path.split("/")).filter().slice(0,-1).join("/"),"/").replace("//","/"):null}(e);return e.protocol&&e.domain?"".concat(e.protocol,"://").concat(e.domain).concat(null!=t?t:"/"):t}function Sw(e){var t;if("@type"in e&&!("@value"in e)){e["@id"]=null!==(t=e["@id"])&&void 0!==t?t:eb();for(var r=0,n=Object.values(e);r<n.length;r++){var i=n[r];Nm(i)&&Sw(i),Am(i)&&i.forEach((function(e){return Nm(e)&&Sw(e)}))}}}function Iw(e,t,r){return kw.apply(this,arguments)}function kw(){return(kw=i(regeneratorRuntime.mark((function e(t,r,n){var i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null!==(i=n)&&void 0!==i?i:window.fetch.bind(n),o=t.storageUrls[0],a="".concat(o,"settings/").concat(r,"TypeIndex"),e.next=5,cw(a,n);case 5:if(!e.sent){e.next=9;break}e.t0="".concat(o,"settings/").concat(r,"TypeIndex-").concat(eb()),e.next=10;break;case 9:e.t0=a;case 10:return e.abrupt("return",e.t0);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Rw(e,t,r){return Ew.apply(this,arguments)}function Ew(){return(Ew=i(regeneratorRuntime.mark((function e(t,r,n){var i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==t.writableProfileUrl){e.next=2;break}throw new Error("Can't create type index without a writable profile document");case 2:return n=null!==(i=n)&&void 0!==i?i:window.fetch.bind(n),e.next=5,Iw(t,r,n);case 5:return o=e.sent,a="public"===r?"<> a <http://www.w3.org/ns/solid/terms#TypeIndex> .":"\n <> a\n <http://www.w3.org/ns/solid/terms#TypeIndex>,\n <http://www.w3.org/ns/solid/terms#UnlistedDocument> .\n ",s="\n INSERT DATA {\n <".concat(t.webId,"> <http://www.w3.org/ns/solid/terms#").concat(r,"TypeIndex> <").concat(o,"> .\n }\n "),e.next=10,Wb(o,a,n);case 10:return e.next=12,gw(t.writableProfileUrl,s,n);case 12:return e.abrupt("return",o);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ow(e,t,r,n){return Tw.apply(this,arguments)}function Tw(){return(Tw=i(regeneratorRuntime.mark((function e(t,r,n,i){var o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Kb(t,i);case 2:return o=e.sent,a=Array.isArray(r)?r:[r],e.abrupt("return",a.map((function(e){return o.statements(void 0,"rdf:type","solid:TypeRegistration").filter((function(t){return o.contains(t.subject.value,"solid:forClass",e)})).map((function(e){return o.statements(e.subject.value,n)})).flat().map((function(e){return e.object.value})).filter((function(e){return!!e}))})).flat());case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Aw(){return(Aw=i(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Rw(t,"public",r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pw(){return(Pw=i(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Rw(t,"private",r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Nw(){return(Nw=i(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Ow(t,r,"solid:instanceContainer",n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Lw(){return(Lw=i(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Ow(t,r,"solid:instance",n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Cw={},Dw={"%uuid%":"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},Mw=function(e){c(ExpectedQuadAssertionError,e);var t=p(ExpectedQuadAssertionError);function ExpectedQuadAssertionError(e){var r;return o(this,ExpectedQuadAssertionError),u(h(r=t.call(this,"Couldn't find the following triple: ".concat(uw(e)))),"expectedQuad",void 0),r.expectedQuad=e,r}return ExpectedQuadAssertionError}(Rm);function Uw(e,t){var r,n=b(e);try{var i=function(){var e=r.value,n=t.find((function(t){return n=t,function(e,t){if(e.termType!==t.termType)return!1;if("Literal"===e.termType&&"Literal"===t.termType){if(e.datatype.value!==t.datatype.value)return!1;if(!Fw(e.value))return"http://www.w3.org/2001/XMLSchema#dateTime"===e.datatype.value?new Date(e.value).getTime()===new Date(t.value).getTime():e.value===t.value}return Bw(e.value,t.value)}((r=e).object,n.object)&&Bw(r.subject.value,n.subject.value)&&Bw(r.predicate.value,n.predicate.value);var r,n}));if(!n)throw new Mw(e);Hm(t,n)};for(n.s();!(r=n.n()).done;)i()}catch(e){n.e(e)}finally{n.f()}}function Fw(e){return/\[\[(.*\]\[)?([^\]]+)\]\]/.test(e)}function Bw(e,t){var r,n;return Fw(e)?(null!==(n=(r=Cw)[e])&&void 0!==n?n:r[e]=function(e){var t,r=[],n=[],i=e,o=b(rb(e,/\[\[((.*?)\]\[)?([^\]]+)\]\]/g));try{for(o.s();!(t=o.n()).done;){var a=t.value;a[2]&&r.push(a[2]),n.push(a[3]),i=i.replace(a[0],"%PATTERN".concat(n.length-1,"%"))}}catch(e){o.e(e)}finally{o.f()}i=i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");for(var s=0,u=Object.entries(n);s<u.length;s++){var c,l=v(u[s],2),f=l[0],h=l[1];i=i.replace("%PATTERN".concat(f,"%"),null!==(c=Dw[h])&&void 0!==c?c:h)}return new RegExp(i)}(e)).test(t):e===t}function qw(){Cw={}}function zw(e,t){return Jw.apply(this,arguments)}function Jw(){return(Jw=i(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return qw(),e.next=3,tw(t);case 3:return n=e.sent,e.next=6,tw(r);case 6:if(i=e.sent,o=sw(n),a=sw(i),s=function(e,t){return{success:e,message:t,expected:o,actual:a}},n.length===i.length){e.next=12;break}return e.abrupt("return",s(!1,"Expected ".concat(n.length," triples, found ").concat(i.length,".")));case 12:e.prev=12,Uw(n,i),e.next=21;break;case 16:if(e.prev=16,e.t0=e.catch(12),e.t0 instanceof Mw){e.next=20;break}throw e.t0;case 20:return e.abrupt("return",s(!1,e.t0.message));case 21:return e.abrupt("return",s(!0,"jsonld matches"));case 22:case"end":return e.stop()}}),e,null,[[12,16]])})))).apply(this,arguments)}function $w(e,t){var r;qw();for(var n=hw(e,{normalizeBlankNodes:!0}),i=hw(t,{normalizeBlankNodes:!0}),o=function(r,n){return{success:r,message:n,expected:e,actual:t}},a=0,s=Object.keys(n);a<s.length;a++){var u=s[a];if(!(u in i))return o(!1,"Couldn't find expected ".concat(u," operation."));var c=bb(n,u),l=bb(i,u);if(c.length!==l.length)return o(!1,"Expected ".concat(c.length," ").concat(u," triples, found ").concat(l.length,"."));try{Uw(c,l)}catch(e){if(!(e instanceof Mw))throw e;return o(!1,"Couldn't find the following ".concat(u," triple: ").concat(uw(e.expectedQuad)))}}var f=null!==(r=Object.keys(i)[0])&&void 0!==r?r:null;return f?o(!1,"Did not expect to find ".concat(f," triples.")):o(!0,"sparql matches")}function Gw(e,t){qw();var r=vw(e,{normalizeBlankNodes:!0}),n=vw(t,{normalizeBlankNodes:!0}),i=function(r,n){return{success:r,message:n,expected:e,actual:t}};if(r.length!==n.length)return i(!1,"Expected ".concat(r.length," triples, found ").concat(n.length,"."));try{Uw(r,n)}catch(e){if(!(e instanceof Mw))throw e;return i(!1,e.message)}return i(!0,"turtle matches")}function Hw(e,t){return Qw.apply(this,arguments)}function Qw(){return(Qw=i(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=null!==(n=r)&&void 0!==n?n:window.fetch.bind(window),e.next=3,r(t,{method:"HEAD"});case 3:if(s=e.sent,u=null!==(i=s.headers.get("Link"))&&void 0!==i?i:"",c=null!==(o=null===(a=u.match(/<([^>]+)>;\s*rel="acl"/))||void 0===a?void 0:a[1])&&void 0!==o?o:null){e.next=8;break}throw new Error("Could not find ACL Resource for '".concat(t,"'"));case 8:return e.abrupt("return",ob(ib(t),c));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Vw(e,t,r){return Ww.apply(this,arguments)}function Ww(){return(Ww=i(regeneratorRuntime.mark((function e(t,r,n){var i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(i=n)||void 0===i){e.next=4;break}e.t0=i,e.next=7;break;case 4:return e.next=6,Hw(t,r);case 6:e.t0=e.sent;case 7:return n=e.t0,e.next=10,Zb(null!==(o=n)&&void 0!==o?o:"",r);case 10:if(a=e.sent){e.next=13;break}return e.abrupt("return",Vw(ib(t),r));case 13:if(!a.isACPResource()){e.next=15;break}throw new Ib(t,"ACP");case 15:return e.abrupt("return",a);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Yw(){return(Yw=i(regeneratorRuntime.mark((function e(t,r){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Hw(t,r);case 2:return n=e.sent,e.next=5,Vw(t,r,n);case 5:return i=e.sent,e.abrupt("return",Mm({url:n,effectiveUrl:i.url,document:i}));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Kw={turtle:function(e){var t=this._obj,r=this.assert.bind(this),n=Gw(e,t);r(n.success,n.message,"",n.expected,n.actual)},sparql:function(e){var t=this._obj,r=this.assert.bind(this),n=$w(e,t);r(n.success,n.message,"",n.expected,n.actual)}};function Xw(e,t){var r=e.success,n=t.context.utils;return{pass:r,message:r?function(){return[e.message,n.matcherHint(t.hint)].join("\n\n")}:function(){return[e.message,n.matcherHint(t.hint),["Expected: not ".concat(n.printExpected(t.expected)),"Received: ".concat(n.printReceived(t.received))].join("\n")].join("\n\n")}}}var Zw={toEqualJsonLD:function(e,t){var r=this;return i(regeneratorRuntime.mark((function n(){var i;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,zw(t,e);case 2:return i=n.sent,n.abrupt("return",Xw(i,{context:r,hint:"toEqualJsonLD",expected:t,received:e}));case 4:case"end":return n.stop()}}),n)})))()},toEqualSparql:function(e,t){return Xw($w(t,e),{context:this,hint:"toEqualSparql",expected:nw(t),received:nw(e)})},toEqualTurtle:function(e,t){return Xw(Gw(t,e),{context:this,hint:"toEqualTurtle",expected:iw(t),received:iw(e)})}};var ex=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200;o(this,e),u(this,"rawBody",void 0),u(this,"body",void 0),u(this,"bodyUsed",void 0),u(this,"headers",void 0),u(this,"ok",void 0),u(this,"redirected",void 0),u(this,"status",void 0),u(this,"statusText",void 0),u(this,"trailer",void 0),u(this,"type",void 0),u(this,"url",void 0),this.rawBody=t,this.headers=new Headers(r),this.status=n}var t,n,a,c,l;return s(e,[{key:"arrayBuffer",value:(l=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("ResponseStub.arrayBuffer is not implemented");case 1:case"end":return e.stop()}}),e)}))),function(){return l.apply(this,arguments)})},{key:"blob",value:(c=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("ResponseStub.blob is not implemented");case 1:case"end":return e.stop()}}),e)}))),function(){return c.apply(this,arguments)})},{key:"formData",value:(a=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("ResponseStub.formData is not implemented");case 1:case"end":return e.stop()}}),e)}))),function(){return a.apply(this,arguments)})},{key:"json",value:(n=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",JSON.parse(this.rawBody));case 1:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"text",value:(t=i(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.rawBody);case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"clone",value:function(){return r({},this)}}]),e}();e.MalformedSolidDocumentError=wb,e.NetworkRequestError=xb,e.NotFoundError=_b,e.ResponseStub=ex,e.SolidDocument=Ub,e.SolidStore=Ob,e.SolidThing=Eb,e.UnauthorizedError=jb,e.UnsuccessfulNetworkRequestError=Sb,e.UnsupportedAuthorizationProtocolError=Ib,e.compactJsonLDGraph=function(e){return Fb.apply(this,arguments)},e.createPrivateTypeIndex=function(e,t){return Pw.apply(this,arguments)},e.createPublicTypeIndex=function(e,t){return Aw.apply(this,arguments)},e.createSolidDocument=Wb,e.defineIRIPrefix=function(e,t){kb[e]=t},e.expandIRI=Rb,e.fetchLoginUserProfile=function(e){return _w.apply(this,arguments)},e.fetchSolidDocument=Kb,e.fetchSolidDocumentACL=function(e,t){return Yw.apply(this,arguments)},e.fetchSolidDocumentIfFound=Zb,e.findContainerRegistrations=function(e,t,r){return Nw.apply(this,arguments)},e.findInstanceRegistrations=function(e,t,r){return Lw.apply(this,arguments)},e.installChaiPlugin=function(){chai.use((function(e){return Object.entries(Kw).forEach((function(t){var r=v(t,2),n=r[0],i=r[1];return e.Assertion.addMethod(n,i)}))}))},e.installJestPlugin=function(){expect.extend(Zw)},e.isJsonLDGraph=Bb,e.jsonldEquals=zw,e.jsonldToQuads=tw,e.mintJsonLDIdentifiers=function(e){return yb(Cm(e),(function(e){return Sw(e)}))},e.mockFetch=function(){var e=[],t={mockResponse:function(t,r,n){e.push(new ex(t,r,n))},mockNotFoundResponse:function(){e.push(new ex("",{},404))}},r=jest.fn(i(regeneratorRuntime.mark((function t(){var r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",null!==(r=e.shift())&&void 0!==r?r:Xm("fetch mock called without response"));case 1:case"end":return t.stop()}}),t)}))));return Object.assign(r,t),r},e.normalizeSparql=nw,e.normalizeTurtle=iw,e.parseResourceSubject=function(e){var t=ub(e);return t?Mm({containerUrl:jw(t),documentName:t.path?t.path.split("/").pop():null,resourceHash:t.fragment}):{}},e.parseTurtle=ow,e.quadToTurtle=uw,e.quadsToJsonLD=function(e){return aw.apply(this,arguments)},e.quadsToTurtle=sw,e.solidDocumentExists=cw,e.sparqlEquals=$w,e.sparqlToQuads=function(e){return fw.apply(this,arguments)},e.sparqlToQuadsSync=hw,e.turtleEquals=Gw,e.turtleToQuads=dw,e.turtleToQuadsSync=vw,e.updateSolidDocument=gw,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
90
90
|
//# sourceMappingURL=noeldemartin-solid-utils.umd.js.map
|