orbitchat 2.2.4 → 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/dist/assets/_basePickBy-BjEly54R-DqvpNhss.js +1 -0
- package/dist/assets/_baseUniq-DRc_T5HB-BD-eiKhZ.js +1 -0
- package/dist/assets/{api-CIgnRago.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-BLKmE08A.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-BI3Pqtzd.js +0 -1
- package/dist/assets/blockDiagram-c4efeb88-CZ2mpei3-DPM4cmd2.js +0 -118
- package/dist/assets/c4Diagram-c83219d4-DL2EmCLj-rErxymwv.js +0 -10
- package/dist/assets/channel-BKp1WYnX--xyS6HN9.js +0 -1
- package/dist/assets/classDiagram-beda092f-vKbJ2bcD-DMwCR7T_.js +0 -2
- package/dist/assets/classDiagram-v2-2358418a-BHXpn1Du-DOszq8XM.js +0 -2
- package/dist/assets/clone-B1V2003j-M2W86SX2.js +0 -1
- package/dist/assets/createText-1719965b-C2-AT0ab-BCTwBNRp.js +0 -7
- package/dist/assets/edges-96097737-Zk-qG_8u-CqVniuPy.js +0 -4
- package/dist/assets/erDiagram-0228fc6a-B94anMjz-CSeBke6-.js +0 -51
- package/dist/assets/flowDb-c6c81e3f-CRRW-bQO-BPM2pZ7q.js +0 -10
- package/dist/assets/flowDiagram-50d868cf-DPzQMhJv-WdLQi3xJ.js +0 -4
- package/dist/assets/flowDiagram-v2-4f6560a1-Si9enBmB-DPq3OGPp.js +0 -1
- package/dist/assets/flowchart-elk-definition-6af322e1-CULhtvD--DcEXRJ9c.js +0 -139
- package/dist/assets/ganttDiagram-a2739b55-Bp8yOLEz-BVSxz7oy.js +0 -257
- package/dist/assets/gitGraphDiagram-82fe8481-BYtOQJl0-vjj_Vh2i.js +0 -70
- package/dist/assets/graph-BV6jB5rk-Cz0bLK4A.js +0 -1
- package/dist/assets/index-5325376f-DrY72DrM-fDm8gtOg.js +0 -1
- package/dist/assets/index-CMOim5TQ.js +0 -1008
- package/dist/assets/infoDiagram-8eee0895-C6GFnrZ7-Cki4Deww.js +0 -7
- package/dist/assets/journeyDiagram-c64418c1-daS1W8qe-BNPtXbHr.js +0 -139
- package/dist/assets/layout-LXMv3mSS-Y67qlTVT.js +0 -1
- package/dist/assets/mindmap-definition-8da855dc-DmNQYVT1-DTzRqC2x.js +0 -425
- package/dist/assets/pieDiagram-a8764435-381urBY5-BhhVYaft.js +0 -35
- package/dist/assets/quadrantDiagram-1e28029f-hgRmK2bX-UfmuMa3v.js +0 -7
- package/dist/assets/requirementDiagram-08caed73-BB0Q-cI9-DwSrK8CT.js +0 -52
- package/dist/assets/sankeyDiagram-a04cb91d-BpsipZNt-CK3vlM3e.js +0 -8
- package/dist/assets/sequenceDiagram-c5b8d532-xoAvPcQJ-DTwebeTQ.js +0 -122
- package/dist/assets/stateDiagram-1ecb1508-b721R49K-CEYsxSXw.js +0 -1
- package/dist/assets/stateDiagram-v2-c2b004d7-BmSbrbqZ-CFOTq05F.js +0 -1
- package/dist/assets/styles-b4e223ce-TYmJC5IN-D3PIGnZK.js +0 -160
- package/dist/assets/styles-ca3715f6-CfJZu0Yn-DF9IC26s.js +0 -207
- package/dist/assets/styles-d45a18b0-DZ8oSYcV-CwTN_cwl.js +0 -116
- package/dist/assets/svgDrawCommon-b86b1483-CXPkN8HW-DkWtBwlM.js +0 -1
- package/dist/assets/timeline-definition-faaaa080-LDFf1jfb-CrJhn17D.js +0 -61
- package/dist/assets/xychartDiagram-f5964ef8-DdhO5-Bp-By6MFGsG.js +0 -7
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
function Po(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function $d(e){if(Array.isArray(e))return e}function Jd(e){if(Array.isArray(e))return Po(e)}function fn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function eh(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,$u(r.key),r)}}function pn(e,t,n){return t&&eh(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ct(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Go(e))||t){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:a}}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 i,o=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return o=l.done,l},e:function(l){u=!0,i=l},f:function(){try{o||n.return==null||n.return()}finally{if(u)throw i}}}}function Qu(e,t,n){return(t=$u(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function th(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function nh(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,o,u=[],l=!0,s=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(c){s=!0,a=c}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(s)throw a}}return u}}function rh(){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 ah(){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 $e(e,t){return $d(e)||nh(e,t)||Go(e,t)||rh()}function va(e){return Jd(e)||th(e)||Go(e)||ah()}function ih(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function $u(e){var t=ih(e,"string");return typeof t=="symbol"?t:t+""}function tt(e){"@babel/helpers - typeof";return tt=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},tt(e)}function Go(e,t){if(e){if(typeof e=="string")return Po(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Po(e,t):void 0}}var Je=typeof window>"u"?null:window,Es=Je?Je.navigator:null;Je&&Je.document;var oh=tt(""),Ju=tt({}),sh=tt(function(){}),lh=typeof HTMLElement>"u"?"undefined":tt(HTMLElement),Sr=function(e){return e&&e.instanceString&&Ue(e.instanceString)?e.instanceString():null},fe=function(e){return e!=null&&tt(e)==oh},Ue=function(e){return e!=null&&tt(e)===sh},Ve=function(e){return!Pt(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},De=function(e){return e!=null&&tt(e)===Ju&&!Ve(e)&&e.constructor===Object},uh=function(e){return e!=null&&tt(e)===Ju},ne=function(e){return e!=null&&tt(e)===tt(1)&&!isNaN(e)},ch=function(e){return ne(e)&&Math.floor(e)===e},ya=function(e){if(lh!=="undefined")return e!=null&&e instanceof HTMLElement},Pt=function(e){return Mr(e)||ec(e)},Mr=function(e){return Sr(e)==="collection"&&e._private.single},ec=function(e){return Sr(e)==="collection"&&!e._private.single},Ho=function(e){return Sr(e)==="core"},tc=function(e){return Sr(e)==="stylesheet"},dh=function(e){return Sr(e)==="event"},sn=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},hh=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},fh=function(e){return De(e)&&ne(e.x1)&&ne(e.x2)&&ne(e.y1)&&ne(e.y2)},ph=function(e){return uh(e)&&Ue(e.then)},gh=function(){return Es&&Es.userAgent.match(/msie|trident|edge/i)},Zn=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var r=[],a=0;a<arguments.length;a++)r.push(arguments[a]);return r.join("$")});var n=function(){var r=this,a=arguments,i,o=t.apply(r,a),u=n.cache;return(i=u[o])||(i=u[o]=e.apply(r,a)),i};return n.cache={},n},Ko=Zn(function(e){return e.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}),Aa=Zn(function(e){return e.replace(/(-\w)/g,function(t){return t[1].toUpperCase()})}),nc=Zn(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),ks=function(e){return sn(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},tn=function(e,t){return e.slice(-1*t.length)===t},et="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",vh="rgb[a]?\\(("+et+"[%]?)\\s*,\\s*("+et+"[%]?)\\s*,\\s*("+et+"[%]?)(?:\\s*,\\s*("+et+"))?\\)",yh="rgb[a]?\\((?:"+et+"[%]?)\\s*,\\s*(?:"+et+"[%]?)\\s*,\\s*(?:"+et+"[%]?)(?:\\s*,\\s*(?:"+et+"))?\\)",mh="hsl[a]?\\(("+et+")\\s*,\\s*("+et+"[%])\\s*,\\s*("+et+"[%])(?:\\s*,\\s*("+et+"))?\\)",bh="hsl[a]?\\((?:"+et+")\\s*,\\s*(?:"+et+"[%])\\s*,\\s*(?:"+et+"[%])(?:\\s*,\\s*(?:"+et+"))?\\)",xh="\\#[0-9a-fA-F]{3}",wh="\\#[0-9a-fA-F]{6}",rc=function(e,t){return e<t?-1:e>t?1:0},Eh=function(e,t){return-1*rc(e,t)},ge=Object.assign!=null?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(r!=null)for(var a=Object.keys(r),i=0;i<a.length;i++){var o=a[i];e[o]=r[o]}}return e},kh=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var t=e.length===4,n,r,a,i=16;return t?(n=parseInt(e[1]+e[1],i),r=parseInt(e[2]+e[2],i),a=parseInt(e[3]+e[3],i)):(n=parseInt(e[1]+e[2],i),r=parseInt(e[3]+e[4],i),a=parseInt(e[5]+e[6],i)),[n,r,a]}},Th=function(e){var t,n,r,a,i,o,u,l;function s(f,p,v){return v<0&&(v+=1),v>1&&(v-=1),v<1/6?f+(p-f)*6*v:v<1/2?p:v<2/3?f+(p-f)*(2/3-v)*6:f}var c=new RegExp("^"+mh+"$").exec(e);if(c){if(n=parseInt(c[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n=n%360),n/=360,r=parseFloat(c[2]),r<0||r>100||(r=r/100,a=parseFloat(c[3]),a<0||a>100)||(a=a/100,i=c[4],i!==void 0&&(i=parseFloat(i),i<0||i>1)))return;if(r===0)o=u=l=Math.round(a*255);else{var d=a<.5?a*(1+r):a+r-a*r,h=2*a-d;o=Math.round(255*s(h,d,n+1/3)),u=Math.round(255*s(h,d,n)),l=Math.round(255*s(h,d,n-1/3))}t=[o,u,l,i]}return t},Ch=function(e){var t,n=new RegExp("^"+vh+"$").exec(e);if(n){t=[];for(var r=[],a=1;a<=3;a++){var i=n[a];if(i[i.length-1]==="%"&&(r[a]=!0),i=parseFloat(i),r[a]&&(i=i/100*255),i<0||i>255)return;t.push(Math.floor(i))}var o=r[1]||r[2]||r[3],u=r[1]&&r[2]&&r[3];if(o&&!u)return;var l=n[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;t.push(l)}}return t},Ph=function(e){return _h[e.toLowerCase()]},ac=function(e){return(Ve(e)?e:null)||Ph(e)||kh(e)||Ch(e)||Th(e)},_h={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]},ic=function(e){for(var t=e.map,n=e.keys,r=n.length,a=0;a<r;a++){var i=n[a];if(De(i))throw Error("Tried to set map with object key");a<n.length-1?(t[i]==null&&(t[i]={}),t=t[i]):t[i]=e.value}},oc=function(e){for(var t=e.map,n=e.keys,r=n.length,a=0;a<r;a++){var i=n[a];if(De(i))throw Error("Tried to get map with object key");if(t=t[i],t==null)return t}return t},Gr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Za,Ts;function Ir(){if(Ts)return Za;Ts=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Za=e,Za}var Qa,Cs;function Bh(){if(Cs)return Qa;Cs=1;var e=typeof Gr=="object"&&Gr&&Gr.Object===Object&&Gr;return Qa=e,Qa}var $a,Ps;function Sa(){if(Ps)return $a;Ps=1;var e=Bh(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return $a=n,$a}var Ja,_s;function Dh(){if(_s)return Ja;_s=1;var e=Sa(),t=function(){return e.Date.now()};return Ja=t,Ja}var ei,Bs;function Ah(){if(Bs)return ei;Bs=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return ei=t,ei}var ti,Ds;function Sh(){if(Ds)return ti;Ds=1;var e=Ah(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return ti=n,ti}var ni,As;function Zo(){if(As)return ni;As=1;var e=Sa(),t=e.Symbol;return ni=t,ni}var ri,Ss;function Mh(){if(Ss)return ri;Ss=1;var e=Zo(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,a=e?e.toStringTag:void 0;function i(o){var u=n.call(o,a),l=o[a];try{o[a]=void 0;var s=!0}catch{}var c=r.call(o);return s&&(u?o[a]=l:delete o[a]),c}return ri=i,ri}var ai,Ms;function Rh(){if(Ms)return ai;Ms=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return ai=n,ai}var ii,Rs;function sc(){if(Rs)return ii;Rs=1;var e=Zo(),t=Mh(),n=Rh(),r="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function o(u){return u==null?u===void 0?a:r:i&&i in Object(u)?t(u):n(u)}return ii=o,ii}var oi,Is;function Ih(){if(Is)return oi;Is=1;function e(t){return t!=null&&typeof t=="object"}return oi=e,oi}var si,Ls;function Lr(){if(Ls)return si;Ls=1;var e=sc(),t=Ih(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return si=r,si}var li,Ns;function Lh(){if(Ns)return li;Ns=1;var e=Sh(),t=Ir(),n=Lr(),r=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,u=parseInt;function l(s){if(typeof s=="number")return s;if(n(s))return r;if(t(s)){var c=typeof s.valueOf=="function"?s.valueOf():s;s=t(c)?c+"":c}if(typeof s!="string")return s===0?s:+s;s=e(s);var d=i.test(s);return d||o.test(s)?u(s.slice(2),d?2:8):a.test(s)?r:+s}return li=l,li}var ui,Os;function Nh(){if(Os)return ui;Os=1;var e=Ir(),t=Dh(),n=Lh(),r="Expected a function",a=Math.max,i=Math.min;function o(u,l,s){var c,d,h,f,p,v,m=0,g=!1,y=!1,b=!0;if(typeof u!="function")throw new TypeError(r);l=n(l)||0,e(s)&&(g=!!s.leading,y="maxWait"in s,h=y?a(n(s.maxWait)||0,l):h,b="trailing"in s?!!s.trailing:b);function w(S){var A=c,N=d;return c=d=void 0,m=S,f=u.apply(N,A),f}function k(S){return m=S,p=setTimeout(P,l),g?w(S):f}function C(S){var A=S-v,N=S-m,R=l-A;return y?i(R,h-N):R}function x(S){var A=S-v,N=S-m;return v===void 0||A>=l||A<0||y&&N>=h}function P(){var S=t();if(x(S))return B(S);p=setTimeout(P,C(S))}function B(S){return p=void 0,b&&c?w(S):(c=d=void 0,f)}function D(){p!==void 0&&clearTimeout(p),m=0,c=v=d=p=void 0}function _(){return p===void 0?f:B(t())}function T(){var S=t(),A=x(S);if(c=arguments,d=this,v=S,A){if(p===void 0)return k(v);if(y)return clearTimeout(p),p=setTimeout(P,l),w(v)}return p===void 0&&(p=setTimeout(P,l)),f}return T.cancel=D,T.flush=_,T}return ui=o,ui}var Oh=Nh(),Nr=Rr(Oh),ci=Je?Je.performance:null,lc=ci&&ci.now?function(){return ci.now()}:function(){return Date.now()},zh=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(lc())},1e3/60)}}(),ma=function(e){return zh(e)},Gt=lc,kn=9261,uc=65599,Yn=5381,cc=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kn,n=t,r;r=e.next(),!r.done;)n=n*uc+r.value|0;return n},wr=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kn;return t*uc+e|0},Er=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Yn;return(t<<5)+t+e|0},Vh=function(e,t){return e*2097152+t},$t=function(e){return e[0]*2097152+e[1]},Hr=function(e,t){return[wr(e[0],t[0]),Er(e[1],t[1])]},zs=function(e,t){var n={value:0,done:!1},r=0,a=e.length,i={next:function(){return r<a?n.value=e[r++]:n.done=!0,n}};return cc(i,t)},Pn=function(e,t){var n={value:0,done:!1},r=0,a=e.length,i={next:function(){return r<a?n.value=e.charCodeAt(r++):n.done=!0,n}};return cc(i,t)},dc=function(){return Fh(arguments)},Fh=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];n===0?t=Pn(r):t=Pn(r,t)}return t};function Xh(e,t,n,r,a){var i=a*Math.PI/180,o=Math.cos(i)*(e-n)-Math.sin(i)*(t-r)+n,u=Math.sin(i)*(e-n)+Math.cos(i)*(t-r)+r;return{x:o,y:u}}var Yh=function(e,t,n,r,a,i){return{x:(e-n)*a+n,y:(t-r)*i+r}};function jh(e,t,n){if(n===0)return e;var r=(t.x1+t.x2)/2,a=(t.y1+t.y2)/2,i=t.w/t.h,o=1/i,u=Xh(e.x,e.y,r,a,n),l=Yh(u.x,u.y,r,a,i,o);return{x:l.x,y:l.y}}var Vs=!0,qh=console.warn!=null,Uh=console.trace!=null,Qo=Number.MAX_SAFE_INTEGER||9007199254740991,hc=function(){return!0},ba=function(){return!1},Fs=function(){return 0},$o=function(){},qe=function(e){throw new Error(e)},fc=function(e){if(e!==void 0)Vs=!!e;else return Vs},Ne=function(e){fc()&&(qh?console.warn(e):(console.log(e),Uh&&console.trace()))},Wh=function(e){return ge({},e)},Ft=function(e){return e==null?e:Ve(e)?e.slice():De(e)?Wh(e):e},Gh=function(e){return e.slice()},pc=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},Hh={},gc=function(){return Hh},ct=function(e){var t=Object.keys(e);return function(n){for(var r={},a=0;a<t.length;a++){var i=t[a],o=n==null?void 0:n[i];r[i]=o===void 0?e[i]:o}return r}},ln=function(e,t,n){for(var r=e.length-1;r>=0;r--)e[r]===t&&e.splice(r,1)},Jo=function(e){e.splice(0,e.length)},Kh=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}},kt=function(e,t,n){return n&&(t=nc(n,t)),e[t]},Ut=function(e,t,n,r){n&&(t=nc(n,t)),e[t]=r},Zh=function(){function e(){fn(this,e),this._obj={}}return pn(e,[{key:"set",value:function(t,n){return this._obj[t]=n,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]}}])}(),Wt=typeof Map<"u"?Map:Zh,Qh="undefined",$h=function(){function e(t){if(fn(this,e),this._obj=Object.create(null),this.size=0,t!=null){var n;t.instanceString!=null&&t.instanceString()===this.instanceString()?n=t.toArray():n=t;for(var r=0;r<n.length;r++)this.add(n[r])}}return pn(e,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(t){var n=this._obj;n[t]!==1&&(n[t]=1,this.size++)}},{key:"delete",value:function(t){var n=this._obj;n[t]===1&&(n[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(n){return t.has(n)})}},{key:"forEach",value:function(t,n){return this.toArray().forEach(t,n)}}])}(),er=(typeof Set>"u"?"undefined":tt(Set))!==Qh?Set:$h,Ma=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!Ho(e)){qe("An element must have a core reference and parameters set");return}var r=t.group;if(r==null&&(t.data&&t.data.source!=null&&t.data.target!=null?r="edges":r="nodes"),r!=="nodes"&&r!=="edges"){qe("An element must be of type `nodes` or `edges`; you specified `"+r+"`");return}this.length=1,this[0]=this;var a=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:r,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?r==="edges":!!t.pannable,active:!1,classes:new er,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(a.position.x==null&&(a.position.x=0),a.position.y==null&&(a.position.y=0),t.renderedPosition){var i=t.renderedPosition,o=e.pan(),u=e.zoom();a.position={x:(i.x-o.x)/u,y:(i.y-o.y)/u}}var l=[];Ve(t.classes)?l=t.classes:fe(t.classes)&&(l=t.classes.split(/\s+/));for(var s=0,c=l.length;s<c;s++){var d=l[s];!d||d===""||a.classes.add(d)}this.createEmitter(),(n===void 0||n)&&this.restore();var h=t.style||t.css;h&&(Ne("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h))},Xs=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){var a;De(t)&&!Pt(t)&&(a=t,t=a.roots||a.root,n=a.visit,r=a.directed),r=arguments.length===2&&!Ue(n)?n:r,n=Ue(n)?n:function(){};for(var i=this._private.cy,o=t=fe(t)?this.filter(t):t,u=[],l=[],s={},c={},d={},h=0,f,p=this.byGroup(),v=p.nodes,m=p.edges,g=0;g<o.length;g++){var y=o[g],b=y.id();y.isNode()&&(u.unshift(y),e.bfs&&(d[b]=!0,l.push(y)),c[b]=0)}for(var w=function(){var D=e.bfs?u.shift():u.pop(),_=D.id();if(e.dfs){if(d[_])return 0;d[_]=!0,l.push(D)}var T=c[_],S=s[_],A=S!=null?S.source():null,N=S!=null?S.target():null,R=S==null?void 0:D.same(A)?N[0]:A[0],M;if(M=n(D,S,R,h++,T),M===!0)return f=D,1;if(M===!1)return 1;for(var L=D.connectedEdges().filter(function(W){return(!r||W.source().same(D))&&m.has(W)}),I=0;I<L.length;I++){var j=L[I],F=j.connectedNodes().filter(function(W){return!W.same(D)&&v.has(W)}),Y=F.id();F.length!==0&&!d[Y]&&(F=F[0],u.push(F),e.bfs&&(d[Y]=!0,l.push(F)),s[Y]=j,c[Y]=c[_]+1)}},k;u.length!==0&&(k=w(),!(k!==0&&k===1)););for(var C=i.collection(),x=0;x<l.length;x++){var P=l[x],B=s[P.id()];B!=null&&C.push(B),C.push(P)}return{path:i.collection(C),found:i.collection(f)}}},kr={breadthFirstSearch:Xs({bfs:!0}),depthFirstSearch:Xs({dfs:!0})};kr.bfs=kr.breadthFirstSearch;kr.dfs=kr.depthFirstSearch;var _o={exports:{}},Jh=_o.exports,Ys;function ef(){return Ys||(Ys=1,function(e,t){(function(){var n,r,a,i,o,u,l,s,c,d,h,f,p,v,m;a=Math.floor,d=Math.min,r=function(g,y){return g<y?-1:g>y?1:0},c=function(g,y,b,w,k){var C;if(b==null&&(b=0),k==null&&(k=r),b<0)throw new Error("lo must be non-negative");for(w==null&&(w=g.length);b<w;)C=a((b+w)/2),k(y,g[C])<0?w=C:b=C+1;return[].splice.apply(g,[b,b-b].concat(y)),y},u=function(g,y,b){return b==null&&(b=r),g.push(y),v(g,0,g.length-1,b)},o=function(g,y){var b,w;return y==null&&(y=r),b=g.pop(),g.length?(w=g[0],g[0]=b,m(g,0,y)):w=b,w},s=function(g,y,b){var w;return b==null&&(b=r),w=g[0],g[0]=y,m(g,0,b),w},l=function(g,y,b){var w;return b==null&&(b=r),g.length&&b(g[0],y)<0&&(w=[g[0],y],y=w[0],g[0]=w[1],m(g,0,b)),y},i=function(g,y){var b,w,k,C,x,P;for(y==null&&(y=r),C=(function(){P=[];for(var B=0,D=a(g.length/2);0<=D?B<D:B>D;0<=D?B++:B--)P.push(B);return P}).apply(this).reverse(),x=[],w=0,k=C.length;w<k;w++)b=C[w],x.push(m(g,b,y));return x},p=function(g,y,b){var w;if(b==null&&(b=r),w=g.indexOf(y),w!==-1)return v(g,0,w,b),m(g,w,b)},h=function(g,y,b){var w,k,C,x,P;if(b==null&&(b=r),k=g.slice(0,y),!k.length)return k;for(i(k,b),P=g.slice(y),C=0,x=P.length;C<x;C++)w=P[C],l(k,w,b);return k.sort(b).reverse()},f=function(g,y,b){var w,k,C,x,P,B,D,_,T;if(b==null&&(b=r),y*10<=g.length){if(C=g.slice(0,y).sort(b),!C.length)return C;for(k=C[C.length-1],D=g.slice(y),x=0,B=D.length;x<B;x++)w=D[x],b(w,k)<0&&(c(C,w,0,null,b),C.pop(),k=C[C.length-1]);return C}for(i(g,b),T=[],P=0,_=d(y,g.length);0<=_?P<_:P>_;0<=_?++P:--P)T.push(o(g,b));return T},v=function(g,y,b,w){var k,C,x;for(w==null&&(w=r),k=g[b];b>y;){if(x=b-1>>1,C=g[x],w(k,C)<0){g[b]=C,b=x;continue}break}return g[b]=k},m=function(g,y,b){var w,k,C,x,P;for(b==null&&(b=r),k=g.length,P=y,C=g[y],w=2*y+1;w<k;)x=w+1,x<k&&!(b(g[w],g[x])<0)&&(w=x),g[y]=g[w],y=w,w=2*y+1;return g[y]=C,v(g,P,y,b)},n=function(){g.push=u,g.pop=o,g.replace=s,g.pushpop=l,g.heapify=i,g.updateItem=p,g.nlargest=h,g.nsmallest=f;function g(y){this.cmp=y??r,this.nodes=[]}return g.prototype.push=function(y){return u(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 s(this.nodes,y,this.cmp)},g.prototype.pushpop=function(y){return l(this.nodes,y,this.cmp)},g.prototype.heapify=function(){return i(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 n})}).call(Jh)}(_o)),_o.exports}var js,qs;function tf(){return qs||(qs=1,js=ef()),js}var nf=tf(),Or=Rr(nf),rf=ct({root:null,weight:function(e){return 1},directed:!1}),af={dijkstra:function(e){if(!De(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=rf(e),r=n.root,a=n.weight,i=n.directed,o=this,u=a,l=fe(r)?this.filter(r)[0]:r[0],s={},c={},d={},h=this.byGroup(),f=h.nodes,p=h.edges;p.unmergeBy(function(A){return A.isLoop()});for(var v=function(A){return s[A.id()]},m=function(A,N){s[A.id()]=N,g.updateItem(A)},g=new Or(function(A,N){return v(A)-v(N)}),y=0;y<f.length;y++){var b=f[y];s[b.id()]=b.same(l)?0:1/0,g.push(b)}for(var w=function(A,N){for(var R=(i?A.edgesTo(N):A.edgesWith(N)).intersect(p),M=1/0,L,I=0;I<R.length;I++){var j=R[I],F=u(j);(F<M||!L)&&(M=F,L=j)}return{edge:L,dist:M}};g.size()>0;){var k=g.pop(),C=v(k),x=k.id();if(d[x]=C,C!==1/0)for(var P=k.neighborhood().intersect(f),B=0;B<P.length;B++){var D=P[B],_=D.id(),T=w(k,D),S=C+T.dist;S<v(D)&&(m(D,S),c[_]={node:k,edge:T.edge})}}return{distanceTo:function(A){var N=fe(A)?f.filter(A)[0]:A[0];return d[N.id()]},pathTo:function(A){var N=fe(A)?f.filter(A)[0]:A[0],R=[],M=N,L=M.id();if(N.length>0)for(R.unshift(N);c[L];){var I=c[L];R.unshift(I.edge),R.unshift(I.node),M=I.node,L=M.id()}return o.spawn(R)}}}},of={kruskal:function(e){e=e||function(y){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,a=n.length,i=new Array(a),o=n,u=function(y){for(var b=0;b<i.length;b++){var w=i[b];if(w.has(y))return b}},l=0;l<a;l++)i[l]=this.spawn(n[l]);for(var s=r.sort(function(y,b){return e(y)-e(b)}),c=0;c<s.length;c++){var d=s[c],h=d.source()[0],f=d.target()[0],p=u(h),v=u(f),m=i[p],g=i[v];p!==v&&(o.merge(d),m.merge(g),i.splice(v,1))}return o}},sf=ct({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),lf={aStar:function(e){var t=this.cy(),n=sf(e),r=n.root,a=n.goal,i=n.heuristic,o=n.directed,u=n.weight;r=t.collection(r)[0],a=t.collection(a)[0];var l=r.id(),s=a.id(),c={},d={},h={},f=new Or(function(I,j){return d[I.id()]-d[j.id()]}),p=new er,v={},m={},g=function(I,j){f.push(I),p.add(j)},y,b,w=function(){y=f.pop(),b=y.id(),p.delete(b)},k=function(I){return p.has(I)};g(r,l),c[l]=0,d[l]=i(r);for(var C=0;f.size()>0;){if(w(),C++,b===s){for(var x=[],P=a,B=s,D=m[B];x.unshift(P),D!=null&&x.unshift(D),P=v[B],P!=null;)B=P.id(),D=m[B];return{found:!0,distance:c[b],path:this.spawn(x),steps:C}}h[b]=!0;for(var _=y._private.edges,T=0;T<_.length;T++){var S=_[T];if(this.hasElementWithId(S.id())&&!(o&&S.data("source")!==b)){var A=S.source(),N=S.target(),R=A.id()!==b?A:N,M=R.id();if(this.hasElementWithId(M)&&!h[M]){var L=c[b]+u(S);if(!k(M)){c[M]=L,d[M]=L+i(R),g(R,M),v[M]=y,m[M]=S;continue}L<c[M]&&(c[M]=L,d[M]=L+i(R),v[M]=y,m[M]=S)}}}}return{found:!1,distance:void 0,path:void 0,steps:C}}},uf=ct({weight:function(e){return 1},directed:!1}),cf={floydWarshall:function(e){for(var t=this.cy(),n=uf(e),r=n.weight,a=n.directed,i=r,o=this.byGroup(),u=o.nodes,l=o.edges,s=u.length,c=s*s,d=function(F){return u.indexOf(F)},h=function(F){return u[F]},f=new Array(c),p=0;p<c;p++){var v=p%s,m=(p-v)/s;m===v?f[p]=0:f[p]=1/0}for(var g=new Array(c),y=new Array(c),b=0;b<l.length;b++){var w=l[b],k=w.source()[0],C=w.target()[0];if(k!==C){var x=d(k),P=d(C),B=x*s+P,D=i(w);if(f[B]>D&&(f[B]=D,g[B]=P,y[B]=w),!a){var _=P*s+x;!a&&f[_]>D&&(f[_]=D,g[_]=x,y[_]=w)}}}for(var T=0;T<s;T++)for(var S=0;S<s;S++)for(var A=S*s+T,N=0;N<s;N++){var R=S*s+N,M=T*s+N;f[A]+f[M]<f[R]&&(f[R]=f[A]+f[M],g[R]=g[A])}var L=function(F){return(fe(F)?t.filter(F):F)[0]},I=function(F){return d(L(F))},j={distance:function(F,Y){var W=I(F),Q=I(Y);return f[W*s+Q]},path:function(F,Y){var W=I(F),Q=I(Y),$=h(W);if(W===Q)return $.collection();if(g[W*s+Q]==null)return t.collection();var Z=t.collection(),J=W,re;for(Z.merge($);W!==Q;)J=W,W=g[W*s+Q],re=y[J*s+W],Z.merge(re),Z.merge(h(W));return Z}};return j}},df=ct({weight:function(e){return 1},directed:!1,root:null}),hf={bellmanFord:function(e){var t=this,n=df(e),r=n.weight,a=n.directed,i=n.root,o=r,u=this,l=this.cy(),s=this.byGroup(),c=s.edges,d=s.nodes,h=d.length,f=new Wt,p=!1,v=[];i=l.collection(i)[0],c.unmergeBy(function(ye){return ye.isLoop()});for(var m=c.length,g=function(ye){var xe=f.get(ye.id());return xe||(xe={},f.set(ye.id(),xe)),xe},y=function(ye){return(fe(ye)?l.$(ye):ye)[0]},b=function(ye){return g(y(ye)).dist},w=function(ye){for(var xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:i,Ae=y(ye),ee=[],ue=Ae;;){if(ue==null)return t.spawn();var ce=g(ue),me=ce.edge,be=ce.pred;if(ee.unshift(ue[0]),ue.same(xe)&&ee.length>0)break;me!=null&&ee.unshift(me),ue=be}return u.spawn(ee)},k=0;k<h;k++){var C=d[k],x=g(C);C.same(i)?x.dist=0:x.dist=1/0,x.pred=null,x.edge=null}for(var P=!1,B=function(ye,xe,Ae,ee,ue,ce){var me=ee.dist+ce;me<ue.dist&&!Ae.same(ee.edge)&&(ue.dist=me,ue.pred=ye,ue.edge=Ae,P=!0)},D=1;D<h;D++){P=!1;for(var _=0;_<m;_++){var T=c[_],S=T.source(),A=T.target(),N=o(T),R=g(S),M=g(A);B(S,A,T,R,M,N),a||B(A,S,T,M,R,N)}if(!P)break}if(P)for(var L=[],I=0;I<m;I++){var j=c[I],F=j.source(),Y=j.target(),W=o(j),Q=g(F).dist,$=g(Y).dist;if(Q+W<$||!a&&$+W<Q)if(p||(Ne("Graph contains a negative weight cycle for Bellman-Ford"),p=!0),e.findNegativeWeightCycles!==!1){var Z=[];Q+W<$&&Z.push(F),!a&&$+W<Q&&Z.push(Y);for(var J=Z.length,re=0;re<J;re++){var V=Z[re],O=[V];O.push(g(V).edge);for(var z=g(V).pred;O.indexOf(z)===-1;)O.push(z),O.push(g(z).edge),z=g(z).pred;O=O.slice(O.indexOf(z));for(var H=O[0].id(),te=0,ae=2;ae<O.length;ae+=2)O[ae].id()<H&&(H=O[ae].id(),te=ae);O=O.slice(te).concat(O.slice(0,te)),O.push(O[0]);var we=O.map(function(ye){return ye.id()}).join(",");L.indexOf(we)===-1&&(v.push(u.spawn(O)),L.push(we))}}else break}return{distanceTo:b,pathTo:w,hasNegativeWeightCycle:p,negativeWeightCycles:v}}},ff=Math.sqrt(2),pf=function(e,t,n){n.length===0&&qe("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],a=r[1],i=r[2],o=t[a],u=t[i],l=n,s=l.length-1;s>=0;s--){var c=l[s],d=c[1],h=c[2];(t[d]===o&&t[h]===u||t[d]===u&&t[h]===o)&&l.splice(s,1)}for(var f=0;f<l.length;f++){var p=l[f];p[1]===u?(l[f]=p.slice(),l[f][1]=o):p[2]===u&&(l[f]=p.slice(),l[f][2]=o)}for(var v=0;v<t.length;v++)t[v]===u&&(t[v]=o);return l},di=function(e,t,n,r){for(;n>r;){var a=Math.floor(Math.random()*t.length);t=pf(a,e,t),n--}return t},gf={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(M){return M.isLoop()});var a=n.length,i=r.length,o=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),u=Math.floor(a/ff);if(a<2){qe("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],s=0;s<i;s++){var c=r[s];l.push([s,n.indexOf(c.source()),n.indexOf(c.target())])}for(var d=1/0,h=[],f=new Array(a),p=new Array(a),v=new Array(a),m=function(M,L){for(var I=0;I<a;I++)L[I]=M[I]},g=0;g<=o;g++){for(var y=0;y<a;y++)p[y]=y;var b=di(p,l.slice(),a,u),w=b.slice();m(p,v);var k=di(p,b,u,2),C=di(v,w,u,2);k.length<=C.length&&k.length<d?(d=k.length,h=k,m(p,f)):C.length<=k.length&&C.length<d&&(d=C.length,h=C,m(v,f))}for(var x=this.spawn(h.map(function(M){return r[M[0]]})),P=this.spawn(),B=this.spawn(),D=f[0],_=0;_<f.length;_++){var T=f[_],S=n[_];T===D?P.merge(S):B.merge(S)}var A=function(M){var L=e.spawn();return M.forEach(function(I){L.merge(I),I.connectedEdges().forEach(function(j){e.contains(j)&&!x.contains(j)&&L.merge(j)})}),L},N=[A(P),A(B)],R={cut:x,components:N,partition1:P,partition2:B};return R}},hi,vf=function(e){return{x:e.x,y:e.y}},Ra=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},vc=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},jn=function(e){return{x:e[0],y:e[1]}},yf=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=1/0,a=t;a<n;a++){var i=e[a];isFinite(i)&&(r=Math.min(i,r))}return r},mf=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=-1/0,a=t;a<n;a++){var i=e[a];isFinite(i)&&(r=Math.max(i,r))}return r},bf=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=0,a=0,i=t;i<n;i++){var o=e[i];isFinite(o)&&(r+=o,a++)}return r/a},xf=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;r?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var o=0,u=e.length-1;u>=0;u--){var l=e[u];i?isFinite(l)||(e[u]=-1/0,o++):e.splice(u,1)}a&&e.sort(function(d,h){return d-h});var s=e.length,c=Math.floor(s/2);return s%2!==0?e[c+1+o]:(e[c-1+o]+e[c+o])/2},wf=function(e){return Math.PI*e/180},Kr=function(e,t){return Math.atan2(t,e)-Math.PI/2},es=Math.log2||function(e){return Math.log(e)/Math.log(2)},ts=function(e){return e>0?1:e<0?-1:0},_n=function(e,t){return Math.sqrt(wn(e,t))},wn=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},Ef=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var a=0;a<t;a++)e[a]=e[a]/n;return e},at=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},Wn=function(e,t,n,r){return{x:at(e.x,t.x,n.x,r),y:at(e.y,t.y,n.y,r)}},kf=function(e,t,n,r){var a={x:t.x-e.x,y:t.y-e.y},i=_n(e,t),o={x:a.x/i,y:a.y/i};return n=n??0,r=r??n*i,{x:e.x+o.x*r,y:e.y+o.y*r}},Tr=function(e,t,n){return Math.max(e,Math.min(n,t))},bt=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}}},Tf=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Cf=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Pf=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},yc=function(e,t,n){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,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},oa=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},sa=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,r,a,i;if(t.length===1)n=r=a=i=t[0];else if(t.length===2)n=a=t[0],i=r=t[1];else if(t.length===4){var o=$e(t,4);n=o[0],r=o[1],a=o[2],i=o[3]}return e.x1-=i,e.x2+=r,e.y1-=n,e.y2+=a,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Us=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},ns=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)},nn=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Ws=function(e,t){return nn(e,t.x,t.y)},mc=function(e,t){return nn(e,t.x1,t.y1)&&nn(e,t.x2,t.y2)},_f=(hi=Math.hypot)!==null&&hi!==void 0?hi:function(e,t){return Math.sqrt(e*e+t*t)};function Bf(e,t){if(e.length<3)throw new Error("Need at least 3 vertices");var n=function(x,P){return{x:x.x+P.x,y:x.y+P.y}},r=function(x,P){return{x:x.x-P.x,y:x.y-P.y}},a=function(x,P){return{x:x.x*P,y:x.y*P}},i=function(x,P){return x.x*P.y-x.y*P.x},o=function(x){var P=_f(x.x,x.y);return P===0?{x:0,y:0}:{x:x.x/P,y:x.y/P}},u=function(x){for(var P=0,B=0;B<x.length;B++){var D=x[B],_=x[(B+1)%x.length];P+=D.x*_.y-_.x*D.y}return P/2},l=function(x,P,B,D){var _=r(P,x),T=r(D,B),S=i(_,T);if(Math.abs(S)<1e-9)return n(x,a(_,.5));var A=i(r(B,x),T)/S;return n(x,a(_,A))},s=e.map(function(x){return{x:x.x,y:x.y}});u(s)<0&&s.reverse();for(var c=s.length,d=[],h=0;h<c;h++){var f=s[h],p=s[(h+1)%c],v=r(p,f),m=o({x:v.y,y:-v.x});d.push(m)}for(var g=d.map(function(x,P){var B=n(s[P],a(x,t)),D=n(s[(P+1)%c],a(x,t));return{p1:B,p2:D}}),y=[],b=0;b<c;b++){var w=g[(b-1+c)%c],k=g[b],C=l(w.p1,w.p2,k.p1,k.p2);y.push(C)}return y}function Df(e,t,n,r,a,i){var o=zf(e,t,n,r,a),u=Bf(o,i),l=bt();return u.forEach(function(s){return yc(l,s.x,s.y)}),l}var bc=function(e,t,n,r,a,i,o){var u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",l=u==="auto"?un(a,i):u,s=a/2,c=i/2;l=Math.min(l,s,c);var d=l!==s,h=l!==c,f;if(d){var p=n-s+l-o,v=r-c-o,m=n+s-l+o,g=v;if(f=rn(e,t,n,r,p,v,m,g,!1),f.length>0)return f}if(h){var y=n+s+o,b=r-c+l-o,w=y,k=r+c-l+o;if(f=rn(e,t,n,r,y,b,w,k,!1),f.length>0)return f}if(d){var C=n-s+l-o,x=r+c+o,P=n+s-l+o,B=x;if(f=rn(e,t,n,r,C,x,P,B,!1),f.length>0)return f}if(h){var D=n-s-o,_=r-c+l-o,T=D,S=r+c-l+o;if(f=rn(e,t,n,r,D,_,T,S,!1),f.length>0)return f}var A;{var N=n-s+l,R=r-c+l;if(A=gr(e,t,n,r,N,R,l+o),A.length>0&&A[0]<=N&&A[1]<=R)return[A[0],A[1]]}{var M=n+s-l,L=r-c+l;if(A=gr(e,t,n,r,M,L,l+o),A.length>0&&A[0]>=M&&A[1]<=L)return[A[0],A[1]]}{var I=n+s-l,j=r+c-l;if(A=gr(e,t,n,r,I,j,l+o),A.length>0&&A[0]>=I&&A[1]>=j)return[A[0],A[1]]}{var F=n-s+l,Y=r+c-l;if(A=gr(e,t,n,r,F,Y,l+o),A.length>0&&A[0]<=F&&A[1]>=Y)return[A[0],A[1]]}return[]},Af=function(e,t,n,r,a,i,o){var u=o,l=Math.min(n,a),s=Math.max(n,a),c=Math.min(r,i),d=Math.max(r,i);return l-u<=e&&e<=s+u&&c-u<=t&&t<=d+u},Sf=function(e,t,n,r,a,i,o,u,l){var s={x1:Math.min(n,o,a)-l,x2:Math.max(n,o,a)+l,y1:Math.min(r,u,i)-l,y2:Math.max(r,u,i)+l};return!(e<s.x1||e>s.x2||t<s.y1||t>s.y2)},Mf=function(e,t,n,r){n-=r;var a=t*t-4*e*n;if(a<0)return[];var i=Math.sqrt(a),o=2*e,u=(-t+i)/o,l=(-t-i)/o;return[u,l]},Rf=function(e,t,n,r,a){var i=1e-5;e===0&&(e=i),t/=e,n/=e,r/=e;var o,u,l,s,c,d,h,f;if(u=(3*n-t*t)/9,l=-(27*r)+t*(9*n-2*(t*t)),l/=54,o=u*u*u+l*l,a[1]=0,h=t/3,o>0){c=l+Math.sqrt(o),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),d=l-Math.sqrt(o),d=d<0?-Math.pow(-d,1/3):Math.pow(d,1/3),a[0]=-h+c+d,h+=(c+d)/2,a[4]=a[2]=-h,h=Math.sqrt(3)*(-d+c)/2,a[3]=h,a[5]=-h;return}if(a[5]=a[3]=0,o===0){f=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),a[0]=-h+2*f,a[4]=a[2]=-(f+h);return}u=-u,s=u*u*u,s=Math.acos(l/Math.sqrt(s)),f=2*Math.sqrt(u),a[0]=-h+f*Math.cos(s/3),a[2]=-h+f*Math.cos((s+2*Math.PI)/3),a[4]=-h+f*Math.cos((s+4*Math.PI)/3)},If=function(e,t,n,r,a,i,o,u){var l=1*n*n-4*n*a+2*n*o+4*a*a-4*a*o+o*o+r*r-4*r*i+2*r*u+4*i*i-4*i*u+u*u,s=9*n*a-3*n*n-3*n*o-6*a*a+3*a*o+9*r*i-3*r*r-3*r*u-6*i*i+3*i*u,c=3*n*n-6*n*a+n*o-n*e+2*a*a+2*a*e-o*e+3*r*r-6*r*i+r*u-r*t+2*i*i+2*i*t-u*t,d=1*n*a-n*n+n*e-a*e+r*i-r*r+r*t-i*t,h=[];Rf(l,s,c,d,h);for(var f=1e-7,p=[],v=0;v<6;v+=2)Math.abs(h[v+1])<f&&h[v]>=0&&h[v]<=1&&p.push(h[v]);p.push(1),p.push(0);for(var m=-1,g,y,b,w=0;w<p.length;w++)g=Math.pow(1-p[w],2)*n+2*(1-p[w])*p[w]*a+p[w]*p[w]*o,y=Math.pow(1-p[w],2)*r+2*(1-p[w])*p[w]*i+p[w]*p[w]*u,b=Math.pow(g-e,2)+Math.pow(y-t,2),m>=0?b<m&&(m=b):m=b;return m},Lf=function(e,t,n,r,a,i){var o=[e-n,t-r],u=[a-n,i-r],l=u[0]*u[0]+u[1]*u[1],s=o[0]*o[0]+o[1]*o[1],c=o[0]*u[0]+o[1]*u[1],d=c*c/l;return c<0?s:d>l?(e-a)*(e-a)+(t-i)*(t-i):s-d},Tt=function(e,t,n){for(var r,a,i,o,u,l=0,s=0;s<n.length/2;s++)if(r=n[s*2],a=n[s*2+1],s+1<n.length/2?(i=n[(s+1)*2],o=n[(s+1)*2+1]):(i=n[(s+1-n.length/2)*2],o=n[(s+1-n.length/2)*2+1]),!(r==e&&i==e))if(r>=e&&e>=i||r<=e&&e<=i)u=(e-r)/(i-r)*(o-a)+a,u>t&&l++;else continue;return l%2!==0},Ht=function(e,t,n,r,a,i,o,u,l){var s=new Array(n.length),c;u[0]!=null?(c=Math.atan(u[1]/u[0]),u[0]<0?c=c+Math.PI/2:c=-c-Math.PI/2):c=u;for(var d=Math.cos(-c),h=Math.sin(-c),f=0;f<s.length/2;f++)s[f*2]=i/2*(n[f*2]*d-n[f*2+1]*h),s[f*2+1]=o/2*(n[f*2+1]*d+n[f*2]*h),s[f*2]+=r,s[f*2+1]+=a;var p;if(l>0){var v=wa(s,-l);p=xa(v)}else p=s;return Tt(e,t,p)},Nf=function(e,t,n,r,a,i,o,u){for(var l=new Array(n.length*2),s=0;s<u.length;s++){var c=u[s];l[s*4+0]=c.startX,l[s*4+1]=c.startY,l[s*4+2]=c.stopX,l[s*4+3]=c.stopY;var d=Math.pow(c.cx-e,2)+Math.pow(c.cy-t,2);if(d<=Math.pow(c.radius,2))return!0}return Tt(e,t,l)},xa=function(e){for(var t=new Array(e.length/2),n,r,a,i,o,u,l,s,c=0;c<e.length/4;c++){n=e[c*4],r=e[c*4+1],a=e[c*4+2],i=e[c*4+3],c<e.length/4-1?(o=e[(c+1)*4],u=e[(c+1)*4+1],l=e[(c+1)*4+2],s=e[(c+1)*4+3]):(o=e[0],u=e[1],l=e[2],s=e[3]);var d=rn(n,r,a,i,o,u,l,s,!0);t[c*2]=d[0],t[c*2+1]=d[1]}return t},wa=function(e,t){for(var n=new Array(e.length*2),r,a,i,o,u=0;u<e.length/2;u++){r=e[u*2],a=e[u*2+1],u<e.length/2-1?(i=e[(u+1)*2],o=e[(u+1)*2+1]):(i=e[0],o=e[1]);var l=o-a,s=-(i-r),c=Math.sqrt(l*l+s*s),d=l/c,h=s/c;n[u*4]=r+d*t,n[u*4+1]=a+h*t,n[u*4+2]=i+d*t,n[u*4+3]=o+h*t}return n},Of=function(e,t,n,r,a,i){var o=n-e,u=r-t;o/=a,u/=i;var l=Math.sqrt(o*o+u*u),s=l-1;if(s<0)return[];var c=s/l;return[(n-e)*c+e,(r-t)*c+t]},Cn=function(e,t,n,r,a,i,o){return e-=a,t-=i,e/=n/2+o,t/=r/2+o,e*e+t*t<=1},gr=function(e,t,n,r,a,i,o){var u=[n-e,r-t],l=[e-a,t-i],s=u[0]*u[0]+u[1]*u[1],c=2*(l[0]*u[0]+l[1]*u[1]),d=l[0]*l[0]+l[1]*l[1]-o*o,h=c*c-4*s*d;if(h<0)return[];var f=(-c+Math.sqrt(h))/(2*s),p=(-c-Math.sqrt(h))/(2*s),v=Math.min(f,p),m=Math.max(f,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]*u[0]+e,b=g[0]*u[1]+t;if(g.length>1){if(g[0]==g[1])return[y,b];var w=g[1]*u[0]+e,k=g[1]*u[1]+t;return[y,b,w,k]}else return[y,b]},fi=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},rn=function(e,t,n,r,a,i,o,u,l){var s=e-a,c=n-e,d=o-a,h=t-i,f=r-t,p=u-i,v=d*h-p*s,m=c*h-f*s,g=p*c-d*f;if(g!==0){var y=v/g,b=m/g,w=.001,k=0-w,C=1+w;return k<=y&&y<=C&&k<=b&&b<=C?[e+y*c,t+y*f]:l?[e+y*c,t+y*f]:[]}else return v===0||m===0?fi(e,n,o)===o?[o,u]:fi(e,n,a)===a?[a,i]:fi(a,o,n)===n?[n,r]:[]:[]},zf=function(e,t,n,r,a){var i=[],o=r/2,u=a/2,l=t,s=n;i.push({x:l+o*e[0],y:s+u*e[1]});for(var c=1;c<e.length/2;c++)i.push({x:l+o*e[c*2],y:s+u*e[c*2+1]});return i},Cr=function(e,t,n,r,a,i,o,u){var l=[],s,c=new Array(n.length),d=!0;i==null&&(d=!1);var h;if(d){for(var f=0;f<c.length/2;f++)c[f*2]=n[f*2]*i+r,c[f*2+1]=n[f*2+1]*o+a;if(u>0){var p=wa(c,-u);h=xa(p)}else h=c}else h=n;for(var v,m,g,y,b=0;b<h.length/2;b++)v=h[b*2],m=h[b*2+1],b<h.length/2-1?(g=h[(b+1)*2],y=h[(b+1)*2+1]):(g=h[0],y=h[1]),s=rn(e,t,r,a,v,m,g,y),s.length!==0&&l.push(s[0],s[1]);return l},Vf=function(e,t,n,r,a,i,o,u,l){var s=[],c,d=new Array(n.length*2);l.forEach(function(g,y){y===0?(d[d.length-2]=g.startX,d[d.length-1]=g.startY):(d[y*4-2]=g.startX,d[y*4-1]=g.startY),d[y*4]=g.stopX,d[y*4+1]=g.stopY,c=gr(e,t,r,a,g.cx,g.cy,g.radius),c.length!==0&&s.push(c[0],c[1])});for(var h=0;h<d.length/4;h++)c=rn(e,t,r,a,d[h*4],d[h*4+1],d[h*4+2],d[h*4+3],!1),c.length!==0&&s.push(c[0],c[1]);if(s.length>2){for(var f=[s[0],s[1]],p=Math.pow(f[0]-e,2)+Math.pow(f[1]-t,2),v=1;v<s.length/2;v++){var m=Math.pow(s[v*2]-e,2)+Math.pow(s[v*2+1]-t,2);m<=p&&(f[0]=s[v*2],f[1]=s[v*2+1],p=m)}return f}return s},Zr=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],a=Math.sqrt(r[0]*r[0]+r[1]*r[1]),i=(a-n)/a;return i<0&&(i=1e-5),[t[0]+i*r[0],t[1]+i*r[1]]},mt=function(e,t){var n=Bo(e,t);return n=xc(n),n},xc=function(e){for(var t,n,r=e.length/2,a=1/0,i=1/0,o=-1/0,u=-1/0,l=0;l<r;l++)t=e[2*l],n=e[2*l+1],a=Math.min(a,t),o=Math.max(o,t),i=Math.min(i,n),u=Math.max(u,n);for(var s=2/(o-a),c=2/(u-i),d=0;d<r;d++)t=e[2*d]=e[2*d]*s,n=e[2*d+1]=e[2*d+1]*c,a=Math.min(a,t),o=Math.max(o,t),i=Math.min(i,n),u=Math.max(u,n);if(i<-1)for(var h=0;h<r;h++)n=e[2*h+1]=e[2*h+1]+(-1-i);return e},Bo=function(e,t){var n=1/e*2*Math.PI,r=e%2===0?Math.PI/2+n/2:Math.PI/2;r+=t;for(var a=new Array(e*2),i,o=0;o<e;o++)i=o*n+r,a[2*o]=Math.cos(i),a[2*o+1]=Math.sin(-i);return a},un=function(e,t){return Math.min(e/4,t/4,8)},wc=function(e,t){return Math.min(e/10,t/10,8)},rs=function(){return 8},Ff=function(e,t,n){return[e-2*t+n,2*(t-e),e]},Do=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function pi(e,t){function n(d){for(var h=[],f=0;f<d.length;f++){var p=d[f],v=d[(f+1)%d.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);h.push({x:g.x/y,y:g.y/y})}return h}function r(d,h){var f=1/0,p=-1/0,v=Ct(d),m;try{for(v.s();!(m=v.n()).done;){var g=m.value,y=g.x*h.x+g.y*h.y;f=Math.min(f,y),p=Math.max(p,y)}}catch(b){v.e(b)}finally{v.f()}return{min:f,max:p}}function a(d,h){return!(d.max<h.min||h.max<d.min)}var i=[].concat(va(n(e)),va(n(t))),o=Ct(i),u;try{for(o.s();!(u=o.n()).done;){var l=u.value,s=r(e,l),c=r(t,l);if(!a(s,c))return!1}}catch(d){o.e(d)}finally{o.f()}return!0}var Xf=ct({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),Yf={pageRank:function(e){for(var t=Xf(e),n=t.dampingFactor,r=t.precision,a=t.iterations,i=t.weight,o=this._private.cy,u=this.byGroup(),l=u.nodes,s=u.edges,c=l.length,d=c*c,h=s.length,f=new Array(d),p=new Array(c),v=(1-n)/c,m=0;m<c;m++){for(var g=0;g<c;g++){var y=m*c+g;f[y]=0}p[m]=0}for(var b=0;b<h;b++){var w=s[b],k=w.data("source"),C=w.data("target");if(k!==C){var x=l.indexOfId(k),P=l.indexOfId(C),B=i(w),D=P*c+x;f[D]+=B,p[x]+=B}}for(var _=1/c+v,T=0;T<c;T++)if(p[T]===0)for(var S=0;S<c;S++){var A=S*c+T;f[A]=_}else for(var N=0;N<c;N++){var R=N*c+T;f[R]=f[R]/p[T]+v}for(var M=new Array(c),L=new Array(c),I,j=0;j<c;j++)M[j]=1;for(var F=0;F<a;F++){for(var Y=0;Y<c;Y++)L[Y]=0;for(var W=0;W<c;W++)for(var Q=0;Q<c;Q++){var $=W*c+Q;L[W]+=f[$]*M[Q]}Ef(L),I=M,M=L,L=I;for(var Z=0,J=0;J<c;J++){var re=I[J]-M[J];Z+=re*re}if(Z<r)break}var V={rank:function(O){return O=o.collection(O)[0],M[l.indexOf(O)]}};return V}},Gs=ct({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Gn={degreeCentralityNormalized:function(e){e=Gs(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var a={},i={},o=0,u=0,l=0;l<r;l++){var s=n[l],c=s.id();e.root=s;var d=this.degreeCentrality(e);o<d.indegree&&(o=d.indegree),u<d.outdegree&&(u=d.outdegree),a[c]=d.indegree,i[c]=d.outdegree}return{indegree:function(g){return o==0?0:(fe(g)&&(g=t.filter(g)),a[g.id()]/o)},outdegree:function(g){return u===0?0:(fe(g)&&(g=t.filter(g)),i[g.id()]/u)}}}else{for(var h={},f=0,p=0;p<r;p++){var v=n[p];e.root=v;var m=this.degreeCentrality(e);f<m.degree&&(f=m.degree),h[v.id()]=m.degree}return{degree:function(g){return f===0?0:(fe(g)&&(g=t.filter(g)),h[g.id()]/f)}}}},degreeCentrality:function(e){e=Gs(e);var t=this.cy(),n=this,r=e,a=r.root,i=r.weight,o=r.directed,u=r.alpha;if(a=t.collection(a)[0],o){for(var l=a.connectedEdges(),s=l.filter(function(k){return k.target().same(a)&&n.has(k)}),c=l.filter(function(k){return k.source().same(a)&&n.has(k)}),d=s.length,h=c.length,f=0,p=0,v=0;v<s.length;v++)f+=i(s[v]);for(var m=0;m<c.length;m++)p+=i(c[m]);return{indegree:Math.pow(d,1-u)*Math.pow(f,u),outdegree:Math.pow(h,1-u)*Math.pow(p,u)}}else{for(var g=a.connectedEdges().intersection(n),y=g.length,b=0,w=0;w<g.length;w++)b+=i(g[w]);return{degree:Math.pow(y,1-u)*Math.pow(b,u)}}}};Gn.dc=Gn.degreeCentrality;Gn.dcn=Gn.degreeCentralityNormalised=Gn.degreeCentralityNormalized;var Hs=ct({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Hn={closenessCentralityNormalized:function(e){for(var t=Hs(e),n=t.harmonic,r=t.weight,a=t.directed,i=this.cy(),o={},u=0,l=this.nodes(),s=this.floydWarshall({weight:r,directed:a}),c=0;c<l.length;c++){for(var d=0,h=l[c],f=0;f<l.length;f++)if(c!==f){var p=s.distance(h,l[f]);n?d+=1/p:d+=p}n||(d=1/d),u<d&&(u=d),o[h.id()]=d}return{closeness:function(v){return u==0?0:(fe(v)?v=i.filter(v)[0].id():v=v.id(),o[v]/u)}}},closenessCentrality:function(e){var t=Hs(e),n=t.root,r=t.weight,a=t.directed,i=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:a}),u=0,l=this.nodes(),s=0;s<l.length;s++){var c=l[s];if(!c.same(n)){var d=o.distanceTo(c);i?u+=1/d:u+=d}}return i?u:1/u}};Hn.cc=Hn.closenessCentrality;Hn.ccn=Hn.closenessCentralityNormalised=Hn.closenessCentralityNormalized;var jf=ct({weight:null,directed:!1}),Ao={betweennessCentrality:function(e){for(var t=jf(e),n=t.directed,r=t.weight,a=r!=null,i=this.cy(),o=this.nodes(),u={},l={},s=0,c={set:function(g,y){l[g]=y,y>s&&(s=y)},get:function(g){return l[g]}},d=0;d<o.length;d++){var h=o[d],f=h.id();n?u[f]=h.outgoers().nodes():u[f]=h.openNeighborhood().nodes(),c.set(f,0)}for(var p=function(){for(var g=o[v].id(),y=[],b={},w={},k={},C=new Or(function(Y,W){return k[Y]-k[W]}),x=0;x<o.length;x++){var P=o[x].id();b[P]=[],w[P]=0,k[P]=1/0}for(w[g]=1,k[g]=0,C.push(g);!C.empty();){var B=C.pop();if(y.push(B),a)for(var D=0;D<u[B].length;D++){var _=u[B][D],T=i.getElementById(B),S=void 0;T.edgesTo(_).length>0?S=T.edgesTo(_)[0]:S=_.edgesTo(T)[0];var A=r(S);_=_.id(),k[_]>k[B]+A&&(k[_]=k[B]+A,C.nodes.indexOf(_)<0?C.push(_):C.updateItem(_),w[_]=0,b[_]=[]),k[_]==k[B]+A&&(w[_]=w[_]+w[B],b[_].push(B))}else for(var N=0;N<u[B].length;N++){var R=u[B][N].id();k[R]==1/0&&(C.push(R),k[R]=k[B]+1),k[R]==k[B]+1&&(w[R]=w[R]+w[B],b[R].push(B))}}for(var M={},L=0;L<o.length;L++)M[o[L].id()]=0;for(;y.length>0;){for(var I=y.pop(),j=0;j<b[I].length;j++){var F=b[I][j];M[F]=M[F]+w[F]/w[I]*(1+M[I])}I!=o[v].id()&&c.set(I,c.get(I)+M[I])}},v=0;v<o.length;v++)p();var m={betweenness:function(g){var y=i.collection(g).id();return c.get(y)},betweennessNormalized:function(g){if(s==0)return 0;var y=i.collection(g).id();return c.get(y)/s}};return m.betweennessNormalised=m.betweennessNormalized,m}};Ao.bc=Ao.betweennessCentrality;var qf=ct({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),Uf=function(e){return qf(e)},Wf=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},Gf=function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n},Ec=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var a=0;a<t;a++)n+=e[a*t+r];for(var i=0;i<t;i++)e[i*t+r]=e[i*t+r]/n}},Hf=function(e,t,n){for(var r=new Array(n*n),a=0;a<n;a++){for(var i=0;i<n;i++)r[a*n+i]=0;for(var o=0;o<n;o++)for(var u=0;u<n;u++)r[a*n+u]+=e[a*n+o]*t[o*n+u]}return r},Kf=function(e,t,n){for(var r=e.slice(0),a=1;a<n;a++)e=Hf(e,r,t);return e},Zf=function(e,t,n){for(var r=new Array(t*t),a=0;a<t*t;a++)r[a]=Math.pow(e[a],n);return Ec(r,t),r},Qf=function(e,t,n,r){for(var a=0;a<n;a++){var i=Math.round(e[a]*Math.pow(10,r))/Math.pow(10,r),o=Math.round(t[a]*Math.pow(10,r))/Math.pow(10,r);if(i!==o)return!1}return!0},$f=function(e,t,n,r){for(var a=[],i=0;i<t;i++){for(var o=[],u=0;u<t;u++)Math.round(e[i*t+u]*1e3)/1e3>0&&o.push(n[u]);o.length!==0&&a.push(r.collection(o))}return a},Jf=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},ep=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&Jf(e[t],e[n])&&e.splice(n,1);return e},Ks=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),a=Uf(e),i={},o=0;o<t.length;o++)i[t[o].id()]=o;for(var u=t.length,l=u*u,s=new Array(l),c,d=0;d<l;d++)s[d]=0;for(var h=0;h<n.length;h++){var f=n[h],p=i[f.source().id()],v=i[f.target().id()],m=Wf(f,a.attributes);s[p*u+v]+=m,s[v*u+p]+=m}Gf(s,u,a.multFactor),Ec(s,u);for(var g=!0,y=0;g&&y<a.maxIterations;)g=!1,c=Kf(s,u,a.expandFactor),s=Zf(c,u,a.inflateFactor),Qf(s,c,l,4)||(g=!0),y++;var b=$f(s,u,t,r);return b=ep(b),b},tp={markovClustering:Ks,mcl:Ks},np=function(e){return e},kc=function(e,t){return Math.abs(t-e)},Zs=function(e,t,n){return e+kc(t,n)},Qs=function(e,t,n){return e+Math.pow(n-t,2)},rp=function(e){return Math.sqrt(e)},ap=function(e,t,n){return Math.max(e,kc(t,n))},lr=function(e,t,n,r,a){for(var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:np,o=r,u,l,s=0;s<e;s++)u=t(s),l=n(s),o=a(o,u,l);return i(o)},Qn={euclidean:function(e,t,n){return e>=2?lr(e,t,n,0,Qs,rp):lr(e,t,n,0,Zs)},squaredEuclidean:function(e,t,n){return lr(e,t,n,0,Qs)},manhattan:function(e,t,n){return lr(e,t,n,0,Zs)},max:function(e,t,n){return lr(e,t,n,-1/0,ap)}};Qn["squared-euclidean"]=Qn.squaredEuclidean;Qn.squaredeuclidean=Qn.squaredEuclidean;function Ia(e,t,n,r,a,i){var o;return Ue(e)?o=e:o=Qn[e]||Qn.euclidean,t===0&&Ue(e)?o(a,i):o(t,n,r,a,i)}var ip=ct({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),as=function(e){return ip(e)},Ea=function(e,t,n,r,a){var i=a!=="kMedoids",o=i?function(c){return n[c]}:function(c){return r[c](n)},u=function(c){return r[c](t)},l=n,s=t;return Ia(e,r.length,o,u,l,s)},gi=function(e,t,n){for(var r=n.length,a=new Array(r),i=new Array(r),o=new Array(t),u=null,l=0;l<r;l++)a[l]=e.min(n[l]).value,i[l]=e.max(n[l]).value;for(var s=0;s<t;s++){u=[];for(var c=0;c<r;c++)u[c]=Math.random()*(i[c]-a[c])+a[c];o[s]=u}return o},Tc=function(e,t,n,r,a){for(var i=1/0,o=0,u=0;u<t.length;u++){var l=Ea(n,e,t[u],r,a);l<i&&(i=l,o=u)}return o},Cc=function(e,t,n){for(var r=[],a=null,i=0;i<t.length;i++)a=t[i],n[a.id()]===e&&r.push(a);return r},op=function(e,t,n){return Math.abs(t-e)<=n},sp=function(e,t,n){for(var r=0;r<e.length;r++)for(var a=0;a<e[r].length;a++){var i=Math.abs(e[r][a]-t[r][a]);if(i>n)return!1}return!0},lp=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},$s=function(e,t){var n=new Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var a=e[Math.floor(Math.random()*e.length)];lp(a,n,r);)a=e[Math.floor(Math.random()*e.length)];n[r]=a}else for(var i=0;i<t;i++)n[i]=e[Math.floor(Math.random()*e.length)];return n},Js=function(e,t,n){for(var r=0,a=0;a<t.length;a++)r+=Ea("manhattan",t[a],e,n,"kMedoids");return r},up=function(e){var t=this.cy(),n=this.nodes(),r=null,a=as(e),i=new Array(a.k),o={},u;a.testMode?typeof a.testCentroids=="number"?(a.testCentroids,u=gi(n,a.k,a.attributes)):tt(a.testCentroids)==="object"?u=a.testCentroids:u=gi(n,a.k,a.attributes):u=gi(n,a.k,a.attributes);for(var l=!0,s=0;l&&s<a.maxIterations;){for(var c=0;c<n.length;c++)r=n[c],o[r.id()]=Tc(r,u,a.distance,a.attributes,"kMeans");l=!1;for(var d=0;d<a.k;d++){var h=Cc(d,n,o);if(h.length!==0){for(var f=a.attributes.length,p=u[d],v=new Array(f),m=new Array(f),g=0;g<f;g++){m[g]=0;for(var y=0;y<h.length;y++)r=h[y],m[g]+=a.attributes[g](r);v[g]=m[g]/h.length,op(v[g],p[g],a.sensitivityThreshold)||(l=!0)}u[d]=v,i[d]=t.collection(h)}}s++}return i},cp=function(e){var t=this.cy(),n=this.nodes(),r=null,a=as(e),i=new Array(a.k),o,u={},l,s=new Array(a.k);a.testMode?typeof a.testCentroids=="number"||(tt(a.testCentroids)==="object"?o=a.testCentroids:o=$s(n,a.k)):o=$s(n,a.k);for(var c=!0,d=0;c&&d<a.maxIterations;){for(var h=0;h<n.length;h++)r=n[h],u[r.id()]=Tc(r,o,a.distance,a.attributes,"kMedoids");c=!1;for(var f=0;f<o.length;f++){var p=Cc(f,n,u);if(p.length!==0){s[f]=Js(o[f],p,a.attributes);for(var v=0;v<p.length;v++)l=Js(p[v],p,a.attributes),l<s[f]&&(s[f]=l,o[f]=p[v],c=!0);i[f]=t.collection(p)}}d++}return i},dp=function(e,t,n,r,a){for(var i,o,u=0;u<t.length;u++)for(var l=0;l<e.length;l++)r[u][l]=Math.pow(n[u][l],a.m);for(var s=0;s<e.length;s++)for(var c=0;c<a.attributes.length;c++){i=0,o=0;for(var d=0;d<t.length;d++)i+=r[d][s]*a.attributes[c](t[d]),o+=r[d][s];e[s][c]=i/o}},hp=function(e,t,n,r,a){for(var i=0;i<e.length;i++)t[i]=e[i].slice();for(var o,u,l,s=2/(a.m-1),c=0;c<n.length;c++)for(var d=0;d<r.length;d++){o=0;for(var h=0;h<n.length;h++)u=Ea(a.distance,r[d],n[c],a.attributes,"cmeans"),l=Ea(a.distance,r[d],n[h],a.attributes,"cmeans"),o+=Math.pow(u/l,s);e[d][c]=1/o}},fp=function(e,t,n,r){for(var a=new Array(n.k),i=0;i<a.length;i++)a[i]=[];for(var o,u,l=0;l<t.length;l++){o=-1/0,u=-1;for(var s=0;s<t[0].length;s++)t[l][s]>o&&(o=t[l][s],u=s);a[u].push(e[l])}for(var c=0;c<a.length;c++)a[c]=r.collection(a[c]);return a},el=function(e){var t=this.cy(),n=this.nodes(),r=as(e),a,i,o,u,l;u=new Array(n.length);for(var s=0;s<n.length;s++)u[s]=new Array(r.k);o=new Array(n.length);for(var c=0;c<n.length;c++)o[c]=new Array(r.k);for(var d=0;d<n.length;d++){for(var h=0,f=0;f<r.k;f++)o[d][f]=Math.random(),h+=o[d][f];for(var p=0;p<r.k;p++)o[d][p]=o[d][p]/h}i=new Array(r.k);for(var v=0;v<r.k;v++)i[v]=new Array(r.attributes.length);l=new Array(n.length);for(var m=0;m<n.length;m++)l[m]=new Array(r.k);for(var g=!0,y=0;g&&y<r.maxIterations;)g=!1,dp(i,n,o,l,r),hp(o,u,i,n,r),sp(o,u,r.sensitivityThreshold)||(g=!0),y++;return a=fp(n,o,r,t),{clusters:a,degreeOfMembership:o}},pp={kMeans:up,kMedoids:cp,fuzzyCMeans:el,fcm:el},gp=ct({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),vp={single:"min",complete:"max"},yp=function(e){var t=gp(e),n=vp[t.linkage];return n!=null&&(t.linkage=n),t},tl=function(e,t,n,r,a){for(var i=0,o=1/0,u,l=a.attributes,s=function(x,P){return Ia(a.distance,l.length,function(B){return l[B](x)},function(B){return l[B](P)},x,P)},c=0;c<e.length;c++){var d=e[c].key,h=n[d][r[d]];h<o&&(i=d,o=h)}if(a.mode==="threshold"&&o>=a.threshold||a.mode==="dendrogram"&&e.length===1)return!1;var f=t[i],p=t[r[i]],v;a.mode==="dendrogram"?v={left:f,right:p,key:f.key}:v={value:f.value.concat(p.value),key:f.key},e[f.index]=v,e.splice(p.index,1),t[f.key]=v;for(var m=0;m<e.length;m++){var g=e[m];f.key===g.key?u=1/0:a.linkage==="min"?(u=n[f.key][g.key],n[f.key][g.key]>n[p.key][g.key]&&(u=n[p.key][g.key])):a.linkage==="max"?(u=n[f.key][g.key],n[f.key][g.key]<n[p.key][g.key]&&(u=n[p.key][g.key])):a.linkage==="mean"?u=(n[f.key][g.key]*f.size+n[p.key][g.key]*p.size)/(f.size+p.size):a.mode==="dendrogram"?u=s(g.value,f.value):u=s(g.value[0],f.value[0]),n[f.key][g.key]=n[g.key][f.key]=u}for(var y=0;y<e.length;y++){var b=e[y].key;if(r[b]===f.key||r[b]===p.key){for(var w=b,k=0;k<e.length;k++){var C=e[k].key;n[b][C]<n[b][w]&&(w=C)}r[b]=w}e[y].index=y}return f.key=p.key=f.index=p.index=null,!0},qn=function(e,t,n){e&&(e.value?t.push(e.value):(e.left&&qn(e.left,t),e.right&&qn(e.right,t)))},So=function(e,t){if(!e)return"";if(e.left&&e.right){var n=So(e.left,t),r=So(e.right,t),a=t.add({group:"nodes",data:{id:n+","+r}});return t.add({group:"edges",data:{source:n,target:a.id()}}),t.add({group:"edges",data:{source:r,target:a.id()}}),a.id()}else if(e.value)return e.value.id()},Mo=function(e,t,n){if(!e)return[];var r=[],a=[],i=[];return t===0?(e.left&&qn(e.left,r),e.right&&qn(e.right,a),i=r.concat(a),[n.collection(i)]):t===1?e.value?[n.collection(e.value)]:(e.left&&qn(e.left,r),e.right&&qn(e.right,a),[n.collection(r),n.collection(a)]):e.value?[n.collection(e.value)]:(e.left&&(r=Mo(e.left,t-1,n)),e.right&&(a=Mo(e.right,t-1,n)),r.concat(a))},nl=function(e){for(var t=this.cy(),n=this.nodes(),r=yp(e),a=r.attributes,i=function(g,y){return Ia(r.distance,a.length,function(b){return a[b](g)},function(b){return a[b](y)},g,y)},o=[],u=[],l=[],s=[],c=0;c<n.length;c++){var d={value:r.mode==="dendrogram"?n[c]:[n[c]],key:c,index:c};o[c]=d,s[c]=d,u[c]=[],l[c]=0}for(var h=0;h<o.length;h++)for(var f=0;f<=h;f++){var p=void 0;r.mode==="dendrogram"?p=h===f?1/0:i(o[h].value,o[f].value):p=h===f?1/0:i(o[h].value[0],o[f].value[0]),u[h][f]=p,u[f][h]=p,p<u[h][l[h]]&&(l[h]=f)}for(var v=tl(o,s,u,l,r);v;)v=tl(o,s,u,l,r);var m;return r.mode==="dendrogram"?(m=Mo(o[0],r.dendrogramDepth,t),r.addDendrogram&&So(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},mp={hierarchicalClustering:nl,hca:nl},bp=ct({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),xp=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||qe("Damping must range on [0.5, 1). Got: ".concat(t));var r=["median","mean","min","max"];return r.some(function(a){return a===n})||ne(n)||qe("Preference must be one of [".concat(r.map(function(a){return"'".concat(a,"'")}).join(", "),"] or a number. Got: ").concat(n)),bp(e)},wp=function(e,t,n,r){var a=function(i,o){return r[o](i)};return-Ia(e,r.length,function(i){return a(t,i)},function(i){return a(n,i)},t,n)},Ep=function(e,t){var n=null;return t==="median"?n=xf(e):t==="mean"?n=bf(e):t==="min"?n=yf(e):t==="max"?n=mf(e):n=t,n},kp=function(e,t,n){for(var r=[],a=0;a<e;a++)t[a*e+a]+n[a*e+a]>0&&r.push(a);return r},rl=function(e,t,n){for(var r=[],a=0;a<e;a++){for(var i=-1,o=-1/0,u=0;u<n.length;u++){var l=n[u];t[a*e+l]>o&&(i=l,o=t[a*e+l])}i>0&&r.push(i)}for(var s=0;s<n.length;s++)r[n[s]]=n[s];return r},Tp=function(e,t,n){for(var r=rl(e,t,n),a=0;a<n.length;a++){for(var i=[],o=0;o<r.length;o++)r[o]===n[a]&&i.push(o);for(var u=-1,l=-1/0,s=0;s<i.length;s++){for(var c=0,d=0;d<i.length;d++)c+=t[i[d]*e+i[s]];c>l&&(u=s,l=c)}n[a]=i[u]}return r=rl(e,t,n),r},al=function(e){for(var t=this.cy(),n=this.nodes(),r=xp(e),a={},i=0;i<n.length;i++)a[n[i].id()]=i;var o,u,l,s,c,d;o=n.length,u=o*o,l=new Array(u);for(var h=0;h<u;h++)l[h]=-1/0;for(var f=0;f<o;f++)for(var p=0;p<o;p++)f!==p&&(l[f*o+p]=wp(r.distance,n[f],n[p],r.attributes));s=Ep(l,r.preference);for(var v=0;v<o;v++)l[v*o+v]=s;c=new Array(u);for(var m=0;m<u;m++)c[m]=0;d=new Array(u);for(var g=0;g<u;g++)d[g]=0;for(var y=new Array(o),b=new Array(o),w=new Array(o),k=0;k<o;k++)y[k]=0,b[k]=0,w[k]=0;for(var C=new Array(o*r.minIterations),x=0;x<C.length;x++)C[x]=0;var P;for(P=0;P<r.maxIterations;P++){for(var B=0;B<o;B++){for(var D=-1/0,_=-1/0,T=-1,S=0,A=0;A<o;A++)y[A]=c[B*o+A],S=d[B*o+A]+l[B*o+A],S>=D?(_=D,D=S,T=A):S>_&&(_=S);for(var N=0;N<o;N++)c[B*o+N]=(1-r.damping)*(l[B*o+N]-D)+r.damping*y[N];c[B*o+T]=(1-r.damping)*(l[B*o+T]-_)+r.damping*y[T]}for(var R=0;R<o;R++){for(var M=0,L=0;L<o;L++)y[L]=d[L*o+R],b[L]=Math.max(0,c[L*o+R]),M+=b[L];M-=b[R],b[R]=c[R*o+R],M+=b[R];for(var I=0;I<o;I++)d[I*o+R]=(1-r.damping)*Math.min(0,M-b[I])+r.damping*y[I];d[R*o+R]=(1-r.damping)*(M-b[R])+r.damping*y[R]}for(var j=0,F=0;F<o;F++){var Y=d[F*o+F]+c[F*o+F]>0?1:0;C[P%r.minIterations*o+F]=Y,j+=Y}if(j>0&&(P>=r.minIterations-1||P==r.maxIterations-1)){for(var W=0,Q=0;Q<o;Q++){w[Q]=0;for(var $=0;$<r.minIterations;$++)w[Q]+=C[$*o+Q];(w[Q]===0||w[Q]===r.minIterations)&&W++}if(W===o)break}}for(var Z=kp(o,c,d),J=Tp(o,l,Z),re={},V=0;V<Z.length;V++)re[Z[V]]=[];for(var O=0;O<n.length;O++){var z=a[n[O].id()],H=J[z];H!=null&&re[H].push(n[O])}for(var te=new Array(Z.length),ae=0;ae<Z.length;ae++)te[ae]=t.collection(re[Z[ae]]);return te},Cp={affinityPropagation:al,ap:al},Pp=ct({root:void 0,directed:!1}),_p={hierholzer:function(e){if(!De(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n=Pp(e),r=n.root,a=n.directed,i=this,o=!1,u,l,s;r&&(s=fe(r)?this.filter(r)[0].id():r[0].id());var c={},d={};a?i.forEach(function(g){var y=g.id();if(g.isNode()){var b=g.indegree(!0),w=g.outdegree(!0),k=b-w,C=w-b;k==1?u?o=!0:u=y:C==1?l?o=!0:l=y:(C>1||k>1)&&(o=!0),c[y]=[],g.outgoers().forEach(function(x){x.isEdge()&&c[y].push(x.id())})}else d[y]=[void 0,g.target().id()]}):i.forEach(function(g){var y=g.id();if(g.isNode()){var b=g.degree(!0);b%2&&(u?l?o=!0:l=y:u=y),c[y]=[],g.connectedEdges().forEach(function(w){return c[y].push(w.id())})}else d[y]=[g.source().id(),g.target().id()]});var h={found:!1,trail:void 0};if(o)return h;if(l&&u)if(a){if(s&&l!=s)return h;s=l}else{if(s&&l!=s&&u!=s)return h;s||(s=l)}else s||(s=i[0].id());var f=function(g){for(var y=g,b=[g],w,k,C;c[y].length;)w=c[y].shift(),k=d[w][0],C=d[w][1],y!=C?(c[C]=c[C].filter(function(x){return x!=w}),y=C):!a&&y!=k&&(c[k]=c[k].filter(function(x){return x!=w}),y=k),b.unshift(w),b.unshift(y);return b},p=[],v=[];for(v=f(s);v.length!=1;)c[v[0]].length==0?(p.unshift(i.getElementById(v.shift())),p.unshift(i.getElementById(v.shift()))):v=f(v.shift()).concat(v);p.unshift(i.getElementById(v.shift()));for(var m in c)if(c[m].length)return h;return h.found=!0,h.trail=this.spawn(p,!0),h}},Qr=function(){var e=this,t={},n=0,r=0,a=[],i=[],o={},u=function(c,d){for(var h=i.length-1,f=[],p=e.spawn();i[h].x!=c||i[h].y!=d;)f.push(i.pop().edge),h--;f.push(i.pop().edge),f.forEach(function(v){var m=v.connectedNodes().intersection(e);p.merge(v),m.forEach(function(g){var y=g.id(),b=g.connectedEdges().intersection(e);p.merge(g),t[y].cutVertex?p.merge(b.filter(function(w){return w.isLoop()})):p.merge(b)})}),a.push(p)},l=function(c,d,h){c===h&&(r+=1),t[d]={id:n,low:n++,cutVertex:!1};var f=e.getElementById(d).connectedEdges().intersection(e);if(f.size()===0)a.push(e.spawn(e.getElementById(d)));else{var p,v,m,g;f.forEach(function(y){p=y.source().id(),v=y.target().id(),m=p===d?v:p,m!==h&&(g=y.id(),o[g]||(o[g]=!0,i.push({x:d,y:m,edge:y})),m in t?t[d].low=Math.min(t[d].low,t[m].id):(l(c,m,d),t[d].low=Math.min(t[d].low,t[m].low),t[d].id<=t[m].low&&(t[d].cutVertex=!0,u(d,m))))})}};e.forEach(function(c){if(c.isNode()){var d=c.id();d in t||(r=0,l(d,d),t[d].cutVertex=r>1)}});var s=Object.keys(t).filter(function(c){return t[c].cutVertex}).map(function(c){return e.getElementById(c)});return{cut:e.spawn(s),components:a}},Bp={hopcroftTarjanBiconnected:Qr,htbc:Qr,htb:Qr,hopcroftTarjanBiconnectedComponents:Qr},$r=function(){var e=this,t={},n=0,r=[],a=[],i=e.spawn(e),o=function(u){a.push(u),t[u]={index:n,low:n++,explored:!1};var l=e.getElementById(u).connectedEdges().intersection(e);if(l.forEach(function(f){var p=f.target().id();p!==u&&(p in t||o(p),t[p].explored||(t[u].low=Math.min(t[u].low,t[p].low)))}),t[u].index===t[u].low){for(var s=e.spawn();;){var c=a.pop();if(s.merge(e.getElementById(c)),t[c].low=t[u].index,t[c].explored=!0,c===u)break}var d=s.edgesWith(s),h=s.merge(d);r.push(h),i=i.difference(h)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in t||o(l)}}),{cut:i,components:r}},Dp={tarjanStronglyConnected:$r,tsc:$r,tscc:$r,tarjanStronglyConnectedComponents:$r},Pc={};[kr,af,of,lf,cf,hf,gf,Yf,Gn,Hn,Ao,tp,pp,mp,Cp,_p,Bp,Dp].forEach(function(e){ge(Pc,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 _c=0,Bc=1,Dc=2,Lt=function(e){if(!(this instanceof Lt))return new Lt(e);this.id="Thenable/1.0.7",this.state=_c,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))};Lt.prototype={fulfill:function(e){return il(this,Bc,"fulfillValue",e)},reject:function(e){return il(this,Dc,"rejectReason",e)},then:function(e,t){var n=this,r=new Lt;return n.onFulfilled.push(sl(e,r,"fulfill")),n.onRejected.push(sl(t,r,"reject")),Ac(n),r.proxy}};var il=function(e,t,n,r){return e.state===_c&&(e.state=t,e[n]=r,Ac(e)),e},Ac=function(e){e.state===Bc?ol(e,"onFulfilled",e.fulfillValue):e.state===Dc&&ol(e,"onRejected",e.rejectReason)},ol=function(e,t,n){if(e[t].length!==0){var r=e[t];e[t]=[];var a=function(){for(var i=0;i<r.length;i++)r[i](n)};typeof setImmediate=="function"?setImmediate(a):setTimeout(a,0)}},sl=function(e,t,n){return function(r){if(typeof e!="function")t[n].call(t,r);else{var a;try{a=e(r)}catch(i){t.reject(i);return}Sc(t,a)}}},Sc=function(e,t){if(e===t||e.proxy===t){e.reject(new TypeError("cannot resolve promise with itself"));return}var n;if(tt(t)==="object"&&t!==null||typeof t=="function")try{n=t.then}catch(a){e.reject(a);return}if(typeof n=="function"){var r=!1;try{n.call(t,function(a){r||(r=!0,a===t?e.reject(new TypeError("circular thenable chain")):Sc(e,a))},function(a){r||(r=!0,e.reject(a))})}catch(a){r||e.reject(a)}return}e.fulfill(t)};Lt.all=function(e){return new Lt(function(t,n){for(var r=new Array(e.length),a=0,i=function(u,l){r[u]=l,a++,a===e.length&&t(r)},o=0;o<e.length;o++)(function(u){var l=e[u],s=l!=null&&l.then!=null;if(s)l.then(function(d){i(u,d)},function(d){n(d)});else{var c=l;i(u,c)}})(o)})};Lt.resolve=function(e){return new Lt(function(t,n){t(e)})};Lt.reject=function(e){return new Lt(function(t,n){n(e)})};var tr=typeof Promise<"u"?Promise:Lt,Ro=function(e,t,n){var r=Ho(e),a=!r,i=this._private=ge({duration:1e3},t,n);if(i.target=e,i.style=i.style||i.css,i.started=!1,i.playing=!1,i.hooked=!1,i.applying=!1,i.progress=0,i.completes=[],i.frames=[],i.complete&&Ue(i.complete)&&i.completes.push(i.complete),a){var o=e.position();i.startPosition=i.startPosition||{x:o.x,y:o.y},i.startStyle=i.startStyle||e.cy().style().getAnimationStartStyle(e,i.style)}if(r){var u=e.pan();i.startPan={x:u.x,y:u.y},i.startZoom=e.zoom()}this.length=1,this[0]=this},Bn=Ro.prototype;ge(Bn,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t,n=e.target._private.animation;e.queue?t=n.queue:t=n.current,t.push(this),Pt(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,n=t.playing;return e===void 0?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&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 n=function(u,l){var s=e[u];s!=null&&(e[u]=e[l],e[l]=s)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var r=0;r<e.style.length;r++){var a=e.style[r],i=a.name,o=e.startStyle[i];e.startStyle[i]=a,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t=this._private,n;switch(e){case"frame":n=t.frames;break;default:case"complete":case"completed":n=t.completes}return new tr(function(r,a){n.push(function(){r()})})}});Bn.complete=Bn.completed;Bn.run=Bn.play;Bn.running=Bn.playing;var Ap={animated:function(){return function(){var e=this,t=e.length!==void 0,n=t?e:[e],r=this._private.cy||this;if(!r.styleEnabled())return!1;var a=n[0];if(a)return a._private.animation.current.length>0}},clearQueue:function(){return function(){var e=this,t=e.length!==void 0,n=t?e:[e],r=this._private.cy||this;if(!r.styleEnabled())return this;for(var a=0;a<n.length;a++){var i=n[a];i._private.animation.queue=[]}return this}},delay:function(){return function(e,t){var n=this._private.cy||this;return n.styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){var n=this._private.cy||this;return n.styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=this,r=n.length!==void 0,a=r?n:[n],i=this._private.cy||this,o=!r,u=!o;if(!i.styleEnabled())return this;var l=i.style();e=ge({},e,t);var s=Object.keys(e).length===0;if(s)return new Ro(a[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(u&&(e.style=l.getPropsList(e.style||e.css),e.css=void 0),u&&e.renderedPosition!=null){var c=e.renderedPosition,d=i.pan(),h=i.zoom();e.position=vc(c,h,d)}if(o&&e.panBy!=null){var f=e.panBy,p=i.pan();e.pan={x:p.x+f.x,y:p.y+f.y}}var v=e.center||e.centre;if(o&&v!=null){var m=i.getCenterPan(v.eles,e.zoom);m!=null&&(e.pan=m)}if(o&&e.fit!=null){var g=e.fit,y=i.getFitViewport(g.eles||g.boundingBox,g.padding);y!=null&&(e.pan=y.pan,e.zoom=y.zoom)}if(o&&De(e.zoom)){var b=i.getZoomedViewport(e.zoom);b!=null?(b.zoomed&&(e.zoom=b.zoom),b.panned&&(e.pan=b.pan)):e.zoom=null}return new Ro(a[0],e)}},animate:function(){return function(e,t){var n=this,r=n.length!==void 0,a=r?n:[n],i=this._private.cy||this;if(!i.styleEnabled())return this;t&&(e=ge({},e,t));for(var o=0;o<a.length;o++){var u=a[o],l=u.animated()&&(e.queue===void 0||e.queue),s=u.animation(e,l?{queue:!0}:void 0);s.play()}return this}},stop:function(){return function(e,t){var n=this,r=n.length!==void 0,a=r?n:[n],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var o=0;o<a.length;o++){for(var u=a[o],l=u._private,s=l.animation.current,c=0;c<s.length;c++){var d=s[c],h=d._private;t&&(h.duration=0)}e&&(l.animation.queue=[]),t||(l.animation.current=[])}return i.notify("draw"),this}}},vi,ll;function La(){if(ll)return vi;ll=1;var e=Array.isArray;return vi=e,vi}var yi,ul;function Sp(){if(ul)return yi;ul=1;var e=La(),t=Lr(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function a(i,o){if(e(i))return!1;var u=typeof i;return u=="number"||u=="symbol"||u=="boolean"||i==null||t(i)?!0:r.test(i)||!n.test(i)||o!=null&&i in Object(o)}return yi=a,yi}var mi,cl;function Mp(){if(cl)return mi;cl=1;var e=sc(),t=Ir(),n="[object AsyncFunction]",r="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function o(u){if(!t(u))return!1;var l=e(u);return l==r||l==a||l==n||l==i}return mi=o,mi}var bi,dl;function Rp(){if(dl)return bi;dl=1;var e=Sa(),t=e["__core-js_shared__"];return bi=t,bi}var xi,hl;function Ip(){if(hl)return xi;hl=1;var e=Rp(),t=function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function n(r){return!!t&&t in r}return xi=n,xi}var wi,fl;function Lp(){if(fl)return wi;fl=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return wi=n,wi}var Ei,pl;function Np(){if(pl)return Ei;pl=1;var e=Mp(),t=Ip(),n=Ir(),r=Lp(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,l=o.toString,s=u.hasOwnProperty,c=RegExp("^"+l.call(s).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(h){if(!n(h)||t(h))return!1;var f=e(h)?c:i;return f.test(r(h))}return Ei=d,Ei}var ki,gl;function Op(){if(gl)return ki;gl=1;function e(t,n){return t==null?void 0:t[n]}return ki=e,ki}var Ti,vl;function is(){if(vl)return Ti;vl=1;var e=Np(),t=Op();function n(r,a){var i=t(r,a);return e(i)?i:void 0}return Ti=n,Ti}var Ci,yl;function Na(){if(yl)return Ci;yl=1;var e=is(),t=e(Object,"create");return Ci=t,Ci}var Pi,ml;function zp(){if(ml)return Pi;ml=1;var e=Na();function t(){this.__data__=e?e(null):{},this.size=0}return Pi=t,Pi}var _i,bl;function Vp(){if(bl)return _i;bl=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return _i=e,_i}var Bi,xl;function Fp(){if(xl)return Bi;xl=1;var e=Na(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function a(i){var o=this.__data__;if(e){var u=o[i];return u===t?void 0:u}return r.call(o,i)?o[i]:void 0}return Bi=a,Bi}var Di,wl;function Xp(){if(wl)return Di;wl=1;var e=Na(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return Di=r,Di}var Ai,El;function Yp(){if(El)return Ai;El=1;var e=Na(),t="__lodash_hash_undefined__";function n(r,a){var i=this.__data__;return this.size+=this.has(r)?0:1,i[r]=e&&a===void 0?t:a,this}return Ai=n,Ai}var Si,kl;function jp(){if(kl)return Si;kl=1;var e=zp(),t=Vp(),n=Fp(),r=Xp(),a=Yp();function i(o){var u=-1,l=o==null?0:o.length;for(this.clear();++u<l;){var s=o[u];this.set(s[0],s[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,Si=i,Si}var Mi,Tl;function qp(){if(Tl)return Mi;Tl=1;function e(){this.__data__=[],this.size=0}return Mi=e,Mi}var Ri,Cl;function Mc(){if(Cl)return Ri;Cl=1;function e(t,n){return t===n||t!==t&&n!==n}return Ri=e,Ri}var Ii,Pl;function Oa(){if(Pl)return Ii;Pl=1;var e=Mc();function t(n,r){for(var a=n.length;a--;)if(e(n[a][0],r))return a;return-1}return Ii=t,Ii}var Li,_l;function Up(){if(_l)return Li;_l=1;var e=Oa(),t=Array.prototype,n=t.splice;function r(a){var i=this.__data__,o=e(i,a);if(o<0)return!1;var u=i.length-1;return o==u?i.pop():n.call(i,o,1),--this.size,!0}return Li=r,Li}var Ni,Bl;function Wp(){if(Bl)return Ni;Bl=1;var e=Oa();function t(n){var r=this.__data__,a=e(r,n);return a<0?void 0:r[a][1]}return Ni=t,Ni}var Oi,Dl;function Gp(){if(Dl)return Oi;Dl=1;var e=Oa();function t(n){return e(this.__data__,n)>-1}return Oi=t,Oi}var zi,Al;function Hp(){if(Al)return zi;Al=1;var e=Oa();function t(n,r){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,r])):a[i][1]=r,this}return zi=t,zi}var Vi,Sl;function Kp(){if(Sl)return Vi;Sl=1;var e=qp(),t=Up(),n=Wp(),r=Gp(),a=Hp();function i(o){var u=-1,l=o==null?0:o.length;for(this.clear();++u<l;){var s=o[u];this.set(s[0],s[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,Vi=i,Vi}var Fi,Ml;function Zp(){if(Ml)return Fi;Ml=1;var e=is(),t=Sa(),n=e(t,"Map");return Fi=n,Fi}var Xi,Rl;function Qp(){if(Rl)return Xi;Rl=1;var e=jp(),t=Kp(),n=Zp();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Xi=r,Xi}var Yi,Il;function $p(){if(Il)return Yi;Il=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Yi=e,Yi}var ji,Ll;function za(){if(Ll)return ji;Ll=1;var e=$p();function t(n,r){var a=n.__data__;return e(r)?a[typeof r=="string"?"string":"hash"]:a.map}return ji=t,ji}var qi,Nl;function Jp(){if(Nl)return qi;Nl=1;var e=za();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return qi=t,qi}var Ui,Ol;function eg(){if(Ol)return Ui;Ol=1;var e=za();function t(n){return e(this,n).get(n)}return Ui=t,Ui}var Wi,zl;function tg(){if(zl)return Wi;zl=1;var e=za();function t(n){return e(this,n).has(n)}return Wi=t,Wi}var Gi,Vl;function ng(){if(Vl)return Gi;Vl=1;var e=za();function t(n,r){var a=e(this,n),i=a.size;return a.set(n,r),this.size+=a.size==i?0:1,this}return Gi=t,Gi}var Hi,Fl;function rg(){if(Fl)return Hi;Fl=1;var e=Qp(),t=Jp(),n=eg(),r=tg(),a=ng();function i(o){var u=-1,l=o==null?0:o.length;for(this.clear();++u<l;){var s=o[u];this.set(s[0],s[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,Hi=i,Hi}var Ki,Xl;function ag(){if(Xl)return Ki;Xl=1;var e=rg(),t="Expected a function";function n(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var i=function(){var o=arguments,u=a?a.apply(this,o):o[0],l=i.cache;if(l.has(u))return l.get(u);var s=r.apply(this,o);return i.cache=l.set(u,s)||l,s};return i.cache=new(n.Cache||e),i}return n.Cache=e,Ki=n,Ki}var Zi,Yl;function ig(){if(Yl)return Zi;Yl=1;var e=ag(),t=500;function n(r){var a=e(r,function(o){return i.size===t&&i.clear(),o}),i=a.cache;return a}return Zi=n,Zi}var Qi,jl;function Rc(){if(jl)return Qi;jl=1;var e=ig(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(t,function(o,u,l,s){i.push(l?s.replace(n,"$1"):u||o)}),i});return Qi=r,Qi}var $i,ql;function Ic(){if(ql)return $i;ql=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,i=Array(a);++r<a;)i[r]=n(t[r],r,t);return i}return $i=e,$i}var Ji,Ul;function og(){if(Ul)return Ji;Ul=1;var e=Zo(),t=Ic(),n=La(),r=Lr(),a=e?e.prototype:void 0,i=a?a.toString:void 0;function o(u){if(typeof u=="string")return u;if(n(u))return t(u,o)+"";if(r(u))return i?i.call(u):"";var l=u+"";return l=="0"&&1/u==-1/0?"-0":l}return Ji=o,Ji}var eo,Wl;function Lc(){if(Wl)return eo;Wl=1;var e=og();function t(n){return n==null?"":e(n)}return eo=t,eo}var to,Gl;function Nc(){if(Gl)return to;Gl=1;var e=La(),t=Sp(),n=Rc(),r=Lc();function a(i,o){return e(i)?i:t(i,o)?[i]:n(r(i))}return to=a,to}var no,Hl;function os(){if(Hl)return no;Hl=1;var e=Lr();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return no=t,no}var ro,Kl;function sg(){if(Kl)return ro;Kl=1;var e=Nc(),t=os();function n(r,a){a=e(a,r);for(var i=0,o=a.length;r!=null&&i<o;)r=r[t(a[i++])];return i&&i==o?r:void 0}return ro=n,ro}var ao,Zl;function lg(){if(Zl)return ao;Zl=1;var e=sg();function t(n,r,a){var i=n==null?void 0:e(n,r);return i===void 0?a:i}return ao=t,ao}var ug=lg(),cg=Rr(ug),io,Ql;function dg(){if(Ql)return io;Ql=1;var e=is(),t=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}}();return io=t,io}var oo,$l;function hg(){if($l)return oo;$l=1;var e=dg();function t(n,r,a){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return oo=t,oo}var so,Jl;function fg(){if(Jl)return so;Jl=1;var e=hg(),t=Mc(),n=Object.prototype,r=n.hasOwnProperty;function a(i,o,u){var l=i[o];(!(r.call(i,o)&&t(l,u))||u===void 0&&!(o in i))&&e(i,o,u)}return so=a,so}var lo,eu;function pg(){if(eu)return lo;eu=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,a){var i=typeof r;return a=a??e,!!a&&(i=="number"||i!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<a}return lo=n,lo}var uo,tu;function gg(){if(tu)return uo;tu=1;var e=fg(),t=Nc(),n=pg(),r=Ir(),a=os();function i(o,u,l,s){if(!r(o))return o;u=t(u,o);for(var c=-1,d=u.length,h=d-1,f=o;f!=null&&++c<d;){var p=a(u[c]),v=l;if(p==="__proto__"||p==="constructor"||p==="prototype")return o;if(c!=h){var m=f[p];v=s?s(m,p,f):void 0,v===void 0&&(v=r(m)?m:n(u[c+1])?[]:{})}e(f,p,v),f=f[p]}return o}return uo=i,uo}var co,nu;function vg(){if(nu)return co;nu=1;var e=gg();function t(n,r,a){return n==null?n:e(n,r,a)}return co=t,co}var yg=vg(),mg=Rr(yg),ho,ru;function bg(){if(ru)return ho;ru=1;function e(t,n){var r=-1,a=t.length;for(n||(n=Array(a));++r<a;)n[r]=t[r];return n}return ho=e,ho}var fo,au;function xg(){if(au)return fo;au=1;var e=Ic(),t=bg(),n=La(),r=Lr(),a=Rc(),i=os(),o=Lc();function u(l){return n(l)?e(l,i):r(l)?[l]:t(a(o(l)))}return fo=u,fo}var wg=xg(),Eg=Rr(wg),kg={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(n){},beforeSet:function(n,r){},onSet:function(n){},canSet:function(n){return!0}};return e=ge({},t,e),function(n,r){var a=e,i=this,o=i.length!==void 0,u=o?i:[i],l=o?i[0]:i;if(fe(n)){var s=n.indexOf(".")!==-1,c=s&&Eg(n);if(a.allowGetting&&r===void 0){var d;return l&&(a.beforeGet(l),c&&l._private[a.field][n]===void 0?d=cg(l._private[a.field],c):d=l._private[a.field][n]),d}else if(a.allowSetting&&r!==void 0){var h=!a.immutableKeys[n];if(h){var f=Qu({},n,r);a.beforeSet(i,f);for(var p=0,v=u.length;p<v;p++){var m=u[p];a.canSet(m)&&(c&&l._private[a.field][n]===void 0?mg(m._private[a.field],c,r):m._private[a.field][n]=r)}a.updateStyle&&i.updateStyle(),a.onSet(i),a.settingTriggersEvent&&i[a.triggerFnName](a.settingEvent)}}}else if(a.allowSetting&&De(n)){var g=n,y,b,w=Object.keys(g);a.beforeSet(i,g);for(var k=0;k<w.length;k++){y=w[k],b=g[y];var C=!a.immutableKeys[y];if(C)for(var x=0;x<u.length;x++){var P=u[x];a.canSet(P)&&(P._private[a.field][y]=b)}}a.updateStyle&&i.updateStyle(),a.onSet(i),a.settingTriggersEvent&&i[a.triggerFnName](a.settingEvent)}else if(a.allowBinding&&Ue(n)){var B=n;i.on(a.bindingEvent,B)}else if(a.allowGetting&&n===void 0){var D;return l&&(a.beforeGet(l),D=l._private[a.field]),D}return i}},removeData:function(e){var t={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=ge({},t,e),function(n){var r=e,a=this,i=a.length!==void 0,o=i?a:[a];if(fe(n)){for(var u=n.split(/\s+/),l=u.length,s=0;s<l;s++){var c=u[s];if(!sn(c)){var d=!r.immutableKeys[c];if(d)for(var h=0,f=o.length;h<f;h++)o[h]._private[r.field][c]=void 0}}r.triggerEvent&&a[r.triggerFnName](r.event)}else if(n===void 0){for(var p=0,v=o.length;p<v;p++)for(var m=o[p]._private[r.field],g=Object.keys(m),y=0;y<g.length;y++){var b=g[y],w=!r.immutableKeys[b];w&&(m[b]=void 0)}r.triggerEvent&&a[r.triggerFnName](r.event)}return a}}},Tg={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(n,r){var a=this,i=Array.prototype.slice.call(arguments,0);return new tr(function(o,u){var l=function(d){a.off.apply(a,c),o(d)},s=i.concat([l]),c=s.concat([]);a.on.apply(a,s)})}}},Le={};[Ap,kg,Tg].forEach(function(e){ge(Le,e)});var Cg={animate:Le.animate(),animation:Le.animation(),animated:Le.animated(),clearQueue:Le.clearQueue(),delay:Le.delay(),delayAnimation:Le.delayAnimation(),stop:Le.stop()},la={classes:function(e){var t=this;if(e===void 0){var n=[];return t[0]._private.classes.forEach(function(f){return n.push(f)}),n}else Ve(e)||(e=(e||"").match(/\S+/g)||[]);for(var r=[],a=new er(e),i=0;i<t.length;i++){for(var o=t[i],u=o._private,l=u.classes,s=!1,c=0;c<e.length;c++){var d=e[c],h=l.has(d);if(!h){s=!0;break}}s||(s=l.size!==e.length),s&&(u.classes=a,r.push(o))}return r.length>0&&this.spawn(r).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){Ve(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=t===void 0,a=[],i=0,o=n.length;i<o;i++)for(var u=n[i],l=u._private.classes,s=!1,c=0;c<e.length;c++){var d=e[c],h=l.has(d),f=!1;t||r&&!h?(l.add(d),f=!0):(!t||r&&h)&&(l.delete(d),f=!0),!s&&f&&(a.push(u),s=!0)}return a.length>0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(t==null)t=250;else if(t===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};la.className=la.classNames=la.classes;var Be={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:et,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Be.variable="(?:[\\w-.]|(?:\\\\"+Be.metaChar+"))+";Be.className="(?:[\\w-]|(?:\\\\"+Be.metaChar+"))+";Be.value=Be.string+"|"+Be.number;Be.id=Be.variable;(function(){var e,t,n;for(e=Be.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],Be.comparatorOp+="|@"+t;for(e=Be.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],!(t.indexOf("!")>=0)&&t!=="="&&(Be.comparatorOp+="|\\!"+t)})();var ze=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},Io=[{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 Eh(e.selector,t.selector)}),Pg=function(){for(var e={},t,n=0;n<Io.length;n++)t=Io[n],e[t.selector]=t.matches;return e}(),_g=function(e,t){return Pg[e](t)},Bg="("+Io.map(function(e){return e.selector}).join("|")+")",In=function(e){return e.replace(new RegExp("\\\\("+Be.metaChar+")","g"),function(t,n){return n})},Jt=function(e,t,n){e[e.length-1]=n},Lo=[{name:"group",query:!0,regex:"("+Be.group+")",populate:function(e,t,n){var r=$e(n,1),a=r[0];t.checks.push({type:se.GROUP,value:a==="*"?a:a+"s"})}},{name:"state",query:!0,regex:Bg,populate:function(e,t,n){var r=$e(n,1),a=r[0];t.checks.push({type:se.STATE,value:a})}},{name:"id",query:!0,regex:"\\#("+Be.id+")",populate:function(e,t,n){var r=$e(n,1),a=r[0];t.checks.push({type:se.ID,value:In(a)})}},{name:"className",query:!0,regex:"\\.("+Be.className+")",populate:function(e,t,n){var r=$e(n,1),a=r[0];t.checks.push({type:se.CLASS,value:In(a)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Be.variable+")\\s*\\]",populate:function(e,t,n){var r=$e(n,1),a=r[0];t.checks.push({type:se.DATA_EXIST,field:In(a)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Be.variable+")\\s*("+Be.comparatorOp+")\\s*("+Be.value+")\\s*\\]",populate:function(e,t,n){var r=$e(n,3),a=r[0],i=r[1],o=r[2],u=new RegExp("^"+Be.string+"$").exec(o)!=null;u?o=o.substring(1,o.length-1):o=parseFloat(o),t.checks.push({type:se.DATA_COMPARE,field:In(a),operator:i,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Be.boolOp+")\\s*("+Be.variable+")\\s*\\]",populate:function(e,t,n){var r=$e(n,2),a=r[0],i=r[1];t.checks.push({type:se.DATA_BOOL,field:In(i),operator:a})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Be.meta+")\\s*("+Be.comparatorOp+")\\s*("+Be.number+")\\s*\\]\\]",populate:function(e,t,n){var r=$e(n,3),a=r[0],i=r[1],o=r[2];t.checks.push({type:se.META_COMPARE,field:In(a),operator:i,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:Be.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,a=e.compoundCount,i=e[e.length-1];n!=null&&(i.subject=n,e.currentSubject=null),i.edgeCount=r,i.compoundCount=a,e.edgeCount=0,e.compoundCount=0;var o=e[e.length++]=ze();return o}},{name:"directedEdge",separator:!0,regex:Be.directedEdge,populate:function(e,t){if(e.currentSubject==null){var n=ze(),r=t,a=ze();return n.checks.push({type:se.DIRECTED_EDGE,source:r,target:a}),Jt(e,t,n),e.edgeCount++,a}else{var i=ze(),o=t,u=ze();return i.checks.push({type:se.NODE_SOURCE,source:o,target:u}),Jt(e,t,i),e.edgeCount++,u}}},{name:"undirectedEdge",separator:!0,regex:Be.undirectedEdge,populate:function(e,t){if(e.currentSubject==null){var n=ze(),r=t,a=ze();return n.checks.push({type:se.UNDIRECTED_EDGE,nodes:[r,a]}),Jt(e,t,n),e.edgeCount++,a}else{var i=ze(),o=t,u=ze();return i.checks.push({type:se.NODE_NEIGHBOR,node:o,neighbor:u}),Jt(e,t,i),u}}},{name:"child",separator:!0,regex:Be.child,populate:function(e,t){if(e.currentSubject==null){var n=ze(),r=ze(),a=e[e.length-1];return n.checks.push({type:se.CHILD,parent:a,child:r}),Jt(e,t,n),e.compoundCount++,r}else if(e.currentSubject===t){var i=ze(),o=e[e.length-1],u=ze(),l=ze(),s=ze(),c=ze();return i.checks.push({type:se.COMPOUND_SPLIT,left:o,right:u,subject:l}),l.checks=t.checks,t.checks=[{type:se.TRUE}],c.checks.push({type:se.TRUE}),u.checks.push({type:se.PARENT,parent:c,child:s}),Jt(e,o,i),e.currentSubject=l,e.compoundCount++,s}else{var d=ze(),h=ze(),f=[{type:se.PARENT,parent:d,child:h}];return d.checks=t.checks,t.checks=f,e.compoundCount++,h}}},{name:"descendant",separator:!0,regex:Be.descendant,populate:function(e,t){if(e.currentSubject==null){var n=ze(),r=ze(),a=e[e.length-1];return n.checks.push({type:se.DESCENDANT,ancestor:a,descendant:r}),Jt(e,t,n),e.compoundCount++,r}else if(e.currentSubject===t){var i=ze(),o=e[e.length-1],u=ze(),l=ze(),s=ze(),c=ze();return i.checks.push({type:se.COMPOUND_SPLIT,left:o,right:u,subject:l}),l.checks=t.checks,t.checks=[{type:se.TRUE}],c.checks.push({type:se.TRUE}),u.checks.push({type:se.ANCESTOR,ancestor:c,descendant:s}),Jt(e,o,i),e.currentSubject=l,e.compoundCount++,s}else{var d=ze(),h=ze(),f=[{type:se.ANCESTOR,ancestor:d,descendant:h}];return d.checks=t.checks,t.checks=f,e.compoundCount++,h}}},{name:"subject",modifier:!0,regex:Be.subject,populate:function(e,t){if(e.currentSubject!=null&&e.currentSubject!==t)return Ne("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1],r=n.checks[0],a=r==null?null:r.type;a===se.DIRECTED_EDGE?r.type=se.NODE_TARGET:a===se.UNDIRECTED_EDGE&&(r.type=se.NODE_NEIGHBOR,r.node=r.nodes[1],r.neighbor=r.nodes[0],r.nodes=null)}}];Lo.forEach(function(e){return e.regexObj=new RegExp("^"+e.regex)});var Dg=function(e){for(var t,n,r,a=0;a<Lo.length;a++){var i=Lo[a],o=i.name,u=e.match(i.regexObj);if(u!=null){n=u,t=i,r=o;var l=u[0];e=e.substring(l.length);break}}return{expr:t,match:n,name:r,remaining:e}},Ag=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},Sg=function(e){var t=this,n=t.inputText=e,r=t[0]=ze();for(t.length=1,n=Ag(n);;){var a=Dg(n);if(a.expr==null)return Ne("The selector `"+e+"`is invalid"),!1;var i=a.match.slice(1),o=a.expr.populate(t,r,i);if(o===!1)return!1;if(o!=null&&(r=o),n=a.remaining,n.match(/^\s*$/))break}var u=t[t.length-1];t.currentSubject!=null&&(u.subject=t.currentSubject),u.edgeCount=t.edgeCount,u.compoundCount=t.compoundCount;for(var l=0;l<t.length;l++){var s=t[l];if(s.compoundCount>0&&s.edgeCount>0)return Ne("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(s.edgeCount>1)return Ne("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;s.edgeCount===1&&Ne("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},Mg=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(l){return l??""},t=function(l){return fe(l)?'"'+l+'"':e(l)},n=function(l){return" "+l+" "},r=function(l,s){var c=l.type,d=l.value;switch(c){case se.GROUP:{var h=e(d);return h.substring(0,h.length-1)}case se.DATA_COMPARE:{var f=l.field,p=l.operator;return"["+f+n(e(p))+t(d)+"]"}case se.DATA_BOOL:{var v=l.operator,m=l.field;return"["+e(v)+m+"]"}case se.DATA_EXIST:{var g=l.field;return"["+g+"]"}case se.META_COMPARE:{var y=l.operator,b=l.field;return"[["+b+n(e(y))+t(d)+"]]"}case se.STATE:return d;case se.ID:return"#"+d;case se.CLASS:return"."+d;case se.PARENT:case se.CHILD:return a(l.parent,s)+n(">")+a(l.child,s);case se.ANCESTOR:case se.DESCENDANT:return a(l.ancestor,s)+" "+a(l.descendant,s);case se.COMPOUND_SPLIT:{var w=a(l.left,s),k=a(l.subject,s),C=a(l.right,s);return w+(w.length>0?" ":"")+k+C}case se.TRUE:return""}},a=function(l,s){return l.checks.reduce(function(c,d,h){return c+(s===l&&h===0?"$":"")+r(d,s)},"")},i="",o=0;o<this.length;o++){var u=this[o];i+=a(u,u.subject),this.length>1&&o<this.length-1&&(i+=", ")}return this.toStringCache=i,i},Rg={parse:Sg,toString:Mg},Oc=function(e,t,n){var r,a=fe(e),i=ne(e),o=fe(n),u,l,s=!1,c=!1,d=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),s=!0),(a||o||s)&&(u=!a&&!i?"":""+e,l=""+n),s&&(e=u=u.toLowerCase(),n=l=l.toLowerCase()),t){case"*=":r=u.indexOf(l)>=0;break;case"$=":r=u.indexOf(l,u.length-l.length)>=0;break;case"^=":r=u.indexOf(l)===0;break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e<n;break;case"<=":d=!0,r=e<=n;break;default:r=!1;break}return c&&(e!=null||!d)&&(r=!r),r},Ig=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},Lg=function(e){return e!==void 0},ss=function(e,t){return e.data(t)},Ng=function(e,t){return e[t]()},Ge=[],je=function(e,t){return e.checks.every(function(n){return Ge[n.type](n,t)})};Ge[se.GROUP]=function(e,t){var n=e.value;return n==="*"||n===t.group()};Ge[se.STATE]=function(e,t){var n=e.value;return _g(n,t)};Ge[se.ID]=function(e,t){var n=e.value;return t.id()===n};Ge[se.CLASS]=function(e,t){var n=e.value;return t.hasClass(n)};Ge[se.META_COMPARE]=function(e,t){var n=e.field,r=e.operator,a=e.value;return Oc(Ng(t,n),r,a)};Ge[se.DATA_COMPARE]=function(e,t){var n=e.field,r=e.operator,a=e.value;return Oc(ss(t,n),r,a)};Ge[se.DATA_BOOL]=function(e,t){var n=e.field,r=e.operator;return Ig(ss(t,n),r)};Ge[se.DATA_EXIST]=function(e,t){var n=e.field;return e.operator,Lg(ss(t,n))};Ge[se.UNDIRECTED_EDGE]=function(e,t){var n=e.nodes[0],r=e.nodes[1],a=t.source(),i=t.target();return je(n,a)&&je(r,i)||je(r,a)&&je(n,i)};Ge[se.NODE_NEIGHBOR]=function(e,t){return je(e.node,t)&&t.neighborhood().some(function(n){return n.isNode()&&je(e.neighbor,n)})};Ge[se.DIRECTED_EDGE]=function(e,t){return je(e.source,t.source())&&je(e.target,t.target())};Ge[se.NODE_SOURCE]=function(e,t){return je(e.source,t)&&t.outgoers().some(function(n){return n.isNode()&&je(e.target,n)})};Ge[se.NODE_TARGET]=function(e,t){return je(e.target,t)&&t.incomers().some(function(n){return n.isNode()&&je(e.source,n)})};Ge[se.CHILD]=function(e,t){return je(e.child,t)&&je(e.parent,t.parent())};Ge[se.PARENT]=function(e,t){return je(e.parent,t)&&t.children().some(function(n){return je(e.child,n)})};Ge[se.DESCENDANT]=function(e,t){return je(e.descendant,t)&&t.ancestors().some(function(n){return je(e.ancestor,n)})};Ge[se.ANCESTOR]=function(e,t){return je(e.ancestor,t)&&t.descendants().some(function(n){return je(e.descendant,n)})};Ge[se.COMPOUND_SPLIT]=function(e,t){return je(e.subject,t)&&je(e.left,t)&&je(e.right,t)};Ge[se.TRUE]=function(){return!0};Ge[se.COLLECTION]=function(e,t){var n=e.value;return n.has(t)};Ge[se.FILTER]=function(e,t){var n=e.value;return n(t)};var Og=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 n=function(r){for(var a=0;a<t.length;a++){var i=t[a];if(je(i,r))return!0}return!1};return t.text()==null&&(n=function(){return!0}),e.filter(n)},zg=function(e){for(var t=this,n=0;n<t.length;n++){var r=t[n];if(je(r,e))return!0}return!1},Vg={matches:zg,filter:Og},cn=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||fe(e)&&e.match(/^\s*$/)||(Pt(e)?this.addQuery({checks:[{type:se.COLLECTION,value:e.collection()}]}):Ue(e)?this.addQuery({checks:[{type:se.FILTER,value:e}]}):fe(e)?this.parse(e)||(this.invalid=!0):qe("A selector must be created from a string; found "))},dn=cn.prototype;[Rg,Vg].forEach(function(e){return ge(dn,e)});dn.text=function(){return this.inputText};dn.size=function(){return this.length};dn.eq=function(e){return this[e]};dn.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()};dn.addQuery=function(e){this[this.length++]=e};dn.selector=dn.toString;var an={allAre:function(e){var t=new cn(e);return this.every(function(n){return t.matches(n)})},is:function(e){var t=new cn(e);return this.some(function(n){return t.matches(n)})},some:function(e,t){for(var n=0;n<this.length;n++){var r=t?e.apply(t,[this[n],n,this]):e(this[n],n,this);if(r)return!0}return!1},every:function(e,t){for(var n=0;n<this.length;n++){var r=t?e.apply(t,[this[n],n,this]):e(this[n],n,this);if(!r)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length,n=e.length;return t!==n?!1:t===1?this[0]===e[0]:this.every(function(r){return e.hasElementWithId(r.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(n){return t.hasElementWithId(n.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(n){return t.hasElementWithId(n.id())})}};an.allAreNeighbours=an.allAreNeighbors;an.has=an.contains;an.equal=an.equals=an.same;var At=function(e,t){return function(n,r,a,i){var o=n,u=this,l;if(o==null?l="":Pt(o)&&o.length===1&&(l=o.id()),u.length===1&&l){var s=u[0]._private,c=s.traversalCache=s.traversalCache||{},d=c[t]=c[t]||[],h=Pn(l),f=d[h];return f||(d[h]=e.call(u,n,r,a,i))}else return e.call(u,n,r,a,i)}},$n={parent:function(e){var t=[];if(this.length===1){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var a=this[r],i=a._private.parent;i&&t.push(i)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var a=n[r];t.push(a)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n],a=r.parents();t=t||a,t=t.intersect(a)}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:At(function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n],a=r._private.children,i=0;i<a.length;i++)t.push(a[i]);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 n(r){for(var a=0;a<r.length;a++){var i=r[a];t.push(i),i.children().nonempty()&&n(i.children())}}return n(this.children()),this.spawn(t,!0).filter(e)}};function ls(e,t,n,r){for(var a=[],i=new er,o=e.cy(),u=o.hasCompoundNodes(),l=0;l<e.length;l++){var s=e[l];n?a.push(s):u&&r(a,i,s)}for(;a.length>0;){var c=a.shift();t(c),i.add(c.id()),u&&r(a,i,c)}return e}function zc(e,t,n){if(n.isParent())for(var r=n._private.children,a=0;a<r.length;a++){var i=r[a];t.has(i.id())||e.push(i)}}$n.forEachDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ls(this,e,t,zc)};function Vc(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}$n.forEachUp=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ls(this,e,t,Vc)};function Fg(e,t,n){Vc(e,t,n),zc(e,t,n)}$n.forEachUpAndDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ls(this,e,t,Fg)};$n.ancestors=$n.parents;var Pr,Fc;Pr=Fc={data:Le.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:Le.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Le.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Le.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Le.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Le.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};Pr.attr=Pr.data;Pr.removeAttr=Pr.removeData;var Xg=Fc,Va={};function po(e){return function(t){var n=this;if(t===void 0&&(t=!0),n.length!==0)if(n.isNode()&&!n.removed()){for(var r=0,a=n[0],i=a._private.edges,o=0;o<i.length;o++){var u=i[o];!t&&u.isLoop()||(r+=e(a,u))}return r}else return}}ge(Va,{degree:po(function(e,t){return t.source().same(t.target())?2:1}),indegree:po(function(e,t){return t.target().same(e)?1:0}),outdegree:po(function(e,t){return t.source().same(e)?1:0})});function Ln(e,t){return function(n){for(var r,a=this.nodes(),i=0;i<a.length;i++){var o=a[i],u=o[e](n);u!==void 0&&(r===void 0||t(u,r))&&(r=u)}return r}}ge(Va,{minDegree:Ln("degree",function(e,t){return e<t}),maxDegree:Ln("degree",function(e,t){return e>t}),minIndegree:Ln("indegree",function(e,t){return e<t}),maxIndegree:Ln("indegree",function(e,t){return e>t}),minOutdegree:Ln("outdegree",function(e,t){return e<t}),maxOutdegree:Ln("outdegree",function(e,t){return e>t})});ge(Va,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var It,Xc,Yc=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(!a.locked()){var i=a._private.position,o={x:t.x!=null?t.x-i.x:0,y:t.y!=null?t.y-i.y:0};a.isParent()&&!(o.x===0&&o.y===0)&&a.children().shift(o,n),a.dirtyBoundingBoxCache()}}},iu={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){Yc(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};It=Xc={position:Le.data(iu),silentPosition:Le.data(ge({},iu,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){Yc(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(De(e))t?this.silentPosition(e):this.position(e);else if(Ue(e)){var n=e,r=this.cy();r.startBatch();for(var a=0;a<this.length;a++){var i=this[a],o=void 0;(o=n(i,a))&&(t?i.silentPosition(o):i.position(o))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(De(e)?(r={x:ne(e.x)?e.x:0,y:ne(e.y)?e.y:0},n=t):fe(e)&&ne(t)&&(r={x:0,y:0},r[e]=t),r!=null){var a=this.cy();a.startBatch();for(var i=0;i<this.length;i++){var o=this[i];if(!(a.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var u=o.position(),l={x:u.x+r.x,y:u.y+r.y};n?o.silentPosition(l):o.position(l)}}a.endBatch()}return this},silentShift:function(e,t){return De(e)?this.shift(e,!0):fe(e)&&ne(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),a=r.zoom(),i=r.pan(),o=De(e)?e:void 0,u=o!==void 0||t!==void 0&&fe(e);if(n&&n.isNode())if(u)for(var l=0;l<this.length;l++){var s=this[l];t!==void 0?s.position(e,(t-i[e])/a):o!==void 0&&s.position(vc(o,a,i))}else{var c=n.position();return o=Ra(c,a,i),e===void 0?o:o[e]}else if(!u)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),a=De(e)?e:void 0,i=a!==void 0||t!==void 0&&fe(e),o=r.hasCompoundNodes();if(n&&n.isNode())if(i)for(var u=0;u<this.length;u++){var l=this[u],s=o?l.parent():null,c=s&&s.length>0,d=c;c&&(s=s[0]);var h=d?s.position():{x:0,y:0};t!==void 0?l.position(e,t+h[e]):a!==void 0&&l.position({x:a.x+h.x,y:a.y+h.y})}else{var f=n.position(),p=o?n.parent():null,v=p&&p.length>0,m=v;v&&(p=p[0]);var g=m?p.position():{x:0,y:0};return a={x:f.x-g.x,y:f.y-g.y},e===void 0?a:a[e]}else if(!i)return;return this}};It.modelPosition=It.point=It.position;It.modelPositions=It.points=It.positions;It.renderedPoint=It.renderedPosition;It.relativePoint=It.relativePosition;var Yg=Xc,Kn,gn;Kn=gn={};gn.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),a=n.pan(),i=t.x1*r+a.x,o=t.x2*r+a.x,u=t.y1*r+a.y,l=t.y2*r+a.y;return{x1:i,x2:o,y1:u,y2:l,w:o-i,h:l-u}};gn.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(n){if(n.isParent()){var r=n._private;r.compoundBoundsClean=!1,r.bbCache=null,e||n.emitAndNotify("bounds")}}),this)};gn.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 n(o){if(!o.isParent())return;var u=o._private,l=o.children(),s=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")}},d=l.boundingBox({includeLabels:s,includeOverlays:!1,useCache:!1}),h=u.position;(d.w===0||d.h===0)&&(d={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},d.x1=h.x-d.w/2,d.x2=h.x+d.w/2,d.y1=h.y-d.h/2,d.y2=h.y+d.h/2);function f(B,D,_){var T=0,S=0,A=D+_;return B>0&&A>0&&(T=D/A*B,S=_/A*B),{biasDiff:T,biasComplementDiff:S}}function p(B,D,_,T){if(_.units==="%")switch(T){case"width":return B>0?_.pfValue*B:0;case"height":return D>0?_.pfValue*D:0;case"average":return B>0&&D>0?_.pfValue*(B+D)/2:0;case"min":return B>0&&D>0?B>D?_.pfValue*D:_.pfValue*B:0;case"max":return B>0&&D>0?B>D?_.pfValue*B:_.pfValue*D:0;default:return 0}else return _.units==="px"?_.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 b=f(c.width.val-d.w,v,m),w=b.biasDiff,k=b.biasComplementDiff,C=f(c.height.val-d.h,g,y),x=C.biasDiff,P=C.biasComplementDiff;u.autoPadding=p(d.w,d.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),u.autoWidth=Math.max(d.w,c.width.val),h.x=(-w+d.x1+d.x2+k)/2,u.autoHeight=Math.max(d.h,c.height.val),h.y=(-x+d.y1+d.y2+P)/2}for(var r=0;r<this.length;r++){var a=this[r],i=a._private;(!i.compoundBoundsClean||e)&&(n(a),t.batching()||(i.compoundBoundsClean=!0))}return this};var Dt=function(e){return e===1/0||e===-1/0?0:e},Rt=function(e,t,n,r,a){r-t===0||a-n===0||t==null||n==null||r==null||a==null||(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=a>e.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},en=function(e,t){return t==null?e:Rt(e,t.x1,t.y1,t.x2,t.y2)},ur=function(e,t,n){return kt(e,t,n)},Jr=function(e,t,n){if(!t.cy().headless()){var r=t._private,a=r.rstyle,i=a.arrowWidth/2,o=t.pstyle(n+"-arrow-shape").value,u,l;if(o!=="none"){n==="source"?(u=a.srcX,l=a.srcY):n==="target"?(u=a.tgtX,l=a.tgtY):(u=a.midX,l=a.midY);var s=r.arrowBounds=r.arrowBounds||{},c=s[n]=s[n]||{};c.x1=u-i,c.y1=l-i,c.x2=u+i,c.y2=l+i,c.w=c.x2-c.x1,c.h=c.y2-c.y1,oa(c,1),Rt(e,c.x1,c.y1,c.x2,c.y2)}}},go=function(e,t,n){if(!t.cy().headless()){var r;n?r=n+"-":r="";var a=t._private,i=a.rstyle,o=t.pstyle(r+"label").strValue;if(o){var u=t.pstyle("text-halign"),l=t.pstyle("text-valign"),s=ur(i,"labelWidth",n),c=ur(i,"labelHeight",n),d=ur(i,"labelX",n),h=ur(i,"labelY",n),f=t.pstyle(r+"text-margin-x").pfValue,p=t.pstyle(r+"text-margin-y").pfValue,v=t.isEdge(),m=t.pstyle(r+"text-rotation"),g=t.pstyle("text-outline-width").pfValue,y=t.pstyle("text-border-width").pfValue,b=y/2,w=t.pstyle("text-background-padding").pfValue,k=2,C=c,x=s,P=x/2,B=C/2,D,_,T,S;if(v)D=d-P,_=d+P,T=h-B,S=h+B;else{switch(u.value){case"left":D=d-x,_=d;break;case"center":D=d-P,_=d+P;break;case"right":D=d,_=d+x;break}switch(l.value){case"top":T=h-C,S=h;break;case"center":T=h-B,S=h+B;break;case"bottom":T=h,S=h+C;break}}var A=f-Math.max(g,b)-w-k,N=f+Math.max(g,b)+w+k,R=p-Math.max(g,b)-w-k,M=p+Math.max(g,b)+w+k;D+=A,_+=N,T+=R,S+=M;var L=n||"main",I=a.labelBounds,j=I[L]=I[L]||{};j.x1=D,j.y1=T,j.x2=_,j.y2=S,j.w=_-D,j.h=S-T,j.leftPad=A,j.rightPad=N,j.topPad=R,j.botPad=M;var F=v&&m.strValue==="autorotate",Y=m.pfValue!=null&&m.pfValue!==0;if(F||Y){var W=F?ur(a.rstyle,"labelAngle",n):m.pfValue,Q=Math.cos(W),$=Math.sin(W),Z=(D+_)/2,J=(T+S)/2;if(!v){switch(u.value){case"left":Z=_;break;case"right":Z=D;break}switch(l.value){case"top":J=S;break;case"bottom":J=T;break}}var re=function(we,ye){return we=we-Z,ye=ye-J,{x:we*Q-ye*$+Z,y:we*$+ye*Q+J}},V=re(D,T),O=re(D,S),z=re(_,T),H=re(_,S);D=Math.min(V.x,O.x,z.x,H.x),_=Math.max(V.x,O.x,z.x,H.x),T=Math.min(V.y,O.y,z.y,H.y),S=Math.max(V.y,O.y,z.y,H.y)}var te=L+"Rot",ae=I[te]=I[te]||{};ae.x1=D,ae.y1=T,ae.x2=_,ae.y2=S,ae.w=_-D,ae.h=S-T,Rt(e,D,T,_,S),Rt(a.labelBounds.all,D,T,_,S)}return e}},ou=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value,a=t.pstyle("outline-offset").value,i=r+a;jc(e,t,n,i,"outside",i/2)}},jc=function(e,t,n,r,a,i){if(!(n===0||r<=0||a==="inside")){var o=t.cy(),u=t.pstyle("shape").value,l=o.renderer().nodeShapes[u],s=t.position(),c=s.x,d=s.y,h=t.width(),f=t.height();if(l.hasMiterBounds){a==="center"&&(r/=2);var p=l.miterBounds(c,d,h,f,r);en(e,p)}else i!=null&&i>0&&sa(e,[i,i,i,i])}},jg=function(e,t){if(!t.cy().headless()){var n=t.pstyle("border-opacity").value,r=t.pstyle("border-width").pfValue,a=t.pstyle("border-position").value;jc(e,t,n,r,a)}},qg=function(e,t){var n=e._private.cy,r=n.styleEnabled(),a=n.headless(),i=bt(),o=e._private,u=e.isNode(),l=e.isEdge(),s,c,d,h,f,p,v=o.rstyle,m=u&&r?e.pstyle("bounds-expansion").pfValue:[0],g=function(ae){return ae.pstyle("display").value!=="none"},y=!r||g(e)&&(!l||g(e.source())&&g(e.target()));if(y){var b=0,w=0;r&&t.includeOverlays&&(b=e.pstyle("overlay-opacity").value,b!==0&&(w=e.pstyle("overlay-padding").value));var k=0,C=0;r&&t.includeUnderlays&&(k=e.pstyle("underlay-opacity").value,k!==0&&(C=e.pstyle("underlay-padding").value));var x=Math.max(w,C),P=0,B=0;if(r&&(P=e.pstyle("width").pfValue,B=P/2),u&&t.includeNodes){var D=e.position();f=D.x,p=D.y;var _=e.outerWidth(),T=_/2,S=e.outerHeight(),A=S/2;s=f-T,c=f+T,d=p-A,h=p+A,Rt(i,s,d,c,h),r&&ou(i,e),r&&t.includeOutlines&&!a&&ou(i,e),r&&jg(i,e)}else if(l&&t.includeEdges)if(r&&!a){var N=e.pstyle("curve-style").strValue;if(s=Math.min(v.srcX,v.midX,v.tgtX),c=Math.max(v.srcX,v.midX,v.tgtX),d=Math.min(v.srcY,v.midY,v.tgtY),h=Math.max(v.srcY,v.midY,v.tgtY),s-=B,c+=B,d-=B,h+=B,Rt(i,s,d,c,h),N==="haystack"){var R=v.haystackPts;if(R&&R.length===2){if(s=R[0].x,d=R[0].y,c=R[1].x,h=R[1].y,s>c){var M=s;s=c,c=M}if(d>h){var L=d;d=h,h=L}Rt(i,s-B,d-B,c+B,h+B)}}else if(N==="bezier"||N==="unbundled-bezier"||tn(N,"segments")||tn(N,"taxi")){var I;switch(N){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 j=0;j<I.length;j++){var F=I[j];s=F.x-B,c=F.x+B,d=F.y-B,h=F.y+B,Rt(i,s,d,c,h)}}}else{var Y=e.source(),W=Y.position(),Q=e.target(),$=Q.position();if(s=W.x,c=$.x,d=W.y,h=$.y,s>c){var Z=s;s=c,c=Z}if(d>h){var J=d;d=h,h=J}s-=B,c+=B,d-=B,h+=B,Rt(i,s,d,c,h)}if(r&&t.includeEdges&&l&&(Jr(i,e,"mid-source"),Jr(i,e,"mid-target"),Jr(i,e,"source"),Jr(i,e,"target")),r){var re=e.pstyle("ghost").value==="yes";if(re){var V=e.pstyle("ghost-offset-x").pfValue,O=e.pstyle("ghost-offset-y").pfValue;Rt(i,i.x1+V,i.y1+O,i.x2+V,i.y2+O)}}var z=o.bodyBounds=o.bodyBounds||{};Us(z,i),sa(z,m),oa(z,1),r&&(s=i.x1,c=i.x2,d=i.y1,h=i.y2,Rt(i,s-x,d-x,c+x,h+x));var H=o.overlayBounds=o.overlayBounds||{};Us(H,i),sa(H,m),oa(H,1);var te=o.labelBounds=o.labelBounds||{};te.all!=null?Cf(te.all):te.all=bt(),r&&t.includeLabels&&(t.includeMainLabels&&go(i,e,null),l&&(t.includeSourceLabels&&go(i,e,"source"),t.includeTargetLabels&&go(i,e,"target")))}return i.x1=Dt(i.x1),i.y1=Dt(i.y1),i.x2=Dt(i.x2),i.y2=Dt(i.y2),i.w=Dt(i.x2-i.x1),i.h=Dt(i.y2-i.y1),i.w>0&&i.h>0&&y&&(sa(i,m),oa(i,1)),i},qc=function(e){var t=0,n=function(a){return(a?1:0)<<t++},r=0;return r+=n(e.incudeNodes),r+=n(e.includeEdges),r+=n(e.includeLabels),r+=n(e.includeMainLabels),r+=n(e.includeSourceLabels),r+=n(e.includeTargetLabels),r+=n(e.includeOverlays),r+=n(e.includeOutlines),r},Uc=function(e){var t=function(i){return Math.round(i)};if(e.isEdge()){var n=e.source().position(),r=e.target().position();return zs([t(n.x),t(n.y),t(r.x),t(r.y)])}else{var a=e.position();return zs([t(a.x),t(a.y)])}},su=function(e,t){var n=e._private,r,a=e.isEdge(),i=t==null?lu:qc(t),o=i===lu;if(n.bbCache==null?(r=qg(e,_r),n.bbCache=r,n.bbCachePosKey=Uc(e)):r=n.bbCache,!o){var u=e.isNode();r=bt(),(t.includeNodes&&u||t.includeEdges&&!u)&&(t.includeOverlays?en(r,n.overlayBounds):en(r,n.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!a||t.includeSourceLabels&&t.includeTargetLabels)?en(r,n.labelBounds.all):(t.includeMainLabels&&en(r,n.labelBounds.mainRot),t.includeSourceLabels&&en(r,n.labelBounds.sourceRot),t.includeTargetLabels&&en(r,n.labelBounds.targetRot))),r.w=r.x2-r.x1,r.h=r.y2-r.y1}return r},_r={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},lu=qc(_r),uu=ct(_r);gn.boundingBox=function(e){var t,n=e===void 0||e.useCache===void 0||e.useCache===!0,r=Zn(function(c){var d=c._private;return d.bbCache==null||d.styleDirty||d.bbCachePosKey!==Uc(c)},function(c){return c.id()});if(n&&this.length===1&&!r(this[0]))e===void 0?e=_r:e=uu(e),t=su(this[0],e);else{t=bt(),e=e||_r;var a=uu(e),i=this,o=i.cy(),u=o.styleEnabled();this.edges().forEach(r),this.nodes().forEach(r),u&&this.recalculateRenderedStyle(n),this.updateCompoundBounds(!n);for(var l=0;l<i.length;l++){var s=i[l];r(s)&&s.dirtyBoundingBoxCache(),en(t,su(s,a))}}return t.x1=Dt(t.x1),t.y1=Dt(t.y1),t.x2=Dt(t.x2),t.y2=Dt(t.y2),t.w=Dt(t.x2-t.x1),t.h=Dt(t.y2-t.y1),t};gn.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};gn.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),a=n.collection();if(r&&(a=t.filter(function(s){return s.isParent()}),t=t.not(a)),De(e)){var i=e;e=function(){return i}}var o=function(s,c){return s._private.bbAtOldPos=e(s,c)},u=function(s){return s._private.bbAtOldPos};n.startBatch(),t.forEach(o).silentPositions(e),r&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var l=Tf(this.boundingBox({useCache:!1}));return t.silentPositions(u),r&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),n.endBatch(),l};Kn.boundingbox=Kn.bb=Kn.boundingBox;Kn.renderedBoundingbox=Kn.renderedBoundingBox;var Ug=gn,vr,zr;vr=zr={};var Wc=function(e){e.uppercaseName=ks(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=ks(e.outerName),vr[e.name]=function(){var t=this[0],n=t._private,r=n.cy,a=r._private.styleEnabled;if(t)if(a){if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var i=t.pstyle(e.name);switch(i.strValue){case"label":return t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return i.pfValue}}else return 1},vr["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private,r=n.cy,a=r._private.styleEnabled;if(t)if(a){var i=t[e.name](),o=t.pstyle("border-position").value,u;o==="center"?u=t.pstyle("border-width").pfValue:o==="outside"?u=2*t.pstyle("border-width").pfValue:u=0;var l=2*t.padding();return i+u+l}else return 1},vr["rendered"+e.uppercaseName]=function(){var t=this[0];if(t){var n=t[e.name]();return n*this.cy().zoom()}},vr["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t){var n=t[e.outerName]();return n*this.cy().zoom()}}};Wc({name:"width"});Wc({name:"height"});zr.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};zr.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()};zr.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var Wg=zr,Gg=function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)},Hg=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return Ra(t(e),n.zoom(),n.pan())}},Kg=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),r=n.pan(),a=n.zoom();return t(e).map(function(i){return Ra(i,a,r)})}},Zg=function(e){return e.renderer().getControlPoints(e)},Qg=function(e){return e.renderer().getSegmentPoints(e)},$g=function(e){return e.renderer().getSourceEndpoint(e)},Jg=function(e){return e.renderer().getTargetEndpoint(e)},ev=function(e){return e.renderer().getEdgeMidpoint(e)},cu={controlPoints:{get:Zg,mult:!0},segmentPoints:{get:Qg,mult:!0},sourceEndpoint:{get:$g},targetEndpoint:{get:Jg},midpoint:{get:ev}},tv=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},nv=Object.keys(cu).reduce(function(e,t){var n=cu[t],r=tv(t);return e[t]=function(){return Gg(this,n.get)},n.mult?e[r]=function(){return Kg(this,n.get)}:e[r]=function(){return Hg(this,n.get)},e},{}),rv=ge({},Yg,Ug,Wg,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 Gc=function(e,t){this.recycle(e,t)};function cr(){return!1}function ea(){return!0}Gc.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=cr,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?ea:cr):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 n=this.position,r=this.cy.zoom(),a=this.cy.pan();this.renderedPosition={x:n.x*r+a.x,y:n.y*r+a.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=ea;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=ea;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ea,this.stopPropagation()},isDefaultPrevented:cr,isPropagationStopped:cr,isImmediatePropagationStopped:cr};var Hc=/^([^.]+)(\.(?:[^.]+))?$/,av=".*",Kc={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},du=Object.keys(Kc),iv={};function Fa(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:iv,t=arguments.length>1?arguments[1]:void 0,n=0;n<du.length;n++){var r=du[n];this[r]=e[r]||Kc[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var hn=Fa.prototype,Zc=function(e,t,n,r,a,i,o){Ue(r)&&(a=r,r=null),o&&(i==null?i=o:i=ge({},i,o));for(var u=Ve(n)?n:n.split(/\s+/),l=0;l<u.length;l++){var s=u[l];if(!sn(s)){var c=s.match(Hc);if(c){var d=c[1],h=c[2]?c[2]:null,f=t(e,s,d,h,r,a,i);if(f===!1)break}}}},hu=function(e,t){return e.addEventFields(e.context,t),new Gc(t.type,t)},ov=function(e,t,n){if(dh(n)){t(e,n);return}else if(De(n)){t(e,hu(e,n));return}for(var r=Ve(n)?n:n.split(/\s+/),a=0;a<r.length;a++){var i=r[a];if(!sn(i)){var o=i.match(Hc);if(o){var u=o[1],l=o[2]?o[2]:null,s=hu(e,{type:u,namespace:l,target:e.context});t(e,s)}}}};hn.on=hn.addListener=function(e,t,n,r,a){return Zc(this,function(i,o,u,l,s,c,d){Ue(c)&&i.listeners.push({event:o,callback:c,type:u,namespace:l,qualifier:s,conf:d})},e,t,n,r,a),this};hn.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})};hn.removeListener=hn.off=function(e,t,n,r){var a=this;this.emitting!==0&&(this.listeners=Gh(this.listeners));for(var i=this.listeners,o=function(l){var s=i[l];Zc(a,function(c,d,h,f,p,v){if((s.type===h||e==="*")&&(!f&&s.namespace!==".*"||s.namespace===f)&&(!p||c.qualifierCompare(s.qualifier,p))&&(!v||s.callback===v))return i.splice(l,1),!1},e,t,n,r)},u=i.length-1;u>=0;u--)o(u);return this};hn.removeAllListeners=function(){return this.removeListener("*")};hn.emit=hn.trigger=function(e,t,n){var r=this.listeners,a=r.length;return this.emitting++,Ve(t)||(t=[t]),ov(this,function(i,o){n!=null&&(r=[{event:o.event,type:o.type,namespace:o.namespace,callback:n}],a=r.length);for(var u=function(){var s=r[l];if(s.type===o.type&&(!s.namespace||s.namespace===o.namespace||s.namespace===av)&&i.eventMatches(i.context,s,o)){var c=[o];t!=null&&Kh(c,t),i.beforeEmit(i.context,s,o),s.conf&&s.conf.one&&(i.listeners=i.listeners.filter(function(f){return f!==s}));var d=i.callbackContext(i.context,s,o),h=s.callback.apply(d,c);i.afterEmit(i.context,s,o),h===!1&&(o.stopPropagation(),o.preventDefault())}},l=0;l<a;l++)u();i.bubble(i.context)&&!o.isPropagationStopped()&&i.parent(i.context).emit(o,t)},e),this.emitting--,this};var sv={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r!=null?e!==n.target&&Mr(n.target)&&r.matches(n.target):!0},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.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()}},ta=function(e){return fe(e)?new cn(e):e},Qc={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new Fa(sv,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=ta(t),a=0;a<this.length;a++){var i=this[a];i.emitter().on(e,r,n)}return this},removeListener:function(e,t,n){for(var r=ta(t),a=0;a<this.length;a++){var i=this[a];i.emitter().removeListener(e,r,n)}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,n){for(var r=ta(t),a=0;a<this.length;a++){var i=this[a];i.emitter().one(e,r,n)}return this},once:function(e,t,n){for(var r=ta(t),a=0;a<this.length;a++){var i=this[a];i.emitter().on(e,r,n,{once:!0,onceCollection:this})}},emit:function(e,t){for(var n=0;n<this.length;n++){var r=this[n];r.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}};Le.eventAliasesOn(Qc);var $c={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(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.push(r):t.push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(e===void 0)return this;if(fe(e)||Pt(e))return new cn(e).filter(this);if(Ue(e)){for(var n=this.spawn(),r=this,a=0;a<r.length;a++){var i=r[a],o=t?e.apply(t,[i,a,r]):e(i,a,r);o&&n.push(i)}return n}return this.spawn()},not:function(e){if(e){fe(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n],a=e.has(r);a||t.push(r)}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 n=this.spawn(),r=this,a=e,i=this.length<e.length,o=i?r:a,u=i?a:r,l=0;l<o.length;l++){var s=o[l];u.has(s)&&n.push(s)}return n},xor:function(e){var t=this._private.cy;fe(e)&&(e=t.$(e));var n=this.spawn(),r=this,a=e,i=function(o,u){for(var l=0;l<o.length;l++){var s=o[l],c=s._private.data.id,d=u.hasElementWithId(c);d||n.push(s)}};return i(r,a),i(a,r),n},diff:function(e){var t=this._private.cy;fe(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),a=this.spawn(),i=this,o=e,u=function(l,s,c){for(var d=0;d<l.length;d++){var h=l[d],f=h._private.data.id,p=s.hasElementWithId(f);p?a.merge(h):c.push(h)}};return u(i,o,n),u(o,i,r),{left:n,right:r,both:a}},add:function(e){var t=this._private.cy;if(!e)return this;if(fe(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),a=0;a<e.length;a++){var i=e[a],o=!this.has(i);o&&r.push(i)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&fe(e)){var r=e;e=n.mutableElements().filter(r)}for(var a=t.map,i=0;i<e.length;i++){var o=e[i],u=o._private.data.id,l=!a.has(u);if(l){var s=this.length++;this[s]=o,a.set(u,{ele:o,index:s})}}return this},unmergeAt:function(e){var t=this[e],n=t.id(),r=this._private,a=r.map;this[e]=void 0,a.delete(n);var i=e===this.length-1;if(this.length>1&&!i){var o=this.length-1,u=this[o],l=u._private.data.id;this[o]=void 0,this[e]=u,a.set(l,{ele:u,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map,a=r.get(n);if(!a)return this;var i=a.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&fe(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){var n=this[t];e(n)&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,a=0;a<r.length;a++){var i=r[a],o=t?e.apply(t,[i,a,r]):e(i,a,r);n.push(o)}return n},reduce:function(e,t){for(var n=t,r=this,a=0;a<r.length;a++)n=e(n,r[a],a,r);return n},max:function(e,t){for(var n=-1/0,r,a=this,i=0;i<a.length;i++){var o=a[i],u=t?e.apply(t,[o,i,a]):e(o,i,a);u>n&&(n=u,r=o)}return{value:n,ele:r}},min:function(e,t){for(var n=1/0,r,a=this,i=0;i<a.length;i++){var o=a[i],u=t?e.apply(t,[o,i,a]):e(o,i,a);u<n&&(n=u,r=o)}return{value:n,ele:r}}},Me=$c;Me.u=Me["|"]=Me["+"]=Me.union=Me.or=Me.add;Me["\\"]=Me["!"]=Me["-"]=Me.difference=Me.relativeComplement=Me.subtract=Me.not;Me.n=Me["&"]=Me["."]=Me.and=Me.intersection=Me.intersect;Me["^"]=Me["(+)"]=Me["(-)"]=Me.symmetricDifference=Me.symdiff=Me.xor;Me.fnFilter=Me.filterFn=Me.stdFilter=Me.filter;Me.complement=Me.abscomp=Me.absoluteComplement;var lv={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}},Jc=function(e,t){var n=e.cy(),r=n.hasCompoundNodes();function a(s){var c=s.pstyle("z-compound-depth");return c.value==="auto"?r?s.zDepth():0:c.value==="bottom"?-1:c.value==="top"?Qo:0}var i=a(e)-a(t);if(i!==0)return i;function o(s){var c=s.pstyle("z-index-compare");return c.value==="auto"&&s.isNode()?1:0}var u=o(e)-o(t);if(u!==0)return u;var l=e.pstyle("z-index").value-t.pstyle("z-index").value;return l!==0?l:e.poolIndex()-t.poolIndex()},ka={forEach:function(e,t){if(Ue(e))for(var n=this.length,r=0;r<n;r++){var a=this[r],i=t?e.apply(t,[a,r,this]):e(a,r,this);if(i===!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 n=[],r=this.length;t==null&&(t=r),e==null&&(e=0),e<0&&(e=r+e),t<0&&(t=r+t);for(var a=e;a>=0&&a<t&&a<r;a++)n.push(this[a]);return this.spawn(n)},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(!Ue(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(Jc)},zDepth:function(){var e=this[0];if(e){var t=e._private,n=t.group;if(n==="nodes"){var r=t.data.parent?e.parents().size():0;return e.isParent()?r:Qo-1}else{var a=t.source,i=t.target,o=a.zDepth(),u=i.zDepth();return Math.max(o,u,0)}}}};ka.each=ka.forEach;var uv=function(){var e="undefined",t=(typeof Symbol>"u"?"undefined":tt(Symbol))!=e&&tt(Symbol.iterator)!=e;t&&(ka[Symbol.iterator]=function(){var n=this,r={value:void 0,done:!1},a=0,i=this.length;return Qu({next:function(){return a<i?r.value=n[a++]:(r.value=void 0,r.done=!0),r}},Symbol.iterator,function(){return this})})};uv();var cv=ct({nodeDimensionsIncludeLabels:!1}),ua={layoutDimensions:function(e){e=cv(e);var t;if(!this.takesUpSpace())t={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.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,n){var r=this.nodes().filter(function(w){return!w.isParent()}),a=this.cy(),i=t.eles,o=function(w){return w.id()},u=Zn(n,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(w,k,C){var x={x:k.x1+k.w/2,y:k.y1+k.h/2},P={x:(C.x-x.x)*w,y:(C.y-x.y)*w};return{x:x.x+P.x,y:x.y+P.y}},s=t.spacingFactor&&t.spacingFactor!==1,c=function(){if(!s)return null;for(var w=bt(),k=0;k<r.length;k++){var C=r[k],x=u(C,k);yc(w,x.x,x.y)}return w},d=c(),h=Zn(function(w,k){var C=u(w,k);if(s){var x=Math.abs(t.spacingFactor);C=l(x,d,C)}return t.transform!=null&&(C=t.transform(w,C)),C},o);if(t.animate){for(var f=0;f<r.length;f++){var p=r[f],v=h(p,f),m=t.animateFilter==null||t.animateFilter(p,f);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=a.animation({fit:{boundingBox:i.boundingBoxAt(h),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(y)}else if(t.zoom!==void 0&&t.pan!==void 0){var b=a.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(b)}e.animations.forEach(function(w){return w.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),tr.all(e.animations.map(function(w){return w.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else r.positions(h),t.fit&&a.fit(t.eles,t.padding),t.zoom!=null&&a.zoom(t.zoom),t.pan&&a.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}))}};ua.createLayout=ua.makeLayout=ua.layout;function ed(e,t,n){var r=n._private,a=r.styleCache=r.styleCache||[],i;return(i=a[e])!=null||(i=a[e]=t(n)),i}function Xa(e,t){return e=Pn(e),function(n){return ed(e,t,n)}}function Ya(e,t){e=Pn(e);var n=function(r){return t.call(r)};return function(){var r=this[0];if(r)return ed(e,n,r)}}var lt={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),t=function(r){return r._private.styleCache=null};if(e.hasCompoundNodes()){var n;n=this.spawnSelf().merge(this.descendants()).merge(this.parents()),n.merge(n.connectedEdges()),n.forEach(t)}else this.forEach(function(r){t(r),r.connectedEdges().forEach(t)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching()){var n=t._private.batchStyleEles;return n.merge(this),this}var r=t.hasCompoundNodes(),a=this;e=!!(e||e===void 0),r&&(a=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var i=a;return e?i.emitAndNotify("style"):i.emit("style"),a.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 n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],r=n.cy();if(r.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n));var a=n._private.style[e];return a??(t?r.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return n.pfValue!==void 0?n.pfValue:n.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 n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,a=n.style();if(De(e)){var i=e;a.applyBypass(this,i,r),this.emitAndNotify("style")}else if(fe(e))if(t===void 0){var o=this[0];return o?a.getStylePropertyValue(o,e):void 0}else a.applyBypass(this,e,t,r),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?a.getRawStyle(u):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),a=this;if(e===void 0)for(var i=0;i<a.length;i++){var o=a[i];r.removeAllBypasses(o,n)}else{e=e.split(/\s+/);for(var u=0;u<a.length;u++){var l=a[u];r.removeBypasses(l,e,n)}}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(),n=this[0];if(n){var r=n._private,a=n.pstyle("opacity").value;if(!t)return a;var i=r.data.parent?n.parents():null;if(i)for(var o=0;o<i.length;o++){var u=i[o],l=u.pstyle("opacity").value;a=l*a}return a}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0],n=t.cy().hasCompoundNodes();if(t)return n?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 vo(e,t){var n=e._private,r=n.data.parent?e.parents():null;if(r)for(var a=0;a<r.length;a++){var i=r[a];if(!t(i))return!1}return!0}function us(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var a=this.cy();if(!a.styleEnabled())return!0;var i=this[0],o=a.hasCompoundNodes();if(i){var u=i._private;if(!t(i))return!1;if(i.isNode())return!o||vo(i,r);var l=u.source,s=u.target;return n(l)&&(!o||vo(l,n))&&(l===s||n(s)&&(!o||vo(s,n)))}}}var nr=Xa("eleTakesUpSpace",function(e){return e.pstyle("display").value==="element"&&e.width()!==0&&(e.isNode()?e.height()!==0:!0)});lt.takesUpSpace=Ya("takesUpSpace",us({ok:nr}));var dv=Xa("eleInteractive",function(e){return e.pstyle("events").value==="yes"&&e.pstyle("visibility").value==="visible"&&nr(e)}),hv=Xa("parentInteractive",function(e){return e.pstyle("visibility").value==="visible"&&nr(e)});lt.interactive=Ya("interactive",us({ok:dv,parentOk:hv,edgeOkViaNode:nr}));lt.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var fv=Xa("eleVisible",function(e){return e.pstyle("visibility").value==="visible"&&e.pstyle("opacity").pfValue!==0&&nr(e)}),pv=nr;lt.visible=Ya("visible",us({ok:fv,edgeOkViaNode:pv}));lt.hidden=function(){var e=this[0];if(e)return!e.visible()};lt.isBundledBezier=Ya("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});lt.bypass=lt.css=lt.style;lt.renderedCss=lt.renderedStyle;lt.removeBypass=lt.removeCss=lt.removeStyle;lt.pstyle=lt.parsedStyle;var on={};function fu(e){return function(){var t=arguments,n=[];if(t.length===2){var r=t[0],a=t[1];this.on(e.event,r,a)}else if(t.length===1&&Ue(t[0])){var i=t[0];this.on(e.event,i)}else if(t.length===0||t.length===1&&Ve(t[0])){for(var o=t.length===1?t[0]:null,u=0;u<this.length;u++){var l=this[u],s=!e.ableField||l._private[e.ableField],c=l._private[e.field]!=e.value;if(e.overrideAble){var d=e.overrideAble(l);if(d!==void 0&&(s=d,!d))return this}s&&(l._private[e.field]=e.value,c&&n.push(l))}var h=this.spawn(n);h.updateStyle(),h.emit(e.event),o&&h.emit(o)}return this}}function rr(e){on[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(n!==void 0)return n}return t._private[e.field]}},on[e.on]=fu({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),on[e.off]=fu({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}rr({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});rr({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});rr({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});rr({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});on.deselect=on.unselect;on.grabbed=function(){var e=this[0];if(e)return e._private.grabbed};rr({field:"active",on:"activate",off:"unactivate"});rr({field:"pannable",on:"panify",off:"unpanify"});on.inactive=function(){var e=this[0];if(e)return!e._private.active};var ft={},pu=function(e){return function(t){for(var n=this,r=[],a=0;a<n.length;a++){var i=n[a];if(i.isNode()){for(var o=!1,u=i.connectedEdges(),l=0;l<u.length;l++){var s=u[l],c=s.source(),d=s.target();if(e.noIncomingEdges&&d===i&&c!==i||e.noOutgoingEdges&&c===i&&d!==i){o=!0;break}}o||r.push(i)}}return this.spawn(r,!0).filter(t)}},gu=function(e){return function(t){for(var n=this,r=[],a=0;a<n.length;a++){var i=n[a];if(i.isNode())for(var o=i.connectedEdges(),u=0;u<o.length;u++){var l=o[u],s=l.source(),c=l.target();e.outgoing&&s===i?(r.push(l),r.push(c)):e.incoming&&c===i&&(r.push(l),r.push(s))}}return this.spawn(r,!0).filter(t)}},vu=function(e){return function(t){for(var n=this,r=[],a={};;){var i=e.outgoing?n.outgoers():n.incomers();if(i.length===0)break;for(var o=!1,u=0;u<i.length;u++){var l=i[u],s=l.id();a[s]||(a[s]=!0,r.push(l),o=!0)}if(!o)break;n=i}return this.spawn(r,!0).filter(t)}};ft.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null};ge(ft,{roots:pu({noIncomingEdges:!0}),leaves:pu({noOutgoingEdges:!0}),outgoers:At(gu({outgoing:!0}),"outgoers"),successors:vu({outgoing:!0}),incomers:At(gu({incoming:!0}),"incomers"),predecessors:vu({})});ge(ft,{neighborhood:At(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var a=n[r],i=a.connectedEdges(),o=0;o<i.length;o++){var u=i[o],l=u.source(),s=u.target(),c=a===l?s:l;c.length>0&&t.push(c[0]),t.push(u[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)}});ft.neighbourhood=ft.neighborhood;ft.closedNeighbourhood=ft.closedNeighborhood;ft.openNeighbourhood=ft.openNeighborhood;ge(ft,{source:At(function(e){var t=this[0],n;return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},"source"),target:At(function(e){var t=this[0],n;return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},"target"),sources:yu({attr:"source"}),targets:yu({attr:"target"})});function yu(e){return function(t){for(var n=[],r=0;r<this.length;r++){var a=this[r],i=a._private[e.attr];i&&n.push(i)}return this.spawn(n,!0).filter(t)}}ge(ft,{edgesWith:At(mu(),"edgesWith"),edgesTo:At(mu({thisIsSrc:!0}),"edgesTo")});function mu(e){return function(t){var n=[],r=this._private.cy,a=e||{};fe(t)&&(t=r.$(t));for(var i=0;i<t.length;i++)for(var o=t[i]._private.edges,u=0;u<o.length;u++){var l=o[u],s=l._private.data,c=this.hasElementWithId(s.source)&&t.hasElementWithId(s.target),d=t.hasElementWithId(s.source)&&this.hasElementWithId(s.target),h=c||d;h&&((a.thisIsSrc||a.thisIsTgt)&&(a.thisIsSrc&&!c||a.thisIsTgt&&!d)||n.push(l))}return this.spawn(n,!0)}}ge(ft,{connectedEdges:At(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var a=n[r];if(a.isNode())for(var i=a._private.edges,o=0;o<i.length;o++){var u=i[o];t.push(u)}}return this.spawn(t,!0).filter(e)},"connectedEdges"),connectedNodes:At(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var a=n[r];a.isEdge()&&(t.push(a.source()[0]),t.push(a.target()[0]))}return this.spawn(t,!0).filter(e)},"connectedNodes"),parallelEdges:At(bu(),"parallelEdges"),codirectedEdges:At(bu({codirected:!0}),"codirectedEdges")});function bu(e){var t={codirected:!1};return e=ge({},t,e),function(n){for(var r=[],a=this.edges(),i=e,o=0;o<a.length;o++)for(var u=a[o],l=u._private,s=l.source,c=s._private.data.id,d=l.data.target,h=s._private.edges,f=0;f<h.length;f++){var p=h[f],v=p._private.data,m=v.target,g=v.source,y=m===d&&g===c,b=c===m&&d===g;(i.codirected&&y||!i.codirected&&(y||b))&&r.push(p)}return this.spawn(r,!0).filter(n)}}ge(ft,{components:function(e){var t=this,n=t.cy(),r=n.collection(),a=e==null?t.nodes():e.nodes(),i=[];e!=null&&a.empty()&&(a=e.sources());var o=function(l,s){r.merge(l),a.unmerge(l),s.merge(l)};if(a.empty())return t.spawn();var u=function(){var l=n.collection();i.push(l);var s=a[0];o(s,l),t.bfs({directed:!1,roots:s,visit:function(c){return o(c,l)}}),l.forEach(function(c){c.connectedEdges().forEach(function(d){t.has(d)&&l.has(d.source())&&l.has(d.target())&&l.merge(d)})})};do u();while(a.length>0);return i},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});ft.componentsOf=ft.components;var ut=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){qe("A collection must have a reference to the core");return}var a=new Wt,i=!1;if(!t)t=[];else if(t.length>0&&De(t[0])&&!Mr(t[0])){i=!0;for(var o=[],u=new er,l=0,s=t.length;l<s;l++){var c=t[l];c.data==null&&(c.data={});var d=c.data;if(d.id==null)d.id=pc();else if(e.hasElementWithId(d.id)||u.has(d.id))continue;var h=new Ma(e,c,!1);o.push(h),u.add(d.id)}t=o}this.length=0;for(var f=0,p=t.length;f<p;f++){var v=t[f][0];if(v!=null){var m=v._private.data.id;(!n||!a.has(m))&&(n&&a.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 Wt,y=this.eles,b=0;b<y.length;b++){var w=y[b];g.set(w.id(),{index:b,ele:w})}}},n&&(this._private.map=a),i&&!r&&this.restore()},Ye=Ma.prototype=ut.prototype=Object.create(Array.prototype);Ye.instanceString=function(){return"collection"};Ye.spawn=function(e,t){return new ut(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 ec(this)?this:new ut(this._private.cy,[this])};Ye.unique=function(){return new ut(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,n=this._private.map.get(e);return n?n.ele:new ut(t)};Ye.$id=Ye.getElementById;Ye.poolIndex=function(){var e=this._private.cy,t=e._private.elements,n=this[0]._private.data.id;return t._private.map.get(n).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(),n=this.cy();if(t==null&&e)return this;if(t!=null){var r=t._private;if(De(e)){if(n.startBatch(),e.data){t.data(e.data);var a=r.data;if(t.isEdge()){var i=!1,o={},u=e.data.source,l=e.data.target;u!=null&&u!=a.source&&(o.source=""+u,i=!0),l!=null&&l!=a.target&&(o.target=""+l,i=!0),i&&(t=t.move(o))}else{var s="parent"in e.data,c=e.data.parent;s&&(c!=null||a.parent!=null)&&c!=a.parent&&(c===void 0&&(c=null),c!=null&&(c=""+c),t=t.move({parent:c}))}}e.position&&t.position(e.position);var d=function(p,v,m){var g=e[p];g!=null&&g!==r[p]&&(g?t[v]():t[m]())};return d("removed","remove","restore"),d("selected","select","unselect"),d("selectable","selectify","unselectify"),d("locked","lock","unlock"),d("grabbable","grabify","ungrabify"),d("pannable","panify","unpanify"),e.classes!=null&&t.classes(e.classes),n.endBatch(),this}else if(e===void 0){var h={data:Ft(r.data),position:Ft(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};h.classes="";var f=0;return r.classes.forEach(function(p){return h.classes+=f++===0?p:" "+p}),h}}};Ye.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t],r=n.json();e.push(r)}return e};Ye.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=this[n],a=r.json(),i=new Ma(e,a,!1);t.push(i)}return new ut(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,n=this,r=n.cy(),a=r._private,i=[],o=[],u,l=0,s=n.length;l<s;l++){var c=n[l];t&&!c.removed()||(c.isNode()?i.push(c):o.push(c))}u=i.concat(o);var d,h=function(){u.splice(d,1),d--};for(d=0;d<u.length;d++){var f=u[d],p=f._private,v=p.data;if(f.clearTraversalCache(),!(!t&&!p.removed)){if(v.id===void 0)v.id=pc();else if(ne(v.id))v.id=""+v.id;else if(sn(v.id)||!fe(v.id)){qe("Can not create element with invalid string ID `"+v.id+"`"),h();continue}else if(r.hasElementWithId(v.id)){qe("Can not create second element with ID `"+v.id+"`"),h();continue}}var m=v.id;if(f.isNode()){var g=p.position;g.x==null&&(g.x=0),g.y==null&&(g.y=0)}if(f.isEdge()){for(var y=f,b=["source","target"],w=b.length,k=!1,C=0;C<w;C++){var x=b[C],P=v[x];ne(P)&&(P=v[x]=""+v[x]),P==null||P===""?(qe("Can not create edge `"+m+"` with unspecified "+x),k=!0):r.hasElementWithId(P)||(qe("Can not create edge `"+m+"` with nonexistant "+x+" `"+P+"`"),k=!0)}if(k){h();continue}var B=r.getElementById(v.source),D=r.getElementById(v.target);B.same(D)?B._private.edges.push(y):(B._private.edges.push(y),D._private.edges.push(y)),y._private.source=B,y._private.target=D}p.map=new Wt,p.map.set(m,{ele:f,index:0}),p.removed=!1,t&&r.addToPool(f)}for(var _=0;_<i.length;_++){var T=i[_],S=T._private.data;ne(S.parent)&&(S.parent=""+S.parent);var A=S.parent,N=A!=null;if(N||T._private.parent){var R=T._private.parent?r.collection().merge(T._private.parent):r.getElementById(A);if(R.empty())S.parent=void 0;else if(R[0].removed())Ne("Node added with missing parent, reference to parent removed"),S.parent=void 0,T._private.parent=null;else{for(var M=!1,L=R;!L.empty();){if(T.same(L)){M=!0,S.parent=void 0;break}L=L.parent()}M||(R[0]._private.children.push(T),T._private.parent=R[0],a.hasCompoundNodes=!0)}}}if(u.length>0){for(var I=u.length===n.length?n:new ut(r,u),j=0;j<I.length;j++){var F=I[j];F.isNode()||(F.parallelEdges().clearTraversalCache(),F.source().clearTraversalCache(),F.target().clearTraversalCache())}var Y;a.hasCompoundNodes?Y=r.collection().merge(I).merge(I.connectedNodes()).merge(I.parent()):Y=I,Y.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?I.emitAndNotify("add"):t&&I.emit("add")}return n};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,n=this,r=[],a={},i=n._private.cy;function o(A){for(var N=A._private.edges,R=0;R<N.length;R++)l(N[R])}function u(A){for(var N=A._private.children,R=0;R<N.length;R++)l(N[R])}function l(A){var N=a[A.id()];t&&A.removed()||N||(a[A.id()]=!0,A.isNode()?(r.push(A),o(A),u(A)):r.unshift(A))}for(var s=0,c=n.length;s<c;s++){var d=n[s];l(d)}function h(A,N){var R=A._private.edges;ln(R,N),A.clearTraversalCache()}function f(A){A.clearTraversalCache()}var p=[];p.ids={};function v(A,N){N=N[0],A=A[0];var R=A._private.children,M=A.id();ln(R,N),N._private.parent=null,p.ids[M]||(p.ids[M]=!0,p.push(A))}n.dirtyCompoundBoundsCache(),t&&i.removeFromPool(r);for(var m=0;m<r.length;m++){var g=r[m];if(g.isEdge()){var y=g.source()[0],b=g.target()[0];h(y,g),h(b,g);for(var w=g.parallelEdges(),k=0;k<w.length;k++){var C=w[k];f(C),C.isBundledBezier()&&C.dirtyBoundingBoxCache()}}else{var x=g.parent();x.length!==0&&v(x,g)}t&&(g._private.removed=!0)}var P=i._private.elements;i._private.hasCompoundNodes=!1;for(var B=0;B<P.length;B++){var D=P[B];if(D.isParent()){i._private.hasCompoundNodes=!0;break}}var _=new ut(this.cy(),r);_.size()>0&&(e?_.emitAndNotify("remove"):t&&_.emit("remove"));for(var T=0;T<p.length;T++){var S=p[T];(!t||!S.removed())&&S.updateStyle()}return _};Ye.move=function(e){var t=this._private.cy,n=this,r=!1,a=!1,i=function(f){return f==null?f:""+f};if(e.source!==void 0||e.target!==void 0){var o=i(e.source),u=i(e.target),l=o!=null&&t.hasElementWithId(o),s=u!=null&&t.hasElementWithId(u);(l||s)&&(t.batch(function(){n.remove(r,a),n.emitAndNotify("moveout");for(var f=0;f<n.length;f++){var p=n[f],v=p._private.data;p.isEdge()&&(l&&(v.source=o),s&&(v.target=u))}n.restore(r,a)}),n.emitAndNotify("move"))}else if(e.parent!==void 0){var c=i(e.parent),d=c===null||t.hasElementWithId(c);if(d){var h=c===null?void 0:c;t.batch(function(){var f=n.remove(r,a);f.emitAndNotify("moveout");for(var p=0;p<n.length;p++){var v=n[p],m=v._private.data;v.isNode()&&(m.parent=h)}f.restore(r,a)}),n.emitAndNotify("move")}}return this};[Pc,Cg,la,an,$n,Xg,Va,rv,Qc,$c,lv,ka,ua,lt,on,ft].forEach(function(e){ge(Ye,e)});var gv={add:function(e){var t,n=this;if(Pt(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var a=[],i=0;i<r.length;i++){var o=r[i];a.push(o.json())}t=new ut(n,a)}}else if(Ve(e)){var u=e;t=new ut(n,u)}else if(De(e)&&(Ve(e.nodes)||Ve(e.edges))){for(var l=e,s=[],c=["nodes","edges"],d=0,h=c.length;d<h;d++){var f=c[d],p=l[f];if(Ve(p))for(var v=0,m=p.length;v<m;v++){var g=ge({group:f},p[v]);s.push(g)}}t=new ut(n,s)}else{var y=e;t=new Ma(n,y).collection()}return t},remove:function(e){if(!Pt(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 vv(e,t,n,r){var a=4,i=.001,o=1e-7,u=10,l=11,s=1/(l-1),c=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var d=0;d<4;++d)if(typeof arguments[d]!="number"||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var h=c?new Float32Array(l):new Array(l);function f(D,_){return 1-3*_+3*D}function p(D,_){return 3*_-6*D}function v(D){return 3*D}function m(D,_,T){return((f(_,T)*D+p(_,T))*D+v(_))*D}function g(D,_,T){return 3*f(_,T)*D*D+2*p(_,T)*D+v(_)}function y(D,_){for(var T=0;T<a;++T){var S=g(_,e,n);if(S===0)return _;var A=m(_,e,n)-D;_-=A/S}return _}function b(){for(var D=0;D<l;++D)h[D]=m(D*s,e,n)}function w(D,_,T){var S,A,N=0;do A=_+(T-_)/2,S=m(A,e,n)-D,S>0?T=A:_=A;while(Math.abs(S)>o&&++N<u);return A}function k(D){for(var _=0,T=1,S=l-1;T!==S&&h[T]<=D;++T)_+=s;--T;var A=(D-h[T])/(h[T+1]-h[T]),N=_+A*s,R=g(N,e,n);return R>=i?y(D,N):R===0?N:w(D,_,_+s)}var C=!1;function x(){C=!0,(e!==t||n!==r)&&b()}var P=function(D){return C||x(),e===t&&n===r?D:D===0?0:D===1?1:m(k(D),t,r)};P.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var B="generateBezier("+[e,t,n,r]+")";return P.toString=function(){return B},P}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var yv=function(){function e(r){return-r.tension*r.x-r.friction*r.v}function t(r,a,i){var o={x:r.x+i.dx*a,v:r.v+i.dv*a,tension:r.tension,friction:r.friction};return{dx:o.v,dv:e(o)}}function n(r,a){var i={dx:r.v,dv:e(r)},o=t(r,a*.5,i),u=t(r,a*.5,o),l=t(r,a,u),s=1/6*(i.dx+2*(o.dx+u.dx)+l.dx),c=1/6*(i.dv+2*(o.dv+u.dv)+l.dv);return r.x=r.x+s*a,r.v=r.v+c*a,r}return function r(a,i,o){var u={x:-1,v:0,tension:null,friction:null},l=[0],s=0,c=1/1e4,d=16/1e3,h,f,p;for(a=parseFloat(a)||500,i=parseFloat(i)||20,o=o||null,u.tension=a,u.friction=i,h=o!==null,h?(s=r(a,i),f=s/o*d):f=d;p=n(p||u,f),l.push(1+p.x),s+=16,Math.abs(p.x)>c&&Math.abs(p.v)>c;);return h?function(v){return l[v*(l.length-1)|0]}:s}}(),Xe=function(e,t,n,r){var a=vv(e,t,n,r);return function(i,o,u){return i+(o-i)*a(u)}},ca={linear:function(e,t,n){return e+(t-e)*n},ease:Xe(.25,.1,.25,1),"ease-in":Xe(.42,0,1,1),"ease-out":Xe(0,0,.58,1),"ease-in-out":Xe(.42,0,.58,1),"ease-in-sine":Xe(.47,0,.745,.715),"ease-out-sine":Xe(.39,.575,.565,1),"ease-in-out-sine":Xe(.445,.05,.55,.95),"ease-in-quad":Xe(.55,.085,.68,.53),"ease-out-quad":Xe(.25,.46,.45,.94),"ease-in-out-quad":Xe(.455,.03,.515,.955),"ease-in-cubic":Xe(.55,.055,.675,.19),"ease-out-cubic":Xe(.215,.61,.355,1),"ease-in-out-cubic":Xe(.645,.045,.355,1),"ease-in-quart":Xe(.895,.03,.685,.22),"ease-out-quart":Xe(.165,.84,.44,1),"ease-in-out-quart":Xe(.77,0,.175,1),"ease-in-quint":Xe(.755,.05,.855,.06),"ease-out-quint":Xe(.23,1,.32,1),"ease-in-out-quint":Xe(.86,0,.07,1),"ease-in-expo":Xe(.95,.05,.795,.035),"ease-out-expo":Xe(.19,1,.22,1),"ease-in-out-expo":Xe(1,0,0,1),"ease-in-circ":Xe(.6,.04,.98,.335),"ease-out-circ":Xe(.075,.82,.165,1),"ease-in-out-circ":Xe(.785,.135,.15,.86),spring:function(e,t,n){if(n===0)return ca.linear;var r=yv(e,t,n);return function(a,i,o){return a+(i-a)*r(o)}},"cubic-bezier":Xe};function xu(e,t,n,r,a){if(r===1||t===n)return n;var i=a(t,n,r);return e==null||((e.roundValue||e.color)&&(i=Math.round(i)),e.min!==void 0&&(i=Math.max(i,e.min)),e.max!==void 0&&(i=Math.min(i,e.max))),i}function wu(e,t){return e.pfValue!=null||e.value!=null?e.pfValue!=null&&(t==null||t.type.units!=="%")?e.pfValue:e.value:e}function Nn(e,t,n,r,a){var i=a!=null?a.type:null;n<0?n=0:n>1&&(n=1);var o=wu(e,a),u=wu(t,a);if(ne(o)&&ne(u))return xu(i,o,u,n,r);if(Ve(o)&&Ve(u)){for(var l=[],s=0;s<u.length;s++){var c=o[s],d=u[s];if(c!=null&&d!=null){var h=xu(i,c,d,n,r);l.push(h)}else l.push(d)}return l}}function mv(e,t,n,r){var a=!r,i=e._private,o=t._private,u=o.easing,l=o.startTime,s=r?e:e.cy(),c=s.style();if(!o.easingImpl)if(u==null)o.easingImpl=ca.linear;else{var d;if(fe(u)){var h=c.parse("transition-timing-function",u);d=h.value}else d=u;var f,p;fe(d)?(f=d,p=[]):(f=d[1],p=d.slice(2).map(function(I){return+I})),p.length>0?(f==="spring"&&p.push(o.duration),o.easingImpl=ca[f].apply(null,p)):o.easingImpl=ca[f]}var v=o.easingImpl,m;if(o.duration===0?m=1:m=(n-l)/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&&a&&!e.locked()){var b={};dr(g.x,y.x)&&(b.x=Nn(g.x,y.x,m,v)),dr(g.y,y.y)&&(b.y=Nn(g.y,y.y,m,v)),e.position(b)}var w=o.startPan,k=o.pan,C=i.pan,x=k!=null&&r;x&&(dr(w.x,k.x)&&(C.x=Nn(w.x,k.x,m,v)),dr(w.y,k.y)&&(C.y=Nn(w.y,k.y,m,v)),e.emit("pan"));var P=o.startZoom,B=o.zoom,D=B!=null&&r;D&&(dr(P,B)&&(i.zoom=Tr(i.minZoom,Nn(P,B,m,v),i.maxZoom)),e.emit("zoom")),(x||D)&&e.emit("viewport");var _=o.style;if(_&&_.length>0&&a){for(var T=0;T<_.length;T++){var S=_[T],A=S.name,N=S,R=o.startStyle[A],M=c.properties[R.name],L=Nn(R,N,m,v,M);c.overrideBypass(e,A,L)}e.emit("style")}}return o.progress=m,m}function dr(e,t){return e==null||t==null?!1:ne(e)&&ne(t)?!0:!!(e&&t)}function bv(e,t,n,r){var a=t._private;a.started=!0,a.startTime=n-a.progress*a.duration}function Eu(e,t){var n=t._private.aniEles,r=[];function a(c,d){var h=c._private,f=h.animation.current,p=h.animation.queue,v=!1;if(f.length===0){var m=p.shift();m&&f.push(m)}for(var g=function(k){for(var C=k.length-1;C>=0;C--){var x=k[C];x()}k.splice(0,k.length)},y=f.length-1;y>=0;y--){var b=f[y],w=b._private;if(w.stopped){f.splice(y,1),w.hooked=!1,w.playing=!1,w.started=!1,g(w.frames);continue}!w.playing&&!w.applying||(w.playing&&w.applying&&(w.applying=!1),w.started||bv(c,b,e),mv(c,b,e,d),w.applying&&(w.applying=!1),g(w.frames),w.step!=null&&w.step(e),b.completed()&&(f.splice(y,1),w.hooked=!1,w.playing=!1,w.started=!1,g(w.completes)),v=!0)}return!d&&f.length===0&&p.length===0&&r.push(c),v}for(var i=!1,o=0;o<n.length;o++){var u=n[o],l=a(u);i=i||l}var s=a(t,!0);(i||s)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var xv={animate:Le.animate(),animation:Le.animation(),animated:Le.animated(),clearQueue:Le.clearQueue(),delay:Le.delay(),delayAnimation:Le.delayAnimation(),stop:Le.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&&ma(function(r){Eu(r,e),t()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(r,a){Eu(a,e)},n.beforeRenderPriorities.animations):t()}},wv={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r!=null?e!==n.target&&Mr(n.target)&&r.matches(n.target):!0},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e}},na=function(e){return fe(e)?new cn(e):e},td={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Fa(wv,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,na(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,na(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,na(t),n),this},once:function(e,t,n){return this.emitter().one(e,na(t),n),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}};Le.eventAliasesOn(td);var No={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)}};No.jpeg=No.jpg;var da={layout:function(e){var t=this;if(e==null){qe("Layout options must be specified to make a layout");return}if(e.name==null){qe("A `name` must be specified to make a layout");return}var n=e.name,r=t.extension("layout",n);if(r==null){qe("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var a;fe(e.eles)?a=t.$(e.eles):a=e.eles!=null?e.eles:t.$();var i=new r(ge({},e,{cy:t,eles:a}));return i}};da.createLayout=da.makeLayout=da.layout;var Ev={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();t!=null&&r.merge(t);return}if(n.notificationsEnabled){var a=this.renderer();this.destroyed()||!a||a.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(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var a=n[r],i=e[a],o=t.getElementById(a);o.data(i)}})}},kv=ct({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]}),Oo={renderTo:function(e,t,n,r){var a=this._private.renderer;return a.renderTo(e,t,n,r),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,n=t.extension("renderer",e.name);if(n==null){qe("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&&Ne("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 r=kv(e);r.cy=t,t._private.renderer=new n(r),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(n){var r=n._private;r.rscratch={},r.rstyle={},r.animation.current=[],r.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Oo.invalidateDimensions=Oo.resize;var ha={collection:function(e,t){return fe(e)?this.$(e):Pt(e)?e.collection():Ve(e)?(t||(t={}),new ut(this,e,t.unique,t.removed)):new ut(this)},nodes:function(e){var t=this.$(function(n){return n.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(n){return n.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}};ha.elements=ha.filter=ha.$;var ot={},mr="t",Tv="f";ot.apply=function(e){for(var t=this,n=t._private,r=n.cy,a=r.collection(),i=0;i<e.length;i++){var o=e[i],u=t.getContextMeta(o);if(!u.empty){var l=t.getContextStyle(u),s=t.applyContextStyle(u,l,o);o._private.appliedInitStyle?t.updateTransitions(o,s.diffProps):o._private.appliedInitStyle=!0;var c=t.updateStyleHints(o);c&&a.push(o)}}return a};ot.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},a=e+"-"+t,i=r[a];if(i)return i;for(var o=[],u={},l=0;l<n.length;l++){var s=n[l],c=e[l]===mr,d=t[l]===mr,h=c!==d,f=s.mappedProperties.length>0;if(h||d&&f){var p=void 0;h&&f||h?p=s.properties:f&&(p=s.mappedProperties);for(var v=0;v<p.length;v++){for(var m=p[v],g=m.name,y=!1,b=l+1;b<n.length;b++){var w=n[b],k=t[b]===mr;if(k&&(y=w.properties[m.name]!=null,y))break}!u[g]&&!y&&(u[g]=!0,o.push(g))}}}return r[a]=o,o};ot.getContextMeta=function(e){for(var t=this,n="",r,a=e._private.styleCxtKey||"",i=0;i<t.length;i++){var o=t[i],u=o.selector&&o.selector.matches(e);u?n+=mr:n+=Tv}return r=t.getPropertiesDiff(a,n),e._private.styleCxtKey=n,{key:n,diffPropNames:r,empty:r.length===0}};ot.getContextStyle=function(e){var t=e.key,n=this,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var a={_private:{key:t}},i=0;i<n.length;i++){var o=n[i],u=t[i]===mr;if(u)for(var l=0;l<o.properties.length;l++){var s=o.properties[l];a[s.name]=s}}return r[t]=a,a};ot.applyContextStyle=function(e,t,n){for(var r=this,a=e.diffPropNames,i={},o=r.types,u=0;u<a.length;u++){var l=a[u],s=t[l],c=n.pstyle(l);if(!s)if(c)c.bypass?s={name:l,deleteBypassed:!0}:s={name:l,delete:!0};else continue;if(c!==s){if(s.mapped===o.fn&&c!=null&&c.mapping!=null&&c.mapping.value===s.value){var d=c.mapping,h=d.fnValue=s.value(n);if(h===d.prevFnValue)continue}var f=i[l]={prev:c};r.applyParsedProperty(n,s),f.next=n.pstyle(l),f.next&&f.next.bypass&&(f.next=f.next.bypassed)}}return{diffProps:i}};ot.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,a=n.propertyGroupKeys,i=function(z,H,te){return n.getPropertiesHash(z,H,te)},o=t.styleKey;if(e.removed())return!1;var u=t.group==="nodes",l=e._private.style;r=Object.keys(l);for(var s=0;s<a.length;s++){var c=a[s];t.styleKeys[c]=[kn,Yn]}for(var d=function(z,H){return t.styleKeys[H][0]=wr(z,t.styleKeys[H][0])},h=function(z,H){return t.styleKeys[H][1]=Er(z,t.styleKeys[H][1])},f=function(z,H){d(z,H),h(z,H)},p=function(z,H){for(var te=0;te<z.length;te++){var ae=z.charCodeAt(te);d(ae,H),h(ae,H)}},v=2e9,m=function(z){return-128<z&&z<128&&Math.floor(z)!==z?v-(z*1024|0):z},g=0;g<r.length;g++){var y=r[g],b=l[y];if(b!=null){var w=this.properties[y],k=w.type,C=w.groupKey,x=void 0;w.hashOverride!=null?x=w.hashOverride(e,b):b.pfValue!=null&&(x=b.pfValue);var P=w.enums==null?b.value:null,B=x!=null,D=P!=null,_=B||D,T=b.units;if(k.number&&_&&!k.multiple){var S=B?x:P;f(m(S),C),!B&&T!=null&&p(T,C)}else p(b.strValue,C)}}for(var A=[kn,Yn],N=0;N<a.length;N++){var R=a[N],M=t.styleKeys[R];A[0]=wr(M[0],A[0]),A[1]=Er(M[1],A[1])}t.styleKey=Vh(A[0],A[1]);var L=t.styleKeys;t.labelDimsKey=$t(L.labelDimensions);var I=i(e,["label"],L.labelDimensions);if(t.labelKey=$t(I),t.labelStyleKey=$t(Hr(L.commonLabel,I)),!u){var j=i(e,["source-label"],L.labelDimensions);t.sourceLabelKey=$t(j),t.sourceLabelStyleKey=$t(Hr(L.commonLabel,j));var F=i(e,["target-label"],L.labelDimensions);t.targetLabelKey=$t(F),t.targetLabelStyleKey=$t(Hr(L.commonLabel,F))}if(u){var Y=t.styleKeys,W=Y.nodeBody,Q=Y.nodeBorder,$=Y.nodeOutline,Z=Y.backgroundImage,J=Y.compound,re=Y.pie,V=Y.stripe,O=[W,Q,$,Z,J,re,V].filter(function(z){return z!=null}).reduce(Hr,[kn,Yn]);t.nodeKey=$t(O),t.hasPie=re!=null&&re[0]!==kn&&re[1]!==Yn,t.hasStripe=V!=null&&V[0]!==kn&&V[1]!==Yn}return o!==t.styleKey};ot.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};ot.applyParsedProperty=function(e,t){var n=this,r=t,a=e._private.style,i,o=n.types,u=n.properties[r.name].type,l=r.bypass,s=a[r.name],c=s&&s.bypass,d=e._private,h="mapping",f=function(Y){return Y==null?null:Y.pfValue!=null?Y.pfValue:Y.value},p=function(){var Y=f(s),W=f(r);n.checkTriggers(e,r.name,Y,W)};if(t.name==="curve-style"&&e.isEdge()&&(t.value!=="bezier"&&e.isLoop()||t.value==="haystack"&&(e.source().isParent()||e.target().isParent()))&&(r=t=this.parse(t.name,"bezier",l)),r.delete)return a[r.name]=void 0,p(),!0;if(r.deleteBypassed)return s?s.bypass?(s.bypassed=void 0,p(),!0):!1:(p(),!0);if(r.deleteBypass)return s?s.bypass?(a[r.name]=s.bypassed,p(),!0):!1:(p(),!0);var v=function(){Ne("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+r.name+"` with data field `"+r.field+"`); try a `["+r.field+"]` selector to limit scope to elements with `"+r.field+"` defined")};switch(r.mapped){case o.mapData:{for(var m=r.field.split("."),g=d.data,y=0;y<m.length&&g;y++){var b=m[y];g=g[b]}if(g==null)return v(),!1;var w;if(ne(g)){var k=r.fieldMax-r.fieldMin;k===0?w=0:w=(g-r.fieldMin)/k}else return Ne("Do not use continuous mappers without specifying numeric data (i.e. `"+r.field+": "+g+"` for `"+e.id()+"` is non-numeric)"),!1;if(w<0?w=0:w>1&&(w=1),u.color){var C=r.valueMin[0],x=r.valueMax[0],P=r.valueMin[1],B=r.valueMax[1],D=r.valueMin[2],_=r.valueMax[2],T=r.valueMin[3]==null?1:r.valueMin[3],S=r.valueMax[3]==null?1:r.valueMax[3],A=[Math.round(C+(x-C)*w),Math.round(P+(B-P)*w),Math.round(D+(_-D)*w),Math.round(T+(S-T)*w)];i={bypass:r.bypass,name:r.name,value:A,strValue:"rgb("+A[0]+", "+A[1]+", "+A[2]+")"}}else if(u.number){var N=r.valueMin+(r.valueMax-r.valueMin)*w;i=this.parse(r.name,N,r.bypass,h)}else return!1;if(!i)return v(),!1;i.mapping=r,r=i;break}case o.data:{for(var R=r.field.split("."),M=d.data,L=0;L<R.length&&M;L++){var I=R[L];M=M[I]}if(M!=null&&(i=this.parse(r.name,M,r.bypass,h)),!i)return v(),!1;i.mapping=r,r=i;break}case o.fn:{var j=r.value,F=r.fnValue!=null?r.fnValue:j(e);if(r.prevFnValue=F,F==null)return Ne("Custom function mappers may not return null (i.e. `"+r.name+"` for ele `"+e.id()+"` is null)"),!1;if(i=this.parse(r.name,F,r.bypass,h),!i)return Ne("Custom function mappers may not return invalid values for the property type (i.e. `"+r.name+"` for ele `"+e.id()+"` is invalid)"),!1;i.mapping=Ft(r),r=i;break}case void 0:break;default:return!1}return l?(c?r.bypassed=s.bypassed:r.bypassed=s,a[r.name]=r):c?s.bypassed=r:a[r.name]=r,p(),!0};ot.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),!t)r._private.style={};else for(var a=r._private.style,i=Object.keys(a),o=0;o<i.length;o++){var u=i[o],l=a[u];l!=null&&(l.bypass?l.bypassed=null:a[u]=null)}}};ot.update=function(){var e=this._private.cy,t=e.mutableElements();t.updateStyle()};ot.updateTransitions=function(e,t){var n=this,r=e._private,a=e.pstyle("transition-property").value,i=e.pstyle("transition-duration").pfValue,o=e.pstyle("transition-delay").pfValue;if(a.length>0&&i>0){for(var u={},l=!1,s=0;s<a.length;s++){var c=a[s],d=e.pstyle(c),h=t[c];if(h){var f=h.prev,p=f,v=h.next!=null?h.next:d,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):Ve(p.value)&&Ve(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&&(u[c]=v.strValue,this.applyBypass(e,c,g),l=!0))}}if(!l)return;r.transitioning=!0,new tr(function(b){o>0?e.delayAnimation(o).play().promise().then(b):b()}).then(function(){return e.animation({style:u,duration:i,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1)};ot.checkTrigger=function(e,t,n,r,a,i){var o=this.properties[t],u=a(o);e.removed()||u!=null&&u(n,r,e)&&i(o)};ot.checkZOrderTrigger=function(e,t,n,r){var a=this;this.checkTrigger(e,t,n,r,function(i){return i.triggersZOrder},function(){a._private.cy.notify("zorder",e)})};ot.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(a){return a.triggersBounds},function(a){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})};ot.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(a){return a.triggersBoundsOfConnectedEdges},function(a){e.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};ot.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(a){return a.triggersBoundsOfParallelEdges},function(a){e.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};ot.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var Vr={};Vr.applyBypass=function(e,t,n,r){var a=this,i=[],o=!0;if(t==="*"||t==="**"){if(n!==void 0)for(var u=0;u<a.properties.length;u++){var l=a.properties[u],s=l.name,c=this.parse(s,n,!0);c&&i.push(c)}}else if(fe(t)){var d=this.parse(t,n,!0);d&&i.push(d)}else if(De(t)){var h=t;r=n;for(var f=Object.keys(h),p=0;p<f.length;p++){var v=f[p],m=h[v];if(m===void 0&&(m=h[Aa(v)]),m!==void 0){var g=this.parse(v,m,!0);g&&i.push(g)}}}else return!1;if(i.length===0)return!1;for(var y=!1,b=0;b<e.length;b++){for(var w=e[b],k={},C=void 0,x=0;x<i.length;x++){var P=i[x];if(r){var B=w.pstyle(P.name);C=k[P.name]={prev:B}}y=this.applyParsedProperty(w,Ft(P))||y,r&&(C.next=w.pstyle(P.name))}y&&this.updateStyleHints(w),r&&this.updateTransitions(w,k,o)}return y};Vr.overrideBypass=function(e,t,n){t=Ko(t);for(var r=0;r<e.length;r++){var a=e[r],i=a._private.style[t],o=this.properties[t].type,u=o.color,l=o.mutiple,s=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(a,t,n):(i.value=n,i.pfValue!=null&&(i.pfValue=n),u?i.strValue="rgb("+n.join(",")+")":l?i.strValue=n.join(" "):i.strValue=""+n,this.updateStyleHints(a)),this.checkTriggers(a,t,s,n)}};Vr.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)};Vr.removeBypasses=function(e,t,n){for(var r=!0,a=0;a<e.length;a++){for(var i=e[a],o={},u=0;u<t.length;u++){var l=t[u],s=this.properties[l],c=i.pstyle(s.name);if(!(!c||!c.bypass)){var d="",h=this.parse(l,d,!0),f=o[s.name]={prev:c};this.applyParsedProperty(i,h),f.next=i.pstyle(s.name)}}this.updateStyleHints(i),n&&this.updateTransitions(i,o,r)}};var cs={};cs.getEmSizeInPixels=function(){var e=this.containerCss("font-size");return e!=null?parseFloat(e):1};cs.containerCss=function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)};var Xt={};Xt.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)};Xt.getRawStyle=function(e,t){var n=this;if(e=e[0],e){for(var r={},a=0;a<n.properties.length;a++){var i=n.properties[a],o=n.getStylePropertyValue(e,i.name,t);o!=null&&(r[i.name]=o,r[Aa(i.name)]=o)}return r}};Xt.getIndexedStyle=function(e,t,n,r){var a=e.pstyle(t)[n][r];return a??e.cy().style().getDefaultProperty(t)[n][0]};Xt.getStylePropertyValue=function(e,t,n){var r=this;if(e=e[0],e){var a=r.properties[t];a.alias&&(a=a.pointsTo);var i=a.type,o=e.pstyle(a.name);if(o){var u=o.value,l=o.units,s=o.strValue;if(n&&i.number&&u!=null&&ne(u)){var c=e.cy().zoom(),d=function(v){return v*c},h=function(v,m){return d(v)+m},f=Ve(u),p=f?l.every(function(v){return v!=null}):l!=null;return p?f?u.map(function(v,m){return h(v,l[m])}).join(" "):h(u,l):f?u.map(function(v){return fe(v)?v:""+d(v)}).join(" "):""+d(u)}else if(s!=null)return s}return null}};Xt.getAnimationStartStyle=function(e,t){for(var n={},r=0;r<t.length;r++){var a=t[r],i=a.name,o=e.pstyle(i);o!==void 0&&(De(o)?o=this.parse(i,o.strValue):o=this.parse(i,o)),o&&(n[i]=o)}return n};Xt.getPropsList=function(e){var t=this,n=[],r=e,a=t.properties;if(r)for(var i=Object.keys(r),o=0;o<i.length;o++){var u=i[o],l=r[u],s=a[u]||a[Ko(u)],c=this.parse(s.name,l);c&&n.push(c)}return n};Xt.getNonDefaultPropertiesHash=function(e,t,n){var r=n.slice(),a,i,o,u,l,s;for(l=0;l<t.length;l++)if(a=t[l],i=e.pstyle(a,!1),i!=null)if(i.pfValue!=null)r[0]=wr(u,r[0]),r[1]=Er(u,r[1]);else for(o=i.strValue,s=0;s<o.length;s++)u=o.charCodeAt(s),r[0]=wr(u,r[0]),r[1]=Er(u,r[1]);return r};Xt.getPropertiesHash=Xt.getNonDefaultPropertiesHash;var ja={};ja.appendFromJson=function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],a=r.selector,i=r.style||r.css,o=Object.keys(i);t.selector(a);for(var u=0;u<o.length;u++){var l=o[u],s=i[l];t.css(l,s)}}return t};ja.fromJson=function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t};ja.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,a=n.properties,i={},o=0;o<a.length;o++){var u=a[o];i[u.name]=u.strValue}e.push({selector:r?r.toString():"core",style:i})}return e};var ds={};ds.appendFromString=function(e){var t=this,n=this,r=""+e,a,i,o;r=r.replace(/[/][*](\s|.)+?[*][/]/g,"");function u(){r.length>a.length?r=r.substr(a.length):r=""}function l(){i.length>o.length?i=i.substr(o.length):i=""}for(;;){var s=r.match(/^\s*$/);if(s)break;var c=r.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!c){Ne("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+r);break}a=c[0];var d=c[1];if(d!=="core"){var h=new cn(d);if(h.invalid){Ne("Skipping parsing of block: Invalid selector found in string stylesheet: "+d),u();continue}}var f=c[2],p=!1;i=f;for(var v=[];;){var m=i.match(/^\s*$/);if(m)break;var g=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!g){Ne("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+f),p=!0;break}o=g[0];var y=g[1],b=g[2],w=t.properties[y];if(!w){Ne("Skipping property: Invalid property name in: "+o),l();continue}var k=n.parse(y,b);if(!k){Ne("Skipping property: Invalid property definition in: "+o),l();continue}v.push({name:y,val:b}),l()}if(p){u();break}n.selector(d);for(var C=0;C<v.length;C++){var x=v[C];n.css(x.name,x.val)}u()}return n};ds.fromString=function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t};var Qe={};(function(){var e=et,t=yh,n=bh,r=xh,a=wh,i=function(O){return"^"+O+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(O){var z=e+"|\\w+|"+t+"|"+n+"|"+r+"|"+a;return"^"+O+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+e+")\\s*\\,\\s*("+e+")\\s*,\\s*("+z+")\\s*\\,\\s*("+z+")\\)$"},u=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];Qe.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:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("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:u,singleRegexMatchValue:!0},urls:{regexes:u,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(O,z){switch(O.length){case 2:return z[0]!=="deg"&&z[0]!=="rad"&&z[1]!=="deg"&&z[1]!=="rad";case 1:return fe(O[0])||z[0]==="deg"||z[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(O){var z=O.length;return z===1||z===2||z===4}}};var l={zeroNonZero:function(O,z){return(O==null||z==null)&&O!==z||O==0&&z!=0?!0:O!=0&&z==0},any:function(O,z){return O!=z},emptyNonEmpty:function(O,z){var H=sn(O),te=sn(z);return H&&!te||!H&&te}},s=Qe.types,c=[{name:"label",type:s.text,triggersBounds:l.any,triggersZOrder:l.emptyNonEmpty},{name:"text-rotation",type:s.textRotation,triggersBounds:l.any},{name:"text-margin-x",type:s.bidirectionalSize,triggersBounds:l.any},{name:"text-margin-y",type:s.bidirectionalSize,triggersBounds:l.any}],d=[{name:"source-label",type:s.text,triggersBounds:l.any},{name:"source-text-rotation",type:s.textRotation,triggersBounds:l.any},{name:"source-text-margin-x",type:s.bidirectionalSize,triggersBounds:l.any},{name:"source-text-margin-y",type:s.bidirectionalSize,triggersBounds:l.any},{name:"source-text-offset",type:s.size,triggersBounds:l.any}],h=[{name:"target-label",type:s.text,triggersBounds:l.any},{name:"target-text-rotation",type:s.textRotation,triggersBounds:l.any},{name:"target-text-margin-x",type:s.bidirectionalSize,triggersBounds:l.any},{name:"target-text-margin-y",type:s.bidirectionalSize,triggersBounds:l.any},{name:"target-text-offset",type:s.size,triggersBounds:l.any}],f=[{name:"font-family",type:s.fontFamily,triggersBounds:l.any},{name:"font-style",type:s.fontStyle,triggersBounds:l.any},{name:"font-weight",type:s.fontWeight,triggersBounds:l.any},{name:"font-size",type:s.size,triggersBounds:l.any},{name:"text-transform",type:s.textTransform,triggersBounds:l.any},{name:"text-wrap",type:s.textWrap,triggersBounds:l.any},{name:"text-overflow-wrap",type:s.textOverflowWrap,triggersBounds:l.any},{name:"text-max-width",type:s.size,triggersBounds:l.any},{name:"text-outline-width",type:s.size,triggersBounds:l.any},{name:"line-height",type:s.positiveNumber,triggersBounds:l.any}],p=[{name:"text-valign",type:s.valign,triggersBounds:l.any},{name:"text-halign",type:s.halign,triggersBounds:l.any},{name:"color",type:s.color},{name:"text-outline-color",type:s.color},{name:"text-outline-opacity",type:s.zeroOneNumber},{name:"text-background-color",type:s.color},{name:"text-background-opacity",type:s.zeroOneNumber},{name:"text-background-padding",type:s.size,triggersBounds:l.any},{name:"text-border-opacity",type:s.zeroOneNumber},{name:"text-border-color",type:s.color},{name:"text-border-width",type:s.size,triggersBounds:l.any},{name:"text-border-style",type:s.borderStyle,triggersBounds:l.any},{name:"text-background-shape",type:s.textBackgroundShape,triggersBounds:l.any},{name:"text-justification",type:s.justification},{name:"box-select-labels",type:s.bool,triggersBounds:l.any}],v=[{name:"events",type:s.bool,triggersZOrder:l.any},{name:"text-events",type:s.bool,triggersZOrder:l.any},{name:"box-selection",type:s.boxSelection,triggersZOrder:l.any}],m=[{name:"display",type:s.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfConnectedEdges:l.any,triggersBoundsOfParallelEdges:function(O,z,H){return O===z?!1:H.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:s.visibility,triggersZOrder:l.any},{name:"opacity",type:s.zeroOneNumber,triggersZOrder:l.zeroNonZero},{name:"text-opacity",type:s.zeroOneNumber},{name:"min-zoomed-font-size",type:s.size},{name:"z-compound-depth",type:s.zCompoundDepth,triggersZOrder:l.any},{name:"z-index-compare",type:s.zIndexCompare,triggersZOrder:l.any},{name:"z-index",type:s.number,triggersZOrder:l.any}],g=[{name:"overlay-padding",type:s.size,triggersBounds:l.any},{name:"overlay-color",type:s.color},{name:"overlay-opacity",type:s.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"overlay-shape",type:s.overlayShape,triggersBounds:l.any},{name:"overlay-corner-radius",type:s.cornerRadius}],y=[{name:"underlay-padding",type:s.size,triggersBounds:l.any},{name:"underlay-color",type:s.color},{name:"underlay-opacity",type:s.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"underlay-shape",type:s.overlayShape,triggersBounds:l.any},{name:"underlay-corner-radius",type:s.cornerRadius}],b=[{name:"transition-property",type:s.propList},{name:"transition-duration",type:s.time},{name:"transition-delay",type:s.time},{name:"transition-timing-function",type:s.easing}],w=function(O,z){return z.value==="label"?-O.poolIndex():z.pfValue},k=[{name:"height",type:s.nodeSize,triggersBounds:l.any,hashOverride:w},{name:"width",type:s.nodeSize,triggersBounds:l.any,hashOverride:w},{name:"shape",type:s.nodeShape,triggersBounds:l.any},{name:"shape-polygon-points",type:s.polygonPointList,triggersBounds:l.any},{name:"corner-radius",type:s.cornerRadius},{name:"background-color",type:s.color},{name:"background-fill",type:s.fill},{name:"background-opacity",type:s.zeroOneNumber},{name:"background-blacken",type:s.nOneOneNumber},{name:"background-gradient-stop-colors",type:s.colors},{name:"background-gradient-stop-positions",type:s.percentages},{name:"background-gradient-direction",type:s.gradientDirection},{name:"padding",type:s.sizeMaybePercent,triggersBounds:l.any},{name:"padding-relative-to",type:s.paddingRelativeTo,triggersBounds:l.any},{name:"bounds-expansion",type:s.boundsExpansion,triggersBounds:l.any}],C=[{name:"border-color",type:s.color},{name:"border-opacity",type:s.zeroOneNumber},{name:"border-width",type:s.size,triggersBounds:l.any},{name:"border-style",type:s.borderStyle},{name:"border-cap",type:s.lineCap},{name:"border-join",type:s.lineJoin},{name:"border-dash-pattern",type:s.numbers},{name:"border-dash-offset",type:s.number},{name:"border-position",type:s.linePosition}],x=[{name:"outline-color",type:s.color},{name:"outline-opacity",type:s.zeroOneNumber},{name:"outline-width",type:s.size,triggersBounds:l.any},{name:"outline-style",type:s.borderStyle},{name:"outline-offset",type:s.size,triggersBounds:l.any}],P=[{name:"background-image",type:s.urls},{name:"background-image-crossorigin",type:s.bgCrossOrigin},{name:"background-image-opacity",type:s.zeroOneNumbers},{name:"background-image-containment",type:s.bgContainment},{name:"background-image-smoothing",type:s.bools},{name:"background-position-x",type:s.bgPos},{name:"background-position-y",type:s.bgPos},{name:"background-width-relative-to",type:s.bgRelativeTo},{name:"background-height-relative-to",type:s.bgRelativeTo},{name:"background-repeat",type:s.bgRepeat},{name:"background-fit",type:s.bgFit},{name:"background-clip",type:s.bgClip},{name:"background-width",type:s.bgWH},{name:"background-height",type:s.bgWH},{name:"background-offset-x",type:s.bgPos},{name:"background-offset-y",type:s.bgPos}],B=[{name:"position",type:s.position,triggersBounds:l.any},{name:"compound-sizing-wrt-labels",type:s.compoundIncludeLabels,triggersBounds:l.any},{name:"min-width",type:s.size,triggersBounds:l.any},{name:"min-width-bias-left",type:s.sizeMaybePercent,triggersBounds:l.any},{name:"min-width-bias-right",type:s.sizeMaybePercent,triggersBounds:l.any},{name:"min-height",type:s.size,triggersBounds:l.any},{name:"min-height-bias-top",type:s.sizeMaybePercent,triggersBounds:l.any},{name:"min-height-bias-bottom",type:s.sizeMaybePercent,triggersBounds:l.any}],D=[{name:"line-style",type:s.lineStyle},{name:"line-color",type:s.color},{name:"line-fill",type:s.fill},{name:"line-cap",type:s.lineCap},{name:"line-opacity",type:s.zeroOneNumber},{name:"line-dash-pattern",type:s.numbers},{name:"line-dash-offset",type:s.number},{name:"line-outline-width",type:s.size},{name:"line-outline-color",type:s.color},{name:"line-gradient-stop-colors",type:s.colors},{name:"line-gradient-stop-positions",type:s.percentages},{name:"curve-style",type:s.curveStyle,triggersBounds:l.any,triggersBoundsOfParallelEdges:function(O,z){return O===z?!1:O==="bezier"||z==="bezier"}},{name:"haystack-radius",type:s.zeroOneNumber,triggersBounds:l.any},{name:"source-endpoint",type:s.edgeEndpoint,triggersBounds:l.any},{name:"target-endpoint",type:s.edgeEndpoint,triggersBounds:l.any},{name:"control-point-step-size",type:s.size,triggersBounds:l.any},{name:"control-point-distances",type:s.bidirectionalSizes,triggersBounds:l.any},{name:"control-point-weights",type:s.numbers,triggersBounds:l.any},{name:"segment-distances",type:s.bidirectionalSizes,triggersBounds:l.any},{name:"segment-weights",type:s.numbers,triggersBounds:l.any},{name:"segment-radii",type:s.numbers,triggersBounds:l.any},{name:"radius-type",type:s.radiusType,triggersBounds:l.any},{name:"taxi-turn",type:s.bidirectionalSizeMaybePercent,triggersBounds:l.any},{name:"taxi-turn-min-distance",type:s.size,triggersBounds:l.any},{name:"taxi-direction",type:s.axisDirection,triggersBounds:l.any},{name:"taxi-radius",type:s.number,triggersBounds:l.any},{name:"edge-distances",type:s.edgeDistances,triggersBounds:l.any},{name:"arrow-scale",type:s.positiveNumber,triggersBounds:l.any},{name:"loop-direction",type:s.angle,triggersBounds:l.any},{name:"loop-sweep",type:s.angle,triggersBounds:l.any},{name:"source-distance-from-node",type:s.size,triggersBounds:l.any},{name:"target-distance-from-node",type:s.size,triggersBounds:l.any}],_=[{name:"ghost",type:s.bool,triggersBounds:l.any},{name:"ghost-offset-x",type:s.bidirectionalSize,triggersBounds:l.any},{name:"ghost-offset-y",type:s.bidirectionalSize,triggersBounds:l.any},{name:"ghost-opacity",type:s.zeroOneNumber}],T=[{name:"selection-box-color",type:s.color},{name:"selection-box-opacity",type:s.zeroOneNumber},{name:"selection-box-border-color",type:s.color},{name:"selection-box-border-width",type:s.size},{name:"active-bg-color",type:s.color},{name:"active-bg-opacity",type:s.zeroOneNumber},{name:"active-bg-size",type:s.size},{name:"outside-texture-bg-color",type:s.color},{name:"outside-texture-bg-opacity",type:s.zeroOneNumber}],S=[];Qe.pieBackgroundN=16,S.push({name:"pie-size",type:s.sizeMaybePercent}),S.push({name:"pie-hole",type:s.sizeMaybePercent}),S.push({name:"pie-start-angle",type:s.angle});for(var A=1;A<=Qe.pieBackgroundN;A++)S.push({name:"pie-"+A+"-background-color",type:s.color}),S.push({name:"pie-"+A+"-background-size",type:s.percent}),S.push({name:"pie-"+A+"-background-opacity",type:s.zeroOneNumber});var N=[];Qe.stripeBackgroundN=16,N.push({name:"stripe-size",type:s.sizeMaybePercent}),N.push({name:"stripe-direction",type:s.axisDirectionPrimary});for(var R=1;R<=Qe.stripeBackgroundN;R++)N.push({name:"stripe-"+R+"-background-color",type:s.color}),N.push({name:"stripe-"+R+"-background-size",type:s.percent}),N.push({name:"stripe-"+R+"-background-opacity",type:s.zeroOneNumber});var M=[],L=Qe.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:s.arrowShape,triggersBounds:l.any},{name:"arrow-color",type:s.color},{name:"arrow-fill",type:s.arrowFill},{name:"arrow-width",type:s.arrowWidth}].forEach(function(O){L.forEach(function(z){var H=z+"-"+O.name,te=O.type,ae=O.triggersBounds;M.push({name:H,type:te,triggersBounds:ae})})},{});var I=Qe.properties=[].concat(v,b,m,g,y,_,p,f,c,d,h,k,C,x,P,S,N,B,D,M,T),j=Qe.propertyGroups={behavior:v,transition:b,visibility:m,overlay:g,underlay:y,ghost:_,commonLabel:p,labelDimensions:f,mainLabel:c,sourceLabel:d,targetLabel:h,nodeBody:k,nodeBorder:C,nodeOutline:x,backgroundImage:P,pie:S,stripe:N,compound:B,edgeLine:D,edgeArrow:M,core:T},F=Qe.propertyGroupNames={},Y=Qe.propertyGroupKeys=Object.keys(j);Y.forEach(function(O){F[O]=j[O].map(function(z){return z.name}),j[O].forEach(function(z){return z.groupKey=O})});var W=Qe.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"}];Qe.propertyNames=I.map(function(O){return O.name});for(var Q=0;Q<I.length;Q++){var $=I[Q];I[$.name]=$}for(var Z=0;Z<W.length;Z++){var J=W[Z],re=I[J.pointsTo],V={name:J.name,alias:!0,pointsTo:re};I.push(V),I[J.name]=V}})();Qe.getDefaultProperty=function(e){return this.getDefaultProperties()[e]};Qe.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(l,s){for(var c=1;c<=Qe.pieBackgroundN;c++){var d=s.name.replace("{{i}}",c),h=s.value;l[d]=h}return l},{}),{"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(l,s){for(var c=1;c<=Qe.stripeBackgroundN;c++){var d=s.name.replace("{{i}}",c),h=s.value;l[d]=h}return l},{}),{"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(l,s){return Qe.arrowPrefixes.forEach(function(c){var d=c+"-"+s.name,h=s.value;l[d]=h}),l},{})),n={},r=0;r<this.properties.length;r++){var a=this.properties[r];if(!a.pointsTo){var i=a.name,o=t[i],u=this.parse(i,o);n[i]=u}}return e.defaultProperties=n,e.defaultProperties};Qe.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 qa={};qa.parse=function(e,t,n,r){var a=this;if(Ue(t))return a.parseImplWarn(e,t,n,r);var i=r==="mapping"||r===!0||r===!1||r==null?"dontcare":r,o=n?"t":"f",u=""+t,l=dc(e,u,o,i),s=a.propCache=a.propCache||[],c;return(c=s[l])||(c=s[l]=a.parseImplWarn(e,t,n,r)),(n||r==="mapping")&&(c=Ft(c),c&&(c.value=Ft(c.value))),c};qa.parseImplWarn=function(e,t,n,r){var a=this.parseImpl(e,t,n,r);return!a&&t!=null&&Ne("The style property `".concat(e,": ").concat(t,"` is invalid")),a&&(a.name==="width"||a.name==="height")&&t==="label"&&Ne("The style value of `label` is deprecated for `"+a.name+"`"),a};qa.parseImpl=function(e,t,n,r){var a=this;e=Ko(e);var i=a.properties[e],o=t,u=a.types;if(!i||t===void 0)return null;i.alias&&(i=i.pointsTo,e=i.name);var l=fe(t);l&&(t=t.trim());var s=i.type;if(!s)return null;if(n&&(t===""||t===null))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(Ue(t))return{name:e,value:t,strValue:"fn",mapped:u.fn,bypass:n};var c,d;if(!(!l||r||t.length<7||t[1]!=="a")){if(t.length>=7&&t[0]==="d"&&(c=new RegExp(u.data.regex).exec(t))){if(n)return!1;var h=u.data;return{name:e,value:c,strValue:""+t,mapped:h,field:c[1],bypass:n}}else if(t.length>=10&&t[0]==="m"&&(d=new RegExp(u.mapData.regex).exec(t))){if(n||s.multiple)return!1;var f=u.mapData;if(!(s.color||s.number))return!1;var p=this.parse(e,d[4]);if(!p||p.mapped)return!1;var v=this.parse(e,d[5]);if(!v||v.mapped)return!1;if(p.pfValue===v.pfValue||p.strValue===v.strValue)return Ne("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+p.strValue+"`"),this.parse(e,p.strValue);if(s.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:d,strValue:""+t,mapped:f,field:d[1],fieldMin:parseFloat(d[2]),fieldMax:parseFloat(d[3]),valueMin:p.value,valueMax:v.value,bypass:n}}}if(s.multiple&&r!=="multiple"){var b;if(l?b=t.split(/\s+/):Ve(t)?b=t:b=[t],s.evenMultiple&&b.length%2!==0)return null;for(var w=[],k=[],C=[],x="",P=!1,B=0;B<b.length;B++){var D=a.parse(e,b[B],n,"multiple");P=P||fe(D.value),w.push(D.value),C.push(D.pfValue!=null?D.pfValue:D.value),k.push(D.units),x+=(B>0?" ":"")+D.strValue}return s.validate&&!s.validate(w,k)?null:s.singleEnum&&P?w.length===1&&fe(w[0])?{name:e,value:w[0],strValue:w[0],bypass:n}:null:{name:e,value:w,pfValue:C,strValue:x,bypass:n,units:k}}var _=function(){for(var re=0;re<s.enums.length;re++){var V=s.enums[re];if(V===t)return{name:e,value:t,strValue:""+t,bypass:n}}return null};if(s.number){var T,S="px";if(s.units&&(T=s.units),s.implicitUnits&&(S=s.implicitUnits),!s.unitless)if(l){var A="px|em"+(s.allowPercent?"|\\%":"");T&&(A=T);var N=t.match("^("+et+")("+A+")?$");N&&(t=N[1],T=N[2]||S)}else(!T||s.implicitUnits)&&(T=S);if(t=parseFloat(t),isNaN(t)&&s.enums===void 0)return null;if(isNaN(t)&&s.enums!==void 0)return t=o,_();if(s.integer&&!ch(t)||s.min!==void 0&&(t<s.min||s.strictMin&&t===s.min)||s.max!==void 0&&(t>s.max||s.strictMax&&t===s.max))return null;var R={name:e,value:t,strValue:""+t+(T||""),units:T,bypass:n};return s.unitless||T!=="px"&&T!=="em"?R.pfValue=t:R.pfValue=T==="px"||!T?t:this.getEmSizeInPixels()*t,(T==="ms"||T==="s")&&(R.pfValue=T==="ms"?t:1e3*t),(T==="deg"||T==="rad")&&(R.pfValue=T==="rad"?t:wf(t)),T==="%"&&(R.pfValue=t/100),R}else if(s.propList){var M=[],L=""+t;if(L!=="none"){for(var I=L.split(/\s*,\s*|\s+/),j=0;j<I.length;j++){var F=I[j].trim();a.properties[F]?M.push(F):Ne("`"+F+"` is not a valid property name")}if(M.length===0)return null}return{name:e,value:M,strValue:M.length===0?"none":M.join(" "),bypass:n}}else if(s.color){var Y=ac(t);return Y?{name:e,value:Y,pfValue:Y,strValue:"rgb("+Y[0]+","+Y[1]+","+Y[2]+")",bypass:n}:null}else if(s.regex||s.regexes){if(s.enums){var W=_();if(W)return W}for(var Q=s.regexes?s.regexes:[s.regex],$=0;$<Q.length;$++){var Z=new RegExp(Q[$]),J=Z.exec(t);if(J)return{name:e,value:s.singleRegexMatchValue?J[1]:J,strValue:""+t,bypass:n}}return null}else return s.string?{name:e,value:""+t,strValue:""+t,bypass:n}:s.enums?_():null};var it=function(e){if(!(this instanceof it))return new it(e);if(!Ho(e)){qe("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},pt=it.prototype;pt.instanceString=function(){return"style"};pt.clear=function(){for(var e=this._private,t=e.cy,n=t.elements(),r=0;r<this.length;r++)this[r]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(n,!0),n.forEach(function(a){var i=a[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this};pt.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};pt.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)};pt.selector=function(e){var t=e==="core"?null:new cn(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this};pt.css=function(){var e=this,t=arguments;if(t.length===1)for(var n=t[0],r=0;r<e.properties.length;r++){var a=e.properties[r],i=n[a.name];i===void 0&&(i=n[Aa(a.name)]),i!==void 0&&this.cssRule(a.name,i)}else t.length===2&&this.cssRule(t[0],t[1]);return this};pt.style=pt.css;pt.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.name.match(/stripe-(\d+)-background-size/)&&n.value&&(this._private.hasStripe=!0),n.mapped&&this[r].mappedProperties.push(n);var a=!this[r].selector;a&&(this._private.coreStyle[n.name]=n)}return this};pt.append=function(e){return tc(e)?e.appendToStyle(this):Ve(e)?this.appendFromJson(e):fe(e)&&this.appendFromString(e),this};it.fromJson=function(e,t){var n=new it(e);return n.fromJson(t),n};it.fromString=function(e,t){return new it(e).fromString(t)};[ot,Vr,cs,Xt,ja,ds,Qe,qa].forEach(function(e){ge(pt,e)});it.types=pt.types;it.properties=pt.properties;it.propertyGroups=pt.propertyGroups;it.propertyGroupNames=pt.propertyGroupNames;it.propertyGroupKeys=pt.propertyGroupKeys;var Cv={style:function(e){if(e){var t=this.setStyle(e);t.update()}return this._private.style},setStyle:function(e){var t=this._private;return tc(e)?t.style=e.generateStyle(this):Ve(e)?t.style=it.fromJson(this,e):fe(e)?t.style=it.fromString(this,e):t.style=it(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},Pv="single",Dn={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=Pv),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,n,r,a,i,o;switch(e.length){case 0:return t;case 1:if(fe(e[0]))return n=e[0],t[n];if(De(e[0])){if(!this._private.panningEnabled)return this;a=e[0],i=a.x,o=a.y,ne(i)&&(t.x=i),ne(o)&&(t.y=o),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],r=e[1],(n==="x"||n==="y")&&ne(r)&&(t[n]=r),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,t){var n=arguments,r=this._private.pan,a,i,o,u,l;if(!this._private.panningEnabled)return this;switch(n.length){case 1:De(e)&&(o=n[0],u=o.x,l=o.y,ne(u)&&(r.x+=u),ne(l)&&(r.y+=l),this.emit("pan viewport"));break;case 2:a=e,i=t,(a==="x"||a==="y")&&ne(i)&&(r[a]+=i),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.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 n;if(fe(e)){var r=e;e=this.$(r)}else if(fh(e)){var a=e;n={x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else Pt(e)||(e=this.mutableElements());if(!(Pt(e)&&e.empty())){n=n||e.boundingBox();var i=this.width(),o=this.height(),u;if(t=ne(t)?t:0,!isNaN(i)&&!isNaN(o)&&i>0&&o>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){u=Math.min((i-2*t)/n.w,(o-2*t)/n.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u<this._private.minZoom?this._private.minZoom:u;var l={x:(i-u*(n.x1+n.x2))/2,y:(o-u*(n.y1+n.y2))/2};return{zoom:u,pan:l}}}}},zoomRange:function(e,t){var n=this._private;if(t==null){var r=e;e=r.min,t=r.max}return ne(e)&&ne(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):ne(e)&&t===void 0&&e<=n.maxZoom?n.minZoom=e:ne(t)&&e===void 0&&t>=n.minZoom&&(n.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,n=t.pan,r=t.zoom,a,i,o=!1;if(t.zoomingEnabled||(o=!0),ne(e)?i=e:De(e)&&(i=e.level,e.position!=null?a=Ra(e.position,r,n):e.renderedPosition!=null&&(a=e.renderedPosition),a!=null&&!t.panningEnabled&&(o=!0)),i=i>t.maxZoom?t.maxZoom:i,i=i<t.minZoom?t.minZoom:i,o||!ne(i)||i===r||a!=null&&(!ne(a.x)||!ne(a.y)))return null;if(a!=null){var u=n,l=r,s=i,c={x:-s/l*(a.x-u.x)+a.x,y:-s/l*(a.y-u.y)+a.y};return{zoomed:!0,panned:!0,zoom:s,pan:c}}else return{zoomed:!0,panned:!1,zoom:i,pan:n}},zoom:function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return t==null||!t.zoomed?this:(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var t=this._private,n=!0,r=!0,a=[],i=!1,o=!1;if(!e)return this;if(ne(e.zoom)||(n=!1),De(e.pan)||(r=!1),!n&&!r)return this;if(n){var u=e.zoom;u<t.minZoom||u>t.maxZoom||!t.zoomingEnabled?i=!0:(t.zoom=u,a.push("zoom"))}if(r&&(!i||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;ne(l.x)&&(t.pan.x=l.x,o=!1),ne(l.y)&&(t.pan.y=l.y,o=!1),o||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.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 n=e;e=this.mutableElements().filter(n)}else Pt(e)||(e=this.mutableElements());if(e.length!==0){var r=e.boundingBox(),a=this.width(),i=this.height();t=t===void 0?this._private.zoom:t;var o={x:(a-t*(r.x1+r.x2))/2,y:(i-t*(r.y1+r.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,n=this;return e.sizeCache=e.sizeCache||(t?function(){var r=n.window().getComputedStyle(t),a=function(i){return parseFloat(r.getPropertyValue(i))};return{width:t.clientWidth-a("padding-left")-a("padding-right"),height:t.clientHeight-a("padding-top")-a("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,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},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}};Dn.centre=Dn.center;Dn.autolockNodes=Dn.autolock;Dn.autoungrabifyNodes=Dn.autoungrabify;var Br={data:Le.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Le.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Le.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Le.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Br.attr=Br.data;Br.removeAttr=Br.removeData;var Dr=function(e){var t=this;e=ge({},e);var n=e.container;n&&!ya(n)&&ya(n[0])&&(n=n[0]);var r=n?n._cyreg:null;r=r||{},r&&r.cy&&(r.cy.destroy(),r={});var a=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var i=Je!==void 0&&n!==void 0&&!e.headless,o=e;o.layout=ge({name:i?"grid":"null"},o.layout),o.renderer=ge({name:i?"canvas":"null"},o.renderer);var u=function(h,f,p){return f!==void 0?f:p!==void 0?p:h},l=this._private={container:n,ready:!1,options:o,elements:new ut(this),listeners:[],aniEles:new ut(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,o.zoomingEnabled),userZoomingEnabled:u(!0,o.userZoomingEnabled),panningEnabled:u(!0,o.panningEnabled),userPanningEnabled:u(!0,o.userPanningEnabled),boxSelectionEnabled:u(!0,o.boxSelectionEnabled),autolock:u(!1,o.autolock,o.autolockNodes),autoungrabify:u(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:u(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?i:o.styleEnabled,zoom:ne(o.zoom)?o.zoom:1,pan:{x:De(o.pan)&&ne(o.pan.x)?o.pan.x:0,y:De(o.pan)&&ne(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var s=function(h,f){var p=h.some(ph);if(p)return tr.all(h).then(f);f(h)};l.styleEnabled&&t.setStyle([]);var c=ge({},o,o.renderer);t.initRenderer(c);var d=function(h,f,p){t.notifications(!1);var v=t.mutableElements();v.length>0&&v.remove(),h!=null&&(De(h)||Ve(h))&&t.add(h),t.one("layoutready",function(g){t.notifications(!0),t.emit(g),t.one("load",f),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()};s([o.style,o.elements],function(h){var f=h[0],p=h[1];l.styleEnabled&&t.style().append(f),d(p,function(){t.startAnimationLoop(),l.ready=!0,Ue(o.ready)&&t.on("ready",o.ready);for(var v=0;v<a.length;v++){var m=a[v];t.on("ready",m)}r&&(r.readies=[]),t.emit("ready")},o.done)})},Ta=Dr.prototype;ge(Ta,{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,n=t._private,r=n.options;return!ya(e)&&ya(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(ge({},r,r.renderer,{name:r.renderer.name==="null"?"canvas":r.renderer.name})),t.startAnimationLoop(),t.style(r.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 Ft(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements(),a=function(y){return t.getElementById(y.id())};if(De(e)){if(t.startBatch(),e.elements){var i={},o=function(y,b){for(var w=[],k=[],C=0;C<y.length;C++){var x=y[C];if(!x.data.id){Ne("cy.json() cannot handle elements without an ID attribute");continue}var P=""+x.data.id,B=t.getElementById(P);i[P]=!0,B.length!==0?k.push({ele:B,json:x}):(b&&(x.group=b),w.push(x))}t.add(w);for(var D=0;D<k.length;D++){var _=k[D],T=_.ele,S=_.json;T.json(S)}};if(Ve(e.elements))o(e.elements);else for(var u=["nodes","edges"],l=0;l<u.length;l++){var s=u[l],c=e.elements[s];Ve(c)&&o(c,s)}var d=t.collection();r.filter(function(y){return!i[y.id()]}).forEach(function(y){y.isParent()?d.merge(y):y.remove()}),d.forEach(function(y){return y.children().move({parent:null})}),d.forEach(function(y){return a(y).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],f=0;f<h.length;f++){var p=h[f];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={},r.forEach(function(y){var b=y.group();m.elements[b]||(m.elements[b]=[]),m.elements[b].push(y.json())})),this._private.styleEnabled&&(m.style=t.style().json()),m.data=Ft(t.data());var g=n.options;return m.zoomingEnabled=n.zoomingEnabled,m.userZoomingEnabled=n.userZoomingEnabled,m.zoom=n.zoom,m.minZoom=n.minZoom,m.maxZoom=n.maxZoom,m.panningEnabled=n.panningEnabled,m.userPanningEnabled=n.userPanningEnabled,m.pan=Ft(n.pan),m.boxSelectionEnabled=n.boxSelectionEnabled,m.renderer=Ft(g.renderer),m.hideEdgesOnViewport=g.hideEdgesOnViewport,m.textureOnViewport=g.textureOnViewport,m.wheelSensitivity=g.wheelSensitivity,m.motionBlur=g.motionBlur,m.multiClickDebounceTime=g.multiClickDebounceTime,m}}});Ta.$id=Ta.getElementById;[gv,xv,td,No,da,Ev,Oo,ha,Cv,Dn,Br].forEach(function(e){ge(Ta,e)});var _v={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}},Bv={maximal:!1,acyclic:!1},On=function(e){return e.scratch("breadthfirst")},ku=function(e,t){return e.scratch("breadthfirst",t)};function nd(e){this.options=ge({},_v,Bv,e)}nd.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=n.nodes().filter(function(ee){return ee.isChildless()}),a=n,i=e.directed,o=e.acyclic||e.maximal||e.maximalAdjustments>0,u=!!e.boundingBox,l=bt(u?e.boundingBox:structuredClone(t.extent())),s;if(Pt(e.roots))s=e.roots;else if(Ve(e.roots)){for(var c=[],d=0;d<e.roots.length;d++){var h=e.roots[d],f=t.getElementById(h);c.push(f)}s=t.collection(c)}else if(fe(e.roots))s=t.$(e.roots);else if(i)s=r.roots();else{var p=n.components();s=t.collection();for(var v=function(){var ee=p[m],ue=ee.maxDegree(!1),ce=ee.filter(function(me){return me.degree(!1)===ue});s=s.add(ce)},m=0;m<p.length;m++)v()}var g=[],y={},b=function(ee,ue){g[ue]==null&&(g[ue]=[]);var ce=g[ue].length;g[ue].push(ee),ku(ee,{index:ce,depth:ue})},w=function(ee,ue){var ce=On(ee),me=ce.depth,be=ce.index;g[me][be]=null,ee.isChildless()&&b(ee,ue)};a.bfs({roots:s,directed:e.directed,visit:function(ee,ue,ce,me,be){var Ee=ee[0],_e=Ee.id();Ee.isChildless()&&b(Ee,be),y[_e]=!0}});for(var k=[],C=0;C<r.length;C++){var x=r[C];y[x.id()]||k.push(x)}var P=function(ee){for(var ue=g[ee],ce=0;ce<ue.length;ce++){var me=ue[ce];if(me==null){ue.splice(ce,1),ce--;continue}ku(me,{depth:ee,index:ce})}},B=function(ee,ue){for(var ce=On(ee),me=ee.incomers().filter(function(Se){return Se.isNode()&&n.has(Se)}),be=-1,Ee=ee.id(),_e=0;_e<me.length;_e++){var Oe=me[_e],Fe=On(Oe);be=Math.max(be,Fe.depth)}if(ce.depth<=be){if(!e.acyclic&&ue[Ee])return null;var Re=be+1;return w(ee,Re),ue[Ee]=Re,!0}return!1};if(i&&o){var D=[],_={},T=function(ee){return D.push(ee)},S=function(){return D.shift()};for(r.forEach(function(ee){return D.push(ee)});D.length>0;){var A=S(),N=B(A,_);if(N)A.outgoers().filter(function(ee){return ee.isNode()&&n.has(ee)}).forEach(T);else if(N===null){Ne("Detected double maximal shift for node `"+A.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var R=0;if(e.avoidOverlap)for(var M=0;M<r.length;M++){var L=r[M],I=L.layoutDimensions(e),j=I.w,F=I.h;R=Math.max(R,j,F)}var Y={},W=function(ee){if(Y[ee.id()])return Y[ee.id()];for(var ue=On(ee).depth,ce=ee.neighborhood(),me=0,be=0,Ee=0;Ee<ce.length;Ee++){var _e=ce[Ee];if(!(_e.isEdge()||_e.isParent()||!r.has(_e))){var Oe=On(_e);if(Oe!=null){var Fe=Oe.index,Re=Oe.depth;if(!(Fe==null||Re==null)){var Se=g[Re].length;Re<ue&&(me+=Fe/Se,be++)}}}}return be=Math.max(1,be),me=me/be,be===0&&(me=0),Y[ee.id()]=me,me},Q=function(ee,ue){var ce=W(ee),me=W(ue),be=ce-me;return be===0?rc(ee.id(),ue.id()):be};e.depthSort!==void 0&&(Q=e.depthSort);for(var $=g.length,Z=0;Z<$;Z++)g[Z].sort(Q),P(Z);for(var J=[],re=0;re<k.length;re++)J.push(k[re]);var V=function(){for(var ee=0;ee<$;ee++)P(ee)};J.length&&(g.unshift(J),$=g.length,V());for(var O=0,z=0;z<$;z++)O=Math.max(g[z].length,O);var H={x:l.x1+l.w/2,y:l.y1+l.h/2},te=r.reduce(function(ee,ue){return function(ce){return{w:ee.w===-1?ce.w:(ee.w+ce.w)/2,h:ee.h===-1?ce.h:(ee.h+ce.h)/2}}(ue.boundingBox({includeLabels:e.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),ae=Math.max($===1?0:u?(l.h-e.padding*2-te.h)/($-1):(l.h-e.padding*2-te.h)/($+1),R),we=g.reduce(function(ee,ue){return Math.max(ee,ue.length)},0),ye=function(ee){var ue=On(ee),ce=ue.depth,me=ue.index;if(e.circle){var be=Math.min(l.w/2/$,l.h/2/$);be=Math.max(be,R);var Ee=be*ce+be-($>0&&g[0].length<=3?be/2:0),_e=2*Math.PI/g[ce].length*me;return ce===0&&g[0].length===1&&(Ee=1),{x:H.x+Ee*Math.cos(_e),y:H.y+Ee*Math.sin(_e)}}else{var Oe=g[ce].length,Fe=Math.max(Oe===1?0:u?(l.w-e.padding*2-te.w)/((e.grid?we:Oe)-1):(l.w-e.padding*2-te.w)/((e.grid?we:Oe)+1),R),Re={x:H.x+(me+1-(Oe+1)/2)*Fe,y:H.y+(ce+1-($+1)/2)*ae};return Re}},xe={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(xe).indexOf(e.direction)===-1&&qe("Invalid direction '".concat(e.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(xe).join(", ")));var Ae=function(ee){return jh(ye(ee),l,xe[e.direction])};return n.nodes().layoutPositions(this,e,Ae),this};var Dv={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 rd(e){this.options=ge({},Dv,e)}rd.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));for(var o=bt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),u={x:o.x1+o.w/2,y:o.y1+o.h/2},l=t.sweep===void 0?2*Math.PI-2*Math.PI/i.length:t.sweep,s=l/Math.max(1,i.length-1),c,d=0,h=0;h<i.length;h++){var f=i[h],p=f.layoutDimensions(t),v=p.w,m=p.h;d=Math.max(d,v,m)}if(ne(t.radius)?c=t.radius:i.length<=1?c=0:c=Math.min(o.h,o.w)/2-d,i.length>1&&t.avoidOverlap){d*=1.75;var g=Math.cos(s)-Math.cos(0),y=Math.sin(s)-Math.sin(0),b=Math.sqrt(d*d/(g*g+y*y));c=Math.max(b,c)}var w=function(k,C){var x=t.startAngle+C*s*(a?1:-1),P=c*Math.cos(x),B=c*Math.sin(x),D={x:u.x+P,y:u.y+B};return D};return r.nodes().layoutPositions(this,t,w),this};var Av={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 ad(e){this.options=ge({},Av,e)}ad.prototype.run=function(){for(var e=this.options,t=e,n=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,r=e.cy,a=t.eles,i=a.nodes().not(":parent"),o=bt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),u={x:o.x1+o.w/2,y:o.y1+o.h/2},l=[],s=0,c=0;c<i.length;c++){var d=i[c],h=void 0;h=t.concentric(d),l.push({value:h,node:d}),d._private.scratch.concentric=h}i.updateStyle();for(var f=0;f<i.length;f++){var p=i[f],v=p.layoutDimensions(t);s=Math.max(s,v.w,v.h)}l.sort(function(ae,we){return we.value-ae.value});for(var m=t.levelWidth(i),g=[[]],y=g[0],b=0;b<l.length;b++){var w=l[b];if(y.length>0){var k=Math.abs(y[0].value-w.value);k>=m&&(y=[],g.push(y))}y.push(w)}var C=s+t.minNodeSpacing;if(!t.avoidOverlap){var x=g.length>0&&g[0].length>1,P=Math.min(o.w,o.h)/2-C,B=P/(g.length+x?1:0);C=Math.min(C,B)}for(var D=0,_=0;_<g.length;_++){var T=g[_],S=t.sweep===void 0?2*Math.PI-2*Math.PI/T.length:t.sweep,A=T.dTheta=S/Math.max(1,T.length-1);if(T.length>1&&t.avoidOverlap){var N=Math.cos(A)-Math.cos(0),R=Math.sin(A)-Math.sin(0),M=Math.sqrt(C*C/(N*N+R*R));D=Math.max(M,D)}T.r=D,D+=C}if(t.equidistant){for(var L=0,I=0,j=0;j<g.length;j++){var F=g[j],Y=F.r-I;L=Math.max(L,Y)}I=0;for(var W=0;W<g.length;W++){var Q=g[W];W===0&&(I=Q.r),Q.r=I,I+=L}}for(var $={},Z=0;Z<g.length;Z++)for(var J=g[Z],re=J.dTheta,V=J.r,O=0;O<J.length;O++){var z=J[O],H=t.startAngle+(n?1:-1)*re*O,te={x:u.x+V*Math.cos(H),y:u.y+V*Math.sin(H)};$[z.node.id()]=te}return a.nodes().layoutPositions(this,t,function(ae){var we=ae.id();return $[we]}),this};var yo,Sv={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 Ua(e){this.options=ge({},Sv,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges(),r=n.filter(function(a){var i=a.source().data("id"),o=a.target().data("id"),u=t.some(function(s){return s.data("id")===i}),l=t.some(function(s){return s.data("id")===o});return!u||!l});this.options.eles=this.options.eles.not(r)}Ua.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,(e.animate===!0||e.animate===!1)&&n.emit({type:"layoutstart",layout:n}),e.debug===!0?yo=!0:yo=!1;var r=Mv(t,n,e);yo&&Iv(r),e.randomize&&Lv(r);var a=Gt(),i=function(){Nv(r,t,e),e.fit===!0&&t.fit(e.padding)},o=function(d){return!(n.stopped||d>=e.numIter||(Ov(r,e),r.temperature=r.temperature*e.coolingFactor,r.temperature<e.minTemp))},u=function(){if(e.animate===!0||e.animate===!1)i(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var d=e.eles.nodes(),h=od(r,e,d);d.layoutPositions(n,e,h)}},l=0,s=!0;if(e.animate===!0){var c=function(){for(var d=0;s&&d<e.refresh;)s=o(l),l++,d++;if(!s)Cu(r,e),u();else{var h=Gt();h-a>=e.animationThreshold&&i(),ma(c)}};c()}else{for(;s;)s=o(l),l++;Cu(r,e),u()}return this};Ua.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Ua.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Mv=function(e,t,n){for(var r=n.eles.edges(),a=n.eles.nodes(),i=bt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:i.w,clientHeight:i.h,boundingBox:i},u=n.eles.components(),l={},s=0;s<u.length;s++)for(var c=u[s],d=0;d<c.length;d++){var h=c[d];l[h.id()]=s}for(var s=0;s<o.nodeSize;s++){var f=a[s],p=f.layoutDimensions(n),v={};v.isLocked=f.locked(),v.id=f.data("id"),v.parentId=f.data("parent"),v.cmptId=l[f.id()],v.children=[],v.positionX=f.position("x"),v.positionY=f.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(f.style("padding")),v.padRight=parseFloat(f.style("padding")),v.padTop=parseFloat(f.style("padding")),v.padBottom=parseFloat(f.style("padding")),v.nodeRepulsion=Ue(n.nodeRepulsion)?n.nodeRepulsion(f):n.nodeRepulsion,o.layoutNodes.push(v),o.idToIndex[v.id]=s}for(var m=[],g=0,y=-1,b=[],s=0;s<o.nodeSize;s++){var f=o.layoutNodes[s],w=f.parentId;w!=null?o.layoutNodes[o.idToIndex[w]].children.push(f.id):(m[++y]=f.id,b.push(f.id))}for(o.graphSet.push(b);g<=y;){var k=m[g++],C=o.idToIndex[k],h=o.layoutNodes[C],x=h.children;if(x.length>0){o.graphSet.push(x);for(var s=0;s<x.length;s++)m[++y]=x[s]}}for(var s=0;s<o.graphSet.length;s++)for(var P=o.graphSet[s],d=0;d<P.length;d++){var B=o.idToIndex[P[d]];o.indexToGraph[B]=s}for(var s=0;s<o.edgeSize;s++){var D=r[s],_={};_.id=D.data("id"),_.sourceId=D.data("source"),_.targetId=D.data("target");var T=Ue(n.idealEdgeLength)?n.idealEdgeLength(D):n.idealEdgeLength,S=Ue(n.edgeElasticity)?n.edgeElasticity(D):n.edgeElasticity,A=o.idToIndex[_.sourceId],N=o.idToIndex[_.targetId],R=o.indexToGraph[A],M=o.indexToGraph[N];if(R!=M){for(var L=Rv(_.sourceId,_.targetId,o),I=o.graphSet[L],j=0,v=o.layoutNodes[A];I.indexOf(v.id)===-1;)v=o.layoutNodes[o.idToIndex[v.parentId]],j++;for(v=o.layoutNodes[N];I.indexOf(v.id)===-1;)v=o.layoutNodes[o.idToIndex[v.parentId]],j++;T*=j*n.nestingFactor}_.idealLength=T,_.elasticity=S,o.layoutEdges.push(_)}return o},Rv=function(e,t,n){var r=id(e,t,0,n);return 2>r.count?0:r.graph},id=function(e,t,n,r){var a=r.graphSet[n];if(-1<a.indexOf(e)&&-1<a.indexOf(t))return{count:2,graph:n};for(var i=0,o=0;o<a.length;o++){var u=a[o],l=r.idToIndex[u],s=r.layoutNodes[l].children;if(s.length!==0){var c=r.indexToGraph[r.idToIndex[s[0]]],d=id(e,t,c,r);if(d.count!==0)if(d.count===1){if(i++,i===2)break}else return d}}return{count:i,graph:n}},Iv,Lv=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,a=0;a<e.nodeSize;a++){var i=e.layoutNodes[a];i.children.length===0&&!i.isLocked&&(i.positionX=Math.random()*n,i.positionY=Math.random()*r)}},od=function(e,t,n){var r=e.boundingBox,a={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach(function(i){var o=e.layoutNodes[e.idToIndex[i.data("id")]];a.x1=Math.min(a.x1,o.positionX),a.x2=Math.max(a.x2,o.positionX),a.y1=Math.min(a.y1,o.positionY),a.y2=Math.max(a.y2,o.positionY)}),a.w=a.x2-a.x1,a.h=a.y2-a.y1),function(i,o){var u=e.layoutNodes[e.idToIndex[i.data("id")]];if(t.boundingBox){var l=a.w===0?.5:(u.positionX-a.x1)/a.w,s=a.h===0?.5:(u.positionY-a.y1)/a.h;return{x:r.x1+l*r.w,y:r.y1+s*r.h}}else return{x:u.positionX,y:u.positionY}}},Nv=function(e,t,n){var r=n.layout,a=n.eles.nodes(),i=od(e,n,a);a.positions(i),e.ready!==!0&&(e.ready=!0,r.one("layoutready",n.ready),r.emit({type:"layoutready",layout:this}))},Ov=function(e,t,n){zv(e,t),Xv(e),Yv(e,t),jv(e),qv(e)},zv=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],a=r.length,i=0;i<a;i++)for(var o=e.layoutNodes[e.idToIndex[r[i]]],u=i+1;u<a;u++){var l=e.layoutNodes[e.idToIndex[r[u]]];Vv(o,l,e,t)}},Tu=function(e){return-1+2*e*Math.random()},Vv=function(e,t,n,r){var a=e.cmptId,i=t.cmptId;if(!(a!==i&&!n.isCompound)){var o=t.positionX-e.positionX,u=t.positionY-e.positionY,l=1;o===0&&u===0&&(o=Tu(l),u=Tu(l));var s=Fv(e,t,o,u);if(s>0)var m=r.nodeOverlap*s,v=Math.sqrt(o*o+u*u),g=m*o/v,y=m*u/v;else var c=Ca(e,o,u),d=Ca(t,-1*o,-1*u),h=d.x-c.x,f=d.y-c.y,p=h*h+f*f,v=Math.sqrt(p),m=(e.nodeRepulsion+t.nodeRepulsion)/p,g=m*h/v,y=m*f/v;e.isLocked||(e.offsetX-=g,e.offsetY-=y),t.isLocked||(t.offsetX+=g,t.offsetY+=y)}},Fv=function(e,t,n,r){if(n>0)var a=e.maxX-t.minX;else var a=t.maxX-e.minX;if(r>0)var i=e.maxY-t.minY;else var i=t.maxY-e.minY;return a>=0&&i>=0?Math.sqrt(a*a+i*i):0},Ca=function(e,t,n){var r=e.positionX,a=e.positionY,i=e.height||1,o=e.width||1,u=n/t,l=i/o,s={};return t===0&&0<n||t===0&&0>n?(s.x=r,s.y=a+i/2,s):0<t&&-1*l<=u&&u<=l?(s.x=r+o/2,s.y=a+o*n/2/t,s):0>t&&-1*l<=u&&u<=l?(s.x=r-o/2,s.y=a-o*n/2/t,s):0<n&&(u<=-1*l||u>=l)?(s.x=r+i*t/2/n,s.y=a+i/2,s):(0>n&&(u<=-1*l||u>=l)&&(s.x=r-i*t/2/n,s.y=a-i/2),s)},Xv=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],a=e.idToIndex[r.sourceId],i=e.layoutNodes[a],o=e.idToIndex[r.targetId],u=e.layoutNodes[o],l=u.positionX-i.positionX,s=u.positionY-i.positionY;if(!(l===0&&s===0)){var c=Ca(i,l,s),d=Ca(u,-1*l,-1*s),h=d.x-c.x,f=d.y-c.y,p=Math.sqrt(h*h+f*f),v=Math.pow(r.idealLength-p,2)/r.elasticity;if(p!==0)var m=v*h/p,g=v*f/p;else var m=0,g=0;i.isLocked||(i.offsetX+=m,i.offsetY+=g),u.isLocked||(u.offsetX-=m,u.offsetY-=g)}}},Yv=function(e,t){if(t.gravity!==0)for(var n=1,r=0;r<e.graphSet.length;r++){var a=e.graphSet[r],i=a.length;if(r===0)var l=e.clientHeight/2,s=e.clientWidth/2;else var o=e.layoutNodes[e.idToIndex[a[0]]],u=e.layoutNodes[e.idToIndex[o.parentId]],l=u.positionX,s=u.positionY;for(var c=0;c<i;c++){var d=e.layoutNodes[e.idToIndex[a[c]]];if(!d.isLocked){var h=l-d.positionX,f=s-d.positionY,p=Math.sqrt(h*h+f*f);if(p>n){var v=t.gravity*h/p,m=t.gravity*f/p;d.offsetX+=v,d.offsetY+=m}}}}},jv=function(e,t){var n=[],r=0,a=-1;for(n.push.apply(n,e.graphSet[0]),a+=e.graphSet[0].length;r<=a;){var i=n[r++],o=e.idToIndex[i],u=e.layoutNodes[o],l=u.children;if(0<l.length&&!u.isLocked){for(var s=u.offsetX,c=u.offsetY,d=0;d<l.length;d++){var h=e.layoutNodes[e.idToIndex[l[d]]];h.offsetX+=s,h.offsetY+=c,n[++a]=l[d]}u.offsetX=0,u.offsetY=0}}},qv=function(e,t){for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&(r.maxX=void 0,r.minX=void 0,r.maxY=void 0,r.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];if(!(0<r.children.length||r.isLocked)){var a=Uv(r.offsetX,r.offsetY,e.temperature);r.positionX+=a.x,r.positionY+=a.y,r.offsetX=0,r.offsetY=0,r.minX=r.positionX-r.width,r.maxX=r.positionX+r.width,r.minY=r.positionY-r.height,r.maxY=r.positionY+r.height,sd(r,e)}}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&!r.isLocked&&(r.positionX=(r.maxX+r.minX)/2,r.positionY=(r.maxY+r.minY)/2,r.width=r.maxX-r.minX,r.height=r.maxY-r.minY)}},Uv=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var a={x:n*e/r,y:n*t/r};else var a={x:e,y:t};return a},sd=function(e,t){var n=e.parentId;if(n!=null){var r=t.layoutNodes[t.idToIndex[n]],a=!1;if((r.maxX==null||e.maxX+r.padRight>r.maxX)&&(r.maxX=e.maxX+r.padRight,a=!0),(r.minX==null||e.minX-r.padLeft<r.minX)&&(r.minX=e.minX-r.padLeft,a=!0),(r.maxY==null||e.maxY+r.padBottom>r.maxY)&&(r.maxY=e.maxY+r.padBottom,a=!0),(r.minY==null||e.minY-r.padTop<r.minY)&&(r.minY=e.minY-r.padTop,a=!0),a)return sd(r,t)}},Cu=function(e,t){for(var n=e.layoutNodes,r=[],a=0;a<n.length;a++){var i=n[a],o=i.cmptId,u=r[o]=r[o]||[];u.push(i)}for(var l=0,a=0;a<r.length;a++){var s=r[a];if(s){s.x1=1/0,s.x2=-1/0,s.y1=1/0,s.y2=-1/0;for(var c=0;c<s.length;c++){var d=s[c];s.x1=Math.min(s.x1,d.positionX-d.width/2),s.x2=Math.max(s.x2,d.positionX+d.width/2),s.y1=Math.min(s.y1,d.positionY-d.height/2),s.y2=Math.max(s.y2,d.positionY+d.height/2)}s.w=s.x2-s.x1,s.h=s.y2-s.y1,l+=s.w*s.h}}r.sort(function(g,y){return y.w*y.h-g.w*g.h});for(var h=0,f=0,p=0,v=0,m=Math.sqrt(l)*e.clientWidth/e.clientHeight,a=0;a<r.length;a++){var s=r[a];if(s){for(var c=0;c<s.length;c++){var d=s[c];d.isLocked||(d.positionX+=h-s.x1,d.positionY+=f-s.y1)}h+=s.w+t.componentSpacing,p+=s.w+t.componentSpacing,v=Math.max(v,s.h),p>m&&(f+=v+t.componentSpacing,h=0,p=0,v=0)}}},Wv={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 ld(e){this.options=ge({},Wv,e)}ld.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));var i=bt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(i.h===0||i.w===0)r.nodes().layoutPositions(this,t,function(W){return{x:i.x1,y:i.y1}});else{var o=a.size(),u=Math.sqrt(o*i.h/i.w),l=Math.round(u),s=Math.round(i.w/i.h*u),c=function(W){if(W==null)return Math.min(l,s);var Q=Math.min(l,s);Q==l?l=W:s=W},d=function(W){if(W==null)return Math.max(l,s);var Q=Math.max(l,s);Q==l?l=W:s=W},h=t.rows,f=t.cols!=null?t.cols:t.columns;if(h!=null&&f!=null)l=h,s=f;else if(h!=null&&f==null)l=h,s=Math.ceil(o/l);else if(h==null&&f!=null)s=f,l=Math.ceil(o/s);else if(s*l>o){var p=c(),v=d();(p-1)*v>=o?c(p-1):(v-1)*p>=o&&d(v-1)}else for(;s*l<o;){var m=c(),g=d();(g+1)*m>=o?d(g+1):c(m+1)}var y=i.w/s,b=i.h/l;if(t.condense&&(y=0,b=0),t.avoidOverlap)for(var w=0;w<a.length;w++){var k=a[w],C=k._private.position;(C.x==null||C.y==null)&&(C.x=0,C.y=0);var x=k.layoutDimensions(t),P=t.avoidOverlapPadding,B=x.w+P,D=x.h+P;y=Math.max(y,B),b=Math.max(b,D)}for(var _={},T=function(W,Q){return!!_["c-"+W+"-"+Q]},S=function(W,Q){_["c-"+W+"-"+Q]=!0},A=0,N=0,R=function(){N++,N>=s&&(N=0,A++)},M={},L=0;L<a.length;L++){var I=a[L],j=t.position(I);if(j&&(j.row!==void 0||j.col!==void 0)){var F={row:j.row,col:j.col};if(F.col===void 0)for(F.col=0;T(F.row,F.col);)F.col++;else if(F.row===void 0)for(F.row=0;T(F.row,F.col);)F.row++;M[I.id()]=F,S(F.row,F.col)}}var Y=function(W,Q){var $,Z;if(W.locked()||W.isParent())return!1;var J=M[W.id()];if(J)$=J.col*y+y/2+i.x1,Z=J.row*b+b/2+i.y1;else{for(;T(A,N);)R();$=N*y+y/2+i.x1,Z=A*b+b/2+i.y1,S(A,N),R()}return{x:$,y:Z}};a.layoutPositions(this,t,Y)}return this};var Gv={ready:function(){},stop:function(){}};function hs(e){this.options=ge({},Gv,e)}hs.prototype.run=function(){var e=this.options,t=e.eles,n=this;return e.cy,n.emit("layoutstart"),t.nodes().positions(function(){return{x:0,y:0}}),n.one("layoutready",e.ready),n.emit("layoutready"),n.one("layoutstop",e.stop),n.emit("layoutstop"),this};hs.prototype.stop=function(){return this};var Hv={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 ud(e){this.options=ge({},Hv,e)}ud.prototype.run=function(){var e=this.options,t=e.eles,n=t.nodes(),r=Ue(e.positions);function a(i){if(e.positions==null)return vf(i.position());if(r)return e.positions(i);var o=e.positions[i._private.data.id];return o??null}return n.layoutPositions(this,e,function(i,o){var u=a(i);return i.locked()||u==null?!1:u}),this};var Kv={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 cd(e){this.options=ge({},Kv,e)}cd.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=bt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),a=function(i,o){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}};return n.nodes().layoutPositions(this,e,a),this};var Zv=[{name:"breadthfirst",impl:nd},{name:"circle",impl:rd},{name:"concentric",impl:ad},{name:"cose",impl:Ua},{name:"grid",impl:ld},{name:"null",impl:hs},{name:"preset",impl:ud},{name:"random",impl:cd}];function dd(e){this.options=e,this.notifications=0}var Pu=function(){},_u=function(){throw new Error("A headless instance can not render images")};dd.prototype={recalculateRenderedStyle:Pu,notify:function(){this.notifications++},init:Pu,isHeadless:function(){return!0},png:_u,jpg:_u};var fs={};fs.arrowShapeWidth=.3;fs.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,n=function(l,s,c,d,h,f,p){var v=h.x-c/2-p,m=h.x+c/2+p,g=h.y-c/2-p,y=h.y+c/2+p,b=v<=l&&l<=m&&g<=s&&s<=y;return b},r=function(l,s,c,d,h){var f=l*Math.cos(d)-s*Math.sin(d),p=l*Math.sin(d)+s*Math.cos(d),v=f*c,m=p*c,g=v+h.x,y=m+h.y;return{x:g,y}},a=function(l,s,c,d){for(var h=[],f=0;f<l.length;f+=2){var p=l[f],v=l[f+1];h.push(r(p,v,s,c,d))}return h},i=function(l){for(var s=[],c=0;c<l.length;c++){var d=l[c];s.push(d.x,d.y)}return s},o=function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").pfValue*2},u=function(l,s){fe(s)&&(s=e[s]),e[l]=ge({name:l,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(c,d,h,f,p,v){var m=i(a(this.points,h+2*v,f,p)),g=Tt(c,d,m);return g},roughCollide:n,draw:function(c,d,h,f){var p=a(this.points,d,h,f);t.arrowShapeImpl("polygon")(c,p)},spacing:function(c){return 0},gap:o},s)};u("none",{collide:ba,roughCollide:ba,draw:$o,spacing:Fs,gap:Fs}),u("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),u("arrow","triangle"),u("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(l,s,c,d,h){var f=a(this.points,s,c,d),p=this.controlPoint,v=r(p[0],p[1],s,c,d);t.arrowShapeImpl(this.name)(l,f,v)},gap:function(l){return o(l)*.8}}),u("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(l,s,c,d,h,f,p){var v=i(a(this.points,c+2*p,d,h)),m=i(a(this.pointsTee,c+2*p,d,h)),g=Tt(l,s,v)||Tt(l,s,m);return g},draw:function(l,s,c,d,h){var f=a(this.points,s,c,d),p=a(this.pointsTee,s,c,d);t.arrowShapeImpl(this.name)(l,f,p)}}),u("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(l,s,c,d,h,f,p){var v=h,m=Math.pow(v.x-l,2)+Math.pow(v.y-s,2)<=Math.pow((c+2*p)*this.radius,2),g=i(a(this.points,c+2*p,d,h));return Tt(l,s,g)||m},draw:function(l,s,c,d,h){var f=a(this.pointsTr,s,c,d);t.arrowShapeImpl(this.name)(l,f,d.x,d.y,this.radius*s)},spacing:function(l){return t.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),u("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(l,s){var c=this.baseCrossLinePts.slice(),d=s/l,h=3,f=5;return c[h]=c[h]-d,c[f]=c[f]-d,c},collide:function(l,s,c,d,h,f,p){var v=i(a(this.points,c+2*p,d,h)),m=i(a(this.crossLinePts(c,f),c+2*p,d,h)),g=Tt(l,s,v)||Tt(l,s,m);return g},draw:function(l,s,c,d,h){var f=a(this.points,s,c,d),p=a(this.crossLinePts(s,h),s,c,d);t.arrowShapeImpl(this.name)(l,f,p)}}),u("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(l){return o(l)*.525}}),u("circle",{radius:.15,collide:function(l,s,c,d,h,f,p){var v=h,m=Math.pow(v.x-l,2)+Math.pow(v.y-s,2)<=Math.pow((c+2*p)*this.radius,2);return m},draw:function(l,s,c,d,h){t.arrowShapeImpl(this.name)(l,d.x,d.y,this.radius*s)},spacing:function(l){return t.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),u("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(l){return 1},gap:function(l){return 1}}),u("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),u("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}}),u("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(l){return .95*l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}})};var Sn={};Sn.projectIntoViewport=function(e,t){var n=this.cy,r=this.findContainerClientCoords(),a=r[0],i=r[1],o=r[4],u=n.pan(),l=n.zoom(),s=((e-a)/o-u.x)/l,c=((t-i)/o-u.y)/l;return[s,c]};Sn.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(m){return parseFloat(n.getPropertyValue(m))},a={left:r("padding-left"),right:r("padding-right"),top:r("padding-top"),bottom:r("padding-bottom")},i={left:r("border-left-width"),right:r("border-right-width"),top:r("border-top-width"),bottom:r("border-bottom-width")},o=e.clientWidth,u=e.clientHeight,l=a.left+a.right,s=a.top+a.bottom,c=i.left+i.right,d=t.width/(o+c),h=o-l,f=u-s,p=t.left+a.left+i.left,v=t.top+a.top+i.top;return this.containerBB=[p,v,h,f,d]};Sn.invalidateContainerClientCoordsCache=function(){this.containerBB=null};Sn.findNearestElement=function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]};Sn.findNearestElements=function(e,t,n,r){var a=this,i=this,o=i.getCachedZSortedEles(),u=[],l=i.cy.zoom(),s=i.cy.hasCompoundNodes(),c=(r?24:8)/l,d=(r?8:2)/l,h=(r?8:2)/l,f=1/0,p,v;n&&(o=o.interactive);function m(x,P){if(x.isNode()){if(v)return;v=x,u.push(x)}if(x.isEdge()&&(P==null||P<f))if(p){if(p.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value&&p.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value){for(var B=0;B<u.length;B++)if(u[B].isEdge()){u[B]=x,p=x,f=P??f;break}}}else u.push(x),p=x,f=P??f}function g(x){var P=x.outerWidth()+2*d,B=x.outerHeight()+2*d,D=P/2,_=B/2,T=x.position(),S=x.pstyle("corner-radius").value==="auto"?"auto":x.pstyle("corner-radius").pfValue,A=x._private.rscratch;if(T.x-D<=e&&e<=T.x+D&&T.y-_<=t&&t<=T.y+_){var N=i.nodeShapes[a.getNodeShape(x)];if(N.checkPoint(e,t,0,P,B,T.x,T.y,S,A))return m(x,0),!0}}function y(x){var P=x._private,B=P.rscratch,D=x.pstyle("width").pfValue,_=x.pstyle("arrow-scale").value,T=D/2+c,S=T*T,A=T*2,N=P.source,R=P.target,M;if(B.edgeType==="segments"||B.edgeType==="straight"||B.edgeType==="haystack"){for(var L=B.allpts,I=0;I+3<L.length;I+=2)if(Af(e,t,L[I],L[I+1],L[I+2],L[I+3],A)&&S>(M=Lf(e,t,L[I],L[I+1],L[I+2],L[I+3])))return m(x,M),!0}else if(B.edgeType==="bezier"||B.edgeType==="multibezier"||B.edgeType==="self"||B.edgeType==="compound"){for(var L=B.allpts,I=0;I+5<B.allpts.length;I+=4)if(Sf(e,t,L[I],L[I+1],L[I+2],L[I+3],L[I+4],L[I+5],A)&&S>(M=If(e,t,L[I],L[I+1],L[I+2],L[I+3],L[I+4],L[I+5])))return m(x,M),!0}for(var N=N||P.source,R=R||P.target,j=a.getArrowWidth(D,_),F=[{name:"source",x:B.arrowStartX,y:B.arrowStartY,angle:B.srcArrowAngle},{name:"target",x:B.arrowEndX,y:B.arrowEndY,angle:B.tgtArrowAngle},{name:"mid-source",x:B.midX,y:B.midY,angle:B.midsrcArrowAngle},{name:"mid-target",x:B.midX,y:B.midY,angle:B.midtgtArrowAngle}],I=0;I<F.length;I++){var Y=F[I],W=i.arrowShapes[x.pstyle(Y.name+"-arrow-shape").value],Q=x.pstyle("width").pfValue;if(W.roughCollide(e,t,j,Y.angle,{x:Y.x,y:Y.y},Q,c)&&W.collide(e,t,j,Y.angle,{x:Y.x,y:Y.y},Q,c))return m(x),!0}s&&u.length>0&&(g(N),g(R))}function b(x,P,B){return kt(x,P,B)}function w(x,P){var B=x._private,D=h,_;P?_=P+"-":_="",x.boundingBox();var T=B.labelBounds[P||"main"],S=x.pstyle(_+"label").value,A=x.pstyle("text-events").strValue==="yes";if(!(!A||!S)){var N=b(B.rscratch,"labelX",P),R=b(B.rscratch,"labelY",P),M=b(B.rscratch,"labelAngle",P),L=x.pstyle(_+"text-margin-x").pfValue,I=x.pstyle(_+"text-margin-y").pfValue,j=T.x1-D-L,F=T.x2+D-L,Y=T.y1-D-I,W=T.y2+D-I;if(M){var Q=Math.cos(M),$=Math.sin(M),Z=function(H,te){return H=H-N,te=te-R,{x:H*Q-te*$+N,y:H*$+te*Q+R}},J=Z(j,Y),re=Z(j,W),V=Z(F,Y),O=Z(F,W),z=[J.x+L,J.y+I,V.x+L,V.y+I,O.x+L,O.y+I,re.x+L,re.y+I];if(Tt(e,t,z))return m(x),!0}else if(nn(T,e,t))return m(x),!0}}for(var k=o.length-1;k>=0;k--){var C=o[k];C.isNode()?g(C)||w(C):y(C)||w(C)||w(C,"source")||w(C,"target")}return u};Sn.getAllInBox=function(e,t,n,r){var a=this.getCachedZSortedEles().interactive,i=this.cy.zoom(),o=2/i,u=[],l=Math.min(e,n),s=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r);e=l,n=s,t=c,r=d;var h=bt({x1:e,y1:t,x2:n,y2:r}),f=[{x:h.x1,y:h.y1},{x:h.x2,y:h.y1},{x:h.x2,y:h.y2},{x:h.x1,y:h.y2}],p=[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]],[f[3],f[0]]];function v(te,ae,we){return kt(te,ae,we)}function m(te,ae){var we=te._private,ye=o,xe="";te.boundingBox();var Ae=we.labelBounds.main;if(!Ae)return null;var ee=v(we.rscratch,"labelX",ae),ue=v(we.rscratch,"labelY",ae),ce=v(we.rscratch,"labelAngle",ae),me=te.pstyle(xe+"text-margin-x").pfValue,be=te.pstyle(xe+"text-margin-y").pfValue,Ee=Ae.x1-ye-me,_e=Ae.x2+ye-me,Oe=Ae.y1-ye-be,Fe=Ae.y2+ye-be;if(ce){var Re=Math.cos(ce),Se=Math.sin(ce),ie=function(ve,E){return ve=ve-ee,E=E-ue,{x:ve*Re-E*Se+ee,y:ve*Se+E*Re+ue}};return[ie(Ee,Oe),ie(_e,Oe),ie(_e,Fe),ie(Ee,Fe)]}else return[{x:Ee,y:Oe},{x:_e,y:Oe},{x:_e,y:Fe},{x:Ee,y:Fe}]}function g(te,ae,we,ye){function xe(Ae,ee,ue){return(ue.y-Ae.y)*(ee.x-Ae.x)>(ee.y-Ae.y)*(ue.x-Ae.x)}return xe(te,we,ye)!==xe(ae,we,ye)&&xe(te,ae,we)!==xe(te,ae,ye)}for(var y=0;y<a.length;y++){var b=a[y];if(b.isNode()){var w=b,k=w.pstyle("text-events").strValue==="yes",C=w.pstyle("box-selection").strValue,x=w.pstyle("box-select-labels").strValue==="yes";if(C==="none")continue;var P=(C==="overlap"||x)&&k,B=w.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:P});if(C==="contain"){var D=!1;if(x&&k){var _=m(w);_&&pi(_,f)&&(u.push(w),D=!0)}!D&&mc(h,B)&&u.push(w)}else if(C==="overlap"&&ns(h,B)){var T=w.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),S=[{x:T.x1,y:T.y1},{x:T.x2,y:T.y1},{x:T.x2,y:T.y2},{x:T.x1,y:T.y2}];if(pi(S,f))u.push(w);else{var A=m(w);A&&pi(A,f)&&u.push(w)}}}else{var N=b,R=N._private,M=R.rscratch,L=N.pstyle("box-selection").strValue;if(L==="none")continue;if(L==="contain"){if(M.startX!=null&&M.startY!=null&&!nn(h,M.startX,M.startY)||M.endX!=null&&M.endY!=null&&!nn(h,M.endX,M.endY))continue;if(M.edgeType==="bezier"||M.edgeType==="multibezier"||M.edgeType==="self"||M.edgeType==="compound"||M.edgeType==="segments"||M.edgeType==="haystack"){for(var I=R.rstyle.bezierPts||R.rstyle.linePts||R.rstyle.haystackPts,j=!0,F=0;F<I.length;F++)if(!Ws(h,I[F])){j=!1;break}j&&u.push(N)}else M.edgeType==="straight"&&u.push(N)}else if(L==="overlap"){var Y=!1;if(M.startX!=null&&M.startY!=null&&M.endX!=null&&M.endY!=null&&(nn(h,M.startX,M.startY)||nn(h,M.endX,M.endY)))u.push(N),Y=!0;else if(!Y&&M.edgeType==="haystack"){for(var W=R.rstyle.haystackPts,Q=0;Q<W.length;Q++)if(Ws(h,W[Q])){u.push(N),Y=!0;break}}if(!Y){var $=R.rstyle.bezierPts||R.rstyle.linePts||R.rstyle.haystackPts;if((!$||$.length<2)&&M.edgeType==="straight"&&M.startX!=null&&M.startY!=null&&M.endX!=null&&M.endY!=null&&($=[{x:M.startX,y:M.startY},{x:M.endX,y:M.endY}]),!$||$.length<2)continue;for(var Z=0;Z<$.length-1;Z++){for(var J=$[Z],re=$[Z+1],V=0;V<p.length;V++){var O=$e(p[V],2),z=O[0],H=O[1];if(g(J,re,z,H)){u.push(N),Y=!0;break}}if(Y)break}}}}}return u};var Pa={};Pa.calculateArrowAngles=function(e){var t=e._private.rscratch,n=t.edgeType==="haystack",r=t.edgeType==="bezier",a=t.edgeType==="multibezier",i=t.edgeType==="segments",o=t.edgeType==="compound",u=t.edgeType==="self",l,s,c,d,h,f,g,y;if(n?(c=t.haystackPts[0],d=t.haystackPts[1],h=t.haystackPts[2],f=t.haystackPts[3]):(c=t.arrowStartX,d=t.arrowStartY,h=t.arrowEndX,f=t.arrowEndY),g=t.midX,y=t.midY,i)l=c-t.segpts[0],s=d-t.segpts[1];else if(a||o||u||r){var p=t.allpts,v=at(p[0],p[2],p[4],.1),m=at(p[1],p[3],p[5],.1);l=c-v,s=d-m}else l=c-g,s=d-y;t.srcArrowAngle=Kr(l,s);var g=t.midX,y=t.midY;if(n&&(g=(c+h)/2,y=(d+f)/2),l=h-c,s=f-d,i){var p=t.allpts;if(p.length/2%2===0){var b=p.length/2,w=b-2;l=p[b]-p[w],s=p[b+1]-p[w+1]}else if(t.isRound)l=t.midVector[1],s=-t.midVector[0];else{var b=p.length/2-1,w=b-2;l=p[b]-p[w],s=p[b+1]-p[w+1]}}else if(a||o||u){var p=t.allpts,k=t.ctrlpts,C,x,P,B;if(k.length/2%2===0){var D=p.length/2-1,_=D+2,T=_+2;C=at(p[D],p[_],p[T],0),x=at(p[D+1],p[_+1],p[T+1],0),P=at(p[D],p[_],p[T],1e-4),B=at(p[D+1],p[_+1],p[T+1],1e-4)}else{var _=p.length/2-1,D=_-2,T=_+2;C=at(p[D],p[_],p[T],.4999),x=at(p[D+1],p[_+1],p[T+1],.4999),P=at(p[D],p[_],p[T],.5),B=at(p[D+1],p[_+1],p[T+1],.5)}l=P-C,s=B-x}if(t.midtgtArrowAngle=Kr(l,s),t.midDispX=l,t.midDispY=s,l*=-1,s*=-1,i){var p=t.allpts;if(p.length/2%2!==0&&!t.isRound){var b=p.length/2-1,S=b+2;l=-(p[S]-p[b]),s=-(p[S+1]-p[b+1])}}if(t.midsrcArrowAngle=Kr(l,s),i)l=h-t.segpts[t.segpts.length-2],s=f-t.segpts[t.segpts.length-1];else if(a||o||u||r){var p=t.allpts,A=p.length,v=at(p[A-6],p[A-4],p[A-2],.9),m=at(p[A-5],p[A-3],p[A-1],.9);l=h-v,s=f-m}else l=h-g,s=f-y;t.tgtArrowAngle=Kr(l,s)};Pa.getArrowWidth=Pa.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(e*13.37,.9),29)*t,n[e+", "+t]=r,r)};var zo,Vo,Vt={},Bt={},Bu,Du,Tn,fa,qt,bn,En,Ot,zn,ra,hd,fd,Fo,Xo,Au,Su=function(e,t,n){n.x=t.x-e.x,n.y=t.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},Qv=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},$v=function(e,t,n,r,a){if(e!==Au?Su(t,e,Vt):Qv(Bt,Vt),Su(t,n,Bt),Bu=Vt.nx*Bt.ny-Vt.ny*Bt.nx,Du=Vt.nx*Bt.nx-Vt.ny*-Bt.ny,qt=Math.asin(Math.max(-1,Math.min(1,Bu))),Math.abs(qt)<1e-6){zo=t.x,Vo=t.y,En=zn=0;return}Tn=1,fa=!1,Du<0?qt<0?qt=Math.PI+qt:(qt=Math.PI-qt,Tn=-1,fa=!0):qt>0&&(Tn=-1,fa=!0),t.radius!==void 0?zn=t.radius:zn=r,bn=qt/2,ra=Math.min(Vt.len/2,Bt.len/2),a?(Ot=Math.abs(Math.cos(bn)*zn/Math.sin(bn)),Ot>ra?(Ot=ra,En=Math.abs(Ot*Math.sin(bn)/Math.cos(bn))):En=zn):(Ot=Math.min(ra,zn),En=Math.abs(Ot*Math.sin(bn)/Math.cos(bn))),Fo=t.x+Bt.nx*Ot,Xo=t.y+Bt.ny*Ot,zo=Fo-Bt.ny*En*Tn,Vo=Xo+Bt.nx*En*Tn,hd=t.x+Vt.nx*Ot,fd=t.y+Vt.ny*Ot,Au=t};function pd(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 ps(e,t,n,r){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return r===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}:($v(e,t,n,r,a),{cx:zo,cy:Vo,radius:En,startX:hd,startY:fd,stopX:Fo,stopY:Xo,startAngle:Vt.ang+Math.PI/2*Tn,endAngle:Bt.ang-Math.PI/2*Tn,counterClockwise:fa})}var Ar=.01,Jv=Math.sqrt(2*Ar),gt={};gt.findMidptPtsEtc=function(e,t){var n=t.posPts,r=t.intersectionPts,a=t.vectorNormInverse,i,o=e.pstyle("source-endpoint"),u=e.pstyle("target-endpoint"),l=o.units!=null&&u.units!=null,s=function(w,k,C,x){var P=x-k,B=C-w,D=Math.sqrt(B*B+P*P);return{x:-P/D,y:B/D}},c=e.pstyle("edge-distances").value;switch(c){case"node-position":i=n;break;case"intersection":i=r;break;case"endpoints":{if(l){var d=this.manualEndptToPx(e.source()[0],o),h=$e(d,2),f=h[0],p=h[1],v=this.manualEndptToPx(e.target()[0],u),m=$e(v,2),g=m[0],y=m[1],b={x1:f,y1:p,x2:g,y2:y};a=s(f,p,g,y),i=b}else Ne("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).")),i=r;break}}return{midptPts:i,vectorNormInverse:a}};gt.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,a=r.rscratch;if(!a.haystack){var i=Math.random()*2*Math.PI;a.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,a.target={x:Math.cos(i),y:Math.sin(i)}}var o=r.source,u=r.target,l=o.position(),s=u.position(),c=o.width(),d=u.width(),h=o.height(),f=u.height(),p=n.pstyle("haystack-radius").value,v=p/2;a.haystackPts=a.allpts=[a.source.x*c*v+l.x,a.source.y*h*v+l.y,a.target.x*d*v+s.x,a.target.y*f*v+s.y],a.midX=(a.allpts[0]+a.allpts[2])/2,a.midY=(a.allpts[1]+a.allpts[3])/2,a.edgeType="haystack",a.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}};gt.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle("segment-weights"),a=e.pstyle("segment-distances"),i=e.pstyle("segment-radii"),o=e.pstyle("radius-type"),u=Math.min(r.pfValue.length,a.pfValue.length),l=i.pfValue[i.pfValue.length-1],s=o.pfValue[o.pfValue.length-1];n.edgeType="segments",n.segpts=[],n.radii=[],n.isArcRadius=[];for(var c=0;c<u;c++){var d=r.pfValue[c],h=a.pfValue[c],f=1-d,p=d,v=this.findMidptPtsEtc(e,t),m=v.midptPts,g=v.vectorNormInverse,y={x:m.x1*f+m.x2*p,y:m.y1*f+m.y2*p};n.segpts.push(y.x+g.x*h,y.y+g.y*h),n.radii.push(i.pfValue[c]!==void 0?i.pfValue[c]:l),n.isArcRadius.push((o.pfValue[c]!==void 0?o.pfValue[c]:s)==="arc-radius")}};gt.findLoopPoints=function(e,t,n,r){var a=e._private.rscratch,i=t.dirCounts,o=t.srcPos,u=e.pstyle("control-point-distances"),l=u?u.pfValue[0]:void 0,s=e.pstyle("loop-direction").pfValue,c=e.pstyle("loop-sweep").pfValue,d=e.pstyle("control-point-step-size").pfValue;a.edgeType="self";var h=n,f=d;r&&(h=0,f=l);var p=s-Math.PI/2,v=p-c/2,m=p+c/2,g=s+"_"+c;h=i[g]===void 0?i[g]=0:++i[g],a.ctrlpts=[o.x+Math.cos(v)*1.4*f*(h/3+1),o.y+Math.sin(v)*1.4*f*(h/3+1),o.x+Math.cos(m)*1.4*f*(h/3+1),o.y+Math.sin(m)*1.4*f*(h/3+1)]};gt.findCompoundLoopPoints=function(e,t,n,r){var a=e._private.rscratch;a.edgeType="compound";var i=t.srcPos,o=t.tgtPos,u=t.srcW,l=t.srcH,s=t.tgtW,c=t.tgtH,d=e.pstyle("control-point-step-size").pfValue,h=e.pstyle("control-point-distances"),f=h?h.pfValue[0]:void 0,p=n,v=d;r&&(p=0,v=f);var m=50,g={x:i.x-u/2,y:i.y-l/2},y={x:o.x-s/2,y:o.y-c/2},b={x:Math.min(g.x,y.x),y:Math.min(g.y,y.y)},w=.5,k=Math.max(w,Math.log(u*Ar)),C=Math.max(w,Math.log(s*Ar));a.ctrlpts=[b.x,b.y-(1+Math.pow(m,1.12)/100)*v*(p/3+1)*k,b.x-(1+Math.pow(m,1.12)/100)*v*(p/3+1)*C,b.y]};gt.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"};gt.findBezierPoints=function(e,t,n,r,a){var i=e._private.rscratch,o=e.pstyle("control-point-step-size").pfValue,u=e.pstyle("control-point-distances"),l=e.pstyle("control-point-weights"),s=u&&l?Math.min(u.value.length,l.value.length):1,c=u?u.pfValue[0]:void 0,d=l.value[0],h=r;i.edgeType=h?"multibezier":"bezier",i.ctrlpts=[];for(var f=0;f<s;f++){var p=(.5-t.eles.length/2+n)*o*(a?-1:1),v=void 0,m=ts(p);h&&(c=u?u.pfValue[f]:o,d=l.value[f]),r?v=c:v=c!==void 0?m*c:void 0;var g=v!==void 0?v:p,y=1-d,b=d,w=this.findMidptPtsEtc(e,t),k=w.midptPts,C=w.vectorNormInverse,x={x:k.x1*y+k.x2*b,y:k.y1*y+k.y2*b};i.ctrlpts.push(x.x+C.x*g,x.y+C.y*g)}};gt.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType="segments";var r="vertical",a="horizontal",i="leftward",o="rightward",u="downward",l="upward",s="auto",c=t.posPts,d=t.srcW,h=t.srcH,f=t.tgtW,p=t.tgtH,v=e.pstyle("edge-distances").value,m=v!=="node-position",g=e.pstyle("taxi-direction").value,y=g,b=e.pstyle("taxi-turn"),w=b.units==="%",k=b.pfValue,C=k<0,x=e.pstyle("taxi-turn-min-distance").pfValue,P=m?(d+f)/2:0,B=m?(h+p)/2:0,D=c.x2-c.x1,_=c.y2-c.y1,T=function(E,X){return E>0?Math.max(E-X,0):Math.min(E+X,0)},S=T(D,P),A=T(_,B),N=!1;y===s?g=Math.abs(S)>Math.abs(A)?a:r:y===l||y===u?(g=r,N=!0):(y===i||y===o)&&(g=a,N=!0);var R=g===r,M=R?A:S,L=R?_:D,I=ts(L),j=!1;!(N&&(w||C))&&(y===u&&L<0||y===l&&L>0||y===i&&L>0||y===o&&L<0)&&(I*=-1,M=I*Math.abs(M),j=!0);var F;if(w){var Y=k<0?1+k:k;F=Y*M}else{var W=k<0?M:0;F=W+k*I}var Q=function(E){return Math.abs(E)<x||Math.abs(E)>=Math.abs(M)},$=Q(F),Z=Q(Math.abs(M)-Math.abs(F)),J=$||Z;if(J&&!j)if(R){var re=Math.abs(L)<=h/2,V=Math.abs(D)<=f/2;if(re){var O=(c.x1+c.x2)/2,z=c.y1,H=c.y2;n.segpts=[O,z,O,H]}else if(V){var te=(c.y1+c.y2)/2,ae=c.x1,we=c.x2;n.segpts=[ae,te,we,te]}else n.segpts=[c.x1,c.y2]}else{var ye=Math.abs(L)<=d/2,xe=Math.abs(_)<=p/2;if(ye){var Ae=(c.y1+c.y2)/2,ee=c.x1,ue=c.x2;n.segpts=[ee,Ae,ue,Ae]}else if(xe){var ce=(c.x1+c.x2)/2,me=c.y1,be=c.y2;n.segpts=[ce,me,ce,be]}else n.segpts=[c.x2,c.y1]}else if(R){var Ee=c.y1+F+(m?h/2*I:0),_e=c.x1,Oe=c.x2;n.segpts=[_e,Ee,Oe,Ee]}else{var Fe=c.x1+F+(m?d/2*I:0),Re=c.y1,Se=c.y2;n.segpts=[Fe,Re,Fe,Se]}if(n.isRound){var ie=e.pstyle("taxi-radius").value,ve=e.pstyle("radius-type").value[0]==="arc-radius";n.radii=new Array(n.segpts.length/2).fill(ie),n.isArcRadius=new Array(n.segpts.length/2).fill(ve)}};gt.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if(n.edgeType==="bezier"){var r=t.srcPos,a=t.tgtPos,i=t.srcW,o=t.srcH,u=t.tgtW,l=t.tgtH,s=t.srcShape,c=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,f=t.srcRs,p=t.tgtRs,v=!ne(n.startX)||!ne(n.startY),m=!ne(n.arrowStartX)||!ne(n.arrowStartY),g=!ne(n.endX)||!ne(n.endY),y=!ne(n.arrowEndX)||!ne(n.arrowEndY),b=3,w=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth,k=b*w,C=_n({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),x=C<k,P=_n({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),B=P<k,D=!1;if(v||m||x){D=!0;var _={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},T=Math.sqrt(_.x*_.x+_.y*_.y),S={x:_.x/T,y:_.y/T},A=Math.max(i,o),N={x:n.ctrlpts[0]+S.x*2*A,y:n.ctrlpts[1]+S.y*2*A},R=s.intersectLine(r.x,r.y,i,o,N.x,N.y,0,d,f);x?(n.ctrlpts[0]=n.ctrlpts[0]+S.x*(k-C),n.ctrlpts[1]=n.ctrlpts[1]+S.y*(k-C)):(n.ctrlpts[0]=R[0]+S.x*k,n.ctrlpts[1]=R[1]+S.y*k)}if(g||y||B){D=!0;var M={x:n.ctrlpts[0]-a.x,y:n.ctrlpts[1]-a.y},L=Math.sqrt(M.x*M.x+M.y*M.y),I={x:M.x/L,y:M.y/L},j=Math.max(i,o),F={x:n.ctrlpts[0]+I.x*2*j,y:n.ctrlpts[1]+I.y*2*j},Y=c.intersectLine(a.x,a.y,u,l,F.x,F.y,0,h,p);B?(n.ctrlpts[0]=n.ctrlpts[0]+I.x*(k-P),n.ctrlpts[1]=n.ctrlpts[1]+I.y*(k-P)):(n.ctrlpts[0]=Y[0]+I.x*k,n.ctrlpts[1]=Y[1]+I.y*k)}D&&this.findEndpoints(e)}};gt.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 n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);t.allpts.push(t.endX,t.endY);var r,a;t.ctrlpts.length/2%2===0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,a=.5,t.midX=at(t.allpts[r],t.allpts[r+2],t.allpts[r+4],a),t.midY=at(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],a))}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 i=2;i+3<t.allpts.length;i+=2){var o=t.radii[i/2-1],u=t.isArcRadius[i/2-1];t.roundCorners.push(ps({x:t.allpts[i-2],y:t.allpts[i-1]},{x:t.allpts[i],y:t.allpts[i+1],radius:o},{x:t.allpts[i+2],y:t.allpts[i+3]},o,u))}}if(t.segpts.length%4===0){var l=t.segpts.length/2,s=l-2;t.midX=(t.segpts[s]+t.segpts[l])/2,t.midY=(t.segpts[s+1]+t.segpts[l+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 d={x:t.segpts[c],y:t.segpts[c+1]},h=t.roundCorners[c/2];if(h.radius===0){var f={x:t.segpts[c+2],y:t.segpts[c+3]};t.midX=d.x,t.midY=d.y,t.midVector=[d.y-f.y,f.x-d.x]}else{var p=[d.x-h.cx,d.y-h.cy],v=h.radius/Math.sqrt(Math.pow(p[0],2)+Math.pow(p[1],2));p=p.map(function(m){return m*v}),t.midX=h.cx+p[0],t.midY=h.cy+p[1],t.midVector=p}}}}};gt.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,Ne("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."))};gt.findEdgeControlPoints=function(e){var t=this;if(!(!e||e.length===0)){for(var n=this,r=n.cy,a=r.hasCompoundNodes(),i=new Wt,o=function(P,B){return[].concat(va(P),[B?1:0]).join("-")},u=[],l=[],s=0;s<e.length;s++){var c=e[s],d=c._private,h=c.pstyle("curve-style").value;if(!(c.removed()||!c.takesUpSpace())){if(h==="haystack"){l.push(c);continue}var f=h==="unbundled-bezier"||tn(h,"segments")||h==="straight"||h==="straight-triangle"||tn(h,"taxi"),p=h==="unbundled-bezier"||h==="bezier",v=d.source,m=d.target,g=v.poolIndex(),y=m.poolIndex(),b=[g,y].sort(),w=o(b,f),k=i.get(w);k==null&&(k={eles:[]},u.push({pairId:b,edgeIsUnbundled:f}),i.set(w,k)),k.eles.push(c),f&&(k.hasUnbundled=!0),p&&(k.hasBezier=!0)}}for(var C=function(){var P=u[x],B=P.pairId,D=P.edgeIsUnbundled,_=o(B,D),T=i.get(_),S;if(!T.hasUnbundled){var A=T.eles[0].parallelEdges().filter(function(ie){return ie.isBundledBezier()});Jo(T.eles),A.forEach(function(ie){return T.eles.push(ie)}),T.eles.sort(function(ie,ve){return ie.poolIndex()-ve.poolIndex()})}var N=T.eles[0],R=N.source(),M=N.target();if(R.poolIndex()>M.poolIndex()){var L=R;R=M,M=L}var I=T.srcPos=R.position(),j=T.tgtPos=M.position(),F=T.srcW=R.outerWidth(),Y=T.srcH=R.outerHeight(),W=T.tgtW=M.outerWidth(),Q=T.tgtH=M.outerHeight(),$=T.srcShape=n.nodeShapes[t.getNodeShape(R)],Z=T.tgtShape=n.nodeShapes[t.getNodeShape(M)],J=T.srcCornerRadius=R.pstyle("corner-radius").value==="auto"?"auto":R.pstyle("corner-radius").pfValue,re=T.tgtCornerRadius=M.pstyle("corner-radius").value==="auto"?"auto":M.pstyle("corner-radius").pfValue,V=T.tgtRs=M._private.rscratch,O=T.srcRs=R._private.rscratch;T.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var z=0;z<T.eles.length;z++){var H=T.eles[z],te=H[0]._private.rscratch,ae=H.pstyle("curve-style").value,we=ae==="unbundled-bezier"||tn(ae,"segments")||tn(ae,"taxi"),ye=!R.same(H.source());if(!T.calculatedIntersection&&R!==M&&(T.hasBezier||T.hasUnbundled)){T.calculatedIntersection=!0;var xe=$.intersectLine(I.x,I.y,F,Y,j.x,j.y,0,J,O),Ae=T.srcIntn=xe,ee=Z.intersectLine(j.x,j.y,W,Q,I.x,I.y,0,re,V),ue=T.tgtIntn=ee,ce=T.intersectionPts={x1:xe[0],x2:ee[0],y1:xe[1],y2:ee[1]},me=T.posPts={x1:I.x,x2:j.x,y1:I.y,y2:j.y},be=ee[1]-xe[1],Ee=ee[0]-xe[0],_e=Math.sqrt(Ee*Ee+be*be);ne(_e)&&_e>=Jv||(_e=Math.sqrt(Math.max(Ee*Ee,Ar)+Math.max(be*be,Ar)));var Oe=T.vector={x:Ee,y:be},Fe=T.vectorNorm={x:Oe.x/_e,y:Oe.y/_e},Re={x:-Fe.y,y:Fe.x};T.nodesOverlap=!ne(_e)||Z.checkPoint(xe[0],xe[1],0,W,Q,j.x,j.y,re,V)||$.checkPoint(ee[0],ee[1],0,F,Y,I.x,I.y,J,O),T.vectorNormInverse=Re,S={nodesOverlap:T.nodesOverlap,dirCounts:T.dirCounts,calculatedIntersection:!0,hasBezier:T.hasBezier,hasUnbundled:T.hasUnbundled,eles:T.eles,srcPos:j,srcRs:V,tgtPos:I,tgtRs:O,srcW:W,srcH:Q,tgtW:F,tgtH:Y,srcIntn:ue,tgtIntn:Ae,srcShape:Z,tgtShape:$,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:-Oe.x,y:-Oe.y},vectorNorm:{x:-Fe.x,y:-Fe.y},vectorNormInverse:{x:-Re.x,y:-Re.y}}}var Se=ye?S:T;te.nodesOverlap=Se.nodesOverlap,te.srcIntn=Se.srcIntn,te.tgtIntn=Se.tgtIntn,te.isRound=ae.startsWith("round"),a&&(R.isParent()||R.isChild()||M.isParent()||M.isChild())&&(R.parents().anySame(M)||M.parents().anySame(R)||R.same(M)&&R.isParent())?t.findCompoundLoopPoints(H,Se,z,we):R===M?t.findLoopPoints(H,Se,z,we):ae.endsWith("segments")?t.findSegmentsPoints(H,Se):ae.endsWith("taxi")?t.findTaxiPoints(H,Se):ae==="straight"||!we&&T.eles.length%2===1&&z===Math.floor(T.eles.length/2)?t.findStraightEdgePoints(H):t.findBezierPoints(H,Se,z,we,ye),t.findEndpoints(H),t.tryToCorrectInvalidPoints(H,Se),t.checkForInvalidEdgeWarning(H),t.storeAllpts(H),t.storeEdgeProjections(H),t.calculateArrowAngles(H),t.recalculateEdgeLabelProjections(H),t.calculateLabelAngles(H)}},x=0;x<u.length;x++)C();this.findHaystackPoints(l)}};function gd(e){var t=[];if(e!=null){for(var n=0;n<e.length;n+=2){var r=e[n],a=e[n+1];t.push({x:r,y:a})}return t}}gt.getSegmentPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if(n==="segments")return gd(t.segpts)};gt.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if(n==="bezier"||n==="multibezier"||n==="self"||n==="compound")return gd(t.ctrlpts)};gt.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var Fr={};Fr.manualEndptToPx=function(e,t){var n=this,r=e.position(),a=e.outerWidth(),i=e.outerHeight(),o=e._private.rscratch;if(t.value.length===2){var u=[t.pfValue[0],t.pfValue[1]];return t.units[0]==="%"&&(u[0]=u[0]*a),t.units[1]==="%"&&(u[1]=u[1]*i),u[0]+=r.x,u[1]+=r.y,u}else{var l=t.pfValue[0];l=-Math.PI/2+l;var s=2*Math.max(a,i),c=[r.x+Math.cos(l)*s,r.y+Math.sin(l)*s];return n.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,a,i,c[0],c[1],0,e.pstyle("corner-radius").value==="auto"?"auto":e.pstyle("corner-radius").pfValue,o)}};Fr.findEndpoints=function(e){var t,n,r,a,i=this,o,u=e.source()[0],l=e.target()[0],s=u.position(),c=l.position(),d=e.pstyle("target-arrow-shape").value,h=e.pstyle("source-arrow-shape").value,f=e.pstyle("target-distance-from-node").pfValue,p=e.pstyle("source-distance-from-node").pfValue,v=u._private.rscratch,m=l._private.rscratch,g=e.pstyle("curve-style").value,y=e._private.rscratch,b=y.edgeType,w=tn(g,"taxi"),k=b==="self"||b==="compound",C=b==="bezier"||b==="multibezier"||k,x=b!=="bezier",P=b==="straight"||b==="segments",B=b==="segments",D=C||x||P,_=k||w,T=e.pstyle("source-endpoint"),S=_?"outside-to-node":T.value,A=u.pstyle("corner-radius").value==="auto"?"auto":u.pstyle("corner-radius").pfValue,N=e.pstyle("target-endpoint"),R=_?"outside-to-node":N.value,M=l.pstyle("corner-radius").value==="auto"?"auto":l.pstyle("corner-radius").pfValue;y.srcManEndpt=T,y.tgtManEndpt=N;var L,I,j,F,Y=(t=(N==null||(n=N.pfValue)===null||n===void 0?void 0:n.length)===2?N.pfValue:null)!==null&&t!==void 0?t:[0,0],W=(r=(T==null||(a=T.pfValue)===null||a===void 0?void 0:a.length)===2?T.pfValue:null)!==null&&r!==void 0?r:[0,0];if(C){var Q=[y.ctrlpts[0],y.ctrlpts[1]],$=x?[y.ctrlpts[y.ctrlpts.length-2],y.ctrlpts[y.ctrlpts.length-1]]:Q;L=$,I=Q}else if(P){var Z=B?y.segpts.slice(0,2):[c.x+Y[0],c.y+Y[1]],J=B?y.segpts.slice(y.segpts.length-2):[s.x+W[0],s.y+W[1]];L=J,I=Z}if(R==="inside-to-node")o=[c.x,c.y];else if(N.units)o=this.manualEndptToPx(l,N);else if(R==="outside-to-line")o=y.tgtIntn;else if(R==="outside-to-node"||R==="outside-to-node-or-label"?j=L:(R==="outside-to-line"||R==="outside-to-line-or-label")&&(j=[s.x,s.y]),o=i.nodeShapes[this.getNodeShape(l)].intersectLine(c.x,c.y,l.outerWidth(),l.outerHeight(),j[0],j[1],0,M,m),R==="outside-to-node-or-label"||R==="outside-to-line-or-label"){var re=l._private.rscratch,V=re.labelWidth,O=re.labelHeight,z=re.labelX,H=re.labelY,te=V/2,ae=O/2,we=l.pstyle("text-valign").value;we==="top"?H-=ae:we==="bottom"&&(H+=ae);var ye=l.pstyle("text-halign").value;ye==="left"?z-=te:ye==="right"&&(z+=te);var xe=Cr(j[0],j[1],[z-te,H-ae,z+te,H-ae,z+te,H+ae,z-te,H+ae],c.x,c.y);if(xe.length>0){var Ae=s,ee=wn(Ae,jn(o)),ue=wn(Ae,jn(xe)),ce=ee;if(ue<ee&&(o=xe,ce=ue),xe.length>2){var me=wn(Ae,{x:xe[2],y:xe[3]});me<ce&&(o=[xe[2],xe[3]])}}}var be=Zr(o,L,i.arrowShapes[d].spacing(e)+f),Ee=Zr(o,L,i.arrowShapes[d].gap(e)+f);if(y.endX=Ee[0],y.endY=Ee[1],y.arrowEndX=be[0],y.arrowEndY=be[1],S==="inside-to-node")o=[s.x,s.y];else if(T.units)o=this.manualEndptToPx(u,T);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=i.nodeShapes[this.getNodeShape(u)].intersectLine(s.x,s.y,u.outerWidth(),u.outerHeight(),F[0],F[1],0,A,v),S==="outside-to-node-or-label"||S==="outside-to-line-or-label"){var _e=u._private.rscratch,Oe=_e.labelWidth,Fe=_e.labelHeight,Re=_e.labelX,Se=_e.labelY,ie=Oe/2,ve=Fe/2,E=u.pstyle("text-valign").value;E==="top"?Se-=ve:E==="bottom"&&(Se+=ve);var X=u.pstyle("text-halign").value;X==="left"?Re-=ie:X==="right"&&(Re+=ie);var q=Cr(F[0],F[1],[Re-ie,Se-ve,Re+ie,Se-ve,Re+ie,Se+ve,Re-ie,Se+ve],s.x,s.y);if(q.length>0){var U=c,G=wn(U,jn(o)),oe=wn(U,jn(q)),K=G;if(oe<G&&(o=[q[0],q[1]],K=oe),q.length>2){var de=wn(U,{x:q[2],y:q[3]});de<K&&(o=[q[2],q[3]])}}}var le=Zr(o,I,i.arrowShapes[h].spacing(e)+p),pe=Zr(o,I,i.arrowShapes[h].gap(e)+p);y.startX=pe[0],y.startY=pe[1],y.arrowStartX=le[0],y.arrowStartY=le[1],D&&(!ne(y.startX)||!ne(y.startY)||!ne(y.endX)||!ne(y.endY)?y.badLine=!0:y.badLine=!1)};Fr.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}}};Fr.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 gs={};function ey(e,t,n){for(var r=function(l,s,c,d){return at(l,s,c,d)},a=t._private,i=a.rstyle.bezierPts,o=0;o<e.bezierProjPcts.length;o++){var u=e.bezierProjPcts[o];i.push({x:r(n[0],n[2],n[4],u),y:r(n[1],n[3],n[5],u)})}}gs.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,r==="multibezier"||r==="bezier"||r==="self"||r==="compound"){t.rstyle.bezierPts=[];for(var a=0;a+5<n.allpts.length;a+=4)ey(this,e,n.allpts.slice(a,a+6))}else if(r==="segments")for(var i=t.rstyle.linePts=[],a=0;a+1<n.allpts.length;a+=2)i.push({x:n.allpts[a],y:n.allpts[a+1]});else if(r==="haystack"){var o=n.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};gs.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var Yt={};Yt.recalculateNodeLabelProjection=function(e){var t=e.pstyle("label").strValue;if(!sn(t)){var n,r,a=e._private,i=e.width(),o=e.height(),u=e.padding(),l=e.position(),s=e.pstyle("text-halign").strValue,c=e.pstyle("text-valign").strValue,d=a.rscratch,h=a.rstyle;switch(s){case"left":n=l.x-i/2-u;break;case"right":n=l.x+i/2+u;break;default:n=l.x}switch(c){case"top":r=l.y-o/2-u;break;case"bottom":r=l.y+o/2+u;break;default:r=l.y}d.labelX=n,d.labelY=r,h.labelX=n,h.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var vd=function(e,t){var n=Math.atan(t/e);return e===0&&n<0&&(n=n*-1),n},yd=function(e,t){var n=t.x-e.x,r=t.y-e.y;return vd(n,r)},ty=function(e,t,n,r){var a=Tr(0,r-.001,1),i=Tr(0,r+.001,1),o=Wn(e,t,n,a),u=Wn(e,t,n,i);return yd(o,u)};Yt.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,a=this,i={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(i.mid||i.source||i.target){t={x:r.midX,y:r.midY};var o=function(c,d,h){Ut(n.rscratch,c,d,h),Ut(n.rstyle,c,d,h)};o("labelX",null,t.x),o("labelY",null,t.y);var u=vd(r.midDispX,r.midDispY);o("labelAutoAngle",null,u);var l=function(){if(l.cache)return l.cache;for(var c=[],d=0;d+5<r.allpts.length;d+=4){var h={x:r.allpts[d],y:r.allpts[d+1]},f={x:r.allpts[d+2],y:r.allpts[d+3]},p={x:r.allpts[d+4],y:r.allpts[d+5]};c.push({p0:h,p1:f,p2:p,startDist:0,length:0,segments:[]})}var v=n.rstyle.bezierPts,m=a.bezierProjPcts.length;function g(C,x,P,B,D){var _=_n(x,P),T=C.segments[C.segments.length-1],S={p0:x,p1:P,t0:B,t1:D,startDist:T?T.startDist+T.length:0,length:_};C.segments.push(S),C.length+=_}for(var y=0;y<c.length;y++){var b=c[y],w=c[y-1];w&&(b.startDist=w.startDist+w.length),g(b,b.p0,v[y*m],0,a.bezierProjPcts[0]);for(var k=0;k<m-1;k++)g(b,v[y*m+k],v[y*m+k+1],a.bezierProjPcts[k],a.bezierProjPcts[k+1]);g(b,v[y*m+m-1],b.p2,a.bezierProjPcts[m-1],1)}return l.cache=c},s=function(c){var d,h=c==="source";if(i[c]){var f=e.pstyle(c+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var p=l(),v,m=0,g=0,y=0;y<p.length;y++){for(var b=p[h?y:p.length-1-y],w=0;w<b.segments.length;w++){var k=b.segments[h?w:b.segments.length-1-w],C=y===p.length-1&&w===b.segments.length-1;if(m=g,g+=k.length,g>=f||C){v={cp:b,segment:k};break}}if(v)break}var x=v.cp,P=v.segment,B=(f-m)/P.length,D=P.t1-P.t0,_=h?P.t0+D*B:P.t1-D*B;_=Tr(0,_,1),t=Wn(x.p0,x.p1,x.p2,_),d=ty(x.p0,x.p1,x.p2,_);break}case"straight":case"segments":case"haystack":{for(var T=0,S,A,N,R,M=r.allpts.length,L=0;L+3<M&&(h?(N={x:r.allpts[L],y:r.allpts[L+1]},R={x:r.allpts[L+2],y:r.allpts[L+3]}):(N={x:r.allpts[M-2-L],y:r.allpts[M-1-L]},R={x:r.allpts[M-4-L],y:r.allpts[M-3-L]}),S=_n(N,R),A=T,T+=S,!(T>=f));L+=2);var I=f-A,j=I/S;j=Tr(0,j,1),t=kf(N,R,j),d=yd(N,R);break}}o("labelX",c,t.x),o("labelY",c,t.y),o("labelAutoAngle",c,d)}};s("source"),s("target"),this.applyLabelDimensions(e)}};Yt.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))};Yt.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),a=Pn(r,e._private.labelDimsKey);if(kt(n.rscratch,"prefixedLabelDimsKey",t)!==a){Ut(n.rscratch,"prefixedLabelDimsKey",t,a);var i=this.calculateLabelDimensions(e,r),o=e.pstyle("line-height").pfValue,u=e.pstyle("text-wrap").strValue,l=kt(n.rscratch,"labelWrapCachedLines",t)||[],s=u!=="wrap"?1:Math.max(l.length,1),c=i.height/s,d=c*o,h=i.width,f=i.height+(s-1)*(o-1)*c;Ut(n.rstyle,"labelWidth",t,h),Ut(n.rscratch,"labelWidth",t,h),Ut(n.rstyle,"labelHeight",t,f),Ut(n.rscratch,"labelHeight",t,f),Ut(n.rscratch,"labelLineHeight",t,d)}};Yt.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",a=e.pstyle(r+"label").strValue,i=e.pstyle("text-transform").value,o=function(Y,W){return W?(Ut(n.rscratch,Y,t,W),W):kt(n.rscratch,Y,t)};if(!a)return"";i=="none"||(i=="uppercase"?a=a.toUpperCase():i=="lowercase"&&(a=a.toLowerCase()));var u=e.pstyle("text-wrap").value;if(u==="wrap"){var l=o("labelKey");if(l!=null&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var s="",c=a.split(`
|
|
15
|
+
`),d=e.pstyle("text-max-width").pfValue,h=e.pstyle("text-overflow-wrap").value,f=h==="anywhere",p=[],v=/[\s\u200b]+|$/g,m=0;m<c.length;m++){var g=c[m],y=this.calculateLabelDimensions(e,g),b=y.width;if(f){var w=g.split("").join(s);g=w}if(b>d){var k=g.matchAll(v),C="",x=0,P=Ct(k),B;try{for(P.s();!(B=P.n()).done;){var D=B.value,_=D[0],T=g.substring(x,D.index);x=D.index+_.length;var S=C.length===0?T:C+T+_,A=this.calculateLabelDimensions(e,S),N=A.width;N<=d?C+=T+_:(C&&p.push(C),C=T+_)}}catch(Y){P.e(Y)}finally{P.f()}C.match(/^[\s\u200b]+$/)||p.push(C)}else p.push(g)}o("labelWrapCachedLines",p),a=o("labelWrapCachedText",p.join(`
|
|
16
|
+
`)),o("labelWrapKey",l)}else if(u==="ellipsis"){var R=e.pstyle("text-max-width").pfValue,M="",L="…",I=!1;if(this.calculateLabelDimensions(e,a).width<R)return a;for(var j=0;j<a.length;j++){var F=this.calculateLabelDimensions(e,M+a[j]+L).width;if(F>R)break;M+=a[j],j===a.length-1&&(I=!0)}return I||(M+=L),M}return a};Yt.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if(t==="auto")if(e.isNode())switch(n){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return t};Yt.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window(),a=r.document,i=0,o=e.pstyle("font-style").strValue,u=e.pstyle("font-size").pfValue,l=e.pstyle("font-family").strValue,s=e.pstyle("font-weight").strValue,c=this.labelCalcCanvas,d=this.labelCalcCanvasContext;if(!c){c=this.labelCalcCanvas=a.createElement("canvas"),d=this.labelCalcCanvasContext=c.getContext("2d");var h=c.style;h.position="absolute",h.left="-9999px",h.top="-9999px",h.zIndex="-1",h.visibility="hidden",h.pointerEvents="none"}d.font="".concat(o," ").concat(s," ").concat(u,"px ").concat(l);for(var f=0,p=0,v=t.split(`
|
|
17
|
+
`),m=0;m<v.length;m++){var g=v[m],y=d.measureText(g),b=Math.ceil(y.width),w=u;f=Math.max(b,f),p+=w}return f+=i,p+=i,{width:f,height:p}};Yt.calculateLabelAngle=function(e,t){var n=e._private,r=n.rscratch,a=e.isEdge(),i=t?t+"-":"",o=e.pstyle(i+"text-rotation"),u=o.strValue;return u==="none"?0:a&&u==="autorotate"?r.labelAutoAngle:u==="autorotate"?0:o.pfValue};Yt.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private,a=r.rscratch;a.labelAngle=t.calculateLabelAngle(e),n&&(a.sourceLabelAngle=t.calculateLabelAngle(e,"source"),a.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var md={},Mu=28,Ru=!1;md.getNodeShape=function(e){var t=this,n=e.pstyle("shape").value;if(n==="cutrectangle"&&(e.width()<Mu||e.height()<Mu))return Ru||(Ne("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Ru=!0),"rectangle";if(e.isParent())return n==="rectangle"||n==="roundrectangle"||n==="round-rectangle"||n==="cutrectangle"||n==="cut-rectangle"||n==="barrel"?n:"rectangle";if(n==="polygon"){var r=e.pstyle("shape-polygon-points").value;return t.nodeShapes.makePolygon(r).name}return n};var Wa={};Wa.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(i),o)for(var u=0;u<i.length;u++){var l=i[u],s=l._private,c=s.rstyle;c.clean=!1,c.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",function(i){var o=i.target;r(o)}).on("style.* background.*",function(i){var o=i.target;r(o,!1)});var a=function(i){if(i){var o=n.onUpdateEleCalcsFns;t.cleanStyle();for(var u=0;u<t.length;u++){var l=t[u],s=l._private.rstyle;l.isNode()&&!s.cleanConnected&&(r(l.connectedEdges()),s.cleanConnected=!0)}if(o)for(var c=0;c<o.length;c++){var d=o[c];d(i,t)}n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){a(!0)},n.beforeRender(a,n.beforeRenderPriorities.eleCalcs)};Wa.onUpdateEleCalcs=function(e){var t=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];t.push(e)};Wa.recalculateRenderedStyle=function(e,t){var n=function(b){return b._private.rstyle.cleanConnected};if(e.length!==0){var r=[],a=[];if(!this.destroyed){t===void 0&&(t=!0);for(var i=0;i<e.length;i++){var o=e[i],u=o._private,l=u.rstyle;o.isEdge()&&(!n(o.source())||!n(o.target()))&&(l.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(b){return!b._private.rstyle.clean&&b.isBundledBezier()})&&(l.clean=!1),!(t&&l.clean||o.removed())&&o.pstyle("display").value!=="none"&&(u.group==="nodes"?a.push(o):r.push(o),l.clean=!0)}for(var s=0;s<a.length;s++){var c=a[s],d=c._private,h=d.rstyle,f=c.position();this.recalculateNodeLabelProjection(c),h.nodeX=f.x,h.nodeY=f.y,h.nodeW=c.pstyle("width").pfValue,h.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var p=0;p<r.length;p++){var v=r[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 Ga={};Ga.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=e[n],a=r._private.rscratch;r.grabbed()&&!r.isParent()?t.push(r):a.inDragLayer?e.drag.push(r):e.nondrag.push(r)}for(var n=0;n<t.length;n++){var r=t[n];e.drag.push(r)}}};Ga.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};Ga.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(Jc),t.interactive=t.filter(function(n){return n.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var bd={};[Sn,Pa,gt,Fr,gs,Yt,md,Wa,Ga].forEach(function(e){ge(bd,e)});var xd={};xd.getCachedImage=function(e,t,n){var r=this,a=r.imageCache=r.imageCache||{},i=a[e];if(i)return i.image.complete||i.image.addEventListener("load",n),i.image;i=a[e]=a[e]||{};var o=i.image=new Image;o.addEventListener("load",n),o.addEventListener("error",function(){o.error=!0});var u="data:",l=e.substring(0,u.length).toLowerCase()===u;return l||(t=t==="null"?null:t,o.crossOrigin=t),o.src=e,o};var ar={};ar.registerBinding=function(e,t,n,r){var a=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var i=[],o=0;o<e.length;o++){var u=e[o];if(u!==void 0){var l=this.binder(u);i.push(l.on.apply(l,a))}}return i}var l=this.binder(e);return l.on.apply(l,a)};ar.binder=function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||hh(e);if(t.supportsPassiveEvents==null){var a=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});n.addEventListener("test",null,i)}catch{}t.supportsPassiveEvents=a}var o=function(u,l,s){var c=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(c[2]={capture:s??!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}};ar.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()};ar.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()};ar.load=function(){var e=this,t=e.cy.window(),n=function(E){return E.selected()},r=function(E){var X=E.getRootNode();if(X&&X.nodeType===11&&X.host!==void 0)return X},a=function(E,X,q,U){E==null&&(E=e.cy);for(var G=0;G<X.length;G++){var oe=X[G];E.emit({originalEvent:q,type:oe,position:U})}},i=function(E){return E.shiftKey||E.metaKey||E.ctrlKey},o=function(E,X){var q=!0;if(e.cy.hasCompoundNodes()&&E&&E.pannable())for(var U=0;X&&U<X.length;U++){var E=X[U];if(E.isNode()&&E.isParent()&&!E.pannable()){q=!1;break}}else q=!0;return q},u=function(E){E[0]._private.grabbed=!0},l=function(E){E[0]._private.grabbed=!1},s=function(E){E[0]._private.rscratch.inDragLayer=!0},c=function(E){E[0]._private.rscratch.inDragLayer=!1},d=function(E){E[0]._private.rscratch.isGrabTarget=!0},h=function(E){E[0]._private.rscratch.isGrabTarget=!1},f=function(E,X){var q=X.addToList,U=q.has(E);!U&&E.grabbable()&&!E.locked()&&(q.merge(E),u(E))},p=function(E,X){if(E.cy().hasCompoundNodes()&&!(X.inDragLayer==null&&X.addToList==null)){var q=E.descendants();X.inDragLayer&&(q.forEach(s),q.connectedEdges().forEach(s)),X.addToList&&f(q,X)}},v=function(E,X){X=X||{};var q=E.cy().hasCompoundNodes();X.inDragLayer&&(E.forEach(s),E.neighborhood().stdFilter(function(U){return!q||U.isEdge()}).forEach(s)),X.addToList&&E.forEach(function(U){f(U,X)}),p(E,X),y(E,{inDragLayer:X.inDragLayer}),e.updateCachedGrabbedEles()},m=v,g=function(E){E&&(e.getCachedZSortedEles().forEach(function(X){l(X),c(X),h(X)}),e.updateCachedGrabbedEles())},y=function(E,X){if(!(X.inDragLayer==null&&X.addToList==null)&&E.cy().hasCompoundNodes()){var q=E.ancestors().orphans();if(!q.same(E)){var U=q.descendants().spawnSelf().merge(q).unmerge(E).unmerge(E.descendants()),G=U.connectedEdges();X.inDragLayer&&(G.forEach(s),U.forEach(s)),X.addToList&&U.forEach(function(oe){f(oe,X)})}}},b=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},w=typeof MutationObserver<"u",k=typeof ResizeObserver<"u";w?(e.removeObserver=new MutationObserver(function(E){for(var X=0;X<E.length;X++){var q=E[X],U=q.removedNodes;if(U)for(var G=0;G<U.length;G++){var oe=U[G];if(oe===e.container){e.destroy();break}}}}),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",function(E){e.destroy()});var C=Nr(function(){e.cy.resize()},100);w&&(e.styleObserver=new MutationObserver(C),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,"resize",C),k&&(e.resizeObserver=new ResizeObserver(C),e.resizeObserver.observe(e.container));var x=function(E,X){for(;E!=null;)X(E),E=E.parentNode},P=function(){e.invalidateContainerClientCoordsCache()};x(e.container,function(E){e.registerBinding(E,"transitionend",P),e.registerBinding(E,"animationend",P),e.registerBinding(E,"scroll",P)}),e.registerBinding(e.container,"contextmenu",function(E){E.preventDefault()});var B=function(){return e.selection[4]!==0},D=function(E){for(var X=e.findContainerClientCoords(),q=X[0],U=X[1],G=X[2],oe=X[3],K=E.touches?E.touches:[E],de=!1,le=0;le<K.length;le++){var pe=K[le];if(q<=pe.clientX&&pe.clientX<=q+G&&U<=pe.clientY&&pe.clientY<=U+oe){de=!0;break}}if(!de)return!1;for(var Pe=e.container,ke=E.target,he=ke.parentNode,Te=!1;he;){if(he===Pe){Te=!0;break}he=he.parentNode}return!!Te};e.registerBinding(e.container,"mousedown",function(E){if(D(E)&&!(e.hoverData.which===1&&E.which!==1)){E.preventDefault(),b(),e.hoverData.capture=!0,e.hoverData.which=E.which;var X=e.cy,q=[E.clientX,E.clientY],U=e.projectIntoViewport(q[0],q[1]),G=e.selection,oe=e.findNearestElements(U[0],U[1],!0,!1),K=oe[0],de=e.dragData.possibleDragElements;e.hoverData.mdownPos=U,e.hoverData.mdownGPos=q;var le=function(Te){return{originalEvent:E,type:Te,position:{x:U[0],y:U[1]}}},pe=function(){e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout(function(){if(!e.hoverData.tapholdCancelled){var Te=e.hoverData.down;Te?Te.emit(le("taphold")):X.emit(le("taphold"))}},e.tapholdDuration)};if(E.which==3){e.hoverData.cxtStarted=!0;var Pe={originalEvent:E,type:"cxttapstart",position:{x:U[0],y:U[1]}};K?(K.activate(),K.emit(Pe),e.hoverData.down=K):X.emit(Pe),e.hoverData.downTime=new Date().getTime(),e.hoverData.cxtDragged=!1}else if(E.which==1){K&&K.activate();{if(K!=null&&e.nodeIsGrabbable(K)){var ke=function(Te){Te.emit(le("grab"))};if(d(K),!K.selected())de=e.dragData.possibleDragElements=X.collection(),m(K,{addToList:de}),K.emit(le("grabon")).emit(le("grab"));else{de=e.dragData.possibleDragElements=X.collection();var he=X.$(function(Te){return Te.isNode()&&Te.selected()&&e.nodeIsGrabbable(Te)});v(he,{addToList:de}),K.emit(le("grabon")),he.forEach(ke)}e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=K,e.hoverData.downs=oe,e.hoverData.downTime=new Date().getTime()}a(K,["mousedown","tapstart","vmousedown"],E,{x:U[0],y:U[1]}),K==null?(G[4]=1,e.data.bgActivePosistion={x:U[0],y:U[1]},e.redrawHint("select",!0),e.redraw()):K.pannable()&&(G[4]=1),pe()}G[0]=G[2]=U[0],G[1]=G[3]=U[1]}},!1);var _=r(e.container);e.registerBinding([t,_],"mousemove",function(E){var X=e.hoverData.capture;if(!(!X&&!D(E))){var q=!1,U=e.cy,G=U.zoom(),oe=[E.clientX,E.clientY],K=e.projectIntoViewport(oe[0],oe[1]),de=e.hoverData.mdownPos,le=e.hoverData.mdownGPos,pe=e.selection,Pe=null;!e.hoverData.draggingEles&&!e.hoverData.dragging&&!e.hoverData.selecting&&(Pe=e.findNearestElement(K[0],K[1],!0,!1));var ke=e.hoverData.last,he=e.hoverData.down,Te=[K[0]-pe[2],K[1]-pe[3]],Ie=e.dragData.possibleDragElements,We;if(le){var st=oe[0]-le[0],vt=st*st,He=oe[1]-le[1],rt=He*He,Ke=vt+rt;e.hoverData.isOverThresholdDrag=We=Ke>=e.desktopTapThreshold2}var yt=i(E);We&&(e.hoverData.tapholdCancelled=!0);var Qt=function(){var Nt=e.hoverData.dragDelta=e.hoverData.dragDelta||[];Nt.length===0?(Nt.push(Te[0]),Nt.push(Te[1])):(Nt[0]+=Te[0],Nt[1]+=Te[1])};q=!0,a(Pe,["mousemove","vmousemove","tapdrag"],E,{x:K[0],y:K[1]});var Ze=function(Nt){return{originalEvent:E,type:Nt,position:{x:K[0],y:K[1]}}},_t=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||U.emit(Ze("boxstart")),pe[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(e.hoverData.which===3){if(We){var jr=Ze("cxtdrag");he?he.emit(jr):U.emit(jr),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||Pe!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit(Ze("cxtdragout")),e.hoverData.cxtOver=Pe,Pe&&Pe.emit(Ze("cxtdragover")))}}else if(e.hoverData.dragging){if(q=!0,U.panningEnabled()&&U.userPanningEnabled()){var Rn;if(e.hoverData.justStartedPan){var qr=e.hoverData.mdownPos;Rn={x:(K[0]-qr[0])*G,y:(K[1]-qr[1])*G},e.hoverData.justStartedPan=!1}else Rn={x:Te[0]*G,y:Te[1]*G};U.panBy(Rn),U.emit(Ze("dragpan")),e.hoverData.dragged=!0}K=e.projectIntoViewport(E.clientX,E.clientY)}else if(pe[4]==1&&(he==null||he.pannable())){if(We){if(!e.hoverData.dragging&&U.boxSelectionEnabled()&&(yt||!U.panningEnabled()||!U.userPanningEnabled()))_t();else if(!e.hoverData.selecting&&U.panningEnabled()&&U.userPanningEnabled()){var mn=o(he,e.hoverData.downs);mn&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,pe[4]=0,e.data.bgActivePosistion=jn(de),e.redrawHint("select",!0),e.redraw())}he&&he.pannable()&&he.active()&&he.unactivate()}}else{if(he&&he.pannable()&&he.active()&&he.unactivate(),(!he||!he.grabbed())&&Pe!=ke&&(ke&&a(ke,["mouseout","tapdragout"],E,{x:K[0],y:K[1]}),Pe&&a(Pe,["mouseover","tapdragover"],E,{x:K[0],y:K[1]}),e.hoverData.last=Pe),he)if(We){if(U.boxSelectionEnabled()&&yt)he&&he.grabbed()&&(g(Ie),he.emit(Ze("freeon")),Ie.emit(Ze("free")),e.dragData.didDrag&&(he.emit(Ze("dragfreeon")),Ie.emit(Ze("dragfree")))),_t();else if(he&&he.grabbed()&&e.nodeIsDraggable(he)){var wt=!e.dragData.didDrag;wt&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||v(Ie,{inDragLayer:!0});var ht={x:0,y:0};if(ne(Te[0])&&ne(Te[1])&&(ht.x+=Te[0],ht.y+=Te[1],wt)){var Et=e.hoverData.dragDelta;Et&&ne(Et[0])&&ne(Et[1])&&(ht.x+=Et[0],ht.y+=Et[1])}e.hoverData.draggingEles=!0,Ie.silentShift(ht).emit(Ze("position")).emit(Ze("drag")),e.redrawHint("drag",!0),e.redraw()}}else Qt();q=!0}if(pe[2]=K[0],pe[3]=K[1],q)return E.stopPropagation&&E.stopPropagation(),E.preventDefault&&E.preventDefault(),!1}},!1);var T,S,A;e.registerBinding(t,"mouseup",function(E){if(!(e.hoverData.which===1&&E.which!==1&&e.hoverData.capture)){var X=e.hoverData.capture;if(X){e.hoverData.capture=!1;var q=e.cy,U=e.projectIntoViewport(E.clientX,E.clientY),G=e.selection,oe=e.findNearestElement(U[0],U[1],!0,!1),K=e.dragData.possibleDragElements,de=e.hoverData.down,le=i(E);e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,de&&de.unactivate();var pe=function(We){return{originalEvent:E,type:We,position:{x:U[0],y:U[1]}}};if(e.hoverData.which===3){var Pe=pe("cxttapend");if(de?de.emit(Pe):q.emit(Pe),!e.hoverData.cxtDragged){var ke=pe("cxttap");de?de.emit(ke):q.emit(ke)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(a(oe,["mouseup","tapend","vmouseup"],E,{x:U[0],y:U[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(a(de,["click","tap","vclick"],E,{x:U[0],y:U[1]}),S=!1,E.timeStamp-A<=q.multiClickDebounceTime()?(T&&clearTimeout(T),S=!0,A=null,a(de,["dblclick","dbltap","vdblclick"],E,{x:U[0],y:U[1]})):(T=setTimeout(function(){S||a(de,["oneclick","onetap","voneclick"],E,{x:U[0],y:U[1]})},q.multiClickDebounceTime()),A=E.timeStamp)),de==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!i(E)&&(q.$(n).unselect(["tapunselect"]),K.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=K=q.collection()),oe==de&&!e.dragData.didDrag&&!e.hoverData.selecting&&oe!=null&&oe._private.selectable&&(e.hoverData.dragging||(q.selectionType()==="additive"||le?oe.selected()?oe.unselect(["tapunselect"]):oe.select(["tapselect"]):le||(q.$(n).unmerge(oe).unselect(["tapunselect"]),oe.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var he=q.collection(e.getAllInBox(G[0],G[1],G[2],G[3]));e.redrawHint("select",!0),he.length>0&&e.redrawHint("eles",!0),q.emit(pe("boxend"));var Te=function(We){return We.selectable()&&!We.selected()};q.selectionType()==="additive"||le||q.$(n).unmerge(he).unselect(),he.emit(pe("box")).stdFilter(Te).select().emit(pe("boxselect")),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!G[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var Ie=de&&de.grabbed();g(K),Ie&&(de.emit(pe("freeon")),K.emit(pe("free")),e.dragData.didDrag&&(de.emit(pe("dragfreeon")),K.emit(pe("dragfree"))))}}G[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 N=[],R=4,M,L=1e5,I=function(E,X){for(var q=0;q<E.length;q++)if(E[q]%X!==0)return!1;return!0},j=function(E){for(var X=Math.abs(E[0]),q=1;q<E.length;q++)if(Math.abs(E[q])!==X)return!1;return!0},F=function(E){var X=!1,q=E.deltaY;if(q==null&&(E.wheelDeltaY!=null?q=E.wheelDeltaY/4:E.wheelDelta!=null&&(q=E.wheelDelta/4)),q!==0){if(M==null)if(N.length>=R){var U=N;if(M=I(U,5),!M){var G=Math.abs(U[0]);M=j(U)&&G>5}if(M)for(var oe=0;oe<U.length;oe++)L=Math.min(Math.abs(U[oe]),L)}else N.push(q),X=!0;else M&&(L=Math.min(Math.abs(q),L));if(!e.scrollingPage){var K=e.cy,de=K.zoom(),le=K.pan(),pe=e.projectIntoViewport(E.clientX,E.clientY),Pe=[pe[0]*de+le.x,pe[1]*de+le.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||B()){E.preventDefault();return}if(K.panningEnabled()&&K.userPanningEnabled()&&K.zoomingEnabled()&&K.userZoomingEnabled()){E.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 ke;X&&Math.abs(q)>5&&(q=ts(q)*5),ke=q/-250,M&&(ke/=L,ke*=3),ke=ke*e.wheelSensitivity;var he=E.deltaMode===1;he&&(ke*=33);var Te=K.zoom()*Math.pow(10,ke);E.type==="gesturechange"&&(Te=e.gestureStartZoom*E.scale),K.zoom({level:Te,renderedPosition:{x:Pe[0],y:Pe[1]}}),K.emit({type:E.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:E,position:{x:pe[0],y:pe[1]}})}}}};e.registerBinding(e.container,"wheel",F,!0),e.registerBinding(t,"scroll",function(E){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(E){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||E.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(E){e.hasTouchStarted||F(E)},!0),e.registerBinding(e.container,"mouseout",function(E){var X=e.projectIntoViewport(E.clientX,E.clientY);e.cy.emit({originalEvent:E,type:"mouseout",position:{x:X[0],y:X[1]}})},!1),e.registerBinding(e.container,"mouseover",function(E){var X=e.projectIntoViewport(E.clientX,E.clientY);e.cy.emit({originalEvent:E,type:"mouseover",position:{x:X[0],y:X[1]}})},!1);var Y,W,Q,$,Z,J,re,V,O,z,H,te,ae,we=function(E,X,q,U){return Math.sqrt((q-E)*(q-E)+(U-X)*(U-X))},ye=function(E,X,q,U){return(q-E)*(q-E)+(U-X)*(U-X)},xe;e.registerBinding(e.container,"touchstart",xe=function(E){if(e.hasTouchStarted=!0,!!D(E)){b(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var X=e.cy,q=e.touchData.now,U=e.touchData.earlier;if(E.touches[0]){var G=e.projectIntoViewport(E.touches[0].clientX,E.touches[0].clientY);q[0]=G[0],q[1]=G[1]}if(E.touches[1]){var G=e.projectIntoViewport(E.touches[1].clientX,E.touches[1].clientY);q[2]=G[0],q[3]=G[1]}if(E.touches[2]){var G=e.projectIntoViewport(E.touches[2].clientX,E.touches[2].clientY);q[4]=G[0],q[5]=G[1]}var oe=function(Ke){return{originalEvent:E,type:Ke,position:{x:q[0],y:q[1]}}};if(E.touches[1]){e.touchData.singleTouchMoved=!0,g(e.dragData.touchDragEles);var K=e.findContainerClientCoords();O=K[0],z=K[1],H=K[2],te=K[3],Y=E.touches[0].clientX-O,W=E.touches[0].clientY-z,Q=E.touches[1].clientX-O,$=E.touches[1].clientY-z,ae=0<=Y&&Y<=H&&0<=Q&&Q<=H&&0<=W&&W<=te&&0<=$&&$<=te;var de=X.pan(),le=X.zoom();Z=we(Y,W,Q,$),J=ye(Y,W,Q,$),re=[(Y+Q)/2,(W+$)/2],V=[(re[0]-de.x)/le,(re[1]-de.y)/le];var pe=200,Pe=pe*pe;if(J<Pe&&!E.touches[2]){var ke=e.findNearestElement(q[0],q[1],!0,!0),he=e.findNearestElement(q[2],q[3],!0,!0);ke&&ke.isNode()?(ke.activate().emit(oe("cxttapstart")),e.touchData.start=ke):he&&he.isNode()?(he.activate().emit(oe("cxttapstart")),e.touchData.start=he):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(E.touches[2])X.boxSelectionEnabled()&&E.preventDefault();else if(!E.touches[1]&&E.touches[0]){var Te=e.findNearestElements(q[0],q[1],!0,!0),Ie=Te[0];if(Ie!=null&&(Ie.activate(),e.touchData.start=Ie,e.touchData.starts=Te,e.nodeIsGrabbable(Ie))){var We=e.dragData.touchDragEles=X.collection(),st=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),Ie.selected()?(st=X.$(function(Ke){return Ke.selected()&&e.nodeIsGrabbable(Ke)}),v(st,{addToList:We})):m(Ie,{addToList:We}),d(Ie),Ie.emit(oe("grabon")),st?st.forEach(function(Ke){Ke.emit(oe("grab"))}):Ie.emit(oe("grab"))}a(Ie,["touchstart","tapstart","vmousedown"],E,{x:q[0],y:q[1]}),Ie==null&&(e.data.bgActivePosistion={x:G[0],y:G[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&&a(e.touchData.start,["taphold"],E,{x:q[0],y:q[1]})},e.tapholdDuration)}if(E.touches.length>=1){for(var vt=e.touchData.startPosition=[null,null,null,null,null,null],He=0;He<q.length;He++)vt[He]=U[He]=q[He];var rt=E.touches[0];e.touchData.startGPosition=[rt.clientX,rt.clientY]}}},!1);var Ae;e.registerBinding(t,"touchmove",Ae=function(E){var X=e.touchData.capture;if(!(!X&&!D(E))){var q=e.selection,U=e.cy,G=e.touchData.now,oe=e.touchData.earlier,K=U.zoom();if(E.touches[0]){var de=e.projectIntoViewport(E.touches[0].clientX,E.touches[0].clientY);G[0]=de[0],G[1]=de[1]}if(E.touches[1]){var de=e.projectIntoViewport(E.touches[1].clientX,E.touches[1].clientY);G[2]=de[0],G[3]=de[1]}if(E.touches[2]){var de=e.projectIntoViewport(E.touches[2].clientX,E.touches[2].clientY);G[4]=de[0],G[5]=de[1]}var le=function(Qd){return{originalEvent:E,type:Qd,position:{x:G[0],y:G[1]}}},pe=e.touchData.startGPosition,Pe;if(X&&E.touches[0]&&pe){for(var ke=[],he=0;he<G.length;he++)ke[he]=G[he]-oe[he];var Te=E.touches[0].clientX-pe[0],Ie=Te*Te,We=E.touches[0].clientY-pe[1],st=We*We,vt=Ie+st;Pe=vt>=e.touchTapThreshold2}if(X&&e.touchData.cxt){E.preventDefault();var He=E.touches[0].clientX-O,rt=E.touches[0].clientY-z,Ke=E.touches[1].clientX-O,yt=E.touches[1].clientY-z,Qt=ye(He,rt,Ke,yt),Ze=Qt/J,_t=150,jr=_t*_t,Rn=1.5,qr=Rn*Rn;if(Ze>=qr||Qt>=jr){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var mn=le("cxttapend");e.touchData.start?(e.touchData.start.unactivate().emit(mn),e.touchData.start=null):U.emit(mn)}}if(X&&e.touchData.cxt){var mn=le("cxtdrag");e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(mn):U.emit(mn),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var wt=e.findNearestElement(G[0],G[1],!0,!0);(!e.touchData.cxtOver||wt!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit(le("cxtdragout")),e.touchData.cxtOver=wt,wt&&wt.emit(le("cxtdragover")))}else if(X&&E.touches[2]&&U.boxSelectionEnabled())E.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||U.emit(le("boxstart")),e.touchData.selecting=!0,e.touchData.didSelect=!0,q[4]=1,!q||q.length===0||q[0]===void 0?(q[0]=(G[0]+G[2]+G[4])/3,q[1]=(G[1]+G[3]+G[5])/3,q[2]=(G[0]+G[2]+G[4])/3+1,q[3]=(G[1]+G[3]+G[5])/3+1):(q[2]=(G[0]+G[2]+G[4])/3,q[3]=(G[1]+G[3]+G[5])/3),e.redrawHint("select",!0),e.redraw();else if(X&&E.touches[1]&&!e.touchData.didSelect&&U.zoomingEnabled()&&U.panningEnabled()&&U.userZoomingEnabled()&&U.userPanningEnabled()){E.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var ht=e.dragData.touchDragEles;if(ht){e.redrawHint("drag",!0);for(var Et=0;Et<ht.length;Et++){var Nt=ht[Et]._private;Nt.grabbed=!1,Nt.rscratch.inDragLayer=!1}}var Ur=e.touchData.start,He=E.touches[0].clientX-O,rt=E.touches[0].clientY-z,Ke=E.touches[1].clientX-O,yt=E.touches[1].clientY-z,ms=we(He,rt,Ke,yt),Yd=ms/Z;if(ae){var jd=He-Y,qd=rt-W,Ud=Ke-Q,Wd=yt-$,Gd=(jd+Ud)/2,Hd=(qd+Wd)/2,or=U.zoom(),Ha=or*Yd,Wr=U.pan(),bs=V[0]*or+Wr.x,xs=V[1]*or+Wr.y,Kd={x:-Ha/or*(bs-Wr.x-Gd)+bs,y:-Ha/or*(xs-Wr.y-Hd)+xs};if(Ur&&Ur.active()){var ht=e.dragData.touchDragEles;g(ht),e.redrawHint("drag",!0),e.redrawHint("eles",!0),Ur.unactivate().emit(le("freeon")),ht.emit(le("free")),e.dragData.didDrag&&(Ur.emit(le("dragfreeon")),ht.emit(le("dragfree")))}U.viewport({zoom:Ha,pan:Kd,cancelOnFailedZoom:!0}),U.emit(le("pinchzoom")),Z=ms,Y=He,W=rt,Q=Ke,$=yt,e.pinching=!0}if(E.touches[0]){var de=e.projectIntoViewport(E.touches[0].clientX,E.touches[0].clientY);G[0]=de[0],G[1]=de[1]}if(E.touches[1]){var de=e.projectIntoViewport(E.touches[1].clientX,E.touches[1].clientY);G[2]=de[0],G[3]=de[1]}if(E.touches[2]){var de=e.projectIntoViewport(E.touches[2].clientX,E.touches[2].clientY);G[4]=de[0],G[5]=de[1]}}else if(E.touches[0]&&!e.touchData.didSelect){var St=e.touchData.start,Ka=e.touchData.last,wt;if(!e.hoverData.draggingEles&&!e.swipePanning&&(wt=e.findNearestElement(G[0],G[1],!0,!0)),X&&St!=null&&E.preventDefault(),X&&St!=null&&e.nodeIsDraggable(St))if(Pe){var ht=e.dragData.touchDragEles,ws=!e.dragData.didDrag;ws&&v(ht,{inDragLayer:!0}),e.dragData.didDrag=!0;var sr={x:0,y:0};if(ne(ke[0])&&ne(ke[1])&&(sr.x+=ke[0],sr.y+=ke[1],ws)){e.redrawHint("eles",!0);var Mt=e.touchData.dragDelta;Mt&&ne(Mt[0])&&ne(Mt[1])&&(sr.x+=Mt[0],sr.y+=Mt[1])}e.hoverData.draggingEles=!0,ht.silentShift(sr).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 Mt=e.touchData.dragDelta=e.touchData.dragDelta||[];Mt.length===0?(Mt.push(ke[0]),Mt.push(ke[1])):(Mt[0]+=ke[0],Mt[1]+=ke[1])}if(a(St||wt,["touchmove","tapdrag","vmousemove"],E,{x:G[0],y:G[1]}),(!St||!St.grabbed())&&wt!=Ka&&(Ka&&Ka.emit(le("tapdragout")),wt&&wt.emit(le("tapdragover"))),e.touchData.last=wt,X)for(var Et=0;Et<G.length;Et++)G[Et]&&e.touchData.startPosition[Et]&&Pe&&(e.touchData.singleTouchMoved=!0);if(X&&(St==null||St.pannable())&&U.panningEnabled()&&U.userPanningEnabled()){var Zd=o(St,e.touchData.starts);Zd&&(E.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=jn(e.touchData.startPosition)),e.swipePanning?(U.panBy({x:ke[0]*K,y:ke[1]*K}),U.emit(le("dragpan"))):Pe&&(e.swipePanning=!0,U.panBy({x:Te*K,y:We*K}),U.emit(le("dragpan")),St&&(St.unactivate(),e.redrawHint("select",!0),e.touchData.start=null)));var de=e.projectIntoViewport(E.touches[0].clientX,E.touches[0].clientY);G[0]=de[0],G[1]=de[1]}}for(var he=0;he<G.length;he++)oe[he]=G[he];X&&E.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 ee;e.registerBinding(t,"touchcancel",ee=function(E){var X=e.touchData.start;e.touchData.capture=!1,X&&X.unactivate()});var ue,ce,me,be;if(e.registerBinding(t,"touchend",ue=function(E){var X=e.touchData.start,q=e.touchData.capture;if(q)E.touches.length===0&&(e.touchData.capture=!1),E.preventDefault();else return;var U=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var G=e.cy,oe=G.zoom(),K=e.touchData.now,de=e.touchData.earlier;if(E.touches[0]){var le=e.projectIntoViewport(E.touches[0].clientX,E.touches[0].clientY);K[0]=le[0],K[1]=le[1]}if(E.touches[1]){var le=e.projectIntoViewport(E.touches[1].clientX,E.touches[1].clientY);K[2]=le[0],K[3]=le[1]}if(E.touches[2]){var le=e.projectIntoViewport(E.touches[2].clientX,E.touches[2].clientY);K[4]=le[0],K[5]=le[1]}var pe=function(_t){return{originalEvent:E,type:_t,position:{x:K[0],y:K[1]}}};X&&X.unactivate();var Pe;if(e.touchData.cxt){if(Pe=pe("cxttapend"),X?X.emit(Pe):G.emit(Pe),!e.touchData.cxtDragged){var ke=pe("cxttap");X?X.emit(ke):G.emit(ke)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!E.touches[2]&&G.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var he=G.collection(e.getAllInBox(U[0],U[1],U[2],U[3]));U[0]=void 0,U[1]=void 0,U[2]=void 0,U[3]=void 0,U[4]=0,e.redrawHint("select",!0),G.emit(pe("boxend"));var Te=function(_t){return _t.selectable()&&!_t.selected()};he.emit(pe("box")).stdFilter(Te).select().emit(pe("boxselect")),he.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(X!=null&&X.unactivate(),E.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(!E.touches[1]&&!E.touches[0]&&!E.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var Ie=e.dragData.touchDragEles;if(X!=null){var We=X._private.grabbed;g(Ie),e.redrawHint("drag",!0),e.redrawHint("eles",!0),We&&(X.emit(pe("freeon")),Ie.emit(pe("free")),e.dragData.didDrag&&(X.emit(pe("dragfreeon")),Ie.emit(pe("dragfree")))),a(X,["touchend","tapend","vmouseup","tapdragout"],E,{x:K[0],y:K[1]}),X.unactivate(),e.touchData.start=null}else{var st=e.findNearestElement(K[0],K[1],!0,!0);a(st,["touchend","tapend","vmouseup","tapdragout"],E,{x:K[0],y:K[1]})}var vt=e.touchData.startPosition[0]-K[0],He=vt*vt,rt=e.touchData.startPosition[1]-K[1],Ke=rt*rt,yt=He+Ke,Qt=yt*oe*oe;e.touchData.singleTouchMoved||(X||G.$(":selected").unselect(["tapunselect"]),a(X,["tap","vclick"],E,{x:K[0],y:K[1]}),ce=!1,E.timeStamp-be<=G.multiClickDebounceTime()?(me&&clearTimeout(me),ce=!0,be=null,a(X,["dbltap","vdblclick"],E,{x:K[0],y:K[1]})):(me=setTimeout(function(){ce||a(X,["onetap","voneclick"],E,{x:K[0],y:K[1]})},G.multiClickDebounceTime()),be=E.timeStamp)),X!=null&&!e.dragData.didDrag&&X._private.selectable&&Qt<e.touchTapThreshold2&&!e.pinching&&(G.selectionType()==="single"?(G.$(n).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<K.length;Ze++)de[Ze]=K[Ze];e.dragData.didDrag=!1,E.touches.length===0&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),E.touches.length<2&&(E.touches.length===1&&(e.touchData.startGPosition=[E.touches[0].clientX,E.touches[0].clientY]),e.pinching=!1,e.redrawHint("eles",!0),e.redraw())},!1),typeof TouchEvent>"u"){var Ee=[],_e=function(E){return{clientX:E.clientX,clientY:E.clientY,force:1,identifier:E.pointerId,pageX:E.pageX,pageY:E.pageY,radiusX:E.width/2,radiusY:E.height/2,screenX:E.screenX,screenY:E.screenY,target:E.target}},Oe=function(E){return{event:E,touch:_e(E)}},Fe=function(E){Ee.push(Oe(E))},Re=function(E){for(var X=0;X<Ee.length;X++){var q=Ee[X];if(q.event.pointerId===E.pointerId){Ee.splice(X,1);return}}},Se=function(E){var X=Ee.filter(function(q){return q.event.pointerId===E.pointerId})[0];X.event=E,X.touch=_e(E)},ie=function(E){E.touches=Ee.map(function(X){return X.touch})},ve=function(E){return E.pointerType==="mouse"||E.pointerType===4};e.registerBinding(e.container,"pointerdown",function(E){ve(E)||(E.preventDefault(),Fe(E),ie(E),xe(E))}),e.registerBinding(e.container,"pointerup",function(E){ve(E)||(Re(E),ie(E),ue(E))}),e.registerBinding(e.container,"pointercancel",function(E){ve(E)||(Re(E),ie(E),ee(E))}),e.registerBinding(e.container,"pointermove",function(E){ve(E)||(E.preventDefault(),Se(E),ie(E),Ae(E))})}};var Kt={};Kt.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(n,r,a,i,o,u){this.renderer.nodeShapeImpl("polygon",n,r,a,i,o,this.points)},intersectLine:function(n,r,a,i,o,u,l,s){return Cr(o,u,this.points,n,r,a/2,i/2,l)},checkPoint:function(n,r,a,i,o,u,l,s){return Ht(n,r,this.points,u,l,i,o,[0,-1],a)},hasMiterBounds:e!=="rectangle",miterBounds:function(n,r,a,i,o,u){return Df(this.points,n,r,a,i,o)}}};Kt.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a)},intersectLine:function(e,t,n,r,a,i,o,u){return Of(a,i,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,a,i,o,u){return Cn(e,t,r,a,i,o,n)}}};Kt.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(n,r,a,i,o,u,l){if(u[l]!==void 0&&u[l+"-cx"]===n&&u[l+"-cy"]===r)return u[l];u[l]=new Array(t.length/2),u[l+"-cx"]=n,u[l+"-cy"]=r;var s=a/2,c=i/2;o=o==="auto"?wc(a,i):o;for(var d=new Array(t.length/2),h=0;h<t.length/2;h++)d[h]={x:n+s*t[h*2],y:r+c*t[h*2+1]};var f,p,v,m,g=d.length;for(p=d[g-1],f=0;f<g;f++)v=d[f%g],m=d[(f+1)%g],u[l][f]=ps(p,v,m,o),p=v,v=m;return u[l]},draw:function(n,r,a,i,o,u,l){this.renderer.nodeShapeImpl("round-polygon",n,r,a,i,o,this.points,this.getOrCreateCorners(r,a,i,o,u,l,"drawCorners"))},intersectLine:function(n,r,a,i,o,u,l,s,c){return Vf(o,u,this.points,n,r,a,i,l,this.getOrCreateCorners(n,r,a,i,s,c,"corners"))},checkPoint:function(n,r,a,i,o,u,l,s,c){return Nf(n,r,this.points,u,l,i,o,this.getOrCreateCorners(u,l,i,o,s,c,"corners"))}}};Kt.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:mt(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,this.points,i)},intersectLine:function(e,t,n,r,a,i,o,u){return bc(a,i,e,t,n,r,o,u)},checkPoint:function(e,t,n,r,a,i,o,u){var l=r/2,s=a/2;u=u==="auto"?un(r,a):u,u=Math.min(l,s,u);var c=u*2;return!!(Ht(e,t,this.points,i,o,r,a-c,[0,-1],n)||Ht(e,t,this.points,i,o,r-c,a,[0,-1],n)||Cn(e,t,c,c,i-l+u,o-s+u,n)||Cn(e,t,c,c,i+l-u,o-s+u,n)||Cn(e,t,c,c,i+l-u,o+s-u,n)||Cn(e,t,c,c,i-l+u,o+s-u,n))}}};Kt.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:rs(),points:mt(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,null,i)},generateCutTrianglePts:function(e,t,n,r,a){var i=a==="auto"?this.cornerLength:a,o=t/2,u=e/2,l=n-u,s=n+u,c=r-o,d=r+o;return{topLeft:[l,c+i,l+i,c,l+i,c+i],topRight:[s-i,c,s,c+i,s-i,c+i],bottomRight:[s,d-i,s-i,d,s-i,d-i],bottomLeft:[l+i,d,l,d-i,l+i,d-i]}},intersectLine:function(e,t,n,r,a,i,o,u){var l=this.generateCutTrianglePts(n+2*o,r+2*o,e,t,u),s=[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]);return Cr(a,i,s,e,t)},checkPoint:function(e,t,n,r,a,i,o,u){var l=u==="auto"?this.cornerLength:u;if(Ht(e,t,this.points,i,o,r,a-2*l,[0,-1],n)||Ht(e,t,this.points,i,o,r-2*l,a,[0,-1],n))return!0;var s=this.generateCutTrianglePts(r,a,i,o);return Tt(e,t,s.topLeft)||Tt(e,t,s.topRight)||Tt(e,t,s.bottomRight)||Tt(e,t,s.bottomLeft)}}};Kt.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:mt(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a)},intersectLine:function(e,t,n,r,a,i,o,u){var l=.15,s=.5,c=.85,d=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),h=function(p){var v=Wn({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},l),m=Wn({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},s),g=Wn({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]]},f=[].concat(h(d.topLeft),h(d.topRight),h(d.bottomRight),h(d.bottomLeft));return Cr(a,i,f,e,t)},generateBarrelBezierPts:function(e,t,n,r){var a=t/2,i=e/2,o=n-i,u=n+i,l=r-a,s=r+a,c=Do(e,t),d=c.heightOffset,h=c.widthOffset,f=c.ctrlPtOffsetPct*e,p={topLeft:[o,l+d,o+f,l,o+h,l],topRight:[u-h,l,u-f,l,u,l+d],bottomRight:[u,s-d,u-f,s,u-h,s],bottomLeft:[o+h,s,o+f,s,o,s-d]};return p.topLeft.isTop=!0,p.topRight.isTop=!0,p.bottomLeft.isBottom=!0,p.bottomRight.isBottom=!0,p},checkPoint:function(e,t,n,r,a,i,o,u){var l=Do(r,a),s=l.heightOffset,c=l.widthOffset;if(Ht(e,t,this.points,i,o,r,a-2*s,[0,-1],n)||Ht(e,t,this.points,i,o,r-2*c,a,[0,-1],n))return!0;for(var d=this.generateBarrelBezierPts(r,a,i,o),h=function(C,x,P){var B=P[4],D=P[2],_=P[0],T=P[5],S=P[1],A=Math.min(B,_),N=Math.max(B,_),R=Math.min(T,S),M=Math.max(T,S);if(A<=C&&C<=N&&R<=x&&x<=M){var L=Ff(B,D,_),I=Mf(L[0],L[1],L[2],C),j=I.filter(function(F){return 0<=F&&F<=1});if(j.length>0)return j[0]}return null},f=Object.keys(d),p=0;p<f.length;p++){var v=f[p],m=d[v],g=h(e,t,m);if(g!=null){var y=m[5],b=m[3],w=m[1],k=at(y,b,w,g);if(m.isTop&&k<=t||m.isBottom&&t<=k)return!0}}return!1}}};Kt.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:mt(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,this.points,i)},intersectLine:function(e,t,n,r,a,i,o,u){var l=e-(n/2+o),s=t-(r/2+o),c=s,d=e+(n/2+o),h=rn(a,i,e,t,l,s,d,c,!1);return h.length>0?h:bc(a,i,e,t,n,r,o,u)},checkPoint:function(e,t,n,r,a,i,o,u){u=u==="auto"?un(r,a):u;var l=2*u;if(Ht(e,t,this.points,i,o,r,a-l,[0,-1],n)||Ht(e,t,this.points,i,o,r-l,a,[0,-1],n))return!0;var s=r/2+2*n,c=a/2+2*n,d=[i-s,o-c,i-s,o,i+s,o,i+s,o-c];return!!(Tt(e,t,d)||Cn(e,t,l,l,i+r/2-u,o+a/2-u,n)||Cn(e,t,l,l,i-r/2+u,o+a/2-u,n))}}};Kt.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",mt(3,0)),this.generateRoundPolygon("round-triangle",mt(3,0)),this.generatePolygon("rectangle",mt(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n)}this.generatePolygon("pentagon",mt(5,0)),this.generateRoundPolygon("round-pentagon",mt(5,0)),this.generatePolygon("hexagon",mt(6,0)),this.generateRoundPolygon("round-hexagon",mt(6,0)),this.generatePolygon("heptagon",mt(7,0)),this.generateRoundPolygon("round-heptagon",mt(7,0)),this.generatePolygon("octagon",mt(8,0)),this.generateRoundPolygon("round-octagon",mt(8,0));var r=new Array(20);{var a=Bo(5,0),i=Bo(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var u=0;u<i.length/2;u++)i[u*2]*=o,i[u*2+1]*=o;for(var u=0;u<20/4;u++)r[u*4]=a[u*2],r[u*4+1]=a[u*2+1],r[u*4+2]=i[u*2],r[u*4+3]=i[u*2+1]}r=xc(r),this.generatePolygon("star",r),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 l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l)}e.makePolygon=function(s){var c=s.join("$"),d="polygon-"+c,h;return(h=this[d])?h:t.generatePolygon(d,s)}};var Xr={};Xr.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Xr.redraw=function(e){e=e||gc();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};Xr.beforeRender=function(e,t){if(!this.destroyed){t==null&&qe("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(r,a){return a.priority-r.priority})}};var Iu=function(e,t,n){for(var r=e.beforeRenderCallbacks,a=0;a<r.length;a++)r[a].fn(t,n)};Xr.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function(r){if(!e.destroyed){if(!t.batching())if(e.requestedFrame&&!e.skipFrame){Iu(e,!0,r);var a=Gt();e.render(e.renderOptions);var i=e.lastDrawTime=Gt();e.averageRedrawTime===void 0&&(e.averageRedrawTime=i-a),e.redrawCount===void 0&&(e.redrawCount=0),e.redrawCount++,e.redrawTotalTime===void 0&&(e.redrawTotalTime=0);var o=i-a;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else Iu(e,!1,r);e.skipFrame=!1,ma(n)}};ma(n)}};var ny=function(e){this.init(e)},wd=ny,ir=wd.prototype;ir.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];ir.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container(),r=t.cy.window();if(r){var a=r.document,i=a.head,o="__________cytoscape_stylesheet",u="__________cytoscape_container",l=a.getElementById(o)!=null;if(n.className.indexOf(u)<0&&(n.className=(n.className||"")+" "+u),!l){var s=a.createElement("style");s.id=o,s.textContent="."+u+" { position: relative; }",i.insertBefore(s,i.children[0])}var c=r.getComputedStyle(n),d=c.getPropertyValue("position");d==="static"&&Ne("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()};ir.notify=function(e,t){var n=this,r=n.cy;if(!this.destroyed){if(e==="init"){n.load();return}if(e==="destroy"){n.destroy();return}(e==="add"||e==="remove"||e==="move"&&r.hasCompoundNodes()||e==="load"||e==="zorder"||e==="mount")&&n.invalidateCachedZSortedEles(),e==="viewport"&&n.redrawHint("select",!0),e==="gc"&&n.redrawHint("gc",!0),(e==="load"||e==="resize"||e==="mount")&&(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};ir.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n,a=r.target;(a.off||a.removeEventListener).apply(a,r.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{}};ir.isHeadless=function(){return!1};[fs,bd,xd,ar,Kt,Xr].forEach(function(e){ge(ir,e)});var mo=1e3/60,Ed={setupDequeueing:function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=Nr(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),a=function(o,u){var l=Gt(),s=n.averageRedrawTime,c=n.lastRedrawTime,d=[],h=n.cy.extent(),f=n.getPixelRatio();for(o||n.flushRenderedStyleQueue();;){var p=Gt(),v=p-l,m=p-u;if(c<mo){var g=mo-(o?s:0);if(m>=e.deqFastCost*g)break}else if(o){if(v>=e.deqCost*c||v>=e.deqAvgCost*s)break}else if(m>=e.deqNoDrawCost*mo)break;var y=e.deq(t,f,h);if(y.length>0)for(var b=0;b<y.length;b++)d.push(y[b]);else break}d.length>0&&(e.onDeqd(t,d),!o&&e.shouldRedraw(t,d,f,h)&&r())},i=e.priority||$o;n.beforeRender(a,i(t))}}}},ry=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ba;fn(this,e),this.idsByKey=new Wt,this.keyForId=new Wt,this.cachesByLvl=new Wt,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return pn(e,[{key:"getIdsFor",value:function(t){t==null&&qe("Can not get id list for null key");var n=this.idsByKey,r=this.idsByKey.get(t);return r||(r=new er,n.set(t,r)),r}},{key:"addIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).add(n)}},{key:"deleteIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).delete(n)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var n=t.id(),r=this.keyForId.get(n),a=this.getKey(t);this.deleteIdForKey(r,n),this.addIdForKey(a,n),this.keyForId.set(n,a)}},{key:"deleteKeyMappingFor",value:function(t){var n=t.id(),r=this.keyForId.get(n);this.deleteIdForKey(r,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(t){var n=t.id(),r=this.keyForId.get(n),a=this.getKey(t);return r!==a}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var n=this.cachesByLvl,r=this.lvls,a=n.get(t);return a||(a=new Wt,n.set(t,a),r.push(t)),a}},{key:"getCache",value:function(t,n){return this.getCachesAt(n).get(t)}},{key:"get",value:function(t,n){var r=this.getKey(t),a=this.getCache(r,n);return a!=null&&this.updateKeyMappingFor(t),a}},{key:"getForCachedKey",value:function(t,n){var r=this.keyForId.get(t.id()),a=this.getCache(r,n);return a}},{key:"hasCache",value:function(t,n){return this.getCachesAt(n).has(t)}},{key:"has",value:function(t,n){var r=this.getKey(t);return this.hasCache(r,n)}},{key:"setCache",value:function(t,n,r){r.key=t,this.getCachesAt(n).set(t,r)}},{key:"set",value:function(t,n,r){var a=this.getKey(t);this.setCache(a,n,r),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,n){this.getCachesAt(n).delete(t)}},{key:"delete",value:function(t,n){var r=this.getKey(t);this.deleteCache(r,n)}},{key:"invalidateKey",value:function(t){var n=this;this.lvls.forEach(function(r){return n.deleteCache(t,r)})}},{key:"invalidate",value:function(t){var n=t.id(),r=this.keyForId.get(n);this.deleteKeyMappingFor(t);var a=this.doesEleInvalidateKey(t);return a&&this.invalidateKey(r),a||this.getNumberOfIdsForKey(r)===0}}])}(),Lu=25,aa=50,pa=-4,Yo=3,kd=7.99,ay=8,iy=1024,oy=1024,sy=1024,ly=.2,uy=.8,cy=10,dy=.15,hy=.1,fy=.9,py=.9,gy=100,vy=1,Un={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},yy=ct({getKey:null,doesEleInvalidateKey:ba,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:hc,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),yr=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=yy(t);ge(n,r),n.lookup=new ry(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},nt=yr.prototype;nt.reasons=Un;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,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{},r=n[e]=n[e]||[];return r};nt.getElementQueue=function(){var e=this,t=e.eleCacheQueue=e.eleCacheQueue||new Or(function(n,r){return r.reqs-n.reqs});return t};nt.getElementKeyToQueue=function(){var e=this,t=e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{};return t};nt.getElement=function(e,t,n,r,a){var i=this,o=this.renderer,u=o.cy.zoom(),l=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!i.allowEdgeTxrCaching&&e.isEdge()||!i.allowParentTxrCaching&&e.isParent())return null;if(r==null&&(r=Math.ceil(es(u*n))),r<pa)r=pa;else if(u>=kd||r>Yo)return null;var s=Math.pow(2,r),c=t.h*s,d=t.w*s,h=o.eleTextBiggerThanMin(e,s);if(!this.isVisible(e,h))return null;var f=l.get(e,r);if(f&&f.invalidated&&(f.invalidated=!1,f.texture.invalidatedWidth-=f.width),f)return f;var p;if(c<=Lu?p=Lu:c<=aa?p=aa:p=Math.ceil(c/aa)*aa,c>sy||d>oy)return null;var v=i.getTextureQueue(p),m=v[v.length-2],g=function(){return i.recycleTexture(p,d)||i.addTexture(p,d)};m||(m=v[v.length-1]),m||(m=g()),m.width-m.usedWidth<d&&(m=g());for(var y=function(N){return N&&N.scaledLabelShown===h},b=a&&a===Un.dequeue,w=a&&a===Un.highQuality,k=a&&a===Un.downscale,C,x=r+1;x<=Yo;x++){var P=l.get(e,x);if(P){C=P;break}}var B=C&&C.level===r+1?C:null,D=function(){m.context.drawImage(B.texture.canvas,B.x,0,B.width,B.height,m.usedWidth,0,d,c)};if(m.context.setTransform(1,0,0,1,0,0),m.context.clearRect(m.usedWidth,0,d,p),y(B))D();else if(y(C))if(w){for(var _=C.level;_>r;_--)B=i.getElement(e,t,n,_,Un.downscale);D()}else return i.queueElement(e,C.level-1),C;else{var T;if(!b&&!w&&!k)for(var S=r-1;S>=pa;S--){var A=l.get(e,S);if(A){T=A;break}}if(y(T))return i.queueElement(e,r),T;m.context.translate(m.usedWidth,0),m.context.scale(s,s),this.drawElement(m.context,e,t,h,!1),m.context.scale(1/s,1/s),m.context.translate(-m.usedWidth,0)}return f={x:m.usedWidth,texture:m,level:r,scale:s,width:d,height:c,scaledLabelShown:h},m.usedWidth+=Math.ceil(d+ay),m.eleCaches.push(f),l.set(e,r,f),i.checkTextureFullness(m),f};nt.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])};nt.invalidateElement=function(e){var t=this,n=t.lookup,r=[],a=n.isInvalid(e);if(a){for(var i=pa;i<=Yo;i++){var o=n.getForCachedKey(e,i);o&&r.push(o)}var u=n.invalidate(e);if(u)for(var l=0;l<r.length;l++){var s=r[l],c=s.texture;c.invalidatedWidth+=s.width,s.invalidated=!0,t.checkTextureUtility(c)}t.removeFromQueue(e)}};nt.checkTextureUtility=function(e){e.invalidatedWidth>=ly*e.width&&this.retireTexture(e)};nt.checkTextureFullness=function(e){var t=this,n=t.getTextureQueue(e.height);e.usedWidth/e.width>uy&&e.fullnessChecks>=cy?ln(n,e):e.fullnessChecks++};nt.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),a=this.lookup;ln(r,e),e.retired=!0;for(var i=e.eleCaches,o=0;o<i.length;o++){var u=i[o];a.deleteCache(u.key,u.level)}Jo(i);var l=t.getRetiredTextureQueue(n);l.push(e)};nt.addTexture=function(e,t){var n=this,r=n.getTextureQueue(e),a={};return r.push(a),a.eleCaches=[],a.height=e,a.width=Math.max(iy,t),a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,a.canvas=n.renderer.makeOffscreenCanvas(a.width,a.height),a.context=a.canvas.getContext("2d"),a};nt.recycleTexture=function(e,t){for(var n=this,r=n.getTextureQueue(e),a=n.getRetiredTextureQueue(e),i=0;i<a.length;i++){var o=a[i];if(o.width>=t)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,Jo(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),ln(a,o),r.push(o),o}};nt.queueElement=function(e,t){var n=this,r=n.getElementQueue(),a=n.getElementKeyToQueue(),i=this.getKey(e),o=a[i];if(o)o.level=Math.max(o.level,t),o.eles.merge(e),o.reqs++,r.updateItem(o);else{var u={eles:e.spawn().merge(e),level:t,reqs:1,key:i};r.push(u),a[i]=u}};nt.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=[],i=t.lookup,o=0;o<vy&&n.size()>0;o++){var u=n.pop(),l=u.key,s=u.eles[0],c=i.hasCache(s,u.level);if(r[l]=null,!c){a.push(u);var d=t.getBoundingBox(s);t.getElement(s,d,e,u.level,Un.dequeue)}}return a};nt.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=this.getKey(e),i=r[a];i!=null&&(i.eles.length===1?(i.reqs=Qo,n.updateItem(i),n.pop(),r[a]=null):i.eles.unmerge(e))};nt.onDequeue=function(e){this.onDequeues.push(e)};nt.offDequeue=function(e){ln(this.onDequeues,e)};nt.setupDequeueing=Ed.setupDequeueing({deqRedrawThreshold:gy,deqCost:dy,deqAvgCost:hy,deqNoDrawCost:fy,deqFastCost:py,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++){var r=e.onDequeues[n];r(t)}},shouldRedraw:function(e,t,n,r){for(var a=0;a<t.length;a++)for(var i=t[a].eles,o=0;o<i.length;o++){var u=i[o].boundingBox();if(ns(u,r))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var my=1,br=-4,_a=2,by=3.99,xy=50,wy=50,Ey=.15,ky=.1,Ty=.9,Cy=.9,Py=1,Nu=250,_y=4e3*4e3,Ou=32767,By=!0,Td=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=Gt()-2*Nu,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=Nr(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},wy),n.beforeRender(function(i,o){o-t.lastInvalidationTime<=Nu?t.skipping=!0:t.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip);var a=function(i,o){return o.reqs-i.reqs};t.layersQueue=new Or(a),t.setupDequeueing()},dt=Td.prototype,zu=0,Dy=Math.pow(2,53)-1;dt.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),a=Math.ceil(e.h*n),i=this.renderer.makeOffscreenCanvas(r,a),o={id:zu=++zu%Dy,bb:e,level:t,width:r,height:a,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},u=o.context,l=-o.bb.x1,s=-o.bb.y1;return u.scale(n,n),u.translate(l,s),o};dt.getLayers=function(e,t,n){var r=this,a=r.renderer,i=a.cy,o=i.zoom(),u=r.firstGet;if(r.firstGet=!1,n==null){if(n=Math.ceil(es(o*t)),n<br)n=br;else if(o>=by||n>_a)return null}r.validateLayersElesOrdering(n,e);var l=r.layersByLevel,s=Math.pow(2,n),c=l[n]=l[n]||[],d,h=r.levelIsComplete(n,e),f,p=function(){var B=function(S){if(r.validateLayersElesOrdering(S,e),r.levelIsComplete(S,e))return f=l[S],!0},D=function(S){if(!f)for(var A=n+S;br<=A&&A<=_a&&!B(A);A+=S);};D(1),D(-1);for(var _=c.length-1;_>=0;_--){var T=c[_];T.invalid&&ln(c,T)}};if(!h)p();else return c;var v=function(){if(!d){d=bt();for(var B=0;B<e.length;B++)Pf(d,e[B].boundingBox())}return d},m=function(B){B=B||{};var D=B.after;v();var _=Math.ceil(d.w*s),T=Math.ceil(d.h*s);if(_>Ou||T>Ou)return null;var S=_*T;if(S>_y)return null;var A=r.makeLayer(d,n);if(D!=null){var N=c.indexOf(D)+1;c.splice(N,0,A)}else(B.insert===void 0||B.insert)&&c.unshift(A);return A};if(r.skipping&&!u)return null;for(var g=null,y=e.length/my,b=!u,w=0;w<e.length;w++){var k=e[w],C=k._private.rscratch,x=C.imgLayerCaches=C.imgLayerCaches||{},P=x[n];if(P){g=P;continue}if((!g||g.eles.length>=y||!mc(g.bb,k.boundingBox()))&&(g=m({insert:!0,after:g}),!g))return null;f||b?r.queueLayer(g,k):r.drawEleInLayer(g,k,n,t),g.eles.push(k),x[n]=g}return f||(b?null:c)};dt.getEleLevelForLayerLevel=function(e,t){return e};dt.drawEleInLayer=function(e,t,n,r){var a=this,i=this.renderer,o=e.context,u=t.boundingBox();u.w===0||u.h===0||!t.visible()||(n=a.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(o,!1),i.drawCachedElement(o,t,null,null,n,By),i.setImgSmoothing(o,!0))};dt.levelIsComplete=function(e,t){var n=this,r=n.layersByLevel[e];if(!r||r.length===0)return!1;for(var a=0,i=0;i<r.length;i++){var o=r[i];if(o.reqs>0||o.invalid)return!1;a+=o.eles.length}return a===t.length};dt.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var a=n[r],i=-1,o=0;o<t.length;o++)if(a.eles[0]===t[o]){i=o;break}if(i<0){this.invalidateLayer(a);continue}for(var u=i,o=0;o<a.eles.length;o++)if(a.eles[o]!==t[u+o]){this.invalidateLayer(a);break}}};dt.updateElementsInLayers=function(e,t){for(var n=this,r=Mr(e[0]),a=0;a<e.length;a++)for(var i=r?null:e[a],o=r?e[a]:e[a].ele,u=o._private.rscratch,l=u.imgLayerCaches=u.imgLayerCaches||{},s=br;s<=_a;s++){var c=l[s];c&&(i&&n.getEleLevelForLayerLevel(c.level)!==i.level||t(c,o,i))}};dt.haveLayers=function(){for(var e=this,t=!1,n=br;n<=_a;n++){var r=e.layersByLevel[n];if(r&&r.length>0){t=!0;break}}return t};dt.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=Gt(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,function(n,r,a){t.invalidateLayer(n)}))};dt.invalidateLayer=function(e){if(this.lastInvalidationTime=Gt(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];ln(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a<n.length;a++){var i=n[a]._private.rscratch.imgLayerCaches;i&&(i[t]=null)}}};dt.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(n,r,a){var i=n.replacement;if(i||(i=n.replacement=t.makeLayer(n.bb,n.level),i.replaces=n,i.eles=n.eles),!i.reqs)for(var o=0;o<i.eles.length;o++)t.queueLayer(i,i.eles[o])})};dt.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()};dt.queueLayer=function(e,t){var n=this,r=n.layersQueue,a=e.elesQueue,i=a.hasId=a.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;a.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,r.updateItem(e)):(e.reqs=1,r.push(e))}};dt.dequeue=function(e){for(var t=this,n=t.layersQueue,r=[],a=0;a<Py&&n.size()!==0;){var i=n.peek();if(i.replacement){n.pop();continue}if(i.replaces&&i!==i.replaces.replacement){n.pop();continue}if(i.invalid){n.pop();continue}var o=i.elesQueue.shift();o&&(t.drawEleInLayer(i,o,i.level,e),a++),r.length===0&&r.push(!0),i.elesQueue.length===0&&(n.pop(),i.reqs=0,i.replaces&&t.applyLayerReplacement(i),t.requestRedraw())}return r};dt.applyLayerReplacement=function(e){var t=this,n=t.layersByLevel[e.level],r=e.replaces,a=n.indexOf(r);if(!(a<0||r.invalid)){n[a]=e;for(var i=0;i<e.eles.length;i++){var o=e.eles[i]._private,u=o.imgLayerCaches=o.imgLayerCaches||{};u&&(u[e.level]=e)}t.requestRedraw()}};dt.requestRedraw=Nr(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100);dt.setupDequeueing=Ed.setupDequeueing({deqRedrawThreshold:xy,deqCost:Ey,deqAvgCost:ky,deqNoDrawCost:Ty,deqFastCost:Cy,deq:function(e,t){return e.dequeue(t)},onDeqd:$o,shouldRedraw:hc,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var Cd={},Vu;function Ay(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function Sy(e,t,n){for(var r,a=0;a<t.length;a++){var i=t[a];a===0&&(r=i),e.lineTo(i.x,i.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function Fu(e,t,n){e.beginPath&&e.beginPath();for(var r=t,a=0;a<r.length;a++){var i=r[a];e.lineTo(i.x,i.y)}var o=n,u=n[0];e.moveTo(u.x,u.y);for(var a=1;a<o.length;a++){var i=o[a];e.lineTo(i.x,i.y)}e.closePath&&e.closePath()}function My(e,t,n,r,a){e.beginPath&&e.beginPath(),e.arc(n,r,a,0,Math.PI*2,!1);var i=t,o=i[0];e.moveTo(o.x,o.y);for(var u=0;u<i.length;u++){var l=i[u];e.lineTo(l.x,l.y)}e.closePath&&e.closePath()}function Ry(e,t,n,r){e.arc(t,n,r,0,Math.PI*2,!1)}Cd.arrowShapeImpl=function(e){return(Vu||(Vu={polygon:Ay,"triangle-backcurve":Sy,"triangle-tee":Fu,"circle-triangle":My,"triangle-cross":Fu,circle:Ry}))[e]};var jt={};jt.drawElement=function(e,t,n,r,a,i){var o=this;t.isNode()?o.drawNode(e,t,n,r,a,i):o.drawEdge(e,t,n,r,a,i)};jt.drawElementOverlay=function(e,t){var n=this;t.isNode()?n.drawNodeOverlay(e,t):n.drawEdgeOverlay(e,t)};jt.drawElementUnderlay=function(e,t){var n=this;t.isNode()?n.drawNodeUnderlay(e,t):n.drawEdgeUnderlay(e,t)};jt.drawCachedElementPortion=function(e,t,n,r,a,i,o,u){var l=this,s=n.getBoundingBox(t);if(!(s.w===0||s.h===0)){var c=n.getElement(t,s,r,a,i);if(c!=null){var d=u(l,t);if(d===0)return;var h=o(l,t),f=s.x1,p=s.y1,v=s.w,m=s.h,g,y,b,w,k;if(h!==0){var C=n.getRotationPoint(t);b=C.x,w=C.y,e.translate(b,w),e.rotate(h),k=l.getImgSmoothing(e),k||l.setImgSmoothing(e,!0);var x=n.getRotationOffset(t);g=x.x,y=x.y}else g=f,y=p;var P;d!==1&&(P=e.globalAlpha,e.globalAlpha=P*d),e.drawImage(c.texture.canvas,c.x,0,c.width,c.height,g,y,v,m),d!==1&&(e.globalAlpha=P),h!==0&&(e.rotate(-h),e.translate(-b,-w),k||l.setImgSmoothing(e,!1))}else n.drawElement(e,t)}};var Iy=function(){return 0},Ly=function(e,t){return e.getTextAngle(t,null)},Ny=function(e,t){return e.getTextAngle(t,"source")},Oy=function(e,t){return e.getTextAngle(t,"target")},zy=function(e,t){return t.effectiveOpacity()},bo=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};jt.drawCachedElement=function(e,t,n,r,a,i){var o=this,u=o.data,l=u.eleTxrCache,s=u.lblTxrCache,c=u.slbTxrCache,d=u.tlbTxrCache,h=t.boundingBox(),f=i===!0?l.reasons.highQuality:null;if(!(h.w===0||h.h===0||!t.visible())&&(!r||ns(h,r))){var p=t.isEdge(),v=t.element()._private.rscratch.badLine;o.drawElementUnderlay(e,t),o.drawCachedElementPortion(e,t,l,n,a,f,Iy,zy),(!p||!v)&&o.drawCachedElementPortion(e,t,s,n,a,f,Ly,bo),p&&!v&&(o.drawCachedElementPortion(e,t,c,n,a,f,Ny,bo),o.drawCachedElementPortion(e,t,d,n,a,f,Oy,bo)),o.drawElementOverlay(e,t)}};jt.drawElements=function(e,t){for(var n=this,r=0;r<t.length;r++){var a=t[r];n.drawElement(e,a)}};jt.drawCachedElements=function(e,t,n,r){for(var a=this,i=0;i<t.length;i++){var o=t[i];a.drawCachedElement(e,o,n,r)}};jt.drawCachedNodes=function(e,t,n,r){for(var a=this,i=0;i<t.length;i++){var o=t[i];o.isNode()&&a.drawCachedElement(e,o,n,r)}};jt.drawLayeredElements=function(e,t,n,r){var a=this,i=a.data.lyrTxrCache.getLayers(t,n);if(i)for(var o=0;o<i.length;o++){var u=i[o],l=u.bb;l.w===0||l.h===0||e.drawImage(u.canvas,l.x1,l.y1,l.w,l.h)}else a.drawCachedElements(e,t,n,r)};var Zt={};Zt.drawEdge=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,u=t._private.rscratch;if(!(i&&!t.visible())&&!(u.badLine||u.allpts==null||isNaN(u.allpts[0]))){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var s=i?t.pstyle("opacity").value:1,c=i?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,f=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=s*c,y=s*c,b=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;d==="straight-triangle"?(o.eleStrokeStyle(e,t,A),o.drawEdgeTrianglePath(t,e,u.allpts)):(e.lineWidth=f,e.lineCap=p,o.eleStrokeStyle(e,t,A),o.drawEdgePath(t,e,u.allpts,h),e.lineCap="butt")},w=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;if(e.lineWidth=f+v,e.lineCap=p,v>0)o.colorStrokeStyle(e,m[0],m[1],m[2],A);else{e.lineCap="butt";return}d==="straight-triangle"?o.drawEdgeTrianglePath(t,e,u.allpts):(o.drawEdgePath(t,e,u.allpts,h),e.lineCap="butt")},k=function(){a&&o.drawEdgeOverlay(e,t)},C=function(){a&&o.drawEdgeUnderlay(e,t)},x=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;o.drawArrowheads(e,t,A)},P=function(){o.drawElementText(e,t,null,r)};e.lineJoin="round";var B=t.pstyle("ghost").value==="yes";if(B){var D=t.pstyle("ghost-offset-x").pfValue,_=t.pstyle("ghost-offset-y").pfValue,T=t.pstyle("ghost-opacity").value,S=g*T;e.translate(D,_),b(S),x(S),e.translate(-D,-_)}else w();C(),b(),x(),k(),P(),n&&e.translate(l.x1,l.y1)}};var Pd=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(r!==0){var a=this,i=a.usePaths(),o=n._private.rscratch,u=n.pstyle("".concat(e,"-padding")).pfValue,l=2*u,s=n.pstyle("".concat(e,"-color")).value;t.lineWidth=l,o.edgeType==="self"&&!i?t.lineCap="butt":t.lineCap="round",a.colorStrokeStyle(t,s[0],s[1],s[2],r),a.drawEdgePath(n,t,o.allpts,"solid")}}}};Zt.drawEdgeOverlay=Pd("overlay");Zt.drawEdgeUnderlay=Pd("underlay");Zt.drawEdgePath=function(e,t,n,r){var a=e._private.rscratch,i=t,o,u=!1,l=this.usePaths(),s=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var d=n.join("$"),h=a.pathCacheKey&&a.pathCacheKey===d;h?(o=t=a.pathCache,u=!0):(o=t=new Path2D,a.pathCacheKey=d,a.pathCache=o)}if(i.setLineDash)switch(r){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(s),i.lineDashOffset=c;break;case"solid":i.setLineDash([]);break}if(!u&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var f=2;f+3<n.length;f+=4)t.quadraticCurveTo(n[f],n[f+1],n[f+2],n[f+3]);break;case"straight":case"haystack":for(var p=2;p+1<n.length;p+=2)t.lineTo(n[p],n[p+1]);break;case"segments":if(a.isRound){var v=Ct(a.roundCorners),m;try{for(v.s();!(m=v.n()).done;){var g=m.value;pd(t,g)}}catch(b){v.e(b)}finally{v.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var y=2;y+1<n.length;y+=2)t.lineTo(n[y],n[y+1]);break}t=i,l?t.stroke(o):t.stroke(),t.setLineDash&&t.setLineDash([])};Zt.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,a=0;a+1<n.length;a+=2){var i=[n[a+2]-n[a],n[a+3]-n[a+1]],o=Math.sqrt(i[0]*i[0]+i[1]*i[1]),u=[i[1]/o,-i[0]/o],l=[u[0]*r/2,u[1]*r/2];t.beginPath(),t.moveTo(n[a]-l[0],n[a+1]-l[1]),t.lineTo(n[a]+l[0],n[a+1]+l[1]),t.lineTo(n[a+2],n[a+3]),t.closePath(),t.fill()}};Zt.drawArrowheads=function(e,t,n){var r=t._private.rscratch,a=r.edgeType==="haystack";a||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),a||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)};Zt.drawArrowhead=function(e,t,n,r,a,i,o){if(!(isNaN(r)||r==null||isNaN(a)||a==null||isNaN(i)||i==null)){var u=this,l=t.pstyle(n+"-arrow-shape").value;if(l!=="none"){var s=t.pstyle(n+"-arrow-fill").value==="hollow"?"both":"filled",c=t.pstyle(n+"-arrow-fill").value,d=t.pstyle("width").pfValue,h=t.pstyle(n+"-arrow-width"),f=h.value==="match-line"?d:h.pfValue;h.units==="%"&&(f*=d);var p=t.pstyle("opacity").value;o===void 0&&(o=p);var v=e.globalCompositeOperation;(o!==1||c==="hollow")&&(e.globalCompositeOperation="destination-out",u.colorFillStyle(e,255,255,255,1),u.colorStrokeStyle(e,255,255,255,1),u.drawArrowShape(t,e,s,d,l,f,r,a,i),e.globalCompositeOperation=v);var m=t.pstyle(n+"-arrow-color").value;u.colorFillStyle(e,m[0],m[1],m[2],o),u.colorStrokeStyle(e,m[0],m[1],m[2],o),u.drawArrowShape(t,e,c,d,l,f,r,a,i)}}};Zt.drawArrowShape=function(e,t,n,r,a,i,o,u,l){var s=this,c=this.usePaths()&&a!=="triangle-cross",d=!1,h,f=t,p={x:o,y:u},v=e.pstyle("arrow-scale").value,m=this.getArrowWidth(r,v),g=s.arrowShapes[a];if(c){var y=s.arrowPathCache=s.arrowPathCache||[],b=Pn(a),w=y[b];w!=null?(h=t=w,d=!0):(h=t=new Path2D,y[b]=h)}d||(t.beginPath&&t.beginPath(),c?g.draw(t,1,0,{x:0,y:0},1):g.draw(t,m,l,p,r),t.closePath&&t.closePath()),t=f,c&&(t.translate(o,u),t.rotate(l),t.scale(m,m)),(n==="filled"||n==="both")&&(c?t.fill(h):t.fill()),(n==="hollow"||n==="both")&&(t.lineWidth=i/(c?m:1),t.lineJoin="miter",c?t.stroke(h):t.stroke()),c&&(t.scale(1/m,1/m),t.rotate(-l),t.translate(-o,-u))};var vs={};vs.safeDrawImage=function(e,t,n,r,a,i,o,u,l,s){if(!(a<=0||i<=0||l<=0||s<=0))try{e.drawImage(t,n,r,a,i,o,u,l,s)}catch(c){Ne(c)}};vs.drawInscribedImage=function(e,t,n,r,a){var i=this,o=n.position(),u=o.x,l=o.y,s=n.cy().style(),c=s.getIndexedStyle.bind(s),d=c(n,"background-fit","value",r),h=c(n,"background-repeat","value",r),f=n.width(),p=n.height(),v=n.padding()*2,m=f+(c(n,"background-width-relative-to","value",r)==="inner"?0:v),g=p+(c(n,"background-height-relative-to","value",r)==="inner"?0:v),y=n._private.rscratch,b=c(n,"background-clip","value",r),w=b==="node",k=c(n,"background-image-opacity","value",r)*a,C=c(n,"background-image-smoothing","value",r),x=n.pstyle("corner-radius").value;x!=="auto"&&(x=n.pstyle("corner-radius").pfValue);var P=t.width||t.cachedW,B=t.height||t.cachedH;(P==null||B==null)&&(document.body.appendChild(t),P=t.cachedW=t.width||t.offsetWidth,B=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var D=P,_=B;if(c(n,"background-width","value",r)!=="auto"&&(c(n,"background-width","units",r)==="%"?D=c(n,"background-width","pfValue",r)*m:D=c(n,"background-width","pfValue",r)),c(n,"background-height","value",r)!=="auto"&&(c(n,"background-height","units",r)==="%"?_=c(n,"background-height","pfValue",r)*g:_=c(n,"background-height","pfValue",r)),!(D===0||_===0)){if(d==="contain"){var T=Math.min(m/D,g/_);D*=T,_*=T}else if(d==="cover"){var T=Math.max(m/D,g/_);D*=T,_*=T}var S=u-m/2,A=c(n,"background-position-x","units",r),N=c(n,"background-position-x","pfValue",r);A==="%"?S+=(m-D)*N:S+=N;var R=c(n,"background-offset-x","units",r),M=c(n,"background-offset-x","pfValue",r);R==="%"?S+=(m-D)*M:S+=M;var L=l-g/2,I=c(n,"background-position-y","units",r),j=c(n,"background-position-y","pfValue",r);I==="%"?L+=(g-_)*j:L+=j;var F=c(n,"background-offset-y","units",r),Y=c(n,"background-offset-y","pfValue",r);F==="%"?L+=(g-_)*Y:L+=Y,y.pathCache&&(S-=u,L-=l,u=0,l=0);var W=e.globalAlpha;e.globalAlpha=k;var Q=i.getImgSmoothing(e),$=!1;if(C==="no"&&Q?(i.setImgSmoothing(e,!1),$=!0):C==="yes"&&!Q&&(i.setImgSmoothing(e,!0),$=!0),h==="no-repeat")w&&(e.save(),y.pathCache?e.clip(y.pathCache):(i.nodeShapes[i.getNodeShape(n)].draw(e,u,l,m,g,x,y),e.clip())),i.safeDrawImage(e,t,0,0,P,B,S,L,D,_),w&&e.restore();else{var Z=e.createPattern(t,h);e.fillStyle=Z,i.nodeShapes[i.getNodeShape(n)].draw(e,u,l,m,g,x,y),e.translate(S,L),e.fill(),e.translate(-S,-L)}e.globalAlpha=W,$&&i.setImgSmoothing(e,Q)}};var Mn={};Mn.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),a=Math.ceil(es(n*r));t=Math.pow(2,a)}var i=e.pstyle("font-size").pfValue*t,o=e.pstyle("min-zoomed-font-size").pfValue;return!(i<o)};Mn.drawElementText=function(e,t,n,r,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(r==null){if(i&&!o.eleTextBiggerThanMin(t))return}else if(r===!1)return;if(t.isNode()){var u=t.pstyle("label");if(!u||!u.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var s=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(s||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var f=!n,p;n&&(p=n,e.translate(-p.x1,-p.y1)),a==null?(o.drawText(e,t,null,f,i),t.isEdge()&&(o.drawText(e,t,"source",f,i),o.drawText(e,t,"target",f,i))):o.drawText(e,t,a,f,i),n&&e.translate(p.x1,p.y1)};Mn.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if(t=this.fontCaches[n],t.context===e)return t;return t={context:e},this.fontCaches.push(t),t};Mn.setupTextStyle=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue+"px",i=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,u=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*u,s=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+a+" "+i,e.lineJoin="round",this.colorFillStyle(e,s[0],s[1],s[2],u),this.colorStrokeStyle(e,c[0],c[1],c[2],l)};function Vy(e,t,n,r,a){var i=Math.min(r,a),o=i/2,u=t+r/2,l=n+a/2;e.beginPath(),e.arc(u,l,o,0,Math.PI*2),e.closePath()}function Xu(e,t,n,r,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(i,r/2,a/2);e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+a-o),e.quadraticCurveTo(t+r,n+a,t+r-o,n+a),e.lineTo(t+o,n+a),e.quadraticCurveTo(t,n+a,t,n+a-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath()}Mn.getTextAngle=function(e,t){var n,r=e._private,a=r.rscratch,i=t?t+"-":"",o=e.pstyle(i+"text-rotation");if(o.strValue==="autorotate"){var u=kt(a,"labelAngle",t);n=e.isEdge()?u:0}else o.strValue==="none"?n=0:n=o.pfValue;return n};Mn.drawText=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=t._private,o=i.rscratch,u=a?t.effectiveOpacity():1;if(!(a&&(u===0||t.pstyle("text-opacity").value===0))){n==="main"&&(n=null);var l=kt(o,"labelX",n),s=kt(o,"labelY",n),c,d,h=this.getLabelText(t,n);if(h!=null&&h!==""&&!isNaN(l)&&!isNaN(s)){this.setupTextStyle(e,t,a);var f=n?n+"-":"",p=kt(o,"labelWidth",n),v=kt(o,"labelHeight",n),m=t.pstyle(f+"text-margin-x").pfValue,g=t.pstyle(f+"text-margin-y").pfValue,y=t.isEdge(),b=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;y&&(b="center",w="center"),l+=m,s+=g;var k;switch(r?k=this.getTextAngle(t,n):k=0,k!==0&&(c=l,d=s,e.translate(c,d),e.rotate(k),l=0,s=0),w){case"top":break;case"center":s+=v/2;break;case"bottom":s+=v;break}var C=t.pstyle("text-background-opacity").value,x=t.pstyle("text-border-opacity").value,P=t.pstyle("text-border-width").pfValue,B=t.pstyle("text-background-padding").pfValue,D=t.pstyle("text-background-shape").strValue,_=D==="round-rectangle"||D==="roundrectangle",T=D==="circle",S=2;if(C>0||P>0&&x>0){var A=e.fillStyle,N=e.strokeStyle,R=e.lineWidth,M=t.pstyle("text-background-color").value,L=t.pstyle("text-border-color").value,I=t.pstyle("text-border-style").value,j=C>0,F=P>0&&x>0,Y=l-B;switch(b){case"left":Y-=p;break;case"center":Y-=p/2;break}var W=s-v-B,Q=p+2*B,$=v+2*B;if(j&&(e.fillStyle="rgba(".concat(M[0],",").concat(M[1],",").concat(M[2],",").concat(C*u,")")),F&&(e.strokeStyle="rgba(".concat(L[0],",").concat(L[1],",").concat(L[2],",").concat(x*u,")"),e.lineWidth=P,e.setLineDash))switch(I){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=P/4,e.setLineDash([]);break;case"solid":default:e.setLineDash([]);break}if(_?(e.beginPath(),Xu(e,Y,W,Q,$,S)):T?(e.beginPath(),Vy(e,Y,W,Q,$)):(e.beginPath(),e.rect(Y,W,Q,$)),j&&e.fill(),F&&e.stroke(),F&&I==="double"){var Z=P/2;e.beginPath(),_?Xu(e,Y+Z,W+Z,Q-2*Z,$-2*Z,S):e.rect(Y+Z,W+Z,Q-2*Z,$-2*Z),e.stroke()}e.fillStyle=A,e.strokeStyle=N,e.lineWidth=R,e.setLineDash&&e.setLineDash([])}var J=2*t.pstyle("text-outline-width").pfValue;if(J>0&&(e.lineWidth=J),t.pstyle("text-wrap").value==="wrap"){var re=kt(o,"labelWrapCachedLines",n),V=kt(o,"labelLineHeight",n),O=p/2,z=this.getLabelJustification(t);switch(z==="auto"||(b==="left"?z==="left"?l+=-p:z==="center"&&(l+=-O):b==="center"?z==="left"?l+=-O:z==="right"&&(l+=O):b==="right"&&(z==="center"?l+=O:z==="right"&&(l+=p))),w){case"top":s-=(re.length-1)*V;break;case"center":case"bottom":s-=(re.length-1)*V;break}for(var H=0;H<re.length;H++)J>0&&e.strokeText(re[H],l,s),e.fillText(re[H],l,s),s+=V}else J>0&&e.strokeText(h,l,s),e.fillText(h,l,s);k!==0&&(e.rotate(-k),e.translate(-c,-d))}}};var vn={};vn.drawNode=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,u,l,s=t._private,c=s.rscratch,d=t.position();if(!(!ne(d.x)||!ne(d.y))&&!(i&&!t.visible())){var h=i?t.effectiveOpacity():1,f=o.usePaths(),p,v=!1,m=t.padding();u=t.width()+2*m,l=t.height()+2*m;var g;n&&(g=n,e.translate(-g.x1,-g.y1));for(var y=t.pstyle("background-image"),b=y.value,w=new Array(b.length),k=new Array(b.length),C=0,x=0;x<b.length;x++){var P=b[x],B=w[x]=P!=null&&P!=="none";if(B){var D=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",x);C++,k[x]=o.getCachedImage(P,D,function(){s.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var _=t.pstyle("background-blacken").value,T=t.pstyle("border-width").pfValue,S=t.pstyle("background-opacity").value*h,A=t.pstyle("border-color").value,N=t.pstyle("border-style").value,R=t.pstyle("border-join").value,M=t.pstyle("border-cap").value,L=t.pstyle("border-position").value,I=t.pstyle("border-dash-pattern").pfValue,j=t.pstyle("border-dash-offset").pfValue,F=t.pstyle("border-opacity").value*h,Y=t.pstyle("outline-width").pfValue,W=t.pstyle("outline-color").value,Q=t.pstyle("outline-style").value,$=t.pstyle("outline-opacity").value*h,Z=t.pstyle("outline-offset").value,J=t.pstyle("corner-radius").value;J!=="auto"&&(J=t.pstyle("corner-radius").pfValue);var re=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:S;o.eleFillStyle(e,t,ie)},V=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F;o.colorStrokeStyle(e,A[0],A[1],A[2],ie)},O=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$;o.colorStrokeStyle(e,W[0],W[1],W[2],ie)},z=function(ie,ve,E,X){var q=o.nodePathCache=o.nodePathCache||[],U=dc(E==="polygon"?E+","+X.join(","):E,""+ve,""+ie,""+J),G=q[U],oe,K=!1;return G!=null?(oe=G,K=!0,c.pathCache=oe):(oe=new Path2D,q[U]=c.pathCache=oe),{path:oe,cacheHit:K}},H=t.pstyle("shape").strValue,te=t.pstyle("shape-polygon-points").pfValue;if(f){e.translate(d.x,d.y);var ae=z(u,l,H,te);p=ae.path,v=ae.cacheHit}var we=function(){if(!v){var ie=d;f&&(ie={x:0,y:0}),o.nodeShapes[o.getNodeShape(t)].draw(p||e,ie.x,ie.y,u,l,J,c)}f?e.fill(p):e.fill()},ye=function(){for(var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,E=s.backgrounding,X=0,q=0;q<k.length;q++){var U=t.cy().style().getIndexedStyle(t,"background-image-containment","value",q);if(ve&&U==="over"||!ve&&U==="inside"){X++;continue}w[q]&&k[q].complete&&!k[q].error&&(X++,o.drawInscribedImage(e,k[q],t,q,ie))}s.backgrounding=X!==C,E!==s.backgrounding&&t.updateStyle(!1)},xe=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h;o.hasPie(t)&&(o.drawPie(e,t,ve),ie&&(f||o.nodeShapes[o.getNodeShape(t)].draw(e,d.x,d.y,u,l,J,c)))},Ae=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h;o.hasStripe(t)&&(e.save(),f?e.clip(c.pathCache):(o.nodeShapes[o.getNodeShape(t)].draw(e,d.x,d.y,u,l,J,c),e.clip()),o.drawStripe(e,t,ve),e.restore(),ie&&(f||o.nodeShapes[o.getNodeShape(t)].draw(e,d.x,d.y,u,l,J,c)))},ee=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,ve=(_>0?_:-_)*ie,E=_>0?0:255;_!==0&&(o.colorFillStyle(e,E,E,E,ve),f?e.fill(p):e.fill())},ue=function(){if(T>0){if(e.lineWidth=T,e.lineCap=M,e.lineJoin=R,e.setLineDash)switch(N){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(I),e.lineDashOffset=j;break;case"solid":case"double":e.setLineDash([]);break}if(L!=="center"){if(e.save(),e.lineWidth*=2,L==="inside")f?e.clip(p):e.clip();else{var ie=new Path2D;ie.rect(-u/2-T,-l/2-T,u+2*T,l+2*T),ie.addPath(p),e.clip(ie,"evenodd")}f?e.stroke(p):e.stroke(),e.restore()}else f?e.stroke(p):e.stroke();if(N==="double"){e.lineWidth=T/3;var ve=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",f?e.stroke(p):e.stroke(),e.globalCompositeOperation=ve}e.setLineDash&&e.setLineDash([])}},ce=function(){if(Y>0){if(e.lineWidth=Y,e.lineCap="butt",e.setLineDash)switch(Q){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}var ie=d;f&&(ie={x:0,y:0});var ve=o.getNodeShape(t),E=T;L==="inside"&&(E=0),L==="outside"&&(E*=2);var X=(u+E+(Y+Z))/u,q=(l+E+(Y+Z))/l,U=u*X,G=l*q,oe=o.nodeShapes[ve].points,K;if(f){var de=z(U,G,ve,oe);K=de.path}if(ve==="ellipse")o.drawEllipsePath(K||e,ie.x,ie.y,U,G);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,Pe=0;ve==="round-diamond"?le=(E+Z+Y)*1.4:ve==="round-heptagon"?(le=(E+Z+Y)*1.075,Pe=-(E/2+Z+Y)/35):ve==="round-hexagon"?le=(E+Z+Y)*1.12:ve==="round-pentagon"?(le=(E+Z+Y)*1.13,Pe=-(E/2+Z+Y)/15):ve==="round-tag"?(le=(E+Z+Y)*1.12,pe=(E/2+Y+Z)*.07):ve==="round-triangle"&&(le=(E+Z+Y)*(Math.PI/2),Pe=-(E+Z/2+Y)/Math.PI),le!==0&&(X=(u+le)/u,U=u*X,["round-hexagon","round-tag"].includes(ve)||(q=(l+le)/l,G=l*q)),J=J==="auto"?wc(U,G):J;for(var ke=U/2,he=G/2,Te=J+(E+Y+Z)/2,Ie=new Array(oe.length/2),We=new Array(oe.length/2),st=0;st<oe.length/2;st++)Ie[st]={x:ie.x+pe+ke*oe[st*2],y:ie.y+Pe+he*oe[st*2+1]};var vt,He,rt,Ke,yt=Ie.length;for(He=Ie[yt-1],vt=0;vt<yt;vt++)rt=Ie[vt%yt],Ke=Ie[(vt+1)%yt],We[vt]=ps(He,rt,Ke,Te),He=rt,rt=Ke;o.drawRoundPolygonPath(K||e,ie.x+pe,ie.y+Pe,u*X,l*q,oe,We)}else if(["roundrectangle","round-rectangle"].includes(ve))J=J==="auto"?un(U,G):J,o.drawRoundRectanglePath(K||e,ie.x,ie.y,U,G,J+(E+Y+Z)/2);else if(["cutrectangle","cut-rectangle"].includes(ve))J=J==="auto"?rs():J,o.drawCutRectanglePath(K||e,ie.x,ie.y,U,G,null,J+(E+Y+Z)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(ve))J=J==="auto"?un(U,G):J,o.drawBottomRoundRectanglePath(K||e,ie.x,ie.y,U,G,J+(E+Y+Z)/2);else if(ve==="barrel")o.drawBarrelPath(K||e,ie.x,ie.y,U,G);else if(ve.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(ve)){var Qt=(E+Y+Z)/u;oe=xa(wa(oe,Qt)),o.drawPolygonPath(K||e,ie.x,ie.y,u,l,oe)}else{var Ze=(E+Y+Z)/u;oe=xa(wa(oe,-Ze)),o.drawPolygonPath(K||e,ie.x,ie.y,u,l,oe)}if(f?e.stroke(K):e.stroke(),Q==="double"){e.lineWidth=E/3;var _t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",f?e.stroke(K):e.stroke(),e.globalCompositeOperation=_t}e.setLineDash&&e.setLineDash([])}},me=function(){a&&o.drawNodeOverlay(e,t,d,u,l)},be=function(){a&&o.drawNodeUnderlay(e,t,d,u,l)},Ee=function(){o.drawElementText(e,t,null,r)},_e=t.pstyle("ghost").value==="yes";if(_e){var Oe=t.pstyle("ghost-offset-x").pfValue,Fe=t.pstyle("ghost-offset-y").pfValue,Re=t.pstyle("ghost-opacity").value,Se=Re*h;e.translate(Oe,Fe),O(),ce(),re(Re*S),we(),ye(Se,!0),V(Re*F),ue(),xe(_!==0||T!==0),Ae(_!==0||T!==0),ye(Se,!1),ee(Se),e.translate(-Oe,-Fe)}f&&e.translate(-d.x,-d.y),be(),f&&e.translate(d.x,d.y),O(),ce(),re(),we(),ye(h,!0),V(),ue(),xe(_!==0||T!==0),Ae(_!==0||T!==0),ye(h,!1),ee(),f&&e.translate(-d.x,-d.y),Ee(),me(),n&&e.translate(g.x1,g.y1)}};var _d=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,r,a,i){var o=this;if(n.visible()){var u=n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-opacity")).value,s=n.pstyle("".concat(e,"-color")).value,c=n.pstyle("".concat(e,"-shape")).value,d=n.pstyle("".concat(e,"-corner-radius")).value;if(l>0){if(r=r||n.position(),a==null||i==null){var h=n.padding();a=n.width()+2*h,i=n.height()+2*h}o.colorFillStyle(t,s[0],s[1],s[2],l),o.nodeShapes[c].draw(t,r.x,r.y,a+u*2,i+u*2,d),t.fill()}}}};vn.drawNodeOverlay=_d("overlay");vn.drawNodeUnderlay=_d("underlay");vn.hasPie=function(e){return e=e[0],e._private.hasPie};vn.hasStripe=function(e){return e=e[0],e._private.hasStripe};vn.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),i=t.pstyle("pie-size"),o=t.pstyle("pie-hole"),u=t.pstyle("pie-start-angle").pfValue,l=r.x,s=r.y,c=t.width(),d=t.height(),h=Math.min(c,d)/2,f,p=0,v=this.usePaths();if(v&&(l=0,s=0),i.units==="%"?h=h*i.pfValue:i.pfValue!==void 0&&(h=i.pfValue/2),o.units==="%"?f=h*o.pfValue:o.pfValue!==void 0&&(f=o.pfValue/2),!(f>=h))for(var m=1;m<=a.pieBackgroundN;m++){var g=t.pstyle("pie-"+m+"-background-size").value,y=t.pstyle("pie-"+m+"-background-color").value,b=t.pstyle("pie-"+m+"-background-opacity").value*n,w=g/100;w+p>1&&(w=1-p);var k=1.5*Math.PI+2*Math.PI*p;k+=u;var C=2*Math.PI*w,x=k+C;g===0||p>=1||p+w>1||(f===0?(e.beginPath(),e.moveTo(l,s),e.arc(l,s,h,k,x),e.closePath()):(e.beginPath(),e.arc(l,s,h,k,x),e.arc(l,s,f,x,k,!0),e.closePath()),this.colorFillStyle(e,y[0],y[1],y[2],b),e.fill(),p+=w)}};vn.drawStripe=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),i=r.x,o=r.y,u=t.width(),l=t.height(),s=0,c=this.usePaths();e.save();var d=t.pstyle("stripe-direction").value,h=t.pstyle("stripe-size");switch(d){case"vertical":break;case"righward":e.rotate(-Math.PI/2);break}var f=u,p=l;h.units==="%"?(f=f*h.pfValue,p=p*h.pfValue):h.pfValue!==void 0&&(f=h.pfValue,p=h.pfValue),c&&(i=0,o=0),o-=f/2,i-=p/2;for(var v=1;v<=a.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*n,b=m/100;b+s>1&&(b=1-s),!(m===0||s>=1||s+b>1)&&(e.beginPath(),e.rect(i,o+p*s,f,p*b),e.closePath(),this.colorFillStyle(e,g[0],g[1],g[2],y),e.fill(),s+=b)}e.restore()};var xt={},Fy=100;xt.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n};xt.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],n=!0,r,a=0;a<t.length;a++)if(r=t[a],r.context===e){n=!1;break}return n&&(r={context:e},t.push(r)),r};xt.createGradientStyleFor=function(e,t,n,r,a){var i,o=this.usePaths(),u=n.pstyle(t+"-gradient-stop-colors").value,l=n.pstyle(t+"-gradient-stop-positions").pfValue;if(r==="radial-gradient")if(n.isEdge()){var s=n.sourceEndpoint(),c=n.targetEndpoint(),d=n.midpoint(),h=_n(s,d),f=_n(c,d);i=e.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(h,f))}else{var p=o?{x:0,y:0}:n.position(),v=n.paddedWidth(),m=n.paddedHeight();i=e.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(v,m))}else if(n.isEdge()){var g=n.sourceEndpoint(),y=n.targetEndpoint();i=e.createLinearGradient(g.x,g.y,y.x,y.y)}else{var b=o?{x:0,y:0}:n.position(),w=n.paddedWidth(),k=n.paddedHeight(),C=w/2,x=k/2,P=n.pstyle("background-gradient-direction").value;switch(P){case"to-bottom":i=e.createLinearGradient(b.x,b.y-x,b.x,b.y+x);break;case"to-top":i=e.createLinearGradient(b.x,b.y+x,b.x,b.y-x);break;case"to-left":i=e.createLinearGradient(b.x+C,b.y,b.x-C,b.y);break;case"to-right":i=e.createLinearGradient(b.x-C,b.y,b.x+C,b.y);break;case"to-bottom-right":case"to-right-bottom":i=e.createLinearGradient(b.x-C,b.y-x,b.x+C,b.y+x);break;case"to-top-right":case"to-right-top":i=e.createLinearGradient(b.x-C,b.y+x,b.x+C,b.y-x);break;case"to-bottom-left":case"to-left-bottom":i=e.createLinearGradient(b.x+C,b.y-x,b.x-C,b.y+x);break;case"to-top-left":case"to-left-top":i=e.createLinearGradient(b.x+C,b.y+x,b.x-C,b.y-x);break}}if(!i)return null;for(var B=l.length===u.length,D=u.length,_=0;_<D;_++)i.addColorStop(B?l[_]:_/(D-1),"rgba("+u[_][0]+","+u[_][1]+","+u[_][2]+","+a+")");return i};xt.gradientFillStyle=function(e,t,n,r){var a=this.createGradientStyleFor(e,"background",t,n,r);if(!a)return null;e.fillStyle=a};xt.colorFillStyle=function(e,t,n,r,a){e.fillStyle="rgba("+t+","+n+","+r+","+a+")"};xt.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientFillStyle(e,t,r,n);else{var a=t.pstyle("background-color").value;this.colorFillStyle(e,a[0],a[1],a[2],n)}};xt.gradientStrokeStyle=function(e,t,n,r){var a=this.createGradientStyleFor(e,"line",t,n,r);if(!a)return null;e.strokeStyle=a};xt.colorStrokeStyle=function(e,t,n,r,a){e.strokeStyle="rgba("+t+","+n+","+r+","+a+")"};xt.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientStrokeStyle(e,t,r,n);else{var a=t.pstyle("line-color").value;this.colorStrokeStyle(e,a[0],a[1],a[2],n)}};xt.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),a=r[2],i=r[3],o=t.getPixelRatio(),u=t.motionBlurPxRatio;(e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]||e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG])&&(o=u);var l=a*o,s=i*o,c;if(!(l===t.canvasWidth&&s===t.canvasHeight)){t.fontCaches=null;var d=n.canvasContainer;d.style.width=a+"px",d.style.height=i+"px";for(var h=0;h<t.CANVAS_LAYERS;h++)c=n.canvases[h],c.width=l,c.height=s,c.style.width=a+"px",c.style.height=i+"px";for(var h=0;h<t.BUFFER_COUNT;h++)c=n.bufferCanvases[h],c.width=l,c.height=s,c.style.width=a+"px",c.style.height=i+"px";t.textureMult=1,o<=1&&(c=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,c.width=l*t.textureMult,c.height=s*t.textureMult),t.canvasWidth=l,t.canvasHeight=s,t.pixelRatio=o}};xt.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})};xt.clearCanvas=function(){var e=this,t=e.data;function n(r){r.clearRect(0,0,e.canvasWidth,e.canvasHeight)}n(t.contexts[e.NODE]),n(t.contexts[e.DRAG])};xt.render=function(e){var t=this;e=e||gc();var n=t.cy,r=e.forcedContext,a=e.drawAllLayers,i=e.drawOnlyNodeLayer,o=e.forcedZoom,u=e.forcedPan,l=e.forcedPxRatio===void 0?this.getPixelRatio():e.forcedPxRatio,s=t.data,c=s.canvasNeedsRedraw,d=t.textureOnViewport&&!r&&(t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming),h=e.motionBlur!==void 0?e.motionBlur:t.motionBlur,f=t.motionBlurPxRatio,p=n.hasCompoundNodes(),v=t.hoverData.draggingEles,m=!!(t.hoverData.selecting||t.touchData.selecting);h=h&&!r&&t.motionBlurEnabled&&!m;var g=h;r||(t.prevPxRatio!==l&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container),t.redrawHint("eles",!0),t.redrawHint("drag",!0)),t.prevPxRatio=l),!r&&t.motionBlurTimeout&&clearTimeout(t.motionBlurTimeout),h&&(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&&!d&&(c[t.NODE]=!0,c[t.SELECT_BOX]=!0);var y=n.style(),b=n.zoom(),w=o!==void 0?o:b,k=n.pan(),C={x:k.x,y:k.y},x={zoom:b,pan:{x:k.x,y:k.y}},P=t.prevViewport,B=P===void 0||x.zoom!==P.zoom||x.pan.x!==P.pan.x||x.pan.y!==P.pan.y;!B&&!(v&&!p)&&(t.motionBlurPxRatio=1),u&&(C=u),w*=l,C.x*=l,C.y*=l;var D=t.getCachedZSortedEles();function _(V,O,z,H,te){var ae=V.globalCompositeOperation;V.globalCompositeOperation="destination-out",t.colorFillStyle(V,255,255,255,t.motionBlurTransparency),V.fillRect(O,z,H,te),V.globalCompositeOperation=ae}function T(V,O){var z,H,te,ae;!t.clearingMotionBlur&&(V===s.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]||V===s.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG])?(z={x:k.x*f,y:k.y*f},H=b*f,te=t.canvasWidth*f,ae=t.canvasHeight*f):(z=C,H=w,te=t.canvasWidth,ae=t.canvasHeight),V.setTransform(1,0,0,1,0,0),O==="motionBlur"?_(V,0,0,te,ae):!r&&(O===void 0||O)&&V.clearRect(0,0,te,ae),a||(V.translate(z.x,z.y),V.scale(H,H)),u&&V.translate(u.x,u.y),o&&V.scale(o,o)}if(d||(t.textureDrawLastFrame=!1),d){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.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:l*t.textureMult});var x=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight};x.mpan={x:(0-x.pan.x)/x.zoom,y:(0-x.pan.y)/x.zoom}}c[t.DRAG]=!1,c[t.NODE]=!1;var A=s.contexts[t.NODE],N=t.textureCache.texture,x=t.textureCache.viewport;A.setTransform(1,0,0,1,0,0),h?_(A,0,0,x.width,x.height):A.clearRect(0,0,x.width,x.height);var R=y.core("outside-texture-bg-color").value,M=y.core("outside-texture-bg-opacity").value;t.colorFillStyle(A,R[0],R[1],R[2],M),A.fillRect(0,0,x.width,x.height);var b=n.zoom();T(A,!1),A.clearRect(x.mpan.x,x.mpan.y,x.width/x.zoom/l,x.height/x.zoom/l),A.drawImage(N,x.mpan.x,x.mpan.y,x.width/x.zoom/l,x.height/x.zoom/l)}else t.textureOnViewport&&!r&&(t.textureCache=null);var L=n.extent(),I=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),j=t.hideEdgesOnViewport&&I,F=[];if(F[t.NODE]=!c[t.NODE]&&h&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,F[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),F[t.DRAG]=!c[t.DRAG]&&h&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,F[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),c[t.NODE]||a||i||F[t.NODE]){var Y=h&&!F[t.NODE]&&f!==1,A=r||(Y?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:s.contexts[t.NODE]),W=h&&!Y?"motionBlur":void 0;T(A,W),j?t.drawCachedNodes(A,D.nondrag,l,L):t.drawLayeredElements(A,D.nondrag,l,L),t.debug&&t.drawDebugPoints(A,D.nondrag),!a&&!h&&(c[t.NODE]=!1)}if(!i&&(c[t.DRAG]||a||F[t.DRAG])){var Y=h&&!F[t.DRAG]&&f!==1,A=r||(Y?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:s.contexts[t.DRAG]);T(A,h&&!Y?"motionBlur":void 0),j?t.drawCachedNodes(A,D.drag,l,L):t.drawCachedElements(A,D.drag,l,L),t.debug&&t.drawDebugPoints(A,D.drag),!a&&!h&&(c[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,T),h&&f!==1){var Q=s.contexts[t.NODE],$=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],Z=s.contexts[t.DRAG],J=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],re=function(V,O,z){V.setTransform(1,0,0,1,0,0),z||!g?V.clearRect(0,0,t.canvasWidth,t.canvasHeight):_(V,0,0,t.canvasWidth,t.canvasHeight);var H=f;V.drawImage(O,0,0,t.canvasWidth*H,t.canvasHeight*H,0,0,t.canvasWidth,t.canvasHeight)};(c[t.NODE]||F[t.NODE])&&(re(Q,$,F[t.NODE]),c[t.NODE]=!1),(c[t.DRAG]||F[t.DRAG])&&(re(Z,J,F[t.DRAG]),c[t.DRAG]=!1)}t.prevViewport=x,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),h&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!d,t.mbFrames=0,c[t.NODE]=!0,c[t.DRAG]=!0,t.redraw()},Fy)),r||n.emit("render")};var hr;xt.drawSelectionRectangle=function(e,t){var n=this,r=n.cy,a=n.data,i=r.style(),o=e.drawOnlyNodeLayer,u=e.drawAllLayers,l=a.canvasNeedsRedraw,s=e.forcedContext;if(n.showFps||!o&&l[n.SELECT_BOX]&&!u){var c=s||a.contexts[n.SELECT_BOX];if(t(c),n.selection[4]==1&&(n.hoverData.selecting||n.touchData.selecting)){var d=n.cy.zoom(),h=i.core("selection-box-border-width").value/d;c.lineWidth=h,c.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",c.fillRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]),h>0&&(c.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",c.strokeRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]))}if(a.bgActivePosistion&&!n.hoverData.selecting){var d=n.cy.zoom(),f=a.bgActivePosistion;c.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",c.beginPath(),c.arc(f.x,f.y,i.core("active-bg-size").pfValue/d,0,2*Math.PI),c.fill()}var p=n.lastRedrawTime;if(n.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",!hr){var g=c.measureText(m);hr=g.actualBoundingBoxAscent}c.fillText(m,0,hr);var y=60;c.strokeRect(0,hr+10,250,20),c.fillRect(0,hr+10,250*Math.min(v/y,1),20)}u||(l[n.SELECT_BOX]=!1)}};function Yu(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(r));return r}function Xy(e,t,n){var r=Yu(e,e.VERTEX_SHADER,t),a=Yu(e,e.FRAGMENT_SHADER,n),i=e.createProgram();if(e.attachShader(i,r),e.attachShader(i,a),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw new Error("Could not initialize shaders");return i}function Yy(e,t,n){n===void 0&&(n=t);var r=e.makeOffscreenCanvas(t,n),a=r.context=r.getContext("2d");return r.clear=function(){return a.clearRect(0,0,r.width,r.height)},r.clear(),r}function ys(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function jy(e){var t=e.pixelRatio,n=e.cy.zoom();return n*t}function qy(e,t,n,r,a){var i=r*n+t.x,o=a*n+t.y;return o=Math.round(e.canvasHeight-o),[i,o]}function Uy(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 Wy(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function xn(e,t,n){var r=e[0]/255,a=e[1]/255,i=e[2]/255,o=t,u=n||new Array(4);return u[0]=r*o,u[1]=a*o,u[2]=i*o,u[3]=o,u}function Vn(e,t){var n=t||new Array(4);return n[0]=(e>>0&255)/255,n[1]=(e>>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function Gy(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function Hy(e,t){var n=e.createTexture();return n.buffer=function(r){e.bindTexture(e.TEXTURE_2D,n),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,r),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},n.deleteTexture=function(){e.deleteTexture(n)},n}function Bd(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 Dd(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function Ky(e,t,n,r,a,i){switch(t){case e.FLOAT:return new Float32Array(n.buffer,i*r,a);case e.INT:return new Int32Array(n.buffer,i*r,a)}}function Zy(e,t,n,r){var a=Bd(e,t),i=$e(a,2),o=i[0],u=i[1],l=Dd(e,u,r),s=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,l,e.STATIC_DRAW),u===e.FLOAT?e.vertexAttribPointer(n,o,u,!1,0,0):u===e.INT&&e.vertexAttribIPointer(n,o,u,0,0),e.enableVertexAttribArray(n),e.bindBuffer(e.ARRAY_BUFFER,null),s}function zt(e,t,n,r){var a=Bd(e,n),i=$e(a,3),o=i[0],u=i[1],l=i[2],s=Dd(e,u,t*o),c=o*l,d=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,d),e.bufferData(e.ARRAY_BUFFER,t*c,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),u===e.FLOAT?e.vertexAttribPointer(r,o,u,!1,c,0):u===e.INT&&e.vertexAttribIPointer(r,o,u,c,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var h=new Array(t),f=0;f<t;f++)h[f]=Ky(e,u,s,c,o,f);return d.dataArray=s,d.stride=c,d.size=o,d.getView=function(p){return h[p]},d.setPoint=function(p,v,m){var g=h[p];g[0]=v,g[1]=m},d.bufferSubData=function(p){e.bindBuffer(e.ARRAY_BUFFER,d),p?e.bufferSubData(e.ARRAY_BUFFER,0,s,0,p*o):e.bufferSubData(e.ARRAY_BUFFER,0,s)},d}function Qy(e,t,n){for(var r=9,a=new Float32Array(t*r),i=new Array(t),o=0;o<t;o++){var u=o*r*4;i[o]=new Float32Array(a.buffer,u,r)}var l=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,l),e.bufferData(e.ARRAY_BUFFER,a.byteLength,e.DYNAMIC_DRAW);for(var s=0;s<3;s++){var c=n+s;e.enableVertexAttribArray(c),e.vertexAttribPointer(c,3,e.FLOAT,!1,36,s*12),e.vertexAttribDivisor(c,1)}return e.bindBuffer(e.ARRAY_BUFFER,null),l.getMatrixView=function(d){return i[d]},l.setData=function(d,h){i[h].set(d,0)},l.bufferSubData=function(){e.bindBuffer(e.ARRAY_BUFFER,l),e.bufferSubData(e.ARRAY_BUFFER,0,a)},l}function $y(e){var t=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,t);var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),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,n,0),e.bindFramebuffer(e.FRAMEBUFFER,null),t.setFramebufferAttachmentSizes=function(r,a){e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,r,a,0,e.RGBA,e.UNSIGNED_BYTE,null)},t}var ju=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 xo(){var e=new ju(9);return ju!=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 qu(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 Jy(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],u=t[4],l=t[5],s=t[6],c=t[7],d=t[8],h=n[0],f=n[1],p=n[2],v=n[3],m=n[4],g=n[5],y=n[6],b=n[7],w=n[8];return e[0]=h*r+f*o+p*s,e[1]=h*a+f*u+p*c,e[2]=h*i+f*l+p*d,e[3]=v*r+m*o+g*s,e[4]=v*a+m*u+g*c,e[5]=v*i+m*l+g*d,e[6]=y*r+b*o+w*s,e[7]=y*a+b*u+w*c,e[8]=y*i+b*l+w*d,e}function ga(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],u=t[4],l=t[5],s=t[6],c=t[7],d=t[8],h=n[0],f=n[1];return e[0]=r,e[1]=a,e[2]=i,e[3]=o,e[4]=u,e[5]=l,e[6]=h*r+f*o+s,e[7]=h*a+f*u+c,e[8]=h*i+f*l+d,e}function Uu(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],u=t[4],l=t[5],s=t[6],c=t[7],d=t[8],h=Math.sin(n),f=Math.cos(n);return e[0]=f*r+h*o,e[1]=f*a+h*u,e[2]=f*i+h*l,e[3]=f*o-h*r,e[4]=f*u-h*a,e[5]=f*l-h*i,e[6]=s,e[7]=c,e[8]=d,e}function jo(e,t,n){var r=n[0],a=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=a*t[3],e[4]=a*t[4],e[5]=a*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function em(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}var tm=function(){function e(t,n,r,a){fn(this,e),this.debugID=Math.floor(Math.random()*1e4),this.r=t,this.texSize=n,this.texRows=r,this.texHeight=Math.floor(n/r),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=a(t,n,n),this.scratch=a(t,n,this.texHeight,"scratch")}return pn(e,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(t){var n=t.w,r=t.h,a=this.texHeight,i=this.texSize,o=a/r,u=n*o,l=r*o;return u>i&&(o=i/n,u=n*o,l=r*o),{scale:o,texW:u,texH:l}}},{key:"draw",value:function(t,n,r){var a=this;if(this.locked)throw new Error("can't draw, atlas is locked");var i=this.texSize,o=this.texRows,u=this.texHeight,l=this.getScale(n),s=l.scale,c=l.texW,d=l.texH,h=function(g,y){if(r&&y){var b=y.context,w=g.x,k=g.row,C=w,x=u*k;b.save(),b.translate(C,x),b.scale(s,s),r(b,n),b.restore()}},f=[null,null],p=function(){h(a.freePointer,a.canvas),f[0]={x:a.freePointer.x,y:a.freePointer.row*u,w:c,h:d},f[1]={x:a.freePointer.x+c,y:a.freePointer.row*u,w:0,h:d},a.freePointer.x+=c,a.freePointer.x==i&&(a.freePointer.x=0,a.freePointer.row++)},v=function(){var g=a.scratch,y=a.canvas;g.clear(),h({x:0,row:0},g);var b=i-a.freePointer.x,w=c-b,k=u;{var C=a.freePointer.x,x=a.freePointer.row*u,P=b;y.context.drawImage(g,0,0,P,k,C,x,P,k),f[0]={x:C,y:x,w:P,h:d}}{var B=b,D=(a.freePointer.row+1)*u,_=w;y&&y.context.drawImage(g,B,0,_,k,0,D,_,k),f[1]={x:0,y:D,w:_,h:d}}a.freePointer.x=w,a.freePointer.row++},m=function(){a.freePointer.x=0,a.freePointer.row++};if(this.freePointer.x+c<=i)p();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===i?(m(),p()):this.enableWrapping?v():(m(),p())}return this.keyToLocation.set(t,f),this.needsBuffer=!0,f}},{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 n=this.texSize,r=this.texRows,a=this.getScale(t),i=a.texW;return this.freePointer.x+i>n?this.freePointer.row<r-1:!0}},{key:"bufferIfNeeded",value:function(t){this.texture||(this.texture=Hy(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}}])}(),nm=function(){function e(t,n,r,a){fn(this,e),this.r=t,this.texSize=n,this.texRows=r,this.createTextureCanvas=a,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return pn(e,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var t=this.r,n=this.texSize,r=this.texRows,a=this.createTextureCanvas;return new tm(t,n,r,a)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var t=this.r,n=this.texSize,r=this.texRows,a=this.createTextureCanvas,i=Math.floor(n/r);this.scratch=a(t,n,i,"scratch")}return this.scratch}},{key:"draw",value:function(t,n,r){var a=this.styleKeyToAtlas.get(t);return a||(a=this.atlases[this.atlases.length-1],(!a||!a.canFit(n))&&(a&&a.lock(),a=this._createAtlas(),this.atlases.push(a)),a.draw(t,n,r),this.styleKeyToAtlas.set(t,a)),a}},{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,n=this.markedKeys;if(n.size===0){console.log("nothing to garbage collect");return}var r=[],a=new Map,i=null,o=Ct(this.atlases),u;try{var l=function(){var s=u.value,c=s.getKeys(),d=rm(n,c);if(d.size===0)return r.push(s),c.forEach(function(b){return a.set(b,s)}),1;i||(i=t._createAtlas(),r.push(i));var h=Ct(c),f;try{for(h.s();!(f=h.n()).done;){var p=f.value;if(!d.has(p)){var v=s.getOffsets(p),m=$e(v,2),g=m[0],y=m[1];i.canFit({w:g.w+y.w,h:g.h})||(i.lock(),i=t._createAtlas(),r.push(i)),s.canvas&&(t._copyTextureToNewAtlas(p,s,i),a.set(p,i))}}}catch(b){h.e(b)}finally{h.f()}s.dispose()};for(o.s();!(u=o.n()).done;)l()}catch(s){o.e(s)}finally{o.f()}this.atlases=r,this.styleKeyToAtlas=a,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(t,n,r){var a=n.getOffsets(t),i=$e(a,2),o=i[0],u=i[1];if(u.w===0)r.draw(t,o,function(d){d.drawImage(n.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h)});else{var l=this._getScratchCanvas();l.clear(),l.context.drawImage(n.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h),l.context.drawImage(n.canvas,u.x,u.y,u.w,u.h,o.w,0,u.w,u.h);var s=o.w+u.w,c=o.h;r.draw(t,{w:s,h:c},function(d){d.drawImage(l,0,0,s,c,0,0,s,c)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])}();function rm(e,t){return e.intersection?e.intersection(t):new Set(va(e).filter(function(n){return t.has(n)}))}var am=function(){function e(t,n){fn(this,e),this.r=t,this.globalOptions=n,this.atlasSize=n.webglTexSize,this.maxAtlasesPerBatch=n.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return pn(e,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(t,n){var r=this.globalOptions,a=r.webglTexSize,i=r.createTextureCanvas,o=n.texRows,u=this._cacheScratchCanvas(i),l=new nm(this.r,a,o,u);this.collections.set(t,l)}},{key:"addRenderType",value:function(t,n){var r=n.collection;if(!this.collections.has(r))throw new Error("invalid atlas collection name '".concat(r,"'"));var a=this.collections.get(r),i=ge({type:t,atlasCollection:a},n);this.renderTypes.set(t,i)}},{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 n=-1,r=-1,a=null;return function(i,o,u,l){return l?((!a||o!=n||u!=r)&&(n=o,r=u,a=t(i,o,u)),a):t(i,o,u)}}},{key:"_key",value:function(t,n){return"".concat(t,"-").concat(n)}},{key:"invalidate",value:function(t){var n=this,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=r.forceRedraw,i=a===void 0?!1:a,o=r.filterEle,u=o===void 0?function(){return!0}:o,l=r.filterType,s=l===void 0?function(){return!0}:l,c=!1,d=!1,h=Ct(t),f;try{for(h.s();!(f=h.n()).done;){var p=f.value;if(u(p)){var v=Ct(this.renderTypes.values()),m;try{var g=function(){var y=m.value,b=y.type;if(s(b)){var w=n.collections.get(y.collection),k=y.getKey(p),C=Array.isArray(k)?k:[k];if(i)C.forEach(function(D){return w.markKeyForGC(D)}),d=!0;else{var x=y.getID?y.getID(p):p.id(),P=n._key(b,x),B=n.typeAndIdToKey.get(P);B!==void 0&&!Wy(C,B)&&(c=!0,n.typeAndIdToKey.delete(P),B.forEach(function(D){return w.markKeyForGC(D)}))}}};for(v.s();!(m=v.n()).done;)g()}catch(y){v.e(y)}finally{v.f()}}}}catch(y){h.e(y)}finally{h.f()}return d&&(this.gc(),c=!1),c}},{key:"gc",value:function(){var t=Ct(this.collections.values()),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;r.gc()}}catch(a){t.e(a)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(t,n,r,a){var i=this.renderTypes.get(n),o=this.collections.get(i.collection),u=!1,l=o.draw(a,r,function(d){i.drawClipped?(d.save(),d.beginPath(),d.rect(0,0,r.w,r.h),d.clip(),i.drawElement(d,t,r,!0,!0),d.restore()):i.drawElement(d,t,r,!0,!0),u=!0});if(u){var s=i.getID?i.getID(t):t.id(),c=this._key(n,s);this.typeAndIdToKey.has(c)?this.typeAndIdToKey.get(c).push(a):this.typeAndIdToKey.set(c,[a])}return l}},{key:"getAtlasInfo",value:function(t,n){var r=this,a=this.renderTypes.get(n),i=a.getKey(t),o=Array.isArray(i)?i:[i];return o.map(function(u){var l=a.getBoundingBox(t,u),s=r.getOrCreateAtlas(t,n,l,u),c=s.getOffsets(u),d=$e(c,2),h=d[0],f=d[1];return{atlas:s,tex:h,tex1:h,tex2:f,bb:l}})}},{key:"getDebugInfo",value:function(){var t=[],n=Ct(this.collections),r;try{for(n.s();!(r=n.n()).done;){var a=$e(r.value,2),i=a[0],o=a[1],u=o.getCounts(),l=u.keyCount,s=u.atlasCount;t.push({type:i,keyCount:l,atlasCount:s})}}catch(c){n.e(c)}finally{n.f()}return t}}])}(),im=function(){function e(t){fn(this,e),this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.batchAtlases=[]}return pn(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,n){return n})}},{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 n=this.batchAtlases.indexOf(t);if(n<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(t),n=this.batchAtlases.length-1}return n}}])}(),om=`
|
|
18
|
+
float circleSD(vec2 p, float r) {
|
|
19
|
+
return distance(vec2(0), p) - r; // signed distance
|
|
20
|
+
}
|
|
21
|
+
`,sm=`
|
|
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
|
+
`,lm=`
|
|
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
|
+
`,um=`
|
|
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
|
+
`,xr={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Ba={IGNORE:1,USE_BB:2},wo=0,Wu=1,Gu=2,Eo=3,Fn=4,ia=5,fr=6,pr=7,cm=function(){function e(t,n,r){fn(this,e),this.r=t,this.gl=n,this.maxInstances=r.webglBatchSize,this.atlasSize=r.webglTexSize,this.bgColor=r.bgColor,this.debug=r.webglDebug,this.batchDebugInfo=[],r.enableWrapping=!0,r.createTextureCanvas=Yy,this.atlasManager=new am(t,r),this.batchManager=new im(r),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(xr.SCREEN),this.pickingProgram=this._createShaderProgram(xr.PICKING),this.vao=this._createVAO()}return pn(e,[{key:"addAtlasCollection",value:function(t,n){this.atlasManager.addAtlasCollection(t,n)}},{key:"addTextureAtlasRenderType",value:function(t,n){this.atlasManager.addRenderType(t,n)}},{key:"addSimpleShapeRenderType",value:function(t,n){this.simpleShapeOptions.set(t,n)}},{key:"invalidate",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.type,a=this.atlasManager;return r?a.invalidate(t,{filterType:function(i){return i===r},forceRedraw:!0}):a.invalidate(t)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(t){var n=this.gl,r=`#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(wo,`) {
|
|
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(Fn," || aVertType == ").concat(pr,`
|
|
119
|
+
|| aVertType == `).concat(ia," || aVertType == ").concat(fr,`) { // 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(Wu,`) {
|
|
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(Gu,`) {
|
|
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(Eo,` && 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
|
+
`),a=this.batchManager.getIndexArray(),i=`#version 300 es
|
|
219
|
+
precision highp float;
|
|
220
|
+
|
|
221
|
+
// declare texture unit for each texture atlas in the batch
|
|
222
|
+
`.concat(a.map(function(l){return"uniform sampler2D uTexture".concat(l,";")}).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(om,`
|
|
244
|
+
`).concat(sm,`
|
|
245
|
+
`).concat(lm,`
|
|
246
|
+
`).concat(um,`
|
|
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(wo,`) {
|
|
263
|
+
// look up the texel from the texture unit
|
|
264
|
+
`).concat(a.map(function(l){return"if(vAtlasId == ".concat(l,") outColor = texture(uTexture").concat(l,", vTexCoord);")}).join(`
|
|
265
|
+
else `),`
|
|
266
|
+
}
|
|
267
|
+
else if(vVertType == `).concat(Eo,`) {
|
|
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(Fn,` && 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(Fn," || vVertType == ").concat(pr,`
|
|
276
|
+
|| vVertType == `).concat(ia," || vVertType == ").concat(fr,`) { // 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(Fn,`) {
|
|
288
|
+
d = rectangleSD(p, b);
|
|
289
|
+
} else if(vVertType == `).concat(pr,` && w == h) {
|
|
290
|
+
d = circleSD(p, b.x); // faster than ellipse
|
|
291
|
+
} else if(vVertType == `).concat(pr,`) {
|
|
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=Xy(n,r,i);o.aPosition=n.getAttribLocation(o,"aPosition"),o.aIndex=n.getAttribLocation(o,"aIndex"),o.aVertType=n.getAttribLocation(o,"aVertType"),o.aTransform=n.getAttribLocation(o,"aTransform"),o.aAtlasId=n.getAttribLocation(o,"aAtlasId"),o.aTex=n.getAttribLocation(o,"aTex"),o.aPointAPointB=n.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=n.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=n.getAttribLocation(o,"aLineWidth"),o.aColor=n.getAttribLocation(o,"aColor"),o.aCornerRadius=n.getAttribLocation(o,"aCornerRadius"),o.aBorderColor=n.getAttribLocation(o,"aBorderColor"),o.uPanZoomMatrix=n.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=n.getUniformLocation(o,"uAtlasSize"),o.uBGColor=n.getUniformLocation(o,"uBGColor"),o.uZoom=n.getUniformLocation(o,"uZoom"),o.uTextures=[];for(var u=0;u<this.batchManager.getMaxAtlasesPerBatch();u++)o.uTextures.push(n.getUniformLocation(o,"uTexture".concat(u)));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 n=this.maxInstances,r=this.gl,a=this.program,i=r.createVertexArray();return r.bindVertexArray(i),Zy(r,"vec2",a.aPosition,t),this.transformBuffer=Qy(r,n,a.aTransform),this.indexBuffer=zt(r,n,"vec4",a.aIndex),this.vertTypeBuffer=zt(r,n,"int",a.aVertType),this.atlasIdBuffer=zt(r,n,"int",a.aAtlasId),this.texBuffer=zt(r,n,"vec4",a.aTex),this.pointAPointBBuffer=zt(r,n,"vec4",a.aPointAPointB),this.pointCPointDBuffer=zt(r,n,"vec4",a.aPointCPointD),this.lineWidthBuffer=zt(r,n,"vec2",a.aLineWidth),this.colorBuffer=zt(r,n,"vec4",a.aColor),this.cornerRadiusBuffer=zt(r,n,"vec4",a.aCornerRadius),this.borderColorBuffer=zt(r,n,"vec4",a.aBorderColor),r.bindVertexArray(null),i}},{key:"buffers",get:function(){var t=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(n){return tn(n,"Buffer")}).map(function(n){return t[n]})),this._buffers}},{key:"startFrame",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:xr.SCREEN;this.panZoomMatrix=t,this.renderTarget=n,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,n){return t.visible()?n&&n.isVisible?n.isVisible(t):!0:!1}},{key:"drawTexture",value:function(t,n,r){var a=this.atlasManager,i=this.batchManager,o=a.getRenderTypeOpts(r);if(this._isVisible(t,o)&&!(t.isEdge()&&!this._isValidEdge(t))){if(this.renderTarget.picking&&o.getTexPickingMode){var u=o.getTexPickingMode(t);if(u===Ba.IGNORE)return;if(u==Ba.USE_BB){this.drawPickingRectangle(t,n,r);return}}var l=a.getAtlasInfo(t,r),s=Ct(l),c;try{for(s.s();!(c=s.n()).done;){var d=c.value,h=d.atlas,f=d.tex1,p=d.tex2;i.canAddToCurrentBatch(h)||this.endBatch();for(var v=i.getAtlasIndexForBatch(h),m=0,g=[[f,!0],[p,!1]];m<g.length;m++){var y=$e(g[m],2),b=y[0],w=y[1];if(b.w!=0){var k=this.instanceCount;this.vertTypeBuffer.getView(k)[0]=wo;var C=this.indexBuffer.getView(k);Vn(n,C);var x=this.atlasIdBuffer.getView(k);x[0]=v;var P=this.texBuffer.getView(k);P[0]=b.x,P[1]=b.y,P[2]=b.w,P[3]=b.h;var B=this.transformBuffer.getMatrixView(k);this.setTransformMatrix(t,B,o,d,w),this.instanceCount++,w||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(D){s.e(D)}finally{s.f()}}}},{key:"setTransformMatrix",value:function(t,n,r,a){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;if(r.shapeProps&&r.shapeProps.padding&&(o=t.pstyle(r.shapeProps.padding).pfValue),a){var u=a.bb,l=a.tex1,s=a.tex2,c=l.w/(l.w+s.w);i||(c=1-c);var d=this._getAdjustedBB(u,o,i,c);this._applyTransformMatrix(n,d,r,t)}else{var h=r.getBoundingBox(t),f=this._getAdjustedBB(h,o,!0,1);this._applyTransformMatrix(n,f,r,t)}}},{key:"_applyTransformMatrix",value:function(t,n,r,a){var i,o;qu(t);var u=r.getRotation?r.getRotation(a):0;if(u!==0){var l=r.getRotationPoint(a),s=l.x,c=l.y;ga(t,t,[s,c]),Uu(t,t,u);var d=r.getRotationOffset(a);i=d.x+(n.xOffset||0),o=d.y+(n.yOffset||0)}else i=n.x1,o=n.y1;ga(t,t,[i,o]),jo(t,t,[n.w,n.h])}},{key:"_getAdjustedBB",value:function(t,n,r,a){var i=t.x1,o=t.y1,u=t.w,l=t.h,s=t.yOffset;n&&(i-=n,o-=n,u+=2*n,l+=2*n);var c=0,d=u*a;return r&&a<1?u=d:!r&&a<1&&(c=u-d,i+=c,u=d),{x1:i,y1:o,w:u,h:l,xOffset:c,yOffset:s}}},{key:"drawPickingRectangle",value:function(t,n,r){var a=this.atlasManager.getRenderTypeOpts(r),i=this.instanceCount;this.vertTypeBuffer.getView(i)[0]=Fn;var o=this.indexBuffer.getView(i);Vn(n,o);var u=this.colorBuffer.getView(i);xn([0,0,0],1,u);var l=this.transformBuffer.getMatrixView(i);this.setTransformMatrix(t,l,a),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(t,n,r){var a=this.simpleShapeOptions.get(r);if(this._isVisible(t,a)){var i=a.shapeProps,o=this._getVertTypeForShape(t,i.shape);if(o===void 0||a.isSimple&&!a.isSimple(t)){this.drawTexture(t,n,r);return}var u=this.instanceCount;if(this.vertTypeBuffer.getView(u)[0]=o,o===ia||o===fr){var l=a.getBoundingBox(t),s=this._getCornerRadius(t,i.radius,l),c=this.cornerRadiusBuffer.getView(u);c[0]=s,c[1]=s,c[2]=s,c[3]=s,o===fr&&(c[0]=0,c[2]=0)}var d=this.indexBuffer.getView(u);Vn(n,d);var h=t.pstyle(i.color).value,f=t.pstyle(i.opacity).value,p=this.colorBuffer.getView(u);xn(h,f,p);var v=this.lineWidthBuffer.getView(u);if(v[0]=0,v[1]=0,i.border){var m=t.pstyle("border-width").value;if(m>0){var g=t.pstyle("border-color").value,y=t.pstyle("border-opacity").value,b=this.borderColorBuffer.getView(u);xn(g,y,b);var w=t.pstyle("border-position").value;if(w==="inside")v[0]=0,v[1]=-m;else if(w==="outside")v[0]=m,v[1]=0;else{var k=m/2;v[0]=k,v[1]=-k}}}var C=this.transformBuffer.getMatrixView(u);this.setTransformMatrix(t,C,a),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(t,n){var r=t.pstyle(n).value;switch(r){case"rectangle":return Fn;case"ellipse":return pr;case"roundrectangle":case"round-rectangle":return ia;case"bottom-round-rectangle":return fr;default:return}}},{key:"_getCornerRadius",value:function(t,n,r){var a=r.w,i=r.h;if(t.pstyle(n).value==="auto")return un(a,i);var o=t.pstyle(n).pfValue,u=a/2,l=i/2;return Math.min(o,l,u)}},{key:"drawEdgeArrow",value:function(t,n,r){if(t.visible()){var a=t._private.rscratch,i,o,u;if(r==="source"?(i=a.arrowStartX,o=a.arrowStartY,u=a.srcArrowAngle):(i=a.arrowEndX,o=a.arrowEndY,u=a.tgtArrowAngle),!(isNaN(i)||i==null||isNaN(o)||o==null||isNaN(u)||u==null)){var l=t.pstyle(r+"-arrow-shape").value;if(l!=="none"){var s=t.pstyle(r+"-arrow-color").value,c=t.pstyle("opacity").value,d=t.pstyle("line-opacity").value,h=c*d,f=t.pstyle("width").pfValue,p=t.pstyle("arrow-scale").value,v=this.r.getArrowWidth(f,p),m=this.instanceCount,g=this.transformBuffer.getMatrixView(m);qu(g),ga(g,g,[i,o]),jo(g,g,[v,v]),Uu(g,g,u),this.vertTypeBuffer.getView(m)[0]=Eo;var y=this.indexBuffer.getView(m);Vn(n,y);var b=this.colorBuffer.getView(m);xn(s,h,b),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(t,n){if(t.visible()){var r=this._getEdgePoints(t);if(r){var a=t.pstyle("opacity").value,i=t.pstyle("line-opacity").value,o=t.pstyle("width").pfValue,u=t.pstyle("line-color").value,l=a*i;if(r.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),r.length==4){var s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=Wu;var c=this.indexBuffer.getView(s);Vn(n,c);var d=this.colorBuffer.getView(s);xn(u,l,d);var h=this.lineWidthBuffer.getView(s);h[0]=o;var f=this.pointAPointBBuffer.getView(s);f[0]=r[0],f[1]=r[1],f[2]=r[2],f[3]=r[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var p=0;p<r.length-2;p+=2){var v=this.instanceCount;this.vertTypeBuffer.getView(v)[0]=Gu;var m=this.indexBuffer.getView(v);Vn(n,m);var g=this.colorBuffer.getView(v);xn(u,l,g);var y=this.lineWidthBuffer.getView(v);y[0]=o;var b=r[p-2],w=r[p-1],k=r[p],C=r[p+1],x=r[p+2],P=r[p+3],B=r[p+4],D=r[p+5];p==0&&(b=2*k-x+.001,w=2*C-P+.001),p==r.length-4&&(B=2*x-k+.001,D=2*P-C+.001);var _=this.pointAPointBBuffer.getView(v);_[0]=b,_[1]=w,_[2]=k,_[3]=C;var T=this.pointCPointDBuffer.getView(v);T[0]=x,T[1]=P,T[2]=B,T[3]=D,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(t){var n=t._private.rscratch;return!(n.badLine||n.allpts==null||isNaN(n.allpts[0]))}},{key:"_getEdgePoints",value:function(t){var n=t._private.rscratch;if(this._isValidEdge(t)){var r=n.allpts;if(r.length==4)return r;var a=this._getNumSegments(t);return this._getCurveSegmentPoints(r,a)}}},{key:"_getNumSegments",value:function(t){var n=15;return Math.min(Math.max(n,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(t,n){if(t.length==4)return t;for(var r=Array((n+1)*2),a=0;a<=n;a++)if(a==0)r[0]=t[0],r[1]=t[1];else if(a==n)r[a*2]=t[t.length-2],r[a*2+1]=t[t.length-1];else{var i=a/n;this._setCurvePoint(t,i,r,a*2)}return r}},{key:"_setCurvePoint",value:function(t,n,r,a){if(t.length<=2)r[a]=t[0],r[a+1]=t[1];else{for(var i=Array(t.length-2),o=0;o<i.length;o+=2){var u=(1-n)*t[o]+n*t[o+2],l=(1-n)*t[o+1]+n*t[o+3];i[o]=u,i[o+1]=l}return this._setCurvePoint(i,n,r,a)}}},{key:"endBatch",value:function(){var t=this.gl,n=this.vao,r=this.vertexCount,a=this.instanceCount;if(a!==0){var i=this.renderTarget.picking?this.pickingProgram:this.program;t.useProgram(i),t.bindVertexArray(n);var o=Ct(this.buffers),u;try{for(o.s();!(u=o.n()).done;){var l=u.value;l.bufferSubData(a)}}catch(f){o.e(f)}finally{o.f()}for(var s=this.batchManager.getAtlases(),c=0;c<s.length;c++)s[c].bufferIfNeeded(t);for(var d=0;d<s.length;d++)t.activeTexture(t.TEXTURE0+d),t.bindTexture(t.TEXTURE_2D,s[d].texture),t.uniform1i(i.uTextures[d],d);t.uniform1f(i.uZoom,jy(this.r)),t.uniformMatrix3fv(i.uPanZoomMatrix,!1,this.panZoomMatrix),t.uniform1i(i.uAtlasSize,this.batchManager.getAtlasSize());var h=xn(this.bgColor,1);t.uniform4fv(i.uBGColor,h),t.drawArraysInstanced(t.TRIANGLES,0,r,a),t.bindVertexArray(null),t.bindTexture(t.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:a,atlasCount:s.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var t=this.atlasManager.getDebugInfo(),n=t.reduce(function(i,o){return i+o.atlasCount},0),r=this.batchDebugInfo,a=r.reduce(function(i,o){return i+o.count},0);return{atlasInfo:t,totalAtlases:n,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:r.length,batchInfo:r,totalInstances:a}}}])}(),Ad={};Ad.initWebgl=function(e,t){var n=this,r=n.data.contexts[n.WEBGL];e.bgColor=dm(n),e.webglTexSize=Math.min(e.webglTexSize,r.getParameter(r.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,r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),n.webglDebug=e.webglDebug,n.webglDebugShowAtlases=e.webglDebugShowAtlases,n.pickingFrameBuffer=$y(r),n.pickingFrameBuffer.needsDraw=!0,n.drawing=new cm(n,r,e);var a=function(c){return function(d){return n.getTextAngle(d,c)}},i=function(c){return function(d){var h=d.pstyle(c);return h&&h.value}},o=function(c){return function(d){return d.pstyle("".concat(c,"-opacity")).value>0}},u=function(c){var d=c.pstyle("text-events").strValue==="yes";return d?Ba.USE_BB:Ba.IGNORE},l=function(c){var d=c.position(),h=d.x,f=d.y,p=c.outerWidth(),v=c.outerHeight();return{w:p,h:v,x1:h-p/2,y1:f-v/2}};n.drawing.addAtlasCollection("node",{texRows:e.webglTexRowsNodes}),n.drawing.addAtlasCollection("label",{texRows:e.webglTexRows}),n.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),n.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:l,isSimple:Uy,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),n.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:l,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),n.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:l,isVisible:o("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),n.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:u,getKey:ko(t.getLabelKey,null),getBoundingBox:To(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:a(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:i("label")}),n.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:u,getKey:ko(t.getSourceLabelKey,"source"),getBoundingBox:To(t.getSourceLabelBox,"source"),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:a("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:i("source-label")}),n.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:u,getKey:ko(t.getTargetLabelKey,"target"),getBoundingBox:To(t.getTargetLabelBox,"target"),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:a("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:i("target-label")});var s=Nr(function(){console.log("garbage collect flag set"),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(c,d){var h=!1;d&&d.length>0&&(h|=n.drawing.invalidate(d)),h&&s()}),hm(n)};function dm(e){var t=e.cy.container(),n=t&&t.style&&t.style.backgroundColor||"white";return ac(n)}function Sd(e,t){var n=e._private.rscratch;return kt(n,"labelWrapCachedLines",t)||[]}var ko=function(e,t){return function(n){var r=e(n),a=Sd(n,t);return a.length>1?a.map(function(i,o){return"".concat(r,"_").concat(o)}):r}},To=function(e,t){return function(n,r){var a=e(n);if(typeof r=="string"){var i=r.indexOf("_");if(i>0){var o=Number(r.substring(i+1)),u=Sd(n,t),l=a.h/u.length,s=l*o,c=a.y1+s;return{x1:a.x1,w:a.w,y1:c,h:l,yOffset:s}}}return a}};function hm(e){{var t=e.render;e.render=function(i){i=i||{};var o=e.cy;e.webgl&&(o.zoom()>kd?(fm(e),t.call(e,i)):(pm(e),Rd(e,i,xr.SCREEN)))}}{var n=e.matchCanvasSize;e.matchCanvasSize=function(i){n.call(e,i),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0}}e.findNearestElements=function(i,o,u,l){return xm(e,i,o)};{var r=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){r.call(e),e.pickingFrameBuffer.needsDraw=!0}}{var a=e.notify;e.notify=function(i,o){a.call(e,i,o),i==="viewport"||i==="bounds"?e.pickingFrameBuffer.needsDraw=!0:i==="background"&&e.drawing.invalidate(o,{type:"node-body"})}}}function fm(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function pm(e){var t=function(n){n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,e.canvasWidth,e.canvasHeight),n.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}function gm(e){var t=e.canvasWidth,n=e.canvasHeight,r=ys(e),a=r.pan,i=r.zoom,o=xo();ga(o,o,[a.x,a.y]),jo(o,o,[i,i]);var u=xo();em(u,t,n);var l=xo();return Jy(l,u,o),l}function Md(e,t){var n=e.canvasWidth,r=e.canvasHeight,a=ys(e),i=a.pan,o=a.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(i.x,i.y),t.scale(o,o)}function vm(e,t){e.drawSelectionRectangle(t,function(n){return Md(e,n)})}function ym(e){var t=e.data.contexts[e.NODE];t.save(),Md(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 mm(e){var t=function(r,a,i){for(var o=r.atlasManager.getAtlasCollection(a),u=e.data.contexts[e.NODE],l=o.atlases,s=0;s<l.length;s++){var c=l[s],d=c.canvas;if(d){var h=d.width,f=d.height,p=h*s,v=d.height*i,m=.4;u.save(),u.scale(m,m),u.drawImage(d,p,v),u.strokeStyle="black",u.rect(p,v,h,f),u.stroke(),u.restore()}}},n=0;t(e.drawing,"node",n++),t(e.drawing,"label",n++)}function bm(e,t,n,r,a){var i,o,u,l,s=ys(e),c=s.pan,d=s.zoom;{var h=qy(e,c,d,t,n),f=$e(h,2),p=f[0],v=f[1],m=6;i=p-m/2,o=v-m/2,u=m,l=m}if(u===0||l===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),Rd(e,null,xr.PICKING),e.pickingFrameBuffer.needsDraw=!1);var y=u*l,b=new Uint8Array(y*4);g.readPixels(i,o,u,l,g.RGBA,g.UNSIGNED_BYTE,b),g.bindFramebuffer(g.FRAMEBUFFER,null);for(var w=new Set,k=0;k<y;k++){var C=b.slice(k*4,k*4+4),x=Gy(C)-1;x>=0&&w.add(x)}return w}function xm(e,t,n){var r=bm(e,t,n),a=e.getCachedZSortedEles(),i,o,u=Ct(r),l;try{for(u.s();!(l=u.n()).done;){var s=l.value,c=a[s];if(!i&&c.isNode()&&(i=c),!o&&c.isEdge()&&(o=c),i&&o)break}}catch(d){u.e(d)}finally{u.f()}return[i,o].filter(Boolean)}function Co(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawNode(n,t,"node-underlay"),r.drawNode(n,t,"node-body"),r.drawTexture(n,t,"label"),r.drawNode(n,t,"node-overlay")):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,"source"),r.drawEdgeArrow(n,t,"target"),r.drawTexture(n,t,"label"),r.drawTexture(n,t,"edge-source-label"),r.drawTexture(n,t,"edge-target-label"))}function Rd(e,t,n){var r;e.webglDebug&&(r=performance.now());var a=e.drawing,i=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&vm(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var o=e.data.contexts[e.WEBGL];n.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 u=gm(e),l=e.getCachedZSortedEles();if(i=l.length,a.startFrame(u,n),n.screen){for(var s=0;s<l.nondrag.length;s++)Co(e,s,l.nondrag[s]);for(var c=0;c<l.drag.length;c++)Co(e,c,l.drag[c])}else if(n.picking)for(var d=0;d<l.length;d++)Co(e,d,l[d]);a.endFrame(),n.screen&&e.webglDebugShowAtlases&&(ym(e),mm(e)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var h=performance.now(),f=!1,p=Math.ceil(h-r),v=a.getDebugInfo(),m=["".concat(i," 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(f)console.log("WebGL (".concat(n.name,") - time ").concat(p,"ms, ").concat(m));else{console.log("WebGL (".concat(n.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),b;try{for(y.s();!(b=y.n()).done;){var w=b.value;console.log(" ".concat(w.type,": ").concat(w.keyCount," keys, ").concat(w.atlasCount," atlases"))}}catch(k){y.e(k)}finally{y.f()}console.log("")}}e.data.gc&&(console.log("Garbage Collect!"),e.data.gc=!1,a.gc())}var yn={};yn.drawPolygonPath=function(e,t,n,r,a,i){var o=r/2,u=a/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*i[0],n+u*i[1]);for(var l=1;l<i.length/2;l++)e.lineTo(t+o*i[l*2],n+u*i[l*2+1]);e.closePath()};yn.drawRoundPolygonPath=function(e,t,n,r,a,i,o){o.forEach(function(u){return pd(e,u)}),e.closePath()};yn.drawRoundRectanglePath=function(e,t,n,r,a,i){var o=r/2,u=a/2,l=i==="auto"?un(r,a):Math.min(i,u,o);e.beginPath&&e.beginPath(),e.moveTo(t,n-u),e.arcTo(t+o,n-u,t+o,n,l),e.arcTo(t+o,n+u,t,n+u,l),e.arcTo(t-o,n+u,t-o,n,l),e.arcTo(t-o,n-u,t,n-u,l),e.lineTo(t,n-u),e.closePath()};yn.drawBottomRoundRectanglePath=function(e,t,n,r,a,i){var o=r/2,u=a/2,l=i==="auto"?un(r,a):i;e.beginPath&&e.beginPath(),e.moveTo(t,n-u),e.lineTo(t+o,n-u),e.lineTo(t+o,n),e.arcTo(t+o,n+u,t,n+u,l),e.arcTo(t-o,n+u,t-o,n,l),e.lineTo(t-o,n-u),e.lineTo(t,n-u),e.closePath()};yn.drawCutRectanglePath=function(e,t,n,r,a,i,o){var u=r/2,l=a/2,s=o==="auto"?rs():o;e.beginPath&&e.beginPath(),e.moveTo(t-u+s,n-l),e.lineTo(t+u-s,n-l),e.lineTo(t+u,n-l+s),e.lineTo(t+u,n+l-s),e.lineTo(t+u-s,n+l),e.lineTo(t-u+s,n+l),e.lineTo(t-u,n+l-s),e.lineTo(t-u,n-l+s),e.closePath()};yn.drawBarrelPath=function(e,t,n,r,a){var i=r/2,o=a/2,u=t-i,l=t+i,s=n-o,c=n+o,d=Do(r,a),h=d.widthOffset,f=d.heightOffset,p=d.ctrlPtOffsetPct*h;e.beginPath&&e.beginPath(),e.moveTo(u,s+f),e.lineTo(u,c-f),e.quadraticCurveTo(u+p,c,u+h,c),e.lineTo(l-h,c),e.quadraticCurveTo(l-p,c,l,c-f),e.lineTo(l,s+f),e.quadraticCurveTo(l-p,s,l-h,s),e.lineTo(u+h,s),e.quadraticCurveTo(u+p,s,u,s+f),e.closePath()};var Hu=Math.sin(0),Ku=Math.cos(0),qo={},Uo={},Id=Math.PI/40;for(var Xn=0*Math.PI;Xn<2*Math.PI;Xn+=Id)qo[Xn]=Math.sin(Xn),Uo[Xn]=Math.cos(Xn);yn.drawEllipsePath=function(e,t,n,r,a){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,a/2,0,0,2*Math.PI);else for(var i,o,u=r/2,l=a/2,s=0*Math.PI;s<2*Math.PI;s+=Id)i=t-u*qo[s]*Hu+u*Uo[s]*Ku,o=n+l*Uo[s]*Hu+l*qo[s]*Ku,s===0?e.moveTo(i,o):e.lineTo(i,o);e.closePath()};var Yr={};Yr.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]};Yr.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements(),r=n.boundingBox(),a=this.findContainerClientCoords(),i=e.full?Math.ceil(r.w):a[2],o=e.full?Math.ceil(r.h):a[3],u=ne(e.maxWidth)||ne(e.maxHeight),l=this.getPixelRatio(),s=1;if(e.scale!==void 0)i*=e.scale,o*=e.scale,s=e.scale;else if(u){var c=1/0,d=1/0;ne(e.maxWidth)&&(c=s*e.maxWidth/i),ne(e.maxHeight)&&(d=s*e.maxHeight/o),s=Math.min(c,d),i*=s,o*=s}u||(i*=l,o*=l,s*=l);var h=document.createElement("canvas");h.width=i,h.height=o,h.style.width=i+"px",h.style.height=o+"px";var f=h.getContext("2d");if(i>0&&o>0){f.clearRect(0,0,i,o),f.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)f.translate(-r.x1*s,-r.y1*s),f.scale(s,s),this.drawElements(f,p),f.scale(1/s,1/s),f.translate(r.x1*s,r.y1*s);else{var v=t.pan(),m={x:v.x*s,y:v.y*s};s*=t.zoom(),f.translate(m.x,m.y),f.scale(s,s),this.drawElements(f,p),f.scale(1/s,1/s),f.translate(-m.x,-m.y)}e.bg&&(f.globalCompositeOperation="destination-over",f.fillStyle=e.bg,f.rect(0,0,i,o),f.fill())}return h};function wm(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),a=new Uint8Array(r),i=0;i<n.length;i++)a[i]=n.charCodeAt(i);return new Blob([r],{type:t})}function Zu(e){var t=e.indexOf(",");return e.substr(t+1)}function Ld(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new tr(function(a,i){try{t.toBlob(function(o){o!=null?a(o):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},n,e.quality)}catch(o){i(o)}});case"blob":return wm(Zu(r()),n);case"base64":return Zu(r());case"base64uri":default:return r()}}Yr.png=function(e){return Ld(e,this.bufferCanvasImage(e),"image/png")};Yr.jpg=function(e){return Ld(e,this.bufferCanvasImage(e),"image/jpeg")};var Nd={};Nd.nodeShapeImpl=function(e,t,n,r,a,i,o,u){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,a,i);case"polygon":return this.drawPolygonPath(t,n,r,a,i,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,a,i,o,u);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,a,i,u);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,a,i,o,u);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,a,i,u);case"barrel":return this.drawBarrelPath(t,n,r,a,i)}};var Em=Od,Ce=Od.prototype;Ce.CANVAS_LAYERS=3;Ce.SELECT_BOX=0;Ce.DRAG=1;Ce.NODE=2;Ce.WEBGL=3;Ce.CANVAS_TYPES=["2d","2d","2d","webgl2"];Ce.BUFFER_COUNT=3;Ce.TEXTURE_BUFFER=0;Ce.MOTIONBLUR_BUFFER_NODE=1;Ce.MOTIONBLUR_BUFFER_DRAG=2;function Od(e){var t=this,n=t.cy.window(),r=n.document;e.webgl&&(Ce.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:new Array(Ce.CANVAS_LAYERS),contexts:new Array(Ce.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Ce.CANVAS_LAYERS),bufferCanvases:new Array(Ce.BUFFER_COUNT),bufferContexts:new Array(Ce.CANVAS_LAYERS)};var a="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";t.data.canvasContainer=r.createElement("div");var o=t.data.canvasContainer.style;t.data.canvasContainer.style[a]=i,o.position="relative",o.zIndex="0",o.overflow="hidden";var u=e.cy.container();u.appendChild(t.data.canvasContainer),u.style[a]=i;var l={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};gh()&&(l["-ms-touch-action"]="none",l["touch-action"]="none");for(var s=0;s<Ce.CANVAS_LAYERS;s++){var c=t.data.canvases[s]=r.createElement("canvas"),d=Ce.CANVAS_TYPES[s];t.data.contexts[s]=c.getContext(d),t.data.contexts[s]||qe("Could not create canvas of type "+d),Object.keys(l).forEach(function(V){c.style[V]=l[V]}),c.style.position="absolute",c.setAttribute("data-id","layer"+s),c.style.zIndex=String(Ce.CANVAS_LAYERS-s),t.data.canvasContainer.appendChild(c),t.data.canvasNeedsRedraw[s]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[Ce.NODE].setAttribute("data-id","layer"+Ce.NODE+"-node"),t.data.canvases[Ce.SELECT_BOX].setAttribute("data-id","layer"+Ce.SELECT_BOX+"-selectbox"),t.data.canvases[Ce.DRAG].setAttribute("data-id","layer"+Ce.DRAG+"-drag"),t.data.canvases[Ce.WEBGL]&&t.data.canvases[Ce.WEBGL].setAttribute("data-id","layer"+Ce.WEBGL+"-webgl");for(var s=0;s<Ce.BUFFER_COUNT;s++)t.data.bufferCanvases[s]=r.createElement("canvas"),t.data.bufferContexts[s]=t.data.bufferCanvases[s].getContext("2d"),t.data.bufferCanvases[s].style.position="absolute",t.data.bufferCanvases[s].setAttribute("data-id","buffer"+s),t.data.bufferCanvases[s].style.zIndex=String(-s-1),t.data.bufferCanvases[s].style.visibility="hidden";t.pathsEnabled=!0;var h=bt(),f=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 O=V[0]._private,z=O.oldBackgroundTimestamp===O.backgroundTimestamp;return!z},m=function(V){return V[0]._private.nodeKey},g=function(V){return V[0]._private.labelStyleKey},y=function(V){return V[0]._private.sourceLabelStyleKey},b=function(V){return V[0]._private.targetLabelStyleKey},w=function(V,O,z,H,te){return t.drawElement(V,O,z,!1,!1,te)},k=function(V,O,z,H,te){return t.drawElementText(V,O,z,H,"main",te)},C=function(V,O,z,H,te){return t.drawElementText(V,O,z,H,"source",te)},x=function(V,O,z,H,te){return t.drawElementText(V,O,z,H,"target",te)},P=function(V){return V.boundingBox(),V[0]._private.bodyBounds},B=function(V){return V.boundingBox(),V[0]._private.labelBounds.main||h},D=function(V){return V.boundingBox(),V[0]._private.labelBounds.source||h},_=function(V){return V.boundingBox(),V[0]._private.labelBounds.target||h},T=function(V,O){return O},S=function(V){return f(P(V))},A=function(V,O,z){var H=V?V+"-":"";return{x:O.x+z.pstyle(H+"text-margin-x").pfValue,y:O.y+z.pstyle(H+"text-margin-y").pfValue}},N=function(V,O,z){var H=V[0]._private.rscratch;return{x:H[O],y:H[z]}},R=function(V){return A("",N(V,"labelX","labelY"),V)},M=function(V){return A("source",N(V,"sourceLabelX","sourceLabelY"),V)},L=function(V){return A("target",N(V,"targetLabelX","targetLabelY"),V)},I=function(V){return p(P(V))},j=function(V){return p(D(V))},F=function(V){return p(_(V))},Y=function(V){var O=B(V),z=p(B(V));if(V.isNode()){switch(V.pstyle("text-halign").value){case"left":z.x=-O.w-(O.leftPad||0);break;case"right":z.x=-(O.rightPad||0);break}switch(V.pstyle("text-valign").value){case"top":z.y=-O.h-(O.topPad||0);break;case"bottom":z.y=-(O.botPad||0);break}}return z},W=t.data.eleTxrCache=new yr(t,{getKey:m,doesEleInvalidateKey:v,drawElement:w,getBoundingBox:P,getRotationPoint:S,getRotationOffset:I,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),Q=t.data.lblTxrCache=new yr(t,{getKey:g,drawElement:k,getBoundingBox:B,getRotationPoint:R,getRotationOffset:Y,isVisible:T}),$=t.data.slbTxrCache=new yr(t,{getKey:y,drawElement:C,getBoundingBox:D,getRotationPoint:M,getRotationOffset:j,isVisible:T}),Z=t.data.tlbTxrCache=new yr(t,{getKey:b,drawElement:x,getBoundingBox:_,getRotationPoint:L,getRotationOffset:F,isVisible:T}),J=t.data.lyrTxrCache=new Td(t);t.onUpdateEleCalcs(function(V,O){W.invalidateElements(O),Q.invalidateElements(O),$.invalidateElements(O),Z.invalidateElements(O),J.invalidateElements(O);for(var z=0;z<O.length;z++){var H=O[z]._private;H.oldBackgroundTimestamp=H.backgroundTimestamp}});var re=function(V){for(var O=0;O<V.length;O++)J.enqueueElementRefinement(V[O].ele)};W.onDequeue(re),Q.onDequeue(re),$.onDequeue(re),Z.onDequeue(re),e.webgl&&t.initWebgl(e,{getStyleKey:m,getLabelKey:g,getSourceLabelKey:y,getTargetLabelKey:b,drawElement:w,drawLabel:k,drawSourceLabel:C,drawTargetLabel:x,getElementBox:P,getLabelBox:B,getSourceLabelBox:D,getTargetLabelBox:_,getElementRotationPoint:S,getElementRotationOffset:I,getLabelRotationPoint:R,getSourceLabelRotationPoint:M,getTargetLabelRotationPoint:L,getLabelRotationOffset:Y,getSourceLabelRotationOffset:j,getTargetLabelRotationOffset:F})}Ce.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[Ce.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[Ce.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[Ce.SELECT_BOX]=t;break;case"gc":n.data.gc=!0;break}};var km=typeof Path2D<"u";Ce.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e};Ce.usePaths=function(){return km&&this.pathsEnabled};Ce.setImgSmoothing=function(e,t){e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)};Ce.getImgSmoothing=function(e){return e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled};Ce.makeOffscreenCanvas=function(e,t){var n;if((typeof OffscreenCanvas>"u"?"undefined":tt(OffscreenCanvas))!=="undefined")n=new OffscreenCanvas(e,t);else{var r=this.cy.window(),a=r.document;n=a.createElement("canvas"),n.width=e,n.height=t}return n};[Cd,jt,Zt,vs,Mn,vn,xt,Ad,yn,Yr,Nd].forEach(function(e){ge(Ce,e)});var Tm=[{name:"null",impl:dd},{name:"base",impl:wd},{name:"canvas",impl:Em}],Cm=[{type:"layout",extensions:Zv},{type:"renderer",extensions:Tm}],zd={},Vd={};function Fd(e,t,n){var r=n,a=function(x){Ne("Can not register `"+t+"` for `"+e+"` since `"+x+"` already exists in the prototype and can not be overridden")};if(e==="core"){if(Dr.prototype[t])return a(t);Dr.prototype[t]=n}else if(e==="collection"){if(ut.prototype[t])return a(t);ut.prototype[t]=n}else if(e==="layout"){for(var i=function(x){this.options=x,n.call(this,x),De(this._private)||(this._private={}),this._private.cy=x.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(n.prototype),u=[],l=0;l<u.length;l++){var s=u[l];o[s]=o[s]||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=n.prototype.stop;o.stop=function(){var x=this.options;if(x&&x.animate){var P=this.animations;if(P)for(var B=0;B<P.length;B++)P[B].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 d=function(x){return x._private.cy},h={addEventFields:function(x,P){P.layout=x,P.cy=d(x),P.target=x},bubble:function(){return!0},parent:function(x){return d(x)}};ge(o,{createEmitter:function(){return this._private.emitter=new Fa(h,this),this},emitter:function(){return this._private.emitter},on:function(x,P){return this.emitter().on(x,P),this},one:function(x,P){return this.emitter().one(x,P),this},once:function(x,P){return this.emitter().one(x,P),this},removeListener:function(x,P){return this.emitter().removeListener(x,P),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(x,P){return this.emitter().emit(x,P),this}}),Le.eventAliasesOn(o),r=i}else if(e==="renderer"&&t!=="null"&&t!=="base"){var f=Xd("renderer","base"),p=f.prototype,v=n,m=n.prototype,g=function(){f.apply(this,arguments),v.apply(this,arguments)},y=g.prototype;for(var b in p){var w=p[b],k=m[b]!=null;if(k)return a(b);y[b]=w}for(var C in m)y[C]=m[C];p.clientFunctions.forEach(function(x){y[x]=y[x]||function(){qe("Renderer does not implement `renderer."+x+"()` on its prototype")}}),r=g}else if(e==="__proto__"||e==="constructor"||e==="prototype")return qe(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return ic({map:zd,keys:[e,t],value:r})}function Xd(e,t){return oc({map:zd,keys:[e,t]})}function Pm(e,t,n,r,a){return ic({map:Vd,keys:[e,t,n,r],value:a})}function _m(e,t,n,r){return oc({map:Vd,keys:[e,t,n,r]})}var Wo=function(){if(arguments.length===2)return Xd.apply(null,arguments);if(arguments.length===3)return Fd.apply(null,arguments);if(arguments.length===4)return _m.apply(null,arguments);if(arguments.length===5)return Pm.apply(null,arguments);qe("Invalid extension access syntax")};Dr.prototype.extension=Wo;Cm.forEach(function(e){e.extensions.forEach(function(t){Fd(e.type,t.name,t.impl)})});var Da=function(){if(!(this instanceof Da))return new Da;this.length=0},An=Da.prototype;An.instanceString=function(){return"stylesheet"};An.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this};An.css=function(e,t){var n=this.length-1;if(fe(e))this[n].properties.push({name:e,value:t});else if(De(e))for(var r=e,a=Object.keys(r),i=0;i<a.length;i++){var o=a[i],u=r[o];if(u!=null){var l=it.properties[o]||it.properties[Aa(o)];if(l!=null){var s=l.name,c=u;this[n].properties.push({name:s,value:c})}}}return this};An.style=An.css;An.generateStyle=function(e){var t=new it(e);return this.appendToStyle(t)};An.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,a=n.properties;e.selector(r);for(var i=0;i<a.length;i++){var o=a[i];e.css(o.name,o.value)}}return e};var Bm="3.33.1",Jn=function(e){if(e===void 0&&(e={}),De(e))return new Dr(e);if(fe(e))return Wo.apply(Wo,arguments)};Jn.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(Jn),e.apply(null,t),this};Jn.warnings=function(e){return fc(e)};Jn.version=Bm;Jn.stylesheet=Jn.Stylesheet=Da;export{Jn as e};
|