vis-network
Version:
A dynamic, browser-based visualization library.
26 lines • 291 kB
JavaScript
/**
* vis-network
* https://visjs.github.io/vis-network/
*
* A dynamic, browser-based visualization library.
*
* @version 8.2.0
* @date 2020-08-13T21:43:47.994Z
*
* @copyright (c) 2011-2017 Almende B.V, http://almende.com
* @copyright (c) 2017-2019 visjs contributors, https://github.com/visjs
*
* @license
* vis.js is dual licensed under both
*
* 1. The Apache 2.0 License
* http://www.apache.org/licenses/LICENSE-2.0
*
* and
*
* 2. The MIT License
* http://opensource.org/licenses/MIT
*
* vis.js may be distributed under either license.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("component-emitter"),require("vis-util/esnext/umd/vis-util.js"),require("keycharm"),require("@egjs/hammerjs"),require("vis-data/esnext/umd/vis-data.js"),require("uuid"),require("timsort")):"function"==typeof define&&define.amd?define(["exports","component-emitter","vis-util/esnext/umd/vis-util.js","keycharm","@egjs/hammerjs","vis-data/esnext/umd/vis-data.js","uuid","timsort"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).vis=t.vis||{},t.Emitter,t.vis,t.keycharm,t.Hammer,t.vis,t.uuid,t.timsort)}(this,(function(t,e,i,o,s,n,r,a){e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e,o=o&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o,s=s&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s;var h="default"in a?a.default:a;function d(t,e,i,o){t.beginPath(),t.arc(e,i,o,0,2*Math.PI,!1),t.closePath()}function l(t,e,i,o,s,n){const r=Math.PI/180;o-2*n<0&&(n=o/2),s-2*n<0&&(n=s/2),t.beginPath(),t.moveTo(e+n,i),t.lineTo(e+o-n,i),t.arc(e+o-n,i+n,n,270*r,360*r,!1),t.lineTo(e+o,i+s-n),t.arc(e+o-n,i+s-n,n,0,90*r,!1),t.lineTo(e+n,i+s),t.arc(e+n,i+s-n,n,90*r,180*r,!1),t.lineTo(e,i+n),t.arc(e+n,i+n,n,180*r,270*r,!1),t.closePath()}function c(t,e,i,o,s){const n=o/2*.5522848,r=s/2*.5522848,a=e+o,h=i+s,d=e+o/2,l=i+s/2;t.beginPath(),t.moveTo(e,l),t.bezierCurveTo(e,l-r,d-n,i,d,i),t.bezierCurveTo(d+n,i,a,l-r,a,l),t.bezierCurveTo(a,l+r,d+n,h,d,h),t.bezierCurveTo(d-n,h,e,l+r,e,l),t.closePath()}function p(t,e,i,o,s){const n=s*(1/3),r=o/2*.5522848,a=n/2*.5522848,h=e+o,d=i+n,l=e+o/2,c=i+n/2,p=i+(s-n/2),u=i+s;t.beginPath(),t.moveTo(h,c),t.bezierCurveTo(h,c+a,l+r,d,l,d),t.bezierCurveTo(l-r,d,e,c+a,e,c),t.bezierCurveTo(e,c-a,l-r,i,l,i),t.bezierCurveTo(l+r,i,h,c-a,h,c),t.lineTo(h,p),t.bezierCurveTo(h,p+a,l+r,u,l,u),t.bezierCurveTo(l-r,u,e,p+a,e,p),t.lineTo(e,c)}function u(t,e,i,o,s,n){t.beginPath(),t.moveTo(e,i);const r=n.length,a=o-e,h=s-i,d=h/a;let l=Math.sqrt(a*a+h*h),c=0,p=!0,u=0,g=+n[0];for(;l>=.1;)g=+n[c++%r],g>l&&(g=l),u=Math.sqrt(g*g/(1+d*d)),u=a<0?-u:u,e+=u,i+=d*u,!0===p?t.lineTo(e,i):t.moveTo(e,i),l-=g,p=!p}const g={circle:d,dashedLine:u,database:p,diamond:function(t,e,i,o){t.beginPath(),t.lineTo(e,i+o),t.lineTo(e+o,i),t.lineTo(e,i-o),t.lineTo(e-o,i),t.closePath()},ellipse:c,ellipse_vis:c,hexagon:function(t,e,i,o){t.beginPath();const s=2*Math.PI/6;t.moveTo(e+o,i);for(let n=1;n<6;n++)t.lineTo(e+o*Math.cos(s*n),i+o*Math.sin(s*n));t.closePath()},roundRect:l,square:function(t,e,i,o){t.beginPath(),t.rect(e-o,i-o,2*o,2*o),t.closePath()},star:function(t,e,i,o){t.beginPath(),i+=.1*(o*=.82);for(let s=0;s<10;s++){const n=s%2==0?1.3*o:.5*o;t.lineTo(e+n*Math.sin(2*s*Math.PI/10),i-n*Math.cos(2*s*Math.PI/10))}t.closePath()},triangle:function(t,e,i,o){t.beginPath(),i+=.275*(o*=1.15);const s=2*o,n=s/2,r=Math.sqrt(3)/6*s,a=Math.sqrt(s*s-n*n);t.moveTo(e,i-(a-r)),t.lineTo(e+n,i+r),t.lineTo(e-n,i+r),t.lineTo(e,i-(a-r)),t.closePath()},triangleDown:function(t,e,i,o){t.beginPath(),i-=.275*(o*=1.15);const s=2*o,n=s/2,r=Math.sqrt(3)/6*s,a=Math.sqrt(s*s-n*n);t.moveTo(e,i+(a-r)),t.lineTo(e+n,i-r),t.lineTo(e-n,i-r),t.lineTo(e,i+(a-r)),t.closePath()}};function b(t){return O=t,function(){var t={};E=0,void(C=O.charAt(0)),j(),"strict"===k&&(t.strict=!0,j());"graph"!==k&&"digraph"!==k||(t.type=k,j());M===w&&(t.id=k,j());if("{"!=k)throw V("Angle bracket { expected");if(j(),R(t),"}"!=k)throw V("Angle bracket } expected");if(j(),""!==k)throw V("End of file expected");return j(),delete t.node,delete t.edge,delete t.graph,t}()}var m={fontsize:"font.size",fontcolor:"font.color",labelfontcolor:"font.color",fontname:"font.face",color:["color.border","color.background"],fillcolor:"color.background",tooltip:"title",labeltooltip:"title"},f=Object.create(m);f.color="color.color",f.style="dashes";var y=0,v=1,w=2,_=3,x={"{":!0,"}":!0,"[":!0,"]":!0,";":!0,"=":!0,",":!0,"->":!0,"--":!0},O="",E=0,C="",k="",M=y;function S(){E++,C=O.charAt(E)}function D(){return O.charAt(E+1)}var B=/[a-zA-Z_0-9.:#]/;function T(t){return B.test(t)}function P(t,e){if(t||(t={}),e)for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}function z(t,e,i){for(var o=e.split("."),s=t;o.length;){var n=o.shift();o.length?(s[n]||(s[n]={}),s=s[n]):s[n]=i}}function F(t,e){for(var i,o,s=null,n=[t],r=t;r.parent;)n.push(r.parent),r=r.parent;if(r.nodes)for(i=0,o=r.nodes.length;i<o;i++)if(e.id===r.nodes[i].id){s=r.nodes[i];break}for(s||(s={id:e.id},t.node&&(s.attr=P(s.attr,t.node))),i=n.length-1;i>=0;i--){var a=n[i];a.nodes||(a.nodes=[]),-1===a.nodes.indexOf(s)&&a.nodes.push(s)}e.attr&&(s.attr=P(s.attr,e.attr))}function I(t,e){if(t.edges||(t.edges=[]),t.edges.push(e),t.edge){var i=P({},t.edge);e.attr=P(i,e.attr)}}function N(t,e,i,o,s){var n={from:e,to:i,type:o};return t.edge&&(n.attr=P({},t.edge)),n.attr=P(n.attr||{},s),null!=s&&s.hasOwnProperty("arrows")&&null!=s.arrows&&(n.arrows={to:{enabled:!0,type:s.arrows.type}},s.arrows=null),n}function j(){for(M=y,k="";" "===C||"\t"===C||"\n"===C||"\r"===C;)S();do{var t=!1;if("#"===C){for(var e=E-1;" "===O.charAt(e)||"\t"===O.charAt(e);)e--;if("\n"===O.charAt(e)||""===O.charAt(e)){for(;""!=C&&"\n"!=C;)S();t=!0}}if("/"===C&&"/"===D()){for(;""!=C&&"\n"!=C;)S();t=!0}if("/"===C&&"*"===D()){for(;""!=C;){if("*"===C&&"/"===D()){S(),S();break}S()}t=!0}for(;" "===C||"\t"===C||"\n"===C||"\r"===C;)S()}while(t);if(""!==C){var i=C+D();if(x[i])return M=v,k=i,S(),void S();if(x[C])return M=v,k=C,void S();if(T(C)||"-"===C){for(k+=C,S();T(C);)k+=C,S();return"false"===k?k=!1:"true"===k?k=!0:isNaN(Number(k))||(k=Number(k)),void(M=w)}if('"'===C){for(S();""!=C&&('"'!=C||'"'===C&&'"'===D());)'"'===C?(k+=C,S()):"\\"===C&&"n"===D()?(k+="\n",S()):k+=C,S();if('"'!=C)throw V('End of string " expected');return S(),void(M=w)}for(M=_;""!=C;)k+=C,S();throw new SyntaxError('Syntax error in part "'+q(k,30)+'"')}M=v}function R(t){for(;""!==k&&"}"!=k;)A(t),";"===k&&j()}function A(t){var e=H(t);if(e)L(t,e);else if(!function(t){if("node"===k)return j(),t.node=W(),"node";if("edge"===k)return j(),t.edge=W(),"edge";if("graph"===k)return j(),t.graph=W(),"graph";return null}(t)){if(M!=w)throw V("Identifier expected");var i=k;if(j(),"="===k){if(j(),M!=w)throw V("Identifier expected");t[i]=k,j()}else!function(t,e){var i={id:e},o=W();o&&(i.attr=o);F(t,i),L(t,e)}(t,i)}}function H(t){var e=null;if("subgraph"===k&&((e={}).type="subgraph",j(),M===w&&(e.id=k,j())),"{"===k){if(j(),e||(e={}),e.parent=t,e.node=t.node,e.edge=t.edge,e.graph=t.graph,R(e),"}"!=k)throw V("Angle bracket } expected");j(),delete e.node,delete e.edge,delete e.graph,delete e.parent,t.subgraphs||(t.subgraphs=[]),t.subgraphs.push(e)}return e}function L(t,e){for(;"->"===k||"--"===k;){var i,o=k;j();var s=H(t);if(s)i=s;else{if(M!=w)throw V("Identifier or subgraph expected");F(t,{id:i=k}),j()}I(t,N(t,e,i,o,W())),e=i}}function W(){for(var t,e,i=null,o={dashed:!0,solid:!1,dotted:[1,5]},s={dot:"circle",box:"box",crow:"crow",curve:"curve",icurve:"inv_curve",normal:"triangle",inv:"inv_triangle",diamond:"diamond",tee:"bar",vee:"vee"},n=new Array,r=new Array;"["===k;){for(j(),i={};""!==k&&"]"!=k;){if(M!=w)throw V("Attribute name expected");var a=k;if(j(),"="!=k)throw V("Equal sign = expected");if(j(),M!=w)throw V("Attribute value expected");var h=k;"style"===a&&(h=o[h]),"arrowhead"===a&&(a="arrows",h={to:{enabled:!0,type:s[h]}}),"arrowtail"===a&&(a="arrows",h={from:{enabled:!0,type:s[h]}}),n.push({attr:i,name:a,value:h}),r.push(a),j(),","==k&&j()}if("]"!=k)throw V("Bracket ] expected");j()}if(r.includes("dir")){var d={arrows:{}};for(t=0;t<n.length;t++)if("arrows"===n[t].name)if(null!=n[t].value.to)d.arrows.to=t;else{if(null==n[t].value.from)throw V("Invalid value of arrows");d.arrows.from=t}else"dir"===n[t].name&&(d.dir=t);var l,c,p=n[d.dir].value;if(!r.includes("arrows"))if("both"===p)n.push({attr:n[d.dir].attr,name:"arrows",value:{to:{enabled:!0}}}),d.arrows.to=n.length-1,n.push({attr:n[d.dir].attr,name:"arrows",value:{from:{enabled:!0}}}),d.arrows.from=n.length-1;else if("forward"===p)n.push({attr:n[d.dir].attr,name:"arrows",value:{to:{enabled:!0}}}),d.arrows.to=n.length-1;else if("back"===p)n.push({attr:n[d.dir].attr,name:"arrows",value:{from:{enabled:!0}}}),d.arrows.from=n.length-1;else{if("none"!==p)throw V('Invalid dir type "'+p+'"');n.push({attr:n[d.dir].attr,name:"arrows",value:""}),d.arrows.to=n.length-1}if("both"===p)d.arrows.to&&d.arrows.from?(c=n[d.arrows.to].value.to.type,l=n[d.arrows.from].value.from.type,n[d.arrows.to]={attr:n[d.arrows.to].attr,name:n[d.arrows.to].name,value:{to:{enabled:!0,type:c},from:{enabled:!0,type:l}}},n.splice(d.arrows.from,1)):d.arrows.to?(c=n[d.arrows.to].value.to.type,l="arrow",n[d.arrows.to]={attr:n[d.arrows.to].attr,name:n[d.arrows.to].name,value:{to:{enabled:!0,type:c},from:{enabled:!0,type:l}}}):d.arrows.from&&(c="arrow",l=n[d.arrows.from].value.from.type,n[d.arrows.from]={attr:n[d.arrows.from].attr,name:n[d.arrows.from].name,value:{to:{enabled:!0,type:c},from:{enabled:!0,type:l}}});else if("back"===p)d.arrows.to&&d.arrows.from?(c="",l=n[d.arrows.from].value.from.type,n[d.arrows.from]={attr:n[d.arrows.from].attr,name:n[d.arrows.from].name,value:{to:{enabled:!0,type:c},from:{enabled:!0,type:l}}}):d.arrows.to?(c="",l="arrow",d.arrows.from=d.arrows.to,n[d.arrows.from]={attr:n[d.arrows.from].attr,name:n[d.arrows.from].name,value:{to:{enabled:!0,type:c},from:{enabled:!0,type:l}}}):d.arrows.from&&(c="",l=n[d.arrows.from].value.from.type,n[d.arrows.to]={attr:n[d.arrows.from].attr,name:n[d.arrows.from].name,value:{to:{enabled:!0,type:c},from:{enabled:!0,type:l}}}),n[d.arrows.from]={attr:n[d.arrows.from].attr,name:n[d.arrows.from].name,value:{from:{enabled:!0,type:n[d.arrows.from].value.from.type}}};else if("none"===p){var u;n[u=d.arrows.to?d.arrows.to:d.arrows.from]={attr:n[u].attr,name:n[u].name,value:""}}else{if("forward"!==p)throw V('Invalid dir type "'+p+'"');d.arrows.to&&d.arrows.from||d.arrows.to?(c=n[d.arrows.to].value.to.type,l="",n[d.arrows.to]={attr:n[d.arrows.to].attr,name:n[d.arrows.to].name,value:{to:{enabled:!0,type:c},from:{enabled:!0,type:l}}}):d.arrows.from&&(c="arrow",l="",d.arrows.to=d.arrows.from,n[d.arrows.to]={attr:n[d.arrows.to].attr,name:n[d.arrows.to].name,value:{to:{enabled:!0,type:c},from:{enabled:!0,type:l}}}),n[d.arrows.to]={attr:n[d.arrows.to].attr,name:n[d.arrows.to].name,value:{to:{enabled:!0,type:n[d.arrows.to].value.to.type}}}}n.splice(d.dir,1)}if(r.includes("penwidth")){var g=[];for(e=n.length,t=0;t<e;t++)"width"!==n[t].name&&("penwidth"===n[t].name&&(n[t].name="width"),g.push(n[t]));n=g}for(e=n.length,t=0;t<e;t++)z(n[t].attr,n[t].name,n[t].value);return i}function V(t){return new SyntaxError(t+', got "'+q(k,30)+'" (char '+E+")")}function q(t,e){return t.length<=e?t:t.substr(0,27)+"..."}function U(t,e,i){for(var o=e.split("."),s=o.pop(),n=t,r=0;r<o.length;r++){var a=o[r];a in n||(n[a]={}),n=n[a]}return n[s]=i,t}function Y(t,e){var i={};for(var o in t)if(t.hasOwnProperty(o)){var s=e[o];Array.isArray(s)?s.forEach((function(e){U(i,e,t[o])})):U(i,"string"==typeof s?s:o,t[o])}return i}function X(t){var e=b(t),i={nodes:[],edges:[],options:{}};if(e.nodes&&e.nodes.forEach((function(t){var e={id:t.id,label:String(t.label||t.id)};P(e,Y(t.attr,m)),e.image&&(e.shape="image"),i.nodes.push(e)})),e.edges){var o=function(t){var e={from:t.from,to:t.to};return P(e,Y(t.attr,f)),null==e.arrows&&"->"===t.type&&(e.arrows="to"),e};e.edges.forEach((function(t){var e,s,n,r,a;e=t.from instanceof Object?t.from.nodes:{id:t.from},s=t.to instanceof Object?t.to.nodes:{id:t.to},t.from instanceof Object&&t.from.edges&&t.from.edges.forEach((function(t){var e=o(t);i.edges.push(e)})),n=e,r=s,a=function(e,s){var n=N(i,e.id,s.id,t.type,t.attr),r=o(n);i.edges.push(r)},Array.isArray(n)?n.forEach((function(t){Array.isArray(r)?r.forEach((function(e){a(t,e)})):a(t,r)})):Array.isArray(r)?r.forEach((function(t){a(n,t)})):a(n,r),t.to instanceof Object&&t.to.edges&&t.to.edges.forEach((function(t){var e=o(t);i.edges.push(e)}))}))}return e.attr&&(i.options=e.attr),i}var G=Object.freeze({__proto__:null,parseDOT:b,DOTToGraph:X});function K(t,e){const i={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};null!=e&&(null!=e.fixed&&(i.nodes.fixed=e.fixed),null!=e.parseColor&&(i.nodes.parseColor=e.parseColor),null!=e.inheritColor&&(i.edges.inheritColor=e.inheritColor));const o=t.edges.map(t=>{const e={from:t.source,id:t.id,to:t.target};return null!=t.attributes&&(e.attributes=t.attributes),null!=t.label&&(e.label=t.label),null!=t.attributes&&null!=t.attributes.title&&(e.title=t.attributes.title),"Directed"===t.type&&(e.arrows="to"),t.color&&!1===i.edges.inheritColor&&(e.color=t.color),e});return{nodes:t.nodes.map(t=>{const e={id:t.id,fixed:i.nodes.fixed&&null!=t.x&&null!=t.y};return null!=t.attributes&&(e.attributes=t.attributes),null!=t.label&&(e.label=t.label),null!=t.size&&(e.size=t.size),null!=t.attributes&&null!=t.attributes.title&&(e.title=t.attributes.title),null!=t.title&&(e.title=t.title),null!=t.x&&(e.x=t.x),null!=t.y&&(e.y=t.y),null!=t.color&&(!0===i.nodes.parseColor?e.color=t.color:e.color={background:t.color,border:t.color,highlight:{background:t.color,border:t.color},hover:{background:t.color,border:t.color}}),e}),edges:o}}var Z=Object.freeze({__proto__:null,parseGephi:K});var J=function(t,e,i){return t(i={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&i.path)}},i.exports),i.exports}((function(t){if("undefined"!=typeof window){const e=window.Hammer||s;t.exports=e}else t.exports=function(){return function(){const t=()=>{};return{on:t,off:t,destroy:t,emit:t,get:function(e){return{set:t}}}}()}}));function $(t){this.active=!1,this.dom={container:t},this.dom.overlay=document.createElement("div"),this.dom.overlay.className="vis-overlay",this.dom.container.appendChild(this.dom.overlay),this.hammer=J(this.dom.overlay),this.hammer.on("tap",this._onTapOverlay.bind(this));["tap","doubletap","press","pinch","pan","panstart","panmove","panend"].forEach(t=>{this.hammer.on(t,t=>{t.srcEvent.stopPropagation()})}),document&&document.body&&(this.onClick=e=>{(function(t,e){for(;t;){if(t===e)return!0;t=t.parentNode}return!1})(e.target,t)||this.deactivate()},document.body.addEventListener("click",this.onClick)),void 0!==this.keycharm&&this.keycharm.destroy(),this.keycharm=o(),this.escListener=this.deactivate.bind(this)}e($.prototype),$.current=null,$.prototype.destroy=function(){this.deactivate(),this.dom.overlay.parentNode.removeChild(this.dom.overlay),this.onClick&&document.body.removeEventListener("click",this.onClick),void 0!==this.keycharm&&this.keycharm.destroy(),this.keycharm=null,this.hammer.destroy(),this.hammer=null},$.prototype.activate=function(){$.current&&$.current.deactivate(),$.current=this,this.active=!0,this.dom.overlay.style.display="none",i.addClassName(this.dom.container,"vis-active"),this.emit("change"),this.emit("activate"),this.keycharm.bind("esc",this.escListener)},$.prototype.deactivate=function(){this.active=!1,this.dom.overlay.style.display="block",i.removeClassName(this.dom.container,"vis-active"),this.keycharm.unbind("esc",this.escListener),this.emit("change"),this.emit("deactivate")},$.prototype._onTapOverlay=function(t){this.activate(),t.srcEvent.stopPropagation()};var Q=Object.freeze({__proto__:null,en:{addDescription:"Click in an empty space to place a new node.",addEdge:"Add Edge",addNode:"Add Node",back:"Back",createEdgeError:"Cannot link edges to a cluster.",del:"Delete selected",deleteClusterError:"Clusters cannot be deleted.",edgeDescription:"Click on a node and drag the edge to another node to connect them.",edit:"Edit",editClusterError:"Clusters cannot be edited.",editEdge:"Edit Edge",editEdgeDescription:"Click on the control points and drag them to a node to connect to it.",editNode:"Edit Node"},de:{addDescription:"Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.",addEdge:"Kante hinzufügen",addNode:"Knoten hinzufügen",back:"Zurück",createEdgeError:"Es ist nicht möglich, Kanten mit Clustern zu verbinden.",del:"Lösche Auswahl",deleteClusterError:"Cluster können nicht gelöscht werden.",edgeDescription:"Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.",edit:"Editieren",editClusterError:"Cluster können nicht editiert werden.",editEdge:"Kante editieren",editEdgeDescription:"Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.",editNode:"Knoten editieren"},es:{addDescription:"Haga clic en un lugar vacío para colocar un nuevo nodo.",addEdge:"Añadir arista",addNode:"Añadir nodo",back:"Atrás",createEdgeError:"No se puede conectar una arista a un grupo.",del:"Eliminar selección",deleteClusterError:"No es posible eliminar grupos.",edgeDescription:"Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.",edit:"Editar",editClusterError:"No es posible editar grupos.",editEdge:"Editar arista",editEdgeDescription:"Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.",editNode:"Editar nodo"},it:{addDescription:"Clicca per aggiungere un nuovo nodo",addEdge:"Aggiungi un vertice",addNode:"Aggiungi un nodo",back:"Indietro",createEdgeError:"Non si possono collegare vertici ad un cluster",del:"Cancella la selezione",deleteClusterError:"I cluster non possono essere cancellati",edgeDescription:"Clicca su un nodo e trascinalo ad un altro nodo per connetterli.",edit:"Modifica",editClusterError:"I clusters non possono essere modificati.",editEdge:"Modifica il vertice",editEdgeDescription:"Clicca sui Punti di controllo e trascinali ad un nodo per connetterli.",editNode:"Modifica il nodo"},nl:{addDescription:"Klik op een leeg gebied om een nieuwe node te maken.",addEdge:"Link toevoegen",addNode:"Node toevoegen",back:"Terug",createEdgeError:"Kan geen link maken naar een cluster.",del:"Selectie verwijderen",deleteClusterError:"Clusters kunnen niet worden verwijderd.",edgeDescription:"Klik op een node en sleep de link naar een andere node om ze te verbinden.",edit:"Wijzigen",editClusterError:"Clusters kunnen niet worden aangepast.",editEdge:"Link wijzigen",editEdgeDescription:"Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.",editNode:"Node wijzigen"},pt:{addDescription:"Clique em um espaço em branco para adicionar um novo nó",addEdge:"Adicionar aresta",addNode:"Adicionar nó",back:"Voltar",createEdgeError:"Não foi possível linkar arestas a um cluster.",del:"Remover selecionado",deleteClusterError:"Clusters não puderam ser removidos.",edgeDescription:"Clique em um nó e arraste a aresta até outro nó para conectá-los",edit:"Editar",editClusterError:"Clusters não puderam ser editados.",editEdge:"Editar aresta",editEdgeDescription:"Clique nos pontos de controle e os arraste para um nó para conectá-los",editNode:"Editar nó"},ru:{addDescription:"Кликните в свободное место, чтобы добавить новый узел.",addEdge:"Добавить ребро",addNode:"Добавить узел",back:"Назад",createEdgeError:"Невозможно соединить ребра в кластер.",del:"Удалить выбранное",deleteClusterError:"Кластеры не могут быть удалены",edgeDescription:"Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.",edit:"Редактировать",editClusterError:"Кластеры недоступны для редактирования.",editEdge:"Редактировать ребро",editEdgeDescription:"Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.",editNode:"Редактировать узел"},cn:{addDescription:"单击空白处放置新节点。",addEdge:"添加连接线",addNode:"添加节点",back:"返回",createEdgeError:"无法将连接线连接到群集。",del:"删除选定",deleteClusterError:"无法删除群集。",edgeDescription:"单击某个节点并将该连接线拖动到另一个节点以连接它们。",edit:"编辑",editClusterError:"无法编辑群集。",editEdge:"编辑连接线",editEdgeDescription:"单击控制节点并将它们拖到节点上连接。",editNode:"编辑节点"},uk:{addDescription:"Kлікніть на вільне місце, щоб додати новий вузол.",addEdge:"Додати край",addNode:"Додати вузол",back:"Назад",createEdgeError:"Не можливо об'єднати краї в групу.",del:"Видалити обране",deleteClusterError:"Групи не можуть бути видалені.",edgeDescription:"Клікніть на вузол і перетягніть край до іншого вузла, щоб їх з'єднати.",edit:"Редагувати",editClusterError:"Групи недоступні для редагування.",editEdge:"Редагувати край",editEdgeDescription:"Клікніть на контрольні точки і перетягніть їх у вузол, щоб підключитися до нього.",editNode:"Редагувати вузол"},fr:{addDescription:"Cliquez dans un endroit vide pour placer un nœud.",addEdge:"Ajouter un lien",addNode:"Ajouter un nœud",back:"Retour",createEdgeError:"Impossible de créer un lien vers un cluster.",del:"Effacer la sélection",deleteClusterError:"Les clusters ne peuvent pas être effacés.",edgeDescription:"Cliquez sur un nœud et glissez le lien vers un autre nœud pour les connecter.",edit:"Éditer",editClusterError:"Les clusters ne peuvent pas être édités.",editEdge:"Éditer le lien",editEdgeDescription:"Cliquez sur les points de contrôle et glissez-les pour connecter un nœud.",editNode:"Éditer le nœud"},cs:{addDescription:"Kluknutím do prázdného prostoru můžete přidat nový vrchol.",addEdge:"Přidat hranu",addNode:"Přidat vrchol",back:"Zpět",createEdgeError:"Nelze připojit hranu ke shluku.",del:"Smazat výběr",deleteClusterError:"Nelze mazat shluky.",edgeDescription:"Přetažením z jednoho vrcholu do druhého můžete spojit tyto vrcholy novou hranou.",edit:"Upravit",editClusterError:"Nelze upravovat shluky.",editEdge:"Upravit hranu",editEdgeDescription:"Přetažením kontrolního vrcholu hrany ji můžete připojit k jinému vrcholu.",editNode:"Upravit vrchol"}});class tt{constructor(){this.NUM_ITERATIONS=4,this.image=new Image,this.canvas=document.createElement("canvas")}init(){if(this.initialized())return;this.src=this.image.src;const t=this.image.width,e=this.image.height;this.width=t,this.height=e;const i=Math.floor(e/2),o=Math.floor(e/4),s=Math.floor(e/8),n=Math.floor(e/16),r=Math.floor(t/2),a=Math.floor(t/4),h=Math.floor(t/8),d=Math.floor(t/16);this.canvas.width=3*a,this.canvas.height=i,this.coordinates=[[0,0,r,i],[r,0,a,o],[r,o,h,s],[5*h,o,d,n]],this._fillMipMap()}initialized(){return void 0!==this.coordinates}_fillMipMap(){const t=this.canvas.getContext("2d"),e=this.coordinates[0];t.drawImage(this.image,e[0],e[1],e[2],e[3]);for(let e=1;e<this.NUM_ITERATIONS;e++){const i=this.coordinates[e-1],o=this.coordinates[e];t.drawImage(this.canvas,i[0],i[1],i[2],i[3],o[0],o[1],o[2],o[3])}}drawImageAtPosition(t,e,i,o,s,n){if(this.initialized())if(e>2){e*=.5;let r=0;for(;e>2&&r<this.NUM_ITERATIONS;)e*=.5,r+=1;r>=this.NUM_ITERATIONS&&(r=this.NUM_ITERATIONS-1);const a=this.coordinates[r];t.drawImage(this.canvas,a[0],a[1],a[2],a[3],i,o,s,n)}else t.drawImage(this.image,i,o,s,n)}}class et{constructor(t){this.images={},this.imageBroken={},this.callback=t}_tryloadBrokenUrl(t,e,i){void 0!==t&&void 0!==i&&(void 0!==e?(i.image.onerror=()=>{console.error("Could not load brokenImage:",e)},i.image.src=e):console.warn("No broken url image defined"))}_redrawWithImage(t){this.callback&&this.callback(t)}load(t,e){const i=this.images[t];if(i)return i;const o=new tt;return this.images[t]=o,o.image.onload=()=>{this._fixImageCoordinates(o.image),o.init(),this._redrawWithImage(o)},o.image.onerror=()=>{console.error("Could not load image:",t),this._tryloadBrokenUrl(t,e,o)},o.image.src=t,o}_fixImageCoordinates(t){0===t.width&&(document.body.appendChild(t),t.width=t.offsetWidth,t.height=t.offsetHeight,document.body.removeChild(t))}}class it{constructor(){this.clear(),this.defaultIndex=0,this.groupsArray=[],this.groupIndex=0,this.defaultGroups=[{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},{border:"#FFA500",background:"#FFFF00",highlight:{border:"#FFA500",background:"#FFFFA3"},hover:{border:"#FFA500",background:"#FFFFA3"}},{border:"#FA0A10",background:"#FB7E81",highlight:{border:"#FA0A10",background:"#FFAFB1"},hover:{border:"#FA0A10",background:"#FFAFB1"}},{border:"#41A906",background:"#7BE141",highlight:{border:"#41A906",background:"#A1EC76"},hover:{border:"#41A906",background:"#A1EC76"}},{border:"#E129F0",background:"#EB7DF4",highlight:{border:"#E129F0",background:"#F0B3F5"},hover:{border:"#E129F0",background:"#F0B3F5"}},{border:"#7C29F0",background:"#AD85E4",highlight:{border:"#7C29F0",background:"#D3BDF0"},hover:{border:"#7C29F0",background:"#D3BDF0"}},{border:"#C37F00",background:"#FFA807",highlight:{border:"#C37F00",background:"#FFCA66"},hover:{border:"#C37F00",background:"#FFCA66"}},{border:"#4220FB",background:"#6E6EFD",highlight:{border:"#4220FB",background:"#9B9BFD"},hover:{border:"#4220FB",background:"#9B9BFD"}},{border:"#FD5A77",background:"#FFC0CB",highlight:{border:"#FD5A77",background:"#FFD1D9"},hover:{border:"#FD5A77",background:"#FFD1D9"}},{border:"#4AD63A",background:"#C2FABC",highlight:{border:"#4AD63A",background:"#E6FFE3"},hover:{border:"#4AD63A",background:"#E6FFE3"}},{border:"#990000",background:"#EE0000",highlight:{border:"#BB0000",background:"#FF3333"},hover:{border:"#BB0000",background:"#FF3333"}},{border:"#FF6000",background:"#FF6000",highlight:{border:"#FF6000",background:"#FF6000"},hover:{border:"#FF6000",background:"#FF6000"}},{border:"#97C2FC",background:"#2B7CE9",highlight:{border:"#D2E5FF",background:"#2B7CE9"},hover:{border:"#D2E5FF",background:"#2B7CE9"}},{border:"#399605",background:"#255C03",highlight:{border:"#399605",background:"#255C03"},hover:{border:"#399605",background:"#255C03"}},{border:"#B70054",background:"#FF007E",highlight:{border:"#B70054",background:"#FF007E"},hover:{border:"#B70054",background:"#FF007E"}},{border:"#AD85E4",background:"#7C29F0",highlight:{border:"#D3BDF0",background:"#7C29F0"},hover:{border:"#D3BDF0",background:"#7C29F0"}},{border:"#4557FA",background:"#000EA1",highlight:{border:"#6E6EFD",background:"#000EA1"},hover:{border:"#6E6EFD",background:"#000EA1"}},{border:"#FFC0CB",background:"#FD5A77",highlight:{border:"#FFD1D9",background:"#FD5A77"},hover:{border:"#FFD1D9",background:"#FD5A77"}},{border:"#C2FABC",background:"#74D66A",highlight:{border:"#E6FFE3",background:"#74D66A"},hover:{border:"#E6FFE3",background:"#74D66A"}},{border:"#EE0000",background:"#990000",highlight:{border:"#FF3333",background:"#BB0000"},hover:{border:"#FF3333",background:"#BB0000"}}],this.options={},this.defaultOptions={useDefaultGroups:!0},Object.assign(this.options,this.defaultOptions)}setOptions(t){const e=["useDefaultGroups"];if(void 0!==t)for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&-1===e.indexOf(i)){const e=t[i];this.add(i,e)}}clear(){this.groups={},this.groupsArray=[]}get(t,e=!0){let i=this.groups[t];if(void 0===i&&e)if(!1===this.options.useDefaultGroups&&this.groupsArray.length>0){const e=this.groupIndex%this.groupsArray.length;this.groupIndex++,i={},i.color=this.groups[this.groupsArray[e]],this.groups[t]=i}else{const e=this.defaultIndex%this.defaultGroups.length;this.defaultIndex++,i={},i.color=this.defaultGroups[e],this.groups[t]=i}return i}add(t,e){return this.groups[t]=e,this.groupsArray.push(t),e}}function ot(t,e){const o=["node","edge","label"];let s=!0;const n=i.topMost(e,"chosen");if("boolean"==typeof n)s=n;else if("object"==typeof n){if(-1===o.indexOf(t))throw new Error("choosify: subOption '"+t+"' should be one of '"+o.join("', '")+"'");const n=i.topMost(e,["chosen",t]);"boolean"!=typeof n&&"function"!=typeof n||(s=n)}return s}function st(t,e,i){if(t.width<=0||t.height<=0)return!1;if(void 0!==i){const t={x:e.x-i.x,y:e.y-i.y};if(0!==i.angle){const o=-i.angle;e={x:Math.cos(o)*t.x-Math.sin(o)*t.y,y:Math.sin(o)*t.x+Math.cos(o)*t.y}}else e=t}const o=t.x+t.width,s=t.y+t.width;return t.left<e.x&&o>e.x&&t.top<e.y&&s>e.y}function nt(t){return"string"==typeof t&&""!==t}function rt(t,e,i,o){let s=o.x,n=o.y;if("function"==typeof o.distanceToBorder){const i=o.distanceToBorder(t,e),r=Math.sin(e)*i,a=Math.cos(e)*i;a===i?(s+=i,n=o.y):r===i?(s=o.x,n-=i):(s+=a,n-=r)}else o.shape.width>o.shape.height?(s=o.x+.5*o.shape.width,n=o.y-i):(s=o.x+i,n=o.y-.5*o.shape.height);return{x:s,y:n}}class at{constructor(t){this.measureText=t,this.current=0,this.width=0,this.height=0,this.lines=[]}_add(t,e,i="normal"){void 0===this.lines[t]&&(this.lines[t]={width:0,height:0,blocks:[]});let o=e;void 0!==e&&""!==e||(o=" ");const s=this.measureText(o,i),n=Object.assign({},s.values);n.text=e,n.width=s.width,n.mod=i,void 0!==e&&""!==e||(n.width=0),this.lines[t].blocks.push(n),this.lines[t].width+=n.width}curWidth(){const t=this.lines[this.current];return void 0===t?0:t.width}append(t,e="normal"){this._add(this.current,t,e)}newLine(t,e="normal"){this._add(this.current,t,e),this.current++}determineLineHeights(){for(let t=0;t<this.lines.length;t++){const e=this.lines[t];let i=0;if(void 0!==e.blocks)for(let t=0;t<e.blocks.length;t++){const o=e.blocks[t];i<o.height&&(i=o.height)}e.height=i}}determineLabelSize(){let t=0,e=0;for(let i=0;i<this.lines.length;i++){const o=this.lines[i];o.width>t&&(t=o.width),e+=o.height}this.width=t,this.height=e}removeEmptyBlocks(){const t=[];for(let e=0;e<this.lines.length;e++){const i=this.lines[e];if(0===i.blocks.length)continue;if(e===this.lines.length-1&&0===i.width)continue;const o={};let s;Object.assign(o,i),o.blocks=[];const n=[];for(let t=0;t<i.blocks.length;t++){const e=i.blocks[t];0!==e.width?n.push(e):void 0===s&&(s=e)}0===n.length&&void 0!==s&&n.push(s),o.blocks=n,t.push(o)}return t}finalize(){this.determineLineHeights(),this.determineLabelSize();const t=this.removeEmptyBlocks();return{width:this.width,height:this.height,lines:t}}}const ht={"<b>":/<b>/,"<i>":/<i>/,"<code>":/<code>/,"</b>":/<\/b>/,"</i>":/<\/i>/,"</code>":/<\/code>/,"*":/\*/,_:/\_/,"`":/`/,afterBold:/[^\*]/,afterItal:/[^_]/,afterMono:/[^`]/};class dt{constructor(t){this.text=t,this.bold=!1,this.ital=!1,this.mono=!1,this.spacing=!1,this.position=0,this.buffer="",this.modStack=[],this.blocks=[]}mod(){return 0===this.modStack.length?"normal":this.modStack[0]}modName(){return 0===this.modStack.length?"normal":"mono"===this.modStack[0]?"mono":this.bold&&this.ital?"boldital":this.bold?"bold":this.ital?"ital":void 0}emitBlock(){this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(this.blocks.push({text:this.buffer,mod:this.modName()}),this.buffer="")}add(t){" "===t&&(this.spacing=!0),this.spacing&&(this.buffer+=" ",this.spacing=!1)," "!=t&&(this.buffer+=t)}parseWS(t){return!!/[ \t]/.test(t)&&(this.mono?this.add(t):this.spacing=!0,!0)}setTag(t){this.emitBlock(),this[t]=!0,this.modStack.unshift(t)}unsetTag(t){this.emitBlock(),this[t]=!1,this.modStack.shift()}parseStartTag(t,e){return!(this.mono||this[t]||!this.match(e))&&(this.setTag(t),!0)}match(t,e=!0){const[i,o]=this.prepareRegExp(t),s=i.test(this.text.substr(this.position,o));return s&&e&&(this.position+=o-1),s}parseEndTag(t,e,i){let o=this.mod()===t;return o="mono"===t?o&&this.mono:o&&!this.mono,!(!o||!this.match(e))&&(void 0!==i?(this.position===this.text.length-1||this.match(i,!1))&&this.unsetTag(t):this.unsetTag(t),!0)}replace(t,e){return!!this.match(t)&&(this.add(e),this.position+=length-1,!0)}prepareRegExp(t){let e,i;if(t instanceof RegExp)i=t,e=1;else{const o=ht[t];i=void 0!==o?o:new RegExp(t),e=t.length}return[i,e]}}class lt{constructor(t,e,i,o){this.ctx=t,this.parent=e,this.selected=i,this.hover=o;this.lines=new at((e,s)=>{if(void 0===e)return 0;const n=this.parent.getFormattingValues(t,i,o,s);let r=0;if(""!==e){r=this.ctx.measureText(e).width}return{width:r,values:n}})}process(t){if(!nt(t))return this.lines.finalize();const e=this.parent.fontOptions;t=(t=t.replace(/\r\n/g,"\n")).replace(/\r/g,"\n");const i=String(t).split("\n"),o=i.length;if(e.multi)for(let t=0;t<o;t++){const o=this.splitBlocks(i[t],e.multi);if(void 0!==o)if(0!==o.length){if(e.maxWdt>0)for(let t=0;t<o.length;t++){const e=o[t].mod,i=o[t].text;this.splitStringIntoLines(i,e,!0)}else for(let t=0;t<o.length;t++){const e=o[t].mod,i=o[t].text;this.lines.append(i,e)}this.lines.newLine()}else this.lines.newLine("")}else if(e.maxWdt>0)for(let t=0;t<o;t++)this.splitStringIntoLines(i[t]);else for(let t=0;t<o;t++)this.lines.newLine(i[t]);return this.lines.finalize()}decodeMarkupSystem(t){let e="none";return"markdown"===t||"md"===t?e="markdown":!0!==t&&"html"!==t||(e="html"),e}splitHtmlBlocks(t){const e=new dt(t),i=t=>{if(/&/.test(t)){return e.replace(e.text,"<","<")||e.replace(e.text,"&","&")||e.add("&"),!0}return!1};for(;e.position<e.text.length;){const t=e.text.charAt(e.position);e.parseWS(t)||/</.test(t)&&(e.parseStartTag("bold","<b>")||e.parseStartTag("ital","<i>")||e.parseStartTag("mono","<code>")||e.parseEndTag("bold","</b>")||e.parseEndTag("ital","</i>")||e.parseEndTag("mono","</code>"))||i(t)||e.add(t),e.position++}return e.emitBlock(),e.blocks}splitMarkdownBlocks(t){const e=new dt(t);let i=!0;const o=t=>!!/\\/.test(t)&&(e.position<this.text.length+1&&(e.position++,t=this.text.charAt(e.position),/ \t/.test(t)?e.spacing=!0:(e.add(t),i=!1)),!0);for(;e.position<e.text.length;){const t=e.text.charAt(e.position);e.parseWS(t)||o(t)||(i||e.spacing)&&(e.parseStartTag("bold","*")||e.parseStartTag("ital","_")||e.parseStartTag("mono","`"))||e.parseEndTag("bold","*","afterBold")||e.parseEndTag("ital","_","afterItal")||e.parseEndTag("mono","`","afterMono")||(e.add(t),i=!1),e.position++}return e.emitBlock(),e.blocks}splitBlocks(t,e){const i=this.decodeMarkupSystem(e);return"none"===i?[{text:t,mod:"normal"}]:"markdown"===i?this.splitMarkdownBlocks(t):"html"===i?this.splitHtmlBlocks(t):void 0}overMaxWidth(t){const e=this.ctx.measureText(t).width;return this.lines.curWidth()+e>this.parent.fontOptions.maxWdt}getLongestFit(t){let e="",i=0;for(;i<t.length;){const o=e+(""===e?"":" ")+t[i];if(this.overMaxWidth(o))break;e=o,i++}return i}getLongestFitWord(t){let e=0;for(;e<t.length&&!this.overMaxWidth(t.slice(0,e));)e++;return e}splitStringIntoLines(t,e="normal",i=!1){this.parent.getFormattingValues(this.ctx,this.selected,this.hover,e);let o=(t=(t=t.replace(/^( +)/g,"$1\r")).replace(/([^\r][^ ]*)( +)/g,"$1\r$2\r")).split("\r");for(;o.length>0;){let t=this.getLongestFit(o);if(0===t){const t=o[0],i=this.getLongestFitWord(t);this.lines.newLine(t.slice(0,i),e),o[0]=t.slice(i)}else{let s=t;" "===o[t-1]?t--:" "===o[s]&&s++;const n=o.slice(0,t).join("");t==o.length&&i?this.lines.append(n,e):this.lines.newLine(n,e),o=o.slice(s)}}}}const ct=["bold","ital","boldital","mono"];class pt{constructor(t,e,i=!1){this.body=t,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(e),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=i}setOptions(t){if(this.elementOptions=t,this.initFontOptions(t.font),nt(t.label)?this.labelDirty=!0:t.label=void 0,void 0!==t.font&&null!==t.font)if("string"==typeof t.font)this.baseSize=this.fontOptions.size;else if("object"==typeof t.font){const e=t.font.size;void 0!==e&&(this.baseSize=e)}}initFontOptions(t){i.forEach(ct,t=>{this.fontOptions[t]={}}),pt.parseFontString(this.fontOptions,t)?this.fontOptions.vadjust=0:i.forEach(t,(t,e)=>{null!=t&&"object"!=typeof t&&(this.fontOptions[e]=t)})}static parseFontString(t,e){if(!e||"string"!=typeof e)return!1;const i=e.split(" ");return t.size=+i[0].replace("px",""),t.face=i[1],t.color=i[2],!0}constrain(t){const e={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:"middle"},o=i.topMost(t,"widthConstraint");if("number"==typeof o)e.maxWdt=Number(o),e.minWdt=Number(o);else if("object"==typeof o){const o=i.topMost(t,["widthConstraint","maximum"]);"number"==typeof o&&(e.maxWdt=Number(o));const s=i.topMost(t,["widthConstraint","minimum"]);"number"==typeof s&&(e.minWdt=Number(s))}const s=i.topMost(t,"heightConstraint");if("number"==typeof s)e.minHgt=Number(s);else if("object"==typeof s){const o=i.topMost(t,["heightConstraint","minimum"]);"number"==typeof o&&(e.minHgt=Number(o));const s=i.topMost(t,["heightConstraint","valign"]);"string"==typeof s&&("top"!==s&&"bottom"!==s||(e.valign=s))}return e}update(t,e){this.setOptions(t,!0),this.propagateFonts(e),i.deepExtend(this.fontOptions,this.constrain(e)),this.fontOptions.chooser=ot("label",e)}adjustSizes(t){const e=t?t.right+t.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=e,this.fontOptions.minWdt-=e);const i=t?t.top+t.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=i)}addFontOptionsToPile(t,e){for(let i=0;i<e.length;++i)this.addFontToPile(t,e[i])}addFontToPile(t,e){if(void 0===e)return;if(void 0===e.font||null===e.font)return;const i=e.font;t.push(i)}getBasicOptions(t){const e={};for(let o=0;o<t.length;++o){let s=t[o];const n={};pt.parseFontString(n,s)&&(s=n),i.forEach(s,(t,i)=>{void 0!==t&&(Object.prototype.hasOwnProperty.call(e,i)||(-1!==ct.indexOf(i)?e[i]={}:e[i]=t))})}return e}getFontOption(t,e,i){let o;for(let s=0;s<t.length;++s){const n=t[s];if(Object.prototype.hasOwnProperty.call(n,e)){if(o=n[e],null==o)continue;const t={};if(pt.parseFontString(t,o)&&(o=t),Object.prototype.hasOwnProperty.call(o,i))return o[i]}}if(Object.prototype.hasOwnProperty.call(this.fontOptions,i))return this.fontOptions[i];throw new Error("Did not find value for multi-font for property: '"+i+"'")}getFontOptions(t,e){const i={},o=["color","size","face","mod","vadjust"];for(let s=0;s<o.length;++s){const n=o[s];i[n]=this.getFontOption(t,e,n)}return i}propagateFonts(t){const e=[];this.addFontOptionsToPile(e,t),this.fontOptions=this.getBasicOptions(e);for(let t=0;t<ct.length;++t){const o=ct[t],s=this.fontOptions[o],n=this.getFontOptions(e,o);i.forEach(n,(t,e)=>{s[e]=t}),s.size=Number(s.size),s.vadjust=Number(s.vadjust)}}draw(t,e,i,o,s,n="middle"){if(void 0===this.elementOptions.label)return;let r=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&r<this.elementOptions.scaling.label.drawThreshold-1||(r>=this.elementOptions.scaling.label.maxVisible&&(r=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(t,o,s,e,i,n),this._drawBackground(t),this._drawText(t,e,this.size.yLine,n,r))}_drawBackground(t){if(void 0!==this.fontOptions.background&&"none"!==this.fontOptions.background){t.fillStyle=this.fontOptions.background;const e=this.getSize();t.fillRect(e.left,e.top,e.width,e.height)}}_drawText(t,e,i,o="middle",s){[e,i]=this._setAlignment(t,e,i,o),t.textAlign="left",e-=this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&("top"===this.fontOptions.valign&&(i-=(this.size.height-this.size.labelHeight)/2),"bottom"===this.fontOptions.valign&&(i+=(this.size.height-this.size.labelHeight)/2));for(let o=0;o<this.lineCount;o++){const n=this.lines[o];if(n&&n.blocks){let o=0;this.isEdgeLabel||"center"===this.fontOptions.align?o+=(this.size.width-n.width)/2:"right"===this.fontOptions.align&&(o+=this.size.width-n.width);for(let r=0;r<n.blocks.length;r++){const a=n.blocks[r];t.font=a.font;const[h,d]=this._getColor(a.color,s,a.strokeColor);a.strokeWidth>0&&(t.lineWidth=a.strokeWidth,t.strokeStyle=d,t.lineJoin="round"),t.fillStyle=h,a.strokeWidth>0&&t.strokeText(a.text,e+o,i+a.vadjust),t.fillText(a.text,e+o,i+a.vadjust),o+=a.width}i+=n.height}}}_setAlignment(t,e,i,o){if(this.isEdgeLabel&&"horizontal"!==this.fontOptions.align&&!1===this.pointToSelf){e=0,i=0;const o=2;"top"===this.fontOptions.align?(t.textBaseline="alphabetic",i-=2*o):"bottom"===this.fontOptions.align?(t.textBaseline="hanging",i+=2*o):t.textBaseline="middle"}else t.textBaseline=o;return[e,i]}_getColor(t,e,o){let s=t||"#000000",n=o||"#ffffff";if(e<=this.elementOptions.scaling.label.drawThreshold){const t=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-e)));s=i.overrideOpacity(s,t),n=i.overrideOpacity(n,t)}return[s,n]}getTextSize(t,e=!1,i=!1){return this._processLabel(t,e,i),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}getSize(){let t=this.size.left,e=this.size.top-1;if(this.isEdgeLabel){const i=.5*-this.size.width;switch(this.fontOptions.align){case"middle":t=i,e=.5*-this.size.height;break;case"top":t=i,e=-(this.size.height+2);break;case"bottom":t=i,e=2}}return{left:t,top:e,width:this.size.width,height:this.size.height}}calculateLabelSize(t,e,i,o=0,s=0,n="middle"){this._processLabel(t,e,i),this.size.left=o-.5*this.size.width,this.size.top=s-.5*this.size.height,this.size.yLine=s+.5*(1-this.lineCount)*this.fontOptions.size,"hanging"===n&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}getFormattingValues(t,e,i,o){const s=function(t,e,i){return"normal"===e?"mod"===i?"":t[i]:void 0!==t[e][i]?t[e][i]:t[i]},n={color:s(this.fontOptions,o,"color"),size:s(this.fontOptions,o,"size"),face:s(this.fontOptions,o,"face"),mod:s(this.fontOptions,o,"mod"),vadjust:s(this.fontOptions,o,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(e||i)&&("normal"===o&&!0===this.fontOptions.chooser&&this.elementOptions.labelHighlightBold?n.mod="bold":"function"==typeof this.fontOptions.chooser&&this.fontOptions.chooser(n,this.elementOptions.id,e,i));let r="";return void 0!==n.mod&&""!==n.mod&&(r+=n.mod+" "),r+=n.size+"px "+n.face,t.font=r.replace(/"/g,""),n.font=t.font,n.height=n.size,n}differentState(t,e){return t!==this.selectedState||e!==this.hoverState}_processLabelText(t,e,i,o){return new lt(t,this,e,i).process(o)}_processLabel(t,e,i){if(!1===this.labelDirty&&!this.differentState(e,i))return;const o=this._processLabelText(t,e,i,this.elementOptions.label);this.fontOptions.minWdt>0&&o.width<this.fontOptions.minWdt&&(o.width=this.fontOptions.minWdt),this.size.labelHeight=o.height,this.fontOptions.minHgt>0&&o.height<this.fontOptions.minHgt&&(o.height=this.fontOptions.minHgt),this.lines=o.lines,this.lineCount=o.lines.length,this.size.width=o.width,this.size.height=o.height,this.selectedState=e,this.hoverState=i,this.labelDirty=!1}visible(){if(0===this.size.width||0===this.size.height||void 0===this.elementOptions.label)return!1;return!(this.fontOptions.size*this.body.view.scale<this.elementOptions.scaling.label.drawThreshold-1)}}class ut{constructor(t,e,i){this.body=e,this.labelModule=i,this.setOptions(t),this.top=void 0,this.left=void 0,this.height=void 0,this.width=void 0,this.radius=void 0,this.margin=void 0,this.refreshNeeded=!0,this.boundingBox={top:0,left:0,right:0,bottom:0}}setOptions(t){this.options=t}_setMargins(t){this.margin={},this.options.margin&&("object"==typeof this.options.margin?(this.margin.top=this.options.margin.top,this.margin.right=this.options.margin.right,this.margin.bottom=this.options.margin.bottom,this.margin.left=this.options.margin.left):(this.margin.top=this.options.margin,this.margin.right=this.options.margin,this.margin.bottom=this.options.margin,this.margin.left=this.options.margin)),t.adjustSizes(this.margin)}_distanceToBorder(t,e){const i=this.options.borderWidth;return t&&this.resize(t),Math.min(Math.abs(this.width/2/Math.cos(e)),Math.abs(this.height/2/Math.sin(e)))+i}enableShadow(t,e){e.shadow&&(t.shadowColor=e.shadowColor,t.shadowBlur=e.shadowSize,t.shadowOffsetX=e.shadowX,t.shadowOffsetY=e.shadowY)}disableShadow(t,e){e.shadow&&(t.shadowColor="rgba(0,0,0,0)",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0)}enableBorderDashes(t,e){if(!1!==e.borderDashes)if(void 0!==t.setLineDash){let i=e.borderDashes;!0===i&&(i=[5,15]),t.setLineDash(i)}else console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."),this.options.shapeProperties.borderDashes=!1,e.borderDashes=!1}disableBorderDashes(t,e){!1!==e.borderDashes&&(void 0!==t.setLineDash?t.setLineDash([0]):(console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."),this.options.shapeProperties.borderDashes=!1,e.borderDashes=!1))}needsRefresh(t,e){return!0===this.refreshNeeded?(this.refreshNeeded=!1,!0):void 0===this.width||this.labelModule.differentState(t,e)}initContextForDraw(t,e){const i=e.borderWidth/this.body.view.scale;t.lineWidth=Math.min(this.width,i),t.strokeStyle=e.borderColor,t.fillStyle=e.color}performStroke(t,e){const i=e.borderWidth/this.body.view.scale;t.save(),i>0&&(this.enableBorderDashes(t,e),t.stroke(),this.disableBorderDashes(t,e)),t.restore()}performFill(t,e){t.save(),t.fillStyle=e.color,this.enableShadow(t,e),t.fill(),this.disableShadow(t,e),t.restore(),this.performStroke(t,e)}_addBoundingBoxMargin(t){this.boundingBox.left-=t,this.boundingBox.top-=t,this.boundingBox.bottom+=t,this.boundingBox.right+=t}_updateBoundingBox(t,e,i,o,s){void 0!==i&&this.resize(i,o,s),this.left=t-this.width/2,this.top=e-this.height/2,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}updateBoundingBox(t,e,i,o,s){this._updateBoundingBox(t,e,i,o,s)}getDimensionsFromLabel(t,e,i){this.textSize=this.labelModule.getTextSize(t,e,i);let o=this.textSize.width,s=this.textSize.height;return 0===o&&(o=14,s=14),{width:o,height:s}}}class gt extends ut{constructor(t,e,i){super(t,e,i),this._setMargins(i)}resize(t,e=this.selected,i=this.hover){if(this.needsRefresh(e,i)){const o=this.getDimensionsFromLabel(t,e,i);this.width=o.width+this.margin.right+this.margin.left,this.height=o.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}draw(t,e,i,o,s,n){this.resize(t,o,s),this.left=e-this.width/2,this.top=i-this.height/2,this.initContextForDraw(t,n),l(t,this.left,this.top,this.width,this.height,n.borderRadius),this.performFill(t,n),this.updateBoundingBox(e,i,t,o,s),this.labelModule.draw(t,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,o,s)}updateBoundingBox(t,e,i,o,s){this._updateBoundingBox(t,e,i,o,s);const n=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(n)}distanceToBorder(t,e){t&&this.resize(t);const i=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(e)),Math.abs(this.height/2/Math.sin(e)))+i}}class bt extends ut{constructor(t,e,i){super(t,e,i),this.labelOffset=0,this.selected=!1}setOptions(t,e,i){this.options=t,void 0===e&&void 0===i||this.setImages(e,i)}setImages(t,e){e&&this.selected?(this.imageObj=e,this.imageObjAlt=t):(this.imageObj=t,this.imageObjAlt=e)}switchImages(t){const e=t&&!this.selected||!t&&this.selected;if(this.selected=t,void 0!==this.imageObjAlt&&e){const t=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=t}}_getImagePadding(){const t={top:0,right:0,bottom:0,left:0};if(this.options.imagePadding){const e=this.options.imagePadding;"object"==typeof e?(t.top=e.top,t.right=e.right,t.bottom=e.bottom,t.left=e.left):(t.top=e,t.right=e,t.bottom=e,t.left=e)}return t}_resizeImage(){let t,e;if(!1===this.options.shapeProperties.useImageSize){let i=1,o=1;this.imageObj.width&&this.imageObj.height&&(this.imageObj.width>this.imageObj.height?i=this.imageObj.width/this.imageObj.height:o=this.imageObj.height/this.imageObj.width),t=2*this.options.size*i,e=2*this.options.size*o}else{const i=this._getImagePadding();t=this.imageObj.width+i.left+i.right,e=this.imageObj.height+i.top+i.bottom}this.width=t,this.height=e,this.radius=.5*this.width}_drawRawCircle(t,e,i,o){this.initContextForDraw(t,o),d(t,e,i,o.size),this.performFill(t,o)}_drawImageAtPosition(t,e){if(0!=this.imageObj.width){t.globalAlpha=void 0!==e.opacity?e.opacity:1,this.enableShadow(t,e);let i=1;!0===this.options.shapeProperties.interpolation&&(i=this.imageObj.width/this.width/this.body.view.scale);const o=this._getImagePadding(),s=this.left+o.left,n=this.top+o.top,r=this.width-o.left-o.right,a=this.height-o.top-o.bottom;this.imageObj.drawImageAtPosition(t,i,s,n,r,a),this.disableShadow(t,e)}}_drawImageLabel(t,e,i,o,s){let n=0;if(void 0!==this.height){n=.5*this.height;const e=this.labelModule.getTextSize(t,o,s);e.lineCount>=1&&(n+=e.height/2)}const r=i+n;this.options.label&&(this.labelOffset=n),this.labelModule.draw(t,e,r,o,s,"hanging")}}class mt extends bt{constructor(t,e,i){super(t,e,i),this._setMargins(i)}resize(t,e=this.selected,i=this.hover){if(this.needsRefresh(e,i)){const o=this.getDimensionsFromLabel(t,e,i),s=Math.max(o.width+this.margin.right+this.margin.left,o.height+this.margin.top+this.margin.bottom);this.options.size=s/2,this.width=s,this.height=s,this.radius=this.width/2}}draw(t,e,i,o,s,n){this.resize(t,o,s),this.left=e-this.width/2,this.top=i-this.height/2,this._drawRawCircle(t,e,i,n),this.updateBoundingBox(e,i),this.labelModule.draw(t,this.left+this.textSize.width/2+this.margin.left,i,o,s)}updateBoundingBox(t,e){this.boundingBox.top=e-this.options.size,this.boundingBox.left=t-this.options.size,this.boundingBox.right=t+this.options.size,this.boundingBox.bottom=e+this.options.size}distanceToBorder(t,e){return t&&this.resize(t),.5*this.width}}class ft extends bt{constructor(t,e,i,o,s){super(t,e,i),this.setImages(o,s)}resize(t,e=this.selected,i=this.hover){if(void 0===this.imageObj.src||void 0===this.imageObj.width||void 0===this.imageObj.height){const t=2*this.options.size;return this.width=t,this.height=t,void(this.radius=.5*this.width)}this.needsRefresh(e,i)&&this._resizeImage()}draw(t,e,i,o,s,n){this.switchImages(o),this.resize();let r=e,a=i;"top-left"===this.options.shapeProperties.coordinateOrigin?(this.left=e,this.top=i,r+=this.width/2,a+=this.height/2):(this.left=e-this.width/2,this.top=i-this.height/2),this._drawRawCircle(t,r,a,n),t.save(),t.clip(),this._drawImageAtPosition(t,n),t.restore(),this._drawImageLabel(t,r,a,o,s),this.updateBoundingBox(e,i)}updateBoundingBox(t,e){"top-left"===this.options.shapeProperties.coordinateOrigin?(this.boundingBox.top=e,this.boundingBox.left=t,this.boundingBox.ri