graphdb-workbench 1.11.1 → 1.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/113.2c059fa7d06fd04149eb.bundle.js +1 -1
  2. package/dist/113.2c059fa7d06fd04149eb.bundle.js.map +1 -1
  3. package/dist/14.0c709b039159410b0b91.bundle.js +1 -1
  4. package/dist/14.0c709b039159410b0b91.bundle.js.map +1 -1
  5. package/dist/{19.6a237d6c25383747735a.bundle.js → 19.271aef502bad5f51c682.bundle.js} +2 -2
  6. package/dist/{19.6a237d6c25383747735a.bundle.js.map → 19.271aef502bad5f51c682.bundle.js.map} +1 -1
  7. package/dist/22.e85ffde858c596437b7a.bundle.js +1 -1
  8. package/dist/22.e85ffde858c596437b7a.bundle.js.map +1 -1
  9. package/dist/27.ab75434b1389b977291c.bundle.js +1 -1
  10. package/dist/27.ab75434b1389b977291c.bundle.js.map +1 -1
  11. package/dist/30.d341c7532759bc79f41a.bundle.js +1 -1
  12. package/dist/30.d341c7532759bc79f41a.bundle.js.map +1 -1
  13. package/dist/37.dcbe2e4e1f86ca2da209.bundle.js +1 -1
  14. package/dist/37.dcbe2e4e1f86ca2da209.bundle.js.map +1 -1
  15. package/dist/38.171aa543e807777b4f29.bundle.js +1 -1
  16. package/dist/38.171aa543e807777b4f29.bundle.js.map +1 -1
  17. package/dist/52.dbb58479cefc4f3ba211.bundle.js +2 -0
  18. package/dist/52.dbb58479cefc4f3ba211.bundle.js.map +1 -0
  19. package/dist/{bundle.26708524aa502d7fbb2a.bundle.js → bundle.ac70985c70f7da448f2d.bundle.js} +4 -4
  20. package/dist/{bundle.26708524aa502d7fbb2a.bundle.js.map → bundle.ac70985c70f7da448f2d.bundle.js.map} +1 -1
  21. package/dist/index.html +3 -3
  22. package/dist/js/angular/core/directives/rdfresourcesearch/templates/rdfResourceSearchTemplate.html +1 -1
  23. package/dist/pages/autocomplete.html +1 -1
  24. package/dist/pages/choose-repository-type.html +1 -1
  25. package/dist/pages/clusterInfo.html +1 -1
  26. package/dist/pages/create-index.html +4 -4
  27. package/dist/pages/dependencies.html +1 -1
  28. package/dist/pages/domainRangeInfo.html +2 -2
  29. package/dist/pages/edit.html +1 -1
  30. package/dist/pages/explore.html +1 -1
  31. package/dist/pages/export.html +1 -1
  32. package/dist/pages/find.html +1 -1
  33. package/dist/pages/graph-config/saveGraphConfig.html +11 -11
  34. package/dist/pages/graphs-visualizations.html +7 -7
  35. package/dist/pages/import.html +1 -1
  36. package/dist/pages/jdbc-create.html +5 -5
  37. package/dist/pages/monitor/queries.html +1 -1
  38. package/dist/pages/monitor/resources.html +2 -2
  39. package/dist/pages/namespaces.html +2 -2
  40. package/dist/pages/rdfClassHierarchyInfo.html +7 -7
  41. package/dist/pages/rdfrank.html +2 -2
  42. package/dist/pages/repositories.html +2 -2
  43. package/dist/pages/repository.html +2 -2
  44. package/dist/pages/similarity-indexes.html +1 -1
  45. package/dist/pages/sparql-template-create.html +5 -5
  46. package/dist/pages/sparql.html +3 -3
  47. package/dist/pages/webapi.html +2 -2
  48. package/dist/res/swagger/index.html +25 -25
  49. package/package.json +1 -1
  50. package/dist/52.ada981f774ef9f09e7a9.bundle.js +0 -2
  51. package/dist/52.ada981f774ef9f09e7a9.bundle.js.map +0 -1
@@ -1,4 +1,4 @@
1
1
  (window.webpackJsonp=window.webpackJsonp||[]).push([[14,2,10,22,27,28,29,30,35,36,48,56,57,58,59,60,61,62,64,65,81,84,85,86,89,104],{206:function(e,t,n){"use strict";var r=r||{};r.Text=function(){function e(e,t,n,r){n=n||10;var i=t/3;return"string"==typeof e?(i*=10/(e.substring(0,t/3).length+1.5),i+=1,e.match(/[\u0900-\u0DFF\u1100-\u11FF\u2E80-\u2EFF\u3000-\u9FFF]/)&&(i*=.6),i<n&&(i=n),Math.round(i)):(i<n&&(i=n),Math.round(i))}return{calcFontSizeRaw:e,calcFontSize:function(t,n,r,i){return e(t,n,r)+"px"},getTextWithElipsisIfNeeded:function(e,t){return"string"==typeof e&&e.length>t?e.substring(0,t-3)+"...":e}}}(),r.Transition={fadeIn:function(e,t){e.style("opacity",0).transition().duration(t).style("opacity",1)},fadeOut:function(e,t){e.style("opacity",1).transition().duration(t).style("opacity",0)}},r.Click={delayDblClick:function(){var e=d3.dispatch("click","dblclick");return d3.rebind((function(t){var n,r=null;t.on("mousedown",(function(){n=d3.mouse(document.body),new Date})),t.on("mouseup",(function(t){var i,o;i=n,o=d3.mouse(document.body),Math.sqrt(Math.pow(i[0]-o[0],2),Math.pow(i[1]-o[1],2))>5||(r?(window.clearTimeout(r),r=null,e.dblclick(t)):r=window.setTimeout((d3.event,function(){e.click(t),r=null}),250))}))}),e,"on")}},t.a=r},207:function(e,t,n){"use strict";var r=r||{};r.Export={getCSSRules:function(e){var t=$('link[href="'+e+'"]')[0].sheet.rules,n="";return _.each(t,(function(e){n+=e.cssText})),n},generateBase64ImageSource:function(){var e=d3.selectAll("svg").attr({version:"1.1",xmlns:"http://www.w3.org/2000/svg"}).node().parentNode.innerHTML;return"data:image/svg+xml;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(e)))}},t.a=r},209:function(e,t,n){var r,i,o;i=[],void 0===(o="function"==typeof(r=function(){return function(){var e=function(){return"n"},t=function(){return[0,0]},n=function(){return" "},r=f(),i=null,o=null,a=null,s=null;function u(e){var t;i="svg"===(t=(t=e).node()).tagName.toLowerCase()?t:t.ownerSVGElement,o=i.createSVGPoint(),document.body.appendChild(r)}u.show=function(){var r=Array.prototype.slice.call(arguments);r[r.length-1]instanceof SVGElement&&(a=r.pop());var i,o=n.apply(this,r),f=t.apply(this,r),p=e.apply(this,r),h=d(),g=l.length,m=document.documentElement.scrollTop||document.body.scrollTop,y=document.documentElement.scrollLeft||document.body.scrollLeft,v=s.apply(this,r);for(h.html(o).style({opacity:1,"pointer-events":"all"});g--;)h.classed(l[g],!1);return i=c.get(p).apply(this),v?h.style(v):h.classed(p,!0).style({top:i.top+f[0]+m+"px",left:i.left+f[1]+y+"px"}),u},u.hide=function(){return d().style({opacity:0,"pointer-events":"none"}),u},u.attr=function(e,t){if(arguments.length<2&&"string"==typeof e)return d().attr(e);var n=Array.prototype.slice.call(arguments);return d3.selection.prototype.attr.apply(d(),n),u},u.style=function(e,t){if(arguments.length<2&&"string"==typeof e)return d().style(e);var n=Array.prototype.slice.call(arguments);return d3.selection.prototype.style.apply(d(),n),u},u.direction=function(t){return arguments.length?(e=null==t?t:d3.functor(t),u):e},u.offset=function(e){return arguments.length?(t=null==e?e:d3.functor(e),u):t},u.html=function(e){return arguments.length?(n=null==e?e:d3.functor(e),u):n},u.customPosition=function(e){return arguments.length?(s=null==e?e:d3.functor(e),u):s},u.destroy=function(){return r&&(d().remove(),r=null),u};var c=d3.map({n:function(){var e=p();return{top:e.n.y-r.offsetHeight,left:e.n.x-r.offsetWidth/2}},s:function(){var e=p();return{top:e.s.y,left:e.s.x-r.offsetWidth/2}},e:function(){var e=p();return{top:e.e.y-r.offsetHeight/2,left:e.e.x}},w:function(){var e=p();return{top:e.w.y-r.offsetHeight/2,left:e.w.x-r.offsetWidth}},nw:function(){var e=p();return{top:e.nw.y-r.offsetHeight,left:e.nw.x-r.offsetWidth}},ne:function(){var e=p();return{top:e.ne.y-r.offsetHeight,left:e.ne.x}},sw:function(){var e=p();return{top:e.sw.y,left:e.sw.x-r.offsetWidth}},se:function(){var e=p();return{top:e.se.y,left:e.e.x}}}),l=c.keys();function f(){var e=d3.select(document.createElement("div"));return e.style({position:"absolute",top:0,opacity:0,"pointer-events":"none","box-sizing":"border-box"}),e.node()}function d(){return null===r&&(r=f(),document.body.appendChild(r)),d3.select(r)}function p(){for(var e=a||d3.event.target;void 0===e.getScreenCTM&&"undefined"===e.parentNode;)e=e.parentNode;var t={},n=e.getScreenCTM(),r=e.getBBox(),i=r.width,s=r.height,u=r.x,c=r.y;return o.x=u,o.y=c,t.nw=o.matrixTransform(n),o.x+=i,t.ne=o.matrixTransform(n),o.y+=s,t.se=o.matrixTransform(n),o.x-=i,t.sw=o.matrixTransform(n),o.y-=s/2,t.w=o.matrixTransform(n),o.x+=i,t.e=o.matrixTransform(n),o.x-=i/2,o.y-=s/2,t.n=o.matrixTransform(n),o.y+=s,t.s=o.matrixTransform(n),t}return u}})?r.apply(t,i):r)||(e.exports=o)},214:function(e,t,n){var r,i;!function(){var o={version:"3.5.12"},a=[].slice,s=function(e){return a.call(e)},u=this.document;function c(e){return e&&(e.ownerDocument||e.document||e).documentElement}function l(e){return e&&(e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView)}if(u)try{s(u.documentElement.childNodes)[0].nodeType}catch(e){s=function(e){for(var t=e.length,n=new Array(t);t--;)n[t]=e[t];return n}}if(Date.now||(Date.now=function(){return+new Date}),u)try{u.createElement("DIV").style.setProperty("opacity",0,"")}catch(e){var f=this.Element.prototype,d=f.setAttribute,p=f.setAttributeNS,h=this.CSSStyleDeclaration.prototype,g=h.setProperty;f.setAttribute=function(e,t){d.call(this,e,t+"")},f.setAttributeNS=function(e,t,n){p.call(this,e,t,n+"")},h.setProperty=function(e,t,n){g.call(this,e,t+"",n)}}function m(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function y(e){return null===e?NaN:+e}function v(e){return!isNaN(e)}function x(e){return{left:function(t,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);r<i;){var o=r+i>>>1;e(t[o],n)<0?r=o+1:i=o}return r},right:function(t,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);r<i;){var o=r+i>>>1;e(t[o],n)>0?i=o:r=o+1}return r}}}o.ascending=m,o.descending=function(e,t){return t<e?-1:t>e?1:t>=e?0:NaN},o.min=function(e,t){var n,r,i=-1,o=e.length;if(1===arguments.length){for(;++i<o;)if(null!=(r=e[i])&&r>=r){n=r;break}for(;++i<o;)null!=(r=e[i])&&n>r&&(n=r)}else{for(;++i<o;)if(null!=(r=t.call(e,e[i],i))&&r>=r){n=r;break}for(;++i<o;)null!=(r=t.call(e,e[i],i))&&n>r&&(n=r)}return n},o.max=function(e,t){var n,r,i=-1,o=e.length;if(1===arguments.length){for(;++i<o;)if(null!=(r=e[i])&&r>=r){n=r;break}for(;++i<o;)null!=(r=e[i])&&r>n&&(n=r)}else{for(;++i<o;)if(null!=(r=t.call(e,e[i],i))&&r>=r){n=r;break}for(;++i<o;)null!=(r=t.call(e,e[i],i))&&r>n&&(n=r)}return n},o.extent=function(e,t){var n,r,i,o=-1,a=e.length;if(1===arguments.length){for(;++o<a;)if(null!=(r=e[o])&&r>=r){n=i=r;break}for(;++o<a;)null!=(r=e[o])&&(n>r&&(n=r),i<r&&(i=r))}else{for(;++o<a;)if(null!=(r=t.call(e,e[o],o))&&r>=r){n=i=r;break}for(;++o<a;)null!=(r=t.call(e,e[o],o))&&(n>r&&(n=r),i<r&&(i=r))}return[n,i]},o.sum=function(e,t){var n,r=0,i=e.length,o=-1;if(1===arguments.length)for(;++o<i;)v(n=+e[o])&&(r+=n);else for(;++o<i;)v(n=+t.call(e,e[o],o))&&(r+=n);return r},o.mean=function(e,t){var n,r=0,i=e.length,o=-1,a=i;if(1===arguments.length)for(;++o<i;)v(n=y(e[o]))?r+=n:--a;else for(;++o<i;)v(n=y(t.call(e,e[o],o)))?r+=n:--a;if(a)return r/a},o.quantile=function(e,t){var n=(e.length-1)*t+1,r=Math.floor(n),i=+e[r-1],o=n-r;return o?i+o*(e[r]-i):i},o.median=function(e,t){var n,r=[],i=e.length,a=-1;if(1===arguments.length)for(;++a<i;)v(n=y(e[a]))&&r.push(n);else for(;++a<i;)v(n=y(t.call(e,e[a],a)))&&r.push(n);if(r.length)return o.quantile(r.sort(m),.5)},o.variance=function(e,t){var n,r,i=e.length,o=0,a=0,s=-1,u=0;if(1===arguments.length)for(;++s<i;)v(n=y(e[s]))&&(a+=(r=n-o)*(n-(o+=r/++u)));else for(;++s<i;)v(n=y(t.call(e,e[s],s)))&&(a+=(r=n-o)*(n-(o+=r/++u)));if(u>1)return a/(u-1)},o.deviation=function(){var e=o.variance.apply(this,arguments);return e?Math.sqrt(e):e};var w=x(m);function b(e){return e.length}o.bisectLeft=w.left,o.bisect=o.bisectRight=w.right,o.bisector=function(e){return x(1===e.length?function(t,n){return m(e(t),n)}:e)},o.shuffle=function(e,t,n){(o=arguments.length)<3&&(n=e.length,o<2&&(t=0));for(var r,i,o=n-t;o;)i=Math.random()*o--|0,r=e[o+t],e[o+t]=e[i+t],e[i+t]=r;return e},o.permute=function(e,t){for(var n=t.length,r=new Array(n);n--;)r[n]=e[t[n]];return r},o.pairs=function(e){for(var t=0,n=e.length-1,r=e[0],i=new Array(n<0?0:n);t<n;)i[t]=[r,r=e[++t]];return i},o.zip=function(){if(!(r=arguments.length))return[];for(var e=-1,t=o.min(arguments,b),n=new Array(t);++e<t;)for(var r,i=-1,a=n[e]=new Array(r);++i<r;)a[i]=arguments[i][e];return n},o.transpose=function(e){return o.zip.apply(o,e)},o.keys=function(e){var t=[];for(var n in e)t.push(n);return t},o.values=function(e){var t=[];for(var n in e)t.push(e[n]);return t},o.entries=function(e){var t=[];for(var n in e)t.push({key:n,value:e[n]});return t},o.merge=function(e){for(var t,n,r,i=e.length,o=-1,a=0;++o<i;)a+=e[o].length;for(n=new Array(a);--i>=0;)for(t=(r=e[i]).length;--t>=0;)n[--a]=r[t];return n};var C=Math.abs;function S(e){for(var t=1;e*t%1;)t*=10;return t}function M(e,t){for(var n in t)Object.defineProperty(e.prototype,n,{value:t[n],enumerable:!1})}function T(){this._=Object.create(null)}o.range=function(e,t,n){if(arguments.length<3&&(n=1,arguments.length<2&&(t=e,e=0)),(t-e)/n==1/0)throw new Error("infinite range");var r,i=[],o=S(C(n)),a=-1;if(e*=o,t*=o,(n*=o)<0)for(;(r=e+n*++a)>t;)i.push(r/o);else for(;(r=e+n*++a)<t;)i.push(r/o);return i},o.map=function(e,t){var n=new T;if(e instanceof T)e.forEach((function(e,t){n.set(e,t)}));else if(Array.isArray(e)){var r,i=-1,o=e.length;if(1===arguments.length)for(;++i<o;)n.set(i,e[i]);else for(;++i<o;)n.set(t.call(e,r=e[i],i),r)}else for(var a in e)n.set(a,e[a]);return n};var _="__proto__",E="\0";function R(e){return(e+="")===_||e[0]===E?E+e:e}function k(e){return(e+="")[0]===E?e.slice(1):e}function A(e){return R(e)in this._}function I(e){return(e=R(e))in this._&&delete this._[e]}function N(){var e=[];for(var t in this._)e.push(k(t));return e}function L(){var e=0;for(var t in this._)++e;return e}function D(){for(var e in this._)return!1;return!0}function $(){this._=Object.create(null)}function O(e){return e}function P(e,t,n){return function(){var r=n.apply(t,arguments);return r===t?e:r}}function q(e,t){if(t in e)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var n=0,r=z.length;n<r;++n){var i=z[n]+t;if(i in e)return i}}M(T,{has:A,get:function(e){return this._[R(e)]},set:function(e,t){return this._[R(e)]=t},remove:I,keys:N,values:function(){var e=[];for(var t in this._)e.push(this._[t]);return e},entries:function(){var e=[];for(var t in this._)e.push({key:k(t),value:this._[t]});return e},size:L,empty:D,forEach:function(e){for(var t in this._)e.call(this,k(t),this._[t])}}),o.nest=function(){var e,t,n={},r=[],i=[];function a(i,o,s){if(s>=r.length)return t?t.call(n,o):e?o.sort(e):o;for(var u,c,l,f,d=-1,p=o.length,h=r[s++],g=new T;++d<p;)(f=g.get(u=h(c=o[d])))?f.push(c):g.set(u,[c]);return i?(c=i(),l=function(e,t){c.set(e,a(i,t,s))}):(c={},l=function(e,t){c[e]=a(i,t,s)}),g.forEach(l),c}return n.map=function(e,t){return a(t,e,0)},n.entries=function(e){return function e(t,n){if(n>=r.length)return t;var o=[],a=i[n++];return t.forEach((function(t,r){o.push({key:t,values:e(r,n)})})),a?o.sort((function(e,t){return a(e.key,t.key)})):o}(a(o.map,e,0),0)},n.key=function(e){return r.push(e),n},n.sortKeys=function(e){return i[r.length-1]=e,n},n.sortValues=function(t){return e=t,n},n.rollup=function(e){return t=e,n},n},o.set=function(e){var t=new $;if(e)for(var n=0,r=e.length;n<r;++n)t.add(e[n]);return t},M($,{has:A,add:function(e){return this._[R(e+="")]=!0,e},remove:I,values:N,size:L,empty:D,forEach:function(e){for(var t in this._)e.call(this,k(t))}}),o.behavior={},o.rebind=function(e,t){for(var n,r=1,i=arguments.length;++r<i;)e[n=arguments[r]]=P(e,t,t[n]);return e};var z=["webkit","ms","moz","Moz","o","O"];function U(){}function j(){}function Q(e){var t=[],n=new T;function r(){for(var n,r=t,i=-1,o=r.length;++i<o;)(n=r[i].on)&&n.apply(this,arguments);return e}return r.on=function(r,i){var o,a=n.get(r);return arguments.length<2?a&&a.on:(a&&(a.on=null,t=t.slice(0,o=t.indexOf(a)).concat(t.slice(o+1)),n.remove(r)),i&&t.push(n.set(r,{on:i})),e)},r}function F(){o.event.preventDefault()}function H(){for(var e,t=o.event;e=t.sourceEvent;)t=e;return t}function G(e){for(var t=new j,n=0,r=arguments.length;++n<r;)t[arguments[n]]=Q(t);return t.of=function(n,r){return function(i){try{var a=i.sourceEvent=o.event;i.target=e,o.event=i,t[i.type].apply(n,r)}finally{o.event=a}}},t}o.dispatch=function(){for(var e=new j,t=-1,n=arguments.length;++t<n;)e[arguments[t]]=Q(e);return e},j.prototype.on=function(e,t){var n=e.indexOf("."),r="";if(n>=0&&(r=e.slice(n+1),e=e.slice(0,n)),e)return arguments.length<2?this[e].on(r):this[e].on(r,t);if(2===arguments.length){if(null==t)for(e in this)this.hasOwnProperty(e)&&this[e].on(r,null);return this}},o.event=null,o.requote=function(e){return e.replace(B,"\\$&")};var B=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,V={}.__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]};function W(e){return V(e,Z),e}var Y=function(e,t){return t.querySelector(e)},X=function(e,t){return t.querySelectorAll(e)},J=function(e,t){var n=e.matches||e[q(e,"matchesSelector")];return(J=function(e,t){return n.call(e,t)})(e,t)};"function"==typeof Sizzle&&(Y=function(e,t){return Sizzle(e,t)[0]||null},X=Sizzle,J=Sizzle.matchesSelector),o.selection=function(){return o.select(u.documentElement)};var Z=o.selection.prototype=[];function K(e){return"function"==typeof e?e:function(){return Y(e,this)}}function ee(e){return"function"==typeof e?e:function(){return X(e,this)}}Z.select=function(e){var t,n,r,i,o=[];e=K(e);for(var a=-1,s=this.length;++a<s;){o.push(t=[]),t.parentNode=(r=this[a]).parentNode;for(var u=-1,c=r.length;++u<c;)(i=r[u])?(t.push(n=e.call(i,i.__data__,u,a)),n&&"__data__"in i&&(n.__data__=i.__data__)):t.push(null)}return W(o)},Z.selectAll=function(e){var t,n,r=[];e=ee(e);for(var i=-1,o=this.length;++i<o;)for(var a=this[i],u=-1,c=a.length;++u<c;)(n=a[u])&&(r.push(t=s(e.call(n,n.__data__,u,i))),t.parentNode=n);return W(r)};var te={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ne(e,t){return e=o.ns.qualify(e),null==t?e.local?function(){this.removeAttributeNS(e.space,e.local)}:function(){this.removeAttribute(e)}:"function"==typeof t?e.local?function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}:function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}:e.local?function(){this.setAttributeNS(e.space,e.local,t)}:function(){this.setAttribute(e,t)}}function re(e){return e.trim().replace(/\s+/g," ")}function ie(e){return new RegExp("(?:^|\\s+)"+o.requote(e)+"(?:\\s+|$)","g")}function oe(e){return(e+"").trim().split(/^|\s+/)}function ae(e,t){var n=(e=oe(e).map(se)).length;return"function"==typeof t?function(){for(var r=-1,i=t.apply(this,arguments);++r<n;)e[r](this,i)}:function(){for(var r=-1;++r<n;)e[r](this,t)}}function se(e){var t=ie(e);return function(n,r){if(i=n.classList)return r?i.add(e):i.remove(e);var i=n.getAttribute("class")||"";r?(t.lastIndex=0,t.test(i)||n.setAttribute("class",re(i+" "+e))):n.setAttribute("class",re(i.replace(t," ")))}}function ue(e,t,n){return null==t?function(){this.style.removeProperty(e)}:"function"==typeof t?function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}:function(){this.style.setProperty(e,t,n)}}function ce(e,t){return null==t?function(){delete this[e]}:"function"==typeof t?function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}:function(){this[e]=t}}function le(e){return"function"==typeof e?e:(e=o.ns.qualify(e)).local?function(){return this.ownerDocument.createElementNS(e.space,e.local)}:function(){var t=this.ownerDocument,n=this.namespaceURI;return n?t.createElementNS(n,e):t.createElement(e)}}function fe(){var e=this.parentNode;e&&e.removeChild(this)}function de(e){return{__data__:e}}function pe(e){return function(){return J(this,e)}}function he(e){return arguments.length||(e=m),function(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}}function ge(e,t){for(var n=0,r=e.length;n<r;n++)for(var i,o=e[n],a=0,s=o.length;a<s;a++)(i=o[a])&&t(i,a,n);return e}function me(e){return V(e,ye),e}o.ns={prefix:te,qualify:function(e){var t=e.indexOf(":"),n=e;return t>=0&&"xmlns"!==(n=e.slice(0,t))&&(e=e.slice(t+1)),te.hasOwnProperty(n)?{space:te[n],local:e}:e}},Z.attr=function(e,t){if(arguments.length<2){if("string"==typeof e){var n=this.node();return(e=o.ns.qualify(e)).local?n.getAttributeNS(e.space,e.local):n.getAttribute(e)}for(t in e)this.each(ne(t,e[t]));return this}return this.each(ne(e,t))},Z.classed=function(e,t){if(arguments.length<2){if("string"==typeof e){var n=this.node(),r=(e=oe(e)).length,i=-1;if(t=n.classList){for(;++i<r;)if(!t.contains(e[i]))return!1}else for(t=n.getAttribute("class");++i<r;)if(!ie(e[i]).test(t))return!1;return!0}for(t in e)this.each(ae(t,e[t]));return this}return this.each(ae(e,t))},Z.style=function(e,t,n){var r=arguments.length;if(r<3){if("string"!=typeof e){for(n in r<2&&(t=""),e)this.each(ue(n,e[n],t));return this}if(r<2){var i=this.node();return l(i).getComputedStyle(i,null).getPropertyValue(e)}n=""}return this.each(ue(e,t,n))},Z.property=function(e,t){if(arguments.length<2){if("string"==typeof e)return this.node()[e];for(t in e)this.each(ce(t,e[t]));return this}return this.each(ce(e,t))},Z.text=function(e){return arguments.length?this.each("function"==typeof e?function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}:null==e?function(){this.textContent=""}:function(){this.textContent=e}):this.node().textContent},Z.html=function(e){return arguments.length?this.each("function"==typeof e?function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}:null==e?function(){this.innerHTML=""}:function(){this.innerHTML=e}):this.node().innerHTML},Z.append=function(e){return e=le(e),this.select((function(){return this.appendChild(e.apply(this,arguments))}))},Z.insert=function(e,t){return e=le(e),t=K(t),this.select((function(){return this.insertBefore(e.apply(this,arguments),t.apply(this,arguments)||null)}))},Z.remove=function(){return this.each(fe)},Z.data=function(e,t){var n,r,i=-1,o=this.length;if(!arguments.length){for(e=new Array(o=(n=this[0]).length);++i<o;)(r=n[i])&&(e[i]=r.__data__);return e}function a(e,n){var r,i,o,a=e.length,l=n.length,f=Math.min(a,l),d=new Array(l),p=new Array(l),h=new Array(a);if(t){var g,m=new T,y=new Array(a);for(r=-1;++r<a;)(i=e[r])&&(m.has(g=t.call(i,i.__data__,r))?h[r]=i:m.set(g,i),y[r]=g);for(r=-1;++r<l;)(i=m.get(g=t.call(n,o=n[r],r)))?!0!==i&&(d[r]=i,i.__data__=o):p[r]=de(o),m.set(g,!0);for(r=-1;++r<a;)r in y&&!0!==m.get(y[r])&&(h[r]=e[r])}else{for(r=-1;++r<f;)i=e[r],o=n[r],i?(i.__data__=o,d[r]=i):p[r]=de(o);for(;r<l;++r)p[r]=de(n[r]);for(;r<a;++r)h[r]=e[r]}p.update=d,p.parentNode=d.parentNode=h.parentNode=e.parentNode,s.push(p),u.push(d),c.push(h)}var s=me([]),u=W([]),c=W([]);if("function"==typeof e)for(;++i<o;)a(n=this[i],e.call(n,n.parentNode.__data__,i));else for(;++i<o;)a(n=this[i],e);return u.enter=function(){return s},u.exit=function(){return c},u},Z.datum=function(e){return arguments.length?this.property("__data__",e):this.property("__data__")},Z.filter=function(e){var t,n,r,i=[];"function"!=typeof e&&(e=pe(e));for(var o=0,a=this.length;o<a;o++){i.push(t=[]),t.parentNode=(n=this[o]).parentNode;for(var s=0,u=n.length;s<u;s++)(r=n[s])&&e.call(r,r.__data__,s,o)&&t.push(r)}return W(i)},Z.order=function(){for(var e=-1,t=this.length;++e<t;)for(var n,r=this[e],i=r.length-1,o=r[i];--i>=0;)(n=r[i])&&(o&&o!==n.nextSibling&&o.parentNode.insertBefore(n,o),o=n);return this},Z.sort=function(e){e=he.apply(this,arguments);for(var t=-1,n=this.length;++t<n;)this[t].sort(e);return this.order()},Z.each=function(e){return ge(this,(function(t,n,r){e.call(t,t.__data__,n,r)}))},Z.call=function(e){var t=s(arguments);return e.apply(t[0]=this,t),this},Z.empty=function(){return!this.node()},Z.node=function(){for(var e=0,t=this.length;e<t;e++)for(var n=this[e],r=0,i=n.length;r<i;r++){var o=n[r];if(o)return o}return null},Z.size=function(){var e=0;return ge(this,(function(){++e})),e};var ye=[];function ve(e){var t,n;return function(r,i,o){var a,s=e[o].update,u=s.length;for(o!=n&&(n=o,t=0),i>=t&&(t=i+1);!(a=s[t])&&++t<u;);return a}}function xe(e,t,n){var r="__on"+e,i=e.indexOf("."),a=be;i>0&&(e=e.slice(0,i));var u=we.get(e);function c(){var t=this[r];t&&(this.removeEventListener(e,t,t.$),delete this[r])}return u&&(e=u,a=Ce),i?t?function(){var i=a(t,s(arguments));c.call(this),this.addEventListener(e,this[r]=i,i.$=n),i._=t}:c:t?U:function(){var t,n=new RegExp("^__on([^.]+)"+o.requote(e)+"$");for(var r in this)if(t=r.match(n)){var i=this[r];this.removeEventListener(t[1],i,i.$),delete this[r]}}}o.selection.enter=me,o.selection.enter.prototype=ye,ye.append=Z.append,ye.empty=Z.empty,ye.node=Z.node,ye.call=Z.call,ye.size=Z.size,ye.select=function(e){for(var t,n,r,i,o,a=[],s=-1,u=this.length;++s<u;){r=(i=this[s]).update,a.push(t=[]),t.parentNode=i.parentNode;for(var c=-1,l=i.length;++c<l;)(o=i[c])?(t.push(r[c]=n=e.call(i.parentNode,o.__data__,c,s)),n.__data__=o.__data__):t.push(null)}return W(a)},ye.insert=function(e,t){return arguments.length<2&&(t=ve(this)),Z.insert.call(this,e,t)},o.select=function(e){var t;return"string"==typeof e?(t=[Y(e,u)]).parentNode=u.documentElement:(t=[e]).parentNode=c(e),W([t])},o.selectAll=function(e){var t;return"string"==typeof e?(t=s(X(e,u))).parentNode=u.documentElement:(t=s(e)).parentNode=null,W([t])},Z.on=function(e,t,n){var r=arguments.length;if(r<3){if("string"!=typeof e){for(n in r<2&&(t=!1),e)this.each(xe(n,e[n],t));return this}if(r<2)return(r=this.node()["__on"+e])&&r._;n=!1}return this.each(xe(e,t,n))};var we=o.map({mouseenter:"mouseover",mouseleave:"mouseout"});function be(e,t){return function(n){var r=o.event;o.event=n,t[0]=this.__data__;try{e.apply(this,t)}finally{o.event=r}}}function Ce(e,t){var n=be(e,t);return function(e){var t=e.relatedTarget;t&&(t===this||8&t.compareDocumentPosition(this))||n.call(this,e)}}u&&we.forEach((function(e){"on"+e in u&&we.remove(e)}));var Se,Me=0;function Te(e){var t=".dragsuppress-"+ ++Me,n="click"+t,r=o.select(l(e)).on("touchmove"+t,F).on("dragstart"+t,F).on("selectstart"+t,F);if(null==Se&&(Se=!("onselectstart"in e)&&q(e.style,"userSelect")),Se){var i=c(e).style,a=i[Se];i[Se]="none"}return function(e){if(r.on(t,null),Se&&(i[Se]=a),e){var o=function(){r.on(n,null)};r.on(n,(function(){F(),o()}),!0),setTimeout(o,0)}}}o.mouse=function(e){return Ee(e,H())};var _e=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;function Ee(e,t){t.changedTouches&&(t=t.changedTouches[0]);var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();if(_e<0){var i=l(e);if(i.scrollX||i.scrollY){var a=(n=o.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important"))[0][0].getScreenCTM();_e=!(a.f||a.e),n.remove()}}return _e?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),[(r=r.matrixTransform(e.getScreenCTM().inverse())).x,r.y]}var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}function Re(){return o.event.changedTouches[0].identifier}o.touch=function(e,t,n){if(arguments.length<3&&(n=t,t=H().changedTouches),t)for(var r,i=0,o=t.length;i<o;++i)if((r=t[i]).identifier===n)return Ee(e,r)},o.behavior.drag=function(){var e=G(i,"drag","dragstart","dragend"),t=null,n=a(U,o.mouse,l,"mousemove","mouseup"),r=a(Re,o.touch,O,"touchmove","touchend");function i(){this.on("mousedown.drag",n).on("touchstart.drag",r)}function a(n,r,i,a,s){return function(){var u,c=this,l=o.event.target,f=c.parentNode,d=e.of(c,arguments),p=0,h=n(),g=".drag"+(null==h?"":"-"+h),m=o.select(i(l)).on(a+g,x).on(s+g,w),y=Te(l),v=r(f,h);function x(){var e,t,n=r(f,h);n&&(e=n[0]-v[0],t=n[1]-v[1],p|=e|t,v=n,d({type:"drag",x:n[0]+u[0],y:n[1]+u[1],dx:e,dy:t}))}function w(){r(f,h)&&(m.on(a+g,null).on(s+g,null),y(p),d({type:"dragend"}))}u=t?[(u=t.apply(c,arguments)).x-v[0],u.y-v[1]]:[0,0],d({type:"dragstart"})}}return i.origin=function(e){return arguments.length?(t=e,i):t},o.rebind(i,e,"on")},o.touches=function(e,t){return arguments.length<2&&(t=H().touches),t?s(t).map((function(t){var n=Ee(e,t);return n.identifier=t.identifier,n})):[]};var ke=1e-6,Ae=ke*ke,Ie=Math.PI,Ne=2*Ie,Le=Ne-ke,De=Ie/2,$e=Ie/180,Oe=180/Ie;function Pe(e){return e>0?1:e<0?-1:0}function qe(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])}function ze(e){return e>1?0:e<-1?Ie:Math.acos(e)}function Ue(e){return e>1?De:e<-1?-De:Math.asin(e)}function je(e){return((e=Math.exp(e))+1/e)/2}function Qe(e){return(e=Math.sin(e/2))*e}var Fe=Math.SQRT2;o.interpolateZoom=function(e,t){var n,r,i=e[0],o=e[1],a=e[2],s=t[0],u=t[1],c=t[2],l=s-i,f=u-o,d=l*l+f*f;if(d<Ae)r=Math.log(c/a)/Fe,n=function(e){return[i+e*l,o+e*f,a*Math.exp(Fe*e*r)]};else{var p=Math.sqrt(d),h=(c*c-a*a+4*d)/(2*a*2*p),g=(c*c-a*a-4*d)/(2*c*2*p),m=Math.log(Math.sqrt(h*h+1)-h),y=Math.log(Math.sqrt(g*g+1)-g);r=(y-m)/Fe,n=function(e){var t,n=e*r,s=je(m),u=a/(2*p)*(s*(t=Fe*n+m,((t=Math.exp(2*t))-1)/(t+1))-function(e){return((e=Math.exp(e))-1/e)/2}(m));return[i+u*l,o+u*f,a*s/je(Fe*n+m)]}}return n.duration=1e3*r,n},o.behavior.zoom=function(){var e,t,n,r,i,a,s,c,f,d={x:0,y:0,k:1},p=[960,500],h=Be,g=250,m=0,y="mousedown.zoom",v="mousemove.zoom",x="mouseup.zoom",w="touchstart.zoom",b=G(C,"zoomstart","zoom","zoomend");function C(e){e.on(y,I).on(Ge+".zoom",L).on("dblclick.zoom",D).on(w,N)}function S(e){return[(e[0]-d.x)/d.k,(e[1]-d.y)/d.k]}function M(e){d.k=Math.max(h[0],Math.min(h[1],e))}function T(e,t){t=function(e){return[e[0]*d.k+d.x,e[1]*d.k+d.y]}(t),d.x+=e[0]-t[0],d.y+=e[1]-t[1]}function _(e,n,r,i){e.__chart__={x:d.x,y:d.y,k:d.k},M(Math.pow(2,i)),T(t=n,r),e=o.select(e),g>0&&(e=e.transition().duration(g)),e.call(C.event)}function E(){s&&s.domain(a.range().map((function(e){return(e-d.x)/d.k})).map(a.invert)),f&&f.domain(c.range().map((function(e){return(e-d.y)/d.k})).map(c.invert))}function R(e){m++||e({type:"zoomstart"})}function k(e){E(),e({type:"zoom",scale:d.k,translate:[d.x,d.y]})}function A(e){--m||(e({type:"zoomend"}),t=null)}function I(){var e=this,t=b.of(e,arguments),n=0,r=o.select(l(e)).on(v,(function(){n=1,T(o.mouse(e),i),k(t)})).on(x,(function(){r.on(v,null).on(x,null),a(n),A(t)})),i=S(o.mouse(e)),a=Te(e);_s.call(e),R(t)}function N(){var e,t=this,n=b.of(t,arguments),r={},a=0,s=".zoom-"+o.event.changedTouches[0].identifier,u="touchmove"+s,c="touchend"+s,l=[],f=o.select(t),p=Te(t);function h(){var n=o.touches(t);return e=d.k,n.forEach((function(e){e.identifier in r&&(r[e.identifier]=S(e))})),n}function g(){var e=o.event.target;o.select(e).on(u,m).on(c,v),l.push(e);for(var n=o.event.changedTouches,s=0,f=n.length;s<f;++s)r[n[s].identifier]=null;var p=h(),g=Date.now();if(1===p.length){if(g-i<500){var y=p[0];_(t,y,r[y.identifier],Math.floor(Math.log(d.k)/Math.LN2)+1),F()}i=g}else if(p.length>1){y=p[0];var x=p[1],w=y[0]-x[0],b=y[1]-x[1];a=w*w+b*b}}function m(){var s,u,c,l,f=o.touches(t);_s.call(t);for(var d=0,p=f.length;d<p;++d,l=null)if(c=f[d],l=r[c.identifier]){if(u)break;s=c,u=l}if(l){var h=(h=c[0]-s[0])*h+(h=c[1]-s[1])*h,g=a&&Math.sqrt(h/a);s=[(s[0]+c[0])/2,(s[1]+c[1])/2],u=[(u[0]+l[0])/2,(u[1]+l[1])/2],M(g*e)}i=null,T(s,u),k(n)}function v(){if(o.event.touches.length){for(var e=o.event.changedTouches,t=0,i=e.length;t<i;++t)delete r[e[t].identifier];for(var a in r)return void h()}o.selectAll(l).on(s,null),f.on(y,I).on(w,N),p(),A(n)}g(),R(n),f.on(y,null).on(w,g)}function L(){var i=b.of(this,arguments);r?clearTimeout(r):(_s.call(this),e=S(t=n||o.mouse(this)),R(i)),r=setTimeout((function(){r=null,A(i)}),50),F(),M(Math.pow(2,.002*He())*d.k),T(t,e),k(i)}function D(){var e=o.mouse(this),t=Math.log(d.k)/Math.LN2;_(this,e,S(e),o.event.shiftKey?Math.ceil(t)-1:Math.floor(t)+1)}return Ge||(Ge="onwheel"in u?(He=function(){return-o.event.deltaY*(o.event.deltaMode?120:1)},"wheel"):"onmousewheel"in u?(He=function(){return o.event.wheelDelta},"mousewheel"):(He=function(){return-o.event.detail},"MozMousePixelScroll")),C.event=function(e){e.each((function(){var e=b.of(this,arguments),n=d;ks?o.select(this).transition().each("start.zoom",(function(){d=this.__chart__||{x:0,y:0,k:1},R(e)})).tween("zoom:zoom",(function(){var r=p[0],i=p[1],a=t?t[0]:r/2,s=t?t[1]:i/2,u=o.interpolateZoom([(a-d.x)/d.k,(s-d.y)/d.k,r/d.k],[(a-n.x)/n.k,(s-n.y)/n.k,r/n.k]);return function(t){var n=u(t),i=r/n[2];this.__chart__=d={x:a-n[0]*i,y:s-n[1]*i,k:i},k(e)}})).each("interrupt.zoom",(function(){A(e)})).each("end.zoom",(function(){A(e)})):(this.__chart__=d,R(e),k(e),A(e))}))},C.translate=function(e){return arguments.length?(d={x:+e[0],y:+e[1],k:d.k},E(),C):[d.x,d.y]},C.scale=function(e){return arguments.length?(d={x:d.x,y:d.y,k:null},M(+e),E(),C):d.k},C.scaleExtent=function(e){return arguments.length?(h=null==e?Be:[+e[0],+e[1]],C):h},C.center=function(e){return arguments.length?(n=e&&[+e[0],+e[1]],C):n},C.size=function(e){return arguments.length?(p=e&&[+e[0],+e[1]],C):p},C.duration=function(e){return arguments.length?(g=+e,C):g},C.x=function(e){return arguments.length?(s=e,a=e.copy(),d={x:0,y:0,k:1},C):s},C.y=function(e){return arguments.length?(f=e,c=e.copy(),d={x:0,y:0,k:1},C):f},o.rebind(C,b,"on")};var He,Ge,Be=[0,1/0];function Ve(){}function We(e,t,n){return this instanceof We?(this.h=+e,this.s=+t,void(this.l=+n)):arguments.length<2?e instanceof We?new We(e.h,e.s,e.l):mt(""+e,yt,We):new We(e,t,n)}o.color=Ve,Ve.prototype.toString=function(){return this.rgb()+""},o.hsl=We;var Ye=We.prototype=new Ve;function Xe(e,t,n){var r,i;function o(e){return Math.round(255*function(e){return e>360?e-=360:e<0&&(e+=360),e<60?r+(i-r)*e/60:e<180?i:e<240?r+(i-r)*(240-e)/60:r}(e))}return e=isNaN(e)?0:(e%=360)<0?e+360:e,t=isNaN(t)?0:t<0?0:t>1?1:t,r=2*(n=n<0?0:n>1?1:n)-(i=n<=.5?n*(1+t):n+t-n*t),new ft(o(e+120),o(e),o(e-120))}function Je(e,t,n){return this instanceof Je?(this.h=+e,this.c=+t,void(this.l=+n)):arguments.length<2?e instanceof Je?new Je(e.h,e.c,e.l):st(e instanceof et?e.l:(e=vt((e=o.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Je(e,t,n)}Ye.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),new We(this.h,this.s,this.l/e)},Ye.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new We(this.h,this.s,e*this.l)},Ye.rgb=function(){return Xe(this.h,this.s,this.l)},o.hcl=Je;var Ze=Je.prototype=new Ve;function Ke(e,t,n){return isNaN(e)&&(e=0),isNaN(t)&&(t=0),new et(n,Math.cos(e*=$e)*t,Math.sin(e)*t)}function et(e,t,n){return this instanceof et?(this.l=+e,this.a=+t,void(this.b=+n)):arguments.length<2?e instanceof et?new et(e.l,e.a,e.b):e instanceof Je?Ke(e.h,e.c,e.l):vt((e=ft(e)).r,e.g,e.b):new et(e,t,n)}Ze.brighter=function(e){return new Je(this.h,this.c,Math.min(100,this.l+tt*(arguments.length?e:1)))},Ze.darker=function(e){return new Je(this.h,this.c,Math.max(0,this.l-tt*(arguments.length?e:1)))},Ze.rgb=function(){return Ke(this.h,this.c,this.l).rgb()},o.lab=et;var tt=18,nt=.95047,rt=1,it=1.08883,ot=et.prototype=new Ve;function at(e,t,n){var r=(e+16)/116,i=r+t/500,o=r-n/200;return new ft(lt(3.2404542*(i=ut(i)*nt)-1.5371385*(r=ut(r)*rt)-.4985314*(o=ut(o)*it)),lt(-.969266*i+1.8760108*r+.041556*o),lt(.0556434*i-.2040259*r+1.0572252*o))}function st(e,t,n){return e>0?new Je(Math.atan2(n,t)*Oe,Math.sqrt(t*t+n*n),e):new Je(NaN,NaN,e)}function ut(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function ct(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function lt(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function ft(e,t,n){return this instanceof ft?(this.r=~~e,this.g=~~t,void(this.b=~~n)):arguments.length<2?e instanceof ft?new ft(e.r,e.g,e.b):mt(""+e,ft,Xe):new ft(e,t,n)}function dt(e){return new ft(e>>16,e>>8&255,255&e)}function pt(e){return dt(e)+""}ot.brighter=function(e){return new et(Math.min(100,this.l+tt*(arguments.length?e:1)),this.a,this.b)},ot.darker=function(e){return new et(Math.max(0,this.l-tt*(arguments.length?e:1)),this.a,this.b)},ot.rgb=function(){return at(this.l,this.a,this.b)},o.rgb=ft;var ht=ft.prototype=new Ve;function gt(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function mt(e,t,n){var r,i,o,a=0,s=0,u=0;if(r=/([a-z]+)\((.*)\)/.exec(e=e.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return n(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return t(wt(i[0]),wt(i[1]),wt(i[2]))}return(o=bt.get(e))?t(o.r,o.g,o.b):(null==e||"#"!==e.charAt(0)||isNaN(o=parseInt(e.slice(1),16))||(4===e.length?(a=(3840&o)>>4,a|=a>>4,s=240&o,s|=s>>4,u=15&o,u|=u<<4):7===e.length&&(a=(16711680&o)>>16,s=(65280&o)>>8,u=255&o)),t(a,s,u))}function yt(e,t,n){var r,i,o=Math.min(e/=255,t/=255,n/=255),a=Math.max(e,t,n),s=a-o,u=(a+o)/2;return s?(i=u<.5?s/(a+o):s/(2-a-o),r=e==a?(t-n)/s+(t<n?6:0):t==a?(n-e)/s+2:(e-t)/s+4,r*=60):(r=NaN,i=u>0&&u<1?0:r),new We(r,i,u)}function vt(e,t,n){var r=ct((.4124564*(e=xt(e))+.3575761*(t=xt(t))+.1804375*(n=xt(n)))/nt),i=ct((.2126729*e+.7151522*t+.072175*n)/rt);return et(116*i-16,500*(r-i),200*(i-ct((.0193339*e+.119192*t+.9503041*n)/it)))}function xt(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function wt(e){var t=parseFloat(e);return"%"===e.charAt(e.length-1)?Math.round(2.55*t):t}ht.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,n=this.g,r=this.b,i=30;return t||n||r?(t&&t<i&&(t=i),n&&n<i&&(n=i),r&&r<i&&(r=i),new ft(Math.min(255,t/e),Math.min(255,n/e),Math.min(255,r/e))):new ft(i,i,i)},ht.darker=function(e){return new ft((e=Math.pow(.7,arguments.length?e:1))*this.r,e*this.g,e*this.b)},ht.hsl=function(){return yt(this.r,this.g,this.b)},ht.toString=function(){return"#"+gt(this.r)+gt(this.g)+gt(this.b)};var bt=o.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});function Ct(e){return"function"==typeof e?e:function(){return e}}function St(e){return function(t,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=null),Mt(t,n,e,r)}}function Mt(e,t,n,r){var i={},a=o.dispatch("beforesend","progress","load","error"),u={},c=new XMLHttpRequest,l=null;function f(){var e,t=c.status;if(!t&&function(e){var t=e.responseType;return t&&"text"!==t?e.response:e.responseText}(c)||t>=200&&t<300||304===t){try{e=n.call(i,c)}catch(e){return void a.error.call(i,e)}a.load.call(i,e)}else a.error.call(i,c)}return!this.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(e)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=f:c.onreadystatechange=function(){c.readyState>3&&f()},c.onprogress=function(e){var t=o.event;o.event=e;try{a.progress.call(i,c)}finally{o.event=t}},i.header=function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?u[e]:(null==t?delete u[e]:u[e]=t+"",i)},i.mimeType=function(e){return arguments.length?(t=null==e?null:e+"",i):t},i.responseType=function(e){return arguments.length?(l=e,i):l},i.response=function(e){return n=e,i},["get","post"].forEach((function(e){i[e]=function(){return i.send.apply(i,[e].concat(s(arguments)))}})),i.send=function(n,r,o){if(2===arguments.length&&"function"==typeof r&&(o=r,r=null),c.open(n,e,!0),null==t||"accept"in u||(u.accept=t+",*/*"),c.setRequestHeader)for(var s in u)c.setRequestHeader(s,u[s]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=l&&(c.responseType=l),null!=o&&i.on("error",o).on("load",(function(e){o(null,e)})),a.beforesend.call(i,c),c.send(null==r?null:r),i},i.abort=function(){return c.abort(),i},o.rebind(i,a,"on"),null==r?i:i.get(function(e){return 1===e.length?function(t,n){e(null==t?n:null)}:e}(r))}bt.forEach((function(e,t){bt.set(e,dt(t))})),o.functor=Ct,o.xhr=St(O),o.dsv=function(e,t){var n=new RegExp('["'+e+"\n]"),r=e.charCodeAt(0);function i(e,n,r){arguments.length<3&&(r=n,n=null);var i=Mt(e,t,null==n?o:a(n),r);return i.row=function(e){return arguments.length?i.response(null==(n=e)?o:a(e)):n},i}function o(e){return i.parse(e.responseText)}function a(e){return function(t){return i.parse(t.responseText,e)}}function s(t){return t.map(u).join(e)}function u(e){return n.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}return i.parse=function(e,t){var n;return i.parseRows(e,(function(e,r){if(n)return n(e,r-1);var i=new Function("d","return {"+e.map((function(e,t){return JSON.stringify(e)+": d["+t+"]"})).join(",")+"}");n=t?function(e,n){return t(i(e),n)}:i}))},i.parseRows=function(e,t){var n,i,o={},a={},s=[],u=e.length,c=0,l=0;function f(){if(c>=u)return a;if(i)return i=!1,o;var t=c;if(34===e.charCodeAt(t)){for(var n=t;n++<u;)if(34===e.charCodeAt(n)){if(34!==e.charCodeAt(n+1))break;++n}return c=n+2,13===(s=e.charCodeAt(n+1))?(i=!0,10===e.charCodeAt(n+2)&&++c):10===s&&(i=!0),e.slice(t+1,n).replace(/""/g,'"')}for(;c<u;){var s,l=1;if(10===(s=e.charCodeAt(c++)))i=!0;else if(13===s)i=!0,10===e.charCodeAt(c)&&(++c,++l);else if(s!==r)continue;return e.slice(t,c-l)}return e.slice(t)}for(;(n=f())!==a;){for(var d=[];n!==o&&n!==a;)d.push(n),n=f();t&&null==(d=t(d,l++))||s.push(d)}return s},i.format=function(t){if(Array.isArray(t[0]))return i.formatRows(t);var n=new $,r=[];return t.forEach((function(e){for(var t in e)n.has(t)||r.push(n.add(t))})),[r.map(u).join(e)].concat(t.map((function(t){return r.map((function(e){return u(t[e])})).join(e)}))).join("\n")},i.formatRows=function(e){return e.map(s).join("\n")},i},o.csv=o.dsv(",","text/csv"),o.tsv=o.dsv("\t","text/tab-separated-values");var Tt,_t,Et,Rt,kt=this[q(this,"requestAnimationFrame")]||function(e){setTimeout(e,17)};function At(e,t,n){var r=arguments.length;r<2&&(t=0),r<3&&(n=Date.now());var i={c:e,t:n+t,n:null};return _t?_t.n=i:Tt=i,_t=i,Et||(Rt=clearTimeout(Rt),Et=1,kt(It)),i}function It(){var e=Nt(),t=Lt()-e;t>24?(isFinite(t)&&(clearTimeout(Rt),Rt=setTimeout(It,t)),Et=0):(Et=1,kt(It))}function Nt(){for(var e=Date.now(),t=Tt;t;)e>=t.t&&t.c(e-t.t)&&(t.c=null),t=t.n;return e}function Lt(){for(var e,t=Tt,n=1/0;t;)t.c?(t.t<n&&(n=t.t),t=(e=t).n):t=e?e.n=t.n:Tt=t.n;return _t=e,n}function Dt(e,t){return t-(e?Math.ceil(Math.log(e)/Math.LN10):1)}o.timer=function(){At.apply(this,arguments)},o.timer.flush=function(){Nt(),Lt()},o.round=function(e,t){return t?Math.round(e*(t=Math.pow(10,t)))/t:Math.round(e)};var $t=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map((function(e,t){var n=Math.pow(10,3*C(8-t));return{scale:t>8?function(e){return e/n}:function(e){return e*n},symbol:e}}));function Ot(e){var t=e.decimal,n=e.thousands,r=e.grouping,i=e.currency,a=r&&n?function(e,t){for(var i=e.length,o=[],a=0,s=r[0],u=0;i>0&&s>0&&(u+s+1>t&&(s=Math.max(1,t-u)),o.push(e.substring(i-=s,i+s)),!((u+=s+1)>t));)s=r[a=(a+1)%r.length];return o.reverse().join(n)}:O;return function(e){var n=Pt.exec(e),r=n[1]||" ",s=n[2]||">",u=n[3]||"-",c=n[4]||"",l=n[5],f=+n[6],d=n[7],p=n[8],h=n[9],g=1,m="",y="",v=!1,x=!0;switch(p&&(p=+p.substring(1)),(l||"0"===r&&"="===s)&&(l=r="0",s="="),h){case"n":d=!0,h="g";break;case"%":g=100,y="%",h="f";break;case"p":g=100,y="%",h="r";break;case"b":case"o":case"x":case"X":"#"===c&&(m="0"+h.toLowerCase());case"c":x=!1;case"d":v=!0,p=0;break;case"s":g=-1,h="r"}"$"===c&&(m=i[0],y=i[1]),"r"!=h||p||(h="g"),null!=p&&("g"==h?p=Math.max(1,Math.min(21,p)):"e"!=h&&"f"!=h||(p=Math.max(0,Math.min(20,p)))),h=qt.get(h)||zt;var w=l&&d;return function(e){var n=y;if(v&&e%1)return"";var i=e<0||0===e&&1/e<0?(e=-e,"-"):"-"===u?"":u;if(g<0){var c=o.formatPrefix(e,p);e=c.scale(e),n=c.symbol+y}else e*=g;var b,C,S=(e=h(e,p)).lastIndexOf(".");if(S<0){var M=x?e.lastIndexOf("e"):-1;M<0?(b=e,C=""):(b=e.substring(0,M),C=e.substring(M))}else b=e.substring(0,S),C=t+e.substring(S+1);!l&&d&&(b=a(b,1/0));var T=m.length+b.length+C.length+(w?0:i.length),_=T<f?new Array(T=f-T+1).join(r):"";return w&&(b=a(_+b,_.length?f-C.length:1/0)),i+=m,e=b+C,("<"===s?i+e+_:">"===s?_+i+e:"^"===s?_.substring(0,T>>=1)+i+e+_.substring(T):i+(w?e:_+e))+n}}}o.formatPrefix=function(e,t){var n=0;return(e=+e)&&(e<0&&(e*=-1),t&&(e=o.round(e,Dt(e,t))),n=1+Math.floor(1e-12+Math.log(e)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),$t[8+n/3]};var Pt=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,qt=o.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(e,t){return(e=o.round(e,Dt(e,t))).toFixed(Math.max(0,Math.min(20,Dt(e*(1+1e-15),t))))}});function zt(e){return e+""}var Ut=o.time={},jt=Date;function Qt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Qt.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Ft.setUTCDate.apply(this._,arguments)},setDay:function(){Ft.setUTCDay.apply(this._,arguments)},setFullYear:function(){Ft.setUTCFullYear.apply(this._,arguments)},setHours:function(){Ft.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Ft.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Ft.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Ft.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Ft.setUTCSeconds.apply(this._,arguments)},setTime:function(){Ft.setTime.apply(this._,arguments)}};var Ft=Date.prototype;function Ht(e,t,n){function r(t){var n=e(t),r=o(n,1);return t-n<r-t?n:r}function i(n){return t(n=e(new jt(n-1)),1),n}function o(e,n){return t(e=new jt(+e),n),e}function a(e,r,o){var a=i(e),s=[];if(o>1)for(;a<r;)n(a)%o||s.push(new Date(+a)),t(a,1);else for(;a<r;)s.push(new Date(+a)),t(a,1);return s}e.floor=e,e.round=r,e.ceil=i,e.offset=o,e.range=a;var s=e.utc=Gt(e);return s.floor=s,s.round=Gt(r),s.ceil=Gt(i),s.offset=Gt(o),s.range=function(e,t,n){try{jt=Qt;var r=new Qt;return r._=e,a(r,t,n)}finally{jt=Date}},e}function Gt(e){return function(t,n){try{jt=Qt;var r=new Qt;return r._=t,e(r,n)._}finally{jt=Date}}}function Bt(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,s=e.shortDays,u=e.months,c=e.shortMonths;function l(e){var t=e.length;function n(n){for(var r,i,o,a=[],s=-1,u=0;++s<t;)37===e.charCodeAt(s)&&(a.push(e.slice(u,s)),null!=(i=Vt[r=e.charAt(++s)])&&(r=e.charAt(++s)),(o=b[r])&&(r=o(n,null==i?"e"===r?" ":"0":i)),a.push(r),u=s+1);return a.push(e.slice(u,s)),a.join("")}return n.parse=function(t){var n={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null};if(f(n,e,t,0)!=t.length)return null;"p"in n&&(n.H=n.H%12+12*n.p);var r=null!=n.Z&&jt!==Qt,i=new(r?Qt:jt);return"j"in n?i.setFullYear(n.y,0,n.j):"W"in n||"U"in n?("w"in n||(n.w="W"in n?1:0),i.setFullYear(n.y,0,1),i.setFullYear(n.y,0,"W"in n?(n.w+6)%7+7*n.W-(i.getDay()+5)%7:n.w+7*n.U-(i.getDay()+6)%7)):i.setFullYear(n.y,n.m,n.d),i.setHours(n.H+(n.Z/100|0),n.M+n.Z%100,n.S,n.L),r?i._:i},n.toString=function(){return e},n}function f(e,t,n,r){for(var i,o,a,s=0,u=t.length,c=n.length;s<u;){if(r>=c)return-1;if(37===(i=t.charCodeAt(s++))){if(a=t.charAt(s++),!(o=C[a in Vt?t.charAt(s++):a])||(r=o(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}l.utc=function(e){var t=l(e);function n(e){try{var n=new(jt=Qt);return n._=e,t(n)}finally{jt=Date}}return n.parse=function(e){try{jt=Qt;var n=t.parse(e);return n&&n._}finally{jt=Date}},n.toString=t.toString,n},l.multi=l.utc.multi=gn;var d=o.map(),p=Jt(a),h=Zt(a),g=Jt(s),m=Zt(s),y=Jt(u),v=Zt(u),x=Jt(c),w=Zt(c);i.forEach((function(e,t){d.set(e.toLowerCase(),t)}));var b={a:function(e){return s[e.getDay()]},A:function(e){return a[e.getDay()]},b:function(e){return c[e.getMonth()]},B:function(e){return u[e.getMonth()]},c:l(t),d:function(e,t){return Xt(e.getDate(),t,2)},e:function(e,t){return Xt(e.getDate(),t,2)},H:function(e,t){return Xt(e.getHours(),t,2)},I:function(e,t){return Xt(e.getHours()%12||12,t,2)},j:function(e,t){return Xt(1+Ut.dayOfYear(e),t,3)},L:function(e,t){return Xt(e.getMilliseconds(),t,3)},m:function(e,t){return Xt(e.getMonth()+1,t,2)},M:function(e,t){return Xt(e.getMinutes(),t,2)},p:function(e){return i[+(e.getHours()>=12)]},S:function(e,t){return Xt(e.getSeconds(),t,2)},U:function(e,t){return Xt(Ut.sundayOfYear(e),t,2)},w:function(e){return e.getDay()},W:function(e,t){return Xt(Ut.mondayOfYear(e),t,2)},x:l(n),X:l(r),y:function(e,t){return Xt(e.getFullYear()%100,t,2)},Y:function(e,t){return Xt(e.getFullYear()%1e4,t,4)},Z:pn,"%":function(){return"%"}},C={a:function(e,t,n){g.lastIndex=0;var r=g.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(e,t,n){p.lastIndex=0;var r=p.exec(t.slice(n));return r?(e.w=h.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(e,t,n){x.lastIndex=0;var r=x.exec(t.slice(n));return r?(e.m=w.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(e,t,n){y.lastIndex=0;var r=y.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(e,t,n){return f(e,b.c.toString(),t,n)},d:sn,e:sn,H:cn,I:cn,j:un,L:dn,m:an,M:ln,p:function(e,t,n){var r=d.get(t.slice(n,n+=2).toLowerCase());return null==r?-1:(e.p=r,n)},S:fn,U:en,w:Kt,W:tn,x:function(e,t,n){return f(e,b.x.toString(),t,n)},X:function(e,t,n){return f(e,b.X.toString(),t,n)},y:rn,Y:nn,Z:on,"%":hn};return l}Ut.year=Ht((function(e){return(e=Ut.day(e)).setMonth(0,1),e}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e){return e.getFullYear()})),Ut.years=Ut.year.range,Ut.years.utc=Ut.year.utc.range,Ut.day=Ht((function(e){var t=new jt(2e3,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e){return e.getDate()-1})),Ut.days=Ut.day.range,Ut.days.utc=Ut.day.utc.range,Ut.dayOfYear=function(e){var t=Ut.year(e);return Math.floor((e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(e,t){t=7-t;var n=Ut[e]=Ht((function(e){return(e=Ut.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e}),(function(e,t){e.setDate(e.getDate()+7*Math.floor(t))}),(function(e){var n=Ut.year(e).getDay();return Math.floor((Ut.dayOfYear(e)+(n+t)%7)/7)-(n!==t)}));Ut[e+"s"]=n.range,Ut[e+"s"].utc=n.utc.range,Ut[e+"OfYear"]=function(e){var n=Ut.year(e).getDay();return Math.floor((Ut.dayOfYear(e)+(n+t)%7)/7)}})),Ut.week=Ut.sunday,Ut.weeks=Ut.sunday.range,Ut.weeks.utc=Ut.sunday.utc.range,Ut.weekOfYear=Ut.sundayOfYear;var Vt={"-":"",_:" ",0:"0"},Wt=/^\s*\d+/,Yt=/^%/;function Xt(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(t)+i:i)}function Jt(e){return new RegExp("^(?:"+e.map(o.requote).join("|")+")","i")}function Zt(e){for(var t=new T,n=-1,r=e.length;++n<r;)t.set(e[n].toLowerCase(),n);return t}function Kt(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function en(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n));return r?(e.U=+r[0],n+r[0].length):-1}function tn(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n));return r?(e.W=+r[0],n+r[0].length):-1}function nn(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function rn(e,t,n){Wt.lastIndex=0;var r,i=Wt.exec(t.slice(n,n+2));return i?(e.y=(r=+i[0])+(r>68?1900:2e3),n+i[0].length):-1}function on(e,t,n){return/^[+-]\d{4}$/.test(t=t.slice(n,n+5))?(e.Z=-t,n+5):-1}function an(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function sn(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function un(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n,n+3));return r?(e.j=+r[0],n+r[0].length):-1}function cn(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function ln(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function fn(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function dn(e,t,n){Wt.lastIndex=0;var r=Wt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function pn(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=C(t)/60|0,i=C(t)%60;return n+Xt(r,"0",2)+Xt(i,"0",2)}function hn(e,t,n){Yt.lastIndex=0;var r=Yt.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function gn(e){for(var t=e.length,n=-1;++n<t;)e[n][0]=this(e[n][0]);return function(t){for(var n=0,r=e[n];!r[1](t);)r=e[++n];return r[0](t)}}o.locale=function(e){return{numberFormat:Ot(e),timeFormat:Bt(e)}};var mn=o.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function yn(){}o.format=mn.numberFormat,o.geo={},yn.prototype={s:0,t:0,add:function(e){xn(e,this.t,vn),xn(vn.s,this.s,this),this.s?this.t+=vn.t:this.s=vn.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var vn=new yn;function xn(e,t,n){var r=n.s=e+t,i=r-e,o=r-i;n.t=e-o+(t-i)}function wn(e,t){e&&Cn.hasOwnProperty(e.type)&&Cn[e.type](e,t)}o.geo.stream=function(e,t){e&&bn.hasOwnProperty(e.type)?bn[e.type](e,t):wn(e,t)};var bn={Feature:function(e,t){wn(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)wn(n[r].geometry,t)}},Cn={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){Sn(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)Sn(n[r],t,0)},Polygon:function(e,t){Mn(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)Mn(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)wn(n[r],t)}};function Sn(e,t,n){var r,i=-1,o=e.length-n;for(t.lineStart();++i<o;)r=e[i],t.point(r[0],r[1],r[2]);t.lineEnd()}function Mn(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)Sn(e[n],t,1);t.polygonEnd()}o.geo.area=function(e){return Tn=0,o.geo.stream(e,qn),Tn};var Tn,_n,En,Rn,kn,An,In,Nn,Ln,Dn,$n,On,Pn=new yn,qn={sphere:function(){Tn+=4*Ie},point:U,lineStart:U,lineEnd:U,polygonStart:function(){Pn.reset(),qn.lineStart=zn},polygonEnd:function(){var e=2*Pn;Tn+=e<0?4*Ie+e:e,qn.lineStart=qn.lineEnd=qn.point=U}};function zn(){var e,t,n,r,i;function o(e,t){t=t*$e/2+Ie/4;var o=(e*=$e)-n,a=o>=0?1:-1,s=a*o,u=Math.cos(t),c=Math.sin(t),l=i*c,f=r*u+l*Math.cos(s),d=l*a*Math.sin(s);Pn.add(Math.atan2(d,f)),n=e,r=u,i=c}qn.point=function(a,s){qn.point=o,n=(e=a)*$e,r=Math.cos(s=(t=s)*$e/2+Ie/4),i=Math.sin(s)},qn.lineEnd=function(){o(e,t)}}function Un(e){var t=e[0],n=e[1],r=Math.cos(n);return[r*Math.cos(t),r*Math.sin(t),Math.sin(n)]}function jn(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Qn(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Fn(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Hn(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Gn(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function Bn(e){return[Math.atan2(e[1],e[0]),Ue(e[2])]}function Vn(e,t){return C(e[0]-t[0])<ke&&C(e[1]-t[1])<ke}o.geo.bounds=function(){var e,t,n,r,i,a,s,u,c,l,f,d={point:p,lineStart:g,lineEnd:m,polygonStart:function(){d.point=y,d.lineStart=v,d.lineEnd=x,c=0,qn.polygonStart()},polygonEnd:function(){qn.polygonEnd(),d.point=p,d.lineStart=g,d.lineEnd=m,Pn<0?(e=-(n=180),t=-(r=90)):c>ke?r=90:c<-ke&&(t=-90),f[0]=e,f[1]=n}};function p(i,o){l.push(f=[e=i,n=i]),o<t&&(t=o),o>r&&(r=o)}function h(o,a){var s=Un([o*$e,a*$e]);if(u){var c=Qn(u,s),l=Qn([c[1],-c[0],0],c);Gn(l),l=Bn(l);var f=o-i,d=f>0?1:-1,h=l[0]*Oe*d,g=C(f)>180;if(g^(d*i<h&&h<d*o))(m=l[1]*Oe)>r&&(r=m);else if(g^(d*i<(h=(h+360)%360-180)&&h<d*o)){var m;(m=-l[1]*Oe)<t&&(t=m)}else a<t&&(t=a),a>r&&(r=a);g?o<i?w(e,o)>w(e,n)&&(n=o):w(o,n)>w(e,n)&&(e=o):n>=e?(o<e&&(e=o),o>n&&(n=o)):o>i?w(e,o)>w(e,n)&&(n=o):w(o,n)>w(e,n)&&(e=o)}else p(o,a);u=s,i=o}function g(){d.point=h}function m(){f[0]=e,f[1]=n,d.point=p,u=null}function y(e,t){if(u){var n=e-i;c+=C(n)>180?n+(n>0?360:-360):n}else a=e,s=t;qn.point(e,t),h(e,t)}function v(){qn.lineStart()}function x(){y(a,s),qn.lineEnd(),C(c)>ke&&(e=-(n=180)),f[0]=e,f[1]=n,u=null}function w(e,t){return(t-=e)<0?t+360:t}function b(e,t){return e[0]-t[0]}function S(e,t){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e<t[0]||t[1]<e}return function(i){if(r=n=-(e=t=1/0),l=[],o.geo.stream(i,d),c=l.length){l.sort(b);for(var a=1,s=[g=l[0]];a<c;++a)S((p=l[a])[0],g)||S(p[1],g)?(w(g[0],p[1])>w(g[0],g[1])&&(g[1]=p[1]),w(p[0],g[1])>w(g[0],g[1])&&(g[0]=p[0])):s.push(g=p);for(var u,c,p,h=-1/0,g=(a=0,s[c=s.length-1]);a<=c;g=p,++a)p=s[a],(u=w(g[1],p[0]))>h&&(h=u,e=p[0],n=g[1])}return l=f=null,e===1/0||t===1/0?[[NaN,NaN],[NaN,NaN]]:[[e,t],[n,r]]}}(),o.geo.centroid=function(e){_n=En=Rn=kn=An=In=Nn=Ln=Dn=$n=On=0,o.geo.stream(e,Wn);var t=Dn,n=$n,r=On,i=t*t+n*n+r*r;return i<Ae&&(t=In,n=Nn,r=Ln,En<ke&&(t=Rn,n=kn,r=An),(i=t*t+n*n+r*r)<Ae)?[NaN,NaN]:[Math.atan2(n,t)*Oe,Ue(r/Math.sqrt(i))*Oe]};var Wn={sphere:U,point:Yn,lineStart:Jn,lineEnd:Zn,polygonStart:function(){Wn.lineStart=Kn},polygonEnd:function(){Wn.lineStart=Jn}};function Yn(e,t){e*=$e;var n=Math.cos(t*=$e);Xn(n*Math.cos(e),n*Math.sin(e),Math.sin(t))}function Xn(e,t,n){++_n,Rn+=(e-Rn)/_n,kn+=(t-kn)/_n,An+=(n-An)/_n}function Jn(){var e,t,n;function r(r,i){r*=$e;var o=Math.cos(i*=$e),a=o*Math.cos(r),s=o*Math.sin(r),u=Math.sin(i),c=Math.atan2(Math.sqrt((c=t*u-n*s)*c+(c=n*a-e*u)*c+(c=e*s-t*a)*c),e*a+t*s+n*u);En+=c,In+=c*(e+(e=a)),Nn+=c*(t+(t=s)),Ln+=c*(n+(n=u)),Xn(e,t,n)}Wn.point=function(i,o){i*=$e;var a=Math.cos(o*=$e);e=a*Math.cos(i),t=a*Math.sin(i),n=Math.sin(o),Wn.point=r,Xn(e,t,n)}}function Zn(){Wn.point=Yn}function Kn(){var e,t,n,r,i;function o(e,t){e*=$e;var o=Math.cos(t*=$e),a=o*Math.cos(e),s=o*Math.sin(e),u=Math.sin(t),c=r*u-i*s,l=i*a-n*u,f=n*s-r*a,d=Math.sqrt(c*c+l*l+f*f),p=n*a+r*s+i*u,h=d&&-ze(p)/d,g=Math.atan2(d,p);Dn+=h*c,$n+=h*l,On+=h*f,En+=g,In+=g*(n+(n=a)),Nn+=g*(r+(r=s)),Ln+=g*(i+(i=u)),Xn(n,r,i)}Wn.point=function(a,s){e=a,t=s,Wn.point=o,a*=$e;var u=Math.cos(s*=$e);n=u*Math.cos(a),r=u*Math.sin(a),i=Math.sin(s),Xn(n,r,i)},Wn.lineEnd=function(){o(e,t),Wn.lineEnd=Zn,Wn.point=Yn}}function er(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return(n=t.invert(n,r))&&e.invert(n[0],n[1])}),n}function tr(){return!0}function nr(e,t,n,r,i){var o=[],a=[];if(e.forEach((function(e){if(!((t=e.length-1)<=0)){var t,n=e[0],r=e[t];if(Vn(n,r)){i.lineStart();for(var s=0;s<t;++s)i.point((n=e[s])[0],n[1]);i.lineEnd()}else{var u=new ir(n,e,null,!0),c=new ir(n,null,u,!1);u.o=c,o.push(u),a.push(c),u=new ir(r,e,null,!1),c=new ir(r,null,u,!0),u.o=c,o.push(u),a.push(c)}}})),a.sort(t),rr(o),rr(a),o.length){for(var s=0,u=n,c=a.length;s<c;++s)a[s].e=u=!u;for(var l,f,d=o[0];;){for(var p=d,h=!0;p.v;)if((p=p.n)===d)return;l=p.z,i.lineStart();do{if(p.v=p.o.v=!0,p.e){if(h)for(s=0,c=l.length;s<c;++s)i.point((f=l[s])[0],f[1]);else r(p.x,p.n.x,1,i);p=p.n}else{if(h)for(s=(l=p.p.z).length-1;s>=0;--s)i.point((f=l[s])[0],f[1]);else r(p.x,p.p.x,-1,i);p=p.p}l=(p=p.o).z,h=!h}while(!p.v);i.lineEnd()}}}function rr(e){if(t=e.length){for(var t,n,r=0,i=e[0];++r<t;)i.n=n=e[r],n.p=i,i=n;i.n=n=e[0],n.p=i}}function ir(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function or(e,t,n,r){return function(i,a){var s,u=t(a),c=i.invert(r[0],r[1]),l={point:f,lineStart:p,lineEnd:h,polygonStart:function(){l.point=w,l.lineStart=b,l.lineEnd=C,s=[],g=[]},polygonEnd:function(){l.point=f,l.lineStart=p,l.lineEnd=h,s=o.merge(s);var e=function(e,t){var n=e[0],r=e[1],i=[Math.sin(n),-Math.cos(n),0],o=0,a=0;Pn.reset();for(var s=0,u=t.length;s<u;++s){var c=t[s],l=c.length;if(l)for(var f=c[0],d=f[0],p=f[1]/2+Ie/4,h=Math.sin(p),g=Math.cos(p),m=1;;){m===l&&(m=0);var y=(e=c[m])[0],v=e[1]/2+Ie/4,x=Math.sin(v),w=Math.cos(v),b=y-d,C=b>=0?1:-1,S=C*b,M=S>Ie,T=h*x;if(Pn.add(Math.atan2(T*C*Math.sin(S),g*w+T*Math.cos(S))),o+=M?b+C*Ne:b,M^d>=n^y>=n){var _=Qn(Un(f),Un(e));Gn(_);var E=Qn(i,_);Gn(E);var R=(M^b>=0?-1:1)*Ue(E[2]);(r>R||r===R&&(_[0]||_[1]))&&(a+=M^b>=0?1:-1)}if(!m++)break;d=y,h=x,g=w,f=e}}return(o<-ke||o<ke&&Pn<0)^1&a}(c,g);s.length?(x||(a.polygonStart(),x=!0),nr(s,ur,e,n,a)):e&&(x||(a.polygonStart(),x=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),x&&(a.polygonEnd(),x=!1),s=g=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}};function f(t,n){var r=i(t,n);e(t=r[0],n=r[1])&&a.point(t,n)}function d(e,t){var n=i(e,t);u.point(n[0],n[1])}function p(){l.point=d,u.lineStart()}function h(){l.point=f,u.lineEnd()}var g,m,y=sr(),v=t(y),x=!1;function w(e,t){m.push([e,t]);var n=i(e,t);v.point(n[0],n[1])}function b(){v.lineStart(),m=[]}function C(){w(m[0][0],m[0][1]),v.lineEnd();var e,t=v.clean(),n=y.buffer(),r=n.length;if(m.pop(),g.push(m),m=null,r)if(1&t){var i,o=-1;if((r=(e=n[0]).length-1)>0){for(x||(a.polygonStart(),x=!0),a.lineStart();++o<r;)a.point((i=e[o])[0],i[1]);a.lineEnd()}}else r>1&&2&t&&n.push(n.pop().concat(n.shift())),s.push(n.filter(ar))}return l}}function ar(e){return e.length>1}function sr(){var e,t=[];return{lineStart:function(){t.push(e=[])},point:function(t,n){e.push([t,n])},lineEnd:U,buffer:function(){var n=t;return t=[],e=null,n},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function ur(e,t){return((e=e.x)[0]<0?e[1]-De-ke:De-e[1])-((t=t.x)[0]<0?t[1]-De-ke:De-t[1])}var cr=or(tr,(function(e){var t,n=NaN,r=NaN,i=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(o,a){var s=o>0?Ie:-Ie,u=C(o-n);C(u-Ie)<ke?(e.point(n,r=(r+a)/2>0?De:-De),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),e.point(o,r),t=0):i!==s&&u>=Ie&&(C(n-i)<ke&&(n-=i*ke),C(o-s)<ke&&(o-=s*ke),r=function(e,t,n,r){var i,o,a=Math.sin(e-n);return C(a)>ke?Math.atan((Math.sin(t)*(o=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(t))*Math.sin(e))/(i*o*a)):(t+r)/2}(n,r,o,a),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),t=0),e.point(n=o,r=a),i=s},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}}),(function(e,t,n,r){var i;if(null==e)i=n*De,r.point(-Ie,i),r.point(0,i),r.point(Ie,i),r.point(Ie,0),r.point(Ie,-i),r.point(0,-i),r.point(-Ie,-i),r.point(-Ie,0),r.point(-Ie,i);else if(C(e[0]-t[0])>ke){var o=e[0]<t[0]?Ie:-Ie;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])}),[-Ie,-Ie/2]);function lr(e){var t=Math.cos(e),n=t>0,r=C(t)>ke;return or(i,(function(e){var t,s,u,c,l;return{lineStart:function(){c=u=!1,l=1},point:function(f,d){var p,h=[f,d],g=i(f,d),m=n?g?0:a(f,d):g?a(f+(f<0?Ie:-Ie),d):0;if(!t&&(c=u=g)&&e.lineStart(),g!==u&&(p=o(t,h),(Vn(t,p)||Vn(h,p))&&(h[0]+=ke,h[1]+=ke,g=i(h[0],h[1]))),g!==u)l=0,g?(e.lineStart(),p=o(h,t),e.point(p[0],p[1])):(p=o(t,h),e.point(p[0],p[1]),e.lineEnd()),t=p;else if(r&&t&&n^g){var y;m&s||!(y=o(h,t,!0))||(l=0,n?(e.lineStart(),e.point(y[0][0],y[0][1]),e.point(y[1][0],y[1][1]),e.lineEnd()):(e.point(y[1][0],y[1][1]),e.lineEnd(),e.lineStart(),e.point(y[0][0],y[0][1])))}!g||t&&Vn(t,h)||e.point(h[0],h[1]),t=h,u=g,s=m},lineEnd:function(){u&&e.lineEnd(),t=null},clean:function(){return l|(c&&u)<<1}}}),Vr(e,6*$e),n?[0,-e]:[-Ie,e-Ie]);function i(e,n){return Math.cos(e)*Math.cos(n)>t}function o(e,n,r){var i=[1,0,0],o=Qn(Un(e),Un(n)),a=jn(o,o),s=o[0],u=a-s*s;if(!u)return!r&&e;var c=t*a/u,l=-t*s/u,f=Qn(i,o),d=Hn(i,c);Fn(d,Hn(o,l));var p=f,h=jn(d,p),g=jn(p,p),m=h*h-g*(jn(d,d)-1);if(!(m<0)){var y=Math.sqrt(m),v=Hn(p,(-h-y)/g);if(Fn(v,d),v=Bn(v),!r)return v;var x,w=e[0],b=n[0],S=e[1],M=n[1];b<w&&(x=w,w=b,b=x);var T=b-w,_=C(T-Ie)<ke;if(!_&&M<S&&(x=S,S=M,M=x),_||T<ke?_?S+M>0^v[1]<(C(v[0]-w)<ke?S:M):S<=v[1]&&v[1]<=M:T>Ie^(w<=v[0]&&v[0]<=b)){var E=Hn(p,(-h+y)/g);return Fn(E,d),[v,Bn(E)]}}}function a(t,r){var i=n?e:Ie-e,o=0;return t<-i?o|=1:t>i&&(o|=2),r<-i?o|=4:r>i&&(o|=8),o}}function fr(e,t,n,r){return function(i){var o,a=i.a,s=i.b,u=a.x,c=a.y,l=0,f=1,d=s.x-u,p=s.y-c;if(o=e-u,d||!(o>0)){if(o/=d,d<0){if(o<l)return;o<f&&(f=o)}else if(d>0){if(o>f)return;o>l&&(l=o)}if(o=n-u,d||!(o<0)){if(o/=d,d<0){if(o>f)return;o>l&&(l=o)}else if(d>0){if(o<l)return;o<f&&(f=o)}if(o=t-c,p||!(o>0)){if(o/=p,p<0){if(o<l)return;o<f&&(f=o)}else if(p>0){if(o>f)return;o>l&&(l=o)}if(o=r-c,p||!(o<0)){if(o/=p,p<0){if(o>f)return;o>l&&(l=o)}else if(p>0){if(o<l)return;o<f&&(f=o)}return l>0&&(i.a={x:u+l*d,y:c+l*p}),f<1&&(i.b={x:u+f*d,y:c+f*p}),i}}}}}}var dr=1e9;function pr(e,t,n,r){return function(u){var c,l,f,d,p,h,g,m,y,v,x,w=u,b=sr(),C=fr(e,t,n,r),S={point:_,lineStart:function(){S.point=E,l&&l.push(f=[]);v=!0,y=!1,g=m=NaN},lineEnd:function(){c&&(E(d,p),h&&y&&b.rejoin(),c.push(b.buffer()));S.point=_,y&&u.lineEnd()},polygonStart:function(){u=b,c=[],l=[],x=!0},polygonEnd:function(){u=w,c=o.merge(c);var t=function(e){for(var t=0,n=l.length,r=e[1],i=0;i<n;++i)for(var o,a=1,s=l[i],u=s.length,c=s[0];a<u;++a)o=s[a],c[1]<=r?o[1]>r&&qe(c,o,e)>0&&++t:o[1]<=r&&qe(c,o,e)<0&&--t,c=o;return 0!==t}([e,r]),n=x&&t,i=c.length;(n||i)&&(u.polygonStart(),n&&(u.lineStart(),M(null,null,1,u),u.lineEnd()),i&&nr(c,a,t,M,u),u.polygonEnd()),c=l=f=null}};function M(o,a,u,c){var l=0,f=0;if(null==o||(l=i(o,u))!==(f=i(a,u))||s(o,a)<0^u>0)do{c.point(0===l||3===l?e:n,l>1?r:t)}while((l=(l+u+4)%4)!==f);else c.point(a[0],a[1])}function T(i,o){return e<=i&&i<=n&&t<=o&&o<=r}function _(e,t){T(e,t)&&u.point(e,t)}function E(e,t){var n=T(e=Math.max(-dr,Math.min(dr,e)),t=Math.max(-dr,Math.min(dr,t)));if(l&&f.push([e,t]),v)d=e,p=t,h=n,v=!1,n&&(u.lineStart(),u.point(e,t));else if(n&&y)u.point(e,t);else{var r={a:{x:g,y:m},b:{x:e,y:t}};C(r)?(y||(u.lineStart(),u.point(r.a.x,r.a.y)),u.point(r.b.x,r.b.y),n||u.lineEnd(),x=!1):n&&(u.lineStart(),u.point(e,t),x=!1)}g=e,m=t,y=n}return S};function i(r,i){return C(r[0]-e)<ke?i>0?0:3:C(r[0]-n)<ke?i>0?2:1:C(r[1]-t)<ke?i>0?1:0:i>0?3:2}function a(e,t){return s(e.x,t.x)}function s(e,t){var n=i(e,1),r=i(t,1);return n!==r?n-r:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}}function hr(e){var t=0,n=Ie/3,r=zr(e),i=r(t,n);return i.parallels=function(e){return arguments.length?r(t=e[0]*Ie/180,n=e[1]*Ie/180):[t/Ie*180,n/Ie*180]},i}function gr(e,t){var n=Math.sin(e),r=(n+Math.sin(t))/2,i=1+n*(2*r-n),o=Math.sqrt(i)/r;function a(e,t){var n=Math.sqrt(i-2*r*Math.sin(t))/r;return[n*Math.sin(e*=r),o-n*Math.cos(e)]}return a.invert=function(e,t){var n=o-t;return[Math.atan2(e,n)/r,Ue((i-(e*e+n*n)*r*r)/(2*r))]},a}o.geo.clipExtent=function(){var e,t,n,r,i,o,a={stream:function(e){return i&&(i.valid=!1),(i=o(e)).valid=!0,i},extent:function(s){return arguments.length?(o=pr(e=+s[0][0],t=+s[0][1],n=+s[1][0],r=+s[1][1]),i&&(i.valid=!1,i=null),a):[[e,t],[n,r]]}};return a.extent([[0,0],[960,500]])},(o.geo.conicEqualArea=function(){return hr(gr)}).raw=gr,o.geo.albers=function(){return o.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},o.geo.albersUsa=function(){var e,t,n,r,i=o.geo.albers(),a=o.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=o.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),u={point:function(t,n){e=[t,n]}};function c(i){var o=i[0],a=i[1];return e=null,t(o,a),e||(n(o,a),e)||r(o,a),e}return c.invert=function(e){var t=i.scale(),n=i.translate(),r=(e[0]-n[0])/t,o=(e[1]-n[1])/t;return(o>=.12&&o<.234&&r>=-.425&&r<-.214?a:o>=.166&&o<.234&&r>=-.214&&r<-.115?s:i).invert(e)},c.stream=function(e){var t=i.stream(e),n=a.stream(e),r=s.stream(e);return{point:function(e,i){t.point(e,i),n.point(e,i),r.point(e,i)},sphere:function(){t.sphere(),n.sphere(),r.sphere()},lineStart:function(){t.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},c.precision=function(e){return arguments.length?(i.precision(e),a.precision(e),s.precision(e),c):i.precision()},c.scale=function(e){return arguments.length?(i.scale(e),a.scale(.35*e),s.scale(e),c.translate(i.translate())):i.scale()},c.translate=function(e){if(!arguments.length)return i.translate();var o=i.scale(),l=+e[0],f=+e[1];return t=i.translate(e).clipExtent([[l-.455*o,f-.238*o],[l+.455*o,f+.238*o]]).stream(u).point,n=a.translate([l-.307*o,f+.201*o]).clipExtent([[l-.425*o+ke,f+.12*o+ke],[l-.214*o-ke,f+.234*o-ke]]).stream(u).point,r=s.translate([l-.205*o,f+.212*o]).clipExtent([[l-.214*o+ke,f+.166*o+ke],[l-.115*o-ke,f+.234*o-ke]]).stream(u).point,c},c.scale(1070)};var mr,yr,vr,xr,wr,br,Cr={point:U,lineStart:U,lineEnd:U,polygonStart:function(){yr=0,Cr.lineStart=Sr},polygonEnd:function(){Cr.lineStart=Cr.lineEnd=Cr.point=U,mr+=C(yr/2)}};function Sr(){var e,t,n,r;function i(e,t){yr+=r*e-n*t,n=e,r=t}Cr.point=function(o,a){Cr.point=i,e=n=o,t=r=a},Cr.lineEnd=function(){i(e,t)}}var Mr={point:function(e,t){e<vr&&(vr=e);e>wr&&(wr=e);t<xr&&(xr=t);t>br&&(br=t)},lineStart:U,lineEnd:U,polygonStart:U,polygonEnd:U};function Tr(){var e=_r(4.5),t=[],n={point:r,lineStart:function(){n.point=i},lineEnd:a,polygonStart:function(){n.lineEnd=s},polygonEnd:function(){n.lineEnd=a,n.point=r},pointRadius:function(t){return e=_r(t),n},result:function(){if(t.length){var e=t.join("");return t=[],e}}};function r(n,r){t.push("M",n,",",r,e)}function i(e,r){t.push("M",e,",",r),n.point=o}function o(e,n){t.push("L",e,",",n)}function a(){n.point=r}function s(){t.push("Z")}return n}function _r(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}var Er,Rr={point:kr,lineStart:Ar,lineEnd:Ir,polygonStart:function(){Rr.lineStart=Nr},polygonEnd:function(){Rr.point=kr,Rr.lineStart=Ar,Rr.lineEnd=Ir}};function kr(e,t){Rn+=e,kn+=t,++An}function Ar(){var e,t;function n(n,r){var i=n-e,o=r-t,a=Math.sqrt(i*i+o*o);In+=a*(e+n)/2,Nn+=a*(t+r)/2,Ln+=a,kr(e=n,t=r)}Rr.point=function(r,i){Rr.point=n,kr(e=r,t=i)}}function Ir(){Rr.point=kr}function Nr(){var e,t,n,r;function i(e,t){var i=e-n,o=t-r,a=Math.sqrt(i*i+o*o);In+=a*(n+e)/2,Nn+=a*(r+t)/2,Ln+=a,Dn+=(a=r*e-n*t)*(n+e),$n+=a*(r+t),On+=3*a,kr(n=e,r=t)}Rr.point=function(o,a){Rr.point=i,kr(e=n=o,t=r=a)},Rr.lineEnd=function(){i(e,t)}}function Lr(e){var t=4.5,n={point:r,lineStart:function(){n.point=i},lineEnd:a,polygonStart:function(){n.lineEnd=s},polygonEnd:function(){n.lineEnd=a,n.point=r},pointRadius:function(e){return t=e,n},result:U};function r(n,r){e.moveTo(n+t,r),e.arc(n,r,t,0,Ne)}function i(t,r){e.moveTo(t,r),n.point=o}function o(t,n){e.lineTo(t,n)}function a(){n.point=r}function s(){e.closePath()}return n}function Dr(e){var t=.5,n=Math.cos(30*$e),r=16;function i(e){return(r?a:o)(e)}function o(t){return Pr(t,(function(n,r){n=e(n,r),t.point(n[0],n[1])}))}function a(t){var n,i,o,a,u,c,l,f,d,p,h,g,m={point:y,lineStart:v,lineEnd:w,polygonStart:function(){t.polygonStart(),m.lineStart=b},polygonEnd:function(){t.polygonEnd(),m.lineStart=v}};function y(n,r){n=e(n,r),t.point(n[0],n[1])}function v(){f=NaN,m.point=x,t.lineStart()}function x(n,i){var o=Un([n,i]),a=e(n,i);s(f,d,l,p,h,g,f=a[0],d=a[1],l=n,p=o[0],h=o[1],g=o[2],r,t),t.point(f,d)}function w(){m.point=y,t.lineEnd()}function b(){v(),m.point=C,m.lineEnd=S}function C(e,t){x(n=e,t),i=f,o=d,a=p,u=h,c=g,m.point=x}function S(){s(f,d,l,p,h,g,i,o,n,a,u,c,r,t),m.lineEnd=w,w()}return m}function s(r,i,o,a,u,c,l,f,d,p,h,g,m,y){var v=l-r,x=f-i,w=v*v+x*x;if(w>4*t&&m--){var b=a+p,S=u+h,M=c+g,T=Math.sqrt(b*b+S*S+M*M),_=Math.asin(M/=T),E=C(C(M)-1)<ke||C(o-d)<ke?(o+d)/2:Math.atan2(S,b),R=e(E,_),k=R[0],A=R[1],I=k-r,N=A-i,L=x*I-v*N;(L*L/w>t||C((v*I+x*N)/w-.5)>.3||a*p+u*h+c*g<n)&&(s(r,i,o,a,u,c,k,A,E,b/=T,S/=T,M,m,y),y.point(k,A),s(k,A,E,b,S,M,l,f,d,p,h,g,m,y))}}return i.precision=function(e){return arguments.length?(r=(t=e*e)>0&&16,i):Math.sqrt(t)},i}function $r(e){var t=Dr((function(t,n){return e([t*Oe,n*Oe])}));return function(e){return Ur(t(e))}}function Or(e){this.stream=e}function Pr(e,t){return{point:t,sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}function qr(e){return zr((function(){return e}))()}function zr(e){var t,n,r,i,a,s,u=Dr((function(e,n){return[(e=t(e,n))[0]*c+i,a-e[1]*c]})),c=150,l=480,f=250,d=0,p=0,h=0,g=0,m=0,y=cr,v=O,x=null,w=null;function b(e){return[(e=r(e[0]*$e,e[1]*$e))[0]*c+i,a-e[1]*c]}function C(e){return(e=r.invert((e[0]-i)/c,(a-e[1])/c))&&[e[0]*Oe,e[1]*Oe]}function S(){r=er(n=Fr(h,g,m),t);var e=t(d,p);return i=l-e[0]*c,a=f+e[1]*c,M()}function M(){return s&&(s.valid=!1,s=null),b}return b.stream=function(e){return s&&(s.valid=!1),(s=Ur(y(n,u(v(e))))).valid=!0,s},b.clipAngle=function(e){return arguments.length?(y=null==e?(x=e,cr):lr((x=+e)*$e),M()):x},b.clipExtent=function(e){return arguments.length?(w=e,v=e?pr(e[0][0],e[0][1],e[1][0],e[1][1]):O,M()):w},b.scale=function(e){return arguments.length?(c=+e,S()):c},b.translate=function(e){return arguments.length?(l=+e[0],f=+e[1],S()):[l,f]},b.center=function(e){return arguments.length?(d=e[0]%360*$e,p=e[1]%360*$e,S()):[d*Oe,p*Oe]},b.rotate=function(e){return arguments.length?(h=e[0]%360*$e,g=e[1]%360*$e,m=e.length>2?e[2]%360*$e:0,S()):[h*Oe,g*Oe,m*Oe]},o.rebind(b,u,"precision"),function(){return t=e.apply(this,arguments),b.invert=t.invert&&C,S()}}function Ur(e){return Pr(e,(function(t,n){e.point(t*$e,n*$e)}))}function jr(e,t){return[e,t]}function Qr(e,t){return[e>Ie?e-Ne:e<-Ie?e+Ne:e,t]}function Fr(e,t,n){return e?t||n?er(Gr(e),Br(t,n)):Gr(e):t||n?Br(t,n):Qr}function Hr(e){return function(t,n){return[(t+=e)>Ie?t-Ne:t<-Ie?t+Ne:t,n]}}function Gr(e){var t=Hr(e);return t.invert=Hr(-e),t}function Br(e,t){var n=Math.cos(e),r=Math.sin(e),i=Math.cos(t),o=Math.sin(t);function a(e,t){var a=Math.cos(t),s=Math.cos(e)*a,u=Math.sin(e)*a,c=Math.sin(t),l=c*n+s*r;return[Math.atan2(u*i-l*o,s*n-c*r),Ue(l*i+u*o)]}return a.invert=function(e,t){var a=Math.cos(t),s=Math.cos(e)*a,u=Math.sin(e)*a,c=Math.sin(t),l=c*i-u*o;return[Math.atan2(u*i+c*o,s*n+l*r),Ue(l*n-s*r)]},a}function Vr(e,t){var n=Math.cos(e),r=Math.sin(e);return function(i,o,a,s){var u=a*t;null!=i?(i=Wr(n,i),o=Wr(n,o),(a>0?i<o:i>o)&&(i+=a*Ne)):(i=e+a*Ne,o=e-.5*u);for(var c,l=i;a>0?l>o:l<o;l-=u)s.point((c=Bn([n,-r*Math.cos(l),-r*Math.sin(l)]))[0],c[1])}}function Wr(e,t){var n=Un(t);n[0]-=e,Gn(n);var r=ze(-n[1]);return((-n[2]<0?-r:r)+2*Math.PI-ke)%(2*Math.PI)}function Yr(e,t,n){var r=o.range(e,t-ke,n).concat(t);return function(e){return r.map((function(t){return[e,t]}))}}function Xr(e,t,n){var r=o.range(e,t-ke,n).concat(t);return function(e){return r.map((function(t){return[t,e]}))}}function Jr(e){return e.source}function Zr(e){return e.target}o.geo.path=function(){var e,t,n,r,i,a=4.5;function s(e){return e&&("function"==typeof a&&r.pointRadius(+a.apply(this,arguments)),i&&i.valid||(i=n(r)),o.geo.stream(e,i)),r.result()}function u(){return i=null,s}return s.area=function(e){return mr=0,o.geo.stream(e,n(Cr)),mr},s.centroid=function(e){return Rn=kn=An=In=Nn=Ln=Dn=$n=On=0,o.geo.stream(e,n(Rr)),On?[Dn/On,$n/On]:Ln?[In/Ln,Nn/Ln]:An?[Rn/An,kn/An]:[NaN,NaN]},s.bounds=function(e){return wr=br=-(vr=xr=1/0),o.geo.stream(e,n(Mr)),[[vr,xr],[wr,br]]},s.projection=function(t){return arguments.length?(n=(e=t)?t.stream||$r(t):O,u()):e},s.context=function(e){return arguments.length?(r=null==(t=e)?new Tr:new Lr(e),"function"!=typeof a&&r.pointRadius(a),u()):t},s.pointRadius=function(e){return arguments.length?(a="function"==typeof e?e:(r.pointRadius(+e),+e),s):a},s.projection(o.geo.albersUsa()).context(null)},o.geo.transform=function(e){return{stream:function(t){var n=new Or(t);for(var r in e)n[r]=e[r];return n}}},Or.prototype={point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},o.geo.projection=qr,o.geo.projectionMutator=zr,(o.geo.equirectangular=function(){return qr(jr)}).raw=jr.invert=jr,o.geo.rotation=function(e){function t(t){return(t=e(t[0]*$e,t[1]*$e))[0]*=Oe,t[1]*=Oe,t}return e=Fr(e[0]%360*$e,e[1]*$e,e.length>2?e[2]*$e:0),t.invert=function(t){return(t=e.invert(t[0]*$e,t[1]*$e))[0]*=Oe,t[1]*=Oe,t},t},Qr.invert=jr,o.geo.circle=function(){var e,t,n=[0,0],r=6;function i(){var e="function"==typeof n?n.apply(this,arguments):n,r=Fr(-e[0]*$e,-e[1]*$e,0).invert,i=[];return t(null,null,1,{point:function(e,t){i.push(e=r(e,t)),e[0]*=Oe,e[1]*=Oe}}),{type:"Polygon",coordinates:[i]}}return i.origin=function(e){return arguments.length?(n=e,i):n},i.angle=function(n){return arguments.length?(t=Vr((e=+n)*$e,r*$e),i):e},i.precision=function(n){return arguments.length?(t=Vr(e*$e,(r=+n)*$e),i):r},i.angle(90)},o.geo.distance=function(e,t){var n,r=(t[0]-e[0])*$e,i=e[1]*$e,o=t[1]*$e,a=Math.sin(r),s=Math.cos(r),u=Math.sin(i),c=Math.cos(i),l=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((n=f*a)*n+(n=c*l-u*f*s)*n),u*l+c*f*s)},o.geo.graticule=function(){var e,t,n,r,i,a,s,u,c,l,f,d,p=10,h=p,g=90,m=360,y=2.5;function v(){return{type:"MultiLineString",coordinates:x()}}function x(){return o.range(Math.ceil(r/g)*g,n,g).map(f).concat(o.range(Math.ceil(u/m)*m,s,m).map(d)).concat(o.range(Math.ceil(t/p)*p,e,p).filter((function(e){return C(e%g)>ke})).map(c)).concat(o.range(Math.ceil(a/h)*h,i,h).filter((function(e){return C(e%m)>ke})).map(l))}return v.lines=function(){return x().map((function(e){return{type:"LineString",coordinates:e}}))},v.outline=function(){return{type:"Polygon",coordinates:[f(r).concat(d(s).slice(1),f(n).reverse().slice(1),d(u).reverse().slice(1))]}},v.extent=function(e){return arguments.length?v.majorExtent(e).minorExtent(e):v.minorExtent()},v.majorExtent=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],u=+e[0][1],s=+e[1][1],r>n&&(e=r,r=n,n=e),u>s&&(e=u,u=s,s=e),v.precision(y)):[[r,u],[n,s]]},v.minorExtent=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],a=+n[0][1],i=+n[1][1],t>e&&(n=t,t=e,e=n),a>i&&(n=a,a=i,i=n),v.precision(y)):[[t,a],[e,i]]},v.step=function(e){return arguments.length?v.majorStep(e).minorStep(e):v.minorStep()},v.majorStep=function(e){return arguments.length?(g=+e[0],m=+e[1],v):[g,m]},v.minorStep=function(e){return arguments.length?(p=+e[0],h=+e[1],v):[p,h]},v.precision=function(o){return arguments.length?(y=+o,c=Yr(a,i,90),l=Xr(t,e,y),f=Yr(u,s,90),d=Xr(r,n,y),v):y},v.majorExtent([[-180,-90+ke],[180,90-ke]]).minorExtent([[-180,-80-ke],[180,80+ke]])},o.geo.greatArc=function(){var e,t,n=Jr,r=Zr;function i(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),t||r.apply(this,arguments)]}}return i.distance=function(){return o.geo.distance(e||n.apply(this,arguments),t||r.apply(this,arguments))},i.source=function(t){return arguments.length?(n=t,e="function"==typeof t?null:t,i):n},i.target=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,i):r},i.precision=function(){return arguments.length?i:0},i},o.geo.interpolate=function(e,t){return n=e[0]*$e,r=e[1]*$e,i=t[0]*$e,o=t[1]*$e,a=Math.cos(r),s=Math.sin(r),u=Math.cos(o),c=Math.sin(o),l=a*Math.cos(n),f=a*Math.sin(n),d=u*Math.cos(i),p=u*Math.sin(i),h=2*Math.asin(Math.sqrt(Qe(o-r)+a*u*Qe(i-n))),g=1/Math.sin(h),(m=h?function(e){var t=Math.sin(e*=h)*g,n=Math.sin(h-e)*g,r=n*l+t*d,i=n*f+t*p,o=n*s+t*c;return[Math.atan2(i,r)*Oe,Math.atan2(o,Math.sqrt(r*r+i*i))*Oe]}:function(){return[n*Oe,r*Oe]}).distance=h,m;var n,r,i,o,a,s,u,c,l,f,d,p,h,g,m},o.geo.length=function(e){return Er=0,o.geo.stream(e,Kr),Er};var Kr={sphere:U,point:U,lineStart:function(){var e,t,n;function r(r,i){var o=Math.sin(i*=$e),a=Math.cos(i),s=C((r*=$e)-e),u=Math.cos(s);Er+=Math.atan2(Math.sqrt((s=a*Math.sin(s))*s+(s=n*o-t*a*u)*s),t*o+n*a*u),e=r,t=o,n=a}Kr.point=function(i,o){e=i*$e,t=Math.sin(o*=$e),n=Math.cos(o),Kr.point=r},Kr.lineEnd=function(){Kr.point=Kr.lineEnd=U}},lineEnd:U,polygonStart:U,polygonEnd:U};function ei(e,t){function n(t,n){var r=Math.cos(t),i=Math.cos(n),o=e(r*i);return[o*i*Math.sin(t),o*Math.sin(n)]}return n.invert=function(e,n){var r=Math.sqrt(e*e+n*n),i=t(r),o=Math.sin(i),a=Math.cos(i);return[Math.atan2(e*o,r*a),Math.asin(r&&n*o/r)]},n}var ti=ei((function(e){return Math.sqrt(2/(1+e))}),(function(e){return 2*Math.asin(e/2)}));(o.geo.azimuthalEqualArea=function(){return qr(ti)}).raw=ti;var ni=ei((function(e){var t=Math.acos(e);return t&&t/Math.sin(t)}),O);function ri(e,t){var n=Math.cos(e),r=function(e){return Math.tan(Ie/4+e/2)},i=e===t?Math.sin(e):Math.log(n/Math.cos(t))/Math.log(r(t)/r(e)),o=n*Math.pow(r(e),i)/i;if(!i)return ai;function a(e,t){o>0?t<-De+ke&&(t=-De+ke):t>De-ke&&(t=De-ke);var n=o/Math.pow(r(t),i);return[n*Math.sin(i*e),o-n*Math.cos(i*e)]}return a.invert=function(e,t){var n=o-t,r=Pe(i)*Math.sqrt(e*e+n*n);return[Math.atan2(e,n)/i,2*Math.atan(Math.pow(o/r,1/i))-De]},a}function ii(e,t){var n=Math.cos(e),r=e===t?Math.sin(e):(n-Math.cos(t))/(t-e),i=n/r+e;if(C(r)<ke)return jr;function o(e,t){var n=i-t;return[n*Math.sin(r*e),i-n*Math.cos(r*e)]}return o.invert=function(e,t){var n=i-t;return[Math.atan2(e,n)/r,i-Pe(r)*Math.sqrt(e*e+n*n)]},o}(o.geo.azimuthalEquidistant=function(){return qr(ni)}).raw=ni,(o.geo.conicConformal=function(){return hr(ri)}).raw=ri,(o.geo.conicEquidistant=function(){return hr(ii)}).raw=ii;var oi=ei((function(e){return 1/e}),Math.atan);function ai(e,t){return[e,Math.log(Math.tan(Ie/4+t/2))]}function si(e){var t,n=qr(e),r=n.scale,i=n.translate,o=n.clipExtent;return n.scale=function(){var e=r.apply(n,arguments);return e===n?t?n.clipExtent(null):n:e},n.translate=function(){var e=i.apply(n,arguments);return e===n?t?n.clipExtent(null):n:e},n.clipExtent=function(e){var a=o.apply(n,arguments);if(a===n){if(t=null==e){var s=Ie*r(),u=i();o([[u[0]-s,u[1]-s],[u[0]+s,u[1]+s]])}}else t&&(a=null);return a},n.clipExtent(null)}(o.geo.gnomonic=function(){return qr(oi)}).raw=oi,ai.invert=function(e,t){return[e,2*Math.atan(Math.exp(t))-De]},(o.geo.mercator=function(){return si(ai)}).raw=ai;var ui=ei((function(){return 1}),Math.asin);(o.geo.orthographic=function(){return qr(ui)}).raw=ui;var ci=ei((function(e){return 1/(1+e)}),(function(e){return 2*Math.atan(e)}));function li(e,t){return[Math.log(Math.tan(Ie/4+t/2)),-e]}function fi(e){return e[0]}function di(e){return e[1]}function pi(e){for(var t=e.length,n=[0,1],r=2,i=2;i<t;i++){for(;r>1&&qe(e[n[r-2]],e[n[r-1]],e[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}function hi(e,t){return e[0]-t[0]||e[1]-t[1]}(o.geo.stereographic=function(){return qr(ci)}).raw=ci,li.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-De]},(o.geo.transverseMercator=function(){var e=si(li),t=e.center,n=e.rotate;return e.center=function(e){return e?t([-e[1],e[0]]):[(e=t())[1],-e[0]]},e.rotate=function(e){return e?n([e[0],e[1],e.length>2?e[2]+90:90]):[(e=n())[0],e[1],e[2]-90]},n([0,0,90])}).raw=li,o.geom={},o.geom.hull=function(e){var t=fi,n=di;if(arguments.length)return r(e);function r(e){if(e.length<3)return[];var r,i=Ct(t),o=Ct(n),a=e.length,s=[],u=[];for(r=0;r<a;r++)s.push([+i.call(this,e[r],r),+o.call(this,e[r],r),r]);for(s.sort(hi),r=0;r<a;r++)u.push([s[r][0],-s[r][1]]);var c=pi(s),l=pi(u),f=l[0]===c[0],d=l[l.length-1]===c[c.length-1],p=[];for(r=c.length-1;r>=0;--r)p.push(e[s[c[r]][2]]);for(r=+f;r<l.length-d;++r)p.push(e[s[l[r]][2]]);return p}return r.x=function(e){return arguments.length?(t=e,r):t},r.y=function(e){return arguments.length?(n=e,r):n},r},o.geom.polygon=function(e){return V(e,gi),e};var gi=o.geom.polygon.prototype=[];function mi(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function yi(e,t,n,r){var i=e[0],o=n[0],a=t[0]-i,s=r[0]-o,u=e[1],c=n[1],l=t[1]-u,f=r[1]-c,d=(s*(u-c)-f*(i-o))/(f*a-s*l);return[i+d*a,u+d*l]}function vi(e){var t=e[0],n=e[e.length-1];return!(t[0]-n[0]||t[1]-n[1])}gi.area=function(){for(var e,t=-1,n=this.length,r=this[n-1],i=0;++t<n;)e=r,r=this[t],i+=e[1]*r[0]-e[0]*r[1];return.5*i},gi.centroid=function(e){var t,n,r=-1,i=this.length,o=0,a=0,s=this[i-1];for(arguments.length||(e=-1/(6*this.area()));++r<i;)t=s,s=this[r],n=t[0]*s[1]-s[0]*t[1],o+=(t[0]+s[0])*n,a+=(t[1]+s[1])*n;return[o*e,a*e]},gi.clip=function(e){for(var t,n,r,i,o,a,s=vi(e),u=-1,c=this.length-vi(this),l=this[c-1];++u<c;){for(t=e.slice(),e.length=0,i=this[u],o=t[(r=t.length-s)-1],n=-1;++n<r;)mi(a=t[n],l,i)?(mi(o,l,i)||e.push(yi(o,a,l,i)),e.push(a)):mi(o,l,i)&&e.push(yi(o,a,l,i)),o=a;s&&e.push(e[0]),l=i}return e};var xi,wi,bi,Ci,Si,Mi=[],Ti=[];function _i(){Gi(this),this.edge=this.site=this.circle=null}function Ei(e){var t=Mi.pop()||new _i;return t.site=e,t}function Ri(e){Pi(e),bi.remove(e),Mi.push(e),Gi(e)}function ki(e){var t=e.circle,n=t.x,r=t.cy,i={x:n,y:r},o=e.P,a=e.N,s=[e];Ri(e);for(var u=o;u.circle&&C(n-u.circle.x)<ke&&C(r-u.circle.cy)<ke;)o=u.P,s.unshift(u),Ri(u),u=o;s.unshift(u),Pi(u);for(var c=a;c.circle&&C(n-c.circle.x)<ke&&C(r-c.circle.cy)<ke;)a=c.N,s.push(c),Ri(c),c=a;s.push(c),Pi(c);var l,f=s.length;for(l=1;l<f;++l)c=s[l],u=s[l-1],Qi(c.edge,u.site,c.site,i);u=s[0],(c=s[f-1]).edge=Ui(u.site,c.site,null,i),Oi(u),Oi(c)}function Ai(e){for(var t,n,r,i,o=e.x,a=e.y,s=bi._;s;)if((r=Ii(s,a)-o)>ke)s=s.L;else{if(!((i=o-Ni(s,a))>ke)){r>-ke?(t=s.P,n=s):i>-ke?(t=s,n=s.N):t=n=s;break}if(!s.R){t=s;break}s=s.R}var u=Ei(e);if(bi.insert(t,u),t||n){if(t===n)return Pi(t),n=Ei(t.site),bi.insert(u,n),u.edge=n.edge=Ui(t.site,u.site),Oi(t),void Oi(n);if(n){Pi(t),Pi(n);var c=t.site,l=c.x,f=c.y,d=e.x-l,p=e.y-f,h=n.site,g=h.x-l,m=h.y-f,y=2*(d*m-p*g),v=d*d+p*p,x=g*g+m*m,w={x:(m*v-p*x)/y+l,y:(d*x-g*v)/y+f};Qi(n.edge,c,h,w),u.edge=Ui(c,e,null,w),n.edge=Ui(e,h,null,w),Oi(t),Oi(n)}else u.edge=Ui(t.site,u.site)}}function Ii(e,t){var n=e.site,r=n.x,i=n.y,o=i-t;if(!o)return r;var a=e.P;if(!a)return-1/0;var s=(n=a.site).x,u=n.y,c=u-t;if(!c)return s;var l=s-r,f=1/o-1/c,d=l/c;return f?(-d+Math.sqrt(d*d-2*f*(l*l/(-2*c)-u+c/2+i-o/2)))/f+r:(r+s)/2}function Ni(e,t){var n=e.N;if(n)return Ii(n,t);var r=e.site;return r.y===t?r.x:1/0}function Li(e){this.site=e,this.edges=[]}function Di(e,t){return t.angle-e.angle}function $i(){Gi(this),this.x=this.y=this.arc=this.site=this.cy=null}function Oi(e){var t=e.P,n=e.N;if(t&&n){var r=t.site,i=e.site,o=n.site;if(r!==o){var a=i.x,s=i.y,u=r.x-a,c=r.y-s,l=o.x-a,f=2*(u*(m=o.y-s)-c*l);if(!(f>=-Ae)){var d=u*u+c*c,p=l*l+m*m,h=(m*d-c*p)/f,g=(u*p-l*d)/f,m=g+s,y=Ti.pop()||new $i;y.arc=e,y.site=i,y.x=h+a,y.y=m+Math.sqrt(h*h+g*g),y.cy=m,e.circle=y;for(var v=null,x=Si._;x;)if(y.y<x.y||y.y===x.y&&y.x<=x.x){if(!x.L){v=x.P;break}x=x.L}else{if(!x.R){v=x;break}x=x.R}Si.insert(v,y),v||(Ci=y)}}}}function Pi(e){var t=e.circle;t&&(t.P||(Ci=t.N),Si.remove(t),Ti.push(t),Gi(t),e.circle=null)}function qi(e,t){var n=e.b;if(n)return!0;var r,i,o=e.a,a=t[0][0],s=t[1][0],u=t[0][1],c=t[1][1],l=e.l,f=e.r,d=l.x,p=l.y,h=f.x,g=f.y,m=(d+h)/2,y=(p+g)/2;if(g===p){if(m<a||m>=s)return;if(d>h){if(o){if(o.y>=c)return}else o={x:m,y:u};n={x:m,y:c}}else{if(o){if(o.y<u)return}else o={x:m,y:c};n={x:m,y:u}}}else if(i=y-(r=(d-h)/(g-p))*m,r<-1||r>1)if(d>h){if(o){if(o.y>=c)return}else o={x:(u-i)/r,y:u};n={x:(c-i)/r,y:c}}else{if(o){if(o.y<u)return}else o={x:(c-i)/r,y:c};n={x:(u-i)/r,y:u}}else if(p<g){if(o){if(o.x>=s)return}else o={x:a,y:r*a+i};n={x:s,y:r*s+i}}else{if(o){if(o.x<a)return}else o={x:s,y:r*s+i};n={x:a,y:r*a+i}}return e.a=o,e.b=n,!0}function zi(e,t){this.l=e,this.r=t,this.a=this.b=null}function Ui(e,t,n,r){var i=new zi(e,t);return xi.push(i),n&&Qi(i,e,t,n),r&&Qi(i,t,e,r),wi[e.i].edges.push(new Fi(i,e,t)),wi[t.i].edges.push(new Fi(i,t,e)),i}function ji(e,t,n){var r=new zi(e,null);return r.a=t,r.b=n,xi.push(r),r}function Qi(e,t,n,r){e.a||e.b?e.l===n?e.b=r:e.a=r:(e.a=r,e.l=t,e.r=n)}function Fi(e,t,n){var r=e.a,i=e.b;this.edge=e,this.site=t,this.angle=n?Math.atan2(n.y-t.y,n.x-t.x):e.l===t?Math.atan2(i.x-r.x,r.y-i.y):Math.atan2(r.x-i.x,i.y-r.y)}function Hi(){this._=null}function Gi(e){e.U=e.C=e.L=e.R=e.P=e.N=null}function Bi(e,t){var n=t,r=t.R,i=n.U;i?i.L===n?i.L=r:i.R=r:e._=r,r.U=i,n.U=r,n.R=r.L,n.R&&(n.R.U=n),r.L=n}function Vi(e,t){var n=t,r=t.L,i=n.U;i?i.L===n?i.L=r:i.R=r:e._=r,r.U=i,n.U=r,n.L=r.R,n.L&&(n.L.U=n),r.R=n}function Wi(e){for(;e.L;)e=e.L;return e}function Yi(e,t){var n,r,i,o=e.sort(Xi).pop();for(xi=[],wi=new Array(e.length),bi=new Hi,Si=new Hi;;)if(i=Ci,o&&(!i||o.y<i.y||o.y===i.y&&o.x<i.x))o.x===n&&o.y===r||(wi[o.i]=new Li(o),Ai(o),n=o.x,r=o.y),o=e.pop();else{if(!i)break;ki(i.arc)}t&&(function(e){for(var t,n=xi,r=fr(e[0][0],e[0][1],e[1][0],e[1][1]),i=n.length;i--;)(!qi(t=n[i],e)||!r(t)||C(t.a.x-t.b.x)<ke&&C(t.a.y-t.b.y)<ke)&&(t.a=t.b=null,n.splice(i,1))}(t),function(e){for(var t,n,r,i,o,a,s,u,c,l,f=e[0][0],d=e[1][0],p=e[0][1],h=e[1][1],g=wi,m=g.length;m--;)if((o=g[m])&&o.prepare())for(u=(s=o.edges).length,a=0;a<u;)r=(l=s[a].end()).x,i=l.y,t=(c=s[++a%u].start()).x,n=c.y,(C(r-t)>ke||C(i-n)>ke)&&(s.splice(a,0,new Fi(ji(o.site,l,C(r-f)<ke&&h-i>ke?{x:f,y:C(t-f)<ke?n:h}:C(i-h)<ke&&d-r>ke?{x:C(n-h)<ke?t:d,y:h}:C(r-d)<ke&&i-p>ke?{x:d,y:C(t-d)<ke?n:p}:C(i-p)<ke&&r-f>ke?{x:C(n-p)<ke?t:f,y:p}:null),o.site,null)),++u)}(t));var a={cells:wi,edges:xi};return bi=Si=xi=wi=null,a}function Xi(e,t){return t.y-e.y||t.x-e.x}Li.prototype.prepare=function(){for(var e,t=this.edges,n=t.length;n--;)(e=t[n].edge).b&&e.a||t.splice(n,1);return t.sort(Di),t.length},Fi.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},Hi.prototype={insert:function(e,t){var n,r,i;if(e){if(t.P=e,t.N=e.N,e.N&&(e.N.P=t),e.N=t,e.R){for(e=e.R;e.L;)e=e.L;e.L=t}else e.R=t;n=e}else this._?(e=Wi(this._),t.P=null,t.N=e,e.P=e.L=t,n=e):(t.P=t.N=null,this._=t,n=null);for(t.L=t.R=null,t.U=n,t.C=!0,e=t;n&&n.C;)n===(r=n.U).L?(i=r.R)&&i.C?(n.C=i.C=!1,r.C=!0,e=r):(e===n.R&&(Bi(this,n),n=(e=n).U),n.C=!1,r.C=!0,Vi(this,r)):(i=r.L)&&i.C?(n.C=i.C=!1,r.C=!0,e=r):(e===n.L&&(Vi(this,n),n=(e=n).U),n.C=!1,r.C=!0,Bi(this,r)),n=e.U;this._.C=!1},remove:function(e){e.N&&(e.N.P=e.P),e.P&&(e.P.N=e.N),e.N=e.P=null;var t,n,r,i=e.U,o=e.L,a=e.R;if(n=o?a?Wi(a):o:a,i?i.L===e?i.L=n:i.R=n:this._=n,o&&a?(r=n.C,n.C=e.C,n.L=o,o.U=n,n!==a?(i=n.U,n.U=e.U,e=n.R,i.L=e,n.R=a,a.U=n):(n.U=i,i=n,e=n.R)):(r=e.C,e=n),e&&(e.U=i),!r)if(e&&e.C)e.C=!1;else{do{if(e===this._)break;if(e===i.L){if((t=i.R).C&&(t.C=!1,i.C=!0,Bi(this,i),t=i.R),t.L&&t.L.C||t.R&&t.R.C){t.R&&t.R.C||(t.L.C=!1,t.C=!0,Vi(this,t),t=i.R),t.C=i.C,i.C=t.R.C=!1,Bi(this,i),e=this._;break}}else if((t=i.L).C&&(t.C=!1,i.C=!0,Vi(this,i),t=i.L),t.L&&t.L.C||t.R&&t.R.C){t.L&&t.L.C||(t.R.C=!1,t.C=!0,Bi(this,t),t=i.L),t.C=i.C,i.C=t.L.C=!1,Vi(this,i),e=this._;break}t.C=!0,e=i,i=i.U}while(!e.C);e&&(e.C=!1)}}},o.geom.voronoi=function(e){var t=fi,n=di,r=t,i=n,o=Ji;if(e)return a(e);function a(e){var t=new Array(e.length),n=o[0][0],r=o[0][1],i=o[1][0],a=o[1][1];return Yi(s(e),o).cells.forEach((function(o,s){var u=o.edges,c=o.site;(t[s]=u.length?u.map((function(e){var t=e.start();return[t.x,t.y]})):c.x>=n&&c.x<=i&&c.y>=r&&c.y<=a?[[n,a],[i,a],[i,r],[n,r]]:[]).point=e[s]})),t}function s(e){return e.map((function(e,t){return{x:Math.round(r(e,t)/ke)*ke,y:Math.round(i(e,t)/ke)*ke,i:t}}))}return a.links=function(e){return Yi(s(e)).edges.filter((function(e){return e.l&&e.r})).map((function(t){return{source:e[t.l.i],target:e[t.r.i]}}))},a.triangles=function(e){var t=[];return Yi(s(e)).cells.forEach((function(n,r){for(var i,o,a,s,u=n.site,c=n.edges.sort(Di),l=-1,f=c.length,d=c[f-1].edge,p=d.l===u?d.r:d.l;++l<f;)d,i=p,p=(d=c[l].edge).l===u?d.r:d.l,r<i.i&&r<p.i&&(a=i,s=p,((o=u).x-s.x)*(a.y-o.y)-(o.x-a.x)*(s.y-o.y)<0)&&t.push([e[r],e[i.i],e[p.i]])})),t},a.x=function(e){return arguments.length?(r=Ct(t=e),a):t},a.y=function(e){return arguments.length?(i=Ct(n=e),a):n},a.clipExtent=function(e){return arguments.length?(o=null==e?Ji:e,a):o===Ji?null:o},a.size=function(e){return arguments.length?a.clipExtent(e&&[[0,0],e]):o===Ji?null:o&&o[1]},a};var Ji=[[-1e6,-1e6],[1e6,1e6]];function Zi(e){return e.x}function Ki(e){return e.y}function eo(e,t,n,r,i,o){if(!e(t,n,r,i,o)){var a=.5*(n+i),s=.5*(r+o),u=t.nodes;u[0]&&eo(e,u[0],n,r,a,s),u[1]&&eo(e,u[1],a,r,i,s),u[2]&&eo(e,u[2],n,s,a,o),u[3]&&eo(e,u[3],a,s,i,o)}}function to(e,t,n,r,i,o,a){var s,u=1/0;return function e(c,l,f,d,p){if(!(l>o||f>a||d<r||p<i)){if(h=c.point){var h,g=t-c.x,m=n-c.y,y=g*g+m*m;if(y<u){var v=Math.sqrt(u=y);r=t-v,i=n-v,o=t+v,a=n+v,s=h}}for(var x=c.nodes,w=.5*(l+d),b=.5*(f+p),C=(n>=b)<<1|t>=w,S=C+4;C<S;++C)if(c=x[3&C])switch(3&C){case 0:e(c,l,f,w,b);break;case 1:e(c,w,f,d,b);break;case 2:e(c,l,b,w,p);break;case 3:e(c,w,b,d,p)}}}(e,r,i,o,a),s}function no(e,t){e=o.rgb(e),t=o.rgb(t);var n=e.r,r=e.g,i=e.b,a=t.r-n,s=t.g-r,u=t.b-i;return function(e){return"#"+gt(Math.round(n+a*e))+gt(Math.round(r+s*e))+gt(Math.round(i+u*e))}}function ro(e,t){var n,r={},i={};for(n in e)n in t?r[n]=uo(e[n],t[n]):i[n]=e[n];for(n in t)n in e||(i[n]=t[n]);return function(e){for(n in r)i[n]=r[n](e);return i}}function io(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function oo(e,t){var n,r,i,o=ao.lastIndex=so.lastIndex=0,a=-1,s=[],u=[];for(e+="",t+="";(n=ao.exec(e))&&(r=so.exec(t));)(i=r.index)>o&&(i=t.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:io(n,r)})),o=so.lastIndex;return o<t.length&&(i=t.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?u[0]?(t=u[0].x,function(e){return t(e)+""}):function(){return t}:(t=u.length,function(e){for(var n,r=0;r<t;++r)s[(n=u[r]).i]=n.x(e);return s.join("")})}o.geom.delaunay=function(e){return o.geom.voronoi().triangles(e)},o.geom.quadtree=function(e,t,n,r,i){var o,a=fi,s=di;if(o=arguments.length)return a=Zi,s=Ki,3===o&&(i=n,r=t,n=t=0),u(e);function u(e){var u,c,l,f,d,p,h,g,m,y=Ct(a),v=Ct(s);if(null!=t)p=t,h=n,g=r,m=i;else if(g=m=-(p=h=1/0),c=[],l=[],d=e.length,o)for(f=0;f<d;++f)(u=e[f]).x<p&&(p=u.x),u.y<h&&(h=u.y),u.x>g&&(g=u.x),u.y>m&&(m=u.y),c.push(u.x),l.push(u.y);else for(f=0;f<d;++f){var x=+y(u=e[f],f),w=+v(u,f);x<p&&(p=x),w<h&&(h=w),x>g&&(g=x),w>m&&(m=w),c.push(x),l.push(w)}var b=g-p,S=m-h;function M(e,t,n,r,i,o,a,s){if(!isNaN(n)&&!isNaN(r))if(e.leaf){var u=e.x,c=e.y;if(null!=u)if(C(u-n)+C(c-r)<.01)T(e,t,n,r,i,o,a,s);else{var l=e.point;e.x=e.y=e.point=null,T(e,l,u,c,i,o,a,s),T(e,t,n,r,i,o,a,s)}else e.x=n,e.y=r,e.point=t}else T(e,t,n,r,i,o,a,s)}function T(e,t,n,r,i,o,a,s){var u=.5*(i+a),c=.5*(o+s),l=n>=u,f=r>=c,d=f<<1|l;e.leaf=!1,l?i=u:a=u,f?o=c:s=c,M(e=e.nodes[d]||(e.nodes[d]={leaf:!0,nodes:[],point:null,x:null,y:null}),t,n,r,i,o,a,s)}b>S?m=h+b:g=p+S;var _={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(e){M(_,e,+y(e,++f),+v(e,f),p,h,g,m)},visit:function(e){eo(e,_,p,h,g,m)},find:function(e){return to(_,e[0],e[1],p,h,g,m)}};if(f=-1,null==t){for(;++f<d;)M(_,e[f],c[f],l[f],p,h,g,m);--f}else e.forEach(_.add);return c=l=e=u=null,_}return u.x=function(e){return arguments.length?(a=e,u):a},u.y=function(e){return arguments.length?(s=e,u):s},u.extent=function(e){return arguments.length?(null==e?t=n=r=i=null:(t=+e[0][0],n=+e[0][1],r=+e[1][0],i=+e[1][1]),u):null==t?null:[[t,n],[r,i]]},u.size=function(e){return arguments.length?(null==e?t=n=r=i=null:(t=n=0,r=+e[0],i=+e[1]),u):null==t?null:[r-t,i-n]},u},o.interpolateRgb=no,o.interpolateObject=ro,o.interpolateNumber=io,o.interpolateString=oo;var ao=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,so=new RegExp(ao.source,"g");function uo(e,t){for(var n,r=o.interpolators.length;--r>=0&&!(n=o.interpolators[r](e,t)););return n}function co(e,t){var n,r=[],i=[],o=e.length,a=t.length,s=Math.min(e.length,t.length);for(n=0;n<s;++n)r.push(uo(e[n],t[n]));for(;n<o;++n)i[n]=e[n];for(;n<a;++n)i[n]=t[n];return function(e){for(n=0;n<s;++n)i[n]=r[n](e);return i}}o.interpolate=uo,o.interpolators=[function(e,t){var n=typeof t;return("string"===n?bt.has(t.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(t)?no:oo:t instanceof Ve?no:Array.isArray(t)?co:"object"===n&&isNaN(t)?ro:io)(e,t)}],o.interpolateArray=co;var lo=function(){return O},fo=o.map({linear:lo,poly:function(e){return function(t){return Math.pow(t,e)}},quad:function(){return yo},cubic:function(){return vo},sin:function(){return wo},exp:function(){return bo},circle:function(){return Co},elastic:function(e,t){var n;arguments.length<2&&(t=.45);arguments.length?n=t/Ne*Math.asin(1/e):(e=1,n=t/4);return function(r){return 1+e*Math.pow(2,-10*r)*Math.sin((r-n)*Ne/t)}},back:function(e){e||(e=1.70158);return function(t){return t*t*((e+1)*t-e)}},bounce:function(){return So}}),po=o.map({in:O,out:go,"in-out":mo,"out-in":function(e){return mo(go(e))}});function ho(e){return function(t){return t<=0?0:t>=1?1:e(t)}}function go(e){return function(t){return 1-e(1-t)}}function mo(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function yo(e){return e*e}function vo(e){return e*e*e}function xo(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function wo(e){return 1-Math.cos(e*De)}function bo(e){return Math.pow(2,10*(e-1))}function Co(e){return 1-Math.sqrt(1-e*e)}function So(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function Mo(e,t){return t-=e,function(n){return Math.round(e+t*n)}}function To(e){var t,n,r,i=[e.a,e.b],o=[e.c,e.d],a=Eo(i),s=_o(i,o),u=Eo(((t=o)[0]+=(r=-s)*(n=i)[0],t[1]+=r*n[1],t))||0;i[0]*o[1]<o[0]*i[1]&&(i[0]*=-1,i[1]*=-1,a*=-1,s*=-1),this.rotate=(a?Math.atan2(i[1],i[0]):Math.atan2(-o[0],o[1]))*Oe,this.translate=[e.e,e.f],this.scale=[a,u],this.skew=u?Math.atan2(s,u)*Oe:0}function _o(e,t){return e[0]*t[0]+e[1]*t[1]}function Eo(e){var t=Math.sqrt(_o(e,e));return t&&(e[0]/=t,e[1]/=t),t}o.ease=function(e){var t=e.indexOf("-"),n=t>=0?e.slice(0,t):e,r=t>=0?e.slice(t+1):"in";return n=fo.get(n)||lo,ho((r=po.get(r)||O)(n.apply(null,a.call(arguments,1))))},o.interpolateHcl=function(e,t){e=o.hcl(e),t=o.hcl(t);var n=e.h,r=e.c,i=e.l,a=t.h-n,s=t.c-r,u=t.l-i;isNaN(s)&&(s=0,r=isNaN(r)?t.c:r);isNaN(a)?(a=0,n=isNaN(n)?t.h:n):a>180?a-=360:a<-180&&(a+=360);return function(e){return Ke(n+a*e,r+s*e,i+u*e)+""}},o.interpolateHsl=function(e,t){e=o.hsl(e),t=o.hsl(t);var n=e.h,r=e.s,i=e.l,a=t.h-n,s=t.s-r,u=t.l-i;isNaN(s)&&(s=0,r=isNaN(r)?t.s:r);isNaN(a)?(a=0,n=isNaN(n)?t.h:n):a>180?a-=360:a<-180&&(a+=360);return function(e){return Xe(n+a*e,r+s*e,i+u*e)+""}},o.interpolateHslLong=function(e,t){e=o.hsl(e),t=o.hsl(t);var n=e.h,r=e.s,i=e.l,a=t.h-n,s=t.s-r,u=t.l-i;isNaN(s)&&(s=0,r=isNaN(r)?t.s:r);isNaN(a)&&(a=0,n=isNaN(n)?t.h:n);return function(e){return Xe(n+a*e,r+s*e,i+u*e)+""}},o.interpolateLab=function(e,t){e=o.lab(e),t=o.lab(t);var n=e.l,r=e.a,i=e.b,a=t.l-n,s=t.a-r,u=t.b-i;return function(e){return at(n+a*e,r+s*e,i+u*e)+""}},o.interpolateRound=Mo,o.transform=function(e){var t=u.createElementNS(o.ns.prefix.svg,"g");return(o.transform=function(e){if(null!=e){t.setAttribute("transform",e);var n=t.transform.baseVal.consolidate()}return new To(n?n.matrix:Ro)})(e)},To.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var Ro={a:1,b:0,c:0,d:1,e:0,f:0};function ko(e){return e.length?e.pop()+",":""}function Ao(e,t){var n=[],r=[];return e=o.transform(e),t=o.transform(t),function(e,t,n,r){if(e[0]!==t[0]||e[1]!==t[1]){var i=n.push("translate(",null,",",null,")");r.push({i:i-4,x:io(e[0],t[0])},{i:i-2,x:io(e[1],t[1])})}else(t[0]||t[1])&&n.push("translate("+t+")")}(e.translate,t.translate,n,r),function(e,t,n,r){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),r.push({i:n.push(ko(n)+"rotate(",null,")")-2,x:io(e,t)})):t&&n.push(ko(n)+"rotate("+t+")")}(e.rotate,t.rotate,n,r),function(e,t,n,r){e!==t?r.push({i:n.push(ko(n)+"skewX(",null,")")-2,x:io(e,t)}):t&&n.push(ko(n)+"skewX("+t+")")}(e.skew,t.skew,n,r),function(e,t,n,r){if(e[0]!==t[0]||e[1]!==t[1]){var i=n.push(ko(n)+"scale(",null,",",null,")");r.push({i:i-4,x:io(e[0],t[0])},{i:i-2,x:io(e[1],t[1])})}else 1===t[0]&&1===t[1]||n.push(ko(n)+"scale("+t+")")}(e.scale,t.scale,n,r),e=t=null,function(e){for(var t,i=-1,o=r.length;++i<o;)n[(t=r[i]).i]=t.x(e);return n.join("")}}function Io(e,t){return t=(t-=e=+e)||1/t,function(n){return(n-e)/t}}function No(e,t){return t=(t-=e=+e)||1/t,function(n){return Math.max(0,Math.min(1,(n-e)/t))}}function Lo(e){for(var t=e.source,n=e.target,r=function(e,t){if(e===t)return e;var n=Do(e),r=Do(t),i=n.pop(),o=r.pop(),a=null;for(;i===o;)a=i,i=n.pop(),o=r.pop();return a}(t,n),i=[t];t!==r;)t=t.parent,i.push(t);for(var o=i.length;n!==r;)i.splice(o,0,n),n=n.parent;return i}function Do(e){for(var t=[],n=e.parent;null!=n;)t.push(e),e=n,n=n.parent;return t.push(e),t}function $o(e){e.fixed|=2}function Oo(e){e.fixed&=-7}function Po(e){e.fixed|=4,e.px=e.x,e.py=e.y}function qo(e){e.fixed&=-5}o.interpolateTransform=Ao,o.layout={},o.layout.bundle=function(){return function(e){for(var t=[],n=-1,r=e.length;++n<r;)t.push(Lo(e[n]));return t}},o.layout.chord=function(){var e,t,n,r,i,a,s,u={},c=0;function l(){var u,l,d,p,h,g={},m=[],y=o.range(r),v=[];for(e=[],t=[],u=0,p=-1;++p<r;){for(l=0,h=-1;++h<r;)l+=n[p][h];m.push(l),v.push(o.range(r)),u+=l}for(i&&y.sort((function(e,t){return i(m[e],m[t])})),a&&v.forEach((function(e,t){e.sort((function(e,r){return a(n[t][e],n[t][r])}))})),u=(Ne-c*r)/u,l=0,p=-1;++p<r;){for(d=l,h=-1;++h<r;){var x=y[p],w=v[x][h],b=n[x][w],C=l,S=l+=b*u;g[x+"-"+w]={index:x,subindex:w,startAngle:C,endAngle:S,value:b}}t[x]={index:x,startAngle:d,endAngle:l,value:m[x]},l+=c}for(p=-1;++p<r;)for(h=p-1;++h<r;){var M=g[p+"-"+h],T=g[h+"-"+p];(M.value||T.value)&&e.push(M.value<T.value?{source:T,target:M}:{source:M,target:T})}s&&f()}function f(){e.sort((function(e,t){return s((e.source.value+e.target.value)/2,(t.source.value+t.target.value)/2)}))}return u.matrix=function(i){return arguments.length?(r=(n=i)&&n.length,e=t=null,u):n},u.padding=function(n){return arguments.length?(c=n,e=t=null,u):c},u.sortGroups=function(n){return arguments.length?(i=n,e=t=null,u):i},u.sortSubgroups=function(t){return arguments.length?(a=t,e=null,u):a},u.sortChords=function(t){return arguments.length?(s=t,e&&f(),u):s},u.chords=function(){return e||l(),e},u.groups=function(){return t||l(),t},u},o.layout.force=function(){var e,t,n,r,i,a,s={},u=o.dispatch("start","tick","end"),c=[1,1],l=.9,f=zo,d=Uo,p=-30,h=jo,g=.1,m=.64,y=[],v=[];function x(e){return function(t,n,r,i){if(t.point!==e){var o=t.cx-e.x,a=t.cy-e.y,s=i-n,u=o*o+a*a;if(s*s/m<u){if(u<h){var c=t.charge/u;e.px-=o*c,e.py-=a*c}return!0}if(t.point&&u&&u<h){c=t.pointCharge/u;e.px-=o*c,e.py-=a*c}}return!t.charge}}function w(e){e.px=o.event.x,e.py=o.event.y,s.resume()}return s.tick=function(){if((n*=.99)<.005)return e=null,u.end({type:"end",alpha:n=0}),!0;var t,s,f,d,h,m,w,b,C,S=y.length,M=v.length;for(s=0;s<M;++s)d=(f=v[s]).source,(m=(b=(h=f.target).x-d.x)*b+(C=h.y-d.y)*C)&&(b*=m=n*i[s]*((m=Math.sqrt(m))-r[s])/m,C*=m,h.x-=b*(w=d.weight+h.weight?d.weight/(d.weight+h.weight):.5),h.y-=C*w,d.x+=b*(w=1-w),d.y+=C*w);if((w=n*g)&&(b=c[0]/2,C=c[1]/2,s=-1,w))for(;++s<S;)(f=y[s]).x+=(b-f.x)*w,f.y+=(C-f.y)*w;if(p)for(!function e(t,n,r){var i=0,o=0;if(t.charge=0,!t.leaf)for(var a,s=t.nodes,u=s.length,c=-1;++c<u;)null!=(a=s[c])&&(e(a,n,r),t.charge+=a.charge,i+=a.charge*a.cx,o+=a.charge*a.cy);if(t.point){t.leaf||(t.point.x+=Math.random()-.5,t.point.y+=Math.random()-.5);var l=n*r[t.point.index];t.charge+=t.pointCharge=l,i+=l*t.point.x,o+=l*t.point.y}t.cx=i/t.charge,t.cy=o/t.charge}(t=o.geom.quadtree(y),n,a),s=-1;++s<S;)(f=y[s]).fixed||t.visit(x(f));for(s=-1;++s<S;)(f=y[s]).fixed?(f.x=f.px,f.y=f.py):(f.x-=(f.px-(f.px=f.x))*l,f.y-=(f.py-(f.py=f.y))*l);u.tick({type:"tick",alpha:n})},s.nodes=function(e){return arguments.length?(y=e,s):y},s.links=function(e){return arguments.length?(v=e,s):v},s.size=function(e){return arguments.length?(c=e,s):c},s.linkDistance=function(e){return arguments.length?(f="function"==typeof e?e:+e,s):f},s.distance=s.linkDistance,s.linkStrength=function(e){return arguments.length?(d="function"==typeof e?e:+e,s):d},s.friction=function(e){return arguments.length?(l=+e,s):l},s.charge=function(e){return arguments.length?(p="function"==typeof e?e:+e,s):p},s.chargeDistance=function(e){return arguments.length?(h=e*e,s):Math.sqrt(h)},s.gravity=function(e){return arguments.length?(g=+e,s):g},s.theta=function(e){return arguments.length?(m=e*e,s):Math.sqrt(m)},s.alpha=function(t){return arguments.length?(t=+t,n?t>0?n=t:(e.c=null,e.t=NaN,e=null,u.end({type:"end",alpha:n=0})):t>0&&(u.start({type:"start",alpha:n=t}),e=At(s.tick)),s):n},s.start=function(){var e,t,n,o=y.length,u=v.length,l=c[0],h=c[1];for(e=0;e<o;++e)(n=y[e]).index=e,n.weight=0;for(e=0;e<u;++e)"number"==typeof(n=v[e]).source&&(n.source=y[n.source]),"number"==typeof n.target&&(n.target=y[n.target]),++n.source.weight,++n.target.weight;for(e=0;e<o;++e)n=y[e],isNaN(n.x)&&(n.x=g("x",l)),isNaN(n.y)&&(n.y=g("y",h)),isNaN(n.px)&&(n.px=n.x),isNaN(n.py)&&(n.py=n.y);if(r=[],"function"==typeof f)for(e=0;e<u;++e)r[e]=+f.call(this,v[e],e);else for(e=0;e<u;++e)r[e]=f;if(i=[],"function"==typeof d)for(e=0;e<u;++e)i[e]=+d.call(this,v[e],e);else for(e=0;e<u;++e)i[e]=d;if(a=[],"function"==typeof p)for(e=0;e<o;++e)a[e]=+p.call(this,y[e],e);else for(e=0;e<o;++e)a[e]=p;function g(n,r){if(!t){for(t=new Array(o),c=0;c<o;++c)t[c]=[];for(c=0;c<u;++c){var i=v[c];t[i.source.index].push(i.target),t[i.target.index].push(i.source)}}for(var a,s=t[e],c=-1,l=s.length;++c<l;)if(!isNaN(a=s[c][n]))return a;return Math.random()*r}return s.resume()},s.resume=function(){return s.alpha(.1)},s.stop=function(){return s.alpha(0)},s.drag=function(){if(t||(t=o.behavior.drag().origin(O).on("dragstart.force",$o).on("drag.force",w).on("dragend.force",Oo)),!arguments.length)return t;this.on("mouseover.force",Po).on("mouseout.force",qo).call(t)},o.rebind(s,u,"on")};var zo=20,Uo=1,jo=1/0;function Qo(e,t){return o.rebind(e,t,"sort","children","value"),e.nodes=e,e.links=Wo,e}function Fo(e,t){for(var n=[e];null!=(e=n.pop());)if(t(e),(i=e.children)&&(r=i.length))for(var r,i;--r>=0;)n.push(i[r])}function Ho(e,t){for(var n=[e],r=[];null!=(e=n.pop());)if(r.push(e),(o=e.children)&&(i=o.length))for(var i,o,a=-1;++a<i;)n.push(o[a]);for(;null!=(e=r.pop());)t(e)}function Go(e){return e.children}function Bo(e){return e.value}function Vo(e,t){return t.value-e.value}function Wo(e){return o.merge(e.map((function(e){return(e.children||[]).map((function(t){return{source:e,target:t}}))})))}o.layout.hierarchy=function(){var e=Vo,t=Go,n=Bo;function r(i){var o,a=[i],s=[];for(i.depth=0;null!=(o=a.pop());)if(s.push(o),(c=t.call(r,o,o.depth))&&(u=c.length)){for(var u,c,l;--u>=0;)a.push(l=c[u]),l.parent=o,l.depth=o.depth+1;n&&(o.value=0),o.children=c}else n&&(o.value=+n.call(r,o,o.depth)||0),delete o.children;return Ho(i,(function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)})),s}return r.sort=function(t){return arguments.length?(e=t,r):e},r.children=function(e){return arguments.length?(t=e,r):t},r.value=function(e){return arguments.length?(n=e,r):n},r.revalue=function(e){return n&&(Fo(e,(function(e){e.children&&(e.value=0)})),Ho(e,(function(e){var t;e.children||(e.value=+n.call(r,e,e.depth)||0),(t=e.parent)&&(t.value+=e.value)}))),e},r},o.layout.partition=function(){var e=o.layout.hierarchy(),t=[1,1];function n(n,r){var i=e.call(this,n,r);return function e(t,n,r,i){var o=t.children;if(t.x=n,t.y=t.depth*i,t.dx=r,t.dy=i,o&&(a=o.length)){var a,s,u,c=-1;for(r=t.value?r/t.value:0;++c<a;)e(s=o[c],n,u=s.value*r,i),n+=u}}(i[0],0,t[0],t[1]/function e(t){var n=t.children,r=0;if(n&&(i=n.length))for(var i,o=-1;++o<i;)r=Math.max(r,e(n[o]));return 1+r}(i[0])),i}return n.size=function(e){return arguments.length?(t=e,n):t},Qo(n,e)},o.layout.pie=function(){var e=Number,t=Yo,n=0,r=Ne,i=0;function a(s){var u,c=s.length,l=s.map((function(t,n){return+e.call(a,t,n)})),f=+("function"==typeof n?n.apply(this,arguments):n),d=("function"==typeof r?r.apply(this,arguments):r)-f,p=Math.min(Math.abs(d)/c,+("function"==typeof i?i.apply(this,arguments):i)),h=p*(d<0?-1:1),g=o.sum(l),m=g?(d-c*h)/g:0,y=o.range(c),v=[];return null!=t&&y.sort(t===Yo?function(e,t){return l[t]-l[e]}:function(e,n){return t(s[e],s[n])}),y.forEach((function(e){v[e]={data:s[e],value:u=l[e],startAngle:f,endAngle:f+=u*m+h,padAngle:p}})),v}return a.value=function(t){return arguments.length?(e=t,a):e},a.sort=function(e){return arguments.length?(t=e,a):t},a.startAngle=function(e){return arguments.length?(n=e,a):n},a.endAngle=function(e){return arguments.length?(r=e,a):r},a.padAngle=function(e){return arguments.length?(i=e,a):i},a};var Yo={};function Xo(e){return e.x}function Jo(e){return e.y}function Zo(e,t,n){e.y0=t,e.y=n}o.layout.stack=function(){var e=O,t=ta,n=na,r=Zo,i=Xo,a=Jo;function s(u,c){if(!(p=u.length))return u;var l=u.map((function(t,n){return e.call(s,t,n)})),f=l.map((function(e){return e.map((function(e,t){return[i.call(s,e,t),a.call(s,e,t)]}))})),d=t.call(s,f,c);l=o.permute(l,d),f=o.permute(f,d);var p,h,g,m,y=n.call(s,f,c),v=l[0].length;for(g=0;g<v;++g)for(r.call(s,l[0][g],m=y[g],f[0][g][1]),h=1;h<p;++h)r.call(s,l[h][g],m+=f[h-1][g][1],f[h][g][1]);return u}return s.values=function(t){return arguments.length?(e=t,s):e},s.order=function(e){return arguments.length?(t="function"==typeof e?e:Ko.get(e)||ta,s):t},s.offset=function(e){return arguments.length?(n="function"==typeof e?e:ea.get(e)||na,s):n},s.x=function(e){return arguments.length?(i=e,s):i},s.y=function(e){return arguments.length?(a=e,s):a},s.out=function(e){return arguments.length?(r=e,s):r},s};var Ko=o.map({"inside-out":function(e){var t,n,r=e.length,i=e.map(ra),a=e.map(ia),s=o.range(r).sort((function(e,t){return i[e]-i[t]})),u=0,c=0,l=[],f=[];for(t=0;t<r;++t)n=s[t],u<c?(u+=a[n],l.push(n)):(c+=a[n],f.push(n));return f.reverse().concat(l)},reverse:function(e){return o.range(e.length).reverse()},default:ta}),ea=o.map({silhouette:function(e){var t,n,r,i=e.length,o=e[0].length,a=[],s=0,u=[];for(n=0;n<o;++n){for(t=0,r=0;t<i;t++)r+=e[t][n][1];r>s&&(s=r),a.push(r)}for(n=0;n<o;++n)u[n]=(s-a[n])/2;return u},wiggle:function(e){var t,n,r,i,o,a,s,u,c,l=e.length,f=e[0],d=f.length,p=[];for(p[0]=u=c=0,n=1;n<d;++n){for(t=0,i=0;t<l;++t)i+=e[t][n][1];for(t=0,o=0,s=f[n][0]-f[n-1][0];t<l;++t){for(r=0,a=(e[t][n][1]-e[t][n-1][1])/(2*s);r<t;++r)a+=(e[r][n][1]-e[r][n-1][1])/s;o+=a*e[t][n][1]}p[n]=u-=i?o/i*s:0,u<c&&(c=u)}for(n=0;n<d;++n)p[n]-=c;return p},expand:function(e){var t,n,r,i=e.length,o=e[0].length,a=1/i,s=[];for(n=0;n<o;++n){for(t=0,r=0;t<i;t++)r+=e[t][n][1];if(r)for(t=0;t<i;t++)e[t][n][1]/=r;else for(t=0;t<i;t++)e[t][n][1]=a}for(n=0;n<o;++n)s[n]=0;return s},zero:na});function ta(e){return o.range(e.length)}function na(e){for(var t=-1,n=e[0].length,r=[];++t<n;)r[t]=0;return r}function ra(e){for(var t,n=1,r=0,i=e[0][1],o=e.length;n<o;++n)(t=e[n][1])>i&&(r=n,i=t);return r}function ia(e){return e.reduce(oa,0)}function oa(e,t){return e+t[1]}function aa(e,t){return sa(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function sa(e,t){for(var n=-1,r=+e[0],i=(e[1]-r)/t,o=[];++n<=t;)o[n]=i*n+r;return o}function ua(e){return[o.min(e),o.max(e)]}function ca(e,t){return e.value-t.value}function la(e,t){var n=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=n,n._pack_prev=t}function fa(e,t){e._pack_next=t,t._pack_prev=e}function da(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return.999*i*i>n*n+r*r}function pa(e){if((t=e.children)&&(u=t.length)){var t,n,r,i,o,a,s,u,c=1/0,l=-1/0,f=1/0,d=-1/0;if(t.forEach(ha),(n=t[0]).x=-n.r,n.y=0,x(n),u>1&&((r=t[1]).x=r.r,r.y=0,x(r),u>2))for(ma(n,r,i=t[2]),x(i),la(n,i),n._pack_prev=i,la(i,r),r=n._pack_next,o=3;o<u;o++){ma(n,r,i=t[o]);var p=0,h=1,g=1;for(a=r._pack_next;a!==r;a=a._pack_next,h++)if(da(a,i)){p=1;break}if(1==p)for(s=n._pack_prev;s!==a._pack_prev&&!da(s,i);s=s._pack_prev,g++);p?(h<g||h==g&&r.r<n.r?fa(n,r=a):fa(n=s,r),o--):(la(n,i),r=i,x(i))}var m=(c+l)/2,y=(f+d)/2,v=0;for(o=0;o<u;o++)(i=t[o]).x-=m,i.y-=y,v=Math.max(v,i.r+Math.sqrt(i.x*i.x+i.y*i.y));e.r=v,t.forEach(ga)}function x(e){c=Math.min(e.x-e.r,c),l=Math.max(e.x+e.r,l),f=Math.min(e.y-e.r,f),d=Math.max(e.y+e.r,d)}}function ha(e){e._pack_next=e._pack_prev=e}function ga(e){delete e._pack_next,delete e._pack_prev}function ma(e,t,n){var r=e.r+n.r,i=t.x-e.x,o=t.y-e.y;if(r&&(i||o)){var a=t.r+n.r,s=i*i+o*o,u=.5+((r*=r)-(a*=a))/(2*s),c=Math.sqrt(Math.max(0,2*a*(r+s)-(r-=s)*r-a*a))/(2*s);n.x=e.x+u*i+c*o,n.y=e.y+u*o-c*i}else n.x=e.x+r,n.y=e.y}function ya(e,t){return e.parent==t.parent?1:2}function va(e){var t=e.children;return t.length?t[0]:e.t}function xa(e){var t,n=e.children;return(t=n.length)?n[t-1]:e.t}function wa(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function ba(e,t,n){return e.a.parent===t.parent?e.a:n}function Ca(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function Sa(e,t){var n=e.x+t[3],r=e.y+t[0],i=e.dx-t[1]-t[3],o=e.dy-t[0]-t[2];return i<0&&(n+=i/2,i=0),o<0&&(r+=o/2,o=0),{x:n,y:r,dx:i,dy:o}}function Ma(e){var t=e[0],n=e[e.length-1];return t<n?[t,n]:[n,t]}function Ta(e){return e.rangeExtent?e.rangeExtent():Ma(e.range())}function _a(e,t,n,r){var i=n(e[0],e[1]),o=r(t[0],t[1]);return function(e){return o(i(e))}}function Ea(e,t){var n,r=0,i=e.length-1,o=e[r],a=e[i];return a<o&&(n=r,r=i,i=n,n=o,o=a,a=n),e[r]=t.floor(o),e[i]=t.ceil(a),e}function Ra(e){return e?{floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}}:ka}o.layout.histogram=function(){var e=!0,t=Number,n=ua,r=aa;function i(i,a){for(var s,u,c=[],l=i.map(t,this),f=n.call(this,l,a),d=r.call(this,f,l,a),p=(a=-1,l.length),h=d.length-1,g=e?1:1/p;++a<h;)(s=c[a]=[]).dx=d[a+1]-(s.x=d[a]),s.y=0;if(h>0)for(a=-1;++a<p;)(u=l[a])>=f[0]&&u<=f[1]&&((s=c[o.bisect(d,u,1,h)-1]).y+=g,s.push(i[a]));return c}return i.value=function(e){return arguments.length?(t=e,i):t},i.range=function(e){return arguments.length?(n=Ct(e),i):n},i.bins=function(e){return arguments.length?(r="number"==typeof e?function(t){return sa(t,e)}:Ct(e),i):r},i.frequency=function(t){return arguments.length?(e=!!t,i):e},i},o.layout.pack=function(){var e,t=o.layout.hierarchy().sort(ca),n=0,r=[1,1];function i(i,o){var a=t.call(this,i,o),s=a[0],u=r[0],c=r[1],l=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,Ho(s,(function(e){e.r=+l(e.value)})),Ho(s,pa),n){var f=n*(e?1:Math.max(2*s.r/u,2*s.r/c))/2;Ho(s,(function(e){e.r+=f})),Ho(s,pa),Ho(s,(function(e){e.r-=f}))}return function e(t,n,r,i){var o=t.children;if(t.x=n+=i*t.x,t.y=r+=i*t.y,t.r*=i,o)for(var a=-1,s=o.length;++a<s;)e(o[a],n,r,i)}(s,u/2,c/2,e?1:1/Math.max(2*s.r/u,2*s.r/c)),a}return i.size=function(e){return arguments.length?(r=e,i):r},i.radius=function(t){return arguments.length?(e=null==t||"function"==typeof t?t:+t,i):e},i.padding=function(e){return arguments.length?(n=+e,i):n},Qo(i,t)},o.layout.tree=function(){var e=o.layout.hierarchy().sort(null).value(null),t=ya,n=[1,1],r=null;function i(i,o){var c=e.call(this,i,o),l=c[0],f=function(e){var t,n={A:null,children:[e]},r=[n];for(;null!=(t=r.pop());)for(var i,o=t.children,a=0,s=o.length;a<s;++a)r.push((o[a]=i={_:o[a],parent:t,children:(i=o[a].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:a}).a=i);return n.children[0]}(l);if(Ho(f,a),f.parent.m=-f.z,Fo(f,s),r)Fo(l,u);else{var d=l,p=l,h=l;Fo(l,(function(e){e.x<d.x&&(d=e),e.x>p.x&&(p=e),e.depth>h.depth&&(h=e)}));var g=t(d,p)/2-d.x,m=n[0]/(p.x+t(p,d)/2+g),y=n[1]/(h.depth||1);Fo(l,(function(e){e.x=(e.x+g)*m,e.y=e.depth*y}))}return c}function a(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n.length){!function(e){var t,n=0,r=0,i=e.children,o=i.length;for(;--o>=0;)(t=i[o]).z+=n,t.m+=n,n+=t.s+(r+=t.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,o=e,a=e,s=n,u=o.parent.children[0],c=o.m,l=a.m,f=s.m,d=u.m;s=xa(s),o=va(o),s&&o;)u=va(u),(a=xa(a)).a=e,(i=s.z+f-o.z-c+t(s._,o._))>0&&(wa(ba(s,e,r),e,i),c+=i,l+=i),f+=s.m,c+=o.m,d+=u.m,l+=a.m;s&&!xa(a)&&(a.t=s,a.m+=f-l),o&&!va(u)&&(u.t=o,u.m+=c-d,r=e)}return r}(e,i,e.parent.A||r[0])}function s(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function u(e){e.x*=n[0],e.y=e.depth*n[1]}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(e){return arguments.length?(r=null==(n=e)?u:null,i):r?null:n},i.nodeSize=function(e){return arguments.length?(r=null==(n=e)?null:u,i):r?n:null},Qo(i,e)},o.layout.cluster=function(){var e=o.layout.hierarchy().sort(null).value(null),t=ya,n=[1,1],r=!1;function i(i,a){var s,u=e.call(this,i,a),c=u[0],l=0;Ho(c,(function(e){var n=e.children;n&&n.length?(e.x=function(e){return e.reduce((function(e,t){return e+t.x}),0)/e.length}(n),e.y=function(e){return 1+o.max(e,(function(e){return e.y}))}(n)):(e.x=s?l+=t(e,s):0,e.y=0,s=e)}));var f=function e(t){var n=t.children;return n&&n.length?e(n[0]):t}(c),d=function e(t){var n,r=t.children;return r&&(n=r.length)?e(r[n-1]):t}(c),p=f.x-t(f,d)/2,h=d.x+t(d,f)/2;return Ho(c,r?function(e){e.x=(e.x-c.x)*n[0],e.y=(c.y-e.y)*n[1]}:function(e){e.x=(e.x-p)/(h-p)*n[0],e.y=(1-(c.y?e.y/c.y:1))*n[1]}),u}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(e){return arguments.length?(r=null==(n=e),i):r?null:n},i.nodeSize=function(e){return arguments.length?(r=null!=(n=e),i):r?n:null},Qo(i,e)},o.layout.treemap=function(){var e,t=o.layout.hierarchy(),n=Math.round,r=[1,1],i=null,a=Ca,s=!1,u="squarify",c=.5*(1+Math.sqrt(5));function l(e,t){for(var n,r,i=-1,o=e.length;++i<o;)r=(n=e[i]).value*(t<0?0:t),n.area=isNaN(r)||r<=0?0:r}function f(e){var t=e.children;if(t&&t.length){var n,r,i,o=a(e),s=[],c=t.slice(),d=1/0,g="slice"===u?o.dx:"dice"===u?o.dy:"slice-dice"===u?1&e.depth?o.dy:o.dx:Math.min(o.dx,o.dy);for(l(c,o.dx*o.dy/e.value),s.area=0;(i=c.length)>0;)s.push(n=c[i-1]),s.area+=n.area,"squarify"!==u||(r=p(s,g))<=d?(c.pop(),d=r):(s.area-=s.pop().area,h(s,g,o,!1),g=Math.min(o.dx,o.dy),s.length=s.area=0,d=1/0);s.length&&(h(s,g,o,!0),s.length=s.area=0),t.forEach(f)}}function d(e){var t=e.children;if(t&&t.length){var n,r=a(e),i=t.slice(),o=[];for(l(i,r.dx*r.dy/e.value),o.area=0;n=i.pop();)o.push(n),o.area+=n.area,null!=n.z&&(h(o,n.z?r.dx:r.dy,r,!i.length),o.length=o.area=0);t.forEach(d)}}function p(e,t){for(var n,r=e.area,i=0,o=1/0,a=-1,s=e.length;++a<s;)(n=e[a].area)&&(n<o&&(o=n),n>i&&(i=n));return t*=t,(r*=r)?Math.max(t*i*c/r,r/(t*o*c)):1/0}function h(e,t,r,i){var o,a=-1,s=e.length,u=r.x,c=r.y,l=t?n(e.area/t):0;if(t==r.dx){for((i||l>r.dy)&&(l=r.dy);++a<s;)(o=e[a]).x=u,o.y=c,o.dy=l,u+=o.dx=Math.min(r.x+r.dx-u,l?n(o.area/l):0);o.z=!0,o.dx+=r.x+r.dx-u,r.y+=l,r.dy-=l}else{for((i||l>r.dx)&&(l=r.dx);++a<s;)(o=e[a]).x=u,o.y=c,o.dx=l,c+=o.dy=Math.min(r.y+r.dy-c,l?n(o.area/l):0);o.z=!1,o.dy+=r.y+r.dy-c,r.x+=l,r.dx-=l}}function g(n){var i=e||t(n),o=i[0];return o.x=o.y=0,o.value?(o.dx=r[0],o.dy=r[1]):o.dx=o.dy=0,e&&t.revalue(o),l([o],o.dx*o.dy/o.value),(e?d:f)(o),s&&(e=i),i}return g.size=function(e){return arguments.length?(r=e,g):r},g.padding=function(e){if(!arguments.length)return i;function t(t){var n=e.call(g,t,t.depth);return null==n?Ca(t):Sa(t,"number"==typeof n?[n,n,n,n]:n)}function n(t){return Sa(t,e)}var r;return a=null==(i=e)?Ca:"function"==(r=typeof e)?t:"number"===r?(e=[e,e,e,e],n):n,g},g.round=function(e){return arguments.length?(n=e?Math.round:Number,g):n!=Number},g.sticky=function(t){return arguments.length?(s=t,e=null,g):s},g.ratio=function(e){return arguments.length?(c=e,g):c},g.mode=function(e){return arguments.length?(u=e+"",g):u},Qo(g,t)},o.random={normal:function(e,t){var n=arguments.length;return n<2&&(t=1),n<1&&(e=0),function(){var n,r,i;do{i=(n=2*Math.random()-1)*n+(r=2*Math.random()-1)*r}while(!i||i>1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var e=o.random.normal.apply(o,arguments);return function(){return Math.exp(e())}},bates:function(e){var t=o.random.irwinHall(e);return function(){return t()/e}},irwinHall:function(e){return function(){for(var t=0,n=0;n<e;n++)t+=Math.random();return t}}},o.scale={};var ka={floor:O,ceil:O};function Aa(e,t,n,r){var i=[],a=[],s=0,u=Math.min(e.length,t.length)-1;for(e[u]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<=u;)i.push(n(e[s-1],e[s])),a.push(r(t[s-1],t[s]));return function(t){var n=o.bisect(e,t,1,u)-1;return a[n](i[n](t))}}function Ia(e,t){return o.rebind(e,t,"range","rangeRound","interpolate","clamp")}function Na(e,t){return Ea(e,Ra(La(e,t)[2])),Ea(e,Ra(La(e,t)[2])),e}function La(e,t){null==t&&(t=10);var n=Ma(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),o=t/r*i;return o<=.15?i*=10:o<=.35?i*=5:o<=.75&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+.5*i,n[2]=i,n}function Da(e,t){return o.range.apply(o,La(e,t))}function $a(e,t,n){var r=La(e,t);if(n){var i=Pt.exec(n);if(i.shift(),"s"===i[8]){var a=o.formatPrefix(Math.max(C(r[0]),C(r[1])));return i[7]||(i[7]="."+Pa(a.scale(r[2]))),i[8]="f",n=o.format(i.join("")),function(e){return n(a.scale(e))+a.symbol}}i[7]||(i[7]="."+function(e,t){var n=Pa(t[2]);return e in Oa?Math.abs(n-Pa(Math.max(C(t[0]),C(t[1]))))+ +("e"!==e):n-2*("%"===e)}(i[8],r)),n=i.join("")}else n=",."+Pa(r[2])+"f";return o.format(n)}o.scale.linear=function(){return function e(t,n,r,i){var o,a;function s(){var e=Math.min(t.length,n.length)>2?Aa:_a,s=i?No:Io;return o=e(t,n,s,r),a=e(n,t,s,uo),u}function u(e){return o(e)}return u.invert=function(e){return a(e)},u.domain=function(e){return arguments.length?(t=e.map(Number),s()):t},u.range=function(e){return arguments.length?(n=e,s()):n},u.rangeRound=function(e){return u.range(e).interpolate(Mo)},u.clamp=function(e){return arguments.length?(i=e,s()):i},u.interpolate=function(e){return arguments.length?(r=e,s()):r},u.ticks=function(e){return Da(t,e)},u.tickFormat=function(e,n){return $a(t,e,n)},u.nice=function(e){return Na(t,e),s()},u.copy=function(){return e(t,n,r,i)},s()}([0,1],[0,1],uo,!1)};var Oa={s:1,g:1,p:1,r:1,e:1};function Pa(e){return-Math.floor(Math.log(e)/Math.LN10+.01)}o.scale.log=function(){return function e(t,n,r,i){function a(e){return(r?Math.log(e<0?0:e):-Math.log(e>0?0:-e))/Math.log(n)}function s(e){return r?Math.pow(n,e):-Math.pow(n,-e)}function u(e){return t(a(e))}return u.invert=function(e){return s(t.invert(e))},u.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((i=e.map(Number)).map(a)),u):i},u.base=function(e){return arguments.length?(n=+e,t.domain(i.map(a)),u):n},u.nice=function(){var e=Ea(i.map(a),r?Math:za);return t.domain(e),i=e.map(s),u},u.ticks=function(){var e=Ma(i),t=[],o=e[0],u=e[1],c=Math.floor(a(o)),l=Math.ceil(a(u)),f=n%1?2:n;if(isFinite(l-c)){if(r){for(;c<l;c++)for(var d=1;d<f;d++)t.push(s(c)*d);t.push(s(c))}else for(t.push(s(c));c++<l;)for(d=f-1;d>0;d--)t.push(s(c)*d);for(c=0;t[c]<o;c++);for(l=t.length;t[l-1]>u;l--);t=t.slice(c,l)}return t},u.tickFormat=function(e,t){if(!arguments.length)return qa;arguments.length<2?t=qa:"function"!=typeof t&&(t=o.format(t));var r=Math.max(1,n*e/u.ticks().length);return function(e){var i=e/s(Math.round(a(e)));return i*n<n-.5&&(i*=n),i<=r?t(e):""}},u.copy=function(){return e(t.copy(),n,r,i)},Ia(u,t)}(o.scale.linear().domain([0,1]),10,!0,[1,10])};var qa=o.format(".0e"),za={floor:function(e){return-Math.ceil(-e)},ceil:function(e){return-Math.floor(-e)}};function Ua(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}o.scale.pow=function(){return function e(t,n,r){var i=Ua(n),o=Ua(1/n);function a(e){return t(i(e))}return a.invert=function(e){return o(t.invert(e))},a.domain=function(e){return arguments.length?(t.domain((r=e.map(Number)).map(i)),a):r},a.ticks=function(e){return Da(r,e)},a.tickFormat=function(e,t){return $a(r,e,t)},a.nice=function(e){return a.domain(Na(r,e))},a.exponent=function(e){return arguments.length?(i=Ua(n=e),o=Ua(1/n),t.domain(r.map(i)),a):n},a.copy=function(){return e(t.copy(),n,r)},Ia(a,t)}(o.scale.linear(),1,[0,1])},o.scale.sqrt=function(){return o.scale.pow().exponent(.5)},o.scale.ordinal=function(){return function e(t,n){var r,i,a;function s(e){return i[((r.get(e)||("range"===n.t?r.set(e,t.push(e)):NaN))-1)%i.length]}function u(e,n){return o.range(t.length).map((function(t){return e+n*t}))}return s.domain=function(e){if(!arguments.length)return t;t=[],r=new T;for(var i,o=-1,a=e.length;++o<a;)r.has(i=e[o])||r.set(i,t.push(i));return s[n.t].apply(s,n.a)},s.range=function(e){return arguments.length?(i=e,a=0,n={t:"range",a:arguments},s):i},s.rangePoints=function(e,r){arguments.length<2&&(r=0);var o=e[0],c=e[1],l=t.length<2?(o=(o+c)/2,0):(c-o)/(t.length-1+r);return i=u(o+l*r/2,l),a=0,n={t:"rangePoints",a:arguments},s},s.rangeRoundPoints=function(e,r){arguments.length<2&&(r=0);var o=e[0],c=e[1],l=t.length<2?(o=c=Math.round((o+c)/2),0):(c-o)/(t.length-1+r)|0;return i=u(o+Math.round(l*r/2+(c-o-(t.length-1+r)*l)/2),l),a=0,n={t:"rangeRoundPoints",a:arguments},s},s.rangeBands=function(e,r,o){arguments.length<2&&(r=0),arguments.length<3&&(o=r);var c=e[1]<e[0],l=e[c-0],f=e[1-c],d=(f-l)/(t.length-r+2*o);return i=u(l+d*o,d),c&&i.reverse(),a=d*(1-r),n={t:"rangeBands",a:arguments},s},s.rangeRoundBands=function(e,r,o){arguments.length<2&&(r=0),arguments.length<3&&(o=r);var c=e[1]<e[0],l=e[c-0],f=e[1-c],d=Math.floor((f-l)/(t.length-r+2*o));return i=u(l+Math.round((f-l-(t.length-r)*d)/2),d),c&&i.reverse(),a=Math.round(d*(1-r)),n={t:"rangeRoundBands",a:arguments},s},s.rangeBand=function(){return a},s.rangeExtent=function(){return Ma(n.a[0])},s.copy=function(){return e(t,n)},s.domain(t)}([],{t:"range",a:[[]]})},o.scale.category10=function(){return o.scale.ordinal().range(ja)},o.scale.category20=function(){return o.scale.ordinal().range(Qa)},o.scale.category20b=function(){return o.scale.ordinal().range(Fa)},o.scale.category20c=function(){return o.scale.ordinal().range(Ha)};var ja=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(pt),Qa=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(pt),Fa=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(pt),Ha=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(pt);function Ga(){return 0}o.scale.quantile=function(){return function e(t,n){var r;function i(){var e=0,i=n.length;for(r=[];++e<i;)r[e-1]=o.quantile(t,e/i);return a}function a(e){if(!isNaN(e=+e))return n[o.bisect(r,e)]}return a.domain=function(e){return arguments.length?(t=e.map(y).filter(v).sort(m),i()):t},a.range=function(e){return arguments.length?(n=e,i()):n},a.quantiles=function(){return r},a.invertExtent=function(e){return(e=n.indexOf(e))<0?[NaN,NaN]:[e>0?r[e-1]:t[0],e<r.length?r[e]:t[t.length-1]]},a.copy=function(){return e(t,n)},i()}([],[])},o.scale.quantize=function(){return function e(t,n,r){var i,o;function a(e){return r[Math.max(0,Math.min(o,Math.floor(i*(e-t))))]}function s(){return i=r.length/(n-t),o=r.length-1,a}return a.domain=function(e){return arguments.length?(t=+e[0],n=+e[e.length-1],s()):[t,n]},a.range=function(e){return arguments.length?(r=e,s()):r},a.invertExtent=function(e){return[e=(e=r.indexOf(e))<0?NaN:e/i+t,e+1/i]},a.copy=function(){return e(t,n,r)},s()}(0,1,[0,1])},o.scale.threshold=function(){return function e(t,n){function r(e){if(e<=e)return n[o.bisect(t,e)]}return r.domain=function(e){return arguments.length?(t=e,r):t},r.range=function(e){return arguments.length?(n=e,r):n},r.invertExtent=function(e){return e=n.indexOf(e),[t[e-1],t[e]]},r.copy=function(){return e(t,n)},r}([.5],[0,1])},o.scale.identity=function(){return function e(t){function n(e){return+e}return n.invert=n,n.domain=n.range=function(e){return arguments.length?(t=e.map(n),n):t},n.ticks=function(e){return Da(t,e)},n.tickFormat=function(e,n){return $a(t,e,n)},n.copy=function(){return e(t)},n}([0,1])},o.svg={},o.svg.arc=function(){var e=Va,t=Wa,n=Ga,r=Ba,i=Ya,o=Xa,a=Ja;function s(){var s=Math.max(0,+e.apply(this,arguments)),c=Math.max(0,+t.apply(this,arguments)),l=i.apply(this,arguments)-De,f=o.apply(this,arguments)-De,d=Math.abs(f-l),p=l>f?0:1;if(c<s&&(h=c,c=s,s=h),d>=Le)return u(c,p)+(s?u(s,1-p):"")+"Z";var h,g,m,y,v,x,w,b,C,S,M,T,_=0,E=0,R=[];if((y=(+a.apply(this,arguments)||0)/2)&&(m=r===Ba?Math.sqrt(s*s+c*c):+r.apply(this,arguments),p||(E*=-1),c&&(E=Ue(m/c*Math.sin(y))),s&&(_=Ue(m/s*Math.sin(y)))),c){v=c*Math.cos(l+E),x=c*Math.sin(l+E),w=c*Math.cos(f-E),b=c*Math.sin(f-E);var k=Math.abs(f-l-2*E)<=Ie?0:1;if(E&&Za(v,x,w,b)===p^k){var A=(l+f)/2;v=c*Math.cos(A),x=c*Math.sin(A),w=b=null}}else v=x=0;if(s){C=s*Math.cos(f-_),S=s*Math.sin(f-_),M=s*Math.cos(l+_),T=s*Math.sin(l+_);var I=Math.abs(l-f+2*_)<=Ie?0:1;if(_&&Za(C,S,M,T)===1-p^I){var N=(l+f)/2;C=s*Math.cos(N),S=s*Math.sin(N),M=T=null}}else C=S=0;if(d>ke&&(h=Math.min(Math.abs(c-s)/2,+n.apply(this,arguments)))>.001){g=s<c^p?0:1;var L=h,D=h;if(d<Ie){var $=null==M?[C,S]:null==w?[v,x]:yi([v,x],[M,T],[w,b],[C,S]),O=v-$[0],P=x-$[1],q=w-$[0],z=b-$[1],U=1/Math.sin(Math.acos((O*q+P*z)/(Math.sqrt(O*O+P*P)*Math.sqrt(q*q+z*z)))/2),j=Math.sqrt($[0]*$[0]+$[1]*$[1]);D=Math.min(h,(s-j)/(U-1)),L=Math.min(h,(c-j)/(U+1))}if(null!=w){var Q=Ka(null==M?[C,S]:[M,T],[v,x],c,L,p),F=Ka([w,b],[C,S],c,L,p);h===L?R.push("M",Q[0],"A",L,",",L," 0 0,",g," ",Q[1],"A",c,",",c," 0 ",1-p^Za(Q[1][0],Q[1][1],F[1][0],F[1][1]),",",p," ",F[1],"A",L,",",L," 0 0,",g," ",F[0]):R.push("M",Q[0],"A",L,",",L," 0 1,",g," ",F[0])}else R.push("M",v,",",x);if(null!=M){var H=Ka([v,x],[M,T],s,-D,p),G=Ka([C,S],null==w?[v,x]:[w,b],s,-D,p);h===D?R.push("L",G[0],"A",D,",",D," 0 0,",g," ",G[1],"A",s,",",s," 0 ",p^Za(G[1][0],G[1][1],H[1][0],H[1][1]),",",1-p," ",H[1],"A",D,",",D," 0 0,",g," ",H[0]):R.push("L",G[0],"A",D,",",D," 0 0,",g," ",H[0])}else R.push("L",C,",",S)}else R.push("M",v,",",x),null!=w&&R.push("A",c,",",c," 0 ",k,",",p," ",w,",",b),R.push("L",C,",",S),null!=M&&R.push("A",s,",",s," 0 ",I,",",1-p," ",M,",",T);return R.push("Z"),R.join("")}function u(e,t){return"M0,"+e+"A"+e+","+e+" 0 1,"+t+" 0,"+-e+"A"+e+","+e+" 0 1,"+t+" 0,"+e}return s.innerRadius=function(t){return arguments.length?(e=Ct(t),s):e},s.outerRadius=function(e){return arguments.length?(t=Ct(e),s):t},s.cornerRadius=function(e){return arguments.length?(n=Ct(e),s):n},s.padRadius=function(e){return arguments.length?(r=e==Ba?Ba:Ct(e),s):r},s.startAngle=function(e){return arguments.length?(i=Ct(e),s):i},s.endAngle=function(e){return arguments.length?(o=Ct(e),s):o},s.padAngle=function(e){return arguments.length?(a=Ct(e),s):a},s.centroid=function(){var n=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-De;return[Math.cos(r)*n,Math.sin(r)*n]},s};var Ba="auto";function Va(e){return e.innerRadius}function Wa(e){return e.outerRadius}function Ya(e){return e.startAngle}function Xa(e){return e.endAngle}function Ja(e){return e&&e.padAngle}function Za(e,t,n,r){return(e-n)*t-(t-r)*e>0?0:1}function Ka(e,t,n,r,i){var o=e[0]-t[0],a=e[1]-t[1],s=(i?r:-r)/Math.sqrt(o*o+a*a),u=s*a,c=-s*o,l=e[0]+u,f=e[1]+c,d=t[0]+u,p=t[1]+c,h=(l+d)/2,g=(f+p)/2,m=d-l,y=p-f,v=m*m+y*y,x=n-r,w=l*p-d*f,b=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*v-w*w)),C=(w*y-m*b)/v,S=(-w*m-y*b)/v,M=(w*y+m*b)/v,T=(-w*m+y*b)/v,_=C-h,E=S-g,R=M-h,k=T-g;return _*_+E*E>R*R+k*k&&(C=M,S=T),[[C-u,S-c],[C*n/x,S*n/x]]}function es(e){var t=fi,n=di,r=tr,i=ns,o=i.key,a=.7;function s(o){var s,u=[],c=[],l=-1,f=o.length,d=Ct(t),p=Ct(n);function h(){u.push("M",i(e(c),a))}for(;++l<f;)r.call(this,s=o[l],l)?c.push([+d.call(this,s,l),+p.call(this,s,l)]):c.length&&(h(),c=[]);return c.length&&h(),u.length?u.join(""):null}return s.x=function(e){return arguments.length?(t=e,s):t},s.y=function(e){return arguments.length?(n=e,s):n},s.defined=function(e){return arguments.length?(r=e,s):r},s.interpolate=function(e){return arguments.length?(o="function"==typeof e?i=e:(i=ts.get(e)||ns).key,s):o},s.tension=function(e){return arguments.length?(a=e,s):a},s}o.svg.line=function(){return es(O)};var ts=o.map({linear:ns,"linear-closed":rs,step:function(e){var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];for(;++t<n;)i.push("H",(r[0]+(r=e[t])[0])/2,"V",r[1]);n>1&&i.push("H",r[0]);return i.join("")},"step-before":is,"step-after":os,basis:us,"basis-open":function(e){if(e.length<4)return ns(e);var t,n=[],r=-1,i=e.length,o=[0],a=[0];for(;++r<3;)t=e[r],o.push(t[0]),a.push(t[1]);n.push(cs(ds,o)+","+cs(ds,a)),--r;for(;++r<i;)t=e[r],o.shift(),o.push(t[0]),a.shift(),a.push(t[1]),ps(n,o,a);return n.join("")},"basis-closed":function(e){var t,n,r=-1,i=e.length,o=i+4,a=[],s=[];for(;++r<4;)n=e[r%i],a.push(n[0]),s.push(n[1]);t=[cs(ds,a),",",cs(ds,s)],--r;for(;++r<o;)n=e[r%i],a.shift(),a.push(n[0]),s.shift(),s.push(n[1]),ps(t,a,s);return t.join("")},bundle:function(e,t){var n=e.length-1;if(n)for(var r,i,o=e[0][0],a=e[0][1],s=e[n][0]-o,u=e[n][1]-a,c=-1;++c<=n;)r=e[c],i=c/n,r[0]=t*r[0]+(1-t)*(o+i*s),r[1]=t*r[1]+(1-t)*(a+i*u);return us(e)},cardinal:function(e,t){return e.length<3?ns(e):e[0]+as(e,ss(e,t))},"cardinal-open":function(e,t){return e.length<4?ns(e):e[1]+as(e.slice(1,-1),ss(e,t))},"cardinal-closed":function(e,t){return e.length<3?rs(e):e[0]+as((e.push(e[0]),e),ss([e[e.length-2]].concat(e,[e[1]]),t))},monotone:function(e){return e.length<3?ns(e):e[0]+as(e,function(e){var t,n,r,i,o=[],a=function(e){var t=0,n=e.length-1,r=[],i=e[0],o=e[1],a=r[0]=hs(i,o);for(;++t<n;)r[t]=(a+(a=hs(i=o,o=e[t+1])))/2;return r[t]=a,r}(e),s=-1,u=e.length-1;for(;++s<u;)t=hs(e[s],e[s+1]),C(t)<ke?a[s]=a[s+1]=0:(n=a[s]/t,r=a[s+1]/t,(i=n*n+r*r)>9&&(i=3*t/Math.sqrt(i),a[s]=i*n,a[s+1]=i*r));s=-1;for(;++s<=u;)i=(e[Math.min(u,s+1)][0]-e[Math.max(0,s-1)][0])/(6*(1+a[s]*a[s])),o.push([i||0,a[s]*i||0]);return o}(e))}});function ns(e){return e.length>1?e.join("L"):e+"Z"}function rs(e){return e.join("L")+"Z"}function is(e){for(var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];++t<n;)i.push("V",(r=e[t])[1],"H",r[0]);return i.join("")}function os(e){for(var t=0,n=e.length,r=e[0],i=[r[0],",",r[1]];++t<n;)i.push("H",(r=e[t])[0],"V",r[1]);return i.join("")}function as(e,t){if(t.length<1||e.length!=t.length&&e.length!=t.length+2)return ns(e);var n=e.length!=t.length,r="",i=e[0],o=e[1],a=t[0],s=a,u=1;if(n&&(r+="Q"+(o[0]-2*a[0]/3)+","+(o[1]-2*a[1]/3)+","+o[0]+","+o[1],i=e[1],u=2),t.length>1){s=t[1],o=e[u],u++,r+="C"+(i[0]+a[0])+","+(i[1]+a[1])+","+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1];for(var c=2;c<t.length;c++,u++)o=e[u],s=t[c],r+="S"+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1]}if(n){var l=e[u];r+="Q"+(o[0]+2*s[0]/3)+","+(o[1]+2*s[1]/3)+","+l[0]+","+l[1]}return r}function ss(e,t){for(var n,r=[],i=(1-t)/2,o=e[0],a=e[1],s=1,u=e.length;++s<u;)n=o,o=a,a=e[s],r.push([i*(a[0]-n[0]),i*(a[1]-n[1])]);return r}function us(e){if(e.length<3)return ns(e);var t=1,n=e.length,r=e[0],i=r[0],o=r[1],a=[i,i,i,(r=e[1])[0]],s=[o,o,o,r[1]],u=[i,",",o,"L",cs(ds,a),",",cs(ds,s)];for(e.push(e[n-1]);++t<=n;)r=e[t],a.shift(),a.push(r[0]),s.shift(),s.push(r[1]),ps(u,a,s);return e.pop(),u.push("L",r),u.join("")}function cs(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}ts.forEach((function(e,t){t.key=e,t.closed=/-closed$/.test(e)}));var ls=[0,2/3,1/3,0],fs=[0,1/3,2/3,0],ds=[0,1/6,2/3,1/6];function ps(e,t,n){e.push("C",cs(ls,t),",",cs(ls,n),",",cs(fs,t),",",cs(fs,n),",",cs(ds,t),",",cs(ds,n))}function hs(e,t){return(t[1]-e[1])/(t[0]-e[0])}function gs(e){for(var t,n,r,i=-1,o=e.length;++i<o;)n=(t=e[i])[0],r=t[1]-De,t[0]=n*Math.cos(r),t[1]=n*Math.sin(r);return e}function ms(e){var t=fi,n=fi,r=0,i=di,o=tr,a=ns,s=a.key,u=a,c="L",l=.7;function f(s){var f,d,p,h=[],g=[],m=[],y=-1,v=s.length,x=Ct(t),w=Ct(r),b=t===n?function(){return d}:Ct(n),C=r===i?function(){return p}:Ct(i);function S(){h.push("M",a(e(m),l),c,u(e(g.reverse()),l),"Z")}for(;++y<v;)o.call(this,f=s[y],y)?(g.push([d=+x.call(this,f,y),p=+w.call(this,f,y)]),m.push([+b.call(this,f,y),+C.call(this,f,y)])):g.length&&(S(),g=[],m=[]);return g.length&&S(),h.length?h.join(""):null}return f.x=function(e){return arguments.length?(t=n=e,f):n},f.x0=function(e){return arguments.length?(t=e,f):t},f.x1=function(e){return arguments.length?(n=e,f):n},f.y=function(e){return arguments.length?(r=i=e,f):i},f.y0=function(e){return arguments.length?(r=e,f):r},f.y1=function(e){return arguments.length?(i=e,f):i},f.defined=function(e){return arguments.length?(o=e,f):o},f.interpolate=function(e){return arguments.length?(s="function"==typeof e?a=e:(a=ts.get(e)||ns).key,u=a.reverse||a,c=a.closed?"M":"L",f):s},f.tension=function(e){return arguments.length?(l=e,f):l},f}function ys(e){return e.radius}function vs(e){return[e.x,e.y]}function xs(e){return function(){var t=e.apply(this,arguments),n=t[0],r=t[1]-De;return[n*Math.cos(r),n*Math.sin(r)]}}function ws(){return 64}function bs(){return"circle"}function Cs(e){var t=Math.sqrt(e/Ie);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+-t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}o.svg.line.radial=function(){var e=es(gs);return e.radius=e.x,delete e.x,e.angle=e.y,delete e.y,e},is.reverse=os,os.reverse=is,o.svg.area=function(){return ms(O)},o.svg.area.radial=function(){var e=ms(gs);return e.radius=e.x,delete e.x,e.innerRadius=e.x0,delete e.x0,e.outerRadius=e.x1,delete e.x1,e.angle=e.y,delete e.y,e.startAngle=e.y0,delete e.y0,e.endAngle=e.y1,delete e.y1,e},o.svg.chord=function(){var e=Jr,t=Zr,n=ys,r=Ya,i=Xa;function o(n,r){var i,o,c=a(this,e,n,r),l=a(this,t,n,r),f=function(e){return!(Math.abs(1e3*e.p0[0]-1e3*e.p1[0])<1&&Math.abs(1e3*e.p0[1]-1e3*e.p1[1])<1)};return"M"+c.p0+(f(c)?s(c.r,c.p1,c.a1-c.a0):"")+(o=l,(i=c).a0==o.a0&&i.a1==o.a1?u(c.r,c.p1,c.r,c.p0):u(c.r,c.p1,l.r,l.p0)+(f(l)?s(l.r,l.p1,l.a1-l.a0):"")+u(l.r,l.p1,c.r,c.p0))+"Z"}function a(e,t,o,a){var s=t.call(e,o,a),u=n.call(e,s,a),c=r.call(e,s,a)-De,l=i.call(e,s,a)-De;return{r:u,a0:c,a1:l,p0:[u*Math.cos(c),u*Math.sin(c)],p1:[u*Math.cos(l),u*Math.sin(l)]}}function s(e,t,n){return"A"+e+","+e+" 0 "+ +(n>Ie)+",1 "+t}function u(e,t,n,r){return"Q 0,0 "+r}return o.radius=function(e){return arguments.length?(n=Ct(e),o):n},o.source=function(t){return arguments.length?(e=Ct(t),o):e},o.target=function(e){return arguments.length?(t=Ct(e),o):t},o.startAngle=function(e){return arguments.length?(r=Ct(e),o):r},o.endAngle=function(e){return arguments.length?(i=Ct(e),o):i},o},o.svg.diagonal=function(){var e=Jr,t=Zr,n=vs;function r(r,i){var o=e.call(this,r,i),a=t.call(this,r,i),s=(o.y+a.y)/2,u=[o,{x:o.x,y:s},{x:a.x,y:s},a];return"M"+(u=u.map(n))[0]+"C"+u[1]+" "+u[2]+" "+u[3]}return r.source=function(t){return arguments.length?(e=Ct(t),r):e},r.target=function(e){return arguments.length?(t=Ct(e),r):t},r.projection=function(e){return arguments.length?(n=e,r):n},r},o.svg.diagonal.radial=function(){var e=o.svg.diagonal(),t=vs,n=e.projection;return e.projection=function(e){return arguments.length?n(xs(t=e)):t},e},o.svg.symbol=function(){var e=bs,t=ws;function n(n,r){return(Ss.get(e.call(this,n,r))||Cs)(t.call(this,n,r))}return n.type=function(t){return arguments.length?(e=Ct(t),n):e},n.size=function(e){return arguments.length?(t=Ct(e),n):t},n};var Ss=o.map({circle:Cs,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*Ts)),n=t*Ts;return"M0,"+-t+"L"+n+",0 0,"+t+" "+-n+",0Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/Ms),n=t*Ms/2;return"M0,"+n+"L"+t+","+-n+" "+-t+","+-n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/Ms),n=t*Ms/2;return"M0,"+-n+"L"+t+","+n+" "+-t+","+n+"Z"}});o.svg.symbolTypes=Ss.keys();var Ms=Math.sqrt(3),Ts=Math.tan(30*$e);Z.transition=function(e){for(var t,n,r=ks||++Ns,i=$s(e),o=[],a=As||{time:Date.now(),ease:xo,delay:0,duration:250},s=-1,u=this.length;++s<u;){o.push(t=[]);for(var c=this[s],l=-1,f=c.length;++l<f;)(n=c[l])&&Os(n,l,i,r,a),t.push(n)}return Rs(o,i,r)},Z.interrupt=function(e){return this.each(null==e?_s:Es($s(e)))};var _s=Es($s());function Es(e){return function(){var t,n,r;(t=this[e])&&(r=t[n=t.active])&&(r.timer.c=null,r.timer.t=NaN,--t.count?delete t[n]:delete this[e],t.active+=.5,r.event&&r.event.interrupt.call(this,this.__data__,r.index))}}function Rs(e,t,n){return V(e,Is),e.namespace=t,e.id=n,e}var ks,As,Is=[],Ns=0;function Ls(e,t,n,r){var i=e.id,o=e.namespace;return ge(e,"function"==typeof n?function(e,a,s){e[o][i].tween.set(t,r(n.call(e,e.__data__,a,s)))}:(n=r(n),function(e){e[o][i].tween.set(t,n)}))}function Ds(e){return null==e&&(e=""),function(){this.textContent=e}}function $s(e){return null==e?"__transition__":"__transition_"+e+"__"}function Os(e,t,n,r,i){var o,a,s,u,c,l=e[n]||(e[n]={active:0,count:0}),f=l[r];function d(n){var i=l.active,d=l[i];for(var h in d&&(d.timer.c=null,d.timer.t=NaN,--l.count,delete l[i],d.event&&d.event.interrupt.call(e,e.__data__,d.index)),l)if(+h<r){var g=l[h];g.timer.c=null,g.timer.t=NaN,--l.count,delete l[h]}a.c=p,At((function(){return a.c&&p(n||1)&&(a.c=null,a.t=NaN),1}),0,o),l.active=r,f.event&&f.event.start.call(e,e.__data__,t),c=[],f.tween.forEach((function(n,r){(r=r.call(e,e.__data__,t))&&c.push(r)})),u=f.ease,s=f.duration}function p(i){for(var o=i/s,a=u(o),d=c.length;d>0;)c[--d].call(e,a);if(o>=1)return f.event&&f.event.end.call(e,e.__data__,t),--l.count?delete l[r]:delete e[n],1}f||(o=i.time,a=At((function(e){var t=f.delay;if(a.t=t+o,t<=e)return d(e-t);a.c=d}),0,o),f=l[r]={tween:new T,time:o,timer:a,delay:i.delay,duration:i.duration,ease:i.ease,index:t},i=null,++l.count)}Is.call=Z.call,Is.empty=Z.empty,Is.node=Z.node,Is.size=Z.size,o.transition=function(e,t){return e&&e.transition?ks?e.transition(t):e:o.selection().transition(e)},o.transition.prototype=Is,Is.select=function(e){var t,n,r,i=this.id,o=this.namespace,a=[];e=K(e);for(var s=-1,u=this.length;++s<u;){a.push(t=[]);for(var c=this[s],l=-1,f=c.length;++l<f;)(r=c[l])&&(n=e.call(r,r.__data__,l,s))?("__data__"in r&&(n.__data__=r.__data__),Os(n,l,o,i,r[o][i]),t.push(n)):t.push(null)}return Rs(a,o,i)},Is.selectAll=function(e){var t,n,r,i,o,a=this.id,s=this.namespace,u=[];e=ee(e);for(var c=-1,l=this.length;++c<l;)for(var f=this[c],d=-1,p=f.length;++d<p;)if(r=f[d]){o=r[s][a],n=e.call(r,r.__data__,d,c),u.push(t=[]);for(var h=-1,g=n.length;++h<g;)(i=n[h])&&Os(i,h,s,a,o),t.push(i)}return Rs(u,s,a)},Is.filter=function(e){var t,n,r=[];"function"!=typeof e&&(e=pe(e));for(var i=0,o=this.length;i<o;i++){r.push(t=[]);for(var a,s=0,u=(a=this[i]).length;s<u;s++)(n=a[s])&&e.call(n,n.__data__,s,i)&&t.push(n)}return Rs(r,this.namespace,this.id)},Is.tween=function(e,t){var n=this.id,r=this.namespace;return arguments.length<2?this.node()[r][n].tween.get(e):ge(this,null==t?function(t){t[r][n].tween.remove(e)}:function(i){i[r][n].tween.set(e,t)})},Is.attr=function(e,t){if(arguments.length<2){for(t in e)this.attr(t,e[t]);return this}var n="transform"==e?Ao:uo,r=o.ns.qualify(e);function i(){this.removeAttribute(r)}function a(){this.removeAttributeNS(r.space,r.local)}function s(e){return null==e?i:(e+="",function(){var t,i=this.getAttribute(r);return i!==e&&(t=n(i,e),function(e){this.setAttribute(r,t(e))})})}function u(e){return null==e?a:(e+="",function(){var t,i=this.getAttributeNS(r.space,r.local);return i!==e&&(t=n(i,e),function(e){this.setAttributeNS(r.space,r.local,t(e))})})}return Ls(this,"attr."+e,t,r.local?u:s)},Is.attrTween=function(e,t){var n=o.ns.qualify(e);return this.tween("attr."+e,n.local?function(e,r){var i=t.call(this,e,r,this.getAttributeNS(n.space,n.local));return i&&function(e){this.setAttributeNS(n.space,n.local,i(e))}}:function(e,r){var i=t.call(this,e,r,this.getAttribute(n));return i&&function(e){this.setAttribute(n,i(e))}})},Is.style=function(e,t,n){var r=arguments.length;if(r<3){if("string"!=typeof e){for(n in r<2&&(t=""),e)this.style(n,e[n],t);return this}n=""}function i(){this.style.removeProperty(e)}function o(t){return null==t?i:(t+="",function(){var r,i=l(this).getComputedStyle(this,null).getPropertyValue(e);return i!==t&&(r=uo(i,t),function(t){this.style.setProperty(e,r(t),n)})})}return Ls(this,"style."+e,t,o)},Is.styleTween=function(e,t,n){function r(r,i){var o=t.call(this,r,i,l(this).getComputedStyle(this,null).getPropertyValue(e));return o&&function(t){this.style.setProperty(e,o(t),n)}}return arguments.length<3&&(n=""),this.tween("style."+e,r)},Is.text=function(e){return Ls(this,"text",e,Ds)},Is.remove=function(){var e=this.namespace;return this.each("end.transition",(function(){var t;this[e].count<2&&(t=this.parentNode)&&t.removeChild(this)}))},Is.ease=function(e){var t=this.id,n=this.namespace;return arguments.length<1?this.node()[n][t].ease:("function"!=typeof e&&(e=o.ease.apply(o,arguments)),ge(this,(function(r){r[n][t].ease=e})))},Is.delay=function(e){var t=this.id,n=this.namespace;return arguments.length<1?this.node()[n][t].delay:ge(this,"function"==typeof e?function(r,i,o){r[n][t].delay=+e.call(r,r.__data__,i,o)}:(e=+e,function(r){r[n][t].delay=e}))},Is.duration=function(e){var t=this.id,n=this.namespace;return arguments.length<1?this.node()[n][t].duration:ge(this,"function"==typeof e?function(r,i,o){r[n][t].duration=Math.max(1,e.call(r,r.__data__,i,o))}:(e=Math.max(1,e),function(r){r[n][t].duration=e}))},Is.each=function(e,t){var n=this.id,r=this.namespace;if(arguments.length<2){var i=As,a=ks;try{ks=n,ge(this,(function(t,i,o){As=t[r][n],e.call(t,t.__data__,i,o)}))}finally{As=i,ks=a}}else ge(this,(function(i){var a=i[r][n];(a.event||(a.event=o.dispatch("start","end","interrupt"))).on(e,t)}));return this},Is.transition=function(){for(var e,t,n,r=this.id,i=++Ns,o=this.namespace,a=[],s=0,u=this.length;s<u;s++){a.push(e=[]);for(var c,l=0,f=(c=this[s]).length;l<f;l++)(t=c[l])&&Os(t,l,o,i,{time:(n=t[o][r]).time,ease:n.ease,delay:n.delay+n.duration,duration:n.duration}),e.push(t)}return Rs(a,o,i)},o.svg.axis=function(){var e,t=o.scale.linear(),n=Ps,r=6,i=6,a=3,u=[10],c=null;function l(s){s.each((function(){var s,l=o.select(this),f=this.__chart__||t,d=this.__chart__=t.copy(),p=null==c?d.ticks?d.ticks.apply(d,u):d.domain():c,h=null==e?d.tickFormat?d.tickFormat.apply(d,u):O:e,g=l.selectAll(".tick").data(p,d),m=g.enter().insert("g",".domain").attr("class","tick").style("opacity",ke),y=o.transition(g.exit()).style("opacity",ke).remove(),v=o.transition(g.order()).style("opacity",1),x=Math.max(r,0)+a,w=Ta(d),b=l.selectAll(".domain").data([0]),C=(b.enter().append("path").attr("class","domain"),o.transition(b));m.append("line"),m.append("text");var S,M,T,_,E=m.select("line"),R=v.select("line"),k=g.select("text").text(h),A=m.select("text"),I=v.select("text"),N="top"===n||"left"===n?-1:1;if("bottom"===n||"top"===n?(s=zs,S="x",T="y",M="x2",_="y2",k.attr("dy",N<0?"0em":".71em").style("text-anchor","middle"),C.attr("d","M"+w[0]+","+N*i+"V0H"+w[1]+"V"+N*i)):(s=Us,S="y",T="x",M="y2",_="x2",k.attr("dy",".32em").style("text-anchor",N<0?"end":"start"),C.attr("d","M"+N*i+","+w[0]+"H0V"+w[1]+"H"+N*i)),E.attr(_,N*r),A.attr(T,N*x),R.attr(M,0).attr(_,N*r),I.attr(S,0).attr(T,N*x),d.rangeBand){var L=d,D=L.rangeBand()/2;f=d=function(e){return L(e)+D}}else f.rangeBand?f=d:y.call(s,d,f);m.call(s,f,d),v.call(s,d,d)}))}return l.scale=function(e){return arguments.length?(t=e,l):t},l.orient=function(e){return arguments.length?(n=e in qs?e+"":Ps,l):n},l.ticks=function(){return arguments.length?(u=s(arguments),l):u},l.tickValues=function(e){return arguments.length?(c=e,l):c},l.tickFormat=function(t){return arguments.length?(e=t,l):e},l.tickSize=function(e){var t=arguments.length;return t?(r=+e,i=+arguments[t-1],l):r},l.innerTickSize=function(e){return arguments.length?(r=+e,l):r},l.outerTickSize=function(e){return arguments.length?(i=+e,l):i},l.tickPadding=function(e){return arguments.length?(a=+e,l):a},l.tickSubdivide=function(){return arguments.length&&l},l};var Ps="bottom",qs={top:1,right:1,bottom:1,left:1};function zs(e,t,n){e.attr("transform",(function(e){var r=t(e);return"translate("+(isFinite(r)?r:n(e))+",0)"}))}function Us(e,t,n){e.attr("transform",(function(e){var r=t(e);return"translate(0,"+(isFinite(r)?r:n(e))+")"}))}o.svg.brush=function(){var e,t,n=G(d,"brushstart","brush","brushend"),r=null,i=null,a=[0,0],s=[0,0],u=!0,c=!0,f=Qs[0];function d(e){e.each((function(){var e=o.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",m).on("touchstart.brush",m),t=e.selectAll(".background").data([0]);t.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),e.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var n=e.selectAll(".resize").data(f,O);n.exit().remove(),n.enter().append("g").attr("class",(function(e){return"resize "+e})).style("cursor",(function(e){return js[e]})).append("rect").attr("x",(function(e){return/[ew]$/.test(e)?-3:null})).attr("y",(function(e){return/^[ns]/.test(e)?-3:null})).attr("width",6).attr("height",6).style("visibility","hidden"),n.style("display",d.empty()?"none":null);var a,s=o.transition(e),u=o.transition(t);r&&(a=Ta(r),u.attr("x",a[0]).attr("width",a[1]-a[0]),h(s)),i&&(a=Ta(i),u.attr("y",a[0]).attr("height",a[1]-a[0]),g(s)),p(s)}))}function p(e){e.selectAll(".resize").attr("transform",(function(e){return"translate("+a[+/e$/.test(e)]+","+s[+/^s/.test(e)]+")"}))}function h(e){e.select(".extent").attr("x",a[0]),e.selectAll(".extent,.n>rect,.s>rect").attr("width",a[1]-a[0])}function g(e){e.select(".extent").attr("y",s[0]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function m(){var f,m,y=this,v=o.select(o.event.target),x=n.of(y,arguments),w=o.select(y),b=v.datum(),C=!/^(n|s)$/.test(b)&&r,S=!/^(e|w)$/.test(b)&&i,M=v.classed("extent"),T=Te(y),_=o.mouse(y),E=o.select(l(y)).on("keydown.brush",(function(){32==o.event.keyCode&&(M||(f=null,_[0]-=a[1],_[1]-=s[1],M=2),F())})).on("keyup.brush",(function(){32==o.event.keyCode&&2==M&&(_[0]+=a[1],_[1]+=s[1],M=0,F())}));if(o.event.changedTouches?E.on("touchmove.brush",A).on("touchend.brush",N):E.on("mousemove.brush",A).on("mouseup.brush",N),w.interrupt().selectAll("*").interrupt(),M)_[0]=a[0]-_[0],_[1]=s[0]-_[1];else if(b){var R=+/w$/.test(b),k=+/^n/.test(b);m=[a[1-R]-_[0],s[1-k]-_[1]],_[0]=a[R],_[1]=s[k]}else o.event.altKey&&(f=_.slice());function A(){var e=o.mouse(y),t=!1;m&&(e[0]+=m[0],e[1]+=m[1]),M||(o.event.altKey?(f||(f=[(a[0]+a[1])/2,(s[0]+s[1])/2]),_[0]=a[+(e[0]<f[0])],_[1]=s[+(e[1]<f[1])]):f=null),C&&I(e,r,0)&&(h(w),t=!0),S&&I(e,i,1)&&(g(w),t=!0),t&&(p(w),x({type:"brush",mode:M?"move":"resize"}))}function I(n,r,i){var o,l,d=Ta(r),p=d[0],h=d[1],g=_[i],m=i?s:a,y=m[1]-m[0];if(M&&(p-=g,h-=y+g),o=(i?c:u)?Math.max(p,Math.min(h,n[i])):n[i],M?l=(o+=g)+y:(f&&(g=Math.max(p,Math.min(h,2*f[i]-o))),g<o?(l=o,o=g):l=g),m[0]!=o||m[1]!=l)return i?t=null:e=null,m[0]=o,m[1]=l,!0}function N(){A(),w.style("pointer-events","all").selectAll(".resize").style("display",d.empty()?"none":null),o.select("body").style("cursor",null),E.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),T(),x({type:"brushend"})}w.style("pointer-events","none").selectAll(".resize").style("display",null),o.select("body").style("cursor",v.style("cursor")),x({type:"brushstart"}),A()}return d.event=function(r){r.each((function(){var r=n.of(this,arguments),i={x:a,y:s,i:e,j:t},u=this.__chart__||i;this.__chart__=i,ks?o.select(this).transition().each("start.brush",(function(){e=u.i,t=u.j,a=u.x,s=u.y,r({type:"brushstart"})})).tween("brush:brush",(function(){var n=co(a,i.x),o=co(s,i.y);return e=t=null,function(e){a=i.x=n(e),s=i.y=o(e),r({type:"brush",mode:"resize"})}})).each("end.brush",(function(){e=i.i,t=i.j,r({type:"brush",mode:"resize"}),r({type:"brushend"})})):(r({type:"brushstart"}),r({type:"brush",mode:"resize"}),r({type:"brushend"}))}))},d.x=function(e){return arguments.length?(f=Qs[!(r=e)<<1|!i],d):r},d.y=function(e){return arguments.length?(f=Qs[!r<<1|!(i=e)],d):i},d.clamp=function(e){return arguments.length?(r&&i?(u=!!e[0],c=!!e[1]):r?u=!!e:i&&(c=!!e),d):r&&i?[u,c]:r?u:i?c:null},d.extent=function(n){var o,u,c,l,f;return arguments.length?(r&&(o=n[0],u=n[1],i&&(o=o[0],u=u[0]),e=[o,u],r.invert&&(o=r(o),u=r(u)),u<o&&(f=o,o=u,u=f),o==a[0]&&u==a[1]||(a=[o,u])),i&&(c=n[0],l=n[1],r&&(c=c[1],l=l[1]),t=[c,l],i.invert&&(c=i(c),l=i(l)),l<c&&(f=c,c=l,l=f),c==s[0]&&l==s[1]||(s=[c,l])),d):(r&&(e?(o=e[0],u=e[1]):(o=a[0],u=a[1],r.invert&&(o=r.invert(o),u=r.invert(u)),u<o&&(f=o,o=u,u=f))),i&&(t?(c=t[0],l=t[1]):(c=s[0],l=s[1],i.invert&&(c=i.invert(c),l=i.invert(l)),l<c&&(f=c,c=l,l=f))),r&&i?[[o,c],[u,l]]:r?[o,u]:i&&[c,l])},d.clear=function(){return d.empty()||(a=[0,0],s=[0,0],e=t=null),d},d.empty=function(){return!!r&&a[0]==a[1]||!!i&&s[0]==s[1]},o.rebind(d,n,"on")};var js={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Qs=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Fs=Ut.format=mn.timeFormat,Hs=Fs.utc,Gs=Hs("%Y-%m-%dT%H:%M:%S.%LZ");function Bs(e){return e.toISOString()}function Vs(e,t,n){function r(t){return e(t)}function i(e,n){var r=(e[1]-e[0])/n,i=o.bisect(Ys,r);return i==Ys.length?[t.year,La(e.map((function(e){return e/31536e6})),n)[2]]:i?t[r/Ys[i-1]<Ys[i]/r?i-1:i]:[Zs,La(e,n)[2]]}return r.invert=function(t){return Ws(e.invert(t))},r.domain=function(t){return arguments.length?(e.domain(t),r):e.domain().map(Ws)},r.nice=function(e,t){var n=r.domain(),o=Ma(n),a=null==e?i(o,10):"number"==typeof e&&i(o,e);function s(n){return!isNaN(n)&&!e.range(n,Ws(+n+1),t).length}return a&&(e=a[0],t=a[1]),r.domain(Ea(n,t>1?{floor:function(t){for(;s(t=e.floor(t));)t=Ws(t-1);return t},ceil:function(t){for(;s(t=e.ceil(t));)t=Ws(+t+1);return t}}:e))},r.ticks=function(e,t){var n=Ma(r.domain()),o=null==e?i(n,10):"number"==typeof e?i(n,e):!e.range&&[{range:e},t];return o&&(e=o[0],t=o[1]),e.range(n[0],Ws(+n[1]+1),t<1?1:t)},r.tickFormat=function(){return n},r.copy=function(){return Vs(e.copy(),t,n)},Ia(r,e)}function Ws(e){return new Date(e)}Fs.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Bs:Gs,Bs.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Bs.toString=Gs.toString,Ut.second=Ht((function(e){return new jt(1e3*Math.floor(e/1e3))}),(function(e,t){e.setTime(e.getTime()+1e3*Math.floor(t))}),(function(e){return e.getSeconds()})),Ut.seconds=Ut.second.range,Ut.seconds.utc=Ut.second.utc.range,Ut.minute=Ht((function(e){return new jt(6e4*Math.floor(e/6e4))}),(function(e,t){e.setTime(e.getTime()+6e4*Math.floor(t))}),(function(e){return e.getMinutes()})),Ut.minutes=Ut.minute.range,Ut.minutes.utc=Ut.minute.utc.range,Ut.hour=Ht((function(e){var t=e.getTimezoneOffset()/60;return new jt(36e5*(Math.floor(e/36e5-t)+t))}),(function(e,t){e.setTime(e.getTime()+36e5*Math.floor(t))}),(function(e){return e.getHours()})),Ut.hours=Ut.hour.range,Ut.hours.utc=Ut.hour.utc.range,Ut.month=Ht((function(e){return(e=Ut.day(e)).setDate(1),e}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e){return e.getMonth()})),Ut.months=Ut.month.range,Ut.months.utc=Ut.month.utc.range;var Ys=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Xs=[[Ut.second,1],[Ut.second,5],[Ut.second,15],[Ut.second,30],[Ut.minute,1],[Ut.minute,5],[Ut.minute,15],[Ut.minute,30],[Ut.hour,1],[Ut.hour,3],[Ut.hour,6],[Ut.hour,12],[Ut.day,1],[Ut.day,2],[Ut.week,1],[Ut.month,1],[Ut.month,3],[Ut.year,1]],Js=Fs.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%a %d",function(e){return e.getDay()&&1!=e.getDate()}],["%b %d",function(e){return 1!=e.getDate()}],["%B",function(e){return e.getMonth()}],["%Y",tr]]),Zs={range:function(e,t,n){return o.range(Math.ceil(e/n)*n,+t,n).map(Ws)},floor:O,ceil:O};Xs.year=Ut.year,Ut.scale=function(){return Vs(o.scale.linear(),Xs,Js)};var Ks=Xs.map((function(e){return[e[0].utc,e[1]]})),eu=Hs.multi([[".%L",function(e){return e.getUTCMilliseconds()}],[":%S",function(e){return e.getUTCSeconds()}],["%I:%M",function(e){return e.getUTCMinutes()}],["%I %p",function(e){return e.getUTCHours()}],["%a %d",function(e){return e.getUTCDay()&&1!=e.getUTCDate()}],["%b %d",function(e){return 1!=e.getUTCDate()}],["%B",function(e){return e.getUTCMonth()}],["%Y",tr]]);function tu(e){return JSON.parse(e.responseText)}function nu(e){var t=u.createRange();return t.selectNode(u.body),t.createContextualFragment(e.responseText)}Ks.year=Ut.year.utc,Ut.scale.utc=function(){return Vs(o.scale.linear(),Ks,eu)},o.text=St((function(e){return e.responseText})),o.json=function(e,t){return Mt(e,"application/json",tu,t)},o.html=function(e,t){return Mt(e,"text/html",nu,t)},o.xml=St((function(e){return e.responseXML})),this.d3=o,void 0===(i="function"==typeof(r=o)?r.call(t,n,t,e):r)||(e.exports=i)}()},215:function(e,t,n){"use strict";var r=r||{};r.SingleChild={addPlaceholders:function e(t,n){if(t.children){for(var r=0;r<t.children.length;r++)e(t.children[r]);if(1===t.children.length){var i=1.2*t.size;n&&(i=.1*t.children[0].size),t.children.push({name:"placeholder",size:i})}}},removePlaceholders:function e(t){for(var n=t.length-1;n>=0;n--){var r=t[n];"placeholder"===r.name?t.splice(n,1):r.children&&e(r.children)}},centerNodes:function(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.children&&1===n.children.length){var r=n.x-n.children[0].x;n.children[0].x+=r,i(n.children[0],r)}}function i(e,t){if(e.children)for(var n=0;n<e.children.length;n++)e.children[n].x+=t,i(e.children[n],t)}},makePositionsRelativeToZero:function(e){for(var t=e[0].x,n=e[0].y,r=0;r<e.length;r++){var i=e[r];i.x-=t,i.y-=n}}},t.a=r},226:function(e,t){
2
2
  /*! Copyright (c) 2014 Hidenari Nozaki and contributors | Licensed under the MIT license */
3
- !function(e,t){"use strict";!function(e){e.module("angucomplete-alt",[]).directive("angucompleteAlt",["$q","$parse","$http","$sce","$timeout","$templateCache","$interpolate",function(e,t,n,r,i,o,a){var s=40,u=39,c=38,l=37,f=27,d=13,p=9,h=3,g=524288,m=500,y=200,v="autocomplete-required",x="Searching...",w="No results found";function b(t,o,a,b){var C,S,M,T,_,E,R=o.find("input"),k=h,A=null,I=v,N=null,L=null,D=o[0].querySelector(".angucomplete-dropdown"),$=!1,O=null;function P(e,n){e&&("object"==typeof e?(t.searchStr=j(e),U({originalObject:e})):"string"==typeof e&&e.length>0?t.searchStr=e:console&&console.error&&console.error("Tried to set "+(n?"initial":"")+" value of angucomplete to",e,"which is an invalid value"),H(!0))}function q(e){O=null,t.hideResults(e),document.body.removeEventListener("click",q)}function z(e){return e.which?e.which:e.keyCode}function U(e){"function"==typeof t.selectedObject?t.selectedObject(e,t.selectedObjectData):t.selectedObject=e,H(!!e)}function j(e){return t.titleField.split(",").map((function(t){return Q(e,t)})).join(" ")}function Q(e,t){var n,r;if(t){n=t.split("."),r=e;for(var i=0;i<n.length;i++)r=r[n[i]]}else r=e;return r}function F(e,n){var i,o,a;if(a=new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"i"),e)return e.match&&e.replace||(e=e.toString()),i=(o=e.match(a))?e.replace(a,'<span class="'+t.matchClass+'">'+o[0]+"</span>"):e,r.trustAsHtml(i)}function H(e){t.notEmpty=e,N=t.searchStr,t.fieldRequired&&b&&t.inputName&&b[t.inputName].$setValidity(I,e)}function G(e){!t.overrideSuggestions||t.selectedObject&&t.selectedObject.originalObject===t.searchStr||(e&&e.preventDefault(),i.cancel(A),J(),U({originalObject:t.searchStr}),t.clearSelected&&(t.searchStr=null),ee())}function B(){return o[0].querySelectorAll(".angucomplete-row")[t.currentIndex]}function V(e){D.scrollTop=D.scrollTop+e}function W(){var e=t.results[t.currentIndex];t.matchClass?R.val(j(e.originalObject)):R.val(e.title)}function Y(e){return function(n,r,i,o){r||i||o||!n.data||(n=n.data),t.searching=!1,re(Q(S(n),t.remoteUrlDataField),e)}}function X(e,n,r,i){t.searching=!1,0!==n&&-1!==n&&(n||r||i||(n=e.status),t.remoteUrlErrorCallback?t.remoteUrlErrorCallback(e,n,r,i):console&&console.error&&console.error("http error"))}function J(){L&&L.resolve()}function Z(r){var i={},o=t.remoteUrl+encodeURIComponent(r);t.remoteUrlRequestFormatter&&(i={params:t.remoteUrlRequestFormatter(r)},o=t.remoteUrl),t.remoteUrlRequestWithCredentials&&(i.withCredentials=!0),J(),L=e.defer(),i.timeout=L.promise,n.get(o,i).success(Y(r)).error(X)}function K(n){J(),L=e.defer(),t.remoteApiHandler(n,L.promise).then(Y(n)).catch(X)}function ee(){t.showDropdown=!1,t.results=[],D&&(D.scrollTop=0)}function te(){t.showDropdown=T,t.currentIndex=t.focusFirst?0:-1,t.results=[]}function ne(e){!e||e.length<k||(t.localData?t.$apply((function(){var n;n=void 0!==t.localSearch()?t.localSearch()(e,t.localData):function(e){var n,r,i,o,a=t.searchFields.split(","),s=[];for(void 0!==t.parseInput()&&(e=t.parseInput()(e)),n=0;n<t.localData.length;n++){for(r=!1,i=0;i<a.length;i++)o=Q(t.localData[n],a[i])||"",r=r||o.toString().toLowerCase().indexOf(e.toString().toLowerCase())>=0;r&&(s[s.length]=t.localData[n])}return s}(e),t.searching=!1,re(n,e)})):t.remoteApiHandler?K(e):Z(e))}function re(e,n){var r,i,o,a,s,u;if(e&&e.length>0)for(t.results=[],r=0;r<e.length;r++)t.titleField&&""!==t.titleField&&(a=s=j(e[r])),i="",t.descriptionField&&(i=u=Q(e[r],t.descriptionField)),o="",t.imageField&&(o=Q(e[r],t.imageField)),t.matchClass&&(s=F(a,n),u=F(i,n)),t.results[t.results.length]={title:s,description:u,image:o,originalObject:e[r]};else t.results=[];t.autoMatch&&1===t.results.length&&function(e,n,r){if(!r)return!1;for(var i in n)if(n[i].toLowerCase()===r.toLowerCase())return t.selectResult(e),!0;return!1}(t.results[0],{title:a,desc:i||""},t.searchStr)?t.showDropdown=!1:0!==t.results.length||_?t.showDropdown=!0:t.showDropdown=!1}function ie(){t.localData?re(t.localData,""):t.remoteApiHandler?K(""):Z("")}o.on("mousedown",(function(e){e.target.id?(O=e.target.id)===t.id+"_dropdown"&&document.body.addEventListener("click",q):O=e.target.className})),t.currentIndex=t.focusFirst?0:null,t.searching=!1,M=t.$watch("initialValue",(function(e){e&&(M(),P(e,!0))})),t.$watch("fieldRequired",(function(e,n){e!==n&&(e?N&&-1!==t.currentIndex?H(!0):H(!1):b[t.inputName].$setValidity(I,!0))})),t.$on("angucomplete-alt:clearInput",(function(e,n){n&&n!==t.id||(t.searchStr=null,U(),H(!1),ee())})),t.$on("angucomplete-alt:changeInput",(function(e,n,r){n&&n===t.id&&P(r)})),t.onFocusHandler=function(){t.focusIn&&t.focusIn(),0!==k||t.searchStr&&0!==t.searchStr.length||(t.currentIndex=t.focusFirst?0:t.currentIndex,t.showDropdown=!0,ie())},t.hideResults=function(){O&&(O===t.id+"_dropdown"||O.indexOf("angucomplete")>=0)?O=null:(C=i((function(){ee(),t.$apply((function(){t.searchStr&&t.searchStr.length>0&&R.val(t.searchStr)}))}),y),J(),t.focusOut&&t.focusOut(),t.overrideSuggestions&&t.searchStr&&t.searchStr.length>0&&-1===t.currentIndex&&G())},t.resetHideResults=function(){C&&i.cancel(C)},t.hoverRow=function(e){t.currentIndex=e},t.selectResult=function(e){t.matchClass&&(e.title=j(e.originalObject),e.description=Q(e.originalObject,t.descriptionField)),t.clearSelected?t.searchStr=null:t.searchStr=e.title,U(e),ee()},t.inputChangeHandler=function(e){return e.length<k?(J(),ee()):0===e.length&&0===k&&(t.searching=!1,ie()),t.inputChanged&&(e=t.inputChanged(e)),e},t.fieldRequiredClass&&""!==t.fieldRequiredClass&&(I=t.fieldRequiredClass),t.minlength&&""!==t.minlength&&(k=parseInt(t.minlength,10)),t.pause||(t.pause=m),t.clearSelected||(t.clearSelected=!1),t.overrideSuggestions||(t.overrideSuggestions=!1),t.fieldRequired&&b&&(t.initialValue?H(!0):H(!1)),t.inputType=a.type?a.type:"text",t.textSearching=a.textSearching?a.textSearching:x,t.textNoResults=a.textNoResults?a.textNoResults:w,T="false"!==t.textSearching,_="false"!==t.textNoResults,t.maxlength=a.maxlength?a.maxlength:g,R.on("keydown",(function(e){var n=z(e),r=null,i=null;n===d&&t.results?(t.currentIndex>=0&&t.currentIndex<t.results.length?(e.preventDefault(),t.selectResult(t.results[t.currentIndex])):(G(e),ee()),t.$apply()):n===s&&t.results?(e.preventDefault(),t.currentIndex+1<t.results.length&&t.showDropdown&&(t.$apply((function(){t.currentIndex++,W()})),$&&(r=B(),D.getBoundingClientRect().top+parseInt(getComputedStyle(D).maxHeight,10)<r.getBoundingClientRect().bottom&&V(function(e){var t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,10)+parseInt(t.marginBottom,10)}(r))))):n===c&&t.results?(e.preventDefault(),t.currentIndex>=1?(t.$apply((function(){t.currentIndex--,W()})),$&&(i=B().getBoundingClientRect().top-(D.getBoundingClientRect().top+parseInt(getComputedStyle(D).paddingTop,10)))<0&&V(i-1)):0===t.currentIndex&&t.$apply((function(){t.currentIndex=-1,R.val(t.searchStr)}))):n===p?t.results&&t.results.length>0&&t.showDropdown?-1===t.currentIndex&&t.overrideSuggestions?G():(-1===t.currentIndex&&(t.currentIndex=0),t.selectResult(t.results[t.currentIndex]),t.$digest()):t.searchStr&&t.searchStr.length>0&&G():n===f&&e.preventDefault()})),R.on("keyup",(function(e){var n=z(e);if(n!==l&&n!==u)if(n===c||n===d)e.preventDefault();else if(n===s)e.preventDefault(),!t.showDropdown&&t.searchStr&&t.searchStr.length>=k&&(te(),t.searching=!0,ne(t.searchStr));else if(n===f)ee(),t.$apply((function(){R.val(t.searchStr)}));else{if(0===k&&!t.searchStr)return;t.searchStr&&""!==t.searchStr?t.searchStr.length>=k&&(te(),A&&i.cancel(A),t.searching=!0,A=i((function(){ne(t.searchStr)}),t.pause)):t.showDropdown=!1,N&&N!==t.searchStr&&!t.clearSelected&&t.$apply((function(){U()}))}})),E="remoteUrlResponseFormatter",S=function(e){return t[E]?t[E](e):e},i((function(){var e=getComputedStyle(D);$=e.maxHeight&&"auto"===e.overflowY}))}return(o.put("/angucomplete-alt/index.html",'<div class="angucomplete-holder" ng-class="{\'angucomplete-dropdown-visible\': showDropdown}"> <input id="{{id}}_value" name="{{inputName}}" tabindex="{{fieldTabindex}}" ng-class="{\'angucomplete-input-not-empty\': notEmpty}" ng-model="searchStr" ng-disabled="disableInput" type="{{inputType}}" placeholder="{{placeholder}}" maxlength="{{maxlength}}" ng-focus="onFocusHandler()" class="{{inputClass}}" ng-focus="resetHideResults()" ng-blur="hideResults($event)" autocapitalize="off" autocorrect="off" autocomplete="off" ng-change="inputChangeHandler(searchStr)"/> <div id="{{id}}_dropdown" class="angucomplete-dropdown" ng-show="showDropdown"> <div class="angucomplete-searching" ng-show="searching" ng-bind="textSearching"></div> <div class="angucomplete-searching" ng-show="!searching && (!results || results.length == 0)" ng-bind="textNoResults"></div> <div class="angucomplete-row" ng-repeat="result in results" ng-click="selectResult(result)" ng-mouseenter="hoverRow($index)" ng-class="{\'angucomplete-selected-row\': $index == currentIndex}"> <div ng-if="imageField" class="angucomplete-image-holder"> <img ng-if="result.image && result.image != \'\'" ng-src="{{result.image}}" class="angucomplete-image"/> <div ng-if="!result.image && result.image != \'\'" class="angucomplete-image-default"></div> </div> <div class="angucomplete-title" ng-if="matchClass" ng-bind-html="result.title"></div> <div class="angucomplete-title" ng-if="!matchClass">{{ result.title }}</div> <div ng-if="matchClass && result.description && result.description != \'\'" class="angucomplete-description" ng-bind-html="result.description"></div> <div ng-if="!matchClass && result.description && result.description != \'\'" class="angucomplete-description">{{result.description}}</div> </div> </div></div>'),{restrict:"EA",require:"^?form",scope:{selectedObject:"=",selectedObjectData:"=",disableInput:"=",initialValue:"=",localData:"=",localSearch:"&",remoteUrlRequestFormatter:"=",remoteUrlRequestWithCredentials:"@",remoteUrlResponseFormatter:"=",remoteUrlErrorCallback:"=",remoteApiHandler:"=",id:"@",type:"@",placeholder:"@",textSearching:"@",textNoResults:"@",remoteUrl:"@",remoteUrlDataField:"@",titleField:"@",descriptionField:"@",imageField:"@",inputClass:"@",pause:"@",searchFields:"@",minlength:"@",matchClass:"@",clearSelected:"@",overrideSuggestions:"@",fieldRequired:"=",fieldRequiredClass:"@",inputChanged:"=",autoMatch:"@",focusOut:"&",focusIn:"&",fieldTabindex:"@",inputName:"@",focusFirst:"@",parseInput:"&"},templateUrl:function(e,t){return t.templateUrl||"/angucomplete-alt/index.html"},compile:function(e){var t=a.startSymbol(),n=a.endSymbol();if("{{"!==t||"}}"!==n){var r=e.html().replace(/\{\{/g,t).replace(/\}\}/g,n);e.html(r)}return b}})}])}(window.angular)}()},29:function(e,t){angular.module("graphdb.framework.rest.connectors.service",[]).factory("ConnectorsRestService",r),r.$inject=["$http"];const n="rest/connectors";function r(e){return{getConnectors:function(){return e.get(n)},initConnector:function(t){return e.get(`${n}/options?prefix=${t}`)},hasConnector:function(t){return e.get(`${n}/existing?prefix=${t}`)},checkConnector:function(t){return e.post(`${n}/check`,t,{headers:{"Content-Type":"text/plain"}})}}}},31:function(e,t){function n(e){return{showToastMessageWithDelay:function(t){return new Promise(n=>{e.success(t),setTimeout(n,200)})}}}angular.module("graphdb.framework.utils.notifications",[]).factory("Notifications",n),n.$inject=["toastr"]},32:function(e,t,n){"use strict";n.r(t);n(10),n(29);function r(e){const t=[];return Object.keys(e).forEach((function(n){t.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]))})),t.join("&")}function i(e,t){for(let r=0;r<t.length;r++){const i=t[r];if("StringArray"===i.__type)e[i.__name]||(e[i.__name]=[""]);else if("OptionArray"===i.__type)if(e[i.__name])for(let t=0;t<i.__childOptions.length;t++){const n=i.__childOptions[t];if("Boolean"===n.__type)for(let t=0;t<e[i.__name].length;t++){const r=e[i.__name][t];!r.hasOwnProperty([n.__name])&&angular.isDefined(n.__defaultValue)&&(r[n.__name]=n.__defaultValue)}}else{e[i.__name]=[];const t={};for(let e=0;e<i.__childOptions.length;e++){const n=i.__childOptions[e];"StringArray"===n.__type?t[n.__name]=[""]:t[n.__name]=angular.isUndefined(n.__defaultValue)?"":n.__defaultValue}e[i.__name].push(t)}else"Map"===i.__type?e[i.__name]?e[i.__name]=(n=e[i.__name],_.map(n,(function(e,t){return{key:t,value:e}}))):e[i.__name]=[]:"JsonString"===i.__type?!e[i.__name]||e[i.__name]instanceof String||"string"==typeof e[i.__name]||(e[i.__name]=angular.toJson(e[i.__name],2)):angular.isUndefined(e[i.__name])&&(e[i.__name]=angular.isUndefined(i.__defaultValue)?"":i.__defaultValue)}var n;return e}function o(e,t,n){return e.post("repositories/"+t,r({query:n}),{headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/sparql-results+json","X-GraphDB-Local-Consistency":"updating"}})}function a(e){return e.substring(0,e.length-1)+"/instance#"}function s(e,t,n,r,i){const o=function e(t,n){const r={};return _.each(n,(function(n){angular.isDefined(t[n.__name])&&("OptionArray"===n.__type?(r[n.__name]=[],_.each(t[n.__name],(function(t){r[n.__name].push(e(t,n.__childOptions))}))):r[n.__name]=angular.copy(t[n.__name]))})),r}(n,r);for(let e=0;e<r.length;e++)try{"Map"===r[e].__type?o[r[e].__name]=(s=o[r[e].__name],_.reduce(s,(function(e,t){if(""===t.key&&""===t.value);else{if(""===t.key)throw new Error('Key may not be empty with value "'+t.value+'"');if(e.hasOwnProperty(t.key))throw new Error("Duplicate key "+t.key);e[t.key]=t.value}return e}),{})):"JsonString"===r[e].__type&&(o[r[e].__name]=angular.fromJson(o[r[e].__name]))}catch(t){return i(r[e].__label,t.message),null}var s;!function e(t){Array.isArray(t)&&(t=_.filter(t,(function(e){return null!==e&&(!e.trim||""!==e.trim())})));return Object.keys(t).forEach((function(n){""!==t[n]&&null!=t[n]||!1===t[n]?"object"==typeof t[n]&&(t[n]=e(t[n])):delete t[n]})),t}(o);let u="";return u+="PREFIX :<"+t+">\n",u+="PREFIX inst:<"+a(t)+">\n",u+="INSERT DATA {\n",u+="\tinst:"+e+" :createConnector '''\n",u+=angular.toJson(o,2),u+="\n''' .\n}\n",u=u.replace(/\\/g,"\\\\\\"),u}function u(e,t,n,u,c,l,f,d,p){function h(t){e.beingBuiltConnector={percentDone:0,status:{processedEntities:0,estimatedEntities:0,indexedEntities:0,entitiesPerSecond:0},actionName:t?"Repairing":"Creating",waitOnRepairStartOnce:!!t,eta:"-",inline:!1,iri:null}}function g(t,n,r){return h(r),$.extend(e.beingBuiltConnector,{iri:a(t)+n,name:n,inline:!1,doneCallback:function(){e.beingBuiltConnector.modalInstance.dismiss("cancel")}}),e.beingBuiltConnector.modalInstance=u.open({templateUrl:"pages/connectorProgress.html",controller:"CreateProgressCtrl",size:"lg",backdrop:"static",scope:e}),e.beingBuiltConnector.modalInstance}function m(t,i,o){const a=g(t.value,i.name,!1);d.addStatements(n.getActiveRepository(),r({update:i.query})).then((function(){p.getConnectors().then((function(){p.hasConnector(encodeURIComponent(t.value)).then((function(n){e.existing[t.key]=n.data}))})),c.success("Created connector "+i.name)}),(function(e){c.error(getError(e)),o()})).finally((function(){a.dismiss("cancel")}))}e.loader=!1,e.controllers=[],e.existing={},e.definitions={},e.getLoaderMessage=function(){const t=(Date.now()-e.loaderStartTime)/1e3,n=e.getHumanReadableSeconds(t);let r="";return r=e.progressMessage?e.progressMessage+"... "+n:"Running operation..."+n,e.extraMessage&&t>10&&(r+="\n"+e.extraMessage),r},e.setLoader=function(t,n,r){t?(e.loader=!0,e.loaderStartTime=Date.now(),e.progressMessage=n,e.extraMessage=r):(e.loader=!1,e.progressMessage="",e.extraMessage="")},e.initConnector=function(t){return p.initConnector(encodeURIComponent(t.value)).then((function(n){return e.definitions[t.key]=n.data,p.hasConnector(encodeURIComponent(t.value)).then((function(n){e.existing[t.key]=n.data}))}))},e.getConnectors=function(){e.canWriteActiveRepo()&&(e.setLoader(!0,"Fetching connectors","Normally this is a fast operation but it may take longer if a bigger repository needs to be initialised first."),p.getConnectors().then((function(r){e.connectors=Object.keys(r.data).map((function(e){return{key:e,value:r.data[e]}})),f.all(_.map(e.connectors,(function(t){return e.initConnector(t)}))).finally((function(){h();const r=function(e){const t=_.map(e,(function(e){return"<"+e.value+"connectorStatus>"})).join("|");return t?"SELECT ?connector ?status { ?connector "+t+" ?status }":null}(e.connectors);r?function(e){return o(t,n.getActiveRepository(),e)}(r).then((function(t){const n=function(e){if(e.bindings)for(let t=0;t<e.bindings.length;t++)try{const n=JSON.parse(e.bindings[t].status.value);if("BUILDING"===n.status)return{connector:e.bindings[t].connector.value,status:n}}catch(e){console.error(e)}return{}}(t.data.results);if(n.connector){const t=n.connector.split(/#/);t[0]=t[0].replace(/\/instance$/,"#"),r=t[0],i=t[1],h(),$.extend(e.beingBuiltConnector,{iri:a(r)+i,name:i,inline:!0,doneCallback:function(){e.beingBuiltConnector.inline=!1}})}var r,i})).finally((function(){e.setLoader(!1)})):e.setLoader(!1)}))})).catch((function(t){e.setLoader(!1),c.error(getError(t),"Could not get connectors")})),e.existing={})},e.getOptions=function(t){return e.definitions[t.key]},e.isEmpty=function(e){return angular.isObject(e)&&0===Object.keys(e).length},e.toPrettyJson=function(e){return angular.toJson(e,2)},e.$watch((function(){return n.getActiveRepository()}),e.getConnectors),e.$watch((function(){return n.getActiveLocation()}),e.getConnectors),e.copyConnector=function(t,n){let r;angular.isUndefined(n)||(r=angular.copy(n),r.name=r.name+"-copy"),u.open({templateUrl:"pages/createConnector.html",controller:"CreateConnectorCtrl",size:"lg",backdrop:"static",resolve:{connector:function(){return t},values:function(){return angular.isUndefined(r)?{name:"",values:{}}:r},options:function(){return e.getOptions(t)}}}).result.then((function(n){m(t,n,(function(){n.skipConversion=!0,e.newConnector(t,n)}))}))},e.newConnector=function(t,n){u.open({templateUrl:"pages/createConnector.html",controller:"CreateConnectorCtrl",size:"lg",backdrop:"static",resolve:{connector:function(){return t},values:function(){return angular.isUndefined(n)?{name:"",values:{}}:n},options:function(){return e.getOptions(t)}}}).result.then((function(n){m(t,n,(function(){n.skipConversion=!0,e.newConnector(t,n)}))}))},e.repair=function(t,i){l.openSimpleModal({title:"Confirm repair",message:"Are you sure you want to repair this connector?<br>Note that repair means delete + recreate with the same settings.",warning:!0}).result.then((function(){const o=g(i.value,t.name,!0),s=(u=t.name,"PREFIX prefix:<"+(l=i.value)+">\nINSERT DATA {\n\t<"+a(l)+u+'> prefix:repairConnector ""\n}');var u,l;d.addStatements(n.getActiveRepository(),r({update:s})).then((function(){p.getConnectors().then((function(){p.hasConnector(encodeURIComponent(i.value)).then((function(t){e.existing[i.key]=t.data}))})),c.success("Repaired connector "+t.name)}),(function(e){c.error(getError(e))})).finally((function(){o.dismiss("cancel")}))}))},e.delete=function(t,i){const o=i.key.indexOf("Elastic")>=0||i.key.indexOf("Solr")>=0;u.open({templateUrl:"js/angular/externalsync/templates/deleteConnector.html",controller:"DeleteConnectorCtrl",resolve:{type:function(){return i.key},isExternal:function(){return o}}}).result.then((function(a){e.setLoader(!0,"Deleting connector "+t.name,"This is usually a fast operation but it might take a while.");const s=function(e,t,n){const r=t.substring(0,t.length-1)+"/instance#";return"PREFIX prefix:<"+t+">\nINSERT DATA {\n\t<"+r+e+'> prefix:dropConnector "'+(n?"force":"")+'"\n}'}(t.name,i.value,a);d.addStatements(n.getActiveRepository(),r({update:s})).then((function(){p.getConnectors().then((function(){p.hasConnector(encodeURIComponent(i.value)).then((function(t){e.existing[i.key]=t.data}))})),a?(c.success("Deleted (with force) connector "+t.name),o&&c.warning("You may have to remove the index manually from "+i.key)):c.success("Deleted connector "+t.name)}),(function(e){c.error(getError(e))})).finally((function(){e.setLoader(!1)}))}))},e.viewQuery=function(t,n){u.open({templateUrl:"pages/viewQuery.html",controller:"ViewQueryCtrl",resolve:{query:function(){const r=e.getOptions(t);return s(n.name,t.value,i(n.values,r),r)}}})}}function c(e,t,n,r){e.force=!1,e.type=n,e.isExternal=r,e.ok=function(){t.close(e.force)},e.cancel=function(){t.dismiss()}}function l(e,t,n,r,i){function o(){return s(e.name,n.value,e.values,e.options,(function(e,t){i.error(t,e)}))}e.connector=n,e.addField=function(t,n){const r=angular.copy(e.defaultValues[n][0]);e.values[n].splice(t+1,0,r)},e.addOption=function(e,t){t.splice(e+1,0,"")},e.deleteOption=function(e,t){t.splice(e,1)},e.addMapOption=function(e,t){t.splice(e+1,0,{key:"",value:""})},e.deleteMapOption=function(e,t){t.splice(e,1)},e.ok=function(){if(e.form.$valid){const n=o();n&&t.close({name:e.name,values:e.values,options:e.options,query:n})}},e.viewQuery=function(){const e=o();e&&r.open({templateUrl:"pages/viewQuery.html",controller:"ViewQueryCtrl",resolve:{query:function(){return e}}})},e.cancel=function(){t.dismiss("cancel")}}function f(e,t,n,r,o,a,s,u){angular.extend(this,t("ExtendNewConnectorCtrl",{$scope:e,$modalInstance:r,connector:o,$modal:a})),e.values=s.values,e.options=u,e.name=s.name,s.skipConversion||(e.values=i(e.values,e.options)),e.defaultValues=angular.copy(e.values)}function d(e,t,n,r){function i(){const i=function(e){const t=e.replace(/\/instance#.+$/,"#connectorStatus");let n="";return n+="SELECT ?status {\n",n+="\t<"+e+"> <"+t+"> ?status",n+="\n}",n}(e.beingBuiltConnector.iri);e.beingBuiltConnector.iri=null,e.progressInterval=t((function(){(function(e){return o(n,r.getActiveRepository(),e)})(i).then((function(n){const r=function(e){if(e.bindings&&e.bindings.length>0)try{return JSON.parse(e.bindings[0].status.value)}catch(e){console.error(e)}return{}}(n.data.results);"BUILDING"===r.status?(e.beingBuiltConnector.status=r,e.beingBuiltConnector.percentDone=(100*r.processedEntities/r.estimatedEntities).toFixed(0),e.beingBuiltConnector.eta=e.getHumanReadableSeconds(r.etaSeconds),e.beingBuiltConnector.actionName=r.repair?"Repairing":"Creating",e.beingBuiltConnector.waitOnRepairStartOnce=!1):"BUILT"!==r.status||e.beingBuiltConnector.waitOnRepairStartOnce||(t.cancel(e.progressInterval),e.beingBuiltConnector.doneCallback&&e.beingBuiltConnector.doneCallback())}))}),1e3),e.$on("$destroy",(function(){t.cancel(e.progressInterval)}))}e.beingBuiltConnector=e.beingBuiltConnector||{},!e.beingBuiltConnector.inline&&e.beingBuiltConnector.iri&&i(),e.$watch("beingBuiltConnector.iri",(function(t){e.beingBuiltConnector.inline&&t&&i()}))}angular.module("graphdb.framework.externalsync.controllers",["graphdb.framework.rest.rdf4j.repositories.service","graphdb.framework.rest.connectors.service"]).controller("ConnectorsCtrl",u).controller("ExtendNewConnectorCtrl",l).controller("CreateConnectorCtrl",f).controller("CreateProgressCtrl",d).controller("DeleteConnectorCtrl",c).filter("ceil",(function(){return function(e){return Math.ceil(e)}})),u.$inject=["$scope","$http","$repositories","$modal","toastr","ModalService","$q","RDF4JRepositoriesRestService","ConnectorsRestService"],c.$inject=["$scope","$modalInstance","type","isExternal"],l.$inject=["$scope","$modalInstance","connector","$modal","toastr"],f.$inject=["$scope","$controller","$http","$modalInstance","connector","$modal","values","options"],d.$inject=["$scope","$interval","$http","$repositories"]},33:function(e,t,n){"use strict";n.r(t);n(4),n(12);function r(e,t,n,r,i,o,a,s,u,c,l,f,d,p){const h={id:"1",name:"",query:"select * where { \n\t?s ?p ?o .\n} limit 100 \n",inference:!0,sameAs:!0};let g,m=c.getPrincipal();function y(e,t){h.inference=t.appSettings.DEFAULT_INFERENCE,h.sameAs=t.appSettings.DEFAULT_SAMEAS,e.skipCountQuery=!t.appSettings.EXECUTE_COUNT,e.ignoreSharedQueries=t.appSettings.IGNORE_SHARED_QUERIES,e.tabsData=e.tabs=d.get(p.TABS_STATE)||[h],e.$watchCollection("[currentQuery.inference, currentQuery.sameAs]",(function(e,t,n){v(n.currentQuery)})),e.$on("repositoryIsSet",C)}function v(t){!function(){if(r.isActiveRepoOntopType())return;const t=document.getElementById("sameAs");!t||e.currentQuery.inference||t.disabled?e.currentQuery.inference&&t.disabled&&(t.removeAttribute("disabled"),e.currentQuery.sameAs=m.appSettings.DEFAULT_SAMEAS):(t.disabled=!0,e.currentQuery.sameAs=!1)}(),e.tabs.forEach((function(n,i){n.id===t.id&&(e.tabs[i].query=t.query,r.isActiveRepoOntopType()||(e.tabs[i].inference=t.inference,e.tabs[i].sameAs=t.sameAs))})),d.set(p.TABS_STATE,e.tabs)}function x(t,n,r,i){const o=angular.element(document.getElementById("yasr-inner"));e.queryIsRunning=t,t?(e.queryStartTime=Date.now(),e.countTimeouted=!1,e.progressMessage=n,e.extraMessage=r,e.noLoaderTimer=i,o.addClass("hide")):(e.progressMessage="",e.extraMessage="",e.noLoaderTimer=!1,e.currentTrackAlias=null,e.abortRequested=!1,o.removeClass("hide")),null===e.$$phase&&e.$apply()}function w(n){function r(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0}if(e.orientationViewMode){if("yasr"===e.viewMode){let e=r()-document.querySelector(".CodeMirror-wrap").getBoundingClientRect().top;e-=40,document.querySelector(".CodeMirror-wrap").style.height=e+"px"}else e.noPadding={},document.querySelector(".CodeMirror-wrap").style.height="";document.getElementById("yasr").style.minHeight=""}else if(e.noPadding={paddingRight:15,paddingLeft:0},window.editor&&document.querySelector(".CodeMirror-wrap")){let e=r()-document.querySelector(".CodeMirror-wrap").getBoundingClientRect().top;e-=40,document.querySelector(".CodeMirror-wrap").style.height=e+"px",document.getElementById("yasr").style.minHeight=e+"px"}else{let r;r=t(n?function(){e.fixSizesOnHorizontalViewModeSwitch(n)}:e.fixSizesOnHorizontalViewModeSwitch,100),e.$on("$destroy",(function(){t.cancel(r)}))}window.yasr&&window.yasr.container&&t((function(){window.yasr.container.resize()}),100)}function b(){w(!0)}function C(t,n){n.newRepo&&(e.tabsData=d.get(p.TABS_STATE),e.tabsData.forEach((function(e){e.yasrData=void 0,e.queryType=void 0,e.resultsCount=0,e.allResultsCount=0,e.sizeDelta=void 0})),d.set(p.TABS_STATE,e.tabsData),e.tabs=e.tabsData,e.currentQuery={},e.errorMessage=null,e.repositoryError=null)}function S(e){t((function(){$('a[data-id = "'+e+'"]').tab("show")}),0)}function M(i,o){if(e.executedQueryTab=e.currentQuery,o){if("SELECT"!==window.editor.getQueryType()&&"CONSTRUCT"!==window.editor.getQueryType())return void n.warning("Explain only works with SELECT or CONSTRUCT queries.");if(r.isActiveRepoOntopType())return void n.warning("Explain not supported for Virtual repositories.")}if(e.explainRequested=o,!e.queryIsRunning){if(i?e.currentTabConfig.resultsCount=0:e.resetCurrentTabConfig(),e.lastRunQueryMode=window.editor.getQueryMode(),"update"===e.lastRunQueryMode&&r.isActiveRepoOntopType())return void n.warning("Updates are not supported for Virtual repositories.");if(x(!0,"update"===e.lastRunQueryMode?"Executing update":"Evaluating query"),"none"!==e.viewMode){e.viewMode="none",e.orientationViewMode&&e.fixSizesOnHorizontalViewModeSwitch();const n=t(window.editor.query,500);e.$on("$destroy",(function(){t.cancel(n)}))}else window.editor.query()}}function T(){e.showSampleQueries=!e.showSampleQueries,e.showSampleQueries?a.getSavedQueries().success((function(t){e.sampleQueries=t,$("#sampleQueriesCollapse").collapse("show").width("300px")})).error((function(e){const t=getError(e);n.error(t,"Error! Could not get saved queries")})):$("#sampleQueriesCollapse").collapse("hide")}function _(t){let n=void 0;return e.tabsData.forEach((function(e){if(e.name===t.name&&e.query===t.body)return n=e.id,e})),n}function E(t){return function(n,r,i){e.savedQuery={name:n,query:r||window.editor.getValue(),shared:i},$(t).modal("show")}}function R(t){for(let n=0;n<e.tabsData.length;n++){if(e.tabsData[n].id===t)return n}}m?y(e,m):e.$on("securityInit",(function(e){m=c.getPrincipal(),y(e.currentScope,m)})),this.hint=document.createElement("span"),this.hint.innerHTML='Hint: "abC" matches "abC*", "ab c*" and "ab-c*"',this.hint.style.fontSize="12px",this.hint.style.color="gray",this.hint.style.backgroundColor="white",this.hint.style.position="absolute",this.hint.style.zIndex="3",this.hint.style.paddingLeft="12px",e.$watch((function(){return angular.element(".CodeMirror-hints").length}),e=>{if(e){const e=angular.element(".CodeMirror-hints")[0].getBoundingClientRect();document.body.appendChild(this.hint),this.hint.style.top=e.top-20+"px",this.hint.style.left=e.right-this.hint.offsetWidth-12+"px"}else this.hint&&this.hint.parentNode&&this.hint.parentNode.removeChild(this.hint)}),e.resetCurrentTabConfig=function(){e.currentTabConfig={pageSize:1e3,page:1,allResultsCount:0,resultsCount:0}},e.queryExists=!1,e.resetCurrentTabConfig(),e.saveTab=function(t){const n=R(t);if(void 0===n)return{};const r=e.tabsData[n];return e.saveQueryToLocal(r),r},e.loadTab=function(n){e.tabsData=d.get(p.TABS_STATE)||[h];const i=R(n),o=e.tabsData[i];o.yasrData&&x(!0,"Rendering results",null,!0);t((function(){""===e.currentQuery.query&&(e.currentQuery.query=" "),t((function(){window.editor.setValue(e.currentQuery.query),e.yasr.updateDownloadDropdown(),e.$broadcast("tabLoaded",e.currentQuery.id),e.yasr.options.output=o.outputType,o.yasrData&&(o.yasrData.customError?(e.yasr.results={getException:function(){return o.yasrData.customError}},x(!1)):t((function(){e.setYasrResponse(o.yasrData,o.textStatus,o.jqXhrOrErrorString),x(!1),$(".yasr_btnGroup li:nth-child(2)").hasClass("active")&&t((function(){$(".yasr_btnGroup li:nth-child(2) a").get(0).click()}),0)}),0))}),0)}),0),d.set(p.TABS_STATE_CURRENT_ID,n),e.currentQuery=o,t((function(){e.currentTabConfig={},e.currentTabConfig.queryType=o.queryType,e.currentTabConfig.resultsCount=o.resultsCount,e.currentTabConfig.offset=o.offset,e.currentTabConfig.allResultsCount=o.allResultsCount,e.currentTabConfig.allResultsCountExact=o.allResultsCountExact,e.currentTabConfig.page=o.page,e.currentTabConfig.pageSize=o.pageSize,e.currentTabConfig.timeFinished=o.timeFinished,e.currentTabConfig.timeTook=o.timeTook,e.currentTabConfig.sizeDelta=o.sizeDelta,e.currentTabConfig.customUpdateMessage=o.customUpdateMessage,e.currentTabConfig.errorMessage=o.errorMessage,e.currentTabConfig.warningMessage=o.warningMessage,e.$apply()}),0),$("#yasr").css("padding","0"),g||(g=setInterval(I,200));!function(){const t=r.isActiveRepoOntopType(),n=r.isActiveRepoFedXType();(function(e){const t=document.getElementById("sameAs"),n=document.getElementById("inference");t&&(t.disabled=!!e);n&&(n.disabled=!!e)})(t),e.nocount=!(!t&&!n)||!m.appSettings.EXECUTE_COUNT,t&&(e.currentQuery.inference=!0,e.currentQuery.sameAs=!0)}()},e.addNewTab=function(n,r,i){if(!N(!0))return;let o;o=r||i?{id:"1",name:r,query:i,inference:m.appSettings.DEFAULT_INFERENCE,sameAs:m.appSettings.DEFAULT_SAMEAS}:{id:"1",name:"",query:"select * where { \n\t?s ?p ?o .\n} limit 100 \n",inference:m.appSettings.DEFAULT_INFERENCE,sameAs:m.appSettings.DEFAULT_SAMEAS};k++;const a=""+k;e.tabsData=e.tabs;const s=o;s.id=a,e.tabsData.push(s),d.set(p.TABS_STATE_MAXID,k),d.set(p.TABS_STATE,e.tabsData);const u=Array.prototype.slice.call(arguments,1);t((function(){e.$apply(),S(a),n&&n.apply(this,u)}),0),e.tabs=e.tabsData},e.isTabChangeOk=N,e.runQuery=M,e.abortCurrentQuery=function(){f.abortQueryByAlias(e.currentTrackAlias).success((function(){e.abortRequested=!0}))},e.editQuery=function(t){i.open({templateUrl:"js/angular/core/directives/queryeditor/templates/query-sample.html",controller:"QuerySampleModalCtrl",resolve:{data:function(){return{title:'Edit Saved Query: "'+t.name+'"',query:t,edit:!0,okButtonText:"Save"}}}}).result.then((function(r){const i={name:r.name,body:r.body,shared:r.shared};t.name!==r.name?a.addNewSavedQuery(i).success((function(){e.deleteQueryHttp(t.name,!0)})).error((function(e){const t=getError(e);n.error(t,"Error! Cannot edit saved query")})):a.editSavedQuery(i).success((function(){$("#editQueryContainer").modal("hide"),e.toggleSampleQueries(),n.success("Saved query "+t.name+" was edited.")})).error((function(e){const t=getError(e);n.error(t,"Error! Cannot edit Saved query")}))}))},e.getNamespaces=function(){x(!0,"Refreshing namespaces","Normally this is a fast operation but it may take longer if a bigger repository needs to be initialised first."),e.namespacesLoading=!0,l.getRepositoryNamespaces().success((function(t){const n={};t.results.bindings.forEach((function(e){n[e.prefix.value]=e.namespace.value})),e.namespaces=n})).error((function(t){e.repositoryError=getError(t)})).finally((function(){x(!1),e.namespacesLoading=!1}))},e.changePagination=function(){M(!0,e.explainRequested)},e.toggleSampleQueries=T,e.addKnownPrefixes=function(){a.addKnownPrefixes(JSON.stringify(window.editor.getValue())).success((function(e){angular.isDefined(window.editor)&&angular.isDefined(e)&&e!==window.editor.getValue()&&window.editor.setValue(e)})).error((function(e){const t=getError(e);return n.error(t,"Error! Could not add known prefixes"),!0}))},e.getExistingTabId=_,e.querySelected=function(t){const n=_(t);e.toggleSampleQueries(),e.isTabChangeOk(!1)&&(e.highlightNextTabChange=!0,angular.isDefined(n)?S(n):e.addNewTab(null,t.name,t.body))},e.deleteQuery=function(t){o.openSimpleModal({title:"Confirm",message:"Are you sure you want to delete the saved query '"+t+"'?",warning:!0}).result.then((function(){e.deleteQueryHttp(t)}))},e.deleteQueryHttp=function(t,r){a.deleteSavedQuery(t).success((function(){e.toggleSampleQueries(),r||n.success("Saved query: "+t+" was deleted.")})).error((function(e){const t=getError(e);n.error(t,"Error! Cannot delete saved query")}))},e.saveQuery=function(t,n){i.open({templateUrl:"js/angular/core/directives/queryeditor/templates/query-sample.html",controller:"QuerySampleModalCtrl",resolve:{data:function(){return{title:"Create New Saved Query",query:{name:t.name,body:t.query,shared:t.shared},edit:!1,okButtonText:"Create",queryExists:n}}}}).result.then((function(t){e.saveQueryHttp(t)}),(function(){}))},e.saveQueryHttp=function(t){a.addNewSavedQuery(t).success((function(){n.success("Saved query "+t.name+" was saved.")})).error((function(r){let i=getError(r);if(n.error(i,"Error! Cannot create saved query"),i="Query '"+t.name+"' already exists!"){t.query=t.body;const n=!0;e.saveQuery(t,n)}}))},e.saveQueryToLocal=v,e.setLoader=x,e.getLoaderMessage=function(){const t=(Date.now()-e.queryStartTime)/1e3;let n="",r="";e.noLoaderTimer||(n=e.getHumanReadableSeconds(t));r=e.progressMessage?e.progressMessage+"... "+n:"Running operation... "+n;e.extraMessage&&t>10&&(r+="\n"+e.extraMessage);return r},e.fixSizesOnHorizontalViewModeSwitch=w,e.changeViewMode=function(){e.viewMode="none",e.orientationViewMode=!e.orientationViewMode,d.set(p.VIEW_MODE,e.orientationViewMode),w()},e.showHideEditor=b,e.focusQueryEditor=function(){angular.element(document).find(".editable-input").is(":focus")||angular.element(document).find(".CodeMirror textarea:first-child").focus()},e.orientationViewMode=!d.get(p.VIEW_MODE)||"true"===d.get(p.VIEW_MODE),e.viewMode="none",e.getActiveRepository=function(){return r.getActiveRepository()},e.getActiveRepositoryNoError=function(){if(!e.repositoryError)return r.getActiveRepository()},e.orientationViewMode||b(),window.onbeforeunload=function(){e.currentQuery&&e.saveTab(e.currentQuery.id),d.set(p.TABS_STATE,e.tabs)},e.$on("$destroy",(function(){e.currentQuery&&e.saveTab(e.currentQuery.id),d.set(p.TABS_STATE,e.tabs),clearInterval(g)})),e.$on("$destroy",(function(){clearInterval(g),window.editor=null,window.yasr=null})),$(document).mouseup((function(t){const n=$("#sampleQueriesCollapse");!n.is(t.target)&&0===n.has(t.target).length&&e.showSampleQueries&&T()}));let k=d.get(p.TABS_STATE_MAXID)||1;function A(e){return $(e).attr("data-id")}function I(){if(e.currentTabConfig.resultsCount>=0){const e=$(".saveAsDropDown");e.length>0&&!window.editor.queryValid?yasr.header.find(".saveAsDropDown").remove():0===e.length&&window.editor.queryValid&&yasr.updateDownloadDropdown()}}function N(t){return!(e.queryIsRunning&&!e.namespacesLoading)||(t?n.info("New tabs may not be opened while query or update is running."):n.info("Tabs may not be switched while query or update is running."),!1)}e.highlightNextTabChange=!1,e.$on("tabAction",(function(n,r){r.relatedTarget&&(t.cancel(r.relatedTarget.timer),$(r.relatedTarget).css("color",""),e.saveTab(A(r.relatedTarget))),e.loadTab(A(r.target));const i=["#ED4F2F","","#ED4F2F"],o=[400,400,400];if(e.highlightNextTabChange){e.highlightNextTabChange=!1;let n=0;$(r.target).css("color",i[n]);const a=function(){n++,n<i.length?($(r.target).css("color",i[n]),r.target.timer=t(a,o[n])):$(r.target).css("color","")};t(a,o[n])}})),e.$on("deleteAllexeptSelected",(function(t,n){e.tabsData=n,e.tabs=n})),e.currentQuery={},e.showSampleQueries=!1,e.savedQuery={},e.sampleQueries={},e.editQueryModal=E("#editQueryContainer"),e.deleteQueryModal=E("#confirmDeleteContainer"),e.saveQueryModal=E("#saveQueryContainer"),e.getResultsDescription=function(){let t;if(0===e.currentTabConfig.resultsCount)t="No results.";else{const n=(e.currentTabConfig.page-1)*e.currentTabConfig.pageSize+Math.min(e.currentTabConfig.resultsCount,e.currentTabConfig.pageSize);t="Showing results from "+s("currency")(e.currentTabConfig.offset,"",0)+" to "+s("currency")(n,"",0),e.currentTabConfig.allResultsCount>0&&(t+=e.currentTabConfig.allResultsCountExact?" of ":" of at least ",t+=s("currency")(e.currentTabConfig.allResultsCount,"",0)),t+="."}return t},e.getUpdateDescription=function(){return e.currentTabConfig.customUpdateMessage?e.currentTabConfig.customUpdateMessage:void 0===e.currentTabConfig.sizeDelta?"":e.currentTabConfig.sizeDelta<0?"Removed "+Math.abs(e.currentTabConfig.sizeDelta)+" statements.":e.currentTabConfig.sizeDelta>0?"Added "+e.currentTabConfig.sizeDelta+" statements.":"The number of statements did not change."},e.getStaleWarningMessage=function(){const t=60*Math.round((Date.now()-e.currentTabConfig.timeFinished)/6e4);if(t>=3600)return"Possibly stale result (obtained "+e.getHumanReadableSeconds(t)+" ago)."};const L=function(){};angular.element(u).bind("resize",L),e.$on("$destroy",(function(){angular.element(u).unbind("resize",L)}))}function i(e,t,n){n.queryExists&&(e.queryExists=!0),e.query=angular.copy(n.query),e.title=n.title,e.edit=n.edit,e.okButtonText=n.okButtonText,e.ok=function(){e.form.$valid&&t.close(e.query)},e.cancel=function(){t.dismiss("cancel")}}angular.module("graphdb.framework.core.directives.queryeditor.controllers",["graphdb.framework.utils.localstorageadapter","graphdb.framework.rest.sparql.service"]).controller("QueryEditorCtrl",r).controller("QuerySampleModalCtrl",i),r.$inject=["$scope","$timeout","toastr","$repositories","$modal","ModalService","SparqlRestService","$filter","$window","$jwtAuth","RDF4JRepositoriesRestService","MonitoringRestService","LocalStorageAdapter","LSKeys"],i.$inject=["$scope","$modalInstance","data"]},34:function(e,t,n){"use strict";n.r(t);n(29),n(4),n(32);var r=n(210),i=n.n(r),o=n(208),a=n.n(o);function s(e,t,n,r,o,s,u,c,l,f,d,p){let h;return{restrict:"AE",scope:!1,templateUrl:"js/angular/core/directives/queryeditor/templates/query-editor.html",link:function(g,m,y){g.nostorage=y.hasOwnProperty("nostorage"),g.notabs=y.hasOwnProperty("notabs"),g.notoolbar=y.hasOwnProperty("notoolbar"),g.notoolbarSaved=y.hasOwnProperty("notoolbarSaved"),g.notoolbarCopy=y.hasOwnProperty("notoolbarCopy"),g.notoolbarInference=y.hasOwnProperty("notoolbarInference"),g.notoolbarSameAs=y.hasOwnProperty("notoolbarSameAs"),g.nostatus=y.hasOwnProperty("nostatus"),g.norun=y.hasOwnProperty("norun"),g.runButtonName="Run",y.runButtonName&&(g.runButtonName=y.runButtonName);if(g.nocount="true"===y.nocount,y.callbackOnChange){const e=g[y.callbackOnChange];"function"==typeof e&&(h=e)}e((function(){!function(g){function m(){angular.element("#wb-sparql-saveQuery")[0].click()}function y(){g.runQuery(!1,!1)}function v(){g.runQuery(!1,!0)}function x(){if(g.tabs.length<2||!g.currentQuery.id||!g.isTabChangeOk(!1))return;let e=N(g.currentQuery.id);e=(e+1)%g.tabs.length,b(g.tabs[e].id)}function w(){if(g.tabs.length<2||!g.currentQuery.id||!g.isTabChangeOk(!1))return;let e=N(g.currentQuery.id);e--,-1===e&&(e=g.tabs.length-1),b(g.tabs[e].id)}function b(t){e((function(){let e=$('a[data-id = "'+t+'"]');0===e.length&&(e=$("a[data-id]").first()),e.tab("show")}),0)}g.changePagination=function(){g.runQuery(!0,g.explainRequested)},window.editor=i.a.fromTextArea(document.getElementById("query"),{persistent:null,value:"",indentUnit:4,createShareLink:null,cursorHeight:1,sparql:{showQueryButton:!1,acceptHeaderGraph:"application/x-graphdb-table-results+json, application/rdf+json;q=0.9, */*;q=0.8",acceptHeaderSelect:"application/x-sparqlstar-results+json, application/sparql-results+json;q=0.9, */*;q=0.8"},extraKeys:{"Ctrl-Enter":y,"Cmd-Enter":y,"Shift-Ctrl-Enter":v,"Shift-Cmd-Enter":v,"Ctrl-Alt-T":g.addNewTab,"Cmd-Alt-T":g.addNewTab,"Ctrl-S":m,"Cmd-S":m,"Ctrl-Alt-Left":w,"Cmd-Alt-Left":w,"Ctrl-Alt-Right":x,"Cmd-Alt-Right":x}}),window.editor.toastBuildIndex=function(){n.warning("",'<div class="autocomplete-toast"><a href="autocomplete">Autocomplete is OFF<br>Go to Setup -> Autocomplete</a></div>',{allowHtml:!0})},window.editor.toastError=function(e){n.error("Cannot execute autocomplete query. "+getError(e))},window.editor.on("changes",(function(){angular.element(".CodeMirror-linenumbers").css("width","1px"),angular.element(".CodeMirror-sizer").css("margin-left","0px"),clearTimeout(g.changesTimeout);const e=!window.editor.queryValid;g.changesTimeout=setTimeout(h?h():function(){const t=N(g.currentQuery.id)+1;$('a[data-id = "'+t+'"]').toggleClass("query-has-error",e).attr("title",e?"Query contains a syntax error. See the relevant line for more information.":"")},200),g.currentQuery.query=window.editor.getValue(),g.currentQuery.queryType=window.editor.getQueryType()})),$(".fullscreenToggleBtns").hide();const C=function(e){$(e.target).removeClass("fa-link").addClass("fa-check").blur(),setTimeout((function(){$(e.target).removeClass("fa-check").addClass("fa-link")}),1e3)};window.onbeforeunload=function(){g.nostorage||d.set(p.TABS_STATE,g.tabs),g.saveTab(g.currentQuery.id)};const S=i.a.executeQuery,M=i.a.getUrlArguments;function T(e,t,n){return{status:e,statusText:t,responseText:n}}let E,R;g.$on("$destroy",(function(){g.nostorage||d.set(p.TABS_STATE,g.tabs),i.a.executeQuery=S,i.a.getUrlArguments=M,g.saveTab(g.currentQuery.id)})),i.a.drawButtons=function(e){e.buttons=$("#yasqe_buttons_mocked")},i.a.getActiveRepository=function(){return r.getActiveRepository()},i.a.getUrlArguments=function(e,t){const n=M(e,t),r=window.editor.getQueryType();return"SELECT"!==r&&"CONSTRUCT"!==r&&"DESCRIBE"!==r||(n.push({name:"limit",value:g.currentTabConfig.pageSize+1}),g.currentTabConfig.offset=(g.currentTabConfig.page-1)*g.currentTabConfig.pageSize+1,n.push({name:"offset",value:g.currentTabConfig.offset-1})),!g.explainRequested||"SELECT"!==r&&"CONSTRUCT"!==r||n.push({name:"explain",value:"true"}),n},i.a.executeQuery=function(e){if(R&&$(R.resultsContainer).length&&$(R.resultsContainer).empty(),e.options.sparql.headers["X-GraphDB-Catch"]=g.currentTabConfig.pageSize+"; throw",g.currentTrackAlias="query-editor-"+performance.now()+"-"+Date.now(),e.options.sparql.headers["X-GraphDB-Track-Alias"]=g.currentTrackAlias,g.countTimeouted=!1,"query"===e.getQueryMode()?e.options.sparql.endpoint="repositories/"+r.getActiveRepository():"update"===e.getQueryMode()&&(e.options.sparql.endpoint="repositories/"+r.getActiveRepository()+"/statements"),e.options.sparql.args=[{name:"infer",value:g.currentQuery.inference},{name:"sameAs",value:g.currentQuery.sameAs}],g.currentTabConfig.customUpdateMessage="","update"!==window.editor.getQueryMode()){const t=g.currentTabConfig,n=g.executedQueryTab.id;return window.editor.options.sparql.handlers.countCallback=function(e,r,i){if(200===e.status){const o=g.tabs[N(n)];o&&(R.setResultsCount(e,r,i),t.allResultsCount=R.allCount,o.allResultsCount=R.allCount,t.allResultsCountExact=!0,o.allResultsCountExact=!0,g.saveTab(o.id))}else t.countTimeouted=!0},null!=g.currentQuery.outputType?R.options.output=g.currentQuery.outputType:R.options.output="table",g.currentTabConfig.queryType=window.editor.getQueryType(),g.queryStartTime=(new Date).getTime(),S(e,{setQueryLimit:function(e){return"CONSTRUCT"===g.currentTabConfig.queryType&&r.isActiveRepoOntopType()?window.editor.getValueWithoutComments():e}})}{const t=function(){g.currentTabConfig.queryType="UPDATE",l.getRepositorySize().success((function(t){return g.repoSize=parseInt(t),g.queryStartTime=(new Date).getTime(),S(e,{})})).error((function(t){return n.warning("Could not get repository size for: "+r.getActiveRepository()+"; "+getError(t)),g.queryStartTime=(new Date).getTime(),S(e,{})}))};f.checkConnector(window.editor.getValue()).then((function(e){if(e.data.command&&!e.data.hasSupport){g.currentTabConfig.queryType="ERROR",g.currentTabConfig.timeFinished=Date.now(),g.currentTabConfig.timeTook=(g.currentTabConfig.timeFinished-g.queryStartTime)/1e3;const t=T(-1,"No support for "+e.data.connectorName,e.data.connectorName+" connectors are not supported because the plugin "+e.data.pluginName+" is not active.");return R.results={getException:function(){return t}},g.setLoader(!1),void A({customError:t},"",null)}if("create"===e.data.command||"repair"===e.data.command){const t="repair"===e.data.command;t?(g.setLoader(!0,"Repairing connector "+e.data.name),g.currentTabConfig.customUpdateMessage="Repaired connector "+e.data.name+"."):(g.setLoader(!0,"Creating connector "+e.data.name),g.currentTabConfig.customUpdateMessage="Created connector "+e.data.name+".");const n=g.$new(!0);n.beingBuiltConnector={percentDone:0,status:{processedEntities:0,estimatedEntities:0,indexedEntities:0,entitiesPerSecond:0},actionName:t?"Repairing":"Creating",eta:"-",inline:!1,iri:e.data.iri,name:e.data.name,doneCallback:function(){E.dismiss("cancel")}},n.getHumanReadableSeconds=g.getHumanReadableSeconds,E=u.open({templateUrl:"pages/connectorProgress.html",controller:"CreateProgressCtrl",size:"lg",backdrop:"static",scope:n})}else"drop"===e.data.command&&(g.setLoader(!0,"Deleting connector "+e.data.name),g.currentTabConfig.customUpdateMessage="Deleted connector "+e.data.name+".");t()}),(function(){t()}))}};const k=i.a.getAjaxConfig;function A(e,t,n){e.getResponseHeader&&e.getResponseHeader("content-type")&&(e.contentType=e.getResponseHeader("content-type")),delete e.response;const r=N(g.executedQueryTab.id),i=g.tabs[r],o={queryType:g.currentTabConfig.queryType,yasrData:e,textStatus:t,jqXhrOrErrorString:n,page:g.currentTabConfig.page,pageSize:g.currentTabConfig.pageSize,allResultsCount:g.currentTabConfig.allResultsCount,allResultsCountExact:g.currentTabConfig.allResultsCountExact,resultsCount:g.currentTabConfig.resultsCount,offset:g.currentTabConfig.offset,timeTook:g.currentTabConfig.timeTook,timeFinished:g.currentTabConfig.timeFinished,sizeDelta:g.currentTabConfig.sizeDelta,customUpdateMessage:g.currentTabConfig.customUpdateMessage,errorMessage:g.currentTabConfig.errorMessage,warningMessage:g.currentTabConfig.warningMessage};"ERROR"!==g.currentTabConfig.queryType&&"UPDATE"!==g.currentTabConfig.queryType&&"ASK"!==g.currentTabConfig.queryType&&(o.outputType=g.yasr.options.output),angular.extend(g.currentQuery,o),angular.extend(i,o),g.nostorage||d.set(p.TABS_STATE,g.tabs),$('a[data-id = "'+g.executedQueryTab.id+'"]').tab("show")}function I(){var e=R.results.getBindings(),t=R.results.getVariables(),n=e[0],r=t[0];if(1===t.length&&1===e.length&&"plan"===r&&n[r].value.includes("# NOTE: Optimization groups")){var o=document.getElementsByClassName("nonUri")[0];o.classList.add("cm-s-default"),o.setAttribute("id","highlighted_output");var a=o.innerText.substring(1,o.innerText.length-1);o.innerHTML="",i.a.runMode(a,"sparql11",document.getElementById("highlighted_output"))}}function N(e){for(let t=0;t<g.tabs.length;t++){if(g.tabs[t].id===e)return t}}function L(e){return angular.isDefined(e)&&"false"!==e}function D(e,n,r){const i=g.getExistingTabId(e),o=g.$on("tabLoaded",(function(){angular.isDefined(n)&&(g.currentQuery.inference=L(n)),angular.isDefined(r)&&(g.currentQuery.sameAs=L(r)),L(t.search().execute)&&("update"===window.editor.getQueryMode()?s.openSimpleModal({title:"Confirm execute",message:"This is an update and it may change the data in the repository.<br>Are you sure you want to execute it automatically?",warning:!0}).result.then((function(){g.runQuery(!1)})):g.runQuery(!1)),o()}));g.highlightNextTabChange=!0,angular.isDefined(i)?b(i):g.addNewTab(null,e.name,e.body)}function O(){if(t.search().savedQueryName)e=t.search().savedQueryName,r=t.search().owner,i=t.search().infer,a=t.search().sameAs,o.getSavedQuery(e,r).success((function(e){D(e,i,a)})).error((function(t){n.error("Could not get data for saved query: "+e+"; "+getError(t))}));else if(t.search().query){D({name:t.search().name,body:t.search().query},t.search().infer,t.search().sameAs)}else{b(d.get(p.TABS_STATE_CURRENT_ID))}var e,r,i,a}function P(){g.getNamespaces(),i.a.signal(window.editor,"repositoryOrAuthorizationChanged",r.getActiveRepository(),c.getAuthToken()),O()}i.a.getAjaxConfig=function(e,t){const n=k(e,t);return _.extend(n.headers,{Authorization:c.getAuthToken()}),n},g.copyToClipboardQuery=function(e,t){s.openCopyToClipboardModal(function(e,t){let n=[location.protocol,"//",location.host,location.pathname].join("");e?(n=n+"?savedQueryName="+encodeURIComponent(e),null!=t&&(n+="&owner="+encodeURIComponent(t))):n=n+"?"+$.param({name:g.currentQuery.name,infer:g.currentQuery.inference,sameAs:g.currentQuery.sameAs,query:window.editor.getValue()});return n}(e,t))},g.copyToClipboardResult=function(e){s.openCopyToClipboardModal(e)},g.goToVisual=function(){const e={query:window.editor.getValue(),sameAs:g.currentQuery.sameAs,inference:g.currentQuery.inference};t.path("graphs-visualizations").search(e)},$("textarea").on("paste",(function(){e((function(){g.addKnownPrefixes()}),0)})),R=a()(document.getElementById("yasr"),{getUsedPrefixes:{},persistency:!1}),window.yasr=R,R.afterCopy=C,R.getQueryResultsAsFormat=function(e){const t=$("#wb-download");t.attr("action","repositories/"+r.getActiveRepository()),$("#wb-download-query").val(g.currentQuery.query),window.editor.getValue()!==g.currentQuery.query&&n.warning("The query in your editor does not match the query results. Download will save the results from the last executed query."),$("#wb-download-infer").val(g.currentQuery.inference),$("#wb-download-sameAs").val(g.currentQuery.sameAs);const i=localStorage.getItem("com.ontotext.graphdb.auth");i&&$("#wb-auth-token").val(i),$("#wb-download-accept").val(e),t.submit()},window.editor.options.sparql.handlers.complete=function(t,r,i){function o(){A(t,r,i)}if(E&&E.dismiss("cancel"),null===window.editor)return void g.setLoader(!1);if(g.currentTabConfig.errorMessage=t.getResponseHeader("X-GraphDB-Error"),g.currentTabConfig.warningMessage=t.getResponseHeader("X-GraphDB-Warning"),R.currentQuery=g.currentQuery,g.currentTabConfig.timeFinished=Date.now(),g.currentTabConfig.timeTook=(g.currentTabConfig.timeFinished-g.queryStartTime)/1e3,t.status>=400)return t.responseText=t.responseText.replace(/^([^: ]+: )+/,""),g.currentTabConfig.queryType="ERROR",o(),g.setYasrResponse(t,r,i),void g.setLoader(!1);if(0===t.status){g.currentTabConfig.queryType="ERROR";const e=T(-1,"Request was aborted","The request has been aborted. There are no results to show.");return R.results={getException:function(){return e}},g.setLoader(!1),void A({customError:e},"",null)}let a;if(g.setLoader(!1),"update"===window.editor.getQueryMode())a=function(){l.getRepositorySize().success((function(e){let t;void 0!==g.repoSize&&(t=Number(e)-g.repoSize),g.currentTabConfig.sizeDelta=t,o()})).error((function(e){n.warning("Could not get repository size for: "+g.getActiveRepository()+"; "+getError(e)),g.currentTabConfig.sizeDelta=void 0,o()}))};else{if(200===t.status){const e=t.getResponseHeader("Content-Type");0!==e.indexOf("application/sparql-results+json")&&0!==e.indexOf("application/x-sparqlstar-results+json")&&0!==e.indexOf("application/x-graphdb-table-results+json")||t.responseJSON.results&&(g.currentTabConfig.resultsCount=t.responseJSON.results.bindings.length,t.responseJSON.results.bindings.length>g.currentTabConfig.pageSize&&(t.responseJSON.results.bindings.length=g.currentTabConfig.pageSize),g.currentTabConfig.allResultsCountExact||((g.nocount||g.countTimeouted||g.currentTabConfig.resultsCount<=g.currentTabConfig.pageSize)&&(t.status=204),g.currentTabConfig.allResultsCount=Math.max(g.currentTabConfig.allResultsCount,g.currentTabConfig.pageSize*(g.currentTabConfig.page-1)+g.currentTabConfig.resultsCount),g.currentTabConfig.resultsCount<=g.currentTabConfig.pageSize&&(g.currentTabConfig.allResultsCountExact=!0)))}g.setLoader(!0,"Rendering results",null,!0),a=function(){g.setYasrResponse(t,r,i),o(),g.setLoader(!1)}}e((function(){a(),"CONSTRUCT"!==window.editor.getQueryType()?($(".yasr_btnGroup.nav.nav-tabs li a.disabled").removeClass("disabled").css("font-weight","400"),$(".yasr_btnGroup.nav.nav-tabs li.disabled a").addClass("disabled").css("font-weight","200"),"DESCRIBE"===window.editor.getQueryType()&&$(".yasr_btnGroup.nav.nav-tabs li a").removeClass("disabled").css("font-weight","400")):"CONSTRUCT"===window.editor.getQueryType()&&$(".yasr_btnGroup.nav.nav-tabs li a.disabled").removeClass("disabled").css("font-weight","400"),$("#yasr").css("padding","0"),$(".yasr_btnGroup li:nth-child(2)").hasClass("active")&&e((function(){$(".yasr_btnGroup li:nth-child(2) a").get(0).click()}),100),$("#wb-sparql-addNewTab").click((function(){$(".dataTables_filter").hide(),$(".resultsTable").hide()}))}),100)},window.editor.options.sparql.handlers.resetResults=function(){},g.yasr=R,g.setYasrResponse=function(e,t,n){e.responseJSON&&(e.response=e.responseJSON,e.responseText=void 0),window.yasr.plugins.table.options.highlightLiteralCellResult=I,R.setResponse(e,t,n)},g.$watch("yasr.options.output",(function(e){if(e&&"UPDATE"!==g.currentTabConfig.queryType&&"ASK"!==g.currentTabConfig.queryType){const t=g.tabs[N(g.currentQuery.id)];angular.isDefined(t)&&g.currentTabConfig.queryType&&t.outputType!==e&&(t.outputType=g.currentQuery.outputType=e,g.saveTab(t.id))}})),void g.$watch("namespaces",(function(){g.namespaces&&(R&&R.options&&g.namespaces&&(R.options.getUsedPrefixes=g.namespaces),i.a.signal(window.editor,"namespacesChanged",g.namespaces))})),$(document).mouseup((function(e){const t=$("#sampleQueriesCollapse");!t.is(e.target)&&0===t.has(e.target).length&&g.showSampleQueries&&g.toggleSampleQueries()})),r.getActiveRepository()&&P();g.$on("repositoryIsSet",(function(){r.getActiveRepository()&&P()})),e((function(){angular.element(document).find(".CodeMirror textarea:first-child").focus()}),50)}(g)}),150)}}}angular.module("graphdb.framework.core.directives.queryeditor.queryeditor",["ngCookies","graphdb.framework.externalsync.controllers","graphdb.framework.rest.connectors.service","graphdb.framework.utils.localstorageadapter"]).directive("queryEditor",s),s.$inject=["$timeout","$location","toastr","$repositories","SparqlRestService","ModalService","$modal","$jwtAuth","RDF4JRepositoriesRestService","ConnectorsRestService","LocalStorageAdapter","LSKeys"]},37:function(e,t,n){"use strict";n.r(t),n.d(t,"STATIC_RULESETS",(function(){return r})),n.d(t,"REPOSITORY_TYPES",(function(){return i})),n.d(t,"FILENAME_PATTERN",(function(){return o})),n.d(t,"NUMBER_PATTERN",(function(){return a})),n.d(t,"REPO_TOOLTIPS",(function(){return s}));const r=[{id:"empty",name:"No inference"},{id:"rdfs-optimized",name:"RDFS (Optimized)"},{id:"rdfs",name:"RDFS"},{id:"rdfsplus-optimized",name:"RDFS-Plus (Optimized)"},{id:"owl-horst-optimized",name:"OWL-Horst (Optimized)"},{id:"owl-horst",name:"OWL-Horst"},{id:"owl2-ql-optimized",name:"OWL2-QL (Optimized)"},{id:"owl2-ql",name:"OWL2-QL"},{id:"owl-max-optimized",name:"OWL-Max (Optimized)"},{id:"owl-max",name:"OWL-Max"},{id:"owl2-rl-optimized",name:"OWL2-RL (Optimized)"},{id:"owl2-rl",name:"OWL2-RL"}],i={free:"free",eeWorker:"worker",eeMaster:"master",ontop:"ontop",se:"se",fedx:"fedx"},o=new RegExp("^[a-zA-Z0-9-_]+$"),a=new RegExp("^[0-9]+$"),s={id:"Unique identifier for the repository. The ID must contain only letters (a-z, A-Z), numbers (0-9), '-' and '_'.",title:"Human readable description of the repository.",readOnly:"Protects the repository against any changes.",ruleset:"Sets of axiomatic triples, consistency checks and entailment rules, which determine the applied semantics with a PIE file.",rulesetWarnings:{needsSameAs:"Disabling owl:sameAs for this ruleset may cause incomplete inference with owl:sameAs statements.",doesntNeedSameAs:"This ruleset does not need owl:sameAs, consider disabling it.",customRuleset:"If the custom ruleset does not use owl:sameAs, consider disabling it. <br>If the ruleset uses owl:sameAs, disabling it may cause incomplete inference with owl:sameAs statements."},disableSameAs:"GraphDB uses a non-rule implementation of owl:sameAs, which can be enabled or disabled independently of the ruleset.",checkForInconsistencies:"Enables the consistency checks from the ruleset.",isShacl:"Enables support for SHACL validation.",shaclOptions:{cacheSelectNodes:"The SHACL implementation retrieves a lot of its relevant data through running SPARQL Select queries against the repository and against the changes in the transaction. This is usually good for performance, but while validating large amounts of data disabling this cache will use less memory.",undefinedTargetValidatesAllSubjects:"If no target is defined for a NodeShape, that NodeShape will be ignored. Enabling this will make such NodeShapes wildcard shapes and validate all subjects. Equivalent to setting sh:targetClass to owl:Thing or rdfs:Resource in an environment with a reasoner.",logValidationPlans:"Log (INFO) the executed validation plans as GraphViz DOT. It is recommended to disable parallel validation when this is enabled.",logValidationViolations:"Log (INFO) a list of violations and the triples that caused the violations. It is recommended to disable parallel validation when this is enabled.",parallelValidation:"Run SHACL validation in parallel.",globalLogValidationExecution:"Log (INFO) every execution step of the SHACL validation. This is fairly costly and should not be used in production. It is recommended to disable parallel validation when this is enabled.",performanceLogging:"Log (INFO) the execution time per shape. It is recommended to disable parallel validation and caching of select nodes when this is enabled.",eclipseRdf4jShaclExtensions:"Activates RDF4J's SHACL extensions that provide additional functionality (experimental).",dashDataShapes:"Activates DASH Data Shapes extensions that provide additional functionality (experimental)."},entityIdSize:"Defines the bit size of internal IDs used to index entities (URIs, blank nodes, literals, and RDF* embedded triples).<br>Use 40 bit ID only if you expect more than 2 billion unique RDF values.",enableContextIndex:"Builds an additional Context-Predicate-Subject-Object index to boost the SPARQL query performance of queries with GRAPH/FROM/FROM NAMED clauses.",enablePredicateList:"Enables the mappings from an entity (subject or object) to its predicates; enabling it can significantly speed up queries that use wildcard predicate patterns.",queryTimeout:"Sets the number of seconds after which the evaluation of a query will be terminated; values less than or equal to zero mean no limit.",throwQueryEvaluationExceptionOnTimeout:"Repository throws QueryEvaluationException when the duration of a query execution exceeds the timeout parameter.",queryLimitResults:"Sets the maximum number of results returned from a query after which the evaluation of a query will be terminated; values less than or equal to zero mean no limit.",nonInterpretablePredicates:"Semicolon-delimited list of predicates (full URIs) that GraphDB will not try to process with the registered GraphDB plugins.",ontop:{driverType:"Determines the type of SQL database to connect to.",propertiesFile:"Describes the JDBC configuration such as hostname and database name to connect to.",hostName:"The JDBC hostname to connect to.",port:"The JDBC port to connect to if different from the default for the chosen JDBC driver.",portIfRequired:"The JDBC port to connect to.",databaseName:"The database name to connect to.",userName:"The username to use for the JDBC connection.",password:"The password to use for the JDBC connection.",driverClass:"Classname of the chosen JDBC driver. It must be on the classpath (in the lib directory).",driverClassWarning:"JDBC driver not found in the classpath, please save it in the lib directory and restart GraphDB",url:"The JDBC URL that will be used. It is constructed using the supplied hostname, port and database name.",obdaFile:"Describes the mapping from SQL to RDF in either the OBDA or the R2RML format.",owlFile:"Specifies relations between the classes and properties in the cosntructed RDF graph. It can be in any supported RDF format.",constraintFile:"Specifies override of SQL primary and foreign keys.",dbMetadataFile:"Specifies metadata for the SQL database.",testConn:"Attempts to establish a connection to the SQL database to test if the supplied configuration is correct."},fedx:{repositoryNotExistWarning:"The repository member has been removed from the local repositories",localReposInstructions:"Click on a repo to add a local repository as a member",withLogQueries:"Set whether to log queries",withDebugQueryPlan:"Whether to print the optimized query execution plan to stdout",enforceMaxQueryTime:"Max query time in seconds, 0 to disable",withIncludeInferredDefault:"Set whether to include inferred statements or not",withBoundJoinBlockSize:"Set the block size for bound joins",withJoinWorkerThreads:"Set the number of join worker threads for parallelization",withLeftJoinWorkerThreads:"Set the number of left join worker threads",unionWorkerThreads:"Set the number of union worker threads for parallelization",withLogQueryPlan:"Whether to log the query plan",withEnableServiceAsBoundJoin:"Whether external SERVICE clauses are evaluated using bound join",withSourceSelectionCacheSpec:"The cache specification for the SourceSelectionMemoryCache",removeMember:"Remove repository as a FedX member",editRepository:"Edit repository",setAsWritable:"Set repository as writable"}}},38:function(e,t){angular.module("graphdb.framework.rest.graphexplore.data.service",[]).factory("GraphDataRestService",a),a.$inject=["$http"];const n="rest/class-hierarchy",r="rest/domain-range",i="rest/dependencies/",o="rest/explore-graph/";function a(e){return{getClassHierarchyData:function(t){return e.get(n,{params:{graphURI:t}})},reloadClassHierarchy:function(t){return e.get(n,{params:{doReload:!0,graphURI:t}})},getClassInstances:function(t){return e.get(`${n}/class-instances`,{params:{targetUri:t}})},getDomainRangeData:function(t,n){return e.get(r,{params:{targetUri:t,collapsed:n}})},checkDomainRangeData:function(t){return e.head(r,{params:{targetUri:t}})},getRelationshipsData:function(t,n,r){return e.get(`${i}matrix`,{params:{mode:n,classes:_.map(t,(function(e){return e.name})),graphURI:r}})},getRelationshipsClasses:function(t,n){return e.get(`${i}classes`,{params:{mode:t,graphURI:n}})},getRelationshipsStatus:function(t){return e.get(`${i}status`,{params:{graphURI:t}})},calculateRelationships:function(t){return e.get(`${i}update`,{params:{graphURI:t}})},getPredicates:function(t,n,r){return e.get(`${i}predicates`,{params:{from:t,to:n,mode:"all",graphURI:r}})},getInstanceNode:function(t){return e.get(`${o}node`,{params:{iri:t}})},getInstanceNodeLinks:function(t){return e.get(`${o}links`,{params:{iri:t}})},getRdfsLabelAndComment:function(t,n,r){const i=r||{};return e({url:"rest/explore/details",method:"GET",params:_.extend(i,{uri:t,languages:n}),headers:{Accept:"application/json"}})}}}},50:function(e,t){function n(e){return{initLazyList:function(t,n,r,i,o){return e((function(){const e=t+i-1,a=Math.max(0-i,e),s=Math.min(e+n-1,o.length);a>s?r([]):$.isArray(o)&&r(o.slice(a,s+1))}),100,!0)}}}angular.module("graphdb.framework.graphexplore.services.uiscroll",[]).factory("UiScrollService",n),n.$inject=["$timeout"]},51:function(e,t){angular.module("graphdb.framework.graphexplore.services.rdfsdetails",[]).factory("RdfsLabelCommentService",(function(){return{processAndFilterLabelAndComment:function(e){function t(e){const t={};for(let n in e)if(e.hasOwnProperty(n)){let r=n;n.indexOf(":")>-1&&(r=n,n=n.split(":")[1].toLowerCase()),t[n]=e[r]}return t}const n=e.results.bindings,r=[],i=[];_.each(n,(function(e){let n;angular.isUndefined(e.label)||(n=t(e.label),r.push(n)),angular.isUndefined(e.comment)||(n=t(e.comment),i.push(n))}));const o=function(e){return"en"===e.lang||"de"===e.lang},a=$.grep(r,o)[0],s=$.grep(i,o)[0],u=angular.isUndefined(a)?r.length>0?r[0].value:void 0:a.value,c=angular.isUndefined(s)?i.length>0?i[0].value:void 0:s.value;return{rdfsLabel:u,rdfsComment:c}}}}))},52:function(e,t){angular.module("graphdb.framework.rest.graphexplore.savedgraphs.service",[]).factory("SavedGraphsRestService",r),r.$inject=["$http"];const n="rest/explore-graph/saved";function r(e){return{getSavedGraphs:function(){return e.get(n)},getSavedGraph:function(t){return e.get(`${n}/${encodeURIComponent(t)}`)},editSavedGraph:function(t){return e.put(`${n}/${encodeURIComponent(t.id)}`,t)},deleteSavedGraph:function(t){return e.delete(`${n}/${encodeURIComponent(t.id)}`)},addNewSavedGraph:function(t){return e.post(n,t)}}}},53:function(e,t){angular.module("graphdb.framework.rest.graphconfig.service",[]).factory("GraphConfigRestService",i);const n="rest/explore-graph/",r=`${n}config`;function i(e){return{getGraphConfigs:function(){return e.get(r)},getGraphConfigSamples:function(){return e.get(`${n}samples`)},loadGraphForConfig:function(t,n,i,o){return e.get(`${r}/graph/${encodeURIComponent(t.id)}?includeInferred=${n}&linksLimit=${i}&sameAsState=${o}`)},getConfig:function(t){return e.get(`${r}/${encodeURIComponent(t)}`)},createGraphConfig:function(t){return e.post(r,t)},updateGraphConfig:function(t){return e.put(`${r}/${encodeURIComponent(t.id)}`,t)},deleteGraphConfig:function(t){return e.delete(`${r}/${encodeURIComponent(t.id)}`)},validateQuery:function(t,r,i,o,a){return e({method:"POST",url:`${n}validate`,data:{query:t,queryType:r,params:i,all:o,oneOf:a}})}}}i.$inject=["$http"]},54:function(e,t,n){"use strict";n.r(t);n(4);const r=400,i=50,o=1500,a=25;function s(e,t,n,s,u,c,l,f,d,p,h,g,m,y,v){e.classHierarchyData={},e.instancesObj={},e.instancesQueryObj={},e.instancesObj.items=[],e.instancesNotFiltered=[],e.isWarningShowed=!1,e.onopen=e.onclose=()=>angular.noop(),e.currentBrowserLimit=2e3,g.firefox?e.currentBrowserLimit=i:(g.safari||g.msie||g.msedge)&&(e.currentBrowserLimit=r);const x={};let w=0,b=0;t.key="",x.get=function(t,n,r){return f.initLazyList(t,n,r,w,e.instancesObj.items)};let C=allGraphs;const S=function(){if(e.getActiveRepository())return v.resolveGraphs().success((function(t){e.graphsInRepo=t.results.bindings,M()})).error((function(t){e.repositoryError=getError(t),c.error(getError(t),"Error getting graphs")}))},M=function(){const t=m.get(`classHierarchy-selectedGraph-${s.getActiveRepository()}`);null!==t&&e.graphsInRepo.some(e=>e.contextID.uri===t.contextID.uri)?C=t:m.set(`classHierarchy-selectedGraph-${s.getActiveRepository()}`,C)};function T(t,n,r){e.classCountSlider.options&&e.classCountSlider.options.ceil!==n&&(e.classCountSlider={});var i;e.classCountSlider.value||(e.showExternalElements=!0,e.classCountSlider={value:n,options:{floor:1,ceil:n,vertical:!0,showSelectionBar:!0,onChange:function(){p(E,100,!0)}}},null===m.get(y.CLASS_HIERARCHY_CURRENT_SLIDER_VALUE)&&n>e.currentBrowserLimit&&(i=e.currentBrowserLimit,g.chrome?c.warning("Disabling animations for more than "+i+" classes.","Reducing visual effects"):c.warning(g.name+" performs poorly with more than "+i+" classes. Please consider using Chrome for more optimal performance.","Reducing visual effects")));const s=m.get(y.CLASS_HIERARCHY_SWITCH_PREFIXES);null!=s&&"true"!==s&&(e.showExternalElements=!0),r?e.classCountSlider.value=r:n>=o&&(e.classCountSlider.value=o,c.warning("Class count is reduced to "+o+" for faster initial load. Use the slider to see all classes.","Reducing class count")),n>=a&&!window.ActiveXObject&&"ActiveXObject"in window&&!e.isWarningShowed&&(e.classCountSlider.value=a,e.isWarningShowed=!0,c.warning("Class count is reduced to "+a+" for faster load in IE. If you want better performance please switch to different browser.","Reducing class count")),p((function(){e.$broadcast("reCalcViewDimensions")}),200),E();let u=0;$("rzslider").on("wheel",(function(t){t.preventDefault(),t.stopPropagation();const n=(new Date).getTime();if(!(n-u>100))return;u=n,t=t.originalEvent;let r=e.classCountSlider.value;t.deltaY<=-1?r+=1:t.deltaY>=1&&(r-=1),r!==e.classCountSlider.value&&r>=e.classCountSlider.options.floor&&r<=e.classCountSlider.options.ceil&&e.$apply((function(){e.classCountSlider.value=r,p(E,100,!0)}))}))}function E(){e.currentSliderValue=e.classCountSlider.value}function R(e){const t=e.fullName,r=e.name;l.checkDomainRangeData(t).success((function(e,i){204===i?c.warning("No domain-range data available for '"+r+"'"):(m.set(y.CLASS_HIERARCHY_LAST_SELECTED_CLASS,n.hash()),n.hash("").path("domain-range-graph").search("uri",t).search("name",r))})).error((function(){c.error("Request for "+r+" failed!")}))}function k(){n.replace().hash("1"),e.instancesObj.items=[],e.showExternalElements=!1,e.showClassInfoPanel=!1,m.clearClassHieararchyState(),e.hidePrefixes="true"===m.get(y.CLASS_HIERARCHY_HIDE_PREFIXES),e.currentSliderValue=void 0,e.classHierarchyData={},t.$broadcast("angucomplete-alt:clearInput")}function A(){e.hasClassHierarchy()&&p((function(){$("#toolbar").removeClass("ng-hide")}),0)}t.$watch((function(){return t.key}),(function(){w=0,_.each(e.instancesObj.items,(function(e){t.key>e&&w++})),b++})),x.revision=function(){return b},e.adapterContainer={adapter:{remain:!0}},e.$on("goToDomainRangeGraphView",(function(e,t){R(t)})),e.$on("classCount",T),e.$on("repositoryIsSet",(function(){if(I===s.getActiveRepository())return;I=s.getActiveRepository();if(e.repositoryError=null,!I)return;C=allGraphs,S().then(N)})),e.datasource=x,e.goToDomainRangeGraphView=R,e.toggleClassInfoSidePanel=function(){e.showClassInfoPanel=!e.showClassInfoPanel,t.$broadcast("sidePanelClosed")},e.getActiveRepositoryNoError=function(){if(!e.repositoryError)return s.getActiveRepository()},e.isSystemRepository=function(){return s.isSystemRepository()},e.confirmReloadClassHierarchy=function(){h.openSimpleModal({title:"Confirm operation",message:"Calculating class hierarchy data may take some time. Are you sure?",warning:!0}).result.then((function(){k(),e.loader=!0,e.hierarchyError=!1,l.reloadClassHierarchy(C.contextID.uri).success((function(t){e.loader=!1,e.classHierarchyData=t,A(),T()})).error((function(t){e.loader=!1,e.hierarchyError=getError(t),c.error(getError(t),"Request for RDF Class Hierarchy failed!")}))}))},e.focusOnRoot=function(){e.$broadcast("rootFocus")},e.copyToClipboard=function(e){h.openCopyToClipboardModal(e)},e.searchedClassCallback=function(e){if(e){const n={name:e.title};t.$broadcast("searchedClass",n)}},e.instancesQueryObj.query="",e.instancesFilterFunc=function(t){return t.resolvedUri.toLowerCase().indexOf(e.instancesQueryObj.query.toLowerCase())>=0},S(),e.$watch("instancesObj.items",(function(){e.instancesObj.items.length>0&&p((function(){e.adapterContainer.adapter.reload()}),30)})),e.$watch("selectedClass",(function(){e.showClassInfoPanel&&function(t){const n=t.fullName;let r=t.name;if(r===n){const e=r.lastIndexOf("#");r=r.substring(e+1)}e.encodedUri=encodeURIComponent(n);const i=encodeURIComponent("prefix onto:<http://www.ontotext.com/> select ?s from onto:disable-sameAs { ?s a <"+n+"> . }");e.viewInstancesUri="sparql?name="+r+"&infer=true&sameAs=false&query="+i+"&execute=true",l.getRdfsLabelAndComment(n).success((function(t){e.rdfsLabel=t.label,e.rdfsComment=t.comment,e.expanded=!1})).error((function(){c.error("Error getting rdfs:label and rdfs:comment")})),e.instancesQueryObj.query="",e.instancesLoader=!0,l.getClassInstances(n).success((function(t){e.instancesObj.items=[],_.each(t,(function(t,n){const r={};r.type=t.startsWith("<<")&&t.endsWith(">>")?"triple":"uri",r.absUri=encodeURIComponent(t),r.absUriNonEncoded=t,r.resolvedUri=n,e.instancesObj.items.push(r)})),e.instancesLoader=!1,e.instancesSearchPlaceholder=e.instancesObj.items.length<1e3?"Search class instances":"Search first 1000 class instances",e.instancesNotFiltered=e.instancesObj.items})).error((function(){c.error("Request for class instances for failed!")}))}(e.selectedClass)})),$(document).ready((function(){$(".prefix-toggle").click((function(){$(".tooltip").hide()}))}));let I=s.getActiveRepository();function N(){k(),e.isSystemRepository()||(e.hierarchyError=!1,e.loader=!0,l.getClassHierarchyData(C.contextID.uri).success((function(t,n){e.showExternalElements=!0,e.loader=!1,e.classHierarchyData=t,207===n&&c.warning("You can update the diagram by pressing the reload button.","Repository data has changed"),A()})).error((function(t){e.loader=!1,e.hierarchyError=getError(t),c.error(getError(t),"Request for RDF Class Hierarchy failed!")})))}e.hasClassHierarchy=function(){return e.classHierarchyData.classCount&&e.getActiveRepositoryNoError()&&!e.isSystemRepository()},e.chosenGraph=function(e){C=e,N(),m.set(`classHierarchy-selectedGraph-${s.getActiveRepository()}`,C)},e.getSelGraphValue=function(){return C.contextID.value},e.isAllGraphsSelected=function(){return"All graphs"===e.getSelGraphValue()}}angular.module("graphdb.framework.graphexplore.controllers.class",["pageslide-directive","ngAnimate","ui.scroll.jqlite","ui.scroll","angucomplete-alt","rzSlider","toastr","graphdb.framework.utils.localstorageadapter"]).controller("RdfClassHierarchyCtlr",s),s.$inject=["$scope","$rootScope","$location","$repositories","$window","toastr","GraphDataRestService","UiScrollService","RdfsLabelCommentService","$timeout","ModalService","bowser","LocalStorageAdapter","LSKeys","RDF4JRepositoriesRestService"]},55:function(e,t,n){"use strict";n.r(t);n(4);function r(e,t,n,r,i,o,a,s,u,c,l,f){e.predicatesObj={},e.predicatesQueryObj={},e.predicatesObj.items=[],e.predicatesQueryObj.query="",e.predicatesListNotFiltered=[],e.predicatesSearchPlaceholder="Search predicates",e.onopen=e.onclose=()=>angular.noop();const d={};let p=0,h=0;n.key="",d.get=function(t,n,r){return c.initLazyList(t,n,r,p,e.predicatesObj.items)},n.$watch((function(){return n.key}),(function(){p=0,_.each(e.predicatesObj.items,(function(e){n.key>e&&p++})),h++})),d.revision=function(){return h},e.adapterContainer={adapter:{remain:!0}};const g=a.get(s.DOMAIN_RANGE_COLLAPSE_EDGES);function m(){const e=a.get(s.CLASS_HIERARCHY_LAST_SELECTED_CLASS);t.search("").hash(e).path("hierarchy")}e.collapseEdges=null===g||"true"===g,e.datasource=d,e.$on("reloadDomainRangeGraphView",(function(e,n){const r=n.objectPropClassUri,i=n.objectPropClassName;t.path("domain-range-graph").search("uri",r).search("name",i)})),e.$on("switchEdgeMode",(function(e,n){t.path("domain-range-graph").search("uri",n.uri).search("name",n.name).search("collapsed",n.collapsed)})),e.$on("repositoryIsSet",(function(){if(y===i.getActiveRepository())return;y=i.getActiveRepository();m()})),e.$on("changeCollapsedEdgesState",(function(t,n){e.collapseEdges=!n,a.set(s.DOMAIN_RANGE_COLLAPSE_EDGES,e.collapseEdges)})),e.goToClassHierarchyView=m,e.copyToClipboard=function(e){l.openCopyToClipboardModal(e)},e.toggleCollapseEdgesState=function(){e.collapseEdges=!e.collapseEdges,o.history.pushState({collapsed:e.collapseEdges},"domainRangePage",null)},e.predicatesListFilterFunc=function(t){return t.resolvedUri.toLowerCase().indexOf(e.predicatesQueryObj.query.toLowerCase())>=0},e.$watch("predicatesObj.items",(function(){e.predicatesObj.items>0&&r((function(){e.adapterContainer.adapter.reload()}),30)})),e.$watch("selectedPredicate",(function(){e.showPredicatesInfoPanel&&function(t){const n=t.target,r=t.source;e.encodedUri=encodeURIComponent(t.uri),e.sourceTargetObjectNodeUri=n.objectPropClassUri?n.objectPropClassUri:r.objectPropClassUri,e.encodedSourceTargetObjectNodeUri=encodeURIComponent(e.sourceTargetObjectNodeUri),e.sourceTargetObjectNodeName=n.objectPropClassName?n.objectPropClassName:r.objectPropClassName?r.objectPropClassName:"<i>Literal</i>",-1===e.sourceTargetObjectNodeName.indexOf("Literal")?u.getRdfsLabelAndComment(e.sourceTargetObjectNodeUri).success((function(t){e.rdfsLabel=t.label,e.rdfsComment=t.comment})).error((function(){f.error("Error getting rdfs:label and rdfs:comment")})):(e.rdfsComment=void 0,e.rdfsLabel=void 0);e.predicatesObj.items=[],e.predicatesQueryObj.query="";const i=n.allEdges?n.allEdges:r.allEdges;_.each(i,(function(t){const n={};n.absUri=encodeURIComponent(t.uri),n.absUriNonEncoded=t.uri,n.resolvedUri=t.name,n.isImplicit=t.implicit,e.predicatesObj.items.push(n)})),e.predicatesListNotFiltered=e.predicatesObj.items}(e.selectedPredicate)})),$(document).ready((function(){$(".compact-mode-toggle").click((function(){$(".tooltip").hide()}))}));let y=i.getActiveRepository()}angular.module("graphdb.framework.graphexplore.controllers.domainrange",["ui.scroll.jqlite","ui.scroll","ngSanitize","graphdb.framework.utils.localstorageadapter"]).controller("DomainRangeGraphCtlr",r),r.$inject=["$scope","$location","$rootScope","$timeout","$repositories","$window","LocalStorageAdapter","LSKeys","GraphDataRestService","UiScrollService","ModalService","toastr"]},56:function(e,t,n){(function(e){const t={WAIT:"WAIT",NO_REPO:"NO_REPO",READY:"READY",IN_PROGRESS:"IN_PROGRESS",ERROR:"ERROR"},n={contextID:{type:"all",value:"All graphs",uri:""}};function r(e){if(e<1e3)return e;const t=Math.floor(Math.log(e)/Math.log(1e3));let n=e/Math.pow(1e3,t);return n=n%1>1/Math.pow(1e3,t-1)?n.toFixed(2):n.toFixed(0),n+["K","M","G","T","P","H"][t-1]}function i(e,r,i,o,a,s,u,c,l,f){let d=null;e.status=i.getActiveRepository()?t.WAIT:t.NO_REPO;let p=n;const h=function(){f.resolveGraphs().success((function(t){e.graphsInRepo=t.results.bindings,g(),e.isSystemRepository()?"READY"!==e.status&&y():(e.status="WAIT",y(!0))})).error((function(t){e.repositoryError=getError(t),o.error(getError(t),"Error getting graphs")}))},g=function(){const t=l.get(`dependencies-selectedGraph-${i.getActiveRepository()}`);null!==t&&e.graphsInRepo.some(e=>e.contextID.uri===t.contextID.uri)?p=t:l.set(`dependencies-selectedGraph-${i.getActiveRepository()}`,p)},m=function(n){d3.select("#dependencies-chord").html(""),e.status=t.WAIT,s.getRelationshipsData(n,e.direction,p.contextID.uri).success((function(n){e.dependenciesData={matrix:n.right,nodes:n.left,hasLinks:_.sum(_.map(n.right,(function(e){return _.sum(e)})))>0,direction:e.direction},e.status=t.READY})).error((function(n){e.status=t.READY,o.error(getError(n),"Could not get dependencies count")}))},y=function(n){(e.status!==t.READY||n)&&(e.status=t.WAIT,s.getRelationshipsStatus(p.contextID.uri).success((function(n){if(e.status=n,e.status===t.IN_PROGRESS){if(null!==d)return;d=a(y,2e3)}e.status===t.READY&&(null!==d&&(a.cancel(d),d=null),s.getRelationshipsClasses(e.direction,p.contextID.uri).success((function(t,n){e.allClasses.items=_.filter(t,b),e.allNotFilteredClasses=t,e.selectedClasses=void 0,angular.isUndefined(e.selectedClasses)&&(e.selectedClasses=t.slice(0,10)),m(e.selectedClasses),207===n&&o.warning("You can update the diagram by pressing the reload button.","Repository data has changed")}))),0===e.status.indexOf("ERROR;")&&(e.status=t.ERROR,o.error("There was an error while calculating dependencies: "+e.status.substring("ERROR;".length)))})).error((function(n){e.status=t.ERROR,o.error(getError(n),"Could not get dependencies count status!")})))};e.allClasses={},e.allClasses.items=[],e.allNotFilteredClasses=[],e.direction="all";const v={};let x=0,w=0;function b(t){return-1!==t.name.toLowerCase().indexOf(e.classQuery.query.toLowerCase())}r.key="",v.get=function(t,n,r){return u.initLazyList(t,n,r,x,e.allClasses.items)},r.$watch((function(){return r.key}),(function(){x=0,_.each(e.allClasses.items,(function(e){r.key>e&&x++})),w++})),v.revision=function(){return w},e.datasource=v,e.adapterContainer={adapter:{remain:!0}},e.classQuery={},e.classQuery.query="",e.classFilterFunc=b,e.$watch("allClasses.items",(function(){e.allClasses.items.length>0&&a((function(){e.adapterContainer.adapter.reload()}),30)})),e.$watch("direction",(function(){!i.getActiveRepository()||e.isSystemRepository()||i.isActiveRepoFedXType()||h()})),e.$on("$destroy",(function(){a.cancel(d)})),e.isLoading=function(){return e.status===t.IN_PROGRESS||e.status===t.WAIT},e.confirmCalculateDependencies=function(){c.openSimpleModal({title:"Confirm operation",message:"Calculating relationships data may take some time. Are you sure?",warning:!0}).result.then((function(){e.calculateDependencies()}))},e.calculateDependencies=function(){e.status=t.WAIT,e.selectedClasses=void 0,s.calculateRelationships(p.contextID.uri).success((function(e){0===e.indexOf("ERROR;")?o.error("There was an error while calculating dependencies: "+e.substring("ERROR;".length)):y()})).error((function(e){o.error("Could not force dependencies count"+getError(e))}))},e.addClass=function(t){e.selectedClasses.push(t),m(e.selectedClasses)},e.removeClass=function(t){_.remove(e.selectedClasses,(function(e){return e.name===t.name})),m(e.selectedClasses)},e.showClass=function(t){e.classToShow=t},e.isClassByNameShown=function(t){return void 0!==_.find(e.selectedClasses,{name:t})},e.addClassByName=function(t){e.selectedClasses.push(_.find(e.allClasses.items,{name:t})),m(e.selectedClasses)},e.removeClassByName=function(t){_.remove(e.selectedClasses,(function(e){return e.name===t})),m(e.selectedClasses)},e.removeAllClasses=function(){e.selectedClasses=[],m(e.selectedClasses)},e.isSystemRepository=function(){return"SYSTEM"===i.getActiveRepository()};const C=e.$on("repositoryIsSet",(function(){e.classQuery={},e.classQuery.query="",e.repositoryError=null,p=n,i.getActiveRepository()&&!i.isActiveRepoFedXType()?h():e.status=t.NO_REPO}));window.addEventListener("beforeunload",(function e(){C(),window.removeEventListener("beforeunload",e)})),e.selectGraph=function(e){p=e,y(!0),l.set(`dependencies-selectedGraph-${i.getActiveRepository()}`,p)},e.getSelectedGraphValue=function(){return p.contextID.value},e.isAllGraphsSelected=function(){return"All graphs"===e.getSelectedGraphValue()}}Object.defineProperty(e,"allGraphs",{get:()=>n}),angular.module("graphdb.framework.graphexplore.controllers.dependencies",["ui.scroll.jqlite","ui.scroll","toastr","ui.bootstrap","graphdb.framework.core.services.repositories","graphdb.framework.utils.localstorageadapter"]).controller("DependenciesChordCtrl",i).config(["$tooltipProvider",function(e){e.options({appendToBody:!0})}]).filter("humanize",(function(){return r})),i.$inject=["$scope","$rootScope","$repositories","toastr","$timeout","GraphDataRestService","UiScrollService","ModalService","LocalStorageAdapter","RDF4JRepositoriesRestService"]}).call(this,n(3))},57:function(e,t,n){"use strict";n.r(t);n(2);var r=n(206),i=n(209),o=n.n(i),a=(n(4),n(37));function s(e,t,n,i,s,u,c,l,f,d,p,h,g,m,y,v,x,w,b,C){e.languageChanged=!1,e.propertiesObj={},e.propertiesQueryObj={},e.propertiesObj.items=[],e.propertiesNotFiltered=[],e.searchVisible=!1,e.nodeSelected=!1,e.queryResultsMode=!1,e.embedded=d.search().embedded,e.openedNodeInfoPanel=void 0,e.invalidLimit=!1,e.INVALID_LINKS_MSG="Invalid links limit",e.INVALID_LINKS_TOOLTIP="The valid limit range is 1-1000",e.onopen=e.onclose=()=>angular.noop(),e.embedded&&(d.search().query||d.search().uri||d.search().config||d.search().saved)&&(e.noGoHome=!0);const S={};let M=0,T=0,E={},R=0;const k=16,A=d3.behavior.zoom().scaleExtent([.5,10]);let I;const N=1e3,L=1e3;let D,O;function P(e){g.openCopyToClipboardModal(e)}function q(t){const n=t.appSettings;e.defaultSettings.includeInferred=n.DEFAULT_INFERENCE,e.defaultSettings.sameAsState=n.DEFAULT_INFERENCE&&n.DEFAULT_SAMEAS,e.defaultSettings.includeSchema=n.DEFAULT_VIS_GRAPH_SCHEMA;const r=v.get(x.GRAPHS_VIZ);if(r&&"object"==typeof r)try{e.saveSettings=r,void 0===e.saveSettings.includeSchema&&(e.saveSettings.includeSchema=e.defaultSettings.includeSchema,e.saveSettings.rejectedPredicates=[...e.saveSettings.rejectedPredicates,...e.defaultSettings.rejectedPredicates].unique())}catch(t){e.saveSettings=angular.copy(e.defaultSettings),v.set(x.GRAPHS_VIZ,e.saveSettings)}else e.saveSettings=angular.copy(e.defaultSettings)}t.key="",S.get=function(t,n,r){return h.initLazyList(t,n,r,M,e.propertiesObj.items)},t.$watch((function(){return t.key}),(function(){M=0,_.each(e.propertiesObj.items,(function(e){t.key>e&&M++})),T++})),S.revision=function(){return T},e.datasource=S,e.adapterContainer={adapter:{remain:!0}},e.propertiesQueryObj.query="",e.propertiesSearchPlaceholder="Search instance properties",e.propertiesFilterFunc=function(t){return t.key.toLowerCase().indexOf(e.propertiesQueryObj.query.toLowerCase())>=0},e.resetState=function(){e.searchVisible=!1,e.nodeSelected=!1,e.configLoaded=null,e.queryResultsMode=!1,e.lastSavedGraphName=null,e.lastSavedGraphId=null,e.shared=!1,e.numberOfPinnedNodes=0,E={},R=0},e.pushHistory=function(t,n){e.embedded&&(t.embedded=!0),d.search(t),d.state(n)},e.goToHome=function(){e.resetState(),d.url("graphs-visualizations")},e.shouldShowSettings=function(){return e.configLoaded&&e.configLoaded.id===e.defaultGraphConfig.id},e.shouldDisableSameAs=function(){const t=$("#sameAsCheck");return e.settings&&!e.settings.includeInferred&&t.prop("checked")&&(t.prop("checked",!1),e.settings.sameAsState=!1),e.settings&&!e.settings.includeInferred},e.$watch("propertiesObj.items",(function(){angular.isDefined(e.propertiesObj.items)&&e.propertiesObj.items.length>0&&s((function(){e.adapterContainer.adapter.reload()}),500)})),e.toggleMoreInfo=function(e){angular.element(e.currentTarget).parent().next().toggle(200),angular.element(e.currentTarget).children("span").toggleClass("icon-caret-down").toggleClass("icon-caret-up")},e.copyToClipboard=P,e.defaultSettings={linksLimit:20,includeInferred:!0,sameAsState:!0,languages:["en"],showLinksText:!0,preferredTypes:[],rejectedTypes:[],preferredPredicates:[],rejectedPredicates:["http://dbpedia.org/property/logo","http://dbpedia.org/property/hasPhotoCollection","http://dbpedia.org/property/website","http://dbpedia.org/property/homepage","http://dbpedia.org/ontology/thumbnail","http://xmlns.com/foaf/0.1/depiction","http://xmlns.com/foaf/0.1/homepage","http://xmlns.com/foaf/0.1/mbox","http://dbpedia.org/ontology/wikiPage*","http://dbpedia.org/property/wikiPage*","http://factforge.net/*"],preferredTypesOnly:!1,preferredPredicatesOnly:!1,includeSchema:!0},e.saveSettings=angular.copy(e.defaultSettings);const z=p.getPrincipal();function U(){e.settings.languagesMap=_.map(e.settings.languages,(function(e){return{text:e}})),e.settings.preferredTypesMap=_.map(e.settings.preferredTypes,(function(e){return{text:e}})),e.settings.rejectedTypesMap=_.map(e.settings.rejectedTypes,(function(e){return{text:e}})),e.settings.preferredPredicatesMap=_.map(e.settings.preferredPredicates,(function(e){return{text:e}})),e.settings.rejectedPredicatesMap=_.map(e.settings.rejectedPredicates,(function(e){return{text:e}}))}z?q(z):e.$on("securityInit",(function(){q(p.getPrincipal())})),e.resetSettings=function(){e.settings=angular.copy(e.defaultSettings),e.validateLinksLimit(),U()},e.changeLimit=function(t){let n=e.settings.linksLimit+t;n<1&&(n=1),n>1e3&&(n=1e3),e.settings.linksLimit=n},e.validateLinksLimit=function(){e.invalidLimit=!a.NUMBER_PATTERN.test(e.settings.linksLimit)},e.showSettings=function(){e.showInfoPanel=!0,e.showFilter=!0,e.showNodeInfo=!1,e.showPredicates=!1,e.saveSettings?e.settings=angular.copy(e.saveSettings):e.settings=angular.copy(e.defaultSettings),U()},e.reExpandNode=function(){e.rootNodeIri&&e.$broadcast("onRootNodeChange",e.rootNodeIri)};const j=function(t,n,r){const o=void 0===n?e.saveSettings.sameAsState:!0===n,a=void 0===r?e.saveSettings.includeInferred:!0===r;e.loading=!0,u({url:"rest/explore-graph/graph",method:"POST",headers:{"Content-Type":"application/json"},data:{query:t,linksLimit:e.saveSettings.linksLimit,languages:e.shouldShowSettings()?e.saveSettings.languages:[],includeInferred:a,sameAsState:o}}).then((function(e){he(e)}),(function(t){e.loading=!1,i.error(getError(t.data),"Cannot load visual graph!")}))};function Q(e){return e.replace(/[()']/g,"")}function F(e,t){let n=e.split(" ");return t?[n[0],n[1],n[2]].join(">"):[n[0],n[2]].join(">")}function H(e){return[e.source.iri,e.target.iri].join(">")}function G(e){if(e.isTriple){let t=document.getElementById(Q(F(e.iri)));if(t&&void 0!==t.__data__.x)return t.__data__.x}return e.x}function B(e){if(e.isTriple){let t=document.getElementById(Q(F(e.iri)));if(t&&void 0!==t.__data__.y)return t.__data__.y}return e.y}function V(e){let t=e.trim().split(" ");return`<<<${t[0]}> <${t[1]}> <${t[2]}>>>`}function W(e){return Q(`${e.source.isTriple?F(e.source.iri,!0):e.source.iri}>${e.target.isTriple?F(e.target.iri,!0):e.target.iri}>marker`)}function Y(){this.nodes=[],this.links=[],this.tripleNodes=new Map,this.tripleLinksCopy=new Map,this.addNode=function(e,t,n){return e.x=t,e.y=n,this.nodes.push(e),e},this.computeConnectedness=function(){const e={},t={};_.each(this.links,(function(n){const r=n.source.iri,i=n.target.iri,o=_.min([r,i])+"|"+_.max([r,i]);t[o]||(t[o]=1,e[r]=(e[r]||0)+1,e[i]=(e[i]||0)+1)})),_.each(this.links,(function(t){e[t.source.iri]>1&&e[t.target.iri]>1?t.connectedness=Math.min(5,Math.max(e[t.source.iri],e[t.target.iri])-1):t.connectedness=0}))},this.addAndMatchLinks=function(e){const t=this.nodes;Array.prototype.push.apply(this.links,function(e,t){return _.map(e,(function(e){let n,r;n=e.isTripleSource?Ce(e.source):_.find(t,(function(t){return t.iri===e.source})),r=e.isTripleTarget?Ce(e.target):_.find(t,(function(t){return t.iri===e.target}));let i={source:n,target:r,predicates:e.predicates};if(e.isTripleSource||e.isTripleTarget){let e=`${i.source.isTriple?F(i.source.iri):i.source.iri}>${i.target.isTriple?F(i.target.iri):i.target.iri}`;if(X.tripleLinksCopy.has(e)){let t=X.tripleLinksCopy.get(e);return t[0].predicates.push(...i.predicates),t.push(i),X.tripleLinksCopy.set(e,t),null}X.tripleLinksCopy.set(e,[i])}return i}))}(e,t));for(let e of X.tripleLinksCopy.keys())1===X.tripleLinksCopy.get(e).length&&X.tripleLinksCopy.delete(e);this.links=this.links.filter(e=>null!==e),this.computeConnectedness()};const t=function(e,t){return n(e,t).length};function n(e,t){return _.filter(t,(function(t){return t.source.iri===e.iri||t.target.iri===e.iri}))}this.countLinks=t,this.linksTypes=function(e,t){const r=n(e,t),i=_.map(r,(function(t){return t.source.iri===e.iri?t.target.types:t.source.types}));return _.uniq(_.flatten(i))},this.linksPredicates=function(e,t){const r=n(e,t),i=_.map(r,(function(e){return e.predicates}));return _.uniq(_.flatten(i))},this.removeTriples=function(e){let t=[];this.tripleNodes.size>0&&e.forEach(e=>{this.tripleNodes.has(e)&&(this.tripleNodes.delete(e),this.links=_.reject(this.links,(function(n){let r=e.split(">"),i=F(n.source.iri),o=F(n.target.iri);if(i===e&&X.tripleNodes.delete(o)){let e=o.split(">");t.push({source:e[0],target:e[1]})}let a=i===e||o===e||n.source.iri===r[0]&&n.target.iri===r[1];return a&&(X.tripleLinksCopy.delete(`${i}>${o}`),X.tripleLinksCopy.delete(`${o}>${i}`)),a})))}),t.forEach(e=>{this.links=_.reject(this.links,(function(t){return t.source.iri===e.source&&t.target.iri===e.target}))})},this.removeNode=function(n){let r=[];this.links=_.reject(this.links,(function(e){let t=e.source.iri===n.iri||e.target.iri===n.iri;return t&&(e.target.isTriple&&r.push(F(e.target.iri)),e.source.isTriple||e.target.isTriple||r.push([e.source.iri,e.target.iri].join(">"))),t})),this.removeTriples(r);const i=this.links;this.nodes=_.reject(this.nodes,(function(e){return 0===t(e,i)})),0===this.nodes.length&&(e.nodeSelected=!1),this.computeConnectedness()},this.removeNodeLeafLinks=function(e){let r=[],i=this.links;this.links=_.reject(this.links,(function(o){let a=o.source.iri===e.iri&&1===t(o.target,i)&&!o.target.isTriple||o.target.iri===e.iri&&1===t(o.source,i)&&!o.source.isTriple;if(!a){let r;if(o.source.iri!==e.iri||2!==t(o.target,i)||o.target.isTriple?o.target.iri!==e.iri||2!==t(o.source,i)||o.source.isTriple||(r=n(o.source,i)):r=n(o.target,i),!r)return!1;a=(r[0].source.iri===e.iri||r[0].target.iri)&&(r[1].source.iri===e.iri||r[1].target.iri)}return a&&(o.target.isTriple&&r.push(F(o.target.iri)),o.source.isTriple||o.target.isTriple||r.push([o.source.iri,o.target.iri].join(">"))),a})),this.removeTriples(r),i=this.links,this.nodes=_.reject(this.nodes,(function(n){return 0===t(n,i)&&n.iri!==e.iri})),this.computeConnectedness()},this.addTriple=function(e,t,n){e.x=t,e.y=n,e.weight=0;let r=F(e.iri);if(this.tripleNodes.has(r)){let t=this.tripleNodes.get(r);t.push(e),this.tripleNodes.set(r,t)}else e.weight=10,this.tripleNodes.set(r,[e])},this.copyState=function(){const e=_.map(this.nodes,(function(e){return{iri:e.iri,isTriple:e.isTriple,size:e.size,labels:angular.copy(e.labels),types:angular.copy(e.types),rdfRank:e.rdfRank,x:e.x,y:e.y,fixed:e.fixed}})),t=JSON.stringify(Array.from(this.tripleNodes.entries())),n=JSON.stringify(Array.from(this.tripleLinksCopy.entries()));return{nodes:e,links:_.map(this.links,(function(e){return{source:e.source.iri,isTripleSource:e.source.isTriple,target:e.target.iri,isTripleTarget:e.target.isTriple,predicates:e.predicates}})),tripleNodes:t,tripleLinksCopy:n,colorIndex:R,type2color:E,scale:A.scale(),translate:A.translate()}},this.restoreState=function(t){e.nodeSelected=!0,e.searchVisible=!1,this.nodes=angular.copy(t.nodes),this.tripleNodes=t.tripleNodes?new Map(JSON.parse(t.tripleNodes)):new Map,this.links=[],this.addAndMatchLinks(t.links),this.tripleLinksCopy=t.tripleLinksCopy?new Map(JSON.parse(t.tripleLinksCopy)):new Map,_.each(this.nodes,(function(t){t.fixed&&e.numberOfPinnedNodes++})),angular.isDefined(t.colorIndex)&&angular.isDefined(t.type2color)&&(R=t.colorIndex,E=angular.copy(t.type2color)),angular.isDefined(t.translate)&&angular.isDefined(t.scale)&&(I="translate("+t.translate[0]+", "+t.translate[1]+") scale("+t.scale+")",A.translate(t.translate),A.scale(t.scale)),le()}}e.updateSettings=function(){e.invalidLimit?i.error(e.INVALID_LINKS_TOOLTIP,e.INVALID_LINKS_MSG):(e.saveSettings=e.settings,e.saveSettings.languages=_.map(e.saveSettings.languagesMap,(function(e){return e.text})),e.saveSettings.preferredTypes=_.map(e.saveSettings.preferredTypesMap,(function(e){return e.text})),e.saveSettings.rejectedTypes=_.map(e.saveSettings.rejectedTypesMap,(function(e){return e.text})),e.saveSettings.preferredPredicates=_.map(e.saveSettings.preferredPredicatesMap,(function(e){return e.text})),e.saveSettings.rejectedPredicates=_.map(e.saveSettings.rejectedPredicatesMap,(function(e){return e.text})),e.rootNodeIri?e.reExpandNode(e.rootNodeIri):e.queryResultsMode&&d.search().query?j(d.search().query,d.search().sameAs,d.search().inference):"query"===e.configLoaded.startMode&&e.loadGraphConfig(e.configLoaded),e.saveSettings.showLinksText?d3.selectAll("svg .link-wrapper text").style("display","block"):d3.selectAll("svg .link-wrapper text").style("display","none"),e.showInfoPanel=!1,e.showFilter=!1,v.set(x.GRAPHS_VIZ,e.saveSettings))},e.showInfoPanel=!1;let X=new Y;e.defaultGraphConfig={id:"default",name:"Easy graph",startMode:"search"},e.getGraphConfigs=function(t){b.getGraphConfigs().success((function(n){e.graphConfigs=n,t&&t()})).error((function(e){i.error(getError(e),"Could not get graph configs")}))},e.loadConfigForId=function(t,n){t===e.defaultGraphConfig.id?e.loadGraphConfig(e.defaultGraphConfig):b.getConfig(t).success((function(t){e.loadGraphConfig(t),n()})).error((function(e){i.error(getError(e),"Could not load config "+t)}))},e.findConfigById=function(t){return t===e.defaultGraphConfig.id?e.defaultGraphConfig:$.grep(e.graphConfigs,(function(e){return e.id===t}))[0]},e.easyGraphSearch=function(t){e.configLoaded=e.defaultGraphConfig,e.openUri(t)},e.loadGraphConfig=function(t){e.configLoaded=t,"search"===t.startMode?e.searchVisible=!0:"node"===t.startMode&&t.startIRI?s((function(){e.openUri(t.startIRI,!0)}),0):"query"===t.startMode&&t.startGraphQuery&&(e.loading=!0,b.loadGraphForConfig(t,t.startQueryIncludeInferred,e.saveSettings.linksLimit,t.startQuerySameAs).then((function(e){he(e)}),(function(t){e.loading=!1,i.error(getError(t),"Could not load graph from config")})))},e.deleteConfig=function(t){g.openSimpleModal({title:"Confirm",message:"Are you sure you want to delete the graph config '"+t.name+"'?",warning:!0}).result.then((function(){b.deleteGraphConfig(t).success((function(){e.getGraphConfigs(),e.refreshSavedGraphs()})).error((function(e){i.error(getError(e),"Could not delete graph config")}))}))},e.goToGraphConfig=function(t){e.pushHistory({config:t.id},{config:t}),e.resetState(),e.loadGraphConfig(t)},y.onpopstate=function(t){e.resetState(),t.state&&(t.state.config?(e.loadGraphConfig(t.state.config),t.state.uri&&e.openUri(t.state.uri,!0)):t.state.savedGraph&&e.loadSavedGraph(t.state.savedGraph,!0))};const J=function(){d.search().query?(e.searchVisible=!1,e.queryResultsMode=!0,j(d.search().query,d.search().sameAs,d.search().inference)):e.$on("onRootNodeChange",(function(t,n){e.loading=!0,angular.isDefined(n)&&(e.rootNodeIri=n,u({url:"rest/explore-graph/node",method:"GET",params:{iri:n,config:e.configLoaded?e.configLoaded.id:e.defaultGraphConfig.id,languages:e.shouldShowSettings()?e.saveSettings.languages:[],includeInferred:e.saveSettings.includeInferred,sameAsState:e.saveSettings.sameAsState}}).then((function(t){e.nodeSelected=!0,e.searchVisible=!1,null===t.data.types&&(t.data.types="greyColor"),X=new Y;const n=X.addNode(t.data,N/2,L/2);I="translate(0, -70) scale(1)",A.translate([0,-70]),A.scale(1),me(n,!0)})).catch((function(t){e.loading=!1,i.error(getError(t),"Could not load visual graph")})))})),d.search().uri&&e.openUri(d.search().uri),d.search().saved&&w.getSavedGraph(d.search().saved).success((function(t){e.loadSavedGraph(t)})).error((function(e){const t=getError(e);i.error(t,"Error! Could not open saved graph")}))},Z=function(){d.search().config?e.loadConfigForId(d.search().config,J):d.search().query||d.search().uri?(e.loadGraphConfig(e.defaultGraphConfig),J()):J()};function K(t){!n.getActiveRepository()||e.hasInitedRepository&&!t||(e.hasInitedRepository=!0,t||e.getGraphConfigs(Z),e.getNamespacesPromise=C.getNamespaces(e.getActiveRepository()).success((function(t){const n=_.map(t.results.bindings,(function(e){return{uri:e.namespace.value,prefix:e.prefix.value}}));e.namespaces=_.sortBy(n,(function(e){return e.uri.length})),ee()})).error((function(e){i.error(getError(e),"Cannot get namespaces for repository. View will not work properly!")})))}function ee(){e.getAutocompletePromise=l.checkAutocompleteStatus()}e.replaceIRIWithPrefix=function(t){const n=e.namespaces,r=_.findLast(n,(function(e){return 0===t.indexOf(e.uri)}));return r?r.prefix+":"+t.substring(r.uri.length):t},e.addedTag=function(t){return t.text.indexOf(":")<0?(i.warning("Enter an absolute full or prefixed IRI"),null):(t.text=function(e,t){if(!/^<?(http|urn).*>?/.test(e)){const n=e.split(":"),r=n[0],i=n[1];if(!angular.isUndefined(i)){const e=c.getNamespaceUriForPrefix(t,r);if(e)return e+i}}return e}(t.text,e.namespaces),e.pageslideExpanded=!0,t)},e.validateTag=function(e,t,n){if(e.text.indexOf(":")<0)return n?i.warning("Enter an absolute full or prefixed IRI, optionally ending in *",t):i.warning("Enter an absolute full or prefixed IRI",t),!1;const r=e.text.indexOf("*");if(r>=0){if(!n)return i.warning("Wildcards not allowed here",t),!1;if(r<e.text.length-1)return i.warning("Wildcard allowed only as the last character",t),!1}return!0},e.getTagClass=function(e){return e.endsWith("*")?"tag-item-wildcard":null},e.getActiveRepository=function(){return n.getActiveRepository()},e.hasInitedRepository=!1,e.$on("autocompleteStatus",(function(){ee()})),e.$on("repositoryIsSet",(function(t,n){n.newRepo&&(e.hasInitedRepository=!1),K(n.newRepo),n.newRepo&&(e.resetState(),$(".graph-visualization svg").empty(),d.search().query&&(e.goToHome(),J()))})),K();const te=500,ne=1.75,re=d3.scale.linear().domain([0,9]).range(["hsl(0, 100%, 75%)","hsl(360, 90%, 82%)"]).interpolate(d3.interpolateHslLong),ie=d3.scale.linear().domain([0,9]).range(["hsl(180, 50%, 75%)","hsl(540, 40%, 82%)"]).interpolate(d3.interpolateHslLong);e.getColor=function(e){angular.isUndefined(E[e])&&(E[e]=R,R++);const t=E[e];return t>39?"#c2c2c2":t%2==0?re(t/2):ie(t/2)};const oe=d3.layout.force().gravity(.07).size([N,L]),ae=d3.select(".main-container .graph-visualization").append("svg").attr("viewBox","0 0 "+N+" "+L).attr("preserveAspectRatio","xMidYMid meet");let se=0,ue=0;const ce=new function(){this.state=!1,this.setLoadingState=function(e){this.state=e},this.getLoadingState=function(){return this.state},this.init=function(e,t){d3.select(t).append("circle").attr("cx",(function(){return e.x})).attr("cy",(function(){return e.y})).attr("class","loader-container").attr("r",(function(){return e.size})).style("fill","fff").style("opacity","0.7"),d3.select(t).append("image").attr("xlink:href","js/angular/templates/loader/ot-loader.svg?v=1.11.1").attr("x",(function(){return e.x-e.size+5})).attr("y",(function(){return e.y-e.size})).attr("width",(function(){return 2*e.size})).attr("height",(function(){return 2*e.size})).attr("class","node-loader")}};function le(t){d3.selectAll("svg g").remove(),d3.selectAll("svg rect").remove(),d3.selectAll(".d3-tip").remove(),d3.selectAll(".menu-events").remove(),A.on("zoom",(function(){I="translate("+d3.event.translate+") scale("+d3.event.scale+")",n.attr("transform",I)})),ae.append("rect").attr("width",10*N).attr("height",10*L).attr("x",-(10*N-N)/2).attr("y",-(10*L-L)/2).style("fill","none").style("pointer-events","all").call(A).on("click",(function(){d3.event.stopPropagation(),ye(),oe.stop()}));const n=ae.append("g").attr("class","nodes-container").attr("transform",(function(){return angular.isDefined(I)&&!t?I:""})),a=o()().attr("class","d3-tip").customPosition((function(){const e=D.getBoundingClientRect();return{top:e.bottom+10+"px",left:e.left-30+"px"}})).html((function(t){let n="";return t.fixed&&(n+='<i class="icon-pin"></i>&nbsp;&nbsp;'),t.types.length>0?n+=_.join(_.map(t.types,(function(t){return e.replaceIRIWithPrefix(t)}))," · "):n+="<i>No types</i>",n})),u=function(e){let t="";return t+=_.join(_.map(e.predicates,(function(t,n){if(0===n)return Me(t);if(n<10)return" · "+Me(t);if(10===n){const t=function(e){return e.predicates.length-10}(e);return" · more "+(t>1?t+" predicates":t+" predicate")+" to show"}})),""),t};let c;const l=o()().attr("class","d3-tip").customPosition((function(e){const t=c.getBoundingClientRect(),n=function(e){const t=u(e),n=document.createElement("canvas").getContext("2d");return n.font="13px Arial",e.predicates.length<10?n.measureText(t).width:n.measureText(t).width/2}(e);return{top:t.top-30+"px",left:t.left-30+"px",width:n+"px"}})).html((function(e){return u(e)}));const f=function(){s.cancel(void 0),s.cancel(se),D=null,a.hide(),ue=s((function(){ye()}),500)};ae.call(a);ae.call(l);let d=ae.selectAll(".link"),p=ae.selectAll(".node");oe.nodes(X.nodes).charge(-3e3),oe.links(X.links).linkDistance((function(e){return e.source.isTriple||e.target.isTriple?0:function(e){const t=$("<span></span>"),n=e.predicates[0].split("/"),r=n[n.length-1];t.addClass("predicate-text").text(r),$("body").append(t);const i=t.width()+2*e.source.size+2*e.target.size+50;return t.remove(),.75*i}(e)+30*e.connectedness})),n.append("defs").selectAll("marker").data(oe.links()).enter().append("marker").attr("class","arrow-marker").attr("id",(function(e){return W(e)})).attr("viewBox","0 -5 10 10").attr("refX",(function(e){return e.target.isTriple?11:e.target.size+11})).attr("refY",0).attr("markerWidth",10).attr("markerHeight",10).attr("orient","auto").append("path").attr("d","M0,-5L10,0L0,5 L10,0 L0, -5"),d=n.selectAll(".link").data(X.links).enter().append("g").attr("class","link-wrapper").attr("id",(function(e){return Q(H(e))})).append("line").attr("class","link").style("stroke-width",1).style("fill","transparent").style("marker-end",(function(e){return`url(#${W(e)})`}));const h=n.selectAll(".link-wrapper").append("text").text((function(e){return Se(e)})).attr("class",(function(e){return e.predicates.length>1||X.tripleNodes.has(H(e))?"predicates":"predicate"})).attr("dy","-0.5em").style("text-anchor","middle").style("display",e.saveSettings.showLinksText?"":"none").on("mouseover",(function(e){d3.event.stopPropagation(),function(e){s.cancel(void 0);const t=c=d3.event.target;s((function(){c===t&&e.predicates.length>1&&l.show(e,c)}),300)}(e)})).on("mouseout",(function(){s.cancel(void 0),c=null,l.hide()})).on("click",(function(t){d3.event.stopPropagation(),function(t){be();let n=H(t);if(1===t.predicates.length&&X.tripleNodes.has(n)){O=null;let e=X.tripleNodes.get(n)[0];if(de(e,this,d3.event.button)){let t={};t.iri=e.iri,t.pred=Me(e.iri.split(" ")[1]),xe(t)}return}!function(t){if(e.showNodeInfo=!1,e.showPredicates=t.predicates.length>1,e.showFilter=!1,e.showInfoPanel=!1,O===t)return e.showNodeInfo=!1,e.showInfoPanel=!1,void(O=null);O=t,e.showPredicates&&(e.predicates=_.map(t.predicates,(function(e){let n=function(e,t){let n=H(t);return X.tripleNodes.has(n)?X.tripleNodes.get(n).findIndex(t=>t.iri.indexOf(e)>=0):-1}(e,t),r=n>-1;return{value:Me(e),partOfTriple:r,linkId:r?H(t):"",nodeIndex:n}})),e.showInfoPanel=!0)}(t)}(t)}));let g,m=0,y=0,v=0;const x=function(){d3.event.button&&0!==d3.event.button||(f(),s.cancel(g),e.showPredicates=!1,d3.event.timeStamp-m<te?y++:y=1,m=d3.event.timeStamp,d3.event.preventDefault())},w=function(t){if(d3.event.button&&0!==d3.event.button)return;s.cancel(g);const n=d3.event,r=this;if(d3.event.timeStamp-m<te)if(1===y)g=s((function(){de(t,r,n)}),40+te-(d3.event.timeStamp-m));else if(2===y){X.countLinks(t,X.links)<=e.saveSettings.linksLimit?me(t,!1,r.parentNode):i.info("Increase limit to see more connections and try again","Node already expanded to predefined maximum links to show."),e.closeInfoPanel()}d3.event.preventDefault()};function b(e,t){let r,i,o,a,s=!0;if("down"===t)r=2*e.size,i=e.size/3,o=.8,a=.3;else if("down-fixed"===t)r=2*e.size,i=e.size,o=.8,a=.66;else if("up"===t)r=e.size/3,i=2*e.size,o=.3,a=.8;else{if("fixed"!==t)return;r=e.size,o=.66,s=!1}let u=n.selectAll(".node-wrapper").filter((function(t){return t===e})).append("text").text("").classed("icon-any pinned",!0).style("font-size",r+"px").attr("x",(function(e){return e.x})).attr("y",(function(e){return e.y})).attr("opacity",o);"fixed"!==t&&"down-fixed"!==t||(e.pin=u),s&&(u=u.transition().duration(1e3).style("font-size",(function(){return i+"px"})).attr("opacity",a),"down-fixed"!==t&&u.remove())}const C=d3.behavior.drag().origin((function(e){return e})).on("dragstart",(function(e){0===d3.event.sourceEvent.button&&(e.fixedBeforeDrag=e.fixed,e.isBeingDragged=!0,e.beginDragging=!0,ye(),d3.event.sourceEvent.stopPropagation(),d3.select(this).classed("dragging",!0))})).on("drag",(function(t){t.isBeingDragged&&(y=0,t.px=d3.event.x,t.py=d3.event.y,t.fixed?t.beginDragging&&b(t,"fixed"):(e.numberOfPinnedNodes++,t.fixed=!0,b(t,"down-fixed")),t.pinWasFixed=!0,t.beginDragging=null,oe.resume())})).on("dragend",(function(e){e.isBeingDragged&&(e.pinWasFixed&&(e.pinWasFixed=null,d3.select(".pinned").remove()),e.isBeingDragged=!1,d3.select(this).classed("dragging",!1))}));p=n.selectAll(".node").data(X.nodes).enter().append("g").attr("class","node-wrapper").attr("id",(function(e){return e.iri})).append("circle").attr("class","node").attr("r",(function(e){return e.size})).style("fill",(function(t){return"greyColor"===t.types?"c2c2c2":e.getColor(t.types[0])})).call(C).on("mouseover",(function(t){if(!t.isBeingDragged){const n=d3.event;s.cancel(ue),se=s(()=>{(function(t,n){if(e.showInfoPanel)return!1;(fe.closeIcon||fe.expandIcon||fe.focusIcon||fe.copyURIIcon)&&fe.removeIcons();if(oe.alpha()<.05)return fe.initIcons(t,n.parentNode),oe.stop(),!0;return!1})(t,this)&&function(e,t){s.cancel(void 0);const n=D=t.target;s((function(){D===n&&a.show(e,D)}),300)}(t,n)},400)}})).on("mouseout",f).on("mousedown",x).on("touchstart",(function(e){x(),v=0,g=s((function(){v<5&&pe(e),g=null,y=0}),1e3)})).on("touchmove",(function(){v++})).on("mouseup",w).on("touchend",w).on("contextmenu",(function(t){d3.event.shiftKey||(d3.event.preventDefault(),ye(),e.closeInfoPanel(),t.fixed?(e.numberOfPinnedNodes--,t.fixed=!1,b(t,"up"),oe.resume()):(e.numberOfPinnedNodes++,t.fixed=!0,b(t,"down")),function(e){D&&a.show(e,D)}(t))}));const S=n.selectAll(".node-wrapper").append("foreignObject").style("pointer-events","none").attr("width",(function(e){return 2*e.size*ne}));n.insert("g").attr("class","menu-events"),function(e){e.each((function(e){e.fontSize=r.a.Text.calcFontSizeRaw(e.labels[0].label,e.size,k,!0)})).attr("height",(function(e){return 3*e.fontSize})).append("xhtml:div").attr("class","node-label-body").style("font-size",(function(e){return e.fontSize+"px"})).append("xhtml:div").text((function(e){return e.labels[0].label})),s((function(){$(".node-label-body div").each((function(e,t){let n=t.textContent.substring(0,t.textContent.length-1);let r=0;for(;r<200&&(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth);)n=n.substring(0,n.length-1),t.textContent=n+"…",r++}))}),50)}(S),oe.on("tick",(function(){d3.geom.quadtree(X.nodes);X.nodes.length;d.attr("x1",(function(e){return G(e.source)})).attr("y1",(function(e){return B(e.source)})).attr("x2",(function(e){return G(e.target)})).attr("y2",(function(e){return B(e.target)})),h.attr("x",(function(e){let t=G(e.source),n=G(e.target);return e.x=.5*(t+n)})).attr("y",(function(e){let t=B(e.source),n=B(e.target);return e.y=.5*(t+n)})).attr("transform",(function(e){return"rotate("+function(e,t){e.source,e.target;const n={x:G(e.source),y:B(e.source)},r={x:G(e.target),y:B(e.target)};if(t)return 180*Math.atan2(r.y-n.y,r.x-n.x)/Math.PI;{const e=180*Math.atan2(r.y-n.y,r.x-n.x)/Math.PI;return e<=90&&e>=-90?e:(e>0?-1:1)*(180-Math.abs(e))}}(e,e.direction)+", "+e.x+", "+e.y+")"})),p.attr("cx",(function(e){return e.x})).attr("cy",(function(e){return e.y})),n.select(".node-loader").attr("x",(function(e){return e.x-e.size+3})).attr("y",(function(e){return e.y-e.size})),n.select(".loader-container").attr("cx",(function(e){return e.x})).attr("cy",(function(e){return e.y})),S.attr("x",(function(e){return e.x-e.size*ne})).attr("y",(function(e){return e.y-3*e.fontSize/2})),d3.select(".pinned").attr("x",(function(e){return e.x})).attr("y",(function(e){return e.y}))})),angular.isDefined(ce)&&ce.setLoadingState(!1),e.loading&&(e.loading=!1),d3.selectAll(".link-wrapper").each((function(){const e=$(this).attr("id").split(">")[0],t=$(this).attr("id").split(">")[1];d3.selectAll(".link").each((function(n){let r=Q(n.source.iri),i=Q(n.target.iri);if(r===t&&i===e){let e=r;e+=">",e+=i;const t=document.createTextNode(" ⟶");document.getElementById(e).lastChild.appendChild(t),n.direction="double"}}))})),d3.selectAll(".d3-actions-tip").remove(),oe.start()}le();const fe=new function(){function e(e,t){return"translate("+(t.x-14+(t.size+15)*Math.cos(e*Math.PI/180-Math.PI/2))+","+(t.y-14+(t.size+15)*Math.sin(e*Math.PI/180-Math.PI/2))+")"}this.closeIcon=void 0,this.expandIcon=void 0,this.collapseIcon=void 0,this.focusIcon=void 0,this.copyURIIcon=void 0,this.actionsTip=void 0,this.removeIcons=function(){this.closeIcon.remove("g"),this.expandIcon&&this.expandIcon.remove("g"),this.collapseIcon&&this.collapseIcon.remove("g"),this.focusIcon.remove("g"),this.copyURIIcon.remove("g"),this.closeIcon=void 0,this.expandIcon=void 0,this.collapseIcon=void 0,this.focusIcon=void 0,this.copyURIIcon=void 0,this.expandedState=!1},this.expandedState=!1,this.initIcons=function(n,r){const i=o()().attr("class","d3-tip d3-actions-tip").customPosition((function(){const e=d3.event.target.getBoundingClientRect();return{top:e.top-20+"px",left:e.right+10+"px"}})).html((function(e){return e}));ae.call(i);n.isExpanded?(this.collapseIcon=d3.select(".menu-events").append("g").attr("class","collapse-icon").attr("name","collapse").attr("transform",(function(){return e(20,n)})),this.collapseIcon.append("circle").attr("cx",14).attr("cy",14).attr("r",13).style("fill","#eee"),this.collapseIcon.append("path").attr("d","M22.67,12a.59.59,0,0,1-.53.65l-6.88.72H15.2a.59.59,0,0,1-.59-.65l.72-6.88A.58.58,0,0,1,16,5.33a.59.59,0,0,1,.53.65L16,11.11,21.3,5.79a.64.64,0,0,1,.91.91L16.89,12,22,11.49A.59.59,0,0,1,22.67,12ZM12.59,14.75l-6.75.85a.59.59,0,0,0-.51.66.58.58,0,0,0,.66.51l4.95-.62-5.2,5.2a.64.64,0,1,0,.91.91l5.2-5.2L11.23,22a.59.59,0,0,0,.51.66h.07a.59.59,0,0,0,.59-.52l.85-6.75a.59.59,0,0,0-.17-.49A.58.58,0,0,0,12.59,14.75Z").style("fill","#ed4f2f"),this.collapseIcon.on("click",(function(){var e;(e=n).isExpanded=!1,X.removeNodeLeafLinks(e),le()})).on("mouseover",(function(){i.show(this.getAttribute("name")),s.cancel(se),s.cancel(ue)})).on("mouseout",(function(){i.hide(),ue=s((function(){ye()}),500)}))):(this.expandIcon=d3.select(".menu-events").append("g").attr("class","expand-icon").attr("name","expand").attr("transform",(function(){return e(20,n)})),this.expandIcon.append("circle").attr("cx",14).attr("cy",14).attr("r",13).style("fill","#eee"),this.expandIcon.append("path").attr("d","M22.37,6.28l-.72,6.88a.59.59,0,0,1-.59.53H21a.59.59,0,0,1-.53-.65L21,7.9l-5.32,5.32a.64.64,0,0,1-.91-.91L20.1,7,15,7.53a.59.59,0,0,1-.12-1.18l6.88-.72a.59.59,0,0,1,.65.65ZM12.89,20.34,7.95,21l5.2-5.2a.64.64,0,0,0-.91-.91L7,20.05l.62-4.95A.59.59,0,0,0,6.48,15l-.85,6.75a.59.59,0,0,0,.59.67h.07L13,21.52a.59.59,0,1,0-.15-1.18Z").style("fill","#ed4f2f"),this.expandIcon.on("click",(function(){me(n,!1,r)})).on("mouseover",(function(){i.show(this.getAttribute("name")),s.cancel(ue),s.cancel(se)})).on("mouseout",(function(){i.hide(),ue=s((function(){ye()}),500)}))),this.focusIcon=d3.select(".menu-events").append("g").attr("class","focus-icon").attr("name","focus").attr("transform",(function(){return e(20,n)})),this.focusIcon.append("circle").attr("cx",14).attr("cy",14).attr("r",13).style("fill","#eee"),this.focusIcon.append("path").attr("d","M14.2,23.81a9.8,9.8,0,1,1,6.93-2.87h0A9.74,9.74,0,0,1,14.2,23.81Zm0-18.17a8.37,8.37,0,1,0,5.92,14.29h0A8.37,8.37,0,0,0,14.2,5.64Zm1.42,6.95a2,2,0,1,0,0,2.85A2,2,0,0,0,15.62,12.59Z").style("fill","#ed4f2f"),this.focusIcon.on("click",(function(){t.$broadcast("onRootNodeChange",n.iri)})).on("mouseover",(function(){i.show(this.getAttribute("name")),s.cancel(ue),s.cancel(se)})).on("mouseout",(function(){i.hide(),ue=s((function(){ye()}),500)})),this.copyURIIcon=d3.select(".menu-events").append("g").attr("class","icon-link").attr("name","link").attr("transform",(function(){return e(20,n)})),this.copyURIIcon.append("circle").attr("cx",14).attr("cy",14).attr("r",13).style("fill","#eee"),this.copyURIIcon.append("path").attr("d","M 13.457031 10.164062 C 13.648438 10.164062 13.820312 10.242188 13.941406 10.363281 L 15.492188 11.859375 C 15.984375 12.332031 16.292969 12.992188 16.292969 13.714844 C 16.292969 14.441406 15.984375 15.097656 15.492188 15.574219 L 10.394531 20.496094 C 9.902344 20.972656 9.222656 21.265625 8.472656 21.265625 C 7.71875 21.265625 7.039062 20.972656 6.546875 20.496094 L 4.996094 19 C 4.507812 18.523438 4.203125 17.867188 4.203125 17.144531 C 4.203125 16.421875 4.507812 15.765625 4.996094 15.289062 L 7.542969 12.824219 C 7.667969 12.707031 7.84375 12.628906 8.035156 12.628906 C 8.417969 12.628906 8.726562 12.929688 8.726562 13.300781 C 8.726562 13.484375 8.648438 13.652344 8.523438 13.773438 L 5.976562 16.234375 C 5.738281 16.46875 5.589844 16.792969 5.589844 17.148438 C 5.589844 17.503906 5.738281 17.824219 5.976562 18.058594 L 7.527344 19.566406 C 7.773438 19.792969 8.105469 19.929688 8.472656 19.929688 C 8.835938 19.929688 9.167969 19.792969 9.414062 19.566406 L 14.511719 14.644531 C 14.753906 14.410156 14.90625 14.089844 14.90625 13.730469 C 14.90625 13.375 14.753906 13.054688 14.511719 12.820312 L 12.964844 11.324219 C 12.839844 11.203125 12.761719 11.039062 12.761719 10.855469 C 12.761719 10.488281 13.070312 10.1875 13.449219 10.1875 Z M 17.082031 3.976562 C 17.082031 3.976562 17.085938 3.976562 17.085938 3.976562 C 17.824219 3.976562 18.492188 4.261719 18.980469 4.722656 L 20.535156 6.203125 C 21.042969 6.679688 21.355469 7.34375 21.355469 8.082031 C 21.355469 8.792969 21.058594 9.441406 20.582031 9.914062 L 18.0625 12.402344 C 17.9375 12.527344 17.761719 12.605469 17.566406 12.605469 C 17.183594 12.605469 16.875 12.304688 16.875 11.9375 C 16.875 11.753906 16.949219 11.589844 17.070312 11.46875 L 19.605469 8.984375 C 19.847656 8.75 19.996094 8.429688 19.996094 8.070312 C 19.996094 7.714844 19.847656 7.394531 19.605469 7.160156 L 18.019531 5.667969 C 17.773438 5.445312 17.4375 5.304688 17.070312 5.300781 C 16.703125 5.304688 16.367188 5.453125 16.128906 5.691406 L 11.085938 10.667969 C 10.84375 10.898438 10.695312 11.222656 10.695312 11.578125 C 10.695312 11.933594 10.84375 12.257812 11.085938 12.488281 L 12.675781 13.980469 C 12.804688 14.101562 12.882812 14.273438 12.882812 14.457031 C 12.882812 14.828125 12.574219 15.128906 12.191406 15.128906 C 12.003906 15.128906 11.832031 15.054688 11.707031 14.9375 L 10.140625 13.457031 C 9.636719 12.980469 9.324219 12.316406 9.324219 11.582031 C 9.324219 10.863281 9.621094 10.214844 10.101562 9.742188 L 15.140625 4.765625 C 15.625 4.285156 16.304688 3.980469 17.054688 3.976562 Z M 17.082031 3.976562").style("fill","#ed4f2f"),this.copyURIIcon.on("click",(function(){P(n.iri),ye(),i.hide()})).on("mouseover",(function(){i.show("<div style='text-align: center;'><b>Copy to ClipBoard</b><br>"+n.iri+"</div>"),s.cancel(ue),s.cancel(se)})).on("mouseout",(function(){i.hide(),ue=s((function(){ye()}),500)})),this.closeIcon=d3.select(".menu-events").append("g").attr("class","close-icon").attr("name","remove").attr("transform",(function(){return e(20,n)})),this.closeIcon.append("circle").attr("cx",14).attr("cy",14).attr("r",13).style("fill","#eee"),this.closeIcon.append("path").attr("d","M14.94,14l5.87-5.87a.66.66,0,1,0-.94-.94L14,13.06,8.13,7.19a.66.66,0,0,0-.94.94L13.06,14,7.19,19.87a.66.66,0,1,0,.94.94L14,14.94l5.87,5.87a.66.66,0,1,0,.94-.94Z").style("fill","#ed4f2f"),this.closeIcon.on("click",(function(){pe(n)})).on("mouseover",(function(){i.show(this.getAttribute("name")),s.cancel(ue),s.cancel(se)})).on("mouseout",(function(){i.hide(),ue=s((function(){ye()}),500)})),this.animateMenu(n)},this.animateMenu=function(t){let n=0;let r=20;this.expandIcon&&this.expandIcon.transition().duration(100).style("opacity",1).ease("sin").attr("transform",(function(){return e(r,t)})).delay(n+=35),this.collapseIcon&&this.collapseIcon.transition().duration(100).style("opacity",1).ease("sin").attr("transform",(function(){return e(r,t)})).delay(n+=35),this.copyURIIcon.transition().duration(100).style("opacity",1).ease("sin").attr("transform",(function(){return r+=30,e(r,t)})).delay(n+=35),this.focusIcon.transition().duration(100).style("opacity",1).ease("sin").attr("transform",(function(){return r+=30,e(r,t)})).delay(n+=35),this.closeIcon.transition().duration(100).style("opacity",1).ease("sin").attr("transform",(function(){return r+=30,e(r,t)})).delay(n+=35),this.expandedState=!0}};function de(n,r,i){return e.showInfoPanel=!1,e.showPredicates=!1,e.showNodeInfo=!1,i.shiftKey&&(i.ctrlKey||i.metaKey)?(t.$broadcast("onRootNodeChange",n.iri),!1):i.ctrlKey||i.metaKey?(pe(n),!1):void 0!==e.openedNodeInfoPanel&&e.openedNodeInfoPanel===n?(e.pageslideExpanded=!1,e.openedNodeInfoPanel=void 0,!1):(ve(n),!0)}function pe(e){X.removeNode(e),le()}function he(t){!function(t){e.nodeSelected=!0,null===t.data.types&&(t.data.types="greyColor"),X=new Y,I="translate(0, -70) scale(1)",A.translate([0,-70]),A.scale(1)}(t),ge(t)}function ge(t,n,r){let o=t.data;o=_.filter(o,(function(e){return-1===_.findIndex(X.links,(function(t){return e.source===t.source.iri&&e.target===t.target.iri}))}));let a=[];const s=X.tripleLinksCopy.values();for(let e=0;e<X.tripleLinksCopy.size;e++){s.next().value.forEach(e=>{a.push(e)})}o=_.filter(o,(function(e){return-1===_.findIndex(a,(function(t){return e.source===t.source.iri&&e.target===t.target.iri}))})),o=_.filter(o,(function(e){return e.source!==e.target}));const c=function(e,t){let n=t.map((function(t){return t[e]}));return t.filter((function(t,r){return n.indexOf(t[e])===r}))}("iri",_.union(_.flatten(_.map(t.data,(function(e){return[{iri:e.source,isTriple:e.isTripleSource},{iri:e.target,isTriple:e.isTripleTarget}]}))))),l=_.map(X.nodes,(function(e){return{iri:e.iri,isTriple:Boolean(e.isTriple)}})),d=X.tripleNodes.values();for(let e=0;e<X.tripleNodes.size;e++){d.next().value.forEach(e=>{l.push({iri:e.iri,isTriple:e.isTriple})})}const p=_.reject(c,(function(e){return _.some(l,e)}));if(0===p.length)r?i.info("This node either does not exist or has no visible connections. Check your Graph Settings if you expect such."):0===o.length&&i.info("This node either does not exist or has no visible connections. Check your Graph Settings if you expect such."),X.addAndMatchLinks(o),le();else{const t=[],r=[];_.forEach(p,(function(n,i){t.push(u({url:"rest/explore-graph/node",method:"GET",params:{iri:n.isTriple?V(n.iri):n.iri,config:e.configLoaded.id,languages:e.shouldShowSettings()?e.saveSettings.languages:[],includeInferred:e.saveSettings.includeInferred,sameAsState:e.saveSettings.sameAsState}}).then((function(e){r[i]=e.data})))})),f.all(t).then((function(){_.forEach(r,(function(e,t){const i=2*Math.PI*t/r.length,o=(n?n.x:0)+Math.cos(i)*L/3,a=(n?n.y:0)+Math.sin(i)*L/3;e.isTriple?X.addTriple(e,o,a):X.addNode(e,o,a)})),X.addAndMatchLinks(o),n&&(n.isExpanded=!0),le()}))}}function me(t,n,r){if(ce.getLoadingState())return;ce.init(t,r);const o=t.iri;u({url:"rest/explore-graph/links",method:"GET",params:{iri:o,linksLimit:e.saveSettings.linksLimit,includeInferred:e.saveSettings.includeInferred,config:e.configLoaded.id,preferredTypes:e.shouldShowSettings()?e.saveSettings.preferredTypes:[],rejectedTypes:e.shouldShowSettings()?e.saveSettings.rejectedTypes:[],preferredPredicates:e.shouldShowSettings()?e.saveSettings.preferredPredicates:[],rejectedPredicates:e.shouldShowSettings()?e.saveSettings.rejectedPredicates:[],preferredTypesOnly:e.shouldShowSettings()?e.saveSettings.preferredTypesOnly:[],preferredPredicatesOnly:e.shouldShowSettings()?e.saveSettings.preferredPredicatesOnly:[],languages:e.shouldShowSettings()?e.saveSettings.languages:[],sameAsState:e.saveSettings.sameAsState,includeSchema:e.saveSettings.includeSchema}}).then((function(e){ge(e,t,n)}),(function(t){const n=getError(t.data);i.error(n,"Error exploring node"),e.loading=!1,ce.setLoadingState(!1)}))}function ye(){angular.isDefined(fe)&&fe.expandedState&&fe.removeIcons()}function ve(t){oe.stop(),e.openedNodeInfoPanel=t,e.showNodeInfo=!0,e.showFilter=!1,e.showPredicates=!1,e.nodeLabels=t.labels,e.nodeTypes=t.types,e.rdfRank=t.rdfRank,e.nodeIri=t.iri,e.resourceType=t.isTriple?"triple":"uri",e.encodedIri=t.isTriple?encodeURI(V(t.iri)):encodeURI(t.iri),e.showInfoPanel=!0,e.rdfsLabel=t.labels[0].label,e.rdfsComment=t.comment,e.expanded=!1,e.propertiesQueryObj.query="",e.dataNodeKeysQuery="",u.get("rest/explore-graph/properties",{params:{iri:t.isTriple?V(t.iri):t.iri,config:e.configLoaded.id,languages:e.shouldShowSettings()?e.saveSettings.languages:[],includeInferred:e.saveSettings.includeInferred,sameAsState:e.saveSettings.sameAsState,rejectedPredicates:e.shouldShowSettings()?e.saveSettings.rejectedPredicates:[]}}).then((function(t){e.data=_.mapKeys(t.data,(function(t,n){return e.replaceIRIWithPrefix(n)})),e.propertiesObj.items=[],_.forEach(e.data,(function(t,n){e.propertiesObj.items.push({key:n,value:t})})),e.nodeImage=void 0,e.propertiesNotFiltered=e.propertiesObj.items;const n=_.find(e.propertiesObj.items,(function(e){return"image"===e.key}));n&&(e.nodeImage=n.value[0].v),e.propertiesObj.items=_.reject(e.propertiesObj.items,(function(e){return"image"===e.key})),e.propertiesNotFiltered=e.propertiesObj.items}),(function(e){i.warning(getError(e.data),"Error")}))}function xe(e){we("predicate","#d54a33",e),we("predicates","#d54a33",e);let t=document.getElementsByClassName("link");t&&_.each(t,(function(t){let n=t.__data__;(n.source.iri.indexOf(e.iri)>=0||n.target.iri.indexOf(e.iri)>=0)&&(t.style.stroke="#d54a33",t.style.strokeWidth=4)}));let n=document.getElementsByClassName("arrow-marker");n&&_.each(n,(function(t){let n=t.__data__;(n.source.iri.indexOf(e.iri)>=0||n.target.iri.indexOf(e.iri)>=0)&&(t.style.stroke="#d54a33",t.__data__.target.isTriple||t.setAttribute("refX","23"))}))}function we(e,t,n){let r=document.getElementsByClassName(e);r&&_.each(r,(function(e){let r=e.__data__;n?((r.source.iri.indexOf(n.iri)>=0||r.target.iri.indexOf(n.iri)>=0)&&(e.style.fill=t),F(n.iri)===H(r)&&(e.textContent=n.pred,e.style.fill=t),n.oppLinkIRI&&n.oppLinkIRI===H(r)&&(e.textContent=n.oppTriplePred,e.style.fill=t)):(e.style.fill=t,e.textContent=Se(r))}))}function be(){_.each(e.predicates,(function(e){let t=document.getElementById(e.linkId+e.nodeIndex);t&&(t.style.fontWeight="normal")}));let t=document.getElementsByClassName("link");t&&_.each(t,(function(e){e.style.stroke="#999",e.style.strokeWidth=1})),we("predicate",""),we("predicates","");let n=document.getElementsByClassName("arrow-marker");n&&_.each(n,(function(e){e.style.stroke="#999",e.__data__.target.isTriple||e.setAttribute("refX","59")}))}function Ce(e){let t=F(e);if(X.tripleNodes.has(t))return X.tripleNodes.get(t).find(t=>t.iri===e)}function Se(e){return e.predicates.length>1?e.predicates.length+" predicates":Me(e.predicates[0])}function Me(t){const n=e.replaceIRIWithPrefix(t);return n.length===t.length?t.split("/")[t.split("/").length-1]:n}e.toggleSidePanel=function(){e.pageslideExpanded=!e.pageslideExpanded},e.closeInfoPanel=function(){e.pageslideExpanded=!1,e.openedNodeInfoPanel=void 0,e.predicates=[],O=null,s((function(){e.showInfoPanel=!1}))},e.clickLink=function(t){if(X.tripleNodes.has(t.linkId)){be();let n=X.tripleNodes.get(t.linkId)[t.nodeIndex];ve(n),e.showPredicates=!0;let r=document.getElementById(t.linkId+t.nodeIndex);r&&(r.style.fontWeight="bold");let i={};const o=X.tripleLinksCopy.values();for(let e=0;e<X.tripleLinksCopy.size;e++){let e=o.next().value;e.length>1&&e.every(t=>t.source.iri===n.iri?(i.iri=e[0].source.iri,t.target.isTriple&&(i.oppLinkIRI=F(t.target.iri),i.oppTriplePred=Me(t.target.iri.split(" ")[1])),i.pred=Me(n.iri.split(" ")[1]),1===t.predicates.length&&(i.linkPred=t.predicates[0]),!1):t.target.iri!==n.iri||(i.iri=e[0].target.iri,t.source.isTriple&&(i.oppLinkIRI=F(t.source.iri),i.oppTriplePred=Me(t.source.iri.split(" ")[1])),i.pred=Me(n.iri.split(" ")[1]),1===t.predicates.length&&(i.linkPred=t.predicates[0]),!1))}i.iri||(i.iri=n.iri,i.pred=Me(n.iri.split(" ")[1])),xe(i)}},e.splitPredicate=function(e){return e.split("/")[e.split("/").length-1]},e.getActiveRepository=function(){return n.getActiveRepository()},e.isLoadingLocation=function(){return n.isLoadingLocation()},e.hasActiveLocation=function(){return n.hasActiveLocation()},e.rotate=function(e){ye();const t=2*(e?1:-1)*Math.PI/180,n=Math.cos(t),r=Math.sin(t),i=N/2,o=L/2;d3.selectAll(".node-wrapper").each((function(e){e.x=i+(n*(e.x-i)+r*(e.y-o)),e.y=o+(-r*(e.x-i)+n*(e.y-o)),e.fixed&&(e.px=e.x,e.py=e.y)})),oe.resume()},e.openUri=function(t,n){if(!n){const n={};e.configLoaded.id!==e.defaultGraphConfig.id&&(n.config=e.configLoaded.id),n.uri=t,e.pushHistory(n,{uri:t,config:e.configLoaded})}e.$broadcast("onRootNodeChange",t)},e.saveOrUpdateGraph=function(){const t=JSON.stringify(X.copyState()),n={id:e.lastSavedGraphId,name:e.lastSavedGraphName,data:t,shared:e.shared};n.id?e.saveGraphModal("update",n):e.saveGraphModal("new",n)},e.renameSavedGraph=function(t){e.saveGraphModal("rename",{id:t.id,name:t.name,config:t.config,shared:t.shared})};const Te=function(t){w.editSavedGraph(t).success((function(){e.lastSavedGraphName=t.name,e.shared=t.shared,e.refreshSavedGraphs(),i.success("Saved graph "+t.name+" was edited.")})).error((function(e){const t=getError(e);i.error(t,"Error! Cannot edit saved graph")}))};e.saveGraphModal=function(t,n,r){m.open({templateUrl:"js/angular/graphexplore/templates/modal/save-graph.html",controller:"SaveGraphModalCtrl",resolve:{data:function(){return{mode:t,graph:n,graphExists:r,shared:n.shared}}}}).result.then((function(t){if(t.restart)e.saveGraphModal(t.mode,t.graph,!1);else switch(t.mode){case"new":!function(t){e.configLoaded&&(t.config=e.configLoaded.id),w.addNewSavedGraph(t).success((function(n,r,o){e.lastSavedGraphName=t.name,e.lastSavedGraphId=o()["x-saved-graph-id"],e.shared=t.shared,e.refreshSavedGraphs(),i.success("Saved graph "+t.name+" was saved.")})).error((function(n,r){if(422===r)e.saveGraphModal("new",t,!0);else{const e=getError(n);i.error(e,"Error! Cannot create saved graph")}}))}(t.graph);break;case"update":case"rename":Te(t.graph)}}))},e.refreshSavedGraphs=function(){w.getSavedGraphs().success((function(t){e.savedGraphs=t})).error((function(e){const t=getError(e);i.error(t,"Error! Could not get saved graphs")}))},e.loadSavedGraph=function(t,n){t.owner?(e.lastSavedGraphName=t.name,e.lastSavedGraphId=t.id,e.shared=t.shared,e.configLoaded=e.findConfigById(t.config)):(e.lastSavedGraphName=null,e.lastSavedGraphId=null,e.shared=t.shared),e.configLoaded||(e.configLoaded=e.defaultGraphConfig),d.url("?saved="+t.id),X.restoreState(JSON.parse(t.data)),n||e.pushHistory({saved:t.id},{savedGraph:t})},e.copyToClipboardSavedGraph=function(e){P([location.protocol,"//",location.host,location.pathname,"?saved=",e.id].join(""))},e.deleteSavedGraph=function(t){g.openSimpleModal({title:"Confirm",message:"Are you sure you want to delete the saved graph '"+t.name+"'?",warning:!0}).result.then((function(){!function(t){w.deleteSavedGraph(t).success((function(){e.refreshSavedGraphs(),i.success("Saved graph "+t.name+" was deleted.")})).error((function(e){const t=getError(e);i.error(t,"Error! Cannot delete saved graph")}))}(t)}))},e.openIRI=function(t,n){return n.shiftKey?e.$broadcast("onRootNodeChange",t):window.open(t,"_blank"),!1},e.togglePinAllNodes=function(){ye();const t=e.numberOfPinnedNodes<=0;e.numberOfPinnedNodes=0,d3.selectAll(".node").each((function(n){n.fixed=t,t&&e.numberOfPinnedNodes++})),oe.resume()},$("body").on("keydown",(function(t){"input"!==t.target.nodeName&&e.nodeSelected&&(37===t.keyCode?e.rotate(!0):39===t.keyCode&&e.rotate(!1))})),e.getLiteralFromPropValue=function(e){return e.substring(e.indexOf(":")+1)}}function u(e,t,n){switch(e.mode=n.mode,e.graph=angular.copy(n.graph),e.graphExists=n.graphExists,e.mode){case"new":e.title="Create new saved graph",e.okButtonText="Create";break;case"update":e.title="Update saved graph",e.okButtonText="Save";break;case"rename":e.title="Rename saved graph",e.okButtonText="Save"}e.ok=function(){e.form.$valid&&t.close({graph:e.graph,mode:e.mode})},e.saveNew=function(){e.graph.name=e.graph.name+" (new)",t.close({graph:e.graph,mode:"new",restart:!0})},e.cancel=function(){t.dismiss("cancel")}}angular.module("graphdb.framework.graphexplore.controllers.graphviz",["ui.scroll.jqlite","ui.scroll","toastr","ui.bootstrap","ngTagsInput","graphdb.framework.utils.localstorageadapter"]).controller("GraphsVisualizationsCtrl",s).controller("SaveGraphModalCtrl",u).config(["$tooltipProvider",function(e){e.options({appendToBody:!0})}]),s.$inject=["$scope","$rootScope","$repositories","toastr","$timeout","$http","ClassInstanceDetailsService","AutocompleteRestService","$q","$location","$jwtAuth","UiScrollService","ModalService","$modal","$window","LocalStorageAdapter","LSKeys","SavedGraphsRestService","GraphConfigRestService","RDF4JRepositoriesRestService"],u.$inject=["$scope","$modalInstance","data"]},58:function(e,t,n){"use strict";n.r(t);n(31),n(4);function r(e,t,n,r,i,o,a,s,u,c,l,f,d,p,h,g){var m;e.page=1,e.totalPages=5,e.helpHidden=1===h.get(g.HIDE_GRAPH_CONFIG_HELP),e.toggleHelp=function(t){void 0===t&&(t=h.get(g.HIDE_GRAPH_CONFIG_HELP)),1!==t?(h.set(g.HIDE_GRAPH_CONFIG_HELP,1),e.helpHidden=!0):(h.set(g.HIDE_GRAPH_CONFIG_HELP,0),e.helpHidden=!1)},e.fixedVisualCallback=function(t,n){e.newConfig.startIRI=t,e.newConfig.startIRILabel=n,m=!0},e.isDefaultGraph=function(e){return"Minimal"===e.name||"Advanced"===e.name},e.isUserGraph=function(t){return!e.isDefaultGraph(t)},e.getSampleName=function(e,t){const n=e[t+"Description"];return n||(e.id?"Copy of "+e.name:e.name)};const y=function(){c.getGraphConfigSamples().success((function(t){e.samples=_.filter(t,(function(t){return!t.id||e.newConfig.id!==t.id||(e.revertConfig=t,!1)}))})).error((function(e){r.error(getError(e),"Could not get graph configs. You may not see sample values")}))},v=f.configName;function x(e){r.warning(e)}function w(t){let n;return"query"===t.startMode&&1===e.page?n=t.startGraphQuery:2===e.page?n=t.expandQuery:3===e.page?n=t.resourceQuery:4===e.page?n=t.predicateLabelQuery:5===e.page&&(n=t.resourcePropertiesQuery),angular.isDefined(n)?n:""}function b(){function o(){e.getAutocompletePromise=l.checkAutocompleteStatus()}y(),e.createGraphConfig=function(){c.createGraphConfig(e.newConfig).success((async function(){await d.showToastMessageWithDelay("Saved new graph config"),n.url("graphs-visualizations")})).error((function(e){r.error(getError(e),"Error! Could not create graph config")}))},e.updateGraphConfig=function(){c.updateGraphConfig(e.newConfig).success((async function(){await d.showToastMessageWithDelay("Graph config saved"),n.url("graphs-visualizations")})).error((function(e){r.error(getError(e),"Error! Could not save graph config")}))},e.$on("autocompleteStatus",(function(){o()})),o(),e.getNamespacesPromise=p.getNamespaces(e.getActiveRepository());const a=function(e,t,n,r,i,o){t?c.validateQuery(t,n,r,i,o).success((function(){e()})).error((function(e){x(getError(e))})):e()};function s(){u()&&e.$broadcast("addStartFixedNodeAutomatically",{startIRI:e.newConfig.startIRI})}function u(){return 1===e.page&&"node"===e.newConfig.startMode}e.validateCurrentPage=function(t){e.updateModel(),1===e.page?"node"!==e.newConfig.startMode||e.newConfig.startIRI?"query"!==e.newConfig.startMode||e.newConfig.startGraphQuery?"query"===e.newConfig.startMode?a(t,e.newConfig.startGraphQuery,"graph"):t():x("Please provide start graph query."):x("Please select start node."):2===e.page?a(t,e.newConfig.expandQuery,"construct",["node"]):3===e.page?a(t,e.newConfig.resourceQuery,"tuple",["node"],[],["type","label","comment","rank"]):4===e.page?a(t,e.newConfig.predicateLabelQuery,"tuple",["edge"],["label"]):5===e.page&&a(t,e.newConfig.resourcePropertiesQuery,"tuple",["node"],["property","value"])},e.goToPage=function(t){e.page!==t&&e.validateCurrentPage((function(){e.showEditor(),e.page=t,e.notoolbar=1!==e.page}))},e.goToPreviousPage=function(){e.page>1&&e.goToPage(e.page-1),u()&&(m=!1)},e.goToNextPage=function(){s(),m&&e.goToPage(e.page+1)},e.saveGraphConfig=function(){s(),u()&&!m||(e.newConfig.startQueryIncludeInferred=e.currentQuery.inference,e.newConfig.startQuerySameAs=e.currentQuery.sameAs,e.validateCurrentPage((function(){e.newConfig.name?e.isUpdate?e.updateGraphConfig(e.newConfig):e.createGraphConfig(e.newConfig):x("Please provide config name.")})))},e.updateModel=function(){const t=window.editor.getValue().trim();"query"===e.newConfig.startMode&&1===e.page?e.newConfig.startGraphQuery=t:2===e.page?e.newConfig.expandQuery=t:3===e.page?e.newConfig.resourceQuery=t:4===e.page?e.newConfig.predicateLabelQuery=t:5===e.page&&(e.newConfig.resourcePropertiesQuery=t)},e.setQuery=function(e){window.editor.setValue(e||" ")},e.updateDirty=function(){if(e.revertConfig){const t=w(e.revertConfig),n=window.editor.getValue().trim();e.queryEditorIsDirty=t!==n}},e.updateEditor=function(){t((function(){e.currentQuery.query=w(e.newConfig),i.isActiveRepoOntopType()&&(e.nocount=!0),e.currentQuery.inference=e.newConfig.startQueryIncludeInferred,e.currentQuery.sameAs=e.newConfig.startQuerySameAs,L(e.currentQuery.id),R(e.currentQuery.id)}),100)},e.showEditor=function(){window.editor&&window.editor.xhr&&window.editor.xhr.abort(),e.viewMode="yasr"},e.showPreview=function(){e.currentQuery.outputType="table",e.runQuery()},e.revertEditor=function(){e.setQuery(w(e.revertConfig))},e.$watch("newConfig.startMode",(function(n){"query"===n&&t((function(){e.updateEditor()}),0)})),e.$watch("page",(function(n){("query"===e.newConfig.startMode||n>1)&&t((function(){e.showEditor(),e.updateEditor()}),0)}))}e.newConfig={startQueryIncludeInferred:!0,startQuerySameAs:!0},e.newConfig.startMode="search",e.isUpdate=!1,e.shared=!1,e.encodeQuery=function(e){return encodeURIComponent(e)},v?(e.isUpdate=!0,c.getConfig(v).success((function(t){e.newConfig=t,b()})).error((function(e){r.error(getError(e),"Could not load config for name "+v)}))):(e.isUpdate=!1,b());const C={id:"1",name:"",query:"select * where { \n\t?s ?p ?o .\n} limit 100 \n",inference:e.newConfig.startQueryIncludeInferred,sameAs:e.newConfig.startQuerySameAs};e.resetCurrentTabConfig=function(){e.currentTabConfig={pageSize:100,page:1,allResultsCount:0,resultsCount:0}},e.queryExists=!1,e.resetCurrentTabConfig(),e.tabsData=e.tabs=[C],e.saveTab=function(t){const n=function(t){for(let n=0;n<e.tabsData.length;n++){if(e.tabsData[n].id===t)return n}}(t);if(void 0===n)return{};const r=e.tabsData[n];return e.saveQueryToLocal(r),r},e.loadTab=L,e.addNewTab=function(e,t,n){},e.runQuery=k,e.getNamespaces=A,e.changePagination=function(){k(!0,e.explainRequested)},e.toggleSampleQueries=function(){},e.addKnownPrefixes=I,e.getExistingTabId=N,e.querySelected=function(t){const n=N(t);e.toggleSampleQueries(),angular.isDefined(n)?R(n):e.addNewTab(null,t.name,t.body)},e.saveQueryToLocal=S,e.setLoader=M,e.getLoaderMessage=function(){const t=(Date.now()-e.queryStartTime)/1e3,n=e.getHumanReadableSeconds(t);let r="";r=e.progressMessage?e.progressMessage+"... "+n:"Running operation..."+n;e.extraMessage&&t>10&&(r+="\n"+e.extraMessage);return r},e.fixSizesOnHorizontalViewModeSwitch=T,e.changeViewMode=function(n){e.viewMode="none",e.orientationViewMode=!e.orientationViewMode,T(),$(".dataTables_filter").remove(),$(".resultsTable").remove(),t((function(){L(n),R(n)}),100)},e.showHideEditor=E,e.focusQueryEditor=function(){angular.element(document).find(".editable-input").is(":focus")||angular.element(document).find(".CodeMirror textarea:first-child").focus()},e.orientationViewMode=!0;e.getActiveRepository();function S(e){}function M(t,n,r){const i=angular.element(document.getElementById("yasr-inner"));e.queryIsRunning=t,t?(e.queryStartTime=Date.now(),e.countTimeouted=!1,e.progressMessage=n,e.extraMessage=r,i.addClass("hide")):(e.progressMessage="",e.extraMessage="",i.removeClass("hide")),null===e.$$phase&&e.$apply()}function T(n){function r(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0}const i=n;if(e.orientationViewMode){if("yasr"===e.viewMode){let e=r()-document.querySelector(".CodeMirror-wrap").getBoundingClientRect().top;e-=40,document.querySelector(".CodeMirror-wrap").style.height=e+"px"}else e.noPadding={},document.querySelector(".CodeMirror-wrap").style.height="";document.getElementById("yasr").style.minHeight=""}else if(e.noPadding={paddingRight:15,paddingLeft:0},window.editor&&document.querySelector(".CodeMirror-wrap")){let e=r()-document.querySelector(".CodeMirror-wrap").getBoundingClientRect().top;e-=40,document.querySelector(".CodeMirror-wrap").style.height=e+"px",document.getElementById("yasr").style.minHeight=e+"px"}else{let n;n=t(i?function(){e.fixSizesOnHorizontalViewModeSwitch(i)}:e.fixSizesOnHorizontalViewModeSwitch,100),e.$on("$destroy",(function(){t.cancel(n)}))}window.yasr&&window.yasr.container&&t((function(){window.yasr.container.resize()}),100)}function E(){T(!0)}function R(e){t((function(){$('a[data-id = "'+e+'"]').tab("show")}),0)}function k(t,n){e.executedQueryTab=e.currentQuery,n&&"SELECT"!==window.editor.getQueryType()&&"CONSTRUCT"!==window.editor.getQueryType()?r.warning("Explain only works with SELECT or CONSTRUCT queries."):"update"!==window.editor.getQueryMode()?(e.explainRequested=n,e.queryIsRunning||(t?e.currentTabConfig.resultsCount=0:e.resetCurrentTabConfig(),e.viewMode="editor",e.orientationViewMode&&e.fixSizesOnHorizontalViewModeSwitch(),M(!0,"Evaluating query"),window.editor.query())):r.warning("Cannot execute updates from this editor.")}function A(){M(!0,"Refreshing namespaces","Normally this is a fast operation but it may take longer if a bigger repository needs to be initialised first."),p.getRepositoryNamespaces().success((function(t){const n={};t.results.bindings.forEach((function(e){n[e.prefix.value]=e.namespace.value})),e.namespaces=n})).error((function(t){e.repositoryError=getError(t)})).finally((function(){M(!1)}))}function I(){s.addKnownPrefixes(JSON.stringify(window.editor.getValue())).success((function(e){angular.isDefined(window.editor)&&angular.isDefined(e)&&e!==window.editor.getValue()&&window.editor.setValue(e)})).error((function(e){let t=getError(e);return r.error(t,"Error! Could not add known prefixes"),!0}))}function N(t){let n=void 0;return angular.forEach(e.tabsData,(function(e){if(e.name===t.name&&e.query===t.body)return n=e.id,e})),n}e.orientationViewMode||E(),e.getActiveRepository()&&A(),e.$on("$destroy",(function(){window.editor=null,window.yasr=null})),$("textarea").on("paste",(function(){t((function(){I()}),0)})),e.$watchCollection("[currentQuery.inference, currentQuery.sameAs]",(function(){e.currentQuery}));function L(n){e.tabsData=[e.currentQuery];let r=e.currentQuery;null==e.currentQuery.query||""===e.currentQuery.query?window.editor.setValue(" "):window.editor.setValue(e.currentQuery.query),t((function(){e.currentTabConfig={},e.currentTabConfig.queryType=r.queryType,e.currentTabConfig.resultsCount=r.resultsCount,e.currentTabConfig.offset=r.offset,e.currentTabConfig.allResultsCount=r.allResultsCount,e.currentTabConfig.page=r.page,e.currentTabConfig.pageSize=r.pageSize,e.currentTabConfig.timeFinished=r.timeFinished,e.currentTabConfig.timeTook=r.timeTook,e.currentTabConfig.sizeDelta=r.sizeDelta,e.$apply()}),0),$("#yasr").css("padding","0")}function D(e){return $(e).attr("data-id")}e.$on("tabAction",(function(t,n){n.relatedTarget&&e.saveTab(D(n.relatedTarget)),e.loadTab(D(n.target))})),e.$on("deleteAllexeptSelected",(function(t,n){e.tabsData=n,e.tabs=n})),e.currentQuery=angular.copy(C),e.showSampleQueries=!1,e.savedQuery={},e.sampleQueries={},e.getResultsDescription=function(){},e.getUpdateDescription=function(){},e.getStaleWarningMessage=function(){}}angular.module("graphdb.framework.graphexplore.controllers.graphviz.config",["graphdb.framework.utils.notifications","graphdb.framework.utils.localstorageadapter"]).controller("GraphConfigCtrl",r),r.$inject=["$scope","$timeout","$location","toastr","$repositories","$modal","ModalService","SparqlRestService","$filter","GraphConfigRestService","AutocompleteRestService","$routeParams","Notifications","RDF4JRepositoriesRestService","LocalStorageAdapter","LSKeys"]},59:function(e,t,n){"use strict";n.r(t);var r=n(209),i=n.n(r),o=n(215),a=n(206),s=n(207);n(4);function u(e,t,n,r,u,c,l,f,d,p,h){return{restrict:"AE",template:'<div id="classChart"></div>',scope:{classHierarchyData:"=",flattenedClassNames:"=",selectedClass:"=",currentSliderValue:"=",showClassInfoPanel:"=",showExternalElements:"=",hidePrefixes:"=",currentBrowserLimit:"="},link:function(g,m,y){!function(g,m){var y=800,v=800,x=v,w=20,b=d3.layout.pack().size([x-w,x-w]).value((function(e){return e.size})),C=d3.scale.linear().domain([0,4]).range(["hsl(19, 70%, 90%)","hsl(19, 70%, 50%)"]).interpolate(d3.interpolateHcl),S=d3.select("#classChart").insert("svg:svg","h2").attr("viewBox","0 0 "+y+" "+v).attr("preserveAspectRatio","xMidYMid meet").on("dblclick.zoom",null);function M(){return S.append("svg:g").attr({id:"main-group",transform:"translate("+y/2+","+v/2+")"})}function T(){return"true"===p.get(h.CLASS_HIERARCHY_HIDE_PREFIXES)}function E(){var e=s.a.Export.getCSSRules("css/rdf-class-hierarchy-labels.css?v=1.11.1");d3.selectAll("#main-group").append("defs"),$("defs").append('<style type="text/css"><![CDATA['+e+"]]></style>"),d3.selectAll("g").style("opacity",1);var t=s.a.Export.generateBase64ImageSource();d3.select(this).attr({href:t,download:"class-hierarchy-"+c.getActiveRepository()+".svg"})}g.hidePrefixes=T();var R,k,A=M();if(!g.classHierarchyData.classCount&&c.getActiveRepository()&&!c.isSystemRepository()){e.loader=!0,e.hierarchyError=!1;const t=p.get(`classHierarchy-selectedGraph-${c.getActiveRepository()}`);n.getClassHierarchyData(null!==t?t.contextID.uri:"").success((function(t,n,r){e.loader=!1,207===n&&l.warning("You can update the diagram by pressing the reload button.","Repository data has changed"),g.classHierarchyData=t,d3.select("#download-svg").on("mouseover",E)})).error((function(t){e.loader=!1,e.hierarchyError=getError(t),l.error("Request for "+d+" failed! "+getError(t))}))}var I,N,L,D,O,P,q,z,U={};function j(n,s,c,l){L&&L(),D&&D(),d3.selectAll("#main-group").remove(),A=M(),o.a.SingleChild.addPlaceholders(n,!0),N=c||n;var p,h=b.nodes(n);N.isInFocusTransitive=!0,o.a.SingleChild.removePlaceholders(h),o.a.SingleChild.centerNodes(h),o.a.SingleChild.makePositionsRelativeToZero(h);var m=i()().attr("class","d3-tip").customPosition((function(e){return{top:"inherit",bottom:r.innerHeight-d3.event.clientY+"px",right:r.innerWidth-d3.event.clientX+"px"}})).html((function(e){return e.name}));S.call(m);var y=A.selectAll("circle").data(h).enter().append("g");s.doFade&&y.each((function(e){a.a.Transition.fadeIn(d3.select(this),550)}));var v,T=[],E=y.append("circle").attr("class",(function(e){return e.role})).style("fill",(function(e){return e.children?C(e.depth):"#E0D0D0"})).each((function(e){if(e.circle=d3.select(this),e.name!==d){var t=e.name;T.push({name:t}),U[[t]]=e,e.circle.classed("rdf-class",!0),e.circle.on("mouseover",(function(){s.noPrefixes?m.show(e):e.textHidden?m.show(e):m.hide(e)})),e.circle.on("mouseout",m.hide)}}));function $(e){d3.selectAll(".selected").classed("selected",e.selected=!1),e.circle.classed("selected",e.selected=!0),v=e}function O(){g.showClassInfoPanel=!1}T&&(T=_.uniqBy(T,"name"),g.flattenedClassNames=T);var P=a.a.Click.delayDblClick();d3.selectAll(".parent, .topLevelParent, .child, .root").call(P);k=function(e){V(e),e.name===d?(O(),d3.selectAll(".selected").classed("selected",!1)):($(e),g.selectedClass=v,g.showClassInfoPanel=!0,g.$on("sidePanelClosed",(function(t){d3.selectAll(".selected").classed("selected",e.selected=!1)})))},P.on("click",(function(e){e.id&&r.history.pushState({id:e.id},"classHierarchyPage"+e.id,"hierarchy#"+e.id),m.hide(),k(e)})),P.on("dblclick",(function(t){t!==n&&(m.hide(),$(t),e.$broadcast("goToDomainRangeGraphView",v,N),d3.event.stopPropagation())}));var q=0;S.on("wheel",(function(){m.hide();var e=d3.event;e.preventDefault(),e.stopPropagation();var t=(new Date).getTime();if(t-q>100){q=t;var n="";e.deltaY<=-1?n="in":e.deltaY>=1&&(n="out");var i=e.target.__data__;if(i||(i=N),"in"===n){if(i!==N){for(;i.parent&&!i.parent.isInFocusTransitive;)i=i.parent;i.depth<N.depth&&(i=N)}if(i===N&&i.children){for(var o=i.children[0],a=1;a<i.children.length;a++)i.children[a].sortingRank>o.sortingRank&&(o=i.children[a]);i=o}V(i,!0)}else"out"===n&&(i=N.parent)&&V(i,!0);N.name===d&&r.history.replaceState({id:1},"classHierarchyPage1","hierarchy#1"),Q()}}));var z=A.selectAll("text").data(h).enter().append("text").attr("class",(function(e){return e.children&&e.children.length?"label":"label child-label"})).each((function(e){e.textSel=d3.select(this)}));s.noPrefixes?(I!==n&&(z.each((function(e){var t=e.name.indexOf(":");e.name.indexOf("http://")>-1?e.noPrefixName=e.name:t>-1&&(e.noPrefixName=e.name.substring(t+1))})),I=n),z.style("font-size",(function(e){return a.a.Text.calcFontSize(e.noPrefixName,e.r)})).text((function(e){return a.a.Text.getTextWithElipsisIfNeeded(e.noPrefixName,e.r/3)}))):z.style("font-size",(function(e){return a.a.Text.calcFontSize(e.name,e.r)})).text((function(e){return a.a.Text.getTextWithElipsisIfNeeded(e.name,e.r/3)})),z.style("display",(function(e){return e.parent===n?(e.textHidden=this.textContent.indexOf("...")+3===this.textContent.length,null):(e.textHidden=!0,"none")})),s.doFade&&!s.keepPrevState&&z.each((function(e){a.a.Transition.fadeIn(d3.select(this),550)})),R=function(){function e(e){e&&E.each((function(t){e==t.id&&k(t)}))}var n=t.hash();r.onpopstate=function(t){t.state&&e(t.state.id)},e(n)};var j=A.selectAll("circle, text");function F(e,t){var n=x/e[2];p=e,j.attr("transform",(function(t){return"translate("+(t.x-e[0])*n+","+(t.y-e[1])*n+")"})),E.attr("r",(function(e){return e.r*n})),t&&z.each((function(e){e.fullName!==N.topLevelParentUri&&N.topLevelParentUri!==d||(e.textSel.style("display","none"),N.children&&N.children.length?_.each(N.children,(function(e){e.textSel.style("display","inline")})):N.textSel.style("display","inline"),N.parent&&_.each(N.parent.children,(function(e){e.name!==N.name&&e.textSel.style("display","inline")})))})),z.style("font-size",(function(e){return s.noPrefixes?a.a.Text.calcFontSize(e.noPrefixName,e.r*n):a.a.Text.calcFontSize(e.name,e.r*n)})).text((function(e){return s.noPrefixes?a.a.Text.getTextWithElipsisIfNeeded(e.noPrefixName,e.r*n/3):a.a.Text.getTextWithElipsisIfNeeded(e.name,e.r*n/3)}))}function H(e){var t=2*e+w;return 2*e/t<.3&&(t=2*e+2),t}function G(e){!e.isInFocusTransitive&&e.parent&&e.parent.isInFocusTransitive||(e.textHidden=!0,this.style.display="none")}function B(e){!e.isInFocusTransitive&&e.parent&&e.parent.isInFocusTransitive&&(e.textHidden=this.textContent.indexOf("...")+3===this.textContent.length,this.style.display="")}function V(e,t){if(u((function(){g.showExternalElements=e.name===d})),e.id&&r.history.replaceState({id:e.id},"classHierarchyPage"+e.id,"hierarchy#"+e.id),N!==e){if(t&&(O(),d3.selectAll(".selected").classed("selected",!1)),N.parent)for(var n=N;n;)n.isInFocusTransitive=!1,n=n.parent;for(n=e;n;)n.isInFocusTransitive=n.children,n=n.parent;if(2*(N=e).r/(2*N.r+w)<.3||g.currentSliderValue>g.currentBrowserLimit)F([N.x,N.y,H(N.r)]),z.each((function(e){G.call(this,e),B.call(this,e)}));else d3.transition().duration(f).tween("zoom",(function(e){var t=d3.interpolateZoom(p,[N.x,N.y,H(N.r)]);return function(e){F(t(e))}})).selectAll("text").each("start",G).each("end",B)}}F([N.x,N.y,H(N.r)],l),L=g.$on("rootFocus",(function(){r.history.pushState({id:1},"classHierarchyPage1","hierarchy#1"),k(n)})),D=g.$on("classSearch",(function(e){k(e)}))}function Q(){var t=g.classHierarchyData.classCount;let n=p.get(h.CLASS_HIERARCHY_CURRENT_SLIDER_VALUE);(!n||n>t)&&(n=t,p.set(h.CLASS_HIERARCHY_CURRENT_SLIDER_VALUE,n)),e.$broadcast("classCount",t,n)}window.addEventListener("resize",Q),window.addEventListener("beforeunload",(function e(){window.removeEventListener("resize",Q),window.removeEventListener("beforeunload",e)})),g.$watch("classHierarchyData",(function(){O&&O(),P&&P(),q&&q(),z&&z();var e=T();if(g.classHierarchyData.classCount){Q();var t=angular.copy(g.classHierarchyData);var n,r,i=function(e){return b.nodes(e).sort((function(e,t){return e.sortingRank>t.sortingRank?-1:e.sortingRank<t.sortingRank?1:e.depth>t.depth?1:e.depth<t.depth?-1:0}))}(t);function o(e,t){var i={keepPrevState:!0,noPrefixes:T()};r=i.noPrefixes,j(n||e,i,N,!0),u((function(){p.set(h.CLASS_HIERARCHY_SWITCH_PREFIXES,t),R()}),70)}function a(e,i,a){if(e){p.set(h.CLASS_HIERARCHY_CURRENT_SLIDER_VALUE,e),n={name:d,children:[]};for(var s=new Set,u=1;u<=e;u++)s.add(i[u].id),i[u].parent===i[0]&&n.children.push(i[u]);if(function e(t){if(t.children){for(var n=[],r=0;r<t.children.length;r++)s.has(t.children[r].id)&&n.push($.extend({},t.children[r]));t.children=n;for(r=0;r<t.children.length;r++)e(t.children[r])}}(n),a)r=angular.isUndefined(r)?T():r,j(n,{noPrefixes:r});else o(t)}}var s,c=p.get(h.CLASS_HIERARCHY_CURRENT_SLIDER_VALUE);if(c)a(c,i);else{var l={doFade:!0,keepPrevState:!0,noPrefixes:T()};j(t,l),R()}O=g.$watch("hidePrefixes",(function(n){angular.isUndefined(n)||e?e=void 0:u((function(){!function(e){angular.isUndefined(e)||p.set(h.CLASS_HIERARCHY_HIDE_PREFIXES,e)}(n),o(t,!0)}),50)}),!0),P=g.$watch("currentSliderValue",(function(e){a(e,i,!0)}),!0),z=g.$on("onEnterKeypressSearchAction",(function(e){s&&k(s)})),q=g.$on("searchedClass",(function(e,t){(s=U[t.name])&&k(s)}))}}),!0)}(g)}}}angular.module("graphdb.framework.graphexplore.directives.class",["graphdb.framework.graphexplore.controllers.class","graphdb.framework.utils.localstorageadapter"]).constant("ZOOM_DURATION",500).constant("ROOT_OBJ_NAME","RDF Class Hierarchy").directive("rdfClassHierarchy",u),u.$inject=["$rootScope","$location","GraphDataRestService","$window","$timeout","$repositories","toastr","ZOOM_DURATION","ROOT_OBJ_NAME","LocalStorageAdapter","LSKeys"]},60:function(e,t,n){"use strict";n.r(t);var r=n(207),i=n(206);n(4);function o(e,t,n,o,a,s,u,c,l,f,d,p,h){return{restrict:"AE",template:'<div id="domain-range"></div>',scope:{showPredicatesInfoPanel:"=",selectedPredicate:"=",collapseEdges:"="},link:function(f){const d=c((function(){!function(f){d3.selection.prototype.moveToFront=function(){return this.each((function(){d3.select(this.parentNode.appendChild(this))}))},d3.selection.prototype.moveToBack=function(){return this.each((function(){const e=this.parentNode.firstChild;e&&this.parentNode.insertBefore(this,e)}))};var d=1200,g=d/18,m=d/110,y=m/2,v=d/90,x=d/1e3,w=d/600,b=d3.layout.force().size([d,600]).charge(-900),C=b.drag().on("dragstart",(function(e){d3.select(this).classed("selected",e.selected=!0)})),S=d3.select("#domain-range").append("svg").attr("viewBox","0 0 "+d+" 600").attr("preserveAspectRatio","xMidYMid meet").on("dblclick.zoom",null),M=S.append("defs");M.append("marker").attr({id:"arrow",viewBox:"0 -5 10 10",refX:10,refY:0,markerUnits:"strokeWidth",markerWidth:5,markerHeight:5,orient:"auto",fill:p}).append("path").attr({d:"M0,-5L10,0L0,5",class:"arrowHead"}),M.append("marker").attr({id:"collapsed-arrow",viewBox:"0 -5 10 10",refX:9,refY:0,markerUnits:"strokeWidth",markerWidth:4,markerHeight:4,orient:"auto",fill:p}).append("path").attr({d:"M0,-5L10,0L0,5",class:"arrowHead"}),M.append("marker").attr({id:"arrow-loop",viewBox:"0 -5 10 10",refX:7,refY:0,markerUnits:"strokeWidth",markerWidth:5,markerHeight:5,orient:"auto",fill:p}).append("path").attr({d:"M0,-5L10,0L0,5",class:"arrowHead"}),d3.select("#download-svg").on("mouseover",(function(){var e=r.a.Export.getCSSRules("css/domain-range-graph.css?v=1.11.1");$("defs").append('<style type="text/css"><![CDATA['+e+"]]></style>");var t=r.a.Export.generateBase64ImageSource();d3.select(this).attr({href:t,download:"domain-range-graph-"+n.getActiveRepository()+".svg"})}));var T=d/7,_=1.2*T,E=d3.select(".legend-container").append("svg").attr("viewBox","0 0 "+T+" "+_).attr("preserveAspectRatio","xMidYMid meet");E.append("rect").attr({width:T,height:_}).style("fill","rgba(235, 235, 235, 0.9)");var R=d/75,k=d/40,A=R+g/2.5,I=k,N=A+d/90,L=v/1.1,D=k,O=(E.append("circle").attr({class:"legend-class-node",cx:(R+A)/2,cy:D,r:g/4.5}),I+d/370);E.append("text").attr({x:N,y:O}).style("font-size",L+"px").text("main class node");var P=D+d/30;E.append("circle").attr({class:"legend-object-node",cx:(R+A)/2,cy:P,r:m/1.25});var q=O+d/30;E.append("text").attr({x:N,y:q}).style("font-size",L+"px").text("class node");var z=P+d/45;E.append("circle").attr({class:"legend-datatype-node",cx:(R+A)/2,cy:z,r:y});var U=q+d/45;E.append("text").attr({x:N,y:U}).style("font-size",L+"px").text("datatype node");var j=z+d/45;d3.select(".legend-class-node");E.append("line").attr({class:"property-arrow",x1:R,y1:j,x2:A,y2:j}).style("stroke-width",x).attr("marker-end","url("+a.absUrl()+"#arrow)"),E.append("text").attr({x:N,y:j+d/370}).style("font-size",L+"px").text("explicit property");var Q=j+d/45;E.append("line").attr({class:"implicit-property-arrow",x1:R,y1:Q,x2:A,y2:Q}).style("stroke-width",x).attr("marker-end","url("+a.absUrl()+"#arrow)"),E.append("text").attr({x:N,y:Q+d/370}).style("font-size",L+"px").text("implicit property");var F=Q+d/45;E.append("line").attr({class:"collapsed-property-arrow",x1:R,y1:F,x2:A,y2:F}).style("stroke-width",w).attr("marker-end","url("+a.absUrl()+"#collapsed-arrow)"),E.append("text").attr({x:N,y:F+d/370}).style("font-size",L+"px").text("collapsed property");var H=S,G=a.search().uri,B=a.search().name,V=a.search().collapsed;o.getDomainRangeData(G,V).success((function(e,t,n){f.domainRangeGraphData=e})).error((function(e){l.error("Request for "+B+" failed!")})),$(window).on("popstate",(function(){s.set(u.DOMAIN_RANGE_WENT_BACK,!0)})),t.onpopstate=function(t){t.state&&e.$broadcast("changeCollapsedEdgesState",t.state.collapsed)},f.$watch("collapseEdges",(function(){angular.isUndefined(f.collapseEdges)||(s.set(u.DOMAIN_RANGE_COLLAPSE_EDGES,f.collapseEdges),"true"!==s.get(u.DOMAIN_RANGE_WENT_BACK)&&function(t){e.$broadcast("switchEdgeMode",{uri:G,name:B,collapsed:t})}(f.collapseEdges),s.remove(u.DOMAIN_RANGE_WENT_BACK))})),f.$watch("domainRangeGraphData",(function(){if(f.domainRangeGraphData){var n=angular.copy(f.domainRangeGraphData);b.nodes(n.nodes).links(n.links);var r=H.selectAll(".link").data(n.links).enter().append("g");function o(e){e.style("stroke",p),e.style("stroke-width",w),e.attr("marker-end","url("+a.absUrl()+"#collapsed-arrow)")}var s,u,l=0;r.each((function(e){if(e.objectPropNodeClassUri!==G)s=r.append("line").attr({class:"link","marker-end":"url("+a.absUrl()+"#arrow)"}).style("stroke-width",x).each((function(e){switch(e.propertyType){case"objectLeft":e.targetRadius=g;break;case"objectRight":e.targetRadius=m;break;case"datatype":e.targetRadius=y;break;default:e.targetRadius=0}var t=d3.select(this);e.targetNodeEdgeCount>1?o(t):e.implicit&&t.style("stroke-dasharray","3, 3")}));else{if(angular.isUndefined(u)){var t=g/2;u=d3.select(this).append("path").attr({d:"M 0 0 A "+t+" "+t+" 0 1 1 0 "+t,class:"loop-link",fill:"none","marker-end":"url("+a.absUrl()+"#arrow-loop)"}).style("stroke-width",x)}(l+=e.targetNodeEdgeCount)>1&&o(d3.select(".loop-link"))}}));var S={};function M(){$.isEmptyObject(S)||(S.text.style("fill","black"),S.background.style("fill","#f0f0f0"))}function T(e){M(),S.text=d3.select(this),S.background=d3.select(this.previousSibling),S.text.style("fill","white"),S.background.style("fill",p),c((function(){f.showPredicatesInfoPanel=!0,f.selectedPredicate=e})),d3.event.stopPropagation()}$("document").ready((function(){$("#domain-range").bind("click",M)}));var _=r.append("text").attr("class",(function(e){return e.objectPropNodeClassUri===G?"loop-link-property-name":"property-name"})).attr("dx",(function(e){return g/2*("objectLeft"===e.propertyType?1:-1)})).style("text-anchor",(function(e){return"objectLeft"===e.propertyType?"end":"start"})).style("font-size",v).text((function(e){return e.targetNodeEdgeCount>1?e.targetNodeEdgeCount+" predicates":e.name}));_.each((function(e){var n=d3.select(this);/\d\spredicates/.test(n.text())?n.style("font-weight","bold").on("click",T):n.on("click",(function(e){t.open("resource?uri="+encodeURIComponent(e.uri),"_blank")}))}));var E=d/600,R=r.append("rect").attr("class",(function(e){return e.objectPropNodeClassUri!==G?"link-background":"loop-link-background"})).attr("width",(function(e){return e.calculatedWidth=this.previousSibling.getBBox().width,e.calculatedWidth+2*E})).attr("height",(function(e){return e.calculatedHeight=this.previousSibling.getBBox().height,e.calculatedHeight+E})).attr("transform",(function(e){var t=E-g/2*("objectLeft"===e.propertyType?1:-1);return"objectLeft"===e.propertyType&&(t+=e.calculatedWidth),"translate(-"+t+",-"+(E+e.calculatedHeight/2)+")"})).on("click",(function(e){d3.event.stopPropagation()})),k=H.selectAll(".node").data(n.nodes).enter().append("g"),A=k.filter((function(e){return e.objectPropClassUri!==G})).append("circle").each((function(e){var t=d3.select(this);"main"===e.classPosition?t.attr({class:"class-node",r:g}).attr("marker-end","url("+a.absUrl()+"#loop-link)"):null===e.objectPropClassName?t.attr({class:"datatype-node",r:y}):t.attr({class:"object-prop-node",r:m})})).call(C);d3.selectAll(".object-prop-node").on("dblclick",(function(t,n){f.$apply((function(){e.$broadcast("reloadDomainRangeGraphView",t,n)}))})),k.filter((function(e){return e.objectPropClassName&&e.objectPropClassUri!==G})).append("text").attr("class",(function(e){return e.classPosition+"-class-label"})).style("font-size",v).text((function(e){return e.objectPropClassName})).on("click",(function(e){t.open("resource?uri="+encodeURIComponent(e.objectPropClassUri),"_blank")}));var I=k.select("text");H.select(".class-node").each((function(){d3.select(this.parentNode).append("text").attr("class","rdf-class-label").style("font-size",(function(e){return i.a.Text.calcFontSize(B,g)})).text(B).on("click",(function(e){t.open("resource?uri="+encodeURIComponent(G),"_blank")}))}));var N=H.select(".class-node + text"),L=d3.select(".class-node"),D=d3.selectAll(".loop-link-background"),O=d3.selectAll(".loop-link-property-name");if(_=d3.selectAll(".property-name"),!angular.isUndefined(u)){var P=[];D.each((function(e,t){d3.select(this);P.push({idx:t,width:e.calculatedWidth,height:e.calculatedHeight})}))}b.on("tick",(function(e){var t=8*e.alpha;function n(e){var t=e.x+2*g,n=e.y-g/1.9;var r=[];D.each((function(i,o){r.push(i),o<h?function(r,i){var o=$.grep(P,(function(e){return e.idx==i}));i>0&&(t+=parseFloat(i*(o[0].height/(i/1.4)))),r.attr({transform:"rotate(270, "+e.x+","+e.y+") translate("+t+","+n+")",width:o[0].height,height:o[0].width})}(d3.select(this),o):d3.select(this).remove()})),function(e){var t;d3.select(".view-more-preds-label").style("font-weight","bold").each((function(n){n.target.allEdges=e,t=this.getComputedTextLength()})).on("click",T),d3.select(".view-more-preds-rect").attr("height",t+2*E)}(r)}s.filter((function(e){return e.objectPropNodeClassUri!==G})).attr("x1",(function(e){return e.source.x})).attr("y1",(function(e){return e.source.y})).attr("x2",(function(e){return e.targetX})).attr("y2",(function(e){return e.targetY})).each((function(e){!function(e){"objectLeft"===e.propertyType?(e.source.x-=8*t,e.source.y-=t/9):(e.target.x+=8*t,e.target.y-=t/9)}(e);var n=Math.atan2(e.target.y-e.source.y,e.target.x-e.source.x);e.targetX=e.target.x-Math.cos(n)*e.targetRadius,e.targetY=e.target.y-Math.sin(n)*e.targetRadius})),A.each((function(e){"main"!==e.classPosition||angular.isUndefined(u)||(!function(e){var t=e.x+.96*g,n=e.y-g/5.7-5;u.attr("transform","rotate(270, "+e.x+","+e.y+") translate("+t+","+n+")")}(e),function(e){function t(t,n){var r=$.grep(P,(function(e){return e.idx==n})),i=0;n>0&&(i=parseFloat(2*n*(r[0].height/1.4)));var o=e.x,a=e.y-2.1*g-i;t.attr({x:o,y:a}).moveToFront()}O.each((function(e,n){var r=d3.select(this),i=O.size()-h;i<0?t(r,n):(0==n&&!f.collapseEdges&&i>1&&(!function(e,t,n){e.classed("view-more-preds-label",!0).text(n+" predicates more ..."),null!==this.nextSibling&&t.classed("view-more-preds-rect",!0)}(r,d3.select(this.nextSibling),i),t(r,n)),n<h?t(r,n):r.remove())}))}(e),n(e)),e.objectPropClassUri!==G&&d3.select(this).attr("cx",(function(e){return"main"===e.classPosition?function(e){!window.ActiveXObject&&"ActiveXObject"in window&&(Math.log10=function(e){return Math.log(e)/Math.LN10});var t=L.attr("cx")-d/2,n=.5*Math.log10(Math.abs(t));return e.x+=t>0?-n:n,e.x}(e):e.x})).attr("cy",(function(e){return e.y}))})),N.attr("x",(function(e){return e.x})).attr("y",(function(e){return e.y})).moveToFront(),R.filter((function(e){return e.objectPropNodeClassUri!==G})).attr("x",(function(e){return e.target.x>e.source.x?e.source.x+(e.target.x-e.source.x)/2:e.target.x+(e.source.x-e.target.x)/2})).attr("y",(function(e){return e.target.y>e.source.y?e.source.y+(e.target.y-e.source.y)/2:e.target.y+(e.source.y-e.target.y)/2})).moveToFront(),_.attr("x",(function(e){return e.target.x>e.source.x?e.source.x+(e.target.x-e.source.x)/2:e.target.x+(e.source.x-e.target.x)/2})).attr("y",(function(e){return e.target.y>e.source.y?e.source.y+(e.target.y-e.source.y)/2:e.target.y+(e.source.y-e.target.y)/2})).moveToFront(),I.attr("x",(function(e){return"right"===e.classPosition?e.x+1.2*m:e.x-1.2*m})).attr("y",(function(e){return e.y})).moveToFront()})).linkDistance(d/3.5).start()}}))}(f)}),50);f.$on("$destroy",(function(){c.cancel(d)}))}}}angular.module("graphdb.framework.graphexplore.directives.domainrange",["graphdb.framework.graphexplore.controllers.domainrange","graphdb.framework.utils.localstorageadapter"]).constant("ONTO_RED","#F04E23").constant("ONTO_GREEN","#0CB0A0").constant("ONTO_BLUE","#003663").constant("NON_COLLAPSED_REFLEXIVE_LINK_LIMIT",6).directive("domainRangeGraph",o),o.$inject=["$rootScope","$window","$repositories","GraphDataRestService","$location","LocalStorageAdapter","LSKeys","$timeout","toastr","ONTO_RED","ONTO_GREEN","ONTO_BLUE","NON_COLLAPSED_REFLEXIVE_LINK_LIMIT"]},61:function(e,t){function n(e,t){return{restrict:"A",scope:{},templateUrl:"js/angular/graphexplore/templates/systemRepoWarningTemplate.html",link:function(n){n.isSystemRepository=function(){return"SYSTEM"===e.getActiveRepository()},n.hasPermission=function(){return t.hasPermission()}}}}angular.module("graphdb.framework.graphexplore.directives.sysrepo",["graphdb.framework.graphexplore.controllers.class"]).directive("systemRepoWarning",n),n.$inject=["$repositories","$rootScope"]},62:function(e,t){function n(e){return{restrict:"AE",scope:{rdfsLabel:"=",rdfsComment:"=",expanded:"=",alwaysExpanded:"="},templateUrl:"js/angular/graphexplore/templates/rdfsCommentLabelTemplate.html",link:function(t,n){t.stringLimit=e,t.scrollToTop=function(){n[0].getElementsByClassName("rdfs-comment")[0].scrollTop=0},t.checkCommentLength=function(){return n[0].getElementsByClassName("rdfs-comment-text")[0].innerText.length<e},t.equalHeights=function(){const e=n[0].getElementsByClassName("rdfs-comment-text")[0].innerHeight;e<250&&t.expanded&&(n[0].getElementsByClassName("rdfs-comment")[0].innerHeight=e)},t.toggleFullComment=function(){t.expanded=!t.expanded},t.$watch("expanded || alwaysExpanded",(function(n){t.stringLimit=n?t.rdfsComment.length:e}))}}}angular.module("graphdb.framework.graphexplore.directives.rdfsdetails",[]).directive("rdfsCommentLabel",n).constant("SHORT_COMMENT_LENGTH",100),n.$inject=["SHORT_COMMENT_LENGTH"]},63:function(e,t,n){"use strict";n.r(t);var r=n(207);n(38);function i(e,t){return{restrict:"A",template:'<div id="dependencies-chord"></div>',scope:{dependenciesData:"="},link:function(n){n.$watch("dependenciesData",(function(){if(n.dependenciesData){const i=n.dependenciesData;!function(i,o){if(function(){let e=!0;for(const t of i){if(t.some(e=>0!==e)){e=!1;break}}return e}())return;const a=d3.scale.category20(),s=d3.select("body").append("div").attr("class","tooltip").style("opacity",0);d3.select("body").on("click",(function(){s.style("opacity",0)}));const u=Math.min(800,800)/2.8,c=u-24,l=d3.svg.arc().innerRadius(c).outerRadius(u),f=d3.layout.chord().padding(.04).sortSubgroups(d3.descending).sortChords(d3.ascending),d=d3.svg.chord().radius(c),p=d3.select("#dependencies-chord").append("svg").attr("viewBox","0 0 800 800").attr("preserveAspectRatio","xMidYMid meet").style("font","10px sans-serif").append("g").attr("id","circle").attr("transform","translate(400,400)");p.append("circle").attr("r",u).style("fill","none"),f.matrix(i);const h=p.selectAll(".group").data(f.groups).enter().append("g").attr("class","group").on("mouseover",(function(e,t){g.classed("fade",(function(e){return e.source.index!==t&&e.target.index!==t}))}));h.append("title").text((function(e,t){return o[t]})),h.append("path").attr("id",(function(e,t){return"group"+t})).attr("d",l).style("fill",(function(e,t){return a(t)})),h.append("text").each((function(e){e.angle=(e.startAngle+e.endAngle)/2})).attr("dy",".35em").attr("transform",(function(e){return"rotate("+(180*e.angle/Math.PI-90)+")translate("+(c+26)+")"+(e.angle>Math.PI?"rotate(180)":"")})).style("text-anchor",(function(e){return e.angle>Math.PI?"end":null})).text((function(e){return o[e.index]}));const g=p.selectAll(".chord").data(f.chords).enter().append("path").attr("class","chord").style("fill",(function(e){return a(e.target.index)})).style("fill-opacity",".67").style("stroke","#000").style("stroke-width",".25px").style("cursor","pointer").attr("d",d);g.on("mouseover",(function(){d3.select(this).style({"fill-opacity":"1"})})),g.on("mouseout",(function(){d3.select(this).style({"fill-opacity":".67"})})),g.on("click",(function(e){const r=o[e.source.index],i=o[e.target.index],a=d3.event.pageX,u=d3.event.pageY;t.getPredicates(r,i,n.selectedGraph&&n.selectedGraph.contextID.uri).success((function(e){let t="<div class='dependencies-tooltip'>"+("<div class='row'>"+r+" <i class='fa fa-exchange'></i> "+i+"</div>")+_.map(e.slice(0,10),(function(e){const t=" <i class='fa fa-long-arrow-"+("out"===e.direction?"right":"left")+"'></i>";return"<div class='row'>"+e.predicate+" : "+e.weight+t+" </div>"})).join("");e.length>10?t=t+"<div class='pull-right'>And "+(e.length-10).toString()+" more...</div></div>":t+="</div>",s.html(t).style("left",a+"px").style("top",u+"px")})),s.transition().duration(200).style("opacity",1)})),d3.select("#circle").on("mouseleave",(function(){p.selectAll(".chord").classed("fade",!1)})),d3.select("#download-svg").on("mouseover",(function(){const t=r.a.Export.generateBase64ImageSource();d3.select(this).attr({href:t,download:"dependencies-"+e.getActiveRepository()+".svg"})}))}(i.matrix,i.nodes,i.direction)}}))}}}angular.module("graphdb.framework.graphexplore.directives.dependencies",["graphdb.framework.graphexplore.controllers.dependencies","graphdb.framework.rest.graphexplore.data.service"]).directive("dependenciesChord",i),i.$inject=["$repositories","GraphDataRestService"]},64:function(e,t){function n(){return{restrict:"AE",scope:{filterQueryObj:"=",filterFunction:"&",listItemsObj:"=",listItemsNotFiltered:"=",searchPlaceholder:"@"},templateUrl:"js/angular/graphexplore/templates/listItemsSearchFilterTemplate.html",link:function(e){e.filterFunction=e.filterFunction(),e.$watch("filterQueryObj.query",(function(){var t,n,r,i;e.listItemsObj.items=(t=e.filterQueryObj.query,n=e.listItemsObj.items,r=e.listItemsNotFiltered,i=e.filterFunction,t.length>0?_.filter(r,i):n.length!==r.length?r:n)}))}}}angular.module("graphdb.framework.graphexplore.directives.searchfilter",[]).directive("listItemsSearchFilter",n),n.$inject=[]},65:function(e,t){function n(e,t){return{restrict:"AE",scope:{searchData:"=",searchFields:"@",titleField:"@",searchPlaceholder:"@",initialValue:"=",searchedObjCallback:"&"},templateUrl:"js/angular/graphexplore/templates/searchIconInputTemplate.html",link:function(n,r){n.searchedObjCallback=n.searchedObjCallback(),n.performSearchActionOnEnter=function(){e.$broadcast("onEnterKeypressSearchAction")},n.showInput=function(){$("#selectGraphDropdown").hide(),r.find("#search_input #search_input_value")[0].value="",r.find(".search-icon").addClass("animated bounceOut").css("z-index","-1"),r.find("#search_input .angucomplete-holder").css("display","block"),t((function(){r.find("#search_input .angucomplete-holder").css("width","250px").css("left","-215px"),t((function(){r.find(".close-icon").css("display","block").addClass("animated bounceIn").css("z-index","3"),r.find("#search_input #search_input_value").focus()}),200)}),1)},n.hideInput=function(){r.find("#search_input #search_input_value")[0].value="",r.find("#search_input .angucomplete-holder").css("width","0px").css("left","35px"),t((function(){r.find("#search_input .angucomplete-holder").css("display","none"),$("#selectGraphDropdown").show()}),250),r.find(".close-icon").addClass("animated bounceOut").removeClass("bounceOut").css("z-index","-1").css("display","none").click((function(){$(".tooltip").hide()})),t((function(){r.find(".search-icon").css("display","inline-block").removeClass("bounceOut").addClass("bounceIn").css("z-index","3")}),200)}}}}angular.module("graphdb.framework.graphexplore.directives.searchcontrols",[]).directive("searchIconInput",n),n.$inject=["$rootScope","$timeout"]},94:function(e,t,n){"use strict";n.r(t);n(2),n(13),n(7),n(8),n(221),n(222),n(216),n(214),n(209),n(223),n(225),n(226),n(218),n(206),n(215),n(207),n(38),n(50),n(51),n(52),n(53),n(54),n(55),n(56),n(57),n(58),n(59),n(60),n(61),n(62),n(63),n(64),n(65),n(33),n(34);angular.module("graphdb.framework.graphexplore",["graphdb.framework.core.controllers","graphdb.framework.core.directives","graphdb.framework.rest.graphexplore.data.service","graphdb.framework.graphexplore.services.uiscroll","graphdb.framework.graphexplore.services.rdfsdetails","graphdb.framework.rest.graphexplore.savedgraphs.service","graphdb.framework.rest.graphconfig.service","graphdb.framework.graphexplore.controllers.class","graphdb.framework.graphexplore.controllers.domainrange","graphdb.framework.graphexplore.controllers.dependencies","graphdb.framework.graphexplore.controllers.graphviz","graphdb.framework.graphexplore.controllers.graphviz.config","graphdb.framework.graphexplore.directives.sysrepo","graphdb.framework.graphexplore.directives.rdfsdetails","graphdb.framework.graphexplore.directives.searchfilter","graphdb.framework.graphexplore.directives.class","graphdb.framework.graphexplore.directives.domainrange","graphdb.framework.graphexplore.directives.dependencies","graphdb.framework.graphexplore.directives.searchcontrols","graphdb.framework.core.directives.queryeditor.controllers","graphdb.framework.core.directives.queryeditor.queryeditor"])}}]);
3
+ !function(e,t){"use strict";!function(e){e.module("angucomplete-alt",[]).directive("angucompleteAlt",["$q","$parse","$http","$sce","$timeout","$templateCache","$interpolate",function(e,t,n,r,i,o,a){var s=40,u=39,c=38,l=37,f=27,d=13,p=9,h=3,g=524288,m=500,y=200,v="autocomplete-required",x="Searching...",w="No results found";function b(t,o,a,b){var C,S,M,T,_,E,R=o.find("input"),k=h,A=null,I=v,N=null,L=null,D=o[0].querySelector(".angucomplete-dropdown"),$=!1,O=null;function P(e,n){e&&("object"==typeof e?(t.searchStr=j(e),U({originalObject:e})):"string"==typeof e&&e.length>0?t.searchStr=e:console&&console.error&&console.error("Tried to set "+(n?"initial":"")+" value of angucomplete to",e,"which is an invalid value"),H(!0))}function q(e){O=null,t.hideResults(e),document.body.removeEventListener("click",q)}function z(e){return e.which?e.which:e.keyCode}function U(e){"function"==typeof t.selectedObject?t.selectedObject(e,t.selectedObjectData):t.selectedObject=e,H(!!e)}function j(e){return t.titleField.split(",").map((function(t){return Q(e,t)})).join(" ")}function Q(e,t){var n,r;if(t){n=t.split("."),r=e;for(var i=0;i<n.length;i++)r=r[n[i]]}else r=e;return r}function F(e,n){var i,o,a;if(a=new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"i"),e)return e.match&&e.replace||(e=e.toString()),i=(o=e.match(a))?e.replace(a,'<span class="'+t.matchClass+'">'+o[0]+"</span>"):e,r.trustAsHtml(i)}function H(e){t.notEmpty=e,N=t.searchStr,t.fieldRequired&&b&&t.inputName&&b[t.inputName].$setValidity(I,e)}function G(e){!t.overrideSuggestions||t.selectedObject&&t.selectedObject.originalObject===t.searchStr||(e&&e.preventDefault(),i.cancel(A),J(),U({originalObject:t.searchStr}),t.clearSelected&&(t.searchStr=null),ee())}function B(){return o[0].querySelectorAll(".angucomplete-row")[t.currentIndex]}function V(e){D.scrollTop=D.scrollTop+e}function W(){var e=t.results[t.currentIndex];t.matchClass?R.val(j(e.originalObject)):R.val(e.title)}function Y(e){return function(n,r,i,o){r||i||o||!n.data||(n=n.data),t.searching=!1,re(Q(S(n),t.remoteUrlDataField),e)}}function X(e,n,r,i){t.searching=!1,0!==n&&-1!==n&&(n||r||i||(n=e.status),t.remoteUrlErrorCallback?t.remoteUrlErrorCallback(e,n,r,i):console&&console.error&&console.error("http error"))}function J(){L&&L.resolve()}function Z(r){var i={},o=t.remoteUrl+encodeURIComponent(r);t.remoteUrlRequestFormatter&&(i={params:t.remoteUrlRequestFormatter(r)},o=t.remoteUrl),t.remoteUrlRequestWithCredentials&&(i.withCredentials=!0),J(),L=e.defer(),i.timeout=L.promise,n.get(o,i).success(Y(r)).error(X)}function K(n){J(),L=e.defer(),t.remoteApiHandler(n,L.promise).then(Y(n)).catch(X)}function ee(){t.showDropdown=!1,t.results=[],D&&(D.scrollTop=0)}function te(){t.showDropdown=T,t.currentIndex=t.focusFirst?0:-1,t.results=[]}function ne(e){!e||e.length<k||(t.localData?t.$apply((function(){var n;n=void 0!==t.localSearch()?t.localSearch()(e,t.localData):function(e){var n,r,i,o,a=t.searchFields.split(","),s=[];for(void 0!==t.parseInput()&&(e=t.parseInput()(e)),n=0;n<t.localData.length;n++){for(r=!1,i=0;i<a.length;i++)o=Q(t.localData[n],a[i])||"",r=r||o.toString().toLowerCase().indexOf(e.toString().toLowerCase())>=0;r&&(s[s.length]=t.localData[n])}return s}(e),t.searching=!1,re(n,e)})):t.remoteApiHandler?K(e):Z(e))}function re(e,n){var r,i,o,a,s,u;if(e&&e.length>0)for(t.results=[],r=0;r<e.length;r++)t.titleField&&""!==t.titleField&&(a=s=j(e[r])),i="",t.descriptionField&&(i=u=Q(e[r],t.descriptionField)),o="",t.imageField&&(o=Q(e[r],t.imageField)),t.matchClass&&(s=F(a,n),u=F(i,n)),t.results[t.results.length]={title:s,description:u,image:o,originalObject:e[r]};else t.results=[];t.autoMatch&&1===t.results.length&&function(e,n,r){if(!r)return!1;for(var i in n)if(n[i].toLowerCase()===r.toLowerCase())return t.selectResult(e),!0;return!1}(t.results[0],{title:a,desc:i||""},t.searchStr)?t.showDropdown=!1:0!==t.results.length||_?t.showDropdown=!0:t.showDropdown=!1}function ie(){t.localData?re(t.localData,""):t.remoteApiHandler?K(""):Z("")}o.on("mousedown",(function(e){e.target.id?(O=e.target.id)===t.id+"_dropdown"&&document.body.addEventListener("click",q):O=e.target.className})),t.currentIndex=t.focusFirst?0:null,t.searching=!1,M=t.$watch("initialValue",(function(e){e&&(M(),P(e,!0))})),t.$watch("fieldRequired",(function(e,n){e!==n&&(e?N&&-1!==t.currentIndex?H(!0):H(!1):b[t.inputName].$setValidity(I,!0))})),t.$on("angucomplete-alt:clearInput",(function(e,n){n&&n!==t.id||(t.searchStr=null,U(),H(!1),ee())})),t.$on("angucomplete-alt:changeInput",(function(e,n,r){n&&n===t.id&&P(r)})),t.onFocusHandler=function(){t.focusIn&&t.focusIn(),0!==k||t.searchStr&&0!==t.searchStr.length||(t.currentIndex=t.focusFirst?0:t.currentIndex,t.showDropdown=!0,ie())},t.hideResults=function(){O&&(O===t.id+"_dropdown"||O.indexOf("angucomplete")>=0)?O=null:(C=i((function(){ee(),t.$apply((function(){t.searchStr&&t.searchStr.length>0&&R.val(t.searchStr)}))}),y),J(),t.focusOut&&t.focusOut(),t.overrideSuggestions&&t.searchStr&&t.searchStr.length>0&&-1===t.currentIndex&&G())},t.resetHideResults=function(){C&&i.cancel(C)},t.hoverRow=function(e){t.currentIndex=e},t.selectResult=function(e){t.matchClass&&(e.title=j(e.originalObject),e.description=Q(e.originalObject,t.descriptionField)),t.clearSelected?t.searchStr=null:t.searchStr=e.title,U(e),ee()},t.inputChangeHandler=function(e){return e.length<k?(J(),ee()):0===e.length&&0===k&&(t.searching=!1,ie()),t.inputChanged&&(e=t.inputChanged(e)),e},t.fieldRequiredClass&&""!==t.fieldRequiredClass&&(I=t.fieldRequiredClass),t.minlength&&""!==t.minlength&&(k=parseInt(t.minlength,10)),t.pause||(t.pause=m),t.clearSelected||(t.clearSelected=!1),t.overrideSuggestions||(t.overrideSuggestions=!1),t.fieldRequired&&b&&(t.initialValue?H(!0):H(!1)),t.inputType=a.type?a.type:"text",t.textSearching=a.textSearching?a.textSearching:x,t.textNoResults=a.textNoResults?a.textNoResults:w,T="false"!==t.textSearching,_="false"!==t.textNoResults,t.maxlength=a.maxlength?a.maxlength:g,R.on("keydown",(function(e){var n=z(e),r=null,i=null;n===d&&t.results?(t.currentIndex>=0&&t.currentIndex<t.results.length?(e.preventDefault(),t.selectResult(t.results[t.currentIndex])):(G(e),ee()),t.$apply()):n===s&&t.results?(e.preventDefault(),t.currentIndex+1<t.results.length&&t.showDropdown&&(t.$apply((function(){t.currentIndex++,W()})),$&&(r=B(),D.getBoundingClientRect().top+parseInt(getComputedStyle(D).maxHeight,10)<r.getBoundingClientRect().bottom&&V(function(e){var t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,10)+parseInt(t.marginBottom,10)}(r))))):n===c&&t.results?(e.preventDefault(),t.currentIndex>=1?(t.$apply((function(){t.currentIndex--,W()})),$&&(i=B().getBoundingClientRect().top-(D.getBoundingClientRect().top+parseInt(getComputedStyle(D).paddingTop,10)))<0&&V(i-1)):0===t.currentIndex&&t.$apply((function(){t.currentIndex=-1,R.val(t.searchStr)}))):n===p?t.results&&t.results.length>0&&t.showDropdown?-1===t.currentIndex&&t.overrideSuggestions?G():(-1===t.currentIndex&&(t.currentIndex=0),t.selectResult(t.results[t.currentIndex]),t.$digest()):t.searchStr&&t.searchStr.length>0&&G():n===f&&e.preventDefault()})),R.on("keyup",(function(e){var n=z(e);if(n!==l&&n!==u)if(n===c||n===d)e.preventDefault();else if(n===s)e.preventDefault(),!t.showDropdown&&t.searchStr&&t.searchStr.length>=k&&(te(),t.searching=!0,ne(t.searchStr));else if(n===f)ee(),t.$apply((function(){R.val(t.searchStr)}));else{if(0===k&&!t.searchStr)return;t.searchStr&&""!==t.searchStr?t.searchStr.length>=k&&(te(),A&&i.cancel(A),t.searching=!0,A=i((function(){ne(t.searchStr)}),t.pause)):t.showDropdown=!1,N&&N!==t.searchStr&&!t.clearSelected&&t.$apply((function(){U()}))}})),E="remoteUrlResponseFormatter",S=function(e){return t[E]?t[E](e):e},i((function(){var e=getComputedStyle(D);$=e.maxHeight&&"auto"===e.overflowY}))}return(o.put("/angucomplete-alt/index.html",'<div class="angucomplete-holder" ng-class="{\'angucomplete-dropdown-visible\': showDropdown}"> <input id="{{id}}_value" name="{{inputName}}" tabindex="{{fieldTabindex}}" ng-class="{\'angucomplete-input-not-empty\': notEmpty}" ng-model="searchStr" ng-disabled="disableInput" type="{{inputType}}" placeholder="{{placeholder}}" maxlength="{{maxlength}}" ng-focus="onFocusHandler()" class="{{inputClass}}" ng-focus="resetHideResults()" ng-blur="hideResults($event)" autocapitalize="off" autocorrect="off" autocomplete="off" ng-change="inputChangeHandler(searchStr)"/> <div id="{{id}}_dropdown" class="angucomplete-dropdown" ng-show="showDropdown"> <div class="angucomplete-searching" ng-show="searching" ng-bind="textSearching"></div> <div class="angucomplete-searching" ng-show="!searching && (!results || results.length == 0)" ng-bind="textNoResults"></div> <div class="angucomplete-row" ng-repeat="result in results" ng-click="selectResult(result)" ng-mouseenter="hoverRow($index)" ng-class="{\'angucomplete-selected-row\': $index == currentIndex}"> <div ng-if="imageField" class="angucomplete-image-holder"> <img ng-if="result.image && result.image != \'\'" ng-src="{{result.image}}" class="angucomplete-image"/> <div ng-if="!result.image && result.image != \'\'" class="angucomplete-image-default"></div> </div> <div class="angucomplete-title" ng-if="matchClass" ng-bind-html="result.title"></div> <div class="angucomplete-title" ng-if="!matchClass">{{ result.title }}</div> <div ng-if="matchClass && result.description && result.description != \'\'" class="angucomplete-description" ng-bind-html="result.description"></div> <div ng-if="!matchClass && result.description && result.description != \'\'" class="angucomplete-description">{{result.description}}</div> </div> </div></div>'),{restrict:"EA",require:"^?form",scope:{selectedObject:"=",selectedObjectData:"=",disableInput:"=",initialValue:"=",localData:"=",localSearch:"&",remoteUrlRequestFormatter:"=",remoteUrlRequestWithCredentials:"@",remoteUrlResponseFormatter:"=",remoteUrlErrorCallback:"=",remoteApiHandler:"=",id:"@",type:"@",placeholder:"@",textSearching:"@",textNoResults:"@",remoteUrl:"@",remoteUrlDataField:"@",titleField:"@",descriptionField:"@",imageField:"@",inputClass:"@",pause:"@",searchFields:"@",minlength:"@",matchClass:"@",clearSelected:"@",overrideSuggestions:"@",fieldRequired:"=",fieldRequiredClass:"@",inputChanged:"=",autoMatch:"@",focusOut:"&",focusIn:"&",fieldTabindex:"@",inputName:"@",focusFirst:"@",parseInput:"&"},templateUrl:function(e,t){return t.templateUrl||"/angucomplete-alt/index.html"},compile:function(e){var t=a.startSymbol(),n=a.endSymbol();if("{{"!==t||"}}"!==n){var r=e.html().replace(/\{\{/g,t).replace(/\}\}/g,n);e.html(r)}return b}})}])}(window.angular)}()},29:function(e,t){angular.module("graphdb.framework.rest.connectors.service",[]).factory("ConnectorsRestService",r),r.$inject=["$http"];const n="rest/connectors";function r(e){return{getConnectors:function(){return e.get(n)},initConnector:function(t){return e.get(`${n}/options?prefix=${t}`)},hasConnector:function(t){return e.get(`${n}/existing?prefix=${t}`)},checkConnector:function(t){return e.post(`${n}/check`,t,{headers:{"Content-Type":"text/plain"}})}}}},31:function(e,t){function n(e){return{showToastMessageWithDelay:function(t){return new Promise(n=>{e.success(t),setTimeout(n,200)})}}}angular.module("graphdb.framework.utils.notifications",[]).factory("Notifications",n),n.$inject=["toastr"]},32:function(e,t,n){"use strict";n.r(t);n(10),n(29);function r(e){const t=[];return Object.keys(e).forEach((function(n){t.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]))})),t.join("&")}function i(e,t){for(let r=0;r<t.length;r++){const i=t[r];if("StringArray"===i.__type)e[i.__name]||(e[i.__name]=[""]);else if("OptionArray"===i.__type)if(e[i.__name])for(let t=0;t<i.__childOptions.length;t++){const n=i.__childOptions[t];if("Boolean"===n.__type)for(let t=0;t<e[i.__name].length;t++){const r=e[i.__name][t];!r.hasOwnProperty([n.__name])&&angular.isDefined(n.__defaultValue)&&(r[n.__name]=n.__defaultValue)}}else{e[i.__name]=[];const t={};for(let e=0;e<i.__childOptions.length;e++){const n=i.__childOptions[e];"StringArray"===n.__type?t[n.__name]=[""]:t[n.__name]=angular.isUndefined(n.__defaultValue)?"":n.__defaultValue}e[i.__name].push(t)}else"Map"===i.__type?e[i.__name]?e[i.__name]=(n=e[i.__name],_.map(n,(function(e,t){return{key:t,value:e}}))):e[i.__name]=[]:"JsonString"===i.__type?!e[i.__name]||e[i.__name]instanceof String||"string"==typeof e[i.__name]||(e[i.__name]=angular.toJson(e[i.__name],2)):angular.isUndefined(e[i.__name])&&(e[i.__name]=angular.isUndefined(i.__defaultValue)?"":i.__defaultValue)}var n;return e}function o(e,t,n){return e.post("repositories/"+t,r({query:n}),{headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/sparql-results+json","X-GraphDB-Local-Consistency":"updating"}})}function a(e){return e.substring(0,e.length-1)+"/instance#"}function s(e,t,n,r,i){const o=function e(t,n){const r={};return _.each(n,(function(n){angular.isDefined(t[n.__name])&&("OptionArray"===n.__type?(r[n.__name]=[],_.each(t[n.__name],(function(t){r[n.__name].push(e(t,n.__childOptions))}))):r[n.__name]=angular.copy(t[n.__name]))})),r}(n,r);for(let e=0;e<r.length;e++)try{"Map"===r[e].__type?o[r[e].__name]=(s=o[r[e].__name],_.reduce(s,(function(e,t){if(""===t.key&&""===t.value);else{if(""===t.key)throw new Error('Key may not be empty with value "'+t.value+'"');if(e.hasOwnProperty(t.key))throw new Error("Duplicate key "+t.key);e[t.key]=t.value}return e}),{})):"JsonString"===r[e].__type&&(o[r[e].__name]=angular.fromJson(o[r[e].__name]))}catch(t){return i(r[e].__label,t.message),null}var s;!function e(t){Array.isArray(t)&&(t=_.filter(t,(function(e){return null!==e&&(!e.trim||""!==e.trim())})));return Object.keys(t).forEach((function(n){""!==t[n]&&null!=t[n]||!1===t[n]?"object"==typeof t[n]&&(t[n]=e(t[n])):delete t[n]})),t}(o);let u="";return u+="PREFIX :<"+t+">\n",u+="PREFIX inst:<"+a(t)+">\n",u+="INSERT DATA {\n",u+="\tinst:"+e+" :createConnector '''\n",u+=angular.toJson(o,2),u+="\n''' .\n}\n",u=u.replace(/\\/g,"\\\\\\"),u}function u(e,t,n,u,c,l,f,d,p){function h(t){e.beingBuiltConnector={percentDone:0,status:{processedEntities:0,estimatedEntities:0,indexedEntities:0,entitiesPerSecond:0},actionName:t?"Repairing":"Creating",waitOnRepairStartOnce:!!t,eta:"-",inline:!1,iri:null}}function g(t,n,r){return h(r),$.extend(e.beingBuiltConnector,{iri:a(t)+n,name:n,inline:!1,doneCallback:function(){e.beingBuiltConnector.modalInstance.dismiss("cancel")}}),e.beingBuiltConnector.modalInstance=u.open({templateUrl:"pages/connectorProgress.html",controller:"CreateProgressCtrl",size:"lg",backdrop:"static",scope:e}),e.beingBuiltConnector.modalInstance}function m(t,i,o){const a=g(t.value,i.name,!1);d.addStatements(n.getActiveRepository(),r({update:i.query})).then((function(){p.getConnectors().then((function(){p.hasConnector(encodeURIComponent(t.value)).then((function(n){e.existing[t.key]=n.data}))})),c.success("Created connector "+i.name)}),(function(e){c.error(getError(e)),o()})).finally((function(){a.dismiss("cancel")}))}e.loader=!1,e.controllers=[],e.existing={},e.definitions={},e.getLoaderMessage=function(){const t=(Date.now()-e.loaderStartTime)/1e3,n=e.getHumanReadableSeconds(t);let r="";return r=e.progressMessage?e.progressMessage+"... "+n:"Running operation..."+n,e.extraMessage&&t>10&&(r+="\n"+e.extraMessage),r},e.setLoader=function(t,n,r){t?(e.loader=!0,e.loaderStartTime=Date.now(),e.progressMessage=n,e.extraMessage=r):(e.loader=!1,e.progressMessage="",e.extraMessage="")},e.initConnector=function(t){return p.initConnector(encodeURIComponent(t.value)).then((function(n){return e.definitions[t.key]=n.data,p.hasConnector(encodeURIComponent(t.value)).then((function(n){e.existing[t.key]=n.data}))}))},e.getConnectors=function(){e.canWriteActiveRepo()&&(e.setLoader(!0,"Fetching connectors","Normally this is a fast operation but it may take longer if a bigger repository needs to be initialised first."),p.getConnectors().then((function(r){e.connectors=Object.keys(r.data).map((function(e){return{key:e,value:r.data[e]}})),f.all(_.map(e.connectors,(function(t){return e.initConnector(t)}))).finally((function(){h();const r=function(e){const t=_.map(e,(function(e){return"<"+e.value+"connectorStatus>"})).join("|");return t?"SELECT ?connector ?status { ?connector "+t+" ?status }":null}(e.connectors);r?function(e){return o(t,n.getActiveRepository(),e)}(r).then((function(t){const n=function(e){if(e.bindings)for(let t=0;t<e.bindings.length;t++)try{const n=JSON.parse(e.bindings[t].status.value);if("BUILDING"===n.status)return{connector:e.bindings[t].connector.value,status:n}}catch(e){console.error(e)}return{}}(t.data.results);if(n.connector){const t=n.connector.split(/#/);t[0]=t[0].replace(/\/instance$/,"#"),r=t[0],i=t[1],h(),$.extend(e.beingBuiltConnector,{iri:a(r)+i,name:i,inline:!0,doneCallback:function(){e.beingBuiltConnector.inline=!1}})}var r,i})).finally((function(){e.setLoader(!1)})):e.setLoader(!1)}))})).catch((function(t){e.setLoader(!1),c.error(getError(t),"Could not get connectors")})),e.existing={})},e.getOptions=function(t){return e.definitions[t.key]},e.isEmpty=function(e){return angular.isObject(e)&&0===Object.keys(e).length},e.toPrettyJson=function(e){return angular.toJson(e,2)},e.$watch((function(){return n.getActiveRepository()}),e.getConnectors),e.$watch((function(){return n.getActiveLocation()}),e.getConnectors),e.copyConnector=function(t,n){let r;angular.isUndefined(n)||(r=angular.copy(n),r.name=r.name+"-copy"),u.open({templateUrl:"pages/createConnector.html",controller:"CreateConnectorCtrl",size:"lg",backdrop:"static",resolve:{connector:function(){return t},values:function(){return angular.isUndefined(r)?{name:"",values:{}}:r},options:function(){return e.getOptions(t)}}}).result.then((function(n){m(t,n,(function(){n.skipConversion=!0,e.newConnector(t,n)}))}))},e.newConnector=function(t,n){u.open({templateUrl:"pages/createConnector.html",controller:"CreateConnectorCtrl",size:"lg",backdrop:"static",resolve:{connector:function(){return t},values:function(){return angular.isUndefined(n)?{name:"",values:{}}:n},options:function(){return e.getOptions(t)}}}).result.then((function(n){m(t,n,(function(){n.skipConversion=!0,e.newConnector(t,n)}))}))},e.repair=function(t,i){l.openSimpleModal({title:"Confirm repair",message:"Are you sure you want to repair this connector?<br>Note that repair means delete + recreate with the same settings.",warning:!0}).result.then((function(){const o=g(i.value,t.name,!0),s=(u=t.name,"PREFIX prefix:<"+(l=i.value)+">\nINSERT DATA {\n\t<"+a(l)+u+'> prefix:repairConnector ""\n}');var u,l;d.addStatements(n.getActiveRepository(),r({update:s})).then((function(){p.getConnectors().then((function(){p.hasConnector(encodeURIComponent(i.value)).then((function(t){e.existing[i.key]=t.data}))})),c.success("Repaired connector "+t.name)}),(function(e){c.error(getError(e))})).finally((function(){o.dismiss("cancel")}))}))},e.delete=function(t,i){const o=i.key.indexOf("Elastic")>=0||i.key.indexOf("Solr")>=0;u.open({templateUrl:"js/angular/externalsync/templates/deleteConnector.html",controller:"DeleteConnectorCtrl",resolve:{type:function(){return i.key},isExternal:function(){return o}}}).result.then((function(a){e.setLoader(!0,"Deleting connector "+t.name,"This is usually a fast operation but it might take a while.");const s=function(e,t,n){const r=t.substring(0,t.length-1)+"/instance#";return"PREFIX prefix:<"+t+">\nINSERT DATA {\n\t<"+r+e+'> prefix:dropConnector "'+(n?"force":"")+'"\n}'}(t.name,i.value,a);d.addStatements(n.getActiveRepository(),r({update:s})).then((function(){p.getConnectors().then((function(){p.hasConnector(encodeURIComponent(i.value)).then((function(t){e.existing[i.key]=t.data}))})),a?(c.success("Deleted (with force) connector "+t.name),o&&c.warning("You may have to remove the index manually from "+i.key)):c.success("Deleted connector "+t.name)}),(function(e){c.error(getError(e))})).finally((function(){e.setLoader(!1)}))}))},e.viewQuery=function(t,n){u.open({templateUrl:"pages/viewQuery.html",controller:"ViewQueryCtrl",resolve:{query:function(){const r=e.getOptions(t);return s(n.name,t.value,i(n.values,r),r)}}})}}function c(e,t,n,r){e.force=!1,e.type=n,e.isExternal=r,e.ok=function(){t.close(e.force)},e.cancel=function(){t.dismiss()}}function l(e,t,n,r,i){function o(){return s(e.name,n.value,e.values,e.options,(function(e,t){i.error(t,e)}))}e.connector=n,e.addField=function(t,n){const r=angular.copy(e.defaultValues[n][0]);e.values[n].splice(t+1,0,r)},e.addOption=function(e,t){t.splice(e+1,0,"")},e.deleteOption=function(e,t){t.splice(e,1)},e.addMapOption=function(e,t){t.splice(e+1,0,{key:"",value:""})},e.deleteMapOption=function(e,t){t.splice(e,1)},e.ok=function(){if(e.form.$valid){const n=o();n&&t.close({name:e.name,values:e.values,options:e.options,query:n})}},e.viewQuery=function(){const e=o();e&&r.open({templateUrl:"pages/viewQuery.html",controller:"ViewQueryCtrl",resolve:{query:function(){return e}}})},e.cancel=function(){t.dismiss("cancel")}}function f(e,t,n,r,o,a,s,u){angular.extend(this,t("ExtendNewConnectorCtrl",{$scope:e,$modalInstance:r,connector:o,$modal:a})),e.values=s.values,e.options=u,e.name=s.name,s.skipConversion||(e.values=i(e.values,e.options)),e.defaultValues=angular.copy(e.values)}function d(e,t,n,r){function i(){const i=function(e){const t=e.replace(/\/instance#.+$/,"#connectorStatus");let n="";return n+="SELECT ?status {\n",n+="\t<"+e+"> <"+t+"> ?status",n+="\n}",n}(e.beingBuiltConnector.iri);e.beingBuiltConnector.iri=null,e.progressInterval=t((function(){(function(e){return o(n,r.getActiveRepository(),e)})(i).then((function(n){const r=function(e){if(e.bindings&&e.bindings.length>0)try{return JSON.parse(e.bindings[0].status.value)}catch(e){console.error(e)}return{}}(n.data.results);"BUILDING"===r.status?(e.beingBuiltConnector.status=r,e.beingBuiltConnector.percentDone=(100*r.processedEntities/r.estimatedEntities).toFixed(0),e.beingBuiltConnector.eta=e.getHumanReadableSeconds(r.etaSeconds),e.beingBuiltConnector.actionName=r.repair?"Repairing":"Creating",e.beingBuiltConnector.waitOnRepairStartOnce=!1):"BUILT"!==r.status||e.beingBuiltConnector.waitOnRepairStartOnce||(t.cancel(e.progressInterval),e.beingBuiltConnector.doneCallback&&e.beingBuiltConnector.doneCallback())}))}),1e3),e.$on("$destroy",(function(){t.cancel(e.progressInterval)}))}e.beingBuiltConnector=e.beingBuiltConnector||{},!e.beingBuiltConnector.inline&&e.beingBuiltConnector.iri&&i(),e.$watch("beingBuiltConnector.iri",(function(t){e.beingBuiltConnector.inline&&t&&i()}))}angular.module("graphdb.framework.externalsync.controllers",["graphdb.framework.rest.rdf4j.repositories.service","graphdb.framework.rest.connectors.service"]).controller("ConnectorsCtrl",u).controller("ExtendNewConnectorCtrl",l).controller("CreateConnectorCtrl",f).controller("CreateProgressCtrl",d).controller("DeleteConnectorCtrl",c).filter("ceil",(function(){return function(e){return Math.ceil(e)}})),u.$inject=["$scope","$http","$repositories","$modal","toastr","ModalService","$q","RDF4JRepositoriesRestService","ConnectorsRestService"],c.$inject=["$scope","$modalInstance","type","isExternal"],l.$inject=["$scope","$modalInstance","connector","$modal","toastr"],f.$inject=["$scope","$controller","$http","$modalInstance","connector","$modal","values","options"],d.$inject=["$scope","$interval","$http","$repositories"]},33:function(e,t,n){"use strict";n.r(t);n(4),n(12);function r(e,t,n,r,i,o,a,s,u,c,l,f,d,p){const h={id:"1",name:"",query:"select * where { \n\t?s ?p ?o .\n} limit 100 \n",inference:!0,sameAs:!0};let g,m=c.getPrincipal();function y(e,t){h.inference=t.appSettings.DEFAULT_INFERENCE,h.sameAs=t.appSettings.DEFAULT_SAMEAS,e.skipCountQuery=!t.appSettings.EXECUTE_COUNT,e.ignoreSharedQueries=t.appSettings.IGNORE_SHARED_QUERIES,e.tabsData=e.tabs=d.get(p.TABS_STATE)||[h],e.$watchCollection("[currentQuery.inference, currentQuery.sameAs]",(function(e,t,n){v(n.currentQuery)})),e.$on("repositoryIsSet",C)}function v(t){!function(){if(r.isActiveRepoOntopType())return;const t=document.getElementById("sameAs");!t||e.currentQuery.inference||t.disabled?e.currentQuery.inference&&t.disabled&&(t.removeAttribute("disabled"),e.currentQuery.sameAs=m.appSettings.DEFAULT_SAMEAS):(t.disabled=!0,e.currentQuery.sameAs=!1)}(),e.tabs.forEach((function(n,i){n.id===t.id&&(e.tabs[i].query=t.query,r.isActiveRepoOntopType()||(e.tabs[i].inference=t.inference,e.tabs[i].sameAs=t.sameAs))})),d.set(p.TABS_STATE,e.tabs)}function x(t,n,r,i){const o=angular.element(document.getElementById("yasr-inner"));e.queryIsRunning=t,t?(e.queryStartTime=Date.now(),e.countTimeouted=!1,e.progressMessage=n,e.extraMessage=r,e.noLoaderTimer=i,o.addClass("hide")):(e.progressMessage="",e.extraMessage="",e.noLoaderTimer=!1,e.currentTrackAlias=null,e.abortRequested=!1,o.removeClass("hide")),null===e.$$phase&&e.$apply()}function w(n){function r(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0}if(e.orientationViewMode){if("yasr"===e.viewMode){let e=r()-document.querySelector(".CodeMirror-wrap").getBoundingClientRect().top;e-=40,document.querySelector(".CodeMirror-wrap").style.height=e+"px"}else e.noPadding={},document.querySelector(".CodeMirror-wrap").style.height="";document.getElementById("yasr").style.minHeight=""}else if(e.noPadding={paddingRight:15,paddingLeft:0},window.editor&&document.querySelector(".CodeMirror-wrap")){let e=r()-document.querySelector(".CodeMirror-wrap").getBoundingClientRect().top;e-=40,document.querySelector(".CodeMirror-wrap").style.height=e+"px",document.getElementById("yasr").style.minHeight=e+"px"}else{let r;r=t(n?function(){e.fixSizesOnHorizontalViewModeSwitch(n)}:e.fixSizesOnHorizontalViewModeSwitch,100),e.$on("$destroy",(function(){t.cancel(r)}))}window.yasr&&window.yasr.container&&t((function(){window.yasr.container.resize()}),100)}function b(){w(!0)}function C(t,n){n.newRepo&&(e.tabsData=d.get(p.TABS_STATE),e.tabsData.forEach((function(e){e.yasrData=void 0,e.queryType=void 0,e.resultsCount=0,e.allResultsCount=0,e.sizeDelta=void 0})),d.set(p.TABS_STATE,e.tabsData),e.tabs=e.tabsData,e.currentQuery={},e.errorMessage=null,e.repositoryError=null)}function S(e){t((function(){$('a[data-id = "'+e+'"]').tab("show")}),0)}function M(i,o){if(e.executedQueryTab=e.currentQuery,o){if("SELECT"!==window.editor.getQueryType()&&"CONSTRUCT"!==window.editor.getQueryType())return void n.warning("Explain only works with SELECT or CONSTRUCT queries.");if(r.isActiveRepoOntopType())return void n.warning("Explain not supported for Virtual repositories.")}if(e.explainRequested=o,!e.queryIsRunning){if(i?e.currentTabConfig.resultsCount=0:e.resetCurrentTabConfig(),e.lastRunQueryMode=window.editor.getQueryMode(),"update"===e.lastRunQueryMode&&r.isActiveRepoOntopType())return void n.warning("Updates are not supported for Virtual repositories.");if(x(!0,"update"===e.lastRunQueryMode?"Executing update":"Evaluating query"),"none"!==e.viewMode){e.viewMode="none",e.orientationViewMode&&e.fixSizesOnHorizontalViewModeSwitch();const n=t(window.editor.query,500);e.$on("$destroy",(function(){t.cancel(n)}))}else window.editor.query()}}function T(){e.showSampleQueries=!e.showSampleQueries,e.showSampleQueries?a.getSavedQueries().success((function(t){e.sampleQueries=t,$("#sampleQueriesCollapse").collapse("show").width("300px")})).error((function(e){const t=getError(e);n.error(t,"Error! Could not get saved queries")})):$("#sampleQueriesCollapse").collapse("hide")}function _(t){let n=void 0;return e.tabsData.forEach((function(e){if(e.name===t.name&&e.query===t.body)return n=e.id,e})),n}function E(t){return function(n,r,i){e.savedQuery={name:n,query:r||window.editor.getValue(),shared:i},$(t).modal("show")}}function R(t){for(let n=0;n<e.tabsData.length;n++){if(e.tabsData[n].id===t)return n}}m?y(e,m):e.$on("securityInit",(function(e){m=c.getPrincipal(),y(e.currentScope,m)})),this.hint=document.createElement("span"),this.hint.innerHTML='Hint: "abC" matches "abC*", "ab c*" and "ab-c*"',this.hint.style.fontSize="12px",this.hint.style.color="gray",this.hint.style.backgroundColor="white",this.hint.style.position="absolute",this.hint.style.zIndex="3",this.hint.style.paddingLeft="12px",e.$watch((function(){return angular.element(".CodeMirror-hints").length}),e=>{if(e){const e=angular.element(".CodeMirror-hints")[0].getBoundingClientRect();document.body.appendChild(this.hint),this.hint.style.top=e.top-20+"px",this.hint.style.left=e.right-this.hint.offsetWidth-12+"px"}else this.hint&&this.hint.parentNode&&this.hint.parentNode.removeChild(this.hint)}),e.resetCurrentTabConfig=function(){e.currentTabConfig={pageSize:1e3,page:1,allResultsCount:0,resultsCount:0}},e.queryExists=!1,e.resetCurrentTabConfig(),e.saveTab=function(t){const n=R(t);if(void 0===n)return{};const r=e.tabsData[n];return e.saveQueryToLocal(r),r},e.loadTab=function(n){e.tabsData=d.get(p.TABS_STATE)||[h];const i=R(n),o=e.tabsData[i];o.yasrData&&x(!0,"Rendering results",null,!0);t((function(){""===e.currentQuery.query&&(e.currentQuery.query=" "),t((function(){window.editor.setValue(e.currentQuery.query),e.yasr.updateDownloadDropdown(),e.$broadcast("tabLoaded",e.currentQuery.id),e.yasr.options.output=o.outputType,o.yasrData&&(o.yasrData.customError?(e.yasr.results={getException:function(){return o.yasrData.customError}},x(!1)):t((function(){e.setYasrResponse(o.yasrData,o.textStatus,o.jqXhrOrErrorString),x(!1),$(".yasr_btnGroup li:nth-child(2)").hasClass("active")&&t((function(){$(".yasr_btnGroup li:nth-child(2) a").get(0).click()}),0)}),0))}),0)}),0),d.set(p.TABS_STATE_CURRENT_ID,n),e.currentQuery=o,t((function(){e.currentTabConfig={},e.currentTabConfig.queryType=o.queryType,e.currentTabConfig.resultsCount=o.resultsCount,e.currentTabConfig.offset=o.offset,e.currentTabConfig.allResultsCount=o.allResultsCount,e.currentTabConfig.allResultsCountExact=o.allResultsCountExact,e.currentTabConfig.page=o.page,e.currentTabConfig.pageSize=o.pageSize,e.currentTabConfig.timeFinished=o.timeFinished,e.currentTabConfig.timeTook=o.timeTook,e.currentTabConfig.sizeDelta=o.sizeDelta,e.currentTabConfig.customUpdateMessage=o.customUpdateMessage,e.currentTabConfig.errorMessage=o.errorMessage,e.currentTabConfig.warningMessage=o.warningMessage,e.$apply()}),0),$("#yasr").css("padding","0"),g||(g=setInterval(I,200));!function(){const t=r.isActiveRepoOntopType(),n=r.isActiveRepoFedXType();(function(e){const t=document.getElementById("sameAs"),n=document.getElementById("inference");t&&(t.disabled=!!e);n&&(n.disabled=!!e)})(t),e.nocount=!(!t&&!n)||!m.appSettings.EXECUTE_COUNT,t&&(e.currentQuery.inference=!0,e.currentQuery.sameAs=!0)}()},e.addNewTab=function(n,r,i){if(!N(!0))return;let o;o=r||i?{id:"1",name:r,query:i,inference:m.appSettings.DEFAULT_INFERENCE,sameAs:m.appSettings.DEFAULT_SAMEAS}:{id:"1",name:"",query:"select * where { \n\t?s ?p ?o .\n} limit 100 \n",inference:m.appSettings.DEFAULT_INFERENCE,sameAs:m.appSettings.DEFAULT_SAMEAS};k++;const a=""+k;e.tabsData=e.tabs;const s=o;s.id=a,e.tabsData.push(s),d.set(p.TABS_STATE_MAXID,k),d.set(p.TABS_STATE,e.tabsData);const u=Array.prototype.slice.call(arguments,1);t((function(){e.$apply(),S(a),n&&n.apply(this,u)}),0),e.tabs=e.tabsData},e.isTabChangeOk=N,e.runQuery=M,e.abortCurrentQuery=function(){f.abortQueryByAlias(e.currentTrackAlias).success((function(){e.abortRequested=!0}))},e.editQuery=function(t){i.open({templateUrl:"js/angular/core/directives/queryeditor/templates/query-sample.html",controller:"QuerySampleModalCtrl",resolve:{data:function(){return{title:'Edit Saved Query: "'+t.name+'"',query:t,edit:!0,okButtonText:"Save"}}}}).result.then((function(r){const i={name:r.name,body:r.body,shared:r.shared};t.name!==r.name?a.addNewSavedQuery(i).success((function(){e.deleteQueryHttp(t.name,!0)})).error((function(e){const t=getError(e);n.error(t,"Error! Cannot edit saved query")})):a.editSavedQuery(i).success((function(){$("#editQueryContainer").modal("hide"),e.toggleSampleQueries(),n.success("Saved query "+t.name+" was edited.")})).error((function(e){const t=getError(e);n.error(t,"Error! Cannot edit Saved query")}))}))},e.getNamespaces=function(){x(!0,"Refreshing namespaces","Normally this is a fast operation but it may take longer if a bigger repository needs to be initialised first."),e.namespacesLoading=!0,l.getRepositoryNamespaces().success((function(t){const n={};t.results.bindings.forEach((function(e){n[e.prefix.value]=e.namespace.value})),e.namespaces=n})).error((function(t){e.repositoryError=getError(t)})).finally((function(){x(!1),e.namespacesLoading=!1}))},e.changePagination=function(){M(!0,e.explainRequested)},e.toggleSampleQueries=T,e.addKnownPrefixes=function(){a.addKnownPrefixes(JSON.stringify(window.editor.getValue())).success((function(e){angular.isDefined(window.editor)&&angular.isDefined(e)&&e!==window.editor.getValue()&&window.editor.setValue(e)})).error((function(e){const t=getError(e);return n.error(t,"Error! Could not add known prefixes"),!0}))},e.getExistingTabId=_,e.querySelected=function(t){const n=_(t);e.toggleSampleQueries(),e.isTabChangeOk(!1)&&(e.highlightNextTabChange=!0,angular.isDefined(n)?S(n):e.addNewTab(null,t.name,t.body))},e.deleteQuery=function(t){o.openSimpleModal({title:"Confirm",message:"Are you sure you want to delete the saved query '"+t+"'?",warning:!0}).result.then((function(){e.deleteQueryHttp(t)}))},e.deleteQueryHttp=function(t,r){a.deleteSavedQuery(t).success((function(){e.toggleSampleQueries(),r||n.success("Saved query: "+t+" was deleted.")})).error((function(e){const t=getError(e);n.error(t,"Error! Cannot delete saved query")}))},e.saveQuery=function(t,n){i.open({templateUrl:"js/angular/core/directives/queryeditor/templates/query-sample.html",controller:"QuerySampleModalCtrl",resolve:{data:function(){return{title:"Create New Saved Query",query:{name:t.name,body:t.query,shared:t.shared},edit:!1,okButtonText:"Create",queryExists:n}}}}).result.then((function(t){e.saveQueryHttp(t)}),(function(){}))},e.saveQueryHttp=function(t){a.addNewSavedQuery(t).success((function(){n.success("Saved query "+t.name+" was saved.")})).error((function(r){let i=getError(r);if(n.error(i,"Error! Cannot create saved query"),i="Query '"+t.name+"' already exists!"){t.query=t.body;const n=!0;e.saveQuery(t,n)}}))},e.saveQueryToLocal=v,e.setLoader=x,e.getLoaderMessage=function(){const t=(Date.now()-e.queryStartTime)/1e3;let n="",r="";e.noLoaderTimer||(n=e.getHumanReadableSeconds(t));r=e.progressMessage?e.progressMessage+"... "+n:"Running operation... "+n;e.extraMessage&&t>10&&(r+="\n"+e.extraMessage);return r},e.fixSizesOnHorizontalViewModeSwitch=w,e.changeViewMode=function(){e.viewMode="none",e.orientationViewMode=!e.orientationViewMode,d.set(p.VIEW_MODE,e.orientationViewMode),w()},e.showHideEditor=b,e.focusQueryEditor=function(){angular.element(document).find(".editable-input").is(":focus")||angular.element(document).find(".CodeMirror textarea:first-child").focus()},e.orientationViewMode=!d.get(p.VIEW_MODE)||"true"===d.get(p.VIEW_MODE),e.viewMode="none",e.getActiveRepository=function(){return r.getActiveRepository()},e.getActiveRepositoryNoError=function(){if(!e.repositoryError)return r.getActiveRepository()},e.orientationViewMode||b(),window.onbeforeunload=function(){e.currentQuery&&e.saveTab(e.currentQuery.id),d.set(p.TABS_STATE,e.tabs)},e.$on("$destroy",(function(){e.currentQuery&&e.saveTab(e.currentQuery.id),d.set(p.TABS_STATE,e.tabs),clearInterval(g)})),e.$on("$destroy",(function(){clearInterval(g),window.editor=null,window.yasr=null})),$(document).mouseup((function(t){const n=$("#sampleQueriesCollapse");!n.is(t.target)&&0===n.has(t.target).length&&e.showSampleQueries&&T()}));let k=d.get(p.TABS_STATE_MAXID)||1;function A(e){return $(e).attr("data-id")}function I(){if(e.currentTabConfig.resultsCount>=0){const e=$(".saveAsDropDown");e.length>0&&!window.editor.queryValid?yasr.header.find(".saveAsDropDown").remove():0===e.length&&window.editor.queryValid&&yasr.updateDownloadDropdown()}}function N(t){return!(e.queryIsRunning&&!e.namespacesLoading)||(t?n.info("New tabs may not be opened while query or update is running."):n.info("Tabs may not be switched while query or update is running."),!1)}e.highlightNextTabChange=!1,e.$on("tabAction",(function(n,r){r.relatedTarget&&(t.cancel(r.relatedTarget.timer),$(r.relatedTarget).css("color",""),e.saveTab(A(r.relatedTarget))),e.loadTab(A(r.target));const i=["#ED4F2F","","#ED4F2F"],o=[400,400,400];if(e.highlightNextTabChange){e.highlightNextTabChange=!1;let n=0;$(r.target).css("color",i[n]);const a=function(){n++,n<i.length?($(r.target).css("color",i[n]),r.target.timer=t(a,o[n])):$(r.target).css("color","")};t(a,o[n])}})),e.$on("deleteAllexeptSelected",(function(t,n){e.tabsData=n,e.tabs=n})),e.currentQuery={},e.showSampleQueries=!1,e.savedQuery={},e.sampleQueries={},e.editQueryModal=E("#editQueryContainer"),e.deleteQueryModal=E("#confirmDeleteContainer"),e.saveQueryModal=E("#saveQueryContainer"),e.getResultsDescription=function(){let t;if(0===e.currentTabConfig.resultsCount)t="No results.";else{const n=(e.currentTabConfig.page-1)*e.currentTabConfig.pageSize+Math.min(e.currentTabConfig.resultsCount,e.currentTabConfig.pageSize);t="Showing results from "+s("currency")(e.currentTabConfig.offset,"",0)+" to "+s("currency")(n,"",0),e.currentTabConfig.allResultsCount>0&&(t+=e.currentTabConfig.allResultsCountExact?" of ":" of at least ",t+=s("currency")(e.currentTabConfig.allResultsCount,"",0)),t+="."}return t},e.getUpdateDescription=function(){return e.currentTabConfig.customUpdateMessage?e.currentTabConfig.customUpdateMessage:void 0===e.currentTabConfig.sizeDelta?"":e.currentTabConfig.sizeDelta<0?"Removed "+Math.abs(e.currentTabConfig.sizeDelta)+" statements.":e.currentTabConfig.sizeDelta>0?"Added "+e.currentTabConfig.sizeDelta+" statements.":"The number of statements did not change."},e.getStaleWarningMessage=function(){const t=60*Math.round((Date.now()-e.currentTabConfig.timeFinished)/6e4);if(t>=3600)return"Possibly stale result (obtained "+e.getHumanReadableSeconds(t)+" ago)."};const L=function(){};angular.element(u).bind("resize",L),e.$on("$destroy",(function(){angular.element(u).unbind("resize",L)}))}function i(e,t,n){n.queryExists&&(e.queryExists=!0),e.query=angular.copy(n.query),e.title=n.title,e.edit=n.edit,e.okButtonText=n.okButtonText,e.ok=function(){e.form.$valid&&t.close(e.query)},e.cancel=function(){t.dismiss("cancel")}}angular.module("graphdb.framework.core.directives.queryeditor.controllers",["graphdb.framework.utils.localstorageadapter","graphdb.framework.rest.sparql.service"]).controller("QueryEditorCtrl",r).controller("QuerySampleModalCtrl",i),r.$inject=["$scope","$timeout","toastr","$repositories","$modal","ModalService","SparqlRestService","$filter","$window","$jwtAuth","RDF4JRepositoriesRestService","MonitoringRestService","LocalStorageAdapter","LSKeys"],i.$inject=["$scope","$modalInstance","data"]},34:function(e,t,n){"use strict";n.r(t);n(29),n(4),n(32);var r=n(210),i=n.n(r),o=n(208),a=n.n(o);function s(e,t,n,r,o,s,u,c,l,f,d,p){let h;return{restrict:"AE",scope:!1,templateUrl:"js/angular/core/directives/queryeditor/templates/query-editor.html",link:function(g,m,y){g.nostorage=y.hasOwnProperty("nostorage"),g.notabs=y.hasOwnProperty("notabs"),g.notoolbar=y.hasOwnProperty("notoolbar"),g.notoolbarSaved=y.hasOwnProperty("notoolbarSaved"),g.notoolbarCopy=y.hasOwnProperty("notoolbarCopy"),g.notoolbarInference=y.hasOwnProperty("notoolbarInference"),g.notoolbarSameAs=y.hasOwnProperty("notoolbarSameAs"),g.nostatus=y.hasOwnProperty("nostatus"),g.norun=y.hasOwnProperty("norun"),g.runButtonName="Run",y.runButtonName&&(g.runButtonName=y.runButtonName);if(g.nocount="true"===y.nocount,y.callbackOnChange){const e=g[y.callbackOnChange];"function"==typeof e&&(h=e)}e((function(){!function(g){function m(){angular.element("#wb-sparql-saveQuery")[0].click()}function y(){g.runQuery(!1,!1)}function v(){g.runQuery(!1,!0)}function x(){if(g.tabs.length<2||!g.currentQuery.id||!g.isTabChangeOk(!1))return;let e=N(g.currentQuery.id);e=(e+1)%g.tabs.length,b(g.tabs[e].id)}function w(){if(g.tabs.length<2||!g.currentQuery.id||!g.isTabChangeOk(!1))return;let e=N(g.currentQuery.id);e--,-1===e&&(e=g.tabs.length-1),b(g.tabs[e].id)}function b(t){e((function(){let e=$('a[data-id = "'+t+'"]');0===e.length&&(e=$("a[data-id]").first()),e.tab("show")}),0)}g.changePagination=function(){g.runQuery(!0,g.explainRequested)},window.editor=i.a.fromTextArea(document.getElementById("query"),{persistent:null,value:"",indentUnit:4,createShareLink:null,cursorHeight:1,sparql:{showQueryButton:!1,acceptHeaderGraph:"application/x-graphdb-table-results+json, application/rdf+json;q=0.9, */*;q=0.8",acceptHeaderSelect:"application/x-sparqlstar-results+json, application/sparql-results+json;q=0.9, */*;q=0.8"},extraKeys:{"Ctrl-Enter":y,"Cmd-Enter":y,"Shift-Ctrl-Enter":v,"Shift-Cmd-Enter":v,"Ctrl-Alt-T":g.addNewTab,"Cmd-Alt-T":g.addNewTab,"Ctrl-S":m,"Cmd-S":m,"Ctrl-Alt-Left":w,"Cmd-Alt-Left":w,"Ctrl-Alt-Right":x,"Cmd-Alt-Right":x}}),window.editor.toastBuildIndex=function(){n.warning("",'<div class="autocomplete-toast"><a href="autocomplete">Autocomplete is OFF<br>Go to Setup -> Autocomplete</a></div>',{allowHtml:!0})},window.editor.toastError=function(e){n.error("Cannot execute autocomplete query. "+getError(e))},window.editor.on("changes",(function(){angular.element(".CodeMirror-linenumbers").css("width","1px"),angular.element(".CodeMirror-sizer").css("margin-left","0px"),clearTimeout(g.changesTimeout);const e=!window.editor.queryValid;g.changesTimeout=setTimeout(h?h():function(){const t=N(g.currentQuery.id)+1;$('a[data-id = "'+t+'"]').toggleClass("query-has-error",e).attr("title",e?"Query contains a syntax error. See the relevant line for more information.":"")},200),g.currentQuery.query=window.editor.getValue(),g.currentQuery.queryType=window.editor.getQueryType()})),$(".fullscreenToggleBtns").hide();const C=function(e){$(e.target).removeClass("fa-link").addClass("fa-check").blur(),setTimeout((function(){$(e.target).removeClass("fa-check").addClass("fa-link")}),1e3)};window.onbeforeunload=function(){g.nostorage||d.set(p.TABS_STATE,g.tabs),g.saveTab(g.currentQuery.id)};const S=i.a.executeQuery,M=i.a.getUrlArguments;function T(e,t,n){return{status:e,statusText:t,responseText:n}}let E,R;g.$on("$destroy",(function(){g.nostorage||d.set(p.TABS_STATE,g.tabs),i.a.executeQuery=S,i.a.getUrlArguments=M,g.saveTab(g.currentQuery.id)})),i.a.drawButtons=function(e){e.buttons=$("#yasqe_buttons_mocked")},i.a.getActiveRepository=function(){return r.getActiveRepository()},i.a.getUrlArguments=function(e,t){const n=M(e,t),r=window.editor.getQueryType();return"SELECT"!==r&&"CONSTRUCT"!==r&&"DESCRIBE"!==r||(n.push({name:"limit",value:g.currentTabConfig.pageSize+1}),g.currentTabConfig.offset=(g.currentTabConfig.page-1)*g.currentTabConfig.pageSize+1,n.push({name:"offset",value:g.currentTabConfig.offset-1})),!g.explainRequested||"SELECT"!==r&&"CONSTRUCT"!==r||n.push({name:"explain",value:"true"}),n},i.a.executeQuery=function(e){if(R&&$(R.resultsContainer).length&&$(R.resultsContainer).empty(),e.options.sparql.headers["X-GraphDB-Catch"]=g.currentTabConfig.pageSize+"; throw",g.currentTrackAlias="query-editor-"+performance.now()+"-"+Date.now(),e.options.sparql.headers["X-GraphDB-Track-Alias"]=g.currentTrackAlias,g.countTimeouted=!1,"query"===e.getQueryMode()?e.options.sparql.endpoint="repositories/"+r.getActiveRepository():"update"===e.getQueryMode()&&(e.options.sparql.endpoint="repositories/"+r.getActiveRepository()+"/statements"),e.options.sparql.args=[{name:"infer",value:g.currentQuery.inference},{name:"sameAs",value:g.currentQuery.sameAs}],g.currentTabConfig.customUpdateMessage="","update"!==window.editor.getQueryMode()){const t=g.currentTabConfig,n=g.executedQueryTab.id;return window.editor.options.sparql.handlers.countCallback=function(e,r,i){if(200===e.status){const o=g.tabs[N(n)];o&&(R.setResultsCount(e,r,i),t.allResultsCount=R.allCount,o.allResultsCount=R.allCount,t.allResultsCountExact=!0,o.allResultsCountExact=!0,g.saveTab(o.id))}else t.countTimeouted=!0},null!=g.currentQuery.outputType?R.options.output=g.currentQuery.outputType:R.options.output="table",g.currentTabConfig.queryType=window.editor.getQueryType(),g.queryStartTime=(new Date).getTime(),S(e,{setQueryLimit:function(e){return"CONSTRUCT"===g.currentTabConfig.queryType&&r.isActiveRepoOntopType()?window.editor.getValueWithoutComments():e}})}{const t=function(){g.currentTabConfig.queryType="UPDATE",l.getRepositorySize().success((function(t){return g.repoSize=parseInt(t),g.queryStartTime=(new Date).getTime(),S(e,{})})).error((function(t){return n.warning("Could not get repository size for: "+r.getActiveRepository()+"; "+getError(t)),g.queryStartTime=(new Date).getTime(),S(e,{})}))};f.checkConnector(window.editor.getValue()).then((function(e){if(e.data.command&&!e.data.hasSupport){g.currentTabConfig.queryType="ERROR",g.currentTabConfig.timeFinished=Date.now(),g.currentTabConfig.timeTook=(g.currentTabConfig.timeFinished-g.queryStartTime)/1e3;const t=T(-1,"No support for "+e.data.connectorName,e.data.connectorName+" connectors are not supported because the plugin "+e.data.pluginName+" is not active.");return R.results={getException:function(){return t}},g.setLoader(!1),void A({customError:t},"",null)}if("create"===e.data.command||"repair"===e.data.command){const t="repair"===e.data.command;t?(g.setLoader(!0,"Repairing connector "+e.data.name),g.currentTabConfig.customUpdateMessage="Repaired connector "+e.data.name+"."):(g.setLoader(!0,"Creating connector "+e.data.name),g.currentTabConfig.customUpdateMessage="Created connector "+e.data.name+".");const n=g.$new(!0);n.beingBuiltConnector={percentDone:0,status:{processedEntities:0,estimatedEntities:0,indexedEntities:0,entitiesPerSecond:0},actionName:t?"Repairing":"Creating",eta:"-",inline:!1,iri:e.data.iri,name:e.data.name,doneCallback:function(){E.dismiss("cancel")}},n.getHumanReadableSeconds=g.getHumanReadableSeconds,E=u.open({templateUrl:"pages/connectorProgress.html",controller:"CreateProgressCtrl",size:"lg",backdrop:"static",scope:n})}else"drop"===e.data.command&&(g.setLoader(!0,"Deleting connector "+e.data.name),g.currentTabConfig.customUpdateMessage="Deleted connector "+e.data.name+".");t()}),(function(){t()}))}};const k=i.a.getAjaxConfig;function A(e,t,n){e.getResponseHeader&&e.getResponseHeader("content-type")&&(e.contentType=e.getResponseHeader("content-type")),delete e.response;const r=N(g.executedQueryTab.id),i=g.tabs[r],o={queryType:g.currentTabConfig.queryType,yasrData:e,textStatus:t,jqXhrOrErrorString:n,page:g.currentTabConfig.page,pageSize:g.currentTabConfig.pageSize,allResultsCount:g.currentTabConfig.allResultsCount,allResultsCountExact:g.currentTabConfig.allResultsCountExact,resultsCount:g.currentTabConfig.resultsCount,offset:g.currentTabConfig.offset,timeTook:g.currentTabConfig.timeTook,timeFinished:g.currentTabConfig.timeFinished,sizeDelta:g.currentTabConfig.sizeDelta,customUpdateMessage:g.currentTabConfig.customUpdateMessage,errorMessage:g.currentTabConfig.errorMessage,warningMessage:g.currentTabConfig.warningMessage};"ERROR"!==g.currentTabConfig.queryType&&"UPDATE"!==g.currentTabConfig.queryType&&"ASK"!==g.currentTabConfig.queryType&&(o.outputType=g.yasr.options.output),angular.extend(g.currentQuery,o),angular.extend(i,o),g.nostorage||d.set(p.TABS_STATE,g.tabs),$('a[data-id = "'+g.executedQueryTab.id+'"]').tab("show")}function I(){var e=R.results.getBindings(),t=R.results.getVariables(),n=e[0],r=t[0];if(1===t.length&&1===e.length&&"plan"===r&&n[r].value.includes("# NOTE: Optimization groups")){var o=document.getElementsByClassName("nonUri")[0];o.classList.add("cm-s-default"),o.setAttribute("id","highlighted_output");var a=o.innerText.substring(1,o.innerText.length-1);o.innerHTML="",i.a.runMode(a,"sparql11",document.getElementById("highlighted_output"))}}function N(e){for(let t=0;t<g.tabs.length;t++){if(g.tabs[t].id===e)return t}}function L(e){return angular.isDefined(e)&&"false"!==e}function D(e,n,r){const i=g.getExistingTabId(e),o=g.$on("tabLoaded",(function(){angular.isDefined(n)&&(g.currentQuery.inference=L(n)),angular.isDefined(r)&&(g.currentQuery.sameAs=L(r)),L(t.search().execute)&&("update"===window.editor.getQueryMode()?s.openSimpleModal({title:"Confirm execute",message:"This is an update and it may change the data in the repository.<br>Are you sure you want to execute it automatically?",warning:!0}).result.then((function(){g.runQuery(!1)})):g.runQuery(!1)),o()}));g.highlightNextTabChange=!0,angular.isDefined(i)?b(i):g.addNewTab(null,e.name,e.body)}function O(){if(t.search().savedQueryName)e=t.search().savedQueryName,r=t.search().owner,i=t.search().infer,a=t.search().sameAs,o.getSavedQuery(e,r).success((function(e){D(e,i,a)})).error((function(t){n.error("Could not get data for saved query: "+e+"; "+getError(t))}));else if(t.search().query){D({name:t.search().name,body:t.search().query},t.search().infer,t.search().sameAs)}else{b(d.get(p.TABS_STATE_CURRENT_ID))}var e,r,i,a}function P(){g.getNamespaces(),i.a.signal(window.editor,"repositoryOrAuthorizationChanged",r.getActiveRepository(),c.getAuthToken()),O()}i.a.getAjaxConfig=function(e,t){const n=k(e,t);return _.extend(n.headers,{Authorization:c.getAuthToken()}),n},g.copyToClipboardQuery=function(e,t){s.openCopyToClipboardModal(function(e,t){let n=[location.protocol,"//",location.host,location.pathname].join("");e?(n=n+"?savedQueryName="+encodeURIComponent(e),null!=t&&(n+="&owner="+encodeURIComponent(t))):n=n+"?"+$.param({name:g.currentQuery.name,infer:g.currentQuery.inference,sameAs:g.currentQuery.sameAs,query:window.editor.getValue()});return n}(e,t))},g.copyToClipboardResult=function(e){s.openCopyToClipboardModal(e)},g.goToVisual=function(){const e={query:window.editor.getValue(),sameAs:g.currentQuery.sameAs,inference:g.currentQuery.inference};t.path("graphs-visualizations").search(e)},$("textarea").on("paste",(function(){e((function(){g.addKnownPrefixes()}),0)})),R=a()(document.getElementById("yasr"),{getUsedPrefixes:{},persistency:!1}),window.yasr=R,R.afterCopy=C,R.getQueryResultsAsFormat=function(e){const t=$("#wb-download");t.attr("action","repositories/"+r.getActiveRepository()),$("#wb-download-query").val(g.currentQuery.query),window.editor.getValue()!==g.currentQuery.query&&n.warning("The query in your editor does not match the query results. Download will save the results from the last executed query."),$("#wb-download-infer").val(g.currentQuery.inference),$("#wb-download-sameAs").val(g.currentQuery.sameAs);const i=localStorage.getItem("com.ontotext.graphdb.auth");i&&$("#wb-auth-token").val(i),$("#wb-download-accept").val(e),t.submit()},window.editor.options.sparql.handlers.complete=function(t,r,i){function o(){A(t,r,i)}if(E&&E.dismiss("cancel"),null===window.editor)return void g.setLoader(!1);if(g.currentTabConfig.errorMessage=t.getResponseHeader("X-GraphDB-Error"),g.currentTabConfig.warningMessage=t.getResponseHeader("X-GraphDB-Warning"),R.currentQuery=g.currentQuery,g.currentTabConfig.timeFinished=Date.now(),g.currentTabConfig.timeTook=(g.currentTabConfig.timeFinished-g.queryStartTime)/1e3,t.status>=400)return t.responseText=t.responseText.replace(/^([^: ]+: )+/,""),g.currentTabConfig.queryType="ERROR",o(),g.setYasrResponse(t,r,i),void g.setLoader(!1);if(0===t.status){g.currentTabConfig.queryType="ERROR";const e=T(-1,"Request was aborted","The request has been aborted. There are no results to show.");return R.results={getException:function(){return e}},g.setLoader(!1),void A({customError:e},"",null)}let a;if(g.setLoader(!1),"update"===window.editor.getQueryMode())a=function(){l.getRepositorySize().success((function(e){let t;void 0!==g.repoSize&&(t=Number(e)-g.repoSize),g.currentTabConfig.sizeDelta=t,o()})).error((function(e){n.warning("Could not get repository size for: "+g.getActiveRepository()+"; "+getError(e)),g.currentTabConfig.sizeDelta=void 0,o()}))};else{if(200===t.status){const e=t.getResponseHeader("Content-Type");0!==e.indexOf("application/sparql-results+json")&&0!==e.indexOf("application/x-sparqlstar-results+json")&&0!==e.indexOf("application/x-graphdb-table-results+json")||t.responseJSON.results&&(g.currentTabConfig.resultsCount=t.responseJSON.results.bindings.length,t.responseJSON.results.bindings.length>g.currentTabConfig.pageSize&&(t.responseJSON.results.bindings.length=g.currentTabConfig.pageSize),g.currentTabConfig.allResultsCountExact||((g.nocount||g.countTimeouted||g.currentTabConfig.resultsCount<=g.currentTabConfig.pageSize)&&(t.status=204),g.currentTabConfig.allResultsCount=Math.max(g.currentTabConfig.allResultsCount,g.currentTabConfig.pageSize*(g.currentTabConfig.page-1)+g.currentTabConfig.resultsCount),g.currentTabConfig.resultsCount<=g.currentTabConfig.pageSize&&(g.currentTabConfig.allResultsCountExact=!0)))}g.setLoader(!0,"Rendering results",null,!0),a=function(){g.setYasrResponse(t,r,i),o(),g.setLoader(!1)}}e((function(){a(),"CONSTRUCT"!==window.editor.getQueryType()?($(".yasr_btnGroup.nav.nav-tabs li a.disabled").removeClass("disabled").css("font-weight","400"),$(".yasr_btnGroup.nav.nav-tabs li.disabled a").addClass("disabled").css("font-weight","200"),"DESCRIBE"===window.editor.getQueryType()&&$(".yasr_btnGroup.nav.nav-tabs li a").removeClass("disabled").css("font-weight","400")):"CONSTRUCT"===window.editor.getQueryType()&&$(".yasr_btnGroup.nav.nav-tabs li a.disabled").removeClass("disabled").css("font-weight","400"),$("#yasr").css("padding","0"),$(".yasr_btnGroup li:nth-child(2)").hasClass("active")&&e((function(){$(".yasr_btnGroup li:nth-child(2) a").get(0).click()}),100),$("#wb-sparql-addNewTab").click((function(){$(".dataTables_filter").hide(),$(".resultsTable").hide()}))}),100)},window.editor.options.sparql.handlers.resetResults=function(){},g.yasr=R,g.setYasrResponse=function(e,t,n){e.responseJSON&&(e.response=e.responseJSON,e.responseText=void 0),window.yasr.plugins.table.options.highlightLiteralCellResult=I,R.setResponse(e,t,n)},g.$watch("yasr.options.output",(function(e){if(e&&"UPDATE"!==g.currentTabConfig.queryType&&"ASK"!==g.currentTabConfig.queryType){const t=g.tabs[N(g.currentQuery.id)];angular.isDefined(t)&&g.currentTabConfig.queryType&&t.outputType!==e&&(t.outputType=g.currentQuery.outputType=e,g.saveTab(t.id))}})),void g.$watch("namespaces",(function(){g.namespaces&&(R&&R.options&&g.namespaces&&(R.options.getUsedPrefixes=g.namespaces),i.a.signal(window.editor,"namespacesChanged",g.namespaces))})),$(document).mouseup((function(e){const t=$("#sampleQueriesCollapse");!t.is(e.target)&&0===t.has(e.target).length&&g.showSampleQueries&&g.toggleSampleQueries()})),r.getActiveRepository()&&P();g.$on("repositoryIsSet",(function(){r.getActiveRepository()&&P()})),e((function(){angular.element(document).find(".CodeMirror textarea:first-child").focus()}),50)}(g)}),150)}}}angular.module("graphdb.framework.core.directives.queryeditor.queryeditor",["ngCookies","graphdb.framework.externalsync.controllers","graphdb.framework.rest.connectors.service","graphdb.framework.utils.localstorageadapter"]).directive("queryEditor",s),s.$inject=["$timeout","$location","toastr","$repositories","SparqlRestService","ModalService","$modal","$jwtAuth","RDF4JRepositoriesRestService","ConnectorsRestService","LocalStorageAdapter","LSKeys"]},37:function(e,t,n){"use strict";n.r(t),n.d(t,"STATIC_RULESETS",(function(){return r})),n.d(t,"REPOSITORY_TYPES",(function(){return i})),n.d(t,"FILENAME_PATTERN",(function(){return o})),n.d(t,"NUMBER_PATTERN",(function(){return a})),n.d(t,"REPO_TOOLTIPS",(function(){return s}));const r=[{id:"empty",name:"No inference"},{id:"rdfs-optimized",name:"RDFS (Optimized)"},{id:"rdfs",name:"RDFS"},{id:"rdfsplus-optimized",name:"RDFS-Plus (Optimized)"},{id:"owl-horst-optimized",name:"OWL-Horst (Optimized)"},{id:"owl-horst",name:"OWL-Horst"},{id:"owl2-ql-optimized",name:"OWL2-QL (Optimized)"},{id:"owl2-ql",name:"OWL2-QL"},{id:"owl-max-optimized",name:"OWL-Max (Optimized)"},{id:"owl-max",name:"OWL-Max"},{id:"owl2-rl-optimized",name:"OWL2-RL (Optimized)"},{id:"owl2-rl",name:"OWL2-RL"}],i={free:"free",eeWorker:"worker",eeMaster:"master",ontop:"ontop",se:"se",fedx:"fedx"},o=new RegExp("^[a-zA-Z0-9-_]+$"),a=new RegExp("^[0-9]+$"),s={id:"Unique identifier for the repository. The ID must contain only letters (a-z, A-Z), numbers (0-9), '-' and '_'.",title:"Human readable description of the repository.",readOnly:"Protects the repository against any changes.",ruleset:"Sets of axiomatic triples, consistency checks and entailment rules, which determine the applied semantics with a PIE file.",rulesetWarnings:{needsSameAs:"Disabling owl:sameAs for this ruleset may cause incomplete inference with owl:sameAs statements.",doesntNeedSameAs:"This ruleset does not need owl:sameAs, consider disabling it.",customRuleset:"If the custom ruleset does not use owl:sameAs, consider disabling it. <br>If the ruleset uses owl:sameAs, disabling it may cause incomplete inference with owl:sameAs statements."},disableSameAs:"GraphDB uses a non-rule implementation of owl:sameAs, which can be enabled or disabled independently of the ruleset.",checkForInconsistencies:"Enables the consistency checks from the ruleset.",isShacl:"Enables support for SHACL validation.",shaclOptions:{cacheSelectNodes:"The SHACL implementation retrieves a lot of its relevant data through running SPARQL Select queries against the repository and against the changes in the transaction. This is usually good for performance, but while validating large amounts of data disabling this cache will use less memory.",undefinedTargetValidatesAllSubjects:"If no target is defined for a NodeShape, that NodeShape will be ignored. Enabling this will make such NodeShapes wildcard shapes and validate all subjects. Equivalent to setting sh:targetClass to owl:Thing or rdfs:Resource in an environment with a reasoner.",logValidationPlans:"Log (INFO) the executed validation plans as GraphViz DOT. It is recommended to disable parallel validation when this is enabled.",logValidationViolations:"Log (INFO) a list of violations and the triples that caused the violations. It is recommended to disable parallel validation when this is enabled.",parallelValidation:"Run SHACL validation in parallel.",globalLogValidationExecution:"Log (INFO) every execution step of the SHACL validation. This is fairly costly and should not be used in production. It is recommended to disable parallel validation when this is enabled.",performanceLogging:"Log (INFO) the execution time per shape. It is recommended to disable parallel validation and caching of select nodes when this is enabled.",eclipseRdf4jShaclExtensions:"Activates RDF4J's SHACL extensions that provide additional functionality (experimental).",dashDataShapes:"Activates DASH Data Shapes extensions that provide additional functionality (experimental)."},entityIdSize:"Defines the bit size of internal IDs used to index entities (URIs, blank nodes, literals, and RDF* embedded triples).<br>Use 40 bit ID only if you expect more than 2 billion unique RDF values.",enableContextIndex:"Builds an additional Context-Predicate-Subject-Object index to boost the SPARQL query performance of queries with GRAPH/FROM/FROM NAMED clauses.",enablePredicateList:"Enables the mappings from an entity (subject or object) to its predicates; enabling it can significantly speed up queries that use wildcard predicate patterns.",queryTimeout:"Sets the number of seconds after which the evaluation of a query will be terminated; values less than or equal to zero mean no limit.",throwQueryEvaluationExceptionOnTimeout:"Repository throws QueryEvaluationException when the duration of a query execution exceeds the timeout parameter.",queryLimitResults:"Sets the maximum number of results returned from a query after which the evaluation of a query will be terminated; values less than or equal to zero mean no limit.",nonInterpretablePredicates:"Semicolon-delimited list of predicates (full URIs) that GraphDB will not try to process with the registered GraphDB plugins.",ontop:{driverType:"Determines the type of SQL database to connect to.",propertiesFile:"Describes the JDBC configuration such as hostname and database name to connect to.",hostName:"The JDBC hostname to connect to.",port:"The JDBC port to connect to if different from the default for the chosen JDBC driver.",portIfRequired:"The JDBC port to connect to.",databaseName:"The database name to connect to.",userName:"The username to use for the JDBC connection.",password:"The password to use for the JDBC connection.",driverClass:"Classname of the chosen JDBC driver. It must be on the classpath (in the lib directory).",driverClassWarning:"JDBC driver not found in the classpath, please save it in the lib directory and restart GraphDB",url:"The JDBC URL that will be used. It is constructed using the supplied hostname, port and database name.",obdaFile:"Describes the mapping from SQL to RDF in either the OBDA or the R2RML format.",owlFile:"Specifies relations between the classes and properties in the cosntructed RDF graph. It can be in any supported RDF format.",constraintFile:"Specifies override of SQL primary and foreign keys.",dbMetadataFile:"Specifies metadata for the SQL database.",testConn:"Attempts to establish a connection to the SQL database to test if the supplied configuration is correct."},fedx:{repositoryNotExistWarning:"The repository member has been removed from the local repositories",localReposInstructions:"Click on a repo to add a local repository as a member",withLogQueries:"Set whether to log queries",withDebugQueryPlan:"Whether to print the optimized query execution plan to stdout",enforceMaxQueryTime:"Max query time in seconds, 0 to disable",withIncludeInferredDefault:"Set whether to include inferred statements or not",withBoundJoinBlockSize:"Set the block size for bound joins",withJoinWorkerThreads:"Set the number of join worker threads for parallelization",withLeftJoinWorkerThreads:"Set the number of left join worker threads",unionWorkerThreads:"Set the number of union worker threads for parallelization",withLogQueryPlan:"Whether to log the query plan",withEnableServiceAsBoundJoin:"Whether external SERVICE clauses are evaluated using bound join",withSourceSelectionCacheSpec:"The cache specification for the SourceSelectionMemoryCache",removeMember:"Remove repository as a FedX member",editRepository:"Edit repository",setAsWritable:"Set repository as writable"}}},38:function(e,t){angular.module("graphdb.framework.rest.graphexplore.data.service",[]).factory("GraphDataRestService",a),a.$inject=["$http"];const n="rest/class-hierarchy",r="rest/domain-range",i="rest/dependencies/",o="rest/explore-graph/";function a(e){return{getClassHierarchyData:function(t){return e.get(n,{params:{graphURI:t}})},reloadClassHierarchy:function(t){return e.get(n,{params:{doReload:!0,graphURI:t}})},getClassInstances:function(t){return e.get(`${n}/class-instances`,{params:{targetUri:t}})},getDomainRangeData:function(t,n){return e.get(r,{params:{targetUri:t,collapsed:n}})},checkDomainRangeData:function(t){return e.head(r,{params:{targetUri:t}})},getRelationshipsData:function(t,n,r){return e.get(`${i}matrix`,{params:{mode:n,classes:_.map(t,(function(e){return e.name})),graphURI:r}})},getRelationshipsClasses:function(t,n){return e.get(`${i}classes`,{params:{mode:t,graphURI:n}})},getRelationshipsStatus:function(t){return e.get(`${i}status`,{params:{graphURI:t}})},calculateRelationships:function(t){return e.get(`${i}update`,{params:{graphURI:t}})},getPredicates:function(t,n,r){return e.get(`${i}predicates`,{params:{from:t,to:n,mode:"all",graphURI:r}})},getInstanceNode:function(t){return e.get(`${o}node`,{params:{iri:t}})},getInstanceNodeLinks:function(t){return e.get(`${o}links`,{params:{iri:t}})},getRdfsLabelAndComment:function(t,n,r){const i=r||{};return e({url:"rest/explore/details",method:"GET",params:_.extend(i,{uri:t,languages:n}),headers:{Accept:"application/json"}})}}}},50:function(e,t){function n(e){return{initLazyList:function(t,n,r,i,o){return e((function(){const e=t+i-1,a=Math.max(0-i,e),s=Math.min(e+n-1,o.length);a>s?r([]):$.isArray(o)&&r(o.slice(a,s+1))}),100,!0)}}}angular.module("graphdb.framework.graphexplore.services.uiscroll",[]).factory("UiScrollService",n),n.$inject=["$timeout"]},51:function(e,t){angular.module("graphdb.framework.graphexplore.services.rdfsdetails",[]).factory("RdfsLabelCommentService",(function(){return{processAndFilterLabelAndComment:function(e){function t(e){const t={};for(let n in e)if(e.hasOwnProperty(n)){let r=n;n.indexOf(":")>-1&&(r=n,n=n.split(":")[1].toLowerCase()),t[n]=e[r]}return t}const n=e.results.bindings,r=[],i=[];_.each(n,(function(e){let n;angular.isUndefined(e.label)||(n=t(e.label),r.push(n)),angular.isUndefined(e.comment)||(n=t(e.comment),i.push(n))}));const o=function(e){return"en"===e.lang||"de"===e.lang},a=$.grep(r,o)[0],s=$.grep(i,o)[0],u=angular.isUndefined(a)?r.length>0?r[0].value:void 0:a.value,c=angular.isUndefined(s)?i.length>0?i[0].value:void 0:s.value;return{rdfsLabel:u,rdfsComment:c}}}}))},52:function(e,t){angular.module("graphdb.framework.rest.graphexplore.savedgraphs.service",[]).factory("SavedGraphsRestService",r),r.$inject=["$http"];const n="rest/explore-graph/saved";function r(e){return{getSavedGraphs:function(){return e.get(n)},getSavedGraph:function(t){return e.get(`${n}/${encodeURIComponent(t)}`)},editSavedGraph:function(t){return e.put(`${n}/${encodeURIComponent(t.id)}`,t)},deleteSavedGraph:function(t){return e.delete(`${n}/${encodeURIComponent(t.id)}`)},addNewSavedGraph:function(t){return e.post(n,t)}}}},53:function(e,t){angular.module("graphdb.framework.rest.graphconfig.service",[]).factory("GraphConfigRestService",i);const n="rest/explore-graph/",r=`${n}config`;function i(e){return{getGraphConfigs:function(){return e.get(r)},getGraphConfigSamples:function(){return e.get(`${n}samples`)},loadGraphForConfig:function(t,n,i,o){return e.get(`${r}/graph/${encodeURIComponent(t.id)}?includeInferred=${n}&linksLimit=${i}&sameAsState=${o}`)},getConfig:function(t){return e.get(`${r}/${encodeURIComponent(t)}`)},createGraphConfig:function(t){return e.post(r,t)},updateGraphConfig:function(t){return e.put(`${r}/${encodeURIComponent(t.id)}`,t)},deleteGraphConfig:function(t){return e.delete(`${r}/${encodeURIComponent(t.id)}`)},validateQuery:function(t,r,i,o,a){return e({method:"POST",url:`${n}validate`,data:{query:t,queryType:r,params:i,all:o,oneOf:a}})}}}i.$inject=["$http"]},54:function(e,t,n){"use strict";n.r(t);n(4);const r=400,i=50,o=1500,a=25;function s(e,t,n,s,u,c,l,f,d,p,h,g,m,y,v){e.classHierarchyData={},e.instancesObj={},e.instancesQueryObj={},e.instancesObj.items=[],e.instancesNotFiltered=[],e.isWarningShowed=!1,e.onopen=e.onclose=()=>angular.noop(),e.currentBrowserLimit=2e3,g.firefox?e.currentBrowserLimit=i:(g.safari||g.msie||g.msedge)&&(e.currentBrowserLimit=r);const x={};let w=0,b=0;t.key="",x.get=function(t,n,r){return f.initLazyList(t,n,r,w,e.instancesObj.items)};let C=allGraphs;const S=function(){if(e.getActiveRepository())return v.resolveGraphs().success((function(t){e.graphsInRepo=t.results.bindings,M()})).error((function(t){e.repositoryError=getError(t),c.error(getError(t),"Error getting graphs")}))},M=function(){const t=m.get(`classHierarchy-selectedGraph-${s.getActiveRepository()}`);null!==t&&e.graphsInRepo.some(e=>e.contextID.uri===t.contextID.uri)?C=t:m.set(`classHierarchy-selectedGraph-${s.getActiveRepository()}`,C)};function T(t,n,r){e.classCountSlider.options&&e.classCountSlider.options.ceil!==n&&(e.classCountSlider={});var i;e.classCountSlider.value||(e.showExternalElements=!0,e.classCountSlider={value:n,options:{floor:1,ceil:n,vertical:!0,showSelectionBar:!0,onChange:function(){p(E,100,!0)}}},null===m.get(y.CLASS_HIERARCHY_CURRENT_SLIDER_VALUE)&&n>e.currentBrowserLimit&&(i=e.currentBrowserLimit,g.chrome?c.warning("Disabling animations for more than "+i+" classes.","Reducing visual effects"):c.warning(g.name+" performs poorly with more than "+i+" classes. Please consider using Chrome for more optimal performance.","Reducing visual effects")));const s=m.get(y.CLASS_HIERARCHY_SWITCH_PREFIXES);null!=s&&"true"!==s&&(e.showExternalElements=!0),r?e.classCountSlider.value=r:n>=o&&(e.classCountSlider.value=o,c.warning("Class count is reduced to "+o+" for faster initial load. Use the slider to see all classes.","Reducing class count")),n>=a&&!window.ActiveXObject&&"ActiveXObject"in window&&!e.isWarningShowed&&(e.classCountSlider.value=a,e.isWarningShowed=!0,c.warning("Class count is reduced to "+a+" for faster load in IE. If you want better performance please switch to different browser.","Reducing class count")),p((function(){e.$broadcast("reCalcViewDimensions")}),200),E();let u=0;$("rzslider").on("wheel",(function(t){t.preventDefault(),t.stopPropagation();const n=(new Date).getTime();if(!(n-u>100))return;u=n,t=t.originalEvent;let r=e.classCountSlider.value;t.deltaY<=-1?r+=1:t.deltaY>=1&&(r-=1),r!==e.classCountSlider.value&&r>=e.classCountSlider.options.floor&&r<=e.classCountSlider.options.ceil&&e.$apply((function(){e.classCountSlider.value=r,p(E,100,!0)}))}))}function E(){e.currentSliderValue=e.classCountSlider.value}function R(e){const t=e.fullName,r=e.name;l.checkDomainRangeData(t).success((function(e,i){204===i?c.warning("No domain-range data available for '"+r+"'"):(m.set(y.CLASS_HIERARCHY_LAST_SELECTED_CLASS,n.hash()),n.hash("").path("domain-range-graph").search("uri",t).search("name",r))})).error((function(){c.error("Request for "+r+" failed!")}))}function k(){n.replace().hash("1"),e.instancesObj.items=[],e.showExternalElements=!1,e.showClassInfoPanel=!1,m.clearClassHieararchyState(),e.hidePrefixes="true"===m.get(y.CLASS_HIERARCHY_HIDE_PREFIXES),e.currentSliderValue=void 0,e.classHierarchyData={},t.$broadcast("angucomplete-alt:clearInput")}function A(){e.hasClassHierarchy()&&p((function(){$("#toolbar").removeClass("ng-hide")}),0)}t.$watch((function(){return t.key}),(function(){w=0,_.each(e.instancesObj.items,(function(e){t.key>e&&w++})),b++})),x.revision=function(){return b},e.adapterContainer={adapter:{remain:!0}},e.$on("goToDomainRangeGraphView",(function(e,t){R(t)})),e.$on("classCount",T),e.$on("repositoryIsSet",(function(){if(I===s.getActiveRepository())return;I=s.getActiveRepository();if(e.repositoryError=null,!I)return;C=allGraphs,S().then(N)})),e.datasource=x,e.goToDomainRangeGraphView=R,e.toggleClassInfoSidePanel=function(){e.showClassInfoPanel=!e.showClassInfoPanel,t.$broadcast("sidePanelClosed")},e.getActiveRepositoryNoError=function(){if(!e.repositoryError)return s.getActiveRepository()},e.isSystemRepository=function(){return s.isSystemRepository()},e.confirmReloadClassHierarchy=function(){h.openSimpleModal({title:"Confirm operation",message:"Calculating class hierarchy data may take some time. Are you sure?",warning:!0}).result.then((function(){k(),e.loader=!0,e.hierarchyError=!1,l.reloadClassHierarchy(C.contextID.uri).success((function(t){e.loader=!1,e.classHierarchyData=t,A(),T()})).error((function(t){e.loader=!1,e.hierarchyError=getError(t),c.error(getError(t),"Request for RDF Class Hierarchy failed!")}))}))},e.focusOnRoot=function(){e.$broadcast("rootFocus")},e.copyToClipboard=function(e){h.openCopyToClipboardModal(e)},e.searchedClassCallback=function(e){if(e){const n={name:e.title};t.$broadcast("searchedClass",n)}},e.instancesQueryObj.query="",e.instancesFilterFunc=function(t){return t.resolvedUri.toLowerCase().indexOf(e.instancesQueryObj.query.toLowerCase())>=0},S(),e.$watch("instancesObj.items",(function(){e.instancesObj.items.length>0&&p((function(){e.adapterContainer.adapter.reload()}),30)})),e.$watch("selectedClass",(function(){e.showClassInfoPanel&&function(t){const n=t.fullName;let r=t.name;if(r===n){const e=r.lastIndexOf("#");r=r.substring(e+1)}e.encodedUri=encodeURIComponent(n);const i=encodeURIComponent("prefix onto:<http://www.ontotext.com/> select ?s from onto:disable-sameAs { ?s a <"+n+"> . }");e.viewInstancesUri="sparql?name="+r+"&infer=true&sameAs=false&query="+i+"&execute=true",l.getRdfsLabelAndComment(n).success((function(t){e.rdfsLabel=t.label,e.rdfsComment=t.comment,e.expanded=!1})).error((function(){c.error("Error getting rdfs:label and rdfs:comment")})),e.instancesQueryObj.query="",e.instancesLoader=!0,l.getClassInstances(n).success((function(t){e.instancesObj.items=[],_.each(t,(function(t,n){const r={};r.type=t.startsWith("<<")&&t.endsWith(">>")?"triple":"uri",r.absUri=encodeURIComponent(t),r.absUriNonEncoded=t,r.resolvedUri=n,e.instancesObj.items.push(r)})),e.instancesLoader=!1,e.instancesSearchPlaceholder=e.instancesObj.items.length<1e3?"Search class instances":"Search first 1000 class instances",e.instancesNotFiltered=e.instancesObj.items})).error((function(){c.error("Request for class instances for failed!")}))}(e.selectedClass)})),$(document).ready((function(){$(".prefix-toggle").click((function(){$(".tooltip").hide()}))}));let I=s.getActiveRepository();function N(){k(),e.isSystemRepository()||(e.hierarchyError=!1,e.loader=!0,l.getClassHierarchyData(C.contextID.uri).success((function(t,n){e.showExternalElements=!0,e.loader=!1,e.classHierarchyData=t,207===n&&c.warning("You can update the diagram by pressing the reload button.","Repository data has changed"),A()})).error((function(t){e.loader=!1,e.hierarchyError=getError(t),c.error(getError(t),"Request for RDF Class Hierarchy failed!")})))}e.hasClassHierarchy=function(){return e.classHierarchyData.classCount&&e.getActiveRepositoryNoError()&&!e.isSystemRepository()},e.chosenGraph=function(e){C=e,N(),m.set(`classHierarchy-selectedGraph-${s.getActiveRepository()}`,C)},e.getSelGraphValue=function(){return C.contextID.value},e.isAllGraphsSelected=function(){return"All graphs"===e.getSelGraphValue()}}angular.module("graphdb.framework.graphexplore.controllers.class",["pageslide-directive","ngAnimate","ui.scroll.jqlite","ui.scroll","angucomplete-alt","rzSlider","toastr","graphdb.framework.utils.localstorageadapter"]).controller("RdfClassHierarchyCtlr",s),s.$inject=["$scope","$rootScope","$location","$repositories","$window","toastr","GraphDataRestService","UiScrollService","RdfsLabelCommentService","$timeout","ModalService","bowser","LocalStorageAdapter","LSKeys","RDF4JRepositoriesRestService"]},55:function(e,t,n){"use strict";n.r(t);n(4);function r(e,t,n,r,i,o,a,s,u,c,l,f){e.predicatesObj={},e.predicatesQueryObj={},e.predicatesObj.items=[],e.predicatesQueryObj.query="",e.predicatesListNotFiltered=[],e.predicatesSearchPlaceholder="Search predicates",e.onopen=e.onclose=()=>angular.noop();const d={};let p=0,h=0;n.key="",d.get=function(t,n,r){return c.initLazyList(t,n,r,p,e.predicatesObj.items)},n.$watch((function(){return n.key}),(function(){p=0,_.each(e.predicatesObj.items,(function(e){n.key>e&&p++})),h++})),d.revision=function(){return h},e.adapterContainer={adapter:{remain:!0}};const g=a.get(s.DOMAIN_RANGE_COLLAPSE_EDGES);function m(){const e=a.get(s.CLASS_HIERARCHY_LAST_SELECTED_CLASS);t.search("").hash(e).path("hierarchy")}e.collapseEdges=null===g||"true"===g,e.datasource=d,e.$on("reloadDomainRangeGraphView",(function(e,n){const r=n.objectPropClassUri,i=n.objectPropClassName;t.path("domain-range-graph").search("uri",r).search("name",i)})),e.$on("switchEdgeMode",(function(e,n){t.path("domain-range-graph").search("uri",n.uri).search("name",n.name).search("collapsed",n.collapsed)})),e.$on("repositoryIsSet",(function(){if(y===i.getActiveRepository())return;y=i.getActiveRepository();m()})),e.$on("changeCollapsedEdgesState",(function(t,n){e.collapseEdges=!n,a.set(s.DOMAIN_RANGE_COLLAPSE_EDGES,e.collapseEdges)})),e.goToClassHierarchyView=m,e.copyToClipboard=function(e){l.openCopyToClipboardModal(e)},e.toggleCollapseEdgesState=function(){e.collapseEdges=!e.collapseEdges,o.history.pushState({collapsed:e.collapseEdges},"domainRangePage",null)},e.predicatesListFilterFunc=function(t){return t.resolvedUri.toLowerCase().indexOf(e.predicatesQueryObj.query.toLowerCase())>=0},e.$watch("predicatesObj.items",(function(){e.predicatesObj.items>0&&r((function(){e.adapterContainer.adapter.reload()}),30)})),e.$watch("selectedPredicate",(function(){e.showPredicatesInfoPanel&&function(t){const n=t.target,r=t.source;e.encodedUri=encodeURIComponent(t.uri),e.sourceTargetObjectNodeUri=n.objectPropClassUri?n.objectPropClassUri:r.objectPropClassUri,e.encodedSourceTargetObjectNodeUri=encodeURIComponent(e.sourceTargetObjectNodeUri),e.sourceTargetObjectNodeName=n.objectPropClassName?n.objectPropClassName:r.objectPropClassName?r.objectPropClassName:"<i>Literal</i>",-1===e.sourceTargetObjectNodeName.indexOf("Literal")?u.getRdfsLabelAndComment(e.sourceTargetObjectNodeUri).success((function(t){e.rdfsLabel=t.label,e.rdfsComment=t.comment})).error((function(){f.error("Error getting rdfs:label and rdfs:comment")})):(e.rdfsComment=void 0,e.rdfsLabel=void 0);e.predicatesObj.items=[],e.predicatesQueryObj.query="";const i=n.allEdges?n.allEdges:r.allEdges;_.each(i,(function(t){const n={};n.absUri=encodeURIComponent(t.uri),n.absUriNonEncoded=t.uri,n.resolvedUri=t.name,n.isImplicit=t.implicit,e.predicatesObj.items.push(n)})),e.predicatesListNotFiltered=e.predicatesObj.items}(e.selectedPredicate)})),$(document).ready((function(){$(".compact-mode-toggle").click((function(){$(".tooltip").hide()}))}));let y=i.getActiveRepository()}angular.module("graphdb.framework.graphexplore.controllers.domainrange",["ui.scroll.jqlite","ui.scroll","ngSanitize","graphdb.framework.utils.localstorageadapter"]).controller("DomainRangeGraphCtlr",r),r.$inject=["$scope","$location","$rootScope","$timeout","$repositories","$window","LocalStorageAdapter","LSKeys","GraphDataRestService","UiScrollService","ModalService","toastr"]},56:function(e,t,n){(function(e){const t={WAIT:"WAIT",NO_REPO:"NO_REPO",READY:"READY",IN_PROGRESS:"IN_PROGRESS",ERROR:"ERROR"},n={contextID:{type:"all",value:"All graphs",uri:""}};function r(e){if(e<1e3)return e;const t=Math.floor(Math.log(e)/Math.log(1e3));let n=e/Math.pow(1e3,t);return n=n%1>1/Math.pow(1e3,t-1)?n.toFixed(2):n.toFixed(0),n+["K","M","G","T","P","H"][t-1]}function i(e,r,i,o,a,s,u,c,l,f){let d=null;e.status=i.getActiveRepository()?t.WAIT:t.NO_REPO;let p=n;const h=function(){f.resolveGraphs().success((function(t){e.graphsInRepo=t.results.bindings,g(),e.isSystemRepository()?"READY"!==e.status&&y():(e.status="WAIT",y(!0))})).error((function(t){e.repositoryError=getError(t),o.error(getError(t),"Error getting graphs")}))},g=function(){const t=l.get(`dependencies-selectedGraph-${i.getActiveRepository()}`);null!==t&&e.graphsInRepo.some(e=>e.contextID.uri===t.contextID.uri)?p=t:l.set(`dependencies-selectedGraph-${i.getActiveRepository()}`,p)},m=function(n){d3.select("#dependencies-chord").html(""),e.status=t.WAIT,s.getRelationshipsData(n,e.direction,p.contextID.uri).success((function(n){e.dependenciesData={matrix:n.right,nodes:n.left,hasLinks:_.sum(_.map(n.right,(function(e){return _.sum(e)})))>0,direction:e.direction},e.status=t.READY})).error((function(n){e.status=t.READY,o.error(getError(n),"Could not get dependencies count")}))},y=function(n){(e.status!==t.READY||n)&&(e.status=t.WAIT,s.getRelationshipsStatus(p.contextID.uri).success((function(n){if(e.status=n,e.status===t.IN_PROGRESS){if(null!==d)return;d=a(y,2e3)}e.status===t.READY&&(null!==d&&(a.cancel(d),d=null),s.getRelationshipsClasses(e.direction,p.contextID.uri).success((function(t,n){e.allClasses.items=_.filter(t,b),e.allNotFilteredClasses=t,e.selectedClasses=void 0,angular.isUndefined(e.selectedClasses)&&(e.selectedClasses=t.slice(0,10)),m(e.selectedClasses),207===n&&o.warning("You can update the diagram by pressing the reload button.","Repository data has changed")}))),0===e.status.indexOf("ERROR;")&&(e.status=t.ERROR,o.error("There was an error while calculating dependencies: "+e.status.substring("ERROR;".length)))})).error((function(n){e.status=t.ERROR,o.error(getError(n),"Could not get dependencies count status!")})))};e.allClasses={},e.allClasses.items=[],e.allNotFilteredClasses=[],e.direction="all";const v={};let x=0,w=0;function b(t){return-1!==t.name.toLowerCase().indexOf(e.classQuery.query.toLowerCase())}r.key="",v.get=function(t,n,r){return u.initLazyList(t,n,r,x,e.allClasses.items)},r.$watch((function(){return r.key}),(function(){x=0,_.each(e.allClasses.items,(function(e){r.key>e&&x++})),w++})),v.revision=function(){return w},e.datasource=v,e.adapterContainer={adapter:{remain:!0}},e.classQuery={},e.classQuery.query="",e.classFilterFunc=b,e.$watch("allClasses.items",(function(){e.allClasses.items.length>0&&a((function(){e.adapterContainer.adapter.reload()}),30)})),e.$watch("direction",(function(){!i.getActiveRepository()||e.isSystemRepository()||i.isActiveRepoFedXType()||h()})),e.$on("$destroy",(function(){a.cancel(d)})),e.isLoading=function(){return e.status===t.IN_PROGRESS||e.status===t.WAIT},e.confirmCalculateDependencies=function(){c.openSimpleModal({title:"Confirm operation",message:"Calculating relationships data may take some time. Are you sure?",warning:!0}).result.then((function(){e.calculateDependencies()}))},e.calculateDependencies=function(){e.status=t.WAIT,e.selectedClasses=void 0,s.calculateRelationships(p.contextID.uri).success((function(e){0===e.indexOf("ERROR;")?o.error("There was an error while calculating dependencies: "+e.substring("ERROR;".length)):y()})).error((function(e){o.error("Could not force dependencies count"+getError(e))}))},e.addClass=function(t){e.selectedClasses.push(t),m(e.selectedClasses)},e.removeClass=function(t){_.remove(e.selectedClasses,(function(e){return e.name===t.name})),m(e.selectedClasses)},e.showClass=function(t){e.classToShow=t},e.isClassByNameShown=function(t){return void 0!==_.find(e.selectedClasses,{name:t})},e.addClassByName=function(t){e.selectedClasses.push(_.find(e.allClasses.items,{name:t})),m(e.selectedClasses)},e.removeClassByName=function(t){_.remove(e.selectedClasses,(function(e){return e.name===t})),m(e.selectedClasses)},e.removeAllClasses=function(){e.selectedClasses=[],m(e.selectedClasses)},e.isSystemRepository=function(){return"SYSTEM"===i.getActiveRepository()};const C=e.$on("repositoryIsSet",(function(){e.classQuery={},e.classQuery.query="",e.repositoryError=null,p=n,i.getActiveRepository()&&!i.isActiveRepoFedXType()?h():e.status=t.NO_REPO}));window.addEventListener("beforeunload",(function e(){C(),window.removeEventListener("beforeunload",e)})),e.selectGraph=function(e){p=e,y(!0),l.set(`dependencies-selectedGraph-${i.getActiveRepository()}`,p)},e.getSelectedGraphValue=function(){return p.contextID.value},e.isAllGraphsSelected=function(){return"All graphs"===e.getSelectedGraphValue()}}Object.defineProperty(e,"allGraphs",{get:()=>n}),angular.module("graphdb.framework.graphexplore.controllers.dependencies",["ui.scroll.jqlite","ui.scroll","toastr","ui.bootstrap","graphdb.framework.core.services.repositories","graphdb.framework.utils.localstorageadapter"]).controller("DependenciesChordCtrl",i).config(["$tooltipProvider",function(e){e.options({appendToBody:!0})}]).filter("humanize",(function(){return r})),i.$inject=["$scope","$rootScope","$repositories","toastr","$timeout","GraphDataRestService","UiScrollService","ModalService","LocalStorageAdapter","RDF4JRepositoriesRestService"]}).call(this,n(3))},57:function(e,t,n){"use strict";n.r(t);n(2);var r=n(206),i=n(209),o=n.n(i),a=(n(4),n(37));function s(e,t,n,i,s,u,c,l,f,d,p,h,g,m,y,v,x,w,b,C){e.languageChanged=!1,e.propertiesObj={},e.propertiesQueryObj={},e.propertiesObj.items=[],e.propertiesNotFiltered=[],e.searchVisible=!1,e.nodeSelected=!1,e.queryResultsMode=!1,e.embedded=d.search().embedded,e.openedNodeInfoPanel=void 0,e.invalidLimit=!1,e.INVALID_LINKS_MSG="Invalid links limit",e.INVALID_LINKS_TOOLTIP="The valid limit range is 1-1000",e.onopen=e.onclose=()=>angular.noop(),e.embedded&&(d.search().query||d.search().uri||d.search().config||d.search().saved)&&(e.noGoHome=!0);const S={};let M=0,T=0,E={},R=0;const k=16,A=d3.behavior.zoom().scaleExtent([.5,10]);let I;const N=1e3,L=1e3;let D,O;function P(e){g.openCopyToClipboardModal(e)}function q(t){const n=t.appSettings;e.defaultSettings.includeInferred=n.DEFAULT_INFERENCE,e.defaultSettings.sameAsState=n.DEFAULT_INFERENCE&&n.DEFAULT_SAMEAS,e.defaultSettings.includeSchema=n.DEFAULT_VIS_GRAPH_SCHEMA;const r=v.get(x.GRAPHS_VIZ);if(r&&"object"==typeof r)try{e.saveSettings=r,void 0===e.saveSettings.includeSchema&&(e.saveSettings.includeSchema=e.defaultSettings.includeSchema,e.saveSettings.rejectedPredicates=[...e.saveSettings.rejectedPredicates,...e.defaultSettings.rejectedPredicates].unique())}catch(t){e.saveSettings=angular.copy(e.defaultSettings),v.set(x.GRAPHS_VIZ,e.saveSettings)}else e.saveSettings=angular.copy(e.defaultSettings)}t.key="",S.get=function(t,n,r){return h.initLazyList(t,n,r,M,e.propertiesObj.items)},t.$watch((function(){return t.key}),(function(){M=0,_.each(e.propertiesObj.items,(function(e){t.key>e&&M++})),T++})),S.revision=function(){return T},e.datasource=S,e.adapterContainer={adapter:{remain:!0}},e.propertiesQueryObj.query="",e.propertiesSearchPlaceholder="Search instance properties",e.propertiesFilterFunc=function(t){return t.key.toLowerCase().indexOf(e.propertiesQueryObj.query.toLowerCase())>=0},e.resetState=function(){e.searchVisible=!1,e.nodeSelected=!1,e.configLoaded=null,e.queryResultsMode=!1,e.lastSavedGraphName=null,e.lastSavedGraphId=null,e.shared=!1,e.numberOfPinnedNodes=0,E={},R=0},e.pushHistory=function(t,n){e.embedded&&(t.embedded=!0),d.search(t),d.state(n)},e.goToHome=function(){e.resetState(),d.url("graphs-visualizations")},e.shouldShowSettings=function(){return e.configLoaded&&e.configLoaded.id===e.defaultGraphConfig.id},e.shouldDisableSameAs=function(){const t=$("#sameAsCheck");return e.settings&&!e.settings.includeInferred&&t.prop("checked")&&(t.prop("checked",!1),e.settings.sameAsState=!1),e.settings&&!e.settings.includeInferred},e.$watch("propertiesObj.items",(function(){angular.isDefined(e.propertiesObj.items)&&e.propertiesObj.items.length>0&&s((function(){e.adapterContainer.adapter.reload()}),500)})),e.toggleMoreInfo=function(e){angular.element(e.currentTarget).parent().next().toggle(200),angular.element(e.currentTarget).children("span").toggleClass("icon-caret-down").toggleClass("icon-caret-up")},e.copyToClipboard=P,e.defaultSettings={linksLimit:20,includeInferred:!0,sameAsState:!0,languages:["en"],showLinksText:!0,preferredTypes:[],rejectedTypes:[],preferredPredicates:[],rejectedPredicates:["http://dbpedia.org/property/logo","http://dbpedia.org/property/hasPhotoCollection","http://dbpedia.org/property/website","http://dbpedia.org/property/homepage","http://dbpedia.org/ontology/thumbnail","http://xmlns.com/foaf/0.1/depiction","http://xmlns.com/foaf/0.1/homepage","http://xmlns.com/foaf/0.1/mbox","http://dbpedia.org/ontology/wikiPage*","http://dbpedia.org/property/wikiPage*","http://factforge.net/*"],preferredTypesOnly:!1,preferredPredicatesOnly:!1,includeSchema:!0},e.saveSettings=angular.copy(e.defaultSettings);const z=p.getPrincipal();function U(){e.settings.languagesMap=_.map(e.settings.languages,(function(e){return{text:e}})),e.settings.preferredTypesMap=_.map(e.settings.preferredTypes,(function(e){return{text:e}})),e.settings.rejectedTypesMap=_.map(e.settings.rejectedTypes,(function(e){return{text:e}})),e.settings.preferredPredicatesMap=_.map(e.settings.preferredPredicates,(function(e){return{text:e}})),e.settings.rejectedPredicatesMap=_.map(e.settings.rejectedPredicates,(function(e){return{text:e}}))}z?q(z):e.$on("securityInit",(function(){q(p.getPrincipal())})),e.resetSettings=function(){e.settings=angular.copy(e.defaultSettings),e.validateLinksLimit(),U()},e.changeLimit=function(t){let n=e.settings.linksLimit+t;n<1&&(n=1),n>1e3&&(n=1e3),e.settings.linksLimit=n},e.validateLinksLimit=function(){e.invalidLimit=!a.NUMBER_PATTERN.test(e.settings.linksLimit)},e.showSettings=function(){e.showInfoPanel=!0,e.showFilter=!0,e.showNodeInfo=!1,e.showPredicates=!1,e.saveSettings?e.settings=angular.copy(e.saveSettings):e.settings=angular.copy(e.defaultSettings),U()},e.reExpandNode=function(){e.rootNodeIri&&e.$broadcast("onRootNodeChange",e.rootNodeIri)};const j=function(t,n,r){const o=void 0===n?e.saveSettings.sameAsState:!0===n,a=void 0===r?e.saveSettings.includeInferred:!0===r;e.loading=!0,u({url:"rest/explore-graph/graph",method:"POST",headers:{"Content-Type":"application/json"},data:{query:t,linksLimit:e.saveSettings.linksLimit,languages:e.shouldShowSettings()?e.saveSettings.languages:[],includeInferred:a,sameAsState:o}}).then((function(e){he(e)}),(function(t){e.loading=!1,i.error(getError(t.data),"Cannot load visual graph!")}))};function Q(e){return e.replace(/[()']/g,"")}function F(e,t){let n=e.split(" ");return t?[n[0],n[1],n[2]].join(">"):[n[0],n[2]].join(">")}function H(e){return[e.source.iri,e.target.iri].join(">")}function G(e){if(e.isTriple){let t=document.getElementById(Q(F(e.iri)));if(t&&void 0!==t.__data__.x)return t.__data__.x}return e.x}function B(e){if(e.isTriple){let t=document.getElementById(Q(F(e.iri)));if(t&&void 0!==t.__data__.y)return t.__data__.y}return e.y}function V(e){let t=e.trim().split(" ");return`<<<${t[0]}> <${t[1]}> <${t[2]}>>>`}function W(e){return Q(`${e.source.isTriple?F(e.source.iri,!0):e.source.iri}>${e.target.isTriple?F(e.target.iri,!0):e.target.iri}>marker`)}function Y(){this.nodes=[],this.links=[],this.tripleNodes=new Map,this.tripleLinksCopy=new Map,this.addNode=function(e,t,n){return e.x=t,e.y=n,this.nodes.push(e),e},this.computeConnectedness=function(){const e={},t={};_.each(this.links,(function(n){const r=n.source.iri,i=n.target.iri,o=_.min([r,i])+"|"+_.max([r,i]);t[o]||(t[o]=1,e[r]=(e[r]||0)+1,e[i]=(e[i]||0)+1)})),_.each(this.links,(function(t){e[t.source.iri]>1&&e[t.target.iri]>1?t.connectedness=Math.min(5,Math.max(e[t.source.iri],e[t.target.iri])-1):t.connectedness=0}))},this.addAndMatchLinks=function(e){const t=this.nodes;Array.prototype.push.apply(this.links,function(e,t){return _.map(e,(function(e){let n,r;n=e.isTripleSource?Ce(e.source):_.find(t,(function(t){return t.iri===e.source})),r=e.isTripleTarget?Ce(e.target):_.find(t,(function(t){return t.iri===e.target}));let i={source:n,target:r,predicates:e.predicates};if(e.isTripleSource||e.isTripleTarget){let e=`${i.source.isTriple?F(i.source.iri):i.source.iri}>${i.target.isTriple?F(i.target.iri):i.target.iri}`;if(X.tripleLinksCopy.has(e)){let t=X.tripleLinksCopy.get(e);return t[0].predicates.push(...i.predicates),t.push(i),X.tripleLinksCopy.set(e,t),null}X.tripleLinksCopy.set(e,[i])}return i}))}(e,t));for(let e of X.tripleLinksCopy.keys())1===X.tripleLinksCopy.get(e).length&&X.tripleLinksCopy.delete(e);this.links=this.links.filter(e=>null!==e),this.computeConnectedness()};const t=function(e,t){return n(e,t).length};function n(e,t){return _.filter(t,(function(t){return t.source.iri===e.iri||t.target.iri===e.iri}))}this.countLinks=t,this.linksTypes=function(e,t){const r=n(e,t),i=_.map(r,(function(t){return t.source.iri===e.iri?t.target.types:t.source.types}));return _.uniq(_.flatten(i))},this.linksPredicates=function(e,t){const r=n(e,t),i=_.map(r,(function(e){return e.predicates}));return _.uniq(_.flatten(i))},this.removeTriples=function(e){let t=[];this.tripleNodes.size>0&&e.forEach(e=>{this.tripleNodes.has(e)&&(this.tripleNodes.delete(e),this.links=_.reject(this.links,(function(n){let r=e.split(">"),i=F(n.source.iri),o=F(n.target.iri);if(i===e&&X.tripleNodes.delete(o)){let e=o.split(">");t.push({source:e[0],target:e[1]})}let a=i===e||o===e||n.source.iri===r[0]&&n.target.iri===r[1];return a&&(X.tripleLinksCopy.delete(`${i}>${o}`),X.tripleLinksCopy.delete(`${o}>${i}`)),a})))}),t.forEach(e=>{this.links=_.reject(this.links,(function(t){return t.source.iri===e.source&&t.target.iri===e.target}))})},this.removeNode=function(n){let r=[];this.links=_.reject(this.links,(function(e){let t=e.source.iri===n.iri||e.target.iri===n.iri;return t&&(e.target.isTriple&&r.push(F(e.target.iri)),e.source.isTriple||e.target.isTriple||r.push([e.source.iri,e.target.iri].join(">"))),t})),this.removeTriples(r);const i=this.links;this.nodes=_.reject(this.nodes,(function(e){return 0===t(e,i)})),0===this.nodes.length&&(e.nodeSelected=!1),this.computeConnectedness()},this.removeNodeLeafLinks=function(e){let r=[],i=this.links;this.links=_.reject(this.links,(function(o){let a=o.source.iri===e.iri&&1===t(o.target,i)&&!o.target.isTriple||o.target.iri===e.iri&&1===t(o.source,i)&&!o.source.isTriple;if(!a){let r;if(o.source.iri!==e.iri||2!==t(o.target,i)||o.target.isTriple?o.target.iri!==e.iri||2!==t(o.source,i)||o.source.isTriple||(r=n(o.source,i)):r=n(o.target,i),!r)return!1;a=(r[0].source.iri===e.iri||r[0].target.iri)&&(r[1].source.iri===e.iri||r[1].target.iri)}return a&&(o.target.isTriple&&r.push(F(o.target.iri)),o.source.isTriple||o.target.isTriple||r.push([o.source.iri,o.target.iri].join(">"))),a})),this.removeTriples(r),i=this.links,this.nodes=_.reject(this.nodes,(function(n){return 0===t(n,i)&&n.iri!==e.iri})),this.computeConnectedness()},this.addTriple=function(e,t,n){e.x=t,e.y=n,e.weight=0;let r=F(e.iri);if(this.tripleNodes.has(r)){let t=this.tripleNodes.get(r);t.push(e),this.tripleNodes.set(r,t)}else e.weight=10,this.tripleNodes.set(r,[e])},this.copyState=function(){const e=_.map(this.nodes,(function(e){return{iri:e.iri,isTriple:e.isTriple,size:e.size,labels:angular.copy(e.labels),types:angular.copy(e.types),rdfRank:e.rdfRank,x:e.x,y:e.y,fixed:e.fixed}})),t=JSON.stringify(Array.from(this.tripleNodes.entries())),n=JSON.stringify(Array.from(this.tripleLinksCopy.entries()));return{nodes:e,links:_.map(this.links,(function(e){return{source:e.source.iri,isTripleSource:e.source.isTriple,target:e.target.iri,isTripleTarget:e.target.isTriple,predicates:e.predicates}})),tripleNodes:t,tripleLinksCopy:n,colorIndex:R,type2color:E,scale:A.scale(),translate:A.translate()}},this.restoreState=function(t){e.nodeSelected=!0,e.searchVisible=!1,this.nodes=angular.copy(t.nodes),this.tripleNodes=t.tripleNodes?new Map(JSON.parse(t.tripleNodes)):new Map,this.links=[],this.addAndMatchLinks(t.links),this.tripleLinksCopy=t.tripleLinksCopy?new Map(JSON.parse(t.tripleLinksCopy)):new Map,_.each(this.nodes,(function(t){t.fixed&&e.numberOfPinnedNodes++})),angular.isDefined(t.colorIndex)&&angular.isDefined(t.type2color)&&(R=t.colorIndex,E=angular.copy(t.type2color)),angular.isDefined(t.translate)&&angular.isDefined(t.scale)&&(I="translate("+t.translate[0]+", "+t.translate[1]+") scale("+t.scale+")",A.translate(t.translate),A.scale(t.scale)),le()}}e.updateSettings=function(){e.invalidLimit?i.error(e.INVALID_LINKS_TOOLTIP,e.INVALID_LINKS_MSG):(e.saveSettings=e.settings,e.saveSettings.languages=_.map(e.saveSettings.languagesMap,(function(e){return e.text})),e.saveSettings.preferredTypes=_.map(e.saveSettings.preferredTypesMap,(function(e){return e.text})),e.saveSettings.rejectedTypes=_.map(e.saveSettings.rejectedTypesMap,(function(e){return e.text})),e.saveSettings.preferredPredicates=_.map(e.saveSettings.preferredPredicatesMap,(function(e){return e.text})),e.saveSettings.rejectedPredicates=_.map(e.saveSettings.rejectedPredicatesMap,(function(e){return e.text})),e.rootNodeIri?e.reExpandNode(e.rootNodeIri):e.queryResultsMode&&d.search().query?j(d.search().query,d.search().sameAs,d.search().inference):"query"===e.configLoaded.startMode&&e.loadGraphConfig(e.configLoaded),e.saveSettings.showLinksText?d3.selectAll("svg .link-wrapper text").style("display","block"):d3.selectAll("svg .link-wrapper text").style("display","none"),e.showInfoPanel=!1,e.showFilter=!1,v.set(x.GRAPHS_VIZ,e.saveSettings))},e.showInfoPanel=!1;let X=new Y;e.defaultGraphConfig={id:"default",name:"Easy graph",startMode:"search"},e.getGraphConfigs=function(t){b.getGraphConfigs().success((function(n){e.graphConfigs=n,t&&t()})).error((function(e){i.error(getError(e),"Could not get graph configs")}))},e.loadConfigForId=function(t,n){t===e.defaultGraphConfig.id?e.loadGraphConfig(e.defaultGraphConfig):b.getConfig(t).success((function(t){e.loadGraphConfig(t),n()})).error((function(e){i.error(getError(e),"Could not load config "+t)}))},e.findConfigById=function(t){return t===e.defaultGraphConfig.id?e.defaultGraphConfig:$.grep(e.graphConfigs,(function(e){return e.id===t}))[0]},e.easyGraphSearch=function(t){e.configLoaded=e.defaultGraphConfig,e.openUri(t)},e.loadGraphConfig=function(t){e.configLoaded=t,"search"===t.startMode?e.searchVisible=!0:"node"===t.startMode&&t.startIRI?s((function(){e.openUri(t.startIRI,!0)}),0):"query"===t.startMode&&t.startGraphQuery&&(e.loading=!0,b.loadGraphForConfig(t,t.startQueryIncludeInferred,e.saveSettings.linksLimit,t.startQuerySameAs).then((function(e){he(e)}),(function(t){e.loading=!1,i.error(getError(t),"Could not load graph from config")})))},e.deleteConfig=function(t){g.openSimpleModal({title:"Confirm",message:"Are you sure you want to delete the graph config '"+t.name+"'?",warning:!0}).result.then((function(){b.deleteGraphConfig(t).success((function(){e.getGraphConfigs(),e.refreshSavedGraphs()})).error((function(e){i.error(getError(e),"Could not delete graph config")}))}))},e.goToGraphConfig=function(t){e.pushHistory({config:t.id},{config:t}),e.resetState(),e.loadGraphConfig(t)},y.onpopstate=function(t){e.resetState(),t.state&&(t.state.config?(e.loadGraphConfig(t.state.config),t.state.uri&&e.openUri(t.state.uri,!0)):t.state.savedGraph&&e.loadSavedGraph(t.state.savedGraph,!0))};const J=function(){d.search().query?(e.searchVisible=!1,e.queryResultsMode=!0,j(d.search().query,d.search().sameAs,d.search().inference)):e.$on("onRootNodeChange",(function(t,n){e.loading=!0,angular.isDefined(n)&&(e.rootNodeIri=n,u({url:"rest/explore-graph/node",method:"GET",params:{iri:n,config:e.configLoaded?e.configLoaded.id:e.defaultGraphConfig.id,languages:e.shouldShowSettings()?e.saveSettings.languages:[],includeInferred:e.saveSettings.includeInferred,sameAsState:e.saveSettings.sameAsState}}).then((function(t){e.nodeSelected=!0,e.searchVisible=!1,null===t.data.types&&(t.data.types="greyColor"),X=new Y;const n=X.addNode(t.data,N/2,L/2);I="translate(0, -70) scale(1)",A.translate([0,-70]),A.scale(1),me(n,!0)})).catch((function(t){e.loading=!1,i.error(getError(t),"Could not load visual graph")})))})),d.search().uri&&e.openUri(d.search().uri),d.search().saved&&w.getSavedGraph(d.search().saved).success((function(t){e.loadSavedGraph(t)})).error((function(e){const t=getError(e);i.error(t,"Error! Could not open saved graph")}))},Z=function(){d.search().config?e.loadConfigForId(d.search().config,J):d.search().query||d.search().uri?(e.loadGraphConfig(e.defaultGraphConfig),J()):J()};function K(t){!n.getActiveRepository()||e.hasInitedRepository&&!t||(e.hasInitedRepository=!0,t||e.getGraphConfigs(Z),e.getNamespacesPromise=C.getNamespaces(e.getActiveRepository()).success((function(t){const n=_.map(t.results.bindings,(function(e){return{uri:e.namespace.value,prefix:e.prefix.value}}));e.namespaces=_.sortBy(n,(function(e){return e.uri.length})),ee()})).error((function(e){i.error(getError(e),"Cannot get namespaces for repository. View will not work properly!")})))}function ee(){e.getAutocompletePromise=l.checkAutocompleteStatus()}e.replaceIRIWithPrefix=function(t){const n=e.namespaces,r=_.findLast(n,(function(e){return 0===t.indexOf(e.uri)}));return r?r.prefix+":"+t.substring(r.uri.length):t},e.addedTag=function(t){return t.text.indexOf(":")<0?(i.warning("Enter an absolute full or prefixed IRI"),null):(t.text=function(e,t){if(!/^<?(http|urn).*>?/.test(e)){const n=e.split(":"),r=n[0],i=n[1];if(!angular.isUndefined(i)){const e=c.getNamespaceUriForPrefix(t,r);if(e)return e+i}}return e}(t.text,e.namespaces),e.pageslideExpanded=!0,t)},e.validateTag=function(e,t,n){if(e.text.indexOf(":")<0)return n?i.warning("Enter an absolute full or prefixed IRI, optionally ending in *",t):i.warning("Enter an absolute full or prefixed IRI",t),!1;const r=e.text.indexOf("*");if(r>=0){if(!n)return i.warning("Wildcards not allowed here",t),!1;if(r<e.text.length-1)return i.warning("Wildcard allowed only as the last character",t),!1}return!0},e.getTagClass=function(e){return e.endsWith("*")?"tag-item-wildcard":null},e.getActiveRepository=function(){return n.getActiveRepository()},e.hasInitedRepository=!1,e.$on("autocompleteStatus",(function(){ee()})),e.$on("repositoryIsSet",(function(t,n){n.newRepo&&(e.hasInitedRepository=!1),K(n.newRepo),n.newRepo&&(e.resetState(),$(".graph-visualization svg").empty(),d.search().query&&(e.goToHome(),J()))})),K();const te=500,ne=1.75,re=d3.scale.linear().domain([0,9]).range(["hsl(0, 100%, 75%)","hsl(360, 90%, 82%)"]).interpolate(d3.interpolateHslLong),ie=d3.scale.linear().domain([0,9]).range(["hsl(180, 50%, 75%)","hsl(540, 40%, 82%)"]).interpolate(d3.interpolateHslLong);e.getColor=function(e){angular.isUndefined(E[e])&&(E[e]=R,R++);const t=E[e];return t>39?"#c2c2c2":t%2==0?re(t/2):ie(t/2)};const oe=d3.layout.force().gravity(.07).size([N,L]),ae=d3.select(".main-container .graph-visualization").append("svg").attr("viewBox","0 0 "+N+" "+L).attr("preserveAspectRatio","xMidYMid meet");let se=0,ue=0;const ce=new function(){this.state=!1,this.setLoadingState=function(e){this.state=e},this.getLoadingState=function(){return this.state},this.init=function(e,t){d3.select(t).append("circle").attr("cx",(function(){return e.x})).attr("cy",(function(){return e.y})).attr("class","loader-container").attr("r",(function(){return e.size})).style("fill","fff").style("opacity","0.7"),d3.select(t).append("image").attr("xlink:href","js/angular/templates/loader/ot-loader.svg?v=1.11.2").attr("x",(function(){return e.x-e.size+5})).attr("y",(function(){return e.y-e.size})).attr("width",(function(){return 2*e.size})).attr("height",(function(){return 2*e.size})).attr("class","node-loader")}};function le(t){d3.selectAll("svg g").remove(),d3.selectAll("svg rect").remove(),d3.selectAll(".d3-tip").remove(),d3.selectAll(".menu-events").remove(),A.on("zoom",(function(){I="translate("+d3.event.translate+") scale("+d3.event.scale+")",n.attr("transform",I)})),ae.append("rect").attr("width",10*N).attr("height",10*L).attr("x",-(10*N-N)/2).attr("y",-(10*L-L)/2).style("fill","none").style("pointer-events","all").call(A).on("click",(function(){d3.event.stopPropagation(),ye(),oe.stop()}));const n=ae.append("g").attr("class","nodes-container").attr("transform",(function(){return angular.isDefined(I)&&!t?I:""})),a=o()().attr("class","d3-tip").customPosition((function(){const e=D.getBoundingClientRect();return{top:e.bottom+10+"px",left:e.left-30+"px"}})).html((function(t){let n="";return t.fixed&&(n+='<i class="icon-pin"></i>&nbsp;&nbsp;'),t.types.length>0?n+=_.join(_.map(t.types,(function(t){return e.replaceIRIWithPrefix(t)}))," · "):n+="<i>No types</i>",n})),u=function(e){let t="";return t+=_.join(_.map(e.predicates,(function(t,n){if(0===n)return Me(t);if(n<10)return" · "+Me(t);if(10===n){const t=function(e){return e.predicates.length-10}(e);return" · more "+(t>1?t+" predicates":t+" predicate")+" to show"}})),""),t};let c;const l=o()().attr("class","d3-tip").customPosition((function(e){const t=c.getBoundingClientRect(),n=function(e){const t=u(e),n=document.createElement("canvas").getContext("2d");return n.font="13px Arial",e.predicates.length<10?n.measureText(t).width:n.measureText(t).width/2}(e);return{top:t.top-30+"px",left:t.left-30+"px",width:n+"px"}})).html((function(e){return u(e)}));const f=function(){s.cancel(void 0),s.cancel(se),D=null,a.hide(),ue=s((function(){ye()}),500)};ae.call(a);ae.call(l);let d=ae.selectAll(".link"),p=ae.selectAll(".node");oe.nodes(X.nodes).charge(-3e3),oe.links(X.links).linkDistance((function(e){return e.source.isTriple||e.target.isTriple?0:function(e){const t=$("<span></span>"),n=e.predicates[0].split("/"),r=n[n.length-1];t.addClass("predicate-text").text(r),$("body").append(t);const i=t.width()+2*e.source.size+2*e.target.size+50;return t.remove(),.75*i}(e)+30*e.connectedness})),n.append("defs").selectAll("marker").data(oe.links()).enter().append("marker").attr("class","arrow-marker").attr("id",(function(e){return W(e)})).attr("viewBox","0 -5 10 10").attr("refX",(function(e){return e.target.isTriple?11:e.target.size+11})).attr("refY",0).attr("markerWidth",10).attr("markerHeight",10).attr("orient","auto").append("path").attr("d","M0,-5L10,0L0,5 L10,0 L0, -5"),d=n.selectAll(".link").data(X.links).enter().append("g").attr("class","link-wrapper").attr("id",(function(e){return Q(H(e))})).append("line").attr("class","link").style("stroke-width",1).style("fill","transparent").style("marker-end",(function(e){return`url(#${W(e)})`}));const h=n.selectAll(".link-wrapper").append("text").text((function(e){return Se(e)})).attr("class",(function(e){return e.predicates.length>1||X.tripleNodes.has(H(e))?"predicates":"predicate"})).attr("dy","-0.5em").style("text-anchor","middle").style("display",e.saveSettings.showLinksText?"":"none").on("mouseover",(function(e){d3.event.stopPropagation(),function(e){s.cancel(void 0);const t=c=d3.event.target;s((function(){c===t&&e.predicates.length>1&&l.show(e,c)}),300)}(e)})).on("mouseout",(function(){s.cancel(void 0),c=null,l.hide()})).on("click",(function(t){d3.event.stopPropagation(),function(t){be();let n=H(t);if(1===t.predicates.length&&X.tripleNodes.has(n)){O=null;let e=X.tripleNodes.get(n)[0];if(de(e,this,d3.event.button)){let t={};t.iri=e.iri,t.pred=Me(e.iri.split(" ")[1]),xe(t)}return}!function(t){if(e.showNodeInfo=!1,e.showPredicates=t.predicates.length>1,e.showFilter=!1,e.showInfoPanel=!1,O===t)return e.showNodeInfo=!1,e.showInfoPanel=!1,void(O=null);O=t,e.showPredicates&&(e.predicates=_.map(t.predicates,(function(e){let n=function(e,t){let n=H(t);return X.tripleNodes.has(n)?X.tripleNodes.get(n).findIndex(t=>t.iri.indexOf(e)>=0):-1}(e,t),r=n>-1;return{value:Me(e),partOfTriple:r,linkId:r?H(t):"",nodeIndex:n}})),e.showInfoPanel=!0)}(t)}(t)}));let g,m=0,y=0,v=0;const x=function(){d3.event.button&&0!==d3.event.button||(f(),s.cancel(g),e.showPredicates=!1,d3.event.timeStamp-m<te?y++:y=1,m=d3.event.timeStamp,d3.event.preventDefault())},w=function(t){if(d3.event.button&&0!==d3.event.button)return;s.cancel(g);const n=d3.event,r=this;if(d3.event.timeStamp-m<te)if(1===y)g=s((function(){de(t,r,n)}),40+te-(d3.event.timeStamp-m));else if(2===y){X.countLinks(t,X.links)<=e.saveSettings.linksLimit?me(t,!1,r.parentNode):i.info("Increase limit to see more connections and try again","Node already expanded to predefined maximum links to show."),e.closeInfoPanel()}d3.event.preventDefault()};function b(e,t){let r,i,o,a,s=!0;if("down"===t)r=2*e.size,i=e.size/3,o=.8,a=.3;else if("down-fixed"===t)r=2*e.size,i=e.size,o=.8,a=.66;else if("up"===t)r=e.size/3,i=2*e.size,o=.3,a=.8;else{if("fixed"!==t)return;r=e.size,o=.66,s=!1}let u=n.selectAll(".node-wrapper").filter((function(t){return t===e})).append("text").text("").classed("icon-any pinned",!0).style("font-size",r+"px").attr("x",(function(e){return e.x})).attr("y",(function(e){return e.y})).attr("opacity",o);"fixed"!==t&&"down-fixed"!==t||(e.pin=u),s&&(u=u.transition().duration(1e3).style("font-size",(function(){return i+"px"})).attr("opacity",a),"down-fixed"!==t&&u.remove())}const C=d3.behavior.drag().origin((function(e){return e})).on("dragstart",(function(e){0===d3.event.sourceEvent.button&&(e.fixedBeforeDrag=e.fixed,e.isBeingDragged=!0,e.beginDragging=!0,ye(),d3.event.sourceEvent.stopPropagation(),d3.select(this).classed("dragging",!0))})).on("drag",(function(t){t.isBeingDragged&&(y=0,t.px=d3.event.x,t.py=d3.event.y,t.fixed?t.beginDragging&&b(t,"fixed"):(e.numberOfPinnedNodes++,t.fixed=!0,b(t,"down-fixed")),t.pinWasFixed=!0,t.beginDragging=null,oe.resume())})).on("dragend",(function(e){e.isBeingDragged&&(e.pinWasFixed&&(e.pinWasFixed=null,d3.select(".pinned").remove()),e.isBeingDragged=!1,d3.select(this).classed("dragging",!1))}));p=n.selectAll(".node").data(X.nodes).enter().append("g").attr("class","node-wrapper").attr("id",(function(e){return e.iri})).append("circle").attr("class","node").attr("r",(function(e){return e.size})).style("fill",(function(t){return"greyColor"===t.types?"c2c2c2":e.getColor(t.types[0])})).call(C).on("mouseover",(function(t){if(!t.isBeingDragged){const n=d3.event;s.cancel(ue),se=s(()=>{(function(t,n){if(e.showInfoPanel)return!1;(fe.closeIcon||fe.expandIcon||fe.focusIcon||fe.copyURIIcon)&&fe.removeIcons();if(oe.alpha()<.05)return fe.initIcons(t,n.parentNode),oe.stop(),!0;return!1})(t,this)&&function(e,t){s.cancel(void 0);const n=D=t.target;s((function(){D===n&&a.show(e,D)}),300)}(t,n)},400)}})).on("mouseout",f).on("mousedown",x).on("touchstart",(function(e){x(),v=0,g=s((function(){v<5&&pe(e),g=null,y=0}),1e3)})).on("touchmove",(function(){v++})).on("mouseup",w).on("touchend",w).on("contextmenu",(function(t){d3.event.shiftKey||(d3.event.preventDefault(),ye(),e.closeInfoPanel(),t.fixed?(e.numberOfPinnedNodes--,t.fixed=!1,b(t,"up"),oe.resume()):(e.numberOfPinnedNodes++,t.fixed=!0,b(t,"down")),function(e){D&&a.show(e,D)}(t))}));const S=n.selectAll(".node-wrapper").append("foreignObject").style("pointer-events","none").attr("width",(function(e){return 2*e.size*ne}));n.insert("g").attr("class","menu-events"),function(e){e.each((function(e){e.fontSize=r.a.Text.calcFontSizeRaw(e.labels[0].label,e.size,k,!0)})).attr("height",(function(e){return 3*e.fontSize})).append("xhtml:div").attr("class","node-label-body").style("font-size",(function(e){return e.fontSize+"px"})).append("xhtml:div").text((function(e){return e.labels[0].label})),s((function(){$(".node-label-body div").each((function(e,t){let n=t.textContent.substring(0,t.textContent.length-1);let r=0;for(;r<200&&(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth);)n=n.substring(0,n.length-1),t.textContent=n+"…",r++}))}),50)}(S),oe.on("tick",(function(){d3.geom.quadtree(X.nodes);X.nodes.length;d.attr("x1",(function(e){return G(e.source)})).attr("y1",(function(e){return B(e.source)})).attr("x2",(function(e){return G(e.target)})).attr("y2",(function(e){return B(e.target)})),h.attr("x",(function(e){let t=G(e.source),n=G(e.target);return e.x=.5*(t+n)})).attr("y",(function(e){let t=B(e.source),n=B(e.target);return e.y=.5*(t+n)})).attr("transform",(function(e){return"rotate("+function(e,t){e.source,e.target;const n={x:G(e.source),y:B(e.source)},r={x:G(e.target),y:B(e.target)};if(t)return 180*Math.atan2(r.y-n.y,r.x-n.x)/Math.PI;{const e=180*Math.atan2(r.y-n.y,r.x-n.x)/Math.PI;return e<=90&&e>=-90?e:(e>0?-1:1)*(180-Math.abs(e))}}(e,e.direction)+", "+e.x+", "+e.y+")"})),p.attr("cx",(function(e){return e.x})).attr("cy",(function(e){return e.y})),n.select(".node-loader").attr("x",(function(e){return e.x-e.size+3})).attr("y",(function(e){return e.y-e.size})),n.select(".loader-container").attr("cx",(function(e){return e.x})).attr("cy",(function(e){return e.y})),S.attr("x",(function(e){return e.x-e.size*ne})).attr("y",(function(e){return e.y-3*e.fontSize/2})),d3.select(".pinned").attr("x",(function(e){return e.x})).attr("y",(function(e){return e.y}))})),angular.isDefined(ce)&&ce.setLoadingState(!1),e.loading&&(e.loading=!1),d3.selectAll(".link-wrapper").each((function(){const e=$(this).attr("id").split(">")[0],t=$(this).attr("id").split(">")[1];d3.selectAll(".link").each((function(n){let r=Q(n.source.iri),i=Q(n.target.iri);if(r===t&&i===e){let e=r;e+=">",e+=i;const t=document.createTextNode(" ⟶");document.getElementById(e).lastChild.appendChild(t),n.direction="double"}}))})),d3.selectAll(".d3-actions-tip").remove(),oe.start()}le();const fe=new function(){function e(e,t){return"translate("+(t.x-14+(t.size+15)*Math.cos(e*Math.PI/180-Math.PI/2))+","+(t.y-14+(t.size+15)*Math.sin(e*Math.PI/180-Math.PI/2))+")"}this.closeIcon=void 0,this.expandIcon=void 0,this.collapseIcon=void 0,this.focusIcon=void 0,this.copyURIIcon=void 0,this.actionsTip=void 0,this.removeIcons=function(){this.closeIcon.remove("g"),this.expandIcon&&this.expandIcon.remove("g"),this.collapseIcon&&this.collapseIcon.remove("g"),this.focusIcon.remove("g"),this.copyURIIcon.remove("g"),this.closeIcon=void 0,this.expandIcon=void 0,this.collapseIcon=void 0,this.focusIcon=void 0,this.copyURIIcon=void 0,this.expandedState=!1},this.expandedState=!1,this.initIcons=function(n,r){const i=o()().attr("class","d3-tip d3-actions-tip").customPosition((function(){const e=d3.event.target.getBoundingClientRect();return{top:e.top-20+"px",left:e.right+10+"px"}})).html((function(e){return e}));ae.call(i);n.isExpanded?(this.collapseIcon=d3.select(".menu-events").append("g").attr("class","collapse-icon").attr("name","collapse").attr("transform",(function(){return e(20,n)})),this.collapseIcon.append("circle").attr("cx",14).attr("cy",14).attr("r",13).style("fill","#eee"),this.collapseIcon.append("path").attr("d","M22.67,12a.59.59,0,0,1-.53.65l-6.88.72H15.2a.59.59,0,0,1-.59-.65l.72-6.88A.58.58,0,0,1,16,5.33a.59.59,0,0,1,.53.65L16,11.11,21.3,5.79a.64.64,0,0,1,.91.91L16.89,12,22,11.49A.59.59,0,0,1,22.67,12ZM12.59,14.75l-6.75.85a.59.59,0,0,0-.51.66.58.58,0,0,0,.66.51l4.95-.62-5.2,5.2a.64.64,0,1,0,.91.91l5.2-5.2L11.23,22a.59.59,0,0,0,.51.66h.07a.59.59,0,0,0,.59-.52l.85-6.75a.59.59,0,0,0-.17-.49A.58.58,0,0,0,12.59,14.75Z").style("fill","#ed4f2f"),this.collapseIcon.on("click",(function(){var e;(e=n).isExpanded=!1,X.removeNodeLeafLinks(e),le()})).on("mouseover",(function(){i.show(this.getAttribute("name")),s.cancel(se),s.cancel(ue)})).on("mouseout",(function(){i.hide(),ue=s((function(){ye()}),500)}))):(this.expandIcon=d3.select(".menu-events").append("g").attr("class","expand-icon").attr("name","expand").attr("transform",(function(){return e(20,n)})),this.expandIcon.append("circle").attr("cx",14).attr("cy",14).attr("r",13).style("fill","#eee"),this.expandIcon.append("path").attr("d","M22.37,6.28l-.72,6.88a.59.59,0,0,1-.59.53H21a.59.59,0,0,1-.53-.65L21,7.9l-5.32,5.32a.64.64,0,0,1-.91-.91L20.1,7,15,7.53a.59.59,0,0,1-.12-1.18l6.88-.72a.59.59,0,0,1,.65.65ZM12.89,20.34,7.95,21l5.2-5.2a.64.64,0,0,0-.91-.91L7,20.05l.62-4.95A.59.59,0,0,0,6.48,15l-.85,6.75a.59.59,0,0,0,.59.67h.07L13,21.52a.59.59,0,1,0-.15-1.18Z").style("fill","#ed4f2f"),this.expandIcon.on("click",(function(){me(n,!1,r)})).on("mouseover",(function(){i.show(this.getAttribute("name")),s.cancel(ue),s.cancel(se)})).on("mouseout",(function(){i.hide(),ue=s((function(){ye()}),500)}))),this.focusIcon=d3.select(".menu-events").append("g").attr("class","focus-icon").attr("name","focus").attr("transform",(function(){return e(20,n)})),this.focusIcon.append("circle").attr("cx",14).attr("cy",14).attr("r",13).style("fill","#eee"),this.focusIcon.append("path").attr("d","M14.2,23.81a9.8,9.8,0,1,1,6.93-2.87h0A9.74,9.74,0,0,1,14.2,23.81Zm0-18.17a8.37,8.37,0,1,0,5.92,14.29h0A8.37,8.37,0,0,0,14.2,5.64Zm1.42,6.95a2,2,0,1,0,0,2.85A2,2,0,0,0,15.62,12.59Z").style("fill","#ed4f2f"),this.focusIcon.on("click",(function(){t.$broadcast("onRootNodeChange",n.iri)})).on("mouseover",(function(){i.show(this.getAttribute("name")),s.cancel(ue),s.cancel(se)})).on("mouseout",(function(){i.hide(),ue=s((function(){ye()}),500)})),this.copyURIIcon=d3.select(".menu-events").append("g").attr("class","icon-link").attr("name","link").attr("transform",(function(){return e(20,n)})),this.copyURIIcon.append("circle").attr("cx",14).attr("cy",14).attr("r",13).style("fill","#eee"),this.copyURIIcon.append("path").attr("d","M 13.457031 10.164062 C 13.648438 10.164062 13.820312 10.242188 13.941406 10.363281 L 15.492188 11.859375 C 15.984375 12.332031 16.292969 12.992188 16.292969 13.714844 C 16.292969 14.441406 15.984375 15.097656 15.492188 15.574219 L 10.394531 20.496094 C 9.902344 20.972656 9.222656 21.265625 8.472656 21.265625 C 7.71875 21.265625 7.039062 20.972656 6.546875 20.496094 L 4.996094 19 C 4.507812 18.523438 4.203125 17.867188 4.203125 17.144531 C 4.203125 16.421875 4.507812 15.765625 4.996094 15.289062 L 7.542969 12.824219 C 7.667969 12.707031 7.84375 12.628906 8.035156 12.628906 C 8.417969 12.628906 8.726562 12.929688 8.726562 13.300781 C 8.726562 13.484375 8.648438 13.652344 8.523438 13.773438 L 5.976562 16.234375 C 5.738281 16.46875 5.589844 16.792969 5.589844 17.148438 C 5.589844 17.503906 5.738281 17.824219 5.976562 18.058594 L 7.527344 19.566406 C 7.773438 19.792969 8.105469 19.929688 8.472656 19.929688 C 8.835938 19.929688 9.167969 19.792969 9.414062 19.566406 L 14.511719 14.644531 C 14.753906 14.410156 14.90625 14.089844 14.90625 13.730469 C 14.90625 13.375 14.753906 13.054688 14.511719 12.820312 L 12.964844 11.324219 C 12.839844 11.203125 12.761719 11.039062 12.761719 10.855469 C 12.761719 10.488281 13.070312 10.1875 13.449219 10.1875 Z M 17.082031 3.976562 C 17.082031 3.976562 17.085938 3.976562 17.085938 3.976562 C 17.824219 3.976562 18.492188 4.261719 18.980469 4.722656 L 20.535156 6.203125 C 21.042969 6.679688 21.355469 7.34375 21.355469 8.082031 C 21.355469 8.792969 21.058594 9.441406 20.582031 9.914062 L 18.0625 12.402344 C 17.9375 12.527344 17.761719 12.605469 17.566406 12.605469 C 17.183594 12.605469 16.875 12.304688 16.875 11.9375 C 16.875 11.753906 16.949219 11.589844 17.070312 11.46875 L 19.605469 8.984375 C 19.847656 8.75 19.996094 8.429688 19.996094 8.070312 C 19.996094 7.714844 19.847656 7.394531 19.605469 7.160156 L 18.019531 5.667969 C 17.773438 5.445312 17.4375 5.304688 17.070312 5.300781 C 16.703125 5.304688 16.367188 5.453125 16.128906 5.691406 L 11.085938 10.667969 C 10.84375 10.898438 10.695312 11.222656 10.695312 11.578125 C 10.695312 11.933594 10.84375 12.257812 11.085938 12.488281 L 12.675781 13.980469 C 12.804688 14.101562 12.882812 14.273438 12.882812 14.457031 C 12.882812 14.828125 12.574219 15.128906 12.191406 15.128906 C 12.003906 15.128906 11.832031 15.054688 11.707031 14.9375 L 10.140625 13.457031 C 9.636719 12.980469 9.324219 12.316406 9.324219 11.582031 C 9.324219 10.863281 9.621094 10.214844 10.101562 9.742188 L 15.140625 4.765625 C 15.625 4.285156 16.304688 3.980469 17.054688 3.976562 Z M 17.082031 3.976562").style("fill","#ed4f2f"),this.copyURIIcon.on("click",(function(){P(n.iri),ye(),i.hide()})).on("mouseover",(function(){i.show("<div style='text-align: center;'><b>Copy to ClipBoard</b><br>"+n.iri+"</div>"),s.cancel(ue),s.cancel(se)})).on("mouseout",(function(){i.hide(),ue=s((function(){ye()}),500)})),this.closeIcon=d3.select(".menu-events").append("g").attr("class","close-icon").attr("name","remove").attr("transform",(function(){return e(20,n)})),this.closeIcon.append("circle").attr("cx",14).attr("cy",14).attr("r",13).style("fill","#eee"),this.closeIcon.append("path").attr("d","M14.94,14l5.87-5.87a.66.66,0,1,0-.94-.94L14,13.06,8.13,7.19a.66.66,0,0,0-.94.94L13.06,14,7.19,19.87a.66.66,0,1,0,.94.94L14,14.94l5.87,5.87a.66.66,0,1,0,.94-.94Z").style("fill","#ed4f2f"),this.closeIcon.on("click",(function(){pe(n)})).on("mouseover",(function(){i.show(this.getAttribute("name")),s.cancel(ue),s.cancel(se)})).on("mouseout",(function(){i.hide(),ue=s((function(){ye()}),500)})),this.animateMenu(n)},this.animateMenu=function(t){let n=0;let r=20;this.expandIcon&&this.expandIcon.transition().duration(100).style("opacity",1).ease("sin").attr("transform",(function(){return e(r,t)})).delay(n+=35),this.collapseIcon&&this.collapseIcon.transition().duration(100).style("opacity",1).ease("sin").attr("transform",(function(){return e(r,t)})).delay(n+=35),this.copyURIIcon.transition().duration(100).style("opacity",1).ease("sin").attr("transform",(function(){return r+=30,e(r,t)})).delay(n+=35),this.focusIcon.transition().duration(100).style("opacity",1).ease("sin").attr("transform",(function(){return r+=30,e(r,t)})).delay(n+=35),this.closeIcon.transition().duration(100).style("opacity",1).ease("sin").attr("transform",(function(){return r+=30,e(r,t)})).delay(n+=35),this.expandedState=!0}};function de(n,r,i){return e.showInfoPanel=!1,e.showPredicates=!1,e.showNodeInfo=!1,i.shiftKey&&(i.ctrlKey||i.metaKey)?(t.$broadcast("onRootNodeChange",n.iri),!1):i.ctrlKey||i.metaKey?(pe(n),!1):void 0!==e.openedNodeInfoPanel&&e.openedNodeInfoPanel===n?(e.pageslideExpanded=!1,e.openedNodeInfoPanel=void 0,!1):(ve(n),!0)}function pe(e){X.removeNode(e),le()}function he(t){!function(t){e.nodeSelected=!0,null===t.data.types&&(t.data.types="greyColor"),X=new Y,I="translate(0, -70) scale(1)",A.translate([0,-70]),A.scale(1)}(t),ge(t)}function ge(t,n,r){let o=t.data;o=_.filter(o,(function(e){return-1===_.findIndex(X.links,(function(t){return e.source===t.source.iri&&e.target===t.target.iri}))}));let a=[];const s=X.tripleLinksCopy.values();for(let e=0;e<X.tripleLinksCopy.size;e++){s.next().value.forEach(e=>{a.push(e)})}o=_.filter(o,(function(e){return-1===_.findIndex(a,(function(t){return e.source===t.source.iri&&e.target===t.target.iri}))})),o=_.filter(o,(function(e){return e.source!==e.target}));const c=function(e,t){let n=t.map((function(t){return t[e]}));return t.filter((function(t,r){return n.indexOf(t[e])===r}))}("iri",_.union(_.flatten(_.map(t.data,(function(e){return[{iri:e.source,isTriple:e.isTripleSource},{iri:e.target,isTriple:e.isTripleTarget}]}))))),l=_.map(X.nodes,(function(e){return{iri:e.iri,isTriple:Boolean(e.isTriple)}})),d=X.tripleNodes.values();for(let e=0;e<X.tripleNodes.size;e++){d.next().value.forEach(e=>{l.push({iri:e.iri,isTriple:e.isTriple})})}const p=_.reject(c,(function(e){return _.some(l,e)}));if(0===p.length)r?i.info("This node either does not exist or has no visible connections. Check your Graph Settings if you expect such."):0===o.length&&i.info("This node either does not exist or has no visible connections. Check your Graph Settings if you expect such."),X.addAndMatchLinks(o),le();else{const t=[],r=[];_.forEach(p,(function(n,i){t.push(u({url:"rest/explore-graph/node",method:"GET",params:{iri:n.isTriple?V(n.iri):n.iri,config:e.configLoaded.id,languages:e.shouldShowSettings()?e.saveSettings.languages:[],includeInferred:e.saveSettings.includeInferred,sameAsState:e.saveSettings.sameAsState}}).then((function(e){r[i]=e.data})))})),f.all(t).then((function(){_.forEach(r,(function(e,t){const i=2*Math.PI*t/r.length,o=(n?n.x:0)+Math.cos(i)*L/3,a=(n?n.y:0)+Math.sin(i)*L/3;e.isTriple?X.addTriple(e,o,a):X.addNode(e,o,a)})),X.addAndMatchLinks(o),n&&(n.isExpanded=!0),le()}))}}function me(t,n,r){if(ce.getLoadingState())return;ce.init(t,r);const o=t.iri;u({url:"rest/explore-graph/links",method:"GET",params:{iri:o,linksLimit:e.saveSettings.linksLimit,includeInferred:e.saveSettings.includeInferred,config:e.configLoaded.id,preferredTypes:e.shouldShowSettings()?e.saveSettings.preferredTypes:[],rejectedTypes:e.shouldShowSettings()?e.saveSettings.rejectedTypes:[],preferredPredicates:e.shouldShowSettings()?e.saveSettings.preferredPredicates:[],rejectedPredicates:e.shouldShowSettings()?e.saveSettings.rejectedPredicates:[],preferredTypesOnly:e.shouldShowSettings()?e.saveSettings.preferredTypesOnly:[],preferredPredicatesOnly:e.shouldShowSettings()?e.saveSettings.preferredPredicatesOnly:[],languages:e.shouldShowSettings()?e.saveSettings.languages:[],sameAsState:e.saveSettings.sameAsState,includeSchema:e.saveSettings.includeSchema}}).then((function(e){ge(e,t,n)}),(function(t){const n=getError(t.data);i.error(n,"Error exploring node"),e.loading=!1,ce.setLoadingState(!1)}))}function ye(){angular.isDefined(fe)&&fe.expandedState&&fe.removeIcons()}function ve(t){oe.stop(),e.openedNodeInfoPanel=t,e.showNodeInfo=!0,e.showFilter=!1,e.showPredicates=!1,e.nodeLabels=t.labels,e.nodeTypes=t.types,e.rdfRank=t.rdfRank,e.nodeIri=t.iri,e.resourceType=t.isTriple?"triple":"uri",e.encodedIri=t.isTriple?encodeURI(V(t.iri)):encodeURI(t.iri),e.showInfoPanel=!0,e.rdfsLabel=t.labels[0].label,e.rdfsComment=t.comment,e.expanded=!1,e.propertiesQueryObj.query="",e.dataNodeKeysQuery="",u.get("rest/explore-graph/properties",{params:{iri:t.isTriple?V(t.iri):t.iri,config:e.configLoaded.id,languages:e.shouldShowSettings()?e.saveSettings.languages:[],includeInferred:e.saveSettings.includeInferred,sameAsState:e.saveSettings.sameAsState,rejectedPredicates:e.shouldShowSettings()?e.saveSettings.rejectedPredicates:[]}}).then((function(t){e.data=_.mapKeys(t.data,(function(t,n){return e.replaceIRIWithPrefix(n)})),e.propertiesObj.items=[],_.forEach(e.data,(function(t,n){e.propertiesObj.items.push({key:n,value:t})})),e.nodeImage=void 0,e.propertiesNotFiltered=e.propertiesObj.items;const n=_.find(e.propertiesObj.items,(function(e){return"image"===e.key}));n&&(e.nodeImage=n.value[0].v),e.propertiesObj.items=_.reject(e.propertiesObj.items,(function(e){return"image"===e.key})),e.propertiesNotFiltered=e.propertiesObj.items}),(function(e){i.warning(getError(e.data),"Error")}))}function xe(e){we("predicate","#d54a33",e),we("predicates","#d54a33",e);let t=document.getElementsByClassName("link");t&&_.each(t,(function(t){let n=t.__data__;(n.source.iri.indexOf(e.iri)>=0||n.target.iri.indexOf(e.iri)>=0)&&(t.style.stroke="#d54a33",t.style.strokeWidth=4)}));let n=document.getElementsByClassName("arrow-marker");n&&_.each(n,(function(t){let n=t.__data__;(n.source.iri.indexOf(e.iri)>=0||n.target.iri.indexOf(e.iri)>=0)&&(t.style.stroke="#d54a33",t.__data__.target.isTriple||t.setAttribute("refX","23"))}))}function we(e,t,n){let r=document.getElementsByClassName(e);r&&_.each(r,(function(e){let r=e.__data__;n?((r.source.iri.indexOf(n.iri)>=0||r.target.iri.indexOf(n.iri)>=0)&&(e.style.fill=t),F(n.iri)===H(r)&&(e.textContent=n.pred,e.style.fill=t),n.oppLinkIRI&&n.oppLinkIRI===H(r)&&(e.textContent=n.oppTriplePred,e.style.fill=t)):(e.style.fill=t,e.textContent=Se(r))}))}function be(){_.each(e.predicates,(function(e){let t=document.getElementById(e.linkId+e.nodeIndex);t&&(t.style.fontWeight="normal")}));let t=document.getElementsByClassName("link");t&&_.each(t,(function(e){e.style.stroke="#999",e.style.strokeWidth=1})),we("predicate",""),we("predicates","");let n=document.getElementsByClassName("arrow-marker");n&&_.each(n,(function(e){e.style.stroke="#999",e.__data__.target.isTriple||e.setAttribute("refX","59")}))}function Ce(e){let t=F(e);if(X.tripleNodes.has(t))return X.tripleNodes.get(t).find(t=>t.iri===e)}function Se(e){return e.predicates.length>1?e.predicates.length+" predicates":Me(e.predicates[0])}function Me(t){const n=e.replaceIRIWithPrefix(t);return n.length===t.length?t.split("/")[t.split("/").length-1]:n}e.toggleSidePanel=function(){e.pageslideExpanded=!e.pageslideExpanded},e.closeInfoPanel=function(){e.pageslideExpanded=!1,e.openedNodeInfoPanel=void 0,e.predicates=[],O=null,s((function(){e.showInfoPanel=!1}))},e.clickLink=function(t){if(X.tripleNodes.has(t.linkId)){be();let n=X.tripleNodes.get(t.linkId)[t.nodeIndex];ve(n),e.showPredicates=!0;let r=document.getElementById(t.linkId+t.nodeIndex);r&&(r.style.fontWeight="bold");let i={};const o=X.tripleLinksCopy.values();for(let e=0;e<X.tripleLinksCopy.size;e++){let e=o.next().value;e.length>1&&e.every(t=>t.source.iri===n.iri?(i.iri=e[0].source.iri,t.target.isTriple&&(i.oppLinkIRI=F(t.target.iri),i.oppTriplePred=Me(t.target.iri.split(" ")[1])),i.pred=Me(n.iri.split(" ")[1]),1===t.predicates.length&&(i.linkPred=t.predicates[0]),!1):t.target.iri!==n.iri||(i.iri=e[0].target.iri,t.source.isTriple&&(i.oppLinkIRI=F(t.source.iri),i.oppTriplePred=Me(t.source.iri.split(" ")[1])),i.pred=Me(n.iri.split(" ")[1]),1===t.predicates.length&&(i.linkPred=t.predicates[0]),!1))}i.iri||(i.iri=n.iri,i.pred=Me(n.iri.split(" ")[1])),xe(i)}},e.splitPredicate=function(e){return e.split("/")[e.split("/").length-1]},e.getActiveRepository=function(){return n.getActiveRepository()},e.isLoadingLocation=function(){return n.isLoadingLocation()},e.hasActiveLocation=function(){return n.hasActiveLocation()},e.rotate=function(e){ye();const t=2*(e?1:-1)*Math.PI/180,n=Math.cos(t),r=Math.sin(t),i=N/2,o=L/2;d3.selectAll(".node-wrapper").each((function(e){e.x=i+(n*(e.x-i)+r*(e.y-o)),e.y=o+(-r*(e.x-i)+n*(e.y-o)),e.fixed&&(e.px=e.x,e.py=e.y)})),oe.resume()},e.openUri=function(t,n){if(!n){const n={};e.configLoaded.id!==e.defaultGraphConfig.id&&(n.config=e.configLoaded.id),n.uri=t,e.pushHistory(n,{uri:t,config:e.configLoaded})}e.$broadcast("onRootNodeChange",t)},e.saveOrUpdateGraph=function(){const t=JSON.stringify(X.copyState()),n={id:e.lastSavedGraphId,name:e.lastSavedGraphName,data:t,shared:e.shared};n.id?e.saveGraphModal("update",n):e.saveGraphModal("new",n)},e.renameSavedGraph=function(t){e.saveGraphModal("rename",{id:t.id,name:t.name,config:t.config,shared:t.shared})};const Te=function(t){w.editSavedGraph(t).success((function(){e.lastSavedGraphName=t.name,e.shared=t.shared,e.refreshSavedGraphs(),i.success("Saved graph "+t.name+" was edited.")})).error((function(e){const t=getError(e);i.error(t,"Error! Cannot edit saved graph")}))};e.saveGraphModal=function(t,n,r){m.open({templateUrl:"js/angular/graphexplore/templates/modal/save-graph.html",controller:"SaveGraphModalCtrl",resolve:{data:function(){return{mode:t,graph:n,graphExists:r,shared:n.shared}}}}).result.then((function(t){if(t.restart)e.saveGraphModal(t.mode,t.graph,!1);else switch(t.mode){case"new":!function(t){e.configLoaded&&(t.config=e.configLoaded.id),w.addNewSavedGraph(t).success((function(n,r,o){e.lastSavedGraphName=t.name,e.lastSavedGraphId=o()["x-saved-graph-id"],e.shared=t.shared,e.refreshSavedGraphs(),i.success("Saved graph "+t.name+" was saved.")})).error((function(n,r){if(422===r)e.saveGraphModal("new",t,!0);else{const e=getError(n);i.error(e,"Error! Cannot create saved graph")}}))}(t.graph);break;case"update":case"rename":Te(t.graph)}}))},e.refreshSavedGraphs=function(){w.getSavedGraphs().success((function(t){e.savedGraphs=t})).error((function(e){const t=getError(e);i.error(t,"Error! Could not get saved graphs")}))},e.loadSavedGraph=function(t,n){t.owner?(e.lastSavedGraphName=t.name,e.lastSavedGraphId=t.id,e.shared=t.shared,e.configLoaded=e.findConfigById(t.config)):(e.lastSavedGraphName=null,e.lastSavedGraphId=null,e.shared=t.shared),e.configLoaded||(e.configLoaded=e.defaultGraphConfig),d.url("?saved="+t.id),X.restoreState(JSON.parse(t.data)),n||e.pushHistory({saved:t.id},{savedGraph:t})},e.copyToClipboardSavedGraph=function(e){P([location.protocol,"//",location.host,location.pathname,"?saved=",e.id].join(""))},e.deleteSavedGraph=function(t){g.openSimpleModal({title:"Confirm",message:"Are you sure you want to delete the saved graph '"+t.name+"'?",warning:!0}).result.then((function(){!function(t){w.deleteSavedGraph(t).success((function(){e.refreshSavedGraphs(),i.success("Saved graph "+t.name+" was deleted.")})).error((function(e){const t=getError(e);i.error(t,"Error! Cannot delete saved graph")}))}(t)}))},e.openIRI=function(t,n){return n.shiftKey?e.$broadcast("onRootNodeChange",t):window.open(t,"_blank"),!1},e.togglePinAllNodes=function(){ye();const t=e.numberOfPinnedNodes<=0;e.numberOfPinnedNodes=0,d3.selectAll(".node").each((function(n){n.fixed=t,t&&e.numberOfPinnedNodes++})),oe.resume()},$("body").on("keydown",(function(t){"input"!==t.target.nodeName&&e.nodeSelected&&(37===t.keyCode?e.rotate(!0):39===t.keyCode&&e.rotate(!1))})),e.getLiteralFromPropValue=function(e){return e.substring(e.indexOf(":")+1)}}function u(e,t,n){switch(e.mode=n.mode,e.graph=angular.copy(n.graph),e.graphExists=n.graphExists,e.mode){case"new":e.title="Create new saved graph",e.okButtonText="Create";break;case"update":e.title="Update saved graph",e.okButtonText="Save";break;case"rename":e.title="Rename saved graph",e.okButtonText="Save"}e.ok=function(){e.form.$valid&&t.close({graph:e.graph,mode:e.mode})},e.saveNew=function(){e.graph.name=e.graph.name+" (new)",t.close({graph:e.graph,mode:"new",restart:!0})},e.cancel=function(){t.dismiss("cancel")}}angular.module("graphdb.framework.graphexplore.controllers.graphviz",["ui.scroll.jqlite","ui.scroll","toastr","ui.bootstrap","ngTagsInput","graphdb.framework.utils.localstorageadapter"]).controller("GraphsVisualizationsCtrl",s).controller("SaveGraphModalCtrl",u).config(["$tooltipProvider",function(e){e.options({appendToBody:!0})}]),s.$inject=["$scope","$rootScope","$repositories","toastr","$timeout","$http","ClassInstanceDetailsService","AutocompleteRestService","$q","$location","$jwtAuth","UiScrollService","ModalService","$modal","$window","LocalStorageAdapter","LSKeys","SavedGraphsRestService","GraphConfigRestService","RDF4JRepositoriesRestService"],u.$inject=["$scope","$modalInstance","data"]},58:function(e,t,n){"use strict";n.r(t);n(31),n(4);function r(e,t,n,r,i,o,a,s,u,c,l,f,d,p,h,g){var m;e.page=1,e.totalPages=5,e.helpHidden=1===h.get(g.HIDE_GRAPH_CONFIG_HELP),e.toggleHelp=function(t){void 0===t&&(t=h.get(g.HIDE_GRAPH_CONFIG_HELP)),1!==t?(h.set(g.HIDE_GRAPH_CONFIG_HELP,1),e.helpHidden=!0):(h.set(g.HIDE_GRAPH_CONFIG_HELP,0),e.helpHidden=!1)},e.fixedVisualCallback=function(t,n){e.newConfig.startIRI=t,e.newConfig.startIRILabel=n,m=!0},e.isDefaultGraph=function(e){return"Minimal"===e.name||"Advanced"===e.name},e.isUserGraph=function(t){return!e.isDefaultGraph(t)},e.getSampleName=function(e,t){const n=e[t+"Description"];return n||(e.id?"Copy of "+e.name:e.name)};const y=function(){c.getGraphConfigSamples().success((function(t){e.samples=_.filter(t,(function(t){return!t.id||e.newConfig.id!==t.id||(e.revertConfig=t,!1)}))})).error((function(e){r.error(getError(e),"Could not get graph configs. You may not see sample values")}))},v=f.configName;function x(e){r.warning(e)}function w(t){let n;return"query"===t.startMode&&1===e.page?n=t.startGraphQuery:2===e.page?n=t.expandQuery:3===e.page?n=t.resourceQuery:4===e.page?n=t.predicateLabelQuery:5===e.page&&(n=t.resourcePropertiesQuery),angular.isDefined(n)?n:""}function b(){function o(){e.getAutocompletePromise=l.checkAutocompleteStatus()}y(),e.createGraphConfig=function(){c.createGraphConfig(e.newConfig).success((async function(){await d.showToastMessageWithDelay("Saved new graph config"),n.url("graphs-visualizations")})).error((function(e){r.error(getError(e),"Error! Could not create graph config")}))},e.updateGraphConfig=function(){c.updateGraphConfig(e.newConfig).success((async function(){await d.showToastMessageWithDelay("Graph config saved"),n.url("graphs-visualizations")})).error((function(e){r.error(getError(e),"Error! Could not save graph config")}))},e.$on("autocompleteStatus",(function(){o()})),o(),e.getNamespacesPromise=p.getNamespaces(e.getActiveRepository());const a=function(e,t,n,r,i,o){t?c.validateQuery(t,n,r,i,o).success((function(){e()})).error((function(e){x(getError(e))})):e()};function s(){u()&&e.$broadcast("addStartFixedNodeAutomatically",{startIRI:e.newConfig.startIRI})}function u(){return 1===e.page&&"node"===e.newConfig.startMode}e.validateCurrentPage=function(t){e.updateModel(),1===e.page?"node"!==e.newConfig.startMode||e.newConfig.startIRI?"query"!==e.newConfig.startMode||e.newConfig.startGraphQuery?"query"===e.newConfig.startMode?a(t,e.newConfig.startGraphQuery,"graph"):t():x("Please provide start graph query."):x("Please select start node."):2===e.page?a(t,e.newConfig.expandQuery,"construct",["node"]):3===e.page?a(t,e.newConfig.resourceQuery,"tuple",["node"],[],["type","label","comment","rank"]):4===e.page?a(t,e.newConfig.predicateLabelQuery,"tuple",["edge"],["label"]):5===e.page&&a(t,e.newConfig.resourcePropertiesQuery,"tuple",["node"],["property","value"])},e.goToPage=function(t){e.page!==t&&e.validateCurrentPage((function(){e.showEditor(),e.page=t,e.notoolbar=1!==e.page}))},e.goToPreviousPage=function(){e.page>1&&e.goToPage(e.page-1),u()&&(m=!1)},e.goToNextPage=function(){s(),m&&e.goToPage(e.page+1)},e.saveGraphConfig=function(){s(),u()&&!m||(e.newConfig.startQueryIncludeInferred=e.currentQuery.inference,e.newConfig.startQuerySameAs=e.currentQuery.sameAs,e.validateCurrentPage((function(){e.newConfig.name?e.isUpdate?e.updateGraphConfig(e.newConfig):e.createGraphConfig(e.newConfig):x("Please provide config name.")})))},e.updateModel=function(){const t=window.editor.getValue().trim();"query"===e.newConfig.startMode&&1===e.page?e.newConfig.startGraphQuery=t:2===e.page?e.newConfig.expandQuery=t:3===e.page?e.newConfig.resourceQuery=t:4===e.page?e.newConfig.predicateLabelQuery=t:5===e.page&&(e.newConfig.resourcePropertiesQuery=t)},e.setQuery=function(e){window.editor.setValue(e||" ")},e.updateDirty=function(){if(e.revertConfig){const t=w(e.revertConfig),n=window.editor.getValue().trim();e.queryEditorIsDirty=t!==n}},e.updateEditor=function(){t((function(){e.currentQuery.query=w(e.newConfig),i.isActiveRepoOntopType()&&(e.nocount=!0),e.currentQuery.inference=e.newConfig.startQueryIncludeInferred,e.currentQuery.sameAs=e.newConfig.startQuerySameAs,L(e.currentQuery.id),R(e.currentQuery.id)}),100)},e.showEditor=function(){window.editor&&window.editor.xhr&&window.editor.xhr.abort(),e.viewMode="yasr"},e.showPreview=function(){e.currentQuery.outputType="table",e.runQuery()},e.revertEditor=function(){e.setQuery(w(e.revertConfig))},e.$watch("newConfig.startMode",(function(n){"query"===n&&t((function(){e.updateEditor()}),0)})),e.$watch("page",(function(n){("query"===e.newConfig.startMode||n>1)&&t((function(){e.showEditor(),e.updateEditor()}),0)}))}e.newConfig={startQueryIncludeInferred:!0,startQuerySameAs:!0},e.newConfig.startMode="search",e.isUpdate=!1,e.shared=!1,e.encodeQuery=function(e){return encodeURIComponent(e)},v?(e.isUpdate=!0,c.getConfig(v).success((function(t){e.newConfig=t,b()})).error((function(e){r.error(getError(e),"Could not load config for name "+v)}))):(e.isUpdate=!1,b());const C={id:"1",name:"",query:"select * where { \n\t?s ?p ?o .\n} limit 100 \n",inference:e.newConfig.startQueryIncludeInferred,sameAs:e.newConfig.startQuerySameAs};e.resetCurrentTabConfig=function(){e.currentTabConfig={pageSize:100,page:1,allResultsCount:0,resultsCount:0}},e.queryExists=!1,e.resetCurrentTabConfig(),e.tabsData=e.tabs=[C],e.saveTab=function(t){const n=function(t){for(let n=0;n<e.tabsData.length;n++){if(e.tabsData[n].id===t)return n}}(t);if(void 0===n)return{};const r=e.tabsData[n];return e.saveQueryToLocal(r),r},e.loadTab=L,e.addNewTab=function(e,t,n){},e.runQuery=k,e.getNamespaces=A,e.changePagination=function(){k(!0,e.explainRequested)},e.toggleSampleQueries=function(){},e.addKnownPrefixes=I,e.getExistingTabId=N,e.querySelected=function(t){const n=N(t);e.toggleSampleQueries(),angular.isDefined(n)?R(n):e.addNewTab(null,t.name,t.body)},e.saveQueryToLocal=S,e.setLoader=M,e.getLoaderMessage=function(){const t=(Date.now()-e.queryStartTime)/1e3,n=e.getHumanReadableSeconds(t);let r="";r=e.progressMessage?e.progressMessage+"... "+n:"Running operation..."+n;e.extraMessage&&t>10&&(r+="\n"+e.extraMessage);return r},e.fixSizesOnHorizontalViewModeSwitch=T,e.changeViewMode=function(n){e.viewMode="none",e.orientationViewMode=!e.orientationViewMode,T(),$(".dataTables_filter").remove(),$(".resultsTable").remove(),t((function(){L(n),R(n)}),100)},e.showHideEditor=E,e.focusQueryEditor=function(){angular.element(document).find(".editable-input").is(":focus")||angular.element(document).find(".CodeMirror textarea:first-child").focus()},e.orientationViewMode=!0;e.getActiveRepository();function S(e){}function M(t,n,r){const i=angular.element(document.getElementById("yasr-inner"));e.queryIsRunning=t,t?(e.queryStartTime=Date.now(),e.countTimeouted=!1,e.progressMessage=n,e.extraMessage=r,i.addClass("hide")):(e.progressMessage="",e.extraMessage="",i.removeClass("hide")),null===e.$$phase&&e.$apply()}function T(n){function r(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0}const i=n;if(e.orientationViewMode){if("yasr"===e.viewMode){let e=r()-document.querySelector(".CodeMirror-wrap").getBoundingClientRect().top;e-=40,document.querySelector(".CodeMirror-wrap").style.height=e+"px"}else e.noPadding={},document.querySelector(".CodeMirror-wrap").style.height="";document.getElementById("yasr").style.minHeight=""}else if(e.noPadding={paddingRight:15,paddingLeft:0},window.editor&&document.querySelector(".CodeMirror-wrap")){let e=r()-document.querySelector(".CodeMirror-wrap").getBoundingClientRect().top;e-=40,document.querySelector(".CodeMirror-wrap").style.height=e+"px",document.getElementById("yasr").style.minHeight=e+"px"}else{let n;n=t(i?function(){e.fixSizesOnHorizontalViewModeSwitch(i)}:e.fixSizesOnHorizontalViewModeSwitch,100),e.$on("$destroy",(function(){t.cancel(n)}))}window.yasr&&window.yasr.container&&t((function(){window.yasr.container.resize()}),100)}function E(){T(!0)}function R(e){t((function(){$('a[data-id = "'+e+'"]').tab("show")}),0)}function k(t,n){e.executedQueryTab=e.currentQuery,n&&"SELECT"!==window.editor.getQueryType()&&"CONSTRUCT"!==window.editor.getQueryType()?r.warning("Explain only works with SELECT or CONSTRUCT queries."):"update"!==window.editor.getQueryMode()?(e.explainRequested=n,e.queryIsRunning||(t?e.currentTabConfig.resultsCount=0:e.resetCurrentTabConfig(),e.viewMode="editor",e.orientationViewMode&&e.fixSizesOnHorizontalViewModeSwitch(),M(!0,"Evaluating query"),window.editor.query())):r.warning("Cannot execute updates from this editor.")}function A(){M(!0,"Refreshing namespaces","Normally this is a fast operation but it may take longer if a bigger repository needs to be initialised first."),p.getRepositoryNamespaces().success((function(t){const n={};t.results.bindings.forEach((function(e){n[e.prefix.value]=e.namespace.value})),e.namespaces=n})).error((function(t){e.repositoryError=getError(t)})).finally((function(){M(!1)}))}function I(){s.addKnownPrefixes(JSON.stringify(window.editor.getValue())).success((function(e){angular.isDefined(window.editor)&&angular.isDefined(e)&&e!==window.editor.getValue()&&window.editor.setValue(e)})).error((function(e){let t=getError(e);return r.error(t,"Error! Could not add known prefixes"),!0}))}function N(t){let n=void 0;return angular.forEach(e.tabsData,(function(e){if(e.name===t.name&&e.query===t.body)return n=e.id,e})),n}e.orientationViewMode||E(),e.getActiveRepository()&&A(),e.$on("$destroy",(function(){window.editor=null,window.yasr=null})),$("textarea").on("paste",(function(){t((function(){I()}),0)})),e.$watchCollection("[currentQuery.inference, currentQuery.sameAs]",(function(){e.currentQuery}));function L(n){e.tabsData=[e.currentQuery];let r=e.currentQuery;null==e.currentQuery.query||""===e.currentQuery.query?window.editor.setValue(" "):window.editor.setValue(e.currentQuery.query),t((function(){e.currentTabConfig={},e.currentTabConfig.queryType=r.queryType,e.currentTabConfig.resultsCount=r.resultsCount,e.currentTabConfig.offset=r.offset,e.currentTabConfig.allResultsCount=r.allResultsCount,e.currentTabConfig.page=r.page,e.currentTabConfig.pageSize=r.pageSize,e.currentTabConfig.timeFinished=r.timeFinished,e.currentTabConfig.timeTook=r.timeTook,e.currentTabConfig.sizeDelta=r.sizeDelta,e.$apply()}),0),$("#yasr").css("padding","0")}function D(e){return $(e).attr("data-id")}e.$on("tabAction",(function(t,n){n.relatedTarget&&e.saveTab(D(n.relatedTarget)),e.loadTab(D(n.target))})),e.$on("deleteAllexeptSelected",(function(t,n){e.tabsData=n,e.tabs=n})),e.currentQuery=angular.copy(C),e.showSampleQueries=!1,e.savedQuery={},e.sampleQueries={},e.getResultsDescription=function(){},e.getUpdateDescription=function(){},e.getStaleWarningMessage=function(){}}angular.module("graphdb.framework.graphexplore.controllers.graphviz.config",["graphdb.framework.utils.notifications","graphdb.framework.utils.localstorageadapter"]).controller("GraphConfigCtrl",r),r.$inject=["$scope","$timeout","$location","toastr","$repositories","$modal","ModalService","SparqlRestService","$filter","GraphConfigRestService","AutocompleteRestService","$routeParams","Notifications","RDF4JRepositoriesRestService","LocalStorageAdapter","LSKeys"]},59:function(e,t,n){"use strict";n.r(t);var r=n(209),i=n.n(r),o=n(215),a=n(206),s=n(207);n(4);function u(e,t,n,r,u,c,l,f,d,p,h){return{restrict:"AE",template:'<div id="classChart"></div>',scope:{classHierarchyData:"=",flattenedClassNames:"=",selectedClass:"=",currentSliderValue:"=",showClassInfoPanel:"=",showExternalElements:"=",hidePrefixes:"=",currentBrowserLimit:"="},link:function(g,m,y){!function(g,m){var y=800,v=800,x=v,w=20,b=d3.layout.pack().size([x-w,x-w]).value((function(e){return e.size})),C=d3.scale.linear().domain([0,4]).range(["hsl(19, 70%, 90%)","hsl(19, 70%, 50%)"]).interpolate(d3.interpolateHcl),S=d3.select("#classChart").insert("svg:svg","h2").attr("viewBox","0 0 "+y+" "+v).attr("preserveAspectRatio","xMidYMid meet").on("dblclick.zoom",null);function M(){return S.append("svg:g").attr({id:"main-group",transform:"translate("+y/2+","+v/2+")"})}function T(){return"true"===p.get(h.CLASS_HIERARCHY_HIDE_PREFIXES)}function E(){var e=s.a.Export.getCSSRules("css/rdf-class-hierarchy-labels.css?v=1.11.2");d3.selectAll("#main-group").append("defs"),$("defs").append('<style type="text/css"><![CDATA['+e+"]]></style>"),d3.selectAll("g").style("opacity",1);var t=s.a.Export.generateBase64ImageSource();d3.select(this).attr({href:t,download:"class-hierarchy-"+c.getActiveRepository()+".svg"})}g.hidePrefixes=T();var R,k,A=M();if(!g.classHierarchyData.classCount&&c.getActiveRepository()&&!c.isSystemRepository()){e.loader=!0,e.hierarchyError=!1;const t=p.get(`classHierarchy-selectedGraph-${c.getActiveRepository()}`);n.getClassHierarchyData(null!==t?t.contextID.uri:"").success((function(t,n,r){e.loader=!1,207===n&&l.warning("You can update the diagram by pressing the reload button.","Repository data has changed"),g.classHierarchyData=t,d3.select("#download-svg").on("mouseover",E)})).error((function(t){e.loader=!1,e.hierarchyError=getError(t),l.error("Request for "+d+" failed! "+getError(t))}))}var I,N,L,D,O,P,q,z,U={};function j(n,s,c,l){L&&L(),D&&D(),d3.selectAll("#main-group").remove(),A=M(),o.a.SingleChild.addPlaceholders(n,!0),N=c||n;var p,h=b.nodes(n);N.isInFocusTransitive=!0,o.a.SingleChild.removePlaceholders(h),o.a.SingleChild.centerNodes(h),o.a.SingleChild.makePositionsRelativeToZero(h);var m=i()().attr("class","d3-tip").customPosition((function(e){return{top:"inherit",bottom:r.innerHeight-d3.event.clientY+"px",right:r.innerWidth-d3.event.clientX+"px"}})).html((function(e){return e.name}));S.call(m);var y=A.selectAll("circle").data(h).enter().append("g");s.doFade&&y.each((function(e){a.a.Transition.fadeIn(d3.select(this),550)}));var v,T=[],E=y.append("circle").attr("class",(function(e){return e.role})).style("fill",(function(e){return e.children?C(e.depth):"#E0D0D0"})).each((function(e){if(e.circle=d3.select(this),e.name!==d){var t=e.name;T.push({name:t}),U[[t]]=e,e.circle.classed("rdf-class",!0),e.circle.on("mouseover",(function(){s.noPrefixes?m.show(e):e.textHidden?m.show(e):m.hide(e)})),e.circle.on("mouseout",m.hide)}}));function $(e){d3.selectAll(".selected").classed("selected",e.selected=!1),e.circle.classed("selected",e.selected=!0),v=e}function O(){g.showClassInfoPanel=!1}T&&(T=_.uniqBy(T,"name"),g.flattenedClassNames=T);var P=a.a.Click.delayDblClick();d3.selectAll(".parent, .topLevelParent, .child, .root").call(P);k=function(e){V(e),e.name===d?(O(),d3.selectAll(".selected").classed("selected",!1)):($(e),g.selectedClass=v,g.showClassInfoPanel=!0,g.$on("sidePanelClosed",(function(t){d3.selectAll(".selected").classed("selected",e.selected=!1)})))},P.on("click",(function(e){e.id&&r.history.pushState({id:e.id},"classHierarchyPage"+e.id,"hierarchy#"+e.id),m.hide(),k(e)})),P.on("dblclick",(function(t){t!==n&&(m.hide(),$(t),e.$broadcast("goToDomainRangeGraphView",v,N),d3.event.stopPropagation())}));var q=0;S.on("wheel",(function(){m.hide();var e=d3.event;e.preventDefault(),e.stopPropagation();var t=(new Date).getTime();if(t-q>100){q=t;var n="";e.deltaY<=-1?n="in":e.deltaY>=1&&(n="out");var i=e.target.__data__;if(i||(i=N),"in"===n){if(i!==N){for(;i.parent&&!i.parent.isInFocusTransitive;)i=i.parent;i.depth<N.depth&&(i=N)}if(i===N&&i.children){for(var o=i.children[0],a=1;a<i.children.length;a++)i.children[a].sortingRank>o.sortingRank&&(o=i.children[a]);i=o}V(i,!0)}else"out"===n&&(i=N.parent)&&V(i,!0);N.name===d&&r.history.replaceState({id:1},"classHierarchyPage1","hierarchy#1"),Q()}}));var z=A.selectAll("text").data(h).enter().append("text").attr("class",(function(e){return e.children&&e.children.length?"label":"label child-label"})).each((function(e){e.textSel=d3.select(this)}));s.noPrefixes?(I!==n&&(z.each((function(e){var t=e.name.indexOf(":");e.name.indexOf("http://")>-1?e.noPrefixName=e.name:t>-1&&(e.noPrefixName=e.name.substring(t+1))})),I=n),z.style("font-size",(function(e){return a.a.Text.calcFontSize(e.noPrefixName,e.r)})).text((function(e){return a.a.Text.getTextWithElipsisIfNeeded(e.noPrefixName,e.r/3)}))):z.style("font-size",(function(e){return a.a.Text.calcFontSize(e.name,e.r)})).text((function(e){return a.a.Text.getTextWithElipsisIfNeeded(e.name,e.r/3)})),z.style("display",(function(e){return e.parent===n?(e.textHidden=this.textContent.indexOf("...")+3===this.textContent.length,null):(e.textHidden=!0,"none")})),s.doFade&&!s.keepPrevState&&z.each((function(e){a.a.Transition.fadeIn(d3.select(this),550)})),R=function(){function e(e){e&&E.each((function(t){e==t.id&&k(t)}))}var n=t.hash();r.onpopstate=function(t){t.state&&e(t.state.id)},e(n)};var j=A.selectAll("circle, text");function F(e,t){var n=x/e[2];p=e,j.attr("transform",(function(t){return"translate("+(t.x-e[0])*n+","+(t.y-e[1])*n+")"})),E.attr("r",(function(e){return e.r*n})),t&&z.each((function(e){e.fullName!==N.topLevelParentUri&&N.topLevelParentUri!==d||(e.textSel.style("display","none"),N.children&&N.children.length?_.each(N.children,(function(e){e.textSel.style("display","inline")})):N.textSel.style("display","inline"),N.parent&&_.each(N.parent.children,(function(e){e.name!==N.name&&e.textSel.style("display","inline")})))})),z.style("font-size",(function(e){return s.noPrefixes?a.a.Text.calcFontSize(e.noPrefixName,e.r*n):a.a.Text.calcFontSize(e.name,e.r*n)})).text((function(e){return s.noPrefixes?a.a.Text.getTextWithElipsisIfNeeded(e.noPrefixName,e.r*n/3):a.a.Text.getTextWithElipsisIfNeeded(e.name,e.r*n/3)}))}function H(e){var t=2*e+w;return 2*e/t<.3&&(t=2*e+2),t}function G(e){!e.isInFocusTransitive&&e.parent&&e.parent.isInFocusTransitive||(e.textHidden=!0,this.style.display="none")}function B(e){!e.isInFocusTransitive&&e.parent&&e.parent.isInFocusTransitive&&(e.textHidden=this.textContent.indexOf("...")+3===this.textContent.length,this.style.display="")}function V(e,t){if(u((function(){g.showExternalElements=e.name===d})),e.id&&r.history.replaceState({id:e.id},"classHierarchyPage"+e.id,"hierarchy#"+e.id),N!==e){if(t&&(O(),d3.selectAll(".selected").classed("selected",!1)),N.parent)for(var n=N;n;)n.isInFocusTransitive=!1,n=n.parent;for(n=e;n;)n.isInFocusTransitive=n.children,n=n.parent;if(2*(N=e).r/(2*N.r+w)<.3||g.currentSliderValue>g.currentBrowserLimit)F([N.x,N.y,H(N.r)]),z.each((function(e){G.call(this,e),B.call(this,e)}));else d3.transition().duration(f).tween("zoom",(function(e){var t=d3.interpolateZoom(p,[N.x,N.y,H(N.r)]);return function(e){F(t(e))}})).selectAll("text").each("start",G).each("end",B)}}F([N.x,N.y,H(N.r)],l),L=g.$on("rootFocus",(function(){r.history.pushState({id:1},"classHierarchyPage1","hierarchy#1"),k(n)})),D=g.$on("classSearch",(function(e){k(e)}))}function Q(){var t=g.classHierarchyData.classCount;let n=p.get(h.CLASS_HIERARCHY_CURRENT_SLIDER_VALUE);(!n||n>t)&&(n=t,p.set(h.CLASS_HIERARCHY_CURRENT_SLIDER_VALUE,n)),e.$broadcast("classCount",t,n)}window.addEventListener("resize",Q),window.addEventListener("beforeunload",(function e(){window.removeEventListener("resize",Q),window.removeEventListener("beforeunload",e)})),g.$watch("classHierarchyData",(function(){O&&O(),P&&P(),q&&q(),z&&z();var e=T();if(g.classHierarchyData.classCount){Q();var t=angular.copy(g.classHierarchyData);var n,r,i=function(e){return b.nodes(e).sort((function(e,t){return e.sortingRank>t.sortingRank?-1:e.sortingRank<t.sortingRank?1:e.depth>t.depth?1:e.depth<t.depth?-1:0}))}(t);function o(e,t){var i={keepPrevState:!0,noPrefixes:T()};r=i.noPrefixes,j(n||e,i,N,!0),u((function(){p.set(h.CLASS_HIERARCHY_SWITCH_PREFIXES,t),R()}),70)}function a(e,i,a){if(e){p.set(h.CLASS_HIERARCHY_CURRENT_SLIDER_VALUE,e),n={name:d,children:[]};for(var s=new Set,u=1;u<=e;u++)s.add(i[u].id),i[u].parent===i[0]&&n.children.push(i[u]);if(function e(t){if(t.children){for(var n=[],r=0;r<t.children.length;r++)s.has(t.children[r].id)&&n.push($.extend({},t.children[r]));t.children=n;for(r=0;r<t.children.length;r++)e(t.children[r])}}(n),a)r=angular.isUndefined(r)?T():r,j(n,{noPrefixes:r});else o(t)}}var s,c=p.get(h.CLASS_HIERARCHY_CURRENT_SLIDER_VALUE);if(c)a(c,i);else{var l={doFade:!0,keepPrevState:!0,noPrefixes:T()};j(t,l),R()}O=g.$watch("hidePrefixes",(function(n){angular.isUndefined(n)||e?e=void 0:u((function(){!function(e){angular.isUndefined(e)||p.set(h.CLASS_HIERARCHY_HIDE_PREFIXES,e)}(n),o(t,!0)}),50)}),!0),P=g.$watch("currentSliderValue",(function(e){a(e,i,!0)}),!0),z=g.$on("onEnterKeypressSearchAction",(function(e){s&&k(s)})),q=g.$on("searchedClass",(function(e,t){(s=U[t.name])&&k(s)}))}}),!0)}(g)}}}angular.module("graphdb.framework.graphexplore.directives.class",["graphdb.framework.graphexplore.controllers.class","graphdb.framework.utils.localstorageadapter"]).constant("ZOOM_DURATION",500).constant("ROOT_OBJ_NAME","RDF Class Hierarchy").directive("rdfClassHierarchy",u),u.$inject=["$rootScope","$location","GraphDataRestService","$window","$timeout","$repositories","toastr","ZOOM_DURATION","ROOT_OBJ_NAME","LocalStorageAdapter","LSKeys"]},60:function(e,t,n){"use strict";n.r(t);var r=n(207),i=n(206);n(4);function o(e,t,n,o,a,s,u,c,l,f,d,p,h){return{restrict:"AE",template:'<div id="domain-range"></div>',scope:{showPredicatesInfoPanel:"=",selectedPredicate:"=",collapseEdges:"="},link:function(f){const d=c((function(){!function(f){d3.selection.prototype.moveToFront=function(){return this.each((function(){d3.select(this.parentNode.appendChild(this))}))},d3.selection.prototype.moveToBack=function(){return this.each((function(){const e=this.parentNode.firstChild;e&&this.parentNode.insertBefore(this,e)}))};var d=1200,g=d/18,m=d/110,y=m/2,v=d/90,x=d/1e3,w=d/600,b=d3.layout.force().size([d,600]).charge(-900),C=b.drag().on("dragstart",(function(e){d3.select(this).classed("selected",e.selected=!0)})),S=d3.select("#domain-range").append("svg").attr("viewBox","0 0 "+d+" 600").attr("preserveAspectRatio","xMidYMid meet").on("dblclick.zoom",null),M=S.append("defs");M.append("marker").attr({id:"arrow",viewBox:"0 -5 10 10",refX:10,refY:0,markerUnits:"strokeWidth",markerWidth:5,markerHeight:5,orient:"auto",fill:p}).append("path").attr({d:"M0,-5L10,0L0,5",class:"arrowHead"}),M.append("marker").attr({id:"collapsed-arrow",viewBox:"0 -5 10 10",refX:9,refY:0,markerUnits:"strokeWidth",markerWidth:4,markerHeight:4,orient:"auto",fill:p}).append("path").attr({d:"M0,-5L10,0L0,5",class:"arrowHead"}),M.append("marker").attr({id:"arrow-loop",viewBox:"0 -5 10 10",refX:7,refY:0,markerUnits:"strokeWidth",markerWidth:5,markerHeight:5,orient:"auto",fill:p}).append("path").attr({d:"M0,-5L10,0L0,5",class:"arrowHead"}),d3.select("#download-svg").on("mouseover",(function(){var e=r.a.Export.getCSSRules("css/domain-range-graph.css?v=1.11.2");$("defs").append('<style type="text/css"><![CDATA['+e+"]]></style>");var t=r.a.Export.generateBase64ImageSource();d3.select(this).attr({href:t,download:"domain-range-graph-"+n.getActiveRepository()+".svg"})}));var T=d/7,_=1.2*T,E=d3.select(".legend-container").append("svg").attr("viewBox","0 0 "+T+" "+_).attr("preserveAspectRatio","xMidYMid meet");E.append("rect").attr({width:T,height:_}).style("fill","rgba(235, 235, 235, 0.9)");var R=d/75,k=d/40,A=R+g/2.5,I=k,N=A+d/90,L=v/1.1,D=k,O=(E.append("circle").attr({class:"legend-class-node",cx:(R+A)/2,cy:D,r:g/4.5}),I+d/370);E.append("text").attr({x:N,y:O}).style("font-size",L+"px").text("main class node");var P=D+d/30;E.append("circle").attr({class:"legend-object-node",cx:(R+A)/2,cy:P,r:m/1.25});var q=O+d/30;E.append("text").attr({x:N,y:q}).style("font-size",L+"px").text("class node");var z=P+d/45;E.append("circle").attr({class:"legend-datatype-node",cx:(R+A)/2,cy:z,r:y});var U=q+d/45;E.append("text").attr({x:N,y:U}).style("font-size",L+"px").text("datatype node");var j=z+d/45;d3.select(".legend-class-node");E.append("line").attr({class:"property-arrow",x1:R,y1:j,x2:A,y2:j}).style("stroke-width",x).attr("marker-end","url("+a.absUrl()+"#arrow)"),E.append("text").attr({x:N,y:j+d/370}).style("font-size",L+"px").text("explicit property");var Q=j+d/45;E.append("line").attr({class:"implicit-property-arrow",x1:R,y1:Q,x2:A,y2:Q}).style("stroke-width",x).attr("marker-end","url("+a.absUrl()+"#arrow)"),E.append("text").attr({x:N,y:Q+d/370}).style("font-size",L+"px").text("implicit property");var F=Q+d/45;E.append("line").attr({class:"collapsed-property-arrow",x1:R,y1:F,x2:A,y2:F}).style("stroke-width",w).attr("marker-end","url("+a.absUrl()+"#collapsed-arrow)"),E.append("text").attr({x:N,y:F+d/370}).style("font-size",L+"px").text("collapsed property");var H=S,G=a.search().uri,B=a.search().name,V=a.search().collapsed;o.getDomainRangeData(G,V).success((function(e,t,n){f.domainRangeGraphData=e})).error((function(e){l.error("Request for "+B+" failed!")})),$(window).on("popstate",(function(){s.set(u.DOMAIN_RANGE_WENT_BACK,!0)})),t.onpopstate=function(t){t.state&&e.$broadcast("changeCollapsedEdgesState",t.state.collapsed)},f.$watch("collapseEdges",(function(){angular.isUndefined(f.collapseEdges)||(s.set(u.DOMAIN_RANGE_COLLAPSE_EDGES,f.collapseEdges),"true"!==s.get(u.DOMAIN_RANGE_WENT_BACK)&&function(t){e.$broadcast("switchEdgeMode",{uri:G,name:B,collapsed:t})}(f.collapseEdges),s.remove(u.DOMAIN_RANGE_WENT_BACK))})),f.$watch("domainRangeGraphData",(function(){if(f.domainRangeGraphData){var n=angular.copy(f.domainRangeGraphData);b.nodes(n.nodes).links(n.links);var r=H.selectAll(".link").data(n.links).enter().append("g");function o(e){e.style("stroke",p),e.style("stroke-width",w),e.attr("marker-end","url("+a.absUrl()+"#collapsed-arrow)")}var s,u,l=0;r.each((function(e){if(e.objectPropNodeClassUri!==G)s=r.append("line").attr({class:"link","marker-end":"url("+a.absUrl()+"#arrow)"}).style("stroke-width",x).each((function(e){switch(e.propertyType){case"objectLeft":e.targetRadius=g;break;case"objectRight":e.targetRadius=m;break;case"datatype":e.targetRadius=y;break;default:e.targetRadius=0}var t=d3.select(this);e.targetNodeEdgeCount>1?o(t):e.implicit&&t.style("stroke-dasharray","3, 3")}));else{if(angular.isUndefined(u)){var t=g/2;u=d3.select(this).append("path").attr({d:"M 0 0 A "+t+" "+t+" 0 1 1 0 "+t,class:"loop-link",fill:"none","marker-end":"url("+a.absUrl()+"#arrow-loop)"}).style("stroke-width",x)}(l+=e.targetNodeEdgeCount)>1&&o(d3.select(".loop-link"))}}));var S={};function M(){$.isEmptyObject(S)||(S.text.style("fill","black"),S.background.style("fill","#f0f0f0"))}function T(e){M(),S.text=d3.select(this),S.background=d3.select(this.previousSibling),S.text.style("fill","white"),S.background.style("fill",p),c((function(){f.showPredicatesInfoPanel=!0,f.selectedPredicate=e})),d3.event.stopPropagation()}$("document").ready((function(){$("#domain-range").bind("click",M)}));var _=r.append("text").attr("class",(function(e){return e.objectPropNodeClassUri===G?"loop-link-property-name":"property-name"})).attr("dx",(function(e){return g/2*("objectLeft"===e.propertyType?1:-1)})).style("text-anchor",(function(e){return"objectLeft"===e.propertyType?"end":"start"})).style("font-size",v).text((function(e){return e.targetNodeEdgeCount>1?e.targetNodeEdgeCount+" predicates":e.name}));_.each((function(e){var n=d3.select(this);/\d\spredicates/.test(n.text())?n.style("font-weight","bold").on("click",T):n.on("click",(function(e){t.open("resource?uri="+encodeURIComponent(e.uri),"_blank")}))}));var E=d/600,R=r.append("rect").attr("class",(function(e){return e.objectPropNodeClassUri!==G?"link-background":"loop-link-background"})).attr("width",(function(e){return e.calculatedWidth=this.previousSibling.getBBox().width,e.calculatedWidth+2*E})).attr("height",(function(e){return e.calculatedHeight=this.previousSibling.getBBox().height,e.calculatedHeight+E})).attr("transform",(function(e){var t=E-g/2*("objectLeft"===e.propertyType?1:-1);return"objectLeft"===e.propertyType&&(t+=e.calculatedWidth),"translate(-"+t+",-"+(E+e.calculatedHeight/2)+")"})).on("click",(function(e){d3.event.stopPropagation()})),k=H.selectAll(".node").data(n.nodes).enter().append("g"),A=k.filter((function(e){return e.objectPropClassUri!==G})).append("circle").each((function(e){var t=d3.select(this);"main"===e.classPosition?t.attr({class:"class-node",r:g}).attr("marker-end","url("+a.absUrl()+"#loop-link)"):null===e.objectPropClassName?t.attr({class:"datatype-node",r:y}):t.attr({class:"object-prop-node",r:m})})).call(C);d3.selectAll(".object-prop-node").on("dblclick",(function(t,n){f.$apply((function(){e.$broadcast("reloadDomainRangeGraphView",t,n)}))})),k.filter((function(e){return e.objectPropClassName&&e.objectPropClassUri!==G})).append("text").attr("class",(function(e){return e.classPosition+"-class-label"})).style("font-size",v).text((function(e){return e.objectPropClassName})).on("click",(function(e){t.open("resource?uri="+encodeURIComponent(e.objectPropClassUri),"_blank")}));var I=k.select("text");H.select(".class-node").each((function(){d3.select(this.parentNode).append("text").attr("class","rdf-class-label").style("font-size",(function(e){return i.a.Text.calcFontSize(B,g)})).text(B).on("click",(function(e){t.open("resource?uri="+encodeURIComponent(G),"_blank")}))}));var N=H.select(".class-node + text"),L=d3.select(".class-node"),D=d3.selectAll(".loop-link-background"),O=d3.selectAll(".loop-link-property-name");if(_=d3.selectAll(".property-name"),!angular.isUndefined(u)){var P=[];D.each((function(e,t){d3.select(this);P.push({idx:t,width:e.calculatedWidth,height:e.calculatedHeight})}))}b.on("tick",(function(e){var t=8*e.alpha;function n(e){var t=e.x+2*g,n=e.y-g/1.9;var r=[];D.each((function(i,o){r.push(i),o<h?function(r,i){var o=$.grep(P,(function(e){return e.idx==i}));i>0&&(t+=parseFloat(i*(o[0].height/(i/1.4)))),r.attr({transform:"rotate(270, "+e.x+","+e.y+") translate("+t+","+n+")",width:o[0].height,height:o[0].width})}(d3.select(this),o):d3.select(this).remove()})),function(e){var t;d3.select(".view-more-preds-label").style("font-weight","bold").each((function(n){n.target.allEdges=e,t=this.getComputedTextLength()})).on("click",T),d3.select(".view-more-preds-rect").attr("height",t+2*E)}(r)}s.filter((function(e){return e.objectPropNodeClassUri!==G})).attr("x1",(function(e){return e.source.x})).attr("y1",(function(e){return e.source.y})).attr("x2",(function(e){return e.targetX})).attr("y2",(function(e){return e.targetY})).each((function(e){!function(e){"objectLeft"===e.propertyType?(e.source.x-=8*t,e.source.y-=t/9):(e.target.x+=8*t,e.target.y-=t/9)}(e);var n=Math.atan2(e.target.y-e.source.y,e.target.x-e.source.x);e.targetX=e.target.x-Math.cos(n)*e.targetRadius,e.targetY=e.target.y-Math.sin(n)*e.targetRadius})),A.each((function(e){"main"!==e.classPosition||angular.isUndefined(u)||(!function(e){var t=e.x+.96*g,n=e.y-g/5.7-5;u.attr("transform","rotate(270, "+e.x+","+e.y+") translate("+t+","+n+")")}(e),function(e){function t(t,n){var r=$.grep(P,(function(e){return e.idx==n})),i=0;n>0&&(i=parseFloat(2*n*(r[0].height/1.4)));var o=e.x,a=e.y-2.1*g-i;t.attr({x:o,y:a}).moveToFront()}O.each((function(e,n){var r=d3.select(this),i=O.size()-h;i<0?t(r,n):(0==n&&!f.collapseEdges&&i>1&&(!function(e,t,n){e.classed("view-more-preds-label",!0).text(n+" predicates more ..."),null!==this.nextSibling&&t.classed("view-more-preds-rect",!0)}(r,d3.select(this.nextSibling),i),t(r,n)),n<h?t(r,n):r.remove())}))}(e),n(e)),e.objectPropClassUri!==G&&d3.select(this).attr("cx",(function(e){return"main"===e.classPosition?function(e){!window.ActiveXObject&&"ActiveXObject"in window&&(Math.log10=function(e){return Math.log(e)/Math.LN10});var t=L.attr("cx")-d/2,n=.5*Math.log10(Math.abs(t));return e.x+=t>0?-n:n,e.x}(e):e.x})).attr("cy",(function(e){return e.y}))})),N.attr("x",(function(e){return e.x})).attr("y",(function(e){return e.y})).moveToFront(),R.filter((function(e){return e.objectPropNodeClassUri!==G})).attr("x",(function(e){return e.target.x>e.source.x?e.source.x+(e.target.x-e.source.x)/2:e.target.x+(e.source.x-e.target.x)/2})).attr("y",(function(e){return e.target.y>e.source.y?e.source.y+(e.target.y-e.source.y)/2:e.target.y+(e.source.y-e.target.y)/2})).moveToFront(),_.attr("x",(function(e){return e.target.x>e.source.x?e.source.x+(e.target.x-e.source.x)/2:e.target.x+(e.source.x-e.target.x)/2})).attr("y",(function(e){return e.target.y>e.source.y?e.source.y+(e.target.y-e.source.y)/2:e.target.y+(e.source.y-e.target.y)/2})).moveToFront(),I.attr("x",(function(e){return"right"===e.classPosition?e.x+1.2*m:e.x-1.2*m})).attr("y",(function(e){return e.y})).moveToFront()})).linkDistance(d/3.5).start()}}))}(f)}),50);f.$on("$destroy",(function(){c.cancel(d)}))}}}angular.module("graphdb.framework.graphexplore.directives.domainrange",["graphdb.framework.graphexplore.controllers.domainrange","graphdb.framework.utils.localstorageadapter"]).constant("ONTO_RED","#F04E23").constant("ONTO_GREEN","#0CB0A0").constant("ONTO_BLUE","#003663").constant("NON_COLLAPSED_REFLEXIVE_LINK_LIMIT",6).directive("domainRangeGraph",o),o.$inject=["$rootScope","$window","$repositories","GraphDataRestService","$location","LocalStorageAdapter","LSKeys","$timeout","toastr","ONTO_RED","ONTO_GREEN","ONTO_BLUE","NON_COLLAPSED_REFLEXIVE_LINK_LIMIT"]},61:function(e,t){function n(e,t){return{restrict:"A",scope:{},templateUrl:"js/angular/graphexplore/templates/systemRepoWarningTemplate.html",link:function(n){n.isSystemRepository=function(){return"SYSTEM"===e.getActiveRepository()},n.hasPermission=function(){return t.hasPermission()}}}}angular.module("graphdb.framework.graphexplore.directives.sysrepo",["graphdb.framework.graphexplore.controllers.class"]).directive("systemRepoWarning",n),n.$inject=["$repositories","$rootScope"]},62:function(e,t){function n(e){return{restrict:"AE",scope:{rdfsLabel:"=",rdfsComment:"=",expanded:"=",alwaysExpanded:"="},templateUrl:"js/angular/graphexplore/templates/rdfsCommentLabelTemplate.html",link:function(t,n){t.stringLimit=e,t.scrollToTop=function(){n[0].getElementsByClassName("rdfs-comment")[0].scrollTop=0},t.checkCommentLength=function(){return n[0].getElementsByClassName("rdfs-comment-text")[0].innerText.length<e},t.equalHeights=function(){const e=n[0].getElementsByClassName("rdfs-comment-text")[0].innerHeight;e<250&&t.expanded&&(n[0].getElementsByClassName("rdfs-comment")[0].innerHeight=e)},t.toggleFullComment=function(){t.expanded=!t.expanded},t.$watch("expanded || alwaysExpanded",(function(n){t.stringLimit=n?t.rdfsComment.length:e}))}}}angular.module("graphdb.framework.graphexplore.directives.rdfsdetails",[]).directive("rdfsCommentLabel",n).constant("SHORT_COMMENT_LENGTH",100),n.$inject=["SHORT_COMMENT_LENGTH"]},63:function(e,t,n){"use strict";n.r(t);var r=n(207);n(38);function i(e,t){return{restrict:"A",template:'<div id="dependencies-chord"></div>',scope:{dependenciesData:"="},link:function(n){n.$watch("dependenciesData",(function(){if(n.dependenciesData){const i=n.dependenciesData;!function(i,o){if(function(){let e=!0;for(const t of i){if(t.some(e=>0!==e)){e=!1;break}}return e}())return;const a=d3.scale.category20(),s=d3.select("body").append("div").attr("class","tooltip").style("opacity",0);d3.select("body").on("click",(function(){s.style("opacity",0)}));const u=Math.min(800,800)/2.8,c=u-24,l=d3.svg.arc().innerRadius(c).outerRadius(u),f=d3.layout.chord().padding(.04).sortSubgroups(d3.descending).sortChords(d3.ascending),d=d3.svg.chord().radius(c),p=d3.select("#dependencies-chord").append("svg").attr("viewBox","0 0 800 800").attr("preserveAspectRatio","xMidYMid meet").style("font","10px sans-serif").append("g").attr("id","circle").attr("transform","translate(400,400)");p.append("circle").attr("r",u).style("fill","none"),f.matrix(i);const h=p.selectAll(".group").data(f.groups).enter().append("g").attr("class","group").on("mouseover",(function(e,t){g.classed("fade",(function(e){return e.source.index!==t&&e.target.index!==t}))}));h.append("title").text((function(e,t){return o[t]})),h.append("path").attr("id",(function(e,t){return"group"+t})).attr("d",l).style("fill",(function(e,t){return a(t)})),h.append("text").each((function(e){e.angle=(e.startAngle+e.endAngle)/2})).attr("dy",".35em").attr("transform",(function(e){return"rotate("+(180*e.angle/Math.PI-90)+")translate("+(c+26)+")"+(e.angle>Math.PI?"rotate(180)":"")})).style("text-anchor",(function(e){return e.angle>Math.PI?"end":null})).text((function(e){return o[e.index]}));const g=p.selectAll(".chord").data(f.chords).enter().append("path").attr("class","chord").style("fill",(function(e){return a(e.target.index)})).style("fill-opacity",".67").style("stroke","#000").style("stroke-width",".25px").style("cursor","pointer").attr("d",d);g.on("mouseover",(function(){d3.select(this).style({"fill-opacity":"1"})})),g.on("mouseout",(function(){d3.select(this).style({"fill-opacity":".67"})})),g.on("click",(function(e){const r=o[e.source.index],i=o[e.target.index],a=d3.event.pageX,u=d3.event.pageY;t.getPredicates(r,i,n.selectedGraph&&n.selectedGraph.contextID.uri).success((function(e){let t="<div class='dependencies-tooltip'>"+("<div class='row'>"+r+" <i class='fa fa-exchange'></i> "+i+"</div>")+_.map(e.slice(0,10),(function(e){const t=" <i class='fa fa-long-arrow-"+("out"===e.direction?"right":"left")+"'></i>";return"<div class='row'>"+e.predicate+" : "+e.weight+t+" </div>"})).join("");e.length>10?t=t+"<div class='pull-right'>And "+(e.length-10).toString()+" more...</div></div>":t+="</div>",s.html(t).style("left",a+"px").style("top",u+"px")})),s.transition().duration(200).style("opacity",1)})),d3.select("#circle").on("mouseleave",(function(){p.selectAll(".chord").classed("fade",!1)})),d3.select("#download-svg").on("mouseover",(function(){const t=r.a.Export.generateBase64ImageSource();d3.select(this).attr({href:t,download:"dependencies-"+e.getActiveRepository()+".svg"})}))}(i.matrix,i.nodes,i.direction)}}))}}}angular.module("graphdb.framework.graphexplore.directives.dependencies",["graphdb.framework.graphexplore.controllers.dependencies","graphdb.framework.rest.graphexplore.data.service"]).directive("dependenciesChord",i),i.$inject=["$repositories","GraphDataRestService"]},64:function(e,t){function n(){return{restrict:"AE",scope:{filterQueryObj:"=",filterFunction:"&",listItemsObj:"=",listItemsNotFiltered:"=",searchPlaceholder:"@"},templateUrl:"js/angular/graphexplore/templates/listItemsSearchFilterTemplate.html",link:function(e){e.filterFunction=e.filterFunction(),e.$watch("filterQueryObj.query",(function(){var t,n,r,i;e.listItemsObj.items=(t=e.filterQueryObj.query,n=e.listItemsObj.items,r=e.listItemsNotFiltered,i=e.filterFunction,t.length>0?_.filter(r,i):n.length!==r.length?r:n)}))}}}angular.module("graphdb.framework.graphexplore.directives.searchfilter",[]).directive("listItemsSearchFilter",n),n.$inject=[]},65:function(e,t){function n(e,t){return{restrict:"AE",scope:{searchData:"=",searchFields:"@",titleField:"@",searchPlaceholder:"@",initialValue:"=",searchedObjCallback:"&"},templateUrl:"js/angular/graphexplore/templates/searchIconInputTemplate.html",link:function(n,r){n.searchedObjCallback=n.searchedObjCallback(),n.performSearchActionOnEnter=function(){e.$broadcast("onEnterKeypressSearchAction")},n.showInput=function(){$("#selectGraphDropdown").hide(),r.find("#search_input #search_input_value")[0].value="",r.find(".search-icon").addClass("animated bounceOut").css("z-index","-1"),r.find("#search_input .angucomplete-holder").css("display","block"),t((function(){r.find("#search_input .angucomplete-holder").css("width","250px").css("left","-215px"),t((function(){r.find(".close-icon").css("display","block").addClass("animated bounceIn").css("z-index","3"),r.find("#search_input #search_input_value").focus()}),200)}),1)},n.hideInput=function(){r.find("#search_input #search_input_value")[0].value="",r.find("#search_input .angucomplete-holder").css("width","0px").css("left","35px"),t((function(){r.find("#search_input .angucomplete-holder").css("display","none"),$("#selectGraphDropdown").show()}),250),r.find(".close-icon").addClass("animated bounceOut").removeClass("bounceOut").css("z-index","-1").css("display","none").click((function(){$(".tooltip").hide()})),t((function(){r.find(".search-icon").css("display","inline-block").removeClass("bounceOut").addClass("bounceIn").css("z-index","3")}),200)}}}}angular.module("graphdb.framework.graphexplore.directives.searchcontrols",[]).directive("searchIconInput",n),n.$inject=["$rootScope","$timeout"]},94:function(e,t,n){"use strict";n.r(t);n(2),n(13),n(7),n(8),n(221),n(222),n(216),n(214),n(209),n(223),n(225),n(226),n(218),n(206),n(215),n(207),n(38),n(50),n(51),n(52),n(53),n(54),n(55),n(56),n(57),n(58),n(59),n(60),n(61),n(62),n(63),n(64),n(65),n(33),n(34);angular.module("graphdb.framework.graphexplore",["graphdb.framework.core.controllers","graphdb.framework.core.directives","graphdb.framework.rest.graphexplore.data.service","graphdb.framework.graphexplore.services.uiscroll","graphdb.framework.graphexplore.services.rdfsdetails","graphdb.framework.rest.graphexplore.savedgraphs.service","graphdb.framework.rest.graphconfig.service","graphdb.framework.graphexplore.controllers.class","graphdb.framework.graphexplore.controllers.domainrange","graphdb.framework.graphexplore.controllers.dependencies","graphdb.framework.graphexplore.controllers.graphviz","graphdb.framework.graphexplore.controllers.graphviz.config","graphdb.framework.graphexplore.directives.sysrepo","graphdb.framework.graphexplore.directives.rdfsdetails","graphdb.framework.graphexplore.directives.searchfilter","graphdb.framework.graphexplore.directives.class","graphdb.framework.graphexplore.directives.domainrange","graphdb.framework.graphexplore.directives.dependencies","graphdb.framework.graphexplore.directives.searchcontrols","graphdb.framework.core.directives.queryeditor.controllers","graphdb.framework.core.directives.queryeditor.queryeditor"])}}]);
4
4
  //# sourceMappingURL=14.0c709b039159410b0b91.bundle.js.map