orbitchat 2.2.3 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/orbitchat.js +1 -1
- package/dist/assets/_basePickBy-BjEly54R-DqvpNhss.js +1 -0
- package/dist/assets/_baseUniq-DRc_T5HB-BD-eiKhZ.js +1 -0
- package/dist/assets/{api-CUMR6WpG.js → api-B0lJClJq.js} +1 -1
- package/dist/assets/arc-CZCQSTaI-COU74SO_.js +1 -0
- package/dist/assets/architectureDiagram-VXUJARFQ-Cfm45ePu-DpyHVagy.js +36 -0
- package/dist/assets/blockDiagram-VD42YOAC-BRbgLESd-Ck20-ft3.js +122 -0
- package/dist/assets/c4Diagram-YG6GDRKO-DLei6MnZ-CyXWsii7.js +10 -0
- package/dist/assets/channel-DkFrLL9m-pXEXdU8i.js +1 -0
- package/dist/assets/chunk-4BX2VUAB-DeMNg1Xd-CrtFwSE5.js +1 -0
- package/dist/assets/chunk-55IACEB6-_r7qMy9s-CVsj1DxS.js +1 -0
- package/dist/assets/chunk-B4BG7PRW-CIxgz8SC-at5hJRU9.js +165 -0
- package/dist/assets/chunk-DI55MBZ5-i035IDz6-DxOVU1og.js +220 -0
- package/dist/assets/chunk-FMBD7UC4-Bm0ev8jq-BTHOwKty.js +15 -0
- package/dist/assets/chunk-QN33PNHL-C8-RyAc3-DADdydNm.js +1 -0
- package/dist/assets/chunk-QZHKN3VN-DMEEp6GB-MKN7DFjX.js +1 -0
- package/dist/assets/chunk-TZMSLE5B-CNFsEzOl-BT3YM95Y.js +1 -0
- package/dist/assets/classDiagram-2ON5EDUG-DnsiOvOV-CXFnq-_j.js +1 -0
- package/dist/assets/classDiagram-v2-WZHVMYZB-DnsiOvOV-CXFnq-_j.js +1 -0
- package/dist/assets/clone-DduvFCk3-BXgbo_Py.js +1 -0
- package/dist/assets/cose-bilkent-S5V4N54A-VxeRCpgs-ToXg3tv0.js +1 -0
- package/dist/assets/cytoscape.esm-CjI2IsL8-Da6dFVsf.js +331 -0
- package/dist/assets/dagre-6UL2VRFP-B-o0qgxK-B7jIOGhI.js +4 -0
- package/dist/assets/diagram-PSM6KHXK-CoKmJ9sN-CeSAdKE7.js +24 -0
- package/dist/assets/diagram-QEK2KX5R-ETMfkzYL-BXfUD6Bz.js +43 -0
- package/dist/assets/diagram-S2PKOQOG-BgLbl6rv-Bq7z4qcN.js +24 -0
- package/dist/assets/erDiagram-Q2GNP2WA-Swwdy5pk-CDqK5rW5.js +60 -0
- package/dist/assets/flowDiagram-NV44I4VS-DXJdBBSZ-BwK5ukuy.js +162 -0
- package/dist/assets/ganttDiagram-LVOFAZNH-DmRbHwxf-DcLr4kCw.js +267 -0
- package/dist/assets/gitGraphDiagram-NY62KEGX-D30uHfXn-CQ3udd86.js +65 -0
- package/dist/assets/graph-ClfIprSM-Bo9NcOv2.js +1 -0
- package/dist/assets/{index-DlFdZiHl-C7HbEZKd.js → index-Bny2bm5_-BTHX9t_s.js} +1 -1
- package/dist/assets/index-CIi9dO9d.js +1184 -0
- package/dist/assets/infoDiagram-ER5ION4S-C0DTNQfZ-LvJs62gz.js +2 -0
- package/dist/assets/journeyDiagram-XKPGCS4Q-53CUbf20-CN2QFlhq.js +139 -0
- package/dist/assets/kanban-definition-3W4ZIXB7-B-HAgUf7-CCmqybnp.js +89 -0
- package/dist/assets/layout-DoRwGyA9-iPNfcIdd.js +1 -0
- package/dist/assets/mindmap-definition-VGOIOE7T-JxieKS1D-C0G1Iimv.js +68 -0
- package/dist/assets/pieDiagram-ADFJNKIX-vEsBIPBi-B9KBvrYJ.js +30 -0
- package/dist/assets/quadrantDiagram-AYHSOK5B-DuNXQUnS-aaneQodw.js +7 -0
- package/dist/assets/requirementDiagram-UZGBJVZJ-Ajt9-U96-DJ47o9fU.js +64 -0
- package/dist/assets/sankeyDiagram-TZEHDZUN-BNMEPupP-BUQLAXZ-.js +10 -0
- package/dist/assets/sequenceDiagram-WL72ISMW-D2j881gi-DESm0zUV.js +145 -0
- package/dist/assets/stateDiagram-FKZM4ZOC-D9G5SS9f-BGFYCrOw.js +1 -0
- package/dist/assets/stateDiagram-v2-4FDKWEC3-D0cjqibA-CBYfNThC.js +1 -0
- package/dist/assets/timeline-definition-IT6M3QCI-B95452nE-BhqaFUs-.js +61 -0
- package/dist/assets/treemap-KMMF4GRG-Dfxm7cSf-B7pg2atG.js +128 -0
- package/dist/assets/xychartDiagram-PRI3JC2R-CZX71UOJ-zWpWPPXY.js +7 -0
- package/dist/index.html +1 -1
- package/package.json +2 -2
- package/dist/assets/Tableau10-D7jGxypv-Cyu9clx1.js +0 -1
- package/dist/assets/arc-m8RC5oDD-D_zqriJo.js +0 -1
- package/dist/assets/blockDiagram-c4efeb88-CZ2mpei3-DNgkbqw8.js +0 -118
- package/dist/assets/c4Diagram-c83219d4-DL2EmCLj-CuUh45wR.js +0 -10
- package/dist/assets/channel-BKp1WYnX-Bfkn8_bQ.js +0 -1
- package/dist/assets/classDiagram-beda092f-vKbJ2bcD-CWrQ3PmP.js +0 -2
- package/dist/assets/classDiagram-v2-2358418a-BHXpn1Du-v6U68RJv.js +0 -2
- package/dist/assets/clone-B1V2003j-C6XGoCe0.js +0 -1
- package/dist/assets/createText-1719965b-C2-AT0ab-CSaYVcyR.js +0 -7
- package/dist/assets/edges-96097737-Zk-qG_8u-BvX-rD_e.js +0 -4
- package/dist/assets/erDiagram-0228fc6a-B94anMjz-C0RUxFzz.js +0 -51
- package/dist/assets/flowDb-c6c81e3f-CRRW-bQO-Dv8ApRnS.js +0 -10
- package/dist/assets/flowDiagram-50d868cf-DPzQMhJv-qcXw24Z1.js +0 -4
- package/dist/assets/flowDiagram-v2-4f6560a1-Si9enBmB-BosOeZuP.js +0 -1
- package/dist/assets/flowchart-elk-definition-6af322e1-CULhtvD--CMyJERSt.js +0 -139
- package/dist/assets/ganttDiagram-a2739b55-Bp8yOLEz-0p0LU6B2.js +0 -257
- package/dist/assets/gitGraphDiagram-82fe8481-BYtOQJl0-Cdvv8RH9.js +0 -70
- package/dist/assets/graph-BV6jB5rk-BPsWqwd1.js +0 -1
- package/dist/assets/index-5325376f-DrY72DrM-cyJIharh.js +0 -1
- package/dist/assets/index-CBAg0_Do.js +0 -1008
- package/dist/assets/infoDiagram-8eee0895-C6GFnrZ7-B58B7U0j.js +0 -7
- package/dist/assets/journeyDiagram-c64418c1-daS1W8qe-i2hoPaI4.js +0 -139
- package/dist/assets/layout-LXMv3mSS-D7gLeKlL.js +0 -1
- package/dist/assets/mindmap-definition-8da855dc-DmNQYVT1-8qfS2G_Q.js +0 -425
- package/dist/assets/pieDiagram-a8764435-381urBY5-BL34EuZ1.js +0 -35
- package/dist/assets/quadrantDiagram-1e28029f-hgRmK2bX-D0tGtC6c.js +0 -7
- package/dist/assets/requirementDiagram-08caed73-BB0Q-cI9-C_nbMj6N.js +0 -52
- package/dist/assets/sankeyDiagram-a04cb91d-BpsipZNt-BWArNeVf.js +0 -8
- package/dist/assets/sequenceDiagram-c5b8d532-xoAvPcQJ-DAGq-LjC.js +0 -122
- package/dist/assets/stateDiagram-1ecb1508-b721R49K-BIX80hin.js +0 -1
- package/dist/assets/stateDiagram-v2-c2b004d7-BmSbrbqZ-1xTqgfV7.js +0 -1
- package/dist/assets/styles-b4e223ce-TYmJC5IN-Bh92tu5N.js +0 -160
- package/dist/assets/styles-ca3715f6-CfJZu0Yn-DDmGuNcW.js +0 -207
- package/dist/assets/styles-d45a18b0-DZ8oSYcV-BPX-QgIY.js +0 -116
- package/dist/assets/svgDrawCommon-b86b1483-CXPkN8HW-BDGr_arU.js +0 -1
- package/dist/assets/timeline-definition-faaaa080-LDFf1jfb-C-sZwXLb.js +0 -61
- package/dist/assets/xychartDiagram-f5964ef8-DdhO5-Bp-BJGdviNy.js +0 -7
|
@@ -1,425 +0,0 @@
|
|
|
1
|
-
import{O as Ir,aL as gd,aM as vd,aN as yd,E as rs,ab as md,A as bd,af as bi,W as xi,F as xd,ad as wd,aa as Ed}from"./index-CBAg0_Do.js";import{$ as Td}from"./createText-1719965b-C2-AT0ab-CSaYVcyR.js";function So(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function _d(e){if(Array.isArray(e))return e}function Ad(e){if(Array.isArray(e))return So(e)}function gr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cd(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,dc(n.key),n)}}function vr(e,t,r){return t&&Cd(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ct(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ns(e))||t){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{o||r.return==null||r.return()}finally{if(s)throw a}}}}function hc(e,t,r){return(t=dc(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dd(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Nd(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,a,o,s=[],u=!0,l=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(c){l=!0,i=c}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function kd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Md(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
4
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qe(e,t){return _d(e)||Nd(e,t)||ns(e,t)||kd()}function wi(e){return Ad(e)||Dd(e)||ns(e)||Md()}function Sd(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function dc(e){var t=Sd(e,"string");return typeof t=="symbol"?t:t+""}function rt(e){"@babel/helpers - typeof";return rt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rt(e)}function ns(e,t){if(e){if(typeof e=="string")return So(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?So(e,t):void 0}}var Je=typeof window>"u"?null:window,Is=Je?Je.navigator:null;Je&&Je.document;var Ld=rt(""),fc=rt({}),Id=rt(function(){}),Od=typeof HTMLElement>"u"?"undefined":rt(HTMLElement),On=function(e){return e&&e.instanceString&&We(e.instanceString)?e.instanceString():null},fe=function(e){return e!=null&&rt(e)==Ld},We=function(e){return e!=null&&rt(e)===Id},ze=function(e){return!Dt(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},ke=function(e){return e!=null&&rt(e)===fc&&!ze(e)&&e.constructor===Object},Rd=function(e){return e!=null&&rt(e)===fc},ne=function(e){return e!=null&&rt(e)===rt(1)&&!isNaN(e)},Pd=function(e){return ne(e)&&Math.floor(e)===e},Ei=function(e){if(Od!=="undefined")return e!=null&&e instanceof HTMLElement},Dt=function(e){return Rn(e)||pc(e)},Rn=function(e){return On(e)==="collection"&&e._private.single},pc=function(e){return On(e)==="collection"&&!e._private.single},is=function(e){return On(e)==="core"},gc=function(e){return On(e)==="stylesheet"},Bd=function(e){return On(e)==="event"},lr=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Fd=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},zd=function(e){return ke(e)&&ne(e.x1)&&ne(e.x2)&&ne(e.y1)&&ne(e.y2)},Vd=function(e){return Rd(e)&&We(e.then)},Gd=function(){return Is&&Is.userAgent.match(/msie|trident|edge/i)},Jr=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var n=[],i=0;i<arguments.length;i++)n.push(arguments[i]);return n.join("$")});var r=function(){var n=this,i=arguments,a,o=t.apply(n,i),s=r.cache;return(a=s[o])||(a=s[o]=e.apply(n,i)),a};return r.cache={},r},as=Jr(function(e){return e.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}),Ri=Jr(function(e){return e.replace(/(-\w)/g,function(t){return t[1].toUpperCase()})}),vc=Jr(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),Os=function(e){return lr(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},nr=function(e,t){return e.slice(-1*t.length)===t},tt="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",Yd="rgb[a]?\\(("+tt+"[%]?)\\s*,\\s*("+tt+"[%]?)\\s*,\\s*("+tt+"[%]?)(?:\\s*,\\s*("+tt+"))?\\)",Ud="rgb[a]?\\((?:"+tt+"[%]?)\\s*,\\s*(?:"+tt+"[%]?)\\s*,\\s*(?:"+tt+"[%]?)(?:\\s*,\\s*(?:"+tt+"))?\\)",Xd="hsl[a]?\\(("+tt+")\\s*,\\s*("+tt+"[%])\\s*,\\s*("+tt+"[%])(?:\\s*,\\s*("+tt+"))?\\)",Wd="hsl[a]?\\((?:"+tt+")\\s*,\\s*(?:"+tt+"[%])\\s*,\\s*(?:"+tt+"[%])(?:\\s*,\\s*(?:"+tt+"))?\\)",qd="\\#[0-9a-fA-F]{3}",Hd="\\#[0-9a-fA-F]{6}",yc=function(e,t){return e<t?-1:e>t?1:0},jd=function(e,t){return-1*yc(e,t)},ge=Object.assign!=null?Object.assign.bind(Object):function(e){for(var t=arguments,r=1;r<t.length;r++){var n=t[r];if(n!=null)for(var i=Object.keys(n),a=0;a<i.length;a++){var o=i[a];e[o]=n[o]}}return e},$d=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var t=e.length===4,r,n,i,a=16;return t?(r=parseInt(e[1]+e[1],a),n=parseInt(e[2]+e[2],a),i=parseInt(e[3]+e[3],a)):(r=parseInt(e[1]+e[2],a),n=parseInt(e[3]+e[4],a),i=parseInt(e[5]+e[6],a)),[r,n,i]}},Zd=function(e){var t,r,n,i,a,o,s,u;function l(d,p,v){return v<0&&(v+=1),v>1&&(v-=1),v<1/6?d+(p-d)*6*v:v<1/2?p:v<2/3?d+(p-d)*(2/3-v)*6:d}var c=new RegExp("^"+Xd+"$").exec(e);if(c){if(r=parseInt(c[1]),r<0?r=(360- -1*r%360)%360:r>360&&(r=r%360),r/=360,n=parseFloat(c[2]),n<0||n>100||(n=n/100,i=parseFloat(c[3]),i<0||i>100)||(i=i/100,a=c[4],a!==void 0&&(a=parseFloat(a),a<0||a>1)))return;if(n===0)o=s=u=Math.round(i*255);else{var h=i<.5?i*(1+n):i+n-i*n,f=2*i-h;o=Math.round(255*l(f,h,r+1/3)),s=Math.round(255*l(f,h,r)),u=Math.round(255*l(f,h,r-1/3))}t=[o,s,u,a]}return t},Kd=function(e){var t,r=new RegExp("^"+Yd+"$").exec(e);if(r){t=[];for(var n=[],i=1;i<=3;i++){var a=r[i];if(a[a.length-1]==="%"&&(n[i]=!0),a=parseFloat(a),n[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=n[1]||n[2]||n[3],s=n[1]&&n[2]&&n[3];if(o&&!s)return;var u=r[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;t.push(u)}}return t},Qd=function(e){return Jd[e.toLowerCase()]},mc=function(e){return(ze(e)?e:null)||Qd(e)||$d(e)||Kd(e)||Zd(e)},Jd={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},bc=function(e){for(var t=e.map,r=e.keys,n=r.length,i=0;i<n;i++){var a=r[i];if(ke(a))throw Error("Tried to set map with object key");i<r.length-1?(t[a]==null&&(t[a]={}),t=t[a]):t[a]=e.value}},xc=function(e){for(var t=e.map,r=e.keys,n=r.length,i=0;i<n;i++){var a=r[i];if(ke(a))throw Error("Tried to get map with object key");if(t=t[a],t==null)return t}return t},Zn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ta,Rs;function Bn(){if(Rs)return ta;Rs=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return ta=e,ta}var ra,Ps;function ef(){if(Ps)return ra;Ps=1;var e=typeof Zn=="object"&&Zn&&Zn.Object===Object&&Zn;return ra=e,ra}var na,Bs;function Pi(){if(Bs)return na;Bs=1;var e=ef(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return na=r,na}var ia,Fs;function tf(){if(Fs)return ia;Fs=1;var e=Pi(),t=function(){return e.Date.now()};return ia=t,ia}var aa,zs;function rf(){if(zs)return aa;zs=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return aa=t,aa}var oa,Vs;function nf(){if(Vs)return oa;Vs=1;var e=rf(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return oa=r,oa}var sa,Gs;function os(){if(Gs)return sa;Gs=1;var e=Pi(),t=e.Symbol;return sa=t,sa}var la,Ys;function af(){if(Ys)return la;Ys=1;var e=os(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var s=r.call(o,i),u=o[i];try{o[i]=void 0;var l=!0}catch{}var c=n.call(o);return l&&(s?o[i]=u:delete o[i]),c}return la=a,la}var ua,Us;function of(){if(Us)return ua;Us=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return ua=r,ua}var ca,Xs;function wc(){if(Xs)return ca;Xs=1;var e=os(),t=af(),r=of(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(s){return s==null?s===void 0?i:n:a&&a in Object(s)?t(s):r(s)}return ca=o,ca}var ha,Ws;function sf(){if(Ws)return ha;Ws=1;function e(t){return t!=null&&typeof t=="object"}return ha=e,ha}var da,qs;function Fn(){if(qs)return da;qs=1;var e=wc(),t=sf(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return da=n,da}var fa,Hs;function lf(){if(Hs)return fa;Hs=1;var e=nf(),t=Bn(),r=Fn(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function u(l){if(typeof l=="number")return l;if(r(l))return n;if(t(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=t(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=e(l);var h=a.test(l);return h||o.test(l)?s(l.slice(2),h?2:8):i.test(l)?n:+l}return fa=u,fa}var pa,js;function uf(){if(js)return pa;js=1;var e=Bn(),t=tf(),r=lf(),n="Expected a function",i=Math.max,a=Math.min;function o(s,u,l){var c,h,f,d,p,v,m=0,g=!1,y=!1,x=!0;if(typeof s!="function")throw new TypeError(n);u=r(u)||0,e(l)&&(g=!!l.leading,y="maxWait"in l,f=y?i(r(l.maxWait)||0,u):f,x="trailing"in l?!!l.trailing:x);function T(S){var M=c,R=h;return c=h=void 0,m=S,d=s.apply(R,M),d}function w(S){return m=S,p=setTimeout(_,u),g?T(S):d}function D(S){var M=S-v,R=S-m,P=u-M;return y?a(P,f-R):P}function b(S){var M=S-v,R=S-m;return v===void 0||M>=u||M<0||y&&R>=f}function _(){var S=t();if(b(S))return E(S);p=setTimeout(_,D(S))}function E(S){return p=void 0,x&&c?T(S):(c=h=void 0,d)}function A(){p!==void 0&&clearTimeout(p),m=0,c=v=h=p=void 0}function C(){return p===void 0?d:E(t())}function N(){var S=t(),M=b(S);if(c=arguments,h=this,v=S,M){if(p===void 0)return w(v);if(y)return clearTimeout(p),p=setTimeout(_,u),T(v)}return p===void 0&&(p=setTimeout(_,u)),d}return N.cancel=A,N.flush=C,N}return pa=o,pa}var cf=uf(),zn=Pn(cf),ga=Je?Je.performance:null,Ec=ga&&ga.now?function(){return ga.now()}:function(){return Date.now()},hf=function(){if(Je){if(Je.requestAnimationFrame)return function(e){Je.requestAnimationFrame(e)};if(Je.mozRequestAnimationFrame)return function(e){Je.mozRequestAnimationFrame(e)};if(Je.webkitRequestAnimationFrame)return function(e){Je.webkitRequestAnimationFrame(e)};if(Je.msRequestAnimationFrame)return function(e){Je.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(Ec())},1e3/60)}}(),Ti=function(e){return hf(e)},$t=Ec,Ar=9261,Tc=65599,Wr=5381,_c=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ar,r=t,n;n=e.next(),!n.done;)r=r*Tc+n.value|0;return r},_n=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ar;return t*Tc+e|0},An=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Wr;return(t<<5)+t+e|0},df=function(e,t){return e*2097152+t},er=function(e){return e[0]*2097152+e[1]},Kn=function(e,t){return[_n(e[0],t[0]),An(e[1],t[1])]},$s=function(e,t){var r={value:0,done:!1},n=0,i=e.length,a={next:function(){return n<i?r.value=e[n++]:r.done=!0,r}};return _c(a,t)},Nr=function(e,t){var r={value:0,done:!1},n=0,i=e.length,a={next:function(){return n<i?r.value=e.charCodeAt(n++):r.done=!0,r}};return _c(a,t)},Ac=function(){return ff(arguments)},ff=function(e){for(var t,r=0;r<e.length;r++){var n=e[r];r===0?t=Nr(n):t=Nr(n,t)}return t};function pf(e,t,r,n,i){var a=i*Math.PI/180,o=Math.cos(a)*(e-r)-Math.sin(a)*(t-n)+r,s=Math.sin(a)*(e-r)+Math.cos(a)*(t-n)+n;return{x:o,y:s}}var gf=function(e,t,r,n,i,a){return{x:(e-r)*i+r,y:(t-n)*a+n}};function vf(e,t,r){if(r===0)return e;var n=(t.x1+t.x2)/2,i=(t.y1+t.y2)/2,a=t.w/t.h,o=1/a,s=pf(e.x,e.y,n,i,r),u=gf(s.x,s.y,n,i,a,o);return{x:u.x,y:u.y}}var Zs=!0,yf=console.warn!=null,mf=console.trace!=null,ss=Number.MAX_SAFE_INTEGER||9007199254740991,Cc=function(){return!0},_i=function(){return!1},Ks=function(){return 0},ls=function(){},Xe=function(e){throw new Error(e)},Dc=function(e){if(e!==void 0)Zs=!!e;else return Zs},Pe=function(e){Dc()&&(yf?console.warn(e):(console.log(e),mf&&console.trace()))},bf=function(e){return ge({},e)},Yt=function(e){return e==null?e:ze(e)?e.slice():ke(e)?bf(e):e},xf=function(e){return e.slice()},Nc=function(e,t){for(t=e="";e++<36;t+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return t},wf={},kc=function(){return wf},ht=function(e){var t=Object.keys(e);return function(r){for(var n={},i=0;i<t.length;i++){var a=t[i],o=r==null?void 0:r[a];n[a]=o===void 0?e[a]:o}return n}},ur=function(e,t,r){for(var n=e.length-1;n>=0;n--)e[n]===t&&e.splice(n,1)},us=function(e){e.splice(0,e.length)},Ef=function(e,t){for(var r=0;r<t.length;r++){var n=t[r];e.push(n)}},_t=function(e,t,r){return r&&(t=vc(r,t)),e[t]},Ht=function(e,t,r,n){r&&(t=vc(r,t)),e[t]=n},Tf=function(){function e(){gr(this,e),this._obj={}}return vr(e,[{key:"set",value:function(t,r){return this._obj[t]=r,this}},{key:"delete",value:function(t){return this._obj[t]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(t){return this._obj[t]!==void 0}},{key:"get",value:function(t){return this._obj[t]}}])}(),jt=typeof Map<"u"?Map:Tf,_f="undefined",Af=function(){function e(t){if(gr(this,e),this._obj=Object.create(null),this.size=0,t!=null){var r;t.instanceString!=null&&t.instanceString()===this.instanceString()?r=t.toArray():r=t;for(var n=0;n<r.length;n++)this.add(r[n])}}return vr(e,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(t){var r=this._obj;r[t]!==1&&(r[t]=1,this.size++)}},{key:"delete",value:function(t){var r=this._obj;r[t]===1&&(r[t]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(t){return this._obj[t]===1}},{key:"toArray",value:function(){var t=this;return Object.keys(this._obj).filter(function(r){return t.has(r)})}},{key:"forEach",value:function(t,r){return this.toArray().forEach(t,r)}}])}(),rn=(typeof Set>"u"?"undefined":rt(Set))!==_f?Set:Af,Bi=function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!is(e)){Xe("An element must have a core reference and parameters set");return}var n=t.group;if(n==null&&(t.data&&t.data.source!=null&&t.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){Xe("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0?!0:!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0?!0:!!t.grabbable,pannable:t.pannable===void 0?n==="edges":!!t.pannable,active:!1,classes:new rn,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var u=[];ze(t.classes)?u=t.classes:fe(t.classes)&&(u=t.classes.split(/\s+/));for(var l=0,c=u.length;l<c;l++){var h=u[l];!h||h===""||i.classes.add(h)}this.createEmitter(),(r===void 0||r)&&this.restore();var f=t.style||t.css;f&&(Pe("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(f))},Qs=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,r,n){var i;ke(t)&&!Dt(t)&&(i=t,t=i.roots||i.root,r=i.visit,n=i.directed),n=arguments.length===2&&!We(r)?r:n,r=We(r)?r:function(){};for(var a=this._private.cy,o=t=fe(t)?this.filter(t):t,s=[],u=[],l={},c={},h={},f=0,d,p=this.byGroup(),v=p.nodes,m=p.edges,g=0;g<o.length;g++){var y=o[g],x=y.id();y.isNode()&&(s.unshift(y),e.bfs&&(h[x]=!0,u.push(y)),c[x]=0)}for(var T=function(){var A=e.bfs?s.shift():s.pop(),C=A.id();if(e.dfs){if(h[C])return 0;h[C]=!0,u.push(A)}var N=c[C],S=l[C],M=S!=null?S.source():null,R=S!=null?S.target():null,P=S==null?void 0:A.same(M)?R[0]:M[0],L;if(L=r(A,S,P,f++,N),L===!0)return d=A,1;if(L===!1)return 1;for(var O=A.connectedEdges().filter(function(G){return(!n||G.source().same(A))&&m.has(G)}),I=0;I<O.length;I++){var B=O[I],F=B.connectedNodes().filter(function(G){return!G.same(A)&&v.has(G)}),z=F.id();F.length!==0&&!h[z]&&(F=F[0],s.push(F),e.bfs&&(h[z]=!0,u.push(F)),l[z]=B,c[z]=c[C]+1)}},w;s.length!==0&&(w=T(),!(w!==0&&w===1)););for(var D=a.collection(),b=0;b<u.length;b++){var _=u[b],E=l[_.id()];E!=null&&D.push(E),D.push(_)}return{path:a.collection(D),found:a.collection(d)}}},Cn={breadthFirstSearch:Qs({bfs:!0}),depthFirstSearch:Qs({dfs:!0})};Cn.bfs=Cn.breadthFirstSearch;Cn.dfs=Cn.depthFirstSearch;var Lo={exports:{}},Cf=Lo.exports,Js;function Df(){return Js||(Js=1,function(e,t){(function(){var r,n,i,a,o,s,u,l,c,h,f,d,p,v,m;i=Math.floor,h=Math.min,n=function(g,y){return g<y?-1:g>y?1:0},c=function(g,y,x,T,w){var D;if(x==null&&(x=0),w==null&&(w=n),x<0)throw new Error("lo must be non-negative");for(T==null&&(T=g.length);x<T;)D=i((x+T)/2),w(y,g[D])<0?T=D:x=D+1;return[].splice.apply(g,[x,x-x].concat(y)),y},s=function(g,y,x){return x==null&&(x=n),g.push(y),v(g,0,g.length-1,x)},o=function(g,y){var x,T;return y==null&&(y=n),x=g.pop(),g.length?(T=g[0],g[0]=x,m(g,0,y)):T=x,T},l=function(g,y,x){var T;return x==null&&(x=n),T=g[0],g[0]=y,m(g,0,x),T},u=function(g,y,x){var T;return x==null&&(x=n),g.length&&x(g[0],y)<0&&(T=[g[0],y],y=T[0],g[0]=T[1],m(g,0,x)),y},a=function(g,y){var x,T,w,D,b,_;for(y==null&&(y=n),D=(function(){_=[];for(var E=0,A=i(g.length/2);0<=A?E<A:E>A;0<=A?E++:E--)_.push(E);return _}).apply(this).reverse(),b=[],T=0,w=D.length;T<w;T++)x=D[T],b.push(m(g,x,y));return b},p=function(g,y,x){var T;if(x==null&&(x=n),T=g.indexOf(y),T!==-1)return v(g,0,T,x),m(g,T,x)},f=function(g,y,x){var T,w,D,b,_;if(x==null&&(x=n),w=g.slice(0,y),!w.length)return w;for(a(w,x),_=g.slice(y),D=0,b=_.length;D<b;D++)T=_[D],u(w,T,x);return w.sort(x).reverse()},d=function(g,y,x){var T,w,D,b,_,E,A,C,N;if(x==null&&(x=n),y*10<=g.length){if(D=g.slice(0,y).sort(x),!D.length)return D;for(w=D[D.length-1],A=g.slice(y),b=0,E=A.length;b<E;b++)T=A[b],x(T,w)<0&&(c(D,T,0,null,x),D.pop(),w=D[D.length-1]);return D}for(a(g,x),N=[],_=0,C=h(y,g.length);0<=C?_<C:_>C;0<=C?++_:--_)N.push(o(g,x));return N},v=function(g,y,x,T){var w,D,b;for(T==null&&(T=n),w=g[x];x>y;){if(b=x-1>>1,D=g[b],T(w,D)<0){g[x]=D,x=b;continue}break}return g[x]=w},m=function(g,y,x){var T,w,D,b,_;for(x==null&&(x=n),w=g.length,_=y,D=g[y],T=2*y+1;T<w;)b=T+1,b<w&&!(x(g[T],g[b])<0)&&(T=b),g[y]=g[T],y=T,T=2*y+1;return g[y]=D,v(g,_,y,x)},r=function(){g.push=s,g.pop=o,g.replace=l,g.pushpop=u,g.heapify=a,g.updateItem=p,g.nlargest=f,g.nsmallest=d;function g(y){this.cmp=y??n,this.nodes=[]}return g.prototype.push=function(y){return s(this.nodes,y,this.cmp)},g.prototype.pop=function(){return o(this.nodes,this.cmp)},g.prototype.peek=function(){return this.nodes[0]},g.prototype.contains=function(y){return this.nodes.indexOf(y)!==-1},g.prototype.replace=function(y){return l(this.nodes,y,this.cmp)},g.prototype.pushpop=function(y){return u(this.nodes,y,this.cmp)},g.prototype.heapify=function(){return a(this.nodes,this.cmp)},g.prototype.updateItem=function(y){return p(this.nodes,y,this.cmp)},g.prototype.clear=function(){return this.nodes=[]},g.prototype.empty=function(){return this.nodes.length===0},g.prototype.size=function(){return this.nodes.length},g.prototype.clone=function(){var y;return y=new g,y.nodes=this.nodes.slice(0),y},g.prototype.toArray=function(){return this.nodes.slice(0)},g.prototype.insert=g.prototype.push,g.prototype.top=g.prototype.peek,g.prototype.front=g.prototype.peek,g.prototype.has=g.prototype.contains,g.prototype.copy=g.prototype.clone,g}(),function(g,y){return e.exports=y()}(this,function(){return r})}).call(Cf)}(Lo)),Lo.exports}var el,tl;function Nf(){return tl||(tl=1,el=Df()),el}var kf=Nf(),Vn=Pn(kf),Mf=ht({root:null,weight:function(e){return 1},directed:!1}),Sf={dijkstra:function(e){if(!ke(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var r=Mf(e),n=r.root,i=r.weight,a=r.directed,o=this,s=i,u=fe(n)?this.filter(n)[0]:n[0],l={},c={},h={},f=this.byGroup(),d=f.nodes,p=f.edges;p.unmergeBy(function(M){return M.isLoop()});for(var v=function(M){return l[M.id()]},m=function(M,R){l[M.id()]=R,g.updateItem(M)},g=new Vn(function(M,R){return v(M)-v(R)}),y=0;y<d.length;y++){var x=d[y];l[x.id()]=x.same(u)?0:1/0,g.push(x)}for(var T=function(M,R){for(var P=(a?M.edgesTo(R):M.edgesWith(R)).intersect(p),L=1/0,O,I=0;I<P.length;I++){var B=P[I],F=s(B);(F<L||!O)&&(L=F,O=B)}return{edge:O,dist:L}};g.size()>0;){var w=g.pop(),D=v(w),b=w.id();if(h[b]=D,D!==1/0)for(var _=w.neighborhood().intersect(d),E=0;E<_.length;E++){var A=_[E],C=A.id(),N=T(w,A),S=D+N.dist;S<v(A)&&(m(A,S),c[C]={node:w,edge:N.edge})}}return{distanceTo:function(M){var R=fe(M)?d.filter(M)[0]:M[0];return h[R.id()]},pathTo:function(M){var R=fe(M)?d.filter(M)[0]:M[0],P=[],L=R,O=L.id();if(R.length>0)for(P.unshift(R);c[O];){var I=c[O];P.unshift(I.edge),P.unshift(I.node),L=I.node,O=L.id()}return o.spawn(P)}}}},Lf={kruskal:function(e){e=e||function(y){return 1};for(var t=this.byGroup(),r=t.nodes,n=t.edges,i=r.length,a=new Array(i),o=r,s=function(y){for(var x=0;x<a.length;x++){var T=a[x];if(T.has(y))return x}},u=0;u<i;u++)a[u]=this.spawn(r[u]);for(var l=n.sort(function(y,x){return e(y)-e(x)}),c=0;c<l.length;c++){var h=l[c],f=h.source()[0],d=h.target()[0],p=s(f),v=s(d),m=a[p],g=a[v];p!==v&&(o.merge(h),m.merge(g),a.splice(v,1))}return o}},If=ht({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),Of={aStar:function(e){var t=this.cy(),r=If(e),n=r.root,i=r.goal,a=r.heuristic,o=r.directed,s=r.weight;n=t.collection(n)[0],i=t.collection(i)[0];var u=n.id(),l=i.id(),c={},h={},f={},d=new Vn(function(I,B){return h[I.id()]-h[B.id()]}),p=new rn,v={},m={},g=function(I,B){d.push(I),p.add(B)},y,x,T=function(){y=d.pop(),x=y.id(),p.delete(x)},w=function(I){return p.has(I)};g(n,u),c[u]=0,h[u]=a(n);for(var D=0;d.size()>0;){if(T(),D++,x===l){for(var b=[],_=i,E=l,A=m[E];b.unshift(_),A!=null&&b.unshift(A),_=v[E],_!=null;)E=_.id(),A=m[E];return{found:!0,distance:c[x],path:this.spawn(b),steps:D}}f[x]=!0;for(var C=y._private.edges,N=0;N<C.length;N++){var S=C[N];if(this.hasElementWithId(S.id())&&!(o&&S.data("source")!==x)){var M=S.source(),R=S.target(),P=M.id()!==x?M:R,L=P.id();if(this.hasElementWithId(L)&&!f[L]){var O=c[x]+s(S);if(!w(L)){c[L]=O,h[L]=O+a(P),g(P,L),v[L]=y,m[L]=S;continue}O<c[L]&&(c[L]=O,h[L]=O+a(P),v[L]=y,m[L]=S)}}}}return{found:!1,distance:void 0,path:void 0,steps:D}}},Rf=ht({weight:function(e){return 1},directed:!1}),Pf={floydWarshall:function(e){for(var t=this.cy(),r=Rf(e),n=r.weight,i=r.directed,a=n,o=this.byGroup(),s=o.nodes,u=o.edges,l=s.length,c=l*l,h=function(F){return s.indexOf(F)},f=function(F){return s[F]},d=new Array(c),p=0;p<c;p++){var v=p%l,m=(p-v)/l;m===v?d[p]=0:d[p]=1/0}for(var g=new Array(c),y=new Array(c),x=0;x<u.length;x++){var T=u[x],w=T.source()[0],D=T.target()[0];if(w!==D){var b=h(w),_=h(D),E=b*l+_,A=a(T);if(d[E]>A&&(d[E]=A,g[E]=_,y[E]=T),!i){var C=_*l+b;!i&&d[C]>A&&(d[C]=A,g[C]=b,y[C]=T)}}}for(var N=0;N<l;N++)for(var S=0;S<l;S++)for(var M=S*l+N,R=0;R<l;R++){var P=S*l+R,L=N*l+R;d[M]+d[L]<d[P]&&(d[P]=d[M]+d[L],g[P]=g[M])}var O=function(F){return(fe(F)?t.filter(F):F)[0]},I=function(F){return h(O(F))},B={distance:function(F,z){var G=I(F),H=I(z);return d[G*l+H]},path:function(F,z){var G=I(F),H=I(z),j=f(G);if(G===H)return j.collection();if(g[G*l+H]==null)return t.collection();var Z=t.collection(),Q=G,re;for(Z.merge(j);G!==H;)Q=G,G=g[G*l+H],re=y[Q*l+G],Z.merge(re),Z.merge(f(G));return Z}};return B}},Bf=ht({weight:function(e){return 1},directed:!1,root:null}),Ff={bellmanFord:function(e){var t=this,r=Bf(e),n=r.weight,i=r.directed,a=r.root,o=n,s=this,u=this.cy(),l=this.byGroup(),c=l.edges,h=l.nodes,f=h.length,d=new jt,p=!1,v=[];a=u.collection(a)[0],c.unmergeBy(function(ye){return ye.isLoop()});for(var m=c.length,g=function(ye){var xe=d.get(ye.id());return xe||(xe={},d.set(ye.id(),xe)),xe},y=function(ye){return(fe(ye)?u.$(ye):ye)[0]},x=function(ye){return g(y(ye)).dist},T=function(ye){for(var xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:a,Me=y(ye),te=[],ue=Me;;){if(ue==null)return t.spawn();var ce=g(ue),me=ce.edge,be=ce.pred;if(te.unshift(ue[0]),ue.same(xe)&&te.length>0)break;me!=null&&te.unshift(me),ue=be}return s.spawn(te)},w=0;w<f;w++){var D=h[w],b=g(D);D.same(a)?b.dist=0:b.dist=1/0,b.pred=null,b.edge=null}for(var _=!1,E=function(ye,xe,Me,te,ue,ce){var me=te.dist+ce;me<ue.dist&&!Me.same(te.edge)&&(ue.dist=me,ue.pred=ye,ue.edge=Me,_=!0)},A=1;A<f;A++){_=!1;for(var C=0;C<m;C++){var N=c[C],S=N.source(),M=N.target(),R=o(N),P=g(S),L=g(M);E(S,M,N,P,L,R),i||E(M,S,N,L,P,R)}if(!_)break}if(_)for(var O=[],I=0;I<m;I++){var B=c[I],F=B.source(),z=B.target(),G=o(B),H=g(F).dist,j=g(z).dist;if(H+G<j||!i&&j+G<H)if(p||(Pe("Graph contains a negative weight cycle for Bellman-Ford"),p=!0),e.findNegativeWeightCycles!==!1){var Z=[];H+G<j&&Z.push(F),!i&&j+G<H&&Z.push(z);for(var Q=Z.length,re=0;re<Q;re++){var V=Z[re],Y=[V];Y.push(g(V).edge);for(var U=g(V).pred;Y.indexOf(U)===-1;)Y.push(U),Y.push(g(U).edge),U=g(U).pred;Y=Y.slice(Y.indexOf(U));for(var K=Y[0].id(),ee=0,ie=2;ie<Y.length;ie+=2)Y[ie].id()<K&&(K=Y[ie].id(),ee=ie);Y=Y.slice(ee).concat(Y.slice(0,ee)),Y.push(Y[0]);var we=Y.map(function(ye){return ye.id()}).join(",");O.indexOf(we)===-1&&(v.push(s.spawn(Y)),O.push(we))}}else break}return{distanceTo:x,pathTo:T,hasNegativeWeightCycle:p,negativeWeightCycles:v}}},zf=Math.sqrt(2),Vf=function(e,t,r){r.length===0&&Xe("Karger-Stein must be run on a connected (sub)graph");for(var n=r[e],i=n[1],a=n[2],o=t[i],s=t[a],u=r,l=u.length-1;l>=0;l--){var c=u[l],h=c[1],f=c[2];(t[h]===o&&t[f]===s||t[h]===s&&t[f]===o)&&u.splice(l,1)}for(var d=0;d<u.length;d++){var p=u[d];p[1]===s?(u[d]=p.slice(),u[d][1]=o):p[2]===s&&(u[d]=p.slice(),u[d][2]=o)}for(var v=0;v<t.length;v++)t[v]===s&&(t[v]=o);return u},va=function(e,t,r,n){for(;r>n;){var i=Math.floor(Math.random()*t.length);t=Vf(i,e,t),r--}return t},Gf={kargerStein:function(){var e=this,t=this.byGroup(),r=t.nodes,n=t.edges;n.unmergeBy(function(L){return L.isLoop()});var i=r.length,a=n.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/zf);if(i<2){Xe("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],l=0;l<a;l++){var c=n[l];u.push([l,r.indexOf(c.source()),r.indexOf(c.target())])}for(var h=1/0,f=[],d=new Array(i),p=new Array(i),v=new Array(i),m=function(L,O){for(var I=0;I<i;I++)O[I]=L[I]},g=0;g<=o;g++){for(var y=0;y<i;y++)p[y]=y;var x=va(p,u.slice(),i,s),T=x.slice();m(p,v);var w=va(p,x,s,2),D=va(v,T,s,2);w.length<=D.length&&w.length<h?(h=w.length,f=w,m(p,d)):D.length<=w.length&&D.length<h&&(h=D.length,f=D,m(v,d))}for(var b=this.spawn(f.map(function(L){return n[L[0]]})),_=this.spawn(),E=this.spawn(),A=d[0],C=0;C<d.length;C++){var N=d[C],S=r[C];N===A?_.merge(S):E.merge(S)}var M=function(L){var O=e.spawn();return L.forEach(function(I){O.merge(I),I.connectedEdges().forEach(function(B){e.contains(B)&&!b.contains(B)&&O.merge(B)})}),O},R=[M(_),M(E)],P={cut:b,components:R,partition1:_,partition2:E};return P}},ya,Yf=function(e){return{x:e.x,y:e.y}},Fi=function(e,t,r){return{x:e.x*t+r.x,y:e.y*t+r.y}},Mc=function(e,t,r){return{x:(e.x-r.x)/t,y:(e.y-r.y)/t}},qr=function(e){return{x:e[0],y:e[1]}},Uf=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=t;i<r;i++){var a=e[i];isFinite(a)&&(n=Math.min(a,n))}return n},Xf=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=t;i<r;i++){var a=e[i];isFinite(a)&&(n=Math.max(a,n))}return n},Wf=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,a=t;a<r;a++){var o=e[a];isFinite(o)&&(n+=o,i++)}return n/i},qf=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(t,r):(r<e.length&&e.splice(r,e.length-r),t>0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var u=e[s];a?isFinite(u)||(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort(function(h,f){return h-f});var l=e.length,c=Math.floor(l/2);return l%2!==0?e[c+1+o]:(e[c-1+o]+e[c+o])/2},Hf=function(e){return Math.PI*e/180},Qn=function(e,t){return Math.atan2(t,e)-Math.PI/2},cs=Math.log2||function(e){return Math.log(e)/Math.log(2)},hs=function(e){return e>0?1:e<0?-1:0},kr=function(e,t){return Math.sqrt(Tr(e,t))},Tr=function(e,t){var r=t.x-e.x,n=t.y-e.y;return r*r+n*n},jf=function(e){for(var t=e.length,r=0,n=0;n<t;n++)r+=e[n];for(var i=0;i<t;i++)e[i]=e[i]/r;return e},at=function(e,t,r,n){return(1-n)*(1-n)*e+2*(1-n)*n*t+n*n*r},$r=function(e,t,r,n){return{x:at(e.x,t.x,r.x,n),y:at(e.y,t.y,r.y,n)}},$f=function(e,t,r,n){var i={x:t.x-e.x,y:t.y-e.y},a=kr(e,t),o={x:i.x/a,y:i.y/a};return r=r??0,n=n??r*a,{x:e.x+o.x*n,y:e.y+o.y*n}},Dn=function(e,t,r){return Math.max(e,Math.min(r,t))},xt=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Zf=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Kf=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Qf=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},Sc=function(e,t,r){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r),e.y2=Math.max(e.y2,r),e.h=e.y2-e.y1},ui=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},ci=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],r,n,i,a;if(t.length===1)r=n=i=a=t[0];else if(t.length===2)r=i=t[0],a=n=t[1];else if(t.length===4){var o=Qe(t,4);r=o[0],n=o[1],i=o[2],a=o[3]}return e.x1-=a,e.x2+=n,e.y1-=r,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},rl=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},ds=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2<t.x1||t.x2<e.x1||e.y2<t.y1||t.y2<e.y1||e.y1>t.y2||t.y1>e.y2)},ir=function(e,t,r){return e.x1<=t&&t<=e.x2&&e.y1<=r&&r<=e.y2},nl=function(e,t){return ir(e,t.x,t.y)},Lc=function(e,t){return ir(e,t.x1,t.y1)&&ir(e,t.x2,t.y2)},Jf=(ya=Math.hypot)!==null&&ya!==void 0?ya:function(e,t){return Math.sqrt(e*e+t*t)};function ep(e,t){if(e.length<3)throw new Error("Need at least 3 vertices");var r=function(b,_){return{x:b.x+_.x,y:b.y+_.y}},n=function(b,_){return{x:b.x-_.x,y:b.y-_.y}},i=function(b,_){return{x:b.x*_,y:b.y*_}},a=function(b,_){return b.x*_.y-b.y*_.x},o=function(b){var _=Jf(b.x,b.y);return _===0?{x:0,y:0}:{x:b.x/_,y:b.y/_}},s=function(b){for(var _=0,E=0;E<b.length;E++){var A=b[E],C=b[(E+1)%b.length];_+=A.x*C.y-C.x*A.y}return _/2},u=function(b,_,E,A){var C=n(_,b),N=n(A,E),S=a(C,N);if(Math.abs(S)<1e-9)return r(b,i(C,.5));var M=a(n(E,b),N)/S;return r(b,i(C,M))},l=e.map(function(b){return{x:b.x,y:b.y}});s(l)<0&&l.reverse();for(var c=l.length,h=[],f=0;f<c;f++){var d=l[f],p=l[(f+1)%c],v=n(p,d),m=o({x:v.y,y:-v.x});h.push(m)}for(var g=h.map(function(b,_){var E=r(l[_],i(b,t)),A=r(l[(_+1)%c],i(b,t));return{p1:E,p2:A}}),y=[],x=0;x<c;x++){var T=g[(x-1+c)%c],w=g[x],D=u(T.p1,T.p2,w.p1,w.p2);y.push(D)}return y}function tp(e,t,r,n,i,a){var o=cp(e,t,r,n,i),s=ep(o,a),u=xt();return s.forEach(function(l){return Sc(u,l.x,l.y)}),u}var Ic=function(e,t,r,n,i,a,o){var s=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",u=s==="auto"?cr(i,a):s,l=i/2,c=a/2;u=Math.min(u,l,c);var h=u!==l,f=u!==c,d;if(h){var p=r-l+u-o,v=n-c-o,m=r+l-u+o,g=v;if(d=ar(e,t,r,n,p,v,m,g,!1),d.length>0)return d}if(f){var y=r+l+o,x=n-c+u-o,T=y,w=n+c-u+o;if(d=ar(e,t,r,n,y,x,T,w,!1),d.length>0)return d}if(h){var D=r-l+u-o,b=n+c+o,_=r+l-u+o,E=b;if(d=ar(e,t,r,n,D,b,_,E,!1),d.length>0)return d}if(f){var A=r-l-o,C=n-c+u-o,N=A,S=n+c-u+o;if(d=ar(e,t,r,n,A,C,N,S,!1),d.length>0)return d}var M;{var R=r-l+u,P=n-c+u;if(M=mn(e,t,r,n,R,P,u+o),M.length>0&&M[0]<=R&&M[1]<=P)return[M[0],M[1]]}{var L=r+l-u,O=n-c+u;if(M=mn(e,t,r,n,L,O,u+o),M.length>0&&M[0]>=L&&M[1]<=O)return[M[0],M[1]]}{var I=r+l-u,B=n+c-u;if(M=mn(e,t,r,n,I,B,u+o),M.length>0&&M[0]>=I&&M[1]>=B)return[M[0],M[1]]}{var F=r-l+u,z=n+c-u;if(M=mn(e,t,r,n,F,z,u+o),M.length>0&&M[0]<=F&&M[1]>=z)return[M[0],M[1]]}return[]},rp=function(e,t,r,n,i,a,o){var s=o,u=Math.min(r,i),l=Math.max(r,i),c=Math.min(n,a),h=Math.max(n,a);return u-s<=e&&e<=l+s&&c-s<=t&&t<=h+s},np=function(e,t,r,n,i,a,o,s,u){var l={x1:Math.min(r,o,i)-u,x2:Math.max(r,o,i)+u,y1:Math.min(n,s,a)-u,y2:Math.max(n,s,a)+u};return!(e<l.x1||e>l.x2||t<l.y1||t>l.y2)},ip=function(e,t,r,n){r-=n;var i=t*t-4*e*r;if(i<0)return[];var a=Math.sqrt(i),o=2*e,s=(-t+a)/o,u=(-t-a)/o;return[s,u]},ap=function(e,t,r,n,i){var a=1e-5;e===0&&(e=a),t/=e,r/=e,n/=e;var o,s,u,l,c,h,f,d;if(s=(3*r-t*t)/9,u=-(27*n)+t*(9*r-2*(t*t)),u/=54,o=s*s*s+u*u,i[1]=0,f=t/3,o>0){c=u+Math.sqrt(o),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),h=u-Math.sqrt(o),h=h<0?-Math.pow(-h,1/3):Math.pow(h,1/3),i[0]=-f+c+h,f+=(c+h)/2,i[4]=i[2]=-f,f=Math.sqrt(3)*(-h+c)/2,i[3]=f,i[5]=-f;return}if(i[5]=i[3]=0,o===0){d=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=-f+2*d,i[4]=i[2]=-(d+f);return}s=-s,l=s*s*s,l=Math.acos(u/Math.sqrt(l)),d=2*Math.sqrt(s),i[0]=-f+d*Math.cos(l/3),i[2]=-f+d*Math.cos((l+2*Math.PI)/3),i[4]=-f+d*Math.cos((l+4*Math.PI)/3)},op=function(e,t,r,n,i,a,o,s){var u=1*r*r-4*r*i+2*r*o+4*i*i-4*i*o+o*o+n*n-4*n*a+2*n*s+4*a*a-4*a*s+s*s,l=9*r*i-3*r*r-3*r*o-6*i*i+3*i*o+9*n*a-3*n*n-3*n*s-6*a*a+3*a*s,c=3*r*r-6*r*i+r*o-r*e+2*i*i+2*i*e-o*e+3*n*n-6*n*a+n*s-n*t+2*a*a+2*a*t-s*t,h=1*r*i-r*r+r*e-i*e+n*a-n*n+n*t-a*t,f=[];ap(u,l,c,h,f);for(var d=1e-7,p=[],v=0;v<6;v+=2)Math.abs(f[v+1])<d&&f[v]>=0&&f[v]<=1&&p.push(f[v]);p.push(1),p.push(0);for(var m=-1,g,y,x,T=0;T<p.length;T++)g=Math.pow(1-p[T],2)*r+2*(1-p[T])*p[T]*i+p[T]*p[T]*o,y=Math.pow(1-p[T],2)*n+2*(1-p[T])*p[T]*a+p[T]*p[T]*s,x=Math.pow(g-e,2)+Math.pow(y-t,2),m>=0?x<m&&(m=x):m=x;return m},sp=function(e,t,r,n,i,a){var o=[e-r,t-n],s=[i-r,a-n],u=s[0]*s[0]+s[1]*s[1],l=o[0]*o[0]+o[1]*o[1],c=o[0]*s[0]+o[1]*s[1],h=c*c/u;return c<0?l:h>u?(e-i)*(e-i)+(t-a)*(t-a):l-h},At=function(e,t,r){for(var n,i,a,o,s,u=0,l=0;l<r.length/2;l++)if(n=r[l*2],i=r[l*2+1],l+1<r.length/2?(a=r[(l+1)*2],o=r[(l+1)*2+1]):(a=r[(l+1-r.length/2)*2],o=r[(l+1-r.length/2)*2+1]),!(n==e&&a==e))if(n>=e&&e>=a||n<=e&&e<=a)s=(e-n)/(a-n)*(o-i)+i,s>t&&u++;else continue;return u%2!==0},Zt=function(e,t,r,n,i,a,o,s,u){var l=new Array(r.length),c;s[0]!=null?(c=Math.atan(s[1]/s[0]),s[0]<0?c=c+Math.PI/2:c=-c-Math.PI/2):c=s;for(var h=Math.cos(-c),f=Math.sin(-c),d=0;d<l.length/2;d++)l[d*2]=a/2*(r[d*2]*h-r[d*2+1]*f),l[d*2+1]=o/2*(r[d*2+1]*h+r[d*2]*f),l[d*2]+=n,l[d*2+1]+=i;var p;if(u>0){var v=Ci(l,-u);p=Ai(v)}else p=l;return At(e,t,p)},lp=function(e,t,r,n,i,a,o,s){for(var u=new Array(r.length*2),l=0;l<s.length;l++){var c=s[l];u[l*4+0]=c.startX,u[l*4+1]=c.startY,u[l*4+2]=c.stopX,u[l*4+3]=c.stopY;var h=Math.pow(c.cx-e,2)+Math.pow(c.cy-t,2);if(h<=Math.pow(c.radius,2))return!0}return At(e,t,u)},Ai=function(e){for(var t=new Array(e.length/2),r,n,i,a,o,s,u,l,c=0;c<e.length/4;c++){r=e[c*4],n=e[c*4+1],i=e[c*4+2],a=e[c*4+3],c<e.length/4-1?(o=e[(c+1)*4],s=e[(c+1)*4+1],u=e[(c+1)*4+2],l=e[(c+1)*4+3]):(o=e[0],s=e[1],u=e[2],l=e[3]);var h=ar(r,n,i,a,o,s,u,l,!0);t[c*2]=h[0],t[c*2+1]=h[1]}return t},Ci=function(e,t){for(var r=new Array(e.length*2),n,i,a,o,s=0;s<e.length/2;s++){n=e[s*2],i=e[s*2+1],s<e.length/2-1?(a=e[(s+1)*2],o=e[(s+1)*2+1]):(a=e[0],o=e[1]);var u=o-i,l=-(a-n),c=Math.sqrt(u*u+l*l),h=u/c,f=l/c;r[s*4]=n+h*t,r[s*4+1]=i+f*t,r[s*4+2]=a+h*t,r[s*4+3]=o+f*t}return r},up=function(e,t,r,n,i,a){var o=r-e,s=n-t;o/=i,s/=a;var u=Math.sqrt(o*o+s*s),l=u-1;if(l<0)return[];var c=l/u;return[(r-e)*c+e,(n-t)*c+t]},Dr=function(e,t,r,n,i,a,o){return e-=i,t-=a,e/=r/2+o,t/=n/2+o,e*e+t*t<=1},mn=function(e,t,r,n,i,a,o){var s=[r-e,n-t],u=[e-i,t-a],l=s[0]*s[0]+s[1]*s[1],c=2*(u[0]*s[0]+u[1]*s[1]),h=u[0]*u[0]+u[1]*u[1]-o*o,f=c*c-4*l*h;if(f<0)return[];var d=(-c+Math.sqrt(f))/(2*l),p=(-c-Math.sqrt(f))/(2*l),v=Math.min(d,p),m=Math.max(d,p),g=[];if(v>=0&&v<=1&&g.push(v),m>=0&&m<=1&&g.push(m),g.length===0)return[];var y=g[0]*s[0]+e,x=g[0]*s[1]+t;if(g.length>1){if(g[0]==g[1])return[y,x];var T=g[1]*s[0]+e,w=g[1]*s[1]+t;return[y,x,T,w]}else return[y,x]},ma=function(e,t,r){return t<=e&&e<=r||r<=e&&e<=t?e:e<=t&&t<=r||r<=t&&t<=e?t:r},ar=function(e,t,r,n,i,a,o,s,u){var l=e-i,c=r-e,h=o-i,f=t-a,d=n-t,p=s-a,v=h*f-p*l,m=c*f-d*l,g=p*c-h*d;if(g!==0){var y=v/g,x=m/g,T=.001,w=0-T,D=1+T;return w<=y&&y<=D&&w<=x&&x<=D?[e+y*c,t+y*d]:u?[e+y*c,t+y*d]:[]}else return v===0||m===0?ma(e,r,o)===o?[o,s]:ma(e,r,i)===i?[i,a]:ma(i,o,r)===r?[r,n]:[]:[]},cp=function(e,t,r,n,i){var a=[],o=n/2,s=i/2,u=t,l=r;a.push({x:u+o*e[0],y:l+s*e[1]});for(var c=1;c<e.length/2;c++)a.push({x:u+o*e[c*2],y:l+s*e[c*2+1]});return a},Nn=function(e,t,r,n,i,a,o,s){var u=[],l,c=new Array(r.length),h=!0;a==null&&(h=!1);var f;if(h){for(var d=0;d<c.length/2;d++)c[d*2]=r[d*2]*a+n,c[d*2+1]=r[d*2+1]*o+i;if(s>0){var p=Ci(c,-s);f=Ai(p)}else f=c}else f=r;for(var v,m,g,y,x=0;x<f.length/2;x++)v=f[x*2],m=f[x*2+1],x<f.length/2-1?(g=f[(x+1)*2],y=f[(x+1)*2+1]):(g=f[0],y=f[1]),l=ar(e,t,n,i,v,m,g,y),l.length!==0&&u.push(l[0],l[1]);return u},hp=function(e,t,r,n,i,a,o,s,u){var l=[],c,h=new Array(r.length*2);u.forEach(function(g,y){y===0?(h[h.length-2]=g.startX,h[h.length-1]=g.startY):(h[y*4-2]=g.startX,h[y*4-1]=g.startY),h[y*4]=g.stopX,h[y*4+1]=g.stopY,c=mn(e,t,n,i,g.cx,g.cy,g.radius),c.length!==0&&l.push(c[0],c[1])});for(var f=0;f<h.length/4;f++)c=ar(e,t,n,i,h[f*4],h[f*4+1],h[f*4+2],h[f*4+3],!1),c.length!==0&&l.push(c[0],c[1]);if(l.length>2){for(var d=[l[0],l[1]],p=Math.pow(d[0]-e,2)+Math.pow(d[1]-t,2),v=1;v<l.length/2;v++){var m=Math.pow(l[v*2]-e,2)+Math.pow(l[v*2+1]-t,2);m<=p&&(d[0]=l[v*2],d[1]=l[v*2+1],p=m)}return d}return l},Jn=function(e,t,r){var n=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),a=(i-r)/i;return a<0&&(a=1e-5),[t[0]+a*n[0],t[1]+a*n[1]]},bt=function(e,t){var r=Io(e,t);return r=Oc(r),r},Oc=function(e){for(var t,r,n=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,u=0;u<n;u++)t=e[2*u],r=e[2*u+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,r),s=Math.max(s,r);for(var l=2/(o-i),c=2/(s-a),h=0;h<n;h++)t=e[2*h]=e[2*h]*l,r=e[2*h+1]=e[2*h+1]*c,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,r),s=Math.max(s,r);if(a<-1)for(var f=0;f<n;f++)r=e[2*f+1]=e[2*f+1]+(-1-a);return e},Io=function(e,t){var r=1/e*2*Math.PI,n=e%2===0?Math.PI/2+r/2:Math.PI/2;n+=t;for(var i=new Array(e*2),a,o=0;o<e;o++)a=o*r+n,i[2*o]=Math.cos(a),i[2*o+1]=Math.sin(-a);return i},cr=function(e,t){return Math.min(e/4,t/4,8)},Rc=function(e,t){return Math.min(e/10,t/10,8)},fs=function(){return 8},dp=function(e,t,r){return[e-2*t+r,2*(t-e),e]},Oo=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function ba(e,t){function r(h){for(var f=[],d=0;d<h.length;d++){var p=h[d],v=h[(d+1)%h.length],m={x:v.x-p.x,y:v.y-p.y},g={x:-m.y,y:m.x},y=Math.sqrt(g.x*g.x+g.y*g.y);f.push({x:g.x/y,y:g.y/y})}return f}function n(h,f){var d=1/0,p=-1/0,v=Ct(h),m;try{for(v.s();!(m=v.n()).done;){var g=m.value,y=g.x*f.x+g.y*f.y;d=Math.min(d,y),p=Math.max(p,y)}}catch(x){v.e(x)}finally{v.f()}return{min:d,max:p}}function i(h,f){return!(h.max<f.min||f.max<h.min)}var a=[].concat(wi(r(e)),wi(r(t))),o=Ct(a),s;try{for(o.s();!(s=o.n()).done;){var u=s.value,l=n(e,u),c=n(t,u);if(!i(l,c))return!1}}catch(h){o.e(h)}finally{o.f()}return!0}var fp=ht({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),pp={pageRank:function(e){for(var t=fp(e),r=t.dampingFactor,n=t.precision,i=t.iterations,a=t.weight,o=this._private.cy,s=this.byGroup(),u=s.nodes,l=s.edges,c=u.length,h=c*c,f=l.length,d=new Array(h),p=new Array(c),v=(1-r)/c,m=0;m<c;m++){for(var g=0;g<c;g++){var y=m*c+g;d[y]=0}p[m]=0}for(var x=0;x<f;x++){var T=l[x],w=T.data("source"),D=T.data("target");if(w!==D){var b=u.indexOfId(w),_=u.indexOfId(D),E=a(T),A=_*c+b;d[A]+=E,p[b]+=E}}for(var C=1/c+v,N=0;N<c;N++)if(p[N]===0)for(var S=0;S<c;S++){var M=S*c+N;d[M]=C}else for(var R=0;R<c;R++){var P=R*c+N;d[P]=d[P]/p[N]+v}for(var L=new Array(c),O=new Array(c),I,B=0;B<c;B++)L[B]=1;for(var F=0;F<i;F++){for(var z=0;z<c;z++)O[z]=0;for(var G=0;G<c;G++)for(var H=0;H<c;H++){var j=G*c+H;O[G]+=d[j]*L[H]}jf(O),I=L,L=O,O=I;for(var Z=0,Q=0;Q<c;Q++){var re=I[Q]-L[Q];Z+=re*re}if(Z<n)break}var V={rank:function(Y){return Y=o.collection(Y)[0],L[u.indexOf(Y)]}};return V}},il=ht({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Zr={degreeCentralityNormalized:function(e){e=il(e);var t=this.cy(),r=this.nodes(),n=r.length;if(e.directed){for(var i={},a={},o=0,s=0,u=0;u<n;u++){var l=r[u],c=l.id();e.root=l;var h=this.degreeCentrality(e);o<h.indegree&&(o=h.indegree),s<h.outdegree&&(s=h.outdegree),i[c]=h.indegree,a[c]=h.outdegree}return{indegree:function(g){return o==0?0:(fe(g)&&(g=t.filter(g)),i[g.id()]/o)},outdegree:function(g){return s===0?0:(fe(g)&&(g=t.filter(g)),a[g.id()]/s)}}}else{for(var f={},d=0,p=0;p<n;p++){var v=r[p];e.root=v;var m=this.degreeCentrality(e);d<m.degree&&(d=m.degree),f[v.id()]=m.degree}return{degree:function(g){return d===0?0:(fe(g)&&(g=t.filter(g)),f[g.id()]/d)}}}},degreeCentrality:function(e){e=il(e);var t=this.cy(),r=this,n=e,i=n.root,a=n.weight,o=n.directed,s=n.alpha;if(i=t.collection(i)[0],o){for(var u=i.connectedEdges(),l=u.filter(function(w){return w.target().same(i)&&r.has(w)}),c=u.filter(function(w){return w.source().same(i)&&r.has(w)}),h=l.length,f=c.length,d=0,p=0,v=0;v<l.length;v++)d+=a(l[v]);for(var m=0;m<c.length;m++)p+=a(c[m]);return{indegree:Math.pow(h,1-s)*Math.pow(d,s),outdegree:Math.pow(f,1-s)*Math.pow(p,s)}}else{for(var g=i.connectedEdges().intersection(r),y=g.length,x=0,T=0;T<g.length;T++)x+=a(g[T]);return{degree:Math.pow(y,1-s)*Math.pow(x,s)}}}};Zr.dc=Zr.degreeCentrality;Zr.dcn=Zr.degreeCentralityNormalised=Zr.degreeCentralityNormalized;var al=ht({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Kr={closenessCentralityNormalized:function(e){for(var t=al(e),r=t.harmonic,n=t.weight,i=t.directed,a=this.cy(),o={},s=0,u=this.nodes(),l=this.floydWarshall({weight:n,directed:i}),c=0;c<u.length;c++){for(var h=0,f=u[c],d=0;d<u.length;d++)if(c!==d){var p=l.distance(f,u[d]);r?h+=1/p:h+=p}r||(h=1/h),s<h&&(s=h),o[f.id()]=h}return{closeness:function(v){return s==0?0:(fe(v)?v=a.filter(v)[0].id():v=v.id(),o[v]/s)}}},closenessCentrality:function(e){var t=al(e),r=t.root,n=t.weight,i=t.directed,a=t.harmonic;r=this.filter(r)[0];for(var o=this.dijkstra({root:r,weight:n,directed:i}),s=0,u=this.nodes(),l=0;l<u.length;l++){var c=u[l];if(!c.same(r)){var h=o.distanceTo(c);a?s+=1/h:s+=h}}return a?s:1/s}};Kr.cc=Kr.closenessCentrality;Kr.ccn=Kr.closenessCentralityNormalised=Kr.closenessCentralityNormalized;var gp=ht({weight:null,directed:!1}),Ro={betweennessCentrality:function(e){for(var t=gp(e),r=t.directed,n=t.weight,i=n!=null,a=this.cy(),o=this.nodes(),s={},u={},l=0,c={set:function(g,y){u[g]=y,y>l&&(l=y)},get:function(g){return u[g]}},h=0;h<o.length;h++){var f=o[h],d=f.id();r?s[d]=f.outgoers().nodes():s[d]=f.openNeighborhood().nodes(),c.set(d,0)}for(var p=function(){for(var g=o[v].id(),y=[],x={},T={},w={},D=new Vn(function(z,G){return w[z]-w[G]}),b=0;b<o.length;b++){var _=o[b].id();x[_]=[],T[_]=0,w[_]=1/0}for(T[g]=1,w[g]=0,D.push(g);!D.empty();){var E=D.pop();if(y.push(E),i)for(var A=0;A<s[E].length;A++){var C=s[E][A],N=a.getElementById(E),S=void 0;N.edgesTo(C).length>0?S=N.edgesTo(C)[0]:S=C.edgesTo(N)[0];var M=n(S);C=C.id(),w[C]>w[E]+M&&(w[C]=w[E]+M,D.nodes.indexOf(C)<0?D.push(C):D.updateItem(C),T[C]=0,x[C]=[]),w[C]==w[E]+M&&(T[C]=T[C]+T[E],x[C].push(E))}else for(var R=0;R<s[E].length;R++){var P=s[E][R].id();w[P]==1/0&&(D.push(P),w[P]=w[E]+1),w[P]==w[E]+1&&(T[P]=T[P]+T[E],x[P].push(E))}}for(var L={},O=0;O<o.length;O++)L[o[O].id()]=0;for(;y.length>0;){for(var I=y.pop(),B=0;B<x[I].length;B++){var F=x[I][B];L[F]=L[F]+T[F]/T[I]*(1+L[I])}I!=o[v].id()&&c.set(I,c.get(I)+L[I])}},v=0;v<o.length;v++)p();var m={betweenness:function(g){var y=a.collection(g).id();return c.get(y)},betweennessNormalized:function(g){if(l==0)return 0;var y=a.collection(g).id();return c.get(y)/l}};return m.betweennessNormalised=m.betweennessNormalized,m}};Ro.bc=Ro.betweennessCentrality;var vp=ht({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),yp=function(e){return vp(e)},mp=function(e,t){for(var r=0,n=0;n<t.length;n++)r+=t[n](e);return r},bp=function(e,t,r){for(var n=0;n<t;n++)e[n*t+n]=r},Pc=function(e,t){for(var r,n=0;n<t;n++){r=0;for(var i=0;i<t;i++)r+=e[i*t+n];for(var a=0;a<t;a++)e[a*t+n]=e[a*t+n]/r}},xp=function(e,t,r){for(var n=new Array(r*r),i=0;i<r;i++){for(var a=0;a<r;a++)n[i*r+a]=0;for(var o=0;o<r;o++)for(var s=0;s<r;s++)n[i*r+s]+=e[i*r+o]*t[o*r+s]}return n},wp=function(e,t,r){for(var n=e.slice(0),i=1;i<r;i++)e=xp(e,n,t);return e},Ep=function(e,t,r){for(var n=new Array(t*t),i=0;i<t*t;i++)n[i]=Math.pow(e[i],r);return Pc(n,t),n},Tp=function(e,t,r,n){for(var i=0;i<r;i++){var a=Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n),o=Math.round(t[i]*Math.pow(10,n))/Math.pow(10,n);if(a!==o)return!1}return!0},_p=function(e,t,r,n){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)Math.round(e[a*t+s]*1e3)/1e3>0&&o.push(r[s]);o.length!==0&&i.push(n.collection(o))}return i},Ap=function(e,t){for(var r=0;r<e.length;r++)if(!t[r]||e[r].id()!==t[r].id())return!1;return!0},Cp=function(e){for(var t=0;t<e.length;t++)for(var r=0;r<e.length;r++)t!=r&&Ap(e[t],e[r])&&e.splice(r,1);return e},ol=function(e){for(var t=this.nodes(),r=this.edges(),n=this.cy(),i=yp(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s=t.length,u=s*s,l=new Array(u),c,h=0;h<u;h++)l[h]=0;for(var f=0;f<r.length;f++){var d=r[f],p=a[d.source().id()],v=a[d.target().id()],m=mp(d,i.attributes);l[p*s+v]+=m,l[v*s+p]+=m}bp(l,s,i.multFactor),Pc(l,s);for(var g=!0,y=0;g&&y<i.maxIterations;)g=!1,c=wp(l,s,i.expandFactor),l=Ep(c,s,i.inflateFactor),Tp(l,c,u,4)||(g=!0),y++;var x=_p(l,s,t,n);return x=Cp(x),x},Dp={markovClustering:ol,mcl:ol},Np=function(e){return e},Bc=function(e,t){return Math.abs(t-e)},sl=function(e,t,r){return e+Bc(t,r)},ll=function(e,t,r){return e+Math.pow(r-t,2)},kp=function(e){return Math.sqrt(e)},Mp=function(e,t,r){return Math.max(e,Bc(t,r))},hn=function(e,t,r,n,i){for(var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:Np,o=n,s,u,l=0;l<e;l++)s=t(l),u=r(l),o=i(o,s,u);return a(o)},en={euclidean:function(e,t,r){return e>=2?hn(e,t,r,0,ll,kp):hn(e,t,r,0,sl)},squaredEuclidean:function(e,t,r){return hn(e,t,r,0,ll)},manhattan:function(e,t,r){return hn(e,t,r,0,sl)},max:function(e,t,r){return hn(e,t,r,-1/0,Mp)}};en["squared-euclidean"]=en.squaredEuclidean;en.squaredeuclidean=en.squaredEuclidean;function zi(e,t,r,n,i,a){var o;return We(e)?o=e:o=en[e]||en.euclidean,t===0&&We(e)?o(i,a):o(t,r,n,i,a)}var Sp=ht({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),ps=function(e){return Sp(e)},Di=function(e,t,r,n,i){var a=i!=="kMedoids",o=a?function(c){return r[c]}:function(c){return n[c](r)},s=function(c){return n[c](t)},u=r,l=t;return zi(e,n.length,o,s,u,l)},xa=function(e,t,r){for(var n=r.length,i=new Array(n),a=new Array(n),o=new Array(t),s=null,u=0;u<n;u++)i[u]=e.min(r[u]).value,a[u]=e.max(r[u]).value;for(var l=0;l<t;l++){s=[];for(var c=0;c<n;c++)s[c]=Math.random()*(a[c]-i[c])+i[c];o[l]=s}return o},Fc=function(e,t,r,n,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var u=Di(r,e,t[s],n,i);u<a&&(a=u,o=s)}return o},zc=function(e,t,r){for(var n=[],i=null,a=0;a<t.length;a++)i=t[a],r[i.id()]===e&&n.push(i);return n},Lp=function(e,t,r){return Math.abs(t-e)<=r},Ip=function(e,t,r){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++){var a=Math.abs(e[n][i]-t[n][i]);if(a>r)return!1}return!0},Op=function(e,t,r){for(var n=0;n<r;n++)if(e===t[n])return!0;return!1},ul=function(e,t){var r=new Array(t);if(e.length<50)for(var n=0;n<t;n++){for(var i=e[Math.floor(Math.random()*e.length)];Op(i,r,n);)i=e[Math.floor(Math.random()*e.length)];r[n]=i}else for(var a=0;a<t;a++)r[a]=e[Math.floor(Math.random()*e.length)];return r},cl=function(e,t,r){for(var n=0,i=0;i<t.length;i++)n+=Di("manhattan",t[i],e,r,"kMedoids");return n},Rp=function(e){var t=this.cy(),r=this.nodes(),n=null,i=ps(e),a=new Array(i.k),o={},s;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,s=xa(r,i.k,i.attributes)):rt(i.testCentroids)==="object"?s=i.testCentroids:s=xa(r,i.k,i.attributes):s=xa(r,i.k,i.attributes);for(var u=!0,l=0;u&&l<i.maxIterations;){for(var c=0;c<r.length;c++)n=r[c],o[n.id()]=Fc(n,s,i.distance,i.attributes,"kMeans");u=!1;for(var h=0;h<i.k;h++){var f=zc(h,r,o);if(f.length!==0){for(var d=i.attributes.length,p=s[h],v=new Array(d),m=new Array(d),g=0;g<d;g++){m[g]=0;for(var y=0;y<f.length;y++)n=f[y],m[g]+=i.attributes[g](n);v[g]=m[g]/f.length,Lp(v[g],p[g],i.sensitivityThreshold)||(u=!0)}s[h]=v,a[h]=t.collection(f)}}l++}return a},Pp=function(e){var t=this.cy(),r=this.nodes(),n=null,i=ps(e),a=new Array(i.k),o,s={},u,l=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(rt(i.testCentroids)==="object"?o=i.testCentroids:o=ul(r,i.k)):o=ul(r,i.k);for(var c=!0,h=0;c&&h<i.maxIterations;){for(var f=0;f<r.length;f++)n=r[f],s[n.id()]=Fc(n,o,i.distance,i.attributes,"kMedoids");c=!1;for(var d=0;d<o.length;d++){var p=zc(d,r,s);if(p.length!==0){l[d]=cl(o[d],p,i.attributes);for(var v=0;v<p.length;v++)u=cl(p[v],p,i.attributes),u<l[d]&&(l[d]=u,o[d]=p[v],c=!0);a[d]=t.collection(p)}}h++}return a},Bp=function(e,t,r,n,i){for(var a,o,s=0;s<t.length;s++)for(var u=0;u<e.length;u++)n[s][u]=Math.pow(r[s][u],i.m);for(var l=0;l<e.length;l++)for(var c=0;c<i.attributes.length;c++){a=0,o=0;for(var h=0;h<t.length;h++)a+=n[h][l]*i.attributes[c](t[h]),o+=n[h][l];e[l][c]=a/o}},Fp=function(e,t,r,n,i){for(var a=0;a<e.length;a++)t[a]=e[a].slice();for(var o,s,u,l=2/(i.m-1),c=0;c<r.length;c++)for(var h=0;h<n.length;h++){o=0;for(var f=0;f<r.length;f++)s=Di(i.distance,n[h],r[c],i.attributes,"cmeans"),u=Di(i.distance,n[h],r[f],i.attributes,"cmeans"),o+=Math.pow(s/u,l);e[h][c]=1/o}},zp=function(e,t,r,n){for(var i=new Array(r.k),a=0;a<i.length;a++)i[a]=[];for(var o,s,u=0;u<t.length;u++){o=-1/0,s=-1;for(var l=0;l<t[0].length;l++)t[u][l]>o&&(o=t[u][l],s=l);i[s].push(e[u])}for(var c=0;c<i.length;c++)i[c]=n.collection(i[c]);return i},hl=function(e){var t=this.cy(),r=this.nodes(),n=ps(e),i,a,o,s,u;s=new Array(r.length);for(var l=0;l<r.length;l++)s[l]=new Array(n.k);o=new Array(r.length);for(var c=0;c<r.length;c++)o[c]=new Array(n.k);for(var h=0;h<r.length;h++){for(var f=0,d=0;d<n.k;d++)o[h][d]=Math.random(),f+=o[h][d];for(var p=0;p<n.k;p++)o[h][p]=o[h][p]/f}a=new Array(n.k);for(var v=0;v<n.k;v++)a[v]=new Array(n.attributes.length);u=new Array(r.length);for(var m=0;m<r.length;m++)u[m]=new Array(n.k);for(var g=!0,y=0;g&&y<n.maxIterations;)g=!1,Bp(a,r,o,u,n),Fp(o,s,a,r,n),Ip(o,s,n.sensitivityThreshold)||(g=!0),y++;return i=zp(r,o,n,t),{clusters:i,degreeOfMembership:o}},Vp={kMeans:Rp,kMedoids:Pp,fuzzyCMeans:hl,fcm:hl},Gp=ht({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Yp={single:"min",complete:"max"},Up=function(e){var t=Gp(e),r=Yp[t.linkage];return r!=null&&(t.linkage=r),t},dl=function(e,t,r,n,i){for(var a=0,o=1/0,s,u=i.attributes,l=function(b,_){return zi(i.distance,u.length,function(E){return u[E](b)},function(E){return u[E](_)},b,_)},c=0;c<e.length;c++){var h=e[c].key,f=r[h][n[h]];f<o&&(a=h,o=f)}if(i.mode==="threshold"&&o>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=t[a],p=t[n[a]],v;i.mode==="dendrogram"?v={left:d,right:p,key:d.key}:v={value:d.value.concat(p.value),key:d.key},e[d.index]=v,e.splice(p.index,1),t[d.key]=v;for(var m=0;m<e.length;m++){var g=e[m];d.key===g.key?s=1/0:i.linkage==="min"?(s=r[d.key][g.key],r[d.key][g.key]>r[p.key][g.key]&&(s=r[p.key][g.key])):i.linkage==="max"?(s=r[d.key][g.key],r[d.key][g.key]<r[p.key][g.key]&&(s=r[p.key][g.key])):i.linkage==="mean"?s=(r[d.key][g.key]*d.size+r[p.key][g.key]*p.size)/(d.size+p.size):i.mode==="dendrogram"?s=l(g.value,d.value):s=l(g.value[0],d.value[0]),r[d.key][g.key]=r[g.key][d.key]=s}for(var y=0;y<e.length;y++){var x=e[y].key;if(n[x]===d.key||n[x]===p.key){for(var T=x,w=0;w<e.length;w++){var D=e[w].key;r[x][D]<r[x][T]&&(T=D)}n[x]=T}e[y].index=y}return d.key=p.key=d.index=p.index=null,!0},Hr=function(e,t,r){e&&(e.value?t.push(e.value):(e.left&&Hr(e.left,t),e.right&&Hr(e.right,t)))},Po=function(e,t){if(!e)return"";if(e.left&&e.right){var r=Po(e.left,t),n=Po(e.right,t),i=t.add({group:"nodes",data:{id:r+","+n}});return t.add({group:"edges",data:{source:r,target:i.id()}}),t.add({group:"edges",data:{source:n,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},Bo=function(e,t,r){if(!e)return[];var n=[],i=[],a=[];return t===0?(e.left&&Hr(e.left,n),e.right&&Hr(e.right,i),a=n.concat(i),[r.collection(a)]):t===1?e.value?[r.collection(e.value)]:(e.left&&Hr(e.left,n),e.right&&Hr(e.right,i),[r.collection(n),r.collection(i)]):e.value?[r.collection(e.value)]:(e.left&&(n=Bo(e.left,t-1,r)),e.right&&(i=Bo(e.right,t-1,r)),n.concat(i))},fl=function(e){for(var t=this.cy(),r=this.nodes(),n=Up(e),i=n.attributes,a=function(g,y){return zi(n.distance,i.length,function(x){return i[x](g)},function(x){return i[x](y)},g,y)},o=[],s=[],u=[],l=[],c=0;c<r.length;c++){var h={value:n.mode==="dendrogram"?r[c]:[r[c]],key:c,index:c};o[c]=h,l[c]=h,s[c]=[],u[c]=0}for(var f=0;f<o.length;f++)for(var d=0;d<=f;d++){var p=void 0;n.mode==="dendrogram"?p=f===d?1/0:a(o[f].value,o[d].value):p=f===d?1/0:a(o[f].value[0],o[d].value[0]),s[f][d]=p,s[d][f]=p,p<s[f][u[f]]&&(u[f]=d)}for(var v=dl(o,l,s,u,n);v;)v=dl(o,l,s,u,n);var m;return n.mode==="dendrogram"?(m=Bo(o[0],n.dendrogramDepth,t),n.addDendrogram&&Po(o[0],t)):(m=new Array(o.length),o.forEach(function(g,y){g.key=g.index=null,m[y]=t.collection(g.value)})),m},Xp={hierarchicalClustering:fl,hca:fl},Wp=ht({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),qp=function(e){var t=e.damping,r=e.preference;.5<=t&&t<1||Xe("Damping must range on [0.5, 1). Got: ".concat(t));var n=["median","mean","min","max"];return n.some(function(i){return i===r})||ne(r)||Xe("Preference must be one of [".concat(n.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(r)),Wp(e)},Hp=function(e,t,r,n){var i=function(a,o){return n[o](a)};return-zi(e,n.length,function(a){return i(t,a)},function(a){return i(r,a)},t,r)},jp=function(e,t){var r=null;return t==="median"?r=qf(e):t==="mean"?r=Wf(e):t==="min"?r=Uf(e):t==="max"?r=Xf(e):r=t,r},$p=function(e,t,r){for(var n=[],i=0;i<e;i++)t[i*e+i]+r[i*e+i]>0&&n.push(i);return n},pl=function(e,t,r){for(var n=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<r.length;s++){var u=r[s];t[i*e+u]>o&&(a=u,o=t[i*e+u])}a>0&&n.push(a)}for(var l=0;l<r.length;l++)n[r[l]]=r[l];return n},Zp=function(e,t,r){for(var n=pl(e,t,r),i=0;i<r.length;i++){for(var a=[],o=0;o<n.length;o++)n[o]===r[i]&&a.push(o);for(var s=-1,u=-1/0,l=0;l<a.length;l++){for(var c=0,h=0;h<a.length;h++)c+=t[a[h]*e+a[l]];c>u&&(s=l,u=c)}r[i]=a[s]}return n=pl(e,t,r),n},gl=function(e){for(var t=this.cy(),r=this.nodes(),n=qp(e),i={},a=0;a<r.length;a++)i[r[a].id()]=a;var o,s,u,l,c,h;o=r.length,s=o*o,u=new Array(s);for(var f=0;f<s;f++)u[f]=-1/0;for(var d=0;d<o;d++)for(var p=0;p<o;p++)d!==p&&(u[d*o+p]=Hp(n.distance,r[d],r[p],n.attributes));l=jp(u,n.preference);for(var v=0;v<o;v++)u[v*o+v]=l;c=new Array(s);for(var m=0;m<s;m++)c[m]=0;h=new Array(s);for(var g=0;g<s;g++)h[g]=0;for(var y=new Array(o),x=new Array(o),T=new Array(o),w=0;w<o;w++)y[w]=0,x[w]=0,T[w]=0;for(var D=new Array(o*n.minIterations),b=0;b<D.length;b++)D[b]=0;var _;for(_=0;_<n.maxIterations;_++){for(var E=0;E<o;E++){for(var A=-1/0,C=-1/0,N=-1,S=0,M=0;M<o;M++)y[M]=c[E*o+M],S=h[E*o+M]+u[E*o+M],S>=A?(C=A,A=S,N=M):S>C&&(C=S);for(var R=0;R<o;R++)c[E*o+R]=(1-n.damping)*(u[E*o+R]-A)+n.damping*y[R];c[E*o+N]=(1-n.damping)*(u[E*o+N]-C)+n.damping*y[N]}for(var P=0;P<o;P++){for(var L=0,O=0;O<o;O++)y[O]=h[O*o+P],x[O]=Math.max(0,c[O*o+P]),L+=x[O];L-=x[P],x[P]=c[P*o+P],L+=x[P];for(var I=0;I<o;I++)h[I*o+P]=(1-n.damping)*Math.min(0,L-x[I])+n.damping*y[I];h[P*o+P]=(1-n.damping)*(L-x[P])+n.damping*y[P]}for(var B=0,F=0;F<o;F++){var z=h[F*o+F]+c[F*o+F]>0?1:0;D[_%n.minIterations*o+F]=z,B+=z}if(B>0&&(_>=n.minIterations-1||_==n.maxIterations-1)){for(var G=0,H=0;H<o;H++){T[H]=0;for(var j=0;j<n.minIterations;j++)T[H]+=D[j*o+H];(T[H]===0||T[H]===n.minIterations)&&G++}if(G===o)break}}for(var Z=$p(o,c,h),Q=Zp(o,u,Z),re={},V=0;V<Z.length;V++)re[Z[V]]=[];for(var Y=0;Y<r.length;Y++){var U=i[r[Y].id()],K=Q[U];K!=null&&re[K].push(r[Y])}for(var ee=new Array(Z.length),ie=0;ie<Z.length;ie++)ee[ie]=t.collection(re[Z[ie]]);return ee},Kp={affinityPropagation:gl,ap:gl},Qp=ht({root:void 0,directed:!1}),Jp={hierholzer:function(e){if(!ke(e)){var t=arguments;e={root:t[0],directed:t[1]}}var r=Qp(e),n=r.root,i=r.directed,a=this,o=!1,s,u,l;n&&(l=fe(n)?this.filter(n)[0].id():n[0].id());var c={},h={};i?a.forEach(function(g){var y=g.id();if(g.isNode()){var x=g.indegree(!0),T=g.outdegree(!0),w=x-T,D=T-x;w==1?s?o=!0:s=y:D==1?u?o=!0:u=y:(D>1||w>1)&&(o=!0),c[y]=[],g.outgoers().forEach(function(b){b.isEdge()&&c[y].push(b.id())})}else h[y]=[void 0,g.target().id()]}):a.forEach(function(g){var y=g.id();if(g.isNode()){var x=g.degree(!0);x%2&&(s?u?o=!0:u=y:s=y),c[y]=[],g.connectedEdges().forEach(function(T){return c[y].push(T.id())})}else h[y]=[g.source().id(),g.target().id()]});var f={found:!1,trail:void 0};if(o)return f;if(u&&s)if(i){if(l&&u!=l)return f;l=u}else{if(l&&u!=l&&s!=l)return f;l||(l=u)}else l||(l=a[0].id());var d=function(g){for(var y=g,x=[g],T,w,D;c[y].length;)T=c[y].shift(),w=h[T][0],D=h[T][1],y!=D?(c[D]=c[D].filter(function(b){return b!=T}),y=D):!i&&y!=w&&(c[w]=c[w].filter(function(b){return b!=T}),y=w),x.unshift(T),x.unshift(y);return x},p=[],v=[];for(v=d(l);v.length!=1;)c[v[0]].length==0?(p.unshift(a.getElementById(v.shift())),p.unshift(a.getElementById(v.shift()))):v=d(v.shift()).concat(v);p.unshift(a.getElementById(v.shift()));for(var m in c)if(c[m].length)return f;return f.found=!0,f.trail=this.spawn(p,!0),f}},ei=function(){var e=this,t={},r=0,n=0,i=[],a=[],o={},s=function(c,h){for(var f=a.length-1,d=[],p=e.spawn();a[f].x!=c||a[f].y!=h;)d.push(a.pop().edge),f--;d.push(a.pop().edge),d.forEach(function(v){var m=v.connectedNodes().intersection(e);p.merge(v),m.forEach(function(g){var y=g.id(),x=g.connectedEdges().intersection(e);p.merge(g),t[y].cutVertex?p.merge(x.filter(function(T){return T.isLoop()})):p.merge(x)})}),i.push(p)},u=function(c,h,f){c===f&&(n+=1),t[h]={id:r,low:r++,cutVertex:!1};var d=e.getElementById(h).connectedEdges().intersection(e);if(d.size()===0)i.push(e.spawn(e.getElementById(h)));else{var p,v,m,g;d.forEach(function(y){p=y.source().id(),v=y.target().id(),m=p===h?v:p,m!==f&&(g=y.id(),o[g]||(o[g]=!0,a.push({x:h,y:m,edge:y})),m in t?t[h].low=Math.min(t[h].low,t[m].id):(u(c,m,h),t[h].low=Math.min(t[h].low,t[m].low),t[h].id<=t[m].low&&(t[h].cutVertex=!0,s(h,m))))})}};e.forEach(function(c){if(c.isNode()){var h=c.id();h in t||(n=0,u(h,h),t[h].cutVertex=n>1)}});var l=Object.keys(t).filter(function(c){return t[c].cutVertex}).map(function(c){return e.getElementById(c)});return{cut:e.spawn(l),components:i}},eg={hopcroftTarjanBiconnected:ei,htbc:ei,htb:ei,hopcroftTarjanBiconnectedComponents:ei},ti=function(){var e=this,t={},r=0,n=[],i=[],a=e.spawn(e),o=function(s){i.push(s),t[s]={index:r,low:r++,explored:!1};var u=e.getElementById(s).connectedEdges().intersection(e);if(u.forEach(function(d){var p=d.target().id();p!==s&&(p in t||o(p),t[p].explored||(t[s].low=Math.min(t[s].low,t[p].low)))}),t[s].index===t[s].low){for(var l=e.spawn();;){var c=i.pop();if(l.merge(e.getElementById(c)),t[c].low=t[s].index,t[c].explored=!0,c===s)break}var h=l.edgesWith(l),f=l.merge(h);n.push(f),a=a.difference(f)}};return e.forEach(function(s){if(s.isNode()){var u=s.id();u in t||o(u)}}),{cut:a,components:n}},tg={tarjanStronglyConnected:ti,tsc:ti,tscc:ti,tarjanStronglyConnectedComponents:ti},Vc={};[Cn,Sf,Lf,Of,Pf,Ff,Gf,pp,Zr,Kr,Ro,Dp,Vp,Xp,Kp,Jp,eg,tg].forEach(function(e){ge(Vc,e)});/*!
|
|
5
|
-
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
|
|
6
|
-
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
|
|
7
|
-
Licensed under The MIT License (http://opensource.org/licenses/MIT)
|
|
8
|
-
*/var Gc=0,Yc=1,Uc=2,Bt=function(e){if(!(this instanceof Bt))return new Bt(e);this.id="Thenable/1.0.7",this.state=Gc,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};Bt.prototype={fulfill:function(e){return vl(this,Yc,"fulfillValue",e)},reject:function(e){return vl(this,Uc,"rejectReason",e)},then:function(e,t){var r=this,n=new Bt;return r.onFulfilled.push(ml(e,n,"fulfill")),r.onRejected.push(ml(t,n,"reject")),Xc(r),n.proxy}};var vl=function(e,t,r,n){return e.state===Gc&&(e.state=t,e[r]=n,Xc(e)),e},Xc=function(e){e.state===Yc?yl(e,"onFulfilled",e.fulfillValue):e.state===Uc&&yl(e,"onRejected",e.rejectReason)},yl=function(e,t,r){if(e[t].length!==0){var n=e[t];e[t]=[];var i=function(){for(var a=0;a<n.length;a++)n[a](r)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},ml=function(e,t,r){return function(n){if(typeof e!="function")t[r].call(t,n);else{var i;try{i=e(n)}catch(a){t.reject(a);return}Wc(t,i)}}},Wc=function(e,t){if(e===t||e.proxy===t){e.reject(new TypeError("cannot resolve promise with itself"));return}var r;if(rt(t)==="object"&&t!==null||typeof t=="function")try{r=t.then}catch(i){e.reject(i);return}if(typeof r=="function"){var n=!1;try{r.call(t,function(i){n||(n=!0,i===t?e.reject(new TypeError("circular thenable chain")):Wc(e,i))},function(i){n||(n=!0,e.reject(i))})}catch(i){n||e.reject(i)}return}e.fulfill(t)};Bt.all=function(e){return new Bt(function(t,r){for(var n=new Array(e.length),i=0,a=function(s,u){n[s]=u,i++,i===e.length&&t(n)},o=0;o<e.length;o++)(function(s){var u=e[s],l=u!=null&&u.then!=null;if(l)u.then(function(h){a(s,h)},function(h){r(h)});else{var c=u;a(s,c)}})(o)})};Bt.resolve=function(e){return new Bt(function(t,r){t(e)})};Bt.reject=function(e){return new Bt(function(t,r){r(e)})};var nn=typeof Promise<"u"?Promise:Bt,Fo=function(e,t,r){var n=is(e),i=!n,a=this._private=ge({duration:1e3},t,r);if(a.target=e,a.style=a.style||a.css,a.started=!1,a.playing=!1,a.hooked=!1,a.applying=!1,a.progress=0,a.completes=[],a.frames=[],a.complete&&We(a.complete)&&a.completes.push(a.complete),i){var o=e.position();a.startPosition=a.startPosition||{x:o.x,y:o.y},a.startStyle=a.startStyle||e.cy().style().getAnimationStartStyle(e,a.style)}if(n){var s=e.pan();a.startPan={x:s.x,y:s.y},a.startZoom=e.zoom()}this.length=1,this[0]=this},Mr=Fo.prototype;ge(Mr,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t,r=e.target._private.animation;e.queue?t=r.queue:t=r.current,t.push(this),Dt(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return e===void 0?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,r=t.playing;return e===void 0?t.progress:(r&&this.pause(),t.progress=e,t.started=!1,r&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var r=function(s,u){var l=e[s];l!=null&&(e[s]=e[u],e[u]=l)};if(r("zoom","startZoom"),r("pan","startPan"),r("position","startPosition"),e.style)for(var n=0;n<e.style.length;n++){var i=e.style[n],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[n]=o}return t&&this.play(),this},promise:function(e){var t=this._private,r;switch(e){case"frame":r=t.frames;break;default:case"complete":case"completed":r=t.completes}return new nn(function(n,i){r.push(function(){n()})})}});Mr.complete=Mr.completed;Mr.run=Mr.play;Mr.running=Mr.playing;var rg={animated:function(){return function(){var e=this,t=e.length!==void 0,r=t?e:[e],n=this._private.cy||this;if(!n.styleEnabled())return!1;var i=r[0];if(i)return i._private.animation.current.length>0}},clearQueue:function(){return function(){var e=this,t=e.length!==void 0,r=t?e:[e],n=this._private.cy||this;if(!n.styleEnabled())return this;for(var i=0;i<r.length;i++){var a=r[i];a._private.animation.queue=[]}return this}},delay:function(){return function(e,t){var r=this._private.cy||this;return r.styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){var r=this._private.cy||this;return r.styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var r=this,n=r.length!==void 0,i=n?r:[r],a=this._private.cy||this,o=!n,s=!o;if(!a.styleEnabled())return this;var u=a.style();e=ge({},e,t);var l=Object.keys(e).length===0;if(l)return new Fo(i[0],e);switch(e.duration===void 0&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200;break}if(s&&(e.style=u.getPropsList(e.style||e.css),e.css=void 0),s&&e.renderedPosition!=null){var c=e.renderedPosition,h=a.pan(),f=a.zoom();e.position=Mc(c,f,h)}if(o&&e.panBy!=null){var d=e.panBy,p=a.pan();e.pan={x:p.x+d.x,y:p.y+d.y}}var v=e.center||e.centre;if(o&&v!=null){var m=a.getCenterPan(v.eles,e.zoom);m!=null&&(e.pan=m)}if(o&&e.fit!=null){var g=e.fit,y=a.getFitViewport(g.eles||g.boundingBox,g.padding);y!=null&&(e.pan=y.pan,e.zoom=y.zoom)}if(o&&ke(e.zoom)){var x=a.getZoomedViewport(e.zoom);x!=null?(x.zoomed&&(e.zoom=x.zoom),x.panned&&(e.pan=x.pan)):e.zoom=null}return new Fo(i[0],e)}},animate:function(){return function(e,t){var r=this,n=r.length!==void 0,i=n?r:[r],a=this._private.cy||this;if(!a.styleEnabled())return this;t&&(e=ge({},e,t));for(var o=0;o<i.length;o++){var s=i[o],u=s.animated()&&(e.queue===void 0||e.queue),l=s.animation(e,u?{queue:!0}:void 0);l.play()}return this}},stop:function(){return function(e,t){var r=this,n=r.length!==void 0,i=n?r:[r],a=this._private.cy||this;if(!a.styleEnabled())return this;for(var o=0;o<i.length;o++){for(var s=i[o],u=s._private,l=u.animation.current,c=0;c<l.length;c++){var h=l[c],f=h._private;t&&(f.duration=0)}e&&(u.animation.queue=[]),t||(u.animation.current=[])}return a.notify("draw"),this}}},wa,bl;function Vi(){if(bl)return wa;bl=1;var e=Array.isArray;return wa=e,wa}var Ea,xl;function ng(){if(xl)return Ea;xl=1;var e=Vi(),t=Fn(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var s=typeof a;return s=="number"||s=="symbol"||s=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return Ea=i,Ea}var Ta,wl;function ig(){if(wl)return Ta;wl=1;var e=wc(),t=Bn(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(s){if(!t(s))return!1;var u=e(s);return u==n||u==i||u==r||u==a}return Ta=o,Ta}var _a,El;function ag(){if(El)return _a;El=1;var e=Pi(),t=e["__core-js_shared__"];return _a=t,_a}var Aa,Tl;function og(){if(Tl)return Aa;Tl=1;var e=ag(),t=function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function r(n){return!!t&&t in n}return Aa=r,Aa}var Ca,_l;function sg(){if(_l)return Ca;_l=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return Ca=r,Ca}var Da,Al;function lg(){if(Al)return Da;Al=1;var e=ig(),t=og(),r=Bn(),n=sg(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,l=s.hasOwnProperty,c=RegExp("^"+u.call(l).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function h(f){if(!r(f)||t(f))return!1;var d=e(f)?c:a;return d.test(n(f))}return Da=h,Da}var Na,Cl;function ug(){if(Cl)return Na;Cl=1;function e(t,r){return t==null?void 0:t[r]}return Na=e,Na}var ka,Dl;function gs(){if(Dl)return ka;Dl=1;var e=lg(),t=ug();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return ka=r,ka}var Ma,Nl;function Gi(){if(Nl)return Ma;Nl=1;var e=gs(),t=e(Object,"create");return Ma=t,Ma}var Sa,kl;function cg(){if(kl)return Sa;kl=1;var e=Gi();function t(){this.__data__=e?e(null):{},this.size=0}return Sa=t,Sa}var La,Ml;function hg(){if(Ml)return La;Ml=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return La=e,La}var Ia,Sl;function dg(){if(Sl)return Ia;Sl=1;var e=Gi(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var s=o[a];return s===t?void 0:s}return n.call(o,a)?o[a]:void 0}return Ia=i,Ia}var Oa,Ll;function fg(){if(Ll)return Oa;Ll=1;var e=Gi(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return Oa=n,Oa}var Ra,Il;function pg(){if(Il)return Ra;Il=1;var e=Gi(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return Ra=r,Ra}var Pa,Ol;function gg(){if(Ol)return Pa;Ol=1;var e=cg(),t=hg(),r=dg(),n=fg(),i=pg();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Pa=a,Pa}var Ba,Rl;function vg(){if(Rl)return Ba;Rl=1;function e(){this.__data__=[],this.size=0}return Ba=e,Ba}var Fa,Pl;function qc(){if(Pl)return Fa;Pl=1;function e(t,r){return t===r||t!==t&&r!==r}return Fa=e,Fa}var za,Bl;function Yi(){if(Bl)return za;Bl=1;var e=qc();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return za=t,za}var Va,Fl;function yg(){if(Fl)return Va;Fl=1;var e=Yi(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var s=a.length-1;return o==s?a.pop():r.call(a,o,1),--this.size,!0}return Va=n,Va}var Ga,zl;function mg(){if(zl)return Ga;zl=1;var e=Yi();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return Ga=t,Ga}var Ya,Vl;function bg(){if(Vl)return Ya;Vl=1;var e=Yi();function t(r){return e(this.__data__,r)>-1}return Ya=t,Ya}var Ua,Gl;function xg(){if(Gl)return Ua;Gl=1;var e=Yi();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return Ua=t,Ua}var Xa,Yl;function wg(){if(Yl)return Xa;Yl=1;var e=vg(),t=yg(),r=mg(),n=bg(),i=xg();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Xa=a,Xa}var Wa,Ul;function Eg(){if(Ul)return Wa;Ul=1;var e=gs(),t=Pi(),r=e(t,"Map");return Wa=r,Wa}var qa,Xl;function Tg(){if(Xl)return qa;Xl=1;var e=gg(),t=wg(),r=Eg();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return qa=n,qa}var Ha,Wl;function _g(){if(Wl)return Ha;Wl=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Ha=e,Ha}var ja,ql;function Ui(){if(ql)return ja;ql=1;var e=_g();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return ja=t,ja}var $a,Hl;function Ag(){if(Hl)return $a;Hl=1;var e=Ui();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return $a=t,$a}var Za,jl;function Cg(){if(jl)return Za;jl=1;var e=Ui();function t(r){return e(this,r).get(r)}return Za=t,Za}var Ka,$l;function Dg(){if($l)return Ka;$l=1;var e=Ui();function t(r){return e(this,r).has(r)}return Ka=t,Ka}var Qa,Zl;function Ng(){if(Zl)return Qa;Zl=1;var e=Ui();function t(r,n){var i=e(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return Qa=t,Qa}var Ja,Kl;function kg(){if(Kl)return Ja;Kl=1;var e=Tg(),t=Ag(),r=Cg(),n=Dg(),i=Ng();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Ja=a,Ja}var eo,Ql;function Mg(){if(Ql)return eo;Ql=1;var e=kg(),t="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,s=i?i.apply(this,o):o[0],u=a.cache;if(u.has(s))return u.get(s);var l=n.apply(this,o);return a.cache=u.set(s,l)||u,l};return a.cache=new(r.Cache||e),a}return r.Cache=e,eo=r,eo}var to,Jl;function Sg(){if(Jl)return to;Jl=1;var e=Mg(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return to=r,to}var ro,eu;function Hc(){if(eu)return ro;eu=1;var e=Sg(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,s,u,l){a.push(u?l.replace(r,"$1"):s||o)}),a});return ro=n,ro}var no,tu;function jc(){if(tu)return no;tu=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=r(t[n],n,t);return a}return no=e,no}var io,ru;function Lg(){if(ru)return io;ru=1;var e=os(),t=jc(),r=Vi(),n=Fn(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(s){if(typeof s=="string")return s;if(r(s))return t(s,o)+"";if(n(s))return a?a.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return io=o,io}var ao,nu;function $c(){if(nu)return ao;nu=1;var e=Lg();function t(r){return r==null?"":e(r)}return ao=t,ao}var oo,iu;function Zc(){if(iu)return oo;iu=1;var e=Vi(),t=ng(),r=Hc(),n=$c();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return oo=i,oo}var so,au;function vs(){if(au)return so;au=1;var e=Fn();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return so=t,so}var lo,ou;function Ig(){if(ou)return lo;ou=1;var e=Zc(),t=vs();function r(n,i){i=e(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[t(i[a++])];return a&&a==o?n:void 0}return lo=r,lo}var uo,su;function Og(){if(su)return uo;su=1;var e=Ig();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return uo=t,uo}var Rg=Og(),Pg=Pn(Rg),co,lu;function Bg(){if(lu)return co;lu=1;var e=gs(),t=function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}}();return co=t,co}var ho,uu;function Fg(){if(uu)return ho;uu=1;var e=Bg();function t(r,n,i){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return ho=t,ho}var fo,cu;function zg(){if(cu)return fo;cu=1;var e=Fg(),t=qc(),r=Object.prototype,n=r.hasOwnProperty;function i(a,o,s){var u=a[o];(!(n.call(a,o)&&t(u,s))||s===void 0&&!(o in a))&&e(a,o,s)}return fo=i,fo}var po,hu;function Vg(){if(hu)return po;hu=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(n,i){var a=typeof n;return i=i??e,!!i&&(a=="number"||a!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<i}return po=r,po}var go,du;function Gg(){if(du)return go;du=1;var e=zg(),t=Zc(),r=Vg(),n=Bn(),i=vs();function a(o,s,u,l){if(!n(o))return o;s=t(s,o);for(var c=-1,h=s.length,f=h-1,d=o;d!=null&&++c<h;){var p=i(s[c]),v=u;if(p==="__proto__"||p==="constructor"||p==="prototype")return o;if(c!=f){var m=d[p];v=l?l(m,p,d):void 0,v===void 0&&(v=n(m)?m:r(s[c+1])?[]:{})}e(d,p,v),d=d[p]}return o}return go=a,go}var vo,fu;function Yg(){if(fu)return vo;fu=1;var e=Gg();function t(r,n,i){return r==null?r:e(r,n,i)}return vo=t,vo}var Ug=Yg(),Xg=Pn(Ug),yo,pu;function Wg(){if(pu)return yo;pu=1;function e(t,r){var n=-1,i=t.length;for(r||(r=Array(i));++n<i;)r[n]=t[n];return r}return yo=e,yo}var mo,gu;function qg(){if(gu)return mo;gu=1;var e=jc(),t=Wg(),r=Vi(),n=Fn(),i=Hc(),a=vs(),o=$c();function s(u){return r(u)?e(u,a):n(u)?[u]:t(i(o(u)))}return mo=s,mo}var Hg=qg(),jg=Pn(Hg),$g={data:function(e){var t={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(r){},beforeSet:function(r,n){},onSet:function(r){},canSet:function(r){return!0}};return e=ge({},t,e),function(r,n){var i=e,a=this,o=a.length!==void 0,s=o?a:[a],u=o?a[0]:a;if(fe(r)){var l=r.indexOf(".")!==-1,c=l&&jg(r);if(i.allowGetting&&n===void 0){var h;return u&&(i.beforeGet(u),c&&u._private[i.field][r]===void 0?h=Pg(u._private[i.field],c):h=u._private[i.field][r]),h}else if(i.allowSetting&&n!==void 0){var f=!i.immutableKeys[r];if(f){var d=hc({},r,n);i.beforeSet(a,d);for(var p=0,v=s.length;p<v;p++){var m=s[p];i.canSet(m)&&(c&&u._private[i.field][r]===void 0?Xg(m._private[i.field],c,n):m._private[i.field][r]=n)}i.updateStyle&&a.updateStyle(),i.onSet(a),i.settingTriggersEvent&&a[i.triggerFnName](i.settingEvent)}}}else if(i.allowSetting&&ke(r)){var g=r,y,x,T=Object.keys(g);i.beforeSet(a,g);for(var w=0;w<T.length;w++){y=T[w],x=g[y];var D=!i.immutableKeys[y];if(D)for(var b=0;b<s.length;b++){var _=s[b];i.canSet(_)&&(_._private[i.field][y]=x)}}i.updateStyle&&a.updateStyle(),i.onSet(a),i.settingTriggersEvent&&a[i.triggerFnName](i.settingEvent)}else if(i.allowBinding&&We(r)){var E=r;a.on(i.bindingEvent,E)}else if(i.allowGetting&&r===void 0){var A;return u&&(i.beforeGet(u),A=u._private[i.field]),A}return a}},removeData:function(e){var t={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=ge({},t,e),function(r){var n=e,i=this,a=i.length!==void 0,o=a?i:[i];if(fe(r)){for(var s=r.split(/\s+/),u=s.length,l=0;l<u;l++){var c=s[l];if(!lr(c)){var h=!n.immutableKeys[c];if(h)for(var f=0,d=o.length;f<d;f++)o[f]._private[n.field][c]=void 0}}n.triggerEvent&&i[n.triggerFnName](n.event)}else if(r===void 0){for(var p=0,v=o.length;p<v;p++)for(var m=o[p]._private[n.field],g=Object.keys(m),y=0;y<g.length;y++){var x=g[y],T=!n.immutableKeys[x];T&&(m[x]=void 0)}n.triggerEvent&&i[n.triggerFnName](n.event)}return i}}},Zg={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(r,n){var i=this,a=Array.prototype.slice.call(arguments,0);return new nn(function(o,s){var u=function(h){i.off.apply(i,c),o(h)},l=a.concat([u]),c=l.concat([]);i.on.apply(i,l)})}}},Re={};[rg,$g,Zg].forEach(function(e){ge(Re,e)});var Kg={animate:Re.animate(),animation:Re.animation(),animated:Re.animated(),clearQueue:Re.clearQueue(),delay:Re.delay(),delayAnimation:Re.delayAnimation(),stop:Re.stop()},hi={classes:function(e){var t=this;if(e===void 0){var r=[];return t[0]._private.classes.forEach(function(d){return r.push(d)}),r}else ze(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],i=new rn(e),a=0;a<t.length;a++){for(var o=t[a],s=o._private,u=s.classes,l=!1,c=0;c<e.length;c++){var h=e[c],f=u.has(h);if(!f){l=!0;break}}l||(l=u.size!==e.length),l&&(s.classes=i,n.push(o))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){ze(e)||(e=e.match(/\S+/g)||[]);for(var r=this,n=t===void 0,i=[],a=0,o=r.length;a<o;a++)for(var s=r[a],u=s._private.classes,l=!1,c=0;c<e.length;c++){var h=e[c],f=u.has(h),d=!1;t||n&&!f?(u.add(h),d=!0):(!t||n&&f)&&(u.delete(h),d=!0),!l&&d&&(i.push(s),l=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),r},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var r=this;if(t==null)t=250;else if(t===0)return r;return r.addClass(e),setTimeout(function(){r.removeClass(e)},t),r}};hi.className=hi.classNames=hi.classes;var Ne={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:tt,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Ne.variable="(?:[\\w-.]|(?:\\\\"+Ne.metaChar+"))+";Ne.className="(?:[\\w-]|(?:\\\\"+Ne.metaChar+"))+";Ne.value=Ne.string+"|"+Ne.number;Ne.id=Ne.variable;(function(){var e,t,r;for(e=Ne.comparatorOp.split("|"),r=0;r<e.length;r++)t=e[r],Ne.comparatorOp+="|@"+t;for(e=Ne.comparatorOp.split("|"),r=0;r<e.length;r++)t=e[r],!(t.indexOf("!")>=0)&&t!=="="&&(Ne.comparatorOp+="|\\!"+t)})();var Fe=function(){return{checks:[]}},se={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},zo=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return jd(e.selector,t.selector)}),Qg=function(){for(var e={},t,r=0;r<zo.length;r++)t=zo[r],e[t.selector]=t.matches;return e}(),Jg=function(e,t){return Qg[e](t)},ev="("+zo.map(function(e){return e.selector}).join("|")+")",Br=function(e){return e.replace(new RegExp("\\\\("+Ne.metaChar+")","g"),function(t,r){return r})},tr=function(e,t,r){e[e.length-1]=r},Vo=[{name:"group",query:!0,regex:"("+Ne.group+")",populate:function(e,t,r){var n=Qe(r,1),i=n[0];t.checks.push({type:se.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:ev,populate:function(e,t,r){var n=Qe(r,1),i=n[0];t.checks.push({type:se.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+Ne.id+")",populate:function(e,t,r){var n=Qe(r,1),i=n[0];t.checks.push({type:se.ID,value:Br(i)})}},{name:"className",query:!0,regex:"\\.("+Ne.className+")",populate:function(e,t,r){var n=Qe(r,1),i=n[0];t.checks.push({type:se.CLASS,value:Br(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Ne.variable+")\\s*\\]",populate:function(e,t,r){var n=Qe(r,1),i=n[0];t.checks.push({type:se.DATA_EXIST,field:Br(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Ne.variable+")\\s*("+Ne.comparatorOp+")\\s*("+Ne.value+")\\s*\\]",populate:function(e,t,r){var n=Qe(r,3),i=n[0],a=n[1],o=n[2],s=new RegExp("^"+Ne.string+"$").exec(o)!=null;s?o=o.substring(1,o.length-1):o=parseFloat(o),t.checks.push({type:se.DATA_COMPARE,field:Br(i),operator:a,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Ne.boolOp+")\\s*("+Ne.variable+")\\s*\\]",populate:function(e,t,r){var n=Qe(r,2),i=n[0],a=n[1];t.checks.push({type:se.DATA_BOOL,field:Br(a),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Ne.meta+")\\s*("+Ne.comparatorOp+")\\s*("+Ne.number+")\\s*\\]\\]",populate:function(e,t,r){var n=Qe(r,3),i=n[0],a=n[1],o=n[2];t.checks.push({type:se.META_COMPARE,field:Br(i),operator:a,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:Ne.separator,populate:function(e,t){var r=e.currentSubject,n=e.edgeCount,i=e.compoundCount,a=e[e.length-1];r!=null&&(a.subject=r,e.currentSubject=null),a.edgeCount=n,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var o=e[e.length++]=Fe();return o}},{name:"directedEdge",separator:!0,regex:Ne.directedEdge,populate:function(e,t){if(e.currentSubject==null){var r=Fe(),n=t,i=Fe();return r.checks.push({type:se.DIRECTED_EDGE,source:n,target:i}),tr(e,t,r),e.edgeCount++,i}else{var a=Fe(),o=t,s=Fe();return a.checks.push({type:se.NODE_SOURCE,source:o,target:s}),tr(e,t,a),e.edgeCount++,s}}},{name:"undirectedEdge",separator:!0,regex:Ne.undirectedEdge,populate:function(e,t){if(e.currentSubject==null){var r=Fe(),n=t,i=Fe();return r.checks.push({type:se.UNDIRECTED_EDGE,nodes:[n,i]}),tr(e,t,r),e.edgeCount++,i}else{var a=Fe(),o=t,s=Fe();return a.checks.push({type:se.NODE_NEIGHBOR,node:o,neighbor:s}),tr(e,t,a),s}}},{name:"child",separator:!0,regex:Ne.child,populate:function(e,t){if(e.currentSubject==null){var r=Fe(),n=Fe(),i=e[e.length-1];return r.checks.push({type:se.CHILD,parent:i,child:n}),tr(e,t,r),e.compoundCount++,n}else if(e.currentSubject===t){var a=Fe(),o=e[e.length-1],s=Fe(),u=Fe(),l=Fe(),c=Fe();return a.checks.push({type:se.COMPOUND_SPLIT,left:o,right:s,subject:u}),u.checks=t.checks,t.checks=[{type:se.TRUE}],c.checks.push({type:se.TRUE}),s.checks.push({type:se.PARENT,parent:c,child:l}),tr(e,o,a),e.currentSubject=u,e.compoundCount++,l}else{var h=Fe(),f=Fe(),d=[{type:se.PARENT,parent:h,child:f}];return h.checks=t.checks,t.checks=d,e.compoundCount++,f}}},{name:"descendant",separator:!0,regex:Ne.descendant,populate:function(e,t){if(e.currentSubject==null){var r=Fe(),n=Fe(),i=e[e.length-1];return r.checks.push({type:se.DESCENDANT,ancestor:i,descendant:n}),tr(e,t,r),e.compoundCount++,n}else if(e.currentSubject===t){var a=Fe(),o=e[e.length-1],s=Fe(),u=Fe(),l=Fe(),c=Fe();return a.checks.push({type:se.COMPOUND_SPLIT,left:o,right:s,subject:u}),u.checks=t.checks,t.checks=[{type:se.TRUE}],c.checks.push({type:se.TRUE}),s.checks.push({type:se.ANCESTOR,ancestor:c,descendant:l}),tr(e,o,a),e.currentSubject=u,e.compoundCount++,l}else{var h=Fe(),f=Fe(),d=[{type:se.ANCESTOR,ancestor:h,descendant:f}];return h.checks=t.checks,t.checks=d,e.compoundCount++,f}}},{name:"subject",modifier:!0,regex:Ne.subject,populate:function(e,t){if(e.currentSubject!=null&&e.currentSubject!==t)return Pe("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var r=e[e.length-1],n=r.checks[0],i=n==null?null:n.type;i===se.DIRECTED_EDGE?n.type=se.NODE_TARGET:i===se.UNDIRECTED_EDGE&&(n.type=se.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];Vo.forEach(function(e){return e.regexObj=new RegExp("^"+e.regex)});var tv=function(e){for(var t,r,n,i=0;i<Vo.length;i++){var a=Vo[i],o=a.name,s=e.match(a.regexObj);if(s!=null){r=s,t=a,n=o;var u=s[0];e=e.substring(u.length);break}}return{expr:t,match:r,name:n,remaining:e}},rv=function(e){var t=e.match(/^\s+/);if(t){var r=t[0];e=e.substring(r.length)}return e},nv=function(e){var t=this,r=t.inputText=e,n=t[0]=Fe();for(t.length=1,r=rv(r);;){var i=tv(r);if(i.expr==null)return Pe("The selector `"+e+"`is invalid"),!1;var a=i.match.slice(1),o=i.expr.populate(t,n,a);if(o===!1)return!1;if(o!=null&&(n=o),r=i.remaining,r.match(/^\s*$/))break}var s=t[t.length-1];t.currentSubject!=null&&(s.subject=t.currentSubject),s.edgeCount=t.edgeCount,s.compoundCount=t.compoundCount;for(var u=0;u<t.length;u++){var l=t[u];if(l.compoundCount>0&&l.edgeCount>0)return Pe("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return Pe("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;l.edgeCount===1&&Pe("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},iv=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(u){return u??""},t=function(u){return fe(u)?'"'+u+'"':e(u)},r=function(u){return" "+u+" "},n=function(u,l){var c=u.type,h=u.value;switch(c){case se.GROUP:{var f=e(h);return f.substring(0,f.length-1)}case se.DATA_COMPARE:{var d=u.field,p=u.operator;return"["+d+r(e(p))+t(h)+"]"}case se.DATA_BOOL:{var v=u.operator,m=u.field;return"["+e(v)+m+"]"}case se.DATA_EXIST:{var g=u.field;return"["+g+"]"}case se.META_COMPARE:{var y=u.operator,x=u.field;return"[["+x+r(e(y))+t(h)+"]]"}case se.STATE:return h;case se.ID:return"#"+h;case se.CLASS:return"."+h;case se.PARENT:case se.CHILD:return i(u.parent,l)+r(">")+i(u.child,l);case se.ANCESTOR:case se.DESCENDANT:return i(u.ancestor,l)+" "+i(u.descendant,l);case se.COMPOUND_SPLIT:{var T=i(u.left,l),w=i(u.subject,l),D=i(u.right,l);return T+(T.length>0?" ":"")+w+D}case se.TRUE:return""}},i=function(u,l){return u.checks.reduce(function(c,h,f){return c+(l===u&&f===0?"$":"")+n(h,l)},"")},a="",o=0;o<this.length;o++){var s=this[o];a+=i(s,s.subject),this.length>1&&o<this.length-1&&(a+=", ")}return this.toStringCache=a,a},av={parse:nv,toString:iv},Kc=function(e,t,r){var n,i=fe(e),a=ne(e),o=fe(r),s,u,l=!1,c=!1,h=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),l=!0),(i||o||l)&&(s=!i&&!a?"":""+e,u=""+r),l&&(e=s=s.toLowerCase(),r=u=u.toLowerCase()),t){case"*=":n=s.indexOf(u)>=0;break;case"$=":n=s.indexOf(u,s.length-u.length)>=0;break;case"^=":n=s.indexOf(u)===0;break;case"=":n=e===r;break;case">":h=!0,n=e>r;break;case">=":h=!0,n=e>=r;break;case"<":h=!0,n=e<r;break;case"<=":h=!0,n=e<=r;break;default:n=!1;break}return c&&(e!=null||!h)&&(n=!n),n},ov=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},sv=function(e){return e!==void 0},ys=function(e,t){return e.data(t)},lv=function(e,t){return e[t]()},He=[],Ue=function(e,t){return e.checks.every(function(r){return He[r.type](r,t)})};He[se.GROUP]=function(e,t){var r=e.value;return r==="*"||r===t.group()};He[se.STATE]=function(e,t){var r=e.value;return Jg(r,t)};He[se.ID]=function(e,t){var r=e.value;return t.id()===r};He[se.CLASS]=function(e,t){var r=e.value;return t.hasClass(r)};He[se.META_COMPARE]=function(e,t){var r=e.field,n=e.operator,i=e.value;return Kc(lv(t,r),n,i)};He[se.DATA_COMPARE]=function(e,t){var r=e.field,n=e.operator,i=e.value;return Kc(ys(t,r),n,i)};He[se.DATA_BOOL]=function(e,t){var r=e.field,n=e.operator;return ov(ys(t,r),n)};He[se.DATA_EXIST]=function(e,t){var r=e.field;return e.operator,sv(ys(t,r))};He[se.UNDIRECTED_EDGE]=function(e,t){var r=e.nodes[0],n=e.nodes[1],i=t.source(),a=t.target();return Ue(r,i)&&Ue(n,a)||Ue(n,i)&&Ue(r,a)};He[se.NODE_NEIGHBOR]=function(e,t){return Ue(e.node,t)&&t.neighborhood().some(function(r){return r.isNode()&&Ue(e.neighbor,r)})};He[se.DIRECTED_EDGE]=function(e,t){return Ue(e.source,t.source())&&Ue(e.target,t.target())};He[se.NODE_SOURCE]=function(e,t){return Ue(e.source,t)&&t.outgoers().some(function(r){return r.isNode()&&Ue(e.target,r)})};He[se.NODE_TARGET]=function(e,t){return Ue(e.target,t)&&t.incomers().some(function(r){return r.isNode()&&Ue(e.source,r)})};He[se.CHILD]=function(e,t){return Ue(e.child,t)&&Ue(e.parent,t.parent())};He[se.PARENT]=function(e,t){return Ue(e.parent,t)&&t.children().some(function(r){return Ue(e.child,r)})};He[se.DESCENDANT]=function(e,t){return Ue(e.descendant,t)&&t.ancestors().some(function(r){return Ue(e.ancestor,r)})};He[se.ANCESTOR]=function(e,t){return Ue(e.ancestor,t)&&t.descendants().some(function(r){return Ue(e.descendant,r)})};He[se.COMPOUND_SPLIT]=function(e,t){return Ue(e.subject,t)&&Ue(e.left,t)&&Ue(e.right,t)};He[se.TRUE]=function(){return!0};He[se.COLLECTION]=function(e,t){var r=e.value;return r.has(t)};He[se.FILTER]=function(e,t){var r=e.value;return r(t)};var uv=function(e){var t=this;if(t.length===1&&t[0].checks.length===1&&t[0].checks[0].type===se.ID)return e.getElementById(t[0].checks[0].value).collection();var r=function(n){for(var i=0;i<t.length;i++){var a=t[i];if(Ue(a,n))return!0}return!1};return t.text()==null&&(r=function(){return!0}),e.filter(r)},cv=function(e){for(var t=this,r=0;r<t.length;r++){var n=t[r];if(Ue(n,e))return!0}return!1},hv={matches:cv,filter:uv},hr=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||fe(e)&&e.match(/^\s*$/)||(Dt(e)?this.addQuery({checks:[{type:se.COLLECTION,value:e.collection()}]}):We(e)?this.addQuery({checks:[{type:se.FILTER,value:e}]}):fe(e)?this.parse(e)||(this.invalid=!0):Xe("A selector must be created from a string; found "))},dr=hr.prototype;[av,hv].forEach(function(e){return ge(dr,e)});dr.text=function(){return this.inputText};dr.size=function(){return this.length};dr.eq=function(e){return this[e]};dr.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()};dr.addQuery=function(e){this[this.length++]=e};dr.selector=dr.toString;var or={allAre:function(e){var t=new hr(e);return this.every(function(r){return t.matches(r)})},is:function(e){var t=new hr(e);return this.some(function(r){return t.matches(r)})},some:function(e,t){for(var r=0;r<this.length;r++){var n=t?e.apply(t,[this[r],r,this]):e(this[r],r,this);if(n)return!0}return!1},every:function(e,t){for(var r=0;r<this.length;r++){var n=t?e.apply(t,[this[r],r,this]):e(this[r],r,this);if(!n)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length,r=e.length;return t!==r?!1:t===1?this[0]===e[0]:this.every(function(n){return e.hasElementWithId(n.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(r){return t.hasElementWithId(r.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(r){return t.hasElementWithId(r.id())})}};or.allAreNeighbours=or.allAreNeighbors;or.has=or.contains;or.equal=or.equals=or.same;var St=function(e,t){return function(r,n,i,a){var o=r,s=this,u;if(o==null?u="":Dt(o)&&o.length===1&&(u=o.id()),s.length===1&&u){var l=s[0]._private,c=l.traversalCache=l.traversalCache||{},h=c[t]=c[t]||[],f=Nr(u),d=h[f];return d||(h[f]=e.call(s,r,n,i,a))}else return e.call(s,r,n,i,a)}},tn={parent:function(e){var t=[];if(this.length===1){var r=this[0]._private.parent;if(r)return r}for(var n=0;n<this.length;n++){var i=this[n],a=i._private.parent;a&&t.push(a)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],r=this.parent();r.nonempty();){for(var n=0;n<r.length;n++){var i=r[n];t.push(i)}r=r.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,r=0;r<this.length;r++){var n=this[r],i=n.parents();t=t||i,t=t.intersect(i)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(t){return t.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(t){return t.isChild()}).filter(e)},children:St(function(e){for(var t=[],r=0;r<this.length;r++)for(var n=this[r],i=n._private.children,a=0;a<i.length;a++)t.push(i[a]);return this.spawn(t,!0).filter(e)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var t=[];function r(n){for(var i=0;i<n.length;i++){var a=n[i];t.push(a),a.children().nonempty()&&r(a.children())}}return r(this.children()),this.spawn(t,!0).filter(e)}};function ms(e,t,r,n){for(var i=[],a=new rn,o=e.cy(),s=o.hasCompoundNodes(),u=0;u<e.length;u++){var l=e[u];r?i.push(l):s&&n(i,a,l)}for(;i.length>0;){var c=i.shift();t(c),a.add(c.id()),s&&n(i,a,c)}return e}function Qc(e,t,r){if(r.isParent())for(var n=r._private.children,i=0;i<n.length;i++){var a=n[i];t.has(a.id())||e.push(a)}}tn.forEachDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ms(this,e,t,Qc)};function Jc(e,t,r){if(r.isChild()){var n=r._private.parent;t.has(n.id())||e.push(n)}}tn.forEachUp=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ms(this,e,t,Jc)};function dv(e,t,r){Jc(e,t,r),Qc(e,t,r)}tn.forEachUpAndDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ms(this,e,t,dv)};tn.ancestors=tn.parents;var kn,eh;kn=eh={data:Re.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Re.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Re.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Re.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Re.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Re.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};kn.attr=kn.data;kn.removeAttr=kn.removeData;var fv=eh,Xi={};function bo(e){return function(t){var r=this;if(t===void 0&&(t=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var n=0,i=r[0],a=i._private.edges,o=0;o<a.length;o++){var s=a[o];!t&&s.isLoop()||(n+=e(i,s))}return n}else return}}ge(Xi,{degree:bo(function(e,t){return t.source().same(t.target())?2:1}),indegree:bo(function(e,t){return t.target().same(e)?1:0}),outdegree:bo(function(e,t){return t.source().same(e)?1:0})});function Fr(e,t){return function(r){for(var n,i=this.nodes(),a=0;a<i.length;a++){var o=i[a],s=o[e](r);s!==void 0&&(n===void 0||t(s,n))&&(n=s)}return n}}ge(Xi,{minDegree:Fr("degree",function(e,t){return e<t}),maxDegree:Fr("degree",function(e,t){return e>t}),minIndegree:Fr("indegree",function(e,t){return e<t}),maxIndegree:Fr("indegree",function(e,t){return e>t}),minOutdegree:Fr("outdegree",function(e,t){return e<t}),maxOutdegree:Fr("outdegree",function(e,t){return e>t})});ge(Xi,{totalDegree:function(e){for(var t=0,r=this.nodes(),n=0;n<r.length;n++)t+=r[n].degree(e);return t}});var Rt,th,rh=function(e,t,r){for(var n=0;n<e.length;n++){var i=e[n];if(!i.locked()){var a=i._private.position,o={x:t.x!=null?t.x-a.x:0,y:t.y!=null?t.y-a.y:0};i.isParent()&&!(o.x===0&&o.y===0)&&i.children().shift(o,r),i.dirtyBoundingBoxCache()}}},vu={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){rh(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Rt=th={position:Re.data(vu),silentPosition:Re.data(ge({},vu,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){rh(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(ke(e))t?this.silentPosition(e):this.position(e);else if(We(e)){var r=e,n=this.cy();n.startBatch();for(var i=0;i<this.length;i++){var a=this[i],o=void 0;(o=r(a,i))&&(t?a.silentPosition(o):a.position(o))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,r){var n;if(ke(e)?(n={x:ne(e.x)?e.x:0,y:ne(e.y)?e.y:0},r=t):fe(e)&&ne(t)&&(n={x:0,y:0},n[e]=t),n!=null){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o=this[a];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var s=o.position(),u={x:s.x+n.x,y:s.y+n.y};r?o.silentPosition(u):o.position(u)}}i.endBatch()}return this},silentShift:function(e,t){return ke(e)?this.shift(e,!0):fe(e)&&ne(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var r=this[0],n=this.cy(),i=n.zoom(),a=n.pan(),o=ke(e)?e:void 0,s=o!==void 0||t!==void 0&&fe(e);if(r&&r.isNode())if(s)for(var u=0;u<this.length;u++){var l=this[u];t!==void 0?l.position(e,(t-a[e])/i):o!==void 0&&l.position(Mc(o,i,a))}else{var c=r.position();return o=Fi(c,i,a),e===void 0?o:o[e]}else if(!s)return;return this},relativePosition:function(e,t){var r=this[0],n=this.cy(),i=ke(e)?e:void 0,a=i!==void 0||t!==void 0&&fe(e),o=n.hasCompoundNodes();if(r&&r.isNode())if(a)for(var s=0;s<this.length;s++){var u=this[s],l=o?u.parent():null,c=l&&l.length>0,h=c;c&&(l=l[0]);var f=h?l.position():{x:0,y:0};t!==void 0?u.position(e,t+f[e]):i!==void 0&&u.position({x:i.x+f.x,y:i.y+f.y})}else{var d=r.position(),p=o?r.parent():null,v=p&&p.length>0,m=v;v&&(p=p[0]);var g=m?p.position():{x:0,y:0};return i={x:d.x-g.x,y:d.y-g.y},e===void 0?i:i[e]}else if(!a)return;return this}};Rt.modelPosition=Rt.point=Rt.position;Rt.modelPositions=Rt.points=Rt.positions;Rt.renderedPoint=Rt.renderedPosition;Rt.relativePoint=Rt.relativePosition;var pv=th,Qr,yr;Qr=yr={};yr.renderedBoundingBox=function(e){var t=this.boundingBox(e),r=this.cy(),n=r.zoom(),i=r.pan(),a=t.x1*n+i.x,o=t.x2*n+i.x,s=t.y1*n+i.y,u=t.y2*n+i.y;return{x1:a,x2:o,y1:s,y2:u,w:o-a,h:u-s}};yr.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();return!t.styleEnabled()||!t.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var n=r._private;n.compoundBoundsClean=!1,n.bbCache=null,e||r.emitAndNotify("bounds")}}),this)};yr.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function r(o){if(!o.isParent())return;var s=o._private,u=o.children(),l=o.pstyle("compound-sizing-wrt-labels").value==="include",c={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},h=u.boundingBox({includeLabels:l,includeOverlays:!1,useCache:!1}),f=s.position;(h.w===0||h.h===0)&&(h={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},h.x1=f.x-h.w/2,h.x2=f.x+h.w/2,h.y1=f.y-h.h/2,h.y2=f.y+h.h/2);function d(E,A,C){var N=0,S=0,M=A+C;return E>0&&M>0&&(N=A/M*E,S=C/M*E),{biasDiff:N,biasComplementDiff:S}}function p(E,A,C,N){if(C.units==="%")switch(N){case"width":return E>0?C.pfValue*E:0;case"height":return A>0?C.pfValue*A:0;case"average":return E>0&&A>0?C.pfValue*(E+A)/2:0;case"min":return E>0&&A>0?E>A?C.pfValue*A:C.pfValue*E:0;case"max":return E>0&&A>0?E>A?C.pfValue*E:C.pfValue*A:0;default:return 0}else return C.units==="px"?C.pfValue:0}var v=c.width.left.value;c.width.left.units==="px"&&c.width.val>0&&(v=v*100/c.width.val);var m=c.width.right.value;c.width.right.units==="px"&&c.width.val>0&&(m=m*100/c.width.val);var g=c.height.top.value;c.height.top.units==="px"&&c.height.val>0&&(g=g*100/c.height.val);var y=c.height.bottom.value;c.height.bottom.units==="px"&&c.height.val>0&&(y=y*100/c.height.val);var x=d(c.width.val-h.w,v,m),T=x.biasDiff,w=x.biasComplementDiff,D=d(c.height.val-h.h,g,y),b=D.biasDiff,_=D.biasComplementDiff;s.autoPadding=p(h.w,h.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),s.autoWidth=Math.max(h.w,c.width.val),f.x=(-T+h.x1+h.x2+w)/2,s.autoHeight=Math.max(h.h,c.height.val),f.y=(-b+h.y1+h.y2+_)/2}for(var n=0;n<this.length;n++){var i=this[n],a=i._private;(!a.compoundBoundsClean||e)&&(r(i),t.batching()||(a.compoundBoundsClean=!0))}return this};var Mt=function(e){return e===1/0||e===-1/0?0:e},Ot=function(e,t,r,n,i){n-t===0||i-r===0||t==null||r==null||n==null||i==null||(e.x1=t<e.x1?t:e.x1,e.x2=n>e.x2?n:e.x2,e.y1=r<e.y1?r:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},rr=function(e,t){return t==null?e:Ot(e,t.x1,t.y1,t.x2,t.y2)},dn=function(e,t,r){return _t(e,t,r)},ri=function(e,t,r){if(!t.cy().headless()){var n=t._private,i=n.rstyle,a=i.arrowWidth/2,o=t.pstyle(r+"-arrow-shape").value,s,u;if(o!=="none"){r==="source"?(s=i.srcX,u=i.srcY):r==="target"?(s=i.tgtX,u=i.tgtY):(s=i.midX,u=i.midY);var l=n.arrowBounds=n.arrowBounds||{},c=l[r]=l[r]||{};c.x1=s-a,c.y1=u-a,c.x2=s+a,c.y2=u+a,c.w=c.x2-c.x1,c.h=c.y2-c.y1,ui(c,1),Ot(e,c.x1,c.y1,c.x2,c.y2)}}},xo=function(e,t,r){if(!t.cy().headless()){var n;r?n=r+"-":n="";var i=t._private,a=i.rstyle,o=t.pstyle(n+"label").strValue;if(o){var s=t.pstyle("text-halign"),u=t.pstyle("text-valign"),l=dn(a,"labelWidth",r),c=dn(a,"labelHeight",r),h=dn(a,"labelX",r),f=dn(a,"labelY",r),d=t.pstyle(n+"text-margin-x").pfValue,p=t.pstyle(n+"text-margin-y").pfValue,v=t.isEdge(),m=t.pstyle(n+"text-rotation"),g=t.pstyle("text-outline-width").pfValue,y=t.pstyle("text-border-width").pfValue,x=y/2,T=t.pstyle("text-background-padding").pfValue,w=2,D=c,b=l,_=b/2,E=D/2,A,C,N,S;if(v)A=h-_,C=h+_,N=f-E,S=f+E;else{switch(s.value){case"left":A=h-b,C=h;break;case"center":A=h-_,C=h+_;break;case"right":A=h,C=h+b;break}switch(u.value){case"top":N=f-D,S=f;break;case"center":N=f-E,S=f+E;break;case"bottom":N=f,S=f+D;break}}var M=d-Math.max(g,x)-T-w,R=d+Math.max(g,x)+T+w,P=p-Math.max(g,x)-T-w,L=p+Math.max(g,x)+T+w;A+=M,C+=R,N+=P,S+=L;var O=r||"main",I=i.labelBounds,B=I[O]=I[O]||{};B.x1=A,B.y1=N,B.x2=C,B.y2=S,B.w=C-A,B.h=S-N,B.leftPad=M,B.rightPad=R,B.topPad=P,B.botPad=L;var F=v&&m.strValue==="autorotate",z=m.pfValue!=null&&m.pfValue!==0;if(F||z){var G=F?dn(i.rstyle,"labelAngle",r):m.pfValue,H=Math.cos(G),j=Math.sin(G),Z=(A+C)/2,Q=(N+S)/2;if(!v){switch(s.value){case"left":Z=C;break;case"right":Z=A;break}switch(u.value){case"top":Q=S;break;case"bottom":Q=N;break}}var re=function(we,ye){return we=we-Z,ye=ye-Q,{x:we*H-ye*j+Z,y:we*j+ye*H+Q}},V=re(A,N),Y=re(A,S),U=re(C,N),K=re(C,S);A=Math.min(V.x,Y.x,U.x,K.x),C=Math.max(V.x,Y.x,U.x,K.x),N=Math.min(V.y,Y.y,U.y,K.y),S=Math.max(V.y,Y.y,U.y,K.y)}var ee=O+"Rot",ie=I[ee]=I[ee]||{};ie.x1=A,ie.y1=N,ie.x2=C,ie.y2=S,ie.w=C-A,ie.h=S-N,Ot(e,A,N,C,S),Ot(i.labelBounds.all,A,N,C,S)}return e}},yu=function(e,t){if(!t.cy().headless()){var r=t.pstyle("outline-opacity").value,n=t.pstyle("outline-width").value,i=t.pstyle("outline-offset").value,a=n+i;nh(e,t,r,a,"outside",a/2)}},nh=function(e,t,r,n,i,a){if(!(r===0||n<=0||i==="inside")){var o=t.cy(),s=t.pstyle("shape").value,u=o.renderer().nodeShapes[s],l=t.position(),c=l.x,h=l.y,f=t.width(),d=t.height();if(u.hasMiterBounds){i==="center"&&(n/=2);var p=u.miterBounds(c,h,f,d,n);rr(e,p)}else a!=null&&a>0&&ci(e,[a,a,a,a])}},gv=function(e,t){if(!t.cy().headless()){var r=t.pstyle("border-opacity").value,n=t.pstyle("border-width").pfValue,i=t.pstyle("border-position").value;nh(e,t,r,n,i)}},vv=function(e,t){var r=e._private.cy,n=r.styleEnabled(),i=r.headless(),a=xt(),o=e._private,s=e.isNode(),u=e.isEdge(),l,c,h,f,d,p,v=o.rstyle,m=s&&n?e.pstyle("bounds-expansion").pfValue:[0],g=function(ie){return ie.pstyle("display").value!=="none"},y=!n||g(e)&&(!u||g(e.source())&&g(e.target()));if(y){var x=0,T=0;n&&t.includeOverlays&&(x=e.pstyle("overlay-opacity").value,x!==0&&(T=e.pstyle("overlay-padding").value));var w=0,D=0;n&&t.includeUnderlays&&(w=e.pstyle("underlay-opacity").value,w!==0&&(D=e.pstyle("underlay-padding").value));var b=Math.max(T,D),_=0,E=0;if(n&&(_=e.pstyle("width").pfValue,E=_/2),s&&t.includeNodes){var A=e.position();d=A.x,p=A.y;var C=e.outerWidth(),N=C/2,S=e.outerHeight(),M=S/2;l=d-N,c=d+N,h=p-M,f=p+M,Ot(a,l,h,c,f),n&&yu(a,e),n&&t.includeOutlines&&!i&&yu(a,e),n&&gv(a,e)}else if(u&&t.includeEdges)if(n&&!i){var R=e.pstyle("curve-style").strValue;if(l=Math.min(v.srcX,v.midX,v.tgtX),c=Math.max(v.srcX,v.midX,v.tgtX),h=Math.min(v.srcY,v.midY,v.tgtY),f=Math.max(v.srcY,v.midY,v.tgtY),l-=E,c+=E,h-=E,f+=E,Ot(a,l,h,c,f),R==="haystack"){var P=v.haystackPts;if(P&&P.length===2){if(l=P[0].x,h=P[0].y,c=P[1].x,f=P[1].y,l>c){var L=l;l=c,c=L}if(h>f){var O=h;h=f,f=O}Ot(a,l-E,h-E,c+E,f+E)}}else if(R==="bezier"||R==="unbundled-bezier"||nr(R,"segments")||nr(R,"taxi")){var I;switch(R){case"bezier":case"unbundled-bezier":I=v.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":I=v.linePts;break}if(I!=null)for(var B=0;B<I.length;B++){var F=I[B];l=F.x-E,c=F.x+E,h=F.y-E,f=F.y+E,Ot(a,l,h,c,f)}}}else{var z=e.source(),G=z.position(),H=e.target(),j=H.position();if(l=G.x,c=j.x,h=G.y,f=j.y,l>c){var Z=l;l=c,c=Z}if(h>f){var Q=h;h=f,f=Q}l-=E,c+=E,h-=E,f+=E,Ot(a,l,h,c,f)}if(n&&t.includeEdges&&u&&(ri(a,e,"mid-source"),ri(a,e,"mid-target"),ri(a,e,"source"),ri(a,e,"target")),n){var re=e.pstyle("ghost").value==="yes";if(re){var V=e.pstyle("ghost-offset-x").pfValue,Y=e.pstyle("ghost-offset-y").pfValue;Ot(a,a.x1+V,a.y1+Y,a.x2+V,a.y2+Y)}}var U=o.bodyBounds=o.bodyBounds||{};rl(U,a),ci(U,m),ui(U,1),n&&(l=a.x1,c=a.x2,h=a.y1,f=a.y2,Ot(a,l-b,h-b,c+b,f+b));var K=o.overlayBounds=o.overlayBounds||{};rl(K,a),ci(K,m),ui(K,1);var ee=o.labelBounds=o.labelBounds||{};ee.all!=null?Kf(ee.all):ee.all=xt(),n&&t.includeLabels&&(t.includeMainLabels&&xo(a,e,null),u&&(t.includeSourceLabels&&xo(a,e,"source"),t.includeTargetLabels&&xo(a,e,"target")))}return a.x1=Mt(a.x1),a.y1=Mt(a.y1),a.x2=Mt(a.x2),a.y2=Mt(a.y2),a.w=Mt(a.x2-a.x1),a.h=Mt(a.y2-a.y1),a.w>0&&a.h>0&&y&&(ci(a,m),ui(a,1)),a},ih=function(e){var t=0,r=function(i){return(i?1:0)<<t++},n=0;return n+=r(e.incudeNodes),n+=r(e.includeEdges),n+=r(e.includeLabels),n+=r(e.includeMainLabels),n+=r(e.includeSourceLabels),n+=r(e.includeTargetLabels),n+=r(e.includeOverlays),n+=r(e.includeOutlines),n},ah=function(e){var t=function(a){return Math.round(a)};if(e.isEdge()){var r=e.source().position(),n=e.target().position();return $s([t(r.x),t(r.y),t(n.x),t(n.y)])}else{var i=e.position();return $s([t(i.x),t(i.y)])}},mu=function(e,t){var r=e._private,n,i=e.isEdge(),a=t==null?bu:ih(t),o=a===bu;if(r.bbCache==null?(n=vv(e,Mn),r.bbCache=n,r.bbCachePosKey=ah(e)):n=r.bbCache,!o){var s=e.isNode();n=xt(),(t.includeNodes&&s||t.includeEdges&&!s)&&(t.includeOverlays?rr(n,r.overlayBounds):rr(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?rr(n,r.labelBounds.all):(t.includeMainLabels&&rr(n,r.labelBounds.mainRot),t.includeSourceLabels&&rr(n,r.labelBounds.sourceRot),t.includeTargetLabels&&rr(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},Mn={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},bu=ih(Mn),xu=ht(Mn);yr.boundingBox=function(e){var t,r=e===void 0||e.useCache===void 0||e.useCache===!0,n=Jr(function(c){var h=c._private;return h.bbCache==null||h.styleDirty||h.bbCachePosKey!==ah(c)},function(c){return c.id()});if(r&&this.length===1&&!n(this[0]))e===void 0?e=Mn:e=xu(e),t=mu(this[0],e);else{t=xt(),e=e||Mn;var i=xu(e),a=this,o=a.cy(),s=o.styleEnabled();this.edges().forEach(n),this.nodes().forEach(n),s&&this.recalculateRenderedStyle(r),this.updateCompoundBounds(!r);for(var u=0;u<a.length;u++){var l=a[u];n(l)&&l.dirtyBoundingBoxCache(),rr(t,mu(l,i))}}return t.x1=Mt(t.x1),t.y1=Mt(t.y1),t.x2=Mt(t.x2),t.y2=Mt(t.y2),t.w=Mt(t.x2-t.x1),t.h=Mt(t.y2-t.y1),t};yr.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds["mid-source"]=null,t.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};yr.boundingBoxAt=function(e){var t=this.nodes(),r=this.cy(),n=r.hasCompoundNodes(),i=r.collection();if(n&&(i=t.filter(function(l){return l.isParent()}),t=t.not(i)),ke(e)){var a=e;e=function(){return a}}var o=function(l,c){return l._private.bbAtOldPos=e(l,c)},s=function(l){return l._private.bbAtOldPos};r.startBatch(),t.forEach(o).silentPositions(e),n&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var u=Zf(this.boundingBox({useCache:!1}));return t.silentPositions(s),n&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),r.endBatch(),u};Qr.boundingbox=Qr.bb=Qr.boundingBox;Qr.renderedBoundingbox=Qr.renderedBoundingBox;var yv=yr,bn,Gn;bn=Gn={};var oh=function(e){e.uppercaseName=Os(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=Os(e.outerName),bn[e.name]=function(){var t=this[0],r=t._private,n=r.cy,i=n._private.styleEnabled;if(t)if(i){if(t.isParent())return t.updateCompoundBounds(),r[e.autoName]||0;var a=t.pstyle(e.name);switch(a.strValue){case"label":return t.recalculateRenderedStyle(),r.rstyle[e.labelName]||0;default:return a.pfValue}}else return 1},bn["outer"+e.uppercaseName]=function(){var t=this[0],r=t._private,n=r.cy,i=n._private.styleEnabled;if(t)if(i){var a=t[e.name](),o=t.pstyle("border-position").value,s;o==="center"?s=t.pstyle("border-width").pfValue:o==="outside"?s=2*t.pstyle("border-width").pfValue:s=0;var u=2*t.padding();return a+s+u}else return 1},bn["rendered"+e.uppercaseName]=function(){var t=this[0];if(t){var r=t[e.name]();return r*this.cy().zoom()}},bn["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t){var r=t[e.outerName]();return r*this.cy().zoom()}}};oh({name:"width"});oh({name:"height"});Gn.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),t.autoPadding!==void 0?t.autoPadding:e.pstyle("padding").pfValue):e.pstyle("padding").pfValue};Gn.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()};Gn.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var mv=Gn,bv=function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)},xv=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var r=e.cy();return Fi(t(e),r.zoom(),r.pan())}},wv=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var r=e.cy(),n=r.pan(),i=r.zoom();return t(e).map(function(a){return Fi(a,i,n)})}},Ev=function(e){return e.renderer().getControlPoints(e)},Tv=function(e){return e.renderer().getSegmentPoints(e)},_v=function(e){return e.renderer().getSourceEndpoint(e)},Av=function(e){return e.renderer().getTargetEndpoint(e)},Cv=function(e){return e.renderer().getEdgeMidpoint(e)},wu={controlPoints:{get:Ev,mult:!0},segmentPoints:{get:Tv,mult:!0},sourceEndpoint:{get:_v},targetEndpoint:{get:Av},midpoint:{get:Cv}},Dv=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},Nv=Object.keys(wu).reduce(function(e,t){var r=wu[t],n=Dv(t);return e[t]=function(){return bv(this,r.get)},r.mult?e[n]=function(){return wv(this,r.get)}:e[n]=function(){return xv(this,r.get)},e},{}),kv=ge({},pv,yv,mv,Nv);/*!
|
|
9
|
-
Event object based on jQuery events, MIT license
|
|
10
|
-
|
|
11
|
-
https://jquery.org/license/
|
|
12
|
-
https://tldrlegal.com/license/mit-license
|
|
13
|
-
https://github.com/jquery/jquery/blob/master/src/event.js
|
|
14
|
-
*/var sh=function(e,t){this.recycle(e,t)};function fn(){return!1}function ni(){return!0}sh.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=fn,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?ni:fn):e!=null&&e.type?t=e:this.type=e,t!=null&&(this.originalEvent=t.originalEvent,this.type=t.type!=null?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var r=this.position,n=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:r.x*n+i.x,y:r.y*n+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=ni;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=ni;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ni,this.stopPropagation()},isDefaultPrevented:fn,isPropagationStopped:fn,isImmediatePropagationStopped:fn};var lh=/^([^.]+)(\.(?:[^.]+))?$/,Mv=".*",uh={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},Eu=Object.keys(uh),Sv={};function Wi(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Sv,t=arguments.length>1?arguments[1]:void 0,r=0;r<Eu.length;r++){var n=Eu[r];this[n]=e[n]||uh[n]}this.context=t||this.context,this.listeners=[],this.emitting=0}var fr=Wi.prototype,ch=function(e,t,r,n,i,a,o){We(n)&&(i=n,n=null),o&&(a==null?a=o:a=ge({},a,o));for(var s=ze(r)?r:r.split(/\s+/),u=0;u<s.length;u++){var l=s[u];if(!lr(l)){var c=l.match(lh);if(c){var h=c[1],f=c[2]?c[2]:null,d=t(e,l,h,f,n,i,a);if(d===!1)break}}}},Tu=function(e,t){return e.addEventFields(e.context,t),new sh(t.type,t)},Lv=function(e,t,r){if(Bd(r)){t(e,r);return}else if(ke(r)){t(e,Tu(e,r));return}for(var n=ze(r)?r:r.split(/\s+/),i=0;i<n.length;i++){var a=n[i];if(!lr(a)){var o=a.match(lh);if(o){var s=o[1],u=o[2]?o[2]:null,l=Tu(e,{type:s,namespace:u,target:e.context});t(e,l)}}}};fr.on=fr.addListener=function(e,t,r,n,i){return ch(this,function(a,o,s,u,l,c,h){We(c)&&a.listeners.push({event:o,callback:c,type:s,namespace:u,qualifier:l,conf:h})},e,t,r,n,i),this};fr.one=function(e,t,r,n){return this.on(e,t,r,n,{one:!0})};fr.removeListener=fr.off=function(e,t,r,n){var i=this;this.emitting!==0&&(this.listeners=xf(this.listeners));for(var a=this.listeners,o=function(u){var l=a[u];ch(i,function(c,h,f,d,p,v){if((l.type===f||e==="*")&&(!d&&l.namespace!==".*"||l.namespace===d)&&(!p||c.qualifierCompare(l.qualifier,p))&&(!v||l.callback===v))return a.splice(u,1),!1},e,t,r,n)},s=a.length-1;s>=0;s--)o(s);return this};fr.removeAllListeners=function(){return this.removeListener("*")};fr.emit=fr.trigger=function(e,t,r){var n=this.listeners,i=n.length;return this.emitting++,ze(t)||(t=[t]),Lv(this,function(a,o){r!=null&&(n=[{event:o.event,type:o.type,namespace:o.namespace,callback:r}],i=n.length);for(var s=function(){var l=n[u];if(l.type===o.type&&(!l.namespace||l.namespace===o.namespace||l.namespace===Mv)&&a.eventMatches(a.context,l,o)){var c=[o];t!=null&&Ef(c,t),a.beforeEmit(a.context,l,o),l.conf&&l.conf.one&&(a.listeners=a.listeners.filter(function(d){return d!==l}));var h=a.callbackContext(a.context,l,o),f=l.callback.apply(h,c);a.afterEmit(a.context,l,o),f===!1&&(o.stopPropagation(),o.preventDefault())}},u=0;u<i;u++)s();a.bubble(a.context)&&!o.isPropagationStopped()&&a.parent(a.context).emit(o,t)},e),this.emitting--,this};var Iv={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,r){var n=t.qualifier;return n!=null?e!==r.target&&Rn(r.target)&&n.matches(r.target):!0},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,r){return t.qualifier!=null?r.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},ii=function(e){return fe(e)?new hr(e):e},hh={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],r=t._private;r.emitter||(r.emitter=new Wi(Iv,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,r){for(var n=ii(t),i=0;i<this.length;i++){var a=this[i];a.emitter().on(e,n,r)}return this},removeListener:function(e,t,r){for(var n=ii(t),i=0;i<this.length;i++){var a=this[i];a.emitter().removeListener(e,n,r)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var t=this[e];t.emitter().removeAllListeners()}return this},one:function(e,t,r){for(var n=ii(t),i=0;i<this.length;i++){var a=this[i];a.emitter().one(e,n,r)}return this},once:function(e,t,r){for(var n=ii(t),i=0;i<this.length;i++){var a=this[i];a.emitter().on(e,n,r,{once:!0,onceCollection:this})}},emit:function(e,t){for(var r=0;r<this.length;r++){var n=this[r];n.emitter().emit(e,t)}return this},emitAndNotify:function(e,t){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,t),this}};Re.eventAliasesOn(hh);var dh={nodes:function(e){return this.filter(function(t){return t.isNode()}).filter(e)},edges:function(e){return this.filter(function(t){return t.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),r=0;r<this.length;r++){var n=this[r];n.isNode()?e.push(n):t.push(n)}return{nodes:e,edges:t}},filter:function(e,t){if(e===void 0)return this;if(fe(e)||Dt(e))return new hr(e).filter(this);if(We(e)){for(var r=this.spawn(),n=this,i=0;i<n.length;i++){var a=n[i],o=t?e.apply(t,[a,i,n]):e(a,i,n);o&&r.push(a)}return r}return this.spawn()},not:function(e){if(e){fe(e)&&(e=this.filter(e));for(var t=this.spawn(),r=0;r<this.length;r++){var n=this[r],i=e.has(n);i||t.push(n)}return t}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(fe(e)){var t=e;return this.filter(t)}for(var r=this.spawn(),n=this,i=e,a=this.length<e.length,o=a?n:i,s=a?i:n,u=0;u<o.length;u++){var l=o[u];s.has(l)&&r.push(l)}return r},xor:function(e){var t=this._private.cy;fe(e)&&(e=t.$(e));var r=this.spawn(),n=this,i=e,a=function(o,s){for(var u=0;u<o.length;u++){var l=o[u],c=l._private.data.id,h=s.hasElementWithId(c);h||r.push(l)}};return a(n,i),a(i,n),r},diff:function(e){var t=this._private.cy;fe(e)&&(e=t.$(e));var r=this.spawn(),n=this.spawn(),i=this.spawn(),a=this,o=e,s=function(u,l,c){for(var h=0;h<u.length;h++){var f=u[h],d=f._private.data.id,p=l.hasElementWithId(d);p?i.merge(f):c.push(f)}};return s(a,o,r),s(o,a,n),{left:r,right:n,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(fe(e)){var r=e;e=t.mutableElements().filter(r)}for(var n=this.spawnSelf(),i=0;i<e.length;i++){var a=e[i],o=!this.has(a);o&&n.push(a)}return n},merge:function(e){var t=this._private,r=t.cy;if(!e)return this;if(e&&fe(e)){var n=e;e=r.mutableElements().filter(n)}for(var i=t.map,a=0;a<e.length;a++){var o=e[a],s=o._private.data.id,u=!i.has(s);if(u){var l=this.length++;this[l]=o,i.set(s,{ele:o,index:l})}}return this},unmergeAt:function(e){var t=this[e],r=t.id(),n=this._private,i=n.map;this[e]=void 0,i.delete(r);var a=e===this.length-1;if(this.length>1&&!a){var o=this.length-1,s=this[o],u=s._private.data.id;this[o]=void 0,this[e]=s,i.set(u,{ele:s,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,r=e._private.data.id,n=t.map,i=n.get(r);if(!i)return this;var a=i.index;return this.unmergeAt(a),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&fe(e)){var r=e;e=t.mutableElements().filter(r)}for(var n=0;n<e.length;n++)this.unmergeOne(e[n]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){var r=this[t];e(r)&&this.unmergeAt(t)}return this},map:function(e,t){for(var r=[],n=this,i=0;i<n.length;i++){var a=n[i],o=t?e.apply(t,[a,i,n]):e(a,i,n);r.push(o)}return r},reduce:function(e,t){for(var r=t,n=this,i=0;i<n.length;i++)r=e(r,n[i],i,n);return r},max:function(e,t){for(var r=-1/0,n,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s>r&&(r=s,n=o)}return{value:r,ele:n}},min:function(e,t){for(var r=1/0,n,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s<r&&(r=s,n=o)}return{value:r,ele:n}}},Le=dh;Le.u=Le["|"]=Le["+"]=Le.union=Le.or=Le.add;Le["\\"]=Le["!"]=Le["-"]=Le.difference=Le.relativeComplement=Le.subtract=Le.not;Le.n=Le["&"]=Le["."]=Le.and=Le.intersection=Le.intersect;Le["^"]=Le["(+)"]=Le["(-)"]=Le.symmetricDifference=Le.symdiff=Le.xor;Le.fnFilter=Le.filterFn=Le.stdFilter=Le.filter;Le.complement=Le.abscomp=Le.absoluteComplement;var Ov={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},fh=function(e,t){var r=e.cy(),n=r.hasCompoundNodes();function i(l){var c=l.pstyle("z-compound-depth");return c.value==="auto"?n?l.zDepth():0:c.value==="bottom"?-1:c.value==="top"?ss:0}var a=i(e)-i(t);if(a!==0)return a;function o(l){var c=l.pstyle("z-index-compare");return c.value==="auto"&&l.isNode()?1:0}var s=o(e)-o(t);if(s!==0)return s;var u=e.pstyle("z-index").value-t.pstyle("z-index").value;return u!==0?u:e.poolIndex()-t.poolIndex()},Ni={forEach:function(e,t){if(We(e))for(var r=this.length,n=0;n<r;n++){var i=this[n],a=t?e.apply(t,[i,n,this]):e(i,n,this);if(a===!1)break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var r=[],n=this.length;t==null&&(t=n),e==null&&(e=0),e<0&&(e=n+e),t<0&&(t=n+t);for(var i=e;i>=0&&i<t&&i<n;i++)r.push(this[i]);return this.spawn(r)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!We(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(fh)},zDepth:function(){var e=this[0];if(e){var t=e._private,r=t.group;if(r==="nodes"){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:ss-1}else{var i=t.source,a=t.target,o=i.zDepth(),s=a.zDepth();return Math.max(o,s,0)}}}};Ni.each=Ni.forEach;var Rv=function(){var e="undefined",t=(typeof Symbol>"u"?"undefined":rt(Symbol))!=e&&rt(Symbol.iterator)!=e;t&&(Ni[Symbol.iterator]=function(){var r=this,n={value:void 0,done:!1},i=0,a=this.length;return hc({next:function(){return i<a?n.value=r[i++]:(n.value=void 0,n.done=!0),n}},Symbol.iterator,function(){return this})})};Rv();var Pv=ht({nodeDimensionsIncludeLabels:!1}),di={layoutDimensions:function(e){e=Pv(e);var t;if(!this.takesUpSpace())t={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var r=this.boundingBox();t={w:r.w,h:r.h}}else t={w:this.outerWidth(),h:this.outerHeight()};return(t.w===0||t.h===0)&&(t.w=t.h=1),t},layoutPositions:function(e,t,r){var n=this.nodes().filter(function(T){return!T.isParent()}),i=this.cy(),a=t.eles,o=function(T){return T.id()},s=Jr(r,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var u=function(T,w,D){var b={x:w.x1+w.w/2,y:w.y1+w.h/2},_={x:(D.x-b.x)*T,y:(D.y-b.y)*T};return{x:b.x+_.x,y:b.y+_.y}},l=t.spacingFactor&&t.spacingFactor!==1,c=function(){if(!l)return null;for(var T=xt(),w=0;w<n.length;w++){var D=n[w],b=s(D,w);Sc(T,b.x,b.y)}return T},h=c(),f=Jr(function(T,w){var D=s(T,w);if(l){var b=Math.abs(t.spacingFactor);D=u(b,h,D)}return t.transform!=null&&(D=t.transform(T,D)),D},o);if(t.animate){for(var d=0;d<n.length;d++){var p=n[d],v=f(p,d),m=t.animateFilter==null||t.animateFilter(p,d);if(m){var g=p.animation({position:v,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(g)}else p.position(v)}if(t.fit){var y=i.animation({fit:{boundingBox:a.boundingBoxAt(f),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(y)}else if(t.zoom!==void 0&&t.pan!==void 0){var x=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(x)}e.animations.forEach(function(T){return T.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),nn.all(e.animations.map(function(T){return T.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(f),t.fit&&i.fit(t.eles,t.padding),t.zoom!=null&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var t=this.cy();return t.makeLayout(ge({},e,{eles:this}))}};di.createLayout=di.makeLayout=di.layout;function ph(e,t,r){var n=r._private,i=n.styleCache=n.styleCache||[],a;return(a=i[e])!=null||(a=i[e]=t(r)),a}function qi(e,t){return e=Nr(e),function(r){return ph(e,t,r)}}function Hi(e,t){e=Nr(e);var r=function(n){return t.call(n)};return function(){var n=this[0];if(n)return ph(e,r,n)}}var ut={recalculateRenderedStyle:function(e){var t=this.cy(),r=t.renderer(),n=t.styleEnabled();return r&&n&&r.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),t=function(n){return n._private.styleCache=null};if(e.hasCompoundNodes()){var r;r=this.spawnSelf().merge(this.descendants()).merge(this.parents()),r.merge(r.connectedEdges()),r.forEach(t)}else this.forEach(function(n){t(n),n.connectedEdges().forEach(t)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching()){var r=t._private.batchStyleEles;return r.merge(this),this}var n=t.hasCompoundNodes(),i=this;e=!!(e||e===void 0),n&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var a=i;return e?a.emitAndNotify("style"):a.emit("style"),i.forEach(function(o){return o._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var r=this[t];r._private.styleDirty&&(r._private.styleDirty=!1,e.style().apply(r))}},parsedStyle:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this[0],n=r.cy();if(n.styleEnabled()&&r){r._private.styleDirty&&(r._private.styleDirty=!1,n.style().apply(r));var i=r._private.style[e];return i??(t?n.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var r=t.pstyle(e);return r.pfValue!==void 0?r.pfValue:r.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var r=this[0];if(r)return t.style().getRenderedStyle(r,e)},style:function(e,t){var r=this.cy();if(!r.styleEnabled())return this;var n=!1,i=r.style();if(ke(e)){var a=e;i.applyBypass(this,a,n),this.emitAndNotify("style")}else if(fe(e))if(t===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}else i.applyBypass(this,e,t,n),this.emitAndNotify("style");else if(e===void 0){var s=this[0];return s?i.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var r=!1,n=t.style(),i=this;if(e===void 0)for(var a=0;a<i.length;a++){var o=i[a];n.removeAllBypasses(o,r)}else{e=e.split(/\s+/);for(var s=0;s<i.length;s++){var u=i[s];n.removeBypasses(u,e,r)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),r=this[0];if(r){var n=r._private,i=r.pstyle("opacity").value;if(!t)return i;var a=n.data.parent?r.parents():null;if(a)for(var o=0;o<a.length;o++){var s=a[o],u=s.pstyle("opacity").value;i=u*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0],r=t.cy().hasCompoundNodes();if(t)return r?t.effectiveOpacity()===0:t.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0];return!!t._private.backgrounding}};function wo(e,t){var r=e._private,n=r.data.parent?e.parents():null;if(n)for(var i=0;i<n.length;i++){var a=n[i];if(!t(a))return!1}return!0}function bs(e){var t=e.ok,r=e.edgeOkViaNode||e.ok,n=e.parentOk||e.ok;return function(){var i=this.cy();if(!i.styleEnabled())return!0;var a=this[0],o=i.hasCompoundNodes();if(a){var s=a._private;if(!t(a))return!1;if(a.isNode())return!o||wo(a,n);var u=s.source,l=s.target;return r(u)&&(!o||wo(u,r))&&(u===l||r(l)&&(!o||wo(l,r)))}}}var an=qi("eleTakesUpSpace",function(e){return e.pstyle("display").value==="element"&&e.width()!==0&&(e.isNode()?e.height()!==0:!0)});ut.takesUpSpace=Hi("takesUpSpace",bs({ok:an}));var Bv=qi("eleInteractive",function(e){return e.pstyle("events").value==="yes"&&e.pstyle("visibility").value==="visible"&&an(e)}),Fv=qi("parentInteractive",function(e){return e.pstyle("visibility").value==="visible"&&an(e)});ut.interactive=Hi("interactive",bs({ok:Bv,parentOk:Fv,edgeOkViaNode:an}));ut.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var zv=qi("eleVisible",function(e){return e.pstyle("visibility").value==="visible"&&e.pstyle("opacity").pfValue!==0&&an(e)}),Vv=an;ut.visible=Hi("visible",bs({ok:zv,edgeOkViaNode:Vv}));ut.hidden=function(){var e=this[0];if(e)return!e.visible()};ut.isBundledBezier=Hi("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});ut.bypass=ut.css=ut.style;ut.renderedCss=ut.renderedStyle;ut.removeBypass=ut.removeCss=ut.removeStyle;ut.pstyle=ut.parsedStyle;var sr={};function _u(e){return function(){var t=arguments,r=[];if(t.length===2){var n=t[0],i=t[1];this.on(e.event,n,i)}else if(t.length===1&&We(t[0])){var a=t[0];this.on(e.event,a)}else if(t.length===0||t.length===1&&ze(t[0])){for(var o=t.length===1?t[0]:null,s=0;s<this.length;s++){var u=this[s],l=!e.ableField||u._private[e.ableField],c=u._private[e.field]!=e.value;if(e.overrideAble){var h=e.overrideAble(u);if(h!==void 0&&(l=h,!h))return this}l&&(u._private[e.field]=e.value,c&&r.push(u))}var f=this.spawn(r);f.updateStyle(),f.emit(e.event),o&&f.emit(o)}return this}}function on(e){sr[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var r=e.overrideField(t);if(r!==void 0)return r}return t._private[e.field]}},sr[e.on]=_u({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),sr[e.off]=_u({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}on({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});on({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});on({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});on({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});sr.deselect=sr.unselect;sr.grabbed=function(){var e=this[0];if(e)return e._private.grabbed};on({field:"active",on:"activate",off:"unactivate"});on({field:"pannable",on:"panify",off:"unpanify"});sr.inactive=function(){var e=this[0];if(e)return!e._private.active};var pt={},Au=function(e){return function(t){for(var r=this,n=[],i=0;i<r.length;i++){var a=r[i];if(a.isNode()){for(var o=!1,s=a.connectedEdges(),u=0;u<s.length;u++){var l=s[u],c=l.source(),h=l.target();if(e.noIncomingEdges&&h===a&&c!==a||e.noOutgoingEdges&&c===a&&h!==a){o=!0;break}}o||n.push(a)}}return this.spawn(n,!0).filter(t)}},Cu=function(e){return function(t){for(var r=this,n=[],i=0;i<r.length;i++){var a=r[i];if(a.isNode())for(var o=a.connectedEdges(),s=0;s<o.length;s++){var u=o[s],l=u.source(),c=u.target();e.outgoing&&l===a?(n.push(u),n.push(c)):e.incoming&&c===a&&(n.push(u),n.push(l))}}return this.spawn(n,!0).filter(t)}},Du=function(e){return function(t){for(var r=this,n=[],i={};;){var a=e.outgoing?r.outgoers():r.incomers();if(a.length===0)break;for(var o=!1,s=0;s<a.length;s++){var u=a[s],l=u.id();i[l]||(i[l]=!0,n.push(u),o=!0)}if(!o)break;r=a}return this.spawn(n,!0).filter(t)}};pt.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null};ge(pt,{roots:Au({noIncomingEdges:!0}),leaves:Au({noOutgoingEdges:!0}),outgoers:St(Cu({outgoing:!0}),"outgoers"),successors:Du({outgoing:!0}),incomers:St(Cu({incoming:!0}),"incomers"),predecessors:Du({})});ge(pt,{neighborhood:St(function(e){for(var t=[],r=this.nodes(),n=0;n<r.length;n++)for(var i=r[n],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],u=s.source(),l=s.target(),c=i===u?l:u;c.length>0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});pt.neighbourhood=pt.neighborhood;pt.closedNeighbourhood=pt.closedNeighborhood;pt.openNeighbourhood=pt.openNeighborhood;ge(pt,{source:St(function(e){var t=this[0],r;return t&&(r=t._private.source||t.cy().collection()),r&&e?r.filter(e):r},"source"),target:St(function(e){var t=this[0],r;return t&&(r=t._private.target||t.cy().collection()),r&&e?r.filter(e):r},"target"),sources:Nu({attr:"source"}),targets:Nu({attr:"target"})});function Nu(e){return function(t){for(var r=[],n=0;n<this.length;n++){var i=this[n],a=i._private[e.attr];a&&r.push(a)}return this.spawn(r,!0).filter(t)}}ge(pt,{edgesWith:St(ku(),"edgesWith"),edgesTo:St(ku({thisIsSrc:!0}),"edgesTo")});function ku(e){return function(t){var r=[],n=this._private.cy,i=e||{};fe(t)&&(t=n.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._private.edges,s=0;s<o.length;s++){var u=o[s],l=u._private.data,c=this.hasElementWithId(l.source)&&t.hasElementWithId(l.target),h=t.hasElementWithId(l.source)&&this.hasElementWithId(l.target),f=c||h;f&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!c||i.thisIsTgt&&!h)||r.push(u))}return this.spawn(r,!0)}}ge(pt,{connectedEdges:St(function(e){for(var t=[],r=this,n=0;n<r.length;n++){var i=r[n];if(i.isNode())for(var a=i._private.edges,o=0;o<a.length;o++){var s=a[o];t.push(s)}}return this.spawn(t,!0).filter(e)},"connectedEdges"),connectedNodes:St(function(e){for(var t=[],r=this,n=0;n<r.length;n++){var i=r[n];i.isEdge()&&(t.push(i.source()[0]),t.push(i.target()[0]))}return this.spawn(t,!0).filter(e)},"connectedNodes"),parallelEdges:St(Mu(),"parallelEdges"),codirectedEdges:St(Mu({codirected:!0}),"codirectedEdges")});function Mu(e){var t={codirected:!1};return e=ge({},t,e),function(r){for(var n=[],i=this.edges(),a=e,o=0;o<i.length;o++)for(var s=i[o],u=s._private,l=u.source,c=l._private.data.id,h=u.data.target,f=l._private.edges,d=0;d<f.length;d++){var p=f[d],v=p._private.data,m=v.target,g=v.source,y=m===h&&g===c,x=c===m&&h===g;(a.codirected&&y||!a.codirected&&(y||x))&&n.push(p)}return this.spawn(n,!0).filter(r)}}ge(pt,{components:function(e){var t=this,r=t.cy(),n=r.collection(),i=e==null?t.nodes():e.nodes(),a=[];e!=null&&i.empty()&&(i=e.sources());var o=function(u,l){n.merge(u),i.unmerge(u),l.merge(u)};if(i.empty())return t.spawn();var s=function(){var u=r.collection();a.push(u);var l=i[0];o(l,u),t.bfs({directed:!1,roots:l,visit:function(c){return o(c,u)}}),u.forEach(function(c){c.connectedEdges().forEach(function(h){t.has(h)&&u.has(h.source())&&u.has(h.target())&&u.merge(h)})})};do s();while(i.length>0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});pt.componentsOf=pt.components;var ct=function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){Xe("A collection must have a reference to the core");return}var i=new jt,a=!1;if(!t)t=[];else if(t.length>0&&ke(t[0])&&!Rn(t[0])){a=!0;for(var o=[],s=new rn,u=0,l=t.length;u<l;u++){var c=t[u];c.data==null&&(c.data={});var h=c.data;if(h.id==null)h.id=Nc();else if(e.hasElementWithId(h.id)||s.has(h.id))continue;var f=new Bi(e,c,!1);o.push(f),s.add(h.id)}t=o}this.length=0;for(var d=0,p=t.length;d<p;d++){var v=t[d][0];if(v!=null){var m=v._private.data.id;(!r||!i.has(m))&&(r&&i.set(m,{index:this.length,ele:v}),this[this.length]=v,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(g){this.lazyMap=g},rebuildMap:function(){for(var g=this.lazyMap=new jt,y=this.eles,x=0;x<y.length;x++){var T=y[x];g.set(T.id(),{index:x,ele:T})}}},r&&(this._private.map=i),a&&!n&&this.restore()},Ye=Bi.prototype=ct.prototype=Object.create(Array.prototype);Ye.instanceString=function(){return"collection"};Ye.spawn=function(e,t){return new ct(this.cy(),e,t)};Ye.spawnSelf=function(){return this.spawn(this)};Ye.cy=function(){return this._private.cy};Ye.renderer=function(){return this._private.cy.renderer()};Ye.element=function(){return this[0]};Ye.collection=function(){return pc(this)?this:new ct(this._private.cy,[this])};Ye.unique=function(){return new ct(this._private.cy,this,!0)};Ye.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)};Ye.getElementById=function(e){e=""+e;var t=this._private.cy,r=this._private.map.get(e);return r?r.ele:new ct(t)};Ye.$id=Ye.getElementById;Ye.poolIndex=function(){var e=this._private.cy,t=e._private.elements,r=this[0]._private.data.id;return t._private.map.get(r).index};Ye.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index};Ye.indexOfId=function(e){return e=""+e,this._private.map.get(e).index};Ye.json=function(e){var t=this.element(),r=this.cy();if(t==null&&e)return this;if(t!=null){var n=t._private;if(ke(e)){if(r.startBatch(),e.data){t.data(e.data);var i=n.data;if(t.isEdge()){var a=!1,o={},s=e.data.source,u=e.data.target;s!=null&&s!=i.source&&(o.source=""+s,a=!0),u!=null&&u!=i.target&&(o.target=""+u,a=!0),a&&(t=t.move(o))}else{var l="parent"in e.data,c=e.data.parent;l&&(c!=null||i.parent!=null)&&c!=i.parent&&(c===void 0&&(c=null),c!=null&&(c=""+c),t=t.move({parent:c}))}}e.position&&t.position(e.position);var h=function(p,v,m){var g=e[p];g!=null&&g!==n[p]&&(g?t[v]():t[m]())};return h("removed","remove","restore"),h("selected","select","unselect"),h("selectable","selectify","unselectify"),h("locked","lock","unlock"),h("grabbable","grabify","ungrabify"),h("pannable","panify","unpanify"),e.classes!=null&&t.classes(e.classes),r.endBatch(),this}else if(e===void 0){var f={data:Yt(n.data),position:Yt(n.position),group:n.group,removed:n.removed,selected:n.selected,selectable:n.selectable,locked:n.locked,grabbable:n.grabbable,pannable:n.pannable,classes:null};f.classes="";var d=0;return n.classes.forEach(function(p){return f.classes+=d++===0?p:" "+p}),f}}};Ye.jsons=function(){for(var e=[],t=0;t<this.length;t++){var r=this[t],n=r.json();e.push(n)}return e};Ye.clone=function(){for(var e=this.cy(),t=[],r=0;r<this.length;r++){var n=this[r],i=n.json(),a=new Bi(e,i,!1);t.push(a)}return new ct(e,t)};Ye.copy=Ye.clone;Ye.restore=function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,n=r.cy(),i=n._private,a=[],o=[],s,u=0,l=r.length;u<l;u++){var c=r[u];t&&!c.removed()||(c.isNode()?a.push(c):o.push(c))}s=a.concat(o);var h,f=function(){s.splice(h,1),h--};for(h=0;h<s.length;h++){var d=s[h],p=d._private,v=p.data;if(d.clearTraversalCache(),!(!t&&!p.removed)){if(v.id===void 0)v.id=Nc();else if(ne(v.id))v.id=""+v.id;else if(lr(v.id)||!fe(v.id)){Xe("Can not create element with invalid string ID `"+v.id+"`"),f();continue}else if(n.hasElementWithId(v.id)){Xe("Can not create second element with ID `"+v.id+"`"),f();continue}}var m=v.id;if(d.isNode()){var g=p.position;g.x==null&&(g.x=0),g.y==null&&(g.y=0)}if(d.isEdge()){for(var y=d,x=["source","target"],T=x.length,w=!1,D=0;D<T;D++){var b=x[D],_=v[b];ne(_)&&(_=v[b]=""+v[b]),_==null||_===""?(Xe("Can not create edge `"+m+"` with unspecified "+b),w=!0):n.hasElementWithId(_)||(Xe("Can not create edge `"+m+"` with nonexistant "+b+" `"+_+"`"),w=!0)}if(w){f();continue}var E=n.getElementById(v.source),A=n.getElementById(v.target);E.same(A)?E._private.edges.push(y):(E._private.edges.push(y),A._private.edges.push(y)),y._private.source=E,y._private.target=A}p.map=new jt,p.map.set(m,{ele:d,index:0}),p.removed=!1,t&&n.addToPool(d)}for(var C=0;C<a.length;C++){var N=a[C],S=N._private.data;ne(S.parent)&&(S.parent=""+S.parent);var M=S.parent,R=M!=null;if(R||N._private.parent){var P=N._private.parent?n.collection().merge(N._private.parent):n.getElementById(M);if(P.empty())S.parent=void 0;else if(P[0].removed())Pe("Node added with missing parent, reference to parent removed"),S.parent=void 0,N._private.parent=null;else{for(var L=!1,O=P;!O.empty();){if(N.same(O)){L=!0,S.parent=void 0;break}O=O.parent()}L||(P[0]._private.children.push(N),N._private.parent=P[0],i.hasCompoundNodes=!0)}}}if(s.length>0){for(var I=s.length===r.length?r:new ct(n,s),B=0;B<I.length;B++){var F=I[B];F.isNode()||(F.parallelEdges().clearTraversalCache(),F.source().clearTraversalCache(),F.target().clearTraversalCache())}var z;i.hasCompoundNodes?z=n.collection().merge(I).merge(I.connectedNodes()).merge(I.parent()):z=I,z.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?I.emitAndNotify("add"):t&&I.emit("add")}return r};Ye.removed=function(){var e=this[0];return e&&e._private.removed};Ye.inside=function(){var e=this[0];return e&&!e._private.removed};Ye.remove=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,n=[],i={},a=r._private.cy;function o(M){for(var R=M._private.edges,P=0;P<R.length;P++)u(R[P])}function s(M){for(var R=M._private.children,P=0;P<R.length;P++)u(R[P])}function u(M){var R=i[M.id()];t&&M.removed()||R||(i[M.id()]=!0,M.isNode()?(n.push(M),o(M),s(M)):n.unshift(M))}for(var l=0,c=r.length;l<c;l++){var h=r[l];u(h)}function f(M,R){var P=M._private.edges;ur(P,R),M.clearTraversalCache()}function d(M){M.clearTraversalCache()}var p=[];p.ids={};function v(M,R){R=R[0],M=M[0];var P=M._private.children,L=M.id();ur(P,R),R._private.parent=null,p.ids[L]||(p.ids[L]=!0,p.push(M))}r.dirtyCompoundBoundsCache(),t&&a.removeFromPool(n);for(var m=0;m<n.length;m++){var g=n[m];if(g.isEdge()){var y=g.source()[0],x=g.target()[0];f(y,g),f(x,g);for(var T=g.parallelEdges(),w=0;w<T.length;w++){var D=T[w];d(D),D.isBundledBezier()&&D.dirtyBoundingBoxCache()}}else{var b=g.parent();b.length!==0&&v(b,g)}t&&(g._private.removed=!0)}var _=a._private.elements;a._private.hasCompoundNodes=!1;for(var E=0;E<_.length;E++){var A=_[E];if(A.isParent()){a._private.hasCompoundNodes=!0;break}}var C=new ct(this.cy(),n);C.size()>0&&(e?C.emitAndNotify("remove"):t&&C.emit("remove"));for(var N=0;N<p.length;N++){var S=p[N];(!t||!S.removed())&&S.updateStyle()}return C};Ye.move=function(e){var t=this._private.cy,r=this,n=!1,i=!1,a=function(d){return d==null?d:""+d};if(e.source!==void 0||e.target!==void 0){var o=a(e.source),s=a(e.target),u=o!=null&&t.hasElementWithId(o),l=s!=null&&t.hasElementWithId(s);(u||l)&&(t.batch(function(){r.remove(n,i),r.emitAndNotify("moveout");for(var d=0;d<r.length;d++){var p=r[d],v=p._private.data;p.isEdge()&&(u&&(v.source=o),l&&(v.target=s))}r.restore(n,i)}),r.emitAndNotify("move"))}else if(e.parent!==void 0){var c=a(e.parent),h=c===null||t.hasElementWithId(c);if(h){var f=c===null?void 0:c;t.batch(function(){var d=r.remove(n,i);d.emitAndNotify("moveout");for(var p=0;p<r.length;p++){var v=r[p],m=v._private.data;v.isNode()&&(m.parent=f)}d.restore(n,i)}),r.emitAndNotify("move")}}return this};[Vc,Kg,hi,or,tn,fv,Xi,kv,hh,dh,Ov,Ni,di,ut,sr,pt].forEach(function(e){ge(Ye,e)});var Gv={add:function(e){var t,r=this;if(Dt(e)){var n=e;if(n._private.cy===r)t=n.restore();else{for(var i=[],a=0;a<n.length;a++){var o=n[a];i.push(o.json())}t=new ct(r,i)}}else if(ze(e)){var s=e;t=new ct(r,s)}else if(ke(e)&&(ze(e.nodes)||ze(e.edges))){for(var u=e,l=[],c=["nodes","edges"],h=0,f=c.length;h<f;h++){var d=c[h],p=u[d];if(ze(p))for(var v=0,m=p.length;v<m;v++){var g=ge({group:d},p[v]);l.push(g)}}t=new ct(r,l)}else{var y=e;t=new Bi(r,y).collection()}return t},remove:function(e){if(!Dt(e)&&fe(e)){var t=e;e=this.$(t)}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function Yv(e,t,r,n){var i=4,a=.001,o=1e-7,s=10,u=11,l=1/(u-1),c=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var h=0;h<4;++h)if(typeof arguments[h]!="number"||isNaN(arguments[h])||!isFinite(arguments[h]))return!1;e=Math.min(e,1),r=Math.min(r,1),e=Math.max(e,0),r=Math.max(r,0);var f=c?new Float32Array(u):new Array(u);function d(A,C){return 1-3*C+3*A}function p(A,C){return 3*C-6*A}function v(A){return 3*A}function m(A,C,N){return((d(C,N)*A+p(C,N))*A+v(C))*A}function g(A,C,N){return 3*d(C,N)*A*A+2*p(C,N)*A+v(C)}function y(A,C){for(var N=0;N<i;++N){var S=g(C,e,r);if(S===0)return C;var M=m(C,e,r)-A;C-=M/S}return C}function x(){for(var A=0;A<u;++A)f[A]=m(A*l,e,r)}function T(A,C,N){var S,M,R=0;do M=C+(N-C)/2,S=m(M,e,r)-A,S>0?N=M:C=M;while(Math.abs(S)>o&&++R<s);return M}function w(A){for(var C=0,N=1,S=u-1;N!==S&&f[N]<=A;++N)C+=l;--N;var M=(A-f[N])/(f[N+1]-f[N]),R=C+M*l,P=g(R,e,r);return P>=a?y(A,R):P===0?R:T(A,C,C+l)}var D=!1;function b(){D=!0,(e!==t||r!==n)&&x()}var _=function(A){return D||b(),e===t&&r===n?A:A===0?0:A===1?1:m(w(A),t,n)};_.getControlPoints=function(){return[{x:e,y:t},{x:r,y:n}]};var E="generateBezier("+[e,t,r,n]+")";return _.toString=function(){return E},_}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var Uv=function(){function e(n){return-n.tension*n.x-n.friction*n.v}function t(n,i,a){var o={x:n.x+a.dx*i,v:n.v+a.dv*i,tension:n.tension,friction:n.friction};return{dx:o.v,dv:e(o)}}function r(n,i){var a={dx:n.v,dv:e(n)},o=t(n,i*.5,a),s=t(n,i*.5,o),u=t(n,i,s),l=1/6*(a.dx+2*(o.dx+s.dx)+u.dx),c=1/6*(a.dv+2*(o.dv+s.dv)+u.dv);return n.x=n.x+l*i,n.v=n.v+c*i,n}return function n(i,a,o){var s={x:-1,v:0,tension:null,friction:null},u=[0],l=0,c=1/1e4,h=16/1e3,f,d,p;for(i=parseFloat(i)||500,a=parseFloat(a)||20,o=o||null,s.tension=i,s.friction=a,f=o!==null,f?(l=n(i,a),d=l/o*h):d=h;p=r(p||s,d),u.push(1+p.x),l+=16,Math.abs(p.x)>c&&Math.abs(p.v)>c;);return f?function(v){return u[v*(u.length-1)|0]}:l}}(),Ge=function(e,t,r,n){var i=Yv(e,t,r,n);return function(a,o,s){return a+(o-a)*i(s)}},fi={linear:function(e,t,r){return e+(t-e)*r},ease:Ge(.25,.1,.25,1),"ease-in":Ge(.42,0,1,1),"ease-out":Ge(0,0,.58,1),"ease-in-out":Ge(.42,0,.58,1),"ease-in-sine":Ge(.47,0,.745,.715),"ease-out-sine":Ge(.39,.575,.565,1),"ease-in-out-sine":Ge(.445,.05,.55,.95),"ease-in-quad":Ge(.55,.085,.68,.53),"ease-out-quad":Ge(.25,.46,.45,.94),"ease-in-out-quad":Ge(.455,.03,.515,.955),"ease-in-cubic":Ge(.55,.055,.675,.19),"ease-out-cubic":Ge(.215,.61,.355,1),"ease-in-out-cubic":Ge(.645,.045,.355,1),"ease-in-quart":Ge(.895,.03,.685,.22),"ease-out-quart":Ge(.165,.84,.44,1),"ease-in-out-quart":Ge(.77,0,.175,1),"ease-in-quint":Ge(.755,.05,.855,.06),"ease-out-quint":Ge(.23,1,.32,1),"ease-in-out-quint":Ge(.86,0,.07,1),"ease-in-expo":Ge(.95,.05,.795,.035),"ease-out-expo":Ge(.19,1,.22,1),"ease-in-out-expo":Ge(1,0,0,1),"ease-in-circ":Ge(.6,.04,.98,.335),"ease-out-circ":Ge(.075,.82,.165,1),"ease-in-out-circ":Ge(.785,.135,.15,.86),spring:function(e,t,r){if(r===0)return fi.linear;var n=Uv(e,t,r);return function(i,a,o){return i+(a-i)*n(o)}},"cubic-bezier":Ge};function Su(e,t,r,n,i){if(n===1||t===r)return r;var a=i(t,r,n);return e==null||((e.roundValue||e.color)&&(a=Math.round(a)),e.min!==void 0&&(a=Math.max(a,e.min)),e.max!==void 0&&(a=Math.min(a,e.max))),a}function Lu(e,t){return e.pfValue!=null||e.value!=null?e.pfValue!=null&&(t==null||t.type.units!=="%")?e.pfValue:e.value:e}function zr(e,t,r,n,i){var a=i!=null?i.type:null;r<0?r=0:r>1&&(r=1);var o=Lu(e,i),s=Lu(t,i);if(ne(o)&&ne(s))return Su(a,o,s,r,n);if(ze(o)&&ze(s)){for(var u=[],l=0;l<s.length;l++){var c=o[l],h=s[l];if(c!=null&&h!=null){var f=Su(a,c,h,r,n);u.push(f)}else u.push(h)}return u}}function Xv(e,t,r,n){var i=!n,a=e._private,o=t._private,s=o.easing,u=o.startTime,l=n?e:e.cy(),c=l.style();if(!o.easingImpl)if(s==null)o.easingImpl=fi.linear;else{var h;if(fe(s)){var f=c.parse("transition-timing-function",s);h=f.value}else h=s;var d,p;fe(h)?(d=h,p=[]):(d=h[1],p=h.slice(2).map(function(I){return+I})),p.length>0?(d==="spring"&&p.push(o.duration),o.easingImpl=fi[d].apply(null,p)):o.easingImpl=fi[d]}var v=o.easingImpl,m;if(o.duration===0?m=1:m=(r-u)/o.duration,o.applying&&(m=o.progress),m<0?m=0:m>1&&(m=1),o.delay==null){var g=o.startPosition,y=o.position;if(y&&i&&!e.locked()){var x={};pn(g.x,y.x)&&(x.x=zr(g.x,y.x,m,v)),pn(g.y,y.y)&&(x.y=zr(g.y,y.y,m,v)),e.position(x)}var T=o.startPan,w=o.pan,D=a.pan,b=w!=null&&n;b&&(pn(T.x,w.x)&&(D.x=zr(T.x,w.x,m,v)),pn(T.y,w.y)&&(D.y=zr(T.y,w.y,m,v)),e.emit("pan"));var _=o.startZoom,E=o.zoom,A=E!=null&&n;A&&(pn(_,E)&&(a.zoom=Dn(a.minZoom,zr(_,E,m,v),a.maxZoom)),e.emit("zoom")),(b||A)&&e.emit("viewport");var C=o.style;if(C&&C.length>0&&i){for(var N=0;N<C.length;N++){var S=C[N],M=S.name,R=S,P=o.startStyle[M],L=c.properties[P.name],O=zr(P,R,m,v,L);c.overrideBypass(e,M,O)}e.emit("style")}}return o.progress=m,m}function pn(e,t){return e==null||t==null?!1:ne(e)&&ne(t)?!0:!!(e&&t)}function Wv(e,t,r,n){var i=t._private;i.started=!0,i.startTime=r-i.progress*i.duration}function Iu(e,t){var r=t._private.aniEles,n=[];function i(c,h){var f=c._private,d=f.animation.current,p=f.animation.queue,v=!1;if(d.length===0){var m=p.shift();m&&d.push(m)}for(var g=function(w){for(var D=w.length-1;D>=0;D--){var b=w[D];b()}w.splice(0,w.length)},y=d.length-1;y>=0;y--){var x=d[y],T=x._private;if(T.stopped){d.splice(y,1),T.hooked=!1,T.playing=!1,T.started=!1,g(T.frames);continue}!T.playing&&!T.applying||(T.playing&&T.applying&&(T.applying=!1),T.started||Wv(c,x,e),Xv(c,x,e,h),T.applying&&(T.applying=!1),g(T.frames),T.step!=null&&T.step(e),x.completed()&&(d.splice(y,1),T.hooked=!1,T.playing=!1,T.started=!1,g(T.completes)),v=!0)}return!h&&d.length===0&&p.length===0&&n.push(c),v}for(var a=!1,o=0;o<r.length;o++){var s=r[o],u=i(s);a=a||u}var l=i(t,!0);(a||l)&&(r.length>0?t.notify("draw",r):t.notify("draw")),r.unmerge(n),t.emit("step")}var qv={animate:Re.animate(),animation:Re.animation(),animated:Re.animated(),clearQueue:Re.clearQueue(),delay:Re.delay(),delayAnimation:Re.delayAnimation(),stop:Re.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&Ti(function(n){Iu(n,e),t()})}var r=e.renderer();r&&r.beforeRender?r.beforeRender(function(n,i){Iu(i,e)},r.beforeRenderPriorities.animations):t()}},Hv={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,r){var n=t.qualifier;return n!=null?e!==r.target&&Rn(r.target)&&n.matches(r.target):!0},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,r){return t.qualifier!=null?r.target:e}},ai=function(e){return fe(e)?new hr(e):e},gh={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Wi(Hv,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,r){return this.emitter().on(e,ai(t),r),this},removeListener:function(e,t,r){return this.emitter().removeListener(e,ai(t),r),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,r){return this.emitter().one(e,ai(t),r),this},once:function(e,t,r){return this.emitter().one(e,ai(t),r),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Re.eventAliasesOn(gh);var Go={png:function(e){var t=this._private.renderer;return e=e||{},t.png(e)},jpg:function(e){var t=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",t.jpg(e)}};Go.jpeg=Go.jpg;var pi={layout:function(e){var t=this;if(e==null){Xe("Layout options must be specified to make a layout");return}if(e.name==null){Xe("A `name` must be specified to make a layout");return}var r=e.name,n=t.extension("layout",r);if(n==null){Xe("No such layout `"+r+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;fe(e.eles)?i=t.$(e.eles):i=e.eles!=null?e.eles:t.$();var a=new n(ge({},e,{cy:t,eles:i}));return a}};pi.createLayout=pi.makeLayout=pi.layout;var jv={notify:function(e,t){var r=this._private;if(this.batching()){r.batchNotifications=r.batchNotifications||{};var n=r.batchNotifications[e]=r.batchNotifications[e]||this.collection();t!=null&&n.merge(t);return}if(r.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(r){var n=e.batchNotifications[r];n.empty()?t.notify(r):t.notify(r,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var r=Object.keys(e),n=0;n<r.length;n++){var i=r[n],a=e[i],o=t.getElementById(i);o.data(a)}})}},$v=ht({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),Yo={renderTo:function(e,t,r,n){var i=this._private.renderer;return i.renderTo(e,t,r,n),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this,r=t.extension("renderer",e.name);if(r==null){Xe("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&Pe("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var n=$v(e);n.cy=t,t._private.renderer=new r(n),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(r){var n=r._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Yo.invalidateDimensions=Yo.resize;var gi={collection:function(e,t){return fe(e)?this.$(e):Dt(e)?e.collection():ze(e)?(t||(t={}),new ct(this,e,t.unique,t.removed)):new ct(this)},nodes:function(e){var t=this.$(function(r){return r.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(r){return r.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};gi.elements=gi.filter=gi.$;var st={},wn="t",Zv="f";st.apply=function(e){for(var t=this,r=t._private,n=r.cy,i=n.collection(),a=0;a<e.length;a++){var o=e[a],s=t.getContextMeta(o);if(!s.empty){var u=t.getContextStyle(s),l=t.applyContextStyle(s,u,o);o._private.appliedInitStyle?t.updateTransitions(o,l.diffProps):o._private.appliedInitStyle=!0;var c=t.updateStyleHints(o);c&&i.push(o)}}return i};st.getPropertiesDiff=function(e,t){var r=this,n=r._private.propDiffs=r._private.propDiffs||{},i=e+"-"+t,a=n[i];if(a)return a;for(var o=[],s={},u=0;u<r.length;u++){var l=r[u],c=e[u]===wn,h=t[u]===wn,f=c!==h,d=l.mappedProperties.length>0;if(f||h&&d){var p=void 0;f&&d||f?p=l.properties:d&&(p=l.mappedProperties);for(var v=0;v<p.length;v++){for(var m=p[v],g=m.name,y=!1,x=u+1;x<r.length;x++){var T=r[x],w=t[x]===wn;if(w&&(y=T.properties[m.name]!=null,y))break}!s[g]&&!y&&(s[g]=!0,o.push(g))}}}return n[i]=o,o};st.getContextMeta=function(e){for(var t=this,r="",n,i=e._private.styleCxtKey||"",a=0;a<t.length;a++){var o=t[a],s=o.selector&&o.selector.matches(e);s?r+=wn:r+=Zv}return n=t.getPropertiesDiff(i,r),e._private.styleCxtKey=r,{key:r,diffPropNames:n,empty:n.length===0}};st.getContextStyle=function(e){var t=e.key,r=this,n=this._private.contextStyles=this._private.contextStyles||{};if(n[t])return n[t];for(var i={_private:{key:t}},a=0;a<r.length;a++){var o=r[a],s=t[a]===wn;if(s)for(var u=0;u<o.properties.length;u++){var l=o.properties[u];i[l.name]=l}}return n[t]=i,i};st.applyContextStyle=function(e,t,r){for(var n=this,i=e.diffPropNames,a={},o=n.types,s=0;s<i.length;s++){var u=i[s],l=t[u],c=r.pstyle(u);if(!l)if(c)c.bypass?l={name:u,deleteBypassed:!0}:l={name:u,delete:!0};else continue;if(c!==l){if(l.mapped===o.fn&&c!=null&&c.mapping!=null&&c.mapping.value===l.value){var h=c.mapping,f=h.fnValue=l.value(r);if(f===h.prevFnValue)continue}var d=a[u]={prev:c};n.applyParsedProperty(r,l),d.next=r.pstyle(u),d.next&&d.next.bypass&&(d.next=d.next.bypassed)}}return{diffProps:a}};st.updateStyleHints=function(e){var t=e._private,r=this,n=r.propertyGroupNames,i=r.propertyGroupKeys,a=function(U,K,ee){return r.getPropertiesHash(U,K,ee)},o=t.styleKey;if(e.removed())return!1;var s=t.group==="nodes",u=e._private.style;n=Object.keys(u);for(var l=0;l<i.length;l++){var c=i[l];t.styleKeys[c]=[Ar,Wr]}for(var h=function(U,K){return t.styleKeys[K][0]=_n(U,t.styleKeys[K][0])},f=function(U,K){return t.styleKeys[K][1]=An(U,t.styleKeys[K][1])},d=function(U,K){h(U,K),f(U,K)},p=function(U,K){for(var ee=0;ee<U.length;ee++){var ie=U.charCodeAt(ee);h(ie,K),f(ie,K)}},v=2e9,m=function(U){return-128<U&&U<128&&Math.floor(U)!==U?v-(U*1024|0):U},g=0;g<n.length;g++){var y=n[g],x=u[y];if(x!=null){var T=this.properties[y],w=T.type,D=T.groupKey,b=void 0;T.hashOverride!=null?b=T.hashOverride(e,x):x.pfValue!=null&&(b=x.pfValue);var _=T.enums==null?x.value:null,E=b!=null,A=_!=null,C=E||A,N=x.units;if(w.number&&C&&!w.multiple){var S=E?b:_;d(m(S),D),!E&&N!=null&&p(N,D)}else p(x.strValue,D)}}for(var M=[Ar,Wr],R=0;R<i.length;R++){var P=i[R],L=t.styleKeys[P];M[0]=_n(L[0],M[0]),M[1]=An(L[1],M[1])}t.styleKey=df(M[0],M[1]);var O=t.styleKeys;t.labelDimsKey=er(O.labelDimensions);var I=a(e,["label"],O.labelDimensions);if(t.labelKey=er(I),t.labelStyleKey=er(Kn(O.commonLabel,I)),!s){var B=a(e,["source-label"],O.labelDimensions);t.sourceLabelKey=er(B),t.sourceLabelStyleKey=er(Kn(O.commonLabel,B));var F=a(e,["target-label"],O.labelDimensions);t.targetLabelKey=er(F),t.targetLabelStyleKey=er(Kn(O.commonLabel,F))}if(s){var z=t.styleKeys,G=z.nodeBody,H=z.nodeBorder,j=z.nodeOutline,Z=z.backgroundImage,Q=z.compound,re=z.pie,V=z.stripe,Y=[G,H,j,Z,Q,re,V].filter(function(U){return U!=null}).reduce(Kn,[Ar,Wr]);t.nodeKey=er(Y),t.hasPie=re!=null&&re[0]!==Ar&&re[1]!==Wr,t.hasStripe=V!=null&&V[0]!==Ar&&V[1]!==Wr}return o!==t.styleKey};st.clearStyleHints=function(e){var t=e._private;t.styleCxtKey="",t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null,t.hasStripe=null};st.applyParsedProperty=function(e,t){var r=this,n=t,i=e._private.style,a,o=r.types,s=r.properties[n.name].type,u=n.bypass,l=i[n.name],c=l&&l.bypass,h=e._private,f="mapping",d=function(z){return z==null?null:z.pfValue!=null?z.pfValue:z.value},p=function(){var z=d(l),G=d(n);r.checkTriggers(e,n.name,z,G)};if(t.name==="curve-style"&&e.isEdge()&&(t.value!=="bezier"&&e.isLoop()||t.value==="haystack"&&(e.source().isParent()||e.target().isParent()))&&(n=t=this.parse(t.name,"bezier",u)),n.delete)return i[n.name]=void 0,p(),!0;if(n.deleteBypassed)return l?l.bypass?(l.bypassed=void 0,p(),!0):!1:(p(),!0);if(n.deleteBypass)return l?l.bypass?(i[n.name]=l.bypassed,p(),!0):!1:(p(),!0);var v=function(){Pe("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+n.name+"` with data field `"+n.field+"`); try a `["+n.field+"]` selector to limit scope to elements with `"+n.field+"` defined")};switch(n.mapped){case o.mapData:{for(var m=n.field.split("."),g=h.data,y=0;y<m.length&&g;y++){var x=m[y];g=g[x]}if(g==null)return v(),!1;var T;if(ne(g)){var w=n.fieldMax-n.fieldMin;w===0?T=0:T=(g-n.fieldMin)/w}else return Pe("Do not use continuous mappers without specifying numeric data (i.e. `"+n.field+": "+g+"` for `"+e.id()+"` is non-numeric)"),!1;if(T<0?T=0:T>1&&(T=1),s.color){var D=n.valueMin[0],b=n.valueMax[0],_=n.valueMin[1],E=n.valueMax[1],A=n.valueMin[2],C=n.valueMax[2],N=n.valueMin[3]==null?1:n.valueMin[3],S=n.valueMax[3]==null?1:n.valueMax[3],M=[Math.round(D+(b-D)*T),Math.round(_+(E-_)*T),Math.round(A+(C-A)*T),Math.round(N+(S-N)*T)];a={bypass:n.bypass,name:n.name,value:M,strValue:"rgb("+M[0]+", "+M[1]+", "+M[2]+")"}}else if(s.number){var R=n.valueMin+(n.valueMax-n.valueMin)*T;a=this.parse(n.name,R,n.bypass,f)}else return!1;if(!a)return v(),!1;a.mapping=n,n=a;break}case o.data:{for(var P=n.field.split("."),L=h.data,O=0;O<P.length&&L;O++){var I=P[O];L=L[I]}if(L!=null&&(a=this.parse(n.name,L,n.bypass,f)),!a)return v(),!1;a.mapping=n,n=a;break}case o.fn:{var B=n.value,F=n.fnValue!=null?n.fnValue:B(e);if(n.prevFnValue=F,F==null)return Pe("Custom function mappers may not return null (i.e. `"+n.name+"` for ele `"+e.id()+"` is null)"),!1;if(a=this.parse(n.name,F,n.bypass,f),!a)return Pe("Custom function mappers may not return invalid values for the property type (i.e. `"+n.name+"` for ele `"+e.id()+"` is invalid)"),!1;a.mapping=Yt(n),n=a;break}case void 0:break;default:return!1}return u?(c?n.bypassed=l.bypassed:n.bypassed=l,i[n.name]=n):c?l.bypassed=n:i[n.name]=n,p(),!0};st.cleanElements=function(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(this.clearStyleHints(n),n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),!t)n._private.style={};else for(var i=n._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],u=i[s];u!=null&&(u.bypass?u.bypassed=null:i[s]=null)}}};st.update=function(){var e=this._private.cy,t=e.mutableElements();t.updateStyle()};st.updateTransitions=function(e,t){var r=this,n=e._private,i=e.pstyle("transition-property").value,a=e.pstyle("transition-duration").pfValue,o=e.pstyle("transition-delay").pfValue;if(i.length>0&&a>0){for(var s={},u=!1,l=0;l<i.length;l++){var c=i[l],h=e.pstyle(c),f=t[c];if(f){var d=f.prev,p=d,v=f.next!=null?f.next:h,m=!1,g=void 0,y=1e-6;p&&(ne(p.pfValue)&&ne(v.pfValue)?(m=v.pfValue-p.pfValue,g=p.pfValue+y*m):ne(p.value)&&ne(v.value)?(m=v.value-p.value,g=p.value+y*m):ze(p.value)&&ze(v.value)&&(m=p.value[0]!==v.value[0]||p.value[1]!==v.value[1]||p.value[2]!==v.value[2],g=p.strValue),m&&(s[c]=v.strValue,this.applyBypass(e,c,g),u=!0))}}if(!u)return;n.transitioning=!0,new nn(function(x){o>0?e.delayAnimation(o).play().promise().then(x):x()}).then(function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(e,i),e.emitAndNotify("style"),n.transitioning=!1})}else n.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),n.transitioning=!1)};st.checkTrigger=function(e,t,r,n,i,a){var o=this.properties[t],s=i(o);e.removed()||s!=null&&s(r,n,e)&&a(o)};st.checkZOrderTrigger=function(e,t,r,n){var i=this;this.checkTrigger(e,t,r,n,function(a){return a.triggersZOrder},function(){i._private.cy.notify("zorder",e)})};st.checkBoundsTrigger=function(e,t,r,n){this.checkTrigger(e,t,r,n,function(i){return i.triggersBounds},function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})};st.checkConnectedEdgesBoundsTrigger=function(e,t,r,n){this.checkTrigger(e,t,r,n,function(i){return i.triggersBoundsOfConnectedEdges},function(i){e.connectedEdges().forEach(function(a){a.dirtyBoundingBoxCache()})})};st.checkParallelEdgesBoundsTrigger=function(e,t,r,n){this.checkTrigger(e,t,r,n,function(i){return i.triggersBoundsOfParallelEdges},function(i){e.parallelEdges().forEach(function(a){a.dirtyBoundingBoxCache()})})};st.checkTriggers=function(e,t,r,n){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,r,n),this.checkBoundsTrigger(e,t,r,n),this.checkConnectedEdgesBoundsTrigger(e,t,r,n),this.checkParallelEdgesBoundsTrigger(e,t,r,n)};var Yn={};Yn.applyBypass=function(e,t,r,n){var i=this,a=[],o=!0;if(t==="*"||t==="**"){if(r!==void 0)for(var s=0;s<i.properties.length;s++){var u=i.properties[s],l=u.name,c=this.parse(l,r,!0);c&&a.push(c)}}else if(fe(t)){var h=this.parse(t,r,!0);h&&a.push(h)}else if(ke(t)){var f=t;n=r;for(var d=Object.keys(f),p=0;p<d.length;p++){var v=d[p],m=f[v];if(m===void 0&&(m=f[Ri(v)]),m!==void 0){var g=this.parse(v,m,!0);g&&a.push(g)}}}else return!1;if(a.length===0)return!1;for(var y=!1,x=0;x<e.length;x++){for(var T=e[x],w={},D=void 0,b=0;b<a.length;b++){var _=a[b];if(n){var E=T.pstyle(_.name);D=w[_.name]={prev:E}}y=this.applyParsedProperty(T,Yt(_))||y,n&&(D.next=T.pstyle(_.name))}y&&this.updateStyleHints(T),n&&this.updateTransitions(T,w,o)}return y};Yn.overrideBypass=function(e,t,r){t=as(t);for(var n=0;n<e.length;n++){var i=e[n],a=i._private.style[t],o=this.properties[t].type,s=o.color,u=o.mutiple,l=a?a.pfValue!=null?a.pfValue:a.value:null;!a||!a.bypass?this.applyBypass(i,t,r):(a.value=r,a.pfValue!=null&&(a.pfValue=r),s?a.strValue="rgb("+r.join(",")+")":u?a.strValue=r.join(" "):a.strValue=""+r,this.updateStyleHints(i)),this.checkTriggers(i,t,l,r)}};Yn.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)};Yn.removeBypasses=function(e,t,r){for(var n=!0,i=0;i<e.length;i++){for(var a=e[i],o={},s=0;s<t.length;s++){var u=t[s],l=this.properties[u],c=a.pstyle(l.name);if(!(!c||!c.bypass)){var h="",f=this.parse(u,h,!0),d=o[l.name]={prev:c};this.applyParsedProperty(a,f),d.next=a.pstyle(l.name)}}this.updateStyleHints(a),r&&this.updateTransitions(a,o,n)}};var xs={};xs.getEmSizeInPixels=function(){var e=this.containerCss("font-size");return e!=null?parseFloat(e):1};xs.containerCss=function(e){var t=this._private.cy,r=t.container(),n=t.window();if(n&&r&&n.getComputedStyle)return n.getComputedStyle(r).getPropertyValue(e)};var Ut={};Ut.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)};Ut.getRawStyle=function(e,t){var r=this;if(e=e[0],e){for(var n={},i=0;i<r.properties.length;i++){var a=r.properties[i],o=r.getStylePropertyValue(e,a.name,t);o!=null&&(n[a.name]=o,n[Ri(a.name)]=o)}return n}};Ut.getIndexedStyle=function(e,t,r,n){var i=e.pstyle(t)[r][n];return i??e.cy().style().getDefaultProperty(t)[r][0]};Ut.getStylePropertyValue=function(e,t,r){var n=this;if(e=e[0],e){var i=n.properties[t];i.alias&&(i=i.pointsTo);var a=i.type,o=e.pstyle(i.name);if(o){var s=o.value,u=o.units,l=o.strValue;if(r&&a.number&&s!=null&&ne(s)){var c=e.cy().zoom(),h=function(v){return v*c},f=function(v,m){return h(v)+m},d=ze(s),p=d?u.every(function(v){return v!=null}):u!=null;return p?d?s.map(function(v,m){return f(v,u[m])}).join(" "):f(s,u):d?s.map(function(v){return fe(v)?v:""+h(v)}).join(" "):""+h(s)}else if(l!=null)return l}return null}};Ut.getAnimationStartStyle=function(e,t){for(var r={},n=0;n<t.length;n++){var i=t[n],a=i.name,o=e.pstyle(a);o!==void 0&&(ke(o)?o=this.parse(a,o.strValue):o=this.parse(a,o)),o&&(r[a]=o)}return r};Ut.getPropsList=function(e){var t=this,r=[],n=e,i=t.properties;if(n)for(var a=Object.keys(n),o=0;o<a.length;o++){var s=a[o],u=n[s],l=i[s]||i[as(s)],c=this.parse(l.name,u);c&&r.push(c)}return r};Ut.getNonDefaultPropertiesHash=function(e,t,r){var n=r.slice(),i,a,o,s,u,l;for(u=0;u<t.length;u++)if(i=t[u],a=e.pstyle(i,!1),a!=null)if(a.pfValue!=null)n[0]=_n(s,n[0]),n[1]=An(s,n[1]);else for(o=a.strValue,l=0;l<o.length;l++)s=o.charCodeAt(l),n[0]=_n(s,n[0]),n[1]=An(s,n[1]);return n};Ut.getPropertiesHash=Ut.getNonDefaultPropertiesHash;var ji={};ji.appendFromJson=function(e){for(var t=this,r=0;r<e.length;r++){var n=e[r],i=n.selector,a=n.style||n.css,o=Object.keys(a);t.selector(i);for(var s=0;s<o.length;s++){var u=o[s],l=a[u];t.css(u,l)}}return t};ji.fromJson=function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t};ji.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var r=this[t],n=r.selector,i=r.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:n?n.toString():"core",style:a})}return e};var ws={};ws.appendFromString=function(e){var t=this,r=this,n=""+e,i,a,o;n=n.replace(/[/][*](\s|.)+?[*][/]/g,"");function s(){n.length>i.length?n=n.substr(i.length):n=""}function u(){a.length>o.length?a=a.substr(o.length):a=""}for(;;){var l=n.match(/^\s*$/);if(l)break;var c=n.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!c){Pe("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+n);break}i=c[0];var h=c[1];if(h!=="core"){var f=new hr(h);if(f.invalid){Pe("Skipping parsing of block: Invalid selector found in string stylesheet: "+h),s();continue}}var d=c[2],p=!1;a=d;for(var v=[];;){var m=a.match(/^\s*$/);if(m)break;var g=a.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!g){Pe("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+d),p=!0;break}o=g[0];var y=g[1],x=g[2],T=t.properties[y];if(!T){Pe("Skipping property: Invalid property name in: "+o),u();continue}var w=r.parse(y,x);if(!w){Pe("Skipping property: Invalid property definition in: "+o),u();continue}v.push({name:y,val:x}),u()}if(p){s();break}r.selector(h);for(var D=0;D<v.length;D++){var b=v[D];r.css(b.name,b.val)}s()}return r};ws.fromString=function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t};var Ke={};(function(){var e=tt,t=Ud,r=Wd,n=qd,i=Hd,a=function(Y){return"^"+Y+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(Y){var U=e+"|\\w+|"+t+"|"+r+"|"+n+"|"+i;return"^"+Y+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+e+")\\s*\\,\\s*("+e+")\\s*,\\s*("+U+")\\s*\\,\\s*("+U+")\\)$"},s=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];Ke.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},boxSelection:{enums:["contain","overlap","none"]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle","circle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:a("data")},layoutData:{mapping:!0,regex:a("layoutData")},scratch:{mapping:!0,regex:a("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(Y,U){switch(Y.length){case 2:return U[0]!=="deg"&&U[0]!=="rad"&&U[1]!=="deg"&&U[1]!=="rad";case 1:return fe(Y[0])||U[0]==="deg"||U[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(Y){var U=Y.length;return U===1||U===2||U===4}}};var u={zeroNonZero:function(Y,U){return(Y==null||U==null)&&Y!==U||Y==0&&U!=0?!0:Y!=0&&U==0},any:function(Y,U){return Y!=U},emptyNonEmpty:function(Y,U){var K=lr(Y),ee=lr(U);return K&&!ee||!K&&ee}},l=Ke.types,c=[{name:"label",type:l.text,triggersBounds:u.any,triggersZOrder:u.emptyNonEmpty},{name:"text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any}],h=[{name:"source-label",type:l.text,triggersBounds:u.any},{name:"source-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"source-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-offset",type:l.size,triggersBounds:u.any}],f=[{name:"target-label",type:l.text,triggersBounds:u.any},{name:"target-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"target-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-offset",type:l.size,triggersBounds:u.any}],d=[{name:"font-family",type:l.fontFamily,triggersBounds:u.any},{name:"font-style",type:l.fontStyle,triggersBounds:u.any},{name:"font-weight",type:l.fontWeight,triggersBounds:u.any},{name:"font-size",type:l.size,triggersBounds:u.any},{name:"text-transform",type:l.textTransform,triggersBounds:u.any},{name:"text-wrap",type:l.textWrap,triggersBounds:u.any},{name:"text-overflow-wrap",type:l.textOverflowWrap,triggersBounds:u.any},{name:"text-max-width",type:l.size,triggersBounds:u.any},{name:"text-outline-width",type:l.size,triggersBounds:u.any},{name:"line-height",type:l.positiveNumber,triggersBounds:u.any}],p=[{name:"text-valign",type:l.valign,triggersBounds:u.any},{name:"text-halign",type:l.halign,triggersBounds:u.any},{name:"color",type:l.color},{name:"text-outline-color",type:l.color},{name:"text-outline-opacity",type:l.zeroOneNumber},{name:"text-background-color",type:l.color},{name:"text-background-opacity",type:l.zeroOneNumber},{name:"text-background-padding",type:l.size,triggersBounds:u.any},{name:"text-border-opacity",type:l.zeroOneNumber},{name:"text-border-color",type:l.color},{name:"text-border-width",type:l.size,triggersBounds:u.any},{name:"text-border-style",type:l.borderStyle,triggersBounds:u.any},{name:"text-background-shape",type:l.textBackgroundShape,triggersBounds:u.any},{name:"text-justification",type:l.justification},{name:"box-select-labels",type:l.bool,triggersBounds:u.any}],v=[{name:"events",type:l.bool,triggersZOrder:u.any},{name:"text-events",type:l.bool,triggersZOrder:u.any},{name:"box-selection",type:l.boxSelection,triggersZOrder:u.any}],m=[{name:"display",type:l.display,triggersZOrder:u.any,triggersBounds:u.any,triggersBoundsOfConnectedEdges:u.any,triggersBoundsOfParallelEdges:function(Y,U,K){return Y===U?!1:K.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:l.visibility,triggersZOrder:u.any},{name:"opacity",type:l.zeroOneNumber,triggersZOrder:u.zeroNonZero},{name:"text-opacity",type:l.zeroOneNumber},{name:"min-zoomed-font-size",type:l.size},{name:"z-compound-depth",type:l.zCompoundDepth,triggersZOrder:u.any},{name:"z-index-compare",type:l.zIndexCompare,triggersZOrder:u.any},{name:"z-index",type:l.number,triggersZOrder:u.any}],g=[{name:"overlay-padding",type:l.size,triggersBounds:u.any},{name:"overlay-color",type:l.color},{name:"overlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"overlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"overlay-corner-radius",type:l.cornerRadius}],y=[{name:"underlay-padding",type:l.size,triggersBounds:u.any},{name:"underlay-color",type:l.color},{name:"underlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"underlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"underlay-corner-radius",type:l.cornerRadius}],x=[{name:"transition-property",type:l.propList},{name:"transition-duration",type:l.time},{name:"transition-delay",type:l.time},{name:"transition-timing-function",type:l.easing}],T=function(Y,U){return U.value==="label"?-Y.poolIndex():U.pfValue},w=[{name:"height",type:l.nodeSize,triggersBounds:u.any,hashOverride:T},{name:"width",type:l.nodeSize,triggersBounds:u.any,hashOverride:T},{name:"shape",type:l.nodeShape,triggersBounds:u.any},{name:"shape-polygon-points",type:l.polygonPointList,triggersBounds:u.any},{name:"corner-radius",type:l.cornerRadius},{name:"background-color",type:l.color},{name:"background-fill",type:l.fill},{name:"background-opacity",type:l.zeroOneNumber},{name:"background-blacken",type:l.nOneOneNumber},{name:"background-gradient-stop-colors",type:l.colors},{name:"background-gradient-stop-positions",type:l.percentages},{name:"background-gradient-direction",type:l.gradientDirection},{name:"padding",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"padding-relative-to",type:l.paddingRelativeTo,triggersBounds:u.any},{name:"bounds-expansion",type:l.boundsExpansion,triggersBounds:u.any}],D=[{name:"border-color",type:l.color},{name:"border-opacity",type:l.zeroOneNumber},{name:"border-width",type:l.size,triggersBounds:u.any},{name:"border-style",type:l.borderStyle},{name:"border-cap",type:l.lineCap},{name:"border-join",type:l.lineJoin},{name:"border-dash-pattern",type:l.numbers},{name:"border-dash-offset",type:l.number},{name:"border-position",type:l.linePosition}],b=[{name:"outline-color",type:l.color},{name:"outline-opacity",type:l.zeroOneNumber},{name:"outline-width",type:l.size,triggersBounds:u.any},{name:"outline-style",type:l.borderStyle},{name:"outline-offset",type:l.size,triggersBounds:u.any}],_=[{name:"background-image",type:l.urls},{name:"background-image-crossorigin",type:l.bgCrossOrigin},{name:"background-image-opacity",type:l.zeroOneNumbers},{name:"background-image-containment",type:l.bgContainment},{name:"background-image-smoothing",type:l.bools},{name:"background-position-x",type:l.bgPos},{name:"background-position-y",type:l.bgPos},{name:"background-width-relative-to",type:l.bgRelativeTo},{name:"background-height-relative-to",type:l.bgRelativeTo},{name:"background-repeat",type:l.bgRepeat},{name:"background-fit",type:l.bgFit},{name:"background-clip",type:l.bgClip},{name:"background-width",type:l.bgWH},{name:"background-height",type:l.bgWH},{name:"background-offset-x",type:l.bgPos},{name:"background-offset-y",type:l.bgPos}],E=[{name:"position",type:l.position,triggersBounds:u.any},{name:"compound-sizing-wrt-labels",type:l.compoundIncludeLabels,triggersBounds:u.any},{name:"min-width",type:l.size,triggersBounds:u.any},{name:"min-width-bias-left",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-width-bias-right",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height",type:l.size,triggersBounds:u.any},{name:"min-height-bias-top",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height-bias-bottom",type:l.sizeMaybePercent,triggersBounds:u.any}],A=[{name:"line-style",type:l.lineStyle},{name:"line-color",type:l.color},{name:"line-fill",type:l.fill},{name:"line-cap",type:l.lineCap},{name:"line-opacity",type:l.zeroOneNumber},{name:"line-dash-pattern",type:l.numbers},{name:"line-dash-offset",type:l.number},{name:"line-outline-width",type:l.size},{name:"line-outline-color",type:l.color},{name:"line-gradient-stop-colors",type:l.colors},{name:"line-gradient-stop-positions",type:l.percentages},{name:"curve-style",type:l.curveStyle,triggersBounds:u.any,triggersBoundsOfParallelEdges:function(Y,U){return Y===U?!1:Y==="bezier"||U==="bezier"}},{name:"haystack-radius",type:l.zeroOneNumber,triggersBounds:u.any},{name:"source-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"target-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"control-point-step-size",type:l.size,triggersBounds:u.any},{name:"control-point-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"control-point-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"segment-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-radii",type:l.numbers,triggersBounds:u.any},{name:"radius-type",type:l.radiusType,triggersBounds:u.any},{name:"taxi-turn",type:l.bidirectionalSizeMaybePercent,triggersBounds:u.any},{name:"taxi-turn-min-distance",type:l.size,triggersBounds:u.any},{name:"taxi-direction",type:l.axisDirection,triggersBounds:u.any},{name:"taxi-radius",type:l.number,triggersBounds:u.any},{name:"edge-distances",type:l.edgeDistances,triggersBounds:u.any},{name:"arrow-scale",type:l.positiveNumber,triggersBounds:u.any},{name:"loop-direction",type:l.angle,triggersBounds:u.any},{name:"loop-sweep",type:l.angle,triggersBounds:u.any},{name:"source-distance-from-node",type:l.size,triggersBounds:u.any},{name:"target-distance-from-node",type:l.size,triggersBounds:u.any}],C=[{name:"ghost",type:l.bool,triggersBounds:u.any},{name:"ghost-offset-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-offset-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-opacity",type:l.zeroOneNumber}],N=[{name:"selection-box-color",type:l.color},{name:"selection-box-opacity",type:l.zeroOneNumber},{name:"selection-box-border-color",type:l.color},{name:"selection-box-border-width",type:l.size},{name:"active-bg-color",type:l.color},{name:"active-bg-opacity",type:l.zeroOneNumber},{name:"active-bg-size",type:l.size},{name:"outside-texture-bg-color",type:l.color},{name:"outside-texture-bg-opacity",type:l.zeroOneNumber}],S=[];Ke.pieBackgroundN=16,S.push({name:"pie-size",type:l.sizeMaybePercent}),S.push({name:"pie-hole",type:l.sizeMaybePercent}),S.push({name:"pie-start-angle",type:l.angle});for(var M=1;M<=Ke.pieBackgroundN;M++)S.push({name:"pie-"+M+"-background-color",type:l.color}),S.push({name:"pie-"+M+"-background-size",type:l.percent}),S.push({name:"pie-"+M+"-background-opacity",type:l.zeroOneNumber});var R=[];Ke.stripeBackgroundN=16,R.push({name:"stripe-size",type:l.sizeMaybePercent}),R.push({name:"stripe-direction",type:l.axisDirectionPrimary});for(var P=1;P<=Ke.stripeBackgroundN;P++)R.push({name:"stripe-"+P+"-background-color",type:l.color}),R.push({name:"stripe-"+P+"-background-size",type:l.percent}),R.push({name:"stripe-"+P+"-background-opacity",type:l.zeroOneNumber});var L=[],O=Ke.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:l.arrowShape,triggersBounds:u.any},{name:"arrow-color",type:l.color},{name:"arrow-fill",type:l.arrowFill},{name:"arrow-width",type:l.arrowWidth}].forEach(function(Y){O.forEach(function(U){var K=U+"-"+Y.name,ee=Y.type,ie=Y.triggersBounds;L.push({name:K,type:ee,triggersBounds:ie})})},{});var I=Ke.properties=[].concat(v,x,m,g,y,C,p,d,c,h,f,w,D,b,_,S,R,E,A,L,N),B=Ke.propertyGroups={behavior:v,transition:x,visibility:m,overlay:g,underlay:y,ghost:C,commonLabel:p,labelDimensions:d,mainLabel:c,sourceLabel:h,targetLabel:f,nodeBody:w,nodeBorder:D,nodeOutline:b,backgroundImage:_,pie:S,stripe:R,compound:E,edgeLine:A,edgeArrow:L,core:N},F=Ke.propertyGroupNames={},z=Ke.propertyGroupKeys=Object.keys(B);z.forEach(function(Y){F[Y]=B[Y].map(function(U){return U.name}),B[Y].forEach(function(U){return U.groupKey=Y})});var G=Ke.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];Ke.propertyNames=I.map(function(Y){return Y.name});for(var H=0;H<I.length;H++){var j=I[H];I[j.name]=j}for(var Z=0;Z<G.length;Z++){var Q=G[Z],re=I[Q.pointsTo],V={name:Q.name,alias:!0,pointsTo:re};I.push(V),I[Q.name]=V}})();Ke.getDefaultProperty=function(e){return this.getDefaultProperties()[e]};Ke.getDefaultProperties=function(){var e=this._private;if(e.defaultProperties!=null)return e.defaultProperties;for(var t=ge({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","box-selection":"contain","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var c=1;c<=Ke.pieBackgroundN;c++){var h=l.name.replace("{{i}}",c),f=l.value;u[h]=f}return u},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var c=1;c<=Ke.stripeBackgroundN;c++){var h=l.name.replace("{{i}}",c),f=l.value;u[h]=f}return u},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(u,l){return Ke.arrowPrefixes.forEach(function(c){var h=c+"-"+l.name,f=l.value;u[h]=f}),u},{})),r={},n=0;n<this.properties.length;n++){var i=this.properties[n];if(!i.pointsTo){var a=i.name,o=t[a],s=this.parse(a,o);r[a]=s}}return e.defaultProperties=r,e.defaultProperties};Ke.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var $i={};$i.parse=function(e,t,r,n){var i=this;if(We(t))return i.parseImplWarn(e,t,r,n);var a=n==="mapping"||n===!0||n===!1||n==null?"dontcare":n,o=r?"t":"f",s=""+t,u=Ac(e,s,o,a),l=i.propCache=i.propCache||[],c;return(c=l[u])||(c=l[u]=i.parseImplWarn(e,t,r,n)),(r||n==="mapping")&&(c=Yt(c),c&&(c.value=Yt(c.value))),c};$i.parseImplWarn=function(e,t,r,n){var i=this.parseImpl(e,t,r,n);return!i&&t!=null&&Pe("The style property `".concat(e,": ").concat(t,"` is invalid")),i&&(i.name==="width"||i.name==="height")&&t==="label"&&Pe("The style value of `label` is deprecated for `"+i.name+"`"),i};$i.parseImpl=function(e,t,r,n){var i=this;e=as(e);var a=i.properties[e],o=t,s=i.types;if(!a||t===void 0)return null;a.alias&&(a=a.pointsTo,e=a.name);var u=fe(t);u&&(t=t.trim());var l=a.type;if(!l)return null;if(r&&(t===""||t===null))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(We(t))return{name:e,value:t,strValue:"fn",mapped:s.fn,bypass:r};var c,h;if(!(!u||n||t.length<7||t[1]!=="a")){if(t.length>=7&&t[0]==="d"&&(c=new RegExp(s.data.regex).exec(t))){if(r)return!1;var f=s.data;return{name:e,value:c,strValue:""+t,mapped:f,field:c[1],bypass:r}}else if(t.length>=10&&t[0]==="m"&&(h=new RegExp(s.mapData.regex).exec(t))){if(r||l.multiple)return!1;var d=s.mapData;if(!(l.color||l.number))return!1;var p=this.parse(e,h[4]);if(!p||p.mapped)return!1;var v=this.parse(e,h[5]);if(!v||v.mapped)return!1;if(p.pfValue===v.pfValue||p.strValue===v.strValue)return Pe("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+p.strValue+"`"),this.parse(e,p.strValue);if(l.color){var m=p.value,g=v.value,y=m[0]===g[0]&&m[1]===g[1]&&m[2]===g[2]&&(m[3]===g[3]||(m[3]==null||m[3]===1)&&(g[3]==null||g[3]===1));if(y)return!1}return{name:e,value:h,strValue:""+t,mapped:d,field:h[1],fieldMin:parseFloat(h[2]),fieldMax:parseFloat(h[3]),valueMin:p.value,valueMax:v.value,bypass:r}}}if(l.multiple&&n!=="multiple"){var x;if(u?x=t.split(/\s+/):ze(t)?x=t:x=[t],l.evenMultiple&&x.length%2!==0)return null;for(var T=[],w=[],D=[],b="",_=!1,E=0;E<x.length;E++){var A=i.parse(e,x[E],r,"multiple");_=_||fe(A.value),T.push(A.value),D.push(A.pfValue!=null?A.pfValue:A.value),w.push(A.units),b+=(E>0?" ":"")+A.strValue}return l.validate&&!l.validate(T,w)?null:l.singleEnum&&_?T.length===1&&fe(T[0])?{name:e,value:T[0],strValue:T[0],bypass:r}:null:{name:e,value:T,pfValue:D,strValue:b,bypass:r,units:w}}var C=function(){for(var re=0;re<l.enums.length;re++){var V=l.enums[re];if(V===t)return{name:e,value:t,strValue:""+t,bypass:r}}return null};if(l.number){var N,S="px";if(l.units&&(N=l.units),l.implicitUnits&&(S=l.implicitUnits),!l.unitless)if(u){var M="px|em"+(l.allowPercent?"|\\%":"");N&&(M=N);var R=t.match("^("+tt+")("+M+")?$");R&&(t=R[1],N=R[2]||S)}else(!N||l.implicitUnits)&&(N=S);if(t=parseFloat(t),isNaN(t)&&l.enums===void 0)return null;if(isNaN(t)&&l.enums!==void 0)return t=o,C();if(l.integer&&!Pd(t)||l.min!==void 0&&(t<l.min||l.strictMin&&t===l.min)||l.max!==void 0&&(t>l.max||l.strictMax&&t===l.max))return null;var P={name:e,value:t,strValue:""+t+(N||""),units:N,bypass:r};return l.unitless||N!=="px"&&N!=="em"?P.pfValue=t:P.pfValue=N==="px"||!N?t:this.getEmSizeInPixels()*t,(N==="ms"||N==="s")&&(P.pfValue=N==="ms"?t:1e3*t),(N==="deg"||N==="rad")&&(P.pfValue=N==="rad"?t:Hf(t)),N==="%"&&(P.pfValue=t/100),P}else if(l.propList){var L=[],O=""+t;if(O!=="none"){for(var I=O.split(/\s*,\s*|\s+/),B=0;B<I.length;B++){var F=I[B].trim();i.properties[F]?L.push(F):Pe("`"+F+"` is not a valid property name")}if(L.length===0)return null}return{name:e,value:L,strValue:L.length===0?"none":L.join(" "),bypass:r}}else if(l.color){var z=mc(t);return z?{name:e,value:z,pfValue:z,strValue:"rgb("+z[0]+","+z[1]+","+z[2]+")",bypass:r}:null}else if(l.regex||l.regexes){if(l.enums){var G=C();if(G)return G}for(var H=l.regexes?l.regexes:[l.regex],j=0;j<H.length;j++){var Z=new RegExp(H[j]),Q=Z.exec(t);if(Q)return{name:e,value:l.singleRegexMatchValue?Q[1]:Q,strValue:""+t,bypass:r}}return null}else return l.string?{name:e,value:""+t,strValue:""+t,bypass:r}:l.enums?C():null};var ot=function(e){if(!(this instanceof ot))return new ot(e);if(!is(e)){Xe("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},gt=ot.prototype;gt.instanceString=function(){return"style"};gt.clear=function(){for(var e=this._private,t=e.cy,r=t.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(r,!0),r.forEach(function(i){var a=i[0]._private;a.styleDirty=!0,a.appliedInitStyle=!1}),this};gt.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};gt.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)};gt.selector=function(e){var t=e==="core"?null:new hr(e),r=this.length++;return this[r]={selector:t,properties:[],mappedProperties:[],index:r},this};gt.css=function(){var e=this,t=arguments;if(t.length===1)for(var r=t[0],n=0;n<e.properties.length;n++){var i=e.properties[n],a=r[i.name];a===void 0&&(a=r[Ri(i.name)]),a!==void 0&&this.cssRule(i.name,a)}else t.length===2&&this.cssRule(t[0],t[1]);return this};gt.style=gt.css;gt.cssRule=function(e,t){var r=this.parse(e,t);if(r){var n=this.length-1;this[n].properties.push(r),this[n].properties[r.name]=r,r.name.match(/pie-(\d+)-background-size/)&&r.value&&(this._private.hasPie=!0),r.name.match(/stripe-(\d+)-background-size/)&&r.value&&(this._private.hasStripe=!0),r.mapped&&this[n].mappedProperties.push(r);var i=!this[n].selector;i&&(this._private.coreStyle[r.name]=r)}return this};gt.append=function(e){return gc(e)?e.appendToStyle(this):ze(e)?this.appendFromJson(e):fe(e)&&this.appendFromString(e),this};ot.fromJson=function(e,t){var r=new ot(e);return r.fromJson(t),r};ot.fromString=function(e,t){return new ot(e).fromString(t)};[st,Yn,xs,Ut,ji,ws,Ke,$i].forEach(function(e){ge(gt,e)});ot.types=gt.types;ot.properties=gt.properties;ot.propertyGroups=gt.propertyGroups;ot.propertyGroupNames=gt.propertyGroupNames;ot.propertyGroupKeys=gt.propertyGroupKeys;var Kv={style:function(e){if(e){var t=this.setStyle(e);t.update()}return this._private.style},setStyle:function(e){var t=this._private;return gc(e)?t.style=e.generateStyle(this):ze(e)?t.style=ot.fromJson(this,e):fe(e)?t.style=ot.fromString(this,e):t.style=ot(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},Qv="single",Sr={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var t=this._private;if(t.selectionType==null&&(t.selectionType=Qv),e!==void 0)(e==="additive"||e==="single")&&(t.selectionType=e);else return t.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,t=this._private.pan,r,n,i,a,o;switch(e.length){case 0:return t;case 1:if(fe(e[0]))return r=e[0],t[r];if(ke(e[0])){if(!this._private.panningEnabled)return this;i=e[0],a=i.x,o=i.y,ne(a)&&(t.x=a),ne(o)&&(t.y=o),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;r=e[0],n=e[1],(r==="x"||r==="y")&&ne(n)&&(t[r]=n),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,t){var r=arguments,n=this._private.pan,i,a,o,s,u;if(!this._private.panningEnabled)return this;switch(r.length){case 1:ke(e)&&(o=r[0],s=o.x,u=o.y,ne(s)&&(n.x+=s),ne(u)&&(n.y+=u),this.emit("pan viewport"));break;case 2:i=e,a=t,(i==="x"||i==="y")&&ne(a)&&(n[i]+=a),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,t){var r=this.getFitViewport(e,t);if(r){var n=this._private;n.zoom=r.zoom,n.pan=r.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(ne(e)&&t===void 0&&(t=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var r;if(fe(e)){var n=e;e=this.$(n)}else if(zd(e)){var i=e;r={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},r.w=r.x2-r.x1,r.h=r.y2-r.y1}else Dt(e)||(e=this.mutableElements());if(!(Dt(e)&&e.empty())){r=r||e.boundingBox();var a=this.width(),o=this.height(),s;if(t=ne(t)?t:0,!isNaN(a)&&!isNaN(o)&&a>0&&o>0&&!isNaN(r.w)&&!isNaN(r.h)&&r.w>0&&r.h>0){s=Math.min((a-2*t)/r.w,(o-2*t)/r.h),s=s>this._private.maxZoom?this._private.maxZoom:s,s=s<this._private.minZoom?this._private.minZoom:s;var u={x:(a-s*(r.x1+r.x2))/2,y:(o-s*(r.y1+r.y2))/2};return{zoom:s,pan:u}}}}},zoomRange:function(e,t){var r=this._private;if(t==null){var n=e;e=n.min,t=n.max}return ne(e)&&ne(t)&&e<=t?(r.minZoom=e,r.maxZoom=t):ne(e)&&t===void 0&&e<=r.maxZoom?r.minZoom=e:ne(t)&&e===void 0&&t>=r.minZoom&&(r.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t=this._private,r=t.pan,n=t.zoom,i,a,o=!1;if(t.zoomingEnabled||(o=!0),ne(e)?a=e:ke(e)&&(a=e.level,e.position!=null?i=Fi(e.position,n,r):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!t.panningEnabled&&(o=!0)),a=a>t.maxZoom?t.maxZoom:a,a=a<t.minZoom?t.minZoom:a,o||!ne(a)||a===n||i!=null&&(!ne(i.x)||!ne(i.y)))return null;if(i!=null){var s=r,u=n,l=a,c={x:-l/u*(i.x-s.x)+i.x,y:-l/u*(i.y-s.y)+i.y};return{zoomed:!0,panned:!0,zoom:l,pan:c}}else return{zoomed:!0,panned:!1,zoom:a,pan:r}},zoom:function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),r=this._private;return t==null||!t.zoomed?this:(r.zoom=t.zoom,t.panned&&(r.pan.x=t.pan.x,r.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var t=this._private,r=!0,n=!0,i=[],a=!1,o=!1;if(!e)return this;if(ne(e.zoom)||(r=!1),ke(e.pan)||(n=!1),!r&&!n)return this;if(r){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(n&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;ne(u.x)&&(t.pan.x=u.x,o=!1),ne(u.y)&&(t.pan.y=u.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(fe(e)){var r=e;e=this.mutableElements().filter(r)}else Dt(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),a=this.height();t=t===void 0?this._private.zoom:t;var o={x:(i-t*(n.x1+n.x2))/2,y:(a-t*(n.y1+n.y2))/2};return o}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,r=this;return e.sizeCache=e.sizeCache||(t?function(){var n=r.window().getComputedStyle(t),i=function(a){return parseFloat(n.getPropertyValue(a))};return{width:t.clientWidth-i("padding-left")-i("padding-right"),height:t.clientHeight-i("padding-top")-i("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,r=this.renderedExtent(),n={x1:(r.x1-e.x)/t,x2:(r.x2-e.x)/t,y1:(r.y1-e.y)/t,y2:(r.y2-e.y)/t};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};Sr.centre=Sr.center;Sr.autolockNodes=Sr.autolock;Sr.autoungrabifyNodes=Sr.autoungrabify;var Sn={data:Re.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Re.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Re.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Re.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Sn.attr=Sn.data;Sn.removeAttr=Sn.removeData;var Ln=function(e){var t=this;e=ge({},e);var r=e.container;r&&!Ei(r)&&Ei(r[0])&&(r=r[0]);var n=r?r._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];r&&(r._cyreg=n),n.cy=t;var a=Je!==void 0&&r!==void 0&&!e.headless,o=e;o.layout=ge({name:a?"grid":"null"},o.layout),o.renderer=ge({name:a?"canvas":"null"},o.renderer);var s=function(f,d,p){return d!==void 0?d:p!==void 0?p:f},u=this._private={container:r,ready:!1,options:o,elements:new ct(this),listeners:[],aniEles:new ct(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?a:o.styleEnabled,zoom:ne(o.zoom)?o.zoom:1,pan:{x:ke(o.pan)&&ne(o.pan.x)?o.pan.x:0,y:ke(o.pan)&&ne(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var l=function(f,d){var p=f.some(Vd);if(p)return nn.all(f).then(d);d(f)};u.styleEnabled&&t.setStyle([]);var c=ge({},o,o.renderer);t.initRenderer(c);var h=function(f,d,p){t.notifications(!1);var v=t.mutableElements();v.length>0&&v.remove(),f!=null&&(ke(f)||ze(f))&&t.add(f),t.one("layoutready",function(g){t.notifications(!0),t.emit(g),t.one("load",d),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",p),t.emit("done")});var m=ge({},t._private.options.layout);m.eles=t.elements(),t.layout(m).run()};l([o.style,o.elements],function(f){var d=f[0],p=f[1];u.styleEnabled&&t.style().append(d),h(p,function(){t.startAnimationLoop(),u.ready=!0,We(o.ready)&&t.on("ready",o.ready);for(var v=0;v<i.length;v++){var m=i[v];t.on("ready",m)}n&&(n.readies=[]),t.emit("ready")},o.done)})},ki=Ln.prototype;ge(ki,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return Je;var t=this._private.container.ownerDocument;return t===void 0||t==null?Je:t.defaultView||Je},mount:function(e){if(e!=null){var t=this,r=t._private,n=r.options;return!Ei(e)&&Ei(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),r.container=e,r.styleEnabled=!0,t.invalidateSize(),t.initRenderer(ge({},n,n.renderer,{name:n.renderer.name==="null"?"canvas":n.renderer.name})),t.startAnimationLoop(),t.style(n.style),t.emit("mount"),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return Yt(this._private.options)},json:function(e){var t=this,r=t._private,n=t.mutableElements(),i=function(y){return t.getElementById(y.id())};if(ke(e)){if(t.startBatch(),e.elements){var a={},o=function(y,x){for(var T=[],w=[],D=0;D<y.length;D++){var b=y[D];if(!b.data.id){Pe("cy.json() cannot handle elements without an ID attribute");continue}var _=""+b.data.id,E=t.getElementById(_);a[_]=!0,E.length!==0?w.push({ele:E,json:b}):(x&&(b.group=x),T.push(b))}t.add(T);for(var A=0;A<w.length;A++){var C=w[A],N=C.ele,S=C.json;N.json(S)}};if(ze(e.elements))o(e.elements);else for(var s=["nodes","edges"],u=0;u<s.length;u++){var l=s[u],c=e.elements[l];ze(c)&&o(c,l)}var h=t.collection();n.filter(function(y){return!a[y.id()]}).forEach(function(y){y.isParent()?h.merge(y):y.remove()}),h.forEach(function(y){return y.children().move({parent:null})}),h.forEach(function(y){return i(y).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==r.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==r.pan.x||e.pan.y!==r.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var f=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],d=0;d<f.length;d++){var p=f[d];e[p]!=null&&t[p](e[p])}return t.endBatch(),this}else{var v=!!e,m={};v?m.elements=this.elements().map(function(y){return y.json()}):(m.elements={},n.forEach(function(y){var x=y.group();m.elements[x]||(m.elements[x]=[]),m.elements[x].push(y.json())})),this._private.styleEnabled&&(m.style=t.style().json()),m.data=Yt(t.data());var g=r.options;return m.zoomingEnabled=r.zoomingEnabled,m.userZoomingEnabled=r.userZoomingEnabled,m.zoom=r.zoom,m.minZoom=r.minZoom,m.maxZoom=r.maxZoom,m.panningEnabled=r.panningEnabled,m.userPanningEnabled=r.userPanningEnabled,m.pan=Yt(r.pan),m.boxSelectionEnabled=r.boxSelectionEnabled,m.renderer=Yt(g.renderer),m.hideEdgesOnViewport=g.hideEdgesOnViewport,m.textureOnViewport=g.textureOnViewport,m.wheelSensitivity=g.wheelSensitivity,m.motionBlur=g.motionBlur,m.multiClickDebounceTime=g.multiClickDebounceTime,m}}});ki.$id=ki.getElementById;[Gv,qv,gh,Go,pi,jv,Yo,gi,Kv,Sr,Sn].forEach(function(e){ge(ki,e)});var Jv={fit:!0,directed:!1,direction:"downward",padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},ey={maximal:!1,acyclic:!1},Vr=function(e){return e.scratch("breadthfirst")},Ou=function(e,t){return e.scratch("breadthfirst",t)};function vh(e){this.options=ge({},Jv,ey,e)}vh.prototype.run=function(){var e=this.options,t=e.cy,r=e.eles,n=r.nodes().filter(function(te){return te.isChildless()}),i=r,a=e.directed,o=e.acyclic||e.maximal||e.maximalAdjustments>0,s=!!e.boundingBox,u=xt(s?e.boundingBox:structuredClone(t.extent())),l;if(Dt(e.roots))l=e.roots;else if(ze(e.roots)){for(var c=[],h=0;h<e.roots.length;h++){var f=e.roots[h],d=t.getElementById(f);c.push(d)}l=t.collection(c)}else if(fe(e.roots))l=t.$(e.roots);else if(a)l=n.roots();else{var p=r.components();l=t.collection();for(var v=function(){var te=p[m],ue=te.maxDegree(!1),ce=te.filter(function(me){return me.degree(!1)===ue});l=l.add(ce)},m=0;m<p.length;m++)v()}var g=[],y={},x=function(te,ue){g[ue]==null&&(g[ue]=[]);var ce=g[ue].length;g[ue].push(te),Ou(te,{index:ce,depth:ue})},T=function(te,ue){var ce=Vr(te),me=ce.depth,be=ce.index;g[me][be]=null,te.isChildless()&&x(te,ue)};i.bfs({roots:l,directed:e.directed,visit:function(te,ue,ce,me,be){var Ee=te[0],De=Ee.id();Ee.isChildless()&&x(Ee,be),y[De]=!0}});for(var w=[],D=0;D<n.length;D++){var b=n[D];y[b.id()]||w.push(b)}var _=function(te){for(var ue=g[te],ce=0;ce<ue.length;ce++){var me=ue[ce];if(me==null){ue.splice(ce,1),ce--;continue}Ou(me,{depth:te,index:ce})}},E=function(te,ue){for(var ce=Vr(te),me=te.incomers().filter(function(Se){return Se.isNode()&&r.has(Se)}),be=-1,Ee=te.id(),De=0;De<me.length;De++){var Be=me[De],Ve=Vr(Be);be=Math.max(be,Ve.depth)}if(ce.depth<=be){if(!e.acyclic&&ue[Ee])return null;var Ie=be+1;return T(te,Ie),ue[Ee]=Ie,!0}return!1};if(a&&o){var A=[],C={},N=function(te){return A.push(te)},S=function(){return A.shift()};for(n.forEach(function(te){return A.push(te)});A.length>0;){var M=S(),R=E(M,C);if(R)M.outgoers().filter(function(te){return te.isNode()&&r.has(te)}).forEach(N);else if(R===null){Pe("Detected double maximal shift for node `"+M.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var P=0;if(e.avoidOverlap)for(var L=0;L<n.length;L++){var O=n[L],I=O.layoutDimensions(e),B=I.w,F=I.h;P=Math.max(P,B,F)}var z={},G=function(te){if(z[te.id()])return z[te.id()];for(var ue=Vr(te).depth,ce=te.neighborhood(),me=0,be=0,Ee=0;Ee<ce.length;Ee++){var De=ce[Ee];if(!(De.isEdge()||De.isParent()||!n.has(De))){var Be=Vr(De);if(Be!=null){var Ve=Be.index,Ie=Be.depth;if(!(Ve==null||Ie==null)){var Se=g[Ie].length;Ie<ue&&(me+=Ve/Se,be++)}}}}return be=Math.max(1,be),me=me/be,be===0&&(me=0),z[te.id()]=me,me},H=function(te,ue){var ce=G(te),me=G(ue),be=ce-me;return be===0?yc(te.id(),ue.id()):be};e.depthSort!==void 0&&(H=e.depthSort);for(var j=g.length,Z=0;Z<j;Z++)g[Z].sort(H),_(Z);for(var Q=[],re=0;re<w.length;re++)Q.push(w[re]);var V=function(){for(var te=0;te<j;te++)_(te)};Q.length&&(g.unshift(Q),j=g.length,V());for(var Y=0,U=0;U<j;U++)Y=Math.max(g[U].length,Y);var K={x:u.x1+u.w/2,y:u.y1+u.h/2},ee=n.reduce(function(te,ue){return function(ce){return{w:te.w===-1?ce.w:(te.w+ce.w)/2,h:te.h===-1?ce.h:(te.h+ce.h)/2}}(ue.boundingBox({includeLabels:e.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),ie=Math.max(j===1?0:s?(u.h-e.padding*2-ee.h)/(j-1):(u.h-e.padding*2-ee.h)/(j+1),P),we=g.reduce(function(te,ue){return Math.max(te,ue.length)},0),ye=function(te){var ue=Vr(te),ce=ue.depth,me=ue.index;if(e.circle){var be=Math.min(u.w/2/j,u.h/2/j);be=Math.max(be,P);var Ee=be*ce+be-(j>0&&g[0].length<=3?be/2:0),De=2*Math.PI/g[ce].length*me;return ce===0&&g[0].length===1&&(Ee=1),{x:K.x+Ee*Math.cos(De),y:K.y+Ee*Math.sin(De)}}else{var Be=g[ce].length,Ve=Math.max(Be===1?0:s?(u.w-e.padding*2-ee.w)/((e.grid?we:Be)-1):(u.w-e.padding*2-ee.w)/((e.grid?we:Be)+1),P),Ie={x:K.x+(me+1-(Be+1)/2)*Ve,y:K.y+(ce+1-(j+1)/2)*ie};return Ie}},xe={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(xe).indexOf(e.direction)===-1&&Xe("Invalid direction '".concat(e.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(xe).join(", ")));var Me=function(te){return vf(ye(te),u,xe[e.direction])};return r.nodes().layoutPositions(this,e,Me),this};var ty={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function yh(e){this.options=ge({},ty,e)}yh.prototype.run=function(){var e=this.options,t=e,r=e.cy,n=t.eles,i=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,a=n.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o=xt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=t.sweep===void 0?2*Math.PI-2*Math.PI/a.length:t.sweep,l=u/Math.max(1,a.length-1),c,h=0,f=0;f<a.length;f++){var d=a[f],p=d.layoutDimensions(t),v=p.w,m=p.h;h=Math.max(h,v,m)}if(ne(t.radius)?c=t.radius:a.length<=1?c=0:c=Math.min(o.h,o.w)/2-h,a.length>1&&t.avoidOverlap){h*=1.75;var g=Math.cos(l)-Math.cos(0),y=Math.sin(l)-Math.sin(0),x=Math.sqrt(h*h/(g*g+y*y));c=Math.max(x,c)}var T=function(w,D){var b=t.startAngle+D*l*(i?1:-1),_=c*Math.cos(b),E=c*Math.sin(b),A={x:s.x+_,y:s.y+E};return A};return n.nodes().layoutPositions(this,t,T),this};var ry={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function mh(e){this.options=ge({},ry,e)}mh.prototype.run=function(){for(var e=this.options,t=e,r=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,n=e.cy,i=t.eles,a=i.nodes().not(":parent"),o=xt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=[],l=0,c=0;c<a.length;c++){var h=a[c],f=void 0;f=t.concentric(h),u.push({value:f,node:h}),h._private.scratch.concentric=f}a.updateStyle();for(var d=0;d<a.length;d++){var p=a[d],v=p.layoutDimensions(t);l=Math.max(l,v.w,v.h)}u.sort(function(ie,we){return we.value-ie.value});for(var m=t.levelWidth(a),g=[[]],y=g[0],x=0;x<u.length;x++){var T=u[x];if(y.length>0){var w=Math.abs(y[0].value-T.value);w>=m&&(y=[],g.push(y))}y.push(T)}var D=l+t.minNodeSpacing;if(!t.avoidOverlap){var b=g.length>0&&g[0].length>1,_=Math.min(o.w,o.h)/2-D,E=_/(g.length+b?1:0);D=Math.min(D,E)}for(var A=0,C=0;C<g.length;C++){var N=g[C],S=t.sweep===void 0?2*Math.PI-2*Math.PI/N.length:t.sweep,M=N.dTheta=S/Math.max(1,N.length-1);if(N.length>1&&t.avoidOverlap){var R=Math.cos(M)-Math.cos(0),P=Math.sin(M)-Math.sin(0),L=Math.sqrt(D*D/(R*R+P*P));A=Math.max(L,A)}N.r=A,A+=D}if(t.equidistant){for(var O=0,I=0,B=0;B<g.length;B++){var F=g[B],z=F.r-I;O=Math.max(O,z)}I=0;for(var G=0;G<g.length;G++){var H=g[G];G===0&&(I=H.r),H.r=I,I+=O}}for(var j={},Z=0;Z<g.length;Z++)for(var Q=g[Z],re=Q.dTheta,V=Q.r,Y=0;Y<Q.length;Y++){var U=Q[Y],K=t.startAngle+(r?1:-1)*re*Y,ee={x:s.x+V*Math.cos(K),y:s.y+V*Math.sin(K)};j[U.node.id()]=ee}return i.nodes().layoutPositions(this,t,function(ie){var we=ie.id();return j[we]}),this};var Eo,ny={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function Zi(e){this.options=ge({},ny,e),this.options.layout=this;var t=this.options.eles.nodes(),r=this.options.eles.edges(),n=r.filter(function(i){var a=i.source().data("id"),o=i.target().data("id"),s=t.some(function(l){return l.data("id")===a}),u=t.some(function(l){return l.data("id")===o});return!s||!u});this.options.eles=this.options.eles.not(n)}Zi.prototype.run=function(){var e=this.options,t=e.cy,r=this;r.stopped=!1,(e.animate===!0||e.animate===!1)&&r.emit({type:"layoutstart",layout:r}),e.debug===!0?Eo=!0:Eo=!1;var n=iy(t,r,e);Eo&&oy(n),e.randomize&&sy(n);var i=$t(),a=function(){ly(n,t,e),e.fit===!0&&t.fit(e.padding)},o=function(h){return!(r.stopped||h>=e.numIter||(uy(n,e),n.temperature=n.temperature*e.coolingFactor,n.temperature<e.minTemp))},s=function(){if(e.animate===!0||e.animate===!1)a(),r.one("layoutstop",e.stop),r.emit({type:"layoutstop",layout:r});else{var h=e.eles.nodes(),f=xh(n,e,h);h.layoutPositions(r,e,f)}},u=0,l=!0;if(e.animate===!0){var c=function(){for(var h=0;l&&h<e.refresh;)l=o(u),u++,h++;if(!l)Pu(n,e),s();else{var f=$t();f-i>=e.animationThreshold&&a(),Ti(c)}};c()}else{for(;l;)l=o(u),u++;Pu(n,e),s()}return this};Zi.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Zi.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var iy=function(e,t,r){for(var n=r.eles.edges(),i=r.eles.nodes(),a=xt(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:r.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=r.eles.components(),u={},l=0;l<s.length;l++)for(var c=s[l],h=0;h<c.length;h++){var f=c[h];u[f.id()]=l}for(var l=0;l<o.nodeSize;l++){var d=i[l],p=d.layoutDimensions(r),v={};v.isLocked=d.locked(),v.id=d.data("id"),v.parentId=d.data("parent"),v.cmptId=u[d.id()],v.children=[],v.positionX=d.position("x"),v.positionY=d.position("y"),v.offsetX=0,v.offsetY=0,v.height=p.w,v.width=p.h,v.maxX=v.positionX+v.width/2,v.minX=v.positionX-v.width/2,v.maxY=v.positionY+v.height/2,v.minY=v.positionY-v.height/2,v.padLeft=parseFloat(d.style("padding")),v.padRight=parseFloat(d.style("padding")),v.padTop=parseFloat(d.style("padding")),v.padBottom=parseFloat(d.style("padding")),v.nodeRepulsion=We(r.nodeRepulsion)?r.nodeRepulsion(d):r.nodeRepulsion,o.layoutNodes.push(v),o.idToIndex[v.id]=l}for(var m=[],g=0,y=-1,x=[],l=0;l<o.nodeSize;l++){var d=o.layoutNodes[l],T=d.parentId;T!=null?o.layoutNodes[o.idToIndex[T]].children.push(d.id):(m[++y]=d.id,x.push(d.id))}for(o.graphSet.push(x);g<=y;){var w=m[g++],D=o.idToIndex[w],f=o.layoutNodes[D],b=f.children;if(b.length>0){o.graphSet.push(b);for(var l=0;l<b.length;l++)m[++y]=b[l]}}for(var l=0;l<o.graphSet.length;l++)for(var _=o.graphSet[l],h=0;h<_.length;h++){var E=o.idToIndex[_[h]];o.indexToGraph[E]=l}for(var l=0;l<o.edgeSize;l++){var A=n[l],C={};C.id=A.data("id"),C.sourceId=A.data("source"),C.targetId=A.data("target");var N=We(r.idealEdgeLength)?r.idealEdgeLength(A):r.idealEdgeLength,S=We(r.edgeElasticity)?r.edgeElasticity(A):r.edgeElasticity,M=o.idToIndex[C.sourceId],R=o.idToIndex[C.targetId],P=o.indexToGraph[M],L=o.indexToGraph[R];if(P!=L){for(var O=ay(C.sourceId,C.targetId,o),I=o.graphSet[O],B=0,v=o.layoutNodes[M];I.indexOf(v.id)===-1;)v=o.layoutNodes[o.idToIndex[v.parentId]],B++;for(v=o.layoutNodes[R];I.indexOf(v.id)===-1;)v=o.layoutNodes[o.idToIndex[v.parentId]],B++;N*=B*r.nestingFactor}C.idealLength=N,C.elasticity=S,o.layoutEdges.push(C)}return o},ay=function(e,t,r){var n=bh(e,t,0,r);return 2>n.count?0:n.graph},bh=function(e,t,r,n){var i=n.graphSet[r];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:r};for(var a=0,o=0;o<i.length;o++){var s=i[o],u=n.idToIndex[s],l=n.layoutNodes[u].children;if(l.length!==0){var c=n.indexToGraph[n.idToIndex[l[0]]],h=bh(e,t,c,n);if(h.count!==0)if(h.count===1){if(a++,a===2)break}else return h}}return{count:a,graph:r}},oy,sy=function(e,t){for(var r=e.clientWidth,n=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];a.children.length===0&&!a.isLocked&&(a.positionX=Math.random()*r,a.positionY=Math.random()*n)}},xh=function(e,t,r){var n=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(r.forEach(function(a){var o=e.layoutNodes[e.idToIndex[a.data("id")]];i.x1=Math.min(i.x1,o.positionX),i.x2=Math.max(i.x2,o.positionX),i.y1=Math.min(i.y1,o.positionY),i.y2=Math.max(i.y2,o.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(a,o){var s=e.layoutNodes[e.idToIndex[a.data("id")]];if(t.boundingBox){var u=i.w===0?.5:(s.positionX-i.x1)/i.w,l=i.h===0?.5:(s.positionY-i.y1)/i.h;return{x:n.x1+u*n.w,y:n.y1+l*n.h}}else return{x:s.positionX,y:s.positionY}}},ly=function(e,t,r){var n=r.layout,i=r.eles.nodes(),a=xh(e,r,i);i.positions(a),e.ready!==!0&&(e.ready=!0,n.one("layoutready",r.ready),n.emit({type:"layoutready",layout:this}))},uy=function(e,t,r){cy(e,t),fy(e),py(e,t),gy(e),vy(e)},cy=function(e,t){for(var r=0;r<e.graphSet.length;r++)for(var n=e.graphSet[r],i=n.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[n[a]]],s=a+1;s<i;s++){var u=e.layoutNodes[e.idToIndex[n[s]]];hy(o,u,e,t)}},Ru=function(e){return-1+2*e*Math.random()},hy=function(e,t,r,n){var i=e.cmptId,a=t.cmptId;if(!(i!==a&&!r.isCompound)){var o=t.positionX-e.positionX,s=t.positionY-e.positionY,u=1;o===0&&s===0&&(o=Ru(u),s=Ru(u));var l=dy(e,t,o,s);if(l>0)var m=n.nodeOverlap*l,v=Math.sqrt(o*o+s*s),g=m*o/v,y=m*s/v;else var c=Mi(e,o,s),h=Mi(t,-1*o,-1*s),f=h.x-c.x,d=h.y-c.y,p=f*f+d*d,v=Math.sqrt(p),m=(e.nodeRepulsion+t.nodeRepulsion)/p,g=m*f/v,y=m*d/v;e.isLocked||(e.offsetX-=g,e.offsetY-=y),t.isLocked||(t.offsetX+=g,t.offsetY+=y)}},dy=function(e,t,r,n){if(r>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(n>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},Mi=function(e,t,r){var n=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=r/t,u=a/o,l={};return t===0&&0<r||t===0&&0>r?(l.x=n,l.y=i+a/2,l):0<t&&-1*u<=s&&s<=u?(l.x=n+o/2,l.y=i+o*r/2/t,l):0>t&&-1*u<=s&&s<=u?(l.x=n-o/2,l.y=i-o*r/2/t,l):0<r&&(s<=-1*u||s>=u)?(l.x=n+a*t/2/r,l.y=i+a/2,l):(0>r&&(s<=-1*u||s>=u)&&(l.x=n-a*t/2/r,l.y=i-a/2),l)},fy=function(e,t){for(var r=0;r<e.edgeSize;r++){var n=e.layoutEdges[r],i=e.idToIndex[n.sourceId],a=e.layoutNodes[i],o=e.idToIndex[n.targetId],s=e.layoutNodes[o],u=s.positionX-a.positionX,l=s.positionY-a.positionY;if(!(u===0&&l===0)){var c=Mi(a,u,l),h=Mi(s,-1*u,-1*l),f=h.x-c.x,d=h.y-c.y,p=Math.sqrt(f*f+d*d),v=Math.pow(n.idealLength-p,2)/n.elasticity;if(p!==0)var m=v*f/p,g=v*d/p;else var m=0,g=0;a.isLocked||(a.offsetX+=m,a.offsetY+=g),s.isLocked||(s.offsetX-=m,s.offsetY-=g)}}},py=function(e,t){if(t.gravity!==0)for(var r=1,n=0;n<e.graphSet.length;n++){var i=e.graphSet[n],a=i.length;if(n===0)var u=e.clientHeight/2,l=e.clientWidth/2;else var o=e.layoutNodes[e.idToIndex[i[0]]],s=e.layoutNodes[e.idToIndex[o.parentId]],u=s.positionX,l=s.positionY;for(var c=0;c<a;c++){var h=e.layoutNodes[e.idToIndex[i[c]]];if(!h.isLocked){var f=u-h.positionX,d=l-h.positionY,p=Math.sqrt(f*f+d*d);if(p>r){var v=t.gravity*f/p,m=t.gravity*d/p;h.offsetX+=v,h.offsetY+=m}}}}},gy=function(e,t){var r=[],n=0,i=-1;for(r.push.apply(r,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var a=r[n++],o=e.idToIndex[a],s=e.layoutNodes[o],u=s.children;if(0<u.length&&!s.isLocked){for(var l=s.offsetX,c=s.offsetY,h=0;h<u.length;h++){var f=e.layoutNodes[e.idToIndex[u[h]]];f.offsetX+=l,f.offsetY+=c,r[++i]=u[h]}s.offsetX=0,s.offsetY=0}}},vy=function(e,t){for(var r=0;r<e.nodeSize;r++){var n=e.layoutNodes[r];0<n.children.length&&(n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(var r=0;r<e.nodeSize;r++){var n=e.layoutNodes[r];if(!(0<n.children.length||n.isLocked)){var i=yy(n.offsetX,n.offsetY,e.temperature);n.positionX+=i.x,n.positionY+=i.y,n.offsetX=0,n.offsetY=0,n.minX=n.positionX-n.width,n.maxX=n.positionX+n.width,n.minY=n.positionY-n.height,n.maxY=n.positionY+n.height,wh(n,e)}}for(var r=0;r<e.nodeSize;r++){var n=e.layoutNodes[r];0<n.children.length&&!n.isLocked&&(n.positionX=(n.maxX+n.minX)/2,n.positionY=(n.maxY+n.minY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY)}},yy=function(e,t,r){var n=Math.sqrt(e*e+t*t);if(n>r)var i={x:r*e/n,y:r*t/n};else var i={x:e,y:t};return i},wh=function(e,t){var r=e.parentId;if(r!=null){var n=t.layoutNodes[t.idToIndex[r]],i=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(n.minX==null||e.minX-n.padLeft<n.minX)&&(n.minX=e.minX-n.padLeft,i=!0),(n.maxY==null||e.maxY+n.padBottom>n.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(n.minY==null||e.minY-n.padTop<n.minY)&&(n.minY=e.minY-n.padTop,i=!0),i)return wh(n,t)}},Pu=function(e,t){for(var r=e.layoutNodes,n=[],i=0;i<r.length;i++){var a=r[i],o=a.cmptId,s=n[o]=n[o]||[];s.push(a)}for(var u=0,i=0;i<n.length;i++){var l=n[i];if(l){l.x1=1/0,l.x2=-1/0,l.y1=1/0,l.y2=-1/0;for(var c=0;c<l.length;c++){var h=l[c];l.x1=Math.min(l.x1,h.positionX-h.width/2),l.x2=Math.max(l.x2,h.positionX+h.width/2),l.y1=Math.min(l.y1,h.positionY-h.height/2),l.y2=Math.max(l.y2,h.positionY+h.height/2)}l.w=l.x2-l.x1,l.h=l.y2-l.y1,u+=l.w*l.h}}n.sort(function(g,y){return y.w*y.h-g.w*g.h});for(var f=0,d=0,p=0,v=0,m=Math.sqrt(u)*e.clientWidth/e.clientHeight,i=0;i<n.length;i++){var l=n[i];if(l){for(var c=0;c<l.length;c++){var h=l[c];h.isLocked||(h.positionX+=f-l.x1,h.positionY+=d-l.y1)}f+=l.w+t.componentSpacing,p+=l.w+t.componentSpacing,v=Math.max(v,l.h),p>m&&(d+=v+t.componentSpacing,f=0,p=0,v=0)}}},my={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Eh(e){this.options=ge({},my,e)}Eh.prototype.run=function(){var e=this.options,t=e,r=e.cy,n=t.eles,i=n.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=xt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(a.h===0||a.w===0)n.nodes().layoutPositions(this,t,function(G){return{x:a.x1,y:a.y1}});else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),u=Math.round(s),l=Math.round(a.w/a.h*s),c=function(G){if(G==null)return Math.min(u,l);var H=Math.min(u,l);H==u?u=G:l=G},h=function(G){if(G==null)return Math.max(u,l);var H=Math.max(u,l);H==u?u=G:l=G},f=t.rows,d=t.cols!=null?t.cols:t.columns;if(f!=null&&d!=null)u=f,l=d;else if(f!=null&&d==null)u=f,l=Math.ceil(o/u);else if(f==null&&d!=null)l=d,u=Math.ceil(o/l);else if(l*u>o){var p=c(),v=h();(p-1)*v>=o?c(p-1):(v-1)*p>=o&&h(v-1)}else for(;l*u<o;){var m=c(),g=h();(g+1)*m>=o?h(g+1):c(m+1)}var y=a.w/l,x=a.h/u;if(t.condense&&(y=0,x=0),t.avoidOverlap)for(var T=0;T<i.length;T++){var w=i[T],D=w._private.position;(D.x==null||D.y==null)&&(D.x=0,D.y=0);var b=w.layoutDimensions(t),_=t.avoidOverlapPadding,E=b.w+_,A=b.h+_;y=Math.max(y,E),x=Math.max(x,A)}for(var C={},N=function(G,H){return!!C["c-"+G+"-"+H]},S=function(G,H){C["c-"+G+"-"+H]=!0},M=0,R=0,P=function(){R++,R>=l&&(R=0,M++)},L={},O=0;O<i.length;O++){var I=i[O],B=t.position(I);if(B&&(B.row!==void 0||B.col!==void 0)){var F={row:B.row,col:B.col};if(F.col===void 0)for(F.col=0;N(F.row,F.col);)F.col++;else if(F.row===void 0)for(F.row=0;N(F.row,F.col);)F.row++;L[I.id()]=F,S(F.row,F.col)}}var z=function(G,H){var j,Z;if(G.locked()||G.isParent())return!1;var Q=L[G.id()];if(Q)j=Q.col*y+y/2+a.x1,Z=Q.row*x+x/2+a.y1;else{for(;N(M,R);)P();j=R*y+y/2+a.x1,Z=M*x+x/2+a.y1,S(M,R),P()}return{x:j,y:Z}};i.layoutPositions(this,t,z)}return this};var by={ready:function(){},stop:function(){}};function Es(e){this.options=ge({},by,e)}Es.prototype.run=function(){var e=this.options,t=e.eles,r=this;return e.cy,r.emit("layoutstart"),t.nodes().positions(function(){return{x:0,y:0}}),r.one("layoutready",e.ready),r.emit("layoutready"),r.one("layoutstop",e.stop),r.emit("layoutstop"),this};Es.prototype.stop=function(){return this};var xy={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Th(e){this.options=ge({},xy,e)}Th.prototype.run=function(){var e=this.options,t=e.eles,r=t.nodes(),n=We(e.positions);function i(a){if(e.positions==null)return Yf(a.position());if(n)return e.positions(a);var o=e.positions[a._private.data.id];return o??null}return r.layoutPositions(this,e,function(a,o){var s=i(a);return a.locked()||s==null?!1:s}),this};var wy={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function _h(e){this.options=ge({},wy,e)}_h.prototype.run=function(){var e=this.options,t=e.cy,r=e.eles,n=xt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),i=function(a,o){return{x:n.x1+Math.round(Math.random()*n.w),y:n.y1+Math.round(Math.random()*n.h)}};return r.nodes().layoutPositions(this,e,i),this};var Ey=[{name:"breadthfirst",impl:vh},{name:"circle",impl:yh},{name:"concentric",impl:mh},{name:"cose",impl:Zi},{name:"grid",impl:Eh},{name:"null",impl:Es},{name:"preset",impl:Th},{name:"random",impl:_h}];function Ah(e){this.options=e,this.notifications=0}var Bu=function(){},Fu=function(){throw new Error("A headless instance can not render images")};Ah.prototype={recalculateRenderedStyle:Bu,notify:function(){this.notifications++},init:Bu,isHeadless:function(){return!0},png:Fu,jpg:Fu};var Ts={};Ts.arrowShapeWidth=.3;Ts.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,r=function(u,l,c,h,f,d,p){var v=f.x-c/2-p,m=f.x+c/2+p,g=f.y-c/2-p,y=f.y+c/2+p,x=v<=u&&u<=m&&g<=l&&l<=y;return x},n=function(u,l,c,h,f){var d=u*Math.cos(h)-l*Math.sin(h),p=u*Math.sin(h)+l*Math.cos(h),v=d*c,m=p*c,g=v+f.x,y=m+f.y;return{x:g,y}},i=function(u,l,c,h){for(var f=[],d=0;d<u.length;d+=2){var p=u[d],v=u[d+1];f.push(n(p,v,l,c,h))}return f},a=function(u){for(var l=[],c=0;c<u.length;c++){var h=u[c];l.push(h.x,h.y)}return l},o=function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").pfValue*2},s=function(u,l){fe(l)&&(l=e[l]),e[u]=ge({name:u,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(c,h,f,d,p,v){var m=a(i(this.points,f+2*v,d,p)),g=At(c,h,m);return g},roughCollide:r,draw:function(c,h,f,d){var p=i(this.points,h,f,d);t.arrowShapeImpl("polygon")(c,p)},spacing:function(c){return 0},gap:o},l)};s("none",{collide:_i,roughCollide:_i,draw:ls,spacing:Ks,gap:Ks}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(u,l,c,h,f){var d=i(this.points,l,c,h),p=this.controlPoint,v=n(p[0],p[1],l,c,h);t.arrowShapeImpl(this.name)(u,d,v)},gap:function(u){return o(u)*.8}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(u,l,c,h,f,d,p){var v=a(i(this.points,c+2*p,h,f)),m=a(i(this.pointsTee,c+2*p,h,f)),g=At(u,l,v)||At(u,l,m);return g},draw:function(u,l,c,h,f){var d=i(this.points,l,c,h),p=i(this.pointsTee,l,c,h);t.arrowShapeImpl(this.name)(u,d,p)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(u,l,c,h,f,d,p){var v=f,m=Math.pow(v.x-u,2)+Math.pow(v.y-l,2)<=Math.pow((c+2*p)*this.radius,2),g=a(i(this.points,c+2*p,h,f));return At(u,l,g)||m},draw:function(u,l,c,h,f){var d=i(this.pointsTr,l,c,h);t.arrowShapeImpl(this.name)(u,d,h.x,h.y,this.radius*l)},spacing:function(u){return t.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(u,l){var c=this.baseCrossLinePts.slice(),h=l/u,f=3,d=5;return c[f]=c[f]-h,c[d]=c[d]-h,c},collide:function(u,l,c,h,f,d,p){var v=a(i(this.points,c+2*p,h,f)),m=a(i(this.crossLinePts(c,d),c+2*p,h,f)),g=At(u,l,v)||At(u,l,m);return g},draw:function(u,l,c,h,f){var d=i(this.points,l,c,h),p=i(this.crossLinePts(l,f),l,c,h);t.arrowShapeImpl(this.name)(u,d,p)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(u){return o(u)*.525}}),s("circle",{radius:.15,collide:function(u,l,c,h,f,d,p){var v=f,m=Math.pow(v.x-u,2)+Math.pow(v.y-l,2)<=Math.pow((c+2*p)*this.radius,2);return m},draw:function(u,l,c,h,f){t.arrowShapeImpl(this.name)(u,h.x,h.y,this.radius*l)},spacing:function(u){return t.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(u){return 1},gap:function(u){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(u){return .95*u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}})};var Or={};Or.projectIntoViewport=function(e,t){var r=this.cy,n=this.findContainerClientCoords(),i=n[0],a=n[1],o=n[4],s=r.pan(),u=r.zoom(),l=((e-i)/o-s.x)/u,c=((t-a)/o-s.y)/u;return[l,c]};Or.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),r=this.cy.window().getComputedStyle(e),n=function(m){return parseFloat(r.getPropertyValue(m))},i={left:n("padding-left"),right:n("padding-right"),top:n("padding-top"),bottom:n("padding-bottom")},a={left:n("border-left-width"),right:n("border-right-width"),top:n("border-top-width"),bottom:n("border-bottom-width")},o=e.clientWidth,s=e.clientHeight,u=i.left+i.right,l=i.top+i.bottom,c=a.left+a.right,h=t.width/(o+c),f=o-u,d=s-l,p=t.left+i.left+a.left,v=t.top+i.top+a.top;return this.containerBB=[p,v,f,d,h]};Or.invalidateContainerClientCoordsCache=function(){this.containerBB=null};Or.findNearestElement=function(e,t,r,n){return this.findNearestElements(e,t,r,n)[0]};Or.findNearestElements=function(e,t,r,n){var i=this,a=this,o=a.getCachedZSortedEles(),s=[],u=a.cy.zoom(),l=a.cy.hasCompoundNodes(),c=(n?24:8)/u,h=(n?8:2)/u,f=(n?8:2)/u,d=1/0,p,v;r&&(o=o.interactive);function m(b,_){if(b.isNode()){if(v)return;v=b,s.push(b)}if(b.isEdge()&&(_==null||_<d))if(p){if(p.pstyle("z-compound-depth").value===b.pstyle("z-compound-depth").value&&p.pstyle("z-compound-depth").value===b.pstyle("z-compound-depth").value){for(var E=0;E<s.length;E++)if(s[E].isEdge()){s[E]=b,p=b,d=_??d;break}}}else s.push(b),p=b,d=_??d}function g(b){var _=b.outerWidth()+2*h,E=b.outerHeight()+2*h,A=_/2,C=E/2,N=b.position(),S=b.pstyle("corner-radius").value==="auto"?"auto":b.pstyle("corner-radius").pfValue,M=b._private.rscratch;if(N.x-A<=e&&e<=N.x+A&&N.y-C<=t&&t<=N.y+C){var R=a.nodeShapes[i.getNodeShape(b)];if(R.checkPoint(e,t,0,_,E,N.x,N.y,S,M))return m(b,0),!0}}function y(b){var _=b._private,E=_.rscratch,A=b.pstyle("width").pfValue,C=b.pstyle("arrow-scale").value,N=A/2+c,S=N*N,M=N*2,R=_.source,P=_.target,L;if(E.edgeType==="segments"||E.edgeType==="straight"||E.edgeType==="haystack"){for(var O=E.allpts,I=0;I+3<O.length;I+=2)if(rp(e,t,O[I],O[I+1],O[I+2],O[I+3],M)&&S>(L=sp(e,t,O[I],O[I+1],O[I+2],O[I+3])))return m(b,L),!0}else if(E.edgeType==="bezier"||E.edgeType==="multibezier"||E.edgeType==="self"||E.edgeType==="compound"){for(var O=E.allpts,I=0;I+5<E.allpts.length;I+=4)if(np(e,t,O[I],O[I+1],O[I+2],O[I+3],O[I+4],O[I+5],M)&&S>(L=op(e,t,O[I],O[I+1],O[I+2],O[I+3],O[I+4],O[I+5])))return m(b,L),!0}for(var R=R||_.source,P=P||_.target,B=i.getArrowWidth(A,C),F=[{name:"source",x:E.arrowStartX,y:E.arrowStartY,angle:E.srcArrowAngle},{name:"target",x:E.arrowEndX,y:E.arrowEndY,angle:E.tgtArrowAngle},{name:"mid-source",x:E.midX,y:E.midY,angle:E.midsrcArrowAngle},{name:"mid-target",x:E.midX,y:E.midY,angle:E.midtgtArrowAngle}],I=0;I<F.length;I++){var z=F[I],G=a.arrowShapes[b.pstyle(z.name+"-arrow-shape").value],H=b.pstyle("width").pfValue;if(G.roughCollide(e,t,B,z.angle,{x:z.x,y:z.y},H,c)&&G.collide(e,t,B,z.angle,{x:z.x,y:z.y},H,c))return m(b),!0}l&&s.length>0&&(g(R),g(P))}function x(b,_,E){return _t(b,_,E)}function T(b,_){var E=b._private,A=f,C;_?C=_+"-":C="",b.boundingBox();var N=E.labelBounds[_||"main"],S=b.pstyle(C+"label").value,M=b.pstyle("text-events").strValue==="yes";if(!(!M||!S)){var R=x(E.rscratch,"labelX",_),P=x(E.rscratch,"labelY",_),L=x(E.rscratch,"labelAngle",_),O=b.pstyle(C+"text-margin-x").pfValue,I=b.pstyle(C+"text-margin-y").pfValue,B=N.x1-A-O,F=N.x2+A-O,z=N.y1-A-I,G=N.y2+A-I;if(L){var H=Math.cos(L),j=Math.sin(L),Z=function(K,ee){return K=K-R,ee=ee-P,{x:K*H-ee*j+R,y:K*j+ee*H+P}},Q=Z(B,z),re=Z(B,G),V=Z(F,z),Y=Z(F,G),U=[Q.x+O,Q.y+I,V.x+O,V.y+I,Y.x+O,Y.y+I,re.x+O,re.y+I];if(At(e,t,U))return m(b),!0}else if(ir(N,e,t))return m(b),!0}}for(var w=o.length-1;w>=0;w--){var D=o[w];D.isNode()?g(D)||T(D):y(D)||T(D)||T(D,"source")||T(D,"target")}return s};Or.getAllInBox=function(e,t,r,n){var i=this.getCachedZSortedEles().interactive,a=this.cy.zoom(),o=2/a,s=[],u=Math.min(e,r),l=Math.max(e,r),c=Math.min(t,n),h=Math.max(t,n);e=u,r=l,t=c,n=h;var f=xt({x1:e,y1:t,x2:r,y2:n}),d=[{x:f.x1,y:f.y1},{x:f.x2,y:f.y1},{x:f.x2,y:f.y2},{x:f.x1,y:f.y2}],p=[[d[0],d[1]],[d[1],d[2]],[d[2],d[3]],[d[3],d[0]]];function v(ee,ie,we){return _t(ee,ie,we)}function m(ee,ie){var we=ee._private,ye=o,xe="";ee.boundingBox();var Me=we.labelBounds.main;if(!Me)return null;var te=v(we.rscratch,"labelX",ie),ue=v(we.rscratch,"labelY",ie),ce=v(we.rscratch,"labelAngle",ie),me=ee.pstyle(xe+"text-margin-x").pfValue,be=ee.pstyle(xe+"text-margin-y").pfValue,Ee=Me.x1-ye-me,De=Me.x2+ye-me,Be=Me.y1-ye-be,Ve=Me.y2+ye-be;if(ce){var Ie=Math.cos(ce),Se=Math.sin(ce),ae=function(ve,k){return ve=ve-te,k=k-ue,{x:ve*Ie-k*Se+te,y:ve*Se+k*Ie+ue}};return[ae(Ee,Be),ae(De,Be),ae(De,Ve),ae(Ee,Ve)]}else return[{x:Ee,y:Be},{x:De,y:Be},{x:De,y:Ve},{x:Ee,y:Ve}]}function g(ee,ie,we,ye){function xe(Me,te,ue){return(ue.y-Me.y)*(te.x-Me.x)>(te.y-Me.y)*(ue.x-Me.x)}return xe(ee,we,ye)!==xe(ie,we,ye)&&xe(ee,ie,we)!==xe(ee,ie,ye)}for(var y=0;y<i.length;y++){var x=i[y];if(x.isNode()){var T=x,w=T.pstyle("text-events").strValue==="yes",D=T.pstyle("box-selection").strValue,b=T.pstyle("box-select-labels").strValue==="yes";if(D==="none")continue;var _=(D==="overlap"||b)&&w,E=T.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:_});if(D==="contain"){var A=!1;if(b&&w){var C=m(T);C&&ba(C,d)&&(s.push(T),A=!0)}!A&&Lc(f,E)&&s.push(T)}else if(D==="overlap"&&ds(f,E)){var N=T.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),S=[{x:N.x1,y:N.y1},{x:N.x2,y:N.y1},{x:N.x2,y:N.y2},{x:N.x1,y:N.y2}];if(ba(S,d))s.push(T);else{var M=m(T);M&&ba(M,d)&&s.push(T)}}}else{var R=x,P=R._private,L=P.rscratch,O=R.pstyle("box-selection").strValue;if(O==="none")continue;if(O==="contain"){if(L.startX!=null&&L.startY!=null&&!ir(f,L.startX,L.startY)||L.endX!=null&&L.endY!=null&&!ir(f,L.endX,L.endY))continue;if(L.edgeType==="bezier"||L.edgeType==="multibezier"||L.edgeType==="self"||L.edgeType==="compound"||L.edgeType==="segments"||L.edgeType==="haystack"){for(var I=P.rstyle.bezierPts||P.rstyle.linePts||P.rstyle.haystackPts,B=!0,F=0;F<I.length;F++)if(!nl(f,I[F])){B=!1;break}B&&s.push(R)}else L.edgeType==="straight"&&s.push(R)}else if(O==="overlap"){var z=!1;if(L.startX!=null&&L.startY!=null&&L.endX!=null&&L.endY!=null&&(ir(f,L.startX,L.startY)||ir(f,L.endX,L.endY)))s.push(R),z=!0;else if(!z&&L.edgeType==="haystack"){for(var G=P.rstyle.haystackPts,H=0;H<G.length;H++)if(nl(f,G[H])){s.push(R),z=!0;break}}if(!z){var j=P.rstyle.bezierPts||P.rstyle.linePts||P.rstyle.haystackPts;if((!j||j.length<2)&&L.edgeType==="straight"&&L.startX!=null&&L.startY!=null&&L.endX!=null&&L.endY!=null&&(j=[{x:L.startX,y:L.startY},{x:L.endX,y:L.endY}]),!j||j.length<2)continue;for(var Z=0;Z<j.length-1;Z++){for(var Q=j[Z],re=j[Z+1],V=0;V<p.length;V++){var Y=Qe(p[V],2),U=Y[0],K=Y[1];if(g(Q,re,U,K)){s.push(R),z=!0;break}}if(z)break}}}}}return s};var Si={};Si.calculateArrowAngles=function(e){var t=e._private.rscratch,r=t.edgeType==="haystack",n=t.edgeType==="bezier",i=t.edgeType==="multibezier",a=t.edgeType==="segments",o=t.edgeType==="compound",s=t.edgeType==="self",u,l,c,h,f,d,g,y;if(r?(c=t.haystackPts[0],h=t.haystackPts[1],f=t.haystackPts[2],d=t.haystackPts[3]):(c=t.arrowStartX,h=t.arrowStartY,f=t.arrowEndX,d=t.arrowEndY),g=t.midX,y=t.midY,a)u=c-t.segpts[0],l=h-t.segpts[1];else if(i||o||s||n){var p=t.allpts,v=at(p[0],p[2],p[4],.1),m=at(p[1],p[3],p[5],.1);u=c-v,l=h-m}else u=c-g,l=h-y;t.srcArrowAngle=Qn(u,l);var g=t.midX,y=t.midY;if(r&&(g=(c+f)/2,y=(h+d)/2),u=f-c,l=d-h,a){var p=t.allpts;if(p.length/2%2===0){var x=p.length/2,T=x-2;u=p[x]-p[T],l=p[x+1]-p[T+1]}else if(t.isRound)u=t.midVector[1],l=-t.midVector[0];else{var x=p.length/2-1,T=x-2;u=p[x]-p[T],l=p[x+1]-p[T+1]}}else if(i||o||s){var p=t.allpts,w=t.ctrlpts,D,b,_,E;if(w.length/2%2===0){var A=p.length/2-1,C=A+2,N=C+2;D=at(p[A],p[C],p[N],0),b=at(p[A+1],p[C+1],p[N+1],0),_=at(p[A],p[C],p[N],1e-4),E=at(p[A+1],p[C+1],p[N+1],1e-4)}else{var C=p.length/2-1,A=C-2,N=C+2;D=at(p[A],p[C],p[N],.4999),b=at(p[A+1],p[C+1],p[N+1],.4999),_=at(p[A],p[C],p[N],.5),E=at(p[A+1],p[C+1],p[N+1],.5)}u=_-D,l=E-b}if(t.midtgtArrowAngle=Qn(u,l),t.midDispX=u,t.midDispY=l,u*=-1,l*=-1,a){var p=t.allpts;if(p.length/2%2!==0&&!t.isRound){var x=p.length/2-1,S=x+2;u=-(p[S]-p[x]),l=-(p[S+1]-p[x+1])}}if(t.midsrcArrowAngle=Qn(u,l),a)u=f-t.segpts[t.segpts.length-2],l=d-t.segpts[t.segpts.length-1];else if(i||o||s||n){var p=t.allpts,M=p.length,v=at(p[M-6],p[M-4],p[M-2],.9),m=at(p[M-5],p[M-3],p[M-1],.9);u=f-v,l=d-m}else u=f-g,l=d-y;t.tgtArrowAngle=Qn(u,l)};Si.getArrowWidth=Si.getArrowHeight=function(e,t){var r=this.arrowWidthCache=this.arrowWidthCache||{},n=r[e+", "+t];return n||(n=Math.max(Math.pow(e*13.37,.9),29)*t,r[e+", "+t]=n,n)};var Uo,Xo,Gt={},kt={},zu,Vu,Cr,vi,qt,wr,_r,zt,Gr,oi,Ch,Dh,Wo,qo,Gu,Yu=function(e,t,r){r.x=t.x-e.x,r.y=t.y-e.y,r.len=Math.sqrt(r.x*r.x+r.y*r.y),r.nx=r.x/r.len,r.ny=r.y/r.len,r.ang=Math.atan2(r.ny,r.nx)},Ty=function(e,t){t.x=e.x*-1,t.y=e.y*-1,t.nx=e.nx*-1,t.ny=e.ny*-1,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},_y=function(e,t,r,n,i){if(e!==Gu?Yu(t,e,Gt):Ty(kt,Gt),Yu(t,r,kt),zu=Gt.nx*kt.ny-Gt.ny*kt.nx,Vu=Gt.nx*kt.nx-Gt.ny*-kt.ny,qt=Math.asin(Math.max(-1,Math.min(1,zu))),Math.abs(qt)<1e-6){Uo=t.x,Xo=t.y,_r=Gr=0;return}Cr=1,vi=!1,Vu<0?qt<0?qt=Math.PI+qt:(qt=Math.PI-qt,Cr=-1,vi=!0):qt>0&&(Cr=-1,vi=!0),t.radius!==void 0?Gr=t.radius:Gr=n,wr=qt/2,oi=Math.min(Gt.len/2,kt.len/2),i?(zt=Math.abs(Math.cos(wr)*Gr/Math.sin(wr)),zt>oi?(zt=oi,_r=Math.abs(zt*Math.sin(wr)/Math.cos(wr))):_r=Gr):(zt=Math.min(oi,Gr),_r=Math.abs(zt*Math.sin(wr)/Math.cos(wr))),Wo=t.x+kt.nx*zt,qo=t.y+kt.ny*zt,Uo=Wo-kt.ny*_r*Cr,Xo=qo+kt.nx*_r*Cr,Ch=t.x+Gt.nx*zt,Dh=t.y+Gt.ny*zt,Gu=t};function Nh(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function _s(e,t,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return n===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(_y(e,t,r,n,i),{cx:Uo,cy:Xo,radius:_r,startX:Ch,startY:Dh,stopX:Wo,stopY:qo,startAngle:Gt.ang+Math.PI/2*Cr,endAngle:kt.ang-Math.PI/2*Cr,counterClockwise:vi})}var In=.01,Ay=Math.sqrt(2*In),vt={};vt.findMidptPtsEtc=function(e,t){var r=t.posPts,n=t.intersectionPts,i=t.vectorNormInverse,a,o=e.pstyle("source-endpoint"),s=e.pstyle("target-endpoint"),u=o.units!=null&&s.units!=null,l=function(T,w,D,b){var _=b-w,E=D-T,A=Math.sqrt(E*E+_*_);return{x:-_/A,y:E/A}},c=e.pstyle("edge-distances").value;switch(c){case"node-position":a=r;break;case"intersection":a=n;break;case"endpoints":{if(u){var h=this.manualEndptToPx(e.source()[0],o),f=Qe(h,2),d=f[0],p=f[1],v=this.manualEndptToPx(e.target()[0],s),m=Qe(v,2),g=m[0],y=m[1],x={x1:d,y1:p,x2:g,y2:y};i=l(d,p,g,y),a=x}else Pe("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),a=n;break}}return{midptPts:a,vectorNormInverse:i}};vt.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var r=e[t],n=r._private,i=n.rscratch;if(!i.haystack){var a=Math.random()*2*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},a=Math.random()*2*Math.PI,i.target={x:Math.cos(a),y:Math.sin(a)}}var o=n.source,s=n.target,u=o.position(),l=s.position(),c=o.width(),h=s.width(),f=o.height(),d=s.height(),p=r.pstyle("haystack-radius").value,v=p/2;i.haystackPts=i.allpts=[i.source.x*c*v+u.x,i.source.y*f*v+u.y,i.target.x*h*v+l.x,i.target.y*d*v+l.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType="haystack",i.haystack=!0,this.storeEdgeProjections(r),this.calculateArrowAngles(r),this.recalculateEdgeLabelProjections(r),this.calculateLabelAngles(r)}};vt.findSegmentsPoints=function(e,t){var r=e._private.rscratch,n=e.pstyle("segment-weights"),i=e.pstyle("segment-distances"),a=e.pstyle("segment-radii"),o=e.pstyle("radius-type"),s=Math.min(n.pfValue.length,i.pfValue.length),u=a.pfValue[a.pfValue.length-1],l=o.pfValue[o.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var c=0;c<s;c++){var h=n.pfValue[c],f=i.pfValue[c],d=1-h,p=h,v=this.findMidptPtsEtc(e,t),m=v.midptPts,g=v.vectorNormInverse,y={x:m.x1*d+m.x2*p,y:m.y1*d+m.y2*p};r.segpts.push(y.x+g.x*f,y.y+g.y*f),r.radii.push(a.pfValue[c]!==void 0?a.pfValue[c]:u),r.isArcRadius.push((o.pfValue[c]!==void 0?o.pfValue[c]:l)==="arc-radius")}};vt.findLoopPoints=function(e,t,r,n){var i=e._private.rscratch,a=t.dirCounts,o=t.srcPos,s=e.pstyle("control-point-distances"),u=s?s.pfValue[0]:void 0,l=e.pstyle("loop-direction").pfValue,c=e.pstyle("loop-sweep").pfValue,h=e.pstyle("control-point-step-size").pfValue;i.edgeType="self";var f=r,d=h;n&&(f=0,d=u);var p=l-Math.PI/2,v=p-c/2,m=p+c/2,g=l+"_"+c;f=a[g]===void 0?a[g]=0:++a[g],i.ctrlpts=[o.x+Math.cos(v)*1.4*d*(f/3+1),o.y+Math.sin(v)*1.4*d*(f/3+1),o.x+Math.cos(m)*1.4*d*(f/3+1),o.y+Math.sin(m)*1.4*d*(f/3+1)]};vt.findCompoundLoopPoints=function(e,t,r,n){var i=e._private.rscratch;i.edgeType="compound";var a=t.srcPos,o=t.tgtPos,s=t.srcW,u=t.srcH,l=t.tgtW,c=t.tgtH,h=e.pstyle("control-point-step-size").pfValue,f=e.pstyle("control-point-distances"),d=f?f.pfValue[0]:void 0,p=r,v=h;n&&(p=0,v=d);var m=50,g={x:a.x-s/2,y:a.y-u/2},y={x:o.x-l/2,y:o.y-c/2},x={x:Math.min(g.x,y.x),y:Math.min(g.y,y.y)},T=.5,w=Math.max(T,Math.log(s*In)),D=Math.max(T,Math.log(l*In));i.ctrlpts=[x.x,x.y-(1+Math.pow(m,1.12)/100)*v*(p/3+1)*w,x.x-(1+Math.pow(m,1.12)/100)*v*(p/3+1)*D,x.y]};vt.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"};vt.findBezierPoints=function(e,t,r,n,i){var a=e._private.rscratch,o=e.pstyle("control-point-step-size").pfValue,s=e.pstyle("control-point-distances"),u=e.pstyle("control-point-weights"),l=s&&u?Math.min(s.value.length,u.value.length):1,c=s?s.pfValue[0]:void 0,h=u.value[0],f=n;a.edgeType=f?"multibezier":"bezier",a.ctrlpts=[];for(var d=0;d<l;d++){var p=(.5-t.eles.length/2+r)*o*(i?-1:1),v=void 0,m=hs(p);f&&(c=s?s.pfValue[d]:o,h=u.value[d]),n?v=c:v=c!==void 0?m*c:void 0;var g=v!==void 0?v:p,y=1-h,x=h,T=this.findMidptPtsEtc(e,t),w=T.midptPts,D=T.vectorNormInverse,b={x:w.x1*y+w.x2*x,y:w.y1*y+w.y2*x};a.ctrlpts.push(b.x+D.x*g,b.y+D.y*g)}};vt.findTaxiPoints=function(e,t){var r=e._private.rscratch;r.edgeType="segments";var n="vertical",i="horizontal",a="leftward",o="rightward",s="downward",u="upward",l="auto",c=t.posPts,h=t.srcW,f=t.srcH,d=t.tgtW,p=t.tgtH,v=e.pstyle("edge-distances").value,m=v!=="node-position",g=e.pstyle("taxi-direction").value,y=g,x=e.pstyle("taxi-turn"),T=x.units==="%",w=x.pfValue,D=w<0,b=e.pstyle("taxi-turn-min-distance").pfValue,_=m?(h+d)/2:0,E=m?(f+p)/2:0,A=c.x2-c.x1,C=c.y2-c.y1,N=function(k,X){return k>0?Math.max(k-X,0):Math.min(k+X,0)},S=N(A,_),M=N(C,E),R=!1;y===l?g=Math.abs(S)>Math.abs(M)?i:n:y===u||y===s?(g=n,R=!0):(y===a||y===o)&&(g=i,R=!0);var P=g===n,L=P?M:S,O=P?C:A,I=hs(O),B=!1;!(R&&(T||D))&&(y===s&&O<0||y===u&&O>0||y===a&&O>0||y===o&&O<0)&&(I*=-1,L=I*Math.abs(L),B=!0);var F;if(T){var z=w<0?1+w:w;F=z*L}else{var G=w<0?L:0;F=G+w*I}var H=function(k){return Math.abs(k)<b||Math.abs(k)>=Math.abs(L)},j=H(F),Z=H(Math.abs(L)-Math.abs(F)),Q=j||Z;if(Q&&!B)if(P){var re=Math.abs(O)<=f/2,V=Math.abs(A)<=d/2;if(re){var Y=(c.x1+c.x2)/2,U=c.y1,K=c.y2;r.segpts=[Y,U,Y,K]}else if(V){var ee=(c.y1+c.y2)/2,ie=c.x1,we=c.x2;r.segpts=[ie,ee,we,ee]}else r.segpts=[c.x1,c.y2]}else{var ye=Math.abs(O)<=h/2,xe=Math.abs(C)<=p/2;if(ye){var Me=(c.y1+c.y2)/2,te=c.x1,ue=c.x2;r.segpts=[te,Me,ue,Me]}else if(xe){var ce=(c.x1+c.x2)/2,me=c.y1,be=c.y2;r.segpts=[ce,me,ce,be]}else r.segpts=[c.x2,c.y1]}else if(P){var Ee=c.y1+F+(m?f/2*I:0),De=c.x1,Be=c.x2;r.segpts=[De,Ee,Be,Ee]}else{var Ve=c.x1+F+(m?h/2*I:0),Ie=c.y1,Se=c.y2;r.segpts=[Ve,Ie,Ve,Se]}if(r.isRound){var ae=e.pstyle("taxi-radius").value,ve=e.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(ae),r.isArcRadius=new Array(r.segpts.length/2).fill(ve)}};vt.tryToCorrectInvalidPoints=function(e,t){var r=e._private.rscratch;if(r.edgeType==="bezier"){var n=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,u=t.tgtH,l=t.srcShape,c=t.tgtShape,h=t.srcCornerRadius,f=t.tgtCornerRadius,d=t.srcRs,p=t.tgtRs,v=!ne(r.startX)||!ne(r.startY),m=!ne(r.arrowStartX)||!ne(r.arrowStartY),g=!ne(r.endX)||!ne(r.endY),y=!ne(r.arrowEndX)||!ne(r.arrowEndY),x=3,T=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth,w=x*T,D=kr({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),b=D<w,_=kr({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),E=_<w,A=!1;if(v||m||b){A=!0;var C={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},N=Math.sqrt(C.x*C.x+C.y*C.y),S={x:C.x/N,y:C.y/N},M=Math.max(a,o),R={x:r.ctrlpts[0]+S.x*2*M,y:r.ctrlpts[1]+S.y*2*M},P=l.intersectLine(n.x,n.y,a,o,R.x,R.y,0,h,d);b?(r.ctrlpts[0]=r.ctrlpts[0]+S.x*(w-D),r.ctrlpts[1]=r.ctrlpts[1]+S.y*(w-D)):(r.ctrlpts[0]=P[0]+S.x*w,r.ctrlpts[1]=P[1]+S.y*w)}if(g||y||E){A=!0;var L={x:r.ctrlpts[0]-i.x,y:r.ctrlpts[1]-i.y},O=Math.sqrt(L.x*L.x+L.y*L.y),I={x:L.x/O,y:L.y/O},B=Math.max(a,o),F={x:r.ctrlpts[0]+I.x*2*B,y:r.ctrlpts[1]+I.y*2*B},z=c.intersectLine(i.x,i.y,s,u,F.x,F.y,0,f,p);E?(r.ctrlpts[0]=r.ctrlpts[0]+I.x*(w-_),r.ctrlpts[1]=r.ctrlpts[1]+I.y*(w-_)):(r.ctrlpts[0]=z[0]+I.x*w,r.ctrlpts[1]=z[1]+I.y*w)}A&&this.findEndpoints(e)}};vt.storeAllpts=function(e){var t=e._private.rscratch;if(t.edgeType==="multibezier"||t.edgeType==="bezier"||t.edgeType==="self"||t.edgeType==="compound"){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var r=0;r+1<t.ctrlpts.length;r+=2)t.allpts.push(t.ctrlpts[r],t.ctrlpts[r+1]),r+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[r]+t.ctrlpts[r+2])/2,(t.ctrlpts[r+1]+t.ctrlpts[r+3])/2);t.allpts.push(t.endX,t.endY);var n,i;t.ctrlpts.length/2%2===0?(n=t.allpts.length/2-1,t.midX=t.allpts[n],t.midY=t.allpts[n+1]):(n=t.allpts.length/2-3,i=.5,t.midX=at(t.allpts[n],t.allpts[n+2],t.allpts[n+4],i),t.midY=at(t.allpts[n+1],t.allpts[n+3],t.allpts[n+5],i))}else if(t.edgeType==="straight")t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if(t.edgeType==="segments"){if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.isRound){t.roundCorners=[];for(var a=2;a+3<t.allpts.length;a+=2){var o=t.radii[a/2-1],s=t.isArcRadius[a/2-1];t.roundCorners.push(_s({x:t.allpts[a-2],y:t.allpts[a-1]},{x:t.allpts[a],y:t.allpts[a+1],radius:o},{x:t.allpts[a+2],y:t.allpts[a+3]},o,s))}}if(t.segpts.length%4===0){var u=t.segpts.length/2,l=u-2;t.midX=(t.segpts[l]+t.segpts[u])/2,t.midY=(t.segpts[l+1]+t.segpts[u+1])/2}else{var c=t.segpts.length/2-1;if(!t.isRound)t.midX=t.segpts[c],t.midY=t.segpts[c+1];else{var h={x:t.segpts[c],y:t.segpts[c+1]},f=t.roundCorners[c/2];if(f.radius===0){var d={x:t.segpts[c+2],y:t.segpts[c+3]};t.midX=h.x,t.midY=h.y,t.midVector=[h.y-d.y,d.x-h.x]}else{var p=[h.x-f.cx,h.y-f.cy],v=f.radius/Math.sqrt(Math.pow(p[0],2)+Math.pow(p[1],2));p=p.map(function(m){return m*v}),t.midX=f.cx+p[0],t.midY=f.cy+p[1],t.midVector=p}}}}};vt.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||ne(t.startX)&&ne(t.startY)&&ne(t.endX)&&ne(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,Pe("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))};vt.findEdgeControlPoints=function(e){var t=this;if(!(!e||e.length===0)){for(var r=this,n=r.cy,i=n.hasCompoundNodes(),a=new jt,o=function(_,E){return[].concat(wi(_),[E?1:0]).join("-")},s=[],u=[],l=0;l<e.length;l++){var c=e[l],h=c._private,f=c.pstyle("curve-style").value;if(!(c.removed()||!c.takesUpSpace())){if(f==="haystack"){u.push(c);continue}var d=f==="unbundled-bezier"||nr(f,"segments")||f==="straight"||f==="straight-triangle"||nr(f,"taxi"),p=f==="unbundled-bezier"||f==="bezier",v=h.source,m=h.target,g=v.poolIndex(),y=m.poolIndex(),x=[g,y].sort(),T=o(x,d),w=a.get(T);w==null&&(w={eles:[]},s.push({pairId:x,edgeIsUnbundled:d}),a.set(T,w)),w.eles.push(c),d&&(w.hasUnbundled=!0),p&&(w.hasBezier=!0)}}for(var D=function(){var _=s[b],E=_.pairId,A=_.edgeIsUnbundled,C=o(E,A),N=a.get(C),S;if(!N.hasUnbundled){var M=N.eles[0].parallelEdges().filter(function(ae){return ae.isBundledBezier()});us(N.eles),M.forEach(function(ae){return N.eles.push(ae)}),N.eles.sort(function(ae,ve){return ae.poolIndex()-ve.poolIndex()})}var R=N.eles[0],P=R.source(),L=R.target();if(P.poolIndex()>L.poolIndex()){var O=P;P=L,L=O}var I=N.srcPos=P.position(),B=N.tgtPos=L.position(),F=N.srcW=P.outerWidth(),z=N.srcH=P.outerHeight(),G=N.tgtW=L.outerWidth(),H=N.tgtH=L.outerHeight(),j=N.srcShape=r.nodeShapes[t.getNodeShape(P)],Z=N.tgtShape=r.nodeShapes[t.getNodeShape(L)],Q=N.srcCornerRadius=P.pstyle("corner-radius").value==="auto"?"auto":P.pstyle("corner-radius").pfValue,re=N.tgtCornerRadius=L.pstyle("corner-radius").value==="auto"?"auto":L.pstyle("corner-radius").pfValue,V=N.tgtRs=L._private.rscratch,Y=N.srcRs=P._private.rscratch;N.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var U=0;U<N.eles.length;U++){var K=N.eles[U],ee=K[0]._private.rscratch,ie=K.pstyle("curve-style").value,we=ie==="unbundled-bezier"||nr(ie,"segments")||nr(ie,"taxi"),ye=!P.same(K.source());if(!N.calculatedIntersection&&P!==L&&(N.hasBezier||N.hasUnbundled)){N.calculatedIntersection=!0;var xe=j.intersectLine(I.x,I.y,F,z,B.x,B.y,0,Q,Y),Me=N.srcIntn=xe,te=Z.intersectLine(B.x,B.y,G,H,I.x,I.y,0,re,V),ue=N.tgtIntn=te,ce=N.intersectionPts={x1:xe[0],x2:te[0],y1:xe[1],y2:te[1]},me=N.posPts={x1:I.x,x2:B.x,y1:I.y,y2:B.y},be=te[1]-xe[1],Ee=te[0]-xe[0],De=Math.sqrt(Ee*Ee+be*be);ne(De)&&De>=Ay||(De=Math.sqrt(Math.max(Ee*Ee,In)+Math.max(be*be,In)));var Be=N.vector={x:Ee,y:be},Ve=N.vectorNorm={x:Be.x/De,y:Be.y/De},Ie={x:-Ve.y,y:Ve.x};N.nodesOverlap=!ne(De)||Z.checkPoint(xe[0],xe[1],0,G,H,B.x,B.y,re,V)||j.checkPoint(te[0],te[1],0,F,z,I.x,I.y,Q,Y),N.vectorNormInverse=Ie,S={nodesOverlap:N.nodesOverlap,dirCounts:N.dirCounts,calculatedIntersection:!0,hasBezier:N.hasBezier,hasUnbundled:N.hasUnbundled,eles:N.eles,srcPos:B,srcRs:V,tgtPos:I,tgtRs:Y,srcW:G,srcH:H,tgtW:F,tgtH:z,srcIntn:ue,tgtIntn:Me,srcShape:Z,tgtShape:j,posPts:{x1:me.x2,y1:me.y2,x2:me.x1,y2:me.y1},intersectionPts:{x1:ce.x2,y1:ce.y2,x2:ce.x1,y2:ce.y1},vector:{x:-Be.x,y:-Be.y},vectorNorm:{x:-Ve.x,y:-Ve.y},vectorNormInverse:{x:-Ie.x,y:-Ie.y}}}var Se=ye?S:N;ee.nodesOverlap=Se.nodesOverlap,ee.srcIntn=Se.srcIntn,ee.tgtIntn=Se.tgtIntn,ee.isRound=ie.startsWith("round"),i&&(P.isParent()||P.isChild()||L.isParent()||L.isChild())&&(P.parents().anySame(L)||L.parents().anySame(P)||P.same(L)&&P.isParent())?t.findCompoundLoopPoints(K,Se,U,we):P===L?t.findLoopPoints(K,Se,U,we):ie.endsWith("segments")?t.findSegmentsPoints(K,Se):ie.endsWith("taxi")?t.findTaxiPoints(K,Se):ie==="straight"||!we&&N.eles.length%2===1&&U===Math.floor(N.eles.length/2)?t.findStraightEdgePoints(K):t.findBezierPoints(K,Se,U,we,ye),t.findEndpoints(K),t.tryToCorrectInvalidPoints(K,Se),t.checkForInvalidEdgeWarning(K),t.storeAllpts(K),t.storeEdgeProjections(K),t.calculateArrowAngles(K),t.recalculateEdgeLabelProjections(K),t.calculateLabelAngles(K)}},b=0;b<s.length;b++)D();this.findHaystackPoints(u)}};function kh(e){var t=[];if(e!=null){for(var r=0;r<e.length;r+=2){var n=e[r],i=e[r+1];t.push({x:n,y:i})}return t}}vt.getSegmentPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var r=t.edgeType;if(r==="segments")return kh(t.segpts)};vt.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var r=t.edgeType;if(r==="bezier"||r==="multibezier"||r==="self"||r==="compound")return kh(t.ctrlpts)};vt.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var Un={};Un.manualEndptToPx=function(e,t){var r=this,n=e.position(),i=e.outerWidth(),a=e.outerHeight(),o=e._private.rscratch;if(t.value.length===2){var s=[t.pfValue[0],t.pfValue[1]];return t.units[0]==="%"&&(s[0]=s[0]*i),t.units[1]==="%"&&(s[1]=s[1]*a),s[0]+=n.x,s[1]+=n.y,s}else{var u=t.pfValue[0];u=-Math.PI/2+u;var l=2*Math.max(i,a),c=[n.x+Math.cos(u)*l,n.y+Math.sin(u)*l];return r.nodeShapes[this.getNodeShape(e)].intersectLine(n.x,n.y,i,a,c[0],c[1],0,e.pstyle("corner-radius").value==="auto"?"auto":e.pstyle("corner-radius").pfValue,o)}};Un.findEndpoints=function(e){var t,r,n,i,a=this,o,s=e.source()[0],u=e.target()[0],l=s.position(),c=u.position(),h=e.pstyle("target-arrow-shape").value,f=e.pstyle("source-arrow-shape").value,d=e.pstyle("target-distance-from-node").pfValue,p=e.pstyle("source-distance-from-node").pfValue,v=s._private.rscratch,m=u._private.rscratch,g=e.pstyle("curve-style").value,y=e._private.rscratch,x=y.edgeType,T=nr(g,"taxi"),w=x==="self"||x==="compound",D=x==="bezier"||x==="multibezier"||w,b=x!=="bezier",_=x==="straight"||x==="segments",E=x==="segments",A=D||b||_,C=w||T,N=e.pstyle("source-endpoint"),S=C?"outside-to-node":N.value,M=s.pstyle("corner-radius").value==="auto"?"auto":s.pstyle("corner-radius").pfValue,R=e.pstyle("target-endpoint"),P=C?"outside-to-node":R.value,L=u.pstyle("corner-radius").value==="auto"?"auto":u.pstyle("corner-radius").pfValue;y.srcManEndpt=N,y.tgtManEndpt=R;var O,I,B,F,z=(t=(R==null||(r=R.pfValue)===null||r===void 0?void 0:r.length)===2?R.pfValue:null)!==null&&t!==void 0?t:[0,0],G=(n=(N==null||(i=N.pfValue)===null||i===void 0?void 0:i.length)===2?N.pfValue:null)!==null&&n!==void 0?n:[0,0];if(D){var H=[y.ctrlpts[0],y.ctrlpts[1]],j=b?[y.ctrlpts[y.ctrlpts.length-2],y.ctrlpts[y.ctrlpts.length-1]]:H;O=j,I=H}else if(_){var Z=E?y.segpts.slice(0,2):[c.x+z[0],c.y+z[1]],Q=E?y.segpts.slice(y.segpts.length-2):[l.x+G[0],l.y+G[1]];O=Q,I=Z}if(P==="inside-to-node")o=[c.x,c.y];else if(R.units)o=this.manualEndptToPx(u,R);else if(P==="outside-to-line")o=y.tgtIntn;else if(P==="outside-to-node"||P==="outside-to-node-or-label"?B=O:(P==="outside-to-line"||P==="outside-to-line-or-label")&&(B=[l.x,l.y]),o=a.nodeShapes[this.getNodeShape(u)].intersectLine(c.x,c.y,u.outerWidth(),u.outerHeight(),B[0],B[1],0,L,m),P==="outside-to-node-or-label"||P==="outside-to-line-or-label"){var re=u._private.rscratch,V=re.labelWidth,Y=re.labelHeight,U=re.labelX,K=re.labelY,ee=V/2,ie=Y/2,we=u.pstyle("text-valign").value;we==="top"?K-=ie:we==="bottom"&&(K+=ie);var ye=u.pstyle("text-halign").value;ye==="left"?U-=ee:ye==="right"&&(U+=ee);var xe=Nn(B[0],B[1],[U-ee,K-ie,U+ee,K-ie,U+ee,K+ie,U-ee,K+ie],c.x,c.y);if(xe.length>0){var Me=l,te=Tr(Me,qr(o)),ue=Tr(Me,qr(xe)),ce=te;if(ue<te&&(o=xe,ce=ue),xe.length>2){var me=Tr(Me,{x:xe[2],y:xe[3]});me<ce&&(o=[xe[2],xe[3]])}}}var be=Jn(o,O,a.arrowShapes[h].spacing(e)+d),Ee=Jn(o,O,a.arrowShapes[h].gap(e)+d);if(y.endX=Ee[0],y.endY=Ee[1],y.arrowEndX=be[0],y.arrowEndY=be[1],S==="inside-to-node")o=[l.x,l.y];else if(N.units)o=this.manualEndptToPx(s,N);else if(S==="outside-to-line")o=y.srcIntn;else if(S==="outside-to-node"||S==="outside-to-node-or-label"?F=I:(S==="outside-to-line"||S==="outside-to-line-or-label")&&(F=[c.x,c.y]),o=a.nodeShapes[this.getNodeShape(s)].intersectLine(l.x,l.y,s.outerWidth(),s.outerHeight(),F[0],F[1],0,M,v),S==="outside-to-node-or-label"||S==="outside-to-line-or-label"){var De=s._private.rscratch,Be=De.labelWidth,Ve=De.labelHeight,Ie=De.labelX,Se=De.labelY,ae=Be/2,ve=Ve/2,k=s.pstyle("text-valign").value;k==="top"?Se-=ve:k==="bottom"&&(Se+=ve);var X=s.pstyle("text-halign").value;X==="left"?Ie-=ae:X==="right"&&(Ie+=ae);var W=Nn(F[0],F[1],[Ie-ae,Se-ve,Ie+ae,Se-ve,Ie+ae,Se+ve,Ie-ae,Se+ve],l.x,l.y);if(W.length>0){var q=c,$=Tr(q,qr(o)),oe=Tr(q,qr(W)),J=$;if(oe<$&&(o=[W[0],W[1]],J=oe),W.length>2){var he=Tr(q,{x:W[2],y:W[3]});he<J&&(o=[W[2],W[3]])}}}var le=Jn(o,I,a.arrowShapes[f].spacing(e)+p),pe=Jn(o,I,a.arrowShapes[f].gap(e)+p);y.startX=pe[0],y.startY=pe[1],y.arrowStartX=le[0],y.arrowStartY=le[1],A&&(!ne(y.startX)||!ne(y.startY)||!ne(y.endX)||!ne(y.endY)?y.badLine=!0:y.badLine=!1)};Un.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[0],y:t.haystackPts[1]};default:return{x:t.arrowStartX,y:t.arrowStartY}}};Un.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[2],y:t.haystackPts[3]};default:return{x:t.arrowEndX,y:t.arrowEndY}}};var As={};function Cy(e,t,r){for(var n=function(u,l,c,h){return at(u,l,c,h)},i=t._private,a=i.rstyle.bezierPts,o=0;o<e.bezierProjPcts.length;o++){var s=e.bezierProjPcts[o];a.push({x:n(r[0],r[2],r[4],s),y:n(r[1],r[3],r[5],s)})}}As.storeEdgeProjections=function(e){var t=e._private,r=t.rscratch,n=r.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,n==="multibezier"||n==="bezier"||n==="self"||n==="compound"){t.rstyle.bezierPts=[];for(var i=0;i+5<r.allpts.length;i+=4)Cy(this,e,r.allpts.slice(i,i+6))}else if(n==="segments")for(var a=t.rstyle.linePts=[],i=0;i+1<r.allpts.length;i+=2)a.push({x:r.allpts[i],y:r.allpts[i+1]});else if(n==="haystack"){var o=r.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth};As.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var Xt={};Xt.recalculateNodeLabelProjection=function(e){var t=e.pstyle("label").strValue;if(!lr(t)){var r,n,i=e._private,a=e.width(),o=e.height(),s=e.padding(),u=e.position(),l=e.pstyle("text-halign").strValue,c=e.pstyle("text-valign").strValue,h=i.rscratch,f=i.rstyle;switch(l){case"left":r=u.x-a/2-s;break;case"right":r=u.x+a/2+s;break;default:r=u.x}switch(c){case"top":n=u.y-o/2-s;break;case"bottom":n=u.y+o/2+s;break;default:n=u.y}h.labelX=r,h.labelY=n,f.labelX=r,f.labelY=n,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var Mh=function(e,t){var r=Math.atan(t/e);return e===0&&r<0&&(r=r*-1),r},Sh=function(e,t){var r=t.x-e.x,n=t.y-e.y;return Mh(r,n)},Dy=function(e,t,r,n){var i=Dn(0,n-.001,1),a=Dn(0,n+.001,1),o=$r(e,t,r,i),s=$r(e,t,r,a);return Sh(o,s)};Xt.recalculateEdgeLabelProjections=function(e){var t,r=e._private,n=r.rscratch,i=this,a={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(a.mid||a.source||a.target){t={x:n.midX,y:n.midY};var o=function(c,h,f){Ht(r.rscratch,c,h,f),Ht(r.rstyle,c,h,f)};o("labelX",null,t.x),o("labelY",null,t.y);var s=Mh(n.midDispX,n.midDispY);o("labelAutoAngle",null,s);var u=function(){if(u.cache)return u.cache;for(var c=[],h=0;h+5<n.allpts.length;h+=4){var f={x:n.allpts[h],y:n.allpts[h+1]},d={x:n.allpts[h+2],y:n.allpts[h+3]},p={x:n.allpts[h+4],y:n.allpts[h+5]};c.push({p0:f,p1:d,p2:p,startDist:0,length:0,segments:[]})}var v=r.rstyle.bezierPts,m=i.bezierProjPcts.length;function g(D,b,_,E,A){var C=kr(b,_),N=D.segments[D.segments.length-1],S={p0:b,p1:_,t0:E,t1:A,startDist:N?N.startDist+N.length:0,length:C};D.segments.push(S),D.length+=C}for(var y=0;y<c.length;y++){var x=c[y],T=c[y-1];T&&(x.startDist=T.startDist+T.length),g(x,x.p0,v[y*m],0,i.bezierProjPcts[0]);for(var w=0;w<m-1;w++)g(x,v[y*m+w],v[y*m+w+1],i.bezierProjPcts[w],i.bezierProjPcts[w+1]);g(x,v[y*m+m-1],x.p2,i.bezierProjPcts[m-1],1)}return u.cache=c},l=function(c){var h,f=c==="source";if(a[c]){var d=e.pstyle(c+"-text-offset").pfValue;switch(n.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var p=u(),v,m=0,g=0,y=0;y<p.length;y++){for(var x=p[f?y:p.length-1-y],T=0;T<x.segments.length;T++){var w=x.segments[f?T:x.segments.length-1-T],D=y===p.length-1&&T===x.segments.length-1;if(m=g,g+=w.length,g>=d||D){v={cp:x,segment:w};break}}if(v)break}var b=v.cp,_=v.segment,E=(d-m)/_.length,A=_.t1-_.t0,C=f?_.t0+A*E:_.t1-A*E;C=Dn(0,C,1),t=$r(b.p0,b.p1,b.p2,C),h=Dy(b.p0,b.p1,b.p2,C);break}case"straight":case"segments":case"haystack":{for(var N=0,S,M,R,P,L=n.allpts.length,O=0;O+3<L&&(f?(R={x:n.allpts[O],y:n.allpts[O+1]},P={x:n.allpts[O+2],y:n.allpts[O+3]}):(R={x:n.allpts[L-2-O],y:n.allpts[L-1-O]},P={x:n.allpts[L-4-O],y:n.allpts[L-3-O]}),S=kr(R,P),M=N,N+=S,!(N>=d));O+=2);var I=d-M,B=I/S;B=Dn(0,B,1),t=$f(R,P,B),h=Sh(R,P);break}}o("labelX",c,t.x),o("labelY",c,t.y),o("labelAutoAngle",c,h)}};l("source"),l("target"),this.applyLabelDimensions(e)}};Xt.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))};Xt.applyPrefixedLabelDimensions=function(e,t){var r=e._private,n=this.getLabelText(e,t),i=Nr(n,e._private.labelDimsKey);if(_t(r.rscratch,"prefixedLabelDimsKey",t)!==i){Ht(r.rscratch,"prefixedLabelDimsKey",t,i);var a=this.calculateLabelDimensions(e,n),o=e.pstyle("line-height").pfValue,s=e.pstyle("text-wrap").strValue,u=_t(r.rscratch,"labelWrapCachedLines",t)||[],l=s!=="wrap"?1:Math.max(u.length,1),c=a.height/l,h=c*o,f=a.width,d=a.height+(l-1)*(o-1)*c;Ht(r.rstyle,"labelWidth",t,f),Ht(r.rscratch,"labelWidth",t,f),Ht(r.rstyle,"labelHeight",t,d),Ht(r.rscratch,"labelHeight",t,d),Ht(r.rscratch,"labelLineHeight",t,h)}};Xt.getLabelText=function(e,t){var r=e._private,n=t?t+"-":"",i=e.pstyle(n+"label").strValue,a=e.pstyle("text-transform").value,o=function(z,G){return G?(Ht(r.rscratch,z,t,G),G):_t(r.rscratch,z,t)};if(!i)return"";a=="none"||(a=="uppercase"?i=i.toUpperCase():a=="lowercase"&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if(s==="wrap"){var u=o("labelKey");if(u!=null&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var l="",c=i.split(`
|
|
15
|
-
`),h=e.pstyle("text-max-width").pfValue,f=e.pstyle("text-overflow-wrap").value,d=f==="anywhere",p=[],v=/[\s\u200b]+|$/g,m=0;m<c.length;m++){var g=c[m],y=this.calculateLabelDimensions(e,g),x=y.width;if(d){var T=g.split("").join(l);g=T}if(x>h){var w=g.matchAll(v),D="",b=0,_=Ct(w),E;try{for(_.s();!(E=_.n()).done;){var A=E.value,C=A[0],N=g.substring(b,A.index);b=A.index+C.length;var S=D.length===0?N:D+N+C,M=this.calculateLabelDimensions(e,S),R=M.width;R<=h?D+=N+C:(D&&p.push(D),D=N+C)}}catch(z){_.e(z)}finally{_.f()}D.match(/^[\s\u200b]+$/)||p.push(D)}else p.push(g)}o("labelWrapCachedLines",p),i=o("labelWrapCachedText",p.join(`
|
|
16
|
-
`)),o("labelWrapKey",u)}else if(s==="ellipsis"){var P=e.pstyle("text-max-width").pfValue,L="",O="…",I=!1;if(this.calculateLabelDimensions(e,i).width<P)return i;for(var B=0;B<i.length;B++){var F=this.calculateLabelDimensions(e,L+i[B]+O).width;if(F>P)break;L+=i[B],B===i.length-1&&(I=!0)}return I||(L+=O),L}return i};Xt.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,r=e.pstyle("text-halign").strValue;if(t==="auto")if(e.isNode())switch(r){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return t};Xt.calculateLabelDimensions=function(e,t){var r=this,n=r.cy.window(),i=n.document,a=0,o=e.pstyle("font-style").strValue,s=e.pstyle("font-size").pfValue,u=e.pstyle("font-family").strValue,l=e.pstyle("font-weight").strValue,c=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!c){c=this.labelCalcCanvas=i.createElement("canvas"),h=this.labelCalcCanvasContext=c.getContext("2d");var f=c.style;f.position="absolute",f.left="-9999px",f.top="-9999px",f.zIndex="-1",f.visibility="hidden",f.pointerEvents="none"}h.font="".concat(o," ").concat(l," ").concat(s,"px ").concat(u);for(var d=0,p=0,v=t.split(`
|
|
17
|
-
`),m=0;m<v.length;m++){var g=v[m],y=h.measureText(g),x=Math.ceil(y.width),T=s;d=Math.max(x,d),p+=T}return d+=a,p+=a,{width:d,height:p}};Xt.calculateLabelAngle=function(e,t){var r=e._private,n=r.rscratch,i=e.isEdge(),a=t?t+"-":"",o=e.pstyle(a+"text-rotation"),s=o.strValue;return s==="none"?0:i&&s==="autorotate"?n.labelAutoAngle:s==="autorotate"?0:o.pfValue};Xt.calculateLabelAngles=function(e){var t=this,r=e.isEdge(),n=e._private,i=n.rscratch;i.labelAngle=t.calculateLabelAngle(e),r&&(i.sourceLabelAngle=t.calculateLabelAngle(e,"source"),i.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var Lh={},Uu=28,Xu=!1;Lh.getNodeShape=function(e){var t=this,r=e.pstyle("shape").value;if(r==="cutrectangle"&&(e.width()<Uu||e.height()<Uu))return Xu||(Pe("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Xu=!0),"rectangle";if(e.isParent())return r==="rectangle"||r==="roundrectangle"||r==="round-rectangle"||r==="cutrectangle"||r==="cut-rectangle"||r==="barrel"?r:"rectangle";if(r==="polygon"){var n=e.pstyle("shape-polygon-points").value;return t.nodeShapes.makePolygon(n).name}return r};var Ki={};Ki.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),r=this,n=function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(a),o)for(var s=0;s<a.length;s++){var u=a[s],l=u._private,c=l.rstyle;c.clean=!1,c.cleanConnected=!1}};r.binder(e).on("bounds.* dirty.*",function(a){var o=a.target;n(o)}).on("style.* background.*",function(a){var o=a.target;n(o,!1)});var i=function(a){if(a){var o=r.onUpdateEleCalcsFns;t.cleanStyle();for(var s=0;s<t.length;s++){var u=t[s],l=u._private.rstyle;u.isNode()&&!l.cleanConnected&&(n(u.connectedEdges()),l.cleanConnected=!0)}if(o)for(var c=0;c<o.length;c++){var h=o[c];h(a,t)}r.recalculateRenderedStyle(t),t=e.collection()}};r.flushRenderedStyleQueue=function(){i(!0)},r.beforeRender(i,r.beforeRenderPriorities.eleCalcs)};Ki.onUpdateEleCalcs=function(e){var t=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];t.push(e)};Ki.recalculateRenderedStyle=function(e,t){var r=function(x){return x._private.rstyle.cleanConnected};if(e.length!==0){var n=[],i=[];if(!this.destroyed){t===void 0&&(t=!0);for(var a=0;a<e.length;a++){var o=e[a],s=o._private,u=s.rstyle;o.isEdge()&&(!r(o.source())||!r(o.target()))&&(u.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(x){return!x._private.rstyle.clean&&x.isBundledBezier()})&&(u.clean=!1),!(t&&u.clean||o.removed())&&o.pstyle("display").value!=="none"&&(s.group==="nodes"?i.push(o):n.push(o),u.clean=!0)}for(var l=0;l<i.length;l++){var c=i[l],h=c._private,f=h.rstyle,d=c.position();this.recalculateNodeLabelProjection(c),f.nodeX=d.x,f.nodeY=d.y,f.nodeW=c.pstyle("width").pfValue,f.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(var p=0;p<n.length;p++){var v=n[p],m=v._private,g=m.rstyle,y=m.rscratch;g.srcX=y.arrowStartX,g.srcY=y.arrowStartY,g.tgtX=y.arrowEndX,g.tgtY=y.arrowEndY,g.midX=y.midX,g.midY=y.midY,g.labelAngle=y.labelAngle,g.sourceLabelAngle=y.sourceLabelAngle,g.targetLabelAngle=y.targetLabelAngle}}}};var Qi={};Qi.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],r=0;r<e.length;r++){var n=e[r],i=n._private.rscratch;n.grabbed()&&!n.isParent()?t.push(n):i.inDragLayer?e.drag.push(n):e.nondrag.push(n)}for(var r=0;r<t.length;r++){var n=t[r];e.drag.push(n)}}};Qi.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};Qi.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(fh),t.interactive=t.filter(function(r){return r.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var Ih={};[Or,Si,vt,Un,As,Xt,Lh,Ki,Qi].forEach(function(e){ge(Ih,e)});var Oh={};Oh.getCachedImage=function(e,t,r){var n=this,i=n.imageCache=n.imageCache||{},a=i[e];if(a)return a.image.complete||a.image.addEventListener("load",r),a.image;a=i[e]=i[e]||{};var o=a.image=new Image;o.addEventListener("load",r),o.addEventListener("error",function(){o.error=!0});var s="data:",u=e.substring(0,s.length).toLowerCase()===s;return u||(t=t==="null"?null:t,o.crossOrigin=t),o.src=e,o};var sn={};sn.registerBinding=function(e,t,r,n){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var a=[],o=0;o<e.length;o++){var s=e[o];if(s!==void 0){var u=this.binder(s);a.push(u.on.apply(u,i))}}return a}var u=this.binder(e);return u.on.apply(u,i)};sn.binder=function(e){var t=this,r=t.cy.window(),n=e===r||e===r.document||e===r.document.body||Fd(e);if(t.supportsPassiveEvents==null){var i=!1;try{var a=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});r.addEventListener("test",null,a)}catch{}t.supportsPassiveEvents=i}var o=function(s,u,l){var c=Array.prototype.slice.call(arguments);return n&&t.supportsPassiveEvents&&(c[2]={capture:l??!1,passive:!1,once:!1}),t.bindings.push({target:e,args:c}),(e.addEventListener||e.on).apply(e,c),this};return{on:o,addEventListener:o,addListener:o,bind:o}};sn.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()};sn.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()};sn.load=function(){var e=this,t=e.cy.window(),r=function(k){return k.selected()},n=function(k){var X=k.getRootNode();if(X&&X.nodeType===11&&X.host!==void 0)return X},i=function(k,X,W,q){k==null&&(k=e.cy);for(var $=0;$<X.length;$++){var oe=X[$];k.emit({originalEvent:W,type:oe,position:q})}},a=function(k){return k.shiftKey||k.metaKey||k.ctrlKey},o=function(k,X){var W=!0;if(e.cy.hasCompoundNodes()&&k&&k.pannable())for(var q=0;X&&q<X.length;q++){var k=X[q];if(k.isNode()&&k.isParent()&&!k.pannable()){W=!1;break}}else W=!0;return W},s=function(k){k[0]._private.grabbed=!0},u=function(k){k[0]._private.grabbed=!1},l=function(k){k[0]._private.rscratch.inDragLayer=!0},c=function(k){k[0]._private.rscratch.inDragLayer=!1},h=function(k){k[0]._private.rscratch.isGrabTarget=!0},f=function(k){k[0]._private.rscratch.isGrabTarget=!1},d=function(k,X){var W=X.addToList,q=W.has(k);!q&&k.grabbable()&&!k.locked()&&(W.merge(k),s(k))},p=function(k,X){if(k.cy().hasCompoundNodes()&&!(X.inDragLayer==null&&X.addToList==null)){var W=k.descendants();X.inDragLayer&&(W.forEach(l),W.connectedEdges().forEach(l)),X.addToList&&d(W,X)}},v=function(k,X){X=X||{};var W=k.cy().hasCompoundNodes();X.inDragLayer&&(k.forEach(l),k.neighborhood().stdFilter(function(q){return!W||q.isEdge()}).forEach(l)),X.addToList&&k.forEach(function(q){d(q,X)}),p(k,X),y(k,{inDragLayer:X.inDragLayer}),e.updateCachedGrabbedEles()},m=v,g=function(k){k&&(e.getCachedZSortedEles().forEach(function(X){u(X),c(X),f(X)}),e.updateCachedGrabbedEles())},y=function(k,X){if(!(X.inDragLayer==null&&X.addToList==null)&&k.cy().hasCompoundNodes()){var W=k.ancestors().orphans();if(!W.same(k)){var q=W.descendants().spawnSelf().merge(W).unmerge(k).unmerge(k.descendants()),$=q.connectedEdges();X.inDragLayer&&($.forEach(l),q.forEach(l)),X.addToList&&q.forEach(function(oe){d(oe,X)})}}},x=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},T=typeof MutationObserver<"u",w=typeof ResizeObserver<"u";T?(e.removeObserver=new MutationObserver(function(k){for(var X=0;X<k.length;X++){var W=k[X],q=W.removedNodes;if(q)for(var $=0;$<q.length;$++){var oe=q[$];if(oe===e.container){e.destroy();break}}}}),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",function(k){e.destroy()});var D=zn(function(){e.cy.resize()},100);T&&(e.styleObserver=new MutationObserver(D),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,"resize",D),w&&(e.resizeObserver=new ResizeObserver(D),e.resizeObserver.observe(e.container));var b=function(k,X){for(;k!=null;)X(k),k=k.parentNode},_=function(){e.invalidateContainerClientCoordsCache()};b(e.container,function(k){e.registerBinding(k,"transitionend",_),e.registerBinding(k,"animationend",_),e.registerBinding(k,"scroll",_)}),e.registerBinding(e.container,"contextmenu",function(k){k.preventDefault()});var E=function(){return e.selection[4]!==0},A=function(k){for(var X=e.findContainerClientCoords(),W=X[0],q=X[1],$=X[2],oe=X[3],J=k.touches?k.touches:[k],he=!1,le=0;le<J.length;le++){var pe=J[le];if(W<=pe.clientX&&pe.clientX<=W+$&&q<=pe.clientY&&pe.clientY<=q+oe){he=!0;break}}if(!he)return!1;for(var Ce=e.container,Te=k.target,de=Te.parentNode,_e=!1;de;){if(de===Ce){_e=!0;break}de=de.parentNode}return!!_e};e.registerBinding(e.container,"mousedown",function(k){if(A(k)&&!(e.hoverData.which===1&&k.which!==1)){k.preventDefault(),x(),e.hoverData.capture=!0,e.hoverData.which=k.which;var X=e.cy,W=[k.clientX,k.clientY],q=e.projectIntoViewport(W[0],W[1]),$=e.selection,oe=e.findNearestElements(q[0],q[1],!0,!1),J=oe[0],he=e.dragData.possibleDragElements;e.hoverData.mdownPos=q,e.hoverData.mdownGPos=W;var le=function(_e){return{originalEvent:k,type:_e,position:{x:q[0],y:q[1]}}},pe=function(){e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout(function(){if(!e.hoverData.tapholdCancelled){var _e=e.hoverData.down;_e?_e.emit(le("taphold")):X.emit(le("taphold"))}},e.tapholdDuration)};if(k.which==3){e.hoverData.cxtStarted=!0;var Ce={originalEvent:k,type:"cxttapstart",position:{x:q[0],y:q[1]}};J?(J.activate(),J.emit(Ce),e.hoverData.down=J):X.emit(Ce),e.hoverData.downTime=new Date().getTime(),e.hoverData.cxtDragged=!1}else if(k.which==1){J&&J.activate();{if(J!=null&&e.nodeIsGrabbable(J)){var Te=function(_e){_e.emit(le("grab"))};if(h(J),!J.selected())he=e.dragData.possibleDragElements=X.collection(),m(J,{addToList:he}),J.emit(le("grabon")).emit(le("grab"));else{he=e.dragData.possibleDragElements=X.collection();var de=X.$(function(_e){return _e.isNode()&&_e.selected()&&e.nodeIsGrabbable(_e)});v(de,{addToList:he}),J.emit(le("grabon")),de.forEach(Te)}e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=J,e.hoverData.downs=oe,e.hoverData.downTime=new Date().getTime()}i(J,["mousedown","tapstart","vmousedown"],k,{x:q[0],y:q[1]}),J==null?($[4]=1,e.data.bgActivePosistion={x:q[0],y:q[1]},e.redrawHint("select",!0),e.redraw()):J.pannable()&&($[4]=1),pe()}$[0]=$[2]=q[0],$[1]=$[3]=q[1]}},!1);var C=n(e.container);e.registerBinding([t,C],"mousemove",function(k){var X=e.hoverData.capture;if(!(!X&&!A(k))){var W=!1,q=e.cy,$=q.zoom(),oe=[k.clientX,k.clientY],J=e.projectIntoViewport(oe[0],oe[1]),he=e.hoverData.mdownPos,le=e.hoverData.mdownGPos,pe=e.selection,Ce=null;!e.hoverData.draggingEles&&!e.hoverData.dragging&&!e.hoverData.selecting&&(Ce=e.findNearestElement(J[0],J[1],!0,!1));var Te=e.hoverData.last,de=e.hoverData.down,_e=[J[0]-pe[2],J[1]-pe[3]],Oe=e.dragData.possibleDragElements,qe;if(le){var lt=oe[0]-le[0],yt=lt*lt,je=oe[1]-le[1],it=je*je,$e=yt+it;e.hoverData.isOverThresholdDrag=qe=$e>=e.desktopTapThreshold2}var mt=a(k);qe&&(e.hoverData.tapholdCancelled=!0);var Jt=function(){var Ft=e.hoverData.dragDelta=e.hoverData.dragDelta||[];Ft.length===0?(Ft.push(_e[0]),Ft.push(_e[1])):(Ft[0]+=_e[0],Ft[1]+=_e[1])};W=!0,i(Ce,["mousemove","vmousemove","tapdrag"],k,{x:J[0],y:J[1]});var Ze=function(Ft){return{originalEvent:k,type:Ft,position:{x:J[0],y:J[1]}}},Nt=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||q.emit(Ze("boxstart")),pe[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(e.hoverData.which===3){if(qe){var qn=Ze("cxtdrag");de?de.emit(qn):q.emit(qn),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||Ce!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit(Ze("cxtdragout")),e.hoverData.cxtOver=Ce,Ce&&Ce.emit(Ze("cxtdragover")))}}else if(e.hoverData.dragging){if(W=!0,q.panningEnabled()&&q.userPanningEnabled()){var Pr;if(e.hoverData.justStartedPan){var Hn=e.hoverData.mdownPos;Pr={x:(J[0]-Hn[0])*$,y:(J[1]-Hn[1])*$},e.hoverData.justStartedPan=!1}else Pr={x:_e[0]*$,y:_e[1]*$};q.panBy(Pr),q.emit(Ze("dragpan")),e.hoverData.dragged=!0}J=e.projectIntoViewport(k.clientX,k.clientY)}else if(pe[4]==1&&(de==null||de.pannable())){if(qe){if(!e.hoverData.dragging&&q.boxSelectionEnabled()&&(mt||!q.panningEnabled()||!q.userPanningEnabled()))Nt();else if(!e.hoverData.selecting&&q.panningEnabled()&&q.userPanningEnabled()){var xr=o(de,e.hoverData.downs);xr&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,pe[4]=0,e.data.bgActivePosistion=qr(he),e.redrawHint("select",!0),e.redraw())}de&&de.pannable()&&de.active()&&de.unactivate()}}else{if(de&&de.pannable()&&de.active()&&de.unactivate(),(!de||!de.grabbed())&&Ce!=Te&&(Te&&i(Te,["mouseout","tapdragout"],k,{x:J[0],y:J[1]}),Ce&&i(Ce,["mouseover","tapdragover"],k,{x:J[0],y:J[1]}),e.hoverData.last=Ce),de)if(qe){if(q.boxSelectionEnabled()&&mt)de&&de.grabbed()&&(g(Oe),de.emit(Ze("freeon")),Oe.emit(Ze("free")),e.dragData.didDrag&&(de.emit(Ze("dragfreeon")),Oe.emit(Ze("dragfree")))),Nt();else if(de&&de.grabbed()&&e.nodeIsDraggable(de)){var Et=!e.dragData.didDrag;Et&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||v(Oe,{inDragLayer:!0});var ft={x:0,y:0};if(ne(_e[0])&&ne(_e[1])&&(ft.x+=_e[0],ft.y+=_e[1],Et)){var Tt=e.hoverData.dragDelta;Tt&&ne(Tt[0])&&ne(Tt[1])&&(ft.x+=Tt[0],ft.y+=Tt[1])}e.hoverData.draggingEles=!0,Oe.silentShift(ft).emit(Ze("position")).emit(Ze("drag")),e.redrawHint("drag",!0),e.redraw()}}else Jt();W=!0}if(pe[2]=J[0],pe[3]=J[1],W)return k.stopPropagation&&k.stopPropagation(),k.preventDefault&&k.preventDefault(),!1}},!1);var N,S,M;e.registerBinding(t,"mouseup",function(k){if(!(e.hoverData.which===1&&k.which!==1&&e.hoverData.capture)){var X=e.hoverData.capture;if(X){e.hoverData.capture=!1;var W=e.cy,q=e.projectIntoViewport(k.clientX,k.clientY),$=e.selection,oe=e.findNearestElement(q[0],q[1],!0,!1),J=e.dragData.possibleDragElements,he=e.hoverData.down,le=a(k);e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,he&&he.unactivate();var pe=function(qe){return{originalEvent:k,type:qe,position:{x:q[0],y:q[1]}}};if(e.hoverData.which===3){var Ce=pe("cxttapend");if(he?he.emit(Ce):W.emit(Ce),!e.hoverData.cxtDragged){var Te=pe("cxttap");he?he.emit(Te):W.emit(Te)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(i(oe,["mouseup","tapend","vmouseup"],k,{x:q[0],y:q[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(i(he,["click","tap","vclick"],k,{x:q[0],y:q[1]}),S=!1,k.timeStamp-M<=W.multiClickDebounceTime()?(N&&clearTimeout(N),S=!0,M=null,i(he,["dblclick","dbltap","vdblclick"],k,{x:q[0],y:q[1]})):(N=setTimeout(function(){S||i(he,["oneclick","onetap","voneclick"],k,{x:q[0],y:q[1]})},W.multiClickDebounceTime()),M=k.timeStamp)),he==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!a(k)&&(W.$(r).unselect(["tapunselect"]),J.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=J=W.collection()),oe==he&&!e.dragData.didDrag&&!e.hoverData.selecting&&oe!=null&&oe._private.selectable&&(e.hoverData.dragging||(W.selectionType()==="additive"||le?oe.selected()?oe.unselect(["tapunselect"]):oe.select(["tapselect"]):le||(W.$(r).unmerge(oe).unselect(["tapunselect"]),oe.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var de=W.collection(e.getAllInBox($[0],$[1],$[2],$[3]));e.redrawHint("select",!0),de.length>0&&e.redrawHint("eles",!0),W.emit(pe("boxend"));var _e=function(qe){return qe.selectable()&&!qe.selected()};W.selectionType()==="additive"||le||W.$(r).unmerge(de).unselect(),de.emit(pe("box")).stdFilter(_e).select().emit(pe("boxselect")),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!$[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var Oe=he&&he.grabbed();g(J),Oe&&(he.emit(pe("freeon")),J.emit(pe("free")),e.dragData.didDrag&&(he.emit(pe("dragfreeon")),J.emit(pe("dragfree"))))}}$[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}},!1);var R=[],P=4,L,O=1e5,I=function(k,X){for(var W=0;W<k.length;W++)if(k[W]%X!==0)return!1;return!0},B=function(k){for(var X=Math.abs(k[0]),W=1;W<k.length;W++)if(Math.abs(k[W])!==X)return!1;return!0},F=function(k){var X=!1,W=k.deltaY;if(W==null&&(k.wheelDeltaY!=null?W=k.wheelDeltaY/4:k.wheelDelta!=null&&(W=k.wheelDelta/4)),W!==0){if(L==null)if(R.length>=P){var q=R;if(L=I(q,5),!L){var $=Math.abs(q[0]);L=B(q)&&$>5}if(L)for(var oe=0;oe<q.length;oe++)O=Math.min(Math.abs(q[oe]),O)}else R.push(W),X=!0;else L&&(O=Math.min(Math.abs(W),O));if(!e.scrollingPage){var J=e.cy,he=J.zoom(),le=J.pan(),pe=e.projectIntoViewport(k.clientX,k.clientY),Ce=[pe[0]*he+le.x,pe[1]*he+le.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||E()){k.preventDefault();return}if(J.panningEnabled()&&J.userPanningEnabled()&&J.zoomingEnabled()&&J.userZoomingEnabled()){k.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout(function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()},150);var Te;X&&Math.abs(W)>5&&(W=hs(W)*5),Te=W/-250,L&&(Te/=O,Te*=3),Te=Te*e.wheelSensitivity;var de=k.deltaMode===1;de&&(Te*=33);var _e=J.zoom()*Math.pow(10,Te);k.type==="gesturechange"&&(_e=e.gestureStartZoom*k.scale),J.zoom({level:_e,renderedPosition:{x:Ce[0],y:Ce[1]}}),J.emit({type:k.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:k,position:{x:pe[0],y:pe[1]}})}}}};e.registerBinding(e.container,"wheel",F,!0),e.registerBinding(t,"scroll",function(k){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(k){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||k.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(k){e.hasTouchStarted||F(k)},!0),e.registerBinding(e.container,"mouseout",function(k){var X=e.projectIntoViewport(k.clientX,k.clientY);e.cy.emit({originalEvent:k,type:"mouseout",position:{x:X[0],y:X[1]}})},!1),e.registerBinding(e.container,"mouseover",function(k){var X=e.projectIntoViewport(k.clientX,k.clientY);e.cy.emit({originalEvent:k,type:"mouseover",position:{x:X[0],y:X[1]}})},!1);var z,G,H,j,Z,Q,re,V,Y,U,K,ee,ie,we=function(k,X,W,q){return Math.sqrt((W-k)*(W-k)+(q-X)*(q-X))},ye=function(k,X,W,q){return(W-k)*(W-k)+(q-X)*(q-X)},xe;e.registerBinding(e.container,"touchstart",xe=function(k){if(e.hasTouchStarted=!0,!!A(k)){x(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var X=e.cy,W=e.touchData.now,q=e.touchData.earlier;if(k.touches[0]){var $=e.projectIntoViewport(k.touches[0].clientX,k.touches[0].clientY);W[0]=$[0],W[1]=$[1]}if(k.touches[1]){var $=e.projectIntoViewport(k.touches[1].clientX,k.touches[1].clientY);W[2]=$[0],W[3]=$[1]}if(k.touches[2]){var $=e.projectIntoViewport(k.touches[2].clientX,k.touches[2].clientY);W[4]=$[0],W[5]=$[1]}var oe=function($e){return{originalEvent:k,type:$e,position:{x:W[0],y:W[1]}}};if(k.touches[1]){e.touchData.singleTouchMoved=!0,g(e.dragData.touchDragEles);var J=e.findContainerClientCoords();Y=J[0],U=J[1],K=J[2],ee=J[3],z=k.touches[0].clientX-Y,G=k.touches[0].clientY-U,H=k.touches[1].clientX-Y,j=k.touches[1].clientY-U,ie=0<=z&&z<=K&&0<=H&&H<=K&&0<=G&&G<=ee&&0<=j&&j<=ee;var he=X.pan(),le=X.zoom();Z=we(z,G,H,j),Q=ye(z,G,H,j),re=[(z+H)/2,(G+j)/2],V=[(re[0]-he.x)/le,(re[1]-he.y)/le];var pe=200,Ce=pe*pe;if(Q<Ce&&!k.touches[2]){var Te=e.findNearestElement(W[0],W[1],!0,!0),de=e.findNearestElement(W[2],W[3],!0,!0);Te&&Te.isNode()?(Te.activate().emit(oe("cxttapstart")),e.touchData.start=Te):de&&de.isNode()?(de.activate().emit(oe("cxttapstart")),e.touchData.start=de):X.emit(oe("cxttapstart")),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,e.redraw();return}}if(k.touches[2])X.boxSelectionEnabled()&&k.preventDefault();else if(!k.touches[1]&&k.touches[0]){var _e=e.findNearestElements(W[0],W[1],!0,!0),Oe=_e[0];if(Oe!=null&&(Oe.activate(),e.touchData.start=Oe,e.touchData.starts=_e,e.nodeIsGrabbable(Oe))){var qe=e.dragData.touchDragEles=X.collection(),lt=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),Oe.selected()?(lt=X.$(function($e){return $e.selected()&&e.nodeIsGrabbable($e)}),v(lt,{addToList:qe})):m(Oe,{addToList:qe}),h(Oe),Oe.emit(oe("grabon")),lt?lt.forEach(function($e){$e.emit(oe("grab"))}):Oe.emit(oe("grab"))}i(Oe,["touchstart","tapstart","vmousedown"],k,{x:W[0],y:W[1]}),Oe==null&&(e.data.bgActivePosistion={x:$[0],y:$[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){e.touchData.singleTouchMoved===!1&&!e.pinching&&!e.touchData.selecting&&i(e.touchData.start,["taphold"],k,{x:W[0],y:W[1]})},e.tapholdDuration)}if(k.touches.length>=1){for(var yt=e.touchData.startPosition=[null,null,null,null,null,null],je=0;je<W.length;je++)yt[je]=q[je]=W[je];var it=k.touches[0];e.touchData.startGPosition=[it.clientX,it.clientY]}}},!1);var Me;e.registerBinding(t,"touchmove",Me=function(k){var X=e.touchData.capture;if(!(!X&&!A(k))){var W=e.selection,q=e.cy,$=e.touchData.now,oe=e.touchData.earlier,J=q.zoom();if(k.touches[0]){var he=e.projectIntoViewport(k.touches[0].clientX,k.touches[0].clientY);$[0]=he[0],$[1]=he[1]}if(k.touches[1]){var he=e.projectIntoViewport(k.touches[1].clientX,k.touches[1].clientY);$[2]=he[0],$[3]=he[1]}if(k.touches[2]){var he=e.projectIntoViewport(k.touches[2].clientX,k.touches[2].clientY);$[4]=he[0],$[5]=he[1]}var le=function(pd){return{originalEvent:k,type:pd,position:{x:$[0],y:$[1]}}},pe=e.touchData.startGPosition,Ce;if(X&&k.touches[0]&&pe){for(var Te=[],de=0;de<$.length;de++)Te[de]=$[de]-oe[de];var _e=k.touches[0].clientX-pe[0],Oe=_e*_e,qe=k.touches[0].clientY-pe[1],lt=qe*qe,yt=Oe+lt;Ce=yt>=e.touchTapThreshold2}if(X&&e.touchData.cxt){k.preventDefault();var je=k.touches[0].clientX-Y,it=k.touches[0].clientY-U,$e=k.touches[1].clientX-Y,mt=k.touches[1].clientY-U,Jt=ye(je,it,$e,mt),Ze=Jt/Q,Nt=150,qn=Nt*Nt,Pr=1.5,Hn=Pr*Pr;if(Ze>=Hn||Jt>=qn){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var xr=le("cxttapend");e.touchData.start?(e.touchData.start.unactivate().emit(xr),e.touchData.start=null):q.emit(xr)}}if(X&&e.touchData.cxt){var xr=le("cxtdrag");e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(xr):q.emit(xr),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var Et=e.findNearestElement($[0],$[1],!0,!0);(!e.touchData.cxtOver||Et!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit(le("cxtdragout")),e.touchData.cxtOver=Et,Et&&Et.emit(le("cxtdragover")))}else if(X&&k.touches[2]&&q.boxSelectionEnabled())k.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||q.emit(le("boxstart")),e.touchData.selecting=!0,e.touchData.didSelect=!0,W[4]=1,!W||W.length===0||W[0]===void 0?(W[0]=($[0]+$[2]+$[4])/3,W[1]=($[1]+$[3]+$[5])/3,W[2]=($[0]+$[2]+$[4])/3+1,W[3]=($[1]+$[3]+$[5])/3+1):(W[2]=($[0]+$[2]+$[4])/3,W[3]=($[1]+$[3]+$[5])/3),e.redrawHint("select",!0),e.redraw();else if(X&&k.touches[1]&&!e.touchData.didSelect&&q.zoomingEnabled()&&q.panningEnabled()&&q.userZoomingEnabled()&&q.userPanningEnabled()){k.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var ft=e.dragData.touchDragEles;if(ft){e.redrawHint("drag",!0);for(var Tt=0;Tt<ft.length;Tt++){var Ft=ft[Tt]._private;Ft.grabbed=!1,Ft.rscratch.inDragLayer=!1}}var jn=e.touchData.start,je=k.touches[0].clientX-Y,it=k.touches[0].clientY-U,$e=k.touches[1].clientX-Y,mt=k.touches[1].clientY-U,ks=we(je,it,$e,mt),ad=ks/Z;if(ie){var od=je-z,sd=it-G,ld=$e-H,ud=mt-j,cd=(od+ld)/2,hd=(sd+ud)/2,un=q.zoom(),Ji=un*ad,$n=q.pan(),Ms=V[0]*un+$n.x,Ss=V[1]*un+$n.y,dd={x:-Ji/un*(Ms-$n.x-cd)+Ms,y:-Ji/un*(Ss-$n.y-hd)+Ss};if(jn&&jn.active()){var ft=e.dragData.touchDragEles;g(ft),e.redrawHint("drag",!0),e.redrawHint("eles",!0),jn.unactivate().emit(le("freeon")),ft.emit(le("free")),e.dragData.didDrag&&(jn.emit(le("dragfreeon")),ft.emit(le("dragfree")))}q.viewport({zoom:Ji,pan:dd,cancelOnFailedZoom:!0}),q.emit(le("pinchzoom")),Z=ks,z=je,G=it,H=$e,j=mt,e.pinching=!0}if(k.touches[0]){var he=e.projectIntoViewport(k.touches[0].clientX,k.touches[0].clientY);$[0]=he[0],$[1]=he[1]}if(k.touches[1]){var he=e.projectIntoViewport(k.touches[1].clientX,k.touches[1].clientY);$[2]=he[0],$[3]=he[1]}if(k.touches[2]){var he=e.projectIntoViewport(k.touches[2].clientX,k.touches[2].clientY);$[4]=he[0],$[5]=he[1]}}else if(k.touches[0]&&!e.touchData.didSelect){var Lt=e.touchData.start,ea=e.touchData.last,Et;if(!e.hoverData.draggingEles&&!e.swipePanning&&(Et=e.findNearestElement($[0],$[1],!0,!0)),X&&Lt!=null&&k.preventDefault(),X&&Lt!=null&&e.nodeIsDraggable(Lt))if(Ce){var ft=e.dragData.touchDragEles,Ls=!e.dragData.didDrag;Ls&&v(ft,{inDragLayer:!0}),e.dragData.didDrag=!0;var cn={x:0,y:0};if(ne(Te[0])&&ne(Te[1])&&(cn.x+=Te[0],cn.y+=Te[1],Ls)){e.redrawHint("eles",!0);var It=e.touchData.dragDelta;It&&ne(It[0])&&ne(It[1])&&(cn.x+=It[0],cn.y+=It[1])}e.hoverData.draggingEles=!0,ft.silentShift(cn).emit(le("position")).emit(le("drag")),e.redrawHint("drag",!0),e.touchData.startPosition[0]==oe[0]&&e.touchData.startPosition[1]==oe[1]&&e.redrawHint("eles",!0),e.redraw()}else{var It=e.touchData.dragDelta=e.touchData.dragDelta||[];It.length===0?(It.push(Te[0]),It.push(Te[1])):(It[0]+=Te[0],It[1]+=Te[1])}if(i(Lt||Et,["touchmove","tapdrag","vmousemove"],k,{x:$[0],y:$[1]}),(!Lt||!Lt.grabbed())&&Et!=ea&&(ea&&ea.emit(le("tapdragout")),Et&&Et.emit(le("tapdragover"))),e.touchData.last=Et,X)for(var Tt=0;Tt<$.length;Tt++)$[Tt]&&e.touchData.startPosition[Tt]&&Ce&&(e.touchData.singleTouchMoved=!0);if(X&&(Lt==null||Lt.pannable())&&q.panningEnabled()&&q.userPanningEnabled()){var fd=o(Lt,e.touchData.starts);fd&&(k.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=qr(e.touchData.startPosition)),e.swipePanning?(q.panBy({x:Te[0]*J,y:Te[1]*J}),q.emit(le("dragpan"))):Ce&&(e.swipePanning=!0,q.panBy({x:_e*J,y:qe*J}),q.emit(le("dragpan")),Lt&&(Lt.unactivate(),e.redrawHint("select",!0),e.touchData.start=null)));var he=e.projectIntoViewport(k.touches[0].clientX,k.touches[0].clientY);$[0]=he[0],$[1]=he[1]}}for(var de=0;de<$.length;de++)oe[de]=$[de];X&&k.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1);var te;e.registerBinding(t,"touchcancel",te=function(k){var X=e.touchData.start;e.touchData.capture=!1,X&&X.unactivate()});var ue,ce,me,be;if(e.registerBinding(t,"touchend",ue=function(k){var X=e.touchData.start,W=e.touchData.capture;if(W)k.touches.length===0&&(e.touchData.capture=!1),k.preventDefault();else return;var q=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var $=e.cy,oe=$.zoom(),J=e.touchData.now,he=e.touchData.earlier;if(k.touches[0]){var le=e.projectIntoViewport(k.touches[0].clientX,k.touches[0].clientY);J[0]=le[0],J[1]=le[1]}if(k.touches[1]){var le=e.projectIntoViewport(k.touches[1].clientX,k.touches[1].clientY);J[2]=le[0],J[3]=le[1]}if(k.touches[2]){var le=e.projectIntoViewport(k.touches[2].clientX,k.touches[2].clientY);J[4]=le[0],J[5]=le[1]}var pe=function(Nt){return{originalEvent:k,type:Nt,position:{x:J[0],y:J[1]}}};X&&X.unactivate();var Ce;if(e.touchData.cxt){if(Ce=pe("cxttapend"),X?X.emit(Ce):$.emit(Ce),!e.touchData.cxtDragged){var Te=pe("cxttap");X?X.emit(Te):$.emit(Te)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!k.touches[2]&&$.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var de=$.collection(e.getAllInBox(q[0],q[1],q[2],q[3]));q[0]=void 0,q[1]=void 0,q[2]=void 0,q[3]=void 0,q[4]=0,e.redrawHint("select",!0),$.emit(pe("boxend"));var _e=function(Nt){return Nt.selectable()&&!Nt.selected()};de.emit(pe("box")).stdFilter(_e).select().emit(pe("boxselect")),de.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(X!=null&&X.unactivate(),k.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(!k.touches[1]&&!k.touches[0]&&!k.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var Oe=e.dragData.touchDragEles;if(X!=null){var qe=X._private.grabbed;g(Oe),e.redrawHint("drag",!0),e.redrawHint("eles",!0),qe&&(X.emit(pe("freeon")),Oe.emit(pe("free")),e.dragData.didDrag&&(X.emit(pe("dragfreeon")),Oe.emit(pe("dragfree")))),i(X,["touchend","tapend","vmouseup","tapdragout"],k,{x:J[0],y:J[1]}),X.unactivate(),e.touchData.start=null}else{var lt=e.findNearestElement(J[0],J[1],!0,!0);i(lt,["touchend","tapend","vmouseup","tapdragout"],k,{x:J[0],y:J[1]})}var yt=e.touchData.startPosition[0]-J[0],je=yt*yt,it=e.touchData.startPosition[1]-J[1],$e=it*it,mt=je+$e,Jt=mt*oe*oe;e.touchData.singleTouchMoved||(X||$.$(":selected").unselect(["tapunselect"]),i(X,["tap","vclick"],k,{x:J[0],y:J[1]}),ce=!1,k.timeStamp-be<=$.multiClickDebounceTime()?(me&&clearTimeout(me),ce=!0,be=null,i(X,["dbltap","vdblclick"],k,{x:J[0],y:J[1]})):(me=setTimeout(function(){ce||i(X,["onetap","voneclick"],k,{x:J[0],y:J[1]})},$.multiClickDebounceTime()),be=k.timeStamp)),X!=null&&!e.dragData.didDrag&&X._private.selectable&&Jt<e.touchTapThreshold2&&!e.pinching&&($.selectionType()==="single"?($.$(r).unmerge(X).unselect(["tapunselect"]),X.select(["tapselect"])):X.selected()?X.unselect(["tapunselect"]):X.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}for(var Ze=0;Ze<J.length;Ze++)he[Ze]=J[Ze];e.dragData.didDrag=!1,k.touches.length===0&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),k.touches.length<2&&(k.touches.length===1&&(e.touchData.startGPosition=[k.touches[0].clientX,k.touches[0].clientY]),e.pinching=!1,e.redrawHint("eles",!0),e.redraw())},!1),typeof TouchEvent>"u"){var Ee=[],De=function(k){return{clientX:k.clientX,clientY:k.clientY,force:1,identifier:k.pointerId,pageX:k.pageX,pageY:k.pageY,radiusX:k.width/2,radiusY:k.height/2,screenX:k.screenX,screenY:k.screenY,target:k.target}},Be=function(k){return{event:k,touch:De(k)}},Ve=function(k){Ee.push(Be(k))},Ie=function(k){for(var X=0;X<Ee.length;X++){var W=Ee[X];if(W.event.pointerId===k.pointerId){Ee.splice(X,1);return}}},Se=function(k){var X=Ee.filter(function(W){return W.event.pointerId===k.pointerId})[0];X.event=k,X.touch=De(k)},ae=function(k){k.touches=Ee.map(function(X){return X.touch})},ve=function(k){return k.pointerType==="mouse"||k.pointerType===4};e.registerBinding(e.container,"pointerdown",function(k){ve(k)||(k.preventDefault(),Ve(k),ae(k),xe(k))}),e.registerBinding(e.container,"pointerup",function(k){ve(k)||(Ie(k),ae(k),ue(k))}),e.registerBinding(e.container,"pointercancel",function(k){ve(k)||(Ie(k),ae(k),te(k))}),e.registerBinding(e.container,"pointermove",function(k){ve(k)||(k.preventDefault(),Se(k),ae(k),Me(k))})}};var Kt={};Kt.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(r,n,i,a,o,s){this.renderer.nodeShapeImpl("polygon",r,n,i,a,o,this.points)},intersectLine:function(r,n,i,a,o,s,u,l){return Nn(o,s,this.points,r,n,i/2,a/2,u)},checkPoint:function(r,n,i,a,o,s,u,l){return Zt(r,n,this.points,s,u,a,o,[0,-1],i)},hasMiterBounds:e!=="rectangle",miterBounds:function(r,n,i,a,o,s){return tp(this.points,r,n,i,a,o)}}};Kt.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,r,n,i,a){this.renderer.nodeShapeImpl(this.name,e,t,r,n,i)},intersectLine:function(e,t,r,n,i,a,o,s){return up(i,a,e,t,r/2+o,n/2+o)},checkPoint:function(e,t,r,n,i,a,o,s){return Dr(e,t,n,i,a,o,r)}}};Kt.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(r,n,i,a,o,s,u){if(s[u]!==void 0&&s[u+"-cx"]===r&&s[u+"-cy"]===n)return s[u];s[u]=new Array(t.length/2),s[u+"-cx"]=r,s[u+"-cy"]=n;var l=i/2,c=a/2;o=o==="auto"?Rc(i,a):o;for(var h=new Array(t.length/2),f=0;f<t.length/2;f++)h[f]={x:r+l*t[f*2],y:n+c*t[f*2+1]};var d,p,v,m,g=h.length;for(p=h[g-1],d=0;d<g;d++)v=h[d%g],m=h[(d+1)%g],s[u][d]=_s(p,v,m,o),p=v,v=m;return s[u]},draw:function(r,n,i,a,o,s,u){this.renderer.nodeShapeImpl("round-polygon",r,n,i,a,o,this.points,this.getOrCreateCorners(n,i,a,o,s,u,"drawCorners"))},intersectLine:function(r,n,i,a,o,s,u,l,c){return hp(o,s,this.points,r,n,i,a,u,this.getOrCreateCorners(r,n,i,a,l,c,"corners"))},checkPoint:function(r,n,i,a,o,s,u,l,c){return lp(r,n,this.points,s,u,a,o,this.getOrCreateCorners(s,u,a,o,l,c,"corners"))}}};Kt.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:bt(4,0),draw:function(e,t,r,n,i,a){this.renderer.nodeShapeImpl(this.name,e,t,r,n,i,this.points,a)},intersectLine:function(e,t,r,n,i,a,o,s){return Ic(i,a,e,t,r,n,o,s)},checkPoint:function(e,t,r,n,i,a,o,s){var u=n/2,l=i/2;s=s==="auto"?cr(n,i):s,s=Math.min(u,l,s);var c=s*2;return!!(Zt(e,t,this.points,a,o,n,i-c,[0,-1],r)||Zt(e,t,this.points,a,o,n-c,i,[0,-1],r)||Dr(e,t,c,c,a-u+s,o-l+s,r)||Dr(e,t,c,c,a+u-s,o-l+s,r)||Dr(e,t,c,c,a+u-s,o+l-s,r)||Dr(e,t,c,c,a-u+s,o+l-s,r))}}};Kt.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:fs(),points:bt(4,0),draw:function(e,t,r,n,i,a){this.renderer.nodeShapeImpl(this.name,e,t,r,n,i,null,a)},generateCutTrianglePts:function(e,t,r,n,i){var a=i==="auto"?this.cornerLength:i,o=t/2,s=e/2,u=r-s,l=r+s,c=n-o,h=n+o;return{topLeft:[u,c+a,u+a,c,u+a,c+a],topRight:[l-a,c,l,c+a,l-a,c+a],bottomRight:[l,h-a,l-a,h,l-a,h-a],bottomLeft:[u+a,h,u,h-a,u+a,h-a]}},intersectLine:function(e,t,r,n,i,a,o,s){var u=this.generateCutTrianglePts(r+2*o,n+2*o,e,t,s),l=[].concat.apply([],[u.topLeft.splice(0,4),u.topRight.splice(0,4),u.bottomRight.splice(0,4),u.bottomLeft.splice(0,4)]);return Nn(i,a,l,e,t)},checkPoint:function(e,t,r,n,i,a,o,s){var u=s==="auto"?this.cornerLength:s;if(Zt(e,t,this.points,a,o,n,i-2*u,[0,-1],r)||Zt(e,t,this.points,a,o,n-2*u,i,[0,-1],r))return!0;var l=this.generateCutTrianglePts(n,i,a,o);return At(e,t,l.topLeft)||At(e,t,l.topRight)||At(e,t,l.bottomRight)||At(e,t,l.bottomLeft)}}};Kt.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:bt(4,0),draw:function(e,t,r,n,i,a){this.renderer.nodeShapeImpl(this.name,e,t,r,n,i)},intersectLine:function(e,t,r,n,i,a,o,s){var u=.15,l=.5,c=.85,h=this.generateBarrelBezierPts(r+2*o,n+2*o,e,t),f=function(p){var v=$r({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},u),m=$r({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},l),g=$r({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},c);return[p[0],p[1],v.x,v.y,m.x,m.y,g.x,g.y,p[4],p[5]]},d=[].concat(f(h.topLeft),f(h.topRight),f(h.bottomRight),f(h.bottomLeft));return Nn(i,a,d,e,t)},generateBarrelBezierPts:function(e,t,r,n){var i=t/2,a=e/2,o=r-a,s=r+a,u=n-i,l=n+i,c=Oo(e,t),h=c.heightOffset,f=c.widthOffset,d=c.ctrlPtOffsetPct*e,p={topLeft:[o,u+h,o+d,u,o+f,u],topRight:[s-f,u,s-d,u,s,u+h],bottomRight:[s,l-h,s-d,l,s-f,l],bottomLeft:[o+f,l,o+d,l,o,l-h]};return p.topLeft.isTop=!0,p.topRight.isTop=!0,p.bottomLeft.isBottom=!0,p.bottomRight.isBottom=!0,p},checkPoint:function(e,t,r,n,i,a,o,s){var u=Oo(n,i),l=u.heightOffset,c=u.widthOffset;if(Zt(e,t,this.points,a,o,n,i-2*l,[0,-1],r)||Zt(e,t,this.points,a,o,n-2*c,i,[0,-1],r))return!0;for(var h=this.generateBarrelBezierPts(n,i,a,o),f=function(D,b,_){var E=_[4],A=_[2],C=_[0],N=_[5],S=_[1],M=Math.min(E,C),R=Math.max(E,C),P=Math.min(N,S),L=Math.max(N,S);if(M<=D&&D<=R&&P<=b&&b<=L){var O=dp(E,A,C),I=ip(O[0],O[1],O[2],D),B=I.filter(function(F){return 0<=F&&F<=1});if(B.length>0)return B[0]}return null},d=Object.keys(h),p=0;p<d.length;p++){var v=d[p],m=h[v],g=f(e,t,m);if(g!=null){var y=m[5],x=m[3],T=m[1],w=at(y,x,T,g);if(m.isTop&&w<=t||m.isBottom&&t<=w)return!0}}return!1}}};Kt.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:bt(4,0),draw:function(e,t,r,n,i,a){this.renderer.nodeShapeImpl(this.name,e,t,r,n,i,this.points,a)},intersectLine:function(e,t,r,n,i,a,o,s){var u=e-(r/2+o),l=t-(n/2+o),c=l,h=e+(r/2+o),f=ar(i,a,e,t,u,l,h,c,!1);return f.length>0?f:Ic(i,a,e,t,r,n,o,s)},checkPoint:function(e,t,r,n,i,a,o,s){s=s==="auto"?cr(n,i):s;var u=2*s;if(Zt(e,t,this.points,a,o,n,i-u,[0,-1],r)||Zt(e,t,this.points,a,o,n-u,i,[0,-1],r))return!0;var l=n/2+2*r,c=i/2+2*r,h=[a-l,o-c,a-l,o,a+l,o,a+l,o-c];return!!(At(e,t,h)||Dr(e,t,u,u,a+n/2-s,o+i/2-s,r)||Dr(e,t,u,u,a-n/2+s,o+i/2-s,r))}}};Kt.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",bt(3,0)),this.generateRoundPolygon("round-triangle",bt(3,0)),this.generatePolygon("rectangle",bt(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",bt(5,0)),this.generateRoundPolygon("round-pentagon",bt(5,0)),this.generatePolygon("hexagon",bt(6,0)),this.generateRoundPolygon("round-hexagon",bt(6,0)),this.generatePolygon("heptagon",bt(7,0)),this.generateRoundPolygon("round-heptagon",bt(7,0)),this.generatePolygon("octagon",bt(8,0)),this.generateRoundPolygon("round-octagon",bt(8,0));var n=new Array(20);{var i=Io(5,0),a=Io(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<a.length/2;s++)a[s*2]*=o,a[s*2+1]*=o;for(var s=0;s<20/4;s++)n[s*4]=i[s*2],n[s*4+1]=i[s*2+1],n[s*4+2]=a[s*2],n[s*4+3]=a[s*2+1]}n=Oc(n),this.generatePolygon("star",n),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u)}e.makePolygon=function(l){var c=l.join("$"),h="polygon-"+c,f;return(f=this[h])?f:t.generatePolygon(h,l)}};var Xn={};Xn.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Xn.redraw=function(e){e=e||kc();var t=this;t.averageRedrawTime===void 0&&(t.averageRedrawTime=0),t.lastRedrawTime===void 0&&(t.lastRedrawTime=0),t.lastDrawTime===void 0&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e};Xn.beforeRender=function(e,t){if(!this.destroyed){t==null&&Xe("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:e,priority:t}),r.sort(function(n,i){return i.priority-n.priority})}};var Wu=function(e,t,r){for(var n=e.beforeRenderCallbacks,i=0;i<n.length;i++)n[i].fn(t,r)};Xn.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var r=function(n){if(!e.destroyed){if(!t.batching())if(e.requestedFrame&&!e.skipFrame){Wu(e,!0,n);var i=$t();e.render(e.renderOptions);var a=e.lastDrawTime=$t();e.averageRedrawTime===void 0&&(e.averageRedrawTime=a-i),e.redrawCount===void 0&&(e.redrawCount=0),e.redrawCount++,e.redrawTotalTime===void 0&&(e.redrawTotalTime=0);var o=a-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else Wu(e,!1,n);e.skipFrame=!1,Ti(r)}};Ti(r)}};var Ny=function(e){this.init(e)},Rh=Ny,ln=Rh.prototype;ln.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];ln.init=function(e){var t=this;t.options=e,t.cy=e.cy;var r=t.container=e.cy.container(),n=t.cy.window();if(n){var i=n.document,a=i.head,o="__________cytoscape_stylesheet",s="__________cytoscape_container",u=i.getElementById(o)!=null;if(r.className.indexOf(s)<0&&(r.className=(r.className||"")+" "+s),!u){var l=i.createElement("style");l.id=o,l.textContent="."+s+" { position: relative; }",a.insertBefore(l,a.children[0])}var c=n.getComputedStyle(r),h=c.getPropertyValue("position");h==="static"&&Pe("A Cytoscape container has style position:static and so can not use UI extensions properly")}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.webgl=e.webgl,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=ne(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()};ln.notify=function(e,t){var r=this,n=r.cy;if(!this.destroyed){if(e==="init"){r.load();return}if(e==="destroy"){r.destroy();return}(e==="add"||e==="remove"||e==="move"&&n.hasCompoundNodes()||e==="load"||e==="zorder"||e==="mount")&&r.invalidateCachedZSortedEles(),e==="viewport"&&r.redrawHint("select",!0),e==="gc"&&r.redrawHint("gc",!0),(e==="load"||e==="resize"||e==="mount")&&(r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.container)),r.redrawHint("eles",!0),r.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};ln.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var r=e.bindings[t],n=r,i=n.target;(i.off||i.removeEventListener).apply(i,n.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch{}};ln.isHeadless=function(){return!1};[Ts,Ih,Oh,sn,Kt,Xn].forEach(function(e){ge(ln,e)});var To=1e3/60,Ph={setupDequeueing:function(e){return function(){var t=this,r=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var n=zn(function(){r.redrawHint("eles",!0),r.redrawHint("drag",!0),r.redraw()},e.deqRedrawThreshold),i=function(o,s){var u=$t(),l=r.averageRedrawTime,c=r.lastRedrawTime,h=[],f=r.cy.extent(),d=r.getPixelRatio();for(o||r.flushRenderedStyleQueue();;){var p=$t(),v=p-u,m=p-s;if(c<To){var g=To-(o?l:0);if(m>=e.deqFastCost*g)break}else if(o){if(v>=e.deqCost*c||v>=e.deqAvgCost*l)break}else if(m>=e.deqNoDrawCost*To)break;var y=e.deq(t,d,f);if(y.length>0)for(var x=0;x<y.length;x++)h.push(y[x]);else break}h.length>0&&(e.onDeqd(t,h),!o&&e.shouldRedraw(t,h,d,f)&&n())},a=e.priority||ls;r.beforeRender(i,a(t))}}}},ky=function(){function e(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:_i;gr(this,e),this.idsByKey=new jt,this.keyForId=new jt,this.cachesByLvl=new jt,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=r}return vr(e,[{key:"getIdsFor",value:function(t){t==null&&Xe("Can not get id list for null key");var r=this.idsByKey,n=this.idsByKey.get(t);return n||(n=new rn,r.set(t,n)),n}},{key:"addIdForKey",value:function(t,r){t!=null&&this.getIdsFor(t).add(r)}},{key:"deleteIdForKey",value:function(t,r){t!=null&&this.getIdsFor(t).delete(r)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var r=t.id(),n=this.keyForId.get(r),i=this.getKey(t);this.deleteIdForKey(n,r),this.addIdForKey(i,r),this.keyForId.set(r,i)}},{key:"deleteKeyMappingFor",value:function(t){var r=t.id(),n=this.keyForId.get(r);this.deleteIdForKey(n,r),this.keyForId.delete(r)}},{key:"keyHasChangedFor",value:function(t){var r=t.id(),n=this.keyForId.get(r),i=this.getKey(t);return n!==i}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var r=this.cachesByLvl,n=this.lvls,i=r.get(t);return i||(i=new jt,r.set(t,i),n.push(t)),i}},{key:"getCache",value:function(t,r){return this.getCachesAt(r).get(t)}},{key:"get",value:function(t,r){var n=this.getKey(t),i=this.getCache(n,r);return i!=null&&this.updateKeyMappingFor(t),i}},{key:"getForCachedKey",value:function(t,r){var n=this.keyForId.get(t.id()),i=this.getCache(n,r);return i}},{key:"hasCache",value:function(t,r){return this.getCachesAt(r).has(t)}},{key:"has",value:function(t,r){var n=this.getKey(t);return this.hasCache(n,r)}},{key:"setCache",value:function(t,r,n){n.key=t,this.getCachesAt(r).set(t,n)}},{key:"set",value:function(t,r,n){var i=this.getKey(t);this.setCache(i,r,n),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,r){this.getCachesAt(r).delete(t)}},{key:"delete",value:function(t,r){var n=this.getKey(t);this.deleteCache(n,r)}},{key:"invalidateKey",value:function(t){var r=this;this.lvls.forEach(function(n){return r.deleteCache(t,n)})}},{key:"invalidate",value:function(t){var r=t.id(),n=this.keyForId.get(r);this.deleteKeyMappingFor(t);var i=this.doesEleInvalidateKey(t);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}])}(),qu=25,si=50,yi=-4,Ho=3,Bh=7.99,My=8,Sy=1024,Ly=1024,Iy=1024,Oy=.2,Ry=.8,Py=10,By=.15,Fy=.1,zy=.9,Vy=.9,Gy=100,Yy=1,jr={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Uy=ht({getKey:null,doesEleInvalidateKey:_i,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Cc,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),xn=function(e,t){var r=this;r.renderer=e,r.onDequeues=[];var n=Uy(t);ge(r,n),r.lookup=new ky(n.getKey,n.doesEleInvalidateKey),r.setupDequeueing()},nt=xn.prototype;nt.reasons=jr;nt.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]};nt.getRetiredTextureQueue=function(e){var t=this,r=t.eleImgCaches.retired=t.eleImgCaches.retired||{},n=r[e]=r[e]||[];return n};nt.getElementQueue=function(){var e=this,t=e.eleCacheQueue=e.eleCacheQueue||new Vn(function(r,n){return n.reqs-r.reqs});return t};nt.getElementKeyToQueue=function(){var e=this,t=e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{};return t};nt.getElement=function(e,t,r,n,i){var a=this,o=this.renderer,s=o.cy.zoom(),u=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(n==null&&(n=Math.ceil(cs(s*r))),n<yi)n=yi;else if(s>=Bh||n>Ho)return null;var l=Math.pow(2,n),c=t.h*l,h=t.w*l,f=o.eleTextBiggerThanMin(e,l);if(!this.isVisible(e,f))return null;var d=u.get(e,n);if(d&&d.invalidated&&(d.invalidated=!1,d.texture.invalidatedWidth-=d.width),d)return d;var p;if(c<=qu?p=qu:c<=si?p=si:p=Math.ceil(c/si)*si,c>Iy||h>Ly)return null;var v=a.getTextureQueue(p),m=v[v.length-2],g=function(){return a.recycleTexture(p,h)||a.addTexture(p,h)};m||(m=v[v.length-1]),m||(m=g()),m.width-m.usedWidth<h&&(m=g());for(var y=function(R){return R&&R.scaledLabelShown===f},x=i&&i===jr.dequeue,T=i&&i===jr.highQuality,w=i&&i===jr.downscale,D,b=n+1;b<=Ho;b++){var _=u.get(e,b);if(_){D=_;break}}var E=D&&D.level===n+1?D:null,A=function(){m.context.drawImage(E.texture.canvas,E.x,0,E.width,E.height,m.usedWidth,0,h,c)};if(m.context.setTransform(1,0,0,1,0,0),m.context.clearRect(m.usedWidth,0,h,p),y(E))A();else if(y(D))if(T){for(var C=D.level;C>n;C--)E=a.getElement(e,t,r,C,jr.downscale);A()}else return a.queueElement(e,D.level-1),D;else{var N;if(!x&&!T&&!w)for(var S=n-1;S>=yi;S--){var M=u.get(e,S);if(M){N=M;break}}if(y(N))return a.queueElement(e,n),N;m.context.translate(m.usedWidth,0),m.context.scale(l,l),this.drawElement(m.context,e,t,f,!1),m.context.scale(1/l,1/l),m.context.translate(-m.usedWidth,0)}return d={x:m.usedWidth,texture:m,level:n,scale:l,width:h,height:c,scaledLabelShown:f},m.usedWidth+=Math.ceil(h+My),m.eleCaches.push(d),u.set(e,n,d),a.checkTextureFullness(m),d};nt.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])};nt.invalidateElement=function(e){var t=this,r=t.lookup,n=[],i=r.isInvalid(e);if(i){for(var a=yi;a<=Ho;a++){var o=r.getForCachedKey(e,a);o&&n.push(o)}var s=r.invalidate(e);if(s)for(var u=0;u<n.length;u++){var l=n[u],c=l.texture;c.invalidatedWidth+=l.width,l.invalidated=!0,t.checkTextureUtility(c)}t.removeFromQueue(e)}};nt.checkTextureUtility=function(e){e.invalidatedWidth>=Oy*e.width&&this.retireTexture(e)};nt.checkTextureFullness=function(e){var t=this,r=t.getTextureQueue(e.height);e.usedWidth/e.width>Ry&&e.fullnessChecks>=Py?ur(r,e):e.fullnessChecks++};nt.retireTexture=function(e){var t=this,r=e.height,n=t.getTextureQueue(r),i=this.lookup;ur(n,e),e.retired=!0;for(var a=e.eleCaches,o=0;o<a.length;o++){var s=a[o];i.deleteCache(s.key,s.level)}us(a);var u=t.getRetiredTextureQueue(r);u.push(e)};nt.addTexture=function(e,t){var r=this,n=r.getTextureQueue(e),i={};return n.push(i),i.eleCaches=[],i.height=e,i.width=Math.max(Sy,t),i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,i.canvas=r.renderer.makeOffscreenCanvas(i.width,i.height),i.context=i.canvas.getContext("2d"),i};nt.recycleTexture=function(e,t){for(var r=this,n=r.getTextureQueue(e),i=r.getRetiredTextureQueue(e),a=0;a<i.length;a++){var o=i[a];if(o.width>=t)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,us(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),ur(i,o),n.push(o),o}};nt.queueElement=function(e,t){var r=this,n=r.getElementQueue(),i=r.getElementKeyToQueue(),a=this.getKey(e),o=i[a];if(o)o.level=Math.max(o.level,t),o.eles.merge(e),o.reqs++,n.updateItem(o);else{var s={eles:e.spawn().merge(e),level:t,reqs:1,key:a};n.push(s),i[a]=s}};nt.dequeue=function(e){for(var t=this,r=t.getElementQueue(),n=t.getElementKeyToQueue(),i=[],a=t.lookup,o=0;o<Yy&&r.size()>0;o++){var s=r.pop(),u=s.key,l=s.eles[0],c=a.hasCache(l,s.level);if(n[u]=null,!c){i.push(s);var h=t.getBoundingBox(l);t.getElement(l,h,e,s.level,jr.dequeue)}}return i};nt.removeFromQueue=function(e){var t=this,r=t.getElementQueue(),n=t.getElementKeyToQueue(),i=this.getKey(e),a=n[i];a!=null&&(a.eles.length===1?(a.reqs=ss,r.updateItem(a),r.pop(),n[i]=null):a.eles.unmerge(e))};nt.onDequeue=function(e){this.onDequeues.push(e)};nt.offDequeue=function(e){ur(this.onDequeues,e)};nt.setupDequeueing=Ph.setupDequeueing({deqRedrawThreshold:Gy,deqCost:By,deqAvgCost:Fy,deqNoDrawCost:zy,deqFastCost:Vy,deq:function(e,t,r){return e.dequeue(t,r)},onDeqd:function(e,t){for(var r=0;r<e.onDequeues.length;r++){var n=e.onDequeues[r];n(t)}},shouldRedraw:function(e,t,r,n){for(var i=0;i<t.length;i++)for(var a=t[i].eles,o=0;o<a.length;o++){var s=a[o].boundingBox();if(ds(s,n))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Xy=1,En=-4,Li=2,Wy=3.99,qy=50,Hy=50,jy=.15,$y=.1,Zy=.9,Ky=.9,Qy=1,Hu=250,Jy=4e3*4e3,ju=32767,e0=!0,Fh=function(e){var t=this,r=t.renderer=e,n=r.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=$t()-2*Hu,t.skipping=!1,t.eleTxrDeqs=n.collection(),t.scheduleElementRefinement=zn(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},Hy),r.beforeRender(function(a,o){o-t.lastInvalidationTime<=Hu?t.skipping=!0:t.skipping=!1},r.beforeRenderPriorities.lyrTxrSkip);var i=function(a,o){return o.reqs-a.reqs};t.layersQueue=new Vn(i),t.setupDequeueing()},dt=Fh.prototype,$u=0,t0=Math.pow(2,53)-1;dt.makeLayer=function(e,t){var r=Math.pow(2,t),n=Math.ceil(e.w*r),i=Math.ceil(e.h*r),a=this.renderer.makeOffscreenCanvas(n,i),o={id:$u=++$u%t0,bb:e,level:t,width:n,height:i,canvas:a,context:a.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,u=-o.bb.x1,l=-o.bb.y1;return s.scale(r,r),s.translate(u,l),o};dt.getLayers=function(e,t,r){var n=this,i=n.renderer,a=i.cy,o=a.zoom(),s=n.firstGet;if(n.firstGet=!1,r==null){if(r=Math.ceil(cs(o*t)),r<En)r=En;else if(o>=Wy||r>Li)return null}n.validateLayersElesOrdering(r,e);var u=n.layersByLevel,l=Math.pow(2,r),c=u[r]=u[r]||[],h,f=n.levelIsComplete(r,e),d,p=function(){var E=function(S){if(n.validateLayersElesOrdering(S,e),n.levelIsComplete(S,e))return d=u[S],!0},A=function(S){if(!d)for(var M=r+S;En<=M&&M<=Li&&!E(M);M+=S);};A(1),A(-1);for(var C=c.length-1;C>=0;C--){var N=c[C];N.invalid&&ur(c,N)}};if(!f)p();else return c;var v=function(){if(!h){h=xt();for(var E=0;E<e.length;E++)Qf(h,e[E].boundingBox())}return h},m=function(E){E=E||{};var A=E.after;v();var C=Math.ceil(h.w*l),N=Math.ceil(h.h*l);if(C>ju||N>ju)return null;var S=C*N;if(S>Jy)return null;var M=n.makeLayer(h,r);if(A!=null){var R=c.indexOf(A)+1;c.splice(R,0,M)}else(E.insert===void 0||E.insert)&&c.unshift(M);return M};if(n.skipping&&!s)return null;for(var g=null,y=e.length/Xy,x=!s,T=0;T<e.length;T++){var w=e[T],D=w._private.rscratch,b=D.imgLayerCaches=D.imgLayerCaches||{},_=b[r];if(_){g=_;continue}if((!g||g.eles.length>=y||!Lc(g.bb,w.boundingBox()))&&(g=m({insert:!0,after:g}),!g))return null;d||x?n.queueLayer(g,w):n.drawEleInLayer(g,w,r,t),g.eles.push(w),b[r]=g}return d||(x?null:c)};dt.getEleLevelForLayerLevel=function(e,t){return e};dt.drawEleInLayer=function(e,t,r,n){var i=this,a=this.renderer,o=e.context,s=t.boundingBox();s.w===0||s.h===0||!t.visible()||(r=i.getEleLevelForLayerLevel(r,n),a.setImgSmoothing(o,!1),a.drawCachedElement(o,t,null,null,r,e0),a.setImgSmoothing(o,!0))};dt.levelIsComplete=function(e,t){var r=this,n=r.layersByLevel[e];if(!n||n.length===0)return!1;for(var i=0,a=0;a<n.length;a++){var o=n[a];if(o.reqs>0||o.invalid)return!1;i+=o.eles.length}return i===t.length};dt.validateLayersElesOrdering=function(e,t){var r=this.layersByLevel[e];if(r)for(var n=0;n<r.length;n++){for(var i=r[n],a=-1,o=0;o<t.length;o++)if(i.eles[0]===t[o]){a=o;break}if(a<0){this.invalidateLayer(i);continue}for(var s=a,o=0;o<i.eles.length;o++)if(i.eles[o]!==t[s+o]){this.invalidateLayer(i);break}}};dt.updateElementsInLayers=function(e,t){for(var r=this,n=Rn(e[0]),i=0;i<e.length;i++)for(var a=n?null:e[i],o=n?e[i]:e[i].ele,s=o._private.rscratch,u=s.imgLayerCaches=s.imgLayerCaches||{},l=En;l<=Li;l++){var c=u[l];c&&(a&&r.getEleLevelForLayerLevel(c.level)!==a.level||t(c,o,a))}};dt.haveLayers=function(){for(var e=this,t=!1,r=En;r<=Li;r++){var n=e.layersByLevel[r];if(n&&n.length>0){t=!0;break}}return t};dt.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=$t(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,function(r,n,i){t.invalidateLayer(r)}))};dt.invalidateLayer=function(e){if(this.lastInvalidationTime=$t(),!e.invalid){var t=e.level,r=e.eles,n=this.layersByLevel[t];ur(n,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i<r.length;i++){var a=r[i]._private.rscratch.imgLayerCaches;a&&(a[t]=null)}}};dt.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(r,n,i){var a=r.replacement;if(a||(a=r.replacement=t.makeLayer(r.bb,r.level),a.replaces=r,a.eles=r.eles),!a.reqs)for(var o=0;o<a.eles.length;o++)t.queueLayer(a,a.eles[o])})};dt.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()};dt.queueLayer=function(e,t){var r=this,n=r.layersQueue,i=e.elesQueue,a=i.hasId=i.hasId||{};if(!e.replacement){if(t){if(a[t.id()])return;i.push(t),a[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}};dt.dequeue=function(e){for(var t=this,r=t.layersQueue,n=[],i=0;i<Qy&&r.size()!==0;){var a=r.peek();if(a.replacement){r.pop();continue}if(a.replaces&&a!==a.replaces.replacement){r.pop();continue}if(a.invalid){r.pop();continue}var o=a.elesQueue.shift();o&&(t.drawEleInLayer(a,o,a.level,e),i++),n.length===0&&n.push(!0),a.elesQueue.length===0&&(r.pop(),a.reqs=0,a.replaces&&t.applyLayerReplacement(a),t.requestRedraw())}return n};dt.applyLayerReplacement=function(e){var t=this,r=t.layersByLevel[e.level],n=e.replaces,i=r.indexOf(n);if(!(i<0||n.invalid)){r[i]=e;for(var a=0;a<e.eles.length;a++){var o=e.eles[a]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[e.level]=e)}t.requestRedraw()}};dt.requestRedraw=zn(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100);dt.setupDequeueing=Ph.setupDequeueing({deqRedrawThreshold:qy,deqCost:jy,deqAvgCost:$y,deqNoDrawCost:Zy,deqFastCost:Ky,deq:function(e,t){return e.dequeue(t)},onDeqd:ls,shouldRedraw:Cc,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var zh={},Zu;function r0(e,t){for(var r=0;r<t.length;r++){var n=t[r];e.lineTo(n.x,n.y)}}function n0(e,t,r){for(var n,i=0;i<t.length;i++){var a=t[i];i===0&&(n=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(r.x,r.y,n.x,n.y)}function Ku(e,t,r){e.beginPath&&e.beginPath();for(var n=t,i=0;i<n.length;i++){var a=n[i];e.lineTo(a.x,a.y)}var o=r,s=r[0];e.moveTo(s.x,s.y);for(var i=1;i<o.length;i++){var a=o[i];e.lineTo(a.x,a.y)}e.closePath&&e.closePath()}function i0(e,t,r,n,i){e.beginPath&&e.beginPath(),e.arc(r,n,i,0,Math.PI*2,!1);var a=t,o=a[0];e.moveTo(o.x,o.y);for(var s=0;s<a.length;s++){var u=a[s];e.lineTo(u.x,u.y)}e.closePath&&e.closePath()}function a0(e,t,r,n){e.arc(t,r,n,0,Math.PI*2,!1)}zh.arrowShapeImpl=function(e){return(Zu||(Zu={polygon:r0,"triangle-backcurve":n0,"triangle-tee":Ku,"circle-triangle":i0,"triangle-cross":Ku,circle:a0}))[e]};var Wt={};Wt.drawElement=function(e,t,r,n,i,a){var o=this;t.isNode()?o.drawNode(e,t,r,n,i,a):o.drawEdge(e,t,r,n,i,a)};Wt.drawElementOverlay=function(e,t){var r=this;t.isNode()?r.drawNodeOverlay(e,t):r.drawEdgeOverlay(e,t)};Wt.drawElementUnderlay=function(e,t){var r=this;t.isNode()?r.drawNodeUnderlay(e,t):r.drawEdgeUnderlay(e,t)};Wt.drawCachedElementPortion=function(e,t,r,n,i,a,o,s){var u=this,l=r.getBoundingBox(t);if(!(l.w===0||l.h===0)){var c=r.getElement(t,l,n,i,a);if(c!=null){var h=s(u,t);if(h===0)return;var f=o(u,t),d=l.x1,p=l.y1,v=l.w,m=l.h,g,y,x,T,w;if(f!==0){var D=r.getRotationPoint(t);x=D.x,T=D.y,e.translate(x,T),e.rotate(f),w=u.getImgSmoothing(e),w||u.setImgSmoothing(e,!0);var b=r.getRotationOffset(t);g=b.x,y=b.y}else g=d,y=p;var _;h!==1&&(_=e.globalAlpha,e.globalAlpha=_*h),e.drawImage(c.texture.canvas,c.x,0,c.width,c.height,g,y,v,m),h!==1&&(e.globalAlpha=_),f!==0&&(e.rotate(-f),e.translate(-x,-T),w||u.setImgSmoothing(e,!1))}else r.drawElement(e,t)}};var o0=function(){return 0},s0=function(e,t){return e.getTextAngle(t,null)},l0=function(e,t){return e.getTextAngle(t,"source")},u0=function(e,t){return e.getTextAngle(t,"target")},c0=function(e,t){return t.effectiveOpacity()},_o=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};Wt.drawCachedElement=function(e,t,r,n,i,a){var o=this,s=o.data,u=s.eleTxrCache,l=s.lblTxrCache,c=s.slbTxrCache,h=s.tlbTxrCache,f=t.boundingBox(),d=a===!0?u.reasons.highQuality:null;if(!(f.w===0||f.h===0||!t.visible())&&(!n||ds(f,n))){var p=t.isEdge(),v=t.element()._private.rscratch.badLine;o.drawElementUnderlay(e,t),o.drawCachedElementPortion(e,t,u,r,i,d,o0,c0),(!p||!v)&&o.drawCachedElementPortion(e,t,l,r,i,d,s0,_o),p&&!v&&(o.drawCachedElementPortion(e,t,c,r,i,d,l0,_o),o.drawCachedElementPortion(e,t,h,r,i,d,u0,_o)),o.drawElementOverlay(e,t)}};Wt.drawElements=function(e,t){for(var r=this,n=0;n<t.length;n++){var i=t[n];r.drawElement(e,i)}};Wt.drawCachedElements=function(e,t,r,n){for(var i=this,a=0;a<t.length;a++){var o=t[a];i.drawCachedElement(e,o,r,n)}};Wt.drawCachedNodes=function(e,t,r,n){for(var i=this,a=0;a<t.length;a++){var o=t[a];o.isNode()&&i.drawCachedElement(e,o,r,n)}};Wt.drawLayeredElements=function(e,t,r,n){var i=this,a=i.data.lyrTxrCache.getLayers(t,r);if(a)for(var o=0;o<a.length;o++){var s=a[o],u=s.bb;u.w===0||u.h===0||e.drawImage(s.canvas,u.x1,u.y1,u.w,u.h)}else i.drawCachedElements(e,t,r,n)};var Qt={};Qt.drawEdge=function(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s=t._private.rscratch;if(!(a&&!t.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var u;r&&(u=r,e.translate(-u.x1,-u.y1));var l=a?t.pstyle("opacity").value:1,c=a?t.pstyle("line-opacity").value:1,h=t.pstyle("curve-style").value,f=t.pstyle("line-style").value,d=t.pstyle("width").pfValue,p=t.pstyle("line-cap").value,v=t.pstyle("line-outline-width").value,m=t.pstyle("line-outline-color").value,g=l*c,y=l*c,x=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;h==="straight-triangle"?(o.eleStrokeStyle(e,t,M),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=d,e.lineCap=p,o.eleStrokeStyle(e,t,M),o.drawEdgePath(t,e,s.allpts,f),e.lineCap="butt")},T=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;if(e.lineWidth=d+v,e.lineCap=p,v>0)o.colorStrokeStyle(e,m[0],m[1],m[2],M);else{e.lineCap="butt";return}h==="straight-triangle"?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,f),e.lineCap="butt")},w=function(){i&&o.drawEdgeOverlay(e,t)},D=function(){i&&o.drawEdgeUnderlay(e,t)},b=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;o.drawArrowheads(e,t,M)},_=function(){o.drawElementText(e,t,null,n)};e.lineJoin="round";var E=t.pstyle("ghost").value==="yes";if(E){var A=t.pstyle("ghost-offset-x").pfValue,C=t.pstyle("ghost-offset-y").pfValue,N=t.pstyle("ghost-opacity").value,S=g*N;e.translate(A,C),x(S),b(S),e.translate(-A,-C)}else T();D(),x(),b(),w(),_(),r&&e.translate(u.x1,u.y1)}};var Vh=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,r){if(r.visible()){var n=r.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,a=i.usePaths(),o=r._private.rscratch,s=r.pstyle("".concat(e,"-padding")).pfValue,u=2*s,l=r.pstyle("".concat(e,"-color")).value;t.lineWidth=u,o.edgeType==="self"&&!a?t.lineCap="butt":t.lineCap="round",i.colorStrokeStyle(t,l[0],l[1],l[2],n),i.drawEdgePath(r,t,o.allpts,"solid")}}}};Qt.drawEdgeOverlay=Vh("overlay");Qt.drawEdgeUnderlay=Vh("underlay");Qt.drawEdgePath=function(e,t,r,n){var i=e._private.rscratch,a=t,o,s=!1,u=this.usePaths(),l=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(u){var h=r.join("$"),f=i.pathCacheKey&&i.pathCacheKey===h;f?(o=t=i.pathCache,s=!0):(o=t=new Path2D,i.pathCacheKey=h,i.pathCache=o)}if(a.setLineDash)switch(n){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash(l),a.lineDashOffset=c;break;case"solid":a.setLineDash([]);break}if(!s&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(r[0],r[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+3<r.length;d+=4)t.quadraticCurveTo(r[d],r[d+1],r[d+2],r[d+3]);break;case"straight":case"haystack":for(var p=2;p+1<r.length;p+=2)t.lineTo(r[p],r[p+1]);break;case"segments":if(i.isRound){var v=Ct(i.roundCorners),m;try{for(v.s();!(m=v.n()).done;){var g=m.value;Nh(t,g)}}catch(x){v.e(x)}finally{v.f()}t.lineTo(r[r.length-2],r[r.length-1])}else for(var y=2;y+1<r.length;y+=2)t.lineTo(r[y],r[y+1]);break}t=a,u?t.stroke(o):t.stroke(),t.setLineDash&&t.setLineDash([])};Qt.drawEdgeTrianglePath=function(e,t,r){t.fillStyle=t.strokeStyle;for(var n=e.pstyle("width").pfValue,i=0;i+1<r.length;i+=2){var a=[r[i+2]-r[i],r[i+3]-r[i+1]],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]),s=[a[1]/o,-a[0]/o],u=[s[0]*n/2,s[1]*n/2];t.beginPath(),t.moveTo(r[i]-u[0],r[i+1]-u[1]),t.lineTo(r[i]+u[0],r[i+1]+u[1]),t.lineTo(r[i+2],r[i+3]),t.closePath(),t.fill()}};Qt.drawArrowheads=function(e,t,r){var n=t._private.rscratch,i=n.edgeType==="haystack";i||this.drawArrowhead(e,t,"source",n.arrowStartX,n.arrowStartY,n.srcArrowAngle,r),this.drawArrowhead(e,t,"mid-target",n.midX,n.midY,n.midtgtArrowAngle,r),this.drawArrowhead(e,t,"mid-source",n.midX,n.midY,n.midsrcArrowAngle,r),i||this.drawArrowhead(e,t,"target",n.arrowEndX,n.arrowEndY,n.tgtArrowAngle,r)};Qt.drawArrowhead=function(e,t,r,n,i,a,o){if(!(isNaN(n)||n==null||isNaN(i)||i==null||isNaN(a)||a==null)){var s=this,u=t.pstyle(r+"-arrow-shape").value;if(u!=="none"){var l=t.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",c=t.pstyle(r+"-arrow-fill").value,h=t.pstyle("width").pfValue,f=t.pstyle(r+"-arrow-width"),d=f.value==="match-line"?h:f.pfValue;f.units==="%"&&(d*=h);var p=t.pstyle("opacity").value;o===void 0&&(o=p);var v=e.globalCompositeOperation;(o!==1||c==="hollow")&&(e.globalCompositeOperation="destination-out",s.colorFillStyle(e,255,255,255,1),s.colorStrokeStyle(e,255,255,255,1),s.drawArrowShape(t,e,l,h,u,d,n,i,a),e.globalCompositeOperation=v);var m=t.pstyle(r+"-arrow-color").value;s.colorFillStyle(e,m[0],m[1],m[2],o),s.colorStrokeStyle(e,m[0],m[1],m[2],o),s.drawArrowShape(t,e,c,h,u,d,n,i,a)}}};Qt.drawArrowShape=function(e,t,r,n,i,a,o,s,u){var l=this,c=this.usePaths()&&i!=="triangle-cross",h=!1,f,d=t,p={x:o,y:s},v=e.pstyle("arrow-scale").value,m=this.getArrowWidth(n,v),g=l.arrowShapes[i];if(c){var y=l.arrowPathCache=l.arrowPathCache||[],x=Nr(i),T=y[x];T!=null?(f=t=T,h=!0):(f=t=new Path2D,y[x]=f)}h||(t.beginPath&&t.beginPath(),c?g.draw(t,1,0,{x:0,y:0},1):g.draw(t,m,u,p,n),t.closePath&&t.closePath()),t=d,c&&(t.translate(o,s),t.rotate(u),t.scale(m,m)),(r==="filled"||r==="both")&&(c?t.fill(f):t.fill()),(r==="hollow"||r==="both")&&(t.lineWidth=a/(c?m:1),t.lineJoin="miter",c?t.stroke(f):t.stroke()),c&&(t.scale(1/m,1/m),t.rotate(-u),t.translate(-o,-s))};var Cs={};Cs.safeDrawImage=function(e,t,r,n,i,a,o,s,u,l){if(!(i<=0||a<=0||u<=0||l<=0))try{e.drawImage(t,r,n,i,a,o,s,u,l)}catch(c){Pe(c)}};Cs.drawInscribedImage=function(e,t,r,n,i){var a=this,o=r.position(),s=o.x,u=o.y,l=r.cy().style(),c=l.getIndexedStyle.bind(l),h=c(r,"background-fit","value",n),f=c(r,"background-repeat","value",n),d=r.width(),p=r.height(),v=r.padding()*2,m=d+(c(r,"background-width-relative-to","value",n)==="inner"?0:v),g=p+(c(r,"background-height-relative-to","value",n)==="inner"?0:v),y=r._private.rscratch,x=c(r,"background-clip","value",n),T=x==="node",w=c(r,"background-image-opacity","value",n)*i,D=c(r,"background-image-smoothing","value",n),b=r.pstyle("corner-radius").value;b!=="auto"&&(b=r.pstyle("corner-radius").pfValue);var _=t.width||t.cachedW,E=t.height||t.cachedH;(_==null||E==null)&&(document.body.appendChild(t),_=t.cachedW=t.width||t.offsetWidth,E=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var A=_,C=E;if(c(r,"background-width","value",n)!=="auto"&&(c(r,"background-width","units",n)==="%"?A=c(r,"background-width","pfValue",n)*m:A=c(r,"background-width","pfValue",n)),c(r,"background-height","value",n)!=="auto"&&(c(r,"background-height","units",n)==="%"?C=c(r,"background-height","pfValue",n)*g:C=c(r,"background-height","pfValue",n)),!(A===0||C===0)){if(h==="contain"){var N=Math.min(m/A,g/C);A*=N,C*=N}else if(h==="cover"){var N=Math.max(m/A,g/C);A*=N,C*=N}var S=s-m/2,M=c(r,"background-position-x","units",n),R=c(r,"background-position-x","pfValue",n);M==="%"?S+=(m-A)*R:S+=R;var P=c(r,"background-offset-x","units",n),L=c(r,"background-offset-x","pfValue",n);P==="%"?S+=(m-A)*L:S+=L;var O=u-g/2,I=c(r,"background-position-y","units",n),B=c(r,"background-position-y","pfValue",n);I==="%"?O+=(g-C)*B:O+=B;var F=c(r,"background-offset-y","units",n),z=c(r,"background-offset-y","pfValue",n);F==="%"?O+=(g-C)*z:O+=z,y.pathCache&&(S-=s,O-=u,s=0,u=0);var G=e.globalAlpha;e.globalAlpha=w;var H=a.getImgSmoothing(e),j=!1;if(D==="no"&&H?(a.setImgSmoothing(e,!1),j=!0):D==="yes"&&!H&&(a.setImgSmoothing(e,!0),j=!0),f==="no-repeat")T&&(e.save(),y.pathCache?e.clip(y.pathCache):(a.nodeShapes[a.getNodeShape(r)].draw(e,s,u,m,g,b,y),e.clip())),a.safeDrawImage(e,t,0,0,_,E,S,O,A,C),T&&e.restore();else{var Z=e.createPattern(t,f);e.fillStyle=Z,a.nodeShapes[a.getNodeShape(r)].draw(e,s,u,m,g,b,y),e.translate(S,O),e.fill(),e.translate(-S,-O)}e.globalAlpha=G,j&&a.setImgSmoothing(e,H)}};var Rr={};Rr.eleTextBiggerThanMin=function(e,t){if(!t){var r=e.cy().zoom(),n=this.getPixelRatio(),i=Math.ceil(cs(r*n));t=Math.pow(2,i)}var a=e.pstyle("font-size").pfValue*t,o=e.pstyle("min-zoomed-font-size").pfValue;return!(a<o)};Rr.drawElementText=function(e,t,r,n,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(n==null){if(a&&!o.eleTextBiggerThanMin(t))return}else if(n===!1)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var u=o.getLabelJustification(t);e.textAlign=u,e.textBaseline="bottom"}else{var l=t.element()._private.rscratch.badLine,c=t.pstyle("label"),h=t.pstyle("source-label"),f=t.pstyle("target-label");if(l||(!c||!c.value)&&(!h||!h.value)&&(!f||!f.value))return;e.textAlign="center",e.textBaseline="bottom"}var d=!r,p;r&&(p=r,e.translate(-p.x1,-p.y1)),i==null?(o.drawText(e,t,null,d,a),t.isEdge()&&(o.drawText(e,t,"source",d,a),o.drawText(e,t,"target",d,a))):o.drawText(e,t,i,d,a),r&&e.translate(p.x1,p.y1)};Rr.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if(t=this.fontCaches[r],t.context===e)return t;return t={context:e},this.fontCaches.push(t),t};Rr.setupTextStyle=function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=r?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,u=t.pstyle("text-outline-opacity").value*s,l=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=n+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,l[0],l[1],l[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],u)};function h0(e,t,r,n,i){var a=Math.min(n,i),o=a/2,s=t+n/2,u=r+i/2;e.beginPath(),e.arc(s,u,o,0,Math.PI*2),e.closePath()}function Qu(e,t,r,n,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(a,n/2,i/2);e.beginPath(),e.moveTo(t+o,r),e.lineTo(t+n-o,r),e.quadraticCurveTo(t+n,r,t+n,r+o),e.lineTo(t+n,r+i-o),e.quadraticCurveTo(t+n,r+i,t+n-o,r+i),e.lineTo(t+o,r+i),e.quadraticCurveTo(t,r+i,t,r+i-o),e.lineTo(t,r+o),e.quadraticCurveTo(t,r,t+o,r),e.closePath()}Rr.getTextAngle=function(e,t){var r,n=e._private,i=n.rscratch,a=t?t+"-":"",o=e.pstyle(a+"text-rotation");if(o.strValue==="autorotate"){var s=_t(i,"labelAngle",t);r=e.isEdge()?s:0}else o.strValue==="none"?r=0:r=o.pfValue;return r};Rr.drawText=function(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=t._private,o=a.rscratch,s=i?t.effectiveOpacity():1;if(!(i&&(s===0||t.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var u=_t(o,"labelX",r),l=_t(o,"labelY",r),c,h,f=this.getLabelText(t,r);if(f!=null&&f!==""&&!isNaN(u)&&!isNaN(l)){this.setupTextStyle(e,t,i);var d=r?r+"-":"",p=_t(o,"labelWidth",r),v=_t(o,"labelHeight",r),m=t.pstyle(d+"text-margin-x").pfValue,g=t.pstyle(d+"text-margin-y").pfValue,y=t.isEdge(),x=t.pstyle("text-halign").value,T=t.pstyle("text-valign").value;y&&(x="center",T="center"),u+=m,l+=g;var w;switch(n?w=this.getTextAngle(t,r):w=0,w!==0&&(c=u,h=l,e.translate(c,h),e.rotate(w),u=0,l=0),T){case"top":break;case"center":l+=v/2;break;case"bottom":l+=v;break}var D=t.pstyle("text-background-opacity").value,b=t.pstyle("text-border-opacity").value,_=t.pstyle("text-border-width").pfValue,E=t.pstyle("text-background-padding").pfValue,A=t.pstyle("text-background-shape").strValue,C=A==="round-rectangle"||A==="roundrectangle",N=A==="circle",S=2;if(D>0||_>0&&b>0){var M=e.fillStyle,R=e.strokeStyle,P=e.lineWidth,L=t.pstyle("text-background-color").value,O=t.pstyle("text-border-color").value,I=t.pstyle("text-border-style").value,B=D>0,F=_>0&&b>0,z=u-E;switch(x){case"left":z-=p;break;case"center":z-=p/2;break}var G=l-v-E,H=p+2*E,j=v+2*E;if(B&&(e.fillStyle="rgba(".concat(L[0],",").concat(L[1],",").concat(L[2],",").concat(D*s,")")),F&&(e.strokeStyle="rgba(".concat(O[0],",").concat(O[1],",").concat(O[2],",").concat(b*s,")"),e.lineWidth=_,e.setLineDash))switch(I){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=_/4,e.setLineDash([]);break;case"solid":default:e.setLineDash([]);break}if(C?(e.beginPath(),Qu(e,z,G,H,j,S)):N?(e.beginPath(),h0(e,z,G,H,j)):(e.beginPath(),e.rect(z,G,H,j)),B&&e.fill(),F&&e.stroke(),F&&I==="double"){var Z=_/2;e.beginPath(),C?Qu(e,z+Z,G+Z,H-2*Z,j-2*Z,S):e.rect(z+Z,G+Z,H-2*Z,j-2*Z),e.stroke()}e.fillStyle=M,e.strokeStyle=R,e.lineWidth=P,e.setLineDash&&e.setLineDash([])}var Q=2*t.pstyle("text-outline-width").pfValue;if(Q>0&&(e.lineWidth=Q),t.pstyle("text-wrap").value==="wrap"){var re=_t(o,"labelWrapCachedLines",r),V=_t(o,"labelLineHeight",r),Y=p/2,U=this.getLabelJustification(t);switch(U==="auto"||(x==="left"?U==="left"?u+=-p:U==="center"&&(u+=-Y):x==="center"?U==="left"?u+=-Y:U==="right"&&(u+=Y):x==="right"&&(U==="center"?u+=Y:U==="right"&&(u+=p))),T){case"top":l-=(re.length-1)*V;break;case"center":case"bottom":l-=(re.length-1)*V;break}for(var K=0;K<re.length;K++)Q>0&&e.strokeText(re[K],u,l),e.fillText(re[K],u,l),l+=V}else Q>0&&e.strokeText(f,u,l),e.fillText(f,u,l);w!==0&&(e.rotate(-w),e.translate(-c,-h))}}};var mr={};mr.drawNode=function(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s,u,l=t._private,c=l.rscratch,h=t.position();if(!(!ne(h.x)||!ne(h.y))&&!(a&&!t.visible())){var f=a?t.effectiveOpacity():1,d=o.usePaths(),p,v=!1,m=t.padding();s=t.width()+2*m,u=t.height()+2*m;var g;r&&(g=r,e.translate(-g.x1,-g.y1));for(var y=t.pstyle("background-image"),x=y.value,T=new Array(x.length),w=new Array(x.length),D=0,b=0;b<x.length;b++){var _=x[b],E=T[b]=_!=null&&_!=="none";if(E){var A=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",b);D++,w[b]=o.getCachedImage(_,A,function(){l.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var C=t.pstyle("background-blacken").value,N=t.pstyle("border-width").pfValue,S=t.pstyle("background-opacity").value*f,M=t.pstyle("border-color").value,R=t.pstyle("border-style").value,P=t.pstyle("border-join").value,L=t.pstyle("border-cap").value,O=t.pstyle("border-position").value,I=t.pstyle("border-dash-pattern").pfValue,B=t.pstyle("border-dash-offset").pfValue,F=t.pstyle("border-opacity").value*f,z=t.pstyle("outline-width").pfValue,G=t.pstyle("outline-color").value,H=t.pstyle("outline-style").value,j=t.pstyle("outline-opacity").value*f,Z=t.pstyle("outline-offset").value,Q=t.pstyle("corner-radius").value;Q!=="auto"&&(Q=t.pstyle("corner-radius").pfValue);var re=function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:S;o.eleFillStyle(e,t,ae)},V=function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F;o.colorStrokeStyle(e,M[0],M[1],M[2],ae)},Y=function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:j;o.colorStrokeStyle(e,G[0],G[1],G[2],ae)},U=function(ae,ve,k,X){var W=o.nodePathCache=o.nodePathCache||[],q=Ac(k==="polygon"?k+","+X.join(","):k,""+ve,""+ae,""+Q),$=W[q],oe,J=!1;return $!=null?(oe=$,J=!0,c.pathCache=oe):(oe=new Path2D,W[q]=c.pathCache=oe),{path:oe,cacheHit:J}},K=t.pstyle("shape").strValue,ee=t.pstyle("shape-polygon-points").pfValue;if(d){e.translate(h.x,h.y);var ie=U(s,u,K,ee);p=ie.path,v=ie.cacheHit}var we=function(){if(!v){var ae=h;d&&(ae={x:0,y:0}),o.nodeShapes[o.getNodeShape(t)].draw(p||e,ae.x,ae.y,s,u,Q,c)}d?e.fill(p):e.fill()},ye=function(){for(var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:f,ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,k=l.backgrounding,X=0,W=0;W<w.length;W++){var q=t.cy().style().getIndexedStyle(t,"background-image-containment","value",W);if(ve&&q==="over"||!ve&&q==="inside"){X++;continue}T[W]&&w[W].complete&&!w[W].error&&(X++,o.drawInscribedImage(e,w[W],t,W,ae))}l.backgrounding=X!==D,k!==l.backgrounding&&t.updateStyle(!1)},xe=function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f;o.hasPie(t)&&(o.drawPie(e,t,ve),ae&&(d||o.nodeShapes[o.getNodeShape(t)].draw(e,h.x,h.y,s,u,Q,c)))},Me=function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f;o.hasStripe(t)&&(e.save(),d?e.clip(c.pathCache):(o.nodeShapes[o.getNodeShape(t)].draw(e,h.x,h.y,s,u,Q,c),e.clip()),o.drawStripe(e,t,ve),e.restore(),ae&&(d||o.nodeShapes[o.getNodeShape(t)].draw(e,h.x,h.y,s,u,Q,c)))},te=function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:f,ve=(C>0?C:-C)*ae,k=C>0?0:255;C!==0&&(o.colorFillStyle(e,k,k,k,ve),d?e.fill(p):e.fill())},ue=function(){if(N>0){if(e.lineWidth=N,e.lineCap=L,e.lineJoin=P,e.setLineDash)switch(R){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(I),e.lineDashOffset=B;break;case"solid":case"double":e.setLineDash([]);break}if(O!=="center"){if(e.save(),e.lineWidth*=2,O==="inside")d?e.clip(p):e.clip();else{var ae=new Path2D;ae.rect(-s/2-N,-u/2-N,s+2*N,u+2*N),ae.addPath(p),e.clip(ae,"evenodd")}d?e.stroke(p):e.stroke(),e.restore()}else d?e.stroke(p):e.stroke();if(R==="double"){e.lineWidth=N/3;var ve=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",d?e.stroke(p):e.stroke(),e.globalCompositeOperation=ve}e.setLineDash&&e.setLineDash([])}},ce=function(){if(z>0){if(e.lineWidth=z,e.lineCap="butt",e.setLineDash)switch(H){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}var ae=h;d&&(ae={x:0,y:0});var ve=o.getNodeShape(t),k=N;O==="inside"&&(k=0),O==="outside"&&(k*=2);var X=(s+k+(z+Z))/s,W=(u+k+(z+Z))/u,q=s*X,$=u*W,oe=o.nodeShapes[ve].points,J;if(d){var he=U(q,$,ve,oe);J=he.path}if(ve==="ellipse")o.drawEllipsePath(J||e,ae.x,ae.y,q,$);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(ve)){var le=0,pe=0,Ce=0;ve==="round-diamond"?le=(k+Z+z)*1.4:ve==="round-heptagon"?(le=(k+Z+z)*1.075,Ce=-(k/2+Z+z)/35):ve==="round-hexagon"?le=(k+Z+z)*1.12:ve==="round-pentagon"?(le=(k+Z+z)*1.13,Ce=-(k/2+Z+z)/15):ve==="round-tag"?(le=(k+Z+z)*1.12,pe=(k/2+z+Z)*.07):ve==="round-triangle"&&(le=(k+Z+z)*(Math.PI/2),Ce=-(k+Z/2+z)/Math.PI),le!==0&&(X=(s+le)/s,q=s*X,["round-hexagon","round-tag"].includes(ve)||(W=(u+le)/u,$=u*W)),Q=Q==="auto"?Rc(q,$):Q;for(var Te=q/2,de=$/2,_e=Q+(k+z+Z)/2,Oe=new Array(oe.length/2),qe=new Array(oe.length/2),lt=0;lt<oe.length/2;lt++)Oe[lt]={x:ae.x+pe+Te*oe[lt*2],y:ae.y+Ce+de*oe[lt*2+1]};var yt,je,it,$e,mt=Oe.length;for(je=Oe[mt-1],yt=0;yt<mt;yt++)it=Oe[yt%mt],$e=Oe[(yt+1)%mt],qe[yt]=_s(je,it,$e,_e),je=it,it=$e;o.drawRoundPolygonPath(J||e,ae.x+pe,ae.y+Ce,s*X,u*W,oe,qe)}else if(["roundrectangle","round-rectangle"].includes(ve))Q=Q==="auto"?cr(q,$):Q,o.drawRoundRectanglePath(J||e,ae.x,ae.y,q,$,Q+(k+z+Z)/2);else if(["cutrectangle","cut-rectangle"].includes(ve))Q=Q==="auto"?fs():Q,o.drawCutRectanglePath(J||e,ae.x,ae.y,q,$,null,Q+(k+z+Z)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(ve))Q=Q==="auto"?cr(q,$):Q,o.drawBottomRoundRectanglePath(J||e,ae.x,ae.y,q,$,Q+(k+z+Z)/2);else if(ve==="barrel")o.drawBarrelPath(J||e,ae.x,ae.y,q,$);else if(ve.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(ve)){var Jt=(k+z+Z)/s;oe=Ai(Ci(oe,Jt)),o.drawPolygonPath(J||e,ae.x,ae.y,s,u,oe)}else{var Ze=(k+z+Z)/s;oe=Ai(Ci(oe,-Ze)),o.drawPolygonPath(J||e,ae.x,ae.y,s,u,oe)}if(d?e.stroke(J):e.stroke(),H==="double"){e.lineWidth=k/3;var Nt=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",d?e.stroke(J):e.stroke(),e.globalCompositeOperation=Nt}e.setLineDash&&e.setLineDash([])}},me=function(){i&&o.drawNodeOverlay(e,t,h,s,u)},be=function(){i&&o.drawNodeUnderlay(e,t,h,s,u)},Ee=function(){o.drawElementText(e,t,null,n)},De=t.pstyle("ghost").value==="yes";if(De){var Be=t.pstyle("ghost-offset-x").pfValue,Ve=t.pstyle("ghost-offset-y").pfValue,Ie=t.pstyle("ghost-opacity").value,Se=Ie*f;e.translate(Be,Ve),Y(),ce(),re(Ie*S),we(),ye(Se,!0),V(Ie*F),ue(),xe(C!==0||N!==0),Me(C!==0||N!==0),ye(Se,!1),te(Se),e.translate(-Be,-Ve)}d&&e.translate(-h.x,-h.y),be(),d&&e.translate(h.x,h.y),Y(),ce(),re(),we(),ye(f,!0),V(),ue(),xe(C!==0||N!==0),Me(C!==0||N!==0),ye(f,!1),te(),d&&e.translate(-h.x,-h.y),Ee(),me(),r&&e.translate(g.x1,g.y1)}};var Gh=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,r,n,i,a){var o=this;if(r.visible()){var s=r.pstyle("".concat(e,"-padding")).pfValue,u=r.pstyle("".concat(e,"-opacity")).value,l=r.pstyle("".concat(e,"-color")).value,c=r.pstyle("".concat(e,"-shape")).value,h=r.pstyle("".concat(e,"-corner-radius")).value;if(u>0){if(n=n||r.position(),i==null||a==null){var f=r.padding();i=r.width()+2*f,a=r.height()+2*f}o.colorFillStyle(t,l[0],l[1],l[2],u),o.nodeShapes[c].draw(t,n.x,n.y,i+s*2,a+s*2,h),t.fill()}}}};mr.drawNodeOverlay=Gh("overlay");mr.drawNodeUnderlay=Gh("underlay");mr.hasPie=function(e){return e=e[0],e._private.hasPie};mr.hasStripe=function(e){return e=e[0],e._private.hasStripe};mr.drawPie=function(e,t,r,n){t=t[0],n=n||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=t.pstyle("pie-hole"),s=t.pstyle("pie-start-angle").pfValue,u=n.x,l=n.y,c=t.width(),h=t.height(),f=Math.min(c,h)/2,d,p=0,v=this.usePaths();if(v&&(u=0,l=0),a.units==="%"?f=f*a.pfValue:a.pfValue!==void 0&&(f=a.pfValue/2),o.units==="%"?d=f*o.pfValue:o.pfValue!==void 0&&(d=o.pfValue/2),!(d>=f))for(var m=1;m<=i.pieBackgroundN;m++){var g=t.pstyle("pie-"+m+"-background-size").value,y=t.pstyle("pie-"+m+"-background-color").value,x=t.pstyle("pie-"+m+"-background-opacity").value*r,T=g/100;T+p>1&&(T=1-p);var w=1.5*Math.PI+2*Math.PI*p;w+=s;var D=2*Math.PI*T,b=w+D;g===0||p>=1||p+T>1||(d===0?(e.beginPath(),e.moveTo(u,l),e.arc(u,l,f,w,b),e.closePath()):(e.beginPath(),e.arc(u,l,f,w,b),e.arc(u,l,d,b,w,!0),e.closePath()),this.colorFillStyle(e,y[0],y[1],y[2],x),e.fill(),p+=T)}};mr.drawStripe=function(e,t,r,n){t=t[0],n=n||t.position();var i=t.cy().style(),a=n.x,o=n.y,s=t.width(),u=t.height(),l=0,c=this.usePaths();e.save();var h=t.pstyle("stripe-direction").value,f=t.pstyle("stripe-size");switch(h){case"vertical":break;case"righward":e.rotate(-Math.PI/2);break}var d=s,p=u;f.units==="%"?(d=d*f.pfValue,p=p*f.pfValue):f.pfValue!==void 0&&(d=f.pfValue,p=f.pfValue),c&&(a=0,o=0),o-=d/2,a-=p/2;for(var v=1;v<=i.stripeBackgroundN;v++){var m=t.pstyle("stripe-"+v+"-background-size").value,g=t.pstyle("stripe-"+v+"-background-color").value,y=t.pstyle("stripe-"+v+"-background-opacity").value*r,x=m/100;x+l>1&&(x=1-l),!(m===0||l>=1||l+x>1)&&(e.beginPath(),e.rect(a,o+p*l,d,p*x),e.closePath(),this.colorFillStyle(e,g[0],g[1],g[2],y),e.fill(),l+=x)}e.restore()};var wt={},d0=100;wt.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),r=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/r};wt.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],r=!0,n,i=0;i<t.length;i++)if(n=t[i],n.context===e){r=!1;break}return r&&(n={context:e},t.push(n)),n};wt.createGradientStyleFor=function(e,t,r,n,i){var a,o=this.usePaths(),s=r.pstyle(t+"-gradient-stop-colors").value,u=r.pstyle(t+"-gradient-stop-positions").pfValue;if(n==="radial-gradient")if(r.isEdge()){var l=r.sourceEndpoint(),c=r.targetEndpoint(),h=r.midpoint(),f=kr(l,h),d=kr(c,h);a=e.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(f,d))}else{var p=o?{x:0,y:0}:r.position(),v=r.paddedWidth(),m=r.paddedHeight();a=e.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(v,m))}else if(r.isEdge()){var g=r.sourceEndpoint(),y=r.targetEndpoint();a=e.createLinearGradient(g.x,g.y,y.x,y.y)}else{var x=o?{x:0,y:0}:r.position(),T=r.paddedWidth(),w=r.paddedHeight(),D=T/2,b=w/2,_=r.pstyle("background-gradient-direction").value;switch(_){case"to-bottom":a=e.createLinearGradient(x.x,x.y-b,x.x,x.y+b);break;case"to-top":a=e.createLinearGradient(x.x,x.y+b,x.x,x.y-b);break;case"to-left":a=e.createLinearGradient(x.x+D,x.y,x.x-D,x.y);break;case"to-right":a=e.createLinearGradient(x.x-D,x.y,x.x+D,x.y);break;case"to-bottom-right":case"to-right-bottom":a=e.createLinearGradient(x.x-D,x.y-b,x.x+D,x.y+b);break;case"to-top-right":case"to-right-top":a=e.createLinearGradient(x.x-D,x.y+b,x.x+D,x.y-b);break;case"to-bottom-left":case"to-left-bottom":a=e.createLinearGradient(x.x+D,x.y-b,x.x-D,x.y+b);break;case"to-top-left":case"to-left-top":a=e.createLinearGradient(x.x+D,x.y+b,x.x-D,x.y-b);break}}if(!a)return null;for(var E=u.length===s.length,A=s.length,C=0;C<A;C++)a.addColorStop(E?u[C]:C/(A-1),"rgba("+s[C][0]+","+s[C][1]+","+s[C][2]+","+i+")");return a};wt.gradientFillStyle=function(e,t,r,n){var i=this.createGradientStyleFor(e,"background",t,r,n);if(!i)return null;e.fillStyle=i};wt.colorFillStyle=function(e,t,r,n,i){e.fillStyle="rgba("+t+","+r+","+n+","+i+")"};wt.eleFillStyle=function(e,t,r){var n=t.pstyle("background-fill").value;if(n==="linear-gradient"||n==="radial-gradient")this.gradientFillStyle(e,t,n,r);else{var i=t.pstyle("background-color").value;this.colorFillStyle(e,i[0],i[1],i[2],r)}};wt.gradientStrokeStyle=function(e,t,r,n){var i=this.createGradientStyleFor(e,"line",t,r,n);if(!i)return null;e.strokeStyle=i};wt.colorStrokeStyle=function(e,t,r,n,i){e.strokeStyle="rgba("+t+","+r+","+n+","+i+")"};wt.eleStrokeStyle=function(e,t,r){var n=t.pstyle("line-fill").value;if(n==="linear-gradient"||n==="radial-gradient")this.gradientStrokeStyle(e,t,n,r);else{var i=t.pstyle("line-color").value;this.colorStrokeStyle(e,i[0],i[1],i[2],r)}};wt.matchCanvasSize=function(e){var t=this,r=t.data,n=t.findContainerClientCoords(),i=n[2],a=n[3],o=t.getPixelRatio(),s=t.motionBlurPxRatio;(e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]||e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var u=i*o,l=a*o,c;if(!(u===t.canvasWidth&&l===t.canvasHeight)){t.fontCaches=null;var h=r.canvasContainer;h.style.width=i+"px",h.style.height=a+"px";for(var f=0;f<t.CANVAS_LAYERS;f++)c=r.canvases[f],c.width=u,c.height=l,c.style.width=i+"px",c.style.height=a+"px";for(var f=0;f<t.BUFFER_COUNT;f++)c=r.bufferCanvases[f],c.width=u,c.height=l,c.style.width=i+"px",c.style.height=a+"px";t.textureMult=1,o<=1&&(c=r.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,c.width=u*t.textureMult,c.height=l*t.textureMult),t.canvasWidth=u,t.canvasHeight=l,t.pixelRatio=o}};wt.renderTo=function(e,t,r,n){this.render({forcedContext:e,forcedZoom:t,forcedPan:r,drawAllLayers:!0,forcedPxRatio:n})};wt.clearCanvas=function(){var e=this,t=e.data;function r(n){n.clearRect(0,0,e.canvasWidth,e.canvasHeight)}r(t.contexts[e.NODE]),r(t.contexts[e.DRAG])};wt.render=function(e){var t=this;e=e||kc();var r=t.cy,n=e.forcedContext,i=e.drawAllLayers,a=e.drawOnlyNodeLayer,o=e.forcedZoom,s=e.forcedPan,u=e.forcedPxRatio===void 0?this.getPixelRatio():e.forcedPxRatio,l=t.data,c=l.canvasNeedsRedraw,h=t.textureOnViewport&&!n&&(t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming),f=e.motionBlur!==void 0?e.motionBlur:t.motionBlur,d=t.motionBlurPxRatio,p=r.hasCompoundNodes(),v=t.hoverData.draggingEles,m=!!(t.hoverData.selecting||t.touchData.selecting);f=f&&!n&&t.motionBlurEnabled&&!m;var g=f;n||(t.prevPxRatio!==u&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container),t.redrawHint("eles",!0),t.redrawHint("drag",!0)),t.prevPxRatio=u),!n&&t.motionBlurTimeout&&clearTimeout(t.motionBlurTimeout),f&&(t.mbFrames==null&&(t.mbFrames=0),t.mbFrames++,t.mbFrames<3&&(g=!1),t.mbFrames>t.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!h&&(c[t.NODE]=!0,c[t.SELECT_BOX]=!0);var y=r.style(),x=r.zoom(),T=o!==void 0?o:x,w=r.pan(),D={x:w.x,y:w.y},b={zoom:x,pan:{x:w.x,y:w.y}},_=t.prevViewport,E=_===void 0||b.zoom!==_.zoom||b.pan.x!==_.pan.x||b.pan.y!==_.pan.y;!E&&!(v&&!p)&&(t.motionBlurPxRatio=1),s&&(D=s),T*=u,D.x*=u,D.y*=u;var A=t.getCachedZSortedEles();function C(V,Y,U,K,ee){var ie=V.globalCompositeOperation;V.globalCompositeOperation="destination-out",t.colorFillStyle(V,255,255,255,t.motionBlurTransparency),V.fillRect(Y,U,K,ee),V.globalCompositeOperation=ie}function N(V,Y){var U,K,ee,ie;!t.clearingMotionBlur&&(V===l.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]||V===l.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG])?(U={x:w.x*d,y:w.y*d},K=x*d,ee=t.canvasWidth*d,ie=t.canvasHeight*d):(U=D,K=T,ee=t.canvasWidth,ie=t.canvasHeight),V.setTransform(1,0,0,1,0,0),Y==="motionBlur"?C(V,0,0,ee,ie):!n&&(Y===void 0||Y)&&V.clearRect(0,0,ee,ie),i||(V.translate(U.x,U.y),V.scale(K,K)),s&&V.translate(s.x,s.y),o&&V.scale(o,o)}if(h||(t.textureDrawLastFrame=!1),h){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=r.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var S=t.data.bufferContexts[t.TEXTURE_BUFFER];S.setTransform(1,0,0,1,0,0),S.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:S,drawOnlyNodeLayer:!0,forcedPxRatio:u*t.textureMult});var b=t.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:t.canvasWidth,height:t.canvasHeight};b.mpan={x:(0-b.pan.x)/b.zoom,y:(0-b.pan.y)/b.zoom}}c[t.DRAG]=!1,c[t.NODE]=!1;var M=l.contexts[t.NODE],R=t.textureCache.texture,b=t.textureCache.viewport;M.setTransform(1,0,0,1,0,0),f?C(M,0,0,b.width,b.height):M.clearRect(0,0,b.width,b.height);var P=y.core("outside-texture-bg-color").value,L=y.core("outside-texture-bg-opacity").value;t.colorFillStyle(M,P[0],P[1],P[2],L),M.fillRect(0,0,b.width,b.height);var x=r.zoom();N(M,!1),M.clearRect(b.mpan.x,b.mpan.y,b.width/b.zoom/u,b.height/b.zoom/u),M.drawImage(R,b.mpan.x,b.mpan.y,b.width/b.zoom/u,b.height/b.zoom/u)}else t.textureOnViewport&&!n&&(t.textureCache=null);var O=r.extent(),I=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),B=t.hideEdgesOnViewport&&I,F=[];if(F[t.NODE]=!c[t.NODE]&&f&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,F[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),F[t.DRAG]=!c[t.DRAG]&&f&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,F[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),c[t.NODE]||i||a||F[t.NODE]){var z=f&&!F[t.NODE]&&d!==1,M=n||(z?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:l.contexts[t.NODE]),G=f&&!z?"motionBlur":void 0;N(M,G),B?t.drawCachedNodes(M,A.nondrag,u,O):t.drawLayeredElements(M,A.nondrag,u,O),t.debug&&t.drawDebugPoints(M,A.nondrag),!i&&!f&&(c[t.NODE]=!1)}if(!a&&(c[t.DRAG]||i||F[t.DRAG])){var z=f&&!F[t.DRAG]&&d!==1,M=n||(z?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:l.contexts[t.DRAG]);N(M,f&&!z?"motionBlur":void 0),B?t.drawCachedNodes(M,A.drag,u,O):t.drawCachedElements(M,A.drag,u,O),t.debug&&t.drawDebugPoints(M,A.drag),!i&&!f&&(c[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,N),f&&d!==1){var H=l.contexts[t.NODE],j=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],Z=l.contexts[t.DRAG],Q=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],re=function(V,Y,U){V.setTransform(1,0,0,1,0,0),U||!g?V.clearRect(0,0,t.canvasWidth,t.canvasHeight):C(V,0,0,t.canvasWidth,t.canvasHeight);var K=d;V.drawImage(Y,0,0,t.canvasWidth*K,t.canvasHeight*K,0,0,t.canvasWidth,t.canvasHeight)};(c[t.NODE]||F[t.NODE])&&(re(H,j,F[t.NODE]),c[t.NODE]=!1),(c[t.DRAG]||F[t.DRAG])&&(re(Z,Q,F[t.DRAG]),c[t.DRAG]=!1)}t.prevViewport=b,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),f&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!h,t.mbFrames=0,c[t.NODE]=!0,c[t.DRAG]=!0,t.redraw()},d0)),n||r.emit("render")};var gn;wt.drawSelectionRectangle=function(e,t){var r=this,n=r.cy,i=r.data,a=n.style(),o=e.drawOnlyNodeLayer,s=e.drawAllLayers,u=i.canvasNeedsRedraw,l=e.forcedContext;if(r.showFps||!o&&u[r.SELECT_BOX]&&!s){var c=l||i.contexts[r.SELECT_BOX];if(t(c),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var h=r.cy.zoom(),f=a.core("selection-box-border-width").value/h;c.lineWidth=f,c.fillStyle="rgba("+a.core("selection-box-color").value[0]+","+a.core("selection-box-color").value[1]+","+a.core("selection-box-color").value[2]+","+a.core("selection-box-opacity").value+")",c.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),f>0&&(c.strokeStyle="rgba("+a.core("selection-box-border-color").value[0]+","+a.core("selection-box-border-color").value[1]+","+a.core("selection-box-border-color").value[2]+","+a.core("selection-box-opacity").value+")",c.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]))}if(i.bgActivePosistion&&!r.hoverData.selecting){var h=r.cy.zoom(),d=i.bgActivePosistion;c.fillStyle="rgba("+a.core("active-bg-color").value[0]+","+a.core("active-bg-color").value[1]+","+a.core("active-bg-color").value[2]+","+a.core("active-bg-opacity").value+")",c.beginPath(),c.arc(d.x,d.y,a.core("active-bg-size").pfValue/h,0,2*Math.PI),c.fill()}var p=r.lastRedrawTime;if(r.showFps&&p){p=Math.round(p);var v=Math.round(1e3/p),m="1 frame = "+p+" ms = "+v+" fps";if(c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",!gn){var g=c.measureText(m);gn=g.actualBoundingBoxAscent}c.fillText(m,0,gn);var y=60;c.strokeRect(0,gn+10,250,20),c.fillRect(0,gn+10,250*Math.min(v/y,1),20)}s||(u[r.SELECT_BOX]=!1)}};function Ju(e,t,r){var n=e.createShader(t);if(e.shaderSource(n,r),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(n));return n}function f0(e,t,r){var n=Ju(e,e.VERTEX_SHADER,t),i=Ju(e,e.FRAGMENT_SHADER,r),a=e.createProgram();if(e.attachShader(a,n),e.attachShader(a,i),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw new Error("Could not initialize shaders");return a}function p0(e,t,r){r===void 0&&(r=t);var n=e.makeOffscreenCanvas(t,r),i=n.context=n.getContext("2d");return n.clear=function(){return i.clearRect(0,0,n.width,n.height)},n.clear(),n}function Ds(e){var t=e.pixelRatio,r=e.cy.zoom(),n=e.cy.pan();return{zoom:r*t,pan:{x:n.x*t,y:n.y*t}}}function g0(e){var t=e.pixelRatio,r=e.cy.zoom();return r*t}function v0(e,t,r,n,i){var a=n*r+t.x,o=i*r+t.y;return o=Math.round(e.canvasHeight-o),[a,o]}function y0(e){return e.pstyle("background-fill").value!=="solid"||e.pstyle("background-image").strValue!=="none"?!1:e.pstyle("border-width").value===0||e.pstyle("border-opacity").value===0?!0:e.pstyle("border-style").value==="solid"}function m0(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function Er(e,t,r){var n=e[0]/255,i=e[1]/255,a=e[2]/255,o=t,s=r||new Array(4);return s[0]=n*o,s[1]=i*o,s[2]=a*o,s[3]=o,s}function Yr(e,t){var r=t||new Array(4);return r[0]=(e>>0&255)/255,r[1]=(e>>8&255)/255,r[2]=(e>>16&255)/255,r[3]=(e>>24&255)/255,r}function b0(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function x0(e,t){var r=e.createTexture();return r.buffer=function(n){e.bindTexture(e.TEXTURE_2D,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},r.deleteTexture=function(){e.deleteTexture(r)},r}function Yh(e,t){switch(t){case"float":return[1,e.FLOAT,4];case"vec2":return[2,e.FLOAT,4];case"vec3":return[3,e.FLOAT,4];case"vec4":return[4,e.FLOAT,4];case"int":return[1,e.INT,4];case"ivec2":return[2,e.INT,4]}}function Uh(e,t,r){switch(t){case e.FLOAT:return new Float32Array(r);case e.INT:return new Int32Array(r)}}function w0(e,t,r,n,i,a){switch(t){case e.FLOAT:return new Float32Array(r.buffer,a*n,i);case e.INT:return new Int32Array(r.buffer,a*n,i)}}function E0(e,t,r,n){var i=Yh(e,t),a=Qe(i,2),o=a[0],s=a[1],u=Uh(e,s,n),l=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,l),e.bufferData(e.ARRAY_BUFFER,u,e.STATIC_DRAW),s===e.FLOAT?e.vertexAttribPointer(r,o,s,!1,0,0):s===e.INT&&e.vertexAttribIPointer(r,o,s,0,0),e.enableVertexAttribArray(r),e.bindBuffer(e.ARRAY_BUFFER,null),l}function Vt(e,t,r,n){var i=Yh(e,r),a=Qe(i,3),o=a[0],s=a[1],u=a[2],l=Uh(e,s,t*o),c=o*u,h=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,h),e.bufferData(e.ARRAY_BUFFER,t*c,e.DYNAMIC_DRAW),e.enableVertexAttribArray(n),s===e.FLOAT?e.vertexAttribPointer(n,o,s,!1,c,0):s===e.INT&&e.vertexAttribIPointer(n,o,s,c,0),e.vertexAttribDivisor(n,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var f=new Array(t),d=0;d<t;d++)f[d]=w0(e,s,l,c,o,d);return h.dataArray=l,h.stride=c,h.size=o,h.getView=function(p){return f[p]},h.setPoint=function(p,v,m){var g=f[p];g[0]=v,g[1]=m},h.bufferSubData=function(p){e.bindBuffer(e.ARRAY_BUFFER,h),p?e.bufferSubData(e.ARRAY_BUFFER,0,l,0,p*o):e.bufferSubData(e.ARRAY_BUFFER,0,l)},h}function T0(e,t,r){for(var n=9,i=new Float32Array(t*n),a=new Array(t),o=0;o<t;o++){var s=o*n*4;a[o]=new Float32Array(i.buffer,s,n)}var u=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,i.byteLength,e.DYNAMIC_DRAW);for(var l=0;l<3;l++){var c=r+l;e.enableVertexAttribArray(c),e.vertexAttribPointer(c,3,e.FLOAT,!1,36,l*12),e.vertexAttribDivisor(c,1)}return e.bindBuffer(e.ARRAY_BUFFER,null),u.getMatrixView=function(h){return a[h]},u.setData=function(h,f){a[f].set(h,0)},u.bufferSubData=function(){e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferSubData(e.ARRAY_BUFFER,0,i)},u}function _0(e){var t=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,t);var r=e.createTexture();return e.bindTexture(e.TEXTURE_2D,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0),e.bindFramebuffer(e.FRAMEBUFFER,null),t.setFramebufferAttachmentSizes=function(n,i){e.bindTexture(e.TEXTURE_2D,r),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n,i,0,e.RGBA,e.UNSIGNED_BYTE,null)},t}var ec=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function Ao(){var e=new ec(9);return ec!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function tc(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function A0(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],l=t[6],c=t[7],h=t[8],f=r[0],d=r[1],p=r[2],v=r[3],m=r[4],g=r[5],y=r[6],x=r[7],T=r[8];return e[0]=f*n+d*o+p*l,e[1]=f*i+d*s+p*c,e[2]=f*a+d*u+p*h,e[3]=v*n+m*o+g*l,e[4]=v*i+m*s+g*c,e[5]=v*a+m*u+g*h,e[6]=y*n+x*o+T*l,e[7]=y*i+x*s+T*c,e[8]=y*a+x*u+T*h,e}function mi(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],l=t[6],c=t[7],h=t[8],f=r[0],d=r[1];return e[0]=n,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=u,e[6]=f*n+d*o+l,e[7]=f*i+d*s+c,e[8]=f*a+d*u+h,e}function rc(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],l=t[6],c=t[7],h=t[8],f=Math.sin(r),d=Math.cos(r);return e[0]=d*n+f*o,e[1]=d*i+f*s,e[2]=d*a+f*u,e[3]=d*o-f*n,e[4]=d*s-f*i,e[5]=d*u-f*a,e[6]=l,e[7]=c,e[8]=h,e}function jo(e,t,r){var n=r[0],i=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function C0(e,t,r){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}var D0=function(){function e(t,r,n,i){gr(this,e),this.debugID=Math.floor(Math.random()*1e4),this.r=t,this.texSize=r,this.texRows=n,this.texHeight=Math.floor(r/n),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=i(t,r,r),this.scratch=i(t,r,this.texHeight,"scratch")}return vr(e,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(t){var r=t.w,n=t.h,i=this.texHeight,a=this.texSize,o=i/n,s=r*o,u=n*o;return s>a&&(o=a/r,s=r*o,u=n*o),{scale:o,texW:s,texH:u}}},{key:"draw",value:function(t,r,n){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var a=this.texSize,o=this.texRows,s=this.texHeight,u=this.getScale(r),l=u.scale,c=u.texW,h=u.texH,f=function(g,y){if(n&&y){var x=y.context,T=g.x,w=g.row,D=T,b=s*w;x.save(),x.translate(D,b),x.scale(l,l),n(x,r),x.restore()}},d=[null,null],p=function(){f(i.freePointer,i.canvas),d[0]={x:i.freePointer.x,y:i.freePointer.row*s,w:c,h},d[1]={x:i.freePointer.x+c,y:i.freePointer.row*s,w:0,h},i.freePointer.x+=c,i.freePointer.x==a&&(i.freePointer.x=0,i.freePointer.row++)},v=function(){var g=i.scratch,y=i.canvas;g.clear(),f({x:0,row:0},g);var x=a-i.freePointer.x,T=c-x,w=s;{var D=i.freePointer.x,b=i.freePointer.row*s,_=x;y.context.drawImage(g,0,0,_,w,D,b,_,w),d[0]={x:D,y:b,w:_,h}}{var E=x,A=(i.freePointer.row+1)*s,C=T;y&&y.context.drawImage(g,E,0,C,w,0,A,C,w),d[1]={x:0,y:A,w:C,h}}i.freePointer.x=T,i.freePointer.row++},m=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+c<=a)p();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===a?(m(),p()):this.enableWrapping?v():(m(),p())}return this.keyToLocation.set(t,d),this.needsBuffer=!0,d}},{key:"getOffsets",value:function(t){return this.keyToLocation.get(t)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(t){if(this.locked)return!1;var r=this.texSize,n=this.texRows,i=this.getScale(t),a=i.texW;return this.freePointer.x+a>r?this.freePointer.row<n-1:!0}},{key:"bufferIfNeeded",value:function(t){this.texture||(this.texture=x0(t,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])}(),N0=function(){function e(t,r,n,i){gr(this,e),this.r=t,this.texSize=r,this.texRows=n,this.createTextureCanvas=i,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return vr(e,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var t=this.r,r=this.texSize,n=this.texRows,i=this.createTextureCanvas;return new D0(t,r,n,i)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var t=this.r,r=this.texSize,n=this.texRows,i=this.createTextureCanvas,a=Math.floor(r/n);this.scratch=i(t,r,a,"scratch")}return this.scratch}},{key:"draw",value:function(t,r,n){var i=this.styleKeyToAtlas.get(t);return i||(i=this.atlases[this.atlases.length-1],(!i||!i.canFit(r))&&(i&&i.lock(),i=this._createAtlas(),this.atlases.push(i)),i.draw(t,r,n),this.styleKeyToAtlas.set(t,i)),i}},{key:"getAtlas",value:function(t){return this.styleKeyToAtlas.get(t)}},{key:"hasAtlas",value:function(t){return this.styleKeyToAtlas.has(t)}},{key:"markKeyForGC",value:function(t){this.markedKeys.add(t)}},{key:"gc",value:function(){var t=this,r=this.markedKeys;if(r.size===0){console.log("nothing to garbage collect");return}var n=[],i=new Map,a=null,o=Ct(this.atlases),s;try{var u=function(){var l=s.value,c=l.getKeys(),h=k0(r,c);if(h.size===0)return n.push(l),c.forEach(function(x){return i.set(x,l)}),1;a||(a=t._createAtlas(),n.push(a));var f=Ct(c),d;try{for(f.s();!(d=f.n()).done;){var p=d.value;if(!h.has(p)){var v=l.getOffsets(p),m=Qe(v,2),g=m[0],y=m[1];a.canFit({w:g.w+y.w,h:g.h})||(a.lock(),a=t._createAtlas(),n.push(a)),l.canvas&&(t._copyTextureToNewAtlas(p,l,a),i.set(p,a))}}}catch(x){f.e(x)}finally{f.f()}l.dispose()};for(o.s();!(s=o.n()).done;)u()}catch(l){o.e(l)}finally{o.f()}this.atlases=n,this.styleKeyToAtlas=i,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(t,r,n){var i=r.getOffsets(t),a=Qe(i,2),o=a[0],s=a[1];if(s.w===0)n.draw(t,o,function(h){h.drawImage(r.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h)});else{var u=this._getScratchCanvas();u.clear(),u.context.drawImage(r.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h),u.context.drawImage(r.canvas,s.x,s.y,s.w,s.h,o.w,0,s.w,s.h);var l=o.w+s.w,c=o.h;n.draw(t,{w:l,h:c},function(h){h.drawImage(u,0,0,l,c,0,0,l,c)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])}();function k0(e,t){return e.intersection?e.intersection(t):new Set(wi(e).filter(function(r){return t.has(r)}))}var M0=function(){function e(t,r){gr(this,e),this.r=t,this.globalOptions=r,this.atlasSize=r.webglTexSize,this.maxAtlasesPerBatch=r.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return vr(e,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(t,r){var n=this.globalOptions,i=n.webglTexSize,a=n.createTextureCanvas,o=r.texRows,s=this._cacheScratchCanvas(a),u=new N0(this.r,i,o,s);this.collections.set(t,u)}},{key:"addRenderType",value:function(t,r){var n=r.collection;if(!this.collections.has(n))throw new Error("invalid atlas collection name '".concat(n,"'"));var i=this.collections.get(n),a=ge({type:t,atlasCollection:i},r);this.renderTypes.set(t,a)}},{key:"getRenderTypeOpts",value:function(t){return this.renderTypes.get(t)}},{key:"getAtlasCollection",value:function(t){return this.collections.get(t)}},{key:"_cacheScratchCanvas",value:function(t){var r=-1,n=-1,i=null;return function(a,o,s,u){return u?((!i||o!=r||s!=n)&&(r=o,n=s,i=t(a,o,s)),i):t(a,o,s)}}},{key:"_key",value:function(t,r){return"".concat(t,"-").concat(r)}},{key:"invalidate",value:function(t){var r=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.forceRedraw,a=i===void 0?!1:i,o=n.filterEle,s=o===void 0?function(){return!0}:o,u=n.filterType,l=u===void 0?function(){return!0}:u,c=!1,h=!1,f=Ct(t),d;try{for(f.s();!(d=f.n()).done;){var p=d.value;if(s(p)){var v=Ct(this.renderTypes.values()),m;try{var g=function(){var y=m.value,x=y.type;if(l(x)){var T=r.collections.get(y.collection),w=y.getKey(p),D=Array.isArray(w)?w:[w];if(a)D.forEach(function(A){return T.markKeyForGC(A)}),h=!0;else{var b=y.getID?y.getID(p):p.id(),_=r._key(x,b),E=r.typeAndIdToKey.get(_);E!==void 0&&!m0(D,E)&&(c=!0,r.typeAndIdToKey.delete(_),E.forEach(function(A){return T.markKeyForGC(A)}))}}};for(v.s();!(m=v.n()).done;)g()}catch(y){v.e(y)}finally{v.f()}}}}catch(y){f.e(y)}finally{f.f()}return h&&(this.gc(),c=!1),c}},{key:"gc",value:function(){var t=Ct(this.collections.values()),r;try{for(t.s();!(r=t.n()).done;){var n=r.value;n.gc()}}catch(i){t.e(i)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(t,r,n,i){var a=this.renderTypes.get(r),o=this.collections.get(a.collection),s=!1,u=o.draw(i,n,function(h){a.drawClipped?(h.save(),h.beginPath(),h.rect(0,0,n.w,n.h),h.clip(),a.drawElement(h,t,n,!0,!0),h.restore()):a.drawElement(h,t,n,!0,!0),s=!0});if(s){var l=a.getID?a.getID(t):t.id(),c=this._key(r,l);this.typeAndIdToKey.has(c)?this.typeAndIdToKey.get(c).push(i):this.typeAndIdToKey.set(c,[i])}return u}},{key:"getAtlasInfo",value:function(t,r){var n=this,i=this.renderTypes.get(r),a=i.getKey(t),o=Array.isArray(a)?a:[a];return o.map(function(s){var u=i.getBoundingBox(t,s),l=n.getOrCreateAtlas(t,r,u,s),c=l.getOffsets(s),h=Qe(c,2),f=h[0],d=h[1];return{atlas:l,tex:f,tex1:f,tex2:d,bb:u}})}},{key:"getDebugInfo",value:function(){var t=[],r=Ct(this.collections),n;try{for(r.s();!(n=r.n()).done;){var i=Qe(n.value,2),a=i[0],o=i[1],s=o.getCounts(),u=s.keyCount,l=s.atlasCount;t.push({type:a,keyCount:u,atlasCount:l})}}catch(c){r.e(c)}finally{r.f()}return t}}])}(),S0=function(){function e(t){gr(this,e),this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.batchAtlases=[]}return vr(e,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(t,r){return r})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(t){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(t):!0}},{key:"getAtlasIndexForBatch",value:function(t){var r=this.batchAtlases.indexOf(t);if(r<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(t),r=this.batchAtlases.length-1}return r}}])}(),L0=`
|
|
18
|
-
float circleSD(vec2 p, float r) {
|
|
19
|
-
return distance(vec2(0), p) - r; // signed distance
|
|
20
|
-
}
|
|
21
|
-
`,I0=`
|
|
22
|
-
float rectangleSD(vec2 p, vec2 b) {
|
|
23
|
-
vec2 d = abs(p)-b;
|
|
24
|
-
return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
|
|
25
|
-
}
|
|
26
|
-
`,O0=`
|
|
27
|
-
float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
|
|
28
|
-
cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
|
|
29
|
-
cr.x = (p.y > 0.0) ? cr.x : cr.y;
|
|
30
|
-
vec2 q = abs(p) - b + cr.x;
|
|
31
|
-
return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
|
|
32
|
-
}
|
|
33
|
-
`,R0=`
|
|
34
|
-
float ellipseSD(vec2 p, vec2 ab) {
|
|
35
|
-
p = abs( p ); // symmetry
|
|
36
|
-
|
|
37
|
-
// find root with Newton solver
|
|
38
|
-
vec2 q = ab*(p-ab);
|
|
39
|
-
float w = (q.x<q.y)? 1.570796327 : 0.0;
|
|
40
|
-
for( int i=0; i<5; i++ ) {
|
|
41
|
-
vec2 cs = vec2(cos(w),sin(w));
|
|
42
|
-
vec2 u = ab*vec2( cs.x,cs.y);
|
|
43
|
-
vec2 v = ab*vec2(-cs.y,cs.x);
|
|
44
|
-
w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// compute final point and distance
|
|
48
|
-
float d = length(p-ab*vec2(cos(w),sin(w)));
|
|
49
|
-
|
|
50
|
-
// return signed distance
|
|
51
|
-
return (dot(p/ab,p/ab)>1.0) ? d : -d;
|
|
52
|
-
}
|
|
53
|
-
`,Tn={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Ii={IGNORE:1,USE_BB:2},Co=0,nc=1,ic=2,Do=3,Ur=4,li=5,vn=6,yn=7,P0=function(){function e(t,r,n){gr(this,e),this.r=t,this.gl=r,this.maxInstances=n.webglBatchSize,this.atlasSize=n.webglTexSize,this.bgColor=n.bgColor,this.debug=n.webglDebug,this.batchDebugInfo=[],n.enableWrapping=!0,n.createTextureCanvas=p0,this.atlasManager=new M0(t,n),this.batchManager=new S0(n),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Tn.SCREEN),this.pickingProgram=this._createShaderProgram(Tn.PICKING),this.vao=this._createVAO()}return vr(e,[{key:"addAtlasCollection",value:function(t,r){this.atlasManager.addAtlasCollection(t,r)}},{key:"addTextureAtlasRenderType",value:function(t,r){this.atlasManager.addRenderType(t,r)}},{key:"addSimpleShapeRenderType",value:function(t,r){this.simpleShapeOptions.set(t,r)}},{key:"invalidate",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=r.type,i=this.atlasManager;return n?i.invalidate(t,{filterType:function(a){return a===n},forceRedraw:!0}):i.invalidate(t)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(t){var r=this.gl,n=`#version 300 es
|
|
54
|
-
precision highp float;
|
|
55
|
-
|
|
56
|
-
uniform mat3 uPanZoomMatrix;
|
|
57
|
-
uniform int uAtlasSize;
|
|
58
|
-
|
|
59
|
-
// instanced
|
|
60
|
-
in vec2 aPosition; // a vertex from the unit square
|
|
61
|
-
|
|
62
|
-
in mat3 aTransform; // used to transform verticies, eg into a bounding box
|
|
63
|
-
in int aVertType; // the type of thing we are rendering
|
|
64
|
-
|
|
65
|
-
// the z-index that is output when using picking mode
|
|
66
|
-
in vec4 aIndex;
|
|
67
|
-
|
|
68
|
-
// For textures
|
|
69
|
-
in int aAtlasId; // which shader unit/atlas to use
|
|
70
|
-
in vec4 aTex; // x/y/w/h of texture in atlas
|
|
71
|
-
|
|
72
|
-
// for edges
|
|
73
|
-
in vec4 aPointAPointB;
|
|
74
|
-
in vec4 aPointCPointD;
|
|
75
|
-
in vec2 aLineWidth; // also used for node border width
|
|
76
|
-
|
|
77
|
-
// simple shapes
|
|
78
|
-
in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
|
|
79
|
-
in vec4 aColor; // also used for edges
|
|
80
|
-
in vec4 aBorderColor; // aLineWidth is used for border width
|
|
81
|
-
|
|
82
|
-
// output values passed to the fragment shader
|
|
83
|
-
out vec2 vTexCoord;
|
|
84
|
-
out vec4 vColor;
|
|
85
|
-
out vec2 vPosition;
|
|
86
|
-
// flat values are not interpolated
|
|
87
|
-
flat out int vAtlasId;
|
|
88
|
-
flat out int vVertType;
|
|
89
|
-
flat out vec2 vTopRight;
|
|
90
|
-
flat out vec2 vBotLeft;
|
|
91
|
-
flat out vec4 vCornerRadius;
|
|
92
|
-
flat out vec4 vBorderColor;
|
|
93
|
-
flat out vec2 vBorderWidth;
|
|
94
|
-
flat out vec4 vIndex;
|
|
95
|
-
|
|
96
|
-
void main(void) {
|
|
97
|
-
int vid = gl_VertexID;
|
|
98
|
-
vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
|
|
99
|
-
|
|
100
|
-
if(aVertType == `.concat(Co,`) {
|
|
101
|
-
float texX = aTex.x; // texture coordinates
|
|
102
|
-
float texY = aTex.y;
|
|
103
|
-
float texW = aTex.z;
|
|
104
|
-
float texH = aTex.w;
|
|
105
|
-
|
|
106
|
-
if(vid == 1 || vid == 2 || vid == 4) {
|
|
107
|
-
texX += texW;
|
|
108
|
-
}
|
|
109
|
-
if(vid == 2 || vid == 4 || vid == 5) {
|
|
110
|
-
texY += texH;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
float d = float(uAtlasSize);
|
|
114
|
-
vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
|
|
115
|
-
|
|
116
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
117
|
-
}
|
|
118
|
-
else if(aVertType == `).concat(Ur," || aVertType == ").concat(yn,`
|
|
119
|
-
|| aVertType == `).concat(li," || aVertType == ").concat(vn,`) { // simple shapes
|
|
120
|
-
|
|
121
|
-
// the bounding box is needed by the fragment shader
|
|
122
|
-
vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
|
|
123
|
-
vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
|
|
124
|
-
vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
|
|
125
|
-
|
|
126
|
-
// calculations are done in the fragment shader, just pass these along
|
|
127
|
-
vColor = aColor;
|
|
128
|
-
vCornerRadius = aCornerRadius;
|
|
129
|
-
vBorderColor = aBorderColor;
|
|
130
|
-
vBorderWidth = aLineWidth;
|
|
131
|
-
|
|
132
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
133
|
-
}
|
|
134
|
-
else if(aVertType == `).concat(nc,`) {
|
|
135
|
-
vec2 source = aPointAPointB.xy;
|
|
136
|
-
vec2 target = aPointAPointB.zw;
|
|
137
|
-
|
|
138
|
-
// adjust the geometry so that the line is centered on the edge
|
|
139
|
-
position.y = position.y - 0.5;
|
|
140
|
-
|
|
141
|
-
// stretch the unit square into a long skinny rectangle
|
|
142
|
-
vec2 xBasis = target - source;
|
|
143
|
-
vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
|
|
144
|
-
vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
|
|
145
|
-
|
|
146
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
|
|
147
|
-
vColor = aColor;
|
|
148
|
-
}
|
|
149
|
-
else if(aVertType == `).concat(ic,`) {
|
|
150
|
-
vec2 pointA = aPointAPointB.xy;
|
|
151
|
-
vec2 pointB = aPointAPointB.zw;
|
|
152
|
-
vec2 pointC = aPointCPointD.xy;
|
|
153
|
-
vec2 pointD = aPointCPointD.zw;
|
|
154
|
-
|
|
155
|
-
// adjust the geometry so that the line is centered on the edge
|
|
156
|
-
position.y = position.y - 0.5;
|
|
157
|
-
|
|
158
|
-
vec2 p0, p1, p2, pos;
|
|
159
|
-
if(position.x == 0.0) { // The left side of the unit square
|
|
160
|
-
p0 = pointA;
|
|
161
|
-
p1 = pointB;
|
|
162
|
-
p2 = pointC;
|
|
163
|
-
pos = position;
|
|
164
|
-
} else { // The right side of the unit square, use same approach but flip the geometry upside down
|
|
165
|
-
p0 = pointD;
|
|
166
|
-
p1 = pointC;
|
|
167
|
-
p2 = pointB;
|
|
168
|
-
pos = vec2(0.0, -position.y);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
vec2 p01 = p1 - p0;
|
|
172
|
-
vec2 p12 = p2 - p1;
|
|
173
|
-
vec2 p21 = p1 - p2;
|
|
174
|
-
|
|
175
|
-
// Find the normal vector.
|
|
176
|
-
vec2 tangent = normalize(normalize(p12) + normalize(p01));
|
|
177
|
-
vec2 normal = vec2(-tangent.y, tangent.x);
|
|
178
|
-
|
|
179
|
-
// Find the vector perpendicular to p0 -> p1.
|
|
180
|
-
vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
|
|
181
|
-
|
|
182
|
-
// Determine the bend direction.
|
|
183
|
-
float sigma = sign(dot(p01 + p21, normal));
|
|
184
|
-
float width = aLineWidth[0];
|
|
185
|
-
|
|
186
|
-
if(sign(pos.y) == -sigma) {
|
|
187
|
-
// This is an intersecting vertex. Adjust the position so that there's no overlap.
|
|
188
|
-
vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
|
|
189
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
190
|
-
} else {
|
|
191
|
-
// This is a non-intersecting vertex. Treat it like a mitre join.
|
|
192
|
-
vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
|
|
193
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
vColor = aColor;
|
|
197
|
-
}
|
|
198
|
-
else if(aVertType == `).concat(Do,` && vid < 3) {
|
|
199
|
-
// massage the first triangle into an edge arrow
|
|
200
|
-
if(vid == 0)
|
|
201
|
-
position = vec2(-0.15, -0.3);
|
|
202
|
-
if(vid == 1)
|
|
203
|
-
position = vec2( 0.0, 0.0);
|
|
204
|
-
if(vid == 2)
|
|
205
|
-
position = vec2( 0.15, -0.3);
|
|
206
|
-
|
|
207
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
208
|
-
vColor = aColor;
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
vAtlasId = aAtlasId;
|
|
215
|
-
vVertType = aVertType;
|
|
216
|
-
vIndex = aIndex;
|
|
217
|
-
}
|
|
218
|
-
`),i=this.batchManager.getIndexArray(),a=`#version 300 es
|
|
219
|
-
precision highp float;
|
|
220
|
-
|
|
221
|
-
// declare texture unit for each texture atlas in the batch
|
|
222
|
-
`.concat(i.map(function(u){return"uniform sampler2D uTexture".concat(u,";")}).join(`
|
|
223
|
-
`),`
|
|
224
|
-
|
|
225
|
-
uniform vec4 uBGColor;
|
|
226
|
-
uniform float uZoom;
|
|
227
|
-
|
|
228
|
-
in vec2 vTexCoord;
|
|
229
|
-
in vec4 vColor;
|
|
230
|
-
in vec2 vPosition; // model coordinates
|
|
231
|
-
|
|
232
|
-
flat in int vAtlasId;
|
|
233
|
-
flat in vec4 vIndex;
|
|
234
|
-
flat in int vVertType;
|
|
235
|
-
flat in vec2 vTopRight;
|
|
236
|
-
flat in vec2 vBotLeft;
|
|
237
|
-
flat in vec4 vCornerRadius;
|
|
238
|
-
flat in vec4 vBorderColor;
|
|
239
|
-
flat in vec2 vBorderWidth;
|
|
240
|
-
|
|
241
|
-
out vec4 outColor;
|
|
242
|
-
|
|
243
|
-
`).concat(L0,`
|
|
244
|
-
`).concat(I0,`
|
|
245
|
-
`).concat(O0,`
|
|
246
|
-
`).concat(R0,`
|
|
247
|
-
|
|
248
|
-
vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
|
|
249
|
-
return vec4(
|
|
250
|
-
top.rgb + (bot.rgb * (1.0 - top.a)),
|
|
251
|
-
top.a + (bot.a * (1.0 - top.a))
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
|
|
256
|
-
// scale to the zoom level so that borders don't look blurry when zoomed in
|
|
257
|
-
// note 1.5 is an aribitrary value chosen because it looks good
|
|
258
|
-
return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
void main(void) {
|
|
262
|
-
if(vVertType == `).concat(Co,`) {
|
|
263
|
-
// look up the texel from the texture unit
|
|
264
|
-
`).concat(i.map(function(u){return"if(vAtlasId == ".concat(u,") outColor = texture(uTexture").concat(u,", vTexCoord);")}).join(`
|
|
265
|
-
else `),`
|
|
266
|
-
}
|
|
267
|
-
else if(vVertType == `).concat(Do,`) {
|
|
268
|
-
// mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
|
|
269
|
-
outColor = blend(vColor, uBGColor);
|
|
270
|
-
outColor.a = 1.0; // make opaque, masks out line under arrow
|
|
271
|
-
}
|
|
272
|
-
else if(vVertType == `).concat(Ur,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
|
|
273
|
-
outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
|
|
274
|
-
}
|
|
275
|
-
else if(vVertType == `).concat(Ur," || vVertType == ").concat(yn,`
|
|
276
|
-
|| vVertType == `).concat(li," || vVertType == ").concat(vn,`) { // use SDF
|
|
277
|
-
|
|
278
|
-
float outerBorder = vBorderWidth[0];
|
|
279
|
-
float innerBorder = vBorderWidth[1];
|
|
280
|
-
float borderPadding = outerBorder * 2.0;
|
|
281
|
-
float w = vTopRight.x - vBotLeft.x - borderPadding;
|
|
282
|
-
float h = vTopRight.y - vBotLeft.y - borderPadding;
|
|
283
|
-
vec2 b = vec2(w/2.0, h/2.0); // half width, half height
|
|
284
|
-
vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
|
|
285
|
-
|
|
286
|
-
float d; // signed distance
|
|
287
|
-
if(vVertType == `).concat(Ur,`) {
|
|
288
|
-
d = rectangleSD(p, b);
|
|
289
|
-
} else if(vVertType == `).concat(yn,` && w == h) {
|
|
290
|
-
d = circleSD(p, b.x); // faster than ellipse
|
|
291
|
-
} else if(vVertType == `).concat(yn,`) {
|
|
292
|
-
d = ellipseSD(p, b);
|
|
293
|
-
} else {
|
|
294
|
-
d = roundRectangleSD(p, b, vCornerRadius.wzyx);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
// use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
|
|
298
|
-
// we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
|
|
299
|
-
if(d > 0.0) {
|
|
300
|
-
if(d > outerBorder) {
|
|
301
|
-
discard;
|
|
302
|
-
} else {
|
|
303
|
-
outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
|
|
304
|
-
}
|
|
305
|
-
} else {
|
|
306
|
-
if(d > innerBorder) {
|
|
307
|
-
vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
|
|
308
|
-
vec4 innerBorderColor = blend(vBorderColor, vColor);
|
|
309
|
-
outColor = distInterp(innerBorderColor, outerColor, d);
|
|
310
|
-
}
|
|
311
|
-
else {
|
|
312
|
-
vec4 outerColor;
|
|
313
|
-
if(innerBorder == 0.0 && outerBorder == 0.0) {
|
|
314
|
-
outerColor = vec4(0);
|
|
315
|
-
} else if(innerBorder == 0.0) {
|
|
316
|
-
outerColor = vBorderColor;
|
|
317
|
-
} else {
|
|
318
|
-
outerColor = blend(vBorderColor, vColor);
|
|
319
|
-
}
|
|
320
|
-
outColor = distInterp(vColor, outerColor, d - innerBorder);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
else {
|
|
325
|
-
outColor = vColor;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
`).concat(t.picking?`if(outColor.a == 0.0) discard;
|
|
329
|
-
else outColor = vIndex;`:"",`
|
|
330
|
-
}
|
|
331
|
-
`),o=f0(r,n,a);o.aPosition=r.getAttribLocation(o,"aPosition"),o.aIndex=r.getAttribLocation(o,"aIndex"),o.aVertType=r.getAttribLocation(o,"aVertType"),o.aTransform=r.getAttribLocation(o,"aTransform"),o.aAtlasId=r.getAttribLocation(o,"aAtlasId"),o.aTex=r.getAttribLocation(o,"aTex"),o.aPointAPointB=r.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=r.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=r.getAttribLocation(o,"aLineWidth"),o.aColor=r.getAttribLocation(o,"aColor"),o.aCornerRadius=r.getAttribLocation(o,"aCornerRadius"),o.aBorderColor=r.getAttribLocation(o,"aBorderColor"),o.uPanZoomMatrix=r.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=r.getUniformLocation(o,"uAtlasSize"),o.uBGColor=r.getUniformLocation(o,"uBGColor"),o.uZoom=r.getUniformLocation(o,"uZoom"),o.uTextures=[];for(var s=0;s<this.batchManager.getMaxAtlasesPerBatch();s++)o.uTextures.push(r.getUniformLocation(o,"uTexture".concat(s)));return o}},{key:"_createVAO",value:function(){var t=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=t.length/2;var r=this.maxInstances,n=this.gl,i=this.program,a=n.createVertexArray();return n.bindVertexArray(a),E0(n,"vec2",i.aPosition,t),this.transformBuffer=T0(n,r,i.aTransform),this.indexBuffer=Vt(n,r,"vec4",i.aIndex),this.vertTypeBuffer=Vt(n,r,"int",i.aVertType),this.atlasIdBuffer=Vt(n,r,"int",i.aAtlasId),this.texBuffer=Vt(n,r,"vec4",i.aTex),this.pointAPointBBuffer=Vt(n,r,"vec4",i.aPointAPointB),this.pointCPointDBuffer=Vt(n,r,"vec4",i.aPointCPointD),this.lineWidthBuffer=Vt(n,r,"vec2",i.aLineWidth),this.colorBuffer=Vt(n,r,"vec4",i.aColor),this.cornerRadiusBuffer=Vt(n,r,"vec4",i.aCornerRadius),this.borderColorBuffer=Vt(n,r,"vec4",i.aBorderColor),n.bindVertexArray(null),a}},{key:"buffers",get:function(){var t=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(r){return nr(r,"Buffer")}).map(function(r){return t[r]})),this._buffers}},{key:"startFrame",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Tn.SCREEN;this.panZoomMatrix=t,this.renderTarget=r,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(t,r){return t.visible()?r&&r.isVisible?r.isVisible(t):!0:!1}},{key:"drawTexture",value:function(t,r,n){var i=this.atlasManager,a=this.batchManager,o=i.getRenderTypeOpts(n);if(this._isVisible(t,o)&&!(t.isEdge()&&!this._isValidEdge(t))){if(this.renderTarget.picking&&o.getTexPickingMode){var s=o.getTexPickingMode(t);if(s===Ii.IGNORE)return;if(s==Ii.USE_BB){this.drawPickingRectangle(t,r,n);return}}var u=i.getAtlasInfo(t,n),l=Ct(u),c;try{for(l.s();!(c=l.n()).done;){var h=c.value,f=h.atlas,d=h.tex1,p=h.tex2;a.canAddToCurrentBatch(f)||this.endBatch();for(var v=a.getAtlasIndexForBatch(f),m=0,g=[[d,!0],[p,!1]];m<g.length;m++){var y=Qe(g[m],2),x=y[0],T=y[1];if(x.w!=0){var w=this.instanceCount;this.vertTypeBuffer.getView(w)[0]=Co;var D=this.indexBuffer.getView(w);Yr(r,D);var b=this.atlasIdBuffer.getView(w);b[0]=v;var _=this.texBuffer.getView(w);_[0]=x.x,_[1]=x.y,_[2]=x.w,_[3]=x.h;var E=this.transformBuffer.getMatrixView(w);this.setTransformMatrix(t,E,o,h,T),this.instanceCount++,T||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(A){l.e(A)}finally{l.f()}}}},{key:"setTransformMatrix",value:function(t,r,n,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;if(n.shapeProps&&n.shapeProps.padding&&(o=t.pstyle(n.shapeProps.padding).pfValue),i){var s=i.bb,u=i.tex1,l=i.tex2,c=u.w/(u.w+l.w);a||(c=1-c);var h=this._getAdjustedBB(s,o,a,c);this._applyTransformMatrix(r,h,n,t)}else{var f=n.getBoundingBox(t),d=this._getAdjustedBB(f,o,!0,1);this._applyTransformMatrix(r,d,n,t)}}},{key:"_applyTransformMatrix",value:function(t,r,n,i){var a,o;tc(t);var s=n.getRotation?n.getRotation(i):0;if(s!==0){var u=n.getRotationPoint(i),l=u.x,c=u.y;mi(t,t,[l,c]),rc(t,t,s);var h=n.getRotationOffset(i);a=h.x+(r.xOffset||0),o=h.y+(r.yOffset||0)}else a=r.x1,o=r.y1;mi(t,t,[a,o]),jo(t,t,[r.w,r.h])}},{key:"_getAdjustedBB",value:function(t,r,n,i){var a=t.x1,o=t.y1,s=t.w,u=t.h,l=t.yOffset;r&&(a-=r,o-=r,s+=2*r,u+=2*r);var c=0,h=s*i;return n&&i<1?s=h:!n&&i<1&&(c=s-h,a+=c,s=h),{x1:a,y1:o,w:s,h:u,xOffset:c,yOffset:l}}},{key:"drawPickingRectangle",value:function(t,r,n){var i=this.atlasManager.getRenderTypeOpts(n),a=this.instanceCount;this.vertTypeBuffer.getView(a)[0]=Ur;var o=this.indexBuffer.getView(a);Yr(r,o);var s=this.colorBuffer.getView(a);Er([0,0,0],1,s);var u=this.transformBuffer.getMatrixView(a);this.setTransformMatrix(t,u,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(t,r,n){var i=this.simpleShapeOptions.get(n);if(this._isVisible(t,i)){var a=i.shapeProps,o=this._getVertTypeForShape(t,a.shape);if(o===void 0||i.isSimple&&!i.isSimple(t)){this.drawTexture(t,r,n);return}var s=this.instanceCount;if(this.vertTypeBuffer.getView(s)[0]=o,o===li||o===vn){var u=i.getBoundingBox(t),l=this._getCornerRadius(t,a.radius,u),c=this.cornerRadiusBuffer.getView(s);c[0]=l,c[1]=l,c[2]=l,c[3]=l,o===vn&&(c[0]=0,c[2]=0)}var h=this.indexBuffer.getView(s);Yr(r,h);var f=t.pstyle(a.color).value,d=t.pstyle(a.opacity).value,p=this.colorBuffer.getView(s);Er(f,d,p);var v=this.lineWidthBuffer.getView(s);if(v[0]=0,v[1]=0,a.border){var m=t.pstyle("border-width").value;if(m>0){var g=t.pstyle("border-color").value,y=t.pstyle("border-opacity").value,x=this.borderColorBuffer.getView(s);Er(g,y,x);var T=t.pstyle("border-position").value;if(T==="inside")v[0]=0,v[1]=-m;else if(T==="outside")v[0]=m,v[1]=0;else{var w=m/2;v[0]=w,v[1]=-w}}}var D=this.transformBuffer.getMatrixView(s);this.setTransformMatrix(t,D,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(t,r){var n=t.pstyle(r).value;switch(n){case"rectangle":return Ur;case"ellipse":return yn;case"roundrectangle":case"round-rectangle":return li;case"bottom-round-rectangle":return vn;default:return}}},{key:"_getCornerRadius",value:function(t,r,n){var i=n.w,a=n.h;if(t.pstyle(r).value==="auto")return cr(i,a);var o=t.pstyle(r).pfValue,s=i/2,u=a/2;return Math.min(o,u,s)}},{key:"drawEdgeArrow",value:function(t,r,n){if(t.visible()){var i=t._private.rscratch,a,o,s;if(n==="source"?(a=i.arrowStartX,o=i.arrowStartY,s=i.srcArrowAngle):(a=i.arrowEndX,o=i.arrowEndY,s=i.tgtArrowAngle),!(isNaN(a)||a==null||isNaN(o)||o==null||isNaN(s)||s==null)){var u=t.pstyle(n+"-arrow-shape").value;if(u!=="none"){var l=t.pstyle(n+"-arrow-color").value,c=t.pstyle("opacity").value,h=t.pstyle("line-opacity").value,f=c*h,d=t.pstyle("width").pfValue,p=t.pstyle("arrow-scale").value,v=this.r.getArrowWidth(d,p),m=this.instanceCount,g=this.transformBuffer.getMatrixView(m);tc(g),mi(g,g,[a,o]),jo(g,g,[v,v]),rc(g,g,s),this.vertTypeBuffer.getView(m)[0]=Do;var y=this.indexBuffer.getView(m);Yr(r,y);var x=this.colorBuffer.getView(m);Er(l,f,x),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(t,r){if(t.visible()){var n=this._getEdgePoints(t);if(n){var i=t.pstyle("opacity").value,a=t.pstyle("line-opacity").value,o=t.pstyle("width").pfValue,s=t.pstyle("line-color").value,u=i*a;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var l=this.instanceCount;this.vertTypeBuffer.getView(l)[0]=nc;var c=this.indexBuffer.getView(l);Yr(r,c);var h=this.colorBuffer.getView(l);Er(s,u,h);var f=this.lineWidthBuffer.getView(l);f[0]=o;var d=this.pointAPointBBuffer.getView(l);d[0]=n[0],d[1]=n[1],d[2]=n[2],d[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var p=0;p<n.length-2;p+=2){var v=this.instanceCount;this.vertTypeBuffer.getView(v)[0]=ic;var m=this.indexBuffer.getView(v);Yr(r,m);var g=this.colorBuffer.getView(v);Er(s,u,g);var y=this.lineWidthBuffer.getView(v);y[0]=o;var x=n[p-2],T=n[p-1],w=n[p],D=n[p+1],b=n[p+2],_=n[p+3],E=n[p+4],A=n[p+5];p==0&&(x=2*w-b+.001,T=2*D-_+.001),p==n.length-4&&(E=2*b-w+.001,A=2*_-D+.001);var C=this.pointAPointBBuffer.getView(v);C[0]=x,C[1]=T,C[2]=w,C[3]=D;var N=this.pointCPointDBuffer.getView(v);N[0]=b,N[1]=_,N[2]=E,N[3]=A,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(t){var r=t._private.rscratch;return!(r.badLine||r.allpts==null||isNaN(r.allpts[0]))}},{key:"_getEdgePoints",value:function(t){var r=t._private.rscratch;if(this._isValidEdge(t)){var n=r.allpts;if(n.length==4)return n;var i=this._getNumSegments(t);return this._getCurveSegmentPoints(n,i)}}},{key:"_getNumSegments",value:function(t){var r=15;return Math.min(Math.max(r,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(t,r){if(t.length==4)return t;for(var n=Array((r+1)*2),i=0;i<=r;i++)if(i==0)n[0]=t[0],n[1]=t[1];else if(i==r)n[i*2]=t[t.length-2],n[i*2+1]=t[t.length-1];else{var a=i/r;this._setCurvePoint(t,a,n,i*2)}return n}},{key:"_setCurvePoint",value:function(t,r,n,i){if(t.length<=2)n[i]=t[0],n[i+1]=t[1];else{for(var a=Array(t.length-2),o=0;o<a.length;o+=2){var s=(1-r)*t[o]+r*t[o+2],u=(1-r)*t[o+1]+r*t[o+3];a[o]=s,a[o+1]=u}return this._setCurvePoint(a,r,n,i)}}},{key:"endBatch",value:function(){var t=this.gl,r=this.vao,n=this.vertexCount,i=this.instanceCount;if(i!==0){var a=this.renderTarget.picking?this.pickingProgram:this.program;t.useProgram(a),t.bindVertexArray(r);var o=Ct(this.buffers),s;try{for(o.s();!(s=o.n()).done;){var u=s.value;u.bufferSubData(i)}}catch(d){o.e(d)}finally{o.f()}for(var l=this.batchManager.getAtlases(),c=0;c<l.length;c++)l[c].bufferIfNeeded(t);for(var h=0;h<l.length;h++)t.activeTexture(t.TEXTURE0+h),t.bindTexture(t.TEXTURE_2D,l[h].texture),t.uniform1i(a.uTextures[h],h);t.uniform1f(a.uZoom,g0(this.r)),t.uniformMatrix3fv(a.uPanZoomMatrix,!1,this.panZoomMatrix),t.uniform1i(a.uAtlasSize,this.batchManager.getAtlasSize());var f=Er(this.bgColor,1);t.uniform4fv(a.uBGColor,f),t.drawArraysInstanced(t.TRIANGLES,0,n,i),t.bindVertexArray(null),t.bindTexture(t.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:l.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var t=this.atlasManager.getDebugInfo(),r=t.reduce(function(a,o){return a+o.atlasCount},0),n=this.batchDebugInfo,i=n.reduce(function(a,o){return a+o.count},0);return{atlasInfo:t,totalAtlases:r,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:i}}}])}(),Xh={};Xh.initWebgl=function(e,t){var r=this,n=r.data.contexts[r.WEBGL];e.bgColor=B0(r),e.webglTexSize=Math.min(e.webglTexSize,n.getParameter(n.MAX_TEXTURE_SIZE)),e.webglTexRows=Math.min(e.webglTexRows,54),e.webglTexRowsNodes=Math.min(e.webglTexRowsNodes,54),e.webglBatchSize=Math.min(e.webglBatchSize,16384),e.webglTexPerBatch=Math.min(e.webglTexPerBatch,n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)),r.webglDebug=e.webglDebug,r.webglDebugShowAtlases=e.webglDebugShowAtlases,r.pickingFrameBuffer=_0(n),r.pickingFrameBuffer.needsDraw=!0,r.drawing=new P0(r,n,e);var i=function(c){return function(h){return r.getTextAngle(h,c)}},a=function(c){return function(h){var f=h.pstyle(c);return f&&f.value}},o=function(c){return function(h){return h.pstyle("".concat(c,"-opacity")).value>0}},s=function(c){var h=c.pstyle("text-events").strValue==="yes";return h?Ii.USE_BB:Ii.IGNORE},u=function(c){var h=c.position(),f=h.x,d=h.y,p=c.outerWidth(),v=c.outerHeight();return{w:p,h:v,x1:f-p/2,y1:d-v/2}};r.drawing.addAtlasCollection("node",{texRows:e.webglTexRowsNodes}),r.drawing.addAtlasCollection("label",{texRows:e.webglTexRows}),r.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),r.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:u,isSimple:y0,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:u,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:u,isVisible:o("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),r.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:s,getKey:No(t.getLabelKey,null),getBoundingBox:ko(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:i(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:a("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:s,getKey:No(t.getSourceLabelKey,"source"),getBoundingBox:ko(t.getSourceLabelBox,"source"),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:i("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:a("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:s,getKey:No(t.getTargetLabelKey,"target"),getBoundingBox:ko(t.getTargetLabelBox,"target"),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:i("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:a("target-label")});var l=zn(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(c,h){var f=!1;h&&h.length>0&&(f|=r.drawing.invalidate(h)),f&&l()}),F0(r)};function B0(e){var t=e.cy.container(),r=t&&t.style&&t.style.backgroundColor||"white";return mc(r)}function Wh(e,t){var r=e._private.rscratch;return _t(r,"labelWrapCachedLines",t)||[]}var No=function(e,t){return function(r){var n=e(r),i=Wh(r,t);return i.length>1?i.map(function(a,o){return"".concat(n,"_").concat(o)}):n}},ko=function(e,t){return function(r,n){var i=e(r);if(typeof n=="string"){var a=n.indexOf("_");if(a>0){var o=Number(n.substring(a+1)),s=Wh(r,t),u=i.h/s.length,l=u*o,c=i.y1+l;return{x1:i.x1,w:i.w,y1:c,h:u,yOffset:l}}}return i}};function F0(e){{var t=e.render;e.render=function(a){a=a||{};var o=e.cy;e.webgl&&(o.zoom()>Bh?(z0(e),t.call(e,a)):(V0(e),Hh(e,a,Tn.SCREEN)))}}{var r=e.matchCanvasSize;e.matchCanvasSize=function(a){r.call(e,a),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0}}e.findNearestElements=function(a,o,s,u){return q0(e,a,o)};{var n=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){n.call(e),e.pickingFrameBuffer.needsDraw=!0}}{var i=e.notify;e.notify=function(a,o){i.call(e,a,o),a==="viewport"||a==="bounds"?e.pickingFrameBuffer.needsDraw=!0:a==="background"&&e.drawing.invalidate(o,{type:"node-body"})}}}function z0(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function V0(e){var t=function(r){r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,e.canvasWidth,e.canvasHeight),r.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}function G0(e){var t=e.canvasWidth,r=e.canvasHeight,n=Ds(e),i=n.pan,a=n.zoom,o=Ao();mi(o,o,[i.x,i.y]),jo(o,o,[a,a]);var s=Ao();C0(s,t,r);var u=Ao();return A0(u,s,o),u}function qh(e,t){var r=e.canvasWidth,n=e.canvasHeight,i=Ds(e),a=i.pan,o=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,r,n),t.translate(a.x,a.y),t.scale(o,o)}function Y0(e,t){e.drawSelectionRectangle(t,function(r){return qh(e,r)})}function U0(e){var t=e.data.contexts[e.NODE];t.save(),qh(e,t),t.strokeStyle="rgba(0, 0, 0, 0.3)",t.beginPath(),t.moveTo(-1e3,0),t.lineTo(1e3,0),t.stroke(),t.beginPath(),t.moveTo(0,-1e3),t.lineTo(0,1e3),t.stroke(),t.restore()}function X0(e){var t=function(n,i,a){for(var o=n.atlasManager.getAtlasCollection(i),s=e.data.contexts[e.NODE],u=o.atlases,l=0;l<u.length;l++){var c=u[l],h=c.canvas;if(h){var f=h.width,d=h.height,p=f*l,v=h.height*a,m=.4;s.save(),s.scale(m,m),s.drawImage(h,p,v),s.strokeStyle="black",s.rect(p,v,f,d),s.stroke(),s.restore()}}},r=0;t(e.drawing,"node",r++),t(e.drawing,"label",r++)}function W0(e,t,r,n,i){var a,o,s,u,l=Ds(e),c=l.pan,h=l.zoom;{var f=v0(e,c,h,t,r),d=Qe(f,2),p=d[0],v=d[1],m=6;a=p-m/2,o=v-m/2,s=m,u=m}if(s===0||u===0)return[];var g=e.data.contexts[e.WEBGL];g.bindFramebuffer(g.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(g.viewport(0,0,g.canvas.width,g.canvas.height),Hh(e,null,Tn.PICKING),e.pickingFrameBuffer.needsDraw=!1);var y=s*u,x=new Uint8Array(y*4);g.readPixels(a,o,s,u,g.RGBA,g.UNSIGNED_BYTE,x),g.bindFramebuffer(g.FRAMEBUFFER,null);for(var T=new Set,w=0;w<y;w++){var D=x.slice(w*4,w*4+4),b=b0(D)-1;b>=0&&T.add(b)}return T}function q0(e,t,r){var n=W0(e,t,r),i=e.getCachedZSortedEles(),a,o,s=Ct(n),u;try{for(s.s();!(u=s.n()).done;){var l=u.value,c=i[l];if(!a&&c.isNode()&&(a=c),!o&&c.isEdge()&&(o=c),a&&o)break}}catch(h){s.e(h)}finally{s.f()}return[a,o].filter(Boolean)}function Mo(e,t,r){var n=e.drawing;t+=1,r.isNode()?(n.drawNode(r,t,"node-underlay"),n.drawNode(r,t,"node-body"),n.drawTexture(r,t,"label"),n.drawNode(r,t,"node-overlay")):(n.drawEdgeLine(r,t),n.drawEdgeArrow(r,t,"source"),n.drawEdgeArrow(r,t,"target"),n.drawTexture(r,t,"label"),n.drawTexture(r,t,"edge-source-label"),n.drawTexture(r,t,"edge-target-label"))}function Hh(e,t,r){var n;e.webglDebug&&(n=performance.now());var i=e.drawing,a=0;if(r.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&Y0(e,t),e.data.canvasNeedsRedraw[e.NODE]||r.picking){var o=e.data.contexts[e.WEBGL];r.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var s=G0(e),u=e.getCachedZSortedEles();if(a=u.length,i.startFrame(s,r),r.screen){for(var l=0;l<u.nondrag.length;l++)Mo(e,l,u.nondrag[l]);for(var c=0;c<u.drag.length;c++)Mo(e,c,u.drag[c])}else if(r.picking)for(var h=0;h<u.length;h++)Mo(e,h,u[h]);i.endFrame(),r.screen&&e.webglDebugShowAtlases&&(U0(e),X0(e)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var f=performance.now(),d=!1,p=Math.ceil(f-n),v=i.getDebugInfo(),m=["".concat(a," elements"),"".concat(v.totalInstances," instances"),"".concat(v.batchCount," batches"),"".concat(v.totalAtlases," atlases"),"".concat(v.wrappedCount," wrapped textures"),"".concat(v.simpleCount," simple shapes")].join(", ");if(d)console.log("WebGL (".concat(r.name,") - time ").concat(p,"ms, ").concat(m));else{console.log("WebGL (".concat(r.name,") - frame time ").concat(p,"ms")),console.log("Totals:"),console.log(" ".concat(m)),console.log("Texture Atlases Used:");var g=v.atlasInfo,y=Ct(g),x;try{for(y.s();!(x=y.n()).done;){var T=x.value;console.log(" ".concat(T.type,": ").concat(T.keyCount," keys, ").concat(T.atlasCount," atlases"))}}catch(w){y.e(w)}finally{y.f()}console.log("")}}e.data.gc&&(console.log("Garbage Collect!"),e.data.gc=!1,i.gc())}var br={};br.drawPolygonPath=function(e,t,r,n,i,a){var o=n/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],r+s*a[1]);for(var u=1;u<a.length/2;u++)e.lineTo(t+o*a[u*2],r+s*a[u*2+1]);e.closePath()};br.drawRoundPolygonPath=function(e,t,r,n,i,a,o){o.forEach(function(s){return Nh(e,s)}),e.closePath()};br.drawRoundRectanglePath=function(e,t,r,n,i,a){var o=n/2,s=i/2,u=a==="auto"?cr(n,i):Math.min(a,s,o);e.beginPath&&e.beginPath(),e.moveTo(t,r-s),e.arcTo(t+o,r-s,t+o,r,u),e.arcTo(t+o,r+s,t,r+s,u),e.arcTo(t-o,r+s,t-o,r,u),e.arcTo(t-o,r-s,t,r-s,u),e.lineTo(t,r-s),e.closePath()};br.drawBottomRoundRectanglePath=function(e,t,r,n,i,a){var o=n/2,s=i/2,u=a==="auto"?cr(n,i):a;e.beginPath&&e.beginPath(),e.moveTo(t,r-s),e.lineTo(t+o,r-s),e.lineTo(t+o,r),e.arcTo(t+o,r+s,t,r+s,u),e.arcTo(t-o,r+s,t-o,r,u),e.lineTo(t-o,r-s),e.lineTo(t,r-s),e.closePath()};br.drawCutRectanglePath=function(e,t,r,n,i,a,o){var s=n/2,u=i/2,l=o==="auto"?fs():o;e.beginPath&&e.beginPath(),e.moveTo(t-s+l,r-u),e.lineTo(t+s-l,r-u),e.lineTo(t+s,r-u+l),e.lineTo(t+s,r+u-l),e.lineTo(t+s-l,r+u),e.lineTo(t-s+l,r+u),e.lineTo(t-s,r+u-l),e.lineTo(t-s,r-u+l),e.closePath()};br.drawBarrelPath=function(e,t,r,n,i){var a=n/2,o=i/2,s=t-a,u=t+a,l=r-o,c=r+o,h=Oo(n,i),f=h.widthOffset,d=h.heightOffset,p=h.ctrlPtOffsetPct*f;e.beginPath&&e.beginPath(),e.moveTo(s,l+d),e.lineTo(s,c-d),e.quadraticCurveTo(s+p,c,s+f,c),e.lineTo(u-f,c),e.quadraticCurveTo(u-p,c,u,c-d),e.lineTo(u,l+d),e.quadraticCurveTo(u-p,l,u-f,l),e.lineTo(s+f,l),e.quadraticCurveTo(s+p,l,s,l+d),e.closePath()};var ac=Math.sin(0),oc=Math.cos(0),$o={},Zo={},jh=Math.PI/40;for(var Xr=0*Math.PI;Xr<2*Math.PI;Xr+=jh)$o[Xr]=Math.sin(Xr),Zo[Xr]=Math.cos(Xr);br.drawEllipsePath=function(e,t,r,n,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,r,n/2,i/2,0,0,2*Math.PI);else for(var a,o,s=n/2,u=i/2,l=0*Math.PI;l<2*Math.PI;l+=jh)a=t-s*$o[l]*ac+s*Zo[l]*oc,o=r+u*Zo[l]*ac+u*$o[l]*oc,l===0?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var Wn={};Wn.createBuffer=function(e,t){var r=document.createElement("canvas");return r.width=e,r.height=t,[r,r.getContext("2d")]};Wn.bufferCanvasImage=function(e){var t=this.cy,r=t.mutableElements(),n=r.boundingBox(),i=this.findContainerClientCoords(),a=e.full?Math.ceil(n.w):i[2],o=e.full?Math.ceil(n.h):i[3],s=ne(e.maxWidth)||ne(e.maxHeight),u=this.getPixelRatio(),l=1;if(e.scale!==void 0)a*=e.scale,o*=e.scale,l=e.scale;else if(s){var c=1/0,h=1/0;ne(e.maxWidth)&&(c=l*e.maxWidth/a),ne(e.maxHeight)&&(h=l*e.maxHeight/o),l=Math.min(c,h),a*=l,o*=l}s||(a*=u,o*=u,l*=u);var f=document.createElement("canvas");f.width=a,f.height=o,f.style.width=a+"px",f.style.height=o+"px";var d=f.getContext("2d");if(a>0&&o>0){d.clearRect(0,0,a,o),d.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)d.translate(-n.x1*l,-n.y1*l),d.scale(l,l),this.drawElements(d,p),d.scale(1/l,1/l),d.translate(n.x1*l,n.y1*l);else{var v=t.pan(),m={x:v.x*l,y:v.y*l};l*=t.zoom(),d.translate(m.x,m.y),d.scale(l,l),this.drawElements(d,p),d.scale(1/l,1/l),d.translate(-m.x,-m.y)}e.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=e.bg,d.rect(0,0,a,o),d.fill())}return f};function H0(e,t){for(var r=atob(e),n=new ArrayBuffer(r.length),i=new Uint8Array(n),a=0;a<r.length;a++)i[a]=r.charCodeAt(a);return new Blob([n],{type:t})}function sc(e){var t=e.indexOf(",");return e.substr(t+1)}function $h(e,t,r){var n=function(){return t.toDataURL(r,e.quality)};switch(e.output){case"blob-promise":return new nn(function(i,a){try{t.toBlob(function(o){o!=null?i(o):a(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,e.quality)}catch(o){a(o)}});case"blob":return H0(sc(n()),r);case"base64":return sc(n());case"base64uri":default:return n()}}Wn.png=function(e){return $h(e,this.bufferCanvasImage(e),"image/png")};Wn.jpg=function(e){return $h(e,this.bufferCanvasImage(e),"image/jpeg")};var Zh={};Zh.nodeShapeImpl=function(e,t,r,n,i,a,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,r,n,i,a);case"polygon":return this.drawPolygonPath(t,r,n,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,r,n,i,a,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,r,n,i,a,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,r,n,i,a,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,r,n,i,a,s);case"barrel":return this.drawBarrelPath(t,r,n,i,a)}};var j0=Kh,Ae=Kh.prototype;Ae.CANVAS_LAYERS=3;Ae.SELECT_BOX=0;Ae.DRAG=1;Ae.NODE=2;Ae.WEBGL=3;Ae.CANVAS_TYPES=["2d","2d","2d","webgl2"];Ae.BUFFER_COUNT=3;Ae.TEXTURE_BUFFER=0;Ae.MOTIONBLUR_BUFFER_NODE=1;Ae.MOTIONBLUR_BUFFER_DRAG=2;function Kh(e){var t=this,r=t.cy.window(),n=r.document;e.webgl&&(Ae.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:new Array(Ae.CANVAS_LAYERS),contexts:new Array(Ae.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Ae.CANVAS_LAYERS),bufferCanvases:new Array(Ae.BUFFER_COUNT),bufferContexts:new Array(Ae.CANVAS_LAYERS)};var i="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";t.data.canvasContainer=n.createElement("div");var o=t.data.canvasContainer.style;t.data.canvasContainer.style[i]=a,o.position="relative",o.zIndex="0",o.overflow="hidden";var s=e.cy.container();s.appendChild(t.data.canvasContainer),s.style[i]=a;var u={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};Gd()&&(u["-ms-touch-action"]="none",u["touch-action"]="none");for(var l=0;l<Ae.CANVAS_LAYERS;l++){var c=t.data.canvases[l]=n.createElement("canvas"),h=Ae.CANVAS_TYPES[l];t.data.contexts[l]=c.getContext(h),t.data.contexts[l]||Xe("Could not create canvas of type "+h),Object.keys(u).forEach(function(V){c.style[V]=u[V]}),c.style.position="absolute",c.setAttribute("data-id","layer"+l),c.style.zIndex=String(Ae.CANVAS_LAYERS-l),t.data.canvasContainer.appendChild(c),t.data.canvasNeedsRedraw[l]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[Ae.NODE].setAttribute("data-id","layer"+Ae.NODE+"-node"),t.data.canvases[Ae.SELECT_BOX].setAttribute("data-id","layer"+Ae.SELECT_BOX+"-selectbox"),t.data.canvases[Ae.DRAG].setAttribute("data-id","layer"+Ae.DRAG+"-drag"),t.data.canvases[Ae.WEBGL]&&t.data.canvases[Ae.WEBGL].setAttribute("data-id","layer"+Ae.WEBGL+"-webgl");for(var l=0;l<Ae.BUFFER_COUNT;l++)t.data.bufferCanvases[l]=n.createElement("canvas"),t.data.bufferContexts[l]=t.data.bufferCanvases[l].getContext("2d"),t.data.bufferCanvases[l].style.position="absolute",t.data.bufferCanvases[l].setAttribute("data-id","buffer"+l),t.data.bufferCanvases[l].style.zIndex=String(-l-1),t.data.bufferCanvases[l].style.visibility="hidden";t.pathsEnabled=!0;var f=xt(),d=function(V){return{x:(V.x1+V.x2)/2,y:(V.y1+V.y2)/2}},p=function(V){return{x:-V.w/2,y:-V.h/2}},v=function(V){var Y=V[0]._private,U=Y.oldBackgroundTimestamp===Y.backgroundTimestamp;return!U},m=function(V){return V[0]._private.nodeKey},g=function(V){return V[0]._private.labelStyleKey},y=function(V){return V[0]._private.sourceLabelStyleKey},x=function(V){return V[0]._private.targetLabelStyleKey},T=function(V,Y,U,K,ee){return t.drawElement(V,Y,U,!1,!1,ee)},w=function(V,Y,U,K,ee){return t.drawElementText(V,Y,U,K,"main",ee)},D=function(V,Y,U,K,ee){return t.drawElementText(V,Y,U,K,"source",ee)},b=function(V,Y,U,K,ee){return t.drawElementText(V,Y,U,K,"target",ee)},_=function(V){return V.boundingBox(),V[0]._private.bodyBounds},E=function(V){return V.boundingBox(),V[0]._private.labelBounds.main||f},A=function(V){return V.boundingBox(),V[0]._private.labelBounds.source||f},C=function(V){return V.boundingBox(),V[0]._private.labelBounds.target||f},N=function(V,Y){return Y},S=function(V){return d(_(V))},M=function(V,Y,U){var K=V?V+"-":"";return{x:Y.x+U.pstyle(K+"text-margin-x").pfValue,y:Y.y+U.pstyle(K+"text-margin-y").pfValue}},R=function(V,Y,U){var K=V[0]._private.rscratch;return{x:K[Y],y:K[U]}},P=function(V){return M("",R(V,"labelX","labelY"),V)},L=function(V){return M("source",R(V,"sourceLabelX","sourceLabelY"),V)},O=function(V){return M("target",R(V,"targetLabelX","targetLabelY"),V)},I=function(V){return p(_(V))},B=function(V){return p(A(V))},F=function(V){return p(C(V))},z=function(V){var Y=E(V),U=p(E(V));if(V.isNode()){switch(V.pstyle("text-halign").value){case"left":U.x=-Y.w-(Y.leftPad||0);break;case"right":U.x=-(Y.rightPad||0);break}switch(V.pstyle("text-valign").value){case"top":U.y=-Y.h-(Y.topPad||0);break;case"bottom":U.y=-(Y.botPad||0);break}}return U},G=t.data.eleTxrCache=new xn(t,{getKey:m,doesEleInvalidateKey:v,drawElement:T,getBoundingBox:_,getRotationPoint:S,getRotationOffset:I,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),H=t.data.lblTxrCache=new xn(t,{getKey:g,drawElement:w,getBoundingBox:E,getRotationPoint:P,getRotationOffset:z,isVisible:N}),j=t.data.slbTxrCache=new xn(t,{getKey:y,drawElement:D,getBoundingBox:A,getRotationPoint:L,getRotationOffset:B,isVisible:N}),Z=t.data.tlbTxrCache=new xn(t,{getKey:x,drawElement:b,getBoundingBox:C,getRotationPoint:O,getRotationOffset:F,isVisible:N}),Q=t.data.lyrTxrCache=new Fh(t);t.onUpdateEleCalcs(function(V,Y){G.invalidateElements(Y),H.invalidateElements(Y),j.invalidateElements(Y),Z.invalidateElements(Y),Q.invalidateElements(Y);for(var U=0;U<Y.length;U++){var K=Y[U]._private;K.oldBackgroundTimestamp=K.backgroundTimestamp}});var re=function(V){for(var Y=0;Y<V.length;Y++)Q.enqueueElementRefinement(V[Y].ele)};G.onDequeue(re),H.onDequeue(re),j.onDequeue(re),Z.onDequeue(re),e.webgl&&t.initWebgl(e,{getStyleKey:m,getLabelKey:g,getSourceLabelKey:y,getTargetLabelKey:x,drawElement:T,drawLabel:w,drawSourceLabel:D,drawTargetLabel:b,getElementBox:_,getLabelBox:E,getSourceLabelBox:A,getTargetLabelBox:C,getElementRotationPoint:S,getElementRotationOffset:I,getLabelRotationPoint:P,getSourceLabelRotationPoint:L,getTargetLabelRotationPoint:O,getLabelRotationOffset:z,getSourceLabelRotationOffset:B,getTargetLabelRotationOffset:F})}Ae.redrawHint=function(e,t){var r=this;switch(e){case"eles":r.data.canvasNeedsRedraw[Ae.NODE]=t;break;case"drag":r.data.canvasNeedsRedraw[Ae.DRAG]=t;break;case"select":r.data.canvasNeedsRedraw[Ae.SELECT_BOX]=t;break;case"gc":r.data.gc=!0;break}};var $0=typeof Path2D<"u";Ae.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e};Ae.usePaths=function(){return $0&&this.pathsEnabled};Ae.setImgSmoothing=function(e,t){e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)};Ae.getImgSmoothing=function(e){return e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled};Ae.makeOffscreenCanvas=function(e,t){var r;if((typeof OffscreenCanvas>"u"?"undefined":rt(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(e,t);else{var n=this.cy.window(),i=n.document;r=i.createElement("canvas"),r.width=e,r.height=t}return r};[zh,Wt,Qt,Cs,Rr,mr,wt,Xh,br,Wn,Zh].forEach(function(e){ge(Ae,e)});var Z0=[{name:"null",impl:Ah},{name:"base",impl:Rh},{name:"canvas",impl:j0}],K0=[{type:"layout",extensions:Ey},{type:"renderer",extensions:Z0}],Qh={},Jh={};function ed(e,t,r){var n=r,i=function(b){Pe("Can not register `"+t+"` for `"+e+"` since `"+b+"` already exists in the prototype and can not be overridden")};if(e==="core"){if(Ln.prototype[t])return i(t);Ln.prototype[t]=r}else if(e==="collection"){if(ct.prototype[t])return i(t);ct.prototype[t]=r}else if(e==="layout"){for(var a=function(b){this.options=b,r.call(this,b),ke(this._private)||(this._private={}),this._private.cy=b.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(r.prototype),s=[],u=0;u<s.length;u++){var l=s[u];o[l]=o[l]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var c=r.prototype.stop;o.stop=function(){var b=this.options;if(b&&b.animate){var _=this.animations;if(_)for(var E=0;E<_.length;E++)_[E].stop()}return c?c.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var h=function(b){return b._private.cy},f={addEventFields:function(b,_){_.layout=b,_.cy=h(b),_.target=b},bubble:function(){return!0},parent:function(b){return h(b)}};ge(o,{createEmitter:function(){return this._private.emitter=new Wi(f,this),this},emitter:function(){return this._private.emitter},on:function(b,_){return this.emitter().on(b,_),this},one:function(b,_){return this.emitter().one(b,_),this},once:function(b,_){return this.emitter().one(b,_),this},removeListener:function(b,_){return this.emitter().removeListener(b,_),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(b,_){return this.emitter().emit(b,_),this}}),Re.eventAliasesOn(o),n=a}else if(e==="renderer"&&t!=="null"&&t!=="base"){var d=td("renderer","base"),p=d.prototype,v=r,m=r.prototype,g=function(){d.apply(this,arguments),v.apply(this,arguments)},y=g.prototype;for(var x in p){var T=p[x],w=m[x]!=null;if(w)return i(x);y[x]=T}for(var D in m)y[D]=m[D];p.clientFunctions.forEach(function(b){y[b]=y[b]||function(){Xe("Renderer does not implement `renderer."+b+"()` on its prototype")}}),n=g}else if(e==="__proto__"||e==="constructor"||e==="prototype")return Xe(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return bc({map:Qh,keys:[e,t],value:n})}function td(e,t){return xc({map:Qh,keys:[e,t]})}function Q0(e,t,r,n,i){return bc({map:Jh,keys:[e,t,r,n],value:i})}function J0(e,t,r,n){return xc({map:Jh,keys:[e,t,r,n]})}var Ko=function(){if(arguments.length===2)return td.apply(null,arguments);if(arguments.length===3)return ed.apply(null,arguments);if(arguments.length===4)return J0.apply(null,arguments);if(arguments.length===5)return Q0.apply(null,arguments);Xe("Invalid extension access syntax")};Ln.prototype.extension=Ko;K0.forEach(function(e){e.extensions.forEach(function(t){ed(e.type,t.name,t.impl)})});var Oi=function(){if(!(this instanceof Oi))return new Oi;this.length=0},Lr=Oi.prototype;Lr.instanceString=function(){return"stylesheet"};Lr.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this};Lr.css=function(e,t){var r=this.length-1;if(fe(e))this[r].properties.push({name:e,value:t});else if(ke(e))for(var n=e,i=Object.keys(n),a=0;a<i.length;a++){var o=i[a],s=n[o];if(s!=null){var u=ot.properties[o]||ot.properties[Ri(o)];if(u!=null){var l=u.name,c=s;this[r].properties.push({name:l,value:c})}}}return this};Lr.style=Lr.css;Lr.generateStyle=function(e){var t=new ot(e);return this.appendToStyle(t)};Lr.appendToStyle=function(e){for(var t=0;t<this.length;t++){var r=this[t],n=r.selector,i=r.properties;e.selector(n);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var em="3.33.1",pr=function(e){if(e===void 0&&(e={}),ke(e))return new Ln(e);if(fe(e))return Ko.apply(Ko,arguments)};pr.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(pr),e.apply(null,t),this};pr.warnings=function(e){return Dc(e)};pr.version=em;pr.stylesheet=pr.Stylesheet=Oi;var Qo={exports:{}},Jo={exports:{}},es={exports:{}},tm=es.exports,lc;function rm(){return lc||(lc=1,function(e,t){(function(r,n){e.exports=n()})(tm,function(){return function(r){var n={};function i(a){if(n[a])return n[a].exports;var o=n[a]={i:a,l:!1,exports:{}};return r[a].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=r,i.c=n,i.i=function(a){return a},i.d=function(a,o,s){i.o(a,o)||Object.defineProperty(a,o,{configurable:!1,enumerable:!0,get:s})},i.n=function(a){var o=a&&a.__esModule?function(){return a.default}:function(){return a};return i.d(o,"a",o),o},i.o=function(a,o){return Object.prototype.hasOwnProperty.call(a,o)},i.p="",i(i.s=26)}([function(r,n,i){function a(){}a.QUALITY=1,a.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,a.DEFAULT_INCREMENTAL=!1,a.DEFAULT_ANIMATION_ON_LAYOUT=!0,a.DEFAULT_ANIMATION_DURING_LAYOUT=!1,a.DEFAULT_ANIMATION_PERIOD=50,a.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,a.DEFAULT_GRAPH_MARGIN=15,a.NODE_DIMENSIONS_INCLUDE_LABELS=!1,a.SIMPLE_NODE_SIZE=40,a.SIMPLE_NODE_HALF_SIZE=a.SIMPLE_NODE_SIZE/2,a.EMPTY_COMPOUND_NODE_SIZE=40,a.MIN_EDGE_LENGTH=1,a.WORLD_BOUNDARY=1e6,a.INITIAL_WORLD_BOUNDARY=a.WORLD_BOUNDARY/1e3,a.WORLD_CENTER_X=1200,a.WORLD_CENTER_Y=900,r.exports=a},function(r,n,i){var a=i(2),o=i(8),s=i(9);function u(c,h,f){a.call(this,f),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=f,this.bendpoints=[],this.source=c,this.target=h}u.prototype=Object.create(a.prototype);for(var l in a)u[l]=a[l];u.prototype.getSource=function(){return this.source},u.prototype.getTarget=function(){return this.target},u.prototype.isInterGraph=function(){return this.isInterGraph},u.prototype.getLength=function(){return this.length},u.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},u.prototype.getBendpoints=function(){return this.bendpoints},u.prototype.getLca=function(){return this.lca},u.prototype.getSourceInLca=function(){return this.sourceInLca},u.prototype.getTargetInLca=function(){return this.targetInLca},u.prototype.getOtherEnd=function(c){if(this.source===c)return this.target;if(this.target===c)return this.source;throw"Node is not incident with this edge"},u.prototype.getOtherEndInGraph=function(c,h){for(var f=this.getOtherEnd(c),d=h.getGraphManager().getRoot();;){if(f.getOwner()==h)return f;if(f.getOwner()==d)break;f=f.getOwner().getParent()}return null},u.prototype.updateLength=function(){var c=new Array(4);this.isOverlapingSourceAndTarget=o.getIntersection(this.target.getRect(),this.source.getRect(),c),this.isOverlapingSourceAndTarget||(this.lengthX=c[0]-c[2],this.lengthY=c[1]-c[3],Math.abs(this.lengthX)<1&&(this.lengthX=s.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=s.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},u.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=s.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=s.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},r.exports=u},function(r,n,i){function a(o){this.vGraphObject=o}r.exports=a},function(r,n,i){var a=i(2),o=i(10),s=i(13),u=i(0),l=i(16),c=i(4);function h(d,p,v,m){v==null&&m==null&&(m=p),a.call(this,m),d.graphManager!=null&&(d=d.graphManager),this.estimatedSize=o.MIN_VALUE,this.inclusionTreeDepth=o.MAX_VALUE,this.vGraphObject=m,this.edges=[],this.graphManager=d,v!=null&&p!=null?this.rect=new s(p.x,p.y,v.width,v.height):this.rect=new s}h.prototype=Object.create(a.prototype);for(var f in a)h[f]=a[f];h.prototype.getEdges=function(){return this.edges},h.prototype.getChild=function(){return this.child},h.prototype.getOwner=function(){return this.owner},h.prototype.getWidth=function(){return this.rect.width},h.prototype.setWidth=function(d){this.rect.width=d},h.prototype.getHeight=function(){return this.rect.height},h.prototype.setHeight=function(d){this.rect.height=d},h.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},h.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},h.prototype.getCenter=function(){return new c(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},h.prototype.getLocation=function(){return new c(this.rect.x,this.rect.y)},h.prototype.getRect=function(){return this.rect},h.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},h.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},h.prototype.setRect=function(d,p){this.rect.x=d.x,this.rect.y=d.y,this.rect.width=p.width,this.rect.height=p.height},h.prototype.setCenter=function(d,p){this.rect.x=d-this.rect.width/2,this.rect.y=p-this.rect.height/2},h.prototype.setLocation=function(d,p){this.rect.x=d,this.rect.y=p},h.prototype.moveBy=function(d,p){this.rect.x+=d,this.rect.y+=p},h.prototype.getEdgeListToNode=function(d){var p=[],v=this;return v.edges.forEach(function(m){if(m.target==d){if(m.source!=v)throw"Incorrect edge source!";p.push(m)}}),p},h.prototype.getEdgesBetween=function(d){var p=[],v=this;return v.edges.forEach(function(m){if(!(m.source==v||m.target==v))throw"Incorrect edge source and/or target";(m.target==d||m.source==d)&&p.push(m)}),p},h.prototype.getNeighborsList=function(){var d=new Set,p=this;return p.edges.forEach(function(v){if(v.source==p)d.add(v.target);else{if(v.target!=p)throw"Incorrect incidency!";d.add(v.source)}}),d},h.prototype.withChildren=function(){var d=new Set,p,v;if(d.add(this),this.child!=null)for(var m=this.child.getNodes(),g=0;g<m.length;g++)p=m[g],v=p.withChildren(),v.forEach(function(y){d.add(y)});return d},h.prototype.getNoOfChildren=function(){var d=0,p;if(this.child==null)d=1;else for(var v=this.child.getNodes(),m=0;m<v.length;m++)p=v[m],d+=p.getNoOfChildren();return d==0&&(d=1),d},h.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},h.prototype.calcEstimatedSize=function(){return this.child==null?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},h.prototype.scatter=function(){var d,p,v=-u.INITIAL_WORLD_BOUNDARY,m=u.INITIAL_WORLD_BOUNDARY;d=u.WORLD_CENTER_X+l.nextDouble()*(m-v)+v;var g=-u.INITIAL_WORLD_BOUNDARY,y=u.INITIAL_WORLD_BOUNDARY;p=u.WORLD_CENTER_Y+l.nextDouble()*(y-g)+g,this.rect.x=d,this.rect.y=p},h.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var d=this.getChild();if(d.updateBounds(!0),this.rect.x=d.getLeft(),this.rect.y=d.getTop(),this.setWidth(d.getRight()-d.getLeft()),this.setHeight(d.getBottom()-d.getTop()),u.NODE_DIMENSIONS_INCLUDE_LABELS){var p=d.getRight()-d.getLeft(),v=d.getBottom()-d.getTop();this.labelWidth>p&&(this.rect.x-=(this.labelWidth-p)/2,this.setWidth(this.labelWidth)),this.labelHeight>v&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-v)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-v),this.setHeight(this.labelHeight))}}},h.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==o.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},h.prototype.transform=function(d){var p=this.rect.x;p>u.WORLD_BOUNDARY?p=u.WORLD_BOUNDARY:p<-u.WORLD_BOUNDARY&&(p=-u.WORLD_BOUNDARY);var v=this.rect.y;v>u.WORLD_BOUNDARY?v=u.WORLD_BOUNDARY:v<-u.WORLD_BOUNDARY&&(v=-u.WORLD_BOUNDARY);var m=new c(p,v),g=d.inverseTransformPoint(m);this.setLocation(g.x,g.y)},h.prototype.getLeft=function(){return this.rect.x},h.prototype.getRight=function(){return this.rect.x+this.rect.width},h.prototype.getTop=function(){return this.rect.y},h.prototype.getBottom=function(){return this.rect.y+this.rect.height},h.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},r.exports=h},function(r,n,i){function a(o,s){o==null&&s==null?(this.x=0,this.y=0):(this.x=o,this.y=s)}a.prototype.getX=function(){return this.x},a.prototype.getY=function(){return this.y},a.prototype.setX=function(o){this.x=o},a.prototype.setY=function(o){this.y=o},a.prototype.getDifference=function(o){return new DimensionD(this.x-o.x,this.y-o.y)},a.prototype.getCopy=function(){return new a(this.x,this.y)},a.prototype.translate=function(o){return this.x+=o.width,this.y+=o.height,this},r.exports=a},function(r,n,i){var a=i(2),o=i(10),s=i(0),u=i(6),l=i(3),c=i(1),h=i(13),f=i(12),d=i(11);function p(m,g,y){a.call(this,y),this.estimatedSize=o.MIN_VALUE,this.margin=s.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=m,g!=null&&g instanceof u?this.graphManager=g:g!=null&&g instanceof Layout&&(this.graphManager=g.graphManager)}p.prototype=Object.create(a.prototype);for(var v in a)p[v]=a[v];p.prototype.getNodes=function(){return this.nodes},p.prototype.getEdges=function(){return this.edges},p.prototype.getGraphManager=function(){return this.graphManager},p.prototype.getParent=function(){return this.parent},p.prototype.getLeft=function(){return this.left},p.prototype.getRight=function(){return this.right},p.prototype.getTop=function(){return this.top},p.prototype.getBottom=function(){return this.bottom},p.prototype.isConnected=function(){return this.isConnected},p.prototype.add=function(m,g,y){if(g==null&&y==null){var x=m;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(x)>-1)throw"Node already in graph!";return x.owner=this,this.getNodes().push(x),x}else{var T=m;if(!(this.getNodes().indexOf(g)>-1&&this.getNodes().indexOf(y)>-1))throw"Source or target not in graph!";if(!(g.owner==y.owner&&g.owner==this))throw"Both owners must be this graph!";return g.owner!=y.owner?null:(T.source=g,T.target=y,T.isInterGraph=!1,this.getEdges().push(T),g.edges.push(T),y!=g&&y.edges.push(T),T)}},p.prototype.remove=function(m){var g=m;if(m instanceof l){if(g==null)throw"Node is null!";if(!(g.owner!=null&&g.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var y=g.edges.slice(),x,T=y.length,w=0;w<T;w++)x=y[w],x.isInterGraph?this.graphManager.remove(x):x.source.owner.remove(x);var D=this.nodes.indexOf(g);if(D==-1)throw"Node not in owner node list!";this.nodes.splice(D,1)}else if(m instanceof c){var x=m;if(x==null)throw"Edge is null!";if(!(x.source!=null&&x.target!=null))throw"Source and/or target is null!";if(!(x.source.owner!=null&&x.target.owner!=null&&x.source.owner==this&&x.target.owner==this))throw"Source and/or target owner is invalid!";var b=x.source.edges.indexOf(x),_=x.target.edges.indexOf(x);if(!(b>-1&&_>-1))throw"Source and/or target doesn't know this edge!";x.source.edges.splice(b,1),x.target!=x.source&&x.target.edges.splice(_,1);var D=x.source.owner.getEdges().indexOf(x);if(D==-1)throw"Not in owner's edge list!";x.source.owner.getEdges().splice(D,1)}},p.prototype.updateLeftTop=function(){for(var m=o.MAX_VALUE,g=o.MAX_VALUE,y,x,T,w=this.getNodes(),D=w.length,b=0;b<D;b++){var _=w[b];y=_.getTop(),x=_.getLeft(),m>y&&(m=y),g>x&&(g=x)}return m==o.MAX_VALUE?null:(w[0].getParent().paddingLeft!=null?T=w[0].getParent().paddingLeft:T=this.margin,this.left=g-T,this.top=m-T,new f(this.left,this.top))},p.prototype.updateBounds=function(m){for(var g=o.MAX_VALUE,y=-o.MAX_VALUE,x=o.MAX_VALUE,T=-o.MAX_VALUE,w,D,b,_,E,A=this.nodes,C=A.length,N=0;N<C;N++){var S=A[N];m&&S.child!=null&&S.updateBounds(),w=S.getLeft(),D=S.getRight(),b=S.getTop(),_=S.getBottom(),g>w&&(g=w),y<D&&(y=D),x>b&&(x=b),T<_&&(T=_)}var M=new h(g,x,y-g,T-x);g==o.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),A[0].getParent().paddingLeft!=null?E=A[0].getParent().paddingLeft:E=this.margin,this.left=M.x-E,this.right=M.x+M.width+E,this.top=M.y-E,this.bottom=M.y+M.height+E},p.calculateBounds=function(m){for(var g=o.MAX_VALUE,y=-o.MAX_VALUE,x=o.MAX_VALUE,T=-o.MAX_VALUE,w,D,b,_,E=m.length,A=0;A<E;A++){var C=m[A];w=C.getLeft(),D=C.getRight(),b=C.getTop(),_=C.getBottom(),g>w&&(g=w),y<D&&(y=D),x>b&&(x=b),T<_&&(T=_)}var N=new h(g,x,y-g,T-x);return N},p.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},p.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},p.prototype.calcEstimatedSize=function(){for(var m=0,g=this.nodes,y=g.length,x=0;x<y;x++){var T=g[x];m+=T.calcEstimatedSize()}return m==0?this.estimatedSize=s.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=m/Math.sqrt(this.nodes.length),this.estimatedSize},p.prototype.updateConnected=function(){var m=this;if(this.nodes.length==0){this.isConnected=!0;return}var g=new d,y=new Set,x=this.nodes[0],T,w,D=x.withChildren();for(D.forEach(function(N){g.push(N),y.add(N)});g.length!==0;){x=g.shift(),T=x.getEdges();for(var b=T.length,_=0;_<b;_++){var E=T[_];if(w=E.getOtherEndInGraph(x,this),w!=null&&!y.has(w)){var A=w.withChildren();A.forEach(function(N){g.push(N),y.add(N)})}}}if(this.isConnected=!1,y.size>=this.nodes.length){var C=0;y.forEach(function(N){N.owner==m&&C++}),C==this.nodes.length&&(this.isConnected=!0)}},r.exports=p},function(r,n,i){var a,o=i(1);function s(u){a=i(5),this.layout=u,this.graphs=[],this.edges=[]}s.prototype.addRoot=function(){var u=this.layout.newGraph(),l=this.layout.newNode(null),c=this.add(u,l);return this.setRootGraph(c),this.rootGraph},s.prototype.add=function(u,l,c,h,f){if(c==null&&h==null&&f==null){if(u==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(u)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(u),u.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return u.parent=l,l.child=u,u}else{f=c,h=l,c=u;var d=h.getOwner(),p=f.getOwner();if(!(d!=null&&d.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(p!=null&&p.getGraphManager()==this))throw"Target not in this graph mgr!";if(d==p)return c.isInterGraph=!1,d.add(c,h,f);if(c.isInterGraph=!0,c.source=h,c.target=f,this.edges.indexOf(c)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(c),!(c.source!=null&&c.target!=null))throw"Edge source and/or target is null!";if(!(c.source.edges.indexOf(c)==-1&&c.target.edges.indexOf(c)==-1))throw"Edge already in source and/or target incidency list!";return c.source.edges.push(c),c.target.edges.push(c),c}},s.prototype.remove=function(u){if(u instanceof a){var l=u;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var c=[];c=c.concat(l.getEdges());for(var h,f=c.length,d=0;d<f;d++)h=c[d],l.remove(h);var p=[];p=p.concat(l.getNodes());var v;f=p.length;for(var d=0;d<f;d++)v=p[d],l.remove(v);l==this.rootGraph&&this.setRootGraph(null);var m=this.graphs.indexOf(l);this.graphs.splice(m,1),l.parent=null}else if(u instanceof o){if(h=u,h==null)throw"Edge is null!";if(!h.isInterGraph)throw"Not an inter-graph edge!";if(!(h.source!=null&&h.target!=null))throw"Source and/or target is null!";if(!(h.source.edges.indexOf(h)!=-1&&h.target.edges.indexOf(h)!=-1))throw"Source and/or target doesn't know this edge!";var m=h.source.edges.indexOf(h);if(h.source.edges.splice(m,1),m=h.target.edges.indexOf(h),h.target.edges.splice(m,1),!(h.source.owner!=null&&h.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(h.source.owner.getGraphManager().edges.indexOf(h)==-1)throw"Not in owner graph manager's edge list!";var m=h.source.owner.getGraphManager().edges.indexOf(h);h.source.owner.getGraphManager().edges.splice(m,1)}},s.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},s.prototype.getGraphs=function(){return this.graphs},s.prototype.getAllNodes=function(){if(this.allNodes==null){for(var u=[],l=this.getGraphs(),c=l.length,h=0;h<c;h++)u=u.concat(l[h].getNodes());this.allNodes=u}return this.allNodes},s.prototype.resetAllNodes=function(){this.allNodes=null},s.prototype.resetAllEdges=function(){this.allEdges=null},s.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},s.prototype.getAllEdges=function(){if(this.allEdges==null){var u=[],l=this.getGraphs();l.length;for(var c=0;c<l.length;c++)u=u.concat(l[c].getEdges());u=u.concat(this.edges),this.allEdges=u}return this.allEdges},s.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},s.prototype.setAllNodesToApplyGravitation=function(u){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=u},s.prototype.getRoot=function(){return this.rootGraph},s.prototype.setRootGraph=function(u){if(u.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=u,u.parent==null&&(u.parent=this.layout.newNode("Root node"))},s.prototype.getLayout=function(){return this.layout},s.prototype.isOneAncestorOfOther=function(u,l){if(!(u!=null&&l!=null))throw"assert failed";if(u==l)return!0;var c=u.getOwner(),h;do{if(h=c.getParent(),h==null)break;if(h==l)return!0;if(c=h.getOwner(),c==null)break}while(!0);c=l.getOwner();do{if(h=c.getParent(),h==null)break;if(h==u)return!0;if(c=h.getOwner(),c==null)break}while(!0);return!1},s.prototype.calcLowestCommonAncestors=function(){for(var u,l,c,h,f,d=this.getAllEdges(),p=d.length,v=0;v<p;v++){if(u=d[v],l=u.source,c=u.target,u.lca=null,u.sourceInLca=l,u.targetInLca=c,l==c){u.lca=l.getOwner();continue}for(h=l.getOwner();u.lca==null;){for(u.targetInLca=c,f=c.getOwner();u.lca==null;){if(f==h){u.lca=f;break}if(f==this.rootGraph)break;if(u.lca!=null)throw"assert failed";u.targetInLca=f.getParent(),f=u.targetInLca.getOwner()}if(h==this.rootGraph)break;u.lca==null&&(u.sourceInLca=h.getParent(),h=u.sourceInLca.getOwner())}if(u.lca==null)throw"assert failed"}},s.prototype.calcLowestCommonAncestor=function(u,l){if(u==l)return u.getOwner();var c=u.getOwner();do{if(c==null)break;var h=l.getOwner();do{if(h==null)break;if(h==c)return h;h=h.getParent().getOwner()}while(!0);c=c.getParent().getOwner()}while(!0);return c},s.prototype.calcInclusionTreeDepths=function(u,l){u==null&&l==null&&(u=this.rootGraph,l=1);for(var c,h=u.getNodes(),f=h.length,d=0;d<f;d++)c=h[d],c.inclusionTreeDepth=l,c.child!=null&&this.calcInclusionTreeDepths(c.child,l+1)},s.prototype.includesInvalidEdge=function(){for(var u,l=this.edges.length,c=0;c<l;c++)if(u=this.edges[c],this.isOneAncestorOfOther(u.source,u.target))return!0;return!1},r.exports=s},function(r,n,i){var a=i(0);function o(){}for(var s in a)o[s]=a[s];o.MAX_ITERATIONS=2500,o.DEFAULT_EDGE_LENGTH=50,o.DEFAULT_SPRING_STRENGTH=.45,o.DEFAULT_REPULSION_STRENGTH=4500,o.DEFAULT_GRAVITY_STRENGTH=.4,o.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,o.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,o.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,o.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,o.COOLING_ADAPTATION_FACTOR=.33,o.ADAPTATION_LOWER_NODE_LIMIT=1e3,o.ADAPTATION_UPPER_NODE_LIMIT=5e3,o.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,o.MAX_NODE_DISPLACEMENT=o.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,o.MIN_REPULSION_DIST=o.DEFAULT_EDGE_LENGTH/10,o.CONVERGENCE_CHECK_PERIOD=100,o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,o.MIN_EDGE_LENGTH=1,o.GRID_CALCULATION_CHECK_PERIOD=10,r.exports=o},function(r,n,i){var a=i(12);function o(){}o.calcSeparationAmount=function(s,u,l,c){if(!s.intersects(u))throw"assert failed";var h=new Array(2);this.decideDirectionsForOverlappingNodes(s,u,h),l[0]=Math.min(s.getRight(),u.getRight())-Math.max(s.x,u.x),l[1]=Math.min(s.getBottom(),u.getBottom())-Math.max(s.y,u.y),s.getX()<=u.getX()&&s.getRight()>=u.getRight()?l[0]+=Math.min(u.getX()-s.getX(),s.getRight()-u.getRight()):u.getX()<=s.getX()&&u.getRight()>=s.getRight()&&(l[0]+=Math.min(s.getX()-u.getX(),u.getRight()-s.getRight())),s.getY()<=u.getY()&&s.getBottom()>=u.getBottom()?l[1]+=Math.min(u.getY()-s.getY(),s.getBottom()-u.getBottom()):u.getY()<=s.getY()&&u.getBottom()>=s.getBottom()&&(l[1]+=Math.min(s.getY()-u.getY(),u.getBottom()-s.getBottom()));var f=Math.abs((u.getCenterY()-s.getCenterY())/(u.getCenterX()-s.getCenterX()));u.getCenterY()===s.getCenterY()&&u.getCenterX()===s.getCenterX()&&(f=1);var d=f*l[0],p=l[1]/f;l[0]<p?p=l[0]:d=l[1],l[0]=-1*h[0]*(p/2+c),l[1]=-1*h[1]*(d/2+c)},o.decideDirectionsForOverlappingNodes=function(s,u,l){s.getCenterX()<u.getCenterX()?l[0]=-1:l[0]=1,s.getCenterY()<u.getCenterY()?l[1]=-1:l[1]=1},o.getIntersection2=function(s,u,l){var c=s.getCenterX(),h=s.getCenterY(),f=u.getCenterX(),d=u.getCenterY();if(s.intersects(u))return l[0]=c,l[1]=h,l[2]=f,l[3]=d,!0;var p=s.getX(),v=s.getY(),m=s.getRight(),g=s.getX(),y=s.getBottom(),x=s.getRight(),T=s.getWidthHalf(),w=s.getHeightHalf(),D=u.getX(),b=u.getY(),_=u.getRight(),E=u.getX(),A=u.getBottom(),C=u.getRight(),N=u.getWidthHalf(),S=u.getHeightHalf(),M=!1,R=!1;if(c===f){if(h>d)return l[0]=c,l[1]=v,l[2]=f,l[3]=A,!1;if(h<d)return l[0]=c,l[1]=y,l[2]=f,l[3]=b,!1}else if(h===d){if(c>f)return l[0]=p,l[1]=h,l[2]=_,l[3]=d,!1;if(c<f)return l[0]=m,l[1]=h,l[2]=D,l[3]=d,!1}else{var P=s.height/s.width,L=u.height/u.width,O=(d-h)/(f-c),I=void 0,B=void 0,F=void 0,z=void 0,G=void 0,H=void 0;if(-P===O?c>f?(l[0]=g,l[1]=y,M=!0):(l[0]=m,l[1]=v,M=!0):P===O&&(c>f?(l[0]=p,l[1]=v,M=!0):(l[0]=x,l[1]=y,M=!0)),-L===O?f>c?(l[2]=E,l[3]=A,R=!0):(l[2]=_,l[3]=b,R=!0):L===O&&(f>c?(l[2]=D,l[3]=b,R=!0):(l[2]=C,l[3]=A,R=!0)),M&&R)return!1;if(c>f?h>d?(I=this.getCardinalDirection(P,O,4),B=this.getCardinalDirection(L,O,2)):(I=this.getCardinalDirection(-P,O,3),B=this.getCardinalDirection(-L,O,1)):h>d?(I=this.getCardinalDirection(-P,O,1),B=this.getCardinalDirection(-L,O,3)):(I=this.getCardinalDirection(P,O,2),B=this.getCardinalDirection(L,O,4)),!M)switch(I){case 1:z=v,F=c+-w/O,l[0]=F,l[1]=z;break;case 2:F=x,z=h+T*O,l[0]=F,l[1]=z;break;case 3:z=y,F=c+w/O,l[0]=F,l[1]=z;break;case 4:F=g,z=h+-T*O,l[0]=F,l[1]=z;break}if(!R)switch(B){case 1:H=b,G=f+-S/O,l[2]=G,l[3]=H;break;case 2:G=C,H=d+N*O,l[2]=G,l[3]=H;break;case 3:H=A,G=f+S/O,l[2]=G,l[3]=H;break;case 4:G=E,H=d+-N*O,l[2]=G,l[3]=H;break}}return!1},o.getCardinalDirection=function(s,u,l){return s>u?l:1+l%4},o.getIntersection=function(s,u,l,c){if(c==null)return this.getIntersection2(s,u,l);var h=s.x,f=s.y,d=u.x,p=u.y,v=l.x,m=l.y,g=c.x,y=c.y,x=void 0,T=void 0,w=void 0,D=void 0,b=void 0,_=void 0,E=void 0,A=void 0,C=void 0;return w=p-f,b=h-d,E=d*f-h*p,D=y-m,_=v-g,A=g*m-v*y,C=w*_-D*b,C===0?null:(x=(b*A-_*E)/C,T=(D*E-w*A)/C,new a(x,T))},o.angleOfVector=function(s,u,l,c){var h=void 0;return s!==l?(h=Math.atan((c-u)/(l-s)),l<s?h+=Math.PI:c<u&&(h+=this.TWO_PI)):c<u?h=this.ONE_AND_HALF_PI:h=this.HALF_PI,h},o.doIntersect=function(s,u,l,c){var h=s.x,f=s.y,d=u.x,p=u.y,v=l.x,m=l.y,g=c.x,y=c.y,x=(d-h)*(y-m)-(g-v)*(p-f);if(x===0)return!1;var T=((y-m)*(g-h)+(v-g)*(y-f))/x,w=((f-p)*(g-h)+(d-h)*(y-f))/x;return 0<T&&T<1&&0<w&&w<1},o.HALF_PI=.5*Math.PI,o.ONE_AND_HALF_PI=1.5*Math.PI,o.TWO_PI=2*Math.PI,o.THREE_PI=3*Math.PI,r.exports=o},function(r,n,i){function a(){}a.sign=function(o){return o>0?1:o<0?-1:0},a.floor=function(o){return o<0?Math.ceil(o):Math.floor(o)},a.ceil=function(o){return o<0?Math.floor(o):Math.ceil(o)},r.exports=a},function(r,n,i){function a(){}a.MAX_VALUE=2147483647,a.MIN_VALUE=-2147483648,r.exports=a},function(r,n,i){var a=function(){function h(f,d){for(var p=0;p<d.length;p++){var v=d[p];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,d,p){return d&&h(f.prototype,d),p&&h(f,p),f}}();function o(h,f){if(!(h instanceof f))throw new TypeError("Cannot call a class as a function")}var s=function(h){return{value:h,next:null,prev:null}},u=function(h,f,d,p){return h!==null?h.next=f:p.head=f,d!==null?d.prev=f:p.tail=f,f.prev=h,f.next=d,p.length++,f},l=function(h,f){var d=h.prev,p=h.next;return d!==null?d.next=p:f.head=p,p!==null?p.prev=d:f.tail=d,h.prev=h.next=null,f.length--,h},c=function(){function h(f){var d=this;o(this,h),this.length=0,this.head=null,this.tail=null,f!=null&&f.forEach(function(p){return d.push(p)})}return a(h,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(f,d){return u(d.prev,s(f),d,this)}},{key:"insertAfter",value:function(f,d){return u(d,s(f),d.next,this)}},{key:"insertNodeBefore",value:function(f,d){return u(d.prev,f,d,this)}},{key:"insertNodeAfter",value:function(f,d){return u(d,f,d.next,this)}},{key:"push",value:function(f){return u(this.tail,s(f),null,this)}},{key:"unshift",value:function(f){return u(null,s(f),this.head,this)}},{key:"remove",value:function(f){return l(f,this)}},{key:"pop",value:function(){return l(this.tail,this).value}},{key:"popNode",value:function(){return l(this.tail,this)}},{key:"shift",value:function(){return l(this.head,this).value}},{key:"shiftNode",value:function(){return l(this.head,this)}},{key:"get_object_at",value:function(f){if(f<=this.length()){for(var d=1,p=this.head;d<f;)p=p.next,d++;return p.value}}},{key:"set_object_at",value:function(f,d){if(f<=this.length()){for(var p=1,v=this.head;p<f;)v=v.next,p++;v.value=d}}}]),h}();r.exports=c},function(r,n,i){function a(o,s,u){this.x=null,this.y=null,o==null&&s==null&&u==null?(this.x=0,this.y=0):typeof o=="number"&&typeof s=="number"&&u==null?(this.x=o,this.y=s):o.constructor.name=="Point"&&s==null&&u==null&&(u=o,this.x=u.x,this.y=u.y)}a.prototype.getX=function(){return this.x},a.prototype.getY=function(){return this.y},a.prototype.getLocation=function(){return new a(this.x,this.y)},a.prototype.setLocation=function(o,s,u){o.constructor.name=="Point"&&s==null&&u==null?(u=o,this.setLocation(u.x,u.y)):typeof o=="number"&&typeof s=="number"&&u==null&&(parseInt(o)==o&&parseInt(s)==s?this.move(o,s):(this.x=Math.floor(o+.5),this.y=Math.floor(s+.5)))},a.prototype.move=function(o,s){this.x=o,this.y=s},a.prototype.translate=function(o,s){this.x+=o,this.y+=s},a.prototype.equals=function(o){if(o.constructor.name=="Point"){var s=o;return this.x==s.x&&this.y==s.y}return this==o},a.prototype.toString=function(){return new a().constructor.name+"[x="+this.x+",y="+this.y+"]"},r.exports=a},function(r,n,i){function a(o,s,u,l){this.x=0,this.y=0,this.width=0,this.height=0,o!=null&&s!=null&&u!=null&&l!=null&&(this.x=o,this.y=s,this.width=u,this.height=l)}a.prototype.getX=function(){return this.x},a.prototype.setX=function(o){this.x=o},a.prototype.getY=function(){return this.y},a.prototype.setY=function(o){this.y=o},a.prototype.getWidth=function(){return this.width},a.prototype.setWidth=function(o){this.width=o},a.prototype.getHeight=function(){return this.height},a.prototype.setHeight=function(o){this.height=o},a.prototype.getRight=function(){return this.x+this.width},a.prototype.getBottom=function(){return this.y+this.height},a.prototype.intersects=function(o){return!(this.getRight()<o.x||this.getBottom()<o.y||o.getRight()<this.x||o.getBottom()<this.y)},a.prototype.getCenterX=function(){return this.x+this.width/2},a.prototype.getMinX=function(){return this.getX()},a.prototype.getMaxX=function(){return this.getX()+this.width},a.prototype.getCenterY=function(){return this.y+this.height/2},a.prototype.getMinY=function(){return this.getY()},a.prototype.getMaxY=function(){return this.getY()+this.height},a.prototype.getWidthHalf=function(){return this.width/2},a.prototype.getHeightHalf=function(){return this.height/2},r.exports=a},function(r,n,i){var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s};function o(){}o.lastID=0,o.createID=function(s){return o.isPrimitive(s)?s:(s.uniqueID!=null||(s.uniqueID=o.getString(),o.lastID++),s.uniqueID)},o.getString=function(s){return s==null&&(s=o.lastID),"Object#"+s},o.isPrimitive=function(s){var u=typeof s>"u"?"undefined":a(s);return s==null||u!="object"&&u!="function"},r.exports=o},function(r,n,i){function a(v){if(Array.isArray(v)){for(var m=0,g=Array(v.length);m<v.length;m++)g[m]=v[m];return g}else return Array.from(v)}var o=i(0),s=i(6),u=i(3),l=i(1),c=i(5),h=i(4),f=i(17),d=i(27);function p(v){d.call(this),this.layoutQuality=o.QUALITY,this.createBendsAsNeeded=o.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=o.DEFAULT_INCREMENTAL,this.animationOnLayout=o.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=o.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=o.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=o.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new s(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,v!=null&&(this.isRemoteUse=v)}p.RANDOM_SEED=1,p.prototype=Object.create(d.prototype),p.prototype.getGraphManager=function(){return this.graphManager},p.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},p.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},p.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},p.prototype.newGraphManager=function(){var v=new s(this);return this.graphManager=v,v},p.prototype.newGraph=function(v){return new c(null,this.graphManager,v)},p.prototype.newNode=function(v){return new u(this.graphManager,v)},p.prototype.newEdge=function(v){return new l(null,null,v)},p.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},p.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var v;return this.checkLayoutSuccess()?v=!1:v=this.layout(),o.ANIMATE==="during"?!1:(v&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,v)},p.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},p.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var v=this.graphManager.getAllEdges(),m=0;m<v.length;m++)v[m];for(var g=this.graphManager.getRoot().getNodes(),m=0;m<g.length;m++)g[m];this.update(this.graphManager.getRoot())}},p.prototype.update=function(v){if(v==null)this.update2();else if(v instanceof u){var m=v;if(m.getChild()!=null)for(var g=m.getChild().getNodes(),y=0;y<g.length;y++)update(g[y]);if(m.vGraphObject!=null){var x=m.vGraphObject;x.update(m)}}else if(v instanceof l){var T=v;if(T.vGraphObject!=null){var w=T.vGraphObject;w.update(T)}}else if(v instanceof c){var D=v;if(D.vGraphObject!=null){var b=D.vGraphObject;b.update(D)}}},p.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=o.QUALITY,this.animationDuringLayout=o.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=o.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=o.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=o.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=o.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=o.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},p.prototype.transform=function(v){if(v==null)this.transform(new h(0,0));else{var m=new f,g=this.graphManager.getRoot().updateLeftTop();if(g!=null){m.setWorldOrgX(v.x),m.setWorldOrgY(v.y),m.setDeviceOrgX(g.x),m.setDeviceOrgY(g.y);for(var y=this.getAllNodes(),x,T=0;T<y.length;T++)x=y[T],x.transform(m)}}},p.prototype.positionNodesRandomly=function(v){if(v==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var m,g,y=v.getNodes(),x=0;x<y.length;x++)m=y[x],g=m.getChild(),g==null||g.getNodes().length==0?m.scatter():(this.positionNodesRandomly(g),m.updateBounds())},p.prototype.getFlatForest=function(){for(var v=[],m=!0,g=this.graphManager.getRoot().getNodes(),y=!0,x=0;x<g.length;x++)g[x].getChild()!=null&&(y=!1);if(!y)return v;var T=new Set,w=[],D=new Map,b=[];for(b=b.concat(g);b.length>0&&m;){for(w.push(b[0]);w.length>0&&m;){var _=w[0];w.splice(0,1),T.add(_);for(var E=_.getEdges(),x=0;x<E.length;x++){var A=E[x].getOtherEnd(_);if(D.get(_)!=A)if(!T.has(A))w.push(A),D.set(A,_);else{m=!1;break}}}if(!m)v=[];else{var C=[].concat(a(T));v.push(C);for(var x=0;x<C.length;x++){var N=C[x],S=b.indexOf(N);S>-1&&b.splice(S,1)}T=new Set,D=new Map}}return v},p.prototype.createDummyNodesForBendpoints=function(v){for(var m=[],g=v.source,y=this.graphManager.calcLowestCommonAncestor(v.source,v.target),x=0;x<v.bendpoints.length;x++){var T=this.newNode(null);T.setRect(new Point(0,0),new Dimension(1,1)),y.add(T);var w=this.newEdge(null);this.graphManager.add(w,g,T),m.add(T),g=T}var w=this.newEdge(null);return this.graphManager.add(w,g,v.target),this.edgeToDummyNodes.set(v,m),v.isInterGraph()?this.graphManager.remove(v):y.remove(v),m},p.prototype.createBendpointsFromDummyNodes=function(){var v=[];v=v.concat(this.graphManager.getAllEdges()),v=[].concat(a(this.edgeToDummyNodes.keys())).concat(v);for(var m=0;m<v.length;m++){var g=v[m];if(g.bendpoints.length>0){for(var y=this.edgeToDummyNodes.get(g),x=0;x<y.length;x++){var T=y[x],w=new h(T.getCenterX(),T.getCenterY()),D=g.bendpoints.get(x);D.x=w.x,D.y=w.y,T.getOwner().remove(T)}this.graphManager.add(g,g.source,g.target)}}},p.transform=function(v,m,g,y){if(g!=null&&y!=null){var x=m;if(v<=50){var T=m/g;x-=(m-T)/50*(50-v)}else{var w=m*y;x+=(w-m)/50*(v-50)}return x}else{var D,b;return v<=50?(D=9*m/500,b=m/10):(D=9*m/50,b=-8*m),D*v+b}},p.findCenterOfTree=function(v){var m=[];m=m.concat(v);var g=[],y=new Map,x=!1,T=null;(m.length==1||m.length==2)&&(x=!0,T=m[0]);for(var w=0;w<m.length;w++){var D=m[w],b=D.getNeighborsList().size;y.set(D,D.getNeighborsList().size),b==1&&g.push(D)}var _=[];for(_=_.concat(g);!x;){var E=[];E=E.concat(_),_=[];for(var w=0;w<m.length;w++){var D=m[w],A=m.indexOf(D);A>=0&&m.splice(A,1);var C=D.getNeighborsList();C.forEach(function(M){if(g.indexOf(M)<0){var R=y.get(M),P=R-1;P==1&&_.push(M),y.set(M,P)}})}g=g.concat(_),(m.length==1||m.length==2)&&(x=!0,T=m[0])}return T},p.prototype.setGraphManager=function(v){this.graphManager=v},r.exports=p},function(r,n,i){function a(){}a.seed=1,a.x=0,a.nextDouble=function(){return a.x=Math.sin(a.seed++)*1e4,a.x-Math.floor(a.x)},r.exports=a},function(r,n,i){var a=i(4);function o(s,u){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}o.prototype.getWorldOrgX=function(){return this.lworldOrgX},o.prototype.setWorldOrgX=function(s){this.lworldOrgX=s},o.prototype.getWorldOrgY=function(){return this.lworldOrgY},o.prototype.setWorldOrgY=function(s){this.lworldOrgY=s},o.prototype.getWorldExtX=function(){return this.lworldExtX},o.prototype.setWorldExtX=function(s){this.lworldExtX=s},o.prototype.getWorldExtY=function(){return this.lworldExtY},o.prototype.setWorldExtY=function(s){this.lworldExtY=s},o.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},o.prototype.setDeviceOrgX=function(s){this.ldeviceOrgX=s},o.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},o.prototype.setDeviceOrgY=function(s){this.ldeviceOrgY=s},o.prototype.getDeviceExtX=function(){return this.ldeviceExtX},o.prototype.setDeviceExtX=function(s){this.ldeviceExtX=s},o.prototype.getDeviceExtY=function(){return this.ldeviceExtY},o.prototype.setDeviceExtY=function(s){this.ldeviceExtY=s},o.prototype.transformX=function(s){var u=0,l=this.lworldExtX;return l!=0&&(u=this.ldeviceOrgX+(s-this.lworldOrgX)*this.ldeviceExtX/l),u},o.prototype.transformY=function(s){var u=0,l=this.lworldExtY;return l!=0&&(u=this.ldeviceOrgY+(s-this.lworldOrgY)*this.ldeviceExtY/l),u},o.prototype.inverseTransformX=function(s){var u=0,l=this.ldeviceExtX;return l!=0&&(u=this.lworldOrgX+(s-this.ldeviceOrgX)*this.lworldExtX/l),u},o.prototype.inverseTransformY=function(s){var u=0,l=this.ldeviceExtY;return l!=0&&(u=this.lworldOrgY+(s-this.ldeviceOrgY)*this.lworldExtY/l),u},o.prototype.inverseTransformPoint=function(s){var u=new a(this.inverseTransformX(s.x),this.inverseTransformY(s.y));return u},r.exports=o},function(r,n,i){function a(d){if(Array.isArray(d)){for(var p=0,v=Array(d.length);p<d.length;p++)v[p]=d[p];return v}else return Array.from(d)}var o=i(15),s=i(7),u=i(0),l=i(8),c=i(9);function h(){o.call(this),this.useSmartIdealEdgeLengthCalculation=s.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=s.DEFAULT_EDGE_LENGTH,this.springConstant=s.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=s.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=s.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=s.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=s.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*s.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=s.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=s.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=s.MAX_ITERATIONS}h.prototype=Object.create(o.prototype);for(var f in o)h[f]=o[f];h.prototype.initParameters=function(){o.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=s.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},h.prototype.calcIdealEdgeLengths=function(){for(var d,p,v,m,g,y,x=this.getGraphManager().getAllEdges(),T=0;T<x.length;T++)d=x[T],d.idealLength=this.idealEdgeLength,d.isInterGraph&&(v=d.getSource(),m=d.getTarget(),g=d.getSourceInLca().getEstimatedSize(),y=d.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(d.idealLength+=g+y-2*u.SIMPLE_NODE_SIZE),p=d.getLca().getInclusionTreeDepth(),d.idealLength+=s.DEFAULT_EDGE_LENGTH*s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(v.getInclusionTreeDepth()+m.getInclusionTreeDepth()-2*p))},h.prototype.initSpringEmbedder=function(){var d=this.getAllNodes().length;this.incremental?(d>s.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*s.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(d-s.ADAPTATION_LOWER_NODE_LIMIT)/(s.ADAPTATION_UPPER_NODE_LIMIT-s.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-s.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=s.MAX_NODE_DISPLACEMENT_INCREMENTAL):(d>s.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(s.COOLING_ADAPTATION_FACTOR,1-(d-s.ADAPTATION_LOWER_NODE_LIMIT)/(s.ADAPTATION_UPPER_NODE_LIMIT-s.ADAPTATION_LOWER_NODE_LIMIT)*(1-s.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=s.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},h.prototype.calcSpringForces=function(){for(var d=this.getAllEdges(),p,v=0;v<d.length;v++)p=d[v],this.calcSpringForce(p,p.idealLength)},h.prototype.calcRepulsionForces=function(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,v,m,g,y,x=this.getAllNodes(),T;if(this.useFRGridVariant)for(this.totalIterations%s.GRID_CALCULATION_CHECK_PERIOD==1&&d&&this.updateGrid(),T=new Set,v=0;v<x.length;v++)g=x[v],this.calculateRepulsionForceOfANode(g,T,d,p),T.add(g);else for(v=0;v<x.length;v++)for(g=x[v],m=v+1;m<x.length;m++)y=x[m],g.getOwner()==y.getOwner()&&this.calcRepulsionForce(g,y)},h.prototype.calcGravitationalForces=function(){for(var d,p=this.getAllNodesToApplyGravitation(),v=0;v<p.length;v++)d=p[v],this.calcGravitationalForce(d)},h.prototype.moveNodes=function(){for(var d=this.getAllNodes(),p,v=0;v<d.length;v++)p=d[v],p.move()},h.prototype.calcSpringForce=function(d,p){var v=d.getSource(),m=d.getTarget(),g,y,x,T;if(this.uniformLeafNodeSizes&&v.getChild()==null&&m.getChild()==null)d.updateLengthSimple();else if(d.updateLength(),d.isOverlapingSourceAndTarget)return;g=d.getLength(),g!=0&&(y=this.springConstant*(g-p),x=y*(d.lengthX/g),T=y*(d.lengthY/g),v.springForceX+=x,v.springForceY+=T,m.springForceX-=x,m.springForceY-=T)},h.prototype.calcRepulsionForce=function(d,p){var v=d.getRect(),m=p.getRect(),g=new Array(2),y=new Array(4),x,T,w,D,b,_,E;if(v.intersects(m)){l.calcSeparationAmount(v,m,g,s.DEFAULT_EDGE_LENGTH/2),_=2*g[0],E=2*g[1];var A=d.noOfChildren*p.noOfChildren/(d.noOfChildren+p.noOfChildren);d.repulsionForceX-=A*_,d.repulsionForceY-=A*E,p.repulsionForceX+=A*_,p.repulsionForceY+=A*E}else this.uniformLeafNodeSizes&&d.getChild()==null&&p.getChild()==null?(x=m.getCenterX()-v.getCenterX(),T=m.getCenterY()-v.getCenterY()):(l.getIntersection(v,m,y),x=y[2]-y[0],T=y[3]-y[1]),Math.abs(x)<s.MIN_REPULSION_DIST&&(x=c.sign(x)*s.MIN_REPULSION_DIST),Math.abs(T)<s.MIN_REPULSION_DIST&&(T=c.sign(T)*s.MIN_REPULSION_DIST),w=x*x+T*T,D=Math.sqrt(w),b=this.repulsionConstant*d.noOfChildren*p.noOfChildren/w,_=b*x/D,E=b*T/D,d.repulsionForceX-=_,d.repulsionForceY-=E,p.repulsionForceX+=_,p.repulsionForceY+=E},h.prototype.calcGravitationalForce=function(d){var p,v,m,g,y,x,T,w;p=d.getOwner(),v=(p.getRight()+p.getLeft())/2,m=(p.getTop()+p.getBottom())/2,g=d.getCenterX()-v,y=d.getCenterY()-m,x=Math.abs(g)+d.getWidth()/2,T=Math.abs(y)+d.getHeight()/2,d.getOwner()==this.graphManager.getRoot()?(w=p.getEstimatedSize()*this.gravityRangeFactor,(x>w||T>w)&&(d.gravitationForceX=-this.gravityConstant*g,d.gravitationForceY=-this.gravityConstant*y)):(w=p.getEstimatedSize()*this.compoundGravityRangeFactor,(x>w||T>w)&&(d.gravitationForceX=-this.gravityConstant*g*this.compoundGravityConstant,d.gravitationForceY=-this.gravityConstant*y*this.compoundGravityConstant))},h.prototype.isConverged=function(){var d,p=!1;return this.totalIterations>this.maxIterations/3&&(p=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),d=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,d||p},h.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},h.prototype.calcNoOfChildrenForAllNodes=function(){for(var d,p=this.graphManager.getAllNodes(),v=0;v<p.length;v++)d=p[v],d.noOfChildren=d.getNoOfChildren()},h.prototype.calcGrid=function(d){var p=0,v=0;p=parseInt(Math.ceil((d.getRight()-d.getLeft())/this.repulsionRange)),v=parseInt(Math.ceil((d.getBottom()-d.getTop())/this.repulsionRange));for(var m=new Array(p),g=0;g<p;g++)m[g]=new Array(v);for(var g=0;g<p;g++)for(var y=0;y<v;y++)m[g][y]=new Array;return m},h.prototype.addNodeToGrid=function(d,p,v){var m=0,g=0,y=0,x=0;m=parseInt(Math.floor((d.getRect().x-p)/this.repulsionRange)),g=parseInt(Math.floor((d.getRect().width+d.getRect().x-p)/this.repulsionRange)),y=parseInt(Math.floor((d.getRect().y-v)/this.repulsionRange)),x=parseInt(Math.floor((d.getRect().height+d.getRect().y-v)/this.repulsionRange));for(var T=m;T<=g;T++)for(var w=y;w<=x;w++)this.grid[T][w].push(d),d.setGridCoordinates(m,g,y,x)},h.prototype.updateGrid=function(){var d,p,v=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),d=0;d<v.length;d++)p=v[d],this.addNodeToGrid(p,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},h.prototype.calculateRepulsionForceOfANode=function(d,p,v,m){if(this.totalIterations%s.GRID_CALCULATION_CHECK_PERIOD==1&&v||m){var g=new Set;d.surrounding=new Array;for(var y,x=this.grid,T=d.startX-1;T<d.finishX+2;T++)for(var w=d.startY-1;w<d.finishY+2;w++)if(!(T<0||w<0||T>=x.length||w>=x[0].length)){for(var D=0;D<x[T][w].length;D++)if(y=x[T][w][D],!(d.getOwner()!=y.getOwner()||d==y)&&!p.has(y)&&!g.has(y)){var b=Math.abs(d.getCenterX()-y.getCenterX())-(d.getWidth()/2+y.getWidth()/2),_=Math.abs(d.getCenterY()-y.getCenterY())-(d.getHeight()/2+y.getHeight()/2);b<=this.repulsionRange&&_<=this.repulsionRange&&g.add(y)}}d.surrounding=[].concat(a(g))}for(T=0;T<d.surrounding.length;T++)this.calcRepulsionForce(d,d.surrounding[T])},h.prototype.calcRepulsionRange=function(){return 0},r.exports=h},function(r,n,i){var a=i(1),o=i(7);function s(l,c,h){a.call(this,l,c,h),this.idealLength=o.DEFAULT_EDGE_LENGTH}s.prototype=Object.create(a.prototype);for(var u in a)s[u]=a[u];r.exports=s},function(r,n,i){var a=i(3);function o(u,l,c,h){a.call(this,u,l,c,h),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}o.prototype=Object.create(a.prototype);for(var s in a)o[s]=a[s];o.prototype.setGridCoordinates=function(u,l,c,h){this.startX=u,this.finishX=l,this.startY=c,this.finishY=h},r.exports=o},function(r,n,i){function a(o,s){this.width=0,this.height=0,o!==null&&s!==null&&(this.height=s,this.width=o)}a.prototype.getWidth=function(){return this.width},a.prototype.setWidth=function(o){this.width=o},a.prototype.getHeight=function(){return this.height},a.prototype.setHeight=function(o){this.height=o},r.exports=a},function(r,n,i){var a=i(14);function o(){this.map={},this.keys=[]}o.prototype.put=function(s,u){var l=a.createID(s);this.contains(l)||(this.map[l]=u,this.keys.push(s))},o.prototype.contains=function(s){return a.createID(s),this.map[s]!=null},o.prototype.get=function(s){var u=a.createID(s);return this.map[u]},o.prototype.keySet=function(){return this.keys},r.exports=o},function(r,n,i){var a=i(14);function o(){this.set={}}o.prototype.add=function(s){var u=a.createID(s);this.contains(u)||(this.set[u]=s)},o.prototype.remove=function(s){delete this.set[a.createID(s)]},o.prototype.clear=function(){this.set={}},o.prototype.contains=function(s){return this.set[a.createID(s)]==s},o.prototype.isEmpty=function(){return this.size()===0},o.prototype.size=function(){return Object.keys(this.set).length},o.prototype.addAllTo=function(s){for(var u=Object.keys(this.set),l=u.length,c=0;c<l;c++)s.push(this.set[u[c]])},o.prototype.size=function(){return Object.keys(this.set).length},o.prototype.addAll=function(s){for(var u=s.length,l=0;l<u;l++){var c=s[l];this.add(c)}},r.exports=o},function(r,n,i){var a=function(){function l(c,h){for(var f=0;f<h.length;f++){var d=h[f];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(c,d.key,d)}}return function(c,h,f){return h&&l(c.prototype,h),f&&l(c,f),c}}();function o(l,c){if(!(l instanceof c))throw new TypeError("Cannot call a class as a function")}var s=i(11),u=function(){function l(c,h){o(this,l),(h!==null||h!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var f=void 0;c instanceof s?f=c.size():f=c.length,this._quicksort(c,0,f-1)}return a(l,[{key:"_quicksort",value:function(c,h,f){if(h<f){var d=this._partition(c,h,f);this._quicksort(c,h,d),this._quicksort(c,d+1,f)}}},{key:"_partition",value:function(c,h,f){for(var d=this._get(c,h),p=h,v=f;;){for(;this.compareFunction(d,this._get(c,v));)v--;for(;this.compareFunction(this._get(c,p),d);)p++;if(p<v)this._swap(c,p,v),p++,v--;else return v}}},{key:"_get",value:function(c,h){return c instanceof s?c.get_object_at(h):c[h]}},{key:"_set",value:function(c,h,f){c instanceof s?c.set_object_at(h,f):c[h]=f}},{key:"_swap",value:function(c,h,f){var d=this._get(c,h);this._set(c,h,this._get(c,f)),this._set(c,f,d)}},{key:"_defaultCompareFunction",value:function(c,h){return h>c}}]),l}();r.exports=u},function(r,n,i){var a=function(){function u(l,c){for(var h=0;h<c.length;h++){var f=c[h];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(l,f.key,f)}}return function(l,c,h){return c&&u(l.prototype,c),h&&u(l,h),l}}();function o(u,l){if(!(u instanceof l))throw new TypeError("Cannot call a class as a function")}var s=function(){function u(l,c){var h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;o(this,u),this.sequence1=l,this.sequence2=c,this.match_score=h,this.mismatch_penalty=f,this.gap_penalty=d,this.iMax=l.length+1,this.jMax=c.length+1,this.grid=new Array(this.iMax);for(var p=0;p<this.iMax;p++){this.grid[p]=new Array(this.jMax);for(var v=0;v<this.jMax;v++)this.grid[p][v]=0}this.tracebackGrid=new Array(this.iMax);for(var m=0;m<this.iMax;m++){this.tracebackGrid[m]=new Array(this.jMax);for(var g=0;g<this.jMax;g++)this.tracebackGrid[m][g]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return a(u,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var l=1;l<this.jMax;l++)this.grid[0][l]=this.grid[0][l-1]+this.gap_penalty,this.tracebackGrid[0][l]=[!1,!1,!0];for(var c=1;c<this.iMax;c++)this.grid[c][0]=this.grid[c-1][0]+this.gap_penalty,this.tracebackGrid[c][0]=[!1,!0,!1];for(var h=1;h<this.iMax;h++)for(var f=1;f<this.jMax;f++){var d=void 0;this.sequence1[h-1]===this.sequence2[f-1]?d=this.grid[h-1][f-1]+this.match_score:d=this.grid[h-1][f-1]+this.mismatch_penalty;var p=this.grid[h-1][f]+this.gap_penalty,v=this.grid[h][f-1]+this.gap_penalty,m=[d,p,v],g=this.arrayAllMaxIndexes(m);this.grid[h][f]=m[g[0]],this.tracebackGrid[h][f]=[g.includes(0),g.includes(1),g.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var l=[];for(l.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});l[0];){var c=l[0],h=this.tracebackGrid[c.pos[0]][c.pos[1]];h[0]&&l.push({pos:[c.pos[0]-1,c.pos[1]-1],seq1:this.sequence1[c.pos[0]-1]+c.seq1,seq2:this.sequence2[c.pos[1]-1]+c.seq2}),h[1]&&l.push({pos:[c.pos[0]-1,c.pos[1]],seq1:this.sequence1[c.pos[0]-1]+c.seq1,seq2:"-"+c.seq2}),h[2]&&l.push({pos:[c.pos[0],c.pos[1]-1],seq1:"-"+c.seq1,seq2:this.sequence2[c.pos[1]-1]+c.seq2}),c.pos[0]===0&&c.pos[1]===0&&this.alignments.push({sequence1:c.seq1,sequence2:c.seq2}),l.shift()}return this.alignments}},{key:"getAllIndexes",value:function(l,c){for(var h=[],f=-1;(f=l.indexOf(c,f+1))!==-1;)h.push(f);return h}},{key:"arrayAllMaxIndexes",value:function(l){return this.getAllIndexes(l,Math.max.apply(null,l))}}]),u}();r.exports=s},function(r,n,i){var a=function(){};a.FDLayout=i(18),a.FDLayoutConstants=i(7),a.FDLayoutEdge=i(19),a.FDLayoutNode=i(20),a.DimensionD=i(21),a.HashMap=i(22),a.HashSet=i(23),a.IGeometry=i(8),a.IMath=i(9),a.Integer=i(10),a.Point=i(12),a.PointD=i(4),a.RandomSeed=i(16),a.RectangleD=i(13),a.Transform=i(17),a.UniqueIDGeneretor=i(14),a.Quicksort=i(24),a.LinkedList=i(11),a.LGraphObject=i(2),a.LGraph=i(5),a.LEdge=i(1),a.LGraphManager=i(6),a.LNode=i(3),a.Layout=i(15),a.LayoutConstants=i(0),a.NeedlemanWunsch=i(25),r.exports=a},function(r,n,i){function a(){this.listeners=[]}var o=a.prototype;o.addListener=function(s,u){this.listeners.push({event:s,callback:u})},o.removeListener=function(s,u){for(var l=this.listeners.length;l>=0;l--){var c=this.listeners[l];c.event===s&&c.callback===u&&this.listeners.splice(l,1)}},o.emit=function(s,u){for(var l=0;l<this.listeners.length;l++){var c=this.listeners[l];s===c.event&&c.callback(u)}},r.exports=a}])})}(es)),es.exports}var nm=Jo.exports,uc;function im(){return uc||(uc=1,function(e,t){(function(r,n){e.exports=n(rm())})(nm,function(r){return function(n){var i={};function a(o){if(i[o])return i[o].exports;var s=i[o]={i:o,l:!1,exports:{}};return n[o].call(s.exports,s,s.exports,a),s.l=!0,s.exports}return a.m=n,a.c=i,a.i=function(o){return o},a.d=function(o,s,u){a.o(o,s)||Object.defineProperty(o,s,{configurable:!1,enumerable:!0,get:u})},a.n=function(o){var s=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(s,"a",s),s},a.o=function(o,s){return Object.prototype.hasOwnProperty.call(o,s)},a.p="",a(a.s=7)}([function(n,i){n.exports=r},function(n,i,a){var o=a(0).FDLayoutConstants;function s(){}for(var u in o)s[u]=o[u];s.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,s.DEFAULT_RADIAL_SEPARATION=o.DEFAULT_EDGE_LENGTH,s.DEFAULT_COMPONENT_SEPERATION=60,s.TILE=!0,s.TILING_PADDING_VERTICAL=10,s.TILING_PADDING_HORIZONTAL=10,s.TREE_REDUCTION_ON_INCREMENTAL=!1,n.exports=s},function(n,i,a){var o=a(0).FDLayoutEdge;function s(l,c,h){o.call(this,l,c,h)}s.prototype=Object.create(o.prototype);for(var u in o)s[u]=o[u];n.exports=s},function(n,i,a){var o=a(0).LGraph;function s(l,c,h){o.call(this,l,c,h)}s.prototype=Object.create(o.prototype);for(var u in o)s[u]=o[u];n.exports=s},function(n,i,a){var o=a(0).LGraphManager;function s(l){o.call(this,l)}s.prototype=Object.create(o.prototype);for(var u in o)s[u]=o[u];n.exports=s},function(n,i,a){var o=a(0).FDLayoutNode,s=a(0).IMath;function u(c,h,f,d){o.call(this,c,h,f,d)}u.prototype=Object.create(o.prototype);for(var l in o)u[l]=o[l];u.prototype.move=function(){var c=this.graphManager.getLayout();this.displacementX=c.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=c.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>c.coolingFactor*c.maxNodeDisplacement&&(this.displacementX=c.coolingFactor*c.maxNodeDisplacement*s.sign(this.displacementX)),Math.abs(this.displacementY)>c.coolingFactor*c.maxNodeDisplacement&&(this.displacementY=c.coolingFactor*c.maxNodeDisplacement*s.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),c.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},u.prototype.propogateDisplacementToChildren=function(c,h){for(var f=this.getChild().getNodes(),d,p=0;p<f.length;p++)d=f[p],d.getChild()==null?(d.moveBy(c,h),d.displacementX+=c,d.displacementY+=h):d.propogateDisplacementToChildren(c,h)},u.prototype.setPred1=function(c){this.pred1=c},u.prototype.getPred1=function(){return pred1},u.prototype.getPred2=function(){return pred2},u.prototype.setNext=function(c){this.next=c},u.prototype.getNext=function(){return next},u.prototype.setProcessed=function(c){this.processed=c},u.prototype.isProcessed=function(){return processed},n.exports=u},function(n,i,a){var o=a(0).FDLayout,s=a(4),u=a(3),l=a(5),c=a(2),h=a(1),f=a(0).FDLayoutConstants,d=a(0).LayoutConstants,p=a(0).Point,v=a(0).PointD,m=a(0).Layout,g=a(0).Integer,y=a(0).IGeometry,x=a(0).LGraph,T=a(0).Transform;function w(){o.call(this),this.toBeTiled={}}w.prototype=Object.create(o.prototype);for(var D in o)w[D]=o[D];w.prototype.newGraphManager=function(){var b=new s(this);return this.graphManager=b,b},w.prototype.newGraph=function(b){return new u(null,this.graphManager,b)},w.prototype.newNode=function(b){return new l(this.graphManager,b)},w.prototype.newEdge=function(b){return new c(null,null,b)},w.prototype.initParameters=function(){o.prototype.initParameters.call(this,arguments),this.isSubLayout||(h.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=h.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=f.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=f.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=f.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=f.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=f.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=f.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/f.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=f.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},w.prototype.layout=function(){var b=d.DEFAULT_CREATE_BENDS_AS_NEEDED;return b&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},w.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(h.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var b=new Set(this.getAllNodes()),_=this.nodesWithGravity.filter(function(A){return b.has(A)});this.graphManager.setAllNodesToApplyGravitation(_)}}else{var E=this.getFlatForest();if(E.length>0)this.positionNodesRadially(E);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var b=new Set(this.getAllNodes()),_=this.nodesWithGravity.filter(function(N){return b.has(N)});this.graphManager.setAllNodesToApplyGravitation(_),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},w.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%f.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var b=new Set(this.getAllNodes()),_=this.nodesWithGravity.filter(function(C){return b.has(C)});this.graphManager.setAllNodesToApplyGravitation(_),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=f.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=f.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var E=!this.isTreeGrowing&&!this.isGrowthFinished,A=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(E,A),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},w.prototype.getPositionsData=function(){for(var b=this.graphManager.getAllNodes(),_={},E=0;E<b.length;E++){var A=b[E].rect,C=b[E].id;_[C]={id:C,x:A.getCenterX(),y:A.getCenterY(),w:A.width,h:A.height}}return _},w.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var b=!1;if(f.ANIMATE==="during")this.emit("layoutstarted");else{for(;!b;)b=this.tick();this.graphManager.updateBounds()}},w.prototype.calculateNodesToApplyGravitationTo=function(){var b=[],_,E=this.graphManager.getGraphs(),A=E.length,C;for(C=0;C<A;C++)_=E[C],_.updateConnected(),_.isConnected||(b=b.concat(_.getNodes()));return b},w.prototype.createBendpoints=function(){var b=[];b=b.concat(this.graphManager.getAllEdges());var _=new Set,E;for(E=0;E<b.length;E++){var A=b[E];if(!_.has(A)){var C=A.getSource(),N=A.getTarget();if(C==N)A.getBendpoints().push(new v),A.getBendpoints().push(new v),this.createDummyNodesForBendpoints(A),_.add(A);else{var S=[];if(S=S.concat(C.getEdgeListToNode(N)),S=S.concat(N.getEdgeListToNode(C)),!_.has(S[0])){if(S.length>1){var M;for(M=0;M<S.length;M++){var R=S[M];R.getBendpoints().push(new v),this.createDummyNodesForBendpoints(R)}}S.forEach(function(P){_.add(P)})}}}if(_.size==b.length)break}},w.prototype.positionNodesRadially=function(b){for(var _=new p(0,0),E=Math.ceil(Math.sqrt(b.length)),A=0,C=0,N=0,S=new v(0,0),M=0;M<b.length;M++){M%E==0&&(N=0,C=A,M!=0&&(C+=h.DEFAULT_COMPONENT_SEPERATION),A=0);var R=b[M],P=m.findCenterOfTree(R);_.x=N,_.y=C,S=w.radialLayout(R,P,_),S.y>A&&(A=Math.floor(S.y)),N=Math.floor(S.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new v(d.WORLD_CENTER_X-S.x/2,d.WORLD_CENTER_Y-S.y/2))},w.radialLayout=function(b,_,E){var A=Math.max(this.maxDiagonalInTree(b),h.DEFAULT_RADIAL_SEPARATION);w.branchRadialLayout(_,null,0,359,0,A);var C=x.calculateBounds(b),N=new T;N.setDeviceOrgX(C.getMinX()),N.setDeviceOrgY(C.getMinY()),N.setWorldOrgX(E.x),N.setWorldOrgY(E.y);for(var S=0;S<b.length;S++){var M=b[S];M.transform(N)}var R=new v(C.getMaxX(),C.getMaxY());return N.inverseTransformPoint(R)},w.branchRadialLayout=function(b,_,E,A,C,N){var S=(A-E+1)/2;S<0&&(S+=180);var M=(S+E)%360,R=M*y.TWO_PI/360,P=C*Math.cos(R),L=C*Math.sin(R);b.setCenter(P,L);var O=[];O=O.concat(b.getEdges());var I=O.length;_!=null&&I--;for(var B=0,F=O.length,z,G=b.getEdgesBetween(_);G.length>1;){var H=G[0];G.splice(0,1);var j=O.indexOf(H);j>=0&&O.splice(j,1),F--,I--}_!=null?z=(O.indexOf(G[0])+1)%F:z=0;for(var Z=Math.abs(A-E)/I,Q=z;B!=I;Q=++Q%F){var re=O[Q].getOtherEnd(b);if(re!=_){var V=(E+B*Z)%360,Y=(V+Z)%360;w.branchRadialLayout(re,b,V,Y,C+N,N),B++}}},w.maxDiagonalInTree=function(b){for(var _=g.MIN_VALUE,E=0;E<b.length;E++){var A=b[E],C=A.getDiagonal();C>_&&(_=C)}return _},w.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},w.prototype.groupZeroDegreeMembers=function(){var b=this,_={};this.memberGroups={},this.idToDummyNode={};for(var E=[],A=this.graphManager.getAllNodes(),C=0;C<A.length;C++){var N=A[C],S=N.getParent();this.getNodeDegreeWithChildren(N)===0&&(S.id==null||!this.getToBeTiled(S))&&E.push(N)}for(var C=0;C<E.length;C++){var N=E[C],M=N.getParent().id;typeof _[M]>"u"&&(_[M]=[]),_[M]=_[M].concat(N)}Object.keys(_).forEach(function(R){if(_[R].length>1){var P="DummyCompound_"+R;b.memberGroups[P]=_[R];var L=_[R][0].getParent(),O=new l(b.graphManager);O.id=P,O.paddingLeft=L.paddingLeft||0,O.paddingRight=L.paddingRight||0,O.paddingBottom=L.paddingBottom||0,O.paddingTop=L.paddingTop||0,b.idToDummyNode[P]=O;var I=b.getGraphManager().add(b.newGraph(),O),B=L.getChild();B.add(O);for(var F=0;F<_[R].length;F++){var z=_[R][F];B.remove(z),I.add(z)}}})},w.prototype.clearCompounds=function(){var b={},_={};this.performDFSOnCompounds();for(var E=0;E<this.compoundOrder.length;E++)_[this.compoundOrder[E].id]=this.compoundOrder[E],b[this.compoundOrder[E].id]=[].concat(this.compoundOrder[E].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[E].getChild()),this.compoundOrder[E].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(b,_)},w.prototype.clearZeroDegreeMembers=function(){var b=this,_=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(E){var A=b.idToDummyNode[E];_[E]=b.tileNodes(b.memberGroups[E],A.paddingLeft+A.paddingRight),A.rect.width=_[E].width,A.rect.height=_[E].height})},w.prototype.repopulateCompounds=function(){for(var b=this.compoundOrder.length-1;b>=0;b--){var _=this.compoundOrder[b],E=_.id,A=_.paddingLeft,C=_.paddingTop;this.adjustLocations(this.tiledMemberPack[E],_.rect.x,_.rect.y,A,C)}},w.prototype.repopulateZeroDegreeMembers=function(){var b=this,_=this.tiledZeroDegreePack;Object.keys(_).forEach(function(E){var A=b.idToDummyNode[E],C=A.paddingLeft,N=A.paddingTop;b.adjustLocations(_[E],A.rect.x,A.rect.y,C,N)})},w.prototype.getToBeTiled=function(b){var _=b.id;if(this.toBeTiled[_]!=null)return this.toBeTiled[_];var E=b.getChild();if(E==null)return this.toBeTiled[_]=!1,!1;for(var A=E.getNodes(),C=0;C<A.length;C++){var N=A[C];if(this.getNodeDegree(N)>0)return this.toBeTiled[_]=!1,!1;if(N.getChild()==null){this.toBeTiled[N.id]=!1;continue}if(!this.getToBeTiled(N))return this.toBeTiled[_]=!1,!1}return this.toBeTiled[_]=!0,!0},w.prototype.getNodeDegree=function(b){b.id;for(var _=b.getEdges(),E=0,A=0;A<_.length;A++){var C=_[A];C.getSource().id!==C.getTarget().id&&(E=E+1)}return E},w.prototype.getNodeDegreeWithChildren=function(b){var _=this.getNodeDegree(b);if(b.getChild()==null)return _;for(var E=b.getChild().getNodes(),A=0;A<E.length;A++){var C=E[A];_+=this.getNodeDegreeWithChildren(C)}return _},w.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},w.prototype.fillCompexOrderByDFS=function(b){for(var _=0;_<b.length;_++){var E=b[_];E.getChild()!=null&&this.fillCompexOrderByDFS(E.getChild().getNodes()),this.getToBeTiled(E)&&this.compoundOrder.push(E)}},w.prototype.adjustLocations=function(b,_,E,A,C){_+=A,E+=C;for(var N=_,S=0;S<b.rows.length;S++){var M=b.rows[S];_=N;for(var R=0,P=0;P<M.length;P++){var L=M[P];L.rect.x=_,L.rect.y=E,_+=L.rect.width+b.horizontalPadding,L.rect.height>R&&(R=L.rect.height)}E+=R+b.verticalPadding}},w.prototype.tileCompoundMembers=function(b,_){var E=this;this.tiledMemberPack=[],Object.keys(b).forEach(function(A){var C=_[A];E.tiledMemberPack[A]=E.tileNodes(b[A],C.paddingLeft+C.paddingRight),C.rect.width=E.tiledMemberPack[A].width,C.rect.height=E.tiledMemberPack[A].height})},w.prototype.tileNodes=function(b,_){var E=h.TILING_PADDING_VERTICAL,A=h.TILING_PADDING_HORIZONTAL,C={rows:[],rowWidth:[],rowHeight:[],width:0,height:_,verticalPadding:E,horizontalPadding:A};b.sort(function(M,R){return M.rect.width*M.rect.height>R.rect.width*R.rect.height?-1:M.rect.width*M.rect.height<R.rect.width*R.rect.height?1:0});for(var N=0;N<b.length;N++){var S=b[N];C.rows.length==0?this.insertNodeToRow(C,S,0,_):this.canAddHorizontal(C,S.rect.width,S.rect.height)?this.insertNodeToRow(C,S,this.getShortestRowIndex(C),_):this.insertNodeToRow(C,S,C.rows.length,_),this.shiftToLastRow(C)}return C},w.prototype.insertNodeToRow=function(b,_,E,A){var C=A;if(E==b.rows.length){var N=[];b.rows.push(N),b.rowWidth.push(C),b.rowHeight.push(0)}var S=b.rowWidth[E]+_.rect.width;b.rows[E].length>0&&(S+=b.horizontalPadding),b.rowWidth[E]=S,b.width<S&&(b.width=S);var M=_.rect.height;E>0&&(M+=b.verticalPadding);var R=0;M>b.rowHeight[E]&&(R=b.rowHeight[E],b.rowHeight[E]=M,R=b.rowHeight[E]-R),b.height+=R,b.rows[E].push(_)},w.prototype.getShortestRowIndex=function(b){for(var _=-1,E=Number.MAX_VALUE,A=0;A<b.rows.length;A++)b.rowWidth[A]<E&&(_=A,E=b.rowWidth[A]);return _},w.prototype.getLongestRowIndex=function(b){for(var _=-1,E=Number.MIN_VALUE,A=0;A<b.rows.length;A++)b.rowWidth[A]>E&&(_=A,E=b.rowWidth[A]);return _},w.prototype.canAddHorizontal=function(b,_,E){var A=this.getShortestRowIndex(b);if(A<0)return!0;var C=b.rowWidth[A];if(C+b.horizontalPadding+_<=b.width)return!0;var N=0;b.rowHeight[A]<E&&A>0&&(N=E+b.verticalPadding-b.rowHeight[A]);var S;b.width-C>=_+b.horizontalPadding?S=(b.height+N)/(C+_+b.horizontalPadding):S=(b.height+N)/b.width,N=E+b.verticalPadding;var M;return b.width<_?M=(b.height+N)/_:M=(b.height+N)/b.width,M<1&&(M=1/M),S<1&&(S=1/S),S<M},w.prototype.shiftToLastRow=function(b){var _=this.getLongestRowIndex(b),E=b.rowWidth.length-1,A=b.rows[_],C=A[A.length-1],N=C.width+b.horizontalPadding;if(b.width-b.rowWidth[E]>N&&_!=E){A.splice(-1,1),b.rows[E].push(C),b.rowWidth[_]=b.rowWidth[_]-N,b.rowWidth[E]=b.rowWidth[E]+N,b.width=b.rowWidth[instance.getLongestRowIndex(b)];for(var S=Number.MIN_VALUE,M=0;M<A.length;M++)A[M].height>S&&(S=A[M].height);_>0&&(S+=b.verticalPadding);var R=b.rowHeight[_]+b.rowHeight[E];b.rowHeight[_]=S,b.rowHeight[E]<C.height+b.verticalPadding&&(b.rowHeight[E]=C.height+b.verticalPadding);var P=b.rowHeight[_]+b.rowHeight[E];b.height+=P-R,this.shiftToLastRow(b)}},w.prototype.tilingPreLayout=function(){h.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},w.prototype.tilingPostLayout=function(){h.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},w.prototype.reduceTrees=function(){for(var b=[],_=!0,E;_;){var A=this.graphManager.getAllNodes(),C=[];_=!1;for(var N=0;N<A.length;N++)E=A[N],E.getEdges().length==1&&!E.getEdges()[0].isInterGraph&&E.getChild()==null&&(C.push([E,E.getEdges()[0],E.getOwner()]),_=!0);if(_==!0){for(var S=[],M=0;M<C.length;M++)C[M][0].getEdges().length==1&&(S.push(C[M]),C[M][0].getOwner().remove(C[M][0]));b.push(S),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=b},w.prototype.growTree=function(b){for(var _=b.length,E=b[_-1],A,C=0;C<E.length;C++)A=E[C],this.findPlaceforPrunedNode(A),A[2].add(A[0]),A[2].add(A[1],A[1].source,A[1].target);b.splice(b.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},w.prototype.findPlaceforPrunedNode=function(b){var _,E,A=b[0];A==b[1].source?E=b[1].target:E=b[1].source;var C=E.startX,N=E.finishX,S=E.startY,M=E.finishY,R=0,P=0,L=0,O=0,I=[R,L,P,O];if(S>0)for(var B=C;B<=N;B++)I[0]+=this.grid[B][S-1].length+this.grid[B][S].length-1;if(N<this.grid.length-1)for(var B=S;B<=M;B++)I[1]+=this.grid[N+1][B].length+this.grid[N][B].length-1;if(M<this.grid[0].length-1)for(var B=C;B<=N;B++)I[2]+=this.grid[B][M+1].length+this.grid[B][M].length-1;if(C>0)for(var B=S;B<=M;B++)I[3]+=this.grid[C-1][B].length+this.grid[C][B].length-1;for(var F=g.MAX_VALUE,z,G,H=0;H<I.length;H++)I[H]<F?(F=I[H],z=1,G=H):I[H]==F&&z++;if(z==3&&F==0)I[0]==0&&I[1]==0&&I[2]==0?_=1:I[0]==0&&I[1]==0&&I[3]==0?_=0:I[0]==0&&I[2]==0&&I[3]==0?_=3:I[1]==0&&I[2]==0&&I[3]==0&&(_=2);else if(z==2&&F==0){var j=Math.floor(Math.random()*2);I[0]==0&&I[1]==0?j==0?_=0:_=1:I[0]==0&&I[2]==0?j==0?_=0:_=2:I[0]==0&&I[3]==0?j==0?_=0:_=3:I[1]==0&&I[2]==0?j==0?_=1:_=2:I[1]==0&&I[3]==0?j==0?_=1:_=3:j==0?_=2:_=3}else if(z==4&&F==0){var j=Math.floor(Math.random()*4);_=j}else _=G;_==0?A.setCenter(E.getCenterX(),E.getCenterY()-E.getHeight()/2-f.DEFAULT_EDGE_LENGTH-A.getHeight()/2):_==1?A.setCenter(E.getCenterX()+E.getWidth()/2+f.DEFAULT_EDGE_LENGTH+A.getWidth()/2,E.getCenterY()):_==2?A.setCenter(E.getCenterX(),E.getCenterY()+E.getHeight()/2+f.DEFAULT_EDGE_LENGTH+A.getHeight()/2):A.setCenter(E.getCenterX()-E.getWidth()/2-f.DEFAULT_EDGE_LENGTH-A.getWidth()/2,E.getCenterY())},n.exports=w},function(n,i,a){var o={};o.layoutBase=a(0),o.CoSEConstants=a(1),o.CoSEEdge=a(2),o.CoSEGraph=a(3),o.CoSEGraphManager=a(4),o.CoSELayout=a(6),o.CoSENode=a(5),n.exports=o}])})}(Jo)),Jo.exports}var am=Qo.exports,cc;function om(){return cc||(cc=1,function(e,t){(function(r,n){e.exports=n(im())})(am,function(r){return function(n){var i={};function a(o){if(i[o])return i[o].exports;var s=i[o]={i:o,l:!1,exports:{}};return n[o].call(s.exports,s,s.exports,a),s.l=!0,s.exports}return a.m=n,a.c=i,a.i=function(o){return o},a.d=function(o,s,u){a.o(o,s)||Object.defineProperty(o,s,{configurable:!1,enumerable:!0,get:u})},a.n=function(o){var s=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(s,"a",s),s},a.o=function(o,s){return Object.prototype.hasOwnProperty.call(o,s)},a.p="",a(a.s=1)}([function(n,i){n.exports=r},function(n,i,a){var o=a(0).layoutBase.LayoutConstants,s=a(0).layoutBase.FDLayoutConstants,u=a(0).CoSEConstants,l=a(0).CoSELayout,c=a(0).CoSENode,h=a(0).layoutBase.PointD,f=a(0).layoutBase.DimensionD,d={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function p(y,x){var T={};for(var w in y)T[w]=y[w];for(var w in x)T[w]=x[w];return T}function v(y){this.options=p(d,y),m(this.options)}var m=function(y){y.nodeRepulsion!=null&&(u.DEFAULT_REPULSION_STRENGTH=s.DEFAULT_REPULSION_STRENGTH=y.nodeRepulsion),y.idealEdgeLength!=null&&(u.DEFAULT_EDGE_LENGTH=s.DEFAULT_EDGE_LENGTH=y.idealEdgeLength),y.edgeElasticity!=null&&(u.DEFAULT_SPRING_STRENGTH=s.DEFAULT_SPRING_STRENGTH=y.edgeElasticity),y.nestingFactor!=null&&(u.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=y.nestingFactor),y.gravity!=null&&(u.DEFAULT_GRAVITY_STRENGTH=s.DEFAULT_GRAVITY_STRENGTH=y.gravity),y.numIter!=null&&(u.MAX_ITERATIONS=s.MAX_ITERATIONS=y.numIter),y.gravityRange!=null&&(u.DEFAULT_GRAVITY_RANGE_FACTOR=s.DEFAULT_GRAVITY_RANGE_FACTOR=y.gravityRange),y.gravityCompound!=null&&(u.DEFAULT_COMPOUND_GRAVITY_STRENGTH=s.DEFAULT_COMPOUND_GRAVITY_STRENGTH=y.gravityCompound),y.gravityRangeCompound!=null&&(u.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=y.gravityRangeCompound),y.initialEnergyOnIncremental!=null&&(u.DEFAULT_COOLING_FACTOR_INCREMENTAL=s.DEFAULT_COOLING_FACTOR_INCREMENTAL=y.initialEnergyOnIncremental),y.quality=="draft"?o.QUALITY=0:y.quality=="proof"?o.QUALITY=2:o.QUALITY=1,u.NODE_DIMENSIONS_INCLUDE_LABELS=s.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=y.nodeDimensionsIncludeLabels,u.DEFAULT_INCREMENTAL=s.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!y.randomize,u.ANIMATE=s.ANIMATE=o.ANIMATE=y.animate,u.TILE=y.tile,u.TILING_PADDING_VERTICAL=typeof y.tilingPaddingVertical=="function"?y.tilingPaddingVertical.call():y.tilingPaddingVertical,u.TILING_PADDING_HORIZONTAL=typeof y.tilingPaddingHorizontal=="function"?y.tilingPaddingHorizontal.call():y.tilingPaddingHorizontal};v.prototype.run=function(){var y,x,T=this.options;this.idToLNode={};var w=this.layout=new l,D=this;D.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var b=w.newGraphManager();this.gm=b;var _=this.options.eles.nodes(),E=this.options.eles.edges();this.root=b.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(_),w);for(var A=0;A<E.length;A++){var C=E[A],N=this.idToLNode[C.data("source")],S=this.idToLNode[C.data("target")];if(N!==S&&N.getEdgesBetween(S).length==0){var M=b.add(w.newEdge(),N,S);M.id=C.id()}}var R=function(L,O){typeof L=="number"&&(L=O);var I=L.data("id"),B=D.idToLNode[I];return{x:B.getRect().getCenterX(),y:B.getRect().getCenterY()}},P=function L(){for(var O=function(){T.fit&&T.cy.fit(T.eles,T.padding),y||(y=!0,D.cy.one("layoutready",T.ready),D.cy.trigger({type:"layoutready",layout:D}))},I=D.options.refresh,B,F=0;F<I&&!B;F++)B=D.stopped||D.layout.tick();if(B){w.checkLayoutSuccess()&&!w.isSubLayout&&w.doPostLayout(),w.tilingPostLayout&&w.tilingPostLayout(),w.isLayoutFinished=!0,D.options.eles.nodes().positions(R),O(),D.cy.one("layoutstop",D.options.stop),D.cy.trigger({type:"layoutstop",layout:D}),x&&cancelAnimationFrame(x),y=!1;return}var z=D.layout.getPositionsData();T.eles.nodes().positions(function(G,H){if(typeof G=="number"&&(G=H),!G.isParent()){for(var j=G.id(),Z=z[j],Q=G;Z==null&&(Z=z[Q.data("parent")]||z["DummyCompound_"+Q.data("parent")],z[j]=Z,Q=Q.parent()[0],Q!=null););return Z!=null?{x:Z.x,y:Z.y}:{x:G.position("x"),y:G.position("y")}}}),O(),x=requestAnimationFrame(L)};return w.addListener("layoutstarted",function(){D.options.animate==="during"&&(x=requestAnimationFrame(P))}),w.runLayout(),this.options.animate!=="during"&&(D.options.eles.nodes().not(":parent").layoutPositions(D,D.options,R),y=!1),this},v.prototype.getTopMostNodes=function(y){for(var x={},T=0;T<y.length;T++)x[y[T].id()]=!0;var w=y.filter(function(D,b){typeof D=="number"&&(D=b);for(var _=D.parent()[0];_!=null;){if(x[_.id()])return!1;_=_.parent()[0]}return!0});return w},v.prototype.processChildrenList=function(y,x,T){for(var w=x.length,D=0;D<w;D++){var b=x[D],_=b.children(),E,A=b.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(b.outerWidth()!=null&&b.outerHeight()!=null?E=y.add(new c(T.graphManager,new h(b.position("x")-A.w/2,b.position("y")-A.h/2),new f(parseFloat(A.w),parseFloat(A.h)))):E=y.add(new c(this.graphManager)),E.id=b.data("id"),E.paddingLeft=parseInt(b.css("padding")),E.paddingTop=parseInt(b.css("padding")),E.paddingRight=parseInt(b.css("padding")),E.paddingBottom=parseInt(b.css("padding")),this.options.nodeDimensionsIncludeLabels&&b.isParent()){var C=b.boundingBox({includeLabels:!0,includeNodes:!1}).w,N=b.boundingBox({includeLabels:!0,includeNodes:!1}).h,S=b.css("text-halign");E.labelWidth=C,E.labelHeight=N,E.labelPos=S}if(this.idToLNode[b.data("id")]=E,isNaN(E.rect.x)&&(E.rect.x=0),isNaN(E.rect.y)&&(E.rect.y=0),_!=null&&_.length>0){var M;M=T.getGraphManager().add(T.newGraph(),E),this.processChildrenList(M,_,T)}}},v.prototype.stop=function(){return this.stopped=!0,this};var g=function(y){y("layout","cose-bilkent",v)};typeof cytoscape<"u"&&g(cytoscape),n.exports=g}])})}(Qo)),Qo.exports}var sm=om();const lm=Ed(sm);var ts=function(){var e=function(T,w,D,b){for(D=D||{},b=T.length;b--;D[T[b]]=w);return D},t=[1,4],r=[1,13],n=[1,12],i=[1,15],a=[1,16],o=[1,20],s=[1,19],u=[6,7,8],l=[1,26],c=[1,24],h=[1,25],f=[6,7,11],d=[1,6,13,15,16,19,22],p=[1,33],v=[1,34],m=[1,6,7,11,13,15,16,19,22],g={trace:function(){},yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:function(T,w,D,b,_,E,A){var C=E.length-1;switch(_){case 6:case 7:return b;case 8:b.getLogger().trace("Stop NL ");break;case 9:b.getLogger().trace("Stop EOF ");break;case 11:b.getLogger().trace("Stop NL2 ");break;case 12:b.getLogger().trace("Stop EOF2 ");break;case 15:b.getLogger().info("Node: ",E[C].id),b.addNode(E[C-1].length,E[C].id,E[C].descr,E[C].type);break;case 16:b.getLogger().trace("Icon: ",E[C]),b.decorateNode({icon:E[C]});break;case 17:case 21:b.decorateNode({class:E[C]});break;case 18:b.getLogger().trace("SPACELIST");break;case 19:b.getLogger().trace("Node: ",E[C].id),b.addNode(0,E[C].id,E[C].descr,E[C].type);break;case 20:b.decorateNode({icon:E[C]});break;case 25:b.getLogger().trace("node found ..",E[C-2]),this.$={id:E[C-1],descr:E[C-1],type:b.getType(E[C-2],E[C])};break;case 26:this.$={id:E[C],descr:E[C],type:b.nodeType.DEFAULT};break;case 27:b.getLogger().trace("node found ..",E[C-3]),this.$={id:E[C-3],descr:E[C-1],type:b.getType(E[C-2],E[C])};break}},table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:r,7:[1,10],9:9,12:11,13:n,14:14,15:i,16:a,17:17,18:18,19:o,22:s},e(u,[2,3]),{1:[2,2]},e(u,[2,4]),e(u,[2,5]),{1:[2,6],6:r,12:21,13:n,14:14,15:i,16:a,17:17,18:18,19:o,22:s},{6:r,9:22,12:11,13:n,14:14,15:i,16:a,17:17,18:18,19:o,22:s},{6:l,7:c,10:23,11:h},e(f,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:o,22:s}),e(f,[2,18]),e(f,[2,19]),e(f,[2,20]),e(f,[2,21]),e(f,[2,23]),e(f,[2,24]),e(f,[2,26],{19:[1,30]}),{20:[1,31]},{6:l,7:c,10:32,11:h},{1:[2,7],6:r,12:21,13:n,14:14,15:i,16:a,17:17,18:18,19:o,22:s},e(d,[2,14],{7:p,11:v}),e(m,[2,8]),e(m,[2,9]),e(m,[2,10]),e(f,[2,15]),e(f,[2,16]),e(f,[2,17]),{20:[1,35]},{21:[1,36]},e(d,[2,13],{7:p,11:v}),e(m,[2,11]),e(m,[2,12]),{21:[1,37]},e(f,[2,25]),e(f,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:function(T,w){if(w.recoverable)this.trace(T);else{var D=new Error(T);throw D.hash=w,D}},parse:function(T){var w=this,D=[0],b=[],_=[null],E=[],A=this.table,C="",N=0,S=0,M=2,R=1,P=E.slice.call(arguments,1),L=Object.create(this.lexer),O={yy:{}};for(var I in this.yy)Object.prototype.hasOwnProperty.call(this.yy,I)&&(O.yy[I]=this.yy[I]);L.setInput(T,O.yy),O.yy.lexer=L,O.yy.parser=this,typeof L.yylloc>"u"&&(L.yylloc={});var B=L.yylloc;E.push(B);var F=L.options&&L.options.ranges;typeof O.yy.parseError=="function"?this.parseError=O.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function z(){var ee;return ee=b.pop()||L.lex()||R,typeof ee!="number"&&(ee instanceof Array&&(b=ee,ee=b.pop()),ee=w.symbols_[ee]||ee),ee}for(var G,H,j,Z,Q={},re,V,Y,U;;){if(H=D[D.length-1],this.defaultActions[H]?j=this.defaultActions[H]:((G===null||typeof G>"u")&&(G=z()),j=A[H]&&A[H][G]),typeof j>"u"||!j.length||!j[0]){var K="";U=[];for(re in A[H])this.terminals_[re]&&re>M&&U.push("'"+this.terminals_[re]+"'");L.showPosition?K="Parse error on line "+(N+1)+`:
|
|
332
|
-
`+L.showPosition()+`
|
|
333
|
-
Expecting `+U.join(", ")+", got '"+(this.terminals_[G]||G)+"'":K="Parse error on line "+(N+1)+": Unexpected "+(G==R?"end of input":"'"+(this.terminals_[G]||G)+"'"),this.parseError(K,{text:L.match,token:this.terminals_[G]||G,line:L.yylineno,loc:B,expected:U})}if(j[0]instanceof Array&&j.length>1)throw new Error("Parse Error: multiple actions possible at state: "+H+", token: "+G);switch(j[0]){case 1:D.push(G),_.push(L.yytext),E.push(L.yylloc),D.push(j[1]),G=null,S=L.yyleng,C=L.yytext,N=L.yylineno,B=L.yylloc;break;case 2:if(V=this.productions_[j[1]][1],Q.$=_[_.length-V],Q._$={first_line:E[E.length-(V||1)].first_line,last_line:E[E.length-1].last_line,first_column:E[E.length-(V||1)].first_column,last_column:E[E.length-1].last_column},F&&(Q._$.range=[E[E.length-(V||1)].range[0],E[E.length-1].range[1]]),Z=this.performAction.apply(Q,[C,S,N,O.yy,j[1],_,E].concat(P)),typeof Z<"u")return Z;V&&(D=D.slice(0,-1*V*2),_=_.slice(0,-1*V),E=E.slice(0,-1*V)),D.push(this.productions_[j[1]][0]),_.push(Q.$),E.push(Q._$),Y=A[D[D.length-2]][D[D.length-1]],D.push(Y);break;case 3:return!0}}return!0}},y=function(){var T={EOF:1,parseError:function(w,D){if(this.yy.parser)this.yy.parser.parseError(w,D);else throw new Error(w)},setInput:function(w,D){return this.yy=D||this.yy||{},this._input=w,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var w=this._input[0];this.yytext+=w,this.yyleng++,this.offset++,this.match+=w,this.matched+=w;var D=w.match(/(?:\r\n?|\n).*/g);return D?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),w},unput:function(w){var D=w.length,b=w.split(/(?:\r\n?|\n)/g);this._input=w+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-D),this.offset-=D;var _=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),b.length-1&&(this.yylineno-=b.length-1);var E=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:b?(b.length===_.length?this.yylloc.first_column:0)+_[_.length-b.length].length-b[0].length:this.yylloc.first_column-D},this.options.ranges&&(this.yylloc.range=[E[0],E[0]+this.yyleng-D]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
334
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(w){this.unput(this.match.slice(w))},pastInput:function(){var w=this.matched.substr(0,this.matched.length-this.match.length);return(w.length>20?"...":"")+w.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var w=this.match;return w.length<20&&(w+=this._input.substr(0,20-w.length)),(w.substr(0,20)+(w.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var w=this.pastInput(),D=new Array(w.length+1).join("-");return w+this.upcomingInput()+`
|
|
335
|
-
`+D+"^"},test_match:function(w,D){var b,_,E;if(this.options.backtrack_lexer&&(E={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(E.yylloc.range=this.yylloc.range.slice(0))),_=w[0].match(/(?:\r\n?|\n).*/g),_&&(this.yylineno+=_.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:_?_[_.length-1].length-_[_.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+w[0].length},this.yytext+=w[0],this.match+=w[0],this.matches=w,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(w[0].length),this.matched+=w[0],b=this.performAction.call(this,this.yy,this,D,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),b)return b;if(this._backtrack){for(var A in E)this[A]=E[A];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var w,D,b,_;this._more||(this.yytext="",this.match="");for(var E=this._currentRules(),A=0;A<E.length;A++)if(b=this._input.match(this.rules[E[A]]),b&&(!D||b[0].length>D[0].length)){if(D=b,_=A,this.options.backtrack_lexer){if(w=this.test_match(b,E[A]),w!==!1)return w;if(this._backtrack){D=!1;continue}else return!1}else if(!this.options.flex)break}return D?(w=this.test_match(D,E[_]),w!==!1?w:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
336
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var w=this.next();return w||this.lex()},begin:function(w){this.conditionStack.push(w)},popState:function(){var w=this.conditionStack.length-1;return w>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(w){return w=this.conditionStack.length-1-Math.abs(w||0),w>=0?this.conditionStack[w]:"INITIAL"},pushState:function(w){this.begin(w)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(w,D,b,_){switch(b){case 0:return w.getLogger().trace("Found comment",D.yytext),6;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:this.popState();break;case 5:w.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return w.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:w.getLogger().trace("end icon"),this.popState();break;case 10:return w.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return w.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return w.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return w.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:return this.begin("NODE"),19;case 15:return this.begin("NODE"),19;case 16:return this.begin("NODE"),19;case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 23:this.popState();break;case 24:w.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return w.getLogger().trace("description:",D.yytext),"NODE_DESCR";case 26:this.popState();break;case 27:return this.popState(),w.getLogger().trace("node end ))"),"NODE_DEND";case 28:return this.popState(),w.getLogger().trace("node end )"),"NODE_DEND";case 29:return this.popState(),w.getLogger().trace("node end ...",D.yytext),"NODE_DEND";case 30:return this.popState(),w.getLogger().trace("node end (("),"NODE_DEND";case 31:return this.popState(),w.getLogger().trace("node end (-"),"NODE_DEND";case 32:return this.popState(),w.getLogger().trace("node end (-"),"NODE_DEND";case 33:return this.popState(),w.getLogger().trace("node end (("),"NODE_DEND";case 34:return this.popState(),w.getLogger().trace("node end (("),"NODE_DEND";case 35:return w.getLogger().trace("Long description:",D.yytext),20;case 36:return w.getLogger().trace("Long description:",D.yytext),20}},rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return T}();g.lexer=y;function x(){this.yy={}}return x.prototype=g,g.Parser=x,new x}();ts.parser=ts;const um=ts;let Pt=[],rd=0,Ns={};const cm=()=>{Pt=[],rd=0,Ns={}},hm=function(e){for(let t=Pt.length-1;t>=0;t--)if(Pt[t].level<e)return Pt[t];return null},dm=()=>Pt.length>0?Pt[0]:null,fm=(e,t,r,n)=>{var i,a;Ir.info("addNode",e,t,r,n);const o=rs();let s=((i=o.mindmap)==null?void 0:i.padding)??bi.mindmap.padding;switch(n){case et.ROUNDED_RECT:case et.RECT:case et.HEXAGON:s*=2}const u={id:rd++,nodeId:xi(t,o),level:e,descr:xi(r,o),type:n,children:[],width:((a=o.mindmap)==null?void 0:a.maxNodeWidth)??bi.mindmap.maxNodeWidth,padding:s},l=hm(e);if(l)l.children.push(u),Pt.push(u);else if(Pt.length===0)Pt.push(u);else throw new Error('There can be only one root. No parent could be found for ("'+u.descr+'")')},et={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},pm=(e,t)=>{switch(Ir.debug("In get type",e,t),e){case"[":return et.RECT;case"(":return t===")"?et.ROUNDED_RECT:et.CLOUD;case"((":return et.CIRCLE;case")":return et.CLOUD;case"))":return et.BANG;case"{{":return et.HEXAGON;default:return et.DEFAULT}},gm=(e,t)=>{Ns[e]=t},vm=e=>{if(!e)return;const t=rs(),r=Pt[Pt.length-1];e.icon&&(r.icon=xi(e.icon,t)),e.class&&(r.class=xi(e.class,t))},ym=e=>{switch(e){case et.DEFAULT:return"no-border";case et.RECT:return"rect";case et.ROUNDED_RECT:return"rounded-rect";case et.CIRCLE:return"circle";case et.CLOUD:return"cloud";case et.BANG:return"bang";case et.HEXAGON:return"hexgon";default:return"no-border"}},mm=()=>Ir,bm=e=>Ns[e],xm={clear:cm,addNode:fm,getMindmap:dm,nodeType:et,getType:pm,setElementForId:gm,decorateNode:vm,type2Str:ym,getLogger:mm,getElementById:bm},wm=xm,Em=12,Tm=function(e,t,r,n){t.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+e.type2Str(r.type)).attr("d",`M0 ${r.height-5} v${-r.height+10} q0,-5 5,-5 h${r.width-10} q5,0 5,5 v${r.height-5} H0 Z`),t.append("line").attr("class","node-line-"+n).attr("x1",0).attr("y1",r.height).attr("x2",r.width).attr("y2",r.height)},_m=function(e,t,r){t.append("rect").attr("id","node-"+r.id).attr("class","node-bkg node-"+e.type2Str(r.type)).attr("height",r.height).attr("width",r.width)},Am=function(e,t,r){const n=r.width,i=r.height,a=.15*n,o=.25*n,s=.35*n,u=.2*n;t.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+e.type2Str(r.type)).attr("d",`M0 0 a${a},${a} 0 0,1 ${n*.25},${-1*n*.1}
|
|
337
|
-
a${s},${s} 1 0,1 ${n*.4},${-1*n*.1}
|
|
338
|
-
a${o},${o} 1 0,1 ${n*.35},${1*n*.2}
|
|
339
|
-
|
|
340
|
-
a${a},${a} 1 0,1 ${n*.15},${1*i*.35}
|
|
341
|
-
a${u},${u} 1 0,1 ${-1*n*.15},${1*i*.65}
|
|
342
|
-
|
|
343
|
-
a${o},${a} 1 0,1 ${-1*n*.25},${n*.15}
|
|
344
|
-
a${s},${s} 1 0,1 ${-1*n*.5},0
|
|
345
|
-
a${a},${a} 1 0,1 ${-1*n*.25},${-1*n*.15}
|
|
346
|
-
|
|
347
|
-
a${a},${a} 1 0,1 ${-1*n*.1},${-1*i*.35}
|
|
348
|
-
a${u},${u} 1 0,1 ${n*.1},${-1*i*.65}
|
|
349
|
-
|
|
350
|
-
H0 V0 Z`)},Cm=function(e,t,r){const n=r.width,i=r.height,a=.15*n;t.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+e.type2Str(r.type)).attr("d",`M0 0 a${a},${a} 1 0,0 ${n*.25},${-1*i*.1}
|
|
351
|
-
a${a},${a} 1 0,0 ${n*.25},0
|
|
352
|
-
a${a},${a} 1 0,0 ${n*.25},0
|
|
353
|
-
a${a},${a} 1 0,0 ${n*.25},${1*i*.1}
|
|
354
|
-
|
|
355
|
-
a${a},${a} 1 0,0 ${n*.15},${1*i*.33}
|
|
356
|
-
a${a*.8},${a*.8} 1 0,0 0,${1*i*.34}
|
|
357
|
-
a${a},${a} 1 0,0 ${-1*n*.15},${1*i*.33}
|
|
358
|
-
|
|
359
|
-
a${a},${a} 1 0,0 ${-1*n*.25},${i*.15}
|
|
360
|
-
a${a},${a} 1 0,0 ${-1*n*.25},0
|
|
361
|
-
a${a},${a} 1 0,0 ${-1*n*.25},0
|
|
362
|
-
a${a},${a} 1 0,0 ${-1*n*.25},${-1*i*.15}
|
|
363
|
-
|
|
364
|
-
a${a},${a} 1 0,0 ${-1*n*.1},${-1*i*.33}
|
|
365
|
-
a${a*.8},${a*.8} 1 0,0 0,${-1*i*.34}
|
|
366
|
-
a${a},${a} 1 0,0 ${n*.1},${-1*i*.33}
|
|
367
|
-
|
|
368
|
-
H0 V0 Z`)},Dm=function(e,t,r){t.append("circle").attr("id","node-"+r.id).attr("class","node-bkg node-"+e.type2Str(r.type)).attr("r",r.width/2)};function Nm(e,t,r,n,i){return e.insert("polygon",":first-child").attr("points",n.map(function(a){return a.x+","+a.y}).join(" ")).attr("transform","translate("+(i.width-t)/2+", "+r+")")}const km=function(e,t,r){const n=r.height,i=n/4,a=r.width-r.padding+2*i,o=[{x:i,y:0},{x:a-i,y:0},{x:a,y:-n/2},{x:a-i,y:-n},{x:i,y:-n},{x:0,y:-n/2}];Nm(t,a,n,o,r)},Mm=function(e,t,r){t.append("rect").attr("id","node-"+r.id).attr("class","node-bkg node-"+e.type2Str(r.type)).attr("height",r.height).attr("rx",r.padding).attr("ry",r.padding).attr("width",r.width)},Sm=function(e,t,r,n,i){const a=i.htmlLabels,o=n%(Em-1),s=t.append("g");r.section=o;let u="section-"+o;o<0&&(u+=" section-root"),s.attr("class",(r.class?r.class+" ":"")+"mindmap-node "+u);const l=s.append("g"),c=s.append("g"),h=r.descr.replace(/(<br\/*>)/g,`
|
|
369
|
-
`);Td(c,h,{useHtmlLabels:a,width:r.width,classes:"mindmap-node-label"}),a||c.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle");const f=c.node().getBBox(),[d]=wd(i.fontSize);if(r.height=f.height+d*1.1*.5+r.padding,r.width=f.width+2*r.padding,r.icon)if(r.type===e.nodeType.CIRCLE)r.height+=50,r.width+=50,s.append("foreignObject").attr("height","50px").attr("width",r.width).attr("style","text-align: center;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+o+" "+r.icon),c.attr("transform","translate("+r.width/2+", "+(r.height/2-1.5*r.padding)+")");else{r.width+=50;const p=r.height;r.height=Math.max(p,60);const v=Math.abs(r.height-p);s.append("foreignObject").attr("width","60px").attr("height",r.height).attr("style","text-align: center;margin-top:"+v/2+"px;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+o+" "+r.icon),c.attr("transform","translate("+(25+r.width/2)+", "+(v/2+r.padding/2)+")")}else if(a){const p=(r.width-f.width)/2,v=(r.height-f.height)/2;c.attr("transform","translate("+p+", "+v+")")}else{const p=r.width/2,v=r.padding/2;c.attr("transform","translate("+p+", "+v+")")}switch(r.type){case e.nodeType.DEFAULT:Tm(e,l,r,o);break;case e.nodeType.ROUNDED_RECT:Mm(e,l,r);break;case e.nodeType.RECT:_m(e,l,r);break;case e.nodeType.CIRCLE:l.attr("transform","translate("+r.width/2+", "+ +r.height/2+")"),Dm(e,l,r);break;case e.nodeType.CLOUD:Am(e,l,r);break;case e.nodeType.BANG:Cm(e,l,r);break;case e.nodeType.HEXAGON:km(e,l,r);break}return e.setElementForId(r.id,s),r.height},Lm=function(e,t){const r=e.getElementById(t.id),n=t.x||0,i=t.y||0;r.attr("transform","translate("+n+","+i+")")};pr.use(lm);function nd(e,t,r,n,i){Sm(e,t,r,n,i),r.children&&r.children.forEach((a,o)=>{nd(e,t,a,n<0?o:n,i)})}function Im(e,t){t.edges().map((r,n)=>{const i=r.data();if(r[0]._private.bodyBounds){const a=r[0]._private.rscratch;Ir.trace("Edge: ",n,i),e.insert("path").attr("d",`M ${a.startX},${a.startY} L ${a.midX},${a.midY} L${a.endX},${a.endY} `).attr("class","edge section-edge-"+i.section+" edge-depth-"+i.depth)}})}function id(e,t,r,n){t.add({group:"nodes",data:{id:e.id.toString(),labelText:e.descr,height:e.height,width:e.width,level:n,nodeId:e.id,padding:e.padding,type:e.type},position:{x:e.x,y:e.y}}),e.children&&e.children.forEach(i=>{id(i,t,r,n+1),t.add({group:"edges",data:{id:`${e.id}_${i.id}`,source:e.id,target:i.id,depth:n,section:i.section}})})}function Om(e,t){return new Promise(r=>{const n=xd("body").append("div").attr("id","cy").attr("style","display:none"),i=pr({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});n.remove(),id(e,i,t,0),i.nodes().forEach(function(a){a.layoutDimensions=()=>{const o=a.data();return{w:o.width,h:o.height}}}),i.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),i.ready(a=>{Ir.info("Ready",a),r(i)})})}function Rm(e,t){t.nodes().map((r,n)=>{const i=r.data();i.x=r.position().x,i.y=r.position().y,Lm(e,i);const a=e.getElementById(i.nodeId);Ir.info("Id:",n,"Position: (",r.position().x,", ",r.position().y,")",i),a.attr("transform",`translate(${r.position().x-i.width/2}, ${r.position().y-i.height/2})`),a.attr("attr",`apa-${n})`)})}const Pm=async(e,t,r,n)=>{var i,a;Ir.debug(`Rendering mindmap diagram
|
|
370
|
-
`+e);const o=n.db,s=o.getMindmap();if(!s)return;const u=rs();u.htmlLabels=!1;const l=md(t),c=l.append("g");c.attr("class","mindmap-edges");const h=l.append("g");h.attr("class","mindmap-nodes"),nd(o,h,s,-1,u);const f=await Om(s,u);Im(c,f),Rm(o,f),bd(void 0,l,((i=u.mindmap)==null?void 0:i.padding)??bi.mindmap.padding,((a=u.mindmap)==null?void 0:a.useMaxWidth)??bi.mindmap.useMaxWidth)},Bm={draw:Pm},Fm=e=>{let t="";for(let r=0;r<e.THEME_COLOR_LIMIT;r++)e["lineColor"+r]=e["lineColor"+r]||e["cScaleInv"+r],gd(e["lineColor"+r])?e["lineColor"+r]=vd(e["lineColor"+r],20):e["lineColor"+r]=yd(e["lineColor"+r],20);for(let r=0;r<e.THEME_COLOR_LIMIT;r++){const n=""+(17-3*r);t+=`
|
|
371
|
-
.section-${r-1} rect, .section-${r-1} path, .section-${r-1} circle, .section-${r-1} polygon, .section-${r-1} path {
|
|
372
|
-
fill: ${e["cScale"+r]};
|
|
373
|
-
}
|
|
374
|
-
.section-${r-1} text {
|
|
375
|
-
fill: ${e["cScaleLabel"+r]};
|
|
376
|
-
}
|
|
377
|
-
.node-icon-${r-1} {
|
|
378
|
-
font-size: 40px;
|
|
379
|
-
color: ${e["cScaleLabel"+r]};
|
|
380
|
-
}
|
|
381
|
-
.section-edge-${r-1}{
|
|
382
|
-
stroke: ${e["cScale"+r]};
|
|
383
|
-
}
|
|
384
|
-
.edge-depth-${r-1}{
|
|
385
|
-
stroke-width: ${n};
|
|
386
|
-
}
|
|
387
|
-
.section-${r-1} line {
|
|
388
|
-
stroke: ${e["cScaleInv"+r]} ;
|
|
389
|
-
stroke-width: 3;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
.disabled, .disabled circle, .disabled text {
|
|
393
|
-
fill: lightgray;
|
|
394
|
-
}
|
|
395
|
-
.disabled text {
|
|
396
|
-
fill: #efefef;
|
|
397
|
-
}
|
|
398
|
-
`}return t},zm=e=>`
|
|
399
|
-
.edge {
|
|
400
|
-
stroke-width: 3;
|
|
401
|
-
}
|
|
402
|
-
${Fm(e)}
|
|
403
|
-
.section-root rect, .section-root path, .section-root circle, .section-root polygon {
|
|
404
|
-
fill: ${e.git0};
|
|
405
|
-
}
|
|
406
|
-
.section-root text {
|
|
407
|
-
fill: ${e.gitBranchLabel0};
|
|
408
|
-
}
|
|
409
|
-
.icon-container {
|
|
410
|
-
height:100%;
|
|
411
|
-
display: flex;
|
|
412
|
-
justify-content: center;
|
|
413
|
-
align-items: center;
|
|
414
|
-
}
|
|
415
|
-
.edge {
|
|
416
|
-
fill: none;
|
|
417
|
-
}
|
|
418
|
-
.mindmap-node-label {
|
|
419
|
-
dy: 1em;
|
|
420
|
-
alignment-baseline: middle;
|
|
421
|
-
text-anchor: middle;
|
|
422
|
-
dominant-baseline: middle;
|
|
423
|
-
text-align: center;
|
|
424
|
-
}
|
|
425
|
-
`,Vm=zm,Um={db:wm,renderer:Bm,parser:um,styles:Vm};export{Um as diagram};
|