!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.$rdf=a()}}(function(){var a;return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g=a.length&&c())}if(c=c||function(){},!a.length)return c();var d=0;j(a,function(a){b(a,g(e))})},d.forEach=d.each,d.eachSeries=function(a,b,c){if(c=c||function(){},!a.length)return c();var d=0,e=function(){b(a[d],function(b){b?(c(b),c=function(){}):(d+=1,d>=a.length?c():e())})};e()},d.forEachSeries=d.eachSeries,d.eachLimit=function(a,b,c,d){var e=n(b);e.apply(null,[a,c,d])},d.forEachLimit=d.eachLimit;var n=function(a){return function(b,c,d){if(d=d||function(){},!b.length||a<=0)return d();var e=0,f=0,g=0;!function h(){if(e>=b.length)return d();for(;g=b.length?d():h())})}()}},o=function(a){return function(){var b=Array.prototype.slice.call(arguments);return a.apply(null,[d.each].concat(b))}},p=function(a,b){return function(){var c=Array.prototype.slice.call(arguments);return b.apply(null,[n(a)].concat(c))}},q=function(a){return function(){var b=Array.prototype.slice.call(arguments);return a.apply(null,[d.eachSeries].concat(b))}},r=function(a,b,c,d){if(b=k(b,function(a,b){return{index:b,value:a}}),d){var e=[];a(b,function(a,b){c(a.value,function(c,d){e[a.index]=d,b(c)})},function(a){d(a,e)})}else a(b,function(a,b){c(a.value,function(a){b(a)})})};d.map=o(r),d.mapSeries=q(r),d.mapLimit=function(a,b,c,d){return s(b)(a,c,d)};var s=function(a){return p(a,r)};d.reduce=function(a,b,c,e){d.eachSeries(a,function(a,d){c(b,a,function(a,c){b=c,d(a)})},function(a){e(a,b)})},d.inject=d.reduce,d.foldl=d.reduce,d.reduceRight=function(a,b,c,e){var f=k(a,function(a){return a}).reverse();d.reduce(f,b,c,e)},d.foldr=d.reduceRight;var t=function(a,b,c,d){var e=[];b=k(b,function(a,b){return{index:b,value:a}}),a(b,function(a,b){c(a.value,function(c){c&&e.push(a),b()})},function(a){d(k(e.sort(function(a,b){return a.index-b.index}),function(a){return a.value}))})};d.filter=o(t),d.filterSeries=q(t),d.select=d.filter,d.selectSeries=d.filterSeries;var u=function(a,b,c,d){var e=[];b=k(b,function(a,b){return{index:b,value:a}}),a(b,function(a,b){c(a.value,function(c){c||e.push(a),b()})},function(a){d(k(e.sort(function(a,b){return a.index-b.index}),function(a){return a.value}))})};d.reject=o(u),d.rejectSeries=q(u);var v=function(a,b,c,d){a(b,function(a,b){c(a,function(c){c?(d(a),d=function(){}):b()})},function(a){d()})};d.detect=o(v),d.detectSeries=q(v),d.some=function(a,b,c){d.each(a,function(a,d){b(a,function(a){a&&(c(!0),c=function(){}),d()})},function(a){c(!1)})},d.any=d.some,d.every=function(a,b,c){d.each(a,function(a,d){b(a,function(a){a||(c(!1),c=function(){}),d()})},function(a){c(!0)})},d.all=d.every,d.sortBy=function(a,b,c){d.map(a,function(a,c){b(a,function(b,d){b?c(b):c(null,{value:a,criteria:d})})},function(a,b){if(a)return c(a);var d=function(a,b){var c=a.criteria,d=b.criteria;return cd?1:0};c(null,k(b.sort(d),function(a){return a.value}))})},d.auto=function(a,b){b=b||function(){};var c=m(a),e=c.length;if(!e)return b();var f={},g=[],h=function(a){g.unshift(a)},k=function(a){for(var b=0;b>>1);c(b,a[f])>=0?d=f:e=f-1}return d}function f(a,b,f,g){return a.started||(a.started=!0),i(b)||(b=[b]),0==b.length?d.setImmediate(function(){a.drain&&a.drain()}):void j(b,function(b){var h={data:b,priority:f,callback:"function"==typeof g?g:null};a.tasks.splice(e(a.tasks,h,c)+1,0,h),a.saturated&&a.tasks.length===a.concurrency&&a.saturated(),d.setImmediate(a.process)})}var g=d.queue(a,b);return g.push=function(a,b,c){f(g,a,b,c)},delete g.unshift,g},d.cargo=function(a,b){var c=!1,e=[],f={tasks:e,payload:b,saturated:null,empty:null,drain:null,drained:!0,push:function(a,c){i(a)||(a=[a]),j(a,function(a){e.push({data:a,callback:"function"==typeof c?c:null}),f.drained=!1,f.saturated&&e.length===b&&f.saturated()}),d.setImmediate(f.process)},process:function d(){if(!c){if(0===e.length)return f.drain&&!f.drained&&f.drain(),void(f.drained=!0);var g="number"==typeof b?e.splice(0,b):e.splice(0,e.length),h=k(g,function(a){return a.data});f.empty&&f.empty(),c=!0,a(h,function(){c=!1;var a=arguments;j(g,function(b){b.callback&&b.callback.apply(null,a)}),d()})}},length:function(){return e.length},running:function(){return c}};return f};var y=function(a){return function(b){var c=Array.prototype.slice.call(arguments,1);b.apply(null,c.concat([function(b){var c=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(b?console.error&&console.error(b):console[a]&&j(c,function(b){console[a](b)}))}]))}};d.log=y("log"),d.dir=y("dir"),d.memoize=function(a,b){var c={},e={};b=b||function(a){return a};var f=function(){var f=Array.prototype.slice.call(arguments),g=f.pop(),h=b.apply(null,f);h in c?d.nextTick(function(){g.apply(null,c[h])}):h in e?e[h].push(g):(e[h]=[g],a.apply(null,f.concat([function(){c[h]=arguments;var a=e[h];delete e[h];for(var b=0,d=a.length;b2){var d=Array.prototype.slice.call(arguments,2);return c.apply(this,d)}return c};d.applyEach=o(z),d.applyEachSeries=q(z),d.forever=function(a,b){function c(d){if(d){if(b)return b(d);throw d}a(c)}c()},"undefined"!=typeof c&&c.exports?c.exports=d:"undefined"!=typeof a&&a.amd?a([],function(){return d}):e.async=d}()}).call(this,b("_process"))},{_process:23}],2:[function(a,b,c){"use strict";function g(){for(var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b=0,c=a.length;b0)throw new Error("Invalid string. Length must be a multiple of 4");h="="===a[j-2]?2:"="===a[j-1]?1:0,i=new f(3*j/4-h),d=h>0?j-4:j;var k=0;for(b=0,c=0;b>16&255,i[k++]=g>>8&255,i[k++]=255&g;return 2===h?(g=e[a.charCodeAt(b)]<<2|e[a.charCodeAt(b+1)]>>4,i[k++]=255&g):1===h&&(g=e[a.charCodeAt(b)]<<10|e[a.charCodeAt(b+1)]<<4|e[a.charCodeAt(b+2)]>>2,i[k++]=g>>8&255,i[k++]=255&g),i}function i(a){return d[a>>18&63]+d[a>>12&63]+d[a>>6&63]+d[63&a]}function j(a,b,c){for(var d,e=[],f=b;fk?k:i+h));return 1===e?(b=a[c-1],f+=d[b>>2],f+=d[b<<4&63],f+="=="):2===e&&(b=(a[c-2]<<8)+a[c-1],f+=d[b>>10],f+=d[b>>4&63],f+=d[b<<2&63],f+="="),g.push(f),g.join("")}c.toByteArray=h,c.fromByteArray=k;var d=[],e=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array;g()},{}],3:[function(a,b,c){},{}],4:[function(a,b,c){(function(b){"use strict";function g(){try{var a=new Uint8Array(1);return a.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===a.foo()&&"function"==typeof a.subarray&&0===a.subarray(1,1).byteLength}catch(a){return!1}}function h(){return j.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(a,b){if(h()=h())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+h().toString(16)+" bytes");return 0|a}function t(a){return+a!=a&&(a=0),j.alloc(+a)}function u(a,b){if(j.isBuffer(a))return a.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(a)||a instanceof ArrayBuffer))return a.byteLength;"string"!=typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":case void 0:return Y(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return _(a).length;default:if(d)return Y(a).length;b=(""+b).toLowerCase(),d=!0}}function v(a,b,c){var d=!1;if((void 0===b||b<0)&&(b=0),b>this.length)return"";if((void 0===c||c>this.length)&&(c=this.length),c<=0)return"";if(c>>>=0,b>>>=0,c<=b)return"";for(a||(a="utf8");;)switch(a){case"hex":return L(this,b,c);case"utf8":case"utf-8":return G(this,b,c);case"ascii":return J(this,b,c);case"latin1":case"binary":return K(this,b,c);case"base64":return F(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}}function w(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function x(a,b,c,d,e){if(0===a.length)return-1;if("string"==typeof c?(d=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,isNaN(c)&&(c=e?0:a.length-1),c<0&&(c=a.length+c),c>=a.length){if(e)return-1;c=a.length-1}else if(c<0){if(!e)return-1;c=0}if("string"==typeof b&&(b=j.from(b,d)),j.isBuffer(b))return 0===b.length?-1:y(a,b,c,d,e);if("number"==typeof b)return b&=255,j.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?e?Uint8Array.prototype.indexOf.call(a,b,c):Uint8Array.prototype.lastIndexOf.call(a,b,c):y(a,[b],c,d,e);throw new TypeError("val must be string, number or Buffer")}function y(a,b,c,d,e){function i(a,b){return 1===f?a[b]:a.readUInt16BE(b*f)}var f=1,g=a.length,h=b.length;if(void 0!==d&&(d=String(d).toLowerCase(),"ucs2"===d||"ucs-2"===d||"utf16le"===d||"utf-16le"===d)){if(a.length<2||b.length<2)return-1;f=2,g/=2,h/=2,c/=2}var j;if(e){var k=-1;for(j=c;jg&&(c=g-h),j=c;j>=0;j--){for(var l=!0,m=0;me&&(d=e)):d=e;var f=b.length;if(f%2!==0)throw new TypeError("Invalid hex string");d>f/2&&(d=f/2);for(var g=0;g239?4:f>223?3:f>191?2:1;if(e+h<=c){var i,j,k,l;switch(h){case 1:f<128&&(g=f);break;case 2:i=a[e+1],128===(192&i)&&(l=(31&f)<<6|63&i,l>127&&(g=l));break;case 3:i=a[e+1],j=a[e+2],128===(192&i)&&128===(192&j)&&(l=(15&f)<<12|(63&i)<<6|63&j,l>2047&&(l<55296||l>57343)&&(g=l));break;case 4:i=a[e+1],j=a[e+2],k=a[e+3],128===(192&i)&&128===(192&j)&&128===(192&k)&&(l=(15&f)<<18|(63&i)<<12|(63&j)<<6|63&k,l>65535&&l<1114112&&(g=l))}}null===g?(g=65533,h=1):g>65535&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|1023&g),d.push(g),e+=h}return I(d)}function I(a){var b=a.length;if(b<=H)return String.fromCharCode.apply(String,a);for(var c="",d=0;dd)&&(c=d);for(var e="",f=b;fc)throw new RangeError("Trying to access beyond buffer length")}function O(a,b,c,d,e,f){if(!j.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(b>e||ba.length)throw new RangeError("Index out of range")}function P(a,b,c,d){b<0&&(b=65535+b+1);for(var e=0,f=Math.min(a.length-c,2);e>>8*(d?e:1-e)}function Q(a,b,c,d){b<0&&(b=4294967295+b+1);for(var e=0,f=Math.min(a.length-c,4);e>>8*(d?e:3-e)&255}function R(a,b,c,d,e,f){if(c+d>a.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function S(a,b,c,d,f){return f||R(a,b,c,4,3.4028234663852886e38,-3.4028234663852886e38),e.write(a,b,c,d,23,4),c+4}function T(a,b,c,d,f){return f||R(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),e.write(a,b,c,d,52,8),c+8}function V(a){if(a=W(a).replace(U,""),a.length<2)return"";for(;a.length%4!==0;)a+="=";return a}function W(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function X(a){return a<16?"0"+a.toString(16):a.toString(16)}function Y(a,b){b=b||1/0;for(var c,d=a.length,e=null,f=[],g=0;g55295&&c<57344){if(!e){if(c>56319){(b-=3)>-1&&f.push(239,191,189);continue}if(g+1===d){(b-=3)>-1&&f.push(239,191,189);continue}e=c;continue}if(c<56320){(b-=3)>-1&&f.push(239,191,189),e=c;continue}c=(e-55296<<10|c-56320)+65536}else e&&(b-=3)>-1&&f.push(239,191,189);if(e=null,c<128){if((b-=1)<0)break;f.push(c)}else if(c<2048){if((b-=2)<0)break;f.push(c>>6|192,63&c|128)}else if(c<65536){if((b-=3)<0)break;f.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(c<1114112))throw new Error("Invalid code point");if((b-=4)<0)break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return f}function Z(a){for(var b=[],c=0;c>8,e=c%256,f.push(e),f.push(d);return f}function _(a){return d.toByteArray(V(a))}function aa(a,b,c,d){for(var e=0;e=b.length||e>=a.length);++e)b[e+c]=a[e];return e}function ba(a){return a!==a}var d=a("base64-js"),e=a("ieee754"),f=a("isarray");c.Buffer=j,c.SlowBuffer=t,c.INSPECT_MAX_BYTES=50,j.TYPED_ARRAY_SUPPORT=void 0!==b.TYPED_ARRAY_SUPPORT?b.TYPED_ARRAY_SUPPORT:g(),c.kMaxLength=h(),j.poolSize=8192,j._augment=function(a){return a.__proto__=j.prototype,a},j.from=function(a,b,c){return k(null,a,b,c)},j.TYPED_ARRAY_SUPPORT&&(j.prototype.__proto__=Uint8Array.prototype,j.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&j[Symbol.species]===j&&Object.defineProperty(j,Symbol.species,{value:null,configurable:!0})),j.alloc=function(a,b,c){return m(null,a,b,c)},j.allocUnsafe=function(a){return n(null,a)},j.allocUnsafeSlow=function(a){return n(null,a)},j.isBuffer=function(b){return!(null==b||!b._isBuffer)},j.compare=function(b,c){if(!j.isBuffer(b)||!j.isBuffer(c))throw new TypeError("Arguments must be Buffers");if(b===c)return 0;for(var d=b.length,e=c.length,f=0,g=Math.min(d,e);f0&&(b=this.toString("hex",0,d).match(/.{2}/g).join(" "),this.length>d&&(b+=" ... ")),""},j.prototype.compare=function(b,c,d,e,f){if(!j.isBuffer(b))throw new TypeError("Argument must be a Buffer");if(void 0===c&&(c=0),void 0===d&&(d=b?b.length:0),void 0===e&&(e=0),void 0===f&&(f=this.length),c<0||d>b.length||e<0||f>this.length)throw new RangeError("out of range index");if(e>=f&&c>=d)return 0;if(e>=f)return-1;if(c>=d)return 1;if(c>>>=0,d>>>=0,e>>>=0,f>>>=0,this===b)return 0;for(var g=f-e,h=d-c,i=Math.min(g,h),k=this.slice(e,f),l=b.slice(c,d),m=0;mf)&&(d=f),b.length>0&&(d<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");e||(e="utf8");for(var g=!1;;)switch(e){case"hex":return z(this,b,c,d);case"utf8":case"utf-8":return A(this,b,c,d);case"ascii":return B(this,b,c,d);case"latin1":case"binary":return C(this,b,c,d);case"base64":return D(this,b,c,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,b,c,d);default:if(g)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase(),g=!0}},j.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var H=4096;j.prototype.slice=function(b,c){var d=this.length;b=~~b,c=void 0===c?d:~~c,b<0?(b+=d,b<0&&(b=0)):b>d&&(b=d),c<0?(c+=d,c<0&&(c=0)):c>d&&(c=d),c0&&(f*=256);)e+=this[b+--c]*f;return e},j.prototype.readUInt8=function(b,c){return c||N(b,1,this.length),this[b]},j.prototype.readUInt16LE=function(b,c){return c||N(b,2,this.length),this[b]|this[b+1]<<8},j.prototype.readUInt16BE=function(b,c){return c||N(b,2,this.length),this[b]<<8|this[b+1]},j.prototype.readUInt32LE=function(b,c){return c||N(b,4,this.length),(this[b]|this[b+1]<<8|this[b+2]<<16)+16777216*this[b+3]},j.prototype.readUInt32BE=function(b,c){return c||N(b,4,this.length),16777216*this[b]+(this[b+1]<<16|this[b+2]<<8|this[b+3])},j.prototype.readIntLE=function(b,c,d){b|=0,c|=0,d||N(b,c,this.length);for(var e=this[b],f=1,g=0;++g=f&&(e-=Math.pow(2,8*c)),e},j.prototype.readIntBE=function(b,c,d){b|=0,c|=0,d||N(b,c,this.length);for(var e=c,f=1,g=this[b+--e];e>0&&(f*=256);)g+=this[b+--e]*f;return f*=128,g>=f&&(g-=Math.pow(2,8*c)),g},j.prototype.readInt8=function(b,c){return c||N(b,1,this.length),128&this[b]?(255-this[b]+1)*-1:this[b]},j.prototype.readInt16LE=function(b,c){c||N(b,2,this.length);var d=this[b]|this[b+1]<<8;return 32768&d?4294901760|d:d},j.prototype.readInt16BE=function(b,c){c||N(b,2,this.length);var d=this[b+1]|this[b]<<8;return 32768&d?4294901760|d:d},j.prototype.readInt32LE=function(b,c){return c||N(b,4,this.length),this[b]|this[b+1]<<8|this[b+2]<<16|this[b+3]<<24},j.prototype.readInt32BE=function(b,c){return c||N(b,4,this.length),this[b]<<24|this[b+1]<<16|this[b+2]<<8|this[b+3]},j.prototype.readFloatLE=function(b,c){return c||N(b,4,this.length),e.read(this,b,!0,23,4)},j.prototype.readFloatBE=function(b,c){return c||N(b,4,this.length),e.read(this,b,!1,23,4)},j.prototype.readDoubleLE=function(b,c){return c||N(b,8,this.length),e.read(this,b,!0,52,8)},j.prototype.readDoubleBE=function(b,c){return c||N(b,8,this.length),e.read(this,b,!1,52,8)},j.prototype.writeUIntLE=function(b,c,d,e){if(b=+b,c|=0,d|=0,!e){var f=Math.pow(2,8*d)-1;O(this,b,c,d,f,0)}var g=1,h=0;for(this[c]=255&b;++h=0&&(h*=256);)this[c+g]=b/h&255;return c+d},j.prototype.writeUInt8=function(b,c,d){return b=+b,c|=0,d||O(this,b,c,1,255,0),j.TYPED_ARRAY_SUPPORT||(b=Math.floor(b)),this[c]=255&b,c+1},j.prototype.writeUInt16LE=function(b,c,d){return b=+b,c|=0,d||O(this,b,c,2,65535,0),j.TYPED_ARRAY_SUPPORT?(this[c]=255&b,this[c+1]=b>>>8):P(this,b,c,!0),c+2},j.prototype.writeUInt16BE=function(b,c,d){return b=+b,c|=0,d||O(this,b,c,2,65535,0),j.TYPED_ARRAY_SUPPORT?(this[c]=b>>>8,this[c+1]=255&b):P(this,b,c,!1),c+2},j.prototype.writeUInt32LE=function(b,c,d){return b=+b,c|=0,d||O(this,b,c,4,4294967295,0),j.TYPED_ARRAY_SUPPORT?(this[c+3]=b>>>24,this[c+2]=b>>>16,this[c+1]=b>>>8,this[c]=255&b):Q(this,b,c,!0),c+4},j.prototype.writeUInt32BE=function(b,c,d){return b=+b,c|=0,d||O(this,b,c,4,4294967295,0),j.TYPED_ARRAY_SUPPORT?(this[c]=b>>>24,this[c+1]=b>>>16,this[c+2]=b>>>8,this[c+3]=255&b):Q(this,b,c,!1),c+4},j.prototype.writeIntLE=function(b,c,d,e){if(b=+b,c|=0,!e){var f=Math.pow(2,8*d-1);O(this,b,c,d,f-1,-f)}var g=0,h=1,i=0;for(this[c]=255&b;++g>0)-i&255;return c+d},j.prototype.writeIntBE=function(b,c,d,e){if(b=+b,c|=0,!e){var f=Math.pow(2,8*d-1);O(this,b,c,d,f-1,-f)}var g=d-1,h=1,i=0;for(this[c+g]=255&b;--g>=0&&(h*=256);)b<0&&0===i&&0!==this[c+g+1]&&(i=1),this[c+g]=(b/h>>0)-i&255;return c+d},j.prototype.writeInt8=function(b,c,d){return b=+b,c|=0,d||O(this,b,c,1,127,-128),j.TYPED_ARRAY_SUPPORT||(b=Math.floor(b)),b<0&&(b=255+b+1),this[c]=255&b,c+1},j.prototype.writeInt16LE=function(b,c,d){return b=+b,c|=0,d||O(this,b,c,2,32767,-32768),j.TYPED_ARRAY_SUPPORT?(this[c]=255&b,this[c+1]=b>>>8):P(this,b,c,!0),c+2},j.prototype.writeInt16BE=function(b,c,d){return b=+b,c|=0,d||O(this,b,c,2,32767,-32768),j.TYPED_ARRAY_SUPPORT?(this[c]=b>>>8,this[c+1]=255&b):P(this,b,c,!1),c+2},j.prototype.writeInt32LE=function(b,c,d){return b=+b,c|=0,d||O(this,b,c,4,2147483647,-2147483648),j.TYPED_ARRAY_SUPPORT?(this[c]=255&b,this[c+1]=b>>>8,this[c+2]=b>>>16,this[c+3]=b>>>24):Q(this,b,c,!0),c+4},j.prototype.writeInt32BE=function(b,c,d){return b=+b,c|=0,d||O(this,b,c,4,2147483647,-2147483648),b<0&&(b=4294967295+b+1),j.TYPED_ARRAY_SUPPORT?(this[c]=b>>>24,this[c+1]=b>>>16,this[c+2]=b>>>8,this[c+3]=255&b):Q(this,b,c,!1),c+4},j.prototype.writeFloatLE=function(b,c,d){return S(this,b,c,!0,d)},j.prototype.writeFloatBE=function(b,c,d){return S(this,b,c,!1,d)},j.prototype.writeDoubleLE=function(b,c,d){return T(this,b,c,!0,d); },j.prototype.writeDoubleBE=function(b,c,d){return T(this,b,c,!1,d)},j.prototype.copy=function(b,c,d,e){if(d||(d=0),e||0===e||(e=this.length),c>=b.length&&(c=b.length),c||(c=0),e>0&&e=this.length)throw new RangeError("sourceStart out of bounds");if(e<0)throw new RangeError("sourceEnd out of bounds");e>this.length&&(e=this.length),b.length-c=0;--g)b[g+c]=this[g+d];else if(f<1e3||!j.TYPED_ARRAY_SUPPORT)for(g=0;g>>=0,d=void 0===d?this.length:d>>>0,b||(b=0);var g;if("number"==typeof b)for(g=c;g0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),"function"==typeof console.trace&&console.trace())),this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){function d(){this.removeListener(a,d),c||(c=!0,b.apply(this,arguments))}if(!e(b))throw TypeError("listener must be a function");var c=!1;return d.listener=b,this.on(a,d),this},d.prototype.removeListener=function(a,b){var c,d,f,h;if(!e(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],f=c.length,d=-1,c===b||e(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(g(c)){for(h=f;h-- >0;)if(c[h]===b||c[h].listener&&c[h].listener===b){d=h;break}if(d<0)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(d,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},d.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],e(c))this.removeListener(a,c);else if(c)for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},d.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?e(this._events[a])?[this._events[a]]:this._events[a].slice():[]},d.prototype.listenerCount=function(a){if(this._events){var b=this._events[a];if(e(b))return 1;if(b)return b.length}return 0},d.listenerCount=function(a,b){return a.listenerCount(b)}},{}],8:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:(n?-1:1)*(1/0);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=b<0||0===b&&1/b<0?1:0;for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],9:[function(a,b,c){"function"==typeof Object.create?b.exports=function(b,c){b.super_=c,b.prototype=Object.create(c.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}})}:b.exports=function(b,c){b.super_=c;var d=function(){};d.prototype=c.prototype,b.prototype=new d,b.prototype.constructor=b}},{}],10:[function(a,b,c){function d(a){return!!a.constructor&&"function"==typeof a.constructor.isBuffer&&a.constructor.isBuffer(a)}function e(a){return"function"==typeof a.readFloatLE&&"function"==typeof a.slice&&d(a.slice(0,0))}b.exports=function(a){return null!=a&&(d(a)||e(a)||!!a._isBuffer)}},{}],11:[function(a,b,c){var d={}.toString;b.exports=Array.isArray||function(a){return"[object Array]"==d.call(a)}},{}],12:[function(a,b,c){},{}],13:[function(b,c,d){(function(d,e,f){!function(){var g="undefined"!=typeof d&&d.versions&&d.versions.node,h=!g&&("undefined"!=typeof window||"undefined"!=typeof self);h&&"undefined"==typeof e&&("undefined"!=typeof window?e=window:"undefined"!=typeof self?e=self:"undefined"!=typeof $&&(e=$));var i=function(a){function c(){}function G(a){for(var b=[],c=Object.keys(a).sort(),d=0;d=0;--c)if(b[c]["@id"]===a["@id"])return!0;return!1}function V(a,b,c){var d="@"+c,e=d in a?a[d][0]:b[c];return"embed"===c&&(e===!0?e="@last":e===!1?e="@never":"@always"!==e&&"@never"!==e&&"@link"!==e&&(e="@last")),e}function W(a){if(!ma(a)||1!==a.length||!ka(a[0]))throw new E("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:a})}function X(a,b,c,d){for(var e={},f=0;f=0;--n)for(var z=w[n],A=z.terms,B=0;B0&&"/"!==f.substr(-1)&&(f+="/"),f+=d.path),e.path=f}e.query=d.query}e.path=La(e.path,!!e.authority);var g=e.protocol;return null!==e.authority&&(g+="//"+e.authority),g+=e.path,null!==e.query&&(g+="?"+e.query),null!==d.fragment&&(g+="#"+d.fragment),""===g&&(g="./"),g}function ha(b,c){if(null===b)return c;oa(b)&&(b=a.url.parse(b||""));var d="";if(""!==b.href?d+=(b.protocol||"")+"//"+(b.authority||""):c.indexOf("//")&&(d+="//"),0!==c.indexOf(d))return c;for(var e=a.url.parse(c.substr(d.length)),f=b.normalizedPath.split("/"),g=e.normalizedPath.split("/"),h=e.fragment||e.query?0:1;f.length>0&&g.length>h&&f[0]===g[0];)f.shift(),g.shift();var i="";if(f.length>0){f.pop();for(var j=0;j=g.length?"":g[c],h in f?f[h].push(d[i]):f[h]=[d[i]];for(var b in f)""!==b&&e(f,b,c+1)}function f(a,b,c,d){d in c||(c[d]=b)}function g(){var a={};return a["@base"]=this["@base"],a.mappings=Aa(this.mappings),a.clone=this.clone,a.inverse=null,a.getInverse=this.getInverse,"@language"in this&&(a["@language"]=this["@language"]),"@vocab"in this&&(a["@vocab"]=this["@vocab"]),a}var c=a.url.parse(b.base||"");return{"@base":c,mappings:{},inverse:null,getInverse:d,clone:g}}function ja(a){if(!oa(a))return!1;switch(a){case"@base":case"@context":case"@container":case"@default":case"@embed":case"@explicit":case"@graph":case"@id":case"@index":case"@language":case"@list":case"@omitDefault":case"@preserve":case"@requireAll":case"@reverse":case"@set":case"@type":case"@value":case"@vocab":return!0}return!1}function ka(a){return"[object Object]"===Object.prototype.toString.call(a)}function la(a){return ka(a)&&0===Object.keys(a).length}function ma(a){return Array.isArray(a)}function na(a){if(!oa(a)&&!la(a)){var b=!1;if(ma(a)){b=!0;for(var c=0;c1||!("@id"in a)}return b}function va(a){return ka(a)&&1===Object.keys(a).length&&"@id"in a}function wa(a){return ka(a)&&"@value"in a}function xa(a){return ka(a)&&"@list"in a}function ya(a){var b=!1;return ka(a)&&(b="@id"in a?0===a["@id"].indexOf("_:"):0===Object.keys(a).length||!("@value"in a||"@set"in a||"@list"in a)),b}function za(a){return oa(a)&&a.indexOf(":")!==-1}function Aa(a){if(a&&"object"==typeof a){var b;if(ma(a)){b=[];for(var c=0;cD)return d=new E("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"loading remote context failed",max:D}),g(d);var h={},i=function(){Ba(a,h,!0,e),g(null,a)};Ba(a,h,!1,e)||i();var j=[];for(var k in h)h[k]===!1&&j.push(k);for(var l=j.length,m=0;m":c.value,g+=" ",g+="IRI"===d.type?"<"+d.value+">":d.value,g+=" ","IRI"===e.type)g+="<"+e.value+">";else if("blank node"===e.type)g+=e.value;else{var h=e.value.replace(/\\/g,"\\\\").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\"/g,'\\"');g+='"'+h+'"',e.datatype===B?e.language&&(g+="@"+e.language):e.datatype!==r&&(g+="^^<"+e.datatype+">")}return null!==f&&void 0!==f&&(g+=0!==f.indexOf("_:")?" <"+f+">":" "+f),g+=" .\n"}function Ga(a){var b={};b["@default"]=[];for(var c=a.getSubjects(),d=0;d0;)"."===d[0]||""===d[0]&&d.length>1?d.shift():".."!==d[0]?e.push(d.shift()):(d.shift(),b||e.length>0&&".."!==e[e.length-1]?e.pop():e.push(".."));return c+e.join("/")}a.compact=function(b,c,d,e){function g(a,b,d,f){if(a)return e(a);f.compactArrays&&!f.graph&&ma(b)?1===b.length?b=b[0]:0===b.length&&(b={}):f.graph&&ka(b)&&(b=[b]),ka(c)&&"@context"in c&&(c=c["@context"]),c=Aa(c),ma(c)||(c=[c]);var g=c;c=[];for(var h=0;h0)&&c.push(g[h]);var i=c.length>0;if(1===c.length&&(c=c[0]),ma(b)){var j=ca(d,"@graph"),k=b;b={},i&&(b["@context"]=c),b[j]=k}else if(ka(b)&&i){var k=b;b={"@context":c};for(var l in k)b[l]=k[l]}e(null,b,d)}if(arguments.length<2)return a.nextTick(function(){e(new TypeError("Could not compact, too few arguments."))});if("function"==typeof d&&(e=d,d={}),d=d||{},null===c)return a.nextTick(function(){e(new E("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"}))});if(null===b)return a.nextTick(function(){e(null,null)});"base"in d||(d.base="string"==typeof b?b:""),"compactArrays"in d||(d.compactArrays=!0),"graph"in d||(d.graph=!1),"skipExpansion"in d||(d.skipExpansion=!1),"documentLoader"in d||(d.documentLoader=a.loadDocument),"link"in d||(d.link=!1),d.link&&(d.skipExpansion=!0);var f=function(b,c,d){return c.skipExpansion?a.nextTick(function(){d(null,b)}):void a.expand(b,c,d)};f(b,d,function(b,f){if(b)return e(new E("Could not expand input before compaction.","jsonld.CompactError",{cause:b}));var h=ia(d);a.processContext(h,c,d,function(a,b){if(a)return e(new E("Could not process context before compaction.","jsonld.CompactError",{cause:a}));var c;try{c=(new F).compact(b,null,f,d)}catch(a){return e(a)}g(null,c,b,d)})})},a.expand=function(b,c,d){function e(a){"base"in c||(c.base=a.documentUrl||"");var b={document:Aa(a.document),remoteContext:{"@context":a.contextUrl}};if("expandContext"in c){var e=Aa(c.expandContext);"object"==typeof e&&"@context"in e?b.expandContext=e:b.expandContext={"@context":e}}Ca(b,c,function(a,b){if(a)return d(a);var e;try{var f=new F,g=ia(c),h=b.document,i=b.remoteContext["@context"];b.expandContext&&(g=f.processContext(g,b.expandContext["@context"],c)),i&&(g=f.processContext(g,i,c)),e=f.expand(g,null,h,c,!1),ka(e)&&"@graph"in e&&1===Object.keys(e).length?e=e["@graph"]:null===e&&(e=[]),ma(e)||(e=[e])}catch(a){return d(a)}d(null,e)})}return arguments.length<1?a.nextTick(function(){d(new TypeError("Could not expand, too few arguments."))}):("function"==typeof c&&(d=c,c={}),c=c||{},"documentLoader"in c||(c.documentLoader=a.loadDocument),"keepFreeFloatingNodes"in c||(c.keepFreeFloatingNodes=!1),void a.nextTick(function(){if("string"==typeof b){var a=function(a,b){if(a)return d(a);try{if(!b.document)throw new E("No remote document found at the given URL.","jsonld.NullRemoteDocument");"string"==typeof b.document&&(b.document=JSON.parse(b.document))}catch(a){return d(new E("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",cause:a,remoteDoc:b}))}e(b)},f=c.documentLoader(b,a);return void(f&&"then"in f&&f.then(a.bind(null,null),a))}e({contextUrl:null,documentUrl:null,document:b})}))},a.flatten=function(b,c,d,e){return arguments.length<1?a.nextTick(function(){e(new TypeError("Could not flatten, too few arguments."))}):("function"==typeof d?(e=d,d={}):"function"==typeof c&&(e=c,c=null,d={}),d=d||{},"base"in d||(d.base="string"==typeof b?b:""),"documentLoader"in d||(d.documentLoader=a.loadDocument),void a.expand(b,d,function(b,f){if(b)return e(new E("Could not expand input before flattening.","jsonld.FlattenError",{cause:b}));var g;try{g=(new F).flatten(f)}catch(a){return e(a)}return null===c?e(null,g):(d.graph=!0,d.skipExpansion=!0,void a.compact(g,c,d,function(a,b){return a?e(new E("Could not compact flattened output.","jsonld.FlattenError",{cause:a})):void e(null,b)}))}))},a.frame=function(b,c,d,e){function f(c){var g,f=c.document;f?(g=f["@context"],c.contextUrl?(g?ma(g)?g.push(c.contextUrl):g=[g,c.contextUrl]:g=c.contextUrl,f["@context"]=g):g=g||{}):g={},a.expand(b,d,function(b,c){if(b)return e(new E("Could not expand input before framing.","jsonld.FrameError",{cause:b}));var h=Aa(d);h.isFrame=!0,h.keepFreeFloatingNodes=!0,a.expand(f,h,function(b,d){if(b)return e(new E("Could not expand frame before framing.","jsonld.FrameError",{cause:b}));var f;try{f=(new F).frame(c,d,h)}catch(a){return e(a)}h.graph=!0,h.skipExpansion=!0,h.link={},a.compact(f,g,h,function(a,b,c){if(a)return e(new E("Could not compact framed output.","jsonld.FrameError",{cause:a}));var d=ca(c,"@graph");h.link={},b[d]=_(c,b[d],h),e(null,b)})})})}return arguments.length<2?a.nextTick(function(){e(new TypeError("Could not frame, too few arguments."))}):("function"==typeof d&&(e=d,d={}),d=d||{},"base"in d||(d.base="string"==typeof b?b:""),"documentLoader"in d||(d.documentLoader=a.loadDocument),"embed"in d||(d.embed="@last"),d.explicit=d.explicit||!1,"requireAll"in d||(d.requireAll=!0),d.omitDefault=d.omitDefault||!1,void a.nextTick(function(){if("string"==typeof c){var a=function(a,b){if(a)return e(a);try{if(!b.document)throw new E("No remote document found at the given URL.","jsonld.NullRemoteDocument");"string"==typeof b.document&&(b.document=JSON.parse(b.document))}catch(a){return e(new E("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",cause:a,remoteDoc:b}))}f(b)},b=d.documentLoader(c,a);return void(b&&"then"in b&&b.then(a.bind(null,null),a))}f({contextUrl:null,documentUrl:null,document:c})}))},a.link=function(b,c,d,e){var f={};c&&(f["@context"]=c),f["@embed"]="@link",a.frame(b,f,d,e)},a.objectify=function(b,c,d,e){"function"==typeof d&&(e=d,d={}),d=d||{},"base"in d||(d.base="string"==typeof b?b:""),"documentLoader"in d||(d.documentLoader=a.loadDocument),a.expand(b,d,function(b,f){if(b)return e(new E("Could not expand input before linking.","jsonld.LinkError",{cause:b}));var g;try{g=(new F).flatten(f)}catch(a){return e(a)}d.graph=!0,d.skipExpansion=!0,a.compact(g,c,d,function(b,c,d){if(b)return e(new E("Could not compact flattened output before linking.","jsonld.LinkError",{cause:b}));var f=ca(d,"@graph"),g=c[f][0],h=function(b){if(ka(b)||ma(b)){if(ka(b)){if(h.visited[b["@id"]])return;h.visited[b["@id"]]=!0}for(var c in b){var e=b[c],f="@id"===a.getContextValue(d,c,"@type");if(ma(e)||ka(e)||f)if(oa(e)&&f)b[c]=e=g[e],h(e);else if(ma(e))for(var i=0;i]*?>|"[^"]*?"|[^,])+/g),d=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,e=0;e=+new Date)return b.ctx;delete this.cache[a],this.order.splice(this.order.indexOf(a),1)}return null},a.DocumentCache.prototype.set=function(a,b){this.order.length===this.size&&delete this.cache[this.order.shift()],this.order.push(a),this.cache[a]={ctx:b,expires:+new Date+this.expires}},a.ActiveContextCache=function(a){this.order=[],this.cache={},this.size=a||100},a.ActiveContextCache.prototype.get=function(a,b){var c=JSON.stringify(a),d=JSON.stringify(b),e=this.cache[c];return e&&d in e?e[d]:null},a.ActiveContextCache.prototype.set=function(a,b,c){if(this.order.length===this.size){var d=this.order.shift();delete this.cache[d.activeCtx][d.localCtx]}var e=JSON.stringify(a),f=JSON.stringify(b);this.order.push({activeCtx:e,localCtx:f}),e in this.cache||(this.cache[e]={}),this.cache[e][f]=Aa(c)},a.cache={activeCtx:new a.ActiveContextCache},a.documentLoaders={},a.documentLoaders.jquery=function(b,c){function f(d,e){return 0!==d.indexOf("http:")&&0!==d.indexOf("https:")?e(new E('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:d}),{contextUrl:null,documentUrl:d,document:null}):c.secure&&0!==d.indexOf("https")?e(new E('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:d}),{contextUrl:null,documentUrl:d,document:null}):void b.ajax({url:d,accepts:{json:"application/ld+json, application/json"},headers:{Accept:"application/ld+json, application/json"},dataType:"json",crossDomain:!0,success:function(b,c,f){var g={contextUrl:null,documentUrl:d,document:b},h=f.getResponseHeader("Content-Type"),i=f.getResponseHeader("Link");if(i&&"application/ld+json"!==h){if(i=a.parseLinkHeader(i)[C],ma(i))return e(new E("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:d}),g);i&&(g.contextUrl=i.target)}e(null,g)},error:function(a,b,c){e(new E("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:d,cause:c}),{contextUrl:null,documentUrl:d,document:null})}})}c=c||{};var d=new a.RequestQueue,e="usePromise"in c?c.usePromise:"undefined"!=typeof Promise;return e?d.wrapLoader(function(b){return a.promisify(f,b)}):d.wrapLoader(f)},a.documentLoaders.node=function(c){function k(b,i,j){function o(c,d,f){if(l={contextUrl:null,documentUrl:b,document:f||null},c)return j(new E("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:b,cause:c}),l);var g=h.STATUS_CODES[d.statusCode];if(d.statusCode>=400)return j(new E("URL could not be dereferenced: "+g,"jsonld.InvalidUrl",{code:"loading document failed",url:b,httpStatusCode:d.statusCode}),l);if(d.headers.link&&"application/ld+json"!==d.headers["content-type"]){var m=a.parseLinkHeader(d.headers.link)[C];if(ma(m))return j(new E("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:b}),l);m&&(l.contextUrl=m.target)}return d.statusCode>=300&&d.statusCode<400&&d.headers.location?i.length===e?j(new E("URL could not be dereferenced; there were too many redirects.","jsonld.TooManyRedirects",{code:"loading document failed",url:b,httpStatusCode:d.statusCode,redirects:i}),l):i.indexOf(b)!==-1?j(new E("URL could not be dereferenced; infinite redirection was detected.","jsonld.InfiniteRedirectDetected",{code:"recursive context inclusion",url:b,httpStatusCode:d.statusCode,redirects:i}),l):(i.push(b),k(d.headers.location,i,j)):(i.push(b),void j(c,l))}if(0!==b.indexOf("http:")&&0!==b.indexOf("https:"))return j(new E('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:b}),{contextUrl:null,documentUrl:b,document:null});if(c.secure&&0!==b.indexOf("https"))return j(new E('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:b}),{contextUrl:null,documentUrl:b,document:null});var l=null;if(null!==l)return j(null,l);var m={Accept:g};for(var n in c.headers)m[n]=c.headers[n];f({url:b,headers:m,strictSSL:d,followRedirect:!1},o)}c=c||{};var d=!("strictSSL"in c)||c.strictSSL,e="maxRedirects"in c?c.maxRedirects:-1,f="request"in c?c.request:b("request"),g="application/ld+json, application/json",h=b("http"),i=new a.RequestQueue;if(c.usePromise)return i.wrapLoader(function(b){return a.promisify(k,b,[])});var j=c.headers||{};if("Accept"in j||"accept"in j)throw new RangeError('Accept header may not be specified as an option; only "'+g+'" is supported.');return i.wrapLoader(function(a,b){k(a,[],b)})},a.documentLoaders.xhr=function(b){function f(d,e){if(0!==d.indexOf("http:")&&0!==d.indexOf("https:"))return e(new E('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:d}),{contextUrl:null,documentUrl:d,document:null});if(b.secure&&0!==d.indexOf("https"))return e(new E('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:d}),{contextUrl:null,documentUrl:d,document:null});var f=b.xhr||XMLHttpRequest,g=new f;g.onload=function(){if(g.status>=400)return e(new E("URL could not be dereferenced: "+g.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:d,httpStatusCode:g.status}),{contextUrl:null,documentUrl:d,document:null});var h,b={contextUrl:null,documentUrl:d,document:g.response},f=g.getResponseHeader("Content-Type");if(c.test(g.getAllResponseHeaders())&&(h=g.getResponseHeader("Link")),h&&"application/ld+json"!==f){if(h=a.parseLinkHeader(h)[C],ma(h))return e(new E("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:d}),b);h&&(b.contextUrl=h.target)}e(null,b)},g.onerror=function(){e(new E("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:d}),{contextUrl:null,documentUrl:d,document:null})},g.open("GET",d,!0),g.setRequestHeader("Accept","application/ld+json, application/json"),g.send()}b=b||{};var c=/(^|(\r\n))link:/i,d=new a.RequestQueue,e="usePromise"in b?b.usePromise:"undefined"!=typeof Promise;return e?d.wrapLoader(function(b){return a.promisify(f,b)}):d.wrapLoader(f)},a.useDocumentLoader=function(b){if(!(b in a.documentLoaders))throw new E('Unknown document loader type: "'+b+'"',"jsonld.UnknownDocumentLoader",{type:b});a.documentLoader=a.documentLoaders[b].apply(a,Array.prototype.slice.call(arguments,1))},a.processContext=function(b,c){var d={},e=2;arguments.length>3&&(d=arguments[2]||{},e+=1);var f=arguments[e];return"base"in d||(d.base=""),"documentLoader"in d||(d.documentLoader=a.loadDocument),null===c?f(null,ia(d)):(c=Aa(c),ka(c)&&"@context"in c||(c={"@context":c}),void Ca(c,d,function(a,c){if(a)return f(a);try{c=(new F).processContext(b,c,d)}catch(a){return f(a)}f(null,c)}))},a.hasProperty=function(a,b){var c=!1;if(b in a){var d=a[b];c=!ma(d)||d.length>0}return c},a.hasValue=function(b,c,d){var e=!1;if(a.hasProperty(b,c)){var f=b[c],g=xa(f);if(ma(f)||g){g&&(f=f["@list"]);for(var h=0;h0){var r=ca(b,n);a.addValue(f,r,p)}}else{var p;if(oa(o))p=ca(b,o,null,{vocab:"@type"===n});else{p=[];for(var q=0;q1&&!(2===A&&"@index"in h))throw new E('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',"jsonld.SyntaxError",{code:"invalid set or list object",element:h});"@set"in h&&(h=h["@set"],m=Object.keys(h),A=m.length)}else 1===A&&"@language"in h&&(h=null);return!ka(h)||e.keepFreeFloatingNodes||f||null!==c&&"@graph"!==l||(0===A||"@value"in h||"@list"in h||1===A&&"@id"in h)&&(h=null),h},F.prototype.createNodeMap=function(a,b){b=b||{};var c=b.namer||b.issuer||new Ha("_:b"),d={"@default":{}};return Q(a,d,"@default",c),R(d)},F.prototype.flatten=function(a){for(var b=this.createNodeMap(a),c=[],d=Object.keys(b).sort(),e=0;e=d.MAX_TOTAL_DEPTH?c(new Error("Maximum total call stack depth exceeded; normalization aborting.")):void function e(){if(d.depth===d.MAX_DEPTH)return d.depth=0,d.running=!1,a.nextTick(e);var f=(new Date).getTime();return d.running||(d.start=(new Date).getTime(),d.deadline=d.start+d.timeSlice),f1)return f();var h=g[0];c.canonicalIssuer.getId(h),delete e[h],delete c.hashToBlankNodes[a],b=!0,f()},a)}],a)},a)},function(a){var b=Object.keys(c.hashToBlankNodes).sort();c.forEach(b,function(a,b,d){var e=[],f=c.hashToBlankNodes[a];c.waterfall([function(a){c.forEach(f,function(a,b,d){if(c.canonicalIssuer.hasId(a))return d();var f=new Ha("_:b");f.getId(a),c.hashNDegreeQuads(a,f,function(a,b){return a?d(a):(e.push(b),void d())})},a)},function(a){e.sort(function(a,b){return a.hashb.hash?1:0}),c.forEach(e,function(a,b,d){for(var e in a.issuer.existing)c.canonicalIssuer.getId(e);d()},a)}],d)},a)},function(a){var b=[];c.waterfall([function(a){c.forEach(c.quads,function(a,d,e){c.forEachComponent(a,function(a){"blank node"===a.type&&0!==a.value.indexOf(c.canonicalIssuer.prefix)&&(a.value=c.canonicalIssuer.getId(a.value))}),b.push(Fa(a)),e()},a)},function(a){return b.sort(),"application/nquads"===c.options.format?(d=b.join(""),a()):(d=Da(b.join("")),void a())}],a)}],function(a){b(a,d)})},c.prototype.hashFirstDegreeQuads=function(a,b){var c=this,d=c.blankNodeInfo[a];if("hash"in d)return b(null,d.hash);var e=[],f=d.quads;c.forEach(f,function(b,d,f){var g={predicate:b.predicate};c.forEachComponent(b,function(b,d){g[d]=c.modifyFirstDegreeComponent(a,b,d)}),e.push(Fa(g)),f()},function(a){return a?b(a):(e.sort(),d.hash=Ja.hashNQuads(c.name,e),void b(null,d.hash))})},c.prototype.modifyFirstDegreeComponent=function(a,b){return"blank node"!==b.type?b:(b=Aa(b),b.value=b.value===a?"_:a":"_:z",b)},c.prototype.hashRelatedBlankNode=function(a,b,c,d,e){var g,f=this;f.waterfall([function(b){return f.canonicalIssuer.hasId(a)?(g=f.canonicalIssuer.getId(a),b()):c.hasId(a)?(g=c.getId(a),b()):void f.hashFirstDegreeQuads(a,function(a,c){return a?b(a):(g=c,void b())})}],function(a){if(a)return e(a);var c=new Ja(f.name);return c.update(d),"g"!==d&&c.update(f.getRelatedPredicate(b)),c.update(g),e(null,c.digest())})},c.prototype.getRelatedPredicate=function(a){return"<"+a.predicate.value+">"},c.prototype.hashNDegreeQuads=function(a,b,c){var e,d=this,f=new Ja(d.name);d.waterfall([function(c){d.createHashToRelated(a,b,function(a,b){return a?c(a):(e=b,void c())})},function(a){var c=Object.keys(e).sort();d.forEach(c,function(a,c,g){f.update(a);var i,h="",j=new Ia(e[a]);d.whilst(function(){return j.hasNext()},function(a){var c=j.next(),e=b.clone(),f="",g=[];d.waterfall([function(b){d.forEach(c,function(b,c,i){return d.canonicalIssuer.hasId(b)?f+=d.canonicalIssuer.getId(b):(e.hasId(b)||g.push(b),f+=e.getId(b)),0!==h.length&&f.length>=h.length&&f>h?a():void i()},b)},function(b){d.forEach(g,function(b,c,g){d.hashNDegreeQuads(b,e,function(c,d){return c?g(c):(f+=e.getId(b),f+="<"+d.hash+">",e=d.issuer,0!==h.length&&f.length>=h.length&&f>h?a():void g())})},b)},function(a){(0===h.length||fb)&&(g&&e>0&&f>this.list[e-1]||!g&&ethis.list[e+1])&&(b=f,c=e)}if(null===b)this.done=!0;else{var h=this.left[b]?c-1:c+1;this.list[c]=this.list[h],this.list[h]=b;for(var e=0;eb&&(this.left[this.list[e]]=!this.left[this.list[e]])}return a};var Ja=function(a){if(!(this instanceof Ja))return new Ja(a);if(["URDNA2015","URGNA2012"].indexOf(a)===-1)throw new Error("Invalid RDF Dataset Normalization algorithm: "+a);Ja._init.call(this,a)};if(Ja.hashNQuads=function(a,b){for(var c=new Ja(a),d=0;d0;)1&c&&(d._padding+=b),c>>>=1,c>0&&(b+=b)}this.start()};d.prototype.start=function(){this.messageLength=0,this.fullMessageLength=[];for(var a=this._algorithm.messageLengthSize/4,b=0;b>>0,b>>>0];for(var c=this.fullMessageLength.length-1;c>=0;--c)this.fullMessageLength[c]+=b[1],b[1]=b[0]+(this.fullMessageLength[c]/4294967296>>>0),this.fullMessageLength[c]=this.fullMessageLength[c]>>>0,b[0]=b[1]/4294967296>>>0;for(this._input.putBytes(a.bytes());this._input.length()>=this._algorithm.blockSize;)this.state=this._algorithm.digest(this.state,this._input);return(this._input.read>2048||0===this._input.length())&&this._input.compact(),this},d.prototype.digest=function(){var a=new d.ByteBuffer;a.putBytes(this._input.bytes());var b=this.fullMessageLength[this.fullMessageLength.length-1]+this._algorithm.messageLengthSize,c=b&this._algorithm.blockSize-1;a.putBytes(d._padding.substr(0,this._algorithm.blockSize-c));for(var e=new d.ByteBuffer,f=0;f>>28);this._algorithm.writeMessageLength(a,e);var g=this._algorithm.digest(this.state.copy(),a),h=new d.ByteBuffer;return g.write(h),h},d.ByteBuffer=function(a){"string"==typeof a?this.data=a:this.data="",this.read=0},d.ByteBuffer.prototype.putInt32=function(a){this.data+=String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(255&a)},d.ByteBuffer.prototype.getInt32=function(){var a=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,a},d.ByteBuffer.prototype.putBytes=function(a){this.data+=a},d.ByteBuffer.prototype.bytes=function(){return this.data.slice(this.read)},d.ByteBuffer.prototype.length=function(){return this.data.length-this.read},d.ByteBuffer.prototype.compact=function(){this.data=this.data.slice(this.read),this.read=0},d.ByteBuffer.prototype.toHex=function(){for(var a="",b=this.read;b=64;){for(d=a.h0,f=a.h1,g=a.h2,h=a.h3,i=a.h4,k=0;k<16;++k)c=b.getInt32(),m[k]=c,j=h^f&(g^h),c=(d<<5|d>>>27)+j+i+1518500249+c,i=h,h=g,g=f<<30|f>>>2,f=d,d=c;for(;k<20;++k)c=m[k-3]^m[k-8]^m[k-14]^m[k-16],c=c<<1|c>>>31,m[k]=c,j=h^f&(g^h),c=(d<<5|d>>>27)+j+i+1518500249+c,i=h,h=g,g=f<<30|f>>>2,f=d,d=c;for(;k<32;++k)c=m[k-3]^m[k-8]^m[k-14]^m[k-16],c=c<<1|c>>>31,m[k]=c,j=f^g^h,c=(d<<5|d>>>27)+j+i+1859775393+c,i=h,h=g,g=f<<30|f>>>2,f=d,d=c;for(;k<40;++k)c=m[k-6]^m[k-16]^m[k-28]^m[k-32],c=c<<2|c>>>30,m[k]=c,j=f^g^h,c=(d<<5|d>>>27)+j+i+1859775393+c,i=h,h=g,g=f<<30|f>>>2,f=d,d=c;for(;k<60;++k)c=m[k-6]^m[k-16]^m[k-28]^m[k-32],c=c<<2|c>>>30,m[k]=c,j=f&g|h&(f^g),c=(d<<5|d>>>27)+j+i+2400959708+c,i=h,h=g,g=f<<30|f>>>2,f=d,d=c;for(;k<80;++k)c=m[k-6]^m[k-16]^m[k-28]^m[k-32],c=c<<2|c>>>30,m[k]=c,j=f^g^h,c=(d<<5|d>>>27)+j+i+3395469782+c,i=h,h=g,g=f<<30|f>>>2,f=d,d=c;a.h0=a.h0+d|0,a.h1=a.h1+f|0,a.h2=a.h2+g|0,a.h3=a.h3+h|0,a.h4=a.h4+i|0,l-=64}return a},e._createState=function(){var a={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520};return a.copy=function(){var b=e._createState();return b.h0=a.h0,b.h1=a.h1,b.h2=a.h2,b.h3=a.h3,b.h4=a.h4,b},a.write=function(b){b.putInt32(a.h0),b.putInt32(a.h1),b.putInt32(a.h2),b.putInt32(a.h3),b.putInt32(a.h4)},a};var f={_k:null,_w:null};f.Algorithm=function(){this.name="sha256",this.blockSize=64,this.digestLength=32,this.messageLengthSize=8},f.Algorithm.prototype.start=function(){return f._k||f._init(),f._createState()},f.Algorithm.prototype.writeMessageLength=function(a,b){a.putBytes(b.bytes())},f.Algorithm.prototype.digest=function(a,b){for(var c,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s=b.length(),t=f._k,u=f._w;s>=64;){for(j=0;j<16;++j)u[j]=b.getInt32();for(;j<64;++j)c=u[j-2],c=(c>>>17|c<<15)^(c>>>19|c<<13)^c>>>10,d=u[j-15],d=(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3,u[j]=c+u[j-7]+d+u[j-16]|0;for(k=a.h0,l=a.h1,m=a.h2,n=a.h3,o=a.h4,p=a.h5,q=a.h6,r=a.h7,j=0;j<64;++j)g=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),h=q^o&(p^q),e=(k>>>2|k<<30)^(k>>>13|k<<19)^(k>>>22|k<<10),i=k&l|m&(k^l),c=r+g+h+t[j]+u[j],d=e+i,r=q,q=p,p=o,o=n+c|0,n=m,m=l,l=k,k=c+d|0;a.h0=a.h0+k|0,a.h1=a.h1+l|0,a.h2=a.h2+m|0,a.h3=a.h3+n|0,a.h4=a.h4+o|0,a.h5=a.h5+p|0,a.h6=a.h6+q|0,a.h7=a.h7+r|0,s-=64}return a},f._createState=function(){var a={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225};return a.copy=function(){var b=f._createState();return b.h0=a.h0,b.h1=a.h1,b.h2=a.h2,b.h3=a.h3,b.h4=a.h4,b.h5=a.h5,b.h6=a.h6,b.h7=a.h7,b},a.write=function(b){b.putInt32(a.h0),b.putInt32(a.h1),b.putInt32(a.h2),b.putInt32(a.h3),b.putInt32(a.h4),b.putInt32(a.h5),b.putInt32(a.h6),b.putInt32(a.h7)},a},f._init=function(){f._k=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],f._w=new Array(64)}}(g),!m)var Ka=function(){m=b("xmldom").XMLSerializer};if(a.url={},a.url.parsers={simple:{keys:["href","scheme","authority","path","query","fragment"],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:["href","protocol","scheme","authority","auth","user","password","hostname","port","path","directory","file","query","fragment"],regex:/^(([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},a.url.parse=function(b,c){for(var d={},e=a.url.parsers[c||"full"],f=e.regex.exec(b),g=e.keys.length;g--;)d[e.keys[g]]=void 0===f[g]?null:f[g];return d.normalizedPath=La(d.path,!!d.authority),d},g?a.useDocumentLoader("node"):"undefined"!=typeof XMLHttpRequest&&a.useDocumentLoader("xhr"),g){a.use=function(c){switch(c){case"request":a.request=b("jsonld-request");break;default:throw new E("Unknown extension.","jsonld.UnknownExtension",{extension:c})}};var Ma={exports:{},filename:f};b("pkginfo")(Ma,"version"),a.version=Ma.exports.version}return a},j=function(){return i(function(){return j()})};return!g&&"function"==typeof a&&a.amd?a([],function(){return i(j),j}):(i(j),"function"==typeof b&&"undefined"!=typeof c&&c.exports&&(c.exports=j),h&&("undefined"==typeof jsonld?jsonld=jsonldjs=j:jsonldjs=j)),j}()}).call(this,b("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},"/node_modules/jsonld/js")},{_process:23,crypto:12,"es6-promise":6,http:12,"jsonld-request":12,pkginfo:12,request:12,util:12,xmldom:12}],14:[function(a,b,c){var d=a;a=function(){};var c=b.exports={Lexer:a("./lib/N3Lexer"),Parser:a("./lib/N3Parser"),Writer:a("./lib/N3Writer"),Store:a("./lib/N3Store"),StreamParser:a("./lib/N3StreamParser"),StreamWriter:a("./lib/N3StreamWriter"),Util:a("./lib/N3Util")};Object.keys(c).forEach(function(a){Object.defineProperty(c,a,{configurable:!0,enumerable:!0,get:function(){return delete c[a],c[a]=d("./lib/N3"+a)}})})},{"./lib/N3Lexer":15,"./lib/N3Parser":16,"./lib/N3Store":17,"./lib/N3StreamParser":18,"./lib/N3StreamWriter":19,"./lib/N3Util":20,"./lib/N3Writer":21}],15:[function(a,b,c){function i(a){if(!(this instanceof i))return new i(a);if(a&&a.lineMode){this._tripleQuotedString=this._number=this._boolean=/$0^/;var b=this;this._tokenize=this.tokenize,this.tokenize=function(a,c){this._tokenize(a,function(a,d){!a&&/^(?:IRI|prefixed|literal|langcode|type|\.|eof)$/.test(d.type)?c&&c(a,d):c&&c(a||b._syntaxError(d.type,c=null))})}}}var d=String.fromCharCode,e="function"==typeof setImmediate?setImmediate:function(b){setTimeout(b,0)},f=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\[uU]|\\(.)/g,g={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},h=/[\x00-\x20<>\\"\{\}\|\^\`]/;i.prototype={_iri:/^<((?:[^>\\]|\\[uU])+)>/,_unescapedIri:/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>/,_unescapedString:/^"[^"\\]+"(?=[^"\\])/,_singleQuotedString:/^"[^"\\]*(?:\\.[^"\\]*)*"(?=[^"\\])|^'[^'\\]*(?:\\.[^'\\]*)*'(?=[^'\\])/, _tripleQuotedString:/^""("[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*")""|^''('[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*')''/,_langcode:/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,_prefix:/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,_prefixed:/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?=\.?[,;\s#()\[\]\{\}"'<])/,_blank:/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=\.?[,;:\s#()\[\]\{\}"'<])/,_number:/^[\-+]?(?:\d+\.?\d*([eE](?:[\-\+])?\d+)|\d*\.?\d+)(?=[.,;:\s#()\[\]\{\}"'<])/,_boolean:/^(?:true|false)(?=[.,;:\s#()\[\]\{\}"'<])/,_keyword:/^@[a-z]+(?=[\s#<:])/,_sparqlKeyword:/^(?:PREFIX|BASE|GRAPH)(?=[\s#<:])/i,_shortPredicates:/^a(?=\s+|<)/,_newline:/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,_whitespace:/^[ \t]+/,_endOfFile:/^(?:#[^\n\r]*)?$/,_tokenizeToEnd:function(a,b){function o(b){a(b._syntaxError(/^\S*/.exec(c)[0]))}for(var c=this._input;;){for(var d;d=this._newline.exec(c);)c=c.substr(d[0].length,c.length),this._line++;if((d=this._whitespace.exec(c))&&(c=c.substr(d[0].length,c.length)),this._endOfFile.test(c))return b&&a(c=null,{line:this._line,type:"eof",value:"",prefix:""}),this._input=c;var m,e=this._line,f="",g="",i="",j=c[0],k=null,l=0,n=!1;switch(j){case"^":if(1===c.length)break;if("^"!==c[1])return o(this);if(this._prevTokenType="^",c=c.substr(2),"<"!==c[0]){n=!0;break}case"<":if(k=this._unescapedIri.exec(c))f="IRI",g=k[1];else if(k=this._iri.exec(c)){if(m=this._unescape(k[1]),null===m||h.test(m))return o(this);f="IRI",g=m}break;case"_":((k=this._blank.exec(c))||b&&(k=this._blank.exec(c+" ")))&&(f="prefixed",i="_",g=k[1]);break;case'"':case"'":if(k=this._unescapedString.exec(c))f="literal",g=k[0];else if(k=this._singleQuotedString.exec(c)){if(m=this._unescape(k[0]),null===m)return o(this);f="literal",g=m.replace(/^'|'$/g,'"')}else if(k=this._tripleQuotedString.exec(c)){if(m=k[1]||k[2],this._line+=m.split(/\r\n|\r|\n/).length-1,m=this._unescape(m),null===m)return o(this);f="literal",g=m.replace(/^'|'$/g,'"')}break;case"@":"literal"===this._prevTokenType&&(k=this._langcode.exec(c))?(f="langcode",g=k[1]):(k=this._keyword.exec(c))&&(f=k[0]);break;case".":if(1===c.length?b:c[1]<"0"||c[1]>"9"){f=".",l=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(k=this._number.exec(c))&&(f="literal",g='"'+k[0]+'"^^http://www.w3.org/2001/XMLSchema#'+(k[1]?"double":/^[+\-]?\d+$/.test(k[0])?"integer":"decimal"));break;case"B":case"b":case"p":case"P":case"G":case"g":(k=this._sparqlKeyword.exec(c))?f=k[0].toUpperCase():n=!0;break;case"f":case"t":(k=this._boolean.exec(c))?(f="literal",g='"'+k[0]+'"^^http://www.w3.org/2001/XMLSchema#boolean'):n=!0;break;case"a":(k=this._shortPredicates.exec(c))?(f="abbreviation",g="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"):n=!0;break;case",":case";":case"[":case"]":case"(":case")":case"{":case"}":l=1,f=j;break;default:n=!0}if(n&&("@prefix"!==this._prevTokenType&&"PREFIX"!==this._prevTokenType||!(k=this._prefix.exec(c))?((k=this._prefixed.exec(c))||b&&(k=this._prefixed.exec(c+" ")))&&(f="prefixed",i=k[1]||"",g=this._unescape(k[2])):(f="prefix",g=k[1]||"")),"^"===this._prevTokenType&&(f="IRI"===f||"prefixed"===f?"type":""),!f)return b||!/^'''|^"""/.test(c)&&/\n|\r/.test(c)?o(this):this._input=c;a(null,{line:e,type:f,value:g,prefix:i}),this._prevTokenType=f,c=c.substr(l||k[0].length,c.length)}},_unescape:function(a){try{return a.replace(f,function(a,b,c,e){var f;if(b){if(f=parseInt(b,16),isNaN(f))throw new Error;return d(f)}if(c){if(f=parseInt(c,16),isNaN(f))throw new Error;return f<=65535?d(f):d(55296+(f-=65536)/1024,56320+(1023&f))}var h=g[e];if(!h)throw new Error;return h})}catch(a){return null}},_syntaxError:function(a){return this._input=null,new Error('Syntax error: unexpected "'+a+'" on line '+this._line+".")},tokenize:function(a,b){function d(a){null!==c._input&&(c._input+=a,c._tokenizeToEnd(b,!1))}function f(){null!==c._input&&c._tokenizeToEnd(b,!0)}var c=this;this._line=1,"string"==typeof a?(this._input=a,e(function(){c._tokenizeToEnd(b,!0)})):(this._input="",a&&"function"!=typeof a?("function"==typeof a.setEncoding&&a.setEncoding("utf8"),a.on("data",d),a.on("end",f)):(this.addChunk=d,this.end=f,b||(b=a)))}},b.exports=i},{}],16:[function(a,b,c){function n(a){if(!(this instanceof n))return new n(a);this._tripleStack=[],this._graph=null,a=a||{},this._setBase(a.documentIRI);var b="string"==typeof a.format&&a.format.match(/\w*$/)[0].toLowerCase(),c="turtle"===b,e="trig"===b,f=/triple/.test(b),g=/quad/.test(b),h=f||g;(this._supportsNamedGraphs=!c)||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(c||e||f),h&&(this._base="",this._resolveIRI=function(a){return this._error("Disallowed relative IRI",a),this._callback=o,this._subject=null}),this._blankNodePrefix="string"!=typeof a.blankNodePrefix?"":"_:"+a.blankNodePrefix.replace(/^_:/,""),this._lexer=a.lexer||new d({lineMode:h})}function o(){}var d=a("./N3Lexer"),e="http://www.w3.org/1999/02/22-rdf-syntax-ns#",f=e+"nil",g=e+"first",h=e+"rest",i=/^[a-z][a-z0-9+.-]*:/i,j=/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i,k=/(?:^|\/)\.\.?(?:$|[\/#?])/,l=0,m=0;n._resetBlankNodeIds=function(){l=m=0},n.prototype={_setBase:function(a){if(a){if(a.indexOf("#")>=0)throw new Error("Invalid base IRI "+a)}else a=null;(this._base=a)&&(this._basePath=a.replace(/[^\/?]*(?:\?.*)?$/,""),a=a.match(j),this._baseRoot=a[0],this._baseScheme=a[1])},_readInTopContext:function(a){switch(a.type){case"eof":return null!==this._graph?this._error("Unclosed graph",a):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"@prefix":return this._sparqlStyle=!1,this._readPrefix;case"PREFIX":return this._sparqlStyle=!0,this._readPrefix;case"@base":return this._sparqlStyle=!1,this._readBaseIRI;case"BASE":return this._sparqlStyle=!0,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(a)}},_readSubject:function(a){switch(this._predicate=null,a.type){case"IRI":null===this._base||i.test(a.value)?this._subject=a.value:this._subject=this._resolveIRI(a);break;case"prefixed":var b=this._prefixes[a.prefix];if(void 0===b)return this._error('Undefined prefix "'+a.prefix+':"',a);this._subject=b+a.value;break;case"[":return this._subject="_:b"+m++,this._tripleStack.push({subject:this._subject,predicate:null,object:null,type:"blank"}),this._readBlankNodeHead;case"(":return this._tripleStack.push({subject:f,predicate:null,object:null,type:"list"}),this._subject=null,this._readListItem;case"}":return this._readPunctuation(a);default:return this._error("Expected subject but got "+a.type,a)}return this._readPredicateOrNamedGraph},_readPredicate:function(a){var b=a.type;switch(b){case"IRI":case"abbreviation":null===this._base||i.test(a.value)?this._predicate=a.value:this._predicate=this._resolveIRI(a);break;case"prefixed":if("_"===a.prefix)return this._error("Disallowed blank node as predicate",a);var c=this._prefixes[a.prefix];if(void 0===c)return this._error('Undefined prefix "'+a.prefix+':"',a);this._predicate=c+a.value;break;case".":case"]":case"}":return null===this._predicate?this._error("Unexpected "+b,a):(this._subject=null,"]"===b?this._readBlankNodeTail(a):this._readPunctuation(a));case";":return this._readPredicate;default:return this._error('Expected predicate to follow "'+this._subject+'"',a)}return this._readObject},_readObject:function(a){switch(a.type){case"IRI":null===this._base||i.test(a.value)?this._object=a.value:this._object=this._resolveIRI(a);break;case"prefixed":var b=this._prefixes[a.prefix];if(void 0===b)return this._error('Undefined prefix "'+a.prefix+':"',a);this._object=b+a.value;break;case"literal":return this._object=a.value,this._readDataTypeOrLang;case"[":var c="_:b"+m++;return this._tripleStack.push({subject:this._subject,predicate:this._predicate,object:c,type:"blank"}),this._subject=c,this._readBlankNodeHead;case"(":return this._tripleStack.push({subject:this._subject,predicate:this._predicate,object:f,type:"list"}),this._subject=null,this._readListItem;default:return this._error('Expected object to follow "'+this._predicate+'"',a)}return this._getTripleEndReader()},_readPredicateOrNamedGraph:function(a){return"{"===a.type?this._readGraph(a):this._readPredicate(a)},_readGraph:function(a){return"{"!==a.type?this._error("Expected graph but got "+a.type,a):(this._graph=this._subject,this._subject=null,this._readSubject)},_readBlankNodeHead:function(a){return"]"===a.type?(this._subject=null,this._readBlankNodeTail(a)):(this._predicate=null,this._readPredicate(a))},_readBlankNodeTail:function(a){if("]"!==a.type)return this._readBlankNodePunctuation(a);null!==this._subject&&this._callback(null,{subject:this._subject,predicate:this._predicate,object:this._object,graph:this._graph||""});var b=this._tripleStack.pop();return this._subject=b.subject,null!==b.object?(this._predicate=b.predicate,this._object=b.object,this._getTripleEndReader()):null!==this._predicate?this._readPredicate:this._readPredicateOrNamedGraph},_readDataTypeOrLang:function(a){switch(a.type){case"type":var b;if(""===a.prefix)b=null===this._base||i.test(a.value)?a.value:this._resolveIRI(a);else{var c=this._prefixes[a.prefix];if(void 0===c)return this._error('Undefined prefix "'+a.prefix+':"',a);b=c+a.value}return this._object+="^^"+b,this._getTripleEndReader();case"langcode":return this._object+="@"+a.value.toLowerCase(),this._getTripleEndReader();default:return this._getTripleEndReader().call(this,a)}},_readListItem:function(a){var b=null,c=null,d=this._subject,e=this._tripleStack,j=e[e.length-1],k=this._readListItem;switch(a.type){case"IRI":b=null===this._base||i.test(a.value)?a.value:this._resolveIRI(a);break;case"prefixed":var l=this._prefixes[a.prefix];if(void 0===l)return this._error('Undefined prefix "'+a.prefix+':"',a);b=l+a.value;break;case"literal":b=a.value,k=this._readDataTypeOrLang;break;case"[":c="_:b"+m++,b="_:b"+m++,e.push({subject:c,predicate:g,object:b,type:"blank"}),this._subject=b,k=this._readBlankNodeHead;break;case"(":c="_:b"+m++,e.push({subject:c,predicate:g,object:f,type:"list"}),this._subject=null,k=this._readListItem;break;case")":if(e.pop(),0!==e.length&&"list"===e[e.length-1].type&&this._callback(null,{subject:j.subject,predicate:j.predicate,object:j.object,graph:this._graph||""}),this._subject=j.subject,null===j.predicate){if(k=this._readPredicate,j.subject===f)return k}else if(this._predicate=j.predicate,this._object=j.object,k=this._getTripleEndReader(),j.object===f)return k;c=f;break;default:return this._error('Expected list item instead of "'+a.type+'"',a)}return null===c&&(this._subject=c="_:b"+m++),null===d?j.object===f?j.object=c:j.subject=c:this._callback(null,{subject:d,predicate:h,object:c,graph:this._graph||""}),null!==b&&this._callback(null,{subject:c,predicate:g,object:b,graph:this._graph||""}),k},_readPunctuation:function(a){var b,c=this._subject,d=this._graph;switch(a.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",a);this._graph=null;case".":this._subject=null,b=this._readInTopContext;break;case";":b=this._readPredicate;break;case",":b=this._readObject;break;case"IRI":if(this._supportsQuads&&null===this._graph){d=null===this._base||i.test(a.value)?a.value:this._resolveIRI(a),c=this._subject,b=this._readQuadPunctuation;break}case"prefixed":if(this._supportsQuads&&null===this._graph){var e=this._prefixes[a.prefix];if(void 0===e)return this._error('Undefined prefix "'+a.prefix+':"',a);d=e+a.value,b=this._readQuadPunctuation;break}default:return this._error('Expected punctuation to follow "'+this._object+'"',a)}return null!==c&&this._callback(null,{subject:c,predicate:this._predicate,object:this._object,graph:d||""}),b},_readBlankNodePunctuation:function(a){var b;switch(a.type){case";":b=this._readPredicate;break;case",":b=this._readObject;break;default:return this._error('Expected punctuation to follow "'+this._object+'"',a)}return this._callback(null,{subject:this._subject,predicate:this._predicate,object:this._object,graph:this._graph||""}),b},_readQuadPunctuation:function(a){return"."!==a.type?this._error("Expected dot to follow quad",a):this._readInTopContext},_readPrefix:function(a){return"prefix"!==a.type?this._error("Expected prefix to follow @prefix",a):(this._prefix=a.value,this._readPrefixIRI)},_readPrefixIRI:function(a){if("IRI"!==a.type)return this._error('Expected IRI to follow prefix "'+this._prefix+':"',a);var b;return b=null===this._base||i.test(a.value)?a.value:this._resolveIRI(a),this._prefixes[this._prefix]=b,this._prefixCallback(this._prefix,b),this._readDeclarationPunctuation},_readBaseIRI:function(a){if("IRI"!==a.type)return this._error("Expected IRI to follow base declaration",a);try{this._setBase(null===this._base||i.test(a.value)?a.value:this._resolveIRI(a))}catch(b){this._error(b.message,a)}return this._readDeclarationPunctuation},_readNamedGraphLabel:function(a){switch(a.type){case"IRI":case"prefixed":return this._readSubject(a),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",a)}},_readNamedGraphBlankLabel:function(a){return"]"!==a.type?this._error("Invalid graph label",a):(this._subject="_:b"+m++,this._readGraph)},_readDeclarationPunctuation:function(a){return this._sparqlStyle?this._readInTopContext(a):"."!==a.type?this._error("Expected declaration to end with a dot",a):this._readInTopContext},_getTripleEndReader:function(){var a=this._tripleStack;if(0===a.length)return this._readPunctuation;switch(a[a.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem}},_error:function(a,b){this._callback(new Error(a+" at line "+b.line+"."))},_resolveIRI:function(a){var b=a.value;switch(b[0]){case void 0:return this._base;case"#":return this._base+b;case"?":return this._base.replace(/(?:\?.*)?$/,b);case"/":return("/"===b[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(b);default:return this._removeDotSegments(this._basePath+b)}},_removeDotSegments:function(a){if(!k.test(a))return a;for(var b="",c=a.length,d=-1,e=-1,f=0,g="/";d=e&&(b=b.substr(0,f)),"/"!==g)return b+"/"+a.substr(d+1);f=d+1}}}g=a[++d]}return b+a.substring(f)},parse:function(a,b,c){this._readCallback=this._readInTopContext,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix||"_:b"+l++ +"_","function"==typeof a&&(c=b,b=a,a=null),this._callback=b||o,this._prefixCallback=c||o;var d=this;this._lexer.tokenize(a,function(a,b){null!==a?(d._callback(a),d._callback=o):void 0!==d._readCallback&&(d._readCallback=d._readCallback(b))}),a||(this.addChunk=this._lexer.addChunk,this.end=this._lexer.end)}},b.exports=n},{"./N3Lexer":15}],17:[function(a,b,c){function e(a,b){return this instanceof e?(this._size=0,this._graphs=Object.create(null),this._entities=Object.create(null),this._entities["><"]=0,this._entityCount=0,this._blankNodeIndex=0,b||!a||a[0]||(b=a,a=null),this._prefixes=Object.create(null),b&&b.prefixes&&this.addPrefixes(b.prefixes),void(a&&this.addTriples(a))):new e(a,b)}var d=a("./N3Util").expandPrefixedName;e.prototype={get size(){var a=this._size;if(null!==a)return a;var c,d,b=this._graphs;for(var e in b)for(var f in c=b[e].subjects)for(var g in d=c[f])a+=Object.keys(d[g]).length;return this._size=a},_addToIndex:function(a,b,c,d){var e=a[b]||(a[b]={}),f=e[c]||(e[c]={});f[d]=null},_removeFromIndex:function(a,b,c,d){var g,e=a[b],f=e[c];delete f[d];for(g in f)return;delete e[c];for(g in e)return;delete a[b]},_findInIndex:function(a,b,c,d,e,f,g,h){var k,l,m,i=[],j=Object.keys(this._entities);b&&((k=a,a={})[b]=k[b]);for(var n in a){var o=j[n];if(l=a[n]){c&&((k=l,l={})[c]=k[c]);for(var p in l){var q=j[p];if(m=l[p])for(var r=(d?d in m?[d]:[]:Object.keys(m)),s=r.length-1;s>=0;s--){var t={subject:"",predicate:"",object:"",graph:h};t[e]=o,t[f]=q,t[g]=j[r[s]],i.push(t)}}}}return i},_countInIndex:function(a,b,c,d){var f,g,h,e=0;b&&((f=a,a={})[b]=f[b]);for(var i in a)if(g=a[i]){c&&((f=g,g={})[c]=f[c]);for(var j in g)(h=g[j])&&(d?d in h&&e++:e+=Object.keys(h).length)}return e},addTriple:function(a,b,c,d){b||(d=a.graph,c=a.object,b=a.predicate,a=a.subject),d=d||"";var e=this._graphs[d];e||(e=this._graphs[d]={subjects:{},predicates:{},objects:{}},Object.freeze(e));var f=this._entities;a=f[a]||(f[a]=++this._entityCount),b=f[b]||(f[b]=++this._entityCount),c=f[c]||(f[c]=++this._entityCount),this._addToIndex(e.subjects,a,b,c),this._addToIndex(e.predicates,b,c,a),this._addToIndex(e.objects,c,a,b),this._size=null},addTriples:function(a){for(var b=a.length-1;b>=0;b--)this.addTriple(a[b])},addPrefix:function(a,b){this._prefixes[a]=b},addPrefixes:function(a){for(var b in a)this.addPrefix(b,a[b])},removeTriple:function(a,b,c,d){b||(d=a.graph,c=a.object,b=a.predicate,a=a.subject),d=d||"";var e,f=this._entities,g=this._graphs;if((a=f[a])&&(b=f[b])&&(c=f[c])&&(e=g[d])){var h,i;if((h=e.subjects[a])&&(i=h[b])&&c in i){this._removeFromIndex(e.subjects,a,b,c),this._removeFromIndex(e.predicates,b,c,a),this._removeFromIndex(e.objects,c,a,b),null!==this._size&&this._size--;for(a in e.subjects)return;delete g[d]}}},removeTriples:function(a){for(var b=a.length-1;b>=0;b--)this.removeTriple(a[b])},find:function(a,b,c,e){var f=this._prefixes;return this.findByIRI(d(a,f),d(b,f),d(c,f),d(e,f))},findByIRI:function(a,b,c,d){d=d||"";var e=this._graphs[d],f=this._entities;return e?a&&!(a=f[a])?[]:b&&!(b=f[b])?[]:c&&!(c=f[c])?[]:a?c?this._findInIndex(e.objects,c,a,b,"object","subject","predicate",d):this._findInIndex(e.subjects,a,b,null,"subject","predicate","object",d):b?this._findInIndex(e.predicates,b,c,null,"predicate","object","subject",d):c?this._findInIndex(e.objects,c,null,null,"object","subject","predicate",d):this._findInIndex(e.subjects,null,null,null,"subject","predicate","object",d):[]},count:function(a,b,c,e){var f=this._prefixes;return this.countByIRI(d(a,f),d(b,f),d(c,f),d(e,f))},countByIRI:function(a,b,c,d){d=d||"";var e=this._graphs[d],f=this._entities;return e?a&&!(a=f[a])?0:b&&!(b=f[b])?0:c&&!(c=f[c])?0:a?c?this._countInIndex(e.objects,c,a,b):this._countInIndex(e.subjects,a,b,c):b?this._countInIndex(e.predicates,b,c,a):this._countInIndex(e.objects,c,a,b):0},createBlankNode:function(a){var b,c;if(a)for(b=a="_:"+a,c=1;this._entities[b];)b=a+c++;else do b="_:b"+this._blankNodeIndex++;while(this._entities[b]);return this._entities[b]=++this._entityCount,b}},b.exports=e},{"./N3Util":20}],18:[function(a,b,c){function g(a){if(!(this instanceof g))return new g(a);d.call(this,{decodeStrings:!0}),this._readableState.objectMode=!0;var b=this,c=new f(a);c.parse(function(a,c){c&&b.push(c)||a&&b.emit("error",a)},this.emit.bind(this,"prefix")),this._transform=function(a,b,d){c.addChunk(a),d()},this._flush=function(a){c.end(),a()}}var d=a("stream").Transform,e=a("util"),f=a("./N3Parser.js");e.inherits(g,d),b.exports=g},{"./N3Parser.js":16,stream:34,util:38}],19:[function(a,b,c){function g(a){if(!(this instanceof g))return new g(a);d.call(this,{encoding:"utf8"}),this._writableState.objectMode=!0;var b=this,c=new f({write:function(a,c,d){b.push(a),d&&d()},end:function(a){b.push(null),a&&a()}},a);this._transform=function(a,b,d){c.addTriple(a,d)},this._flush=function(a){c.end(a)}}var d=a("stream").Transform,e=a("util"),f=a("./N3Writer.js");e.inherits(g,d),b.exports=g},{"./N3Writer.js":21,stream:34,util:38}],20:[function(a,b,c){function k(a,b){for(var c in j)b?a.prototype[c]=l(j[c]):a[c]=j[c];return a}function l(a){return function(b){return a(this,b)}}var d="http://www.w3.org/2001/XMLSchema#",e=d+"string",f=d+"integer",g=d+"decimal",h=d+"boolean",i="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",j={isIRI:function(a){if(!a)return a;var b=a[0];return'"'!==b&&"_"!==b},isLiteral:function(a){return a&&'"'===a[0]},isBlank:function(a){return a&&"_:"===a.substr(0,2)},getLiteralValue:function(a){var b=/^"([^]*)"/.exec(a);if(!b)throw new Error(a+" is not a literal");return b[1]},getLiteralType:function(a){var b=/^"[^]*"(?:\^\^([^"]+)|(@)[^@"]+)?$/.exec(a);if(!b)throw new Error(a+" is not a literal");return b[1]||(b[2]?i:e)},getLiteralLanguage:function(a){var b=/^"[^]*"(?:@([^@"]+)|\^\^[^"]+)?$/.exec(a);if(!b)throw new Error(a+" is not a literal");return b[1]?b[1].toLowerCase():""},isPrefixedName:function(a){return a&&/^[^:\/"']*:[^:\/"']+$/.test(a)},expandPrefixedName:function(a,b){var d,e,f,c=/(?:^|"\^\^)([^:\/#"'\^_]*):[^\/]*$/.exec(a);return c&&(d=c[1],e=b[d],f=c.index),void 0===e?a:0===f?e+a.substr(d.length+1):a.substr(0,f+3)+e+a.substr(f+d.length+4)},createIRI:function(a){return a&&'"'===a[0]?j.getLiteralValue(a):a},createLiteral:function(a,b){if(!b)switch(typeof a){case"boolean":b=h;break;case"number":if(isFinite(a)){b=a%1===0?f:g;break}default:return'"'+a+'"'}return'"'+a+(/^[a-z]+(-[a-z0-9]+)*$/i.test(b)?'"@'+b.toLowerCase():'"^^'+b)}};b.exports=k(k)},{}],21:[function(a,b,c){function j(a,b){if(!(this instanceof j))return new j(a,b);if(a&&"function"!=typeof a.write&&(b=a,a=null),b=b||{},a)this._outputStream=a,this._endStream=void 0===b.end||!!b.end;else{var c="";this._outputStream={write:function(a,b,d){c+=a,d&&d()},end:function(a){a&&a(null,c)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(b.format)?this._writeTriple=this._writeTripleLine:(this._graph="",this._prefixIRIs=Object.create(null),b.prefixes&&this.addPrefixes(b.prefixes))}function k(a){var b=i[a];return void 0===b&&(1===a.length?(b=a.charCodeAt(0).toString(16),b="\\u0000".substr(0,6-b.length)+b):(b=(1024*(a.charCodeAt(0)-55296)+a.charCodeAt(1)+9216).toString(16),b="\\U00000000".substr(0,10-b.length)+b)),b}var d=/^"([^]*)"(?:\^\^(.+)|@([\-a-z]+))?$/i,e="http://www.w3.org/1999/02/22-rdf-syntax-ns#",f=e+"type",g=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,h=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,i={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};j.prototype={_write:function(a,b){this._outputStream.write(a,"utf8",b)},_writeTriple:function(a,b,c,d,e){try{this._graph!==d&&(this._write((null===this._subject?"":this._graph?"\n}\n":".\n")+(d?this._encodeIriOrBlankNode(d)+" {\n":"")),this._subject=null,this._graph="["!==d[0]?d:"]"),this._subject===a?this._predicate===b?this._write(", "+this._encodeObject(c),e):this._write(";\n "+this._encodePredicate(this._predicate=b)+" "+this._encodeObject(c),e):this._write((null===this._subject?"":".\n")+this._encodeSubject(this._subject=a)+" "+this._encodePredicate(this._predicate=b)+" "+this._encodeObject(c),e)}catch(a){e&&e(a)}},_writeTripleLine:function(a,b,c,d,e){delete this._prefixMatch;try{this._write(this._encodeIriOrBlankNode(a)+" "+this._encodeIriOrBlankNode(b)+" "+this._encodeObject(c)+(d?" "+this._encodeIriOrBlankNode(d)+".\n":".\n"),e)}catch(a){e&&e(a)}},_encodeIriOrBlankNode:function(a){var b=a[0];if("["===b||"("===b||"_"===b&&":"===a[1])return a;g.test(a)&&(a=a.replace(h,k));var c=this._prefixRegex.exec(a);return c?c[1]?this._prefixIRIs[c[1]]+c[2]:a:"<"+a+">"},_encodeLiteral:function(a,b,c){return g.test(a)&&(a=a.replace(h,k)),c?'"'+a+'"@'+c:b?'"'+a+'"^^'+this._encodeIriOrBlankNode(b):'"'+a+'"'},_encodeSubject:function(a){if('"'===a[0])throw new Error("A literal as subject is not allowed: "+a);return"["===a[0]&&(this._subject="]"),this._encodeIriOrBlankNode(a)},_encodePredicate:function(a){if('"'===a[0])throw new Error("A literal as predicate is not allowed: "+a);return a===f?"a":this._encodeIriOrBlankNode(a)},_encodeObject:function(a){if('"'!==a[0])return this._encodeIriOrBlankNode(a);var b=d.exec(a);if(!b)throw new Error("Invalid literal: "+a);return this._encodeLiteral(b[1],b[2],b[3])},_blockedWrite:function(){throw new Error("Cannot write because the writer has been closed.")},addTriple:function(a,b,c,d,e){void 0===c?this._writeTriple(a.subject,a.predicate,a.object,a.graph||"",b):"string"!=typeof d?this._writeTriple(a,b,c,"",d):this._writeTriple(a,b,c,d,e)},addTriples:function(a){for(var b=0;b.\n"))}if(d){var g="",h="";for(var i in c)g+=g?"|"+i:i,h+=(h?"|":"")+c[i];g=g.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&"),this._prefixRegex=new RegExp("^(?:"+h+")[^/]*$|^("+g+")([a-zA-Z][\\-_a-zA-Z0-9]*)$")}this._write(d?"\n":"",b)},blank:function(a,b){var d,e,c=a;switch(void 0===a?c=[]:"string"==typeof a?c=[{predicate:a,object:b}]:"length"in a||(c=[a]),e=c.length){case 0:return"[]";case 1:if(d=c[0],"["!==d.object[0])return"[ "+this._encodePredicate(d.predicate)+" "+this._encodeObject(d.object)+" ]";default:for(var f="[",g=0;g1)for(var c=1;c0)if(b.ended&&!e){var g=new Error("stream.push() after EOF");a.emit("error",g)}else if(b.endEmitted&&e){ var g=new Error("stream.unshift() after end event");a.emit("error",g)}else{var h;!b.decoder||e||d||(c=b.decoder.write(c),h=!b.objectMode&&0===c.length),e||(b.reading=!1),h||(b.flowing&&0===b.length&&!b.sync?(a.emit("data",c),a.read(0)):(b.length+=b.objectMode?1:c.length,e?b.buffer.unshift(c):b.buffer.push(c),b.needReadable&&x(a))),z(a,b)}else e||(b.reading=!1);return r(b)}function r(a){return!a.ended&&(a.needReadable||a.length=s?a=s:(a--,a|=a>>>1,a|=a>>>2,a|=a>>>4,a|=a>>>8,a|=a>>>16,a++),a}function u(a,b){return 0===b.length&&b.ended?0:b.objectMode?0===a?0:1:null===a||isNaN(a)?b.flowing&&b.buffer.length?b.buffer[0].length:b.length:a<=0?0:(a>b.highWaterMark&&(b.highWaterMark=t(a)),a>b.length?b.ended?b.length:(b.needReadable=!0,0):a)}function v(a,b){var c=null;return f.isBuffer(b)||"string"==typeof b||null===b||void 0===b||a.objectMode||(c=new TypeError("Invalid non-string/buffer chunk")),c}function w(a,b){if(!b.ended){if(b.decoder){var c=b.decoder.end();c&&c.length&&(b.buffer.push(c),b.length+=b.objectMode?1:c.length)}b.ended=!0,x(a)}}function x(a){var b=a._readableState;b.needReadable=!1,b.emittedReadable||(l("emitReadable",b.flowing),b.emittedReadable=!0,b.sync?d(y,a):y(a))}function y(a){l("emit readable"),a.emit("readable"),F(a)}function z(a,b){b.readingMore||(b.readingMore=!0,d(A,a,b))}function A(a,b){for(var c=b.length;!b.reading&&!b.flowing&&!b.ended&&b.length=d)h=e?c.join(""):1===c.length?c[0]:f.concat(c,d),c.length=0;else if(a0)throw new Error("endReadable called on non-empty stream");b.endEmitted||(b.ended=!0,d(I,b,a))}function I(a,b){a.endEmitted||0!==a.length||(a.endEmitted=!0,b.readable=!1,b.emit("end"))}function J(a,b){for(var c=0,d=a.length;c0)&&(b.emittedReadable=!1),0===a&&b.needReadable&&(b.length>=b.highWaterMark||b.ended))return l("read: emitReadable",b.length,b.ended),0===b.length&&b.ended?H(this):x(this),null;if(a=u(a,b),0===a&&b.ended)return 0===b.length&&H(this),null;var d=b.needReadable;l("need readable",d),(0===b.length||b.length-a0?G(a,b):null,null===e&&(b.needReadable=!0,a=0),b.length-=a,0!==b.length||b.ended||(b.needReadable=!0),c!==a&&b.ended&&0===b.length&&H(this),null!==e&&this.emit("data",e),e},p.prototype._read=function(a){this.emit("error",new Error("not implemented"))},p.prototype.pipe=function(a,b){function k(a){l("onunpipe"),a===f&&p()}function m(){l("onend"),a.end()}function p(){l("cleanup"),a.removeListener("close",s),a.removeListener("finish",t),a.removeListener("drain",n),a.removeListener("error",r),a.removeListener("unpipe",k),f.removeListener("end",m),f.removeListener("end",p),f.removeListener("data",q),o=!0,!g.awaitDrain||a._writableState&&!a._writableState.needDrain||n()}function q(b){l("ondata");var c=a.write(b);!1===c&&(1!==g.pipesCount||g.pipes[0]!==a||1!==f.listenerCount("data")||o||(l("false write response, pause",f._readableState.awaitDrain),f._readableState.awaitDrain++),f.pause())}function r(b){l("onerror",b),u(),a.removeListener("error",r),0===h(a,"error")&&a.emit("error",b)}function s(){a.removeListener("finish",t),u()}function t(){l("onfinish"),a.removeListener("close",s),u()}function u(){l("unpipe"),f.unpipe(a)}var f=this,g=this._readableState;switch(g.pipesCount){case 0:g.pipes=a;break;case 1:g.pipes=[g.pipes,a];break;default:g.pipes.push(a)}g.pipesCount+=1,l("pipe count=%d opts=%j",g.pipesCount,b);var i=(!b||b.end!==!1)&&a!==c.stdout&&a!==c.stderr,j=i?m:p;g.endEmitted?d(j):f.once("end",j),a.on("unpipe",k);var n=B(f);a.on("drain",n);var o=!1;return f.on("data",q),a._events&&a._events.error?e(a._events.error)?a._events.error.unshift(r):a._events.error=[r,a._events.error]:a.on("error",r),a.once("close",s),a.once("finish",t),a.emit("pipe",f),g.flowing||(l("pipe resume"),f.resume()),a},p.prototype.unpipe=function(a){var b=this._readableState;if(0===b.pipesCount)return this;if(1===b.pipesCount)return a&&a!==b.pipes?this:(a||(a=b.pipes),b.pipes=null,b.pipesCount=0,b.flowing=!1,a&&a.emit("unpipe",this),this);if(!a){var c=b.pipes,d=b.pipesCount;b.pipes=null,b.pipesCount=0,b.flowing=!1;for(var e=0;e-1?setImmediate:d,f=a("buffer").Buffer;n.WritableState=m;var g=a("core-util-is");g.inherits=a("inherits");var i,h={deprecate:a("util-deprecate")};!function(){try{i=a("stream")}catch(a){}finally{i||(i=a("events").EventEmitter)}}();var f=a("buffer").Buffer;g.inherits(n,i);var l;m.prototype.getBuffer=function(){for(var b=this.bufferedRequest,c=[];b;)c.push(b),b=b.next;return c},function(){try{Object.defineProperty(m.prototype,"buffer",{get:h.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(a){}}();var l;n.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},n.prototype.write=function(a,b,c){var d=this._writableState,e=!1;return"function"==typeof b&&(c=b,b=null),f.isBuffer(a)?b="buffer":b||(b=d.defaultEncoding),"function"!=typeof c&&(c=j),d.ended?o(this,c):p(this,d,a,c)&&(d.pendingcb++,e=r(this,d,a,b,c)),e},n.prototype.cork=function(){var a=this._writableState;a.corked++},n.prototype.uncork=function(){var a=this._writableState;a.corked&&(a.corked--,a.writing||a.corked||a.finished||a.bufferProcessing||!a.bufferedRequest||y(this,a))},n.prototype.setDefaultEncoding=function(b){if("string"==typeof b&&(b=b.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((b+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+b);this._writableState.defaultEncoding=b},n.prototype._write=function(a,b,c){c(new Error("not implemented"))},n.prototype._writev=null,n.prototype.end=function(a,b,c){var d=this._writableState;"function"==typeof a?(c=a,a=null,b=null):"function"==typeof b&&(c=b,b=null),null!==a&&void 0!==a&&this.write(a,b),d.corked&&(d.corked=1,this.uncork()),d.ending||d.finished||C(this,d,c)}}).call(this,a("_process"))},{"./_stream_duplex":25,_process:23,buffer:4,"core-util-is":5,events:7,inherits:9,"process-nextick-args":22,"util-deprecate":36}],30:[function(a,b,c){b.exports=a("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":26}],31:[function(a,b,c){var d=function(){try{return a("stream")}catch(a){}}();c=b.exports=a("./lib/_stream_readable.js"),c.Stream=d||c,c.Readable=c,c.Writable=a("./lib/_stream_writable.js"),c.Duplex=a("./lib/_stream_duplex.js"),c.Transform=a("./lib/_stream_transform.js"),c.PassThrough=a("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":25,"./lib/_stream_passthrough.js":26,"./lib/_stream_readable.js":27,"./lib/_stream_transform.js":28,"./lib/_stream_writable.js":29}],32:[function(a,b,c){b.exports=a("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":28}],33:[function(a,b,c){b.exports=a("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":29}],34:[function(a,b,c){function f(){d.call(this)}b.exports=f;var d=a("events").EventEmitter,e=a("inherits");e(f,d),f.Readable=a("readable-stream/readable.js"),f.Writable=a("readable-stream/writable.js"),f.Duplex=a("readable-stream/duplex.js"),f.Transform=a("readable-stream/transform.js"),f.PassThrough=a("readable-stream/passthrough.js"),f.Stream=f,f.prototype.pipe=function(a,b){function e(b){a.writable&&!1===a.write(b)&&c.pause&&c.pause()}function f(){c.readable&&c.resume&&c.resume()}function h(){g||(g=!0,a.end())}function i(){g||(g=!0,"function"==typeof a.destroy&&a.destroy())}function j(a){if(k(),0===d.listenerCount(this,"error"))throw a}function k(){c.removeListener("data",e),a.removeListener("drain",f),c.removeListener("end",h),c.removeListener("close",i),c.removeListener("error",j),a.removeListener("error",j),c.removeListener("end",k),c.removeListener("close",k),a.removeListener("close",k)}var c=this;c.on("data",e),a.on("drain",f),a._isStdio||b&&b.end===!1||(c.on("end",h),c.on("close",i));var g=!1;return c.on("error",j),a.on("error",j),c.on("end",k),c.on("close",k),a.on("close",k),a.emit("pipe",c),a}},{events:7,inherits:9,"readable-stream/duplex.js":24,"readable-stream/passthrough.js":30,"readable-stream/readable.js":31,"readable-stream/transform.js":32,"readable-stream/writable.js":33}],35:[function(a,b,c){function f(a){if(a&&!e(a))throw new Error("Unknown encoding: "+a)}function h(a){return a.toString(this.encoding)}function i(a){this.charReceived=a.length%2,this.charLength=this.charReceived?2:0}function j(a){this.charReceived=a.length%3,this.charLength=this.charReceived?3:0}var d=a("buffer").Buffer,e=d.isEncoding||function(a){switch(a&&a.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},g=c.StringDecoder=function(a){switch(this.encoding=(a||"utf8").toLowerCase().replace(/[-_]/,""),f(a),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=i;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=j;break;default:return void(this.write=h)}this.charBuffer=new d(6),this.charReceived=0,this.charLength=0};g.prototype.write=function(a){for(var b="";this.charLength;){var c=a.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:a.length;if(a.copy(this.charBuffer,this.charReceived,0,c),this.charReceived+=c,this.charReceived=55296&&d<=56319)){if(this.charReceived=this.charLength=0,0===a.length)return b;break}this.charLength+=this.surrogateSize,b=""}this.detectIncompleteChar(a);var e=a.length;this.charLength&&(a.copy(this.charBuffer,0,a.length-this.charReceived,e),e-=this.charReceived),b+=a.toString(this.encoding,0,e);var e=b.length-1,d=b.charCodeAt(e);if(d>=55296&&d<=56319){var f=this.surrogateSize;return this.charLength+=f,this.charReceived+=f,this.charBuffer.copy(this.charBuffer,f,0,f),a.copy(this.charBuffer,0,0,f),b.substring(0,e)}return b},g.prototype.detectIncompleteChar=function(a){for(var b=a.length>=3?3:a.length;b>0;b--){var c=a[a.length-b];if(1==b&&c>>5==6){this.charLength=2;break}if(b<=2&&c>>4==14){this.charLength=3;break}if(b<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=b},g.prototype.end=function(a){var b="";if(a&&a.length&&(b=this.write(a)),this.charReceived){var c=this.charReceived,d=this.charBuffer,e=this.encoding;b+=d.slice(0,c).toString(e)}return b}},{buffer:4}],36:[function(a,b,c){(function(a){function c(a,b){function e(){if(!c){if(d("throwDeprecation"))throw new Error(b);d("traceDeprecation")?console.trace(b):console.warn(b),c=!0}return a.apply(this,arguments)}if(d("noDeprecation"))return a;var c=!1;return e}function d(b){try{if(!a.localStorage)return!1}catch(a){return!1}var c=a.localStorage[b];return null!=c&&"true"===String(c).toLowerCase()}b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(a,b,c){b.exports=function(b){return b&&"object"==typeof b&&"function"==typeof b.copy&&"function"==typeof b.fill&&"function"==typeof b.readUInt8}},{}],38:[function(a,b,c){(function(b,d){function h(a,b){var d={seen:[],stylize:j};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),s(b)?d.showHidden=b:b&&c._extend(d,b),y(d.showHidden)&&(d.showHidden=!1),y(d.depth)&&(d.depth=2),y(d.colors)&&(d.colors=!1),y(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=i),l(d,a,d.depth)}function i(a,b){var c=h.styles[b];return c?"["+h.colors[c][0]+"m"+a+"["+h.colors[c][1]+"m":a}function j(a,b){return a}function k(a){var b={};return a.forEach(function(a,c){b[a]=!0}),b}function l(a,b,d){if(a.customInspect&&b&&D(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return w(e)||(e=l(a,e,d)),e}var f=m(a,b);if(f)return f;var g=Object.keys(b),h=k(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),C(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return n(b);if(0===g.length){if(D(b)){var i=b.name?": "+b.name:"";return a.stylize("[Function"+i+"]","special")}if(z(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(B(b))return a.stylize(Date.prototype.toString.call(b),"date");if(C(b))return n(b)}var j="",s=!1,t=["{","}"];if(r(b)&&(s=!0,t=["[","]"]),D(b)){var u=b.name?": "+b.name:"";j=" [Function"+u+"]"}if(z(b)&&(j=" "+RegExp.prototype.toString.call(b)),B(b)&&(j=" "+Date.prototype.toUTCString.call(b)),C(b)&&(j=" "+n(b)),0===g.length&&(!s||0==b.length))return t[0]+j+t[1];if(d<0)return z(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var v;return v=s?o(a,b,d,h,g):g.map(function(c){return p(a,b,d,h,c,s)}),a.seen.pop(),q(v,j,t)}function m(a,b){if(y(b))return a.stylize("undefined","undefined");if(w(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return v(b)?a.stylize(""+b,"number"):s(b)?a.stylize(""+b,"boolean"):t(b)?a.stylize("null","null"):void 0}function n(a){return"["+Error.prototype.toString.call(a)+"]"}function o(a,b,c,d,e){for(var f=[],g=0,h=b.length;g-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),y(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function q(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function r(a){return Array.isArray(a)}function s(a){return"boolean"==typeof a}function t(a){return null===a}function u(a){return null==a}function v(a){return"number"==typeof a}function w(a){return"string"==typeof a}function x(a){return"symbol"==typeof a}function y(a){return void 0===a}function z(a){return A(a)&&"[object RegExp]"===F(a)}function A(a){return"object"==typeof a&&null!==a}function B(a){return A(a)&&"[object Date]"===F(a)}function C(a){return A(a)&&("[object Error]"===F(a)||a instanceof Error)}function D(a){return"function"==typeof a}function E(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function F(a){return Object.prototype.toString.call(a)}function G(a){return a<10?"0"+a.toString(10):a.toString(10)}function I(){var a=new Date,b=[G(a.getHours()),G(a.getMinutes()),G(a.getSeconds())].join(":");return[a.getDate(),H[a.getMonth()],b].join(" ")}function J(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var e=/%[sdj%]/g;c.format=function(a){if(!w(a)){for(var b=[],c=0;c=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(a){return"[Circular]"}default:return a}}),i=d[c];c=b+c||b?new java.lang.String(a,b,c)+"":a}function j(a,b){a.currentElement?a.currentElement.appendChild(b):a.document.appendChild(b)}if(d.prototype.parseFromString=function(a,b){var c=this.options,d=new k,g=c.domBuilder||new f,h=c.errorHandler,i=c.locator,j=c.xmlns||{},l={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return i&&g.setDocumentLocator(i),d.errorHandler=e(h,g,i),d.domBuilder=c.domBuilder||g,/\/x?html?$/.test(b)&&(l.nbsp=" ",l.copy="©",j[""]="http://www.w3.org/1999/xhtml"),j.xml=j.xml||"http://www.w3.org/XML/1998/namespace",a?d.parse(a,j,l):d.errorHandler.error("invalid document source"),g.document},f.prototype={startDocument:function(){this.document=(new l).createDocument(null,null,null),this.locator&&(this.document.documentURI=this.locator.systemId)},startElement:function(a,b,c,d){var e=this.document,f=e.createElementNS(a,c||b),h=d.length;j(this,f),this.currentElement=f,this.locator&&g(this.locator,f);for(var i=0;i=0))throw K(C,new Error);for(var e=b.length-1;d"==a&&">"||"&"==a&&"&"||'"'==a&&"""||"&#"+a.charCodeAt()+";"}function V(a,b){if(b(a))return!0;if(a=a.firstChild)do if(V(a,b))return!0;while(a=a.nextSibling)}function W(){}function X(a,b,c){a&&a._inc++;var d=c.namespaceURI;"http://www.w3.org/2000/xmlns/"==d&&(b._nsMap[c.prefix?c.localName:""]=c.value)}function Y(a,b,c,d){a&&a._inc++;var e=c.namespaceURI;"http://www.w3.org/2000/xmlns/"==e&&delete b._nsMap[c.prefix?c.localName:""]}function Z(a,b,c){if(a&&a._inc){a._inc++;var d=b.childNodes;if(c)d[d.length++]=c;else{for(var e=b.firstChild,f=0;e;)d[f++]=e,e=e.nextSibling;d.length=f}}}function $(a,b){var c=b.previousSibling,d=b.nextSibling;return c?c.nextSibling=d:a.firstChild=d,d?d.previousSibling=c:a.lastChild=c,Z(a.ownerDocument,a),b}function _(a,b,c){var d=b.parentNode;if(d&&d.removeChild(b),b.nodeType===r){var e=b.firstChild;if(null==e)return b;var f=b.lastChild}else e=f=b;var g=c?c.previousSibling:a.lastChild;e.previousSibling=g,f.nextSibling=c,g?g.nextSibling=e:a.firstChild=e,null==c?a.lastChild=f:c.previousSibling=f;do e.parentNode=a;while(e!==f&&(e=e.nextSibling));return Z(a.ownerDocument||a,a),b.nodeType==r&&(b.firstChild=b.lastChild=null),b}function aa(a,b){var c=b.parentNode;if(c){var d=a.lastChild;c.removeChild(b);var d=a.lastChild}var d=a.lastChild;return b.parentNode=a,b.previousSibling=d,b.nextSibling=null,d?d.nextSibling=b:a.firstChild=b,a.lastChild=b,Z(a.ownerDocument,a,b),b}function ba(){this._nsMap={}}function ca(){}function da(){}function ea(){}function fa(){}function ga(){}function ha(){}function ia(){}function ja(){}function ka(){}function la(){}function ma(){}function na(){}function oa(a,b,c,d){switch(a.nodeType){case h:var e=a.attributes,g=e.length,m=a.firstChild,s=a.tagName;d=f===a.namespaceURI||d,b.push("<",s),c&&b.sort.apply(e,c);for(var t=0;t"),d&&/^script$/i.test(s))m&&b.push(m.data);else for(;m;)oa(m,b,c,d),m=m.nextSibling;b.push("")}else b.push("/>");return;case p:case r:for(var m=a.firstChild;m;)oa(m,b,c,d),m=m.nextSibling;return;case i:return b.push(" ",a.name,'="',a.value.replace(/[<&"]/g,U),'"');case j:return b.push(a.data.replace(/[<&]/g,U));case k:return b.push("");case o:return b.push("");case q:var u=a.publicId,v=a.systemId;if(b.push("');else if(v&&"."!=v)b.push(' SYSTEM "',v,'">');else{var w=a.internalSubset;w&&b.push(" [",w,"]"),b.push(">")}return;case n:return b.push("");case l:return b.push("&",a.nodeName,";");default:b.push("??",a.nodeName)}}function pa(a,b,c){var d;switch(b.nodeType){case h:d=b.cloneNode(!1),d.ownerDocument=a;case r:break;case i:c=!0}if(d||(d=b.cloneNode(!1)),d.ownerDocument=a,d.parentNode=null,c)for(var e=b.firstChild;e;)d.appendChild(pa(a,e,c)),e=e.nextSibling;return d}function qa(a,b,c){var d=new b.constructor;for(var e in b){var f=b[e];"object"!=typeof f&&f!=d[e]&&(d[e]=f)}switch(b.childNodes&&(d.childNodes=new L),d.ownerDocument=a,d.nodeType){case h:var g=b.attributes,j=d.attributes=new O,k=g.length;j._ownerElement=d;for(var l=0;l0},lookupPrefix:function(a){for(var b=this;b;){var c=b._nsMap;if(c)for(var d in c)if(c[d]==a)return d;b=2==b.nodeType?b.ownerDocument:b.parentNode}return null},lookupNamespaceURI:function(a){for(var b=this;b;){var c=b._nsMap;if(c&&a in c)return c[a];b=2==b.nodeType?b.ownerDocument:b.parentNode}return null},isDefaultNamespace:function(a){var b=this.lookupPrefix(a);return null==b}},d(g,T),d(g,T.prototype),W.prototype={nodeName:"#document",nodeType:p,doctype:null,documentElement:null,_inc:1,insertBefore:function(a,b){if(a.nodeType==r){for(var c=a.firstChild;c;){var d=c.nextSibling;this.insertBefore(c,b),c=d}return a}return null==this.documentElement&&1==a.nodeType&&(this.documentElement=a),_(this,a,b),a.ownerDocument=this,a},removeChild:function(a){return this.documentElement==a&&(this.documentElement=null),$(this,a)},importNode:function(a,b){return pa(this,a,b)},getElementById:function(a){var b=null;return V(this.documentElement,function(c){if(1==c.nodeType&&c.getAttribute("id")==a)return b=c,!0}),b},createElement:function(a){var b=new ba;b.ownerDocument=this,b.nodeName=a,b.tagName=a,b.childNodes=new L;var c=b.attributes=new O;return c._ownerElement=b,b},createDocumentFragment:function(){var a=new la;return a.ownerDocument=this,a.childNodes=new L,a},createTextNode:function(a){var b=new ea;return b.ownerDocument=this,b.appendData(a),b},createComment:function(a){var b=new fa;return b.ownerDocument=this,b.appendData(a),b},createCDATASection:function(a){var b=new ga;return b.ownerDocument=this,b.appendData(a),b},createProcessingInstruction:function(a,b){var c=new ma;return c.ownerDocument=this,c.tagName=c.target=a,c.nodeValue=c.data=b,c},createAttribute:function(a){var b=new ca;return b.ownerDocument=this,b.name=a,b.nodeName=a,b.localName=a,b.specified=!0,b},createEntityReference:function(a){var b=new ka;return b.ownerDocument=this,b.nodeName=a,b},createElementNS:function(a,b){var c=new ba,d=b.split(":"),e=c.attributes=new O;return c.childNodes=new L,c.ownerDocument=this,c.nodeName=b,c.tagName=b,c.namespaceURI=a,2==d.length?(c.prefix=d[0],c.localName=d[1]):c.localName=b,e._ownerElement=c,c},createAttributeNS:function(a,b){var c=new ca,d=b.split(":");return c.ownerDocument=this,c.nodeName=b,c.name=b,c.namespaceURI=a,c.specified=!0,2==d.length?(c.prefix=d[0],c.localName=d[1]):c.localName=b,c}},e(W,T),ba.prototype={nodeType:h,hasAttribute:function(a){return null!=this.getAttributeNode(a)},getAttribute:function(a){var b=this.getAttributeNode(a);return b&&b.value||""},getAttributeNode:function(a){return this.attributes.getNamedItem(a)},setAttribute:function(a,b){var c=this.ownerDocument.createAttribute(a);c.value=c.nodeValue=""+b,this.setAttributeNode(c)},removeAttribute:function(a){var b=this.getAttributeNode(a);b&&this.removeAttributeNode(b)},appendChild:function(a){return a.nodeType===r?this.insertBefore(a,null):aa(this,a)},setAttributeNode:function(a){return this.attributes.setNamedItem(a)},setAttributeNodeNS:function(a){return this.attributes.setNamedItemNS(a)},removeAttributeNode:function(a){return this.attributes.removeNamedItem(a.nodeName)},removeAttributeNS:function(a,b){var c=this.getAttributeNodeNS(a,b);c&&this.removeAttributeNode(c)},hasAttributeNS:function(a,b){return null!=this.getAttributeNodeNS(a,b)},getAttributeNS:function(a,b){var c=this.getAttributeNodeNS(a,b);return c&&c.value||""},setAttributeNS:function(a,b,c){var d=this.ownerDocument.createAttributeNS(a,b);d.value=d.nodeValue=""+c,this.setAttributeNode(d)},getAttributeNodeNS:function(a,b){return this.attributes.getNamedItemNS(a,b)},getElementsByTagName:function(a){return new M(this,function(b){var c=[];return V(b,function(d){d===b||d.nodeType!=h||"*"!==a&&d.tagName!=a||c.push(d)}),c})},getElementsByTagNameNS:function(a,b){return new M(this,function(c){var d=[];return V(c,function(e){e===c||e.nodeType!==h||"*"!==a&&e.namespaceURI!==a||"*"!==b&&e.localName!=b||d.push(e)}),d})}},W.prototype.getElementsByTagName=ba.prototype.getElementsByTagName,W.prototype.getElementsByTagNameNS=ba.prototype.getElementsByTagNameNS,e(ba,T),ca.prototype.nodeType=i,e(ca,T),da.prototype={data:"",substringData:function(a,b){return this.data.substring(a,a+b)},appendData:function(a){a=this.data+a,this.nodeValue=this.data=a,this.length=a.length},insertData:function(a,b){this.replaceData(a,0,b)},appendChild:function(a){throw new Error(u[3])},deleteData:function(a,b){this.replaceData(a,b,"")},replaceData:function(a,b,c){var d=this.data.substring(0,a),e=this.data.substring(a+b);c=d+c+e,this.nodeValue=this.data=c,this.length=c.length}},e(da,T),ea.prototype={nodeName:"#text",nodeType:j,splitText:function(a){var b=this.data,c=b.substring(a);b=b.substring(0,a),this.data=this.nodeValue=b,this.length=b.length;var d=this.ownerDocument.createTextNode(c);return this.parentNode&&this.parentNode.insertBefore(d,this.nextSibling),d}},e(ea,da),fa.prototype={nodeName:"#comment",nodeType:o},e(fa,da),ga.prototype={nodeName:"#cdata-section",nodeType:k},e(ga,da),ha.prototype.nodeType=q,e(ha,T),ia.prototype.nodeType=s,e(ia,T),ja.prototype.nodeType=m,e(ja,T),ka.prototype.nodeType=l,e(ka,T),la.prototype.nodeName="#document-fragment",la.prototype.nodeType=r,e(la,T),ma.prototype.nodeType=n,e(ma,T),na.prototype.serializeToString=function(a,b){return a.toString(b)},T.prototype.toString=function(a){var b=[];return oa(this,b,a),b.join("")};try{Object.defineProperty&&(Object.defineProperty(M.prototype,"length",{get:function(){return N(this),this.$$length}}),Object.defineProperty(T.prototype,"textContent",{get:function(){return sa(this)},set:function(a){switch(this.nodeType){case 1:case 11:for(;this.firstChild;)this.removeChild(this.firstChild);(a||String(a))&&this.appendChild(this.ownerDocument.createTextNode(a));break;default:this.data=a,this.value=value,this.nodeValue=a}}}),ra=function(a,b,c){a["$$"+b]=c})}catch(a){}"function"==typeof a&&(c.DOMImplementation=S,c.XMLSerializer=na)},{}],41:[function(a,b,c){function o(){}function p(a,b,c,d,e){function f(a){if(a>65535){a-=65536;var b=55296+(a>>10),c=56320+(1023&a);return String.fromCharCode(b,c)}return String.fromCharCode(a)}function g(a){var b=a.slice(1,-1);return b in c?c[b]:"#"===b.charAt(0)?f(parseInt(b.substr(1).replace("x","0x"))):(e.error("entity not found:"+a),a)}function h(b){if(b>p){var c=a.substring(p,b).replace(/&#?\w+;/g,g);m&&i(p),d.characters(c,0,b-p),p=b}}function i(b,c){for(;b>=k&&(c=l.exec(a));)j=c.index,k=j+c[0].length,m.lineNumber++;m.columnNumber=b-j+1}for(var j=0,k=0,l=/.+(?:\r\n?|\n)|.*$/g,m=d.locator,n=[{currentNSMap:b}],o={},p=0;;){try{var v=a.indexOf("<",p);if(v<0){if(!a.substr(p).match(/^\s*$/)){var z=d.document,A=z.createTextNode(a.substr(p));z.appendChild(A),d.currentElement=A}return}switch(v>p&&h(v),a.charAt(v+1)){case"/":var B=a.indexOf(">",v+3),C=a.substring(v+2,B),D=n.pop(),E=D.localNSMap;if(D.tagName!=C&&e.fatalError("end tag name: "+C+" is not match the current start tagName:"+D.tagName),d.endElement(D.uri,D.localName,C),E)for(var F in E)d.endPrefixMapping(F);B++;break;case"?":m&&i(v),B=x(a,v,d);break;case"!":m&&i(v),B=w(a,v,d,e);break;default:m&&i(v);var G=new y,B=r(a,v,G,g,e),H=G.length;if(m){if(H)for(var I=0;Ip?p=B:h(Math.max(v,p)+1)}}function q(a,b){return b.lineNumber=a.lineNumber,b.columnNumber=a.columnNumber,b}function r(a,b,c,d,e){for(var f,o,p=++b,q=g;;){var r=a.charAt(p);switch(r){case"=":if(q===h)f=a.slice(b,p),q=j;else{if(q!==i)throw new Error("attribute equal must after attrName");q=j}break;case"'":case'"':if(q===j){if(b=p+1,p=a.indexOf(r,b),!(p>0))throw new Error("attribute value no end '"+r+"' match");o=a.slice(b,p).replace(/&#?\w+;/g,d),c.add(f,o,b-1),q=l}else{if(q!=k)throw new Error('attribute value must after "="');o=a.slice(b,p).replace(/&#?\w+;/g,d),c.add(f,o,b),e.warning('attribute "'+f+'" missed start quot('+r+")!!"),b=p+1,q=l}break;case"/":switch(q){case g:c.setTagName(a.slice(b,p));case l:case m:case n:q=n,c.closed=!0;case k:case h:case i:break;default:throw new Error("attribute invalid close char('/')")}break;case"":e.error("unexpected end of input");case">":switch(q){case g:c.setTagName(a.slice(b,p));case l:case m:case n:break;case k:case h:o=a.slice(b,p),"/"===o.slice(-1)&&(c.closed=!0,o=o.slice(0,-1));case i:q===i&&(o=f),q==k?(e.warning('attribute "'+o+'" missed quot(")!!'),c.add(f,o.replace(/&#?\w+;/g,d),b)):(e.warning('attribute "'+o+'" missed value!! "'+o+'" instead!!'),c.add(o,o,b));break;case j:throw new Error("attribute value missed!!")}return p;case"€":r=" ";default:if(r<=" ")switch(q){case g:c.setTagName(a.slice(b,p)),q=m;break;case h:f=a.slice(b,p),q=i;break;case k:var o=a.slice(b,p).replace(/&#?\w+;/g,d);e.warning('attribute "'+o+'" missed quot(")!!'),c.add(f,o,b);case l:q=m}else switch(q){case i:e.warning('attribute "'+f+'" missed value!! "'+f+'" instead!!'),c.add(f,f,b),b=p,q=h;break;case l:e.warning('attribute space is required"'+f+'"!!');case m:q=h,b=p;break;case j:q=k,b=p;break;case n:throw new Error("elements closed character '/' and '>' must be connected to")}}p++}}function s(a,b,c){for(var d=a.tagName,e=null,f=c[c.length-1].currentNSMap,g=a.length;g--;){var h=a[g],i=h.qName,j=h.value,k=i.indexOf(":");if(k>0)var l=h.prefix=i.slice(0,k),m=i.slice(k+1),n="xmlns"===l&&m;else m=i,l=null,n="xmlns"===i&&"";h.localName=m,n!==!1&&(null==e&&(e={},v(f,f={})),f[n]=e[n]=j,h.uri="http://www.w3.org/2000/xmlns/",b.startPrefixMapping(n,j))}for(var g=a.length;g--;){h=a[g];var l=h.prefix;l&&("xml"===l&&(h.uri="http://www.w3.org/XML/1998/namespace"),"xmlns"!==l&&(h.uri=f[l]))}var k=d.indexOf(":");k>0?(l=a.prefix=d.slice(0,k),m=a.localName=d.slice(k+1)):(l=null,m=a.localName=d);var o=a.uri=f[l||""];if(b.startElement(o,m,d,a),a.closed){if(b.endElement(o,m,d),e)for(l in e)b.endPrefixMapping(l)}else a.currentNSMap=f,a.localNSMap=e,c.push(a)}function t(a,b,c,d,e){if(/^(?:script|textarea)$/i.test(c)){var f=a.indexOf("",b),g=a.substring(b+1,f);if(/[&<]/.test(g))return/^script$/i.test(c)?(e.characters(g,0,g.length),f):(g=g.replace(/&#?\w+;/g,d),e.characters(g,0,g.length),f)}return b+1}function u(a,b,c,d){var e=d[c];return null==e&&(e=d[c]=a.lastIndexOf("")),e",b+4);return f>b?(c.comment(a,b+4,f-b-4),f+3):(d.error("Unclosed comment"),-1)}return-1;default:if("CDATA["==a.substr(b+3,6)){var f=a.indexOf("]]>",b+9);return c.startCDATA(),c.characters(a,b+9,f-b-9),c.endCDATA(),f+3}var g=A(a,b),h=g.length;if(h>1&&/!doctype/i.test(g[0][0])){var i=g[1][0],j=h>3&&/^public$/i.test(g[2][0])&&g[3][0],k=h>4&&g[4][0],l=g[h-1];return c.startDTD(i,j&&j.replace(/^(['"])(.*?)\1$/,"$2"),k&&k.replace(/^(['"])(.*?)\1$/,"$2")),c.endDTD(),l.index+l[0].length}}return-1}function x(a,b,c){var d=a.indexOf("?>",b);if(d){var e=a.substring(b,d).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(e){e[0].length;return c.processingInstruction(e[1],e[2]),d+2}return-1}return-1}function y(a){}function z(a,b){return a.__proto__=b,a}function A(a,b){var c,d=[],e=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(e.lastIndex=b,e.exec(a);c=e.exec(a);)if(d.push(c),c[1])return d}var d=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,e=new RegExp("[\\-\\.0-9"+d.source.slice(1,-1)+"·̀-ͯ\\u203F-⁀]"),f=new RegExp("^"+d.source+e.source+"*(?::"+d.source+e.source+"*)?$"),g=0,h=1,i=2,j=3,k=4,l=5,m=6,n=7;o.prototype={parse:function(a,b,c){var d=this.domBuilder;d.startDocument(),v(b,b={}),p(a,b,c,d,this.errorHandler),d.endDocument()}},y.prototype={setTagName:function(a){if(!f.test(a))throw new Error("invalid tagName:"+a);this.tagName=a},add:function(a,b,c){if(!f.test(a))throw new Error("invalid attribute:"+a);this[this.length++]={qName:a,value:b,offset:c}},length:0,getLocalName:function(a){return this[a].localName},getOffset:function(a){return this[a].offset},getQName:function(a){return this[a].qName},getURI:function(a){return this[a].uri},getValue:function(a){return this[a].value}},z({},z.prototype)instanceof z||(z=function(a,b){function c(){}c.prototype=b,c=new c;for(b in a)c[b]=a[b];return c}),"function"==typeof a&&(c.XMLReader=o)},{}],42:[function(a,b,c){"use strict";function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function g(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var d=function(){function a(a,b){for(var c=0;cb.classOrder?1:this.idb.id?1:0}},{key:"copy",value:function(c){var d=new b;return c.copyTo(this,d),d}},{key:"toCanonical",value:function(){return"_:"+this.value}},{key:"toString",value:function(){return b.NTAnonymousNodePrefix+this.id}}]),b}(i);j.nextId=0,j.termType="BlankNode",j.NTAnonymousNodePrefix="_:n",j.prototype.classOrder=h.BlankNode,j.prototype.isBlank=1,j.prototype.isVar=1,b.exports=j},{"./class-order":43,"./node":58}],43:[function(a,b,c){"use strict";var d={Literal:1,Collection:3,Formula:4,NamedNode:5,BlankNode:6,Variable:7};b.exports=d},{}],44:[function(a,b,c){"use strict";function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function g(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var d=function(){function a(a,b){for(var c=0;c0&&a.forEach(function(a){c.elements.push(j.fromValue(a))}),c}return g(b,a),d(b,[{key:"append",value:function(b){return this.elements.push(b)}},{key:"close",value:function(){return this.closed=!0,this.closed}},{key:"shift",value:function(){return this.elements.shift()}},{key:"substitute",value:function(c){var d=this.elements.map(function(a){a.substitute(c)});return new b(d)}},{key:"toNT",value:function(){return h.NTAnonymousNodePrefix+this.id}},{key:"toString",value:function(){return"("+this.elements.join(" ")+")"}},{key:"unshift",value:function(b){return this.elements.unshift(b)}}]),b}(j);k.termType="collection",k.prototype.classOrder=i.Collection,k.prototype.compareTerm=h.prototype.compareTerm,k.prototype.isVar=0,b.exports=k},{"./blank-node":42,"./class-order":43,"./node":58}],45:[function(a,b,c){"use strict";function g(a,b){var c,g=f.Parser(),h=f.Writer({format:"N-Quads"});d.waterfall([function(b){g.parse(a,b)},function(a,b,c){null!==a&&h.addTriple(a),"function"==typeof c&&h.end(c)},function(a,b){try{e.fromRDF(a,{format:"application/nquads"},b)}catch(a){b(a)}},function(a,d){c=JSON.stringify(a),b(null,c)}],function(a,d){b(a,c)})}function h(a,b){var c,e=f.Parser(),g=f.Writer({format:"N-Quads"});d.waterfall([function(b){e.parse(a,b)},function(a,b,c){null!==a&&g.addTriple(a),"function"==typeof c&&g.end(c)},function(a,d){c=a,b(null,c)}],function(a,d){b(a,c)})}b.exports.convertToJson=g,b.exports.convertToNQuads=h;var d=a("async"),e=a("jsonld"),f=a("n3")},{async:1,jsonld:13,n3:14}],46:[function(a,b,c){"use strict";function m(a){return new d(a)}function n(a){return new e(a)}function o(){return new f}function p(a,b,c){return new g(a,b,c)}function q(){return new h}function r(a,b,c){return new i(""+a,b,c)}function s(a,b){return"string"==typeof b?b.indexOf(":")===-1?new i(a,b):new i(a,null,t(b)):new i(a,null,b)}function t(a){return new j(a)}function u(a,b,c,d){return d=d||new f,new k(a,b,c,d)}function v(a,b,c,d){return new k(a,b,c,d)}function w(a,b,c){return u(a,b,c)}function x(a){return new l(a)}var d=a("./blank-node"),e=a("./collection"),f=a("./default-graph"),g=a("./fetcher"),h=a("./indexed-formula"),i=a("./literal"),j=a("./named-node"),k=a("./statement"),l=a("./variable");b.exports.blankNode=m,b.exports.defaultGraph=o,b.exports.graph=q,b.exports.literal=s,b.exports.namedNode=t,b.exports.quad=u,b.exports.triple=w,b.exports.variable=x,b.exports.collection=n,b.exports.fetcher=p,b.exports.lit=r,b.exports.st=v},{"./blank-node":42,"./collection":44,"./default-graph":47,"./fetcher":49,"./indexed-formula":51,"./literal":53,"./named-node":56,"./statement":68,"./variable":73}],47:[function(a,b,c){"use strict";function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function g(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var d=function(){function a(a,b){for(var c=0;c0&&e.add(a.resource,r.dc("title"),e.literal(f[0].textContent),a.resource);for(var g=this.dom.getElementsByTagName("link"),h=g.length-1;h>=0;h--)c=g[h].getAttribute("rel"),d=!1,c||(c=g[h].getAttribute("rev"),d=!0),c&&p.linkData(a,c,g[h].getAttribute("href"),a.resource,d);for(var k=this.dom.getElementsByTagName("script"),l=0;l]+\?>/))return p.addStatus(a.req,"Has an XML declaration. We'll assume it's XHTML as the content-type was text/html.\n"),void p.switchHandler("XHTMLHandler",a,b);if(c.match(/.*/))return p.addStatus(a.req,"Has XHTML DOCTYPE. Switching to XHTMLHandler.\n"), void p.switchHandler("XHTMLHandler",a,b);if(c.match(/[^(/))return p.addStatus(a.req,"Has default namespace for XHTML, so switching to XHTMLHandler.\n"),void p.switchHandler("XHTMLHandler",a,b);var d=new RegExp("([\\s\\S]+?)","im").exec(c);if(d){var e=p.store;return e.add(a.resource,r.dc("title"),e.literal(d[1]),a.resource),e.add(a.resource,r.rdf("type"),r.link("WebPage"),p.appNode),void b()}p.addStatus(a.req,"non-XML HTML document, not parsed for data."),p.doneFetch(a)}}},a.HTMLHandler.toString=function(){return"HTMLHandler"},a.HTMLHandler.register=function(a){a.mediatypes["text/html"]={q:.3}},a.HTMLHandler.pattern=new RegExp("text/html"),a.TextHandler=function(){this.handlerFactory=function(a){a.handle=function(b){var c=a.responseText;return c.match(/\s*<\?xml\s+version\s*=[^<>]+\?>/)?(p.addStatus(a.req,"Warning: "+a.resource+" has an XML declaration. We'll assume it's XML but its content-type wasn't XML.\n"),void p.switchHandler("XMLHandler",a,b)):c.slice(0,500).match(/xmlns:/)?(p.addStatus(a.req,"May have an XML namespace. We'll assume it's XML but its content-type wasn't XML.\n"),void p.switchHandler("XMLHandler",a,b)):(p.addStatus(a.req,"Plain text document, no known RDF semantics."),void p.doneFetch(a))}}},a.TextHandler.toString=function(){return"TextHandler"},a.TextHandler.register=function(a){a.mediatypes["text/plain"]={q:.1}},a.TextHandler.pattern=new RegExp("text/plain"),a.N3Handler=function(){this.handlerFactory=function(a){a.handle=function(b){var c=f(q,q,a.original.uri,a.original.uri,null,null,"",null);try{c.loadBuf(a.responseText)}catch(b){var d="Error trying to parse "+a.resource+" as Notation3:\n"+b+":\n"+b.stack;return void p.failFetch(a,d)}p.addStatus(a.req,"N3 parsed: "+c.statementCount+" triples in "+c.lines+" lines."),p.store.add(a.original,r.rdf("type"),r.link("RDFDocument"),p.appNode),p.doneFetch(a)}}},a.N3Handler.toString=function(){return"N3Handler"},a.N3Handler.register=function(a){a.mediatypes["text/n3"]={q:"1.0"},a.mediatypes["application/x-turtle"]={q:1},a.mediatypes["text/turtle"]={q:1}},a.N3Handler.pattern=new RegExp("(application|text)/(x-)?(rdf\\+)?(n3|turtle)"),m.callbackify(this,["request","recv","headers","load","fail","refresh","retract","done"]),this.addHandler=function(a){p.handlers.push(a),a.register(p)},this.switchHandler=function(b,c,e,f){for(var g=null,h=0;h failed: "+b,a);return delete this.fetchCallbacks[a.original.uri],this.fireCallbacks("fail",[a.original.uri,b]),a.abort(),a},this.linkData=function(a,b,c,d,e){if(c){var f,g=q.sym(l.join(c,a.original.uri));if("alternate"===b||"seeAlso"===b||"meta"===b||"describedby"===b){if(g.uri===a.original.uri)return;f=r.rdfs("seeAlso")}else f="type"===b?q.sym("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"):q.sym(l.join(b,"http://www.iana.org/assignments/link-relations/"));e?q.add(g,f,a.original,d):q.add(a.original,f,g,d)}},this.parseLinkHeader=function(a,b){var c;try{c=a.getResponseHeader("link")}catch(a){}if(c)for(var d=/<[^>]*>\s*(\s*;\s*[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*")))*(,|$)/g,e=/[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*"))/g,f=c.match(d),g=0;g"),i=h[0].substring(1),j=h[1],k=j.match(e),l=0;l=200&&g.status<300;c.noMeta||"undefined"==typeof tabulator||d.saveResponseMetadata(g,d.store),a?e(g):f(g.status+" "+g.statusText)}},g.open(a,b,!0),c.contentType&&g.setRequestHeader("Content-type",c.contentType),g.send(c.data?c.data:void 0)})},this.webCopy=function(a,b,c){var d=this;return a=a.uri||a,new Promise(function(e,f){d.webOperation("GET",a).then(function(a){d.webOperation("PUT",b,{data:a.responseText,contentType:c}).then(function(a){e(a)}).catch(function(a){f(a)})}).catch(function(a){f(a)})})},this.lookUpThing=function(a,b,c,d,e){var j,f=q.uris(a),g=!0,h="",i={};if(c===!1||c===!0?(j=c,c={force:j}):(void 0===c&&(c={}),j=!!c.force),"undefined"!=typeof f)for(var k=0;k0||e&&e(g,h)})};o(m)}return f.length},this.load=function(a,b){var c=this;if(a instanceof Array){var d=a.map(function(a){return c.load(a)});return Promise.all(d)}return a=a.uri||a,new Promise(function(d,e){c.nowOrWhenFetched(a,b,function(a,b,c){a?d(c):e(b)})})},this.nowOrWhenFetched=function(a,b,c,d){a=a.uri||a,"function"==typeof b?(d={},c=b):"undefined"==typeof b||(d=b instanceof g?{referingTerm:b}:b),this.requestURI(a,b,d||{},c)},this.get=this.nowOrWhenFetched,this.getHeader=function(a,b){for(var c=this.store,d=c.each(void 0,r.link("requestedURI"),a.uri),e=0;e Cross-site Proxy to <"+g+">"),c.aborted)return;var h=s.store,i=c.req;c.options.noMeta||h.add(i,r.http("redirectedTo"),h.sym(g),i),c.abort(),c.aborted=!0,s.addStatus(i,"redirected to new request"),s.requested[c.resource.uri]="redirected",s.redirectedTo[c.resource.uri]=g,s.fetchCallbacks[c.resource.uri]&&(s.fetchCallbacks[g]||(s.fetchCallbacks[g]=[]),s.fetchCallbacks[g]===s.fetchCallbacks[g].concat(s.fetchCallbacks[c.resource.uri]),delete s.fetchCallbacks[c.resource.uri]);var j=s.requestURI(g,c.resource,c.options,c.userCallback);if(j&&(j.proxyUsed=!0,j.original=c.original,console.log("Proxying but original still "+j.original)),j&&j.req)return void(c.options.noMeta||h.add(c.req,h.sym("http://www.w3.org/2007/ont/link#redirectedRequest"),j.req,s.appNode))}c.status=999}}},x=function(c){return function(){var a=function(){if(!c.handleResponseDone){c.handleResponseDone=!0;var e=null,f=c.req;s.fireCallbacks("recv",i);var h=s.store;if(s.saveResponseMetadata(c,h),s.fireCallbacks("headers",[{uri:b,headers:c.headers}]),0===c.status){if(console.log("Masked error - status 0 for "+c.resource.uri),v(c))return;return void(c.status=900)}if(c.status>=400){if(404===c.status&&(h.fetcher.nonexistant[c.resource.uri]=!0),c.responseText.length>10){var j=h.bnode();h.add(j,r.http("content"),h.literal(c.responseText),j),c.statusText&&h.add(j,r.http("statusText"),h.literal(c.statusText),j)}return void s.failFetch(c,"HTTP error for "+c.resource+": "+c.status+" "+c.statusText)}var o,k=c.headers["content-location"],m=function(b){var c=f;if(k){var d=h.any(c,r.link("requestedURI"));d!==k&&h.add(h.sym(k),r.rdf("type"),b,s.appNode)}for(;;){var e=h.any(c,r.link("requestedURI"));if(e&&e.value&&h.add(h.sym(e.value),r.rdf("type"),b,s.appNode),c=h.any(void 0,h.sym("http://www.w3.org/2007/ont/link#redirectedRequest"),c),!c)break;var g=h.any(c,h.sym("http://www.w3.org/2007/ont/link#response"));if(!g)break;var i=h.any(g,h.sym("http://www.w3.org/2007/ont/http#status"));if(!i)break;if("301"!==i&&"302"!==i)break}},n={rdf:"application/rdf+xml",owl:"application/rdf+xml",n3:"text/n3",ttl:"text/turtle",nt:"text/n3",acl:"text/n3",html:"text/html",xml:"text/xml"};if(200===c.status){m(r.link("Document"));var p=c.headers["content-type"];d.forceContentType&&(c.headers["content-type"]=d.forceContentType),(!p||p.indexOf("application/octet-stream")>=0)&&(o=n[c.resource.uri.split(".").pop()],o&&(c.headers["content-type"]=o)),p&&(0!==p.indexOf("image/")&&0!==p.indexOf("application/pdf")||m(h.sym("http://purl.org/dc/terms/Image"))),d.clearPreviousData&&h.removeDocument(c.resource)}if("file"!==l.protocol(c.resource.uri)&&"chrome"!==l.protocol(c.resource.uri)||(d.forceContentType?c.headers["content-type"]=d.forceContentType:(o=n[c.resource.uri.split(".").pop()],o?c.headers["content-type"]=o:c.headers["content-type"]="text/xml")),k){var q=l.join(c.resource.uri,k);if(!g&&q!==c.resource.uri&&s.requested[q]&&"done"===s.requested[q])return s.doneFetch(c),void c.abort();s.requested[q]=!0}for(var t=0;t Cross-site Proxy to <"+f+">"),c.aborted)return;var k=s.store,m=c.req;k.add(m,r.http("redirectedTo"),k.sym(f),m);var n=c.req=k.bnode();k.add(m,r.http("redirectedRequest"),n,c.req);var o=new Date,p="["+o.getHours()+":"+o.getMinutes()+":"+o.getSeconds()+"] ";k.add(n,r.rdfs("label"),k.literal(p+" Request for "+f),this.appNode),k.add(n,r.link("status"),k.collection(),this.appNode),k.add(n,r.link("requestedURI"),k.literal(f),this.appNode);var q=k.bnode();k.add(m,r.link("response"),q),c.abort(),c.aborted=!0,c.redirected=!0,s.addStatus(m,"redirected XHR"),s.fetchCallbacks[c.resource.uri]&&(s.fetchCallbacks[f]||(s.fetchCallbacks[f]=[]),s.fetchCallbacks[f]===s.fetchCallbacks[f].concat(s.fetchCallbacks[c.resource.uri]),delete s.fetchCallbacks[c.resource.uri]),s.fireCallbacks("redirected",i),s.requested[c.resource.uri]="redirected";var t=s.requestURI(f,c.resource,c.options||{},c.userCallback);if(t&&t.req)return void k.add(c.req,k.sym("http://www.w3.org/2007/ont/link#redirectedRequest"),t.req,s.appNode)}}s.failFetch(c,"HTTP Blocked. (ReadyState 0) Cross-site violation for <"+b+">");break;case 3:break;case 4:if(a(),c.handle&&void 0!==c.responseText){if("redirected"===s.requested[c.resource.uri])break;s.fireCallbacks("load",i),c.handle(function(){s.doneFetch(c)})}else c.redirected?s.addStatus(c.req,"Aborted and redirected to new request."):s.addStatus(c.req,"Fetch over. No data handled. Aborted = "+c.aborted)}}},y=b;"undefined"!=typeof tabulator&&tabulator.preferences.get("offlineModeUsingLocalhost")&&"http://"===y.slice(0,7)&&"localhost/"!==y.slice(7,17)&&(y="http://localhost/"+y.slice(7),e.warn("Localhost kludge for offline use: actually getting <"+y+">"));var z="https:"===y.slice(0,6);void 0!==d.withCredentials&&(z=d.withCredentials);var A=this.proxyIfNecessary(y);p.onerror=w(p),p.onreadystatechange=x(p),p.timeout=s.timeout,p.withCredentials=z,p.actualProxyURI=A,p.req=q,p.options=d,p.options=d,p.resource=n,p.requestedURI=y,p.ontimeout=function(){s.failFetch(p,"requestTimeout")};try{p.open("GET",A,this.async)}catch(a){return this.failFetch(p,"XHR open for GET failed for <"+y+">:\n\t"+a)}if(g&&p.setRequestHeader("Cache-control","no-cache"),"undefined"!=typeof tabulator&&tabulator.isExtension&&p.channel&&("http"===l.protocol(p.resource.uri)||"https"===l.protocol(p.resource.uri)))try{p.channel.notificationCallbacks={getInterface:function(b){return b.equals(Components.interfaces.nsIChannelEventSink)?{onChannelRedirect:function(b,e,f){if(!p.aborted){var g=s.store,h=e.URI.spec,j=p.req;if(!p.options.noMeta){s.addStatus(p.req,"Redirected: "+p.status+" to <"+h+">"),g.add(j,r.http("redirectedTo"),g.sym(h),p.req);var k=p.req=g.bnode();g.add(j,r.http("redirectedRequest"),k,this.appNode);var m=new Date,n="["+m.getHours()+":"+m.getMinutes()+":"+m.getSeconds()+"] ";g.add(k,r.rdfs("label"),g.literal(n+" Request for "+h),this.appNode),g.add(k,r.link("status"),g.collection(),this.appNode),g.add(k,r.link("requestedURI"),g.literal(h),this.appNode);var o=g.bnode();g.add(j,r.link("response"),o),g.add(o,r.http("status"),g.literal(p.status),o),p.statusText&&g.add(o,r.http("statusText"),g.literal(p.statusText),o)}if(p.status-0!==303&&(g.HTTPRedirects[p.resource.uri]=h),p.status-0===301&&c){var q=l.docpart(c.uri),t="Warning: "+p.resource+" has moved to <"+h+">.";c&&(t+=" Link in <"+q+" >should be changed",g.add(q,g.sym("http://www.w3.org/2007/ont/link#warning"),t,s.appNode))}p.abort(),p.aborted=!0,s.fetchCallbacks[p.resource.uri]&&(s.fetchCallbacks[h]||(s.fetchCallbacks[h]=[]),s.fetchCallbacks[h]===s.fetchCallbacks[h].concat(s.fetchCallbacks[p.resource.uri]),delete s.fetchCallbacks[p.resource.uri]),s.addStatus(j,"redirected"),s.fireCallbacks("redirected",i),s.requested[p.resource.uri]="redirected",s.redirectedTo[p.resource.uri]=h;var u=h.indexOf("#");u>=0&&(p.options.noMeta||g.add(p.resource,g.sym("http://www.w3.org/2007/ont/link#warning"),"Warning: "+p.resource+" HTTP redirects to"+h+' which should not contain a "#" sign'),h=h.slice(0,u));var v=s.requestURI(h,p.resource,p.options,p.userCallback);v&&v.req&&!d.noMeta&&g.add(p.req,g.sym("http://www.w3.org/2007/ont/link#redirectedRequest"),v.req,s.appNode)}},asyncOnChannelRedirect:function(b,d,e,f){if(!p.aborted){var g=s.store,h=d.URI.spec,i=p.req;s.addStatus(p.req,"Redirected: "+p.status+" to <"+h+">"),g.add(i,r.http("redirectedTo"),g.sym(h),p.req);var j=p.req=g.bnode();g.add(i,r.http("redirectedRequest"),j,p.req);var k=new Date,m="["+k.getHours()+":"+k.getMinutes()+":"+k.getSeconds()+"] ";g.add(j,r.rdfs("label"),g.literal(m+" Request for "+h),this.appNode),g.add(j,r.link("status"),g.collection(),this.appNode),g.add(j,r.link("requestedURI"),g.literal(h),this.appNode);var n=g.bnode();if(g.add(i,r.link("response"),n),g.add(n,r.http("status"),g.literal(p.status),n),p.statusText&&g.add(n,r.http("statusText"),g.literal(p.statusText),n),p.status-0!==303&&(g.HTTPRedirects[p.resource.uri]=h),p.status-0===301&&c){var o=l.docpart(c.uri),q="Warning: "+p.resource+" has moved to <"+h+">.";c&&(q+=" Link in <"+o+" >should be changed",g.add(o,g.sym("http://www.w3.org/2007/ont/link#warning"),q,s.appNode))}p.abort(),p.aborted=!0;var t=h.indexOf("#");if(t>=0){var u="Warning: "+p.resource+" HTTP redirects to"+h+' which do not normally contain a "#" sign';g.add(p.resource,g.sym("http://www.w3.org/2007/ont/link#warning"),u),h=h.slice(0,t)}s.requested[p.resource.uri]="redirected",s.redirectedTo[p.resource.uri]=h;var v=s.requestURI(h,p.resource,p.options,p.userCallback);v&&(v.original=p.original,v.req&&g.add(p.req,g.sym("http://www.w3.org/2007/ont/link#redirectedRequest"),v.req,s.appNode))}}}:Components.results.NS_NOINTERFACE}}}catch(a){return s.failFetch(p,"@@ Couldn't set callback for redirects: "+a)}try{var B="";for(var C in this.mediatypes){""!==B&&(B+=", "),B+=C;for(var D in this.mediatypes[C])B+=";"+D+"="+this.mediatypes[C][D]}p.setRequestHeader("Accept",B),this.addStatus(p.req,"Accept: "+B)}catch(a){throw new Error("Can't set Accept header: "+a)}try{p.send(null)}catch(a){return this.failFetch(p,"XHR send failed:"+a)}return setTimeout(function(){4!==p.readyState&&s.isPending(p.resource.uri)&&s.failFetch(p,"requestTimeout")},this.timeout),this.addStatus(p.req,"HTTP Request sent."),p}},this.objectRefresh=function(a){var b=q.uris(a);if("undefined"!=typeof b)for(var c=0;c1?e("Patch ambiguous. No patch done."):(j=l[0],void i(e))})}else i(e)}},{key:"declareExistential",value:function(b){return this._existentialVariables||(this._existentialVariables=[]),this._existentialVariables.push(b),b}},{key:"initPropertyActions",value:function(b){this.propertyActions[""]=[p],h(b,"sameAs")>=0&&(this.propertyActions[""]=[function(a,b,c,d,e){ return a.equate(b,d),!0}]),h(b,"InverseFunctionalProperty")>=0&&(this.classActions["<"+m+"InverseFunctionalProperty>"]=[function(a,b,c,d,e){return a.newPropertyAction(b,o)}]),h(b,"FunctionalProperty")>=0&&(this.classActions["<"+m+"FunctionalProperty>"]=[function(a,b,c,d,e){return a.newPropertyAction(b,n)}])}},{key:"add",value:function(b,d,e,f){var g;if(1===arguments.length){if(b instanceof Array)for(g=0;g";return!!this.subjectIndex[c]||!!this.objectIndex[c]||!!this.predicateIndex[c]}},{key:"newExistential",value:function(b){if(!b)return this.bnode();var c=this.sym(b);return this.declareExistential(c)}},{key:"newPropertyAction",value:function(b,c){var d=b.hashString();this.propertyActions[d]||(this.propertyActions[d]=[]),this.propertyActions[d].push(c);for(var e=this.statementsMatching(void 0,b,void 0),f=!1,g=0;g1&&(n=n.slice(0,1)),n=n||[];var p,q,o=1e10;for(q=0;q=0?l.float:(""+c).indexOf(".")>=0?l.decimal:l.integer,new b(""+c,null,d)}},{key:"fromValue",value:function(c){if("undefined"==typeof c||null===c)return c;if(c&&c.termType)return c;switch("undefined"==typeof c?"undefined":d(c)){case"object":if(c instanceof Date)return b.fromDate(c);case"boolean":return b.fromBoolean(c);case"number":return b.fromNumber(c);case"string":return new b(c)}throw new Error("Can't make literal from "+c+" of type "+("undefined"==typeof c?"undefined":d(c)))}}]),b}(k);m.termType="Literal",m.prototype.classOrder=i.Literal,m.prototype.datatype=l.string,m.prototype.lang="",m.prototype.isVar=0,b.exports=m},{"./class-order":43,"./named-node":56,"./node":58,"./xsd":74}],54:[function(a,b,c){"use strict";b.exports={debug:function(b){},warn:function(b){},info:function(b){},error:function(b){},success:function(b){},msg:function(b){}}},{}],55:[function(a,b,c){"use strict";var d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol?"symbol":typeof a},e=a("./uri"),f=a("./util").ArrayIndexOf,g=function(){function a(a){return encodeURI(a)}function X(a,b,c,d,e,f,g,h){return new Y(a,b,c,d,e,f,g,h)}function Y(a,b,c,d,e,f,g,h){"undefined"==typeof b&&(b=null),"undefined"==typeof c&&(c=""),"undefined"==typeof d&&(d=null),"undefined"==typeof e&&(e=""),"undefined"==typeof f&&(f=null),"undefined"==typeof g&&(g=""),"undefined"==typeof h&&(h=null),this._bindings=new k([]),this._flags=g,""!=c&&(r(c.indexOf(":")>=0,"Document URI not absolute: "+c),this._bindings[""]=c+"#"),this._store=a,e&&a.setGenPrefix(e),this._thisDoc=c,this.source=a.sym(c),this.lines=0,this.statementCount=0,this.startOfLine=0,this.previousLine=0,this._genPrefix=e,this.keywords=new j(["a","this","bind","has","is","of","true","false"]),this.keywordsSet=0,this._anonymousNodes=new k([]),this._variables=new k([]),this._parentVariables=new k([]),this._reason=h,this._reason2=null,v&&(this._reason2=why_BecauseOfData(a.sym(c),this._reason)),d?this._baseURI=d:c?this._baseURI=c:this._baseURI=null,r(!this._baseURI||this._baseURI.indexOf(":")>=0),this._genPrefix||(this._thisDoc?this._genPrefix=this._thisDoc+"#_g":this._genPrefix=RDFSink_uniqueURI()),null==b?this._thisDoc?this._formula=a.formula(c+"#_formula"):this._formula=a.formula():this._formula=b,this._context=this._formula,this._parentContext=null}function $(a,b,c,d,e){this._str=c.encode("utf-8"),this._str=c,this._i=d,this._why=e,this.lines=b,this._uri=a}function _(a,b,c,d,e){return"Line "+(b+1)+" of <"+a+">: Bad syntax: "+e+'\nat: "'+m(c,d,d+30)+'"'}var b={encode:function(b){b=b.replace(/\r\n/g,"\n");for(var c="",d=0;d127&&e<2048?(c+=String.fromCharCode(e>>6|192),c+=String.fromCharCode(63&e|128)):(c+=String.fromCharCode(e>>12|224),c+=String.fromCharCode(e>>6&63|128),c+=String.fromCharCode(63&e|128))}return c},decode:function(b){for(var c="",d=0;d191&&e<224?(c+=String.fromCharCode((31&e)<<6|63&b.charCodeAt(d+1)),d+=2):(c+=String.fromCharCode((15&e)<<12|(63&b.charCodeAt(d+1))<<6|63&b.charCodeAt(d+2)),d+=3)}return c}},h="http://www.w3.org/2000/10/swap/log#",i=function(b){return b},j=function(b){return b},k=function(b){if(b.length>0)throw"missing.js: oops nnonempty dict not imp";return[]},l=function(b){return b.length},m=function(b,c,e){if("undefined"==typeof b.slice)throw"@@ mising.js: No .slice function for "+b+" of type "+("undefined"==typeof b?"undefined":d(b));return"undefined"==typeof e||null==e?b.slice(c):b.slice(c,e)},n=Error("dummy error stop iteration"),o=function(b){return this.last=0,this.li=b,this.next=function(){if(this.last==this.li.length)throw n;return this.li[this.last++]},this},q=function(b,c){return b.indexOf(c)},r=function(b,c){if(!b){if(c)throw"python Assertion failed: "+c;throw"(python) Assertion failed."}},s=function(b){return String.fromCharCode(b)};String.prototype.encode=function(a){if("utf-8"!=a)throw"UTF8_converter: can only do utf-8";return b.encode(this)},String.prototype.decode=function(a){if("utf-8"!=a)throw"UTF8_converter: can only do utf-8";return this};var t=function(b,c){return e.join(c,b)},u=null,v=0,w=0,x=function(b){},y="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",z="http://www.w3.org/2002/07/owl#sameAs",B="#",D="http://www.w3.org/2001/XMLSchema#integer",E="http://www.w3.org/2001/XMLSchema#double",F="http://www.w3.org/2001/XMLSchema#decimal",G="http://www.w3.org/2001/XMLSchema#date",H="http://www.w3.org/2001/XMLSchema#dateTime",K="\t\r\n !\"#$%&'()*.,+/;<=>?@[\\]^`{|}~",L=K+":",S=(new RegExp("^[ \\t]*(#[^\\n]*)?\\r?\\n","g"),new RegExp("^[ \\t]*(#[^\\n]*)?$","g"),new RegExp("^[ \\t]*","g"),new RegExp("^[-+]?[0-9]+","g"),new RegExp("^([-+]?[0-9]+)(\\.[0-9]+)?(e[-+]?[0-9]+)?","g")),T=new RegExp("^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9](T[0-9][0-9]:[0-9][0-9](:[0-9][0-9](\\.[0-9]*)?)?)?Z?"),V=(new RegExp("^[0-9]+","g"),new RegExp('[\\\\\\r\\n\\"]',"g")),W=new RegExp("^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)?","g");return Y.prototype.here=function(a){return this._genPrefix+"_L"+this.lines+"C"+(a-this.startOfLine+1)},Y.prototype.formula=function(){return this._formula},Y.prototype.loadStream=function(a){return this.loadBuf(a.read())},Y.prototype.loadBuf=function(a){return this.startDoc(),this.feed(a),this.endDoc()},Y.prototype.feed=function(a){for(var b=a.decode("utf-8"),c=0;c>=0;){var d=this.skipSpace(b,c);if(d<0)return;var c=this.directiveOrStatement(b,d);if(c<0)throw _(this._thisDoc,this.lines,b,d,"expected directive or statement")}},Y.prototype.directiveOrStatement=function(a,b){var c=this.skipSpace(a,b);if(c<0)return c;var d=this.directive(a,c);if(d>=0)return this.checkDot(a,d);var d=this.statement(a,c);return d>=0?this.checkDot(a,d):d},Y.prototype.tok=function(a,b,c){if("@"==m(b,c,c+1))var c=c+1;else if(f(this.keywords,a)<0)return-1;var e=c+l(a);return m(b,c,e)==a&&K.indexOf(b.charAt(e))>=0?e:-1},Y.prototype.directive=function(b,c){var d=this.skipSpace(b,c);if(d<0)return d;var e=new j([]),d=this.tok("bind",b,c);if(d>0)throw _(this._thisDoc,this.lines,b,c,"keyword bind is obsolete: use @prefix");var d=this.tok("keywords",b,c);if(d>0){var c=this.commaSeparatedList(b,d,e,!1);if(c<0)throw _(this._thisDoc,this.lines,b,c,"'@keywords' needs comma separated list of words");return this.setKeywords(m(e,null,null)),w>80&&x("Keywords ",this.keywords),c}var d=this.tok("forAll",b,c);if(d>0){var c=this.commaSeparatedList(b,d,e,!0);if(c<0)throw _(this._thisDoc,this.lines,b,c,"Bad variable list after @forAll");var g=new o(e);try{for(;;){var h=g.next();(f(this._variables,h)<0||f(this._parentVariables,h)>=0)&&(this._variables[h]=this._context.newUniversal(h))}}catch(a){if(a!=n)throw a}return c}var d=this.tok("forSome",b,c);if(d>0){var c=this.commaSeparatedList(b,d,e,this.uri_ref2);if(c<0)throw _(this._thisDoc,this.lines,b,c,"Bad variable list after @forSome");var g=new o(e);try{for(;;){var h=g.next();this._context.declareExistential(h)}}catch(a){if(a!=n)throw a}return c}var d=this.tok("prefix",b,c);if(d>=0){var i=new j([]),c=this.qname(b,d,i);if(c<0)throw _(this._thisDoc,this.lines,b,d,"expected qname after @prefix");var d=this.uri_ref2(b,c,i);if(d<0)throw _(this._thisDoc,this.lines,b,c,"expected after @prefix _qname_");var k=i[1].uri;if(this._baseURI)var k=t(this._baseURI,k);else r(k.indexOf(":")>=0,"With no base URI, cannot handle relative URI for NS");return r(k.indexOf(":")>=0),this._bindings[i[0][0]]=k,this.bind(i[0][0],a(k)),d}var d=this.tok("base",b,c);if(d>=0){var i=new j([]),c=this.uri_ref2(b,d,i);if(c<0)throw _(this._thisDoc,this.lines,b,d,"expected after @base ");var k=i[0].uri;if(!this._baseURI)throw _(this._thisDoc,this.lines,b,d,"With no previous base URI, cannot use relative URI in @base <"+k+">");var k=t(this._baseURI,k);return r(k.indexOf(":")>=0),this._baseURI=k,c}return-1},Y.prototype.bind=function(a,b){""==a||this._store.setPrefixForURI(a,b)},Y.prototype.setKeywords=function(a){null==a?this.keywordsSet=0:(this.keywords=a,this.keywordsSet=1)},Y.prototype.startDoc=function(){},Y.prototype.endDoc=function(){return this._formula},Y.prototype.makeStatement=function(a){a[0].add(a[2],a[1],a[3],this.source),this.statementCount+=1},Y.prototype.statement=function(a,b){var c=new j([]),b=this.object(a,b,c);if(b<0)return b;var d=this.property_list(a,b,c[0]);if(d<0)throw _(this._thisDoc,this.lines,a,b,"expected propertylist");return d},Y.prototype.subject=function(a,b,c){return this.item(a,b,c)},Y.prototype.verb=function(a,b,c){var d=this.skipSpace(a,b);if(d<0)return d;var e=new j([]),d=this.tok("has",a,b);if(d>=0){var b=this.prop(a,d,e);if(b<0)throw _(this._thisDoc,this.lines,a,d,"expected property after 'has'");return c.push(new i(["->",e[0]])),b}var d=this.tok("is",a,b);if(d>=0){var b=this.prop(a,d,e);if(b<0)throw _(this._thisDoc,this.lines,a,d,"expected after 'is'");var d=this.skipSpace(a,b);if(d<0)throw _(this._thisDoc,this.lines,a,b,"End of file found, expected property after 'is'");var b=d,d=this.tok("of",a,b);if(d<0)throw _(this._thisDoc,this.lines,a,b,"expected 'of' after 'is' ");return c.push(new i(["<-",e[0]])),d}var d=this.tok("a",a,b);if(d>=0)return c.push(new i(["->",this._store.sym(y)])),d;if("<="==m(a,b,b+2))return c.push(new i(["<-",this._store.sym(h+"implies")])),b+2;if("="==m(a,b,b+1))return">"==m(a,b+1,b+2)?(c.push(new i(["->",this._store.sym(h+"implies")])),b+2):(c.push(new i(["->",this._store.sym(z)])),b+1);if(":="==m(a,b,b+2))return c.push(new i(["->",h+"becomes"])),b+2;var d=this.prop(a,b,e);if(d>=0)return c.push(new i(["->",e[0]])),d;if(">-"==m(a,b,b+2)||"<-"==m(a,b,b+2))throw _(this._thisDoc,this.lines,a,d,">- ... -> syntax is obsolete.");return-1},Y.prototype.prop=function(a,b,c){return this.item(a,b,c)},Y.prototype.item=function(a,b,c){return this.path(a,b,c)},Y.prototype.blankNode=function(a){return this._context.bnode(a,this._reason2)},Y.prototype.path=function(a,b,c){var d=this.nodeOrLiteral(a,b,c);if(d<0)return d;for(;"!^.".indexOf(m(a,d,d+1))>=0;){var e=m(a,d,d+1);if("."==e){var f=m(a,d+1,d+2);if(!f||L.indexOf(f)>=0&&":?<[{(".indexOf(f)<0)break}var g=c.pop(),h=this.blankNode(this.here(d)),d=this.node(a,d+1,c);if(d<0)throw _(this._thisDoc,this.lines,a,d,"EOF found in middle of path syntax");var j=c.pop();"^"==e?this.makeStatement(new i([this._context,j,h,g])):this.makeStatement(new i([this._context,j,g,h])),c.push(h)}return d},Y.prototype.anonymousNode=function(a){var b=this._anonymousNodes[a];if(b)return b;var b=this._store.bnode(this._context,this._reason2);return this._anonymousNodes[a]=b,b},Y.prototype.node=function(a,b,c,d){"undefined"==typeof d&&(d=null);var e=d,f=this.skipSpace(a,b);if(f<0)return f;var b=f,g=m(a,b,b+1);if("["==g){var h=this.here(b),f=this.skipSpace(a,b+1);if(f<0)throw _(this._thisDoc,this.lines,a,b,"EOF after '['");if("="==m(a,f,f+1)){var b=f+1,p=new j([]),f=this.objectList(a,b,p);if(!(f>=0))throw _(this._thisDoc,this.lines,a,b,"objectList expected after [= ");var e=p[0];if(l(p)>1){var q=new o(p);try{for(;;){var r=q.next();this.makeStatement(new i([this._context,this._store.sym(z),e,r]))}}catch(a){if(a!=n)throw a}}var f=this.skipSpace(a,f);if(f<0)throw _(this._thisDoc,this.lines,a,b,"EOF when objectList expected after [ = ");if(";"==m(a,f,f+1))var f=f+1}if(null==e)var e=this.blankNode(h);var b=this.property_list(a,f,e);if(b<0)throw _(this._thisDoc,this.lines,a,f,"property_list expected");var f=this.skipSpace(a,b);if(f<0)throw _(this._thisDoc,this.lines,a,b,"EOF when ']' expected after [ ");if("]"!=m(a,f,f+1))throw _(this._thisDoc,this.lines,a,f,"']' expected");return c.push(e),f+1}if("{"==g){var s=m(a,b+1,b+2);if("$"==s){b+=1;for(var f=b+1,t=new j([]),v=!0;;){var b=this.skipSpace(a,f);if(b<0)throw _(this._thisDoc,this.lines,a,b,"needed '$}', found end.");if("$}"==m(a,b,b+2)){var f=b+2;break}if(v)var v=!1;else{if(","!=m(a,b,b+1))throw _(this._thisDoc,this.lines,a,b,"expected: ','");b+=1}var w=new j([]),f=this.item(a,b,w);if(f<0)throw _(this._thisDoc,this.lines,a,b,"expected item in set or '$}'");t.push(w[0])}return c.push(this._store.newSet(t,this._context)),f}var f=b+1,x=this._parentContext;this._parentContext=this._context;var y=this._anonymousNodes,A=this._parentVariables;this._parentVariables=this._variables,this._anonymousNodes=new k([]),this._variables=this._variables.slice();var B=this._reason2;if(this._reason2=u,null==e)var e=this._store.formula();for(this._context=e;;){var b=this.skipSpace(a,f);if(b<0)throw _(this._thisDoc,this.lines,a,b,"needed '}', found end.");if("}"==m(a,b,b+1)){var f=b+1;break}var f=this.directiveOrStatement(a,b);if(f<0)throw _(this._thisDoc,this.lines,a,b,"expected statement or '}'")}return this._anonymousNodes=y,this._variables=this._parentVariables,this._parentVariables=A,this._context=this._parentContext,this._reason2=B,this._parentContext=x,c.push(e.close()),f}if("("==g){var C=this._store.list,s=m(a,b+1,b+2);if("$"==s){var C=this._store.newSet;b+=1}for(var f=b+1,t=new j([]);;){var b=this.skipSpace(a,f);if(b<0)throw _(this._thisDoc,this.lines,a,b,"needed ')', found end.");if(")"==m(a,b,b+1)){var f=b+1;break}var w=new j([]),f=this.item(a,b,w);if(f<0)throw _(this._thisDoc,this.lines,a,b,"expected item in list or ')'");t.push(w[0])}return c.push(C(t,this._context)),f}var f=this.tok("this",a,b);if(f>=0)throw _(this._thisDoc,this.lines,a,b,"Keyword 'this' was ancient N3. Now use @forSome and @forAll keywords.");var f=this.tok("true",a,b);if(f>=0)return c.push(!0),f;var f=this.tok("false",a,b);if(f>=0)return c.push(!1),f;if(null==e){var f=this.uri_ref2(a,b,c);if(f>=0)return f}return-1},Y.prototype.property_list=function(a,b,c){for(;;){var d=this.skipSpace(a,b);if(d<0)throw _(this._thisDoc,this.lines,a,b,"EOF found when expected verb in property list");if(":-"!=m(a,d,d+2)){var b=d,f=new j([]),d=this.verb(a,b,f);if(d<=0)return b;var g=new j([]),b=this.objectList(a,d,g);if(b<0)throw _(this._thisDoc,this.lines,a,d,"objectList expected");var h=new o(g);try{for(;;){var k=h.next(),l=f[0],p=l[0],q=l[1];"->"==p?this.makeStatement(new i([this._context,q,c,k])):this.makeStatement(new i([this._context,q,k,c]))}}catch(a){if(a!=n)throw a}var d=this.skipSpace(a,b);if(d<0)throw _(this._thisDoc,this.lines,a,d,"EOF found in list of objects");if(";"!=m(a,b,b+1))return b;var b=b+1}else{var b=d+2,e=new j([]),d=this.node(a,b,e,c);if(d<0)throw _(this._thisDoc,this.lines,a,b,"bad {} or () or [] node after :- ");var b=d}}},Y.prototype.commaSeparatedList=function(a,b,c,d){var e=this.skipSpace(a,b);if(e<0)throw _(this._thisDoc,this.lines,a,e,"EOF found expecting comma sep list");if("."==a.charAt(e))return b;if(d)var e=this.uri_ref2(a,e,c);else var e=this.bareWord(a,e,c);if(e<0)return-1;for(;;){var b=this.skipSpace(a,e);if(b<0)return b;var f=m(a,b,b+1);if(","!=f)return"."!=f?-1:b;if(d)var e=this.uri_ref2(a,b+1,c);else var e=this.bareWord(a,b+1,c);if(e<0)throw _(this._thisDoc,this.lines,a,e,"bad list content")}},Y.prototype.objectList=function(a,b,c){var b=this.object(a,b,c);if(b<0)return-1;for(;;){var d=this.skipSpace(a,b);if(d<0)throw _(this._thisDoc,this.lines,a,d,"EOF found after object");if(","!=m(a,d,d+1))return d;var b=this.object(a,d+1,c);if(b<0)return b}},Y.prototype.checkDot=function(a,b){var c=this.skipSpace(a,b);if(c<0)return c;if("."==m(a,c,c+1))return c+1;if("}"==m(a,c,c+1))return c;if("]"==m(a,c,c+1))return c;throw _(this._thisDoc,this.lines,a,c,"expected '.' or '}' or ']' at end of statement")},Y.prototype.uri_ref2=function(a,b,c){var d=new j([]),e=this.qname(a,b,d);if(e>=0){var g=d[0],h=g[0],i=g[1];if(null==h){r(0,"not used?");var k=this._baseURI+B}else{var k=this._bindings[h];if(!k){if("_"==h)return c.push(this.anonymousNode(i)),e;throw _(this._thisDoc,this.lines,a,b,"Prefix "+h+" not bound.")}}var n=this._store.sym(k+i);return f(this._variables,n)>=0?c.push(this._variables[n]):c.push(n),e}var b=this.skipSpace(a,b);if(b<0)return-1;if("?"==a.charAt(b)){var o=new j([]),e=this.variable(a,b,o);return e>0?(c.push(o[0]),e):-1}if("<"==a.charAt(b)){for(var b=b+1,p=b;b"==a.charAt(b)){var q=m(a,p,b);if(this._baseURI)var q=t(this._baseURI,q);else r(q.indexOf(":")>=0,"With no base URI, cannot deal with relative URIs");if("#"==m(a,b-1,b)&&"#"!=m(q,-1,null))var q=q+"#";var n=this._store.sym(q);return f(this._variables,n)>=0?c.push(this._variables[n]):c.push(n),b+1}var b=b+1}throw _(this._thisDoc,this.lines,a,e,"unterminated URI reference")}if(this.keywordsSet){var o=new j([]),e=this.bareWord(a,b,o);if(e<0)return-1;if(f(this.keywords,o[0])>=0)throw _(this._thisDoc,this.lines,a,b,'Keyword "'+o[0]+'" not allowed here.');return c.push(this._store.sym(this._bindings[""]+o[0])),e}return-1},Y.prototype.skipSpace=function(a,b){for(var c=" \n\r\t\f\v            ​\u2028\u2029 ",d=b?b:0;d=0)throw _(this._thisDoc,this.lines,a,d,"Varible name can't start with '"+a.charAt(d)+"s'");for(;b=0)return-1;if(L.indexOf(e)>=0)return-1;for(var b=d;b=0)return-1;if(L.indexOf(d)<0)for(var e=d,b=b+1;b=0)return d;var d=this.skipSpace(a,b);if(d<0)return-1;var b=d;if('"'==a.charAt(b)){if('"""'==m(a,b,b+3))var e='"""';else var e='"';var b=b+l(e),f=this.strconst(a,b,e),d=f[0],g=f[1];return c.push(this._store.literal(g)),x("New string const ",g,d),d}return-1},Y.prototype.nodeOrLiteral=function(a,b,c){var d=this.node(a,b,c);if(d>=0)return d;var d=this.skipSpace(a,b);if(d<0)return-1;var b=d,e=a.charAt(b);if("-+0987654321".indexOf(e)>=0){T.lastIndex=0;var f=T.exec(a.slice(b));if(null!=f){var g=f[0];d=b+g.length,g.indexOf("T")>=0?c.push(this._store.literal(g,void 0,this._store.sym(H))):c.push(this._store.literal(g,void 0,this._store.sym(G)))}else{S.lastIndex=0;var f=S.exec(a.slice(b));if(null==f)throw _(this._thisDoc,this.lines,a,b,"Bad number or date syntax");d=b+S.lastIndex;var g=m(a,b,d);g.indexOf("e")>=0?c.push(this._store.literal(parseFloat(g),void 0,this._store.sym(E))):m(a,b,d).indexOf(".")>=0?c.push(this._store.literal(parseFloat(g),void 0,this._store.sym(F))):c.push(this._store.literal(parseInt(g),void 0,this._store.sym(D)))}return d}if('"'==a.charAt(b)){if('"""'==m(a,b,b+3))var h='"""';else var h='"';var b=b+l(h),i=null,k=this.strconst(a,b,h),d=k[0],n=k[1],o=null;if("@"==m(a,d,d+1)){W.lastIndex=0;var f=W.exec(a.slice(d+1));if(null==f)throw _(this._thisDoc,startline,a,b,"Bad language code syntax on string literal, after @");var b=W.lastIndex+d+1,o=m(a,d+1,b),d=b}if("^^"==m(a,d,d+2))var p=new j([]),d=this.uri_ref2(a,d+2,p),i=p[0];return c.push(this._store.literal(n,o,i)),d}return-1},Y.prototype.strconst=function(a,b,c){for(var d=b,e="",f=this.lines;d=0)var k='a\b\f\r\t\v\n\\"'.charAt(j),e=e+k,d=d+1;else if("u"==h)var n=this.uEscape(a,d+1,f),d=n[0],h=n[1],e=e+h;else{if("U"!=h)throw _(this._thisDoc,this.lines,a,b,"bad escape");var n=this.UEscape(a,d+1,f),d=n[0],h=n[1],e=e+h}}}else var d=b+1;else var d=b}else var e=e+'"',d=d+1}throw _(this._thisDoc,this.lines,a,b,"unterminated string literal")},Y.prototype.uEscape=function(a,b,c){for(var d=b,e=0,f=0;e<4;){var g=m(a,d,d+1),h=g.toLowerCase(),d=d+1;if(""==h)throw _(this._thisDoc,c,a,b,"unterminated string literal(3)");var j=q("0123456789abcdef",h);if(j<0)throw _(this._thisDoc,c,a,b,"bad string literal hex escape");var f=16*f+j,e=e+1}var k=String.fromCharCode(f);return new i([d,k])},Y.prototype.UEscape=function(a,b,c){for(var d=b,e=0,f="\\U";e<8;){var g=m(a,d,d+1),h=g.toLowerCase(),d=d+1;if(""==h)throw _(this._thisDoc,c,a,b,"unterminated string literal(3)");var j=q("0123456789abcdef",h);if(j<0)throw _(this._thisDoc,c,a,b,"bad string literal hex escape"); var f=f+h,e=e+1}var k=s("0x"+m(f,2,10)-0);return new i([d,k])},$.prototype.toString=function(){var a=this._str,b=this._i,c=0;if(b>60)var d="...",c=b-60;else var d="";if(l(a)-b>60)var e="...";else var e="";return'Line %i of <%s>: Bad syntax (%s) at ^ in:\n"%s%s^%s%s"'%new i([this.lines+1,this._uri,this._why,d,m(a,c,b),m(a,b,b+60),e])},X}();b.exports=g},{"./uri":71,"./util":72}],56:[function(a,b,c){"use strict";function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function g(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var d=function(){function a(a,b){for(var c=0;c=0&&d"}},{key:"uri",get:function(){return this.value},set:function(b){this.value=b}}],[{key:"fromValue",value:function(c){if("undefined"==typeof c||null===c)return c;var d=c&&c.termType;return d?c:new b(c)}}]),b}(i);j.termType="NamedNode",j.prototype.classOrder=h.NamedNode,j.prototype.isVar=0,b.exports=j},{"./class-order":43,"./node":58}],57:[function(a,b,c){"use strict";function e(a){return function(b){return new d(a+(b||""))}}var d=a("./named-node");b.exports=e},{"./named-node":56}],58:[function(a,b,c){"use strict";function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var d=function(){function a(a,b){for(var c=0;cb.classOrder?1:this.valueb.value?1:0}},{key:"equals",value:function(b){return!!b&&(this.termType===b.termType&&this.value===b.value)}},{key:"hashString",value:function(){return this.toCanonical()}},{key:"sameTerm",value:function(b){return this.equals(b)}},{key:"toCanonical",value:function(){return this.toNT()}},{key:"toNT",value:function(){return this.toString()}},{key:"toString",value:function(){throw new Error("Node.toString() is abstract - see the subclasses instead")}}]),a}();b.exports=f,f.fromValue=function(c){var d=a("./collection"),e=a("./literal");a("./named-node");if("undefined"==typeof c||null===c)return c;var g=c&&c.termType;return g?c:Array.isArray(c)?new d(c):e.fromValue(c)}},{"./collection":44,"./literal":53,"./named-node":56}],59:[function(a,b,c){"use strict";function n(a,b,c,n,o){function u(){o&&o(null,b)}function v(a){if("application/ld+json"!==n||"application/nquads"!==n||"application/n-quads"!==n){if(!o)throw new Error("Error trying to parse <"+c+"> as "+n+":\n"+a+":\n"+a.stack);o(a,b)}}function w(a,c){a&&o(a,b);try{r.parse(c,x)}catch(a){o(a,b)}}function x(a,c,d){if(a&&o(a,b),c)s.push(c);else{for(var e=0;e: Bad syntax:\n "+f+'\n at: "'+d.slice(e,e+30)+'"'};f=0;var n=b.sym(c+"#query");for(l.query=n;;){if(g=k.skipSpace(a,f),g<0)return l;if(";"===a[g]){if(f=k.skipSpace(a,g+1),f<0)return l;g=f}var o=!1;for(h=0;h "+b[d]);return c},h=function(b){var d,c="Bindings: ",f=b.length;for(d=0;dg.length)&&(c.index=g)}return null===c.index&&(c.index=b.statements),!0},r=0,s=function a(c,d,h,i,j,k,l){f.debug("Match begins, Branch count now: "+l.count+" for "+l.pattern_debug);var n=c.fetcher?c.fetcher:null,p=d.statements;if(0===p.length){if(f.debug("FOUND MATCH WITH BINDINGS:"+e(h)),0===d.optional.length)l.reportMatch(h);else{f.debug("OPTIONAL: "+d.optional);var t,q=new m(b,h),s=[];for(t=0;t in query: "+f),a(c,d,h,i,j,k,l)})};for(w=0;w=0){var h=c.substring(0,f);if(""===h)return g=d[""],g?g+c.substring(f+1):null;if("_"===h)return"_:"+c.substring(f+1);if(a.NCNAME.test(h)&&(g=d[h]))return g+c.substring(f+1)}return null}},{key:"parseCURIEOrURI",value:function(b,c,d){var e=this.parseCURIE(b,c,d);return e?e:this.resolveAndNormalize(d,b)}},{key:"parsePredicate",value:function(b,c,d,e,f,g){if(""===b)return null;var h=this.parseTermOrCURIEOrAbsURI(b,c,g?null:d,e,f);return h&&0===h.indexOf("_:")?null:h}},{key:"parsePrefixMappings",value:function(b,c){for(var d=this.tokenize(b),e=null,f=0;f=0&&(b=b.substring(0,c)),d&&d.baseURIMap&&(b=d.baseURIMap(b)),b};for(f.push({current:c,context:this.push(null,g(c.baseURI))});f.length>0;){var h=f.shift();if(h.parent){if(h.context.parent&&h.context.parent.listMapping===h.listMapping)continue;for(var i in h.listMapping){var k=h.listMapping[i];if(0!==k.length){for(var m=[],n=0;n0){B=D;var E=e.spec;this.addTriple(p,E,"http://www.w3.org/ns/rdfa#usesVocabulary",{type:a.objectURI,value:B})}else B=this.vocabulary}for(var F=0;F0?M:null}var $,_,N=p.getAttributeNode("rel"),O=p.getAttributeNode("rev"),P=p.getAttributeNode("typeof"),Q=p.getAttributeNode("property"),R=p.getAttributeNode("datatype"),S=this.inHTMLMode?p.getAttributeNode("datetime"):null,T=p.getAttributeNode("content"),U=p.getAttributeNode("about"),V=p.getAttributeNode("src"),W=p.getAttributeNode("resource"),X=p.getAttributeNode("href"),Y=p.getAttributeNode("inlist"),Z=[];if(N){_=this.tokenize(N.value);for(var aa=0;aa<_.length;aa++)$=this.parsePredicate(_[aa],B,q.terms,v,e,this.inHTMLMode&&null!==Q),$&&Z.push($)}var ba=[];if(O){_=this.tokenize(O.value);for(var ca=0;ca<_.length;ca++)$=this.parsePredicate(_[ca],B,q.terms,v,e,this.inHTMLMode&&Q),$&&ba.push($)}if(this.inHTMLMode&&(N||O)&&Q&&(0===Z.length&&(N=null),0===ba.length&&(O=null)),N||O?(U&&(s=this.parseSafeCURIEOrCURIEOrURI(U.value,v,e)),P&&(u=s),s||(p.parentNode.nodeType===l.DOCUMENT_NODE?s=g(p.baseURI):q.parentObject&&(s=g(p.parentNode.baseURI)===q.parentObject?g(p.baseURI):q.parentObject)),W&&(t=this.parseSafeCURIEOrCURIEOrURI(W.value,v,e)),t||(X?t=this.resolveAndNormalize(e,encodeURI(X.value)):V?t=this.resolveAndNormalize(e,encodeURI(V.value)):!P||U||this.inXHTMLMode&&("head"===p.localName||"body"===p.localName)||(t=this.newBlankNode())),!P||U||!this.inXHTMLMode||"head"!==p.localName&&"body"!==p.localName?P&&!U&&(u=t):u=s):!Q||T||R?(U&&(s=this.parseSafeCURIEOrCURIEOrURI(U.value,v,e)),!s&&W&&(s=this.parseSafeCURIEOrCURIEOrURI(W.value,v,e)),!s&&X&&(s=this.resolveAndNormalize(e,encodeURI(X.value))),!s&&V&&(s=this.resolveAndNormalize(e,encodeURI(V.value))),s||(p.parentNode.nodeType===l.DOCUMENT_NODE?s=g(p.baseURI):!this.inXHTMLMode&&!this.inHTMLMode||"head"!==p.localName&&"body"!==p.localName?P?s=this.newBlankNode():q.parentObject&&(s=g(p.parentNode.baseURI)===q.parentObject?g(p.baseURI):q.parentObject,Q||(r=!0)):s=g(p.parentNode.baseURI)===q.parentObject?g(p.baseURI):q.parentObject),P&&(u=s)):(U&&(s=this.parseSafeCURIEOrCURIEOrURI(U.value,v,e),P&&(u=s)),s||p.parentNode.nodeType!==l.DOCUMENT_NODE?!s&&q.parentObject&&(s=g(p.parentNode.baseURI)===q.parentObject?g(p.baseURI):q.parentObject):(s=g(p.baseURI),P&&(u=s)),P&&!u&&(W&&(u=this.parseSafeCURIEOrCURIEOrURI(W.value,v,e)),!u&&X&&(u=this.resolveAndNormalize(e,encodeURI(X.value))),!u&&V&&(u=this.resolveAndNormalize(e,encodeURI(V.value))),u||!this.inXHTMLMode&&!this.inHTMLMode||"head"!==p.localName&&"body"!==p.localName||(u=s),u||(u=this.newBlankNode()),t=u)),s&&(U||W||u)){var da=s;P&&!U&&!W&&t&&(da=t),this.newSubjectOrigin(p,da)}if(u){_=this.tokenize(P.value);for(var ea=0;ea<_.length;ea++){var fa=this.parseTermOrCURIEOrAbsURI(_[ea],B,q.terms,v,e);fa&&this.addTriple(p,u,a.typeURI,{type:a.objectURI,value:fa})}}if(s&&s!==q.parentObject&&(y={},z=!0),t){if(N&&Y)for(var ga=0;ga=0?a.nodeName.split(":")[1]:a.nodeName),b}.bind(this),f=!0;b.parent;){var g=b.element,h=g.attributes;if(g.nodeType===a.nodeType.TEXT||g.nodeType===a.nodeType.CDATA_SECTION)b.parent.nodeType===b.NODE&&(b.addArc(a.ns.RDF+"value"),b=this.buildFrame(b)),b.addLiteral(g.nodeValue);else if(e(g)!==a.ns.RDF+"RDF")if(b.parent&&b.parent.collection&&(b.addCollectionArc(),b=this.buildFrame(b,b.element),b.parent.element=null),b.parent&&b.parent.nodeType&&b.parent.nodeType!==b.ARC){b.addArc(e(g)),this.reify&&(c=this.getAttributeNodeNS(g,a.ns.RDF,"ID"),c&&(b.rdfid=c.nodeValue,g.removeAttributeNode(c)));var m=this.getAttributeNodeNS(g,a.ns.RDF,"parseType"),n=this.getAttributeNodeNS(g,a.ns.RDF,"datatype");if(n&&(b.datatype=n.nodeValue,g.removeAttributeNode(n)),m){var o=m.nodeValue;"Literal"===o?(b.datatype=a.ns.RDF+"XMLLiteral",b=this.buildFrame(b),b.addLiteral(g),f=!1):"Resource"===o?(b=this.buildFrame(b,b.element),b.parent.element=null,b.addBNode()):"Collection"===o&&(b=this.buildFrame(b,b.element),b.parent.element=null,b.addCollection()),g.removeAttributeNode(m)}if(0!==h.length){var p=this.getAttributeNodeNS(g,a.ns.RDF,"resource"),q=this.getAttributeNodeNS(g,a.ns.RDF,"nodeID");b=this.buildFrame(b),p?(b.addNode(p.nodeValue),g.removeAttributeNode(p)):q?(b.addBNode(q.nodeValue),g.removeAttributeNode(q)):b.addBNode();for(var r=h.length-1;r>=0;r--){var s=this.buildFrame(b);s.addArc(e(h[r])),e(h[r])===a.ns.RDF+"type"?this.buildFrame(s).addNode(h[r].nodeValue):this.buildFrame(s).addLiteral(h[r].nodeValue)}}else 0===g.childNodes.length&&this.buildFrame(b).addLiteral("")}else{var i=this.getAttributeNodeNS(g,a.ns.RDF,"about");if(c=this.getAttributeNodeNS(g,a.ns.RDF,"ID"),i&&c)throw new Error("RDFParser: "+g.nodeName+" has both rdf:id and rdf:about. Halting. Only one of these properties may be specified on a node.");if(!i&&c)b.addNode("#"+c.nodeValue),g.removeAttributeNode(c);else if(null==i&&null==c){var j=this.getAttributeNodeNS(g,a.ns.RDF,"nodeID");j?(b.addBNode(j.nodeValue),g.removeAttributeNode(j)):b.addBNode()}else b.addNode(i.nodeValue),g.removeAttributeNode(i);var k=this.getAttributeNodeNS(g,a.ns.RDF,"type");a.ns.RDF+"Description"!==e(g)&&(k={nodeValue:e(g)}),null!=k&&(this.store.add(b.node,this.store.sym(a.ns.RDF+"type"),this.store.sym(d.join(k.nodeValue,b.base)),this.why),k.nodeName&&g.removeAttributeNode(k));for(var l=h.length-1;l>=0;l--)this.store.add(b.node,this.store.sym(e(h[l])),this.store.literal(h[l].nodeValue,b.lang),this.why)}for(g=b.element;b.parent;){for(var t=b;null==g;)b=b.parent,g=b.element;var u=g.childNodes&&g.childNodes[b.lastChild];if(u&&f){if((u.nodeType===a.nodeType.ELEMENT||u.nodeType===a.nodeType.TEXT||u.nodeType===a.nodeType.CDATA_SECTION)&&(u.nodeType!==a.nodeType.TEXT&&u.nodeType!==a.nodeType.CDATA_SECTION||1===g.childNodes.length)){b.lastChild++,b=this.buildFrame(t,g.childNodes[b.lastChild-1]);break}b.lastChild++}else{if(b.terminateFrame(),!(b=b.parent))break;g=b.element,f=!0}}}},this.cleanParser=function(){this.bnodes={},this.why=null},this.buildFrame=function(b,c){var e=this.frameFactory(this,b,c);if(b&&(e.base=b.base,e.lang=b.lang),!c||c.nodeType===a.nodeType.TEXT||c.nodeType===a.nodeType.CDATA_SECTION)return e;var f=c.attributes,g=c.getAttributeNode("xml:base");null!=g&&(e.base=g.nodeValue,c.removeAttribute("xml:base"));var h=c.getAttributeNode("xml:lang");null!=h&&(e.lang=h.nodeValue,c.removeAttribute("xml:lang"));for(var i=f.length-1;i>=0;i--)if("xml"===f[i].nodeName.substr(0,3)){if("xmlns:"===f[i].name.slice(0,6)){var j=f[i].nodeValue;this.base&&(j=d.join(j,this.base)),this.store.setPrefixForURI(f[i].name.slice(6),j)}c.removeAttributeNode(f[i])}return e}};b.exports=e},{"./uri":71}],65:[function(a,b,c){"use strict";function f(a,b,c,f,g){function l(a,b){return g?void g(a,b):b}var h=null;try{var k,i=e(b),j=b.statementsMatching(void 0,void 0,void 0,a);switch(i.suggestNamespaces(b.namespaces),i.setBase(c),f){case"application/rdf+xml":return h=i.statementsToXML(j),l(null,h);case"text/n3":case"application/n3":return h=i.statementsToN3(j),l(null,h);case"text/turtle":case"application/x-turtle":return i.setFlags("si"),h=i.statementsToN3(j),l(null,h);case"application/ld+json":k=i.statementsToN3(j),d.convertToJson(k,g);break;case"application/n-quads":case"application/nquads":k=i.statementsToN3(j),h=d.convertToNQuads(k,g);break;default:throw new Error("Serialize: Content-type "+f+" not supported for data write.")}}catch(a){if(g)return g(a);throw a}}b.exports=f;var d=a("./convert"),e=a("./serializer")},{"./convert":45,"./serializer":66}],66:[function(a,b,c){"use strict";var d=a("./named-node"),e=a("./uri"),f=a("./util"),g=a("./xsd"),h=function(){function b(a){return encodeURI(a)}function c(a){for(var c,b="",d=0;d65535?"\\U"+("00000000"+c.toString(16)).slice(-8):c>126?"\\u"+("0000"+c.toString(16)).slice(-4):a[d];return b}var a=function(b){this.flags="",this.base=null,this.prefixes=[],this.namespaces=[],this.suggestPrefix("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this.suggestPrefix("xml","reserved:reservedForFutureUse"),this.namespacesUsed=[],this.keywords=["a"],this.prefixchars="abcdefghijklmnopqustuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",this.incoming=null,this.formulas=[],this.store=b};a.prototype.setBase=function(a){this.base=a},a.prototype.setFlags=function(a){this.flags=a?a:""},a.prototype.toStr=function(a){var b=a.toNT();return"formula"==a.termType&&(this.formulas[b]=a),b},a.prototype.fromStr=function(a){if("{"==a[0]){var b=this.formulas[a];return b||alert("No formula object for "+a),b}return this.store.fromNT(a)},a.prototype.suggestPrefix=function(a,b){"default"!==a.slice(0,7)&&"ns"!==a.slice(0,2)&&a&&b&&(a in this.namespaces||b in this.prefixes||(this.prefixes[b]=a,this.namespaces[a]=b))},a.prototype.suggestNamespaces=function(a){for(var b in a)this.suggestPrefix(b,a[b])},a.prototype.checkIntegrity=function(){var a,b;for(a in this.namespaces)if(this.prefixes[this.namespaces[a]]!==a)throw"Serializer integity error 1: "+a+", "+this.namespaces[a]+", "+this.prefixes[this.namespaces[a]]+"!";for(b in this.prefixes)if(this.namespaces[this.prefixes[b]]!==b)throw"Serializer integity error 2: "+b+", "+this.prefixs[b]+", "+this.namespaces[this.prefixes[b]]+"!"},a.prototype.makeUpPrefix=function(b){function e(c){return!!a.prototype.validPrefix.test(c)&&("ns"!==c&&(!(c in this.namespaces)&&(this.prefixes[b]=c,this.namespaces[c]=b,d=c,!0)))}var d,c=b;e=e.bind(this),"#/".indexOf(c[c.length-1])>=0&&(c=c.slice(0,-1));var f=c.lastIndexOf("/");f>=0&&(c=c.slice(f+1));for(var g=0;g?@[\\]^`{|}~",a.prototype._notNameChars=a.prototype._notQNameChars+":",a.prototype.statementsToN3=function(b){function l(a){for(var c=this.rootSubjects(a),d=c.roots,e=[],f=0;f.\n");for(var b in this.prefixes)this.prefixes.hasOwnProperty(b)&&this.namespacesUsed[b]&&(a+="@prefix "+this.prefixes[b]+": <"+e.refTo(this.base,b)+">.\n");return a+"\n"}var c=4,d=80,g={};this.flags.indexOf("s")<0&&(g["http://www.w3.org/2002/07/owl#sameAs"]="="),this.flags.indexOf("t")<0&&(g["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]="a"),this.flags.indexOf("i")<0&&(g["http://www.w3.org/2000/10/swap/log#implies"]="=>");var h=function(b){for(var c="",d=0;d=0){f=f.slice(0,-1)+k+"\n",g+=1;continue}if("])}".indexOf(k)>=0){f=f.slice(0,-1)+" "+k+"\n",g+=2;continue}}if(g20&&'"'!=c.slice(-1)&&d.indexOf("n")<0&&(c.indexOf("\n")>0||c.indexOf('"')>0)?(h='"""',i=a.prototype.forbidden3):(h='"',i=a.prototype.forbidden1),f=0;f=0?"\\"+'bfrtvn\\"'[l]:d.indexOf("e")>=0?"\\u"+("000"+k.charCodeAt(0).toString(16).toLowerCase()).slice(-4):k}f=g+1}return h+e+c.slice(f)+h},a.prototype.symbolToN3=function(f){var g=f.uri,h=g.indexOf("#");if(h<0&&this.flags.indexOf("/")<0&&(h=g.lastIndexOf("/")),h>=0&&this.flags.indexOf("p")<0&&(0===g.indexOf("http")||0===g.indexOf("ws")||0===g.indexOf("file"))){for(var i=!0,j=h+1;j=0){i=!1;break}if(g.slice(0,h+1)==this.base+"#")return"<#"+g.slice(h+1)+">";if(i){var k=g.slice(h+1),l=g.slice(0,h+1);if(this.defaultNamespace&&this.defaultNamespace==l&&this.flags.indexOf("d")<0)return this.flags.indexOf("k")>=0&&this.keyords.indexOf(k)<0?k:":"+k;this.checkIntegrity();var m=this.prefixes[l];if(m||(m=this.makeUpPrefix(l)),m)return this.namespacesUsed[l]=!0,m+":"+k}}return g=this.flags.indexOf("r")<0&&this.base?e.refTo(this.base,g):this.flags.indexOf("u")>=0?c(g):b(g),"<"+g+">"},a.prototype.writeStore=function(a){var b=this.store,c=b.fetcher,d=c&&c.appNode,e=this.store.index[3];for(s in e){var f=b.fromNT(s);d&&f.sameTerm(d)||a("\n"+this.atomicTermToN3(f)+" "+this.atomicTermToN3(b.sym("http://www.w3.org/2000/10/swap/log#semantics"))+" { "+this.statementsToN3(b.statementsMatching(void 0,void 0,void 0,f))+" }.\n")}b.statementsMatching(void 0,b.sym("http://www.w3.org/2007/ont/link#requestedURI")).map(function(c){a("\n<"+c.object.value+"> log:metadata {\n");var d=b.statementsMatching(void 0,void 0,void 0,c.subject);a(this.statementsToN3(this.statementsToN3(d))),a("}.\n")}),d&&metaSources.push(d);var g=[];metaSources.map(function(a){g=g.concat(b.statementsMatching(void 0,void 0,void 0,a))}),a(this.statementsToN3(g))},a.prototype.statementsToXML=function(b){function m(a){this.suggestPrefix("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");for(var b=this.rootSubjects(a),c=b.roots,d=[],e=0;e",p(h.object,b),""]):c.concat(["<"+f+' rdf:nodeID="'+h.object.toNT().slice(2)+'"/>']);break;case"NamedNode":c=c.concat(["<"+f+' rdf:resource="'+o(h.object)+'"/>']);break;case"Literal":c=c.concat(["<"+f+(h.object.datatype.equals(g.string)?"":' rdf:datatype="'+n(h.object.datatype.uri)+'"')+(h.object.language?' xml:lang="'+h.object.language+'"':"")+">"+n(h.object.value)+""]);break;case"collection":c=c.concat(["<"+f+' rdf:parseType="Collection">',q(h.object,b),""]);break;default:throw"Can't serialize object of type "+h.object.termType+" into XML"}}else e=h.object;var t=e?s(e):"rdf:Description",u="";return"BlankNode"==a.termType?b.incoming[a]&&1==b.incoming[a].length||(u=' rdf:nodeID="'+a.toNT().slice(2)+'"'):u=' rdf:about="'+o(a)+'"',["<"+t+u+">"].concat([c]).concat([""])}function q(a,b){for(var c=[],d=0;d',""]):c.concat(["<"+s(f.predicate)+' rdf:parseType="Resource">',r(f.object,b),""]);break;case"NamedNode":c=c.concat(["<"+s(f.predicate)+' rdf:resource="'+o(f.object)+'"/>']);break;case"Literal":c=c.concat(["<"+s(f.predicate)+(f.object.datatype.equals(g.string)?"":' rdf:datatype="'+n(f.object.datatype.value)+'"')+(f.object.language?' xml:lang="'+f.object.language+'"':"")+">"+n(f.object.value)+""]);break;case"collection":c=c.concat(["<"+s(f.predicate)+' rdf:parseType="Collection">',q(f.object,b),""]);break;default:throw"Can't serialize object of type "+f.object.termType+" into XML"}}return c}function s(b){var c=b.uri,d=c.indexOf("#");if(d<0&&this.flags.indexOf("/")<0&&(d=c.lastIndexOf("/")),d<0)throw"Cannot make qname out of <"+c+">";for(var f=d+1;f=0)throw'Invalid character "'+c[f]+'" cannot be in XML qname for URI: '+c;var g=c.slice(d+1),i=c.slice(0,d+1);if(this.defaultNamespace&&this.defaultNamespace==i&&this.flags.indexOf("d")<0)return g;var j=this.prefixes[i];return j||(j=this.makeUpPrefix(i)),h[i]=!0,j+":"+g}var c=4,e=80,h=[];h["http://www.w3.org/1999/02/22-rdf-syntax-ns#"]=!0;var i="http://www.w3.org/1999/02/22-rdf-syntax-ns#_",j=function(b){for(var c="",d=0;d"];return l(w,-1)};var h=function(c){return new a(c)};return h}();b.exports=h},{"./named-node":56,"./uri":71,"./util":72,"./xsd":74}],67:[function(a,b,c){"use strict";function g(a,b,c){function h(a){if(g[a])return g[a];var b=c.variable(a);return g[a]=b,b}function i(a){return"string"==typeof a&&a.match(/[^ \n\t]/)}function j(a){return"string"==typeof a&&a.match(/^[\?\$]/)}function k(a){return"string"==typeof a?a.replace(/^</,"<").replace(/>$/,">"):a}function l(a){return"string"==typeof a&&a.match(/^<[^>]*>$/)}function m(a){return"string"==typeof a&&(a.match(/^_:/)||a.match(/^$/))}function n(a){return"string"==typeof a&&a.match(/:$/)}function o(a){return"string"==typeof a&&a.match(/^:|^[^_][^:]*:/)}function p(a){var b=a.split(":");return b[0]}function q(a){var b=a.split(":");return b[1]}function r(a){return l(a)?a.slice(1,a.length-1):a}function s(a){var b=a.indexOf("'")===-1?null:a.indexOf("'"),e=a.indexOf('"')===-1?null:a.indexOf('"');if(!b&&!e){var f=new Array(1);return f[0]=a,f}var h,i,g=new Array(2);if(!b||e&&e/g,"> ").replace(/{/g," { ").replace(/}/g," } ").replace(/[\t\n\r]/g," ").replace(/; /g," ; ").replace(/\. /g," . ").replace(/, /g," , "),d.info("New str into spaceDelimit: \n"+a);var b=[],c=a.split(" ");for(var e in c)i(c[e])&&(b=b.concat(c[e]));return b}function u(a){for(var b=a,c=0;c"),"is"===b[c]&&"of"===b[c+2]){b.splice(c,1),b.splice(c+1,1);var d=b[c-1];b[c-1]=b[c+1],b[c+1]=d}return b}function v(a){for(var b=[],e=0;e "+g);var h=p(f),i=r(g);c[h]=i}else d.error("Invalid SPARQL symbol: "+g);else d.error("Invalid SPARQL prefix: "+f)}return c}function B(a,b,c){d.info("Looking for a close bracket of type "+c+" in "+a);for(var e=0,f=0;f"===a[1]?(d.debug("Constraint added: "+a),b.constraints[a[0]]=new E(a[2])):"<"===a[1]?(d.debug("Constraint added: "+a),b.constraints[a[0]]=new E(a[2])):d.warn("I don't know how to handle the constraint: "+a)}function H(a,b){d.debug("Optional query: "+a+" not yet implemented.");var e=c.formula();I(a,e),b.optional.push(e)}function I(a,b){var e,c=v(a);d.debug("WHERE: "+c);for(var f;x("OPTIONAL",c);)f=x("OPTIONAL",c),d.debug("OPT: "+f+" "+c[f]+" in "+c),"{"!==c[f+1]&&d.warn("Bad optional opening bracket in word "+f),e=B(c.slice(f+2),"{","}"),e===-1?d.error("No matching bracket in word "+f):(H(c.slice(f+2,f+2+e),b),f=x("OPTIONAL",c),e=B(c.slice(f+2),"{","}"),c.splice(f,e+3));for(d.debug("WHERE after optionals: "+c);x("FILTER",c);){var g=x("FILTER",c);"("!==c[g+1]&&d.warn("Bad filter opening bracket in word "+g),e=B(c.slice(g+2),"(",")"),e===-1?d.error("No matching bracket in word "+g):(G(c.slice(g+2,g+2+e),b),g=x("FILTER",c),e=B(c.slice(g+2),"(",")"),c.splice(g,e+3))}d.debug("WHERE after filters and optionals: "+c),J(c,b)}function J(a,b){var c=new Array(1);c[0]=-1;for(var e=c.concat(y(".",a)),f=[],g=0;gO)return d.error("Invalid or nonexistent SELECT and WHERE tags in SPARQL query"),!1;if(z(L.slice(N+1,O),K),I(L.slice(O+2,L.length-1),K.pat),b)return K;for(var P in K.pat.statements){var Q=K.pat.statements[P];"NamedNode"===Q.subject.termType&&f&&f.lookUpThing(Q.subject,"sparql:"+Q.subject),"NamedNode"===Q.object.termType&&f&&f.lookUpThing(Q.object,"sparql:"+Q.object)}return K}var d=a("./log"),e=a("./query").Query,f=a("./fetcher");b.exports=g},{"./fetcher":49,"./log":54,"./query":62}],68:[function(a,b,c){"use strict";function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var d=function(){function a(a,b){for(var c=0;c=0)return"SPARQL";var n=b.each(l,this.ns.httph("ms-author-via"));if(n.length)for(h=0;h=0)return"SPARQL";if(j.indexOf("DAV")>=0)return"DAV"}var o=b.each(l,this.ns.http("status"));if(o.length)for(h=0;h");var d=m.XMLHTTPFactory();d.options={},d.onreadystatechange=function(){if(4===d.readyState){var e=!d.status||d.status>=200&&d.status<300;e?console.log("sparql: update Ok for <"+a+">"):console.log("sparql: update failed for <"+a+"> status="+d.status+", "+d.statusText+", body length="+d.responseText.length+"\n for query: "+b),c(a,e,d.responseText,d)}},d.open("PATCH",a,!0),d.setRequestHeader("Content-type","application/sparql-update"),d.send(b)},a.prototype.update_statement=function(a){if(!a||a.why){var b=this,c=this._statement_context(a);return{statement:a?[a.subject,a.predicate,a.object,a.why]:void 0,statementNT:a?this.anonymizeNT(a):void 0,where:b._context_where(c),set_object:function(c,d){var e=this.where;e+="DELETE DATA { "+this.statementNT+" } ;\n",e+="INSERT DATA { "+this.anonymize(this.statement[0])+" "+this.anonymize(this.statement[1])+" "+this.anonymize(c)+" . }\n",b._fire(this.statement[3].uri,e,d)}}}},a.prototype.insert_statement=function(a,b){var c=a instanceof Array?a[0]:a,d=this._context_where(this._statement_context(c));if(a instanceof Array){for(var e="",f=0;f 1 differnt downstream actions")}c.downstreamAction=b}else b(a)},a.prototype.clearUpstreamCount=function(a){var b=this.patchControlFor(a);b.upstreamCount=0},a.prototype.getUpdatesVia=function(a){var b=this.store.fetcher.getHeader(a,"updates-via");return b&&b.length?b[0].trim():null},a.prototype.addDownstreamChangeListener=function(a,b){var c=this.patchControlFor(a);c.downstreamChangeListeners||(c.downstreamChangeListeners=[]),c.downstreamChangeListeners.push(b);var d=this;this.setRefreshHandler(a,function(a){d.reloadAndSync(a)})},a.prototype.reloadAndSync=function(a){var b=this.patchControlFor(a),c=this;if(b.reloading)return void console.log(" Already reloading - stop");b.reloading=!0;var d=1e3,e=function e(){console.log("try reload - timeout = "+d),c.reload(c.store,a,function(c,f,g){if(b.reloading=!1,c){if(b.downstreamChangeListeners)for(var h=0;h=0))return void console.log("just an echo");j.upstreamCount=0,console.log("Assume a real downstream change"),e.requestDownstreamAction(a,d)}}};return i(),!0},a.prototype.update=function(a,b,c){try{var e=this.store,f=a?a instanceof h?a.statements:a instanceof Array?a:[a]:[],g=b?b instanceof h?b.statements:b instanceof Array?b:[b]:[];if(!(f instanceof Array))throw new Error("Type Error "+("undefined"==typeof f?"undefined":d(f))+": "+f);if(!(g instanceof Array))throw new Error("Type Error "+("undefined"==typeof g?"undefined":d(g))+": "+g);if(0===f.length&&0===g.length)return c(null,!0);var i=f.length?f[0].why:g[0].why,j=this.patchControlFor(i),n=Date.now(),o=["subject","predicate","object","why"],p=["insert","delete"],q={delete:f,insert:g};p.map(function(a){q[a].map(function(a){if(!i.sameTerm(a.why))throw new Error("update: destination "+i+" inconsistent with delete quad "+a.why);o.map(function(b){if("undefined"==typeof a[b])throw new Error("update: undefined "+b+" of statement.")})})});var r=this.editable(i.uri,e);if(!r)throw new Error("Can't make changes in uneditable "+i);var s,t,u,v;if(r.indexOf("SPARQL")>=0){var w=[];f.length&&(w=this._statement_array_bnodes(f)),g.length&&(w=w.concat(this._statement_array_bnodes(g)));var x=this._bnode_context(w,i),y=this._context_where(x),z="";if(y.length){if(f.length){for(z+="DELETE { ",s=0;s=0){var A=e.any(i,this.ns.link("request"));if(!A)throw new Error("No record of our HTTP GET request for document: "+i);var B=e.any(A,this.ns.link("response"));if(!B)return null;var C=e.the(B,this.ns.httph("content-type")).value;for(t=e.statementsMatching(void 0,void 0,void 0,i).slice(),s=0;s=200&&F.status<300;if(a){for(var b=0;b=0))throw new Error("Unhandled edit method: '"+r+"' for "+i);try{for(console.log("Writing back to local file\n"),t=e.statementsMatching(void 0,void 0,void 0,i).slice(),s=0;s>>");var I=i.uri.slice(7),J=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);if(J.initWithPath(I),!J.exists())throw new Error("Rewriting file <"+i.uri+"> but it does not exist!");var K=Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);for(K.init(J,42,parseInt("0666",8),0),K.write(u,u.length),K.close(),s=0;s\n")}}}catch(a){c(void 0,!1,"Exception in update: "+a)}},a.prototype.put=function(a,b,c,e){var f,g=this.store;if(("undefined"==typeof b?"undefined":d(b))===d(""))f=b;else{var h=k(g);switch(h.suggestNamespaces(g.namespaces),h.setBase(a.uri),c){case"application/rdf+xml":f=h.statementsToXML(b);break;case"text/n3":case"text/turtle":case"application/x-turtle":case"application/n3":f=h.statementsToN3(b);break;default:throw new Error("Content-type "+c+" not supported for data PUT")}}var i=m.XMLHTTPFactory();i.options={},i.onreadystatechange=function(){if(4===i.readyState){var c=!i.status||i.status>=200&&i.status<300;c&&"string"!=typeof b&&b.map(function(a){g.addStatement(a)}),c&&(delete g.fetcher.nonexistant[a.uri],delete g.fetcher.requested[a.uri]),e(a.uri,c,i.responseText,i)}},i.open("PUT",a.uri,!0),i.setRequestHeader("Content-type",c),i.send(f)},a.prototype.reload=function(a,b,c){var d=Date.now();a.fetcher.nowOrWhenFetched(b.uri,{force:!0,noMeta:!0,clearPreviousData:!0},function(a,e,f){if(a)if(f.onErrorWasCalled||200!==f.status)console.log(" Non-HTTP error reloading data! onErrorWasCalled="+f.onErrorWasCalled+" status: "+f.status),c(!1,"Non-HTTP error reloading data: "+e,f);else{var g=Date.now()-d;b.reloadTime_total||(b.reloadTime_total=0),b.reloadTime_count||(b.reloadTime_count=0),b.reloadTime_total+=g,b.reloadTime_count+=1,console.log(" Fetch took "+g+"ms, av. of "+b.reloadTime_count+" = "+b.reloadTime_total/b.reloadTime_count+"ms."),c(!0)}else console.log(" ERROR reloading data: "+e),c(!1,"Error reloading data: "+e,f)})},a.prototype.oldReload=function(a,b,c){var d=g(),e=f(d),h=Date.now();e.nowOrWhenFetched(b.uri,{force:!0,noMeta:!0,clearPreviousData:!0},function(e,f,g){if(e)if(g.onErrorWasCalled||200!==g.status)console.log(" Non-HTTP error reloading data! onErrorWasCalled="+g.onErrorWasCalled+" status: "+g.status),c(!1,"Non-HTTP error reloading data: "+f,g);else{var i=a.statementsMatching(void 0,void 0,void 0,b).slice(),j=d.statementsMatching(void 0,void 0,void 0,b).slice();console.log(" replacing "+i.length+" with "+j.length+" out of total statements "+a.statements.length),a.remove(i),a.add(j);var k=Date.now()-h;0===j.length&&console.log("????????????????? 0000000"),b.reloadTime_total||(b.reloadTime_total=0),b.reloadTime_count||(b.reloadTime_count=0),b.reloadTime_total+=k,b.reloadTime_count+=1,console.log(" fetch took "+k+"ms, av. of "+b.reloadTime_count+" = "+b.reloadTime_total/b.reloadTime_count+"ms."),c(!0)}else console.log(" ERROR reloading data: "+f),c(!1,"Error reloading data: "+f,g)})},a}();b.exports=n},{"./data-factory":46,"./fetcher":49,"./indexed-formula":51,"./namespace":57,"./serializer":66,"./uri":71,"./util":72}],70:[function(a,b,c){"use strict";function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var d=function(){function a(a,b){for(var c=0;c0&&(b=b.slice(0,j)),0===a.length)return b;if(0===a.indexOf("#"))return b+a;if(g=a.indexOf(":"),g>=0)return a;if(c=b.indexOf(":"),0===b.length)return a;if(c<0)return d("Invalid base: "+b+" in join with given: "+a),a;if(e=b.slice(0,+c+1||9e9),0===a.indexOf("//"))return e+a;if(b.indexOf("//",c)===c+1){if(f=b.indexOf("/",c+3),f<0)return b.length-c-3>0?b+"/"+a:e+a}else if(f=b.indexOf("/",c+1),f<0)return b.length-c-1>0?b+"/"+a:e+a;if(0===a.indexOf("/"))return b.slice(0,f)+a;if(i=b.slice(f),h=i.lastIndexOf("/"),h<0)return e+a;for(h>=0&&h0&&"/"!==b[d-1];)d--;if(d<3)return b;if(a.indexOf("//",d-2)>0||b.indexOf("//",d-2)>0)return b;if(a.indexOf(":",d)>0)return b;for(i=0,m=a.slice(d),k=0,h=m.length;k0)for(l=1,n=i;n>=1?l<=n:l>=n;n>=1?++l:--l)o+="../";return o+b.slice(d)}var d=d||console.log;b.exports.docpart=f,b.exports.document=g,b.exports.hostpart=h,b.exports.join=i,b.exports.protocol=j,b.exports.refTo=k;var e=a("./data-factory").namedNode},{"./data-factory":46}],72:[function(a,b,c){"use strict";function f(a,b,c){var f=null;if("undefined"!=typeof a.fetcher&&(f=a.fetcher,"NamedNode"===b.termType)){var h,g=d(b.uri);if(b.uri.indexOf("#")<0){if(s(b.uri,"http://dbpedia.org/resource/Category:"))return;s(b.uri,"http://purl.org/dc/elements/1.1/")||s(b.uri,"http://purl.org/dc/terms/")?h="http://dublincore.org/2005/06/13/dcq":s(b.uri,"http://xmlns.com/wot/0.1/")?h="http://xmlns.com/wot/0.1/index.rdf":s(b.uri,"http://web.resource.org/cc/")&&(h="http://web.resource.org/cc/schema.rdf")}h&&(g=h),f&&"unrequested"!==f.getState(g)||(h&&e.warn("Assuming server still broken, faking redirect of <"+b.uri+"> to <"+g+">"),f.requestURI(g,c))}}function g(a,b,c){c||(c=0);var d=a.length;for(c<0&&(c=d+c);c=0;c--)a.callbacks[b[c]]=[];a.addHook=function(b){a.callbacks[b]||(a.callbacks[b]=[])},a.addCallback=function(b,c){a.callbacks[b].push(c)},a.removeCallback=function(b,c){for(var d=0;d=0;g--)a.callbacks[b][g].apply(a,c)&&d.push(a.callbacks[b][g]);for(g=d.length-1;g>=0;g--)e.push(d[g]);for(g=f;g=0;e--){var j=a.attributes[e];if(!(d.length>0&&d[j.name]||/^\d+$/.test(j.name))){if("class"===j.name&&"replaceClassItemWith"in b&&j.value.split(" ").indexOf(b.replaceClassItemWith.source)>-1){var l=new RegExp(b.replaceClassItemWith.source,"g");j.value=j.value.replace(l,b.replaceClassItemWith.target).trim()}"class"===j.name&&"skipClassWithValue"in b&&b.skipClassWithValue===j.value||i.push(j.name+"='"+j.value.replace(/&/g,"&").replace(//g,">").replace(/'/g,""")+"'")}}if(i.length>0&&("sortAttributes"in b&&b.sortAttributes&&i.sort(function(a,b){return a.toLowerCase().localeCompare(b.toLowerCase())}),f+=" "+i.join(" ")),c[h])f+=" />";else{for(f+=">",f+="html"===h?"\n ":"",g.push("style"===h||"script"===h),e=0;e\n":""}}}else if(8===a.nodeType)f+="";else if(3===a.nodeType||4===a.nodeType){var m=a.nodeValue.replace(/\n+$/,"");f+=g[g.length-1]?m:m.replace(/&/g,"&").replace(//g,">")}else console.log("Warning; Cannot handle serialising nodes of type: "+a.nodeType),console.log(a);return f}function l(){var a=new Date,b=a.getYear()+1900,c=a.getMonth()+1,d=a.getDate(),e=a.getUTCHours(),f=a.getUTCMinutes(),g=a.getSeconds();return c<10&&(c="0"+c),d<10&&(d="0"+d),e<10&&(e="0"+e),f<10&&(f="0"+f),g<10&&(g="0"+g),b+"-"+c+"-"+d+"T"+e+":"+f+":"+g+"Z"}function m(a){for(var d,b=a.getAllResponseHeaders().split("\n"),c={},e=0;e0){var f=b[e].split(": ");"undefined"==typeof f[1]?c[d]+="\n"+f[0]:(d=f[0].toLowerCase(),c[d]=f[1])}return c}function n(a,b,c){var d=function(b){return"BlankNode"===b.termType?null:b},e=function(e){var f=c.statementsMatching(a).map(function(a){return""+d(a.subject)+" "+d(a.predicate)+" "+d(a.object)}).concat(c.statementsMatching(void 0,void 0,a).map(function(a){return""+d(a.subject)+" "+d(a.predicate)+" "+d(a.object)}));return f.sort(),f.join("\n")};return"BlankNode"===a.termType||"BlankNode"===b.termType?0===a.compareTerm(b)?0:e(a)>e(b)?1:e(a)