From e1a6be0836cbf38c9143526f3f736aa1b572047b Mon Sep 17 00:00:00 2001 From: Fedorov Vladimir Date: Sat, 6 Dec 2025 16:59:13 +0700 Subject: [PATCH] fix graph --- .../{index-ByEcXhLz.js => index-BzJgtw31.js} | 2 +- ...{index-CcF8a8OC.css => index-CpjiKclx.css} | 2 +- cmd/evening_detective/static/admin/index.html | 4 +- data/story/story.json | 164 +++++++++++++++++- 4 files changed, 167 insertions(+), 5 deletions(-) rename cmd/evening_detective/static/admin/assets/{index-ByEcXhLz.js => index-BzJgtw31.js} (99%) rename cmd/evening_detective/static/admin/assets/{index-CcF8a8OC.css => index-CpjiKclx.css} (96%) diff --git a/cmd/evening_detective/static/admin/assets/index-ByEcXhLz.js b/cmd/evening_detective/static/admin/assets/index-BzJgtw31.js similarity index 99% rename from cmd/evening_detective/static/admin/assets/index-ByEcXhLz.js rename to cmd/evening_detective/static/admin/assets/index-BzJgtw31.js index a4d55b6..aa71f4b 100644 --- a/cmd/evening_detective/static/admin/assets/index-ByEcXhLz.js +++ b/cmd/evening_detective/static/admin/assets/index-BzJgtw31.js @@ -112,4 +112,4 @@ Minimum version required to store current data is: `+R+`. `,vt()):he+=Ee,vt();if(Ee!='"')throw Nt('End of string " expected');vt(),Ht=Mt.IDENTIFIER;return}for(Ht=Mt.UNKNOWN;Ee!="";)he+=Ee,vt();throw new SyntaxError('Syntax error in part "'+E5(he,30)+'"')}function uZ(){var r={};if(sZ(),Ve(),he==="strict"&&(r.strict=!0,Ve()),(he==="graph"||he==="digraph")&&(r.type=he,Ve()),Ht===Mt.IDENTIFIER&&(r.id=he,Ve()),he!="{")throw Nt("Angle bracket { expected");if(Ve(),b5(r),he!="}")throw Nt("Angle bracket } expected");if(Ve(),he!=="")throw Nt("End of file expected");return Ve(),delete r.node,delete r.edge,delete r.graph,r}function b5(r){for(;he!==""&&he!="}";)lZ(r),he===";"&&Ve()}function lZ(r){var e=_5(r);if(e){w5(r,e);return}var t=cZ(r);if(!t){if(Ht!=Mt.IDENTIFIER)throw Nt("Identifier expected");var i=he;if(Ve(),he==="="){if(Ve(),Ht!=Mt.IDENTIFIER)throw Nt("Identifier expected");r[i]=he,Ve()}else dZ(r,i)}}function _5(r){var e=null;if(he==="subgraph"&&(e={},e.type="subgraph",Ve(),Ht===Mt.IDENTIFIER&&(e.id=he,Ve())),he==="{"){if(Ve(),e||(e={}),e.parent=r,e.node=r.node,e.edge=r.edge,e.graph=r.graph,b5(e),he!="}")throw Nt("Angle bracket } expected");Ve(),delete e.node,delete e.edge,delete e.graph,delete e.parent,r.subgraphs||(r.subgraphs=[]),r.subgraphs.push(e)}return e}function cZ(r){return he==="node"?(Ve(),r.node=bo(),"node"):he==="edge"?(Ve(),r.edge=bo(),"edge"):he==="graph"?(Ve(),r.graph=bo(),"graph"):null}function dZ(r,e){var t={id:e},i=bo();i&&(t.attr=i),m5(r,t),w5(r,e)}function w5(r,e){for(;he==="->"||he==="--";){var t,i=he;Ve();var n=_5(r);if(n)t=n;else{if(Ht!=Mt.IDENTIFIER)throw Nt("Identifier or subgraph expected");t=he,m5(r,{id:t}),Ve()}var s=bo(),o=y5(r,e,t,i,s);aZ(r,o),e=t}}function bo(){for(var r,e=null,t={dashed:!0,solid:!1,dotted:[1,5]},i={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,s=new Array;he==="[";){for(Ve(),e={};he!==""&&he!="]";){if(Ht!=Mt.IDENTIFIER)throw Nt("Attribute name expected");var o=he;if(Ve(),he!="=")throw Nt("Equal sign = expected");if(Ve(),Ht!=Mt.IDENTIFIER)throw Nt("Attribute value expected");var a=he;o==="style"&&(a=t[a]);var u;o==="arrowhead"&&(u=i[a],o="arrows",a={to:{enabled:!0,type:u}}),o==="arrowtail"&&(u=i[a],o="arrows",a={from:{enabled:!0,type:u}}),n.push({attr:e,name:o,value:a}),s.push(o),Ve(),he==","&&Ve()}if(he!="]")throw Nt("Bracket ] expected");Ve()}if(Ii(s).call(s,"dir")){var l={};for(l.arrows={},r=0;r"&&(a.arrows="to"),a};Le(n=e.edges).call(n,function(o){var a,u;if(o.from instanceof Object?a=o.from.nodes:a={id:o.from},o.to instanceof Object?u=o.to.nodes:u={id:o.to},o.from instanceof Object&&o.from.edges){var l;Le(l=o.from.edges).call(l,function(d){var h=s(d);t.edges.push(h)})}if(hZ(a,u,function(d,h){var f=y5(t,d.id,h.id,o.type,o.attr),p=s(f);t.edges.push(p)}),o.to instanceof Object&&o.to.edges){var c;Le(c=o.to.edges).call(c,function(d){var h=s(d);t.edges.push(h)})}})}return e.attr&&(t.options=e.attr),t}function pZ(r,e){var t;const i={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};e!=null&&(e.fixed!=null&&(i.nodes.fixed=e.fixed),e.parseColor!=null&&(i.nodes.parseColor=e.parseColor),e.inheritColor!=null&&(i.edges.inheritColor=e.inheritColor));const n=r.edges,s=ms(n).call(n,a=>{const u={from:a.source,id:a.id,to:a.target};return a.attributes!=null&&(u.attributes=a.attributes),a.label!=null&&(u.label=a.label),a.attributes!=null&&a.attributes.title!=null&&(u.title=a.attributes.title),a.type==="Directed"&&(u.arrows="to"),a.color&&i.edges.inheritColor===!1&&(u.color=a.color),u});return{nodes:ms(t=r.nodes).call(t,a=>{const u={id:a.id,fixed:i.nodes.fixed&&a.x!=null&&a.y!=null};return a.attributes!=null&&(u.attributes=a.attributes),a.label!=null&&(u.label=a.label),a.size!=null&&(u.size=a.size),a.attributes!=null&&a.attributes.title!=null&&(u.title=a.attributes.title),a.title!=null&&(u.title=a.title),a.x!=null&&(u.x=a.x),a.y!=null&&(u.y=a.y),a.color!=null&&(i.nodes.parseColor===!0?u.color=a.color:u.color={background:a.color,border:a.color,highlight:{background:a.color,border:a.color},hover:{background:a.color,border:a.color}}),u}),edges:s}}const vZ={addDescription:"Click in an empty space to place a new node.",addEdge:"Add Edge",addNode:"Add Node",back:"Back",close:"Close",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"},gZ={addDescription:"Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.",addEdge:"Kante hinzufügen",addNode:"Knoten hinzufügen",back:"Zurück",close:"Schließen",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"},mZ={addDescription:"Haga clic en un lugar vacío para colocar un nuevo nodo.",addEdge:"Añadir arista",addNode:"Añadir nodo",back:"Atrás",close:"Cerrar",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"},yZ={addDescription:"Clicca per aggiungere un nuovo nodo",addEdge:"Aggiungi un vertice",addNode:"Aggiungi un nodo",back:"Indietro",close:"Chiudere",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"},bZ={addDescription:"Klik op een leeg gebied om een nieuwe node te maken.",addEdge:"Link toevoegen",addNode:"Node toevoegen",back:"Terug",close:"Sluiten",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"},_Z={addDescription:"Clique em um espaço em branco para adicionar um novo nó",addEdge:"Adicionar aresta",addNode:"Adicionar nó",back:"Voltar",close:"Fechar",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ó"},wZ={addDescription:"Кликните в свободное место, чтобы добавить новый узел.",addEdge:"Добавить ребро",addNode:"Добавить узел",back:"Назад",close:"Закрывать",createEdgeError:"Невозможно соединить ребра в кластер.",del:"Удалить выбранное",deleteClusterError:"Кластеры не могут быть удалены",edgeDescription:"Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.",edit:"Редактировать",editClusterError:"Кластеры недоступны для редактирования.",editEdge:"Редактировать ребро",editEdgeDescription:"Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.",editNode:"Редактировать узел"},EZ={addDescription:"单击空白处放置新节点。",addEdge:"添加连接线",addNode:"添加节点",back:"返回",close:"關閉",createEdgeError:"无法将连接线连接到群集。",del:"删除选定",deleteClusterError:"无法删除群集。",edgeDescription:"单击某个节点并将该连接线拖动到另一个节点以连接它们。",edit:"编辑",editClusterError:"无法编辑群集。",editEdge:"编辑连接线",editEdgeDescription:"单击控制节点并将它们拖到节点上连接。",editNode:"编辑节点"},SZ={addDescription:"Kлікніть на вільне місце, щоб додати новий вузол.",addEdge:"Додати край",addNode:"Додати вузол",back:"Назад",close:"Закрити",createEdgeError:"Не можливо об'єднати краї в групу.",del:"Видалити обране",deleteClusterError:"Групи не можуть бути видалені.",edgeDescription:"Клікніть на вузол і перетягніть край до іншого вузла, щоб їх з'єднати.",edit:"Редагувати",editClusterError:"Групи недоступні для редагування.",editEdge:"Редагувати край",editEdgeDescription:"Клікніть на контрольні точки і перетягніть їх у вузол, щоб підключитися до нього.",editNode:"Редагувати вузол"},OZ={addDescription:"Cliquez dans un endroit vide pour placer un nœud.",addEdge:"Ajouter un lien",addNode:"Ajouter un nœud",back:"Retour",close:"Fermer",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"},IZ={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",close:"Zavří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"};var TZ=Object.freeze({__proto__:null,cn:EZ,cs:IZ,de:gZ,en:vZ,es:mZ,fr:OZ,it:yZ,nl:bZ,pt:_Z,ru:wZ,uk:SZ});function $Z(r,e){try{const[i,n]=e.split(/[-_ /]/,2),s=i!=null?i.toLowerCase():null,o=n!=null?n.toUpperCase():null;if(s&&o){const a=s+"-"+o;if(Object.prototype.hasOwnProperty.call(r,a))return a;var t;console.warn(JX(t="Unknown variant ".concat(o," of language ")).call(t,s,"."))}if(s){const a=s;if(Object.prototype.hasOwnProperty.call(r,a))return a;console.warn("Unknown language ".concat(s))}return console.warn("Unknown locale ".concat(e,", falling back to English.")),"en"}catch(i){return console.error(i),console.warn("Unexpected error while normalizing locale ".concat(e,", falling back to English.")),"en"}}class PZ{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 e=this.image.width,t=this.image.height;this.width=e,this.height=t;const i=Math.floor(t/2),n=Math.floor(t/4),s=Math.floor(t/8),o=Math.floor(t/16),a=Math.floor(e/2),u=Math.floor(e/4),l=Math.floor(e/8),c=Math.floor(e/16);this.canvas.width=3*u,this.canvas.height=i,this.coordinates=[[0,0,a,i],[a,0,u,n],[a,n,l,s],[5*l,n,c,o]],this._fillMipMap()}initialized(){return this.coordinates!==void 0}_fillMipMap(){const e=this.canvas.getContext("2d"),t=this.coordinates[0];e.drawImage(this.image,t[0],t[1],t[2],t[3]);for(let i=1;i2){t*=.5;let a=0;for(;t>2&&a=this.NUM_ITERATIONS&&(a=this.NUM_ITERATIONS-1);const u=this.coordinates[a];e.drawImage(this.canvas,u[0],u[1],u[2],u[3],i,n,s,o)}else e.drawImage(this.image,i,n,s,o)}}class RZ{constructor(e){this.images={},this.imageBroken={},this.callback=e}_tryloadBrokenUrl(e,t,i){if(!(e===void 0||i===void 0)){if(t===void 0){console.warn("No broken url image defined");return}i.image.onerror=()=>{console.error("Could not load brokenImage:",t)},i.image.src=t}}_redrawWithImage(e){this.callback&&this.callback(e)}load(e,t){const i=this.images[e];if(i)return i;const n=new PZ;return this.images[e]=n,n.image.onload=()=>{this._fixImageCoordinates(n.image),n.init(),this._redrawWithImage(n)},n.image.onerror=()=>{console.error("Could not load image:",e),this._tryloadBrokenUrl(e,t,n)},n.image.src=e,n}_fixImageCoordinates(e){e.width===0&&(document.body.appendChild(e),e.width=e.offsetWidth,e.height=e.offsetHeight,document.body.removeChild(e))}}var fF={},pF={},Zy={exports:{}},eb,vF;function CZ(){if(vF)return eb;vF=1;var r=$e();return eb=r(function(){if(typeof ArrayBuffer=="function"){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}}),eb}var tb,gF;function xZ(){if(gF)return tb;gF=1;var r=$e(),e=Et(),t=Br(),i=CZ(),n=Object.isExtensible,s=r(function(){});return tb=s||i?function(a){return!e(a)||i&&t(a)==="ArrayBuffer"?!1:n?n(a):!0}:n,tb}var rb,mF;function S5(){if(mF)return rb;mF=1;var r=$e();return rb=!r(function(){return Object.isExtensible(Object.preventExtensions({}))}),rb}var yF;function nl(){if(yF)return Zy.exports;yF=1;var r=ce(),e=Ce(),t=da(),i=Et(),n=It(),s=cr().f,o=Qu(),a=t0(),u=xZ(),l=Uu(),c=S5(),d=!1,h=l("meta"),f=0,p=function(y){s(y,h,{value:{objectID:"O"+f++,weakData:{}}})},v=function(y,S){if(!i(y))return typeof y=="symbol"?y:(typeof y=="string"?"S":"P")+y;if(!n(y,h)){if(!u(y))return"F";if(!S)return"E";p(y)}return y[h].objectID},b=function(y,S){if(!n(y,h)){if(!u(y))return!0;if(!S)return!1;p(y)}return y[h].weakData},m=function(y){return c&&d&&u(y)&&!n(y,h)&&p(y),y},g=function(){w.enable=function(){},d=!0;var y=o.f,S=e([].splice),O={};O[h]=1,y(O).length&&(o.f=function(I){for(var _=y(I),E=0,T=_.length;E_;_++)if(T=D(f[_]),T&&o(h,T))return T;return new d(!1)}O=a(f,I)}for(R=g?f.next:O.next;!(x=e(R,O)).done;){try{T=D(x.value)}catch(j){l(O,"throw",j)}if(typeof T=="object"&&T&&o(h,T))return T}return new d(!1)},ab}var ub,OF;function y0(){if(OF)return ub;OF=1;var r=dt(),e=TypeError;return ub=function(t,i){if(r(i,t))return t;throw new e("Incorrect invocation")},ub}var lb,IF;function b0(){if(IF)return lb;IF=1;var r=ce(),e=Ye(),t=nl(),i=$e(),n=Bs(),s=sl(),o=y0(),a=wt(),u=Et(),l=Ds(),c=qn(),d=cr().f,h=Hi().forEach,f=rt(),p=Dn(),v=p.set,b=p.getterFor;return lb=function(m,g,w){var y=m.indexOf("Map")!==-1,S=m.indexOf("Weak")!==-1,O=y?"set":"add",I=e[m],_=I&&I.prototype,E={},T;if(!f||!a(I)||!(S||_.forEach&&!i(function(){new I().entries().next()})))T=w.getConstructor(g,m,y,O),t.enable();else{T=g(function(C,D){v(o(C,R),{type:m,collection:new I}),l(D)||s(D,C[O],{that:C,AS_ENTRIES:y})});var R=T.prototype,x=b(m);h(["add","clear","delete","forEach","get","has","set","keys","values","entries"],function(C){var D=C==="add"||C==="set";C in _&&!(S&&C==="clear")&&n(R,C,function(j,ee){var H=x(this).collection;if(!D&&S&&!u(j))return C==="get"?void 0:!1;var Z=H[C](j===0?0:j,ee);return D?this:Z})}),S||d(R,"size",{configurable:!0,get:function(){return x(this).collection.size}})}return c(T,m,!1,!0),E[m]=T,r({global:!0,forced:!0},E),S||w.setStrong(T,m,y),T},lb}var cb,TF;function _0(){if(TF)return cb;TF=1;var r=va();return cb=function(e,t,i){for(var n in t)i&&i.unsafe&&e[n]?e[n]=t[n]:r(e,n,t[n],i);return e},cb}var db,$F;function AZ(){if($F)return db;$F=1;var r=tr(),e=r0(),t=ht(),i=rt(),n=t("species");return db=function(s){var o=r(s);i&&o&&!o[n]&&e(o,n,{configurable:!0,get:function(){return this}})},db}var hb,PF;function I5(){if(PF)return hb;PF=1;var r=pa(),e=r0(),t=_0(),i=Ku(),n=y0(),s=Ds(),o=sl(),a=n0(),u=s0(),l=AZ(),c=rt(),d=nl().fastKey,h=Dn(),f=h.set,p=h.getterFor;return hb={getConstructor:function(v,b,m,g){var w=v(function(_,E){n(_,y),f(_,{type:b,index:r(null),first:null,last:null,size:0}),c||(_.size=0),s(E)||o(E,_[g],{that:_,AS_ENTRIES:m})}),y=w.prototype,S=p(b),O=function(_,E,T){var R=S(_),x=I(_,E),C,D;return x?x.value=T:(R.last=x={index:D=d(E,!0),key:E,value:T,previous:C=R.last,next:null,removed:!1},R.first||(R.first=x),C&&(C.next=x),c?R.size++:_.size++,D!=="F"&&(R.index[D]=x)),_},I=function(_,E){var T=S(_),R=d(E),x;if(R!=="F")return T.index[R];for(x=T.first;x;x=x.next)if(x.key===E)return x};return t(y,{clear:function(){for(var E=this,T=S(E),R=T.first;R;)R.removed=!0,R.previous&&(R.previous=R.previous.next=null),R=R.next;T.first=T.last=null,T.index=r(null),c?T.size=0:E.size=0},delete:function(_){var E=this,T=S(E),R=I(E,_);if(R){var x=R.next,C=R.previous;delete T.index[R.index],R.removed=!0,C&&(C.next=x),x&&(x.previous=C),T.first===R&&(T.first=x),T.last===R&&(T.last=C),c?T.size--:E.size--}return!!R},forEach:function(E){for(var T=S(this),R=i(E,arguments.length>1?arguments[1]:void 0),x;x=x?x.next:T.first;)for(R(x.value,x.key,this);x&&x.removed;)x=x.previous},has:function(E){return!!I(this,E)}}),t(y,m?{get:function(E){var T=I(this,E);return T&&T.value},set:function(E,T){return O(this,E===0?0:E,T)}}:{add:function(E){return O(this,E=E===0?0:E,E)}}),c&&e(y,"size",{configurable:!0,get:function(){return S(this).size}}),w},setStrong:function(v,b,m){var g=b+" Iterator",w=p(b),y=p(g);a(v,b,function(S,O){f(this,{type:g,target:S,state:w(S),kind:O,last:null})},function(){for(var S=y(this),O=S.kind,I=S.last;I&&I.removed;)I=I.previous;return!S.target||!(S.last=I=I?I.next:S.state.first)?(S.target=null,u(void 0,!0)):u(O==="keys"?I.key:O==="values"?I.value:[I.key,I.value],!1)},m?"entries":"values",!m,!0),l(b)}},hb}var RF;function MZ(){if(RF)return pF;RF=1;var r=b0(),e=I5();return r("Map",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},e),pF}var CF;function NZ(){return CF||(CF=1,MZ()),fF}var xF={},fb,qF;function T5(){return qF||(qF=1,fb=function(r,e){return e===1?function(t,i){return t[r](i)}:function(t,i,n){return t[r](i,n)}}),fb}var pb,DF;function FZ(){if(DF)return pb;DF=1;var r=tr(),e=T5(),t=r("Map");return pb={Map:t,set:e("set",2),get:e("get",1),has:e("has",1),remove:e("delete",1),proto:t.prototype},pb}var AF;function kZ(){if(AF)return xF;AF=1;var r=ce(),e=Ce(),t=li(),i=ui(),n=sl(),s=FZ(),o=Fs(),a=$e(),u=s.Map,l=s.has,c=s.get,d=s.set,h=e([].push),f=o||a(function(){return u.groupBy("ab",function(p){return p}).get("a").length!==1});return r({target:"Map",stat:!0,forced:o||f},{groupBy:function(v,b){i(v),t(b);var m=new u,g=0;return n(v,function(w){var y=b(w,g++);l(m,y)?h(c(m,y),w):d(m,y,[w])}),m}}),xF}var MF={},vb,NF;function BZ(){if(NF)return vb;NF=1;var r=Ce(),e=js(),t=dr(),i=ui(),n=r("".charAt),s=r("".charCodeAt),o=r("".slice),a=function(u){return function(l,c){var d=t(i(l)),h=e(c),f=d.length,p,v;return h<0||h>=f?u?"":void 0:(p=s(d,h),p<55296||p>56319||h+1===f||(v=s(d,h+1))<56320||v>57343?u?n(d,h):p:u?o(d,h,h+2):(p-55296<<10)+(v-56320)+65536)}};return vb={codeAt:a(!1),charAt:a(!0)},vb}var FF;function w0(){if(FF)return MF;FF=1;var r=BZ().charAt,e=dr(),t=Dn(),i=n0(),n=s0(),s="String Iterator",o=t.set,a=t.getterFor(s);return i(String,"String",function(u){o(this,{type:s,string:e(u),index:0})},function(){var l=a(this),c=l.string,d=l.index,h;return d>=c.length?n(void 0,!0):(h=r(c,d),l.index+=h.length,n(h,!1))}),MF}var gb,kF;function jZ(){if(kF)return gb;kF=1,Ws(),NZ(),kZ(),w0();var r=Be();return gb=r.Map,gb}var mb,BF;function LZ(){if(BF)return mb;BF=1;var r=jZ();return Us(),mb=r,mb}var yb,jF;function zZ(){return jF||(jF=1,yb=LZ()),yb}var HZ=zZ(),E0=pe(HZ);class WZ{constructor(){this.clear(),this._defaultIndex=0,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},ot(this.options,this.defaultOptions)}setOptions(e){const t=["useDefaultGroups"];if(e!==void 0){for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&Fe(t).call(t,i)===-1){const n=e[i];this.add(i,n)}}}clear(){this._groups=new E0,this._groupNames=[]}get(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=this._groups.get(e);if(i===void 0&&t)if(this.options.useDefaultGroups===!1&&this._groupNames.length>0){const n=this._groupIndex%this._groupNames.length;++this._groupIndex,i={},i.color=this._groups.get(this._groupNames[n]),this._groups.set(e,i)}else{const n=this._defaultIndex%this._defaultGroups.length;this._defaultIndex++,i={},i.color=this._defaultGroups[n],this._groups.set(e,i)}return i}add(e,t){return this._groups.has(e)||this._groupNames.push(e),this._groups.set(e,t),t}}var LF={},zF;function UZ(){if(zF)return LF;zF=1;var r=ce();return r({target:"Number",stat:!0},{isNaN:function(t){return t!==t}}),LF}var bb,HF;function VZ(){if(HF)return bb;HF=1,UZ();var r=Be();return bb=r.Number.isNaN,bb}var _b,WF;function KZ(){if(WF)return _b;WF=1;var r=VZ();return _b=r,_b}var wb,UF;function GZ(){return UF||(UF=1,wb=KZ()),wb}var YZ=GZ(),G_=pe(YZ),VF={},Eb,KF;function XZ(){if(KF)return Eb;KF=1;var r=Ye(),e=r.isFinite;return Eb=Number.isFinite||function(i){return typeof i=="number"&&e(i)},Eb}var GF;function JZ(){if(GF)return VF;GF=1;var r=ce(),e=XZ();return r({target:"Number",stat:!0},{isFinite:e}),VF}var Sb,YF;function QZ(){if(YF)return Sb;YF=1,JZ();var r=Be();return Sb=r.Number.isFinite,Sb}var Ob,XF;function ZZ(){if(XF)return Ob;XF=1;var r=QZ();return Ob=r,Ob}var Ib,JF;function eee(){return JF||(JF=1,Ib=ZZ()),Ib}var tee=eee(),tn=pe(tee),QF={},ZF;function ree(){if(ZF)return QF;ZF=1;var r=ce(),e=Hi().some,t=Vs(),i=t("some");return r({target:"Array",proto:!0,forced:!i},{some:function(s){return e(this,s,arguments.length>1?arguments[1]:void 0)}}),QF}var Tb,ek;function iee(){if(ek)return Tb;ek=1,ree();var r=Tt();return Tb=r("Array","some"),Tb}var $b,tk;function nee(){if(tk)return $b;tk=1;var r=dt(),e=iee(),t=Array.prototype;return $b=function(i){var n=i.some;return i===t||r(t,i)&&n===t.some?e:n},$b}var Pb,rk;function see(){if(rk)return Pb;rk=1;var r=nee();return Pb=r,Pb}var Rb,ik;function oee(){return ik||(ik=1,Rb=see()),Rb}var aee=oee(),uee=pe(aee),Cb={exports:{}},nk={},sk;function lee(){if(sk)return nk;sk=1;var r=ce(),e=rt(),t=cr().f;return r({target:"Object",stat:!0,forced:Object.defineProperty!==t,sham:!e},{defineProperty:t}),nk}var ok;function cee(){if(ok)return Cb.exports;ok=1,lee();var r=Be(),e=r.Object,t=Cb.exports=function(n,s,o){return e.defineProperty(n,s,o)};return e.defineProperty.sham&&(t.sham=!0),Cb.exports}var xb,ak;function $5(){if(ak)return xb;ak=1;var r=cee();return xb=r,xb}var qb,uk;function dee(){if(uk)return qb;uk=1;var r=$5();return qb=r,qb}var Db,lk;function hee(){if(lk)return Db;lk=1;var r=dee();return Db=r,Db}var Ab,ck;function fee(){return ck||(ck=1,Ab=hee()),Ab}var pee=fee(),vee=pe(pee),dk={},hk;function gee(){if(hk)return dk;hk=1;var r=ht(),e=cr().f,t=r("metadata"),i=Function.prototype;return i[t]===void 0&&e(i,t,{value:null}),dk}var fk={},pk;function mee(){return pk||(pk=1,R3()),fk}var vk={},gk;function yee(){return gk||(gk=1,C3()),vk}var mk={},yk;function bee(){if(yk)return mk;yk=1;var r=Je();return r("metadata"),mk}var Mb,bk;function _ee(){if(bk)return Mb;bk=1;var r=M3();return gee(),mee(),yee(),bee(),Mb=r,Mb}var _k={},Nb,wk;function P5(){if(wk)return Nb;wk=1;var r=tr(),e=Ce(),t=r("Symbol"),i=t.keyFor,n=e(t.prototype.valueOf);return Nb=t.isRegisteredSymbol||function(o){try{return i(n(o))!==void 0}catch{return!1}},Nb}var Ek;function wee(){if(Ek)return _k;Ek=1;var r=ce(),e=P5();return r({target:"Symbol",stat:!0},{isRegisteredSymbol:e}),_k}var Sk={},Fb,Ok;function R5(){if(Ok)return Fb;Ok=1;for(var r=ks(),e=tr(),t=Ce(),i=ca(),n=ht(),s=e("Symbol"),o=s.isWellKnownSymbol,a=e("Object","getOwnPropertyNames"),u=t(s.prototype.valueOf),l=r("wks"),c=0,d=a(s),h=d.length;ch;)p=l(u,f=c[h++]),p!==void 0&&s(d,f,p);return d}}),b2}var l1,w2;function yte(){if(w2)return l1;w2=1,mte();var r=Be();return l1=r.Object.getOwnPropertyDescriptors,l1}var c1,E2;function bte(){if(E2)return c1;E2=1;var r=yte();return c1=r,c1}var d1,S2;function _te(){return S2||(S2=1,d1=bte()),d1}var wte=_te(),Ai=pe(wte),h1={exports:{}},O2={},I2;function Ete(){if(I2)return O2;I2=1;var r=ce(),e=rt(),t=e0().f;return r({target:"Object",stat:!0,forced:Object.defineProperties!==t,sham:!e},{defineProperties:t}),O2}var T2;function Ste(){if(T2)return h1.exports;T2=1,Ete();var r=Be(),e=r.Object,t=h1.exports=function(n,s){return e.defineProperties(n,s)};return e.defineProperties.sham&&(t.sham=!0),h1.exports}var f1,$2;function Ote(){if($2)return f1;$2=1;var r=Ste();return f1=r,f1}var p1,P2;function Ite(){return P2||(P2=1,p1=Ote()),p1}var Tte=Ite(),ol=pe(Tte),v1,R2;function $te(){return R2||(R2=1,v1=$5()),v1}var Pte=$te(),al=pe(Pte);function S0(r,e){const t=["node","edge","label"];let i=!0;const n=yi(e,"chosen");if(typeof n=="boolean")i=n;else if(typeof n=="object"){if(Fe(t).call(t,r)===-1)throw new Error("choosify: subOption '"+r+"' should be one of '"+t.join("', '")+"'");const s=yi(e,["chosen",r]);(typeof s=="boolean"||typeof s=="function")&&(i=s)}return i}function Y_(r,e,t){if(r.width<=0||r.height<=0)return!1;if(t!==void 0){const s={x:e.x-t.x,y:e.y-t.y};if(t.angle!==0){const o=-t.angle;e={x:Math.cos(o)*s.x-Math.sin(o)*s.y,y:Math.sin(o)*s.x+Math.cos(o)*s.y}}else e=s}const i=r.x+r.width,n=r.y+r.width;return r.lefte.x&&r.tope.y}function du(r){return typeof r=="string"&&r!==""}function x5(r,e,t,i){let n=i.x,s=i.y;if(typeof i.distanceToBorder=="function"){const o=i.distanceToBorder(r,e),a=Math.sin(e)*o,u=Math.cos(e)*o;u===o?(n+=o,s=i.y):a===o?(n=i.x,s-=o):(n+=u,s-=a)}else i.shape.width>i.shape.height?(n=i.x+i.shape.width*.5,s=i.y-t):(n=i.x+t,s=i.y-i.shape.height*.5);return{x:n,y:s}}var g1,C2;function Rte(){if(C2)return g1;C2=1,Ws();var r=Tt();return g1=r("Array","values"),g1}var m1,x2;function Cte(){if(x2)return m1;x2=1;var r=Rte();return m1=r,m1}var y1,q2;function xte(){if(q2)return y1;q2=1,Us();var r=zs(),e=It(),t=dt(),i=Cte(),n=Array.prototype,s={DOMTokenList:!0,NodeList:!0};return y1=function(o){var a=o.values;return o===n||t(n,o)&&a===n.values||e(s,r(o))?i:a},y1}var b1,D2;function qte(){return D2||(D2=1,b1=xte()),b1}var Dte=qte(),q5=pe(Dte);class Ate{constructor(e){this.measureText=e,this.current=0,this.width=0,this.height=0,this.lines=[]}_add(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"normal";this.lines[e]===void 0&&(this.lines[e]={width:0,height:0,blocks:[]});let n=t;(t===void 0||t==="")&&(n=" ");const s=this.measureText(n,i),o=ot({},q5(s));o.text=t,o.width=s.width,o.mod=i,(t===void 0||t==="")&&(o.width=0),this.lines[e].blocks.push(o),this.lines[e].width+=o.width}curWidth(){const e=this.lines[this.current];return e===void 0?0:e.width}append(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t)}newLine(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"normal";this._add(this.current,e,t),this.current++}determineLineHeights(){for(let e=0;ee&&(e=n.width),t+=n.height}this.width=e,this.height=t}removeEmptyBlocks(){const e=[];for(let t=0;t"://,""://,""://,"":/<\/b>/,"":/<\/i>/,"":/<\/code>/,"*":/\*/,_:/_/,"`":/`/,afterBold:/[^*]/,afterItal:/[^_]/,afterMono:/[^`]/};class A2{constructor(e){this.text=e,this.bold=!1,this.ital=!1,this.mono=!1,this.spacing=!1,this.position=0,this.buffer="",this.modStack=[],this.blocks=[]}mod(){return this.modStack.length===0?"normal":this.modStack[0]}modName(){if(this.modStack.length===0)return"normal";if(this.modStack[0]==="mono")return"mono";if(this.bold&&this.ital)return"boldital";if(this.bold)return"bold";if(this.ital)return"ital"}emitBlock(){this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(this.blocks.push({text:this.buffer,mod:this.modName()}),this.buffer="")}add(e){e===" "&&(this.spacing=!0),this.spacing&&(this.buffer+=" ",this.spacing=!1),e!=" "&&(this.buffer+=e)}parseWS(e){return/[ \t]/.test(e)?(this.mono?this.add(e):this.spacing=!0,!0):!1}setTag(e){this.emitBlock(),this[e]=!0,this.modStack.unshift(e)}unsetTag(e){this.emitBlock(),this[e]=!1,this.modStack.shift()}parseStartTag(e,t){return!this.mono&&!this[e]&&this.match(t)?(this.setTag(e),!0):!1}match(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;const[i,n]=this.prepareRegExp(e),s=i.test(this.text.substr(this.position,n));return s&&t&&(this.position+=n-1),s}parseEndTag(e,t,i){let n=this.mod()===e;return e==="mono"?n=n&&this.mono:n=n&&!this.mono,n&&this.match(t)?(i!==void 0?(this.position===this.text.length-1||this.match(i,!1))&&this.unsetTag(e):this.unsetTag(e),!0):!1}replace(e,t){return this.match(e)?(this.add(t),this.position+=length-1,!0):!1}prepareRegExp(e){let t,i;if(e instanceof RegExp)i=e,t=1;else{const n=Mte[e];n!==void 0?i=n:i=new RegExp(e),t=e.length}return[i,t]}}class Nte{constructor(e,t,i,n){this.ctx=e,this.parent=t,this.selected=i,this.hover=n;const s=(o,a)=>{if(o===void 0)return 0;const u=this.parent.getFormattingValues(e,i,n,a);let l=0;return o!==""&&(l=this.ctx.measureText(o).width),{width:l,values:u}};this.lines=new Ate(s)}process(e){if(!du(e))return this.lines.finalize();const t=this.parent.fontOptions;e=e.replace(/\r\n/g,` `),e=e.replace(/\r/g,` `);const i=String(e).split(` -`),n=i.length;if(t.multi)for(let s=0;s0)for(let a=0;a0)for(let s=0;s/&/.test(n)?(t.replace(t.text,"<","<")||t.replace(t.text,"&","&")||t.add("&"),!0):!1;for(;t.position")||t.parseStartTag("ital","")||t.parseStartTag("mono","")||t.parseEndTag("bold","")||t.parseEndTag("ital","")||t.parseEndTag("mono",""))||i(n)||t.add(n),t.position++}return t.emitBlock(),t.blocks}splitMarkdownBlocks(e){const t=new A2(e);let i=!0;const n=s=>/\\/.test(s)?(t.positionthis.parent.fontOptions.maxWdt}getLongestFit(e){let t="",i=0;for(;i1&&arguments[1]!==void 0?arguments[1]:"normal",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.parent.getFormattingValues(this.ctx,this.selected,this.hover,t),e=e.replace(/^( +)/g,"$1\r"),e=e.replace(/([^\r][^ ]*)( +)/g,"$1\r$2\r");let n=e.split("\r");for(;n.length>0;){let s=this.getLongestFit(n);if(s===0){const o=n[0],a=this.getLongestFitWord(o);this.lines.newLine(Cr(o).call(o,0,a),t),n[0]=Cr(o).call(o,a)}else{let o=s;n[s-1]===" "?s--:n[o]===" "&&o++;const a=Cr(n).call(n,0,s).join("");s==n.length&&i?this.lines.append(a,t):this.lines.newLine(a,t),n=Cr(n).call(n,o)}}}}const io=["bold","ital","boldital","mono"];class ls{constructor(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.body=e,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(t),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=i}setOptions(e){if(this.elementOptions=e,this.initFontOptions(e.font),du(e.label)?this.labelDirty=!0:e.label=void 0,e.font!==void 0&&e.font!==null){if(typeof e.font=="string")this.baseSize=this.fontOptions.size;else if(typeof e.font=="object"){const t=e.font.size;t!==void 0&&(this.baseSize=t)}}}initFontOptions(e){if(Oe(io,t=>{this.fontOptions[t]={}}),ls.parseFontString(this.fontOptions,e)){this.fontOptions.vadjust=0;return}Oe(e,(t,i)=>{t!=null&&typeof t!="object"&&(this.fontOptions[i]=t)})}static parseFontString(e,t){if(!t||typeof t!="string")return!1;const i=t.split(" ");return e.size=+i[0].replace("px",""),e.face=i[1],e.color=i[2],!0}constrain(e){const t={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:"middle"},i=yi(e,"widthConstraint");if(typeof i=="number")t.maxWdt=Number(i),t.minWdt=Number(i);else if(typeof i=="object"){const s=yi(e,["widthConstraint","maximum"]);typeof s=="number"&&(t.maxWdt=Number(s));const o=yi(e,["widthConstraint","minimum"]);typeof o=="number"&&(t.minWdt=Number(o))}const n=yi(e,"heightConstraint");if(typeof n=="number")t.minHgt=Number(n);else if(typeof n=="object"){const s=yi(e,["heightConstraint","minimum"]);typeof s=="number"&&(t.minHgt=Number(s));const o=yi(e,["heightConstraint","valign"]);typeof o=="string"&&(o==="top"||o==="bottom")&&(t.valign=o)}return t}update(e,t){this.setOptions(e,!0),this.propagateFonts(t),Ue(this.fontOptions,this.constrain(t)),this.fontOptions.chooser=S0("label",t)}adjustSizes(e){const t=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=t,this.fontOptions.minWdt-=t);const i=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=i)}addFontOptionsToPile(e,t){for(let i=0;i{o!==void 0&&(Object.prototype.hasOwnProperty.call(t,a)||(Fe(io).call(io,a)!==-1?t[a]={}:t[a]=o))})}return t}getFontOption(e,t,i){let n;for(let s=0;s{s[u]=a}),s.size=Number(s.size),s.vadjust=Number(s.vadjust)}}draw(e,t,i,n,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"middle";if(this.elementOptions.label===void 0)return;let a=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&a=this.elementOptions.scaling.label.maxVisible&&(a=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(e,n,s,t,i,o),this._drawBackground(e),this._drawText(e,t,this.size.yLine,o,a))}_drawBackground(e){if(this.fontOptions.background!==void 0&&this.fontOptions.background!=="none"){e.fillStyle=this.fontOptions.background;const t=this.getSize();e.fillRect(t.left,t.top,t.width,t.height)}}_drawText(e,t,i){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"middle",s=arguments.length>4?arguments[4]:void 0;[t,i]=this._setAlignment(e,t,i,n),e.textAlign="left",t=t-this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&(this.fontOptions.valign==="top"&&(i-=(this.size.height-this.size.labelHeight)/2),this.fontOptions.valign==="bottom"&&(i+=(this.size.height-this.size.labelHeight)/2));for(let o=0;o0&&(e.lineWidth=c.strokeWidth,e.strokeStyle=h,e.lineJoin="round"),e.fillStyle=d,c.strokeWidth>0&&e.strokeText(c.text,t+u,i+c.vadjust),e.fillText(c.text,t+u,i+c.vadjust),u+=c.width}i+=a.height}}}_setAlignment(e,t,i,n){if(this.isEdgeLabel&&this.fontOptions.align!=="horizontal"&&this.pointToSelf===!1){t=0,i=0;const s=2;this.fontOptions.align==="top"?(e.textBaseline="alphabetic",i-=2*s):this.fontOptions.align==="bottom"?(e.textBaseline="hanging",i+=2*s):e.textBaseline="middle"}else e.textBaseline=n;return[t,i]}_getColor(e,t,i){let n=e||"#000000",s=i||"#ffffff";if(t<=this.elementOptions.scaling.label.drawThreshold){const o=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-t)));n=nr(n,o),s=nr(s,o)}return[n,s]}getTextSize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this._processLabel(e,t,i),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}getSize(){let t=this.size.left,i=this.size.top-.5*2;if(this.isEdgeLabel){const s=-this.size.width*.5;switch(this.fontOptions.align){case"middle":t=s,i=-this.size.height*.5;break;case"top":t=s,i=-(this.size.height+2);break;case"bottom":t=s,i=2;break}}return{left:t,top:i,width:this.size.width,height:this.size.height}}calculateLabelSize(e,t,i){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"middle";this._processLabel(e,t,i),this.size.left=n-this.size.width*.5,this.size.top=s-this.size.height*.5,this.size.yLine=s+(1-this.lineCount)*.5*this.fontOptions.size,o==="hanging"&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}getFormattingValues(e,t,i,n){const s=function(u,l,c){return l==="normal"?c==="mod"?"":u[c]:u[l][c]!==void 0?u[l][c]:u[c]},o={color:s(this.fontOptions,n,"color"),size:s(this.fontOptions,n,"size"),face:s(this.fontOptions,n,"face"),mod:s(this.fontOptions,n,"mod"),vadjust:s(this.fontOptions,n,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(t||i)&&(n==="normal"&&this.fontOptions.chooser===!0&&this.elementOptions.labelHighlightBold?o.mod="bold":typeof this.fontOptions.chooser=="function"&&this.fontOptions.chooser(o,this.elementOptions.id,t,i));let a="";return o.mod!==void 0&&o.mod!==""&&(a+=o.mod+" "),a+=o.size+"px "+o.face,e.font=a.replace(/"/g,""),o.font=e.font,o.height=o.size,o}differentState(e,t){return e!==this.selectedState||t!==this.hoverState}_processLabelText(e,t,i,n){return new Nte(e,this,t,i).process(n)}_processLabel(e,t,i){if(this.labelDirty===!1&&!this.differentState(t,i))return;const n=this._processLabelText(e,t,i,this.elementOptions.label);this.fontOptions.minWdt>0&&n.width0&&n.height0&&(this.enableBorderDashes(e,t),e.stroke(),this.disableBorderDashes(e,t)),e.restore()}performFill(e,t){e.save(),e.fillStyle=t.color,this.enableShadow(e,t),ma(e).call(e),this.disableShadow(e,t),e.restore(),this.performStroke(e,t)}_addBoundingBoxMargin(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}_updateBoundingBox(e,t,i,n,s){i!==void 0&&this.resize(i,n,s),this.left=e-this.width/2,this.top=t-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(e,t,i,n,s){this._updateBoundingBox(e,t,i,n,s)}getDimensionsFromLabel(e,t,i){this.textSize=this.labelModule.getTextSize(e,t,i);let n=this.textSize.width,s=this.textSize.height;const o=14;return n===0&&(n=o,s=o),{width:n,height:s}}}let Fte=class extends Mn{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,i)){const n=this.getDimensionsFromLabel(e,t,i);this.width=n.width+this.margin.right+this.margin.left,this.height=n.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}draw(e,t,i,n,s,o){this.resize(e,n,s),this.left=t-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,o),m3(e,this.left,this.top,this.width,this.height,o.borderRadius),this.performFill(e,o),this.updateBoundingBox(t,i,e,n,s),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,n,s)}updateBoundingBox(e,t,i,n,s){this._updateBoundingBox(e,t,i,n,s);const o=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(o)}distanceToBorder(e,t){e&&this.resize(e);const i=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(t)),Math.abs(this.height/2/Math.sin(t)))+i}};class O0 extends Mn{constructor(e,t,i){super(e,t,i),this.labelOffset=0,this.selected=!1}setOptions(e,t,i){this.options=e,t===void 0&&i===void 0||this.setImages(t,i)}setImages(e,t){t&&this.selected?(this.imageObj=t,this.imageObjAlt=e):(this.imageObj=e,this.imageObjAlt=t)}switchImages(e){const t=e&&!this.selected||!e&&this.selected;if(this.selected=e,this.imageObjAlt!==void 0&&t){const i=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=i}}_getImagePadding(){const e={top:0,right:0,bottom:0,left:0};if(this.options.imagePadding){const t=this.options.imagePadding;typeof t=="object"?(e.top=t.top,e.right=t.right,e.bottom=t.bottom,e.left=t.left):(e.top=t,e.right=t,e.bottom=t,e.left=t)}return e}_resizeImage(){let e,t;if(this.options.shapeProperties.useImageSize===!1){let i=1,n=1;this.imageObj.width&&this.imageObj.height&&(this.imageObj.width>this.imageObj.height?i=this.imageObj.width/this.imageObj.height:n=this.imageObj.height/this.imageObj.width),e=this.options.size*2*i,t=this.options.size*2*n}else{const i=this._getImagePadding();e=this.imageObj.width+i.left+i.right,t=this.imageObj.height+i.top+i.bottom}this.width=e,this.height=t,this.radius=.5*this.width}_drawRawCircle(e,t,i,n){this.initContextForDraw(e,n),Jw(e,t,i,n.size),this.performFill(e,n)}_drawImageAtPosition(e,t){if(this.imageObj.width!=0){e.globalAlpha=t.opacity!==void 0?t.opacity:1,this.enableShadow(e,t);let i=1;this.options.shapeProperties.interpolation===!0&&(i=this.imageObj.width/this.width/this.body.view.scale);const n=this._getImagePadding(),s=this.left+n.left,o=this.top+n.top,a=this.width-n.left-n.right,u=this.height-n.top-n.bottom;this.imageObj.drawImageAtPosition(e,i,s,o,a,u),this.disableShadow(e,t)}}_drawImageLabel(e,t,i,n,s){let o=0;if(this.height!==void 0){o=this.height*.5;const u=this.labelModule.getTextSize(e,n,s);u.lineCount>=1&&(o+=u.height/2)}const a=i+o;this.options.label&&(this.labelOffset=o),this.labelModule.draw(e,t,a,n,s,"hanging")}}let kte=class extends O0{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,i)){const n=this.getDimensionsFromLabel(e,t,i),s=Math.max(n.width+this.margin.right+this.margin.left,n.height+this.margin.top+this.margin.bottom);this.options.size=s/2,this.width=s,this.height=s,this.radius=this.width/2}}draw(e,t,i,n,s,o){this.resize(e,n,s),this.left=t-this.width/2,this.top=i-this.height/2,this._drawRawCircle(e,t,i,o),this.updateBoundingBox(t,i),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,i,n,s)}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size}distanceToBorder(e){return e&&this.resize(e),this.width*.5}};class Bte extends O0{constructor(e,t,i,n,s){super(e,t,i),this.setImages(n,s)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0){const s=this.options.size*2;this.width=s,this.height=s,this.radius=.5*this.width;return}this.needsRefresh(t,i)&&this._resizeImage()}draw(e,t,i,n,s,o){this.switchImages(n),this.resize();let a=t,u=i;this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=t,this.top=i,a+=this.width/2,u+=this.height/2):(this.left=t-this.width/2,this.top=i-this.height/2),this._drawRawCircle(e,a,u,o),e.save(),e.clip(),this._drawImageAtPosition(e,o),e.restore(),this._drawImageLabel(e,a,u,n,s),this.updateBoundingBox(t,i)}updateBoundingBox(e,t){this.options.shapeProperties.coordinateOrigin==="top-left"?(this.boundingBox.top=t,this.boundingBox.left=e,this.boundingBox.right=e+this.options.size*2,this.boundingBox.bottom=t+this.options.size*2):(this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size),this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}distanceToBorder(e){return e&&this.resize(e),this.width*.5}}class Ui extends Mn{constructor(e,t,i){super(e,t,i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{size:this.options.size};if(this.needsRefresh(t,i)){var s,o;this.labelModule.getTextSize(e,t,i);const a=2*n.size;this.width=(s=this.customSizeWidth)!==null&&s!==void 0?s:a,this.height=(o=this.customSizeHeight)!==null&&o!==void 0?o:a,this.radius=.5*this.width}}_drawShape(e,t,i,n,s,o,a,u){return this.resize(e,o,a,u),this.left=n-this.width/2,this.top=s-this.height/2,this.initContextForDraw(e,u),t7(t)(e,n,s,u.size),this.performFill(e,u),this.options.icon!==void 0&&this.options.icon.code!==void 0&&(e.font=(o?"bold ":"")+this.height/2+"px "+(this.options.icon.face||"FontAwesome"),e.fillStyle=this.options.icon.color||"black",e.textAlign="center",e.textBaseline="middle",e.fillText(this.options.icon.code,n,s)),{drawExternalLabel:()=>{if(this.options.label!==void 0){this.labelModule.calculateLabelSize(e,o,a,n,s,"hanging");const l=s+.5*this.height+.5*this.labelModule.size.height;this.labelModule.draw(e,n,l,o,a,"hanging")}this.updateBoundingBox(n,s)}}}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height))}}function M2(r,e){var t=Ze(r);if(Di){var i=Di(r);e&&(i=Wt(i).call(i,function(n){return Wi(r,n).enumerable})),t.push.apply(t,i)}return t}function jte(r){for(var e=1;e{e.save(),u(),e.restore()}}return a.nodeDimensions&&(this.customSizeWidth=a.nodeDimensions.width,this.customSizeHeight=a.nodeDimensions.height),a}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class zte extends Mn{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e,t,i){if(this.needsRefresh(t,i)){const s=this.getDimensionsFromLabel(e,t,i).width+this.margin.right+this.margin.left;this.width=s,this.height=s,this.radius=this.width/2}}draw(e,t,i,n,s,o){this.resize(e,n,s),this.left=t-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,o),y3(e,t-this.width/2,i-this.height/2,this.width,this.height),this.performFill(e,o),this.updateBoundingBox(t,i,e,n,s),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,n,s)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let Hte=class extends Ui{constructor(e,t,i){super(e,t,i)}draw(e,t,i,n,s,o){return this._drawShape(e,"diamond",4,t,i,n,s,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class Wte extends Ui{constructor(e,t,i){super(e,t,i)}draw(e,t,i,n,s,o){return this._drawShape(e,"circle",2,t,i,n,s,o)}distanceToBorder(e){return e&&this.resize(e),this.options.size}}class N2 extends Mn{constructor(e,t,i){super(e,t,i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,i)){const n=this.getDimensionsFromLabel(e,t,i);this.height=n.height*2,this.width=n.width+n.height,this.radius=.5*this.width}}draw(e,t,i,n,s,o){this.resize(e,n,s),this.left=t-this.width*.5,this.top=i-this.height*.5,this.initContextForDraw(e,o),B_(e,this.left,this.top,this.width,this.height),this.performFill(e,o),this.updateBoundingBox(t,i,e,n,s),this.labelModule.draw(e,t,i,n,s)}distanceToBorder(e,t){e&&this.resize(e);const i=this.width*.5,n=this.height*.5,s=Math.sin(t)*i,o=Math.cos(t)*n;return i*n/Math.sqrt(s*s+o*o)}}class Ute extends Mn{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e,t,i){this.needsRefresh(t,i)&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}draw(e,t,i,n,s,o){return this.resize(e,n,s),this.options.icon.size=this.options.icon.size||50,this.left=t-this.width/2,this.top=i-this.height/2,this._icon(e,t,i,n,s,o),{drawExternalLabel:()=>{this.options.label!==void 0&&this.labelModule.draw(e,this.left+this.iconSize.width/2+this.margin.left,i+this.height/2+5,n),this.updateBoundingBox(t,i)}}}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.icon.size*.5,this.boundingBox.left=e-this.options.icon.size*.5,this.boundingBox.right=e+this.options.icon.size*.5,this.boundingBox.bottom=t+this.options.icon.size*.5,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+5))}_icon(e,t,i,n,s,o){const a=Number(this.options.icon.size);this.options.icon.code!==void 0?(e.font=[this.options.icon.weight!=null?this.options.icon.weight:n?"bold":"",(this.options.icon.weight!=null&&n?5:0)+a+"px",this.options.icon.face].join(" "),e.fillStyle=this.options.icon.color||"black",e.textAlign="center",e.textBaseline="middle",this.enableShadow(e,o),e.fillText(this.options.icon.code,t,i),this.disableShadow(e,o)):console.error("When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.")}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let Vte=class extends O0{constructor(e,t,i,n,s){super(e,t,i),this.setImages(n,s)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0){const s=this.options.size*2;this.width=s,this.height=s;return}this.needsRefresh(t,i)&&this._resizeImage()}draw(e,t,i,n,s,o){e.save(),this.switchImages(n),this.resize();let a=t,u=i;if(this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=t,this.top=i,a+=this.width/2,u+=this.height/2):(this.left=t-this.width/2,this.top=i-this.height/2),this.options.shapeProperties.useBorderWithImage===!0){const l=this.options.borderWidth,c=this.options.borderWidthSelected||2*this.options.borderWidth,d=(n?c:l)/this.body.view.scale;e.lineWidth=Math.min(this.width,d),e.beginPath();let h=n?this.options.color.highlight.border:s?this.options.color.hover.border:this.options.color.border,f=n?this.options.color.highlight.background:s?this.options.color.hover.background:this.options.color.background;o.opacity!==void 0&&(h=nr(h,o.opacity),f=nr(f,o.opacity)),e.strokeStyle=h,e.fillStyle=f,e.rect(this.left-.5*e.lineWidth,this.top-.5*e.lineWidth,this.width+e.lineWidth,this.height+e.lineWidth),ma(e).call(e),this.performStroke(e,o),e.closePath()}this._drawImageAtPosition(e,o),this._drawImageLabel(e,a,u,n,s),this.updateBoundingBox(t,i),e.restore()}updateBoundingBox(e,t){this.resize(),this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=e,this.top=t):(this.left=e-this.width/2,this.top=t-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,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class Kte extends Ui{constructor(e,t,i){super(e,t,i)}draw(e,t,i,n,s,o){return this._drawShape(e,"square",2,t,i,n,s,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class Gte extends Ui{constructor(e,t,i){super(e,t,i)}draw(e,t,i,n,s,o){return this._drawShape(e,"hexagon",4,t,i,n,s,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class Yte extends Ui{constructor(e,t,i){super(e,t,i)}draw(e,t,i,n,s,o){return this._drawShape(e,"star",4,t,i,n,s,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class Xte extends Mn{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e,t,i){this.needsRefresh(t,i)&&(this.textSize=this.labelModule.getTextSize(e,t,i),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}draw(e,t,i,n,s,o){this.resize(e,n,s),this.left=t-this.width/2,this.top=i-this.height/2,this.enableShadow(e,o),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,n,s),this.disableShadow(e,o),this.updateBoundingBox(t,i,e,n,s)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let Jte=class extends Ui{constructor(e,t,i){super(e,t,i)}draw(e,t,i,n,s,o){return this._drawShape(e,"triangle",3,t,i,n,s,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class Qte extends Ui{constructor(e,t,i){super(e,t,i)}draw(e,t,i,n,s,o){return this._drawShape(e,"triangleDown",3,t,i,n,s,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}function F2(r,e){var t=Ze(r);if(Di){var i=Di(r);e&&(i=Wt(i).call(i,function(n){return Wi(r,n).enumerable})),t.push.apply(t,i)}return t}function k2(r){for(var e=1;et[l]!=null);u.push("font"),lu(u,e,a),e.color=W_(e.color)}static parseOptions(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},s=arguments.length>4?arguments[4]:void 0;if(lu(["color","fixed","shadow"],e,t,i),Ke.checkMass(t),e.opacity!==void 0&&(Ke.checkOpacity(e.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity),e.opacity=void 0)),t.opacity!==void 0&&(Ke.checkOpacity(t.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+t.opacity),t.opacity=void 0)),t.shapeProperties&&!Ke.checkCoordinateOrigin(t.shapeProperties.coordinateOrigin)&&console.error("Invalid option for node coordinateOrigin, found: "+t.shapeProperties.coordinateOrigin),ir(e,t,"shadow",n),t.color!==void 0&&t.color!==null){const a=W_(t.color);d5(e.color,a)}else i===!0&&t.color===null&&(e.color=$i(n.color));t.fixed!==void 0&&t.fixed!==null&&(typeof t.fixed=="boolean"?(e.fixed.x=t.fixed,e.fixed.y=t.fixed):(t.fixed.x!==void 0&&typeof t.fixed.x=="boolean"&&(e.fixed.x=t.fixed.x),t.fixed.y!==void 0&&typeof t.fixed.y=="boolean"&&(e.fixed.y=t.fixed.y))),i===!0&&t.font===null&&(e.font=$i(n.font)),Ke.updateGroupOptions(e,t,s),t.scaling!==void 0&&ir(e.scaling,t.scaling,"label",n.scaling)}getFormattingValues(){const e={color:this.options.color.background,opacity:this.options.opacity,borderWidth:this.options.borderWidth,borderColor:this.options.color.border,size:this.options.size,borderDashes:this.options.shapeProperties.borderDashes,borderRadius:this.options.shapeProperties.borderRadius,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y};if(this.selected||this.hover?this.chooser===!0?this.selected?(this.options.borderWidthSelected!=null?e.borderWidth=this.options.borderWidthSelected:e.borderWidth*=2,e.color=this.options.color.highlight.background,e.borderColor=this.options.color.highlight.border,e.shadow=this.options.shadow.enabled):this.hover&&(e.color=this.options.color.hover.background,e.borderColor=this.options.color.hover.border,e.shadow=this.options.shadow.enabled):typeof this.chooser=="function"&&(this.chooser(e,this.options.id,this.selected,this.hover),e.shadow===!1&&(e.shadowColor!==this.options.shadow.color||e.shadowSize!==this.options.shadow.size||e.shadowX!==this.options.shadow.x||e.shadowY!==this.options.shadow.y)&&(e.shadow=!0)):e.shadow=this.options.shadow.enabled,this.options.opacity!==void 0){const t=this.options.opacity;e.borderColor=nr(e.borderColor,t),e.color=nr(e.color,t),e.shadowColor=nr(e.shadowColor,t)}return e}updateLabelModule(e){(this.options.label===void 0||this.options.label===null)&&(this.options.label=""),Ke.updateGroupOptions(this.options,k2(k2({},e),{},{color:e&&e.color||this._localColor||void 0}),this.grouplist);const t=this.grouplist.get(this.options.group,!1),i=[e,this.options,t,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,i),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}updateShape(e){if(e===this.options.shape&&this.shape)this.shape.setOptions(this.options,this.imageObj,this.imageObjAlt);else switch(this.options.shape){case"box":this.shape=new Fte(this.options,this.body,this.labelModule);break;case"circle":this.shape=new kte(this.options,this.body,this.labelModule);break;case"circularImage":this.shape=new Bte(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case"custom":this.shape=new Lte(this.options,this.body,this.labelModule,this.options.ctxRenderer);break;case"database":this.shape=new zte(this.options,this.body,this.labelModule);break;case"diamond":this.shape=new Hte(this.options,this.body,this.labelModule);break;case"dot":this.shape=new Wte(this.options,this.body,this.labelModule);break;case"ellipse":this.shape=new N2(this.options,this.body,this.labelModule);break;case"icon":this.shape=new Ute(this.options,this.body,this.labelModule);break;case"image":this.shape=new Vte(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case"square":this.shape=new Kte(this.options,this.body,this.labelModule);break;case"hexagon":this.shape=new Gte(this.options,this.body,this.labelModule);break;case"star":this.shape=new Yte(this.options,this.body,this.labelModule);break;case"text":this.shape=new Xte(this.options,this.body,this.labelModule);break;case"triangle":this.shape=new Jte(this.options,this.body,this.labelModule);break;case"triangleDown":this.shape=new Qte(this.options,this.body,this.labelModule);break;default:this.shape=new N2(this.options,this.body,this.labelModule);break}this.needsRefresh()}select(){this.selected=!0,this.needsRefresh()}unselect(){this.selected=!1,this.needsRefresh()}needsRefresh(){this.shape.refreshNeeded=!0}getTitle(){return this.options.title}distanceToBorder(e,t){return this.shape.distanceToBorder(e,t)}isFixed(){return this.options.fixed.x&&this.options.fixed.y}isSelected(){return this.selected}getValue(){return this.options.value}getLabelSize(){return this.labelModule.size()}setValueRange(e,t,i){if(this.options.value!==void 0){const n=this.options.scaling.customScalingFunction(e,t,i,this.options.value),s=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){const o=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+n*o}this.options.size=this.options.scaling.min+n*s}else this.options.size=this.baseSize,this.options.font.size=this.baseFontSize;this.updateLabelModule()}draw(e){const t=this.getFormattingValues();return this.shape.draw(e,this.x,this.y,this.selected,this.hover,t)||{}}updateBoundingBox(e){this.shape.updateBoundingBox(this.x,this.y,e)}resize(e){const t=this.getFormattingValues();this.shape.resize(e,this.selected,this.hover,t)}getItemsOnPoint(e){const t=[];return this.labelModule.visible()&&Y_(this.labelModule.getSize(),e)&&t.push({nodeId:this.id,labelId:0}),Y_(this.shape.boundingBox,e)&&t.push({nodeId:this.id}),t}isOverlappingWith(e){return this.shape.lefte.left&&this.shape.tope.top}isBoundingBoxOverlappingWith(e){return this.shape.boundingBox.lefte.left&&this.shape.boundingBox.tope.top}static checkMass(e,t){if(e.mass!==void 0&&e.mass<=0){let i="";t!==void 0&&(i=" in node id: "+t),console.error("%cNegative or zero mass disallowed"+i+", setting mass to 1.",v5),e.mass=1}}}class Zte{constructor(e,t,i,n){var s;if(this.body=e,this.images=t,this.groups=i,this.layoutEngine=n,this.body.functions.createNode=z(s=this.create).call(s,this),this.nodesListeners={add:(o,a)=>{this.add(a.items)},update:(o,a)=>{this.update(a.items,a.data,a.oldData)},remove:(o,a)=>{this.remove(a.items)}},this.defaultOptions={borderWidth:1,borderWidthSelected:void 0,brokenImage:void 0,color:{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},opacity:void 0,fixed:{x:!1,y:!1},font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:0,strokeColor:"#ffffff",align:"center",vadjust:0,multi:!1,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"monospace",vadjust:2}},group:void 0,hidden:!1,icon:{face:"FontAwesome",code:void 0,size:50,color:"#2B7CE9"},image:void 0,imagePadding:{top:0,right:0,bottom:0,left:0},label:void 0,labelHighlightBold:!0,level:void 0,margin:{top:5,right:5,bottom:5,left:5},mass:1,physics:!0,scaling:{min:10,max:30,label:{enabled:!1,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(o,a,u,l){if(a===o)return .5;{const c=1/(a-o);return Math.max(0,(l-o)*c)}}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},shape:"ellipse",shapeProperties:{borderDashes:!1,borderRadius:6,interpolation:!0,useImageSize:!1,useBorderWithImage:!1,coordinateOrigin:"center"},size:25,title:void 0,value:void 0,x:void 0,y:void 0},this.defaultOptions.mass<=0)throw"Internal error: mass in defaultOptions of NodesHandler may not be zero or negative";this.options=$i(this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e,t;this.body.emitter.on("refreshNodes",z(e=this.refresh).call(e,this)),this.body.emitter.on("refresh",z(t=this.refresh).call(t,this)),this.body.emitter.on("destroy",()=>{Oe(this.nodesListeners,(i,n)=>{this.body.data.nodes&&this.body.data.nodes.off(n,i)}),delete this.body.functions.createNode,delete this.nodesListeners.add,delete this.nodesListeners.update,delete this.nodesListeners.remove,delete this.nodesListeners})}setOptions(e){if(e!==void 0){if(Ke.parseOptions(this.options,e),e.opacity!==void 0&&(G_(e.opacity)||!tn(e.opacity)||e.opacity<0||e.opacity>1?console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity):this.options.opacity=e.opacity),e.shape!==void 0)for(const t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&this.body.nodes[t].updateShape();if(typeof e.font<"u"||typeof e.widthConstraint<"u"||typeof e.heightConstraint<"u")for(const t of Ze(this.body.nodes))this.body.nodes[t].updateLabelModule(),this.body.nodes[t].needsRefresh();if(e.size!==void 0)for(const t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&this.body.nodes[t].needsRefresh();(e.hidden!==void 0||e.physics!==void 0)&&this.body.emitter.emit("_dataChanged")}}setData(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.body.data.nodes;if(l3("id",e))this.body.data.nodes=e;else if(et(e))this.body.data.nodes=new nu,this.body.data.nodes.add(e);else if(!e)this.body.data.nodes=new nu;else throw new TypeError("Array or DataSet expected");if(i&&Oe(this.nodesListeners,function(n,s){i.off(s,n)}),this.body.nodes={},this.body.data.nodes){const n=this;Oe(this.nodesListeners,function(o,a){n.body.data.nodes.on(a,o)});const s=this.body.data.nodes.getIds();this.add(s,!0)}t===!1&&this.body.emitter.emit("_dataChanged")}add(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i;const n=[];for(let s=0;s1&&arguments[1]!==void 0?arguments[1]:Ke;return new t(e,this.body,this.images,this.groups,this.options,this.defaultOptions)}refresh(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;Oe(this.body.nodes,(t,i)=>{const n=this.body.data.nodes.get(i);n!==void 0&&(e===!0&&t.setOptions({x:null,y:null}),t.setOptions({fixed:!1}),t.setOptions(n))})}getPositions(e){const t={};if(e!==void 0){if(et(e)===!0){for(let i=0;i{this.body.emitter.emit("startSimulation")},0)):console.error("Node id supplied to moveNode does not exist. Provided: ",e)}}var B2={},j2;function ere(){if(j2)return B2;j2=1;var r=ce(),e=Math.hypot,t=Math.abs,i=Math.sqrt,n=!!e&&e(1/0,NaN)!==1/0;return r({target:"Math",stat:!0,arity:2,forced:n},{hypot:function(o,a){for(var u=0,l=0,c=arguments.length,d=0,h,f;l0?(f=h/d,u+=f*f):u+=h;return d===1/0?1/0:d*i(u)}}),B2}var _1,L2;function tre(){if(L2)return _1;L2=1,ere();var r=Be();return _1=r.Math.hypot,_1}var w1,z2;function rre(){if(z2)return w1;z2=1;var r=tre();return w1=r,w1}var E1,H2;function ire(){return H2||(H2=1,E1=rre()),E1}var nre=ire(),sre=pe(nre);class tt{static transform(e,t){et(e)||(e=[e]);const i=t.point.x,n=t.point.y,s=t.angle,o=t.length;for(let a=0;a4&&arguments[4]!==void 0?arguments[4]:this.getViaNode();e.strokeStyle=this.getColor(e,t),e.lineWidth=t.width,t.dashes!==!1?this._drawDashedLine(e,t,s):this._drawLine(e,t,s)}_drawLine(e,t,i,n,s){if(this.from!=this.to)this._line(e,t,i,n,s);else{const[o,a,u]=this._getCircleData(e);this._circle(e,t,o,a,u)}}_drawDashedLine(e,t,i,n,s){e.lineCap="round";const o=et(t.dashes)?t.dashes:[5,5];if(e.setLineDash!==void 0){if(e.save(),e.setLineDash(o),e.lineDashOffset=0,this.from!=this.to)this._line(e,t,i);else{const[a,u,l]=this._getCircleData(e);this._circle(e,t,a,u,l)}e.setLineDash([0]),e.lineDashOffset=0,e.restore()}else{if(this.from!=this.to)b3(e,this.from.x,this.from.y,this.to.x,this.to.y,o);else{const[a,u,l]=this._getCircleData(e);this._circle(e,t,a,u,l)}this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}}findBorderPosition(e,t,i){return this.from!=this.to?this._findBorderPosition(e,t,i):this._findBorderPositionCircle(e,t,i)}findBorderPositions(e){if(this.from!=this.to)return{from:this._findBorderPosition(this.from,e),to:this._findBorderPosition(this.to,e)};{var t;const[i,n]=Cr(t=this._getCircleData(e)).call(t,0,2);return{from:this._findBorderPositionCircle(this.from,e,{x:i,y:n,low:.25,high:.6,direction:-1}),to:this._findBorderPositionCircle(this.from,e,{x:i,y:n,low:.6,high:.8,direction:1})}}}_getCircleData(e){const t=this.options.selfReference.size;e!==void 0&&this.from.shape.width===void 0&&this.from.shape.resize(e);const i=x5(e,this.options.selfReference.angle,t,this.from);return[i.x,i.y,t]}_pointOnCircle(e,t,i,n){const s=n*2*Math.PI;return{x:e+i*Math.cos(s),y:t-i*Math.sin(s)}}_findBorderPositionCircle(e,t,i){const n=i.x,s=i.y;let o=i.low,a=i.high;const u=i.direction,l=10,c=this.options.selfReference.size,d=.05;let h,f=(o+a)*.5,p=0;this.options.arrowStrikethrough===!0&&(u===-1?p=this.options.endPointOffset.from:u===1&&(p=this.options.endPointOffset.to));let v=0;do{f=(o+a)*.5,h=this._pointOnCircle(n,s,c,f);const b=Math.atan2(e.y-h.y,e.x-h.x),m=e.distanceToBorder(t,b)+p,g=Math.sqrt(Math.pow(h.x-e.x,2)+Math.pow(h.y-e.y,2)),w=m-g;if(Math.abs(w)0?u>0?o=f:a=f:u>0?a=f:o=f,++v}while(o<=a&&v1?c=1:c<0&&(c=0);const d=e+c*a,h=t+c*u,f=d-s,p=h-o;return Math.sqrt(f*f+p*p)}getArrowData(e,t,i,n,s,o){let a,u,l,c,d,h,f;const p=o.width;t==="from"?(l=this.from,c=this.to,d=o.fromArrowScale<0,h=Math.abs(o.fromArrowScale),f=o.fromArrowType):t==="to"?(l=this.to,c=this.from,d=o.toArrowScale<0,h=Math.abs(o.toArrowScale),f=o.toArrowType):(l=this.to,c=this.from,d=o.middleArrowScale<0,h=Math.abs(o.middleArrowScale),f=o.middleArrowType);const v=15*h+3*p;if(l!=c){const w=sre(l.x-c.x,l.y-c.y),y=v/w;if(t!=="middle")if(this.options.smooth.enabled===!0){const S=this._findBorderPosition(l,e,{via:i}),O=this.getPoint(S.t+y*(t==="from"?1:-1),i);a=Math.atan2(S.y-O.y,S.x-O.x),u=S}else a=Math.atan2(l.y-c.y,l.x-c.x),u=this._findBorderPosition(l,e);else{const S=(d?-y:y)/2,O=this.getPoint(.5+S,i),I=this.getPoint(.5-S,i);a=Math.atan2(O.y-I.y,O.x-I.x),u=this.getPoint(.5,i)}}else{const[w,y,S]=this._getCircleData(e);if(t==="from"){const O=this.options.selfReference.angle,I=this.options.selfReference.angle+Math.PI,_=this._findBorderPositionCircle(this.from,e,{x:w,y,low:O,high:I,direction:-1});a=_.t*-2*Math.PI+1.5*Math.PI+.1*Math.PI,u=_}else if(t==="to"){const O=this.options.selfReference.angle,I=this.options.selfReference.angle+Math.PI,_=this._findBorderPositionCircle(this.from,e,{x:w,y,low:O,high:I,direction:1});a=_.t*-2*Math.PI+1.5*Math.PI-1.1*Math.PI,u=_}else{const O=this.options.selfReference.angle/(2*Math.PI);u=this._pointOnCircle(w,y,S,O),a=O*-2*Math.PI+1.5*Math.PI+.1*Math.PI}}const b=u.x-v*.9*Math.cos(a),m=u.y-v*.9*Math.sin(a);return{point:u,core:{x:b,y:m},angle:a,length:v,type:f}}drawArrowHead(e,t,i,n,s){e.strokeStyle=this.getColor(e,t),e.fillStyle=e.strokeStyle,e.lineWidth=t.width,D5.draw(e,s)&&(this.enableShadow(e,t),ma(e).call(e),this.disableShadow(e,t))}enableShadow(e,t){t.shadow===!0&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}disableShadow(e,t){t.shadow===!0&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}drawBackground(e,t){if(t.background!==!1){const i={strokeStyle:e.strokeStyle,lineWidth:e.lineWidth,dashes:e.dashes};e.strokeStyle=t.backgroundColor,e.lineWidth=t.backgroundSize,this.setStrokeDashed(e,t.backgroundDashes),e.stroke(),e.strokeStyle=i.strokeStyle,e.lineWidth=i.lineWidth,e.dashes=i.dashes,this.setStrokeDashed(e,t.dashes)}}setStrokeDashed(e,t){if(t!==!1)if(e.setLineDash!==void 0){const i=et(t)?t:[5,5];e.setLineDash(i)}else console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.");else e.setLineDash!==void 0?e.setLineDash([]):console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.")}}function V2(r,e){var t=Ze(r);if(Di){var i=Di(r);e&&(i=Wt(i).call(i,function(n){return Wi(r,n).enumerable})),t.push.apply(t,i)}return t}function K2(r){for(var e=1;e2&&arguments[2]!==void 0?arguments[2]:this._getViaCoordinates();const n=10,s=.2;let o=!1,a=1,u=0,l=this.to,c,d,h=this.options.endPointOffset?this.options.endPointOffset.to:0;e.id===this.from.id&&(l=this.from,o=!0,h=this.options.endPointOffset?this.options.endPointOffset.from:0),this.options.arrowStrikethrough===!1&&(h=0);let f=0;do{d=(u+a)*.5,c=this.getPoint(d,i);const p=Math.atan2(l.y-c.y,l.x-c.x),v=l.distanceToBorder(t,p)+h,b=Math.sqrt(Math.pow(c.x-l.x,2)+Math.pow(c.y-l.y,2)),m=v-b;if(Math.abs(m)0&&(l=this._getDistanceToLine(p,v,h,f,s,o),u=l{this.positionBezierNode()},this._body.emitter.on("_repositionBezierNodes",this._boundFunction)}setOptions(e){super.setOptions(e);let t=!1;this.options.physics!==e.physics&&(t=!0),this.options=e,this.id=this.options.id,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.setupSupportNode(),this.connect(),t===!0&&(this.via.setOptions({physics:this.options.physics}),this.positionBezierNode())}connect(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.from===void 0||this.to===void 0||this.options.physics===!1?this.via.setOptions({physics:!1}):this.from.id===this.to.id?this.via.setOptions({physics:!1}):this.via.setOptions({physics:!0})}cleanup(){return this._body.emitter.off("_repositionBezierNodes",this._boundFunction),this.via!==void 0?(delete this._body.nodes[this.via.id],this.via=void 0,!0):!1}setupSupportNode(){if(this.via===void 0){const e="edgeId:"+this.id,t=this._body.functions.createNode({id:e,shape:"circle",physics:!0,hidden:!0});this._body.nodes[e]=t,this.via=t,this.via.parentEdgeId=this.id,this.positionBezierNode()}}positionBezierNode(){this.via!==void 0&&this.from!==void 0&&this.to!==void 0?(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y)):this.via!==void 0&&(this.via.x=0,this.via.y=0)}_line(e,t,i){this._bezierCurve(e,t,i)}_getViaCoordinates(){return this.via}getViaNode(){return this.via}getPoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.via;if(this.from===this.to){const[i,n,s]=this._getCircleData(),o=2*Math.PI*(1-e);return{x:i+s*Math.sin(o),y:n+s-s*(1-Math.cos(o))}}else return{x:Math.pow(1-e,2)*this.fromPoint.x+2*e*(1-e)*t.x+Math.pow(e,2)*this.toPoint.x,y:Math.pow(1-e,2)*this.fromPoint.y+2*e*(1-e)*t.y+Math.pow(e,2)*this.toPoint.y}}_findBorderPosition(e,t){return this._findBorderPositionBezier(e,t,this.via)}_getDistanceToEdge(e,t,i,n,s,o){return this._getDistanceToBezierEdge(e,t,i,n,s,o,this.via)}}class Y2 extends I0{constructor(e,t,i){super(e,t,i)}_line(e,t,i){this._bezierCurve(e,t,i)}getViaNode(){return this._getViaCoordinates()}_getViaCoordinates(){const e=this.options.smooth.roundness,t=this.options.smooth.type;let i=Math.abs(this.from.x-this.to.x),n=Math.abs(this.from.y-this.to.y);if(t==="discrete"||t==="diagonalCross"){let s,o;i<=n?s=o=e*n:s=o=e*i,this.from.x>this.to.x&&(s=-s),this.from.y>=this.to.y&&(o=-o);let a=this.from.x+s,u=this.from.y+o;return t==="discrete"&&(i<=n?a=ithis.to.x&&(s=-s),this.from.y>=this.to.y&&(o=-o);let a=this.from.x+s,u=this.from.y+o;return i<=n?this.from.x<=this.to.x?a=this.to.xa?this.to.x:a:this.from.y>=this.to.y?u=this.to.y>u?this.to.y:u:u=this.to.y2&&arguments[2]!==void 0?arguments[2]:{};return this._findBorderPositionBezier(e,t,i.via)}_getDistanceToEdge(e,t,i,n,s,o){let a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(e,t,i,n,s,o,a)}getPoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates();const i=e,n=Math.pow(1-i,2)*this.fromPoint.x+2*i*(1-i)*t.x+Math.pow(i,2)*this.toPoint.x,s=Math.pow(1-i,2)*this.fromPoint.y+2*i*(1-i)*t.y+Math.pow(i,2)*this.toPoint.y;return{x:n,y:s}}}class yre extends I0{constructor(e,t,i){super(e,t,i)}_getDistanceToBezierEdge2(e,t,i,n,s,o,a,u){let l=1e9,c=e,d=t;const h=[0,0,0,0];for(let f=1;f<10;f++){const p=.1*f;h[0]=Math.pow(1-p,3),h[1]=3*p*Math.pow(1-p,2),h[2]=3*Math.pow(p,2)*(1-p),h[3]=Math.pow(p,3);const v=h[0]*e+h[1]*a.x+h[2]*u.x+h[3]*i,b=h[0]*t+h[1]*a.y+h[2]*u.y+h[3]*n;if(f>0){const m=this._getDistanceToLine(c,d,v,b,s,o);l=mMath.abs(t)||this.options.smooth.forceDirection===!0||this.options.smooth.forceDirection==="horizontal")&&this.options.smooth.forceDirection!=="vertical"?(n=this.from.y,o=this.to.y,i=this.from.x-a*e,s=this.to.x+a*e):(n=this.from.y-a*t,o=this.to.y+a*t,i=this.from.x,s=this.to.x),[{x:i,y:n},{x:s,y:o}]}getViaNode(){return this._getViaCoordinates()}_findBorderPosition(e,t){return this._findBorderPositionBezier(e,t)}_getDistanceToEdge(e,t,i,n,s,o){let[a,u]=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge2(e,t,i,n,s,o,a,u)}getPoint(e){let[t,i]=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates();const n=e,s=[Math.pow(1-n,3),3*n*Math.pow(1-n,2),3*Math.pow(n,2)*(1-n),Math.pow(n,3)],o=s[0]*this.fromPoint.x+s[1]*t.x+s[2]*i.x+s[3]*this.toPoint.x,a=s[0]*this.fromPoint.y+s[1]*t.y+s[2]*i.y+s[3]*this.toPoint.y;return{x:o,y:a}}}class J2 extends A5{constructor(e,t,i){super(e,t,i)}_line(e,t){e.beginPath(),e.moveTo(this.fromPoint.x,this.fromPoint.y),e.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}getViaNode(){}getPoint(e){return{x:(1-e)*this.fromPoint.x+e*this.toPoint.x,y:(1-e)*this.fromPoint.y+e*this.toPoint.y}}_findBorderPosition(e,t){let i=this.to,n=this.from;e.id===this.from.id&&(i=this.from,n=this.to);const s=Math.atan2(i.y-n.y,i.x-n.x),o=i.x-n.x,a=i.y-n.y,u=Math.sqrt(o*o+a*a),l=e.distanceToBorder(t,s),c=(u-l)/u;return{x:(1-c)*n.x+c*i.x,y:(1-c)*n.y+c*i.y,t:0}}_getDistanceToEdge(e,t,i,n,s,o){return this._getDistanceToLine(e,t,i,n,s,o)}}class Pi{constructor(e,t,i,n,s){if(t===void 0)throw new Error("No body provided");this.options=$i(n),this.globalOptions=n,this.defaultOptions=s,this.body=t,this.imagelist=i,this.id=void 0,this.fromId=void 0,this.toId=void 0,this.selected=!1,this.hover=!1,this.labelDirty=!0,this.baseWidth=this.options.width,this.baseFontSize=this.options.font.size,this.from=void 0,this.to=void 0,this.edgeType=void 0,this.connected=!1,this.labelModule=new ls(this.body,this.options,!0),this.setOptions(e)}setOptions(e){if(!e)return;let t=typeof e.physics<"u"&&this.options.physics!==e.physics||typeof e.hidden<"u"&&(this.options.hidden||!1)!==(e.hidden||!1)||typeof e.from<"u"&&this.options.from!==e.from||typeof e.to<"u"&&this.options.to!==e.to;Pi.parseOptions(this.options,e,!0,this.globalOptions),e.id!==void 0&&(this.id=e.id),e.from!==void 0&&(this.fromId=e.from),e.to!==void 0&&(this.toId=e.to),e.title!==void 0&&(this.title=e.title),e.value!==void 0&&(e.value=C5(e.value));const i=[e,this.options,this.defaultOptions];return this.chooser=S0("edge",i),this.updateLabelModule(e),t=this.updateEdgeType()||t,this._setInteractionWidths(),this.connect(),t}static parseOptions(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(Gs(["endPointOffset","arrowStrikethrough","id","from","hidden","hoverWidth","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","selfReference","to","title","value","width","font","chosen","widthConstraint"],e,t,i),t.endPointOffset!==void 0&&t.endPointOffset.from!==void 0&&(tn(t.endPointOffset.from)?e.endPointOffset.from=t.endPointOffset.from:(e.endPointOffset.from=n.endPointOffset.from!==void 0?n.endPointOffset.from:0,console.error("endPointOffset.from is not a valid number"))),t.endPointOffset!==void 0&&t.endPointOffset.to!==void 0&&(tn(t.endPointOffset.to)?e.endPointOffset.to=t.endPointOffset.to:(e.endPointOffset.to=n.endPointOffset.to!==void 0?n.endPointOffset.to:0,console.error("endPointOffset.to is not a valid number"))),du(t.label)?e.label=t.label:du(e.label)||(e.label=void 0),ir(e,t,"smooth",n),ir(e,t,"shadow",n),ir(e,t,"background",n),t.dashes!==void 0&&t.dashes!==null?e.dashes=t.dashes:i===!0&&t.dashes===null&&(e.dashes=an(n.dashes)),t.scaling!==void 0&&t.scaling!==null?(t.scaling.min!==void 0&&(e.scaling.min=t.scaling.min),t.scaling.max!==void 0&&(e.scaling.max=t.scaling.max),ir(e.scaling,t.scaling,"label",n.scaling)):i===!0&&t.scaling===null&&(e.scaling=an(n.scaling)),t.arrows!==void 0&&t.arrows!==null)if(typeof t.arrows=="string"){const a=t.arrows.toLowerCase();e.arrows.to.enabled=Fe(a).call(a,"to")!=-1,e.arrows.middle.enabled=Fe(a).call(a,"middle")!=-1,e.arrows.from.enabled=Fe(a).call(a,"from")!=-1}else if(typeof t.arrows=="object")ir(e.arrows,t.arrows,"to",n.arrows),ir(e.arrows,t.arrows,"middle",n.arrows),ir(e.arrows,t.arrows,"from",n.arrows);else throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+ga(t.arrows));else i===!0&&t.arrows===null&&(e.arrows=an(n.arrows));if(t.color!==void 0&&t.color!==null){const a=as(t.color)?{color:t.color,highlight:t.color,hover:t.color,inherit:!1,opacity:1}:t.color,u=e.color;if(s)Ue(u,n.color,!1,i);else for(const l in u)Object.prototype.hasOwnProperty.call(u,l)&&delete u[l];if(as(u))u.color=u,u.highlight=u,u.hover=u,u.inherit=!1,a.opacity===void 0&&(u.opacity=1);else{let l=!1;a.color!==void 0&&(u.color=a.color,l=!0),a.highlight!==void 0&&(u.highlight=a.highlight,l=!0),a.hover!==void 0&&(u.hover=a.hover,l=!0),a.inherit!==void 0&&(u.inherit=a.inherit),a.opacity!==void 0&&(u.opacity=Math.min(1,Math.max(0,a.opacity))),l===!0?u.inherit=!1:u.inherit===void 0&&(u.inherit="from")}}else i===!0&&t.color===null&&(e.color=$i(n.color));i===!0&&t.font===null&&(e.font=$i(n.font)),Object.prototype.hasOwnProperty.call(t,"selfReferenceSize")&&(console.warn("The selfReferenceSize property has been deprecated. Please use selfReference property instead. The selfReference can be set like thise selfReference:{size:30, angle:Math.PI / 4}"),e.selfReference.size=t.selfReferenceSize)}getFormattingValues(){const e=this.options.arrows.to===!0||this.options.arrows.to.enabled===!0,t=this.options.arrows.from===!0||this.options.arrows.from.enabled===!0,i=this.options.arrows.middle===!0||this.options.arrows.middle.enabled===!0,n=this.options.color.inherit,s={toArrow:e,toArrowScale:this.options.arrows.to.scaleFactor,toArrowType:this.options.arrows.to.type,toArrowSrc:this.options.arrows.to.src,toArrowImageWidth:this.options.arrows.to.imageWidth,toArrowImageHeight:this.options.arrows.to.imageHeight,middleArrow:i,middleArrowScale:this.options.arrows.middle.scaleFactor,middleArrowType:this.options.arrows.middle.type,middleArrowSrc:this.options.arrows.middle.src,middleArrowImageWidth:this.options.arrows.middle.imageWidth,middleArrowImageHeight:this.options.arrows.middle.imageHeight,fromArrow:t,fromArrowScale:this.options.arrows.from.scaleFactor,fromArrowType:this.options.arrows.from.type,fromArrowSrc:this.options.arrows.from.src,fromArrowImageWidth:this.options.arrows.from.imageWidth,fromArrowImageHeight:this.options.arrows.from.imageHeight,arrowStrikethrough:this.options.arrowStrikethrough,color:n?void 0:this.options.color.color,inheritsColor:n,opacity:this.options.color.opacity,hidden:this.options.hidden,length:this.options.length,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y,dashes:this.options.dashes,width:this.options.width,background:this.options.background.enabled,backgroundColor:this.options.background.color,backgroundSize:this.options.background.size,backgroundDashes:this.options.background.dashes};if(this.selected||this.hover)if(this.chooser===!0){if(this.selected){const o=this.options.selectionWidth;typeof o=="function"?s.width=o(s.width):typeof o=="number"&&(s.width+=o),s.width=Math.max(s.width,.3/this.body.view.scale),s.color=this.options.color.highlight,s.shadow=this.options.shadow.enabled}else if(this.hover){const o=this.options.hoverWidth;typeof o=="function"?s.width=o(s.width):typeof o=="number"&&(s.width+=o),s.width=Math.max(s.width,.3/this.body.view.scale),s.color=this.options.color.hover,s.shadow=this.options.shadow.enabled}}else typeof this.chooser=="function"&&(this.chooser(s,this.options.id,this.selected,this.hover),s.color!==void 0&&(s.inheritsColor=!1),s.shadow===!1&&(s.shadowColor!==this.options.shadow.color||s.shadowSize!==this.options.shadow.size||s.shadowX!==this.options.shadow.x||s.shadowY!==this.options.shadow.y)&&(s.shadow=!0));else s.shadow=this.options.shadow.enabled,s.width=Math.max(s.width,.3/this.body.view.scale);return s}updateLabelModule(e){const t=[e,this.options,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,t),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}updateEdgeType(){const e=this.options.smooth;let t=!1,i=!0;return this.edgeType!==void 0&&((this.edgeType instanceof G2&&e.enabled===!0&&e.type==="dynamic"||this.edgeType instanceof X2&&e.enabled===!0&&e.type==="cubicBezier"||this.edgeType instanceof Y2&&e.enabled===!0&&e.type!=="dynamic"&&e.type!=="cubicBezier"||this.edgeType instanceof J2&&e.type.enabled===!1)&&(i=!1),i===!0&&(t=this.cleanup())),i===!0?e.enabled===!0?e.type==="dynamic"?(t=!0,this.edgeType=new G2(this.options,this.body,this.labelModule)):e.type==="cubicBezier"?this.edgeType=new X2(this.options,this.body,this.labelModule):this.edgeType=new Y2(this.options,this.body,this.labelModule):this.edgeType=new J2(this.options,this.body,this.labelModule):this.edgeType.setOptions(this.options),t}connect(){this.disconnect(),this.from=this.body.nodes[this.fromId]||void 0,this.to=this.body.nodes[this.toId]||void 0,this.connected=this.from!==void 0&&this.to!==void 0,this.connected===!0?(this.from.attachEdge(this),this.to.attachEdge(this)):(this.from&&this.from.detachEdge(this),this.to&&this.to.detachEdge(this)),this.edgeType.connect()}disconnect(){this.from&&(this.from.detachEdge(this),this.from=void 0),this.to&&(this.to.detachEdge(this),this.to=void 0),this.connected=!1}getTitle(){return this.title}isSelected(){return this.selected}getValue(){return this.options.value}setValueRange(e,t,i){if(this.options.value!==void 0){const n=this.options.scaling.customScalingFunction(e,t,i,this.options.value),s=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){const o=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+n*o}this.options.width=this.options.scaling.min+n*s}else this.options.width=this.baseWidth,this.options.font.size=this.baseFontSize;this._setInteractionWidths(),this.updateLabelModule()}_setInteractionWidths(){typeof this.options.hoverWidth=="function"?this.edgeType.hoverWidth=this.options.hoverWidth(this.options.width):this.edgeType.hoverWidth=this.options.hoverWidth+this.options.width,typeof this.options.selectionWidth=="function"?this.edgeType.selectionWidth=this.options.selectionWidth(this.options.width):this.edgeType.selectionWidth=this.options.selectionWidth+this.options.width}draw(e){const t=this.getFormattingValues();if(t.hidden)return;const i=this.edgeType.getViaNode();this.edgeType.drawLine(e,t,this.selected,this.hover,i),this.drawLabel(e,i)}drawArrows(e){const t=this.getFormattingValues();if(t.hidden)return;const i=this.edgeType.getViaNode(),n={};this.edgeType.fromPoint=this.edgeType.from,this.edgeType.toPoint=this.edgeType.to,t.fromArrow&&(n.from=this.edgeType.getArrowData(e,"from",i,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.fromPoint=n.from.core),t.fromArrowSrc&&(n.from.image=this.imagelist.load(t.fromArrowSrc)),t.fromArrowImageWidth&&(n.from.imageWidth=t.fromArrowImageWidth),t.fromArrowImageHeight&&(n.from.imageHeight=t.fromArrowImageHeight)),t.toArrow&&(n.to=this.edgeType.getArrowData(e,"to",i,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.toPoint=n.to.core),t.toArrowSrc&&(n.to.image=this.imagelist.load(t.toArrowSrc)),t.toArrowImageWidth&&(n.to.imageWidth=t.toArrowImageWidth),t.toArrowImageHeight&&(n.to.imageHeight=t.toArrowImageHeight)),t.middleArrow&&(n.middle=this.edgeType.getArrowData(e,"middle",i,this.selected,this.hover,t),t.middleArrowSrc&&(n.middle.image=this.imagelist.load(t.middleArrowSrc)),t.middleArrowImageWidth&&(n.middle.imageWidth=t.middleArrowImageWidth),t.middleArrowImageHeight&&(n.middle.imageHeight=t.middleArrowImageHeight)),t.fromArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,n.from),t.middleArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,n.middle),t.toArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,n.to)}drawLabel(e,t){if(this.options.label!==void 0){const i=this.from,n=this.to;this.labelModule.differentState(this.selected,this.hover)&&this.labelModule.getTextSize(e,this.selected,this.hover);let s;if(i.id!=n.id){this.labelModule.pointToSelf=!1,s=this.edgeType.getPoint(.5,t),e.save();const o=this._getRotation(e);o.angle!=0&&(e.translate(o.x,o.y),e.rotate(o.angle)),this.labelModule.draw(e,s.x,s.y,this.selected,this.hover),e.restore()}else{this.labelModule.pointToSelf=!0;const o=x5(e,this.options.selfReference.angle,this.options.selfReference.size,i);s=this._pointOnCircle(o.x,o.y,this.options.selfReference.size,this.options.selfReference.angle),this.labelModule.draw(e,s.x,s.y,this.selected,this.hover)}}}getItemsOnPoint(e){const t=[];if(this.labelModule.visible()){const n=this._getRotation();Y_(this.labelModule.getSize(),e,n)&&t.push({edgeId:this.id,labelId:0})}const i={left:e.x,top:e.y};return this.isOverlappingWith(i)&&t.push({edgeId:this.id}),t}isOverlappingWith(e){if(this.connected){const i=this.from.x,n=this.from.y,s=this.to.x,o=this.to.y,a=e.left,u=e.top;return this.edgeType.getDistanceToEdge(i,n,s,o,a,u)<10}else return!1}_getRotation(e){const t=this.edgeType.getViaNode(),i=this.edgeType.getPoint(.5,t);e!==void 0&&this.labelModule.calculateLabelSize(e,this.selected,this.hover,i.x,i.y);const n={x:i.x,y:this.labelModule.size.yLine,angle:0};if(!this.labelModule.visible()||this.options.font.align==="horizontal")return n;const s=this.from.y-this.to.y,o=this.from.x-this.to.x;let a=Math.atan2(s,o);return(a<-1&&o<0||a>0&&o<0)&&(a+=Math.PI),n.angle=a,n}_pointOnCircle(e,t,i,n){return{x:e+i*Math.cos(n),y:t-i*Math.sin(n)}}select(){this.selected=!0}unselect(){this.selected=!1}cleanup(){return this.edgeType.cleanup()}remove(){this.cleanup(),this.disconnect(),delete this.body.edges[this.id]}endPointsValid(){return this.body.nodes[this.fromId]!==void 0&&this.body.nodes[this.toId]!==void 0}}class bre{constructor(e,t,i){var n;this.body=e,this.images=t,this.groups=i,this.body.functions.createEdge=z(n=this.create).call(n,this),this.edgesListeners={add:(s,o)=>{this.add(o.items)},update:(s,o)=>{this.update(o.items)},remove:(s,o)=>{this.remove(o.items)}},this.options={},this.defaultOptions={arrows:{to:{enabled:!1,scaleFactor:1,type:"arrow"},middle:{enabled:!1,scaleFactor:1,type:"arrow"},from:{enabled:!1,scaleFactor:1,type:"arrow"}},endPointOffset:{from:0,to:0},arrowStrikethrough:!0,color:{color:"#848484",highlight:"#848484",hover:"#848484",inherit:"from",opacity:1},dashes:!1,font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:2,strokeColor:"#ffffff",align:"horizontal",multi:!1,vadjust:0,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"courier new",vadjust:2}},hidden:!1,hoverWidth:1.5,label:void 0,labelHighlightBold:!0,length:void 0,physics:!0,scaling:{min:1,max:15,label:{enabled:!0,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(s,o,a,u){if(o===s)return .5;{const l=1/(o-s);return Math.max(0,(u-s)*l)}}},selectionWidth:1.5,selfReference:{size:20,angle:Math.PI/4,renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},background:{enabled:!1,color:"rgba(111,111,111,1)",size:10,dashes:!1},smooth:{enabled:!0,type:"dynamic",forceDirection:"none",roundness:.5},title:void 0,width:1,value:void 0},Ue(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e=this,t,i;this.body.emitter.on("_forceDisableDynamicCurves",function(n){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n==="dynamic"&&(n="continuous");let o=!1;for(const a in e.body.edges)if(Object.prototype.hasOwnProperty.call(e.body.edges,a)){const u=e.body.edges[a],l=e.body.data.edges.get(a);if(l!=null){const c=l.smooth;c!==void 0&&c.enabled===!0&&c.type==="dynamic"&&(n===void 0?u.setOptions({smooth:!1}):u.setOptions({smooth:{type:n}}),o=!0)}}s===!0&&o===!0&&e.body.emitter.emit("_dataChanged")}),this.body.emitter.on("_dataUpdated",()=>{this.reconnectEdges()}),this.body.emitter.on("refreshEdges",z(t=this.refresh).call(t,this)),this.body.emitter.on("refresh",z(i=this.refresh).call(i,this)),this.body.emitter.on("destroy",()=>{Oe(this.edgesListeners,(n,s)=>{this.body.data.edges&&this.body.data.edges.off(s,n)}),delete this.body.functions.createEdge,delete this.edgesListeners.add,delete this.edgesListeners.update,delete this.edgesListeners.remove,delete this.edgesListeners})}setOptions(e){if(e!==void 0){Pi.parseOptions(this.options,e,!0,this.defaultOptions,!0);let t=!1;if(e.smooth!==void 0)for(const i in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,i)&&(t=this.body.edges[i].updateEdgeType()||t);if(e.font!==void 0)for(const i in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,i)&&this.body.edges[i].updateLabelModule();(e.hidden!==void 0||e.physics!==void 0||t===!0)&&this.body.emitter.emit("_dataChanged")}}setData(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.body.data.edges;if(l3("id",e))this.body.data.edges=e;else if(et(e))this.body.data.edges=new nu,this.body.data.edges.add(e);else if(!e)this.body.data.edges=new nu;else throw new TypeError("Array or DataSet expected");if(i&&Oe(this.edgesListeners,(n,s)=>{i.off(s,n)}),this.body.edges={},this.body.data.edges){Oe(this.edgesListeners,(s,o)=>{this.body.data.edges.on(o,s)});const n=this.body.data.edges.getIds();this.add(n,!0)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),t===!1&&this.body.emitter.emit("_dataChanged")}add(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.body.edges,n=this.body.data.edges;for(let s=0;s1&&arguments[1]!==void 0?arguments[1]:!0;if(e.length===0)return;const i=this.body.edges;Oe(e,n=>{const s=i[n];s!==void 0&&s.remove()}),t&&this.body.emitter.emit("_dataChanged")}refresh(){Oe(this.body.edges,(e,t)=>{const i=this.body.data.edges.get(t);i!==void 0&&e.setOptions(i)})}create(e){return new Pi(e,this.body,this.images,this.options,this.defaultOptions)}reconnectEdges(){let e;const t=this.body.nodes,i=this.body.edges;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e].edges=[]);for(e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const n=i[e];n.from=null,n.to=null,n.connect()}}getConnectedNodes(e){const t=[];if(this.body.edges[e]!==void 0){const i=this.body.edges[e];i.fromId!==void 0&&t.push(i.fromId),i.toId!==void 0&&t.push(i.toId)}return t}_updateState(){this._addMissingEdges(),this._removeInvalidEdges()}_removeInvalidEdges(){const e=[];Oe(this.body.edges,(t,i)=>{const n=this.body.nodes[t.toId],s=this.body.nodes[t.fromId];n!==void 0&&n.isCluster===!0||s!==void 0&&s.isCluster===!0||(n===void 0||s===void 0)&&e.push(i)}),this.remove(e,!1)}_addMissingEdges(){const e=this.body.data.edges;if(e==null)return;const t=this.body.edges,i=[];Le(e).call(e,(n,s)=>{t[s]===void 0&&i.push(s)}),this.add(i,!0)}}class M5{constructor(e,t,i){this.body=e,this.physicsBody=t,this.barnesHutTree,this.setOptions(i),this._rng=il("BARNES HUT SOLVER")}setOptions(e){this.options=e,this.thetaInversed=1/this.options.theta,this.overlapAvoidanceFactor=1-Math.max(0,Math.min(1,this.options.avoidOverlap))}solve(){if(this.options.gravitationalConstant!==0&&this.physicsBody.physicsNodeIndices.length>0){let e;const t=this.body.nodes,i=this.physicsBody.physicsNodeIndices,n=i.length,s=this._formBarnesHutTree(t,i);this.barnesHutTree=s;for(let o=0;o0&&this._getForceContributions(s.root,e)}}_getForceContributions(e,t){this._getForceContribution(e.children.NW,t),this._getForceContribution(e.children.NE,t),this._getForceContribution(e.children.SW,t),this._getForceContribution(e.children.SE,t)}_getForceContribution(e,t){if(e.childrenCount>0){const i=e.centerOfMass.x-t.x,n=e.centerOfMass.y-t.y,s=Math.sqrt(i*i+n*n);s*e.calcSize>this.thetaInversed?this._calculateForces(s,i,n,t,e):e.childrenCount===4?this._getForceContributions(e,t):e.children.data.id!=t.id&&this._calculateForces(s,i,n,t,e)}}_calculateForces(e,t,i,n,s){e===0&&(e=.1,t=e),this.overlapAvoidanceFactor<1&&n.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*n.shape.radius,e-n.shape.radius));const o=this.options.gravitationalConstant*s.mass*n.options.mass/Math.pow(e,3),a=t*o,u=i*o;this.physicsBody.forces[n.id].x+=a,this.physicsBody.forces[n.id].y+=u}_formBarnesHutTree(e,t){let i;const n=t.length;let s=e[t[0]].x,o=e[t[0]].y,a=e[t[0]].x,u=e[t[0]].y;for(let b=1;b0&&(ga&&(a=g),wu&&(u=w))}const l=Math.abs(a-s)-Math.abs(u-o);l>0?(o-=.5*l,u+=.5*l):(s+=.5*l,a-=.5*l);const d=Math.max(1e-5,Math.abs(a-s)),h=.5*d,f=.5*(s+a),p=.5*(o+u),v={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:f-h,maxX:f+h,minY:p-h,maxY:p+h},size:d,calcSize:1/d,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(v.root);for(let b=0;b0&&this._placeInTree(v.root,i);return v}_updateBranchMass(e,t){const i=e.centerOfMass,n=e.mass+t.options.mass,s=1/n;i.x=i.x*e.mass+t.x*t.options.mass,i.x*=s,i.y=i.y*e.mass+t.y*t.options.mass,i.y*=s,e.mass=n;const o=Math.max(Math.max(t.height,t.radius),t.width);e.maxWidth=e.maxWidtht.x?n.maxY>t.y?s="NW":s="SW":n.maxY>t.y?s="NE":s="SE",this._placeInRegion(e,t,s)}_placeInRegion(e,t,i){const n=e.children[i];switch(n.childrenCount){case 0:n.children.data=t,n.childrenCount=1,this._updateBranchMass(n,t);break;case 1:n.children.data.x===t.x&&n.children.data.y===t.y?(t.x+=this._rng(),t.y+=this._rng()):(this._splitBranch(n),this._placeInTree(n,t));break;case 4:this._placeInTree(n,t);break}}_splitBranch(e){let t=null;e.childrenCount===1&&(t=e.children.data,e.mass=0,e.centerOfMass.x=0,e.centerOfMass.y=0),e.childrenCount=4,e.children.data=null,this._insertRegion(e,"NW"),this._insertRegion(e,"NE"),this._insertRegion(e,"SW"),this._insertRegion(e,"SE"),t!=null&&this._placeInTree(e,t)}_insertRegion(e,t){let i,n,s,o;const a=.5*e.size;switch(t){case"NW":i=e.range.minX,n=e.range.minX+a,s=e.range.minY,o=e.range.minY+a;break;case"NE":i=e.range.minX+a,n=e.range.maxX,s=e.range.minY,o=e.range.minY+a;break;case"SW":i=e.range.minX,n=e.range.minX+a,s=e.range.minY+a,o=e.range.maxY;break;case"SE":i=e.range.minX+a,n=e.range.maxX,s=e.range.minY+a,o=e.range.maxY;break}e.children[t]={centerOfMass:{x:0,y:0},mass:0,range:{minX:i,maxX:n,minY:s,maxY:o},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}_debug(e,t){this.barnesHutTree!==void 0&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,t))}_drawBranch(e,t,i){i===void 0&&(i="#FF0000"),e.childrenCount===4&&(this._drawBranch(e.children.NW,t),this._drawBranch(e.children.NE,t),this._drawBranch(e.children.SE,t),this._drawBranch(e.children.SW,t)),t.strokeStyle=i,t.beginPath(),t.moveTo(e.range.minX,e.range.minY),t.lineTo(e.range.maxX,e.range.minY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.minY),t.lineTo(e.range.maxX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.maxY),t.lineTo(e.range.minX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.minX,e.range.maxY),t.lineTo(e.range.minX,e.range.minY),t.stroke()}}class _re{constructor(e,t,i){this._rng=il("REPULSION SOLVER"),this.body=e,this.physicsBody=t,this.setOptions(i)}setOptions(e){this.options=e}solve(){let e,t,i,n,s,o,a,u;const l=this.body.nodes,c=this.physicsBody.physicsNodeIndices,d=this.physicsBody.forces,h=this.options.nodeDistance,f=-2/3/h,p=4/3;for(let v=0;v0){const o=s.edges.length+1,a=this.options.centralGravity*o*s.options.mass;n[s.id].x=t*a,n[s.id].y=i*a}}}class Ire{constructor(e){this.body=e,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:"barnesHut",stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0,wind:{x:0,y:0}},ot(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}bindEventListeners(){this.body.emitter.on("initPhysics",()=>{this.initPhysics()}),this.body.emitter.on("_layoutFailed",()=>{this.layoutFailed=!0}),this.body.emitter.on("resetPhysics",()=>{this.stopSimulation(),this.ready=!1}),this.body.emitter.on("disablePhysics",()=>{this.physicsEnabled=!1,this.stopSimulation()}),this.body.emitter.on("restorePhysics",()=>{this.setOptions(this.options),this.ready===!0&&this.startSimulation()}),this.body.emitter.on("startSimulation",()=>{this.ready===!0&&this.startSimulation()}),this.body.emitter.on("stopSimulation",()=>{this.stopSimulation()}),this.body.emitter.on("destroy",()=>{this.stopSimulation(!1),this.body.emitter.off()}),this.body.emitter.on("_dataChanged",()=>{this.updatePhysicsData()})}setOptions(e){if(e!==void 0)if(e===!1)this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation();else if(e===!0)this.options.enabled=!0,this.physicsEnabled=!0,this.startSimulation();else{this.physicsEnabled=!0,lu(["stabilization"],this.options,e),ir(this.options,e,"stabilization"),e.enabled===void 0&&(this.options.enabled=!0),this.options.enabled===!1&&(this.physicsEnabled=!1,this.stopSimulation());const t=this.options.wind;t&&((typeof t.x!="number"||G_(t.x))&&(t.x=0),(typeof t.y!="number"||G_(t.y))&&(t.y=0)),this.timestep=this.options.timestep}this.init()}init(){let e;this.options.solver==="forceAtlas2Based"?(e=this.options.forceAtlas2Based,this.nodesSolver=new Sre(this.body,this.physicsBody,e),this.edgesSolver=new S1(this.body,this.physicsBody,e),this.gravitySolver=new Ore(this.body,this.physicsBody,e)):this.options.solver==="repulsion"?(e=this.options.repulsion,this.nodesSolver=new _re(this.body,this.physicsBody,e),this.edgesSolver=new S1(this.body,this.physicsBody,e),this.gravitySolver=new Va(this.body,this.physicsBody,e)):this.options.solver==="hierarchicalRepulsion"?(e=this.options.hierarchicalRepulsion,this.nodesSolver=new wre(this.body,this.physicsBody,e),this.edgesSolver=new Ere(this.body,this.physicsBody,e),this.gravitySolver=new Va(this.body,this.physicsBody,e)):(e=this.options.barnesHut,this.nodesSolver=new M5(this.body,this.physicsBody,e),this.edgesSolver=new S1(this.body,this.physicsBody,e),this.gravitySolver=new Va(this.body,this.physicsBody,e)),this.modelOptions=e}initPhysics(){this.physicsEnabled===!0&&this.options.enabled===!0?this.options.stabilization.enabled===!0?this.stabilize():(this.stabilized=!1,this.ready=!0,this.body.emitter.emit("fit",{},this.layoutFailed),this.startSimulation()):(this.ready=!0,this.body.emitter.emit("fit"))}startSimulation(){if(this.physicsEnabled===!0&&this.options.enabled===!0){if(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit("_resizeNodes"),this.viewFunction===void 0){var e;this.viewFunction=z(e=this.simulationStep).call(e,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}else this.body.emitter.emit("_redraw")}stopSimulation(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.stabilized=!0,e===!0&&this._emitStabilized(),this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.viewFunction=void 0,e===!0&&this.body.emitter.emit("_stopRendering"))}simulationStep(){const e=su();this.physicsTick(),(su()-e<.4*this.simulationInterval||this.runDoubleSpeed===!0)&&this.stabilized===!1&&(this.physicsTick(),this.runDoubleSpeed=!0),this.stabilized===!0&&this.stopSimulation()}_emitStabilized(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||this.startedStabilization===!0)&&Zr(()=>{this.body.emitter.emit("stabilized",{iterations:e}),this.startedStabilization=!1,this.stabilizationIterations=0},0)}physicsStep(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve(),this.moveNodes()}adjustTimeStep(){this._evaluateStepQuality()===!0?this.timestep=1.2*this.timestep:this.timestep/1.2o))return!1;return!0}moveNodes(){const e=this.physicsBody.physicsNodeIndices;let t=0,i=0;const n=5;for(let s=0;so&&(e=e>0?o:-o),e}_performStep(e){const t=this.body.nodes[e],i=this.physicsBody.forces[e];this.options.wind&&(i.x+=this.options.wind.x,i.y+=this.options.wind.y);const n=this.physicsBody.velocities[e];return this.previousStates[e]={x:t.x,y:t.y,vx:n.x,vy:n.y},t.options.fixed.x===!1?(n.x=this.calculateComponentVelocity(n.x,i.x,t.options.mass),t.x+=n.x*this.timestep):(i.x=0,n.x=0),t.options.fixed.y===!1?(n.y=this.calculateComponentVelocity(n.y,i.y,t.options.mass),t.y+=n.y*this.timestep):(i.y=0,n.y=0),Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2))}_freezeNodes(){const e=this.body.nodes;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t].x&&e[t].y){const i=e[t].options.fixed;this.freezeCache[t]={x:i.x,y:i.y},i.x=!0,i.y=!0}}_restoreFrozenNodes(){const e=this.body.nodes;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.freezeCache[t]!==void 0&&(e[t].options.fixed.x=this.freezeCache[t].x,e[t].options.fixed.y=this.freezeCache[t].y);this.freezeCache={}}stabilize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.stabilization.iterations;if(typeof e!="number"&&(e=this.options.stabilization.iterations,console.error("The stabilize method needs a numeric amount of iterations. Switching to default: ",e)),this.physicsBody.physicsNodeIndices.length===0){this.ready=!0;return}this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit("_resizeNodes"),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit("_blockRedraw"),this.targetIterations=e,this.options.stabilization.onlyDynamicEdges===!0&&this._freezeNodes(),this.stabilizationIterations=0,Zr(()=>this._stabilizationBatch(),0)}_startStabilizing(){return this.startedStabilization===!0?!1:(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0,!0)}_stabilizationBatch(){const e=()=>this.stabilized===!1&&this.stabilizationIterations{this.body.emitter.emit("stabilizationProgress",{iterations:this.stabilizationIterations,total:this.targetIterations})};this._startStabilizing()&&t();let i=0;for(;e()&&i"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");O1=crypto.getRandomValues.bind(crypto)}return O1($re)}const Rre=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var Q2={randomUUID:Rre};function Cre(r,e,t){var n;r=r||{};const i=r.random??((n=r.rng)==null?void 0:n.call(r))??Pre();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Tre(i)}function _o(r,e,t){return Q2.randomUUID?Q2.randomUUID():Cre(r)}class kt{constructor(){}static getRange(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=1e9,n=-1e9,s=1e9,o=-1e9,a;if(t.length>0)for(let u=0;ua.shape.boundingBox.left&&(s=a.shape.boundingBox.left),oa.shape.boundingBox.top&&(i=a.shape.boundingBox.top),n1&&arguments[1]!==void 0?arguments[1]:[],i=1e9,n=-1e9,s=1e9,o=-1e9,a;if(t.length>0)for(let u=0;ua.x&&(s=a.x),oa.y&&(i=a.y),n{delete this.containedEdges[i.id]}),Oe(t.containedNodes,(i,n)=>{this.containedNodes[n]=i}),t.containedNodes={},Oe(t.containedEdges,(i,n)=>{this.containedEdges[n]=i}),t.containedEdges={},Oe(t.edges,i=>{Oe(this.edges,n=>{var s,o;const a=Fe(s=n.clusteringEdgeReplacingIds).call(s,i.id);a!==-1&&(Oe(i.clusteringEdgeReplacingIds,u=>{n.clusteringEdgeReplacingIds.push(u),this.body.edges[u].edgeReplacedById=n.id}),Qr(o=n.clusteringEdgeReplacingIds).call(o,a,1))})}),t.edges=[]}}class qre{constructor(e){this.body=e,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},ot(this.options,this.defaultOptions),this.body.emitter.on("_resetData",()=>{this.clusteredNodes={},this.clusteredEdges={}})}clusterByHubsize(e,t){e===void 0?e=this._getHubSize():typeof e=="object"&&(t=this._checkOptions(e),e=this._getHubSize());const i=[];for(let n=0;n=e&&i.push(s.id)}for(let n=0;n0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.joinCondition===void 0)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");e=this._checkOptions(e);const i={},n={};Oe(this.body.nodes,(s,o)=>{s.options&&e.joinCondition(s.options)===!0&&(i[o]=s,Oe(s.edges,a=>{this.clusteredEdges[a.id]===void 0&&(n[a.id]=a)}))}),this._cluster(i,n,e,t)}clusterByEdgeCount(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;t=this._checkOptions(t);const n=[],s={};let o,a,u;for(let l=0;l0&&Ze(d).length>0&&v===!0){const m=function(){for(let g=0;g1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(1,e,t)}clusterBridges(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(2,e,t)}clusterByConnection(e,t){var i;let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No nodeId supplied to clusterByConnection!");if(this.body.nodes[e]===void 0)throw new Error("The nodeId given to clusterByConnection does not exist!");const s=this.body.nodes[e];t=this._checkOptions(t,s),t.clusterNodeProperties.x===void 0&&(t.clusterNodeProperties.x=s.x),t.clusterNodeProperties.y===void 0&&(t.clusterNodeProperties.y=s.y),t.clusterNodeProperties.fixed===void 0&&(t.clusterNodeProperties.fixed={},t.clusterNodeProperties.fixed.x=s.options.fixed.x,t.clusterNodeProperties.fixed.y=s.options.fixed.y);const o={},a={},u=s.id,l=kt.cloneOptions(s);o[u]=s;for(let d=0;d-1&&(a[p.id]=p)}}this._cluster(o,a,t,n)}_createClusterEdges(e,t,i,n){let s,o,a,u,l,c;const d=Ze(e),h=[];for(let v=0;v0&&arguments[0]!==void 0?arguments[0]:{};return e.clusterEdgeProperties===void 0&&(e.clusterEdgeProperties={}),e.clusterNodeProperties===void 0&&(e.clusterNodeProperties={}),e}_cluster(e,t,i){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;const s=[];for(const c in e)Object.prototype.hasOwnProperty.call(e,c)&&this.clusteredNodes[c]!==void 0&&s.push(c);for(let c=0;cn?a.x:n,s=a.yo?a.y:o;return{x:.5*(i+n),y:.5*(s+o)}}openCluster(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No clusterNodeId supplied to openCluster.");const n=this.body.nodes[e];if(n===void 0)throw new Error("The clusterNodeId supplied to openCluster does not exist.");if(n.isCluster!==!0||n.containedNodes===void 0||n.containedEdges===void 0)throw new Error("The node:"+e+" is not a valid cluster.");const s=this.findNode(e),o=Fe(s).call(s,e)-1;if(o>=0){const c=s[o];this.body.nodes[c]._openChildCluster(e),delete this.body.nodes[e],i===!0&&this.body.emitter.emit("_dataChanged");return}const a=n.containedNodes,u=n.containedEdges;if(t!==void 0&&t.releaseFunction!==void 0&&typeof t.releaseFunction=="function"){const c={},d={x:n.x,y:n.y};for(const f in a)if(Object.prototype.hasOwnProperty.call(a,f)){const p=this.body.nodes[f];c[f]={x:p.x,y:p.y}}const h=t.releaseFunction(d,c);for(const f in a)if(Object.prototype.hasOwnProperty.call(a,f)){const p=this.body.nodes[f];h[f]!==void 0&&(p.x=h[f].x===void 0?n.x:h[f].x,p.y=h[f].y===void 0?n.y:h[f].y)}}else Oe(a,function(c){c.options.fixed.x===!1&&(c.x=n.x),c.options.fixed.y===!1&&(c.y=n.y)});for(const c in a)if(Object.prototype.hasOwnProperty.call(a,c)){const d=this.body.nodes[c];d.vx=n.vx,d.vy=n.vy,d.setOptions({physics:!0}),delete this.clusteredNodes[c]}const l=[];for(let c=0;c0&&on&&(n=l.edges.length),e+=l.edges.length,t+=Math.pow(l.edges.length,2),i+=1}e=e/i,t=t/i;const s=t-Math.pow(e,2),o=Math.sqrt(s);let a=Math.floor(e+2*o);return a>n&&(a=n),a}_createClusteredEdge(e,t,i,n,s){const o=kt.cloneOptions(i,"edge");Ue(o,n),o.from=e,o.to=t,o.id="clusterEdge:"+_o(),s!==void 0&&Ue(o,s);const a=this.body.functions.createEdge(o);return a.clusteringEdgeReplacingIds=[i.id],a.connect(),this.body.edges[a.id]=a,a}_clusterEdges(e,t,i,n){if(t instanceof Pi){const s=t,o={};o[s.id]=s,t=o}if(e instanceof Ke){const s=e,o={};o[s.id]=s,e=o}if(i==null)throw new Error("_clusterEdges: parameter clusterNode required");n===void 0&&(n=i.clusterEdgeProperties),this._createClusterEdges(e,t,i,n);for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&this.body.edges[s]!==void 0){const o=this.body.edges[s];this._backupEdgeOptions(o),o.setOptions({physics:!1})}for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(this.clusteredNodes[s]={clusterId:i.id,node:this.body.nodes[s]},this.body.nodes[s].setOptions({physics:!1}))}_getClusterNodeForNode(e){if(e===void 0)return;const t=this.clusteredNodes[e];if(t===void 0)return;const i=t.clusterId;if(i!==void 0)return this.body.nodes[i]}_filter(e,t){const i=[];return Oe(e,n=>{t(n)&&i.push(n)}),i}_updateState(){let e;const t=[],i={},n=u=>{Oe(this.body.nodes,l=>{l.isCluster===!0&&u(l)})};for(e in this.clusteredNodes){if(!Object.prototype.hasOwnProperty.call(this.clusteredNodes,e))continue;this.body.nodes[e]===void 0&&t.push(e)}n(function(u){for(let l=0;l{const l=this.body.edges[u];(l===void 0||!l.endPointsValid())&&(i[u]=u)}),n(function(u){Oe(u.containedEdges,(l,c)=>{!l.endPointsValid()&&!i[c]&&(i[c]=c)})}),Oe(this.body.edges,(u,l)=>{let c=!0;const d=u.clusteringEdgeReplacingIds;if(d!==void 0){let h=0;Oe(d,f=>{const p=this.body.edges[f];p!==void 0&&p.endPointsValid()&&(h+=1)}),c=h>0}(!u.endPointsValid()||!c)&&(i[l]=l)}),n(u=>{Oe(i,l=>{delete u.containedEdges[l],Oe(u.edges,(c,d)=>{if(c.id===l){u.edges[d]=null;return}c.clusteringEdgeReplacingIds=this._filter(c.clusteringEdgeReplacingIds,function(h){return!i[h]})}),u.edges=this._filter(u.edges,function(c){return c!==null})})}),Oe(i,u=>{delete this.clusteredEdges[u]}),Oe(i,u=>{delete this.body.edges[u]});const s=Ze(this.body.edges);Oe(s,u=>{const l=this.body.edges[u],c=this._isClusteredNode(l.fromId)||this._isClusteredNode(l.toId);if(c!==this._isClusteredEdge(l.id))if(c){const d=this._getClusterNodeForNode(l.fromId);d!==void 0&&this._clusterEdges(this.body.nodes[l.fromId],l,d);const h=this._getClusterNodeForNode(l.toId);h!==void 0&&this._clusterEdges(this.body.nodes[l.toId],l,h)}else delete this._clusterEdges[u],this._restoreEdge(l)});let o=!1,a=!0;for(;a;){const u=[];n(function(l){const c=Ze(l.containedNodes).length,d=l.options.allowSingleNodeCluster===!0;(d&&c<1||!d&&c<2)&&u.push(l.id)});for(let l=0;l0,o=o||a}o&&this._updateState()}_isClusteredNode(e){return this.clusteredNodes[e]!==void 0}_isClusteredEdge(e){return this.clusteredEdges[e]!==void 0}}class Dre{constructor(e,t){this.body=e,this.canvas=t,this.redrawRequested=!1,this.requestAnimationFrameRequestId=void 0,this.renderingActive=!1,this.renderRequests=0,this.allowRedraw=!0,this.dragging=!1,this.zooming=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1},ot(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e;this.body.emitter.on("dragStart",()=>{this.dragging=!0}),this.body.emitter.on("dragEnd",()=>{this.dragging=!1}),this.body.emitter.on("zoom",()=>{this.zooming=!0,window.clearTimeout(this.zoomTimeoutId),this.zoomTimeoutId=Zr(()=>{var t;this.zooming=!1,z(t=this._requestRedraw).call(t,this)()},250)}),this.body.emitter.on("_resizeNodes",()=>{this._resizeNodes()}),this.body.emitter.on("_redraw",()=>{this.renderingActive===!1&&this._redraw()}),this.body.emitter.on("_blockRedraw",()=>{this.allowRedraw=!1}),this.body.emitter.on("_allowRedraw",()=>{this.allowRedraw=!0,this.redrawRequested=!1}),this.body.emitter.on("_requestRedraw",z(e=this._requestRedraw).call(e,this)),this.body.emitter.on("_startRendering",()=>{this.renderRequests+=1,this.renderingActive=!0,this._startRendering()}),this.body.emitter.on("_stopRendering",()=>{this.renderRequests-=1,this.renderingActive=this.renderRequests>0,this.requestAnimationFrameRequestId=void 0}),this.body.emitter.on("destroy",()=>{this.renderRequests=0,this.allowRedraw=!1,this.renderingActive=!1,window.cancelAnimationFrame(this.requestAnimationFrameRequestId),this.body.emitter.off()})}setOptions(e){e!==void 0&&Gs(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag"],this.options,e)}_startRendering(){if(this.renderingActive===!0&&this.requestAnimationFrameRequestId===void 0){var e;this.requestAnimationFrameRequestId=window.requestAnimationFrame(z(e=this._renderStep).call(e,this),this.simulationInterval)}}_renderStep(){this.renderingActive===!0&&(this.requestAnimationFrameRequestId=void 0,this._startRendering(),this._redraw())}redraw(){this.body.emitter.emit("setSize"),this._redraw()}_requestRedraw(){this.redrawRequested!==!0&&this.renderingActive===!1&&this.allowRedraw===!0&&(this.redrawRequested=!0,window.requestAnimationFrame(()=>{this._redraw(!1)}))}_redraw(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(this.allowRedraw===!0){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1;const t={drawExternalLabels:null};(this.canvas.frame.canvas.width===0||this.canvas.frame.canvas.height===0)&&this.canvas.setSize(),this.canvas.setTransform();const i=this.canvas.getContext(),n=this.canvas.frame.canvas.clientWidth,s=this.canvas.frame.canvas.clientHeight;if(i.clearRect(0,0,n,s),this.canvas.frame.clientWidth===0)return;if(i.save(),i.translate(this.body.view.translation.x,this.body.view.translation.y),i.scale(this.body.view.scale,this.body.view.scale),i.beginPath(),this.body.emitter.emit("beforeDrawing",i),i.closePath(),e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawEdges(i),this.dragging===!1||this.dragging===!0&&this.options.hideNodesOnDrag===!1){const{drawExternalLabels:o}=this._drawNodes(i,e);t.drawExternalLabels=o}e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawArrows(i),t.drawExternalLabels!=null&&t.drawExternalLabels(),e===!1&&this._drawSelectionBox(i),i.beginPath(),this.body.emitter.emit("afterDrawing",i),i.closePath(),i.restore(),e===!0&&i.clearRect(0,0,n,s)}}_resizeNodes(){this.canvas.setTransform();const e=this.canvas.getContext();e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale);const t=this.body.nodes;let i;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i=t[n],i.resize(e),i.updateBoundingBox(e,i.selected));e.restore()}_drawNodes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.body.nodes,n=this.body.nodeIndices;let s;const o=[],a=[],u=20,l=this.canvas.DOMtoCanvas({x:-20,y:-20}),c=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+u,y:this.canvas.frame.canvas.clientHeight+u}),d={top:l.y,left:l.x,bottom:c.y,right:c.x},h=[];for(let b=0;b{for(const b of h)b()}}}_drawEdges(e){const t=this.body.edges,i=this.body.edgeIndices;for(let n=0;n{t.width!==0&&(this.body.view.translation.x=t.width*.5),t.height!==0&&(this.body.view.translation.y=t.height*.5)}),this.body.emitter.on("setSize",z(e=this.setSize).call(e,this)),this.body.emitter.on("destroy",()=>{this.hammerFrame.destroy(),this.hammer.destroy(),this._cleanUp()})}setOptions(e){if(e!==void 0&&Gs(["width","height","autoResize"],this.options,e),this._cleanUp(),this.options.autoResize===!0){var t;if(window.ResizeObserver){const n=new ResizeObserver(()=>{this.setSize()===!0&&this.body.emitter.emit("_requestRedraw")}),{frame:s}=this;n.observe(s),this._cleanupCallbacks.push(()=>{n.unobserve(s)})}else{const n=Fre(()=>{this.setSize()===!0&&this.body.emitter.emit("_requestRedraw")},1e3);this._cleanupCallbacks.push(()=>{clearInterval(n)})}const i=z(t=this._onResize).call(t,this);window.addEventListener("resize",i),this._cleanupCallbacks.push(()=>{window.removeEventListener("resize",i)})}}_cleanUp(){var e,t,i;Le(e=on(t=Qr(i=this._cleanupCallbacks).call(i,0)).call(t)).call(e,n=>{try{n()}catch(s){console.error(s)}})}_onResize(){this.setSize(),this.body.emitter.emit("_redraw")}_getCameraState(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.pixelRatio;this.initialized===!0&&(this.cameraState.previousWidth=this.frame.canvas.width/e,this.cameraState.previousHeight=this.frame.canvas.height/e,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/e,y:.5*this.frame.canvas.height/e}))}_setCameraState(){if(this.cameraState.scale!==void 0&&this.frame.canvas.clientWidth!==0&&this.frame.canvas.clientHeight!==0&&this.pixelRatio!==0&&this.cameraState.previousWidth>0&&this.cameraState.previousHeight>0){const e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,t=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight;let i=this.cameraState.scale;e!=1&&t!=1?i=this.cameraState.scale*.5*(e+t):e!=1?i=this.cameraState.scale*e:t!=1&&(i=this.cameraState.scale*t),this.body.view.scale=i;const n=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),s={x:n.x-this.cameraState.position.x,y:n.y-this.cameraState.position.y};this.body.view.translation.x+=s.x*this.body.view.scale,this.body.view.translation.y+=s.y*this.body.view.scale}}_prepareValue(e){if(typeof e=="number")return e+"px";if(typeof e=="string"){if(Fe(e).call(e,"%")!==-1||Fe(e).call(e,"px")!==-1)return e;if(Fe(e).call(e,"%")===-1)return e+"px"}throw new Error("Could not use the value supplied for width or height:"+e)}_create(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement("div"),this.frame.className="vis-network",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.tabIndex=0,this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext)this._setPixelRatio(),this.setTransform();else{const e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerText="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(e)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}_bindHammer(){this.hammer!==void 0&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new us(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:us.DIRECTION_ALL}),hu(this.hammer,e=>{this.body.eventListeners.onTouch(e)}),this.hammer.on("tap",e=>{this.body.eventListeners.onTap(e)}),this.hammer.on("doubletap",e=>{this.body.eventListeners.onDoubleTap(e)}),this.hammer.on("press",e=>{this.body.eventListeners.onHold(e)}),this.hammer.on("panstart",e=>{this.body.eventListeners.onDragStart(e)}),this.hammer.on("panmove",e=>{this.body.eventListeners.onDrag(e)}),this.hammer.on("panend",e=>{this.body.eventListeners.onDragEnd(e)}),this.hammer.on("pinch",e=>{this.body.eventListeners.onPinch(e)}),this.frame.canvas.addEventListener("wheel",e=>{this.body.eventListeners.onMouseWheel(e)}),this.frame.canvas.addEventListener("mousemove",e=>{this.body.eventListeners.onMouseMove(e)}),this.frame.canvas.addEventListener("contextmenu",e=>{this.body.eventListeners.onContext(e)}),this.hammerFrame=new us(this.frame),N5(this.hammerFrame,e=>{this.body.eventListeners.onRelease(e)})}setSize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.width,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.height;e=this._prepareValue(e),t=this._prepareValue(t);let i=!1;const n=this.frame.canvas.width,s=this.frame.canvas.height,o=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||t!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=t)this._getCameraState(o),this.frame.style.width=e,this.frame.style.height=t,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=e,this.options.height=t,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},i=!0;else{const a=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),u=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);(this.frame.canvas.width!==a||this.frame.canvas.height!==u)&&this._getCameraState(o),this.frame.canvas.width!==a&&(this.frame.canvas.width=a,i=!0),this.frame.canvas.height!==u&&(this.frame.canvas.height=u,i=!0)}return i===!0&&(this.body.emitter.emit("resize",{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(n/this.pixelRatio),oldHeight:Math.round(s/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,i}getContext(){return this.frame.canvas.getContext("2d")}_determinePixelRatio(){const e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");let t=1;typeof window<"u"&&(t=window.devicePixelRatio||1);const i=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return t/i}_setPixelRatio(){this.pixelRatio=this._determinePixelRatio()}setTransform(){const e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}_XconvertDOMtoCanvas(e){return(e-this.body.view.translation.x)/this.body.view.scale}_XconvertCanvasToDOM(e){return e*this.body.view.scale+this.body.view.translation.x}_YconvertDOMtoCanvas(e){return(e-this.body.view.translation.y)/this.body.view.scale}_YconvertCanvasToDOM(e){return e*this.body.view.scale+this.body.view.translation.y}canvasToDOM(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}DOMtoCanvas(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}}function Bre(r,e){const t=ot({nodes:e,minZoomLevel:Number.MIN_VALUE,maxZoomLevel:1},r??{});if(!et(t.nodes))throw new TypeError("Nodes has to be an array of ids.");if(t.nodes.length===0&&(t.nodes=e),!(typeof t.minZoomLevel=="number"&&t.minZoomLevel>0))throw new TypeError("Min zoom level has to be a number higher than zero.");if(!(typeof t.maxZoomLevel=="number"&&t.minZoomLevel<=t.maxZoomLevel))throw new TypeError("Max zoom level has to be a number higher than min zoom level.");return t}class jre{constructor(e,t){var i,n;this.body=e,this.canvas=t,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction="easeInOutQuint",this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on("fit",z(i=this.fit).call(i,this)),this.body.emitter.on("animationFinished",()=>{this.body.emitter.emit("_stopRendering")}),this.body.emitter.on("unlockNode",z(n=this.releaseNode).call(n,this))}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.options=e}fit(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;e=Bre(e,this.body.nodeIndices);const i=this.canvas.frame.canvas.clientWidth,n=this.canvas.frame.canvas.clientHeight;let s,o;if(i===0||n===0)o=1,s=kt.getRange(this.body.nodes,e.nodes);else if(t===!0){let l=0;for(const h in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,h)&&this.body.nodes[h].predefinedPosition===!0&&(l+=1);if(l>.5*this.body.nodeIndices.length){this.fit(e,!1);return}s=kt.getRange(this.body.nodes,e.nodes),o=12.662/(this.body.nodeIndices.length+7.4147)+.0964822;const d=Math.min(i/600,n/600);o*=d}else{this.body.emitter.emit("_resizeNodes"),s=kt.getRange(this.body.nodes,e.nodes);const l=Math.abs(s.maxX-s.minX)*1.1,c=Math.abs(s.maxY-s.minY)*1.1,d=i/l,h=n/c;o=d<=h?d:h}o>e.maxZoomLevel?o=e.maxZoomLevel:o1&&arguments[1]!==void 0?arguments[1]:{};if(this.body.nodes[e]!==void 0){const i={x:this.body.nodes[e].x,y:this.body.nodes[e].y};t.position=i,t.lockedOnNode=e,this.moveTo(t)}else console.error("Node: "+e+" cannot be found.")}moveTo(e){if(e===void 0){e={};return}if(e.offset!=null){if(e.offset.x!=null){if(e.offset.x=+e.offset.x,!tn(e.offset.x))throw new TypeError('The option "offset.x" has to be a finite number.')}else e.offset.x=0;if(e.offset.y!=null){if(e.offset.y=+e.offset.y,!tn(e.offset.y))throw new TypeError('The option "offset.y" has to be a finite number.')}else e.offset.x=0}else e.offset={x:0,y:0};if(e.position!=null){if(e.position.x!=null){if(e.position.x=+e.position.x,!tn(e.position.x))throw new TypeError('The option "position.x" has to be a finite number.')}else e.position.x=0;if(e.position.y!=null){if(e.position.y=+e.position.y,!tn(e.position.y))throw new TypeError('The option "position.y" has to be a finite number.')}else e.position.x=0}else e.position=this.getViewPosition();if(e.scale!=null){if(e.scale=+e.scale,!(e.scale>0))throw new TypeError('The option "scale" has to be a number greater than zero.')}else e.scale=this.body.view.scale;e.animation===void 0&&(e.animation={duration:0}),e.animation===!1&&(e.animation={duration:0}),e.animation===!0&&(e.animation={}),e.animation.duration===void 0&&(e.animation.duration=1e3),e.animation.easingFunction===void 0&&(e.animation.easingFunction="easeInOutQuad"),this.animateView(e)}animateView(e){if(e===void 0)return;this.animationEasingFunction=e.animation.easingFunction,this.releaseNode(),e.locked===!0&&(this.lockedOnNodeId=e.lockedOnNode,this.lockedOnNodeOffset=e.offset),this.easingTime!=0&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=e.scale,this.body.view.scale=this.targetScale;const t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),i={x:t.x-e.position.x,y:t.y-e.position.y};if(this.targetTranslation={x:this.sourceTranslation.x+i.x*this.targetScale+e.offset.x,y:this.sourceTranslation.y+i.y*this.targetScale+e.offset.y},e.animation.duration===0)if(this.lockedOnNodeId!=null){var n;this.viewFunction=z(n=this._lockedRedraw).call(n,this),this.body.emitter.on("initRedraw",this.viewFunction)}else this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit("_requestRedraw");else{var s;this.animationSpeed=1/(60*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=z(s=this._transitionRedraw).call(s,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}_lockedRedraw(){const e={x:this.body.nodes[this.lockedOnNodeId].x,y:this.body.nodes[this.lockedOnNodeId].y},t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),i={x:t.x-e.x,y:t.y-e.y},n=this.body.view.translation,s={x:n.x+i.x*this.body.view.scale+this.lockedOnNodeOffset.x,y:n.y+i.y*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=s}releaseNode(){this.lockedOnNodeId!==void 0&&this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}_transitionRedraw(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.easingTime+=this.animationSpeed,this.easingTime=e===!0?1:this.easingTime;const t=GQ[this.animationEasingFunction](this.easingTime);if(this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*t,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*t,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*t},this.easingTime>=1){if(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,this.lockedOnNodeId!=null){var i;this.viewFunction=z(i=this._lockedRedraw).call(i,this),this.body.emitter.on("initRedraw",this.viewFunction)}this.body.emitter.emit("animationFinished")}}getScale(){return this.body.view.scale}getViewPosition(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}}function tB(r){var e=r&&r.preventDefault||!1,t=r&&r.container||window,i={},n={keydown:{},keyup:{}},s={},o;for(o=97;o<=122;o++)s[String.fromCharCode(o)]={code:65+(o-97),shift:!1};for(o=65;o<=90;o++)s[String.fromCharCode(o)]={code:o,shift:!0};for(o=0;o<=9;o++)s[""+o]={code:48+o,shift:!1};for(o=1;o<=12;o++)s["F"+o]={code:111+o,shift:!1};for(o=0;o<=9;o++)s["num"+o]={code:96+o,shift:!1};s["num*"]={code:106,shift:!1},s["num+"]={code:107,shift:!1},s["num-"]={code:109,shift:!1},s["num/"]={code:111,shift:!1},s["num."]={code:110,shift:!1},s.left={code:37,shift:!1},s.up={code:38,shift:!1},s.right={code:39,shift:!1},s.down={code:40,shift:!1},s.space={code:32,shift:!1},s.enter={code:13,shift:!1},s.shift={code:16,shift:void 0},s.esc={code:27,shift:!1},s.backspace={code:8,shift:!1},s.tab={code:9,shift:!1},s.ctrl={code:17,shift:!1},s.alt={code:18,shift:!1},s.delete={code:46,shift:!1},s.pageup={code:33,shift:!1},s.pagedown={code:34,shift:!1},s["="]={code:187,shift:!1},s["-"]={code:189,shift:!1},s["]"]={code:221,shift:!1},s["["]={code:219,shift:!1};var a=function(c){l(c,"keydown")},u=function(c){l(c,"keyup")},l=function(c,d){if(n[d][c.keyCode]!==void 0){for(var h=n[d][c.keyCode],f=0;f{this.activated=!0,this.configureKeyboardBindings()}),this.body.emitter.on("deactivate",()=>{this.activated=!1,this.configureKeyboardBindings()}),this.body.emitter.on("destroy",()=>{this.keycharm!==void 0&&this.keycharm.destroy()}),this.options={}}setOptions(e){e!==void 0&&(this.options=e,this.create())}create(){this.options.navigationButtons===!0?this.iconsCreated===!1&&this.loadNavigationElements():this.iconsCreated===!0&&this.cleanNavigation(),this.configureKeyboardBindings()}cleanNavigation(){if(this.navigationHammers.length!=0){for(let e=0;e{this._stopMovement()}),this.navigationHammers.push(s),this.iconsCreated=!0}bindToRedraw(e){if(this.boundFunctions[e]===void 0){var t;this.boundFunctions[e]=z(t=this[e]).call(t,this),this.body.emitter.on("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_startRendering")}}unbindFromRedraw(e){this.boundFunctions[e]!==void 0&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"),delete this.boundFunctions[e])}_fit(){new Date().valueOf()-this.touchTime>700&&(this.body.emitter.emit("fit",{duration:700}),this.touchTime=new Date().valueOf())}_stopMovement(){for(const e in this.boundFunctions)Object.prototype.hasOwnProperty.call(this.boundFunctions,e)&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"));this.boundFunctions={}}_moveUp(){this.body.view.translation.y+=this.options.keyboard.speed.y}_moveDown(){this.body.view.translation.y-=this.options.keyboard.speed.y}_moveLeft(){this.body.view.translation.x+=this.options.keyboard.speed.x}_moveRight(){this.body.view.translation.x-=this.options.keyboard.speed.x}_zoomIn(){const e=this.body.view.scale,t=this.body.view.scale*(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,n=t/e,s=(1-n)*this.canvas.canvasViewCenter.x+i.x*n,o=(1-n)*this.canvas.canvasViewCenter.y+i.y*n;this.body.view.scale=t,this.body.view.translation={x:s,y:o},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:null})}_zoomOut(){const e=this.body.view.scale,t=this.body.view.scale/(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,n=t/e,s=(1-n)*this.canvas.canvasViewCenter.x+i.x*n,o=(1-n)*this.canvas.canvasViewCenter.y+i.y*n;this.body.view.scale=t,this.body.view.translation={x:s,y:o},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:null})}configureKeyboardBindings(){if(this.keycharm!==void 0&&this.keycharm.destroy(),this.options.keyboard.enabled===!0&&(this.options.keyboard.bindToWindow===!0?this.keycharm=tB({container:window,preventDefault:!0}):this.keycharm=tB({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),this.activated===!0)){var e,t,i,n,s,o,a,u,l,c,d,h,f,p,v,b,m,g,w,y,S,O,I,_;z(e=this.keycharm).call(e,"up",()=>{this.bindToRedraw("_moveUp")},"keydown"),z(t=this.keycharm).call(t,"down",()=>{this.bindToRedraw("_moveDown")},"keydown"),z(i=this.keycharm).call(i,"left",()=>{this.bindToRedraw("_moveLeft")},"keydown"),z(n=this.keycharm).call(n,"right",()=>{this.bindToRedraw("_moveRight")},"keydown"),z(s=this.keycharm).call(s,"=",()=>{this.bindToRedraw("_zoomIn")},"keydown"),z(o=this.keycharm).call(o,"num+",()=>{this.bindToRedraw("_zoomIn")},"keydown"),z(a=this.keycharm).call(a,"num-",()=>{this.bindToRedraw("_zoomOut")},"keydown"),z(u=this.keycharm).call(u,"-",()=>{this.bindToRedraw("_zoomOut")},"keydown"),z(l=this.keycharm).call(l,"[",()=>{this.bindToRedraw("_zoomOut")},"keydown"),z(c=this.keycharm).call(c,"]",()=>{this.bindToRedraw("_zoomIn")},"keydown"),z(d=this.keycharm).call(d,"pageup",()=>{this.bindToRedraw("_zoomIn")},"keydown"),z(h=this.keycharm).call(h,"pagedown",()=>{this.bindToRedraw("_zoomOut")},"keydown"),z(f=this.keycharm).call(f,"up",()=>{this.unbindFromRedraw("_moveUp")},"keyup"),z(p=this.keycharm).call(p,"down",()=>{this.unbindFromRedraw("_moveDown")},"keyup"),z(v=this.keycharm).call(v,"left",()=>{this.unbindFromRedraw("_moveLeft")},"keyup"),z(b=this.keycharm).call(b,"right",()=>{this.unbindFromRedraw("_moveRight")},"keyup"),z(m=this.keycharm).call(m,"=",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),z(g=this.keycharm).call(g,"num+",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),z(w=this.keycharm).call(w,"num-",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),z(y=this.keycharm).call(y,"-",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),z(S=this.keycharm).call(S,"[",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),z(O=this.keycharm).call(O,"]",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),z(I=this.keycharm).call(I,"pageup",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),z(_=this.keycharm).call(_,"pagedown",()=>{this.unbindFromRedraw("_zoomOut")},"keyup")}}}class zre{constructor(e,t,i){var n,s,o,a,u,l,c,d,h,f,p,v,b;this.body=e,this.canvas=t,this.selectionHandler=i,this.navigationHandler=new Lre(e,t),this.body.eventListeners.onTap=z(n=this.onTap).call(n,this),this.body.eventListeners.onTouch=z(s=this.onTouch).call(s,this),this.body.eventListeners.onDoubleTap=z(o=this.onDoubleTap).call(o,this),this.body.eventListeners.onHold=z(a=this.onHold).call(a,this),this.body.eventListeners.onDragStart=z(u=this.onDragStart).call(u,this),this.body.eventListeners.onDrag=z(l=this.onDrag).call(l,this),this.body.eventListeners.onDragEnd=z(c=this.onDragEnd).call(c,this),this.body.eventListeners.onMouseWheel=z(d=this.onMouseWheel).call(d,this),this.body.eventListeners.onPinch=z(h=this.onPinch).call(h,this),this.body.eventListeners.onMouseMove=z(f=this.onMouseMove).call(f,this),this.body.eventListeners.onRelease=z(p=this.onRelease).call(p,this),this.body.eventListeners.onContext=z(v=this.onContext).call(v,this),this.touchTime=0,this.drag={},this.pinch={},this.popup=void 0,this.popupObj=void 0,this.popupTimer=void 0,this.body.functions.getPointer=z(b=this.getPointer).call(b,this),this.options={},this.defaultOptions={dragNodes:!0,dragView:!0,hover:!1,keyboard:{enabled:!1,speed:{x:10,y:10,zoom:.02},bindToWindow:!0,autoFocus:!0},navigationButtons:!1,tooltipDelay:300,zoomView:!0,zoomSpeed:1},ot(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){this.body.emitter.on("destroy",()=>{clearTimeout(this.popupTimer),delete this.body.functions.getPointer})}setOptions(e){e!==void 0&&(lu(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag","keyboard","multiselect","selectable","selectConnectedEdges"],this.options,e),ir(this.options,e,"keyboard"),e.tooltip&&(ot(this.options.tooltip,e.tooltip),e.tooltip.color&&(this.options.tooltip.color=W_(e.tooltip.color)))),this.navigationHandler.setOptions(this.options)}getPointer(e){return{x:e.x-WQ(this.canvas.frame.canvas),y:e.y-UQ(this.canvas.frame.canvas)}}onTouch(e){new Date().valueOf()-this.touchTime>50&&(this.drag.pointer=this.getPointer(e.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=new Date().valueOf())}onTap(e){const t=this.getPointer(e.center),i=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(t,i),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t)}onDoubleTap(e){const t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("doubleClick",e,t)}onHold(e){const t=this.getPointer(e.center),i=this.selectionHandler.options.multiselect;this.checkSelectionChanges(t,i),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t),this.selectionHandler.generateClickEvent("hold",e,t)}onRelease(e){if(new Date().valueOf()-this.touchTime>10){const t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("release",e,t),this.touchTime=new Date().valueOf()}}onContext(e){const t=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler.generateClickEvent("oncontext",e,t)}checkSelectionChanges(e){(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1)===!0?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e)}_determineDifference(e,t){const i=function(n,s){const o=[];for(let a=0;a{const a=o.node;o.xFixed===!1&&(a.x=this.canvas._XconvertDOMtoCanvas(this.canvas._XconvertCanvasToDOM(o.x)+n)),o.yFixed===!1&&(a.y=this.canvas._YconvertDOMtoCanvas(this.canvas._YconvertCanvasToDOM(o.y)+s))}),this.body.emitter.emit("startSimulation")}else{if(e.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent("dragging",e,t,void 0,!0),this.drag.pointer===void 0){this.onDragStart(e);return}this.body.selectionBox.position.end={x:this.canvas._XconvertDOMtoCanvas(t.x),y:this.canvas._YconvertDOMtoCanvas(t.y)},this.body.emitter.emit("_requestRedraw")}if(this.options.dragView===!0&&!e.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent("dragging",e,t,void 0,!0),this.drag.pointer===void 0){this.onDragStart(e);return}const n=t.x-this.drag.pointer.x,s=t.y-this.drag.pointer.y;this.body.view.translation={x:this.drag.translation.x+n,y:this.drag.translation.y+s},this.body.emitter.emit("_requestRedraw")}}}onDragEnd(e){if(this.drag.dragging=!1,this.body.selectionBox.show){var t;this.body.selectionBox.show=!1;const i=this.body.selectionBox.position,n={minX:Math.min(i.start.x,i.end.x),minY:Math.min(i.start.y,i.end.y),maxX:Math.max(i.start.x,i.end.x),maxY:Math.max(i.start.y,i.end.y)},s=Wt(t=this.body.nodeIndices).call(t,a=>{const u=this.body.nodes[a];return u.x>=n.minX&&u.x<=n.maxX&&u.y>=n.minY&&u.y<=n.maxY});Le(s).call(s,a=>this.selectionHandler.selectObject(this.body.nodes[a]));const o=this.getPointer(e.center);this.selectionHandler.commitAndEmit(o,e),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw")}else{const i=this.drag.selection;i&&i.length?(Le(i).call(i,function(n){n.node.options.fixed.x=n.xFixed,n.node.options.fixed.y=n.yFixed}),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center)),this.body.emitter.emit("startSimulation")):(this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw"))}}onPinch(e){const t=this.getPointer(e.center);this.drag.pinched=!0,this.pinch.scale===void 0&&(this.pinch.scale=1);const i=this.pinch.scale*e.scale;this.zoom(i,t)}zoom(e,t){if(this.options.zoomView===!0){const i=this.body.view.scale;e<1e-5&&(e=1e-5),e>10&&(e=10);let n;this.drag!==void 0&&this.drag.dragging===!0&&(n=this.canvas.DOMtoCanvas(this.drag.pointer));const s=this.body.view.translation,o=e/i,a=(1-o)*t.x+s.x*o,u=(1-o)*t.y+s.y*o;if(this.body.view.scale=e,this.body.view.translation={x:a,y:u},n!=null){const l=this.canvas.canvasToDOM(n);this.drag.pointer.x=l.x,this.drag.pointer.y=l.y}this.body.emitter.emit("_requestRedraw"),ithis._checkShowPopup(t),this.options.tooltipDelay))),this.options.hover===!0&&this.selectionHandler.hoverObject(e,t)}_checkShowPopup(e){const t=this.canvas._XconvertDOMtoCanvas(e.x),i=this.canvas._YconvertDOMtoCanvas(e.y),n={left:t,top:i,right:t,bottom:i},s=this.popupObj===void 0?void 0:this.popupObj.id;let o=!1,a="node";if(this.popupObj===void 0){const u=this.body.nodeIndices,l=this.body.nodes;let c;const d=[];for(let h=0;h0&&(this.popupObj=l[d[d.length-1]],o=!0)}if(this.popupObj===void 0&&o===!1){const u=this.body.edgeIndices,l=this.body.edges;let c;const d=[];for(let h=0;h0&&(this.popupObj=l[d[d.length-1]],a="edge")}this.popupObj!==void 0?this.popupObj.id!==s&&(this.popup===void 0&&(this.popup=new rZ(this.canvas.frame)),this.popup.popupTargetType=a,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(e.x+3,e.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit("showPopup",this.popupObj.id)):this.popup!==void 0&&(this.popup.hide(),this.body.emitter.emit("hidePopup"))}_checkHidePopup(e){const t=this.selectionHandler._pointerToPositionObject(e);let i=!1;if(this.popup.popupTargetType==="node"){if(this.body.nodes[this.popup.popupTargetId]!==void 0&&(i=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t),i===!0)){const n=this.selectionHandler.getNodeAt(e);i=n===void 0?!1:n.id===this.popup.popupTargetId}}else this.selectionHandler.getNodeAt(e)===void 0&&this.body.edges[this.popup.popupTargetId]!==void 0&&(i=this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));i===!1&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}var rB={},iB={},nB;function Hre(){if(nB)return iB;nB=1;var r=b0(),e=I5();return r("Set",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},e),iB}var sB;function Wre(){return sB||(sB=1,Hre()),rB}var oB={},$1,aB;function Nn(){if(aB)return $1;aB=1;var r=Ns(),e=TypeError;return $1=function(t){if(typeof t=="object"&&"size"in t&&"has"in t&&"add"in t&&"delete"in t&&"keys"in t)return t;throw new e(r(t)+" is not a set")},$1}var P1,uB;function Fn(){if(uB)return P1;uB=1;var r=tr(),e=T5(),t=r("Set"),i=t.prototype;return P1={Set:t,add:e("add",1),has:e("has",1),remove:e("delete",1),proto:i},P1}var R1,lB;function kn(){if(lB)return R1;lB=1;var r=Yt();return R1=function(e,t,i){for(var n=i?e:e.iterator,s=e.next,o,a;!(o=r(s,n)).done;)if(a=t(o.value),a!==void 0)return a},R1}var C1,cB;function Sa(){if(cB)return C1;cB=1;var r=kn();return C1=function(e,t,i){return i?r(e.keys(),t,!0):e.forEach(t)},C1}var x1,dB;function T0(){if(dB)return x1;dB=1;var r=Fn(),e=Sa(),t=r.Set,i=r.add;return x1=function(n){var s=new t;return e(n,function(o){i(s,o)}),s},x1}var q1,hB;function Oa(){return hB||(hB=1,q1=function(r){return r.size}),q1}var D1,fB;function Ure(){return fB||(fB=1,D1=function(r){return{iterator:r,next:r.next,done:!1}}),D1}var A1,pB;function Bn(){if(pB)return A1;pB=1;var r=li(),e=jr(),t=Yt(),i=js(),n=Ure(),s="Invalid size",o=RangeError,a=TypeError,u=Math.max,l=function(c,d){this.set=c,this.size=u(d,0),this.has=r(c.has),this.keys=r(c.keys)};return l.prototype={getIterator:function(){return n(e(t(this.keys,this.set)))},includes:function(c){return t(this.has,this.set,c)}},A1=function(c){e(c);var d=+c.size;if(d!==d)throw new a(s);var h=i(d);if(h<0)throw new o(s);return new l(c,h)},A1}var M1,vB;function Vre(){if(vB)return M1;vB=1;var r=Nn(),e=Fn(),t=T0(),i=Oa(),n=Bn(),s=Sa(),o=kn(),a=e.has,u=e.remove;return M1=function(c){var d=r(this),h=n(c),f=t(d);return i(d)<=h.size?s(d,function(p){h.includes(p)&&u(f,p)}):o(h.getIterator(),function(p){a(f,p)&&u(f,p)}),f},M1}var N1,gB;function jn(){return gB||(gB=1,N1=function(){return!1}),N1}var mB;function Kre(){if(mB)return oB;mB=1;var r=ce(),e=Vre(),t=$e(),i=jn(),n=!i("difference",function(o){return o.size===0}),s=n||t(function(){var o={size:1,has:function(){return!0},keys:function(){var u=0;return{next:function(){var l=u++>1;return a.has(1)&&a.clear(),{done:l,value:2}}}}},a=new Set([1,2,3,4]);return a.difference(o).size!==3});return r({target:"Set",proto:!0,real:!0,forced:s},{difference:e}),oB}var yB={},F1,bB;function Gre(){if(bB)return F1;bB=1;var r=Nn(),e=Fn(),t=Oa(),i=Bn(),n=Sa(),s=kn(),o=e.Set,a=e.add,u=e.has;return F1=function(c){var d=r(this),h=i(c),f=new o;return t(d)>h.size?s(h.getIterator(),function(p){u(d,p)&&a(f,p)}):n(d,function(p){h.includes(p)&&a(f,p)}),f},F1}var _B;function Yre(){if(_B)return yB;_B=1;var r=ce(),e=$e(),t=Gre(),i=jn(),n=!i("intersection",function(s){return s.size===2&&s.has(1)&&s.has(2)})||e(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!=="3,2"});return r({target:"Set",proto:!0,real:!0,forced:n},{intersection:t}),yB}var wB={},k1,EB;function Xre(){if(EB)return k1;EB=1;var r=Nn(),e=Fn().has,t=Oa(),i=Bn(),n=Sa(),s=kn(),o=m0();return k1=function(u){var l=r(this),c=i(u);if(t(l)<=c.size)return n(l,function(h){if(c.includes(h))return!1},!0)!==!1;var d=c.getIterator();return s(d,function(h){if(e(l,h))return o(d,"normal",!1)})!==!1},k1}var SB;function Jre(){if(SB)return wB;SB=1;var r=ce(),e=Xre(),t=jn(),i=!t("isDisjointFrom",function(n){return!n});return r({target:"Set",proto:!0,real:!0,forced:i},{isDisjointFrom:e}),wB}var OB={},B1,IB;function Qre(){if(IB)return B1;IB=1;var r=Nn(),e=Oa(),t=Sa(),i=Bn();return B1=function(s){var o=r(this),a=i(s);return e(o)>a.size?!1:t(o,function(u){if(!a.includes(u))return!1},!0)!==!1},B1}var TB;function Zre(){if(TB)return OB;TB=1;var r=ce(),e=Qre(),t=jn(),i=!t("isSubsetOf",function(n){return n});return r({target:"Set",proto:!0,real:!0,forced:i},{isSubsetOf:e}),OB}var $B={},j1,PB;function eie(){if(PB)return j1;PB=1;var r=Nn(),e=Fn().has,t=Oa(),i=Bn(),n=kn(),s=m0();return j1=function(a){var u=r(this),l=i(a);if(t(u)0&&arguments[0]!==void 0?arguments[0]:()=>{};wo(this,Gi,new YB),wo(this,Yi,new YB),wo(this,J1,void 0),X_(J1,this,e)}get sizeNodes(){return We(Gi,this).size}get sizeEdges(){return We(Yi,this).size}getNodes(){return We(Gi,this).getSelection()}getEdges(){return We(Yi,this).getSelection()}addNodes(){We(Gi,this).add(...arguments)}addEdges(){We(Yi,this).add(...arguments)}deleteNodes(e){We(Gi,this).delete(e)}deleteEdges(e){We(Yi,this).delete(e)}clear(){We(Gi,this).clear(),We(Yi,this).clear()}commit(){const e={nodes:We(Gi,this).commit(),edges:We(Yi,this).commit()};for(var t=arguments.length,i=new Array(t),n=0;n{this.updateSelection()})}setOptions(e){e!==void 0&&Gs(["multiselect","hoverConnectedEdges","selectable","selectConnectedEdges"],this.options,e)}selectOnPoint(e){let t=!1;if(this.options.selectable===!0){const i=this.getNodeAt(e)||this.getEdgeAt(e);this.unselectAll(),i!==void 0&&(t=this.selectObject(i)),this.body.emitter.emit("_requestRedraw")}return t}selectAdditionalOnPoint(e){let t=!1;if(this.options.selectable===!0){const i=this.getNodeAt(e)||this.getEdgeAt(e);i!==void 0&&(t=!0,i.isSelected()===!0?this.deselectObject(i):this.selectObject(i),this.body.emitter.emit("_requestRedraw"))}return t}_initBaseEvent(e,t){const i={};return i.pointer={DOM:{x:t.x,y:t.y},canvas:this.canvas.DOMtoCanvas(t)},i.event=e,i}generateClickEvent(e,t,i,n){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;const o=this._initBaseEvent(t,i);if(s===!0)o.nodes=[],o.edges=[];else{const a=this.getSelection();o.nodes=a.nodes,o.edges=a.edges}n!==void 0&&(o.previousSelection=n),e=="click"&&(o.items=this.getClickedItems(i)),t.controlEdge!==void 0&&(o.controlEdge=t.controlEdge),this.body.emitter.emit(e,o)}selectObject(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.selectConnectedEdges;return e!==void 0?(e instanceof Ke?(t===!0&&this._selectionAccumulator.addEdges(...e.edges),this._selectionAccumulator.addNodes(e)):this._selectionAccumulator.addEdges(e),!0):!1}deselectObject(e){e.isSelected()===!0&&(e.selected=!1,this._removeFromSelection(e))}_getAllNodesOverlappingWith(e){const t=[],i=this.body.nodes;for(let n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;const i=this._pointerToPositionObject(e),n=this._getAllNodesOverlappingWith(i);if(n.length>0)return t===!0?this.body.nodes[n[n.length-1]]:n[n.length-1]}_getEdgesOverlappingWith(e,t){const i=this.body.edges;for(let n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;const i=this.canvas.DOMtoCanvas(e);let n=10,s=null;const o=this.body.edges;for(let a=0;a0&&(this.generateClickEvent("deselectEdge",t,e,s),i=!0),n.nodes.deleted.length>0&&(this.generateClickEvent("deselectNode",t,e,s),i=!0),n.nodes.added.length>0&&(this.generateClickEvent("selectNode",t,e),i=!0),n.edges.added.length>0&&(this.generateClickEvent("selectEdge",t,e),i=!0),i===!0&&this.generateClickEvent("select",t,e)}getSelection(){return{nodes:this.getSelectedNodeIds(),edges:this.getSelectedEdgeIds()}}getSelectedNodes(){return this._selectionAccumulator.getNodes()}getSelectedEdges(){return this._selectionAccumulator.getEdges()}getSelectedNodeIds(){var e;return ms(e=this._selectionAccumulator.getNodes()).call(e,t=>t.id)}getSelectedEdgeIds(){var e;return ms(e=this._selectionAccumulator.getEdges()).call(e,t=>t.id)}setSelection(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||!e.nodes&&!e.edges)throw new TypeError("Selection must be an object with nodes and/or edges properties");if((t.unselectAll||t.unselectAll===void 0)&&this.unselectAll(),e.nodes)for(const i of e.nodes){const n=this.body.nodes[i];if(!n)throw new RangeError('Node with id "'+i+'" not found');this.selectObject(n,t.highlightEdges)}if(e.edges)for(const i of e.edges){const n=this.body.edges[i];if(!n)throw new RangeError('Edge with id "'+i+'" not found');this.selectObject(n)}this.body.emitter.emit("_requestRedraw"),this._selectionAccumulator.commit()}selectNodes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({nodes:e},{highlightEdges:t})}selectEdges(e){if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({edges:e})}updateSelection(){for(const e in this._selectionAccumulator.getNodes())Object.prototype.hasOwnProperty.call(this.body.nodes,e.id)||this._selectionAccumulator.deleteNodes(e);for(const e in this._selectionAccumulator.getEdges())Object.prototype.hasOwnProperty.call(this.body.edges,e.id)||this._selectionAccumulator.deleteEdges(e)}getClickedItems(e){const t=this.canvas.DOMtoCanvas(e),i=[],n=this.body.nodeIndices,s=this.body.nodes;for(let u=n.length-1;u>=0;u--){const c=s[n[u]].getItemsOnPoint(t);i.push.apply(i,c)}const o=this.body.edgeIndices,a=this.body.edges;for(let u=o.length-1;u>=0;u--){const c=a[o[u]].getItemsOnPoint(t);i.push.apply(i,c)}return i}}var XB={},Q1,JB;function _ie(){if(JB)return Q1;JB=1;var r=Ls(),e=Math.floor,t=function(i,n){var s=i.length;if(s<8)for(var o=1,a,u;o0;)i[u]=i[--u];u!==o++&&(i[u]=a)}else for(var l=e(s/2),c=t(r(i,0,l),n),d=t(r(i,l),n),h=c.length,f=d.length,p=0,v=0;p3)){if(d)return!0;if(f)return f<603;var I="",_,E,T,R;for(_=65;_<76;_++){switch(E=String.fromCharCode(_),_){case 66:case 69:case 70:case 72:T=3;break;case 68:case 71:T=4;break;default:T=2}for(R=0;R<47;R++)p.push({k:E+R,v:T})}for(p.sort(function(x,C){return C.v-x.v}),R=0;Ro(E)?1:-1}};return r({target:"Array",proto:!0,forced:S},{sort:function(_){_!==void 0&&t(_);var E=i(this);if(y)return _===void 0?v(E):v(E,_);var T=[],R=n(E),x,C;for(C=0;C=0:p>v;v+=b)v in f&&(d=l(d,f[v],v,h));return d}};return o_={left:o(!1),right:o(!0)},o_}var a_,uj;function xie(){if(uj)return a_;uj=1;var r=k3();return a_=r==="NODE",a_}var lj;function qie(){if(lj)return oj;lj=1;var r=ce(),e=Cie().left,t=Vs(),i=la(),n=xie(),s=!n&&i>79&&i<83,o=s||!t("reduce");return r({target:"Array",proto:!0,forced:o},{reduce:function(u){var l=arguments.length;return e(this,u,l,l>1?arguments[1]:void 0)}}),oj}var u_,cj;function Die(){if(cj)return u_;cj=1,qie();var r=Tt();return u_=r("Array","reduce"),u_}var l_,dj;function Aie(){if(dj)return l_;dj=1;var r=dt(),e=Die(),t=Array.prototype;return l_=function(i){var n=i.reduce;return i===t||r(t,i)&&n===t.reduce?e:n},l_}var c_,hj;function Mie(){if(hj)return c_;hj=1;var r=Aie();return c_=r,c_}var d_,fj;function Nie(){return fj||(fj=1,d_=Mie()),d_}var Fie=Nie(),B5=pe(Fie);class j5{abstract(){throw new Error("Can't instantiate abstract class!")}fake_use(){}curveType(){return this.abstract()}getPosition(e){return this.fake_use(e),this.abstract()}setPosition(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;this.fake_use(e,t,i),this.abstract()}getTreeSize(e){return this.fake_use(e),this.abstract()}sort(e){this.fake_use(e),this.abstract()}fix(e,t){this.fake_use(e,t),this.abstract()}shift(e,t){this.fake_use(e,t),this.abstract()}}class kie extends j5{constructor(e){super(),this.layout=e}curveType(){return"horizontal"}getPosition(e){return e.x}setPosition(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;i!==void 0&&this.layout.hierarchical.addToOrdering(e,i),e.x=t}getTreeSize(e){const t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_x,max:t.max_x}}sort(e){cs(e).call(e,function(t,i){return t.x-i.x})}fix(e,t){e.y=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.y=!0}shift(e,t){this.layout.body.nodes[e].x+=t}}class Bie extends j5{constructor(e){super(),this.layout=e}curveType(){return"vertical"}getPosition(e){return e.y}setPosition(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;i!==void 0&&this.layout.hierarchical.addToOrdering(e,i),e.y=t}getTreeSize(e){const t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_y,max:t.max_y}}sort(e){cs(e).call(e,function(t,i){return t.y-i.y})}fix(e,t){e.x=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.x=!0}shift(e,t){this.layout.body.nodes[e].y+=t}}var pj={},vj;function jie(){if(vj)return pj;vj=1;var r=ce(),e=Hi().every,t=Vs(),i=t("every");return r({target:"Array",proto:!0,forced:!i},{every:function(s){return e(this,s,arguments.length>1?arguments[1]:void 0)}}),pj}var h_,gj;function Lie(){if(gj)return h_;gj=1,jie();var r=Tt();return h_=r("Array","every"),h_}var f_,mj;function zie(){if(mj)return f_;mj=1;var r=dt(),e=Lie(),t=Array.prototype;return f_=function(i){var n=i.every;return i===t||r(t,i)&&n===t.every?e:n},f_}var p_,yj;function Hie(){if(yj)return p_;yj=1;var r=zie();return p_=r,p_}var v_,bj;function Wie(){return bj||(bj=1,v_=Hie()),v_}var Uie=Wie(),L5=pe(Uie);function Vie(r,e){const t=new _i;return Le(r).call(r,i=>{var n;Le(n=i.edges).call(n,s=>{s.connected&&t.add(s)})}),Le(t).call(t,i=>{const n=i.from.id,s=i.to.id;e[n]==null&&(e[n]=0),(e[s]==null||e[n]>=e[s])&&(e[s]=e[n]+1)}),e}function Kie(r){return z5(e=>{var t,i;return L5(t=Wt(i=e.edges).call(i,n=>r.has(n.toId))).call(t,n=>n.to===e)},(e,t)=>t>e,"from",r)}function Gie(r){return z5(e=>{var t,i;return L5(t=Wt(i=e.edges).call(i,n=>r.has(n.toId))).call(t,n=>n.from===e)},(e,t)=>td+1+h.edges.length,0),a=t+"Id",u=t==="to"?1:-1;for(const[d,h]of i){if(!i.has(d)||!r(h))continue;s[d]=0;const f=[h];let p=0,v;for(;v=f.pop();){var l,c;if(!i.has(d))continue;const b=s[v.id]+u;if(Le(l=Wt(c=v.edges).call(c,m=>m.connected&&m.to!==m.from&&m[t]!==v&&i.has(m.toId)&&i.has(m.fromId))).call(l,m=>{const g=m[a],w=s[g];(w==null||e(b,w))&&(s[g]=b,f.push(m[t]))}),p>o)return Vie(i,s);++p}}return s}class Yie{constructor(){this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}addRelation(e,t){this.childrenReference[e]===void 0&&(this.childrenReference[e]=[]),this.childrenReference[e].push(t),this.parentReference[t]===void 0&&(this.parentReference[t]=[]),this.parentReference[t].push(e)}checkIfTree(){for(const e in this.parentReference)if(this.parentReference[e].length>1){this.isTree=!1;return}this.isTree=!0}numTrees(){return this.treeIndex+1}setTreeIndex(e,t){t!==void 0&&this.trees[e.id]===void 0&&(this.trees[e.id]=t,this.treeIndex=Math.max(t,this.treeIndex))}ensureLevel(e){this.levels[e]===void 0&&(this.levels[e]=0)}getMaxLevel(e){const t={},i=n=>{if(t[n]!==void 0)return t[n];let s=this.levels[n];if(this.childrenReference[n]){const o=this.childrenReference[n];if(o.length>0)for(let a=0;as-o);for(const s of n)t.set(s,i++);for(const s in this.levels)Object.prototype.hasOwnProperty.call(this.levels,s)&&(this.levels[s]=t.get(this.levels[s]))}getTreeSize(e,t){let i=1e9,n=-1e9,s=1e9,o=-1e9;for(const a in this.trees)if(Object.prototype.hasOwnProperty.call(this.trees,a)&&this.trees[a]===t){const u=e[a];i=Math.min(u.x,i),n=Math.max(u.x,n),s=Math.min(u.y,s),o=Math.max(u.y,o)}return{min_x:i,max_x:n,min_y:s,max_y:o}}hasSameParent(e,t){const i=this.parentReference[e.id],n=this.parentReference[t.id];if(i===void 0||n===void 0)return!1;for(let s=0;s{this.setupHierarchicalLayout()}),this.body.emitter.on("_dataLoaded",()=>{this.layoutNetwork()}),this.body.emitter.on("_resetHierarchicalLayout",()=>{this.setupHierarchicalLayout()}),this.body.emitter.on("_adjustEdgesForHierarchicalLayout",()=>{if(this.options.hierarchical.enabled!==!0)return;const e=this.direction.curveType();this.body.emitter.emit("_forceDisableDynamicCurves",e,!1)})}setOptions(e,t){if(e!==void 0){const i=this.options.hierarchical,n=i.enabled;if(Gs(["randomSeed","improvedLayout","clusterThreshold"],this.options,e),ir(this.options,e,"hierarchical"),e.randomSeed!==void 0&&this._resetRNG(e.randomSeed),i.enabled===!0)return n===!0&&this.body.emitter.emit("refresh",!0),i.direction==="RL"||i.direction==="DU"?i.levelSeparation>0&&(i.levelSeparation*=-1):i.levelSeparation<0&&(i.levelSeparation*=-1),this.setDirectionStrategy(),this.body.emitter.emit("_resetHierarchicalLayout"),this.adaptAllOptionsForHierarchicalLayout(t);if(n===!0)return this.body.emitter.emit("refresh"),Ue(t,this.optionsBackup)}return t}_resetRNG(e){this.initialRandomSeed=e,this._rng=il(this.initialRandomSeed)}adaptAllOptionsForHierarchicalLayout(e){if(this.options.hierarchical.enabled===!0){const t=this.optionsBackup.physics;e.physics===void 0||e.physics===!0?(e.physics={enabled:t.enabled===void 0?!0:t.enabled,solver:"hierarchicalRepulsion"},t.enabled=t.enabled===void 0?!0:t.enabled,t.solver=t.solver||"barnesHut"):typeof e.physics=="object"?(t.enabled=e.physics.enabled===void 0?!0:e.physics.enabled,t.solver=e.physics.solver||"barnesHut",e.physics.solver="hierarchicalRepulsion"):e.physics!==!1&&(t.solver="barnesHut",e.physics={solver:"hierarchicalRepulsion"});let i=this.direction.curveType();if(e.edges===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges={smooth:!1};else if(e.edges.smooth===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges.smooth=!1;else if(typeof e.edges.smooth=="boolean")this.optionsBackup.edges={smooth:e.edges.smooth},e.edges.smooth={enabled:e.edges.smooth,type:i};else{const n=e.edges.smooth;n.type!==void 0&&n.type!=="dynamic"&&(i=n.type),this.optionsBackup.edges={smooth:{enabled:n.enabled===void 0?!0:n.enabled,type:n.type===void 0?"dynamic":n.type,roundness:n.roundness===void 0?.5:n.roundness,forceDirection:n.forceDirection===void 0?!1:n.forceDirection}},e.edges.smooth={enabled:n.enabled===void 0?!0:n.enabled,type:i,roundness:n.roundness===void 0?.5:n.roundness,forceDirection:n.forceDirection===void 0?!1:n.forceDirection}}this.body.emitter.emit("_forceDisableDynamicCurves",i)}return e}positionInitially(e){if(this.options.hierarchical.enabled!==!0){this._resetRNG(this.initialRandomSeed);const t=e.length+50;for(let i=0;is){const u=e.length;for(;e.length>s&&n<=10;){n+=1;const l=e.length;n%3===0?this.body.modules.clustering.clusterBridges(o):this.body.modules.clustering.clusterOutliers(o);const c=e.length;if(l==c&&n%3!==0){this._declusterAll(),this.body.emitter.emit("_layoutFailed"),console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.");return}}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*u)})}n>10&&console.info("The clustering didn't succeed within the amount of interations allowed, progressing with partial result."),this.body.modules.kamadaKawai.solve(e,this.body.edgeIndices,!0),this._shiftToCenter();const a=70;for(let u=0;u0){let e,t,i=!1,n=!1;this.lastNodeOnLevel={},this.hierarchical=new Yie;for(t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&(e=this.body.nodes[t],e.options.level!==void 0?(i=!0,this.hierarchical.levels[t]=e.options.level):n=!0);if(n===!0&&i===!0)throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");{if(n===!0){const o=this.options.hierarchical.sortMethod;o==="hubsize"?this._determineLevelsByHubsize():o==="directed"?this._determineLevelsDirected():o==="custom"&&this._determineLevelsCustomCallback()}for(const o in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,o)&&this.hierarchical.ensureLevel(o);const s=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(s),this._condenseHierarchy(),this._shiftToCenter()}}}_condenseHierarchy(){var e=this;let t=!1;const i={},n=()=>{const m=o();let g=0;for(let w=0;w{const w=this.hierarchical.trees;for(const y in w)Object.prototype.hasOwnProperty.call(w,y)&&w[y]===m&&this.direction.shift(y,g)},o=()=>{const m=[];for(let g=0;g{if(!g[m.id]&&(g[m.id]=!0,this.hierarchical.childrenReference[m.id])){const w=this.hierarchical.childrenReference[m.id];if(w.length>0)for(let y=0;y1&&arguments[1]!==void 0?arguments[1]:1e9,w=1e9,y=1e9,S=1e9,O=-1e9;for(const I in m)if(Object.prototype.hasOwnProperty.call(m,I)){const _=e.body.nodes[I],E=e.hierarchical.levels[_.id],T=e.direction.getPosition(_),[R,x]=e._getSpaceAroundNode(_,m);w=Math.min(R,w),y=Math.min(x,y),E<=g&&(S=Math.min(T,S),O=Math.max(T,O))}return[S,O,w,y]},l=(m,g)=>{const w=this.hierarchical.getMaxLevel(m.id),y=this.hierarchical.getMaxLevel(g.id);return Math.min(w,y)},c=(m,g,w)=>{const y=this.hierarchical;for(let S=0;S1)for(let _=0;_2&&arguments[2]!==void 0?arguments[2]:!1;const y=e.direction.getPosition(m),S=e.direction.getPosition(g),O=Math.abs(S-y),I=e.options.hierarchical.nodeSpacing;if(O>I){const _={},E={};a(m,_),a(g,E);const T=l(m,g),R=u(_,T),x=u(E,T),C=R[1],D=x[0],j=x[2];if(Math.abs(C-D)>I){let H=C-D+I;H<-j+I&&(H=-j+I),H<0&&(e._shiftBlock(g.id,H),t=!0,w===!0&&e._centerParent(g))}}},h=(m,g)=>{const w=g.id,y=g.edges,S=this.hierarchical.levels[g.id],O=this.options.hierarchical.levelSeparation*this.options.hierarchical.levelSeparation,I={},_=[];for(let j=0;j{let H=0;for(let Z=0;Z{let H=0;for(let Z=0;Z{let H=this.direction.getPosition(g);const Z={};for(let fe=0;fe{const ee=this.direction.getPosition(g);if(i[g.id]===void 0){const ge={};a(g,ge),i[g.id]=ge}const H=u(i[g.id]),Z=H[2],fe=H[3],_e=j-ee;let te=0;_e>0?te=Math.min(_e,fe-this.options.hierarchical.nodeSpacing):_e<0&&(te=-Math.min(-_e,Z-this.options.hierarchical.nodeSpacing)),te!=0&&(this._shiftBlock(g.id,te),t=!0)},C=j=>{const ee=this.direction.getPosition(g),[H,Z]=this._getSpaceAroundNode(g),fe=j-ee;let _e=ee;fe>0?_e=Math.min(ee+(Z-this.options.hierarchical.nodeSpacing),j):fe<0&&(_e=Math.max(ee-(H-this.options.hierarchical.nodeSpacing),j)),_e!==ee&&(this.direction.setPosition(g,_e),t=!0)};let D=R(m,_);x(D),D=R(m,y),C(D)},f=m=>{let g=this.hierarchical.getLevels();g=on(g).call(g);for(let w=0;w{let g=this.hierarchical.getLevels();g=on(g).call(g);for(let w=0;w{for(const m in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,m)&&this._centerParent(this.body.nodes[m])},b=()=>{let m=this.hierarchical.getLevels();m=on(m).call(m);for(let g=0;g0&&Math.abs(d)0&&(l=this.direction.getPosition(n[o-1])+u),this.direction.setPosition(a,l,i),this._validatePositionAndContinue(a,i,l),s++}}}}_placeBranchNodes(e,t){var i;const n=this.hierarchical.childrenReference[e];if(n===void 0)return;const s=[];for(let a=0;at&&this.positionedNodes[u.id]===void 0){const c=this.options.hierarchical.nodeSpacing;let d;a===0?d=this.direction.getPosition(this.body.nodes[e]):d=this.direction.getPosition(s[a-1])+c,this.direction.setPosition(u,d,l),this._validatePositionAndContinue(u,l,d)}else return}const o=this._getCenterPosition(s);this.direction.setPosition(this.body.nodes[e],o,t)}_validatePositionAndContinue(e,t,i){if(this.hierarchical.isTree){if(this.lastNodeOnLevel[t]!==void 0){const n=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[t]]);if(i-n{var n;Fe(n=this.body.edgeIndices).call(n,i.id)!==-1&&t.push(i)}),t}_getHubSizes(){const e={},t=this.body.nodeIndices;Oe(t,n=>{const s=this.body.nodes[n],o=this._getActiveEdges(s).length;e[o]=!0});const i=[];return Oe(e,n=>{i.push(Number(n))}),cs(i).call(i,function(n,s){return s-n}),i}_determineLevelsByHubsize(){const e=(i,n)=>{this.hierarchical.levelDownstream(i,n)},t=this._getHubSizes();for(let i=0;i{const o=this.body.nodes[s];n===this._getActiveEdges(o).length&&this._crawlNetwork(e,s)})}}_determineLevelsCustomCallback(){const t=function(n,s,o){},i=(n,s,o)=>{let a=this.hierarchical.levels[n.id];a===void 0&&(a=this.hierarchical.levels[n.id]=1e5);const u=t(kt.cloneOptions(n,"node"),kt.cloneOptions(s,"node"),kt.cloneOptions(o,"edge"));this.hierarchical.levels[s.id]=a+u};this._crawlNetwork(i),this.hierarchical.setMinLevelToZero()}_determineLevelsDirected(){var e;const t=B5(e=this.body.nodeIndices).call(e,(i,n)=>(i.set(n,this.body.nodes[n]),i),new E0);this.options.hierarchical.shakeTowards==="roots"?this.hierarchical.levels=Gie(t):this.hierarchical.levels=Kie(t),this.hierarchical.setMinLevelToZero()}_generateMap(){const e=(t,i)=>{this.hierarchical.levels[i.id]>this.hierarchical.levels[t.id]&&this.hierarchical.addRelation(t.id,i.id)};this._crawlNetwork(e),this.hierarchical.checkIfTree()}_crawlNetwork(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){},t=arguments.length>1?arguments[1]:void 0;const i={},n=(s,o)=>{if(i[s.id]===void 0){this.hierarchical.setTreeIndex(s,o),i[s.id]=!0;let a;const u=this._getActiveEdges(s);for(let l=0;l{if(i[s])return;i[s]=!0,this.direction.shift(s,t);const o=this.hierarchical.childrenReference[s];if(o!==void 0)for(let a=0;a{const u=this.hierarchical.parentReference[a];if(u!==void 0)for(let l=0;l{const u=this.hierarchical.parentReference[a];if(u!==void 0)for(let l=0;l{this._clean()}),this.body.emitter.on("_dataChanged",z(s=this._restore).call(s,this)),this.body.emitter.on("_resetData",z(o=this._restore).call(o,this))}_restore(){this.inMode!==!1&&(this.options.initiallyActive===!0?this.enableEditMode():this.disableEditMode())}setOptions(e,t,i){t!==void 0&&(t.locale!==void 0?this.options.locale=t.locale:this.options.locale=i.locale,t.locales!==void 0?this.options.locales=t.locales:this.options.locales=i.locales),e!==void 0&&(typeof e=="boolean"?this.options.enabled=e:(this.options.enabled=!0,Ue(this.options,e)),this.options.initiallyActive===!0&&(this.editMode=!0),this._setup())}toggleEditMode(){this.editMode===!0?this.disableEditMode():this.enableEditMode()}enableEditMode(){this.editMode=!0,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display="block",this.closeDiv.style.display="block",this.editModeDiv.style.display="none",this.showManipulatorToolbar())}disableEditMode(){this.editMode=!1,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display="none",this.closeDiv.style.display="none",this.editModeDiv.style.display="block",this._createEditButton())}showManipulatorToolbar(){if(this._clean(),this.manipulationDOM={},this.guiEnabled===!0){var e,t;this.editMode=!0,this.manipulationDiv.style.display="block",this.closeDiv.style.display="block";const i=this.selectionHandler.getSelectedNodeCount(),n=this.selectionHandler.getSelectedEdgeCount(),s=i+n,o=this.options.locales[this.options.locale];let a=!1;this.options.addNode!==!1&&(this._createAddNodeButton(o),a=!0),this.options.addEdge!==!1&&(a===!0?this._createSeperator(1):a=!0,this._createAddEdgeButton(o)),i===1&&typeof this.options.editNode=="function"?(a===!0?this._createSeperator(2):a=!0,this._createEditNodeButton(o)):n===1&&i===0&&this.options.editEdge!==!1&&(a===!0?this._createSeperator(3):a=!0,this._createEditEdgeButton(o)),s!==0&&(i>0&&this.options.deleteNode!==!1?(a===!0&&this._createSeperator(4),this._createDeleteButton(o)):i===0&&this.options.deleteEdge!==!1&&(a===!0&&this._createSeperator(4),this._createDeleteButton(o))),this._bindElementEvents(this.closeDiv,z(e=this.toggleEditMode).call(e,this)),this._temporaryBindEvent("select",z(t=this.showManipulatorToolbar).call(t,this))}this.body.emitter.emit("_redraw")}addNodeMode(){var e;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addNode",this.guiEnabled===!0){var t;const i=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(i),this._createSeperator(),this._createDescription(i.addDescription||this.options.locales.en.addDescription),this._bindElementEvents(this.closeDiv,z(t=this.toggleEditMode).call(t,this))}this._temporaryBindEvent("click",z(e=this._performAddNode).call(e,this))}editNode(){this.editMode!==!0&&this.enableEditMode(),this._clean();const e=this.selectionHandler.getSelectedNodes()[0];if(e!==void 0)if(this.inMode="editNode",typeof this.options.editNode=="function")if(e.isCluster!==!0){const t=Ue({},e.options,!1);if(t.x=e.x,t.y=e.y,this.options.editNode.length===2)this.options.editNode(t,i=>{i!=null&&this.inMode==="editNode"&&this.body.data.nodes.getDataSet().update(i),this.showManipulatorToolbar()});else throw new Error("The function for edit does not support two arguments (data, callback)")}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError);else throw new Error("No function has been configured to handle the editing of nodes.");else this.showManipulatorToolbar()}addEdgeMode(){var e,t,i,n,s;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addEdge",this.guiEnabled===!0){var o;const a=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(a),this._createSeperator(),this._createDescription(a.edgeDescription||this.options.locales.en.edgeDescription),this._bindElementEvents(this.closeDiv,z(o=this.toggleEditMode).call(o,this))}this._temporaryBindUI("onTouch",z(e=this._handleConnect).call(e,this)),this._temporaryBindUI("onDragEnd",z(t=this._finishConnect).call(t,this)),this._temporaryBindUI("onDrag",z(i=this._dragControlNode).call(i,this)),this._temporaryBindUI("onRelease",z(n=this._finishConnect).call(n,this)),this._temporaryBindUI("onDragStart",z(s=this._dragStartEdge).call(s,this)),this._temporaryBindUI("onHold",()=>{})}editEdgeMode(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="editEdge",typeof this.options.editEdge=="object"&&typeof this.options.editEdge.editWithoutDrag=="function"&&(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0)){const o=this.body.edges[this.edgeBeingEditedId];this._performEditEdge(o.from.id,o.to.id);return}if(this.guiEnabled===!0){var e;const o=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(o),this._createSeperator(),this._createDescription(o.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindElementEvents(this.closeDiv,z(e=this.toggleEditMode).call(e,this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0){var t,i,n,s;const o=this.body.edges[this.edgeBeingEditedId],a=this._getNewTargetNode(o.from.x,o.from.y),u=this._getNewTargetNode(o.to.x,o.to.y);this.temporaryIds.nodes.push(a.id),this.temporaryIds.nodes.push(u.id),this.body.nodes[a.id]=a,this.body.nodeIndices.push(a.id),this.body.nodes[u.id]=u,this.body.nodeIndices.push(u.id),this._temporaryBindUI("onTouch",z(t=this._controlNodeTouch).call(t,this)),this._temporaryBindUI("onTap",()=>{}),this._temporaryBindUI("onHold",()=>{}),this._temporaryBindUI("onDragStart",z(i=this._controlNodeDragStart).call(i,this)),this._temporaryBindUI("onDrag",z(n=this._controlNodeDrag).call(n,this)),this._temporaryBindUI("onDragEnd",z(s=this._controlNodeDragEnd).call(s,this)),this._temporaryBindUI("onMouseMove",()=>{}),this._temporaryBindEvent("beforeDrawing",l=>{const c=o.edgeType.findBorderPositions(l);a.selected===!1&&(a.x=c.from.x,a.y=c.from.y),u.selected===!1&&(u.x=c.to.x,u.y=c.to.y)}),this.body.emitter.emit("_redraw")}else this.showManipulatorToolbar()}deleteSelected(){this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="delete";const e=this.selectionHandler.getSelectedNodeIds(),t=this.selectionHandler.getSelectedEdgeIds();let i;if(e.length>0){for(let n=0;n0&&typeof this.options.deleteEdge=="function"&&(i=this.options.deleteEdge);if(typeof i=="function"){const n={nodes:e,edges:t};if(i.length===2)i(n,s=>{s!=null&&this.inMode==="delete"?(this.body.data.edges.getDataSet().remove(s.edges),this.body.data.nodes.getDataSet().remove(s.nodes),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()):(this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar())});else throw new Error("The function for delete does not support two arguments (data, callback)")}else this.body.data.edges.getDataSet().remove(t),this.body.data.nodes.getDataSet().remove(e),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}_setup(){this.options.enabled===!0?(this.guiEnabled=!0,this._createWrappers(),this.editMode===!1?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}_createWrappers(){if(this.manipulationDiv===void 0&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="vis-manipulation",this.editMode===!0?this.manipulationDiv.style.display="block":this.manipulationDiv.style.display="none",this.canvas.frame.appendChild(this.manipulationDiv)),this.editModeDiv===void 0&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="vis-edit-mode",this.editMode===!0?this.editModeDiv.style.display="none":this.editModeDiv.style.display="block",this.canvas.frame.appendChild(this.editModeDiv)),this.closeDiv===void 0){var e,t;this.closeDiv=document.createElement("button"),this.closeDiv.className="vis-close",this.closeDiv.setAttribute("aria-label",(e=(t=this.options.locales[this.options.locale])===null||t===void 0?void 0:t.close)!==null&&e!==void 0?e:this.options.locales.en.close),this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv)}}_getNewTargetNode(e,t){const i=Ue({},this.options.controlNodeStyle);i.id="targetNode"+_o(),i.hidden=!1,i.physics=!1,i.x=e,i.y=t;const n=this.body.functions.createNode(i);return n.shape.boundingBox={left:e,right:e,top:t,bottom:t},n}_createEditButton(){var e;this._clean(),this.manipulationDOM={},mi(this.editModeDiv);const t=this.options.locales[this.options.locale],i=this._createButton("editMode","vis-edit vis-edit-mode",t.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(i),this._bindElementEvents(i,z(e=this.toggleEditMode).call(e,this))}_clean(){this.inMode=!1,this.guiEnabled===!0&&(mi(this.editModeDiv),mi(this.manipulationDiv),this._cleanupDOMEventListeners()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}_cleanupDOMEventListeners(){for(const t of Qr(e=this._domEventListenerCleanupQueue).call(e,0)){var e;t()}}_removeManipulationDOM(){this._clean(),mi(this.manipulationDiv),mi(this.editModeDiv),mi(this.closeDiv),this.manipulationDiv&&this.canvas.frame.removeChild(this.manipulationDiv),this.editModeDiv&&this.canvas.frame.removeChild(this.editModeDiv),this.closeDiv&&this.canvas.frame.removeChild(this.closeDiv),this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0}_createSeperator(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+e]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+e].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+e])}_createAddNodeButton(e){var t;const i=this._createButton("addNode","vis-add",e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,z(t=this.addNodeMode).call(t,this))}_createAddEdgeButton(e){var t;const i=this._createButton("addEdge","vis-connect",e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,z(t=this.addEdgeMode).call(t,this))}_createEditNodeButton(e){var t;const i=this._createButton("editNode","vis-edit",e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,z(t=this.editNode).call(t,this))}_createEditEdgeButton(e){var t;const i=this._createButton("editEdge","vis-edit",e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,z(t=this.editEdgeMode).call(t,this))}_createDeleteButton(e){var t;let i;this.options.rtl?i="vis-delete-rtl":i="vis-delete";const n=this._createButton("delete",i,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,z(t=this.deleteSelected).call(t,this))}_createBackButton(e){var t;const i=this._createButton("back","vis-back",e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,z(t=this.showManipulatorToolbar).call(t,this))}_createButton(e,t,i){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"vis-label";return this.manipulationDOM[e+"Div"]=document.createElement("button"),this.manipulationDOM[e+"Div"].className="vis-button "+t,this.manipulationDOM[e+"Label"]=document.createElement("div"),this.manipulationDOM[e+"Label"].className=n,this.manipulationDOM[e+"Label"].innerText=i,this.manipulationDOM[e+"Div"].appendChild(this.manipulationDOM[e+"Label"]),this.manipulationDOM[e+"Div"]}_createDescription(e){this.manipulationDOM.descriptionLabel=document.createElement("div"),this.manipulationDOM.descriptionLabel.className="vis-none",this.manipulationDOM.descriptionLabel.innerText=e,this.manipulationDiv.appendChild(this.manipulationDOM.descriptionLabel)}_temporaryBindEvent(e,t){this.temporaryEventFunctions.push({event:e,boundFunction:t}),this.body.emitter.on(e,t)}_temporaryBindUI(e,t){if(this.body.eventListeners[e]!==void 0)this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=t;else throw new Error("This UI function does not exist. Typo? You tried: "+e+" possible are: "+ga(Ze(this.body.eventListeners)))}_unbindTemporaryUIs(){for(const e in this.temporaryUIFunctions)Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions,e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}_unbindTemporaryEvents(){for(let e=0;e{i.destroy()});const n=s=>{let{keyCode:o,key:a}=s;(a==="Enter"||a===" "||o===13||o===32)&&t()};e.addEventListener("keyup",n,!1),this._domEventListenerCleanupQueue.push(()=>{e.removeEventListener("keyup",n,!1)})}_cleanupTemporaryNodesAndEdges(){for(let s=0;s=0;a--)if(s[a]!==this.selectedControlNode.id){o=this.body.nodes[s[a]];break}if(o!==void 0&&this.selectedControlNode!==void 0)if(o.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{const a=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===a.id?this._performEditEdge(o.id,n.to.id):this._performEditEdge(n.from.id,o.id)}else n.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}_handleConnect(e){if(new Date().valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=ot({},this.body.view.translation),this.interactionHandler.drag.pointer=this.lastTouch,this.interactionHandler.drag.translation=this.lastTouch.translation;const t=this.lastTouch,i=this.selectionHandler.getNodeAt(t);if(i!==void 0)if(i.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{const n=this._getNewTargetNode(i.x,i.y);this.body.nodes[n.id]=n,this.body.nodeIndices.push(n.id);const s=this.body.functions.createEdge({id:"connectionEdge"+_o(),from:i.id,to:n.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[s.id]=s,this.body.edgeIndices.push(s.id),this.temporaryIds.nodes.push(n.id),this.temporaryIds.edges.push(s.id)}this.touchTime=new Date().valueOf()}}_dragControlNode(e){const t=this.body.functions.getPointer(e.center),i=this.selectionHandler._pointerToPositionObject(t);let n;this.temporaryIds.edges[0]!==void 0&&(n=this.body.edges[this.temporaryIds.edges[0]].fromId);const s=this.selectionHandler._getAllNodesOverlappingWith(i);let o;for(let u=s.length-1;u>=0;u--){var a;if(Fe(a=this.temporaryIds.nodes).call(a,s[u])===-1){o=this.body.nodes[s[u]];break}}if(e.controlEdge={from:n,to:o?o.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragging",e,t),this.temporaryIds.nodes[0]!==void 0){const u=this.body.nodes[this.temporaryIds.nodes[0]];u.x=this.canvas._XconvertDOMtoCanvas(t.x),u.y=this.canvas._YconvertDOMtoCanvas(t.y),this.body.emitter.emit("_redraw")}else this.interactionHandler.onDrag(e)}_finishConnect(e){const t=this.body.functions.getPointer(e.center),i=this.selectionHandler._pointerToPositionObject(t);let n;this.temporaryIds.edges[0]!==void 0&&(n=this.body.edges[this.temporaryIds.edges[0]].fromId);const s=this.selectionHandler._getAllNodesOverlappingWith(i);let o;for(let u=s.length-1;u>=0;u--){var a;if(Fe(a=this.temporaryIds.nodes).call(a,s[u])===-1){o=this.body.nodes[s[u]];break}}this._cleanupTemporaryNodesAndEdges(),o!==void 0&&(o.isCluster===!0?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):this.body.nodes[n]!==void 0&&this.body.nodes[o.id]!==void 0&&this._performAddEdge(n,o.id)),e.controlEdge={from:n,to:o?o.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragEnd",e,t),this.body.emitter.emit("_redraw")}_dragStartEdge(e){const t=this.lastTouch;this.selectionHandler.generateClickEvent("dragStart",e,t,void 0,!0)}_performAddNode(e){const t={id:_o(),x:e.pointer.canvas.x,y:e.pointer.canvas.y,label:"new"};if(typeof this.options.addNode=="function")if(this.options.addNode.length===2)this.options.addNode(t,i=>{i!=null&&this.inMode==="addNode"&&this.body.data.nodes.getDataSet().add(i),this.showManipulatorToolbar()});else throw this.showManipulatorToolbar(),new Error("The function for add does not support two arguments (data,callback)");else this.body.data.nodes.getDataSet().add(t),this.showManipulatorToolbar()}_performAddEdge(e,t){const i={from:e,to:t};if(typeof this.options.addEdge=="function")if(this.options.addEdge.length===2)this.options.addEdge(i,n=>{n!=null&&this.inMode==="addEdge"&&(this.body.data.edges.getDataSet().add(n),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())});else throw new Error("The function for connect does not support two arguments (data,callback)");else this.body.data.edges.getDataSet().add(i),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}_performEditEdge(e,t){const i={id:this.edgeBeingEditedId,from:e,to:t,label:this.body.data.edges.get(this.edgeBeingEditedId).label};let n=this.options.editEdge;if(typeof n=="object"&&(n=n.editWithoutDrag),typeof n=="function")if(n.length===2)n(i,s=>{s==null||this.inMode!=="editEdge"?(this.body.edges[i.id].updateEdgeType(),this.body.emitter.emit("_redraw"),this.showManipulatorToolbar()):(this.body.data.edges.getDataSet().update(s),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())});else throw new Error("The function for edit does not support two arguments (data, callback)");else this.body.data.edges.getDataSet().update(i),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}const G="string",L="boolean",M="number",oo="array",ue="object",H5="dom",Qie="any",g_=["arrow","bar","box","circle","crow","curve","diamond","image","inv_curve","inv_triangle","triangle","vee"],m_={borderWidth:{number:M},borderWidthSelected:{number:M,undefined:"undefined"},brokenImage:{string:G,undefined:"undefined"},chosen:{label:{boolean:L,function:"function"},node:{boolean:L,function:"function"},__type__:{object:ue,boolean:L}},color:{border:{string:G},background:{string:G},highlight:{border:{string:G},background:{string:G},__type__:{object:ue,string:G}},hover:{border:{string:G},background:{string:G},__type__:{object:ue,string:G}},__type__:{object:ue,string:G}},opacity:{number:M,undefined:"undefined"},fixed:{x:{boolean:L},y:{boolean:L},__type__:{object:ue,boolean:L}},font:{align:{string:G},color:{string:G},size:{number:M},face:{string:G},background:{string:G},strokeWidth:{number:M},strokeColor:{string:G},vadjust:{number:M},multi:{boolean:L,string:G},bold:{color:{string:G},size:{number:M},face:{string:G},mod:{string:G},vadjust:{number:M},__type__:{object:ue,string:G}},boldital:{color:{string:G},size:{number:M},face:{string:G},mod:{string:G},vadjust:{number:M},__type__:{object:ue,string:G}},ital:{color:{string:G},size:{number:M},face:{string:G},mod:{string:G},vadjust:{number:M},__type__:{object:ue,string:G}},mono:{color:{string:G},size:{number:M},face:{string:G},mod:{string:G},vadjust:{number:M},__type__:{object:ue,string:G}},__type__:{object:ue,string:G}},group:{string:G,number:M,undefined:"undefined"},heightConstraint:{minimum:{number:M},valign:{string:G},__type__:{object:ue,boolean:L,number:M}},hidden:{boolean:L},icon:{face:{string:G},code:{string:G},size:{number:M},color:{string:G},weight:{string:G,number:M},__type__:{object:ue}},id:{string:G,number:M},image:{selected:{string:G,undefined:"undefined"},unselected:{string:G,undefined:"undefined"},__type__:{object:ue,string:G}},imagePadding:{top:{number:M},right:{number:M},bottom:{number:M},left:{number:M},__type__:{object:ue,number:M}},label:{string:G,undefined:"undefined"},labelHighlightBold:{boolean:L},level:{number:M,undefined:"undefined"},margin:{top:{number:M},right:{number:M},bottom:{number:M},left:{number:M},__type__:{object:ue,number:M}},mass:{number:M},physics:{boolean:L},scaling:{min:{number:M},max:{number:M},label:{enabled:{boolean:L},min:{number:M},max:{number:M},maxVisible:{number:M},drawThreshold:{number:M},__type__:{object:ue,boolean:L}},customScalingFunction:{function:"function"},__type__:{object:ue}},shadow:{enabled:{boolean:L},color:{string:G},size:{number:M},x:{number:M},y:{number:M},__type__:{object:ue,boolean:L}},shape:{string:["custom","ellipse","circle","database","box","text","image","circularImage","diamond","dot","star","triangle","triangleDown","square","icon","hexagon"]},ctxRenderer:{function:"function"},shapeProperties:{borderDashes:{boolean:L,array:oo},borderRadius:{number:M},interpolation:{boolean:L},useImageSize:{boolean:L},useBorderWithImage:{boolean:L},coordinateOrigin:{string:["center","top-left"]},__type__:{object:ue}},size:{number:M},title:{string:G,dom:H5,undefined:"undefined"},value:{number:M,undefined:"undefined"},widthConstraint:{minimum:{number:M},maximum:{number:M},__type__:{object:ue,boolean:L,number:M}},x:{number:M},y:{number:M},__type__:{object:ue}},Zie={configure:{enabled:{boolean:L},filter:{boolean:L,string:G,array:oo,function:"function"},container:{dom:H5},showButton:{boolean:L},__type__:{object:ue,boolean:L,string:G,array:oo,function:"function"}},edges:{arrows:{to:{enabled:{boolean:L},scaleFactor:{number:M},type:{string:g_},imageHeight:{number:M},imageWidth:{number:M},src:{string:G},__type__:{object:ue,boolean:L}},middle:{enabled:{boolean:L},scaleFactor:{number:M},type:{string:g_},imageWidth:{number:M},imageHeight:{number:M},src:{string:G},__type__:{object:ue,boolean:L}},from:{enabled:{boolean:L},scaleFactor:{number:M},type:{string:g_},imageWidth:{number:M},imageHeight:{number:M},src:{string:G},__type__:{object:ue,boolean:L}},__type__:{string:["from","to","middle"],object:ue}},endPointOffset:{from:{number:M},to:{number:M},__type__:{object:ue,number:M}},arrowStrikethrough:{boolean:L},background:{enabled:{boolean:L},color:{string:G},size:{number:M},dashes:{boolean:L,array:oo},__type__:{object:ue,boolean:L}},chosen:{label:{boolean:L,function:"function"},edge:{boolean:L,function:"function"},__type__:{object:ue,boolean:L}},color:{color:{string:G},highlight:{string:G},hover:{string:G},inherit:{string:["from","to","both"],boolean:L},opacity:{number:M},__type__:{object:ue,string:G}},dashes:{boolean:L,array:oo},font:{color:{string:G},size:{number:M},face:{string:G},background:{string:G},strokeWidth:{number:M},strokeColor:{string:G},align:{string:["horizontal","top","middle","bottom"]},vadjust:{number:M},multi:{boolean:L,string:G},bold:{color:{string:G},size:{number:M},face:{string:G},mod:{string:G},vadjust:{number:M},__type__:{object:ue,string:G}},boldital:{color:{string:G},size:{number:M},face:{string:G},mod:{string:G},vadjust:{number:M},__type__:{object:ue,string:G}},ital:{color:{string:G},size:{number:M},face:{string:G},mod:{string:G},vadjust:{number:M},__type__:{object:ue,string:G}},mono:{color:{string:G},size:{number:M},face:{string:G},mod:{string:G},vadjust:{number:M},__type__:{object:ue,string:G}},__type__:{object:ue,string:G}},hidden:{boolean:L},hoverWidth:{function:"function",number:M},label:{string:G,undefined:"undefined"},labelHighlightBold:{boolean:L},length:{number:M,undefined:"undefined"},physics:{boolean:L},scaling:{min:{number:M},max:{number:M},label:{enabled:{boolean:L},min:{number:M},max:{number:M},maxVisible:{number:M},drawThreshold:{number:M},__type__:{object:ue,boolean:L}},customScalingFunction:{function:"function"},__type__:{object:ue}},selectionWidth:{function:"function",number:M},selfReferenceSize:{number:M},selfReference:{size:{number:M},angle:{number:M},renderBehindTheNode:{boolean:L},__type__:{object:ue}},shadow:{enabled:{boolean:L},color:{string:G},size:{number:M},x:{number:M},y:{number:M},__type__:{object:ue,boolean:L}},smooth:{enabled:{boolean:L},type:{string:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"]},roundness:{number:M},forceDirection:{string:["horizontal","vertical","none"],boolean:L},__type__:{object:ue,boolean:L}},title:{string:G,undefined:"undefined"},width:{number:M},widthConstraint:{maximum:{number:M},__type__:{object:ue,boolean:L,number:M}},value:{number:M,undefined:"undefined"},__type__:{object:ue}},groups:{useDefaultGroups:{boolean:L},__any__:m_,__type__:{object:ue}},interaction:{dragNodes:{boolean:L},dragView:{boolean:L},hideEdgesOnDrag:{boolean:L},hideEdgesOnZoom:{boolean:L},hideNodesOnDrag:{boolean:L},hover:{boolean:L},keyboard:{enabled:{boolean:L},speed:{x:{number:M},y:{number:M},zoom:{number:M},__type__:{object:ue}},bindToWindow:{boolean:L},autoFocus:{boolean:L},__type__:{object:ue,boolean:L}},multiselect:{boolean:L},navigationButtons:{boolean:L},selectable:{boolean:L},selectConnectedEdges:{boolean:L},hoverConnectedEdges:{boolean:L},tooltipDelay:{number:M},zoomView:{boolean:L},zoomSpeed:{number:M},__type__:{object:ue}},layout:{randomSeed:{undefined:"undefined",number:M,string:G},improvedLayout:{boolean:L},clusterThreshold:{number:M},hierarchical:{enabled:{boolean:L},levelSeparation:{number:M},nodeSpacing:{number:M},treeSpacing:{number:M},blockShifting:{boolean:L},edgeMinimization:{boolean:L},parentCentralization:{boolean:L},direction:{string:["UD","DU","LR","RL"]},sortMethod:{string:["hubsize","directed"]},shakeTowards:{string:["leaves","roots"]},__type__:{object:ue,boolean:L}},__type__:{object:ue}},manipulation:{enabled:{boolean:L},initiallyActive:{boolean:L},addNode:{boolean:L,function:"function"},addEdge:{boolean:L,function:"function"},editNode:{function:"function"},editEdge:{editWithoutDrag:{function:"function"},__type__:{object:ue,boolean:L,function:"function"}},deleteNode:{boolean:L,function:"function"},deleteEdge:{boolean:L,function:"function"},controlNodeStyle:m_,__type__:{object:ue,boolean:L}},nodes:m_,physics:{enabled:{boolean:L},barnesHut:{theta:{number:M},gravitationalConstant:{number:M},centralGravity:{number:M},springLength:{number:M},springConstant:{number:M},damping:{number:M},avoidOverlap:{number:M},__type__:{object:ue}},forceAtlas2Based:{theta:{number:M},gravitationalConstant:{number:M},centralGravity:{number:M},springLength:{number:M},springConstant:{number:M},damping:{number:M},avoidOverlap:{number:M},__type__:{object:ue}},repulsion:{centralGravity:{number:M},springLength:{number:M},springConstant:{number:M},nodeDistance:{number:M},damping:{number:M},__type__:{object:ue}},hierarchicalRepulsion:{centralGravity:{number:M},springLength:{number:M},springConstant:{number:M},nodeDistance:{number:M},damping:{number:M},avoidOverlap:{number:M},__type__:{object:ue}},maxVelocity:{number:M},minVelocity:{number:M},solver:{string:["barnesHut","repulsion","hierarchicalRepulsion","forceAtlas2Based"]},stabilization:{enabled:{boolean:L},iterations:{number:M},updateInterval:{number:M},onlyDynamicEdges:{boolean:L},fit:{boolean:L},__type__:{object:ue,boolean:L}},timestep:{number:M},adaptiveTimestep:{boolean:L},wind:{x:{number:M},y:{number:M},__type__:{object:ue}},__type__:{object:ue,boolean:L}},autoResize:{boolean:L},clickToUse:{boolean:L},locale:{string:G},locales:{__any__:{any:Qie},__type__:{object:ue}},height:{string:G},width:{string:G},__type__:{object:ue}},W5={nodes:{borderWidth:[1,0,10,1],borderWidthSelected:[2,0,10,1],color:{border:["color","#2B7CE9"],background:["color","#97C2FC"],highlight:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]},hover:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]}},opacity:[0,0,1,.1],fixed:{x:!1,y:!1},font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[0,0,50,1],strokeColor:["color","#ffffff"]},hidden:!1,labelHighlightBold:!0,physics:!0,scaling:{min:[10,0,200,1],max:[30,0,200,1],label:{enabled:!1,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},shape:["ellipse","box","circle","database","diamond","dot","square","star","text","triangle","triangleDown","hexagon"],shapeProperties:{borderDashes:!1,borderRadius:[6,0,20,1],interpolation:!0,useImageSize:!1},size:[25,0,200,1]},edges:{arrows:{to:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},middle:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},from:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"}},endPointOffset:{from:[0,-10,10,1],to:[0,-10,10,1]},arrowStrikethrough:!0,color:{color:["color","#848484"],highlight:["color","#848484"],hover:["color","#848484"],inherit:["from","to","both",!0,!1],opacity:[1,0,1,.05]},dashes:!1,font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[2,0,50,1],strokeColor:["color","#ffffff"],align:["horizontal","top","middle","bottom"]},hidden:!1,hoverWidth:[1.5,0,5,.1],labelHighlightBold:!0,physics:!0,scaling:{min:[1,0,100,1],max:[15,0,100,1],label:{enabled:!0,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},selectionWidth:[1.5,0,5,.1],selfReferenceSize:[20,0,200,1],selfReference:{size:[20,0,200,1],angle:[Math.PI/2,-6*Math.PI,6*Math.PI,Math.PI/8],renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},smooth:{enabled:!0,type:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"],forceDirection:["horizontal","vertical","none"],roundness:[.5,0,1,.05]},width:[1,0,30,1]},layout:{hierarchical:{enabled:!1,levelSeparation:[150,20,500,5],nodeSpacing:[100,20,500,5],treeSpacing:[200,20,500,5],blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:["UD","DU","LR","RL"],sortMethod:["hubsize","directed"],shakeTowards:["leaves","roots"]}},interaction:{dragNodes:!0,dragView:!0,hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1,hover:!1,keyboard:{enabled:!1,speed:{x:[10,0,40,1],y:[10,0,40,1],zoom:[.02,0,.1,.005]},bindToWindow:!0,autoFocus:!0},multiselect:!1,navigationButtons:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0,tooltipDelay:[300,0,1e3,25],zoomView:!0,zoomSpeed:[1,.1,2,.1]},manipulation:{enabled:!1,initiallyActive:!1},physics:{enabled:!0,barnesHut:{theta:[.5,.1,1,.05],gravitationalConstant:[-2e3,-3e4,0,50],centralGravity:[.3,0,10,.05],springLength:[95,0,500,5],springConstant:[.04,0,1.2,.005],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},forceAtlas2Based:{theta:[.5,.1,1,.05],gravitationalConstant:[-50,-500,0,1],centralGravity:[.01,0,1,.005],springLength:[95,0,500,5],springConstant:[.08,0,1.2,.005],damping:[.4,0,1,.01],avoidOverlap:[0,0,1,.01]},repulsion:{centralGravity:[.2,0,10,.05],springLength:[200,0,500,5],springConstant:[.05,0,1.2,.005],nodeDistance:[100,0,500,5],damping:[.09,0,1,.01]},hierarchicalRepulsion:{centralGravity:[.2,0,10,.05],springLength:[100,0,500,5],springConstant:[.01,0,1.2,.005],nodeDistance:[120,0,500,5],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},maxVelocity:[50,0,150,1],minVelocity:[.1,.01,.5,.01],solver:["barnesHut","forceAtlas2Based","repulsion","hierarchicalRepulsion"],timestep:[.5,.01,1,.01],wind:{x:[0,-10,10,.1],y:[0,-10,10,.1]}}},ene=(r,e,t)=>{var i;return!!(Ii(r).call(r,"physics")&&Ii(i=W5.physics.solver).call(i,e)&&t.physics.solver!==e&&e!=="wind")};class tne{constructor(){}getDistances(e,t,i){const n={},s=e.edges;for(let a=0;a2&&arguments[2]!==void 0?arguments[2]:!1;const n=this.distanceSolver.getDistances(this.body,e,t);this._createL_matrix(n),this._createK_matrix(n),this._createE_matrix();const s=.01,o=1;let a=0;const u=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),l=5;let c=1e9,d=0,h=0,f=0,p=0,v=0;for(;c>s&&ao&&vthis.body.emitter.emit("_requestRedraw")),this.groups=new WZ,this.canvas=new kre(this.body),this.selectionHandler=new bie(this.body,this.canvas),this.interactionHandler=new zre(this.body,this.canvas,this.selectionHandler),this.view=new jre(this.body,this.canvas),this.renderer=new Dre(this.body,this.canvas),this.physics=new Ire(this.body),this.layoutEngine=new Xie(this.body),this.clustering=new qre(this.body),this.manipulation=new Jie(this.body,this.canvas,this.selectionHandler,this.interactionHandler),this.nodesHandler=new Zte(this.body,this.images,this.groups,this.layoutEngine),this.edgesHandler=new bre(this.body,this.images,this.groups),this.body.modules.kamadaKawai=new rne(this.body,150,.05),this.body.modules.clustering=this.clustering,this.canvas._create(),this.setOptions(t),this.setData(e)}_3(ae.prototype);ae.prototype.setOptions=function(r){if(r===null&&(r=void 0),r!==void 0){if(iZ.validate(r,Zie)===!0&&console.error("%cErrors have been found in the supplied options object.",v5),Gs(["locale","locales","clickToUse"],this.options,r),r.locale!==void 0&&(r.locale=$Z(r.locales||this.options.locales,r.locale)),r=this.layoutEngine.setOptions(r.layout,r),this.canvas.setOptions(r),this.groups.setOptions(r.groups),this.nodesHandler.setOptions(r.nodes),this.edgesHandler.setOptions(r.edges),this.physics.setOptions(r.physics),this.manipulation.setOptions(r.manipulation,r,this.options),this.interactionHandler.setOptions(r.interaction),this.renderer.setOptions(r.interaction),this.selectionHandler.setOptions(r.interaction),r.groups!==void 0&&this.body.emitter.emit("refreshNodes"),"configure"in r&&(this.configurator||(this.configurator=new tZ(this,this.body.container,W5,this.canvas.pixelRatio,ene)),this.configurator.setOptions(r.configure)),this.configurator&&this.configurator.options.enabled===!0){const i={nodes:{},edges:{},layout:{},interaction:{},manipulation:{},physics:{},global:{}};Ue(i.nodes,this.nodesHandler.options),Ue(i.edges,this.edgesHandler.options),Ue(i.layout,this.layoutEngine.options),Ue(i.interaction,this.selectionHandler.options),Ue(i.interaction,this.renderer.options),Ue(i.interaction,this.interactionHandler.options),Ue(i.manipulation,this.manipulation.options),Ue(i.physics,this.physics.options),Ue(i.global,this.canvas.options),Ue(i.global,this.options),this.configurator.setModuleOptions(i)}r.clickToUse!==void 0?r.clickToUse===!0?this.activator===void 0&&(this.activator=new eZ(this.canvas.frame),this.activator.on("change",()=>{this.body.emitter.emit("activate")})):(this.activator!==void 0&&(this.activator.destroy(),delete this.activator),this.body.emitter.emit("activate")):this.body.emitter.emit("activate"),this.canvas.setSize(),this.body.emitter.emit("startSimulation")}};ae.prototype._updateVisibleIndices=function(){const r=this.body.nodes,e=this.body.edges;this.body.nodeIndices=[],this.body.edgeIndices=[];for(const t in r)Object.prototype.hasOwnProperty.call(r,t)&&!this.clustering._isClusteredNode(t)&&r[t].options.hidden===!1&&this.body.nodeIndices.push(r[t].id);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const i=e[t],n=r[i.fromId],s=r[i.toId],o=n!==void 0&&s!==void 0;!this.clustering._isClusteredEdge(t)&&i.options.hidden===!1&&o&&n.options.hidden===!1&&s.options.hidden===!1&&this.body.edgeIndices.push(i.id)}};ae.prototype.bindEventListeners=function(){this.body.emitter.on("_dataChanged",()=>{this.edgesHandler._updateState(),this.body.emitter.emit("_dataUpdated")}),this.body.emitter.on("_dataUpdated",()=>{this.clustering._updateState(),this._updateVisibleIndices(),this._updateValueRange(this.body.nodes),this._updateValueRange(this.body.edges),this.body.emitter.emit("startSimulation"),this.body.emitter.emit("_requestRedraw")})};ae.prototype.setData=function(r){if(this.body.emitter.emit("resetPhysics"),this.body.emitter.emit("_resetData"),this.selectionHandler.unselectAll(),r&&r.dot&&(r.nodes||r.edges))throw new SyntaxError('Data must contain either parameter "dot" or parameter pair "nodes" and "edges", but not both.');if(this.setOptions(r&&r.options),r&&r.dot){console.warn("The dot property has been deprecated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);");const e=fZ(r.dot);this.setData(e);return}else if(r&&r.gephi){console.warn("The gephi property has been deprecated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);");const e=pZ(r.gephi);this.setData(e);return}else this.nodesHandler.setData(r&&r.nodes,!0),this.edgesHandler.setData(r&&r.edges,!0);this.body.emitter.emit("_dataChanged"),this.body.emitter.emit("_dataLoaded"),this.body.emitter.emit("initPhysics")};ae.prototype.destroy=function(){this.body.emitter.emit("destroy"),this.body.emitter.off(),this.off(),delete this.groups,delete this.canvas,delete this.selectionHandler,delete this.interactionHandler,delete this.view,delete this.renderer,delete this.physics,delete this.layoutEngine,delete this.clustering,delete this.manipulation,delete this.nodesHandler,delete this.edgesHandler,delete this.configurator,delete this.images;for(const r in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,r)&&delete this.body.nodes[r];for(const r in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,r)&&delete this.body.edges[r];mi(this.body.container)};ae.prototype._updateValueRange=function(r){let e,t,i,n=0;for(e in r)if(Object.prototype.hasOwnProperty.call(r,e)){const s=r[e].getValue();s!==void 0&&(t=t===void 0?s:Math.min(s,t),i=i===void 0?s:Math.max(s,i),n+=s)}if(t!==void 0&&i!==void 0)for(e in r)Object.prototype.hasOwnProperty.call(r,e)&&r[e].setValueRange(t,i,n)};ae.prototype.isActive=function(){return!this.activator||this.activator.active};ae.prototype.setSize=function(){return this.canvas.setSize.apply(this.canvas,arguments)};ae.prototype.canvasToDOM=function(){return this.canvas.canvasToDOM.apply(this.canvas,arguments)};ae.prototype.DOMtoCanvas=function(){return this.canvas.DOMtoCanvas.apply(this.canvas,arguments)};ae.prototype.findNode=function(){return this.clustering.findNode.apply(this.clustering,arguments)};ae.prototype.isCluster=function(){return this.clustering.isCluster.apply(this.clustering,arguments)};ae.prototype.openCluster=function(){return this.clustering.openCluster.apply(this.clustering,arguments)};ae.prototype.cluster=function(){return this.clustering.cluster.apply(this.clustering,arguments)};ae.prototype.getNodesInCluster=function(){return this.clustering.getNodesInCluster.apply(this.clustering,arguments)};ae.prototype.clusterByConnection=function(){return this.clustering.clusterByConnection.apply(this.clustering,arguments)};ae.prototype.clusterByHubsize=function(){return this.clustering.clusterByHubsize.apply(this.clustering,arguments)};ae.prototype.updateClusteredNode=function(){return this.clustering.updateClusteredNode.apply(this.clustering,arguments)};ae.prototype.getClusteredEdges=function(){return this.clustering.getClusteredEdges.apply(this.clustering,arguments)};ae.prototype.getBaseEdge=function(){return this.clustering.getBaseEdge.apply(this.clustering,arguments)};ae.prototype.getBaseEdges=function(){return this.clustering.getBaseEdges.apply(this.clustering,arguments)};ae.prototype.updateEdge=function(){return this.clustering.updateEdge.apply(this.clustering,arguments)};ae.prototype.clusterOutliers=function(){return this.clustering.clusterOutliers.apply(this.clustering,arguments)};ae.prototype.getSeed=function(){return this.layoutEngine.getSeed.apply(this.layoutEngine,arguments)};ae.prototype.enableEditMode=function(){return this.manipulation.enableEditMode.apply(this.manipulation,arguments)};ae.prototype.disableEditMode=function(){return this.manipulation.disableEditMode.apply(this.manipulation,arguments)};ae.prototype.addNodeMode=function(){return this.manipulation.addNodeMode.apply(this.manipulation,arguments)};ae.prototype.editNode=function(){return this.manipulation.editNode.apply(this.manipulation,arguments)};ae.prototype.editNodeMode=function(){return console.warn("Deprecated: Please use editNode instead of editNodeMode."),this.manipulation.editNode.apply(this.manipulation,arguments)};ae.prototype.addEdgeMode=function(){return this.manipulation.addEdgeMode.apply(this.manipulation,arguments)};ae.prototype.editEdgeMode=function(){return this.manipulation.editEdgeMode.apply(this.manipulation,arguments)};ae.prototype.deleteSelected=function(){return this.manipulation.deleteSelected.apply(this.manipulation,arguments)};ae.prototype.getPositions=function(){return this.nodesHandler.getPositions.apply(this.nodesHandler,arguments)};ae.prototype.getPosition=function(){return this.nodesHandler.getPosition.apply(this.nodesHandler,arguments)};ae.prototype.storePositions=function(){return this.nodesHandler.storePositions.apply(this.nodesHandler,arguments)};ae.prototype.moveNode=function(){return this.nodesHandler.moveNode.apply(this.nodesHandler,arguments)};ae.prototype.getBoundingBox=function(){return this.nodesHandler.getBoundingBox.apply(this.nodesHandler,arguments)};ae.prototype.getConnectedNodes=function(r){return this.body.nodes[r]!==void 0?this.nodesHandler.getConnectedNodes.apply(this.nodesHandler,arguments):this.edgesHandler.getConnectedNodes.apply(this.edgesHandler,arguments)};ae.prototype.getConnectedEdges=function(){return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler,arguments)};ae.prototype.startSimulation=function(){return this.physics.startSimulation.apply(this.physics,arguments)};ae.prototype.stopSimulation=function(){return this.physics.stopSimulation.apply(this.physics,arguments)};ae.prototype.stabilize=function(){return this.physics.stabilize.apply(this.physics,arguments)};ae.prototype.getSelection=function(){return this.selectionHandler.getSelection.apply(this.selectionHandler,arguments)};ae.prototype.setSelection=function(){return this.selectionHandler.setSelection.apply(this.selectionHandler,arguments)};ae.prototype.getSelectedNodes=function(){return this.selectionHandler.getSelectedNodeIds.apply(this.selectionHandler,arguments)};ae.prototype.getSelectedEdges=function(){return this.selectionHandler.getSelectedEdgeIds.apply(this.selectionHandler,arguments)};ae.prototype.getNodeAt=function(){const r=this.selectionHandler.getNodeAt.apply(this.selectionHandler,arguments);return r!==void 0&&r.id!==void 0?r.id:r};ae.prototype.getEdgeAt=function(){const r=this.selectionHandler.getEdgeAt.apply(this.selectionHandler,arguments);return r!==void 0&&r.id!==void 0?r.id:r};ae.prototype.selectNodes=function(){return this.selectionHandler.selectNodes.apply(this.selectionHandler,arguments)};ae.prototype.selectEdges=function(){return this.selectionHandler.selectEdges.apply(this.selectionHandler,arguments)};ae.prototype.unselectAll=function(){this.selectionHandler.unselectAll.apply(this.selectionHandler,arguments),this.selectionHandler.commitWithoutEmitting.apply(this.selectionHandler),this.redraw()};ae.prototype.redraw=function(){return this.renderer.redraw.apply(this.renderer,arguments)};ae.prototype.getScale=function(){return this.view.getScale.apply(this.view,arguments)};ae.prototype.getViewPosition=function(){return this.view.getViewPosition.apply(this.view,arguments)};ae.prototype.fit=function(){return this.view.fit.apply(this.view,arguments)};ae.prototype.moveTo=function(){return this.view.moveTo.apply(this.view,arguments)};ae.prototype.focus=function(){return this.view.focus.apply(this.view,arguments)};ae.prototype.releaseNode=function(){return this.view.releaseNode.apply(this.view,arguments)};ae.prototype.getOptionsFromConfigurator=function(){let r={};return this.configurator&&(r=this.configurator.getOptions.apply(this.configurator)),r};const ine=wr({__name:"EditorWindow",setup(r){const e=Pr();return fw(async()=>{if(!e.value)return;const t=await IU(),i={nodes:t.nodes,edges:t.edges},n={};new ae(e.value,i,n)}),(t,i)=>(Ct(),bi(Rt,null,[gt(_w,null,{default:_u(()=>i[0]||(i[0]=[Ie("div",null," Редактор сценариев ",-1)])),_:1}),Ie("div",{ref_key:"network",ref:e,class:"graph-container"},null,512)],64))}}),nne=Tu(ine,[["__scopeId","data-v-3a1f22ee"]]),sne=wr({__name:"EditorView",setup(r){return(e,t)=>(Ct(),xi(nne))}}),one=wr({__name:"GamesWindow",setup(r){return(e,t)=>(Ct(),xi(_w,null,{default:_u(()=>t[0]||(t[0]=[Ie("div",null," Каталог игр ",-1)])),_:1}))}}),ane=wr({__name:"GamesView",setup(r){return(e,t)=>(Ct(),xi(one))}}),J_=fU({history:H4("/"),routes:[{path:"/",name:"home",component:dV},{path:"/editor",name:"editor",component:sne},{path:"/games",name:"games",component:ane}]}),$0=u4(vU);$0.use(h4());$0.use(J_);$0.mount("#app"); +`),n=i.length;if(t.multi)for(let s=0;s0)for(let a=0;a0)for(let s=0;s/&/.test(n)?(t.replace(t.text,"<","<")||t.replace(t.text,"&","&")||t.add("&"),!0):!1;for(;t.position")||t.parseStartTag("ital","")||t.parseStartTag("mono","")||t.parseEndTag("bold","")||t.parseEndTag("ital","")||t.parseEndTag("mono",""))||i(n)||t.add(n),t.position++}return t.emitBlock(),t.blocks}splitMarkdownBlocks(e){const t=new A2(e);let i=!0;const n=s=>/\\/.test(s)?(t.positionthis.parent.fontOptions.maxWdt}getLongestFit(e){let t="",i=0;for(;i1&&arguments[1]!==void 0?arguments[1]:"normal",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.parent.getFormattingValues(this.ctx,this.selected,this.hover,t),e=e.replace(/^( +)/g,"$1\r"),e=e.replace(/([^\r][^ ]*)( +)/g,"$1\r$2\r");let n=e.split("\r");for(;n.length>0;){let s=this.getLongestFit(n);if(s===0){const o=n[0],a=this.getLongestFitWord(o);this.lines.newLine(Cr(o).call(o,0,a),t),n[0]=Cr(o).call(o,a)}else{let o=s;n[s-1]===" "?s--:n[o]===" "&&o++;const a=Cr(n).call(n,0,s).join("");s==n.length&&i?this.lines.append(a,t):this.lines.newLine(a,t),n=Cr(n).call(n,o)}}}}const io=["bold","ital","boldital","mono"];class ls{constructor(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.body=e,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(t),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=i}setOptions(e){if(this.elementOptions=e,this.initFontOptions(e.font),du(e.label)?this.labelDirty=!0:e.label=void 0,e.font!==void 0&&e.font!==null){if(typeof e.font=="string")this.baseSize=this.fontOptions.size;else if(typeof e.font=="object"){const t=e.font.size;t!==void 0&&(this.baseSize=t)}}}initFontOptions(e){if(Oe(io,t=>{this.fontOptions[t]={}}),ls.parseFontString(this.fontOptions,e)){this.fontOptions.vadjust=0;return}Oe(e,(t,i)=>{t!=null&&typeof t!="object"&&(this.fontOptions[i]=t)})}static parseFontString(e,t){if(!t||typeof t!="string")return!1;const i=t.split(" ");return e.size=+i[0].replace("px",""),e.face=i[1],e.color=i[2],!0}constrain(e){const t={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:"middle"},i=yi(e,"widthConstraint");if(typeof i=="number")t.maxWdt=Number(i),t.minWdt=Number(i);else if(typeof i=="object"){const s=yi(e,["widthConstraint","maximum"]);typeof s=="number"&&(t.maxWdt=Number(s));const o=yi(e,["widthConstraint","minimum"]);typeof o=="number"&&(t.minWdt=Number(o))}const n=yi(e,"heightConstraint");if(typeof n=="number")t.minHgt=Number(n);else if(typeof n=="object"){const s=yi(e,["heightConstraint","minimum"]);typeof s=="number"&&(t.minHgt=Number(s));const o=yi(e,["heightConstraint","valign"]);typeof o=="string"&&(o==="top"||o==="bottom")&&(t.valign=o)}return t}update(e,t){this.setOptions(e,!0),this.propagateFonts(t),Ue(this.fontOptions,this.constrain(t)),this.fontOptions.chooser=S0("label",t)}adjustSizes(e){const t=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=t,this.fontOptions.minWdt-=t);const i=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=i)}addFontOptionsToPile(e,t){for(let i=0;i{o!==void 0&&(Object.prototype.hasOwnProperty.call(t,a)||(Fe(io).call(io,a)!==-1?t[a]={}:t[a]=o))})}return t}getFontOption(e,t,i){let n;for(let s=0;s{s[u]=a}),s.size=Number(s.size),s.vadjust=Number(s.vadjust)}}draw(e,t,i,n,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"middle";if(this.elementOptions.label===void 0)return;let a=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&a=this.elementOptions.scaling.label.maxVisible&&(a=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(e,n,s,t,i,o),this._drawBackground(e),this._drawText(e,t,this.size.yLine,o,a))}_drawBackground(e){if(this.fontOptions.background!==void 0&&this.fontOptions.background!=="none"){e.fillStyle=this.fontOptions.background;const t=this.getSize();e.fillRect(t.left,t.top,t.width,t.height)}}_drawText(e,t,i){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"middle",s=arguments.length>4?arguments[4]:void 0;[t,i]=this._setAlignment(e,t,i,n),e.textAlign="left",t=t-this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&(this.fontOptions.valign==="top"&&(i-=(this.size.height-this.size.labelHeight)/2),this.fontOptions.valign==="bottom"&&(i+=(this.size.height-this.size.labelHeight)/2));for(let o=0;o0&&(e.lineWidth=c.strokeWidth,e.strokeStyle=h,e.lineJoin="round"),e.fillStyle=d,c.strokeWidth>0&&e.strokeText(c.text,t+u,i+c.vadjust),e.fillText(c.text,t+u,i+c.vadjust),u+=c.width}i+=a.height}}}_setAlignment(e,t,i,n){if(this.isEdgeLabel&&this.fontOptions.align!=="horizontal"&&this.pointToSelf===!1){t=0,i=0;const s=2;this.fontOptions.align==="top"?(e.textBaseline="alphabetic",i-=2*s):this.fontOptions.align==="bottom"?(e.textBaseline="hanging",i+=2*s):e.textBaseline="middle"}else e.textBaseline=n;return[t,i]}_getColor(e,t,i){let n=e||"#000000",s=i||"#ffffff";if(t<=this.elementOptions.scaling.label.drawThreshold){const o=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-t)));n=nr(n,o),s=nr(s,o)}return[n,s]}getTextSize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this._processLabel(e,t,i),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}getSize(){let t=this.size.left,i=this.size.top-.5*2;if(this.isEdgeLabel){const s=-this.size.width*.5;switch(this.fontOptions.align){case"middle":t=s,i=-this.size.height*.5;break;case"top":t=s,i=-(this.size.height+2);break;case"bottom":t=s,i=2;break}}return{left:t,top:i,width:this.size.width,height:this.size.height}}calculateLabelSize(e,t,i){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"middle";this._processLabel(e,t,i),this.size.left=n-this.size.width*.5,this.size.top=s-this.size.height*.5,this.size.yLine=s+(1-this.lineCount)*.5*this.fontOptions.size,o==="hanging"&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}getFormattingValues(e,t,i,n){const s=function(u,l,c){return l==="normal"?c==="mod"?"":u[c]:u[l][c]!==void 0?u[l][c]:u[c]},o={color:s(this.fontOptions,n,"color"),size:s(this.fontOptions,n,"size"),face:s(this.fontOptions,n,"face"),mod:s(this.fontOptions,n,"mod"),vadjust:s(this.fontOptions,n,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(t||i)&&(n==="normal"&&this.fontOptions.chooser===!0&&this.elementOptions.labelHighlightBold?o.mod="bold":typeof this.fontOptions.chooser=="function"&&this.fontOptions.chooser(o,this.elementOptions.id,t,i));let a="";return o.mod!==void 0&&o.mod!==""&&(a+=o.mod+" "),a+=o.size+"px "+o.face,e.font=a.replace(/"/g,""),o.font=e.font,o.height=o.size,o}differentState(e,t){return e!==this.selectedState||t!==this.hoverState}_processLabelText(e,t,i,n){return new Nte(e,this,t,i).process(n)}_processLabel(e,t,i){if(this.labelDirty===!1&&!this.differentState(t,i))return;const n=this._processLabelText(e,t,i,this.elementOptions.label);this.fontOptions.minWdt>0&&n.width0&&n.height0&&(this.enableBorderDashes(e,t),e.stroke(),this.disableBorderDashes(e,t)),e.restore()}performFill(e,t){e.save(),e.fillStyle=t.color,this.enableShadow(e,t),ma(e).call(e),this.disableShadow(e,t),e.restore(),this.performStroke(e,t)}_addBoundingBoxMargin(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}_updateBoundingBox(e,t,i,n,s){i!==void 0&&this.resize(i,n,s),this.left=e-this.width/2,this.top=t-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(e,t,i,n,s){this._updateBoundingBox(e,t,i,n,s)}getDimensionsFromLabel(e,t,i){this.textSize=this.labelModule.getTextSize(e,t,i);let n=this.textSize.width,s=this.textSize.height;const o=14;return n===0&&(n=o,s=o),{width:n,height:s}}}let Fte=class extends Mn{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,i)){const n=this.getDimensionsFromLabel(e,t,i);this.width=n.width+this.margin.right+this.margin.left,this.height=n.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}draw(e,t,i,n,s,o){this.resize(e,n,s),this.left=t-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,o),m3(e,this.left,this.top,this.width,this.height,o.borderRadius),this.performFill(e,o),this.updateBoundingBox(t,i,e,n,s),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,n,s)}updateBoundingBox(e,t,i,n,s){this._updateBoundingBox(e,t,i,n,s);const o=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(o)}distanceToBorder(e,t){e&&this.resize(e);const i=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(t)),Math.abs(this.height/2/Math.sin(t)))+i}};class O0 extends Mn{constructor(e,t,i){super(e,t,i),this.labelOffset=0,this.selected=!1}setOptions(e,t,i){this.options=e,t===void 0&&i===void 0||this.setImages(t,i)}setImages(e,t){t&&this.selected?(this.imageObj=t,this.imageObjAlt=e):(this.imageObj=e,this.imageObjAlt=t)}switchImages(e){const t=e&&!this.selected||!e&&this.selected;if(this.selected=e,this.imageObjAlt!==void 0&&t){const i=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=i}}_getImagePadding(){const e={top:0,right:0,bottom:0,left:0};if(this.options.imagePadding){const t=this.options.imagePadding;typeof t=="object"?(e.top=t.top,e.right=t.right,e.bottom=t.bottom,e.left=t.left):(e.top=t,e.right=t,e.bottom=t,e.left=t)}return e}_resizeImage(){let e,t;if(this.options.shapeProperties.useImageSize===!1){let i=1,n=1;this.imageObj.width&&this.imageObj.height&&(this.imageObj.width>this.imageObj.height?i=this.imageObj.width/this.imageObj.height:n=this.imageObj.height/this.imageObj.width),e=this.options.size*2*i,t=this.options.size*2*n}else{const i=this._getImagePadding();e=this.imageObj.width+i.left+i.right,t=this.imageObj.height+i.top+i.bottom}this.width=e,this.height=t,this.radius=.5*this.width}_drawRawCircle(e,t,i,n){this.initContextForDraw(e,n),Jw(e,t,i,n.size),this.performFill(e,n)}_drawImageAtPosition(e,t){if(this.imageObj.width!=0){e.globalAlpha=t.opacity!==void 0?t.opacity:1,this.enableShadow(e,t);let i=1;this.options.shapeProperties.interpolation===!0&&(i=this.imageObj.width/this.width/this.body.view.scale);const n=this._getImagePadding(),s=this.left+n.left,o=this.top+n.top,a=this.width-n.left-n.right,u=this.height-n.top-n.bottom;this.imageObj.drawImageAtPosition(e,i,s,o,a,u),this.disableShadow(e,t)}}_drawImageLabel(e,t,i,n,s){let o=0;if(this.height!==void 0){o=this.height*.5;const u=this.labelModule.getTextSize(e,n,s);u.lineCount>=1&&(o+=u.height/2)}const a=i+o;this.options.label&&(this.labelOffset=o),this.labelModule.draw(e,t,a,n,s,"hanging")}}let kte=class extends O0{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,i)){const n=this.getDimensionsFromLabel(e,t,i),s=Math.max(n.width+this.margin.right+this.margin.left,n.height+this.margin.top+this.margin.bottom);this.options.size=s/2,this.width=s,this.height=s,this.radius=this.width/2}}draw(e,t,i,n,s,o){this.resize(e,n,s),this.left=t-this.width/2,this.top=i-this.height/2,this._drawRawCircle(e,t,i,o),this.updateBoundingBox(t,i),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,i,n,s)}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size}distanceToBorder(e){return e&&this.resize(e),this.width*.5}};class Bte extends O0{constructor(e,t,i,n,s){super(e,t,i),this.setImages(n,s)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0){const s=this.options.size*2;this.width=s,this.height=s,this.radius=.5*this.width;return}this.needsRefresh(t,i)&&this._resizeImage()}draw(e,t,i,n,s,o){this.switchImages(n),this.resize();let a=t,u=i;this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=t,this.top=i,a+=this.width/2,u+=this.height/2):(this.left=t-this.width/2,this.top=i-this.height/2),this._drawRawCircle(e,a,u,o),e.save(),e.clip(),this._drawImageAtPosition(e,o),e.restore(),this._drawImageLabel(e,a,u,n,s),this.updateBoundingBox(t,i)}updateBoundingBox(e,t){this.options.shapeProperties.coordinateOrigin==="top-left"?(this.boundingBox.top=t,this.boundingBox.left=e,this.boundingBox.right=e+this.options.size*2,this.boundingBox.bottom=t+this.options.size*2):(this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size),this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}distanceToBorder(e){return e&&this.resize(e),this.width*.5}}class Ui extends Mn{constructor(e,t,i){super(e,t,i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{size:this.options.size};if(this.needsRefresh(t,i)){var s,o;this.labelModule.getTextSize(e,t,i);const a=2*n.size;this.width=(s=this.customSizeWidth)!==null&&s!==void 0?s:a,this.height=(o=this.customSizeHeight)!==null&&o!==void 0?o:a,this.radius=.5*this.width}}_drawShape(e,t,i,n,s,o,a,u){return this.resize(e,o,a,u),this.left=n-this.width/2,this.top=s-this.height/2,this.initContextForDraw(e,u),t7(t)(e,n,s,u.size),this.performFill(e,u),this.options.icon!==void 0&&this.options.icon.code!==void 0&&(e.font=(o?"bold ":"")+this.height/2+"px "+(this.options.icon.face||"FontAwesome"),e.fillStyle=this.options.icon.color||"black",e.textAlign="center",e.textBaseline="middle",e.fillText(this.options.icon.code,n,s)),{drawExternalLabel:()=>{if(this.options.label!==void 0){this.labelModule.calculateLabelSize(e,o,a,n,s,"hanging");const l=s+.5*this.height+.5*this.labelModule.size.height;this.labelModule.draw(e,n,l,o,a,"hanging")}this.updateBoundingBox(n,s)}}}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height))}}function M2(r,e){var t=Ze(r);if(Di){var i=Di(r);e&&(i=Wt(i).call(i,function(n){return Wi(r,n).enumerable})),t.push.apply(t,i)}return t}function jte(r){for(var e=1;e{e.save(),u(),e.restore()}}return a.nodeDimensions&&(this.customSizeWidth=a.nodeDimensions.width,this.customSizeHeight=a.nodeDimensions.height),a}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class zte extends Mn{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e,t,i){if(this.needsRefresh(t,i)){const s=this.getDimensionsFromLabel(e,t,i).width+this.margin.right+this.margin.left;this.width=s,this.height=s,this.radius=this.width/2}}draw(e,t,i,n,s,o){this.resize(e,n,s),this.left=t-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,o),y3(e,t-this.width/2,i-this.height/2,this.width,this.height),this.performFill(e,o),this.updateBoundingBox(t,i,e,n,s),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,n,s)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let Hte=class extends Ui{constructor(e,t,i){super(e,t,i)}draw(e,t,i,n,s,o){return this._drawShape(e,"diamond",4,t,i,n,s,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class Wte extends Ui{constructor(e,t,i){super(e,t,i)}draw(e,t,i,n,s,o){return this._drawShape(e,"circle",2,t,i,n,s,o)}distanceToBorder(e){return e&&this.resize(e),this.options.size}}class N2 extends Mn{constructor(e,t,i){super(e,t,i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,i)){const n=this.getDimensionsFromLabel(e,t,i);this.height=n.height*2,this.width=n.width+n.height,this.radius=.5*this.width}}draw(e,t,i,n,s,o){this.resize(e,n,s),this.left=t-this.width*.5,this.top=i-this.height*.5,this.initContextForDraw(e,o),B_(e,this.left,this.top,this.width,this.height),this.performFill(e,o),this.updateBoundingBox(t,i,e,n,s),this.labelModule.draw(e,t,i,n,s)}distanceToBorder(e,t){e&&this.resize(e);const i=this.width*.5,n=this.height*.5,s=Math.sin(t)*i,o=Math.cos(t)*n;return i*n/Math.sqrt(s*s+o*o)}}class Ute extends Mn{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e,t,i){this.needsRefresh(t,i)&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}draw(e,t,i,n,s,o){return this.resize(e,n,s),this.options.icon.size=this.options.icon.size||50,this.left=t-this.width/2,this.top=i-this.height/2,this._icon(e,t,i,n,s,o),{drawExternalLabel:()=>{this.options.label!==void 0&&this.labelModule.draw(e,this.left+this.iconSize.width/2+this.margin.left,i+this.height/2+5,n),this.updateBoundingBox(t,i)}}}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.icon.size*.5,this.boundingBox.left=e-this.options.icon.size*.5,this.boundingBox.right=e+this.options.icon.size*.5,this.boundingBox.bottom=t+this.options.icon.size*.5,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+5))}_icon(e,t,i,n,s,o){const a=Number(this.options.icon.size);this.options.icon.code!==void 0?(e.font=[this.options.icon.weight!=null?this.options.icon.weight:n?"bold":"",(this.options.icon.weight!=null&&n?5:0)+a+"px",this.options.icon.face].join(" "),e.fillStyle=this.options.icon.color||"black",e.textAlign="center",e.textBaseline="middle",this.enableShadow(e,o),e.fillText(this.options.icon.code,t,i),this.disableShadow(e,o)):console.error("When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.")}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let Vte=class extends O0{constructor(e,t,i,n,s){super(e,t,i),this.setImages(n,s)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0){const s=this.options.size*2;this.width=s,this.height=s;return}this.needsRefresh(t,i)&&this._resizeImage()}draw(e,t,i,n,s,o){e.save(),this.switchImages(n),this.resize();let a=t,u=i;if(this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=t,this.top=i,a+=this.width/2,u+=this.height/2):(this.left=t-this.width/2,this.top=i-this.height/2),this.options.shapeProperties.useBorderWithImage===!0){const l=this.options.borderWidth,c=this.options.borderWidthSelected||2*this.options.borderWidth,d=(n?c:l)/this.body.view.scale;e.lineWidth=Math.min(this.width,d),e.beginPath();let h=n?this.options.color.highlight.border:s?this.options.color.hover.border:this.options.color.border,f=n?this.options.color.highlight.background:s?this.options.color.hover.background:this.options.color.background;o.opacity!==void 0&&(h=nr(h,o.opacity),f=nr(f,o.opacity)),e.strokeStyle=h,e.fillStyle=f,e.rect(this.left-.5*e.lineWidth,this.top-.5*e.lineWidth,this.width+e.lineWidth,this.height+e.lineWidth),ma(e).call(e),this.performStroke(e,o),e.closePath()}this._drawImageAtPosition(e,o),this._drawImageLabel(e,a,u,n,s),this.updateBoundingBox(t,i),e.restore()}updateBoundingBox(e,t){this.resize(),this.options.shapeProperties.coordinateOrigin==="top-left"?(this.left=e,this.top=t):(this.left=e-this.width/2,this.top=t-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,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class Kte extends Ui{constructor(e,t,i){super(e,t,i)}draw(e,t,i,n,s,o){return this._drawShape(e,"square",2,t,i,n,s,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class Gte extends Ui{constructor(e,t,i){super(e,t,i)}draw(e,t,i,n,s,o){return this._drawShape(e,"hexagon",4,t,i,n,s,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class Yte extends Ui{constructor(e,t,i){super(e,t,i)}draw(e,t,i,n,s,o){return this._drawShape(e,"star",4,t,i,n,s,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}class Xte extends Mn{constructor(e,t,i){super(e,t,i),this._setMargins(i)}resize(e,t,i){this.needsRefresh(t,i)&&(this.textSize=this.labelModule.getTextSize(e,t,i),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}draw(e,t,i,n,s,o){this.resize(e,n,s),this.left=t-this.width/2,this.top=i-this.height/2,this.enableShadow(e,o),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,n,s),this.disableShadow(e,o),this.updateBoundingBox(t,i,e,n,s)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}let Jte=class extends Ui{constructor(e,t,i){super(e,t,i)}draw(e,t,i,n,s,o){return this._drawShape(e,"triangle",3,t,i,n,s,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};class Qte extends Ui{constructor(e,t,i){super(e,t,i)}draw(e,t,i,n,s,o){return this._drawShape(e,"triangleDown",3,t,i,n,s,o)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}}function F2(r,e){var t=Ze(r);if(Di){var i=Di(r);e&&(i=Wt(i).call(i,function(n){return Wi(r,n).enumerable})),t.push.apply(t,i)}return t}function k2(r){for(var e=1;et[l]!=null);u.push("font"),lu(u,e,a),e.color=W_(e.color)}static parseOptions(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},s=arguments.length>4?arguments[4]:void 0;if(lu(["color","fixed","shadow"],e,t,i),Ke.checkMass(t),e.opacity!==void 0&&(Ke.checkOpacity(e.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity),e.opacity=void 0)),t.opacity!==void 0&&(Ke.checkOpacity(t.opacity)||(console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+t.opacity),t.opacity=void 0)),t.shapeProperties&&!Ke.checkCoordinateOrigin(t.shapeProperties.coordinateOrigin)&&console.error("Invalid option for node coordinateOrigin, found: "+t.shapeProperties.coordinateOrigin),ir(e,t,"shadow",n),t.color!==void 0&&t.color!==null){const a=W_(t.color);d5(e.color,a)}else i===!0&&t.color===null&&(e.color=$i(n.color));t.fixed!==void 0&&t.fixed!==null&&(typeof t.fixed=="boolean"?(e.fixed.x=t.fixed,e.fixed.y=t.fixed):(t.fixed.x!==void 0&&typeof t.fixed.x=="boolean"&&(e.fixed.x=t.fixed.x),t.fixed.y!==void 0&&typeof t.fixed.y=="boolean"&&(e.fixed.y=t.fixed.y))),i===!0&&t.font===null&&(e.font=$i(n.font)),Ke.updateGroupOptions(e,t,s),t.scaling!==void 0&&ir(e.scaling,t.scaling,"label",n.scaling)}getFormattingValues(){const e={color:this.options.color.background,opacity:this.options.opacity,borderWidth:this.options.borderWidth,borderColor:this.options.color.border,size:this.options.size,borderDashes:this.options.shapeProperties.borderDashes,borderRadius:this.options.shapeProperties.borderRadius,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y};if(this.selected||this.hover?this.chooser===!0?this.selected?(this.options.borderWidthSelected!=null?e.borderWidth=this.options.borderWidthSelected:e.borderWidth*=2,e.color=this.options.color.highlight.background,e.borderColor=this.options.color.highlight.border,e.shadow=this.options.shadow.enabled):this.hover&&(e.color=this.options.color.hover.background,e.borderColor=this.options.color.hover.border,e.shadow=this.options.shadow.enabled):typeof this.chooser=="function"&&(this.chooser(e,this.options.id,this.selected,this.hover),e.shadow===!1&&(e.shadowColor!==this.options.shadow.color||e.shadowSize!==this.options.shadow.size||e.shadowX!==this.options.shadow.x||e.shadowY!==this.options.shadow.y)&&(e.shadow=!0)):e.shadow=this.options.shadow.enabled,this.options.opacity!==void 0){const t=this.options.opacity;e.borderColor=nr(e.borderColor,t),e.color=nr(e.color,t),e.shadowColor=nr(e.shadowColor,t)}return e}updateLabelModule(e){(this.options.label===void 0||this.options.label===null)&&(this.options.label=""),Ke.updateGroupOptions(this.options,k2(k2({},e),{},{color:e&&e.color||this._localColor||void 0}),this.grouplist);const t=this.grouplist.get(this.options.group,!1),i=[e,this.options,t,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,i),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}updateShape(e){if(e===this.options.shape&&this.shape)this.shape.setOptions(this.options,this.imageObj,this.imageObjAlt);else switch(this.options.shape){case"box":this.shape=new Fte(this.options,this.body,this.labelModule);break;case"circle":this.shape=new kte(this.options,this.body,this.labelModule);break;case"circularImage":this.shape=new Bte(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case"custom":this.shape=new Lte(this.options,this.body,this.labelModule,this.options.ctxRenderer);break;case"database":this.shape=new zte(this.options,this.body,this.labelModule);break;case"diamond":this.shape=new Hte(this.options,this.body,this.labelModule);break;case"dot":this.shape=new Wte(this.options,this.body,this.labelModule);break;case"ellipse":this.shape=new N2(this.options,this.body,this.labelModule);break;case"icon":this.shape=new Ute(this.options,this.body,this.labelModule);break;case"image":this.shape=new Vte(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case"square":this.shape=new Kte(this.options,this.body,this.labelModule);break;case"hexagon":this.shape=new Gte(this.options,this.body,this.labelModule);break;case"star":this.shape=new Yte(this.options,this.body,this.labelModule);break;case"text":this.shape=new Xte(this.options,this.body,this.labelModule);break;case"triangle":this.shape=new Jte(this.options,this.body,this.labelModule);break;case"triangleDown":this.shape=new Qte(this.options,this.body,this.labelModule);break;default:this.shape=new N2(this.options,this.body,this.labelModule);break}this.needsRefresh()}select(){this.selected=!0,this.needsRefresh()}unselect(){this.selected=!1,this.needsRefresh()}needsRefresh(){this.shape.refreshNeeded=!0}getTitle(){return this.options.title}distanceToBorder(e,t){return this.shape.distanceToBorder(e,t)}isFixed(){return this.options.fixed.x&&this.options.fixed.y}isSelected(){return this.selected}getValue(){return this.options.value}getLabelSize(){return this.labelModule.size()}setValueRange(e,t,i){if(this.options.value!==void 0){const n=this.options.scaling.customScalingFunction(e,t,i,this.options.value),s=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){const o=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+n*o}this.options.size=this.options.scaling.min+n*s}else this.options.size=this.baseSize,this.options.font.size=this.baseFontSize;this.updateLabelModule()}draw(e){const t=this.getFormattingValues();return this.shape.draw(e,this.x,this.y,this.selected,this.hover,t)||{}}updateBoundingBox(e){this.shape.updateBoundingBox(this.x,this.y,e)}resize(e){const t=this.getFormattingValues();this.shape.resize(e,this.selected,this.hover,t)}getItemsOnPoint(e){const t=[];return this.labelModule.visible()&&Y_(this.labelModule.getSize(),e)&&t.push({nodeId:this.id,labelId:0}),Y_(this.shape.boundingBox,e)&&t.push({nodeId:this.id}),t}isOverlappingWith(e){return this.shape.lefte.left&&this.shape.tope.top}isBoundingBoxOverlappingWith(e){return this.shape.boundingBox.lefte.left&&this.shape.boundingBox.tope.top}static checkMass(e,t){if(e.mass!==void 0&&e.mass<=0){let i="";t!==void 0&&(i=" in node id: "+t),console.error("%cNegative or zero mass disallowed"+i+", setting mass to 1.",v5),e.mass=1}}}class Zte{constructor(e,t,i,n){var s;if(this.body=e,this.images=t,this.groups=i,this.layoutEngine=n,this.body.functions.createNode=z(s=this.create).call(s,this),this.nodesListeners={add:(o,a)=>{this.add(a.items)},update:(o,a)=>{this.update(a.items,a.data,a.oldData)},remove:(o,a)=>{this.remove(a.items)}},this.defaultOptions={borderWidth:1,borderWidthSelected:void 0,brokenImage:void 0,color:{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},opacity:void 0,fixed:{x:!1,y:!1},font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:0,strokeColor:"#ffffff",align:"center",vadjust:0,multi:!1,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"monospace",vadjust:2}},group:void 0,hidden:!1,icon:{face:"FontAwesome",code:void 0,size:50,color:"#2B7CE9"},image:void 0,imagePadding:{top:0,right:0,bottom:0,left:0},label:void 0,labelHighlightBold:!0,level:void 0,margin:{top:5,right:5,bottom:5,left:5},mass:1,physics:!0,scaling:{min:10,max:30,label:{enabled:!1,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(o,a,u,l){if(a===o)return .5;{const c=1/(a-o);return Math.max(0,(l-o)*c)}}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},shape:"ellipse",shapeProperties:{borderDashes:!1,borderRadius:6,interpolation:!0,useImageSize:!1,useBorderWithImage:!1,coordinateOrigin:"center"},size:25,title:void 0,value:void 0,x:void 0,y:void 0},this.defaultOptions.mass<=0)throw"Internal error: mass in defaultOptions of NodesHandler may not be zero or negative";this.options=$i(this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e,t;this.body.emitter.on("refreshNodes",z(e=this.refresh).call(e,this)),this.body.emitter.on("refresh",z(t=this.refresh).call(t,this)),this.body.emitter.on("destroy",()=>{Oe(this.nodesListeners,(i,n)=>{this.body.data.nodes&&this.body.data.nodes.off(n,i)}),delete this.body.functions.createNode,delete this.nodesListeners.add,delete this.nodesListeners.update,delete this.nodesListeners.remove,delete this.nodesListeners})}setOptions(e){if(e!==void 0){if(Ke.parseOptions(this.options,e),e.opacity!==void 0&&(G_(e.opacity)||!tn(e.opacity)||e.opacity<0||e.opacity>1?console.error("Invalid option for node opacity. Value must be between 0 and 1, found: "+e.opacity):this.options.opacity=e.opacity),e.shape!==void 0)for(const t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&this.body.nodes[t].updateShape();if(typeof e.font<"u"||typeof e.widthConstraint<"u"||typeof e.heightConstraint<"u")for(const t of Ze(this.body.nodes))this.body.nodes[t].updateLabelModule(),this.body.nodes[t].needsRefresh();if(e.size!==void 0)for(const t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&this.body.nodes[t].needsRefresh();(e.hidden!==void 0||e.physics!==void 0)&&this.body.emitter.emit("_dataChanged")}}setData(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.body.data.nodes;if(l3("id",e))this.body.data.nodes=e;else if(et(e))this.body.data.nodes=new nu,this.body.data.nodes.add(e);else if(!e)this.body.data.nodes=new nu;else throw new TypeError("Array or DataSet expected");if(i&&Oe(this.nodesListeners,function(n,s){i.off(s,n)}),this.body.nodes={},this.body.data.nodes){const n=this;Oe(this.nodesListeners,function(o,a){n.body.data.nodes.on(a,o)});const s=this.body.data.nodes.getIds();this.add(s,!0)}t===!1&&this.body.emitter.emit("_dataChanged")}add(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i;const n=[];for(let s=0;s1&&arguments[1]!==void 0?arguments[1]:Ke;return new t(e,this.body,this.images,this.groups,this.options,this.defaultOptions)}refresh(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;Oe(this.body.nodes,(t,i)=>{const n=this.body.data.nodes.get(i);n!==void 0&&(e===!0&&t.setOptions({x:null,y:null}),t.setOptions({fixed:!1}),t.setOptions(n))})}getPositions(e){const t={};if(e!==void 0){if(et(e)===!0){for(let i=0;i{this.body.emitter.emit("startSimulation")},0)):console.error("Node id supplied to moveNode does not exist. Provided: ",e)}}var B2={},j2;function ere(){if(j2)return B2;j2=1;var r=ce(),e=Math.hypot,t=Math.abs,i=Math.sqrt,n=!!e&&e(1/0,NaN)!==1/0;return r({target:"Math",stat:!0,arity:2,forced:n},{hypot:function(o,a){for(var u=0,l=0,c=arguments.length,d=0,h,f;l0?(f=h/d,u+=f*f):u+=h;return d===1/0?1/0:d*i(u)}}),B2}var _1,L2;function tre(){if(L2)return _1;L2=1,ere();var r=Be();return _1=r.Math.hypot,_1}var w1,z2;function rre(){if(z2)return w1;z2=1;var r=tre();return w1=r,w1}var E1,H2;function ire(){return H2||(H2=1,E1=rre()),E1}var nre=ire(),sre=pe(nre);class tt{static transform(e,t){et(e)||(e=[e]);const i=t.point.x,n=t.point.y,s=t.angle,o=t.length;for(let a=0;a4&&arguments[4]!==void 0?arguments[4]:this.getViaNode();e.strokeStyle=this.getColor(e,t),e.lineWidth=t.width,t.dashes!==!1?this._drawDashedLine(e,t,s):this._drawLine(e,t,s)}_drawLine(e,t,i,n,s){if(this.from!=this.to)this._line(e,t,i,n,s);else{const[o,a,u]=this._getCircleData(e);this._circle(e,t,o,a,u)}}_drawDashedLine(e,t,i,n,s){e.lineCap="round";const o=et(t.dashes)?t.dashes:[5,5];if(e.setLineDash!==void 0){if(e.save(),e.setLineDash(o),e.lineDashOffset=0,this.from!=this.to)this._line(e,t,i);else{const[a,u,l]=this._getCircleData(e);this._circle(e,t,a,u,l)}e.setLineDash([0]),e.lineDashOffset=0,e.restore()}else{if(this.from!=this.to)b3(e,this.from.x,this.from.y,this.to.x,this.to.y,o);else{const[a,u,l]=this._getCircleData(e);this._circle(e,t,a,u,l)}this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}}findBorderPosition(e,t,i){return this.from!=this.to?this._findBorderPosition(e,t,i):this._findBorderPositionCircle(e,t,i)}findBorderPositions(e){if(this.from!=this.to)return{from:this._findBorderPosition(this.from,e),to:this._findBorderPosition(this.to,e)};{var t;const[i,n]=Cr(t=this._getCircleData(e)).call(t,0,2);return{from:this._findBorderPositionCircle(this.from,e,{x:i,y:n,low:.25,high:.6,direction:-1}),to:this._findBorderPositionCircle(this.from,e,{x:i,y:n,low:.6,high:.8,direction:1})}}}_getCircleData(e){const t=this.options.selfReference.size;e!==void 0&&this.from.shape.width===void 0&&this.from.shape.resize(e);const i=x5(e,this.options.selfReference.angle,t,this.from);return[i.x,i.y,t]}_pointOnCircle(e,t,i,n){const s=n*2*Math.PI;return{x:e+i*Math.cos(s),y:t-i*Math.sin(s)}}_findBorderPositionCircle(e,t,i){const n=i.x,s=i.y;let o=i.low,a=i.high;const u=i.direction,l=10,c=this.options.selfReference.size,d=.05;let h,f=(o+a)*.5,p=0;this.options.arrowStrikethrough===!0&&(u===-1?p=this.options.endPointOffset.from:u===1&&(p=this.options.endPointOffset.to));let v=0;do{f=(o+a)*.5,h=this._pointOnCircle(n,s,c,f);const b=Math.atan2(e.y-h.y,e.x-h.x),m=e.distanceToBorder(t,b)+p,g=Math.sqrt(Math.pow(h.x-e.x,2)+Math.pow(h.y-e.y,2)),w=m-g;if(Math.abs(w)0?u>0?o=f:a=f:u>0?a=f:o=f,++v}while(o<=a&&v1?c=1:c<0&&(c=0);const d=e+c*a,h=t+c*u,f=d-s,p=h-o;return Math.sqrt(f*f+p*p)}getArrowData(e,t,i,n,s,o){let a,u,l,c,d,h,f;const p=o.width;t==="from"?(l=this.from,c=this.to,d=o.fromArrowScale<0,h=Math.abs(o.fromArrowScale),f=o.fromArrowType):t==="to"?(l=this.to,c=this.from,d=o.toArrowScale<0,h=Math.abs(o.toArrowScale),f=o.toArrowType):(l=this.to,c=this.from,d=o.middleArrowScale<0,h=Math.abs(o.middleArrowScale),f=o.middleArrowType);const v=15*h+3*p;if(l!=c){const w=sre(l.x-c.x,l.y-c.y),y=v/w;if(t!=="middle")if(this.options.smooth.enabled===!0){const S=this._findBorderPosition(l,e,{via:i}),O=this.getPoint(S.t+y*(t==="from"?1:-1),i);a=Math.atan2(S.y-O.y,S.x-O.x),u=S}else a=Math.atan2(l.y-c.y,l.x-c.x),u=this._findBorderPosition(l,e);else{const S=(d?-y:y)/2,O=this.getPoint(.5+S,i),I=this.getPoint(.5-S,i);a=Math.atan2(O.y-I.y,O.x-I.x),u=this.getPoint(.5,i)}}else{const[w,y,S]=this._getCircleData(e);if(t==="from"){const O=this.options.selfReference.angle,I=this.options.selfReference.angle+Math.PI,_=this._findBorderPositionCircle(this.from,e,{x:w,y,low:O,high:I,direction:-1});a=_.t*-2*Math.PI+1.5*Math.PI+.1*Math.PI,u=_}else if(t==="to"){const O=this.options.selfReference.angle,I=this.options.selfReference.angle+Math.PI,_=this._findBorderPositionCircle(this.from,e,{x:w,y,low:O,high:I,direction:1});a=_.t*-2*Math.PI+1.5*Math.PI-1.1*Math.PI,u=_}else{const O=this.options.selfReference.angle/(2*Math.PI);u=this._pointOnCircle(w,y,S,O),a=O*-2*Math.PI+1.5*Math.PI+.1*Math.PI}}const b=u.x-v*.9*Math.cos(a),m=u.y-v*.9*Math.sin(a);return{point:u,core:{x:b,y:m},angle:a,length:v,type:f}}drawArrowHead(e,t,i,n,s){e.strokeStyle=this.getColor(e,t),e.fillStyle=e.strokeStyle,e.lineWidth=t.width,D5.draw(e,s)&&(this.enableShadow(e,t),ma(e).call(e),this.disableShadow(e,t))}enableShadow(e,t){t.shadow===!0&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}disableShadow(e,t){t.shadow===!0&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}drawBackground(e,t){if(t.background!==!1){const i={strokeStyle:e.strokeStyle,lineWidth:e.lineWidth,dashes:e.dashes};e.strokeStyle=t.backgroundColor,e.lineWidth=t.backgroundSize,this.setStrokeDashed(e,t.backgroundDashes),e.stroke(),e.strokeStyle=i.strokeStyle,e.lineWidth=i.lineWidth,e.dashes=i.dashes,this.setStrokeDashed(e,t.dashes)}}setStrokeDashed(e,t){if(t!==!1)if(e.setLineDash!==void 0){const i=et(t)?t:[5,5];e.setLineDash(i)}else console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.");else e.setLineDash!==void 0?e.setLineDash([]):console.warn("setLineDash is not supported in this browser. The dashed stroke cannot be used.")}}function V2(r,e){var t=Ze(r);if(Di){var i=Di(r);e&&(i=Wt(i).call(i,function(n){return Wi(r,n).enumerable})),t.push.apply(t,i)}return t}function K2(r){for(var e=1;e2&&arguments[2]!==void 0?arguments[2]:this._getViaCoordinates();const n=10,s=.2;let o=!1,a=1,u=0,l=this.to,c,d,h=this.options.endPointOffset?this.options.endPointOffset.to:0;e.id===this.from.id&&(l=this.from,o=!0,h=this.options.endPointOffset?this.options.endPointOffset.from:0),this.options.arrowStrikethrough===!1&&(h=0);let f=0;do{d=(u+a)*.5,c=this.getPoint(d,i);const p=Math.atan2(l.y-c.y,l.x-c.x),v=l.distanceToBorder(t,p)+h,b=Math.sqrt(Math.pow(c.x-l.x,2)+Math.pow(c.y-l.y,2)),m=v-b;if(Math.abs(m)0&&(l=this._getDistanceToLine(p,v,h,f,s,o),u=l{this.positionBezierNode()},this._body.emitter.on("_repositionBezierNodes",this._boundFunction)}setOptions(e){super.setOptions(e);let t=!1;this.options.physics!==e.physics&&(t=!0),this.options=e,this.id=this.options.id,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.setupSupportNode(),this.connect(),t===!0&&(this.via.setOptions({physics:this.options.physics}),this.positionBezierNode())}connect(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.from===void 0||this.to===void 0||this.options.physics===!1?this.via.setOptions({physics:!1}):this.from.id===this.to.id?this.via.setOptions({physics:!1}):this.via.setOptions({physics:!0})}cleanup(){return this._body.emitter.off("_repositionBezierNodes",this._boundFunction),this.via!==void 0?(delete this._body.nodes[this.via.id],this.via=void 0,!0):!1}setupSupportNode(){if(this.via===void 0){const e="edgeId:"+this.id,t=this._body.functions.createNode({id:e,shape:"circle",physics:!0,hidden:!0});this._body.nodes[e]=t,this.via=t,this.via.parentEdgeId=this.id,this.positionBezierNode()}}positionBezierNode(){this.via!==void 0&&this.from!==void 0&&this.to!==void 0?(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y)):this.via!==void 0&&(this.via.x=0,this.via.y=0)}_line(e,t,i){this._bezierCurve(e,t,i)}_getViaCoordinates(){return this.via}getViaNode(){return this.via}getPoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.via;if(this.from===this.to){const[i,n,s]=this._getCircleData(),o=2*Math.PI*(1-e);return{x:i+s*Math.sin(o),y:n+s-s*(1-Math.cos(o))}}else return{x:Math.pow(1-e,2)*this.fromPoint.x+2*e*(1-e)*t.x+Math.pow(e,2)*this.toPoint.x,y:Math.pow(1-e,2)*this.fromPoint.y+2*e*(1-e)*t.y+Math.pow(e,2)*this.toPoint.y}}_findBorderPosition(e,t){return this._findBorderPositionBezier(e,t,this.via)}_getDistanceToEdge(e,t,i,n,s,o){return this._getDistanceToBezierEdge(e,t,i,n,s,o,this.via)}}class Y2 extends I0{constructor(e,t,i){super(e,t,i)}_line(e,t,i){this._bezierCurve(e,t,i)}getViaNode(){return this._getViaCoordinates()}_getViaCoordinates(){const e=this.options.smooth.roundness,t=this.options.smooth.type;let i=Math.abs(this.from.x-this.to.x),n=Math.abs(this.from.y-this.to.y);if(t==="discrete"||t==="diagonalCross"){let s,o;i<=n?s=o=e*n:s=o=e*i,this.from.x>this.to.x&&(s=-s),this.from.y>=this.to.y&&(o=-o);let a=this.from.x+s,u=this.from.y+o;return t==="discrete"&&(i<=n?a=ithis.to.x&&(s=-s),this.from.y>=this.to.y&&(o=-o);let a=this.from.x+s,u=this.from.y+o;return i<=n?this.from.x<=this.to.x?a=this.to.xa?this.to.x:a:this.from.y>=this.to.y?u=this.to.y>u?this.to.y:u:u=this.to.y2&&arguments[2]!==void 0?arguments[2]:{};return this._findBorderPositionBezier(e,t,i.via)}_getDistanceToEdge(e,t,i,n,s,o){let a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(e,t,i,n,s,o,a)}getPoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates();const i=e,n=Math.pow(1-i,2)*this.fromPoint.x+2*i*(1-i)*t.x+Math.pow(i,2)*this.toPoint.x,s=Math.pow(1-i,2)*this.fromPoint.y+2*i*(1-i)*t.y+Math.pow(i,2)*this.toPoint.y;return{x:n,y:s}}}class yre extends I0{constructor(e,t,i){super(e,t,i)}_getDistanceToBezierEdge2(e,t,i,n,s,o,a,u){let l=1e9,c=e,d=t;const h=[0,0,0,0];for(let f=1;f<10;f++){const p=.1*f;h[0]=Math.pow(1-p,3),h[1]=3*p*Math.pow(1-p,2),h[2]=3*Math.pow(p,2)*(1-p),h[3]=Math.pow(p,3);const v=h[0]*e+h[1]*a.x+h[2]*u.x+h[3]*i,b=h[0]*t+h[1]*a.y+h[2]*u.y+h[3]*n;if(f>0){const m=this._getDistanceToLine(c,d,v,b,s,o);l=mMath.abs(t)||this.options.smooth.forceDirection===!0||this.options.smooth.forceDirection==="horizontal")&&this.options.smooth.forceDirection!=="vertical"?(n=this.from.y,o=this.to.y,i=this.from.x-a*e,s=this.to.x+a*e):(n=this.from.y-a*t,o=this.to.y+a*t,i=this.from.x,s=this.to.x),[{x:i,y:n},{x:s,y:o}]}getViaNode(){return this._getViaCoordinates()}_findBorderPosition(e,t){return this._findBorderPositionBezier(e,t)}_getDistanceToEdge(e,t,i,n,s,o){let[a,u]=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge2(e,t,i,n,s,o,a,u)}getPoint(e){let[t,i]=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates();const n=e,s=[Math.pow(1-n,3),3*n*Math.pow(1-n,2),3*Math.pow(n,2)*(1-n),Math.pow(n,3)],o=s[0]*this.fromPoint.x+s[1]*t.x+s[2]*i.x+s[3]*this.toPoint.x,a=s[0]*this.fromPoint.y+s[1]*t.y+s[2]*i.y+s[3]*this.toPoint.y;return{x:o,y:a}}}class J2 extends A5{constructor(e,t,i){super(e,t,i)}_line(e,t){e.beginPath(),e.moveTo(this.fromPoint.x,this.fromPoint.y),e.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}getViaNode(){}getPoint(e){return{x:(1-e)*this.fromPoint.x+e*this.toPoint.x,y:(1-e)*this.fromPoint.y+e*this.toPoint.y}}_findBorderPosition(e,t){let i=this.to,n=this.from;e.id===this.from.id&&(i=this.from,n=this.to);const s=Math.atan2(i.y-n.y,i.x-n.x),o=i.x-n.x,a=i.y-n.y,u=Math.sqrt(o*o+a*a),l=e.distanceToBorder(t,s),c=(u-l)/u;return{x:(1-c)*n.x+c*i.x,y:(1-c)*n.y+c*i.y,t:0}}_getDistanceToEdge(e,t,i,n,s,o){return this._getDistanceToLine(e,t,i,n,s,o)}}class Pi{constructor(e,t,i,n,s){if(t===void 0)throw new Error("No body provided");this.options=$i(n),this.globalOptions=n,this.defaultOptions=s,this.body=t,this.imagelist=i,this.id=void 0,this.fromId=void 0,this.toId=void 0,this.selected=!1,this.hover=!1,this.labelDirty=!0,this.baseWidth=this.options.width,this.baseFontSize=this.options.font.size,this.from=void 0,this.to=void 0,this.edgeType=void 0,this.connected=!1,this.labelModule=new ls(this.body,this.options,!0),this.setOptions(e)}setOptions(e){if(!e)return;let t=typeof e.physics<"u"&&this.options.physics!==e.physics||typeof e.hidden<"u"&&(this.options.hidden||!1)!==(e.hidden||!1)||typeof e.from<"u"&&this.options.from!==e.from||typeof e.to<"u"&&this.options.to!==e.to;Pi.parseOptions(this.options,e,!0,this.globalOptions),e.id!==void 0&&(this.id=e.id),e.from!==void 0&&(this.fromId=e.from),e.to!==void 0&&(this.toId=e.to),e.title!==void 0&&(this.title=e.title),e.value!==void 0&&(e.value=C5(e.value));const i=[e,this.options,this.defaultOptions];return this.chooser=S0("edge",i),this.updateLabelModule(e),t=this.updateEdgeType()||t,this._setInteractionWidths(),this.connect(),t}static parseOptions(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(Gs(["endPointOffset","arrowStrikethrough","id","from","hidden","hoverWidth","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","selfReference","to","title","value","width","font","chosen","widthConstraint"],e,t,i),t.endPointOffset!==void 0&&t.endPointOffset.from!==void 0&&(tn(t.endPointOffset.from)?e.endPointOffset.from=t.endPointOffset.from:(e.endPointOffset.from=n.endPointOffset.from!==void 0?n.endPointOffset.from:0,console.error("endPointOffset.from is not a valid number"))),t.endPointOffset!==void 0&&t.endPointOffset.to!==void 0&&(tn(t.endPointOffset.to)?e.endPointOffset.to=t.endPointOffset.to:(e.endPointOffset.to=n.endPointOffset.to!==void 0?n.endPointOffset.to:0,console.error("endPointOffset.to is not a valid number"))),du(t.label)?e.label=t.label:du(e.label)||(e.label=void 0),ir(e,t,"smooth",n),ir(e,t,"shadow",n),ir(e,t,"background",n),t.dashes!==void 0&&t.dashes!==null?e.dashes=t.dashes:i===!0&&t.dashes===null&&(e.dashes=an(n.dashes)),t.scaling!==void 0&&t.scaling!==null?(t.scaling.min!==void 0&&(e.scaling.min=t.scaling.min),t.scaling.max!==void 0&&(e.scaling.max=t.scaling.max),ir(e.scaling,t.scaling,"label",n.scaling)):i===!0&&t.scaling===null&&(e.scaling=an(n.scaling)),t.arrows!==void 0&&t.arrows!==null)if(typeof t.arrows=="string"){const a=t.arrows.toLowerCase();e.arrows.to.enabled=Fe(a).call(a,"to")!=-1,e.arrows.middle.enabled=Fe(a).call(a,"middle")!=-1,e.arrows.from.enabled=Fe(a).call(a,"from")!=-1}else if(typeof t.arrows=="object")ir(e.arrows,t.arrows,"to",n.arrows),ir(e.arrows,t.arrows,"middle",n.arrows),ir(e.arrows,t.arrows,"from",n.arrows);else throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+ga(t.arrows));else i===!0&&t.arrows===null&&(e.arrows=an(n.arrows));if(t.color!==void 0&&t.color!==null){const a=as(t.color)?{color:t.color,highlight:t.color,hover:t.color,inherit:!1,opacity:1}:t.color,u=e.color;if(s)Ue(u,n.color,!1,i);else for(const l in u)Object.prototype.hasOwnProperty.call(u,l)&&delete u[l];if(as(u))u.color=u,u.highlight=u,u.hover=u,u.inherit=!1,a.opacity===void 0&&(u.opacity=1);else{let l=!1;a.color!==void 0&&(u.color=a.color,l=!0),a.highlight!==void 0&&(u.highlight=a.highlight,l=!0),a.hover!==void 0&&(u.hover=a.hover,l=!0),a.inherit!==void 0&&(u.inherit=a.inherit),a.opacity!==void 0&&(u.opacity=Math.min(1,Math.max(0,a.opacity))),l===!0?u.inherit=!1:u.inherit===void 0&&(u.inherit="from")}}else i===!0&&t.color===null&&(e.color=$i(n.color));i===!0&&t.font===null&&(e.font=$i(n.font)),Object.prototype.hasOwnProperty.call(t,"selfReferenceSize")&&(console.warn("The selfReferenceSize property has been deprecated. Please use selfReference property instead. The selfReference can be set like thise selfReference:{size:30, angle:Math.PI / 4}"),e.selfReference.size=t.selfReferenceSize)}getFormattingValues(){const e=this.options.arrows.to===!0||this.options.arrows.to.enabled===!0,t=this.options.arrows.from===!0||this.options.arrows.from.enabled===!0,i=this.options.arrows.middle===!0||this.options.arrows.middle.enabled===!0,n=this.options.color.inherit,s={toArrow:e,toArrowScale:this.options.arrows.to.scaleFactor,toArrowType:this.options.arrows.to.type,toArrowSrc:this.options.arrows.to.src,toArrowImageWidth:this.options.arrows.to.imageWidth,toArrowImageHeight:this.options.arrows.to.imageHeight,middleArrow:i,middleArrowScale:this.options.arrows.middle.scaleFactor,middleArrowType:this.options.arrows.middle.type,middleArrowSrc:this.options.arrows.middle.src,middleArrowImageWidth:this.options.arrows.middle.imageWidth,middleArrowImageHeight:this.options.arrows.middle.imageHeight,fromArrow:t,fromArrowScale:this.options.arrows.from.scaleFactor,fromArrowType:this.options.arrows.from.type,fromArrowSrc:this.options.arrows.from.src,fromArrowImageWidth:this.options.arrows.from.imageWidth,fromArrowImageHeight:this.options.arrows.from.imageHeight,arrowStrikethrough:this.options.arrowStrikethrough,color:n?void 0:this.options.color.color,inheritsColor:n,opacity:this.options.color.opacity,hidden:this.options.hidden,length:this.options.length,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y,dashes:this.options.dashes,width:this.options.width,background:this.options.background.enabled,backgroundColor:this.options.background.color,backgroundSize:this.options.background.size,backgroundDashes:this.options.background.dashes};if(this.selected||this.hover)if(this.chooser===!0){if(this.selected){const o=this.options.selectionWidth;typeof o=="function"?s.width=o(s.width):typeof o=="number"&&(s.width+=o),s.width=Math.max(s.width,.3/this.body.view.scale),s.color=this.options.color.highlight,s.shadow=this.options.shadow.enabled}else if(this.hover){const o=this.options.hoverWidth;typeof o=="function"?s.width=o(s.width):typeof o=="number"&&(s.width+=o),s.width=Math.max(s.width,.3/this.body.view.scale),s.color=this.options.color.hover,s.shadow=this.options.shadow.enabled}}else typeof this.chooser=="function"&&(this.chooser(s,this.options.id,this.selected,this.hover),s.color!==void 0&&(s.inheritsColor=!1),s.shadow===!1&&(s.shadowColor!==this.options.shadow.color||s.shadowSize!==this.options.shadow.size||s.shadowX!==this.options.shadow.x||s.shadowY!==this.options.shadow.y)&&(s.shadow=!0));else s.shadow=this.options.shadow.enabled,s.width=Math.max(s.width,.3/this.body.view.scale);return s}updateLabelModule(e){const t=[e,this.options,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,t),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}updateEdgeType(){const e=this.options.smooth;let t=!1,i=!0;return this.edgeType!==void 0&&((this.edgeType instanceof G2&&e.enabled===!0&&e.type==="dynamic"||this.edgeType instanceof X2&&e.enabled===!0&&e.type==="cubicBezier"||this.edgeType instanceof Y2&&e.enabled===!0&&e.type!=="dynamic"&&e.type!=="cubicBezier"||this.edgeType instanceof J2&&e.type.enabled===!1)&&(i=!1),i===!0&&(t=this.cleanup())),i===!0?e.enabled===!0?e.type==="dynamic"?(t=!0,this.edgeType=new G2(this.options,this.body,this.labelModule)):e.type==="cubicBezier"?this.edgeType=new X2(this.options,this.body,this.labelModule):this.edgeType=new Y2(this.options,this.body,this.labelModule):this.edgeType=new J2(this.options,this.body,this.labelModule):this.edgeType.setOptions(this.options),t}connect(){this.disconnect(),this.from=this.body.nodes[this.fromId]||void 0,this.to=this.body.nodes[this.toId]||void 0,this.connected=this.from!==void 0&&this.to!==void 0,this.connected===!0?(this.from.attachEdge(this),this.to.attachEdge(this)):(this.from&&this.from.detachEdge(this),this.to&&this.to.detachEdge(this)),this.edgeType.connect()}disconnect(){this.from&&(this.from.detachEdge(this),this.from=void 0),this.to&&(this.to.detachEdge(this),this.to=void 0),this.connected=!1}getTitle(){return this.title}isSelected(){return this.selected}getValue(){return this.options.value}setValueRange(e,t,i){if(this.options.value!==void 0){const n=this.options.scaling.customScalingFunction(e,t,i,this.options.value),s=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){const o=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+n*o}this.options.width=this.options.scaling.min+n*s}else this.options.width=this.baseWidth,this.options.font.size=this.baseFontSize;this._setInteractionWidths(),this.updateLabelModule()}_setInteractionWidths(){typeof this.options.hoverWidth=="function"?this.edgeType.hoverWidth=this.options.hoverWidth(this.options.width):this.edgeType.hoverWidth=this.options.hoverWidth+this.options.width,typeof this.options.selectionWidth=="function"?this.edgeType.selectionWidth=this.options.selectionWidth(this.options.width):this.edgeType.selectionWidth=this.options.selectionWidth+this.options.width}draw(e){const t=this.getFormattingValues();if(t.hidden)return;const i=this.edgeType.getViaNode();this.edgeType.drawLine(e,t,this.selected,this.hover,i),this.drawLabel(e,i)}drawArrows(e){const t=this.getFormattingValues();if(t.hidden)return;const i=this.edgeType.getViaNode(),n={};this.edgeType.fromPoint=this.edgeType.from,this.edgeType.toPoint=this.edgeType.to,t.fromArrow&&(n.from=this.edgeType.getArrowData(e,"from",i,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.fromPoint=n.from.core),t.fromArrowSrc&&(n.from.image=this.imagelist.load(t.fromArrowSrc)),t.fromArrowImageWidth&&(n.from.imageWidth=t.fromArrowImageWidth),t.fromArrowImageHeight&&(n.from.imageHeight=t.fromArrowImageHeight)),t.toArrow&&(n.to=this.edgeType.getArrowData(e,"to",i,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.toPoint=n.to.core),t.toArrowSrc&&(n.to.image=this.imagelist.load(t.toArrowSrc)),t.toArrowImageWidth&&(n.to.imageWidth=t.toArrowImageWidth),t.toArrowImageHeight&&(n.to.imageHeight=t.toArrowImageHeight)),t.middleArrow&&(n.middle=this.edgeType.getArrowData(e,"middle",i,this.selected,this.hover,t),t.middleArrowSrc&&(n.middle.image=this.imagelist.load(t.middleArrowSrc)),t.middleArrowImageWidth&&(n.middle.imageWidth=t.middleArrowImageWidth),t.middleArrowImageHeight&&(n.middle.imageHeight=t.middleArrowImageHeight)),t.fromArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,n.from),t.middleArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,n.middle),t.toArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,n.to)}drawLabel(e,t){if(this.options.label!==void 0){const i=this.from,n=this.to;this.labelModule.differentState(this.selected,this.hover)&&this.labelModule.getTextSize(e,this.selected,this.hover);let s;if(i.id!=n.id){this.labelModule.pointToSelf=!1,s=this.edgeType.getPoint(.5,t),e.save();const o=this._getRotation(e);o.angle!=0&&(e.translate(o.x,o.y),e.rotate(o.angle)),this.labelModule.draw(e,s.x,s.y,this.selected,this.hover),e.restore()}else{this.labelModule.pointToSelf=!0;const o=x5(e,this.options.selfReference.angle,this.options.selfReference.size,i);s=this._pointOnCircle(o.x,o.y,this.options.selfReference.size,this.options.selfReference.angle),this.labelModule.draw(e,s.x,s.y,this.selected,this.hover)}}}getItemsOnPoint(e){const t=[];if(this.labelModule.visible()){const n=this._getRotation();Y_(this.labelModule.getSize(),e,n)&&t.push({edgeId:this.id,labelId:0})}const i={left:e.x,top:e.y};return this.isOverlappingWith(i)&&t.push({edgeId:this.id}),t}isOverlappingWith(e){if(this.connected){const i=this.from.x,n=this.from.y,s=this.to.x,o=this.to.y,a=e.left,u=e.top;return this.edgeType.getDistanceToEdge(i,n,s,o,a,u)<10}else return!1}_getRotation(e){const t=this.edgeType.getViaNode(),i=this.edgeType.getPoint(.5,t);e!==void 0&&this.labelModule.calculateLabelSize(e,this.selected,this.hover,i.x,i.y);const n={x:i.x,y:this.labelModule.size.yLine,angle:0};if(!this.labelModule.visible()||this.options.font.align==="horizontal")return n;const s=this.from.y-this.to.y,o=this.from.x-this.to.x;let a=Math.atan2(s,o);return(a<-1&&o<0||a>0&&o<0)&&(a+=Math.PI),n.angle=a,n}_pointOnCircle(e,t,i,n){return{x:e+i*Math.cos(n),y:t-i*Math.sin(n)}}select(){this.selected=!0}unselect(){this.selected=!1}cleanup(){return this.edgeType.cleanup()}remove(){this.cleanup(),this.disconnect(),delete this.body.edges[this.id]}endPointsValid(){return this.body.nodes[this.fromId]!==void 0&&this.body.nodes[this.toId]!==void 0}}class bre{constructor(e,t,i){var n;this.body=e,this.images=t,this.groups=i,this.body.functions.createEdge=z(n=this.create).call(n,this),this.edgesListeners={add:(s,o)=>{this.add(o.items)},update:(s,o)=>{this.update(o.items)},remove:(s,o)=>{this.remove(o.items)}},this.options={},this.defaultOptions={arrows:{to:{enabled:!1,scaleFactor:1,type:"arrow"},middle:{enabled:!1,scaleFactor:1,type:"arrow"},from:{enabled:!1,scaleFactor:1,type:"arrow"}},endPointOffset:{from:0,to:0},arrowStrikethrough:!0,color:{color:"#848484",highlight:"#848484",hover:"#848484",inherit:"from",opacity:1},dashes:!1,font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:2,strokeColor:"#ffffff",align:"horizontal",multi:!1,vadjust:0,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"courier new",vadjust:2}},hidden:!1,hoverWidth:1.5,label:void 0,labelHighlightBold:!0,length:void 0,physics:!0,scaling:{min:1,max:15,label:{enabled:!0,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(s,o,a,u){if(o===s)return .5;{const l=1/(o-s);return Math.max(0,(u-s)*l)}}},selectionWidth:1.5,selfReference:{size:20,angle:Math.PI/4,renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},background:{enabled:!1,color:"rgba(111,111,111,1)",size:10,dashes:!1},smooth:{enabled:!0,type:"dynamic",forceDirection:"none",roundness:.5},title:void 0,width:1,value:void 0},Ue(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e=this,t,i;this.body.emitter.on("_forceDisableDynamicCurves",function(n){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;n==="dynamic"&&(n="continuous");let o=!1;for(const a in e.body.edges)if(Object.prototype.hasOwnProperty.call(e.body.edges,a)){const u=e.body.edges[a],l=e.body.data.edges.get(a);if(l!=null){const c=l.smooth;c!==void 0&&c.enabled===!0&&c.type==="dynamic"&&(n===void 0?u.setOptions({smooth:!1}):u.setOptions({smooth:{type:n}}),o=!0)}}s===!0&&o===!0&&e.body.emitter.emit("_dataChanged")}),this.body.emitter.on("_dataUpdated",()=>{this.reconnectEdges()}),this.body.emitter.on("refreshEdges",z(t=this.refresh).call(t,this)),this.body.emitter.on("refresh",z(i=this.refresh).call(i,this)),this.body.emitter.on("destroy",()=>{Oe(this.edgesListeners,(n,s)=>{this.body.data.edges&&this.body.data.edges.off(s,n)}),delete this.body.functions.createEdge,delete this.edgesListeners.add,delete this.edgesListeners.update,delete this.edgesListeners.remove,delete this.edgesListeners})}setOptions(e){if(e!==void 0){Pi.parseOptions(this.options,e,!0,this.defaultOptions,!0);let t=!1;if(e.smooth!==void 0)for(const i in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,i)&&(t=this.body.edges[i].updateEdgeType()||t);if(e.font!==void 0)for(const i in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,i)&&this.body.edges[i].updateLabelModule();(e.hidden!==void 0||e.physics!==void 0||t===!0)&&this.body.emitter.emit("_dataChanged")}}setData(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.body.data.edges;if(l3("id",e))this.body.data.edges=e;else if(et(e))this.body.data.edges=new nu,this.body.data.edges.add(e);else if(!e)this.body.data.edges=new nu;else throw new TypeError("Array or DataSet expected");if(i&&Oe(this.edgesListeners,(n,s)=>{i.off(s,n)}),this.body.edges={},this.body.data.edges){Oe(this.edgesListeners,(s,o)=>{this.body.data.edges.on(o,s)});const n=this.body.data.edges.getIds();this.add(n,!0)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),t===!1&&this.body.emitter.emit("_dataChanged")}add(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.body.edges,n=this.body.data.edges;for(let s=0;s1&&arguments[1]!==void 0?arguments[1]:!0;if(e.length===0)return;const i=this.body.edges;Oe(e,n=>{const s=i[n];s!==void 0&&s.remove()}),t&&this.body.emitter.emit("_dataChanged")}refresh(){Oe(this.body.edges,(e,t)=>{const i=this.body.data.edges.get(t);i!==void 0&&e.setOptions(i)})}create(e){return new Pi(e,this.body,this.images,this.options,this.defaultOptions)}reconnectEdges(){let e;const t=this.body.nodes,i=this.body.edges;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e].edges=[]);for(e in i)if(Object.prototype.hasOwnProperty.call(i,e)){const n=i[e];n.from=null,n.to=null,n.connect()}}getConnectedNodes(e){const t=[];if(this.body.edges[e]!==void 0){const i=this.body.edges[e];i.fromId!==void 0&&t.push(i.fromId),i.toId!==void 0&&t.push(i.toId)}return t}_updateState(){this._addMissingEdges(),this._removeInvalidEdges()}_removeInvalidEdges(){const e=[];Oe(this.body.edges,(t,i)=>{const n=this.body.nodes[t.toId],s=this.body.nodes[t.fromId];n!==void 0&&n.isCluster===!0||s!==void 0&&s.isCluster===!0||(n===void 0||s===void 0)&&e.push(i)}),this.remove(e,!1)}_addMissingEdges(){const e=this.body.data.edges;if(e==null)return;const t=this.body.edges,i=[];Le(e).call(e,(n,s)=>{t[s]===void 0&&i.push(s)}),this.add(i,!0)}}class M5{constructor(e,t,i){this.body=e,this.physicsBody=t,this.barnesHutTree,this.setOptions(i),this._rng=il("BARNES HUT SOLVER")}setOptions(e){this.options=e,this.thetaInversed=1/this.options.theta,this.overlapAvoidanceFactor=1-Math.max(0,Math.min(1,this.options.avoidOverlap))}solve(){if(this.options.gravitationalConstant!==0&&this.physicsBody.physicsNodeIndices.length>0){let e;const t=this.body.nodes,i=this.physicsBody.physicsNodeIndices,n=i.length,s=this._formBarnesHutTree(t,i);this.barnesHutTree=s;for(let o=0;o0&&this._getForceContributions(s.root,e)}}_getForceContributions(e,t){this._getForceContribution(e.children.NW,t),this._getForceContribution(e.children.NE,t),this._getForceContribution(e.children.SW,t),this._getForceContribution(e.children.SE,t)}_getForceContribution(e,t){if(e.childrenCount>0){const i=e.centerOfMass.x-t.x,n=e.centerOfMass.y-t.y,s=Math.sqrt(i*i+n*n);s*e.calcSize>this.thetaInversed?this._calculateForces(s,i,n,t,e):e.childrenCount===4?this._getForceContributions(e,t):e.children.data.id!=t.id&&this._calculateForces(s,i,n,t,e)}}_calculateForces(e,t,i,n,s){e===0&&(e=.1,t=e),this.overlapAvoidanceFactor<1&&n.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*n.shape.radius,e-n.shape.radius));const o=this.options.gravitationalConstant*s.mass*n.options.mass/Math.pow(e,3),a=t*o,u=i*o;this.physicsBody.forces[n.id].x+=a,this.physicsBody.forces[n.id].y+=u}_formBarnesHutTree(e,t){let i;const n=t.length;let s=e[t[0]].x,o=e[t[0]].y,a=e[t[0]].x,u=e[t[0]].y;for(let b=1;b0&&(ga&&(a=g),wu&&(u=w))}const l=Math.abs(a-s)-Math.abs(u-o);l>0?(o-=.5*l,u+=.5*l):(s+=.5*l,a-=.5*l);const d=Math.max(1e-5,Math.abs(a-s)),h=.5*d,f=.5*(s+a),p=.5*(o+u),v={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:f-h,maxX:f+h,minY:p-h,maxY:p+h},size:d,calcSize:1/d,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(v.root);for(let b=0;b0&&this._placeInTree(v.root,i);return v}_updateBranchMass(e,t){const i=e.centerOfMass,n=e.mass+t.options.mass,s=1/n;i.x=i.x*e.mass+t.x*t.options.mass,i.x*=s,i.y=i.y*e.mass+t.y*t.options.mass,i.y*=s,e.mass=n;const o=Math.max(Math.max(t.height,t.radius),t.width);e.maxWidth=e.maxWidtht.x?n.maxY>t.y?s="NW":s="SW":n.maxY>t.y?s="NE":s="SE",this._placeInRegion(e,t,s)}_placeInRegion(e,t,i){const n=e.children[i];switch(n.childrenCount){case 0:n.children.data=t,n.childrenCount=1,this._updateBranchMass(n,t);break;case 1:n.children.data.x===t.x&&n.children.data.y===t.y?(t.x+=this._rng(),t.y+=this._rng()):(this._splitBranch(n),this._placeInTree(n,t));break;case 4:this._placeInTree(n,t);break}}_splitBranch(e){let t=null;e.childrenCount===1&&(t=e.children.data,e.mass=0,e.centerOfMass.x=0,e.centerOfMass.y=0),e.childrenCount=4,e.children.data=null,this._insertRegion(e,"NW"),this._insertRegion(e,"NE"),this._insertRegion(e,"SW"),this._insertRegion(e,"SE"),t!=null&&this._placeInTree(e,t)}_insertRegion(e,t){let i,n,s,o;const a=.5*e.size;switch(t){case"NW":i=e.range.minX,n=e.range.minX+a,s=e.range.minY,o=e.range.minY+a;break;case"NE":i=e.range.minX+a,n=e.range.maxX,s=e.range.minY,o=e.range.minY+a;break;case"SW":i=e.range.minX,n=e.range.minX+a,s=e.range.minY+a,o=e.range.maxY;break;case"SE":i=e.range.minX+a,n=e.range.maxX,s=e.range.minY+a,o=e.range.maxY;break}e.children[t]={centerOfMass:{x:0,y:0},mass:0,range:{minX:i,maxX:n,minY:s,maxY:o},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}_debug(e,t){this.barnesHutTree!==void 0&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,t))}_drawBranch(e,t,i){i===void 0&&(i="#FF0000"),e.childrenCount===4&&(this._drawBranch(e.children.NW,t),this._drawBranch(e.children.NE,t),this._drawBranch(e.children.SE,t),this._drawBranch(e.children.SW,t)),t.strokeStyle=i,t.beginPath(),t.moveTo(e.range.minX,e.range.minY),t.lineTo(e.range.maxX,e.range.minY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.minY),t.lineTo(e.range.maxX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.maxY),t.lineTo(e.range.minX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.minX,e.range.maxY),t.lineTo(e.range.minX,e.range.minY),t.stroke()}}class _re{constructor(e,t,i){this._rng=il("REPULSION SOLVER"),this.body=e,this.physicsBody=t,this.setOptions(i)}setOptions(e){this.options=e}solve(){let e,t,i,n,s,o,a,u;const l=this.body.nodes,c=this.physicsBody.physicsNodeIndices,d=this.physicsBody.forces,h=this.options.nodeDistance,f=-2/3/h,p=4/3;for(let v=0;v0){const o=s.edges.length+1,a=this.options.centralGravity*o*s.options.mass;n[s.id].x=t*a,n[s.id].y=i*a}}}class Ire{constructor(e){this.body=e,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:"barnesHut",stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0,wind:{x:0,y:0}},ot(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}bindEventListeners(){this.body.emitter.on("initPhysics",()=>{this.initPhysics()}),this.body.emitter.on("_layoutFailed",()=>{this.layoutFailed=!0}),this.body.emitter.on("resetPhysics",()=>{this.stopSimulation(),this.ready=!1}),this.body.emitter.on("disablePhysics",()=>{this.physicsEnabled=!1,this.stopSimulation()}),this.body.emitter.on("restorePhysics",()=>{this.setOptions(this.options),this.ready===!0&&this.startSimulation()}),this.body.emitter.on("startSimulation",()=>{this.ready===!0&&this.startSimulation()}),this.body.emitter.on("stopSimulation",()=>{this.stopSimulation()}),this.body.emitter.on("destroy",()=>{this.stopSimulation(!1),this.body.emitter.off()}),this.body.emitter.on("_dataChanged",()=>{this.updatePhysicsData()})}setOptions(e){if(e!==void 0)if(e===!1)this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation();else if(e===!0)this.options.enabled=!0,this.physicsEnabled=!0,this.startSimulation();else{this.physicsEnabled=!0,lu(["stabilization"],this.options,e),ir(this.options,e,"stabilization"),e.enabled===void 0&&(this.options.enabled=!0),this.options.enabled===!1&&(this.physicsEnabled=!1,this.stopSimulation());const t=this.options.wind;t&&((typeof t.x!="number"||G_(t.x))&&(t.x=0),(typeof t.y!="number"||G_(t.y))&&(t.y=0)),this.timestep=this.options.timestep}this.init()}init(){let e;this.options.solver==="forceAtlas2Based"?(e=this.options.forceAtlas2Based,this.nodesSolver=new Sre(this.body,this.physicsBody,e),this.edgesSolver=new S1(this.body,this.physicsBody,e),this.gravitySolver=new Ore(this.body,this.physicsBody,e)):this.options.solver==="repulsion"?(e=this.options.repulsion,this.nodesSolver=new _re(this.body,this.physicsBody,e),this.edgesSolver=new S1(this.body,this.physicsBody,e),this.gravitySolver=new Va(this.body,this.physicsBody,e)):this.options.solver==="hierarchicalRepulsion"?(e=this.options.hierarchicalRepulsion,this.nodesSolver=new wre(this.body,this.physicsBody,e),this.edgesSolver=new Ere(this.body,this.physicsBody,e),this.gravitySolver=new Va(this.body,this.physicsBody,e)):(e=this.options.barnesHut,this.nodesSolver=new M5(this.body,this.physicsBody,e),this.edgesSolver=new S1(this.body,this.physicsBody,e),this.gravitySolver=new Va(this.body,this.physicsBody,e)),this.modelOptions=e}initPhysics(){this.physicsEnabled===!0&&this.options.enabled===!0?this.options.stabilization.enabled===!0?this.stabilize():(this.stabilized=!1,this.ready=!0,this.body.emitter.emit("fit",{},this.layoutFailed),this.startSimulation()):(this.ready=!0,this.body.emitter.emit("fit"))}startSimulation(){if(this.physicsEnabled===!0&&this.options.enabled===!0){if(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit("_resizeNodes"),this.viewFunction===void 0){var e;this.viewFunction=z(e=this.simulationStep).call(e,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}else this.body.emitter.emit("_redraw")}stopSimulation(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.stabilized=!0,e===!0&&this._emitStabilized(),this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.viewFunction=void 0,e===!0&&this.body.emitter.emit("_stopRendering"))}simulationStep(){const e=su();this.physicsTick(),(su()-e<.4*this.simulationInterval||this.runDoubleSpeed===!0)&&this.stabilized===!1&&(this.physicsTick(),this.runDoubleSpeed=!0),this.stabilized===!0&&this.stopSimulation()}_emitStabilized(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||this.startedStabilization===!0)&&Zr(()=>{this.body.emitter.emit("stabilized",{iterations:e}),this.startedStabilization=!1,this.stabilizationIterations=0},0)}physicsStep(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve(),this.moveNodes()}adjustTimeStep(){this._evaluateStepQuality()===!0?this.timestep=1.2*this.timestep:this.timestep/1.2o))return!1;return!0}moveNodes(){const e=this.physicsBody.physicsNodeIndices;let t=0,i=0;const n=5;for(let s=0;so&&(e=e>0?o:-o),e}_performStep(e){const t=this.body.nodes[e],i=this.physicsBody.forces[e];this.options.wind&&(i.x+=this.options.wind.x,i.y+=this.options.wind.y);const n=this.physicsBody.velocities[e];return this.previousStates[e]={x:t.x,y:t.y,vx:n.x,vy:n.y},t.options.fixed.x===!1?(n.x=this.calculateComponentVelocity(n.x,i.x,t.options.mass),t.x+=n.x*this.timestep):(i.x=0,n.x=0),t.options.fixed.y===!1?(n.y=this.calculateComponentVelocity(n.y,i.y,t.options.mass),t.y+=n.y*this.timestep):(i.y=0,n.y=0),Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2))}_freezeNodes(){const e=this.body.nodes;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t].x&&e[t].y){const i=e[t].options.fixed;this.freezeCache[t]={x:i.x,y:i.y},i.x=!0,i.y=!0}}_restoreFrozenNodes(){const e=this.body.nodes;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.freezeCache[t]!==void 0&&(e[t].options.fixed.x=this.freezeCache[t].x,e[t].options.fixed.y=this.freezeCache[t].y);this.freezeCache={}}stabilize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.stabilization.iterations;if(typeof e!="number"&&(e=this.options.stabilization.iterations,console.error("The stabilize method needs a numeric amount of iterations. Switching to default: ",e)),this.physicsBody.physicsNodeIndices.length===0){this.ready=!0;return}this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit("_resizeNodes"),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit("_blockRedraw"),this.targetIterations=e,this.options.stabilization.onlyDynamicEdges===!0&&this._freezeNodes(),this.stabilizationIterations=0,Zr(()=>this._stabilizationBatch(),0)}_startStabilizing(){return this.startedStabilization===!0?!1:(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0,!0)}_stabilizationBatch(){const e=()=>this.stabilized===!1&&this.stabilizationIterations{this.body.emitter.emit("stabilizationProgress",{iterations:this.stabilizationIterations,total:this.targetIterations})};this._startStabilizing()&&t();let i=0;for(;e()&&i"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");O1=crypto.getRandomValues.bind(crypto)}return O1($re)}const Rre=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var Q2={randomUUID:Rre};function Cre(r,e,t){var n;r=r||{};const i=r.random??((n=r.rng)==null?void 0:n.call(r))??Pre();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Tre(i)}function _o(r,e,t){return Q2.randomUUID?Q2.randomUUID():Cre(r)}class kt{constructor(){}static getRange(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=1e9,n=-1e9,s=1e9,o=-1e9,a;if(t.length>0)for(let u=0;ua.shape.boundingBox.left&&(s=a.shape.boundingBox.left),oa.shape.boundingBox.top&&(i=a.shape.boundingBox.top),n1&&arguments[1]!==void 0?arguments[1]:[],i=1e9,n=-1e9,s=1e9,o=-1e9,a;if(t.length>0)for(let u=0;ua.x&&(s=a.x),oa.y&&(i=a.y),n{delete this.containedEdges[i.id]}),Oe(t.containedNodes,(i,n)=>{this.containedNodes[n]=i}),t.containedNodes={},Oe(t.containedEdges,(i,n)=>{this.containedEdges[n]=i}),t.containedEdges={},Oe(t.edges,i=>{Oe(this.edges,n=>{var s,o;const a=Fe(s=n.clusteringEdgeReplacingIds).call(s,i.id);a!==-1&&(Oe(i.clusteringEdgeReplacingIds,u=>{n.clusteringEdgeReplacingIds.push(u),this.body.edges[u].edgeReplacedById=n.id}),Qr(o=n.clusteringEdgeReplacingIds).call(o,a,1))})}),t.edges=[]}}class qre{constructor(e){this.body=e,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},ot(this.options,this.defaultOptions),this.body.emitter.on("_resetData",()=>{this.clusteredNodes={},this.clusteredEdges={}})}clusterByHubsize(e,t){e===void 0?e=this._getHubSize():typeof e=="object"&&(t=this._checkOptions(e),e=this._getHubSize());const i=[];for(let n=0;n=e&&i.push(s.id)}for(let n=0;n0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.joinCondition===void 0)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");e=this._checkOptions(e);const i={},n={};Oe(this.body.nodes,(s,o)=>{s.options&&e.joinCondition(s.options)===!0&&(i[o]=s,Oe(s.edges,a=>{this.clusteredEdges[a.id]===void 0&&(n[a.id]=a)}))}),this._cluster(i,n,e,t)}clusterByEdgeCount(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;t=this._checkOptions(t);const n=[],s={};let o,a,u;for(let l=0;l0&&Ze(d).length>0&&v===!0){const m=function(){for(let g=0;g1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(1,e,t)}clusterBridges(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(2,e,t)}clusterByConnection(e,t){var i;let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No nodeId supplied to clusterByConnection!");if(this.body.nodes[e]===void 0)throw new Error("The nodeId given to clusterByConnection does not exist!");const s=this.body.nodes[e];t=this._checkOptions(t,s),t.clusterNodeProperties.x===void 0&&(t.clusterNodeProperties.x=s.x),t.clusterNodeProperties.y===void 0&&(t.clusterNodeProperties.y=s.y),t.clusterNodeProperties.fixed===void 0&&(t.clusterNodeProperties.fixed={},t.clusterNodeProperties.fixed.x=s.options.fixed.x,t.clusterNodeProperties.fixed.y=s.options.fixed.y);const o={},a={},u=s.id,l=kt.cloneOptions(s);o[u]=s;for(let d=0;d-1&&(a[p.id]=p)}}this._cluster(o,a,t,n)}_createClusterEdges(e,t,i,n){let s,o,a,u,l,c;const d=Ze(e),h=[];for(let v=0;v0&&arguments[0]!==void 0?arguments[0]:{};return e.clusterEdgeProperties===void 0&&(e.clusterEdgeProperties={}),e.clusterNodeProperties===void 0&&(e.clusterNodeProperties={}),e}_cluster(e,t,i){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;const s=[];for(const c in e)Object.prototype.hasOwnProperty.call(e,c)&&this.clusteredNodes[c]!==void 0&&s.push(c);for(let c=0;cn?a.x:n,s=a.yo?a.y:o;return{x:.5*(i+n),y:.5*(s+o)}}openCluster(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw new Error("No clusterNodeId supplied to openCluster.");const n=this.body.nodes[e];if(n===void 0)throw new Error("The clusterNodeId supplied to openCluster does not exist.");if(n.isCluster!==!0||n.containedNodes===void 0||n.containedEdges===void 0)throw new Error("The node:"+e+" is not a valid cluster.");const s=this.findNode(e),o=Fe(s).call(s,e)-1;if(o>=0){const c=s[o];this.body.nodes[c]._openChildCluster(e),delete this.body.nodes[e],i===!0&&this.body.emitter.emit("_dataChanged");return}const a=n.containedNodes,u=n.containedEdges;if(t!==void 0&&t.releaseFunction!==void 0&&typeof t.releaseFunction=="function"){const c={},d={x:n.x,y:n.y};for(const f in a)if(Object.prototype.hasOwnProperty.call(a,f)){const p=this.body.nodes[f];c[f]={x:p.x,y:p.y}}const h=t.releaseFunction(d,c);for(const f in a)if(Object.prototype.hasOwnProperty.call(a,f)){const p=this.body.nodes[f];h[f]!==void 0&&(p.x=h[f].x===void 0?n.x:h[f].x,p.y=h[f].y===void 0?n.y:h[f].y)}}else Oe(a,function(c){c.options.fixed.x===!1&&(c.x=n.x),c.options.fixed.y===!1&&(c.y=n.y)});for(const c in a)if(Object.prototype.hasOwnProperty.call(a,c)){const d=this.body.nodes[c];d.vx=n.vx,d.vy=n.vy,d.setOptions({physics:!0}),delete this.clusteredNodes[c]}const l=[];for(let c=0;c0&&on&&(n=l.edges.length),e+=l.edges.length,t+=Math.pow(l.edges.length,2),i+=1}e=e/i,t=t/i;const s=t-Math.pow(e,2),o=Math.sqrt(s);let a=Math.floor(e+2*o);return a>n&&(a=n),a}_createClusteredEdge(e,t,i,n,s){const o=kt.cloneOptions(i,"edge");Ue(o,n),o.from=e,o.to=t,o.id="clusterEdge:"+_o(),s!==void 0&&Ue(o,s);const a=this.body.functions.createEdge(o);return a.clusteringEdgeReplacingIds=[i.id],a.connect(),this.body.edges[a.id]=a,a}_clusterEdges(e,t,i,n){if(t instanceof Pi){const s=t,o={};o[s.id]=s,t=o}if(e instanceof Ke){const s=e,o={};o[s.id]=s,e=o}if(i==null)throw new Error("_clusterEdges: parameter clusterNode required");n===void 0&&(n=i.clusterEdgeProperties),this._createClusterEdges(e,t,i,n);for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&this.body.edges[s]!==void 0){const o=this.body.edges[s];this._backupEdgeOptions(o),o.setOptions({physics:!1})}for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(this.clusteredNodes[s]={clusterId:i.id,node:this.body.nodes[s]},this.body.nodes[s].setOptions({physics:!1}))}_getClusterNodeForNode(e){if(e===void 0)return;const t=this.clusteredNodes[e];if(t===void 0)return;const i=t.clusterId;if(i!==void 0)return this.body.nodes[i]}_filter(e,t){const i=[];return Oe(e,n=>{t(n)&&i.push(n)}),i}_updateState(){let e;const t=[],i={},n=u=>{Oe(this.body.nodes,l=>{l.isCluster===!0&&u(l)})};for(e in this.clusteredNodes){if(!Object.prototype.hasOwnProperty.call(this.clusteredNodes,e))continue;this.body.nodes[e]===void 0&&t.push(e)}n(function(u){for(let l=0;l{const l=this.body.edges[u];(l===void 0||!l.endPointsValid())&&(i[u]=u)}),n(function(u){Oe(u.containedEdges,(l,c)=>{!l.endPointsValid()&&!i[c]&&(i[c]=c)})}),Oe(this.body.edges,(u,l)=>{let c=!0;const d=u.clusteringEdgeReplacingIds;if(d!==void 0){let h=0;Oe(d,f=>{const p=this.body.edges[f];p!==void 0&&p.endPointsValid()&&(h+=1)}),c=h>0}(!u.endPointsValid()||!c)&&(i[l]=l)}),n(u=>{Oe(i,l=>{delete u.containedEdges[l],Oe(u.edges,(c,d)=>{if(c.id===l){u.edges[d]=null;return}c.clusteringEdgeReplacingIds=this._filter(c.clusteringEdgeReplacingIds,function(h){return!i[h]})}),u.edges=this._filter(u.edges,function(c){return c!==null})})}),Oe(i,u=>{delete this.clusteredEdges[u]}),Oe(i,u=>{delete this.body.edges[u]});const s=Ze(this.body.edges);Oe(s,u=>{const l=this.body.edges[u],c=this._isClusteredNode(l.fromId)||this._isClusteredNode(l.toId);if(c!==this._isClusteredEdge(l.id))if(c){const d=this._getClusterNodeForNode(l.fromId);d!==void 0&&this._clusterEdges(this.body.nodes[l.fromId],l,d);const h=this._getClusterNodeForNode(l.toId);h!==void 0&&this._clusterEdges(this.body.nodes[l.toId],l,h)}else delete this._clusterEdges[u],this._restoreEdge(l)});let o=!1,a=!0;for(;a;){const u=[];n(function(l){const c=Ze(l.containedNodes).length,d=l.options.allowSingleNodeCluster===!0;(d&&c<1||!d&&c<2)&&u.push(l.id)});for(let l=0;l0,o=o||a}o&&this._updateState()}_isClusteredNode(e){return this.clusteredNodes[e]!==void 0}_isClusteredEdge(e){return this.clusteredEdges[e]!==void 0}}class Dre{constructor(e,t){this.body=e,this.canvas=t,this.redrawRequested=!1,this.requestAnimationFrameRequestId=void 0,this.renderingActive=!1,this.renderRequests=0,this.allowRedraw=!0,this.dragging=!1,this.zooming=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1},ot(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e;this.body.emitter.on("dragStart",()=>{this.dragging=!0}),this.body.emitter.on("dragEnd",()=>{this.dragging=!1}),this.body.emitter.on("zoom",()=>{this.zooming=!0,window.clearTimeout(this.zoomTimeoutId),this.zoomTimeoutId=Zr(()=>{var t;this.zooming=!1,z(t=this._requestRedraw).call(t,this)()},250)}),this.body.emitter.on("_resizeNodes",()=>{this._resizeNodes()}),this.body.emitter.on("_redraw",()=>{this.renderingActive===!1&&this._redraw()}),this.body.emitter.on("_blockRedraw",()=>{this.allowRedraw=!1}),this.body.emitter.on("_allowRedraw",()=>{this.allowRedraw=!0,this.redrawRequested=!1}),this.body.emitter.on("_requestRedraw",z(e=this._requestRedraw).call(e,this)),this.body.emitter.on("_startRendering",()=>{this.renderRequests+=1,this.renderingActive=!0,this._startRendering()}),this.body.emitter.on("_stopRendering",()=>{this.renderRequests-=1,this.renderingActive=this.renderRequests>0,this.requestAnimationFrameRequestId=void 0}),this.body.emitter.on("destroy",()=>{this.renderRequests=0,this.allowRedraw=!1,this.renderingActive=!1,window.cancelAnimationFrame(this.requestAnimationFrameRequestId),this.body.emitter.off()})}setOptions(e){e!==void 0&&Gs(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag"],this.options,e)}_startRendering(){if(this.renderingActive===!0&&this.requestAnimationFrameRequestId===void 0){var e;this.requestAnimationFrameRequestId=window.requestAnimationFrame(z(e=this._renderStep).call(e,this),this.simulationInterval)}}_renderStep(){this.renderingActive===!0&&(this.requestAnimationFrameRequestId=void 0,this._startRendering(),this._redraw())}redraw(){this.body.emitter.emit("setSize"),this._redraw()}_requestRedraw(){this.redrawRequested!==!0&&this.renderingActive===!1&&this.allowRedraw===!0&&(this.redrawRequested=!0,window.requestAnimationFrame(()=>{this._redraw(!1)}))}_redraw(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(this.allowRedraw===!0){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1;const t={drawExternalLabels:null};(this.canvas.frame.canvas.width===0||this.canvas.frame.canvas.height===0)&&this.canvas.setSize(),this.canvas.setTransform();const i=this.canvas.getContext(),n=this.canvas.frame.canvas.clientWidth,s=this.canvas.frame.canvas.clientHeight;if(i.clearRect(0,0,n,s),this.canvas.frame.clientWidth===0)return;if(i.save(),i.translate(this.body.view.translation.x,this.body.view.translation.y),i.scale(this.body.view.scale,this.body.view.scale),i.beginPath(),this.body.emitter.emit("beforeDrawing",i),i.closePath(),e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawEdges(i),this.dragging===!1||this.dragging===!0&&this.options.hideNodesOnDrag===!1){const{drawExternalLabels:o}=this._drawNodes(i,e);t.drawExternalLabels=o}e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawArrows(i),t.drawExternalLabels!=null&&t.drawExternalLabels(),e===!1&&this._drawSelectionBox(i),i.beginPath(),this.body.emitter.emit("afterDrawing",i),i.closePath(),i.restore(),e===!0&&i.clearRect(0,0,n,s)}}_resizeNodes(){this.canvas.setTransform();const e=this.canvas.getContext();e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale);const t=this.body.nodes;let i;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i=t[n],i.resize(e),i.updateBoundingBox(e,i.selected));e.restore()}_drawNodes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.body.nodes,n=this.body.nodeIndices;let s;const o=[],a=[],u=20,l=this.canvas.DOMtoCanvas({x:-20,y:-20}),c=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+u,y:this.canvas.frame.canvas.clientHeight+u}),d={top:l.y,left:l.x,bottom:c.y,right:c.x},h=[];for(let b=0;b{for(const b of h)b()}}}_drawEdges(e){const t=this.body.edges,i=this.body.edgeIndices;for(let n=0;n{t.width!==0&&(this.body.view.translation.x=t.width*.5),t.height!==0&&(this.body.view.translation.y=t.height*.5)}),this.body.emitter.on("setSize",z(e=this.setSize).call(e,this)),this.body.emitter.on("destroy",()=>{this.hammerFrame.destroy(),this.hammer.destroy(),this._cleanUp()})}setOptions(e){if(e!==void 0&&Gs(["width","height","autoResize"],this.options,e),this._cleanUp(),this.options.autoResize===!0){var t;if(window.ResizeObserver){const n=new ResizeObserver(()=>{this.setSize()===!0&&this.body.emitter.emit("_requestRedraw")}),{frame:s}=this;n.observe(s),this._cleanupCallbacks.push(()=>{n.unobserve(s)})}else{const n=Fre(()=>{this.setSize()===!0&&this.body.emitter.emit("_requestRedraw")},1e3);this._cleanupCallbacks.push(()=>{clearInterval(n)})}const i=z(t=this._onResize).call(t,this);window.addEventListener("resize",i),this._cleanupCallbacks.push(()=>{window.removeEventListener("resize",i)})}}_cleanUp(){var e,t,i;Le(e=on(t=Qr(i=this._cleanupCallbacks).call(i,0)).call(t)).call(e,n=>{try{n()}catch(s){console.error(s)}})}_onResize(){this.setSize(),this.body.emitter.emit("_redraw")}_getCameraState(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.pixelRatio;this.initialized===!0&&(this.cameraState.previousWidth=this.frame.canvas.width/e,this.cameraState.previousHeight=this.frame.canvas.height/e,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/e,y:.5*this.frame.canvas.height/e}))}_setCameraState(){if(this.cameraState.scale!==void 0&&this.frame.canvas.clientWidth!==0&&this.frame.canvas.clientHeight!==0&&this.pixelRatio!==0&&this.cameraState.previousWidth>0&&this.cameraState.previousHeight>0){const e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,t=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight;let i=this.cameraState.scale;e!=1&&t!=1?i=this.cameraState.scale*.5*(e+t):e!=1?i=this.cameraState.scale*e:t!=1&&(i=this.cameraState.scale*t),this.body.view.scale=i;const n=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),s={x:n.x-this.cameraState.position.x,y:n.y-this.cameraState.position.y};this.body.view.translation.x+=s.x*this.body.view.scale,this.body.view.translation.y+=s.y*this.body.view.scale}}_prepareValue(e){if(typeof e=="number")return e+"px";if(typeof e=="string"){if(Fe(e).call(e,"%")!==-1||Fe(e).call(e,"px")!==-1)return e;if(Fe(e).call(e,"%")===-1)return e+"px"}throw new Error("Could not use the value supplied for width or height:"+e)}_create(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement("div"),this.frame.className="vis-network",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.tabIndex=0,this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext)this._setPixelRatio(),this.setTransform();else{const e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerText="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(e)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}_bindHammer(){this.hammer!==void 0&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new us(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:us.DIRECTION_ALL}),hu(this.hammer,e=>{this.body.eventListeners.onTouch(e)}),this.hammer.on("tap",e=>{this.body.eventListeners.onTap(e)}),this.hammer.on("doubletap",e=>{this.body.eventListeners.onDoubleTap(e)}),this.hammer.on("press",e=>{this.body.eventListeners.onHold(e)}),this.hammer.on("panstart",e=>{this.body.eventListeners.onDragStart(e)}),this.hammer.on("panmove",e=>{this.body.eventListeners.onDrag(e)}),this.hammer.on("panend",e=>{this.body.eventListeners.onDragEnd(e)}),this.hammer.on("pinch",e=>{this.body.eventListeners.onPinch(e)}),this.frame.canvas.addEventListener("wheel",e=>{this.body.eventListeners.onMouseWheel(e)}),this.frame.canvas.addEventListener("mousemove",e=>{this.body.eventListeners.onMouseMove(e)}),this.frame.canvas.addEventListener("contextmenu",e=>{this.body.eventListeners.onContext(e)}),this.hammerFrame=new us(this.frame),N5(this.hammerFrame,e=>{this.body.eventListeners.onRelease(e)})}setSize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.width,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.height;e=this._prepareValue(e),t=this._prepareValue(t);let i=!1;const n=this.frame.canvas.width,s=this.frame.canvas.height,o=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||t!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=t)this._getCameraState(o),this.frame.style.width=e,this.frame.style.height=t,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=e,this.options.height=t,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},i=!0;else{const a=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),u=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);(this.frame.canvas.width!==a||this.frame.canvas.height!==u)&&this._getCameraState(o),this.frame.canvas.width!==a&&(this.frame.canvas.width=a,i=!0),this.frame.canvas.height!==u&&(this.frame.canvas.height=u,i=!0)}return i===!0&&(this.body.emitter.emit("resize",{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(n/this.pixelRatio),oldHeight:Math.round(s/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,i}getContext(){return this.frame.canvas.getContext("2d")}_determinePixelRatio(){const e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");let t=1;typeof window<"u"&&(t=window.devicePixelRatio||1);const i=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return t/i}_setPixelRatio(){this.pixelRatio=this._determinePixelRatio()}setTransform(){const e=this.getContext();if(e===void 0)throw new Error("Could not get canvax context");e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}_XconvertDOMtoCanvas(e){return(e-this.body.view.translation.x)/this.body.view.scale}_XconvertCanvasToDOM(e){return e*this.body.view.scale+this.body.view.translation.x}_YconvertDOMtoCanvas(e){return(e-this.body.view.translation.y)/this.body.view.scale}_YconvertCanvasToDOM(e){return e*this.body.view.scale+this.body.view.translation.y}canvasToDOM(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}DOMtoCanvas(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}}function Bre(r,e){const t=ot({nodes:e,minZoomLevel:Number.MIN_VALUE,maxZoomLevel:1},r??{});if(!et(t.nodes))throw new TypeError("Nodes has to be an array of ids.");if(t.nodes.length===0&&(t.nodes=e),!(typeof t.minZoomLevel=="number"&&t.minZoomLevel>0))throw new TypeError("Min zoom level has to be a number higher than zero.");if(!(typeof t.maxZoomLevel=="number"&&t.minZoomLevel<=t.maxZoomLevel))throw new TypeError("Max zoom level has to be a number higher than min zoom level.");return t}class jre{constructor(e,t){var i,n;this.body=e,this.canvas=t,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction="easeInOutQuint",this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on("fit",z(i=this.fit).call(i,this)),this.body.emitter.on("animationFinished",()=>{this.body.emitter.emit("_stopRendering")}),this.body.emitter.on("unlockNode",z(n=this.releaseNode).call(n,this))}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.options=e}fit(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;e=Bre(e,this.body.nodeIndices);const i=this.canvas.frame.canvas.clientWidth,n=this.canvas.frame.canvas.clientHeight;let s,o;if(i===0||n===0)o=1,s=kt.getRange(this.body.nodes,e.nodes);else if(t===!0){let l=0;for(const h in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,h)&&this.body.nodes[h].predefinedPosition===!0&&(l+=1);if(l>.5*this.body.nodeIndices.length){this.fit(e,!1);return}s=kt.getRange(this.body.nodes,e.nodes),o=12.662/(this.body.nodeIndices.length+7.4147)+.0964822;const d=Math.min(i/600,n/600);o*=d}else{this.body.emitter.emit("_resizeNodes"),s=kt.getRange(this.body.nodes,e.nodes);const l=Math.abs(s.maxX-s.minX)*1.1,c=Math.abs(s.maxY-s.minY)*1.1,d=i/l,h=n/c;o=d<=h?d:h}o>e.maxZoomLevel?o=e.maxZoomLevel:o1&&arguments[1]!==void 0?arguments[1]:{};if(this.body.nodes[e]!==void 0){const i={x:this.body.nodes[e].x,y:this.body.nodes[e].y};t.position=i,t.lockedOnNode=e,this.moveTo(t)}else console.error("Node: "+e+" cannot be found.")}moveTo(e){if(e===void 0){e={};return}if(e.offset!=null){if(e.offset.x!=null){if(e.offset.x=+e.offset.x,!tn(e.offset.x))throw new TypeError('The option "offset.x" has to be a finite number.')}else e.offset.x=0;if(e.offset.y!=null){if(e.offset.y=+e.offset.y,!tn(e.offset.y))throw new TypeError('The option "offset.y" has to be a finite number.')}else e.offset.x=0}else e.offset={x:0,y:0};if(e.position!=null){if(e.position.x!=null){if(e.position.x=+e.position.x,!tn(e.position.x))throw new TypeError('The option "position.x" has to be a finite number.')}else e.position.x=0;if(e.position.y!=null){if(e.position.y=+e.position.y,!tn(e.position.y))throw new TypeError('The option "position.y" has to be a finite number.')}else e.position.x=0}else e.position=this.getViewPosition();if(e.scale!=null){if(e.scale=+e.scale,!(e.scale>0))throw new TypeError('The option "scale" has to be a number greater than zero.')}else e.scale=this.body.view.scale;e.animation===void 0&&(e.animation={duration:0}),e.animation===!1&&(e.animation={duration:0}),e.animation===!0&&(e.animation={}),e.animation.duration===void 0&&(e.animation.duration=1e3),e.animation.easingFunction===void 0&&(e.animation.easingFunction="easeInOutQuad"),this.animateView(e)}animateView(e){if(e===void 0)return;this.animationEasingFunction=e.animation.easingFunction,this.releaseNode(),e.locked===!0&&(this.lockedOnNodeId=e.lockedOnNode,this.lockedOnNodeOffset=e.offset),this.easingTime!=0&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=e.scale,this.body.view.scale=this.targetScale;const t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),i={x:t.x-e.position.x,y:t.y-e.position.y};if(this.targetTranslation={x:this.sourceTranslation.x+i.x*this.targetScale+e.offset.x,y:this.sourceTranslation.y+i.y*this.targetScale+e.offset.y},e.animation.duration===0)if(this.lockedOnNodeId!=null){var n;this.viewFunction=z(n=this._lockedRedraw).call(n,this),this.body.emitter.on("initRedraw",this.viewFunction)}else this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit("_requestRedraw");else{var s;this.animationSpeed=1/(60*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=z(s=this._transitionRedraw).call(s,this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering")}}_lockedRedraw(){const e={x:this.body.nodes[this.lockedOnNodeId].x,y:this.body.nodes[this.lockedOnNodeId].y},t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),i={x:t.x-e.x,y:t.y-e.y},n=this.body.view.translation,s={x:n.x+i.x*this.body.view.scale+this.lockedOnNodeOffset.x,y:n.y+i.y*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=s}releaseNode(){this.lockedOnNodeId!==void 0&&this.viewFunction!==void 0&&(this.body.emitter.off("initRedraw",this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}_transitionRedraw(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.easingTime+=this.animationSpeed,this.easingTime=e===!0?1:this.easingTime;const t=GQ[this.animationEasingFunction](this.easingTime);if(this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*t,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*t,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*t},this.easingTime>=1){if(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,this.lockedOnNodeId!=null){var i;this.viewFunction=z(i=this._lockedRedraw).call(i,this),this.body.emitter.on("initRedraw",this.viewFunction)}this.body.emitter.emit("animationFinished")}}getScale(){return this.body.view.scale}getViewPosition(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}}function tB(r){var e=r&&r.preventDefault||!1,t=r&&r.container||window,i={},n={keydown:{},keyup:{}},s={},o;for(o=97;o<=122;o++)s[String.fromCharCode(o)]={code:65+(o-97),shift:!1};for(o=65;o<=90;o++)s[String.fromCharCode(o)]={code:o,shift:!0};for(o=0;o<=9;o++)s[""+o]={code:48+o,shift:!1};for(o=1;o<=12;o++)s["F"+o]={code:111+o,shift:!1};for(o=0;o<=9;o++)s["num"+o]={code:96+o,shift:!1};s["num*"]={code:106,shift:!1},s["num+"]={code:107,shift:!1},s["num-"]={code:109,shift:!1},s["num/"]={code:111,shift:!1},s["num."]={code:110,shift:!1},s.left={code:37,shift:!1},s.up={code:38,shift:!1},s.right={code:39,shift:!1},s.down={code:40,shift:!1},s.space={code:32,shift:!1},s.enter={code:13,shift:!1},s.shift={code:16,shift:void 0},s.esc={code:27,shift:!1},s.backspace={code:8,shift:!1},s.tab={code:9,shift:!1},s.ctrl={code:17,shift:!1},s.alt={code:18,shift:!1},s.delete={code:46,shift:!1},s.pageup={code:33,shift:!1},s.pagedown={code:34,shift:!1},s["="]={code:187,shift:!1},s["-"]={code:189,shift:!1},s["]"]={code:221,shift:!1},s["["]={code:219,shift:!1};var a=function(c){l(c,"keydown")},u=function(c){l(c,"keyup")},l=function(c,d){if(n[d][c.keyCode]!==void 0){for(var h=n[d][c.keyCode],f=0;f{this.activated=!0,this.configureKeyboardBindings()}),this.body.emitter.on("deactivate",()=>{this.activated=!1,this.configureKeyboardBindings()}),this.body.emitter.on("destroy",()=>{this.keycharm!==void 0&&this.keycharm.destroy()}),this.options={}}setOptions(e){e!==void 0&&(this.options=e,this.create())}create(){this.options.navigationButtons===!0?this.iconsCreated===!1&&this.loadNavigationElements():this.iconsCreated===!0&&this.cleanNavigation(),this.configureKeyboardBindings()}cleanNavigation(){if(this.navigationHammers.length!=0){for(let e=0;e{this._stopMovement()}),this.navigationHammers.push(s),this.iconsCreated=!0}bindToRedraw(e){if(this.boundFunctions[e]===void 0){var t;this.boundFunctions[e]=z(t=this[e]).call(t,this),this.body.emitter.on("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_startRendering")}}unbindFromRedraw(e){this.boundFunctions[e]!==void 0&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"),delete this.boundFunctions[e])}_fit(){new Date().valueOf()-this.touchTime>700&&(this.body.emitter.emit("fit",{duration:700}),this.touchTime=new Date().valueOf())}_stopMovement(){for(const e in this.boundFunctions)Object.prototype.hasOwnProperty.call(this.boundFunctions,e)&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"));this.boundFunctions={}}_moveUp(){this.body.view.translation.y+=this.options.keyboard.speed.y}_moveDown(){this.body.view.translation.y-=this.options.keyboard.speed.y}_moveLeft(){this.body.view.translation.x+=this.options.keyboard.speed.x}_moveRight(){this.body.view.translation.x-=this.options.keyboard.speed.x}_zoomIn(){const e=this.body.view.scale,t=this.body.view.scale*(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,n=t/e,s=(1-n)*this.canvas.canvasViewCenter.x+i.x*n,o=(1-n)*this.canvas.canvasViewCenter.y+i.y*n;this.body.view.scale=t,this.body.view.translation={x:s,y:o},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:null})}_zoomOut(){const e=this.body.view.scale,t=this.body.view.scale/(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,n=t/e,s=(1-n)*this.canvas.canvasViewCenter.x+i.x*n,o=(1-n)*this.canvas.canvasViewCenter.y+i.y*n;this.body.view.scale=t,this.body.view.translation={x:s,y:o},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:null})}configureKeyboardBindings(){if(this.keycharm!==void 0&&this.keycharm.destroy(),this.options.keyboard.enabled===!0&&(this.options.keyboard.bindToWindow===!0?this.keycharm=tB({container:window,preventDefault:!0}):this.keycharm=tB({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),this.activated===!0)){var e,t,i,n,s,o,a,u,l,c,d,h,f,p,v,b,m,g,w,y,S,O,I,_;z(e=this.keycharm).call(e,"up",()=>{this.bindToRedraw("_moveUp")},"keydown"),z(t=this.keycharm).call(t,"down",()=>{this.bindToRedraw("_moveDown")},"keydown"),z(i=this.keycharm).call(i,"left",()=>{this.bindToRedraw("_moveLeft")},"keydown"),z(n=this.keycharm).call(n,"right",()=>{this.bindToRedraw("_moveRight")},"keydown"),z(s=this.keycharm).call(s,"=",()=>{this.bindToRedraw("_zoomIn")},"keydown"),z(o=this.keycharm).call(o,"num+",()=>{this.bindToRedraw("_zoomIn")},"keydown"),z(a=this.keycharm).call(a,"num-",()=>{this.bindToRedraw("_zoomOut")},"keydown"),z(u=this.keycharm).call(u,"-",()=>{this.bindToRedraw("_zoomOut")},"keydown"),z(l=this.keycharm).call(l,"[",()=>{this.bindToRedraw("_zoomOut")},"keydown"),z(c=this.keycharm).call(c,"]",()=>{this.bindToRedraw("_zoomIn")},"keydown"),z(d=this.keycharm).call(d,"pageup",()=>{this.bindToRedraw("_zoomIn")},"keydown"),z(h=this.keycharm).call(h,"pagedown",()=>{this.bindToRedraw("_zoomOut")},"keydown"),z(f=this.keycharm).call(f,"up",()=>{this.unbindFromRedraw("_moveUp")},"keyup"),z(p=this.keycharm).call(p,"down",()=>{this.unbindFromRedraw("_moveDown")},"keyup"),z(v=this.keycharm).call(v,"left",()=>{this.unbindFromRedraw("_moveLeft")},"keyup"),z(b=this.keycharm).call(b,"right",()=>{this.unbindFromRedraw("_moveRight")},"keyup"),z(m=this.keycharm).call(m,"=",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),z(g=this.keycharm).call(g,"num+",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),z(w=this.keycharm).call(w,"num-",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),z(y=this.keycharm).call(y,"-",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),z(S=this.keycharm).call(S,"[",()=>{this.unbindFromRedraw("_zoomOut")},"keyup"),z(O=this.keycharm).call(O,"]",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),z(I=this.keycharm).call(I,"pageup",()=>{this.unbindFromRedraw("_zoomIn")},"keyup"),z(_=this.keycharm).call(_,"pagedown",()=>{this.unbindFromRedraw("_zoomOut")},"keyup")}}}class zre{constructor(e,t,i){var n,s,o,a,u,l,c,d,h,f,p,v,b;this.body=e,this.canvas=t,this.selectionHandler=i,this.navigationHandler=new Lre(e,t),this.body.eventListeners.onTap=z(n=this.onTap).call(n,this),this.body.eventListeners.onTouch=z(s=this.onTouch).call(s,this),this.body.eventListeners.onDoubleTap=z(o=this.onDoubleTap).call(o,this),this.body.eventListeners.onHold=z(a=this.onHold).call(a,this),this.body.eventListeners.onDragStart=z(u=this.onDragStart).call(u,this),this.body.eventListeners.onDrag=z(l=this.onDrag).call(l,this),this.body.eventListeners.onDragEnd=z(c=this.onDragEnd).call(c,this),this.body.eventListeners.onMouseWheel=z(d=this.onMouseWheel).call(d,this),this.body.eventListeners.onPinch=z(h=this.onPinch).call(h,this),this.body.eventListeners.onMouseMove=z(f=this.onMouseMove).call(f,this),this.body.eventListeners.onRelease=z(p=this.onRelease).call(p,this),this.body.eventListeners.onContext=z(v=this.onContext).call(v,this),this.touchTime=0,this.drag={},this.pinch={},this.popup=void 0,this.popupObj=void 0,this.popupTimer=void 0,this.body.functions.getPointer=z(b=this.getPointer).call(b,this),this.options={},this.defaultOptions={dragNodes:!0,dragView:!0,hover:!1,keyboard:{enabled:!1,speed:{x:10,y:10,zoom:.02},bindToWindow:!0,autoFocus:!0},navigationButtons:!1,tooltipDelay:300,zoomView:!0,zoomSpeed:1},ot(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){this.body.emitter.on("destroy",()=>{clearTimeout(this.popupTimer),delete this.body.functions.getPointer})}setOptions(e){e!==void 0&&(lu(["hideEdgesOnDrag","hideEdgesOnZoom","hideNodesOnDrag","keyboard","multiselect","selectable","selectConnectedEdges"],this.options,e),ir(this.options,e,"keyboard"),e.tooltip&&(ot(this.options.tooltip,e.tooltip),e.tooltip.color&&(this.options.tooltip.color=W_(e.tooltip.color)))),this.navigationHandler.setOptions(this.options)}getPointer(e){return{x:e.x-WQ(this.canvas.frame.canvas),y:e.y-UQ(this.canvas.frame.canvas)}}onTouch(e){new Date().valueOf()-this.touchTime>50&&(this.drag.pointer=this.getPointer(e.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=new Date().valueOf())}onTap(e){const t=this.getPointer(e.center),i=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(t,i),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t)}onDoubleTap(e){const t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("doubleClick",e,t)}onHold(e){const t=this.getPointer(e.center),i=this.selectionHandler.options.multiselect;this.checkSelectionChanges(t,i),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent("click",e,t),this.selectionHandler.generateClickEvent("hold",e,t)}onRelease(e){if(new Date().valueOf()-this.touchTime>10){const t=this.getPointer(e.center);this.selectionHandler.generateClickEvent("release",e,t),this.touchTime=new Date().valueOf()}}onContext(e){const t=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler.generateClickEvent("oncontext",e,t)}checkSelectionChanges(e){(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1)===!0?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e)}_determineDifference(e,t){const i=function(n,s){const o=[];for(let a=0;a{const a=o.node;o.xFixed===!1&&(a.x=this.canvas._XconvertDOMtoCanvas(this.canvas._XconvertCanvasToDOM(o.x)+n)),o.yFixed===!1&&(a.y=this.canvas._YconvertDOMtoCanvas(this.canvas._YconvertCanvasToDOM(o.y)+s))}),this.body.emitter.emit("startSimulation")}else{if(e.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent("dragging",e,t,void 0,!0),this.drag.pointer===void 0){this.onDragStart(e);return}this.body.selectionBox.position.end={x:this.canvas._XconvertDOMtoCanvas(t.x),y:this.canvas._YconvertDOMtoCanvas(t.y)},this.body.emitter.emit("_requestRedraw")}if(this.options.dragView===!0&&!e.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent("dragging",e,t,void 0,!0),this.drag.pointer===void 0){this.onDragStart(e);return}const n=t.x-this.drag.pointer.x,s=t.y-this.drag.pointer.y;this.body.view.translation={x:this.drag.translation.x+n,y:this.drag.translation.y+s},this.body.emitter.emit("_requestRedraw")}}}onDragEnd(e){if(this.drag.dragging=!1,this.body.selectionBox.show){var t;this.body.selectionBox.show=!1;const i=this.body.selectionBox.position,n={minX:Math.min(i.start.x,i.end.x),minY:Math.min(i.start.y,i.end.y),maxX:Math.max(i.start.x,i.end.x),maxY:Math.max(i.start.y,i.end.y)},s=Wt(t=this.body.nodeIndices).call(t,a=>{const u=this.body.nodes[a];return u.x>=n.minX&&u.x<=n.maxX&&u.y>=n.minY&&u.y<=n.maxY});Le(s).call(s,a=>this.selectionHandler.selectObject(this.body.nodes[a]));const o=this.getPointer(e.center);this.selectionHandler.commitAndEmit(o,e),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw")}else{const i=this.drag.selection;i&&i.length?(Le(i).call(i,function(n){n.node.options.fixed.x=n.xFixed,n.node.options.fixed.y=n.yFixed}),this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center)),this.body.emitter.emit("startSimulation")):(this.selectionHandler.generateClickEvent("dragEnd",e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit("_requestRedraw"))}}onPinch(e){const t=this.getPointer(e.center);this.drag.pinched=!0,this.pinch.scale===void 0&&(this.pinch.scale=1);const i=this.pinch.scale*e.scale;this.zoom(i,t)}zoom(e,t){if(this.options.zoomView===!0){const i=this.body.view.scale;e<1e-5&&(e=1e-5),e>10&&(e=10);let n;this.drag!==void 0&&this.drag.dragging===!0&&(n=this.canvas.DOMtoCanvas(this.drag.pointer));const s=this.body.view.translation,o=e/i,a=(1-o)*t.x+s.x*o,u=(1-o)*t.y+s.y*o;if(this.body.view.scale=e,this.body.view.translation={x:a,y:u},n!=null){const l=this.canvas.canvasToDOM(n);this.drag.pointer.x=l.x,this.drag.pointer.y=l.y}this.body.emitter.emit("_requestRedraw"),ithis._checkShowPopup(t),this.options.tooltipDelay))),this.options.hover===!0&&this.selectionHandler.hoverObject(e,t)}_checkShowPopup(e){const t=this.canvas._XconvertDOMtoCanvas(e.x),i=this.canvas._YconvertDOMtoCanvas(e.y),n={left:t,top:i,right:t,bottom:i},s=this.popupObj===void 0?void 0:this.popupObj.id;let o=!1,a="node";if(this.popupObj===void 0){const u=this.body.nodeIndices,l=this.body.nodes;let c;const d=[];for(let h=0;h0&&(this.popupObj=l[d[d.length-1]],o=!0)}if(this.popupObj===void 0&&o===!1){const u=this.body.edgeIndices,l=this.body.edges;let c;const d=[];for(let h=0;h0&&(this.popupObj=l[d[d.length-1]],a="edge")}this.popupObj!==void 0?this.popupObj.id!==s&&(this.popup===void 0&&(this.popup=new rZ(this.canvas.frame)),this.popup.popupTargetType=a,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(e.x+3,e.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit("showPopup",this.popupObj.id)):this.popup!==void 0&&(this.popup.hide(),this.body.emitter.emit("hidePopup"))}_checkHidePopup(e){const t=this.selectionHandler._pointerToPositionObject(e);let i=!1;if(this.popup.popupTargetType==="node"){if(this.body.nodes[this.popup.popupTargetId]!==void 0&&(i=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t),i===!0)){const n=this.selectionHandler.getNodeAt(e);i=n===void 0?!1:n.id===this.popup.popupTargetId}}else this.selectionHandler.getNodeAt(e)===void 0&&this.body.edges[this.popup.popupTargetId]!==void 0&&(i=this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));i===!1&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}var rB={},iB={},nB;function Hre(){if(nB)return iB;nB=1;var r=b0(),e=I5();return r("Set",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},e),iB}var sB;function Wre(){return sB||(sB=1,Hre()),rB}var oB={},$1,aB;function Nn(){if(aB)return $1;aB=1;var r=Ns(),e=TypeError;return $1=function(t){if(typeof t=="object"&&"size"in t&&"has"in t&&"add"in t&&"delete"in t&&"keys"in t)return t;throw new e(r(t)+" is not a set")},$1}var P1,uB;function Fn(){if(uB)return P1;uB=1;var r=tr(),e=T5(),t=r("Set"),i=t.prototype;return P1={Set:t,add:e("add",1),has:e("has",1),remove:e("delete",1),proto:i},P1}var R1,lB;function kn(){if(lB)return R1;lB=1;var r=Yt();return R1=function(e,t,i){for(var n=i?e:e.iterator,s=e.next,o,a;!(o=r(s,n)).done;)if(a=t(o.value),a!==void 0)return a},R1}var C1,cB;function Sa(){if(cB)return C1;cB=1;var r=kn();return C1=function(e,t,i){return i?r(e.keys(),t,!0):e.forEach(t)},C1}var x1,dB;function T0(){if(dB)return x1;dB=1;var r=Fn(),e=Sa(),t=r.Set,i=r.add;return x1=function(n){var s=new t;return e(n,function(o){i(s,o)}),s},x1}var q1,hB;function Oa(){return hB||(hB=1,q1=function(r){return r.size}),q1}var D1,fB;function Ure(){return fB||(fB=1,D1=function(r){return{iterator:r,next:r.next,done:!1}}),D1}var A1,pB;function Bn(){if(pB)return A1;pB=1;var r=li(),e=jr(),t=Yt(),i=js(),n=Ure(),s="Invalid size",o=RangeError,a=TypeError,u=Math.max,l=function(c,d){this.set=c,this.size=u(d,0),this.has=r(c.has),this.keys=r(c.keys)};return l.prototype={getIterator:function(){return n(e(t(this.keys,this.set)))},includes:function(c){return t(this.has,this.set,c)}},A1=function(c){e(c);var d=+c.size;if(d!==d)throw new a(s);var h=i(d);if(h<0)throw new o(s);return new l(c,h)},A1}var M1,vB;function Vre(){if(vB)return M1;vB=1;var r=Nn(),e=Fn(),t=T0(),i=Oa(),n=Bn(),s=Sa(),o=kn(),a=e.has,u=e.remove;return M1=function(c){var d=r(this),h=n(c),f=t(d);return i(d)<=h.size?s(d,function(p){h.includes(p)&&u(f,p)}):o(h.getIterator(),function(p){a(f,p)&&u(f,p)}),f},M1}var N1,gB;function jn(){return gB||(gB=1,N1=function(){return!1}),N1}var mB;function Kre(){if(mB)return oB;mB=1;var r=ce(),e=Vre(),t=$e(),i=jn(),n=!i("difference",function(o){return o.size===0}),s=n||t(function(){var o={size:1,has:function(){return!0},keys:function(){var u=0;return{next:function(){var l=u++>1;return a.has(1)&&a.clear(),{done:l,value:2}}}}},a=new Set([1,2,3,4]);return a.difference(o).size!==3});return r({target:"Set",proto:!0,real:!0,forced:s},{difference:e}),oB}var yB={},F1,bB;function Gre(){if(bB)return F1;bB=1;var r=Nn(),e=Fn(),t=Oa(),i=Bn(),n=Sa(),s=kn(),o=e.Set,a=e.add,u=e.has;return F1=function(c){var d=r(this),h=i(c),f=new o;return t(d)>h.size?s(h.getIterator(),function(p){u(d,p)&&a(f,p)}):n(d,function(p){h.includes(p)&&a(f,p)}),f},F1}var _B;function Yre(){if(_B)return yB;_B=1;var r=ce(),e=$e(),t=Gre(),i=jn(),n=!i("intersection",function(s){return s.size===2&&s.has(1)&&s.has(2)})||e(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!=="3,2"});return r({target:"Set",proto:!0,real:!0,forced:n},{intersection:t}),yB}var wB={},k1,EB;function Xre(){if(EB)return k1;EB=1;var r=Nn(),e=Fn().has,t=Oa(),i=Bn(),n=Sa(),s=kn(),o=m0();return k1=function(u){var l=r(this),c=i(u);if(t(l)<=c.size)return n(l,function(h){if(c.includes(h))return!1},!0)!==!1;var d=c.getIterator();return s(d,function(h){if(e(l,h))return o(d,"normal",!1)})!==!1},k1}var SB;function Jre(){if(SB)return wB;SB=1;var r=ce(),e=Xre(),t=jn(),i=!t("isDisjointFrom",function(n){return!n});return r({target:"Set",proto:!0,real:!0,forced:i},{isDisjointFrom:e}),wB}var OB={},B1,IB;function Qre(){if(IB)return B1;IB=1;var r=Nn(),e=Oa(),t=Sa(),i=Bn();return B1=function(s){var o=r(this),a=i(s);return e(o)>a.size?!1:t(o,function(u){if(!a.includes(u))return!1},!0)!==!1},B1}var TB;function Zre(){if(TB)return OB;TB=1;var r=ce(),e=Qre(),t=jn(),i=!t("isSubsetOf",function(n){return n});return r({target:"Set",proto:!0,real:!0,forced:i},{isSubsetOf:e}),OB}var $B={},j1,PB;function eie(){if(PB)return j1;PB=1;var r=Nn(),e=Fn().has,t=Oa(),i=Bn(),n=kn(),s=m0();return j1=function(a){var u=r(this),l=i(a);if(t(u)0&&arguments[0]!==void 0?arguments[0]:()=>{};wo(this,Gi,new YB),wo(this,Yi,new YB),wo(this,J1,void 0),X_(J1,this,e)}get sizeNodes(){return We(Gi,this).size}get sizeEdges(){return We(Yi,this).size}getNodes(){return We(Gi,this).getSelection()}getEdges(){return We(Yi,this).getSelection()}addNodes(){We(Gi,this).add(...arguments)}addEdges(){We(Yi,this).add(...arguments)}deleteNodes(e){We(Gi,this).delete(e)}deleteEdges(e){We(Yi,this).delete(e)}clear(){We(Gi,this).clear(),We(Yi,this).clear()}commit(){const e={nodes:We(Gi,this).commit(),edges:We(Yi,this).commit()};for(var t=arguments.length,i=new Array(t),n=0;n{this.updateSelection()})}setOptions(e){e!==void 0&&Gs(["multiselect","hoverConnectedEdges","selectable","selectConnectedEdges"],this.options,e)}selectOnPoint(e){let t=!1;if(this.options.selectable===!0){const i=this.getNodeAt(e)||this.getEdgeAt(e);this.unselectAll(),i!==void 0&&(t=this.selectObject(i)),this.body.emitter.emit("_requestRedraw")}return t}selectAdditionalOnPoint(e){let t=!1;if(this.options.selectable===!0){const i=this.getNodeAt(e)||this.getEdgeAt(e);i!==void 0&&(t=!0,i.isSelected()===!0?this.deselectObject(i):this.selectObject(i),this.body.emitter.emit("_requestRedraw"))}return t}_initBaseEvent(e,t){const i={};return i.pointer={DOM:{x:t.x,y:t.y},canvas:this.canvas.DOMtoCanvas(t)},i.event=e,i}generateClickEvent(e,t,i,n){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;const o=this._initBaseEvent(t,i);if(s===!0)o.nodes=[],o.edges=[];else{const a=this.getSelection();o.nodes=a.nodes,o.edges=a.edges}n!==void 0&&(o.previousSelection=n),e=="click"&&(o.items=this.getClickedItems(i)),t.controlEdge!==void 0&&(o.controlEdge=t.controlEdge),this.body.emitter.emit(e,o)}selectObject(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.selectConnectedEdges;return e!==void 0?(e instanceof Ke?(t===!0&&this._selectionAccumulator.addEdges(...e.edges),this._selectionAccumulator.addNodes(e)):this._selectionAccumulator.addEdges(e),!0):!1}deselectObject(e){e.isSelected()===!0&&(e.selected=!1,this._removeFromSelection(e))}_getAllNodesOverlappingWith(e){const t=[],i=this.body.nodes;for(let n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;const i=this._pointerToPositionObject(e),n=this._getAllNodesOverlappingWith(i);if(n.length>0)return t===!0?this.body.nodes[n[n.length-1]]:n[n.length-1]}_getEdgesOverlappingWith(e,t){const i=this.body.edges;for(let n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;const i=this.canvas.DOMtoCanvas(e);let n=10,s=null;const o=this.body.edges;for(let a=0;a0&&(this.generateClickEvent("deselectEdge",t,e,s),i=!0),n.nodes.deleted.length>0&&(this.generateClickEvent("deselectNode",t,e,s),i=!0),n.nodes.added.length>0&&(this.generateClickEvent("selectNode",t,e),i=!0),n.edges.added.length>0&&(this.generateClickEvent("selectEdge",t,e),i=!0),i===!0&&this.generateClickEvent("select",t,e)}getSelection(){return{nodes:this.getSelectedNodeIds(),edges:this.getSelectedEdgeIds()}}getSelectedNodes(){return this._selectionAccumulator.getNodes()}getSelectedEdges(){return this._selectionAccumulator.getEdges()}getSelectedNodeIds(){var e;return ms(e=this._selectionAccumulator.getNodes()).call(e,t=>t.id)}getSelectedEdgeIds(){var e;return ms(e=this._selectionAccumulator.getEdges()).call(e,t=>t.id)}setSelection(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||!e.nodes&&!e.edges)throw new TypeError("Selection must be an object with nodes and/or edges properties");if((t.unselectAll||t.unselectAll===void 0)&&this.unselectAll(),e.nodes)for(const i of e.nodes){const n=this.body.nodes[i];if(!n)throw new RangeError('Node with id "'+i+'" not found');this.selectObject(n,t.highlightEdges)}if(e.edges)for(const i of e.edges){const n=this.body.edges[i];if(!n)throw new RangeError('Edge with id "'+i+'" not found');this.selectObject(n)}this.body.emitter.emit("_requestRedraw"),this._selectionAccumulator.commit()}selectNodes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({nodes:e},{highlightEdges:t})}selectEdges(e){if(!e||e.length===void 0)throw"Selection must be an array with ids";this.setSelection({edges:e})}updateSelection(){for(const e in this._selectionAccumulator.getNodes())Object.prototype.hasOwnProperty.call(this.body.nodes,e.id)||this._selectionAccumulator.deleteNodes(e);for(const e in this._selectionAccumulator.getEdges())Object.prototype.hasOwnProperty.call(this.body.edges,e.id)||this._selectionAccumulator.deleteEdges(e)}getClickedItems(e){const t=this.canvas.DOMtoCanvas(e),i=[],n=this.body.nodeIndices,s=this.body.nodes;for(let u=n.length-1;u>=0;u--){const c=s[n[u]].getItemsOnPoint(t);i.push.apply(i,c)}const o=this.body.edgeIndices,a=this.body.edges;for(let u=o.length-1;u>=0;u--){const c=a[o[u]].getItemsOnPoint(t);i.push.apply(i,c)}return i}}var XB={},Q1,JB;function _ie(){if(JB)return Q1;JB=1;var r=Ls(),e=Math.floor,t=function(i,n){var s=i.length;if(s<8)for(var o=1,a,u;o0;)i[u]=i[--u];u!==o++&&(i[u]=a)}else for(var l=e(s/2),c=t(r(i,0,l),n),d=t(r(i,l),n),h=c.length,f=d.length,p=0,v=0;p3)){if(d)return!0;if(f)return f<603;var I="",_,E,T,R;for(_=65;_<76;_++){switch(E=String.fromCharCode(_),_){case 66:case 69:case 70:case 72:T=3;break;case 68:case 71:T=4;break;default:T=2}for(R=0;R<47;R++)p.push({k:E+R,v:T})}for(p.sort(function(x,C){return C.v-x.v}),R=0;Ro(E)?1:-1}};return r({target:"Array",proto:!0,forced:S},{sort:function(_){_!==void 0&&t(_);var E=i(this);if(y)return _===void 0?v(E):v(E,_);var T=[],R=n(E),x,C;for(C=0;C=0:p>v;v+=b)v in f&&(d=l(d,f[v],v,h));return d}};return o_={left:o(!1),right:o(!0)},o_}var a_,uj;function xie(){if(uj)return a_;uj=1;var r=k3();return a_=r==="NODE",a_}var lj;function qie(){if(lj)return oj;lj=1;var r=ce(),e=Cie().left,t=Vs(),i=la(),n=xie(),s=!n&&i>79&&i<83,o=s||!t("reduce");return r({target:"Array",proto:!0,forced:o},{reduce:function(u){var l=arguments.length;return e(this,u,l,l>1?arguments[1]:void 0)}}),oj}var u_,cj;function Die(){if(cj)return u_;cj=1,qie();var r=Tt();return u_=r("Array","reduce"),u_}var l_,dj;function Aie(){if(dj)return l_;dj=1;var r=dt(),e=Die(),t=Array.prototype;return l_=function(i){var n=i.reduce;return i===t||r(t,i)&&n===t.reduce?e:n},l_}var c_,hj;function Mie(){if(hj)return c_;hj=1;var r=Aie();return c_=r,c_}var d_,fj;function Nie(){return fj||(fj=1,d_=Mie()),d_}var Fie=Nie(),B5=pe(Fie);class j5{abstract(){throw new Error("Can't instantiate abstract class!")}fake_use(){}curveType(){return this.abstract()}getPosition(e){return this.fake_use(e),this.abstract()}setPosition(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;this.fake_use(e,t,i),this.abstract()}getTreeSize(e){return this.fake_use(e),this.abstract()}sort(e){this.fake_use(e),this.abstract()}fix(e,t){this.fake_use(e,t),this.abstract()}shift(e,t){this.fake_use(e,t),this.abstract()}}class kie extends j5{constructor(e){super(),this.layout=e}curveType(){return"horizontal"}getPosition(e){return e.x}setPosition(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;i!==void 0&&this.layout.hierarchical.addToOrdering(e,i),e.x=t}getTreeSize(e){const t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_x,max:t.max_x}}sort(e){cs(e).call(e,function(t,i){return t.x-i.x})}fix(e,t){e.y=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.y=!0}shift(e,t){this.layout.body.nodes[e].x+=t}}class Bie extends j5{constructor(e){super(),this.layout=e}curveType(){return"vertical"}getPosition(e){return e.y}setPosition(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;i!==void 0&&this.layout.hierarchical.addToOrdering(e,i),e.y=t}getTreeSize(e){const t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_y,max:t.max_y}}sort(e){cs(e).call(e,function(t,i){return t.y-i.y})}fix(e,t){e.x=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.x=!0}shift(e,t){this.layout.body.nodes[e].y+=t}}var pj={},vj;function jie(){if(vj)return pj;vj=1;var r=ce(),e=Hi().every,t=Vs(),i=t("every");return r({target:"Array",proto:!0,forced:!i},{every:function(s){return e(this,s,arguments.length>1?arguments[1]:void 0)}}),pj}var h_,gj;function Lie(){if(gj)return h_;gj=1,jie();var r=Tt();return h_=r("Array","every"),h_}var f_,mj;function zie(){if(mj)return f_;mj=1;var r=dt(),e=Lie(),t=Array.prototype;return f_=function(i){var n=i.every;return i===t||r(t,i)&&n===t.every?e:n},f_}var p_,yj;function Hie(){if(yj)return p_;yj=1;var r=zie();return p_=r,p_}var v_,bj;function Wie(){return bj||(bj=1,v_=Hie()),v_}var Uie=Wie(),L5=pe(Uie);function Vie(r,e){const t=new _i;return Le(r).call(r,i=>{var n;Le(n=i.edges).call(n,s=>{s.connected&&t.add(s)})}),Le(t).call(t,i=>{const n=i.from.id,s=i.to.id;e[n]==null&&(e[n]=0),(e[s]==null||e[n]>=e[s])&&(e[s]=e[n]+1)}),e}function Kie(r){return z5(e=>{var t,i;return L5(t=Wt(i=e.edges).call(i,n=>r.has(n.toId))).call(t,n=>n.to===e)},(e,t)=>t>e,"from",r)}function Gie(r){return z5(e=>{var t,i;return L5(t=Wt(i=e.edges).call(i,n=>r.has(n.toId))).call(t,n=>n.from===e)},(e,t)=>td+1+h.edges.length,0),a=t+"Id",u=t==="to"?1:-1;for(const[d,h]of i){if(!i.has(d)||!r(h))continue;s[d]=0;const f=[h];let p=0,v;for(;v=f.pop();){var l,c;if(!i.has(d))continue;const b=s[v.id]+u;if(Le(l=Wt(c=v.edges).call(c,m=>m.connected&&m.to!==m.from&&m[t]!==v&&i.has(m.toId)&&i.has(m.fromId))).call(l,m=>{const g=m[a],w=s[g];(w==null||e(b,w))&&(s[g]=b,f.push(m[t]))}),p>o)return Vie(i,s);++p}}return s}class Yie{constructor(){this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}addRelation(e,t){this.childrenReference[e]===void 0&&(this.childrenReference[e]=[]),this.childrenReference[e].push(t),this.parentReference[t]===void 0&&(this.parentReference[t]=[]),this.parentReference[t].push(e)}checkIfTree(){for(const e in this.parentReference)if(this.parentReference[e].length>1){this.isTree=!1;return}this.isTree=!0}numTrees(){return this.treeIndex+1}setTreeIndex(e,t){t!==void 0&&this.trees[e.id]===void 0&&(this.trees[e.id]=t,this.treeIndex=Math.max(t,this.treeIndex))}ensureLevel(e){this.levels[e]===void 0&&(this.levels[e]=0)}getMaxLevel(e){const t={},i=n=>{if(t[n]!==void 0)return t[n];let s=this.levels[n];if(this.childrenReference[n]){const o=this.childrenReference[n];if(o.length>0)for(let a=0;as-o);for(const s of n)t.set(s,i++);for(const s in this.levels)Object.prototype.hasOwnProperty.call(this.levels,s)&&(this.levels[s]=t.get(this.levels[s]))}getTreeSize(e,t){let i=1e9,n=-1e9,s=1e9,o=-1e9;for(const a in this.trees)if(Object.prototype.hasOwnProperty.call(this.trees,a)&&this.trees[a]===t){const u=e[a];i=Math.min(u.x,i),n=Math.max(u.x,n),s=Math.min(u.y,s),o=Math.max(u.y,o)}return{min_x:i,max_x:n,min_y:s,max_y:o}}hasSameParent(e,t){const i=this.parentReference[e.id],n=this.parentReference[t.id];if(i===void 0||n===void 0)return!1;for(let s=0;s{this.setupHierarchicalLayout()}),this.body.emitter.on("_dataLoaded",()=>{this.layoutNetwork()}),this.body.emitter.on("_resetHierarchicalLayout",()=>{this.setupHierarchicalLayout()}),this.body.emitter.on("_adjustEdgesForHierarchicalLayout",()=>{if(this.options.hierarchical.enabled!==!0)return;const e=this.direction.curveType();this.body.emitter.emit("_forceDisableDynamicCurves",e,!1)})}setOptions(e,t){if(e!==void 0){const i=this.options.hierarchical,n=i.enabled;if(Gs(["randomSeed","improvedLayout","clusterThreshold"],this.options,e),ir(this.options,e,"hierarchical"),e.randomSeed!==void 0&&this._resetRNG(e.randomSeed),i.enabled===!0)return n===!0&&this.body.emitter.emit("refresh",!0),i.direction==="RL"||i.direction==="DU"?i.levelSeparation>0&&(i.levelSeparation*=-1):i.levelSeparation<0&&(i.levelSeparation*=-1),this.setDirectionStrategy(),this.body.emitter.emit("_resetHierarchicalLayout"),this.adaptAllOptionsForHierarchicalLayout(t);if(n===!0)return this.body.emitter.emit("refresh"),Ue(t,this.optionsBackup)}return t}_resetRNG(e){this.initialRandomSeed=e,this._rng=il(this.initialRandomSeed)}adaptAllOptionsForHierarchicalLayout(e){if(this.options.hierarchical.enabled===!0){const t=this.optionsBackup.physics;e.physics===void 0||e.physics===!0?(e.physics={enabled:t.enabled===void 0?!0:t.enabled,solver:"hierarchicalRepulsion"},t.enabled=t.enabled===void 0?!0:t.enabled,t.solver=t.solver||"barnesHut"):typeof e.physics=="object"?(t.enabled=e.physics.enabled===void 0?!0:e.physics.enabled,t.solver=e.physics.solver||"barnesHut",e.physics.solver="hierarchicalRepulsion"):e.physics!==!1&&(t.solver="barnesHut",e.physics={solver:"hierarchicalRepulsion"});let i=this.direction.curveType();if(e.edges===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges={smooth:!1};else if(e.edges.smooth===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges.smooth=!1;else if(typeof e.edges.smooth=="boolean")this.optionsBackup.edges={smooth:e.edges.smooth},e.edges.smooth={enabled:e.edges.smooth,type:i};else{const n=e.edges.smooth;n.type!==void 0&&n.type!=="dynamic"&&(i=n.type),this.optionsBackup.edges={smooth:{enabled:n.enabled===void 0?!0:n.enabled,type:n.type===void 0?"dynamic":n.type,roundness:n.roundness===void 0?.5:n.roundness,forceDirection:n.forceDirection===void 0?!1:n.forceDirection}},e.edges.smooth={enabled:n.enabled===void 0?!0:n.enabled,type:i,roundness:n.roundness===void 0?.5:n.roundness,forceDirection:n.forceDirection===void 0?!1:n.forceDirection}}this.body.emitter.emit("_forceDisableDynamicCurves",i)}return e}positionInitially(e){if(this.options.hierarchical.enabled!==!0){this._resetRNG(this.initialRandomSeed);const t=e.length+50;for(let i=0;is){const u=e.length;for(;e.length>s&&n<=10;){n+=1;const l=e.length;n%3===0?this.body.modules.clustering.clusterBridges(o):this.body.modules.clustering.clusterOutliers(o);const c=e.length;if(l==c&&n%3!==0){this._declusterAll(),this.body.emitter.emit("_layoutFailed"),console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.");return}}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*u)})}n>10&&console.info("The clustering didn't succeed within the amount of interations allowed, progressing with partial result."),this.body.modules.kamadaKawai.solve(e,this.body.edgeIndices,!0),this._shiftToCenter();const a=70;for(let u=0;u0){let e,t,i=!1,n=!1;this.lastNodeOnLevel={},this.hierarchical=new Yie;for(t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&(e=this.body.nodes[t],e.options.level!==void 0?(i=!0,this.hierarchical.levels[t]=e.options.level):n=!0);if(n===!0&&i===!0)throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");{if(n===!0){const o=this.options.hierarchical.sortMethod;o==="hubsize"?this._determineLevelsByHubsize():o==="directed"?this._determineLevelsDirected():o==="custom"&&this._determineLevelsCustomCallback()}for(const o in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,o)&&this.hierarchical.ensureLevel(o);const s=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(s),this._condenseHierarchy(),this._shiftToCenter()}}}_condenseHierarchy(){var e=this;let t=!1;const i={},n=()=>{const m=o();let g=0;for(let w=0;w{const w=this.hierarchical.trees;for(const y in w)Object.prototype.hasOwnProperty.call(w,y)&&w[y]===m&&this.direction.shift(y,g)},o=()=>{const m=[];for(let g=0;g{if(!g[m.id]&&(g[m.id]=!0,this.hierarchical.childrenReference[m.id])){const w=this.hierarchical.childrenReference[m.id];if(w.length>0)for(let y=0;y1&&arguments[1]!==void 0?arguments[1]:1e9,w=1e9,y=1e9,S=1e9,O=-1e9;for(const I in m)if(Object.prototype.hasOwnProperty.call(m,I)){const _=e.body.nodes[I],E=e.hierarchical.levels[_.id],T=e.direction.getPosition(_),[R,x]=e._getSpaceAroundNode(_,m);w=Math.min(R,w),y=Math.min(x,y),E<=g&&(S=Math.min(T,S),O=Math.max(T,O))}return[S,O,w,y]},l=(m,g)=>{const w=this.hierarchical.getMaxLevel(m.id),y=this.hierarchical.getMaxLevel(g.id);return Math.min(w,y)},c=(m,g,w)=>{const y=this.hierarchical;for(let S=0;S1)for(let _=0;_2&&arguments[2]!==void 0?arguments[2]:!1;const y=e.direction.getPosition(m),S=e.direction.getPosition(g),O=Math.abs(S-y),I=e.options.hierarchical.nodeSpacing;if(O>I){const _={},E={};a(m,_),a(g,E);const T=l(m,g),R=u(_,T),x=u(E,T),C=R[1],D=x[0],j=x[2];if(Math.abs(C-D)>I){let H=C-D+I;H<-j+I&&(H=-j+I),H<0&&(e._shiftBlock(g.id,H),t=!0,w===!0&&e._centerParent(g))}}},h=(m,g)=>{const w=g.id,y=g.edges,S=this.hierarchical.levels[g.id],O=this.options.hierarchical.levelSeparation*this.options.hierarchical.levelSeparation,I={},_=[];for(let j=0;j{let H=0;for(let Z=0;Z{let H=0;for(let Z=0;Z{let H=this.direction.getPosition(g);const Z={};for(let fe=0;fe{const ee=this.direction.getPosition(g);if(i[g.id]===void 0){const ge={};a(g,ge),i[g.id]=ge}const H=u(i[g.id]),Z=H[2],fe=H[3],_e=j-ee;let te=0;_e>0?te=Math.min(_e,fe-this.options.hierarchical.nodeSpacing):_e<0&&(te=-Math.min(-_e,Z-this.options.hierarchical.nodeSpacing)),te!=0&&(this._shiftBlock(g.id,te),t=!0)},C=j=>{const ee=this.direction.getPosition(g),[H,Z]=this._getSpaceAroundNode(g),fe=j-ee;let _e=ee;fe>0?_e=Math.min(ee+(Z-this.options.hierarchical.nodeSpacing),j):fe<0&&(_e=Math.max(ee-(H-this.options.hierarchical.nodeSpacing),j)),_e!==ee&&(this.direction.setPosition(g,_e),t=!0)};let D=R(m,_);x(D),D=R(m,y),C(D)},f=m=>{let g=this.hierarchical.getLevels();g=on(g).call(g);for(let w=0;w{let g=this.hierarchical.getLevels();g=on(g).call(g);for(let w=0;w{for(const m in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,m)&&this._centerParent(this.body.nodes[m])},b=()=>{let m=this.hierarchical.getLevels();m=on(m).call(m);for(let g=0;g0&&Math.abs(d)0&&(l=this.direction.getPosition(n[o-1])+u),this.direction.setPosition(a,l,i),this._validatePositionAndContinue(a,i,l),s++}}}}_placeBranchNodes(e,t){var i;const n=this.hierarchical.childrenReference[e];if(n===void 0)return;const s=[];for(let a=0;at&&this.positionedNodes[u.id]===void 0){const c=this.options.hierarchical.nodeSpacing;let d;a===0?d=this.direction.getPosition(this.body.nodes[e]):d=this.direction.getPosition(s[a-1])+c,this.direction.setPosition(u,d,l),this._validatePositionAndContinue(u,l,d)}else return}const o=this._getCenterPosition(s);this.direction.setPosition(this.body.nodes[e],o,t)}_validatePositionAndContinue(e,t,i){if(this.hierarchical.isTree){if(this.lastNodeOnLevel[t]!==void 0){const n=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[t]]);if(i-n{var n;Fe(n=this.body.edgeIndices).call(n,i.id)!==-1&&t.push(i)}),t}_getHubSizes(){const e={},t=this.body.nodeIndices;Oe(t,n=>{const s=this.body.nodes[n],o=this._getActiveEdges(s).length;e[o]=!0});const i=[];return Oe(e,n=>{i.push(Number(n))}),cs(i).call(i,function(n,s){return s-n}),i}_determineLevelsByHubsize(){const e=(i,n)=>{this.hierarchical.levelDownstream(i,n)},t=this._getHubSizes();for(let i=0;i{const o=this.body.nodes[s];n===this._getActiveEdges(o).length&&this._crawlNetwork(e,s)})}}_determineLevelsCustomCallback(){const t=function(n,s,o){},i=(n,s,o)=>{let a=this.hierarchical.levels[n.id];a===void 0&&(a=this.hierarchical.levels[n.id]=1e5);const u=t(kt.cloneOptions(n,"node"),kt.cloneOptions(s,"node"),kt.cloneOptions(o,"edge"));this.hierarchical.levels[s.id]=a+u};this._crawlNetwork(i),this.hierarchical.setMinLevelToZero()}_determineLevelsDirected(){var e;const t=B5(e=this.body.nodeIndices).call(e,(i,n)=>(i.set(n,this.body.nodes[n]),i),new E0);this.options.hierarchical.shakeTowards==="roots"?this.hierarchical.levels=Gie(t):this.hierarchical.levels=Kie(t),this.hierarchical.setMinLevelToZero()}_generateMap(){const e=(t,i)=>{this.hierarchical.levels[i.id]>this.hierarchical.levels[t.id]&&this.hierarchical.addRelation(t.id,i.id)};this._crawlNetwork(e),this.hierarchical.checkIfTree()}_crawlNetwork(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){},t=arguments.length>1?arguments[1]:void 0;const i={},n=(s,o)=>{if(i[s.id]===void 0){this.hierarchical.setTreeIndex(s,o),i[s.id]=!0;let a;const u=this._getActiveEdges(s);for(let l=0;l{if(i[s])return;i[s]=!0,this.direction.shift(s,t);const o=this.hierarchical.childrenReference[s];if(o!==void 0)for(let a=0;a{const u=this.hierarchical.parentReference[a];if(u!==void 0)for(let l=0;l{const u=this.hierarchical.parentReference[a];if(u!==void 0)for(let l=0;l{this._clean()}),this.body.emitter.on("_dataChanged",z(s=this._restore).call(s,this)),this.body.emitter.on("_resetData",z(o=this._restore).call(o,this))}_restore(){this.inMode!==!1&&(this.options.initiallyActive===!0?this.enableEditMode():this.disableEditMode())}setOptions(e,t,i){t!==void 0&&(t.locale!==void 0?this.options.locale=t.locale:this.options.locale=i.locale,t.locales!==void 0?this.options.locales=t.locales:this.options.locales=i.locales),e!==void 0&&(typeof e=="boolean"?this.options.enabled=e:(this.options.enabled=!0,Ue(this.options,e)),this.options.initiallyActive===!0&&(this.editMode=!0),this._setup())}toggleEditMode(){this.editMode===!0?this.disableEditMode():this.enableEditMode()}enableEditMode(){this.editMode=!0,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display="block",this.closeDiv.style.display="block",this.editModeDiv.style.display="none",this.showManipulatorToolbar())}disableEditMode(){this.editMode=!1,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display="none",this.closeDiv.style.display="none",this.editModeDiv.style.display="block",this._createEditButton())}showManipulatorToolbar(){if(this._clean(),this.manipulationDOM={},this.guiEnabled===!0){var e,t;this.editMode=!0,this.manipulationDiv.style.display="block",this.closeDiv.style.display="block";const i=this.selectionHandler.getSelectedNodeCount(),n=this.selectionHandler.getSelectedEdgeCount(),s=i+n,o=this.options.locales[this.options.locale];let a=!1;this.options.addNode!==!1&&(this._createAddNodeButton(o),a=!0),this.options.addEdge!==!1&&(a===!0?this._createSeperator(1):a=!0,this._createAddEdgeButton(o)),i===1&&typeof this.options.editNode=="function"?(a===!0?this._createSeperator(2):a=!0,this._createEditNodeButton(o)):n===1&&i===0&&this.options.editEdge!==!1&&(a===!0?this._createSeperator(3):a=!0,this._createEditEdgeButton(o)),s!==0&&(i>0&&this.options.deleteNode!==!1?(a===!0&&this._createSeperator(4),this._createDeleteButton(o)):i===0&&this.options.deleteEdge!==!1&&(a===!0&&this._createSeperator(4),this._createDeleteButton(o))),this._bindElementEvents(this.closeDiv,z(e=this.toggleEditMode).call(e,this)),this._temporaryBindEvent("select",z(t=this.showManipulatorToolbar).call(t,this))}this.body.emitter.emit("_redraw")}addNodeMode(){var e;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addNode",this.guiEnabled===!0){var t;const i=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(i),this._createSeperator(),this._createDescription(i.addDescription||this.options.locales.en.addDescription),this._bindElementEvents(this.closeDiv,z(t=this.toggleEditMode).call(t,this))}this._temporaryBindEvent("click",z(e=this._performAddNode).call(e,this))}editNode(){this.editMode!==!0&&this.enableEditMode(),this._clean();const e=this.selectionHandler.getSelectedNodes()[0];if(e!==void 0)if(this.inMode="editNode",typeof this.options.editNode=="function")if(e.isCluster!==!0){const t=Ue({},e.options,!1);if(t.x=e.x,t.y=e.y,this.options.editNode.length===2)this.options.editNode(t,i=>{i!=null&&this.inMode==="editNode"&&this.body.data.nodes.getDataSet().update(i),this.showManipulatorToolbar()});else throw new Error("The function for edit does not support two arguments (data, callback)")}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError);else throw new Error("No function has been configured to handle the editing of nodes.");else this.showManipulatorToolbar()}addEdgeMode(){var e,t,i,n,s;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addEdge",this.guiEnabled===!0){var o;const a=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(a),this._createSeperator(),this._createDescription(a.edgeDescription||this.options.locales.en.edgeDescription),this._bindElementEvents(this.closeDiv,z(o=this.toggleEditMode).call(o,this))}this._temporaryBindUI("onTouch",z(e=this._handleConnect).call(e,this)),this._temporaryBindUI("onDragEnd",z(t=this._finishConnect).call(t,this)),this._temporaryBindUI("onDrag",z(i=this._dragControlNode).call(i,this)),this._temporaryBindUI("onRelease",z(n=this._finishConnect).call(n,this)),this._temporaryBindUI("onDragStart",z(s=this._dragStartEdge).call(s,this)),this._temporaryBindUI("onHold",()=>{})}editEdgeMode(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="editEdge",typeof this.options.editEdge=="object"&&typeof this.options.editEdge.editWithoutDrag=="function"&&(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0)){const o=this.body.edges[this.edgeBeingEditedId];this._performEditEdge(o.from.id,o.to.id);return}if(this.guiEnabled===!0){var e;const o=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(o),this._createSeperator(),this._createDescription(o.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindElementEvents(this.closeDiv,z(e=this.toggleEditMode).call(e,this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0){var t,i,n,s;const o=this.body.edges[this.edgeBeingEditedId],a=this._getNewTargetNode(o.from.x,o.from.y),u=this._getNewTargetNode(o.to.x,o.to.y);this.temporaryIds.nodes.push(a.id),this.temporaryIds.nodes.push(u.id),this.body.nodes[a.id]=a,this.body.nodeIndices.push(a.id),this.body.nodes[u.id]=u,this.body.nodeIndices.push(u.id),this._temporaryBindUI("onTouch",z(t=this._controlNodeTouch).call(t,this)),this._temporaryBindUI("onTap",()=>{}),this._temporaryBindUI("onHold",()=>{}),this._temporaryBindUI("onDragStart",z(i=this._controlNodeDragStart).call(i,this)),this._temporaryBindUI("onDrag",z(n=this._controlNodeDrag).call(n,this)),this._temporaryBindUI("onDragEnd",z(s=this._controlNodeDragEnd).call(s,this)),this._temporaryBindUI("onMouseMove",()=>{}),this._temporaryBindEvent("beforeDrawing",l=>{const c=o.edgeType.findBorderPositions(l);a.selected===!1&&(a.x=c.from.x,a.y=c.from.y),u.selected===!1&&(u.x=c.to.x,u.y=c.to.y)}),this.body.emitter.emit("_redraw")}else this.showManipulatorToolbar()}deleteSelected(){this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="delete";const e=this.selectionHandler.getSelectedNodeIds(),t=this.selectionHandler.getSelectedEdgeIds();let i;if(e.length>0){for(let n=0;n0&&typeof this.options.deleteEdge=="function"&&(i=this.options.deleteEdge);if(typeof i=="function"){const n={nodes:e,edges:t};if(i.length===2)i(n,s=>{s!=null&&this.inMode==="delete"?(this.body.data.edges.getDataSet().remove(s.edges),this.body.data.nodes.getDataSet().remove(s.nodes),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()):(this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar())});else throw new Error("The function for delete does not support two arguments (data, callback)")}else this.body.data.edges.getDataSet().remove(t),this.body.data.nodes.getDataSet().remove(e),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}_setup(){this.options.enabled===!0?(this.guiEnabled=!0,this._createWrappers(),this.editMode===!1?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}_createWrappers(){if(this.manipulationDiv===void 0&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="vis-manipulation",this.editMode===!0?this.manipulationDiv.style.display="block":this.manipulationDiv.style.display="none",this.canvas.frame.appendChild(this.manipulationDiv)),this.editModeDiv===void 0&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="vis-edit-mode",this.editMode===!0?this.editModeDiv.style.display="none":this.editModeDiv.style.display="block",this.canvas.frame.appendChild(this.editModeDiv)),this.closeDiv===void 0){var e,t;this.closeDiv=document.createElement("button"),this.closeDiv.className="vis-close",this.closeDiv.setAttribute("aria-label",(e=(t=this.options.locales[this.options.locale])===null||t===void 0?void 0:t.close)!==null&&e!==void 0?e:this.options.locales.en.close),this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv)}}_getNewTargetNode(e,t){const i=Ue({},this.options.controlNodeStyle);i.id="targetNode"+_o(),i.hidden=!1,i.physics=!1,i.x=e,i.y=t;const n=this.body.functions.createNode(i);return n.shape.boundingBox={left:e,right:e,top:t,bottom:t},n}_createEditButton(){var e;this._clean(),this.manipulationDOM={},mi(this.editModeDiv);const t=this.options.locales[this.options.locale],i=this._createButton("editMode","vis-edit vis-edit-mode",t.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(i),this._bindElementEvents(i,z(e=this.toggleEditMode).call(e,this))}_clean(){this.inMode=!1,this.guiEnabled===!0&&(mi(this.editModeDiv),mi(this.manipulationDiv),this._cleanupDOMEventListeners()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}_cleanupDOMEventListeners(){for(const t of Qr(e=this._domEventListenerCleanupQueue).call(e,0)){var e;t()}}_removeManipulationDOM(){this._clean(),mi(this.manipulationDiv),mi(this.editModeDiv),mi(this.closeDiv),this.manipulationDiv&&this.canvas.frame.removeChild(this.manipulationDiv),this.editModeDiv&&this.canvas.frame.removeChild(this.editModeDiv),this.closeDiv&&this.canvas.frame.removeChild(this.closeDiv),this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0}_createSeperator(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+e]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+e].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+e])}_createAddNodeButton(e){var t;const i=this._createButton("addNode","vis-add",e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,z(t=this.addNodeMode).call(t,this))}_createAddEdgeButton(e){var t;const i=this._createButton("addEdge","vis-connect",e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,z(t=this.addEdgeMode).call(t,this))}_createEditNodeButton(e){var t;const i=this._createButton("editNode","vis-edit",e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,z(t=this.editNode).call(t,this))}_createEditEdgeButton(e){var t;const i=this._createButton("editEdge","vis-edit",e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,z(t=this.editEdgeMode).call(t,this))}_createDeleteButton(e){var t;let i;this.options.rtl?i="vis-delete-rtl":i="vis-delete";const n=this._createButton("delete",i,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,z(t=this.deleteSelected).call(t,this))}_createBackButton(e){var t;const i=this._createButton("back","vis-back",e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,z(t=this.showManipulatorToolbar).call(t,this))}_createButton(e,t,i){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"vis-label";return this.manipulationDOM[e+"Div"]=document.createElement("button"),this.manipulationDOM[e+"Div"].className="vis-button "+t,this.manipulationDOM[e+"Label"]=document.createElement("div"),this.manipulationDOM[e+"Label"].className=n,this.manipulationDOM[e+"Label"].innerText=i,this.manipulationDOM[e+"Div"].appendChild(this.manipulationDOM[e+"Label"]),this.manipulationDOM[e+"Div"]}_createDescription(e){this.manipulationDOM.descriptionLabel=document.createElement("div"),this.manipulationDOM.descriptionLabel.className="vis-none",this.manipulationDOM.descriptionLabel.innerText=e,this.manipulationDiv.appendChild(this.manipulationDOM.descriptionLabel)}_temporaryBindEvent(e,t){this.temporaryEventFunctions.push({event:e,boundFunction:t}),this.body.emitter.on(e,t)}_temporaryBindUI(e,t){if(this.body.eventListeners[e]!==void 0)this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=t;else throw new Error("This UI function does not exist. Typo? You tried: "+e+" possible are: "+ga(Ze(this.body.eventListeners)))}_unbindTemporaryUIs(){for(const e in this.temporaryUIFunctions)Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions,e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}_unbindTemporaryEvents(){for(let e=0;e{i.destroy()});const n=s=>{let{keyCode:o,key:a}=s;(a==="Enter"||a===" "||o===13||o===32)&&t()};e.addEventListener("keyup",n,!1),this._domEventListenerCleanupQueue.push(()=>{e.removeEventListener("keyup",n,!1)})}_cleanupTemporaryNodesAndEdges(){for(let s=0;s=0;a--)if(s[a]!==this.selectedControlNode.id){o=this.body.nodes[s[a]];break}if(o!==void 0&&this.selectedControlNode!==void 0)if(o.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{const a=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===a.id?this._performEditEdge(o.id,n.to.id):this._performEditEdge(n.from.id,o.id)}else n.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}_handleConnect(e){if(new Date().valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=ot({},this.body.view.translation),this.interactionHandler.drag.pointer=this.lastTouch,this.interactionHandler.drag.translation=this.lastTouch.translation;const t=this.lastTouch,i=this.selectionHandler.getNodeAt(t);if(i!==void 0)if(i.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{const n=this._getNewTargetNode(i.x,i.y);this.body.nodes[n.id]=n,this.body.nodeIndices.push(n.id);const s=this.body.functions.createEdge({id:"connectionEdge"+_o(),from:i.id,to:n.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[s.id]=s,this.body.edgeIndices.push(s.id),this.temporaryIds.nodes.push(n.id),this.temporaryIds.edges.push(s.id)}this.touchTime=new Date().valueOf()}}_dragControlNode(e){const t=this.body.functions.getPointer(e.center),i=this.selectionHandler._pointerToPositionObject(t);let n;this.temporaryIds.edges[0]!==void 0&&(n=this.body.edges[this.temporaryIds.edges[0]].fromId);const s=this.selectionHandler._getAllNodesOverlappingWith(i);let o;for(let u=s.length-1;u>=0;u--){var a;if(Fe(a=this.temporaryIds.nodes).call(a,s[u])===-1){o=this.body.nodes[s[u]];break}}if(e.controlEdge={from:n,to:o?o.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragging",e,t),this.temporaryIds.nodes[0]!==void 0){const u=this.body.nodes[this.temporaryIds.nodes[0]];u.x=this.canvas._XconvertDOMtoCanvas(t.x),u.y=this.canvas._YconvertDOMtoCanvas(t.y),this.body.emitter.emit("_redraw")}else this.interactionHandler.onDrag(e)}_finishConnect(e){const t=this.body.functions.getPointer(e.center),i=this.selectionHandler._pointerToPositionObject(t);let n;this.temporaryIds.edges[0]!==void 0&&(n=this.body.edges[this.temporaryIds.edges[0]].fromId);const s=this.selectionHandler._getAllNodesOverlappingWith(i);let o;for(let u=s.length-1;u>=0;u--){var a;if(Fe(a=this.temporaryIds.nodes).call(a,s[u])===-1){o=this.body.nodes[s[u]];break}}this._cleanupTemporaryNodesAndEdges(),o!==void 0&&(o.isCluster===!0?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):this.body.nodes[n]!==void 0&&this.body.nodes[o.id]!==void 0&&this._performAddEdge(n,o.id)),e.controlEdge={from:n,to:o?o.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragEnd",e,t),this.body.emitter.emit("_redraw")}_dragStartEdge(e){const t=this.lastTouch;this.selectionHandler.generateClickEvent("dragStart",e,t,void 0,!0)}_performAddNode(e){const t={id:_o(),x:e.pointer.canvas.x,y:e.pointer.canvas.y,label:"new"};if(typeof this.options.addNode=="function")if(this.options.addNode.length===2)this.options.addNode(t,i=>{i!=null&&this.inMode==="addNode"&&this.body.data.nodes.getDataSet().add(i),this.showManipulatorToolbar()});else throw this.showManipulatorToolbar(),new Error("The function for add does not support two arguments (data,callback)");else this.body.data.nodes.getDataSet().add(t),this.showManipulatorToolbar()}_performAddEdge(e,t){const i={from:e,to:t};if(typeof this.options.addEdge=="function")if(this.options.addEdge.length===2)this.options.addEdge(i,n=>{n!=null&&this.inMode==="addEdge"&&(this.body.data.edges.getDataSet().add(n),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())});else throw new Error("The function for connect does not support two arguments (data,callback)");else this.body.data.edges.getDataSet().add(i),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}_performEditEdge(e,t){const i={id:this.edgeBeingEditedId,from:e,to:t,label:this.body.data.edges.get(this.edgeBeingEditedId).label};let n=this.options.editEdge;if(typeof n=="object"&&(n=n.editWithoutDrag),typeof n=="function")if(n.length===2)n(i,s=>{s==null||this.inMode!=="editEdge"?(this.body.edges[i.id].updateEdgeType(),this.body.emitter.emit("_redraw"),this.showManipulatorToolbar()):(this.body.data.edges.getDataSet().update(s),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())});else throw new Error("The function for edit does not support two arguments (data, callback)");else this.body.data.edges.getDataSet().update(i),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}const G="string",L="boolean",M="number",oo="array",ue="object",H5="dom",Qie="any",g_=["arrow","bar","box","circle","crow","curve","diamond","image","inv_curve","inv_triangle","triangle","vee"],m_={borderWidth:{number:M},borderWidthSelected:{number:M,undefined:"undefined"},brokenImage:{string:G,undefined:"undefined"},chosen:{label:{boolean:L,function:"function"},node:{boolean:L,function:"function"},__type__:{object:ue,boolean:L}},color:{border:{string:G},background:{string:G},highlight:{border:{string:G},background:{string:G},__type__:{object:ue,string:G}},hover:{border:{string:G},background:{string:G},__type__:{object:ue,string:G}},__type__:{object:ue,string:G}},opacity:{number:M,undefined:"undefined"},fixed:{x:{boolean:L},y:{boolean:L},__type__:{object:ue,boolean:L}},font:{align:{string:G},color:{string:G},size:{number:M},face:{string:G},background:{string:G},strokeWidth:{number:M},strokeColor:{string:G},vadjust:{number:M},multi:{boolean:L,string:G},bold:{color:{string:G},size:{number:M},face:{string:G},mod:{string:G},vadjust:{number:M},__type__:{object:ue,string:G}},boldital:{color:{string:G},size:{number:M},face:{string:G},mod:{string:G},vadjust:{number:M},__type__:{object:ue,string:G}},ital:{color:{string:G},size:{number:M},face:{string:G},mod:{string:G},vadjust:{number:M},__type__:{object:ue,string:G}},mono:{color:{string:G},size:{number:M},face:{string:G},mod:{string:G},vadjust:{number:M},__type__:{object:ue,string:G}},__type__:{object:ue,string:G}},group:{string:G,number:M,undefined:"undefined"},heightConstraint:{minimum:{number:M},valign:{string:G},__type__:{object:ue,boolean:L,number:M}},hidden:{boolean:L},icon:{face:{string:G},code:{string:G},size:{number:M},color:{string:G},weight:{string:G,number:M},__type__:{object:ue}},id:{string:G,number:M},image:{selected:{string:G,undefined:"undefined"},unselected:{string:G,undefined:"undefined"},__type__:{object:ue,string:G}},imagePadding:{top:{number:M},right:{number:M},bottom:{number:M},left:{number:M},__type__:{object:ue,number:M}},label:{string:G,undefined:"undefined"},labelHighlightBold:{boolean:L},level:{number:M,undefined:"undefined"},margin:{top:{number:M},right:{number:M},bottom:{number:M},left:{number:M},__type__:{object:ue,number:M}},mass:{number:M},physics:{boolean:L},scaling:{min:{number:M},max:{number:M},label:{enabled:{boolean:L},min:{number:M},max:{number:M},maxVisible:{number:M},drawThreshold:{number:M},__type__:{object:ue,boolean:L}},customScalingFunction:{function:"function"},__type__:{object:ue}},shadow:{enabled:{boolean:L},color:{string:G},size:{number:M},x:{number:M},y:{number:M},__type__:{object:ue,boolean:L}},shape:{string:["custom","ellipse","circle","database","box","text","image","circularImage","diamond","dot","star","triangle","triangleDown","square","icon","hexagon"]},ctxRenderer:{function:"function"},shapeProperties:{borderDashes:{boolean:L,array:oo},borderRadius:{number:M},interpolation:{boolean:L},useImageSize:{boolean:L},useBorderWithImage:{boolean:L},coordinateOrigin:{string:["center","top-left"]},__type__:{object:ue}},size:{number:M},title:{string:G,dom:H5,undefined:"undefined"},value:{number:M,undefined:"undefined"},widthConstraint:{minimum:{number:M},maximum:{number:M},__type__:{object:ue,boolean:L,number:M}},x:{number:M},y:{number:M},__type__:{object:ue}},Zie={configure:{enabled:{boolean:L},filter:{boolean:L,string:G,array:oo,function:"function"},container:{dom:H5},showButton:{boolean:L},__type__:{object:ue,boolean:L,string:G,array:oo,function:"function"}},edges:{arrows:{to:{enabled:{boolean:L},scaleFactor:{number:M},type:{string:g_},imageHeight:{number:M},imageWidth:{number:M},src:{string:G},__type__:{object:ue,boolean:L}},middle:{enabled:{boolean:L},scaleFactor:{number:M},type:{string:g_},imageWidth:{number:M},imageHeight:{number:M},src:{string:G},__type__:{object:ue,boolean:L}},from:{enabled:{boolean:L},scaleFactor:{number:M},type:{string:g_},imageWidth:{number:M},imageHeight:{number:M},src:{string:G},__type__:{object:ue,boolean:L}},__type__:{string:["from","to","middle"],object:ue}},endPointOffset:{from:{number:M},to:{number:M},__type__:{object:ue,number:M}},arrowStrikethrough:{boolean:L},background:{enabled:{boolean:L},color:{string:G},size:{number:M},dashes:{boolean:L,array:oo},__type__:{object:ue,boolean:L}},chosen:{label:{boolean:L,function:"function"},edge:{boolean:L,function:"function"},__type__:{object:ue,boolean:L}},color:{color:{string:G},highlight:{string:G},hover:{string:G},inherit:{string:["from","to","both"],boolean:L},opacity:{number:M},__type__:{object:ue,string:G}},dashes:{boolean:L,array:oo},font:{color:{string:G},size:{number:M},face:{string:G},background:{string:G},strokeWidth:{number:M},strokeColor:{string:G},align:{string:["horizontal","top","middle","bottom"]},vadjust:{number:M},multi:{boolean:L,string:G},bold:{color:{string:G},size:{number:M},face:{string:G},mod:{string:G},vadjust:{number:M},__type__:{object:ue,string:G}},boldital:{color:{string:G},size:{number:M},face:{string:G},mod:{string:G},vadjust:{number:M},__type__:{object:ue,string:G}},ital:{color:{string:G},size:{number:M},face:{string:G},mod:{string:G},vadjust:{number:M},__type__:{object:ue,string:G}},mono:{color:{string:G},size:{number:M},face:{string:G},mod:{string:G},vadjust:{number:M},__type__:{object:ue,string:G}},__type__:{object:ue,string:G}},hidden:{boolean:L},hoverWidth:{function:"function",number:M},label:{string:G,undefined:"undefined"},labelHighlightBold:{boolean:L},length:{number:M,undefined:"undefined"},physics:{boolean:L},scaling:{min:{number:M},max:{number:M},label:{enabled:{boolean:L},min:{number:M},max:{number:M},maxVisible:{number:M},drawThreshold:{number:M},__type__:{object:ue,boolean:L}},customScalingFunction:{function:"function"},__type__:{object:ue}},selectionWidth:{function:"function",number:M},selfReferenceSize:{number:M},selfReference:{size:{number:M},angle:{number:M},renderBehindTheNode:{boolean:L},__type__:{object:ue}},shadow:{enabled:{boolean:L},color:{string:G},size:{number:M},x:{number:M},y:{number:M},__type__:{object:ue,boolean:L}},smooth:{enabled:{boolean:L},type:{string:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"]},roundness:{number:M},forceDirection:{string:["horizontal","vertical","none"],boolean:L},__type__:{object:ue,boolean:L}},title:{string:G,undefined:"undefined"},width:{number:M},widthConstraint:{maximum:{number:M},__type__:{object:ue,boolean:L,number:M}},value:{number:M,undefined:"undefined"},__type__:{object:ue}},groups:{useDefaultGroups:{boolean:L},__any__:m_,__type__:{object:ue}},interaction:{dragNodes:{boolean:L},dragView:{boolean:L},hideEdgesOnDrag:{boolean:L},hideEdgesOnZoom:{boolean:L},hideNodesOnDrag:{boolean:L},hover:{boolean:L},keyboard:{enabled:{boolean:L},speed:{x:{number:M},y:{number:M},zoom:{number:M},__type__:{object:ue}},bindToWindow:{boolean:L},autoFocus:{boolean:L},__type__:{object:ue,boolean:L}},multiselect:{boolean:L},navigationButtons:{boolean:L},selectable:{boolean:L},selectConnectedEdges:{boolean:L},hoverConnectedEdges:{boolean:L},tooltipDelay:{number:M},zoomView:{boolean:L},zoomSpeed:{number:M},__type__:{object:ue}},layout:{randomSeed:{undefined:"undefined",number:M,string:G},improvedLayout:{boolean:L},clusterThreshold:{number:M},hierarchical:{enabled:{boolean:L},levelSeparation:{number:M},nodeSpacing:{number:M},treeSpacing:{number:M},blockShifting:{boolean:L},edgeMinimization:{boolean:L},parentCentralization:{boolean:L},direction:{string:["UD","DU","LR","RL"]},sortMethod:{string:["hubsize","directed"]},shakeTowards:{string:["leaves","roots"]},__type__:{object:ue,boolean:L}},__type__:{object:ue}},manipulation:{enabled:{boolean:L},initiallyActive:{boolean:L},addNode:{boolean:L,function:"function"},addEdge:{boolean:L,function:"function"},editNode:{function:"function"},editEdge:{editWithoutDrag:{function:"function"},__type__:{object:ue,boolean:L,function:"function"}},deleteNode:{boolean:L,function:"function"},deleteEdge:{boolean:L,function:"function"},controlNodeStyle:m_,__type__:{object:ue,boolean:L}},nodes:m_,physics:{enabled:{boolean:L},barnesHut:{theta:{number:M},gravitationalConstant:{number:M},centralGravity:{number:M},springLength:{number:M},springConstant:{number:M},damping:{number:M},avoidOverlap:{number:M},__type__:{object:ue}},forceAtlas2Based:{theta:{number:M},gravitationalConstant:{number:M},centralGravity:{number:M},springLength:{number:M},springConstant:{number:M},damping:{number:M},avoidOverlap:{number:M},__type__:{object:ue}},repulsion:{centralGravity:{number:M},springLength:{number:M},springConstant:{number:M},nodeDistance:{number:M},damping:{number:M},__type__:{object:ue}},hierarchicalRepulsion:{centralGravity:{number:M},springLength:{number:M},springConstant:{number:M},nodeDistance:{number:M},damping:{number:M},avoidOverlap:{number:M},__type__:{object:ue}},maxVelocity:{number:M},minVelocity:{number:M},solver:{string:["barnesHut","repulsion","hierarchicalRepulsion","forceAtlas2Based"]},stabilization:{enabled:{boolean:L},iterations:{number:M},updateInterval:{number:M},onlyDynamicEdges:{boolean:L},fit:{boolean:L},__type__:{object:ue,boolean:L}},timestep:{number:M},adaptiveTimestep:{boolean:L},wind:{x:{number:M},y:{number:M},__type__:{object:ue}},__type__:{object:ue,boolean:L}},autoResize:{boolean:L},clickToUse:{boolean:L},locale:{string:G},locales:{__any__:{any:Qie},__type__:{object:ue}},height:{string:G},width:{string:G},__type__:{object:ue}},W5={nodes:{borderWidth:[1,0,10,1],borderWidthSelected:[2,0,10,1],color:{border:["color","#2B7CE9"],background:["color","#97C2FC"],highlight:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]},hover:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]}},opacity:[0,0,1,.1],fixed:{x:!1,y:!1},font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[0,0,50,1],strokeColor:["color","#ffffff"]},hidden:!1,labelHighlightBold:!0,physics:!0,scaling:{min:[10,0,200,1],max:[30,0,200,1],label:{enabled:!1,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},shape:["ellipse","box","circle","database","diamond","dot","square","star","text","triangle","triangleDown","hexagon"],shapeProperties:{borderDashes:!1,borderRadius:[6,0,20,1],interpolation:!0,useImageSize:!1},size:[25,0,200,1]},edges:{arrows:{to:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},middle:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},from:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"}},endPointOffset:{from:[0,-10,10,1],to:[0,-10,10,1]},arrowStrikethrough:!0,color:{color:["color","#848484"],highlight:["color","#848484"],hover:["color","#848484"],inherit:["from","to","both",!0,!1],opacity:[1,0,1,.05]},dashes:!1,font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[2,0,50,1],strokeColor:["color","#ffffff"],align:["horizontal","top","middle","bottom"]},hidden:!1,hoverWidth:[1.5,0,5,.1],labelHighlightBold:!0,physics:!0,scaling:{min:[1,0,100,1],max:[15,0,100,1],label:{enabled:!0,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},selectionWidth:[1.5,0,5,.1],selfReferenceSize:[20,0,200,1],selfReference:{size:[20,0,200,1],angle:[Math.PI/2,-6*Math.PI,6*Math.PI,Math.PI/8],renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},smooth:{enabled:!0,type:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"],forceDirection:["horizontal","vertical","none"],roundness:[.5,0,1,.05]},width:[1,0,30,1]},layout:{hierarchical:{enabled:!1,levelSeparation:[150,20,500,5],nodeSpacing:[100,20,500,5],treeSpacing:[200,20,500,5],blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:["UD","DU","LR","RL"],sortMethod:["hubsize","directed"],shakeTowards:["leaves","roots"]}},interaction:{dragNodes:!0,dragView:!0,hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1,hover:!1,keyboard:{enabled:!1,speed:{x:[10,0,40,1],y:[10,0,40,1],zoom:[.02,0,.1,.005]},bindToWindow:!0,autoFocus:!0},multiselect:!1,navigationButtons:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0,tooltipDelay:[300,0,1e3,25],zoomView:!0,zoomSpeed:[1,.1,2,.1]},manipulation:{enabled:!1,initiallyActive:!1},physics:{enabled:!0,barnesHut:{theta:[.5,.1,1,.05],gravitationalConstant:[-2e3,-3e4,0,50],centralGravity:[.3,0,10,.05],springLength:[95,0,500,5],springConstant:[.04,0,1.2,.005],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},forceAtlas2Based:{theta:[.5,.1,1,.05],gravitationalConstant:[-50,-500,0,1],centralGravity:[.01,0,1,.005],springLength:[95,0,500,5],springConstant:[.08,0,1.2,.005],damping:[.4,0,1,.01],avoidOverlap:[0,0,1,.01]},repulsion:{centralGravity:[.2,0,10,.05],springLength:[200,0,500,5],springConstant:[.05,0,1.2,.005],nodeDistance:[100,0,500,5],damping:[.09,0,1,.01]},hierarchicalRepulsion:{centralGravity:[.2,0,10,.05],springLength:[100,0,500,5],springConstant:[.01,0,1.2,.005],nodeDistance:[120,0,500,5],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},maxVelocity:[50,0,150,1],minVelocity:[.1,.01,.5,.01],solver:["barnesHut","forceAtlas2Based","repulsion","hierarchicalRepulsion"],timestep:[.5,.01,1,.01],wind:{x:[0,-10,10,.1],y:[0,-10,10,.1]}}},ene=(r,e,t)=>{var i;return!!(Ii(r).call(r,"physics")&&Ii(i=W5.physics.solver).call(i,e)&&t.physics.solver!==e&&e!=="wind")};class tne{constructor(){}getDistances(e,t,i){const n={},s=e.edges;for(let a=0;a2&&arguments[2]!==void 0?arguments[2]:!1;const n=this.distanceSolver.getDistances(this.body,e,t);this._createL_matrix(n),this._createK_matrix(n),this._createE_matrix();const s=.01,o=1;let a=0;const u=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),l=5;let c=1e9,d=0,h=0,f=0,p=0,v=0;for(;c>s&&ao&&vthis.body.emitter.emit("_requestRedraw")),this.groups=new WZ,this.canvas=new kre(this.body),this.selectionHandler=new bie(this.body,this.canvas),this.interactionHandler=new zre(this.body,this.canvas,this.selectionHandler),this.view=new jre(this.body,this.canvas),this.renderer=new Dre(this.body,this.canvas),this.physics=new Ire(this.body),this.layoutEngine=new Xie(this.body),this.clustering=new qre(this.body),this.manipulation=new Jie(this.body,this.canvas,this.selectionHandler,this.interactionHandler),this.nodesHandler=new Zte(this.body,this.images,this.groups,this.layoutEngine),this.edgesHandler=new bre(this.body,this.images,this.groups),this.body.modules.kamadaKawai=new rne(this.body,150,.05),this.body.modules.clustering=this.clustering,this.canvas._create(),this.setOptions(t),this.setData(e)}_3(ae.prototype);ae.prototype.setOptions=function(r){if(r===null&&(r=void 0),r!==void 0){if(iZ.validate(r,Zie)===!0&&console.error("%cErrors have been found in the supplied options object.",v5),Gs(["locale","locales","clickToUse"],this.options,r),r.locale!==void 0&&(r.locale=$Z(r.locales||this.options.locales,r.locale)),r=this.layoutEngine.setOptions(r.layout,r),this.canvas.setOptions(r),this.groups.setOptions(r.groups),this.nodesHandler.setOptions(r.nodes),this.edgesHandler.setOptions(r.edges),this.physics.setOptions(r.physics),this.manipulation.setOptions(r.manipulation,r,this.options),this.interactionHandler.setOptions(r.interaction),this.renderer.setOptions(r.interaction),this.selectionHandler.setOptions(r.interaction),r.groups!==void 0&&this.body.emitter.emit("refreshNodes"),"configure"in r&&(this.configurator||(this.configurator=new tZ(this,this.body.container,W5,this.canvas.pixelRatio,ene)),this.configurator.setOptions(r.configure)),this.configurator&&this.configurator.options.enabled===!0){const i={nodes:{},edges:{},layout:{},interaction:{},manipulation:{},physics:{},global:{}};Ue(i.nodes,this.nodesHandler.options),Ue(i.edges,this.edgesHandler.options),Ue(i.layout,this.layoutEngine.options),Ue(i.interaction,this.selectionHandler.options),Ue(i.interaction,this.renderer.options),Ue(i.interaction,this.interactionHandler.options),Ue(i.manipulation,this.manipulation.options),Ue(i.physics,this.physics.options),Ue(i.global,this.canvas.options),Ue(i.global,this.options),this.configurator.setModuleOptions(i)}r.clickToUse!==void 0?r.clickToUse===!0?this.activator===void 0&&(this.activator=new eZ(this.canvas.frame),this.activator.on("change",()=>{this.body.emitter.emit("activate")})):(this.activator!==void 0&&(this.activator.destroy(),delete this.activator),this.body.emitter.emit("activate")):this.body.emitter.emit("activate"),this.canvas.setSize(),this.body.emitter.emit("startSimulation")}};ae.prototype._updateVisibleIndices=function(){const r=this.body.nodes,e=this.body.edges;this.body.nodeIndices=[],this.body.edgeIndices=[];for(const t in r)Object.prototype.hasOwnProperty.call(r,t)&&!this.clustering._isClusteredNode(t)&&r[t].options.hidden===!1&&this.body.nodeIndices.push(r[t].id);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const i=e[t],n=r[i.fromId],s=r[i.toId],o=n!==void 0&&s!==void 0;!this.clustering._isClusteredEdge(t)&&i.options.hidden===!1&&o&&n.options.hidden===!1&&s.options.hidden===!1&&this.body.edgeIndices.push(i.id)}};ae.prototype.bindEventListeners=function(){this.body.emitter.on("_dataChanged",()=>{this.edgesHandler._updateState(),this.body.emitter.emit("_dataUpdated")}),this.body.emitter.on("_dataUpdated",()=>{this.clustering._updateState(),this._updateVisibleIndices(),this._updateValueRange(this.body.nodes),this._updateValueRange(this.body.edges),this.body.emitter.emit("startSimulation"),this.body.emitter.emit("_requestRedraw")})};ae.prototype.setData=function(r){if(this.body.emitter.emit("resetPhysics"),this.body.emitter.emit("_resetData"),this.selectionHandler.unselectAll(),r&&r.dot&&(r.nodes||r.edges))throw new SyntaxError('Data must contain either parameter "dot" or parameter pair "nodes" and "edges", but not both.');if(this.setOptions(r&&r.options),r&&r.dot){console.warn("The dot property has been deprecated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);");const e=fZ(r.dot);this.setData(e);return}else if(r&&r.gephi){console.warn("The gephi property has been deprecated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);");const e=pZ(r.gephi);this.setData(e);return}else this.nodesHandler.setData(r&&r.nodes,!0),this.edgesHandler.setData(r&&r.edges,!0);this.body.emitter.emit("_dataChanged"),this.body.emitter.emit("_dataLoaded"),this.body.emitter.emit("initPhysics")};ae.prototype.destroy=function(){this.body.emitter.emit("destroy"),this.body.emitter.off(),this.off(),delete this.groups,delete this.canvas,delete this.selectionHandler,delete this.interactionHandler,delete this.view,delete this.renderer,delete this.physics,delete this.layoutEngine,delete this.clustering,delete this.manipulation,delete this.nodesHandler,delete this.edgesHandler,delete this.configurator,delete this.images;for(const r in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,r)&&delete this.body.nodes[r];for(const r in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,r)&&delete this.body.edges[r];mi(this.body.container)};ae.prototype._updateValueRange=function(r){let e,t,i,n=0;for(e in r)if(Object.prototype.hasOwnProperty.call(r,e)){const s=r[e].getValue();s!==void 0&&(t=t===void 0?s:Math.min(s,t),i=i===void 0?s:Math.max(s,i),n+=s)}if(t!==void 0&&i!==void 0)for(e in r)Object.prototype.hasOwnProperty.call(r,e)&&r[e].setValueRange(t,i,n)};ae.prototype.isActive=function(){return!this.activator||this.activator.active};ae.prototype.setSize=function(){return this.canvas.setSize.apply(this.canvas,arguments)};ae.prototype.canvasToDOM=function(){return this.canvas.canvasToDOM.apply(this.canvas,arguments)};ae.prototype.DOMtoCanvas=function(){return this.canvas.DOMtoCanvas.apply(this.canvas,arguments)};ae.prototype.findNode=function(){return this.clustering.findNode.apply(this.clustering,arguments)};ae.prototype.isCluster=function(){return this.clustering.isCluster.apply(this.clustering,arguments)};ae.prototype.openCluster=function(){return this.clustering.openCluster.apply(this.clustering,arguments)};ae.prototype.cluster=function(){return this.clustering.cluster.apply(this.clustering,arguments)};ae.prototype.getNodesInCluster=function(){return this.clustering.getNodesInCluster.apply(this.clustering,arguments)};ae.prototype.clusterByConnection=function(){return this.clustering.clusterByConnection.apply(this.clustering,arguments)};ae.prototype.clusterByHubsize=function(){return this.clustering.clusterByHubsize.apply(this.clustering,arguments)};ae.prototype.updateClusteredNode=function(){return this.clustering.updateClusteredNode.apply(this.clustering,arguments)};ae.prototype.getClusteredEdges=function(){return this.clustering.getClusteredEdges.apply(this.clustering,arguments)};ae.prototype.getBaseEdge=function(){return this.clustering.getBaseEdge.apply(this.clustering,arguments)};ae.prototype.getBaseEdges=function(){return this.clustering.getBaseEdges.apply(this.clustering,arguments)};ae.prototype.updateEdge=function(){return this.clustering.updateEdge.apply(this.clustering,arguments)};ae.prototype.clusterOutliers=function(){return this.clustering.clusterOutliers.apply(this.clustering,arguments)};ae.prototype.getSeed=function(){return this.layoutEngine.getSeed.apply(this.layoutEngine,arguments)};ae.prototype.enableEditMode=function(){return this.manipulation.enableEditMode.apply(this.manipulation,arguments)};ae.prototype.disableEditMode=function(){return this.manipulation.disableEditMode.apply(this.manipulation,arguments)};ae.prototype.addNodeMode=function(){return this.manipulation.addNodeMode.apply(this.manipulation,arguments)};ae.prototype.editNode=function(){return this.manipulation.editNode.apply(this.manipulation,arguments)};ae.prototype.editNodeMode=function(){return console.warn("Deprecated: Please use editNode instead of editNodeMode."),this.manipulation.editNode.apply(this.manipulation,arguments)};ae.prototype.addEdgeMode=function(){return this.manipulation.addEdgeMode.apply(this.manipulation,arguments)};ae.prototype.editEdgeMode=function(){return this.manipulation.editEdgeMode.apply(this.manipulation,arguments)};ae.prototype.deleteSelected=function(){return this.manipulation.deleteSelected.apply(this.manipulation,arguments)};ae.prototype.getPositions=function(){return this.nodesHandler.getPositions.apply(this.nodesHandler,arguments)};ae.prototype.getPosition=function(){return this.nodesHandler.getPosition.apply(this.nodesHandler,arguments)};ae.prototype.storePositions=function(){return this.nodesHandler.storePositions.apply(this.nodesHandler,arguments)};ae.prototype.moveNode=function(){return this.nodesHandler.moveNode.apply(this.nodesHandler,arguments)};ae.prototype.getBoundingBox=function(){return this.nodesHandler.getBoundingBox.apply(this.nodesHandler,arguments)};ae.prototype.getConnectedNodes=function(r){return this.body.nodes[r]!==void 0?this.nodesHandler.getConnectedNodes.apply(this.nodesHandler,arguments):this.edgesHandler.getConnectedNodes.apply(this.edgesHandler,arguments)};ae.prototype.getConnectedEdges=function(){return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler,arguments)};ae.prototype.startSimulation=function(){return this.physics.startSimulation.apply(this.physics,arguments)};ae.prototype.stopSimulation=function(){return this.physics.stopSimulation.apply(this.physics,arguments)};ae.prototype.stabilize=function(){return this.physics.stabilize.apply(this.physics,arguments)};ae.prototype.getSelection=function(){return this.selectionHandler.getSelection.apply(this.selectionHandler,arguments)};ae.prototype.setSelection=function(){return this.selectionHandler.setSelection.apply(this.selectionHandler,arguments)};ae.prototype.getSelectedNodes=function(){return this.selectionHandler.getSelectedNodeIds.apply(this.selectionHandler,arguments)};ae.prototype.getSelectedEdges=function(){return this.selectionHandler.getSelectedEdgeIds.apply(this.selectionHandler,arguments)};ae.prototype.getNodeAt=function(){const r=this.selectionHandler.getNodeAt.apply(this.selectionHandler,arguments);return r!==void 0&&r.id!==void 0?r.id:r};ae.prototype.getEdgeAt=function(){const r=this.selectionHandler.getEdgeAt.apply(this.selectionHandler,arguments);return r!==void 0&&r.id!==void 0?r.id:r};ae.prototype.selectNodes=function(){return this.selectionHandler.selectNodes.apply(this.selectionHandler,arguments)};ae.prototype.selectEdges=function(){return this.selectionHandler.selectEdges.apply(this.selectionHandler,arguments)};ae.prototype.unselectAll=function(){this.selectionHandler.unselectAll.apply(this.selectionHandler,arguments),this.selectionHandler.commitWithoutEmitting.apply(this.selectionHandler),this.redraw()};ae.prototype.redraw=function(){return this.renderer.redraw.apply(this.renderer,arguments)};ae.prototype.getScale=function(){return this.view.getScale.apply(this.view,arguments)};ae.prototype.getViewPosition=function(){return this.view.getViewPosition.apply(this.view,arguments)};ae.prototype.fit=function(){return this.view.fit.apply(this.view,arguments)};ae.prototype.moveTo=function(){return this.view.moveTo.apply(this.view,arguments)};ae.prototype.focus=function(){return this.view.focus.apply(this.view,arguments)};ae.prototype.releaseNode=function(){return this.view.releaseNode.apply(this.view,arguments)};ae.prototype.getOptionsFromConfigurator=function(){let r={};return this.configurator&&(r=this.configurator.getOptions.apply(this.configurator)),r};const ine=wr({__name:"EditorWindow",setup(r){const e=Pr();return fw(async()=>{if(!e.value)return;const t=await IU(),i={nodes:t.nodes,edges:t.edges},n={};new ae(e.value,i,n)}),(t,i)=>(Ct(),bi(Rt,null,[gt(_w,null,{default:_u(()=>i[0]||(i[0]=[Ie("div",null," Редактор сценариев ",-1)])),_:1}),Ie("div",{ref_key:"network",ref:e,class:"graph-container"},null,512)],64))}}),nne=Tu(ine,[["__scopeId","data-v-b9737d2d"]]),sne=wr({__name:"EditorView",setup(r){return(e,t)=>(Ct(),xi(nne))}}),one=wr({__name:"GamesWindow",setup(r){return(e,t)=>(Ct(),xi(_w,null,{default:_u(()=>t[0]||(t[0]=[Ie("div",null," Каталог игр ",-1)])),_:1}))}}),ane=wr({__name:"GamesView",setup(r){return(e,t)=>(Ct(),xi(one))}}),J_=fU({history:H4("/"),routes:[{path:"/",name:"home",component:dV},{path:"/editor",name:"editor",component:sne},{path:"/games",name:"games",component:ane}]}),$0=u4(vU);$0.use(h4());$0.use(J_);$0.mount("#app"); diff --git a/cmd/evening_detective/static/admin/assets/index-CcF8a8OC.css b/cmd/evening_detective/static/admin/assets/index-CpjiKclx.css similarity index 96% rename from cmd/evening_detective/static/admin/assets/index-CcF8a8OC.css rename to cmd/evening_detective/static/admin/assets/index-CpjiKclx.css index 4a20894..5a75a55 100644 --- a/cmd/evening_detective/static/admin/assets/index-CcF8a8OC.css +++ b/cmd/evening_detective/static/admin/assets/index-CpjiKclx.css @@ -1 +1 @@ -:root{--vt-c-white: #ffffff;--vt-c-white-soft: #f8f8f8;--vt-c-white-mute: #f2f2f2;--vt-c-black: #181818;--vt-c-black-soft: #222222;--vt-c-black-mute: #282828;--vt-c-indigo: #2c3e50;--vt-c-divider-light-1: rgba(60, 60, 60, .29);--vt-c-divider-light-2: rgba(60, 60, 60, .12);--vt-c-divider-dark-1: rgba(84, 84, 84, .65);--vt-c-divider-dark-2: rgba(84, 84, 84, .48);--vt-c-text-light-1: var(--vt-c-indigo);--vt-c-text-light-2: rgba(60, 60, 60, .66);--vt-c-text-dark-1: var(--vt-c-white);--vt-c-text-dark-2: rgba(235, 235, 235, .64);--main-color: rgba(34, 50, 60, 1);--second-color: rgb(97, 74, 22);--main-back-color: rgba(240, 240, 240, 1);--main-back-item-color: rgba(254, 254, 254, 1)}:root{--color-background: var(--vt-c-white);--color-background-soft: var(--vt-c-white-soft);--color-background-mute: var(--vt-c-white-mute);--color-border: var(--vt-c-divider-light-2);--color-border-hover: var(--vt-c-divider-light-1);--color-heading: var(--vt-c-text-light-1);--color-text: var(--vt-c-text-light-1);--section-gap: 160px}*,*:before,*:after{box-sizing:border-box;margin:0;font-weight:400}body{min-height:100dvh;color:var(--color-text);background:var(--main-back-color);transition:color .5s,background-color .5s;line-height:1.6;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:15px;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.input-custom{width:100%;box-sizing:border-box;margin-bottom:15px}.button-custom{margin-left:auto;background-color:var(--main-color);font-weight:600;color:#fff}.button-custom-inline{margin:10px;background-color:var(--main-color);font-weight:600;color:#fff;padding:6px 8px;border:1px solid #ddd;border-radius:15px;font-size:14px}.button-custom:hover,.button-custom-inline:hover{background-color:var(--second-color)}.input-custom,.button-custom{padding:12px 16px;border:1px solid #ddd;border-radius:15px;font-size:16px}.button-container{display:flex}.center-message{display:flex;justify-content:center;align-items:center;height:calc(100dvh - 100px);text-align:center}.qr[data-v-666b8d35]{position:absolute;top:130px;right:30px;text-align:center;width:120px}.header-block[data-v-5b6894ef]{background-color:var(--main-color);font-size:large;color:#fff;vertical-align:middle;padding:10px 0 10px 16px;font-weight:700}.buttons-block[data-v-27835e5c]{padding-top:5px}.button-menu[data-v-27835e5c]{margin:5px 10px 5px 0}table[data-v-27835e5c]{width:700px;border-collapse:collapse;margin:30px auto;border:1px solid #444444}th[data-v-27835e5c],td[data-v-27835e5c]{padding:12px;text-align:left}th[data-v-27835e5c]{background-color:var(--main-color);color:#fff;font-weight:700}tr[data-v-27835e5c]:nth-child(odd){background-color:#efefef}tr[data-v-27835e5c]:nth-child(2n){background-color:#fff}tr[data-v-27835e5c]:hover{background-color:#cfcfcf}.time[data-v-27835e5c]{white-space:nowrap}.team-name[data-v-27835e5c]{font-weight:600}.link-button[data-v-27835e5c]{display:inline;border:none;background:none;padding:0;margin:0;font:inherit;cursor:pointer;color:var(--main-color);text-decoration:underline;font-weight:600;-webkit-appearance:none;-moz-appearance:none;appearance:none;line-height:inherit;text-align:left}.link-button[data-v-27835e5c]:hover{color:var(--second-color);text-decoration:none}.link-button[data-v-27835e5c]:active{color:#036}.link-button[data-v-27835e5c]:focus{outline:none;text-decoration:none;box-shadow:0 0 0 2px #0066cc4d}.form-block[data-v-27835e5c]{width:700px;margin:0 auto}a[data-v-27835e5c]{color:var(--second-color);text-decoration:none;transition:all .2s ease;cursor:pointer}a[data-v-27835e5c]:hover{text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:3px}a[data-v-27835e5c]:focus-visible{outline:2px solid #3182ce;outline-offset:2px;border-radius:2px}a[disabled][data-v-27835e5c]{color:#a0aec0;pointer-events:none;cursor:not-allowed}.button-container[data-v-27835e5c]{margin-bottom:30px}.cell-center[data-v-27835e5c]{text-align:center}.graph-container[data-v-3a1f22ee]{width:100%;height:700px;border:1px solid #e0e0e0;border-radius:8px} +:root{--vt-c-white: #ffffff;--vt-c-white-soft: #f8f8f8;--vt-c-white-mute: #f2f2f2;--vt-c-black: #181818;--vt-c-black-soft: #222222;--vt-c-black-mute: #282828;--vt-c-indigo: #2c3e50;--vt-c-divider-light-1: rgba(60, 60, 60, .29);--vt-c-divider-light-2: rgba(60, 60, 60, .12);--vt-c-divider-dark-1: rgba(84, 84, 84, .65);--vt-c-divider-dark-2: rgba(84, 84, 84, .48);--vt-c-text-light-1: var(--vt-c-indigo);--vt-c-text-light-2: rgba(60, 60, 60, .66);--vt-c-text-dark-1: var(--vt-c-white);--vt-c-text-dark-2: rgba(235, 235, 235, .64);--main-color: rgba(34, 50, 60, 1);--second-color: rgb(97, 74, 22);--main-back-color: rgba(240, 240, 240, 1);--main-back-item-color: rgba(254, 254, 254, 1)}:root{--color-background: var(--vt-c-white);--color-background-soft: var(--vt-c-white-soft);--color-background-mute: var(--vt-c-white-mute);--color-border: var(--vt-c-divider-light-2);--color-border-hover: var(--vt-c-divider-light-1);--color-heading: var(--vt-c-text-light-1);--color-text: var(--vt-c-text-light-1);--section-gap: 160px}*,*:before,*:after{box-sizing:border-box;margin:0;font-weight:400}body{min-height:100dvh;color:var(--color-text);background:var(--main-back-color);transition:color .5s,background-color .5s;line-height:1.6;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:15px;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.input-custom{width:100%;box-sizing:border-box;margin-bottom:15px}.button-custom{margin-left:auto;background-color:var(--main-color);font-weight:600;color:#fff}.button-custom-inline{margin:10px;background-color:var(--main-color);font-weight:600;color:#fff;padding:6px 8px;border:1px solid #ddd;border-radius:15px;font-size:14px}.button-custom:hover,.button-custom-inline:hover{background-color:var(--second-color)}.input-custom,.button-custom{padding:12px 16px;border:1px solid #ddd;border-radius:15px;font-size:16px}.button-container{display:flex}.center-message{display:flex;justify-content:center;align-items:center;height:calc(100dvh - 100px);text-align:center}.qr[data-v-666b8d35]{position:absolute;top:130px;right:30px;text-align:center;width:120px}.header-block[data-v-5b6894ef]{background-color:var(--main-color);font-size:large;color:#fff;vertical-align:middle;padding:10px 0 10px 16px;font-weight:700}.buttons-block[data-v-27835e5c]{padding-top:5px}.button-menu[data-v-27835e5c]{margin:5px 10px 5px 0}table[data-v-27835e5c]{width:700px;border-collapse:collapse;margin:30px auto;border:1px solid #444444}th[data-v-27835e5c],td[data-v-27835e5c]{padding:12px;text-align:left}th[data-v-27835e5c]{background-color:var(--main-color);color:#fff;font-weight:700}tr[data-v-27835e5c]:nth-child(odd){background-color:#efefef}tr[data-v-27835e5c]:nth-child(2n){background-color:#fff}tr[data-v-27835e5c]:hover{background-color:#cfcfcf}.time[data-v-27835e5c]{white-space:nowrap}.team-name[data-v-27835e5c]{font-weight:600}.link-button[data-v-27835e5c]{display:inline;border:none;background:none;padding:0;margin:0;font:inherit;cursor:pointer;color:var(--main-color);text-decoration:underline;font-weight:600;-webkit-appearance:none;-moz-appearance:none;appearance:none;line-height:inherit;text-align:left}.link-button[data-v-27835e5c]:hover{color:var(--second-color);text-decoration:none}.link-button[data-v-27835e5c]:active{color:#036}.link-button[data-v-27835e5c]:focus{outline:none;text-decoration:none;box-shadow:0 0 0 2px #0066cc4d}.form-block[data-v-27835e5c]{width:700px;margin:0 auto}a[data-v-27835e5c]{color:var(--second-color);text-decoration:none;transition:all .2s ease;cursor:pointer}a[data-v-27835e5c]:hover{text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:3px}a[data-v-27835e5c]:focus-visible{outline:2px solid #3182ce;outline-offset:2px;border-radius:2px}a[disabled][data-v-27835e5c]{color:#a0aec0;pointer-events:none;cursor:not-allowed}.button-container[data-v-27835e5c]{margin-bottom:30px}.cell-center[data-v-27835e5c]{text-align:center}.graph-container[data-v-b9737d2d]{width:100%;height:calc(100vh - 50px);border:1px solid #e0e0e0;border-radius:8px} diff --git a/cmd/evening_detective/static/admin/index.html b/cmd/evening_detective/static/admin/index.html index 878a825..c0c1672 100644 --- a/cmd/evening_detective/static/admin/index.html +++ b/cmd/evening_detective/static/admin/index.html @@ -5,8 +5,8 @@ ВД Админка - - + +
diff --git a/data/story/story.json b/data/story/story.json index c6dad0a..3b804f2 100644 --- a/data/story/story.json +++ b/data/story/story.json @@ -1 +1,163 @@ -{"places":[{"code":"ЛП-1","name":"Шезлонги","text":"Воздух пахнет речной водой, нагретым деревом и сладковатым ароматом засохшего коктейля. Утреннее солнце подсвечивает пылинки, кружащиеся в воздухе. \nДесяток аккуратно расставленных шезлонгов с пастельно-голубыми полосатыми матрасами, под цвет балетных пачек. Каркасы — из потемневшего от солёного воздуха тика, с небольшими табличками, указывающими номера кают. Утром они стоят пустые, лишь на некоторых остались следы вчерашнего вечера:\nНа одном — пустой бокал с подтаявшим дном, прилипший к подстаканнику. Внутри болтается синий бумажный зонтик.\nПод третьим шезлонгом, в тени, валяется небольшая розовая заколка-краб."},{"code":"ЛП-2","name":"Бассейн","text":"Небольшой, но живописный бассейн в форме лебедя. Вода чуть мутновата от ночной прохлады, на поверхности плавает несколько опавших лепестков от цветочных композиций с вечеринки. По краям — синие пластиковые шезлонги и плетёные столики."},{"code":"ЛП-3","name":"Прохладительные напитки","text":"Небольшая стойка-бар под тентом у бассейна. За прилавком — ряды бутылок с яркими сиропами, содовой в сифонах и медный холодильник, густо покрытый конденсатом. Утром бар не работает, но на стойке остались следы вчерашней суеты."},{"code":"ТЗ","name":"Танцевальный зал","text":"— Господа артисты, а теперь растяжка самостоятельно, к нам гости.\nВас встречает Маргарита Станиславовна. \n— Почему не в форме, вчера вы отлично танцевали с нами вместе.\nВы рассказываете события которые застали вас с первыми лучами солнца. \n— Я вчера была в том баре, и девочки там были. Этот мужчина в пиджаке за баром сидел, не нравится он мне, телефоном своим тыкал бармену в лицо, мне даже жалко мальчишку стало. А потом пришел этот мясник, злой весь пыхтел. Я чего заметила то, он меня каждый вечер танцевать зовет, а вчера с барменом поговорил, услышала только “Придумай что нибудь до 11”, и пулей вылетел из бара([Р-1])([К-323])."},{"code":"Р-1","name":"Ресторан «Фуэте \u0026 Фуа-гра»","text":"Вас встречает высокий грузный мужчина лет 40, Игорь Ковалев, шеф повар ресторана. Кухня кипит, повара работают, персонал бегает, в этот момент раздается звук бьющегося стекла и крик шефа.\n— Откуда у тебя руки растут, огрызок. Алиса! Убери это! Семен Викторович? Конечно знаю - VIP клиент, холить и лелеять, целовать в жопу - приказ капитана. Был вчера, не самый приятный человек. Поел, был даже весел. Когда ушел, не знаю. Я отходил отнести в “Пуанты” десерт.\nВы просите поговорить с официантом который приносил вчера обед в каюту 323.\n— ГЕНА! Хороший парень. Его ещё нет. Весь вечер он был тут, а после за разбитую тарелку, он мыл посуду вместе с Алисой. Часов до 3 должны были тут быть([К-405])."},{"code":"Т-1","name":"Туалет","text":"— Все уделали, паразиты, а мне опять отмывай. Проклятый бар.\nОсмотрев комнату уже нельзя было понять что кому-то здесь было плохо, тётя Глаша тут уже все убрала.([К-406])"},{"code":"Б-1","name":"Бар «Пуанты вверх!»","text":"С утра бар закрыт, приглушённое освещение и тишина делают его похожим на театральные кулисы после спектакля. Стойка липкая от пролитых напитков, на её поверхности — засохшие круги от бокалов, рассыпанная соль, мятные палочки и крошки от орешков. Под стойкой, рядом с мусорным ведром, валяется смятая пачка сигарет «Ява» и один синий пластиковый зонтик для коктейлей."},{"code":"К","name":"Костюмерная","text":"Тесное, забитое до потолка стеллажами помещение. Повсюду висят пышные пачки, трико, перья и блестящие аксессуары. Пахнет нафталином, гримом и пудрой. На большом столе у зеркала — беспорядок: коробка с нитками и иголками, пустой тюбик мази «от усталости ног» и распечатанная афиша вчерашнего выступления с автографом."},{"code":"К-200","name":"Каюта 200","text":"Дверь закрыта."},{"code":"К-201","name":"Каюта 201","text":"Дверь закрыта."},{"code":"К-202","name":"Каюта 202","text":"Вам открывает дверь невысокий пожилой мужчина. Он встречает вас широкой улыбкой. Из разговора вы узнаете, что с обеда он до полуночи был на верхней палубе и играл на аккордеоне. Парни наверное спят еще, тяжелый денек был."},{"code":"К-203","name":"Каюта 203","text":"Дверь закрыта."},{"code":"К-204","name":"Каюта 204","text":"Вы стучитесь в дверь, которая с тихим скрипом открывается. Из каюты повеяло мягким цветочным ароматом. Вы проходите в комнату, никого нет. Осмотревшись, Вы замечаете пачку фотографий на столе среди которых вы встречаете и фото вчерашнего вечера.","applications":[{"name":"Фото"}]},{"code":"К-205","name":"Каюта 205","text":"Дверь закрыта."},{"code":"К-206","name":"Каюта 206","text":"На двери висит расписание занятий в танцевальном зале и сейчас Маргарита Станиславовна должна быть там.([ТЗ])"},{"code":"К-207","name":"Каюта 207","text":"Около каюты Вы встречаете молодую девушку, это же она танцевала вчера под звёздами. В каюте вы рассказываете что произошло и что ей грозит тюрьма. \n— Нет! Я ничего не крала! - она начинает плакать, - Я не самый хороший человек но я не нарушаю закон. Спросите руководителя, девчонок, я никогда…\nЭто дело кажется вам странным а почему-то вы верите, девушке. Хладнокровно украсть дорогой телефон, и так неудачно спрятать, что горничная находит его даже при легкой уборке.\n— Вчера всё утро мы репетировали, а после показывали историю про цыган. После был мастер класс. Вечером как обычно с девчонками заглянули в бар, Алинке там бармен Толя нравится. Там были до половины десятого, а потом на Лебединую палубу пошли, там танцы вчера были и звезды красивые, Соня нас даже сфотографировала.([ТЗ])([К-206])([К-204])([К-205])([К-409])([Б-1])\nВы с задумчивым видом получаете разрешение взять буклеты, кладете их в карман и покидаете каюту.","applications":[{"name":"Карта"}]},{"code":"К-208","name":"Каюта 208","text":"Дверь открывает сонный мужчина, одетый в пижаму темно зеленого цвета.\n— Ну собственно сыграли с Сёмочкой пару партий, рассказывал, что жена его, та еще стерва, разводятся они, а сына то, забрать хочет, вот и подала в суд, не хочет чтобы отец с сыном общался, а тот и психует. Сёмка то весь вечер в баре пил, не заметил даже, что у него бармен сумку стырил, ну я так думал, а потом увидел, что Сёмочке плохо стало, и бармен помог до туалета этому горю луковому дойти. А потом они вернулись.([К-323])"},{"code":"К-209","name":"Каюта 209","text":"— Убирайтесь прочь! - низкий голос из каюты."},{"code":"К-210","name":"Каюта 210","text":"Каюта закрыта, капитан на мостике.([КМ])"},{"code":"К-211","name":"Каюта 211","text":"Встретив старпома в коридоре, он разрешает вам исследовать его каюту, он дает вам ключи и удаляется. Идеальный порядок, пахнет свежей краской, типографской краской и металлом. Каюта похожа на кабинет штурмана. На столе — стопка уставов, навигационные приборы, распечатанный график вахт и телескоп в чехле. На стене — астрономическая карта звёздного неба, схема устройства теплохода и диплом мореходного училища. На полке — потёртый блокнот со стихами о море и лейкопластырь. Возле иллюминатора на штативе установлен телескоп, направленный на звёзды. В ящике стола, под схемами, лежит секретная шифровка о розыске контрабанды, а на её полях карандашом написано: «Груз №7 — бананы? Проверить по накладным. Капитан не слушает...». Рядом валяется пузырёк с антигистаминными таблетками.([КМ])([С])"},{"code":"Р-2","name":"Ресторан «Гранд батон»","text":"Более скромный, чем «Фуэте \u0026 Фуа-гра», но уютный ресторан на третьей палубе. Утром здесь подают завтрак: запах кофе, свежей выпечки и масла. На столиках — остатки еды, сморщенные салфетки и меню с пятном от варенья. За стойкой официанты суетятся, разнося подносы.([Р-1])"},{"code":"И","name":"Игровая комната «Золотая рыбка»","text":"Небольшая комната с игрушками, столом для рисования и несколькими стеллажами книг за кафедрой. Так же имеется записка “По вопросам работы библиотеки и игровой комнаты, обращаться в каюту 412” Похоже руководитель комнаты еще не пришел. За кафедрой вы находите засаленный учебник по мореходству и пачку читательских билетов. В центре сидит девочка и строит башню из металлического конструктора. На полу валяется плюшевая пчёлка и раскраска с кораблём. В углу стоит жестяная коробка с надписью «Юный архитектор». На ваши вопросы она не отвечает.([К-412])([К-306])"},{"code":"Т-2","name":"Туалет","text":"Чисто, пахнет хлоркой. На полу — мокрый след от швабры. Ведро для мусора переполнено смятыми бумажками и обёртками от леденцов."},{"code":"Б-2","name":"Бар «Гранд шот»","text":"У барной стойке никого нет. На столешнице табличка с надписью:\nРаботаем с 12:00"},{"code":"А","name":"Администрация","text":"Заходя в помещение, вы замечаете небольшое пространство с диванчиком, а также рабочий стол в углу.\n— Да-да, я знаю про трагедию, а Вы тот самый детектив о котором все только и говорят? Очень приятно Валерия Сергеевна Громова, администратор.\nНа полках много папок но все расставлены в идеальном порядке по годам и рейсам, кажется ошибок быть не может.\n— Вот вам список пассажиров, в этот раз не все каюты заняты, одну даже выкупили но не поплыли с нами, я там отметила. Все пассажиры у нас хорошие вежливые. А я вчера вечером уже спала, режим, да и остановка сегодня большая работы много. А теперь еще и эта кража. Больше ничем помочь не могу.([К-319])","applications":[{"name":"Список пассажиров"}]},{"code":"К-300","name":"Каюта 300","text":"— Проходите, садитесь.\nВ её каюте пахнет духами и воспоминаниями. На столе — программки старых балетов, фото в роли Жизели на столе.\n— Это я. Хорошие были времена. А вот в кардебалете Витя Кораблев он с нами плывет. Хороший парень был. Связался с плохой компанией. \nНа фотографии вы видите шеф-повара. Моложе худее, но это точно он!\n— Его в 90-е поймали на хранении наркотиков, они называли его “скорость”. Красивое название, вы не находите? Тогда и пропал.([Р-1])([К-401])"},{"code":"К-301","name":"Каюта 301","text":"— Я думаю это инопланетяне, даже Анжела поверила. Вчера такая вспышка была, и она двигалась Дима подтвердит. Зачем им телефон я не знаю, могли же кого-нибудь украсть, А все пассажиры на месте?([К-207])([К-305])"},{"code":"К-302","name":"Каюта 302","text":"— Кто там? Мне папа запрещает открывать незнакомым, а он ещё спит."},{"code":"К-303","name":"Каюта 303","text":"Закрыто."},{"code":"К-304","name":"Каюта 304","text":"На стук никто не отвечает, прислушавшись Вы слышите легкое сопение и бормотание.\n— Какая хорошенькая девочка. … Как так напиться можно было, негодяй! … Это же совсем не ваше дело, Вам танцевать нужно, а не пирожки печь."},{"code":"К-305","name":"Каюта 305","text":"— Ты видел её глаза! Теперь то она точно поверит в НЛО! Такая вспышка интересная получилась, да все теперь поверят.\nСлышится радостный разговор из каюты."},{"code":"К-306","name":"Каюта 306","text":"— Здравствуйте, я вчера на Лебединой с дочкой весь вечер была. Салюты огни было красиво. Мужчину про которого вы говорите я там не видела. Знаете что странно было. Вчера шеф сильно наорал на бармена на коктейльном столике. Он принес ящик бананов, а другой забрал точно такой же. Я запомнила потому что Лерочка сильно напугалась. А в остальном вечер отличный был.([ЛП-3])([P-1])([К-401])"},{"code":"К-307","name":"Каюта 307","text":"— Здравствуйте, это вы занимаетесь этим делом? У меня есть несколько зацепок. Вчера около 22:00 часов была вспышка очень близко к кораблю, и тогда же и исчез телефон. Это инопланетяне, им нужны наши технологии, они изучают нас! Я раньше не верила, но факты!!!"},{"code":"К-308","name":"Каюта 308","text":"Эту каюту Вы уже видели. Тут живет отличный мальчуган, внук Григория Семеновича и Людмилы Аркадьевны, скорее всего где-то с ними сейчас.([К-310])"},{"code":"К-309","name":"Каюта 309","text":"— Здрасте, свою комнату обыскивать не позволю!!! Я завуч, я на вас жаловаться буду!\nВы пытаетесь объяснить ситуацию, и что обыскивать её вы не собираетесь. Но толку было бы больше рисуй вы на воде ровные квадраты вилами.\n— Ворует прислуга, они уже украли мою статуэтку и очки! Я найду на них и Вас управу.\nОчень вежливо извинившись вы уходите. Очки же у нее на цепочке, о статуэтка на полочке для ключей, увы сказать ей это не получится."},{"code":"К-310","name":"Каюта 310","text":"Дверь заперта, а около ручки очень аккуратно приклеен листок с кружевной надписью: “Греем косточки, ищите на верхней палубе”([ЛП-1])."},{"code":"К-311","name":"Каюта 311","text":"По коридору быстрым шагом несется Станислав с огромной клетчатой сумкой, кажется скоро его остановка. Вы кричите ему в след, но он уже Вас не слышит."},{"code":"К-312","name":"Каюта 312","text":"Виктор Павлович с которым вы познакомились еще в очереди на посадку очень рад вас видеть.\n— Проходите, дорогой друг. \nОн приглашает вас в каюту и быстро закрывает дверь. В то же мгновение улыбка на его лице исчезла.\n— Нас нашли. Это они, наводят суету чтобы нас поймать. Я не могу сказать за что нас ищут, это государственная тайна.\nЕго жена, Людмила Ивановна, насторожено посмотрела на дверь. \nПосле пятиминутной беседы но уже шепотом, вы покидаете каюту, с боязнью что за 3 дня путешествия вы так обмякли что не заметили шпионов прямо под носом."},{"code":"К-313","name":"Каюта 313","text":"Уютный хаос из книг. На столе — «Три мушкетёра», очки и клетка с канарейкой Кешей. На тумбочке — стопки книг с закладками. На полу стоит корзинка с пряжей и следы птичьего корма.\n— Я вчера вечером ходила по коридору, уснуть долго не могла из-за музыки сверху. И видела как мальчишка зашел в каюту Катеньки в белой рубашке был и брюках. Еще шапочка была. Я с катенькой болтаю иногда, она молодец хочет в большой пойти, на пробы едет. Ой, я же забыла ей рассказать что вор был.\nВы обещаете что всё передадите и уходите.([К-207])"},{"code":"К-314","name":"Каюта 314","text":"Доносится громкий женский храп! Не стоит будить такую женщину."},{"code":"К-315","name":"Каюта 315","text":"— Я ничего не крал! Я просто погоду смотрел! Я не знаю вашего ну того обокраденного.\nДверь он так и не открыл, скрывает он что-то.([К-323])"},{"code":"К-316","name":"Каюта 316","text":"Из двери доносится легкий запах канифоли.\n— Здравствуйте, проходите. Я про вас слышал. Вернее читал в газете. Тогда в лагере мой ребенок отдыхал. Но он ничего не знает я не рассказывал, но спасибо огромное. \nОн крепко жмет Вашу руку.\n— Вы видели эту молодежь верят в привидения, и ползают везде. Я их даже в запретной зоне видел. А туда же нельзя. Ух руки бы им поотрывать. Столько радиоэлементов на свои глупости тратят, и откуда деньги!"},{"code":"К-317","name":"Каюта 317","text":"Дверь закрыта. На стук никто не отвечает."},{"code":"К-318","name":"Каюта 318","text":"— Ты это куда, сердешный? Я тут. А там никого нет.\nПрогремел мужчина у 320 каюты.([К-320])"},{"code":"К-319","name":"Каюта 319","text":"Закрыто."},{"code":"К-320","name":"Каюта 320","text":"У двери вас встречает охранник. Обыскав вас он стучит в дверь каюты. Вам открывает мужчина плотного телосложения в водолазке и толстой цепи. \n— Заходите, слышал конечно, весь корабль гудит. Я даже хотел отправить Гришу искать, но администратор запретила, говорит не законно это. Не то чтобы я закона боюсь, но паники нам тут не надо.\nОн как то зло улыбнулся.\n— Я вам вот что скажу мои соседи - очень подозрительные ребята, из 305 постоянно что-то бормочет себе под нос. Поехавший, зуб даю. Гриша его уже дважды сломать хотел. А больше ничего подозрительного не видел, да я и не ищу, больше не ищу.\nОн ухмыльнулся и расплылся в холодной улыбке.([К-318])([А])([К-305])"},{"code":"К-321","name":"Каюта 321","text":"Ключ от этой двери вам достать не получилось, но Вас уверяют что там никого нет уже давно, и пыль в щели под дверью намекает на тоже."},{"code":"К-322","name":"Каюта 322","text":"Заперта на ключ. Из-под двери тянет запахом старой ткани и пыли. Если заглянуть в замочную скважину, можно увидеть стопки постельного белья и ведро с тряпками. Видимо, используется горничными для хранения запасов."},{"code":"К-323","name":"Каюта 323","text":"Просторная VIP каюта отличается от вашей только расположением кровати, и наличием чайника с микроволновкой. \n— Всё утро я играл в шахматы с Николаем Степанычем пока не проснулся Дмитрий Федотыч и я любезно уступил ему место на верхней палубе. После читал здесь “Записки юного врача” - он указал на книгу лежащую на столе рядом с буклетами.\n— Обед я заказал в каюту. Официант, который приносил мне блюда был очень любопытный все про телефон спрашивал, где я его купил и сколько стоит” - Семен закурил, руки его тряслись все сильнее и уже от злости.\n— Убью ворюгу! Через 2 часа остановка там я и должен позвонить сыну. Вечером отужинав с Вами и нашей милой медсестрой, я проводил последнюю до её 400-ой каюты и пошел в бар пропустить стаканчик. Я был в баре, в том что на носу, остаток вечера, и точно помню мне пришло смс, где-то в 10 часов, от жены… не будем об этом. Я и много пить не собирался вчера. В итоге даже фарфорового друга обнимал в том же баре, только никому не говорите. Больше ничего не помню, проснулся думал проспал время звонка и потянулся за телефоном, дальше вы знаете.\nТолько он завершил свой рассказ, в дверь каюты кто-то постучался. \n— Войдите.\nТётя Глаша взволнованно открыла дверь. Я случайно нашла ваш телефон в 207-ой. Вы забираете телефон: \n— Никому не говорите что нашли его.\nТелефон найден дело закрыто! Слишком просто. Вы убеждаете Семёна никому ничего не говорить пока Вы не разрешите. И направляетесь в 207-ую каюту([К-208])([К-209])([К-400])([Р-1])([Б-1])([к-207])([К-406]).","applications":[{"name":"Список смс"}]},{"code":"К-324","name":"Каюта 324","text":"Незаправленная кровать, выдает не самое спокойное утро, приняв холодный душ, Вы садитесь в кресло и начинаете вспоминать события вчерашнего дня. Прекрасный спектакль на первой палубе, со сцены три неотразимые молодые танцовщицы в образе цыганок рассказывали историю о гадании на картах. Вкуснейший ужин в ресторане «Фуэте \u0026 Фуа-гра» состоящий из 3 блюд прелестной компании Семёна Викторовича и Эльвиры Петровны. Волшебные танцы и живая музыка под звездами и целого импровизированного шоу от Екатерины (одной из участниц труппы театра). Вы были тут - прямо в центре преступления и в шаге от его предотвращения. Что ж, за дело, нужно опросить потерпевшего, он живет в каюте 323 [К-323] ([К-323])([ТЗ])([Р-1])([К-400])([К-207])."},{"code":"К-325","name":"Каюта 325","text":"Дверь каюты была заперта, вы присматриваетесь и понимаете что по списку этой каюты не должно быть, хмм… Как ни странно, под дверью валялась покерная фишка."},{"code":"С","name":"Склад","text":"Прохладное помещение со стеллажами до потолка. Пахнет овощами, металлом и свежестью. В углу стоят ящики с надписью «Эквадор. Бананы.». На полу — следы грязи от ботинок и белый порошок, мука похоже. На стене висит график разгрузки и список поставок."},{"code":"М","name":"Медпункт","text":"Работа с 10:00 до 20:00. В экстренных ситуациях обращаться в каюту 400.([К-400])"},{"code":"К-400","name":"Каюта 400","text":"Дверь закрыта. Постучавшись в дверь вы слышите:\n— Бегу, бегу. Что случилось? Кто-то утонул?\nПока вы рассказываете ситуацию, глаза медсестры все больше теряют к ней интерес.\n— Хмм, необычное? да вроде нет… хотя… да, было кое что странное. Во время медосмотра персонала у нашего официанта Гены были вены исколоты, я еще подумала “наркоман что ли”. Ну сказал что снотворное колит. Из странного еще бабулька сумасшедшая есть одна, вроде в 300-й каюте живет, все ходит и болтает, что шеф повар наш бывший балерун.\nТут медсестра расхохоталась. На звук смеха из комнаты вышла Алиса и вы решаете опросить ее тоже\n— Вчера я весь день провела на кухне, до 12 ночи, это ужас какой то, сверхурочно я не нанималась, чертов шеф со своими бананами. Ну хоть не одна я маялась, мы с Геной вместе были. А в остальном я ничего не знаю, вам лучше поговорить с Любой и Глашей, они должны что то знать.([К-400])([Р-1])([К-405])([К-406])([К-408])([к-405])([к-300])"},{"code":"К-401","name":"Каюта 401","text":"На двери табличка “не беспокоить”. Ручка двери слегка покрылась пылью."},{"code":"К-402","name":"Каюта 402","text":"Сквозь замочную скважину ничего увидеть не получается. Взяв ключи у администратора вы открываете дверь. По всей комнате разбросаны обрывки каких-то бумаг. В мусорном ведре вы находите упаковку снотворного и пачку слабительного. На столе также рекламу агентства элитной недвижимости с пометками и журнал сотовых телефонов и надпись: “3 штуки”. В тумбочке вы находите паспорт на имя Виктора Кораблева и билет в “большой театр”."},{"code":"К-403","name":"Каюта 403","text":"Книга рецептов, фото семьи и расписание смен. На стене висит график готовки и список обязанностей с кучей пометок и советов. В углу стоит чемодан, а на вешалке 3 чистых выглаженных фартука. На тумбочке — два будильника и записка:\n\t“У тебя всё получится - мама и папа.”\nВы спрашиваете про вип гостей.\n— У нас много гостей, я знаю всех, но как-то особенно к ним не отношусь. Обслуживаю всех по высшему классу. Я хочу когда-нибудь стать шефом. Начальство довольно. Правда я еще не могу спорить с капитаном или шефом, опытом они меня побеждают многократно. Но я учусь. А вечером я был здесь перечитал книгу рецептов из рыбы, вчерашний хаос на кухне меня совсем с толку сбил, хорошо что он закончился. Повара были раздражены этим инцидентом, но это наше внутреннее, не важно, гости довольны.([КМ])([Р-1])"},{"code":"К-404","name":"Что это?","text":"Каюта не найдена. И ее вы не отыщите её на корабле. Когда-то давно, конструктор забыл добавить ее в план."},{"code":"К-405","name":"Каюта 405","text":"Дверь открывает молодой крючковатый парень с красными глазами. Он пускает вас в каюту. На столе — форма официанта, книга «Как стать богатым» и фото матери и журнал открытый на странице с мобильными телефонами среди которых есть и модель которая пропала у вашего соседа. На стене висит расписание рейсов и мотивирующие цитаты. Под кроватью — ящик с деньгами и пустые упаковки от лекарств. На тумбочке — записка: «Завтра в 11 передача груза. Путь чист. Не опоздать.». Увидев что вы осматриваете стол он прикрывает записку:\n— Это личное, не имеете права, вчера я помогал на кухне, таскал ящики с продуктами на кухню, да шеф позавчера объявил что сегодня будет день бананов и надо принести со склада 10 ящиков.\nПопрощавшись с парнем вы выходите из каюты, после того как дверь закрылась вы слышите как бумагу начинают рвать.([Р-1])([С])"},{"code":"К-406","name":"Каюта 406","text":"Дверь открыта, но внутри никого. На столике записка:\nЕсли вам нужна внеплановая уборка номера запишитесь в книгу. \nНа столе также вы находите вязание, фото сына-милиционера и коробку конфет «Дюшес». На стене висит график уборки. В углу стоит тележка с чистящими средствами и запасные перчатки.\nВ книге запросов вы находите записи:\n— Туалет у бара на носу, пассажиру стало плохо\n— Каюта 300, сменить постельное белье\n— Склад, рассыпали муку\n— Каюта 412, раздавлен банановый пирог\n— Каюта 210, разлит ром, воняет([Т-1])([К-300])([С])([К-412])([К-210])"},{"code":"К-407","name":"Каюта 407","text":"Дверь приоткрыта. Внутри пахнет свежим бельём и мылом. На кровати — свёрнутые полотенца для гостей. Очень милая бабушка встречает вас широкой улыбкой. \n— Я с пассажирами почти не контактирую, белье горничные мне приносят. Но вот 2 дня назад приходил мальчишка официант, попросил форму почистить. Сказал на кухне мукой его осыпали. Странно потому что он пришел рано утром, там ресторан еще не работает. А еще я как-то в простыне нашла какое-то зеленое пятно.\nОна продолжает шепотом.\n— Может у нас на корабле инопланетяне, люди писают желтым.([P-1])"},{"code":"К-408","name":"Каюта 408","text":"Милая светлая комната. На столе — дневник с котиками, брелок-пчёлка и фото гитариста Алексея. На стене висит расписание и открытка от мамы. На кровати — плюшевый мишка и форма горничной. В углу стоит корзинка с подарками для пассажиров (конфеты, открытки). На тумбочке — кольцо из пробки.\n— Вчера я убирала склад и медпункт, там все как обычно было, разве что через вентиляцию я подслушала разговор с кухни, я правда не хотела. Повар ворчал на шефа, тот заставил потратить 10 ящиков бананов за день, якобы по плану должна быть рыба, а теперь чертовы бананы не дают спокойно работать, это мыло очень смешно и грустно одновременно. Су-шеф ответил что тоже был не в курсе, но Игорю Михайловичу виднее.([К-200])([С])([М])([Р-1])([К-401])([К-403])"},{"code":"К-409","name":"Каюта 409","text":"Вы стучите в грузную дверь каюты, недавно покрытую лаком. На темно коричневом фоне сияла бронзовая ручка с исцарапанной замочной скважиной, сквозь которую пробивался слабый лучик света. Дверь вам открыл худощавый парень с растрепанными волосами и как-то неловко прикрытых шапкой, окна были завешаны шторами насколько это позволяла их форма. \n— Ты кто?\nБеглым взглядом вы осмотрели каюту - койка и полтора квадратных метра, которые позволяли разве что дойти до кровати. Маленький откидной столик с бутылкой виски, и вешалка с одним крючком. У самой двери была лампочка и полочка с тремя ключами от номера.\n— Вчера я работал в баре, как и всегда. Потом пошел спать, как и всегда. Шеф живет в 402. Жалобы ему.\nИ он захлопывает дверь перед Вашим носом.([Б-1])([К-402])"},{"code":"К-410","name":"Каюта 410","text":"Каюта заперта. Из-за двери доносится сильный храп. Вы стучите в дверь приложив все усилия, на храп не прекратился. Потеряв надежду вы отворачиваясь от двери замечаете схему корабля которая отличается от той что есть у вас на этаже. Последний пункт помечен как [Б-3] - Баня.([Б-3])"},{"code":"К-411","name":"Каюта 411","text":"Дверь каюты закрыта и на стук никто-не отзывается, видимо в это раннее утро есть важные дела не только у вас."},{"code":"К-412","name":"Каюта 412","text":"Вас встречает Нина Александровна библиотекарь корабля и руководитель игровой комнаты. Вы спрашиваете ее событиях о минувшей ночи.\n— Вчера был обычный вечер, я сидела у себя в библиотеке, вечером даже ела свой любимый банановый пирог, на этом рейсе меня им балуют каждый вечер. А, знаете, шеф вчера чуть не сломал мне дверь в библиотеку, торопился куда-то, даже не извинился. Я запомнила потому что Лерочка очень испугалась, пришлось успокаивать. Извините, мне пора бежать на рабочее место.([И])([Р-1])([К-401])"},{"code":"Б-3","name":"Баня","text":"Разорвав запретные ленты вы заходите вы проходите в конец коридора с 3 дверьми. За одной их них вы находите баню, достаточно чистую и вполне рабочую. Похоже персонал корабля очень любит проводить тут время. Также тут лежит кусок картонной коробки на которой нарисованы бананы."},{"code":"ЗЗ","name":"Запретное место","text":"В коридоре вы видите желтую полосатую ленту, с предупреждением не входить. В конце коридора есть несколько дверей. Но идти туда вы не решаетесь."},{"code":"КМ","name":"Капитанский мостик","text":"— Ну что, нашли телефон? Нужно срочно его найти! Семен Викторович очень серьезный человек, нам эта шумиха с ним не нужна. И было бы лучше, если бы вы обращались к моему старпому Коваль Денису Матвеевичу, я сейчас занят, много дел накопилось([К-211])"}]} \ No newline at end of file +{ + "places": [ + { + "code": "А", + "name": "Администрация", + "text": "Тут работают директор и старший вожатый. На столе Лехи вы находите расписание на 23 августа. Стопку книг по педагогике и какие-то записки от детей — похоже они очень любили Лёху.", + "applications": [{ "name": "Расписание дня" }] + }, + { + "code": "В-1", + "name": "Вход", + "text": "Ржавые ворота с выцветшей табличкой «Добро пожаловать в «Сосновый Бор» скрипят на ветру. За ними — узкая дорога, уходящая вглубь соснового леса. На покосившемся стенде у проходной — пожелтевший плакат с информацией:\n\n\"Лагерь «Сосновый Бор» - Место, где рождаются характеры.\"\n\n«Орлы» — спортивные, загорелые, с грамотами за победы в эстафетах.\n\n«Лисы» — те, кто вместо костра сидит с книгами. Их шепотом называют «ботанами», но именно они всегда знают ответ.\n\n«Волки» — вечные нарушители. Их следы находят то на крыше столовой, то у водонапорной вышки.\n\n«Совы» — тихие художники и поэты. Их рисунки иногда находят даже в лесу.\n\nВ самом низу подпись: Директор лагеря - Виктор Сергеевич Громов." + }, + { + "code": "В-2", + "name": "Водонапорная вышка", + "text": "Труп лежит на земле с разбитой головой, рядом лежит окровавленный камень, судя по всему от него и погиб старший вожатый. Помимо следов погибшего рядом с трупом вы находите отпечатки кроссовок. Они глубокие, будто кто-то бежал или резко разворачивался. Подошва – с характерным рисунком в виде зигзагов. Также вы находите другие следы двух пар ботинок. Первые – массивные, с грубым протектором. Следы ведут к телу, затем резко обрываются – будто человек замер на месте. Вторые – аккуратные, с узким носком. Они подходят к камню, а затем удаляются в сторону вышки." + }, + { + "code": "Д", + "name": "Душ", + "text": "Вы дергаете дверь душа, она закрыта. Завхоз и повариха, сидящие на лавочке рассказали, что душ не работает – у кочегара голова болит уже вторые сутки, – и почему-то громко расхохотались. Поговорив с женщинами вы узнаете, что кормят в лагере очень плохо, даже 2 проверки приезжали – нарушений не нашли, но дети жалуются и почти не едят. Лёша сам ругаться приходил несколько раз, уж очень он за детей волновался." + }, + { + "code": "К-1", + "name": "Клуб", + "text": "В клубе вас встречает диджей Пётр.\n“Концерт как всегда душевный, все плакали обнимались, вроде все здесь были, хотя награждение “Лучший ребенок” в этот раз Лёха проводил, а не броненосец, вот его то я вчера и не видел”.\nОн рассказывает, что дискотека прошла на ура, танцевали и пели под все самые лучшие песни. Кажется он почти не общался с Лехой и до сих пор не знает, что произошло: «А какие медляки, танцевал весь лагерь, правда Макса и Даши не было. Они у нас главные знаменитости, танцуют медляки каждый вечер, а днем делают вид что противны друг другу, думают что дети верят в их притворство»" + }, + { + "code": "К-2", + "name": "Костровище", + "text": "В глубине лагеря, за последним отрядом расчищена круглая площадка, окруженная полукругом пеньков-сидушек, сколоченных из толстых спилов сосны. В центре — огромный костровой круг, выложенный из камней, почерневших от бесчисленных костров." + }, + { + "code": "К-3", + "name": "Коморка физрука", + "text": "Тесное помещение, забитое спортинвентарем до самого потолка. В углу валяется порванный мат, из которого торчит пожелтевший поролон. На полках вперемешку лежат мячи разных видов – футбольные, волейбольные, баскетбольные, – половина из которых явно спущена. Воняет резиной, потом и старыми кроссовками." + }, + { + "code": "Л", + "name": "Лавки", + "text": "Пара покосившихся деревянных скамеек, выкрашенных когда-то в зелёную краску, но теперь облезлых до серой древесины. Сиденья испещрены выцарапанными именами, сердечками и нецензурными словами – кто-то старательно выводил их гвоздём или кончиком ключа." + }, + { + "code": "М", + "name": "Медпункт", + "text": "Небольшое побелено-голубое здание в тени сосен. Внутри – приемная с выцветшими плакатами про “чистые руки” и “опасность клещей”, изолятор с двумя койками за занавеской, а дальше – общий душ и туалет. На столе стоят 3 кружки из-под чая. Печенье “Юбилейное” в открытой пачке. Медицинская карта с последней записью: “22:30 23.08.99 – Волкова С. (отряд “Орлы”) – жалобы на температуру и тошноту. Диагноз: пищевое отравление?” В мусорном ведре вы замечаете упаковку от таблетки, 3 пакетика чая и использованный презерватив. Слабый аромат духов – дешевый, сладкий, явно не медицинский." + }, + { + "code": "O-1", + "name": "Отряд 1", + "text": "Белое кирпичное здание, с выложенными кирпичом “1970”. Сбоку нарисован Чебурашка, коричневой и красной краской. Отряд опрятный, но сильно пахнет потом. Койки заправлены с армейской аккуратностью. На стене – газета с детскими стихами, где кто-то красной ручкой исправил рифмы на похабные." + }, + { + "code": "O-2", + "name": "Отряд 2", + "text": "Тени от сосен за окном рисуют на стенах полосатые узоры. Зайдя внутрь здания, вы замечаете одного из вожатых — Кирилла. Заведя разговор о произошедшем, вы по секрету узнаете, что его напарница Даша бегает на свиданки с вожатым первого отряда Максимом. Больше ничего необычного вы не заметили." + }, + { + "code": "O-3", + "name": "Отряд 3", + "text": "Приближаясь, Вы осматриваете кирпичное здание с нарисованным сбоку здания мультяшным героем. Переводя взгляд в окно, вы видите детей, разбившихся на группки: кто-то рисует, кто-то бегает, а кто-то просто сидит в сторонке. \n«Вы тоже за тем, что пропало?» — раздаётся голос за спиной. Обернувшись, вы видите мальчика лет 12 с слишком взрослым взглядом. «Лёха говорит, что если что — искать надо в лисах. Только он не договорил... что именно.» Он нервно оглядывается и исчезает за углом, оставив вас с новой загадкой и ощущением, что за вами уже наблюдают." + }, + { + "code": "O-4", + "name": "Отряд 4", + "text": "У входа в отряд вы видите десятки пар обуви, аккуратно выставленных в ряд. Среди них вы сразу замечаете кроссовки с характерным зигзагообразным протектором, слегка запачканные грязью и... чем-то тёмным у носка. «Это Катины!» — оживляется девочка с косичками, тыча пальцем в обувь. — «Она их всегда носит, даже когда дождь!»" + }, + { + "code": "П", + "name": "Площадь", + "text": "Площадь в лагере, развивается флаг России и флаг лагеря — зелёное полотно с белой сосной. Чисто выметен асфальт. Музыку здесь почти не слышно, хотя граммофон висит на ближайшем столбе." + }, + { + "code": "С-1", + "name": "Столовая", + "text": "В столовой пахнет хлоркой, висит плакат чистоты. Там вы никого не нашли." + }, + { + "code": "С-2", + "name": "Стадион", + "text": "На стадионе вы встречаете детей 3 и 4 отрядов. Вы интересуетесь, почему они не собирают вещи. Вам рассказывают, что их вожатые самые классные на земле, они приучили их к спорту — каждое утро они даже бегали с Катей вокруг стадиона и водонапорной вышки. Но сегодня последний день и Катя почему-то отправила их играть в волейбол, а бегать запретила." + }, + { + "code": "Т", + "name": "Туалет", + "text": "За туалетом вы находите пачку сигарет и записку как у Лехи, размер и бумага совпадают. На ней написано «Сегодня вам сильно повезет, не сдавайся и все получится!» Похоже кто-то раздавал печенье с предсказанием.", + "applications": [{ "name": "Газета" }] + }, + { + "code": "Ц", + "name": "Цветы", + "text": "Неровный овал, огороженный потрёпанными синими бордюрами, которые когда-то были яркими, но теперь выцвели под солнцем и покрылись трещинами. Земля в одних местах усыпана мелкими камушками, в других – потрескалась от жары, будто жаждет воды. Но вопреки всему здесь цветут бархатцы – жёлтые и оранжевые, как маленькие огоньки." + }, + { + "code": "МК", + "name": "Макс Крутов", + "text": "Перед вами парень в рваных джинсах и черной футболке, похожий на музыканта. Говорит, что был в душе вчера во время дискотеки: «Тёма был на дискотеке, а наши все вчера на медляках отжигали. Ну, я и решил помыться. Пока в душ шёл у администрации у Лехи сигарету и стрельнул. Поговорили немного, о чем я вам не могу сказать. Потом мы заметили за туалетом какие-то шорохи, Леха решил проверить, сказал, что за одно и обход сделает, якобы лишним не будет, ответственный наш» — Пока он это рассказывал мимо проходил директор — «Смотрите наш броненосец пиджак скинул, а я думал это его кожа!»." + }, + { + "code": "АК", + "name": "Артём Ковалёв", + "text": "«Я следил за детьми в клубе, даже драку девочек разнял — ребята утром подслушали ссору Лехи с Алиной и поддерживали разные стороны, как видите очень яро. Макс отпросился в душ, с парнями вчера спортом был занят весь день»." + }, + { + "code": "ДО", + "name": "Даша Орлова", + "text": "«Вчера весь вечер я сидела с детьми которые не пошли на дискотеку. Но те ребята, которые могли это подтвердить, уже уехали домой»." + }, + { + "code": "КЛ", + "name": "Кирилл Лебедев", + "text": "«Леху на втором ужине только видел, да и то он мимо прошел. Мы вчера с Аней, Катей и Темой дежурили на дискотеке. Потом сразу пошли на костер, это могла быть самая лучшая смена. Я рассказывал много историй вчера на костре и про историю лагеря и легенды разные. На свечку мы ушли в отряды — вспоминали смену, делились впечатлениями. На улицу больше не выходили, там похолодало, да и не видно уже ничего было — слишком поздно»." + }, + { + "code": "АГ", + "name": "Артём Глушко", + "text": "Артём сидит и читает книгу в своем отряде, попутно помогает ребятам собирать чемоданы. Он интересуется, удалось ли что-то узнать, рассказывает, что они с Лехой как-то застали Макса за кражей денег из кассы, и с тех пор в их отношениях была напряженность. Артем предложил вам печенье и пошел дальше помогать ребятам." + }, + { + "code": "АС", + "name": "Анна Соколова", + "text": "«Лёха был ответственным человеком и всегда помогал, иногда он делал больше чем от него требовалось. Он мог и веселые старты провести, когда физрук ленится, вёл все мероприятия лагеря со сцены, встречал проверки. Мне кажется, он некоторые проверки даже устраивал сам, чтобы лагерь лучше делать. Директор даже на него скидывал какие-то бумажные дела. Лёха был очень начитанный хоть и учился на математика, любила с ним поболтать»." + }, + { + "code": "КС", + "name": "Катя Светлова", + "text": "На диване в центре общей комнаты отряда вы встречаете молодую девушку в яркой оранжевой футболке с принтами, шортах и белых носках. Длинные волосы, собранные в небрежный хвост или косу, минимум макияжа. Она сидит в обнимку со старшими мальчиками отряда, смеётся и рассказывает им какую-то историю." + }, + { + "code": "АЗ", + "name": "Алина Зайцева", + "text": "Вы находите ее рядом с турниками. Девушка спортивного телосложения сидит на траве, прикрыв лицо капюшоном. Слезы бегут по ее лицу. “Мы встречались, хотели даже пожениться, он последнее время очень злой ходил, эта смена его совсем из колеи выбила. Рассказывать он не хотел, знаю что долго за документами засиживался уже когда все спали”." + }, + { + "code": "ВСГ", + "name": "Виктор Сергеевич Громов", + "text": "«Труп обнаружил охранник Виктор Петрович на ночном обходе, позвал меня. Я проверил пульс и позвонил в полицию. Вот вам список работников лагеря. Страшно осознавать что кто-то из них может быть убийцей».", + "applications": [{ "name": "Список работников лагеря" }] + }, + { + "code": "ЕО", + "name": "Елена Орлова", + "text": "Очень красивая статная девушка в белом халате встречает вас нежной улыбкой. \n«Во время дискотеки я была в приемной, королевская ночь по статистике самая травмоопасная. Хотя на удивление только одна девочка с температурой, я выдала таблетку и вожатая увела её обратно в отряд»." + }, + { + "code": "СС", + "name": "Сергей Смирнов", + "text": "Вы подошли к мужчине среднего роста в спортивном костюме: «Вечером телевизор смотрел, музыка долбила спать не давала. Петрович заходил, мы досмотрели “музыкальный ринг” да и побёг он. На дискотеки я не ходок, да и Лёха сказал помощь не нужна. За день набегался, дел много и не только своих, там помоги, сям помоги, никто ничего не может, вот и помогаю. Устаю, возраст как никак. Петрович попросил, вчера помочь с вывозом мусора, с тех пор в коморке и сидел. Лёху видел последний раз в воскресенье, он сказал зарядку не проводить пущай дети поспят»." + }, + { + "code": "ВПБ", + "name": "Виктор Петрович Белов", + "text": "«У меня свой режим: завтрак в 9 утра, вынос мусора в 9 вечера, в 11 вечера обход. Всю дискотеку Лёха сидел в администрации, как с концерта пришел, так и не выходил. В пол десятого я до клуба отходил проверить все ли спокойно во время дискотеки, проверил все и за клубом, площадь посмотрел — минут 30 заняло. Фонари давно у клуба не работают, пришлось с фонариком везде лазить. Тело обнаружил уже на обходе — очень перепугался и сразу в администрацию побежал».", + "applications": [{ "name": "Карта лагеря" }] + }, + { + "code": "ВД", + "name": "Вечерний детектив", + "text": "Дело №1 “Последний костёр”\n\nАвтор сценария: \nВладимир Фёдоров\n\nРедакторы:\nДарья Лисовая\nЕкатерина Бокова\nЕкатерина Бутина\nАнастасия Пушкарёва\n\nОзвучка:\nАлексей Демченко\n\nХудожники:\nВладимир Фёдоров\nАлина Заугольникова\n\nРазработчик:\nВладимир Фёдоров\n\nМы желаем вам приятной игры!" + } + ] +}